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.

AustinTan

Members
  • Joined

  • Last visited

  1. I made it so that player other than the owner who placed down the block cannot break the block but every time when the first player place down a block the UUID variable is equal to player 1 name but after player 2 place down another block the UUID variable of both block change to the player 2 UUID what did I do wrong? I am still very new to modding! and coding btw @Override public void onBlockClicked(BlockState state, World worldIn, BlockPos pos, PlayerEntity player) { if(player.getUniqueID().equals(ChestTileEntity.permission)) { ChestTileEntity.canBreak = true; System.out.println("It tried to read to tileentity " + ChestTileEntity.permission); System.out.println("Succeseeseidkhowtospeellol"); } else { ChestTileEntity.canBreak = false; } } @SubscribeEvent public static void breakSpeedEvent(BreakSpeed event) { if(ChestTileEntity.canBreak == false) { event.setNewSpeed(0); System.out.println("It tried to read to tileentity " + ChestTileEntity.canBreak); } } Variable: public static UUID permission; public static Boolean canBreak;
  2. I used this but it's still the same what did I do wrong? event.setNewSpeed(0); EDIT: it worked I fixed it Thanks you!
  3. AustinTan changed their profile photo
  4. Sorry for the late reply! Now that I store the data in the title entity and then I realized that I used the wrong method for what I am trying to do I want to set so that the player cannot break the block not cannot get the block after it break do you know what method should I use? Because I don't and I've been searching for quite sometime and I still have no idea!
  5. How do I make only the player who place the block can break the Block? I dont know the problem is that I used the wrong method to get the name of the player who placed the block or that I used the canHarvestBlock in a wrong way. I am very new to this ! This is the onBlockPlacedBy and canHarvestBlock: @Override public void onBlockPlacedBy(World worldIn, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack) { if(placer instanceof PlayerEntity) { permission = placer.getName().toString(); } } @Override public boolean canHarvestBlock(BlockState state, IBlockReader world, BlockPos pos, PlayerEntity player) { if(player.getName().getString() == permission) { return state.getBlock().canHarvestBlock(state, world, pos, player); } return false; } Permission variable: public static String permission = null; EDIT: I solve the problem above but now my problem is that I the method I used was wrong! I don't know what method should I use in order to not let player to break the block

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.