@Override public void validate() { super.validate(); if (worldObj.isRemote && this instanceof IHarvestAreaContainer) { MineFactoryReloadedClient.addTileToAreaList((IHarvestAreaContainer) this); } }
public boolean moveBlockSimple(JumpBlock shipBlock) { try { if (shipBlock == null) { return false; } int oldX = shipBlock.x; int oldY = shipBlock.y; int oldZ = shipBlock.z; int blockID = shipBlock.blockID; int blockMeta = shipBlock.blockMeta; mySetBlock(worldObj, oldX + newX, oldY + newY, oldZ + newZ, blockID, blockMeta, 2); NBTTagCompound oldnbt = new NBTTagCompound(); oldnbt = shipBlock.blockNBT; if (oldnbt != null) { TileEntity newTileEntity; newTileEntity = TileEntity.createAndLoadEntity(oldnbt); newTileEntity.worldObj = worldObj; newTileEntity.validate(); worldObj.setBlockTileEntity(oldX + newX, oldY + newY, oldZ + newZ, newTileEntity); } } catch (Exception exception) { exception.printStackTrace(); return false; } return true; }
@Override public void validate() { super.validate(); if (worldObj.isRemote) { Mekanism.packetHandler.sendToServer(new DataRequestMessage(Coord4D.get(this))); } }
public static void updateFurnaceBlockState( boolean flag, World world, int i, int j, int k, Block activeID, Block idleID, boolean sounds) { int l = world.getBlockMetadata(i, j, k); TileEntity tileentity = world.getTileEntity(i, j, k); setKeepInventory(true); if (flag) { if (sounds) { world.playSoundEffect( i + 0.5F, j + 0.5F, k + 0.5F, "mob.ghast.fireball", 1.0F, 0.8F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F); world.playSoundEffect( i + 0.5F, j + 0.5F, k + 0.5F, "mob.zombiepig.zpigdeath", 0.1F, 0.1F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.6F); world.playSoundEffect( i + 0.5F, j + 0.5F, k + 0.5F, "fire.ignite", 1.5F, 1.0F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F); } world.setBlock(i, j, k, activeID); } else { if (sounds) world.playSoundEffect( i + 0.5F, j + 0.5F, k + 0.5F, "ambient.cave.cave", 0.1F, 0.1F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F); world.setBlock(i, j, k, idleID); } setKeepInventory(false); world.setBlockMetadataWithNotify(i, j, k, l, 2); if (tileentity != null) { tileentity.validate(); world.setTileEntity(i, j, k, tileentity); } }
public static void updateBlockState(int type, World world, int x, int y, int z) { int i = world.getBlockMetadata(x, y, z); TileEntity entity = world.getTileEntity(x, y, z); keepInventory = true; if (type == 1) { world.setBlock(x, y, z, ModBlocks.launch_pad_generic); } else if (type == 2) { world.setBlock(x, y, z, ModBlocks.launch_pad_strong); } else if (type == 3) { world.setBlock(x, y, z, ModBlocks.launch_pad_cluster); } else if (type == 4) { world.setBlock(x, y, z, ModBlocks.launch_pad_nuclear); } else if (type == 5) { world.setBlock(x, y, z, ModBlocks.launch_pad_incendiary); } else if (type == 6) { world.setBlock(x, y, z, ModBlocks.launch_pad_buster); } else if (type == 7) { world.setBlock(x, y, z, ModBlocks.launch_pad_incendiary_strong); } else if (type == 8) { world.setBlock(x, y, z, ModBlocks.launch_pad_cluster_strong); } else if (type == 9) { world.setBlock(x, y, z, ModBlocks.launch_pad_buster_strong); } else if (type == 10) { world.setBlock(x, y, z, ModBlocks.launch_pad_burst); } else if (type == 11) { world.setBlock(x, y, z, ModBlocks.launch_pad_inferno); } else if (type == 12) { world.setBlock(x, y, z, ModBlocks.launch_pad_rain); } else if (type == 13) { world.setBlock(x, y, z, ModBlocks.launch_pad_drill); } else if (type == 14) { world.setBlock(x, y, z, ModBlocks.launch_pad_endo); } else if (type == 15) { world.setBlock(x, y, z, ModBlocks.launch_pad_exo); } else if (type == 16) { world.setBlock(x, y, z, ModBlocks.launch_pad_mirv); } else { world.setBlock(x, y, z, ModBlocks.launch_pad); } keepInventory = false; if (entity != null) { entity.validate(); world.setTileEntity(x, y, z, entity); } }
public static void updateBlockState(boolean par0, World par1World, int par2, int par3, int par4) { int var5 = par1World.getBlockMetadata(par2, par3, par4); TileEntity tileentity = par1World.getTileEntity(par2, par3, par4); keepInventory = true; if (par0) par1World.setBlockMetadataWithNotify(par2, par3, par4, var5 + 7, 2); else par1World.setBlockMetadataWithNotify(par2, par3, par4, var5 - 7, 2); keepInventory = false; if (tileentity != null) { tileentity.validate(); par1World.setTileEntity(par2, par3, par4, tileentity); } }
public static void updateBlockState( boolean active, World worldObj, int xCoord, int yCoord, int zCoord) { int i = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); TileEntity tileentity = worldObj.getTileEntity(xCoord, yCoord, zCoord); keepInventory = true; if (active) { worldObj.setBlock(xCoord, yCoord, zCoord, NCBlocks.oxidiserActive); } else { worldObj.setBlock(xCoord, yCoord, zCoord, NCBlocks.oxidiserIdle); } keepInventory = false; worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, i, 2); if (tileentity != null) { tileentity.validate(); worldObj.setTileEntity(xCoord, yCoord, zCoord, tileentity); } }
public static void updateBlockState(boolean burning, World world, int x, int y, int z) { int direction = world.getBlockMetadata(x, y, z); TileEntity tileentity = world.getTileEntity(x, y, z); isBurning = true; if (burning) { world.setBlock(x, y, z, Machines_Main.crusherActive); } else { world.setBlock(x, y, z, Machines_Main.crusher); } isBurning = false; world.setBlockMetadataWithNotify(x, y, z, direction, 2); if (tileentity != null) { tileentity.validate(); world.setTileEntity(x, y, z, tileentity); } }
/** Update which block ID the furnace is using depending on whether or not it is burning */ public static void updateFurnaceBlockState( boolean par0, World par1World, int par2, int par3, int par4) { int l = par1World.getBlockMetadata(par2, par3, par4); TileEntity tileentity = par1World.getBlockTileEntity(par2, par3, par4); keepFurnaceInventory = true; if (par0) { par1World.setBlock(par2, par3, par4, TileEntityHandler.tiletutorialblock.blockID); } else { par1World.setBlock(par2, par3, par4, TileEntityHandler.tiletutorialblock.blockID); } keepFurnaceInventory = false; par1World.setBlockMetadataWithNotify(par2, par3, par4, l, 2); if (tileentity != null) { tileentity.validate(); par1World.setBlockTileEntity(par2, par3, par4, tileentity); } }
public static void setState(boolean active, World worldIn, BlockPos pos) { IBlockState iblockstate = worldIn.getBlockState(pos); TileEntity tileentity = worldIn.getTileEntity(pos); keepInventory = true; if (active) { worldIn.setBlockState( pos, MBlocks.melter_active .getDefaultState() .withProperty(FACING, iblockstate.getValue(FACING)), 3); worldIn.setBlockState( pos, MBlocks.melter_active .getDefaultState() .withProperty(FACING, iblockstate.getValue(FACING)), 3); } else { worldIn.setBlockState( pos, MBlocks.melter.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); worldIn.setBlockState( pos, MBlocks.melter.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); } keepInventory = false; if (tileentity != null) { tileentity.validate(); worldIn.setTileEntity(pos, tileentity); } }
@Override public void validate() { super.validate(); }
@Override public void validate() { super.validate(); init = false; }
@Override public void validate() { super.validate(); getHandler().validate(); }
@Override public void validate() { super.validate(); _needsNetworkUpdate = true; }
public void updateEntity() { // Check for ghost TEs if (dead) return; // Make sure the relays haven't been broken verifyRelay(); // Bounce if (linked && worldObj.getTotalWorldTime() % 100 == 0 && !worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)) { // Target coordinates to check int targetX = xCoord + movementDirection.offsetX; int targetZ = zCoord + movementDirection.offsetZ; // Switch direction if at end of track if (worldObj.getBlock(targetX, yCoord, targetZ) != Block.getBlockFromName("air") || worldObj.getBlock(targetX, yCoord + 1, targetZ) != Block.getBlockFromName("air")) { movementDirection = movementDirection.getOpposite(); } } // Move if (linked && worldObj.getTotalWorldTime() % 100 == 1 && !worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)) { // Cache coordinated int targetX = xCoord + movementDirection.offsetX; int targetZ = zCoord + movementDirection.offsetZ; // Check for abandoned TEs if (worldObj.getBlock(xCoord, yCoord, zCoord) != ThaumicTinkerer.registry.getFirstBlockFromClass(BlockMobilizer.class)) { return; } // Check if the space the mobilizer will move into is empty if ((worldObj.isAirBlock(targetX, yCoord, targetZ) || worldObj.getBlock(targetX, yCoord, targetZ).isAir(worldObj, targetX, yCoord, targetZ) && (worldObj.isAirBlock(xCoord, yCoord + 1, zCoord) || worldObj.isAirBlock(targetX, yCoord + 1, targetZ) || worldObj .getBlock(targetX, yCoord + 1, targetZ) .isAir(worldObj, targetX, yCoord + 1, targetZ)))) { // Move Entities // List<Entity> entities = worldObj.getEntitiesWithinAABB(Entity.class, // AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord+1, yCoord+3, zCoord+1)); // System.out.print(entities); // for(Entity e: entities){ // e.setPosition(e.posX+movementDirection.offsetX, e.posY, // e.posZ+movementDirection.offsetZ); // } // Move the block on top of the mobilizer if (!worldObj.isRemote) { TileEntity passenger = worldObj.getTileEntity(xCoord, yCoord + 1, zCoord); IAppEngApi api = AEApi.instance(); // Prevent the passenger from popping off. Not sent to clients. worldObj.setBlock(targetX, yCoord, targetZ, Block.getBlockFromName("stone"), 0, 0); // Move non-TE blocks Block passengerId = worldObj.getBlock(xCoord, yCoord + 1, zCoord); if (worldObj.isAirBlock(xCoord, yCoord + 1, zCoord) || passengerId.canPlaceBlockAt(worldObj, targetX, yCoord + 1, targetZ)) { if (passenger == null) { if (passengerId != Block.getBlockFromName("bedrock") && passengerId != Block.getBlockFromName("")) { worldObj.setBlock( targetX, yCoord + 1, targetZ, passengerId, worldObj.getBlockMetadata(xCoord, yCoord + 1, zCoord), 3); if (passengerId != Block.getBlockFromName("air") && passengerId != Block.getBlockFromName("piston_head")) { worldObj.setBlock( xCoord, yCoord + 1, zCoord, Block.getBlockFromName("air"), 0, 2); } } // If AE is installed, use its handler } else if (api != null) { if (api.registries().moveable().askToMove(passenger)) { worldObj.setBlock( targetX, yCoord + 1, targetZ, worldObj.getBlock(xCoord, yCoord + 1, zCoord), worldObj.getBlockMetadata(xCoord, yCoord + 1, zCoord), 3); passenger.invalidate(); worldObj.setBlockToAir(xCoord, yCoord + 1, zCoord); api.registries() .moveable() .getHandler(passenger) .moveTile(passenger, worldObj, targetX, yCoord + 1, targetZ); api.registries().moveable().doneMoving(passenger); passenger.validate(); } // Handler IMovableTiles and vanilla TEs without AE } else if (passenger instanceof IMovableTile || passenger.getClass().getName().startsWith("net.minecraft.tileentity")) { boolean imovable = passenger instanceof IMovableTile; if (imovable) ((IMovableTile) passenger).prepareToMove(); worldObj.setBlock( targetX, yCoord + 1, targetZ, worldObj.getBlock(xCoord, yCoord + 1, zCoord), worldObj.getBlockMetadata(xCoord, yCoord + 1, zCoord), 3); passenger.invalidate(); worldObj.setBlockToAir(xCoord, yCoord + 1, zCoord); // IMovableHandler default code Chunk c = worldObj.getChunkFromBlockCoords(targetX, targetZ); c.func_150812_a(targetX & 0xF, yCoord + 1, targetZ & 0xF, passenger); if (c.isChunkLoaded) { worldObj.addTileEntity(passenger); worldObj.markBlockForUpdate(targetX, yCoord + 1, targetZ); } if (imovable) ((IMovableTile) passenger).doneMoving(); passenger.validate(); } } // Move self this.invalidate(); worldObj.removeTileEntity(xCoord, yCoord, zCoord); worldObj.setBlock(xCoord, yCoord, zCoord, Block.getBlockFromName("air"), 0, 2); worldObj.setBlock( targetX, yCoord, targetZ, ThaumicTinkerer.registry.getFirstBlockFromClass(BlockMobilizer.class)); int oldX = xCoord; int oldZ = zCoord; this.xCoord = targetX; this.zCoord = targetZ; this.validate(); worldObj.addTileEntity(this); worldObj.removeTileEntity(oldX, yCoord, oldZ); worldObj.notifyBlockChange(oldX, yCoord, oldZ, Block.getBlockFromName("air")); } } } }