diff --git a/common/buildcraft/BuildCraftBuilders.java b/common/buildcraft/BuildCraftBuilders.java index 26096fd8..6b64ef73 100644 --- a/common/buildcraft/BuildCraftBuilders.java +++ b/common/buildcraft/BuildCraftBuilders.java @@ -27,6 +27,7 @@ import buildcraft.api.bptblocks.BptBlockSign; import buildcraft.api.bptblocks.BptBlockStairs; import buildcraft.api.bptblocks.BptBlockWallSide; import buildcraft.api.filler.FillerManager; +import buildcraft.api.filler.IFillerPattern; import buildcraft.api.gates.ActionManager; import buildcraft.builders.BlockArchitect; import buildcraft.builders.BlockBlueprintLibrary; @@ -34,7 +35,6 @@ import buildcraft.builders.BlockBuilder; import buildcraft.builders.BlockFiller; import buildcraft.builders.BlockMarker; import buildcraft.builders.BlockPathMarker; -import buildcraft.builders.BuilderProxyClient; import buildcraft.builders.EventHandlerBuilders; import buildcraft.builders.filler.pattern.PatternFill; import buildcraft.builders.filler.pattern.PatternPyramid; @@ -64,12 +64,12 @@ import buildcraft.core.Version; import buildcraft.core.blueprints.BptPlayerIndex; import buildcraft.core.blueprints.BptRootIndex; import buildcraft.core.proxy.CoreProxy; +import buildcraft.core.utils.BCLog; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLInterModComms; -import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.event.FMLServerStoppingEvent; import cpw.mods.fml.common.network.NetworkMod; @@ -82,7 +82,6 @@ import java.io.IOException; import java.util.LinkedList; import java.util.TreeMap; import net.minecraft.block.Block; -import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -288,16 +287,21 @@ public class BuildCraftBuilders { MinecraftForge.EVENT_BUS.register(this); // Create filler registry - FillerManager.registry = new FillerRegistry(); + try { + FillerManager.registry = new FillerRegistry(); - // INIT FILLER PATTERNS - FillerManager.registry.addPattern(PatternFill.INSTANCE); - FillerManager.registry.addPattern(new PatternFlatten()); - FillerManager.registry.addPattern(new PatternHorizon()); - FillerManager.registry.addPattern(new PatternClear()); - FillerManager.registry.addPattern(new PatternBox()); - FillerManager.registry.addPattern(new PatternPyramid()); - FillerManager.registry.addPattern(new PatternStairs()); + // INIT FILLER PATTERNS + FillerManager.registry.addPattern(PatternFill.INSTANCE); + FillerManager.registry.addPattern(new PatternFlatten()); + FillerManager.registry.addPattern(new PatternHorizon()); + FillerManager.registry.addPattern(new PatternClear()); + FillerManager.registry.addPattern(new PatternBox()); + FillerManager.registry.addPattern(new PatternPyramid()); + FillerManager.registry.addPattern(new PatternStairs()); + } catch (Error error) { + BCLog.logErrorAPI("Buildcraft", error, IFillerPattern.class); + throw error; + } ActionManager.registerActionProvider(new BuildersActionProvider()); } diff --git a/common/buildcraft/BuildCraftTransport.java b/common/buildcraft/BuildCraftTransport.java index 840969c3..6a6199de 100644 --- a/common/buildcraft/BuildCraftTransport.java +++ b/common/buildcraft/BuildCraftTransport.java @@ -8,6 +8,7 @@ package buildcraft; import buildcraft.api.core.IIconProvider; +import buildcraft.api.filler.IFillerPattern; import buildcraft.api.gates.ActionManager; import buildcraft.api.recipes.AssemblyRecipe; import buildcraft.api.transport.IExtractionHandler; @@ -20,6 +21,7 @@ import buildcraft.core.Version; import buildcraft.core.proxy.CoreProxy; import buildcraft.core.triggers.BCAction; import buildcraft.core.triggers.BCTrigger; +import buildcraft.core.utils.BCLog; import buildcraft.core.utils.EnumColor; import buildcraft.transport.BlockFilteredBuffer; import buildcraft.transport.BlockGenericPipe; @@ -177,11 +179,9 @@ public class BuildCraftTransport { public static BCAction actionExtractionPresetBlue = new ActionExtractionPreset(-1, EnumColor.BLUE); public static BCAction actionExtractionPresetGreen = new ActionExtractionPreset(-1, EnumColor.GREEN); public static BCAction actionExtractionPresetYellow = new ActionExtractionPreset(-1, EnumColor.YELLOW); - public IIconProvider pipeIconProvider = new PipeIconProvider(); public IIconProvider gateIconProvider = new GateIconProvider(); public IIconProvider wireIconProvider = new WireIconProvider(); - @Instance("BuildCraft|Transport") public static BuildCraftTransport instance; @@ -293,7 +293,7 @@ public class BuildCraftTransport { pipeItemsSandstone = buildPipe(DefaultProps.PIPE_ITEMS_SANDSTONE_ID, PipeItemsSandstone.class, "Sandstone Transport Pipe", Block.sandStone, Block.glass, Block.sandStone); pipeItemsVoid = buildPipe(DefaultProps.PIPE_ITEMS_VOID_ID, PipeItemsVoid.class, "Void Transport Pipe", "dyeBlack", Block.glass, Item.redstone); pipeItemsEmzuli = buildPipe(DefaultProps.PIPE_ITEMS_EMZULI_ID, PipeItemsEmzuli.class, "Emzuli Transport Pipe", Block.blockLapis, Block.glass, Item.emerald); - + pipeFluidsWood = buildPipe(DefaultProps.PIPE_LIQUIDS_WOOD_ID, PipeFluidsWood.class, "Wooden Waterproof Pipe", pipeWaterproof, pipeItemsWood); pipeFluidsCobblestone = buildPipe(DefaultProps.PIPE_LIQUIDS_COBBLESTONE_ID, PipeFluidsCobblestone.class, "Cobblestone Waterproof Pipe", pipeWaterproof, pipeItemsCobblestone); pipeFluidsStone = buildPipe(DefaultProps.PIPE_LIQUIDS_STONE_ID, PipeFluidsStone.class, "Stone Waterproof Pipe", pipeWaterproof, pipeItemsStone); @@ -449,11 +449,15 @@ public class BuildCraftTransport { GameRegistry.addRecipe(facadeItem.new FacadeRecipe()); // Assembly table recipes, moved from PreInit phase to Init, all mods should be done adding to the OreDictionary by now - AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(500, new ItemStack(redPipeWire, 8), "dyeRed", 1, new ItemStack(Item.redstone), new ItemStack(Item.ingotIron))); - AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(500, new ItemStack(bluePipeWire, 8), "dyeBlue", 1, new ItemStack(Item.redstone), new ItemStack(Item.ingotIron))); - AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(500, new ItemStack(greenPipeWire, 8), "dyeGreen", 1, new ItemStack(Item.redstone), new ItemStack(Item.ingotIron))); - AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(500, new ItemStack(yellowPipeWire, 8), "dyeYellow", 1, new ItemStack(Item.redstone), new ItemStack(Item.ingotIron))); - AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[]{new ItemStack(pipeStructureCobblestone)}, 1000, new ItemStack(plugItem, 8))); + try { + AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(500, new ItemStack(redPipeWire, 8), "dyeRed", 1, new ItemStack(Item.redstone), new ItemStack(Item.ingotIron))); + AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(500, new ItemStack(bluePipeWire, 8), "dyeBlue", 1, new ItemStack(Item.redstone), new ItemStack(Item.ingotIron))); + AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(500, new ItemStack(greenPipeWire, 8), "dyeGreen", 1, new ItemStack(Item.redstone), new ItemStack(Item.ingotIron))); + AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(500, new ItemStack(yellowPipeWire, 8), "dyeYellow", 1, new ItemStack(Item.redstone), new ItemStack(Item.ingotIron))); + AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[]{new ItemStack(pipeStructureCobblestone)}, 1000, new ItemStack(plugItem, 8))); + } catch (Error error) { + BCLog.logErrorAPI("Buildcraft", error, AssemblyRecipe.class); + } } @EventHandler diff --git a/common/buildcraft/core/utils/MathUtils.java b/common/buildcraft/core/utils/MathUtils.java index 4a676d97..ad6432fe 100644 --- a/common/buildcraft/core/utils/MathUtils.java +++ b/common/buildcraft/core/utils/MathUtils.java @@ -14,6 +14,10 @@ package buildcraft.core.utils; */ public class MathUtils { + public static float clamp(float value, float min, float max) { + return value < min ? min : (value > max ? max : value); + } + public static double clamp(double value, double min, double max) { return value < min ? min : (value > max ? max : value); } diff --git a/common/buildcraft/transport/pipes/PipeItemsGold.java b/common/buildcraft/transport/pipes/PipeItemsGold.java index d474ca2f..9c5bfa1e 100644 --- a/common/buildcraft/transport/pipes/PipeItemsGold.java +++ b/common/buildcraft/transport/pipes/PipeItemsGold.java @@ -9,6 +9,7 @@ package buildcraft.transport.pipes; import buildcraft.BuildCraftTransport; import buildcraft.api.core.IIconProvider; +import buildcraft.core.utils.MathUtils; import buildcraft.transport.Pipe; import buildcraft.transport.PipeIconProvider; import buildcraft.transport.PipeTransportItems; @@ -39,6 +40,6 @@ public class PipeItemsGold extends Pipe { public void eventHandler(PipeEventItem.AdjustSpeed event) { event.handled = true; TravelingItem item = event.item; - item.setSpeed(Math.min(Math.max(TransportConstants.PIPE_NORMAL_SPEED, item.getSpeed()) * 4f, TransportConstants.PIPE_NORMAL_SPEED * 20F)); + item.setSpeed(MathUtils.clamp(item.getSpeed() * 4F, TransportConstants.PIPE_NORMAL_SPEED * 4F, TransportConstants.PIPE_NORMAL_SPEED * 20F)); } }