Jump to content

MayusYT

Members
  • Posts

    13
  • Joined

  • Last visited

Everything posted by MayusYT

  1. You know, not everyone who asks something here is an expert. Beginners like me don't get everything right the first time, and I think that's okay. Feel free to just tell it me in a normal tone, but I have zero understanding for persons being that aggressive, unpleasant or unhelpful. Statements like these don't help the person who asked the question nor do they help the conversation. If that is a "straightforward way" for you, then I'll consider asking on the MMD discord in the future.
  2. haha no need to get aggressive That was just a quick hacky way how I did this and I already fixed it. At the moment it works fine, so this can be closed now.
  3. Thanks for your reply. Unfortunately, the controller still can't determine the blocks correctly. See this picture - the small arrows on the controller point to the direction they're facing to: currentPos = currentPos.add(0, -1, 0); currentPos = currentPos.offset(EnumFacing.byIndex(world.getBlockState(currentPos).getBlock().getMetaFromState(world.getBlockState(currentPos))).rotateYCCW()); ^ that's the code I currently have. currentPos is the controller's position at first, then I subtract 1 on the y axis and rotate the facing counter-clockwise. I placed the stone block where currentPos is. As you can see, the block isn't always at the same position relative to the controller. I have trouble with fixing this, any help will be appreciated!
  4. Hi, there! I want to create my own multiblock in Forge 1.12.2. The thing I struggle with is the pattern recognition. I already searched the Forum, but couldn't find what I wanted. Either it was outdated or it was not solved. So I want to create a 3x3 hollow master-slave multiblock. The following problem is what i stumbled upon: Assuming the yellowish rectangle is the controller, it is facing to north here. I want to get the facing on its left, that would be "West" in the picture. But when the Controller is e.g. facing to the east, the block on its left is on the north facing: My question is now: How can I get a facing RELATIVE to the blocks direction? Thanks in advance.
  5. Found the bug! Just forgot to set the variables in the Container according to the ones in the TileEntity.
  6. By the way, this is the packet I send to the server: public class PacketSetEnabled implements IMessage { // A default constructor is always required public PacketSetEnabled(){} @Override public void toBytes(ByteBuf buf) {} @Override public void fromBytes(ByteBuf buf) {} public static class Handler implements IMessageHandler<PacketSetEnabled, IMessage> { @Override public IMessage onMessage(PacketSetEnabled message, MessageContext ctx) { // This is the player the packet was sent to the server from EntityPlayerMP serverPlayer = ctx.getServerHandler().player; serverPlayer.getServerWorld().addScheduledTask(() -> { if (serverPlayer.openContainer instanceof ContainerControllerLarge) { ContainerControllerLarge openContainer = (ContainerControllerLarge) serverPlayer.openContainer; openContainer.te.isEnabled = openContainer.isEnabled; if (openContainer.redstoneBehaviour == 0) { openContainer.te.redstoneBehaviour = 1; } else if (openContainer.redstoneBehaviour == 1) { openContainer.te.redstoneBehaviour = 2; } else { openContainer.te.redstoneBehaviour = 0; } openContainer.te.markDirty(); } }); // No response packet return null; } } }
  7. ok, I'm going to change that. The value is set to a different value but is reset every time I click the button again.
  8. I added a second value but it doesn't seem to work anymore. This is my current code: /** * A bit of a hack, but with Container#updateProgressBar you don't have to send a custom packet */ @Override public void updateProgressBar(int id, int data) { if(id == 5) { isEnabled = data != 0; } if(id == 6) { redstoneBehaviour = data; } } @Override public void detectAndSendChanges() { super.detectAndSendChanges(); for (IContainerListener containerListener : listeners) { if (containerListener instanceof EntityPlayerMP) { containerListener.sendWindowProperty(this, 5, te.isEnabled ? 1 : 0); containerListener.sendWindowProperty(this, 6, te.redstoneBehaviour); } } }
  9. Thanks for your answer. I‘ll have a look at ContainerFurnace but I think sending my own packet would be better (and easier) because I want toupdate multiple Values in the future. I‘ll keep you updated! thanks again!
  10. Thanks for your answers! Do you mean detectAndSendChanges()? A dev of EnderCore gave me this snippet: https://github.com/SleepyTrousers/EnderCore/blob/1.12/src/main/java/com/enderio/core/common/ContainerEnderCap.java#L260 I copied the code into my container class but it still doesnt work. thanks! PS: I distinguish the guis by checking whether the boolean in the tileentity class is true or false. EDIT: Here is my code, might help: Folder of my block (contains the important files): https://github.com/MayusYT/ZPM-Mod/tree/master/src/main/java/mayus/zpmmod/blockControllerLarge (the click handler is in guicontrollerlarge)
  11. HI! I started Forge modding a few weeks ago and I'm stuck at understanding the packets I have to use when e.g. clicking on a button on a GUI of a block. Let's choose an enable/disable button for this example. The button will change its texture whether the machine is enabled or not. So I understand that I have to send a packet from the GUI click "listener" that has to change my boolean "enabled" in my tile class. But when you open the GUI, you should see whether the machine is enabled or not. How do I do the communication between the server and the client? I heard that sending a packet is unnecessary. Thank you very much in advance!
  12. Did you succeed? I have the same problem and have no idea how reflection works.
×
×
  • Create New...

Important Information

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