@Override public void invalidate() { if (host != null) { host.onTileInvalidate(this); } super.invalidate(); }
@Override public void invalidate() { super.invalidate(); if (pNetwork != null) { pNetwork.removeMachine(this); } }
@Override public void invalidate() { super.invalidate(); // Make sure to remove the node from its network when its environment, // meaning this tile entity, gets unloaded. for (Node node : nodes) { if (node != null) node.remove(); } }
@Override public void invalidate() { if (addedToEnergyNet) { MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this)); addedToEnergyNet = false; } super.invalidate(); }
@Override public void invalidate() { super.invalidate(); try { renderer.deleteAllDisplayLists(); } catch (NullPointerException ex) { } PortalgunMod.portalList.remove(this); }
public static void check(TileEntity te) { for (SegmentTileEntity segment : segmentsTile.get(te.getClass())) { if (!segment.shouldExist(te)) { ItemStack itemStack = new ItemStack(te.getBlockType(), 1, te.getBlockMetadata()); NBTTagCompound nbt = new NBTTagCompound(); te.writeToNBT(nbt); itemStack.setTagCompound(nbt); WorldUtils.dropAsEntity(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, itemStack); te.getWorldObj().setBlock(te.xCoord, te.yCoord, te.zCoord, Blocks.air); te.invalidate(); MyTown.instance.LOG.info("TileEntity {} was ATOMICALLY DISINTEGRATED!", te.toString()); return; } } }
public void convertDummies() { int n = 0; boolean axis = (facing.equals(ForgeDirection.EAST) || facing.equals(ForgeDirection.WEST)); int dir = (facing.equals(ForgeDirection.WEST) || facing.equals(ForgeDirection.NORTH)) ? -1 : 1; for (int k = -1; k < 3; k++) for (int i = 0; i < 7; i++) for (int j = -3; j < 4; j++) { int r = Vector3.Int((Math.sqrt(j * j + (i - 3) * (i - 3) + (k + 1) * (k + 1)))); if (r != 3 && !(k == -1 && r <= 3)) continue; if (j == 0 && k == 0 && (i == 0 || i == 1)) continue; if (k == 2 && i == 3 && j == 0) continue; int x = xCoord + (axis ? i * dir : j); int z = zCoord + (axis ? j : i * dir); int y = yCoord + k; if (x == xCoord && y == yCoord && z == zCoord) continue; worldObj.setBlock(x, y, z, limekiln, 2 + type, 3); TileEntityMultiBlockPart dummyTE; TileEntity te = worldObj.getTileEntity(x, y, z); if (te instanceof TileEntityMultiBlockPart) dummyTE = (TileEntityMultiBlockPart) te; else { if (te != null) { te.invalidate(); worldObj.removeTileEntity(x, y, z); } dummyTE = new TileEntityMultiBlockPart(); worldObj.setTileEntity(x, y, z, dummyTE); } dummyTE.type = type; dummyTE.revertID = partBlocks; dummyTE.setCore(this); worldObj.markBlockForUpdate(x, y, z); } isValidMultiblock = true; }
@Override public void invalidate() { super.invalidate(); init = false; if (controllerPosition != null && worldObj.blockExists(controllerPosition.x, controllerPosition.y, controllerPosition.z)) { TileEntity te = worldObj.getTileEntity(controllerPosition.x, controllerPosition.y, controllerPosition.z); if (te instanceof WorkSiteWarehouse) { WorkSiteWarehouse warehouse = (WorkSiteWarehouse) te; BlockPosition min = warehouse.getWorkBoundsMin(); BlockPosition max = warehouse.getWorkBoundsMax(); if (xCoord >= min.x && xCoord <= max.x && yCoord >= min.y && yCoord <= max.y && zCoord >= min.z && zCoord <= max.z) { warehouse.removeInputBlock(this); } } } controllerPosition = null; }
/** invalidates a tile entity */ public void invalidate() { super.invalidate(); this.updateContainingBlockInfo(); }
@Override public void invalidate() { super.invalidate(); this.onChunkUnload(); }
@Override public void invalidate() { energySource.invalidate(); super.invalidate(); }
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")); } } } }