
clowcadia
Members-
Posts
458 -
Joined
-
Last visited
Everything posted by clowcadia
-
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
-
Finding blocks connected to a start position
clowcadia replied to Jay Avery's topic in Modder Support
-
Finding blocks connected to a start position
clowcadia replied to Jay Avery's topic in Modder Support
How is this? getIBS(pos).getValue(BlockLeaves.CHECK_DECAY -
Finding blocks connected to a start position
clowcadia replied to Jay Avery's topic in Modder Support
but how does it know its that exact block -
Finding blocks connected to a start position
clowcadia replied to Jay Avery's topic in Modder Support
not sure how to do that, something like this (BlockLeaves)getBlock(pos). -
Finding blocks connected to a start position
clowcadia replied to Jay Avery's topic in Modder Support
I dotn want to create a new topic for this, as my issues is with he the same theme.. -
Finding blocks connected to a start position
clowcadia replied to Jay Avery's topic in Modder Support
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 -
Finding blocks connected to a start position
clowcadia replied to Jay Avery's topic in Modder Support
i was just about to say\ state.getValue(CHECK_DECAY) -
Finding blocks connected to a start position
clowcadia replied to Jay Avery's topic in Modder Support
lol the beginner modders challenge this is -
Finding blocks connected to a start position
clowcadia replied to Jay Avery's topic in Modder Support
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 -
Finding blocks connected to a start position
clowcadia replied to Jay Avery's topic in Modder Support
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 -
Finding blocks connected to a start position
clowcadia replied to Jay Avery's topic in Modder Support
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 -
tree chopping for loop does not get tree trunk
clowcadia replied to clowcadia's topic in Modder Support
actually i think ur right -
tree chopping for loop does not get tree trunk
clowcadia replied to clowcadia's topic in Modder Support
but get block gets the block with the right position -
tree chopping for loop does not get tree trunk
clowcadia replied to clowcadia's topic in Modder Support
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 -
tree chopping for loop does not get tree trunk
clowcadia replied to clowcadia's topic in Modder Support
call me retarded... -
tree chopping for loop does not get tree trunk
clowcadia replied to clowcadia's topic in Modder Support
ok never mind, what about iblock access? whats that -
tree chopping for loop does not get tree trunk
clowcadia replied to clowcadia's topic in Modder Support
-
tree chopping for loop does not get tree trunk
clowcadia replied to clowcadia's topic in Modder Support
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 -
tree chopping for loop does not get tree trunk
clowcadia replied to clowcadia's topic in Modder Support
its the i-- that did it -
tree chopping for loop does not get tree trunk
clowcadia replied to clowcadia's topic in Modder Support
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 -
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)); } }
-
Finding blocks connected to a start position
clowcadia replied to Jay Avery's topic in Modder Support
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 -
Finding blocks connected to a start position
clowcadia replied to Jay Avery's topic in Modder Support
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); } } } } -
awsomeness