Jump to content

Novârch

Members
  • Posts

    422
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by Novârch

  1. First of all, don't reference FMLJavaModLoadingContext directly from that class, put it as a parameter in the PotionRegistryHandler#init method, second of all, you never even register your potions by calling EFFECTS#register, and lastly, your DeferredRegisters have their names mixed up, the first one is for effects and the second one is for potions.

  2. You need an interface to make a capability, I'd say you should call it IPet, Pet should implement it and you should pass in IPet in @CapabilityInject and the first parameter of register. The interface should look something like this with what you're currently doing: 

    public interface IExample {
        EntityType<?> getEntityType();
    
        void setEntityType(EntityType<?> type);
    }

    strongly recommend you use generics instead if you can, something like this:

    public interface IExample {
        <T extends Entity> EntityType<T> getEntityType();
    
        <T extends Entity> void setEntityType(EntityType<T> type);
    }
    

    Ping me or something next post, I'll help you out if I can.

    Edit: Oh come on, solved as I was posting.

  3. 13 hours ago, VaalAlves said:

    If possible, could you please show me an example of a working ToolItem?

    private static final Set<Block> EFFECTIVE_ON = Sets.newHashSet(Blocks.OAK_PLANKS, Blocks.SPRUCE_PLANKS, Blocks.BIRCH_PLANKS)
    

    Pretty much the same as in AxeItem, edited some stuff to avoid breaching Mojang's copyright. Remember that you need a class that extends ToolItem (at least in 1.15, but I don't think that changed in 1.16).

    • Thanks 1
  4. 11 minutes ago, coderboy_yt said:

    Is there any way to move a mod from older edition of Minecraft Forge to a newer one?

    Of course there is, change some version numbers in your mods.toml and build.gradle and voila, you're on 1.16, it's pretty obvious which ones you should change, but if you aren't sure I recommend setting up a 1.16 project from the MDK and copying it from that. On a separate note, I personally recommend you stay away from 1.16 Forge until it gets a recommended release.

  5. 4 minutes ago, VaalAlves said:

    Here but i'm not sure how.

    It's just a parameter, pass it in, but you can't directly reference the one in AxeItem as it's private, if you really don't want to copy it, 

     

    1 hour ago, Novârch said:

    if you're super paranoid like me, use some reflection or AT's to get direct access to the field so you don't have to copy Mojang's code.

     

  6. Pretty easy, actually. You've got the random generation down, don't change it, as for the PlayerEntity#dropItem method requiring an ItemStack, if you took literally 1 second to look at ItemStack, you'd see that it has a constructor that takes in an Item.

      

    19 minutes ago, Darkrider000 said:

    ps. my reference also 1.12.2 version so I encounter lot of problem even if try to copy it as well

     

    If you can solve a crossword puzzle, you can translate 1.12 item code to 1.15, barely anything had changed (excluding metadata, of course).

  7. On 7/2/2019 at 9:28 AM, diesieben07 said:

    Currently there is indeed no client command handling in Forge, since vanilla's command handling was completely rewritten.

    As for tab completion... you would need a custom solution there as well, since vanilla's tab completion handling is very intertwined with the command system.

    Seems client commands are currently impossible.

    Edit: What about a keybind, I think you could use that.

  8. 3 minutes ago, VaalAlves said:

    And how would i make the blocks drop items only if they're broken with said custom tool type?

    You could copy the EFFECTIVE_ON field from AxeItem, ShovelItem or PickaxeItem and pass it into the ToolType constructor, or if you're super paranoid like me, use some reflection or AT's to get direct access to the field so you don't have to copy Mojang's code.

  9. 1 hour ago, Agreenstopsign said:

    yes I know that, however, replaceItemInInventory asks or a number (which represents the slot), and then the itemstack,
    I do not know what the number for a horses saddle/horse armor slot is

    Well look through the code and find out, it has to be somewhere, my guess is 0 for the saddle and 1 for the armor.

  10. 4 minutes ago, Same here said:

    Maybe there's something wrong with my statement,I've learned the basics of Java.My mod has written a lot of basic items and blocks.In fact ,I know that the alchemy bag stores item data through the player entity.But I want to konw how to make the custom capability which can stores itemstack.I've learned how to extend the player's attribute data through the NBT tag.But the NBT Tag ,but NBT data can only store data types.How can I store the itemstack to the playerentity?

    This is just from a first glance, so take it with a grain of salt, EE3 seems to write the player's UUID to the ItemStack-s NBT, this is very hard to follow because of the mods' heavy use of util classes, but can be deciphered with some time, I'll give you the link to the item on GitHub, beware it's for 1.12 though, but I think NBT hasn't really changed since day 1.

  11. 13 minutes ago, Same here said:

    I want to ask how to make a item which like AlchemicaBag in EE2?

     Make your own thread if you want help.

     

    13 minutes ago, Same here said:

    I can't understande the source code in the github

    If you can't understand the source it's very unlikely you can actually make it yourself, if you want to make a mod, learn Java, get acquainted with Forge and Minecraft, and then do what you want, asking for help when you don't understand Forge/Java will get you nowhere long-term.

  12. 1 minute ago, Blu3 said:

    public void func_1737_v_as(Matrix mouseY)

    1.16 is still in Beta and doesn't have real mappings ready yet, the current mappings are handmade, I honestly recommend you don't use 1.16 yet, but if you really want to you could fire up a Forge 1.15 project and look at the classes there, they're basically the same.

×
×
  • Create New...

Important Information

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