NOT WORKING! "if Block at [i,j,k] == mcreator_name.block"

Started by Sedyh on Sat, 01/16/2016 - 19:39
Last seen on 16:08, 13. Mar 2018
Joined Oct 2014
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
NOT WORKING! "if Block at [i,j,k] == mcreator_name.block"
Sat, 01/16/2016 - 19:40 (edited)

Any events with function are not working at all! But all code compiles right.

* "if Block at [i,j,k] == mcreator_name.block"

* Same function in code - "if(world.getBlockState(new BlockPos(i, j, k)) == mcreator_name.block){
                                       world.setBlockState(new BlockPos(i, j, k), mcreator_name.block.getDefaultState(), 3);
                                       }"

 

Have code like this for wires in my mod:

public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block neighborBlock){
int i = pos.getX();int j = pos.getY();int k = pos.getZ();EntityPlayer entity = Minecraft.getMinecraft().thePlayer;

if(true){
//---------------------------------------------------------------------------------------
if(world.getBlockState(new BlockPos(i-1, j, k)) == mcreator_e1U.block){
world.setBlockState(new BlockPos(i, j, k), mcreator_e1U.block.getDefaultState(), 3);
}
//---------------------------------------------------------------------------------------
if(world.getBlockState(new BlockPos(i, j-1, k)) == mcreator_e1U.block){
world.setBlockState(new BlockPos(i, j, k), mcreator_e1U.block.getDefaultState(), 1);
}
//---------------------------------------------------------------------------------------
if(world.getBlockState(new BlockPos(i, j, k-1)) == mcreator_e1U.block){
world.setBlockState(new BlockPos(i, j, k), mcreator_e1U.block.getDefaultState(), 3);
}
//---------------------------------------------------------------------------------------
if(world.getBlockState(new BlockPos(i-1, j-1, k)) == mcreator_e1U.block){
world.setBlockState(new BlockPos(i, j, k), mcreator_e1U.block.getDefaultState(), 3);
}
//---------------------------------------------------------------------------------------
if(world.getBlockState(new BlockPos(i, j-1, k-1)) == mcreator_e1U.block){
world.setBlockState(new BlockPos(i, j, k), mcreator_e1U.block.getDefaultState(), 3);
}
//---------------------------------------------------------------------------------------
if(world.getBlockState(new BlockPos(i-1, j, k-1)) == mcreator_e1U.block){
world.setBlockState(new BlockPos(i, j, k), mcreator_e1U.block.getDefaultState(), 3);
}
//---------------------------------------------------------------------------------------
if(world.getBlockState(new BlockPos(i-1, j-1, k-1)) == mcreator_e1U.block){
world.setBlockState(new BlockPos(i, j, k), mcreator_e1U.block.getDefaultState(), 3);
}
//---------------------------------------------------------------------------------------
if(world.getBlockState(new BlockPos(i+1, j, k)) == mcreator_e1U.block){
world.setBlockState(new BlockPos(i, j, k), mcreator_e1U.block.getDefaultState(), 3);
}
//---------------------------------------------------------------------------------------
if(world.getBlockState(new BlockPos(i, j+1, k)) == mcreator_e1U.block){
world.setBlockState(new BlockPos(i, j, k), mcreator_e1U.block.getDefaultState(), 2);
}
//---------------------------------------------------------------------------------------
if(world.getBlockState(new BlockPos(i, j, k+1)) == mcreator_e1U.block){
world.setBlockState(new BlockPos(i, j, k), mcreator_e1U.block.getDefaultState(), 3);
}
//---------------------------------------------------------------------------------------
if(world.getBlockState(new BlockPos(i+1, j+1, k)) == mcreator_e1U.block){
world.setBlockState(new BlockPos(i, j, k), mcreator_e1U.block.getDefaultState(), 3);
}
//---------------------------------------------------------------------------------------
if(world.getBlockState(new BlockPos(i, j+1, k+1)) == mcreator_e1U.block){
world.setBlockState(new BlockPos(i, j, k), mcreator_e1U.block.getDefaultState(), 3);
}
//---------------------------------------------------------------------------------------
if(world.getBlockState(new BlockPos(i+1, j, k+1)) == mcreator_e1U.block){
world.setBlockState(new BlockPos(i, j, k), mcreator_e1U.block.getDefaultState(), 3);
}
//---------------------------------------------------------------------------------------
if(world.getBlockState(new BlockPos(i+1, j+1, k+1)) == mcreator_e1U.block){
world.setBlockState(new BlockPos(i, j, k), mcreator_e1U.block.getDefaultState(), 3);
}
//---------------------------------------------------------------------------------------

}

}

Edited by Sedyh on Sat, 01/16/2016 - 19:40
Last seen on 21:17, 16. Aug 2018
Joined Nov 2013
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
I'm having the same issue and
Tue, 03/15/2016 - 16:50

I'm having the same issue and would very much like a solution.