Posted June 27, 20196 yr Hi All, I'm looking for some guidance here. I'm converting my mod from 1.12.2 --> 1.14.3 and have a question. I have an item that allows a player to open their EnderChest by right-clicking an item. The .openGUIChest doesn't exist in PlayerEntity in 1.14.3, and throws an error. Reading through PlayerEntity.java yields no insight, so I'm stuck. Suggestions? Here is my code: package com.kwpugh.gobber2.items.rings; import java.util.List; import com.kwpugh.gobber2.util.RayTraceUtil; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.inventory.EnderChestInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.potion.EffectInstance; import net.minecraft.potion.Effects; import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResultType; import net.minecraft.util.Hand; import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundEvents; import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.Vec3d; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.StringTextComponent; import net.minecraft.world.World; public class ItemCustomRingEnderman extends Item { public ItemCustomRingEnderman(Properties properties) { super(properties); } public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, Hand hand) { EnderChestInventory enderChest = player.getInventoryEnderChest(); if (enderChest != null) { if (!world.isRemote) { player.displayGUIChest(enderChest); //player.addStat(StatList.ENDERCHEST_OPENED); } } return new ActionResult<ItemStack>(ActionResultType.PASS, player.getHeldItem(hand)); } @Override public void addInformation(ItemStack stack, World world, List<ITextComponent> list, ITooltipFlag flag) { super.addInformation(stack, world, list, flag); list.add(new StringTextComponent("Provides player with a boost of speed")); list.add(new StringTextComponent("Right-click to use")); } }
June 28, 20196 yr Author Thanks for the pointer. I adapted some code there and added a static methods for field_220115_d. Thanks for the help. player.openContainer(new SimpleNamedContainerProvider((p_220114_1_, p_220114_2_, p_220114_3_) -> { return ChestContainer.createGeneric9X3(p_220114_1_, p_220114_2_, enderChest); }, field_220115_d));
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.