I have a mod that change chests inventories near the player when player press button.
All works fine, however, since I send custom packets to the server to manipulate chests inventory, mod, sure, should be installed both on client and dedicated server to work.
Because my mod do not add any block or whatever to the game, I start to think about making it client-side only.
Why I think it is possible?
Well, because one solution is already exist: manipulate player, simulate keypresses, simulate mouse movement etc.
But it's terrible, hacky, and hard solution. So I trying to avoid it and do job more directly.
For example, when I connect from client with my mod to the dedicated server without it, I can do something like:
if (keyBinding.isPressed()) {
Minecraft minecraft = Minecraft.getMinecraft();
EntityPlayerSP player = minecraft.thePlayer;
ItemStack itemStack = new ItemStack(Item.getItemById(20), 25); // 25 Glass
player.inventoryContainer.putStackInSlot(10, itemStack);
player.inventoryContainer.detectAndSendChanges();
}
And voila! Player got items, client side, no use network wrapper.
But when I look at "player.inventoryContainer", I can not understand what kind of dark magic goes inside.
Sure, I can not do something like because world object is client side:
World world = player.getEntityWorld();
BlockPos blockPos = new BlockPos(player.posX + 1, player.posY, player.posZ);
TileEntityChest tileEntityChest = (TileEntityChest) world.getTileEntity(blockPos);
tileEntityChest.setInventorySlotContents(10, itemStack);
So, question is:
How to add ItemStack to chest from client side without "NETWORK.registerMessage(MainMessage.Handler.class, MainMessage.class, 0, Side.SERVER)"..?
P.S: Sorry for my English.