From 5fde18014b45483e6812aedf9dfa1f56d068cf7b Mon Sep 17 00:00:00 2001 From: asiekierka Date: Sun, 26 Oct 2014 12:42:11 +0100 Subject: [PATCH] fix style --- api/buildcraft/api/core/BlockMetaPair.java | 2 +- api/buildcraft/api/core/StackKey.java | 1 - common/buildcraft/BuildCraftEnergy.java | 1 - common/buildcraft/BuildCraftFactory.java | 1 - common/buildcraft/BuildCraftSilicon.java | 1 - common/buildcraft/BuildCraftTransport.java | 1 - .../builders/HeuristicBlockDetection.java | 22 ++++++++++++++----- .../core/blueprints/SchematicRegistry.java | 7 +----- .../core/builders/TileAbstractBuilder.java | 1 - 9 files changed, 18 insertions(+), 19 deletions(-) diff --git a/api/buildcraft/api/core/BlockMetaPair.java b/api/buildcraft/api/core/BlockMetaPair.java index d23c2163..f4f2cf01 100644 --- a/api/buildcraft/api/core/BlockMetaPair.java +++ b/api/buildcraft/api/core/BlockMetaPair.java @@ -37,7 +37,7 @@ public class BlockMetaPair implements Comparable { if (arg.id != id) { return (id - arg.id) * 16; } else { - return (meta - arg.meta); + return meta - arg.meta; } } } diff --git a/api/buildcraft/api/core/StackKey.java b/api/buildcraft/api/core/StackKey.java index 9c9ef0e0..092c173f 100644 --- a/api/buildcraft/api/core/StackKey.java +++ b/api/buildcraft/api/core/StackKey.java @@ -11,7 +11,6 @@ package buildcraft.api.core; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidStack; diff --git a/common/buildcraft/BuildCraftEnergy.java b/common/buildcraft/BuildCraftEnergy.java index cec4751c..81f3f898 100644 --- a/common/buildcraft/BuildCraftEnergy.java +++ b/common/buildcraft/BuildCraftEnergy.java @@ -52,7 +52,6 @@ import buildcraft.core.BlockSpring; import buildcraft.core.DefaultProps; import buildcraft.core.InterModComms; import buildcraft.core.Version; -import buildcraft.core.blueprints.SchematicRegistry; import buildcraft.core.network.BuildCraftChannelHandler; import buildcraft.core.proxy.CoreProxy; import buildcraft.energy.BlockBuildcraftFluid; diff --git a/common/buildcraft/BuildCraftFactory.java b/common/buildcraft/BuildCraftFactory.java index c34688f2..3f9d764e 100644 --- a/common/buildcraft/BuildCraftFactory.java +++ b/common/buildcraft/BuildCraftFactory.java @@ -38,7 +38,6 @@ import buildcraft.builders.schematics.SchematicIgnoreMeta; import buildcraft.core.DefaultProps; import buildcraft.core.InterModComms; import buildcraft.core.Version; -import buildcraft.core.blueprints.SchematicRegistry; import buildcraft.core.network.BuildCraftChannelHandler; import buildcraft.core.proxy.CoreProxy; import buildcraft.core.utils.ConfigUtils; diff --git a/common/buildcraft/BuildCraftSilicon.java b/common/buildcraft/BuildCraftSilicon.java index ca38ec5d..91cb6be2 100644 --- a/common/buildcraft/BuildCraftSilicon.java +++ b/common/buildcraft/BuildCraftSilicon.java @@ -36,7 +36,6 @@ import buildcraft.core.InterModComms; import buildcraft.core.ItemBuildCraft; import buildcraft.core.ItemRobot; import buildcraft.core.Version; -import buildcraft.core.blueprints.SchematicRegistry; import buildcraft.core.network.BuildCraftChannelHandler; import buildcraft.core.proxy.CoreProxy; import buildcraft.core.robots.RobotIntegrationRecipe; diff --git a/common/buildcraft/BuildCraftTransport.java b/common/buildcraft/BuildCraftTransport.java index 05427dea..4629e145 100644 --- a/common/buildcraft/BuildCraftTransport.java +++ b/common/buildcraft/BuildCraftTransport.java @@ -51,7 +51,6 @@ import buildcraft.core.InterModComms; import buildcraft.core.ItemBuildCraft; import buildcraft.core.PowerMode; import buildcraft.core.Version; -import buildcraft.core.blueprints.SchematicRegistry; import buildcraft.core.network.BuildCraftChannelHandler; import buildcraft.core.proxy.CoreProxy; import buildcraft.silicon.ItemRedstoneChipset.Chipset; diff --git a/common/buildcraft/builders/HeuristicBlockDetection.java b/common/buildcraft/builders/HeuristicBlockDetection.java index c7e36b0d..2c08f71c 100644 --- a/common/buildcraft/builders/HeuristicBlockDetection.java +++ b/common/buildcraft/builders/HeuristicBlockDetection.java @@ -1,15 +1,19 @@ package buildcraft.builders; -import buildcraft.api.blueprints.SchematicBlock; -import buildcraft.api.blueprints.SchematicFluid; -import buildcraft.core.blueprints.SchematicRegistry; import net.minecraft.block.Block; import net.minecraft.item.Item; + import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; +import buildcraft.api.blueprints.SchematicBlock; +import buildcraft.api.blueprints.SchematicFluid; +import buildcraft.builders.schematics.SchematicBlockCreative; +import buildcraft.core.blueprints.SchematicRegistry; + public final class HeuristicBlockDetection { + private HeuristicBlockDetection() { } @@ -29,12 +33,14 @@ public final class HeuristicBlockDetection { for (int meta = 0; meta < 16; meta++) { if (!SchematicRegistry.INSTANCE.isSupported(block, meta)) { + boolean creativeOnly = false; + // Stops dupes with (for instance) ore blocks try { if (block.getItemDropped(meta, null, 0) != Item.getItemFromBlock(block)) { - continue; + creativeOnly = true; } - } catch(NullPointerException e) { + } catch (NullPointerException e) { // The "null" for Random in getItemDropped stops blocks // depending on an RNG for deciding the dropped item // from being autodetected. @@ -43,7 +49,11 @@ public final class HeuristicBlockDetection { continue; } - SchematicRegistry.INSTANCE.registerSchematicBlock(block, meta, SchematicBlock.class); + if (creativeOnly) { + SchematicRegistry.INSTANCE.registerSchematicBlock(block, meta, SchematicBlock.class); + } else { + SchematicRegistry.INSTANCE.registerSchematicBlock(block, meta, SchematicBlockCreative.class); + } } } } diff --git a/common/buildcraft/core/blueprints/SchematicRegistry.java b/common/buildcraft/core/blueprints/SchematicRegistry.java index 90048764..7c35f89a 100644 --- a/common/buildcraft/core/blueprints/SchematicRegistry.java +++ b/common/buildcraft/core/blueprints/SchematicRegistry.java @@ -14,15 +14,10 @@ import java.util.HashMap; import java.util.HashSet; import net.minecraft.block.Block; -import net.minecraft.block.ITileEntityProvider; import net.minecraft.entity.Entity; import net.minecraft.init.Blocks; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Property; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; import buildcraft.api.blueprints.ISchematicRegistry; import buildcraft.api.blueprints.Schematic; @@ -31,7 +26,7 @@ import buildcraft.api.blueprints.SchematicEntity; import buildcraft.api.core.BlockMetaPair; import buildcraft.api.core.JavaTools; -public class SchematicRegistry implements ISchematicRegistry { +public final class SchematicRegistry implements ISchematicRegistry { public static SchematicRegistry INSTANCE = new SchematicRegistry(); diff --git a/common/buildcraft/core/builders/TileAbstractBuilder.java b/common/buildcraft/core/builders/TileAbstractBuilder.java index 82154f4b..741abc85 100755 --- a/common/buildcraft/core/builders/TileAbstractBuilder.java +++ b/common/buildcraft/core/builders/TileAbstractBuilder.java @@ -20,7 +20,6 @@ import buildcraft.core.IBoxProvider; import buildcraft.core.LaserData; import buildcraft.core.RFBattery; import buildcraft.core.TileBuildCraft; -import buildcraft.core.blueprints.SchematicRegistry; import buildcraft.core.network.RPC; import buildcraft.core.network.RPCHandler; import buildcraft.core.network.RPCMessageInfo;