Jump to content

SanAndreaP

Forge Modder
  • Posts

    1689
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by SanAndreaP

  1. Instead of listing all of this, you can also look at the data you wanna put in as single bits, then connect those bits together (like I did), thus much less writing and the logic / result is the same
  2. You need to split up your uses: You need a flag for the state, which means 1 bit goes away. Then you need to determine which direction it should face, which means 2 bits go away Left is now 1 bit, so you can't store the size, which should be from 0-8 Means: state - 1 bit - xxx0 or xxx1 (1st bit is used) direction - 2 bits - x00x, x01x, x10x or x11x (2nd and 3rd bits are used) size - 4 bits - 0000, 0001, 0010, 0011, 0100, 0101, 0110, 0111, 1000 (no space for that information) If you really don't want to use TileEntities, you need to make multiple blocks, meaning you have to use your metadata efficiently, so that you don't need too much blocks! I suggest you stick with a size range of 0 to 7, so you have 1 bit left for the state: state - 1 bit - xxx0 or xxx1 (1st bit is used) size - 3 bits - 000x, 001x, 010x, 011x, 100x, 101x, 110x or 111x the direction is each a different block, so you have 4 different blocks (like the furnace has 2 blocks for the on/off state)
  3. AFAIK, the sounds.json goes next to your sounds folder, not into it, in your case like: E:\Forge\eclipse\WildAnimals\src\assets\wildanimals\sounds.json instead of E:\Forge\eclipse\WildAnimals\src\assets\wildanimals\sounds\sounds.json
  4. http://lmgtfy.com/?q=java+path
  5. Look at the RenderFallingSand code and how it did it. You can adopt the code with some changes in your block renderer.
  6. override getStrVsBlock(...) Look at the ItemTool class on how it did it (read the javadoc above the method).
  7. ^^ That's what I was trying to say, though in C++ you can pass a pointer by reference, in which case you can change the original pointer's address... the source of many a C++ coder's nightmares, to be sure Pretty sure anyway, it's been many many years since I've touched C++, so I might be terribly wrong about that statement. Yes, you can use the & as an operator in C++ like method(&pointer); B2T: Can we see your Item class, I'm pretty sure you forgot to override getUnlocalizedName(...) https://github.com/SanAndreasP/EnderStuffPlus/blob/master/java/sanandreasp/mods/EnderStuffPlus/item/ItemESPPearls.java#L81-L83 Also I suggest you don't use the LanguageRegistry anymore, since in 1.7 it's not there anymore and 1.6.4 already supports .lang files in your resource folder https://github.com/SanAndreasP/EnderStuffPlus/blob/master/resources/assets/enderstuffp/lang/en_US.lang
  8. In C++ that would be true, but in Java all variables are passed by value; for non-native types, the value is always a copy of the memory address (maybe not always, but I'm pretty sure that's the case). Unlike C++, you cannot pass by reference in Java, even when passing a memory address. Java is "pass by reference by value", as they like to say EDIT: Here is a link that explains it probably better than I am: http://stackoverflow.com/questions/40480/is-java-pass-by-reference You can test following: Change the stack size of the ItemStack argument -> it is also changed outside of the method: doSomething() { ItemStack stack = new ItemStack(Block.dirt, 1); incrStackSize(stack); System.out.println(stack.stackSize); // is now 64 here, too! } incrStackSize(ItemStack stack) { System.out.println(stack.stackSize); // is here 1 stack.stackSize = 64; System.out.println(stack.stackSize); // is now 64 } If you re-assign the "pointer", it will hold the new address of that reference! doSomething() { ItemStack stack = new ItemStack(Block.dirt, 1); incrStackSize(stack); System.out.println(stack.stackSize); // is still 1! } incrStackSize(ItemStack stack) { stack = new ItemStack(Block.sand, 64) System.out.println(stack.stackSize); // is here 64 } That is true for C++ pointers as well as for Java "pointers" The only exception is in VB.NET where you can say that a parameter of a method is a direct reference (ByRef) and thus you can actually assign a new reference, but that's another language entirely...
  9. Why? The solution was already provided previously, what's different in your code?
  10. Eclipse says it's not visibile Well, then it's changed in 1.7. Use sequituri's suggestion then.
  11. what? Please explain.
  12. mekanism.common.OreHandler.generate(OreHandler.java:28) Seems like one of your mods is causing the error. Remove those one by one to find out which one, then go to the respective mod thread and report the crash there
  13. How about you outsource the custom code within addRandomArmor() to a new method (like addCustomArmor()), call that method in addRandomArmor and also in entityInit() (whilst removing the addRandomArmor() from entityInit()) Seems like the super implementation of addRandomArmor() executes a bunch of code which could possibly cause a NPE during entity construction.
  14. You would need a TileEntity, saving the block instance which should be shown in there and in your blocks getBlockTexture method, grab the TileEntity, get the block from it and get the Icon from this block via blockInstance.getIcon()
  15. can I see your code (after manipulating the entityInit method)
  16. there's no "biomList" Also since when is biomeList not visible? You checked the BiomeGenBase class for it and made sure it's really not visible? If it isn't, is there a getter method?
  17. I know what the p_149699_1_ parameter is I still want to know what this "used" variable is for. Also add @Override to your methods you intend to override to check if they really get overridden!
  18. You could call your addRandomArmor() method within the entityInit() method.
  19. Don't bump after like 20 minutes -.- What is this used variable? Where is it (and the minutes variable) declared? If in the class, you know that this variable is not individually set for the specific block, but rather for all blocks? Try only p_149699_1_.getWorldInfo().setRainTime((minutes * 20) * 60); p_149699_1_.getWorldInfo().setRaining(false); in your onBlockClicked method and see if this is working.
  20. I have some code, which is definitely working: https://github.com/SanAndreasP/EnderStuffPlus/blob/master/java/sanandreasp/mods/EnderStuffPlus/tileentity/TileEntityWeatherAltar.java#L30-L48 EDIT: to explain what I did differently: You first need to set the duration of the rain and/or thunderstorm. And then use setRaining and/or setThundering Also the duration is the number in ticks, I multiplied the duration I have as a parameter, since my GUI shows it as seconds (20 ticks = 1 second)
  21. No, this will crash, since biomeList contains null values! Look here for a solution: http://www.minecraftforge.net/forum/index.php/topic,17455.msg88353.html#msg88353
  22. If you want to apply armor to a vanilla mob during spawn, use the LivingSpawnEvent.
  23. Seems like not many people know about this, so I'll drop this here: You can also use the ObfuscationReflectionHelper class instead of this try-catch block
  24. There's nothing stopping you making a PR, it either gets accepted or rejected.
×
×
  • Create New...

Important Information

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