I have a problem with a block corrupting block

Started by mega1134227 on Fri, 07/13/2018 - 15:58

Topic category: Advanced modding

Last seen on 01:18, 19. Sep 2019
Joined Feb 2016
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
I have a problem with a block corrupting block
Sat, 07/14/2018 - 21:28 (edited)

I made this code that allows my block to corrupt only certain blocks by making it think some blocks will cause it to do nothing. But, even though the Compiler says there isn't any mistake, it still does push itself on top of the blocks I told it to do nothing on.

 

Here is my code (where it infects):

 

        @Override
public void updateTick(World world, BlockPos pos, IBlockState state, Random random){
int i = pos.getX();int j = pos.getY();int k = pos.getZ();EntityPlayer entity = Minecraft.getMinecraft().player;

if(mcreator_VarListtestenvironmentmod.IsAbyssalsingularityAlive == true){

if((!(((((((((((world.getBlockState(new BlockPos(i, j+1, k)).getBlock() == Blocks.AIR) && world.getBlockState(new BlockPos(i, j+1, k)).getBlock() == Blocks.LAVA) && world.getBlockState(new BlockPos(i, j+1, k)).getBlock() == Blocks.WATER) && world.getBlockState(new BlockPos(i, j+1, k)).getBlock() == Blocks.BEDROCK) &&
world.getBlockState(new BlockPos(i, j+1, k)).getBlock() == mcreator_abyssalcorruption.block) && world.getBlockState(new BlockPos(i, j+1, k)).getBlock() == mcreator_abyssalsingularity.block) && world.getBlockState(new BlockPos(i, j+1, k)).getBlock() == mcreator_abyssalspawner.block) &&
world.getBlockState(new BlockPos(i, j+1, k)).getBlock() == mcreator_abyssalspotter.block) && world.getBlockState(new BlockPos(i, j+1, k)).getBlock() == mcreator_abyssfog1.block) && world.getBlockState(new BlockPos(i, j+1, k)).getBlock() == mcreator_abyssfog2.block) && world.getBlockState(new BlockPos(i, j+1, k)).getBlock() == mcreator_abyssfog3.block )))
{
return;
}
else {
world.setBlockState(new BlockPos(i, j+1, k), mcreator_abyssalcorruption.block.getDefaultState(), 3);
}
if((!(((((((((((world.getBlockState(new BlockPos(i, j-1, k)).getBlock() == Blocks.AIR) && world.getBlockState(new BlockPos(i, j-1, k)).getBlock() == Blocks.LAVA) && world.getBlockState(new BlockPos(i, j-1, k)).getBlock() == Blocks.WATER) && world.getBlockState(new BlockPos(i, j-1, k)).getBlock() == Blocks.BEDROCK) &&
world.getBlockState(new BlockPos(i, j-1, k)).getBlock() == mcreator_abyssalcorruption.block) && world.getBlockState(new BlockPos(i, j-1, k)).getBlock() == mcreator_abyssalsingularity.block) && world.getBlockState(new BlockPos(i, j-1, k)).getBlock() == mcreator_abyssalspawner.block) &&
world.getBlockState(new BlockPos(i, j-1, k)).getBlock() == mcreator_abyssalspotter.block) && world.getBlockState(new BlockPos(i, j-1, k)).getBlock() == mcreator_abyssfog1.block) && world.getBlockState(new BlockPos(i, j-1, k)).getBlock() == mcreator_abyssfog2.block) && world.getBlockState(new BlockPos(i, j-1, k)).getBlock() == mcreator_abyssfog3.block )))
{
return;
}
else {
world.setBlockState(new BlockPos(i, j-1, k), mcreator_abyssalcorruption.block.getDefaultState(), 3);
}
if((!(((((((((((world.getBlockState(new BlockPos(i+1, j, k)).getBlock() == Blocks.AIR) && world.getBlockState(new BlockPos(i+1, j, k)).getBlock() == Blocks.LAVA) && world.getBlockState(new BlockPos(i+1, j, k)).getBlock() == Blocks.WATER) && world.getBlockState(new BlockPos(i+1, j, k)).getBlock() == Blocks.BEDROCK) &&
world.getBlockState(new BlockPos(i+1, j, k)).getBlock() == mcreator_abyssalcorruption.block) && world.getBlockState(new BlockPos(i+1, j, k)).getBlock() == mcreator_abyssalsingularity.block) && world.getBlockState(new BlockPos(i+1, j, k)).getBlock() == mcreator_abyssalspawner.block) &&
world.getBlockState(new BlockPos(i+1, j, k)).getBlock() == mcreator_abyssalspotter.block) && world.getBlockState(new BlockPos(i+1, j, k)).getBlock() == mcreator_abyssfog1.block) && world.getBlockState(new BlockPos(i+1, j, k)).getBlock() == mcreator_abyssfog2.block) && world.getBlockState(new BlockPos(i+1, j, k)).getBlock() == mcreator_abyssfog3.block )))
{
return;
}
else {
world.setBlockState(new BlockPos(i+1, j, k), mcreator_abyssalcorruption.block.getDefaultState(), 3);
}
if((!(((((((((((world.getBlockState(new BlockPos(i-1, j, k)).getBlock() == Blocks.AIR) && world.getBlockState(new BlockPos(i-1, j, k)).getBlock() == Blocks.LAVA) && world.getBlockState(new BlockPos(i-1, j, k)).getBlock() == Blocks.WATER) && world.getBlockState(new BlockPos(i-1, j, k)).getBlock() == Blocks.BEDROCK) &&
world.getBlockState(new BlockPos(i-1, j, k)).getBlock() == mcreator_abyssalcorruption.block) && world.getBlockState(new BlockPos(i-1, j, k)).getBlock() == mcreator_abyssalsingularity.block) && world.getBlockState(new BlockPos(i-1, j, k)).getBlock() == mcreator_abyssalspawner.block) &&
world.getBlockState(new BlockPos(i-1, j, k)).getBlock() == mcreator_abyssalspotter.block) && world.getBlockState(new BlockPos(i-1, j, k)).getBlock() == mcreator_abyssfog1.block) && world.getBlockState(new BlockPos(i-1, j, k)).getBlock() == mcreator_abyssfog2.block) && world.getBlockState(new BlockPos(i-1, j, k)).getBlock() == mcreator_abyssfog3.block )))
{
return;
}
else {
world.setBlockState(new BlockPos(i-1, j, k), mcreator_abyssalcorruption.block.getDefaultState(), 3);
}
if((!(((((((((((world.getBlockState(new BlockPos(i, j, k+1)).getBlock() == Blocks.AIR) && world.getBlockState(new BlockPos(i, j, k+1)).getBlock() == Blocks.LAVA) && world.getBlockState(new BlockPos(i, j, k+1)).getBlock() == Blocks.WATER) && world.getBlockState(new BlockPos(i, j, k+1)).getBlock() == Blocks.BEDROCK) &&
world.getBlockState(new BlockPos(i, j, k+1)).getBlock() == mcreator_abyssalcorruption.block) && world.getBlockState(new BlockPos(i, j, k+1)).getBlock() == mcreator_abyssalsingularity.block) && world.getBlockState(new BlockPos(i, j, k+1)).getBlock() == mcreator_abyssalspawner.block) &&
world.getBlockState(new BlockPos(i, j, k+1)).getBlock() == mcreator_abyssalspotter.block) && world.getBlockState(new BlockPos(i, j, k+1)).getBlock() == mcreator_abyssfog1.block) && world.getBlockState(new BlockPos(i, j, k+1)).getBlock() == mcreator_abyssfog2.block) && world.getBlockState(new BlockPos(i, j, k+1)).getBlock() == mcreator_abyssfog3.block )))
{
return;
}
else {
world.setBlockState(new BlockPos(i, j, k+1), mcreator_abyssalcorruption.block.getDefaultState(), 3);
}
if((!(((((((((((world.getBlockState(new BlockPos(i, j, k-1)).getBlock() == Blocks.AIR) && world.getBlockState(new BlockPos(i, j, k-1)).getBlock() == Blocks.LAVA) && world.getBlockState(new BlockPos(i, j, k-1)).getBlock() == Blocks.WATER) && world.getBlockState(new BlockPos(i, j, k-1)).getBlock() == Blocks.BEDROCK) &&
world.getBlockState(new BlockPos(i, j, k-1)).getBlock() == mcreator_abyssalcorruption.block) && world.getBlockState(new BlockPos(i, j, k-1)).getBlock() == mcreator_abyssalsingularity.block) && world.getBlockState(new BlockPos(i, j, k-1)).getBlock() == mcreator_abyssalspawner.block) &&
world.getBlockState(new BlockPos(i, j, k-1)).getBlock() == mcreator_abyssalspotter.block) && world.getBlockState(new BlockPos(i, j, k-1)).getBlock() == mcreator_abyssfog1.block) && world.getBlockState(new BlockPos(i, j, k-1)).getBlock() == mcreator_abyssfog2.block) && world.getBlockState(new BlockPos(i, j, k-1)).getBlock() == mcreator_abyssfog3.block )))
{
return;
}
else {
world.setBlockState(new BlockPos(i, j, k-1), mcreator_abyssalcorruption.block.getDefaultState(), 3);
}
if (true){
world.setBlockState(new BlockPos(i, 120, k), mcreator_abyssfog3.block.getDefaultState(), 3);
}
if (true){
world.setBlockState(new BlockPos(i, 121, k), mcreator_abyssfog2.block.getDefaultState(), 3);
}
if (true){
world.setBlockState(new BlockPos(i, 122, k), mcreator_abyssfog1.block.getDefaultState(), 3);
}
}
world.scheduleUpdate(new BlockPos(i, j, k), this, this.tickRate(world));
}

Edited by mega1134227 on Sat, 07/14/2018 - 21:28