Jump to content

CommandCore

Members
  • Posts

    37
  • Joined

  • Last visited

Everything posted by CommandCore

  1. Fixed it. I have no clue why this fixes it but I added .func_235861_h_() to my properties list like so: public class MyBlock extends Block { public MyBlock() { super(Properties.create(Material.ROCK) .harvestTool(ToolType.PICKAXE) .harvestLevel(0) .hardnessAndResistance(1.5f, 6f) .sound(SoundType.STONE) .func_235861_h_() ); } } And now everything functions like it's supposed to. This is 1.16.1 by the way. Sorry for the unsupported version but hey, there ya go for anyone that has having trouble in the beta version. 👍 Edit: Don't know why I didn't test this before posting, but it fixed the bare hand mining thing, but still can be harvested outside of a given harvest level (I put the method on a different block with a higher harvest level.) Still need help!
  2. I really don't know how else to put it. This is my block class: public class MyBlock extends Block { public MyBlock() { super(Properties.create(Material.ROCK) .harvestTool(ToolType.PICKAXE) .harvestLevel(0) .hardnessAndResistance(1.5f, 6f) .sound(SoundType.STONE) ); } } Yet I can still break it with my bare hands and it will drop the block. I scorched various classes and the internet clean to try to find what was causing this, and have had no luck. Could someone point me in the right direction? Cheers.
  3. Hi! I'm trying to find a method to override in order for my block to have grass-like spreading capabilities. I was looking through the classes of different types of block that have timing in them, and they've either used the randomTick() method or the tick() method. However, it's deprecated! So is there any other alternative solution to my problem or the tick method in general? I've heard something about block ticks being called in BlockState now or something, but I've tried looking into that and I don't know what it means. Here's my code that would've probably worked if tick wasn't deprecated, simply spreading to a random surrounding block of a type every two seconds, code was pretty much ripped from: private int defaultTimer = 40; //2 seconds private int timer = defaultTimer; //Constructor, other overriden methods, yada yada @Override public void tick(BlockState state, ServerWorld worldIn, BlockPos pos, Random rand) { super.tick(state, worldIn, pos, rand); if(timer < defaultTimer) { for(int i = 0; i < 4; ++i) { BlockPos blockpos = pos.add(rand.nextInt(3) - 1, rand.nextInt(5) - 3, rand.nextInt(3) - 1); if (worldIn.getBlockState(blockpos).isIn(RegistryHandler.BLOCK_TO_SPREAD_ONTO.get())) { worldIn.setBlockState(blockpos, RegistryHandler.THIS_BLOCK.get().getDefaultState()); } } timer = defaultTimer; } else { timer --; } } Thanks everyone for the help, Cheers.
  4. Hey everyone, Does anyone know of a way to get all entities of a certain type in all loaded chunks of a world? I've seen World#getEntitiesWithinAABB(), however I cannot remove the range parameter. Thanks!
×
×
  • Create New...

Important Information

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