Jump to content

Recommended Posts

Posted (edited)

Recently I started Minecraft modding, one of the things I wanted to do was opening chests remotely. For example by using a command. The goal is to get all the items from the chest without actually being at its location. 

 

Currently I have done the following, this gets a chest location from the world and opens a chest gui. While this does open a chest gui, it opens the client chest and not server side, meaning there are no items in it.

 


        RayTraceResult objectMouseOver = player.rayTrace(5, 1); 

       	TileEntityChest te = (TileEntityChest) player.world.getTileEntity(objectMouseOver.getBlockPos());

        IInventory inv = null;

        if(te instanceof TileEntityChest) {
          TileEntityChest teChest = (TileEntityChest) te;
          inv = (IInventory) teChest;
        }
        IInventory finalInv = inv;

        Minecraft.getMinecraft().displayGuiScreen(new GuiChest(player.inventory, finalInv));
        

 

My question is, can I get the server side chest data or GUI within the code? And how to do this?

 

 

 

 

Edited by larsyuipo
Posted (edited)

where do you call that?

edit:

sorry do not read 1.12 cannot help you and generally it is not longer supported at this forum

Edited by Niprow
don't know 1.12

 I will make fun of you if you are not able to look into the (vanilla-) code.

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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