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.

AzenoX

Members
  • Joined

  • Last visited

Everything posted by AzenoX

  1. I'm a java beginner and I don't understand Interfaces or Abstraction very well. Where I can see childs event of PlayerInteractEvent ? I changed flags and that works: @SubscribeEvent public void event(PlayerInteractEvent e) { BlockPos bp = e.getPos(); BlockState bs = e.getWorld().getBlockState(bp); Block b = bs.getBlock(); PlayerEntity p = e.getPlayer(); if(!e.getWorld().isRemote) { if((b == BlockList.altar) && (p.getHeldItemMainhand().getItem() == ItemList.amulet)) { Dimensions.getLogger().info("Trigger On"); Block.replaceBlock(BlockList.altar.getDefaultState(), BlockList.altar_2.getDefaultState(), e.getWorld(), bp, Constants.BlockFlags.DEFAULT_AND_RERENDER); p.setHeldItem(e.getHand(), new ItemStack(Items.AIR, 1)); } else if((b == BlockList.altar_2) && (p.getHeldItemMainhand().getItem() == Items.AIR)) { Dimensions.getLogger().info("Trigger Off"); Block.replaceBlock(BlockList.altar_2.getDefaultState(), BlockList.altar.getDefaultState(), e.getWorld(), bp, Constants.BlockFlags.DEFAULT_AND_RERENDER); p.addItemStackToInventory(new ItemStack(ItemList.amulet, 1)); } } } Thank you a lot !
  2. Hey guys, I want to change a block's texture when a player click on it. My goal is to create an altar with the possiblity to place the item on it. There is my code: @SubscribeEvent public void event(PlayerInteractEvent e) { BlockPos bp = e.getPos(); BlockState bs = e.getWorld().getBlockState(bp); Block b = bs.getBlock(); PlayerEntity p = e.getPlayer(); if((b == BlockList.altar) && (p.getHeldItemMainhand().getItem() == ItemList.amulet)) { Dimensions.getLogger().info("Trigger On"); Block.replaceBlock(BlockList.altar.getDefaultState(), BlockList.altar_2.getDefaultState(), e.getWorld(), bp, 0); p.setHeldItem(e.getHand(), new ItemStack(Items.AIR, 1)); } else if((b == BlockList.altar_2) && (p.getHeldItemMainhand().getItem() == Items.AIR)) { Dimensions.getLogger().info("Trigger Off"); Block.replaceBlock(BlockList.altar_2.getDefaultState(), BlockList.altar.getDefaultState(), e.getWorld(), bp, 0); p.addItemStackToInventory(new ItemStack(ItemList.amulet, 1)); } } I have the debug message in the console and our inventory is modifying correctly but the block does not replace. Do someone know how to do that ? Thank you.

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.