Jump to content

jhdoran

Members
  • Posts

    20
  • Joined

  • Last visited

Everything posted by jhdoran

  1. Draco's link was pretty clear, with screenshots. You need to learn how to use the debugger. You won't always be able to find someone willing to debug your program for you.
  2. Use the JSON recipe system whenever you can. There are examples in the assets package of vanilla Minecraft.
  3. Timezone? You can change the blockstate in a tick handler, and I think that would give you a resolution of 1/20 of a second. Not all blocks need to change at once as I believe that block state is working with the block metadata, not the main block instance.
  4. I stopped reading when I hit matches with variables: itemstack, itemStacks, itemstack1. None of these are descriptive. Slightly better than 11l1ll11, 1ll1l11l and 11llll1l1. If you are confused, it would help to unconfuse by rewriting the code so that it made sense. Variables like "flag" don't help. I believe I recognize the Furnace here, but that was obfuscated code to begin with.
  5. You were advised to clone the list. Therefore, don't make the new list public static final.
  6. I think a Git repository is in order. Right now its a piece of code here, a piece of code there. I'm not sure what you are trying to do. Nor do I know what events you are talking about.
  7. Are you leaf blocks opaque?
  8. Again, go look at ItemSword.
  9. It depends on the Item. Take a look at ItemSword. (There are no sets involved. You aren't looking at AttributeModifiers are you?)
  10. ItemStackHandler (not Helper, that is a different class) implements IItemHandler -- this is the Capability. If you walk up to a cow and ask for an inventory capability, it will hand you an ItemStackHandler. So this single ItemStackHandler is given to the cow early on (when it is constructed the capability will attach) in the form of a CapabilityProvider.
  11. Yes I did look at the pictures, but I would rather look at code. I commented on the code you posted. And since setRegistryName creates a resource location, creating one yourself before setting the name is going to create a rather messed up JSON name. But you said it is correct. And you didn't mention looking at the logs for exceptions. Or printing out the name. Or setting a breakpoint and checking...
  12. There's too much code not shown. But, what capability does MentalProvider provide? Looking at code that I've written, the provider wanted an implementation to associate with the entity. This object needed to be created and passed into the provider's constructor. Without this, it isn't clear what getCapability should later return.
  13. You are describing a problem with model loading (the textures are associated with the models). Loading a second model damages the first. So I look to see how you are loading the models, and see that the names don't look right. The names must match the JSON. So for example, if I am adding a stick: The item constructor sets the name to "stick", calls setUnlocalizedName("stick"), and setRegistryName("stick"). These values will be adjusted as needed. My stick.json is then used. If I mess up the name, then a number of things can happen, and will be reflected in the log file. Do you see JSON load exceptions? I'm just reacting to what seems excessive manipulation of the item name. Put a breakpoint before the call to setCustomModelResourceLocation and see what the location is.
  14. When I create a ModelResourceLocation, I pass in the registry name: ModelResourceLocation location = new ModelResourceLocation(item.getRegistryName(), id); System.out.println("setting resource location for model " + item.getUnlocalizedName()); ModelLoader.setCustomModelResourceLocation(item, metadata, location); The name, unlocalized name and registry name are all the same value: The name of the json without extension. setRegistryName already modifies the name to avoid collisions. Edit: I should clarify public ItemBase(String name) { this.name = name; setUnlocalizedName(name); setRegistryName(name);
  15. I've used new categories without problems. public static KeyBinding eventKey; ... eventKey = new KeyBinding("key." + Reference.MOD_ID + ".event", Keyboard.KEY_G, "key.categories." + Reference.MOD_ID); ClientRegistry.registerKeyBinding(eventKey); Is addKeys() even called? If so, you can register them at that point.
  16. With null pointer exceptions, something is null and being used. In general one should check references before using them. So, looking at the above code what comes to my mind is "what if the player doesn't have the capability?" You should be able to set a breakpoint at the line given in the error and see what is null, and then work backwards to see what went wrong. I'm betting on "mental"
  17. Creating a new ItemStackHandler in getCapability does not seem like a good idea. Anytime someone wants to use the inventory, they get a brand new one.
  18. I had odd looking rendering for translucent objects for which the above was not sufficient. As I recall the translucent material (glass in my case) appeared opaque and nothing was seen through it. @Override public BlockRenderLayer getBlockLayer() { return BlockRenderLayer.TRANSLUCENT; }
  19. Thanks, I feel better about that now.
  20. I am a bit puzzled on key binds in 1.12, and would like to check best practices. I do not see any registration events like I do for blocks, items, models. Every example I've studied has registered keybinds during Preinit which feels wrong given the registry changes in other areas. So I would appreciate some confirmation that I should perform my registration in Preinit, or alternately a suggestion for a registration event I should use. Thanks.
×
×
  • Create New...

Important Information

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