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.

clowcadia

Members
  • Joined

  • Last visited

Everything posted by clowcadia

  1. So i am working on my tree logging ai, I figured out how to scan 14x14x14 area for any logs and leaves and have their pos set in an array. so after scanning and going through leaves(whole tree intact nothing removed) using this every leaf returns true
  2. How is this? getIBS(pos).getValue(BlockLeaves.CHECK_DECAY
  3. but how does it know its that exact block
  4. not sure how to do that, something like this (BlockLeaves)getBlock(pos).
  5. I dotn want to create a new topic for this, as my issues is with he the same theme..
  6. cant figure out how get that to work if(getBlock(pos).isLeaves(getIBS(pos),this.test.world,pos) && (BlockLeaves)getIBS(pos).getValue(CHECK_DECAY)){ CHECK_DECAY is in red
  7. i was just about to say\ state.getValue(CHECK_DECAY)
  8. lol the beginner modders challenge this is
  9. wow seams like we are working on the exact same thing, realisting wood chopper haha yea that a good idea, one of my next steps is to place the log onthe ground with a tree leaves (i just realized to match the tree leave structure will be difficult, i was just gonna do block like bush, but not realistic enough), and then i am gonna take a look at the leaf connection to a tree
  10. oh i just realized once all the log blocks are done u could probably check if the leave block is decaying to make sure it belongs to the tree
  11. Hey Jay Every check out my AI task that chops a whole tree down, see what you thing . any criticism https://github.com/Clowcadia/MinecraftForge/blob/master/1.11/NPCTesting/src/main/java/com/clowcadia/test/entities/living/ai/AIGoto.java
  12. but get block gets the block with the right position
  13. Ok now it only removes the selected block, but does not go through any of the loops passes first check but fails on the loops https://github.com/Clowcadia/MinecraftForge/blob/master/1.11/NPCTesting/src/main/java/com/clowcadia/test/entities/living/ai/AIGoto.java
  14. ok never mind, what about iblock access? whats that
  15. i cant seem to use Block.isWood() its red, and the get block is going through a loop, it doesnt use on the same value
  16. case full code is required https://github.com/Clowcadia/MinecraftForge/blob/master/1.11/NPCTesting/src/main/java/com/clowcadia/test/entities/living/ai/AIGoto.java
  17. so i got me a tree chopping loop, then the block position of a tree is selected on the 3 log from the buttom its cuts that log and one down but not the one inside dirt, and then it cuts all blocks from above the 3 log wondering if anyone knows why if(getBlock() == Blocks.LOG | getBlock() == Blocks.LOG2){ test.world.setBlockToAir(getPos()); for(int i=1; getBlock(getPos().down(i)) == Blocks.LOG | getBlock(getPos().down(i)) == Blocks.LOG2; i--){ test.world.setBlockToAir(getPos().down(i)); } for(int i=1; getBlock(getPos().up(i)) == Blocks.LOG | getBlock(getPos().up(i)) == Blocks.LOG2; i++){ test.world.setBlockToAir(getPos().up(i)); } }
  18. I just dont understand what do they mean by a mutable blockpos... i believe this it to know how block leaves fall ass they devay or get destroyed when the trunk is destroyed i believe
  19. I think its in BlockLeaves the code is hard to understand though public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) { if (!worldIn.isRemote) { if (((Boolean)state.getValue(CHECK_DECAY)).booleanValue() && ((Boolean)state.getValue(DECAYABLE)).booleanValue()) { int i = 4; int j = 5; int k = pos.getX(); int l = pos.getY(); int i1 = pos.getZ(); int j1 = 32; int k1 = 1024; int l1 = 16; if (this.surroundings == null) { this.surroundings = new int[32768]; } if (worldIn.isAreaLoaded(new BlockPos(k - 5, l - 5, i1 - 5), new BlockPos(k + 5, l + 5, i1 + 5))) { BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); for (int i2 = -4; i2 <= 4; ++i2) { for (int j2 = -4; j2 <= 4; ++j2) { for (int k2 = -4; k2 <= 4; ++k2) { IBlockState iblockstate = worldIn.getBlockState(blockpos$mutableblockpos.setPos(k + i2, l + j2, i1 + k2)); Block block = iblockstate.getBlock(); if (!block.canSustainLeaves(iblockstate, worldIn, blockpos$mutableblockpos.setPos(k + i2, l + j2, i1 + k2))) { if (block.isLeaves(iblockstate, worldIn, blockpos$mutableblockpos.setPos(k + i2, l + j2, i1 + k2))) { this.surroundings[(i2 + 16) * 1024 + (j2 + 16) * 32 + k2 + 16] = -2; } else { this.surroundings[(i2 + 16) * 1024 + (j2 + 16) * 32 + k2 + 16] = -1; } } else { this.surroundings[(i2 + 16) * 1024 + (j2 + 16) * 32 + k2 + 16] = 0; } } } } for (int i3 = 1; i3 <= 4; ++i3) { for (int j3 = -4; j3 <= 4; ++j3) { for (int k3 = -4; k3 <= 4; ++k3) { for (int l3 = -4; l3 <= 4; ++l3) { if (this.surroundings[(j3 + 16) * 1024 + (k3 + 16) * 32 + l3 + 16] == i3 - 1) { if (this.surroundings[(j3 + 16 - 1) * 1024 + (k3 + 16) * 32 + l3 + 16] == -2) { this.surroundings[(j3 + 16 - 1) * 1024 + (k3 + 16) * 32 + l3 + 16] = i3; } if (this.surroundings[(j3 + 16 + 1) * 1024 + (k3 + 16) * 32 + l3 + 16] == -2) { this.surroundings[(j3 + 16 + 1) * 1024 + (k3 + 16) * 32 + l3 + 16] = i3; } if (this.surroundings[(j3 + 16) * 1024 + (k3 + 16 - 1) * 32 + l3 + 16] == -2) { this.surroundings[(j3 + 16) * 1024 + (k3 + 16 - 1) * 32 + l3 + 16] = i3; } if (this.surroundings[(j3 + 16) * 1024 + (k3 + 16 + 1) * 32 + l3 + 16] == -2) { this.surroundings[(j3 + 16) * 1024 + (k3 + 16 + 1) * 32 + l3 + 16] = i3; } if (this.surroundings[(j3 + 16) * 1024 + (k3 + 16) * 32 + (l3 + 16 - 1)] == -2) { this.surroundings[(j3 + 16) * 1024 + (k3 + 16) * 32 + (l3 + 16 - 1)] = i3; } if (this.surroundings[(j3 + 16) * 1024 + (k3 + 16) * 32 + l3 + 16 + 1] == -2) { this.surroundings[(j3 + 16) * 1024 + (k3 + 16) * 32 + l3 + 16 + 1] = i3; } } } } } } } int l2 = this.surroundings[16912]; if (l2 >= 0) { worldIn.setBlockState(pos, state.withProperty(CHECK_DECAY, Boolean.valueOf(false)), 4); } else { this.destroy(worldIn, pos); } } } }

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.