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.

urabaros

Members
  • Joined

  • Last visited

Everything posted by urabaros

  1. Ok, but how can I get these parameters from blockstate T.T Sorry, I don't understand.
  2. Thanks! But i think I use 'with' wrong, because I get this mistake: My code: world.setBlockState(blockpos, BlockInit.ROTATABLE_CUSTOM_BLOCK_STRIPPED.get().getDefaultState().with(blockstate.getBlock(), blockstate), 11); What I wrote wrong?
  3. Hello! I'm very new to modding and I'm trying to strip a rotatable custom block. I don't know how to strip it and set a right BlockState, if you know, please help me. What should I write into setBlockState function? public ActionResultType onItemUse(ItemUseContext context) { World world = context.getWorld(); BlockPos blockpos = context.getPos(); BlockState blockstate = world.getBlockState(blockpos); blockpos.add(0, 0, 1); if (blockstate.getBlock() == BlockInit.ROTATABLE_CUSTOM_BLOCK.get()) { PlayerEntity playerentity = context.getPlayer(); world.playSound(playerentity, blockpos, SoundEvents.ITEM_AXE_STRIP, SoundCategory.BLOCKS, 1.0F, 1.0F); if (!world.isRemote) { world.setBlockState(blockpos, BlockInit.ROTATABLE_CUSTOM_BLOCK_STRIPPED.get().getStateAtViewpoint(blockstate, world, blockpos, context.getHitVec()), 11); if (playerentity != null) { context.getItem().damageItem(1, playerentity, (p_220040_1_) -> { p_220040_1_.sendBreakAnimation(context.getHand()); }); } } } return ActionResultType.PASS; }
  4. Thank youuuuuuu that helped!!!!!!!
  5. No, that's strange, but it has only one state. Moreover, even if I wanted to compare block (not blockstate), i don't know how to do it, because this function require BlockState
  6. Hi! I made a stick that would strip special blocks like an axe. These blocks can be stripped ONLY using this stick. It's currently working, but only when block was placed on the ground. If it is placed on the side of another block, it is not working. I think maybe it is something about getDefaultState, because I'm checking block simply through If @Override public ActionResultType onItemUse(ItemUseContext context) { World world = context.getWorld(); BlockPos blockpos = context.getPos(); BlockState blockstate = world.getBlockState(blockpos); if (blockstate == BlockInit.CUSTOM_BLOCK.get().getDefaultState()) { PlayerEntity playerentity = context.getPlayer(); world.playSound(playerentity, blockpos, SoundEvents.ITEM_AXE_STRIP, SoundCategory.BLOCKS, 1.0F, 1.0F); if (!world.isRemote) { world.setBlockState(blockpos, BlockInit.CUSTOM_BLOCK_STRIPPED.get().getDefaultState(), 11); if (playerentity != null) { context.getItem().damageItem(1, playerentity, (p_220040_1_) -> { p_220040_1_.sendBreakAnimation(context.getHand()); }); } } } p.s. Sorry sorry sorry i know my code is kinda bad, I'm only learning.
  7. Thank you! Sorry, I really know java poorly, but I'm definitely going to learn it! Thank you once more!
  8. Hi! I'm trying to make a custom Stick that would strip special custom blocks. I know how to add blocks to BLOCK_STRIPPING_MAP, but my goal is to strip my custom blocks only with my custom Stick, but not with vanilla Axes. I've tried to create StickItem extends ToolItem and copy everything from AxeItem, then change BLOCK_STRIPPING_MAP, but it doesn't help. Moreover, it seems that this stripping depends on ToolType in onItemUse function... so I don't know what to do. Do anyone have any ideas?

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.