Posted November 16, 20222 yr I am coding my own Mod with an Elytra Item and in My ElytraJumpC2SPacket.java i want to check if the player is wearing my custom Elytra with this line of code if(player.getInventory().armor.get(1) != ModItems.BAT_ELYTRA.get().getDefaultInstance() || player.getInventory().armor.get(1) != ModItems.ARMORED_BAT_ELYTRA.get().getDefaultInstance()) return; Full Code on GitHub In the game it doesn´t works I am using Forge 1.19.2 - 43.1.52(the latest) Edited November 16, 20222 yr by darkexplosiveqwx forgot something
November 16, 20222 yr You need to learn the different between reference == and value e.g. Object.equals() equality checks. Examples where reference equality works in Minecraft are things that go in registries, e.g. Block, Item, EntityType, etc. Examples where you need value equality are most other things, ItemStack, Entity, etc. because they have many instances. The code you want looks something like: Quote player.getItemBySlot(EquipmentSlot.CHEST).is(EXAMPLE_ITEM.get()) Look at the ItemStack class for other value equality checks. NOTE how Item == Item is acceptable, but ItemStack == ItemStack is not. Edited November 16, 20222 yr by warjort Boilerplate: If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one. If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install Large files should be posted to a file sharing site like https://gist.github.com You should also read the support forum sticky post.
November 16, 20222 yr Author I changed the .gitignore to upload the /logs/ and /crash-reports/ folders (located in master/run/logs/)
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.