From d5f75bd23e02997f6a42b07635819e24d3df0e24 Mon Sep 17 00:00:00 2001 From: Adrian Date: Sat, 8 Aug 2015 16:14:55 +0200 Subject: [PATCH] cleanup --- buildcraft_resources/changelog/7.1.1 | 1 + common/buildcraft/BuildCraftBuilders.java | 4 ---- common/buildcraft/BuildCraftEnergy.java | 1 - common/buildcraft/BuildCraftTransport.java | 4 ++++ common/buildcraft/builders/TileArchitect.java | 7 +++++++ common/buildcraft/builders/TileBuilder.java | 16 +--------------- .../blueprints/RecursiveBlueprintReader.java | 5 +---- common/buildcraft/core/TilePathMarker.java | 14 ++++++++++++++ .../buildcraft/core/proxy/CoreProxyClient.java | 1 - common/buildcraft/factory/TileFloodGate.java | 10 +++++++--- common/buildcraft/robotics/EntityRobot.java | 1 + common/buildcraft/robotics/ai/AIRobotBreak.java | 1 + common/buildcraft/transport/Pipe.java | 2 -- 13 files changed, 37 insertions(+), 30 deletions(-) diff --git a/buildcraft_resources/changelog/7.1.1 b/buildcraft_resources/changelog/7.1.1 index 20b175de..fb51cac9 100644 --- a/buildcraft_resources/changelog/7.1.1 +++ b/buildcraft_resources/changelog/7.1.1 @@ -1,5 +1,6 @@ Improvements: +* Flood Gates now have configurable sides. No idea when I fixed that, but it works now. (asie) * Lists * Lists now accept empty Lists for sorting (asie) * Minor GUI tweaks (asie) diff --git a/common/buildcraft/BuildCraftBuilders.java b/common/buildcraft/BuildCraftBuilders.java index 46b0fbba..91378995 100644 --- a/common/buildcraft/BuildCraftBuilders.java +++ b/common/buildcraft/BuildCraftBuilders.java @@ -230,10 +230,6 @@ public class BuildCraftBuilders extends BuildCraftMod { reloadConfig(ConfigManager.RestartRequirement.GAME); - // TODO - //Property dropBlock = BuildCraftCore.mainConfiguration.get("general", "builder.dropBrokenBlocks", false, "set to true to force the builder to drop broken blocks"); - //dropBrokenBlocks = dropBlock.getBoolean(false); - Property printSchematicList = BuildCraftCore.mainConfiguration.get("debug", "printBlueprintSchematicList", false); debugPrintSchematicList = printSchematicList.getBoolean(); } diff --git a/common/buildcraft/BuildCraftEnergy.java b/common/buildcraft/BuildCraftEnergy.java index 90941d68..456b5544 100644 --- a/common/buildcraft/BuildCraftEnergy.java +++ b/common/buildcraft/BuildCraftEnergy.java @@ -123,7 +123,6 @@ public class BuildCraftEnergy extends BuildCraftMod { BuildcraftFuelRegistry.fuel = FuelManager.INSTANCE; BuildcraftFuelRegistry.coolant = CoolantManager.INSTANCE; - // TODO: Reload configs without having to close the game int oilDesertBiomeId = BuildCraftCore.mainConfigManager.register("worldgen.biomes", "biomeOilDesert", DefaultProps.BIOME_OIL_DESERT, "The id for the Oil Desert biome", RestartRequirement.GAME).getInt(); diff --git a/common/buildcraft/BuildCraftTransport.java b/common/buildcraft/BuildCraftTransport.java index cd435c48..4a1fc655 100644 --- a/common/buildcraft/BuildCraftTransport.java +++ b/common/buildcraft/BuildCraftTransport.java @@ -77,9 +77,11 @@ import buildcraft.transport.ItemFacade; import buildcraft.transport.ItemGateCopier; import buildcraft.transport.ItemPipe; import buildcraft.transport.ItemPipeWire; +import buildcraft.transport.LensFilterHandler; import buildcraft.transport.Pipe; import buildcraft.transport.PipeActionProvider; import buildcraft.transport.PipeColoringRecipe; +import buildcraft.transport.PipeEventBus; import buildcraft.transport.PipeIconProvider; import buildcraft.transport.PipeTriggerProvider; import buildcraft.transport.TileFilteredBuffer; @@ -480,6 +482,8 @@ public class BuildCraftTransport extends BuildCraftMod { } } + PipeEventBus.registerGlobalHandler(new LensFilterHandler()); + BCCreativeTab.get("pipes").setIcon(new ItemStack(BuildCraftTransport.pipeItemsDiamond, 1)); BCCreativeTab.get("facades").setIcon(facadeItem.getFacadeForBlock(Blocks.brick_block, 0)); if (Loader.isModLoaded("BuildCraft|Silicon")) { diff --git a/common/buildcraft/builders/TileArchitect.java b/common/buildcraft/builders/TileArchitect.java index 56e12f04..25cf76d1 100644 --- a/common/buildcraft/builders/TileArchitect.java +++ b/common/buildcraft/builders/TileArchitect.java @@ -44,6 +44,8 @@ import buildcraft.core.lib.utils.NetworkUtils; import buildcraft.core.lib.utils.Utils; public class TileArchitect extends TileBuildCraft implements IInventory, IBoxProvider, ICommandReceiver, ILEDProvider { + + public enum Mode { EDIT, COPY } @@ -66,6 +68,11 @@ public class TileArchitect extends TileBuildCraft implements IInventory, IBoxPro box.kind = Kind.BLUE_STRIPES; } + public void storeBlueprintStack(ItemStack blueprintStack) { + setInventorySlotContents(1, blueprintStack); + decrStackSize(0, 1); + } + @Override public void updateEntity() { super.updateEntity(); diff --git a/common/buildcraft/builders/TileBuilder.java b/common/buildcraft/builders/TileBuilder.java index 92fcbd77..9c924e41 100644 --- a/common/buildcraft/builders/TileBuilder.java +++ b/common/buildcraft/builders/TileBuilder.java @@ -23,9 +23,7 @@ import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.WorldSettings.GameType; - import cpw.mods.fml.relauncher.Side; - import net.minecraftforge.common.util.Constants; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; @@ -47,7 +45,6 @@ import buildcraft.builders.blueprints.RecursiveBlueprintBuilder; import buildcraft.core.Box; import buildcraft.core.Box.Kind; import buildcraft.core.LaserData; -import buildcraft.core.TilePathMarker; import buildcraft.core.blueprints.Blueprint; import buildcraft.core.blueprints.BlueprintBase; import buildcraft.core.blueprints.BptBuilderBase; @@ -254,18 +251,7 @@ public class TileBuilder extends TileAbstractBuilder implements IHasWork, IFluid if (tile instanceof IPathProvider) { path = ((IPathProvider) tile).getPath(); - - // TODO (7.1): Add API method for IPathProviders to remove - // themselves from world like IAreaProviders. - if (tile instanceof TilePathMarker) { - for (BlockIndex b : path) { - BuildCraftCore.pathMarkerBlock.dropBlockAsItem( - worldObj, b.x, b.y, b.z, - 0, 0); - - worldObj.setBlockToAir(b.x, b.y, b.z); - } - } + ((IPathProvider) tile).removeFromWorld(); break; } diff --git a/common/buildcraft/builders/blueprints/RecursiveBlueprintReader.java b/common/buildcraft/builders/blueprints/RecursiveBlueprintReader.java index 4e76fd36..74c0ee44 100644 --- a/common/buildcraft/builders/blueprints/RecursiveBlueprintReader.java +++ b/common/buildcraft/builders/blueprints/RecursiveBlueprintReader.java @@ -213,10 +213,7 @@ public class RecursiveBlueprintReader { BuildCraftBuilders.serverDB.add(writingBlueprint.id, nbt); if (parentBlueprint == null) { - // TODO: This is hacky, should probably be done in the architect - // itself. - architect.setInventorySlotContents(1, writingBlueprint.getStack()); - architect.setInventorySlotContents(0, null); + architect.storeBlueprintStack(writingBlueprint.getStack()); } } diff --git a/common/buildcraft/core/TilePathMarker.java b/common/buildcraft/core/TilePathMarker.java index 53ef689a..8460d290 100644 --- a/common/buildcraft/core/TilePathMarker.java +++ b/common/buildcraft/core/TilePathMarker.java @@ -11,6 +11,7 @@ package buildcraft.core; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; +import java.util.List; import io.netty.buffer.ByteBuf; @@ -18,6 +19,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; +import buildcraft.BuildCraftCore; import buildcraft.api.core.BlockIndex; import buildcraft.api.core.IPathProvider; import buildcraft.api.core.Position; @@ -326,4 +328,16 @@ public class TilePathMarker extends TileMarker implements IPathProvider { lasers[1].writeData(data); } } + + @Override + public void removeFromWorld() { + List path = getPath(); + for (BlockIndex b : path) { + BuildCraftCore.pathMarkerBlock.dropBlockAsItem( + worldObj, b.x, b.y, b.z, + 0, 0); + + worldObj.setBlockToAir(b.x, b.y, b.z); + } + } } diff --git a/common/buildcraft/core/proxy/CoreProxyClient.java b/common/buildcraft/core/proxy/CoreProxyClient.java index acfaefab..a2c26563 100644 --- a/common/buildcraft/core/proxy/CoreProxyClient.java +++ b/common/buildcraft/core/proxy/CoreProxyClient.java @@ -96,7 +96,6 @@ public class CoreProxyClient extends CoreProxy { RenderingRegistry.registerBlockHandler(BuildCraftCore.complexBlockModel, new RenderBlockComplex()); ClientRegistry.bindTileEntitySpecialRenderer(TilePathMarker.class, new RenderPathMarker()); - //TODO Update me to grab differing trunk textures ClientRegistry.bindTileEntitySpecialRenderer(TileEngineBase.class, new RenderEngine()); for (int i = 0; i < BuildCraftCore.engineBlock.getEngineCount(); i++) { RenderingEntityBlocks.blockByEntityRenders.put(new RenderingEntityBlocks.EntityRenderIndex(BuildCraftCore.engineBlock, i), new RenderEngine((TileEngineBase) BuildCraftCore.engineBlock.createTileEntity(null, i))); diff --git a/common/buildcraft/factory/TileFloodGate.java b/common/buildcraft/factory/TileFloodGate.java index 17b5555f..06906c0f 100644 --- a/common/buildcraft/factory/TileFloodGate.java +++ b/common/buildcraft/factory/TileFloodGate.java @@ -256,19 +256,23 @@ public class TileFloodGate extends TileBuildCraft implements IFluidHandler { } } - // TODO: fit in single byte @Override public void readData(ByteBuf stream) { + byte flags = stream.readByte(); for (int i = 0; i < 6; i++) { - blockedSides[i] = stream.readBoolean(); + blockedSides[i] = (flags & (1 << i)) != 0; } } @Override public void writeData(ByteBuf stream) { + byte flags = 0; for (int i = 0; i < 6; i++) { - stream.writeBoolean(blockedSides[i]); + if (blockedSides[i]) { + flags |= 1 << i; + } } + stream.writeByte(flags); } public void switchSide(ForgeDirection side) { diff --git a/common/buildcraft/robotics/EntityRobot.java b/common/buildcraft/robotics/EntityRobot.java index 6eecfdae..c27d8248 100644 --- a/common/buildcraft/robotics/EntityRobot.java +++ b/common/buildcraft/robotics/EntityRobot.java @@ -10,6 +10,7 @@ package buildcraft.robotics; import java.util.ArrayList; import java.util.Date; +import java.util.HashSet; import java.util.List; import java.util.WeakHashMap; diff --git a/common/buildcraft/robotics/ai/AIRobotBreak.java b/common/buildcraft/robotics/ai/AIRobotBreak.java index d9c28066..ed7702a2 100644 --- a/common/buildcraft/robotics/ai/AIRobotBreak.java +++ b/common/buildcraft/robotics/ai/AIRobotBreak.java @@ -66,6 +66,7 @@ public class AIRobotBreak extends AIRobot { hardness = block.getBlockHardness(robot.worldObj, blockToBreak.x, blockToBreak.y, blockToBreak.z); speed = getBreakSpeed(robot, robot.getHeldItem(), block, meta); } + if (block.isAir(robot.worldObj, blockToBreak.x, blockToBreak.y, blockToBreak.z)) { setSuccess(false); terminate(); diff --git a/common/buildcraft/transport/Pipe.java b/common/buildcraft/transport/Pipe.java index 65797158..d7148cd9 100644 --- a/common/buildcraft/transport/Pipe.java +++ b/common/buildcraft/transport/Pipe.java @@ -62,8 +62,6 @@ public abstract class Pipe implements IDropControlInven this.item = item; eventBus.registerHandler(this); - // TODO: Move to globalHandlers once a priority system is in place - eventBus.registerHandler(new LensFilterHandler()); } public void setTile(TileEntity tile) {