Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/18/19 in all areas

  1. You'll probably need some math. What you probably want is kind of a responsive GUI. For example, if you want a button that's always in the top right corner of your screen you'd calculate x and y like this: y = yOffset;. x = this.width - buttonWidht - xOffset; However, the way most guis work everything is centered. So to get the center you'd use: y = this.height / 2; x = this.width / 2; And place your things according to this. This way the items will always stay relative to the center.
    2 points
  2. The installer seems to create a version JSON that is incorrect, or at least that the launcher doesn't like. Steps: Move current .minecraft directory out of the way. Launch the official Minecraft launcher, log in, launch the game once and quit. Grab https://files.minecraftforge.net/maven/net/minecraftforge/forge/1.13.2-25.0.26/forge-1.13.2-25.0.26-installer.jar and run it. Notice the installer says it installed successfully. Launch the Minecraft launcher again. Notice that forge doesn't launch and when you edit the profile the version of forge is not there (even though when you look at the profile list it looks right). Notice the crash log. Crash log: Workaround: Edit the version json to put "http://files.minecraftforge.net/maven/" in the url field for forge (corresponding to source code line https://github.com/MinecraftForge/MinecraftForge/blob/1.13.x/build.gradle#L492) With the file saved, re-launch the launcher. Play modded minecraft.
    1 point
  3. https://github.com/MinecraftForge/MinecraftForge/issues/5470 As far as I can tell this bug has been fixed so you just need to simply update your forge instead of manually adding things to that map.
    1 point
  4. Are you doing the Item.BLOCK_TO_ITEM thing?
    1 point
  5. Here is my item block code. This loads into my tab @SubscribeEvent public static void registerItems(final RegistryEvent.Register<Item> event) { event.getRegistry().registerAll ( ItemList.tutorial_block = new ItemBlock(BlockList.tutorial_block, new Item.Properties().group(tutorial)).setRegistryName(BlockList.tutorial_block.getRegistryName()) ); Item.BLOCK_TO_ITEM.put(BlockList.tutorial_block, ItemList.tutorial_block); }
    1 point
  6. - Where are you calling this? This gets the player on the client, and therefore will not work in multiplayer. Get the player from the appropriate event/parameter of the method/wherever you are using that line. - Armor index [0, 3] is: 3: Helmet 2: Chestplate 1: Leggings 0: Boots So if you want to set something to the leggings part, do player.inventory.armorInventory.set(2, itemStack);
    1 point
  7. You're saying the equivalent of “Build me an airplane then I’ll go and learn how to build one myself”. That information is Get the armor slot index and call Minecraft.getInstance().player.inventory.armorInventory.set(armorIndex, itemStack); Note: Minecraft.getInstance and everything else from that snippet is from 1.13 mappings. Names may not be the same in your version (Minecraft.getInstance is Minecraft.getMinecraft on <1.13)
    1 point
  8. It looks like TagCollection#getOwningTags does this, but it's a client-only method so you'll need to copy its logic rather than call it directly. This iterates through all registered tags of the TagCollection's type, so you may need to cache the results if you call this frequently.
    1 point
  9. EntityType.create(NBTTagCompound, World)
    1 point
  10. 1. Do NOT use static initializers. 2. 1.12.2: event.getTooltip.add(String); 1.13.2: event.getTooltip.add(ITextComponent);
    1 point
  11. It prevents you from overriding other classes. Say you want to create a custom elytra - well, you have to override ItemElytraWings(or whatever it's called) since minecraft uses a lot of instanceof checks. With your ItemBase though you can't. And now you have to duplicate your code for no good reason. It is not needed. You are just creating extra classes for no good reason. Why do you need it? Everything is now passed to the constructor via the corresponding Properties object and setRegistryName already returns you your object so you can chain it. It serves no purpose apart from enforcing cargo-cult programming. In general you shouldn't abuse inheritance just to write less code, that's not what inheritance is for. If you really need it create a helper method: public static <T extends IForgeRegistryEntry<T>> T setCommonParameters(T object, String registryName) { return object.setRegistryName(new ResourceLocation(TestMod.MODID, registryName)); } // In your registry handler event.getRegistry().register(setCommonParameters(new Item(new Item.Properties()), "test_item")); But even this is not needed since you can just do event.getRegistry().register(new Item(new Item.Properties().group(GroupsRef.GROUP_TEST_MOD)).setRegistryName(NAME_VOID_INGOT));
    1 point
  12. Those are builds for 1.3.2 from 2014, they're not for 1.13.2.
    1 point
  13. I am not sure this is the method's signature and you don't have an override annotation over it. Place that annotation and make sure the signature is correct. Also don't manually override methods, use your IDE. As for other issues: Don't use BlockBase, there is already a BlockBase, it's called Block. Don't ever use static initializers. Instantinate your stuff directly in the appropriate registry event. IHasModel is stupid. All items need models and nothing about model registration requires access to private/protected data. Register your models directly in the ModelRegistryEvent. You can even do it with a loop and write a metric ton less code. And even if you don't use a loop you still write 1/3 of the code you would with IHasModel.
    0 points
×
×
  • Create New...

Important Information

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