Jump to content

Ernio

Forge Modder
  • Posts

    2638
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by Ernio

  1. Na! Just asking cuz I know there are some guys here who wouldn't use "alien" source. Expect link on Mail Box - let's say max 12 hours from now (it's 3:30AM here, and I don't know exacly when I'll upload it)
  2. Well, if you REALLY need it and you don't care where you will get it from I can upload fresh copy for you. Since 1.2.5 I've decided to save every fresh workspace so I've got like 3GB of Fresh forge workspaces Just tell me if you accept me as a source so I can upload it knowing someone will use it. File: MCP - Fresh - F.9.10.871 (145.5MB) Downloaded Forge and run install.cmd once (ready to open with eclipse).
  3. Looking at whole mining system makes me cry man Q.Q 1000 methods for one shit Anyway thanks for making me sure this code is trolling my brain
  4. I have no idea what you mean by custom folder, so I think you just mean assets of your mod, anyway: public class TestBlock extends Block { String texture; public TestBlock (int id, Material material, String t) { super(id, material); this.texture = t; } @SideOnly(Side.CLIENT) public void registerIcons(IconRegister iconRegister) { blockIcon = iconRegister.registerIcon("modname:" + texture); } } And then in modname.class public static final Block testBlock = new TestBlock(3000, Material.rock, "test"); Texture will be set from assets/modpack/textures/blocks/test.png Oh and to set Material as constant for all blocks just change public TestBlock (int id, String t) { super(id, Material.rock); this.texture = t; }
  5. ItemPickaxe when checking for getStrVsBlock() first checks if shit is Material.rock (and/or other materials) and then if it is not, it goes to super class and checks array of blocks which are exceptions. In that array there are blocks which have alredy been checked (they have Material.rock). I mean: If block is Material.rock then it will return efficiencyOnProperMaterial, and so why the hell they added blocks to array: public static final Block[] blocksEffectiveAgainst = new Block[] {Block.cobblestone, Block.stoneDoubleSlab, Block.stoneSingleSlab, etc.}; which alredy are Material.rock. It just seems pointless and unless it is used in other methods I want to know where I can find them (found nutnig for now).
  6. Well, my server is not planning on changing to 1.7+ (I am 1.6.4) so IF robustus manner will work and there will be no glitches (not using other mods, so no chance for incompatibility) I will stay on this, so thanks for that. As to if(!world.isRemote) - God i am retarded I forgot about it Thanks all Will report with result later
  7. Ok, thanks, will test it Now new topic: Next problem: When I am calling: public void onBlockDestroyedByPlayer(World world, int x, int y, int z, int m) It does it server and client side. Now when I put a Random int in it, it will be randomed 2 times (like all the other operations). This is not a big problem, because if a method is launcher 2 times only second result is the actuall result so my random is actually single (not a pair), but can I turn it off? Eg.: public void onBlockDestroyedByPlayer(World world, int x, int y, int z, int m) have some stuff in it which will tell if at the end of mining block it should hit some value that will transform it to an bomb (lol). Now when I launch Random Int and it hit value (true) this is hat I get: 1st Random 2nd Random true true It's cool false false It's cool false true } true false } Now with last two it is making minecraft glitch It sets block to bomb then it turns it again to normal, or it sets it to normal then to bomb. As I said: It's not THAT bad, but it's confusing :C
  8. Ok so maybe I'll take other approach: When making vanilia block replacement with my own, then if I define in MyBlockClass that it's ID is x, it will be x or it will stay vanilia? Same goes to CreativeTabs - will they change? Maybe I know how to override block, but to be honest I never used this: How exacly does it operate?
  9. Dude... ItemStack is not ant int, it's an OBJECT (java type). If yo uwant to eg. get specific block you do not write: ItemStack[1000] but: ItemStack[MyMod.Sword]
  10. So I know how to override them like Stone = MyStone, but now I want to delete one. Is it possible without raping system (game) to remove MAJOR blocks in game, where major is ex. Ore (gold)? If it's impossible then: Is it possible to remove it from CretaiveTabs? If not: Is it possible to make sure that NOONE will get it (even on creative), only possible scenario would be typing command Give ;p Also: NO ASM/Refle EDIT: RANDOM INT rage! Read my 3rd post.
  11. You ask (author) some strange questions lately - it's almost like you are lazy (lol) If you don't understand how TileEntity works in container and when and what is called I suggest opening: BlockFurncae.class ContainerFurnace.class FurnaceRecipes.class TileEntityFurnace.class Then go through code and in every method add System.out.println() on beggining and end, also before and after any method that is called by that method (see for what it asks, when, and what is the return). eg.: in onUpdate() in TileEntity write something like: public void updateEntity() { boolean flag = this.furnaceBurnTime > 0; boolean flag1 = false; System.out.println("Starting Updating Entity") if (this.furnaceBurnTime > 0) { System.out.println("Furnace is burning...") --this.furnaceBurnTime; } else System.out.println("Not burning") if (!this.worldObj.isRemote) { System.out.println("Checking if furnace is not burning and if not, and also there is fuel continue") if (this.furnaceBurnTime == 0 && this.canSmelt()) { this.currentItemBurnTime = this.furnaceBurnTime = getItemBurnTime(this.furnaceItemStacks[1]); Same goes to this.furnaceItemStacks[1] - if you add nice System.out.println() to it and put something in it you will figure out how it works. I am not helping here much (sorry) but belive me, if you want to have ability to code advanced stuff in future this will help very much (takes about few hours to figure out, but then you KNOW the code). And hit about this.furnaceItemStacks[] - when you are adding slots in your Container class this will be an array with size equal to how many slots you add. Let's have look: //In Container I have defined my slots like this public static final int FUEL[] = {0}; public static final int INPUT[] = {1,2,3,4,5,6}; public static final int OUTPUT[] = {7,8,9,10,11,12}; //Now in my TileEntity it's ArrayOfItemStacks = new ItemStack[13]; //Now ArrayOfItemStacks is a array {0,1,2,3,4,5,6,7,8,9,10,11,12}; where every ID is refering to those in Container.class Can't describe it more clearly :C
  12. Ernio

    Break Speed

    Well... How can I implement this Event into Block code? Let's say i want to Make block that (pseudocode): this.Hardness = 1.0F; @Override public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player) //TODO HARDNESS { //Gets y parameter of clicked block and performs an action that calls: PlayerEvent.BreakSpeed... { addModifierToBreakSpeed() //which will take actuall BreakSpeed (which is dependent on this.Hardness and Tool Efficiency) and multiply it depending on y coord } }
  13. Hello, quick: How can I edit Break Speed for SPECIFIC player? Hardness of block will depend on y coordinte (depth of world). All Pickaxes/GenericBlocks (stone too) are made by me and vanilia ones have been overriden so I can edit whole code. Also: getCurrentPlayerStrVsBlock() is not good here since it uses efficiency which is kinda lame solution :C net.minecraft.entity.player.EntityPlayer (if anyone is interested) Or maybe I am wrong? Maybe you could explain to me how it works and get my facts straight.
  14. Well, last time I checked Minecraft Launcher is NOT Minecraft Game. Since Forge is modification for Minecraft Game which is loaded by Launcher you cannot possibly make something that loads data in reverse without going into Launchers code. Thing you'll need here is to write whole new launcher and totally screw minecraft.net using your databases and then downloading game (non-premium) from your repo. Or you can make minecraft.net account checking AND your own in addition which wil be held in some variables that will be used by your Forge Mod inside Minecraft Game. I did thing described here, but this would take at least 10 hours (only if you are good) to write in GOOD way with whole graphics and nice handling of code (took me about 30h if not more to finish) Conclusion: Nope, you cannot modify launcher by forge. (Or am I wrong?)
  15. Well... just fuck it (sry), I've tried to make something too realistic, but such an accurate thing just can't exist in clean code, I'll just go with some freaky-close randoms system with some changing variables. That will be challenging maybe Excel will help <CLOSED> (sorry, explaining this mechanism would be too hard, and I belive that me spending week on it is alredy too much - and yeah, it's complicated math-mod) As I said I'll just creat close-value-function somehow ;O
  16. Yeah, I can count (and I did some math and testing via System.currentTimeMillis(), but still, I just NEED to ask before I get to work. I need to either save global array[biome][depth][value] or I need to make this array every time it is needed. Size is: array[20][256][100000] which will give us 51.200.000 values. Best compression available for my algorithm to work is byte (I prefere short). Now: Holding so many values in global array will take some MB of RAM (well not just some, a lot compared to rest of my mod). Is it better to just lose this memory and have full access to it all the time, or maybe to create whole array from for()for()for(), use it, and delete (memory saving and stuff). Algorithm is called everytime you destroy block (holy fuck that often, and I think that answers the question, but just give me your opinion)
  17. There are 2 ways of doing this: Either you use Forge to change GuiMainMenu to MyGuiMainMenu (using If's and Ticks) - this option will work only for one mod (yours) and will cause incompatibility with other MainMenu-changing-mods. Or you just change vanillia code and every time you instal your mod, you change minecraft.jar files :C Skipping to code: (I am refering to GuiMainMenu BaseClass editing, to make Ticking stuff with Forge you will just need to use proper methods, hope you know them) //In GuiMainMenu: private void addSingleplayerMultiplayerButtons(int par1, int par2) { //Add this, remember to move around your button to not hide it under others. this.buttonList.add(new GuiButton(ID, this.width / 2 - 100, par1, I18n.getString("MyServer"))); } protected void actionPerformed(GuiButton par1GuiButton) { //Add this: if (par1GuiButton.id == ID) { this.mc.displayGuiScreen(new GuiConnecting(this, mc, "myip.com", 12345)); //this number is port } } Well thats is
  18. Nope... sorry, I just spotted you alredy gave your code... looking at it now...
  19. OFFTOPIC (kinda) Well, what if I want to find coordinates of block player is clicking on when it's not TE? I mean - best way?
  20. I was making same thing, but that was like a year ago? (1.2.5) GuiMainMenu uses GuiConnecting which uses Threads that handle ip's and ports - in that times (1.2.5) there wasn't any method capable of doing what you want so I used it. But from what I remember (which is really sad) I added one boolean to vanillia code which is later used(Client.SIDE) by Forge mod (which checks if this is "the" server). Since that was a private server I just told them that whenever they make a new pack they should put this one file into minecraft.jar. This might be a solution if you won't find anything better. ;/ 2min in code and I got this: (Don't ask me, am just giving a hint ;p) ServerAddress.class public String getIP() { return this.ipAddress; } private static String[] getServerAddress(String par0Str)
  21. I wrote this for you - you can feel special //TileEntity public int Power; //Time needed to smelt an item public TileEntity() { //Other stuff Power = 200; //Well you need to declare first Power (I mean - maybe not, never checked) } //Since you need to check for stack in your [6] slot everytime they change I would suggest using updateEntity public void updateEntity() { //You need to call this right at the beggining! if(this.ItemStacks[6] != null) //Checks if Slot[6] is not null { if(this.ItemStacks[6].itemID == MyMod.booster.itemID) //Checks if there is booster inside - and yes - use freaking ID's, not getItem() -.- { int x = this.ItemStacks[6].stackSize; //Well, you wanted that: more boosters = faster smelting? this.Power = 200 - 2*x; //10sec - 1/5sec for every booster in slot [6] //It is VERY important to make sure that maxStackSize of booster will not make your Power go less than 1. //Here: with 64xbooster you will get 200-128-1=71 ticks to smelt item (-1 is from array index, or whatever you call it) } } else { this.Power = 200; //10sec } } This works perfectly! And I mean it - just checked in eclipse! Also: I did int x inside updateEntity - don't do that, make it global
  22. But... but... that means my mod is broken (so hard) :C Actually I was worried about it - but doesn't that mean that when I am setting Hardness like this: (pseudo) onBlockClicked() //y is coord - so obvious? { if (y<64} Hardness = 50.0F; else Hardness = 10.0F; } And one player starts mining one block on y<64 (50.F), almost finishes it and right before it breaks (half a second to break), second player starts mining other block which is y>=64 : shouldn't that reset the 1st player's block hardness to 10.0F? If you are right it should (or maybe it would auto-break it since time player 1 is mining his block is greater that time needed to mine block that player 2 is mining) - BUT it doesn't - either it is a glitch (and may cause problems) or I am missing something important. Also: sorry for offtop. ;p & also: thanks for reminder - my Ground block was written months ago and I forgot to make more tests.
  23. "Not use its methods to add/remove stuff, but 100% overdo it." Not sure if you are talking about rewriting GUI code or just replacing every Vanilia GUI with yours? If the 1st one - why do you use Forge then... I belive that's second one - visit this page http://www.minecraftforge.net/wiki/Gui_Overlay There are also methods for removing/adding other stuff - I am just not really sure what you want to do :L Please give an example
  24. Well if you are still "bothering with this shit" - MyStone1 is created by generator and stays that way. MyStone2 is a MyStone1 clicked by player but not changed to Ore. Example (depending on which one of described by me ways are you using): *Player starts mining MyStone1. *Random % is rolled and hits 5405 which is a empty result (MyStone1 doesn't change into Ore) *Well - that way you could hit it till it changes? And when you have MyStone2 you simply set that if MyStone1 will roll % which is not an Ore, it will change into MyStone2 - which is standard stone - that way you cannot click on block and wait till it's changed. MyStone1 with MyStone2 option was described only if you are setting block (chaging it from stone to ores) right before mining (onBlockClicked). If you are using option that set random loot before braking (onBlockDestroyedByPlayer) you won't need two stones. Also: most of X-rays base on Block IDs or resource data (what block.png is the block using). Its obvious that since all changes are called ONLY when player clicks/breaks a block it cannot be just found by ANY mod (including X-Rays). (WRONG) And about GotoLink thesis: Nope, I don't think so. Data travels through CPU (or other shit) in order, so if you reset and change hardness everytime its called it will be changed only for this certain block - you can call it everytime player starts to hit it and change it. And if you don't belive that data is sent in queues - well, this work's for me - no bugs/multi-loots/not-precised loots/other shit. Also little note about X-Ray: When I say "//Super-anti-x-ray - everything is invisible and happens inside code *_*" I mean it - there is NO program that can detect it.
  25. I think what are u tring to do is exacly same thing I did. Note I did this on 1.6.2 (I know some guy before me said something close to this) Stone - vanillia stone, My - referes to anything thats mod-made. *Create MyStone1 and MyStone2 //They will both use SAME textures as Stone MyStone1 will be used as a ,,general" stone and MyStone2 as a ,,touched" stone *Replace Stone with MyStone1 - now the world will generate it as a normal Stone which will drop CobbleStone *When you try to smelt CobbleStone into Stone you will get MyStone:0 (and we don't want that) you need to remove all recipes that use Stone (including buttons/slabs and other stuff - they will also use MyStone1 which is not for players to have) *Now you need to re-add all the recipes with small change: Everywhere there needs to be MyStone2. Note: what we have now is a MyStone1 which will drop some stuff and then if you try to craft other stone you'll get MyStone2 which DOESN'T have any special loot properties. Finally: *Add custom drops to MyStone1 - here is the fun stuff There are two fun methods you'll wanna use: //Called right before loots are set and dropped. (moment of breaking) onBlockDestroyedByPlayer(World world, int x, int y, int z, int m) or //Called when player click it (when he start to hit it or inspect it/right-click - well am not sure if right-click works here) onBlockClicked(World world, int x, int y, int z, EntityPlayer player) Now you must decide which you wanna use: If you want super Anti-X-Ray you will wanna use onBlockDestroyedByPlayer - block will always stay the same, and only will change if you actually destroy him (and by change i mean - switch its drops). If you want to be more Realistic you will use onBlockClicked - well, by that you could travel across the tunnels and click on walls to inspect them, and if you get lucky random the block will change into ore I am using both - why? Well why not... it's not like it is lagging server (only called whe you actually interact with block). I'm just gonna write pseudo-code Combine those two and BOOM!!! You are god ;O See also: Hope I covered everything you could actually think of when making a mining system
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.