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.

WillTheGameDecoder

Members
  • Joined

  • Last visited

Everything posted by WillTheGameDecoder

  1. Yeah. I found the issue now, though. (forgot that changing blocks counts towards calling that method as well...)
  2. No. "onNeighborChange" doesn't get triggered at all, as far as I'm aware. I forgot to delete that code
  3. https://pastebin.com/RGWBr9RW
  4. Well, that certainly helps in that aspect, but my original question still stands. My block isn't being updated when receiving weak power, and the code is still breaking, in spite of it working 100% in the "onBlockActivated" method
  5. 1) I know I'm not calling the method. I did forget to add it, yeah, but it doesn't work, even when I do add it. 2) IBlockAccess doesn't have the "isBlockPowered" method. It only has "getStrongPower" which requires an EnumFacing as well, which I don't understand either...
  6. I've been trying to mod in a new redstone component similar to the piston. I've searched high and low on forums and YouTube, trying to figure out how to get this to work, but I can't seem to get any proper updates or read redstone signals like I'm expecting. In all cases, it has either has ignored all redstone signals, or it doesn't function like it should (I've tested it with onBlockActivated. it does work) Is there something I'm missing? Do I need a TileEntity? Am I overriding the wrong methods? I should also mention that I'm just setting blocks in the world to test whether code is running, and it doesn't ever seem to. package com.willtgd.testmod.blocks; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class Teleporter extends Block { public Teleporter() {} // not important to the question at hand (i think) @Override public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) { if (world.isBlockPowered(pos.add(0, 0, 1))) { world.setBlockState(pos.add(1, 0, 0), Block.getBlockFromName("minecraft:stone").getDefaultState()); } } @Override public void onNeighborChange(IBlockAccess access, BlockPos pos, BlockPos neighbor) { World world = Minecraft.getMinecraft().world; if (world.isBlockPowered(neighbor)) { world.setBlockState(neighbor, Block.getBlockFromName("minecraft:dirt").getDefaultState()); } } @Override public void observedNeighborChange(IBlockState state, World world, BlockPos observerPos, Block changedBlock, BlockPos changePos) { if (world.isBlockPowered(changePos)) { world.setBlockState(changePos, Block.getBlockFromName("minecraft:dirt").getDefaultState()); } } private void swapBlocks(World world, BlockPos pos) { BlockPos up = pos.add(0, 1, 0); BlockPos down = pos.add(0, -1, 0); IBlockState temp = world.getBlockState(up); world.setBlockState(up, world.getBlockState(down)); world.setBlockState(down, temp); } }

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.