Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Retzudo

Members
  • Joined

  • Last visited

  1. Thanks for the tip! That seems more reasonable than my solution .
  2. Hi everybody! I started modding the other day and made some good progress but now I've hit a wall. My idea is this: I have a semi-expensive to craft block a player can right click. The block (a TileEntity obviously) stores the player's name. I then listen to the LivingDeathEvent event. If a player dies I cancel the event, set his health to half a heart and teleport him on top of the block he was "bound" to. Now...I've managed the right-clicking, the event handling and the teleporting but it all works a bit wonky probably due to massive syncing issues I'm currently not able to comprehend. Currently I'm doing something like this: a player clicks the block -> the TileEntity registers at a central class which holds a static collection of all active resurrection blocks (i.e. TileEntities). If the LivingDeathEvent occurs it checks if it was a player and then iterates over all elements (TileEntities) in the collection to check if the player was "bound" to one of them. Which one of these things do I need to handle on which side (client/server)? Do I need packages or am I overlooking something obvious? Here's some random code: click on the block @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) { TileEntityResurrectionBlock base = (TileEntityResurrectionBlock)world.getBlockTileEntity(x, y, z); if (base != null) { if (player.isSneaking()) { if (base.isBound()) { if(!world.isRemote) player.addChatMessage(MessagesEn.SOMEONE_ELSE_BOUND); } else { base.setBinding(player.getEntityName()); if(!world.isRemote) player.addChatMessage(MessagesEn.NOW_BOUND); } } else { if (base.isBound()) { if(!world.isRemote) player.addChatMessage(MessagesEn.PLAYER_BOUND + base.getBoundPlayer()); } else { if(!world.isRemote) player.addChatMessage(MessagesEn.NOT_BOUND); } } } return false; } setBinding in TileEntityResurrectionBlock public void setBinding(String playerName) { boundPlayer = playerName; BlockManager.addBlock(this); } BlockManager public class BlockManager { private static List blocks = new ArrayList(); public static void addBlock(TileEntityResurrectionBlock base) { //if(!Minecraft.getMinecraft().theWorld.isRemote) return; Iterator it = blocks.iterator(); // check if this player already has a bound vita-chamber anywhere // and remove that one while (it.hasNext()) { TileEntityResurrectionBlock b = (TileEntityResurrectionBlock)it.next(); if (b.getBoundPlayer().equals(base.getBoundPlayer())) { b.setBoundPlayer(""); it.remove(); } } blocks.add(base); } public static void removeBlock(TileEntityResurrectionBlock base) { //if(Minecraft.getMinecraft().theWorld.isRemote) return; blocks.remove(base); } public static TileEntityResurrectionBlock isPlayerBoundAnywhere(String playerName) { Iterator it = blocks.iterator(); boolean isBound = false; while (it.hasNext()) { TileEntityResurrectionBlock base = (TileEntityResurrectionBlock)it.next(); if (base.getBoundPlayer().equals(playerName)) { return base; } } return null; } } Cheers - Chris

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.