Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

vilu

Forge Modder
  • Content Count

    84
  • Joined

  • Last visited

Community Reputation

12 Good

About vilu

  • Rank
    Stone Miner

Converted

  • Gender
    Male
  • Personal Text
    Modder

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Try changing your model name in your blockstate file. You are now referencing to minecraft's chest model, so "normal": { "model": "yourmodel_id_lowercased:block_model_file_name" }
  2. You could try IInventory#setInventorySlotContents(int, ItemStack) and then IInventory#markDirty Not sure if that would do the trick and I cannot check from my own sources how I did that syncing right now, but I can check next time when I'm back. But anyway, let me know if it doesn't work.
  3. You should pass it into the constructor of your Container, not GuiContainer(which is on the client-side). So in IGuiHandler#getServerGuiElement when you return new Container for server, you'll pass InventoryPlayer (I think you can get it from EntityPlayer#inventory) to your Container constructor.
  4. -> Server gets packet (that has pressed button ID for example) -> Packet has MessageContext ctx, so ctx.getServerHandler().playerEntity gives you server-side player (EntityPlayerMP) -> playerEntity.openContainer gives you container you have defined in your IGuiHandler (getClientGuiElement you returned GuiContainer for client-side and getServerGuiElement Container for server-side) -> You can set ItemStack to player inventory by getting player's inventory either from Container (if you have passed InventoryPlayer as an argument when constructing Container for server in IGuiHandl
  5. Check EntityPlayerSP#onLivingUpdate and EntityPlayerSP#sendHorseJump I think horse jumping is done by checking somewhere that ridden entity is instance of EntityHorse and otherwise Minecraft just ignores space pressing when trying to jump while riding. I had same kind of problem when I tried to set specific state for entity when space was pressed and I solved it by subscribe of KeyInputEvent and checking there if Minecraft.getMinecraft().gameSettings.keyBindJump.isPressed() and if so, client sends packet to server. Packet is received by server side packet handler and it gets EntityPlayerMP f
  6. Double check that there is no abstract methods. It seems like there is problem to construct new instance of mercenarymod.mensajeMercenario
  7. Just like you would do it on client side. You can set itemstacks and check player inventory on server-side same way as on client side, you just need to use server-side player (EntityPlayerMP). The first thing you need to do is to let server know which button was pressed and this is where the packet is needed. So you need packet and handlers. There is great tutorial at http://www.minecraftforge.net/forum/index.php/topic,20135.0.html When the packet is received by server, you can get EntityPlayerMP from MessageContext#getServerHandler().playerEntity and server-side container from player E
  8. You are approaching this from wrong direction. Gui is on client side and remember that client can let the gui know exactly what it wants (hacking). So you really need to do that on server side and I would do this like this way: - Player presses gui button -> onActionPerformed() get called. It sends request to server (can be your own packet or same way as item enchant is done so look for that. That request contains the name of requested item/block to craft. - Server gets this requests and gets player from server side container (EntityPlayerMP#opencontainer) - Server "scans" playe
  9. Hey check this out http://www.minecraftforge.net/forum/index.php/topic,20135.0.html it works on 1.8 as well.
  10. That worked! Thank you so much So it was, just like you said, the logger messing up sides. Packet were handled in server-side just like it should be. It just looked like it is the client that receives server-side packet because tileentity did reset everytime when its metadata (blockstate) changed. I added console debug print to onBlockActivated and checked what it prints after sending packet and it did show same nbt tag compound for both sides. Then I changed current blockstate with one Boolean property and checked nbt tags again so then it reset tileentity.
  11. Well, no specific reason why =D Actually its much efficient and easier way to do all those things I do.. just never thought it. I think that there were some case that I had problems with containers or something and therefore I made sure that Container would never return null value for getTileEntity() or something. And I just left it like that so, that's the background story behind. But back to the problem. I did more digging and I've noticed that every time I set blockstate (aka. metadata) tileentity resets. Something like this: worldIn.setBlockState(pos, previousState.withPropert
  12. Sorry it was typo. Just quickly renamed some parts of code. It doesn't extend BlockContainer, the tileentity of block instead does. I didn't remember that BlockContainer actually exists. I'll edit my posts.
  13. I was thinking the same, but it's weird because there are lot of cases that logger recognizes server as it should. After I did some debugging I see that tileentity losts given data after changing associated block metadata...
  14. BlockPacket.ServerHandler: public static class HandlerServer extends BlockPacket implements IMessageHandler<BlockPacket, IMessage> { @Override public IMessage onMessage(BlockPacket message, MessageContext ctx) { int receivedInt = message.someInteger; System.out.printf("BlockPacket.HandlerServer.onMessage: Received integer was %s", receivedInt); EntityPlayer player = ctx.getServerHandler().playerEntity; if(player != null) { Container container = player.openContainer; if (container != null && container instanceof SomeContainer) { //Note: IGuiHandler returns SomeCon
  15. I'm using SimpleNetworkWrapper to send packets that implements IMessage. Everything worked fine on 1.7.10 but now if I send packet from client side to server, I can see from console that it's the client that handles packet when its handler is registered to be on server-side. So here is some code. @EventHandler public void preInit(FMLPreInitializationEvent event) { network = NetworkRegistry.INSTANCE.newSimpleChannel(Info.modChannel); network.registerMessage(BlockPacket.HandlerServer.class, BlockPacket.class, 1, Side.SERVER); network.registerMessage(BlockPacket.HandlerClient.class, Block
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.