@Override protected void onRemove() { super.onRemove(); for (int x = -1; x <= 1; x++) { for (int y = -1; y <= 1; y++) { for (int z = -1; z <= 1; z++) { Coord c = getCoord().add(pos); TileEntityExtension tex = c.getTE(TileEntityExtension.class); if (tex != null && tex.getParent() == this) { c.setAir(); } } } } }
public boolean isValidLump(ClayLump lump) { // check volume if (!(Core.cheat)) { int wX = lump.maxX - lump.minX; int wY = lump.maxY - lump.minY; int wZ = lump.maxZ - lump.minZ; int area = wX * wY * wZ; int max_area = 16 * 16 * 16 /* / 4 */; if (!FzConfig.stretchy_clay) { max_area /= 4; } if (area <= 0 || area > max_area) { return false; } } // check bounds final int B = 16 * 3; if (lump.minX < 0) return false; if (lump.minY < 0) return false; if (lump.minZ < 0) return false; if (lump.maxX > B) return false; if (lump.maxY > B) return false; if (lump.maxZ > B) return false; // check for free space (needs to be last, as it can mutate the world) Block block = FzUtil.getTraceHelper(); for (int dx = -1; dx <= 1; dx++) { for (int dy = -1; dy <= 1; dy++) { for (int dz = -1; dz <= 1; dz++) { AxisAlignedBB ab = new AxisAlignedBB( pos.getX() + dx, pos.getY() + dy, pos.getZ() + dz, pos.getX() + dx + 1, pos.getY() + dy + 1, pos.getZ() + dz + 1); Coord c = getCoord(); c.x += dx; c.y += dy; c.z += dz; lump.toRotatedBlockBounds(this, block); AxisAlignedBB in = block.getCollisionBoundingBox(worldObj, pos, c.getState()); if (in != null && ab.intersectsWith(in)) { // This block needs to be an Extension, or this if (c.isAir() || c.isReplacable()) { c.setId(Core.registry.legacy_factory_block); TileEntityExtension tex = new TileEntityExtension(this); c.setTE(tex); tex.getBlockClass().enforce(c); continue; } TileEntity te = c.getTE(); if (te == this) { continue; } if (te instanceof TileEntityExtension) { TileEntityExtension tex = (TileEntityExtension) te; if (tex.getParent() == this) { continue; } } // We used to not allow this. We just make a bit of noise instead. // A notification will indicate that things will be a bit messed up here. // FIXME: Let block collision boxes go outside the block (Notch hard-coded for fences) new Notice(c, "!").sendToAll(); } } } } return true; }