Hello,
Today I made a method that uses 2 for loops to change the floor in front of you to 5x5 square filled with my own block (ModBlocks.houseFundaments).
But whenever I rightclick with the item (which is the trigger event for my method), the world seems to jigger more than usual. Is this normal or am I doing something wrong?
private EnumActionResult buildHouse(World w, EntityPlayer p, BlockPos pos, ItemStack s) {
final int xRows = 5;
final int zRows = 5;
BlockPos negStartPos = new BlockPos(-1, 0, 0);
BlockPos prevBlockPos = pos.add(negStartPos);
for(int i=1; i<=xRows; i++){
BlockPos newBlockPos = new BlockPos(prevBlockPos.getX()+ 1, prevBlockPos.getY(), prevBlockPos.getZ());
w.setBlockState(newBlockPos, ModBlocks.houseFundaments.getDefaultState());
for (int j=1; j<=zRows; j++) {
BlockPos zAddPos = new BlockPos(newBlockPos.getX(), newBlockPos.getY(), newBlockPos.getZ()+ 1);
w.setBlockState(zAddPos, ModBlocks.houseFundaments.getDefaultState());
}
prevBlockPos = newBlockPos;
}
//w.setBlockState(pos, ModBlocks.houseFundaments.getDefaultState());
return EnumActionResult.PASS;
}
P.S. Does any one know why this codes only places in a 5x2? I just don't understand.
Thanks in advance,
NeusAap