From bc3963b8dca553e58b0258b3fec630de1923ae9e Mon Sep 17 00:00:00 2001 From: asiekierka Date: Tue, 14 Jul 2015 00:37:07 +0200 Subject: [PATCH] improve pipe rotatablity in blueprints, begin adding heuristic detection of necessary rotation code --- common/buildcraft/BuildCraftTransport.java | 32 ++++++++++++------- ...mPipeFilters.java => BptPipeFiltered.java} | 4 +-- .../transport/schematics/BptPipeIron.java | 31 ------------------ ...tPipeWooden.java => BptPipeRotatable.java} | 4 +-- 4 files changed, 25 insertions(+), 46 deletions(-) rename common/buildcraft/transport/schematics/{BptItemPipeFilters.java => BptPipeFiltered.java} (92%) delete mode 100644 common/buildcraft/transport/schematics/BptPipeIron.java rename common/buildcraft/transport/schematics/{BptPipeWooden.java => BptPipeRotatable.java} (89%) diff --git a/common/buildcraft/BuildCraftTransport.java b/common/buildcraft/BuildCraftTransport.java index b1422253..4efdd638 100644 --- a/common/buildcraft/BuildCraftTransport.java +++ b/common/buildcraft/BuildCraftTransport.java @@ -71,6 +71,7 @@ import buildcraft.core.proxy.CoreProxy; import buildcraft.transport.BlockFilteredBuffer; import buildcraft.transport.BlockGenericPipe; import buildcraft.transport.FacadePluggable; +import buildcraft.transport.IDiamondPipe; import buildcraft.transport.IMCHandlerTransport; import buildcraft.transport.ItemFacade; import buildcraft.transport.ItemGateCopier; @@ -144,9 +145,8 @@ import buildcraft.transport.pluggable.ItemPlug; import buildcraft.transport.pluggable.LensPluggable; import buildcraft.transport.pluggable.PlugPluggable; import buildcraft.transport.render.PipeRendererTESR; -import buildcraft.transport.schematics.BptItemPipeFilters; -import buildcraft.transport.schematics.BptPipeIron; -import buildcraft.transport.schematics.BptPipeWooden; +import buildcraft.transport.schematics.BptPipeFiltered; +import buildcraft.transport.schematics.BptPipeRotatable; import buildcraft.transport.schematics.SchematicPipe; import buildcraft.transport.statements.ActionEnergyPulsar; import buildcraft.transport.statements.ActionExtractionPreset; @@ -462,16 +462,26 @@ public class BuildCraftTransport extends BuildCraftMod { BuilderAPI.schematicRegistry.registerSchematicBlock(genericPipeBlock, SchematicPipe.class); - new BptPipeIron(pipeItemsIron); - new BptPipeIron(pipeFluidsIron); - new BptPipeIron(pipePowerIron); + new BptPipeRotatable(pipeItemsWood); + new BptPipeRotatable(pipeFluidsWood); + new BptPipeRotatable(pipePowerWood); + new BptPipeRotatable(pipeItemsIron); + new BptPipeRotatable(pipeFluidsIron); + new BptPipeRotatable(pipePowerIron); + new BptPipeRotatable(pipeItemsEmerald); + new BptPipeRotatable(pipeFluidsEmerald); + new BptPipeRotatable(pipePowerEmerald); - new BptPipeWooden(pipeItemsWood); - new BptPipeWooden(pipeFluidsWood); - new BptPipeWooden(pipePowerWood); - new BptPipeWooden(pipeItemsEmerald); + new BptPipeRotatable(pipeItemsDaizuli); + new BptPipeRotatable(pipeItemsEmzuli); - new BptItemPipeFilters(pipeItemsDiamond); + for (Item itemPipe : BlockGenericPipe.pipes.keySet()) { + Class klazz = BlockGenericPipe.pipes.get(itemPipe); + + if (IDiamondPipe.class.isAssignableFrom(klazz)) { + new BptPipeFiltered(itemPipe); + } + } BCCreativeTab.get("pipes").setIcon(new ItemStack(BuildCraftTransport.pipeItemsDiamond, 1)); BCCreativeTab.get("facades").setIcon(facadeItem.getFacadeForBlock(Blocks.brick_block, 0)); diff --git a/common/buildcraft/transport/schematics/BptItemPipeFilters.java b/common/buildcraft/transport/schematics/BptPipeFiltered.java similarity index 92% rename from common/buildcraft/transport/schematics/BptItemPipeFilters.java rename to common/buildcraft/transport/schematics/BptPipeFiltered.java index 7aef28a4..ba383152 100644 --- a/common/buildcraft/transport/schematics/BptItemPipeFilters.java +++ b/common/buildcraft/transport/schematics/BptPipeFiltered.java @@ -15,9 +15,9 @@ import buildcraft.api.blueprints.IBuilderContext; import buildcraft.api.blueprints.SchematicTile; import buildcraft.core.lib.inventory.SimpleInventory; -public class BptItemPipeFilters extends BptPipeExtension { +public class BptPipeFiltered extends BptPipeExtension { - public BptItemPipeFilters(Item i) { + public BptPipeFiltered(Item i) { super (i); } diff --git a/common/buildcraft/transport/schematics/BptPipeIron.java b/common/buildcraft/transport/schematics/BptPipeIron.java deleted file mode 100644 index e0059b79..00000000 --- a/common/buildcraft/transport/schematics/BptPipeIron.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team - * http://www.mod-buildcraft.com - * - * BuildCraft is distributed under the terms of the Minecraft Mod Public - * License 1.0, or MMPL. Please check the contents of the license located in - * http://www.mod-buildcraft.com/MMPL-1.0.txt - */ -package buildcraft.transport.schematics; - -import net.minecraft.item.Item; -import net.minecraftforge.common.util.ForgeDirection; - -import buildcraft.api.blueprints.IBuilderContext; -import buildcraft.api.blueprints.SchematicTile; - -public class BptPipeIron extends BptPipeExtension { - - public BptPipeIron(Item i) { - super(i); - } - - @Override - public void rotateLeft(SchematicTile slot, IBuilderContext context) { - int orientation = slot.meta & 7; - int others = slot.meta - orientation; - - slot.meta = ForgeDirection.values()[orientation].getRotation(ForgeDirection.UP).ordinal() + others; - } - -} diff --git a/common/buildcraft/transport/schematics/BptPipeWooden.java b/common/buildcraft/transport/schematics/BptPipeRotatable.java similarity index 89% rename from common/buildcraft/transport/schematics/BptPipeWooden.java rename to common/buildcraft/transport/schematics/BptPipeRotatable.java index 6e8d8013..30a278a7 100644 --- a/common/buildcraft/transport/schematics/BptPipeWooden.java +++ b/common/buildcraft/transport/schematics/BptPipeRotatable.java @@ -14,9 +14,9 @@ import net.minecraftforge.common.util.ForgeDirection; import buildcraft.api.blueprints.IBuilderContext; import buildcraft.api.blueprints.SchematicTile; -public class BptPipeWooden extends BptPipeExtension { +public class BptPipeRotatable extends BptPipeExtension { - public BptPipeWooden(Item i) { + public BptPipeRotatable(Item i) { super (i); }