• 0

    posted a message on Getting String modid From Block Object Dynamically?

    I strongly recommend updating straight to 1.12.1, or at least 1.11.2. 1.10.2 is no longer being actively maintained.


    The FontRenderer#colorCode field contains the colours for each colour code. These are used by FontRenderer#renderStringAtPos, which is (indirectly) called by FontRenderer#drawString(String, float, float, int, boolean) and FontRenderer#renderStringAligned.


    The former is public and can be directly overridden, but the latter isn't; you'll need to override FontRenderer#drawSplitString (which indirectly calls it) instead.


    You'll need to extend FontRenderer and override these methods to do the same thing as the super methods, but call your own methods instead of FontRenderer's private methods. You'll need to handle the custom colour codes in your copy of the FontRenderer#renderStringAtPos method.

    Posted in: Modification Development
  • 1

    posted a message on Registering recipes using the JSON system with metadata

    I checked EntityList#init, and the id for chicken is "chicken". It worked in my development space like "id": "chicken". Is there any disadvantage to using this approach? (Future compatibility, etc.)

    The ID/registry name is converted to a ResourceLocation, so the domain defaults to minecraft if not specified. If you don't specify a domain, ItemMonsterPlacer will automatically replace the specified registry name with the full registry name (including the domain) when it's first accessed.

    It will work without specifying a domain, but it's best to be explicit.
    Posted in: Modification Development
  • 1

    posted a message on Registering recipes using the JSON system with metadata

    Thanks for your reply. So to use the EntityTag and id nbt data, would I do this?

    "item": "minecraft:spawn_egg",
    "nbt": {
           "EntityTag": {
                  "id": "Chicken"
           }
    }



    Chicken is the old name for EntityChicken, the current registry name is minecraft:chicken.

    See the wiki or the EntityList.init method for the registry names of vanilla entities.


    Apart from that, your NBT structure (and the JSON representation of it) are correct.

    Posted in: Modification Development
  • 0

    posted a message on Registering recipes using the JSON system with metadata

    Spawn Eggs don't use metadata in 1.9+, the registry name of the spawned entity is stored in NBT instead. Look at ItemMonsterPlacer#applyEntityIdToItemStack to see how the NBT structure is created.

    Posted in: Modification Development
  • 0

    posted a message on Keep Inventory if carrying an item

    PlayerEvent.Clone is fired when a player is cloned after respawning from death or returning from The End. You can use this to copy the inventory from the old player to the new one if they have the right item.

    Posted in: Modification Development
  • 0

    posted a message on Textures missing after gradlew built from eclipse
    Quote from Arkyo001379»

    Managed to fix textures by caps....really?!


    But why they render normally in eclipse?



    If you're using Windows, files on disk (e.g. assets in your development environment) have case-insensitive names. Files in JARs (e.g. assets in your compiled mod) always have case-sensitive names.
    Posted in: Modification Development
  • 0

    posted a message on Removing Fire Effect From Player With Charm

    Use Entity#extinguish to extinguish the fire on an Entity.

    Posted in: Modification Development
  • 0

    posted a message on Block properties (com.author.modname.blocks)

    IBlockProperties (which is extended by IBlockState) has a getter method for most properties. For other properties, look for getter methods in the Block class.

    Posted in: Modification Development
  • 1

    posted a message on JEI Integration - Crash when hover over the Recipe

    ToACraftingCategory#getTooltipStrings returns null, which causes this NullPointerException when JEI calls ArrayList#addAll(Collection<? extends E>) with the null value.


    JEI uses @Nonnull/@Nullable annotations, so your IDE should warn you about returning null from a @Nonnull method or an unannotated method overriding a @Nonnull method. You should use these annotations in your code as well, I recommend copying the package-info.java file from a vanilla package into every one of your packages so methods and parameters are @Nonnull by default.


    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
  • 0

    posted a message on Chisel 3 seemingly exceeding metadata length; I get java.lang.ArrayIndexOutOfBoundsException: 16 when I try

    Have you considered using the Chisel Team fork of Chisel instead of Chisel 3? It's already been updated to 1.10.2, 1.11.2 and 1.12 and is being actively maintained.

    Posted in: Modification Development
  • 1

    posted a message on Custom Entity Attack Damage

    You need to override EntityLivingBase#attackEntityAsMob to deal damage to the Entity argument.


    For examples, look at EntityWolf or EntityMob.

    Posted in: Modification Development
  • 0

    posted a message on Custom Entity Attack Damage

    Thank you for your response, and the advice. I am now getting an error on this line:

    AbstractAttributeMap.registerAttribute(SharedMonsterAttributes.ATTACK_DAMAGE);


    saying that I cannot make a static reference to the non-static method registerAttribute(IAttribute) from the type AbstractAttributeMap.


    I use Class#member to refer to non-static fields/methods of Class called member. I use Class.member to refer to static fields/methods.




    Would

    this.getAttributeMap().registerAttribute(SharedMonsterAttributes.ATTACK_DAMAGE);

    also have the same effect? This code complies just fine.



    Yes, that's what you need to do.
    Posted in: Modification Development
  • 0

    posted a message on Replacing Biome Foliage of Swamp ~ No ASM/Base Class Edits
    Quote from jredfox»

    Would Registering IBlock colors work with vanilla blocks or does it have to be my own blocks?

    You should be able to register your own IBlockColors for the vanilla Blocks to replace the vanilla IBlockColors.
    Posted in: Modification Development
  • 0

    posted a message on Custom Entity Attack Damage

    When asking for help with an exception, post the full exception and its stacktrace using Gist or Pastebin.


    The most likely issue is that you haven't registered the SharedMonsterAttributes.ATTACK_DAMAGE IAttribute for your entity, do this by calling AbstractAttributeMap#registerAttribute in your override of EntityLivingBase#applyEntityAttributes.


    You don't need to do this for the other IAttributes because they're already registered by the super classes.

    Posted in: Modification Development
  • 0

    posted a message on How to get the tile entity placer's name as a string?[FORGE 1.12][SOLVED]

    There are several issues with your code:

    • Strings can't be compared with the == operator, you need to use the String#equals method.
    • Don't convert objects to Strings to compare them, compare the objects directly.
    • TileEntity#getTileData is for storing your own data on external TileEntities (i.e. TileEntities added by vanilla or another mod), you should use regular fields to store data in your own TileEntities. It shouldn't really be used at all, the Capability System should be used to store your own data on external TileEntities.
    • UUIDs shouldn't be stored as Strings in NBT, they should be stored as a pair of longs (the most and least significant bits). NBTTagCompound has UUID-specific methods that do this for you.
    • When you have an if statement that does nothing but return true or false, you can simply return the value of the if statement's condition instead.

    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
  • To post a comment, please .