Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void findBlock()
- {
- int xCoord = pos.getX();
- int yCoord = pos.getY();
- int zCoord = pos.getZ();
- if(isMachine(xCoord+1, yCoord, zCoord))
- {
- machine[0] = (TileMachineBase) worldObj.getTileEntity(new BlockPos(xCoord+1, yCoord, zCoord));
- }
- else machine[0] = null;
- if(isMachine(xCoord-1, yCoord, zCoord))
- {
- machine[1] = (TileMachineBase) worldObj.getTileEntity(new BlockPos(xCoord-1, yCoord, zCoord));
- }
- else machine[1] = null;
- if(isMachine(xCoord, yCoord+1, zCoord))
- {
- machine[2] = (TileMachineBase) worldObj.getTileEntity(new BlockPos(xCoord, yCoord+1, zCoord));
- }
- else machine[2] = null;
- if(isMachine(xCoord, yCoord-1, zCoord))
- {
- machine[3] = (TileMachineBase) worldObj.getTileEntity(new BlockPos(xCoord, yCoord-1, zCoord));
- }
- else machine[3] = null;
- if(isMachine(xCoord, yCoord, zCoord+1))
- {
- machine[4] = (TileMachineBase) worldObj.getTileEntity(new BlockPos(xCoord, yCoord, zCoord+1));
- }
- else machine[4] = null;
- if(isMachine(xCoord, yCoord, zCoord-1))
- {
- machine[5] = (TileMachineBase) worldObj.getTileEntity(new BlockPos(xCoord, yCoord, zCoord-1));
- }
- else machine[5] = null;
- }
- public void givePower()
- {
- findBlock();
- for (int i = 0; i < machine.length; i++)
- {
- if (machine[i] != null & machine[i].canAcceptPower()) this is 366 in the code.
- {
- machine[i].setPower(1);
- power -= 1;
- }
- }
- }
- public boolean isMachine(int x, int y, int z){
- return this.worldObj.getTileEntity(new BlockPos(x, y, z)) instanceof TileMachineBase;
- }
Advertisement
Add Comment
Please, Sign In to add comment