• 0

    posted a message on Unable To Get Current Blocks Tile Entity/MetaData? In Harvets Event Forge Hooks


    Ok So I got the blocks to stack and read nbt without nei and that part works. I need to know how to replace the title name on the Item based on the entity name. How Do I do this? I can grab the entity name had to do this for the work around in nie I just need to know how to set the tag so it displays as entityname + Monster Spawner.


    The best way to do this is probably to create a class that extends ItemReed and override Item#getItemStackDisplayName to translate the item name and entity name before concatenating and returning them. Look at ItemMonsterPlacer#getItemStackDisplayName for an example of this.

    Make your event handlers drop this item instead of the default ItemBlock form of Blocks.mob_spawner.

    Despite the name, ItemReed isn't just for reeds/sugar canes. It's very similar to ItemBlock, but instances of it won't be put in the map used by Item.getItemFromBlock and Block.getBlockFromItem. Due to this, it was renamed to ItemBlockSpecial in 1.9.

    I'm not sure why the XP reduction isn't working.
    Posted in: Modification Development
  • 0

    posted a message on Crash On Planting Crop

    In the first code snippet you passed null to the constructor (probably because ModBlocks.FireFern was null at the time), so the crops field was set to null. In the second code snippet you're probably still passing null to the constructor, but ModBlocks.FireFern wasn't null by the time it was referenced in onItemUse.


    Make sure you initialise your Blocks before your Items. If a Block needs to reference an Item, make sure it's done after the loading process has complete (i.e. after the Item has been initialised) rather than when the Block's constructor is called (i.e. before the Item has been initialised).


    If your plants only grow on your soil, consider calling EnumPlantType.getPlantType once in preInit to create a new EnumPlantType, storing it in a field and then using it in IPlantable#getPlantType and Block#canSustainPlant. Use your mod ID in the EnumPlantType's name to avoid conflicts with other mods' plant types.

    Posted in: Modification Development
  • 0

    posted a message on Crash On Planting Crop
    Quote from cj3636»

    It looks like the seed can't get the plants' default state. I can't figure out how to fix this.


    Which value is null? Where does that value come from? What would cause it to be null?
    Posted in: Modification Development
  • 0

    posted a message on Unable To Get Current Blocks Tile Entity/MetaData? In Harvets Event Forge Hooks

    It makes it have the argument in their of the player and then upon block break of the mobspawner it disappears and is still their. I need to detect it from nbt. Could you please tell me how to do this?


    EnchantmentHelper already reads the ItemStack's NBT to determine which enchantments it has.

    Post your current code (using Gist/Pastebin).
    Posted in: Modification Development
  • 0

    posted a message on Unable To Get Current Blocks Tile Entity/MetaData? In Harvets Event Forge Hooks

    Use EnchantmentHelper.getSilkTouchModifier to check if an entity's held item has Silk Touch on it.

    Posted in: Modification Development
  • 0

    posted a message on drawTexturedModalRect Draws Textures Weirdly

    The overload of Gui#drawTexturedModalRect you're using expects the bound texture to be 256x256. Use Gui.drawModalRectWithCustomSizedTexture for textures that aren't this size.


    On GitHub, you can click on a line number to get a link to that line. You can then shift click on another line number to get a link to that range of lines.

    Posted in: Modification Development
  • 0

    posted a message on [SOLVED] How To Disable Xp From Modded Block Drops Forge?

    Are any other mods handling BlockEvent.BreakEvent and setting the XP themselves?


    By the way, ItemStack#hasEffect tells you whether the item renders with the enchantment glint in the specified render pass. It doesn't tell you if the ItemStack has an Enchantment.

    Posted in: Modification Development
  • 0

    posted a message on Crash On Planting Crop
    Quote from cj3636»

    I am having the exact same issue and would like to see it resolved.


    Follow my instructions and resolve it yourself.
    Posted in: Modification Development
  • 0

    posted a message on Crash On Planting Crop

    Put a breakpoint on line 1828 of Block (in Block#canSustainPlant), run Minecraft in debug mode and try to plant your crop. When the breakpoint is hit, look at which value is null.

    Posted in: Modification Development
  • 0

    posted a message on Unable To Get Current Blocks Tile Entity/MetaData? In Harvets Event Forge Hooks

    Choonster Could you please tell me how to get around this?

    The method getEntityNameToSpawn() from the type MobSpawnerBaseLogic is not visible

    I got that error when trying to get mobspawnerbaselogic getenitytyname because, the string is private. How else can i get the entity name using 1.8+ code?


    You'll need to use reflection to call it.

    Now that I look at the spawner code more closely, a single spawner can spawn multiple types of entities. You should only use an NEI-compatible (metadata-based) spawner if MobSpawnerBaseLogic#getRandomEntity returns null and the MobSpawnerBaseLogic#minecartToSpawn list is empty (these are both private, you'll need to use reflection to access them); else use an NBT-based spawner.

    Despite the name, MobSpawnerBaseLogic#minecartToSpawn can be used for any type of entity; not just minecarts.

    To access a private field or method using reflection, call ReflectionHelper#findField or ReflectionHelper#findMethod and store the resulting Field/Method object in a private static final field (the instance argument of ReflectionHelper#findMethod is unused, just pass null). Use Field#get to get the current value of a field, passing the instance to get it from as the argument. Use Method#invoke to call a method, passing the instance to call it on and the arguments to pass to it as arguments.

    You must use the MCP and SRG names of a Minecraft field/method when accessing it via reflection. MCPBot can give you this information. Fields/methods added by Forge or other non-Minecraft code only have a single name, so just use this when accessing them via reflection.


    It already does that for me by itself but, I want to set the x y z cords upon block breaking to 0 0 0 so the blocks will stack once in my inventory how do I do this. Once that is fixed and you answer me on how to get entity name to spawn for nie I can release 1.8 and 1.8.9 ports of the mod.


    Simply call NBTTagCompound#setInteger or NBTTagCompound#removeTag for each coordinate tag after writing the spawner to NBT, before you add it to the ItemStack's NBT.

    Posted in: Modification Development
  • 0

    posted a message on What kind of model does Minecraft use?
    Quote from TheWesternWolf»

    Ok so if I got this right, items and blocks use a .json model, but only some entities can also use these models, if they are a certain kind (ex:RenderFallingBlock, RenderSnowball ) but all other entities use what kind? I am really sorry but I am very new at modding, is it a .class file? An example/video of a mob's model would be greatly appreciated.


    P.S: I want to know what model types are used in vanilla minecraft, not what models can be used via modding. Thanks for your patience


    Most entities use a class that extends ModelBase as their model, they don't use a regular model format. For examples, look at the classes that extend ModelBase.
    Posted in: Modification Development
  • 0

    posted a message on How to have custom ores generate in the minecraft world.
    Quote from Merp_Derpster»


    java.lang.NullPointerException: at index 0
    at com.google.common.collect.ObjectArrays.checkElementNotNull(ObjectArrays.java:240)
    at com.google.common.collect.ObjectArrays.checkElementsNotNull(ObjectArrays.java:231)
    at com.google.common.collect.ObjectArrays.checkElementsNotNull(ObjectArrays.java:226)
    at com.google.common.collect.ImmutableList.construct(ImmutableList.java:303)
    at com.google.common.collect.ImmutableList.copyOf(ImmutableList.java:258)
    at net.minecraftforge.fml.common.registry.GameRegistry.computeSortedGeneratorList(GameRegistry.java:135)
    at net.minecraftforge.fml.common.registry.GameRegistry.generateWorld(GameRegistry.java:109).


    It looks like you registered null as an IWorldGenerator.


    In future, please use Gist or Pastebin to post logs/crash reports (if applicable) and code with syntax highlighting. To get syntax highlighting on Gist, give each file the appropriate extension (.java for Java code). To get syntax highlighting on Pastebin, select the language from the dropdown at the bottom of the page.


    It's much easier to read code with proper formatting and syntax highlighting.

    Posted in: Modification Development
  • 1

    posted a message on What kind of model does Minecraft use?

    Most entities use model classes that extend ModelBase, rendered from classes that extend Render. You can create these using Tabula or by just writing the code yourself.


    Blocks and items use a separate baked model system, this supports JSON (a Minecraft-specific format), OBJ and B3D (general-purpose formats) models. You can also write a loader for any other format. You can create JSON models using one of the programs listed here or by writing them yourself. You can create OBJ or B3D models using mainstream 3D modelling programs like Blender and 3ds Max.


    Baked models can be animated using Forge's model animation system. The grammar of the Animation State Machine files is documented here. Forge has an example here (assets), there are also some examples linked here.


    An entity's Render class has direct access to OpenGL, so it can render anything, not just a ModelBase. RenderFallingBlock renders a block model, RenderSnowball and RenderPotion render an item model.

    Posted in: Modification Development
  • 1

    posted a message on Creating a Fluid
    Quote from cj3636»

    I got the fluid to render with a texture, but there is no animation. How do I get that to work?


    You need to use a texture with each frame of the animation stacked vertically and create the appropriate .mcmeta file to tell Minecraft it's animated. You can see some examples here or in Minecraft's textures.
    Posted in: Modification Development
  • 0

    posted a message on How do You Use getArmorInventoryList()?

    Use the for-each/enhanced for loop to iterate through an Iterable.

    Posted in: Modification Development
  • To post a comment, please .