diff --git a/README.md b/README.md index a31f8c920c..c04a5a28ed 100644 --- a/README.md +++ b/README.md @@ -90,8 +90,15 @@ this repository will have to be rejected. Add the following to your build.gradle file: ``` +repositories { + ivy { + name "BuildCraft" + artifactPattern "http://www.mod-buildcraft.com/releases/BuildCraft/[revision]/[module]-[revision]-[classifier].[ext]" + } +} + dependencies { - compile 'com.mod-buildcraft:buildcraft:6.1.8:dev' + compile name: "buildcraft", version: "7.0.7", classifier: "dev" } ``` -Where `6.1.8` is the desired version of BuildCraft. +Where `7.0.7` is the desired version of BuildCraft. diff --git a/api/buildcraft/api/blueprints/BuilderAPI.java b/api/buildcraft/api/blueprints/BuilderAPI.java index d68c54e0fa..a911bb3e9e 100644 --- a/api/buildcraft/api/blueprints/BuilderAPI.java +++ b/api/buildcraft/api/blueprints/BuilderAPI.java @@ -6,6 +6,7 @@ public final class BuilderAPI { public static ISchematicRegistry schematicRegistry; + public static ISchematicHelper schematicHelper; public static final int BREAK_ENERGY = 160; public static final int BUILD_ENERGY = 240; diff --git a/api/buildcraft/api/blueprints/ISchematicHelper.java b/api/buildcraft/api/blueprints/ISchematicHelper.java new file mode 100644 index 0000000000..a90d4c9307 --- /dev/null +++ b/api/buildcraft/api/blueprints/ISchematicHelper.java @@ -0,0 +1,7 @@ +package buildcraft.api.blueprints; + +import net.minecraft.item.ItemStack; + +public interface ISchematicHelper { + boolean isEqualItem(ItemStack a, ItemStack b); +} diff --git a/api/buildcraft/api/blueprints/Schematic.java b/api/buildcraft/api/blueprints/Schematic.java index 64d7191856..f34f288579 100755 --- a/api/buildcraft/api/blueprints/Schematic.java +++ b/api/buildcraft/api/blueprints/Schematic.java @@ -6,7 +6,6 @@ import java.util.LinkedList; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.BlockPos; @@ -29,17 +28,22 @@ public abstract class Schematic { /** Blocks are build in various stages, in order to make sure that a block can indeed be placed, and that it's * unlikely to disturb other blocks. */ - public static enum BuildingStage { - /** Standalone blocks can be placed in the air, and they don't change once placed. */ + public enum BuildingStage { + /** Standalone blocks do not change once placed. */ STANDALONE, - /** Supported blocks may require to be placed on a standalone block, e.g. a torch. */ - SUPPORTED, - - /** Expanding blocks will grow and may disturb other block locations, like e.g. water */ + /** Expanding blocks will grow and may disturb other block locations, like liquids. */ EXPANDING } + /** This is called to verify whether the required item is equal to the supplied item. + * + * Primarily rely on this for checking metadata/NBT - the item ID itself might have been filtered out by previously + * running code. */ + public boolean isItemMatchingRequirement(ItemStack suppliedStack, ItemStack requiredStack) { + return BuilderAPI.schematicHelper.isEqualItem(suppliedStack, requiredStack); + } + /** This is called each time an item matches a requirement. By default, it will increase damage of items that can be * damaged by the amount of the requirement, and remove the intended amount of items that can't be damaged. * @@ -75,12 +79,14 @@ public ItemStack useItem(IBuilderContext context, ItemStack req, IInvSlot slot) } } - if (stack.stackSize == 0 && stack.getItem().getContainerItem() != null) { - Item container = stack.getItem().getContainerItem(); - ItemStack newStack = new ItemStack(container); - slot.setStackInSlot(newStack); - } else if (stack.stackSize == 0) { - slot.setStackInSlot(null); + if (stack.stackSize == 0) { + stack.stackSize = 1; + if (stack.getItem().hasContainerItem(stack)) { + ItemStack newStack = stack.getItem().getContainerItem(stack); + slot.setStackInSlot(newStack); + } else { + slot.setStackInSlot(null); + } } return result; diff --git a/api/buildcraft/api/blueprints/SchematicBlock.java b/api/buildcraft/api/blueprints/SchematicBlock.java index 81b9b39b59..798a5c2a88 100755 --- a/api/buildcraft/api/blueprints/SchematicBlock.java +++ b/api/buildcraft/api/blueprints/SchematicBlock.java @@ -4,11 +4,7 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.blueprints; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; +import java.util.*; import net.minecraft.block.Block; import net.minecraft.block.BlockFalling; @@ -21,11 +17,11 @@ import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing.Axis; + import net.minecraftforge.common.util.Constants; import net.minecraftforge.fluids.BlockFluidBase; public class SchematicBlock extends SchematicBlockBase { - public IBlockState state = null; public BuildingPermission defaultPermission = BuildingPermission.ALL; @@ -90,17 +86,21 @@ public void readSchematicFromNBT(NBTTagCompound nbt, MappingRegistry registry) { } } + /** Get a list of relative block coordinates which have to be built before this block can be placed. */ + public Set getPrerequisiteBlocks(IBuilderContext context) { + Set indexes = new HashSet(); + if (state.getBlock() instanceof BlockFalling) { + indexes.add(new BlockPos(0, -1, 0)); + } + return indexes; + } + @Override public BuildingStage getBuildStage() { - Block block = state.getBlock(); - if (block instanceof BlockFalling) { - return BuildingStage.SUPPORTED; - } else if (block instanceof BlockFluidBase || block instanceof BlockLiquid) { + if (state.getBlock() instanceof BlockFluidBase || state.getBlock() instanceof BlockLiquid) { return BuildingStage.EXPANDING; - } else if (block.isOpaqueCube()) { - return BuildingStage.STANDALONE; } else { - return BuildingStage.SUPPORTED; + return BuildingStage.STANDALONE; } } @@ -183,25 +183,24 @@ protected ItemStack getItemStack(IBlockState state) { return getItemStack(state, 1); } - public EnumFacing getFace(IProperty prop) { - return (EnumFacing) state.getValue(prop); - } - // Pretty much all blocks (that rotate) rotate this way now @Override public void rotateLeft(IBuilderContext context) { - @SuppressWarnings("unchecked") + IProperty facingProp = getFacingProp(); + if (facingProp != null) { + EnumFacing face = state.getValue(facingProp); + if (face.getAxis() == Axis.Y) return; + state = state.withProperty(facingProp, face.rotateY()); + } + } + + protected IProperty getFacingProp() { Collection props = state.getPropertyNames(); for (IProperty prop : props) { - if ("facing".equals(prop.getName())) { - EnumFacing face = getFace(prop); - if (face.getAxis() == Axis.Y) { - // Don't attempt to rotate if its facing up or down - break; - } - state = state.withProperty(prop, face.rotateY()); - break; + if ("facing".equals(prop.getName()) && state.getValue(prop) instanceof EnumFacing) { + return prop; } } + return null; } } diff --git a/api/buildcraft/api/blueprints/SchematicMask.java b/api/buildcraft/api/blueprints/SchematicMask.java index 1ff9131898..93520f29ba 100755 --- a/api/buildcraft/api/blueprints/SchematicMask.java +++ b/api/buildcraft/api/blueprints/SchematicMask.java @@ -6,6 +6,9 @@ import java.util.LinkedList; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.BlockPos; @@ -34,13 +37,23 @@ public void placeInWorld(IBuilderContext context, BlockPos pos, LinkedList stacks) { @@ -59,6 +63,9 @@ public void initializeFromObjectAt(IBuilderContext context, BlockPos pos) { if (tile != null) { tile.writeToNBT(tileNBT); } + + tileNBT = (NBTTagCompound) tileNBT.copy(); + onNBTLoaded(); } } @@ -97,6 +104,7 @@ public void readSchematicFromNBT(NBTTagCompound nbt, MappingRegistry registry) { super.readSchematicFromNBT(nbt, registry); tileNBT = nbt.getCompoundTag("blockCpt"); + onNBTLoaded(); } @Override diff --git a/api/buildcraft/api/blueprints/package-info.java b/api/buildcraft/api/blueprints/package-info.java index 467fa2eec7..54339fe00a 100644 --- a/api/buildcraft/api/blueprints/package-info.java +++ b/api/buildcraft/api/blueprints/package-info.java @@ -1,8 +1,10 @@ /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "1.3", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|blueprints") + * The BuildCraft API is distributed under the terms of the MIT License. + * Please check the contents of the license, which should be located + * as "LICENSE.API" in the BuildCraft source code distribution. + */ +@API(apiVersion = "1.5", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|blueprints") package buildcraft.api.blueprints; import net.minecraftforge.fml.common.API; diff --git a/api/buildcraft/api/core/BCLog.java b/api/buildcraft/api/core/BCLog.java index f5ee0a8ef8..1ba70725c6 100644 --- a/api/buildcraft/api/core/BCLog.java +++ b/api/buildcraft/api/core/BCLog.java @@ -4,29 +4,24 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.core; -import java.lang.reflect.Method; - import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; public final class BCLog { - public static final Logger logger = LogManager.getLogger("BuildCraft"); /** Deactivate constructor */ private BCLog() {} - public static void initLog() { - - logger.info("Starting BuildCraft " + getVersion()); - logger.info("Copyright (c) SpaceToad, 2011-2015"); - logger.info("http://www.mod-buildcraft.com"); + @Deprecated + public static void logErrorAPI(String mod, Throwable error, Class classFile) { + logErrorAPI(error, classFile); } - public static void logErrorAPI(String mod, Throwable error, Class classFile) { - StringBuilder msg = new StringBuilder(mod); - msg.append(" API error, please update your mods. Error: ").append(error); + public static void logErrorAPI(Throwable error, Class classFile) { + StringBuilder msg = new StringBuilder("API error! Please update your mods. Error: "); + msg.append(error); StackTraceElement[] stackTrace = error.getStackTrace(); if (stackTrace.length > 0) { msg.append(", ").append(stackTrace[0]); @@ -35,20 +30,13 @@ public static void logErrorAPI(String mod, Throwable error, Class classFile) logger.log(Level.ERROR, msg.toString()); if (classFile != null) { - msg = new StringBuilder(mod); - msg.append(" API error: ").append(classFile.getSimpleName()).append(" is loaded from ").append(classFile.getProtectionDomain() - .getCodeSource().getLocation()); + msg.append("API error: ").append(classFile.getSimpleName()).append(" is loaded from ").append(classFile.getProtectionDomain().getCodeSource().getLocation()); logger.log(Level.ERROR, msg.toString()); } } + @Deprecated public static String getVersion() { - try { - Class clazz = Class.forName("buildcraft.core.Version"); - Method method = clazz.getDeclaredMethod("getVersion"); - return String.valueOf(method.invoke(null)); - } catch (Exception e) { - return "UNKNOWN VERSION"; - } + return BuildCraftAPI.getVersion(); } } diff --git a/api/buildcraft/api/core/BuildCraftAPI.java b/api/buildcraft/api/core/BuildCraftAPI.java index ac5fe096e5..5e172ba183 100644 --- a/api/buildcraft/api/core/BuildCraftAPI.java +++ b/api/buildcraft/api/core/BuildCraftAPI.java @@ -4,6 +4,7 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.core; +import java.lang.reflect.Method; import java.util.HashMap; import java.util.Set; @@ -24,6 +25,16 @@ public final class BuildCraftAPI { /** Deactivate constructor */ private BuildCraftAPI() {} + public static String getVersion() { + try { + Class clazz = Class.forName("buildcraft.core.Version"); + Method method = clazz.getDeclaredMethod("getVersion"); + return String.valueOf(method.invoke(null)); + } catch (Exception e) { + return "UNKNOWN VERSION"; + } + } + public static IWorldProperty getWorldProperty(String name) { return worldProperties.get(name); } diff --git a/api/buildcraft/api/core/EnumPipePart.java b/api/buildcraft/api/core/EnumPipePart.java new file mode 100644 index 0000000000..f3ea8d6fb2 --- /dev/null +++ b/api/buildcraft/api/core/EnumPipePart.java @@ -0,0 +1,118 @@ +package buildcraft.api.core; + +import java.util.Locale; +import java.util.Map; + +import com.google.common.collect.Maps; + +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTBase.NBTPrimitive; +import net.minecraft.nbt.NBTTagString; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.IStringSerializable; + +import io.netty.buffer.ByteBuf; + +public enum EnumPipePart implements IStringSerializable,INetworkLoadable_BC8 { + DOWN(EnumFacing.DOWN), + UP(EnumFacing.UP), + NORTH(EnumFacing.NORTH), + SOUTH(EnumFacing.SOUTH), + WEST(EnumFacing.WEST), + EAST(EnumFacing.EAST), + /** CENTER, UNKNOWN and ALL are all valid uses of this constant. */ + CENTER(null); + + private static final Map facingMap = Maps.newEnumMap(EnumFacing.class); + private static final Map nameMap = Maps.newHashMap(); + private static final int MAX_VALUES = values().length; + + public final EnumFacing face; + + static { + for (EnumPipePart part : values()) { + nameMap.put(part.name(), part); + if (part.face != null) facingMap.put(part.face, part); + } + } + + public static EnumPipePart fromFacing(EnumFacing face) { + if (face == null) return EnumPipePart.CENTER; + return facingMap.get(face); + } + + public static EnumPipePart[] validFaces() { + return new EnumPipePart[] { DOWN, UP, NORTH, SOUTH, WEST, EAST }; + } + + public static EnumPipePart fromMeta(int meta) { + if (meta < 0 || meta >= MAX_VALUES) return EnumPipePart.CENTER; + return values()[meta]; + } + + private EnumPipePart(EnumFacing face) { + this.face = face; + } + + public int getIndex() { + if (face == null) return 6; + return face.getIndex(); + } + + @Override + public String getName() { + return name().toLowerCase(Locale.ROOT); + } + + public EnumPipePart next() { + switch (this) { + case DOWN: + return EAST; + case EAST: + return NORTH; + case NORTH: + return SOUTH; + case SOUTH: + return UP; + case UP: + return WEST; + case WEST: + return DOWN; + default: + return DOWN; + } + } + + public EnumPipePart opposite() { + if (this == CENTER) return CENTER; + return fromFacing(face.getOpposite()); + } + + public static EnumPipePart readFromNBT(NBTBase base) { + if (base == null) return CENTER; + if (base instanceof NBTTagString) { + NBTTagString nbtString = (NBTTagString) base; + String string = nbtString.getString(); + return nameMap.containsKey(string) ? nameMap.get(string) : CENTER; + } else { + byte ord = ((NBTPrimitive) base).getByte(); + if (ord < 0 || ord > 6) return CENTER; + return values()[ord]; + } + } + + public NBTBase writeToNBT() { + return new NBTTagString(name()); + } + + @Override + public EnumPipePart readFromByteBuf(ByteBuf buf) { + byte ord = buf.readByte(); + return fromMeta(ord); + } + + @Override + public void writeToByteBuf(ByteBuf buf) { + buf.writeByte(ordinal()); + } +} diff --git a/api/buildcraft/api/core/IPathProvider.java b/api/buildcraft/api/core/IPathProvider.java index cba5ae3ae1..8994152272 100644 --- a/api/buildcraft/api/core/IPathProvider.java +++ b/api/buildcraft/api/core/IPathProvider.java @@ -7,4 +7,9 @@ /** To be implemented by TileEntities able to provide a path on the world, typically BuildCraft path markers. */ public interface IPathProvider { List getPath(); + + /** + * Remove from the world all objects used to define the path. + */ + void removeFromWorld(); } diff --git a/api/buildcraft/api/core/package-info.java b/api/buildcraft/api/core/package-info.java index ab6a7174cd..12cc9ea131 100644 --- a/api/buildcraft/api/core/package-info.java +++ b/api/buildcraft/api/core/package-info.java @@ -1,8 +1,10 @@ /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "1.5", owner = "BuildCraft|Core", provides = "BuildCraftAPI|core") + * The BuildCraft API is distributed under the terms of the MIT License. + * Please check the contents of the license, which should be located + * as "LICENSE.API" in the BuildCraft source code distribution. + */ +@API(apiVersion = "2.0", owner = "BuildCraft|Core", provides = "BuildCraftAPI|core") package buildcraft.api.core; import net.minecraftforge.fml.common.API; diff --git a/api/buildcraft/api/crops/CropManager.java b/api/buildcraft/api/crops/CropManager.java index e6641f8f47..3d512a7104 100644 --- a/api/buildcraft/api/crops/CropManager.java +++ b/api/buildcraft/api/crops/CropManager.java @@ -45,7 +45,7 @@ public static boolean canSustainPlant(World world, ItemStack seed, BlockPos pos) return true; } } - return defaultHandler.canSustainPlant(world, seed, pos); + return defaultHandler.isSeed(seed) && defaultHandler.canSustainPlant(world, seed, pos); } public static boolean plantCrop(World world, EntityPlayer player, ItemStack seed, BlockPos pos) { @@ -67,13 +67,13 @@ public static boolean isMature(IBlockAccess blockAccess, IBlockState state, Bloc } public static boolean harvestCrop(World world, BlockPos pos, List drops) { + IBlockState state = world.getBlockState(pos); for (ICropHandler cropHandler : handlers) { - IBlockState state = world.getBlockState(pos); if (cropHandler.isMature(world, state, pos)) { return cropHandler.harvestCrop(world, pos, drops); } } - return defaultHandler.harvestCrop(world, pos, drops); + return defaultHandler.isMature(world, state, pos) && defaultHandler.harvestCrop(world, pos, drops); } } diff --git a/api/buildcraft/api/events/RobotEvent.java b/api/buildcraft/api/events/RobotEvent.java new file mode 100644 index 0000000000..a37daa9c0c --- /dev/null +++ b/api/buildcraft/api/events/RobotEvent.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + * + * The BuildCraft API is distributed under the terms of the MIT License. + * Please check the contents of the license, which should be located + * as "LICENSE.API" in the BuildCraft source code distribution. + */ +package buildcraft.api.events; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; + +import net.minecraftforge.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Event; + +import buildcraft.api.robots.EntityRobotBase; + +public abstract class RobotEvent extends Event { + public final EntityRobotBase robot; + + public RobotEvent(EntityRobotBase robot) { + this.robot = robot; + } + + @Cancelable + public static class Place extends RobotEvent { + public final EntityPlayer player; + + public Place(EntityRobotBase robot, EntityPlayer player) { + super(robot); + this.player = player; + } + } + + @Cancelable + public static class Interact extends RobotEvent { + public final EntityPlayer player; + public final ItemStack item; + + public Interact(EntityRobotBase robot, EntityPlayer player, ItemStack item) { + super(robot); + this.player = player; + this.item = item; + } + } + + @Cancelable + public static class Dismantle extends RobotEvent { + public final EntityPlayer player; + + public Dismantle(EntityRobotBase robot, EntityPlayer player) { + super(robot); + this.player = player; + } + } +} diff --git a/api/buildcraft/api/events/package-info.java b/api/buildcraft/api/events/package-info.java index c6ec482f60..87688aa839 100644 --- a/api/buildcraft/api/events/package-info.java +++ b/api/buildcraft/api/events/package-info.java @@ -1,8 +1,10 @@ /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "1.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|events") + * The BuildCraft API is distributed under the terms of the MIT License. + * Please check the contents of the license, which should be located + * as "LICENSE.API" in the BuildCraft source code distribution. + */ +@API(apiVersion = "2.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|events") package buildcraft.api.events; import net.minecraftforge.fml.common.API; diff --git a/api/buildcraft/api/library/LibraryAPI.java b/api/buildcraft/api/library/LibraryAPI.java index a90c92199c..8e5a03ec48 100644 --- a/api/buildcraft/api/library/LibraryAPI.java +++ b/api/buildcraft/api/library/LibraryAPI.java @@ -6,9 +6,9 @@ public final class LibraryAPI { private static final Set handlers = new HashSet(); - private LibraryAPI() { + private LibraryAPI() { - } + } public static Set getHandlerSet() { return handlers; @@ -19,7 +19,7 @@ public static void registerHandler(LibraryTypeHandler handler) { } public static LibraryTypeHandler getHandlerFor(String extension) { - for(LibraryTypeHandler h : handlers) { + for (LibraryTypeHandler h : handlers) { if (h.isInputExtension(extension)) { return h; } diff --git a/api/buildcraft/api/lists/ListMatchHandler.java b/api/buildcraft/api/lists/ListMatchHandler.java new file mode 100644 index 0000000000..7ed405a852 --- /dev/null +++ b/api/buildcraft/api/lists/ListMatchHandler.java @@ -0,0 +1,23 @@ +package buildcraft.api.lists; + +import java.util.List; +import net.minecraft.item.ItemStack; + +public abstract class ListMatchHandler { + public enum Type { + TYPE, MATERIAL, CLASS + } + + public abstract boolean matches(Type type, ItemStack stack, ItemStack target, boolean precise); + public abstract boolean isValidSource(Type type, ItemStack stack); + + /** + * Get custom client examples. + * @param type + * @param stack + * @return A List (even empty!) if the examples satisfy this handler, null if iteration and .matches should be used instead. + */ + public List getClientExamples(Type type, ItemStack stack) { + return null; + } +} diff --git a/api/buildcraft/api/lists/ListRegistry.java b/api/buildcraft/api/lists/ListRegistry.java new file mode 100644 index 0000000000..ce9f05664c --- /dev/null +++ b/api/buildcraft/api/lists/ListRegistry.java @@ -0,0 +1,26 @@ +package buildcraft.api.lists; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import net.minecraft.item.Item; + +public final class ListRegistry { + public static final List> itemClassAsType = new ArrayList>(); + private static final List handlers = new ArrayList(); + + private ListRegistry() { + + } + + public static void registerHandler(ListMatchHandler h) { + if (h != null) { + handlers.add(h); + } + } + + public static List getHandlers() { + return Collections.unmodifiableList(handlers); + } +} diff --git a/api/buildcraft/api/robots/StackRequest.java b/api/buildcraft/api/lists/package-info.java old mode 100755 new mode 100644 similarity index 53% rename from api/buildcraft/api/robots/StackRequest.java rename to api/buildcraft/api/lists/package-info.java index e7676f7783..603c335871 --- a/api/buildcraft/api/robots/StackRequest.java +++ b/api/buildcraft/api/lists/package-info.java @@ -2,14 +2,7 @@ * * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.robots; +@API(apiVersion = "1.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|lists") +package buildcraft.api.lists; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; - -public class StackRequest { - public ItemStack stack; - public int index; - public TileEntity requester; - public DockingStation station; -} +import net.minecraftforge.fml.common.API; diff --git a/api/buildcraft/api/properties/BuildCraftExtendedProperty.java b/api/buildcraft/api/properties/BuildCraftExtendedProperty.java index a6d47c7a64..f7eea6382f 100644 --- a/api/buildcraft/api/properties/BuildCraftExtendedProperty.java +++ b/api/buildcraft/api/properties/BuildCraftExtendedProperty.java @@ -8,7 +8,7 @@ import net.minecraftforge.common.property.IExtendedBlockState; import net.minecraftforge.common.property.IUnlistedProperty; -public class BuildCraftExtendedProperty extends BuildCraftPropertyimplements IUnlistedProperty { +public class BuildCraftExtendedProperty> extends BuildCraftPropertyimplements IUnlistedProperty { private final Predicate function; public BuildCraftExtendedProperty(String name, Class clazz, Predicate allowingFunction) { @@ -33,7 +33,7 @@ public boolean apply(Double input) { /** This is useful if you want to use a particular class for this property, but don't care what the class contains * (it will never contain an incorrect value) */ @SuppressWarnings("unchecked") - public static BuildCraftExtendedProperty createExtended(String name, Class clazz) { + public static > BuildCraftExtendedProperty createExtended(String name, Class clazz) { return new BuildCraftExtendedProperty(name, clazz, (Predicate) Predicates.alwaysTrue()); } diff --git a/api/buildcraft/api/properties/BuildCraftProperties.java b/api/buildcraft/api/properties/BuildCraftProperties.java index cc664692ce..747dd470a8 100644 --- a/api/buildcraft/api/properties/BuildCraftProperties.java +++ b/api/buildcraft/api/properties/BuildCraftProperties.java @@ -7,14 +7,7 @@ import net.minecraft.util.EnumFacing; import buildcraft.api.core.EnumColor; -import buildcraft.api.enums.EnumBlueprintType; -import buildcraft.api.enums.EnumDecoratedBlock; -import buildcraft.api.enums.EnumEnergyStage; -import buildcraft.api.enums.EnumEngineType; -import buildcraft.api.enums.EnumFillerPattern; -import buildcraft.api.enums.EnumLaserTableType; -import buildcraft.api.enums.EnumMachineState; -import buildcraft.api.enums.EnumSpring; +import buildcraft.api.enums.*; public final class BuildCraftProperties { public static final BuildCraftProperty BLOCK_FACING = BuildCraftProperty.create("facing", EnumFacing.Plane.HORIZONTAL.facings()); @@ -29,7 +22,6 @@ public final class BuildCraftProperties { public static final BuildCraftProperty BLUEPRINT_TYPE = BuildCraftProperty.create("blueprint_type", EnumBlueprintType.class); public static final BuildCraftProperty DECORATED_BLOCK = BuildCraftProperty.create("decoration_type", EnumDecoratedBlock.class); - public static final BuildCraftProperty GENERIC_PIPE_DATA = BuildCraftProperty.create("pipe_data", 0, 15); public static final BuildCraftProperty LED_POWER = BuildCraftProperty.create("led_power", 0, 3); diff --git a/api/buildcraft/api/properties/BuildCraftProperty.java b/api/buildcraft/api/properties/BuildCraftProperty.java index 24e7b2c772..b866d377e0 100644 --- a/api/buildcraft/api/properties/BuildCraftProperty.java +++ b/api/buildcraft/api/properties/BuildCraftProperty.java @@ -12,7 +12,7 @@ /** This class exists primarily to allow for a property to be used as either a normal IProperty, or an * IUnlistedProperty. It also exists to give IProperty's generic types. */ -public class BuildCraftProperty implements IProperty { +public class BuildCraftProperty> implements IProperty { private final String name; private final Class clazz; protected final List values; @@ -88,7 +88,7 @@ public String getName() { } @Override - public Collection getAllowedValues() { + public List getAllowedValues() { return values; } @@ -114,9 +114,8 @@ protected String valueName(Object value) { } } - @SuppressWarnings("unchecked") public T getValue(IBlockState state) { - return (T) state.getValue(this); + return state.getValue(this); } @Override @@ -133,7 +132,7 @@ public String toString() { } // Helper methods for arguments - public IProperty asMetaProperty() { + public IProperty asMetaProperty() { return this; } } diff --git a/api/buildcraft/api/robots/AIRobot.java b/api/buildcraft/api/robots/AIRobot.java index e7a89314d9..8c401d960b 100755 --- a/api/buildcraft/api/robots/AIRobot.java +++ b/api/buildcraft/api/robots/AIRobot.java @@ -175,7 +175,7 @@ public final void loadFromNBT(NBTTagCompound nbt) { NBTTagCompound sub = nbt.getCompoundTag("delegateAI"); try { - Class aiRobotClass = null; + Class aiRobotClass; if (sub.hasKey("class")) { // Migration support for 6.4.x aiRobotClass = RobotManager.getAIRobotByLegacyClassName(sub.getString("class")); @@ -184,9 +184,9 @@ public final void loadFromNBT(NBTTagCompound nbt) { } if (aiRobotClass != null) { delegateAI = (AIRobot) aiRobotClass.getConstructor(EntityRobotBase.class).newInstance(robot); + delegateAI.parentAI = this; if (delegateAI.canLoadFromNBT()) { - delegateAI.parentAI = this; delegateAI.loadFromNBT(sub); } } @@ -200,7 +200,7 @@ public static AIRobot loadAI(NBTTagCompound nbt, EntityRobotBase robot) { AIRobot ai = null; try { - Class aiRobotClass = null; + Class aiRobotClass; if (nbt.hasKey("class")) { // Migration support for 6.4.x aiRobotClass = RobotManager.getAIRobotByLegacyClassName(nbt.getString("class")); diff --git a/api/buildcraft/api/robots/DockingStation.java b/api/buildcraft/api/robots/DockingStation.java index 0f1c90bb87..8417a86e54 100755 --- a/api/buildcraft/api/robots/DockingStation.java +++ b/api/buildcraft/api/robots/DockingStation.java @@ -9,9 +9,11 @@ import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; + import net.minecraftforge.fluids.IFluidHandler; import buildcraft.api.core.BCLog; +import buildcraft.api.core.EnumPipePart; import buildcraft.api.statements.StatementSlot; import buildcraft.api.transport.IInjectable; @@ -126,7 +128,7 @@ public void readFromNBT(NBTTagCompound nbt) { int x = indexNBT.getInteger("i"); int y = indexNBT.getInteger("j"); int z = indexNBT.getInteger("k"); - pos = new BlockPos(pos); + pos = new BlockPos(x, y, z); } else { int[] array = nbt.getIntArray("pos"); if (array.length == 3) { @@ -160,7 +162,7 @@ public String toString() { } public boolean linkIsDocked() { - if (isTaken()) { + if (robotTaking() != null) { return robotTaking().getDockingStation() == this; } else { return false; @@ -181,18 +183,34 @@ public IInjectable getItemOutput() { return null; } + public EnumPipePart getItemOutputSide() { + return EnumPipePart.CENTER; + } + public IInventory getItemInput() { return null; } + public EnumPipePart getItemInputSide() { + return EnumPipePart.CENTER; + } + public IFluidHandler getFluidOutput() { return null; } + public EnumPipePart getFluidOutputSide() { + return EnumPipePart.CENTER; + } + public IFluidHandler getFluidInput() { return null; } + public EnumPipePart getFluidInputSide() { + return EnumPipePart.CENTER; + } + public boolean providesPower() { return false; } @@ -201,4 +219,7 @@ public IRequestProvider getRequestProvider() { return null; } + public void onChunkUnload() { + + } } diff --git a/api/buildcraft/api/robots/EntityRobotBase.java b/api/buildcraft/api/robots/EntityRobotBase.java index fd3d854b50..949962121b 100755 --- a/api/buildcraft/api/robots/EntityRobotBase.java +++ b/api/buildcraft/api/robots/EntityRobotBase.java @@ -14,7 +14,6 @@ import net.minecraftforge.fluids.IFluidHandler; import cofh.api.energy.IEnergyStorage; - import buildcraft.api.boards.RedstoneBoardRobot; import buildcraft.api.core.IZone; diff --git a/api/buildcraft/api/robots/IRequestProvider.java b/api/buildcraft/api/robots/IRequestProvider.java index 5a5e7ac594..ad3fd0c25b 100755 --- a/api/buildcraft/api/robots/IRequestProvider.java +++ b/api/buildcraft/api/robots/IRequestProvider.java @@ -6,18 +6,37 @@ import net.minecraft.item.ItemStack; +/** + * Provide requests of items that need to be fulfilled. + * + * Requests are organized as an linear array, where null entries mark slots + * without a requests. A request in a slot, or the amount of slots, is allowed + * to change before a call to {@link #offerItem(int, ItemStack)}, but it is not + * recommended that this is frequent, since the request delivery won't fail + * until it is offered the previous request. + */ public interface IRequestProvider { - /** Return the total number of request slots available from this provider. */ - int getNumberOfRequests(); - - /** Return the stack requested in slot i, provided that this request is not in process of being provided by a - * robot. */ - StackRequest getAvailableRequest(int i); + /** + * Return the total number of request slots available from this provider. + * + * @return + */ + int getRequestsCount(); - /** Allocate the request at slot i to the robot given in parameter, and return true if the allocation is - * successful. */ - boolean takeRequest(int i, EntityRobotBase robot); + /** + * Return a stack with the request in the slot. + * + * @param slot + * @return the request in the slot, or null if there's no request. + */ + ItemStack getRequest(int slot); - /** Provide a stack to fulfill request at index i. Return the stack minus items that have been taken. */ - ItemStack provideItemsForRequest(int i, ItemStack stack); + /** + * Fulfill the request in slot with the stack given and return any excess. + * + * @param slot + * @param stack + * @return any excess that was not used to fulfill the request. + */ + ItemStack offerItem(int slot, ItemStack stack); } diff --git a/api/buildcraft/api/robots/ResourceId.java b/api/buildcraft/api/robots/ResourceId.java index 92ac8b5dbf..539503a0f5 100755 --- a/api/buildcraft/api/robots/ResourceId.java +++ b/api/buildcraft/api/robots/ResourceId.java @@ -5,67 +5,20 @@ package buildcraft.api.robots; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumFacing; - -import buildcraft.api.core.BCLog; public abstract class ResourceId { - public BlockPos pos = BlockPos.ORIGIN; - public EnumFacing side = null; - public int localId = 0; protected ResourceId() {} - @Override - public boolean equals(Object obj) { - if (obj.getClass() != getClass()) { - return false; - } - - ResourceId compareId = (ResourceId) obj; - - return pos.equals(compareId.pos) && side == compareId.side && localId == compareId.localId; - } - - @Override - public int hashCode() { - return (((pos != null ? pos.hashCode() : 0) * 37) + (side != null ? side.ordinal() : 6) * 37) + localId; - } - public void writeToNBT(NBTTagCompound nbt) { - nbt.setIntArray("pos", new int[] { pos.getX(), pos.getY(), pos.getZ() }); - nbt.setByte("side", (byte) (side == null ? 6 : side.ordinal())); - nbt.setInteger("localId", localId); nbt.setString("resourceName", RobotManager.getResourceIdName(getClass())); } - protected void readFromNBT(NBTTagCompound nbt) { - if (nbt.hasKey("index")) { - // For compatibility with older versions of minecraft and buildcraft - NBTTagCompound indexNBT = nbt.getCompoundTag("index"); - int x = indexNBT.getInteger("i"); - int y = indexNBT.getInteger("j"); - int z = indexNBT.getInteger("k"); - pos = new BlockPos(x, y, z); - } else { - int[] array = nbt.getIntArray("pos"); - if (array.length == 3) { - pos = new BlockPos(array[0], array[1], array[2]); - } else if (array.length != 0) { - BCLog.logger.warn("Found an integer array that wwas not the right length! (" + array + ")"); - } else { - BCLog.logger.warn("Did not find any integer positions! This is a bug!"); - } - } - byte sid = nbt.getByte("side"); - side = sid == 6 ? null : EnumFacing.values()[sid]; - localId = nbt.getInteger("localId"); - } + protected void readFromNBT(NBTTagCompound nbt) {} public static ResourceId load(NBTTagCompound nbt) { try { - Class cls = null; + Class cls; if (nbt.hasKey("class")) { // Migration support for 6.4.x cls = RobotManager.getResourceIdByLegacyClassName(nbt.getString("class")); @@ -83,12 +36,4 @@ public static ResourceId load(NBTTagCompound nbt) { return null; } - - public void taken(long robotId) { - - } - - public void released(long robotId) { - - } } diff --git a/api/buildcraft/api/robots/ResourceIdBlock.java b/api/buildcraft/api/robots/ResourceIdBlock.java index f83a4ba85f..29159a9129 100755 --- a/api/buildcraft/api/robots/ResourceIdBlock.java +++ b/api/buildcraft/api/robots/ResourceIdBlock.java @@ -4,11 +4,19 @@ * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ package buildcraft.api.robots; +import org.apache.commons.lang3.builder.HashCodeBuilder; + +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockPos; +import buildcraft.api.core.EnumPipePart; + public class ResourceIdBlock extends ResourceId { + public BlockPos pos = new BlockPos(0, 0, 0); + public EnumPipePart side = EnumPipePart.CENTER; + public ResourceIdBlock() { } @@ -25,4 +33,38 @@ public ResourceIdBlock(TileEntity tile) { pos = tile.getPos(); } + @Override + public boolean equals(Object obj) { + if (obj == null || obj.getClass() != getClass()) { + return false; + } + + ResourceIdBlock compareId = (ResourceIdBlock) obj; + + return pos.equals(compareId.pos) && side == compareId.side; + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(pos.hashCode()).append(side != null ? side.ordinal() : 0).build(); + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + + int[] arr = new int[] { pos.getX(), pos.getY(), pos.getZ() }; + nbt.setIntArray("pos", arr); + + nbt.setTag("side", side.writeToNBT()); + } + + @Override + protected void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + int[] arr = nbt.getIntArray("pos"); + pos = new BlockPos(arr[0], arr[1], arr[2]); + + side = EnumPipePart.readFromNBT(nbt.getTag("side")); + } } diff --git a/api/buildcraft/api/robots/ResourceIdRequest.java b/api/buildcraft/api/robots/ResourceIdRequest.java index 672c49bc53..ab37ad2c6a 100755 --- a/api/buildcraft/api/robots/ResourceIdRequest.java +++ b/api/buildcraft/api/robots/ResourceIdRequest.java @@ -4,17 +4,50 @@ * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ package buildcraft.api.robots; -import net.minecraft.tileentity.TileEntity; +import org.apache.commons.lang3.builder.HashCodeBuilder; -public class ResourceIdRequest extends ResourceId { +import net.minecraft.nbt.NBTTagCompound; + +import buildcraft.api.core.EnumPipePart; + +public class ResourceIdRequest extends ResourceIdBlock { + + private int slot; public ResourceIdRequest() { } - public ResourceIdRequest(TileEntity tile, int i) { - pos = tile.getPos(); - localId = i; + public ResourceIdRequest(DockingStation station, int slot) { + pos = station.index(); + side = EnumPipePart.fromFacing(station.side()); + this.slot = slot; } + @Override + public boolean equals(Object obj) { + if (!super.equals(obj)) return false; + ResourceIdRequest compareId = (ResourceIdRequest) obj; + + return slot == compareId.slot; + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(super.hashCode()).append(slot).build(); + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + + nbt.setInteger("localId", slot); + } + + @Override + protected void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + + slot = nbt.getInteger("localId"); + } } diff --git a/api/buildcraft/api/robots/RobotManager.java b/api/buildcraft/api/robots/RobotManager.java index 278cd8e1c0..39a4672c80 100644 --- a/api/buildcraft/api/robots/RobotManager.java +++ b/api/buildcraft/api/robots/RobotManager.java @@ -47,6 +47,14 @@ public static void registerAIRobot(Class aiRobot, String name if (aiRobotsByNames.containsKey(name)) { BCLog.logger.info("Overriding " + aiRobotsByNames.get(name).getName() + " with " + aiRobot.getName()); } + + // Check if NBT-load constructor is present + try { + aiRobot.getConstructor(EntityRobotBase.class); + } catch (NoSuchMethodException e) { + throw new RuntimeException("AI class " + aiRobot.getName() + " lacks NBT load construtor! This is a bug!"); + } + aiRobots.add(aiRobot); aiRobotsByNames.put(name, aiRobot); aiRobotsNames.put(aiRobot, name); diff --git a/api/buildcraft/api/robots/package-info.java b/api/buildcraft/api/robots/package-info.java index f8e660c474..57de74eb01 100644 --- a/api/buildcraft/api/robots/package-info.java +++ b/api/buildcraft/api/robots/package-info.java @@ -1,8 +1,10 @@ /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "2.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|robotics") + * The BuildCraft API is distributed under the terms of the MIT License. + * Please check the contents of the license, which should be located + * as "LICENSE.API" in the BuildCraft source code distribution. + */ +@API(apiVersion = "3.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|robotics") package buildcraft.api.robots; import net.minecraftforge.fml.common.API; diff --git a/api/buildcraft/api/statements/IStatementParameter.java b/api/buildcraft/api/statements/IStatementParameter.java index 6e94bce14d..7ef29c793d 100755 --- a/api/buildcraft/api/statements/IStatementParameter.java +++ b/api/buildcraft/api/statements/IStatementParameter.java @@ -22,9 +22,6 @@ public interface IStatementParameter { ItemStack getItemStack(); - // @SideOnly(Side.CLIENT) - // void registerIcons(TextureAtlasSpriteRegister iconRegister); - /** Return the parameter description in the UI */ String getDescription(); diff --git a/api/buildcraft/api/statements/StatementManager.java b/api/buildcraft/api/statements/StatementManager.java index d2c218c5e9..098462c139 100644 --- a/api/buildcraft/api/statements/StatementManager.java +++ b/api/buildcraft/api/statements/StatementManager.java @@ -13,6 +13,8 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; +import buildcraft.api.core.BCLog; + public final class StatementManager { public static Map statements = new HashMap(); @@ -149,6 +151,9 @@ private static IStatementParameter createParameter(Class facingMap = Maps.newEnumMap(EnumFacing.class); - - public final EnumFacing face; - - static { - for (EnumPipePart part : values()) - if (part.face != null) { - facingMap.put(part.face, part); - } - } - - public static EnumPipePart fromFacing(EnumFacing face) { - if (face == null) return EnumPipePart.CENTER; - return facingMap.get(face); - } - - public static EnumPipePart[] validFaces() { - return new EnumPipePart[] { DOWN, UP, NORTH, SOUTH, WEST, EAST }; - } - - private EnumPipePart(EnumFacing face) { - this.face = face; - } - - public int getIndex() { - if (face == null) return 6; - return face.getIndex(); - } - - @Override - public String getName() { - return name().toLowerCase(Locale.ROOT); - } - - public EnumPipePart next() { - switch (this) { - case DOWN: - return EAST; - case EAST: - return NORTH; - case NORTH: - return SOUTH; - case SOUTH: - return UP; - case UP: - return WEST; - case WEST: - return DOWN; - default: - return DOWN; - } - } - - public EnumPipePart opposite() { - if (this == CENTER) return null; - return fromFacing(face.getOpposite()); - } -} diff --git a/api/buildcraft/api/transport/pipe_bc8/IPipeContents.java b/api/buildcraft/api/transport/pipe_bc8/IPipeContents.java index fc67da2040..aed0ea1fca 100644 --- a/api/buildcraft/api/transport/pipe_bc8/IPipeContents.java +++ b/api/buildcraft/api/transport/pipe_bc8/IPipeContents.java @@ -7,6 +7,8 @@ import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; +import buildcraft.api.core.EnumPipePart; + public interface IPipeContents { public interface IPipeContentsBulk extends IPipeContents { /** Get the part of the pipe the contents is held within */ diff --git a/api/buildcraft/api/transport/pipe_bc8/IPipeContentsEditable.java b/api/buildcraft/api/transport/pipe_bc8/IPipeContentsEditable.java index 99434df9ae..4860422f9d 100644 --- a/api/buildcraft/api/transport/pipe_bc8/IPipeContentsEditable.java +++ b/api/buildcraft/api/transport/pipe_bc8/IPipeContentsEditable.java @@ -7,6 +7,7 @@ import net.minecraftforge.fluids.Fluid; +import buildcraft.api.core.EnumPipePart; import buildcraft.api.core.INBTLoadable_BC8; import buildcraft.api.core.INetworkLoadable_BC8; import buildcraft.api.transport.pipe_bc8.IPipePropertyProvider.IPipePropertyProviderEditable; diff --git a/buildcraft_resources/assets/buildcraft/lang/en_US.lang b/buildcraft_resources/assets/buildcraft/lang/en_US.lang index e0429e5240..ebc9dba9f9 100644 --- a/buildcraft_resources/assets/buildcraft/lang/en_US.lang +++ b/buildcraft_resources/assets/buildcraft/lang/en_US.lang @@ -19,6 +19,7 @@ buildcraft.boardRobotCrafter=Crafter buildcraft.boardRobotDelivery=Delivery buildcraft.boardRobotPump=Pump buildcraft.boardRobotStripes=Stripes +buildcraft.boardRobotBreaker=Breaker buildcraft.boardRobotPicker.desc=Picks up items buildcraft.boardRobotLumberjack.desc=Breaks logs @@ -38,6 +39,7 @@ buildcraft.boardRobotCrafter.desc=Crafts items buildcraft.boardRobotDelivery.desc=Delivers items upon request buildcraft.boardRobotPump.desc=Pumps out liquids buildcraft.boardRobotStripes.desc=Uhh... Stripes! +buildcraft.boardRobotStripes.desc=Mines stone chat.gateCopier.clear=Gate information cleared. chat.gateCopier.gateCopied=Copied gate information to copier. @@ -103,10 +105,8 @@ config.general.boards.blacklist=Robot blacklist config.general.pumpsConsumeWater=Pumps consume water config.general.updateCheck=Check for updates config.general.fuel.fuel.combustion=Combustion engine fuel multiplier -config.general.fuel.lava.combustion=Combustion engine lava multiplier config.general.fuel.oil.combustion=Combustion engine oil multiplier config.general.fuel.fuel.combustion.energyOutput=Combustion engine fuel output -config.general.fuel.lava.combustion.energyOutput=Combustion engine lava output config.general.fuel.oil.combustion.energyOutput=Combustion engine oil output config.general.itemLifespan=Item lifespan (seconds) config.general.canEnginesExplode=Engines explode @@ -118,6 +118,7 @@ config.general.pipes.facadeBlacklistAsWhitelist=Invert facade blacklist config.general.pipes.facadeNoLaserRecipe=Add facade recipe without laser config.general.pipes.hardness=Hardness config.general.pipes.slimeballWaterproofRecipe=Add slimeball sealant recipe +config.general.pumpsNeedRealPower=Pumps need real power config.general.quarry=Quarry Options config.general.quarry.oneTimeUse=One-time use config.general.quarry.doChunkLoading=Automatic chunk loading @@ -142,7 +143,6 @@ config.worldgen.biomes.excessiveOilIDs=Biomes with excessive oil config.worldgen.biomes.excludeOilIDs=Biomes without oil config.worldgen.biomes.increasedOilIDs=Biomes with increased oil - direction.north=North direction.west=West direction.east=East @@ -150,6 +150,16 @@ direction.south=South direction.up=Top direction.down=Bottom +direction.center.0=North-West +direction.center.1=North +direction.center.2=North-East +direction.center.3=West +direction.center.4=Center +direction.center.5=East +direction.center.6=South-West +direction.center.7=South +direction.center.8=South-East + fillerpattern.clear=Clear fillerpattern.fill=Fill fillerpattern.flatten=Flatten @@ -160,6 +170,8 @@ fillerpattern.box=Box fillerpattern.cylinder=Cylinder fillerpattern.frame=Frame fillerpattern.none=None +fillerpattern.parameter.hollow=Hollow +fillerpattern.parameter.filled=Filled fluid.oil=Oil fluid.fuel=Fuel @@ -183,7 +195,7 @@ gate.action.station.accept_items=Accept Items gate.action.station.request_items=Request Items gate.action.station.drop_items_in_pipe=Drop Items In Pipe gate.action.station.allow_craft=Allow Craft -gate.action.station.provide_machine_request=Provide Computed Items +gate.action.station.provide_machine_request=Request Needed Items gate.action.station.accept_fluids=Accept Fluids gate.action.station.povide_fluids=Provide Fluids gate.action.robot.work_in_area=Work in Area @@ -259,6 +271,10 @@ gate.trigger.time.0=Night gate.trigger.time.6=Morning gate.trigger.time.12=Afternoon gate.trigger.time.18=Evening +gate.trigger.fuelLevelBelow=Fuel level below %d%% +gate.trigger.coolantLevelBelow=Coolant level below %d%% + +gui.fluidtank.empty=Empty gui.building.resources=Building Resources gui.building.fluids=Fluid Tanks @@ -355,6 +371,7 @@ item.PipeFluidsQuartz.name=Quartz Fluid Pipe item.PipeFluidsGold.name=Golden Fluid Pipe item.PipeFluidsEmerald.name=Emerald Fluid Pipe item.PipeFluidsDiamond.name=Diamond Fluid Pipe +item.PipeFluidsClay.name=Clay Fluid Pipe item.PipePowerWood.name=Wooden Kinesis Pipe item.PipePowerCobblestone.name=Cobblestone Kinesis Pipe item.PipePowerStone.name=Stone Kinesis Pipe @@ -382,6 +399,7 @@ item.FacadePhased.state_transparent=Transparent item.PipePlug.name=Pipe Plug item.Lens.name=Lens item.Filter.name=Filter +item.PipePowerAdapter.name=Power Adapter item.debugger.name=Debugger item.debugger.warning=Use only for testing! Leaks secrets. item.package.name=Package @@ -449,12 +467,14 @@ tip.gate.wires.diamond=Red, Blue, Green, Yellow tip.gate.wires.emerald=Red, Blue, Green, Yellow tip.gate.expansions=§9§oInstalled Expansions: -tip.PipeFluidsCobblestone=Won't connect to Stone +tip.PipeFluidsClay=Insertion pipe +tip.PipeFluidsCobblestone=Won't connect to Stone or Quartz tip.PipeFluidsDiamond=Sorts fluids tip.PipeFluidsEmerald=Extraction pipe tip.PipeFluidsIron=Valve pipe +tip.PipeFluidsQuartz=Won't connect to Cobblestone or Stone tip.PipeFluidsSandstone=Only connects to other pipes -tip.PipeFluidsStone=Won't connect to Cobblestone +tip.PipeFluidsStone=Won't connect to Cobblestone or Quartz tip.PipeFluidsVoid=Destroys fluids tip.PipeFluidsWood=Extraction pipe tip.PipeItemsClay=Insertion pipe @@ -477,6 +497,16 @@ tip.PipePowerIron=Selectable Limiter Pipe tip.PipePowerSandstone=Only connects to other pipes tip.PipePowerWood=Power Input Pipe tip.PipeStructureCobblestone=Support pipe +tip.deprecated=Deprecated + +tip.gate.charged=Charged +tip.gate.fullcharge=Full Charge +tip.gate.nocharge=No Charge + +tip.filler.excavate.on=Excavate +tip.filler.excavate.off=Do Not Excavate + +tip.list.matches=Matches tip.shift.PipeFluidsDiamond=GUI accepts any fluid containers tip.shift.PipeFluidsEmerald=GUI accepts any fluid container @@ -487,6 +517,10 @@ tip.shift.PipeItemsLapis=Sneak-click to change color tip.shift.PipeItemsObsidian=Power with an engine\nMore power - greater distance tip.shift.PipePowerIron=Change the limit with a wrench or gates +tip.PipeItemsEmerald.whitelist=Whitelist +tip.PipeItemsEmerald.blacklist=Blacklist +tip.PipeItemsEmerald.roundrobin=Round Robin (In Order) + tip.tool.add=Add tip.tool.fullscreen=Fullscreen tip.tool.remove=Remove @@ -538,6 +572,10 @@ bc_update.new_version=§cNew version of BuildCraft available: %s for Minecraft % bc_update.download=§cDownload from http://www.mod-buildcraft.com/download bc_update.once=This message only displays once bc_update.again=Type '/buildcraft version' if you want to see it again +bc_update.changelog=Type '/buildcraft changelog' to see the changelog + +chat.buildcraft.quarry.tooSmall=[BuildCraft] Quarry size is outside of chunkloading bounds or too small %d %d (%d) +chat.buildcraft.quarry.chunkloadInfo=[BuildCraft] The quarry at %d %d %d will keep %d chunks loaded command.buildcraft.version=BuildCraft %s for Minecraft %s (Latest: %s). command.buildcraft.changelog_header=Changelog for BuildCraft %s: @@ -564,3 +602,10 @@ buildcraft.guide.chapter.block=Blocks buildcraft.guide.chapter.item=Items buildcraft.guide.chapter.gears=Gears +command.buildcraft.buildcraft.op.desc=- %s : Op FakePlayer +command.buildcraft.buildcraft.op.help=Gives OP rights to the BC FakePlayer (acts in the name of quarries, robots, etc.) +command.buildcraft.buildcraft.op.format=Format: /%s + +command.buildcraft.buildcraft.deop.desc=- %s : Deop FakePlayer +command.buildcraft.buildcraft.deop.help=Gives OP rights to the BC FakePlayer (acts in the name of quarries, robots, etc.) +command.buildcraft.buildcraft.deop.format=Format: /%s diff --git a/buildcraft_resources/assets/buildcraft/logo.png b/buildcraft_resources/assets/buildcraft/logo.png index 205d674d6a..241f0f90fb 100755 Binary files a/buildcraft_resources/assets/buildcraft/logo.png and b/buildcraft_resources/assets/buildcraft/logo.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/architect/back.png b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/architect/back.png index c8032e0673..c286467c2b 100755 Binary files a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/architect/back.png and b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/architect/back.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/architect/front.png b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/architect/front.png index 57f657795d..2c2dc63ad8 100755 Binary files a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/architect/front.png and b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/architect/front.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/architect/led_red.png b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/architect/led_red.png index 258b7b460f..e0e852a684 100755 Binary files a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/architect/led_red.png and b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/architect/led_red.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/architect/left.png b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/architect/left.png index 68fc7e3a4c..2a4fa3c3a1 100755 Binary files a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/architect/left.png and b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/architect/left.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/architect/right.png b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/architect/right.png index 3e8cde2e97..b95c0d265a 100755 Binary files a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/architect/right.png and b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/architect/right.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/builder/back.png b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/builder/back.png index 66dae9fea3..3615777cfd 100755 Binary files a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/builder/back.png and b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/builder/back.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/builder/bottom.png b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/builder/bottom.png index 0bbd84f8fc..84f7cbe6b1 100755 Binary files a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/builder/bottom.png and b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/builder/bottom.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/builder/side.png b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/builder/side.png index a7fed32f46..e6270c15a5 100755 Binary files a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/builder/side.png and b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/builder/side.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/constructionMarkerBlock/default.png b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/constructionMarkerBlock/default.png new file mode 100755 index 0000000000..35f52f17cb Binary files /dev/null and b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/constructionMarkerBlock/default.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/filler/bottom.png b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/filler/bottom.png index e666e98bfe..abc1f2808b 100755 Binary files a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/filler/bottom.png and b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/filler/bottom.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/filler/item_hatch.png b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/filler/item_hatch.png index ea2ceea459..98c63a382e 100755 Binary files a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/filler/item_hatch.png and b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/filler/item_hatch.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/filler/top.png b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/filler/top.png index 493fef38d6..700b8c564a 100755 Binary files a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/filler/top.png and b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/filler/top.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/fillerBlock/front.png b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/fillerBlock/front.png new file mode 100755 index 0000000000..4918a72242 Binary files /dev/null and b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/fillerBlock/front.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/fillerBlock/led_green.png b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/fillerBlock/led_green.png new file mode 100755 index 0000000000..dd0ac90dc6 Binary files /dev/null and b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/fillerBlock/led_green.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/fillerBlock/led_red.png b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/fillerBlock/led_red.png new file mode 100755 index 0000000000..78060e1dff Binary files /dev/null and b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/fillerBlock/led_red.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/fillerBlock/side.png b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/fillerBlock/side.png new file mode 100755 index 0000000000..0c5aaa8164 Binary files /dev/null and b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/fillerBlock/side.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/fillerBlockIcons/box.png b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/fillerBlockIcons/box.png new file mode 100755 index 0000000000..1bc922813b Binary files /dev/null and b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/fillerBlockIcons/box.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/fillerBlockIcons/clear.png b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/fillerBlockIcons/clear.png new file mode 100755 index 0000000000..aaf0f32c96 Binary files /dev/null and b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/fillerBlockIcons/clear.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/fillerBlockIcons/cylinder.png b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/fillerBlockIcons/cylinder.png new file mode 100755 index 0000000000..a457cae5ab Binary files /dev/null and b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/fillerBlockIcons/cylinder.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/fillerBlockIcons/fill.png b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/fillerBlockIcons/fill.png new file mode 100755 index 0000000000..b518954ea6 Binary files /dev/null and b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/fillerBlockIcons/fill.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/fillerBlockIcons/flatten.png b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/fillerBlockIcons/flatten.png new file mode 100755 index 0000000000..8d36211c3c Binary files /dev/null and b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/fillerBlockIcons/flatten.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/fillerBlockIcons/frame.png b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/fillerBlockIcons/frame.png new file mode 100755 index 0000000000..98b0e8bf69 Binary files /dev/null and b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/fillerBlockIcons/frame.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/fillerBlockIcons/horizon.png b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/fillerBlockIcons/horizon.png new file mode 100755 index 0000000000..7b5d1b5148 Binary files /dev/null and b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/fillerBlockIcons/horizon.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/fillerBlockIcons/pyramid.png b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/fillerBlockIcons/pyramid.png new file mode 100755 index 0000000000..a73a353a33 Binary files /dev/null and b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/fillerBlockIcons/pyramid.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/fillerBlockIcons/stairs.png b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/fillerBlockIcons/stairs.png new file mode 100755 index 0000000000..a3fff23038 Binary files /dev/null and b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/fillerBlockIcons/stairs.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/frameBlock/default.png b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/frameBlock/default.png index 163282f923..38dcafc7e3 100755 Binary files a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/frameBlock/default.png and b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/frameBlock/default.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/library/back.png b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/library/back.png index a1edd35bb3..4521987385 100755 Binary files a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/library/back.png and b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/library/back.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/library/bottom.png b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/library/bottom.png index bfb73915e1..4bc22d6a64 100755 Binary files a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/library/bottom.png and b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/library/bottom.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/library/front.png b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/library/front.png index 6753a5af7b..b2b2dc1e6a 100755 Binary files a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/library/front.png and b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/library/front.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/library/left.png b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/library/left.png index e7b7908bbc..b6b936f629 100755 Binary files a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/library/left.png and b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/library/left.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/library/right.png b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/library/right.png index 88dbf9804f..6b11136944 100755 Binary files a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/library/right.png and b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/library/right.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/marker/construction.png b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/marker/construction.png index 690ae3a931..49edc96cff 100755 Binary files a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/marker/construction.png and b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/marker/construction.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/quarry/back.png b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/quarry/back.png index 4197922f8f..7ce74c824c 100755 Binary files a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/quarry/back.png and b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/quarry/back.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/quarry/bottom.png b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/quarry/bottom.png index 47202a415c..d54964442e 100755 Binary files a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/quarry/bottom.png and b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/quarry/bottom.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/quarry/display.png b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/quarry/display.png index b7cc00964b..013bb5b9ac 100755 Binary files a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/quarry/display.png and b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/quarry/display.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/quarry/drill_head.png b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/quarry/drill_head.png index bffdde2d12..260d26a277 100755 Binary files a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/quarry/drill_head.png and b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/quarry/drill_head.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/quarry/item_hatch.png b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/quarry/item_hatch.png index 98f581e050..c2e06ef345 100755 Binary files a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/quarry/item_hatch.png and b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/quarry/item_hatch.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/quarry/led_green.png b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/quarry/led_green.png index 0f082d47e7..b29498b332 100755 Binary files a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/quarry/led_green.png and b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/quarry/led_green.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/quarry/led_red.png b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/quarry/led_red.png index cc23682d8e..d6707a91ea 100755 Binary files a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/quarry/led_red.png and b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/quarry/led_red.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/quarry/top.png b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/quarry/top.png index ed5b9f1427..700b8c564a 100755 Binary files a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/quarry/top.png and b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/quarry/top.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/gui/architect_gui_large.png b/buildcraft_resources/assets/buildcraftbuilders/textures/gui/architect_gui_large.png new file mode 100644 index 0000000000..c8a35c7def Binary files /dev/null and b/buildcraft_resources/assets/buildcraftbuilders/textures/gui/architect_gui_large.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/gui/builder_blueprint.png b/buildcraft_resources/assets/buildcraftbuilders/textures/gui/builder_blueprint.png index 22be096b54..183abc4024 100755 Binary files a/buildcraft_resources/assets/buildcraftbuilders/textures/gui/builder_blueprint.png and b/buildcraft_resources/assets/buildcraftbuilders/textures/gui/builder_blueprint.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/gui/filler.png b/buildcraft_resources/assets/buildcraftbuilders/textures/gui/filler.png index 909f2028b9..5f3763a23c 100755 Binary files a/buildcraft_resources/assets/buildcraftbuilders/textures/gui/filler.png and b/buildcraft_resources/assets/buildcraftbuilders/textures/gui/filler.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/gui/library_rw.png b/buildcraft_resources/assets/buildcraftbuilders/textures/gui/library_rw.png index 91e04216c4..afaf628b74 100755 Binary files a/buildcraft_resources/assets/buildcraftbuilders/textures/gui/library_rw.png and b/buildcraft_resources/assets/buildcraftbuilders/textures/gui/library_rw.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/gui/urbanist_tool_filler.png b/buildcraft_resources/assets/buildcraftbuilders/textures/gui/urbanist_tool_filler.png deleted file mode 100755 index 83ff0acddf..0000000000 Binary files a/buildcraft_resources/assets/buildcraftbuilders/textures/gui/urbanist_tool_filler.png and /dev/null differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/gui/urbanist_tool_place_block.png b/buildcraft_resources/assets/buildcraftbuilders/textures/gui/urbanist_tool_place_block.png deleted file mode 100755 index 0d34f58bf2..0000000000 Binary files a/buildcraft_resources/assets/buildcraftbuilders/textures/gui/urbanist_tool_place_block.png and /dev/null differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/gui/urbanist_tools.png b/buildcraft_resources/assets/buildcraftbuilders/textures/gui/urbanist_tools.png deleted file mode 100755 index f0d77d906e..0000000000 Binary files a/buildcraft_resources/assets/buildcraftbuilders/textures/gui/urbanist_tools.png and /dev/null differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/items/blueprint/clean.png b/buildcraft_resources/assets/buildcraftbuilders/textures/items/blueprint/clean.png index 4320c27b93..3fe44d8ed5 100755 Binary files a/buildcraft_resources/assets/buildcraftbuilders/textures/items/blueprint/clean.png and b/buildcraft_resources/assets/buildcraftbuilders/textures/items/blueprint/clean.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/items/blueprint/used.png b/buildcraft_resources/assets/buildcraftbuilders/textures/items/blueprint/used.png index 6d95e281f4..7be3637297 100755 Binary files a/buildcraft_resources/assets/buildcraftbuilders/textures/items/blueprint/used.png and b/buildcraft_resources/assets/buildcraftbuilders/textures/items/blueprint/used.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/items/constructionMarkerBlock/default.png b/buildcraft_resources/assets/buildcraftbuilders/textures/items/constructionMarkerBlock/default.png index f5849e007e..01e87f933f 100755 Binary files a/buildcraft_resources/assets/buildcraftbuilders/textures/items/constructionMarkerBlock/default.png and b/buildcraft_resources/assets/buildcraftbuilders/textures/items/constructionMarkerBlock/default.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/items/constructionMarkerBlock/recording.png b/buildcraft_resources/assets/buildcraftbuilders/textures/items/constructionMarkerBlock/recording.png index d261f00e61..dd7dd5deb9 100755 Binary files a/buildcraft_resources/assets/buildcraftbuilders/textures/items/constructionMarkerBlock/recording.png and b/buildcraft_resources/assets/buildcraftbuilders/textures/items/constructionMarkerBlock/recording.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/items/icons/urbanist_area.png b/buildcraft_resources/assets/buildcraftbuilders/textures/items/icons/urbanist_area.png index c823891647..e563d6706a 100755 Binary files a/buildcraft_resources/assets/buildcraftbuilders/textures/items/icons/urbanist_area.png and b/buildcraft_resources/assets/buildcraftbuilders/textures/items/icons/urbanist_area.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/items/icons/urbanist_block.png b/buildcraft_resources/assets/buildcraftbuilders/textures/items/icons/urbanist_block.png index 1aea188daf..a52521803d 100755 Binary files a/buildcraft_resources/assets/buildcraftbuilders/textures/items/icons/urbanist_block.png and b/buildcraft_resources/assets/buildcraftbuilders/textures/items/icons/urbanist_block.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/items/icons/urbanist_blueprint.png b/buildcraft_resources/assets/buildcraftbuilders/textures/items/icons/urbanist_blueprint.png index daf4f7529c..cc53db785d 100755 Binary files a/buildcraft_resources/assets/buildcraftbuilders/textures/items/icons/urbanist_blueprint.png and b/buildcraft_resources/assets/buildcraftbuilders/textures/items/icons/urbanist_blueprint.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/items/icons/urbanist_erase.png b/buildcraft_resources/assets/buildcraftbuilders/textures/items/icons/urbanist_erase.png index ad930f408f..043ec8e3e4 100755 Binary files a/buildcraft_resources/assets/buildcraftbuilders/textures/items/icons/urbanist_erase.png and b/buildcraft_resources/assets/buildcraftbuilders/textures/items/icons/urbanist_erase.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/items/icons/urbanist_filler.png b/buildcraft_resources/assets/buildcraftbuilders/textures/items/icons/urbanist_filler.png index f9e1c98035..fa709ce59d 100755 Binary files a/buildcraft_resources/assets/buildcraftbuilders/textures/items/icons/urbanist_filler.png and b/buildcraft_resources/assets/buildcraftbuilders/textures/items/icons/urbanist_filler.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/items/icons/urbanist_path.png b/buildcraft_resources/assets/buildcraftbuilders/textures/items/icons/urbanist_path.png index 027db6b37c..a06808e8c9 100755 Binary files a/buildcraft_resources/assets/buildcraftbuilders/textures/items/icons/urbanist_path.png and b/buildcraft_resources/assets/buildcraftbuilders/textures/items/icons/urbanist_path.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/items/template/clean.png b/buildcraft_resources/assets/buildcraftbuilders/textures/items/template/clean.png index 22ff474c02..10653b1cad 100755 Binary files a/buildcraft_resources/assets/buildcraftbuilders/textures/items/template/clean.png and b/buildcraft_resources/assets/buildcraftbuilders/textures/items/template/clean.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/items/template/used.png b/buildcraft_resources/assets/buildcraftbuilders/textures/items/template/used.png index b6da4c08a0..20031ea369 100755 Binary files a/buildcraft_resources/assets/buildcraftbuilders/textures/items/template/used.png and b/buildcraft_resources/assets/buildcraftbuilders/textures/items/template/used.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/blocks/engine/trunk_blue.png b/buildcraft_resources/assets/buildcraftcore/textures/blocks/engine/trunk_blue.png new file mode 100755 index 0000000000..70232aaa3a Binary files /dev/null and b/buildcraft_resources/assets/buildcraftcore/textures/blocks/engine/trunk_blue.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/blocks/engine/trunk_green.png b/buildcraft_resources/assets/buildcraftcore/textures/blocks/engine/trunk_green.png new file mode 100755 index 0000000000..83e0a596ab Binary files /dev/null and b/buildcraft_resources/assets/buildcraftcore/textures/blocks/engine/trunk_green.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/blocks/engine/trunk_overheat.png b/buildcraft_resources/assets/buildcraftcore/textures/blocks/engine/trunk_overheat.png new file mode 100755 index 0000000000..e395a5f064 Binary files /dev/null and b/buildcraft_resources/assets/buildcraftcore/textures/blocks/engine/trunk_overheat.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/blocks/engine/trunk_red.png b/buildcraft_resources/assets/buildcraftcore/textures/blocks/engine/trunk_red.png new file mode 100755 index 0000000000..c87a4b1973 Binary files /dev/null and b/buildcraft_resources/assets/buildcraftcore/textures/blocks/engine/trunk_red.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/blocks/engine/trunk_yellow.png b/buildcraft_resources/assets/buildcraftcore/textures/blocks/engine/trunk_yellow.png new file mode 100755 index 0000000000..8e01da7d96 Binary files /dev/null and b/buildcraft_resources/assets/buildcraftcore/textures/blocks/engine/trunk_yellow.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/blocks/engineWood/base.png b/buildcraft_resources/assets/buildcraftcore/textures/blocks/engineWood/base.png new file mode 100755 index 0000000000..45061f15ac Binary files /dev/null and b/buildcraft_resources/assets/buildcraftcore/textures/blocks/engineWood/base.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/blocks/engineWood/chamber.png b/buildcraft_resources/assets/buildcraftcore/textures/blocks/engineWood/chamber.png new file mode 100755 index 0000000000..d975f18856 Binary files /dev/null and b/buildcraft_resources/assets/buildcraftcore/textures/blocks/engineWood/chamber.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/blocks/engineWood/icon.png b/buildcraft_resources/assets/buildcraftcore/textures/blocks/engineWood/icon.png new file mode 100755 index 0000000000..86ac7810a3 Binary files /dev/null and b/buildcraft_resources/assets/buildcraftcore/textures/blocks/engineWood/icon.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/blocks/laserBox/blockBlueLaser.png b/buildcraft_resources/assets/buildcraftcore/textures/blocks/laserBox/blockBlueLaser.png index 5d92340ef6..13ef51d82b 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/blocks/laserBox/blockBlueLaser.png and b/buildcraft_resources/assets/buildcraftcore/textures/blocks/laserBox/blockBlueLaser.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/blocks/laserBox/blockRedLaser.png b/buildcraft_resources/assets/buildcraftcore/textures/blocks/laserBox/blockRedLaser.png index 529aa708d1..a392d81f54 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/blocks/laserBox/blockRedLaser.png and b/buildcraft_resources/assets/buildcraftcore/textures/blocks/laserBox/blockRedLaser.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/blocks/laserBox/blockStripesLaser.png b/buildcraft_resources/assets/buildcraftcore/textures/blocks/laserBox/blockStripesLaser.png index 530bc4c9e1..d008fd6b8e 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/blocks/laserBox/blockStripesLaser.png and b/buildcraft_resources/assets/buildcraftcore/textures/blocks/laserBox/blockStripesLaser.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/blocks/markerBlock/default.png b/buildcraft_resources/assets/buildcraftcore/textures/blocks/markerBlock/default.png new file mode 100755 index 0000000000..6e7fab2d01 Binary files /dev/null and b/buildcraft_resources/assets/buildcraftcore/textures/blocks/markerBlock/default.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/blocks/misc/texture_blue_dark.png b/buildcraft_resources/assets/buildcraftcore/textures/blocks/misc/texture_blue_dark.png index 6eaeb99edb..50c2a6c114 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/blocks/misc/texture_blue_dark.png and b/buildcraft_resources/assets/buildcraftcore/textures/blocks/misc/texture_blue_dark.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/blocks/misc/texture_blue_lit.png b/buildcraft_resources/assets/buildcraftcore/textures/blocks/misc/texture_blue_lit.png index 05e1217445..f4716361c5 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/blocks/misc/texture_blue_lit.png and b/buildcraft_resources/assets/buildcraftcore/textures/blocks/misc/texture_blue_lit.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/blocks/misc/texture_cyan.png b/buildcraft_resources/assets/buildcraftcore/textures/blocks/misc/texture_cyan.png index 3e44194b02..9a6181c7c6 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/blocks/misc/texture_cyan.png and b/buildcraft_resources/assets/buildcraftcore/textures/blocks/misc/texture_cyan.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/blocks/misc/texture_green_dark.png b/buildcraft_resources/assets/buildcraftcore/textures/blocks/misc/texture_green_dark.png index 6f9861d516..9e49030df9 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/blocks/misc/texture_green_dark.png and b/buildcraft_resources/assets/buildcraftcore/textures/blocks/misc/texture_green_dark.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/blocks/misc/texture_green_lit.png b/buildcraft_resources/assets/buildcraftcore/textures/blocks/misc/texture_green_lit.png index 6e68784ec3..6223f9d24c 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/blocks/misc/texture_green_lit.png and b/buildcraft_resources/assets/buildcraftcore/textures/blocks/misc/texture_green_lit.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/blocks/misc/texture_red_dark.png b/buildcraft_resources/assets/buildcraftcore/textures/blocks/misc/texture_red_dark.png index 256cb503ef..451e6d75fe 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/blocks/misc/texture_red_dark.png and b/buildcraft_resources/assets/buildcraftcore/textures/blocks/misc/texture_red_dark.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/blocks/misc/texture_red_lit.png b/buildcraft_resources/assets/buildcraftcore/textures/blocks/misc/texture_red_lit.png index bedb4bdbfd..d9de7e49d7 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/blocks/misc/texture_red_lit.png and b/buildcraft_resources/assets/buildcraftcore/textures/blocks/misc/texture_red_lit.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/blocks/misc/texture_yellow_dark.png b/buildcraft_resources/assets/buildcraftcore/textures/blocks/misc/texture_yellow_dark.png index 08b133dfb4..996ffe9d8b 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/blocks/misc/texture_yellow_dark.png and b/buildcraft_resources/assets/buildcraftcore/textures/blocks/misc/texture_yellow_dark.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/blocks/misc/texture_yellow_lit.png b/buildcraft_resources/assets/buildcraftcore/textures/blocks/misc/texture_yellow_lit.png index d4f98da07b..75a55877ec 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/blocks/misc/texture_yellow_lit.png and b/buildcraft_resources/assets/buildcraftcore/textures/blocks/misc/texture_yellow_lit.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/blocks/misc/transparent.png b/buildcraft_resources/assets/buildcraftcore/textures/blocks/misc/transparent.png index eb674ec7f1..e0eac4e5e9 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/blocks/misc/transparent.png and b/buildcraft_resources/assets/buildcraftcore/textures/blocks/misc/transparent.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/blocks/pathMarkerBlock/active.png b/buildcraft_resources/assets/buildcraftcore/textures/blocks/pathMarkerBlock/active.png new file mode 100755 index 0000000000..554b3e0685 Binary files /dev/null and b/buildcraft_resources/assets/buildcraftcore/textures/blocks/pathMarkerBlock/active.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/blocks/pathMarkerBlock/default.png b/buildcraft_resources/assets/buildcraftcore/textures/blocks/pathMarkerBlock/default.png new file mode 100755 index 0000000000..abe1aa3860 Binary files /dev/null and b/buildcraft_resources/assets/buildcraftcore/textures/blocks/pathMarkerBlock/default.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/gui/buttons.png b/buildcraft_resources/assets/buildcraftcore/textures/gui/buttons.png index 099e297487..1791d9dce0 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/gui/buttons.png and b/buildcraft_resources/assets/buildcraftcore/textures/gui/buttons.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/gui/generic_one_slot.png b/buildcraft_resources/assets/buildcraftcore/textures/gui/generic_one_slot.png index c998bffbf0..f7e9fcb1d5 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/gui/generic_one_slot.png and b/buildcraft_resources/assets/buildcraftcore/textures/gui/generic_one_slot.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/gui/list_new.png b/buildcraft_resources/assets/buildcraftcore/textures/gui/list_new.png new file mode 100644 index 0000000000..e3a36e47d2 Binary files /dev/null and b/buildcraft_resources/assets/buildcraftcore/textures/gui/list_new.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/gui/tablet.png b/buildcraft_resources/assets/buildcraftcore/textures/gui/tablet.png index d24ad52d78..e51f7b9afe 100644 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/gui/tablet.png and b/buildcraft_resources/assets/buildcraftcore/textures/gui/tablet.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/items/debugger.png b/buildcraft_resources/assets/buildcraftcore/textures/items/debugger.png index ddca9e3dc8..1aa6dd2cd0 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/items/debugger.png and b/buildcraft_resources/assets/buildcraftcore/textures/items/debugger.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/items/diamondGearItem.png b/buildcraft_resources/assets/buildcraftcore/textures/items/diamondGearItem.png index 8129f07259..d1bd43552c 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/items/diamondGearItem.png and b/buildcraft_resources/assets/buildcraftcore/textures/items/diamondGearItem.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/arrow_dl.png b/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/arrow_dl.png new file mode 100644 index 0000000000..ba0b4b24ef Binary files /dev/null and b/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/arrow_dl.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/arrow_down.png b/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/arrow_down.png index 6667e10ebd..bff7191f9c 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/arrow_down.png and b/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/arrow_down.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/arrow_dr.png b/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/arrow_dr.png new file mode 100644 index 0000000000..b475991ed6 Binary files /dev/null and b/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/arrow_dr.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/arrow_left.png b/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/arrow_left.png new file mode 100644 index 0000000000..2a9dbc5bcb Binary files /dev/null and b/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/arrow_left.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/arrow_right.png b/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/arrow_right.png new file mode 100644 index 0000000000..6c5690e9cc Binary files /dev/null and b/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/arrow_right.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/arrow_ul.png b/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/arrow_ul.png new file mode 100644 index 0000000000..11e15970dd Binary files /dev/null and b/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/arrow_ul.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/arrow_up.png b/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/arrow_up.png index db5322e4ba..1e13582fa7 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/arrow_up.png and b/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/arrow_up.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/arrow_ur.png b/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/arrow_ur.png new file mode 100644 index 0000000000..d7714166cb Binary files /dev/null and b/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/arrow_ur.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/center_0.png b/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/center_0.png new file mode 100644 index 0000000000..7f173d1ab4 Binary files /dev/null and b/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/center_0.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/center_1.png b/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/center_1.png new file mode 100644 index 0000000000..e53483395c Binary files /dev/null and b/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/center_1.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/center_2.png b/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/center_2.png new file mode 100644 index 0000000000..2b69baab55 Binary files /dev/null and b/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/center_2.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/center_3.png b/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/center_3.png new file mode 100644 index 0000000000..433afb8f3b Binary files /dev/null and b/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/center_3.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/center_4.png b/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/center_4.png new file mode 100644 index 0000000000..e42a61e536 Binary files /dev/null and b/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/center_4.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/center_5.png b/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/center_5.png new file mode 100644 index 0000000000..536b2ef463 Binary files /dev/null and b/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/center_5.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/center_6.png b/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/center_6.png new file mode 100644 index 0000000000..55a2ea6967 Binary files /dev/null and b/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/center_6.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/center_7.png b/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/center_7.png new file mode 100644 index 0000000000..11dfd4e37c Binary files /dev/null and b/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/center_7.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/center_8.png b/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/center_8.png new file mode 100644 index 0000000000..efe612095d Binary files /dev/null and b/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/center_8.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/filled.png b/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/filled.png new file mode 100644 index 0000000000..ce18f5fbb5 Binary files /dev/null and b/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/filled.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/hollow.png b/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/hollow.png new file mode 100644 index 0000000000..fab9ff17ac Binary files /dev/null and b/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/hollow.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/stairs_ascend.png b/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/stairs_ascend.png new file mode 100644 index 0000000000..7e44ee4ce4 Binary files /dev/null and b/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/stairs_ascend.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/stairs_descend.png b/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/stairs_descend.png new file mode 100644 index 0000000000..7073957ba6 Binary files /dev/null and b/buildcraft_resources/assets/buildcraftcore/textures/items/fillerParameters/stairs_descend.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/items/goldGearItem.png b/buildcraft_resources/assets/buildcraftcore/textures/items/goldGearItem.png index b1b9d26d0e..59bf0cad37 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/items/goldGearItem.png and b/buildcraft_resources/assets/buildcraftcore/textures/items/goldGearItem.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/items/icons/guiicons_0_4.png b/buildcraft_resources/assets/buildcraftcore/textures/items/icons/guiicons_0_4.png index c71120e176..a454397757 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/items/icons/guiicons_0_4.png and b/buildcraft_resources/assets/buildcraftcore/textures/items/icons/guiicons_0_4.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/items/ironGearItem.png b/buildcraft_resources/assets/buildcraftcore/textures/items/ironGearItem.png index 1c292642a7..cf5f8331b6 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/items/ironGearItem.png and b/buildcraft_resources/assets/buildcraftcore/textures/items/ironGearItem.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/items/list/clean.png b/buildcraft_resources/assets/buildcraftcore/textures/items/list/clean.png index 3fe0dfd260..44992002c2 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/items/list/clean.png and b/buildcraft_resources/assets/buildcraftcore/textures/items/list/clean.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/items/list/used.png b/buildcraft_resources/assets/buildcraftcore/textures/items/list/used.png index fa9074b192..3df73e0731 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/items/list/used.png and b/buildcraft_resources/assets/buildcraftcore/textures/items/list/used.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/items/map/area.png b/buildcraft_resources/assets/buildcraftcore/textures/items/map/area.png index 2e2ed9e97b..0da28900da 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/items/map/area.png and b/buildcraft_resources/assets/buildcraftcore/textures/items/map/area.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/items/map/clean.png b/buildcraft_resources/assets/buildcraftcore/textures/items/map/clean.png index 690f4f9486..c2065636ea 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/items/map/clean.png and b/buildcraft_resources/assets/buildcraftcore/textures/items/map/clean.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/items/map/path.png b/buildcraft_resources/assets/buildcraftcore/textures/items/map/path.png index 666dee8d7a..b6fe71563c 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/items/map/path.png and b/buildcraft_resources/assets/buildcraftcore/textures/items/map/path.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/items/map/spot.png b/buildcraft_resources/assets/buildcraftcore/textures/items/map/spot.png index ba62162ea1..c9d41b9cb8 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/items/map/spot.png and b/buildcraft_resources/assets/buildcraftcore/textures/items/map/spot.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/items/map/zone.png b/buildcraft_resources/assets/buildcraftcore/textures/items/map/zone.png index bdcc7320af..abf62c52ac 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/items/map/zone.png and b/buildcraft_resources/assets/buildcraftcore/textures/items/map/zone.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/items/stoneGearItem.png b/buildcraft_resources/assets/buildcraftcore/textures/items/stoneGearItem.png index 98ddbf7158..42986c618c 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/items/stoneGearItem.png and b/buildcraft_resources/assets/buildcraftcore/textures/items/stoneGearItem.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/items/woodenGearItem.png b/buildcraft_resources/assets/buildcraftcore/textures/items/woodenGearItem.png index a1c59da5a8..01aeb5a2d1 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/items/woodenGearItem.png and b/buildcraft_resources/assets/buildcraftcore/textures/items/woodenGearItem.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/items/wrenchItem.png b/buildcraft_resources/assets/buildcraftcore/textures/items/wrenchItem.png index 4a5d62c152..f3c25782bb 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/items/wrenchItem.png and b/buildcraft_resources/assets/buildcraftcore/textures/items/wrenchItem.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/lasers/blue.png b/buildcraft_resources/assets/buildcraftcore/textures/lasers/blue.png index 7abfdef025..35100198e2 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/lasers/blue.png and b/buildcraft_resources/assets/buildcraftcore/textures/lasers/blue.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/lasers/green.png b/buildcraft_resources/assets/buildcraftcore/textures/lasers/green.png index cd2f980e6d..b5d7d7dcbf 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/lasers/green.png and b/buildcraft_resources/assets/buildcraftcore/textures/lasers/green.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/lasers/red.png b/buildcraft_resources/assets/buildcraftcore/textures/lasers/red.png index ea85ef9975..4358b44845 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/lasers/red.png and b/buildcraft_resources/assets/buildcraftcore/textures/lasers/red.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/lasers/stripes_blue.png b/buildcraft_resources/assets/buildcraftcore/textures/lasers/stripes_blue.png index d32d935899..1075aee104 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/lasers/stripes_blue.png and b/buildcraft_resources/assets/buildcraftcore/textures/lasers/stripes_blue.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/lasers/stripes_yellow.png b/buildcraft_resources/assets/buildcraftcore/textures/lasers/stripes_yellow.png index ca21667974..b468173aa8 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/lasers/stripes_yellow.png and b/buildcraft_resources/assets/buildcraftcore/textures/lasers/stripes_yellow.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/lasers/yellow.png b/buildcraft_resources/assets/buildcraftcore/textures/lasers/yellow.png index c71c87ed33..a205f653fd 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/lasers/yellow.png and b/buildcraft_resources/assets/buildcraftcore/textures/lasers/yellow.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/triggers/action_machinecontrol_loop.png b/buildcraft_resources/assets/buildcraftcore/textures/triggers/action_machinecontrol_loop.png index 748a9d7aac..027ca0e231 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/triggers/action_machinecontrol_loop.png and b/buildcraft_resources/assets/buildcraftcore/textures/triggers/action_machinecontrol_loop.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/triggers/action_machinecontrol_off.png b/buildcraft_resources/assets/buildcraftcore/textures/triggers/action_machinecontrol_off.png index 59754e5da4..af6073cb9b 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/triggers/action_machinecontrol_off.png and b/buildcraft_resources/assets/buildcraftcore/textures/triggers/action_machinecontrol_off.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/triggers/action_machinecontrol_on.png b/buildcraft_resources/assets/buildcraftcore/textures/triggers/action_machinecontrol_on.png index 9974b8b4ef..a506e0b5fe 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/triggers/action_machinecontrol_on.png and b/buildcraft_resources/assets/buildcraftcore/textures/triggers/action_machinecontrol_on.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/triggers/action_redstoneoutput.png b/buildcraft_resources/assets/buildcraftcore/textures/triggers/action_redstoneoutput.png index ded214bbbd..8f1507fe07 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/triggers/action_redstoneoutput.png and b/buildcraft_resources/assets/buildcraftcore/textures/triggers/action_redstoneoutput.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/triggers/redstone_gate_side_only.png b/buildcraft_resources/assets/buildcraftcore/textures/triggers/redstone_gate_side_only.png index e42c946516..7fa56771a5 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/triggers/redstone_gate_side_only.png and b/buildcraft_resources/assets/buildcraftcore/textures/triggers/redstone_gate_side_only.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_dir_down.png b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_dir_down.png index c62ebe1c92..df1a493b3a 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_dir_down.png and b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_dir_down.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_dir_east.png b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_dir_east.png index d80d33e239..3a64248e67 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_dir_east.png and b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_dir_east.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_dir_north.png b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_dir_north.png index 5eb068a279..b8a7c32cb7 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_dir_north.png and b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_dir_north.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_dir_south.png b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_dir_south.png index b772a0944a..b330c6d0cc 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_dir_south.png and b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_dir_south.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_dir_up.png b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_dir_up.png index f5f2203162..08bb635c50 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_dir_up.png and b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_dir_up.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_dir_west.png b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_dir_west.png index cdda3af2b6..13b404add9 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_dir_west.png and b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_dir_west.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_energy_storage_below25.png b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_energy_storage_below25.png index cebf02ad40..59d6dbf80f 100644 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_energy_storage_below25.png and b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_energy_storage_below25.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_energy_storage_below50.png b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_energy_storage_below50.png index a2bbd3bf50..2a39a8a58a 100644 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_energy_storage_below50.png and b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_energy_storage_below50.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_energy_storage_below75.png b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_energy_storage_below75.png index 9d74c19e79..c78a800956 100644 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_energy_storage_below75.png and b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_energy_storage_below75.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_energy_storage_high.png b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_energy_storage_high.png index ab2a5726d1..74857415aa 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_energy_storage_high.png and b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_energy_storage_high.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_energy_storage_low.png b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_energy_storage_low.png index 06973763e7..06aae8e032 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_energy_storage_low.png and b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_energy_storage_low.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_inventory_below25.png b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_inventory_below25.png index efbf40a76d..ed7ec35a5c 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_inventory_below25.png and b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_inventory_below25.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_inventory_below50.png b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_inventory_below50.png index 592c4a0741..8af20149e5 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_inventory_below50.png and b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_inventory_below50.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_inventory_below75.png b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_inventory_below75.png index 4fc2042052..7aa4afe840 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_inventory_below75.png and b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_inventory_below75.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_inventory_contains.png b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_inventory_contains.png index cc853b900a..b9ea48f759 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_inventory_contains.png and b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_inventory_contains.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_inventory_empty.png b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_inventory_empty.png index 9299456ab5..8f85ece181 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_inventory_empty.png and b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_inventory_empty.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_inventory_full.png b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_inventory_full.png index 159903f4bb..4cba8e3813 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_inventory_full.png and b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_inventory_full.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_inventory_space.png b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_inventory_space.png index d5c140fdbe..4667a43d6e 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_inventory_space.png and b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_inventory_space.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_liquidcontainer_below25.png b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_liquidcontainer_below25.png index c622458722..28f4cc028f 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_liquidcontainer_below25.png and b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_liquidcontainer_below25.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_liquidcontainer_below50.png b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_liquidcontainer_below50.png index 95224931c9..304533fa62 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_liquidcontainer_below50.png and b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_liquidcontainer_below50.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_liquidcontainer_below75.png b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_liquidcontainer_below75.png index d9b2064c1b..e111d26e98 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_liquidcontainer_below75.png and b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_liquidcontainer_below75.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_liquidcontainer_contains.png b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_liquidcontainer_contains.png index 10d84fcbed..07778ba5c0 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_liquidcontainer_contains.png and b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_liquidcontainer_contains.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_liquidcontainer_empty.png b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_liquidcontainer_empty.png index 1a6216e028..aa4ac4f46f 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_liquidcontainer_empty.png and b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_liquidcontainer_empty.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_liquidcontainer_full.png b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_liquidcontainer_full.png index d6b6b2551c..f92369adae 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_liquidcontainer_full.png and b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_liquidcontainer_full.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_liquidcontainer_space.png b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_liquidcontainer_space.png index ce57a6cbe3..fdf9f19636 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_liquidcontainer_space.png and b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_liquidcontainer_space.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_machine_active.png b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_machine_active.png index 43b868a494..7b20264892 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_machine_active.png and b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_machine_active.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_machine_inactive.png b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_machine_inactive.png index 69aab4afab..38da8e80fd 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_machine_inactive.png and b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_machine_inactive.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_redstoneinput_active.png b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_redstoneinput_active.png index ded214bbbd..8f1507fe07 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_redstoneinput_active.png and b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_redstoneinput_active.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_redstoneinput_inactive.png b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_redstoneinput_inactive.png index 381a168af0..7871b6a25e 100755 Binary files a/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_redstoneinput_inactive.png and b/buildcraft_resources/assets/buildcraftcore/textures/triggers/trigger_redstoneinput_inactive.png differ diff --git a/buildcraft_resources/assets/buildcraftenergy/textures/blocks/engine/creative/base.png b/buildcraft_resources/assets/buildcraftenergy/textures/blocks/engine/creative/base.png index fc9ca5994b..a13e5e6bd5 100755 Binary files a/buildcraft_resources/assets/buildcraftenergy/textures/blocks/engine/creative/base.png and b/buildcraft_resources/assets/buildcraftenergy/textures/blocks/engine/creative/base.png differ diff --git a/buildcraft_resources/assets/buildcraftenergy/textures/blocks/engine/creative/chamber.png b/buildcraft_resources/assets/buildcraftenergy/textures/blocks/engine/creative/chamber.png index ced65595c7..d4bf46d9e1 100755 Binary files a/buildcraft_resources/assets/buildcraftenergy/textures/blocks/engine/creative/chamber.png and b/buildcraft_resources/assets/buildcraftenergy/textures/blocks/engine/creative/chamber.png differ diff --git a/buildcraft_resources/assets/buildcraftenergy/textures/blocks/engine/creative/trunk.png b/buildcraft_resources/assets/buildcraftenergy/textures/blocks/engine/creative/trunk.png index fbf7fc7b40..8d544b501b 100755 Binary files a/buildcraft_resources/assets/buildcraftenergy/textures/blocks/engine/creative/trunk.png and b/buildcraft_resources/assets/buildcraftenergy/textures/blocks/engine/creative/trunk.png differ diff --git a/buildcraft_resources/assets/buildcraftenergy/textures/blocks/engine/iron/base.png b/buildcraft_resources/assets/buildcraftenergy/textures/blocks/engine/iron/base.png index b86082b5f4..2252b3b197 100755 Binary files a/buildcraft_resources/assets/buildcraftenergy/textures/blocks/engine/iron/base.png and b/buildcraft_resources/assets/buildcraftenergy/textures/blocks/engine/iron/base.png differ diff --git a/buildcraft_resources/assets/buildcraftenergy/textures/blocks/engine/iron/chamber.png b/buildcraft_resources/assets/buildcraftenergy/textures/blocks/engine/iron/chamber.png index 9f0d12b7d2..d975f18856 100755 Binary files a/buildcraft_resources/assets/buildcraftenergy/textures/blocks/engine/iron/chamber.png and b/buildcraft_resources/assets/buildcraftenergy/textures/blocks/engine/iron/chamber.png differ diff --git a/buildcraft_resources/assets/buildcraftenergy/textures/blocks/engine/iron/icon.png b/buildcraft_resources/assets/buildcraftenergy/textures/blocks/engine/iron/icon.png index b3808b8a6f..9823c445c4 100755 Binary files a/buildcraft_resources/assets/buildcraftenergy/textures/blocks/engine/iron/icon.png and b/buildcraft_resources/assets/buildcraftenergy/textures/blocks/engine/iron/icon.png differ diff --git a/buildcraft_resources/assets/buildcraftenergy/textures/blocks/engine/stone/base.png b/buildcraft_resources/assets/buildcraftenergy/textures/blocks/engine/stone/base.png index 0bb405db2c..342730e590 100755 Binary files a/buildcraft_resources/assets/buildcraftenergy/textures/blocks/engine/stone/base.png and b/buildcraft_resources/assets/buildcraftenergy/textures/blocks/engine/stone/base.png differ diff --git a/buildcraft_resources/assets/buildcraftenergy/textures/blocks/engine/stone/chamber.png b/buildcraft_resources/assets/buildcraftenergy/textures/blocks/engine/stone/chamber.png index 9780c4d8e1..d975f18856 100755 Binary files a/buildcraft_resources/assets/buildcraftenergy/textures/blocks/engine/stone/chamber.png and b/buildcraft_resources/assets/buildcraftenergy/textures/blocks/engine/stone/chamber.png differ diff --git a/buildcraft_resources/assets/buildcraftenergy/textures/blocks/engine/stone/icon.png b/buildcraft_resources/assets/buildcraftenergy/textures/blocks/engine/stone/icon.png index a07932a348..3842df9eec 100755 Binary files a/buildcraft_resources/assets/buildcraftenergy/textures/blocks/engine/stone/icon.png and b/buildcraft_resources/assets/buildcraftenergy/textures/blocks/engine/stone/icon.png differ diff --git a/buildcraft_resources/assets/buildcraftenergy/textures/blocks/engineCreative/icon.png b/buildcraft_resources/assets/buildcraftenergy/textures/blocks/engineCreative/icon.png new file mode 100644 index 0000000000..a212ef98e6 Binary files /dev/null and b/buildcraft_resources/assets/buildcraftenergy/textures/blocks/engineCreative/icon.png differ diff --git a/buildcraft_resources/assets/buildcraftenergy/textures/blocks/fluids/fuel_flow.png b/buildcraft_resources/assets/buildcraftenergy/textures/blocks/fluids/fuel_flow.png index 1434c4c93e..47131f7e67 100755 Binary files a/buildcraft_resources/assets/buildcraftenergy/textures/blocks/fluids/fuel_flow.png and b/buildcraft_resources/assets/buildcraftenergy/textures/blocks/fluids/fuel_flow.png differ diff --git a/buildcraft_resources/assets/buildcraftenergy/textures/items/triggers/trigger_coolant_below_threshold.png b/buildcraft_resources/assets/buildcraftenergy/textures/items/triggers/trigger_coolant_below_threshold.png new file mode 100644 index 0000000000..76a29d1fbe Binary files /dev/null and b/buildcraft_resources/assets/buildcraftenergy/textures/items/triggers/trigger_coolant_below_threshold.png differ diff --git a/buildcraft_resources/assets/buildcraftenergy/textures/items/triggers/trigger_fuel_below_threshold.png b/buildcraft_resources/assets/buildcraftenergy/textures/items/triggers/trigger_fuel_below_threshold.png new file mode 100644 index 0000000000..6feb3a4803 Binary files /dev/null and b/buildcraft_resources/assets/buildcraftenergy/textures/items/triggers/trigger_fuel_below_threshold.png differ diff --git a/buildcraft_resources/assets/buildcraftenergy/textures/triggers/trigger_engineheat_blue.png b/buildcraft_resources/assets/buildcraftenergy/textures/triggers/trigger_engineheat_blue.png index 8178379214..4c3a9f0e4d 100755 Binary files a/buildcraft_resources/assets/buildcraftenergy/textures/triggers/trigger_engineheat_blue.png and b/buildcraft_resources/assets/buildcraftenergy/textures/triggers/trigger_engineheat_blue.png differ diff --git a/buildcraft_resources/assets/buildcraftenergy/textures/triggers/trigger_engineheat_green.png b/buildcraft_resources/assets/buildcraftenergy/textures/triggers/trigger_engineheat_green.png index a2328b02d5..414589b793 100755 Binary files a/buildcraft_resources/assets/buildcraftenergy/textures/triggers/trigger_engineheat_green.png and b/buildcraft_resources/assets/buildcraftenergy/textures/triggers/trigger_engineheat_green.png differ diff --git a/buildcraft_resources/assets/buildcraftenergy/textures/triggers/trigger_engineheat_overheat.png b/buildcraft_resources/assets/buildcraftenergy/textures/triggers/trigger_engineheat_overheat.png index 0e02ae6dc9..82b590d4a7 100755 Binary files a/buildcraft_resources/assets/buildcraftenergy/textures/triggers/trigger_engineheat_overheat.png and b/buildcraft_resources/assets/buildcraftenergy/textures/triggers/trigger_engineheat_overheat.png differ diff --git a/buildcraft_resources/assets/buildcraftenergy/textures/triggers/trigger_engineheat_red.png b/buildcraft_resources/assets/buildcraftenergy/textures/triggers/trigger_engineheat_red.png index ec6e20e0fc..4031f85269 100755 Binary files a/buildcraft_resources/assets/buildcraftenergy/textures/triggers/trigger_engineheat_red.png and b/buildcraft_resources/assets/buildcraftenergy/textures/triggers/trigger_engineheat_red.png differ diff --git a/buildcraft_resources/assets/buildcraftenergy/textures/triggers/trigger_engineheat_yellow.png b/buildcraft_resources/assets/buildcraftenergy/textures/triggers/trigger_engineheat_yellow.png index f226dca423..e2e2d873fe 100755 Binary files a/buildcraft_resources/assets/buildcraftenergy/textures/triggers/trigger_engineheat_yellow.png and b/buildcraft_resources/assets/buildcraftenergy/textures/triggers/trigger_engineheat_yellow.png differ diff --git a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/autoWorkbench/bottom.png b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/autoWorkbench/bottom.png index 35fdb11e88..cc25886ff1 100755 Binary files a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/autoWorkbench/bottom.png and b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/autoWorkbench/bottom.png differ diff --git a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/autoWorkbench/side.png b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/autoWorkbench/side.png index 7a0c449f9b..d48e6a2eb3 100755 Binary files a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/autoWorkbench/side.png and b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/autoWorkbench/side.png differ diff --git a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/autoWorkbench/top.png b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/autoWorkbench/top.png index a9a2685853..8e60bb0793 100755 Binary files a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/autoWorkbench/top.png and b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/autoWorkbench/top.png differ diff --git a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/chute/middle.png b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/chute/middle.png index 7d449c4dff..7835407a3d 100755 Binary files a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/chute/middle.png and b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/chute/middle.png differ diff --git a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/floodGate/bottom.png b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/floodGate/bottom.png index 3597a69402..7f4d32afcc 100755 Binary files a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/floodGate/bottom.png and b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/floodGate/bottom.png differ diff --git a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/floodGate/side.png b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/floodGate/side.png index b5425d7f3e..c0c6863074 100755 Binary files a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/floodGate/side.png and b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/floodGate/side.png differ diff --git a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/floodGate/top.png b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/floodGate/top.png index 342aa649a0..1c5e305d23 100755 Binary files a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/floodGate/top.png and b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/floodGate/top.png differ diff --git a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/floodGate/valve.png b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/floodGate/valve.png index 57fc818217..b8e2583368 100755 Binary files a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/floodGate/valve.png and b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/floodGate/valve.png differ diff --git a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/hopperBlock/bottom.png b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/hopperBlock/bottom.png new file mode 100755 index 0000000000..98cc002eaf Binary files /dev/null and b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/hopperBlock/bottom.png differ diff --git a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/hopperBlock/top.png b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/hopperBlock/top.png new file mode 100755 index 0000000000..751856e526 Binary files /dev/null and b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/hopperBlock/top.png differ diff --git a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/miningWell/back.png b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/miningWell/back.png index e81b79743d..38820ff2fc 100755 Binary files a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/miningWell/back.png and b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/miningWell/back.png differ diff --git a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/miningWell/bottom.png b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/miningWell/bottom.png index bf06e1cc9d..438d0b921c 100755 Binary files a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/miningWell/bottom.png and b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/miningWell/bottom.png differ diff --git a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/miningWell/front.png b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/miningWell/front.png index 929c79f9dd..b4be2f2c8f 100755 Binary files a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/miningWell/front.png and b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/miningWell/front.png differ diff --git a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/miningWell/item_hatch.png b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/miningWell/item_hatch.png index 98f581e050..c2e06ef345 100755 Binary files a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/miningWell/item_hatch.png and b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/miningWell/item_hatch.png differ diff --git a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/miningWell/led_green.png b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/miningWell/led_green.png index 59e9e2c8ba..e0eb3877ad 100755 Binary files a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/miningWell/led_green.png and b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/miningWell/led_green.png differ diff --git a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/miningWell/led_red.png b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/miningWell/led_red.png index 07be6dfe1f..988c420611 100755 Binary files a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/miningWell/led_red.png and b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/miningWell/led_red.png differ diff --git a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/miningWell/side.png b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/miningWell/side.png index 08b0d59be0..395765e071 100755 Binary files a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/miningWell/side.png and b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/miningWell/side.png differ diff --git a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/miningWell/top.png b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/miningWell/top.png index 46d1efed95..61c00fbc2b 100755 Binary files a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/miningWell/top.png and b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/miningWell/top.png differ diff --git a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/plainPipe/default.png b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/plainPipe/default.png index b842c299f9..0355172bf2 100755 Binary files a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/plainPipe/default.png and b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/plainPipe/default.png differ diff --git a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/pump/bottom.png b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/pump/bottom.png index c5418a97ad..acaa91af92 100755 Binary files a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/pump/bottom.png and b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/pump/bottom.png differ diff --git a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/pump/led_green.png b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/pump/led_green.png index 22d2979af2..ddc7c9eee1 100755 Binary files a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/pump/led_green.png and b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/pump/led_green.png differ diff --git a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/pump/led_red.png b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/pump/led_red.png index afbf178265..9a69d11d14 100755 Binary files a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/pump/led_red.png and b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/pump/led_red.png differ diff --git a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/pump/top.png b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/pump/top.png index 2267ab5a8d..37f6a7a25a 100755 Binary files a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/pump/top.png and b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/pump/top.png differ diff --git a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/pump/tube.png b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/pump/tube.png index e4e0ac42cf..281bdf2214 100755 Binary files a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/pump/tube.png and b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/pump/tube.png differ diff --git a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/refinery/refinery.png b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/refinery/refinery.png index b50862e14d..ba0df64b61 100755 Binary files a/buildcraft_resources/assets/buildcraftfactory/textures/blocks/refinery/refinery.png and b/buildcraft_resources/assets/buildcraftfactory/textures/blocks/refinery/refinery.png differ diff --git a/buildcraft_resources/assets/buildcraftfactory/textures/gui/autobench.png b/buildcraft_resources/assets/buildcraftfactory/textures/gui/autobench.png index 4e81a0f5fd..5cc494f0fc 100755 Binary files a/buildcraft_resources/assets/buildcraftfactory/textures/gui/autobench.png and b/buildcraft_resources/assets/buildcraftfactory/textures/gui/autobench.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/blocks/requester/back.png b/buildcraft_resources/assets/buildcraftrobotics/textures/blocks/requester/back.png index 36b38bdcaa..cacd295757 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/blocks/requester/back.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/blocks/requester/back.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/blocks/requester/bottom.png b/buildcraft_resources/assets/buildcraftrobotics/textures/blocks/requester/bottom.png index 18cd3f633e..7f4d32afcc 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/blocks/requester/bottom.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/blocks/requester/bottom.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/blocks/requester/front.png b/buildcraft_resources/assets/buildcraftrobotics/textures/blocks/requester/front.png index b8f89c91eb..aaacebfe2a 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/blocks/requester/front.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/blocks/requester/front.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/blocks/requester/side.png b/buildcraft_resources/assets/buildcraftrobotics/textures/blocks/requester/side.png index 955d117148..f4d33ef021 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/blocks/requester/side.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/blocks/requester/side.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/blocks/requester/top.png b/buildcraft_resources/assets/buildcraftrobotics/textures/blocks/requester/top.png index 9863871bba..59aaa1c8eb 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/blocks/requester/top.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/blocks/requester/top.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/blocks/zone_plan/back.png b/buildcraft_resources/assets/buildcraftrobotics/textures/blocks/zone_plan/back.png index 1a21c48984..4521987385 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/blocks/zone_plan/back.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/blocks/zone_plan/back.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/blocks/zone_plan/front.png b/buildcraft_resources/assets/buildcraftrobotics/textures/blocks/zone_plan/front.png index e006cbaee4..7ec1ed1679 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/blocks/zone_plan/front.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/blocks/zone_plan/front.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/blocks/zone_plan/left.png b/buildcraft_resources/assets/buildcraftrobotics/textures/blocks/zone_plan/left.png index 81741d53fd..805bd17a11 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/blocks/zone_plan/left.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/blocks/zone_plan/left.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/blocks/zone_plan/right.png b/buildcraft_resources/assets/buildcraftrobotics/textures/blocks/zone_plan/right.png index e7c8159e9e..ec13a3e0ab 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/blocks/zone_plan/right.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/blocks/zone_plan/right.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/blocks/zone_plan/top.png b/buildcraft_resources/assets/buildcraftrobotics/textures/blocks/zone_plan/top.png index af74459255..577111ea75 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/blocks/zone_plan/top.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/blocks/zone_plan/top.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/entities/overlay_bottom.png b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/overlay_bottom.png index 5e2092e84b..b5a9c69726 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/entities/overlay_bottom.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/overlay_bottom.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/entities/overlay_side.png b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/overlay_side.png index 0f57fa733b..d2bee90653 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/entities/overlay_side.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/overlay_side.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_base.png b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_base.png index e535524eb9..55a9a01029 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_base.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_base.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_bomber.png b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_bomber.png index f6cb38ab96..410d605a52 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_bomber.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_bomber.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_breaker.png b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_breaker.png new file mode 100755 index 0000000000..c3a032f29a Binary files /dev/null and b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_breaker.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_builder.png b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_builder.png index 7733d6cb11..81b6c53b96 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_builder.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_builder.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_builder_base.png b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_builder_base.png index 91259c43d2..97fb5703a5 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_builder_base.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_builder_base.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_carrier.png b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_carrier.png index 83348b2a3d..e86f95ae45 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_carrier.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_carrier.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_delivery.png b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_delivery.png index ea544cd52d..03e8c4f9bc 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_delivery.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_delivery.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_factory.png b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_factory.png index 51f662db59..c923589a04 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_factory.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_factory.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_farmer.png b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_farmer.png index f2b0821554..f4cb152d7c 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_farmer.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_farmer.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_fluidCarrier.png b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_fluidCarrier.png index 733cc4b4e7..e58f1240a5 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_fluidCarrier.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_fluidCarrier.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_harvester.png b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_harvester.png index 43108794b9..e2eb13d418 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_harvester.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_harvester.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_knight.png b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_knight.png index 56e417387e..333e80a0a5 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_knight.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_knight.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_leaveCutter.png b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_leaveCutter.png index f4580f3bcd..1a6d6aef7a 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_leaveCutter.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_leaveCutter.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_lumberjack.png b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_lumberjack.png index a71ff23b97..24a9915a59 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_lumberjack.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_lumberjack.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_military.png b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_military.png index 26856cc4e3..a47005f4de 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_military.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_military.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_miner.png b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_miner.png index 1f790a36ce..872fba9a9d 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_miner.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_miner.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_picker.png b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_picker.png index 3c33ac27c5..4cc53eadfa 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_picker.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_picker.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_planter.png b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_planter.png index b07c1be990..9ef3ae18af 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_planter.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_planter.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_pump.png b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_pump.png index 32c0a0953f..c8f169a5e7 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_pump.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_pump.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_shovelman.png b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_shovelman.png index e34a55cd7b..89e3d760ef 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_shovelman.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_shovelman.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_stripes.png b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_stripes.png index c268355041..3996cd77c3 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_stripes.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/entities/robot_stripes.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/gui/zone_planner_gui.png b/buildcraft_resources/assets/buildcraftrobotics/textures/gui/zone_planner_gui.png index f5270366ea..27ada69de7 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/gui/zone_planner_gui.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/gui/zone_planner_gui.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/items/board/blue.png b/buildcraft_resources/assets/buildcraftrobotics/textures/items/board/blue.png deleted file mode 100644 index aa561e8ac2..0000000000 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/items/board/blue.png and /dev/null differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/items/board/clean.png b/buildcraft_resources/assets/buildcraftrobotics/textures/items/board/clean.png deleted file mode 100644 index b21e1d317c..0000000000 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/items/board/clean.png and /dev/null differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/items/board/green.png b/buildcraft_resources/assets/buildcraftrobotics/textures/items/board/green.png deleted file mode 100644 index 972e70e74d..0000000000 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/items/board/green.png and /dev/null differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/items/board/red.png b/buildcraft_resources/assets/buildcraftrobotics/textures/items/board/red.png deleted file mode 100644 index fc9e696fab..0000000000 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/items/board/red.png and /dev/null differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/items/board/unknown_map.png b/buildcraft_resources/assets/buildcraftrobotics/textures/items/board/unknown_map.png index 99e0063d23..cab0245b0a 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/items/board/unknown_map.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/items/board/unknown_map.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/items/board/yellow.png b/buildcraft_resources/assets/buildcraftrobotics/textures/items/board/yellow.png deleted file mode 100644 index 453ba71f6d..0000000000 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/items/board/yellow.png and /dev/null differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_robot_filter.png b/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_robot_filter.png index 8f772d6473..7e58a11ecf 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_robot_filter.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_robot_filter.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_robot_filter_tool.png b/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_robot_filter_tool.png index 3695ebcbfd..ec34978bcf 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_robot_filter_tool.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_robot_filter_tool.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_robot_goto_station.png b/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_robot_goto_station.png index 57cde5982d..6da7d7c511 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_robot_goto_station.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_robot_goto_station.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_robot_inventory.png b/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_robot_inventory.png index 6db871765f..50c204d9ea 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_robot_inventory.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_robot_inventory.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_robot_load_unload_area.png b/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_robot_load_unload_area.png index 8f16081d98..60c9766f99 100644 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_robot_load_unload_area.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_robot_load_unload_area.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_robot_wakeup.png b/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_robot_wakeup.png index 487f1a814a..a89cd08e87 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_robot_wakeup.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_robot_wakeup.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_robot_work_in_area.png b/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_robot_work_in_area.png index e5f91a880f..4a5e3e9efa 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_robot_work_in_area.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_robot_work_in_area.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_station_accept_fluids.png b/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_station_accept_fluids.png index 52d7b21c25..f2fc0446ee 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_station_accept_fluids.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_station_accept_fluids.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_station_accept_items.png b/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_station_accept_items.png index d98e93643e..1535301138 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_station_accept_items.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_station_accept_items.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_station_allow_craft.png b/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_station_allow_craft.png index 834270c732..b211526faf 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_station_allow_craft.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_station_allow_craft.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_station_drop_in_pipe.png b/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_station_drop_in_pipe.png index 6bf9da377b..c9d1b44a8c 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_station_drop_in_pipe.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_station_drop_in_pipe.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_station_machine_request.png b/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_station_machine_request.png index 6d89014f3e..ff3fe7f656 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_station_machine_request.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_station_machine_request.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_station_provide_fluids.png b/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_station_provide_fluids.png index 8f3c4df406..b9fc9a57e9 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_station_provide_fluids.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_station_provide_fluids.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_station_request_items.png b/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_station_request_items.png index 0ebbbf864f..8a29aeb789 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_station_request_items.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_station_request_items.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_station_robot_forbidden.png b/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_station_robot_forbidden.png index aa6b1f0119..72eb110c70 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_station_robot_forbidden.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_station_robot_forbidden.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_station_robot_mandatory.png b/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_station_robot_mandatory.png index 87d9bc76b6..934d5641a6 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_station_robot_mandatory.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/action_station_robot_mandatory.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/trigger_robot_in_station.png b/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/trigger_robot_in_station.png index 8ebf36c090..54b5932381 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/trigger_robot_in_station.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/trigger_robot_in_station.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/trigger_robot_linked.png b/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/trigger_robot_linked.png index d49cec53c9..b18498b26a 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/trigger_robot_linked.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/trigger_robot_linked.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/trigger_robot_reserved.png b/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/trigger_robot_reserved.png index edce6690b1..599410affe 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/trigger_robot_reserved.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/trigger_robot_reserved.png differ diff --git a/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/trigger_robot_sleep.png b/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/trigger_robot_sleep.png index 6991312707..331246180f 100755 Binary files a/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/trigger_robot_sleep.png and b/buildcraft_resources/assets/buildcraftrobotics/textures/triggers/trigger_robot_sleep.png differ diff --git a/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/advancedCraftingTable/default.png b/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/advancedCraftingTable/default.png index 22e2c9cf2f..1c9207717c 100755 Binary files a/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/advancedCraftingTable/default.png and b/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/advancedCraftingTable/default.png differ diff --git a/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/assemblyTable/default.png b/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/assemblyTable/default.png index 14f3a30bdd..2f67cab200 100755 Binary files a/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/assemblyTable/default.png and b/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/assemblyTable/default.png differ diff --git a/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/chargingTable/default.png b/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/chargingTable/default.png index 24eaae8238..50e5a4a522 100755 Binary files a/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/chargingTable/default.png and b/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/chargingTable/default.png differ diff --git a/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/chargingTable/table4_dark.png b/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/chargingTable/table4_dark.png index a6bdc649fa..c141875049 100755 Binary files a/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/chargingTable/table4_dark.png and b/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/chargingTable/table4_dark.png differ diff --git a/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/chargingTable/table4_overlay.png b/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/chargingTable/table4_overlay.png index ecb2d9708f..970d11795d 100755 Binary files a/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/chargingTable/table4_overlay.png and b/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/chargingTable/table4_overlay.png differ diff --git a/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/integrationTable/default.png b/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/integrationTable/default.png index 41e7f83c1a..b129b31d65 100755 Binary files a/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/integrationTable/default.png and b/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/integrationTable/default.png differ diff --git a/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/laser/bottom.png b/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/laser/bottom.png index edd12e12aa..1eec15573b 100755 Binary files a/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/laser/bottom.png and b/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/laser/bottom.png differ diff --git a/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/laser/side.png b/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/laser/side.png index 716dccb98d..05754d397b 100755 Binary files a/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/laser/side.png and b/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/laser/side.png differ diff --git a/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/laser/top.png b/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/laser/top.png index d90d76153b..f14a4bcd1c 100755 Binary files a/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/laser/top.png and b/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/laser/top.png differ diff --git a/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/packagerBlock/bottom.png b/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/packagerBlock/bottom.png index 0697fc3d26..7f4d32afcc 100644 Binary files a/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/packagerBlock/bottom.png and b/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/packagerBlock/bottom.png differ diff --git a/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/packagerBlock/side.png b/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/packagerBlock/side.png index 6a023b0afa..cd244f725d 100644 Binary files a/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/packagerBlock/side.png and b/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/packagerBlock/side.png differ diff --git a/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/packagerBlock/top.png b/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/packagerBlock/top.png index 44f58dee62..b861c16a8a 100644 Binary files a/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/packagerBlock/top.png and b/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/packagerBlock/top.png differ diff --git a/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/programmingTable/default.png b/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/programmingTable/default.png index d9a7cd5ac3..3820620100 100755 Binary files a/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/programmingTable/default.png and b/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/programmingTable/default.png differ diff --git a/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/stampingTable/default.png b/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/stampingTable/default.png index 22e2c9cf2f..1c9207717c 100755 Binary files a/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/stampingTable/default.png and b/buildcraft_resources/assets/buildcraftsilicon/textures/blocks/stampingTable/default.png differ diff --git a/buildcraft_resources/assets/buildcraftsilicon/textures/gui/assembly_table.png b/buildcraft_resources/assets/buildcraftsilicon/textures/gui/assembly_table.png index 67770763eb..035fd21ffc 100755 Binary files a/buildcraft_resources/assets/buildcraftsilicon/textures/gui/assembly_table.png and b/buildcraft_resources/assets/buildcraftsilicon/textures/gui/assembly_table.png differ diff --git a/buildcraft_resources/assets/buildcraftsilicon/textures/gui/charging_table.png b/buildcraft_resources/assets/buildcraftsilicon/textures/gui/charging_table.png index 741d06e3d2..c4227567e4 100755 Binary files a/buildcraft_resources/assets/buildcraftsilicon/textures/gui/charging_table.png and b/buildcraft_resources/assets/buildcraftsilicon/textures/gui/charging_table.png differ diff --git a/buildcraft_resources/assets/buildcraftsilicon/textures/gui/integration_table.png b/buildcraft_resources/assets/buildcraftsilicon/textures/gui/integration_table.png index 330a353a47..3e87abd0e1 100755 Binary files a/buildcraft_resources/assets/buildcraftsilicon/textures/gui/integration_table.png and b/buildcraft_resources/assets/buildcraftsilicon/textures/gui/integration_table.png differ diff --git a/buildcraft_resources/assets/buildcraftsilicon/textures/gui/packager.png b/buildcraft_resources/assets/buildcraftsilicon/textures/gui/packager.png index 7a088f9d81..b5eb9d08e5 100644 Binary files a/buildcraft_resources/assets/buildcraftsilicon/textures/gui/packager.png and b/buildcraft_resources/assets/buildcraftsilicon/textures/gui/packager.png differ diff --git a/buildcraft_resources/assets/buildcraftsilicon/textures/gui/programming_table.png b/buildcraft_resources/assets/buildcraftsilicon/textures/gui/programming_table.png index 5ced914a79..15b39f186a 100755 Binary files a/buildcraft_resources/assets/buildcraftsilicon/textures/gui/programming_table.png and b/buildcraft_resources/assets/buildcraftsilicon/textures/gui/programming_table.png differ diff --git a/buildcraft_resources/assets/buildcraftsilicon/textures/gui/stamper.png b/buildcraft_resources/assets/buildcraftsilicon/textures/gui/stamper.png index ca3593998d..ff52d82417 100644 Binary files a/buildcraft_resources/assets/buildcraftsilicon/textures/gui/stamper.png and b/buildcraft_resources/assets/buildcraftsilicon/textures/gui/stamper.png differ diff --git a/buildcraft_resources/assets/buildcraftsilicon/textures/items/chipset/redstone_comp_chipset.png b/buildcraft_resources/assets/buildcraftsilicon/textures/items/chipset/redstone_comp_chipset.png index 9f1e83ebe7..a5599142b2 100755 Binary files a/buildcraft_resources/assets/buildcraftsilicon/textures/items/chipset/redstone_comp_chipset.png and b/buildcraft_resources/assets/buildcraftsilicon/textures/items/chipset/redstone_comp_chipset.png differ diff --git a/buildcraft_resources/assets/buildcraftsilicon/textures/items/chipset/redstone_diamond_chipset.png b/buildcraft_resources/assets/buildcraftsilicon/textures/items/chipset/redstone_diamond_chipset.png index 7ce9901c49..1f77dc436e 100755 Binary files a/buildcraft_resources/assets/buildcraftsilicon/textures/items/chipset/redstone_diamond_chipset.png and b/buildcraft_resources/assets/buildcraftsilicon/textures/items/chipset/redstone_diamond_chipset.png differ diff --git a/buildcraft_resources/assets/buildcraftsilicon/textures/items/chipset/redstone_emerald_chipset.png b/buildcraft_resources/assets/buildcraftsilicon/textures/items/chipset/redstone_emerald_chipset.png index 8e82ed12bc..90502874ed 100755 Binary files a/buildcraft_resources/assets/buildcraftsilicon/textures/items/chipset/redstone_emerald_chipset.png and b/buildcraft_resources/assets/buildcraftsilicon/textures/items/chipset/redstone_emerald_chipset.png differ diff --git a/buildcraft_resources/assets/buildcraftsilicon/textures/items/chipset/redstone_gold_chipset.png b/buildcraft_resources/assets/buildcraftsilicon/textures/items/chipset/redstone_gold_chipset.png index 7470a6736b..203e46b533 100755 Binary files a/buildcraft_resources/assets/buildcraftsilicon/textures/items/chipset/redstone_gold_chipset.png and b/buildcraft_resources/assets/buildcraftsilicon/textures/items/chipset/redstone_gold_chipset.png differ diff --git a/buildcraft_resources/assets/buildcraftsilicon/textures/items/chipset/redstone_iron_chipset.png b/buildcraft_resources/assets/buildcraftsilicon/textures/items/chipset/redstone_iron_chipset.png index 45f11575cd..a7a72ae02d 100755 Binary files a/buildcraft_resources/assets/buildcraftsilicon/textures/items/chipset/redstone_iron_chipset.png and b/buildcraft_resources/assets/buildcraftsilicon/textures/items/chipset/redstone_iron_chipset.png differ diff --git a/buildcraft_resources/assets/buildcraftsilicon/textures/items/chipset/redstone_pulsating_chipset.png b/buildcraft_resources/assets/buildcraftsilicon/textures/items/chipset/redstone_pulsating_chipset.png index fbd1feace9..1d98f3c0c8 100755 Binary files a/buildcraft_resources/assets/buildcraftsilicon/textures/items/chipset/redstone_pulsating_chipset.png and b/buildcraft_resources/assets/buildcraftsilicon/textures/items/chipset/redstone_pulsating_chipset.png differ diff --git a/buildcraft_resources/assets/buildcraftsilicon/textures/items/chipset/redstone_quartz_chipset.png b/buildcraft_resources/assets/buildcraftsilicon/textures/items/chipset/redstone_quartz_chipset.png index ff0acff487..fa7c3b3fc1 100755 Binary files a/buildcraft_resources/assets/buildcraftsilicon/textures/items/chipset/redstone_quartz_chipset.png and b/buildcraft_resources/assets/buildcraftsilicon/textures/items/chipset/redstone_quartz_chipset.png differ diff --git a/buildcraft_resources/assets/buildcraftsilicon/textures/items/chipset/redstone_red_chipset.png b/buildcraft_resources/assets/buildcraftsilicon/textures/items/chipset/redstone_red_chipset.png index d9e69bc81f..b014d727f8 100755 Binary files a/buildcraft_resources/assets/buildcraftsilicon/textures/items/chipset/redstone_red_chipset.png and b/buildcraft_resources/assets/buildcraftsilicon/textures/items/chipset/redstone_red_chipset.png differ diff --git a/buildcraft_resources/assets/buildcraftsilicon/textures/items/package.png b/buildcraft_resources/assets/buildcraftsilicon/textures/items/package.png index efd6c9f6dc..2b514319c0 100644 Binary files a/buildcraft_resources/assets/buildcraftsilicon/textures/items/package.png and b/buildcraft_resources/assets/buildcraftsilicon/textures/items/package.png differ diff --git a/buildcraft_resources/assets/buildcraftsilicon/textures/items/redstoneCrystal.png b/buildcraft_resources/assets/buildcraftsilicon/textures/items/redstoneCrystal.png index fc6531f9bd..0f96a415a2 100755 Binary files a/buildcraft_resources/assets/buildcraftsilicon/textures/items/redstoneCrystal.png and b/buildcraft_resources/assets/buildcraftsilicon/textures/items/redstoneCrystal.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/blocks/filtered_buffer/default.png b/buildcraft_resources/assets/buildcrafttransport/textures/blocks/filtered_buffer/default.png index 624a7d9215..f9e23d4464 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/blocks/filtered_buffer/default.png and b/buildcraft_resources/assets/buildcrafttransport/textures/blocks/filtered_buffer/default.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/blocks/pipes/pipeRobotStationLinked_cb.png b/buildcraft_resources/assets/buildcrafttransport/textures/blocks/pipes/pipeRobotStationLinked_cb.png new file mode 100644 index 0000000000..0b31d458cb Binary files /dev/null and b/buildcraft_resources/assets/buildcrafttransport/textures/blocks/pipes/pipeRobotStationLinked_cb.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/blocks/pipes/pipeRobotStationReserved_cb.png b/buildcraft_resources/assets/buildcrafttransport/textures/blocks/pipes/pipeRobotStationReserved_cb.png new file mode 100644 index 0000000000..a41f2d5517 Binary files /dev/null and b/buildcraft_resources/assets/buildcrafttransport/textures/blocks/pipes/pipeRobotStationReserved_cb.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/blocks/pipes/pipeRobotStation_cb.png b/buildcraft_resources/assets/buildcrafttransport/textures/blocks/pipes/pipeRobotStation_cb.png new file mode 100644 index 0000000000..333ba132f2 Binary files /dev/null and b/buildcraft_resources/assets/buildcrafttransport/textures/blocks/pipes/pipeRobotStation_cb.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/gates/gate_expansion_fader.png b/buildcraft_resources/assets/buildcrafttransport/textures/gates/gate_expansion_fader.png index 9d88689807..150ea383a7 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/gates/gate_expansion_fader.png and b/buildcraft_resources/assets/buildcrafttransport/textures/gates/gate_expansion_fader.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/gates/gate_expansion_light_sensor.png b/buildcraft_resources/assets/buildcrafttransport/textures/gates/gate_expansion_light_sensor.png index 79b6efc414..7059d4e131 100644 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/gates/gate_expansion_light_sensor.png and b/buildcraft_resources/assets/buildcrafttransport/textures/gates/gate_expansion_light_sensor.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/gates/gate_expansion_pulsar.png b/buildcraft_resources/assets/buildcrafttransport/textures/gates/gate_expansion_pulsar.png index b5bc4aa965..41b0c24421 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/gates/gate_expansion_pulsar.png and b/buildcraft_resources/assets/buildcrafttransport/textures/gates/gate_expansion_pulsar.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/gates/gate_expansion_timer.png b/buildcraft_resources/assets/buildcrafttransport/textures/gates/gate_expansion_timer.png index 7d8f6dd9f7..e167bb3f43 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/gates/gate_expansion_timer.png and b/buildcraft_resources/assets/buildcrafttransport/textures/gates/gate_expansion_timer.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/gates/gate_or_dark.png b/buildcraft_resources/assets/buildcrafttransport/textures/gates/gate_or_dark.png index ab78198948..4883203cb1 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/gates/gate_or_dark.png and b/buildcraft_resources/assets/buildcrafttransport/textures/gates/gate_or_dark.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/gates/gate_or_lit.png b/buildcraft_resources/assets/buildcrafttransport/textures/gates/gate_or_lit.png index 087631a822..b4c19c5420 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/gates/gate_or_lit.png and b/buildcraft_resources/assets/buildcrafttransport/textures/gates/gate_or_lit.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/gui/filter.png b/buildcraft_resources/assets/buildcrafttransport/textures/gui/filter.png index 3ba58d1712..d9cb2c0fe6 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/gui/filter.png and b/buildcraft_resources/assets/buildcrafttransport/textures/gui/filter.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/gui/filter_cb.png b/buildcraft_resources/assets/buildcrafttransport/textures/gui/filter_cb.png index f8ca46ab4c..baa7899ac2 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/gui/filter_cb.png and b/buildcraft_resources/assets/buildcrafttransport/textures/gui/filter_cb.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/gui/filter_original.png b/buildcraft_resources/assets/buildcrafttransport/textures/gui/filter_original.png deleted file mode 100755 index 6ea9357115..0000000000 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/gui/filter_original.png and /dev/null differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/gui/filteredBuffer_gui.png b/buildcraft_resources/assets/buildcrafttransport/textures/gui/filteredBuffer_gui.png index ada3525f67..e260ea9df7 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/gui/filteredBuffer_gui.png and b/buildcraft_resources/assets/buildcrafttransport/textures/gui/filteredBuffer_gui.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/gui/gate_interface_1.png b/buildcraft_resources/assets/buildcrafttransport/textures/gui/gate_interface_1.png index 73c8ccf0bf..b293229d54 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/gui/gate_interface_1.png and b/buildcraft_resources/assets/buildcrafttransport/textures/gui/gate_interface_1.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/gui/gate_interface_2.png b/buildcraft_resources/assets/buildcrafttransport/textures/gui/gate_interface_2.png index d7a8bb867b..5f7b27a3a2 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/gui/gate_interface_2.png and b/buildcraft_resources/assets/buildcrafttransport/textures/gui/gate_interface_2.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/gui/gate_interface_3.png b/buildcraft_resources/assets/buildcrafttransport/textures/gui/gate_interface_3.png index 8380253eac..cc68c35b07 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/gui/gate_interface_3.png and b/buildcraft_resources/assets/buildcrafttransport/textures/gui/gate_interface_3.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/gui/gate_interface_4.png b/buildcraft_resources/assets/buildcrafttransport/textures/gui/gate_interface_4.png index 2f82278865..e9b6954f7f 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/gui/gate_interface_4.png and b/buildcraft_resources/assets/buildcrafttransport/textures/gui/gate_interface_4.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/gui/gate_interface_5.png b/buildcraft_resources/assets/buildcrafttransport/textures/gui/gate_interface_5.png index 4c67d6abdc..4b52dffc56 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/gui/gate_interface_5.png and b/buildcraft_resources/assets/buildcrafttransport/textures/gui/gate_interface_5.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/gui/gate_interface_6.png b/buildcraft_resources/assets/buildcrafttransport/textures/gui/gate_interface_6.png index 73a0194373..9ac157304f 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/gui/gate_interface_6.png and b/buildcraft_resources/assets/buildcrafttransport/textures/gui/gate_interface_6.png differ diff --git a/buildcraft_resources/assets/buildcraftcore/textures/gui/icon_button.png b/buildcraft_resources/assets/buildcrafttransport/textures/gui/pipe_emerald_button.png similarity index 100% rename from buildcraft_resources/assets/buildcraftcore/textures/gui/icon_button.png rename to buildcraft_resources/assets/buildcrafttransport/textures/gui/pipe_emerald_button.png diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/gui/pipe_emzuli.png b/buildcraft_resources/assets/buildcrafttransport/textures/gui/pipe_emzuli.png index 7b17dc8071..836a7b8cd8 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/gui/pipe_emzuli.png and b/buildcraft_resources/assets/buildcrafttransport/textures/gui/pipe_emzuli.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/items/gateCopier/empty.png b/buildcraft_resources/assets/buildcrafttransport/textures/items/gateCopier/empty.png index 8f41b50218..fd5e985828 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/items/gateCopier/empty.png and b/buildcraft_resources/assets/buildcrafttransport/textures/items/gateCopier/empty.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/items/gateCopier/full.png b/buildcraft_resources/assets/buildcrafttransport/textures/items/gateCopier/full.png index b80fa3e8d9..9e02610baa 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/items/gateCopier/full.png and b/buildcraft_resources/assets/buildcrafttransport/textures/items/gateCopier/full.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_expansion_clock.png b/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_expansion_clock.png index c1896f278e..b0d6fd4703 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_expansion_clock.png and b/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_expansion_clock.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_expansion_fader.png b/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_expansion_fader.png index b931de4b06..4a1e712c5a 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_expansion_fader.png and b/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_expansion_fader.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_expansion_light_sensor.png b/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_expansion_light_sensor.png index 6cfb6935b6..5c6a4eff7d 100644 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_expansion_light_sensor.png and b/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_expansion_light_sensor.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_expansion_pulsar.png b/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_expansion_pulsar.png index a6c17a7c17..aa68e716f0 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_expansion_pulsar.png and b/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_expansion_pulsar.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_expansion_timer.png b/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_expansion_timer.png index 679437721b..116e594fe7 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_expansion_timer.png and b/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_expansion_timer.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_logic_and.png b/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_logic_and.png index e1913fa86f..9919c08bdf 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_logic_and.png and b/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_logic_and.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_logic_or.png b/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_logic_or.png index 5484f21098..045a60efb8 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_logic_or.png and b/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_logic_or.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_material_diamond.png b/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_material_diamond.png index ff4473e6af..c1635859ed 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_material_diamond.png and b/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_material_diamond.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_material_emerald.png b/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_material_emerald.png index eb313c5c8a..d81210adeb 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_material_emerald.png and b/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_material_emerald.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_material_gold.png b/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_material_gold.png index 39a78bcf65..fcde36b5d8 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_material_gold.png and b/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_material_gold.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_material_iron.png b/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_material_iron.png index abd941125f..4523607baa 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_material_iron.png and b/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_material_iron.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_material_quartz.png b/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_material_quartz.png index efedd6e024..ced9f18998 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_material_quartz.png and b/buildcraft_resources/assets/buildcrafttransport/textures/items/gates/gate_material_quartz.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/items/lens/filterFrame.png b/buildcraft_resources/assets/buildcrafttransport/textures/items/lens/filterFrame.png index 82e7c657ed..dcd6984120 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/items/lens/filterFrame.png and b/buildcraft_resources/assets/buildcrafttransport/textures/items/lens/filterFrame.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/items/lens/lensFrame.png b/buildcraft_resources/assets/buildcrafttransport/textures/items/lens/lensFrame.png index 3f37533a21..004249e076 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/items/lens/lensFrame.png and b/buildcraft_resources/assets/buildcrafttransport/textures/items/lens/lensFrame.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/items/lens/transparent.png b/buildcraft_resources/assets/buildcrafttransport/textures/items/lens/transparent.png index 166d12485f..e6f4212c65 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/items/lens/transparent.png and b/buildcraft_resources/assets/buildcrafttransport/textures/items/lens/transparent.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/items/pipePowerAdapter.png b/buildcraft_resources/assets/buildcrafttransport/textures/items/pipePowerAdapter.png new file mode 100644 index 0000000000..5b1d90af6b Binary files /dev/null and b/buildcraft_resources/assets/buildcrafttransport/textures/items/pipePowerAdapter.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/items/pipeWire/blue.png b/buildcraft_resources/assets/buildcrafttransport/textures/items/pipeWire/blue.png index d8bb50b36e..c72fed91f1 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/items/pipeWire/blue.png and b/buildcraft_resources/assets/buildcrafttransport/textures/items/pipeWire/blue.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/items/pipeWire/green.png b/buildcraft_resources/assets/buildcrafttransport/textures/items/pipeWire/green.png index be5061884d..d926440dfa 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/items/pipeWire/green.png and b/buildcraft_resources/assets/buildcrafttransport/textures/items/pipeWire/green.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/items/pipeWire/red.png b/buildcraft_resources/assets/buildcrafttransport/textures/items/pipeWire/red.png index 4b56d3ccda..05d8a59214 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/items/pipeWire/red.png and b/buildcraft_resources/assets/buildcrafttransport/textures/items/pipeWire/red.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/items/pipeWire/yellow.png b/buildcraft_resources/assets/buildcrafttransport/textures/items/pipeWire/yellow.png index 34f88d2ea0..0c824f2896 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/items/pipeWire/yellow.png and b/buildcraft_resources/assets/buildcrafttransport/textures/items/pipeWire/yellow.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/cobblestone_power.png b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/cobblestone_power.png index b5dcbb1598..eda7131e7a 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/cobblestone_power.png and b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/cobblestone_power.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/cobblestone_structure.png b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/cobblestone_structure.png index 2ea41dd850..846936bcf9 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/cobblestone_structure.png and b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/cobblestone_structure.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/filter.png b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/filter.png index aeb0cb7621..ab2fae2b78 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/filter.png and b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/filter.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/iron_power_m128.png b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/iron_power_m128.png index 1ee0ae7d07..cd7f535a40 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/iron_power_m128.png and b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/iron_power_m128.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/iron_power_m16.png b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/iron_power_m16.png index 48eb74f06a..abee040766 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/iron_power_m16.png and b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/iron_power_m16.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/iron_power_m2.png b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/iron_power_m2.png index 46e9b14110..99f418a548 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/iron_power_m2.png and b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/iron_power_m2.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/iron_power_m32.png b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/iron_power_m32.png index 1fe6e664e2..a570349101 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/iron_power_m32.png and b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/iron_power_m32.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/iron_power_m4.png b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/iron_power_m4.png index d824641033..4a24f9ec94 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/iron_power_m4.png and b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/iron_power_m4.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/iron_power_m64.png b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/iron_power_m64.png index 62e69be9e7..2404770e7d 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/iron_power_m64.png and b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/iron_power_m64.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/iron_power_m8.png b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/iron_power_m8.png index 73cebc5b53..0ab19acd8e 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/iron_power_m8.png and b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/iron_power_m8.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/lens.png b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/lens.png index b7c64104e1..ff420dcf61 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/lens.png and b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/lens.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/overlay_lens.png b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/overlay_lens.png index 21b8ed230b..c21ee7e90a 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/overlay_lens.png and b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/overlay_lens.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/overlay_stained.png b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/overlay_stained.png index 3c536afbe8..18f87e9b63 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/overlay_stained.png and b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/overlay_stained.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/pipePowerAdapterBottom.png b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/pipePowerAdapterBottom.png index c124a786c5..50b97c7abf 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/pipePowerAdapterBottom.png and b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/pipePowerAdapterBottom.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/pipePowerAdapterSide.png b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/pipePowerAdapterSide.png index 2d0382e7b8..94273232b8 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/pipePowerAdapterSide.png and b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/pipePowerAdapterSide.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/pipePowerAdapterTop.png b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/pipePowerAdapterTop.png old mode 100755 new mode 100644 index 912b10fd11..d23c0ef4e1 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/pipePowerAdapterTop.png and b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/pipePowerAdapterTop.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/plug.png b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/plug.png index 7676bfe22e..c97d14bca5 100644 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/plug.png and b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/plug.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/quartz_power.png b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/quartz_power.png index fad03aaa4e..3d277f7cd6 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/quartz_power.png and b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/quartz_power.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/robot_station.png b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/robot_station.png index ac4f68483d..2d86f22746 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/robot_station.png and b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/robot_station.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/robot_station_base.png b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/robot_station_base.png index f4cc20904d..ca63f57013 100644 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/robot_station_base.png and b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/robot_station_base.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/robot_station_linked.png b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/robot_station_linked.png index fce8a899b4..4ffa9ce1fc 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/robot_station_linked.png and b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/robot_station_linked.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/robot_station_reserved.png b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/robot_station_reserved.png index 86a42a8000..a7653e1843 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/robot_station_reserved.png and b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/robot_station_reserved.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/sandstone_power.png b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/sandstone_power.png index 44a8200e46..c7ddae4844 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/pipes/sandstone_power.png and b/buildcraft_resources/assets/buildcrafttransport/textures/pipes/sandstone_power.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/action_pulsar.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/action_pulsar.png index 430b2be022..37297b132c 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/action_pulsar.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/action_pulsar.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/action_single_pulsar.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/action_single_pulsar.png index 077a84c004..ba30efdd61 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/action_single_pulsar.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/action_single_pulsar.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/action_valve_closed.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/action_valve_closed.png index 4fcc39c3d9..fef473cd83 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/action_valve_closed.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/action_valve_closed.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/action_valve_input_only.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/action_valve_input_only.png index 159ddca69b..cc9ae2a9d8 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/action_valve_input_only.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/action_valve_input_only.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/action_valve_open.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/action_valve_open.png index 7e9ae76410..49b0335f53 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/action_valve_open.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/action_valve_open.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/action_valve_output_only.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/action_valve_output_only.png index 84a40be3f3..56b2a152e2 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/action_valve_output_only.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/action_valve_output_only.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/extraction_preset_blue.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/extraction_preset_blue.png index b6d3d2e62f..235619a67a 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/extraction_preset_blue.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/extraction_preset_blue.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/extraction_preset_green.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/extraction_preset_green.png index 59452f3367..570a177a28 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/extraction_preset_green.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/extraction_preset_green.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/extraction_preset_red.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/extraction_preset_red.png index 2f33b49d78..97a2403ad2 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/extraction_preset_red.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/extraction_preset_red.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/extraction_preset_yellow.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/extraction_preset_yellow.png index 2993afc3ea..cb98843277 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/extraction_preset_yellow.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/extraction_preset_yellow.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/guitriggers_3_4.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/guitriggers_3_4.png index 801f6d59b2..6bd1a113f7 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/guitriggers_3_4.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/guitriggers_3_4.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_01.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_01.png index d54d8e8b9a..d86ce5ec4c 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_01.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_01.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_02.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_02.png index 9b15200f9c..161342e33d 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_02.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_02.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_03.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_03.png index d5f7020f35..bb49b6e38c 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_03.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_03.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_04.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_04.png index 80fbd3df07..d7656bd4af 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_04.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_04.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_05.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_05.png index a93d689fe0..bb0d9e3ddd 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_05.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_05.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_06.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_06.png index a7eeaf54ee..cca0490ae7 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_06.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_06.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_07.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_07.png index 9b50304729..24a4b7477d 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_07.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_07.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_08.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_08.png index 6da8f3cedf..a257da0472 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_08.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_08.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_09.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_09.png index a9c208787c..a6585a6830 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_09.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_09.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_10.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_10.png index 403ffa72ca..879acce0f3 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_10.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_10.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_11.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_11.png index 4175abd3aa..36fc3ef727 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_11.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_11.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_12.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_12.png index f26bc0e53d..020f989ceb 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_12.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_12.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_13.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_13.png index 3e5de5ae23..e172b9e6a2 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_13.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_13.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_14.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_14.png index ec5f9f37bb..b6f80d5b9b 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_14.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_14.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_15.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_15.png index 69a9ff2ba8..1a5ba402a8 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_15.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/redstone_15.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_light_bright.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_light_bright.png index 0746c7b85e..2a1bfa684a 100644 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_light_bright.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_light_bright.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_light_dark.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_light_dark.png index ae7391c854..24b8942a52 100644 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_light_dark.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_light_dark.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_limiter_m128.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_limiter_m128.png index a49f62ed42..bf4f5e8b87 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_limiter_m128.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_limiter_m128.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_limiter_m16.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_limiter_m16.png index 99f505ca75..fc03730237 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_limiter_m16.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_limiter_m16.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_limiter_m2.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_limiter_m2.png index 491ee80569..a24e5611d9 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_limiter_m2.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_limiter_m2.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_limiter_m32.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_limiter_m32.png index b953c1d86b..ca31a114d6 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_limiter_m32.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_limiter_m32.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_limiter_m4.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_limiter_m4.png index b733285078..370b731813 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_limiter_m4.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_limiter_m4.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_limiter_m64.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_limiter_m64.png index df47e8bc31..dacee53473 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_limiter_m64.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_limiter_m64.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_limiter_m8.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_limiter_m8.png index cc12d580b0..8fb03d4981 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_limiter_m8.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_limiter_m8.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipecontents_containsenergy.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipecontents_containsenergy.png index cd7b7d48c1..fad7e8bb0d 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipecontents_containsenergy.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipecontents_containsenergy.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipecontents_containsfluids.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipecontents_containsfluids.png index 2f75f2735c..9b4ec752a6 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipecontents_containsfluids.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipecontents_containsfluids.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipecontents_containsitems.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipecontents_containsitems.png index b509fb7860..6206512a8f 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipecontents_containsitems.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipecontents_containsitems.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipecontents_empty.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipecontents_empty.png index 17834f6bbe..ed620e8a98 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipecontents_empty.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipecontents_empty.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipecontents_requestsenergy.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipecontents_requestsenergy.png index 13ee5e4316..7aca6e1184 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipecontents_requestsenergy.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipecontents_requestsenergy.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipecontents_toomuchenergy.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipecontents_toomuchenergy.png index e4468e0ef6..d30836d044 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipecontents_toomuchenergy.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipecontents_toomuchenergy.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipesignal_blue_active.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipesignal_blue_active.png index e94f5af72a..8ff6e01bf3 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipesignal_blue_active.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipesignal_blue_active.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipesignal_blue_inactive.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipesignal_blue_inactive.png index 3517457486..5c964ece0f 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipesignal_blue_inactive.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipesignal_blue_inactive.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipesignal_green_active.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipesignal_green_active.png index 7421af87bb..8c45c4c3f6 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipesignal_green_active.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipesignal_green_active.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipesignal_green_inactive.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipesignal_green_inactive.png index 519f122ed9..7026ce98f5 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipesignal_green_inactive.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipesignal_green_inactive.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipesignal_yellow_active.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipesignal_yellow_active.png index 1c461a4392..f4c1893f9f 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipesignal_yellow_active.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipesignal_yellow_active.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipesignal_yellow_inactive.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipesignal_yellow_inactive.png index f099ed6b72..8ab9eb4fd6 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipesignal_yellow_inactive.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_pipesignal_yellow_inactive.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_timer_long.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_timer_long.png index 9f891d833f..8d06578691 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_timer_long.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_timer_long.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_timer_medium.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_timer_medium.png index 57d681261f..6b84a7eeca 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_timer_medium.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_timer_medium.png differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_timer_short.png b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_timer_short.png index 819630e4fc..b6c0a7b35a 100755 Binary files a/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_timer_short.png and b/buildcraft_resources/assets/buildcrafttransport/textures/triggers/trigger_timer_short.png differ diff --git a/buildcraft_resources/changelog/7.0.10 b/buildcraft_resources/changelog/7.0.10 new file mode 100644 index 0000000000..6cedb113bf --- /dev/null +++ b/buildcraft_resources/changelog/7.0.10 @@ -0,0 +1,23 @@ +Additions: + +* New filler parameters: Hollow for Cylinders, Center for Pyramids and Direction for Stairs (asie) +* Support for inventory Minecarts in the obsidian pipe - partially a bugfix (asie) + +Improvements: + +* Builders now show the amount of required items up to 99K instead of 999 (asie) +* Optimizations to Builder/Filler code (asie) +* Tweaks to water spring generation (asie) + +Bugs fixed: + +* [#2801] Internal server crash on certain pipe removal cases (asie) +* [#2800, others] Fluid pipe network sync (this time hopefully for real) (asie) +* [#2799] Cauldron crash on server startup (asie) +* [#2798] Crashing when rightclickling with wrench (asie) +* [#2796] Invalid height for stairs in Filler (asie) +* [#2792] Obsidian pipes not using up energy for items (asie) +* Fix buckets in stripes pipes not working with custom air blocks (asie) +* Fix filler pattern icon render in gates (asie) +* Fix stripes pipes eating unplaced blocks in a large stack (asie) +* Fix tooltip rendering in filler GUI (asie) diff --git a/buildcraft_resources/changelog/7.0.11 b/buildcraft_resources/changelog/7.0.11 new file mode 100644 index 0000000000..c3b4cbc227 --- /dev/null +++ b/buildcraft_resources/changelog/7.0.11 @@ -0,0 +1,12 @@ +Additions: + +* Excavation toggle in the Filler! Finally! (asie) + +Improvements: + +* Color correction in colorblind diamond pipe GUI for easier color distinction (asie - with input from BevoLJ) +* Tooltips in Emerald Transport Pipe (asie) + +Bugs fixed: + +* Crash in rotateLeft (asie) diff --git a/buildcraft_resources/changelog/7.0.12 b/buildcraft_resources/changelog/7.0.12 new file mode 100644 index 0000000000..254062659a --- /dev/null +++ b/buildcraft_resources/changelog/7.0.12 @@ -0,0 +1,22 @@ +Additions: + +* [#2819] Leather/dyed helmet support on robots (asie) +* Make mining robots work with GregTech ores (zmaster587, asie) +* Robots can now be filtered in Force/Forbid by wearable, not just by type (asie) + +Improvements: + +* Rendering helmet overlays on robots is now supported (hea3ven) +* The Accept Items action now supports Lists (asie) +* The builder robot will not pick up materials in creative worlds (hea3ven) + +Bugs fixed: + +* [#2833] Stained Glass Panes in schematics always white (asie) +* [#2828] Filler crash without Transport (asie) +* [#2822] Stamper eats items that should not used up (asie) +* [#2820] CME in map generation (asie) +* Fix planter robots not freeing reserved blocks (hea3ven) +* NPE in Builder robot (hea3ven) +* Zone planner maps not generating (asie) + diff --git a/buildcraft_resources/changelog/7.0.13 b/buildcraft_resources/changelog/7.0.13 new file mode 100644 index 0000000000..72219a6574 --- /dev/null +++ b/buildcraft_resources/changelog/7.0.13 @@ -0,0 +1,14 @@ +Improvements: + +* [#2846] Make Blueprints removable from Construction Markers (asie) +* Code optimizations (asie) + +Bugs fixed: + +* [#2852] Diamond fluid pipes not sorting into unfiltered slots (asie) +* [#2850] Random ArrayIndexOutOfBoundException (asie - not a true fix, it will however give you a console warning if this is caught again; it's very rare) +* [#2849] Graphical Glitch on Assembly Table when using Texture Packs (asie) +* [#2842] Various fixes to robot state saving (hea3ven) +* [#2835] Robot helmet overlay rendering incorrectly (hea3ven) +* [#2753] Remove unused slot from Packager (asie) +* Crashes in item pipe packet sending (asie) diff --git a/buildcraft_resources/changelog/7.0.14 b/buildcraft_resources/changelog/7.0.14 new file mode 100644 index 0000000000..034c73a6ca --- /dev/null +++ b/buildcraft_resources/changelog/7.0.14 @@ -0,0 +1,19 @@ +Improvements: + +* Quarries now dig through light fluids and stop on dense fluids. Behaviour might change later, so watch out! (asie) + +Bugs fixed: + +* [#2880] Try to fix fluid pipe bug (asie) +* [#2878] Robot NPE for robots prior to 7.0.13 fix (asie) +* [#2877] Survival blueprint crash (asie) +* [#2841] Another crash with Oil in the Nether (asie) +* [#2837] Massive lag with Construction Markers (hea3ven) +* [#2831] Robots sinking through the ground (hea3ven) +* [#2825, #2618, #1777] Quarry issues with just about every translucent block (asie) +* Allow Builders to use arbitrary IPathProviders (asie) +* Block breaking robots sleeping in mid air (hea3ven) +* Error in robot AI loading (hea3ven) +* Incorrect Request Needed Items action name (asie) +* Packages crashing Minecraft if mods are removed (asie) +* Robots ignoring gate config on their linked station when equipping items (hea3ven) diff --git a/buildcraft_resources/changelog/7.0.15 b/buildcraft_resources/changelog/7.0.15 new file mode 100644 index 0000000000..c0b60ba98d --- /dev/null +++ b/buildcraft_resources/changelog/7.0.15 @@ -0,0 +1,5 @@ +Bugs fixed: + +* [#2883] Pipe Empty/Fluid Traversing not working on fluid pipes (asie) +* [#2882] **Massive Recipe Packager dupe bug** (asie) +* Packager GUI issues on shift-click (asie) diff --git a/buildcraft_resources/changelog/7.0.16 b/buildcraft_resources/changelog/7.0.16 new file mode 100644 index 0000000000..59ba08a44e --- /dev/null +++ b/buildcraft_resources/changelog/7.0.16 @@ -0,0 +1,10 @@ +Bugs fixed: + +* [#2890] Integration Table messy extraction behaviour (asie) +* [#2889] Fix robots movement desync when going through fluids (hea3ven) +* Fix potential crash with invalid recipe in Stamping Table (asie) +* Fix the work in area and load/unload area allowing non map locations items as parameters (hea3ven) +* Fluid pipe behaviour regression (asie) +* Integrated hollow facade becoming non-hollow (asie) +* Rotating pipe orientation not working well in blueprints (asie) +* Void fluid pipe having wrong colours (asie) diff --git a/buildcraft_resources/changelog/7.0.17 b/buildcraft_resources/changelog/7.0.17 new file mode 100644 index 0000000000..9fb472f935 --- /dev/null +++ b/buildcraft_resources/changelog/7.0.17 @@ -0,0 +1,16 @@ +Improvements: + +* Packages can now be thrown via Dispensers and Stripes Pipes (asie) + +Bugs fixed: + +* [#2904] Crash on corrupt facade (asie) +* [#2892] Disconnect on large-resolution Zone Planner fullscreen (asie) +* [#2891] Boxes ignoring the south and east boundaries when rounding (hea3ven) +* Accidentally setting an area in the Zone Planner GUI upon pressing fullscreen (asie) +* Compact Lens->Filter "diodes" not acting correctly (asie) +* Gate Copiers not clearing correctly (asie) +* Paintbrush not being re-dyeable if not fully used (asie) +* Robots going to unreachable stations passing through walls (hea3ven) +* Stripes Pipe "breaking" fluid blocks (asie) +* Wrench failing to rotate double chests and beds (asie) diff --git a/buildcraft_resources/changelog/7.0.18 b/buildcraft_resources/changelog/7.0.18 new file mode 100644 index 0000000000..1ff64ef230 --- /dev/null +++ b/buildcraft_resources/changelog/7.0.18 @@ -0,0 +1,18 @@ +Improvements: + +* [#2941] Knights and Butchers now respect all your fancy sword enchantments, knockbacks and damage modifiers. Woo! (asie) +* [#2926] Fluid pipes are now extra glowy (asie) + +Bugs fixed: + +* [#2942] Autarchic Gates not reacting to short pulses on Single Energy Pulse mode (asie) +* [#2935, attempted] Programming Table robot board mixups (asie) +* [#2929] Builders unable to place liquid in survival mode (asie) +* [#2921] Architect Table's defined area box not visible >64 blocks (ganymedes01) +* [#2914] Advanced Crafting Table excess tick times in certain circumstances (asie) +* [#2898] Robot crash on chunk unload/reload (hea3ven) +* [#2862] Pipe name not displaying in WAILA (asie) +* Fluid tanks rendering incorrectly in Builder (asie) +* Knight/Butcher not emitting Forge attack events (asie) +* Restoring robot block breaking state could fail (hea3ven) +* Stripes pipes placing extra blocks, and the behaviour of the stripes robot placing blocks (hea3ven) diff --git a/buildcraft_resources/changelog/7.0.19 b/buildcraft_resources/changelog/7.0.19 new file mode 100644 index 0000000000..34ef5837d1 --- /dev/null +++ b/buildcraft_resources/changelog/7.0.19 @@ -0,0 +1,3 @@ +Bugs fixed: + +* Quarry/Mining Well no longer connecting to front for some users O_O (asie) diff --git a/buildcraft_resources/changelog/7.0.20 b/buildcraft_resources/changelog/7.0.20 new file mode 100644 index 0000000000..665f8e1a48 --- /dev/null +++ b/buildcraft_resources/changelog/7.0.20 @@ -0,0 +1,6 @@ +Bugs fixed: + +* Creative Only blueprints partially working in Survival worlds (asie) +* Incorrect behaviour with Forestry/RailCraft engines (asie - workaround, actually bug on their side) +* Logistics Pipes VerifyError crash (asie) +* Overly dark water with non-sky lighting (asie) diff --git a/buildcraft_resources/changelog/7.0.21 b/buildcraft_resources/changelog/7.0.21 new file mode 100644 index 0000000000..66bfbb44c2 --- /dev/null +++ b/buildcraft_resources/changelog/7.0.21 @@ -0,0 +1,13 @@ +Backported from 7.1: + +* Blueprint Library GUI improvements (asie) +* Clay fluid pipe (asie) +* Fluid pipe capacity scaling with fluidMultiplier (asie) +* Zone Planner improvements (dynamic texture, zooming in) (asie) + +Bugs fixed: + +* [#2939] Quarry makes server crash when used and chunkloading is off in some cases (asie) +* Builder inconsistently respecting OreDict (knexer) +* ClassCastException when trying to plant reeds (hea3ven) +* Random minor crashes (asie) diff --git a/buildcraft_resources/changelog/7.0.22 b/buildcraft_resources/changelog/7.0.22 new file mode 100644 index 0000000000..d70e601029 --- /dev/null +++ b/buildcraft_resources/changelog/7.0.22 @@ -0,0 +1,14 @@ +Bugs fixed: + +* [#3000] Robots only charge to 20% when "go to home" is true (hea3ven, asie) +* [#2996] DockingStationPipe crash (asie) +* [#2994] Dupe with just about anything that mines (asie) +* [#2991] Carrier robots ignoring Provide Items filters (asie) +* [#2984] List sorting crash with flowers (asie) +* [#2978] Programming Table refusing to work after item removal (asie) +* [#2977, #2526] Assembly Table voiding excess energy (just made it not void it after all) (asie) +* [#2976] Builder dupes (asie) +* [#2974] Single Energy Pulse fix makes things worse - revert to previous code (asie) +* [#2971] Stamping Table overflow on multiple-output items (asie) +* [#2969] Crash when Silicon present without Transport (asie) +* [#2964] Fluid/laser textures breaking on texture pack change (asie) diff --git a/buildcraft_resources/changelog/7.0.23 b/buildcraft_resources/changelog/7.0.23 new file mode 100644 index 0000000000..412856d849 --- /dev/null +++ b/buildcraft_resources/changelog/7.0.23 @@ -0,0 +1,20 @@ +Improvements: + +* Rewritten robots request system (hea3ven) + * Changed the IRequestProvider api to be independent of robots. + * Delivery robots can now carry more than an item at a time. + * Builders, requesters and docking stations can now request more than one item at a time. +* Architect Tables are less server-intensive now (asie) +* More Ore Dictionary support for recipes (Adaptivity) +* Proper Docking Station renderer (asie) + +Bugs fixed: + +* [#3008] Rare crash on strange Minecraft world in MapChunk (asie) +* [#3007] "Energy Stored" trigger has incorrect behaviour (asie) +* [#3001] NPE in RobotStationPluggableRenderer (asie) +* [#2922, #2975] Composite blueprints not working (asie) +* [#2565] Fillers not liking certain blocks (asie) +* Fillers and Builders not dropping item on inability to place (asie) +* Quarry arm jitter on client side (asie) +* Robots not using the correct sides when accessing inventories/tanks (hea3ven) diff --git a/buildcraft_resources/changelog/7.0.26 b/buildcraft_resources/changelog/7.0.26 new file mode 100644 index 0000000000..7eaa86b72e --- /dev/null +++ b/buildcraft_resources/changelog/7.0.26 @@ -0,0 +1,10 @@ +Improvements: + +* [#3039] Slight item insertion optimization (Speiger) +* Improved power transmission logic (asie) + +Bugs fixed: + +* [#3041] GUI crash with Robot gate parameters (asie) +* [#3038] Server crash on corrupt BC map loading (asie) +* [#3035] Builder GUI crash (asie) diff --git a/buildcraft_resources/changelog/7.0.6 b/buildcraft_resources/changelog/7.0.6 index 58992b84b0..5d69fe3d53 100644 --- a/buildcraft_resources/changelog/7.0.6 +++ b/buildcraft_resources/changelog/7.0.6 @@ -2,11 +2,42 @@ Additions: * [#2692] Restore config option to make filler/builder drop blocks (hea3ven) * [#2709] Add a loop mode to the quarry (hea3ven) +* Robots start with a small amount of energy after being programmed (hea3ven) +* Add colorblind textures for the docking stations (hea3ven) +* The light sensor now has textures and is thus fully usable! (hea3ven) +* Container item support for the Stamping Table (asie) +* Packagers only allow items relevant to the recipe to be inserted (asie) +* Builders now light up when working (asie) +* Add the ability to scroll through the parameters of the Forbid/Force robot (hea3ven) + +Improvements: + +* LEDs and filler pattern icons now use TESRs for less refresh lag (asie) +* Pipes have been color-corrected (asie) +* Pipes now have better insides shading/depth (asie) +* Diamond pipes can now keep track of multiple round-robin sorts at the same time (asie) +* Charging table texture fixed to not be brighter than the rest (asie) +* Lists are now more expensive - though the "improvement" of this is debatable (asie) + +Removals: + +* Lava in Combustion Engine. Use the Stirling Engine (asie) +* Flower handling for harvesters. Caused bugs (hea3ven) +>>>>>>> origin/7.1.x Bugs fixed: +* [#2746] Fix invalid random number generation code (asie) +* [#2741] Fix the rendering of helmets on robots (hea3ven) * [#2730] Fix integration table using energy when it has an invalid recipe (hea3ven) * [#2694] Fix client/server desync on the gate copier item (hea3ven) * Fix gate expansion recipe ignoring the input's stack size (hea3ven) * Fix planters dropping items in stead of planting (hea3ven) +* Fix laser block texture (asie) * Use the OreDict for the pipes recipes (ganymedes01) +* Fix robots not keeping their energy when being reprogrammed (hea3ven) +* Fix the builder robot not respecting the working area (hea3ven) +* Fix some robots not going to sleep if they fail to equip items (hea3ven) +* Fix rendering issues with pipe contents after a texture reload (asie) +* Fix crash upon new config file generation (asie) +* Fix picker robot hanging on unreachable items (hea3ven) diff --git a/buildcraft_resources/changelog/7.0.7 b/buildcraft_resources/changelog/7.0.7 new file mode 100644 index 0000000000..dee3b42709 --- /dev/null +++ b/buildcraft_resources/changelog/7.0.7 @@ -0,0 +1,10 @@ +Bugs fixed: + +* [#2762] Invalid hover text offset (asie) +* [#2758] Connection issues with Big Reactors (asie) +* [#2755] Stacked robots charging require the same amount of energy as a single robot (asie) +* [#2754] Putting a cake package into a stamper only returns 1 milk bucket instead of 3 (asie) +* [#2752] Emerald fluid pipe has no GUI texture (asie) +* [#2751] Race condition between block breaking and placing causes client-side render glitch (asie) +* Fixed Mining Well not rotating in Builder (asie) +* Fixed diamond fluid pipe texture colour (asie) diff --git a/buildcraft_resources/changelog/7.0.8 b/buildcraft_resources/changelog/7.0.8 new file mode 100644 index 0000000000..68b91f4ee8 --- /dev/null +++ b/buildcraft_resources/changelog/7.0.8 @@ -0,0 +1,3 @@ +Bugs fixed: + +* Fix compatibility with BC 7.0.x addons (asie) diff --git a/buildcraft_resources/changelog/7.0.9 b/buildcraft_resources/changelog/7.0.9 new file mode 100644 index 0000000000..4811a4374a --- /dev/null +++ b/buildcraft_resources/changelog/7.0.9 @@ -0,0 +1,25 @@ +Additions: + +* Robots can now wear player and mob heads! (hea3ven) + +Improvements: + +* Power pipe rendering is slightly less laggy. (asie) +* Shift-right-clicking with a wrench removes wearables first. (hea3ven) +* Wrenching an iron/wood/etc. pipe sets it to the direction you hit in. (asie) +* Auto Workbenches only accept recipe-relevant items again. (asie) +* Add OreDictionary IDs for chipsets (asie) + +Bug fixes: + +* [#2785] Water springs do not generate correctly (asie - thanks a lot SpwnX) +* [#2782] CME in EntityTracker (asie) +* [#2781] Crash with RailCraft rails and BC tanks (asie) +* [#2770] Mojang's ambient occlusion assumes full blocks (asie) +* [#2765] CME with PacketSender (asie) +* [#2743] DockingStationPipes kept track of invalid pipes (asie) +* Fix crash in MapRegion (asie) +* Fix fluid pipe synchronization (again) (asie) +* Fix handling of template extensions length != 3 (Sangar) +* Fix Java 6 compatibility (asie) +* Improve compatibility with Logistics Pipes (asie) diff --git a/buildcraft_resources/changelog/7.1.0 b/buildcraft_resources/changelog/7.1.0 new file mode 100644 index 0000000000..f94b49d83f --- /dev/null +++ b/buildcraft_resources/changelog/7.1.0 @@ -0,0 +1,47 @@ +BREAKING CHANGES! + +* Cobblestone Structure Pipes have a new recipe. (asie) +* Quartz Fluid Pipes no longer connect to Cobblestone or Stone Fluid Pipes. This might break existing builds! (asie) + +Additions: + +* Core: + * New Lists! (asie) + * Sort by type, material, or both! Precise sorting! + * See with a tooltip if an item matches the List! +* Transport: + * Clay fluid pipe! The power of insertion applied to liquids. (asie) + * Power Adapters! Connect Kinesis Pipes to non-Kinesis pipes. (asie) + +Improvements: + +* Core/Any: + * Use integrated server data in singleplayer for certain tiles - back to the smoothness of 1.2.5! (asie) + * Minor optimizations (asie, gamerForEA) +* Builders: + * New blueprint library GUI, now featuring a scrollbar! (asie) +* Factory: + * Chutes now support the Comparator (asie) + * Less lag on Tank updating - new comparator update system (asie) +* Robotics: + * Rewritten robots request system (hea3ven) + * Changed the IRequestProvider api to be independent of robots. + * Delivery robots can now carry more than an item at a time. + * Builders, requesters and docking stations can now request more than one item at a time. + * Zone Planners now have a dynamic texture (asie) + * Requesters now support the Comparator (asie) + * Add events for robot interaction and removal (asie) + * Fix robots not using the correct sides when accessing inventories/tanks (hea3ven) + * Fix loading break ai from nbt (hea3ven) +* Transport: + * Filtered Buffers now support the Comparator (asie) + * Lenses do not require Iron Ingots anymore (asie) + * New power beam display algorithm (asie) + * Rewritten pipe wires - should now propagate more or less instantly. (asie) + * Debugger support for fluid pipes (asie) + * Fluid pipe capacity and extraction rate now scales with the base flow multiplier. (asie) + +Bugs fixed: + +* "Lens-Filter" diodes not working (asie) +* Make Docking Station items look like the real thing (asie) diff --git a/buildcraft_resources/changelog/7.1.1 b/buildcraft_resources/changelog/7.1.1 new file mode 100644 index 0000000000..369420d984 --- /dev/null +++ b/buildcraft_resources/changelog/7.1.1 @@ -0,0 +1,19 @@ +Improvements: + +* [#2345] Finish adding command localization (asie, warlordjones) +* Builders are a bit smarter now (asie) +* 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) + * Support for sorting armor and tools by type (asie) +* Robots can now be destroyed via swords and projectiles (asie) +* Zone Planner GUIs now support zooming in (asie) + +Bugs fixed: + +* [#2948] Precise damage checking not working (asie) +* [#2925] Rails on gravel not placing correctly (asie) +* Force/Forbid Robot statements not accepting lists (asie) +* Hovering over slot causing incorrect item lighting (asie) +* Tweaks to lens/filter behaviour to stop a pretty odd "lens/filter diode" bug (asie) diff --git a/buildcraft_resources/changelog/7.1.10 b/buildcraft_resources/changelog/7.1.10 new file mode 100644 index 0000000000..1ae57f8f33 --- /dev/null +++ b/buildcraft_resources/changelog/7.1.10 @@ -0,0 +1,9 @@ +Bugs fixed: + +* [#3072] PipeTransportFluids crash (proper fix) (asie) +* [#3071] Filled cylinder pattern incorrect (asie) +* [#3069, #2865] Fluid pipe extraction speed ~25% lower than intended (asie, mconwa01) +* Filler not changing pattern on parameter change (asie) +* Improvements to robot pathfinding logic (asie, hea3ven) +* Incorrect CoFHAPIProps RF API version (asie) +* Rotated quarry not detecting its own frame (asie) diff --git a/buildcraft_resources/changelog/7.1.11 b/buildcraft_resources/changelog/7.1.11 new file mode 100644 index 0000000000..a997486ef0 --- /dev/null +++ b/buildcraft_resources/changelog/7.1.11 @@ -0,0 +1,6 @@ +Bugs fixed: + +* [#3079] Emzuli pipe's round-robin extraction behaving incorrectly (asie) +* [#3075] Rare crash in AIRobotGoAndLinkToDock (asie) +* Robot pathfinding using 100% CPU on fast CPUs (asie) +* Robots flying up due to bugs in "un-stuck" code (asie) diff --git a/buildcraft_resources/changelog/7.1.12 b/buildcraft_resources/changelog/7.1.12 new file mode 100644 index 0000000000..b9683c8d5d --- /dev/null +++ b/buildcraft_resources/changelog/7.1.12 @@ -0,0 +1,19 @@ +Improvements: + +* [#3088] Miner Robots now support enchantments correctly. (asie) +* Robots ignore broken tools and unload them when they break - think Tinkers' Construct here. (asie) +* Stained Glass Pipe recipes now support ore dictionary colored glass. (asie) + +Removals: + +* Pre-1.5 Auto Workbench loading code. (asie) + +Bugs fixed: + +* [#3092, #3087, #3085] Robot unstucking code being a terrible hack - removed it for now (asie) +* [#3091, #3083] Various recipe disabling crashes (asie) +* [#3090] Robots delete repairable tools after they break (asie) +* [#3089] Integration Table dupe (asie) +* [#3082] Void not killing robots (asie) +* [#3081] Emzuli Pipe behaviour bug (asie) +* Robot crash with TConstruct pickaxe on world reload (asie) diff --git a/buildcraft_resources/changelog/7.1.3 b/buildcraft_resources/changelog/7.1.3 new file mode 100644 index 0000000000..b2ae55c630 --- /dev/null +++ b/buildcraft_resources/changelog/7.1.3 @@ -0,0 +1,70 @@ +NOTE: This changelog takes off from BuildCraft 7.0.23! + +BREAKING CHANGES! + +* Cobblestone Structure Pipes have a new recipe. (asie) +* Electronic Libraries have a new recipe matching the looks better. (asie) +* Quartz Fluid Pipes no longer connect to Cobblestone or Stone Fluid Pipes. This might break existing builds! (asie) + +NON-BREAKING CHANGES BUT STILL IMPORTANT! + +* [#2886] Server blueprints are now saved inside [world]/buildcraft/blueprints as opposed to config/buildcraft/blueprints/server. The old directory will keep working, however. + +Additions: + +* Core: + * New Lists! (asie) + * Sort by type, material, or both! Precise sorting! + * See with a tooltip if an item matches the List! + * They can also sort armor, tools and fluids by type! +* Transport: + * Power Adapters! Connect Kinesis Pipes to non-Kinesis pipes. (asie) + +Improvements: + +* Core/Any: + * [#2345] Finish adding command localization (asie, warlordjones) + * Minor optimizations (asie, gamerForEA) + * Use integrated server data in singleplayer for certain tiles - back to the smoothness of 1.2.5! (asie) +* Builders: + * Massive improvements to Builder logic and heuristics (asie) + * Improved pipe rotation support (asie) +* Factory: + * Chutes now support the Comparator (asie) + * Flood Gates now have configurable sides. No idea when I fixed that, but it works now. (asie) + * Less lag on Tank updating - new comparator update system (asie) +* Robotics: + * Robots can now be destroyed via swords and projectiles (asie) + * Requesters now support the Comparator (asie) + * Add events for robot interaction and removal (asie) +* Transport: + * Filtered Buffers now support the Comparator (asie) + * Glass Facades no longer render the "plug" (asie) + * Lenses do not require Iron Ingots anymore (asie) + * New power beam display algorithm (asie) + * Rewritten pipe wires - should now propagate more or less instantly. (asie) + * Fluid pipe capacity and extraction rate now scales with the base flow multiplier. (asie) + +Bugs fixed: + +* [#3017] Crash if unable to extend stripes pipe (asie) +* [#3015] Packager pulls from input only slots from adjacent machines (asie) +* [#3010] Pipe wire does not activate when connecting by building through striped pipe (asie) +* [#2956] PipePluggable leaking state on the client (asie) +* [#2951] Obsidian Pipes not working right in certain circumstances (asie) +* [#2925] Rails on gravel not placing correctly (asie) +* A few robot bugs (hea3ven) +* Force/Forbid Robot statements not accepting lists (asie) +* "Lens-Filter" diodes not working (asie) +* Stirling engines heat up to green again (asie) + +API changes (I will document the API eventually): + +* Blueprints: + * Schematics can now depend on relative blocks to be built before they are placed (things like torches, ladders, redstone wire, etc.) (asie) +* Lists: + * New list matching API for custom sorting support! (asie) +* Robots: + * Rewritten request system! You can now check what items BC machines need with a simple interface! (hea3ven) +* Transport (Internal): + * PipeTransports can now have their own renderers via PipeTransportRenderer! (asie) diff --git a/buildcraft_resources/changelog/7.1.4 b/buildcraft_resources/changelog/7.1.4 new file mode 100644 index 0000000000..040a7c357f --- /dev/null +++ b/buildcraft_resources/changelog/7.1.4 @@ -0,0 +1,19 @@ +Additions: + +* Config option to disable showing every facade in Creative/NEI (asie) +* Objects.cfg, a config file letting you enable/disable almost any block and item in BuildCraft individually! (asie) + +Improvements: + +* [#3039] Slight item insertion optimization (Speiger) +* Improved power transmission logic (asie) +* Restored proper engine breaking icons (asie) + +Bugs fixed: + +* [#3041] GUI crash with Robot gate parameters (asie) +* [#3038] Server crash on corrupt BC map loading (asie) +* [#3035] Builder GUI crash (asie) +* [#3029] Cannot craft Pipe Plugs in rare cases (asie) +* [#3026] Filler breaking animation blocks being pickupable (asie) +* [#3024] Cannot right-click on pipes (asie) diff --git a/buildcraft_resources/changelog/7.1.5 b/buildcraft_resources/changelog/7.1.5 new file mode 100644 index 0000000000..ec9cba23cf --- /dev/null +++ b/buildcraft_resources/changelog/7.1.5 @@ -0,0 +1,3 @@ +Bugs fixed: + +* Builder/Quarry acting very strangely (asie) diff --git a/buildcraft_resources/changelog/7.1.6 b/buildcraft_resources/changelog/7.1.6 new file mode 100644 index 0000000000..c5817c1fbe --- /dev/null +++ b/buildcraft_resources/changelog/7.1.6 @@ -0,0 +1,21 @@ +Improvements: + +* "/buildcraft op" and "/buildcraft deop" commands, letting you easily op/deop the BuildCraft "fake player" (asie) +* Improved vanilla/BuildCraft tile Builder compatibility (asie) +* New Quarry frame model (asie) +* Quarry now rebuilds its own frame if it is removed (asie) + +Bugs fixed: + +* [#3045] Electronic Library crash (asie) +* [#3033] Emerald Transport Pipes only changing setting after closing GUI (asie) +* [#2998] Quarries not respecting a certain form of player-specific protection (asie) +* Biome config crashing instead of finding a new ID on setting ID past 256 (asie) +* Crash in TileAssemblyTable upon removing a mod whose Assembly Table recipes were being used (asie) +* Creative Engines only outputting 1/5th the advertised RF/t (asie) +* Frame icon not rendering on Quarry frame building (asie) +* Incorrect composite tank capacity calculation (indemnity83, Thog) +* NullPointerException on invalid StackRequest saving (asie) +* Rare MapChunk crash (asie) +* Rare StackOverflowException on breaking Markers (asie) +* StackOverflowException when breaking large Quarry frames (asie) diff --git a/buildcraft_resources/changelog/7.1.7 b/buildcraft_resources/changelog/7.1.7 new file mode 100644 index 0000000000..edae4569a9 --- /dev/null +++ b/buildcraft_resources/changelog/7.1.7 @@ -0,0 +1,3 @@ +Bugs fixed: + +* [#3049] BuildCraft 7.1.6 not working in SMP (asie) diff --git a/buildcraft_resources/changelog/7.1.8 b/buildcraft_resources/changelog/7.1.8 new file mode 100644 index 0000000000..7e25e13d05 --- /dev/null +++ b/buildcraft_resources/changelog/7.1.8 @@ -0,0 +1,11 @@ +Improvements: + +* Improvements to /buildcraft command (asie) +* New robot board texture (asie) + +Bugs fixed: + +* [#3050] Oil biome configs not changing from defaults (asie) +* Rare crash with engines (asie) +* Rare crash with facade rendering (asie) +* Very rare rendering glitch with items in BC pipes (asie) diff --git a/buildcraft_resources/changelog/7.1.9 b/buildcraft_resources/changelog/7.1.9 new file mode 100644 index 0000000000..e6ee5fbf49 --- /dev/null +++ b/buildcraft_resources/changelog/7.1.9 @@ -0,0 +1,14 @@ +Improvements: + +* Builder "Needed" list now shows exact amount of required blocks on hover (asie) +* More Builder optimizations (asie) + +Bugs fixed: + +* [#3056] PipeTransportFluids crash (asie) +* [#3055] Redstone Engines not heating up (asie) +* Builder anti-hack system bug (asie) +* Fluids in builder GUI not rendering correctly (for real this time!) (asie) +* Hollow facades using wrongly calculated ambient occlusion (asie) +* Leaves and saplings having issues when built (asie) +* Random crashes with integrated server tile entity lookup (asie) diff --git a/buildcraft_resources/versions.txt b/buildcraft_resources/versions.txt index 1d5db80e9b..ba7d1c4dc7 100755 --- a/buildcraft_resources/versions.txt +++ b/buildcraft_resources/versions.txt @@ -1,3 +1,3 @@ 1.6.4:BuildCraft:4.2.2 1.7.2:BuildCraft:6.0.16 -1.7.10:BuildCraft:6.4.14 +1.7.10:BuildCraft:7.1.12 diff --git a/common/buildcraft/BuildCraftBuilders.java b/common/buildcraft/BuildCraftBuilders.java index 59967e42ce..daa80d946f 100644 --- a/common/buildcraft/BuildCraftBuilders.java +++ b/common/buildcraft/BuildCraftBuilders.java @@ -1,5 +1,5 @@ /** 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; @@ -14,13 +14,7 @@ import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.entity.item.EntityItemFrame; -import net.minecraft.entity.item.EntityMinecartChest; -import net.minecraft.entity.item.EntityMinecartEmpty; -import net.minecraft.entity.item.EntityMinecartFurnace; -import net.minecraft.entity.item.EntityMinecartHopper; -import net.minecraft.entity.item.EntityMinecartTNT; -import net.minecraft.entity.item.EntityPainting; +import net.minecraft.entity.item.*; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; @@ -32,58 +26,32 @@ import net.minecraft.world.World; import net.minecraftforge.client.event.TextureStitchEvent; +import net.minecraftforge.common.DimensionManager; import net.minecraftforge.common.ForgeChunkManager; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.config.Property; import net.minecraftforge.fml.client.event.ConfigChangedEvent; -import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.common.event.FMLInitializationEvent; -import net.minecraftforge.fml.common.event.FMLInterModComms; -import net.minecraftforge.fml.common.event.FMLMissingMappingsEvent; -import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; -import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; -import net.minecraftforge.fml.common.event.FMLServerStoppingEvent; +import net.minecraftforge.fml.common.event.*; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import buildcraft.api.blueprints.BlueprintDeployer; -import buildcraft.api.blueprints.BuilderAPI; -import buildcraft.api.blueprints.ISchematicRegistry; -import buildcraft.api.blueprints.SchematicBlock; -import buildcraft.api.blueprints.SchematicEntity; -import buildcraft.api.blueprints.SchematicFactory; -import buildcraft.api.blueprints.SchematicMask; -import buildcraft.api.blueprints.SchematicTile; -import buildcraft.api.core.BCLog; -import buildcraft.api.core.ConfigAccessor; -import buildcraft.api.core.ConfigAccessor.EMod; +import buildcraft.api.blueprints.*; import buildcraft.api.core.JavaTools; -import buildcraft.api.filler.FillerManager; -import buildcraft.api.filler.IFillerPattern; import buildcraft.api.library.LibraryAPI; import buildcraft.api.statements.StatementManager; import buildcraft.builders.*; import buildcraft.builders.blueprints.RealBlueprintDeployer; import buildcraft.builders.schematics.*; import buildcraft.builders.statements.BuildersActionProvider; -import buildcraft.builders.urbanism.BlockUrbanist; -import buildcraft.builders.urbanism.TileUrbanist; import buildcraft.builders.urbanism.UrbanistToolsIconProvider; -import buildcraft.core.CompatHooks; -import buildcraft.core.DefaultProps; -import buildcraft.core.InterModComms; +import buildcraft.core.*; import buildcraft.core.blueprints.SchematicRegistry; -import buildcraft.core.builders.patterns.*; -import buildcraft.core.builders.schematics.SchematicBlockCreative; import buildcraft.core.builders.schematics.SchematicIgnore; -import buildcraft.core.builders.schematics.SchematicStandalone; -import buildcraft.core.builders.schematics.SchematicTileCreative; import buildcraft.core.config.ConfigManager; -import buildcraft.core.proxy.CoreProxy; @Mod(name = "BuildCraft Builders", version = DefaultProps.VERSION, useMetadata = false, modid = "BuildCraft|Builders", dependencies = DefaultProps.DEPENDENCY_CORE) @@ -92,14 +60,11 @@ public class BuildCraftBuilders extends BuildCraftMod { @Mod.Instance("BuildCraft|Builders") public static BuildCraftBuilders instance; - public static BlockMarker markerBlock; - public static BlockPathMarker pathMarkerBlock; public static BlockConstructionMarker constructionMarkerBlock; public static BlockFiller fillerBlock; public static BlockBuilder builderBlock; public static BlockArchitect architectBlock; public static BlockBlueprintLibrary libraryBlock; - public static BlockUrbanist urbanistBlock; public static BlockQuarry quarryBlock; public static BlockFrame frameBlock; public static ItemBlueprintTemplate templateItem; @@ -121,7 +86,7 @@ public class BuildCraftBuilders extends BuildCraftMod { public static boolean quarryLoadsChunks = true; public static boolean quarryOneTimeUse = false; - private String blueprintServerDir, blueprintClientDir; + private String oldBlueprintServerDir, blueprintClientDir; public class QuarryChunkloadCallback implements ForgeChunkManager.OrderedLoadingCallback { @Override @@ -160,11 +125,9 @@ public List ticketsLoaded(List) CompatHooks.INSTANCE.getTile(TileEngineWood.class), 0, "tile.engineWood"); + BCRegistry.INSTANCE.registerTileEntity(TileEngineWood.class, "net.minecraft.src.buildcraft.energy.TileEngineWood"); - decoratedBlock = new BlockDecoration(); - decoratedBlock.setUnlocalizedName("decoratedBlock"); - CoreProxy.proxy.registerBlock(decoratedBlock); + markerBlock = (BlockMarker) CompatHooks.INSTANCE.getBlock(BlockMarker.class); + BCRegistry.INSTANCE.registerBlock(markerBlock.setUnlocalizedName("markerBlock"), false); - engineBlock = (BlockEngine) CompatHooks.INSTANCE.getBlock(BlockEngine.class); - CoreProxy.proxy.registerBlock(engineBlock, ItemEngine.class); - engineBlock.registerTile((Class) CompatHooks.INSTANCE.getTile(TileEngineWood.class), - "buildcraft.core.engine.wood"); - CoreProxy.proxy.registerTileEntity(TileEngineWood.class, "buildcraft.core.engine.wood", - "net.minecraft.src.buildcraft.energy.TileEngineWood"); + pathMarkerBlock = (BlockPathMarker) CompatHooks.INSTANCE.getBlock(BlockPathMarker.class); + BCRegistry.INSTANCE.registerBlock(pathMarkerBlock.setUnlocalizedName("pathMarkerBlock"), false); - FMLCommonHandler.instance().bus().register(this); - MinecraftForge.EVENT_BUS.register(this); - MinecraftForge.EVENT_BUS.register(new BlockHighlightHandler()); - } finally {} + MinecraftForge.EVENT_BUS.register(this); + MinecraftForge.EVENT_BUS.register(this); + MinecraftForge.EVENT_BUS.register(new BlockHighlightHandler()); + + MinecraftForge.EVENT_BUS.register(new ListTooltipHandler()); + + OreDictionary.registerOre("chestWood", Blocks.chest); + OreDictionary.registerOre("craftingTableWood", Blocks.crafting_table); } @@ -343,7 +350,7 @@ public void init(FMLInitializationEvent evt) { channels = NetworkRegistry.INSTANCE.newChannel(DefaultProps.NET_CHANNEL_NAME + "-CORE", coreChannelHandler, new PacketHandler()); achievementManager = new AchievementManager("BuildCraft"); - FMLCommonHandler.instance().bus().register(achievementManager); + MinecraftForge.EVENT_BUS.register(achievementManager); woodenGearAchievement = achievementManager.registerAchievement(new Achievement("achievement.woodenGear", "woodenGearAchievement", 0, 0, woodenGearItem, null)); @@ -365,6 +372,7 @@ public void init(FMLInitializationEvent evt) { StatementManager.registerParameterClass("buildcraft:stackAction", StatementParameterItemStack.class); StatementManager.registerParameterClass(StatementParameterItemStack.class); + StatementManager.registerParameterClass(StatementParameterItemStackExact.class); StatementManager.registerParameterClass(StatementParameterDirection.class); StatementManager.registerParameterClass(StatementParameterRedstoneGateSideOnly.class); StatementManager.registerTriggerProvider(new DefaultTriggerProvider()); @@ -394,20 +402,49 @@ public void init(FMLInitializationEvent evt) { NetworkRegistry.INSTANCE.registerGuiHandler(instance, new CoreGuiHandler()); - FMLCommonHandler.instance().bus().register(TabletManagerClient.INSTANCE); - FMLCommonHandler.instance().bus().register(TabletManagerServer.INSTANCE); - FMLCommonHandler.instance().bus().register(TickHandlerCore.INSTANCE); MinecraftForge.EVENT_BUS.register(TabletManagerClient.INSTANCE); MinecraftForge.EVENT_BUS.register(TabletManagerServer.INSTANCE); MinecraftForge.EVENT_BUS.register(TickHandlerCore.INSTANCE); TabletAPI.registerProgram(new TabletProgramMenuFactory()); + + // Create filler registry + 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()); + FillerManager.registry.addPattern(new PatternCylinder()); + FillerManager.registry.addPattern(new PatternFrame()); + } catch (Error error) { + BCLog.logErrorAPI(error, IFillerPattern.class); + throw error; + } + + StatementManager.registerParameterClass(PatternParameterYDir.class); + StatementManager.registerParameterClass(PatternParameterXZDir.class); + StatementManager.registerParameterClass(PatternParameterCenter.class); + StatementManager.registerParameterClass(PatternParameterHollow.class); + + ListRegistry.registerHandler(new ListMatchHandlerClass()); + ListRegistry.registerHandler(new ListMatchHandlerFluid()); + ListRegistry.registerHandler(new ListMatchHandlerTools()); + ListRegistry.registerHandler(new ListMatchHandlerArmor()); + ListRegistry.itemClassAsType.add(ItemFood.class); } @Mod.EventHandler public void postInit(FMLPostInitializationEvent event) { BCLog.logger.info("BuildCraft's fake player: UUID = " + gameProfile.getId().toString() + ", name = '" + gameProfile.getName() + "'!"); + BCRegistry.INSTANCE.save(); + for (Object o : Block.blockRegistry) { Block block = (Block) o; @@ -419,11 +456,11 @@ public void postInit(FMLPostInitializationEvent event) { BuildCraftAPI.softBlocks.add(Blocks.snow); BuildCraftAPI.softBlocks.add(Blocks.vine); BuildCraftAPI.softBlocks.add(Blocks.fire); - BuildCraftAPI.softBlocks.add(Blocks.air); CropManager.setDefaultHandler(new CropHandlerPlantable()); CropManager.registerHandler(new CropHandlerReeds()); + BuildCraftAPI.registerWorldProperty("replaceable", new WorldPropertyIsReplaceable()); BuildCraftAPI.registerWorldProperty("soft", new WorldPropertyIsSoft()); BuildCraftAPI.registerWorldProperty("wood", new WorldPropertyIsWood()); BuildCraftAPI.registerWorldProperty("leaves", new WorldPropertyIsLeaf()); @@ -436,6 +473,10 @@ public void postInit(FMLPostInitializationEvent event) { BuildCraftAPI.registerWorldProperty("dirt", new WorldPropertyIsDirt()); BuildCraftAPI.registerWorldProperty("fluidSource", new WorldPropertyIsFluidSource()); + // Landmarks are often caught incorrectly, making building them counter-productive. + SchematicRegistry.INSTANCE.registerSchematicBlock(markerBlock, SchematicIgnore.class); + SchematicRegistry.INSTANCE.registerSchematicBlock(pathMarkerBlock, SchematicIgnore.class); + ColorUtils.initialize(); actionControl = new IActionExternal[IControllable.Mode.values().length]; @@ -444,25 +485,42 @@ public void postInit(FMLPostInitializationEvent event) { actionControl[mode.ordinal()] = new ActionMachineControl(mode); } } + + MinecraftForge.EVENT_BUS.register(ListOreDictionaryCache.INSTANCE); + for (String s : OreDictionary.getOreNames()) { + ListOreDictionaryCache.INSTANCE.registerName(s); + } + + ListRegistry.registerHandler(new ListMatchHandlerOreDictionary()); } @Mod.EventHandler public void serverStarting(FMLServerStartingEvent event) { event.registerServerCommand(commandBuildcraft); + /* Increase the builder speed in singleplayer mode. Singleplayer users generally run far fewer of them. */ + + if (FMLCommonHandler.instance().getSide() == Side.CLIENT) { + BuildingSlotMapIterator.MAX_PER_ITEM = builderMaxPerItemFactor * 4; + } else { + BuildingSlotMapIterator.MAX_PER_ITEM = builderMaxPerItemFactor; + } + if (Utils.CAULDRON_DETECTED) { BCLog.logger.warn("############################################"); BCLog.logger.warn("# #"); BCLog.logger.warn("# Cauldron has been detected! Please keep #"); - BCLog.logger.warn("# in mind that BuildCraft does NOT support #"); - BCLog.logger.warn("# Cauldron and we do not promise to fix #"); - BCLog.logger.warn("# bugs caused by its modifications to the #"); - BCLog.logger.warn("# Minecraft engine. Please reconsider. #"); + BCLog.logger.warn("# in mind that BuildCraft may NOT provide #"); + BCLog.logger.warn("# support to Cauldron users, as the mod is #"); + BCLog.logger.warn("# primarily tested without Bukkit/Spigot's #"); + BCLog.logger.warn("# changes to the Minecraft internals. #"); BCLog.logger.warn("# #"); BCLog.logger.warn("# Any lag caused by BuildCraft on top of #"); - BCLog.logger.warn("# Cauldron likely arises from our fixes to #"); - BCLog.logger.warn("# their bugs, so please don't report that #"); - BCLog.logger.warn("# either. Thanks for your attention! ~BC #"); + BCLog.logger.warn("# Cauldron likely arises from workarounds #"); + BCLog.logger.warn("# which we apply to make sure BuildCraft #"); + BCLog.logger.warn("# works properly with Cauldron installed. #"); + BCLog.logger.warn("# #"); + BCLog.logger.warn("# Thanks for your attention! ~ BC devs #"); BCLog.logger.warn("# #"); BCLog.logger.warn("############################################"); @@ -488,15 +546,19 @@ public void reloadConfig(ConfigManager.RestartRequirement restartType) { reloadConfig(ConfigManager.RestartRequirement.WORLD); } else if (restartType == ConfigManager.RestartRequirement.WORLD) { - reloadConfig(ConfigManager.RestartRequirement.NONE); } else { + useServerDataOnClient = mainConfigManager.get("general.useServerDataOnClient").getBoolean(true); + builderMaxPerItemFactor = mainConfigManager.get("general.builderMaxIterationsPerItemFactor").getInt(); hideFluidNumbers = mainConfigManager.get("display.hideFluidValues").getBoolean(); hidePowerNumbers = mainConfigManager.get("display.hidePowerValues").getBoolean(); itemLifespan = mainConfigManager.get("general.itemLifespan").getInt(); canEnginesExplode = mainConfigManager.get("general.canEnginesExplode").getBoolean(); consumeWaterSources = mainConfigManager.get("general.pumpsConsumeWater").getBoolean(); miningMultiplier = (float) mainConfigManager.get("power.miningUsageMultiplier").getDouble(); + miningAllowPlayerProtectedBlocks = mainConfigManager.get("general.miningBreaksPlayerProtectedBlocks").getBoolean(); + + BuildingSlotMapIterator.MAX_PER_ITEM = builderMaxPerItemFactor; ChannelHandler.setRecordStats(mainConfigManager.get("debug.network.stats").getBoolean()); @@ -514,90 +576,56 @@ public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event) { } public void loadRecipes() { - CoreProxy.proxy.addCraftingRecipe(new ItemStack(wrenchItem), "I I", " G ", " I ", 'I', "ingotIron", 'G', "gearStone"); - CoreProxy.proxy.addCraftingRecipe(new ItemStack(woodenGearItem), " S ", "S S", " S ", 'S', "stickWood"); - CoreProxy.proxy.addCraftingRecipe(new ItemStack(stoneGearItem), " I ", "IGI", " I ", 'I', "cobblestone", 'G', "gearWood"); - CoreProxy.proxy.addCraftingRecipe(new ItemStack(ironGearItem), " I ", "IGI", " I ", 'I', "ingotIron", 'G', "gearStone"); - CoreProxy.proxy.addCraftingRecipe(new ItemStack(goldGearItem), " I ", "IGI", " I ", 'I', "ingotGold", 'G', "gearIron"); - CoreProxy.proxy.addCraftingRecipe(new ItemStack(diamondGearItem), " I ", "IGI", " I ", 'I', "gemDiamond", 'G', "gearGold"); - CoreProxy.proxy.addCraftingRecipe(new ItemStack(mapLocationItem), "ppp", "pYp", "ppp", 'p', Items.paper, 'Y', "dyeYellow"); - CoreProxy.proxy.addCraftingRecipe(new ItemStack(listItem), "ppp", "pYp", "ppp", 'p', Items.paper, 'Y', "dyeGreen"); + BCRegistry.INSTANCE.addCraftingRecipe(new ItemStack(wrenchItem), "I I", " G ", " I ", 'I', "ingotIron", 'G', "gearStone"); + BCRegistry.INSTANCE.addCraftingRecipe(new ItemStack(woodenGearItem), " S ", "S S", " S ", 'S', "stickWood"); + BCRegistry.INSTANCE.addCraftingRecipe(new ItemStack(stoneGearItem), " I ", "IGI", " I ", 'I', "cobblestone", 'G', "gearWood"); + BCRegistry.INSTANCE.addCraftingRecipe(new ItemStack(ironGearItem), " I ", "IGI", " I ", 'I', "ingotIron", 'G', "gearStone"); + BCRegistry.INSTANCE.addCraftingRecipe(new ItemStack(goldGearItem), " I ", "IGI", " I ", 'I', "ingotGold", 'G', "gearIron"); + BCRegistry.INSTANCE.addCraftingRecipe(new ItemStack(diamondGearItem), " I ", "IGI", " I ", 'I', "gemDiamond", 'G', "gearGold"); + BCRegistry.INSTANCE.addCraftingRecipe(new ItemStack(mapLocationItem), "ppp", "pYp", "ppp", 'p', Items.paper, 'Y', "dyeYellow"); - CoreProxy.proxy.addCraftingRecipe(new ItemStack(engineBlock, 1, 0), "www", " g ", "GpG", 'w', "plankWood", 'g', "blockGlass", 'G', "gearWood", - 'p', Blocks.piston); + BCRegistry.INSTANCE.addCraftingRecipe(new ItemStack(engineBlock, 1, 0), "www", " g ", "GpG", 'w', "plankWood", 'g', "blockGlass", 'G', + "gearWood", 'p', Blocks.piston); - CoreProxy.proxy.addCraftingRecipe(new ItemStack(paintbrushItem), " iw", " gi", "s ", 's', "stickWood", 'g', "gearWood", 'w', new ItemStack( - Blocks.wool, 1, 0), 'i', Items.string); + BCRegistry.INSTANCE.addCraftingRecipe(new ItemStack(markerBlock, 1), "l ", "r ", 'l', new ItemStack(Items.dye, 1, 4), 'r', + Blocks.redstone_torch); - for (int i = 0; i < 16; i++) { - ItemStack outputStack = paintbrushItem.getItemStack(EnumDyeColor.values()[i]); - String dye = ColorUtils.getOreDictionaryName(i); - CoreProxy.proxy.addShapelessRecipe(outputStack, paintbrushItem, dye); - } - } - - @Mod.EventHandler - public void processIMCRequests(FMLInterModComms.IMCEvent event) { - InterModComms.processIMC(event); - } + BCRegistry.INSTANCE.addCraftingRecipe(new ItemStack(pathMarkerBlock, 1), "l ", "r ", 'l', "dyeGreen", 'r', Blocks.redstone_torch); - @SubscribeEvent - @SideOnly(Side.CLIENT) - public void renderLast(RenderWorldLastEvent evt) { - // TODO: while the urbanist is deactivated, this code can be dormant. - // it happens to be very expensive at run time, so we need some way - // to operate it only when releval (e.g. in the cycle following a - // click request). - if (NONRELEASED_BLOCKS) { - return; - } + BCRegistry.INSTANCE.addCraftingRecipe(new ItemStack(paintbrushItem), " iw", " gi", "s ", 's', "stickWood", 'g', "gearWood", 'w', + new ItemStack(Blocks.wool, 1, 0), 'i', Items.string); - /** Note (SpaceToad): Why on earth this thing eventually worked out is a mystery to me. In particular, all the - * examples I got computed y in a different way. Anyone with further OpenGL understanding would be welcome to - * explain. - * - * Anyway, the purpose of this code is to store the block position pointed by the mouse at each frame, relative - * to the entity that has the camera. - * - * It got heavily inspire from the two following sources: - * http://nehe.gamedev.net/article/using_gluunproject/16013/ #ActiveRenderInfo.updateRenderInfo. - * - * See EntityUrbanist#rayTraceMouse for a usage example. */ - - if (modelviewF == null) { - modelviewF = GLAllocation.createDirectFloatBuffer(16); - projectionF = GLAllocation.createDirectFloatBuffer(16); - viewport = GLAllocation.createDirectIntBuffer(16); + ItemStack anyPaintbrush = new ItemStack(paintbrushItem, 1, OreDictionary.WILDCARD_VALUE); + for (int i = 0; i < 16; i++) { + ItemStack outputStack = new ItemStack(paintbrushItem); + NBTUtils.getItemData(outputStack).setByte("color", (byte) i); + BCRegistry.INSTANCE.addShapelessRecipe(outputStack, anyPaintbrush, EnumColor.fromId(i).getDye()); } - GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, modelviewF); - GL11.glGetFloat(GL11.GL_PROJECTION_MATRIX, projectionF); - GL11.glGetInteger(GL11.GL_VIEWPORT, viewport); - float f = (viewport.get(0) + viewport.get(2)) / 2; - float f1 = (viewport.get(1) + viewport.get(3)) / 2; - - float x = Mouse.getX(); - float y = Mouse.getY(); - - // TODO: Minecraft seems to instist to have this winZ re-created at - // each frame - looks like a memory leak to me but I couldn't use a - // static variable instead, as for the rest. - FloatBuffer winZ = GLAllocation.createDirectFloatBuffer(1); - GL11.glReadPixels((int) x, (int) y, 1, 1, GL11.GL_DEPTH_COMPONENT, GL11.GL_FLOAT, winZ); + // Convert old lists to new lists + BCRegistry.INSTANCE.addShapelessRecipe(new ItemStack(listItem, 1, 1), new ItemStack(listItem, 1, 0)); - GLU.gluUnProject(x, y, winZ.get(), modelviewF, projectionF, viewport, pos); + if (Loader.isModLoaded("BuildCraft|Silicon")) { + CoreSiliconRecipes.loadSiliconRecipes(); + } else { + BCRegistry.INSTANCE.addCraftingRecipe(new ItemStack(listItem, 1, 1), "ppp", "pYp", "ppp", 'p', Items.paper, 'Y', "dyeGreen"); + } + } - diffX = pos.get(0); - diffY = pos.get(1); - diffZ = pos.get(2); + @Mod.EventHandler + public void processIMCRequests(FMLInterModComms.IMCEvent event) { + InterModComms.processIMC(event); } @SubscribeEvent - public void cleanRegistries(WorldEvent.Unload unload) { + public void cleanRegistries(WorldEvent.Unload event) { for (IWorldProperty property : BuildCraftAPI.worldProperties.values()) { property.clear(); } + if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) { + TilePathMarker.clearAvailableMarkersList(event.world); + } } // 1.7.10 migration diff --git a/common/buildcraft/BuildCraftEnergy.java b/common/buildcraft/BuildCraftEnergy.java index 6dd8b2870e..4661312b5c 100644 --- a/common/buildcraft/BuildCraftEnergy.java +++ b/common/buildcraft/BuildCraftEnergy.java @@ -1,5 +1,5 @@ /** 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; @@ -27,13 +27,8 @@ import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fml.client.event.ConfigChangedEvent; -import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.common.event.FMLInitializationEvent; -import net.minecraftforge.fml.common.event.FMLInterModComms; -import net.minecraftforge.fml.common.event.FMLMissingMappingsEvent; -import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; -import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; +import net.minecraftforge.fml.common.event.*; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.registry.GameRegistry; @@ -47,6 +42,7 @@ import buildcraft.api.recipes.BuildcraftRecipeRegistry; import buildcraft.api.statements.ITriggerExternal; import buildcraft.api.statements.StatementManager; +import buildcraft.core.BCRegistry; import buildcraft.core.DefaultProps; import buildcraft.core.InterModComms; import buildcraft.core.config.ConfigManager; @@ -55,20 +51,13 @@ import buildcraft.core.lib.engines.TileEngineBase; import buildcraft.core.lib.network.base.ChannelHandler; import buildcraft.core.lib.network.base.PacketHandler; -import buildcraft.core.proxy.CoreProxy; -import buildcraft.energy.BucketHandler; -import buildcraft.energy.EnergyGuiHandler; -import buildcraft.energy.EnergyProxy; -import buildcraft.energy.IMCHandlerEnergy; -import buildcraft.energy.ItemBucketBuildcraft; -import buildcraft.energy.MaterialBuildCraftLiquid; -import buildcraft.energy.TileEngineCreative; -import buildcraft.energy.TileEngineIron; -import buildcraft.energy.TileEngineStone; +import buildcraft.energy.*; import buildcraft.energy.fuels.CoolantManager; import buildcraft.energy.fuels.FuelManager; import buildcraft.energy.statements.EnergyStatementProvider; +import buildcraft.energy.statements.TriggerCoolantBelowThreshold; import buildcraft.energy.statements.TriggerEngineHeat; +import buildcraft.energy.statements.TriggerFuelBelowThreshold; import buildcraft.energy.worldgen.BiomeGenOilDesert; import buildcraft.energy.worldgen.BiomeGenOilOcean; import buildcraft.energy.worldgen.BiomeInitializer; @@ -106,12 +95,19 @@ public class BuildCraftEnergy extends BuildCraftMod { public static boolean canOilBurn; public static boolean isOilDense; public static double oilWellScalar = 1.0; + public static ITriggerExternal triggerBlueEngineHeat = new TriggerEngineHeat(EnumEnergyStage.BLUE); public static ITriggerExternal triggerGreenEngineHeat = new TriggerEngineHeat(EnumEnergyStage.GREEN); public static ITriggerExternal triggerYellowEngineHeat = new TriggerEngineHeat(EnumEnergyStage.YELLOW); public static ITriggerExternal triggerRedEngineHeat = new TriggerEngineHeat(EnumEnergyStage.RED); public static ITriggerExternal triggerEngineOverheat = new TriggerEngineHeat(EnumEnergyStage.OVERHEAT); + public static ITriggerExternal triggerFuelBelow25 = new TriggerFuelBelowThreshold(0.25F); + public static ITriggerExternal triggerFuelBelow50 = new TriggerFuelBelowThreshold(0.50F); + + public static ITriggerExternal triggerCoolantBelow25 = new TriggerCoolantBelowThreshold(0.25F); + public static ITriggerExternal triggerCoolantBelow50 = new TriggerCoolantBelowThreshold(0.50F); + private static Fluid buildcraftFluidOil; private static Fluid buildcraftFluidFuel; private static Fluid buildcraftFluidRedPlasma; @@ -121,7 +117,6 @@ public void preInit(FMLPreInitializationEvent evt) { 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(); int oilOceanBiomeId = BuildCraftCore.mainConfigManager.register("worldgen.biomes", "biomeOilOcean", DefaultProps.BIOME_OIL_OCEAN, @@ -144,15 +139,11 @@ public void preInit(FMLPreInitializationEvent evt) { BiomeGenBase.sky.biomeName, BiomeGenBase.hell.biomeName }, "IDs or Biome Types (e.g. SANDY,OCEAN) of biomes that are excluded from generating oil.", RestartRequirement.GAME)); - double fuelLavaMultiplier = BuildCraftCore.mainConfigManager.register("general", "fuel.lava.combustion", 1.0F, - "adjust energy value of Lava in Combustion Engines", RestartRequirement.GAME).getDouble(); double fuelOilMultiplier = BuildCraftCore.mainConfigManager.register("general", "fuel.oil.combustion", 1.0F, "adjust energy value of Oil in Combustion Engines", RestartRequirement.GAME).getDouble(); double fuelFuelMultiplier = BuildCraftCore.mainConfigManager.register("general", "fuel.fuel.combustion", 1.0F, "adjust energy value of Fuel in Combustion Engines", RestartRequirement.GAME).getDouble(); - int fuelLavaEnergyOutput = BuildCraftCore.mainConfigManager.register("general", "fuel.lava.combustion.energyOutput", 20, - "adjust output energy by Lava in Combustion Engines", RestartRequirement.GAME).getInt(); int fuelOilEnergyOutput = BuildCraftCore.mainConfigManager.register("general", "fuel.oil.combustion.energyOutput", 30, "adjust output energy by Oil in Combustion Engines", RestartRequirement.GAME).getInt(); int fuelFuelEnergyOutput = BuildCraftCore.mainConfigManager.register("general", "fuel.fuel.combustion.energyOutput", 60, @@ -160,8 +151,10 @@ public void preInit(FMLPreInitializationEvent evt) { BuildCraftCore.mainConfiguration.save(); + BiomeGenBase[] biomeGenArray = BiomeGenBase.getBiomeGenArray(); + if (oilDesertBiomeId > 0) { - if (BiomeGenBase.getBiomeGenArray()[oilDesertBiomeId] != null) { + if (oilDesertBiomeId >= biomeGenArray.length || biomeGenArray[oilDesertBiomeId] != null) { oilDesertBiomeId = findUnusedBiomeID("oilDesert"); // save changes to config file BuildCraftCore.mainConfiguration.get("worldgen.biomes", "biomeOilDesert", oilDesertBiomeId).set(oilDesertBiomeId); @@ -171,7 +164,7 @@ public void preInit(FMLPreInitializationEvent evt) { } if (oilOceanBiomeId > 0) { - if (BiomeGenBase.getBiomeGenArray()[oilOceanBiomeId] != null) { + if (oilOceanBiomeId >= biomeGenArray.length || biomeGenArray[oilOceanBiomeId] != null) { oilOceanBiomeId = findUnusedBiomeID("oilOcean"); // save changes to config file BuildCraftCore.mainConfiguration.get("worldgen.biomes", "biomeOilOcean", oilOceanBiomeId).set(oilOceanBiomeId); @@ -216,7 +209,7 @@ public void preInit(FMLPreInitializationEvent evt) { materialOil = new MaterialBuildCraftLiquid(MapColor.blackColor); blockOil = new BlockBuildCraftFluid(fluidOil, materialOil).setFlammability(0); blockOil.setUnlocalizedName("blockOil").setLightOpacity(8); - CoreProxy.proxy.registerBlock(blockOil); + BCRegistry.INSTANCE.registerBlock(blockOil, true); fluidOil.setBlock(blockOil); BuildCraftCore.mainConfigManager.register("general.oilCanBurn", true, "Should oil burn when lit on fire?", @@ -239,7 +232,7 @@ public void preInit(FMLPreInitializationEvent evt) { materialFuel = new MaterialBuildCraftLiquid(MapColor.yellowColor); blockFuel = new BlockBuildCraftFluid(fluidFuel, materialFuel).setFlammable(true).setFlammability(5).setParticleColor(0.7F, 0.7F, 0.0F); blockFuel.setUnlocalizedName("blockFuel").setLightOpacity(3); - CoreProxy.proxy.registerBlock(blockFuel); + BCRegistry.INSTANCE.registerBlock(blockFuel, true); fluidFuel.setBlock(blockFuel); } else { blockFuel = fluidFuel.getBlock(); @@ -249,7 +242,7 @@ public void preInit(FMLPreInitializationEvent evt) { materialRedPlasma = new MaterialBuildCraftLiquid(MapColor.redColor); blockRedPlasma = new BlockBuildCraftFluid(fluidRedPlasma, materialRedPlasma).setFlammable(false).setParticleColor(0.9F, 0, 0); blockRedPlasma.setUnlocalizedName("blockRedPlasma"); - CoreProxy.proxy.registerBlock(blockRedPlasma); + BCRegistry.INSTANCE.registerBlock(blockRedPlasma, true); fluidRedPlasma.setBlock(blockRedPlasma); } else { blockRedPlasma = fluidRedPlasma.getBlock(); @@ -260,7 +253,7 @@ public void preInit(FMLPreInitializationEvent evt) { if (blockOil != null) { bucketOil = new ItemBucketBuildcraft(blockOil); bucketOil.setUnlocalizedName("bucketOil").setContainerItem(Items.bucket); - CoreProxy.proxy.registerItem(bucketOil); + BCRegistry.INSTANCE.registerItem(bucketOil, true); FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluidStack("oil", FluidContainerRegistry.BUCKET_VOLUME), new ItemStack( bucketOil), new ItemStack(Items.bucket)); } @@ -268,16 +261,16 @@ public void preInit(FMLPreInitializationEvent evt) { if (blockFuel != null) { bucketFuel = new ItemBucketBuildcraft(blockFuel); bucketFuel.setUnlocalizedName("bucketFuel").setContainerItem(Items.bucket); - CoreProxy.proxy.registerItem(bucketFuel); + BCRegistry.INSTANCE.registerItem(bucketFuel, true); FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluidStack("fuel", FluidContainerRegistry.BUCKET_VOLUME), new ItemStack( bucketFuel), new ItemStack(Items.bucket)); } - if (!BuildCraftCore.NONRELEASED_BLOCKS) { + if (BuildCraftCore.DEVELOPER_MODE) { if (blockRedPlasma != null) { bucketRedPlasma = new ItemBucketBuildcraft(blockRedPlasma); bucketRedPlasma.setUnlocalizedName("bucketRedPlasma").setContainerItem(Items.bucket); - CoreProxy.proxy.registerItem(bucketRedPlasma); + BCRegistry.INSTANCE.registerItem(bucketRedPlasma, true); FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluidStack("redplasma", FluidContainerRegistry.BUCKET_VOLUME), new ItemStack(bucketRedPlasma), new ItemStack(Items.bucket)); } @@ -294,20 +287,20 @@ public void preInit(FMLPreInitializationEvent evt) { BuildcraftRecipeRegistry.refinery.addRecipe("buildcraft:fuel", new FluidStack(fluidOil, 1), new FluidStack(fluidFuel, 1), 120, 1); - BuildcraftFuelRegistry.fuel.addFuel(FluidRegistry.LAVA, fuelLavaEnergyOutput, (int) (6000 * fuelLavaMultiplier)); BuildcraftFuelRegistry.fuel.addFuel(fluidOil, fuelOilEnergyOutput, (int) (5000 * fuelOilMultiplier)); BuildcraftFuelRegistry.fuel.addFuel(fluidFuel, fuelFuelEnergyOutput, (int) (25000 * fuelFuelMultiplier)); BuildcraftFuelRegistry.coolant.addCoolant(FluidRegistry.WATER, 0.0023f); - BuildcraftFuelRegistry.coolant.addSolidCoolant(StackKey.stack(Blocks.ice), StackKey.fluid(FluidRegistry.WATER), 2f); + BuildcraftFuelRegistry.coolant.addSolidCoolant(StackKey.stack(Blocks.ice), StackKey.fluid(FluidRegistry.WATER), 1.5f); + BuildcraftFuelRegistry.coolant.addSolidCoolant(StackKey.stack(Blocks.packed_ice), StackKey.fluid(FluidRegistry.WATER), 2.0f); - BuildCraftCore.engineBlock.registerTile(TileEngineStone.class, "buildcraft.energy.engineStone"); - BuildCraftCore.engineBlock.registerTile(TileEngineIron.class, "buildcraft.energy.engineIron"); - BuildCraftCore.engineBlock.registerTile(TileEngineCreative.class, "buildcraft.energy.engineCreative"); + BuildCraftCore.engineBlock.registerTile(TileEngineStone.class, 1, "tile.engineStone"); + BuildCraftCore.engineBlock.registerTile(TileEngineIron.class, 2, "tile.engineIron"); + BuildCraftCore.engineBlock.registerTile(TileEngineCreative.class, 3, "tile.engineCreative"); InterModComms.registerHandler(new IMCHandlerEnergy()); - FMLCommonHandler.instance().bus().register(this); + MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(this); } @@ -402,14 +395,14 @@ public void postInit(FMLPostInitializationEvent evt) { } public static void loadRecipes() { - CoreProxy.proxy.addCraftingRecipe(new ItemStack(BuildCraftCore.engineBlock, 1, 1), "www", " g ", "GpG", 'w', "cobblestone", 'g', "blockGlass", - 'G', "gearStone", 'p', Blocks.piston); - CoreProxy.proxy.addCraftingRecipe(new ItemStack(BuildCraftCore.engineBlock, 1, 2), "www", " g ", "GpG", 'w', "ingotIron", 'g', "blockGlass", - 'G', "gearIron", 'p', Blocks.piston); + BCRegistry.INSTANCE.addCraftingRecipe(new ItemStack(BuildCraftCore.engineBlock, 1, 1), "www", " g ", "GpG", 'w', "cobblestone", 'g', + "blockGlass", 'G', "gearStone", 'p', Blocks.piston); + BCRegistry.INSTANCE.addCraftingRecipe(new ItemStack(BuildCraftCore.engineBlock, 1, 2), "www", " g ", "GpG", 'w', "ingotIron", 'g', + "blockGlass", 'G', "gearIron", 'p', Blocks.piston); } private int findUnusedBiomeID(String biomeName) { - int freeBiomeID = 0; + int freeBiomeID; // code to find a free biome for (int i = 1; i < 256; i++) { if (BiomeGenBase.getBiomeGenArray()[i] == null) { @@ -418,14 +411,6 @@ private int findUnusedBiomeID(String biomeName) { } } // failed to find any free biome IDs - // class BiomeIdLimitException extends RuntimeException { - // private static final long serialVersionUID = 1L; - // - // public BiomeIdLimitException(String biome) { - // super(String.format("You have run out of free Biome ID spaces for %s", biome)); - // } - // } - throw new RuntimeException("You have run out of free Biome ID spaces for " + biomeName); } diff --git a/common/buildcraft/BuildCraftFactory.java b/common/buildcraft/BuildCraftFactory.java index e1de149f75..f817ced0c6 100644 --- a/common/buildcraft/BuildCraftFactory.java +++ b/common/buildcraft/BuildCraftFactory.java @@ -1,5 +1,5 @@ /** 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; @@ -19,7 +19,6 @@ import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.client.event.ConfigChangedEvent; -import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.event.FMLInitializationEvent; @@ -34,6 +33,7 @@ import buildcraft.api.blueprints.BuilderAPI; import buildcraft.api.blueprints.SchematicTile; +import buildcraft.core.BCRegistry; import buildcraft.core.CompatHooks; import buildcraft.core.DefaultProps; import buildcraft.core.InterModComms; @@ -41,7 +41,6 @@ import buildcraft.core.config.ConfigManager; import buildcraft.core.lib.network.base.ChannelHandler; import buildcraft.core.lib.network.base.PacketHandler; -import buildcraft.core.proxy.CoreProxy; import buildcraft.factory.*; import buildcraft.factory.render.ChuteRenderModel; import buildcraft.factory.schematics.SchematicAutoWorkbench; @@ -70,47 +69,9 @@ public class BuildCraftFactory extends BuildCraftMod { public static Achievement refineAndRedefineAchievement; public static int miningDepth = 256; - public static boolean pumpsNeedRealPower = false; + public static boolean pumpsNeedRealPower = false; public static PumpDimensionList pumpDimensionList; - @Mod.EventHandler - public void load(FMLInitializationEvent evt) { - NetworkRegistry.INSTANCE.registerGuiHandler(instance, new FactoryGuiHandler()); - - // EntityRegistry.registerModEntity(EntityMechanicalArm.class, "bcMechanicalArm", EntityIds.MECHANICAL_ARM, - // instance, 50, 1, true); - - CoreProxy.proxy.registerTileEntity(TileMiningWell.class, "buildcraft.factory.MiningWell", "MiningWell"); - CoreProxy.proxy.registerTileEntity(TileAutoWorkbench.class, "buildcraft.factory.AutoWorkbench", "AutoWorkbench"); - CoreProxy.proxy.registerTileEntity(TilePump.class, "buildcraft.factory.Pump", "net.minecraft.src.buildcraft.factory.TilePump"); - CoreProxy.proxy.registerTileEntity(TileFloodGate.class, "buildcraft.factory.FloodGate", "net.minecraft.src.buildcraft.factory.TileFloodGate"); - CoreProxy.proxy.registerTileEntity(TileTank.class, "buildcraft.factory.Tank", "net.minecraft.src.buildcraft.factory.TileTank"); - CoreProxy.proxy.registerTileEntity(TileRefinery.class, "buildcraft.factory.Refinery", "net.minecraft.src.buildcraft.factory.Refinery"); - CoreProxy.proxy.registerTileEntity(TileChute.class, "buildcraft.factory.Chute", "net.minecraft.src.buildcraft.factory.TileHopper"); - - FactoryProxy.proxy.initializeTileEntities(); - - BuilderAPI.schematicRegistry.registerSchematicBlock(refineryBlock, SchematicRefinery.class); - BuilderAPI.schematicRegistry.registerSchematicBlock(tankBlock, SchematicTileIgnoreState.class); - BuilderAPI.schematicRegistry.registerSchematicBlock(pumpBlock, SchematicPump.class); - BuilderAPI.schematicRegistry.registerSchematicBlock(miningWellBlock, SchematicTileIgnoreState.class); - BuilderAPI.schematicRegistry.registerSchematicBlock(floodGateBlock, SchematicTileIgnoreState.class); - BuilderAPI.schematicRegistry.registerSchematicBlock(autoWorkbenchBlock, SchematicAutoWorkbench.class); - BuilderAPI.schematicRegistry.registerSchematicBlock(chuteBlock, SchematicTile.class); - BuilderAPI.schematicRegistry.registerSchematicBlock(plainPipeBlock, SchematicFree.class); - - aLotOfCraftingAchievement = BuildCraftCore.achievementManager.registerAchievement(new Achievement("achievement.aLotOfCrafting", - "aLotOfCraftingAchievement", 1, 2, autoWorkbenchBlock, BuildCraftCore.woodenGearAchievement)); - straightDownAchievement = BuildCraftCore.achievementManager.registerAchievement(new Achievement("achievement.straightDown", - "straightDownAchievement", 5, 2, miningWellBlock, BuildCraftCore.ironGearAchievement)); - refineAndRedefineAchievement = BuildCraftCore.achievementManager.registerAchievement(new Achievement("achievement.refineAndRedefine", - "refineAndRedefineAchievement", 10, 0, refineryBlock, BuildCraftCore.diamondGearAchievement)); - - if (BuildCraftCore.loadDefaultRecipes) { - loadRecipes(); - } - } - @Mod.EventHandler public void initialize(FMLPreInitializationEvent evt) { channels = NetworkRegistry.INSTANCE.newChannel(DefaultProps.NET_CHANNEL_NAME + "-FACTORY", new ChannelHandler(), new PacketHandler()); @@ -124,76 +85,114 @@ public void initialize(FMLPreInitializationEvent evt) { ConfigManager.RestartRequirement.NONE); BuildCraftCore.mainConfigManager.get("general.miningDepth").setMinValue(2).setMaxValue(256); - BuildCraftCore.mainConfigManager.register("general.pumpDimensionControl", DefaultProps.PUMP_DIMENSION_LIST, plc, ConfigManager.RestartRequirement.NONE); - BuildCraftCore.mainConfigManager.register("general.pumpsNeedRealPower", false, "Do pumps need real (non-redstone) power?", ConfigManager.RestartRequirement.WORLD); + BuildCraftCore.mainConfigManager.register("general.pumpDimensionControl", DefaultProps.PUMP_DIMENSION_LIST, plc, + ConfigManager.RestartRequirement.NONE); + BuildCraftCore.mainConfigManager.register("general.pumpsNeedRealPower", false, "Do pumps need real (non-redstone) power?", + ConfigManager.RestartRequirement.WORLD); reloadConfig(ConfigManager.RestartRequirement.GAME); miningWellBlock = (BlockMiningWell) CompatHooks.INSTANCE.getBlock(BlockMiningWell.class); - CoreProxy.proxy.registerBlock(miningWellBlock.setUnlocalizedName("miningWellBlock")); - - plainPipeBlock = new BlockPlainPipe(); - CoreProxy.proxy.registerBlock(plainPipeBlock.setUnlocalizedName("plainPipeBlock")); + if (BCRegistry.INSTANCE.registerBlock(miningWellBlock.setUnlocalizedName("miningWellBlock"), false)) { + plainPipeBlock = new BlockPlainPipe(); + BCRegistry.INSTANCE.registerBlock(plainPipeBlock.setUnlocalizedName("plainPipeBlock"), true); + } autoWorkbenchBlock = (BlockAutoWorkbench) CompatHooks.INSTANCE.getBlock(BlockAutoWorkbench.class); - CoreProxy.proxy.registerBlock(autoWorkbenchBlock.setUnlocalizedName("autoWorkbenchBlock")); + BCRegistry.INSTANCE.registerBlock(autoWorkbenchBlock.setUnlocalizedName("autoWorkbenchBlock"), false); tankBlock = (BlockTank) CompatHooks.INSTANCE.getBlock(BlockTank.class); - CoreProxy.proxy.registerBlock(tankBlock.setUnlocalizedName("tankBlock")); + BCRegistry.INSTANCE.registerBlock(tankBlock.setUnlocalizedName("tankBlock"), false); pumpBlock = (BlockPump) CompatHooks.INSTANCE.getBlock(BlockPump.class); - CoreProxy.proxy.registerBlock(pumpBlock.setUnlocalizedName("pumpBlock")); + BCRegistry.INSTANCE.registerBlock(pumpBlock.setUnlocalizedName("pumpBlock"), false); floodGateBlock = (BlockFloodGate) CompatHooks.INSTANCE.getBlock(BlockFloodGate.class); - CoreProxy.proxy.registerBlock(floodGateBlock.setUnlocalizedName("floodGateBlock")); + BCRegistry.INSTANCE.registerBlock(floodGateBlock.setUnlocalizedName("floodGateBlock"), false); refineryBlock = (BlockRefinery) CompatHooks.INSTANCE.getBlock(BlockRefinery.class); - CoreProxy.proxy.registerBlock(refineryBlock.setUnlocalizedName("refineryBlock")); + BCRegistry.INSTANCE.registerBlock(refineryBlock.setUnlocalizedName("refineryBlock"), false); chuteBlock = (BlockChute) CompatHooks.INSTANCE.getBlock(BlockChute.class); - CoreProxy.proxy.registerBlock(chuteBlock.setUnlocalizedName("chuteBlock")); + BCRegistry.INSTANCE.registerBlock(chuteBlock.setUnlocalizedName("blockChute"), false); FactoryProxy.proxy.initializeEntityRenders(); - FMLCommonHandler.instance().bus().register(this); + MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(this); } public static void loadRecipes() { if (miningWellBlock != null) { - CoreProxy.proxy.addCraftingRecipe(new ItemStack(miningWellBlock, 1), "ipi", "igi", "iPi", 'p', "dustRedstone", 'i', "ingotIron", 'g', + BCRegistry.INSTANCE.addCraftingRecipe(new ItemStack(miningWellBlock, 1), "ipi", "igi", "iPi", 'p', "dustRedstone", 'i', "ingotIron", 'g', "gearIron", 'P', Items.iron_pickaxe); } if (pumpBlock != null) { - CoreProxy.proxy.addCraftingRecipe(new ItemStack(pumpBlock), "ipi", "igi", "TBT", 'p', "dustRedstone", 'i', "ingotIron", 'T', tankBlock, - 'g', "gearIron", 'B', Items.bucket); + BCRegistry.INSTANCE.addCraftingRecipe(new ItemStack(pumpBlock), "ipi", "igi", "TBT", 'p', "dustRedstone", 'i', "ingotIron", 'T', + tankBlock, 'g', "gearIron", 'B', Items.bucket); } if (autoWorkbenchBlock != null) { - CoreProxy.proxy.addCraftingRecipe(new ItemStack(autoWorkbenchBlock), "gwg", 'w', Blocks.crafting_table, 'g', "gearStone"); + BCRegistry.INSTANCE.addCraftingRecipe(new ItemStack(autoWorkbenchBlock), "gwg", 'w', "craftingTableWood", 'g', "gearStone"); - CoreProxy.proxy.addCraftingRecipe(new ItemStack(autoWorkbenchBlock), "g", "w", "g", 'w', Blocks.crafting_table, 'g', "gearStone"); + BCRegistry.INSTANCE.addCraftingRecipe(new ItemStack(autoWorkbenchBlock), "g", "w", "g", 'w', "craftingTableWood", 'g', "gearStone"); } if (tankBlock != null) { - CoreProxy.proxy.addCraftingRecipe(new ItemStack(tankBlock), "ggg", "g g", "ggg", 'g', "blockGlass"); + BCRegistry.INSTANCE.addCraftingRecipe(new ItemStack(tankBlock), "ggg", "g g", "ggg", 'g', "blockGlass"); } if (refineryBlock != null) { - CoreProxy.proxy.addCraftingRecipe(new ItemStack(refineryBlock), "RTR", "TGT", 'T', tankBlock != null ? tankBlock : "blockGlass", 'G', + BCRegistry.INSTANCE.addCraftingRecipe(new ItemStack(refineryBlock), "RTR", "TGT", 'T', tankBlock != null ? tankBlock : "blockGlass", 'G', "gearDiamond", 'R', Blocks.redstone_torch); } if (chuteBlock != null) { - CoreProxy.proxy.addCraftingRecipe(new ItemStack(chuteBlock), "ICI", " G ", 'I', "ingotIron", 'C', Blocks.chest, 'G', "gearStone"); + BCRegistry.INSTANCE.addCraftingRecipe(new ItemStack(chuteBlock), "ICI", " G ", 'I', "ingotIron", 'C', "chestWood", 'G', "gearStone"); - CoreProxy.proxy.addShapelessRecipe(new ItemStack(chuteBlock), Blocks.hopper, "gearStone"); + BCRegistry.INSTANCE.addShapelessRecipe(new ItemStack(chuteBlock), Blocks.hopper, "gearStone"); } if (floodGateBlock != null) { - CoreProxy.proxy.addCraftingRecipe(new ItemStack(floodGateBlock), "IGI", "FTF", "IFI", 'I', "ingotIron", 'T', tankBlock != null ? tankBlock - : "blockGlass", 'G', "gearIron", 'F', new ItemStack(Blocks.iron_bars)); + BCRegistry.INSTANCE.addCraftingRecipe(new ItemStack(floodGateBlock), "IGI", "FTF", "IFI", 'I', "ingotIron", 'T', tankBlock != null + ? tankBlock : "blockGlass", 'G', "gearIron", 'F', new ItemStack(Blocks.iron_bars)); + } + + } + + @Mod.EventHandler + public void load(FMLInitializationEvent evt) { + NetworkRegistry.INSTANCE.registerGuiHandler(instance, new FactoryGuiHandler()); + + BCRegistry.INSTANCE.registerTileEntity(TileMiningWell.class, "buildcraft.factory.MiningWell", "MiningWell"); + BCRegistry.INSTANCE.registerTileEntity(TileAutoWorkbench.class, "buildcraft.factory.AutoWorkbench", "AutoWorkbench"); + BCRegistry.INSTANCE.registerTileEntity(TilePump.class, "buildcraft.factory.Pump", "net.minecraft.src.buildcraft.factory.TilePump"); + BCRegistry.INSTANCE.registerTileEntity(TileFloodGate.class, "buildcraft.factory.FloodGate", + "net.minecraft.src.buildcraft.factory.TileFloodGate"); + BCRegistry.INSTANCE.registerTileEntity(TileTank.class, "buildcraft.factory.Tank", "net.minecraft.src.buildcraft.factory.TileTank"); + BCRegistry.INSTANCE.registerTileEntity(TileRefinery.class, "buildcraft.factory.Refinery", "net.minecraft.src.buildcraft.factory.Refinery"); + BCRegistry.INSTANCE.registerTileEntity(TileChute.class, "buildcraft.factory.Chute", "net.minecraft.src.buildcraft.factory.TileHopper"); + + FactoryProxy.proxy.initializeTileEntities(); + + BuilderAPI.schematicRegistry.registerSchematicBlock(refineryBlock, SchematicRefinery.class); + BuilderAPI.schematicRegistry.registerSchematicBlock(tankBlock, SchematicTileIgnoreState.class); + BuilderAPI.schematicRegistry.registerSchematicBlock(pumpBlock, SchematicPump.class); + BuilderAPI.schematicRegistry.registerSchematicBlock(floodGateBlock, SchematicTileIgnoreState.class); + BuilderAPI.schematicRegistry.registerSchematicBlock(autoWorkbenchBlock, SchematicAutoWorkbench.class); + BuilderAPI.schematicRegistry.registerSchematicBlock(chuteBlock, SchematicTile.class); + BuilderAPI.schematicRegistry.registerSchematicBlock(plainPipeBlock, SchematicFree.class); + + aLotOfCraftingAchievement = BuildCraftCore.achievementManager.registerAchievement(new Achievement("achievement.aLotOfCrafting", + "aLotOfCraftingAchievement", 1, 2, autoWorkbenchBlock, BuildCraftCore.woodenGearAchievement)); + straightDownAchievement = BuildCraftCore.achievementManager.registerAchievement(new Achievement("achievement.straightDown", + "straightDownAchievement", 5, 2, miningWellBlock, BuildCraftCore.ironGearAchievement)); + refineAndRedefineAchievement = BuildCraftCore.achievementManager.registerAchievement(new Achievement("achievement.refineAndRedefine", + "refineAndRedefineAchievement", 10, 0, refineryBlock, BuildCraftCore.diamondGearAchievement)); + + if (BuildCraftCore.loadDefaultRecipes) { + loadRecipes(); } } @@ -204,7 +203,7 @@ public void reloadConfig(ConfigManager.RestartRequirement restartType) { reloadConfig(ConfigManager.RestartRequirement.NONE); } else { miningDepth = BuildCraftCore.mainConfigManager.get("general.miningDepth").getInt(); - pumpsNeedRealPower = BuildCraftCore.mainConfigManager.get("general.pumpsNeedRealPower").getBoolean(); + pumpsNeedRealPower = BuildCraftCore.mainConfigManager.get("general.pumpsNeedRealPower").getBoolean(); pumpDimensionList = new PumpDimensionList(BuildCraftCore.mainConfigManager.get("general.pumpDimensionControl").getString()); if (BuildCraftCore.mainConfiguration.hasChanged()) { diff --git a/common/buildcraft/BuildCraftMod.java b/common/buildcraft/BuildCraftMod.java index 3dc71df049..b018e4a4ca 100644 --- a/common/buildcraft/BuildCraftMod.java +++ b/common/buildcraft/BuildCraftMod.java @@ -1,11 +1,18 @@ -/** 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 */ +/** + * 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; import java.util.EnumMap; +import java.util.List; import java.util.Map; +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.Executor; import java.util.concurrent.Executors; @@ -13,6 +20,9 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.network.NetHandlerPlayServer; +import net.minecraft.server.MinecraftServer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockPos; import net.minecraft.util.Vec3; @@ -29,6 +39,7 @@ import buildcraft.api.core.IBuildCraftMod; import buildcraft.core.DefaultProps; import buildcraft.core.lib.network.base.Packet; +import buildcraft.core.lib.utils.ThreadSafeUtils; import buildcraft.core.lib.utils.Utils; public class BuildCraftMod implements IBuildCraftMod { @@ -195,7 +206,7 @@ public Property getOption(String name) { return null; } - /** WaRNING: INTERNAL USE ONLY! */ + /** WARNING: INTERNAL USE ONLY! */ public void putOption(String name, Property value) { options.put(name, value); } diff --git a/common/buildcraft/BuildCraftRobotics.java b/common/buildcraft/BuildCraftRobotics.java index f715c3dc29..6a99aa56fe 100644 --- a/common/buildcraft/BuildCraftRobotics.java +++ b/common/buildcraft/BuildCraftRobotics.java @@ -1,5 +1,5 @@ /** 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; @@ -14,7 +14,6 @@ import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.stats.Achievement; import net.minecraftforge.client.event.ModelBakeEvent; import net.minecraftforge.common.DimensionManager; @@ -22,31 +21,26 @@ import net.minecraftforge.fml.client.event.ConfigChangedEvent; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.common.event.FMLInitializationEvent; -import net.minecraftforge.fml.common.event.FMLInterModComms; -import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; -import net.minecraftforge.fml.common.event.FMLServerStartingEvent; -import net.minecraftforge.fml.common.event.FMLServerStoppingEvent; +import net.minecraftforge.fml.common.event.*; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.registry.EntityRegistry; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import buildcraft.api.blueprints.BuilderAPI; +import buildcraft.api.blueprints.SchematicTile; import buildcraft.api.boards.RedstoneBoardRegistry; +import buildcraft.api.lists.ListRegistry; import buildcraft.api.recipes.BuildcraftRecipeRegistry; import buildcraft.api.robots.RobotManager; import buildcraft.api.statements.IActionInternal; import buildcraft.api.statements.ITriggerInternal; import buildcraft.api.statements.StatementManager; import buildcraft.api.transport.PipeManager; -import buildcraft.core.BCCreativeTab; -import buildcraft.core.CompatHooks; -import buildcraft.core.DefaultProps; -import buildcraft.core.InterModComms; +import buildcraft.core.*; import buildcraft.core.config.ConfigManager; import buildcraft.core.network.EntityIds; -import buildcraft.core.proxy.CoreProxy; import buildcraft.robotics.*; import buildcraft.robotics.ai.*; import buildcraft.robotics.boards.*; @@ -85,13 +79,10 @@ public class BuildCraftRobotics extends BuildCraftMod { public static IActionInternal actionStationAcceptFluids = new ActionStationAcceptFluids(); public static IActionInternal actionStationProvideFluids = new ActionStationProvideFluids(); public static IActionInternal actionStationForceRobot = new ActionStationForbidRobot(true); - public static IActionInternal actionStationForbidRobot = new ActionStationForbidRobot(true); + public static IActionInternal actionStationForbidRobot = new ActionStationForbidRobot(false); public static IActionInternal actionStationAcceptItems = new ActionStationAcceptItems(); public static IActionInternal actionStationMachineRequestItems = new ActionStationRequestItemsMachine(); - public static Achievement timeForSomeLogicAchievement; - public static Achievement tinglyLaserAchievement; - public static List blacklistedRobots; public static MapManager manager; @@ -107,22 +98,22 @@ public void preInit(FMLPreInitializationEvent evt) { reloadConfig(ConfigManager.RestartRequirement.GAME); robotItem = new ItemRobot().setUnlocalizedName("robot"); - CoreProxy.proxy.registerItem(robotItem); + BCRegistry.INSTANCE.registerItem(robotItem, false); robotStationItem = new ItemRobotStation().setUnlocalizedName("robotStation"); - CoreProxy.proxy.registerItem(robotStationItem); + BCRegistry.INSTANCE.registerItem(robotStationItem, false); redstoneBoard = new ItemRedstoneBoard(); redstoneBoard.setUnlocalizedName("redstone_board"); - CoreProxy.proxy.registerItem(redstoneBoard); + BCRegistry.INSTANCE.registerItem(redstoneBoard, false); zonePlanBlock = (BlockZonePlan) CompatHooks.INSTANCE.getBlock(BlockZonePlan.class); zonePlanBlock.setUnlocalizedName("zonePlan"); - CoreProxy.proxy.registerBlock(zonePlanBlock); + BCRegistry.INSTANCE.registerBlock(zonePlanBlock, false); requesterBlock = (BlockRequester) CompatHooks.INSTANCE.getBlock(BlockRequester.class); requesterBlock.setUnlocalizedName("requester"); - CoreProxy.proxy.registerBlock(requesterBlock); + BCRegistry.INSTANCE.registerBlock(requesterBlock, false); RedstoneBoardRegistry.instance = new ImplRedstoneBoardRegistry(); @@ -174,6 +165,8 @@ public void preInit(FMLPreInitializationEvent evt) { "yellow"), 512000); } + StatementManager.registerParameterClass(StatementParameterRobot.class); + StatementManager.registerParameterClass(StatementParameterMapLocation.class); StatementManager.registerActionProvider(new RobotsActionProvider()); StatementManager.registerTriggerProvider(new RobotsTriggerProvider()); } @@ -189,11 +182,13 @@ public void init(FMLInitializationEvent evt) { BCCreativeTab.get("boards").setIcon(new ItemStack(BuildCraftRobotics.redstoneBoard, 1)); + BuilderAPI.schematicRegistry.registerSchematicBlock(requesterBlock, SchematicTile.class); + PipeManager.registerPipePluggable(RobotStationPluggable.class, "robotStation"); EntityRegistry.registerModEntity(EntityRobot.class, "bcRobot", EntityIds.ROBOT, instance, 50, 1, true); - CoreProxy.proxy.registerTileEntity(TileZonePlan.class, "net.minecraft.src.buildcraft.commander.TileZonePlan"); - CoreProxy.proxy.registerTileEntity(TileRequester.class, "net.minecraft.src.buildcraft.commander.TileRequester"); + BCRegistry.INSTANCE.registerTileEntity(TileZonePlan.class, "net.minecraft.src.buildcraft.commander.TileZonePlan"); + BCRegistry.INSTANCE.registerTileEntity(TileRequester.class, "net.minecraft.src.buildcraft.commander.TileRequester"); RobotManager.registryProvider = new RobotRegistryProvider(); @@ -269,41 +264,49 @@ public void init(FMLInitializationEvent evt) { RobotManager.registerDockingStation(DockingStationPipe.class, "dockingStationPipe"); RoboticsProxy.proxy.registerRenderers(); + + ListRegistry.itemClassAsType.add(ItemRobot.class); } public static void loadRecipes() { - CoreProxy.proxy.addCraftingRecipe(new ItemStack(robotItem), "PPP", "PRP", "C C", 'P', "ingotIron", 'R', BuildCraftSilicon.redstoneCrystal, - 'C', ItemRedstoneChipset.Chipset.DIAMOND.getStack()); + BCRegistry.INSTANCE.addCraftingRecipe(new ItemStack(robotItem), "PPP", "PRP", "C C", 'P', "ingotIron", 'R', "crystalRedstone", 'C', + ItemRedstoneChipset.Chipset.DIAMOND.getStack()); - CoreProxy.proxy.addCraftingRecipe(new ItemStack(redstoneBoard), "PPP", "PRP", "PPP", 'R', "dustRedstone", 'P', Items.paper); + BCRegistry.INSTANCE.addCraftingRecipe(new ItemStack(redstoneBoard), "PPP", "PRP", "PPP", 'R', "dustRedstone", 'P', Items.paper); - CoreProxy.proxy.addCraftingRecipe(new ItemStack(zonePlanBlock, 1, 0), "IRI", "GMG", "IDI", 'M', Items.map, 'R', "dustRedstone", 'G', + BCRegistry.INSTANCE.addCraftingRecipe(new ItemStack(zonePlanBlock, 1, 0), "IRI", "GMG", "IDI", 'M', Items.map, 'R', "dustRedstone", 'G', "gearGold", 'D', "gearDiamond", 'I', "ingotIron"); - CoreProxy.proxy.addCraftingRecipe(new ItemStack(requesterBlock, 1, 0), "IPI", "GCG", "IRI", 'C', Blocks.chest, 'R', "dustRedstone", 'P', + BCRegistry.INSTANCE.addCraftingRecipe(new ItemStack(requesterBlock, 1, 0), "IPI", "GCG", "IRI", 'C', "chestWood", 'R', "dustRedstone", 'P', Blocks.piston, 'G', "gearIron", 'I', "ingotIron"); - CoreProxy.proxy.addCraftingRecipe(new ItemStack(robotStationItem), " ", " I ", "ICI", 'I', "ingotIron", 'C', + BCRegistry.INSTANCE.addCraftingRecipe(new ItemStack(robotStationItem), " ", " I ", "ICI", 'I', "ingotIron", 'C', ItemRedstoneChipset.Chipset.GOLD.getStack()); BuildcraftRecipeRegistry.programmingTable.addRecipe(new BoardProgrammingRecipe()); BuildcraftRecipeRegistry.integrationTable.addRecipe(new RobotIntegrationRecipe()); } - @Mod.EventHandler - public void serverUnload(FMLServerStoppingEvent event) { - if (managerThread != null) { + private void stopMapManager() { + if (manager != null) { manager.stop(); - manager.saveAllWorlds(); - managerThread.interrupt(); - MinecraftForge.EVENT_BUS.unregister(manager); + MinecraftForge.EVENT_BUS.unregister(manager); + } + + if (managerThread != null) { + managerThread.interrupt(); } managerThread = null; manager = null; } + @Mod.EventHandler + public void serverUnload(FMLServerStoppingEvent event) { + stopMapManager(); + } + @Mod.EventHandler public void serverLoad(FMLServerStartingEvent event) { File f = new File(DimensionManager.getCurrentSaveRootDirectory(), "buildcraft/zonemap"); @@ -314,13 +317,23 @@ public void serverLoad(FMLServerStartingEvent event) { e.printStackTrace(); } + stopMapManager(); + manager = new MapManager(f); managerThread = new Thread(manager); managerThread.start(); + BoardRobotPicker.onServerStart(); + + MinecraftForge.EVENT_BUS.register(manager); MinecraftForge.EVENT_BUS.register(manager); } + @Mod.EventHandler + public void serverLoadFinish(FMLServerStartedEvent event) { + manager.initialize(); + } + @Mod.EventHandler public void processRequests(FMLInterModComms.IMCEvent event) { InterModComms.processIMC(event); @@ -328,6 +341,7 @@ public void processRequests(FMLInterModComms.IMCEvent event) { public void reloadConfig(ConfigManager.RestartRequirement restartType) { if (restartType == ConfigManager.RestartRequirement.GAME) { + blacklistedRobots = new ArrayList(); blacklistedRobots.addAll(Arrays.asList(BuildCraftCore.mainConfigManager.get("general", "boards.blacklist").getStringList())); reloadConfig(ConfigManager.RestartRequirement.WORLD); diff --git a/common/buildcraft/BuildCraftSilicon.java b/common/buildcraft/BuildCraftSilicon.java index 02e30df658..d8a928ddfd 100644 --- a/common/buildcraft/BuildCraftSilicon.java +++ b/common/buildcraft/BuildCraftSilicon.java @@ -1,10 +1,11 @@ /** 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; import net.minecraft.block.Block; +import net.minecraft.block.BlockDispenser; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; @@ -12,7 +13,9 @@ import net.minecraft.stats.Achievement; import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.common.Optional; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLInterModComms; import net.minecraftforge.fml.common.event.FMLMissingMappingsEvent; @@ -23,7 +26,7 @@ import net.minecraftforge.oredict.OreDictionary; import buildcraft.api.recipes.BuildcraftRecipeRegistry; -import buildcraft.api.robots.RobotManager; +import buildcraft.core.BCRegistry; import buildcraft.core.CompatHooks; import buildcraft.core.DefaultProps; import buildcraft.core.InterModComms; @@ -32,9 +35,9 @@ import buildcraft.core.lib.network.base.ChannelHandler; import buildcraft.core.lib.network.base.PacketHandler; import buildcraft.core.network.EntityIds; -import buildcraft.core.proxy.CoreProxy; import buildcraft.silicon.*; import buildcraft.silicon.ItemRedstoneChipset.Chipset; +import buildcraft.transport.stripes.StripesHandlerDispenser; @Mod(name = "BuildCraft Silicon", version = DefaultProps.VERSION, useMetadata = false, modid = "BuildCraft|Silicon", dependencies = DefaultProps.DEPENDENCY_CORE) @@ -67,27 +70,31 @@ public void preInit(FMLPreInitializationEvent evt) { laserBlock = (BlockLaser) CompatHooks.INSTANCE.getBlock(BlockLaser.class); laserBlock.setUnlocalizedName("laserBlock"); - CoreProxy.proxy.registerBlock(laserBlock); + BCRegistry.INSTANCE.registerBlock(laserBlock, false); assemblyTableBlock = (BlockLaserTable) CompatHooks.INSTANCE.getBlock(BlockLaserTable.class); assemblyTableBlock.setUnlocalizedName("laserTableBlock"); - CoreProxy.proxy.registerBlock(assemblyTableBlock, ItemLaserTable.class); + BCRegistry.INSTANCE.registerBlock(assemblyTableBlock, ItemLaserTable.class, false); packagerBlock = (BlockPackager) CompatHooks.INSTANCE.getBlock(BlockPackager.class); packagerBlock.setUnlocalizedName("packagerBlock"); - CoreProxy.proxy.registerBlock(packagerBlock); + BCRegistry.INSTANCE.registerBlock(packagerBlock, false); redstoneChipset = new ItemRedstoneChipset(); redstoneChipset.setUnlocalizedName("redstoneChipset"); - CoreProxy.proxy.registerItem(redstoneChipset); + BCRegistry.INSTANCE.registerItem(redstoneChipset, false); + redstoneChipset.registerItemStacks(); packageItem = new ItemPackage(); packageItem.setUnlocalizedName("package"); - CoreProxy.proxy.registerItem(packageItem); + BCRegistry.INSTANCE.registerItem(packageItem, false); redstoneCrystal = (new ItemBuildCraft()).setUnlocalizedName("redstoneCrystal"); - CoreProxy.proxy.registerItem(redstoneCrystal); - OreDictionary.registerOre("redstoneCrystal", new ItemStack(redstoneCrystal)); + if (BCRegistry.INSTANCE.registerItem(redstoneCrystal, false)) { + OreDictionary.registerOre("redstoneCrystal", new ItemStack(redstoneCrystal)); // Deprecated + OreDictionary.registerOre("crystalRedstone", new ItemStack(redstoneCrystal)); + } + EntityRegistry.registerModEntity(EntityPackage.class, "bcPackageThrowable", EntityIds.PACKAGE_THROWABLE, instance, 48, 10, true); } @@ -96,24 +103,19 @@ public void init(FMLInitializationEvent evt) { channels = NetworkRegistry.INSTANCE.newChannel(DefaultProps.NET_CHANNEL_NAME + "-SILICON", new ChannelHandler(), new PacketHandler()); NetworkRegistry.INSTANCE.registerGuiHandler(instance, new SiliconGuiHandler()); - CoreProxy.proxy.registerTileEntity(TileLaser.class, "buildcraft.silicon.TileLaser", "net.minecraft.src.buildcraft.factory.TileLaser"); - CoreProxy.proxy.registerTileEntity(TileAssemblyTable.class, "buildcraft.silicon.TileAssemblyTable", + BCRegistry.INSTANCE.registerTileEntity(TileLaser.class, "buildcraft.silicon.TileLaser", "net.minecraft.src.buildcraft.factory.TileLaser"); + BCRegistry.INSTANCE.registerTileEntity(TileAssemblyTable.class, "buildcraft.silicon.TileAssemblyTable", "net.minecraft.src.buildcraft.factory.TileAssemblyTable"); - CoreProxy.proxy.registerTileEntity(TileAdvancedCraftingTable.class, "buildcraft.silicon.TileAdvancedCraftingTable", + BCRegistry.INSTANCE.registerTileEntity(TileAdvancedCraftingTable.class, "buildcraft.silicon.TileAdvancedCraftingTable", "net.minecraft.src.buildcraft.factory.TileAssemblyAdvancedWorkbench"); - CoreProxy.proxy.registerTileEntity(TileIntegrationTable.class, "buildcraft.silicon.TileIntegrationTable", + BCRegistry.INSTANCE.registerTileEntity(TileIntegrationTable.class, "buildcraft.silicon.TileIntegrationTable", "net.minecraft.src.buildcraft.factory.TileIntegrationTable"); - CoreProxy.proxy.registerTileEntity(TileChargingTable.class, "buildcraft.silicon.TileChargingTable", + BCRegistry.INSTANCE.registerTileEntity(TileChargingTable.class, "buildcraft.silicon.TileChargingTable", "net.minecraft.src.buildcraft.factory.TileChargingTable"); - CoreProxy.proxy.registerTileEntity(TileProgrammingTable.class, "buildcraft.silicon.TileProgrammingTable", + BCRegistry.INSTANCE.registerTileEntity(TileProgrammingTable.class, "buildcraft.silicon.TileProgrammingTable", "net.minecraft.src.buildcraft.factory.TileProgrammingTable"); - CoreProxy.proxy.registerTileEntity(TilePackager.class, "buildcraft.silicon.TilePackager", "buildcraft.TilePackager"); - CoreProxy.proxy.registerTileEntity(TileStampingTable.class, "buildcraft.silicon.TileStampingTable", "buildcraft.TileStampingTable"); - - // BuilderAPI.schematicRegistry.registerSchematicBlock(laserBlock, SchematicRotateMeta.class, new int[] { 2, 5, - // 3, 4 }, true); - - RobotManager.registerResourceId(ResourceIdAssemblyTable.class, "resourceIdAssemblyTable", "buildcraft.core.robots.ResourceIdAssemblyTable"); + BCRegistry.INSTANCE.registerTileEntity(TilePackager.class, "buildcraft.silicon.TilePackager", "buildcraft.TilePackager"); + BCRegistry.INSTANCE.registerTileEntity(TileStampingTable.class, "buildcraft.silicon.TileStampingTable", "buildcraft.TileStampingTable"); timeForSomeLogicAchievement = BuildCraftCore.achievementManager.registerAchievement(new Achievement("achievement.timeForSomeLogic", "timeForSomeLogicAchievement", 9, -2, assemblyTableBlock, BuildCraftCore.diamondGearAchievement)); @@ -124,45 +126,55 @@ public void init(FMLInitializationEvent evt) { loadRecipes(); } + BlockDispenser.dispenseBehaviorRegistry.putObject(packageItem, new ItemPackage.DispenseBehaviour()); + if (Loader.isModLoaded("BuildCraft|Transport")) { + initTransport(); + } + SiliconProxy.proxy.registerRenderers(); } + @Optional.Method(modid = "BuildCraft|Transport") + private void initTransport() { + StripesHandlerDispenser.items.add(packageItem); + } + public static void loadRecipes() { // TABLES - CoreProxy.proxy.addCraftingRecipe(new ItemStack(laserBlock), "ORR", "DDR", "ORR", 'O', Blocks.obsidian, 'R', "dustRedstone", 'D', + BCRegistry.INSTANCE.addCraftingRecipe(new ItemStack(laserBlock), "ORR", "DDR", "ORR", 'O', Blocks.obsidian, 'R', "dustRedstone", 'D', "gemDiamond"); - CoreProxy.proxy.addCraftingRecipe(new ItemStack(laserBlock), "RRO", "RDD", "RRO", 'O', Blocks.obsidian, 'R', "dustRedstone", 'D', + BCRegistry.INSTANCE.addCraftingRecipe(new ItemStack(laserBlock), "RRO", "RDD", "RRO", 'O', Blocks.obsidian, 'R', "dustRedstone", 'D', "gemDiamond"); - CoreProxy.proxy.addCraftingRecipe(new ItemStack(laserBlock), "RRR", "RDR", "ODO", 'O', Blocks.obsidian, 'R', "dustRedstone", 'D', + BCRegistry.INSTANCE.addCraftingRecipe(new ItemStack(laserBlock), "RRR", "RDR", "ODO", 'O', Blocks.obsidian, 'R', "dustRedstone", 'D', "gemDiamond"); - CoreProxy.proxy.addCraftingRecipe(new ItemStack(laserBlock), "ODO", "RDR", "RRR", 'O', Blocks.obsidian, 'R', "dustRedstone", 'D', + BCRegistry.INSTANCE.addCraftingRecipe(new ItemStack(laserBlock), "ODO", "RDR", "RRR", 'O', Blocks.obsidian, 'R', "dustRedstone", 'D', "gemDiamond"); - CoreProxy.proxy.addCraftingRecipe(new ItemStack(assemblyTableBlock, 1, 0), "ODO", "ORO", "OGO", 'O', Blocks.obsidian, 'R', "dustRedstone", + BCRegistry.INSTANCE.addCraftingRecipe(new ItemStack(assemblyTableBlock, 1, 0), "ODO", "ORO", "OGO", 'O', Blocks.obsidian, 'R', "dustRedstone", 'D', "gemDiamond", 'G', "gearDiamond"); - /* CoreProxy.proxy.addCraftingRecipe(new ItemStack(assemblyTableBlock, 1, 1), "OWO", "OCO", "ORO", 'O', + /* BCRegistry.INSTANCE.addCraftingRecipe(new ItemStack(assemblyTableBlock, 1, 1), "OWO", "OCO", "ORO", 'O', * Blocks.obsidian, 'W', Blocks.crafting_table, 'C', Blocks.chest, 'R', new ItemStack(redstoneChipset, 1, * 0)); */ - CoreProxy.proxy.addCraftingRecipe(new ItemStack(assemblyTableBlock, 1, 2), "OIO", "OCO", "OGO", 'O', Blocks.obsidian, 'I', "ingotGold", 'C', - new ItemStack(redstoneChipset, 1, 0), 'G', "gearDiamond"); + BCRegistry.INSTANCE.addCraftingRecipe(new ItemStack(assemblyTableBlock, 1, 2), "OIO", "OCO", "OGO", 'O', Blocks.obsidian, 'I', "ingotGold", + 'C', new ItemStack(redstoneChipset, 1, 0), 'G', "gearDiamond"); - CoreProxy.proxy.addCraftingRecipe(new ItemStack(assemblyTableBlock, 1, 3), "OIO", "OCO", "OGO", 'O', Blocks.obsidian, 'I', "dustRedstone", + BCRegistry.INSTANCE.addCraftingRecipe(new ItemStack(assemblyTableBlock, 1, 3), "OIO", "OCO", "OGO", 'O', Blocks.obsidian, 'I', "dustRedstone", 'C', new ItemStack(redstoneChipset, 1, 0), 'G', "gearGold"); - CoreProxy.proxy.addCraftingRecipe(new ItemStack(assemblyTableBlock, 1, 4), "OCO", "ORO", "OGO", 'O', Blocks.obsidian, 'R', new ItemStack( - redstoneChipset, 1, 0), 'C', Items.emerald, 'G', "gearDiamond"); + BCRegistry.INSTANCE.addCraftingRecipe(new ItemStack(assemblyTableBlock, 1, 4), "OCO", "ORO", "OGO", 'O', Blocks.obsidian, 'R', new ItemStack( + redstoneChipset, 1, 0), 'C', "gemEmerald", 'G', "gearDiamond"); - CoreProxy.proxy.addCraftingRecipe(new ItemStack(assemblyTableBlock, 1, 5), "OWO", "ORO", "OGO", 'O', Blocks.obsidian, 'W', - Blocks.crafting_table, 'G', "gearGold", 'R', new ItemStack(redstoneChipset, 1, 0)); + BCRegistry.INSTANCE.addCraftingRecipe(new ItemStack(assemblyTableBlock, 1, 5), "OWO", "ORO", "OGO", 'O', Blocks.obsidian, 'W', + "craftingTableWood", 'G', "gearGold", 'R', new ItemStack(redstoneChipset, 1, 0)); - CoreProxy.proxy.addCraftingRecipe(new ItemStack(packagerBlock, 1, 0), " I ", "ICI", " P ", 'I', "ingotIron", 'C', Blocks.crafting_table, 'P', - Blocks.piston); + BCRegistry.INSTANCE.addCraftingRecipe(new ItemStack(packagerBlock, 1, 0), " I ", "ICI", " P ", 'I', "ingotIron", 'C', "craftingTableWood", + 'P', Blocks.piston); // CHIPSETS BuildcraftRecipeRegistry.assemblyTable.addRecipe("buildcraft:redstoneChipset", Math.round(100000 * chipsetCostMultiplier), Chipset.RED @@ -188,7 +200,7 @@ public static void loadRecipes() { } @Mod.EventHandler - public void processRequests(FMLInterModComms.IMCEvent event) { + public void processIMCRequests(FMLInterModComms.IMCEvent event) { InterModComms.processIMC(event); } diff --git a/common/buildcraft/BuildCraftTransport.java b/common/buildcraft/BuildCraftTransport.java index 2be2fdff81..fdeb6dba4a 100644 --- a/common/buildcraft/BuildCraftTransport.java +++ b/common/buildcraft/BuildCraftTransport.java @@ -1,5 +1,5 @@ /** 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; @@ -7,6 +7,7 @@ import java.io.PrintWriter; import java.util.LinkedList; +import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.init.Blocks; @@ -28,14 +29,8 @@ import net.minecraftforge.fml.client.event.ConfigChangedEvent; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.common.event.FMLInitializationEvent; -import net.minecraftforge.fml.common.event.FMLInterModComms; +import net.minecraftforge.fml.common.event.*; import net.minecraftforge.fml.common.event.FMLInterModComms.IMCEvent; -import net.minecraftforge.fml.common.event.FMLMissingMappingsEvent; -import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; -import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; -import net.minecraftforge.fml.common.event.FMLServerStartingEvent; -import net.minecraftforge.fml.common.event.FMLServerStoppingEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import net.minecraftforge.fml.common.network.NetworkRegistry; @@ -46,11 +41,13 @@ import net.minecraftforge.oredict.ShapedOreRecipe; import buildcraft.api.blueprints.BuilderAPI; +import buildcraft.api.blueprints.SchematicTile; import buildcraft.api.core.BCLog; import buildcraft.api.core.EnumColor; import buildcraft.api.facades.FacadeAPI; import buildcraft.api.gates.GateExpansions; import buildcraft.api.gates.IGateExpansion; +import buildcraft.api.lists.ListRegistry; import buildcraft.api.statements.IActionInternal; import buildcraft.api.statements.ITriggerInternal; import buildcraft.api.statements.StatementManager; @@ -58,46 +55,25 @@ import buildcraft.api.transport.PipeConnectionAPI; import buildcraft.api.transport.PipeManager; import buildcraft.api.transport.PipeWire; -import buildcraft.core.BCCreativeTab; -import buildcraft.core.CompatHooks; -import buildcraft.core.DefaultProps; -import buildcraft.core.InterModComms; -import buildcraft.core.PowerMode; +import buildcraft.core.*; import buildcraft.core.config.ConfigManager; import buildcraft.core.lib.items.ItemBuildCraft; import buildcraft.core.lib.network.base.ChannelHandler; import buildcraft.core.lib.network.base.PacketHandler; import buildcraft.core.lib.utils.ColorUtils; import buildcraft.core.lib.utils.ModelHelper; -import buildcraft.core.lib.utils.Utils; -import buildcraft.core.proxy.CoreProxy; import buildcraft.transport.*; import buildcraft.transport.block.BlockPipe; -import buildcraft.transport.gates.GateDefinition; +import buildcraft.transport.gates.*; import buildcraft.transport.gates.GateDefinition.GateLogic; import buildcraft.transport.gates.GateDefinition.GateMaterial; -import buildcraft.transport.gates.GateExpansionLightSensor; -import buildcraft.transport.gates.GateExpansionPulsar; -import buildcraft.transport.gates.GateExpansionRedstoneFader; -import buildcraft.transport.gates.GateExpansionTimer; -import buildcraft.transport.gates.GatePluggable; -import buildcraft.transport.gates.ItemGate; -import buildcraft.transport.network.PacketFluidUpdate; -import buildcraft.transport.network.PacketPipeTransportItemStack; -import buildcraft.transport.network.PacketPipeTransportItemStackRequest; -import buildcraft.transport.network.PacketPipeTransportTraveler; -import buildcraft.transport.network.PacketPowerUpdate; +import buildcraft.transport.network.*; import buildcraft.transport.pipes.*; -import buildcraft.transport.pipes.bc8.TilePipe_BC8; -import buildcraft.transport.pluggable.ItemLens; -import buildcraft.transport.pluggable.ItemPlug; -import buildcraft.transport.pluggable.LensPluggable; -import buildcraft.transport.pluggable.PlugPluggable; +import buildcraft.transport.pluggable.*; import buildcraft.transport.render.PipeBlockModel; import buildcraft.transport.render.PipeItemModel; -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.*; import buildcraft.transport.statements.ActionValve.ValveState; @@ -115,6 +91,7 @@ public class BuildCraftTransport extends BuildCraftMod { public static boolean facadeTreatBlacklistAsWhitelist; public static boolean additionalWaterproofingRecipe; public static boolean facadeForceNonLaserRecipe; + public static boolean showAllFacadesCreative; public static BlockGenericPipe genericPipeBlock; public static BlockFilteredBuffer filteredBufferBlock; @@ -156,6 +133,7 @@ public class BuildCraftTransport extends BuildCraftMod { public static Item pipeFluidsSandstone; public static Item pipeFluidsEmerald; public static Item pipeFluidsDiamond; + public static Item pipeFluidsClay; public static Item pipePowerWood; public static Item pipePowerCobblestone; public static Item pipePowerStone; @@ -211,7 +189,6 @@ public void preInit(FMLPreInitializationEvent evt) { // TODO Fluid shader rendering // FluidShaderManager.INSTANCE.getRenderer(null); new BCCreativeTab("pipes"); - new BCCreativeTab("facades"); new BCCreativeTab("neptune"); if (Loader.isModLoaded("BuildCraft|Silicon")) { new BCCreativeTab("gates"); @@ -227,18 +204,28 @@ public void preInit(FMLPreInitializationEvent evt) { "What should the base flow rate of a fluid pipe be?", ConfigManager.RestartRequirement.GAME).setMinValue(1).setMaxValue(40); BuildCraftCore.mainConfigManager.register("debug.printFacadeList", false, "Print a list of all registered facades.", ConfigManager.RestartRequirement.GAME); + BuildCraftCore.mainConfigManager.register("general.pipes.facadeShowAllInCreative", true, + "Should all BC facades be shown in Creative/NEI, or just a few carefully chosen ones?", ConfigManager.RestartRequirement.GAME); BuildCraftCore.mainConfigManager.register("general.pipes.slimeballWaterproofRecipe", false, "Should I enable an alternate Waterproof recipe, based on slimeballs?", ConfigManager.RestartRequirement.GAME); BuildCraftCore.mainConfigManager.register("power.gateCostMultiplier", 1.0D, "What should be the multiplier of all gate power costs?", ConfigManager.RestartRequirement.GAME); - BuildCraftCore.mainConfigManager.register("general.pipes.facadeBlacklist", new String[] { Utils.getNameForBlock(Blocks.bedrock), Utils - .getNameForBlock(Blocks.command_block), Utils.getNameForBlock(Blocks.end_portal_frame), Utils.getNameForBlock(Blocks.grass), Utils - .getNameForBlock(Blocks.leaves), Utils.getNameForBlock(Blocks.leaves2), Utils.getNameForBlock(Blocks.lit_pumpkin), Utils - .getNameForBlock(Blocks.lit_redstone_lamp), Utils.getNameForBlock(Blocks.mob_spawner), Utils.getNameForBlock( - Blocks.monster_egg), Utils.getNameForBlock(Blocks.redstone_lamp), Utils.getNameForBlock( - Blocks.double_stone_slab), Utils.getNameForBlock(Blocks.double_wooden_slab), Utils - .getNameForBlock(Blocks.sponge) }, - "What block types should be blacklisted from being a facade?", ConfigManager.RestartRequirement.GAME); + BuildCraftCore.mainConfigManager.register("general.pipes.facadeBlacklist", new String[] { + //@formatter:off + Block.blockRegistry.getNameForObject(Blocks.end_portal_frame).toString(), + Block.blockRegistry.getNameForObject(Blocks.grass).toString(), + Block.blockRegistry.getNameForObject(Blocks.leaves).toString(), + Block.blockRegistry.getNameForObject(Blocks.leaves2).toString(), + Block.blockRegistry.getNameForObject(Blocks.lit_pumpkin).toString(), + Block.blockRegistry.getNameForObject(Blocks.lit_redstone_lamp).toString(), + Block.blockRegistry.getNameForObject(Blocks.mob_spawner).toString(), + Block.blockRegistry.getNameForObject(Blocks.monster_egg).toString(), + Block.blockRegistry.getNameForObject(Blocks.redstone_lamp).toString(), + Block.blockRegistry.getNameForObject(Blocks.double_stone_slab).toString(), + Block.blockRegistry.getNameForObject(Blocks.double_wooden_slab).toString(), + Block.blockRegistry.getNameForObject(Blocks.sponge).toString() + //@formatter:on + }, "What block types should be blacklisted from being a facade?", ConfigManager.RestartRequirement.GAME); BuildCraftCore.mainConfigManager.register("general.pipes.facadeBlacklistAsWhitelist", false, "Should the blacklist be treated as a whitelist instead?", ConfigManager.RestartRequirement.GAME); BuildCraftCore.mainConfigManager.register("general.pipes.facadeNoLaserRecipe", false, @@ -246,89 +233,88 @@ public void preInit(FMLPreInitializationEvent evt) { reloadConfig(ConfigManager.RestartRequirement.GAME); + if (showAllFacadesCreative) { + new BCCreativeTab("facades"); + } + filteredBufferBlock = new BlockFilteredBuffer(); - CoreProxy.proxy.registerBlock(filteredBufferBlock.setUnlocalizedName("filteredBufferBlock")); + BCRegistry.INSTANCE.registerBlock(filteredBufferBlock.setUnlocalizedName("filteredBufferBlock"), false); pipeWaterproof = new ItemBuildCraft(); - pipeWaterproof.setUnlocalizedName("pipeWaterproof"); - CoreProxy.proxy.registerItem(pipeWaterproof); + BCRegistry.INSTANCE.registerItem(pipeWaterproof, false); genericPipeBlock = (BlockGenericPipe) CompatHooks.INSTANCE.getBlock(BlockGenericPipe.class); - - CoreProxy.proxy.registerBlock(genericPipeBlock.setUnlocalizedName("pipeBlock"), ItemBlock.class); - - pipeBlock = new BlockPipe(); - CoreProxy.proxy.registerBlock(pipeBlock.setUnlocalizedName("pipe_block_neptune"), null); - - BCCreativeTab pipeTab = BCCreativeTab.get("pipes"); - pipeItemsWood = buildPipe(PipeItemsWood.class, pipeTab, "plankWood", "blockGlassColorless", "plankWood"); - pipeItemsEmerald = buildPipe(PipeItemsEmerald.class, pipeTab, "gemEmerald", "blockGlassColorless", "gemEmerald"); - pipeItemsCobblestone = buildPipe(PipeItemsCobblestone.class, pipeTab, "cobblestone", "blockGlassColorless", "cobblestone"); - pipeItemsStone = buildPipe(PipeItemsStone.class, pipeTab, "stone", "blockGlassColorless", "stone"); - pipeItemsQuartz = buildPipe(PipeItemsQuartz.class, pipeTab, "blockQuartz", "blockGlassColorless", "blockQuartz"); - pipeItemsIron = buildPipe(PipeItemsIron.class, pipeTab, "ingotIron", "blockGlassColorless", "ingotIron"); - pipeItemsGold = buildPipe(PipeItemsGold.class, pipeTab, "ingotGold", "blockGlassColorless", "ingotGold"); - pipeItemsDiamond = buildPipe(PipeItemsDiamond.class, pipeTab, "gemDiamond", "blockGlassColorless", "gemDiamond"); - pipeItemsObsidian = buildPipe(PipeItemsObsidian.class, pipeTab, Blocks.obsidian, "blockGlassColorless", Blocks.obsidian); - pipeItemsLapis = buildPipe(PipeItemsLapis.class, pipeTab, "blockLapis", "blockGlassColorless", "blockLapis"); - pipeItemsDaizuli = buildPipe(PipeItemsDaizuli.class, pipeTab, "blockLapis", "blockGlassColorless", "gemDiamond"); - pipeItemsSandstone = buildPipe(PipeItemsSandstone.class, pipeTab, Blocks.sandstone, "blockGlassColorless", Blocks.sandstone); - pipeItemsVoid = buildPipe(PipeItemsVoid.class, pipeTab, "dyeBlack", "blockGlassColorless", "dustRedstone"); - pipeItemsEmzuli = buildPipe(PipeItemsEmzuli.class, pipeTab, "blockLapis", "blockGlassColorless", "gemEmerald"); - pipeItemsStripes = buildPipe(PipeItemsStripes.class, pipeTab, "gearGold", "blockGlassColorless", "gearGold"); - pipeItemsClay = buildPipe(PipeItemsClay.class, pipeTab, Blocks.clay, "blockGlassColorless", Blocks.clay); - - pipeFluidsWood = buildPipe(PipeFluidsWood.class, pipeTab, pipeWaterproof, pipeItemsWood); - pipeFluidsCobblestone = buildPipe(PipeFluidsCobblestone.class, pipeTab, pipeWaterproof, pipeItemsCobblestone); - pipeFluidsStone = buildPipe(PipeFluidsStone.class, pipeTab, pipeWaterproof, pipeItemsStone); - pipeFluidsQuartz = buildPipe(PipeFluidsQuartz.class, pipeTab, pipeWaterproof, pipeItemsQuartz); - pipeFluidsIron = buildPipe(PipeFluidsIron.class, pipeTab, pipeWaterproof, pipeItemsIron); - pipeFluidsGold = buildPipe(PipeFluidsGold.class, pipeTab, pipeWaterproof, pipeItemsGold); - pipeFluidsEmerald = buildPipe(PipeFluidsEmerald.class, pipeTab, pipeWaterproof, pipeItemsEmerald); - pipeFluidsDiamond = buildPipe(PipeFluidsDiamond.class, pipeTab, pipeWaterproof, pipeItemsDiamond); - pipeFluidsSandstone = buildPipe(PipeFluidsSandstone.class, pipeTab, pipeWaterproof, pipeItemsSandstone); - pipeFluidsVoid = buildPipe(PipeFluidsVoid.class, pipeTab, pipeWaterproof, pipeItemsVoid); - - pipePowerWood = buildPipe(PipePowerWood.class, pipeTab, "dustRedstone", pipeItemsWood); - pipePowerCobblestone = buildPipe(PipePowerCobblestone.class, pipeTab, "dustRedstone", pipeItemsCobblestone); - pipePowerStone = buildPipe(PipePowerStone.class, pipeTab, "dustRedstone", pipeItemsStone); - pipePowerQuartz = buildPipe(PipePowerQuartz.class, pipeTab, "dustRedstone", pipeItemsQuartz); - pipePowerIron = buildPipe(PipePowerIron.class, pipeTab, "dustRedstone", pipeItemsIron); - pipePowerGold = buildPipe(PipePowerGold.class, pipeTab, "dustRedstone", pipeItemsGold); - pipePowerDiamond = buildPipe(PipePowerDiamond.class, pipeTab, "dustRedstone", pipeItemsDiamond); - pipePowerEmerald = buildPipe(PipePowerEmerald.class, pipeTab, "dustRedstone", pipeItemsEmerald); - pipePowerSandstone = buildPipe(PipePowerSandstone.class, pipeTab, "dustRedstone", pipeItemsSandstone); - - pipeStructureCobblestone = buildPipe(PipeStructureCobblestone.class, pipeTab, Blocks.gravel, pipeItemsCobblestone); + BCRegistry.INSTANCE.registerBlock(genericPipeBlock.setUnlocalizedName("pipeBlock"), ItemBlock.class, true); + + pipeItemsWood = buildPipe(PipeItemsWood.class, "plankWood", "blockGlassColorless", "plankWood"); + pipeItemsEmerald = buildPipe(PipeItemsEmerald.class, "gemEmerald", "blockGlassColorless", "gemEmerald"); + pipeItemsCobblestone = buildPipe(PipeItemsCobblestone.class, "cobblestone", "blockGlassColorless", "cobblestone"); + pipeItemsStone = buildPipe(PipeItemsStone.class, "stone", "blockGlassColorless", "stone"); + pipeItemsQuartz = buildPipe(PipeItemsQuartz.class, "blockQuartz", "blockGlassColorless", "blockQuartz"); + pipeItemsIron = buildPipe(PipeItemsIron.class, "ingotIron", "blockGlassColorless", "ingotIron"); + pipeItemsGold = buildPipe(PipeItemsGold.class, "ingotGold", "blockGlassColorless", "ingotGold"); + pipeItemsDiamond = buildPipe(PipeItemsDiamond.class, "gemDiamond", "blockGlassColorless", "gemDiamond"); + pipeItemsObsidian = buildPipe(PipeItemsObsidian.class, Blocks.obsidian, "blockGlassColorless", Blocks.obsidian); + pipeItemsLapis = buildPipe(PipeItemsLapis.class, "blockLapis", "blockGlassColorless", "blockLapis"); + pipeItemsDaizuli = buildPipe(PipeItemsDaizuli.class, "blockLapis", "blockGlassColorless", "gemDiamond"); + pipeItemsSandstone = buildPipe(PipeItemsSandstone.class, Blocks.sandstone, "blockGlassColorless", Blocks.sandstone); + pipeItemsVoid = buildPipe(PipeItemsVoid.class, "dyeBlack", "blockGlassColorless", "dustRedstone"); + pipeItemsEmzuli = buildPipe(PipeItemsEmzuli.class, "blockLapis", "blockGlassColorless", "gemEmerald"); + pipeItemsStripes = buildPipe(PipeItemsStripes.class, "gearGold", "blockGlassColorless", "gearGold"); + pipeItemsClay = buildPipe(PipeItemsClay.class, Blocks.clay, "blockGlassColorless", Blocks.clay); + + pipeFluidsWood = buildPipe(PipeFluidsWood.class, pipeWaterproof, pipeItemsWood); + pipeFluidsCobblestone = buildPipe(PipeFluidsCobblestone.class, pipeWaterproof, pipeItemsCobblestone); + pipeFluidsStone = buildPipe(PipeFluidsStone.class, pipeWaterproof, pipeItemsStone); + pipeFluidsQuartz = buildPipe(PipeFluidsQuartz.class, pipeWaterproof, pipeItemsQuartz); + pipeFluidsIron = buildPipe(PipeFluidsIron.class, pipeWaterproof, pipeItemsIron); + pipeFluidsGold = buildPipe(PipeFluidsGold.class, pipeWaterproof, pipeItemsGold); + pipeFluidsEmerald = buildPipe(PipeFluidsEmerald.class, pipeWaterproof, pipeItemsEmerald); + pipeFluidsDiamond = buildPipe(PipeFluidsDiamond.class, pipeWaterproof, pipeItemsDiamond); + pipeFluidsSandstone = buildPipe(PipeFluidsSandstone.class, pipeWaterproof, pipeItemsSandstone); + pipeFluidsVoid = buildPipe(PipeFluidsVoid.class, pipeWaterproof, pipeItemsVoid); + pipeFluidsClay = buildPipe(PipeFluidsClay.class, pipeWaterproof, pipeItemsClay); + + pipePowerWood = buildPipe(PipePowerWood.class, "dustRedstone", pipeItemsWood); + pipePowerCobblestone = buildPipe(PipePowerCobblestone.class, "dustRedstone", pipeItemsCobblestone); + pipePowerStone = buildPipe(PipePowerStone.class, "dustRedstone", pipeItemsStone); + pipePowerQuartz = buildPipe(PipePowerQuartz.class, "dustRedstone", pipeItemsQuartz); + pipePowerIron = buildPipe(PipePowerIron.class, "dustRedstone", pipeItemsIron); + pipePowerGold = buildPipe(PipePowerGold.class, "dustRedstone", pipeItemsGold); + pipePowerDiamond = buildPipe(PipePowerDiamond.class, "dustRedstone", pipeItemsDiamond); + pipePowerEmerald = buildPipe(PipePowerEmerald.class, "dustRedstone", pipeItemsEmerald); + pipePowerSandstone = buildPipe(PipePowerSandstone.class, "dustRedstone", pipeItemsSandstone); + + pipeStructureCobblestone = buildPipe(PipeStructureCobblestone.class, Blocks.cobblestone, Blocks.gravel, Blocks.cobblestone); pipeWire = new ItemPipeWire(); - CoreProxy.proxy.registerItem(pipeWire); + BCRegistry.INSTANCE.registerItem(pipeWire, false); PipeWire.item = pipeWire; pipeGate = new ItemGate(); pipeGate.setUnlocalizedName("pipeGate"); - CoreProxy.proxy.registerItem(pipeGate); + BCRegistry.INSTANCE.registerItem(pipeGate, false); facadeItem = new ItemFacade(); facadeItem.setUnlocalizedName("pipeFacade"); - CoreProxy.proxy.registerItem(facadeItem); + BCRegistry.INSTANCE.registerItem(facadeItem, false); FacadeAPI.facadeItem = facadeItem; plugItem = new ItemPlug(); plugItem.setUnlocalizedName("pipePlug"); - CoreProxy.proxy.registerItem(plugItem); + BCRegistry.INSTANCE.registerItem(plugItem, false); lensItem = new ItemLens(); lensItem.setUnlocalizedName("pipeLens"); - CoreProxy.proxy.registerItem(lensItem); + BCRegistry.INSTANCE.registerItem(lensItem, false); - // powerAdapterItem = new ItemPowerAdapter(); - // powerAdapterItem.setUnlocalizedName("pipePowerAdapter"); - // CoreProxy.proxy.registerItem(powerAdapterItem); + powerAdapterItem = new ItemPowerAdapter(); + powerAdapterItem.setUnlocalizedName("pipePowerAdapter"); + BCRegistry.INSTANCE.registerItem(powerAdapterItem, false); gateCopier = new ItemGateCopier(); - CoreProxy.proxy.registerItem(gateCopier); + BCRegistry.INSTANCE.registerItem(gateCopier, false); for (PipeContents kind : PipeContents.values()) { triggerPipe[kind.ordinal()] = new TriggerPipeContents(kind); @@ -392,21 +378,33 @@ public void init(FMLInitializationEvent evt) { TransportProxy.proxy.registerTileEntities(); BuilderAPI.schematicRegistry.registerSchematicBlock(genericPipeBlock, SchematicPipe.class); + BuilderAPI.schematicRegistry.registerSchematicBlock(filteredBufferBlock, SchematicTile.class); + + new BptPipeRotatable(pipeItemsWood); + new BptPipeRotatable(pipeFluidsWood); + new BptPipeRotatable(pipeItemsIron); + new BptPipeRotatable(pipeFluidsIron); + new BptPipeRotatable(pipeItemsEmerald); + new BptPipeRotatable(pipeFluidsEmerald); - new BptPipeIron(pipeItemsIron); - new BptPipeIron(pipeFluidsIron); - new BptPipeIron(pipePowerIron); + new BptPipeRotatable(pipeItemsDaizuli); + new BptPipeRotatable(pipeItemsEmzuli); - new BptPipeWooden(pipeItemsWood); - new BptPipeWooden(pipeFluidsWood); - new BptPipeWooden(pipePowerWood); - new BptPipeWooden(pipeItemsEmerald); + for (Item itemPipe : BlockGenericPipe.pipes.keySet()) { + Class> klazz = BlockGenericPipe.pipes.get(itemPipe); - new BptItemPipeFilters(pipeItemsDiamond); + if (IDiamondPipe.class.isAssignableFrom(klazz)) { + new BptPipeFiltered(itemPipe); + } + } + + PipeEventBus.registerGlobalHandler(new LensFilterHandler()); BCCreativeTab.get("pipes").setIcon(new ItemStack(BuildCraftTransport.pipeItemsDiamond, 1)); - BCCreativeTab.get("facades").setIcon(facadeItem.getFacadeForBlock(Blocks.brick_block.getDefaultState())); BCCreativeTab.get("neptune").setIcon(new ItemStack(Items.cake)); + if (showAllFacadesCreative) { + BCCreativeTab.get("facades").setIcon(facadeItem.getFacadeForBlock(Blocks.brick_block.getDefaultState())); + } if (Loader.isModLoaded("BuildCraft|Silicon")) { BCCreativeTab.get("gates").setIcon(ItemGate.makeGateItem(GateMaterial.DIAMOND, GateLogic.AND)); } @@ -443,6 +441,7 @@ public void init(FMLInitializationEvent evt) { PipeManager.registerPipePluggable(GatePluggable.class, "gate"); PipeManager.registerPipePluggable(LensPluggable.class, "lens"); PipeManager.registerPipePluggable(PlugPluggable.class, "plug"); + PipeManager.registerPipePluggable(PowerAdapterPluggable.class, "powerAdapter"); GateExpansions.registerExpansion(GateExpansionPulsar.INSTANCE); GateExpansions.registerExpansion(GateExpansionTimer.INSTANCE); @@ -491,6 +490,10 @@ public void postInit(FMLPostInitializationEvent evt) { } TransportPipes_BC8.postInit(); + ListRegistry.itemClassAsType.add(ItemPipe.class); + ListRegistry.itemClassAsType.add(ItemGate.class); + ListRegistry.itemClassAsType.add(ItemFacade.class); + ListRegistry.itemClassAsType.add(ItemPipeWire.class); } public void reloadConfig(ConfigManager.RestartRequirement restartType) { @@ -502,6 +505,7 @@ public void reloadConfig(ConfigManager.RestartRequirement restartType) { debugPrintFacadeList = BuildCraftCore.mainConfigManager.get("debug.printFacadeList").getBoolean(); pipeFluidsBaseFlowRate = BuildCraftCore.mainConfigManager.get("general.pipes.baseFluidRate").getInt(); facadeForceNonLaserRecipe = BuildCraftCore.mainConfigManager.get("general.pipes.facadeNoLaserRecipe").getBoolean(); + showAllFacadesCreative = BuildCraftCore.mainConfigManager.get("general.pipes.facadeShowAllInCreative").getBoolean(); reloadConfig(ConfigManager.RestartRequirement.WORLD); } else if (restartType == ConfigManager.RestartRequirement.WORLD) { @@ -578,17 +582,17 @@ public void loadRecipes() { // Add pipe recipes for (PipeRecipe pipe : pipeRecipes) { if (pipe.isShapeless) { - CoreProxy.proxy.addShapelessRecipe(pipe.result, pipe.input); + BCRegistry.INSTANCE.addShapelessRecipe(pipe.result, pipe.input); } else { - CoreProxy.proxy.addCraftingRecipe(pipe.result, pipe.input); + BCRegistry.INSTANCE.addCraftingRecipe(pipe.result, pipe.input); } } GameRegistry.addRecipe(new PipeColoringRecipe()); RecipeSorter.register("buildcraft:pipecoloring", PipeColoringRecipe.class, RecipeSorter.Category.SHAPELESS, "after:minecraft:shapeless"); - CoreProxy.proxy.addCraftingRecipe(new ItemStack(filteredBufferBlock, 1), "wdw", "wcw", "wpw", 'w', "plankWood", 'd', - BuildCraftTransport.pipeItemsDiamond, 'c', Blocks.chest, 'p', Blocks.piston); + BCRegistry.INSTANCE.addCraftingRecipe(new ItemStack(filteredBufferBlock, 1), "wdw", "wcw", "wpw", 'w', "plankWood", 'd', + BuildCraftTransport.pipeItemsDiamond, 'c', "chestWood", 'p', Blocks.piston); // Facade turning helper GameRegistry.addRecipe(facadeItem.new FacadeRecipe()); @@ -596,17 +600,16 @@ public void loadRecipes() { // Pipe Plug GameRegistry.addShapelessRecipe(new ItemStack(plugItem, 4), new ItemStack(pipeStructureCobblestone)); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(powerAdapterItem, 4), "scs", "sbs", "sas", 's', pipeStructureCobblestone, 'a', + Items.redstone, 'b', "gearStone", 'c', "ingotGold")); if (Loader.isModLoaded("BuildCraft|Silicon")) { TransportSiliconRecipes.loadSiliconRecipes(); } else { BCLog.logger.warn("**********************************************"); BCLog.logger.warn("* You are using the BuildCraft Transport *"); - BCLog.logger.warn("* module WITHOUT the Silicon module. Certain *"); - BCLog.logger.warn("* crafting recipes will be unavailable, and *"); - BCLog.logger.warn("* you are HIGHLY encouraged to either add *"); - BCLog.logger.warn("* the module or add custom recipes for those *"); - BCLog.logger.warn("* parts of the mod. *"); + BCLog.logger.warn("* module WITHOUT the Silicon module. Gates *"); + BCLog.logger.warn("* will not be available. *"); BCLog.logger.warn("**********************************************"); // Alternate recipes @@ -626,10 +629,29 @@ public void processIMCRequests(IMCEvent event) { InterModComms.processIMC(event); } + public static Item buildPipe(Class> clas, Object... ingredients) { + return buildPipe(clas, BCCreativeTab.get("pipes"), ingredients); + } + + @Deprecated + public static Item buildPipe(Class> clas, String descr, BCCreativeTab creativeTab, Object... ingredients) { + return buildPipe(clas, creativeTab, ingredients); + } + public static Item buildPipe(Class> clas, BCCreativeTab creativeTab, Object... ingredients) { + if (!BCRegistry.INSTANCE.isEnabled("pipes", clas.getSimpleName())) { + return null; + } + ItemPipe res = BlockGenericPipe.registerPipe(clas, creativeTab); res.setUnlocalizedName(clas.getSimpleName()); + for (Object o : ingredients) { + if (o == null) { + return res; + } + } + // Add appropriate recipes to temporary list if (ingredients.length == 3) { for (int i = 0; i < 17; i++) { @@ -639,7 +661,7 @@ public static Item buildPipe(Class> clas, BCCreativeTab creati if (i == 0) { glass = ingredients[1]; } else { - glass = new ItemStack(Blocks.stained_glass, 1, i - 1); + glass = "blockGlass" + EnumColor.fromId(15 - (i - 1)).getName(); } recipe.result = new ItemStack(res, 8, i); @@ -664,7 +686,7 @@ public static Item buildPipe(Class> clas, BCCreativeTab creati pipeRecipes.add(recipe); - if (ingredients[1] instanceof ItemPipe) { + if (ingredients[1] instanceof ItemPipe && clas != PipeStructureCobblestone.class) { PipeRecipe uncraft = new PipeRecipe(); uncraft.isShapeless = true; uncraft.input = new Object[] { recipe.result }; diff --git a/common/buildcraft/builders/BlockArchitect.java b/common/buildcraft/builders/BlockArchitect.java index ce9b89e330..4d8643a11b 100644 --- a/common/buildcraft/builders/BlockArchitect.java +++ b/common/buildcraft/builders/BlockArchitect.java @@ -1,5 +1,5 @@ /** 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.builders; @@ -19,7 +19,6 @@ import buildcraft.core.lib.block.BlockBuildCraft; public class BlockArchitect extends BlockBuildCraft { - public BlockArchitect() { super(Material.iron, FACING_PROP); } diff --git a/common/buildcraft/builders/BlockBlueprintLibrary.java b/common/buildcraft/builders/BlockBlueprintLibrary.java index c1760e2cfd..ba93741df0 100644 --- a/common/buildcraft/builders/BlockBlueprintLibrary.java +++ b/common/buildcraft/builders/BlockBlueprintLibrary.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.builders; import net.minecraft.block.material.Material; @@ -20,6 +24,7 @@ public class BlockBlueprintLibrary extends BlockBuildCraft { public BlockBlueprintLibrary() { super(Material.wood, BCCreativeTab.get("main"), FACING_PROP); + setHardness(5F); } @Override diff --git a/common/buildcraft/builders/BlockBuilder.java b/common/buildcraft/builders/BlockBuilder.java index 4e8d9cbc5a..82988109e4 100644 --- a/common/buildcraft/builders/BlockBuilder.java +++ b/common/buildcraft/builders/BlockBuilder.java @@ -1,5 +1,5 @@ /** 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.builders; @@ -14,6 +14,7 @@ import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -38,7 +39,7 @@ public IBlockState getActualState(IBlockState state, IBlockAccess access, BlockP return state; } - @Override + @Override public TileEntity createNewTileEntity(World world, int metadata) { return new TileBuilder(); } diff --git a/common/buildcraft/builders/BlockConstructionMarker.java b/common/buildcraft/builders/BlockConstructionMarker.java index bc7fd7112c..3fe94dba60 100755 --- a/common/buildcraft/builders/BlockConstructionMarker.java +++ b/common/buildcraft/builders/BlockConstructionMarker.java @@ -1,12 +1,11 @@ /** 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.builders; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -14,7 +13,11 @@ import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; +import net.minecraft.world.WorldServer; +import buildcraft.api.tools.IToolWrench; +import buildcraft.core.BlockMarker; +import buildcraft.core.lib.utils.BlockUtils; import buildcraft.core.lib.utils.Utils; public class BlockConstructionMarker extends BlockMarker { @@ -28,17 +31,23 @@ public TileEntity createNewTileEntity(World world, int metadata) { @Override public void breakBlock(World world, BlockPos pos, IBlockState state) { Utils.preDestroyBlock(world, pos); + dropMarkerIfPresent(world, pos, true); + super.breakBlock(world, pos, state); + } + + private boolean dropMarkerIfPresent(World world, BlockPos pos, boolean onBreak) { TileConstructionMarker marker = (TileConstructionMarker) world.getTileEntity(pos); if (marker != null && marker.itemBlueprint != null && !world.isRemote) { - float f1 = 0.7F; - double d = (world.rand.nextFloat() * f1) + (1.0F - f1) * 0.5D; - double d1 = (world.rand.nextFloat() * f1) + (1.0F - f1) * 0.5D; - double d2 = (world.rand.nextFloat() * f1) + (1.0F - f1) * 0.5D; - EntityItem itemToDrop = new EntityItem(world, pos.getX() + d, pos.getY() + d1, pos.getZ() + d2, marker.itemBlueprint); - itemToDrop.setDefaultPickupDelay(); - world.spawnEntityInWorld(itemToDrop); + BlockUtils.dropItem((WorldServer) world, pos, 6000, marker.itemBlueprint); + marker.itemBlueprint = null; + if (!onBreak) { + marker.bluePrintBuilder = null; + marker.bptContext = null; + marker.sendNetworkUpdate(); + } + return true; } - super.breakBlock(world, pos, state); + return false; } @Override @@ -79,6 +88,8 @@ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, En ItemConstructionMarker.link(entityplayer.getCurrentEquippedItem(), world, pos); return true; } + } else if ((equipped == null || equipped instanceof IToolWrench) && entityplayer.isSneaking()) { + return dropMarkerIfPresent(world, pos, false); } return false; diff --git a/common/buildcraft/builders/BlockFiller.java b/common/buildcraft/builders/BlockFiller.java index 0a26432b92..6d0820a0c2 100644 --- a/common/buildcraft/builders/BlockFiller.java +++ b/common/buildcraft/builders/BlockFiller.java @@ -1,5 +1,5 @@ /** 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.builders; @@ -13,6 +13,7 @@ import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/common/buildcraft/builders/BlockFrame.java b/common/buildcraft/builders/BlockFrame.java index 1c919818d7..0daa0c4fa8 100644 --- a/common/buildcraft/builders/BlockFrame.java +++ b/common/buildcraft/builders/BlockFrame.java @@ -1,5 +1,5 @@ /** 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.builders; @@ -16,17 +16,13 @@ import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.*; import net.minecraft.util.EnumFacing.Axis; -import net.minecraft.util.EnumWorldBlockLayer; -import net.minecraft.util.IStringSerializable; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/common/buildcraft/builders/BlockQuarry.java b/common/buildcraft/builders/BlockQuarry.java index 8b9d6fc8b8..7a14e26d0a 100644 --- a/common/buildcraft/builders/BlockQuarry.java +++ b/common/buildcraft/builders/BlockQuarry.java @@ -1,5 +1,5 @@ /** 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.builders; diff --git a/common/buildcraft/builders/BuilderProxy.java b/common/buildcraft/builders/BuilderProxy.java index 7ae35182fe..69668fef72 100644 --- a/common/buildcraft/builders/BuilderProxy.java +++ b/common/buildcraft/builders/BuilderProxy.java @@ -1,10 +1,11 @@ /** 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.builders; import net.minecraft.world.World; + import net.minecraftforge.fml.common.SidedProxy; import buildcraft.core.lib.EntityResizableCuboid; @@ -12,6 +13,7 @@ public class BuilderProxy { @SidedProxy(clientSide = "buildcraft.builders.BuilderProxyClient", serverSide = "buildcraft.builders.BuilderProxy") public static BuilderProxy proxy; + public static int frameRenderId; public void registerClientHook() { diff --git a/common/buildcraft/builders/BuilderProxyClient.java b/common/buildcraft/builders/BuilderProxyClient.java index 91f085432c..6229d7079d 100644 --- a/common/buildcraft/builders/BuilderProxyClient.java +++ b/common/buildcraft/builders/BuilderProxyClient.java @@ -1,5 +1,5 @@ /** 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.builders; @@ -14,7 +14,6 @@ import buildcraft.builders.render.RenderArchitect; import buildcraft.builders.render.RenderBuilderTile; import buildcraft.builders.render.RenderConstructionMarker; -import buildcraft.builders.render.RenderPathMarker; import buildcraft.builders.urbanism.TileUrbanist; import buildcraft.core.lib.EntityResizableCuboid; import buildcraft.core.lib.render.RenderVoid; @@ -38,14 +37,7 @@ public void registerBlockRenderers() { ClientRegistry.bindTileEntitySpecialRenderer(TileArchitect.class, new RenderArchitect()); ClientRegistry.bindTileEntitySpecialRenderer(TileFiller.class, new RenderBuilder()); ClientRegistry.bindTileEntitySpecialRenderer(TileBuilder.class, new RenderBuilderTile()); - ClientRegistry.bindTileEntitySpecialRenderer(TilePathMarker.class, new RenderPathMarker()); ClientRegistry.bindTileEntitySpecialRenderer(TileConstructionMarker.class, new RenderConstructionMarker()); - - // ClientRegistry.bindTileEntitySpecialRenderer(TileArchitect.class, new - // RenderLEDTile(BuildCraftBuilders.architectBlock)); - // ClientRegistry.bindTileEntitySpecialRenderer(TileFiller.class, new - // RenderLEDTile(BuildCraftBuilders.fillerBlock)); - ClientRegistry.bindTileEntitySpecialRenderer(TileQuarry.class, new RenderBuilder()); RenderingRegistry.registerEntityRenderingHandler(EntityMechanicalArm.class, new RenderVoid()); diff --git a/common/buildcraft/builders/BuilderTooltipHandler.java b/common/buildcraft/builders/BuilderTooltipHandler.java new file mode 100644 index 0000000000..5487707160 --- /dev/null +++ b/common/buildcraft/builders/BuilderTooltipHandler.java @@ -0,0 +1,33 @@ +package buildcraft.builders; + +import java.util.List; + +import net.minecraft.util.EnumChatFormatting; + +import net.minecraftforge.event.entity.player.ItemTooltipEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import buildcraft.builders.gui.ContainerBuilder; +import buildcraft.core.blueprints.RequirementItemStack; + +/** Created by asie on 10/6/15. */ +public class BuilderTooltipHandler { + @SubscribeEvent + public void itemTooltipEvent(ItemTooltipEvent event) { + if (event.itemStack != null && event.entityPlayer != null && event.entityPlayer.openContainer != null + && event.entityPlayer.openContainer instanceof ContainerBuilder) { + ContainerBuilder containerBuilder = (ContainerBuilder) event.entityPlayer.openContainer; + TileBuilder builder = containerBuilder.getBuilder(); + if (builder != null) { + List needs = builder.getNeededItems(); + if (needs != null) { + for (RequirementItemStack ris : needs) { + if (ris.stack == event.itemStack) { + event.toolTip.add(EnumChatFormatting.GRAY + "" + EnumChatFormatting.ITALIC + "Needed: " + ris.size); + } + } + } + } + } + } +} diff --git a/common/buildcraft/builders/BuildersGuiHandler.java b/common/buildcraft/builders/BuildersGuiHandler.java index d2a597bd05..318ff59826 100644 --- a/common/buildcraft/builders/BuildersGuiHandler.java +++ b/common/buildcraft/builders/BuildersGuiHandler.java @@ -1,5 +1,5 @@ /** 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.builders; @@ -8,19 +8,10 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockPos; import net.minecraft.world.World; + import net.minecraftforge.fml.common.network.IGuiHandler; -import buildcraft.builders.gui.ContainerArchitect; -import buildcraft.builders.gui.ContainerBlueprintLibrary; -import buildcraft.builders.gui.ContainerBuilder; -import buildcraft.builders.gui.ContainerFiller; -import buildcraft.builders.gui.GuiArchitect; -import buildcraft.builders.gui.GuiBlueprintLibrary; -import buildcraft.builders.gui.GuiBuilder; -import buildcraft.builders.gui.GuiFiller; -import buildcraft.builders.urbanism.ContainerUrbanist; -import buildcraft.builders.urbanism.GuiUrbanist; -import buildcraft.builders.urbanism.TileUrbanist; +import buildcraft.builders.gui.*; import buildcraft.core.GuiIds; public class BuildersGuiHandler implements IGuiHandler { @@ -60,12 +51,6 @@ public Object getClientGuiElement(int id, EntityPlayer player, World world, int } return new GuiFiller(player, (TileFiller) tile); - case GuiIds.URBANIST: - if (!(tile instanceof TileUrbanist)) { - return null; - } - return new GuiUrbanist(player, (TileUrbanist) tile); - default: return null; } @@ -106,13 +91,6 @@ public Object getServerGuiElement(int id, EntityPlayer player, World world, int } return new ContainerFiller(player, (TileFiller) tile); - case GuiIds.URBANIST: - if (!(tile instanceof TileUrbanist)) { - return null; - } else { - return new ContainerUrbanist(player, (TileUrbanist) tile); - } - default: return null; } diff --git a/common/buildcraft/builders/EntityMechanicalArm.java b/common/buildcraft/builders/EntityMechanicalArm.java index 470c13b735..4eb82759a1 100644 --- a/common/buildcraft/builders/EntityMechanicalArm.java +++ b/common/buildcraft/builders/EntityMechanicalArm.java @@ -1,5 +1,5 @@ /** 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.builders; @@ -22,8 +22,6 @@ public class EntityMechanicalArm extends Entity { private double yRoot; private double zRoot; - private boolean inProgressionXZ = false; - private boolean inProgressionY = false; private int headX, headY, headZ; private EntityResizableCuboid xArm, yArm, zArm, head; @@ -93,7 +91,7 @@ protected void readEntityFromNBT(NBTTagCompound nbttagcompound) { private void findAndJoinQuarry() { TileEntity te = worldObj.getTileEntity(new BlockPos((int) posX, (int) posY, (int) posZ)); - if (te != null && te instanceof TileQuarry) { + if (te instanceof TileQuarry) { parent = (TileQuarry) te; parent.setArm(this); } else { diff --git a/common/buildcraft/builders/EventHandlerBuilders.java b/common/buildcraft/builders/EventHandlerBuilders.java index 4c5a48ac4a..e1cbeaef6f 100644 --- a/common/buildcraft/builders/EventHandlerBuilders.java +++ b/common/buildcraft/builders/EventHandlerBuilders.java @@ -9,6 +9,8 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.relauncher.Side; +import buildcraft.core.TilePathMarker; + public class EventHandlerBuilders { @SubscribeEvent diff --git a/common/buildcraft/builders/HeuristicBlockDetection.java b/common/buildcraft/builders/HeuristicBlockDetection.java index d15a8065c0..38b290f505 100644 --- a/common/buildcraft/builders/HeuristicBlockDetection.java +++ b/common/buildcraft/builders/HeuristicBlockDetection.java @@ -1,37 +1,25 @@ package buildcraft.builders; -import java.util.BitSet; import java.util.Iterator; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; + import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidBlock; import buildcraft.api.blueprints.SchematicBlock; import buildcraft.api.blueprints.SchematicFluid; import buildcraft.core.blueprints.SchematicRegistry; -import buildcraft.core.builders.schematics.SchematicBlockCreative; import buildcraft.core.builders.schematics.SchematicTileCreative; public final class HeuristicBlockDetection { - - private static BitSet craftableBlockList = new BitSet(65536); - private HeuristicBlockDetection() { } public static void start() { - // Initialize craftableBlockList - /* for (Object or : CraftingManager.getInstance().getRecipeList()) { if (or instanceof IRecipe) { IRecipe recipe - * = ((IRecipe) or); if (recipe.getRecipeOutput() != null && recipe.getRecipeOutput().getItem() != null && - * recipe.getRecipeOutput().getItem() instanceof ItemBlock) { int pos = recipe.getRecipeOutput().getItemDamage() - * & 15; pos |= Block.getIdFromBlock(Block.getBlockFromItem(recipe.getRecipeOutput().getItem())) << 4; if (pos - * >= 0 && pos < 65536) { craftableBlockList.set(pos); } } } } */ - - // Register blocks Iterator i = Block.blockRegistry.iterator(); while (i.hasNext()) { Block block = (Block) i.next(); @@ -50,21 +38,15 @@ public static void start() { continue; } - boolean creativeOnly = false; - try { - if (creativeOnly) { - SchematicRegistry.INSTANCE.registerSchematicBlock(state, SchematicBlockCreative.class); - } else { - if (block instanceof IFluidBlock) { - IFluidBlock fblock = (IFluidBlock) block; - if (fblock.getFluid() != null) { - SchematicRegistry.INSTANCE.registerSchematicBlock(state, SchematicFluid.class, new FluidStack(fblock - .getFluid(), 1000)); - } - } else { - SchematicRegistry.INSTANCE.registerSchematicBlock(state, SchematicBlock.class); + if (block instanceof IFluidBlock) { + IFluidBlock fblock = (IFluidBlock) block; + if (fblock.getFluid() != null) { + SchematicRegistry.INSTANCE.registerSchematicBlock(state, SchematicFluid.class, new FluidStack(fblock.getFluid(), + 1000)); } + } else { + SchematicRegistry.INSTANCE.registerSchematicBlock(state, SchematicBlock.class); } } catch (Exception e) { e.printStackTrace(); @@ -76,9 +58,4 @@ public static void start() { } } } - - private static boolean canCraft(Block block, int meta) { - int pos = Block.getIdFromBlock(block) << 4 | meta; - return craftableBlockList.get(pos); - } } diff --git a/common/buildcraft/builders/ItemBlueprint.java b/common/buildcraft/builders/ItemBlueprint.java index c7c2c76cc7..852e6b4ccb 100644 --- a/common/buildcraft/builders/ItemBlueprint.java +++ b/common/buildcraft/builders/ItemBlueprint.java @@ -1,5 +1,5 @@ /** 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.builders; @@ -60,17 +60,17 @@ public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer pla protected abstract void openGui(BlueprintBase bpt); @Override - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advanced) { + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advanced) { if (NBTUtils.getItemData(stack).hasKey("name")) { String name = NBTUtils.getItemData(stack).getString("name"); if ("".equals(name)) { - list.add(String.format(StringUtils.localize("item.blueprint.unnamed"))); + list.add(StringUtils.localize("item.blueprint.unnamed")); } else { - list.add(String.format(name)); + list.add(name); } - list.add(String.format(StringUtils.localize("item.blueprint.author") + " " + NBTUtils.getItemData(stack).getString("author"))); + list.add(StringUtils.localize("item.blueprint.author") + " " + NBTUtils.getItemData(stack).getString("author")); } else { list.add(StringUtils.localize("item.blueprint.blank")); } @@ -79,9 +79,9 @@ public void addInformation(ItemStack stack, EntityPlayer player, List list, bool BuildingPermission p = BuildingPermission.values()[NBTUtils.getItemData(stack).getByte("permission")]; if (p == BuildingPermission.CREATIVE_ONLY) { - list.add(String.format(StringUtils.localize("item.blueprint.creative_only"))); + list.add(StringUtils.localize("item.blueprint.creative_only")); } else if (p == BuildingPermission.NONE) { - list.add(String.format(StringUtils.localize("item.blueprint.no_build"))); + list.add(StringUtils.localize("item.blueprint.no_build")); } } @@ -89,7 +89,7 @@ public void addInformation(ItemStack stack, EntityPlayer player, List list, bool boolean isComplete = NBTUtils.getItemData(stack).getBoolean("isComplete"); if (!isComplete) { - list.add(String.format(StringUtils.localize("item.blueprint.incomplete"))); + list.add(StringUtils.localize("item.blueprint.incomplete")); } } } @@ -99,6 +99,10 @@ public int getItemStackLimit(ItemStack stack) { return NBTUtils.getItemData(stack).hasKey("name") ? 1 : 16; } + public static boolean isContentReadable(ItemStack stack) { + return getId(stack) != null; + } + public static LibraryId getId(ItemStack stack) { NBTTagCompound nbt = NBTUtils.getItemData(stack); if (nbt == null) { diff --git a/common/buildcraft/builders/ItemBlueprintStandard.java b/common/buildcraft/builders/ItemBlueprintStandard.java index 90bd8d6bfd..73d970cbe4 100644 --- a/common/buildcraft/builders/ItemBlueprintStandard.java +++ b/common/buildcraft/builders/ItemBlueprintStandard.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.builders; import net.minecraft.client.Minecraft; diff --git a/common/buildcraft/builders/ItemBlueprintTemplate.java b/common/buildcraft/builders/ItemBlueprintTemplate.java index c1b91eb858..76231c7534 100644 --- a/common/buildcraft/builders/ItemBlueprintTemplate.java +++ b/common/buildcraft/builders/ItemBlueprintTemplate.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.builders; import net.minecraft.client.Minecraft; diff --git a/common/buildcraft/builders/ItemConstructionMarker.java b/common/buildcraft/builders/ItemConstructionMarker.java index 16e0ab2ac4..74ba9d196f 100755 --- a/common/buildcraft/builders/ItemConstructionMarker.java +++ b/common/buildcraft/builders/ItemConstructionMarker.java @@ -1,5 +1,5 @@ /** 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.builders; @@ -15,6 +15,7 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.Vec3; import net.minecraft.world.World; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/common/buildcraft/builders/LibraryBlueprintTypeHandler.java b/common/buildcraft/builders/LibraryBlueprintTypeHandler.java index e69b1efd68..bebe139ed2 100644 --- a/common/buildcraft/builders/LibraryBlueprintTypeHandler.java +++ b/common/buildcraft/builders/LibraryBlueprintTypeHandler.java @@ -19,9 +19,9 @@ public LibraryBlueprintTypeHandler(boolean isBlueprint) { @Override public boolean isHandler(ItemStack stack, HandlerType type) { if (isBlueprint) { - return stack.getItem() instanceof ItemBlueprintStandard; + return stack.getItem() instanceof ItemBlueprintStandard && (type == HandlerType.LOAD || ItemBlueprint.isContentReadable(stack)); } else { - return stack.getItem() instanceof ItemBlueprintTemplate; + return stack.getItem() instanceof ItemBlueprintTemplate && (type == HandlerType.LOAD || ItemBlueprint.isContentReadable(stack)); } } @@ -32,7 +32,8 @@ public int getTextColor() { @Override public String getName(ItemStack stack) { - return ItemBlueprint.getId(stack).name; + LibraryId id = ItemBlueprint.getId(stack); + return id != null ? id.name : "<>"; } @Override diff --git a/common/buildcraft/builders/LibraryDatabase.java b/common/buildcraft/builders/LibraryDatabase.java index e17b58031f..5eac30c9a2 100644 --- a/common/buildcraft/builders/LibraryDatabase.java +++ b/common/buildcraft/builders/LibraryDatabase.java @@ -1,19 +1,11 @@ /** 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.builders; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.FilenameFilter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Locale; -import java.util.Set; -import java.util.TreeSet; +import java.io.*; +import java.util.*; import net.minecraft.nbt.NBTTagCompound; @@ -23,203 +15,181 @@ import buildcraft.core.lib.utils.NBTUtils; public class LibraryDatabase { - private static final int PAGE_SIZE = 12; - - protected Set blueprintIds; - protected LibraryId[] pages = new LibraryId[0]; - - private File outputDir; - private File[] inputDirs; - - /** - * Initialize the blueprint database. - * - * @param inputPaths directories to read the blueprints from. - */ - public void init(String[] inputPaths, String outputPath) { - outputDir = new File(outputPath); - - if (!outputDir.exists()) { - outputDir.mkdirs(); - } - - inputDirs = new File[inputPaths.length]; - - for (int i = 0; i < inputDirs.length; ++i) { - inputDirs[i] = new File(inputPaths[i]); - } - - refresh(); - } - - public void refresh() { - blueprintIds = new TreeSet(); - loadIndex(inputDirs); - } - - public void deleteBlueprint (LibraryId id) { - File blueprintFile = getBlueprintFile(id); - - if (blueprintFile != null) { - blueprintFile.delete(); - blueprintIds.remove(id); - pages = new LibraryId[blueprintIds.size()]; - pages = blueprintIds.toArray(pages); - } - } - - protected File getBlueprintFile(LibraryId id) { - String name = String.format(Locale.ENGLISH, "%s." + id.extension, id.toString()); - - for (File dir : inputDirs) { - File f = new File(dir, name); - - if (f.exists()) { - return f; - } - } - - return null; - } - - protected File getBlueprintOutputFile(LibraryId id) { - String name = String.format(Locale.ENGLISH, "%s." + id.extension, id.toString()); - - return new File(outputDir, name); - } - - public void add(LibraryId base, NBTTagCompound compound) { - save(base, compound); - - if (!blueprintIds.contains(base)) { - blueprintIds.add(base); - pages = blueprintIds.toArray(pages); - } - } - - private void save(LibraryId base, NBTTagCompound compound) { - byte[] data = NBTUtils.save(compound); - base.generateUniqueId(data); - File blueprintFile = getBlueprintOutputFile(base); - System.out.println(blueprintFile.getName() + " - " + data.length); - - if (!blueprintFile.exists()) { - try { - FileOutputStream f = new FileOutputStream(blueprintFile); - f.write(data); - f.close(); - } catch (IOException ex) { - BCLog.logger.error(String.format("Failed to save library file: %s %s", blueprintFile.getName(), ex.getMessage())); - } - } - } - - private void loadIndex(File[] dirs) { - for (File dir : dirs) { - if (dir != null) { - loadIndex(dir); - } - } - } - - private void loadIndex(File directory) { - FilenameFilter filter = new FilenameFilter() { - @Override - public boolean accept(File dir, String name) { - int dotIndex = name.lastIndexOf('.') + 1; - String extension = name.substring(dotIndex); - return LibraryAPI.getHandlerFor(extension) != null; - } - }; - - if (directory.exists()) { - File[] files = directory.listFiles(filter); - if (files == null || files.length == 0) { - return; - } - - for (File blueprintFile : files) { - String fileName = blueprintFile.getName(); - - LibraryId id = new LibraryId(); - - int sepIndex = fileName.lastIndexOf(LibraryId.BPT_SEP_CHARACTER); - int dotIndex = fileName.lastIndexOf('.'); - - String extension = fileName.substring(dotIndex + 1); - - if (sepIndex > 0) { - String prefix = fileName.substring(0, sepIndex); - String suffix = fileName.substring(sepIndex + 1); - - id.name = prefix; - id.uniqueId = LibraryId.toBytes(suffix.substring(0, suffix.length() - 4)); - } else { - id.name = fileName.substring(0, dotIndex); - id.uniqueId = new byte[0]; - } - id.extension = extension; - - if (!blueprintIds.contains(id)) { - blueprintIds.add(id); - } - } - - pages = blueprintIds.toArray(new LibraryId[blueprintIds.size()]); - } - } - - public boolean exists (LibraryId id) { - return blueprintIds.contains(id); - } - - public NBTTagCompound load(final LibraryId id) { - if (id == null) { - return null; - } - - NBTTagCompound compound = load(getBlueprintFile(id)); - return compound; - } - - public static NBTTagCompound load (File blueprintFile) { - if (blueprintFile != null && blueprintFile.exists()) { - try { - FileInputStream f = new FileInputStream(blueprintFile); - byte [] data = new byte [(int) blueprintFile.length()]; - f.read (data); - f.close(); - - return NBTUtils.load(data); - } catch (FileNotFoundException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - } - - return null; - } - - public ArrayList getPage (int pageId) { - ArrayList result = new ArrayList(); - - if (pageId < 0) { - return result; - } - - for (int i = pageId * PAGE_SIZE; i < pageId * PAGE_SIZE + PAGE_SIZE; ++i) { - if (i < pages.length) { - result.add(pages [i]); - } else { - break; - } - } - - return result; - } - - public int getPageNumber () { - return (int) Math.ceil((float) blueprintIds.size() / (float) PAGE_SIZE); - } + protected Set blueprintIds; + protected LibraryId[] pages = new LibraryId[0]; + + private File outputDir; + private List inputDirs; + + /** Initialize the blueprint database. + * + * @param inputPaths directories to read the blueprints from. */ + public void init(String[] inputPaths, String outputPath) { + outputDir = new File(outputPath); + + if (!outputDir.exists()) { + outputDir.mkdirs(); + } + + inputDirs = new ArrayList(); + + for (int i = 0; i < inputPaths.length; ++i) { + File inputDir = new File(inputPaths[i]); + if (inputDir.exists()) { + inputDirs.add(inputDir); + } + } + + refresh(); + } + + public void refresh() { + blueprintIds = new TreeSet(); + for (File f : inputDirs) { + loadIndex(f); + } + } + + public void deleteBlueprint(LibraryId id) { + File blueprintFile = getBlueprintFile(id); + + if (blueprintFile != null) { + blueprintFile.delete(); + blueprintIds.remove(id); + pages = new LibraryId[blueprintIds.size()]; + pages = blueprintIds.toArray(pages); + } + } + + protected File getBlueprintFile(LibraryId id) { + String name = String.format(Locale.ENGLISH, "%s." + id.extension, id.toString()); + + for (File dir : inputDirs) { + File f = new File(dir, name); + + if (f.exists()) { + return f; + } + } + + return null; + } + + protected File getBlueprintOutputFile(LibraryId id) { + String name = String.format(Locale.ENGLISH, "%s." + id.extension, id.toString()); + + return new File(outputDir, name); + } + + public void add(LibraryId base, NBTTagCompound compound) { + save(base, compound); + + if (!blueprintIds.contains(base)) { + blueprintIds.add(base); + pages = blueprintIds.toArray(pages); + } + } + + private void save(LibraryId base, NBTTagCompound compound) { + byte[] data = NBTUtils.save(compound); + base.generateUniqueId(data); + File blueprintFile = getBlueprintOutputFile(base); + + if (!blueprintFile.exists()) { + try { + FileOutputStream f = new FileOutputStream(blueprintFile); + f.write(data); + f.close(); + } catch (IOException ex) { + BCLog.logger.error(String.format("Failed to save library file: %s %s", blueprintFile.getName(), ex.getMessage())); + } + } + } + + private void loadIndex(File directory) { + FilenameFilter filter = new FilenameFilter() { + @Override + public boolean accept(File dir, String name) { + int dotIndex = name.lastIndexOf('.') + 1; + String extension = name.substring(dotIndex); + return LibraryAPI.getHandlerFor(extension) != null; + } + }; + + if (directory.exists()) { + File[] files = directory.listFiles(filter); + if (files == null || files.length == 0) { + return; + } + + for (File blueprintFile : files) { + String fileName = blueprintFile.getName(); + + LibraryId id = new LibraryId(); + + int sepIndex = fileName.lastIndexOf(LibraryId.BPT_SEP_CHARACTER); + int dotIndex = fileName.lastIndexOf('.'); + + if (dotIndex > 0) { + String extension = fileName.substring(dotIndex + 1); + + if (sepIndex > 0) { + String prefix = fileName.substring(0, sepIndex); + String suffix = fileName.substring(sepIndex + 1); + + id.name = prefix; + id.uniqueId = LibraryId.toBytes(suffix.substring(0, suffix.length() - (extension.length() + 1))); + } else { + id.name = fileName.substring(0, dotIndex); + id.uniqueId = new byte[0]; + } + id.extension = extension; + + if (!blueprintIds.contains(id)) { + blueprintIds.add(id); + } + } else { + BCLog.logger.warn("Found incorrectly named (no extension) blueprint file: '%s'!", fileName); + } + } + + pages = blueprintIds.toArray(new LibraryId[blueprintIds.size()]); + } + } + + public boolean exists(LibraryId id) { + return blueprintIds.contains(id); + } + + public NBTTagCompound load(final LibraryId id) { + if (id == null) { + return null; + } + + NBTTagCompound compound = load(getBlueprintFile(id)); + return compound; + } + + public static NBTTagCompound load(File blueprintFile) { + if (blueprintFile != null && blueprintFile.exists()) { + try { + FileInputStream f = new FileInputStream(blueprintFile); + byte[] data = new byte[(int) blueprintFile.length()]; + f.read(data); + f.close(); + + return NBTUtils.load(data); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + return null; + } + + public List getBlueprintIds() { + return Collections.unmodifiableList(new ArrayList(blueprintIds)); + } } diff --git a/common/buildcraft/builders/PatternQuarryFrame.java b/common/buildcraft/builders/PatternQuarryFrame.java index 01ee2398a2..b8cf87d2f1 100644 --- a/common/buildcraft/builders/PatternQuarryFrame.java +++ b/common/buildcraft/builders/PatternQuarryFrame.java @@ -16,35 +16,35 @@ public Blueprint getBlueprint(Box box, World world) { int y = box.sizeY() - 1; int z = box.sizeZ() - 1; for (int d = 1; d < x; d++) { - result.contents[d][0][0] = EFrameConnection.EAST_WEST.getSchematic(); - result.contents[d][0][z] = EFrameConnection.EAST_WEST.getSchematic(); - result.contents[d][y][0] = EFrameConnection.EAST_WEST.getSchematic(); - result.contents[d][y][z] = EFrameConnection.EAST_WEST.getSchematic(); + result.put(d, 0, 0, EFrameConnection.EAST_WEST.getSchematic()); + result.put(d, 0, z, EFrameConnection.EAST_WEST.getSchematic()); + result.put(d, y, 0, EFrameConnection.EAST_WEST.getSchematic()); + result.put(d, y, z, EFrameConnection.EAST_WEST.getSchematic()); } for (int d = 1; d < y; d++) { - result.contents[0][d][0] = EFrameConnection.UP_DOWN.getSchematic(); - result.contents[0][d][z] = EFrameConnection.UP_DOWN.getSchematic(); - result.contents[x][d][0] = EFrameConnection.UP_DOWN.getSchematic(); - result.contents[x][d][z] = EFrameConnection.UP_DOWN.getSchematic(); + result.put(0, d, 0, EFrameConnection.UP_DOWN.getSchematic()); + result.put(0, d, z, EFrameConnection.UP_DOWN.getSchematic()); + result.put(x, d, 0, EFrameConnection.UP_DOWN.getSchematic()); + result.put(x, d, z, EFrameConnection.UP_DOWN.getSchematic()); } for (int d = 1; d < z; d++) { - result.contents[0][0][d] = EFrameConnection.NORTH_SOUTH.getSchematic(); - result.contents[0][y][d] = EFrameConnection.NORTH_SOUTH.getSchematic(); - result.contents[x][0][d] = EFrameConnection.NORTH_SOUTH.getSchematic(); - result.contents[x][y][d] = EFrameConnection.NORTH_SOUTH.getSchematic(); + result.put(0, 0, d, EFrameConnection.NORTH_SOUTH.getSchematic()); + result.put(0, y, d, EFrameConnection.NORTH_SOUTH.getSchematic()); + result.put(x, 0, d, EFrameConnection.NORTH_SOUTH.getSchematic()); + result.put(x, y, d, EFrameConnection.NORTH_SOUTH.getSchematic()); } - result.contents[0][0][0] = EFrameConnection.SOUTH_EAST_UP.getSchematic(); - result.contents[0][0][z] = EFrameConnection.NORTH_EAST_UP.getSchematic(); - result.contents[x][0][0] = EFrameConnection.SOUTH_WEST_UP.getSchematic(); - result.contents[x][0][z] = EFrameConnection.NORTH_WEST_UP.getSchematic(); + result.put(0, 0, 0, EFrameConnection.SOUTH_EAST_UP.getSchematic()); + result.put(0, 0, z, EFrameConnection.NORTH_EAST_UP.getSchematic()); + result.put(x, 0, 0, EFrameConnection.SOUTH_WEST_UP.getSchematic()); + result.put(x, 0, z, EFrameConnection.NORTH_WEST_UP.getSchematic()); - result.contents[0][y][0] = EFrameConnection.SOUTH_EAST_DOWN.getSchematic(); - result.contents[0][y][z] = EFrameConnection.NORTH_EAST_DOWN.getSchematic(); - result.contents[x][y][0] = EFrameConnection.SOUTH_WEST_DOWN.getSchematic(); - result.contents[x][y][z] = EFrameConnection.NORTH_WEST_DOWN.getSchematic(); + result.put(0, y, 0, EFrameConnection.SOUTH_EAST_DOWN.getSchematic()); + result.put(0, y, z, EFrameConnection.NORTH_EAST_DOWN.getSchematic()); + result.put(x, y, 0, EFrameConnection.SOUTH_WEST_DOWN.getSchematic()); + result.put(x, y, z, EFrameConnection.NORTH_WEST_DOWN.getSchematic()); return result; } diff --git a/common/buildcraft/builders/TileArchitect.java b/common/buildcraft/builders/TileArchitect.java index b7901de509..8377199e14 100644 --- a/common/buildcraft/builders/TileArchitect.java +++ b/common/buildcraft/builders/TileArchitect.java @@ -1,5 +1,5 @@ /** 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.builders; @@ -16,18 +16,19 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.BlockPos; import net.minecraft.util.Vec3; + import net.minecraftforge.common.util.Constants; import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import buildcraft.BuildCraftCore; import buildcraft.api.core.IAreaProvider; import buildcraft.builders.blueprints.RecursiveBlueprintReader; import buildcraft.core.Box; import buildcraft.core.Box.Kind; -import buildcraft.BuildCraftCore; import buildcraft.core.LaserData; import buildcraft.core.blueprints.BlueprintReadConfiguration; import buildcraft.core.internal.IBoxProvider; -import buildcraft.core.internal.ILEDProvider; import buildcraft.core.lib.block.TileBuildCraft; import buildcraft.core.lib.inventory.SimpleInventory; import buildcraft.core.lib.network.base.Packet; @@ -41,8 +42,14 @@ import io.netty.buffer.ByteBuf; public class TileArchitect extends TileBuildCraft implements IInventory, IBoxProvider, ICommandReceiver { + public enum Mode { + NONE, + EDIT, + COPY + } public String currentAuthorName = ""; + public Mode mode = Mode.NONE; public Box box = new Box(); public String name = ""; @@ -53,25 +60,28 @@ public class TileArchitect extends TileBuildCraft implements IInventory, IBoxPro public ArrayList subBlueprints = new ArrayList(); private SimpleInventory inv = new SimpleInventory(2, "Architect", 1); - private RecursiveBlueprintReader reader; - private boolean isProcessing; + private boolean clientIsWorking, initialized; public TileArchitect() { box.kind = Kind.BLUE_STRIPES; } + public void storeBlueprintStack(ItemStack blueprintStack) { + setInventorySlotContents(1, blueprintStack); + decrStackSize(0, 1); + } + @Override public void update() { super.update(); if (!worldObj.isRemote) { - if (reader != null) { + if (mode == Mode.COPY && reader != null) { reader.iterate(); if (reader.isDone()) { reader = null; - isProcessing = false; sendNetworkUpdate(); } } @@ -82,16 +92,28 @@ public void update() { public void initialize() { super.initialize(); - if (!worldObj.isRemote) { + if (!worldObj.isRemote && !initialized) { if (!box.isInitialized()) { IAreaProvider a = Utils.getNearbyAreaProvider(worldObj, pos); if (a != null) { + mode = Mode.COPY; box.initialize(a); a.removeFromWorld(); sendNetworkUpdate(); + return; + } else { + if (BuildCraftCore.DEVELOPER_MODE) { + mode = Mode.EDIT; + } else { + mode = Mode.NONE; + } } + } else { + mode = Mode.COPY; } + initialized = true; + sendNetworkUpdate(); } } @@ -110,7 +132,7 @@ public ItemStack decrStackSize(int i, int j) { ItemStack result = inv.decrStackSize(i, j); if (i == 0) { - initializeComputing(); + initializeBlueprint(); } return result; @@ -121,7 +143,7 @@ public void setInventorySlotContents(int i, ItemStack itemstack) { inv.setInventorySlotContents(i, itemstack); if (i == 0) { - initializeComputing(); + initializeBlueprint(); } } @@ -137,7 +159,7 @@ public int getInventoryStackLimit() { @Override public boolean isUseableByPlayer(EntityPlayer entityplayer) { - return worldObj.getTileEntity(pos) == this; + return mode != Mode.NONE && worldObj.getTileEntity(pos) == this; } @Override @@ -150,6 +172,7 @@ public void readFromNBT(NBTTagCompound nbt) { inv.readFromNBT(nbt); + mode = Mode.values()[nbt.getByte("mode")]; name = nbt.getString("name"); currentAuthorName = nbt.getString("lastAuthor"); @@ -178,6 +201,7 @@ public void writeToNBT(NBTTagCompound nbt) { inv.writeToNBT(nbt); + nbt.setByte("mode", (byte) mode.ordinal()); nbt.setString("name", name); nbt.setString("lastAuthor", currentAuthorName); @@ -194,15 +218,22 @@ public void writeToNBT(NBTTagCompound nbt) { nbt.setTag("subBlueprints", subBptList); } + private boolean getIsWorking() { + return mode == Mode.COPY ? reader != null : false; + } + @Override public void writeData(ByteBuf stream) { box.writeData(stream); NetworkUtils.writeUTF(stream, name); - readConfiguration.writeData(stream); - stream.writeBoolean(reader != null); - stream.writeShort(subLasers.size()); - for (LaserData ld : subLasers) { - ld.writeData(stream); + stream.writeBoolean(getIsWorking()); + stream.writeByte(mode.ordinal()); + if (mode == Mode.COPY) { + readConfiguration.writeData(stream); + stream.writeShort(subLasers.size()); + for (LaserData ld : subLasers) { + ld.writeData(stream); + } } } @@ -210,20 +241,18 @@ public void writeData(ByteBuf stream) { public void readData(ByteBuf stream) { box.readData(stream); name = NetworkUtils.readUTF(stream); - readConfiguration.readData(stream); - boolean newIsProcessing = stream.readBoolean(); - if (newIsProcessing != isProcessing) { - isProcessing = newIsProcessing; - worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(), getPos().getY(), getPos() - .getZ()); - } - - int size = stream.readUnsignedShort(); - subLasers.clear(); - for (int i = 0; i < size; i++) { - LaserData ld = new LaserData(); - ld.readData(stream); - subLasers.add(ld); + clientIsWorking = stream.readBoolean(); + mode = Mode.values()[stream.readByte()]; + + if (mode == Mode.COPY) { + readConfiguration.readData(stream); + int size = stream.readUnsignedShort(); + subLasers.clear(); + for (int i = 0; i < size; i++) { + LaserData ld = new LaserData(); + ld.readData(stream); + subLasers.add(ld); + } } } @@ -233,12 +262,14 @@ public void invalidate() { destroy(); } - private void initializeComputing() { + private void initializeBlueprint() { if (getWorld().isRemote) { return; } - reader = new RecursiveBlueprintReader(this); + if (mode == Mode.COPY) { + reader = new RecursiveBlueprintReader(this); + } sendNetworkUpdate(); } @@ -316,9 +347,10 @@ public void write(ByteBuf data) { } public void addSubBlueprint(TileEntity sub) { - addSubBlueprint(sub.getPos()); - - sendNetworkUpdate(); + if (mode == Mode.COPY) { + addSubBlueprint(sub.getPos()); + sendNetworkUpdate(); + } } private void addSubBlueprint(BlockPos index) { @@ -335,4 +367,10 @@ private void addSubBlueprint(BlockPos index) { public String getInventoryName() { return "Template"; } + + @Override + @SideOnly(Side.CLIENT) + public double getMaxRenderDistanceSquared() { + return Double.MAX_VALUE; + } } diff --git a/common/buildcraft/builders/TileBlueprintLibrary.java b/common/buildcraft/builders/TileBlueprintLibrary.java index d17ea9832d..6dbfffa43f 100644 --- a/common/buildcraft/builders/TileBlueprintLibrary.java +++ b/common/buildcraft/builders/TileBlueprintLibrary.java @@ -1,12 +1,12 @@ /** 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.builders; import java.io.ByteArrayInputStream; import java.io.IOException; -import java.util.ArrayList; +import java.util.List; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; @@ -44,15 +44,13 @@ public class TileBlueprintLibrary extends TileBuildCraft implements IInventory, public int progressIn = 0; public int progressOut = 0; - public ArrayList currentPage; + public List entries; public int selected = -1; public EntityPlayer uploadingPlayer = null; public EntityPlayer downloadingPlayer = null; - public int pageId = 0; - private LibraryId blueprintDownloadId; private byte[] blueprintDownload; @@ -63,7 +61,8 @@ public TileBlueprintLibrary() { public void refresh() { if (worldObj.isRemote) { BuildCraftBuilders.clientDB.refresh(); - setCurrentPage(BuildCraftBuilders.clientDB.getPage(pageId)); + entries = BuildCraftBuilders.clientDB.getBlueprintIds(); + selected = -1; } } @@ -74,36 +73,13 @@ public void initialize() { refresh(); } - public void setCurrentPage(ArrayList newPage) { - currentPage = newPage; - selected = -1; - } - - public void pageNext() { - if (pageId < BuildCraftBuilders.clientDB.getPageNumber() - 1) { - pageId++; - } - - setCurrentPage(BuildCraftBuilders.clientDB.getPage(pageId)); - } - - public void pagePrev() { - if (pageId > 0) { - pageId--; - } - - setCurrentPage(BuildCraftBuilders.clientDB.getPage(pageId)); - } - public void deleteSelectedBpt() { if (selected != -1) { - BuildCraftBuilders.clientDB.deleteBlueprint(currentPage.get(selected)); - - if (pageId > BuildCraftBuilders.clientDB.getPageNumber() - 1 && pageId > 0) { - pageId--; + BuildCraftBuilders.clientDB.deleteBlueprint(entries.get(selected)); + entries = BuildCraftBuilders.clientDB.getBlueprintIds(); + if (selected >= entries.size()) { + selected--; } - - setCurrentPage(BuildCraftBuilders.clientDB.getPage(pageId)); } } @@ -298,16 +274,16 @@ public void receiveCommand(String command, Side side, Object sender, ByteBuf str if (side.isClient()) { if ("requestSelectedBlueprint".equals(command)) { if (isOutputConsistent()) { - if (selected > -1 && selected < currentPage.size()) { + if (selected > -1 && selected < entries.size()) { // Work around 32k max limit on client->server - final NBTTagCompound compound = BuildCraftBuilders.clientDB.load(currentPage.get(selected)); - compound.setString("__filename", currentPage.get(selected).name); + final NBTTagCompound compound = BuildCraftBuilders.clientDB.load(entries.get(selected)); + compound.setString("__filename", entries.get(selected).name); final byte[] bptData = NBTUtils.save(compound); final int chunks = (bptData.length + CHUNK_SIZE - 1) / CHUNK_SIZE; BuildCraftCore.instance.sendToServer(new PacketCommand(this, "uploadServerBegin", new CommandWriter() { public void write(ByteBuf data) { - currentPage.get(selected).writeData(data); + entries.get(selected).writeData(data); data.writeShort(chunks); } })); @@ -343,7 +319,7 @@ public void write(ByteBuf data) { NBTTagCompound nbt = CompressedStreamTools.readCompressed(new ByteArrayInputStream(data)); BuildCraftBuilders.clientDB.add(id, nbt); - setCurrentPage(BuildCraftBuilders.clientDB.getPage(pageId)); + entries = BuildCraftBuilders.clientDB.getBlueprintIds(); } catch (IOException e) { e.printStackTrace(); } @@ -409,10 +385,10 @@ public void write(ByteBuf data) { } private boolean isOutputConsistent() { - if (selected == -1 || getStackInSlot(2) == null) { + if (selected <= -1 || selected >= entries.size() || getStackInSlot(2) == null) { return false; } - return LibraryAPI.getHandlerFor(currentPage.get(selected).extension).isHandler(getStackInSlot(2), LibraryTypeHandler.HandlerType.LOAD); + return LibraryAPI.getHandlerFor(entries.get(selected).extension).isHandler(getStackInSlot(2), LibraryTypeHandler.HandlerType.LOAD); } } diff --git a/common/buildcraft/builders/TileBuilder.java b/common/buildcraft/builders/TileBuilder.java index f056fb9d3f..65345473ff 100644 --- a/common/buildcraft/builders/TileBuilder.java +++ b/common/buildcraft/builders/TileBuilder.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.builders; import java.util.ArrayList; @@ -11,6 +15,7 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; @@ -20,45 +25,32 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.Vec3; import net.minecraft.world.WorldSettings.GameType; + import net.minecraftforge.common.util.Constants; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTankInfo; -import net.minecraftforge.fluids.IFluidHandler; +import net.minecraftforge.fluids.*; import net.minecraftforge.fml.relauncher.Side; import buildcraft.BuildCraftBuilders; import buildcraft.BuildCraftCore; +import buildcraft.api.core.BCLog; import buildcraft.api.core.IInvSlot; +import buildcraft.api.core.IPathProvider; +import buildcraft.api.core.SafeTimeTracker; import buildcraft.api.enums.EnumBlueprintType; import buildcraft.api.properties.BuildCraftProperties; -import buildcraft.api.robots.EntityRobotBase; import buildcraft.api.robots.IRequestProvider; -import buildcraft.api.robots.ResourceIdRequest; -import buildcraft.api.robots.RobotManager; -import buildcraft.api.robots.StackRequest; import buildcraft.api.tiles.IControllable; import buildcraft.api.tiles.IHasWork; import buildcraft.builders.blueprints.RecursiveBlueprintBuilder; import buildcraft.core.Box; import buildcraft.core.Box.Kind; import buildcraft.core.LaserData; -import buildcraft.core.blueprints.Blueprint; -import buildcraft.core.blueprints.BlueprintBase; -import buildcraft.core.blueprints.BptBuilderBase; -import buildcraft.core.blueprints.BptBuilderBlueprint; -import buildcraft.core.blueprints.BptBuilderTemplate; +import buildcraft.core.TilePathMarker; +import buildcraft.core.blueprints.*; import buildcraft.core.builders.TileAbstractBuilder; import buildcraft.core.lib.fluids.Tank; import buildcraft.core.lib.fluids.TankManager; -import buildcraft.core.lib.inventory.IInventoryListener; -import buildcraft.core.lib.inventory.ITransactor; -import buildcraft.core.lib.inventory.InvUtils; -import buildcraft.core.lib.inventory.InventoryIterator; -import buildcraft.core.lib.inventory.SimpleInventory; -import buildcraft.core.lib.inventory.StackHelper; -import buildcraft.core.lib.inventory.Transactor; +import buildcraft.core.lib.inventory.*; import buildcraft.core.lib.network.base.Packet; import buildcraft.core.lib.network.command.CommandWriter; import buildcraft.core.lib.network.command.PacketCommand; @@ -74,16 +66,24 @@ public class TileBuilder extends TileAbstractBuilder implements IHasWork, IFluid public Box box = new Box(); public PathIterator currentPathIterator; - public Tank[] fluidTanks = new Tank[] { new Tank("fluid1", FluidContainerRegistry.BUCKET_VOLUME * 8, this), new Tank("fluid2", - FluidContainerRegistry.BUCKET_VOLUME * 8, this), new Tank("fluid3", FluidContainerRegistry.BUCKET_VOLUME * 8, this), new Tank("fluid4", - FluidContainerRegistry.BUCKET_VOLUME * 8, this) }; + public Tank[] fluidTanks = new Tank[]{ + //@formatter:off + new Tank("fluid1", FluidContainerRegistry.BUCKET_VOLUME * 8, this), + new Tank("fluid2", FluidContainerRegistry.BUCKET_VOLUME * 8, this), + new Tank("fluid3", FluidContainerRegistry.BUCKET_VOLUME * 8, this), + new Tank("fluid4", FluidContainerRegistry.BUCKET_VOLUME * 8, this) + //@formatter:on + }; public TankManager fluidTank = new TankManager(fluidTanks); + private SafeTimeTracker networkUpdateTracker = new SafeTimeTracker(BuildCraftCore.updateFactor / 2); + private boolean shouldUpdateRequirements; + private SimpleInventory inv = new SimpleInventory(28, "Builder", 64); private BptBuilderBase currentBuilder; private RecursiveBlueprintBuilder recursiveBuilder; - private LinkedList path; - private ArrayList requiredToBuild; + private List path; + private List requiredToBuild; private NBTTagCompound initNBT = null; private boolean done = true; private boolean isBuilding = false; @@ -156,13 +156,9 @@ public BptBuilderBase next() { AxisAlignedBB boundingBox = bpt.getBoundingBox(); if (oldBoundingBox == null || !collision(oldBoundingBox, boundingBox)) { - oldBoundingBox = boundingBox; - - if (bpt != null) { return bpt; } - } ix += cx; iy += cy; @@ -249,14 +245,9 @@ public void initialize() { for (int z = pos.getZ() - 1; z <= pos.getZ() + 1; ++z) { TileEntity tile = worldObj.getTileEntity(pos); - if (tile instanceof TilePathMarker) { - path = ((TilePathMarker) tile).getPath(); - - for (BlockPos b : path) { - IBlockState state = worldObj.getBlockState(b); - worldObj.setBlockToAir(b); - BuildCraftBuilders.pathMarkerBlock.dropBlockAsItem(worldObj, b, state, 0); - } + if (tile instanceof IPathProvider) { + path = ((IPathProvider) tile).getPath(); + ((IPathProvider) tile).removeFromWorld(); break; } @@ -266,7 +257,6 @@ public void initialize() { if (path != null && pathLasers.size() == 0) { createLasersForPath(); - sendNetworkUpdate(); } @@ -290,7 +280,7 @@ public void createLasersForPath() { } public BlueprintBase instanciateBlueprint() { - BlueprintBase bpt = null; + BlueprintBase bpt; try { bpt = ItemBlueprint.loadBlueprint(getStackInSlot(0)); @@ -336,7 +326,7 @@ public void iterateBpt(boolean forceIterate) { currentPathIterator = null; } - updateRequirements(); + scheduleRequirementUpdate(); sendNetworkUpdate(); @@ -376,13 +366,13 @@ public void iterateBpt(boolean forceIterate) { done = false; } - updateRequirements(); + scheduleRequirementUpdate(); } else { if (currentBuilder != null && currentBuilder.isDone(this)) { currentBuilder.postProcessing(worldObj); currentBuilder = recursiveBuilder.nextBuilder(); - updateRequirements(); + scheduleRequirementUpdate(); } else { BlueprintBase bpt = instanciateBlueprint(); @@ -392,7 +382,7 @@ public void iterateBpt(boolean forceIterate) { currentBuilder = recursiveBuilder.nextBuilder(); - updateRequirements(); + scheduleRequirementUpdate(); } } @@ -567,7 +557,13 @@ public void update() { return; } - if ((currentBuilder == null || currentBuilder.isDone(this)) && box.isInitialized()) { + if (shouldUpdateRequirements && networkUpdateTracker.markTimeIfDelay(worldObj)) { + updateRequirements(); + shouldUpdateRequirements = false; + } + + if ((currentBuilder == null || currentBuilder.isDone(this)) + && box.isInitialized()) { box.reset(); sendNetworkUpdate(); @@ -578,15 +574,14 @@ public void update() { iterateBpt(false); if (mode != Mode.Off) { - if (getWorld().getWorldInfo().getGameType() == GameType.CREATIVE) { - build(); - } else if (getBattery().getEnergyStored() > POWER_ACTIVATION) { + if (getWorld().getWorldInfo().getGameType() == GameType.CREATIVE + || getBattery().getEnergyStored() > POWER_ACTIVATION) { build(); } } if (!isBuilding && this.isBuildingBlueprint()) { - updateRequirements(); + scheduleRequirementUpdate(); } isBuilding = this.isBuildingBlueprint(); @@ -606,8 +601,8 @@ public boolean isBuildingBlueprint() { return getStackInSlot(0) != null && getStackInSlot(0).getItem() instanceof ItemBlueprint; } - public List getNeededItems() { - return requiredToBuild; + public List getNeededItems() { + return worldObj.isRemote ? requiredToBuild : (currentBuilder instanceof BptBuilderBlueprint ? ((BptBuilderBlueprint) currentBuilder).getNeededItems() : null); } @Override @@ -617,12 +612,24 @@ public void receiveCommand(String command, Side side, Object sender, ByteBuf str if ("clearItemRequirements".equals(command)) { requiredToBuild = null; } else if ("setItemRequirements".equals(command)) { - int size = stream.readUnsignedShort(); - requiredToBuild = new ArrayList(); + int size = stream.readUnsignedMedium(); + requiredToBuild = new ArrayList(); for (int i = 0; i < size; i++) { - ItemStack stack = NetworkUtils.readStack(stream); - stack.stackSize = Math.min(999, stream.readUnsignedShort()); - requiredToBuild.add(stack); + int itemId = stream.readUnsignedShort(); + int itemDamage = stream.readShort(); + int stackSize = stream.readUnsignedMedium(); + boolean hasCompound = stackSize >= 0x800000; + + ItemStack stack = new ItemStack(Item.getItemById(itemId), 1, itemDamage); + if (hasCompound) { + stack.setTagCompound(NetworkUtils.readNBT(stream)); + } + + if (stack.getItem() != null) { + requiredToBuild.add(new RequirementItemStack(stack, stackSize & 0x7FFFFF)); + } else { + BCLog.logger.error("Corrupt ItemStack in TileBuilder.receiveCommand! This should not happen! (ID " + itemId + ", damage " + itemDamage + ")"); + } } } } else if (side.isServer()) { @@ -640,15 +647,20 @@ public void receiveCommand(String command, Side side, Object sender, ByteBuf str } } - private Packet getItemRequirementsPacket(final ArrayList items) { - if (items != null) { + private Packet getItemRequirementsPacket(List itemsIn) { + if (itemsIn != null) { + final List items = new ArrayList(); + items.addAll(itemsIn); + return new PacketCommand(this, "setItemRequirements", new CommandWriter() { public void write(ByteBuf data) { - data.writeShort(items.size()); - if (items != null) { - for (ItemStack rb : items) { - NetworkUtils.writeStack(data, rb); - data.writeShort(rb.stackSize); + data.writeMedium(items.size()); + for (RequirementItemStack rb : items) { + data.writeShort(Item.getIdFromItem(rb.stack.getItem())); + data.writeShort(rb.stack.getItemDamage()); + data.writeMedium((rb.stack.hasTagCompound() ? 0x800000 : 0x000000) | Math.min(0x7FFFFF, rb.size)); + if (rb.stack.hasTagCompound()) { + NetworkUtils.writeNBT(data, rb.stack.getTagCompound()); } } } @@ -696,17 +708,17 @@ public AxisAlignedBB getRenderBoundingBox() { public void build() { if (currentBuilder != null) { - if (currentBuilder.buildNextSlot(worldObj, this, pos.getX(), pos.getY(), pos.getZ())) { - updateRequirements(); + if (currentBuilder.buildNextSlot(worldObj, this, pos.getX(), pos.getY(), pos.getZ())) { + scheduleRequirementUpdate(); } } } - public void updateRequirements() { - ArrayList reqCopy = null; + private void updateRequirements() { + List reqCopy = null; if (currentBuilder instanceof BptBuilderBlueprint) { currentBuilder.initialize(); - reqCopy = ((BptBuilderBlueprint) currentBuilder).neededItems; + reqCopy = ((BptBuilderBlueprint) currentBuilder).getNeededItems(); } for (EntityPlayer p : guiWatchers) { @@ -714,11 +726,15 @@ public void updateRequirements() { } } - public void updateRequirements(EntityPlayer caller) { - ArrayList reqCopy = null; + public void scheduleRequirementUpdate() { + shouldUpdateRequirements = true; + } + + public void updateRequirementsOnGuiOpen(EntityPlayer caller) { + List reqCopy = null; if (currentBuilder instanceof BptBuilderBlueprint) { currentBuilder.initialize(); - reqCopy = ((BptBuilderBlueprint) currentBuilder).neededItems; + reqCopy = ((BptBuilderBlueprint) currentBuilder).getNeededItems(); } BuildCraftCore.instance.sendToPlayer(caller, getItemRequirementsPacket(reqCopy)); @@ -803,7 +819,7 @@ public FluidTankInfo[] getTankInfo(EnumFacing from) { } @Override - public int getNumberOfRequests() { + public int getRequestsCount() { if (currentBuilder == null) { return 0; } else if (!(currentBuilder instanceof BptBuilderBlueprint)) { @@ -811,68 +827,54 @@ public int getNumberOfRequests() { } else { BptBuilderBlueprint bpt = (BptBuilderBlueprint) currentBuilder; - return bpt.neededItems.size(); + return bpt.getNeededItems().size(); } } @Override - public StackRequest getAvailableRequest(int i) { + public ItemStack getRequest(int slot) { if (currentBuilder == null) { return null; } else if (!(currentBuilder instanceof BptBuilderBlueprint)) { return null; } else { BptBuilderBlueprint bpt = (BptBuilderBlueprint) currentBuilder; + List neededItems = bpt.getNeededItems(); - if (bpt.neededItems.size() <= i) { + if (neededItems.size() <= slot) { return null; } - ItemStack requirement = bpt.neededItems.get(i); + RequirementItemStack requirement = neededItems.get(slot); - int qty = quantityMissing(requirement); + int qty = quantityMissing(requirement.stack, requirement.size); if (qty <= 0) { return null; } - - StackRequest request = new StackRequest(); - - request.index = i; - request.requester = this; - request.stack = requirement; - - return request; - } - } - - @Override - public boolean takeRequest(int i, EntityRobotBase robot) { - if (currentBuilder == null) { - return false; - } else if (!(currentBuilder instanceof BptBuilderBlueprint)) { - return false; - } else { - return RobotManager.registryProvider.getRegistry(worldObj).take(new ResourceIdRequest(this, i), robot); + ItemStack requestStack = requirement.stack.copy(); + requestStack.stackSize = qty; + return requestStack; } } @Override - public ItemStack provideItemsForRequest(int i, ItemStack stack) { + public ItemStack offerItem(int slot, ItemStack stack) { if (currentBuilder == null) { return stack; } else if (!(currentBuilder instanceof BptBuilderBlueprint)) { return stack; } else { BptBuilderBlueprint bpt = (BptBuilderBlueprint) currentBuilder; + List neededItems = bpt.getNeededItems(); - if (bpt.neededItems.size() <= i) { + if (neededItems.size() <= slot) { return stack; } - ItemStack requirement = bpt.neededItems.get(i); + RequirementItemStack requirement = neededItems.get(slot); - int qty = quantityMissing(requirement); + int qty = quantityMissing(requirement.stack, requirement.size); if (qty <= 0) { return stack; @@ -896,12 +898,13 @@ public ItemStack provideItemsForRequest(int i, ItemStack stack) { } } - private int quantityMissing(ItemStack requirement) { - int left = requirement.stackSize; + private int quantityMissing(ItemStack requirement, int amount) { + int left = amount <= 0 ? requirement.stackSize : amount; for (IInvSlot slot : InventoryIterator.getIterable(this)) { if (slot.getStackInSlot() != null) { - if (StackHelper.isMatchingItem(requirement, slot.getStackInSlot())) { + // TODO: This should also be using the Schematic version of the function! + if (StackHelper.isEqualItem(requirement, slot.getStackInSlot())) { if (slot.getStackInSlot().stackSize >= left) { return 0; } else { @@ -957,4 +960,8 @@ public void onChange(int slot, ItemStack before, ItemStack after) { } } } + + public Tank[] getFluidTanks() { + return fluidTanks; + } } diff --git a/common/buildcraft/builders/TileConstructionMarker.java b/common/buildcraft/builders/TileConstructionMarker.java index b1542c9af6..257072d3cd 100755 --- a/common/buildcraft/builders/TileConstructionMarker.java +++ b/common/buildcraft/builders/TileConstructionMarker.java @@ -1,5 +1,5 @@ /** 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.builders; @@ -13,17 +13,14 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.EnumFacing; import net.minecraft.util.Vec3; + import net.minecraftforge.fml.relauncher.Side; +import buildcraft.BuildCraftCore; import buildcraft.core.Box; import buildcraft.core.Box.Kind; -import buildcraft.BuildCraftCore; import buildcraft.core.LaserData; -import buildcraft.core.blueprints.Blueprint; -import buildcraft.core.blueprints.BlueprintBase; -import buildcraft.core.blueprints.BptBuilderBase; -import buildcraft.core.blueprints.BptBuilderBlueprint; -import buildcraft.core.blueprints.BptContext; +import buildcraft.core.blueprints.*; import buildcraft.core.builders.BuildingItem; import buildcraft.core.builders.IBuildingItemsProvider; import buildcraft.core.internal.IBoxProvider; @@ -97,11 +94,12 @@ public void update() { BlueprintBase bpt = ItemBlueprint.loadBlueprint(itemBlueprint); if (bpt != null && bpt instanceof Blueprint) { bpt = bpt.adjustToWorld(worldObj, pos, direction); - - bluePrintBuilder = new BptBuilderBlueprint((Blueprint) bpt, worldObj, pos); - bptContext = bluePrintBuilder.getContext(); - box.initialize(bluePrintBuilder); - sendNetworkUpdate(); + if (bpt != null) { + bluePrintBuilder = new BptBuilderBlueprint((Blueprint) bpt, worldObj, pos); + bptContext = bluePrintBuilder.getContext(); + box.initialize(bluePrintBuilder); + sendNetworkUpdate(); + } } else { return; } @@ -205,7 +203,6 @@ public void addAndLaunchBuildingItem(BuildingItem item) { @Override public void receiveCommand(String command, Side side, Object sender, ByteBuf stream) { if (side.isServer() && "uploadBuildersInAction".equals(command)) { - BuildCraftCore.instance.sendToServer(new PacketCommand(this, "uploadBuildersInAction", null)); for (BuildingItem i : buildersInAction) { BuildCraftCore.instance.sendToPlayer((EntityPlayer) sender, createLaunchItemPacket(i)); } diff --git a/common/buildcraft/builders/TileFiller.java b/common/buildcraft/builders/TileFiller.java index 7aab405127..f346adbd66 100644 --- a/common/buildcraft/builders/TileFiller.java +++ b/common/buildcraft/builders/TileFiller.java @@ -1,5 +1,5 @@ /** 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.builders; @@ -9,8 +9,10 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; + import net.minecraftforge.fml.relauncher.Side; +import buildcraft.BuildCraftCore; import buildcraft.api.core.IAreaProvider; import buildcraft.api.filler.FillerManager; import buildcraft.api.properties.BuildCraftProperties; @@ -21,9 +23,7 @@ import buildcraft.api.tiles.IHasWork; import buildcraft.core.Box; import buildcraft.core.Box.Kind; -import buildcraft.BuildCraftCore; import buildcraft.core.blueprints.BptBuilderTemplate; -import buildcraft.core.blueprints.BptContext; import buildcraft.core.builders.TileAbstractBuilder; import buildcraft.core.builders.patterns.FillerPattern; import buildcraft.core.builders.patterns.PatternNone; @@ -43,10 +43,10 @@ public class TileFiller extends TileAbstractBuilder implements IHasWork, IContro public IStatementParameter[] patternParameters; private BptBuilderTemplate currentTemplate; - private BptContext context; private final Box box = new Box(); private boolean done = false; + private boolean excavate = true; private SimpleInventory inv = new SimpleInventory(27, "Filler", 64); private NBTTagCompound initNBT = null; @@ -57,6 +57,10 @@ public TileFiller() { initPatternParameters(); } + public boolean isExcavate() { + return excavate; + } + @Override public void initialize() { super.initialize(); @@ -69,17 +73,12 @@ public void initialize() { if (a != null) { box.initialize(a); - - if (a instanceof TileMarker) { - a.removeFromWorld(); - } - + a.removeFromWorld(); sendNetworkUpdate(); } - if (currentPattern != null && currentTemplate == null && box.isInitialized()) { - currentTemplate = currentPattern.getTemplateBuilder(box, getWorld(), patternParameters); - context = currentTemplate.getContext(); + if (currentTemplate == null) { + initTemplate(); } if (initNBT != null && currentTemplate != null) { @@ -89,6 +88,13 @@ public void initialize() { initNBT = null; } + private void initTemplate() { + if (currentPattern != null && box.isInitialized() && box.sizeX() > 0 && box.sizeY() > 0 && box.sizeZ() > 0) { + currentTemplate = currentPattern.getTemplateBuilder(box, getWorld(), patternParameters); + currentTemplate.blueprint.excavate = excavate; + } + } + @Override public void update() { super.update(); @@ -119,9 +125,8 @@ public void update() { } } - if (currentPattern != null && currentTemplate == null) { - currentTemplate = currentPattern.getTemplateBuilder(box, getWorld(), patternParameters); - context = currentTemplate.getContext(); + if (currentTemplate == null) { + initTemplate(); } if (currentTemplate != null) { @@ -192,7 +197,8 @@ public void readFromNBT(NBTTagCompound nbt) { box.initialize(nbt.getCompoundTag("box")); } - setDone(nbt.getBoolean("done")); + done = nbt.getBoolean("done"); + excavate = nbt.hasKey("excavate") ? nbt.getBoolean("excavate") : true; // The rest of load has to be done upon initialize. initNBT = (NBTTagCompound) nbt.getCompoundTag("bpt").copy(); @@ -212,7 +218,8 @@ public void writeToNBT(NBTTagCompound nbt) { box.writeToNBT(boxStore); nbt.setTag("box", boxStore); - nbt.setBoolean("done", isDone()); + nbt.setBoolean("done", done); + nbt.setBoolean("excavate", excavate); NBTTagCompound bptNBT = new NBTTagCompound(); @@ -295,7 +302,7 @@ private void readParametersFromNBT(NBTTagCompound nbt) { public void writeData(ByteBuf data) { super.writeData(data); box.writeData(data); - data.writeBoolean(isDone()); + data.writeByte((done ? 1 : 0) | (excavate ? 2 : 0)); NetworkUtils.writeUTF(data, currentPattern.getUniqueTag()); NBTTagCompound parameterData = new NBTTagCompound(); @@ -307,7 +314,9 @@ public void writeData(ByteBuf data) { public void readData(ByteBuf data) { super.readData(data); box.readData(data); - setDone(data.readBoolean()); + int flags = data.readUnsignedByte(); + done = (flags & 1) > 0; + excavate = (flags & 2) > 0; FillerPattern pattern = (FillerPattern) FillerManager.registry.getPattern(NetworkUtils.readUTF(data)); NBTTagCompound parameterData = NetworkUtils.readNBT(data); readParametersFromNBT(parameterData); @@ -343,12 +352,25 @@ public void write(ByteBuf data) { @Override public void receiveCommand(String command, Side side, Object sender, ByteBuf stream) { super.receiveCommand(command, side, sender, stream); - if (side.isServer() && "setPattern".equals(command)) { - String name = NetworkUtils.readUTF(stream); - setPattern((FillerPattern) FillerManager.registry.getPattern(name)); - } else if (side.isServer() && "setParameters".equals(command)) { - NBTTagCompound patternData = NetworkUtils.readNBT(stream); - readParametersFromNBT(patternData); + if (side.isServer()) { + if ("setPattern".equals(command)) { + String name = NetworkUtils.readUTF(stream); + setPattern((FillerPattern) FillerManager.registry.getPattern(name)); + + done = false; + } else if ("setParameters".equals(command)) { + NBTTagCompound patternData = NetworkUtils.readNBT(stream); + readParametersFromNBT(patternData); + + currentTemplate = null; + done = false; + } else if ("setFlags".equals(command)) { + excavate = stream.readBoolean(); + currentTemplate = null; + + sendNetworkUpdate(); + done = false; + } } } @@ -387,17 +409,6 @@ public void write(ByteBuf data) { })); } - @Deprecated - public int getIconGlowLevel(int renderPass) { - if (renderPass == 1) { // Red LED - return isDone() ? 15 : 0; - } else if (renderPass == 2) { // Green LED - return 0; - } else { - return -1; - } - } - private boolean isDone() { return done; } @@ -408,4 +419,8 @@ private void setDone(boolean done) { worldObj.setBlockState(pos, worldObj.getBlockState(pos).withProperty(BuildCraftProperties.LED_DONE, done)); } } + + public void setExcavate(boolean excavate) { + this.excavate = excavate; + } } diff --git a/common/buildcraft/builders/TileQuarry.java b/common/buildcraft/builders/TileQuarry.java index 1058378352..035ba9fd3d 100644 --- a/common/buildcraft/builders/TileQuarry.java +++ b/common/buildcraft/builders/TileQuarry.java @@ -1,5 +1,5 @@ /** 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.builders; @@ -12,22 +12,21 @@ import com.google.common.collect.Sets; import net.minecraft.block.Block; +import net.minecraft.block.BlockLiquid; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.MathHelper; +import net.minecraft.util.*; import net.minecraft.world.ChunkCoordIntPair; + import net.minecraftforge.common.ForgeChunkManager; import net.minecraftforge.common.ForgeChunkManager.Ticket; import net.minecraftforge.common.ForgeChunkManager.Type; import net.minecraftforge.common.util.FakePlayer; +import net.minecraftforge.fluids.IFluidBlock; import buildcraft.BuildCraftBuilders; import buildcraft.BuildCraftCore; @@ -49,7 +48,6 @@ import buildcraft.core.blueprints.BptBuilderBlueprint; import buildcraft.core.builders.TileAbstractBuilder; import buildcraft.core.internal.IDropControlInventory; -import buildcraft.core.internal.ILEDProvider; import buildcraft.core.lib.RFBattery; import buildcraft.core.lib.utils.BlockMiner; import buildcraft.core.lib.utils.BlockUtils; @@ -95,7 +93,6 @@ private static enum Stage { private NBTTagCompound initNBT = null; private BlockMiner miner; - private int ledState; public TileQuarry() { @@ -123,8 +120,8 @@ public void createUtilsIfNeeded() { } if (findTarget(false)) { - if (box != null && ((headPosX < box.xMin || headPosX > box.xMax) || (headPosZ < box.zMin || headPosZ > box.zMax))) { - setHead(box.xMin + 1, pos.getY() + 2, box.zMin + 1); + if ((headPosX < box.xMin || headPosX > box.xMax) || (headPosZ < box.zMin || headPosZ > box.zMax)) { + setHead(box.xMin + 1, getPos().getY() + 2, box.zMin + 1); } } } else { @@ -196,8 +193,8 @@ public void update() { // We are sending a network packet update ONLY below. // In this case, since idling() does it anyway, we should return. return; - } else if (getStage() == Stage.MOVING) { - int energyUsed = this.getBattery().useEnergy(20, (int) Math.ceil(20 + getBattery().getEnergyStored() / 10), false); + } else if (stage == Stage.MOVING) { + int energyUsed = this.getBattery().useEnergy(20, (int) Math.ceil(20D + (double) getBattery().getEnergyStored() / 10), false); if (energyUsed >= 20) { @@ -230,8 +227,8 @@ protected void dig() { } if (miner == null) { - // Hmm. - setStage(Stage.IDLE); + // Hmm. Probably shouldn't be mining if there's no miner. + stage = Stage.IDLE; return; } @@ -239,32 +236,47 @@ protected void dig() { getBattery().useEnergy(rfTaken, rfTaken, false); if (miner.hasMined()) { - // Collect any lost items laying around + // Collect any lost items laying around. double[] head = getHead(); AxisAlignedBB axis = new AxisAlignedBB(head[0] - 2, head[1] - 2, head[2] - 2, head[0] + 3, head[1] + 3, head[2] + 3); - @SuppressWarnings("rawtypes") - List result = worldObj.getEntitiesWithinAABB(EntityItem.class, axis); - for (int ii = 0; ii < result.size(); ii++) { - if (result.get(ii) instanceof EntityItem) { - EntityItem entity = (EntityItem) result.get(ii); - if (entity.isDead) { - continue; - } + List result = worldObj.getEntitiesWithinAABB(EntityItem.class, axis); + for (EntityItem entity : result) { + if (entity.isDead) { + continue; + } - ItemStack mineable = entity.getEntityItem(); - if (mineable.stackSize <= 0) { - continue; - } - CoreProxy.proxy.removeEntity(entity); - miner.mineStack(mineable); + ItemStack mineable = entity.getEntityItem(); + if (mineable.stackSize <= 0) { + continue; } + CoreProxy.proxy.removeEntity(entity); + miner.mineStack(mineable); } + } - setStage(Stage.IDLE); - miner = null; + setStage(Stage.IDLE); + miner = null; + + if (!findFrame()) { + initializeBlueprintBuilder(); + stage = Stage.BUILDING; + } else { + stage = Stage.IDLE; } } + protected boolean findFrame() { + for (EnumFacing face : EnumFacing.Plane.HORIZONTAL.facings()) { + if (box.contains(getPos().offset(face))) { + return worldObj.getBlockState(getPos().offset(face)).getBlock() == BuildCraftBuilders.frameBlock; + } + } + + // Could not find any location in box - this is strange, so obviously + // we're going to ignore it! + return true; + } + protected void idling() { if (!findTarget(true)) { // I believe the issue is box going null becuase of bad chunkloader positioning @@ -308,12 +320,9 @@ public boolean findTarget(boolean doSet) { int[] nextTarget = visitList.removeFirst(); if (!columnVisitListIsUpdated) { // nextTarget may not be accurate, at least search the target column for - // changes - for (int y = nextTarget[1] + 1; y < pos.getY() + 3; y++) { - BlockPos pos = new BlockPos(nextTarget[0], y, nextTarget[2]); - IBlockState state = worldObj.getBlockState(pos); - Block block = state.getBlock(); - if (BlockUtils.isAnObstructingBlock(block, worldObj, pos) || !BuildCraftAPI.isSoftBlock(worldObj, pos)) { + // changes + for (int y = nextTarget[1] + 1; y < getPos().getY() + 3; y++) { + if (isQuarriableBlock(new BlockPos(nextTarget[0], y, nextTarget[2]))) { createColumnVisitList(); columnVisitListIsUpdated = true; nextTarget = null; @@ -336,8 +345,6 @@ public boolean findTarget(boolean doSet) { /** Make the column visit list: called once per layer */ private void createColumnVisitList() { visitList.clear(); - - Integer[][] columnHeights = new Integer[builder.blueprint.sizeX - 2][builder.blueprint.sizeZ - 2]; boolean[][] blockedColumns = new boolean[builder.blueprint.sizeX - 2][builder.blueprint.sizeZ - 2]; for (int searchY = pos.getY() + 3; searchY >= 1; --searchY) { @@ -368,33 +375,20 @@ private void createColumnVisitList() { for (int searchZ = startZ; searchZ != endZ; searchZ += incZ) { if (!blockedColumns[searchX][searchZ]) { - Integer height = columnHeights[searchX][searchZ]; int bx = box.xMin + searchX + 1, by = searchY, bz = box.zMin + searchZ + 1; - if (height == null) { - columnHeights[searchX][searchZ] = height = worldObj.getHeight(new BlockPos(bx, 0, bz)).getY(); - } - - if (height > 0 && height < by && worldObj.provider.getDimensionId() != -1) { - continue; - } - BlockPos pos = new BlockPos(bx, by, bz); IBlockState state = worldObj.getBlockState(pos); + Block block = state.getBlock(); if (!BlockUtils.canChangeBlock(state, worldObj, pos)) { blockedColumns[searchX][searchZ] = true; - } else if (!BuildCraftAPI.isSoftBlock(worldObj, pos)) { + } else if (!BuildCraftAPI.isSoftBlock(worldObj, pos) && !(block instanceof BlockLiquid) && !(block instanceof IFluidBlock)) { visitList.add(new int[] { bx, by, bz }); } - if (height == 0 && !worldObj.isAirBlock(pos)) { - columnHeights[searchX][searchZ] = by; - } - // Stop at two planes - generally any obstructions will have been found and will force a // recompute prior to this - if (visitList.size() > builder.blueprint.sizeZ * builder.blueprint.sizeX * 2) { return; } @@ -402,6 +396,7 @@ private void createColumnVisitList() { } } } + } @Override @@ -484,7 +479,9 @@ public void positionReached() { private boolean isQuarriableBlock(BlockPos pos) { IBlockState state = worldObj.getBlockState(pos); - return BlockUtils.canChangeBlock(state, worldObj, pos) && !BuildCraftAPI.isSoftBlock(worldObj, pos); + Block block = state.getBlock(); + return BlockUtils.canChangeBlock(state, worldObj, pos) && !BuildCraftAPI.isSoftBlock(worldObj, pos) && !(block instanceof BlockLiquid) + && !(block instanceof IFluidBlock); } @Override @@ -542,6 +539,7 @@ private void setBoundaries(boolean useDefaultI) { if (BuildCraftBuilders.quarryLoadsChunks && chunkTicket == null) { chunkTicket = ForgeChunkManager.requestTicket(BuildCraftBuilders.instance, worldObj, Type.NORMAL); } + if (chunkTicket != null) { chunkTicket.getModData().setInteger("quarryX", pos.getX()); chunkTicket.getModData().setInteger("quarryY", pos.getY()); @@ -564,17 +562,14 @@ private void setBoundaries(boolean useDefaultI) { int xSize = a.xMax() - a.xMin() + 1; int zSize = a.zMax() - a.zMin() + 1; - if (chunkTicket != null) { - if (xSize < 3 || zSize < 3 || ((xSize * zSize) >> 8) >= chunkTicket.getMaxChunkListDepth()) { - if (placedBy != null) { - placedBy.addChatMessage(new ChatComponentText(String.format( - "Quarry size is outside of chunkloading bounds or too small %d %d (%d)", xSize, zSize, chunkTicket - .getMaxChunkListDepth()))); - } - - a = new DefaultAreaProvider(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 10, pos.getY() + 4, pos.getZ() + 10); - useDefault = true; + if (xSize < 3 || zSize < 3 || (chunkTicket != null && ((xSize * zSize) >> 8) >= chunkTicket.getMaxChunkListDepth())) { + if (placedBy != null) { + placedBy.addChatMessage(new ChatComponentTranslation("chat.buildcraft.quarry.tooSmall", xSize, zSize, chunkTicket != null + ? chunkTicket.getMaxChunkListDepth() : 0)); } + + a = new DefaultAreaProvider(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 10, pos.getY() + 4, pos.getZ() + 10); + useDefault = true; } xSize = a.xMax() - a.xMin() + 1; @@ -630,9 +625,12 @@ private void initializeBlueprintBuilder() { Blueprint bpt = pqf.getBlueprint(box, worldObj); // TODO (PASS 1): Fix this to make it work properly with the new frame mechanics - - builder = new BptBuilderBlueprint(bpt, worldObj, new BlockPos(box.xMin, pos.getY(), box.zMin)); - setStage(Stage.BUILDING); + if (bpt != null) { + builder = new BptBuilderBlueprint(bpt, worldObj, new BlockPos(box.xMin, getPos().getY(), box.zMin)); + speed = 0; + stage = Stage.BUILDING; + sendNetworkUpdate(); + } } @Override @@ -646,8 +644,8 @@ public void writeData(ByteBuf stream) { stream.writeDouble(headPosY); stream.writeDouble(headPosZ); stream.writeFloat((float) speed); - stream.writeFloat((float) headTrajectory); - int flags = getStage().ordinal(); + stream.writeFloat(headTrajectory); + int flags = stage.ordinal(); flags |= movingHorizontally ? 0x10 : 0; flags |= movingVertically ? 0x20 : 0; stream.writeByte(flags); @@ -861,18 +859,7 @@ public void forceChunkLoading(Ticket ticket) { } if (placedBy != null && !(placedBy instanceof FakePlayer)) { - placedBy.addChatMessage(new ChatComponentText(String.format("[BUILDCRAFT] The quarry at %d %d %d will keep %d chunks loaded", pos.getX(), - pos.getY(), pos.getZ(), chunks.size()))); - } - } - - public int getIconGlowLevel(int renderPass) { - if (renderPass == 2) { // Red LED - return ledState & 15; - } else if (renderPass == 3) { // Green LED - return (ledState >> 4) > 0 ? 15 : 0; - } else { - return -1; + placedBy.addChatMessage(new ChatComponentTranslation("chat.buildcraft.quarry.chunkloadInfo", getPos(), chunks.size())); } } diff --git a/common/buildcraft/builders/blueprints/IBlueprintBuilderAgent.java b/common/buildcraft/builders/blueprints/IBlueprintBuilderAgent.java index a9745dea70..fbe2ad8b1b 100755 --- a/common/buildcraft/builders/blueprints/IBlueprintBuilderAgent.java +++ b/common/buildcraft/builders/blueprints/IBlueprintBuilderAgent.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.builders.blueprints; import net.minecraft.inventory.IInventory; diff --git a/common/buildcraft/builders/blueprints/RealBlueprintDeployer.java b/common/buildcraft/builders/blueprints/RealBlueprintDeployer.java index 9513df10c1..226277105c 100755 --- a/common/buildcraft/builders/blueprints/RealBlueprintDeployer.java +++ b/common/buildcraft/builders/blueprints/RealBlueprintDeployer.java @@ -1,5 +1,5 @@ /** 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.builders.blueprints; @@ -13,11 +13,7 @@ import buildcraft.api.blueprints.BlueprintDeployer; import buildcraft.builders.LibraryDatabase; -import buildcraft.core.blueprints.Blueprint; -import buildcraft.core.blueprints.BlueprintBase; -import buildcraft.core.blueprints.BptBuilderBlueprint; -import buildcraft.core.blueprints.BptContext; -import buildcraft.core.blueprints.LibraryId; +import buildcraft.core.blueprints.*; import buildcraft.core.lib.utils.NBTUtils; import buildcraft.core.lib.utils.Utils; diff --git a/common/buildcraft/builders/blueprints/RecursiveBlueprintBuilder.java b/common/buildcraft/builders/blueprints/RecursiveBlueprintBuilder.java index cce7c828a7..c083c73926 100755 --- a/common/buildcraft/builders/blueprints/RecursiveBlueprintBuilder.java +++ b/common/buildcraft/builders/blueprints/RecursiveBlueprintBuilder.java @@ -1,5 +1,5 @@ /** 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.builders.blueprints; @@ -12,12 +12,7 @@ import net.minecraft.world.World; import buildcraft.core.Box; -import buildcraft.core.blueprints.Blueprint; -import buildcraft.core.blueprints.BlueprintBase; -import buildcraft.core.blueprints.BptBuilderBase; -import buildcraft.core.blueprints.BptBuilderBlueprint; -import buildcraft.core.blueprints.BptBuilderTemplate; -import buildcraft.core.blueprints.Template; +import buildcraft.core.blueprints.*; public class RecursiveBlueprintBuilder { @@ -41,7 +36,7 @@ public RecursiveBlueprintBuilder(BlueprintBase iBlueprint, World iWorld, BlockPo public BptBuilderBase nextBuilder() { if (!returnedThis) { - blueprint.adjustToWorld(world, pos, dir); + blueprint = blueprint.adjustToWorld(world, pos, dir); returnedThis = true; diff --git a/common/buildcraft/builders/blueprints/RecursiveBlueprintReader.java b/common/buildcraft/builders/blueprints/RecursiveBlueprintReader.java index 318af3b292..49fa0b3657 100644 --- a/common/buildcraft/builders/blueprints/RecursiveBlueprintReader.java +++ b/common/buildcraft/builders/blueprints/RecursiveBlueprintReader.java @@ -1,5 +1,5 @@ /** 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.builders.blueprints; @@ -12,14 +12,9 @@ import net.minecraft.util.Vec3; import net.minecraft.world.World; -import buildcraft.api.properties.BuildCraftProperties; import buildcraft.BuildCraftBuilders; -import buildcraft.builders.ItemBlueprint; -import buildcraft.builders.ItemBlueprintStandard; -import buildcraft.builders.ItemBlueprintTemplate; -import buildcraft.builders.TileArchitect; -import buildcraft.builders.TileBuilder; -import buildcraft.builders.TileConstructionMarker; +import buildcraft.api.properties.BuildCraftProperties; +import buildcraft.builders.*; import buildcraft.core.blueprints.Blueprint; import buildcraft.core.blueprints.BlueprintBase; import buildcraft.core.blueprints.BptContext; @@ -42,7 +37,6 @@ public class RecursiveBlueprintReader { private float computingTime = 0; private boolean done = false; - private boolean saveInItem = false; private BlueprintBase parentBlueprint; @@ -179,7 +173,7 @@ public void iterate() { } } } - } else if (blockScanner != null && writingBlueprint.getData() != null) { + } else if (blockScanner != null) { createBlueprint(); done = true; @@ -197,10 +191,7 @@ public void createBlueprint() { 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/builders/gui/ContainerArchitect.java b/common/buildcraft/builders/gui/ContainerArchitect.java index f4eb8fd6b8..425a0cf442 100644 --- a/common/buildcraft/builders/gui/ContainerArchitect.java +++ b/common/buildcraft/builders/gui/ContainerArchitect.java @@ -1,5 +1,5 @@ /** 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.builders.gui; @@ -51,8 +51,8 @@ public void onCraftGuiOpened(ICrafting icrafting) { public void detectAndSendChanges() { super.detectAndSendChanges(); - for (int i = 0; i < crafters.size(); i++) { - ICrafting icrafting = (ICrafting) crafters.get(i); + for (Object crafter : crafters) { + ICrafting icrafting = (ICrafting) crafter; if (computingTime != architect.getComputingProgressScaled(24)) { icrafting.sendProgressBarUpdate(this, 0, architect.getComputingProgressScaled(24)); } diff --git a/common/buildcraft/builders/gui/ContainerBlueprintLibrary.java b/common/buildcraft/builders/gui/ContainerBlueprintLibrary.java index 522992617b..e11e768c18 100644 --- a/common/buildcraft/builders/gui/ContainerBlueprintLibrary.java +++ b/common/buildcraft/builders/gui/ContainerBlueprintLibrary.java @@ -1,5 +1,5 @@ /** 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.builders.gui; @@ -12,9 +12,10 @@ import buildcraft.builders.TileBlueprintLibrary; import buildcraft.core.lib.gui.BuildCraftContainer; import buildcraft.core.lib.gui.slots.SlotOutput; +import buildcraft.core.lib.gui.widgets.ScrollbarWidget; public class ContainerBlueprintLibrary extends BuildCraftContainer { - + protected ScrollbarWidget scrollbarWidget; protected IInventory playerInventory; protected TileBlueprintLibrary library; @@ -25,29 +26,33 @@ public ContainerBlueprintLibrary(EntityPlayer player, TileBlueprintLibrary libra this.playerInventory = player.inventory; this.library = library; - addSlotToContainer(new SlotBlueprintLibrary(library, player, 0, 211, 61)); - addSlotToContainer(new SlotOutput(library, 1, 167, 61)); + this.scrollbarWidget = new ScrollbarWidget(163, 21, 244, 0, 110); + this.scrollbarWidget.hidden = true; + this.addWidget(scrollbarWidget); + + addSlotToContainer(new SlotBlueprintLibrary(library, player, 0, 219, 57)); + addSlotToContainer(new SlotOutput(library, 1, 175, 57)); - addSlotToContainer(new SlotBlueprintLibrary(library, player, 2, 167, 79)); - addSlotToContainer(new SlotOutput(library, 3, 211, 79)); + addSlotToContainer(new SlotBlueprintLibrary(library, player, 2, 175, 79)); + addSlotToContainer(new SlotOutput(library, 3, 219, 79)); // Player inventory for (int l = 0; l < 3; l++) { for (int k1 = 0; k1 < 9; k1++) { - addSlotToContainer(new Slot(playerInventory, k1 + l * 9 + 9, 66 + k1 * 18, 140 + l * 18)); + addSlotToContainer(new Slot(playerInventory, k1 + l * 9 + 9, 8 + k1 * 18, 138 + l * 18)); } } for (int i1 = 0; i1 < 9; i1++) { - addSlotToContainer(new Slot(playerInventory, i1, 66 + i1 * 18, 198)); + addSlotToContainer(new Slot(playerInventory, i1, 8 + i1 * 18, 196)); } } @Override public void detectAndSendChanges() { super.detectAndSendChanges(); - for (int i = 0; i < crafters.size(); i++) { - ICrafting icrafting = (ICrafting) crafters.get(i); + for (Object crafter : crafters) { + ICrafting icrafting = (ICrafting) crafter; if (progressIn != library.progressIn) { icrafting.sendProgressBarUpdate(this, 0, library.progressIn); } diff --git a/common/buildcraft/builders/gui/ContainerBuilder.java b/common/buildcraft/builders/gui/ContainerBuilder.java index 4e3355fb7d..152d6f3584 100644 --- a/common/buildcraft/builders/gui/ContainerBuilder.java +++ b/common/buildcraft/builders/gui/ContainerBuilder.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.builders.gui; import net.minecraft.entity.player.EntityPlayer; @@ -11,17 +15,22 @@ import buildcraft.builders.TileBuilder; import buildcraft.core.lib.gui.BuildCraftContainer; +import buildcraft.core.lib.gui.widgets.ScrollbarWidget; public class ContainerBuilder extends BuildCraftContainer { - IInventory playerInventory; TileBuilder builder; + protected ScrollbarWidget scrollbarWidget; public ContainerBuilder(EntityPlayer player, TileBuilder builder) { super(player, builder.getSizeInventory()); this.playerInventory = player.inventory; this.builder = builder; + this.scrollbarWidget = new ScrollbarWidget(172, 17, 18, 0, 108); + this.scrollbarWidget.hidden = true; + this.addWidget(scrollbarWidget); + addSlotToContainer(new Slot(builder, 0, 80, 27)); for (int k = 0; k < 3; k++) { @@ -43,11 +52,15 @@ public ContainerBuilder(EntityPlayer player, TileBuilder builder) { if (!builder.getWorld().isRemote && playerInventory instanceof InventoryPlayer) { // Refresh the requirements list for the player opening the GUI, // in case he does not have it. - builder.updateRequirements(((InventoryPlayer) playerInventory).player); + builder.updateRequirementsOnGuiOpen(((InventoryPlayer) playerInventory).player); builder.addGuiWatcher(((InventoryPlayer) playerInventory).player); } } + public TileBuilder getBuilder() { + return builder; + } + @Override public void onContainerClosed(EntityPlayer player) { super.onContainerClosed(player); diff --git a/common/buildcraft/builders/gui/ContainerFiller.java b/common/buildcraft/builders/gui/ContainerFiller.java index de1f6e79e0..fc8ddfe347 100644 --- a/common/buildcraft/builders/gui/ContainerFiller.java +++ b/common/buildcraft/builders/gui/ContainerFiller.java @@ -1,13 +1,18 @@ -/** 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 */ +/** + * 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.builders.gui; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/common/buildcraft/builders/gui/GuiArchitect.java b/common/buildcraft/builders/gui/GuiArchitect.java index 12b92e34ce..530bf2a76b 100644 --- a/common/buildcraft/builders/gui/GuiArchitect.java +++ b/common/buildcraft/builders/gui/GuiArchitect.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.builders.gui; import java.io.IOException; diff --git a/common/buildcraft/builders/gui/GuiBlueprintLibrary.java b/common/buildcraft/builders/gui/GuiBlueprintLibrary.java index 4940722813..0c0a0eead7 100644 --- a/common/buildcraft/builders/gui/GuiBlueprintLibrary.java +++ b/common/buildcraft/builders/gui/GuiBlueprintLibrary.java @@ -1,5 +1,5 @@ /** 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.builders.gui; @@ -13,7 +13,6 @@ import net.minecraft.util.ResourceLocation; import buildcraft.api.library.LibraryAPI; -import buildcraft.BuildCraftBuilders; import buildcraft.builders.TileBlueprintLibrary; import buildcraft.core.DefaultProps; import buildcraft.core.blueprints.LibraryId; @@ -21,17 +20,14 @@ import buildcraft.core.lib.utils.StringUtils; public class GuiBlueprintLibrary extends GuiBuildCraft { - private static final ResourceLocation TEXTURE = new ResourceLocation("buildcraftbuilders:textures/gui/library_rw.png"); - private GuiButton nextPageButton; - private GuiButton prevPageButton; private GuiButton deleteButton; private TileBlueprintLibrary library; public GuiBlueprintLibrary(EntityPlayer player, TileBlueprintLibrary library) { super(new ContainerBlueprintLibrary(player, library), library, TEXTURE); - xSize = 234; - ySize = 225; + xSize = 244; + ySize = 220; this.library = library; } @@ -41,19 +37,16 @@ public GuiBlueprintLibrary(EntityPlayer player, TileBlueprintLibrary library) { public void initGui() { super.initGui(); - prevPageButton = new GuiButton(0, guiLeft + 158, guiTop + 23, 20, 20, "<"); - nextPageButton = new GuiButton(1, guiLeft + 180, guiTop + 23, 20, 20, ">"); - - buttonList.add(prevPageButton); - buttonList.add(nextPageButton); - - deleteButton = new GuiButton(2, guiLeft + 158, guiTop + 114, 25, 20, StringUtils.localize("gui.del")); + deleteButton = new GuiButton(2, guiLeft + 174, guiTop + 109, 25, 20, StringUtils.localize("gui.del")); buttonList.add(deleteButton); library.refresh(); checkDelete(); - checkPages(); + } + + private ContainerBlueprintLibrary getLibraryContainer() { + return (ContainerBlueprintLibrary) getContainer(); } @Override @@ -61,29 +54,30 @@ protected void drawGuiContainerForegroundLayer(int par1, int par2) { String title = StringUtils.localize("tile.libraryBlock.name"); fontRendererObj.drawString(title, getCenteredOffset(title), 6, 0x404040); - int c = 0; - for (LibraryId bpt : library.currentPage) { + int off = getLibraryContainer().scrollbarWidget.getPosition(); + for (int i = off; i < (off + 12); i++) { + if (i >= library.entries.size()) { + break; + } + LibraryId bpt = library.entries.get(i); String name = bpt.name; if (name.length() > DefaultProps.MAX_NAME_SIZE) { name = name.substring(0, DefaultProps.MAX_NAME_SIZE); } - if (c == library.selected) { + if (i == library.selected) { int l1 = 8; - int i2 = 24; - - // TODO - // if (bpt.kind == Kind.Blueprint) { - // drawGradientRect(l1, i2 + 9 * c, l1 + 146, i2 + 9 * (c + 1), 0xFFA0C0F0, 0xFFA0C0F0); - // } else { - drawGradientRect(l1, i2 + 9 * c, l1 + 146, i2 + 9 * (c + 1), 0x80ffffff, 0x80ffffff); - // } + int i2 = 22; + + drawGradientRect(l1, i2 + 9 * (i - off), l1 + 146, i2 + 9 * (i - off + 1), 0x80ffffff, 0x80ffffff); } - fontRendererObj.drawString(name, 9, 25 + 9 * c, LibraryAPI.getHandlerFor(bpt.extension).getTextColor()); + while (fontRendererObj.getStringWidth(name) > (160 - 9)) { + name = name.substring(0, name.length() - 1); + } - c++; + fontRendererObj.drawString(name, 9, 23 + 9 * (i - off), LibraryAPI.getHandlerFor(bpt.extension).getTextColor()); } } @@ -94,20 +88,21 @@ protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); - int inP = (int) (library.progressIn / 100.0 * 22.0); - int outP = (int) (library.progressOut / 100.0 * 22.0); + getLibraryContainer().scrollbarWidget.hidden = library.entries.size() <= 12; + getLibraryContainer().scrollbarWidget.setLength(Math.max(0, library.entries.size() - 12)); + + drawWidgets(x, y); - drawTexturedModalRect(guiLeft + 186 + 22 - inP, guiTop + 61, 234 + 22 - inP, 16, inP, 16); - drawTexturedModalRect(guiLeft + 186, guiTop + 78, 234, 0, outP, 16); + int inP = library.progressIn * 22 / 100; + int outP = library.progressOut * 22 / 100; + + drawTexturedModalRect(guiLeft + 194 + 22 - inP, guiTop + 57, 234 + 22 - inP, 240, inP, 16); + drawTexturedModalRect(guiLeft + 194, guiTop + 79, 234, 224, outP, 16); } @Override protected void actionPerformed(GuiButton button) { - if (button == nextPageButton) { - library.pageNext(); - } else if (button == prevPageButton) { - library.pagePrev(); - } else if (deleteButton != null && button == deleteButton) { + if (deleteButton != null && button == deleteButton) { library.deleteSelectedBpt(); } } @@ -118,18 +113,15 @@ protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOEx int x = mouseX - guiLeft; int y = mouseY - guiTop; - if (x >= 8 && x <= 88) { - int ySlot = (y - 24) / 9; + if (x >= 8 && x <= 161) { + int ySlot = (y - 22) / 9 + getLibraryContainer().scrollbarWidget.getPosition(); - if (ySlot >= 0 && ySlot <= 11) { - if (ySlot < library.currentPage.size()) { - library.selectBlueprint(ySlot); - } + if (ySlot > -1 && ySlot < library.entries.size()) { + library.selectBlueprint(ySlot); } } checkDelete(); - checkPages(); } protected void checkDelete() { @@ -139,18 +131,4 @@ protected void checkDelete() { deleteButton.enabled = false; } } - - protected void checkPages() { - if (library.pageId != 0) { - prevPageButton.enabled = true; - } else { - prevPageButton.enabled = false; - } - - if (library.pageId < BuildCraftBuilders.clientDB.getPageNumber() - 1) { - nextPageButton.enabled = true; - } else { - nextPageButton.enabled = false; - } - } } diff --git a/common/buildcraft/builders/gui/GuiBuilder.java b/common/buildcraft/builders/gui/GuiBuilder.java index 04c1a7e38c..8df5aff292 100644 --- a/common/buildcraft/builders/gui/GuiBuilder.java +++ b/common/buildcraft/builders/gui/GuiBuilder.java @@ -1,10 +1,10 @@ /** 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.builders.gui; -import java.io.IOException; +import java.util.ArrayList; import java.util.List; import org.lwjgl.opengl.GL11; @@ -12,15 +12,16 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; import buildcraft.BuildCraftCore; import buildcraft.builders.TileBuilder; +import buildcraft.core.blueprints.RequirementItemStack; import buildcraft.core.lib.fluids.Tank; +import buildcraft.core.lib.gui.AdvancedSlot; import buildcraft.core.lib.gui.GuiAdvancedInterface; -import buildcraft.core.lib.gui.ItemSlot; import buildcraft.core.lib.network.command.CommandWriter; import buildcraft.core.lib.network.command.PacketCommand; import buildcraft.core.lib.utils.StringUtils; @@ -30,15 +31,11 @@ public class GuiBuilder extends GuiAdvancedInterface { private static final ResourceLocation REGULAR_TEXTURE = new ResourceLocation("buildcraftbuilders:textures/gui/builder.png"); private static final ResourceLocation BLUEPRINT_TEXTURE = new ResourceLocation("buildcraftbuilders:textures/gui/builder_blueprint.png"); - private IInventory playerInventory; private TileBuilder builder; private GuiButton selectedButton; - private int sbPosition, sbLength; - private boolean sbInside; public GuiBuilder(EntityPlayer player, TileBuilder builder) { super(new ContainerBuilder(player, builder), builder, BLUEPRINT_TEXTURE); - this.playerInventory = player.inventory; this.builder = builder; xSize = 256; ySize = 225; @@ -47,11 +44,15 @@ public GuiBuilder(EntityPlayer player, TileBuilder builder) { for (int i = 0; i < 6; ++i) { for (int j = 0; j < 4; ++j) { - slots.set(i * 4 + j, new ItemSlot(this, 179 + j * 18, 18 + i * 18)); + slots.set(i * 4 + j, new SlotBuilderRequirement(this, 179 + j * 18, 18 + i * 18)); } } } + private ContainerBuilder getContainerBuilder() { + return (ContainerBuilder) getContainer(); + } + @Override protected void drawGuiContainerForegroundLayer(int par1, int par2) { super.drawGuiContainerForegroundLayer(par1, par2); @@ -64,11 +65,36 @@ protected void drawGuiContainerForegroundLayer(int par1, int par2) { fontRendererObj.drawString(StringUtils.localize("gui.building.fluids"), 178, 133, 0x404040); } + drawTooltips(par1, par2); + } + + private void drawTooltips(int par1, int par2) { + int top = guiTop + 145; + for (int i = 0; i < builder.fluidTanks.length; i++) { + int left = guiLeft + 179 + 18 * i; + if (par1 >= left && par2 >= top && par1 < (left + 16) && par2 < (left + 47)) { + List fluidTip = new ArrayList(); + Tank tank = builder.fluidTanks[i]; + if (tank.getFluid() != null && tank.getFluid().amount > 0) { + fluidTip.add(tank.getFluid().getLocalizedName()); + if (!BuildCraftCore.hideFluidNumbers) { + fluidTip.add(EnumChatFormatting.GRAY + "" + EnumChatFormatting.ITALIC + tank.getFluid().amount + " mB"); + } + } else { + fluidTip.add(StatCollector.translateToLocal("gui.fluidtank.empty")); + } + drawHoveringText(fluidTip, par1 - guiLeft, par2 - guiTop, fontRendererObj); + return; + } + } + drawTooltipForSlotAt(par1, par2); } @Override protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { + // We cannot do super here due to some crazy shenanigans with a dynamically + // resized GUI. GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); boolean isBlueprint = builder.getStackInSlot(0) != null; @@ -79,31 +105,23 @@ protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { drawTexturedModalRect(guiLeft + 169, guiTop, 169, 0, 256 - 169, ySize); } - List needs = builder.getNeededItems(); + List needs = builder.getNeededItems(); if (needs != null) { if (needs.size() > slots.size()) { - sbLength = (needs.size() - slots.size() + 3) / 4; - if (sbPosition >= sbLength) { - sbPosition = sbLength; - } - - // render scrollbar - drawTexturedModalRect(guiLeft + 172, guiTop + 17, 18, 0, 6, 108); - int sbPixelPosition = sbPosition * 95 / sbLength; - drawTexturedModalRect(guiLeft + 172, guiTop + 17 + sbPixelPosition, 24, 0, 6, 14); + getContainerBuilder().scrollbarWidget.hidden = false; + getContainerBuilder().scrollbarWidget.setLength((needs.size() - slots.size() + 3) / 4); } else { - sbPosition = 0; - sbLength = 0; + getContainerBuilder().scrollbarWidget.hidden = true; } - int offset = sbPosition * 4; + int offset = getContainerBuilder().scrollbarWidget.getPosition() * 4; for (int s = 0; s < slots.size(); s++) { int ts = offset + s; if (ts >= needs.size()) { - ((ItemSlot) slots.get(s)).stack = null; + ((SlotBuilderRequirement) slots.get(s)).stack = null; } else { - ((ItemSlot) slots.get(s)).stack = needs.get(ts).copy(); + ((SlotBuilderRequirement) slots.get(s)).stack = needs.get(ts); } } @@ -111,23 +129,34 @@ protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { b.visible = true; } } else { - sbPosition = 0; - sbLength = 0; - for (int s = 0; s < slots.size(); s++) { - ((ItemSlot) slots.get(s)).stack = null; + getContainerBuilder().scrollbarWidget.hidden = true; + for (AdvancedSlot slot : slots) { + ((SlotBuilderRequirement) slot).stack = null; } for (GuiButton b : (List) buttonList) { b.visible = false; } } + drawWidgets(x, y); + if (isBlueprint) { - drawBackgroundSlots(); + drawBackgroundSlots(x, y); + } + if (isBlueprint) { for (int i = 0; i < builder.fluidTanks.length; i++) { Tank tank = builder.fluidTanks[i]; if (tank.getFluid() != null && tank.getFluid().amount > 0) { drawFluid(tank.getFluid(), guiLeft + 179 + 18 * i, guiTop + 145, 16, 47, tank.getCapacity()); + } + } + + mc.renderEngine.bindTexture(BLUEPRINT_TEXTURE); + + for (int i = 0; i < builder.fluidTanks.length; i++) { + Tank tank = builder.fluidTanks[i]; + if (tank.getFluid() != null && tank.getFluid().amount > 0) { drawTexturedModalRect(guiLeft + 179 + 18 * i, guiTop + 145, 0, 54, 16, 47); } } @@ -142,50 +171,9 @@ public void initGui() { } } - @Override - public void mouseClicked(int mouseX, int mouseY, int button) throws IOException { - int guiX = mouseX - guiLeft; - int guiY = mouseY - guiTop; - if (sbLength > 0 && button == 0) { - if (guiX >= 172 && guiX < 178 && guiY >= 17 && guiY < 125) { - sbInside = true; - updateToSbHeight(guiY - 17); - } - } - super.mouseClicked(mouseX, mouseY, button); - } - - private void updateToSbHeight(int h) { - int hFrac = (h * sbLength + 54) / 108; - sbPosition = hFrac; - } - - @Override - protected void mouseClickMove(int x, int y, int button, long time) { - super.mouseClickMove(x, y, button, time); - if (sbInside && button == 0) { - int guiY = y - guiTop; - if (sbLength > 0) { - if (guiY >= 17 && guiY < 125) { - updateToSbHeight(guiY - 17); - } - } - } - } - @Override protected void mouseReleased(int mouseX, int mouseY, int eventType) { super.mouseReleased(mouseX, mouseY, eventType); - if (sbInside && eventType == 0) { - int guiY = mouseY - guiTop; - if (sbLength > 0) { - if (guiY >= 17 && guiY < 125) { - updateToSbHeight(guiY - 17); - sbInside = false; - } - } - } - if (this.selectedButton != null && eventType == 0) { this.selectedButton.mouseReleased(mouseX, mouseY); this.selectedButton = null; diff --git a/common/buildcraft/builders/gui/GuiFiller.java b/common/buildcraft/builders/gui/GuiFiller.java index f9f761e2d8..c7ab0a07e7 100644 --- a/common/buildcraft/builders/gui/GuiFiller.java +++ b/common/buildcraft/builders/gui/GuiFiller.java @@ -1,5 +1,5 @@ /** 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.builders.gui; @@ -8,24 +8,29 @@ import net.minecraft.client.gui.GuiButton; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; +import buildcraft.BuildCraftCore; import buildcraft.api.filler.FillerManager; import buildcraft.api.statements.IStatement; import buildcraft.api.statements.IStatementParameter; import buildcraft.api.statements.StatementMouseClick; import buildcraft.builders.TileFiller; import buildcraft.core.builders.patterns.FillerPattern; -import buildcraft.core.lib.gui.AdvancedSlot; -import buildcraft.core.lib.gui.GuiAdvancedInterface; -import buildcraft.core.lib.gui.GuiTools; -import buildcraft.core.lib.gui.StatementParameterSlot; -import buildcraft.core.lib.gui.StatementSlot; +import buildcraft.core.lib.gui.*; +import buildcraft.core.lib.gui.buttons.ButtonTextureSet; import buildcraft.core.lib.gui.buttons.GuiBetterButton; +import buildcraft.core.lib.gui.buttons.IButtonTextureSet; import buildcraft.core.lib.gui.buttons.StandardButtonTextureSets; +import buildcraft.core.lib.gui.tooltips.ToolTip; +import buildcraft.core.lib.gui.tooltips.ToolTipLine; +import buildcraft.core.lib.network.command.CommandWriter; +import buildcraft.core.lib.network.command.PacketCommand; import buildcraft.core.lib.utils.StringUtils; +import io.netty.buffer.ByteBuf; + public class GuiFiller extends GuiAdvancedInterface { class FillerParameterSlot extends StatementParameterSlot { public FillerParameterSlot(int x, int y, int slot) { @@ -34,7 +39,7 @@ public FillerParameterSlot(int x, int y, int slot) { @Override public IStatementParameter getParameter() { - if (slot >= instance.filler.patternParameters.length) { + if (instance.filler.patternParameters == null || slot >= instance.filler.patternParameters.length) { return null; } else { return instance.filler.patternParameters[slot]; @@ -48,14 +53,14 @@ public void setParameter(IStatementParameter param, boolean notifyServer) { } private static final ResourceLocation TEXTURE = new ResourceLocation("buildcraftbuilders:textures/gui/filler.png"); - private final IInventory playerInventory; + private static final IButtonTextureSet EXCAVATE_OFF = new ButtonTextureSet(240, -16, 16, 16, TEXTURE); + private static final IButtonTextureSet EXCAVATE_ON = new ButtonTextureSet(224, -16, 16, 16, TEXTURE); private final TileFiller filler; private final GuiFiller instance; private final StatementSlot fakeStatementSlot; public GuiFiller(EntityPlayer player, TileFiller filler) { super(new ContainerFiller(player, filler), filler, TEXTURE); - this.playerInventory = player.inventory; this.filler = filler; this.instance = this; this.fakeStatementSlot = new StatementSlot(instance, -1, -1, 0) { @@ -68,6 +73,15 @@ public IStatement getStatement() { ySize = 240; } + private IButtonTextureSet getExcavateTexture() { + return filler.isExcavate() ? EXCAVATE_ON : EXCAVATE_OFF; + } + + private GuiBetterButton getExcavateButton() { + return new GuiBetterButton(2, guiLeft + 150, guiTop + 30, 16, getExcavateTexture(), "").setToolTip(new ToolTip(500, new ToolTipLine( + StatCollector.translateToLocal("tip.filler.excavate." + (filler.isExcavate() ? "on" : "off"))))); + } + @Override public void initGui() { super.initGui(); @@ -75,6 +89,7 @@ public void initGui() { buttonList.add(new GuiBetterButton(0, guiLeft + 38 - 18, guiTop + 30, 10, StandardButtonTextureSets.LEFT_BUTTON, "")); buttonList.add(new GuiBetterButton(1, guiLeft + 38 + 16 + 8, guiTop + 30, 10, StandardButtonTextureSets.RIGHT_BUTTON, "")); + buttonList.add(getExcavateButton()); slots.clear(); for (int i = 0; i < 4; i++) { @@ -90,6 +105,16 @@ protected void actionPerformed(GuiButton button) throws IOException { filler.currentPattern = (FillerPattern) FillerManager.registry.getPreviousPattern(filler.currentPattern); } else if (button.id == 1) { filler.currentPattern = (FillerPattern) FillerManager.registry.getNextPattern(filler.currentPattern); + } else if (button.id == 2) { + filler.setExcavate(!filler.isExcavate()); + + buttonList.set(2, getExcavateButton()); + + BuildCraftCore.instance.sendToServer(new PacketCommand(filler, "setFlags", new CommandWriter() { + public void write(ByteBuf data) { + data.writeBoolean(filler.isExcavate()); + } + })); } filler.rpcSetPatternFromString(filler.currentPattern.getUniqueTag()); @@ -118,15 +143,19 @@ protected void mouseClicked(int x, int y, int k) throws IOException { @Override protected void drawGuiContainerBackgroundLayer(float f, int mx, int my) { super.drawGuiContainerBackgroundLayer(f, mx, my); - drawBackgroundSlots(); + drawBackgroundSlots(mx, my); } @Override protected void drawGuiContainerForegroundLayer(int mx, int my) { + super.drawGuiContainerForegroundLayer(mx, my); + String title = StringUtils.localize("tile.fillerBlock.name"); fontRendererObj.drawString(title, getCenteredOffset(title), 6, 0x404040); fontRendererObj.drawString(StringUtils.localize("gui.filling.resources"), 8, 74, 0x404040); fontRendererObj.drawString(StringUtils.localize("gui.inventory"), 8, 142, 0x404040); GuiTools.drawCenteredString(fontRendererObj, filler.currentPattern.getDescription(), 56); + + drawTooltipForSlotAt(mx, my); } } diff --git a/common/buildcraft/builders/gui/SlotArchitect.java b/common/buildcraft/builders/gui/SlotArchitect.java index 3aaae044ee..92f11b4ba6 100644 --- a/common/buildcraft/builders/gui/SlotArchitect.java +++ b/common/buildcraft/builders/gui/SlotArchitect.java @@ -1,5 +1,5 @@ /** 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.builders.gui; diff --git a/common/buildcraft/builders/gui/SlotBlueprintLibrary.java b/common/buildcraft/builders/gui/SlotBlueprintLibrary.java index 7e59419fd4..e1695fdbf0 100644 --- a/common/buildcraft/builders/gui/SlotBlueprintLibrary.java +++ b/common/buildcraft/builders/gui/SlotBlueprintLibrary.java @@ -1,5 +1,5 @@ /** 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.builders.gui; diff --git a/common/buildcraft/builders/gui/SlotBuilderRequirement.java b/common/buildcraft/builders/gui/SlotBuilderRequirement.java new file mode 100644 index 0000000000..2960336237 --- /dev/null +++ b/common/buildcraft/builders/gui/SlotBuilderRequirement.java @@ -0,0 +1,42 @@ +package buildcraft.builders.gui; + +import org.lwjgl.opengl.GL11; + +import net.minecraft.item.ItemStack; + +import buildcraft.core.blueprints.RequirementItemStack; +import buildcraft.core.lib.gui.AdvancedSlot; +import buildcraft.core.lib.gui.GuiAdvancedInterface; + +public class SlotBuilderRequirement extends AdvancedSlot { + public RequirementItemStack stack; + + public SlotBuilderRequirement(GuiAdvancedInterface gui, int x, int y) { + super(gui, x, y); + } + + @Override + public ItemStack getItemStack() { + return stack != null ? stack.stack : null; + } + + @Override + public void drawStack(ItemStack item) { + int cornerX = (gui.width - gui.getXSize()) / 2; + int cornerY = (gui.height - gui.getYSize()) / 2; + + gui.drawStack(item, cornerX + x, cornerY + y); + + if (stack != null) { + // Render real stack size + String s = String.valueOf(stack.size > 999 ? Math.min(99, stack.size / 1000) + "K" : stack.size); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_DEPTH_TEST); + GL11.glDisable(GL11.GL_BLEND); + gui.getFontRenderer().drawStringWithShadow(s, + cornerX + x + 17 - gui.getFontRenderer().getStringWidth(s), cornerY + y + 9, 16777215); + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_DEPTH_TEST); + } + } +} diff --git a/common/buildcraft/builders/render/RenderArchitect.java b/common/buildcraft/builders/render/RenderArchitect.java index 6a15c61b67..c91dfc0a78 100755 --- a/common/buildcraft/builders/render/RenderArchitect.java +++ b/common/buildcraft/builders/render/RenderArchitect.java @@ -1,5 +1,5 @@ /** 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.builders.render; diff --git a/common/buildcraft/builders/render/RenderConstructionMarker.java b/common/buildcraft/builders/render/RenderConstructionMarker.java index 85e0a650d3..667a397a45 100755 --- a/common/buildcraft/builders/render/RenderConstructionMarker.java +++ b/common/buildcraft/builders/render/RenderConstructionMarker.java @@ -1,5 +1,5 @@ /** 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.builders.render; @@ -12,7 +12,6 @@ import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.resources.model.IBakedModel; import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; import buildcraft.builders.TileConstructionMarker; import buildcraft.core.EntityLaser; @@ -21,7 +20,6 @@ import buildcraft.core.render.RenderLaser; public class RenderConstructionMarker extends RenderBoxProvider { - private final RenderBuildingItems renderItems = new RenderBuildingItems(); private ModelBase model = new ModelBase() {}; diff --git a/common/buildcraft/builders/render/RenderPathMarker.java b/common/buildcraft/builders/render/RenderPathMarker.java index b037895d29..e6b7186592 100755 --- a/common/buildcraft/builders/render/RenderPathMarker.java +++ b/common/buildcraft/builders/render/RenderPathMarker.java @@ -11,11 +11,10 @@ import net.minecraft.client.model.ModelRenderer; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.tileentity.TileEntity; -import buildcraft.builders.TilePathMarker; import buildcraft.core.EntityLaser; import buildcraft.core.LaserData; +import buildcraft.core.TilePathMarker; import buildcraft.core.render.RenderLaser; public class RenderPathMarker extends TileEntitySpecialRenderer { diff --git a/common/buildcraft/builders/schematics/SchematicBed.java b/common/buildcraft/builders/schematics/SchematicBed.java index 263ed90d86..ff45c76680 100644 --- a/common/buildcraft/builders/schematics/SchematicBed.java +++ b/common/buildcraft/builders/schematics/SchematicBed.java @@ -1,5 +1,5 @@ -/** Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * +/** 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.builders.schematics; @@ -40,7 +40,7 @@ public void rotateLeft(IBuilderContext context) { @Override public void placeInWorld(IBuilderContext context, BlockPos pos, LinkedList stacks) { context.world().setBlockState(pos, state.withProperty(BlockBed.PART, BlockBed.EnumPartType.HEAD)); - BlockPos feetPos = pos.offset(getFace(BlockBed.FACING), -1); + BlockPos feetPos = pos.offset(state.getValue(getFacingProp()), -1); context.world().setBlockState(feetPos, state.withProperty(BlockBed.PART, BlockBed.EnumPartType.FOOT)); } diff --git a/common/buildcraft/builders/schematics/SchematicBrewingStand.java b/common/buildcraft/builders/schematics/SchematicBrewingStand.java new file mode 100644 index 0000000000..1b31111375 --- /dev/null +++ b/common/buildcraft/builders/schematics/SchematicBrewingStand.java @@ -0,0 +1,17 @@ +package buildcraft.builders.schematics; + +import net.minecraft.util.BlockPos; + +import buildcraft.api.blueprints.IBuilderContext; +import buildcraft.api.blueprints.SchematicTile; + +public class SchematicBrewingStand extends SchematicTile { + @Override + public void initializeFromObjectAt(IBuilderContext context, BlockPos pos) { + super.initializeFromObjectAt(context, pos); + + if (tileNBT != null) { + tileNBT.removeTag("BrewTime"); + } + } +} diff --git a/common/buildcraft/builders/schematics/SchematicBuilderLike.java b/common/buildcraft/builders/schematics/SchematicBuilderLike.java new file mode 100644 index 0000000000..21f24b8420 --- /dev/null +++ b/common/buildcraft/builders/schematics/SchematicBuilderLike.java @@ -0,0 +1,22 @@ +package buildcraft.builders.schematics; + +import buildcraft.core.builders.schematics.SchematicRotateMeta; + +public class SchematicBuilderLike extends SchematicRotateMeta { + public SchematicBuilderLike() { + super(new int[]{2, 5, 3, 4}, true); + } + + @Override + public void onNBTLoaded() { + if (tileNBT != null) { + tileNBT.removeTag("box"); + tileNBT.removeTag("bpt"); + tileNBT.removeTag("bptBuilder"); + tileNBT.removeTag("builderState"); + tileNBT.removeTag("done"); + tileNBT.removeTag("iterator"); + tileNBT.removeTag("path"); + } + } +} diff --git a/common/buildcraft/builders/schematics/SchematicCactus.java b/common/buildcraft/builders/schematics/SchematicCactus.java index 389ea7edaf..047fc016b8 100644 --- a/common/buildcraft/builders/schematics/SchematicCactus.java +++ b/common/buildcraft/builders/schematics/SchematicCactus.java @@ -1,7 +1,11 @@ -/** Copyright (c) 2011-2014, 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 */ +/** + * 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.builders.schematics; import java.util.LinkedList; @@ -11,9 +15,9 @@ import net.minecraft.util.BlockPos; import buildcraft.api.blueprints.IBuilderContext; -import buildcraft.api.blueprints.SchematicBlock; +import buildcraft.core.builders.schematics.SchematicBlockFloored; -public class SchematicCactus extends SchematicBlock { +public class SchematicCactus extends SchematicBlockFloored { @Override public void getRequirementsForPlacement(IBuilderContext context, LinkedList requirements) { diff --git a/common/buildcraft/builders/schematics/SchematicCustomStack.java b/common/buildcraft/builders/schematics/SchematicCustomStack.java index 500fe66a96..6b60bd742c 100644 --- a/common/buildcraft/builders/schematics/SchematicCustomStack.java +++ b/common/buildcraft/builders/schematics/SchematicCustomStack.java @@ -1,7 +1,11 @@ -/** Copyright (c) 2011-2014, 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 */ +/** + * 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.builders.schematics; import java.util.LinkedList; diff --git a/common/buildcraft/builders/schematics/SchematicDirt.java b/common/buildcraft/builders/schematics/SchematicDirt.java index 5a64e2c881..c4e7639546 100644 --- a/common/buildcraft/builders/schematics/SchematicDirt.java +++ b/common/buildcraft/builders/schematics/SchematicDirt.java @@ -1,7 +1,11 @@ -/** Copyright (c) 2011-2014, 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 */ +/** + * 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.builders.schematics; import java.util.LinkedList; diff --git a/common/buildcraft/builders/schematics/SchematicDoor.java b/common/buildcraft/builders/schematics/SchematicDoor.java index 2b06c9556d..48bd73f7a3 100644 --- a/common/buildcraft/builders/schematics/SchematicDoor.java +++ b/common/buildcraft/builders/schematics/SchematicDoor.java @@ -1,5 +1,5 @@ -/** Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * +/** 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.builders.schematics; @@ -11,9 +11,9 @@ import net.minecraft.util.BlockPos; import buildcraft.api.blueprints.IBuilderContext; -import buildcraft.api.blueprints.SchematicBlock; +import buildcraft.core.builders.schematics.SchematicBlockFloored; -public class SchematicDoor extends SchematicBlock { +public class SchematicDoor extends SchematicBlockFloored { final ItemStack stack; diff --git a/common/buildcraft/builders/schematics/SchematicEnderChest.java b/common/buildcraft/builders/schematics/SchematicEnderChest.java index 5c88ed43ba..633971b744 100644 --- a/common/buildcraft/builders/schematics/SchematicEnderChest.java +++ b/common/buildcraft/builders/schematics/SchematicEnderChest.java @@ -1,5 +1,5 @@ -/** Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * +/** 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.builders.schematics; diff --git a/common/buildcraft/builders/schematics/SchematicFactoryBlock.java b/common/buildcraft/builders/schematics/SchematicFactoryBlock.java index b39e28cec8..5c5a5f9421 100644 --- a/common/buildcraft/builders/schematics/SchematicFactoryBlock.java +++ b/common/buildcraft/builders/schematics/SchematicFactoryBlock.java @@ -1,7 +1,11 @@ -/** Copyright (c) 2011-2014, 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 */ +/** + * 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.builders.schematics; import net.minecraft.block.Block; diff --git a/common/buildcraft/builders/schematics/SchematicFactoryEntity.java b/common/buildcraft/builders/schematics/SchematicFactoryEntity.java index 08f113a86a..471529be3b 100644 --- a/common/buildcraft/builders/schematics/SchematicFactoryEntity.java +++ b/common/buildcraft/builders/schematics/SchematicFactoryEntity.java @@ -1,7 +1,11 @@ -/** Copyright (c) 2011-2014, 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 */ +/** + * 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.builders.schematics; import net.minecraft.nbt.NBTTagCompound; diff --git a/common/buildcraft/builders/schematics/SchematicFactoryMask.java b/common/buildcraft/builders/schematics/SchematicFactoryMask.java index 62e37dd0e3..c3836e5919 100644 --- a/common/buildcraft/builders/schematics/SchematicFactoryMask.java +++ b/common/buildcraft/builders/schematics/SchematicFactoryMask.java @@ -1,7 +1,11 @@ -/** Copyright (c) 2011-2014, 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 */ +/** + * 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.builders.schematics; import net.minecraft.nbt.NBTTagCompound; diff --git a/common/buildcraft/builders/schematics/SchematicFarmland.java b/common/buildcraft/builders/schematics/SchematicFarmland.java index e33fe9a051..cd55603f2c 100644 --- a/common/buildcraft/builders/schematics/SchematicFarmland.java +++ b/common/buildcraft/builders/schematics/SchematicFarmland.java @@ -1,7 +1,11 @@ -/** Copyright (c) 2011-2014, 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 */ +/** + * 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.builders.schematics; import java.util.LinkedList; diff --git a/common/buildcraft/builders/schematics/SchematicFire.java b/common/buildcraft/builders/schematics/SchematicFire.java index 6cf48c2d69..caf1212eb9 100644 --- a/common/buildcraft/builders/schematics/SchematicFire.java +++ b/common/buildcraft/builders/schematics/SchematicFire.java @@ -1,7 +1,11 @@ -/** Copyright (c) 2011-2014, 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 */ +/** + * 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.builders.schematics; import java.util.LinkedList; diff --git a/common/buildcraft/builders/schematics/SchematicFrame.java b/common/buildcraft/builders/schematics/SchematicFrame.java index b36246eb2e..16317b7ac5 100644 --- a/common/buildcraft/builders/schematics/SchematicFrame.java +++ b/common/buildcraft/builders/schematics/SchematicFrame.java @@ -1,8 +1,8 @@ package buildcraft.builders.schematics; +import buildcraft.BuildCraftBuilders; import buildcraft.api.blueprints.IBuilderContext; import buildcraft.api.blueprints.SchematicBlock; -import buildcraft.BuildCraftBuilders; import buildcraft.builders.BlockFrame; import buildcraft.builders.BlockFrame.EFrameConnection; diff --git a/common/buildcraft/builders/schematics/SchematicGlassPane.java b/common/buildcraft/builders/schematics/SchematicGlassPane.java index 47e7416f96..0358dee135 100644 --- a/common/buildcraft/builders/schematics/SchematicGlassPane.java +++ b/common/buildcraft/builders/schematics/SchematicGlassPane.java @@ -1,7 +1,11 @@ -/** Copyright (c) 2011-2014, 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 */ +/** + * 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.builders.schematics; import java.util.LinkedList; diff --git a/common/buildcraft/builders/schematics/SchematicGravel.java b/common/buildcraft/builders/schematics/SchematicGravel.java index ed3360e4fb..3d49154e91 100644 --- a/common/buildcraft/builders/schematics/SchematicGravel.java +++ b/common/buildcraft/builders/schematics/SchematicGravel.java @@ -1,7 +1,11 @@ -/** Copyright (c) 2011-2014, 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 */ +/** + * 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.builders.schematics; import java.util.LinkedList; diff --git a/common/buildcraft/builders/schematics/SchematicHanging.java b/common/buildcraft/builders/schematics/SchematicHanging.java index f76f107203..1b4e59eeea 100644 --- a/common/buildcraft/builders/schematics/SchematicHanging.java +++ b/common/buildcraft/builders/schematics/SchematicHanging.java @@ -1,7 +1,11 @@ -/** Copyright (c) 2011-2014, 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 */ +/** + * 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.builders.schematics; import net.minecraft.entity.Entity; diff --git a/common/buildcraft/builders/schematics/SchematicJukebox.java b/common/buildcraft/builders/schematics/SchematicJukebox.java new file mode 100644 index 0000000000..a5768ae2e4 --- /dev/null +++ b/common/buildcraft/builders/schematics/SchematicJukebox.java @@ -0,0 +1,25 @@ +/** 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.builders.schematics; + +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; + +import buildcraft.api.blueprints.IBuilderContext; +import buildcraft.api.blueprints.SchematicTile; +import buildcraft.api.core.JavaTools; + +public class SchematicJukebox extends SchematicTile { + public SchematicJukebox() {} + + @Override + public void storeRequirements(IBuilderContext context, BlockPos pos) { + super.storeRequirements(context, pos); + if (tileNBT != null && tileNBT.hasKey("RecordItem")) { + ItemStack recordStack = ItemStack.loadItemStackFromNBT(tileNBT.getCompoundTag("RecordItem")); + storedRequirements = JavaTools.concat(storedRequirements, new ItemStack[] { recordStack }); + } + } +} diff --git a/common/buildcraft/builders/schematics/SchematicMinecart.java b/common/buildcraft/builders/schematics/SchematicMinecart.java index cb50fba341..0070f328fc 100644 --- a/common/buildcraft/builders/schematics/SchematicMinecart.java +++ b/common/buildcraft/builders/schematics/SchematicMinecart.java @@ -1,7 +1,11 @@ -/** Copyright (c) 2011-2014, 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 */ +/** + * 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.builders.schematics; import net.minecraft.entity.Entity; diff --git a/common/buildcraft/builders/schematics/SchematicPortal.java b/common/buildcraft/builders/schematics/SchematicPortal.java index 0b6e7d9fad..635e7d5734 100644 --- a/common/buildcraft/builders/schematics/SchematicPortal.java +++ b/common/buildcraft/builders/schematics/SchematicPortal.java @@ -1,7 +1,11 @@ -/** Copyright (c) 2011-2014, 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 */ +/** + * 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.builders.schematics; import java.util.LinkedList; diff --git a/common/buildcraft/builders/schematics/SchematicRail.java b/common/buildcraft/builders/schematics/SchematicRail.java index c7cdfffa7b..2a718337bb 100644 --- a/common/buildcraft/builders/schematics/SchematicRail.java +++ b/common/buildcraft/builders/schematics/SchematicRail.java @@ -1,5 +1,5 @@ -/** Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * +/** 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.builders.schematics; @@ -31,10 +31,8 @@ public void rotateLeft(IBuilderContext context) { public void placeInWorld(IBuilderContext context, BlockPos pos, LinkedList stacks) { // If we set it to NORTH_SOUTH here (and don't update) then when we set it to the actual state in the post // processing it just ignores the update because they are the same - if (state == defaultDirection) - context.world().setBlockState(pos, defaultDirection, BuildCraftProperties.MARK_BLOCK_FOR_UPDATE); - else - context.world().setBlockState(pos, defaultDirection, BuildCraftProperties.UPDATE_NONE); + if (state == defaultDirection) context.world().setBlockState(pos, defaultDirection, BuildCraftProperties.MARK_BLOCK_FOR_UPDATE); + else context.world().setBlockState(pos, defaultDirection, BuildCraftProperties.UPDATE_NONE); } @Override diff --git a/common/buildcraft/builders/schematics/SchematicRedstoneLamp.java b/common/buildcraft/builders/schematics/SchematicRedstoneLamp.java index 953bff8d46..cb98e3e325 100644 --- a/common/buildcraft/builders/schematics/SchematicRedstoneLamp.java +++ b/common/buildcraft/builders/schematics/SchematicRedstoneLamp.java @@ -1,7 +1,11 @@ -/** Copyright (c) 2011-2014, 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 */ +/** + * 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.builders.schematics; import java.util.LinkedList; diff --git a/common/buildcraft/builders/schematics/SchematicRedstoneWire.java b/common/buildcraft/builders/schematics/SchematicRedstoneWire.java index 3ea3e7bab7..d75c6e87bd 100644 --- a/common/buildcraft/builders/schematics/SchematicRedstoneWire.java +++ b/common/buildcraft/builders/schematics/SchematicRedstoneWire.java @@ -1,7 +1,11 @@ -/** Copyright (c) 2011-2014, 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 */ +/** + * 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.builders.schematics; import java.util.LinkedList; @@ -10,10 +14,9 @@ import net.minecraft.util.BlockPos; import buildcraft.api.blueprints.IBuilderContext; -import buildcraft.api.blueprints.SchematicBlock; - -public class SchematicRedstoneWire extends SchematicBlock { +import buildcraft.core.builders.schematics.SchematicBlockFloored; +public class SchematicRedstoneWire extends SchematicBlockFloored { final ItemStack customStack; public SchematicRedstoneWire(ItemStack customStack) { @@ -39,5 +42,4 @@ public void placeInWorld(IBuilderContext context, BlockPos pos, LinkedList + * 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.builders.schematics; import java.util.LinkedList; @@ -11,10 +15,9 @@ import net.minecraft.util.BlockPos; import buildcraft.api.blueprints.IBuilderContext; -import buildcraft.api.blueprints.SchematicBlock; - -public class SchematicSeeds extends SchematicBlock { +import buildcraft.core.builders.schematics.SchematicBlockFloored; +public class SchematicSeeds extends SchematicBlockFloored { public Item seeds; public SchematicSeeds(Item seeds) { diff --git a/common/buildcraft/builders/schematics/SchematicSign.java b/common/buildcraft/builders/schematics/SchematicSign.java new file mode 100644 index 0000000000..7e59f5c6ec --- /dev/null +++ b/common/buildcraft/builders/schematics/SchematicSign.java @@ -0,0 +1,52 @@ +/** 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.builders.schematics; + +import java.util.LinkedList; + +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; + +import buildcraft.api.blueprints.IBuilderContext; +import buildcraft.api.blueprints.SchematicTile; + +public class SchematicSign extends SchematicTile { + + boolean isWall; + + public SchematicSign(boolean isWall) { + this.isWall = isWall; + } + + @Override + public void getRequirementsForPlacement(IBuilderContext context, LinkedList requirements) { + requirements.add(new ItemStack(Items.sign)); + } + + @Override + public void storeRequirements(IBuilderContext context, BlockPos pos) { + // cancel requirements reading + } + + @Override + public void rotateLeft(IBuilderContext context) { + if (!isWall) { + Block standing = Blocks.standing_sign; + int meta = standing.getMetaFromState(state); + double angle = (meta * 360.0) / 16.0; + angle += 90.0; + if (angle >= 360) { + angle -= 360; + } + meta = (int) (angle / 360.0 * 16.0); + state = standing.getStateFromMeta(meta); + } else { + super.rotateLeft(context); + } + } +} diff --git a/common/buildcraft/builders/schematics/SchematicSkull.java b/common/buildcraft/builders/schematics/SchematicSkull.java index df2204ea67..e05137cce0 100644 --- a/common/buildcraft/builders/schematics/SchematicSkull.java +++ b/common/buildcraft/builders/schematics/SchematicSkull.java @@ -1,5 +1,5 @@ -/** Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * +/** 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.builders.schematics; diff --git a/common/buildcraft/builders/schematics/SchematicStone.java b/common/buildcraft/builders/schematics/SchematicStone.java deleted file mode 100644 index 87433ac17d..0000000000 --- a/common/buildcraft/builders/schematics/SchematicStone.java +++ /dev/null @@ -1,32 +0,0 @@ -/** Copyright (c) 2011-2014, 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.builders.schematics; - -import java.util.LinkedList; - -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; - -import buildcraft.api.blueprints.IBuilderContext; -import buildcraft.api.blueprints.SchematicBlock; - -public class SchematicStone extends SchematicBlock { - - @Override - public void getRequirementsForPlacement(IBuilderContext context, LinkedList requirements) { - requirements.add(new ItemStack(Blocks.stone, 1, Blocks.stone.getMetaFromState(state))); - } - - @Override - public void storeRequirements(IBuilderContext context, BlockPos pos) { - - } - - @Override - public void placeInWorld(IBuilderContext context, BlockPos pos, LinkedList stacks) { - context.world().setBlockState(pos, state, 3); - } -} diff --git a/common/buildcraft/builders/statements/ActionFiller.java b/common/buildcraft/builders/statements/ActionFiller.java index 1753d03979..662a51e897 100644 --- a/common/buildcraft/builders/statements/ActionFiller.java +++ b/common/buildcraft/builders/statements/ActionFiller.java @@ -1,5 +1,5 @@ /** 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.builders.statements; @@ -34,10 +34,26 @@ public TextureAtlasSprite getGuiSprite() { return pattern.getGuiSprite(); } + @Override + public int minParameters() { + return pattern.minParameters(); + } + + @Override + public int maxParameters() { + return pattern.maxParameters(); + } + + @Override + public IStatementParameter createParameter(int index) { + return pattern.createParameter(index); + } + @Override public void actionActivate(TileEntity target, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) { if (target instanceof TileFiller) { ((TileFiller) target).setPattern(pattern); + ((TileFiller) target).patternParameters = parameters; } } } diff --git a/common/buildcraft/builders/statements/BuildersActionProvider.java b/common/buildcraft/builders/statements/BuildersActionProvider.java index a63ebe07ad..d1bb38b6a4 100644 --- a/common/buildcraft/builders/statements/BuildersActionProvider.java +++ b/common/buildcraft/builders/statements/BuildersActionProvider.java @@ -1,5 +1,5 @@ /** 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.builders.statements; diff --git a/common/buildcraft/builders/urbanism/BlockUrbanist.java b/common/buildcraft/builders/urbanism/BlockUrbanist.java index c6a62a1e26..6429c4d9df 100755 --- a/common/buildcraft/builders/urbanism/BlockUrbanist.java +++ b/common/buildcraft/builders/urbanism/BlockUrbanist.java @@ -12,10 +12,11 @@ import net.minecraft.util.EnumFacing; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import net.minecraftforge.fml.common.FMLCommonHandler; -import buildcraft.api.events.BlockInteractionEvent; +import net.minecraftforge.common.MinecraftForge; + import buildcraft.BuildCraftBuilders; +import buildcraft.api.events.BlockInteractionEvent; import buildcraft.core.GuiIds; import buildcraft.core.lib.block.BlockBuildCraft; @@ -33,11 +34,11 @@ public BlockUrbanist() { public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer entityplayer, EnumFacing side, float par7, float par8, float par9) { if (!world.isRemote) { - entityplayer.openGui(BuildCraftBuilders.instance, GuiIds.URBANIST, world, pos.getX(), pos.getY(), pos.getZ()); +// entityplayer.openGui(BuildCraftBuilders.instance, GuiIds.URBANIST, world, pos.getX(), pos.getY(), pos.getZ()); } BlockInteractionEvent event = new BlockInteractionEvent(entityplayer, state); - FMLCommonHandler.instance().bus().post(event); + MinecraftForge.EVENT_BUS.post(event); if (event.isCanceled()) { return false; } diff --git a/common/buildcraft/builders/urbanism/GuiUrbanist.java b/common/buildcraft/builders/urbanism/GuiUrbanist.java index e9e6916e76..c780123f99 100755 --- a/common/buildcraft/builders/urbanism/GuiUrbanist.java +++ b/common/buildcraft/builders/urbanism/GuiUrbanist.java @@ -13,6 +13,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.util.ResourceLocation; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -128,7 +129,7 @@ protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { tools[selectedTool].drawGuiContainerBackgroundLayer(this, f, x, y); } - drawBackgroundSlots(); + drawBackgroundSlots(x, y); if (selectedTool != -1) { tools[selectedTool].drawSelection(this, f, x, y); diff --git a/common/buildcraft/core/AchievementManager.java b/common/buildcraft/core/AchievementManager.java index baf40f9b71..d05f18019f 100644 --- a/common/buildcraft/core/AchievementManager.java +++ b/common/buildcraft/core/AchievementManager.java @@ -7,7 +7,7 @@ import net.minecraftforge.fml.common.gameevent.PlayerEvent; public class AchievementManager { - public AchievementPage page; + public final AchievementPage page; public AchievementManager(String name) { page = new AchievementPage(name); diff --git a/common/buildcraft/core/BCCreativeTab.java b/common/buildcraft/core/BCCreativeTab.java index 29e72be1fe..38e213be62 100644 --- a/common/buildcraft/core/BCCreativeTab.java +++ b/common/buildcraft/core/BCCreativeTab.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core; import java.util.HashMap; @@ -15,12 +19,10 @@ public class BCCreativeTab extends CreativeTabs { private static final Map tabs = new HashMap(); - private final String name; private ItemStack icon; public BCCreativeTab(String name) { super("buildcraft." + name); - this.name = name; tabs.put(name, this); } diff --git a/common/buildcraft/core/BCRegistry.java b/common/buildcraft/core/BCRegistry.java new file mode 100644 index 0000000000..c98ddd1445 --- /dev/null +++ b/common/buildcraft/core/BCRegistry.java @@ -0,0 +1,97 @@ +package buildcraft.core; + +import java.io.File; + +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; + +import net.minecraftforge.common.config.Configuration; +import net.minecraftforge.fml.common.registry.GameRegistry; +import net.minecraftforge.oredict.ShapedOreRecipe; +import net.minecraftforge.oredict.ShapelessOreRecipe; + +import buildcraft.core.lib.items.ItemBlockBuildCraft; +import buildcraft.core.lib.utils.Utils; + +public final class BCRegistry { + public static final BCRegistry INSTANCE = new BCRegistry(); + private Configuration regCfg; + + private BCRegistry() { + + } + + public boolean isEnabled(String category, String name) { + return regCfg.get(category, name, true).getBoolean(); + } + + public void setRegistryConfig(File f) { + regCfg = new Configuration(f); + } + + public boolean registerBlock(Block block, boolean forced) { + return registerBlock(block, ItemBlockBuildCraft.class, forced); + } + + public boolean registerBlock(Block block, Class item, boolean forced) { + String name = block.getUnlocalizedName().replace("tile.", ""); + if (forced || regCfg.get("blocks", name, true).getBoolean()) { + GameRegistry.registerBlock(block, item, name); + return true; + } + return false; + } + + public boolean registerItem(Item item, boolean forced) { + String name = item.getUnlocalizedName().replace("item.", ""); + if (forced || regCfg.get("items", name, true).getBoolean()) { + GameRegistry.registerItem(item, name); + return true; + } + return false; + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + public void registerTileEntity(Class clas, String... ident) { + GameRegistry.registerTileEntityWithAlternatives(CompatHooks.INSTANCE.getTile(clas), ident[0], ident); + } + + public void addCraftingRecipe(ItemStack result, Object... recipe) { + for (Object o : recipe) { + if (o == null) { + return; + } + if (o instanceof Block && !Utils.isRegistered((Block) o)) { + return; + } + if (o instanceof Item && !Utils.isRegistered((Item) o)) { + return; + } + if (o instanceof ItemStack && !Utils.isRegistered((ItemStack) o)) { + return; + } + } + GameRegistry.addRecipe(new ShapedOreRecipe(result, recipe)); + } + + public void addShapelessRecipe(ItemStack result, Object... recipe) { + for (Object o : recipe) { + if (o instanceof Block && Block.getIdFromBlock((Block) o) < 0) { + return; + } + if (o instanceof Item && Item.getIdFromItem((Item) o) < 0) { + return; + } + if (o instanceof ItemStack && ((ItemStack) o).getItem() == null) { + return; + } + } + GameRegistry.addRecipe(new ShapelessOreRecipe(result, recipe)); + } + + public void save() { + regCfg.save(); + } +} diff --git a/common/buildcraft/core/BlockEngine.java b/common/buildcraft/core/BlockEngine.java index 830d3d3118..9cff685cfd 100644 --- a/common/buildcraft/core/BlockEngine.java +++ b/common/buildcraft/core/BlockEngine.java @@ -1,8 +1,9 @@ package buildcraft.core; -import java.util.ArrayList; import java.util.List; +import com.google.common.collect.Lists; + import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; @@ -16,31 +17,33 @@ import buildcraft.core.lib.utils.ModelHelper; public class BlockEngine extends BlockEngineBase implements IModelRegister { - private final List> engineTiles; - private final List names; + private final Class[] engineTiles; + private final String[] names; public BlockEngine() { super(); setUnlocalizedName("engineBlock"); - engineTiles = new ArrayList>(16); - names = new ArrayList(16); + engineTiles = new Class[16]; + names = new String[16]; } @Override public String getUnlocalizedName(int metadata) { - return names.get(metadata % names.size()); + return names[metadata] != null ? names[metadata] : "unknown"; } - public void registerTile(Class engineTile, String name) { - engineTiles.add(engineTile); - names.add(name); + public void registerTile(Class engineTile, int meta, String name) { + if (BCRegistry.INSTANCE.isEnabled("engines", name)) { + engineTiles[meta]= engineTile; + names[meta]= name; + } } @Override public TileEntity createTileEntity(World world, int metadata) { try { - return engineTiles.get(metadata % engineTiles.size()).newInstance(); + return (TileEntity) engineTiles[metadata].newInstance(); } catch (Exception e) { e.printStackTrace(); return null; @@ -50,13 +53,17 @@ public TileEntity createTileEntity(World world, int metadata) { @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public void getSubBlocks(Item item, CreativeTabs par2CreativeTabs, List itemList) { - for (int i = 0; i < engineTiles.size(); i++) { - itemList.add(new ItemStack(this, 1, i)); + int i = 0; + for (String name : names) { + if (name != null) { + itemList.add(new ItemStack(this, 1, i)); + } + i++; } } - public int getEngineCount() { - return engineTiles.size(); + public boolean hasEngine(int meta) { + return engineTiles[meta] != null; } @Override diff --git a/common/buildcraft/builders/BlockMarker.java b/common/buildcraft/core/BlockMarker.java similarity index 92% rename from common/buildcraft/builders/BlockMarker.java rename to common/buildcraft/core/BlockMarker.java index fcd4636f78..536cac431d 100644 --- a/common/buildcraft/builders/BlockMarker.java +++ b/common/buildcraft/core/BlockMarker.java @@ -1,8 +1,12 @@ -/** 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.builders; +/** + * 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.core; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -85,7 +89,7 @@ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, En } TileEntity tile = world.getTileEntity(pos); - if (tile instanceof TileMarker && !(tile instanceof TileConstructionMarker)) { + if (tile instanceof TileMarker) { ((TileMarker) tile).tryConnection(); return true; } diff --git a/common/buildcraft/builders/BlockPathMarker.java b/common/buildcraft/core/BlockPathMarker.java similarity index 94% rename from common/buildcraft/builders/BlockPathMarker.java rename to common/buildcraft/core/BlockPathMarker.java index b0742bd6cf..4712911925 100644 --- a/common/buildcraft/builders/BlockPathMarker.java +++ b/common/buildcraft/core/BlockPathMarker.java @@ -1,8 +1,8 @@ /** 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.builders; +package buildcraft.core; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; diff --git a/common/buildcraft/core/BlockSpring.java b/common/buildcraft/core/BlockSpring.java index 748012f636..c84ddf9f43 100644 --- a/common/buildcraft/core/BlockSpring.java +++ b/common/buildcraft/core/BlockSpring.java @@ -1,5 +1,5 @@ /** 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.core; @@ -16,7 +16,6 @@ import net.minecraft.world.World; import buildcraft.api.enums.EnumSpring; -import buildcraft.core.BCCreativeTab; import buildcraft.core.lib.block.BlockBuildCraftBase; import buildcraft.core.lib.utils.XorShift128Random; @@ -36,7 +35,7 @@ public BlockSpring() { } @Override - public void getSubBlocks(Item item, CreativeTabs tab, List list) { + public void getSubBlocks(Item item, CreativeTabs tab, List list) { for (EnumSpring type : EnumSpring.VALUES) { list.add(new ItemStack(this, 1, type.ordinal())); } @@ -53,8 +52,8 @@ public void updateTick(World world, BlockPos pos, IBlockState state, Random rand } // @Override - // public void onNeighborBlockChange(World world, BlockPos pos, int blockid) { - // assertSpring(world, pos); + // public void onNeighborBlockChange(World world, int x, int y, int z, int blockid) { + // assertSpring(world, x, y, z); // } @Override diff --git a/common/buildcraft/core/Box.java b/common/buildcraft/core/Box.java index ea3edcadba..d496d70fd5 100644 --- a/common/buildcraft/core/Box.java +++ b/common/buildcraft/core/Box.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core; import java.util.ArrayList; @@ -12,6 +16,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; import net.minecraft.util.Vec3; import buildcraft.api.core.IAreaProvider; @@ -150,6 +155,10 @@ public IBox contract(int amount) { } public boolean contains(double x, double y, double z) { + return contains(MathHelper.floor_double(x), MathHelper.floor_double(y), MathHelper.floor_double(z)); + } + + public boolean contains(int x, int y, int z) { return x >= xMin && x <= xMax && y >= yMin && y <= yMax && z >= zMin && z <= zMax; } @@ -235,7 +244,7 @@ public void reorder() { @Override public void createLaserData() { - lasersData = Utils.createLaserDataBox(xMin, yMin, zMin, xMax, yMax, zMax); + lasersData = Utils.createLaserDataBox(xMin, yMin, zMin, xMax, yMax, zMax); } public void writeToNBT(NBTTagCompound nbttagcompound) { diff --git a/common/buildcraft/core/ChunkIndex.java b/common/buildcraft/core/ChunkIndex.java deleted file mode 100755 index a9a63d98b1..0000000000 --- a/common/buildcraft/core/ChunkIndex.java +++ /dev/null @@ -1,62 +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.core; - -import net.minecraft.nbt.NBTTagCompound; - -import buildcraft.api.core.ISerializable; - -import io.netty.buffer.ByteBuf; - -public class ChunkIndex implements ISerializable { - public int x, z; - - public ChunkIndex() { - - } - - public ChunkIndex(int iX, int iZ) { - x = iX; - z = iZ; - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof ChunkIndex) { - ChunkIndex c = (ChunkIndex) obj; - - return c.x == x && c.z == z; - } - - return super.equals(obj); - } - - @Override - public int hashCode() { - return x * 37 + z; - } - - public void writeToNBT(NBTTagCompound nbt) { - nbt.setInteger("x", x); - nbt.setInteger("z", z); - } - - public void readFromNBT(NBTTagCompound nbt) { - x = nbt.getInteger("x"); - z = nbt.getInteger("z"); - } - - @Override - public void readData(ByteBuf stream) { - x = stream.readInt(); - z = stream.readInt(); - } - - @Override - public void writeData(ByteBuf stream) { - stream.writeInt(x); - stream.writeInt(z); - } -} diff --git a/common/buildcraft/core/CompatHooks.java b/common/buildcraft/core/CompatHooks.java index 9faf54cd60..5970c04874 100644 --- a/common/buildcraft/core/CompatHooks.java +++ b/common/buildcraft/core/CompatHooks.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core; import net.minecraft.block.Block; diff --git a/common/buildcraft/core/CoreConstants.java b/common/buildcraft/core/CoreConstants.java index 43c8b5d451..995ee2fa83 100644 --- a/common/buildcraft/core/CoreConstants.java +++ b/common/buildcraft/core/CoreConstants.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core; public final class CoreConstants { diff --git a/common/buildcraft/core/CoreGuiHandler.java b/common/buildcraft/core/CoreGuiHandler.java index df4aa65ce7..21a4447ea2 100755 --- a/common/buildcraft/core/CoreGuiHandler.java +++ b/common/buildcraft/core/CoreGuiHandler.java @@ -1,30 +1,40 @@ -/** 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 */ +/** + * 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.core; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; import net.minecraftforge.fml.common.network.IGuiHandler; -import buildcraft.core.gui.ContainerList; -import buildcraft.core.gui.GuiList; +import buildcraft.core.list.ContainerListNew; +import buildcraft.core.list.ContainerListOld; +import buildcraft.core.list.GuiListNew; +import buildcraft.core.list.GuiListOld; public class CoreGuiHandler implements IGuiHandler { @Override public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { - if (id == GuiIds.LIST) { - return new GuiList(player); + if (id == GuiIds.LIST_OLD) { + return new GuiListOld(player); + } else if (id == GuiIds.LIST_NEW) { + return new GuiListNew(player); } return null; } @Override public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { - if (id == GuiIds.LIST) { - return new ContainerList(player); + if (id == GuiIds.LIST_OLD) { + return new ContainerListOld(player); + } else if (id == GuiIds.LIST_NEW) { + return new ContainerListNew(player); } return null; } diff --git a/common/buildcraft/core/CoreSiliconRecipes.java b/common/buildcraft/core/CoreSiliconRecipes.java new file mode 100644 index 0000000000..bd6d08e6db --- /dev/null +++ b/common/buildcraft/core/CoreSiliconRecipes.java @@ -0,0 +1,25 @@ +package buildcraft.core; + +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; + +import net.minecraftforge.fml.common.Optional; + +import buildcraft.BuildCraftCore; +import buildcraft.api.recipes.BuildcraftRecipeRegistry; +import buildcraft.core.lib.utils.Utils; + +public final class CoreSiliconRecipes { + private CoreSiliconRecipes() { + + } + + @Optional.Method(modid = "BuildCraft|Silicon") + public static void loadSiliconRecipes() { + // Lists + if (Utils.isRegistered(BuildCraftCore.listItem)) { + BuildcraftRecipeRegistry.assemblyTable.addRecipe("buildcraft:list", 20000, new ItemStack(BuildCraftCore.listItem, 1, 1), "dyeGreen", + "dustRedstone", new ItemStack(Items.paper, 8)); + } + } +} diff --git a/common/buildcraft/core/DefaultAreaProvider.java b/common/buildcraft/core/DefaultAreaProvider.java index 3e9eaa3a2e..975557cd4a 100644 --- a/common/buildcraft/core/DefaultAreaProvider.java +++ b/common/buildcraft/core/DefaultAreaProvider.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core; import buildcraft.api.core.IAreaProvider; diff --git a/common/buildcraft/core/DefaultProps.java b/common/buildcraft/core/DefaultProps.java index a33a6a012c..075370d41f 100644 --- a/common/buildcraft/core/DefaultProps.java +++ b/common/buildcraft/core/DefaultProps.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core; public final class DefaultProps { @@ -24,8 +28,6 @@ public final class DefaultProps { public static String TEXTURE_PATH_ROBOTS = "buildcraftrobotics:textures/entities"; - public static final String DEFAULT_LANGUAGE = "en_US"; - public static String PUMP_DIMENSION_LIST = "+/*/*,+/-1/lava"; public static double PIPES_DURABILITY = 0.25D; diff --git a/common/buildcraft/core/EntityLaser.java b/common/buildcraft/core/EntityLaser.java index ee718de8ca..9d3a1f329f 100644 --- a/common/buildcraft/core/EntityLaser.java +++ b/common/buildcraft/core/EntityLaser.java @@ -1,7 +1,11 @@ -/** Copyright (c) 2011-2014, 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 */ +/** + * 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.core; import net.minecraft.entity.Entity; @@ -69,7 +73,14 @@ protected void entityInit() { preventEntitySpawning = false; noClip = true; isImmuneToFire = true; - dataWatcher.addObject(8, Byte.valueOf((byte) 1)); + dataWatcher.addObject(8, (double)0); + dataWatcher.addObject(9, (double)0); + dataWatcher.addObject(10,(double) 0); + dataWatcher.addObject(11,(double) 0); + dataWatcher.addObject(12,(double) 0); + dataWatcher.addObject(13,(double) 0); + + dataWatcher.addObject(14, (byte) 0); } @Override @@ -101,7 +112,23 @@ protected void updateDataClient() { } protected void updateDataServer() { - dataWatcher.updateObject(8, Byte.valueOf((byte) (data.isVisible ? 1 : 0))); + dataWatcher.updateObject(8, encodeDouble(data.head.xCoord)); + dataWatcher.updateObject(9, encodeDouble(data.head.yCoord)); + dataWatcher.updateObject(10, encodeDouble(data.head.zCoord)); + dataWatcher.updateObject(11, encodeDouble(data.tail.xCoord)); + dataWatcher.updateObject(12, encodeDouble(data.tail.yCoord)); + dataWatcher.updateObject(13, encodeDouble(data.tail.zCoord)); + + dataWatcher.updateObject(14, (byte) (data.isVisible ? 1 : 0)); + } + + public void setPositions(Vec3 head, Vec3 tail) { + data.head = head; + data.tail = tail; + + setPositionAndRotation(head.xCoord, head.yCoord, head.zCoord, 0, 0); + + needsUpdate = true; } public void show() { diff --git a/common/buildcraft/core/GuiIds.java b/common/buildcraft/core/GuiIds.java index bdbf999abd..0b36e27582 100644 --- a/common/buildcraft/core/GuiIds.java +++ b/common/buildcraft/core/GuiIds.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core; // TODO: Convert to an enum! @@ -12,11 +16,11 @@ public final class GuiIds { public static final int BUILDER = 11; public static final int FILLER = 12; public static final int BLUEPRINT_LIBRARY = 13; - public static final int URBANIST = 14; public static final int MAP = 15; public static final int REQUESTER = 16; - public static final int LIST = 17; + public static final int LIST_OLD = 17; public static final int TABLET = 18; + public static final int LIST_NEW = 19; public static final int ENGINE_IRON = 20; public static final int ENGINE_STONE = 21; @@ -25,8 +29,6 @@ public final class GuiIds { public static final int REFINERY = 31; public static final int HOPPER = 32; - public static final int ASSEMBLY_TABLE = 40; - public static final int PIPE_DIAMOND = 50; public static final int GATES = 51; public static final int PIPE_EMERALD_ITEM = 52; diff --git a/common/buildcraft/core/InterModComms.java b/common/buildcraft/core/InterModComms.java index 8a8d74c6b2..c974be1394 100644 --- a/common/buildcraft/core/InterModComms.java +++ b/common/buildcraft/core/InterModComms.java @@ -1,5 +1,5 @@ /** 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.core; @@ -12,6 +12,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; + import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fml.common.event.FMLInterModComms.IMCEvent; import net.minecraftforge.fml.common.event.FMLInterModComms.IMCMessage; diff --git a/common/buildcraft/core/ItemDebugger.java b/common/buildcraft/core/ItemDebugger.java index 215c7e1015..4be897b8c0 100644 --- a/common/buildcraft/core/ItemDebugger.java +++ b/common/buildcraft/core/ItemDebugger.java @@ -11,7 +11,6 @@ import buildcraft.core.lib.items.ItemBuildCraft; import buildcraft.core.lib.utils.StringUtils; -/** Created by asie on 3/7/15. */ @Deprecated public class ItemDebugger extends ItemBuildCraft { public ItemDebugger() { diff --git a/common/buildcraft/core/ItemGear.java b/common/buildcraft/core/ItemGear.java new file mode 100755 index 0000000000..cd6e313730 --- /dev/null +++ b/common/buildcraft/core/ItemGear.java @@ -0,0 +1,19 @@ +/** + * 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.core; + +import buildcraft.core.lib.items.ItemBuildCraft; + +public class ItemGear extends ItemBuildCraft { + + public ItemGear() { + + } + +} diff --git a/common/buildcraft/core/ItemList.java b/common/buildcraft/core/ItemList.java index f163070817..3f94dc5450 100644 --- a/common/buildcraft/core/ItemList.java +++ b/common/buildcraft/core/ItemList.java @@ -1,272 +1,65 @@ /** 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.core; -import java.util.ArrayList; -import java.util.LinkedList; import java.util.List; -import java.util.WeakHashMap; -import net.minecraft.block.Block; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; -import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import net.minecraftforge.fml.common.FMLCommonHandler; + import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.oredict.OreDictionary; +import net.minecraftforge.fml.relauncher.SideOnly; -import buildcraft.api.items.IList; import buildcraft.BuildCraftCore; -import buildcraft.core.lib.inventory.StackHelper; +import buildcraft.api.items.IList; import buildcraft.core.lib.items.ItemBuildCraft; import buildcraft.core.lib.utils.ModelHelper; import buildcraft.core.lib.utils.NBTUtils; +import buildcraft.core.list.ListHandlerNew; +import buildcraft.core.list.ListHandlerOld; public class ItemList extends ItemBuildCraft implements IList { - private static final WeakHashMap LINE_CACHE = new WeakHashMap(); - - public static class StackLine { - public boolean oreWildcard = false; - public boolean subitemsWildcard = false; - public boolean isOre; - - private ItemStack[] stacks = new ItemStack[7]; - private ArrayList ores = new ArrayList(); - private ArrayList relatedItems = new ArrayList(); - - public ItemStack getStack(int index) { - if (index == 0 || (!oreWildcard && !subitemsWildcard)) { - if (index < 7) { - return stacks[index]; - } else { - return null; - } - } else if (oreWildcard) { - if (ores.size() >= index) { - return ores.get(index - 1); - } else { - return null; - } - } else { - if (relatedItems.size() >= index) { - return relatedItems.get(index - 1); - } else { - return null; - } - } - } - - public void setStack(int slot, ItemStack stack) { - stacks[slot] = stack; - - if (stack != null) { - stacks[slot] = stacks[slot].copy(); - stacks[slot].stackSize = 1; - } - - if (slot == 0) { - relatedItems.clear(); - ores.clear(); - - if (stack == null) { - isOre = false; - } else { - if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) { - setClientPreviewLists(); - } else { - isOre = OreDictionary.getOreIDs(stacks[0]).length > 0; - } - } - } - } - - public void writeToNBT(NBTTagCompound nbt) { - nbt.setBoolean("ore", oreWildcard); - nbt.setBoolean("sub", subitemsWildcard); - - for (int i = 0; i < 7; ++i) { - if (stacks[i] != null) { - NBTTagCompound stackNBT = new NBTTagCompound(); - stacks[i].writeToNBT(stackNBT); - nbt.setTag("stacks[" + i + "]", stackNBT); - } - } - } - - public void readFromNBT(NBTTagCompound nbt) { - oreWildcard = nbt.getBoolean("ore"); - subitemsWildcard = nbt.getBoolean("sub"); - - for (int i = 0; i < 7; ++i) { - if (nbt.hasKey("stacks[" + i + "]")) { - setStack(i, ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("stacks[" + i + "]"))); - } - } - } - - private boolean classMatch(Item base, Item matched) { - if (base.getClass() == Item.class) { - return base == matched; - } else if (base.getClass() == matched.getClass()) { - if (base instanceof ItemBlock) { - Block baseBlock = ((ItemBlock) base).block; - Block matchedBlock = ((ItemBlock) matched).block; - - if (baseBlock.getClass() == Block.class) { - return baseBlock == matchedBlock; - } else { - return baseBlock.equals(matchedBlock); - } - } else { - return true; - } - } else { - return false; - } - } - - private boolean oreMatch(ItemStack base, ItemStack matched) { - int[] oreIds = OreDictionary.getOreIDs(base); - int[] matchesIds = OreDictionary.getOreIDs(matched); - - for (int stackId : oreIds) { - for (int matchId : matchesIds) { - if (stackId == matchId) { - return true; - } - } - } - - return false; - } - - private void setClientPreviewLists() { - Item baseItem = stacks[0].getItem(); - - int[] oreIds = OreDictionary.getOreIDs(stacks[0]); - - isOre = oreIds.length > 0; - - for (Object o : Item.itemRegistry) { - Item item = (Item) o; - boolean classMatch = classMatch(baseItem, item); - - List list = new LinkedList(); - - for (CreativeTabs tab : item.getCreativeTabs()) { - item.getSubItems(item, tab, list); - } - - if (list.size() > 0) { - for (Object ol : list) { - ItemStack stack = (ItemStack) ol; - - if (classMatch && relatedItems.size() <= 7 && !StackHelper.isMatchingItemOrList(stacks[0], stack)) { - relatedItems.add(stack); - } - - if (isOre && ores.size() <= 7 && !StackHelper.isMatchingItemOrList(stacks[0], stack) && oreMatch(stacks[0], stack)) { - ores.add(stack); - } - } - } - } - } - - public boolean matches(ItemStack item) { - if (subitemsWildcard) { - if (stacks[0] == null) { - return false; - } - - return classMatch(stacks[0].getItem(), item.getItem()); - } else if (oreWildcard) { - if (stacks[0] == null) { - return false; - } - - return oreMatch(stacks[0], item); - } else { - for (ItemStack stack : stacks) { - if (stack != null && StackHelper.isMatchingItem(stack, item, true, false)) { - return true; - } - } - - return false; - } - } - } - public ItemList() { super(); + setHasSubtypes(true); setMaxStackSize(1); } @Override public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { if (!world.isRemote) { - player.openGui(BuildCraftCore.instance, GuiIds.LIST, world, 0, 0, 0); + player.openGui(BuildCraftCore.instance, stack.getItemDamage() == 1 ? GuiIds.LIST_NEW : GuiIds.LIST_OLD, world, 0, 0, 0); } return stack; } @Override - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advanced) { - NBTTagCompound nbt = NBTUtils.getItemData(stack); + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advanced) { + if (stack.getItemDamage() == 0) { + list.add(EnumChatFormatting.DARK_RED + StatCollector.translateToLocal("tip.deprecated")); + } + NBTTagCompound nbt = NBTUtils.getItemData(stack); if (nbt.hasKey("label")) { list.add(nbt.getString("label")); } } - public static void saveLine(ItemStack stack, StackLine line, int index) { - NBTTagCompound nbt = NBTUtils.getItemData(stack); - - stack.setItemDamage(1); - - NBTTagCompound lineNBT = new NBTTagCompound(); - line.writeToNBT(lineNBT); - nbt.setTag("line[" + index + "]", lineNBT); - } - public static void saveLabel(ItemStack stack, String text) { NBTTagCompound nbt = NBTUtils.getItemData(stack); nbt.setString("label", text); } - public static StackLine[] getLines(ItemStack stack) { - if (LINE_CACHE.containsKey(stack)) { - return LINE_CACHE.get(stack); - } - - StackLine[] result = new StackLine[6]; - - for (int i = 0; i < 6; ++i) { - result[i] = new StackLine(); - } - - NBTTagCompound nbt = NBTUtils.getItemData(stack); - - if (stack.getItemDamage() == 1) { - for (int i = 0; i < 6; ++i) { - result[i].readFromNBT(nbt.getCompoundTag("line[" + i + "]")); - } - } - - LINE_CACHE.put(stack, result); - - return result; - } - @Override public boolean setName(ItemStack stack, String name) { saveLabel(stack, name); @@ -285,17 +78,18 @@ public String getLabel(ItemStack stack) { @Override public boolean matches(ItemStack stackList, ItemStack item) { - StackLine[] lines = getLines(stackList); - - if (lines != null) { - for (int i = 0; i < lines.length; i++) { - if (lines[i] != null && lines[i].matches(item)) { - return true; - } - } + if (stackList.getItemDamage() == 1) { + return ListHandlerNew.matches(stackList, item); + } else { + return ListHandlerOld.matches(stackList, item); } + } - return false; + @Override + @SideOnly(Side.CLIENT) + public void getSubItems(Item item, CreativeTabs tab, List itemList) { + itemList.add(new ItemStack(this, 1, 0)); // TODO: remove + itemList.add(new ItemStack(this, 1, 1)); } @Override diff --git a/common/buildcraft/core/ItemMapLocation.java b/common/buildcraft/core/ItemMapLocation.java index ca4d6724ff..23dbe3c370 100755 --- a/common/buildcraft/core/ItemMapLocation.java +++ b/common/buildcraft/core/ItemMapLocation.java @@ -1,5 +1,5 @@ /** 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.core; @@ -15,6 +15,7 @@ import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; + import net.minecraftforge.common.util.Constants; import buildcraft.api.core.IAreaProvider; @@ -22,13 +23,11 @@ import buildcraft.api.core.IPathProvider; import buildcraft.api.core.IZone; import buildcraft.api.items.IMapLocation; -import buildcraft.core.BCCreativeTab; -import buildcraft.core.Box; -import buildcraft.core.ZonePlan; import buildcraft.core.lib.items.ItemBuildCraft; import buildcraft.core.lib.utils.ModelHelper; import buildcraft.core.lib.utils.NBTUtils; import buildcraft.core.lib.utils.StringUtils; +import buildcraft.robotics.ZonePlan; public class ItemMapLocation extends ItemBuildCraft implements IMapLocation { public ItemMapLocation() { diff --git a/common/buildcraft/core/ItemPaintbrush.java b/common/buildcraft/core/ItemPaintbrush.java index ac8e61dd44..4971d6755e 100644 --- a/common/buildcraft/core/ItemPaintbrush.java +++ b/common/buildcraft/core/ItemPaintbrush.java @@ -1,5 +1,5 @@ /** 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.core; @@ -16,6 +16,7 @@ import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -130,7 +131,7 @@ public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, Bloc @Override @SideOnly(Side.CLIENT) - public void getSubItems(Item item, CreativeTabs tab, List itemList) { + public void getSubItems(Item item, CreativeTabs tab, List itemList) { for (int i = 0; i < 17; i++) { EnumDyeColor color = i == 0 ? null : EnumDyeColor.values()[i - 1]; itemList.add(this.getItemStack(color)); diff --git a/common/buildcraft/core/ItemSpring.java b/common/buildcraft/core/ItemSpring.java index 9b9ee079f8..1a0dc85259 100644 --- a/common/buildcraft/core/ItemSpring.java +++ b/common/buildcraft/core/ItemSpring.java @@ -1,5 +1,5 @@ /** 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.core; diff --git a/common/buildcraft/core/ItemWrench.java b/common/buildcraft/core/ItemWrench.java index 8041769462..6b223ae459 100644 --- a/common/buildcraft/core/ItemWrench.java +++ b/common/buildcraft/core/ItemWrench.java @@ -1,5 +1,5 @@ /** 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.core; @@ -7,10 +7,7 @@ import java.util.HashSet; import java.util.Set; -import net.minecraft.block.Block; -import net.minecraft.block.BlockButton; -import net.minecraft.block.BlockChest; -import net.minecraft.block.BlockLever; +import net.minecraft.block.*; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -20,10 +17,11 @@ import buildcraft.api.tools.IToolWrench; import buildcraft.core.lib.items.ItemBuildCraft; +import buildcraft.core.lib.utils.BlockUtils; public class ItemWrench extends ItemBuildCraft implements IToolWrench { - private final Set> shiftRotations = new HashSet>(); + private final Set> blacklistedRotations = new HashSet>(); public ItemWrench() { super(); @@ -33,11 +31,12 @@ public ItemWrench() { shiftRotations.add(BlockLever.class); shiftRotations.add(BlockButton.class); shiftRotations.add(BlockChest.class); + blacklistedRotations.add(BlockBed.class); setHarvestLevel("wrench", 0); } - private boolean isShiftRotation(Class cls) { - for (Class shift : shiftRotations) { + private boolean isClass(Set> set, Class cls) { + for (Class shift : set) { if (shift.isAssignableFrom(cls)) { return true; } @@ -50,11 +49,16 @@ public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, float hitZ) { Block block = world.getBlockState(pos).getBlock(); - if (block == null) { + if (block == null || isClass(blacklistedRotations, block.getClass())) { + return false; + } + + if (player.isSneaking() != isClass(shiftRotations, block.getClass())) { return false; } - if (player.isSneaking() != isShiftRotation(block.getClass())) { + // Double chests should NOT be rotated. + if (block instanceof BlockChest && BlockUtils.getOtherDoubleChest(world.getTileEntity(pos)) != null) { return false; } diff --git a/common/buildcraft/core/LaserData.java b/common/buildcraft/core/LaserData.java index 4ea382fb9f..25c8c29921 100755 --- a/common/buildcraft/core/LaserData.java +++ b/common/buildcraft/core/LaserData.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core; import net.minecraft.nbt.NBTTagCompound; diff --git a/common/buildcraft/core/LaserKind.java b/common/buildcraft/core/LaserKind.java index 125bdfef0f..fdbc4f0186 100644 --- a/common/buildcraft/core/LaserKind.java +++ b/common/buildcraft/core/LaserKind.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core; public enum LaserKind { diff --git a/common/buildcraft/core/PowerMode.java b/common/buildcraft/core/PowerMode.java index 3b819ae1f3..70ac99ce62 100644 --- a/common/buildcraft/core/PowerMode.java +++ b/common/buildcraft/core/PowerMode.java @@ -12,7 +12,7 @@ public enum PowerMode { public static final PowerMode[] VALUES = values(); public final int maxPower; - private PowerMode(int max) { + PowerMode(int max) { this.maxPower = max; } diff --git a/common/buildcraft/core/RenderPathMarker.java b/common/buildcraft/core/RenderPathMarker.java new file mode 100755 index 0000000000..71d361a52d --- /dev/null +++ b/common/buildcraft/core/RenderPathMarker.java @@ -0,0 +1,58 @@ +/** 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.core; + +import org.lwjgl.opengl.GL11; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; + +import buildcraft.core.render.RenderLaser; + +public class RenderPathMarker extends TileEntitySpecialRenderer { + + private ModelBase model = new ModelBase() {}; + private ModelRenderer box; + + public RenderPathMarker() { + box = new ModelRenderer(model, 0, 1); + box.addBox(-8F, -8F, -8F, 16, 4, 16); + box.rotationPointX = 8; + box.rotationPointY = 8; + box.rotationPointZ = 8; + } + + @Override + public void renderTileEntityAt(TilePathMarker marker, double x, double y, double z, float f, int arg) { + + if (marker != null) { + GL11.glPushMatrix(); + GL11.glPushAttrib(GL11.GL_ENABLE_BIT); + GL11.glEnable(GL11.GL_CULL_FACE); + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + + GL11.glTranslated(x, y, z); + GL11.glTranslated(-marker.getPos().getX(), -marker.getPos().getY(), -marker.getPos().getZ()); + + for (LaserData laser : marker.lasers) { + if (laser != null) { + GL11.glPushMatrix(); + RenderLaser.doRenderLaser(TileEntityRendererDispatcher.instance.worldObj, Minecraft.getMinecraft().renderEngine, laser, + EntityLaser.LASER_BLUE); + GL11.glPopMatrix(); + } + } + + // GL11.glEnable(GL11.GL_LIGHTING); + GL11.glPopAttrib(); + GL11.glPopMatrix(); + } + } +} diff --git a/common/buildcraft/core/SchematicEngine.java b/common/buildcraft/core/SchematicEngine.java index a094f9810c..17ebf7cae2 100644 --- a/common/buildcraft/core/SchematicEngine.java +++ b/common/buildcraft/core/SchematicEngine.java @@ -1,5 +1,5 @@ /** 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.core; diff --git a/common/buildcraft/core/SpringPopulate.java b/common/buildcraft/core/SpringPopulate.java index b4d2bb9cab..bf701443ef 100644 --- a/common/buildcraft/core/SpringPopulate.java +++ b/common/buildcraft/core/SpringPopulate.java @@ -1,5 +1,5 @@ /** 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.core; @@ -7,16 +7,19 @@ import java.util.Random; import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.util.BlockPos; import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeGenBase; + import net.minecraftforge.event.terraingen.PopulateChunkEvent; import net.minecraftforge.event.terraingen.TerrainGen; import net.minecraftforge.fml.common.eventhandler.Event.Result; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import buildcraft.BuildCraftCore; +import buildcraft.api.enums.EnumSpring; +import buildcraft.core.lib.block.BlockBuildCraftBase; public class SpringPopulate { @@ -26,7 +29,7 @@ public void populate(PopulateChunkEvent.Post event) { boolean doGen = TerrainGen.populate(event.chunkProvider, event.world, event.rand, event.chunkX, event.chunkZ, event.hasVillageGenerated, PopulateChunkEvent.Populate.EventType.CUSTOM); - if (!doGen) { + if (!doGen || !EnumSpring.WATER.canGen) { event.setResult(Result.ALLOW); return; } @@ -39,15 +42,14 @@ public void populate(PopulateChunkEvent.Post event) { } private void doPopulate(World world, Random random, int x, int z) { - - // A spring will be generated every 40th chunk. - if (random.nextFloat() > 0.025f) { + int dimId = world.provider.getDimensionId(); + // No water springs will generate in the Nether or End. + if (dimId == -1 || dimId == 1) { return; } - // Do not generate water in the End or the Nether - BiomeGenBase biomegenbase = world.getWorldChunkManager().getBiomeGenerator(new BlockPos(x, 10, z)); - if (biomegenbase.biomeID == BiomeGenBase.sky.biomeID || biomegenbase.biomeID == BiomeGenBase.hell.biomeID) { + // A spring will be generated every 40th chunk. + if (random.nextFloat() > 0.025f) { return; } @@ -61,34 +63,24 @@ private void doPopulate(World world, Random random, int x, int z) { if (candidate != Blocks.bedrock) { continue; } - world.setBlockState(pos.up(), BuildCraftCore.springBlock.getDefaultState()); - for (int j = i + 2; j < world.getActualHeight() - 10; j++) { - BlockPos above = pos.up(j); - if (!boreToSurface(world, above)) { - if (world.isAirBlock(above)) { - world.setBlockState(above, Blocks.water.getDefaultState()); - } + // Handle flat bedrock maps + int y = i > 0 ? i : i - 1; + + IBlockState springState = BuildCraftCore.springBlock.getDefaultState(); + springState = springState.withProperty(BlockBuildCraftBase.SPRING_TYPE, EnumSpring.WATER); + world.setBlockState(new BlockPos(posX, y, posZ), springState); + + for (int j = y + 2; j < world.getActualHeight(); j++) { + if (world.isAirBlock(new BlockPos(posX, j, posZ))) { break; + } else { + world.setBlockState(new BlockPos(posX, j, posZ), Blocks.water.getDefaultState()); } } break; } } - - private boolean boreToSurface(World world, BlockPos pos) { - if (world.isAirBlock(pos)) { - return false; - } - - Block existing = world.getBlockState(pos).getBlock(); - if (existing != Blocks.stone && existing != Blocks.dirt && existing != Blocks.gravel && existing != Blocks.grass) { - return false; - } - - world.setBlockState(pos, Blocks.water.getDefaultState()); - return true; - } } diff --git a/common/buildcraft/core/StackAtPosition.java b/common/buildcraft/core/StackAtPosition.java index 230850cf5e..c53e3b3838 100755 --- a/common/buildcraft/core/StackAtPosition.java +++ b/common/buildcraft/core/StackAtPosition.java @@ -1,5 +1,5 @@ /** 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.core; @@ -17,7 +17,7 @@ public class StackAtPosition implements ISerializable { public Vec3 pos; public boolean display; - // Rendering + // Rendering only! public boolean generatedListId; public int glListId; @@ -30,4 +30,18 @@ public void readData(ByteBuf stream) { public void writeData(ByteBuf stream) { NetworkUtils.writeStack(stream, stack); } + + @Override + public boolean equals(Object o) { + if (o == null || !(o instanceof StackAtPosition)) { + return false; + } + StackAtPosition other = (StackAtPosition) o; + return other.stack.equals(stack) && other.pos.equals(pos) && other.display == display; + } + + @Override + public int hashCode() { + return stack.hashCode() * 17 + pos.hashCode(); + } } diff --git a/common/buildcraft/core/TickHandlerCore.java b/common/buildcraft/core/TickHandlerCore.java index 09297d4a37..9832fa15b0 100644 --- a/common/buildcraft/core/TickHandlerCore.java +++ b/common/buildcraft/core/TickHandlerCore.java @@ -1,5 +1,5 @@ /** 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.core; @@ -9,21 +9,18 @@ import com.google.common.collect.Lists; import net.minecraft.client.Minecraft; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.ChatComponentTranslation; import net.minecraft.world.World; + import net.minecraftforge.event.world.WorldEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent; import net.minecraftforge.fml.common.gameevent.TickEvent.Phase; -import net.minecraftforge.fml.common.gameevent.TickEvent.PlayerTickEvent; import net.minecraftforge.fml.common.gameevent.TickEvent.WorldTickEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import buildcraft.api.core.BCLog; import buildcraft.core.lib.network.base.PacketHandler; -import buildcraft.core.proxy.CoreProxy; public enum TickHandlerCore { INSTANCE; diff --git a/common/buildcraft/core/TileEngineWood.java b/common/buildcraft/core/TileEngineWood.java index 2c3934826a..cbd351d18c 100644 --- a/common/buildcraft/core/TileEngineWood.java +++ b/common/buildcraft/core/TileEngineWood.java @@ -1,5 +1,5 @@ /** 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.core; @@ -23,16 +23,6 @@ public EnumEngineType getEngineType() { return EnumEngineType.WOOD; } - @Override - public int minEnergyReceived() { - return 0; - } - - @Override - public int maxEnergyReceived() { - return 500; - } - @Override protected EnumEnergyStage computeEnergyStage() { double energyLevel = getEnergyLevel(); @@ -47,6 +37,11 @@ protected EnumEnergyStage computeEnergyStage() { } } + @Override + public int getCurrentOutputLimit() { + return 10; + } + @Override public float getPistonSpeed() { if (!worldObj.isRemote) { @@ -92,19 +87,22 @@ public int getMaxEnergy() { } @Override - public int calculateCurrentOutput() { + public int getIdealOutput() { return 10; } @Override - public int maxEnergyExtracted() { - return 10; + public boolean canConnectEnergy(EnumFacing from) { + return false; + } + + public int getEnergyStored(EnumFacing side) { + return 0; } - // TODO: HACK @Override - public boolean canConnectEnergy(EnumFacing from) { - return false; + public int getMaxEnergyStored(EnumFacing side) { + return 0; } @Override diff --git a/common/buildcraft/builders/TileMarker.java b/common/buildcraft/core/TileMarker.java similarity index 97% rename from common/buildcraft/builders/TileMarker.java rename to common/buildcraft/core/TileMarker.java index ea0d585035..1a42c4321a 100644 --- a/common/buildcraft/builders/TileMarker.java +++ b/common/buildcraft/core/TileMarker.java @@ -1,8 +1,8 @@ /** 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.builders; +package buildcraft.core; import net.minecraft.block.state.IBlockState; import net.minecraft.nbt.NBTTagCompound; @@ -11,12 +11,9 @@ import net.minecraft.util.Vec3; import net.minecraft.world.World; -import buildcraft.BuildCraftBuilders; +import buildcraft.BuildCraftCore; import buildcraft.api.core.ISerializable; import buildcraft.api.tiles.ITileAreaProvider; -import buildcraft.core.DefaultProps; -import buildcraft.core.EntityLaser; -import buildcraft.core.LaserKind; import buildcraft.core.lib.block.TileBuildCraft; import buildcraft.core.lib.utils.NBTUtils; import buildcraft.core.lib.utils.Utils; @@ -457,14 +454,14 @@ public void removeFromWorld() { if (m.isSet()) { IBlockState state = worldObj.getBlockState(m.getPos()); worldObj.setBlockToAir(m.getPos()); - BuildCraftBuilders.markerBlock.dropBlockAsItem(worldObj, m.getPos(), state, 0); + BuildCraftCore.markerBlock.dropBlockAsItem(worldObj, m.getPos(), state, 0); } } IBlockState state = worldObj.getBlockState(o.vectO.getPos()); worldObj.setBlockToAir(o.vectO.getPos()); - BuildCraftBuilders.markerBlock.dropBlockAsItem(worldObj, o.vectO.getPos(), state, 0); + BuildCraftCore.markerBlock.dropBlockAsItem(worldObj, o.vectO.getPos(), state, 0); } @Override diff --git a/common/buildcraft/builders/TilePathMarker.java b/common/buildcraft/core/TilePathMarker.java similarity index 93% rename from common/buildcraft/builders/TilePathMarker.java rename to common/buildcraft/core/TilePathMarker.java index 70f42381bb..d978b5530a 100644 --- a/common/buildcraft/builders/TilePathMarker.java +++ b/common/buildcraft/core/TilePathMarker.java @@ -1,12 +1,13 @@ /** 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.builders; +package buildcraft.core; +import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; -import java.util.LinkedList; +import java.util.List; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; @@ -14,9 +15,8 @@ import net.minecraft.util.Vec3; import net.minecraft.world.World; +import buildcraft.BuildCraftCore; import buildcraft.api.core.IPathProvider; -import buildcraft.core.DefaultProps; -import buildcraft.core.LaserData; import buildcraft.core.lib.utils.Utils; import io.netty.buffer.ByteBuf; @@ -24,7 +24,7 @@ public class TilePathMarker extends TileMarker implements IPathProvider { // A list with the pathMarkers that aren't fully connected // It only contains markers within the loaded chunks - private static LinkedList availableMarkers = new LinkedList(); + private static ArrayList availableMarkers = new ArrayList(); public int x0, y0, z0, x1, y1, z1; public boolean loadLink0 = false; @@ -133,9 +133,9 @@ public void update() { } } - public LinkedList getPath() { + public List getPath() { HashSet visitedPaths = new HashSet(); - LinkedList res = new LinkedList(); + List res = new ArrayList(); TilePathMarker nextTile = this; @@ -261,6 +261,7 @@ public void writeToNBT(NBTTagCompound nbttagcompound) { @Override public void onChunkUnload() { + super.onChunkUnload(); availableMarkers.remove(this); } @@ -312,4 +313,14 @@ public void writeData(ByteBuf data) { lasers[1].writeData(data); } } + + @Override + public void removeFromWorld() { + List path = getPath(); + for (BlockPos b : path) { + BuildCraftCore.pathMarkerBlock.dropBlockAsItem(worldObj, b, BuildCraftCore.pathMarkerBlock.getDefaultState(), 0); + + worldObj.setBlockToAir(b); + } + } } diff --git a/common/buildcraft/core/blueprints/Blueprint.java b/common/buildcraft/core/blueprints/Blueprint.java index ef3916b1cd..ba8dc88b65 100644 --- a/common/buildcraft/core/blueprints/Blueprint.java +++ b/common/buildcraft/core/blueprints/Blueprint.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.blueprints; import java.util.LinkedList; @@ -24,6 +28,7 @@ import buildcraft.api.blueprints.IBuilderContext; import buildcraft.api.blueprints.MappingNotFoundException; import buildcraft.api.blueprints.SchematicBlock; +import buildcraft.api.blueprints.SchematicBlockBase; import buildcraft.api.blueprints.SchematicEntity; import buildcraft.api.core.BCLog; import buildcraft.core.lib.utils.NBTUtils; @@ -101,7 +106,7 @@ public void readFromWorld(IBuilderContext context, TileEntity anchorTile, BlockP try { slot.initializeFromObjectAt(context, pos); slot.storeRequirements(context, pos); - contents[posX][posY][posZ] = slot; + put(posX, posY, posZ, slot); } catch (Throwable t) { // Defensive code against errors in implementers t.printStackTrace(); @@ -117,7 +122,7 @@ public void readFromWorld(IBuilderContext context, TileEntity anchorTile, BlockP buildingPermission = BuildingPermission.CREATIVE_ONLY; } } else { - contents[posX][posY][posZ] = null; + put(posX, posY, posZ, null); } break; case NONE: @@ -168,11 +173,12 @@ public void saveContents(NBTTagCompound nbt) { for (int x = 0; x < sizeX; ++x) { for (int y = 0; y < sizeY; ++y) { for (int z = 0; z < sizeZ; ++z) { + SchematicBlockBase schematic = get(x, y, z); NBTTagCompound cpt = new NBTTagCompound(); - if (contents[x][y][z] != null) { - contents[x][y][z].idsToBlueprint(mapping); - contents[x][y][z].writeSchematicToNBT(cpt, mapping); + if (schematic != null) { + schematic.idsToBlueprint(mapping); + schematic.writeSchematicToNBT(cpt, mapping); } nbtContents.appendTag(cpt); @@ -224,14 +230,14 @@ public void loadContents(NBTTagCompound nbt) throws BptError { if (block != null) { int meta = cpt.getInteger("blockMeta"); - contents[x][y][z] = SchematicRegistry.INSTANCE.createSchematicBlock(block.getStateFromMeta(meta)); - if (contents[x][y][z] != null) { - contents[x][y][z].readSchematicFromNBT(cpt, mapping); + SchematicBlockBase schematic = SchematicRegistry.INSTANCE.createSchematicBlock(block.getStateFromMeta(meta)); + if (schematic != null) { + schematic.readSchematicFromNBT(cpt, mapping); - if (!contents[x][y][z].doNotUse()) { - contents[x][y][z].idsToWorld(mapping); + if (!schematic.doNotUse()) { + schematic.idsToWorld(mapping); - switch (contents[x][y][z].getBuildingPermission()) { + switch (schematic.getBuildingPermission()) { case ALL: break; case CREATIVE_ONLY: @@ -244,16 +250,17 @@ public void loadContents(NBTTagCompound nbt) throws BptError { break; } } else { - contents[x][y][z] = null; + schematic = null; isComplete = false; } } + put(x, y, z, schematic); } else { - contents[x][y][z] = null; + put(x, y, z, null); isComplete = false; } } else { - contents[x][y][z] = null; + put(x, y, z, null); } } } @@ -288,7 +295,7 @@ public void loadContents(NBTTagCompound nbt) throws BptError { @Override public ItemStack getStack() { - Item item = (Item) Item.itemRegistry.getObject(new ResourceLocation("BuildCraft|Builders:blueprintItem")); + Item item = Item.itemRegistry.getObject(new ResourceLocation("BuildCraft|Builders:blueprintItem")); if (item == null) { throw new Error("Could not find the blueprint item! Did you attempt to use this without buildcraft builders installed?"); } diff --git a/common/buildcraft/core/blueprints/BlueprintBase.java b/common/buildcraft/core/blueprints/BlueprintBase.java index 28a4983c23..c2ea3e9e06 100644 --- a/common/buildcraft/core/blueprints/BlueprintBase.java +++ b/common/buildcraft/core/blueprints/BlueprintBase.java @@ -1,15 +1,16 @@ -/** 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 */ +/** + * 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.core.blueprints; -import java.io.ByteArrayOutputStream; -import java.io.IOException; import java.util.ArrayList; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; @@ -35,7 +36,6 @@ public abstract class BlueprintBase { public ArrayList subBlueprintsNBT = new ArrayList(); - public SchematicBlockBase[][][] contents; public int anchorX, anchorY, anchorZ; public int sizeX, sizeY, sizeZ; public LibraryId id = new LibraryId(); @@ -46,15 +46,15 @@ public abstract class BlueprintBase { public boolean isComplete = true; protected MappingRegistry mapping = new MappingRegistry(); + protected SchematicBlockBase[] contents; - private ComputeDataThread computeData; - private byte[] data; + private NBTTagCompound nbt; private EnumFacing mainDir = EnumFacing.EAST; public BlueprintBase() {} public BlueprintBase(int sizeX, int sizeY, int sizeZ) { - contents = new SchematicBlockBase[sizeX][sizeY][sizeZ]; + contents = new SchematicBlockBase[sizeX * sizeY * sizeZ]; this.sizeX = sizeX; this.sizeY = sizeY; @@ -65,41 +65,46 @@ public BlueprintBase(int sizeX, int sizeY, int sizeZ) { anchorZ = 0; } - public void translateToBlueprint(Vec3 transform) { - for (int x = 0; x < sizeX; ++x) { - for (int y = 0; y < sizeY; ++y) { - for (int z = 0; z < sizeZ; ++z) { - if (contents[x][y][z] != null) { - contents[x][y][z].translateToBlueprint(transform); + private int toArrayPos(int x, int y, int z) { + return (y * sizeZ + z) * sizeX + x; } + + public SchematicBlockBase get(int x, int y, int z) { + return contents[(y * sizeZ + z) * sizeX + x]; } + + public void put(int x, int y, int z, SchematicBlockBase s) { + contents[(y * sizeZ + z) * sizeX + x] = s; + } + + public void translateToBlueprint(Vec3 transform) { + for (SchematicBlockBase content : contents) { + if (content != null) { + content.translateToBlueprint(transform); } } } - public void translateToWorld(Vec3 transform) { - for (int x = 0; x < sizeX; ++x) { - for (int y = 0; y < sizeY; ++y) { - for (int z = 0; z < sizeZ; ++z) { - if (contents[x][y][z] != null) { - contents[x][y][z].translateToWorld(transform); - } - } + public void translateToWorld(Vec3 transform) { + for (SchematicBlockBase content : contents) { + if (content != null) { + content.translateToWorld(transform); } } } public void rotateLeft(BptContext context) { - SchematicBlockBase[][][] newContents = new SchematicBlockBase[sizeZ][sizeY][sizeX]; + SchematicBlockBase[] newContents = new SchematicBlockBase[sizeZ * sizeY * sizeX]; for (int x = 0; x < sizeZ; ++x) { for (int y = 0; y < sizeY; ++y) { for (int z = 0; z < sizeX; ++z) { - newContents[x][y][z] = contents[z][y][(sizeZ - 1) - x]; + int pos = (y * sizeX + z) * sizeZ + x; + newContents[pos] = contents[toArrayPos(z, y, (sizeZ - 1) - x)]; - if (newContents[x][y][z] != null) { + if (newContents[pos] != null) { try { - newContents[x][y][z].rotateLeft(context); + newContents[pos].rotateLeft(context); } catch (Throwable t) { // Defensive code against errors in implementers t.printStackTrace(); @@ -129,8 +134,6 @@ public void rotateLeft(BptContext context) { sub.setInteger("x", (int) np.xCoord); sub.setInteger("z", (int) np.zCoord); sub.setByte("dir", (byte) dir.ordinal()); - - NBTTagCompound bpt = sub.getCompoundTag("bpt"); } context.rotateLeft(); @@ -220,7 +223,7 @@ public void readFromNBT(NBTTagCompound nbt) { excavate = true; } - contents = new SchematicBlockBase[sizeX][sizeY][sizeZ]; + contents = new SchematicBlockBase[sizeX * sizeY * sizeZ]; try { loadContents(nbt); @@ -255,59 +258,25 @@ public Box getBoxForPos(BlockPos pos) { public BptContext getContext(World world, Box box) { return new BptContext(world, box, mapping); } - - public void addSubBlueprint(BlueprintBase bpt, BlockPos pos, EnumFacing dir) { - NBTTagCompound nbt = new NBTTagCompound(); - - nbt.setInteger("x", pos.getX()); - nbt.setInteger("y", pos.getY()); - nbt.setInteger("z", pos.getZ()); - nbt.setByte("dir", (byte) dir.ordinal()); - - NBTTagCompound bptNBT = getNBT(); - nbt.setTag("bpt", bptNBT); - - subBlueprintsNBT.add(nbt); - } - - class ComputeDataThread extends Thread { - public NBTTagCompound nbt; - - @Override - public void run() { - try { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - CompressedStreamTools.writeCompressed(nbt, baos); - BlueprintBase.this.setData(baos.toByteArray()); - } catch (IOException e) { - e.printStackTrace(); - } - } + + public void addSubBlueprint(BlueprintBase subBpt, BlockPos pos, EnumFacing dir) { + NBTTagCompound subNBT = new NBTTagCompound(); + + subNBT.setInteger("x", pos.getX()); + subNBT.setInteger("y", pos.getY()); + subNBT.setInteger("z", pos.getZ()); + subNBT.setByte("dir", (byte) dir.ordinal()); + subNBT.setTag("bpt", subBpt.getNBT()); + + subBlueprintsNBT.add(subNBT); } - /** This function will return the binary data associated to this blueprint. This data is computed asynchronously. If - * the data is not yet available, null will be returned. */ - public synchronized byte[] getData() { - if (data != null) { - return data; - } else if (computeData == null) { - computeData = new ComputeDataThread(); - computeData.nbt = new NBTTagCompound(); - writeToNBTInternal(computeData.nbt); - computeData.start(); + public NBTTagCompound getNBT() { + if (nbt == null) { + nbt = new NBTTagCompound(); + writeToNBTInternal(nbt); } - - return null; - } - - public synchronized NBTTagCompound getNBT() { - if (computeData == null) { - computeData = new ComputeDataThread(); - computeData.nbt = new NBTTagCompound(); - writeToNBTInternal(computeData.nbt); - computeData.start(); - } - return computeData.nbt; + return nbt; } public BlueprintBase adjustToWorld(World world, BlockPos pos, EnumFacing o) { @@ -340,10 +309,6 @@ public BlueprintBase adjustToWorld(World world, BlockPos pos, EnumFacing o) { return this; } - public synchronized void setData(byte[] b) { - data = b; - } - public abstract void loadContents(NBTTagCompound nbt) throws BptError; public abstract void saveContents(NBTTagCompound nbt); diff --git a/common/buildcraft/core/blueprints/BlueprintReadConfiguration.java b/common/buildcraft/core/blueprints/BlueprintReadConfiguration.java index 8f6670c3ab..17d7224644 100755 --- a/common/buildcraft/core/blueprints/BlueprintReadConfiguration.java +++ b/common/buildcraft/core/blueprints/BlueprintReadConfiguration.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.blueprints; import net.minecraft.nbt.NBTTagCompound; diff --git a/common/buildcraft/core/blueprints/BptBuilderBase.java b/common/buildcraft/core/blueprints/BptBuilderBase.java index 3d9878240e..57bc25a6d0 100644 --- a/common/buildcraft/core/blueprints/BptBuilderBase.java +++ b/common/buildcraft/core/blueprints/BptBuilderBase.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.blueprints; import java.util.BitSet; @@ -21,6 +25,7 @@ import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraft.world.WorldServer; + import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.BlockSnapshot; import net.minecraftforge.common.util.Constants; @@ -211,7 +216,7 @@ public void consumeEnergyToDestroy(TileAbstractBuilder builder, BuildingSlotBloc } public void createDestroyItems(BuildingSlotBlock slot) { - int hardness = (int) Math.ceil(getBlockBreakEnergy(slot) / BuilderAPI.BREAK_ENERGY); + int hardness = (int) Math.ceil((double) getBlockBreakEnergy(slot) / BuilderAPI.BREAK_ENERGY); for (int i = 0; i < hardness; ++i) { slot.addStackConsumed(new ItemStack(BuildCraftCore.decoratedBlock)); @@ -223,8 +228,6 @@ public void useRequirements(IInventory inv, BuildingSlot slot) { } public void saveBuildStateToNBT(NBTTagCompound nbt, IBuildingItemsProvider builder) { - NBTTagList clearList = new NBTTagList(); - nbt.setByteArray("usedLocationList", BitSetUtils.toByteArray(usedLocations)); NBTTagList buildingList = new NBTTagList(); diff --git a/common/buildcraft/core/blueprints/BptBuilderBlueprint.java b/common/buildcraft/core/blueprints/BptBuilderBlueprint.java index 4f6ae4daab..0feed8d01e 100644 --- a/common/buildcraft/core/blueprints/BptBuilderBlueprint.java +++ b/common/buildcraft/core/blueprints/BptBuilderBlueprint.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.blueprints; import java.util.ArrayList; @@ -15,9 +19,6 @@ import java.util.ListIterator; import java.util.Map.Entry; -import com.google.common.collect.HashMultiset; -import com.google.common.collect.Multiset; - import net.minecraft.init.Blocks; import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; @@ -45,25 +46,23 @@ import buildcraft.core.builders.BuildingSlotBlock; import buildcraft.core.builders.BuildingSlotBlock.Mode; import buildcraft.core.builders.BuildingSlotEntity; -import buildcraft.core.builders.BuildingSlotMapIterator; import buildcraft.core.builders.IBuildingItemsProvider; import buildcraft.core.builders.TileAbstractBuilder; import buildcraft.core.lib.inventory.InventoryCopy; import buildcraft.core.lib.inventory.InventoryIterator; -import buildcraft.core.lib.inventory.StackHelper; import buildcraft.core.lib.utils.BlockUtils; public class BptBuilderBlueprint extends BptBuilderBase { - - public ArrayList neededItems = new ArrayList(); - protected HashSet builtEntities = new HashSet(); + protected HashMap> buildList = new HashMap>(); + protected int[] buildStageOccurences; + + private ArrayList neededItems = new ArrayList(); - private HashMap> buildList = new HashMap>(); - private Multiset buildStageOccurences = HashMultiset.create(); private LinkedList entityList = new LinkedList(); private LinkedList postProcessing = new LinkedList(); private BuildingSlotMapIterator iterator; + private IndexRequirementMap requirementMap = new IndexRequirementMap(); public BptBuilderBlueprint(Blueprint bluePrint, World world, BlockPos pos) { super(bluePrint, world, pos); @@ -72,18 +71,22 @@ public BptBuilderBlueprint(Blueprint bluePrint, World world, BlockPos pos) { @Override protected void internalInit() { for (int j = blueprint.sizeY - 1; j >= 0; --j) { - for (int i = 0; i < blueprint.sizeX; ++i) { - for (int k = 0; k < blueprint.sizeZ; ++k) { - int xCoord = i + pos.getX() - blueprint.anchorX; - int yCoord = j + pos.getY() - blueprint.anchorY; - int zCoord = k + pos.getZ() - blueprint.anchorZ; + int yCoord = j + pos.getY() - blueprint.anchorY; if (yCoord < 0 || yCoord >= context.world.getHeight()) { continue; } - if (!isLocationUsed(xCoord, yCoord, zCoord)) { - SchematicBlock slot = (SchematicBlock) blueprint.contents[i][j][k]; + for (int i = 0; i < blueprint.sizeX; ++i) { + int xCoord = i + pos.getX() - blueprint.anchorX; + + for (int k = 0; k < blueprint.sizeZ; ++k) { + int zCoord = k + pos.getZ() - blueprint.anchorZ; + + BlockPos coord = new BlockPos(xCoord, yCoord, zCoord); + + if (!isLocationUsed(coord)) { + SchematicBlock slot = (SchematicBlock) blueprint.get(i, j, k); if (slot == null && !blueprint.excavate) { continue; @@ -111,19 +114,24 @@ protected void internalInit() { } LinkedList tmpStandalone = new LinkedList(); - LinkedList tmpSupported = new LinkedList(); LinkedList tmpExpanding = new LinkedList(); for (int j = 0; j < blueprint.sizeY; ++j) { + int yCoord = j + pos.getY() - blueprint.anchorY; + + if (yCoord < 0 || yCoord >= context.world.getHeight()) { + continue; + } + for (int i = 0; i < blueprint.sizeX; ++i) { - for (int k = 0; k < blueprint.sizeZ; ++k) { - int xCoord = i + pos.getX() - blueprint.anchorX; - int yCoord = j + pos.getY() - blueprint.anchorY; - int zCoord = k + pos.getZ() - blueprint.anchorZ; + int xCoord = i + pos.getX() - blueprint.anchorX; - SchematicBlock slot = (SchematicBlock) blueprint.contents[i][j][k]; + for (int k = 0; k < blueprint.sizeZ; ++k) { + int zCoord = k + pos.getZ() - blueprint.anchorZ; - if (slot == null || yCoord < 0 || yCoord >= context.world.getHeight()) { + SchematicBlock slot = (SchematicBlock) blueprint.get(i, j, k); + + if (slot == null) { continue; } @@ -142,15 +150,10 @@ protected void internalInit() { tmpStandalone.add(b); b.buildStage = 1; break; - case SUPPORTED: - tmpSupported.add(b); - b.buildStage = 2; - break; case EXPANDING: tmpExpanding.add(b); - b.buildStage = 3; + b.buildStage = 2; break; - } } else { postProcessing.add(b); @@ -162,9 +165,6 @@ protected void internalInit() { for (BuildingSlotBlock b : tmpStandalone) { addToBuildList(b); } - for (BuildingSlotBlock b : tmpSupported) { - addToBuildList(b); - } for (BuildingSlotBlock b : tmpExpanding) { addToBuildList(b); } @@ -248,8 +248,6 @@ public void deploy() { } private void checkDone() { - recomputeNeededItems(); - if (getBuildListCount() == 0 && entityList.size() == 0) { done = true; } else { @@ -259,8 +257,10 @@ private void checkDone() { private int getBuildListCount() { int out = 0; - for (int i = 0; i < 4; i++) { - out += buildStageOccurences.count(i); + if (buildStageOccurences != null) { + for (int i = 0; i < buildStageOccurences.length; i++) { + out += buildStageOccurences[i]; + } } return out; } @@ -288,7 +288,20 @@ private void addToBuildList(BuildingSlotBlock b) { buildList.put(imp, new ArrayList()); } buildList.get(imp).add(b); - buildStageOccurences.add(b.buildStage); + + if (buildStageOccurences == null) { + buildStageOccurences = new int[Math.max(3, b.buildStage + 1)]; + } else if (buildStageOccurences.length <= b.buildStage) { + int[] newBSO = new int[b.buildStage + 1]; + System.arraycopy(buildStageOccurences, 0, newBSO, 0, buildStageOccurences.length); + buildStageOccurences = newBSO; + } + buildStageOccurences[b.buildStage]++; + + if (b.mode == Mode.Build) { + requirementMap.add(b, context); + b.internalRequirementRemovalListener = requirementMap; + } } } @@ -310,26 +323,37 @@ public BuildingSlot getNextBlock(World world, TileAbstractBuilder inv) { return null; } - /** Gets the next available block. If builder is not null, then building will be verified and performed. Otherwise, - * the next possible building slot is returned, possibly for reservation, with no building. */ + protected boolean readyForSlotLookup(TileAbstractBuilder builder) { + return builder == null || builder.energyAvailable() >= BuilderAPI.BREAK_ENERGY; + } + + /** + * Gets the next available block. If builder is not null, then building will + * be verified and performed. Otherwise, the next possible building slot is + * returned, possibly for reservation, with no building. + */ private BuildingSlot internalGetNextBlock(World world, TileAbstractBuilder builder) { - if (builder != null && builder.energyAvailable() < BuilderAPI.BREAK_ENERGY) { + if (!readyForSlotLookup(builder)) { return null; } - iterator = new BuildingSlotMapIterator(buildList, builder, buildStageOccurences); + if (iterator == null) { + iterator = new BuildingSlotMapIterator(this, builder); + } + BuildingSlotBlock slot; + iterator.refresh(builder); - while ((slot = iterator.next()) != null) { - // if (world.isAirBlock(slot.pos)) { - // continue; - // } + while (readyForSlotLookup(builder) && (slot = iterator.next()) != null) { + if (world.isAirBlock(slot.pos)) { + continue; + } boolean skipped = false; for (int i = 0; i < slot.buildStage; i++) { - if (buildStageOccurences.count(i) > 0) { - iterator.skipList(); + if (buildStageOccurences[i] > 0) { + iterator.skipKey(); skipped = true; break; } @@ -354,6 +378,8 @@ private BuildingSlot internalGetNextBlock(World world, TileAbstractBuilder build try { if (slot.isAlreadyBuilt(context)) { if (slot.mode == Mode.Build) { + requirementMap.remove(slot); + // Even slots that considered already built may need // post processing calls. For example, flowing water // may need to be adjusted, engines may need to be @@ -362,7 +388,6 @@ private BuildingSlot internalGetNextBlock(World world, TileAbstractBuilder build } iterator.remove(); - continue; } @@ -370,6 +395,7 @@ private BuildingSlot internalGetNextBlock(World world, TileAbstractBuilder build // if the block can't be broken, just forget this iterator iterator.remove(); markLocationUsed(slot.pos); + requirementMap.remove(slot); } else { if (slot.mode == Mode.ClearIfInvalid) { if (BuildCraftAPI.isSoftBlock(world, slot.pos) || isBlockBreakCanceled(world, slot.pos)) { @@ -392,11 +418,14 @@ private BuildingSlot internalGetNextBlock(World world, TileAbstractBuilder build if (builder == null) { return slot; } else if (checkRequirements(builder, slot.schematic)) { - if (isBlockPlaceCanceled(world, slot.pos, slot.schematic)) { - // Forge does not allow us to place a block in - // this position. - iterator.remove(); - markLocationUsed(slot.pos); + if (!BuildCraftAPI.isSoftBlock(world, slot.pos) || requirementMap.contains(slot.pos)) { + continue; // Can't build yet, wait (#2751) + } else if (isBlockPlaceCanceled(world, slot.pos, slot.schematic)) { + // Forge does not allow us to place a block in + // this position. + iterator.remove(); + requirementMap.remove(slot); + markLocationUsed(slot.pos); continue; } @@ -417,6 +446,7 @@ private BuildingSlot internalGetNextBlock(World world, TileAbstractBuilder build // Even slots that don't need to be build may need // post processing, see above for the argument. postProcessing.add(slot); + requirementMap.remove(slot); iterator.remove(); } } @@ -425,12 +455,14 @@ private BuildingSlot internalGetNextBlock(World world, TileAbstractBuilder build t.printStackTrace(); BCLog.logger.throwing(t); iterator.remove(); + requirementMap.remove(slot); } } return null; } + // TODO: Remove recomputeNeededItems() and replace with something more efficient private BuildingSlot internalGetNextEntity(World world, TileAbstractBuilder builder) { Iterator it = entityList.iterator(); @@ -439,12 +471,14 @@ private BuildingSlot internalGetNextEntity(World world, TileAbstractBuilder buil if (slot.isAlreadyBuilt(context)) { it.remove(); + recomputeNeededItems(); } else { if (checkRequirements(builder, slot.schematic)) { builder.consumeEnergy(slot.getEnergyRequirement()); useRequirements(builder, slot); it.remove(); + recomputeNeededItems(); postProcessing.add(slot); builtEntities.add(slot.sequenceNumber); return slot; @@ -506,7 +540,7 @@ public boolean checkRequirements(TileAbstractBuilder builder, Schematic slot) { boolean compatibleContainer = fluidStack != null && fluidStack.getFluid() == fluid && fluidStack.amount >= FluidContainerRegistry.BUCKET_VOLUME; - if (StackHelper.isMatchingItem(reqStk, invStk, true, true) || compatibleContainer) { + if (slot.isItemMatchingRequirement(invStk, reqStk) || compatibleContainer) { try { stacksUsed.add(slot.useItem(context, reqStk, slotInv)); } catch (Throwable t) { @@ -588,7 +622,7 @@ public void useRequirements(IInventory inv, BuildingSlot slot) { boolean fluidFound = fluidStack != null && fluidStack.getFluid() == fluid && fluidStack.amount >= FluidContainerRegistry.BUCKET_VOLUME; - if (fluidFound || StackHelper.isCraftingEquivalent(reqStk, invStk, true)) { + if (fluidFound || slot.getSchematic().isItemMatchingRequirement(invStk, reqStk)) { try { usedStack = slot.getSchematic().useItem(context, reqStk, slotInv); slot.addStackConsumed(usedStack); @@ -614,7 +648,82 @@ public void useRequirements(IInventory inv, BuildingSlot slot) { } } - public void recomputeNeededItems() { + public List getNeededItems() { + return neededItems; + } + + protected void onRemoveBuildingSlotBlock(BuildingSlotBlock slot) { + buildStageOccurences[slot.buildStage]--; + LinkedList stacks = new LinkedList(); + + try { + stacks = slot.getRequirements(context); + } catch (Throwable t) { + // Defensive code against errors in implementers + t.printStackTrace(); + BCLog.logger.throwing(t); + } + + HashMap computeStacks = new HashMap(); + + for (ItemStack stack : stacks) { + if (stack == null || stack.getItem() == null || stack.stackSize == 0) { + continue; + } + + StackKey key = new StackKey(stack); + + if (!computeStacks.containsKey(key)) { + computeStacks.put(key, stack.stackSize); + } else { + Integer num = computeStacks.get(key); + num += stack.stackSize; + computeStacks.put(key, num); + } + } + + for (RequirementItemStack ris : neededItems) { + StackKey stackKey = new StackKey(ris.stack); + if (computeStacks.containsKey(stackKey)) { + Integer num = computeStacks.get(stackKey); + if (ris.size <= num) { + recomputeNeededItems(); + return; + } else { + neededItems.set(neededItems.indexOf(ris), new RequirementItemStack(ris.stack, ris.size - num)); + } + } + } + + sortNeededItems(); + } + + private void sortNeededItems() { + Collections.sort(neededItems, new Comparator() { + @Override + public int compare(RequirementItemStack o1, RequirementItemStack o2) { + if (o1.size != o2.size) { + return o1.size < o2.size ? 1 : -1; + } else { + ItemStack os1 = o1.stack; + ItemStack os2 = o2.stack; + if (Item.getIdFromItem(os1.getItem()) > Item.getIdFromItem(os2.getItem())) { + return -1; + } else if (Item.getIdFromItem(os1.getItem()) < Item.getIdFromItem(os2.getItem())) { + return 1; + } else if (os1.getItemDamage() > os2.getItemDamage()) { + return -1; + } else if (os1.getItemDamage() < os2.getItemDamage()) { + return 1; + } else { + return 0; + } + } + } + }); + } + + private void recomputeNeededItems() { neededItems.clear(); HashMap computeStacks = new HashMap(); @@ -685,33 +794,10 @@ public void recomputeNeededItems() { } for (Entry e : computeStacks.entrySet()) { - ItemStack newStack = e.getKey().stack.copy(); - newStack.stackSize = e.getValue(); - - neededItems.add(newStack); + neededItems.add(new RequirementItemStack(e.getKey().stack.copy(), e.getValue())); } - Collections.sort(neededItems, new Comparator() { - @Override - public int compare(ItemStack o1, ItemStack o2) { - if (o1.stackSize > o2.stackSize) { - return -1; - } else if (o1.stackSize < o2.stackSize) { - return 1; - } else if (Item.getIdFromItem(o1.getItem()) > Item.getIdFromItem(o2.getItem())) { - return -1; - } else if (Item.getIdFromItem(o1.getItem()) < Item.getIdFromItem(o2.getItem())) { - return 1; - } else if (o1.getItemDamage() > o2.getItemDamage()) { - return -1; - } else if (o1.getItemDamage() < o2.getItemDamage()) { - return 1; - } else { - return 0; - } - } - }); - + sortNeededItems(); } @Override @@ -753,5 +839,4 @@ public void loadBuildStateToNBT(NBTTagCompound nbt, IBuildingItemsProvider build builtEntities.add(i); } } - } diff --git a/common/buildcraft/core/blueprints/BptBuilderTemplate.java b/common/buildcraft/core/blueprints/BptBuilderTemplate.java index c9ee92912a..8bc9a8913e 100644 --- a/common/buildcraft/core/blueprints/BptBuilderTemplate.java +++ b/common/buildcraft/core/blueprints/BptBuilderTemplate.java @@ -1,5 +1,5 @@ /** 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.core.blueprints; @@ -36,17 +36,19 @@ public BptBuilderTemplate(BlueprintBase bluePrint, World world, BlockPos pos) { protected void internalInit() { if (blueprint.excavate) { for (int j = blueprint.sizeY - 1; j >= 0; --j) { + int yCoord = j + pos.getY() - blueprint.anchorY; + + if (yCoord < 0 || yCoord >= context.world.getHeight()) { + continue; + } + for (int i = 0; i < blueprint.sizeX; ++i) { + int xCoord = i + pos.getX() - blueprint.anchorX; + for (int k = 0; k < blueprint.sizeZ; ++k) { - int xCoord = i + pos.getX() - blueprint.anchorX; - int yCoord = j + pos.getY() - blueprint.anchorY; int zCoord = k + pos.getZ() - blueprint.anchorZ; - if (yCoord < 0 || yCoord >= context.world.getHeight()) { - continue; - } - - SchematicBlockBase slot = blueprint.contents[i][j][k]; + SchematicBlockBase slot = blueprint.get(i, j, k); if (slot == null && !isLocationUsed(xCoord, yCoord, zCoord)) { BuildingSlotBlock b = new BuildingSlotBlock(); @@ -64,17 +66,19 @@ protected void internalInit() { } for (int j = 0; j < blueprint.sizeY; ++j) { + int yCoord = j + pos.getY() - blueprint.anchorY; + + if (yCoord < 0 || yCoord >= context.world.getHeight()) { + continue; + } + for (int i = 0; i < blueprint.sizeX; ++i) { + int xCoord = i + pos.getX() - blueprint.anchorX; + for (int k = 0; k < blueprint.sizeZ; ++k) { - int xCoord = i + pos.getX() - blueprint.anchorX; - int yCoord = j + pos.getY() - blueprint.anchorY; int zCoord = k + pos.getZ() - blueprint.anchorZ; - if (yCoord < 0 || yCoord >= context.world.getHeight()) { - continue; - } - - SchematicBlockBase slot = blueprint.contents[i][j][k]; + SchematicBlockBase slot = blueprint.get(i, j, k); if (slot != null && !isLocationUsed(xCoord, yCoord, zCoord)) { BuildingSlotBlock b = new BuildingSlotBlock(); diff --git a/common/buildcraft/core/blueprints/BptContext.java b/common/buildcraft/core/blueprints/BptContext.java index 5b8a8b9aa6..108b9717cc 100644 --- a/common/buildcraft/core/blueprints/BptContext.java +++ b/common/buildcraft/core/blueprints/BptContext.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.blueprints; import net.minecraft.util.Vec3; diff --git a/common/buildcraft/core/blueprints/BptDataStream.java b/common/buildcraft/core/blueprints/BptDataStream.java index c79f548f48..b045a5dee8 100644 --- a/common/buildcraft/core/blueprints/BptDataStream.java +++ b/common/buildcraft/core/blueprints/BptDataStream.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.blueprints; import java.io.DataInput; diff --git a/common/buildcraft/core/blueprints/BptError.java b/common/buildcraft/core/blueprints/BptError.java index d0dce0afb4..78f7698fe4 100644 --- a/common/buildcraft/core/blueprints/BptError.java +++ b/common/buildcraft/core/blueprints/BptError.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.blueprints; import buildcraft.api.core.BCLog; diff --git a/common/buildcraft/core/blueprints/BuildingSlotMapIterator.java b/common/buildcraft/core/blueprints/BuildingSlotMapIterator.java new file mode 100755 index 0000000000..2379429066 --- /dev/null +++ b/common/buildcraft/core/blueprints/BuildingSlotMapIterator.java @@ -0,0 +1,121 @@ +/** 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.core.blueprints; + +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import net.minecraft.item.ItemStack; +import net.minecraft.world.WorldSettings; + +import buildcraft.core.builders.BuilderItemMetaPair; +import buildcraft.core.builders.BuildingSlotBlock; +import buildcraft.core.builders.TileAbstractBuilder; +import buildcraft.core.lib.fluids.Tank; + +public class BuildingSlotMapIterator { + public static int MAX_PER_ITEM = 512; + private final BptBuilderBlueprint builderBlueprint; + private final Map> slotMap; + private final Set availablePairs = new HashSet(); + private final int[] buildStageOccurences; + private final boolean isCreative; + private Iterator keyIterator; + private BuilderItemMetaPair currentKey; + private List slots; + private int slotPos, slotFound; + + public BuildingSlotMapIterator(BptBuilderBlueprint builderBlueprint, TileAbstractBuilder builder) { + this.builderBlueprint = builderBlueprint; + this.slotMap = builderBlueprint.buildList; + this.buildStageOccurences = builderBlueprint.buildStageOccurences; + this.isCreative = builder == null || builder.getWorld().getWorldInfo().getGameType() == WorldSettings.GameType.CREATIVE; + + reset(); + } + + public void refresh(TileAbstractBuilder builder) { + if (!isCreative) { + availablePairs.clear(); + availablePairs.add(new BuilderItemMetaPair(null)); + + if (builder != null) { + for (int i = 0; i < builder.getSizeInventory(); i++) { + ItemStack stack = builder.getStackInSlot(i); + if (stack != null) { + availablePairs.add(new BuilderItemMetaPair(stack)); + } + } + for (Tank t : builder.getFluidTanks()) { + if (t.getFluid() != null && t.getFluid().getFluid().getBlock() != null) { + availablePairs.add(new BuilderItemMetaPair(new ItemStack(t.getFluid().getFluid().getBlock()))); + } + } + } + } + } + + public void skipKey() { + findNextKey(); + } + + private void findNextKey() { + slotPos = -1; + slotFound = 0; + slots = null; + while (keyIterator.hasNext()) { + currentKey = keyIterator.next(); + if (isCreative || availablePairs.contains(currentKey)) { + slots = slotMap.get(currentKey); + slotPos = currentKey.position - 1; + return; + } + } + this.currentKey = null; + this.keyIterator = slotMap.keySet().iterator(); + } + + public BuildingSlotBlock next() { + if (slots == null) { + findNextKey(); + } + while (slots != null) { + slotPos++; + while (slotFound < MAX_PER_ITEM && slotPos < slots.size()) { + BuildingSlotBlock b = slots.get(slotPos); + if (b != null) { + slotFound++; + currentKey.position = slotPos + 1; + return b; + } + slotPos++; + } + if (slotFound >= MAX_PER_ITEM) { + currentKey.position = slotPos; + } else if (slotPos >= slots.size()) { + currentKey.position = 0; + } + findNextKey(); + } + return null; + } + + public void remove() { + BuildingSlotBlock slot = slots.get(slotPos); + slots.set(slotPos, null); + + builderBlueprint.onRemoveBuildingSlotBlock(slot); + } + + public void reset() { + this.keyIterator = slotMap.keySet().iterator(); + this.currentKey = null; + this.slots = null; + findNextKey(); + } +} diff --git a/common/buildcraft/core/blueprints/IndexRequirementMap.java b/common/buildcraft/core/blueprints/IndexRequirementMap.java new file mode 100644 index 0000000000..3412c4ff13 --- /dev/null +++ b/common/buildcraft/core/blueprints/IndexRequirementMap.java @@ -0,0 +1,56 @@ +package buildcraft.core.blueprints; + +import java.util.Set; + +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Multimap; + +import net.minecraft.util.BlockPos; + +import buildcraft.api.blueprints.IBuilderContext; +import buildcraft.api.blueprints.SchematicBlock; +import buildcraft.core.builders.BuildingSlotBlock; +import buildcraft.core.lib.utils.Utils; + +public class IndexRequirementMap { + private final Multimap requirements = HashMultimap.create(); + private final Multimap requirementsInv = HashMultimap.create(); + + public IndexRequirementMap() { + + } + + public void add(BuildingSlotBlock b, IBuilderContext context) { + if (b.schematic instanceof SchematicBlock) { + BlockPos index = b.pos; + Set prereqs = ((SchematicBlock) b.schematic).getPrerequisiteBlocks(context); + + if (prereqs != null && prereqs.size() > 0) { + for (BlockPos i : prereqs) { + BlockPos ia = i.add(index); + + if (ia.equals(index) || !context.surroundingBox().contains(Utils.convert(ia))) { + continue; + } + requirements.put(index, ia); + requirementsInv.put(ia, index); + } + } + } + } + + public boolean contains(BlockPos index) { + return requirements.containsKey(index); + } + + public void remove(BuildingSlotBlock b) { + remove(b.pos); + } + + public void remove(BlockPos index) { + for (BlockPos reqingIndex : requirementsInv.get(index)) { + requirements.remove(reqingIndex, index); + } + requirementsInv.removeAll(index); + } +} diff --git a/common/buildcraft/core/blueprints/LibraryId.java b/common/buildcraft/core/blueprints/LibraryId.java index 4e88df8374..6047e9802b 100644 --- a/common/buildcraft/core/blueprints/LibraryId.java +++ b/common/buildcraft/core/blueprints/LibraryId.java @@ -1,5 +1,5 @@ /** 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.core.blueprints; diff --git a/common/buildcraft/core/blueprints/RequirementItemStack.java b/common/buildcraft/core/blueprints/RequirementItemStack.java new file mode 100644 index 0000000000..2f1b87c0ae --- /dev/null +++ b/common/buildcraft/core/blueprints/RequirementItemStack.java @@ -0,0 +1,19 @@ +package buildcraft.core.blueprints; + +import net.minecraft.item.ItemStack; + +public class RequirementItemStack { + public final ItemStack stack; + public final int size; + + public RequirementItemStack(ItemStack stack, int size) { + this.stack = stack; + this.size = size; + stack.stackSize = 1; + } + + @Override + public int hashCode() { + return this.stack.hashCode() * 13 + this.size; + } +} diff --git a/common/buildcraft/core/blueprints/SchematicHelper.java b/common/buildcraft/core/blueprints/SchematicHelper.java new file mode 100644 index 0000000000..a2ddbb8286 --- /dev/null +++ b/common/buildcraft/core/blueprints/SchematicHelper.java @@ -0,0 +1,19 @@ +package buildcraft.core.blueprints; + +import net.minecraft.item.ItemStack; + +import buildcraft.api.blueprints.ISchematicHelper; +import buildcraft.core.lib.inventory.StackHelper; + +public final class SchematicHelper implements ISchematicHelper { + public static final SchematicHelper INSTANCE = new SchematicHelper(); + + private SchematicHelper() { + + } + + @Override + public boolean isEqualItem(ItemStack a, ItemStack b) { + return StackHelper.isEqualItem(a, b); + } +} diff --git a/common/buildcraft/core/blueprints/SchematicRegistry.java b/common/buildcraft/core/blueprints/SchematicRegistry.java index 24379f2176..50577205df 100644 --- a/common/buildcraft/core/blueprints/SchematicRegistry.java +++ b/common/buildcraft/core/blueprints/SchematicRegistry.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.blueprints; import java.lang.reflect.Constructor; @@ -12,6 +16,7 @@ import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; + import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Property; @@ -61,6 +66,9 @@ private Constructor findConstructor() throws IllegalArgumentException { } for (Constructor c : clazz.getConstructors()) { + if (c == null) { + continue; + } Class[] typesSignature = c.getParameterTypes(); if (typesSignature.length != params.length) { // non-matching constructor count arguments, skip @@ -84,7 +92,7 @@ private Constructor findConstructor() throws IllegalArgumentException { if (!valid) { continue; } - if (c != null && params.length == 0) { + if (params.length == 0) { emptyConstructorMap.put(clazz, c); } return c; diff --git a/common/buildcraft/core/blueprints/Template.java b/common/buildcraft/core/blueprints/Template.java index 22d6c161f4..40d34a240b 100644 --- a/common/buildcraft/core/blueprints/Template.java +++ b/common/buildcraft/core/blueprints/Template.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.blueprints; import net.minecraft.item.Item; @@ -39,7 +43,7 @@ public void readFromWorld(IBuilderContext context, TileEntity anchorTile, BlockP int posZ = (int) nPos.zCoord; if (!BuildCraftAPI.isSoftBlock(anchorTile.getWorld(), pos)) { - contents[posX][posY][posZ] = new SchematicMask(true); + put(posX, posY, posZ, new SchematicMask(true)); } } @@ -55,7 +59,7 @@ public void saveContents(NBTTagCompound nbt) { for (int x = 0; x < sizeX; ++x) { for (int y = 0; y < sizeY; ++y) { for (int z = 0; z < sizeZ; ++z) { - data[ind] = (byte) ((contents[x][y][z] == null) ? 0 : 1); + data[ind] = (byte) ((get(x, y, z) == null) ? 0 : 1); ind++; } } @@ -73,7 +77,7 @@ public void loadContents(NBTTagCompound nbt) throws BptError { for (int y = 0; y < sizeY; ++y) { for (int z = 0; z < sizeZ; ++z) { if (data[ind] == 1) { - contents[x][y][z] = new SchematicMask(true); + put(x, y, z, new SchematicMask(true)); } ind++; @@ -84,7 +88,7 @@ public void loadContents(NBTTagCompound nbt) throws BptError { @Override public ItemStack getStack() { - Item item = (Item) Item.itemRegistry.getObject(new ResourceLocation("BuildCraft|Builders:templateItem")); + Item item = Item.itemRegistry.getObject(new ResourceLocation("BuildCraft|Builders:templateItem")); if (item == null) { throw new Error("Could not find the template item! Did you attempt to use this without buildcraft builders installed?"); } diff --git a/common/buildcraft/core/builders/BuilderItemMetaPair.java b/common/buildcraft/core/builders/BuilderItemMetaPair.java index 6f9f3df403..54dc203f0d 100644 --- a/common/buildcraft/core/builders/BuilderItemMetaPair.java +++ b/common/buildcraft/core/builders/BuilderItemMetaPair.java @@ -11,6 +11,7 @@ public class BuilderItemMetaPair { public Item item; public int meta; + public int position = 0; public BuilderItemMetaPair(ItemStack stack) { if (stack != null && stack.getItem() != null) { diff --git a/common/buildcraft/core/builders/BuildingItem.java b/common/buildcraft/core/builders/BuildingItem.java index 9498566a27..f8e35842b8 100755 --- a/common/buildcraft/core/builders/BuildingItem.java +++ b/common/buildcraft/core/builders/BuildingItem.java @@ -1,28 +1,33 @@ /** 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.core.builders; import java.util.Date; import java.util.LinkedList; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; +import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.BlockPos; import net.minecraft.util.MathHelper; import net.minecraft.util.Vec3; + import net.minecraftforge.common.util.Constants; +import buildcraft.BuildCraftCore; import buildcraft.api.blueprints.IBuilderContext; import buildcraft.api.blueprints.MappingNotFoundException; import buildcraft.api.blueprints.MappingRegistry; import buildcraft.api.core.ISerializable; -import buildcraft.BuildCraftCore; +import buildcraft.core.BlockDecoration; import buildcraft.core.StackAtPosition; +import buildcraft.core.lib.inventory.InvUtils; import buildcraft.core.lib.utils.NBTUtils; import buildcraft.core.lib.utils.NetworkUtils; import buildcraft.core.lib.utils.Utils; @@ -163,13 +168,19 @@ private void build() { IBlockState state = context.world().getBlockState(dest); - context.world().playAuxSFXAtEntity(null, 2001, dest, Block.getStateId(state)); - /* if (BlockUtil.isToughBlock(context.world(), destX, destY, destZ)) { BlockUtil.breakBlock(context.world(), * destX, destY, destZ, BuildCraftBuilders.fillerLifespanTough); } else { * BlockUtil.breakBlock(context.world(), destX, destY, destZ, BuildCraftBuilders.fillerLifespanNormal); } */ - slotToBuild.writeToWorld(context); + if (slotToBuild.writeToWorld(context)) { + context.world().playAuxSFXAtEntity(null, 2001, dest, Block.getStateId(state)); + } else { + for (ItemStack s : slotToBuild.stackConsumed) { + if (s != null && !(s.getItem() instanceof ItemBlock && Block.getBlockFromItem(s.getItem()) instanceof BlockDecoration)) { + InvUtils.dropItems(context.world(), s, dest); + } + } + } } } @@ -256,7 +267,7 @@ public void readFromNBT(NBTTagCompound nbt) throws MappingNotFoundException { slotToBuild.readFromNBT(nbt.getCompoundTag("slotToBuild"), registry); } - public void setStacksToDisplay(LinkedList stacks) { + public void setStacksToDisplay(List stacks) { if (stacks != null) { for (ItemStack s : stacks) { for (int i = 0; i < s.stackSize; ++i) { diff --git a/common/buildcraft/core/builders/BuildingSlot.java b/common/buildcraft/core/builders/BuildingSlot.java index 60d3ab00ac..ae4ebafa39 100755 --- a/common/buildcraft/core/builders/BuildingSlot.java +++ b/common/buildcraft/core/builders/BuildingSlot.java @@ -1,10 +1,15 @@ -/** 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 */ +/** + * 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.core.builders; import java.util.LinkedList; +import java.util.List; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -23,8 +28,8 @@ public abstract class BuildingSlot { public boolean built = false; - public void writeToWorld(IBuilderContext context) { - + public boolean writeToWorld(IBuilderContext context) { + return false; } public void writeCompleted(IBuilderContext context, double complete) { @@ -49,7 +54,7 @@ public void addStackConsumed(ItemStack stack) { stackConsumed.add(stack); } - public LinkedList getStacksToDisplay() { + public List getStacksToDisplay() { return getSchematic().getStacksToDisplay(stackConsumed); } diff --git a/common/buildcraft/core/builders/BuildingSlotBlock.java b/common/buildcraft/core/builders/BuildingSlotBlock.java index 78bf8104b6..06fcbb0d94 100755 --- a/common/buildcraft/core/builders/BuildingSlotBlock.java +++ b/common/buildcraft/core/builders/BuildingSlotBlock.java @@ -1,5 +1,5 @@ /** 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.core.builders; @@ -8,6 +8,8 @@ import java.util.LinkedList; import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; @@ -19,18 +21,10 @@ import net.minecraftforge.common.util.Constants; -import buildcraft.api.blueprints.BuildingPermission; -import buildcraft.api.blueprints.IBuilderContext; -import buildcraft.api.blueprints.MappingNotFoundException; -import buildcraft.api.blueprints.MappingRegistry; -import buildcraft.api.blueprints.SchematicBlock; -import buildcraft.api.blueprints.SchematicBlockBase; -import buildcraft.api.blueprints.SchematicFactory; -import buildcraft.api.blueprints.SchematicMask; +import buildcraft.BuildCraftBuilders; +import buildcraft.api.blueprints.*; import buildcraft.api.core.BCLog; -import buildcraft.api.core.ConfigAccessor; -import buildcraft.api.core.ConfigAccessor.EMod; -import buildcraft.core.lib.inventory.StackHelper; +import buildcraft.core.blueprints.IndexRequirementMap; import buildcraft.core.lib.utils.BlockUtils; import buildcraft.core.lib.utils.NBTUtils; @@ -39,6 +33,9 @@ public class BuildingSlotBlock extends BuildingSlot { public BlockPos pos; public SchematicBlockBase schematic; + // TODO: Remove this ugly hack + public IndexRequirementMap internalRequirementRemovalListener; + public enum Mode { ClearIfInvalid, Build @@ -58,22 +55,45 @@ public SchematicBlockBase getSchematic() { } @Override - public void writeToWorld(IBuilderContext context) { + public boolean writeToWorld(IBuilderContext context) { + if (internalRequirementRemovalListener != null) { + internalRequirementRemovalListener.remove(this); + } + if (mode == Mode.ClearIfInvalid) { if (!getSchematic().isAlreadyBuilt(context, pos)) { - if (ConfigAccessor.getBoolean(EMod.BUILDERS, "builders.dropBrokenBlocks", false)) { + if (BuildCraftBuilders.dropBrokenBlocks) { BlockUtils.breakBlock((WorldServer) context.world(), pos); } else { context.world().setBlockToAir(pos); + return true; } } } else { try { getSchematic().placeInWorld(context, pos, stackConsumed); - // This is slightly hackish, but it's a very important way to verify - // the stored requirements. + // This is also slightly hackish, but that's what you get when + // you're unable to break an API too much. + if (!getSchematic().isAlreadyBuilt(context, pos)) { + if (context.world().isAirBlock(pos)) { + return false; + } else if (!(getSchematic() instanceof SchematicBlock) || context.world().getBlockState(pos).getBlock().isAssociatedBlock( + ((SchematicBlock) getSchematic()).state.getBlock())) { + BCLog.logger.warn( + "Placed block does not match expectations! Most likely a bug in BuildCraft or a supported mod. Removed mismatched block."); + IBlockState state = context.world().getBlockState(pos); + BCLog.logger.warn("Location: " + pos + " - Block: " + Block.blockRegistry.getNameForObject(state.getBlock()) + "@" + state); + context.world().removeTileEntity(pos); + context.world().setBlockToAir(pos); + return true; + } else { + return false; + } + } + // This is slightly hackish, but it's a very important way to verify + // the stored requirements for anti-cheating purposes. if (!context.world().isAirBlock(pos) && getSchematic().getBuildingPermission() == BuildingPermission.ALL && getSchematic() instanceof SchematicBlock) { SchematicBlock sb = (SchematicBlock) getSchematic(); @@ -85,7 +105,7 @@ && getSchematic() instanceof SchematicBlock) { for (ItemStack s : sb.storedRequirements) { boolean contains = false; for (ItemStack ss : oldRequirements) { - if (StackHelper.isMatchingItem(s, ss)) { + if (getSchematic().isItemMatchingRequirement(s, ss)) { contains = true; break; } @@ -96,7 +116,7 @@ && getSchematic() instanceof SchematicBlock) { BCLog.logger.warn("Location: " + pos + " - ItemStack: " + s.toString()); context.world().removeTileEntity(pos); context.world().setBlockToAir(pos); - return; + return true; } } // Restore the stored requirements. @@ -115,11 +135,16 @@ && getSchematic() instanceof SchematicBlock) { if (e != null && e instanceof ITickable) { ((ITickable) e).update(); } + + return true; } catch (Throwable t) { t.printStackTrace(); context.world().setBlockToAir(pos); + return false; } } + + return false; } @Override @@ -202,7 +227,7 @@ public void readFromNBT(NBTTagCompound nbt, MappingRegistry registry) throws Map } @Override - public LinkedList getStacksToDisplay() { + public List getStacksToDisplay() { if (mode == Mode.ClearIfInvalid) { return stackConsumed; } else { diff --git a/common/buildcraft/core/builders/BuildingSlotEntity.java b/common/buildcraft/core/builders/BuildingSlotEntity.java index 33e0fae717..0297ab1888 100755 --- a/common/buildcraft/core/builders/BuildingSlotEntity.java +++ b/common/buildcraft/core/builders/BuildingSlotEntity.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.builders; import java.util.Collections; @@ -27,8 +31,9 @@ public class BuildingSlotEntity extends BuildingSlot { public int sequenceNumber; @Override - public void writeToWorld(IBuilderContext context) { + public boolean writeToWorld(IBuilderContext context) { schematic.writeToWorld(context); + return true; } @Override diff --git a/common/buildcraft/core/builders/BuildingSlotIterator.java b/common/buildcraft/core/builders/BuildingSlotIterator.java index f859324285..6468963d54 100755 --- a/common/buildcraft/core/builders/BuildingSlotIterator.java +++ b/common/buildcraft/core/builders/BuildingSlotIterator.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.builders; import java.util.Iterator; @@ -14,7 +18,10 @@ public class BuildingSlotIterator { private Iterator current; private int nbIterations; - /** Creates an iterator on the list, which will cycle through iterations per chunk. */ + /** + * Creates an iterator on the list, which will cycle through iterations per + * chunk. + */ public BuildingSlotIterator(LinkedList buildList) { this.buildList = buildList; } diff --git a/common/buildcraft/core/builders/BuildingSlotMapIterator.java b/common/buildcraft/core/builders/BuildingSlotMapIterator.java deleted file mode 100755 index bde3beb0fe..0000000000 --- a/common/buildcraft/core/builders/BuildingSlotMapIterator.java +++ /dev/null @@ -1,88 +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.core.builders; - -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.google.common.collect.Multiset; - -import net.minecraft.world.WorldSettings; - -public class BuildingSlotMapIterator { - private static final int MAX_PER_ITEM = 80; - private final Map> slots; - private final Set availablePairs = new HashSet(); - private final Multiset buildStageOccurences; - private final boolean isCreative; - private Iterator impIterator; - private BuilderItemMetaPair pair; - private List current; - private int position, returnsThisCurrent; - - public BuildingSlotMapIterator(Map> slots, TileAbstractBuilder builder, - Multiset buildStageOccurences) { - this.slots = slots; - this.impIterator = slots.keySet().iterator(); - this.buildStageOccurences = buildStageOccurences; - this.isCreative = builder.getWorld().getWorldInfo().getGameType() == WorldSettings.GameType.CREATIVE; - - // Generate available pairs - availablePairs.add(new BuilderItemMetaPair(null)); - for (int i = 0; i < builder.getSizeInventory(); i++) { - availablePairs.add(new BuilderItemMetaPair(builder.getStackInSlot(i))); - } - - findNewCurrent(); - } - - public void skipList() { - findNewCurrent(); - } - - private void findNewCurrent() { - position = -1; - returnsThisCurrent = 0; - while (impIterator.hasNext()) { - pair = impIterator.next(); - if (isCreative || availablePairs.contains(pair)) { - current = slots.get(pair); - return; - } - } - current = null; - } - - public BuildingSlotBlock next() { - while (current != null) { - position++; - while (returnsThisCurrent < MAX_PER_ITEM && position < current.size()) { - BuildingSlotBlock b = current.get(position); - if (b != null) { - returnsThisCurrent++; - return b; - } - position++; - } - findNewCurrent(); - } - return null; - } - - public void remove() { - buildStageOccurences.remove(current.get(position).buildStage); - current.set(position, null); - } - - public void reset() { - this.impIterator = slots.keySet().iterator(); - this.pair = null; - this.current = null; - findNewCurrent(); - } -} diff --git a/common/buildcraft/core/builders/IBuildingItem.java b/common/buildcraft/core/builders/IBuildingItem.java index 07711493ab..1d382c3e56 100755 --- a/common/buildcraft/core/builders/IBuildingItem.java +++ b/common/buildcraft/core/builders/IBuildingItem.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.builders; public interface IBuildingItem { diff --git a/common/buildcraft/core/builders/IBuildingItemsProvider.java b/common/buildcraft/core/builders/IBuildingItemsProvider.java index 1c67d4189b..c884104eca 100755 --- a/common/buildcraft/core/builders/IBuildingItemsProvider.java +++ b/common/buildcraft/core/builders/IBuildingItemsProvider.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.builders; import java.util.Collection; diff --git a/common/buildcraft/core/builders/TileAbstractBuilder.java b/common/buildcraft/core/builders/TileAbstractBuilder.java index 5c2c4e2ae4..ce705c9047 100755 --- a/common/buildcraft/core/builders/TileAbstractBuilder.java +++ b/common/buildcraft/core/builders/TileAbstractBuilder.java @@ -1,5 +1,5 @@ /** 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.core.builders; @@ -14,16 +14,18 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.nbt.NBTTagCompound; + import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fml.relauncher.Side; +import buildcraft.BuildCraftCore; import buildcraft.api.blueprints.BuilderAPI; import buildcraft.api.blueprints.ITileBuilder; -import buildcraft.BuildCraftCore; import buildcraft.core.LaserData; import buildcraft.core.internal.IBoxProvider; import buildcraft.core.lib.RFBattery; import buildcraft.core.lib.block.TileBuildCraft; +import buildcraft.core.lib.fluids.Tank; import buildcraft.core.lib.network.base.Packet; import buildcraft.core.lib.network.command.CommandWriter; import buildcraft.core.lib.network.command.ICommandReceiver; @@ -117,9 +119,9 @@ public void update() { } } - public boolean isWorking() { - return buildersInAction.size() > 0; - } + public boolean isWorking() { + return buildersInAction.size() > 0; + } @Override public Collection getBuilders() { @@ -186,4 +188,8 @@ public double getMaxRenderDistanceSquared() { public boolean drainBuild(FluidStack fluidStack, boolean realDrain) { return false; } + + public Tank[] getFluidTanks() { + return new Tank[0]; + } } diff --git a/common/buildcraft/core/builders/patterns/FillerPattern.java b/common/buildcraft/core/builders/patterns/FillerPattern.java index bd39b87664..42c2958052 100644 --- a/common/buildcraft/core/builders/patterns/FillerPattern.java +++ b/common/buildcraft/core/builders/patterns/FillerPattern.java @@ -1,5 +1,5 @@ /** 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.core.builders.patterns; @@ -12,6 +12,7 @@ import net.minecraft.util.BlockPos; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; + import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -24,11 +25,7 @@ import buildcraft.api.statements.IStatement; import buildcraft.api.statements.IStatementParameter; import buildcraft.core.Box; -import buildcraft.core.blueprints.Blueprint; -import buildcraft.core.blueprints.BlueprintBase; -import buildcraft.core.blueprints.BptBuilderTemplate; -import buildcraft.core.blueprints.SchematicRegistry; -import buildcraft.core.blueprints.Template; +import buildcraft.core.blueprints.*; import buildcraft.core.lib.utils.StringUtils; public abstract class FillerPattern implements IFillerPattern { @@ -91,7 +88,7 @@ public static void fill(int xMin, int yMin, int zMin, int xMax, int yMax, int zM for (int x = xMin; x <= xMax; ++x) { for (int z = zMin; z <= zMax; ++z) { if (isValid(x, y, z, template)) { - template.contents[x][y][z] = new SchematicMask(true); + template.put(x, y, z, new SchematicMask(true)); } } } @@ -100,13 +97,11 @@ public static void fill(int xMin, int yMin, int zMin, int xMax, int yMax, int zM /** Generates an empty in a given area */ public static void empty(int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, Template template) { - int lastX = Integer.MAX_VALUE, lastY = Integer.MAX_VALUE, lastZ = Integer.MAX_VALUE; - for (int y = yMax; y >= yMin; y--) { for (int x = xMin; x <= xMax; ++x) { for (int z = zMin; z <= zMax; ++z) { if (isValid(x, y, z, template)) { - template.contents[x][y][z] = null; + template.put(x, y, z, null); } } } @@ -115,13 +110,11 @@ public static void empty(int xMin, int yMin, int zMin, int xMax, int yMax, int z /** Generates a flatten in a given area */ public static void flatten(int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, Template template) { - int lastX = Integer.MAX_VALUE, lastY = Integer.MAX_VALUE, lastZ = Integer.MAX_VALUE; - for (int x = xMin; x <= xMax; ++x) { for (int z = zMin; z <= zMax; ++z) { for (int y = yMax; y >= yMin; --y) { if (isValid(x, y, z, template)) { - template.contents[x][y][z] = new SchematicMask(true); + template.put(x, y, z, new SchematicMask(true)); } } } @@ -139,8 +132,8 @@ public Blueprint getBlueprint(Box box, World world, IStatementParameter[] parame for (int x = 0; x < box.sizeX(); ++x) { for (int y = 0; y < box.sizeY(); ++y) { for (int z = 0; z < box.sizeZ(); ++z) { - if (tmpl.contents[x][y][z] != null) { - result.contents[x][y][z] = SchematicRegistry.INSTANCE.createSchematicBlock(state); + if (tmpl.get(x, y, z) != null) { + result.put(x, y, z, SchematicRegistry.INSTANCE.createSchematicBlock(state)); } } diff --git a/common/buildcraft/core/builders/patterns/FillerRegistry.java b/common/buildcraft/core/builders/patterns/FillerRegistry.java index 26bf4b342e..8e8e6932be 100644 --- a/common/buildcraft/core/builders/patterns/FillerRegistry.java +++ b/common/buildcraft/core/builders/patterns/FillerRegistry.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.builders.patterns; import java.util.Collection; diff --git a/common/buildcraft/core/builders/patterns/PatternBox.java b/common/buildcraft/core/builders/patterns/PatternBox.java index 06b4636e39..0810cef037 100644 --- a/common/buildcraft/core/builders/patterns/PatternBox.java +++ b/common/buildcraft/core/builders/patterns/PatternBox.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.builders.patterns; import net.minecraft.world.World; diff --git a/common/buildcraft/core/builders/patterns/PatternClear.java b/common/buildcraft/core/builders/patterns/PatternClear.java index ff1fad422b..2c636fa413 100644 --- a/common/buildcraft/core/builders/patterns/PatternClear.java +++ b/common/buildcraft/core/builders/patterns/PatternClear.java @@ -1,5 +1,5 @@ /** 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.core.builders.patterns; diff --git a/common/buildcraft/core/builders/patterns/PatternCylinder.java b/common/buildcraft/core/builders/patterns/PatternCylinder.java index 577f15baff..d9f8b7079d 100644 --- a/common/buildcraft/core/builders/patterns/PatternCylinder.java +++ b/common/buildcraft/core/builders/patterns/PatternCylinder.java @@ -1,5 +1,5 @@ /** 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.core.builders.patterns; @@ -17,9 +17,25 @@ public PatternCylinder() { super("cylinder", EnumFillerPattern.CYLINDER); } + @Override + public int maxParameters() { + return 1; + } + + @Override + public int minParameters() { + return 1; + } + + @Override + public IStatementParameter createParameter(int index) { + return new PatternParameterHollow(true); + } + @Override public Template getTemplate(Box box, World world, IStatementParameter[] parameters) { Template result = new Template(box.sizeX(), box.sizeY(), box.sizeZ()); + boolean filled = parameters.length > 0 && ((PatternParameterHollow) parameters[0]).filled; int xMin = 0; int yMin = 0; @@ -40,6 +56,7 @@ public Template getTemplate(Box box, World world, IStatementParameter[] paramete if (xRadius == 0 || zRadius == 0) { fill(xMin, yMin, zMin, xMax, yMax, zMax, result); + return result; } int dx = xRadius, dz = 0; @@ -53,7 +70,11 @@ public Template getTemplate(Box box, World world, IStatementParameter[] paramete if (twoASquare > 0) { while (stoppingX >= stoppingZ) { - fillFourColumns(xCenter, zCenter, dx, dz, xFix, zFix, yMin, yMax, result); + if (filled) { + fillSquare(xCenter, zCenter, dx, dz, xFix, zFix, yMin, yMax, result); + } else { + fillFourColumns(xCenter, zCenter, dx, dz, xFix, zFix, yMin, yMax, result); + } ++dz; stoppingZ += twoASquare; @@ -78,7 +99,11 @@ public Template getTemplate(Box box, World world, IStatementParameter[] paramete if (twoBSquare > 0) { while (stoppingX <= stoppingZ) { - fillFourColumns(xCenter, zCenter, dx, dz, xFix, zFix, yMin, yMax, result); + if (filled) { + fillSquare(xCenter, zCenter, dx, dz, xFix, zFix, yMin, yMax, result); + } else { + fillFourColumns(xCenter, zCenter, dx, dz, xFix, zFix, yMin, yMax, result); + } ++dx; stoppingX += twoBSquare; @@ -96,6 +121,35 @@ public Template getTemplate(Box box, World world, IStatementParameter[] paramete return result; } + private boolean fillSquare(int xCenter, int zCenter, int dx, int dz, int xFix, int zFix, int yMin, int yMax, Template template) { + int x1, x2, z1, z2; + + x1 = xCenter + dx + xFix; + z1 = zCenter + dz + zFix; + + x2 = xCenter - dx; + z2 = zCenter + dz + zFix; + + fill(x2, yMin, z2, x1, yMax, z1, template); + + x1 = xCenter - dx; + z1 = zCenter - dz; + + fill(x1, yMin, z1, x2, yMax, z2, template); + + x2 = xCenter + dx + xFix; + z2 = zCenter - dz; + + fill(x1, yMin, z1, x2, yMax, z2, template); + + x1 = xCenter + dx + xFix; + z1 = zCenter + dz + zFix; + + fill(x2, yMin, z2, x1, yMax, z1, template); + + return true; + } + private boolean fillFourColumns(int xCenter, int zCenter, int dx, int dz, int xFix, int zFix, int yMin, int yMax, Template template) { int x, z; diff --git a/common/buildcraft/core/builders/patterns/PatternFill.java b/common/buildcraft/core/builders/patterns/PatternFill.java index 544084b270..ec691f37e6 100644 --- a/common/buildcraft/core/builders/patterns/PatternFill.java +++ b/common/buildcraft/core/builders/patterns/PatternFill.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.builders.patterns; import net.minecraft.world.World; diff --git a/common/buildcraft/core/builders/patterns/PatternFlatten.java b/common/buildcraft/core/builders/patterns/PatternFlatten.java index 950aba52f4..ba6570e4b5 100644 --- a/common/buildcraft/core/builders/patterns/PatternFlatten.java +++ b/common/buildcraft/core/builders/patterns/PatternFlatten.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.builders.patterns; import net.minecraft.util.BlockPos; @@ -35,7 +39,7 @@ public Template getTemplate(Box box, World world, IStatementParameter[] paramete if (box.pMin().yCoord > 0) { for (int x = xMin; x <= xMax; ++x) { for (int z = zMin; z <= zMax; ++z) { - bpt.contents[x - xMin][0][z - zMin] = new SchematicMask(true); + bpt.put(x - xMin, 0, z - zMin, new SchematicMask(true)); } } } diff --git a/common/buildcraft/core/builders/patterns/PatternFrame.java b/common/buildcraft/core/builders/patterns/PatternFrame.java index cbe38c64ec..39fc5f669c 100755 --- a/common/buildcraft/core/builders/patterns/PatternFrame.java +++ b/common/buildcraft/core/builders/patterns/PatternFrame.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.builders.patterns; import net.minecraft.world.World; @@ -22,31 +26,27 @@ public PatternFrame() { public Template getTemplate(Box box, World world, IStatementParameter[] parameters) { Template template = new Template(box.sizeX(), box.sizeY(), box.sizeZ()); - int xMin = 0; - int yMin = 0; - int zMin = 0; - int xMax = box.sizeX() - 1; - int yMax = box.sizeY() - 1; int zMax = box.sizeZ() - 1; for (int it = 0; it < 2; it++) { + int y = it * (box.sizeY() - 1); for (int i = 0; i < template.sizeX; ++i) { - template.contents[i][it * (box.sizeY() - 1)][0] = new SchematicMask(true); - template.contents[i][it * (box.sizeY() - 1)][template.sizeZ - 1] = new SchematicMask(true); - } + template.put(i, y, 0, new SchematicMask(true)); + template.put(i, y, zMax, new SchematicMask(true)); + } - for (int k = 0; k < template.sizeZ; ++k) { - template.contents[0][it * (box.sizeY() - 1)][k] = new SchematicMask(true); - template.contents[template.sizeX - 1][it * (box.sizeY() - 1)][k] = new SchematicMask(true); + for (int k = 0; k < template.sizeZ; ++k) { + template.put(0, y, k, new SchematicMask(true)); + template.put(xMax, y, k, new SchematicMask(true)); } } for (int h = 1; h < box.sizeY(); ++h) { - template.contents[0][h][0] = new SchematicMask(true); - template.contents[0][h][template.sizeZ - 1] = new SchematicMask(true); - template.contents[template.sizeX - 1][h][0] = new SchematicMask(true); - template.contents[template.sizeX - 1][h][template.sizeZ - 1] = new SchematicMask(true); + template.put(0, h, 0, new SchematicMask(true)); + template.put(0, h, zMax, new SchematicMask(true)); + template.put(xMax, h, 0, new SchematicMask(true)); + template.put(xMax, h, zMax, new SchematicMask(true)); } return template; diff --git a/common/buildcraft/core/builders/patterns/PatternHorizon.java b/common/buildcraft/core/builders/patterns/PatternHorizon.java index 29625ba910..421d5217ab 100644 --- a/common/buildcraft/core/builders/patterns/PatternHorizon.java +++ b/common/buildcraft/core/builders/patterns/PatternHorizon.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.builders.patterns; import net.minecraft.util.BlockPos; @@ -35,7 +39,7 @@ public Template getTemplate(Box box, World world, IStatementParameter[] paramete if (box.sizeY() > 0) { for (int x = xMin; x <= xMax; ++x) { for (int z = zMin; z <= zMax; ++z) { - bpt.contents[x - xMin][0][z - zMin] = new SchematicMask(true); + bpt.put(x - xMin, 0, z - zMin, new SchematicMask(true)); } } } diff --git a/common/buildcraft/core/builders/patterns/PatternParameterCenter.java b/common/buildcraft/core/builders/patterns/PatternParameterCenter.java new file mode 100644 index 0000000000..3dc156b424 --- /dev/null +++ b/common/buildcraft/core/builders/patterns/PatternParameterCenter.java @@ -0,0 +1,86 @@ +package buildcraft.core.builders.patterns; + +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ResourceLocation; + +import net.minecraftforge.client.event.TextureStitchEvent; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +import buildcraft.api.statements.IStatement; +import buildcraft.api.statements.IStatementContainer; +import buildcraft.api.statements.IStatementParameter; +import buildcraft.api.statements.StatementMouseClick; +import buildcraft.core.lib.utils.StringUtils; + +public class PatternParameterCenter implements IStatementParameter { + private static final int[] shiftLeft = { 6, 3, 0, 7, 4, 1, 8, 5, 2 }; + + @SideOnly(Side.CLIENT) + private static TextureAtlasSprite[] sprites; + + private int direction; + + public static void registerSprites(TextureMap map) { + sprites = new TextureAtlasSprite[9]; + for (int i = 0; i < 9; i++) { + sprites[i] = map.registerSprite(new ResourceLocation("buildcraftcore:fillerParameters/center_" + i)); + } + } + + public PatternParameterCenter() { + super(); + } + + public PatternParameterCenter(int direction) { + this(); + this.direction = direction; + } + + @Override + public String getUniqueTag() { + return "buildcraft:fillerParameterCenter"; + } + + @Override + public TextureAtlasSprite getIcon() { + return sprites[direction % 9]; + } + + @Override + public ItemStack getItemStack() { + return null; + } + + @Override + public String getDescription() { + return StringUtils.localize("direction.center." + direction); + } + + @Override + public void onClick(IStatementContainer source, IStatement stmt, ItemStack stack, StatementMouseClick mouse) { + direction = (direction + 1) % 9; + } + + @Override + public void readFromNBT(NBTTagCompound compound) { + direction = compound.getByte("dir"); + } + + @Override + public void writeToNBT(NBTTagCompound compound) { + compound.setByte("dir", (byte) direction); + } + + @Override + public IStatementParameter rotateLeft() { + return new PatternParameterCenter(shiftLeft[direction % 9]); + } + + public int getDirection() { + return direction; + } +} diff --git a/common/buildcraft/core/builders/patterns/PatternParameterHollow.java b/common/buildcraft/core/builders/patterns/PatternParameterHollow.java new file mode 100644 index 0000000000..07341419f9 --- /dev/null +++ b/common/buildcraft/core/builders/patterns/PatternParameterHollow.java @@ -0,0 +1,78 @@ +package buildcraft.core.builders.patterns; + +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ResourceLocation; + +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +import buildcraft.api.statements.IStatement; +import buildcraft.api.statements.IStatementContainer; +import buildcraft.api.statements.IStatementParameter; +import buildcraft.api.statements.StatementMouseClick; +import buildcraft.core.lib.utils.StringUtils; + +public class PatternParameterHollow implements IStatementParameter { + @SideOnly(Side.CLIENT) + private static TextureAtlasSprite iconHollow, iconFilled; + + public boolean filled = false; + + public PatternParameterHollow() { + super(); + } + + public PatternParameterHollow(boolean hollow) { + this(); + this.filled = !hollow; + } + + @SideOnly(Side.CLIENT) + public static void registerSprites(TextureMap map ) { + iconFilled = map.registerSprite(new ResourceLocation("buildcraftcore:fillerParameters/filled")); + iconHollow = map.registerSprite(new ResourceLocation("buildcraftcore:fillerParameters/hollow")); + } + + @Override + public String getUniqueTag() { + return "buildcraft:fillerParameterHollow"; + } + + @Override + public TextureAtlasSprite getIcon() { + return filled ? iconFilled : iconHollow; + } + + @Override + public ItemStack getItemStack() { + return null; + } + + @Override + public String getDescription() { + return StringUtils.localize("fillerpattern.parameter." + (filled ? "filled" : "hollow")); + } + + @Override + public void onClick(IStatementContainer source, IStatement stmt, ItemStack stack, StatementMouseClick mouse) { + filled = !filled; + } + + @Override + public void readFromNBT(NBTTagCompound compound) { + filled = compound.getBoolean("filled"); + } + + @Override + public void writeToNBT(NBTTagCompound compound) { + compound.setBoolean("filled", filled); + } + + @Override + public IStatementParameter rotateLeft() { + return this; + } +} diff --git a/common/buildcraft/core/builders/patterns/PatternParameterXZDir.java b/common/buildcraft/core/builders/patterns/PatternParameterXZDir.java new file mode 100644 index 0000000000..c3ded962e3 --- /dev/null +++ b/common/buildcraft/core/builders/patterns/PatternParameterXZDir.java @@ -0,0 +1,88 @@ +package buildcraft.core.builders.patterns; + +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ResourceLocation; + +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +import buildcraft.api.statements.IStatement; +import buildcraft.api.statements.IStatementContainer; +import buildcraft.api.statements.IStatementParameter; +import buildcraft.api.statements.StatementMouseClick; +import buildcraft.core.lib.utils.StringUtils; + +public class PatternParameterXZDir implements IStatementParameter { + private static final String[] names = { "west", "east", "north", "south" }; + private static final int[] shiftLeft = { 3, 2, 0, 1 }; + private static final int[] shiftRight = { 2, 3, 1, 0 }; + + @SideOnly(Side.CLIENT) + private static TextureAtlasSprite[] sprites; + private int direction; + + @SideOnly(Side.CLIENT) + public static void registerSprites(TextureMap map) { + sprites = new TextureAtlasSprite[4]; + sprites[0] = map.registerSprite(new ResourceLocation("buildcraftcore:fillerParameters/arrow_left")); + sprites[1] = map.registerSprite(new ResourceLocation("buildcraftcore:fillerParameters/arrow_right")); + sprites[2] = map.registerSprite(new ResourceLocation("buildcraftcore:fillerParameters/arrow_up")); + sprites[3] = map.registerSprite(new ResourceLocation("buildcraftcore:fillerParameters/arrow_down")); + } + + public PatternParameterXZDir() { + super(); + } + + public PatternParameterXZDir(int direction) { + this(); + this.direction = direction; + } + + @Override + public String getUniqueTag() { + return "buildcraft:fillerParameterXZDir"; + } + + @Override + public TextureAtlasSprite getIcon() { + return sprites[direction & 3]; + } + + @Override + public ItemStack getItemStack() { + return null; + } + + @Override + public String getDescription() { + return StringUtils.localize("direction." + names[direction & 3]); + } + + @Override + public void onClick(IStatementContainer source, IStatement stmt, ItemStack stack, StatementMouseClick mouse) { + direction = shiftRight[direction & 3]; + } + + @Override + public void readFromNBT(NBTTagCompound compound) { + direction = compound.getByte("dir"); + } + + @Override + public void writeToNBT(NBTTagCompound compound) { + compound.setByte("dir", (byte) direction); + } + + @Override + public IStatementParameter rotateLeft() { + return new PatternParameterXZDir(shiftLeft[direction & 3]); + } + + public int getDirection() { + return direction; + } +} diff --git a/common/buildcraft/core/builders/patterns/PatternParameterYDir.java b/common/buildcraft/core/builders/patterns/PatternParameterYDir.java index 96059b69a3..d2de184260 100644 --- a/common/buildcraft/core/builders/patterns/PatternParameterYDir.java +++ b/common/buildcraft/core/builders/patterns/PatternParameterYDir.java @@ -1,8 +1,13 @@ package buildcraft.core.builders.patterns; import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ResourceLocation; + +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; import buildcraft.api.statements.IStatement; import buildcraft.api.statements.IStatementContainer; @@ -11,6 +16,8 @@ import buildcraft.core.lib.utils.StringUtils; public class PatternParameterYDir implements IStatementParameter { + private static TextureAtlasSprite spriteUp, spriteDown; + public boolean up = false; public PatternParameterYDir() { @@ -22,6 +29,12 @@ public PatternParameterYDir(boolean up) { this.up = up; } + @SideOnly(Side.CLIENT) + public static void registerSprites(TextureMap map) { + spriteUp = map.registerSprite(new ResourceLocation("buildcraftcore:fillerParameters/stairs_ascend")); + spriteDown = map.registerSprite(new ResourceLocation("buildcraftcore:fillerParameters/stairs_descend")); + } + @Override public String getUniqueTag() { return "buildcraft:fillerParameterYDir"; @@ -54,12 +67,11 @@ public void writeToNBT(NBTTagCompound compound) { @Override public IStatementParameter rotateLeft() { - return null; + return this; } @Override public TextureAtlasSprite getIcon() { - // return Minecraft.getMinecraft().getTextureManager().getTexture(new ResourceLocation("TODO")); - return null; + return up ? spriteUp : spriteDown; } } diff --git a/common/buildcraft/core/builders/patterns/PatternPyramid.java b/common/buildcraft/core/builders/patterns/PatternPyramid.java index cc24575d9d..a643db5fb7 100644 --- a/common/buildcraft/core/builders/patterns/PatternPyramid.java +++ b/common/buildcraft/core/builders/patterns/PatternPyramid.java @@ -1,5 +1,5 @@ /** 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.core.builders.patterns; @@ -13,23 +13,25 @@ import buildcraft.core.blueprints.Template; public class PatternPyramid extends FillerPattern { + private static final int[] MODIFIERS = { 0x0101, 0x1101, 0x1001, 0x0111, 0x1111, 0x1011, 0x0110, 0x1110, 0x1010 }; + public PatternPyramid() { super("pyramid", EnumFillerPattern.PYRAMID); } @Override public int maxParameters() { - return 1; + return 2; } @Override public int minParameters() { - return 1; + return 2; } @Override public IStatementParameter createParameter(int index) { - return new PatternParameterYDir(true); + return index == 1 ? new PatternParameterCenter(4) : new PatternParameterYDir(true); } @Override @@ -44,34 +46,53 @@ public Template getTemplate(Box box, World world, IStatementParameter[] paramete Template bpt = new Template(xMax - xMin + 1, yMax - yMin + 1, zMax - zMin + 1); - int xSize = xMax - xMin + 1; - int zSize = zMax - zMin + 1; - - int step = 0; + int[] modifiers = new int[4]; int height; int stepY; - if (parameters[0] != null && !(((PatternParameterYDir) parameters[0]).up)) { + if (parameters.length >= 1 && parameters[0] != null && !(((PatternParameterYDir) parameters[0]).up)) { stepY = -1; } else { stepY = 1; } + int center = 4; + if (parameters.length >= 2 && parameters[1] != null) { + center = ((PatternParameterCenter) parameters[1]).getDirection(); + } + + modifiers[0] = (MODIFIERS[center] >> 12) & 1; + modifiers[1] = (MODIFIERS[center] >> 8) & 1; + modifiers[2] = (MODIFIERS[center] >> 4) & 1; + modifiers[3] = (MODIFIERS[center]) & 1; + if (stepY == 1) { height = yMin; } else { height = yMax; } - while (step <= xSize / 2 && step <= zSize / 2 && height >= yMin && height <= yMax) { - for (int x = xMin + step; x <= xMax - step; ++x) { - for (int z = zMin + step; z <= zMax - step; ++z) { - bpt.contents[x - xMin][height - yMin][z - zMin] = new SchematicMask(true); + int x1 = xMin; + int x2 = xMax; + int z1 = zMin; + int z2 = zMax; + + while (height >= yMin && height <= yMax) { + for (int x = x1; x <= x2; ++x) { + for (int z = z1; z <= z2; ++z) { + bpt.put(x - xMin, height - yMin, z - zMin, new SchematicMask(true)); } } - step++; + x1 += modifiers[0]; + x2 -= modifiers[1]; + z1 += modifiers[2]; + z2 -= modifiers[3]; height += stepY; + + if (x1 > x2 || z1 > z2) { + break; + } } return bpt; diff --git a/common/buildcraft/core/builders/patterns/PatternStairs.java b/common/buildcraft/core/builders/patterns/PatternStairs.java index cdd331333e..f61c045a9a 100644 --- a/common/buildcraft/core/builders/patterns/PatternStairs.java +++ b/common/buildcraft/core/builders/patterns/PatternStairs.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.builders.patterns; import net.minecraft.world.World; @@ -13,28 +17,23 @@ public class PatternStairs extends FillerPattern { - // TODO: These parameters need to be settable from the filler - private int param2 = 0; - private int param3 = 0; - private int param4 = 0; - public PatternStairs() { super("stairs", EnumFillerPattern.STAIRS); } @Override public int maxParameters() { - return 1; + return 2; } @Override public int minParameters() { - return 1; + return 2; } @Override public IStatementParameter createParameter(int index) { - return new PatternParameterYDir(true); + return index == 1 ? new PatternParameterXZDir(0) : new PatternParameterYDir(true); } @Override @@ -52,25 +51,22 @@ public Template getTemplate(Box box, World world, IStatementParameter[] paramete Template template = new Template(box.sizeX(), box.sizeY(), box.sizeZ()); - int height; - int heightStep; - int dimX = 0; - int dimZ = 0; + int height, heightStep; - if (parameters[0] != null && !(((PatternParameterYDir) parameters[0]).up)) { - height = yMin; + if (parameters.length >= 1 && parameters[0] != null && !(((PatternParameterYDir) parameters[0]).up)) { + height = Math.max(yMin, yMax - Math.max(xMax, zMax)); heightStep = 1; } else { - height = yMax; + height = Math.min(yMax, Math.max(xMax, zMax)); heightStep = -1; } - int kind = 0; - - int[] steps = new int[] { 0, 0, 0, 0 }; + int param2 = 0; + if (parameters.length >= 2 && parameters[1] != null) { + param2 = ((PatternParameterXZDir) parameters[1]).getDirection(); + } - int x = 0, z = 0; - int stepDiagX = 0, stepDiagZ = 0; + int[] steps = new int[]{0, 0, 0, 0}; if (param2 == 0) { steps[0] = 1; @@ -80,49 +76,10 @@ public Template getTemplate(Box box, World world, IStatementParameter[] paramete steps[2] = 1; } else if (param2 == 3) { steps[3] = 1; - } else { - kind = 1; - - if (param3 == 0) { - x = xMin; - } else if (param3 == 1) { - x = xMax; - } else if (param3 == 2) { - // no change - } - - if (param4 == 0) { - z = zMin; - } else if (param4 == 1) { - z = zMax; - } else if (param4 == 2) { - // no change } - if (heightStep == 1) { - stepDiagX = -1; - dimX = sizeX - 1; - - stepDiagZ = -1; - dimZ = sizeZ - 1; - } else { - stepDiagX = 1; - dimX = 0; - - stepDiagZ = 1; - dimZ = 0; - } - } - - int x1 = 0, x2 = 0, z1 = 0, z2 = 0; + int x1 = xMin, x2 = xMax, z1 = zMin, z2 = zMax; - x1 = xMin; - x2 = xMax; - - z1 = zMin; - z2 = zMax; - - if (heightStep == -1) { if (steps[0] == 1) { x1 = xMax - sizeX + 1; x2 = x1; @@ -142,72 +99,17 @@ public Template getTemplate(Box box, World world, IStatementParameter[] paramete z2 = zMin + sizeZ - 1; z1 = z2; } - } - if (kind == 0) { while (x2 - x1 + 1 > 0 && z2 - z1 + 1 > 0 && x2 - x1 < sizeX && z2 - z1 < sizeZ && height >= yMin && height <= yMax) { fill(x1, height, z1, x2, height, z2, template); - if (heightStep == 1) { - x1 += steps[0]; - x2 -= steps[1]; - z1 += steps[2]; - z2 -= steps[3]; - } else { x2 += steps[0]; x1 -= steps[1]; z2 += steps[2]; z1 -= steps[3]; - } - - height += heightStep; - } - } else if (kind == 1) { - while (dimX >= 0 && dimX < sizeX && dimZ >= 0 && dimZ < sizeZ && height >= yMin && height <= yMax) { - - if (heightStep == 1) { - if (param3 == 1) { - x1 = x - sizeX + 1; - x2 = x1 + dimX; - } else { - x2 = x + sizeX - 1; - x1 = x2 - dimX; - } - - if (param4 == 1) { - z1 = z - sizeZ + 1; - z2 = z1 + dimZ; - } else { - z2 = z + sizeZ - 1; - z1 = z2 - dimZ; - } - } else if (heightStep == -1) { - if (param3 == 0) { - x1 = x; - x2 = x1 + dimX; - } else { - x2 = x; - x1 = x2 - dimX; - } - - if (param3 == 1) { - z1 = z; - z2 = z1 + dimZ; - } else { - z2 = z; - z1 = z2 - dimZ; - } - - } - - fill(x1, height, z1, x2, height, z2, template); - - dimX += stepDiagX; - dimZ += stepDiagZ; height += heightStep; } - } return template; } diff --git a/common/buildcraft/core/builders/schematics/SchematicBlockCreative.java b/common/buildcraft/core/builders/schematics/SchematicBlockCreative.java index e39ff57e55..a1d0fec003 100755 --- a/common/buildcraft/core/builders/schematics/SchematicBlockCreative.java +++ b/common/buildcraft/core/builders/schematics/SchematicBlockCreative.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.builders.schematics; import buildcraft.api.blueprints.BuildingPermission; diff --git a/common/buildcraft/core/builders/schematics/SchematicBlockFloored.java b/common/buildcraft/core/builders/schematics/SchematicBlockFloored.java new file mode 100644 index 0000000000..669a268aee --- /dev/null +++ b/common/buildcraft/core/builders/schematics/SchematicBlockFloored.java @@ -0,0 +1,17 @@ +package buildcraft.core.builders.schematics; + +import java.util.Set; + +import com.google.common.collect.Sets; + +import net.minecraft.util.BlockPos; + +import buildcraft.api.blueprints.IBuilderContext; +import buildcraft.api.blueprints.SchematicBlock; + +public class SchematicBlockFloored extends SchematicBlock { + @Override + public Set getPrerequisiteBlocks(IBuilderContext context) { + return Sets.newHashSet(new BlockPos(0, -1, 0)); + } +} diff --git a/common/buildcraft/core/builders/schematics/SchematicFree.java b/common/buildcraft/core/builders/schematics/SchematicFree.java index 2797c5032f..e01434a1c3 100644 --- a/common/buildcraft/core/builders/schematics/SchematicFree.java +++ b/common/buildcraft/core/builders/schematics/SchematicFree.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.builders.schematics; import java.util.LinkedList; @@ -22,4 +26,12 @@ public void getRequirementsForPlacement(IBuilderContext context, LinkedList getStacksToDisplay( + LinkedList stackConsumed) { + LinkedList displayStacks = new LinkedList(); + displayStacks.add(new ItemStack(state.getBlock(), 1, state.getBlock().getMetaFromState(state))); + return displayStacks; + } } diff --git a/common/buildcraft/core/builders/schematics/SchematicIgnore.java b/common/buildcraft/core/builders/schematics/SchematicIgnore.java index db498746af..4e262e19a9 100644 --- a/common/buildcraft/core/builders/schematics/SchematicIgnore.java +++ b/common/buildcraft/core/builders/schematics/SchematicIgnore.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.builders.schematics; import java.util.LinkedList; diff --git a/common/buildcraft/core/builders/schematics/SchematicIgnoreMeta.java b/common/buildcraft/core/builders/schematics/SchematicIgnoreMeta.java index 7515957b68..2d0c0571e5 100644 --- a/common/buildcraft/core/builders/schematics/SchematicIgnoreMeta.java +++ b/common/buildcraft/core/builders/schematics/SchematicIgnoreMeta.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.builders.schematics; import java.util.LinkedList; diff --git a/common/buildcraft/core/builders/schematics/SchematicRotateMeta.java b/common/buildcraft/core/builders/schematics/SchematicRotateMeta.java new file mode 100644 index 0000000000..e8193b8013 --- /dev/null +++ b/common/buildcraft/core/builders/schematics/SchematicRotateMeta.java @@ -0,0 +1,79 @@ +/** + * 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.core.builders.schematics; + +import net.minecraft.util.BlockPos; + +import buildcraft.api.blueprints.IBuilderContext; +import buildcraft.api.blueprints.SchematicTile; + +/** + * Use EnumFacing properties instead + */ +@Deprecated +public class SchematicRotateMeta extends SchematicTile { + + int[] rot; + boolean rotateForward; + + int infoMask = 0; + + public SchematicRotateMeta(int[] rotations, boolean rotateForward) { + rot = rotations; + + for (int element : rot) { + if (element < 4) { + infoMask = infoMask < 3 ? 3 : infoMask; + } else if (element < 8) { + infoMask = infoMask < 7 ? 7 : infoMask; + } else if (element < 16) { + infoMask = infoMask < 15 ? 15 : infoMask; + } + } + + this.rotateForward = rotateForward; + throw new IllegalStateException("DEPRECATED DUMBASS"); + } + + @Override + public boolean isAlreadyBuilt(IBuilderContext context, BlockPos pos) { + return state == context.world().getBlockState(pos); + } + + @Override + public void rotateLeft(IBuilderContext context) { +// int pos = meta & infoMask; +// int others = meta - pos; +// +// if (rotateForward) { +// if (pos == rot[0]) { +// pos = rot[1]; +// } else if (pos == rot[1]) { +// pos = rot[2]; +// } else if (pos == rot[2]) { +// pos = rot[3]; +// } else if (pos == rot[3]) { +// pos = rot[0]; +// } +// } else { +// if (pos == rot[0]) { +// pos = rot[3]; +// } else if (pos == rot[1]) { +// pos = rot[2]; +// } else if (pos == rot[2]) { +// pos = rot[0]; +// } else if (pos == rot[3]) { +// pos = rot[1]; +// } +// } +// +// meta = pos + others; + } + +} diff --git a/common/buildcraft/core/builders/schematics/SchematicTileCreative.java b/common/buildcraft/core/builders/schematics/SchematicTileCreative.java index 78e28ed3dc..4dcfc39284 100755 --- a/common/buildcraft/core/builders/schematics/SchematicTileCreative.java +++ b/common/buildcraft/core/builders/schematics/SchematicTileCreative.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.builders.schematics; import buildcraft.api.blueprints.BuildingPermission; diff --git a/common/buildcraft/core/builders/schematics/SchematicWallSide.java b/common/buildcraft/core/builders/schematics/SchematicWallSide.java new file mode 100644 index 0000000000..3999ee4ec3 --- /dev/null +++ b/common/buildcraft/core/builders/schematics/SchematicWallSide.java @@ -0,0 +1,24 @@ +/** 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.core.builders.schematics; + +import java.util.Set; + +import com.google.common.collect.ImmutableSet; + +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; + +import buildcraft.api.blueprints.IBuilderContext; +import buildcraft.api.blueprints.SchematicBlock; + +// A block that is placed on a wall, and requires said wall +public class SchematicWallSide extends SchematicBlock { + @Override + public Set getPrerequisiteBlocks(IBuilderContext context) { + EnumFacing face = state.getValue(getFacingProp()); + return ImmutableSet.of(new BlockPos(0, 0, 0).offset(face)); + } +} diff --git a/common/buildcraft/core/command/SubCommandDeop.java b/common/buildcraft/core/command/SubCommandDeop.java new file mode 100644 index 0000000000..51261ba14c --- /dev/null +++ b/common/buildcraft/core/command/SubCommandDeop.java @@ -0,0 +1,21 @@ +package buildcraft.core.command; + +import net.minecraft.command.ICommandSender; +import net.minecraft.server.MinecraftServer; + +import buildcraft.BuildCraftCore; +import buildcraft.core.lib.commands.CommandHelpers; +import buildcraft.core.lib.commands.SubCommand; + +public class SubCommandDeop extends SubCommand { + public SubCommandDeop() { + super("deop"); + setPermLevel(PermLevel.SERVER_ADMIN); + } + + @Override + public void processSubCommand(ICommandSender sender, String[] args) { + MinecraftServer.getServer().getConfigurationManager().removeOp(BuildCraftCore.gameProfile); + CommandHelpers.sendLocalizedChatMessage(sender, "commands.deop.success", "[BuildCraft]"); + } +} diff --git a/common/buildcraft/core/command/SubCommandOp.java b/common/buildcraft/core/command/SubCommandOp.java new file mode 100644 index 0000000000..221e8146b4 --- /dev/null +++ b/common/buildcraft/core/command/SubCommandOp.java @@ -0,0 +1,21 @@ +package buildcraft.core.command; + +import net.minecraft.command.ICommandSender; +import net.minecraft.server.MinecraftServer; + +import buildcraft.BuildCraftCore; +import buildcraft.core.lib.commands.CommandHelpers; +import buildcraft.core.lib.commands.SubCommand; + +public class SubCommandOp extends SubCommand { + public SubCommandOp() { + super("op"); + setPermLevel(PermLevel.SERVER_ADMIN); + } + + @Override + public void processSubCommand(ICommandSender sender, String[] args) { + MinecraftServer.getServer().getConfigurationManager().addOp(BuildCraftCore.gameProfile); + CommandHelpers.sendLocalizedChatMessage(sender, "commands.op.success", "[BuildCraft]"); + } +} diff --git a/common/buildcraft/core/config/BCConfigElement.java b/common/buildcraft/core/config/BCConfigElement.java index ae30be6ce0..2cf9b8aa49 100644 --- a/common/buildcraft/core/config/BCConfigElement.java +++ b/common/buildcraft/core/config/BCConfigElement.java @@ -37,7 +37,7 @@ public List getChildElements() { continue; } - ConfigElement temp = new BCConfigElement(child); + ConfigElement temp = new BCConfigElement(child); if (temp.showInGui()) { elements.add(temp); } diff --git a/common/buildcraft/core/config/ConfigManager.java b/common/buildcraft/core/config/ConfigManager.java index 4f23a7147e..66b84fc7cd 100644 --- a/common/buildcraft/core/config/ConfigManager.java +++ b/common/buildcraft/core/config/ConfigManager.java @@ -25,7 +25,7 @@ public GuiConfigManager(GuiScreen parentScreen) { for (String s : config.getCategoryNames()) { if (!s.contains(".")) { - configElements.add(new BCConfigElement(config.getCategory(s))); + configElements.add(new BCConfigElement(config.getCategory(s))); } } } @@ -62,12 +62,12 @@ public Property get(String catName, String propName) { } private Property create(String s, Object o) { - Property p = null; + Property p; if (o instanceof Integer) { p = new Property(s, o.toString(), Property.Type.INTEGER); } else if (o instanceof String) { p = new Property(s, (String) o, Property.Type.STRING); - } else if (o instanceof Double) { + } else if (o instanceof Double || o instanceof Float) { p = new Property(s, o.toString(), Property.Type.DOUBLE); } else if (o instanceof Float) { p = new Property(s, o.toString(), Property.Type.DOUBLE); diff --git a/common/buildcraft/core/crops/CropHandlerPlantable.java b/common/buildcraft/core/crops/CropHandlerPlantable.java index 6ecd4f6a12..8ed19e8400 100644 --- a/common/buildcraft/core/crops/CropHandlerPlantable.java +++ b/common/buildcraft/core/crops/CropHandlerPlantable.java @@ -2,13 +2,7 @@ import java.util.List; -import net.minecraft.block.Block; -import net.minecraft.block.BlockCrops; -import net.minecraft.block.BlockDoublePlant; -import net.minecraft.block.BlockFlower; -import net.minecraft.block.BlockMelon; -import net.minecraft.block.BlockMushroom; -import net.minecraft.block.BlockTallGrass; +import net.minecraft.block.*; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -19,6 +13,7 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraft.world.WorldServer; + import net.minecraftforge.common.IPlantable; import buildcraft.api.crops.ICropHandler; diff --git a/common/buildcraft/core/crops/CropHandlerReeds.java b/common/buildcraft/core/crops/CropHandlerReeds.java index c605c25d9b..4a325b587d 100644 --- a/common/buildcraft/core/crops/CropHandlerReeds.java +++ b/common/buildcraft/core/crops/CropHandlerReeds.java @@ -2,14 +2,19 @@ import java.util.List; +import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraftforge.common.IPlantable; + import buildcraft.api.crops.CropManager; import buildcraft.api.crops.ICropHandler; @@ -22,7 +27,8 @@ public boolean isSeed(ItemStack stack) { @Override public boolean canSustainPlant(World world, ItemStack seed, BlockPos pos) { - return CropManager.getDefaultHandler().canSustainPlant(world, seed, pos); + Block block = world.getBlockState(pos).getBlock(); + return block.canSustainPlant(world, pos, EnumFacing.UP, (IPlantable) Blocks.reeds) && block != Blocks.reeds && world.isAirBlock(pos.up()); } @Override diff --git a/common/buildcraft/core/internal/IBoxProvider.java b/common/buildcraft/core/internal/IBoxProvider.java index 3ef8566e89..b813ce2b54 100755 --- a/common/buildcraft/core/internal/IBoxProvider.java +++ b/common/buildcraft/core/internal/IBoxProvider.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.internal; import buildcraft.core.Box; diff --git a/common/buildcraft/core/internal/IBoxesProvider.java b/common/buildcraft/core/internal/IBoxesProvider.java index d7c62b3b47..aaa338812f 100755 --- a/common/buildcraft/core/internal/IBoxesProvider.java +++ b/common/buildcraft/core/internal/IBoxesProvider.java @@ -1,13 +1,13 @@ /** 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.core.internal; -import java.util.ArrayList; +import java.util.List; import buildcraft.core.Box; public interface IBoxesProvider { - ArrayList getBoxes(); + List getBoxes(); } diff --git a/common/buildcraft/core/internal/ICustomLEDBlock.java b/common/buildcraft/core/internal/ICustomLEDBlock.java new file mode 100644 index 0000000000..26f7afbd5e --- /dev/null +++ b/common/buildcraft/core/internal/ICustomLEDBlock.java @@ -0,0 +1,5 @@ +package buildcraft.core.internal; + +public interface ICustomLEDBlock { + String[] getLEDSuffixes(); +} diff --git a/common/buildcraft/core/internal/IDropControlInventory.java b/common/buildcraft/core/internal/IDropControlInventory.java index 6dd11a5009..8d8457268f 100644 --- a/common/buildcraft/core/internal/IDropControlInventory.java +++ b/common/buildcraft/core/internal/IDropControlInventory.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.internal; public interface IDropControlInventory { diff --git a/common/buildcraft/core/internal/IFramePipeConnection.java b/common/buildcraft/core/internal/IFramePipeConnection.java new file mode 100644 index 0000000000..67159cc8ed --- /dev/null +++ b/common/buildcraft/core/internal/IFramePipeConnection.java @@ -0,0 +1,15 @@ +/** + * 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.core.internal; + +import net.minecraft.world.IBlockAccess; + +public interface IFramePipeConnection { + boolean isPipeConnected(IBlockAccess blockAccess, int x1, int y1, int z1, int x2, int y2, int z2); +} diff --git a/common/buildcraft/core/lib/AchievementManager.java b/common/buildcraft/core/lib/AchievementManager.java index 4f3796df14..280ced3931 100644 --- a/common/buildcraft/core/lib/AchievementManager.java +++ b/common/buildcraft/core/lib/AchievementManager.java @@ -2,8 +2,9 @@ import net.minecraft.item.Item; import net.minecraft.stats.Achievement; + import net.minecraftforge.common.AchievementPage; -import net.minecraftforge.fml.common.FMLCommonHandler; +import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.PlayerEvent; @@ -14,7 +15,7 @@ public AchievementManager(String name) { page = new AchievementPage(name); AchievementPage.registerAchievementPage(page); - FMLCommonHandler.instance().bus().register(this); + MinecraftForge.EVENT_BUS.register(this); } public Achievement registerAchievement(Achievement a) { diff --git a/common/buildcraft/core/lib/ITileBufferHolder.java b/common/buildcraft/core/lib/ITileBufferHolder.java index 87927e09a7..afe885e89b 100644 --- a/common/buildcraft/core/lib/ITileBufferHolder.java +++ b/common/buildcraft/core/lib/ITileBufferHolder.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib; import net.minecraft.block.Block; @@ -9,7 +13,6 @@ import net.minecraft.util.EnumFacing; public interface ITileBufferHolder { - void blockRemoved(EnumFacing from); void blockCreated(EnumFacing from, Block block, TileEntity tile); @@ -17,5 +20,4 @@ public interface ITileBufferHolder { Block getBlock(EnumFacing to); TileEntity getTile(EnumFacing to); - } diff --git a/common/buildcraft/core/lib/TileBuffer.java b/common/buildcraft/core/lib/TileBuffer.java index 52f793253f..0db3ce65a5 100644 --- a/common/buildcraft/core/lib/TileBuffer.java +++ b/common/buildcraft/core/lib/TileBuffer.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib; import net.minecraft.block.state.IBlockState; diff --git a/common/buildcraft/core/lib/block/BlockBuildCraft.java b/common/buildcraft/core/lib/block/BlockBuildCraft.java index 28486cf1c3..9aa72c7f83 100644 --- a/common/buildcraft/core/lib/block/BlockBuildCraft.java +++ b/common/buildcraft/core/lib/block/BlockBuildCraft.java @@ -1,5 +1,5 @@ /** 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.core.lib.block; @@ -9,19 +9,25 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; + +import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.FMLCommonHandler; +import buildcraft.api.core.IInvSlot; import buildcraft.api.events.BlockInteractionEvent; import buildcraft.api.events.BlockPlacedDownEvent; import buildcraft.api.properties.BuildCraftProperty; import buildcraft.api.tiles.IHasWork; import buildcraft.core.BCCreativeTab; +import buildcraft.core.lib.inventory.InventoryIterator; import buildcraft.core.lib.utils.Utils; import buildcraft.core.lib.utils.XorShift128Random; @@ -76,7 +82,7 @@ public IBlockState getActualState(IBlockState state, IBlockAccess access, BlockP @Override public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase entity, ItemStack stack) { super.onBlockPlacedBy(world, pos, state, entity, stack); - FMLCommonHandler.instance().bus().post(new BlockPlacedDownEvent((EntityPlayer) entity, pos, state)); + MinecraftForge.EVENT_BUS.post(new BlockPlacedDownEvent((EntityPlayer) entity, pos, state)); TileEntity tile = world.getTileEntity(pos); if (tile instanceof TileBuildCraft) { @@ -88,7 +94,7 @@ public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, Entity public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) { BlockInteractionEvent event = new BlockInteractionEvent(player, state); - FMLCommonHandler.instance().bus().post(event); + MinecraftForge.EVENT_BUS.post(event); if (event.isCanceled()) { return true; } @@ -111,4 +117,36 @@ public int getLightValue(IBlockAccess world, BlockPos pos) { return super.getLightValue(world, pos); } } + + @Override + public boolean hasComparatorInputOverride() { + return this instanceof IComparatorInventory; + } + + @Override + public int getComparatorInputOverride(World world, BlockPos pos) { + TileEntity tile = world.getTileEntity(pos); + if (tile instanceof IInventory) { + int count = 0; + int countNonEmpty = 0; + float power = 0.0F; + for (EnumFacing face : EnumFacing.values()) { + for (IInvSlot slot : InventoryIterator.getIterable((IInventory) tile, face)) { + if (((IComparatorInventory) this).doesSlotCountComparator(tile, slot.getIndex(), slot.getStackInSlot())) { + count++; + if (slot.getStackInSlot() != null) { + countNonEmpty++; + power += (float) slot.getStackInSlot().stackSize / (float) Math.min(((IInventory) tile).getInventoryStackLimit(), slot + .getStackInSlot().getMaxStackSize()); + } + } + } + } + + power /= count; + return MathHelper.floor_float(power * 14.0F) + (countNonEmpty > 0 ? 1 : 0); + } + + return 0; + } } diff --git a/common/buildcraft/core/lib/block/BlockBuildCraftBase.java b/common/buildcraft/core/lib/block/BlockBuildCraftBase.java index 9db8b24c52..50a5bd069f 100644 --- a/common/buildcraft/core/lib/block/BlockBuildCraftBase.java +++ b/common/buildcraft/core/lib/block/BlockBuildCraftBase.java @@ -1,6 +1,5 @@ package buildcraft.core.lib.block; -import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Map; @@ -151,7 +150,7 @@ protected BlockBuildCraftBase(Material material, BCCreativeTab bcCreativeTab, bo boolean canRotate = false; boolean canSixRotate = false; - for (BuildCraftProperty prop : properties) { + for (BuildCraftProperty prop : properties) { if (prop == null) { continue; } @@ -168,14 +167,14 @@ protected BlockBuildCraftBase(Material material, BCCreativeTab bcCreativeTab, bo canSixRotate = true; } - Collection allowedValues = prop.getAllowedValues(); - defaultState = defaultState.withProperty(prop, (Comparable) allowedValues.iterator().next()); + List allowedValues = prop.getAllowedValues(); + defaultState = defaultState.withProperty(prop, allowedValues.iterator().next()); Map newValidStates = Maps.newHashMap(); int mul = metas.contains(prop) ? allowedValues.size() : 1; for (Entry entry : tempValidStates.entrySet()) { int index = 0; - Collections.sort((List) allowedValues); + Collections.sort(allowedValues); for (Object comp : allowedValues) { int pos = entry.getValue() * mul + index; newValidStates.put(entry.getKey().withProperty(prop, (Comparable) comp), pos); @@ -333,7 +332,7 @@ public AxisAlignedBB getCollisionBoundingBox(World world, BlockPos pos, IBlockSt public AxisAlignedBB getSelectedBoundingBox(World world, BlockPos pos) { return getBox(world, pos, world.getBlockState(pos)).offset(pos.getX(), pos.getY(), pos.getZ()); } - + /* @Override public void setBlockBoundsBasedOnState(IBlockAccess world, BlockPos pos) { AxisAlignedBB[] bbs = * getBoxes(world, pos, world.getBlockState(pos)); AxisAlignedBB bb = bbs[0]; for (int i = 1; i < bbs.length; i++) { * bb = bb.union(bbs[i]); } minX = bb.minX; minY = bb.minY; minZ = bb.minZ; maxX = bb.maxX; maxY = bb.maxY; maxZ = diff --git a/common/buildcraft/core/lib/block/BlockBuildCraftFluid.java b/common/buildcraft/core/lib/block/BlockBuildCraftFluid.java index 33f4ab6865..bb7bf5bccc 100644 --- a/common/buildcraft/core/lib/block/BlockBuildCraftFluid.java +++ b/common/buildcraft/core/lib/block/BlockBuildCraftFluid.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.block; import java.util.Random; @@ -16,6 +20,7 @@ import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.Vec3; +import net.minecraft.world.Explosion; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.client.model.ModelLoader; @@ -171,4 +176,9 @@ protected ModelResourceLocation getModelResourceLocation(IBlockState state) { } }); } + + @Override + public boolean canDropFromExplosion(Explosion explosion) { + return false; + } } diff --git a/common/buildcraft/core/lib/block/IComparatorInventory.java b/common/buildcraft/core/lib/block/IComparatorInventory.java new file mode 100644 index 0000000000..2450416d54 --- /dev/null +++ b/common/buildcraft/core/lib/block/IComparatorInventory.java @@ -0,0 +1,11 @@ +package buildcraft.core.lib.block; + +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; + +/** + * Implemented by Blocks which have an inventory Comparator override. + */ +public interface IComparatorInventory { + boolean doesSlotCountComparator(TileEntity tile, int slot, ItemStack stack); +} diff --git a/common/buildcraft/core/lib/block/TileBuildCraft.java b/common/buildcraft/core/lib/block/TileBuildCraft.java index f44872af99..ff31d1a998 100644 --- a/common/buildcraft/core/lib/block/TileBuildCraft.java +++ b/common/buildcraft/core/lib/block/TileBuildCraft.java @@ -1,5 +1,5 @@ /** 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.core.lib.block; @@ -14,11 +14,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.IChatComponent; -import net.minecraft.util.ITickable; +import net.minecraft.util.*; import net.minecraft.world.World; import cofh.api.energy.IEnergyHandler; diff --git a/common/buildcraft/core/lib/commands/CommandHelpers.java b/common/buildcraft/core/lib/commands/CommandHelpers.java index 006ff2a0c2..a514979312 100644 --- a/common/buildcraft/core/lib/commands/CommandHelpers.java +++ b/common/buildcraft/core/lib/commands/CommandHelpers.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.commands; import net.minecraft.command.CommandException; @@ -109,6 +113,14 @@ public static void printHelp(ICommandSender sender, IModCommand command) { public static boolean processStandardCommands(ICommandSender sender, IModCommand command, String[] args) throws CommandException { if (args.length >= 1) { if ("help".equals(args[0])) { + if (args.length >= 2) { + for (SubCommand child : command.getChildren()) { + if (matches(args[1], child)) { + child.printHelp(sender); + return true; + } + } + } command.printHelp(sender); return true; } diff --git a/common/buildcraft/core/lib/commands/IModCommand.java b/common/buildcraft/core/lib/commands/IModCommand.java index 78b401d59b..1382f72529 100644 --- a/common/buildcraft/core/lib/commands/IModCommand.java +++ b/common/buildcraft/core/lib/commands/IModCommand.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.commands; diff --git a/common/buildcraft/core/lib/commands/RootCommand.java b/common/buildcraft/core/lib/commands/RootCommand.java index 63e1667d0a..b61daec19d 100644 --- a/common/buildcraft/core/lib/commands/RootCommand.java +++ b/common/buildcraft/core/lib/commands/RootCommand.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.commands; import java.util.ArrayList; diff --git a/common/buildcraft/core/lib/commands/SubCommand.java b/common/buildcraft/core/lib/commands/SubCommand.java index 02c2a3c4b9..f620292f71 100644 --- a/common/buildcraft/core/lib/commands/SubCommand.java +++ b/common/buildcraft/core/lib/commands/SubCommand.java @@ -1,5 +1,5 @@ /** 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.core.lib.commands; @@ -18,8 +18,9 @@ public abstract class SubCommand implements IModCommand { public enum PermLevel { EVERYONE(0), - ADMIN(2); - int permLevel; + ADMIN(2), + SERVER_ADMIN(3); + final int permLevel; PermLevel(int permLevel) { this.permLevel = permLevel; diff --git a/common/buildcraft/core/lib/engines/BlockEngineBase.java b/common/buildcraft/core/lib/engines/BlockEngineBase.java index d15a075421..c1b037557b 100644 --- a/common/buildcraft/core/lib/engines/BlockEngineBase.java +++ b/common/buildcraft/core/lib/engines/BlockEngineBase.java @@ -1,5 +1,5 @@ /** 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.core.lib.engines; @@ -16,15 +16,12 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.*; import net.minecraft.util.EnumFacing.AxisDirection; -import net.minecraft.util.EnumParticleTypes; -import net.minecraft.util.Vec3; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import net.minecraftforge.fml.common.FMLCommonHandler; + +import net.minecraftforge.common.MinecraftForge; import buildcraft.api.enums.EnumEnergyStage; import buildcraft.api.events.BlockInteractionEvent; @@ -97,7 +94,7 @@ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, En TileEntity tile = world.getTileEntity(pos); BlockInteractionEvent event = new BlockInteractionEvent(player, state); - FMLCommonHandler.instance().bus().post(event); + MinecraftForge.EVENT_BUS.post(event); if (event.isCanceled()) { return false; } diff --git a/common/buildcraft/core/lib/engines/ItemEngine.java b/common/buildcraft/core/lib/engines/ItemEngine.java index 9f712ad0c2..a93b84390d 100644 --- a/common/buildcraft/core/lib/engines/ItemEngine.java +++ b/common/buildcraft/core/lib/engines/ItemEngine.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.engines; import net.minecraft.block.Block; diff --git a/common/buildcraft/core/lib/engines/RenderEngine.java b/common/buildcraft/core/lib/engines/RenderEngine.java index 66415905ec..d537954410 100644 --- a/common/buildcraft/core/lib/engines/RenderEngine.java +++ b/common/buildcraft/core/lib/engines/RenderEngine.java @@ -1,5 +1,5 @@ /** 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.core.lib.engines; @@ -15,11 +15,11 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.Vec3; import net.minecraft.world.World; + import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -35,7 +35,8 @@ import buildcraft.core.lib.render.RenderUtils; import buildcraft.core.lib.utils.Utils; -public class RenderEngine extends TileEntitySpecialRenderer { +public class RenderEngine extends TileEntitySpecialRenderer { + private static final float[] angleMap = new float[6]; /** The number of stages to go through. Increase this number to go through more stages (smoother), decrease this @@ -67,12 +68,11 @@ public void textureStitchPost(TextureStitchEvent.Post post) { } @Override - public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float f, int wtfIsThis) { - TileEngineBase engine = (TileEngineBase) tile; + public void renderTileEntityAt(TileEngineBase engine, double x, double y, double z, float f, int wtfIsThis) { if (engine != null) { - World world = tile.getWorld(); - BlockPos pos = tile.getPos(); + World world = engine.getWorld(); + BlockPos pos = engine.getPos(); IBlockState engineState = world.getBlockState(pos); if (engineState.getBlock() instanceof BlockEngineBase) { engineState = engineState.getBlock().getActualState(engineState, world, pos); @@ -139,7 +139,7 @@ public Vec3 transformToWorld(Vec3 vec) { GL11.glRotated(-angle, 0, 1, 0); } RenderUtils.translate(Utils.vec3(-0.5)); - + EntityResizableCuboid chamberCuboid = new EntityResizableCuboid(getWorld()); chamberCuboid.texture = spriteChamber; chamberCuboid.setTextureOffset(new Vec3(3, 0, 3)); diff --git a/common/buildcraft/core/lib/engines/TileEngineBase.java b/common/buildcraft/core/lib/engines/TileEngineBase.java index 6c453873e3..76e44fc29e 100644 --- a/common/buildcraft/core/lib/engines/TileEngineBase.java +++ b/common/buildcraft/core/lib/engines/TileEngineBase.java @@ -1,5 +1,5 @@ /** 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.core.lib.engines; @@ -8,7 +8,6 @@ import net.minecraft.inventory.Container; import net.minecraft.inventory.ICrafting; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; @@ -27,7 +26,6 @@ import buildcraft.core.CompatHooks; import buildcraft.core.lib.block.TileBuildCraft; import buildcraft.core.lib.utils.MathUtils; -import buildcraft.core.lib.utils.ResourceUtils; import buildcraft.core.lib.utils.Utils; import io.netty.buffer.ByteBuf; @@ -349,7 +347,7 @@ private boolean switchOrientationDo(boolean pipesOnly) { for (int i = orientation.getIndex() + 1; i <= orientation.getIndex() + 6; ++i) { EnumFacing o = EnumFacing.VALUES[i % 6]; - TileEntity tile = getTile(o); + Object tile = getEnergyProvider(o); if ((!pipesOnly || tile instanceof IPipeTile) && isPoweredTile(tile, o)) { orientation = o; @@ -413,14 +411,10 @@ public void writeData(ByteBuf stream) { public void getGUINetworkData(int id, int value) { switch (id) { case 0: - int iEnergy = Math.round(energy); - iEnergy = (iEnergy & 0xffff0000) | (value & 0xffff); - energy = iEnergy; + energy = (energy & 0xffff0000) | (value & 0xffff); break; case 1: - iEnergy = Math.round(energy); - iEnergy = (iEnergy & 0xffff) | ((value & 0xffff) << 16); - energy = iEnergy; + energy = (energy & 0xffff) | ((value & 0xffff) << 16); break; case 2: currentOutput = value; @@ -432,9 +426,9 @@ public void getGUINetworkData(int id, int value) { } public void sendGUINetworkData(Container container, ICrafting iCrafting) { - iCrafting.sendProgressBarUpdate(container, 0, Math.round(energy) & 0xffff); - iCrafting.sendProgressBarUpdate(container, 1, (Math.round(energy) & 0xffff0000) >> 16); - iCrafting.sendProgressBarUpdate(container, 2, Math.round(currentOutput)); + iCrafting.sendProgressBarUpdate(container, 0, energy & 0xffff); + iCrafting.sendProgressBarUpdate(container, 1, (energy & 0xffff0000) >> 16); + iCrafting.sendProgressBarUpdate(container, 2, currentOutput); iCrafting.sendProgressBarUpdate(container, 3, Math.round(heat * 100)); } @@ -454,7 +448,7 @@ public void addEnergy(int addition) { } public int extractEnergy(int energyMax, boolean doExtract) { - int max = Math.min(energyMax, maxEnergyExtracted()); + int max = Math.min(energyMax, getCurrentOutputLimit()); int extracted; @@ -489,19 +483,15 @@ public boolean isPoweredTile(Object tile, EnumFacing side) { public abstract int getMaxEnergy(); - public int minEnergyReceived() { - return 20; - } - - public abstract int maxEnergyReceived(); - - public abstract int maxEnergyExtracted(); - public int getEnergyStored() { return energy; } - public abstract int calculateCurrentOutput(); + public abstract int getIdealOutput(); + + public int getCurrentOutputLimit() { + return Integer.MAX_VALUE; + } @Override public ConnectOverride overridePipeConnection(IPipeTile.PipeType type, EnumFacing with) { diff --git a/common/buildcraft/core/lib/engines/TileEngineWithInventory.java b/common/buildcraft/core/lib/engines/TileEngineWithInventory.java index 975811bf5d..2b0ebe531c 100644 --- a/common/buildcraft/core/lib/engines/TileEngineWithInventory.java +++ b/common/buildcraft/core/lib/engines/TileEngineWithInventory.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.engines; import net.minecraft.entity.player.EntityPlayer; diff --git a/common/buildcraft/core/lib/fluids/RestrictedTank.java b/common/buildcraft/core/lib/fluids/RestrictedTank.java index cc6a05536a..518ad32362 100644 --- a/common/buildcraft/core/lib/fluids/RestrictedTank.java +++ b/common/buildcraft/core/lib/fluids/RestrictedTank.java @@ -1,10 +1,15 @@ -/** 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 */ +/** + * 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.core.lib.fluids; import net.minecraft.tileentity.TileEntity; + import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; diff --git a/common/buildcraft/core/lib/fluids/SingleUseTank.java b/common/buildcraft/core/lib/fluids/SingleUseTank.java index dc702abd2b..af2ffb548c 100644 --- a/common/buildcraft/core/lib/fluids/SingleUseTank.java +++ b/common/buildcraft/core/lib/fluids/SingleUseTank.java @@ -1,11 +1,16 @@ -/** 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 */ +/** + * 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.core.lib.fluids; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; + import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; diff --git a/common/buildcraft/core/lib/fluids/Tank.java b/common/buildcraft/core/lib/fluids/Tank.java index a9597929b5..38d6040f7f 100644 --- a/common/buildcraft/core/lib/fluids/Tank.java +++ b/common/buildcraft/core/lib/fluids/Tank.java @@ -1,13 +1,18 @@ -/** 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 */ +/** + * 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.core.lib.fluids; import java.util.Locale; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; + import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidTank; diff --git a/common/buildcraft/core/lib/fluids/TankManager.java b/common/buildcraft/core/lib/fluids/TankManager.java index bcc56ae8a4..b514302695 100644 --- a/common/buildcraft/core/lib/fluids/TankManager.java +++ b/common/buildcraft/core/lib/fluids/TankManager.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.fluids; import java.util.ArrayList; diff --git a/common/buildcraft/core/lib/fluids/TankUtils.java b/common/buildcraft/core/lib/fluids/TankUtils.java index 8d65f0f64c..6b69e07616 100644 --- a/common/buildcraft/core/lib/fluids/TankUtils.java +++ b/common/buildcraft/core/lib/fluids/TankUtils.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.fluids; import net.minecraft.block.Block; diff --git a/common/buildcraft/core/lib/gui/AdvancedSlot.java b/common/buildcraft/core/lib/gui/AdvancedSlot.java index 391969efb6..1d9f1ae348 100755 --- a/common/buildcraft/core/lib/gui/AdvancedSlot.java +++ b/common/buildcraft/core/lib/gui/AdvancedSlot.java @@ -1,5 +1,5 @@ /** 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.core.lib.gui; @@ -67,6 +67,8 @@ public boolean isDefined() { return true; } + public void selected() {} + public void drawSprite(int cornerX, int cornerY) { Minecraft mc = Minecraft.getMinecraft(); @@ -87,15 +89,15 @@ public void drawSprite(int cornerX, int cornerY) { // System.out.printf("Drawing advanced sprite %s (%d,%d) at %d %d\n", getIcon().getIconName(), // getIcon().getOriginX(),getIcon().getOriginY(),cornerX + x, cornerY + y); + GL11.glPushAttrib(GL11.GL_LIGHTING_BIT | GL11.GL_COLOR_BUFFER_BIT); + GL11.glDisable(GL11.GL_LIGHTING); // Make sure that render states are reset, an ItemStack can derp them up. GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_BLEND); gui.drawTexturedModalRect(cornerX + x, cornerY + y, getIcon(), 16, 16); - GL11.glEnable(GL11.GL_LIGHTING); - GL11.glDisable(GL11.GL_ALPHA_TEST); - GL11.glDisable(GL11.GL_BLEND); + GL11.glPopAttrib(); } } @@ -105,9 +107,10 @@ public void drawStack(ItemStack item) { int cornerY = (gui.height - gui.getYSize()) / 2; gui.drawStack(item, cornerX + x, cornerY + y); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); } - public void selected() { - + public boolean shouldDrawHighlight() { + return true; } } diff --git a/common/buildcraft/core/lib/gui/BuildCraftContainer.java b/common/buildcraft/core/lib/gui/BuildCraftContainer.java index d77ebed2c8..47982a27e2 100644 --- a/common/buildcraft/core/lib/gui/BuildCraftContainer.java +++ b/common/buildcraft/core/lib/gui/BuildCraftContainer.java @@ -1,5 +1,5 @@ /** 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.core.lib.gui; diff --git a/common/buildcraft/core/lib/gui/ContainerDummy.java b/common/buildcraft/core/lib/gui/ContainerDummy.java index db019545ff..c04fe56f21 100644 --- a/common/buildcraft/core/lib/gui/ContainerDummy.java +++ b/common/buildcraft/core/lib/gui/ContainerDummy.java @@ -2,10 +2,15 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; +import net.minecraft.inventory.IInventory; public class ContainerDummy extends Container { - @Override - public boolean canInteractWith(EntityPlayer player) { - return false; - } + @Override + public boolean canInteractWith(EntityPlayer player) { + return false; + } + + @Override + public void onCraftMatrixChanged(IInventory inventory) { + } } diff --git a/common/buildcraft/core/lib/gui/FluidSlot.java b/common/buildcraft/core/lib/gui/FluidSlot.java index 61c7c86e88..e10f5c5734 100755 --- a/common/buildcraft/core/lib/gui/FluidSlot.java +++ b/common/buildcraft/core/lib/gui/FluidSlot.java @@ -1,5 +1,5 @@ /** 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.core.lib.gui; @@ -7,6 +7,7 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.ResourceLocation; + import net.minecraftforge.fluids.Fluid; import buildcraft.core.lib.render.FluidRenderer; diff --git a/common/buildcraft/core/lib/gui/GuiAdvancedInterface.java b/common/buildcraft/core/lib/gui/GuiAdvancedInterface.java index 154c69d673..2d4e76e0e3 100644 --- a/common/buildcraft/core/lib/gui/GuiAdvancedInterface.java +++ b/common/buildcraft/core/lib/gui/GuiAdvancedInterface.java @@ -1,13 +1,18 @@ -/** 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 */ +/** + * 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.core.lib.gui; import java.io.IOException; import java.util.ArrayList; import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.OpenGlHelper; @@ -49,11 +54,30 @@ public AdvancedSlot getSlotAtLocation(int i, int j) { } } - protected void drawBackgroundSlots() { + private boolean isMouseOverSlot(AdvancedSlot slot, int mouseX, int mouseY) { + int realMouseX = mouseX - this.guiLeft; + int realMouseY = mouseY - this.guiTop; + return realMouseX >= slot.x - 1 && realMouseX < slot.x + 16 + 1 && realMouseY >= slot.y - 1 && realMouseY < slot.y + 16 + 1; + } + + protected void drawSlotHighlight(AdvancedSlot slot, int mouseX, int mouseY) { + if (this.isMouseOverSlot(slot, mouseX, mouseY) && slot.shouldDrawHighlight()) { + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_DEPTH_TEST); + GL11.glColorMask(true, true, true, false); + this.drawGradientRect(guiLeft + slot.x, guiTop + slot.y, guiLeft + slot.x + 16, guiTop + slot.y + 16, -2130706433, -2130706433); + GL11.glColorMask(true, true, true, true); + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_DEPTH_TEST); + } + } + + protected void drawBackgroundSlots(int mouseX, int mouseY) { RenderHelper.enableGUIStandardItemLighting(); GL11.glPushMatrix(); + GL11.glPushAttrib(GL11.GL_TRANSFORM_BIT); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GL11.glEnable(32826 /* GL_RESCALE_NORMAL_EXT */); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); int i1 = 240; int k1 = 240; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, i1 / 1.0F, k1 / 1.0F); @@ -63,10 +87,12 @@ protected void drawBackgroundSlots() { for (AdvancedSlot slot : slots) { if (slot != null) { slot.drawSprite(guiLeft, guiTop); + drawSlotHighlight(slot, mouseX, mouseY); } } } + GL11.glPopAttrib(); GL11.glPopMatrix(); } @@ -75,6 +101,7 @@ public void drawTooltipForSlotAt(int mouseX, int mouseY) { if (slot != null) { slot.drawTooltip(this, mouseX, mouseY); + RenderHelper.enableGUIStandardItemLighting(); } } @@ -87,7 +114,7 @@ public void drawTooltip(String caption, int mouseX, int mouseY) { } } - public RenderItem getItemRenderer() { + public RenderItem getItemRenderer() { return itemRender; } diff --git a/common/buildcraft/core/lib/gui/GuiBuildCraft.java b/common/buildcraft/core/lib/gui/GuiBuildCraft.java index b4d18d1bec..b2d01c271a 100644 --- a/common/buildcraft/core/lib/gui/GuiBuildCraft.java +++ b/common/buildcraft/core/lib/gui/GuiBuildCraft.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.gui; import java.io.IOException; @@ -82,16 +86,16 @@ public void drawScreen(int mouseX, int mouseY, float par3) { InventoryPlayer playerInv = this.mc.thePlayer.inventory; if (playerInv.getItemStack() == null) { - drawToolTips(container.getWidgets(), mouseX - left, mouseY - top); - drawToolTips(buttonList, mouseX, mouseY); - drawToolTips(inventorySlots.inventorySlots, mouseX, mouseY); + drawToolTips(container.getWidgets(), mouseX - left, mouseY - top, left, top); + drawToolTips(buttonList, mouseX, mouseY, 0, 0); + drawToolTips(inventorySlots.inventorySlots, mouseX, mouseY, 0, 0); } GL11.glPopMatrix(); GL11.glEnable(GL11.GL_DEPTH_TEST); } - private void drawToolTips(Collection objects, int mouseX, int mouseY) { + private void drawToolTips(Collection objects, int mouseX, int mouseY, int offsetX, int offsetY) { for (Object obj : objects) { if (!(obj instanceof IToolTipProvider)) { continue; @@ -108,7 +112,7 @@ private void drawToolTips(Collection objects, int mouseX, int mouseY) { tips.onTick(mouseOver); if (mouseOver && tips.isReady()) { tips.refresh(); - drawToolTips(tips, mouseX, mouseY); + drawToolTips(tips, mouseX + offsetX, mouseY + offsetY); } } } @@ -174,6 +178,10 @@ protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) int mX = mouseX - guiLeft; int mY = mouseY - guiTop; + drawWidgets(mX, mY); + } + + protected void drawWidgets(int mX, int mY) { for (Widget widget : container.getWidgets()) { if (widget.hidden) { continue; @@ -368,8 +376,7 @@ protected Ledger getAtPosition(int mX, int mY) { int xShift = ((gui.width - gui.xSize) / 2) + gui.xSize; int yShift = ((gui.height - gui.ySize) / 2) + 8; - for (int i = 0; i < ledgers.size(); i++) { - Ledger ledger = ledgers.get(i); + for (Ledger ledger : ledgers) { if (!ledger.isVisible()) { continue; } @@ -387,8 +394,7 @@ protected Ledger getAtPosition(int mX, int mY) { } protected void drawLedgers(int mouseX, int mouseY) { - - int xPos = 8; + int yPos = 8; for (Ledger ledger : ledgers) { ledger.update(); @@ -396,8 +402,8 @@ protected void drawLedgers(int mouseX, int mouseY) { continue; } - ledger.draw(xSize, xPos); - xPos += ledger.getHeight(); + ledger.draw(xSize, yPos); + yPos += ledger.getHeight(); } Ledger ledger = getAtPosition(mouseX, mouseY); @@ -439,7 +445,6 @@ protected abstract class Ledger { public int currentShiftX = 0; public int currentShiftY = 0; protected int overlayColor = 0xffffff; - protected int limitWidth = 128; protected int maxWidth = 124; protected int minWidth = 24; protected int currentWidth = minWidth; diff --git a/common/buildcraft/core/lib/gui/GuiTools.java b/common/buildcraft/core/lib/gui/GuiTools.java index a6afb3c0b5..efc8a79b45 100644 --- a/common/buildcraft/core/lib/gui/GuiTools.java +++ b/common/buildcraft/core/lib/gui/GuiTools.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.gui; import java.util.List; diff --git a/common/buildcraft/core/lib/gui/IInventorySlot.java b/common/buildcraft/core/lib/gui/IInventorySlot.java index 35432b615e..6f482c126d 100755 --- a/common/buildcraft/core/lib/gui/IInventorySlot.java +++ b/common/buildcraft/core/lib/gui/IInventorySlot.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.gui; import net.minecraft.inventory.IInventory; diff --git a/common/buildcraft/core/lib/gui/ItemSlot.java b/common/buildcraft/core/lib/gui/ItemSlot.java index 84310df16a..8b47dc1dff 100755 --- a/common/buildcraft/core/lib/gui/ItemSlot.java +++ b/common/buildcraft/core/lib/gui/ItemSlot.java @@ -1,13 +1,16 @@ -/** 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 */ +/** + * 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.core.lib.gui; import net.minecraft.item.ItemStack; public class ItemSlot extends AdvancedSlot { - public ItemStack stack; public ItemSlot(GuiAdvancedInterface gui, int x, int y) { diff --git a/common/buildcraft/core/lib/gui/StatementParameterSlot.java b/common/buildcraft/core/lib/gui/StatementParameterSlot.java index 43347c9e72..890c78c17e 100644 --- a/common/buildcraft/core/lib/gui/StatementParameterSlot.java +++ b/common/buildcraft/core/lib/gui/StatementParameterSlot.java @@ -6,7 +6,9 @@ import buildcraft.api.statements.IStatementParameter; import buildcraft.api.statements.StatementParameterItemStack; -/** Created by asie on 1/24/15. */ +/** + * Created by asie on 1/24/15. + */ public abstract class StatementParameterSlot extends AdvancedSlot { public int slot; public StatementSlot statementSlot; diff --git a/common/buildcraft/core/lib/gui/StatementSlot.java b/common/buildcraft/core/lib/gui/StatementSlot.java index 894194b7ba..d0b203e424 100644 --- a/common/buildcraft/core/lib/gui/StatementSlot.java +++ b/common/buildcraft/core/lib/gui/StatementSlot.java @@ -48,4 +48,9 @@ public boolean isDefined() { } public abstract IStatement getStatement(); + + @Override + public boolean shouldDrawHighlight() { + return false; + } } diff --git a/common/buildcraft/core/lib/gui/buttons/ButtonTextureSet.java b/common/buildcraft/core/lib/gui/buttons/ButtonTextureSet.java index 8a556952d4..6b698cdf21 100644 --- a/common/buildcraft/core/lib/gui/buttons/ButtonTextureSet.java +++ b/common/buildcraft/core/lib/gui/buttons/ButtonTextureSet.java @@ -1,18 +1,29 @@ -/** 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 */ +/** + * 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.core.lib.gui.buttons; -public class ButtonTextureSet implements IButtonTextureSet { +import net.minecraft.util.ResourceLocation; +public class ButtonTextureSet implements IButtonTextureSet { + private final ResourceLocation texture; private final int x, y, height, width; public ButtonTextureSet(int x, int y, int height, int width) { + this(x, y, height, width, StandardButtonTextureSets.BUTTON_TEXTURES); + } + + public ButtonTextureSet(int x, int y, int height, int width, ResourceLocation texture) { this.x = x; this.y = y; this.height = height; this.width = width; + this.texture = texture; } @Override @@ -34,4 +45,9 @@ public int getHeight() { public int getWidth() { return width; } + + @Override + public ResourceLocation getTexture() { + return texture; + } } diff --git a/common/buildcraft/core/lib/gui/buttons/GuiBetterButton.java b/common/buildcraft/core/lib/gui/buttons/GuiBetterButton.java index 612e4de8ee..82e27fc867 100644 --- a/common/buildcraft/core/lib/gui/buttons/GuiBetterButton.java +++ b/common/buildcraft/core/lib/gui/buttons/GuiBetterButton.java @@ -1,5 +1,5 @@ /** 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.core.lib.gui.buttons; @@ -9,7 +9,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiButton; -import net.minecraft.util.ResourceLocation; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -18,8 +18,6 @@ @SideOnly(Side.CLIENT) public class GuiBetterButton extends GuiButton implements IToolTipProvider { - - public static final ResourceLocation BUTTON_TEXTURES = new ResourceLocation("buildcraftcore:textures/gui/buttons.png"); protected final IButtonTextureSet texture; private ToolTip toolTip; @@ -59,7 +57,7 @@ public boolean isMouseOverButton(int mouseX, int mouseY) { } protected void bindButtonTextures(Minecraft minecraft) { - minecraft.renderEngine.bindTexture(BUTTON_TEXTURES); + minecraft.renderEngine.bindTexture(texture.getTexture()); } @Override @@ -88,8 +86,9 @@ public ToolTip getToolTip() { return toolTip; } - public void setToolTip(ToolTip tips) { + public GuiBetterButton setToolTip(ToolTip tips) { this.toolTip = tips; + return this; } @Override diff --git a/common/buildcraft/core/lib/gui/buttons/GuiButtonSmall.java b/common/buildcraft/core/lib/gui/buttons/GuiButtonSmall.java index e932adaf0c..05012c38b3 100644 --- a/common/buildcraft/core/lib/gui/buttons/GuiButtonSmall.java +++ b/common/buildcraft/core/lib/gui/buttons/GuiButtonSmall.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.gui.buttons; import net.minecraftforge.fml.relauncher.Side; diff --git a/common/buildcraft/core/lib/gui/buttons/GuiImageButton.java b/common/buildcraft/core/lib/gui/buttons/GuiImageButton.java index ce0ee9ce1f..391999e31a 100644 --- a/common/buildcraft/core/lib/gui/buttons/GuiImageButton.java +++ b/common/buildcraft/core/lib/gui/buttons/GuiImageButton.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.gui.buttons; @@ -15,43 +19,35 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import buildcraft.core.lib.gui.tooltips.IToolTipProvider; +import buildcraft.core.lib.gui.tooltips.ToolTip; + + @SideOnly(Side.CLIENT) -public class GuiImageButton extends GuiButton implements IButtonClickEventTrigger { +public class GuiImageButton extends GuiButton implements IButtonClickEventTrigger, IToolTipProvider { + private final int size, u, v, baseU, baseV; + private final ResourceLocation texture; - public enum ButtonImage { - BLANK(1, 19), - WHITE_LIST(19, 19), - BLACK_LIST(37, 19), - ROUND_ROBIN(55, 19); + private ArrayList listeners = new ArrayList(); + private boolean active = false; + private ToolTip toolTip; - private final int u, v; + public GuiImageButton(int id, int x, int y, int size, ResourceLocation texture, int u, int v) { + this(id, x, y, size, texture, 0, 0, u, v); + } - ButtonImage(int u, int v) { + public GuiImageButton(int id, int x, int y, int size, ResourceLocation texture, int baseU, int baseV, int u, int v) { + super(id, x, y, size, size, ""); + this.size = size; this.u = u; this.v = v; + this.baseU = baseU; + this.baseV = baseV; + this.texture = texture; } - public int getU() { - return u; - } - - public int getV() { - return v; - } - } - - public static final ResourceLocation ICON_BUTTON_TEXTURES = new ResourceLocation("buildcraftcore:textures/gui/icon_button.png"); - - public static final int SIZE = 18; - - private ArrayList listeners = new ArrayList(); - private ButtonImage image = ButtonImage.BLANK; - private boolean active = false; - - public GuiImageButton(int id, int x, int y, ButtonImage image) { - super(id, x, y, SIZE, SIZE, ""); - - this.image = image; + public int getSize() { + return size; } public boolean isActive() { @@ -68,20 +64,20 @@ public void deActivate() { @Override public void drawButton(Minecraft minecraft, int x, int y) { - if (!visible) { return; } - minecraft.renderEngine.bindTexture(ICON_BUTTON_TEXTURES); + minecraft.renderEngine.bindTexture(texture); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glDisable(GL11.GL_BLEND); int buttonState = getButtonState(x, y); - drawTexturedModalRect(xPosition, yPosition, buttonState * SIZE, 0, SIZE, SIZE); - - drawTexturedModalRect(xPosition + 1, yPosition + 1, image.getU(), image.getV(), SIZE - 2, SIZE - 2); + drawTexturedModalRect(xPosition, yPosition, baseU + buttonState * size, baseV, size, size); + drawTexturedModalRect(xPosition + 1, yPosition + 1, u, v, size - 2, size - 2); mouseDragged(minecraft, x, y); } @@ -136,6 +132,26 @@ private int getButtonState(int mouseX, int mouseY) { } private boolean isMouseOverButton(int mouseX, int mouseY) { - return mouseX >= xPosition && mouseY >= yPosition && mouseX < xPosition + SIZE && mouseY < yPosition + SIZE; + return mouseX >= xPosition && mouseY >= yPosition && mouseX < xPosition + size && mouseY < yPosition + size; + } + + @Override + public ToolTip getToolTip() { + return toolTip; + } + + public GuiImageButton setToolTip(ToolTip tips) { + this.toolTip = tips; + return this; + } + + @Override + public boolean isToolTipVisible() { + return visible; + } + + @Override + public boolean isMouseOver(int mouseX, int mouseY) { + return isMouseOverButton(mouseX, mouseY); } } diff --git a/common/buildcraft/core/lib/gui/buttons/GuiMultiButton.java b/common/buildcraft/core/lib/gui/buttons/GuiMultiButton.java index e4afc38dab..d6e28c14d5 100644 --- a/common/buildcraft/core/lib/gui/buttons/GuiMultiButton.java +++ b/common/buildcraft/core/lib/gui/buttons/GuiMultiButton.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.gui.buttons; import org.lwjgl.opengl.GL11; diff --git a/common/buildcraft/core/lib/gui/buttons/GuiToggleButton.java b/common/buildcraft/core/lib/gui/buttons/GuiToggleButton.java index b73d673335..3bf9d4ded9 100644 --- a/common/buildcraft/core/lib/gui/buttons/GuiToggleButton.java +++ b/common/buildcraft/core/lib/gui/buttons/GuiToggleButton.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.gui.buttons; public class GuiToggleButton extends GuiBetterButton { diff --git a/common/buildcraft/core/lib/gui/buttons/GuiToggleButtonSmall.java b/common/buildcraft/core/lib/gui/buttons/GuiToggleButtonSmall.java index 7785902d4d..4256daaed5 100644 --- a/common/buildcraft/core/lib/gui/buttons/GuiToggleButtonSmall.java +++ b/common/buildcraft/core/lib/gui/buttons/GuiToggleButtonSmall.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.gui.buttons; import net.minecraftforge.fml.relauncher.Side; diff --git a/common/buildcraft/core/lib/gui/buttons/IButtonClickEventListener.java b/common/buildcraft/core/lib/gui/buttons/IButtonClickEventListener.java index 7517971e96..fb0f0f6de4 100644 --- a/common/buildcraft/core/lib/gui/buttons/IButtonClickEventListener.java +++ b/common/buildcraft/core/lib/gui/buttons/IButtonClickEventListener.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.gui.buttons; diff --git a/common/buildcraft/core/lib/gui/buttons/IButtonClickEventTrigger.java b/common/buildcraft/core/lib/gui/buttons/IButtonClickEventTrigger.java index 04d360dc41..e5de325e8e 100644 --- a/common/buildcraft/core/lib/gui/buttons/IButtonClickEventTrigger.java +++ b/common/buildcraft/core/lib/gui/buttons/IButtonClickEventTrigger.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.gui.buttons; diff --git a/common/buildcraft/core/lib/gui/buttons/IButtonTextureSet.java b/common/buildcraft/core/lib/gui/buttons/IButtonTextureSet.java index 7189e97107..a9c62f79ab 100644 --- a/common/buildcraft/core/lib/gui/buttons/IButtonTextureSet.java +++ b/common/buildcraft/core/lib/gui/buttons/IButtonTextureSet.java @@ -1,9 +1,15 @@ -/** 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 */ +/** + * 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.core.lib.gui.buttons; +import net.minecraft.util.ResourceLocation; + public interface IButtonTextureSet { int getX(); @@ -13,4 +19,6 @@ public interface IButtonTextureSet { int getHeight(); int getWidth(); + + ResourceLocation getTexture(); } diff --git a/common/buildcraft/core/lib/gui/buttons/IMultiButtonState.java b/common/buildcraft/core/lib/gui/buttons/IMultiButtonState.java index d897ce04a6..d84eae8002 100644 --- a/common/buildcraft/core/lib/gui/buttons/IMultiButtonState.java +++ b/common/buildcraft/core/lib/gui/buttons/IMultiButtonState.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.gui.buttons; import buildcraft.core.lib.gui.tooltips.ToolTip; diff --git a/common/buildcraft/core/lib/gui/buttons/LockButtonState.java b/common/buildcraft/core/lib/gui/buttons/LockButtonState.java index 6dfeff028e..5d1dc9e38e 100644 --- a/common/buildcraft/core/lib/gui/buttons/LockButtonState.java +++ b/common/buildcraft/core/lib/gui/buttons/LockButtonState.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.gui.buttons; import buildcraft.core.lib.gui.tooltips.ToolTip; @@ -13,7 +17,7 @@ public enum LockButtonState implements IMultiButtonState { public static final LockButtonState[] VALUES = values(); private final IButtonTextureSet texture; - private LockButtonState(IButtonTextureSet texture) { + LockButtonState(IButtonTextureSet texture) { this.texture = texture; } diff --git a/common/buildcraft/core/lib/gui/buttons/MultiButtonController.java b/common/buildcraft/core/lib/gui/buttons/MultiButtonController.java index 1ca4b6e877..0467aa2989 100644 --- a/common/buildcraft/core/lib/gui/buttons/MultiButtonController.java +++ b/common/buildcraft/core/lib/gui/buttons/MultiButtonController.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.gui.buttons; import net.minecraft.nbt.NBTTagByte; diff --git a/common/buildcraft/core/lib/gui/buttons/StandardButtonTextureSets.java b/common/buildcraft/core/lib/gui/buttons/StandardButtonTextureSets.java index 98afa8876e..ecac714c58 100644 --- a/common/buildcraft/core/lib/gui/buttons/StandardButtonTextureSets.java +++ b/common/buildcraft/core/lib/gui/buttons/StandardButtonTextureSets.java @@ -1,18 +1,24 @@ -/** 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 */ +/** + * 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.core.lib.gui.buttons; -public enum StandardButtonTextureSets implements IButtonTextureSet { +import net.minecraft.util.ResourceLocation; +public enum StandardButtonTextureSets implements IButtonTextureSet { LARGE_BUTTON(0, 0, 20, 200), SMALL_BUTTON(0, 80, 15, 200), LEFT_BUTTON(204, 0, 16, 10), RIGHT_BUTTON(214, 0, 16, 10); + public static final ResourceLocation BUTTON_TEXTURES = new ResourceLocation("buildcraftcore:textures/gui/buttons.png"); private final int x, y, height, width; - private StandardButtonTextureSets(int x, int y, int height, int width) { + StandardButtonTextureSets(int x, int y, int height, int width) { this.x = x; this.y = y; this.height = height; @@ -38,4 +44,9 @@ public int getHeight() { public int getWidth() { return width; } + + @Override + public ResourceLocation getTexture() { + return BUTTON_TEXTURES; + } } diff --git a/common/buildcraft/core/lib/gui/slots/IPhantomSlot.java b/common/buildcraft/core/lib/gui/slots/IPhantomSlot.java index c088a2d808..76f0864055 100644 --- a/common/buildcraft/core/lib/gui/slots/IPhantomSlot.java +++ b/common/buildcraft/core/lib/gui/slots/IPhantomSlot.java @@ -1,11 +1,14 @@ -/** 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 */ +/** + * 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.core.lib.gui.slots; /* Phantom Slots don't "use" items, they are used for filters and various other logic slots. */ public interface IPhantomSlot { - boolean canAdjust(); } diff --git a/common/buildcraft/core/lib/gui/slots/SlotBase.java b/common/buildcraft/core/lib/gui/slots/SlotBase.java index a7a35085dd..a83615dae0 100644 --- a/common/buildcraft/core/lib/gui/slots/SlotBase.java +++ b/common/buildcraft/core/lib/gui/slots/SlotBase.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.gui.slots; import net.minecraft.inventory.IInventory; diff --git a/common/buildcraft/core/lib/gui/slots/SlotHidden.java b/common/buildcraft/core/lib/gui/slots/SlotHidden.java index 12c5838052..196f155bc8 100755 --- a/common/buildcraft/core/lib/gui/slots/SlotHidden.java +++ b/common/buildcraft/core/lib/gui/slots/SlotHidden.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.gui.slots; import net.minecraft.inventory.IInventory; diff --git a/common/buildcraft/core/lib/gui/slots/SlotLimited.java b/common/buildcraft/core/lib/gui/slots/SlotLimited.java index 757a77ca03..d2fd9c574b 100644 --- a/common/buildcraft/core/lib/gui/slots/SlotLimited.java +++ b/common/buildcraft/core/lib/gui/slots/SlotLimited.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.gui.slots; import net.minecraft.inventory.IInventory; diff --git a/common/buildcraft/core/lib/gui/slots/SlotOutput.java b/common/buildcraft/core/lib/gui/slots/SlotOutput.java index 59794bdac7..e2ca137fe3 100644 --- a/common/buildcraft/core/lib/gui/slots/SlotOutput.java +++ b/common/buildcraft/core/lib/gui/slots/SlotOutput.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.gui.slots; import net.minecraft.inventory.IInventory; diff --git a/common/buildcraft/core/lib/gui/slots/SlotPhantom.java b/common/buildcraft/core/lib/gui/slots/SlotPhantom.java index 810df40ecd..bb915584d1 100644 --- a/common/buildcraft/core/lib/gui/slots/SlotPhantom.java +++ b/common/buildcraft/core/lib/gui/slots/SlotPhantom.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.gui.slots; import net.minecraft.entity.player.EntityPlayer; diff --git a/common/buildcraft/core/lib/gui/slots/SlotUntouchable.java b/common/buildcraft/core/lib/gui/slots/SlotUntouchable.java index 1c54d76720..e6986555e1 100644 --- a/common/buildcraft/core/lib/gui/slots/SlotUntouchable.java +++ b/common/buildcraft/core/lib/gui/slots/SlotUntouchable.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.gui.slots; import net.minecraft.entity.player.EntityPlayer; diff --git a/common/buildcraft/core/lib/gui/slots/SlotValidated.java b/common/buildcraft/core/lib/gui/slots/SlotValidated.java index c3302bbc88..b616e530d4 100644 --- a/common/buildcraft/core/lib/gui/slots/SlotValidated.java +++ b/common/buildcraft/core/lib/gui/slots/SlotValidated.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.gui.slots; import net.minecraft.inventory.IInventory; diff --git a/common/buildcraft/core/lib/gui/tooltips/IToolTipProvider.java b/common/buildcraft/core/lib/gui/tooltips/IToolTipProvider.java index 2d7dd80a1e..148e2e4a60 100644 --- a/common/buildcraft/core/lib/gui/tooltips/IToolTipProvider.java +++ b/common/buildcraft/core/lib/gui/tooltips/IToolTipProvider.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.gui.tooltips; public interface IToolTipProvider { diff --git a/common/buildcraft/core/lib/gui/tooltips/ToolTip.java b/common/buildcraft/core/lib/gui/tooltips/ToolTip.java index ea8fd0bcb8..466bdfa6c5 100644 --- a/common/buildcraft/core/lib/gui/tooltips/ToolTip.java +++ b/common/buildcraft/core/lib/gui/tooltips/ToolTip.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.gui.tooltips; import java.util.ArrayList; diff --git a/common/buildcraft/core/lib/gui/tooltips/ToolTipLine.java b/common/buildcraft/core/lib/gui/tooltips/ToolTipLine.java index 6d6b1d439e..4c985e1fb1 100644 --- a/common/buildcraft/core/lib/gui/tooltips/ToolTipLine.java +++ b/common/buildcraft/core/lib/gui/tooltips/ToolTipLine.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.gui.tooltips; public class ToolTipLine { diff --git a/common/buildcraft/core/lib/gui/widgets/ButtonWidget.java b/common/buildcraft/core/lib/gui/widgets/ButtonWidget.java index 0f4366dd1a..88df18a520 100644 --- a/common/buildcraft/core/lib/gui/widgets/ButtonWidget.java +++ b/common/buildcraft/core/lib/gui/widgets/ButtonWidget.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.gui.widgets; import buildcraft.core.lib.gui.GuiBuildCraft; diff --git a/common/buildcraft/core/lib/gui/widgets/FluidGaugeWidget.java b/common/buildcraft/core/lib/gui/widgets/FluidGaugeWidget.java index 30b3749888..423ad8ae9e 100644 --- a/common/buildcraft/core/lib/gui/widgets/FluidGaugeWidget.java +++ b/common/buildcraft/core/lib/gui/widgets/FluidGaugeWidget.java @@ -1,11 +1,12 @@ /** 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.core.lib.gui.widgets; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; + import net.minecraftforge.fluids.FluidStack; import buildcraft.core.lib.fluids.Tank; diff --git a/common/buildcraft/core/lib/gui/widgets/IIndicatorController.java b/common/buildcraft/core/lib/gui/widgets/IIndicatorController.java index c19171eab7..62edf8fe65 100644 --- a/common/buildcraft/core/lib/gui/widgets/IIndicatorController.java +++ b/common/buildcraft/core/lib/gui/widgets/IIndicatorController.java @@ -1,5 +1,5 @@ /** 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.core.lib.gui.widgets; diff --git a/common/buildcraft/core/lib/gui/widgets/IndicatorController.java b/common/buildcraft/core/lib/gui/widgets/IndicatorController.java index 67e954f736..cd6f4d1563 100644 --- a/common/buildcraft/core/lib/gui/widgets/IndicatorController.java +++ b/common/buildcraft/core/lib/gui/widgets/IndicatorController.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.gui.widgets; import buildcraft.core.lib.gui.tooltips.ToolTip; diff --git a/common/buildcraft/core/lib/gui/widgets/IndicatorWidget.java b/common/buildcraft/core/lib/gui/widgets/IndicatorWidget.java index 4258970405..5d6dc946cd 100644 --- a/common/buildcraft/core/lib/gui/widgets/IndicatorWidget.java +++ b/common/buildcraft/core/lib/gui/widgets/IndicatorWidget.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.gui.widgets; import net.minecraftforge.fml.relauncher.Side; diff --git a/common/buildcraft/core/lib/gui/widgets/ScrollbarWidget.java b/common/buildcraft/core/lib/gui/widgets/ScrollbarWidget.java new file mode 100644 index 0000000000..1ea3f5361b --- /dev/null +++ b/common/buildcraft/core/lib/gui/widgets/ScrollbarWidget.java @@ -0,0 +1,70 @@ +package buildcraft.core.lib.gui.widgets; + +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +import buildcraft.core.lib.gui.GuiBuildCraft; +import buildcraft.core.lib.utils.MathUtils; + +public class ScrollbarWidget extends Widget { + private static final int HEIGHT = 14; + private int pos, len; + private boolean isClicking; + + public ScrollbarWidget(int x, int y, int u, int v, int h) { + super(x, y, u, v, 6, h); + } + + @Override + @SideOnly(Side.CLIENT) + public void draw(GuiBuildCraft gui, int guiX, int guiY, int mouseX, int mouseY) { + gui.drawTexturedModalRect(guiX + x, guiY + y, u, v, w, h); + int posPx = pos * (h - HEIGHT + 2) / len; + gui.drawTexturedModalRect(guiX + x, guiY + y + posPx, u + 6, v, w, HEIGHT); + } + + private void updateLength(int mouseY) { + setPosition(((mouseY - y) * len + (h / 2)) / h); + } + + @Override + @SideOnly(Side.CLIENT) + public boolean handleMouseClick(int mouseX, int mouseY, int mouseButton) { + if (mouseButton == 0) { + isClicking = true; + updateLength(mouseY); + return true; + } + return false; + } + + @Override + @SideOnly(Side.CLIENT) + public void handleMouseMove(int mouseX, int mouseY, int mouseButton, long time) { + if (isClicking && mouseButton == 0) { + updateLength(mouseY); + } + } + + @Override + @SideOnly(Side.CLIENT) + public void handleMouseRelease(int mouseX, int mouseY, int eventType) { + if (isClicking && eventType == 0) { + updateLength(mouseY); + isClicking = false; + } + } + + public int getPosition() { + return pos; + } + + public void setPosition(int pos) { + this.pos = MathUtils.clamp(pos, 0, len); + } + + public void setLength(int len) { + this.len = len; + setPosition(this.pos); + } +} diff --git a/common/buildcraft/core/lib/gui/widgets/Widget.java b/common/buildcraft/core/lib/gui/widgets/Widget.java index 93d65f32bc..660c26110f 100644 --- a/common/buildcraft/core/lib/gui/widgets/Widget.java +++ b/common/buildcraft/core/lib/gui/widgets/Widget.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.gui.widgets; import java.io.DataInputStream; diff --git a/common/buildcraft/core/lib/inventory/CrafterCopy.java b/common/buildcraft/core/lib/inventory/CrafterCopy.java index ab17fa735c..58773dcf2b 100644 --- a/common/buildcraft/core/lib/inventory/CrafterCopy.java +++ b/common/buildcraft/core/lib/inventory/CrafterCopy.java @@ -1,10 +1,15 @@ -/** 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 */ +/** + * 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.core.lib.inventory; import net.minecraft.item.ItemStack; + import net.minecraftforge.fluids.FluidStack; import buildcraft.api.recipes.IFlexibleCrafter; diff --git a/common/buildcraft/core/lib/inventory/FluidHandlerCopy.java b/common/buildcraft/core/lib/inventory/FluidHandlerCopy.java index e37319cd8e..6e2609bc62 100755 --- a/common/buildcraft/core/lib/inventory/FluidHandlerCopy.java +++ b/common/buildcraft/core/lib/inventory/FluidHandlerCopy.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.inventory; import net.minecraft.util.EnumFacing; diff --git a/common/buildcraft/core/lib/inventory/ITransactor.java b/common/buildcraft/core/lib/inventory/ITransactor.java index ff1bf55761..92a6f9d8b6 100644 --- a/common/buildcraft/core/lib/inventory/ITransactor.java +++ b/common/buildcraft/core/lib/inventory/ITransactor.java @@ -1,5 +1,5 @@ /** 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.core.lib.inventory; diff --git a/common/buildcraft/core/lib/inventory/InvUtils.java b/common/buildcraft/core/lib/inventory/InvUtils.java index eab0604443..7eb7951031 100644 --- a/common/buildcraft/core/lib/inventory/InvUtils.java +++ b/common/buildcraft/core/lib/inventory/InvUtils.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.inventory; import net.minecraft.entity.item.EntityItem; @@ -15,10 +19,12 @@ import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; + import net.minecraftforge.common.util.Constants; import buildcraft.api.core.IInvSlot; import buildcraft.core.lib.inventory.filters.IStackFilter; +import buildcraft.core.lib.utils.BlockUtils; public final class InvUtils { @@ -204,28 +210,9 @@ public static ItemStack consumeItem(ItemStack stack) { * @return Modified inventory if double chest, unmodified otherwise. */ public static IInventory getInventory(IInventory inv) { if (inv instanceof TileEntityChest) { - TileEntityChest chest = (TileEntityChest) inv; - - TileEntityChest adjacent = null; - - if (chest.adjacentChestXNeg != null) { - adjacent = chest.adjacentChestXNeg; - } - - if (chest.adjacentChestXPos != null) { - adjacent = chest.adjacentChestXPos; - } - - if (chest.adjacentChestZNeg != null) { - adjacent = chest.adjacentChestZNeg; - } - - if (chest.adjacentChestZPos != null) { - adjacent = chest.adjacentChestZPos; - } - + TileEntityChest adjacent = BlockUtils.getOtherDoubleChest((TileEntityChest) inv); if (adjacent != null) { - return new InventoryLargeChest("", chest, adjacent); + return new InventoryLargeChest("", adjacent, adjacent); } return inv; } diff --git a/common/buildcraft/core/lib/inventory/InventoryConcatenator.java b/common/buildcraft/core/lib/inventory/InventoryConcatenator.java index 72c8396c7f..366a93e54c 100644 --- a/common/buildcraft/core/lib/inventory/InventoryConcatenator.java +++ b/common/buildcraft/core/lib/inventory/InventoryConcatenator.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.inventory; import java.util.ArrayList; diff --git a/common/buildcraft/core/lib/inventory/InventoryCopy.java b/common/buildcraft/core/lib/inventory/InventoryCopy.java index 59fbea2e70..9291470e65 100644 --- a/common/buildcraft/core/lib/inventory/InventoryCopy.java +++ b/common/buildcraft/core/lib/inventory/InventoryCopy.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.inventory; import net.minecraft.entity.player.EntityPlayer; diff --git a/common/buildcraft/core/lib/inventory/InventoryIterator.java b/common/buildcraft/core/lib/inventory/InventoryIterator.java index a16390bfc0..9f95724740 100644 --- a/common/buildcraft/core/lib/inventory/InventoryIterator.java +++ b/common/buildcraft/core/lib/inventory/InventoryIterator.java @@ -1,5 +1,5 @@ /** 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.core.lib.inventory; diff --git a/common/buildcraft/core/lib/inventory/InventoryIteratorSided.java b/common/buildcraft/core/lib/inventory/InventoryIteratorSided.java index f8cdc9faca..97e72c9d67 100644 --- a/common/buildcraft/core/lib/inventory/InventoryIteratorSided.java +++ b/common/buildcraft/core/lib/inventory/InventoryIteratorSided.java @@ -1,5 +1,5 @@ /** 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.core.lib.inventory; diff --git a/common/buildcraft/core/lib/inventory/InventoryIteratorSimple.java b/common/buildcraft/core/lib/inventory/InventoryIteratorSimple.java index 54f436feda..d2a77c2b5c 100644 --- a/common/buildcraft/core/lib/inventory/InventoryIteratorSimple.java +++ b/common/buildcraft/core/lib/inventory/InventoryIteratorSimple.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.inventory; import java.util.Iterator; diff --git a/common/buildcraft/core/lib/inventory/InventoryMapper.java b/common/buildcraft/core/lib/inventory/InventoryMapper.java index ed832521c0..4bc9c7837a 100644 --- a/common/buildcraft/core/lib/inventory/InventoryMapper.java +++ b/common/buildcraft/core/lib/inventory/InventoryMapper.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.inventory; import net.minecraft.entity.player.EntityPlayer; diff --git a/common/buildcraft/core/lib/inventory/InventoryWrapper.java b/common/buildcraft/core/lib/inventory/InventoryWrapper.java index 746cfbd90a..5afdb26fd6 100644 --- a/common/buildcraft/core/lib/inventory/InventoryWrapper.java +++ b/common/buildcraft/core/lib/inventory/InventoryWrapper.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.inventory; import net.minecraft.entity.player.EntityPlayer; @@ -44,7 +48,7 @@ public void setInventorySlotContents(int slotIndex, ItemStack itemstack) { inventory.setInventorySlotContents(slotIndex, itemstack); } - @Override + @Override public int getInventoryStackLimit() { return inventory.getInventoryStackLimit(); } diff --git a/common/buildcraft/core/lib/inventory/InventoryWrapperSimple.java b/common/buildcraft/core/lib/inventory/InventoryWrapperSimple.java index 2ae66e26de..5ad6333864 100644 --- a/common/buildcraft/core/lib/inventory/InventoryWrapperSimple.java +++ b/common/buildcraft/core/lib/inventory/InventoryWrapperSimple.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.inventory; import net.minecraft.inventory.IInventory; diff --git a/common/buildcraft/core/lib/inventory/SimpleInventory.java b/common/buildcraft/core/lib/inventory/SimpleInventory.java index af9a384a8a..b293c70480 100644 --- a/common/buildcraft/core/lib/inventory/SimpleInventory.java +++ b/common/buildcraft/core/lib/inventory/SimpleInventory.java @@ -1,5 +1,5 @@ /** 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.core.lib.inventory; diff --git a/common/buildcraft/core/lib/inventory/StackHelper.java b/common/buildcraft/core/lib/inventory/StackHelper.java index fad7865064..ca615f37fb 100644 --- a/common/buildcraft/core/lib/inventory/StackHelper.java +++ b/common/buildcraft/core/lib/inventory/StackHelper.java @@ -1,10 +1,15 @@ -/** 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 */ +/** + * 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.core.lib.inventory; import net.minecraft.item.ItemStack; + import net.minecraftforge.oredict.OreDictionary; import buildcraft.api.items.IList; @@ -14,7 +19,9 @@ public class StackHelper { protected StackHelper() {} /* STACK MERGING */ - /** Checks if two ItemStacks are identical enough to be merged + + /** + * Checks if two ItemStacks are identical enough to be merged * * @param stack1 - The first stack * @param stack2 - The second stack @@ -77,7 +84,9 @@ public static int mergeStacks(ItemStack mergeSource, ItemStack mergeTarget, bool } /* ITEM COMPARISONS */ - /** Determines whether the given ItemStack should be considered equivalent for crafting purposes. + /** + * Determines whether the given ItemStack should be considered equivalent + * for crafting purposes. * * @param base The stack to compare to. * @param comparison The stack to compare. @@ -120,7 +129,7 @@ public static boolean isCraftingEquivalent(int[] oreIDs, ItemStack comparison) { return false; } - public static boolean isMatchingItemOrList(ItemStack a, ItemStack b) { + public static boolean isMatchingItemOrList(final ItemStack a, final ItemStack b) { if (a == null || b == null) { return false; } @@ -141,13 +150,26 @@ public static boolean isMatchingItemOrList(ItemStack a, ItemStack b) { * * @param base The stack to compare to. * @param comparison The stack to compare. - * @return true if id, damage and NBT match. */ - public static boolean isMatchingItem(ItemStack base, ItemStack comparison) { - return isMatchingItem(base, comparison, true, true); - } - - /** Compares item id, and optionally damage and NBT. Accepts wildcard damage. Ignores damage entirely if the item - * doesn't have subtypes. + * @return true if id, damage and NBT match. + */ + public static boolean isMatchingItem(final ItemStack base, final ItemStack comparison) { + return isMatchingItem(base, comparison, true, true); + } + + /** + * This variant also checks damage for damaged items. + */ + public static boolean isEqualItem(final ItemStack a, final ItemStack b) { + if (isMatchingItem(a, b, false, true)) { + return isWildcard(a) || isWildcard(b) || a.getItemDamage() == b.getItemDamage(); + } else { + return false; + } + } + + /** + * Compares item id, and optionally damage and NBT. Accepts wildcard damage. + * Ignores damage entirely if the item doesn't have subtypes. * * @param a ItemStack * @param b ItemStack diff --git a/common/buildcraft/core/lib/inventory/Transactor.java b/common/buildcraft/core/lib/inventory/Transactor.java index f28a723dc5..9c2455d4c5 100644 --- a/common/buildcraft/core/lib/inventory/Transactor.java +++ b/common/buildcraft/core/lib/inventory/Transactor.java @@ -1,5 +1,5 @@ /** 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.core.lib.inventory; @@ -21,7 +21,6 @@ public ItemStack add(ItemStack stack, EnumFacing orientation, boolean doAdd) { public abstract int inject(ItemStack stack, EnumFacing orientation, boolean doAdd); public static ITransactor getTransactorFor(Object object) { - if (object instanceof ISidedInventory) { return new TransactorSimple((ISidedInventory) object); } else if (object instanceof IInventory) { diff --git a/common/buildcraft/core/lib/inventory/TransactorRoundRobin.java b/common/buildcraft/core/lib/inventory/TransactorRoundRobin.java index 3963e5e202..36b6dc8174 100644 --- a/common/buildcraft/core/lib/inventory/TransactorRoundRobin.java +++ b/common/buildcraft/core/lib/inventory/TransactorRoundRobin.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.inventory; import net.minecraft.inventory.IInventory; diff --git a/common/buildcraft/core/lib/inventory/TransactorSimple.java b/common/buildcraft/core/lib/inventory/TransactorSimple.java index 927485180e..e5a3645ef8 100644 --- a/common/buildcraft/core/lib/inventory/TransactorSimple.java +++ b/common/buildcraft/core/lib/inventory/TransactorSimple.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.inventory; import java.util.ArrayList; @@ -40,7 +44,9 @@ public int inject(ItemStack stack, EnumFacing orientation, boolean doAdd) { injected = tryPut(stack, filledSlots, injected, doAdd); injected = tryPut(stack, emptySlots, injected, doAdd); + if (injected > 0 && doAdd) { inventory.markDirty(); + } return injected; } diff --git a/common/buildcraft/core/lib/inventory/filters/AggregateFilter.java b/common/buildcraft/core/lib/inventory/filters/AggregateFilter.java index a79b0c0914..f91c991fc2 100644 --- a/common/buildcraft/core/lib/inventory/filters/AggregateFilter.java +++ b/common/buildcraft/core/lib/inventory/filters/AggregateFilter.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.inventory.filters; import net.minecraft.item.ItemStack; diff --git a/common/buildcraft/core/lib/inventory/filters/ArrayFluidFilter.java b/common/buildcraft/core/lib/inventory/filters/ArrayFluidFilter.java index 51b1a9db8f..48f722fcef 100755 --- a/common/buildcraft/core/lib/inventory/filters/ArrayFluidFilter.java +++ b/common/buildcraft/core/lib/inventory/filters/ArrayFluidFilter.java @@ -1,10 +1,15 @@ -/** 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 */ +/** + * 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.core.lib.inventory.filters; import net.minecraft.item.ItemStack; + import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidStack; diff --git a/common/buildcraft/core/lib/inventory/filters/ArrayStackFilter.java b/common/buildcraft/core/lib/inventory/filters/ArrayStackFilter.java index 75dd181019..49b318d65e 100644 --- a/common/buildcraft/core/lib/inventory/filters/ArrayStackFilter.java +++ b/common/buildcraft/core/lib/inventory/filters/ArrayStackFilter.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.inventory.filters; import net.minecraft.item.ItemStack; diff --git a/common/buildcraft/core/lib/inventory/filters/ArrayStackOrListFilter.java b/common/buildcraft/core/lib/inventory/filters/ArrayStackOrListFilter.java index 06bbc23c8e..8cfe58be3b 100755 --- a/common/buildcraft/core/lib/inventory/filters/ArrayStackOrListFilter.java +++ b/common/buildcraft/core/lib/inventory/filters/ArrayStackOrListFilter.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.inventory.filters; import net.minecraft.item.ItemStack; diff --git a/common/buildcraft/core/lib/inventory/filters/CompositeFilter.java b/common/buildcraft/core/lib/inventory/filters/CompositeFilter.java index 141fca1fc5..8a44c26145 100755 --- a/common/buildcraft/core/lib/inventory/filters/CompositeFilter.java +++ b/common/buildcraft/core/lib/inventory/filters/CompositeFilter.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.inventory.filters; import net.minecraft.item.ItemStack; diff --git a/common/buildcraft/core/lib/inventory/filters/CraftingFilter.java b/common/buildcraft/core/lib/inventory/filters/CraftingFilter.java index fe5c499a7a..c2d522d4a0 100644 --- a/common/buildcraft/core/lib/inventory/filters/CraftingFilter.java +++ b/common/buildcraft/core/lib/inventory/filters/CraftingFilter.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.inventory.filters; import net.minecraft.item.ItemStack; diff --git a/common/buildcraft/core/lib/inventory/filters/IFluidFilter.java b/common/buildcraft/core/lib/inventory/filters/IFluidFilter.java index 0c4c94b518..a4c29c08e6 100755 --- a/common/buildcraft/core/lib/inventory/filters/IFluidFilter.java +++ b/common/buildcraft/core/lib/inventory/filters/IFluidFilter.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.inventory.filters; import net.minecraftforge.fluids.Fluid; diff --git a/common/buildcraft/core/lib/inventory/filters/IStackFilter.java b/common/buildcraft/core/lib/inventory/filters/IStackFilter.java index 5631e03d14..968cd721d3 100644 --- a/common/buildcraft/core/lib/inventory/filters/IStackFilter.java +++ b/common/buildcraft/core/lib/inventory/filters/IStackFilter.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.inventory.filters; import net.minecraft.item.ItemStack; diff --git a/common/buildcraft/core/lib/inventory/filters/InvertedStackFilter.java b/common/buildcraft/core/lib/inventory/filters/InvertedStackFilter.java index 0fa62c7b42..74ea47e507 100644 --- a/common/buildcraft/core/lib/inventory/filters/InvertedStackFilter.java +++ b/common/buildcraft/core/lib/inventory/filters/InvertedStackFilter.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.inventory.filters; import net.minecraft.item.ItemStack; diff --git a/common/buildcraft/core/lib/inventory/filters/OreStackFilter.java b/common/buildcraft/core/lib/inventory/filters/OreStackFilter.java index ef8af08a54..9668b60247 100755 --- a/common/buildcraft/core/lib/inventory/filters/OreStackFilter.java +++ b/common/buildcraft/core/lib/inventory/filters/OreStackFilter.java @@ -1,10 +1,15 @@ -/** 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 */ +/** + * 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.core.lib.inventory.filters; import net.minecraft.item.ItemStack; + import net.minecraftforge.oredict.OreDictionary; /** Returns true if the stack matches any one one of the filter stacks. */ diff --git a/common/buildcraft/core/lib/inventory/filters/PassThroughFluidFilter.java b/common/buildcraft/core/lib/inventory/filters/PassThroughFluidFilter.java index 66e743827c..0f39566bbc 100755 --- a/common/buildcraft/core/lib/inventory/filters/PassThroughFluidFilter.java +++ b/common/buildcraft/core/lib/inventory/filters/PassThroughFluidFilter.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.inventory.filters; import net.minecraftforge.fluids.Fluid; diff --git a/common/buildcraft/core/lib/inventory/filters/PassThroughStackFilter.java b/common/buildcraft/core/lib/inventory/filters/PassThroughStackFilter.java index b5c435325a..1daeea4981 100755 --- a/common/buildcraft/core/lib/inventory/filters/PassThroughStackFilter.java +++ b/common/buildcraft/core/lib/inventory/filters/PassThroughStackFilter.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.inventory.filters; import net.minecraft.item.ItemStack; diff --git a/common/buildcraft/core/lib/inventory/filters/SimpleFluidFilter.java b/common/buildcraft/core/lib/inventory/filters/SimpleFluidFilter.java index 47b6cbd6e7..be13c630f1 100755 --- a/common/buildcraft/core/lib/inventory/filters/SimpleFluidFilter.java +++ b/common/buildcraft/core/lib/inventory/filters/SimpleFluidFilter.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.inventory.filters; import net.minecraftforge.fluids.Fluid; diff --git a/common/buildcraft/core/lib/inventory/filters/StackFilter.java b/common/buildcraft/core/lib/inventory/filters/StackFilter.java index 4ff1fb08f2..82587d5a54 100644 --- a/common/buildcraft/core/lib/inventory/filters/StackFilter.java +++ b/common/buildcraft/core/lib/inventory/filters/StackFilter.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.inventory.filters; import net.minecraft.item.ItemStack; diff --git a/common/buildcraft/core/lib/inventory/filters/StatementParameterStackFilter.java b/common/buildcraft/core/lib/inventory/filters/StatementParameterStackFilter.java index daf7cc7633..a5a763d07f 100755 --- a/common/buildcraft/core/lib/inventory/filters/StatementParameterStackFilter.java +++ b/common/buildcraft/core/lib/inventory/filters/StatementParameterStackFilter.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.inventory.filters; import java.util.ArrayList; diff --git a/common/buildcraft/core/lib/items/ItemBlockBuildCraft.java b/common/buildcraft/core/lib/items/ItemBlockBuildCraft.java index f14c04e7d1..e28ff95e5b 100644 --- a/common/buildcraft/core/lib/items/ItemBlockBuildCraft.java +++ b/common/buildcraft/core/lib/items/ItemBlockBuildCraft.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.items; import net.minecraft.block.Block; diff --git a/common/buildcraft/core/lib/items/ItemBuildCraft.java b/common/buildcraft/core/lib/items/ItemBuildCraft.java index 39d3236e6f..441525c52b 100644 --- a/common/buildcraft/core/lib/items/ItemBuildCraft.java +++ b/common/buildcraft/core/lib/items/ItemBuildCraft.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.items; import net.minecraft.creativetab.CreativeTabs; diff --git a/common/buildcraft/core/lib/network/IGuiReturnHandler.java b/common/buildcraft/core/lib/network/IGuiReturnHandler.java index b985bff856..22d4ccb071 100644 --- a/common/buildcraft/core/lib/network/IGuiReturnHandler.java +++ b/common/buildcraft/core/lib/network/IGuiReturnHandler.java @@ -1,5 +1,5 @@ /** 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.core.lib.network; @@ -9,7 +9,7 @@ import io.netty.buffer.ByteBuf; -public abstract interface IGuiReturnHandler { +public interface IGuiReturnHandler { World getWorld(); void writeGuiData(ByteBuf data); diff --git a/common/buildcraft/core/lib/network/ISyncedTile.java b/common/buildcraft/core/lib/network/ISyncedTile.java index c3ca1adfde..9ea95be4fe 100644 --- a/common/buildcraft/core/lib/network/ISyncedTile.java +++ b/common/buildcraft/core/lib/network/ISyncedTile.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.network; import buildcraft.api.core.ISerializable; diff --git a/common/buildcraft/core/lib/network/Packet.java b/common/buildcraft/core/lib/network/Packet.java new file mode 100644 index 0000000000..6647b4076c --- /dev/null +++ b/common/buildcraft/core/lib/network/Packet.java @@ -0,0 +1,22 @@ +/** + * 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.core.lib.network; + +import io.netty.buffer.ByteBuf; + +public abstract class Packet { + + protected boolean isChunkDataPacket = false; + + public abstract int getID(); + + public abstract void readData(ByteBuf data); + + public abstract void writeData(ByteBuf data); +} diff --git a/common/buildcraft/core/lib/network/PacketCoordinates.java b/common/buildcraft/core/lib/network/PacketCoordinates.java index bb35ee635b..af137e4dae 100644 --- a/common/buildcraft/core/lib/network/PacketCoordinates.java +++ b/common/buildcraft/core/lib/network/PacketCoordinates.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.network; import net.minecraft.tileentity.TileEntity; diff --git a/common/buildcraft/core/lib/network/PacketEntityUpdate.java b/common/buildcraft/core/lib/network/PacketEntityUpdate.java index 79ffbecc6b..de315d2646 100644 --- a/common/buildcraft/core/lib/network/PacketEntityUpdate.java +++ b/common/buildcraft/core/lib/network/PacketEntityUpdate.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.network; import net.minecraft.entity.Entity; diff --git a/common/buildcraft/core/lib/network/PacketGuiReturn.java b/common/buildcraft/core/lib/network/PacketGuiReturn.java index 35c7d14e14..98d6677831 100644 --- a/common/buildcraft/core/lib/network/PacketGuiReturn.java +++ b/common/buildcraft/core/lib/network/PacketGuiReturn.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.network; import net.minecraft.entity.Entity; @@ -16,6 +20,7 @@ import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; +// TODO: Rename to PacketGuiUpdate public class PacketGuiReturn extends Packet { private IGuiReturnHandler obj; private byte[] extraData; diff --git a/common/buildcraft/core/lib/network/PacketGuiWidget.java b/common/buildcraft/core/lib/network/PacketGuiWidget.java index 65db285f4c..820d9e806c 100644 --- a/common/buildcraft/core/lib/network/PacketGuiWidget.java +++ b/common/buildcraft/core/lib/network/PacketGuiWidget.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.network; import net.minecraft.entity.player.EntityPlayer; diff --git a/common/buildcraft/core/lib/network/PacketSlotChange.java b/common/buildcraft/core/lib/network/PacketSlotChange.java index 7daf034f09..c2effcdb82 100644 --- a/common/buildcraft/core/lib/network/PacketSlotChange.java +++ b/common/buildcraft/core/lib/network/PacketSlotChange.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.network; import net.minecraft.entity.player.EntityPlayer; diff --git a/common/buildcraft/core/lib/network/PacketTileState.java b/common/buildcraft/core/lib/network/PacketTileState.java index 52130b3161..144e4af66b 100644 --- a/common/buildcraft/core/lib/network/PacketTileState.java +++ b/common/buildcraft/core/lib/network/PacketTileState.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.network; import java.util.LinkedList; diff --git a/common/buildcraft/core/lib/network/PacketTileUpdate.java b/common/buildcraft/core/lib/network/PacketTileUpdate.java index e7ea3193df..b557c63d53 100644 --- a/common/buildcraft/core/lib/network/PacketTileUpdate.java +++ b/common/buildcraft/core/lib/network/PacketTileUpdate.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.network; import net.minecraft.entity.player.EntityPlayer; diff --git a/common/buildcraft/core/lib/network/PacketUpdate.java b/common/buildcraft/core/lib/network/PacketUpdate.java index 561bce33b2..27c352aed4 100644 --- a/common/buildcraft/core/lib/network/PacketUpdate.java +++ b/common/buildcraft/core/lib/network/PacketUpdate.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.network; import buildcraft.api.core.ISerializable; diff --git a/common/buildcraft/core/lib/network/Serializable.java b/common/buildcraft/core/lib/network/Serializable.java deleted file mode 100644 index c072f32197..0000000000 --- a/common/buildcraft/core/lib/network/Serializable.java +++ /dev/null @@ -1,17 +0,0 @@ -package buildcraft.core.lib.network; - -import buildcraft.api.core.ISerializable; - -import io.netty.buffer.ByteBuf; - -public class Serializable implements ISerializable { - @Override - public void readData(ByteBuf stream) { - - } - - @Override - public void writeData(ByteBuf stream) { - - } -} diff --git a/common/buildcraft/core/lib/network/command/CommandTarget.java b/common/buildcraft/core/lib/network/command/CommandTarget.java index 1705065f62..849ba80450 100644 --- a/common/buildcraft/core/lib/network/command/CommandTarget.java +++ b/common/buildcraft/core/lib/network/command/CommandTarget.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.network.command; import net.minecraft.entity.player.EntityPlayer; diff --git a/common/buildcraft/core/lib/network/command/CommandTargetContainer.java b/common/buildcraft/core/lib/network/command/CommandTargetContainer.java index 733e4a430a..1bb324cb01 100644 --- a/common/buildcraft/core/lib/network/command/CommandTargetContainer.java +++ b/common/buildcraft/core/lib/network/command/CommandTargetContainer.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.network.command; import net.minecraft.entity.player.EntityPlayer; @@ -14,8 +18,8 @@ public class CommandTargetContainer extends CommandTarget { @Override - public Class getHandledClass() { - return BuildCraftContainer.class; + public Class getHandledClass() { + return Container.class; } @Override diff --git a/common/buildcraft/core/lib/network/command/CommandTargetEntity.java b/common/buildcraft/core/lib/network/command/CommandTargetEntity.java index 27e7bd0f9a..f575236fd1 100644 --- a/common/buildcraft/core/lib/network/command/CommandTargetEntity.java +++ b/common/buildcraft/core/lib/network/command/CommandTargetEntity.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.network.command; import net.minecraft.entity.Entity; @@ -12,7 +16,7 @@ public class CommandTargetEntity extends CommandTarget { @Override - public Class getHandledClass() { + public Class getHandledClass() { return Entity.class; } diff --git a/common/buildcraft/core/lib/network/command/CommandTargetTile.java b/common/buildcraft/core/lib/network/command/CommandTargetTile.java index 53f9e0a42d..59b2105474 100644 --- a/common/buildcraft/core/lib/network/command/CommandTargetTile.java +++ b/common/buildcraft/core/lib/network/command/CommandTargetTile.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.network.command; import net.minecraft.entity.player.EntityPlayer; diff --git a/common/buildcraft/core/lib/network/command/CommandWriter.java b/common/buildcraft/core/lib/network/command/CommandWriter.java index a354631ec4..d0c48709a7 100644 --- a/common/buildcraft/core/lib/network/command/CommandWriter.java +++ b/common/buildcraft/core/lib/network/command/CommandWriter.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.network.command; import io.netty.buffer.ByteBuf; diff --git a/common/buildcraft/core/lib/network/command/ICommandReceiver.java b/common/buildcraft/core/lib/network/command/ICommandReceiver.java index 1f32fb53f9..81011a0faa 100644 --- a/common/buildcraft/core/lib/network/command/ICommandReceiver.java +++ b/common/buildcraft/core/lib/network/command/ICommandReceiver.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.network.command; import net.minecraftforge.fml.relauncher.Side; diff --git a/common/buildcraft/core/lib/network/command/PacketCommand.java b/common/buildcraft/core/lib/network/command/PacketCommand.java index e906862ded..de557c83ea 100644 --- a/common/buildcraft/core/lib/network/command/PacketCommand.java +++ b/common/buildcraft/core/lib/network/command/PacketCommand.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.network.command; import java.util.ArrayList; diff --git a/common/buildcraft/core/lib/render/DynamicTextureBC.java b/common/buildcraft/core/lib/render/DynamicTextureBC.java index 2ba2a134fa..d34c99edba 100644 --- a/common/buildcraft/core/lib/render/DynamicTextureBC.java +++ b/common/buildcraft/core/lib/render/DynamicTextureBC.java @@ -5,7 +5,6 @@ import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.texture.DynamicTexture; - import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/common/buildcraft/core/lib/render/EntityDropParticleFX.java b/common/buildcraft/core/lib/render/EntityDropParticleFX.java index 4988f078be..7d318f234e 100644 --- a/common/buildcraft/core/lib/render/EntityDropParticleFX.java +++ b/common/buildcraft/core/lib/render/EntityDropParticleFX.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.render; import net.minecraft.block.Block; diff --git a/common/buildcraft/core/lib/render/FluidRenderer.java b/common/buildcraft/core/lib/render/FluidRenderer.java index 67bdcd246d..9af52b4695 100644 --- a/common/buildcraft/core/lib/render/FluidRenderer.java +++ b/common/buildcraft/core/lib/render/FluidRenderer.java @@ -1,5 +1,5 @@ /** 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.core.lib.render; @@ -18,6 +18,7 @@ import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.EnumFacing; import net.minecraft.util.Vec3; + import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; @@ -107,9 +108,7 @@ public static TextureAtlasSprite getFluidTexture(Fluid fluid, FluidType type) { @Deprecated public static TextureAtlasSprite getFluidTexture(FluidStack fluidStack, boolean flowing) { - if (fluidStack == null) { - return null; - } + if (fluidStack == null) return null; return getFluidTexture(fluidStack.getFluid(), flowing); } diff --git a/common/buildcraft/core/lib/render/ICustomHighlight.java b/common/buildcraft/core/lib/render/ICustomHighlight.java index 86b2bf1135..ee4e2eaa97 100644 --- a/common/buildcraft/core/lib/render/ICustomHighlight.java +++ b/common/buildcraft/core/lib/render/ICustomHighlight.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.render; import net.minecraft.block.state.IBlockState; diff --git a/common/buildcraft/core/lib/render/IInventoryRenderer.java b/common/buildcraft/core/lib/render/IInventoryRenderer.java index 81b252ca50..b163ec3244 100644 --- a/common/buildcraft/core/lib/render/IInventoryRenderer.java +++ b/common/buildcraft/core/lib/render/IInventoryRenderer.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.render; /** This interface is used to provide special renders of tiles in the player inventory. */ diff --git a/common/buildcraft/core/lib/render/ModelFrustum.java b/common/buildcraft/core/lib/render/ModelFrustum.java index 120a7526c5..05f092d414 100644 --- a/common/buildcraft/core/lib/render/ModelFrustum.java +++ b/common/buildcraft/core/lib/render/ModelFrustum.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.render; import net.minecraft.client.model.ModelRenderer; @@ -97,8 +101,30 @@ public ModelFrustum(ModelRenderer par1ModelRenderer, int textureOffsetX, int tex int depth = Math.max(bottomDepth, topDepth); int width = Math.max(bottomWidth, topWidth); - this.quadList[0] = new TexturedQuad(new PositionTextureVertex[] { var19, var15, var16, var20 }, textureOffsetX + depth + width, textureOffsetY - + depth, textureOffsetX + depth + width + depth, textureOffsetY + depth + height, par1ModelRenderer.textureWidth, + this.quadList[0] = new TexturedQuad(new PositionTextureVertex[]{ + var19, var15, var16, var20}, textureOffsetX + depth + width, + textureOffsetY + depth, + textureOffsetX + depth + width + depth, textureOffsetY + depth + height, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight); + this.quadList[1] = new TexturedQuad(new PositionTextureVertex[]{ + var23, var18, var21, var17}, textureOffsetX, textureOffsetY + + depth, textureOffsetX + + depth, textureOffsetY + depth + height, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight); + this.quadList[2] = new TexturedQuad(new PositionTextureVertex[]{ + var19, var18, var23, var15}, textureOffsetX + depth, + textureOffsetY, textureOffsetX + + depth + width, textureOffsetY + depth, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight); + this.quadList[3] = new TexturedQuad(new PositionTextureVertex[]{ + var16, var17, var21, var20}, textureOffsetX + depth + width, + textureOffsetY + depth, + textureOffsetX + depth + width + width, textureOffsetY, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight); + this.quadList[4] = new TexturedQuad(new PositionTextureVertex[]{ + var15, var23, var17, var16}, textureOffsetX + depth, + textureOffsetY + depth, + textureOffsetX + depth + width, textureOffsetY + depth + height, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight); + this.quadList[5] = new TexturedQuad(new PositionTextureVertex[]{ + var18, var19, var20, var21}, textureOffsetX + depth + width + + depth, textureOffsetY + + depth, textureOffsetX + depth + width + depth + width, textureOffsetY + depth + height, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight); this.quadList[1] = new TexturedQuad(new PositionTextureVertex[] { var23, var18, var21, var17 }, textureOffsetX, textureOffsetY + depth, textureOffsetX + depth, textureOffsetY + depth + height, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight); diff --git a/common/buildcraft/core/lib/render/RenderEntityBlock.java b/common/buildcraft/core/lib/render/RenderEntityBlock.java index 0f284692fe..633d606a00 100644 --- a/common/buildcraft/core/lib/render/RenderEntityBlock.java +++ b/common/buildcraft/core/lib/render/RenderEntityBlock.java @@ -1,7 +1,11 @@ -/** Copyright (c) 2011-2014, 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 */ +/** + * 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.core.lib.render; import java.util.Arrays; @@ -23,6 +27,7 @@ import net.minecraft.init.Blocks; import net.minecraft.util.BlockPos; import net.minecraft.util.ResourceLocation; +import net.minecraft.world.EnumSkyBlock; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -35,6 +40,7 @@ public final class RenderEntityBlock extends Render { private RenderEntityBlock() { super(Minecraft.getMinecraft().getRenderManager()); + throw new IllegalStateException("DEPRECATED LOL"); } @Override @@ -58,7 +64,6 @@ public static class RenderInfo { public int brightness = -1; public RenderInfo() { - setRenderAllSides(); } public RenderInfo(IBlockState state, TextureAtlasSprite[] texture) { @@ -120,59 +125,11 @@ public void reverseZ() { @Override public void doRender(Entity entity, double i, double j, double k, float f, float f1) { doRenderBlock((EntityResizableCuboid) entity, i, j, k); + throw new IllegalStateException("DEPRECATED LOL"); } public void doRenderBlock(EntityResizableCuboid entity, double i, double j, double k) { - if (entity.isDead) { - return; - } - - shadowSize = entity.shadowSize; - World world = entity.worldObj; - RenderInfo util = new RenderInfo(); - if (entity.blockState != null) util.blockState = entity.blockState; - util.resource = entity.resource; - if (entity.texture != null) util.texture = entity.texture; - - for (int iBase = 0; iBase < entity.xSize; ++iBase) { - for (int jBase = 0; jBase < entity.ySize; ++jBase) { - for (int kBase = 0; kBase < entity.zSize; ++kBase) { - - util.minX = 0; - util.minY = 0; - util.minZ = 0; - - double remainX = entity.xSize - iBase; - double remainY = entity.ySize - jBase; - double remainZ = entity.zSize - kBase; - - util.maxX = remainX > 1.0 ? 1.0 : remainX; - util.maxY = remainY > 1.0 ? 1.0 : remainY; - util.maxZ = remainZ > 1.0 ? 1.0 : remainZ; - // GlStateManager.enableTexture2D(); - GlStateManager.enableRescaleNormal(); - GL11.glPushMatrix(); - GL11.glTranslatef((float) i, (float) j, (float) k); - GL11.glRotatef(entity.rotationX, 1, 0, 0); - GL11.glRotatef(entity.rotationY, 0, 1, 0); - GL11.glRotatef(entity.rotationZ, 0, 0, 1); - GL11.glTranslatef(iBase, jBase, kBase); - - int lightX, lightY, lightZ; - - lightX = (int) (Math.floor(entity.posX) + iBase); - lightY = (int) (Math.floor(entity.posY) + jBase); - lightZ = (int) (Math.floor(entity.posZ) + kBase); - - GL11.glDisable(GL11.GL_LIGHTING); - renderBlock(util, world, 0, 0, 0, new BlockPos(lightX, lightY, lightZ), false, true); - GL11.glEnable(GL11.GL_LIGHTING); - GL11.glPopMatrix(); - GlStateManager.disableRescaleNormal(); - - } - } - } + throw new IllegalStateException("DEPRECATED LOL"); } /** Render a render info by its state, ignoring any textures you might have set */ @@ -183,10 +140,12 @@ public void renderBlock(RenderInfo info) { worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); renderBlocks.getBlockModelRenderer().renderModelStandard(null, model, info.blockState.getBlock(), BlockPos.ORIGIN, worldRenderer, false); Tessellator.getInstance().draw(); + throw new IllegalStateException("DEPRECATED LOL"); } public void renderBlock(RenderInfo info, IBlockAccess blockAccess, int x, int y, int z, boolean doLight, boolean doTessellating) { renderBlock(info, blockAccess, x, y, z, new BlockPos(x, y, z), doLight, doTessellating); + throw new IllegalStateException("DEPRECATED LOL"); } /** Render 6 sides according to the lengths that have been set in the render info */ @@ -218,5 +177,6 @@ public void renderBlock(RenderInfo info, IBlockAccess blockAccess, double x, dou tessellator.draw(); GlStateManager.popMatrix(); + throw new IllegalStateException("DEPRECATED LOL"); } } diff --git a/common/buildcraft/core/lib/render/RenderUtils.java b/common/buildcraft/core/lib/render/RenderUtils.java index 268ef5a9bf..96303b36db 100644 --- a/common/buildcraft/core/lib/render/RenderUtils.java +++ b/common/buildcraft/core/lib/render/RenderUtils.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.render; import java.util.Map; diff --git a/common/buildcraft/core/lib/render/RenderVoid.java b/common/buildcraft/core/lib/render/RenderVoid.java index a20db712fb..63f9f39355 100644 --- a/common/buildcraft/core/lib/render/RenderVoid.java +++ b/common/buildcraft/core/lib/render/RenderVoid.java @@ -1,5 +1,5 @@ /** 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.core.lib.render; diff --git a/common/buildcraft/core/lib/render/TextureStateManager.java b/common/buildcraft/core/lib/render/TextureStateManager.java index 2216faa04e..1a087023d1 100644 --- a/common/buildcraft/core/lib/render/TextureStateManager.java +++ b/common/buildcraft/core/lib/render/TextureStateManager.java @@ -1,10 +1,15 @@ -/** 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 */ +/** + * 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.core.lib.render; import net.minecraft.client.renderer.texture.TextureAtlasSprite; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/common/buildcraft/core/lib/utils/Average.java b/common/buildcraft/core/lib/utils/AverageDouble.java similarity index 76% rename from common/buildcraft/core/lib/utils/Average.java rename to common/buildcraft/core/lib/utils/AverageDouble.java index 508296d4d6..19625301b2 100644 --- a/common/buildcraft/core/lib/utils/Average.java +++ b/common/buildcraft/core/lib/utils/AverageDouble.java @@ -1,15 +1,19 @@ -/** 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 */ +/** + * 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.core.lib.utils; -public class Average { +public class AverageDouble { private double[] data; private int pos, precise; private double averageRaw, tickValue; - public Average(int precise) { + public AverageDouble(int precise) { this.precise = precise; this.data = new double[precise]; this.pos = 0; diff --git a/common/buildcraft/core/lib/utils/AverageInt.java b/common/buildcraft/core/lib/utils/AverageInt.java new file mode 100644 index 0000000000..18cad4ee68 --- /dev/null +++ b/common/buildcraft/core/lib/utils/AverageInt.java @@ -0,0 +1,57 @@ +/** + * 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.core.lib.utils; + +public class AverageInt { + private int[] data; + private int pos, precise; + private int averageRaw, tickValue; + + public AverageInt(int precise) { + this.precise = precise; + clear(); + } + + public void clear() { + this.data = new int[precise]; + this.pos = 0; + } + + public double getAverage() { + return (double) averageRaw / precise; + } + + public void tick(int value) { + internalTick(tickValue + value); + tickValue = 0; + } + + public void tick() { + internalTick(tickValue); + tickValue = 0; + } + + private void internalTick(int value) { + pos = ++pos % precise; + int oldValue = data[pos]; + data[pos] = value; + if (pos == 0) { + averageRaw = 0; + for (int iValue : data) { + averageRaw += iValue; + } + } else { + averageRaw = averageRaw - oldValue + value; + } + } + + public void push(int value) { + tickValue += value; + } +} diff --git a/common/buildcraft/core/lib/utils/BitSetUtils.java b/common/buildcraft/core/lib/utils/BitSetUtils.java index 11ab53aa16..75347b0b6c 100644 --- a/common/buildcraft/core/lib/utils/BitSetUtils.java +++ b/common/buildcraft/core/lib/utils/BitSetUtils.java @@ -3,32 +3,31 @@ import java.util.BitSet; public final class BitSetUtils { + private BitSetUtils() { - private BitSetUtils() { + } - } + public static BitSet fromByteArray(byte[] bytes) { + BitSet bits = new BitSet(bytes.length * 8); + for (int i = 0; i < bytes.length * 8; i++) { + if ((bytes[i / 8] & (1 << (i % 8))) != 0) { + bits.set(i); + } + } + return bits; + } - public static BitSet fromByteArray(byte[] bytes) { - BitSet bits = new BitSet(bytes.length * 8); - for (int i = 0; i < bytes.length * 8; i++) { - if ((bytes[i / 8] & (1 << (i % 8))) != 0) { - bits.set(i); - } - } - return bits; - } + public static byte[] toByteArray(BitSet bits) { + return toByteArray(bits, (bits.size() + 7) >> 3); + } - public static byte[] toByteArray(BitSet bits) { - return toByteArray(bits, (bits.size() + 7) >> 3); - } - - public static byte[] toByteArray(BitSet bits, int sizeInBytes) { - byte[] bytes = new byte[sizeInBytes]; - for (int i = 0; i < bits.length(); i++) { - if (bits.get(i)) { - bytes[i / 8] |= 1 << (i % 8); - } - } - return bytes; - } + public static byte[] toByteArray(BitSet bits, int sizeInBytes) { + byte[] bytes = new byte[sizeInBytes]; + for (int i = 0; i < bits.length(); i++) { + if (bits.get(i)) { + bytes[i / 8] |= 1 << (i % 8); + } + } + return bytes; + } } diff --git a/common/buildcraft/core/lib/utils/BlockMiner.java b/common/buildcraft/core/lib/utils/BlockMiner.java index a71c621fe0..71797436e6 100644 --- a/common/buildcraft/core/lib/utils/BlockMiner.java +++ b/common/buildcraft/core/lib/utils/BlockMiner.java @@ -10,6 +10,7 @@ import net.minecraft.util.BlockPos; import net.minecraft.world.World; import net.minecraft.world.WorldServer; + import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.world.BlockEvent; @@ -72,7 +73,12 @@ public void invalidate() { } public int acceptEnergy(int offeredAmount) { - energyRequired = BlockUtils.computeBlockBreakEnergy(world, pos); + if (BlockUtils.isUnbreakableBlock(world, pos)) { + hasFailed = true; + return 0; + } + + energyRequired = BlockUtils.computeBlockBreakEnergy(world, pos); int usedAmount = MathUtils.clamp(offeredAmount, 0, Math.max(0, energyRequired - energyAccepted)); energyAccepted += usedAmount; @@ -101,8 +107,7 @@ public int acceptEnergy(int offeredAmount) { world.playAuxSFXAtEntity(null, 2001, pos, Block.getStateId(state)); - Utils.preDestroyBlock(world, pos); - world.setBlockToAir(pos); + world.setBlockToAir(pos); } else { hasFailed = true; } diff --git a/common/buildcraft/core/lib/utils/BlockScanner.java b/common/buildcraft/core/lib/utils/BlockScanner.java index 669b2208a3..e8947d6fea 100755 --- a/common/buildcraft/core/lib/utils/BlockScanner.java +++ b/common/buildcraft/core/lib/utils/BlockScanner.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.utils; import java.util.Iterator; diff --git a/common/buildcraft/core/lib/utils/BlockUtils.java b/common/buildcraft/core/lib/utils/BlockUtils.java index 0556dc6cbe..70e983323f 100644 --- a/common/buildcraft/core/lib/utils/BlockUtils.java +++ b/common/buildcraft/core/lib/utils/BlockUtils.java @@ -1,5 +1,5 @@ /** 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.core.lib.utils; @@ -16,12 +16,16 @@ import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.network.play.server.S27PacketExplosion; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityChest; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.Explosion; import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.Chunk.EnumCreateEntityType; + import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.ForgeEventFactory; import net.minecraftforge.event.world.BlockEvent.BreakEvent; @@ -32,13 +36,11 @@ import net.minecraftforge.fluids.IFluidBlock; import net.minecraftforge.fml.common.FMLCommonHandler; -import buildcraft.api.blueprints.BuilderAPI; import buildcraft.BuildCraftCore; +import buildcraft.api.blueprints.BuilderAPI; import buildcraft.core.proxy.CoreProxy; public final class BlockUtils { - private static Chunk lastChunk; - /** Deactivate constructor */ private BlockUtils() {} @@ -79,6 +81,38 @@ public static boolean breakBlock(WorldServer world, BlockPos pos, int forcedLife return false; } + public static boolean harvestBlock(WorldServer world, BlockPos pos, ItemStack tool) { + BreakEvent breakEvent = new BreakEvent(world, pos, world.getBlockState(pos), CoreProxy.proxy.getBuildCraftPlayer(world).get()); + MinecraftForge.EVENT_BUS.post(breakEvent); + + if (breakEvent.isCanceled()) { + return false; + } + + IBlockState state = world.getBlockState(pos); + + EntityPlayer player = CoreProxy.proxy.getBuildCraftPlayer(world, pos).get(); + int i = 0; + while (player.getHeldItem() != tool && i < 9) { + if (i > 0) { + player.inventory.setInventorySlotContents(i - 1, null); + } + + player.inventory.setInventorySlotContents(i, tool); + i++; + } + + if (!state.getBlock().canHarvestBlock(world, pos, player)) { + return false; + } + + state.getBlock().onBlockHarvested(world, pos, state, player); + state.getBlock().harvestBlock(world, player, pos, state, world.getTileEntity(pos)); + world.setBlockToAir(pos); + + return true; + } + public static boolean breakBlock(WorldServer world, BlockPos pos, List drops) { BreakEvent breakEvent = new BreakEvent(world, pos, world.getBlockState(pos), CoreProxy.proxy.getBuildCraftPlayer(world).get()); MinecraftForge.EVENT_BUS.post(breakEvent); @@ -108,46 +142,58 @@ public static void dropItem(WorldServer world, BlockPos pos, int forcedLifespan, world.spawnEntityInWorld(entityitem); } - public static boolean isAnObstructingBlock(Block block, World world, BlockPos pos) { - if (block == null || block.isAir(world, pos)) { - return false; - } - return true; - } - public static boolean canChangeBlock(World world, BlockPos pos) { return canChangeBlock(world.getBlockState(pos), world, pos); } public static boolean canChangeBlock(IBlockState state, World world, BlockPos pos) { - if (state == null) - return true; + if (state == null) return true; Block block = state.getBlock(); if (block == null || block.isAir(world, pos)) { return true; } - if (block.getBlockHardness(world, pos) < 0) { + if (isUnbreakableBlock(world, pos, block)) { return false; } - // TODO: Make this support all "heavy" liquids, not just oil/lava - if (block instanceof IFluidBlock && ((IFluidBlock) block).getFluid() != null && "oil".equals(((IFluidBlock) block).getFluid().getName())) { + if (block == Blocks.lava || block == Blocks.flowing_lava) { return false; + } else if (block instanceof IFluidBlock && ((IFluidBlock) block).getFluid() != null) { + Fluid f = ((IFluidBlock) block).getFluid(); + if (f.getDensity(world, pos) >= 3000) { + return false; + } } - if (block == Blocks.lava || block == Blocks.flowing_lava) { + return true; + } + + public static float getBlockHardnessMining(World world, BlockPos pos, Block b) { + if (world instanceof WorldServer && !BuildCraftCore.miningAllowPlayerProtectedBlocks) { + float relativeHardness = b.getPlayerRelativeBlockHardness(CoreProxy.proxy.getBuildCraftPlayer((WorldServer) world).get(), world, pos); + if (relativeHardness <= 0.0F) { // Forge's getPlayerRelativeBlockHardness hook returns 0.0F if the hardness + // is < 0.0F. + return -1.0F; + } else { + return relativeHardness; + } + } else { + return b.getBlockHardness(world, pos); + } + } + + public static boolean isUnbreakableBlock(World world, BlockPos pos, Block b) { + if (b == null) { return false; } - return true; + return getBlockHardnessMining(world, pos, b) < 0; } public static boolean isUnbreakableBlock(World world, BlockPos pos) { - Block b = world.getBlockState(pos).getBlock(); - - return b != null && b.getBlockHardness(world, pos) < 0; + return isUnbreakableBlock(world, pos, world.getBlockState(pos).getBlock()); } /** Returns true if a block cannot be harvested without a tool. */ @@ -231,7 +277,8 @@ public static void explodeBlock(World world, BlockPos pos) { } if (player.getDistanceSq(pos) < 4096) { - ((EntityPlayerMP) player).playerNetServerHandler.sendPacket(new S27PacketExplosion(x, y, z, 3f, explosion.getAffectedBlockPositions(), null)); + ((EntityPlayerMP) player).playerNetServerHandler.sendPacket(new S27PacketExplosion(x, y, z, 3f, explosion.getAffectedBlockPositions(), + null)); } } } @@ -242,37 +289,19 @@ public static int computeBlockBreakEnergy(World world, BlockPos pos) { } /** The following functions let you avoid unnecessary chunk loads, which is nice. */ - - private static Chunk getChunkUnforced(World world, int x, int z) { - Chunk chunk = lastChunk; - if (chunk != null) { - if (chunk.isLoaded()) { - if (chunk.getWorld() == world && chunk.xPosition == x && chunk.zPosition == z) { - return chunk; - } - } else { - lastChunk = null; - } - } - - chunk = world.getChunkProvider().chunkExists(x, z) ? world.getChunkProvider().provideChunk(x, z) : null; - lastChunk = chunk; - return chunk; - } - - public static Block getBlock(World world, BlockPos pos) { - return getBlock(world, pos, false); + public static TileEntity getTileEntity(World world, BlockPos pos) { + return getTileEntity(world, pos, false); } - public static Block getBlock(World world, BlockPos pos, boolean force) { + public static TileEntity getTileEntity(World world, BlockPos pos, boolean force) { if (!force) { if (pos.getY() < 0 || pos.getY() > 255) { - return Blocks.air; + return null; } - Chunk chunk = getChunkUnforced(world, pos.getX() >> 4, pos.getZ() >> 4); - return chunk != null ? chunk.getBlock(pos.getX() & 15, pos.getY(), pos.getZ() & 15) : Blocks.air; + Chunk chunk = ThreadSafeUtils.getChunk(world, pos.getX() >> 4, pos.getZ() >> 4); + return chunk != null ? chunk.getTileEntity(pos, EnumCreateEntityType.CHECK) : null; } else { - return world.getBlockState(pos).getBlock(); + return world.getTileEntity(pos); } } @@ -281,13 +310,17 @@ public static IBlockState getBlockState(World world, BlockPos pos) { } public static IBlockState getBlockState(World world, BlockPos pos, boolean force) { - if (force) { - return world.getBlockState(pos); + if (!force) { + if (pos.getY() < 0 || pos.getY() >= world.getHeight()) { + return Blocks.air.getDefaultState(); + } + Chunk chunk = ThreadSafeUtils.getChunk(world, pos.getX() >> 4, pos.getZ() >> 4); + return chunk != null ? chunk.getBlockState(pos) : Blocks.air.getDefaultState(); } else { if (pos.getY() < 0 || pos.getY() > 255) { return Blocks.air.getDefaultState(); } - Chunk chunk = getChunkUnforced(world, pos.getX() >> 4, pos.getZ() >> 4); + Chunk chunk = ThreadSafeUtils.getChunk(world, pos.getX() >> 4, pos.getZ() >> 4); return chunk != null ? chunk.getBlockState(pos) : Blocks.air.getDefaultState(); } } @@ -318,4 +351,35 @@ public static boolean useItemOnBlock(World world, EntityPlayer player, ItemStack } return done; } + + public static void onComparatorUpdate(World world, BlockPos pos, Block block) { + world.updateComparatorOutputLevel(pos, block); + } + + public static TileEntityChest getOtherDoubleChest(TileEntity inv) { + if (inv instanceof TileEntityChest) { + TileEntityChest chest = (TileEntityChest) inv; + + TileEntityChest adjacent = null; + + if (chest.adjacentChestXNeg != null) { + adjacent = chest.adjacentChestXNeg; + } + + if (chest.adjacentChestXPos != null) { + adjacent = chest.adjacentChestXPos; + } + + if (chest.adjacentChestZNeg != null) { + adjacent = chest.adjacentChestZNeg; + } + + if (chest.adjacentChestZPos != null) { + adjacent = chest.adjacentChestZPos; + } + + return adjacent; + } + return null; + } } diff --git a/common/buildcraft/core/lib/utils/ColorUtils.java b/common/buildcraft/core/lib/utils/ColorUtils.java index b46036a53c..6ded85b29f 100644 --- a/common/buildcraft/core/lib/utils/ColorUtils.java +++ b/common/buildcraft/core/lib/utils/ColorUtils.java @@ -1,11 +1,16 @@ -/** 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 */ +/** + * 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.core.lib.utils; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; + import net.minecraftforge.oredict.OreDictionary; public final class ColorUtils { diff --git a/common/buildcraft/core/lib/utils/CraftingUtils.java b/common/buildcraft/core/lib/utils/CraftingUtils.java index 6f7adb11fa..e77119c99d 100644 --- a/common/buildcraft/core/lib/utils/CraftingUtils.java +++ b/common/buildcraft/core/lib/utils/CraftingUtils.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.utils; import java.util.ArrayList; @@ -61,12 +65,12 @@ public static IRecipe findMatchingRecipe(InventoryCrafting par1InventoryCrafting ingredients.add(item2); return new ShapelessRecipes(new ItemStack(item1.getItem(), 1, newDamage), ingredients); - } else { + } else if (itemNum > 0) { // End repair recipe handler List recipes = CraftingManager.getInstance().getRecipeList(); - for (int index = 0; index < recipes.size(); ++index) { - IRecipe currentRecipe = (IRecipe) recipes.get(index); + for (Object recipe : recipes) { + IRecipe currentRecipe = (IRecipe) recipe; if (currentRecipe.matches(par1InventoryCrafting, par2World)) { return currentRecipe; @@ -74,6 +78,10 @@ public static IRecipe findMatchingRecipe(InventoryCrafting par1InventoryCrafting } return null; + } else { + // No items - no recipe! + + return null; } } diff --git a/common/buildcraft/core/lib/utils/FluidUtils.java b/common/buildcraft/core/lib/utils/FluidUtils.java index 946f93e708..8898372988 100644 --- a/common/buildcraft/core/lib/utils/FluidUtils.java +++ b/common/buildcraft/core/lib/utils/FluidUtils.java @@ -1,10 +1,12 @@ package buildcraft.core.lib.utils; import net.minecraft.block.Block; +import net.minecraft.init.Blocks; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidContainerRegistry; +import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidBlock; import net.minecraftforge.fluids.IFluidContainerItem; @@ -23,8 +25,14 @@ public static FluidStack getFluidStackFromItemStack(ItemStack stack) { return FluidContainerRegistry.getFluidForFilledItem(stack); } else if (stack.getItem() instanceof ItemBlock) { Block b = Block.getBlockFromItem(stack.getItem()); - if (b != null && b instanceof IFluidBlock && ((IFluidBlock) b).getFluid() != null) { + if (b != null) { + if (b instanceof IFluidBlock && ((IFluidBlock) b).getFluid() != null) { return new FluidStack(((IFluidBlock) b).getFluid(), 1000); + } else if (b == Blocks.lava) { + return new FluidStack(FluidRegistry.getFluid("lava"), 1000); + } else if (b == Blocks.water) { + return new FluidStack(FluidRegistry.getFluid("water"), 1000); + } } } } diff --git a/common/buildcraft/core/lib/utils/IBlockFilter.java b/common/buildcraft/core/lib/utils/IBlockFilter.java index f611805cb4..b6c34caf23 100755 --- a/common/buildcraft/core/lib/utils/IBlockFilter.java +++ b/common/buildcraft/core/lib/utils/IBlockFilter.java @@ -1,5 +1,5 @@ /** 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.core.lib.utils; @@ -8,7 +8,5 @@ import net.minecraft.world.World; public interface IBlockFilter { - boolean matches(World world, BlockPos pos); - } diff --git a/common/buildcraft/core/lib/utils/IEntityFilter.java b/common/buildcraft/core/lib/utils/IEntityFilter.java index 6486fcdb90..d993f053a0 100755 --- a/common/buildcraft/core/lib/utils/IEntityFilter.java +++ b/common/buildcraft/core/lib/utils/IEntityFilter.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.utils; import net.minecraft.entity.Entity; diff --git a/common/buildcraft/core/lib/utils/IIterableAlgorithm.java b/common/buildcraft/core/lib/utils/IIterableAlgorithm.java index c32d2ed42e..1f6a4a9bf7 100644 --- a/common/buildcraft/core/lib/utils/IIterableAlgorithm.java +++ b/common/buildcraft/core/lib/utils/IIterableAlgorithm.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.utils; public interface IIterableAlgorithm { diff --git a/common/buildcraft/core/lib/utils/IterableAlgorithmRunner.java b/common/buildcraft/core/lib/utils/IterableAlgorithmRunner.java index 1c6acd373f..813bd99814 100755 --- a/common/buildcraft/core/lib/utils/IterableAlgorithmRunner.java +++ b/common/buildcraft/core/lib/utils/IterableAlgorithmRunner.java @@ -1,5 +1,5 @@ /** 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.core.lib.utils; @@ -34,13 +34,12 @@ public void run() { } long startTime = new Date().getTime(); - long elapsedtime = 0; pathFinding.iterate(); - elapsedtime = new Date().getTime() - startTime; - double timeToWait = elapsedtime * 1.5; - sleep((long) timeToWait); + long elapsedTime = new Date().getTime() - startTime; + int timeToWait = (int) MathUtils.clamp((int) Math.ceil(elapsedTime * 1.5), 1, 500); + sleep(timeToWait); } } catch (Throwable t) { t.printStackTrace(); diff --git a/common/buildcraft/core/lib/utils/MathUtils.java b/common/buildcraft/core/lib/utils/MathUtils.java index 94b6498c74..4f0cc3d595 100644 --- a/common/buildcraft/core/lib/utils/MathUtils.java +++ b/common/buildcraft/core/lib/utils/MathUtils.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.utils; public final class MathUtils { diff --git a/common/buildcraft/core/lib/utils/MatrixTranformations.java b/common/buildcraft/core/lib/utils/MatrixTranformations.java index c140a21f6a..e275576e7f 100644 --- a/common/buildcraft/core/lib/utils/MatrixTranformations.java +++ b/common/buildcraft/core/lib/utils/MatrixTranformations.java @@ -1,13 +1,15 @@ /** 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.core.lib.utils; -import java.util.Arrays; +import javax.vecmath.Matrix4f; import net.minecraft.util.EnumFacing; +/** Use {@link Matrix4f} goddammit! */ +@Deprecated public final class MatrixTranformations { /** Deactivate constructor */ diff --git a/common/buildcraft/core/lib/utils/NBTUtils.java b/common/buildcraft/core/lib/utils/NBTUtils.java index 2ed41cb946..dde84e2e88 100644 --- a/common/buildcraft/core/lib/utils/NBTUtils.java +++ b/common/buildcraft/core/lib/utils/NBTUtils.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.utils; import java.io.ByteArrayInputStream; diff --git a/common/buildcraft/core/lib/utils/PathFinding.java b/common/buildcraft/core/lib/utils/PathFinding.java index f2f7aff786..108b2ca9b5 100755 --- a/common/buildcraft/core/lib/utils/PathFinding.java +++ b/common/buildcraft/core/lib/utils/PathFinding.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.utils; import java.util.ArrayList; diff --git a/common/buildcraft/core/lib/utils/PathFindingSearch.java b/common/buildcraft/core/lib/utils/PathFindingSearch.java index 11dbaca0f7..d3dda14b41 100644 --- a/common/buildcraft/core/lib/utils/PathFindingSearch.java +++ b/common/buildcraft/core/lib/utils/PathFindingSearch.java @@ -1,15 +1,10 @@ /** 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.core.lib.utils; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; +import java.util.*; import net.minecraft.util.BlockPos; import net.minecraft.world.World; @@ -19,9 +14,9 @@ public class PathFindingSearch implements IIterableAlgorithm { - public static int PATH_ITERATIONS = 1000; + public static final int PATH_ITERATIONS = 1000; - private static HashMap> reservations = new HashMap>(); + private static final HashMap> reservations = new HashMap>(); private World world; private BlockPos start; @@ -109,7 +104,7 @@ public void iteratePathFind(int itNumber) { if (pathFinding.isDone()) { LinkedList path = pathFinding.getResult(); if (path != null && path.size() > 0) { - if (reserve(path.getLast())) { + if (reserve(pathFinding.end())) { return; } } diff --git a/common/buildcraft/core/lib/utils/ResourceUtils.java b/common/buildcraft/core/lib/utils/ResourceUtils.java index 5c6cf302ca..c7a8d75269 100644 --- a/common/buildcraft/core/lib/utils/ResourceUtils.java +++ b/common/buildcraft/core/lib/utils/ResourceUtils.java @@ -44,6 +44,10 @@ private ResourceUtils() { * @param objectName * @return */ public static String getObjectPrefix(String objectName) { + if (objectName == null) { + return null; + } + int splitLocation = objectName.indexOf(":"); return objectName.substring(0, splitLocation).replaceAll("[^a-zA-Z0-9\\s]", "") + objectName.substring(splitLocation); } diff --git a/common/buildcraft/core/lib/utils/RevolvingList.java b/common/buildcraft/core/lib/utils/RevolvingList.java index fcf303e5bd..074daae5a8 100644 --- a/common/buildcraft/core/lib/utils/RevolvingList.java +++ b/common/buildcraft/core/lib/utils/RevolvingList.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.utils; import java.util.Collection; diff --git a/common/buildcraft/core/lib/utils/SessionVars.java b/common/buildcraft/core/lib/utils/SessionVars.java index 0b8cd0f5ab..788458ac05 100644 --- a/common/buildcraft/core/lib/utils/SessionVars.java +++ b/common/buildcraft/core/lib/utils/SessionVars.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.utils; public final class SessionVars { diff --git a/common/buildcraft/energy/worldgen/SimplexNoise.java b/common/buildcraft/core/lib/utils/SimplexNoise.java similarity index 97% rename from common/buildcraft/energy/worldgen/SimplexNoise.java rename to common/buildcraft/core/lib/utils/SimplexNoise.java index 0980c816ee..91e12c20fc 100644 --- a/common/buildcraft/energy/worldgen/SimplexNoise.java +++ b/common/buildcraft/core/lib/utils/SimplexNoise.java @@ -1,8 +1,4 @@ -/** 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.energy.worldgen; +package buildcraft.core.lib.utils; /** A speed-improved simplex noise algorithm for 2D, 3D and 4D in Java. * diff --git a/common/buildcraft/core/lib/utils/StringUtils.java b/common/buildcraft/core/lib/utils/StringUtils.java index bb15491c7c..24ed7a2cd9 100644 --- a/common/buildcraft/core/lib/utils/StringUtils.java +++ b/common/buildcraft/core/lib/utils/StringUtils.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.utils; import com.google.common.base.Splitter; diff --git a/common/buildcraft/core/lib/utils/ThreadSafeUtils.java b/common/buildcraft/core/lib/utils/ThreadSafeUtils.java new file mode 100644 index 0000000000..535638d278 --- /dev/null +++ b/common/buildcraft/core/lib/utils/ThreadSafeUtils.java @@ -0,0 +1,44 @@ +package buildcraft.core.lib.utils; + +import net.minecraft.world.ChunkCoordIntPair; +import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.IChunkProvider; +import net.minecraft.world.gen.ChunkProviderServer; + +public final class ThreadSafeUtils { + private static final ThreadLocal lastChunk = new ThreadLocal(); + + private ThreadSafeUtils() { + + } + + public static Chunk getChunk(World world, int x, int z) { + Chunk chunk; + chunk = lastChunk.get(); + + if (chunk != null) { + if (chunk.isLoaded()) { + if (chunk.getWorld() == world && chunk.xPosition == x && chunk.zPosition == z) { + return chunk; + } + } else { + lastChunk.set(null); + } + } + + IChunkProvider provider = world.getChunkProvider(); + // These probably won't guarantee full thread safety, but it's our best bet. + if (!Utils.CAULDRON_DETECTED && provider instanceof ChunkProviderServer) { + // Slight optimization + chunk = (Chunk) ((ChunkProviderServer) provider).id2ChunkMap.getValueByKey(ChunkCoordIntPair.chunkXZ2Int(x, z)); + } else { + chunk = provider.chunkExists(x, z) ? provider.provideChunk(x, z) : null; + } + + if (chunk != null) { + lastChunk.set(chunk); + } + return chunk; + } +} diff --git a/common/buildcraft/core/lib/utils/Utils.java b/common/buildcraft/core/lib/utils/Utils.java index 72f136310f..bc426c1933 100644 --- a/common/buildcraft/core/lib/utils/Utils.java +++ b/common/buildcraft/core/lib/utils/Utils.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.lib.utils; import java.util.ArrayList; @@ -43,6 +47,7 @@ import buildcraft.api.core.IAreaProvider; import buildcraft.api.power.IEngine; +import buildcraft.api.power.ILaserTarget; import buildcraft.api.tiles.ITileAreaProvider; import buildcraft.api.transport.IInjectable; import buildcraft.api.transport.IPipeTile; @@ -55,6 +60,7 @@ import buildcraft.core.lib.inventory.ITransactor; import buildcraft.core.lib.inventory.InvUtils; import buildcraft.core.lib.inventory.Transactor; +import buildcraft.core.lib.network.Packet; public final class Utils { // Commonly used vectors @@ -92,10 +98,21 @@ public final class Utils { } } - /** Deactivate constructor */ - private Utils() {} + public static boolean isRegistered(Block block) { + return block != null && Block.getIdFromBlock(block) >= 0; + } - /** Tries to add the passed stack to any valid inventories around the given coordinates. + public static boolean isRegistered(Item item) { + return item != null && Item.getIdFromItem(item) >= 0; + } + + public static boolean isRegistered(ItemStack stack) { + return stack != null && isRegistered(stack.getItem()); + } + + /** + * Tries to add the passed stack to any valid inventories around the given + * coordinates. * * @param stack * @param world diff --git a/common/buildcraft/core/lib/utils/XorShift128Random.java b/common/buildcraft/core/lib/utils/XorShift128Random.java index 0d33a30c35..6537cef2b8 100644 --- a/common/buildcraft/core/lib/utils/XorShift128Random.java +++ b/common/buildcraft/core/lib/utils/XorShift128Random.java @@ -2,11 +2,14 @@ import java.util.Random; -/** Based on http://xorshift.di.unimi.it/xorshift128plus.c */ +/** + * Based on http://xorshift.di.unimi.it/xorshift128plus.c + * TODO: This thing ought to have tests! + */ public class XorShift128Random { private static final Random seed = new Random(); private static final double DOUBLE_UNIT = 0x1.0p-53; - private long[] s = new long[2]; + private final long[] s = new long[2]; public XorShift128Random() { s[0] = seed.nextLong(); @@ -23,7 +26,7 @@ public long nextLong() { } public int nextInt() { - return (int) (nextLong() & 0xFFFFFFFF); + return (int) nextLong(); } public boolean nextBoolean() { @@ -31,7 +34,8 @@ public boolean nextBoolean() { } public int nextInt(int size) { - return (int) (nextLong() % size); + int nl = (int) nextLong(); + return nl < 0 ? ((nl + 0x80000000) % size) : (nl % size); } public double nextDouble() { diff --git a/common/buildcraft/core/lib/world/FakeWorld.java b/common/buildcraft/core/lib/world/FakeWorld.java index fd8b7a1efa..d1cf085e63 100644 --- a/common/buildcraft/core/lib/world/FakeWorld.java +++ b/common/buildcraft/core/lib/world/FakeWorld.java @@ -70,7 +70,7 @@ public FakeWorld(Template template, IBlockState filledBlock) { for (BlockPos pos : Utils.allInBoxIncludingCorners(start, end)) { BlockPos array = pos.subtract(start); - SchematicBlockBase block = template.contents[array.getX()][array.getY()][array.getZ()]; + SchematicBlockBase block = template.get(array.getX(), array.getY(), array.getZ()); if (block != null) { setBlockState(pos, filledBlock); diff --git a/common/buildcraft/core/list/ContainerListNew.java b/common/buildcraft/core/list/ContainerListNew.java new file mode 100755 index 0000000000..a8a0885a47 --- /dev/null +++ b/common/buildcraft/core/list/ContainerListNew.java @@ -0,0 +1,107 @@ +/** + * 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.core.list; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +import net.minecraftforge.fml.relauncher.Side; + +import buildcraft.BuildCraftCore; +import buildcraft.core.ItemList; +import buildcraft.core.lib.gui.BuildCraftContainer; +import buildcraft.core.lib.network.command.CommandWriter; +import buildcraft.core.lib.network.command.ICommandReceiver; +import buildcraft.core.lib.network.command.PacketCommand; +import buildcraft.core.lib.utils.NetworkUtils; + +import io.netty.buffer.ByteBuf; + +public class ContainerListNew extends BuildCraftContainer implements ICommandReceiver { + public ListHandlerNew.Line[] lines; + private EntityPlayer player; + + public ContainerListNew(EntityPlayer iPlayer) { + super(iPlayer, iPlayer.inventory.getSizeInventory()); + + player = iPlayer; + + lines = ListHandlerNew.getLines(player.getCurrentEquippedItem()); + + for (int sy = 0; sy < 3; sy++) { + for (int sx = 0; sx < 9; sx++) { + addSlotToContainer(new Slot(player.inventory, sx + sy * 9 + 9, 8 + sx * 18, 103 + sy * 18)); + } + } + + for (int sx = 0; sx < 9; sx++) { + addSlotToContainer(new Slot(player.inventory, sx, 8 + sx * 18, 161)); + } + } + + @Override + public boolean canInteractWith(EntityPlayer player) { + return true; + } + + public void setStack(final int lineIndex, final int slotIndex, final ItemStack stack) { + lines[lineIndex].setStack(slotIndex, stack); + ListHandlerNew.saveLines(player.getCurrentEquippedItem(), lines); + + if (player.worldObj.isRemote) { + BuildCraftCore.instance.sendToServer(new PacketCommand(this, "setStack", new CommandWriter() { + public void write(ByteBuf data) { + data.writeByte(lineIndex); + data.writeByte(slotIndex); + NetworkUtils.writeStack(data, stack); + } + })); + } + } + + public void switchButton(final int lineIndex, final int button) { + lines[lineIndex].toggleOption(button); + ListHandlerNew.saveLines(player.getCurrentEquippedItem(), lines); + + if (player.worldObj.isRemote) { + BuildCraftCore.instance.sendToServer(new PacketCommand(this, "switchButton", new CommandWriter() { + public void write(ByteBuf data) { + data.writeByte(lineIndex); + data.writeByte(button); + } + })); + } + } + + public void setLabel(final String text) { + ItemList.saveLabel(player.getCurrentEquippedItem(), text); + + if (player.worldObj.isRemote) { + BuildCraftCore.instance.sendToServer(new PacketCommand(this, "setLabel", new CommandWriter() { + public void write(ByteBuf data) { + NetworkUtils.writeUTF(data, text); + } + })); + } + } + + @Override + public void receiveCommand(String command, Side side, Object sender, ByteBuf stream) { + if (side.isServer()) { + if ("setLabel".equals(command)) { + setLabel(NetworkUtils.readUTF(stream)); + } else if ("switchButton".equals(command)) { + switchButton(stream.readUnsignedByte(), stream.readUnsignedByte()); + } else if ("setStack".equals(command)) { + setStack(stream.readUnsignedByte(), stream.readUnsignedByte(), NetworkUtils.readStack(stream)); + } + } + } +} diff --git a/common/buildcraft/core/gui/ContainerList.java b/common/buildcraft/core/list/ContainerListOld.java similarity index 88% rename from common/buildcraft/core/gui/ContainerList.java rename to common/buildcraft/core/list/ContainerListOld.java index 2f57137ddd..fd7ba009ff 100755 --- a/common/buildcraft/core/gui/ContainerList.java +++ b/common/buildcraft/core/list/ContainerListOld.java @@ -1,12 +1,13 @@ /** 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.core.gui; +package buildcraft.core.list; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; + import net.minecraftforge.fml.relauncher.Side; import buildcraft.BuildCraftCore; @@ -19,17 +20,17 @@ import io.netty.buffer.ByteBuf; -public class ContainerList extends BuildCraftContainer implements ICommandReceiver { +public class ContainerListOld extends BuildCraftContainer implements ICommandReceiver { - public ItemList.StackLine[] lines; + public ListHandlerOld.StackLine[] lines; private EntityPlayer player; - public ContainerList(EntityPlayer iPlayer) { + public ContainerListOld(EntityPlayer iPlayer) { super(iPlayer, iPlayer.inventory.getSizeInventory()); player = iPlayer; - lines = ItemList.getLines(player.getCurrentEquippedItem()); + lines = ListHandlerOld.getLines(player.getCurrentEquippedItem()); for (int sy = 0; sy < 3; sy++) { for (int sx = 0; sx < 9; sx++) { @@ -49,7 +50,7 @@ public boolean canInteractWith(EntityPlayer player) { public void setStack(final int lineIndex, final int slotIndex, final ItemStack stack) { lines[lineIndex].setStack(slotIndex, stack); - ItemList.saveLine(player.getCurrentEquippedItem(), lines[lineIndex], lineIndex); + ListHandlerOld.saveLine(player.getCurrentEquippedItem(), lines[lineIndex], lineIndex); if (player.worldObj.isRemote) { BuildCraftCore.instance.sendToServer(new PacketCommand(this, "setStack", new CommandWriter() { @@ -71,7 +72,7 @@ public void switchButton(final int lineIndex, final int button) { lines[lineIndex].oreWildcard = !lines[lineIndex].oreWildcard; } - ItemList.saveLine(player.getCurrentEquippedItem(), lines[lineIndex], lineIndex); + ListHandlerOld.saveLine(player.getCurrentEquippedItem(), lines[lineIndex], lineIndex); if (player.worldObj.isRemote) { BuildCraftCore.instance.sendToServer(new PacketCommand(this, "switchButton", new CommandWriter() { diff --git a/common/buildcraft/core/list/GuiListNew.java b/common/buildcraft/core/list/GuiListNew.java new file mode 100755 index 0000000000..935ddb04a3 --- /dev/null +++ b/common/buildcraft/core/list/GuiListNew.java @@ -0,0 +1,231 @@ +/** 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.core.list; + +import java.io.IOException; +import java.util.*; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiTextField; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; + +import buildcraft.BuildCraftCore; +import buildcraft.api.lists.ListMatchHandler; +import buildcraft.core.ItemList; +import buildcraft.core.lib.gui.AdvancedSlot; +import buildcraft.core.lib.gui.GuiAdvancedInterface; +import buildcraft.core.lib.gui.buttons.GuiImageButton; +import buildcraft.core.lib.gui.buttons.IButtonClickEventListener; +import buildcraft.core.lib.gui.buttons.IButtonClickEventTrigger; +import buildcraft.core.lib.inventory.StackHelper; + +public class GuiListNew extends GuiAdvancedInterface implements IButtonClickEventListener { + private static final ResourceLocation TEXTURE_BASE = new ResourceLocation("buildcraftcore:textures/gui/list_new.png"); + private static final int BUTTON_COUNT = 3; + + private final Map>> exampleCache = + new HashMap>>(); + private GuiTextField textField; + private EntityPlayer player; + + private static class ListSlot extends AdvancedSlot { + public int lineIndex; + public int slotIndex; + + public ListSlot(GuiAdvancedInterface gui, int x, int y, int iLineIndex, int iSlotIndex) { + super(gui, x, y); + + lineIndex = iLineIndex; + slotIndex = iSlotIndex; + } + + @Override + public ItemStack getItemStack() { + ContainerListNew container = (ContainerListNew) gui.getContainer(); + if (slotIndex == 0 || !container.lines[lineIndex].isOneStackMode()) { + return container.lines[lineIndex].getStack(slotIndex); + } else { + List data = ((GuiListNew) gui).getExamplesList(lineIndex, container.lines[lineIndex].getSortingType()); + if (data.size() >= slotIndex) { + return data.get(slotIndex - 1); + } else { + return null; + } + } + } + + @Override + public void drawSprite(int cornerX, int cornerY) { + if (!shouldDrawHighlight()) { + Minecraft.getMinecraft().renderEngine.bindTexture(TEXTURE_BASE); + gui.drawTexturedModalRect(cornerX + x, cornerY + y, 176, 0, 16, 16); + } + + super.drawSprite(cornerX, cornerY); + } + + @Override + public boolean shouldDrawHighlight() { + ContainerListNew container = (ContainerListNew) gui.getContainer(); + return slotIndex == 0 || !container.lines[lineIndex].isOneStackMode(); + } + } + + public GuiListNew(EntityPlayer iPlayer) { + super(new ContainerListNew(iPlayer), iPlayer.inventory, TEXTURE_BASE); + + xSize = 176; + ySize = 191; + + player = iPlayer; + } + + private void clearExamplesCache(int lineId) { + Map> exampleList = exampleCache.get(lineId); + if (exampleList != null) { + exampleList.clear(); + } + } + + private List getExamplesList(int lineId, ListMatchHandler.Type type) { + Map> exampleList = exampleCache.get(lineId); + if (exampleList == null) { + exampleList = new EnumMap>(ListMatchHandler.Type.class); + exampleCache.put(lineId, exampleList); + } + + ContainerListNew container = (ContainerListNew) getContainer(); + + if (!exampleList.containsKey(type)) { + List examples = container.lines[lineId].getExamples(); + ItemStack input = container.lines[lineId].stacks[0]; + if (input != null) { + List repetitions = new ArrayList(); + for (ItemStack is : examples) { + if (StackHelper.isMatchingItem(input, is, true, false)) { + repetitions.add(is); + } + } + examples.removeAll(repetitions); + } + exampleList.put(type, examples); + } + return exampleList.get(type); + } + + @Override + public void initGui() { + super.initGui(); + + exampleCache.clear(); + slots.clear(); + buttonList.clear(); + + for (int sy = 0; sy < ListHandlerNew.HEIGHT; sy++) { + for (int sx = 0; sx < ListHandlerNew.WIDTH; sx++) { + slots.add(new ListSlot(this, 8 + sx * 18, 32 + sy * 33, sy, sx)); + } + int bOff = sy * BUTTON_COUNT; + int bOffX = this.guiLeft + 8 + ListHandlerNew.WIDTH * 18 - BUTTON_COUNT * 11; + int bOffY = this.guiTop + 32 + sy * 33 + 18; + + buttonList.add(new GuiImageButton(bOff + 0, bOffX, bOffY, 11, TEXTURE_BASE, 176, 16, 176, 28)); + buttonList.add(new GuiImageButton(bOff + 1, bOffX + 11, bOffY, 11, TEXTURE_BASE, 176, 16, 185, 28)); + buttonList.add(new GuiImageButton(bOff + 2, bOffX + 22, bOffY, 11, TEXTURE_BASE, 176, 16, 194, 28)); + } + + for (Object o : buttonList) { + GuiImageButton b = (GuiImageButton) o; + int lineId = b.id / BUTTON_COUNT; + int buttonId = b.id % BUTTON_COUNT; + if (((ContainerListNew) getContainer()).lines[lineId].getOption(buttonId)) { + b.activate(); + } + + b.registerListener(this); + } + + textField = new GuiTextField(6, this.fontRendererObj, 10, 10, 156, 12); + textField.setMaxStringLength(32); + textField.setText(BuildCraftCore.listItem.getLabel(player.getCurrentEquippedItem())); + textField.setFocused(false); + } + + @Override + protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { + super.drawGuiContainerBackgroundLayer(f, x, y); + + ContainerListNew containerL = (ContainerListNew) getContainer(); + for (int i = 0; i < 2; i++) { + if (containerL.lines[i].isOneStackMode()) { + drawTexturedModalRect(guiLeft + 6, guiTop + 30 + i * 33, 0, ySize, 20, 20); + } + } + + drawBackgroundSlots(x, y); + } + + @Override + protected void drawGuiContainerForegroundLayer(int par1, int par2) { + super.drawGuiContainerForegroundLayer(par1, par2); + + textField.drawTextBox(); + drawTooltipForSlotAt(par1, par2); + } + + private boolean isCarryingNonEmptyList() { + ItemStack stack = mc.thePlayer.inventory.getItemStack(); + return stack != null && stack.getItem() instanceof ItemList && stack.getTagCompound() != null; + } + + private boolean hasListEquipped() { + return mc.thePlayer.getCurrentEquippedItem() != null && mc.thePlayer.getCurrentEquippedItem().getItem() instanceof ItemList; + } + + @Override + protected void mouseClicked(int x, int y, int b) throws IOException { + super.mouseClicked(x, y, b); + + if (isCarryingNonEmptyList() || !hasListEquipped()) { + return; + } + + AdvancedSlot slot = getSlotAtLocation(x, y); + ContainerListNew container = (ContainerListNew) getContainer(); + + if (slot instanceof ListSlot) { + container.setStack(((ListSlot) slot).lineIndex, ((ListSlot) slot).slotIndex, mc.thePlayer.inventory.getItemStack()); + clearExamplesCache(((ListSlot) slot).lineIndex); + } + + textField.mouseClicked(x - guiLeft, y - guiTop, b); + } + + @Override + public void handleButtonClick(IButtonClickEventTrigger sender, int id) { + int buttonId = id % BUTTON_COUNT; + int lineId = id / BUTTON_COUNT; + + ContainerListNew container = (ContainerListNew) getContainer(); + container.switchButton(lineId, buttonId); + clearExamplesCache(lineId); + } + + @Override + protected void keyTyped(char c, int i) throws IOException { + if (textField.isFocused()) { + if (c == 13 || c == 27) { + textField.setFocused(false); + } else { + textField.textboxKeyTyped(c, i); + ((ContainerListNew) container).setLabel(textField.getText()); + } + } else { + super.keyTyped(c, i); + } + } +} diff --git a/common/buildcraft/core/gui/GuiList.java b/common/buildcraft/core/list/GuiListOld.java similarity index 82% rename from common/buildcraft/core/gui/GuiList.java rename to common/buildcraft/core/list/GuiListOld.java index efe489db3e..3b2124d062 100755 --- a/common/buildcraft/core/gui/GuiList.java +++ b/common/buildcraft/core/list/GuiListOld.java @@ -1,8 +1,12 @@ -/** 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.core.gui; +/** + * 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.core.list; import java.io.IOException; @@ -16,7 +20,7 @@ import buildcraft.core.lib.gui.AdvancedSlot; import buildcraft.core.lib.gui.GuiAdvancedInterface; -public class GuiList extends GuiAdvancedInterface { +public class GuiListOld extends GuiAdvancedInterface { private static final ResourceLocation TEXTURE_BASE = new ResourceLocation("buildcraftcore:textures/gui/list.png"); @@ -34,13 +38,9 @@ public MainSlot(GuiAdvancedInterface gui, int x, int y, int iLineIndex) { @Override public ItemStack getItemStack() { - ContainerList container = (ContainerList) gui.getContainer(); + ContainerListOld container = (ContainerListOld) gui.getContainer(); - if (container.lines[lineIndex].getStack(0) != null) { return container.lines[lineIndex].getStack(0); - } else { - return null; - } } } @@ -57,17 +57,13 @@ public SecondarySlot(GuiAdvancedInterface gui, int x, int y, int iLineIndex, int @Override public ItemStack getItemStack() { - ContainerList container = (ContainerList) gui.getContainer(); + ContainerListOld container = (ContainerListOld) gui.getContainer(); if (slotIndex == 6 && container.lines[lineIndex].getStack(7) != null) { return null; } - if (container.lines[lineIndex].getStack(slotIndex) != null) { return container.lines[lineIndex].getStack(slotIndex); - } else { - return null; - } } } @@ -91,16 +87,16 @@ public String getDescription() { } } - public GuiList(EntityPlayer iPlayer) { - super(new ContainerList(iPlayer), iPlayer.inventory, TEXTURE_BASE); + public GuiListOld(EntityPlayer iPlayer) { + super(new ContainerListOld(iPlayer), iPlayer.inventory, TEXTURE_BASE); xSize = 176; ySize = 241; - for (int sy = 0; sy < 6; ++sy) { + for (int sy = 0; sy < 6; sy++) { slots.add(new MainSlot(this, 44, 31 + sy * 18, sy)); - for (int sx = 1; sx < 7; ++sx) { + for (int sx = 1; sx < 7; sx++) { slots.add(new SecondarySlot(this, 44 + sx * 18, 31 + sy * 18, sy, sx)); } @@ -125,7 +121,7 @@ public void initGui() { protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { super.drawGuiContainerBackgroundLayer(f, x, y); - ContainerList container = (ContainerList) getContainer(); + ContainerListOld container = (ContainerListOld) getContainer(); bindTexture(TEXTURE_BASE); @@ -151,7 +147,7 @@ protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { } } - drawBackgroundSlots(); + drawBackgroundSlots(x, y); bindTexture(TEXTURE_BASE); @@ -189,7 +185,7 @@ protected void mouseClicked(int x, int y, int b) throws IOException { } AdvancedSlot slot = getSlotAtLocation(x, y); - ContainerList container = (ContainerList) getContainer(); + ContainerListOld container = (ContainerListOld) getContainer(); if (slot instanceof MainSlot) { container.setStack(((MainSlot) slot).lineIndex, 0, mc.thePlayer.inventory.getItemStack()); @@ -211,9 +207,7 @@ protected void keyTyped(char c, int i) throws IOException { textField.setFocused(false); } else { textField.textboxKeyTyped(c, i); - ((ContainerList) container).setLabel(textField.getText()); - // RPCHandler.rpcServer(architect, "handleClientSetName", - // textField.getText()); + ((ContainerListOld) container).setLabel(textField.getText()); } } else { super.keyTyped(c, i); diff --git a/common/buildcraft/core/list/ListHandlerNew.java b/common/buildcraft/core/list/ListHandlerNew.java new file mode 100644 index 0000000000..f0ef75c8f5 --- /dev/null +++ b/common/buildcraft/core/list/ListHandlerNew.java @@ -0,0 +1,222 @@ +package buildcraft.core.list; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; + +import buildcraft.api.lists.ListMatchHandler; +import buildcraft.api.lists.ListRegistry; +import buildcraft.core.lib.inventory.StackHelper; +import buildcraft.core.lib.utils.NBTUtils; + +public final class ListHandlerNew { + public static final int WIDTH = 9; + public static final int HEIGHT = 2; + + public static class Line { + public final ItemStack[] stacks; + public boolean precise, byType, byMaterial; + + public Line() { + stacks = new ItemStack[WIDTH]; + } + + public boolean isOneStackMode() { + return byType || byMaterial; + } + + public boolean getOption(int id) { + return id == 0 ? precise : (id == 1 ? byType : byMaterial); + } + + public void toggleOption(int id) { + if (byType == false && byMaterial == false && (id == 1 || id == 2)) { + for (int i = 1; i < stacks.length; i++) { + stacks[i] = null; + } + } + switch (id) { + case 0: + precise = !precise; + break; + case 1: + byType = !byType; + break; + case 2: + byMaterial = !byMaterial; + break; + } + } + + public boolean matches(ItemStack target) { + if (byType || byMaterial) { + if (stacks[0] == null) { + return false; + } + + List handlers = ListRegistry.getHandlers(); + ListMatchHandler.Type type = getSortingType(); + for (ListMatchHandler h : handlers) { + if (h.matches(type, stacks[0], target, precise)) { + return true; + } + } + } else { + for (ItemStack s : stacks) { + if (s != null && StackHelper.isMatchingItem(s, target, true, precise)) { + // If precise, re-check damage + if (!precise || s.getItemDamage() == target.getItemDamage()) { + return true; + } + } + } + } + return false; + } + + public ListMatchHandler.Type getSortingType() { + return byType ? (byMaterial ? ListMatchHandler.Type.CLASS : ListMatchHandler.Type.TYPE) : ListMatchHandler.Type.MATERIAL; + } + + public static Line fromNBT(NBTTagCompound data) { + Line line = new Line(); + + if (data != null && data.hasKey("st")) { + NBTTagList l = data.getTagList("st", 10); + for (int i = 0; i < l.tagCount(); i++) { + line.stacks[i] = ItemStack.loadItemStackFromNBT(l.getCompoundTagAt(i)); + } + + line.precise = data.getBoolean("Fp"); + line.byType = data.getBoolean("Ft"); + line.byMaterial = data.getBoolean("Fm"); + } + + return line; + } + + public NBTTagCompound toNBT() { + NBTTagCompound data = new NBTTagCompound(); + NBTTagList stackList = new NBTTagList(); + for (ItemStack stack1 : stacks) { + NBTTagCompound stack = new NBTTagCompound(); + if (stack1 != null) { + stack1.writeToNBT(stack); + } + stackList.appendTag(stack); + } + data.setTag("st", stackList); + data.setBoolean("Fp", precise); + data.setBoolean("Ft", byType); + data.setBoolean("Fm", byMaterial); + return data; + } + + public void setStack(int slotIndex, ItemStack stack) { + if (slotIndex == 0 || (!byType && !byMaterial)) { + if (stack != null && stack.getItem() != null) { + stacks[slotIndex] = stack.copy(); + stacks[slotIndex].stackSize = 1; + } else { + stacks[slotIndex] = null; + } + } + } + + public ItemStack getStack(int i) { + return i >= 0 && i < stacks.length ? stacks[i] : null; + } + + public List getExamples() { + List stackList = new ArrayList(); + if (stacks[0] != null) { + List handlers = ListRegistry.getHandlers(); + List handlersCustom = new ArrayList(); + ListMatchHandler.Type type = getSortingType(); + for (ListMatchHandler h : handlers) { + if (h.isValidSource(type, stacks[0])) { + List examples = h.getClientExamples(type, stacks[0]); + if (examples != null) { + stackList.addAll(examples); + } else { + handlersCustom.add(h); + } + } + } + if (handlersCustom.size() > 0) { + for (Object o : Item.itemRegistry) { + if (o != null && o instanceof Item) { + Item i = (Item) o; + List examples = new ArrayList(); + i.getSubItems(i, CreativeTabs.tabMisc, examples); + for (ItemStack s : examples) { + for (ListMatchHandler mh : handlersCustom) { + if (mh.matches(type, stacks[0], s, false)) { + stackList.add(s); + break; + } + } + } + } + } + } + + Collections.shuffle(stackList); + } + return stackList; + } + } + + private ListHandlerNew() { + + } + + public static Line[] getLines(ItemStack item) { + NBTTagCompound data = NBTUtils.getItemData(item); + if (data.hasKey("written") && data.hasKey("lines")) { + NBTTagList list = data.getTagList("lines", 10); + Line[] lines = new Line[list.tagCount()]; + for (int i = 0; i < lines.length; i++) { + lines[i] = Line.fromNBT(list.getCompoundTagAt(i)); + } + return lines; + } else { + Line[] lines = new Line[HEIGHT]; + for (int i = 0; i < lines.length; i++) { + lines[i] = new Line(); + } + return lines; + } + } + + public static void saveLines(ItemStack stackList, Line[] lines) { + NBTTagCompound data = NBTUtils.getItemData(stackList); + data.setBoolean("written", true); + NBTTagList lineList = new NBTTagList(); + for (Line l : lines) { + lineList.appendTag(l.toNBT()); + } + data.setTag("lines", lineList); + } + + public static boolean matches(ItemStack stackList, ItemStack item) { + NBTTagCompound data = NBTUtils.getItemData(stackList); + if (data.hasKey("written") && data.hasKey("lines")) { + NBTTagList list = data.getTagList("lines", 10); + for (int i = 0; i < list.tagCount(); i++) { + Line line = Line.fromNBT(list.getCompoundTagAt(i)); + if (line.matches(item)) { + return true; + } + } + } + + return false; + } +} diff --git a/common/buildcraft/core/list/ListHandlerOld.java b/common/buildcraft/core/list/ListHandlerOld.java new file mode 100644 index 0000000000..fba218bd8e --- /dev/null +++ b/common/buildcraft/core/list/ListHandlerOld.java @@ -0,0 +1,249 @@ +package buildcraft.core.list; + +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.WeakHashMap; + +import net.minecraft.block.Block; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +import net.minecraftforge.fml.common.FMLCommonHandler; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.oredict.OreDictionary; + +import buildcraft.core.lib.inventory.StackHelper; +import buildcraft.core.lib.utils.NBTUtils; + +public final class ListHandlerOld { + private static final WeakHashMap LINE_CACHE = new WeakHashMap(); + + public static class StackLine { + public boolean oreWildcard = false; + public boolean subitemsWildcard = false; + public boolean isOre; + + private ItemStack[] stacks = new ItemStack[7]; + private ArrayList ores = new ArrayList(); + private ArrayList relatedItems = new ArrayList(); + + public ItemStack getStack(int index) { + if (index == 0 || (!oreWildcard && !subitemsWildcard)) { + if (index < 7) { + return stacks[index]; + } else { + return null; + } + } else if (oreWildcard) { + if (ores.size() >= index) { + return ores.get(index - 1); + } else { + return null; + } + } else { + if (relatedItems.size() >= index) { + return relatedItems.get(index - 1); + } else { + return null; + } + } + } + + public void setStack(int slot, ItemStack stack) { + stacks[slot] = stack; + + if (stack != null) { + stacks[slot] = stacks[slot].copy(); + stacks[slot].stackSize = 1; + } + + if (slot == 0) { + relatedItems.clear(); + ores.clear(); + + if (stack == null) { + isOre = false; + } else { + if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) { + setClientPreviewLists(); + } else { + isOre = OreDictionary.getOreIDs(stacks[0]).length > 0; + } + } + } + } + + public void writeToNBT(NBTTagCompound nbt) { + nbt.setBoolean("ore", oreWildcard); + nbt.setBoolean("sub", subitemsWildcard); + + for (int i = 0; i < 7; ++i) { + if (stacks[i] != null) { + NBTTagCompound stackNBT = new NBTTagCompound(); + stacks[i].writeToNBT(stackNBT); + nbt.setTag("stacks[" + i + "]", stackNBT); + } + } + } + + public void readFromNBT(NBTTagCompound nbt) { + oreWildcard = nbt.getBoolean("ore"); + subitemsWildcard = nbt.getBoolean("sub"); + + for (int i = 0; i < 7; ++i) { + if (nbt.hasKey("stacks[" + i + "]")) { + setStack(i, ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("stacks[" + i + "]"))); + } + } + } + + private boolean classMatch(Item base, Item matched) { + if (base.getClass() == Item.class) { + return base == matched; + } else if (base.getClass() == matched.getClass()) { + if (base instanceof ItemBlock) { + Block baseBlock = ((ItemBlock) base).block; + Block matchedBlock = ((ItemBlock) matched).block; + + if (baseBlock.getClass() == Block.class) { + return baseBlock == matchedBlock; + } else { + return baseBlock.equals(matchedBlock); + } + } else { + return true; + } + } else { + return false; + } + } + + private boolean oreMatch(ItemStack base, ItemStack matched) { + int[] oreIds = OreDictionary.getOreIDs(base); + int[] matchesIds = OreDictionary.getOreIDs(matched); + + for (int stackId : oreIds) { + for (int matchId : matchesIds) { + if (stackId == matchId) { + return true; + } + } + } + + return false; + } + + private void setClientPreviewLists() { + Item baseItem = stacks[0].getItem(); + + int[] oreIds = OreDictionary.getOreIDs(stacks[0]); + + isOre = oreIds.length > 0; + + for (Object o : Item.itemRegistry) { + Item item = (Item) o; + boolean classMatch = classMatch(baseItem, item); + + List list = new LinkedList(); + + for (CreativeTabs tab : item.getCreativeTabs()) { + item.getSubItems(item, tab, list); + } + + if (list.size() > 0) { + for (Object ol : list) { + ItemStack stack = (ItemStack) ol; + + if (classMatch && relatedItems.size() <= 7 && !StackHelper.isMatchingItemOrList(stacks[0], stack)) { + relatedItems.add(stack); + } + + if (isOre && ores.size() <= 7 && !StackHelper.isMatchingItemOrList(stacks[0], stack) && oreMatch(stacks[0], stack)) { + ores.add(stack); + } + } + } + } + } + + public boolean matches(ItemStack item) { + if (subitemsWildcard) { + if (stacks[0] == null) { + return false; + } + + return classMatch(stacks[0].getItem(), item.getItem()); + } else if (oreWildcard) { + if (stacks[0] == null) { + return false; + } + + return oreMatch(stacks[0], item); + } else { + for (ItemStack stack : stacks) { + if (stack != null && StackHelper.isMatchingItem(stack, item, true, false)) { + return true; + } + } + + return false; + } + } + } + + private ListHandlerOld() { + + } + + public static void saveLine(ItemStack stack, StackLine line, int index) { + NBTTagCompound nbt = NBTUtils.getItemData(stack); + + nbt.setBoolean("written", true); + + NBTTagCompound lineNBT = new NBTTagCompound(); + line.writeToNBT(lineNBT); + nbt.setTag("line[" + index + "]", lineNBT); + } + + public static StackLine[] getLines(ItemStack stack) { + if (LINE_CACHE.containsKey(stack)) { + return LINE_CACHE.get(stack); + } + + StackLine[] result = new StackLine[6]; + + for (int i = 0; i < 6; ++i) { + result[i] = new StackLine(); + } + + NBTTagCompound nbt = NBTUtils.getItemData(stack); + + if (nbt.hasKey("written")) { + for (int i = 0; i < 6; ++i) { + result[i].readFromNBT(nbt.getCompoundTag("line[" + i + "]")); + } + } + + LINE_CACHE.put(stack, result); + + return result; + } + + public static boolean matches(ItemStack stackList, ItemStack item) { + StackLine[] lines = getLines(stackList); + + if (lines != null) { + for (StackLine line : lines) { + if (line != null && line.matches(item)) { + return true; + } + } + } + + return false; + } +} diff --git a/common/buildcraft/core/list/ListMatchHandlerArmor.java b/common/buildcraft/core/list/ListMatchHandlerArmor.java new file mode 100644 index 0000000000..1948f3a775 --- /dev/null +++ b/common/buildcraft/core/list/ListMatchHandlerArmor.java @@ -0,0 +1,48 @@ +package buildcraft.core.list; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; + +import net.minecraftforge.common.DimensionManager; + +import buildcraft.api.lists.ListMatchHandler; +import buildcraft.core.proxy.CoreProxy; + +public class ListMatchHandlerArmor extends ListMatchHandler { + private int getArmorTypeID(ItemStack stack) { + EntityPlayer player = CoreProxy.proxy.getClientPlayer(); + if (player == null) { + player = CoreProxy.proxy.getBuildCraftPlayer(DimensionManager.getWorld(0)).get(); + } + int atID = 0; + + for (int i = 0; i <= 3; i++) { + if (stack.getItem().isValidArmor(stack, i, player)) { + atID |= 1 << i; + } + } + + return atID; + } + + @Override + public boolean matches(Type type, ItemStack stack, ItemStack target, boolean precise) { + if (type == Type.TYPE) { + int armorTypeIDSource = getArmorTypeID(stack); + if (armorTypeIDSource > 0) { + int armorTypeIDTarget = getArmorTypeID(target); + if (precise) { + return armorTypeIDSource == armorTypeIDTarget; + } else { + return (armorTypeIDSource & armorTypeIDTarget) != 0; + } + } + } + return false; + } + + @Override + public boolean isValidSource(Type type, ItemStack stack) { + return getArmorTypeID(stack) > 0; + } +} diff --git a/common/buildcraft/core/list/ListMatchHandlerClass.java b/common/buildcraft/core/list/ListMatchHandlerClass.java new file mode 100644 index 0000000000..b8f7692863 --- /dev/null +++ b/common/buildcraft/core/list/ListMatchHandlerClass.java @@ -0,0 +1,26 @@ +package buildcraft.core.list; + +import net.minecraft.item.ItemStack; + +import buildcraft.api.lists.ListMatchHandler; +import buildcraft.api.lists.ListRegistry; + +public class ListMatchHandlerClass extends ListMatchHandler { + @Override + public boolean matches(Type type, ItemStack stack, ItemStack target, boolean precise) { + if (type == Type.TYPE) { + Class kl = stack.getItem().getClass(); + return ListRegistry.itemClassAsType.contains(kl) && kl.equals(target.getClass()); + } + return false; + } + + @Override + public boolean isValidSource(Type type, ItemStack stack) { + if (type == Type.TYPE) { + Class kl = stack.getItem().getClass(); + return ListRegistry.itemClassAsType.contains(kl); + } + return false; + } +} diff --git a/common/buildcraft/core/list/ListMatchHandlerFluid.java b/common/buildcraft/core/list/ListMatchHandlerFluid.java new file mode 100644 index 0000000000..f89949e09d --- /dev/null +++ b/common/buildcraft/core/list/ListMatchHandlerFluid.java @@ -0,0 +1,75 @@ +package buildcraft.core.list; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.item.ItemStack; + +import net.minecraftforge.fluids.FluidContainerRegistry; +import net.minecraftforge.fluids.FluidStack; + +import buildcraft.api.lists.ListMatchHandler; +import buildcraft.core.lib.inventory.StackHelper; +import buildcraft.core.lib.utils.FluidUtils; + +public class ListMatchHandlerFluid extends ListMatchHandler { + @Override + public boolean matches(Type type, ItemStack stack, ItemStack target, boolean precise) { + if (type == Type.TYPE) { + if (FluidContainerRegistry.isContainer(stack) && FluidContainerRegistry.isContainer(target)) { + ItemStack emptyContainerStack = FluidContainerRegistry.drainFluidContainer(stack); + ItemStack emptyContainerTarget = FluidContainerRegistry.drainFluidContainer(target); + if (StackHelper.isMatchingItem(emptyContainerStack, emptyContainerTarget, true, true)) { + return true; + } + } + } else if (type == Type.MATERIAL) { + FluidStack fStack = FluidUtils.getFluidStackFromItemStack(stack); + FluidStack fTarget = FluidUtils.getFluidStackFromItemStack(target); + if (fStack != null && fTarget != null) { + return fStack.isFluidEqual(fTarget); + } + } + return false; + } + + @Override + public boolean isValidSource(Type type, ItemStack stack) { + if (type == Type.TYPE) { + return FluidContainerRegistry.isContainer(stack); + } else if (type == Type.MATERIAL) { + return FluidUtils.getFluidStackFromItemStack(stack) != null; + } + return false; + } + + @Override + public List getClientExamples(Type type, ItemStack stack) { + if (type == Type.MATERIAL) { + FluidStack fStack = FluidUtils.getFluidStackFromItemStack(stack); + if (fStack != null) { + List examples = new ArrayList(); + for (FluidContainerRegistry.FluidContainerData data : FluidContainerRegistry.getRegisteredFluidContainerData()) { + if (fStack.isFluidEqual(data.fluid)) { + examples.add(data.filledContainer); + } + } + return examples; + } + } else if (type == Type.TYPE) { + if (FluidContainerRegistry.isContainer(stack)) { + List examples = new ArrayList(); + ItemStack emptyContainerStack = FluidContainerRegistry.drainFluidContainer(stack); + examples.add(stack); + examples.add(emptyContainerStack); + for (FluidContainerRegistry.FluidContainerData data : FluidContainerRegistry.getRegisteredFluidContainerData()) { + if (StackHelper.isMatchingItem(data.emptyContainer, emptyContainerStack, true, true)) { + examples.add(data.filledContainer); + } + } + return examples; + } + } + return null; + } +} diff --git a/common/buildcraft/core/list/ListMatchHandlerOreDictionary.java b/common/buildcraft/core/list/ListMatchHandlerOreDictionary.java new file mode 100644 index 0000000000..cee769cf25 --- /dev/null +++ b/common/buildcraft/core/list/ListMatchHandlerOreDictionary.java @@ -0,0 +1,159 @@ +package buildcraft.core.list; + +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.ItemStack; + +import net.minecraftforge.oredict.OreDictionary; + +import buildcraft.api.lists.ListMatchHandler; +import buildcraft.core.lib.inventory.StackHelper; + +public class ListMatchHandlerOreDictionary extends ListMatchHandler { + private int getUppercaseCount(String s) { + int j = 0; + for (int i = 0; i < s.length(); i++) { + if (Character.isUpperCase(s.codePointAt(i))) { + j++; + } + } + return j; + } + + @Override + public boolean matches(Type type, ItemStack stack, ItemStack target, boolean precise) { + int[] oreIds = OreDictionary.getOreIDs(stack); + + if (oreIds.length == 0) { + // No ore IDs? Time for the best effort plan of METADATA! + if (type == Type.TYPE) { + return StackHelper.isMatchingItem(stack, target, false, false); + } + return false; + } + + int[] matchesIds = OreDictionary.getOreIDs(target); + + String[] oreNames = new String[oreIds.length]; + for (int i = 0; i < oreIds.length; i++) { + oreNames[i] = OreDictionary.getOreName(oreIds[i]); + } + + if (type == Type.CLASS) { + for (int i : oreIds) { + for (int j : matchesIds) { + if (i == j) { + return true; + } + } + } + } else { + // Always pick only the longest OreDictionary string for matching. + // It's ugly, but should give us the most precise result for the + // cases in which a given stone is also used for crafting equivalents. + String s = getBestOreString(oreNames); + if (s != null) { + Set stackIds = ListOreDictionaryCache.INSTANCE.getListOfPartialMatches(type == Type.MATERIAL ? ListOreDictionaryCache + .getMaterial(s) : ListOreDictionaryCache.getType(s)); + if (stackIds != null) { + for (int j : stackIds) { + for (int k : matchesIds) { + if (j == k) { + return true; + } + } + } + } + } + } + + return false; + } + + @Override + public boolean isValidSource(Type type, ItemStack stack) { + if (OreDictionary.getOreIDs(stack).length > 0) { + return true; + } + if (type == Type.TYPE && stack.getHasSubtypes()) { + return true; + } + return false; + } + + private String getBestOreString(String[] oreIds) { + String s = null; + int suc = 0, suct; + for (String st : oreIds) { + suct = getUppercaseCount(st); + if (s == null || suct > suc) { + s = st; + suc = suct; + } + } + return s; + } + + @Override + public List getClientExamples(Type type, ItemStack stack) { + int[] oreIds = OreDictionary.getOreIDs(stack); + List stacks = new ArrayList(); + + if (oreIds.length == 0) { + // No ore IDs? Time for the best effort plan of METADATA! + if (type == Type.TYPE) { + List tempStack = new ArrayList(); + stack.getItem().getSubItems(stack.getItem(), CreativeTabs.tabMisc, tempStack); + for (ItemStack is : tempStack) { + if (is.getItem() == stack.getItem()) { + stacks.add(is); + } + } + } + return stacks; + } + + String[] oreNames = new String[oreIds.length]; + for (int i = 0; i < oreIds.length; i++) { + oreNames[i] = OreDictionary.getOreName(oreIds[i]); + } + + if (type == Type.CLASS) { + for (String s : oreNames) { + stacks.addAll(OreDictionary.getOres(s)); + } + } else { + String s = getBestOreString(oreNames); + if (s != null) { + Set stackIds = ListOreDictionaryCache.INSTANCE.getListOfPartialMatches(type == Type.MATERIAL ? ListOreDictionaryCache + .getMaterial(s) : ListOreDictionaryCache.getType(s)); + if (stackIds != null) { + for (int j : stackIds) { + stacks.addAll(OreDictionary.getOres(OreDictionary.getOreName(j))); + } + } + } + } + + List wildcard = new ArrayList(); + + for (ItemStack is : stacks) { + if (is != null && is.getItemDamage() == OreDictionary.WILDCARD_VALUE && is.getHasSubtypes()) { + wildcard.add(is); + } + } + for (ItemStack is : wildcard) { + List wll = new ArrayList(); + is.getItem().getSubItems(is.getItem(), CreativeTabs.tabMisc, wll); + if (wll.size() > 0) { + stacks.remove(is); + stacks.addAll(wll); + } + } + + return stacks; + } +} diff --git a/common/buildcraft/core/list/ListMatchHandlerTools.java b/common/buildcraft/core/list/ListMatchHandlerTools.java new file mode 100644 index 0000000000..b01a0b7ca1 --- /dev/null +++ b/common/buildcraft/core/list/ListMatchHandlerTools.java @@ -0,0 +1,36 @@ +package buildcraft.core.list; + +import java.util.Set; + +import net.minecraft.item.ItemStack; + +import buildcraft.api.lists.ListMatchHandler; + +public class ListMatchHandlerTools extends ListMatchHandler { + @Override + public boolean matches(Type type, ItemStack stack, ItemStack target, boolean precise) { + if (type == Type.TYPE) { + Set toolClassesSource = stack.getItem().getToolClasses(stack); + Set toolClassesTarget = target.getItem().getToolClasses(stack); + if (toolClassesSource.size() > 0 && toolClassesTarget.size() > 0) { + if (precise) { + if (toolClassesSource.size() != toolClassesTarget.size()) { + return false; + } + } + for (String s : toolClassesSource) { + if (!toolClassesTarget.contains(s)) { + return false; + } + } + return true; + } + } + return false; + } + + @Override + public boolean isValidSource(Type type, ItemStack stack) { + return stack.getItem().getToolClasses(stack).size() > 0; + } +} diff --git a/common/buildcraft/core/list/ListOreDictionaryCache.java b/common/buildcraft/core/list/ListOreDictionaryCache.java new file mode 100644 index 0000000000..85e3be4279 --- /dev/null +++ b/common/buildcraft/core/list/ListOreDictionaryCache.java @@ -0,0 +1,96 @@ +package buildcraft.core.list; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import net.minecraftforge.oredict.OreDictionary; + +public final class ListOreDictionaryCache { + public static final ListOreDictionaryCache INSTANCE = new ListOreDictionaryCache(); + private static final String[] TYPE_KEYWORDS = { + "Tiny", "Dense", "Small" + }; + private final Map> namingCache = new HashMap>(); + private final Set registeredNames = new HashSet(); + + private ListOreDictionaryCache() { + + } + + public Set getListOfPartialMatches(String part) { + return namingCache.get(part); + } + + private void addToNamingCache(String s, int id) { + if (s == null) { + return; + } + + Set ll = namingCache.get(s); + + if (ll == null) { + ll = new HashSet(); + ll.add(id); + namingCache.put(s, ll); + } else { + ll.add(id); + } + } + + public static String getType(String name) { + // Rules for finding type: + // - Split just before the last uppercase character found. + int splitLocation = name.length() - 1; + while (splitLocation >= 0) { + if (Character.isUpperCase(name.codePointAt(splitLocation))) { + break; + } else { + splitLocation--; + } + } + return splitLocation >= 0 ? name.substring(0, splitLocation) : name; // No null - this handles things like "record". + } + + public static String getMaterial(String name) { + // Rules for finding material: + // - For every uppercase character, check if the character is not in + // TYPE_KEYWORDS. This is used to skip things like "plate[DenseIron]" + // or "dust[TinyRedstone]". That part should be the material still. + int splitLocation = 0; + String t = null; + while (splitLocation < name.length()) { + if (!Character.isUpperCase(name.codePointAt(splitLocation))) { + splitLocation++; + } else { + t = name.substring(splitLocation); + for (String s : TYPE_KEYWORDS) { + if (t.startsWith(s)) { + t = null; + break; + } + } + if (t != null) { + break; + } else { + splitLocation++; + } + } + } + return splitLocation < name.length() ? t : null; + } + + public void registerName(String name) { + if (registeredNames.contains(name)) { + return; + } + + int oreID = OreDictionary.getOreID(name); + + addToNamingCache(getType(name), oreID); + addToNamingCache(getMaterial(name), oreID); + + registeredNames.add(name); + } +} diff --git a/common/buildcraft/core/list/ListTooltipHandler.java b/common/buildcraft/core/list/ListTooltipHandler.java new file mode 100644 index 0000000000..3c9e6113c8 --- /dev/null +++ b/common/buildcraft/core/list/ListTooltipHandler.java @@ -0,0 +1,25 @@ +package buildcraft.core.list; + +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; + +import net.minecraftforge.event.entity.player.ItemTooltipEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import buildcraft.api.items.IList; +import buildcraft.core.lib.utils.StringUtils; + +public class ListTooltipHandler { + @SubscribeEvent + public void itemTooltipEvent(ItemTooltipEvent event) { + if (event.itemStack != null && event.entityPlayer != null && event.entityPlayer.openContainer != null + && event.entityPlayer.openContainer instanceof ContainerListNew) { + ItemStack list = event.entityPlayer.getCurrentEquippedItem(); + if (list != null && list.getItem() instanceof IList) { + if (((IList) list.getItem()).matches(list, event.itemStack)) { + event.toolTip.add(EnumChatFormatting.GREEN + StringUtils.localize("tip.list.matches")); + } + } + } + } +} diff --git a/common/buildcraft/core/network/EntityIds.java b/common/buildcraft/core/network/EntityIds.java index bf7e0fe54f..93a28b8c86 100644 --- a/common/buildcraft/core/network/EntityIds.java +++ b/common/buildcraft/core/network/EntityIds.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.network; public final class EntityIds { diff --git a/common/buildcraft/core/network/PacketIds.java b/common/buildcraft/core/network/PacketIds.java index 1408f89efe..7a15051abd 100644 --- a/common/buildcraft/core/network/PacketIds.java +++ b/common/buildcraft/core/network/PacketIds.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.network; @Deprecated diff --git a/common/buildcraft/core/properties/ChunkProperty.java b/common/buildcraft/core/properties/ChunkProperty.java index 9d31a82095..c42fe85d3c 100755 --- a/common/buildcraft/core/properties/ChunkProperty.java +++ b/common/buildcraft/core/properties/ChunkProperty.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.properties; import java.util.BitSet; diff --git a/common/buildcraft/core/properties/DimensionProperty.java b/common/buildcraft/core/properties/DimensionProperty.java index 345bc814e0..e866b4b77c 100644 --- a/common/buildcraft/core/properties/DimensionProperty.java +++ b/common/buildcraft/core/properties/DimensionProperty.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.properties; import net.minecraft.block.state.IBlockState; @@ -16,10 +20,10 @@ public class DimensionProperty implements IWorldAccess { - private LongHashMap chunkMapping = new LongHashMap(); - private World world; - private int worldHeight; - private WorldProperty worldProperty; + private final LongHashMap chunkMapping = new LongHashMap(); + private final World world; + private final int worldHeight; + private final WorldProperty worldProperty; public DimensionProperty(World iWorld, WorldProperty iProp) { world = iWorld; diff --git a/common/buildcraft/core/properties/WorldProperty.java b/common/buildcraft/core/properties/WorldProperty.java index 42e4b544a0..e8e11fa3ce 100644 --- a/common/buildcraft/core/properties/WorldProperty.java +++ b/common/buildcraft/core/properties/WorldProperty.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.properties; import java.util.HashMap; diff --git a/common/buildcraft/core/properties/WorldPropertyIsDirt.java b/common/buildcraft/core/properties/WorldPropertyIsDirt.java index b6b718cccd..14c73ca3df 100755 --- a/common/buildcraft/core/properties/WorldPropertyIsDirt.java +++ b/common/buildcraft/core/properties/WorldPropertyIsDirt.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.properties; import net.minecraft.block.BlockDirt; diff --git a/common/buildcraft/core/properties/WorldPropertyIsFarmland.java b/common/buildcraft/core/properties/WorldPropertyIsFarmland.java index 0e02bb35d2..4c07671337 100755 --- a/common/buildcraft/core/properties/WorldPropertyIsFarmland.java +++ b/common/buildcraft/core/properties/WorldPropertyIsFarmland.java @@ -1,5 +1,5 @@ /** 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.core.properties; diff --git a/common/buildcraft/core/properties/WorldPropertyIsFluidSource.java b/common/buildcraft/core/properties/WorldPropertyIsFluidSource.java index 9f43c2faf1..5d7e9b0e3b 100755 --- a/common/buildcraft/core/properties/WorldPropertyIsFluidSource.java +++ b/common/buildcraft/core/properties/WorldPropertyIsFluidSource.java @@ -1,5 +1,5 @@ /** 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.core.properties; @@ -10,6 +10,7 @@ import net.minecraft.util.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; + import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidBlock; diff --git a/common/buildcraft/core/properties/WorldPropertyIsHarvestable.java b/common/buildcraft/core/properties/WorldPropertyIsHarvestable.java index 0103169153..14e15961e8 100755 --- a/common/buildcraft/core/properties/WorldPropertyIsHarvestable.java +++ b/common/buildcraft/core/properties/WorldPropertyIsHarvestable.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.properties; import net.minecraft.block.state.IBlockState; diff --git a/common/buildcraft/core/properties/WorldPropertyIsLeaf.java b/common/buildcraft/core/properties/WorldPropertyIsLeaf.java index 2a871c857a..156be25a80 100755 --- a/common/buildcraft/core/properties/WorldPropertyIsLeaf.java +++ b/common/buildcraft/core/properties/WorldPropertyIsLeaf.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.properties; import net.minecraft.block.Block; @@ -9,6 +13,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.BlockPos; import net.minecraft.world.IBlockAccess; + import net.minecraftforge.oredict.OreDictionary; public class WorldPropertyIsLeaf extends WorldProperty { diff --git a/common/buildcraft/core/properties/WorldPropertyIsOre.java b/common/buildcraft/core/properties/WorldPropertyIsOre.java index 8347dd7c53..9734da2707 100755 --- a/common/buildcraft/core/properties/WorldPropertyIsOre.java +++ b/common/buildcraft/core/properties/WorldPropertyIsOre.java @@ -1,9 +1,10 @@ /** 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.core.properties; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; @@ -12,12 +13,13 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.BlockPos; import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.oredict.OreDictionary; public class WorldPropertyIsOre extends WorldProperty { - - public HashSet ores = new HashSet(); + private final HashSet ores = new HashSet(); public WorldPropertyIsOre(int harvestLevel) { initBlockHarvestTools(); @@ -56,12 +58,19 @@ public boolean get(IBlockAccess blockAccess, IBlockState state, BlockPos pos) { if (block == null) { return false; } else { - ItemStack stack = new ItemStack(block, 1, 0); + List toCheck = new ArrayList(); + toCheck.add(new ItemStack(block, 1, block.getMetaFromState(state))); + + if (block.hasTileEntity(state) && blockAccess instanceof World) { + toCheck.addAll(block.getDrops((World) blockAccess, pos, state, 0)); + } - if (stack.getItem() != null) { - for (int id : OreDictionary.getOreIDs(stack)) { - if (ores.contains(id)) { - return true; + for (ItemStack stack : toCheck) { + if (stack.getItem() != null) { + for (int id : OreDictionary.getOreIDs(stack)) { + if (ores.contains(id)) { + return true; + } } } } diff --git a/common/buildcraft/core/properties/WorldPropertyIsReplaceable.java b/common/buildcraft/core/properties/WorldPropertyIsReplaceable.java new file mode 100755 index 0000000000..358e8fa682 --- /dev/null +++ b/common/buildcraft/core/properties/WorldPropertyIsReplaceable.java @@ -0,0 +1,19 @@ +/** 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.core.properties; + +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.util.BlockPos; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class WorldPropertyIsReplaceable extends WorldProperty { + @Override + public boolean get(IBlockAccess blockAccess, IBlockState state, BlockPos pos) { + Block block = state.getBlock(); + return block == null || block.isAir(blockAccess, pos) || block.isReplaceable((World) blockAccess, pos); + } +} diff --git a/common/buildcraft/core/properties/WorldPropertyIsShoveled.java b/common/buildcraft/core/properties/WorldPropertyIsShoveled.java index 6466a76ebe..47f79c8529 100755 --- a/common/buildcraft/core/properties/WorldPropertyIsShoveled.java +++ b/common/buildcraft/core/properties/WorldPropertyIsShoveled.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.properties; import net.minecraft.block.Block; diff --git a/common/buildcraft/core/properties/WorldPropertyIsSoft.java b/common/buildcraft/core/properties/WorldPropertyIsSoft.java index b455e6df6b..0b365766b5 100755 --- a/common/buildcraft/core/properties/WorldPropertyIsSoft.java +++ b/common/buildcraft/core/properties/WorldPropertyIsSoft.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.properties; import net.minecraft.block.Block; diff --git a/common/buildcraft/core/properties/WorldPropertyIsWood.java b/common/buildcraft/core/properties/WorldPropertyIsWood.java index d82e1792ba..e83d2f4f92 100755 --- a/common/buildcraft/core/properties/WorldPropertyIsWood.java +++ b/common/buildcraft/core/properties/WorldPropertyIsWood.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.properties; import net.minecraft.block.Block; @@ -9,6 +13,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.BlockPos; import net.minecraft.world.IBlockAccess; + import net.minecraftforge.oredict.OreDictionary; public class WorldPropertyIsWood extends WorldProperty { diff --git a/common/buildcraft/core/proxy/CoreProxy.java b/common/buildcraft/core/proxy/CoreProxy.java index e2a246e60a..5a72b4ed1f 100644 --- a/common/buildcraft/core/proxy/CoreProxy.java +++ b/common/buildcraft/core/proxy/CoreProxy.java @@ -1,20 +1,16 @@ /** 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.core.proxy; import java.lang.ref.WeakReference; -import java.util.List; import net.minecraft.block.Block; -import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; -import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.CraftingManager; import net.minecraft.network.INetHandler; import net.minecraft.network.NetHandlerPlayServer; import net.minecraft.tileentity.TileEntity; @@ -25,15 +21,9 @@ import net.minecraftforge.common.util.FakePlayerFactory; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.SidedProxy; -import net.minecraftforge.fml.common.registry.GameRegistry; -import net.minecraftforge.oredict.ShapedOreRecipe; -import net.minecraftforge.oredict.ShapelessOreRecipe; import buildcraft.BuildCraftCore; import buildcraft.api.core.ICoreProxy; -import buildcraft.core.CompatHooks; -import buildcraft.core.lib.items.ItemBlockBuildCraft; -import buildcraft.core.lib.utils.Utils; public class CoreProxy implements ICoreProxy { @@ -61,10 +51,6 @@ public void removeEntity(Entity entity) { entity.worldObj.removeEntity(entity); } - /* WRAPPER */ - @SuppressWarnings("rawtypes") - public void feedSubBlocks(Block block, CreativeTabs tab, List itemList) {} - public String getItemDisplayName(ItemStack newStack) { return ""; } @@ -74,51 +60,10 @@ public void initializeRendering() {} public void initializeEntityRendering() {} - /* REGISTRATION */ - public void registerBlock(Block block) { - registerBlock(block, ItemBlockBuildCraft.class); - } - - public void registerBlock(Block block, Class item) { - GameRegistry.registerBlock(block, item, block.getUnlocalizedName().replace("tile.", "")); - } - - public void registerItem(Item item) { - registerItem(item, item.getUnlocalizedName().replace("item.", "")); - } - - public void registerItem(Item item, String overridingName) { - GameRegistry.registerItem(item, overridingName); - } - - public void registerTileEntity(Class clas, String ident) { - GameRegistry.registerTileEntity(CompatHooks.INSTANCE.getTile(clas), ident); - } - - public void registerTileEntity(Class clas, String id, String... alternatives) { - GameRegistry.registerTileEntityWithAlternatives(CompatHooks.INSTANCE.getTile(clas), id, alternatives); - } - public void onCraftingPickup(World world, EntityPlayer player, ItemStack stack) { stack.onCrafting(world, player, stack.stackSize); } - @SuppressWarnings("unchecked") - public void addCraftingRecipe(ItemStack result, Object... recipe) { - String name = Utils.getNameForItem(result.getItem()); - if (name != null) { - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(result, recipe)); - } - } - - @SuppressWarnings("unchecked") - public void addShapelessRecipe(ItemStack result, Object... recipe) { - String name = Utils.getNameForItem(result.getItem()); - if (name != null) { - CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(result, recipe)); - } - } - public String playerName() { return ""; } @@ -169,4 +114,16 @@ public EntityPlayer getPlayerFromNetHandler(INetHandler handler) { } return null; } + + public T getServerTile(T source) { + return source; + } + + public EntityPlayer getClientPlayer() { + return null; + } + + public void postRegisterBlock(Block block) {} + + public void postRegisterItem(Item item) {} } diff --git a/common/buildcraft/core/proxy/CoreProxyClient.java b/common/buildcraft/core/proxy/CoreProxyClient.java index d1d2cccf22..75269dd145 100644 --- a/common/buildcraft/core/proxy/CoreProxyClient.java +++ b/common/buildcraft/core/proxy/CoreProxyClient.java @@ -1,5 +1,5 @@ /** 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.core.proxy; @@ -19,20 +19,25 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.client.resources.model.ModelResourceLocation; -import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; -import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.network.INetHandler; import net.minecraft.network.NetHandlerPlayServer; +import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; +import net.minecraft.world.WorldServer; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.Chunk.EnumCreateEntityType; + import net.minecraftforge.client.model.ModelLoader; +import net.minecraftforge.common.DimensionManager; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.client.registry.RenderingRegistry; +import buildcraft.BuildCraftCore; import buildcraft.core.EntityLaser; import buildcraft.core.client.BuildCraftStateMapper; import buildcraft.core.lib.EntityResizableCuboid; @@ -68,16 +73,6 @@ public void removeEntity(Entity entity) { } /* WRAPPER */ - @SuppressWarnings("rawtypes") - @Override - public void feedSubBlocks(Block block, CreativeTabs tab, List itemList) { - if (block == null) { - return; - } - - block.getSubBlocks(Item.getItemFromBlock(block), tab, itemList); - } - @Override public String getItemDisplayName(ItemStack stack) { if (stack.getItem() == null) { @@ -114,8 +109,7 @@ public void initializeEntityRendering() { } for (Entry> entry : metaStateMap.asMap().entrySet()) { Collection blockStates = entry.getValue(); - if (blockStates.isEmpty()) - continue; + if (blockStates.isEmpty()) continue; if (blockStates.contains(defaultState)) { registerBlockItemModel(defaultState, entry.getKey(), stateTypeMap.get(defaultState)); } else { @@ -158,8 +152,7 @@ public EntityPlayer getPlayerFromNetHandler(INetHandler handler) { private LinkedList itemsToRegisterRenderersFor = new LinkedList(); @Override - public void registerBlock(Block block, Class item) { - super.registerBlock(block, item); + public void postRegisterBlock(Block block) { blocksToRegisterRenderersFor.add(block); if (block instanceof ICustomStateMapper) { ((ICustomStateMapper) block).setCusomStateMappers(); @@ -169,8 +162,27 @@ public void registerBlock(Block block, Class item) { } @Override - public void registerItem(Item item, String overridingName) { - super.registerItem(item, overridingName); + public void postRegisterItem(Item item) { itemsToRegisterRenderersFor.add(item); } + + public EntityPlayer getClientPlayer() { + return Minecraft.getMinecraft().thePlayer; + } + + public T getServerTile(T source) { + if (BuildCraftCore.useServerDataOnClient && Minecraft.getMinecraft().isSingleplayer() && source.getWorld().isRemote) { + WorldServer w = DimensionManager.getWorld(source.getWorld().provider.getDimensionId()); + if (w != null && w.getChunkProvider() != null) { + Chunk c = w.getChunkFromBlockCoords(source.getPos()); + if (c != null) { + TileEntity t = c.getTileEntity(source.getPos(), EnumCreateEntityType.CHECK); + if (t != null && t.getClass().equals(source.getClass())) { + return (T) t; + } + } + } + } + return source; + } } diff --git a/common/buildcraft/core/recipes/AssemblyRecipeManager.java b/common/buildcraft/core/recipes/AssemblyRecipeManager.java index 5b46fa9fe6..596782b7ba 100644 --- a/common/buildcraft/core/recipes/AssemblyRecipeManager.java +++ b/common/buildcraft/core/recipes/AssemblyRecipeManager.java @@ -1,5 +1,5 @@ /** 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.core.recipes; diff --git a/common/buildcraft/core/recipes/FakeFlexibleCrafter.java b/common/buildcraft/core/recipes/FakeFlexibleCrafter.java index 89711460e1..4c1ed4c412 100644 --- a/common/buildcraft/core/recipes/FakeFlexibleCrafter.java +++ b/common/buildcraft/core/recipes/FakeFlexibleCrafter.java @@ -1,6 +1,7 @@ package buildcraft.core.recipes; import net.minecraft.item.ItemStack; + import net.minecraftforge.fluids.FluidStack; import buildcraft.api.recipes.IFlexibleCrafter; diff --git a/common/buildcraft/core/recipes/FlexibleRecipe.java b/common/buildcraft/core/recipes/FlexibleRecipe.java index 1a2c8cf2e9..8e72121492 100644 --- a/common/buildcraft/core/recipes/FlexibleRecipe.java +++ b/common/buildcraft/core/recipes/FlexibleRecipe.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.recipes; import java.util.ArrayList; @@ -11,6 +15,7 @@ import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; + import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; @@ -182,7 +187,7 @@ public CraftingResult craft(IFlexibleCrafter baseCrafter, boolean preview) { FluidStack fluid = crafter.getCraftingFluidStack(tankid); if (fluid != null && fluid.isFluidEqual(requirement)) { - int amountUsed = 0; + int amountUsed; if (fluid.amount > amount) { amountUsed = amount; @@ -234,7 +239,7 @@ private int consumeItems(IFlexibleCrafter crafter, CraftingResult result, ISt ItemStack stack = crafter.getCraftingItemStack(slotid); if (stack != null && filter.matches(stack)) { - ItemStack removed = null; + ItemStack removed; if (stack.stackSize >= expected) { removed = crafter.decrCraftingItemStack(slotid, expected); diff --git a/common/buildcraft/core/recipes/IntegrationRecipeManager.java b/common/buildcraft/core/recipes/IntegrationRecipeManager.java index 3cd9445d67..d8a541dc70 100644 --- a/common/buildcraft/core/recipes/IntegrationRecipeManager.java +++ b/common/buildcraft/core/recipes/IntegrationRecipeManager.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.recipes; import java.util.LinkedList; diff --git a/common/buildcraft/core/recipes/RecipeManager.java b/common/buildcraft/core/recipes/RecipeManager.java index 4cec3700ab..999a74b991 100644 --- a/common/buildcraft/core/recipes/RecipeManager.java +++ b/common/buildcraft/core/recipes/RecipeManager.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.recipes; import java.util.Collection; diff --git a/common/buildcraft/core/recipes/RefineryRecipeManager.java b/common/buildcraft/core/recipes/RefineryRecipeManager.java index e758416356..8f423a18e4 100644 --- a/common/buildcraft/core/recipes/RefineryRecipeManager.java +++ b/common/buildcraft/core/recipes/RefineryRecipeManager.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.recipes; import java.util.ArrayList; @@ -19,15 +23,13 @@ public final class RefineryRecipeManager implements IRefineryRecipeManager { public static final RefineryRecipeManager INSTANCE = new RefineryRecipeManager(); private HashMap> recipes = new HashMap>(); - private ArrayList validFluids1 = new ArrayList(); - private ArrayList validFluids2 = new ArrayList(); + private ArrayList validFluids1 = new ArrayList(); + private ArrayList validFluids2 = new ArrayList(); private RefineryRecipeManager() {} @Override public void addRecipe(String id, FluidStack ingredient, FluidStack result, int energy, int delay) { - String name = result.getFluid().getName(); - FlexibleRecipe recipe = new FlexibleRecipe(id, result, energy, delay, ingredient); recipes.put(id, recipe); validFluids1.add(ingredient); @@ -36,8 +38,6 @@ public void addRecipe(String id, FluidStack ingredient, FluidStack result, int e @Override public void addRecipe(String id, FluidStack ingredient1, FluidStack ingredient2, FluidStack result, int energy, int delay) { - String name = result.getFluid().getName(); - if (ingredient1 == null || ingredient2 == null || result == null) { BCLog.logger.warn("Rejected refinery recipe " + id + " due to a null FluidStack!"); } diff --git a/common/buildcraft/core/render/BlockHighlightHandler.java b/common/buildcraft/core/render/BlockHighlightHandler.java index 37a2777942..88db403ed8 100644 --- a/common/buildcraft/core/render/BlockHighlightHandler.java +++ b/common/buildcraft/core/render/BlockHighlightHandler.java @@ -1,5 +1,5 @@ /** 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.core.render; @@ -10,11 +10,8 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.RenderGlobal; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; -import net.minecraft.util.MathHelper; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.Vec3; +import net.minecraft.util.*; + import net.minecraftforge.client.event.DrawBlockHighlightEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.relauncher.Side; @@ -23,7 +20,6 @@ import buildcraft.core.lib.render.ICustomHighlight; public class BlockHighlightHandler { - @SideOnly(Side.CLIENT) @SubscribeEvent public void handleBlockHighlight(DrawBlockHighlightEvent e) { @@ -53,6 +49,7 @@ public void handleBlockHighlight(DrawBlockHighlightEvent e) { GL11.glLineWidth(2F); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDepthMask(false); + double exp = ((ICustomHighlight) block).getExpansion(); exp += expansion / 32D; nPos = nPos.subtract(x, y, z); @@ -60,6 +57,7 @@ public void handleBlockHighlight(DrawBlockHighlightEvent e) { AxisAlignedBB changed = aabb.expand(exp, exp, exp).offset(-nPos.xCoord, -nPos.yCoord, -nPos.zCoord); RenderGlobal.func_181561_a(changed); } + GL11.glDepthMask(true); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); diff --git a/common/buildcraft/core/render/RenderBox.java b/common/buildcraft/core/render/RenderBox.java index 08d680b5dd..253c521d3d 100755 --- a/common/buildcraft/core/render/RenderBox.java +++ b/common/buildcraft/core/render/RenderBox.java @@ -1,5 +1,5 @@ /** 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.core.render; diff --git a/common/buildcraft/core/render/RenderBoxProvider.java b/common/buildcraft/core/render/RenderBoxProvider.java index 2cdf7600cd..f11245b2d3 100755 --- a/common/buildcraft/core/render/RenderBoxProvider.java +++ b/common/buildcraft/core/render/RenderBoxProvider.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.render; import org.lwjgl.opengl.GL11; diff --git a/common/buildcraft/core/render/RenderBuilder.java b/common/buildcraft/core/render/RenderBuilder.java index 8f50fccec5..13fbd08789 100755 --- a/common/buildcraft/core/render/RenderBuilder.java +++ b/common/buildcraft/core/render/RenderBuilder.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.render; import org.lwjgl.opengl.GL11; @@ -20,7 +24,6 @@ public class RenderBuilder extends RenderBoxProvi public void renderTileEntityAt(B builder, double x, double y, double z, float f, int arg) { super.renderTileEntityAt(builder, x, y, z, f, arg); - if (builder != null) { GL11.glPushMatrix(); GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_CULL_FACE); @@ -48,6 +51,5 @@ public void renderTileEntityAt(B builder, double x, double y, double z, float f, renderItems.render(builder, x, y, z); } - } } diff --git a/common/buildcraft/core/render/RenderBuildingItems.java b/common/buildcraft/core/render/RenderBuildingItems.java index b8d2857962..0e1691bf35 100755 --- a/common/buildcraft/core/render/RenderBuildingItems.java +++ b/common/buildcraft/core/render/RenderBuildingItems.java @@ -1,5 +1,5 @@ -/** Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * +/** 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.core.render; @@ -58,7 +58,6 @@ private void doRenderItem(BuildingItem i, float light) { GL11.glTranslatef(0, 0.25F, 0); GL11.glScalef(renderScale, renderScale, renderScale); if (s.stack != null) { - @SuppressWarnings("deprecation") IBakedModel model = renderItem.getItemModelMesher().getItemModel(s.stack); if (model != null) { renderItem.renderItem(s.stack, renderItem.getItemModelMesher().getItemModel(s.stack)); diff --git a/common/buildcraft/core/render/RenderLaser.java b/common/buildcraft/core/render/RenderLaser.java index 612c79a9d7..fcce377931 100644 --- a/common/buildcraft/core/render/RenderLaser.java +++ b/common/buildcraft/core/render/RenderLaser.java @@ -1,5 +1,5 @@ -/** Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * +/** 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.core.render; @@ -12,7 +12,6 @@ import net.minecraft.client.renderer.GLAllocation; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.texture.TextureManager; -import net.minecraft.entity.Entity; import net.minecraft.util.ResourceLocation; import net.minecraft.util.Vec3; import net.minecraft.world.World; @@ -22,8 +21,8 @@ import buildcraft.core.lib.render.RenderEntityBlock; import buildcraft.core.lib.render.RenderEntityBlock.RenderInfo; -public class RenderLaser extends Render { - +public class RenderLaser extends Render { + // FIXME: REWRITE THE LASER RENDERER public static final float STEP = 0.04F; protected static ModelBase model = new ModelBase() {}; @@ -35,6 +34,10 @@ public RenderLaser() { super(Minecraft.getMinecraft().getRenderManager()); } + public static void onTextureReload() { + scaledBoxes = null; + } + private static ModelRenderer getBox(int index) { if (box == null) { box = new ModelRenderer[40]; @@ -88,12 +91,7 @@ private static void initScaledBoxes(World world) { } @Override - public void doRender(Entity entity, double x, double y, double z, float f, float f1) { - doRender((EntityLaser) entity, x, y, z, f, f1); - // entity.setAngles(45, 180); - } - - private void doRender(EntityLaser laser, double x, double y, double z, float f, float f1) { + public void doRender(EntityLaser laser, double x, double y, double z, float f, float f1) { if (!laser.isVisible() || laser.getTexture() == null) { return; } @@ -195,7 +193,7 @@ private static void doRenderLaserLine(double len, int texId) { } @Override - protected ResourceLocation getEntityTexture(Entity entity) { - return ((EntityLaser) entity).getTexture(); + protected ResourceLocation getEntityTexture(EntityLaser entity) { + return entity.getTexture(); } } diff --git a/common/buildcraft/core/statements/ActionMachineControl.java b/common/buildcraft/core/statements/ActionMachineControl.java index 49e20f4346..d587e56636 100644 --- a/common/buildcraft/core/statements/ActionMachineControl.java +++ b/common/buildcraft/core/statements/ActionMachineControl.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.statements; import java.util.Locale; diff --git a/common/buildcraft/core/statements/ActionRedstoneOutput.java b/common/buildcraft/core/statements/ActionRedstoneOutput.java index a4dc33cb35..6fa3911d55 100644 --- a/common/buildcraft/core/statements/ActionRedstoneOutput.java +++ b/common/buildcraft/core/statements/ActionRedstoneOutput.java @@ -1,5 +1,5 @@ /** 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.core.statements; diff --git a/common/buildcraft/core/statements/BCStatement.java b/common/buildcraft/core/statements/BCStatement.java index aabcf950f3..a02ea7c363 100644 --- a/common/buildcraft/core/statements/BCStatement.java +++ b/common/buildcraft/core/statements/BCStatement.java @@ -1,5 +1,5 @@ /** 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.core.statements; @@ -30,11 +30,11 @@ public abstract class BCStatement implements IStatement { * * @param uniqueTag */ public BCStatement(String... uniqueTag) { - this.uniqueTag = uniqueTag[0]; - for (String tag : uniqueTag) { - StatementManager.statements.put(tag, this); - } - MinecraftForge.EVENT_BUS.register(this); + this.uniqueTag = uniqueTag[0]; + for (String tag : uniqueTag) { + StatementManager.statements.put(tag, this); + } + MinecraftForge.EVENT_BUS.register(this); } @Override diff --git a/common/buildcraft/core/statements/DefaultActionProvider.java b/common/buildcraft/core/statements/DefaultActionProvider.java index 7e15e6acf9..4af2660a0f 100644 --- a/common/buildcraft/core/statements/DefaultActionProvider.java +++ b/common/buildcraft/core/statements/DefaultActionProvider.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.statements; import java.util.Collection; diff --git a/common/buildcraft/core/statements/DefaultTriggerProvider.java b/common/buildcraft/core/statements/DefaultTriggerProvider.java index 8c5850ba77..0bfd58b83c 100644 --- a/common/buildcraft/core/statements/DefaultTriggerProvider.java +++ b/common/buildcraft/core/statements/DefaultTriggerProvider.java @@ -1,5 +1,5 @@ /** 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.core.statements; @@ -9,16 +9,17 @@ import net.minecraft.inventory.IInventory; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; + import net.minecraftforge.fluids.FluidTankInfo; import net.minecraftforge.fluids.IFluidHandler; +import buildcraft.BuildCraftCore; import buildcraft.api.statements.IStatementContainer; import buildcraft.api.statements.ITriggerExternal; import buildcraft.api.statements.ITriggerInternal; import buildcraft.api.statements.ITriggerProvider; import buildcraft.api.statements.containers.IRedstoneStatementContainer; import buildcraft.api.tiles.IHasWork; -import buildcraft.BuildCraftCore; public class DefaultTriggerProvider implements ITriggerProvider { @Override diff --git a/common/buildcraft/core/statements/StatementParameterDirection.java b/common/buildcraft/core/statements/StatementParameterDirection.java index 4521f38db1..e273a601b2 100644 --- a/common/buildcraft/core/statements/StatementParameterDirection.java +++ b/common/buildcraft/core/statements/StatementParameterDirection.java @@ -1,14 +1,16 @@ /** 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.core.statements; import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing.Axis; +import net.minecraft.util.ResourceLocation; import buildcraft.api.statements.IStatement; import buildcraft.api.statements.IStatementContainer; @@ -19,10 +21,20 @@ public class StatementParameterDirection implements IStatementParameter { - private static TextureAtlasSprite[] icons; + private static TextureAtlasSprite[] sprites; public EnumFacing direction = null; + public static void registerIcons(TextureMap map) { + sprites = new TextureAtlasSprite[5]; + sprites[0] = map.registerSprite(new ResourceLocation("buildcraftcore:triggers/trigger_dir_down")); + sprites[1] = map.registerSprite(new ResourceLocation("buildcraftcore:triggers/trigger_dir_up")); + sprites[2] = map.registerSprite(new ResourceLocation("buildcraftcore:triggers/trigger_dir_north")); + sprites[3] = map.registerSprite(new ResourceLocation("buildcraftcore:triggers/trigger_dir_south")); + sprites[4] = map.registerSprite(new ResourceLocation("buildcraftcore:triggers/trigger_dir_west")); + sprites[5] = map.registerSprite(new ResourceLocation("buildcraftcore:triggers/trigger_dir_east")); + } + public StatementParameterDirection() { } @@ -37,7 +49,7 @@ public TextureAtlasSprite getIcon() { if (direction == null) { return null; } else { - return icons[direction.ordinal()]; + return sprites[direction.ordinal()]; } } @@ -91,17 +103,6 @@ public String getUniqueTag() { return "buildcraft:pipeActionDirection"; } - // @Override - // public void registerIcons(TextureAtlasSpriteRegister iconRegister) { - // icons = - // new TextureAtlasSprite[] { iconRegister.registerIcon("buildcraftcore:triggers/trigger_dir_down"), - // iconRegister.registerIcon("buildcraftcore:triggers/trigger_dir_up"), - // iconRegister.registerIcon("buildcraftcore:triggers/trigger_dir_north"), - // iconRegister.registerIcon("buildcraftcore:triggers/trigger_dir_south"), - // iconRegister.registerIcon("buildcraftcore:triggers/trigger_dir_west"), - // iconRegister.registerIcon("buildcraftcore:triggers/trigger_dir_east") }; - // } - @Override public IStatementParameter rotateLeft() { StatementParameterDirection d = new StatementParameterDirection(); diff --git a/common/buildcraft/core/statements/StatementParameterItemStackExact.java b/common/buildcraft/core/statements/StatementParameterItemStackExact.java new file mode 100644 index 0000000000..0939b8c99f --- /dev/null +++ b/common/buildcraft/core/statements/StatementParameterItemStackExact.java @@ -0,0 +1,112 @@ +package buildcraft.core.statements; + +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +import buildcraft.api.statements.IStatement; +import buildcraft.api.statements.IStatementContainer; +import buildcraft.api.statements.IStatementParameter; +import buildcraft.api.statements.StatementMouseClick; + +public class StatementParameterItemStackExact implements IStatementParameter { + protected ItemStack stack; + + @Override + public ItemStack getItemStack() { + return stack; + } + + @Override + public void onClick(IStatementContainer source, IStatement stmt, ItemStack stack, StatementMouseClick mouse) { + if (stack != null) { + if (areItemsEqual(this.stack, stack)) { + if (mouse.getButton() == 0) { + this.stack.stackSize += (mouse.isShift()) ? 16 : 1; + if (this.stack.stackSize > 64) { + this.stack.stackSize = 64; + } + } else { + this.stack.stackSize -= (mouse.isShift()) ? 16 : 1; + if (this.stack.stackSize < 0) { + this.stack.stackSize = 0; + } + } + } else { + this.stack = stack.copy(); + } + } else { + if (this.stack != null) { + if (mouse.getButton() == 0) { + this.stack.stackSize += (mouse.isShift()) ? 16 : 1; + if (this.stack.stackSize > 64) { + this.stack.stackSize = 64; + } + } else { + this.stack.stackSize -= (mouse.isShift()) ? 16 : 1; + if (this.stack.stackSize < 0) { + this.stack = null; + } + } + } + } + } + + @Override + public void writeToNBT(NBTTagCompound compound) { + if (stack != null) { + NBTTagCompound tagCompound = new NBTTagCompound(); + stack.writeToNBT(tagCompound); + compound.setTag("stack", tagCompound); + } + } + + @Override + public void readFromNBT(NBTTagCompound compound) { + stack = ItemStack.loadItemStackFromNBT(compound.getCompoundTag("stack")); + } + + @Override + public boolean equals(Object object) { + if (object instanceof StatementParameterItemStackExact) { + StatementParameterItemStackExact param = (StatementParameterItemStackExact) object; + + return areItemsEqual(stack, param.stack); + } else { + return false; + } + } + + private boolean areItemsEqual(ItemStack stack1, ItemStack stack2) { + if (stack1 != null) { + return stack2 != null && stack1.isItemEqual(stack2) && ItemStack.areItemStackTagsEqual(stack1, stack2); + } else { + return stack2 == null; + } + } + + @Override + public String getDescription() { + if (stack != null) { + return stack.getDisplayName(); + } else { + return ""; + } + } + + @Override + public String getUniqueTag() { + return "buildcraft:stackExact"; + } + + @Override + public IStatementParameter rotateLeft() { + return this; + } + + @Override + public TextureAtlasSprite getIcon() { + // Whats rendered is not a sprite but the actual stack itself + return null; + } +} diff --git a/common/buildcraft/core/statements/TriggerEnergy.java b/common/buildcraft/core/statements/TriggerEnergy.java index 3d51ae6cf1..328415a257 100644 --- a/common/buildcraft/core/statements/TriggerEnergy.java +++ b/common/buildcraft/core/statements/TriggerEnergy.java @@ -1,5 +1,5 @@ /** 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.core.statements; @@ -12,11 +12,11 @@ import cofh.api.energy.IEnergyProvider; import cofh.api.energy.IEnergyReceiver; +import buildcraft.api.core.EnumPipePart; import buildcraft.api.statements.IStatementContainer; import buildcraft.api.statements.IStatementParameter; import buildcraft.api.statements.ITriggerInternal; import buildcraft.api.transport.IPipeTile; -import buildcraft.api.transport.pipe_bc8.EnumPipePart; import buildcraft.core.lib.utils.StringUtils; public class TriggerEnergy extends BCStatement implements ITriggerInternal { @@ -62,7 +62,7 @@ private boolean isTriggeredEnergyHandler(IEnergyConnection connection, EnumPipeP } if (energyMaxStored > 0) { - float level = energyStored / energyMaxStored; + float level = (float) energyStored / (float) energyMaxStored; if (high) { return level > 0.95F; } else { diff --git a/common/buildcraft/core/statements/TriggerFluidContainer.java b/common/buildcraft/core/statements/TriggerFluidContainer.java index a70c06ad39..e31bcf3c0b 100644 --- a/common/buildcraft/core/statements/TriggerFluidContainer.java +++ b/common/buildcraft/core/statements/TriggerFluidContainer.java @@ -1,5 +1,5 @@ /** 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.core.statements; @@ -8,6 +8,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; + import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTankInfo; @@ -33,7 +34,7 @@ public enum State { public TriggerFluidContainer(State state) { super("buildcraft:fluid." + state.name().toLowerCase(Locale.ROOT), "buildcraft.fluid." + state.name().toLowerCase(Locale.ROOT)); - setBuildCraftLocation("core", "triggers/trigger_liquidcontainer_" + state.name().toLowerCase(Locale.ROOT)); + setBuildCraftLocation("core", "triggers/trigger_liquidcontainer_" + state.name().toLowerCase(Locale.ROOT)); this.state = state; } diff --git a/common/buildcraft/core/statements/TriggerFluidContainerLevel.java b/common/buildcraft/core/statements/TriggerFluidContainerLevel.java index 8a20c0dbbe..95d1ba5869 100644 --- a/common/buildcraft/core/statements/TriggerFluidContainerLevel.java +++ b/common/buildcraft/core/statements/TriggerFluidContainerLevel.java @@ -1,13 +1,18 @@ -/** 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 */ +/** + * 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.core.statements; import java.util.Locale; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; + import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTankInfo; @@ -29,7 +34,7 @@ public enum TriggerType { public final float level; - private TriggerType(float level) { + TriggerType(float level) { this.level = level; } } diff --git a/common/buildcraft/core/statements/TriggerInventory.java b/common/buildcraft/core/statements/TriggerInventory.java index a93988ce05..75dc487a0f 100644 --- a/common/buildcraft/core/statements/TriggerInventory.java +++ b/common/buildcraft/core/statements/TriggerInventory.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.core.statements; import java.util.Locale; diff --git a/common/buildcraft/core/statements/TriggerInventoryLevel.java b/common/buildcraft/core/statements/TriggerInventoryLevel.java index c037c9ff32..ebe51434f2 100644 --- a/common/buildcraft/core/statements/TriggerInventoryLevel.java +++ b/common/buildcraft/core/statements/TriggerInventoryLevel.java @@ -1,5 +1,5 @@ /** 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.core.statements; @@ -29,7 +29,7 @@ public enum TriggerType { BELOW75(0.75F); public final float level; - private TriggerType(float level) { + TriggerType(float level) { this.level = level; } } @@ -39,7 +39,7 @@ private TriggerType(float level) { public TriggerInventoryLevel(TriggerType type) { super("buildcraft:inventorylevel." + type.name().toLowerCase(Locale.ROOT), "buildcraft.inventorylevel." + type.name().toLowerCase( Locale.ROOT), "buildcraft.filteredBuffer." + type.name().toLowerCase(Locale.ROOT)); - setBuildCraftLocation("core", "triggers/trigger_inventory_"+type.name().toLowerCase(Locale.ROOT)); + setBuildCraftLocation("core", "triggers/trigger_inventory_" + type.name().toLowerCase(Locale.ROOT)); this.type = type; } diff --git a/common/buildcraft/core/statements/TriggerMachine.java b/common/buildcraft/core/statements/TriggerMachine.java index 8c6f5cc689..992b98f522 100644 --- a/common/buildcraft/core/statements/TriggerMachine.java +++ b/common/buildcraft/core/statements/TriggerMachine.java @@ -1,5 +1,5 @@ /** 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.core.statements; @@ -19,7 +19,7 @@ public class TriggerMachine extends BCStatement implements ITriggerExternal { public TriggerMachine(boolean active) { super("buildcraft:work." + (active ? "scheduled" : "done"), "buildcraft.work." + (active ? "scheduled" : "done")); - setBuildCraftLocation("core", "triggers/trigger_machine_" + (active ? "active" : "inactive")); + setBuildCraftLocation("core", "triggers/trigger_machine_" + (active ? "active" : "inactive")); this.active = active; } diff --git a/common/buildcraft/core/statements/TriggerRedstoneInput.java b/common/buildcraft/core/statements/TriggerRedstoneInput.java index 80a4d05315..3115a83b43 100644 --- a/common/buildcraft/core/statements/TriggerRedstoneInput.java +++ b/common/buildcraft/core/statements/TriggerRedstoneInput.java @@ -1,5 +1,5 @@ /** 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.core.statements; diff --git a/common/buildcraft/core/tablet/GuiTablet.java b/common/buildcraft/core/tablet/GuiTablet.java index f551423224..2bee8f6797 100644 --- a/common/buildcraft/core/tablet/GuiTablet.java +++ b/common/buildcraft/core/tablet/GuiTablet.java @@ -24,7 +24,6 @@ public class GuiTablet extends GuiScreen { private static final int X_SIZE = 142; private static final int Y_SIZE = 180; private final DynamicTextureBC display; - private final EntityPlayer player; private final TabletThread tabletThread; private final TabletClient tablet; private int guiLeft, guiTop; @@ -38,7 +37,6 @@ public GuiTablet(EntityPlayer player) { this.tabletThread = TabletManagerClient.INSTANCE.get(); this.tablet = (TabletClient) tabletThread.getTablet(); this.lastDate = (new Date()).getTime(); - this.player = player; this.display = new DynamicTextureBC(tablet.getScreenWidth(), tablet.getScreenHeight()); tablet.updateGui(0.0F, this, true); @@ -104,7 +102,6 @@ public void handleMouseInput() { } else if (buttonState == 2) { if (isButton(x, y)) { buttonState = ENABLE_HIGHLIGHT ? 0 : 1; - System.out.println("PRESS"); } else { buttonState = 1; } diff --git a/common/buildcraft/core/tablet/TabletBase.java b/common/buildcraft/core/tablet/TabletBase.java index be96272790..173a784449 100644 --- a/common/buildcraft/core/tablet/TabletBase.java +++ b/common/buildcraft/core/tablet/TabletBase.java @@ -11,59 +11,58 @@ import buildcraft.api.tablet.TabletProgramFactory; public abstract class TabletBase implements ITablet { - protected LinkedList programs = new LinkedList(); + protected final LinkedList programs = new LinkedList(); - protected TabletBase() { + protected TabletBase() { - } + } - public void tick(float time) { - if (programs.size() > 0) { - programs.getLast().tick(time); - } - } + public void tick(float time) { + if (programs.size() > 0) { + programs.getLast().tick(time); + } + } - @Override - public int getScreenWidth() { - return 244; - } + @Override + public int getScreenWidth() { + return 244; + } - @Override - public int getScreenHeight() { - return 306; - } + @Override + public int getScreenHeight() { + return 306; + } - protected boolean launchProgramInternal(String name) { - TabletProgramFactory factory = TabletAPI.getProgram(name); - if (factory == null) { - BCLog.logger.error("Tried to launch non-existent tablet program on side CLIENT: " + name); - return false; - } - TabletProgram program = factory.create(this); - if (program == null) { - BCLog.logger.error("Factory could not create program on side CLIENT: " + name); - return false; - } - programs.add(program); - return true; - } + protected boolean launchProgramInternal(String name) { + TabletProgramFactory factory = TabletAPI.getProgram(name); + if (factory == null) { + BCLog.logger.error("Tried to launch non-existent tablet program on side CLIENT: " + name); + return false; + } + TabletProgram program = factory.create(this); + if (program == null) { + BCLog.logger.error("Factory could not create program on side CLIENT: " + name); + return false; + } + programs.add(program); + return true; + } - public abstract void receiveMessage(NBTTagCompound compound); + public abstract void receiveMessage(NBTTagCompound compound); - protected boolean receiveMessageInternal(NBTTagCompound compound) { - if (compound.hasKey("__program")) { - compound.removeTag("__program"); - if (programs.getLast() != null) { - programs.getLast().receiveMessage(compound); - } - return true; - } else { - if (compound.hasKey("programToLaunch")) { - System.out.println("received"); - launchProgramInternal(compound.getString("programToLaunch")); - return true; - } - } - return false; - } + protected boolean receiveMessageInternal(NBTTagCompound compound) { + if (compound.hasKey("__program")) { + compound.removeTag("__program"); + if (programs.getLast() != null) { + programs.getLast().receiveMessage(compound); + } + return true; + } else { + if (compound.hasKey("programToLaunch")) { + launchProgramInternal(compound.getString("programToLaunch")); + return true; + } + } + return false; + } } diff --git a/common/buildcraft/core/tablet/TabletRenderer.java b/common/buildcraft/core/tablet/TabletRenderer.java index 546ab99850..ace3dc7b1c 100644 --- a/common/buildcraft/core/tablet/TabletRenderer.java +++ b/common/buildcraft/core/tablet/TabletRenderer.java @@ -4,71 +4,71 @@ import buildcraft.api.tablet.TabletTicker; class TabletRenderer { - private TabletBitmap currDisplay, newDisplay; - private TabletTicker refreshRate = new TabletTicker(0.035F); - private boolean changed = false; - private boolean isTicking = false; - private int tickLocation = 7; + private TabletBitmap currDisplay, newDisplay; + private final TabletTicker refreshRate = new TabletTicker(0.035F); + private boolean changed = false; + private boolean isTicking = false; + private int tickLocation = 7; - public TabletRenderer(TabletBitmap display) { - this.currDisplay = display; - } + public TabletRenderer(TabletBitmap display) { + this.currDisplay = display; + } - public TabletBitmap get() { - return currDisplay; - } + public TabletBitmap get() { + return currDisplay; + } - public boolean shouldChange() { - boolean oldChanged = changed; - changed = false; - return oldChanged; - } + public boolean shouldChange() { + boolean oldChanged = changed; + changed = false; + return oldChanged; + } - public void update(TabletBitmap display) { - synchronized (refreshRate) { - newDisplay = display; - isTicking = true; - tickLocation = 7; - refreshRate.reset(); - } - } + public void update(TabletBitmap display) { + synchronized (refreshRate) { + newDisplay = display; + isTicking = true; + tickLocation = 7; + refreshRate.reset(); + } + } - public boolean tick(float tick) { - if (isTicking) { - synchronized (refreshRate) { - refreshRate.add(tick); - changed = false; - for (int times = 0; times < refreshRate.getTicks(); times++) { - for (int j = 0; j < currDisplay.height; j++) { - for (int i = 0; i < currDisplay.width; i++) { - int oldI = currDisplay.get(i, j); - int newI = newDisplay.get(i, j); - if (Math.abs(oldI - newI) == tickLocation) { - if (oldI < newI) { - changed = true; - currDisplay.set(i, j, oldI + 1); - } else if (oldI > newI) { - changed = true; - currDisplay.set(i, j, oldI - 1); - } - } - } - } + public boolean tick(float tick) { + if (isTicking) { + synchronized (refreshRate) { + refreshRate.add(tick); + changed = false; + for (int times = 0; times < refreshRate.getTicks(); times++) { + for (int j = 0; j < currDisplay.height; j++) { + for (int i = 0; i < currDisplay.width; i++) { + int oldI = currDisplay.get(i, j); + int newI = newDisplay.get(i, j); + if (Math.abs(oldI - newI) == tickLocation) { + if (oldI < newI) { + changed = true; + currDisplay.set(i, j, oldI + 1); + } else if (oldI > newI) { + changed = true; + currDisplay.set(i, j, oldI - 1); + } + } + } + } - tickLocation--; + tickLocation--; - if (!changed || tickLocation == 0) { - isTicking = false; - break; - } - } + if (!changed || tickLocation == 0) { + isTicking = false; + break; + } + } - refreshRate.tick(); - } + refreshRate.tick(); + } - return true; - } else { - return false; - } - } + return true; + } else { + return false; + } + } } diff --git a/common/buildcraft/core/tablet/utils/TabletFont.java b/common/buildcraft/core/tablet/utils/TabletFont.java index cacc9e450c..5c41fb5483 100644 --- a/common/buildcraft/core/tablet/utils/TabletFont.java +++ b/common/buildcraft/core/tablet/utils/TabletFont.java @@ -1,10 +1,6 @@ package buildcraft.core.tablet.utils; -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; +import java.io.*; import buildcraft.api.tablet.TabletBitmap; @@ -70,7 +66,6 @@ public int draw(TabletBitmap bitmap, int x, int y, int intensity) { } } - private String family; private boolean isBold; private boolean isItalic; private int pointSize, maxW, maxH, ascent, descent; @@ -89,7 +84,7 @@ public TabletFont(InputStream stream) throws Exception { loaded += 8; if ("FAMI".equals(section)) { - this.family = readString(stream, sectionLength); + readString(stream, sectionLength); } else if ("WEIG".equals(section)) { this.isBold = "bold".equals(readString(stream, sectionLength)); } else if ("SLAN".equals(section)) { diff --git a/common/buildcraft/energy/BucketHandler.java b/common/buildcraft/energy/BucketHandler.java index 524c1091e1..b8022c8baa 100644 --- a/common/buildcraft/energy/BucketHandler.java +++ b/common/buildcraft/energy/BucketHandler.java @@ -1,5 +1,5 @@ /** 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.energy; @@ -13,6 +13,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; + import net.minecraftforge.event.entity.player.FillBucketEvent; import net.minecraftforge.fml.common.eventhandler.Event.Result; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; diff --git a/common/buildcraft/energy/EnergyGuiHandler.java b/common/buildcraft/energy/EnergyGuiHandler.java index 327b81bd66..b7982bb629 100644 --- a/common/buildcraft/energy/EnergyGuiHandler.java +++ b/common/buildcraft/energy/EnergyGuiHandler.java @@ -1,5 +1,5 @@ /** 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.energy; @@ -8,6 +8,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockPos; import net.minecraft.world.World; + import net.minecraftforge.fml.common.network.IGuiHandler; import buildcraft.core.GuiIds; diff --git a/common/buildcraft/energy/EnergyProxy.java b/common/buildcraft/energy/EnergyProxy.java index 0cdaa8750f..ea80fd36fb 100644 --- a/common/buildcraft/energy/EnergyProxy.java +++ b/common/buildcraft/energy/EnergyProxy.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.energy; import net.minecraftforge.fml.common.SidedProxy; diff --git a/common/buildcraft/energy/EnergyProxyClient.java b/common/buildcraft/energy/EnergyProxyClient.java index acc7e53224..6abd764b37 100644 --- a/common/buildcraft/energy/EnergyProxyClient.java +++ b/common/buildcraft/energy/EnergyProxyClient.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.energy; public class EnergyProxyClient extends EnergyProxy { diff --git a/common/buildcraft/energy/IMCHandlerEnergy.java b/common/buildcraft/energy/IMCHandlerEnergy.java index 90c9ec61a3..d330f3e16a 100644 --- a/common/buildcraft/energy/IMCHandlerEnergy.java +++ b/common/buildcraft/energy/IMCHandlerEnergy.java @@ -2,6 +2,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.biome.BiomeGenBase; + import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fml.common.event.FMLInterModComms.IMCEvent; diff --git a/common/buildcraft/energy/ItemBucketBuildcraft.java b/common/buildcraft/energy/ItemBucketBuildcraft.java index 0520aa867f..77b1891e36 100644 --- a/common/buildcraft/energy/ItemBucketBuildcraft.java +++ b/common/buildcraft/energy/ItemBucketBuildcraft.java @@ -1,5 +1,5 @@ /** 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.energy; diff --git a/common/buildcraft/energy/TileEngineCreative.java b/common/buildcraft/energy/TileEngineCreative.java index 9c365d23df..1de4c0c845 100644 --- a/common/buildcraft/energy/TileEngineCreative.java +++ b/common/buildcraft/energy/TileEngineCreative.java @@ -1,5 +1,5 @@ /** 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.energy; @@ -7,8 +7,9 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.EnumFacing; + import net.minecraftforge.common.util.FakePlayer; import buildcraft.BuildCraftCore; @@ -45,11 +46,10 @@ public boolean onBlockActivated(EntityPlayer player, EnumFacing side) { if (!(player instanceof FakePlayer)) { if (BuildCraftCore.hidePowerNumbers) { - player.addChatMessage(new ChatComponentText(String.format(StringUtils.localize("chat.pipe.power.iron.mode.numberless"), - StringUtils.localize("chat.pipe.power.iron.level." + powerMode.maxPower)))); + player.addChatMessage(new ChatComponentTranslation("chat.pipe.power.iron.mode.numberless", StringUtils.localize( + "chat.pipe.power.iron.level." + powerMode.maxPower))); } else { - player.addChatMessage(new ChatComponentText(String.format(StringUtils.localize("chat.pipe.power.iron.mode"), - powerMode.maxPower))); + player.addChatMessage(new ChatComponentTranslation("chat.pipe.power.iron.mode", powerMode.maxPower)); } } @@ -104,7 +104,7 @@ public void engineUpdate() { super.engineUpdate(); if (isRedstonePowered) { - addEnergy(calculateCurrentOutput()); + addEnergy(getIdealOutput()); } } @@ -113,23 +113,13 @@ public boolean isBurning() { return isRedstonePowered; } - @Override - public int maxEnergyReceived() { - return calculateCurrentOutput(); - } - - @Override - public int maxEnergyExtracted() { - return calculateCurrentOutput(); - } - @Override public int getMaxEnergy() { - return calculateCurrentOutput(); + return getIdealOutput(); } @Override - public int calculateCurrentOutput() { + public int getIdealOutput() { return powerMode.maxPower; } } diff --git a/common/buildcraft/energy/TileEngineIron.java b/common/buildcraft/energy/TileEngineIron.java index 1e505ca80c..0be43e4ec4 100644 --- a/common/buildcraft/energy/TileEngineIron.java +++ b/common/buildcraft/energy/TileEngineIron.java @@ -1,9 +1,16 @@ -/** 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 */ +/** + * 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.energy; +import java.util.LinkedList; +import java.util.List; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.ICrafting; @@ -11,13 +18,10 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; import net.minecraft.world.biome.BiomeGenBase; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTankInfo; -import net.minecraftforge.fluids.IFluidHandler; +import net.minecraftforge.fluids.*; + +import buildcraft.BuildCraftCore; import buildcraft.BuildCraftEnergy; import buildcraft.api.core.StackKey; import buildcraft.api.enums.EnumEnergyStage; @@ -26,6 +30,9 @@ import buildcraft.api.fuels.ICoolant; import buildcraft.api.fuels.IFuel; import buildcraft.api.fuels.ISolidCoolant; +import buildcraft.api.statements.IActionExternal; +import buildcraft.api.statements.IOverrideDefaultStatements; +import buildcraft.api.statements.ITriggerExternal; import buildcraft.api.transport.IItemPipe; import buildcraft.core.GuiIds; import buildcraft.core.lib.engines.TileEngineWithInventory; @@ -34,7 +41,7 @@ import buildcraft.core.lib.fluids.TankUtils; import buildcraft.core.lib.inventory.InvUtils; -public class TileEngineIron extends TileEngineWithInventory implements IFluidHandler { +public class TileEngineIron extends TileEngineWithInventory implements IFluidHandler, IOverrideDefaultStatements { public static int MAX_LIQUID = FluidContainerRegistry.BUCKET_VOLUME * 10; public static float HEAT_PER_RF = 0.00023F; @@ -112,6 +119,28 @@ public float getPistonSpeed() { } } + public boolean hasFuelBelowThreshold(float threshold) { + FluidStack fuel = tankFuel.getFluid(); + + if (fuel == null) { + return true; + } + + float percentage = (float) fuel.amount / (float) MAX_LIQUID; + return percentage < threshold; + } + + public boolean hasCoolantBelowThreshold(float threshold) { + FluidStack coolant = tankCoolant.getFluid(); + + if (coolant == null) { + return true; + } + + float percentage = (float) coolant.amount / (float) MAX_LIQUID; + return percentage < threshold; + } + private float getBiomeTempScalar() { if (biomeCache == null) { biomeCache = worldObj.getBiomeGenForCoords(pos); @@ -297,18 +326,16 @@ public void getGUINetworkData(int id, int value) { switch (id) { // Fluid Fuel ID case 15: - Fluid fluid = FluidRegistry.getFluid(value); - if (fluid != null) { - tankFuel.setFluid(new FluidStack(fluid, tankFuelAmountCache)); + if (FluidRegistry.getFluid(value) != null) { + tankFuel.setFluid(new FluidStack(FluidRegistry.getFluid(value), tankFuelAmountCache)); } else { tankFuel.setFluid(null); } break; // Fluid Coolant ID case 16: - fluid = FluidRegistry.getFluid(value); - if (fluid != null) { - tankCoolant.setFluid(new FluidStack(fluid, tankCoolantAmountCache)); + if (FluidRegistry.getFluid(value) != null) { + tankCoolant.setFluid(new FluidStack(FluidRegistry.getFluid(value), tankCoolantAmountCache)); } else { tankCoolant.setFluid(null); } @@ -383,12 +410,15 @@ public boolean canDrain(EnumFacing from, Fluid fluid) { @Override public int fill(EnumFacing from, FluidStack resource, boolean doFill) { + if (resource == null || resource.getFluid() == null) { + return 0; + } + if (BuildcraftFuelRegistry.coolant.getCoolant(resource.getFluid()) != null) { return tankCoolant.fill(resource, doFill); } else if (BuildcraftFuelRegistry.fuel.getFuel(resource.getFluid()) != null) { int filled = tankFuel.fill(resource, doFill); - if (filled > 0 && tankFuel.getFluid() != null && tankFuel.getFluid().getFluid() != null && tankFuel.getFluid() - .getFluid() != currentFuel) { + if (filled > 0 && tankFuel.getFluid() != null && tankFuel.getFluid().getFluid() != null && (currentFuel == null || tankFuel.getFluid().getFluid() != currentFuel.getFluid())) { currentFuel = BuildcraftFuelRegistry.fuel.getFuel(tankFuel.getFluid().getFluid()); } return filled; @@ -398,9 +428,10 @@ public int fill(EnumFacing from, FluidStack resource, boolean doFill) { } @Override - public boolean canFill(EnumFacing from, Fluid fluid) { - return from != orientation && (BuildcraftFuelRegistry.coolant.getCoolant(fluid) != null || BuildcraftFuelRegistry.fuel.getFuel( - fluid) != null); + public boolean canFill(EnumFacing from, Fluid fluid) { + return from != orientation && fluid != null && + (BuildcraftFuelRegistry.coolant.getCoolant(fluid) != null || + BuildcraftFuelRegistry.fuel.getFuel(fluid) != null); } @Override @@ -428,23 +459,13 @@ public FluidStack getCoolant() { return tankCoolant.getFluid(); } - @Override - public int maxEnergyReceived() { - return 20000; - } - - @Override - public int maxEnergyExtracted() { - return 5000; - } - @Override public int getMaxEnergy() { return 100000; } @Override - public int calculateCurrentOutput() { + public int getIdealOutput() { if (currentFuel == null) { return 0; } else { @@ -456,4 +477,33 @@ public int calculateCurrentOutput() { public boolean hasCustomName() { return false; } + + @Override + public List overrideTriggers() { + List triggers = new LinkedList(); + + triggers.add(BuildCraftCore.triggerEmptyInventory); + triggers.add(BuildCraftCore.triggerContainsInventory); + triggers.add(BuildCraftCore.triggerSpaceInventory); + triggers.add(BuildCraftCore.triggerFullInventory); + + triggers.add(BuildCraftEnergy.triggerBlueEngineHeat); + triggers.add(BuildCraftEnergy.triggerGreenEngineHeat); + triggers.add(BuildCraftEnergy.triggerYellowEngineHeat); + triggers.add(BuildCraftEnergy.triggerRedEngineHeat); + triggers.add(BuildCraftEnergy.triggerEngineOverheat); + + triggers.add(BuildCraftEnergy.triggerCoolantBelow25); + triggers.add(BuildCraftEnergy.triggerCoolantBelow50); + + triggers.add(BuildCraftEnergy.triggerFuelBelow25); + triggers.add(BuildCraftEnergy.triggerFuelBelow50); + + return triggers; + } + + @Override + public List overrideActions() { + return null; + } } diff --git a/common/buildcraft/energy/TileEngineStone.java b/common/buildcraft/energy/TileEngineStone.java index c2d2900cf4..dcec10695a 100644 --- a/common/buildcraft/energy/TileEngineStone.java +++ b/common/buildcraft/energy/TileEngineStone.java @@ -1,5 +1,5 @@ /** 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.energy; @@ -42,6 +42,11 @@ public EnumEngineType getEngineType() { return EnumEngineType.STONE; } + @Override + public int getCurrentOutputLimit() { + return (int) Math.floor((float) getIdealOutput() * heat / IDEAL_HEAT); + } + @Override public boolean onBlockActivated(EntityPlayer player, EnumFacing side) { if (super.onBlockActivated(player, side)) { @@ -69,7 +74,7 @@ public void burn() { if (burnTime > 0) { burnTime--; if (isRedstonePowered) { - currentOutput = calculateCurrentOutput(); + currentOutput = getIdealOutput(); addEnergy(currentOutput); } } else { @@ -135,23 +140,13 @@ public void sendGUINetworkData(Container containerEngine, ICrafting iCrafting) { iCrafting.sendProgressBarUpdate(containerEngine, 16, totalBurnTime); } - @Override - public int maxEnergyReceived() { - return 2000; - } - - @Override - public int maxEnergyExtracted() { - return 1000; - } - @Override public int getMaxEnergy() { return 10000; } @Override - public int calculateCurrentOutput() { + public int getIdealOutput() { if (burnItem != null && burnItem.getItem() == Items.paper) { return 1; } diff --git a/common/buildcraft/energy/fuels/CoolantManager.java b/common/buildcraft/energy/fuels/CoolantManager.java index 802c05ec39..97c5dc912a 100644 --- a/common/buildcraft/energy/fuels/CoolantManager.java +++ b/common/buildcraft/energy/fuels/CoolantManager.java @@ -1,5 +1,5 @@ /** 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.energy.fuels; @@ -9,6 +9,7 @@ import java.util.List; import net.minecraft.item.ItemStack; + import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; diff --git a/common/buildcraft/energy/fuels/FuelManager.java b/common/buildcraft/energy/fuels/FuelManager.java index 13fd5ad3b4..e6c517e0ce 100644 --- a/common/buildcraft/energy/fuels/FuelManager.java +++ b/common/buildcraft/energy/fuels/FuelManager.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.energy.fuels; import java.util.Collection; diff --git a/common/buildcraft/energy/gui/ContainerEngine.java b/common/buildcraft/energy/gui/ContainerEngine.java index ce473f27b9..4b1e61a77c 100644 --- a/common/buildcraft/energy/gui/ContainerEngine.java +++ b/common/buildcraft/energy/gui/ContainerEngine.java @@ -1,5 +1,5 @@ /** 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.energy.gui; @@ -43,8 +43,8 @@ public ContainerEngine(EntityPlayer player, TileEngineWithInventory tileEngine) public void detectAndSendChanges() { super.detectAndSendChanges(); - for (int i = 0; i < crafters.size(); i++) { - engine.sendGUINetworkData(this, (ICrafting) crafters.get(i)); + for (Object crafter : crafters) { + engine.sendGUINetworkData(this, (ICrafting) crafter); } } diff --git a/common/buildcraft/energy/gui/GuiCombustionEngine.java b/common/buildcraft/energy/gui/GuiCombustionEngine.java index 488ba30e37..22e06a1b11 100644 --- a/common/buildcraft/energy/gui/GuiCombustionEngine.java +++ b/common/buildcraft/energy/gui/GuiCombustionEngine.java @@ -1,12 +1,17 @@ /** 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.energy.gui; +import java.util.ArrayList; +import java.util.List; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fluids.FluidStack; + import buildcraft.core.lib.utils.StringUtils; import buildcraft.energy.TileEngineIron; @@ -24,14 +29,36 @@ protected void drawGuiContainerForegroundLayer(int par1, int par2) { String title = StringUtils.localize("tile.engineIron.name"); fontRendererObj.drawString(title, getCenteredOffset(title), 6, 0x404040); fontRendererObj.drawString(StringUtils.localize("gui.inventory"), 8, (ySize - 96) + 2, 0x404040); + + TileEngineIron engine = (TileEngineIron) tile; + FluidStack stack = null; + + if (engine != null) { + if (par2 >= (guiTop + 19) && par2 < (guiTop + 19 + 60)) { + if (par1 >= (guiLeft + 104) && par1 < (guiLeft + 104 + 16)) { + stack = engine.getFuel(); + } else if (par1 >= (guiLeft + 122) && par1 < (guiLeft + 122 + 16)) { + stack = engine.getCoolant(); + } + } + } + + if (stack != null && stack.amount > 0) { + List fluidTip = new ArrayList(); + fluidTip.add(stack.getLocalizedName()); + + drawHoveringText(fluidTip, par1 - guiLeft, par2 - guiTop, fontRendererObj); + } } @Override protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { super.drawGuiContainerBackgroundLayer(f, x, y); TileEngineIron engine = (TileEngineIron) tile; - drawFluid(engine.getFuel(), guiLeft + 104, guiTop + 19, 16, 58, TileEngineIron.MAX_LIQUID); - drawFluid(engine.getCoolant(), guiLeft + 122, guiTop + 19, 16, 58, TileEngineIron.MAX_LIQUID); + if (engine != null) { + drawFluid(engine.getFuel(), guiLeft + 104, guiTop + 19, 16, 58, TileEngineIron.MAX_LIQUID); + drawFluid(engine.getCoolant(), guiLeft + 122, guiTop + 19, 16, 58, TileEngineIron.MAX_LIQUID); + } mc.renderEngine.bindTexture(TEXTURE); drawTexturedModalRect(guiLeft + 104, guiTop + 19, 176, 0, 16, 60); drawTexturedModalRect(guiLeft + 122, guiTop + 19, 176, 0, 16, 60); diff --git a/common/buildcraft/energy/gui/GuiEngine.java b/common/buildcraft/energy/gui/GuiEngine.java index 6f2a916ce9..f732254567 100644 --- a/common/buildcraft/energy/gui/GuiEngine.java +++ b/common/buildcraft/energy/gui/GuiEngine.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.energy.gui; import net.minecraft.client.Minecraft; diff --git a/common/buildcraft/energy/gui/GuiStoneEngine.java b/common/buildcraft/energy/gui/GuiStoneEngine.java index 0341ca7241..69b438fc73 100644 --- a/common/buildcraft/energy/gui/GuiStoneEngine.java +++ b/common/buildcraft/energy/gui/GuiStoneEngine.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.energy.gui; import org.lwjgl.opengl.GL11; diff --git a/common/buildcraft/energy/statements/EnergyStatementProvider.java b/common/buildcraft/energy/statements/EnergyStatementProvider.java index 3af1e16657..dbeb4e7dc0 100644 --- a/common/buildcraft/energy/statements/EnergyStatementProvider.java +++ b/common/buildcraft/energy/statements/EnergyStatementProvider.java @@ -1,5 +1,5 @@ /** 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.energy.statements; @@ -10,12 +10,12 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; +import buildcraft.BuildCraftEnergy; import buildcraft.api.statements.IStatementContainer; import buildcraft.api.statements.ITriggerExternal; import buildcraft.api.statements.ITriggerInternal; import buildcraft.api.statements.ITriggerProvider; import buildcraft.core.lib.engines.TileEngineBase; -import buildcraft.BuildCraftEnergy; public class EnergyStatementProvider implements ITriggerProvider { diff --git a/common/buildcraft/energy/statements/TriggerCoolantBelowThreshold.java b/common/buildcraft/energy/statements/TriggerCoolantBelowThreshold.java new file mode 100644 index 0000000000..dbafbb3496 --- /dev/null +++ b/common/buildcraft/energy/statements/TriggerCoolantBelowThreshold.java @@ -0,0 +1,40 @@ +/** 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.energy.statements; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; + +import buildcraft.api.statements.IStatementContainer; +import buildcraft.api.statements.IStatementParameter; +import buildcraft.api.statements.ITriggerExternal; +import buildcraft.core.lib.utils.StringUtils; +import buildcraft.core.statements.BCStatement; +import buildcraft.energy.TileEngineIron; + +public class TriggerCoolantBelowThreshold extends BCStatement implements ITriggerExternal { + + private float threshold; + + public TriggerCoolantBelowThreshold(float threshold) { + super("buildcraft:trigger.coolantLevelBelow." + (int) (threshold * 100)); + setBuildCraftLocation("energy", "triggers/trigger_coolant_below_threshold"); + this.threshold = threshold; + } + + @Override + public String getDescription() { + return String.format(StringUtils.localize("gate.trigger.coolantLevelBelow"), (int) (threshold * 100)); + } + + @Override + public boolean isTriggerActive(TileEntity target, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) { + if (!(target instanceof TileEngineIron)) { + return false; + } + + return ((TileEngineIron) target).hasCoolantBelowThreshold(threshold); + } +} diff --git a/common/buildcraft/energy/statements/TriggerEngineHeat.java b/common/buildcraft/energy/statements/TriggerEngineHeat.java index b89a276876..1d5fa49477 100644 --- a/common/buildcraft/energy/statements/TriggerEngineHeat.java +++ b/common/buildcraft/energy/statements/TriggerEngineHeat.java @@ -1,5 +1,5 @@ /** 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.energy.statements; @@ -42,11 +42,4 @@ public boolean isTriggerActive(TileEntity tile, EnumFacing side, IStatementConta return false; } - - // @Override - // @SideOnly(Side.CLIENT) - // public void registerIcons(TextureAtlasSpriteRegister iconRegister) { - // icon = iconRegister.registerIcon("buildcraftenergy:triggers/trigger_engineheat_" + - // stage.name().toLowerCase(Locale.ENGLISH)); - // } } diff --git a/common/buildcraft/energy/statements/TriggerFuelBelowThreshold.java b/common/buildcraft/energy/statements/TriggerFuelBelowThreshold.java new file mode 100644 index 0000000000..526e2a7586 --- /dev/null +++ b/common/buildcraft/energy/statements/TriggerFuelBelowThreshold.java @@ -0,0 +1,40 @@ +/** 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.energy.statements; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; + +import buildcraft.api.statements.IStatementContainer; +import buildcraft.api.statements.IStatementParameter; +import buildcraft.api.statements.ITriggerExternal; +import buildcraft.core.lib.utils.StringUtils; +import buildcraft.core.statements.BCStatement; +import buildcraft.energy.TileEngineIron; + +public class TriggerFuelBelowThreshold extends BCStatement implements ITriggerExternal { + + private float threshold; + + public TriggerFuelBelowThreshold(float threshold) { + super("buildcraft:trigger.fuelLevelBelow." + (int) (threshold * 100)); + setBuildCraftLocation("energy", "triggers/trigger_fuel_below_threshold"); + this.threshold = threshold; + } + + @Override + public String getDescription() { + return String.format(StringUtils.localize("gate.trigger.fuelLevelBelow"), (int) (threshold * 100)); + } + + @Override + public boolean isTriggerActive(TileEntity target, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) { + if (!(target instanceof TileEngineIron)) { + return false; + } + + return ((TileEngineIron) target).hasFuelBelowThreshold(threshold); + } +} diff --git a/common/buildcraft/energy/worldgen/BiomeGenOilDesert.java b/common/buildcraft/energy/worldgen/BiomeGenOilDesert.java index cd63f7b42b..d3f81bc639 100644 --- a/common/buildcraft/energy/worldgen/BiomeGenOilDesert.java +++ b/common/buildcraft/energy/worldgen/BiomeGenOilDesert.java @@ -1,11 +1,16 @@ -/** 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 */ +/** + * 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.energy.worldgen; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.BiomeGenDesert; + import net.minecraftforge.common.BiomeDictionary; public final class BiomeGenOilDesert extends BiomeGenDesert { diff --git a/common/buildcraft/energy/worldgen/BiomeGenOilOcean.java b/common/buildcraft/energy/worldgen/BiomeGenOilOcean.java index 8a5693849c..30d1ed7bb3 100644 --- a/common/buildcraft/energy/worldgen/BiomeGenOilOcean.java +++ b/common/buildcraft/energy/worldgen/BiomeGenOilOcean.java @@ -1,11 +1,16 @@ -/** 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 */ +/** + * 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.energy.worldgen; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.BiomeGenOcean; + import net.minecraftforge.common.BiomeDictionary; public final class BiomeGenOilOcean extends BiomeGenOcean { diff --git a/common/buildcraft/energy/worldgen/BiomeInitializer.java b/common/buildcraft/energy/worldgen/BiomeInitializer.java index 4c7f4188d9..33ca9542ed 100644 --- a/common/buildcraft/energy/worldgen/BiomeInitializer.java +++ b/common/buildcraft/energy/worldgen/BiomeInitializer.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.energy.worldgen; import net.minecraftforge.event.terraingen.WorldTypeEvent; diff --git a/common/buildcraft/energy/worldgen/GenLayerAddOilDesert.java b/common/buildcraft/energy/worldgen/GenLayerAddOilDesert.java index 6e3c2ed204..5c293a4e1a 100644 --- a/common/buildcraft/energy/worldgen/GenLayerAddOilDesert.java +++ b/common/buildcraft/energy/worldgen/GenLayerAddOilDesert.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.energy.worldgen; import net.minecraft.world.biome.BiomeGenBase; diff --git a/common/buildcraft/energy/worldgen/GenLayerAddOilOcean.java b/common/buildcraft/energy/worldgen/GenLayerAddOilOcean.java index d506908959..ee3c358386 100644 --- a/common/buildcraft/energy/worldgen/GenLayerAddOilOcean.java +++ b/common/buildcraft/energy/worldgen/GenLayerAddOilOcean.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.energy.worldgen; import net.minecraft.world.biome.BiomeGenBase; diff --git a/common/buildcraft/energy/worldgen/GenLayerBiomeReplacer.java b/common/buildcraft/energy/worldgen/GenLayerBiomeReplacer.java index 2ce0d14f21..b2bc5cd417 100644 --- a/common/buildcraft/energy/worldgen/GenLayerBiomeReplacer.java +++ b/common/buildcraft/energy/worldgen/GenLayerBiomeReplacer.java @@ -1,5 +1,5 @@ /** 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.energy.worldgen; @@ -9,6 +9,8 @@ import net.minecraft.world.gen.layer.GenLayer; import net.minecraft.world.gen.layer.IntCache; +import buildcraft.core.lib.utils.SimplexNoise; + public abstract class GenLayerBiomeReplacer extends GenLayer { public static final int OFFSET_RANGE = 500000; diff --git a/common/buildcraft/energy/worldgen/OilPopulate.java b/common/buildcraft/energy/worldgen/OilPopulate.java index 85ab3c28db..000a573f4d 100644 --- a/common/buildcraft/energy/worldgen/OilPopulate.java +++ b/common/buildcraft/energy/worldgen/OilPopulate.java @@ -1,5 +1,5 @@ /** 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.energy.worldgen; @@ -20,6 +20,7 @@ import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.chunk.Chunk; + import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.event.terraingen.PopulateChunkEvent; import net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType; @@ -29,10 +30,10 @@ import net.minecraftforge.fml.common.eventhandler.Event.Result; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import buildcraft.api.enums.EnumSpring; -import buildcraft.api.properties.BuildCraftProperties; import buildcraft.BuildCraftCore; import buildcraft.BuildCraftEnergy; +import buildcraft.api.enums.EnumSpring; +import buildcraft.api.properties.BuildCraftProperties; public final class OilPopulate { diff --git a/common/buildcraft/factory/BlockAutoWorkbench.java b/common/buildcraft/factory/BlockAutoWorkbench.java index dd01681b3b..e1b58a61f5 100644 --- a/common/buildcraft/factory/BlockAutoWorkbench.java +++ b/common/buildcraft/factory/BlockAutoWorkbench.java @@ -1,5 +1,5 @@ /** 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.factory; diff --git a/common/buildcraft/factory/BlockFloodGate.java b/common/buildcraft/factory/BlockFloodGate.java index 5fa610f393..60b6c35759 100644 --- a/common/buildcraft/factory/BlockFloodGate.java +++ b/common/buildcraft/factory/BlockFloodGate.java @@ -1,5 +1,5 @@ /** 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.factory; @@ -46,7 +46,6 @@ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, En // Restart the flood gate if it's a wrench Item equipped = entityplayer.getCurrentEquippedItem() != null ? entityplayer.getCurrentEquippedItem().getItem() : null; if (equipped instanceof IToolWrench && ((IToolWrench) equipped).canWrench(entityplayer, pos)) { - System.out.println("pre=" + side); if (side == EnumFacing.UP) { floodGate.rebuildQueue(); } else { diff --git a/common/buildcraft/factory/BlockMiningWell.java b/common/buildcraft/factory/BlockMiningWell.java index a32afe02fb..27eeba8f8f 100644 --- a/common/buildcraft/factory/BlockMiningWell.java +++ b/common/buildcraft/factory/BlockMiningWell.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.factory; import net.minecraft.block.Block; diff --git a/common/buildcraft/factory/BlockPlainPipe.java b/common/buildcraft/factory/BlockPlainPipe.java index 10b11c676e..a94dbd02c5 100644 --- a/common/buildcraft/factory/BlockPlainPipe.java +++ b/common/buildcraft/factory/BlockPlainPipe.java @@ -1,5 +1,5 @@ /** 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.factory; @@ -45,9 +45,8 @@ public boolean isNormalCube() { return false; } - @SuppressWarnings({ "unchecked", "rawtypes" }) @Override - public void getSubBlocks(Item item, CreativeTabs tab, List list) { + public void getSubBlocks(Item item, CreativeTabs tab, List list) { list.add(new ItemStack(this)); } diff --git a/common/buildcraft/factory/BlockPump.java b/common/buildcraft/factory/BlockPump.java index 1bea5148af..5fe458706f 100644 --- a/common/buildcraft/factory/BlockPump.java +++ b/common/buildcraft/factory/BlockPump.java @@ -1,5 +1,5 @@ /** 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.factory; diff --git a/common/buildcraft/factory/BlockRefinery.java b/common/buildcraft/factory/BlockRefinery.java index cc2dea1226..7a86fab7c4 100644 --- a/common/buildcraft/factory/BlockRefinery.java +++ b/common/buildcraft/factory/BlockRefinery.java @@ -1,5 +1,5 @@ /** 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.factory; @@ -14,6 +14,7 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.world.World; + import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -87,10 +88,10 @@ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, En return true; } - @Override - public int getRenderType() { - return 2; - } + @Override + public int getRenderType() { + return 2; + } @SideOnly(Side.CLIENT) public EnumWorldBlockLayer getBlockLayer() { diff --git a/common/buildcraft/factory/BlockTank.java b/common/buildcraft/factory/BlockTank.java index cc1902c50b..af42c488d2 100644 --- a/common/buildcraft/factory/BlockTank.java +++ b/common/buildcraft/factory/BlockTank.java @@ -1,5 +1,5 @@ /** 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.factory; @@ -10,13 +10,10 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.*; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; + import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidContainerItem; diff --git a/common/buildcraft/factory/FactoryGuiHandler.java b/common/buildcraft/factory/FactoryGuiHandler.java index 68731fe463..f0c8e3cb9a 100644 --- a/common/buildcraft/factory/FactoryGuiHandler.java +++ b/common/buildcraft/factory/FactoryGuiHandler.java @@ -1,5 +1,5 @@ /** 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.factory; @@ -8,15 +8,11 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockPos; import net.minecraft.world.World; + import net.minecraftforge.fml.common.network.IGuiHandler; import buildcraft.core.GuiIds; -import buildcraft.factory.gui.ContainerAutoWorkbench; -import buildcraft.factory.gui.ContainerChute; -import buildcraft.factory.gui.ContainerRefinery; -import buildcraft.factory.gui.GuiAutoCrafting; -import buildcraft.factory.gui.GuiChute; -import buildcraft.factory.gui.GuiRefinery; +import buildcraft.factory.gui.*; public class FactoryGuiHandler implements IGuiHandler { diff --git a/common/buildcraft/factory/FactoryProxy.java b/common/buildcraft/factory/FactoryProxy.java index 7282a5eef2..1d3fe913d4 100644 --- a/common/buildcraft/factory/FactoryProxy.java +++ b/common/buildcraft/factory/FactoryProxy.java @@ -1,5 +1,5 @@ /** 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.factory; diff --git a/common/buildcraft/factory/FactoryProxyClient.java b/common/buildcraft/factory/FactoryProxyClient.java index f24f32d5b2..7d80331e0e 100644 --- a/common/buildcraft/factory/FactoryProxyClient.java +++ b/common/buildcraft/factory/FactoryProxyClient.java @@ -1,14 +1,12 @@ /** 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.factory; import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.item.Item; import net.minecraft.world.World; -import net.minecraftforge.client.ForgeHooksClient; import net.minecraftforge.fml.client.registry.ClientRegistry; import buildcraft.BuildCraftFactory; @@ -32,11 +30,6 @@ public void initializeTileEntities() { } } - @Override - public void initializeEntityRenders() { - ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(BuildCraftFactory.refineryBlock), 0, TileRefinery.class); - } - @Override public EntityResizableCuboid newPumpTube(World w) { EntityResizableCuboid eb = super.newPumpTube(w); diff --git a/common/buildcraft/factory/PumpDimensionList.java b/common/buildcraft/factory/PumpDimensionList.java index ba4124c66d..9fa8bd2c0f 100644 --- a/common/buildcraft/factory/PumpDimensionList.java +++ b/common/buildcraft/factory/PumpDimensionList.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.factory; import java.util.ArrayList; diff --git a/common/buildcraft/factory/TileAutoWorkbench.java b/common/buildcraft/factory/TileAutoWorkbench.java index 16bcb99c42..b732314766 100644 --- a/common/buildcraft/factory/TileAutoWorkbench.java +++ b/common/buildcraft/factory/TileAutoWorkbench.java @@ -1,5 +1,5 @@ /** 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.factory; @@ -7,11 +7,7 @@ import java.lang.ref.WeakReference; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.ISidedInventory; -import net.minecraft.inventory.InventoryCraftResult; -import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.inventory.SlotCrafting; +import net.minecraft.inventory.*; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; import net.minecraft.nbt.NBTTagCompound; @@ -26,11 +22,7 @@ import buildcraft.core.lib.RFBattery; import buildcraft.core.lib.block.TileBuildCraft; import buildcraft.core.lib.gui.ContainerDummy; -import buildcraft.core.lib.inventory.InvUtils; -import buildcraft.core.lib.inventory.InventoryConcatenator; -import buildcraft.core.lib.inventory.InventoryIterator; -import buildcraft.core.lib.inventory.SimpleInventory; -import buildcraft.core.lib.inventory.StackHelper; +import buildcraft.core.lib.inventory.*; import buildcraft.core.lib.utils.CraftingUtils; import buildcraft.core.lib.utils.Utils; import buildcraft.core.proxy.CoreProxy; @@ -248,15 +240,6 @@ public void readFromNBT(NBTTagCompound data) { } craftMatrix.rebuildCache(); - - // Legacy Code - if (data.hasKey("stackList")) { - ItemStack[] stacks = new ItemStack[9]; - InvUtils.readStacksFromNBT(data, "stackList", stacks); - for (int i = 0; i < 9; i++) { - craftMatrix.setInventorySlotContents(i, stacks[i]); - } - } } @Override @@ -411,7 +394,20 @@ public int[] getSlotsForFace(EnumFacing face) { @Override public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side) { - return slot < 9; + if (slot >= 9) { + return false; + } + ItemStack slotStack = inv.getStackInSlot(slot); + if (StackHelper.canStacksMerge(stack, slotStack)) { + return true; + } + for (int i = 0; i < 9; i++) { + ItemStack inputStack = craftMatrix.getStackInSlot(i); + if (inputStack != null && StackHelper.isMatchingItem(inputStack, stack, true, false)) { + return true; + } + } + return false; } @Override diff --git a/common/buildcraft/factory/TileFloodGate.java b/common/buildcraft/factory/TileFloodGate.java index 301d27908c..78101b1e38 100644 --- a/common/buildcraft/factory/TileFloodGate.java +++ b/common/buildcraft/factory/TileFloodGate.java @@ -1,15 +1,14 @@ -/** 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 */ +/** + * 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.factory; -import java.util.Deque; -import java.util.EnumMap; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.Set; -import java.util.TreeMap; +import java.util.*; import com.google.common.collect.Maps; @@ -17,13 +16,8 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; -import net.minecraftforge.fluids.BlockFluidBase; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTankInfo; -import net.minecraftforge.fluids.IFluidHandler; + +import net.minecraftforge.fluids.*; import buildcraft.api.core.BuildCraftAPI; import buildcraft.core.lib.block.TileBuildCraft; @@ -103,7 +97,7 @@ public void update() { } private boolean placeFluid(BlockPos pos, Fluid fluid) { - Block block = BlockUtils.getBlock(worldObj, pos); + Block block = BlockUtils.getBlockState(worldObj, pos).getBlock(); if (canPlaceFluidAt(block, pos)) { boolean placed; @@ -203,7 +197,7 @@ public void queueForFilling(BlockPos pos) { return; } - Block block = BlockUtils.getBlock(worldObj, pos); + Block block = BlockUtils.getBlockState(worldObj, pos).getBlock(); if (BlockUtils.getFluid(block) == tank.getFluidType()) { fluidsFound.add(pos); } diff --git a/common/buildcraft/factory/TileMiningWell.java b/common/buildcraft/factory/TileMiningWell.java index c5e2262d90..c3a89ab808 100644 --- a/common/buildcraft/factory/TileMiningWell.java +++ b/common/buildcraft/factory/TileMiningWell.java @@ -1,5 +1,5 @@ /** 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.factory; @@ -96,10 +96,11 @@ public void update() { int usedEnergy = miner.acceptEnergy(getBattery().getEnergyStored()); getBattery().useEnergy(usedEnergy, usedEnergy, false); - if (miner.hasMined()) { - if (miner.hasFailed()) { - isDigging = false; - } + if (miner.hasFailed()) { + isDigging = false; + } + + if (miner.hasFailed() || miner.hasMined()) { miner = null; } } diff --git a/common/buildcraft/factory/TilePump.java b/common/buildcraft/factory/TilePump.java index 0889063cf7..49ee93a610 100644 --- a/common/buildcraft/factory/TilePump.java +++ b/common/buildcraft/factory/TilePump.java @@ -1,14 +1,10 @@ /** 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.factory; -import java.util.Deque; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.Set; -import java.util.TreeMap; +import java.util.*; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -16,18 +12,14 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTankInfo; -import net.minecraftforge.fluids.IFluidHandler; +import net.minecraftforge.fluids.*; + +import buildcraft.BuildCraftCore; import buildcraft.BuildCraftFactory; import buildcraft.api.core.SafeTimeTracker; import buildcraft.api.power.IRedstoneEngineReceiver; import buildcraft.api.tiles.IHasWork; -import buildcraft.BuildCraftCore; import buildcraft.core.CoreConstants; import buildcraft.core.lib.EntityResizableCuboid; import buildcraft.core.lib.RFBattery; @@ -157,8 +149,7 @@ public void onNeighborBlockChange(Block block) { } private boolean isBlocked(BlockPos pos) { - Material mat = BlockUtils.getBlock(worldObj, pos).getMaterial(); - + Material mat = BlockUtils.getBlockState(worldObj, pos).getBlock().getMaterial(); return mat.blocksMovement(); } @@ -250,7 +241,7 @@ public void rebuildQueue() { int y = aimY; int z = pos.getZ(); BlockPos pos = new BlockPos(x, y, z); - Fluid pumpingFluid = BlockUtils.getFluid(BlockUtils.getBlock(worldObj, pos)); + Fluid pumpingFluid = BlockUtils.getFluid(BlockUtils.getBlockState(worldObj, pos).getBlock()); if (pumpingFluid == null) { return; @@ -310,7 +301,7 @@ public void queueForPumping(BlockPos pos, Set visitedBlocks, Deque + * 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.factory; import java.util.List; @@ -13,21 +17,17 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTankInfo; -import net.minecraftforge.fluids.IFluidHandler; + +import net.minecraftforge.fluids.*; import net.minecraftforge.fml.relauncher.Side; +import buildcraft.BuildCraftCore; import buildcraft.api.core.SafeTimeTracker; import buildcraft.api.recipes.CraftingResult; import buildcraft.api.recipes.IFlexibleCrafter; import buildcraft.api.recipes.IFlexibleRecipe; import buildcraft.api.tiles.IDebuggable; import buildcraft.api.tiles.IHasWork; -import buildcraft.BuildCraftCore; import buildcraft.core.lib.RFBattery; import buildcraft.core.lib.block.TileBuildCraft; import buildcraft.core.lib.fluids.SingleUseTank; diff --git a/common/buildcraft/factory/TileTank.java b/common/buildcraft/factory/TileTank.java index 4f97debca9..5e6de3b23c 100644 --- a/common/buildcraft/factory/TileTank.java +++ b/common/buildcraft/factory/TileTank.java @@ -1,5 +1,5 @@ /** 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.factory; @@ -11,13 +11,7 @@ import net.minecraft.util.EnumFacing; import net.minecraft.world.EnumSkyBlock; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidEvent; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTank; -import net.minecraftforge.fluids.FluidTankInfo; -import net.minecraftforge.fluids.IFluidHandler; +import net.minecraftforge.fluids.*; import buildcraft.BuildCraftCore; import buildcraft.api.core.SafeTimeTracker; @@ -25,6 +19,7 @@ import buildcraft.core.lib.block.TileBuildCraft; import buildcraft.core.lib.fluids.Tank; import buildcraft.core.lib.fluids.TankManager; +import buildcraft.core.lib.utils.BlockUtils; import io.netty.buffer.ByteBuf; @@ -82,6 +77,7 @@ public void update() { if (hasUpdate) { worldObj.notifyBlockOfStateChange(pos, blockType); + BlockUtils.onComparatorUpdate(worldObj, pos, getBlockType()); hasUpdate = false; } @@ -116,6 +112,7 @@ public void writeToNBT(NBTTagCompound data) { } /* HELPER FUNCTIONS */ + /** @return Last tank block below this one or this one if it is the last. */ public TileTank getBottomTank() { @@ -255,18 +252,16 @@ public FluidTankInfo[] getTankInfo(EnumFacing direction) { TileTank tile = getBottomTank(); - int capacity = tank.getCapacity(); - if (tile != null && tile.tank.getFluid() != null) { compositeTank.setFluid(tile.tank.getFluid().copy()); } else { return new FluidTankInfo[] { compositeTank.getInfo() }; } + int capacity = tile.tank.getCapacity(); tile = getTankAbove(tile); while (tile != null) { - FluidStack liquid = tile.tank.getFluid(); if (liquid == null || liquid.amount == 0) { // NOOP diff --git a/common/buildcraft/factory/gui/ContainerAutoWorkbench.java b/common/buildcraft/factory/gui/ContainerAutoWorkbench.java index 3373e63d9e..35717b30cb 100644 --- a/common/buildcraft/factory/gui/ContainerAutoWorkbench.java +++ b/common/buildcraft/factory/gui/ContainerAutoWorkbench.java @@ -1,5 +1,5 @@ /** 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.factory.gui; @@ -63,8 +63,8 @@ public void onCraftGuiOpened(ICrafting icrafting) { @Override public void detectAndSendChanges() { super.detectAndSendChanges(); - for (int i = 0; i < crafters.size(); i++) { - ICrafting icrafting = (ICrafting) crafters.get(i); + for (Object crafter : crafters) { + ICrafting icrafting = (ICrafting) crafter; if (lastProgress != tile.progress) { icrafting.sendProgressBarUpdate(this, 0, tile.progress); diff --git a/common/buildcraft/factory/gui/ContainerRefinery.java b/common/buildcraft/factory/gui/ContainerRefinery.java index 24bebbff2a..443c4996e2 100644 --- a/common/buildcraft/factory/gui/ContainerRefinery.java +++ b/common/buildcraft/factory/gui/ContainerRefinery.java @@ -1,5 +1,5 @@ /** 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.factory.gui; @@ -7,6 +7,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.Slot; + import net.minecraftforge.fluids.Fluid; import buildcraft.BuildCraftFactory; @@ -38,7 +39,7 @@ public ContainerRefinery(EntityPlayer player, TileRefinery refinery) { @Override public boolean canInteractWith(EntityPlayer entityplayer) { - return refinery.isUseableByPlayer(entityplayer); + return entityplayer.worldObj.getTileEntity(refinery.getPos()) == refinery; } /* SETTING AND GETTING FILTERS */ @@ -71,8 +72,8 @@ public void updateProgressBar(int i, int j) { @Override public void detectAndSendChanges() { super.detectAndSendChanges(); - for (int i = 0; i < crafters.size(); i++) { - refinery.sendGUINetworkData(this, (ICrafting) crafters.get(i)); + for (Object crafter : crafters) { + refinery.sendGUINetworkData(this, (ICrafting) crafter); } } } diff --git a/common/buildcraft/factory/gui/GuiAutoCrafting.java b/common/buildcraft/factory/gui/GuiAutoCrafting.java index fe35da3c76..a900e850ce 100644 --- a/common/buildcraft/factory/gui/GuiAutoCrafting.java +++ b/common/buildcraft/factory/gui/GuiAutoCrafting.java @@ -1,5 +1,5 @@ /** 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.factory.gui; diff --git a/common/buildcraft/factory/gui/GuiRefinery.java b/common/buildcraft/factory/gui/GuiRefinery.java index 1f50199c13..801820683c 100644 --- a/common/buildcraft/factory/gui/GuiRefinery.java +++ b/common/buildcraft/factory/gui/GuiRefinery.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.factory.gui; import java.io.IOException; @@ -10,6 +14,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; + import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidStack; @@ -56,7 +61,7 @@ protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); updateSlots(); - drawBackgroundSlots(); + drawBackgroundSlots(x, y); } @Override @@ -81,12 +86,10 @@ protected void mouseClicked(int x, int y, int mouse) throws IOException { container.refinery.tankManager.get(position).colorRenderCache = 0xFFFFFF; } } else { - TileRefinery ref = (TileRefinery) this.tile; - if (position == 0) { - container.setFilter(position, ref.tanks[0].getFluidType()); + container.setFilter(position, container.refinery.tanks[0].getFluidType()); } else if (position == 1) { - container.setFilter(position, ref.tanks[1].getFluidType()); + container.setFilter(position, container.refinery.tanks[1].getFluidType()); } } } diff --git a/common/buildcraft/factory/gui/SlotWorkbench.java b/common/buildcraft/factory/gui/SlotWorkbench.java index 100a9db6a4..afde980e19 100644 --- a/common/buildcraft/factory/gui/SlotWorkbench.java +++ b/common/buildcraft/factory/gui/SlotWorkbench.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.factory.gui; import net.minecraft.inventory.IInventory; diff --git a/common/buildcraft/factory/render/ChuteRenderModel.java b/common/buildcraft/factory/render/ChuteRenderModel.java index ed2d4442ff..11ed57f34a 100644 --- a/common/buildcraft/factory/render/ChuteRenderModel.java +++ b/common/buildcraft/factory/render/ChuteRenderModel.java @@ -18,24 +18,21 @@ public class ChuteRenderModel extends BuildCraftBakedModel { public static TextureAtlasSprite sideTexture = null; - @SuppressWarnings("deprecation") private final IBakedModel parent; - @SuppressWarnings("deprecation") protected ChuteRenderModel(ImmutableList quads, IBakedModel parent) { super(quads, null, DefaultVertexFormats.BLOCK); this.parent = parent; } - @SuppressWarnings({ "deprecation", "unchecked" }) public static ChuteRenderModel create(IBakedModel parent) { if (parent == null) { /* The "chute.json" block model file contains the top and bottom boxes, so it will look strange if it * doesn't exist. Just print out a warning to make sure they know that this is why. Print out a full stack * trace because this really shouldn't happen, and it makes it much more obvious in the logfile where the * error message is. */ - new IllegalStateException("For some reason, the block model for the chute block was missing!" - + "\nThis is not meant to happen, you have a bad JAR file!").printStackTrace(); + throw new IllegalStateException("For some reason, the block model for the chute block was missing!" + + "\nThis is not meant to happen, you have a bad JAR file!"); } List lst = Lists.newArrayList(parent.getGeneralQuads()); diff --git a/common/buildcraft/factory/render/RenderRefinery.java b/common/buildcraft/factory/render/RenderRefinery.java index 5c8396eff4..2c50e942c6 100644 --- a/common/buildcraft/factory/render/RenderRefinery.java +++ b/common/buildcraft/factory/render/RenderRefinery.java @@ -1,5 +1,5 @@ /** 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.factory.render; @@ -163,6 +163,8 @@ public void renderTileEntityAt(TileRefinery tile, double x, double y, double z, GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + bindTexture(TextureMap.locationBlocksTexture); + if (liquid1 != null && liquid1.amount > 0) { int[] list1 = FluidRenderer.getFluidDisplayLists(liquid1, false, TANK_SIZE); diff --git a/common/buildcraft/factory/render/RenderTank.java b/common/buildcraft/factory/render/RenderTank.java index f37b71497e..0c0a39fc20 100644 --- a/common/buildcraft/factory/render/RenderTank.java +++ b/common/buildcraft/factory/render/RenderTank.java @@ -1,5 +1,5 @@ /** 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.factory.render; @@ -14,6 +14,7 @@ import buildcraft.core.lib.render.FluidRenderer; import buildcraft.core.lib.render.RenderUtils; +import buildcraft.core.proxy.CoreProxy; import buildcraft.factory.TileTank; public class RenderTank extends TileEntitySpecialRenderer { @@ -21,6 +22,7 @@ public class RenderTank extends TileEntitySpecialRenderer { @Override public void renderTileEntityAt(TileTank tank, double x, double y, double z, float f, int minusOne) { + tank = CoreProxy.proxy.getServerTile(tank); FluidStack liquid = tank.tank.getFluid(); int color = tank.tank.colorRenderCache; diff --git a/common/buildcraft/factory/schematics/SchematicAutoWorkbench.java b/common/buildcraft/factory/schematics/SchematicAutoWorkbench.java index eb5eb1ea69..28cee4cabf 100644 --- a/common/buildcraft/factory/schematics/SchematicAutoWorkbench.java +++ b/common/buildcraft/factory/schematics/SchematicAutoWorkbench.java @@ -1,5 +1,5 @@ /** 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.factory.schematics; @@ -12,12 +12,12 @@ import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import buildcraft.BuildCraftFactory; import buildcraft.api.blueprints.IBuilderContext; import buildcraft.api.blueprints.SchematicTile; import buildcraft.api.core.IInvSlot; import buildcraft.api.core.JavaTools; import buildcraft.core.lib.inventory.InventoryIterator; -import buildcraft.BuildCraftFactory; import buildcraft.factory.TileAutoWorkbench; public class SchematicAutoWorkbench extends SchematicTile { diff --git a/common/buildcraft/factory/schematics/SchematicPump.java b/common/buildcraft/factory/schematics/SchematicPump.java index 9e65160867..bb81c128a4 100755 --- a/common/buildcraft/factory/schematics/SchematicPump.java +++ b/common/buildcraft/factory/schematics/SchematicPump.java @@ -1,5 +1,5 @@ /** 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.factory.schematics; @@ -9,9 +9,9 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.BlockPos; +import buildcraft.BuildCraftFactory; import buildcraft.api.blueprints.IBuilderContext; import buildcraft.api.blueprints.SchematicTile; -import buildcraft.BuildCraftFactory; public class SchematicPump extends SchematicTile { @@ -30,7 +30,7 @@ public void initializeFromObjectAt(IBuilderContext context, BlockPos pos) { super.initializeFromObjectAt(context, pos); tileNBT.removeTag("tank"); - tileNBT.removeTag("mjStored"); + tileNBT.removeTag("battery"); } @Override diff --git a/common/buildcraft/factory/schematics/SchematicRefinery.java b/common/buildcraft/factory/schematics/SchematicRefinery.java index 96f8dcc4cd..4f635a9122 100644 --- a/common/buildcraft/factory/schematics/SchematicRefinery.java +++ b/common/buildcraft/factory/schematics/SchematicRefinery.java @@ -1,5 +1,5 @@ /** 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.factory.schematics; @@ -10,10 +10,10 @@ import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import buildcraft.BuildCraftFactory; import buildcraft.api.blueprints.IBuilderContext; import buildcraft.api.blueprints.SchematicTile; import buildcraft.api.properties.BuildCraftProperties; -import buildcraft.BuildCraftFactory; public class SchematicRefinery extends SchematicTile { @@ -40,7 +40,7 @@ public void initializeFromObjectAt(IBuilderContext context, BlockPos pos) { tileNBT.removeTag("tank1"); tileNBT.removeTag("tank2"); tileNBT.removeTag("result"); - tileNBT.removeTag("mjStored"); + tileNBT.removeTag("battery"); } @Override @@ -49,7 +49,7 @@ public void placeInWorld(IBuilderContext context, BlockPos pos, LinkedList * 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.factory.schematics; diff --git a/common/buildcraft/robotics/BlockRequester.java b/common/buildcraft/robotics/BlockRequester.java index c404513725..517265de1c 100755 --- a/common/buildcraft/robotics/BlockRequester.java +++ b/common/buildcraft/robotics/BlockRequester.java @@ -1,5 +1,5 @@ /** 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.robotics; @@ -7,6 +7,7 @@ import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; @@ -15,8 +16,9 @@ import buildcraft.BuildCraftRobotics; import buildcraft.core.GuiIds; import buildcraft.core.lib.block.BlockBuildCraft; +import buildcraft.core.lib.block.IComparatorInventory; -public class BlockRequester extends BlockBuildCraft { +public class BlockRequester extends BlockBuildCraft implements IComparatorInventory { public BlockRequester() { super(Material.iron, FACING_PROP); } @@ -39,4 +41,9 @@ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, En return true; } + + @Override + public boolean doesSlotCountComparator(TileEntity tile, int slot, ItemStack stack) { + return ((TileRequester) tile).getRequestTemplate(slot) != null; + } } diff --git a/common/buildcraft/robotics/BlockZonePlan.java b/common/buildcraft/robotics/BlockZonePlan.java index e2031dc7d5..9018c44ccb 100755 --- a/common/buildcraft/robotics/BlockZonePlan.java +++ b/common/buildcraft/robotics/BlockZonePlan.java @@ -1,14 +1,12 @@ /** 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.robotics; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; @@ -17,7 +15,6 @@ import buildcraft.BuildCraftRobotics; import buildcraft.core.GuiIds; import buildcraft.core.lib.block.BlockBuildCraft; -import buildcraft.robotics.map.MapWorld; public class BlockZonePlan extends BlockBuildCraft { public BlockZonePlan() { @@ -42,25 +39,4 @@ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, En return true; } - - @Override - public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase entity, ItemStack stack) { - super.onBlockPlacedBy(world, pos, state, entity, stack); - - if (!world.isRemote) { - int radius = TileZonePlan.RESOLUTION >> 4; - - int chunkX = pos.getX() >> 4; - int chunkZ = pos.getZ() >> 4; - - MapWorld map = BuildCraftRobotics.manager.getWorld(world); - - for (int checkX = -radius; checkX < radius; checkX++) { - for (int checkZ = -radius; checkZ < radius; checkZ++) { - int distance = checkX * checkX + checkZ * checkZ; - map.queueChunkForUpdateIfEmpty(chunkX + checkX, chunkZ + checkZ, distance); - } - } - } - } } diff --git a/common/buildcraft/robotics/BoardProgrammingRecipe.java b/common/buildcraft/robotics/BoardProgrammingRecipe.java index ed4a92fad5..7a317c4716 100644 --- a/common/buildcraft/robotics/BoardProgrammingRecipe.java +++ b/common/buildcraft/robotics/BoardProgrammingRecipe.java @@ -23,7 +23,8 @@ public BoardSorter(BoardProgrammingRecipe recipe) { @Override public int compare(ItemStack o1, ItemStack o2) { - return recipe.getEnergyCost(o1) - recipe.getEnergyCost(o2); + int i = (recipe.getEnergyCost(o1) - recipe.getEnergyCost(o2)) * 200; + return i != 0 ? i : ItemRedstoneBoard.getBoardNBT(o1).getID().compareTo(ItemRedstoneBoard.getBoardNBT(o2).getID()); } } @@ -35,7 +36,7 @@ public String getId() { @Override public List getOptions(int width, int height) { List options = new ArrayList(width * height); - for (RedstoneBoardNBT nbt : RedstoneBoardRegistry.instance.getAllBoardNBTs()) { + for (RedstoneBoardNBT nbt : RedstoneBoardRegistry.instance.getAllBoardNBTs()) { ItemStack stack = new ItemStack(BuildCraftRobotics.redstoneBoard); nbt.createBoard(NBTUtils.getItemData(stack)); options.add(stack); diff --git a/common/buildcraft/robotics/DockingStationPipe.java b/common/buildcraft/robotics/DockingStationPipe.java index 5e003ee4dd..75be3b864f 100644 --- a/common/buildcraft/robotics/DockingStationPipe.java +++ b/common/buildcraft/robotics/DockingStationPipe.java @@ -1,21 +1,30 @@ package buildcraft.robotics; +import java.util.List; + import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.Vec3; + import net.minecraftforge.fluids.IFluidHandler; +import buildcraft.BuildCraftRobotics; import buildcraft.api.core.EnumColor; +import buildcraft.api.core.EnumPipePart; +import buildcraft.api.gates.IGate; import buildcraft.api.robots.DockingStation; import buildcraft.api.robots.EntityRobotBase; import buildcraft.api.robots.IRequestProvider; import buildcraft.api.robots.RobotManager; +import buildcraft.api.statements.IStatement; import buildcraft.api.statements.StatementSlot; import buildcraft.api.transport.IInjectable; import buildcraft.api.transport.IPipeTile; +import buildcraft.core.lib.inventory.InventoryWrapper; import buildcraft.core.lib.utils.Utils; import buildcraft.transport.Pipe; import buildcraft.transport.PipeTransportItems; @@ -24,7 +33,7 @@ import buildcraft.transport.pipes.PipeFluidsWood; import buildcraft.transport.pipes.PipeItemsWood; -public class DockingStationPipe extends DockingStation { +public class DockingStationPipe extends DockingStation implements IRequestProvider { private IInjectable injectablePipe = new IInjectable() { @Override @@ -47,7 +56,7 @@ public int injectItem(ItemStack stack, boolean doAdd, EnumFacing from, EnumColor private IPipeTile pipe; public DockingStationPipe() { - // Loading later from NBT + // Loading later from NBT - DO NOT TOUCH! } public DockingStationPipe(IPipeTile iPipe, EnumFacing side) { @@ -58,7 +67,10 @@ public DockingStationPipe(IPipeTile iPipe, EnumFacing side) { public IPipeTile getPipe() { if (pipe == null) { - pipe = (IPipeTile) world.getTileEntity(getPos()); + TileEntity tile = world.getTileEntity(getPos()); + if (tile instanceof IPipeTile) { + pipe = (IPipeTile) tile; + } } if (pipe == null || ((TileEntity) pipe).isInvalid()) { @@ -85,7 +97,12 @@ public IInjectable getItemOutput() { } @Override - public IInventory getItemInput() { + public EnumPipePart getItemOutputSide() { + return EnumPipePart.fromFacing(side().getOpposite()); + } + + @Override + public ISidedInventory getItemInput() { if (getPipe().getPipeType() != IPipeTile.PipeType.ITEM) { return null; } @@ -99,12 +116,26 @@ public IInventory getItemInput() { TileEntity connectedTile = getPipe().getWorld().getTileEntity(getPos().add(Utils.convertFloor(dir))); if (connectedTile instanceof IInventory) { - return (IInventory) connectedTile; + return InventoryWrapper.getWrappedInventory(connectedTile); } return null; } + @Override + public EnumPipePart getItemInputSide() { + if (getPipe().getPipeType() != IPipeTile.PipeType.ITEM) { + return EnumPipePart.CENTER; + } + + if (!(getPipe().getPipe() instanceof PipeItemsWood)) { + return EnumPipePart.CENTER; + } + + int meta = ((TileEntity) getPipe()).getBlockMetadata(); + return EnumPipePart.fromMeta(meta).opposite(); + } + @Override public IFluidHandler getFluidInput() { if (getPipe().getPipeType() != IPipeTile.PipeType.FLUID) { @@ -126,6 +157,20 @@ public IFluidHandler getFluidInput() { return null; } + @Override + public EnumPipePart getFluidInputSide() { + if (getPipe().getPipeType() != IPipeTile.PipeType.FLUID) { + return EnumPipePart.CENTER; + } + + if (!(getPipe().getPipe() instanceof PipeFluidsWood)) { + return EnumPipePart.CENTER; + } + + int meta = ((TileEntity) getPipe()).getBlockMetadata(); + return EnumPipePart.fromMeta(meta).opposite(); + } + @Override public IFluidHandler getFluidOutput() { if (getPipe().getPipeType() != IPipeTile.PipeType.FLUID) { @@ -135,6 +180,11 @@ public IFluidHandler getFluidOutput() { return (IFluidHandler) ((Pipe) getPipe().getPipe()).transport; } + @Override + public EnumPipePart getFluidOutputSide() { + return EnumPipePart.CENTER; + } + @Override public boolean providesPower() { return getPipe().getPipeType() == IPipeTile.PipeType.POWER; @@ -148,7 +198,7 @@ public IRequestProvider getRequestProvider() { return (IRequestProvider) nearbyTile; } } - return null; + return this; } @Override @@ -180,9 +230,71 @@ public boolean takeAsMain(EntityRobotBase robot) { @Override public void unsafeRelease(EntityRobotBase robot) { super.unsafeRelease(robot); - if (robotTaking() == null) { + if (robotTaking() == null && getPipe() != null) { getPipe().scheduleRenderUpdate(); } } + @Override + public void onChunkUnload() { + pipe = null; + } + + @Override + public int getRequestsCount() { + return 127; + } + + @Override + public ItemStack getRequest(int slot) { + EnumFacing side = EnumFacing.values()[(slot & 0x70) >> 4]; + int action = (slot & 0xc) >> 2; + int param = slot & 0x3; + IGate gate = getPipe().getPipe().getGate(side); + if (gate == null) { + return null; + } + + List actions = gate.getActions(); + if (actions.size() <= action) { + return null; + } + + if (actions.get(action) != BuildCraftRobotics.actionStationRequestItems) { + return null; + } + + List activeActions = gate.getActiveActions(); + + StatementSlot slotStmt = null; + for (StatementSlot stmt : activeActions) { + if (stmt.statement == actions.get(action)) { + slotStmt = stmt; + break; + } + } + if (slotStmt == null) { + return null; + } + if (slotStmt.parameters.length <= param) { + return null; + } + + if (slotStmt.parameters[param] == null) { + return null; + } + + return slotStmt.parameters[param].getItemStack(); + } + + @Override + public ItemStack offerItem(int slot, ItemStack stack) { + int consumed = injectablePipe.injectItem(stack, true, side.getOpposite(), null); + if (stack.stackSize > consumed) { + ItemStack newStack = stack.copy(); + newStack.stackSize -= consumed; + return newStack; + } + return null; + } } diff --git a/common/buildcraft/robotics/EntityRobot.java b/common/buildcraft/robotics/EntityRobot.java index bd1851a10b..92270b2cbf 100644 --- a/common/buildcraft/robotics/EntityRobot.java +++ b/common/buildcraft/robotics/EntityRobot.java @@ -1,5 +1,5 @@ /** 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.robotics; @@ -9,26 +9,35 @@ import java.util.List; import java.util.WeakHashMap; -import net.minecraft.block.Block; +import com.google.common.collect.Iterables; +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.properties.Property; + import net.minecraft.client.Minecraft; +import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityFallingBlock; +import net.minecraft.entity.monster.IMob; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemArmor; +import net.minecraft.item.ItemSkull; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; +import net.minecraft.nbt.NBTUtil; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.*; import net.minecraft.world.World; +import net.minecraft.world.WorldServer; +import net.minecraftforge.common.ForgeHooks; +import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.Constants; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTankInfo; -import net.minecraftforge.fluids.IFluidHandler; +import net.minecraftforge.common.util.Constants.NBT; +import net.minecraftforge.event.entity.player.AttackEntityEvent; +import net.minecraftforge.fluids.*; import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -40,15 +49,13 @@ import buildcraft.api.boards.RedstoneBoardRobotNBT; import buildcraft.api.core.BCLog; import buildcraft.api.core.IZone; -import buildcraft.api.robots.AIRobot; -import buildcraft.api.robots.DockingStation; -import buildcraft.api.robots.EntityRobotBase; -import buildcraft.api.robots.IRobotOverlayItem; -import buildcraft.api.robots.RobotManager; +import buildcraft.api.core.SafeTimeTracker; +import buildcraft.api.events.RobotEvent; +import buildcraft.api.robots.*; import buildcraft.api.statements.StatementSlot; import buildcraft.api.tiles.IDebuggable; -import buildcraft.api.tools.IToolWrench; import buildcraft.core.DefaultProps; +import buildcraft.core.ItemWrench; import buildcraft.core.LaserData; import buildcraft.core.lib.RFBattery; import buildcraft.core.lib.network.command.CommandWriter; @@ -57,6 +64,7 @@ import buildcraft.core.lib.utils.NBTUtils; import buildcraft.core.lib.utils.NetworkUtils; import buildcraft.core.lib.utils.Utils; +import buildcraft.core.proxy.CoreProxy; import buildcraft.robotics.ai.AIRobotMain; import buildcraft.robotics.ai.AIRobotShutdown; import buildcraft.robotics.ai.AIRobotSleep; @@ -81,6 +89,8 @@ public class EntityRobot extends EntityRobotBase implements IEntityAdditionalSpa private static final int DATA_ACTIVE_CLIENT = 21; private static final int DATA_BATTERY_ENERGY = 22; + public static final int MAX_WEARABLES = 8; + public LaserData laser = new LaserData(); public DockingStation linkedDockingStation; public BlockPos linkedDockingStationIndex; @@ -102,6 +112,9 @@ public class EntityRobot extends EntityRobotBase implements IEntityAdditionalSpa public float itemActiveStage = 0; public long lastUpdateTime = 0; + private SafeTimeTracker expensiveVerificationsTracker = new SafeTimeTracker(10); + private boolean isMovingOutOfStuck; + private DockingStation currentDockingStation; private List wearables = new ArrayList(); @@ -111,7 +124,7 @@ public class EntityRobot extends EntityRobotBase implements IEntityAdditionalSpa private int maxFluid = FluidContainerRegistry.BUCKET_VOLUME * 4; private ResourceLocation texture; - private WeakHashMap unreachableEntities = new WeakHashMap(); + private WeakHashMap unreachableEntities = new WeakHashMap(); private NBTTagList stackRequestNBT; @@ -224,7 +237,6 @@ protected void init() { public void setLaserDestination(float x, float y, float z) { if (x != laser.tail.xCoord || y != laser.tail.yCoord || z != laser.tail.zCoord) { laser.tail = new Vec3(x, y, z); - needsUpdate = true; } } @@ -324,8 +336,27 @@ public void onEntityUpdate() { currentDockingStation = getRegistry().getStation(currentDockingStationIndex, currentDockingStationSide); } + if (posY < -128) { + isDead = true; + + BCLog.logger.info("Destroying robot " + this.toString() + " - Fallen into Void"); + getRegistry().killRobot(this); + } + + // The commented out part is the part which unstucks robots. + // It has been known to cause a lot of issues in 7.1.11. + // If you want to try and fix it, go ahead. + // Right now it will simply stop them from moving. + + /* if (expensiveVerificationsTracker.markTimeIfDelay(worldObj)) { int collisions = 0; int bx = (int) + * Math.floor(posX); int by = (int) Math.floor(posY); int bz = (int) Math.floor(posZ); if (by >= 0 && by < + * worldObj.getActualHeight() && !BuildCraftAPI.isSoftBlock(worldObj, bx, by, bz)) { List clist = new + * ArrayList(); Block block = worldObj.getBlock(bx, by, bz); block.addCollisionBoxesToList(worldObj, bx, by, + * bz, getBoundingBox(), clist, this); collisions = clist.size(); } if (collisions > 0) { isMovingOutOfStuck + * = true; motionX = 0.0F; motionY = 0.05F; motionZ = 0.0F; } else if (isMovingOutOfStuck) { + * isMovingOutOfStuck = false; board.abortDelegateAI(); motionY = 0.0F; } } if (!isMovingOutOfStuck) { */ if (linkedDockingStation == null || linkedDockingStation.isInitialized()) { - this.worldObj.theProfiler.startSection("bcRobotAIMainCycle"); + this.worldObj.theProfiler.startSection("bcRobotAI"); mainAI.cycle(); this.worldObj.theProfiler.endSection(); @@ -344,6 +375,11 @@ public void onEntityUpdate() { // @Override // protected void updateEntityActionState() {} + @Override + public boolean handleWaterMovement() { + return false; + } + @SideOnly(Side.CLIENT) private void updateEnergyFX() { energyFX += energySpendPerCycle; @@ -360,7 +396,7 @@ private void spawnEnergyFX() { + steamDirection.yCoord * 0.25, posZ + steamDirection.zCoord * 0.25, steamDirection.xCoord * 0.05, steamDirection.yCoord * 0.05, steamDirection.zCoord * 0.05, energySpendPerCycle * 0.075F < 1 ? 1 : energySpendPerCycle * 0.075F)); } - + @Override public AxisAlignedBB getEntityBoundingBox() { return new AxisAlignedBB(posX - 0.25F, posY - 0.25F, posZ - 0.25F, posX + 0.25F, posY + 0.25F, posZ + 0.25F); @@ -380,14 +416,6 @@ private void shutdown(String reason) { } } - private void iterateBehaviorDocked() { - motionX = 0F; - motionY = 0F; - motionZ = 0F; - - setNullBoundingBox(); - } - @Override public void writeSpawnData(ByteBuf data) { data.writeByte(wearables.size()); @@ -414,12 +442,6 @@ public ItemStack getHeldItem() { @Override public void setCurrentItemOrArmor(int i, ItemStack itemstack) {} - @Override - public void fall(float dist, float damageMultiplier) {} - - @Override - protected void updateFallState(double y, boolean onGround, Block block, BlockPos pos) {} - @Override public void moveEntityWithHeading(float par1, float par2) { this.setPosition(posX + motionX, posY + motionY, posZ + motionZ); @@ -478,9 +500,9 @@ public void writeEntityToNBT(NBTTagCompound nbt) { if (wearables.size() > 0) { NBTTagList wearableList = new NBTTagList(); - for (int i = 0; i < wearables.size(); i++) { + for (ItemStack wearable : wearables) { NBTTagCompound item = new NBTTagCompound(); - wearables.get(i).writeToNBT(item); + wearable.writeToNBT(item); wearableList.appendTag(item); } @@ -533,7 +555,10 @@ public void readEntityFromNBT(NBTTagCompound nbt) { if (nbt.hasKey("wearables")) { NBTTagList list = nbt.getTagList("wearables", 10); for (int i = 0; i < list.tagCount(); i++) { - wearables.add(ItemStack.loadItemStackFromNBT(list.getCompoundTagAt(i))); + ItemStack stack = ItemStack.loadItemStackFromNBT(list.getCompoundTagAt(i)); + if (stack != null) { + wearables.add(stack); + } } } @@ -652,7 +677,9 @@ public ItemStack decrStackSize(int var1, int var2) { @Override public ItemStack removeStackFromSlot(int var1) { - return inv[var1].splitStack(var1); + ItemStack stack = inv[var1]; + inv[var1] = null; + return stack; } @Override @@ -800,8 +827,36 @@ public void setHealth(float par1) { } @Override - public boolean attackEntityFrom(DamageSource par1, float par2) { - // deactivate being hit + public boolean attackEntityFrom(DamageSource source, float f) { + // Ignore hits from mobs or when docked. + Entity src = source.getSourceOfDamage(); + if (src != null && !(src instanceof EntityFallingBlock) && !(src instanceof IMob) && currentDockingStation == null) { + if (ForgeHooks.onLivingAttack(this, source, f)) { + return false; + } + + if (!worldObj.isRemote) { + hurtTime = maxHurtTime = 10; + + int mul = 2600; + for (ItemStack s : wearables) { + if (s.getItem() instanceof ItemArmor) { + mul = mul * 2 / (2 + ((ItemArmor) s.getItem()).damageReduceAmount); + } else { + mul *= 0.7; + } + } + + int energy = Math.round(f * mul); + if (battery.getEnergyStored() - energy > 0) { + battery.setEnergy(battery.getEnergyStored() - energy); + return true; + } else { + onRobotHit(true); + } + } + return true; + } return false; } @@ -928,17 +983,54 @@ public void overrideAI(AIRobot ai) { } public void attackTargetEntityWithCurrentItem(Entity par1Entity) { + BlockPos entPos = Utils.convertFloor(Utils.getVec(par1Entity)); + if (MinecraftForge.EVENT_BUS.post(new AttackEntityEvent(CoreProxy.proxy.getBuildCraftPlayer((WorldServer) worldObj, entPos).get(), + par1Entity))) { + return; + } if (par1Entity.canAttackWithItem()) { if (!par1Entity.hitByEntity(this)) { - this.setLastAttacker(par1Entity); - boolean flag2 = par1Entity.attackEntityFrom(new EntityDamageSource("robot", this), 2.0F); - // FIXME! This was probably meant to do something at some point... - // EnchantmentHelper.func_151385_b(this, par1Entity); - ItemStack itemstack = itemInUse; - Object object = par1Entity; - - if (itemstack != null && object instanceof EntityLivingBase) { - itemstack.getItem().hitEntity(itemstack, (EntityLivingBase) object, this); + float attackDamage = 2.0F; + int knockback = 0; + + if (par1Entity instanceof EntityLivingBase) { + // FIXME: This was probably meant to do something at some point + // attackDamage += EnchantmentHelper.getEnchantmentModifierDamage(this, (EntityLivingBase) + // par1Entity); + knockback += EnchantmentHelper.getKnockbackModifier(this); + } + + if (attackDamage > 0.0F) { + int fireAspect = EnchantmentHelper.getFireAspectModifier(this); + + if (par1Entity instanceof EntityLivingBase && fireAspect > 0 && !par1Entity.isBurning()) { + par1Entity.setFire(fireAspect * 4); + } + + if (par1Entity.attackEntityFrom(new EntityDamageSource("robot", this), attackDamage)) { + this.setLastAttacker(par1Entity); + + if (knockback > 0) { + par1Entity.addVelocity((double) (-MathHelper.sin(this.rotationYaw * (float) Math.PI / 180.0F) * (float) knockback * 0.5F), + 0.1D, (double) (MathHelper.cos(this.rotationYaw * (float) Math.PI / 180.0F) * (float) knockback * 0.5F)); + this.motionX *= 0.6D; + this.motionZ *= 0.6D; + this.setSprinting(false); + } + // FIXME: This was probably meant to do something at some point... + + // if (par1Entity instanceof EntityLivingBase) { + // EnchantmentHelper.((EntityLivingBase) par1Entity, this); + // } + // + // EnchantmentHelper.func_151385_b(this, par1Entity); + + ItemStack itemstack = itemInUse; + + if (itemstack != null && par1Entity instanceof EntityLivingBase) { + itemstack.getItem().hitEntity(itemstack, (EntityLivingBase) par1Entity, this); + } + } } } } @@ -959,12 +1051,14 @@ public IZone getZoneToLoadUnload() { } private IZone getZone(AreaType areaType) { - for (StatementSlot s : linkedDockingStation.getActiveActions()) { - if (s.statement instanceof ActionRobotWorkInArea && ((ActionRobotWorkInArea) s.statement).getAreaType() == areaType) { - IZone zone = ActionRobotWorkInArea.getArea(s); + if (linkedDockingStation != null) { + for (StatementSlot s : linkedDockingStation.getActiveActions()) { + if (s.statement instanceof ActionRobotWorkInArea && ((ActionRobotWorkInArea) s.statement).getAreaType() == areaType) { + IZone zone = ActionRobotWorkInArea.getArea(s); - if (zone != null) { - return zone; + if (zone != null) { + return zone; + } } } } @@ -996,29 +1090,74 @@ public boolean hasFreeSlot() { @Override public void unreachableEntityDetected(Entity entity) { - unreachableEntities.put(entity, true); + unreachableEntities.put(entity, worldObj.getTotalWorldTime() + 1200); } @Override public boolean isKnownUnreachable(Entity entity) { - return unreachableEntities.containsKey(entity); + if (unreachableEntities.containsKey(entity)) { + if (unreachableEntities.get(entity) >= worldObj.getTotalWorldTime()) { + return true; + } else { + unreachableEntities.remove(entity); + return false; + } + } else { + return false; + } + } + + protected void onRobotHit(boolean attacked) { + if (!worldObj.isRemote) { + if (attacked) { + convertToItems(); + } else { + if (wearables.size() > 0) { + entityDropItem(wearables.remove(wearables.size() - 1), 0); + syncWearablesToClient(); + } else { + convertToItems(); + } + } + } } @Override protected boolean interact(EntityPlayer player) { ItemStack stack = player.getCurrentEquippedItem(); if (stack == null || stack.getItem() == null) { - return super.interact(player); + return false; + } + + RobotEvent.Interact robotInteractEvent = new RobotEvent.Interact(this, player, stack); + MinecraftForge.EVENT_BUS.post(robotInteractEvent); + if (robotInteractEvent.isCanceled()) { + return false; } - if (player.isSneaking() && stack.getItem() instanceof IToolWrench) { + if (player.isSneaking() && stack.getItem() == BuildCraftCore.wrenchItem) { + RobotEvent.Dismantle robotDismantleEvent = new RobotEvent.Dismantle(this, player); + MinecraftForge.EVENT_BUS.post(robotDismantleEvent); + if (robotDismantleEvent.isCanceled()) { + return false; + } + + onRobotHit(false); + + if (worldObj.isRemote) { + ((ItemWrench) stack.getItem()).wrenchUsed(player, this); + } + return true; + } else if (wearables.size() < MAX_WEARABLES && stack.getItem().isValidArmor(stack, 0, this)) { if (!worldObj.isRemote) { - convertToItems(); + wearables.add(stack.splitStack(1)); + syncWearablesToClient(); } else { - ((IToolWrench) stack.getItem()).wrenchUsed(player, this); + player.swingItem(); } return true; - } else if (wearables.size() < 8 && stack.getItem() instanceof ItemArmor && ((ItemArmor) stack.getItem()).armorType == 0) { + } else if (wearables.size() < MAX_WEARABLES && stack.getItem() instanceof IRobotOverlayItem && ((IRobotOverlayItem) stack.getItem()) + .isValidRobotOverlay(stack)) { if (!worldObj.isRemote) { wearables.add(stack.splitStack(1)); syncWearablesToClient(); @@ -1026,10 +1165,11 @@ protected boolean interact(EntityPlayer player) { player.swingItem(); } return true; - } else if (wearables.size() < 8 && stack.getItem() instanceof IRobotOverlayItem && ((IRobotOverlayItem) stack.getItem()).isValidRobotOverlay( - stack)) { + } else if (wearables.size() < MAX_WEARABLES && stack.getItem() instanceof ItemSkull) { if (!worldObj.isRemote) { - wearables.add(stack.splitStack(1)); + ItemStack skullStack = stack.splitStack(1); + initSkullItem(skullStack); + wearables.add(skullStack); syncWearablesToClient(); } else { player.swingItem(); @@ -1040,6 +1180,41 @@ protected boolean interact(EntityPlayer player) { } } + private void initSkullItem(ItemStack skullStack) { + if (skullStack.hasTagCompound()) { + NBTTagCompound nbttagcompound = skullStack.getTagCompound(); + GameProfile gameProfile = null; + + if (nbttagcompound.hasKey("SkullOwner", NBT.TAG_COMPOUND)) { + gameProfile = NBTUtil.readGameProfileFromNBT(nbttagcompound.getCompoundTag("SkullOwner")); + } else if (nbttagcompound.hasKey("SkullOwner", NBT.TAG_STRING) && !StringUtils.isNullOrEmpty(nbttagcompound.getString("SkullOwner"))) { + gameProfile = new GameProfile(null, nbttagcompound.getString("SkullOwner")); + } + if (gameProfile != null && !StringUtils.isNullOrEmpty(gameProfile.getName())) { + if (!gameProfile.isComplete() || !gameProfile.getProperties().containsKey("textures")) { + // TODO: FIND OUT HOW SKULLS LOAD GAME PROFILES + // gameProfile = MinecraftServer.getServer().getGameProfileRepository().(gameProfile.getName()); + + if (gameProfile != null) { + Property property = (Property) Iterables.getFirst(gameProfile.getProperties().get("textures"), (Object) null); + + if (property == null) { + // gameProfile = + // MinecraftServer.getServer().func_147130_as().fillProfileProperties(gameProfile, true); + } + } + } + } + if (gameProfile != null && gameProfile.isComplete() && gameProfile.getProperties().containsKey("textures")) { + NBTTagCompound profileNBT = new NBTTagCompound(); + NBTUtil.writeGameProfile(profileNBT, gameProfile); + nbttagcompound.setTag("SkullOwner", profileNBT); + } else { + nbttagcompound.removeTag("SkullOwner"); + } + } + } + private void syncWearablesToClient() { BuildCraftCore.instance.sendToEntity(new PacketCommand(this, "syncWearables", new CommandWriter() { public void write(ByteBuf data) { @@ -1224,17 +1399,6 @@ public FluidTankInfo[] getTankInfo(EnumFacing from) { return new FluidTankInfo[] { new FluidTankInfo(tank, maxFluid) }; } - // @SideOnly(Side.CLIENT) - // public TextureAtlasSprite getItemIcon(ItemStack stack, int renderPass) { - // TextureAtlasSprite iicon = super.getItemIcon(stack, renderPass); - // - // if (iicon == null) { - // iicon = stack.getItem().getIcon(stack, renderPass, null, itemInUse, 0); - // } - // - // return iicon; - // } - @Override public void getDebugInfo(List left, List right, EnumFacing side) { left.add("Robot " + board.getNBTHandler().getID() + " (" + getBattery().getEnergyStored() + "/" + getBattery().getMaxEnergyStored() + " RF)"); diff --git a/common/buildcraft/robotics/EntityRobotEnergyParticle.java b/common/buildcraft/robotics/EntityRobotEnergyParticle.java index 1b0ff963cf..b16512ffa9 100755 --- a/common/buildcraft/robotics/EntityRobotEnergyParticle.java +++ b/common/buildcraft/robotics/EntityRobotEnergyParticle.java @@ -1,13 +1,18 @@ -/** 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 */ +/** + * 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.robotics; import net.minecraft.client.particle.EntityFX; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.entity.Entity; import net.minecraft.world.World; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/common/buildcraft/robotics/IStationFilter.java b/common/buildcraft/robotics/IStationFilter.java index 763f51c568..696a3219ce 100755 --- a/common/buildcraft/robotics/IStationFilter.java +++ b/common/buildcraft/robotics/IStationFilter.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.robotics; import buildcraft.api.robots.DockingStation; diff --git a/common/buildcraft/robotics/ImplRedstoneBoardRegistry.java b/common/buildcraft/robotics/ImplRedstoneBoardRegistry.java index 493dee65df..8b746d5131 100755 --- a/common/buildcraft/robotics/ImplRedstoneBoardRegistry.java +++ b/common/buildcraft/robotics/ImplRedstoneBoardRegistry.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.robotics; import java.util.ArrayList; diff --git a/common/buildcraft/robotics/ItemRedstoneBoard.java b/common/buildcraft/robotics/ItemRedstoneBoard.java index ae745bebf4..996d3b9e31 100755 --- a/common/buildcraft/robotics/ItemRedstoneBoard.java +++ b/common/buildcraft/robotics/ItemRedstoneBoard.java @@ -1,5 +1,5 @@ /** 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.robotics; @@ -16,6 +16,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -43,9 +44,8 @@ public String getItemStackDisplayName(ItemStack stack) { return start + " (" + board.getDisplayName() + ")"; } - @SuppressWarnings("rawtypes") @Override - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advanced) { + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advanced) { RedstoneBoardNBT board = getBoardNBT(stack); board.addInformation(stack, player, list, advanced); } diff --git a/common/buildcraft/robotics/ItemRobot.java b/common/buildcraft/robotics/ItemRobot.java index 4b4d747d03..25d3af8e6e 100755 --- a/common/buildcraft/robotics/ItemRobot.java +++ b/common/buildcraft/robotics/ItemRobot.java @@ -1,5 +1,5 @@ /** 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.robotics; @@ -17,7 +17,8 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; -import net.minecraftforge.fml.common.FMLCommonHandler; + +import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -27,20 +28,34 @@ import buildcraft.api.boards.RedstoneBoardNBT; import buildcraft.api.boards.RedstoneBoardRegistry; import buildcraft.api.boards.RedstoneBoardRobotNBT; -import buildcraft.api.events.RobotPlacementEvent; +import buildcraft.api.events.RobotEvent; import buildcraft.api.robots.DockingStation; import buildcraft.api.robots.EntityRobotBase; import buildcraft.api.transport.pluggable.PipePluggable; import buildcraft.core.BCCreativeTab; import buildcraft.core.lib.items.ItemBuildCraft; import buildcraft.core.lib.utils.NBTUtils; -import buildcraft.transport.Pipe; +import buildcraft.core.lib.utils.StringUtils; import buildcraft.transport.BlockGenericPipe; +import buildcraft.transport.Pipe; public class ItemRobot extends ItemBuildCraft implements IEnergyContainerItem { public ItemRobot() { super(BCCreativeTab.get("boards")); + setMaxStackSize(1); + } + + @Override + public int getItemStackLimit(ItemStack stack) { + NBTTagCompound cpt = getNBT(stack); + RedstoneBoardRobotNBT boardNBT = getRobotNBT(cpt); + + if (boardNBT != RedstoneBoardRegistry.instance.getEmptyRobotBoard()) { + return 1; + } else { + return 16; + } } public EntityRobot createRobot(ItemStack stack, World world) { @@ -83,11 +98,11 @@ public void addInformation(ItemStack stack, EntityPlayer player, List list, bool int energy = getEnergy(cpt); int pct = energy * 100 / EntityRobotBase.MAX_ENERGY; - String enInfo = pct + "% Charged"; + String enInfo = pct + "% " + StringUtils.localize("tip.gate.charged"); if (energy == EntityRobotBase.MAX_ENERGY) { - enInfo = "Full Charge"; + enInfo = StringUtils.localize("tip.gate.fullcharge"); } else if (energy == 0) { - enInfo = "No Charge"; + enInfo = StringUtils.localize("tip.gate.nocharge"); } enInfo = (pct >= 80 ? EnumChatFormatting.GREEN : (pct >= 50 ? EnumChatFormatting.YELLOW : (pct >= 30 ? EnumChatFormatting.GOLD : (pct >= 20 ? EnumChatFormatting.RED : EnumChatFormatting.DARK_RED)))) + enInfo; @@ -188,12 +203,14 @@ public boolean onItemUse(ItemStack currentItem, EntityPlayer player, World world if (robotNBT == RedstoneBoardRegistry.instance.getEmptyRobotBoard()) { return true; } - RobotPlacementEvent robotEvent = new RobotPlacementEvent(player, robotNBT.getID()); - FMLCommonHandler.instance().bus().post(robotEvent); + + EntityRobot robot = ((ItemRobot) currentItem.getItem()).createRobot(currentItem, world); + + RobotEvent.Place robotEvent = new RobotEvent.Place(robot, player); + MinecraftForge.EVENT_BUS.post(robotEvent); if (robotEvent.isCanceled()) { return true; } - EntityRobot robot = ((ItemRobot) currentItem.getItem()).createRobot(currentItem, world); if (robot != null && robot.getRegistry() != null) { robot.setUniqueRobotId(robot.getRegistry().getNextRobotId()); diff --git a/common/buildcraft/robotics/ItemRobotStation.java b/common/buildcraft/robotics/ItemRobotStation.java index 82571dfa46..06f7ebb323 100755 --- a/common/buildcraft/robotics/ItemRobotStation.java +++ b/common/buildcraft/robotics/ItemRobotStation.java @@ -1,5 +1,5 @@ /** 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.robotics; @@ -15,7 +15,6 @@ import buildcraft.api.transport.pluggable.PipePluggable; import buildcraft.core.BCCreativeTab; import buildcraft.core.lib.items.ItemBuildCraft; -import buildcraft.robotics.RobotStationPluggable; public class ItemRobotStation extends ItemBuildCraft implements IPipePluggableItem { public ItemRobotStation() { diff --git a/common/buildcraft/robotics/RobotIntegrationRecipe.java b/common/buildcraft/robotics/RobotIntegrationRecipe.java index 9ff675e433..08658866c0 100755 --- a/common/buildcraft/robotics/RobotIntegrationRecipe.java +++ b/common/buildcraft/robotics/RobotIntegrationRecipe.java @@ -1,5 +1,5 @@ /** 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.robotics; @@ -33,7 +33,7 @@ public List generateExampleInput() { public List> generateExampleExpansions() { ArrayList> list = new ArrayList>(); ArrayList example = new ArrayList(); - for (RedstoneBoardNBT nbt : RedstoneBoardRegistry.instance.getAllBoardNBTs()) { + for (RedstoneBoardNBT nbt : RedstoneBoardRegistry.instance.getAllBoardNBTs()) { ItemStack stack = new ItemStack(BuildCraftRobotics.redstoneBoard); nbt.createBoard(NBTUtils.getItemData(stack)); example.add(stack); @@ -45,7 +45,7 @@ public List> generateExampleExpansions() { @Override public List generateExampleOutput() { ArrayList example = new ArrayList(); - for (RedstoneBoardNBT nbt : RedstoneBoardRegistry.instance.getAllBoardNBTs()) { + for (RedstoneBoardNBT nbt : RedstoneBoardRegistry.instance.getAllBoardNBTs()) { example.add(ItemRobot.createRobotStack((RedstoneBoardRobotNBT) nbt, 0)); } return example; diff --git a/common/buildcraft/robotics/RobotRegistry.java b/common/buildcraft/robotics/RobotRegistry.java index 082e731157..53d7cbf174 100755 --- a/common/buildcraft/robotics/RobotRegistry.java +++ b/common/buildcraft/robotics/RobotRegistry.java @@ -1,45 +1,39 @@ /** 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.robotics; import java.security.InvalidParameterException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; +import java.util.*; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.LongHashMap; import net.minecraft.world.World; import net.minecraft.world.WorldSavedData; + import net.minecraftforge.common.util.Constants; import net.minecraftforge.event.world.ChunkEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import buildcraft.api.core.BCLog; -import buildcraft.api.robots.DockingStation; -import buildcraft.api.robots.EntityRobotBase; -import buildcraft.api.robots.IRobotRegistry; -import buildcraft.api.robots.ResourceId; -import buildcraft.api.robots.RobotManager; +import buildcraft.api.robots.*; public class RobotRegistry extends WorldSavedData implements IRobotRegistry { protected World world; - protected HashMap stations = new HashMap(); + protected final HashMap stations = new HashMap(); private long nextRobotID = Long.MIN_VALUE; - private HashMap robotsLoaded = new HashMap(); - private HashMap resourcesTaken = new HashMap(); - private HashMap> resourcesTakenByRobot = new HashMap>(); - - private HashMap> stationsTakenByRobot = new HashMap>(); + private final LongHashMap robotsLoaded = new LongHashMap(); + private final HashSet robotsLoadedSet = new HashSet(); + private final HashMap resourcesTaken = new HashMap(); + private final LongHashMap resourcesTakenByRobot = new LongHashMap(); + private final LongHashMap stationsTakenByRobot = new LongHashMap(); public RobotRegistry(String id) { super(id); @@ -61,11 +55,29 @@ public void registerRobot(EntityRobotBase robot) { if (robot.getRobotId() == EntityRobotBase.NULL_ROBOT_ID) { ((EntityRobot) robot).setUniqueRobotId(getNextRobotId()); } - if (robotsLoaded.containsKey(robot.getRobotId())) { + if (robotsLoaded.containsItem(robot.getRobotId())) { BCLog.logger.warn("Robot with id %d was not unregistered properly", robot.getRobotId()); } - robotsLoaded.put(robot.getRobotId(), (EntityRobot) robot); + addRobotLoaded((EntityRobot) robot); + } + + private HashSet getResourcesTakenByRobot(long robotId) { + return (HashSet) resourcesTakenByRobot.getValueByKey(robotId); + } + + private HashSet getStationsTakenByRobot(long robotId) { + return (HashSet) stationsTakenByRobot.getValueByKey(robotId); + } + + private void addRobotLoaded(EntityRobot robot) { + robotsLoaded.add(robot.getRobotId(), robot); + robotsLoadedSet.add(robot); + } + + private void removeRobotLoaded(EntityRobot robot) { + robotsLoaded.remove(robot.getRobotId()); + robotsLoadedSet.remove(robot); } @Override @@ -73,7 +85,7 @@ public void killRobot(EntityRobotBase robot) { markDirty(); releaseResources(robot, true); - robotsLoaded.remove(robot.getRobotId()); + removeRobotLoaded((EntityRobot) robot); } @Override @@ -81,13 +93,13 @@ public void unloadRobot(EntityRobotBase robot) { markDirty(); releaseResources(robot, false, true); - robotsLoaded.remove(robot.getRobotId()); + removeRobotLoaded((EntityRobot) robot); } @Override public EntityRobot getLoadedRobot(long id) { - if (robotsLoaded.containsKey(id)) { - return robotsLoaded.get(id); + if (robotsLoaded.containsItem(id)) { + return (EntityRobot) robotsLoaded.getValueByKey(id); } else { return null; } @@ -106,7 +118,7 @@ public synchronized long robotIdTaking(ResourceId resourceId) { long robotId = resourcesTaken.get(resourceId); - if (robotsLoaded.containsKey(robotId) && !robotsLoaded.get(robotId).isDead) { + if (robotsLoaded.containsItem(robotId) && !((EntityRobot) robotsLoaded.getValueByKey(robotId)).isDead) { return robotId; } else { // If the robot is either not loaded or dead, the resource is not @@ -120,10 +132,10 @@ public synchronized long robotIdTaking(ResourceId resourceId) { public synchronized EntityRobot robotTaking(ResourceId resourceId) { long robotId = robotIdTaking(resourceId); - if (robotId == EntityRobotBase.NULL_ROBOT_ID || !robotsLoaded.containsKey(robotId)) { + if (robotId == EntityRobotBase.NULL_ROBOT_ID || !robotsLoaded.containsItem(robotId)) { return null; } else { - return robotsLoaded.get(robotId); + return (EntityRobot) robotsLoaded.getValueByKey(robotId); } } @@ -145,13 +157,11 @@ public synchronized boolean take(ResourceId resourceId, long robotId) { if (!resourcesTaken.containsKey(resourceId)) { resourcesTaken.put(resourceId, robotId); - if (!resourcesTakenByRobot.containsKey(robotId)) { - resourcesTakenByRobot.put(robotId, new HashSet()); + if (!resourcesTakenByRobot.containsItem(robotId)) { + resourcesTakenByRobot.add(robotId, new HashSet()); } - resourcesTakenByRobot.get(robotId).add(resourceId); - - resourceId.taken(robotId); + getResourcesTakenByRobot(robotId).add(resourceId); return true; } else { @@ -170,9 +180,8 @@ public synchronized void release(ResourceId resourceId) { if (resourcesTaken.containsKey(resourceId)) { long robotId = resourcesTaken.get(resourceId); - resourcesTakenByRobot.get(resourcesTaken.get(resourceId)).remove(resourceId); + getResourcesTakenByRobot(robotId).remove(resourceId); resourcesTaken.remove(resourceId); - resourceId.released(robotId); } } @@ -188,8 +197,8 @@ private synchronized void releaseResources(EntityRobotBase robot, boolean forceA private synchronized void releaseResources(EntityRobotBase robot, boolean forceAll, boolean resetEntities) { markDirty(); - if (resourcesTakenByRobot.containsKey(robot.getRobotId())) { - HashSet resourceSet = (HashSet) resourcesTakenByRobot.get(robot.getRobotId()).clone(); + if (resourcesTakenByRobot.containsItem(robot.getRobotId())) { + HashSet resourceSet = (HashSet) getResourcesTakenByRobot(robot.getRobotId()).clone(); for (ResourceId id : resourceSet) { release(id); @@ -198,8 +207,8 @@ private synchronized void releaseResources(EntityRobotBase robot, boolean forceA resourcesTakenByRobot.remove(robot.getRobotId()); } - if (stationsTakenByRobot.containsKey(robot.getRobotId())) { - HashSet stationSet = (HashSet) stationsTakenByRobot.get(robot.getRobotId()).clone(); + if (stationsTakenByRobot.containsItem(robot.getRobotId())) { + HashSet stationSet = (HashSet) getStationsTakenByRobot(robot.getRobotId()).clone(); for (StationIndex s : stationSet) { DockingStation d = stations.get(s); @@ -266,8 +275,8 @@ public synchronized void removeStation(DockingStation station) { station.robotTaking().setMainStation(null); } } else if (station.robotIdTaking() != EntityRobotBase.NULL_ROBOT_ID) { - if (stationsTakenByRobot.get(station.robotIdTaking()) != null) { - stationsTakenByRobot.get(station.robotIdTaking()).remove(index); + if (stationsTakenByRobot.containsItem(station.robotIdTaking())) { + getStationsTakenByRobot(station.robotIdTaking()).remove(index); } } @@ -277,17 +286,17 @@ public synchronized void removeStation(DockingStation station) { @Override public synchronized void take(DockingStation station, long robotId) { - if (!stationsTakenByRobot.containsKey(robotId)) { - stationsTakenByRobot.put(robotId, new HashSet()); + if (!stationsTakenByRobot.containsItem(robotId)) { + stationsTakenByRobot.add(robotId, new HashSet()); } - stationsTakenByRobot.get(robotId).add(new StationIndex(station)); + getStationsTakenByRobot(robotId).add(new StationIndex(station)); } @Override public synchronized void release(DockingStation station, long robotId) { - if (stationsTakenByRobot.containsKey(robotId)) { - stationsTakenByRobot.get(robotId).remove(new StationIndex(station)); + if (stationsTakenByRobot.containsItem(robotId)) { + getStationsTakenByRobot(robotId).remove(new StationIndex(station)); } } @@ -340,7 +349,7 @@ public synchronized void readFromNBT(NBTTagCompound nbt) { for (int i = 0; i < stationList.tagCount(); ++i) { NBTTagCompound cpt = stationList.getCompoundTagAt(i); - Class cls = null; + Class cls; if (!cpt.hasKey("stationType")) { cls = DockingStationPipe.class; @@ -370,11 +379,16 @@ public synchronized void readFromNBT(NBTTagCompound nbt) { @SubscribeEvent public void onChunkUnload(ChunkEvent.Unload e) { if (e.world == this.world) { - for (EntityRobot robot : new ArrayList(robotsLoaded.values())) { + for (EntityRobot robot : new ArrayList(robotsLoadedSet)) { if (!e.world.loadedEntityList.contains(robot)) { robot.onChunkUnload(); } } + for (DockingStation station : new ArrayList(stations.values())) { + if (world.isAirBlock(station.getPos())) { + station.onChunkUnload(); + } + } } } diff --git a/common/buildcraft/robotics/RobotRegistryProvider.java b/common/buildcraft/robotics/RobotRegistryProvider.java index 3d012ce0bb..24bf7cbd89 100644 --- a/common/buildcraft/robotics/RobotRegistryProvider.java +++ b/common/buildcraft/robotics/RobotRegistryProvider.java @@ -3,6 +3,7 @@ import java.util.HashMap; import net.minecraft.world.World; + import net.minecraftforge.common.MinecraftForge; import buildcraft.api.robots.DockingStation; diff --git a/common/buildcraft/robotics/RobotStationPluggable.java b/common/buildcraft/robotics/RobotStationPluggable.java index 1a85682b89..48a59cff58 100644 --- a/common/buildcraft/robotics/RobotStationPluggable.java +++ b/common/buildcraft/robotics/RobotStationPluggable.java @@ -2,11 +2,9 @@ import java.util.List; -import com.google.common.collect.Lists; - -import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.EnumFacing; @@ -20,109 +18,13 @@ import buildcraft.api.transport.IPipe; import buildcraft.api.transport.IPipeTile; import buildcraft.api.transport.pluggable.IPipePluggableItem; -import buildcraft.api.transport.pluggable.IPipePluggableState; import buildcraft.api.transport.pluggable.IPipePluggableStaticRenderer; -import buildcraft.api.transport.pluggable.IPipeRenderState; import buildcraft.api.transport.pluggable.PipePluggable; import buildcraft.core.lib.utils.MatrixTranformations; -import buildcraft.transport.TileGenericPipe; import io.netty.buffer.ByteBuf; public class RobotStationPluggable extends PipePluggable implements IPipePluggableItem, IEnergyReceiver, IDebuggable, IDockingStationProvider { - public class RobotStationPluggableRenderer implements IPipePluggableStaticRenderer { - private float zFightOffset = 1 / 4096.0F; - - @Override - public List renderStaticPluggable(IPipeRenderState render, IPipePluggableState pluggableState, IPipe pipe, PipePluggable pluggable, - EnumFacing face) { - List quads = Lists.newArrayList(); - EnumRobotStationState state = ((RobotStationPluggable) pluggable).renderState; - // FIXME (RobotStationPluggable) - // TextureAtlasSprite sprite = BuildCraftTrans; - - switch (state) { - case None: - case Available: { - // sprite = - // BuildCraftTransport.instance.pipeIconProvider.getIcon(PipeIconProvider.TYPE.PipeRobotStation.ordinal()); - break; - } - case Linked: { - // sprite = - break; - } - case Reserved: { - break; - } - } - - return quads; - } - - // @Override - // public void renderPluggable(RenderBlocks renderblocks, IPipe pipe, EnumFacing side, PipePluggable - // pipePluggable, - // ITextureStates blockStateMachine, int renderPass, BlockPos pos) { - // if (renderPass != 0) { - // return; - // } - // - // EnumRobotStationState state = ((RobotStationPluggable) pipePluggable).renderState; - // - // switch (state) { - // case None: - // case Available: - // blockStateMachine.getTextureState().setToStack(BuildCraftTransport.instance.pipeIconProvider.getIcon( - // PipeIconProvider.TYPE.PipeRobotStation.ordinal())); - // break; - // case Reserved: - // blockStateMachine.getTextureState().setToStack(BuildCraftTransport.instance.pipeIconProvider.getIcon( - // PipeIconProvider.TYPE.PipeRobotStationReserved.ordinal())); - // break; - // case Linked: - // blockStateMachine.getTextureState().setToStack(BuildCraftTransport.instance.pipeIconProvider.getIcon( - // PipeIconProvider.TYPE.PipeRobotStationLinked.ordinal())); - // break; - // } - // - // float[][] zeroState = new float[3][2]; - // // X START - END - // zeroState[0][0] = 0.4325F; - // zeroState[0][1] = 0.5675F; - // // Y START - END - // zeroState[1][0] = 0F; - // zeroState[1][1] = 0.1875F + zFightOffset; - // // Z START - END - // zeroState[2][0] = 0.4325F; - // zeroState[2][1] = 0.5675F; - // - // float[][] rotated = MatrixTranformations.deepClone(zeroState); - // MatrixTranformations.transform(rotated, side); - // - // renderblocks.setRenderBounds(rotated[0][0], rotated[1][0], rotated[2][0], rotated[0][1], rotated[1][1], - // rotated[2][1]); - // renderblocks.renderStandardBlock(blockStateMachine.getBlock(), pos); - // - // // X START - END - // zeroState[0][0] = 0.25F; - // zeroState[0][1] = 0.75F; - // // Y START - END - // zeroState[1][0] = 0.1875F; - // zeroState[1][1] = 0.25F + zFightOffset; - // // Z START - END - // zeroState[2][0] = 0.25F; - // zeroState[2][1] = 0.75F; - // - // rotated = MatrixTranformations.deepClone(zeroState); - // MatrixTranformations.transform(rotated, side); - // - // renderblocks.setRenderBounds(rotated[0][0], rotated[1][0], rotated[2][0], rotated[0][1], rotated[1][1], - // rotated[2][1]); - // renderblocks.renderStandardBlock(blockStateMachine.getBlock(), pos); - // } - } - public enum EnumRobotStationState { None, Available, @@ -173,13 +75,13 @@ public void invalidate() { @Override public void validate(IPipeTile pipe, EnumFacing direction) { - TileGenericPipe gPipe = (TileGenericPipe) pipe; - if (!isValid && !gPipe.getWorld().isRemote) { - station = (DockingStationPipe) RobotManager.registryProvider.getRegistry(gPipe.getWorld()).getStation(gPipe.getPos(), direction); + if (!isValid && !pipe.getWorld().isRemote) { + station = (DockingStationPipe) RobotManager.registryProvider.getRegistry(pipe.getWorld()).getStation(((TileEntity) pipe).getPos(), + direction); if (station == null) { - station = new DockingStationPipe(gPipe, direction); - RobotManager.registryProvider.getRegistry(gPipe.getWorld()).registerStation(station); + station = new DockingStationPipe(pipe, direction); + RobotManager.registryProvider.getRegistry(pipe.getWorld()).registerStation(station); } isValid = true; @@ -209,12 +111,15 @@ private void refreshRenderState() { } public EnumRobotStationState getRenderState() { + if (renderState == null) { + renderState = EnumRobotStationState.None; + } return renderState; } @Override public IPipePluggableStaticRenderer getRenderer() { - return new RobotStationPluggableRenderer(); + return null;// TODO! This! } @Override @@ -225,12 +130,16 @@ public void writeData(ByteBuf data) { @Override public boolean requiresRenderUpdate(PipePluggable o) { - return renderState != ((RobotStationPluggable) o).renderState; + return getRenderState() != ((RobotStationPluggable) o).getRenderState(); } @Override public void readData(ByteBuf data) { - this.renderState = EnumRobotStationState.values()[data.readUnsignedByte()]; + try { + this.renderState = EnumRobotStationState.values()[data.readUnsignedByte()]; + } catch (ArrayIndexOutOfBoundsException e) { + this.renderState = EnumRobotStationState.None; + } } @Override diff --git a/common/buildcraft/robotics/RobotUtils.java b/common/buildcraft/robotics/RobotUtils.java index 1f828fe5f1..2b7739c5bd 100644 --- a/common/buildcraft/robotics/RobotUtils.java +++ b/common/buildcraft/robotics/RobotUtils.java @@ -1,10 +1,18 @@ package buildcraft.robotics; import java.util.ArrayList; +import java.util.Collection; import java.util.List; +import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; + +import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; +import buildcraft.api.boards.RedstoneBoardNBT; +import buildcraft.api.boards.RedstoneBoardRegistry; +import buildcraft.api.boards.RedstoneBoardRobotNBT; import buildcraft.api.robots.DockingStation; import buildcraft.api.robots.IDockingStationProvider; import buildcraft.api.transport.IPipeTile; @@ -33,4 +41,28 @@ public static List getStations(Object tile) { return stations; } + + public static RedstoneBoardRobotNBT getNextBoard(ItemStack stack, boolean reverse) { + Collection> boards = RedstoneBoardRegistry.instance.getAllBoardNBTs(); + if (stack == null || !(stack.getItem() instanceof ItemRobot)) { + if (!reverse) { + return (RedstoneBoardRobotNBT) Iterables.getFirst(boards, null); + } else { + return (RedstoneBoardRobotNBT) Iterables.getLast(boards, null); + } + } else { + if (reverse) { + boards = Lists.reverse((List>) boards); + } + boolean found = false; + for (RedstoneBoardNBT boardNBT : boards) { + if (found) { + return (RedstoneBoardRobotNBT) boardNBT; + } else if (ItemRobot.getRobotNBT(stack) == boardNBT) { + found = true; + } + } + return null; + } + } } diff --git a/common/buildcraft/robotics/RoboticsGuiHandler.java b/common/buildcraft/robotics/RoboticsGuiHandler.java index d7b57b739b..0b10e02008 100644 --- a/common/buildcraft/robotics/RoboticsGuiHandler.java +++ b/common/buildcraft/robotics/RoboticsGuiHandler.java @@ -1,5 +1,5 @@ /** 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.robotics; @@ -8,6 +8,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockPos; import net.minecraft.world.World; + import net.minecraftforge.fml.common.network.IGuiHandler; import buildcraft.core.GuiIds; diff --git a/common/buildcraft/robotics/RoboticsProxy.java b/common/buildcraft/robotics/RoboticsProxy.java index 3286414d1c..536ea10b72 100644 --- a/common/buildcraft/robotics/RoboticsProxy.java +++ b/common/buildcraft/robotics/RoboticsProxy.java @@ -1,5 +1,5 @@ /** 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.robotics; diff --git a/common/buildcraft/robotics/RoboticsProxyClient.java b/common/buildcraft/robotics/RoboticsProxyClient.java index 3d75988725..7eb038cb52 100644 --- a/common/buildcraft/robotics/RoboticsProxyClient.java +++ b/common/buildcraft/robotics/RoboticsProxyClient.java @@ -1,22 +1,27 @@ /** 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.robotics; import net.minecraft.client.Minecraft; + +import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.client.registry.RenderingRegistry; import net.minecraftforge.fml.common.Loader; import buildcraft.BuildCraftRobotics; import buildcraft.robotics.render.RedstoneBoardMeshDefinition; import buildcraft.robotics.render.RenderRobot; +import buildcraft.robotics.render.RenderZonePlan; public class RoboticsProxyClient extends RoboticsProxy { public void registerRenderers() { RenderingRegistry.registerEntityRenderingHandler(EntityRobot.class, new RenderRobot()); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(BuildCraftRobotics.redstoneBoard, new RedstoneBoardMeshDefinition()); // MinecraftForgeClient.registerItemRenderer(BuildCraftRobotics.robotItem, new RenderRobot()); + ClientRegistry.bindTileEntitySpecialRenderer(TileZonePlan.class, new RenderZonePlan()); + // TODO: Move robot station textures locally if (Loader.isModLoaded("BuildCraft|Transport")) { loadBCTransport(); diff --git a/common/buildcraft/robotics/StackRequest.java b/common/buildcraft/robotics/StackRequest.java new file mode 100755 index 0000000000..00c7e2ba1b --- /dev/null +++ b/common/buildcraft/robotics/StackRequest.java @@ -0,0 +1,106 @@ +/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com + *

+ * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which + * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +package buildcraft.robotics; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +import buildcraft.api.robots.*; +import buildcraft.core.lib.utils.NBTUtils; + +public class StackRequest { + private IRequestProvider requester; + + private int slot; + + private ItemStack stack; + + private DockingStation station; + private BlockPos stationIndex; + private EnumFacing stationSide; + + public StackRequest(IRequestProvider requester, int slot, ItemStack stack) { + this.requester = requester; + this.slot = slot; + this.stack = stack; + this.station = null; + } + + private StackRequest(int slot, ItemStack stack, BlockPos stationIndex, EnumFacing stationSide) { + requester = null; + this.slot = slot; + this.stack = stack; + station = null; + this.stationIndex = stationIndex; + this.stationSide = stationSide; + } + + public IRequestProvider getRequester(World world) { + if (requester == null) { + DockingStation dockingStation = getStation(world); + if (dockingStation != null) { + requester = dockingStation.getRequestProvider(); + } + } + return requester; + } + + public int getSlot() { + return slot; + } + + public ItemStack getStack() { + return stack; + } + + public DockingStation getStation(World world) { + if (station == null) { + IRobotRegistry robotRegistry = RobotManager.registryProvider.getRegistry(world); + station = robotRegistry.getStation(stationIndex, stationSide); + } + return station; + } + + public void setStation(DockingStation station) { + this.station = station; + this.stationIndex = station.index(); + this.stationSide = station.side(); + } + + public void writeToNBT(NBTTagCompound nbt) { + nbt.setInteger("slot", slot); + + NBTTagCompound stackNBT = new NBTTagCompound(); + stack.writeToNBT(stackNBT); + nbt.setTag("stack", stackNBT); + + if (station != null) { + nbt.setTag("stationIndex", NBTUtils.writeBlockPos(stationIndex)); + nbt.setByte("stationSide", (byte) station.side().ordinal()); + } + } + + public static StackRequest loadFromNBT(NBTTagCompound nbt) { + if (nbt.hasKey("stationIndex")) { + int slot = nbt.getInteger("slot"); + + ItemStack stack = ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("stack")); + + BlockPos stationIndex = NBTUtils.readBlockPos(nbt.getTag("stationIndex")); + EnumFacing stationSide = EnumFacing.values()[nbt.getByte("stationSide")]; + + return new StackRequest(slot, stack, stationIndex, stationSide); + } else { + return null; + } + } + + public ResourceId getResourceId(World world) { + return getStation(world) != null ? new ResourceIdRequest(getStation(world), slot) : null; + } +} diff --git a/common/buildcraft/robotics/StationIndex.java b/common/buildcraft/robotics/StationIndex.java index 604f1fb239..e981cce01b 100755 --- a/common/buildcraft/robotics/StationIndex.java +++ b/common/buildcraft/robotics/StationIndex.java @@ -1,5 +1,5 @@ /** 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.robotics; @@ -30,7 +30,7 @@ public StationIndex(DockingStation station) { @Override public boolean equals(Object obj) { - if (obj.getClass() != getClass()) { + if (obj == null || obj.getClass() != getClass()) { return false; } diff --git a/common/buildcraft/robotics/TileRequester.java b/common/buildcraft/robotics/TileRequester.java index e30271983e..0e263b28ae 100755 --- a/common/buildcraft/robotics/TileRequester.java +++ b/common/buildcraft/robotics/TileRequester.java @@ -1,5 +1,5 @@ /** 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.robotics; @@ -13,11 +13,7 @@ import net.minecraftforge.fml.relauncher.Side; import buildcraft.BuildCraftCore; -import buildcraft.api.robots.EntityRobotBase; import buildcraft.api.robots.IRequestProvider; -import buildcraft.api.robots.ResourceIdRequest; -import buildcraft.api.robots.RobotManager; -import buildcraft.api.robots.StackRequest; import buildcraft.core.lib.block.TileBuildCraft; import buildcraft.core.lib.inventory.SimpleInventory; import buildcraft.core.lib.inventory.StackHelper; @@ -58,7 +54,7 @@ public void receiveCommand(String command, Side side, Object sender, ByteBuf str } } - public ItemStack getRequest(int index) { + public ItemStack getRequestTemplate(int index) { return requests.getStackInSlot(index); } @@ -161,47 +157,48 @@ public boolean isFulfilled(int i) { } @Override - public int getNumberOfRequests() { + public int getRequestsCount() { return NB_ITEMS; } @Override - public StackRequest getAvailableRequest(int i) { + public ItemStack getRequest(int i) { if (requests.getStackInSlot(i) == null) { return null; } else if (isFulfilled(i)) { return null; - } else if (RobotManager.registryProvider.getRegistry(worldObj).isTaken(new ResourceIdRequest(this, i))) { - return null; } else { - StackRequest r = new StackRequest(); + ItemStack request = requests.getStackInSlot(i).copy(); - r.index = i; - r.stack = requests.getStackInSlot(i); - r.requester = this; + ItemStack existingStack = inv.getStackInSlot(i); + if (existingStack == null) { + return request; + } - return r; - } - } + if (!StackHelper.isMatchingItemOrList(request, existingStack)) { + return null; + } - @Override - public boolean takeRequest(int i, EntityRobotBase robot) { - if (requests.getStackInSlot(i) == null) { - return false; - } else if (isFulfilled(i)) { - return false; - } else { - return RobotManager.registryProvider.getRegistry(worldObj).take(new ResourceIdRequest(this, i), robot); + request.stackSize -= existingStack.stackSize; + if (request.stackSize <= 0) { + return null; + } + + return request; } } @Override - public ItemStack provideItemsForRequest(int i, ItemStack stack) { + public ItemStack offerItem(int i, ItemStack stack) { ItemStack existingStack = inv.getStackInSlot(i); if (requests.getStackInSlot(i) == null) { return stack; } else if (existingStack == null) { + if (!StackHelper.isMatchingItemOrList(stack, requests.getStackInSlot(i))) { + return stack; + } + int maxQty = requests.getStackInSlot(i).stackSize; if (stack.stackSize <= maxQty) { @@ -219,7 +216,7 @@ public ItemStack provideItemsForRequest(int i, ItemStack stack) { } } else if (!StackHelper.isMatchingItemOrList(stack, existingStack)) { return stack; - } else if (existingStack == null || StackHelper.isMatchingItemOrList(stack, requests.getStackInSlot(i))) { + } else if (StackHelper.isMatchingItemOrList(stack, requests.getStackInSlot(i))) { int maxQty = requests.getStackInSlot(i).stackSize; if (existingStack.stackSize + stack.stackSize <= maxQty) { diff --git a/common/buildcraft/robotics/TileZonePlan.java b/common/buildcraft/robotics/TileZonePlan.java index 6b929b67e6..5ce2f1206f 100644 --- a/common/buildcraft/robotics/TileZonePlan.java +++ b/common/buildcraft/robotics/TileZonePlan.java @@ -1,9 +1,11 @@ /** 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.robotics; +import java.util.Arrays; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.inventory.IInventory; @@ -13,11 +15,12 @@ import net.minecraft.util.IChatComponent; import buildcraft.BuildCraftCore; +import buildcraft.BuildCraftRobotics; import buildcraft.api.core.IZone; +import buildcraft.api.core.SafeTimeTracker; import buildcraft.api.items.IMapLocation; import buildcraft.api.items.INamedItem; import buildcraft.core.ItemMapLocation; -import buildcraft.core.ZonePlan; import buildcraft.core.lib.block.TileBuildCraft; import buildcraft.core.lib.inventory.SimpleInventory; import buildcraft.core.lib.network.base.Packet; @@ -25,6 +28,7 @@ import buildcraft.core.lib.network.command.PacketCommand; import buildcraft.core.lib.utils.NetworkUtils; import buildcraft.robotics.gui.ContainerZonePlan; +import buildcraft.robotics.map.MapWorld; import io.netty.buffer.ByteBuf; @@ -32,18 +36,28 @@ public class TileZonePlan extends TileBuildCraft implements IInventory { public static final int RESOLUTION = 2048; public static final int CRAFT_TIME = 120; + private static final int PREVIEW_BLOCKS_PER_PIXEL = 10; private static int RESOLUTION_CHUNKS = RESOLUTION >> 4; public int chunkStartX, chunkStartZ; - public short progress = 0; - public String mapName = ""; + private final byte[] previewColors = new byte[80]; + private final SimpleInventory inv = new SimpleInventory(3, "inv", 64); + private final SafeTimeTracker previewRecalcTimer = new SafeTimeTracker(100); + + private boolean previewColorsPushed = false; private ZonePlan[] selectedAreas = new ZonePlan[16]; private int currentSelectedArea = 0; - private SimpleInventory inv = new SimpleInventory(3, "inv", 64); + public byte[] getPreviewTexture(boolean force) { + if (!previewColorsPushed || force) { + previewColorsPushed = true; + return previewColors; + } + return null; + } @Override public void initialize() { @@ -64,6 +78,10 @@ public void update() { return; } + if (previewRecalcTimer.markTimeIfDelay(worldObj)) { + recalculatePreview(); + } + if (inv.getStackInSlot(0) != null && inv.getStackInSlot(1) == null && inv.getStackInSlot(0).getItem() instanceof ItemMapLocation) { if (progress < CRAFT_TIME) { @@ -88,6 +106,25 @@ public void update() { } } + private void recalculatePreview() { + byte[] newPreviewColors = new byte[80]; + MapWorld mw = BuildCraftRobotics.manager.getWorld(worldObj); + + for (int y = 0; y < 8; y++) { + for (int x = 0; x < 10; x++) { + int tx = (x * PREVIEW_BLOCKS_PER_PIXEL) - (5 * PREVIEW_BLOCKS_PER_PIXEL) + (PREVIEW_BLOCKS_PER_PIXEL / 2); + int ty = (y * PREVIEW_BLOCKS_PER_PIXEL) - (4 * PREVIEW_BLOCKS_PER_PIXEL) + (PREVIEW_BLOCKS_PER_PIXEL / 2); + newPreviewColors[y * 10 + x] = (byte) mw.getColor(getPos().getX() - (getPos().getX() % PREVIEW_BLOCKS_PER_PIXEL) + tx, getPos().getZ() + - (getPos().getZ() % PREVIEW_BLOCKS_PER_PIXEL) + ty); + } + } + + if (!Arrays.equals(previewColors, newPreviewColors)) { + System.arraycopy(newPreviewColors, 0, previewColors, 0, 80); + sendNetworkUpdate(); + } + } + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); @@ -130,12 +167,15 @@ public void readFromNBT(NBTTagCompound nbt) { public void writeData(ByteBuf stream) { stream.writeShort(progress); NetworkUtils.writeUTF(stream, mapName); + stream.writeBytes(previewColors, 0, 80); } @Override public void readData(ByteBuf stream) { progress = stream.readShort(); mapName = NetworkUtils.readUTF(stream); + stream.readBytes(previewColors, 0, 80); + previewColorsPushed = false; } private void importMap(ItemStack stack) { diff --git a/common/buildcraft/core/ZoneChunk.java b/common/buildcraft/robotics/ZoneChunk.java similarity index 98% rename from common/buildcraft/core/ZoneChunk.java rename to common/buildcraft/robotics/ZoneChunk.java index fdcfb037a5..7490d54905 100755 --- a/common/buildcraft/core/ZoneChunk.java +++ b/common/buildcraft/robotics/ZoneChunk.java @@ -1,8 +1,8 @@ /** 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.core; +package buildcraft.robotics; import java.util.BitSet; import java.util.Random; diff --git a/common/buildcraft/core/ZonePlan.java b/common/buildcraft/robotics/ZonePlan.java similarity index 73% rename from common/buildcraft/core/ZonePlan.java rename to common/buildcraft/robotics/ZonePlan.java index 59bc347af8..567b52a9bb 100755 --- a/common/buildcraft/core/ZonePlan.java +++ b/common/buildcraft/robotics/ZonePlan.java @@ -1,8 +1,8 @@ /** 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.core; +package buildcraft.robotics; import java.util.HashMap; import java.util.Map; @@ -12,6 +12,8 @@ import net.minecraft.nbt.NBTTagList; import net.minecraft.util.BlockPos; import net.minecraft.util.Vec3; +import net.minecraft.world.ChunkCoordIntPair; + import net.minecraftforge.common.util.Constants; import buildcraft.api.core.ISerializable; @@ -20,12 +22,12 @@ import io.netty.buffer.ByteBuf; public class ZonePlan implements IZone, ISerializable { - private HashMap chunkMapping = new HashMap(); + private final HashMap chunkMapping = new HashMap(); public boolean get(int x, int z) { int xChunk = x >> 4; int zChunk = z >> 4; - ChunkIndex chunkId = new ChunkIndex(xChunk, zChunk); + ChunkCoordIntPair chunkId = new ChunkCoordIntPair(xChunk, zChunk); ZoneChunk property; if (!chunkMapping.containsKey(chunkId)) { @@ -39,7 +41,7 @@ public boolean get(int x, int z) { public void set(int x, int z, boolean val) { int xChunk = x >> 4; int zChunk = z >> 4; - ChunkIndex chunkId = new ChunkIndex(xChunk, zChunk); + ChunkCoordIntPair chunkId = new ChunkCoordIntPair(xChunk, zChunk); ZoneChunk property; if (!chunkMapping.containsKey(chunkId)) { @@ -63,9 +65,10 @@ public void set(int x, int z, boolean val) { public void writeToNBT(NBTTagCompound nbt) { NBTTagList list = new NBTTagList(); - for (Map.Entry e : chunkMapping.entrySet()) { + for (Map.Entry e : chunkMapping.entrySet()) { NBTTagCompound subNBT = new NBTTagCompound(); - e.getKey().writeToNBT(subNBT); + subNBT.setInteger("chunkX", e.getKey().chunkXPos); + subNBT.setInteger("chunkZ", e.getKey().chunkZPos); e.getValue().writeToNBT(subNBT); list.appendTag(subNBT); } @@ -79,8 +82,7 @@ public void readFromNBT(NBTTagCompound nbt) { for (int i = 0; i < list.tagCount(); ++i) { NBTTagCompound subNBT = list.getCompoundTagAt(i); - ChunkIndex id = new ChunkIndex(); - id.readFromNBT(subNBT); + ChunkCoordIntPair id = new ChunkCoordIntPair(subNBT.getInteger("chunkX"), subNBT.getInteger("chunkZ")); ZoneChunk chunk = new ZoneChunk(); chunk.readFromNBT(subNBT); @@ -98,9 +100,9 @@ public double distanceTo(BlockPos index) { public double distanceToSquared(BlockPos index) { double maxSqrDistance = Double.MAX_VALUE; - for (Map.Entry e : chunkMapping.entrySet()) { - double dx = (e.getKey().x << 4 + 8) - index.getX(); - double dz = (e.getKey().x << 4 + 8) - index.getZ(); + for (Map.Entry e : chunkMapping.entrySet()) { + double dx = (e.getKey().chunkXPos << 4 + 8) - index.getX(); + double dz = (e.getKey().chunkZPos << 4 + 8) - index.getZ(); double sqrDistance = dx * dx + dz * dz; @@ -128,11 +130,11 @@ public BlockPos getRandomBlockPos(Random rand) { int chunkId = rand.nextInt(chunkMapping.size()); - for (Map.Entry e : chunkMapping.entrySet()) { + for (Map.Entry e : chunkMapping.entrySet()) { if (chunkId == 0) { BlockPos i = e.getValue().getRandomBlockPos(rand); - int x = (e.getKey().x << 4) + i.getX(); - int z = (e.getKey().z << 4) + i.getZ(); + int x = (e.getKey().chunkXPos << 4) + i.getX(); + int z = (e.getKey().chunkZPos << 4) + i.getZ(); return new BlockPos(x, i.getY(), z); } @@ -148,9 +150,8 @@ public void readData(ByteBuf stream) { chunkMapping.clear(); int size = stream.readInt(); for (int i = 0; i < size; i++) { - ChunkIndex key = new ChunkIndex(); + ChunkCoordIntPair key = new ChunkCoordIntPair(stream.readInt(), stream.readInt()); ZoneChunk value = new ZoneChunk(); - key.readData(stream); value.readData(stream); chunkMapping.put(key, value); } @@ -159,8 +160,9 @@ public void readData(ByteBuf stream) { @Override public void writeData(ByteBuf stream) { stream.writeInt(chunkMapping.size()); - for (Map.Entry e : chunkMapping.entrySet()) { - e.getKey().writeData(stream); + for (Map.Entry e : chunkMapping.entrySet()) { + stream.writeInt(e.getKey().chunkXPos); + stream.writeInt(e.getKey().chunkZPos); e.getValue().writeData(stream); } } diff --git a/common/buildcraft/robotics/ai/AIRobotAttack.java b/common/buildcraft/robotics/ai/AIRobotAttack.java index 94a83f3a3f..8a2746ab95 100755 --- a/common/buildcraft/robotics/ai/AIRobotAttack.java +++ b/common/buildcraft/robotics/ai/AIRobotAttack.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.robotics.ai; import net.minecraft.entity.Entity; @@ -42,7 +46,7 @@ public void preempt(AIRobot ai) { @Override public void update() { - if (target.isDead) { + if (target == null || target.isDead) { terminate(); return; } diff --git a/common/buildcraft/robotics/ai/AIRobotBreak.java b/common/buildcraft/robotics/ai/AIRobotBreak.java index dd6b4e0462..8d0dca5229 100644 --- a/common/buildcraft/robotics/ai/AIRobotBreak.java +++ b/common/buildcraft/robotics/ai/AIRobotBreak.java @@ -1,5 +1,5 @@ /** 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.robotics.ai; @@ -11,6 +11,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.BlockPos; import net.minecraft.world.WorldServer; + import net.minecraftforge.common.ForgeHooks; import buildcraft.api.blueprints.BuilderAPI; @@ -21,7 +22,6 @@ import buildcraft.core.proxy.CoreProxy; public class AIRobotBreak extends AIRobot { - private BlockPos blockToBreak; private float blockDamage = 0; @@ -51,8 +51,22 @@ public void start() { @Override public void update() { - if (state == null || state.getBlock().isAir(robot.worldObj, blockToBreak)) { + if (state == null) { + state = robot.worldObj.getBlockState(blockToBreak); + if (state.getBlock().isAir(robot.worldObj, blockToBreak)) { + setSuccess(false); + terminate(); + return; + } + state = robot.worldObj.getBlockState(blockToBreak); + hardness = state.getBlock().getBlockHardness(robot.worldObj, blockToBreak); + speed = getBreakSpeed(robot, robot.getHeldItem(), state, blockToBreak); + } + + if (state.getBlock().isAir(robot.worldObj, blockToBreak) || hardness < 0) { + setSuccess(false); terminate(); + return; } if (hardness != 0) { @@ -66,18 +80,22 @@ public void update() { robot.worldObj.sendBlockBreakProgress(robot.getEntityId(), blockToBreak, -1); blockDamage = 0; + boolean continueBreaking = true; + if (robot.getHeldItem() != null) { - robot.getHeldItem().getItem().onBlockStartBreak(robot.getHeldItem(), blockToBreak, CoreProxy.proxy.getBuildCraftPlayer( - (WorldServer) robot.worldObj).get()); + if (robot.getHeldItem().getItem().onBlockStartBreak(robot.getHeldItem(), blockToBreak, CoreProxy.proxy.getBuildCraftPlayer( + (WorldServer) robot.worldObj).get())) { + continueBreaking = false; + } } - if (BlockUtils.breakBlock((WorldServer) robot.worldObj, blockToBreak, 6000)) { + if (continueBreaking && BlockUtils.harvestBlock((WorldServer) robot.worldObj, blockToBreak, robot.getHeldItem())) { robot.worldObj.playAuxSFXAtEntity(null, 2001, blockToBreak, Block.getStateId(state)); if (robot.getHeldItem() != null) { robot.getHeldItem().getItem().onBlockDestroyed(robot.getHeldItem(), robot.worldObj, state.getBlock(), blockToBreak, robot); - if (robot.getHeldItem().getItemDamage() >= robot.getHeldItem().getMaxDamage()) { + if (robot.getHeldItem().stackSize == 0) { robot.setItemInUse(null); } } @@ -103,12 +121,11 @@ private float getBreakSpeed(EntityRobotBase robot, ItemStack usingItem, IBlockSt if (f > 1.0F) { int i = EnchantmentHelper.getEfficiencyModifier(robot); - ItemStack itemstack = usingItem; - if (i > 0 && itemstack != null) { + if (i > 0) { float f1 = i * i + 1; - boolean canHarvest = ForgeHooks.canToolHarvestBlock(robot.worldObj, pos, itemstack); + boolean canHarvest = ForgeHooks.canToolHarvestBlock(robot.worldObj, pos, usingItem); if (!canHarvest && f <= 1.0F) { f += f1 * 0.08F; @@ -126,6 +143,11 @@ public int getEnergyCost() { return (int) Math.ceil((float) BuilderAPI.BREAK_ENERGY * 2 / 30.0F); } + @Override + public boolean canLoadFromNBT() { + return true; + } + @Override public void writeSelfToNBT(NBTTagCompound nbt) { super.writeSelfToNBT(nbt); diff --git a/common/buildcraft/robotics/ai/AIRobotDeliverRequested.java b/common/buildcraft/robotics/ai/AIRobotDeliverRequested.java index 8046c91a8e..a67f3e83f0 100755 --- a/common/buildcraft/robotics/ai/AIRobotDeliverRequested.java +++ b/common/buildcraft/robotics/ai/AIRobotDeliverRequested.java @@ -1,18 +1,23 @@ -/** 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 */ +/** + * 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.robotics.ai; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import buildcraft.api.core.IInvSlot; import buildcraft.api.robots.AIRobot; import buildcraft.api.robots.EntityRobotBase; import buildcraft.api.robots.IRequestProvider; -import buildcraft.api.robots.StackRequest; import buildcraft.core.lib.inventory.InvUtils; import buildcraft.core.lib.inventory.filters.ArrayStackOrListFilter; +import buildcraft.robotics.StackRequest; public class AIRobotDeliverRequested extends AIRobot { @@ -31,39 +36,42 @@ public AIRobotDeliverRequested(EntityRobotBase robot, StackRequest request) { @Override public void start() { - startDelegateAI(new AIRobotGotoStation(robot, requested.station)); + if (requested != null) { + startDelegateAI(new AIRobotGotoStation(robot, requested.getStation(robot.worldObj))); + } else { + setSuccess(false); + terminate(); + } } @Override public void delegateAIEnded(AIRobot ai) { if (ai instanceof AIRobotGotoStation) { if (!ai.success()) { + setSuccess(false); terminate(); return; } - IInvSlot slot = InvUtils.getItem(robot, new ArrayStackOrListFilter(requested.stack)); + IInvSlot slot = InvUtils.getItem(robot, new ArrayStackOrListFilter(requested.getStack())); if (slot == null) { + setSuccess(false); terminate(); return; } - if (requested.requester != null) { - ItemStack newStack = ((IRequestProvider) requested.requester).provideItemsForRequest(requested.index, slot.getStackInSlot().copy()); + IRequestProvider requester = requested.getRequester(robot.worldObj); + if (requester == null) { + setSuccess(false); + terminate(); + return; + } + ItemStack newStack = requester.offerItem(requested.getSlot(), slot.getStackInSlot().copy()); if (newStack == null || newStack.stackSize != slot.getStackInSlot().stackSize) { - delivered = true; slot.setStackInSlot(newStack); } - - terminate(); - } else { - startDelegateAI(new AIRobotUnload(robot)); - return; - } - } else if (ai instanceof AIRobotUnload) { - delivered = ai.success(); terminate(); } } @@ -72,4 +80,28 @@ public void delegateAIEnded(AIRobot ai) { public boolean success() { return delivered; } + + @Override + public boolean canLoadFromNBT() { + return true; + } + + @Override + public void writeSelfToNBT(NBTTagCompound nbt) { + super.writeSelfToNBT(nbt); + + if (requested != null) { + NBTTagCompound requestNBT = new NBTTagCompound(); + requested.writeToNBT(requestNBT); + nbt.setTag("currentRequest", requestNBT); + } + } + + @Override + public void loadSelfFromNBT(NBTTagCompound nbt) { + super.loadSelfFromNBT(nbt); + if (nbt.hasKey("currentRequest")) { + requested = StackRequest.loadFromNBT(nbt.getCompoundTag("currentRequest")); + } + } } diff --git a/common/buildcraft/robotics/ai/AIRobotDisposeItems.java b/common/buildcraft/robotics/ai/AIRobotDisposeItems.java index 89738de033..32c32d9763 100755 --- a/common/buildcraft/robotics/ai/AIRobotDisposeItems.java +++ b/common/buildcraft/robotics/ai/AIRobotDisposeItems.java @@ -1,5 +1,5 @@ /** 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.robotics.ai; diff --git a/common/buildcraft/robotics/ai/AIRobotFetchAndEquipItemStack.java b/common/buildcraft/robotics/ai/AIRobotFetchAndEquipItemStack.java index e1018b7360..3bd3514521 100755 --- a/common/buildcraft/robotics/ai/AIRobotFetchAndEquipItemStack.java +++ b/common/buildcraft/robotics/ai/AIRobotFetchAndEquipItemStack.java @@ -1,16 +1,13 @@ /** 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.robotics.ai; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; import buildcraft.api.robots.AIRobot; -import buildcraft.api.robots.DockingStation; import buildcraft.api.robots.EntityRobotBase; import buildcraft.core.lib.inventory.ITransactor; import buildcraft.core.lib.inventory.Transactor; @@ -33,18 +30,24 @@ public AIRobotFetchAndEquipItemStack(EntityRobotBase iRobot, IStackFilter iFilte filter = new AggregateFilter(ActionRobotFilterTool.getGateFilter(iRobot.getLinkedStation()), iFilter); } + @Override + public void start() { + startDelegateAI(new AIRobotGotoStationToLoad(robot, filter, 1)); + } + @Override public void update() { if (robot.getDockingStation() == null) { - startDelegateAI(new AIRobotGotoStationToLoad(robot, filter, 1)); - } else { - if (delay++ > 40) { - if (equipItemStack()) { - terminate(); - } else { - delay = 0; - startDelegateAI(new AIRobotGotoStationToLoad(robot, filter, 1)); - } + setSuccess(false); + terminate(); + } + + if (delay++ > 40) { + if (equipItemStack()) { + terminate(); + } else { + delay = 0; + startDelegateAI(new AIRobotGotoStationToLoad(robot, filter, 1)); } } } @@ -67,30 +70,20 @@ public void delegateAIEnded(AIRobot ai) { } private boolean equipItemStack() { - if (robot.getDockingStation() != null) { - DockingStation station = robot.getDockingStation(); - - ItemStack itemFound = null; - - for (EnumFacing dir : EnumFacing.VALUES) { - TileEntity nearbyTile = robot.worldObj.getTileEntity(station.getPos().offset(dir)); - - if (nearbyTile != null && nearbyTile instanceof IInventory) { - ITransactor trans = Transactor.getTransactorFor(nearbyTile); + IInventory tileInventory = robot.getDockingStation().getItemInput(); + if (tileInventory == null) { + return false; + } - itemFound = trans.remove(filter, dir.getOpposite(), true); + ITransactor trans = Transactor.getTransactorFor(tileInventory); - if (itemFound != null) { - break; - } - } - } + ItemStack itemFound = trans.remove(filter, robot.getDockingStation().getItemInputSide().face, true); - if (itemFound != null) { - robot.setItemInUse(itemFound); - return true; - } + if (itemFound != null) { + robot.setItemInUse(itemFound); + return true; } + return false; } } diff --git a/common/buildcraft/robotics/ai/AIRobotFetchItem.java b/common/buildcraft/robotics/ai/AIRobotFetchItem.java index 152e6ae688..9d6b8f1079 100755 --- a/common/buildcraft/robotics/ai/AIRobotFetchItem.java +++ b/common/buildcraft/robotics/ai/AIRobotFetchItem.java @@ -1,5 +1,5 @@ /** 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.robotics.ai; @@ -78,6 +78,7 @@ public void delegateAIEnded(AIRobot ai) { if (!ai.success()) { robot.unreachableEntityDetected(target); + setSuccess(false); terminate(); } } diff --git a/common/buildcraft/robotics/ai/AIRobotGoAndLinkToDock.java b/common/buildcraft/robotics/ai/AIRobotGoAndLinkToDock.java index daad516695..74168e35a9 100755 --- a/common/buildcraft/robotics/ai/AIRobotGoAndLinkToDock.java +++ b/common/buildcraft/robotics/ai/AIRobotGoAndLinkToDock.java @@ -1,12 +1,17 @@ /** 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.robotics.ai; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; + import buildcraft.api.robots.AIRobot; import buildcraft.api.robots.DockingStation; import buildcraft.api.robots.EntityRobotBase; +import buildcraft.core.lib.utils.NBTUtils; import buildcraft.core.lib.utils.Utils; public class AIRobotGoAndLinkToDock extends AIRobot { @@ -28,7 +33,7 @@ public void start() { if (station == robot.getLinkedStation() && station == robot.getDockingStation()) { terminate(); } else { - if (station.takeAsMain(robot)) { + if (station != null && station.takeAsMain(robot)) { startDelegateAI(new AIRobotGotoBlock(robot, station.getPos().offset(station.side(), 2))); } else { setSuccess(false); @@ -52,4 +57,31 @@ public void delegateAIEnded(AIRobot ai) { terminate(); } } + + @Override + public boolean canLoadFromNBT() { + return true; + } + + @Override + public void writeSelfToNBT(NBTTagCompound nbt) { + super.writeSelfToNBT(nbt); + + if (station != null && station.index() != null) { + nbt.setTag("stationIndex", NBTUtils.writeBlockPos(station.index())); + nbt.setByte("stationSide", (byte) station.side().ordinal()); + } + } + + @Override + public void loadSelfFromNBT(NBTTagCompound nbt) { + if (nbt.hasKey("stationIndex")) { + BlockPos index = NBTUtils.readBlockPos(nbt.getTag("stationIndex")); + EnumFacing side = EnumFacing.values()[nbt.getByte("stationSide")]; + + station = robot.getRegistry().getStation(index, side); + } else { + station = robot.getLinkedStation(); + } + } } diff --git a/common/buildcraft/robotics/ai/AIRobotGoto.java b/common/buildcraft/robotics/ai/AIRobotGoto.java index f27cab3521..01a3f8425c 100755 --- a/common/buildcraft/robotics/ai/AIRobotGoto.java +++ b/common/buildcraft/robotics/ai/AIRobotGoto.java @@ -1,5 +1,5 @@ /** 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.robotics.ai; diff --git a/common/buildcraft/robotics/ai/AIRobotGotoBlock.java b/common/buildcraft/robotics/ai/AIRobotGotoBlock.java index a7f8cc95dd..e20a2a3fcc 100755 --- a/common/buildcraft/robotics/ai/AIRobotGotoBlock.java +++ b/common/buildcraft/robotics/ai/AIRobotGotoBlock.java @@ -1,5 +1,5 @@ /** 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.robotics.ai; @@ -9,8 +9,10 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.BlockPos; + import net.minecraftforge.common.util.Constants; +import buildcraft.api.core.BuildCraftAPI; import buildcraft.api.robots.EntityRobotBase; import buildcraft.core.lib.utils.IterableAlgorithmRunner; import buildcraft.core.lib.utils.NBTUtils; @@ -59,7 +61,7 @@ public void update() { pathSearch = new PathFinding(robot.worldObj, new BlockPos((int) Math.floor(robot.posX), (int) Math.floor(robot.posY), (int) Math.floor( robot.posZ)), finalPos, maxDistance); - pathSearchJob = new IterableAlgorithmRunner(pathSearch, 100); + pathSearchJob = new IterableAlgorithmRunner(pathSearch, 50); pathSearchJob.start(); } else if (path != null && next != null) { double distance = robot.getDistance(next.xCoord, next.yCoord, next.zCoord); @@ -106,9 +108,14 @@ public void update() { private void setNextInPath() { if (path.size() > 0) { BlockPos next = path.getFirst(); - setDestination(robot, Utils.convertMiddle(next)); - prevDistance = Double.MAX_VALUE; - robot.aimItemAt(next); + if (BuildCraftAPI.isSoftBlock(robot.worldObj, next)) { + setDestination(robot, Utils.convertMiddle(next)); + prevDistance = Double.MAX_VALUE; + robot.aimItemAt(next); + } else { + setSuccess(false); + terminate(); + } } } diff --git a/common/buildcraft/robotics/ai/AIRobotGotoSleep.java b/common/buildcraft/robotics/ai/AIRobotGotoSleep.java index fa6f4a5125..a1f5bf65f8 100755 --- a/common/buildcraft/robotics/ai/AIRobotGotoSleep.java +++ b/common/buildcraft/robotics/ai/AIRobotGotoSleep.java @@ -1,5 +1,5 @@ /** 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.robotics.ai; @@ -27,9 +27,4 @@ public void delegateAIEnded(AIRobot ai) { terminate(); } } - - @Override - public boolean canLoadFromNBT() { - return true; - } } diff --git a/common/buildcraft/robotics/ai/AIRobotGotoStation.java b/common/buildcraft/robotics/ai/AIRobotGotoStation.java index 2d63b5f158..89e78c33fc 100755 --- a/common/buildcraft/robotics/ai/AIRobotGotoStation.java +++ b/common/buildcraft/robotics/ai/AIRobotGotoStation.java @@ -1,5 +1,5 @@ /** 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.robotics.ai; @@ -58,7 +58,11 @@ public void delegateAIEnded(AIRobot ai) { if (station == null) { terminate(); } else if (ai instanceof AIRobotGotoBlock) { - startDelegateAI(new AIRobotStraightMoveTo(robot, Utils.convertMiddle(stationIndex).add(Utils.convert(stationSide, 0.5)))); + if (ai.success()) { + startDelegateAI(new AIRobotStraightMoveTo(robot, Utils.convertMiddle(stationIndex).add(Utils.convert(stationSide, 0.5)))); + } else { + terminate(); + } } else { setSuccess(true); if (stationSide.getAxis() != Axis.Y) { diff --git a/common/buildcraft/robotics/ai/AIRobotGotoStationAndLoad.java b/common/buildcraft/robotics/ai/AIRobotGotoStationAndLoad.java index e91a75e61e..60c84a50e5 100755 --- a/common/buildcraft/robotics/ai/AIRobotGotoStationAndLoad.java +++ b/common/buildcraft/robotics/ai/AIRobotGotoStationAndLoad.java @@ -1,5 +1,5 @@ /** 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.robotics.ai; @@ -32,13 +32,13 @@ public void start() { @Override public void delegateAIEnded(AIRobot ai) { if (ai instanceof AIRobotGotoStationToLoad) { - if (ai.success()) { + if (filter != null && ai.success()) { startDelegateAI(new AIRobotLoad(robot, filter, quantity)); } else { setSuccess(false); terminate(); } - } else if (ai instanceof AIRobotGotoStationToLoad) { + } else if (ai instanceof AIRobotLoad) { setSuccess(ai.success()); terminate(); } diff --git a/common/buildcraft/robotics/ai/AIRobotGotoStationAndLoadFluids.java b/common/buildcraft/robotics/ai/AIRobotGotoStationAndLoadFluids.java index fc9b2ca420..f1a6a8c630 100755 --- a/common/buildcraft/robotics/ai/AIRobotGotoStationAndLoadFluids.java +++ b/common/buildcraft/robotics/ai/AIRobotGotoStationAndLoadFluids.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.robotics.ai; import buildcraft.api.robots.AIRobot; @@ -30,7 +34,7 @@ public void start() { @Override public void delegateAIEnded(AIRobot ai) { if (ai instanceof AIRobotGotoStationToLoadFluids) { - if (ai.success()) { + if (filter != null && ai.success()) { startDelegateAI(new AIRobotLoadFluids(robot, filter)); } else { setSuccess(false); diff --git a/common/buildcraft/robotics/ai/AIRobotGotoStationAndUnload.java b/common/buildcraft/robotics/ai/AIRobotGotoStationAndUnload.java index 472337618c..29f5b1e994 100755 --- a/common/buildcraft/robotics/ai/AIRobotGotoStationAndUnload.java +++ b/common/buildcraft/robotics/ai/AIRobotGotoStationAndUnload.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.robotics.ai; import buildcraft.api.robots.AIRobot; diff --git a/common/buildcraft/robotics/ai/AIRobotGotoStationAndUnloadFluids.java b/common/buildcraft/robotics/ai/AIRobotGotoStationAndUnloadFluids.java index 78932d33c8..f4b4d08755 100755 --- a/common/buildcraft/robotics/ai/AIRobotGotoStationAndUnloadFluids.java +++ b/common/buildcraft/robotics/ai/AIRobotGotoStationAndUnloadFluids.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.robotics.ai; import buildcraft.api.robots.AIRobot; diff --git a/common/buildcraft/robotics/ai/AIRobotGotoStationToLoad.java b/common/buildcraft/robotics/ai/AIRobotGotoStationToLoad.java index 952898a2aa..f3cfd7a518 100755 --- a/common/buildcraft/robotics/ai/AIRobotGotoStationToLoad.java +++ b/common/buildcraft/robotics/ai/AIRobotGotoStationToLoad.java @@ -1,5 +1,5 @@ /** 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.robotics.ai; diff --git a/common/buildcraft/robotics/ai/AIRobotGotoStationToLoadFluids.java b/common/buildcraft/robotics/ai/AIRobotGotoStationToLoadFluids.java index ff0c1477ef..3c1115f1b0 100755 --- a/common/buildcraft/robotics/ai/AIRobotGotoStationToLoadFluids.java +++ b/common/buildcraft/robotics/ai/AIRobotGotoStationToLoadFluids.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.robotics.ai; import buildcraft.api.robots.AIRobot; diff --git a/common/buildcraft/robotics/ai/AIRobotGotoStationToUnload.java b/common/buildcraft/robotics/ai/AIRobotGotoStationToUnload.java index 64bbddd1c4..aa01c63805 100755 --- a/common/buildcraft/robotics/ai/AIRobotGotoStationToUnload.java +++ b/common/buildcraft/robotics/ai/AIRobotGotoStationToUnload.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.robotics.ai; import buildcraft.api.robots.AIRobot; diff --git a/common/buildcraft/robotics/ai/AIRobotGotoStationToUnloadFluids.java b/common/buildcraft/robotics/ai/AIRobotGotoStationToUnloadFluids.java index 3ab1256107..58f24f44e1 100755 --- a/common/buildcraft/robotics/ai/AIRobotGotoStationToUnloadFluids.java +++ b/common/buildcraft/robotics/ai/AIRobotGotoStationToUnloadFluids.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.robotics.ai; import buildcraft.api.robots.AIRobot; diff --git a/common/buildcraft/robotics/ai/AIRobotHarvest.java b/common/buildcraft/robotics/ai/AIRobotHarvest.java index e82760fe1b..22819d009c 100644 --- a/common/buildcraft/robotics/ai/AIRobotHarvest.java +++ b/common/buildcraft/robotics/ai/AIRobotHarvest.java @@ -57,6 +57,11 @@ public void update() { } @Override + public boolean canLoadFromNBT() { + return true; + } + + @Override public void writeSelfToNBT(NBTTagCompound nbt) { super.writeSelfToNBT(nbt); diff --git a/common/buildcraft/robotics/ai/AIRobotLoad.java b/common/buildcraft/robotics/ai/AIRobotLoad.java index 2200ea090e..4b404b2114 100755 --- a/common/buildcraft/robotics/ai/AIRobotLoad.java +++ b/common/buildcraft/robotics/ai/AIRobotLoad.java @@ -1,5 +1,5 @@ /** 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.robotics.ai; @@ -39,7 +39,6 @@ public AIRobotLoad(EntityRobotBase iRobot, IStackFilter iFilter, int iQuantity) @Override public void update() { if (filter == null) { - // loading error terminate(); return; } @@ -64,10 +63,11 @@ public static boolean load(EntityRobotBase robot, DockingStation station, IStack return false; } - for (IInvSlot slot : InventoryIterator.getIterable(tileInventory)) { + for (IInvSlot slot : InventoryIterator.getIterable(tileInventory, station.getItemInputSide().face)) { ItemStack stack = slot.getStackInSlot(); - if (stack == null || !filter.matches(stack) || !ActionRobotFilter.canInteractWithItem(station, filter, ActionStationProvideItems.class)) { + if (stack == null || !slot.canTakeStackFromSlot(stack) || !filter.matches(stack) || !ActionStationProvideItems.canExtractItem(station, + stack) || !ActionRobotFilter.canInteractWithItem(station, filter, ActionStationProvideItems.class)) { continue; } diff --git a/common/buildcraft/robotics/ai/AIRobotLoadFluids.java b/common/buildcraft/robotics/ai/AIRobotLoadFluids.java index 78410af5c1..8a19c6086e 100755 --- a/common/buildcraft/robotics/ai/AIRobotLoadFluids.java +++ b/common/buildcraft/robotics/ai/AIRobotLoadFluids.java @@ -1,9 +1,11 @@ /** 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.robotics.ai; +import net.minecraft.util.EnumFacing; + import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidHandler; @@ -33,6 +35,11 @@ public AIRobotLoadFluids(EntityRobotBase iRobot, IFluidFilter iFilter) { @Override public void update() { + if (filter == null) { + terminate(); + return; + } + waitedCycles++; if (waitedCycles > 40) { @@ -59,7 +66,9 @@ public static int load(EntityRobotBase robot, DockingStation station, IFluidFilt return 0; } - FluidStack drainable = handler.drain(station.side, FluidContainerRegistry.BUCKET_VOLUME, false); + EnumFacing side = station.getFluidInputSide().face; + + FluidStack drainable = handler.drain(side, FluidContainerRegistry.BUCKET_VOLUME, false); if (drainable == null || !filter.matches(drainable.getFluid())) { return 0; } @@ -69,7 +78,7 @@ public static int load(EntityRobotBase robot, DockingStation station, IFluidFilt if (filled > 0 && doLoad) { drainable.amount = filled; - handler.drain(station.side, drainable, true); + handler.drain(side, drainable, true); } return filled; } diff --git a/common/buildcraft/robotics/ai/AIRobotMain.java b/common/buildcraft/robotics/ai/AIRobotMain.java index 6e45172a9d..5cd9a3c903 100755 --- a/common/buildcraft/robotics/ai/AIRobotMain.java +++ b/common/buildcraft/robotics/ai/AIRobotMain.java @@ -1,5 +1,5 @@ /** 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.robotics.ai; @@ -37,8 +37,10 @@ public void preempt(AIRobot ai) { startDelegateAI(new AIRobotRecharge(robot)); } } - } else if (overridingAI != null && ai != overridingAI) { - startDelegateAI(overridingAI); + } else if (!(ai instanceof AIRobotRecharge)) { + if (overridingAI != null && ai != overridingAI) { + startDelegateAI(overridingAI); + } } } diff --git a/common/buildcraft/robotics/ai/AIRobotPumpBlock.java b/common/buildcraft/robotics/ai/AIRobotPumpBlock.java index 0f2b1ebda8..65cb26f8a0 100644 --- a/common/buildcraft/robotics/ai/AIRobotPumpBlock.java +++ b/common/buildcraft/robotics/ai/AIRobotPumpBlock.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.robotics.ai; import net.minecraft.util.BlockPos; diff --git a/common/buildcraft/robotics/ai/AIRobotRecharge.java b/common/buildcraft/robotics/ai/AIRobotRecharge.java index a8d8d85a46..aee6990012 100755 --- a/common/buildcraft/robotics/ai/AIRobotRecharge.java +++ b/common/buildcraft/robotics/ai/AIRobotRecharge.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.robotics.ai; import buildcraft.api.robots.AIRobot; diff --git a/common/buildcraft/robotics/ai/AIRobotSearchAndGotoBlock.java b/common/buildcraft/robotics/ai/AIRobotSearchAndGotoBlock.java index a2b807ed64..4e41a76643 100644 --- a/common/buildcraft/robotics/ai/AIRobotSearchAndGotoBlock.java +++ b/common/buildcraft/robotics/ai/AIRobotSearchAndGotoBlock.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.robotics.ai; import net.minecraft.nbt.NBTTagCompound; diff --git a/common/buildcraft/robotics/ai/AIRobotSearchAndGotoStation.java b/common/buildcraft/robotics/ai/AIRobotSearchAndGotoStation.java index 73a10b4f16..9bcc0b6984 100755 --- a/common/buildcraft/robotics/ai/AIRobotSearchAndGotoStation.java +++ b/common/buildcraft/robotics/ai/AIRobotSearchAndGotoStation.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.robotics.ai; import buildcraft.api.core.IZone; diff --git a/common/buildcraft/robotics/ai/AIRobotSearchBlock.java b/common/buildcraft/robotics/ai/AIRobotSearchBlock.java index 2381d84c21..f9e233c72b 100644 --- a/common/buildcraft/robotics/ai/AIRobotSearchBlock.java +++ b/common/buildcraft/robotics/ai/AIRobotSearchBlock.java @@ -10,13 +10,7 @@ import buildcraft.api.robots.AIRobot; import buildcraft.api.robots.EntityRobotBase; import buildcraft.api.robots.ResourceIdBlock; -import buildcraft.core.lib.utils.BlockScannerExpanding; -import buildcraft.core.lib.utils.BlockScannerRandom; -import buildcraft.core.lib.utils.BlockScannerZoneRandom; -import buildcraft.core.lib.utils.IBlockFilter; -import buildcraft.core.lib.utils.IterableAlgorithmRunner; -import buildcraft.core.lib.utils.NBTUtils; -import buildcraft.core.lib.utils.PathFindingSearch; +import buildcraft.core.lib.utils.*; public class AIRobotSearchBlock extends AIRobot { @@ -29,6 +23,10 @@ public class AIRobotSearchBlock extends AIRobot { private double maxDistanceToEnd; private IZone zone; + public AIRobotSearchBlock(EntityRobotBase iRobot) { + super(iRobot); + } + public AIRobotSearchBlock(EntityRobotBase iRobot, boolean random, IBlockFilter iPathFound, double iMaxDistanceToEnd) { super(iRobot); @@ -91,6 +89,11 @@ public boolean success() { return blockFound != null; } + @Override + public boolean canLoadFromNBT() { + return true; + } + @Override public void writeSelfToNBT(NBTTagCompound nbt) { super.writeSelfToNBT(nbt); diff --git a/common/buildcraft/robotics/ai/AIRobotSearchEntity.java b/common/buildcraft/robotics/ai/AIRobotSearchEntity.java old mode 100755 new mode 100644 index 79cc32e5ec..bbe63a52b7 --- a/common/buildcraft/robotics/ai/AIRobotSearchEntity.java +++ b/common/buildcraft/robotics/ai/AIRobotSearchEntity.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.robotics.ai; import net.minecraft.entity.Entity; diff --git a/common/buildcraft/robotics/ai/AIRobotSearchRandomGroundBlock.java b/common/buildcraft/robotics/ai/AIRobotSearchRandomGroundBlock.java index 8e127d96d9..a5b8765c33 100755 --- a/common/buildcraft/robotics/ai/AIRobotSearchRandomGroundBlock.java +++ b/common/buildcraft/robotics/ai/AIRobotSearchRandomGroundBlock.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.robotics.ai; import net.minecraft.util.BlockPos; @@ -38,7 +42,6 @@ public AIRobotSearchRandomGroundBlock(EntityRobotBase iRobot, int iRange, IBlock @Override public void update() { if (filter == null) { - // defensive code terminate(); } @@ -48,8 +51,7 @@ public void update() { terminate(); } - int x = 0; - int z = 0; + int x, z; if (zone == null) { double r = robot.worldObj.rand.nextFloat() * range; diff --git a/common/buildcraft/robotics/ai/AIRobotSearchStackRequest.java b/common/buildcraft/robotics/ai/AIRobotSearchStackRequest.java index 37f9c9ea61..824d102182 100755 --- a/common/buildcraft/robotics/ai/AIRobotSearchStackRequest.java +++ b/common/buildcraft/robotics/ai/AIRobotSearchStackRequest.java @@ -1,10 +1,12 @@ /** 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.robotics.ai; +import java.util.ArrayList; import java.util.Collection; +import java.util.List; import net.minecraft.item.ItemStack; @@ -12,20 +14,15 @@ import buildcraft.api.robots.DockingStation; import buildcraft.api.robots.EntityRobotBase; import buildcraft.api.robots.IRequestProvider; -import buildcraft.api.robots.StackRequest; -import buildcraft.api.statements.IStatementParameter; -import buildcraft.api.statements.StatementParameterItemStack; -import buildcraft.api.statements.StatementSlot; import buildcraft.core.lib.inventory.StackHelper; import buildcraft.core.lib.inventory.filters.IStackFilter; import buildcraft.robotics.IStationFilter; -import buildcraft.robotics.statements.ActionRobotFilter; -import buildcraft.robotics.statements.ActionStationRequestItems; -import buildcraft.robotics.statements.ActionStationRequestItemsMachine; +import buildcraft.robotics.StackRequest; public class AIRobotSearchStackRequest extends AIRobot { public StackRequest request = null; + public DockingStation station = null; private Collection blackList; @@ -50,17 +47,11 @@ public void start() { @Override public void delegateAIEnded(AIRobot ai) { if (ai instanceof AIRobotSearchStation) { - if (!ai.success()) { - terminate(); - } else { - request = getOrderFromRequestingAction(((AIRobotSearchStation) ai).targetStation); - - if (request == null) { - request = getOrderFromRequestingStation(((AIRobotSearchStation) ai).targetStation, true); - } - - terminate(); + if (ai.success()) { + request = getOrderFromRequestingStation(((AIRobotSearchStation) ai).targetStation, true); } + + terminate(); } } @@ -80,27 +71,16 @@ private boolean isBlacklisted(ItemStack stack) { } private StackRequest getOrderFromRequestingStation(DockingStation station, boolean take) { - if (!ActionRobotFilter.canInteractWithItem(station, filter, ActionStationRequestItemsMachine.class)) { - return null; - } - - IRequestProvider provider = station.getRequestProvider(); - if (provider == null) { - return null; - } - - for (int i = 0; i < provider.getNumberOfRequests(); ++i) { - StackRequest requestFound = provider.getAvailableRequest(i); - - if (requestFound != null && !isBlacklisted(requestFound.stack) && filter.matches(requestFound.stack)) { - requestFound.station = station; + for (StackRequest req : getAvailableRequests(station)) { + if (!isBlacklisted(req.getStack()) && filter.matches(req.getStack())) { + req.setStation(station); if (take) { - if (provider.takeRequest(i, robot)) { - return requestFound; + if (robot.getRegistry().take(req.getResourceId(robot.worldObj), robot)) { + return req; } } else { - return requestFound; + return req; } } } @@ -108,32 +88,31 @@ private StackRequest getOrderFromRequestingStation(DockingStation station, boole return null; } - private StackRequest getOrderFromRequestingAction(DockingStation station) { - for (StatementSlot s : station.getActiveActions()) { - if (s.statement instanceof ActionStationRequestItems) { - for (IStatementParameter p : s.parameters) { - StatementParameterItemStack param = (StatementParameterItemStack) p; + private Collection getAvailableRequests(DockingStation station) { + List result = new ArrayList(); - if (param != null && !isBlacklisted(param.getItemStack())) { - StackRequest req = new StackRequest(); - req.station = station; - req.stack = param.getItemStack(); + IRequestProvider provider = station.getRequestProvider(); + if (provider == null) { + return result; + } - return req; - } - } + for (int i = 0; i < provider.getRequestsCount(); i++) { + if (provider.getRequest(i) == null) { + continue; + } + StackRequest req = new StackRequest(provider, i, provider.getRequest(i)); + req.setStation(station); + if (!robot.getRegistry().isTaken(req.getResourceId(robot.worldObj))) { + result.add(req); } } - - return null; + return result; } private class StationProviderFilter implements IStationFilter { - @Override public boolean matches(DockingStation station) { - return getOrderFromRequestingAction(station) != null || getOrderFromRequestingStation(station, false) != null; + return getOrderFromRequestingStation(station, false) != null; } } - } diff --git a/common/buildcraft/robotics/ai/AIRobotSearchStation.java b/common/buildcraft/robotics/ai/AIRobotSearchStation.java index 0c395feb3e..daf2bc757f 100755 --- a/common/buildcraft/robotics/ai/AIRobotSearchStation.java +++ b/common/buildcraft/robotics/ai/AIRobotSearchStation.java @@ -1,5 +1,5 @@ /** 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.robotics.ai; @@ -41,6 +41,9 @@ public void start() { DockingStation potentialStation = null; for (DockingStation station : robot.getRegistry().getStations()) { + if (!station.isInitialized()) { + continue; + } if (station.isTaken() && station.robotIdTaking() != robot.getRobotId()) { continue; diff --git a/common/buildcraft/robotics/ai/AIRobotShutdown.java b/common/buildcraft/robotics/ai/AIRobotShutdown.java index 62491ec72d..c94a61f5be 100644 --- a/common/buildcraft/robotics/ai/AIRobotShutdown.java +++ b/common/buildcraft/robotics/ai/AIRobotShutdown.java @@ -1,13 +1,11 @@ /** 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.robotics.ai; import java.util.List; -import net.minecraft.util.AxisAlignedBB; - import buildcraft.api.robots.AIRobot; import buildcraft.api.robots.EntityRobotBase; @@ -34,7 +32,8 @@ public void start() { @Override public void update() { if (skip == 0) { - List boxes = robot.worldObj.getCollidingBoundingBoxes(robot, getRobotBox().addCoord(robot.motionX, -0.075f, robot.motionZ)); + List boxes = robot.worldObj.getCollidingBoundingBoxes(robot, robot.getEntityBoundingBox().addCoord(robot.motionX, -0.075f, + robot.motionZ)); if (boxes.size() == 0) { robot.motionY = -0.075f; } else { @@ -53,11 +52,6 @@ public void update() { } - private AxisAlignedBB getRobotBox() { - return new AxisAlignedBB(robot.posX - 0.25d, robot.posY - 0.25d, robot.posZ - 0.25d, robot.posX + 0.25d, robot.posY + 0.25d, robot.posZ - + 0.25d); - } - @Override public int getEnergyCost() { return 0; diff --git a/common/buildcraft/robotics/ai/AIRobotSleep.java b/common/buildcraft/robotics/ai/AIRobotSleep.java index 1ad2e4cf2d..d4d18a8b5b 100755 --- a/common/buildcraft/robotics/ai/AIRobotSleep.java +++ b/common/buildcraft/robotics/ai/AIRobotSleep.java @@ -1,5 +1,5 @@ /** 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.robotics.ai; diff --git a/common/buildcraft/robotics/ai/AIRobotStraightMoveTo.java b/common/buildcraft/robotics/ai/AIRobotStraightMoveTo.java index db72ece12a..bcaac2fec5 100755 --- a/common/buildcraft/robotics/ai/AIRobotStraightMoveTo.java +++ b/common/buildcraft/robotics/ai/AIRobotStraightMoveTo.java @@ -1,9 +1,10 @@ /** 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.robotics.ai; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.Vec3; import buildcraft.api.robots.EntityRobotBase; @@ -49,4 +50,30 @@ public void update() { terminate(); } } + + @Override + public boolean canLoadFromNBT() { + return true; + } + + @Override + public void writeSelfToNBT(NBTTagCompound nbt) { + super.writeSelfToNBT(nbt); + + nbt.setFloat("x", (float) pos.xCoord); + nbt.setFloat("y", (float) pos.yCoord); + nbt.setFloat("z", (float) pos.zCoord); + } + + @Override + public void loadSelfFromNBT(NBTTagCompound nbt) { + super.loadSelfFromNBT(nbt); + + if (nbt.hasKey("x")) { + float x = nbt.getFloat("x"); + float y = nbt.getFloat("y"); + float z = nbt.getFloat("z"); + pos = new Vec3(x, y, z); + } + } } diff --git a/common/buildcraft/robotics/ai/AIRobotStripesHandler.java b/common/buildcraft/robotics/ai/AIRobotStripesHandler.java index 570206dc0b..c149663355 100644 --- a/common/buildcraft/robotics/ai/AIRobotStripesHandler.java +++ b/common/buildcraft/robotics/ai/AIRobotStripesHandler.java @@ -1,5 +1,5 @@ /** 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.robotics.ai; @@ -42,6 +42,12 @@ public void start() { @Override public void update() { + if (useToBlock == null) { + setSuccess(false); + terminate(); + return; + } + useCycles++; if (useCycles > 60) { diff --git a/common/buildcraft/robotics/ai/AIRobotUnload.java b/common/buildcraft/robotics/ai/AIRobotUnload.java index c2215544c1..15803f5284 100755 --- a/common/buildcraft/robotics/ai/AIRobotUnload.java +++ b/common/buildcraft/robotics/ai/AIRobotUnload.java @@ -1,5 +1,5 @@ /** 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.robotics.ai; @@ -13,9 +13,9 @@ import buildcraft.api.robots.EntityRobotBase; import buildcraft.api.transport.IInjectable; import buildcraft.core.lib.inventory.InventoryIterator; -import buildcraft.core.lib.inventory.filters.ArrayStackFilter; +import buildcraft.core.lib.inventory.filters.ArrayStackOrListFilter; import buildcraft.robotics.statements.ActionRobotFilter; -import buildcraft.robotics.statements.ActionStationInputItems; +import buildcraft.robotics.statements.ActionStationAcceptItems; public class AIRobotUnload extends AIRobot { @@ -49,26 +49,46 @@ public static boolean unload(EntityRobotBase robot, DockingStation station, bool return false; } - for (IInvSlot robotSlot : InventoryIterator.getIterable(robot, null)) { + EnumFacing injectSide = station.getItemOutputSide().face; + if (!output.canInjectItems(injectSide)) { + return false; + } + + for (IInvSlot robotSlot : InventoryIterator.getIterable(robot)) { if (robotSlot.getStackInSlot() == null) { continue; } - if (!ActionRobotFilter.canInteractWithItem(station, new ArrayStackFilter(robotSlot.getStackInSlot()), ActionStationInputItems.class)) { - return false; + if (!ActionRobotFilter.canInteractWithItem(station, new ArrayStackOrListFilter(robotSlot.getStackInSlot()), + ActionStationAcceptItems.class)) { + continue; } - EnumFacing injectSide = station.side().getOpposite(); - ItemStack stack = robotSlot.getStackInSlot(); int used = output.injectItem(stack, doUnload, injectSide, null); + + if (used > 0) { + if (doUnload) { + robotSlot.decreaseStackInSlot(used); + } + return true; + } + } + + if (robot.getHeldItem() != null) { + if (!ActionRobotFilter.canInteractWithItem(station, new ArrayStackOrListFilter(robot.getHeldItem()), ActionStationAcceptItems.class)) { + return false; + } + + ItemStack stack = robot.getHeldItem(); + int used = output.injectItem(stack, doUnload, injectSide, null); + if (used > 0) { if (doUnload) { - stack.stackSize -= used; - if (stack.stackSize > 0) { - robotSlot.setStackInSlot(stack); + if (stack.stackSize <= used) { + robot.setItemInUse(null); } else { - robotSlot.setStackInSlot(null); + stack.stackSize -= used; } } return true; diff --git a/common/buildcraft/robotics/ai/AIRobotUnloadFluids.java b/common/buildcraft/robotics/ai/AIRobotUnloadFluids.java index 93065521cd..7bed5fd6bf 100755 --- a/common/buildcraft/robotics/ai/AIRobotUnloadFluids.java +++ b/common/buildcraft/robotics/ai/AIRobotUnloadFluids.java @@ -1,5 +1,5 @@ /** 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.robotics.ai; @@ -58,7 +58,7 @@ public static int unload(EntityRobotBase robot, DockingStation station, boolean } drainable = drainable.copy(); - int filled = fluidHandler.fill(station.side, drainable, doUnload); + int filled = fluidHandler.fill(station.getFluidOutputSide().face, drainable, doUnload); if (filled > 0 && doUnload) { drainable.amount = filled; diff --git a/common/buildcraft/robotics/ai/AIRobotUseToolOnBlock.java b/common/buildcraft/robotics/ai/AIRobotUseToolOnBlock.java index d69965b597..9540a93e65 100755 --- a/common/buildcraft/robotics/ai/AIRobotUseToolOnBlock.java +++ b/common/buildcraft/robotics/ai/AIRobotUseToolOnBlock.java @@ -1,5 +1,5 @@ /** 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.robotics.ai; diff --git a/common/buildcraft/robotics/boards/BCBoardNBT.java b/common/buildcraft/robotics/boards/BCBoardNBT.java index ced5c19505..366781e4ac 100644 --- a/common/buildcraft/robotics/boards/BCBoardNBT.java +++ b/common/buildcraft/robotics/boards/BCBoardNBT.java @@ -9,6 +9,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/common/buildcraft/robotics/boards/BoardRobotBomber.java b/common/buildcraft/robotics/boards/BoardRobotBomber.java index c4bcda38a6..855c82eb52 100755 --- a/common/buildcraft/robotics/boards/BoardRobotBomber.java +++ b/common/buildcraft/robotics/boards/BoardRobotBomber.java @@ -1,5 +1,5 @@ /** 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.robotics.boards; @@ -19,11 +19,7 @@ import buildcraft.core.lib.inventory.filters.ArrayStackFilter; import buildcraft.core.lib.inventory.filters.IStackFilter; import buildcraft.core.lib.utils.IBlockFilter; -import buildcraft.robotics.ai.AIRobotGotoBlock; -import buildcraft.robotics.ai.AIRobotGotoSleep; -import buildcraft.robotics.ai.AIRobotGotoStationAndLoad; -import buildcraft.robotics.ai.AIRobotLoad; -import buildcraft.robotics.ai.AIRobotSearchRandomGroundBlock; +import buildcraft.robotics.ai.*; public class BoardRobotBomber extends RedstoneBoardRobot { diff --git a/common/buildcraft/robotics/boards/BoardRobotBuilder.java b/common/buildcraft/robotics/boards/BoardRobotBuilder.java index 6ab85f28be..9b16477db0 100644 --- a/common/buildcraft/robotics/boards/BoardRobotBuilder.java +++ b/common/buildcraft/robotics/boards/BoardRobotBuilder.java @@ -1,5 +1,5 @@ /** 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.robotics.boards; @@ -8,6 +8,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.WorldSettings; import buildcraft.api.boards.RedstoneBoardRobot; import buildcraft.api.boards.RedstoneBoardRobotNBT; @@ -19,11 +20,7 @@ import buildcraft.core.builders.BuildingSlot; import buildcraft.core.lib.inventory.filters.ArrayStackFilter; import buildcraft.core.lib.utils.Utils; -import buildcraft.robotics.ai.AIRobotDisposeItems; -import buildcraft.robotics.ai.AIRobotGotoBlock; -import buildcraft.robotics.ai.AIRobotGotoSleep; -import buildcraft.robotics.ai.AIRobotGotoStationAndLoad; -import buildcraft.robotics.ai.AIRobotRecharge; +import buildcraft.robotics.ai.*; public class BoardRobotBuilder extends RedstoneBoardRobot { @@ -85,7 +82,11 @@ public void update() { startDelegateAI(new AIRobotDisposeItems(robot)); } - requirementsToLookFor = currentBuildingSlot.getRequirements(markerToBuild.getContext()); + if (robot.worldObj.getWorldInfo().getGameType() != WorldSettings.GameType.CREATIVE) { + requirementsToLookFor = currentBuildingSlot.getRequirements(markerToBuild.getContext()); + } else { + requirementsToLookFor = new LinkedList(); + } if (requirementsToLookFor == null) { launchingDelay = 40; diff --git a/common/buildcraft/robotics/boards/BoardRobotButcher.java b/common/buildcraft/robotics/boards/BoardRobotButcher.java index 722412a172..0838a63ef5 100755 --- a/common/buildcraft/robotics/boards/BoardRobotButcher.java +++ b/common/buildcraft/robotics/boards/BoardRobotButcher.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.robotics.boards; import net.minecraft.entity.Entity; diff --git a/common/buildcraft/robotics/boards/BoardRobotCarrier.java b/common/buildcraft/robotics/boards/BoardRobotCarrier.java index fb7128538c..6f1e63c077 100755 --- a/common/buildcraft/robotics/boards/BoardRobotCarrier.java +++ b/common/buildcraft/robotics/boards/BoardRobotCarrier.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.robotics.boards; import buildcraft.api.boards.RedstoneBoardRobot; diff --git a/common/buildcraft/robotics/boards/BoardRobotDelivery.java b/common/buildcraft/robotics/boards/BoardRobotDelivery.java index 841611e808..f49854ce03 100755 --- a/common/buildcraft/robotics/boards/BoardRobotDelivery.java +++ b/common/buildcraft/robotics/boards/BoardRobotDelivery.java @@ -1,5 +1,5 @@ /** 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.robotics.boards; @@ -7,19 +7,16 @@ import java.util.ArrayList; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import buildcraft.api.boards.RedstoneBoardRobot; import buildcraft.api.boards.RedstoneBoardRobotNBT; import buildcraft.api.robots.AIRobot; import buildcraft.api.robots.EntityRobotBase; -import buildcraft.api.robots.StackRequest; import buildcraft.core.lib.inventory.StackHelper; import buildcraft.core.lib.inventory.filters.IStackFilter; -import buildcraft.robotics.ai.AIRobotDeliverRequested; -import buildcraft.robotics.ai.AIRobotDisposeItems; -import buildcraft.robotics.ai.AIRobotGotoSleep; -import buildcraft.robotics.ai.AIRobotGotoStationAndLoad; -import buildcraft.robotics.ai.AIRobotSearchStackRequest; +import buildcraft.robotics.StackRequest; +import buildcraft.robotics.ai.*; import buildcraft.robotics.statements.ActionRobotFilter; public class BoardRobotDelivery extends RedstoneBoardRobot { @@ -40,9 +37,6 @@ public RedstoneBoardRobotNBT getNBTHandler() { @Override public void update() { if (robot.containsItems()) { - // Always makes sure that when starting a craft, the inventory is - // clean. - startDelegateAI(new AIRobotDisposeItems(robot)); return; } @@ -50,7 +44,12 @@ public void update() { if (currentRequest == null) { startDelegateAI(new AIRobotSearchStackRequest(robot, ActionRobotFilter.getGateFilter(robot.getLinkedStation()), deliveryBlacklist)); } else { - startDelegateAI(new AIRobotGotoStationAndLoad(robot, new ReqFilter(), 1)); + startDelegateAI(new AIRobotGotoStationAndLoad(robot, new IStackFilter() { + @Override + public boolean matches(ItemStack stack) { + return currentRequest != null && StackHelper.isMatchingItemOrList(stack, currentRequest.getStack()); + } + }, currentRequest.getStack().stackSize)); } } @@ -63,33 +62,51 @@ public void delegateAIEnded(AIRobot ai) { } else { currentRequest = ((AIRobotSearchStackRequest) ai).request; - if (!currentRequest.station.take(robot)) { - currentRequest = null; + if (!currentRequest.getStation(robot.worldObj).take(robot)) { + releaseCurrentRequest(); } } } else if (ai instanceof AIRobotGotoStationAndLoad) { if (!ai.success()) { - deliveryBlacklist.add(currentRequest.stack); - robot.releaseResources(); - currentRequest = null; + deliveryBlacklist.add(currentRequest.getStack()); + releaseCurrentRequest(); } else { startDelegateAI(new AIRobotDeliverRequested(robot, currentRequest)); } } else if (ai instanceof AIRobotDeliverRequested) { - robot.releaseResources(); + releaseCurrentRequest(); + } + } + + private void releaseCurrentRequest() { + if (currentRequest != null) { + robot.getRegistry().release(currentRequest.getResourceId(robot.worldObj)); + currentRequest.getStation(robot.worldObj).release(robot); currentRequest = null; } } - private class ReqFilter implements IStackFilter { + @Override + public boolean canLoadFromNBT() { + return true; + } - @Override - public boolean matches(ItemStack stack) { - if (currentRequest == null) { - return false; - } else { - return StackHelper.isMatchingItemOrList(stack, currentRequest.stack); - } + @Override + public void writeSelfToNBT(NBTTagCompound nbt) { + super.writeSelfToNBT(nbt); + + if (currentRequest != null) { + NBTTagCompound requestNBT = new NBTTagCompound(); + currentRequest.writeToNBT(requestNBT); + nbt.setTag("currentRequest", requestNBT); + } + } + + @Override + public void loadSelfFromNBT(NBTTagCompound nbt) { + super.loadSelfFromNBT(nbt); + if (nbt.hasKey("currentRequest")) { + currentRequest = StackRequest.loadFromNBT(nbt.getCompoundTag("currentRequest")); } } } diff --git a/common/buildcraft/robotics/boards/BoardRobotFarmer.java b/common/buildcraft/robotics/boards/BoardRobotFarmer.java index c4e606e7e4..6d643c1d43 100644 --- a/common/buildcraft/robotics/boards/BoardRobotFarmer.java +++ b/common/buildcraft/robotics/boards/BoardRobotFarmer.java @@ -1,5 +1,5 @@ /** 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.robotics.boards; diff --git a/common/buildcraft/robotics/boards/BoardRobotFluidCarrier.java b/common/buildcraft/robotics/boards/BoardRobotFluidCarrier.java index 552625da1d..abd3c71b77 100755 --- a/common/buildcraft/robotics/boards/BoardRobotFluidCarrier.java +++ b/common/buildcraft/robotics/boards/BoardRobotFluidCarrier.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.robotics.boards; import net.minecraftforge.fluids.FluidStack; diff --git a/common/buildcraft/robotics/boards/BoardRobotGenericBreakBlock.java b/common/buildcraft/robotics/boards/BoardRobotGenericBreakBlock.java index 5ded78950b..f1486c02d2 100644 --- a/common/buildcraft/robotics/boards/BoardRobotGenericBreakBlock.java +++ b/common/buildcraft/robotics/boards/BoardRobotGenericBreakBlock.java @@ -1,5 +1,5 @@ /** 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.robotics.boards; @@ -11,6 +11,8 @@ import buildcraft.core.lib.inventory.filters.IStackFilter; import buildcraft.robotics.ai.AIRobotBreak; import buildcraft.robotics.ai.AIRobotFetchAndEquipItemStack; +import buildcraft.robotics.ai.AIRobotGotoSleep; +import buildcraft.robotics.ai.AIRobotGotoStationAndUnload; public abstract class BoardRobotGenericBreakBlock extends BoardRobotGenericSearchBlock { @@ -26,9 +28,11 @@ public final void update() { startDelegateAI(new AIRobotFetchAndEquipItemStack(robot, new IStackFilter() { @Override public boolean matches(ItemStack stack) { - return isExpectedTool(stack); + return stack != null && (stack.getItemDamage() < stack.getMaxDamage()) && isExpectedTool(stack); } })); + } else if (robot.getHeldItem() != null && robot.getHeldItem().getItemDamage() >= robot.getHeldItem().getMaxDamage()) { + startDelegateAI(new AIRobotGotoStationAndUnload(robot)); } else if (blockFound() != null) { startDelegateAI(new AIRobotBreak(robot, blockFound())); } else { @@ -38,7 +42,11 @@ public boolean matches(ItemStack stack) { @Override public void delegateAIEnded(AIRobot ai) { - if (ai instanceof AIRobotBreak) { + if (ai instanceof AIRobotFetchAndEquipItemStack || ai instanceof AIRobotGotoStationAndUnload) { + if (!ai.success()) { + startDelegateAI(new AIRobotGotoSleep(robot)); + } + } else if (ai instanceof AIRobotBreak) { releaseBlockFound(ai.success()); } super.delegateAIEnded(ai); diff --git a/common/buildcraft/robotics/boards/BoardRobotHarvester.java b/common/buildcraft/robotics/boards/BoardRobotHarvester.java index 3518aa5da7..053d434398 100755 --- a/common/buildcraft/robotics/boards/BoardRobotHarvester.java +++ b/common/buildcraft/robotics/boards/BoardRobotHarvester.java @@ -1,5 +1,5 @@ /** 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.robotics.boards; diff --git a/common/buildcraft/robotics/boards/BoardRobotKnight.java b/common/buildcraft/robotics/boards/BoardRobotKnight.java index f8cdd70981..b3a604280b 100755 --- a/common/buildcraft/robotics/boards/BoardRobotKnight.java +++ b/common/buildcraft/robotics/boards/BoardRobotKnight.java @@ -1,5 +1,5 @@ /** 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.robotics.boards; diff --git a/common/buildcraft/robotics/boards/BoardRobotLeaveCutter.java b/common/buildcraft/robotics/boards/BoardRobotLeaveCutter.java index b0277ab7d6..98236b1466 100755 --- a/common/buildcraft/robotics/boards/BoardRobotLeaveCutter.java +++ b/common/buildcraft/robotics/boards/BoardRobotLeaveCutter.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.robotics.boards; import net.minecraft.item.ItemShears; diff --git a/common/buildcraft/robotics/boards/BoardRobotLumberjack.java b/common/buildcraft/robotics/boards/BoardRobotLumberjack.java index 33a2e6d62d..0075d5dba5 100755 --- a/common/buildcraft/robotics/boards/BoardRobotLumberjack.java +++ b/common/buildcraft/robotics/boards/BoardRobotLumberjack.java @@ -1,5 +1,5 @@ /** 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.robotics.boards; diff --git a/common/buildcraft/robotics/boards/BoardRobotMiner.java b/common/buildcraft/robotics/boards/BoardRobotMiner.java index 9e9ddadca0..78e86c5aa4 100755 --- a/common/buildcraft/robotics/boards/BoardRobotMiner.java +++ b/common/buildcraft/robotics/boards/BoardRobotMiner.java @@ -1,10 +1,9 @@ /** 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.robotics.boards; -import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockPos; import net.minecraft.world.World; @@ -29,17 +28,17 @@ public void delegateAIEnded(AIRobot ai) { super.delegateAIEnded(ai); if (ai instanceof AIRobotFetchAndEquipItemStack) { - detectHarvestLevel(); + if (ai.success()) { + detectHarvestLevel(); + } } } private void detectHarvestLevel() { ItemStack stack = robot.getHeldItem(); - if (stack != null && stack.getItem().getToolClasses(stack).contains("pickaxe")) { - ItemPickaxe pickaxe = (ItemPickaxe) stack.getItem(); - - harvestLevel = pickaxe.getHarvestLevel(stack, "pickaxe"); + if (stack != null && stack.getItem() != null && stack.getItem().getToolClasses(stack).contains("pickaxe")) { + harvestLevel = stack.getItem().getHarvestLevel(stack, "pickaxe"); } } diff --git a/common/buildcraft/robotics/boards/BoardRobotPicker.java b/common/buildcraft/robotics/boards/BoardRobotPicker.java index 961563e736..fa163b8bfe 100755 --- a/common/buildcraft/robotics/boards/BoardRobotPicker.java +++ b/common/buildcraft/robotics/boards/BoardRobotPicker.java @@ -1,5 +1,5 @@ /** 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.robotics.boards; @@ -17,16 +17,23 @@ import buildcraft.robotics.statements.ActionRobotFilter; public class BoardRobotPicker extends RedstoneBoardRobot { - // TODO: Clean this when world unloaded public static Set targettedItems = new HashSet(); public BoardRobotPicker(EntityRobotBase iRobot) { super(iRobot); } + public static void onServerStart() { + targettedItems.clear(); + } + + private void fetchNewItem() { + startDelegateAI(new AIRobotFetchItem(robot, 250, ActionRobotFilter.getGateFilter(robot.getLinkedStation()), robot.getZoneToWork())); + } + @Override public void update() { - startDelegateAI(new AIRobotFetchItem(robot, 250, ActionRobotFilter.getGateFilter(robot.getLinkedStation()), robot.getZoneToWork())); + fetchNewItem(); } @Override @@ -35,7 +42,7 @@ public void delegateAIEnded(AIRobot ai) { if (ai.success()) { // if we find an item - that may have been cancelled. // let's try to get another one - startDelegateAI(new AIRobotFetchItem(robot, 250, ActionRobotFilter.getGateFilter(robot.getLinkedStation()), robot.getZoneToWork())); + fetchNewItem(); } else if (robot.containsItems()) { startDelegateAI(new AIRobotGotoStationAndUnload(robot)); } else { diff --git a/common/buildcraft/robotics/boards/BoardRobotPlanter.java b/common/buildcraft/robotics/boards/BoardRobotPlanter.java index d1dae3de17..3bb03b8050 100644 --- a/common/buildcraft/robotics/boards/BoardRobotPlanter.java +++ b/common/buildcraft/robotics/boards/BoardRobotPlanter.java @@ -1,5 +1,5 @@ /** 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.robotics.boards; @@ -11,6 +11,7 @@ import buildcraft.api.boards.RedstoneBoardRobot; import buildcraft.api.boards.RedstoneBoardRobotNBT; +import buildcraft.api.core.BuildCraftAPI; import buildcraft.api.crops.CropManager; import buildcraft.api.robots.AIRobot; import buildcraft.api.robots.EntityRobotBase; @@ -55,7 +56,8 @@ public void update() { IBlockFilter blockFilter = new IBlockFilter() { @Override public boolean matches(World world, BlockPos pos) { - return isPlantable(itemStack, world, pos) && !robot.getRegistry().isTaken(new ResourceIdBlock(pos)); + return !BuildCraftAPI.getWorldProperty("replaceable").get(world, pos) && isPlantable(itemStack, world, pos) && !robot + .getRegistry().isTaken(new ResourceIdBlock(pos)); } }; startDelegateAI(new AIRobotSearchAndGotoBlock(robot, true, blockFilter, 1)); @@ -74,7 +76,7 @@ public void delegateAIEnded(AIRobot ai) { } else if (ai instanceof AIRobotPlant) { releaseBlockFound(); } else if (ai instanceof AIRobotFetchAndEquipItemStack) { - if (robot.getHeldItem() == null) { + if (!ai.success()) { startDelegateAI(new AIRobotGotoSleep(robot)); } } diff --git a/common/buildcraft/robotics/boards/BoardRobotPump.java b/common/buildcraft/robotics/boards/BoardRobotPump.java index 6f47bfda66..43d3f28621 100644 --- a/common/buildcraft/robotics/boards/BoardRobotPump.java +++ b/common/buildcraft/robotics/boards/BoardRobotPump.java @@ -1,12 +1,14 @@ /** 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.robotics.boards; import net.minecraft.block.Block; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.BlockPos; import net.minecraft.world.World; + import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; @@ -21,6 +23,7 @@ import buildcraft.core.lib.inventory.filters.IFluidFilter; import buildcraft.core.lib.inventory.filters.PassThroughFluidFilter; import buildcraft.core.lib.utils.IBlockFilter; +import buildcraft.core.lib.utils.NBTUtils; import buildcraft.robotics.ai.AIRobotGotoSleep; import buildcraft.robotics.ai.AIRobotGotoStationAndUnloadFluids; import buildcraft.robotics.ai.AIRobotPumpBlock; @@ -74,8 +77,9 @@ public void delegateAIEnded(AIRobot ai) { } else { startDelegateAI(new AIRobotGotoSleep(robot)); } - } else if (ai instanceof AIRobotGotoStationAndUnloadFluids) { + } else if (ai instanceof AIRobotPumpBlock) { releaseBlockFound(); + } else if (ai instanceof AIRobotGotoStationAndUnloadFluids) { if (!ai.success()) { startDelegateAI(new AIRobotGotoSleep(robot)); @@ -112,4 +116,25 @@ private boolean matchesGateFilter(World world, BlockPos pos) { return fluidFilter.matches(fluid); } + @Override + public boolean canLoadFromNBT() { + return true; + } + + @Override + public void writeSelfToNBT(NBTTagCompound nbt) { + super.writeSelfToNBT(nbt); + if (blockFound != null) { + nbt.setTag("blockFound", NBTUtils.writeBlockPos(blockFound)); + } + } + + @Override + public void loadSelfFromNBT(NBTTagCompound nbt) { + super.loadSelfFromNBT(nbt); + + if (nbt.hasKey("blockFound")) { + blockFound = NBTUtils.readBlockPos(nbt.getTag("blockFound")); + } + } } diff --git a/common/buildcraft/robotics/boards/BoardRobotShovelman.java b/common/buildcraft/robotics/boards/BoardRobotShovelman.java index 7084aec22d..3366c60639 100755 --- a/common/buildcraft/robotics/boards/BoardRobotShovelman.java +++ b/common/buildcraft/robotics/boards/BoardRobotShovelman.java @@ -1,5 +1,5 @@ /** 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.robotics.boards; diff --git a/common/buildcraft/robotics/boards/BoardRobotStripes.java b/common/buildcraft/robotics/boards/BoardRobotStripes.java index 7bd24f5c07..33bda6f1b2 100644 --- a/common/buildcraft/robotics/boards/BoardRobotStripes.java +++ b/common/buildcraft/robotics/boards/BoardRobotStripes.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.robotics.boards; import net.minecraft.item.ItemStack; diff --git a/common/buildcraft/robotics/gui/ContainerRequester.java b/common/buildcraft/robotics/gui/ContainerRequester.java index 5fd5ca364d..2b709f2389 100755 --- a/common/buildcraft/robotics/gui/ContainerRequester.java +++ b/common/buildcraft/robotics/gui/ContainerRequester.java @@ -1,5 +1,5 @@ /** 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.robotics.gui; @@ -7,6 +7,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; + import net.minecraftforge.fml.relauncher.Side; import buildcraft.BuildCraftCore; @@ -65,7 +66,7 @@ public void receiveCommand(String command, Side side, Object sender, ByteBuf str final ItemStack[] stacks = new ItemStack[TileRequester.NB_ITEMS]; for (int i = 0; i < TileRequester.NB_ITEMS; ++i) { - stacks[i] = requester.getRequest(i); + stacks[i] = requester.getRequestTemplate(i); } BuildCraftCore.instance.sendToPlayer((EntityPlayer) sender, new PacketCommand(this, "receiveRequestList", new CommandWriter() { diff --git a/common/buildcraft/robotics/gui/ContainerZonePlan.java b/common/buildcraft/robotics/gui/ContainerZonePlan.java index ebac6dc971..5283ad3263 100755 --- a/common/buildcraft/robotics/gui/ContainerZonePlan.java +++ b/common/buildcraft/robotics/gui/ContainerZonePlan.java @@ -1,5 +1,5 @@ /** 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.robotics.gui; @@ -7,11 +7,11 @@ import net.minecraft.block.material.MapColor; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Slot; + import net.minecraftforge.fml.relauncher.Side; import buildcraft.BuildCraftCore; import buildcraft.BuildCraftRobotics; -import buildcraft.core.ZonePlan; import buildcraft.core.lib.gui.BuildCraftContainer; import buildcraft.core.lib.gui.slots.SlotOutput; import buildcraft.core.lib.network.command.CommandWriter; @@ -20,10 +20,13 @@ import buildcraft.core.lib.render.DynamicTextureBC; import buildcraft.core.lib.utils.NetworkUtils; import buildcraft.robotics.TileZonePlan; +import buildcraft.robotics.ZonePlan; +import buildcraft.robotics.map.MapWorld; import io.netty.buffer.ByteBuf; public class ContainerZonePlan extends BuildCraftContainer implements ICommandReceiver { + private static final int MAX_PACKET_LENGTH = 30000; public DynamicTextureBC mapTexture; public ZonePlan currentAreaSelection; @@ -87,9 +90,10 @@ public void receiveCommand(String command, Side side, Object sender, ByteBuf str gui.refreshSelectedArea(); } else if ("receiveImage".equals(command)) { int size = stream.readUnsignedMedium(); + int pos = stream.readUnsignedMedium(); - for (int i = 0; i < size; ++i) { - mapTexture.colorMap[i] = 0xFF000000 | MapColor.mapColorArray[stream.readUnsignedByte()].colorValue; + for (int i = 0; i < Math.min(size - pos, MAX_PACKET_LENGTH); ++i) { + mapTexture.colorMap[pos + i] = 0xFF000000 | MapColor.mapColorArray[stream.readUnsignedByte()].colorValue; } } } else if (side.isServer()) { @@ -106,7 +110,7 @@ public void write(ByteBuf data) { plan.readData(stream); map.setArea(index, plan); } else if ("computeMap".equals(command)) { - computeMap(stream.readInt(), stream.readInt(), stream.readUnsignedShort(), stream.readUnsignedShort(), stream.readUnsignedByte(), + computeMap(stream.readInt(), stream.readInt(), stream.readUnsignedShort(), stream.readUnsignedShort(), stream.readFloat(), (EntityPlayer) sender); } else if ("setName".equals(command)) { map.mapName = NetworkUtils.readUTF(stream); @@ -114,18 +118,21 @@ public void write(ByteBuf data) { } } - private void computeMap(int cx, int cz, int width, int height, int blocksPerPixel, EntityPlayer player) { + private void computeMap(int cx, int cz, int width, int height, float blocksPerPixel, EntityPlayer player) { final byte[] textureData = new byte[width * height]; - int startX = cx - width * blocksPerPixel / 2; - int startZ = cz - height * blocksPerPixel / 2; + MapWorld w = BuildCraftRobotics.manager.getWorld(map.getWorld()); + int startX = Math.round(cx - width * blocksPerPixel / 2); + int startZ = Math.round(cz - height * blocksPerPixel / 2); + int mapStartX = map.chunkStartX << 4; + int mapStartZ = map.chunkStartZ << 4; for (int i = 0; i < width; ++i) { for (int j = 0; j < height; ++j) { - int x = startX + i * blocksPerPixel; - int z = startZ + j * blocksPerPixel; - int ix = x - (map.chunkStartX << 4); - int iz = z - (map.chunkStartZ << 4); + int x = Math.round(startX + i * blocksPerPixel); + int z = Math.round(startZ + j * blocksPerPixel); + int ix = x - mapStartX; + int iz = z - mapStartZ; if (ix >= 0 && iz >= 0 && ix < TileZonePlan.RESOLUTION && iz < TileZonePlan.RESOLUTION) { textureData[i + j * width] = (byte) BuildCraftRobotics.manager.getWorld(map.getWorld()).getColor(x, z); @@ -133,11 +140,17 @@ private void computeMap(int cx, int cz, int width, int height, int blocksPerPixe } } - BuildCraftCore.instance.sendToPlayer(player, new PacketCommand(this, "receiveImage", new CommandWriter() { - public void write(ByteBuf data) { - data.writeMedium(textureData.length); - data.writeBytes(textureData); - } - })); + final int len = MAX_PACKET_LENGTH; + + for (int i = 0; i < textureData.length; i += len) { + final int pos = i; + BuildCraftCore.instance.sendToPlayer(player, new PacketCommand(this, "receiveImage", new CommandWriter() { + public void write(ByteBuf data) { + data.writeMedium(textureData.length); + data.writeMedium(pos); + data.writeBytes(textureData, pos, Math.min(textureData.length - pos, len)); + } + })); + } } } diff --git a/common/buildcraft/robotics/gui/GuiRequester.java b/common/buildcraft/robotics/gui/GuiRequester.java index 9e837b435f..e030a3f643 100755 --- a/common/buildcraft/robotics/gui/GuiRequester.java +++ b/common/buildcraft/robotics/gui/GuiRequester.java @@ -1,11 +1,10 @@ /** 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.robotics.gui; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; @@ -19,11 +18,8 @@ public class GuiRequester extends GuiAdvancedInterface { private TileRequester requester; - private IInventory playerInventory; - private static class RequestSlot extends AdvancedSlot { - private ItemStack item; private int index; public RequestSlot(GuiAdvancedInterface gui, int iIndex, int x, int y) { @@ -35,12 +31,6 @@ public RequestSlot(GuiAdvancedInterface gui, int iIndex, int x, int y) { public void setItem(ItemStack itemStack) { TileRequester requester = ((GuiRequester) gui).requester; - if (itemStack != null) { - item = itemStack.copy(); - } else { - item = null; - } - requester.setRequest(index, itemStack); ((GuiRequester) gui).getContainer().getRequestList(); } @@ -63,7 +53,6 @@ public GuiRequester(EntityPlayer player, TileRequester iRequester) { ySize = 181; requester = iRequester; - playerInventory = player.inventory; for (int x = 0; x < 4; ++x) { for (int y = 0; y < 5; ++y) { @@ -76,7 +65,7 @@ public GuiRequester(EntityPlayer player, TileRequester iRequester) { protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { super.drawGuiContainerBackgroundLayer(f, x, y); - drawBackgroundSlots(); + drawBackgroundSlots(x, y); } @Override diff --git a/common/buildcraft/robotics/gui/GuiZonePlan.java b/common/buildcraft/robotics/gui/GuiZonePlan.java index 9c7f9a271e..7957502225 100755 --- a/common/buildcraft/robotics/gui/GuiZonePlan.java +++ b/common/buildcraft/robotics/gui/GuiZonePlan.java @@ -1,5 +1,5 @@ /** 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.robotics.gui; @@ -22,7 +22,6 @@ import buildcraft.BuildCraftCore; import buildcraft.api.core.EnumColor; import buildcraft.core.DefaultProps; -import buildcraft.core.ZonePlan; import buildcraft.core.lib.gui.AdvancedSlot; import buildcraft.core.lib.gui.GuiAdvancedInterface; import buildcraft.core.lib.gui.buttons.GuiBetterButton; @@ -35,6 +34,7 @@ import buildcraft.core.lib.utils.NetworkUtils; import buildcraft.core.lib.utils.StringUtils; import buildcraft.robotics.TileZonePlan; +import buildcraft.robotics.ZonePlan; import io.netty.buffer.ByteBuf; @@ -60,7 +60,7 @@ public class GuiZonePlan extends GuiAdvancedInterface { private int mapXMin = 0; private int mapYMin = 0; - private int zoomLevel = 1; + private float blocksPerPixel = 1.0f; private int cx; private int cz; @@ -160,7 +160,7 @@ public void write(ByteBuf data) { data.writeInt(cz); data.writeShort(getContainer().mapTexture.width); data.writeShort(getContainer().mapTexture.height); - data.writeByte(zoomLevel); + data.writeFloat(blocksPerPixel); } })); } @@ -212,7 +212,7 @@ protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { } if (!isFullscreen()) { - drawBackgroundSlots(); + drawBackgroundSlots(x, y); bindTexture(texture); @@ -232,15 +232,11 @@ protected void drawGuiContainerForegroundLayer(int par1, int par2) { @Override protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { - super.mouseClicked(mouseX, mouseY, mouseButton); - - textField.mouseClicked(mouseX - guiLeft, mouseY - guiTop, mouseButton); + int blocksX = Math.round((mouseX - mapXMin) * blocksPerPixel); + int blocksZ = Math.round((mouseY - mapYMin) * blocksPerPixel); - int blocksX = (mouseX - mapXMin) * zoomLevel; - int blocksZ = (mouseY - mapYMin) * zoomLevel; - - int blockStartX = cx - mapWidth * zoomLevel / 2; - int blockStartZ = cz - mapHeight * zoomLevel / 2; + int blockStartX = Math.round(cx - mapWidth * blocksPerPixel / 2); + int blockStartZ = Math.round(cz - mapHeight * blocksPerPixel / 2); boolean clickOnMap = mouseX >= mapXMin && mouseX <= mapXMin + getContainer().mapTexture.width && mouseY >= mapYMin && mouseY <= mapYMin + getContainer().mapTexture.height; @@ -252,22 +248,27 @@ protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOEx uploadMap(); refreshSelectedArea(); + return; } else { inSelection = true; selX1 = mouseX; selY1 = mouseY; selX2 = 0; selY2 = 0; + return; } - } else { - AdvancedSlot slot = getSlotAtLocation(mouseX, mouseY); + } - if (slot instanceof AreaSlot) { - colorSelected = (AreaSlot) slot; + super.mouseClicked(mouseX, mouseY, mouseButton); + textField.mouseClicked(mouseX - guiLeft, mouseY - guiTop, mouseButton); - newSelection.setColor(0, 0, colorSelected.color.getDarkHex(), alpha); - getContainer().loadArea(colorSelected.color.ordinal()); - } + AdvancedSlot slot = getSlotAtLocation(mouseX, mouseY); + + if (slot instanceof AreaSlot) { + colorSelected = (AreaSlot) slot; + + newSelection.setColor(0, 0, colorSelected.color.getDarkHex(), alpha); + getContainer().loadArea(colorSelected.color.ordinal()); } } @@ -290,21 +291,21 @@ protected void mouseReleased(int mouseX, int mouseY, int eventType) { if (eventType != -1 && inSelection) { boolean val = tool.displayString.equals("+"); - int blockStartX = cx - mapWidth * zoomLevel / 2; - int blockStartZ = cz - mapHeight * zoomLevel / 2; + int blockStartX = Math.round(cx - mapWidth * blocksPerPixel / 2); + int blockStartZ = Math.round(cz - mapHeight * blocksPerPixel / 2); int x1 = selX1 < selX2 ? selX1 : selX2; int x2 = selX1 < selX2 ? selX2 : selX1; int y1 = selY1 < selY2 ? selY1 : selY2; int y2 = selY1 < selY2 ? selY2 : selY1; - int lengthX = (x2 - x1) * zoomLevel; - int lengthY = (y2 - y1) * zoomLevel; + int lengthX = Math.round((x2 - x1) * blocksPerPixel); + int lengthY = Math.round((y2 - y1) * blocksPerPixel); for (int i = 0; i <= lengthX; ++i) { for (int j = 0; j <= lengthY; ++j) { - int x = blockStartX + (x1 - mapXMin) * zoomLevel + i; - int z = blockStartZ + (y1 - mapYMin) * zoomLevel + j; + int x = Math.round(blockStartX + (x1 - mapXMin) * blocksPerPixel) + i; + int z = Math.round(blockStartZ + (y1 - mapYMin) * blocksPerPixel) + j; getContainer().currentAreaSelection.set(x, z, val); } @@ -317,6 +318,10 @@ protected void mouseReleased(int mouseX, int mouseY, int eventType) { } private void toFullscreen() { + if (blocksPerPixel > 4.0f) { + blocksPerPixel = 4.0f; + } + mapWidth = this.mc.displayWidth; mapHeight = this.mc.displayHeight; @@ -326,8 +331,8 @@ private void toFullscreen() { uploadMap(); refreshSelectedArea(); - container.inventorySlots = new LinkedList(); - buttonList = new LinkedList(); + container.inventorySlots = new LinkedList(); + buttonList = new LinkedList(); } private void toWindowed() { @@ -344,6 +349,30 @@ private void toWindowed() { buttonList = savedButtonList; } + private boolean incBlocksPerPixel() { + if (blocksPerPixel > 0.125f) { + if (blocksPerPixel <= 1.0f) { + blocksPerPixel /= 2; + } else { + blocksPerPixel--; + } + return true; + } + return false; + } + + private boolean decBlocksPerPixel() { + if ((isFullscreen() && blocksPerPixel < 4.0f) || (!isFullscreen() && blocksPerPixel < 8.0f)) { + if (blocksPerPixel >= 1.0f) { + blocksPerPixel++; + } else { + blocksPerPixel *= 2; + } + return true; + } + return false; + } + @Override protected void keyTyped(char carac, int val) throws IOException { if (!isFullscreen() && textField.isFocused()) { @@ -362,12 +391,10 @@ public void write(ByteBuf data) { } else if (val == Keyboard.KEY_F5) { uploadMap(); refreshSelectedArea(); - } else if (carac == '+' && zoomLevel > 1) { - zoomLevel--; + } else if (carac == '+' && incBlocksPerPixel()) { uploadMap(); refreshSelectedArea(); - } else if (carac == '-' && zoomLevel < 6) { - zoomLevel++; + } else if (carac == '-' && decBlocksPerPixel()) { uploadMap(); refreshSelectedArea(); } else if (carac == 'm' || (carac == 27 && isFullscreen())) { @@ -388,17 +415,18 @@ public void refreshSelectedArea() { for (int i = 0; i < currentSelection.width; ++i) { for (int j = 0; j < currentSelection.height; ++j) { - int blockStartX = cx - mapWidth * zoomLevel / 2; - int blockStartZ = cz - mapHeight * zoomLevel / 2; + int blockStartX = Math.round(cx - mapWidth * blocksPerPixel / 2); + int blockStartZ = Math.round(cz - mapHeight * blocksPerPixel / 2); + int c = (int) Math.ceil(blocksPerPixel); double r = 0; double g = 0; double b = 0; - for (int stepi = 0; stepi < zoomLevel; ++stepi) { - for (int stepj = 0; stepj < zoomLevel; ++stepj) { - int x = blockStartX + i * zoomLevel + stepi; - int z = blockStartZ + j * zoomLevel + stepj; + for (int stepi = 0; stepi < c; ++stepi) { + for (int stepj = 0; stepj < c; ++stepj) { + int x = Math.round(blockStartX + i * blocksPerPixel) + stepi; + int z = Math.round(blockStartZ + j * blocksPerPixel) + stepj; if (getContainer().currentAreaSelection.get(x, z)) { r += rAdd; @@ -408,9 +436,9 @@ public void refreshSelectedArea() { } } - r /= zoomLevel * zoomLevel; - g /= zoomLevel * zoomLevel; - b /= zoomLevel * zoomLevel; + r /= c * c; + g /= c * c; + b /= c * c; if (r != 0) { currentSelection.setColori(i, j, (int) r, (int) g, (int) b, (int) (alpha * 255.0F)); @@ -454,12 +482,10 @@ public void handleMouseInput() throws IOException { + getContainer().mapTexture.height) { int wheel = Mouse.getEventDWheel(); if (wheel != 0) { - if (zoomLevel < 6 && wheel > 0) { - zoomLevel++; + if (wheel > 0 && decBlocksPerPixel()) { uploadMap(); refreshSelectedArea(); - } else if (zoomLevel > 1 && wheel < 0) { - zoomLevel--; + } else if (wheel < 0 && incBlocksPerPixel()) { uploadMap(); refreshSelectedArea(); } diff --git a/common/buildcraft/robotics/map/MapChunk.java b/common/buildcraft/robotics/map/MapChunk.java index ab36bb624e..690ec32614 100644 --- a/common/buildcraft/robotics/map/MapChunk.java +++ b/common/buildcraft/robotics/map/MapChunk.java @@ -1,5 +1,6 @@ package buildcraft.robotics.map; +import net.minecraft.block.Block; import net.minecraft.block.material.MapColor; import net.minecraft.block.state.IBlockState; import net.minecraft.nbt.NBTTagCompound; @@ -40,15 +41,24 @@ public void update(Chunk chunk) { for (int bz = 0; bz < 16; bz++) { for (int bx = 0; bx < 16; bx++) { int y = chunk.getHeightValue(bx, bz); - int color; + int color = MapColor.airColor.colorIndex; - IBlockState state = chunk.getBlockState(new BlockPos(bx, y, bz)); + if (y < 0) { + y = 255; + } - while ((color = state.getBlock().getMapColor(state).colorIndex) == MapColor.airColor.colorIndex) { - y--; - if (y < 0) { + Block b; + IBlockState state; + + while (y >= 0) { + state = chunk.getBlockState(new BlockPos(bx, y, bz)); + b = state.getBlock(); + + color = b.getMapColor(state) != null ? b.getMapColor(state).colorIndex : MapColor.airColor.colorIndex; + if (color != MapColor.airColor.colorIndex) { break; } + y--; } data[(bz << 4) | bx] = (byte) color; diff --git a/common/buildcraft/robotics/map/MapManager.java b/common/buildcraft/robotics/map/MapManager.java index 60f831a3a0..88d22b3a0d 100644 --- a/common/buildcraft/robotics/map/MapManager.java +++ b/common/buildcraft/robotics/map/MapManager.java @@ -6,16 +6,26 @@ import com.google.common.collect.HashBiMap; import net.minecraft.world.World; +import net.minecraft.world.WorldServer; import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.IChunkProvider; +import net.minecraft.world.gen.ChunkProviderServer; + +import net.minecraftforge.common.DimensionManager; import net.minecraftforge.event.world.BlockEvent; import net.minecraftforge.event.world.ChunkEvent; +import net.minecraftforge.event.world.WorldEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; +import net.minecraftforge.fml.relauncher.Side; + +import buildcraft.core.lib.utils.Utils; public class MapManager implements Runnable { + private static final int UPDATE_DELAY = 60000; private final HashBiMap worldMap = HashBiMap.create(); private final File location; private boolean stop = false; - private long lastSaveTime; public MapManager(File location) { @@ -24,10 +34,11 @@ public MapManager(File location) { public void stop() { stop = true; + saveAllWorlds(); } public MapWorld getWorld(World world) { - if (world.isRemote) { + if (world == null || world.isRemote) { return null; } @@ -39,20 +50,66 @@ public MapWorld getWorld(World world) { return worldMap.get(world); } + private boolean doUpdate(MapWorld world, Chunk chunk) { + int x = chunk.xPosition; + int z = chunk.zPosition; + long updateTime = (new Date()).getTime() - UPDATE_DELAY; + return world.getUpdateTime(x, z) < updateTime || !world.hasChunk(x, z); + } + + private void updateChunk(World rworld, Chunk chunk, boolean force) { + MapWorld world = getWorld(rworld); + if (world != null && (force || doUpdate(world, chunk))) { + world.updateChunk(chunk); + } + } + + private void updateChunkDelayed(World rworld, Chunk chunk, boolean force, byte time) { + MapWorld world = getWorld(rworld); + if (world != null && (force || doUpdate(world, chunk))) { + world.updateChunkDelayed(chunk, time); + } + } + @SubscribeEvent - public void chunkLoaded(ChunkEvent.Load event) { - MapWorld world = getWorld(event.getChunk().getWorld()); - if (world != null) { - world.queueChunkForUpdateIfEmpty(event.getChunk().xPosition, event.getChunk().zPosition, 99999); + public void tickDelayedWorlds(TickEvent.WorldTickEvent event) { + if (event.phase == TickEvent.Phase.END && event.side == Side.SERVER) { + MapWorld w = worldMap.get(event.world); + if (w != null) { + w.tick(); + } + } + } + + @SubscribeEvent + public void worldUnloaded(WorldEvent.Unload event) { + if (worldMap.containsKey(event.world)) { + worldMap.get(event.world).save(); + synchronized (worldMap) { + worldMap.remove(event.world); + } } } + @SubscribeEvent + public void chunkLoaded(ChunkEvent.Load event) { + updateChunkDelayed(event.world, event.getChunk(), false, (byte) (40 + Utils.RANDOM.nextInt(20))); + } + + @SubscribeEvent + public void chunkUnloaded(ChunkEvent.Unload event) { + updateChunk(event.world, event.getChunk(), false); + } + @SubscribeEvent public void blockPlaced(BlockEvent.PlaceEvent placeEvent) { Chunk chunk = placeEvent.world.getChunkFromBlockCoords(placeEvent.pos); MapWorld world = getWorld(placeEvent.world); - if (world != null) { - world.queueChunkForUpdate(chunk.xPosition, chunk.zPosition, 512); + if (world != null && doUpdate(world, chunk)) { + int hv = placeEvent.world.getHeight(placeEvent.pos).getY(); + if (placeEvent.pos.getY() >= (hv - 3)) { + world.updateChunk(chunk); + } } } @@ -60,8 +117,11 @@ public void blockPlaced(BlockEvent.PlaceEvent placeEvent) { public void blockBroken(BlockEvent.BreakEvent placeEvent) { Chunk chunk = placeEvent.world.getChunkFromBlockCoords(placeEvent.pos); MapWorld world = getWorld(placeEvent.world); - if (world != null) { - world.queueChunkForUpdate(chunk.xPosition, chunk.zPosition, 512); + if (world != null && doUpdate(world, chunk)) { + int hv = placeEvent.world.getHeight(placeEvent.pos).getY(); + if (placeEvent.pos.getY() >= (hv - 3)) { + world.updateChunk(chunk); + } } } @@ -78,12 +138,6 @@ public void run() { lastSaveTime = (new Date()).getTime(); while (!stop) { - synchronized (worldMap) { - for (MapWorld world : worldMap.values()) { - world.updateChunkInQueue(); - } - } - long now = (new Date()).getTime(); if (now - lastSaveTime > 120000) { @@ -92,10 +146,27 @@ public void run() { } try { - Thread.sleep(50 * worldMap.size()); + Thread.sleep(4000); } catch (Exception e) { } } } + + public void initialize() { + for (WorldServer ws : DimensionManager.getWorlds()) { + MapWorld mw = getWorld(ws); + IChunkProvider provider = ws.getChunkProvider(); + if (provider instanceof ChunkProviderServer) { + for (Object o : ((ChunkProviderServer) provider).func_152380_a()) { + if (o != null && o instanceof Chunk) { + Chunk c = (Chunk) o; + if (!mw.hasChunk(c.xPosition, c.zPosition)) { + mw.updateChunkDelayed(c, (byte) (40 + Utils.RANDOM.nextInt(20))); + } + } + } + } + } + } } diff --git a/common/buildcraft/robotics/map/MapRegion.java b/common/buildcraft/robotics/map/MapRegion.java index 06d412d4b9..84333ad798 100644 --- a/common/buildcraft/robotics/map/MapRegion.java +++ b/common/buildcraft/robotics/map/MapRegion.java @@ -1,13 +1,14 @@ package buildcraft.robotics.map; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.IntHashMap; import buildcraft.api.core.INBTStoreable; import gnu.trove.map.hash.TIntObjectHashMap; public class MapRegion implements INBTStoreable { - private final TIntObjectHashMap chunks = new TIntObjectHashMap(); + private final IntHashMap chunks = new IntHashMap(); private final int x, z; public MapRegion(int x, int z) { @@ -24,27 +25,29 @@ public int getZ() { } public boolean hasChunk(int x, int z) { - return chunks.contains((z << 4) | x); + return chunks.containsItem((z << 4) | x); } public MapChunk getChunk(int x, int z) { int id = (z << 4) | x; - MapChunk chunk = chunks.get(id); + MapChunk chunk = (MapChunk) chunks.lookup(id); if (chunk == null) { chunk = new MapChunk(x, z); - chunks.put(id, chunk); + chunks.addKey(id, chunk); } return chunk; } @Override public void readFromNBT(NBTTagCompound tag) { - chunks.clear(); + chunks.clearMap(); + if (tag != null) { for (int i = 0; i < 256; i++) { if (tag.hasKey("r" + i)) { MapChunk chunk = new MapChunk(tag.getCompoundTag("r" + i)); - chunks.put(i, chunk); + chunks.addKey(i, chunk); + } } } } @@ -52,10 +55,12 @@ public void readFromNBT(NBTTagCompound tag) { @Override public void writeToNBT(NBTTagCompound tag) { for (int i = 0; i < 256; i++) { - MapChunk chunk = chunks.get(i); + MapChunk chunk = (MapChunk) chunks.lookup(i); if (chunk != null) { NBTTagCompound chunkNBT = new NBTTagCompound(); + synchronized (chunk) { chunk.writeToNBT(chunkNBT); + } tag.setTag("r" + i, chunkNBT); } } diff --git a/common/buildcraft/robotics/map/MapUtils.java b/common/buildcraft/robotics/map/MapUtils.java new file mode 100644 index 0000000000..00d483c916 --- /dev/null +++ b/common/buildcraft/robotics/map/MapUtils.java @@ -0,0 +1,25 @@ +package buildcraft.robotics.map; + +public final class MapUtils { + private MapUtils() { + + } + + public static long getIDFromCoords(int x, int z) { + return ((x & 0xFFFFFF) << 24) | (z & 0xFFFFFF); + } + + public static int getXFromID(long id) { + return (int) (id >> 24); + } + + public static int getZFromID(long id) { + int z = (int) (id & 0xFFFFFF); + if (z >= 0x800000) { + return -(z ^ 0xFFFFFF); + } else { + return z; + } + } + +} diff --git a/common/buildcraft/robotics/map/MapWorld.java b/common/buildcraft/robotics/map/MapWorld.java index d9cb3c3d17..e07dce525e 100644 --- a/common/buildcraft/robotics/map/MapWorld.java +++ b/common/buildcraft/robotics/map/MapWorld.java @@ -2,65 +2,34 @@ import java.io.File; import java.io.FileInputStream; -import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; -import java.util.Comparator; import java.util.Date; +import java.util.HashMap; import java.util.HashSet; -import java.util.Iterator; -import java.util.PriorityQueue; -import java.util.Queue; import java.util.Set; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.LongHashMap; import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; import buildcraft.core.lib.utils.NBTUtils; -import gnu.trove.map.hash.TLongObjectHashMap; +import gnu.trove.map.hash.TLongLongHashMap; +import gnu.trove.set.hash.TLongHashSet; public class MapWorld { - private final World world; - private final TLongObjectHashMap regionMap; - private final Set regionUpdateSet = new HashSet(); - private final Queue queuedChunks; + private final LongHashMap regionMap; + private final HashMap timeToUpdate = new HashMap(); + private final TLongLongHashMap regionUpdateTime; + private final TLongHashSet updatedChunks; private final File location; - private long lastForcedChunkLoad; - - private class QueuedXZ { - int x, z, p; - - QueuedXZ(int x, int z, int p) { - this.x = x; - this.z = z; - this.p = p; - } - - @Override - public boolean equals(Object other) { - if (other == null || !(other instanceof QueuedXZ)) { - return false; - } - return ((QueuedXZ) other).x == x && ((QueuedXZ) other).z == z; - } - - @Override - public int hashCode() { - return x * 31 + z; - } - } - public MapWorld(World world, File location) { - this.world = world; - regionMap = new TLongObjectHashMap(); - queuedChunks = new PriorityQueue(11, new Comparator() { - @Override - public int compare(QueuedXZ c1, QueuedXZ c2) { - return (c1 != null ? c1.p : 0) - (c2 != null ? c2.p : 0); - } - }); + regionMap = new LongHashMap(); + regionUpdateTime = new TLongLongHashMap(); + updatedChunks = new TLongHashSet(); String saveFolder = world.provider.getSaveFolder(); if (saveFolder == null) { @@ -74,13 +43,9 @@ public int compare(QueuedXZ c1, QueuedXZ c2) { } } - private long getXzId(int x, int z) { - return (x << 24) | z; - } - private MapRegion getRegion(int x, int z) { - long id = getXzId(x, z); - MapRegion region = regionMap.get(id); + long id = MapUtils.getIDFromCoords(x, z); + MapRegion region = (MapRegion) regionMap.getValueByKey(id); if (region == null) { region = new MapRegion(x, z); @@ -93,15 +58,16 @@ private MapRegion getRegion(int x, int z) { f.read(data); f.close(); - region.readFromNBT(NBTUtils.load(data)); - } catch (FileNotFoundException e) { - e.printStackTrace(); - } catch (IOException e) { + NBTTagCompound nbt = NBTUtils.load(data); + if (nbt != null) { + region.readFromNBT(nbt); + } + } catch (Exception e) { e.printStackTrace(); } } - regionMap.put(id, region); + regionMap.add(id, region); } return region; } @@ -116,52 +82,15 @@ public boolean hasChunk(int x, int z) { return region.hasChunk(x & 15, z & 15); } - public void queueChunkForUpdate(int x, int z, int priority) { - long id = getXzId(x, z); - queuedChunks.add(new QueuedXZ(x, z, priority)); - } - - public void queueChunkForUpdateIfEmpty(int x, int z, int priority) { - if (!hasChunk(x, z)) { - queueChunkForUpdate(x, z, priority); - } - } - - public void updateChunkInQueue() { - if (queuedChunks.size() == 0) { - return; - } - - QueuedXZ q = queuedChunks.remove(); - if (q == null) { - return; - } - - if (!world.getChunkProvider().chunkExists(q.x, q.z)) { - long now = (new Date()).getTime(); - if (now - lastForcedChunkLoad < 1000) { - q.p++; // Increase priority so it gets looked at later - queuedChunks.add(q); - return; - } else { - lastForcedChunkLoad = now; - } - } - - updateChunk(q.x, q.z); - } - public void save() { - Iterator i = regionUpdateSet.iterator(); - - while (i.hasNext()) { - QueuedXZ id = i.next(); - i.remove(); - if (id == null) { - continue; - } + long[] chunkList; + synchronized (updatedChunks) { + chunkList = updatedChunks.toArray(); + updatedChunks.clear(); + } - MapRegion region = regionMap.get(getXzId(id.x, id.z)); + for (long id : chunkList) { + MapRegion region = (MapRegion) regionMap.getValueByKey(id); if (region == null) { continue; } @@ -169,7 +98,7 @@ public void save() { NBTTagCompound output = new NBTTagCompound(); region.writeToNBT(output); byte[] data = NBTUtils.save(output); - File file = new File(location, "r" + id.x + "," + id.z + ".nbt"); + File file = new File(location, "r" + MapUtils.getXFromID(id) + "," + MapUtils.getZFromID(id) + ".nbt"); try { FileOutputStream f = new FileOutputStream(file); @@ -186,12 +115,45 @@ public int getColor(int x, int z) { return chunk.getColor(x & 15, z & 15); } - protected void updateChunk(int x, int z) { - MapChunk chunk = getChunk(x, z); - chunk.update(world.getChunkFromChunkCoords(x, z)); - regionUpdateSet.add(new QueuedXZ(x >> 4, z >> 4, 0)); + public void tick() { + if (timeToUpdate.size() > 0) { + synchronized (timeToUpdate) { + Set chunks = new HashSet(); + chunks.addAll(timeToUpdate.keySet()); + for (Chunk c : chunks) { + int v = timeToUpdate.get(c); + if (v > 1) { + timeToUpdate.put(c, v - 1); + } else { + try { + updateChunk(c); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + } + } + } + + public void updateChunk(Chunk rchunk) { + long id = MapUtils.getIDFromCoords(rchunk.xPosition, rchunk.zPosition); + MapChunk chunk = getChunk(rchunk.xPosition, rchunk.zPosition); + chunk.update(rchunk); + updatedChunks.add(id); + synchronized (timeToUpdate) { + timeToUpdate.remove(rchunk); + } + regionUpdateTime.put(id, (new Date()).getTime()); + } - // priority does not matter - see equals - queuedChunks.remove(new QueuedXZ(x, z, 0)); + public long getUpdateTime(int x, int z) { + return regionUpdateTime.get(MapUtils.getIDFromCoords(x, z)); + } + + public void updateChunkDelayed(Chunk chunk, byte time) { + synchronized (timeToUpdate) { + timeToUpdate.put(chunk, (int) time); + } } } diff --git a/common/buildcraft/robotics/render/RenderRobot.java b/common/buildcraft/robotics/render/RenderRobot.java index 9a03ef46d7..2ae06686aa 100644 --- a/common/buildcraft/robotics/render/RenderRobot.java +++ b/common/buildcraft/robotics/render/RenderRobot.java @@ -1,27 +1,37 @@ /** 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.robotics.render; import java.util.Date; +import com.mojang.authlib.GameProfile; + import org.lwjgl.opengl.GL11; import net.minecraft.client.Minecraft; import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelBiped; import net.minecraft.client.model.ModelRenderer; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderEntityItem; import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.renderer.tileentity.TileEntitySkullRenderer; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.item.ItemArmor; +import net.minecraft.item.ItemSkull; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTUtil; +import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; + import net.minecraftforge.client.ForgeHooksClient; +import net.minecraftforge.common.util.Constants.NBT; import buildcraft.api.robots.IRobotOverlayItem; import buildcraft.core.DefaultProps; @@ -31,7 +41,8 @@ import buildcraft.core.render.RenderLaser; import buildcraft.robotics.EntityRobot; -public class RenderRobot extends Render { +/** All of this is getting a mega-rewrite for Neptune */ +public class RenderRobot extends Render { private static final ResourceLocation overlay_red = new ResourceLocation(DefaultProps.TEXTURE_PATH_ROBOTS + "/overlay_side.png"); private static final ResourceLocation overlay_cyan = new ResourceLocation(DefaultProps.TEXTURE_PATH_ROBOTS + "/overlay_bottom.png"); @@ -40,6 +51,8 @@ public class RenderRobot extends Render { private ModelBase model = new ModelBase() {}; private ModelBase modelHelmet = new ModelBase() {}; + private ModelBase modelSkullOverlay = new ModelBase() {}; + private ModelRenderer skullOverlayBox; private ModelRenderer box, helmetBox; public RenderRobot() { @@ -60,13 +73,108 @@ public boolean shouldSpreadItems() { box.addBox(-4F, -4F, -4F, 8, 8, 8); box.setRotationPoint(0.0F, 0.0F, 0.0F); helmetBox = new ModelRenderer(modelHelmet, 0, 0); - helmetBox.addBox(-4F, -4F, -4F, 8, 8, 8); + helmetBox.addBox(-4F, -8F, -4F, 8, 8, 8); helmetBox.setRotationPoint(0.0F, 0.0F, 0.0F); + skullOverlayBox = new ModelRenderer(modelSkullOverlay, 32, 0); + skullOverlayBox.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, 0.5F); + skullOverlayBox.setRotationPoint(0.0F, 0.0F, 0.0F); } @Override - public void doRender(Entity entity, double x, double y, double z, float f, float f1) { - doRender((EntityRobot) entity, x, y, z, f1); + public void doRender(EntityRobot entity, double x, double y, double z, float f, float f1) { + EntityRobot robot = (EntityRobot) entity; + GL11.glPushMatrix(); + GL11.glTranslated(x, y, z); + + float robotYaw = this.interpolateRotation(robot.prevRenderYawOffset, robot.renderYawOffset, f1); + // GL11.glRotatef(-robotYaw, 0.0f, 1.0f, 0.0f); + + if (robot.getStackInSlot(0) != null) { + GL11.glPushMatrix(); + GL11.glTranslatef(-0.125F, 0, -0.125F); + doRenderItem(robot.getStackInSlot(0)); + GL11.glColor3f(1, 1, 1); + GL11.glPopMatrix(); + } + + if (robot.getStackInSlot(1) != null) { + GL11.glPushMatrix(); + GL11.glTranslatef(+0.125F, 0, -0.125F); + doRenderItem(robot.getStackInSlot(1)); + GL11.glColor3f(1, 1, 1); + GL11.glPopMatrix(); + } + + if (robot.getStackInSlot(2) != null) { + GL11.glPushMatrix(); + GL11.glTranslatef(+0.125F, 0, +0.125F); + doRenderItem(robot.getStackInSlot(2)); + GL11.glColor3f(1, 1, 1); + GL11.glPopMatrix(); + } + + if (robot.getStackInSlot(3) != null) { + GL11.glPushMatrix(); + GL11.glTranslatef(-0.125F, 0, +0.125F); + doRenderItem(robot.getStackInSlot(3)); + GL11.glColor3f(1, 1, 1); + GL11.glPopMatrix(); + } + + if (robot.itemInUse != null) { + GL11.glPushMatrix(); + + GL11.glRotatef(robot.itemAimPitch, 0, 0, 1); + + if (robot.itemActive) { + long newDate = new Date().getTime(); + robot.itemActiveStage = (robot.itemActiveStage + (newDate - robot.lastUpdateTime) / 10) % 45; + GL11.glRotatef(robot.itemActiveStage, 0, 0, 1); + robot.lastUpdateTime = newDate; + } + + GL11.glTranslatef(-0.4F, 0, 0); + GL11.glRotatef(-45F + 180F, 0, 1, 0); + GL11.glScalef(0.8F, 0.8F, 0.8F); + + ItemStack itemstack1 = robot.itemInUse; + + // if (itemstack1.getItem().requiresMultipleRenderPasses()) { + // for (int k = 0; k < itemstack1.getItem().getRenderPasses(itemstack1.getItemDamage()); ++k) { + // RenderUtils.setGLColorFromInt(itemstack1.getItem().getColorFromItemStack(itemstack1, k)); + // this.renderManager.itemRenderer.renderItem(robot, itemstack1, k); + // } + // } else { + RenderUtils.setGLColorFromInt(itemstack1.getItem().getColorFromItemStack(itemstack1, 0)); + // this.renderManager.itemRenderer.renderItem(robot, itemstack1, 0); + Minecraft.getMinecraft().getItemRenderer().renderItem(robot, itemstack1, TransformType.THIRD_PERSON); + // } + + GL11.glColor3f(1, 1, 1); + GL11.glPopMatrix(); + } + + if (robot.laser.isVisible) { + robot.laser.head = Utils.getVec(robot); + + RenderLaser.doRenderLaser(robot.worldObj, renderManager.renderEngine, robot.laser, EntityLaser.LASER_YELLOW); + } + + if (robot.getTexture() != null) { + renderManager.renderEngine.bindTexture(robot.getTexture()); + float storagePercent = (float) robot.getBattery().getEnergyStored() / (float) robot.getBattery().getMaxEnergyStored(); + if (robot.hurtTime > 0) { + GL11.glColor3f(1.0f, 0.6f, 0.6f); + GL11.glRotatef(robot.hurtTime * 0.01f, 0, 0, 1); + } + doRenderRobot(1F / 16F, renderManager.renderEngine, storagePercent, robot.isActive()); + } + + for (ItemStack s : robot.getWearables()) { + doRenderWearable(robot, renderManager.renderEngine, s); + } + + GL11.glPopMatrix(); } private void doRender(EntityRobot robot, double x, double y, double z, float partialTicks) { @@ -74,7 +182,7 @@ private void doRender(EntityRobot robot, double x, double y, double z, float par GL11.glTranslated(x, y, z); float robotYaw = this.interpolateRotation(robot.prevRenderYawOffset, robot.renderYawOffset, partialTicks); -// GL11.glRotatef(-robotYaw, 0.0f, 1.0f, 0.0f); + // GL11.glRotatef(-robotYaw, 0.0f, 1.0f, 0.0f); if (robot.getStackInSlot(0) != null) { GL11.glPushMatrix(); @@ -150,6 +258,10 @@ private void doRender(EntityRobot robot, double x, double y, double z, float par if (robot.getTexture() != null) { renderManager.renderEngine.bindTexture(robot.getTexture()); float storagePercent = (float) robot.getBattery().getEnergyStored() / (float) robot.getBattery().getMaxEnergyStored(); + if (robot.hurtTime > 0) { + GL11.glColor3f(1.0f, 0.6f, 0.6f); + GL11.glRotatef(robot.hurtTime * 0.01f, 0, 0, 1); + } doRenderRobot(1F / 16F, renderManager.renderEngine, storagePercent, robot.isActive()); } @@ -161,8 +273,8 @@ private void doRender(EntityRobot robot, double x, double y, double z, float par } @Override - protected ResourceLocation getEntityTexture(Entity entity) { - return ((EntityRobot) entity).getTexture(); + protected ResourceLocation getEntityTexture(EntityRobot entity) { + return entity.getTexture(); } // @Override @@ -210,15 +322,62 @@ private void doRenderWearable(EntityRobot entity, TextureManager textureManager, GL11.glScalef(1.0125F, 1.0125F, 1.0125F); GL11.glTranslatef(0.0f, -0.25f, 0.0f); GL11.glRotatef(180F, 0, 0, 1); - textureManager.bindTexture(new ResourceLocation(ForgeHooksClient.getArmorTexture(entity, wearable, null, 0, null))); - ModelBase armorModel = ForgeHooksClient.getArmorModel(entity, wearable, 0, null); + + int color = wearable.getItem().getColorFromItemStack(wearable, 0); + if (color != 16777215) { + GL11.glPushAttrib(GL11.GL_COLOR_BUFFER_BIT); + GL11.glColor3ub((byte) (color >> 16), (byte) ((color >> 8) & 255), (byte) (color & 255)); + } + + textureManager.bindTexture(new ResourceLocation(ForgeHooksClient.getArmorTexture(entity, wearable, "", 0, ""))); + ModelBiped armorModel = ForgeHooksClient.getArmorModel(entity, wearable, 0, null); if (armorModel != null) { armorModel.render(entity, 0, 0, 0, -90f, 0, 1 / 16F); + + if (color != 16777215) { + GL11.glPopAttrib(); + } } else { + GL11.glRotatef(-90.0f, 0.0f, 1.0f, 0.0f); helmetBox.render(1 / 16F); + + if (color != 16777215) { + this.bindTexture(new ResourceLocation(ForgeHooksClient.getArmorTexture(entity, wearable, "", 0, "overlay"))); + helmetBox.render(1 / 16F); + GL11.glPopAttrib(); + } } + GL11.glPopMatrix(); + } else if (wearable.getItem() instanceof ItemSkull) { + doRenderSkull(wearable); + } + } + + private void doRenderSkull(ItemStack wearable) { + GL11.glPushMatrix(); + GL11.glScalef(1.0125F, 1.0125F, 1.0125F); + GameProfile gameProfile = null; + if (wearable.hasTagCompound()) { + NBTTagCompound nbt = wearable.getTagCompound(); + if (nbt.hasKey("Name")) {// FIXME: Come back to this! + gameProfile = gameProfileCache.get(nbt.getString("Name")); + } else if (nbt.hasKey("SkullOwner", NBT.TAG_COMPOUND)) { + gameProfile = NBTUtil.readGameProfileFromNBT(nbt.getCompoundTag("SkullOwner")); + nbt.setString("Name", gameProfile.getName()); + gameProfileCache.put(gameProfile.getName(), gameProfile); + } } + + TileEntitySkullRenderer.instance.renderSkull(-0.5F, -0.25F, -0.5F, EnumFacing.values()[wearable.getItemDamage() & 7], -90.0F, 1, gameProfile, + 0); + if (gameProfile != null) { + GL11.glTranslatef(0.0f, -0.25f, 0.0f); + GL11.glRotatef(180F, 0, 0, 1); + GL11.glRotatef(-90.0f, 0.0f, 1.0f, 0.0f); + skullOverlayBox.render(1 / 16f); + } + GL11.glPopMatrix(); } private void doRenderRobot(float factor, TextureManager texManager, float storagePercent, boolean isAsleep) { diff --git a/common/buildcraft/robotics/render/RenderZonePlan.java b/common/buildcraft/robotics/render/RenderZonePlan.java new file mode 100644 index 0000000000..97de0b71e7 --- /dev/null +++ b/common/buildcraft/robotics/render/RenderZonePlan.java @@ -0,0 +1,68 @@ +package buildcraft.robotics.render; + +import java.util.HashMap; + +import org.lwjgl.opengl.GL11; + +import net.minecraft.block.material.MapColor; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; + +import buildcraft.core.lib.render.DynamicTextureBC; +import buildcraft.robotics.TileZonePlan; + +public class RenderZonePlan extends TileEntitySpecialRenderer { + private static final float Z_OFFSET = 2049 / 2048.0F; + private static final HashMap TEXTURES = new HashMap(); + + @Override + public void renderTileEntityAt(TileZonePlan zonePlan, double tx, double ty, double tz, float partialTicks, int arg) { + boolean rendered = true; + TileZonePlan tile = zonePlan; + + if (!TEXTURES.containsKey(zonePlan)) { + DynamicTextureBC textureBC = new DynamicTextureBC(16, 16); + TEXTURES.put(zonePlan, textureBC); + rendered = false; + } + DynamicTextureBC textureBC = TEXTURES.get(zonePlan); + // FIXME! All of this is wrong! + // FakeIcon fakeIcon = new FakeIcon(0, 1, 0, 1, 16, 16); + + byte[] previewColors = zonePlan.getPreviewTexture(!rendered); + + if (previewColors != null) { + for (int y = 0; y < 8; y++) { + for (int x = 0; x < 10; x++) { + int col = MapColor.mapColorArray[previewColors[y * 10 + x]].colorValue; + if ((x & 1) != (y & 1)) { + int ocol = col; + col = (ocol & 0xFF) * 15 / 16 | (((ocol & 0xFF00) >> 8) * 15 / 16) << 8 | (((ocol & 0xFF0000) >> 16) * 15 / 16) << 16; + } + textureBC.setColor(x + 3, y + 3, 0xFF000000 | col); + } + } + } + + GL11.glPushMatrix(); + GL11.glPushAttrib(GL11.GL_COLOR_BUFFER_BIT); + + GL11.glTranslatef((float) tx + 0.5F, (float) ty + 0.5F, (float) tz + 0.5F); + GL11.glScalef(Z_OFFSET, Z_OFFSET, Z_OFFSET); + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); + + textureBC.updateTexture(); + + // RenderEntityBlock.RenderInfo renderBox = new RenderEntityBlock.RenderInfo(); + // renderBox.setRenderSingleSide(((BlockBuildCraft) + // zonePlan.getBlockType()).getFrontSide(zonePlan.getBlockMetadata())); + // renderBox.texture = fakeIcon; + // renderBox.light = 15; + // RenderEntityBlock.INSTANCE.renderBlock(renderBox); + + GL11.glPopAttrib(); + GL11.glPopMatrix(); + } +} diff --git a/common/buildcraft/robotics/render/RobotStationItemRenderer.java b/common/buildcraft/robotics/render/RobotStationItemRenderer.java deleted file mode 100755 index 844ba4109c..0000000000 --- a/common/buildcraft/robotics/render/RobotStationItemRenderer.java +++ /dev/null @@ -1,94 +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.robotics.render; - -public class RobotStationItemRenderer {/*implements IItemRenderer { - private void renderPlugItem(RenderBlocks render, ItemStack item, float translateX, float translateY, float translateZ) { - // Render StructurePipe - Block block = BuildCraftTransport.genericPipeBlock; - Tessellator tessellator = Tessellator.instance; - TextureAtlasSprite textureID = BuildCraftTransport.instance.pipeIconProvider.getIcon(PipeIconProvider.TYPE.PipeRobotStation.ordinal()); // Structure - // pipe - - block.setBlockBounds(0.25F, 0.25F, 0.25F, 0.75F, 0.375F, 0.75F); - block.setBlockBoundsForItemRender(); - render.setRenderBoundsFromBlock(block); - GL11.glTranslatef(translateX, translateY, translateZ + 0.25F); - - tessellator.startDrawingQuads(); - tessellator.setNormal(0.0F, -0F, 0.0F); - render.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, textureID); - tessellator.draw(); - - tessellator.startDrawingQuads(); - tessellator.setNormal(0.0F, 1.0F, 0.0F); - render.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, textureID); - tessellator.draw(); - - tessellator.startDrawingQuads(); - tessellator.setNormal(0.0F, 0.0F, -1F); - render.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, textureID); - tessellator.draw(); - - tessellator.startDrawingQuads(); - tessellator.setNormal(0.0F, 0.0F, 1.0F); - render.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, textureID); - tessellator.draw(); - - tessellator.startDrawingQuads(); - tessellator.setNormal(-1F, 0.0F, 0.0F); - render.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, textureID); - tessellator.draw(); - - tessellator.startDrawingQuads(); - tessellator.setNormal(1.0F, 0.0F, 0.0F); - render.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, textureID); - tessellator.draw(); - } - - @Override - public boolean handleRenderType(ItemStack item, ItemRenderType type) { - switch (type) { - case ENTITY: - return true; - case EQUIPPED: - return true; - case EQUIPPED_FIRST_PERSON: - return true; - case INVENTORY: - return true; - default: - return false; - } - } - - @Override - public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { - return helper != ItemRendererHelper.BLOCK_3D; - } - - @Override - public void renderItem(ItemRenderType type, ItemStack item, Object... data) { - switch (type) { - case ENTITY: - GL11.glScalef(0.50F, 0.50F, 0.50F); - renderPlugItem((RenderBlocks) data[0], item, -0.6F, 0f, -0.6F); - break; - case EQUIPPED: - case EQUIPPED_FIRST_PERSON: - GL11.glRotatef(70, 0, 0, 1F); - GL11.glRotatef(-55, 1, 0, 0); - GL11.glScalef(2F, 2F, 2F); - GL11.glTranslatef(0, -0.6F, -0.4F); - renderPlugItem((RenderBlocks) data[0], item, 0F, 0F, 0f); - break; - case INVENTORY: - GL11.glScalef(1.1F, 1.1F, 1.1F); - renderPlugItem((RenderBlocks) data[0], item, -0.3f, -0.35f, -0.7f); - break; - default: - } - }*/ -} diff --git a/common/buildcraft/robotics/statements/ActionRobotFilter.java b/common/buildcraft/robotics/statements/ActionRobotFilter.java index 4cb03aa4b0..0415f8acc2 100755 --- a/common/buildcraft/robotics/statements/ActionRobotFilter.java +++ b/common/buildcraft/robotics/statements/ActionRobotFilter.java @@ -1,5 +1,5 @@ /** 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.robotics.statements; @@ -8,22 +8,13 @@ import java.util.Collection; import net.minecraft.item.ItemStack; + import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidStack; import buildcraft.api.robots.DockingStation; -import buildcraft.api.statements.IActionInternal; -import buildcraft.api.statements.IStatementContainer; -import buildcraft.api.statements.IStatementParameter; -import buildcraft.api.statements.StatementParameterItemStack; -import buildcraft.api.statements.StatementSlot; -import buildcraft.core.lib.inventory.filters.ArrayFluidFilter; -import buildcraft.core.lib.inventory.filters.ArrayStackOrListFilter; -import buildcraft.core.lib.inventory.filters.IFluidFilter; -import buildcraft.core.lib.inventory.filters.IStackFilter; -import buildcraft.core.lib.inventory.filters.PassThroughFluidFilter; -import buildcraft.core.lib.inventory.filters.PassThroughStackFilter; -import buildcraft.core.lib.inventory.filters.StatementParameterStackFilter; +import buildcraft.api.statements.*; +import buildcraft.core.lib.inventory.filters.*; import buildcraft.core.lib.utils.StringUtils; import buildcraft.core.statements.BCStatement; @@ -39,11 +30,6 @@ public String getDescription() { return StringUtils.localize("gate.action.robot.filter"); } - // @Override - // public void registerIcons(TextureAtlasSpriteRegister iconRegister) { - // icon = iconRegister.registerIcon("buildcraftrobotics:triggers/action_robot_filter"); - // } - @Override public int minParameters() { return 1; diff --git a/common/buildcraft/robotics/statements/ActionRobotFilterTool.java b/common/buildcraft/robotics/statements/ActionRobotFilterTool.java index 5f4404e83f..5a356b0f30 100644 --- a/common/buildcraft/robotics/statements/ActionRobotFilterTool.java +++ b/common/buildcraft/robotics/statements/ActionRobotFilterTool.java @@ -1,5 +1,5 @@ /** 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.robotics.statements; @@ -10,11 +10,7 @@ import net.minecraft.item.ItemStack; import buildcraft.api.robots.DockingStation; -import buildcraft.api.statements.IActionInternal; -import buildcraft.api.statements.IStatementContainer; -import buildcraft.api.statements.IStatementParameter; -import buildcraft.api.statements.StatementParameterItemStack; -import buildcraft.api.statements.StatementSlot; +import buildcraft.api.statements.*; import buildcraft.core.lib.inventory.filters.ArrayStackOrListFilter; import buildcraft.core.lib.inventory.filters.IStackFilter; import buildcraft.core.lib.inventory.filters.PassThroughStackFilter; diff --git a/common/buildcraft/robotics/statements/ActionRobotGotoStation.java b/common/buildcraft/robotics/statements/ActionRobotGotoStation.java index d09056db01..25b4f7a5d0 100644 --- a/common/buildcraft/robotics/statements/ActionRobotGotoStation.java +++ b/common/buildcraft/robotics/statements/ActionRobotGotoStation.java @@ -1,5 +1,5 @@ /** 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.robotics.statements; @@ -37,11 +37,6 @@ public String getDescription() { return StringUtils.localize("gate.action.robot.goto_station"); } - // @Override - // public void registerIcons(TextureAtlasSpriteRegister iconRegister) { - // icon = iconRegister.registerIcon("buildcraftrobotics:triggers/action_robot_goto_station"); - // } - @Override public void actionActivate(IStatementContainer container, IStatementParameter[] parameters) { IRobotRegistry registry = RobotManager.registryProvider.getRegistry(container.getTile().getWorld()); @@ -63,7 +58,9 @@ public void actionActivate(IStatementContainer container, IStatementParameter[] newStation = getStation((StatementParameterItemStack) parameters[0], registry); } - robot.overrideAI(new AIRobotGoAndLinkToDock(robot, newStation)); + if (newStation != null) { + robot.overrideAI(new AIRobotGoAndLinkToDock(robot, newStation)); + } } } } diff --git a/common/buildcraft/robotics/statements/ActionRobotWakeUp.java b/common/buildcraft/robotics/statements/ActionRobotWakeUp.java index e8d84f2a0a..29d8c3156c 100755 --- a/common/buildcraft/robotics/statements/ActionRobotWakeUp.java +++ b/common/buildcraft/robotics/statements/ActionRobotWakeUp.java @@ -1,5 +1,5 @@ /** 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.robotics.statements; @@ -22,13 +22,6 @@ public String getDescription() { return StringUtils.localize("gate.action.robot.wakeup"); } - // @Override - // public void registerIcons(TextureAtlasSpriteRegister iconRegister) { - // icon = iconRegister.registerIcon("buildcraftrobotics:triggers/action_robot_wakeup"); - // } - @Override - public void actionActivate(IStatementContainer source, IStatementParameter[] parameters) { - - } + public void actionActivate(IStatementContainer source, IStatementParameter[] parameters) {} } diff --git a/common/buildcraft/robotics/statements/ActionRobotWorkInArea.java b/common/buildcraft/robotics/statements/ActionRobotWorkInArea.java index 251d3cf097..f9302978f0 100755 --- a/common/buildcraft/robotics/statements/ActionRobotWorkInArea.java +++ b/common/buildcraft/robotics/statements/ActionRobotWorkInArea.java @@ -1,5 +1,5 @@ /** 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.robotics.statements; @@ -11,7 +11,6 @@ import buildcraft.api.statements.IActionInternal; import buildcraft.api.statements.IStatementContainer; import buildcraft.api.statements.IStatementParameter; -import buildcraft.api.statements.StatementParameterItemStack; import buildcraft.api.statements.StatementSlot; import buildcraft.core.lib.utils.StringUtils; import buildcraft.core.statements.BCStatement; @@ -22,9 +21,9 @@ public enum AreaType { WORK("work_in_area"), LOAD_UNLOAD("load_unload_area"); - private String name; + private final String name; - private AreaType(String iName) { + AreaType(String iName) { name = iName; } @@ -41,7 +40,7 @@ public String getSpriteLocation() { } } - private AreaType areaType; + private final AreaType areaType; public ActionRobotWorkInArea(AreaType areaType) { super(areaType.getTag()); @@ -54,11 +53,6 @@ public String getDescription() { return StringUtils.localize(areaType.getUnlocalizedName()); } - // @Override - // public void registerIcons(TextureAtlasSpriteRegister iconRegister) { - // icon = iconRegister.registerIcon(areaType.getIcon()); - // } - public static IZone getArea(StatementSlot slot) { if (slot.parameters[0] == null) { return null; @@ -86,7 +80,7 @@ public int maxParameters() { @Override public IStatementParameter createParameter(int index) { - return new StatementParameterItemStack(); + return new StatementParameterMapLocation(); } @Override diff --git a/common/buildcraft/robotics/statements/ActionStationAcceptFluids.java b/common/buildcraft/robotics/statements/ActionStationAcceptFluids.java index 50eb27c0cc..7f01ec9279 100755 --- a/common/buildcraft/robotics/statements/ActionStationAcceptFluids.java +++ b/common/buildcraft/robotics/statements/ActionStationAcceptFluids.java @@ -1,5 +1,5 @@ /** 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.robotics.statements; @@ -39,7 +39,5 @@ public IStatementParameter createParameter(int index) { } @Override - public void actionActivate(IStatementContainer source, IStatementParameter[] parameters) { - - } + public void actionActivate(IStatementContainer source, IStatementParameter[] parameters) {} } diff --git a/common/buildcraft/robotics/statements/ActionStationAcceptItems.java b/common/buildcraft/robotics/statements/ActionStationAcceptItems.java index 13297d7f0b..e6512bd8f3 100755 --- a/common/buildcraft/robotics/statements/ActionStationAcceptItems.java +++ b/common/buildcraft/robotics/statements/ActionStationAcceptItems.java @@ -1,21 +1,13 @@ /** 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.robotics.statements; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; - -import buildcraft.api.core.IInvSlot; -import buildcraft.api.robots.DockingStation; import buildcraft.api.statements.IStatementParameter; import buildcraft.api.statements.StatementManager; import buildcraft.api.statements.StatementParameterItemStack; -import buildcraft.api.statements.StatementSlot; -import buildcraft.api.transport.IInjectable; import buildcraft.core.lib.utils.StringUtils; -import buildcraft.robotics.EntityRobot; public class ActionStationAcceptItems extends ActionStationInputItems { @@ -30,11 +22,6 @@ public String getDescription() { return StringUtils.localize("gate.action.station.accept_items"); } - // @Override - // public void registerIcons(TextureAtlasSpriteRegister iconRegister) { - // icon = iconRegister.registerIcon("buildcraftrobotics:triggers/action_station_accept_items"); - // } - @Override public int maxParameters() { return 3; @@ -44,42 +31,4 @@ public int maxParameters() { public IStatementParameter createParameter(int index) { return new StatementParameterItemStack(); } - - @Override - public boolean insert(DockingStation station, EntityRobot robot, StatementSlot actionSlot, IInvSlot invSlot, boolean doInsert) { - if (!super.insert(station, robot, actionSlot, invSlot, doInsert)) { - return false; - } - - IInjectable injectable = station.getItemOutput(); - - if (injectable == null) { - return false; - } - - EnumFacing injectSide = station.side().getOpposite(); - - if (!injectable.canInjectItems(injectSide)) { - return false; - } - - if (!doInsert) { - return true; - } - - ItemStack stack = invSlot.getStackInSlot(); - int used = injectable.injectItem(stack, doInsert, injectSide, null); - if (used > 0) { - stack.stackSize -= used; - if (stack.stackSize > 0) { - invSlot.setStackInSlot(stack); - } else { - invSlot.setStackInSlot(null); - } - return true; - } - - return false; - } - } diff --git a/common/buildcraft/robotics/statements/ActionStationForbidRobot.java b/common/buildcraft/robotics/statements/ActionStationForbidRobot.java index 16dc4d0fae..1471ec8bd1 100755 --- a/common/buildcraft/robotics/statements/ActionStationForbidRobot.java +++ b/common/buildcraft/robotics/statements/ActionStationForbidRobot.java @@ -1,21 +1,17 @@ /** 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.robotics.statements; -import net.minecraft.item.ItemStack; - import buildcraft.api.robots.DockingStation; import buildcraft.api.robots.EntityRobotBase; import buildcraft.api.statements.IActionInternal; import buildcraft.api.statements.IStatementContainer; import buildcraft.api.statements.IStatementParameter; -import buildcraft.api.statements.StatementParameterItemStack; import buildcraft.api.statements.StatementSlot; import buildcraft.core.lib.utils.StringUtils; import buildcraft.core.statements.BCStatement; -import buildcraft.robotics.ItemRobot; public class ActionStationForbidRobot extends BCStatement implements IActionInternal { private final boolean invert; @@ -31,12 +27,6 @@ public String getDescription() { return StringUtils.localize("gate.action.station." + (invert ? "force" : "forbid") + "_robot"); } - // @Override - // public void registerIcons(TextureAtlasSpriteRegister iconRegister) { - // icon = iconRegister.registerIcon("buildcraftrobotics:triggers/action_station_robot_" + (invert ? "mandatory" : - // "forbidden")); - // } - @Override public int minParameters() { return 1; @@ -49,7 +39,7 @@ public int maxParameters() { @Override public IStatementParameter createParameter(int index) { - return new StatementParameterItemStack(); + return new StatementParameterRobot(); } public static boolean isForbidden(DockingStation station, EntityRobotBase robot) { @@ -66,14 +56,8 @@ public static boolean isForbidden(DockingStation station, EntityRobotBase robot) public static boolean isForbidden(StatementSlot slot, EntityRobotBase robot) { for (IStatementParameter p : slot.parameters) { - if (p != null) { - ItemStack stack = p.getItemStack(); - - if (stack != null && stack.getItem() instanceof ItemRobot) { - if (ItemRobot.getRobotNBT(stack) == robot.getBoard().getNBTHandler()) { - return true; - } - } + if (p != null && StatementParameterRobot.matches(p, robot)) { + return true; } } @@ -81,7 +65,5 @@ public static boolean isForbidden(StatementSlot slot, EntityRobotBase robot) { } @Override - public void actionActivate(IStatementContainer source, IStatementParameter[] parameters) { - - } + public void actionActivate(IStatementContainer source, IStatementParameter[] parameters) {} } diff --git a/common/buildcraft/robotics/statements/ActionStationInputItems.java b/common/buildcraft/robotics/statements/ActionStationInputItems.java index 2ff7b5acb7..3284c4690f 100755 --- a/common/buildcraft/robotics/statements/ActionStationInputItems.java +++ b/common/buildcraft/robotics/statements/ActionStationInputItems.java @@ -1,33 +1,19 @@ /** 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.robotics.statements; -import buildcraft.api.core.IInvSlot; -import buildcraft.api.robots.DockingStation; import buildcraft.api.statements.IActionInternal; import buildcraft.api.statements.IStatementContainer; import buildcraft.api.statements.IStatementParameter; -import buildcraft.api.statements.StatementSlot; -import buildcraft.core.lib.inventory.filters.StatementParameterStackFilter; import buildcraft.core.statements.BCStatement; -import buildcraft.robotics.EntityRobot; public abstract class ActionStationInputItems extends BCStatement implements IActionInternal { - public ActionStationInputItems(String name) { super(name); } - public boolean insert(DockingStation station, EntityRobot robot, StatementSlot actionSlot, IInvSlot invSlot, boolean doInsert) { - StatementParameterStackFilter param = new StatementParameterStackFilter(actionSlot.parameters); - - return !param.hasFilter() || param.matches(invSlot.getStackInSlot()); - } - @Override - public void actionActivate(IStatementContainer source, IStatementParameter[] parameters) { - - } + public void actionActivate(IStatementContainer source, IStatementParameter[] parameters) {} } diff --git a/common/buildcraft/robotics/statements/ActionStationProvideFluids.java b/common/buildcraft/robotics/statements/ActionStationProvideFluids.java index 2cf61b8774..8186c454a4 100755 --- a/common/buildcraft/robotics/statements/ActionStationProvideFluids.java +++ b/common/buildcraft/robotics/statements/ActionStationProvideFluids.java @@ -1,5 +1,5 @@ /** 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.robotics.statements; @@ -23,11 +23,6 @@ public String getDescription() { return StringUtils.localize("gate.action.station.povide_fluids"); } - // @Override - // public void registerIcons(TextureAtlasSpriteRegister iconRegister) { - // icon = iconRegister.registerIcon("buildcraftrobotics:triggers/action_station_provide_fluids"); - // } - @Override public int maxParameters() { return 3; @@ -39,7 +34,5 @@ public IStatementParameter createParameter(int index) { } @Override - public void actionActivate(IStatementContainer source, IStatementParameter[] parameters) { - - } + public void actionActivate(IStatementContainer source, IStatementParameter[] parameters) {} } diff --git a/common/buildcraft/robotics/statements/ActionStationProvideItems.java b/common/buildcraft/robotics/statements/ActionStationProvideItems.java index 743acb7c96..977eb6bb39 100755 --- a/common/buildcraft/robotics/statements/ActionStationProvideItems.java +++ b/common/buildcraft/robotics/statements/ActionStationProvideItems.java @@ -1,13 +1,14 @@ /** 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.robotics.statements; -import buildcraft.api.statements.IActionInternal; -import buildcraft.api.statements.IStatementContainer; -import buildcraft.api.statements.IStatementParameter; -import buildcraft.api.statements.StatementParameterItemStack; +import net.minecraft.item.ItemStack; + +import buildcraft.api.robots.DockingStation; +import buildcraft.api.statements.*; +import buildcraft.core.lib.inventory.filters.StatementParameterStackFilter; import buildcraft.core.lib.utils.StringUtils; import buildcraft.core.statements.BCStatement; @@ -23,11 +24,6 @@ public String getDescription() { return StringUtils.localize("gate.action.station.provide_items"); } - // @Override - // public void registerIcons(TextureAtlasSpriteRegister iconRegister) { - // icon = iconRegister.registerIcon("buildcraftrobotics:triggers/action_station_provide_items"); - // } - @Override public int maxParameters() { return 3; @@ -42,4 +38,24 @@ public IStatementParameter createParameter(int index) { public void actionActivate(IStatementContainer source, IStatementParameter[] parameters) { } + + public static boolean canExtractItem(DockingStation station, ItemStack stack) { + boolean hasFilter = false; + + for (StatementSlot s : station.getActiveActions()) { + if (s.statement instanceof ActionStationProvideItems) { + StatementParameterStackFilter param = new StatementParameterStackFilter(s.parameters); + + if (param.hasFilter()) { + hasFilter = true; + + if (param.matches(stack)) { + return true; + } + } + } + } + + return !hasFilter; + } } diff --git a/common/buildcraft/robotics/statements/ActionStationRequestItems.java b/common/buildcraft/robotics/statements/ActionStationRequestItems.java index a537df8d5d..1259402ade 100755 --- a/common/buildcraft/robotics/statements/ActionStationRequestItems.java +++ b/common/buildcraft/robotics/statements/ActionStationRequestItems.java @@ -1,20 +1,12 @@ /** 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.robotics.statements; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; - -import buildcraft.api.core.IInvSlot; -import buildcraft.api.robots.DockingStation; import buildcraft.api.statements.IStatementParameter; -import buildcraft.api.statements.StatementParameterItemStack; -import buildcraft.api.statements.StatementSlot; -import buildcraft.api.transport.IInjectable; import buildcraft.core.lib.utils.StringUtils; -import buildcraft.robotics.EntityRobot; +import buildcraft.core.statements.StatementParameterItemStackExact; public class ActionStationRequestItems extends ActionStationInputItems { @@ -28,11 +20,6 @@ public String getDescription() { return StringUtils.localize("gate.action.station.request_items"); } - // @Override - // public void registerIcons(TextureAtlasSpriteRegister iconRegister) { - // icon = iconRegister.registerIcon("buildcraftrobotics:triggers/action_station_request_items"); - // } - @Override public int maxParameters() { return 3; @@ -45,43 +32,6 @@ public int minParameters() { @Override public IStatementParameter createParameter(int index) { - return new StatementParameterItemStack(); - } - - @Override - public boolean insert(DockingStation station, EntityRobot robot, StatementSlot actionSlot, IInvSlot invSlot, boolean doInsert) { - if (!super.insert(station, robot, actionSlot, invSlot, doInsert)) { - return false; - } - - IInjectable injectable = station.getItemOutput(); - - if (injectable == null) { - return false; - } - - EnumFacing injectSide = station.side().getOpposite(); - - if (!injectable.canInjectItems(injectSide)) { - return false; - } - - if (!doInsert) { - return true; - } - - ItemStack stack = invSlot.getStackInSlot(); - int used = injectable.injectItem(stack, doInsert, injectSide, null); - if (used > 0) { - stack.stackSize -= used; - if (stack.stackSize > 0) { - invSlot.setStackInSlot(stack); - } else { - invSlot.setStackInSlot(null); - } - return true; - } - - return false; + return new StatementParameterItemStackExact(); } } diff --git a/common/buildcraft/robotics/statements/ActionStationRequestItemsMachine.java b/common/buildcraft/robotics/statements/ActionStationRequestItemsMachine.java index 1850742bde..62595e02ad 100755 --- a/common/buildcraft/robotics/statements/ActionStationRequestItemsMachine.java +++ b/common/buildcraft/robotics/statements/ActionStationRequestItemsMachine.java @@ -1,5 +1,5 @@ /** 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.robotics.statements; @@ -22,13 +22,6 @@ public String getDescription() { return StringUtils.localize("gate.action.station.provide_machine_request"); } - // @Override - // public void registerIcons(TextureAtlasSpriteRegister iconRegister) { - // icon = iconRegister.registerIcon("buildcraftrobotics:triggers/action_station_machine_request"); - // } - @Override - public void actionActivate(IStatementContainer source, IStatementParameter[] parameters) { - - } + public void actionActivate(IStatementContainer source, IStatementParameter[] parameters) {} } diff --git a/common/buildcraft/robotics/statements/RobotsActionProvider.java b/common/buildcraft/robotics/statements/RobotsActionProvider.java index a2658d7a49..53cb8a7520 100755 --- a/common/buildcraft/robotics/statements/RobotsActionProvider.java +++ b/common/buildcraft/robotics/statements/RobotsActionProvider.java @@ -1,5 +1,5 @@ /** 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.robotics.statements; @@ -8,10 +8,10 @@ import java.util.LinkedList; import java.util.List; -import net.minecraft.block.Block; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; +import buildcraft.BuildCraftRobotics; import buildcraft.api.robots.DockingStation; import buildcraft.api.statements.IActionExternal; import buildcraft.api.statements.IActionInternal; @@ -19,9 +19,7 @@ import buildcraft.api.statements.IStatementContainer; import buildcraft.api.transport.IPipeTile; import buildcraft.api.transport.IPipeTile.PipeType; -import buildcraft.BuildCraftRobotics; import buildcraft.robotics.RobotUtils; -import buildcraft.transport.TileGenericPipe; public class RobotsActionProvider implements IActionProvider { @@ -61,13 +59,6 @@ public Collection getInternalActions(IStatementContainer contai } for (DockingStation station : stations) { - TileEntity sideTile = ((TileGenericPipe) tile).getTile(station.side); - Block sideBlock = ((TileGenericPipe) tile).getBlock(station.side); - - if (sideTile instanceof IPipeTile) { - continue; - } - if (station.getItemInput() != null) { result.add(BuildCraftRobotics.actionStationProvideItems); } diff --git a/common/buildcraft/robotics/statements/RobotsTriggerProvider.java b/common/buildcraft/robotics/statements/RobotsTriggerProvider.java index 3cc773329c..00794a961c 100755 --- a/common/buildcraft/robotics/statements/RobotsTriggerProvider.java +++ b/common/buildcraft/robotics/statements/RobotsTriggerProvider.java @@ -1,5 +1,5 @@ /** 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.robotics.statements; @@ -11,12 +11,12 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; +import buildcraft.BuildCraftRobotics; import buildcraft.api.robots.DockingStation; import buildcraft.api.statements.IStatementContainer; import buildcraft.api.statements.ITriggerExternal; import buildcraft.api.statements.ITriggerInternal; import buildcraft.api.statements.ITriggerProvider; -import buildcraft.BuildCraftRobotics; import buildcraft.robotics.RobotUtils; public class RobotsTriggerProvider implements ITriggerProvider { diff --git a/common/buildcraft/robotics/statements/StateStationProvideItems.java b/common/buildcraft/robotics/statements/StateStationProvideItems.java index 3a00cdd446..0a4f8fc70d 100755 --- a/common/buildcraft/robotics/statements/StateStationProvideItems.java +++ b/common/buildcraft/robotics/statements/StateStationProvideItems.java @@ -1,5 +1,5 @@ /** 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.robotics.statements; diff --git a/common/buildcraft/robotics/statements/StateStationRequestItems.java b/common/buildcraft/robotics/statements/StateStationRequestItems.java index 01290f38ff..8197dc7368 100755 --- a/common/buildcraft/robotics/statements/StateStationRequestItems.java +++ b/common/buildcraft/robotics/statements/StateStationRequestItems.java @@ -1,5 +1,5 @@ /** 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.robotics.statements; diff --git a/common/buildcraft/robotics/statements/StatementParameterMapLocation.java b/common/buildcraft/robotics/statements/StatementParameterMapLocation.java new file mode 100644 index 0000000000..fb3c8dfd04 --- /dev/null +++ b/common/buildcraft/robotics/statements/StatementParameterMapLocation.java @@ -0,0 +1,25 @@ +package buildcraft.robotics.statements; + +import net.minecraft.item.ItemStack; + +import buildcraft.api.items.IMapLocation; +import buildcraft.api.statements.IStatement; +import buildcraft.api.statements.IStatementContainer; +import buildcraft.api.statements.StatementMouseClick; +import buildcraft.api.statements.StatementParameterItemStack; + +public class StatementParameterMapLocation extends StatementParameterItemStack { + @Override + public String getUniqueTag() { + return "buildcraft:maplocation"; + } + + @Override + public void onClick(IStatementContainer source, IStatement stmt, ItemStack stackIn, StatementMouseClick mouse) { + ItemStack stack = stackIn; + if (stack != null && !(stack.getItem() instanceof IMapLocation)) { + stack = null; + } + super.onClick(source, stmt, stack, mouse); + } +} diff --git a/common/buildcraft/robotics/statements/StatementParameterRobot.java b/common/buildcraft/robotics/statements/StatementParameterRobot.java new file mode 100644 index 0000000000..7989619772 --- /dev/null +++ b/common/buildcraft/robotics/statements/StatementParameterRobot.java @@ -0,0 +1,67 @@ +package buildcraft.robotics.statements; + +import net.minecraft.item.ItemStack; + +import buildcraft.api.boards.RedstoneBoardRobotNBT; +import buildcraft.api.items.IList; +import buildcraft.api.robots.EntityRobotBase; +import buildcraft.api.statements.IStatement; +import buildcraft.api.statements.IStatementContainer; +import buildcraft.api.statements.IStatementParameter; +import buildcraft.api.statements.StatementMouseClick; +import buildcraft.api.statements.StatementParameterItemStack; +import buildcraft.core.lib.inventory.StackHelper; +import buildcraft.robotics.EntityRobot; +import buildcraft.robotics.ItemRobot; +import buildcraft.robotics.RobotUtils; + +public class StatementParameterRobot extends StatementParameterItemStack { + + @Override + public void onClick(IStatementContainer source, IStatement stmt, ItemStack stack, + StatementMouseClick mouse) { + if (stack == null && (this.stack == null || this.stack.getItem() instanceof ItemRobot)) { + RedstoneBoardRobotNBT nextBoard = RobotUtils.getNextBoard(this.stack, mouse.getButton() > 0); + if (nextBoard != null) { + this.stack = ItemRobot.createRobotStack(nextBoard, 0); + } else { + this.stack = null; + } + } else { + super.onClick(source, stmt, stack, mouse); + } + } + + @Override + public String getUniqueTag() { + return "buildcraft:robot"; + } + + public static boolean matches(IStatementParameter param, EntityRobotBase robot) { + ItemStack stack = param.getItemStack(); + if (stack != null) { + if (stack.getItem() instanceof IList) { + IList list = (IList) stack.getItem(); + if (list.matches(stack, ItemRobot.createRobotStack(robot.getBoard().getNBTHandler(), robot.getEnergy()))) { + return true; + } + for (ItemStack target : ((EntityRobot) robot).getWearables()) { + if (target != null && list.matches(stack, target)) { + return true; + } + } + } else if (stack.getItem() instanceof ItemRobot) { + if (ItemRobot.getRobotNBT(stack) == robot.getBoard().getNBTHandler()) { + return true; + } + } else if (robot instanceof EntityRobot) { + for (ItemStack target : ((EntityRobot) robot).getWearables()) { + if (target != null && StackHelper.isMatchingItem(stack, target, true, true)) { + return true; + } + } + } + } + return false; + } +} diff --git a/common/buildcraft/robotics/statements/TriggerRobotInStation.java b/common/buildcraft/robotics/statements/TriggerRobotInStation.java index ee5a5f216d..7412d19951 100755 --- a/common/buildcraft/robotics/statements/TriggerRobotInStation.java +++ b/common/buildcraft/robotics/statements/TriggerRobotInStation.java @@ -1,5 +1,5 @@ /** 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.robotics.statements; @@ -27,10 +27,22 @@ public String getDescription() { return StringUtils.localize("gate.trigger.robot.in.station"); } - // @Override - // public void registerIcons(TextureAtlasSpriteRegister iconRegister) { - // icon = iconRegister.registerIcon("buildcraftrobotics:triggers/trigger_robot_in_station"); - // } + @Override + public int minParameters() { + return 0; + } + + @Override + public int maxParameters() { + // return 1; + // TODO: Discuss whether we actually want to allow parameters here. + return 0; + } + + @Override + public IStatementParameter createParameter(int index) { + return new StatementParameterRobot(); + } @Override public boolean isTriggerActive(IStatementContainer container, IStatementParameter[] parameters) { @@ -41,7 +53,13 @@ public boolean isTriggerActive(IStatementContainer container, IStatementParamete EntityRobot robot = (EntityRobot) station.robotTaking(); if (robot.getDockingStation() == station) { - return true; + if (parameters.length > 0 && parameters[0] != null && parameters[0].getItemStack() != null) { + if (StatementParameterRobot.matches(parameters[0], robot)) { + return true; + } + } else { + return true; + } } } } diff --git a/common/buildcraft/robotics/statements/TriggerRobotLinked.java b/common/buildcraft/robotics/statements/TriggerRobotLinked.java index a808fc5020..de72bdbbc7 100755 --- a/common/buildcraft/robotics/statements/TriggerRobotLinked.java +++ b/common/buildcraft/robotics/statements/TriggerRobotLinked.java @@ -1,5 +1,5 @@ /** 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.robotics.statements; @@ -28,11 +28,6 @@ public String getDescription() { return StringUtils.localize("gate.trigger.robot." + (reserved ? "reserved" : "linked")); } -// @Override -// public void registerIcons(TextureAtlasSpriteRegister iconRegister) { -// icon = iconRegister.registerIcon("buildcraftrobotics:triggers/trigger_robot_" + (reserved ? "reserved" : "linked")); - // } - @Override public boolean isTriggerActive(IStatementContainer container, IStatementParameter[] parameters) { List stations = RobotUtils.getStations(container.getTile()); diff --git a/common/buildcraft/robotics/statements/TriggerRobotSleep.java b/common/buildcraft/robotics/statements/TriggerRobotSleep.java index 1400c76848..56d5c9380a 100755 --- a/common/buildcraft/robotics/statements/TriggerRobotSleep.java +++ b/common/buildcraft/robotics/statements/TriggerRobotSleep.java @@ -1,5 +1,5 @@ /** 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.robotics.statements; @@ -27,11 +27,6 @@ public String getDescription() { return StringUtils.localize("gate.trigger.robot.sleep"); } - // @Override - // public void registerIcons(TextureAtlasSpriteRegister iconRegister) { - // icon = iconRegister.registerIcon("buildcraftrobotics:triggers/trigger_robot_sleep"); - // } - @Override public boolean isTriggerActive(IStatementContainer container, IStatementParameter[] parameters) { List stations = RobotUtils.getStations(container.getTile()); diff --git a/common/buildcraft/silicon/BlockLaser.java b/common/buildcraft/silicon/BlockLaser.java index 4cb3174d51..21e87232be 100644 --- a/common/buildcraft/silicon/BlockLaser.java +++ b/common/buildcraft/silicon/BlockLaser.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.silicon; import java.util.EnumMap; @@ -33,6 +37,7 @@ public class BlockLaser extends BlockBuildCraft implements ICustomHighlight { private static final EnumMap boxesMap = Maps.newEnumMap(EnumFacing.class); static { + // FIXME: THIS IS WRONG FOR ALL NEGATIVE DIRECTIONS for (EnumFacing face : EnumFacing.values()) { AxisAlignedBB[] array = new AxisAlignedBB[2]; Vec3 min = Utils.VEC_ZERO; diff --git a/common/buildcraft/silicon/BlockLaserTable.java b/common/buildcraft/silicon/BlockLaserTable.java index 340e86cbce..91f3dd8d29 100644 --- a/common/buildcraft/silicon/BlockLaserTable.java +++ b/common/buildcraft/silicon/BlockLaserTable.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.silicon; import java.util.List; diff --git a/common/buildcraft/silicon/EntityPackage.java b/common/buildcraft/silicon/EntityPackage.java index d86265fa7b..f588c1367c 100644 --- a/common/buildcraft/silicon/EntityPackage.java +++ b/common/buildcraft/silicon/EntityPackage.java @@ -25,6 +25,11 @@ public EntityPackage(World world, EntityPlayer player, ItemStack stack) { this.pkg = stack; } + public EntityPackage(World world, double x, double y, double z, ItemStack stack) { + super(world, x, y, z); + this.pkg = stack; + } + @Override public void writeToNBT(NBTTagCompound compound) { super.writeToNBT(compound); diff --git a/common/buildcraft/silicon/ItemLaserTable.java b/common/buildcraft/silicon/ItemLaserTable.java index c37b2c0fdd..ea1edcfe1c 100644 --- a/common/buildcraft/silicon/ItemLaserTable.java +++ b/common/buildcraft/silicon/ItemLaserTable.java @@ -1,14 +1,25 @@ -/** 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 */ +/** + * 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.silicon; +import java.util.List; + import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; + +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; import buildcraft.core.lib.items.ItemBlockBuildCraft; -import buildcraft.silicon.BlockLaserTable; public class ItemLaserTable extends ItemBlockBuildCraft { @@ -38,6 +49,14 @@ public String getUnlocalizedName(ItemStack stack) { } @Override + @SideOnly(Side.CLIENT) + public void addInformation(ItemStack stack, EntityPlayer player, List strings, boolean adv) { + if (stack.getItemDamage() == 1) { + strings.add(EnumChatFormatting.DARK_RED + StatCollector.translateToLocal("tip.deprecated")); + } + } + + @Override public int getMetadata(int meta) { return meta < BlockLaserTable.TABLE_MAX ? meta : 0; } diff --git a/common/buildcraft/silicon/ItemPackage.java b/common/buildcraft/silicon/ItemPackage.java index 0f2111063e..854658ff49 100644 --- a/common/buildcraft/silicon/ItemPackage.java +++ b/common/buildcraft/silicon/ItemPackage.java @@ -2,22 +2,44 @@ import java.util.List; +import net.minecraft.block.BlockDispenser; import net.minecraft.client.gui.FontRenderer; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.dispenser.BehaviorDefaultDispenseItem; +import net.minecraft.dispenser.IBlockSource; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumFacing; import net.minecraft.world.World; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import buildcraft.core.lib.items.ItemBuildCraft; import buildcraft.core.lib.utils.NBTUtils; -import buildcraft.silicon.EntityPackage; import buildcraft.silicon.render.PackageFontRenderer; public class ItemPackage extends ItemBuildCraft { + public static final class DispenseBehaviour extends BehaviorDefaultDispenseItem { + @Override + public ItemStack dispenseStack(IBlockSource source, ItemStack stack) { + if (stack != null && stack.getItem() instanceof ItemPackage) { + World world = source.getWorld(); + EnumFacing enumfacing = BlockDispenser.getFacing(source.getBlockMetadata()); + + EntityPackage entityPackage = new EntityPackage(source.getWorld(), source.getX() + enumfacing.getFrontOffsetX(), source.getY() + + enumfacing.getFrontOffsetY(), source.getZ() + enumfacing.getFrontOffsetZ(), stack.copy()); + entityPackage.setThrowableHeading(enumfacing.getFrontOffsetX(), enumfacing.getFrontOffsetY() + 0.1F, enumfacing.getFrontOffsetZ(), + 1.1F, 6.0F); + world.spawnEntityInWorld(entityPackage); + stack.splitStack(1); + } + return stack; + } + } + public ItemPackage() { super(); setMaxStackSize(1); @@ -25,13 +47,9 @@ public ItemPackage() { @Override @SideOnly(Side.CLIENT) - public void getSubItems(Item item, CreativeTabs tab, List list) { + public void getSubItems(Item item, CreativeTabs tab, List list) {} - } - - public static void update(ItemStack stack) { - - } + public static void update(ItemStack stack) {} public static ItemStack getStack(ItemStack stack, int slot) { NBTTagCompound tag = NBTUtils.getItemData(stack); @@ -65,7 +83,7 @@ public FontRenderer getFontRenderer(ItemStack stack) { @Override @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, EntityPlayer player, List strings, boolean adv) { + public void addInformation(ItemStack stack, EntityPlayer player, List strings, boolean adv) { NBTTagCompound tag = NBTUtils.getItemData(stack); if (!tag.hasNoTags()) { strings.add("SPECIAL:0"); diff --git a/common/buildcraft/silicon/ItemRedstoneChipset.java b/common/buildcraft/silicon/ItemRedstoneChipset.java index 950f5d557c..d15a074a40 100644 --- a/common/buildcraft/silicon/ItemRedstoneChipset.java +++ b/common/buildcraft/silicon/ItemRedstoneChipset.java @@ -1,5 +1,5 @@ /** 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.silicon; @@ -12,8 +12,10 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.oredict.OreDictionary; import buildcraft.BuildCraftSilicon; import buildcraft.core.lib.items.ItemBuildCraft; @@ -21,7 +23,7 @@ public class ItemRedstoneChipset extends ItemBuildCraft { - public static enum Chipset { + public enum Chipset { RED, IRON, @@ -74,11 +76,18 @@ public void getSubItems(Item item, CreativeTabs tab, List itemList) { } } - @Override - @SideOnly(Side.CLIENT) - public void registerModels() { - for (Chipset chipset : Chipset.values()) { - ModelHelper.registerItemModel(this, chipset.ordinal(), "/" + chipset.name().toLowerCase(Locale.ROOT)); - } - } + @Override + @SideOnly(Side.CLIENT) + public void registerModels() { + for (Chipset chipset : Chipset.values()) { + ModelHelper.registerItemModel(this, chipset.ordinal(), "/" + chipset.name().toLowerCase(Locale.ROOT)); + } + } + + public void registerItemStacks() { + for (Chipset chipset : Chipset.VALUES) { + OreDictionary.registerOre("chipset" + chipset.name().toUpperCase().substring(0, 1) + chipset.name().toLowerCase().substring(1), chipset + .getStack()); + } + } } diff --git a/common/buildcraft/silicon/ResourceIdAssemblyTable.java b/common/buildcraft/silicon/ResourceIdAssemblyTable.java index 9c0750ca91..b044bc8e49 100755 --- a/common/buildcraft/silicon/ResourceIdAssemblyTable.java +++ b/common/buildcraft/silicon/ResourceIdAssemblyTable.java @@ -4,11 +4,9 @@ * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ package buildcraft.silicon; -import net.minecraft.util.BlockPos; +import buildcraft.api.robots.ResourceIdBlock; -import buildcraft.api.robots.ResourceId; - -public class ResourceIdAssemblyTable extends ResourceId { +public class ResourceIdAssemblyTable extends ResourceIdBlock { public ResourceIdAssemblyTable() { diff --git a/common/buildcraft/silicon/SiliconGuiHandler.java b/common/buildcraft/silicon/SiliconGuiHandler.java index b4dab55c07..2af4d06d99 100644 --- a/common/buildcraft/silicon/SiliconGuiHandler.java +++ b/common/buildcraft/silicon/SiliconGuiHandler.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.silicon; import net.minecraft.entity.player.EntityPlayer; diff --git a/common/buildcraft/silicon/SiliconProxy.java b/common/buildcraft/silicon/SiliconProxy.java index c04015268c..dda8a3d750 100644 --- a/common/buildcraft/silicon/SiliconProxy.java +++ b/common/buildcraft/silicon/SiliconProxy.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.silicon; import net.minecraftforge.fml.common.SidedProxy; diff --git a/common/buildcraft/silicon/SiliconProxyClient.java b/common/buildcraft/silicon/SiliconProxyClient.java index e63a74e7ec..48a05b077e 100644 --- a/common/buildcraft/silicon/SiliconProxyClient.java +++ b/common/buildcraft/silicon/SiliconProxyClient.java @@ -1,11 +1,12 @@ /** 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.silicon; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.entity.RenderSnowball; + import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.client.registry.RenderingRegistry; @@ -17,7 +18,7 @@ public class SiliconProxyClient extends SiliconProxy { public void registerRenderers() { ClientRegistry.bindTileEntitySpecialRenderer(TileLaser.class, new RenderLaserTile()); - RenderingRegistry.registerEntityRenderingHandler(EntityPackage.class, new RenderSnowball(Minecraft.getMinecraft().getRenderManager(), - BuildCraftSilicon.packageItem, Minecraft.getMinecraft().getRenderItem())); + RenderingRegistry.registerEntityRenderingHandler(EntityPackage.class, new RenderSnowball(Minecraft.getMinecraft() + .getRenderManager(), BuildCraftSilicon.packageItem, Minecraft.getMinecraft().getRenderItem())); } } diff --git a/common/buildcraft/silicon/TileAdvancedCraftingTable.java b/common/buildcraft/silicon/TileAdvancedCraftingTable.java index 32218d4a38..dec3de8bda 100644 --- a/common/buildcraft/silicon/TileAdvancedCraftingTable.java +++ b/common/buildcraft/silicon/TileAdvancedCraftingTable.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.silicon; import java.lang.ref.WeakReference; diff --git a/common/buildcraft/silicon/TileAssemblyTable.java b/common/buildcraft/silicon/TileAssemblyTable.java index f2899bbc26..79904feb33 100644 --- a/common/buildcraft/silicon/TileAssemblyTable.java +++ b/common/buildcraft/silicon/TileAssemblyTable.java @@ -1,5 +1,5 @@ /** 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.silicon; @@ -9,9 +9,6 @@ import java.util.LinkedList; import java.util.List; -import io.netty.buffer.ByteBuf; - -import net.minecraft.entity.item.EntityItem; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -22,21 +19,20 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fml.relauncher.Side; +import buildcraft.BuildCraftCore; import buildcraft.api.recipes.CraftingResult; import buildcraft.api.recipes.IFlexibleCrafter; import buildcraft.api.recipes.IFlexibleRecipe; import buildcraft.api.recipes.IFlexibleRecipeViewable; -import buildcraft.api.robots.EntityRobotBase; -import buildcraft.api.robots.RobotManager; -import buildcraft.BuildCraftCore; import buildcraft.core.lib.network.command.CommandWriter; import buildcraft.core.lib.network.command.ICommandReceiver; import buildcraft.core.lib.network.command.PacketCommand; import buildcraft.core.lib.utils.NetworkUtils; import buildcraft.core.lib.utils.StringUtils; -import buildcraft.core.lib.utils.Utils; import buildcraft.core.recipes.AssemblyRecipeManager; +import io.netty.buffer.ByteBuf; + public class TileAssemblyTable extends TileLaserTableBase implements IInventory, IFlexibleCrafter, ICommandReceiver { public String currentRecipeId = ""; public IFlexibleRecipe currentRecipe; @@ -66,9 +62,9 @@ private void queueNetworkUpdate() { public void update() { // WARNING: run only server-side, see canUpdate() super.update(); - if (worldObj.isRemote) { - return; - } + if (worldObj.isRemote) { + return; + } if (queuedNetworkUpdate) { sendNetworkUpdate(); @@ -88,32 +84,10 @@ public void update() { // WARNING: run only server-side, see canUpdate() } if (getEnergy() >= currentRecipe.craft(this, true).energyCost) { - setEnergy(0); - if (currentRecipe.canBeCrafted(this)) { - ItemStack remaining = currentRecipe.craft(this, false).crafted.copy(); - - if (RobotManager.registryProvider != null) { - EntityRobotBase robot = RobotManager.registryProvider.getRegistry(worldObj).robotTaking(new ResourceIdAssemblyTable(this)); - - if (robot != null) { - remaining = robot.receiveItem(this, remaining); - } - } - - if (remaining != null && remaining.stackSize > 0) { - remaining.stackSize -= Utils.addToRandomInventoryAround(worldObj, getPos(), remaining); - } - - if (remaining != null && remaining.stackSize > 0) { - remaining.stackSize -= Utils.addToRandomInjectableAround(worldObj, getPos(), null, remaining); - } - - if (remaining != null && remaining.stackSize > 0) { - EntityItem entityitem = new EntityItem(worldObj, getPos().getX() + 0.5, getPos().getY() + 0.7, getPos().getZ() + 0.5, remaining); - - worldObj.spawnEntityInWorld(entityitem); - } + CraftingResult result = currentRecipe.craft(this, false); + setEnergy(Math.max(0, getEnergy() - result.energyCost)); + outputStack(result.crafted.copy(), true); setNextCurrentRecipe(); } @@ -159,18 +133,22 @@ public void readData(ByteBuf stream) { private void generatePlannedOutputIcons() { for (String s : plannedOutput) { IFlexibleRecipe recipe = AssemblyRecipeManager.INSTANCE.getRecipe(s); - CraftingResult result = recipe.craft(this, true); - if (result != null && result.usedItems != null && result.usedItems.size() > 0) { - plannedOutputIcons.put(s, result); - } else if (recipe instanceof IFlexibleRecipeViewable) { - // !! HACK !! TODO !! HACK !! - Object out = ((IFlexibleRecipeViewable) recipe).getOutput(); - if (out instanceof ItemStack) { - result = new CraftingResult(); - result.crafted = (ItemStack) out; - result.recipe = recipe; + if (recipe != null) { + CraftingResult result = recipe.craft(this, true); + if (result != null && result.usedItems != null && result.usedItems.size() > 0) { plannedOutputIcons.put(s, result); + } else if (recipe instanceof IFlexibleRecipeViewable) { + // !! HACK !! TODO !! HACK !! + Object out = ((IFlexibleRecipeViewable) recipe).getOutput(); + if (out instanceof ItemStack) { + result = new CraftingResult(); + result.crafted = (ItemStack) out; + result.recipe = recipe; + plannedOutputIcons.put(s, result); + } } + } else { + plannedOutput.remove(s); } } @@ -184,7 +162,7 @@ private void generatePlannedOutputIcons() { @Override public void writeData(ByteBuf stream) { super.writeData(stream); - NetworkUtils.writeUTF(stream, currentRecipeId); + NetworkUtils.writeUTF(stream, currentRecipeId); stream.writeByte(plannedOutput.size()); for (String s : plannedOutput) { NetworkUtils.writeUTF(stream, s); @@ -195,7 +173,7 @@ public void writeData(ByteBuf stream) { public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); - NBTTagList list = nbt.getTagList("plannedIds", Constants.NBT.TAG_STRING); + NBTTagList list = nbt.getTagList("plannedIds", Constants.NBT.TAG_STRING); for (int i = 0; i < list.tagCount(); ++i) { IFlexibleRecipe recipe = AssemblyRecipeManager.INSTANCE.getRecipe(list.getStringTagAt(i)); @@ -285,7 +263,7 @@ public void planOutput(IFlexibleRecipe recipe) { queueNetworkUpdate(); } - } + } public void cancelPlanOutput(IFlexibleRecipe recipe) { if (isAssembling(recipe)) { @@ -301,7 +279,7 @@ public void cancelPlanOutput(IFlexibleRecipe recipe) { queueNetworkUpdate(); } - public void setNextCurrentRecipe() { + public void setNextCurrentRecipe() { boolean takeNext = false; for (String recipeId : plannedOutput) { @@ -335,7 +313,7 @@ public void setNextCurrentRecipe() { setCurrentRecipe(null); } - public void rpcSelectRecipe(final String id, final boolean select) { + public void rpcSelectRecipe(final String id, final boolean select) { BuildCraftCore.instance.sendToServer(new PacketCommand(this, "select", new CommandWriter() { public void write(ByteBuf data) { NetworkUtils.writeUTF(data, id); diff --git a/common/buildcraft/silicon/TileIntegrationTable.java b/common/buildcraft/silicon/TileIntegrationTable.java index 1800cd556e..5130864dc7 100644 --- a/common/buildcraft/silicon/TileIntegrationTable.java +++ b/common/buildcraft/silicon/TileIntegrationTable.java @@ -1,5 +1,5 @@ /** 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.silicon; @@ -7,26 +7,32 @@ import java.util.ArrayList; import java.util.List; -import io.netty.buffer.ByteBuf; - +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import buildcraft.api.recipes.BuildcraftRecipeRegistry; import buildcraft.api.recipes.IIntegrationRecipe; -import buildcraft.core.lib.inventory.ITransactor; -import buildcraft.core.lib.inventory.InventoryMapper; +import buildcraft.core.lib.inventory.SimpleInventory; import buildcraft.core.lib.inventory.StackHelper; -import buildcraft.core.lib.inventory.Transactor; +import buildcraft.core.lib.utils.NetworkUtils; import buildcraft.core.lib.utils.StringUtils; +import buildcraft.core.lib.utils.Utils; -public class TileIntegrationTable extends TileLaserTableBase { +import io.netty.buffer.ByteBuf; + +public class TileIntegrationTable extends TileLaserTableBase implements ISidedInventory { public static final int SLOT_OUTPUT = 9; + private static final int CYCLE_LENGTH = 16; + private static final int[] SLOTS = Utils.createSlotArray(0, 10); + + public final IInventory clientOutputInv = new SimpleInventory(1, "Preview", 64); + private int tick = 0; private IIntegrationRecipe activeRecipe; private boolean activeRecipeValid = false; - private InventoryMapper mappedOutput = new InventoryMapper(this, SLOT_OUTPUT, 1, false); private int maxExpCountClient; @Override @@ -56,7 +62,7 @@ public void update() { updateRecipeOutput(); - ItemStack output = getStackInSlot(10); + ItemStack output = clientOutputInv.getStackInSlot(0); if (!isRoomForOutput(output)) { setEnergy(0); return; @@ -68,9 +74,6 @@ public void update() { output = activeRecipe.craft(getStackInSlot(0), getExpansions(), false); if (output != null) { - ITransactor trans = Transactor.getTransactorFor(mappedOutput); - trans.add(output, EnumFacing.UP, true); - ItemStack input = getStackInSlot(0); if (input.stackSize > output.stackSize) { @@ -79,6 +82,8 @@ public void update() { setInventorySlotContents(0, null); } + outputStack(output, this, 9, false); + for (int i = 1; i < 9; i++) { if (getStackInSlot(i) != null && getStackInSlot(i).stackSize == 0) { setInventorySlotContents(i, null); @@ -99,22 +104,24 @@ private List getExpansions() { } private void updateRecipeOutput() { - if (activeRecipe == null) { - inv.setInventorySlotContents(10, null); - return; - } + ItemStack oldClientOutput = clientOutputInv.getStackInSlot(0); - List expansions = getExpansions(); + activeRecipeValid = false; + clientOutputInv.setInventorySlotContents(0, null); - if (expansions.size() == 0) { - activeRecipeValid = false; - inv.setInventorySlotContents(10, null); - return; + if (activeRecipe != null) { + List expansions = getExpansions(); + + if (expansions.size() > 0) { + clientOutputInv.setInventorySlotContents(0, activeRecipe.craft(getStackInSlot(0), expansions, true)); + } } - ItemStack output = activeRecipe.craft(getStackInSlot(0), expansions, true); - activeRecipeValid = output != null; - inv.setInventorySlotContents(10, output); + activeRecipeValid = clientOutputInv.getStackInSlot(0) != null; + + if (!StackHelper.isEqualItem(clientOutputInv.getStackInSlot(0), oldClientOutput)) { + sendNetworkUpdate(); + } } private void setNewActiveRecipe() { @@ -152,11 +159,13 @@ private boolean isRoomForOutput(ItemStack output) { @Override public void writeData(ByteBuf buf) { buf.writeByte((byte) getMaxExpansionCount()); + NetworkUtils.writeStack(buf, clientOutputInv.getStackInSlot(0)); } @Override public void readData(ByteBuf buf) { maxExpCountClient = buf.readByte(); + clientOutputInv.setInventorySlotContents(0, NetworkUtils.readStack(buf)); } public int getMaxExpansionCount() { @@ -180,10 +189,9 @@ public boolean isItemValidForSlot(int slot, ItemStack stack) { } else if (activeRecipe == null) { return false; } else if (slot < 9) { - if (activeRecipe.getMaximumExpansionCount(getStackInSlot(0)) > 0) { - if (slot > activeRecipe.getMaximumExpansionCount(getStackInSlot(0))) { - return false; - } + int expansionCount = activeRecipe.getMaximumExpansionCount(getStackInSlot(0)); + if (expansionCount > 0 && slot > expansionCount) { + return false; } return activeRecipe.isValidExpansion(getStackInSlot(0), stack); } else { @@ -193,7 +201,7 @@ public boolean isItemValidForSlot(int slot, ItemStack stack) { @Override public int getSizeInventory() { - return 11; + return 10; } @Override @@ -241,4 +249,31 @@ public void markDirty() { private void updateRecipe() { setNewActiveRecipe(); } + + @Override + public int[] getSlotsForFace(EnumFacing side) { + return SLOTS; + } + + @Override + public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side) { + if (slot == 0) { + return true; + } else if (activeRecipe == null) { + return false; + } else if (slot < 9) { + int expansionCount = activeRecipe.getMaximumExpansionCount(getStackInSlot(0)); + if (expansionCount > 0 && slot > expansionCount) { + return false; + } + return true; + } else { + return false; + } + } + + @Override + public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side) { + return slot == 9; + } } diff --git a/common/buildcraft/silicon/TileLaser.java b/common/buildcraft/silicon/TileLaser.java index b0b0550079..4b6e98b7ff 100644 --- a/common/buildcraft/silicon/TileLaser.java +++ b/common/buildcraft/silicon/TileLaser.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.silicon; import java.util.LinkedList; @@ -100,14 +104,17 @@ public void update() { return; } + // We have a laser + if (laser != null) { // We have a table and can work, so we create a laser if // necessary. laser.isVisible = true; - // We have a laser and may update it - if (laser != null && canUpdateLaser()) { + // We may update laser + if (canUpdateLaser()) { updateLaser(); } + } // Consume power and transfer it to the table. int localPower = getBattery().useEnergy(0, getMaxPowerSent(), false); @@ -159,7 +166,7 @@ protected void findTable() { List targets = new LinkedList(); for (BlockPos pos : Utils.allInBoxIncludingCorners(min, max)) { - if (BlockUtils.getBlock(worldObj, pos) instanceof ILaserTargetBlock) { + if (BlockUtils.getBlockState(worldObj, pos).getBlock() instanceof ILaserTargetBlock) { TileEntity tile = worldObj.getTileEntity(pos); if (tile instanceof ILaserTarget) { ILaserTarget table = (ILaserTarget) tile; diff --git a/common/buildcraft/silicon/TileLaserTableBase.java b/common/buildcraft/silicon/TileLaserTableBase.java index d3a4a052da..4f563c3309 100644 --- a/common/buildcraft/silicon/TileLaserTableBase.java +++ b/common/buildcraft/silicon/TileLaserTableBase.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.silicon; import net.minecraft.entity.item.EntityItem; @@ -17,16 +21,15 @@ import buildcraft.core.lib.block.TileBuildCraft; import buildcraft.core.lib.inventory.SimpleInventory; import buildcraft.core.lib.inventory.StackHelper; -import buildcraft.core.lib.utils.Average; +import buildcraft.core.lib.utils.AverageInt; import buildcraft.core.lib.utils.Utils; public abstract class TileLaserTableBase extends TileBuildCraft implements ILaserTarget, IInventory, IHasWork { - public int clientRequiredEnergy = 0; protected SimpleInventory inv = new SimpleInventory(getSizeInventory(), "inv", 64); private int energy = 0; private int recentEnergyAverage; - private Average recentEnergyAverageUtil = new Average(20); + private AverageInt recentEnergyAverageUtil = new AverageInt(20); @Override public void update() { @@ -145,11 +148,12 @@ protected void outputStack(ItemStack remaining, boolean autoEject) { protected void outputStack(ItemStack remaining, IInventory inv, int slot, boolean autoEject) { if (autoEject) { if (remaining != null && remaining.stackSize > 0) { - remaining.stackSize -= Utils.addToRandomInventoryAround(worldObj, getPos(), remaining); - } + remaining.stackSize -= Utils + .addToRandomInventoryAround(worldObj, getPos(), remaining); + } - if (remaining != null && remaining.stackSize > 0) { - remaining.stackSize -= Utils.addToRandomInjectableAround(worldObj, getPos(), null, remaining); + if (remaining != null && remaining.stackSize > 0) { + remaining.stackSize -= Utils.addToRandomInjectableAround(worldObj, getPos(), null, remaining); } } diff --git a/common/buildcraft/silicon/TilePackager.java b/common/buildcraft/silicon/TilePackager.java index 27127fc0f1..68441b3d45 100644 --- a/common/buildcraft/silicon/TilePackager.java +++ b/common/buildcraft/silicon/TilePackager.java @@ -1,5 +1,6 @@ package buildcraft.silicon; +import java.util.EnumMap; import java.util.HashMap; import java.util.Map; @@ -20,12 +21,10 @@ import buildcraft.api.core.IInvSlot; import buildcraft.BuildCraftCore; import buildcraft.core.lib.block.TileBuildCraft; -import buildcraft.core.lib.inventory.InventoryConcatenator; import buildcraft.core.lib.inventory.InventoryIterator; import buildcraft.core.lib.inventory.SimpleInventory; import buildcraft.core.lib.inventory.StackHelper; import buildcraft.core.lib.utils.NBTUtils; -import buildcraft.core.lib.utils.Utils; public class TilePackager extends TileBuildCraft implements ISidedInventory { private class Requirement { @@ -66,11 +65,11 @@ public int hashCode() { } } - private static final int[] SLOTS = Utils.createSlotArray(0, 12); + // Slot 10 is currently missing. Left in for backwards compat. + private static final int[] SLOTS = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11}; public SimpleInventory inventoryPublic = new SimpleInventory(12, "Packager", 64); public SimpleInventory inventoryPattern = new SimpleInventory(9, "Packager", 64); - public IInventory visibleInventory = InventoryConcatenator.make().add(inventoryPublic).add(inventoryPattern); private Requirement[] requirements = new Requirement[9]; private int patternsSet; @@ -246,7 +245,7 @@ private boolean attemptCrafting(ItemStack input) { break; } IInventory inv = invs.get(dir); - Iterable iterator = InventoryIterator.getIterable(inv, dir); + Iterable iterator = InventoryIterator.getIterable(inv, dir.getOpposite()); for (IInvSlot slot : iterator) { if (filteredReqsToFulfill == 0) { break; @@ -308,7 +307,7 @@ private boolean attemptCrafting(ItemStack input) { break; } IInventory inv = invs.get(dir); - Iterable iterator = InventoryIterator.getIterable(inv, dir); + Iterable iterator = InventoryIterator.getIterable(inv, dir.getOpposite()); for (IInvSlot slot : iterator) { if (foundMissing) { break; @@ -410,27 +409,27 @@ public void writeToNBT(NBTTagCompound cpd) { @Override public int getSizeInventory() { - return visibleInventory.getSizeInventory(); + return inventoryPublic.getSizeInventory(); } @Override public ItemStack getStackInSlot(int slot) { - return visibleInventory.getStackInSlot(slot); + return inventoryPublic.getStackInSlot(slot); } @Override public ItemStack decrStackSize(int slot, int amount) { - return visibleInventory.decrStackSize(slot, amount); + return inventoryPublic.decrStackSize(slot, amount); } @Override public ItemStack removeStackFromSlot(int slot) { - return visibleInventory.removeStackFromSlot(slot); + return inventoryPublic.removeStackFromSlot(slot); } @Override public void setInventorySlotContents(int slot, ItemStack stack) { - visibleInventory.setInventorySlotContents(slot, stack); + inventoryPublic.setInventorySlotContents(slot, stack); } @Override @@ -445,17 +444,17 @@ public int getInventoryStackLimit() { @Override public boolean isUseableByPlayer(EntityPlayer player) { - return visibleInventory.isUseableByPlayer(player); + return inventoryPublic.isUseableByPlayer(player); } @Override public void openInventory(EntityPlayer player) { - visibleInventory.openInventory(player); + inventoryPublic.openInventory(player); } @Override public void closeInventory(EntityPlayer player) { - visibleInventory.closeInventory(player); + inventoryPublic.closeInventory(player); } @Override @@ -463,7 +462,7 @@ public boolean isItemValidForSlot(int slot, ItemStack stack) { if (slot == 9) { return stack == null || stack.getItem() == Items.paper || stack.getItem() instanceof ItemPackage; } - return visibleInventory.isItemValidForSlot(slot, stack); + return inventoryPublic.isItemValidForSlot(slot, stack); } @Override diff --git a/common/buildcraft/silicon/TileProgrammingTable.java b/common/buildcraft/silicon/TileProgrammingTable.java index e7038196f5..3a1457bcb4 100644 --- a/common/buildcraft/silicon/TileProgrammingTable.java +++ b/common/buildcraft/silicon/TileProgrammingTable.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.silicon; import java.util.List; @@ -24,7 +28,6 @@ import buildcraft.core.lib.network.command.PacketCommand; import buildcraft.core.lib.utils.NetworkUtils; import buildcraft.core.lib.utils.StringUtils; -import buildcraft.core.lib.utils.Utils; public class TileProgrammingTable extends TileLaserTableBase implements IInventory, ISidedInventory, ICommandReceiver { public static final int WIDTH = 6; @@ -62,26 +65,13 @@ public void update() { return; } - if (optionId >= 0 && this.getStackInSlot(1) == null && getEnergy() >= currentRecipe.getEnergyCost(options.get(optionId))) { + if (optionId >= 0 && getEnergy() >= currentRecipe.getEnergyCost(options.get(optionId))) { if (currentRecipe.canCraft(this.getStackInSlot(0))) { ItemStack remaining = currentRecipe.craft(this.getStackInSlot(0), options.get(optionId)); if (remaining != null && remaining.stackSize > 0) { setEnergy(0); - this.decrStackSize(0, remaining.stackSize); - - if (remaining.stackSize > 0) { - remaining.stackSize -= Utils.addToRandomInventoryAround(worldObj, getPos(), remaining); - } - - if (remaining.stackSize > 0) { - remaining.stackSize -= Utils.addToRandomInjectableAround(worldObj, getPos(), null, remaining); - } - - if (remaining.stackSize > 0) { - this.setInventorySlotContents(1, remaining); - } else { - this.setInventorySlotContents(1, null); - } + decrStackSize(0, remaining.stackSize); + outputStack(remaining, this, 1, false); } } findRecipe(); @@ -112,7 +102,7 @@ public String getInventoryName() { public void readData(ByteBuf stream) { super.readData(stream); currentRecipeId = NetworkUtils.readUTF(stream); - optionId = stream.readUnsignedByte(); + optionId = stream.readByte(); updateRecipe(); } @@ -168,7 +158,9 @@ public void findRecipe() { } } - if ((oldId != null && !oldId.equals(currentRecipeId)) || (oldId == null && currentRecipeId != null)) { + if ((oldId != null && currentRecipeId != null && !oldId.equals(currentRecipeId)) + || (oldId == null && currentRecipeId != null) + || (oldId != null && currentRecipeId == null)) { optionId = -1; updateRecipe(); queueNetworkUpdate(); @@ -195,9 +187,11 @@ public void write(ByteBuf data) { @Override public void receiveCommand(String command, Side side, Object sender, ByteBuf stream) { if (side.isServer() && "select".equals(command)) { - optionId = stream.readUnsignedByte(); + optionId = stream.readByte(); if (optionId >= options.size()) { - optionId = 0; + optionId = -1; + } else if (optionId < -1) { + optionId = -1; } queueNetworkUpdate(); diff --git a/common/buildcraft/silicon/TileStampingTable.java b/common/buildcraft/silicon/TileStampingTable.java index fe480d23fc..077e98a39d 100644 --- a/common/buildcraft/silicon/TileStampingTable.java +++ b/common/buildcraft/silicon/TileStampingTable.java @@ -2,6 +2,7 @@ import java.lang.ref.WeakReference; +import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.ISidedInventory; @@ -42,14 +43,53 @@ public WeakReference getInternalPlayer() { return CoreProxy.proxy.getBuildCraftPlayer((WorldServer) worldObj, getPos().up()); } + private void handleLeftoverItems(IInventory items) { + for (int i = 0; i < items.getSizeInventory(); i++) { + if (items.getStackInSlot(i) != null) { + ItemStack output = items.getStackInSlot(i); + + if (output.stackSize <= 0) { + items.setInventorySlotContents(i, null); + continue; + } + + boolean inserted = false; + + for (int j = 2; j <= 4; j++) { + ItemStack target = getStackInSlot(j); + + if (target == null || target.stackSize <= 0) { + setInventorySlotContents(j, output); + inserted = true; + break; + } else { + output.stackSize -= StackHelper.mergeStacks(output, target, true); + if (output.stackSize == 0) { + inserted = true; + break; + } + } + } + + if (!inserted) { + if (output.stackSize > 0) { + output.stackSize -= Utils.addToRandomInventoryAround(worldObj, getPos(), output); + + if (output.stackSize > 0) { + InvUtils.dropItems(worldObj, output, getPos().up()); + } + } + } + + items.setInventorySlotContents(i, null); + } + } + } + @Override public void update() { super.update(); - if (worldObj.isRemote) { - return; - } - if (getEnergy() >= getRequiredEnergy() && getEnergy() > 0) { ItemStack input = this.getStackInSlot(0); @@ -57,8 +97,10 @@ public void update() { return; } + EntityPlayer internalPlayer = getInternalPlayer().get(); + if (craftSlot == null) { - craftSlot = new SlotCrafting(getInternalPlayer().get(), crafting, this, 1, 0, 0); + craftSlot = new SlotCrafting(internalPlayer, crafting, this, 1, 0, 0); } if (input.getItem() instanceof ItemPackage) { @@ -66,7 +108,12 @@ public void update() { NBTTagCompound tag = NBTUtils.getItemData(input); for (int i = 0; i < 9; i++) { if (tag.hasKey("item" + i)) { - crafting.setInventorySlotContents(i, ItemStack.loadItemStackFromNBT(tag.getCompoundTag("item" + i))); + ItemStack is = ItemStack.loadItemStackFromNBT(tag.getCompoundTag("item" + i)); + if (is != null) { + crafting.setInventorySlotContents(i, is); + } else { + return; + } } else { crafting.setInventorySlotContents(i, null); } @@ -83,63 +130,45 @@ public void update() { IRecipe recipe = crafting.findRecipe(); ItemStack result = recipe != null ? recipe.getCraftingResult(crafting).copy() : null; - ItemStack resultInto = this.getStackInSlot(1); - - if (recipe == null || result == null || result.stackSize <= 0) { - if (resultInto == null || StackHelper.canStacksMerge(input, resultInto)) { - this.setInventorySlotContents(0, null); - this.setInventorySlotContents(1, input); - } - return; - } else if (resultInto != null && (!StackHelper.canStacksMerge(result, resultInto) || resultInto.stackSize + result.stackSize > result - .getMaxStackSize())) { - return; - } addEnergy(-getRequiredEnergy()); - craftSlot.onPickupFromSlot(getInternalPlayer().get(), result); + if (result != null) { + craftSlot.onPickupFromSlot(internalPlayer, result); + handleLeftoverItems(crafting); + handleLeftoverItems(internalPlayer.inventory); - IInventory playerInv = getInternalPlayer().get().inventory; + for (int i = 1; i <= 4; i++) { + ItemStack inside = inv.getStackInSlot(i); - for (int i = 0; i < playerInv.getSizeInventory(); i++) { - if (playerInv.getStackInSlot(i) != null) { - ItemStack output = playerInv.getStackInSlot(i); + if (inside == null || inside.stackSize <= 0) { + inv.setInventorySlotContents(i, result.copy()); + result.stackSize = 0; + break; + } else if (StackHelper.canStacksMerge(inside, result)) { + result.stackSize -= StackHelper.mergeStacks(result, inside, true); - for (int j = 2; j < 5; j++) { - ItemStack target = getStackInSlot(j); - - if (target == null) { - setInventorySlotContents(j, output); - output.stackSize = 0; + if (result.stackSize == 0) { break; - } else { - output.stackSize -= StackHelper.mergeStacks(output, input, true); - if (output.stackSize == 0) { - break; - } } } + } - if (output.stackSize > 0) { - output.stackSize -= Utils.addToRandomInventoryAround(worldObj, getPos(), output); - } + if (result.stackSize > 0) { + EntityItem entityitem = new EntityItem(worldObj, getPos().getX() + 0.5, getPos().getY() + 0.7, getPos().getZ() + 0.5, result + .copy()); - if (output.stackSize > 0) { - InvUtils.dropItems(worldObj, output, getPos().add(0, 1, 0)); - } - - playerInv.setInventorySlotContents(i, null); + worldObj.spawnEntityInWorld(entityitem); + result.stackSize = 0; } - } - - if (resultInto == null) { - setInventorySlotContents(1, result); + decrStackSize(0, 1); } else { - resultInto.stackSize += result.stackSize; + ItemStack outputSlot = getStackInSlot(1); + if (outputSlot == null) { + setInventorySlotContents(1, getStackInSlot(0)); + setInventorySlotContents(0, null); + } } - - decrStackSize(0, 1); } } diff --git a/common/buildcraft/silicon/gui/ContainerAdvancedCraftingTable.java b/common/buildcraft/silicon/gui/ContainerAdvancedCraftingTable.java index 5b457446bf..878d75cb7d 100644 --- a/common/buildcraft/silicon/gui/ContainerAdvancedCraftingTable.java +++ b/common/buildcraft/silicon/gui/ContainerAdvancedCraftingTable.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.silicon.gui; import net.minecraft.entity.player.EntityPlayer; @@ -64,8 +68,8 @@ public boolean canInteractWith(EntityPlayer var1) { @Override public void detectAndSendChanges() { super.detectAndSendChanges(); - for (int i = 0; i < crafters.size(); i++) { - workbench.sendGUINetworkData(this, (ICrafting) crafters.get(i)); + for (Object crafter : crafters) { + workbench.sendGUINetworkData(this, (ICrafting) crafter); } } diff --git a/common/buildcraft/silicon/gui/ContainerAssemblyTable.java b/common/buildcraft/silicon/gui/ContainerAssemblyTable.java index 8d9ae0e05d..a71fbdd22c 100644 --- a/common/buildcraft/silicon/gui/ContainerAssemblyTable.java +++ b/common/buildcraft/silicon/gui/ContainerAssemblyTable.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.silicon.gui; import net.minecraft.entity.player.EntityPlayer; @@ -55,8 +59,8 @@ public void updateProgressBar(int i, int j) { public void detectAndSendChanges() { super.detectAndSendChanges(); - for (int i = 0; i < crafters.size(); i++) { - table.sendGUINetworkData(this, (ICrafting) crafters.get(i)); + for (Object crafter : crafters) { + table.sendGUINetworkData(this, (ICrafting) crafter); } } } diff --git a/common/buildcraft/silicon/gui/ContainerChargingTable.java b/common/buildcraft/silicon/gui/ContainerChargingTable.java index ee9c778c0a..50fcb72641 100644 --- a/common/buildcraft/silicon/gui/ContainerChargingTable.java +++ b/common/buildcraft/silicon/gui/ContainerChargingTable.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.silicon.gui; import net.minecraft.entity.player.EntityPlayer; @@ -47,8 +51,8 @@ public void updateProgressBar(int i, int j) { public void detectAndSendChanges() { super.detectAndSendChanges(); - for (int i = 0; i < crafters.size(); i++) { - table.sendGUINetworkData(this, (ICrafting) crafters.get(i)); + for (Object crafter : crafters) { + table.sendGUINetworkData(this, (ICrafting) crafter); } } } diff --git a/common/buildcraft/silicon/gui/ContainerIntegrationTable.java b/common/buildcraft/silicon/gui/ContainerIntegrationTable.java index 6aeda15706..9dacb8bbfc 100644 --- a/common/buildcraft/silicon/gui/ContainerIntegrationTable.java +++ b/common/buildcraft/silicon/gui/ContainerIntegrationTable.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.silicon.gui; import net.minecraft.entity.player.EntityPlayer; @@ -29,7 +33,7 @@ public ContainerIntegrationTable(EntityPlayer player, TileIntegrationTable table } addSlot(new SlotOutput(table, 9, 138, 49)); - addSlot(new SlotUntouchable(table, 10, 101, 36)); + addSlot(new SlotUntouchable(table.clientOutputInv, 0, 101, 36)); for (int y = 0; y < 3; y++) { for (int x = 0; x < 9; x++) { @@ -50,8 +54,8 @@ public boolean canInteractWith(EntityPlayer var1) { @Override public void detectAndSendChanges() { super.detectAndSendChanges(); - for (int i = 0; i < crafters.size(); i++) { - table.sendGUINetworkData(this, (ICrafting) crafters.get(i)); + for (Object crafter : crafters) { + table.sendGUINetworkData(this, (ICrafting) crafter); } } diff --git a/common/buildcraft/silicon/gui/ContainerPackager.java b/common/buildcraft/silicon/gui/ContainerPackager.java index 81ebc23325..1aad79835d 100644 --- a/common/buildcraft/silicon/gui/ContainerPackager.java +++ b/common/buildcraft/silicon/gui/ContainerPackager.java @@ -1,10 +1,15 @@ -/** 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 */ +/** + * 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.silicon.gui; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; @@ -16,8 +21,6 @@ public class ContainerPackager extends BuildCraftContainer { private final TilePackager tile; - // private int lastProgress; - public ContainerPackager(EntityPlayer player, TilePackager t) { super(player, t.getSizeInventory()); @@ -33,11 +36,11 @@ public ContainerPackager(EntityPlayer player, TilePackager t) { for (int y = 0; y < 3; y++) { for (int x = 0; x < 3; x++) { - addSlotToContainer(new SlotPackager(tile, 12 + x + y * 3, 30 + x * 18, 17 + y * 18)); + addSlotToContainer(new SlotPackager(tile.inventoryPattern, x + y * 3, 30 + x * 18, 17 + y * 18)); } } - addSlotToContainer(new Slot(tile, 10, 108, 31)); + // addSlotToContainer(new Slot(tile, 10, 108, 31)); addSlotToContainer(new SlotOutput(tile, 11, 123, 59)); for (int y = 0; y < 3; y++) { @@ -53,18 +56,13 @@ public ContainerPackager(EntityPlayer player, TilePackager t) { onCraftMatrixChanged(tile); } - @Override - public void updateProgressBar(int id, int data) { - /* switch (id) { case 0: tile.progress = data; break; } */ - } - @Override public ItemStack slotClick(int slotNum, int mouseButton, int modifier, EntityPlayer player) { - ItemStack out = super.slotClick(slotNum, mouseButton, modifier, player); Slot slot = slotNum < 0 ? null : (Slot) this.inventorySlots.get(slotNum); + ItemStack out = super.slotClick(slotNum, mouseButton, slot instanceof SlotPackager ? 0 : modifier, player); if (slot instanceof SlotPackager) { - int idx = slot.getSlotIndex() - 12; + int idx = slot.getSlotIndex(); ItemStack stack = player != null && player.inventory != null ? player.inventory.getItemStack() : null; if (stack == null) { tile.setPatternSlot(idx, !tile.isPatternSlotSet(idx)); diff --git a/common/buildcraft/silicon/gui/ContainerProgrammingTable.java b/common/buildcraft/silicon/gui/ContainerProgrammingTable.java index 4f35d20af3..f1faa7aab6 100644 --- a/common/buildcraft/silicon/gui/ContainerProgrammingTable.java +++ b/common/buildcraft/silicon/gui/ContainerProgrammingTable.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.silicon.gui; import net.minecraft.entity.player.EntityPlayer; @@ -51,8 +55,8 @@ public void updateProgressBar(int i, int j) { public void detectAndSendChanges() { super.detectAndSendChanges(); - for (int i = 0; i < crafters.size(); i++) { - table.sendGUINetworkData(this, (ICrafting) crafters.get(i)); + for (Object crafter : crafters) { + table.sendGUINetworkData(this, (ICrafting) crafter); } } } diff --git a/common/buildcraft/silicon/gui/ContainerStampingTable.java b/common/buildcraft/silicon/gui/ContainerStampingTable.java index 9ac9162f3c..479bc89c2d 100644 --- a/common/buildcraft/silicon/gui/ContainerStampingTable.java +++ b/common/buildcraft/silicon/gui/ContainerStampingTable.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.silicon.gui; import net.minecraft.entity.player.EntityPlayer; @@ -46,8 +50,8 @@ public boolean canInteractWith(EntityPlayer var1) { @Override public void detectAndSendChanges() { super.detectAndSendChanges(); - for (int i = 0; i < crafters.size(); i++) { - table.sendGUINetworkData(this, (ICrafting) crafters.get(i)); + for (Object crafter : crafters) { + table.sendGUINetworkData(this, (ICrafting) crafter); } } diff --git a/common/buildcraft/silicon/gui/GuiAdvancedCraftingTable.java b/common/buildcraft/silicon/gui/GuiAdvancedCraftingTable.java index 3993184e93..ef5662a69e 100644 --- a/common/buildcraft/silicon/gui/GuiAdvancedCraftingTable.java +++ b/common/buildcraft/silicon/gui/GuiAdvancedCraftingTable.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.silicon.gui; import org.lwjgl.opengl.GL11; diff --git a/common/buildcraft/silicon/gui/GuiAssemblyTable.java b/common/buildcraft/silicon/gui/GuiAssemblyTable.java index b3e8788575..666b18cfa4 100644 --- a/common/buildcraft/silicon/gui/GuiAssemblyTable.java +++ b/common/buildcraft/silicon/gui/GuiAssemblyTable.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.silicon.gui; import java.util.Collection; @@ -170,7 +174,7 @@ protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { drawTexturedModalRect(guiLeft + 86, guiTop + 36 + 70 - h, 176, 18, 4, h); - drawBackgroundSlots(); + drawBackgroundSlots(x, y); } @Override diff --git a/common/buildcraft/silicon/gui/GuiChargingTable.java b/common/buildcraft/silicon/gui/GuiChargingTable.java index 1cdfc01b7a..b62100db7a 100644 --- a/common/buildcraft/silicon/gui/GuiChargingTable.java +++ b/common/buildcraft/silicon/gui/GuiChargingTable.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.silicon.gui; import net.minecraft.entity.player.EntityPlayer; @@ -12,11 +16,9 @@ public class GuiChargingTable extends GuiLaserTable { public static final ResourceLocation TEXTURE = new ResourceLocation("buildcraftsilicon:textures/gui/charging_table.png"); - private final TileChargingTable table; public GuiChargingTable(EntityPlayer player, TileChargingTable chargingTable) { super(player, new ContainerChargingTable(player, chargingTable), chargingTable, TEXTURE); - this.table = chargingTable; xSize = 176; ySize = 132; } diff --git a/common/buildcraft/silicon/gui/GuiIntegrationTable.java b/common/buildcraft/silicon/gui/GuiIntegrationTable.java index ffa272968b..7b87ad531d 100644 --- a/common/buildcraft/silicon/gui/GuiIntegrationTable.java +++ b/common/buildcraft/silicon/gui/GuiIntegrationTable.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.silicon.gui; import org.lwjgl.opengl.GL11; diff --git a/common/buildcraft/silicon/gui/GuiLaserTable.java b/common/buildcraft/silicon/gui/GuiLaserTable.java index 1d5bcd7f43..a3f3e24389 100644 --- a/common/buildcraft/silicon/gui/GuiLaserTable.java +++ b/common/buildcraft/silicon/gui/GuiLaserTable.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.silicon.gui; import net.minecraft.client.Minecraft; diff --git a/common/buildcraft/silicon/gui/GuiPackager.java b/common/buildcraft/silicon/gui/GuiPackager.java index edeb48a210..ef3e7ac7be 100644 --- a/common/buildcraft/silicon/gui/GuiPackager.java +++ b/common/buildcraft/silicon/gui/GuiPackager.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.silicon.gui; import org.lwjgl.opengl.GL11; @@ -42,7 +46,5 @@ protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) } } } - /* if (bench.progress > 0) { int progress = bench.getProgressScaled(23); drawTexturedModalRect(guiLeft + 89, - * guiTop + 45, 176, 0, progress + 1, 12); } */ } } diff --git a/common/buildcraft/silicon/gui/GuiProgrammingTable.java b/common/buildcraft/silicon/gui/GuiProgrammingTable.java index fc19935526..afe9b21062 100644 --- a/common/buildcraft/silicon/gui/GuiProgrammingTable.java +++ b/common/buildcraft/silicon/gui/GuiProgrammingTable.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.silicon.gui; import java.util.Iterator; @@ -152,7 +156,7 @@ protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { drawTexturedModalRect(guiLeft + 164, guiTop + 36 + 70 - h, 176, 18, 4, h); - drawBackgroundSlots(); + drawBackgroundSlots(x, y); } @Override @@ -166,9 +170,13 @@ protected void slotClicked(AdvancedSlot aslot, int mouseButton) { return; } + if (table.optionId == slot.id) { + table.rpcSelectOption(-1); + } else { table.rpcSelectOption(slot.id); } } + } @Override protected void initLedgers(IInventory inventory) { diff --git a/common/buildcraft/silicon/gui/GuiStampingTable.java b/common/buildcraft/silicon/gui/GuiStampingTable.java index 1d15cdeac3..ec894ea064 100644 --- a/common/buildcraft/silicon/gui/GuiStampingTable.java +++ b/common/buildcraft/silicon/gui/GuiStampingTable.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.silicon.gui; import org.lwjgl.opengl.GL11; diff --git a/common/buildcraft/silicon/gui/SlotPackager.java b/common/buildcraft/silicon/gui/SlotPackager.java index 4810a28453..c76627418e 100644 --- a/common/buildcraft/silicon/gui/SlotPackager.java +++ b/common/buildcraft/silicon/gui/SlotPackager.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.silicon.gui; import net.minecraft.inventory.IInventory; @@ -23,4 +27,9 @@ public boolean isItemValid(ItemStack stack) { public boolean canShift() { return false; } + + @Override + public int getSlotStackLimit() { + return 1; + } } diff --git a/common/buildcraft/silicon/render/PackageFontRenderer.java b/common/buildcraft/silicon/render/PackageFontRenderer.java index 4bbe5d1694..f54c029839 100644 --- a/common/buildcraft/silicon/render/PackageFontRenderer.java +++ b/common/buildcraft/silicon/render/PackageFontRenderer.java @@ -15,28 +15,26 @@ public class PackageFontRenderer extends FontRenderer { private static final RenderItem itemRender = Minecraft.getMinecraft().getRenderItem(); private static final Minecraft mc = Minecraft.getMinecraft(); private static final FontRenderer realRenderer = mc.fontRendererObj; - private final ItemStack packageStack; private final NBTTagCompound pkgTag; public PackageFontRenderer(ItemStack packageStack) { super(mc.gameSettings, new ResourceLocation("textures/font/ascii.png"), mc.getTextureManager(), mc.fontRendererObj.getUnicodeFlag()); - this.packageStack = packageStack; this.pkgTag = NBTUtils.getItemData(packageStack); } @Override public int getStringWidth(String s) { - if (s.indexOf("SPECIAL:") < 0) { + if (!s.contains("SPECIAL:")) { return realRenderer.getStringWidth(s); } return 21; } - // TODO: Bug-test! + // TODO: Bug-test! @Override public int drawString(String s, float x, float y, int color, boolean shadow) { - if (s.indexOf("SPECIAL:") < 0) { + if (!s.contains("SPECIAL:")) { return realRenderer.drawString(s, x, y, color, shadow); } @@ -48,18 +46,22 @@ public int drawString(String s, float x, float y, int color, boolean shadow) { if (pkgTag.hasKey("item" + slotPos)) { ItemStack slotStack = ItemStack.loadItemStackFromNBT(pkgTag.getCompoundTag("item" + slotPos)); - GL11.glTranslatef(0.0F, 0.0F, 32.0F); - GL11.glScalef(0.5F, 0.5F, 0.5F); - FontRenderer font = slotStack.getItem().getFontRenderer(slotStack); - itemRender.zLevel = 200.0F; + if (slotStack != null) { + GL11.glTranslatef(0.0F, 0.0F, 32.0F); + GL11.glScalef(0.5F, 0.5F, 0.5F); + FontRenderer font = slotStack.getItem().getFontRenderer(slotStack); + itemRender.zLevel = 200.0F; - if (font == null || font instanceof PackageFontRenderer) { - font = Minecraft.getMinecraft().fontRendererObj; - } + if (font == null || font instanceof PackageFontRenderer) { + font = Minecraft.getMinecraft().fontRendererObj; + } - itemRender.renderItemAndEffectIntoGUI(slotStack, rx * 2, (int) (y * 2)); - itemRender.renderItemOverlayIntoGUI(font, slotStack, rx * 2, (int) (y * 2), ""); - itemRender.zLevel = 0.0F; + itemRender.renderItemAndEffectIntoGUI(slotStack, rx * 2, (int) (y * 2)); + itemRender.renderItemOverlays(font, slotStack, rx * 2, (int) (y * 2)); + itemRender.zLevel = 0.0F; + } else { + realRenderer.drawStringWithShadow("X", rx, y, 0xFF0000); + } } rx += 7; diff --git a/common/buildcraft/silicon/render/RenderLaserTile.java b/common/buildcraft/silicon/render/RenderLaserTile.java index e212f393f4..18921015e2 100755 --- a/common/buildcraft/silicon/render/RenderLaserTile.java +++ b/common/buildcraft/silicon/render/RenderLaserTile.java @@ -1,5 +1,5 @@ /** 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.silicon.render; @@ -8,24 +8,22 @@ import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.tileentity.TileEntity; import buildcraft.core.render.RenderLaser; import buildcraft.silicon.TileLaser; -public class RenderLaserTile extends TileEntitySpecialRenderer { +public class RenderLaserTile extends TileEntitySpecialRenderer { @Override - public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f, int i) { - TileLaser laser = (TileLaser) tileentity; - + public void renderTileEntityAt(TileLaser laser, double x, double y, double z, float f, int i) { if (laser != null) { GL11.glPushMatrix(); GL11.glTranslated(x, y, z); - GL11.glTranslated(-tileentity.getPos().getX(), -tileentity.getPos().getY(), -tileentity.getPos().getZ()); + GL11.glTranslated(-laser.getPos().getX(), -laser.getPos().getY(), -laser.getPos().getZ()); GL11.glPushMatrix(); - RenderLaser.doRenderLaser(TileEntityRendererDispatcher.instance.worldObj, TileEntityRendererDispatcher.instance.renderEngine, laser.laser, laser.getTexture()); + RenderLaser.doRenderLaser(TileEntityRendererDispatcher.instance.worldObj, TileEntityRendererDispatcher.instance.renderEngine, laser.laser, + laser.getTexture()); GL11.glPopMatrix(); GL11.glPopMatrix(); diff --git a/common/buildcraft/silicon/schematics/SchematicLaserTableBase.java b/common/buildcraft/silicon/schematics/SchematicLaserTableBase.java index 9ec14da9b4..075480760b 100755 --- a/common/buildcraft/silicon/schematics/SchematicLaserTableBase.java +++ b/common/buildcraft/silicon/schematics/SchematicLaserTableBase.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.silicon.schematics; import net.minecraft.util.BlockPos; diff --git a/common/buildcraft/transport/ActionActiveState.java b/common/buildcraft/transport/ActionActiveState.java index 75291e7e78..7def65e64a 100755 --- a/common/buildcraft/transport/ActionActiveState.java +++ b/common/buildcraft/transport/ActionActiveState.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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; public enum ActionActiveState { diff --git a/common/buildcraft/transport/BlockFilteredBuffer.java b/common/buildcraft/transport/BlockFilteredBuffer.java index c88e6ed0fd..4e67679318 100644 --- a/common/buildcraft/transport/BlockFilteredBuffer.java +++ b/common/buildcraft/transport/BlockFilteredBuffer.java @@ -1,5 +1,5 @@ /** 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; @@ -7,17 +7,19 @@ import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; +import buildcraft.BuildCraftTransport; import buildcraft.api.transport.IItemPipe; import buildcraft.core.GuiIds; import buildcraft.core.lib.block.BlockBuildCraft; -import buildcraft.BuildCraftTransport; +import buildcraft.core.lib.block.IComparatorInventory; -public class BlockFilteredBuffer extends BlockBuildCraft { +public class BlockFilteredBuffer extends BlockBuildCraft implements IComparatorInventory { public BlockFilteredBuffer() { super(Material.iron); setHardness(5F); @@ -51,4 +53,9 @@ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, En return true; } + + @Override + public boolean doesSlotCountComparator(TileEntity tile, int slot, ItemStack stack) { + return ((TileFilteredBuffer) tile).getFilters().getStackInSlot(slot) != null; + } } diff --git a/common/buildcraft/transport/BlockGenericPipe.java b/common/buildcraft/transport/BlockGenericPipe.java index 2f7feb84e3..43d2fa4a45 100644 --- a/common/buildcraft/transport/BlockGenericPipe.java +++ b/common/buildcraft/transport/BlockGenericPipe.java @@ -1,5 +1,5 @@ /** 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; @@ -42,14 +42,17 @@ import net.minecraft.world.World; import net.minecraftforge.client.model.ModelLoader; +import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.property.IExtendedBlockState; -import net.minecraftforge.fml.common.FMLCommonHandler; +import net.minecraftforge.common.util.BlockSnapshot; +import net.minecraftforge.event.world.BlockEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import buildcraft.BuildCraftTransport; import buildcraft.api.blocks.IColorRemovable; import buildcraft.api.core.BCLog; +import buildcraft.api.core.EnumPipePart; import buildcraft.api.events.PipePlacedEvent; import buildcraft.api.items.IMapLocation; import buildcraft.api.properties.BuildCraftExtendedProperty; @@ -61,8 +64,8 @@ import buildcraft.api.transport.pluggable.IPipePluggableItem; import buildcraft.api.transport.pluggable.PipePluggable; import buildcraft.core.BCCreativeTab; +import buildcraft.core.BCRegistry; import buildcraft.core.CoreConstants; -import buildcraft.core.lib.TileBuffer; import buildcraft.core.lib.block.BlockBuildCraft; import buildcraft.core.lib.render.ICustomHighlight; import buildcraft.core.lib.utils.ICustomStateMapper; @@ -82,7 +85,7 @@ public class BlockGenericPipe extends BlockBuildCraft implements IColorRemovable public static final BuildCraftExtendedProperty PIPE_PLUGGABLE_STATE = BuildCraftExtendedProperty.createExtended( "pluggable_state", PipePluggableState.class); - public static final BuildCraftExtendedProperty PIPE_PIPE = BuildCraftExtendedProperty.createExtended("pipe_pipe", Pipe.class); + public static final BuildCraftExtendedProperty> PIPE_PIPE = BuildCraftExtendedProperty.createExtended("pipe_pipe", Pipe.class); public static Map>> pipes = Maps.newHashMap(); public static Map> pipeRemoved = Maps.newHashMap(); @@ -91,7 +94,7 @@ public class BlockGenericPipe extends BlockBuildCraft implements IColorRemovable private static final EnumFacing[] DIR_VALUES = EnumFacing.values(); - public static enum Part { + public enum Part { Pipe, Pluggable, Wire @@ -533,10 +536,14 @@ public static void removePipe(Pipe pipe) { } pipeRemoved.put(pos, pipe); - world.removeTileEntity(pos); - if (pipe != null) { - updateNeighbourSignalState(pipe); + for (EnumFacing dir : EnumFacing.values()) { + TileEntity tile = world.getTileEntity(pos.offset(dir)); + if (tile instanceof IPipeTile) { + Pipe tpipe = (Pipe) ((IPipeTile) tile).getPipe(); + tpipe.scheduleWireUpdate(); + } } + world.removeTileEntity(pos); } @Override @@ -604,10 +611,20 @@ public Item getItemDropped(IBlockState state, Random rand, int dmg) { return null; } + @Override + public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos) { + // HACK: WAILA compatibility + EntityPlayer clientPlayer = CoreProxy.proxy.getClientPlayer(); + if (clientPlayer != null) { + return getPickBlock(target, world, pos, clientPlayer); + } else { + return new ItemStack(getPipe(world, pos).item, 1, getPipe(world, pos).container.getItemMetadata()); + } + } + @Override public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) { RaytraceResult rayTraceResult = doRayTrace(world, pos, player); - BCLog.logger.info("Picked " + rayTraceResult); if (rayTraceResult != null && rayTraceResult.boundingBox != null) { switch (rayTraceResult.hitPart) { @@ -651,14 +668,25 @@ public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, } } + @Override + public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor) { + TileEntity tile = world.getTileEntity(pos); + + if (tile instanceof TileGenericPipe) { + for (EnumFacing face : EnumFacing.values()) { + if (pos.offset(face).equals(neighbor)) { + ((TileGenericPipe) tile).scheduleNeighborChange(EnumPipePart.fromFacing(face)); + return; + } + } + } + } + private int getRedstoneInputToPipe(World world, BlockPos pos, EnumFacing d) { - // TODO (PASS 1): TEST THIS! - return world.getRedstonePower(pos, d); - // int i = d.ordinal(); - // int input = world.isBlockProvidingPowerTo(x + d.offsetX, y + d.offsetY, z + d.offsetZ, i); + // int input = world.getStrongPower(pos.offset(d), d); // if (input == 0) { - // input = world.getIndirectPowerLevelTo(x + d.offsetX, y + d.offsetY, z + d.offsetZ, i); - // if (input == 0 && d != EnumFacing.DOWN) { + return world.getRedstonePower(pos.offset(d), d); + // if (input == 0 && d != ForgeDirection.DOWN) { // Block block = world.getBlock(x + d.offsetX, y + d.offsetY, z + d.offsetZ); // if (block instanceof BlockRedstoneWire) { // return world.getBlockMetadata(x + d.offsetX, y + d.offsetY, z + d.offsetZ); @@ -728,7 +756,13 @@ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, En } else if (currentItem.getItem() instanceof IToolWrench) { // Only check the instance at this point. Call the IToolWrench // interface callbacks for the individual pipe/logic calls - return pipe.blockActivated(player); + RaytraceResult rayTraceResult = doRayTrace(world, pos, player); + if (rayTraceResult != null) { + EnumFacing hitSide = rayTraceResult.hitPart == Part.Pipe ? rayTraceResult.sideHit : null; + return pipe.blockActivated(player, hitSide); + } else { + return pipe.blockActivated(player, null); + } } else if (currentItem.getItem() instanceof IMapLocation) { // We want to be able to record pipe locations return false; @@ -770,7 +804,14 @@ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, En clickedGate.openGui(player); return true; } else { - return pipe.blockActivated(player); + if (pipe.blockActivated(player, side)) { + return true; + } + + if (rayTrace != null) { + EnumFacing hitSide = rayTrace.hitPart == Part.Pipe ? rayTrace.sideHit : null; + return pipe.blockActivated(player, hitSide); + } } } @@ -828,6 +869,7 @@ private boolean addWire(Pipe pipe, PipeWire color) { pipe.signalStrength[color.ordinal()] = 0; pipe.updateSignalState(); + pipe.container.scheduleRenderUpdate(); return true; } @@ -843,9 +885,7 @@ private boolean stripWire(Pipe pipe, PipeWire color, EntityPlayer player) { pipe.signalStrength[color.ordinal()] = 0; pipe.wireSet[color.ordinal()] = false; - pipe.updateSignalState(); - - updateNeighbourSignalState(pipe); + pipe.propagateSignalState(color, 0); if (isFullyDefined(pipe)) { pipe.resolveActions(); @@ -953,7 +993,7 @@ public static ItemPipe registerPipe(Class> clas, BCCreativeTab ItemPipe item = new ItemPipe(creativeTab); item.setUnlocalizedName("buildcraftPipe." + clas.getSimpleName().toLowerCase(Locale.ENGLISH)); - CoreProxy.proxy.registerItem(item, item.getUnlocalizedName()); + BCRegistry.INSTANCE.registerItem(item, true); pipes.put(item, clas); @@ -984,11 +1024,20 @@ public static Pipe createPipe(ItemPipe key) { return null; } - public static boolean placePipe(Pipe pipe, World world, BlockPos pos, IBlockState state, EntityPlayer player) { + public static boolean placePipe(Pipe pipe, World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side) { if (world.isRemote) { return true; } + if (player != null) { + IBlockState stateAgainst = world.getBlockState(pos.offset(side.getOpposite())); + BlockEvent.PlaceEvent placeEvent = new BlockEvent.PlaceEvent(new BlockSnapshot(world, pos, state), stateAgainst, player); + MinecraftForge.EVENT_BUS.post(placeEvent); + if (placeEvent.isCanceled()) { + return false; + } + } + boolean placed = world.setBlockState(pos, state, 3); if (placed) { @@ -997,7 +1046,7 @@ public static boolean placePipe(Pipe pipe, World world, BlockPos pos, IBlockS TileGenericPipe tilePipe = (TileGenericPipe) tile; tilePipe.initialize(pipe); tilePipe.sendNetworkUpdate(); - FMLCommonHandler.instance().bus().post(new PipePlacedEvent(player, pipe.item.getUnlocalizedName(), pos)); + MinecraftForge.EVENT_BUS.post(new PipePlacedEvent(player, pipe.item.getUnlocalizedName(), pos)); } } @@ -1141,23 +1190,7 @@ public boolean removeColorFromBlock(World world, BlockPos pos, EnumFacing side) return false; } - public static void updateNeighbourSignalState(Pipe pipe) { - if (pipe != null && pipe.container != null) { - TileBuffer[] neighbours = pipe.container.getTileCache(); - - if (neighbours != null) { - for (int i = 0; i < 6; i++) { - if (neighbours[i] != null && neighbours[i].getTile() instanceof IPipeTile && !neighbours[i].getTile().isInvalid() - && ((IPipeTile) neighbours[i].getTile()).getPipe() instanceof Pipe) { - ((Pipe) ((IPipeTile) neighbours[i].getTile()).getPipe()).updateSignalState(); - } - } - } - } - } - - // @Override - public TextureAtlasSprite getIcon(IBlockAccess world, BlockPos pos, int side) { + public TextureAtlasSprite getSprite(IBlockAccess world, BlockPos pos, EnumFacing side) { TileEntity tile = world.getTileEntity(pos); if (tile instanceof TileGenericPipe) { Pipe pipe = (Pipe) ((TileGenericPipe) tile).getPipe(); diff --git a/common/buildcraft/transport/FacadePluggable.java b/common/buildcraft/transport/FacadePluggable.java index 86d2d9b51f..1cb2f6ecf5 100644 --- a/common/buildcraft/transport/FacadePluggable.java +++ b/common/buildcraft/transport/FacadePluggable.java @@ -9,6 +9,8 @@ import net.minecraftforge.common.util.Constants; +import buildcraft.api.core.BCLog; +import buildcraft.api.transport.IPipe; import buildcraft.api.transport.IPipeTile; import buildcraft.api.transport.pluggable.IFacadePluggable; import buildcraft.api.transport.pluggable.IPipePluggableStaticRenderer; @@ -21,6 +23,7 @@ public class FacadePluggable extends PipePluggable implements IFacadePluggable { public ItemFacade.FacadeState[] states; private ItemFacade.FacadeState activeState; + private IPipeTile pipe; // Client sync private IBlockState state; @@ -33,6 +36,16 @@ public FacadePluggable(ItemFacade.FacadeState[] states) { public FacadePluggable() {} + @Override + public void invalidate() { + this.pipe = null; + } + + @Override + public void validate(IPipeTile pipe, EnumFacing direction) { + this.pipe = pipe; + } + @Override public boolean requiresRenderUpdate(PipePluggable o) { FacadePluggable other = (FacadePluggable) o; @@ -144,14 +157,35 @@ public void readData(ByteBuf data) { } private void prepareStates() { - if (activeState == null) { + if (states != null && states.length > 1) { + if (pipe == null || pipe.getPipe() == null) { + activeState = states[0]; + return; + } + + IPipe p = pipe.getPipe(); + int defaultStateId = -1; + int activeStateId = -1; + + for (int i = 0; i < states.length; i++) { + ItemFacade.FacadeState state = states[i]; + if (state.wire == null) { + defaultStateId = i; + continue; + } + if (p.isWireActive(state.wire)) { + activeStateId = i; + break; + } + } + + activeState = activeStateId < 0 ? (defaultStateId < 0 ? states[0] : states[defaultStateId]) : states[activeStateId]; + } else if (activeState == null) { activeState = states != null && states.length > 0 ? states[0] : null; } } - protected void setActiveState(int id) { - if (id >= 0 && id < states.length) { - activeState = states[id]; - } + public void setActiveState(int activeState2) { + BCLog.logger.error("TRIED TO SET THE ACTIVE STATE OF A FACEDE PLUGGABLE TO " + activeState2); } } diff --git a/common/buildcraft/transport/Gate.java b/common/buildcraft/transport/Gate.java index c9ab9d3d08..0823049aa9 100644 --- a/common/buildcraft/transport/Gate.java +++ b/common/buildcraft/transport/Gate.java @@ -1,12 +1,15 @@ -/** 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 */ +/** + * 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; import java.util.ArrayList; import java.util.Arrays; -import java.util.BitSet; import java.util.List; import com.google.common.collect.BiMap; @@ -55,8 +58,7 @@ public final class Gate implements IGate, ISidedStatementContainer, IRedstoneSta public ActionActiveState[] actionsState = new ActionActiveState[MAX_STATEMENTS]; public ArrayList activeActions = new ArrayList(); - public BitSet broadcastSignal = new BitSet(PipeWire.VALUES.length); - public BitSet prevBroadcastSignal = new BitSet(PipeWire.VALUES.length); + public byte broadcastSignal, prevBroadcastSignal; public int redstoneOutput = 0; public int redstoneOutputSide = 0; @@ -66,7 +68,7 @@ public final class Gate implements IGate, ISidedStatementContainer, IRedstoneSta private EnumFacing direction; private HashMultiset statementCounts = HashMultiset.create(); - private int[] actionGroups = new int[] { 0, 1, 2, 3, 4, 5, 6, 7 }; + private int[] actionGroups = new int[]{0, 1, 2, 3, 4, 5, 6, 7}; // / CONSTRUCTOR public Gate(Pipe pipe, GateMaterial material, GateLogic logic, EnumFacing direction) { @@ -198,9 +200,7 @@ public void writeToNBT(NBTTagCompound data) { writeStatementsToNBT(data); - for (PipeWire wire : PipeWire.VALUES) { - data.setBoolean("wireState[" + wire.ordinal() + "]", broadcastSignal.get(wire.ordinal())); - } + data.setByte("wireState", broadcastSignal); data.setByte("redstoneOutput", (byte) redstoneOutput); } @@ -292,8 +292,14 @@ public boolean verifyGateStatements() { public void readFromNBT(NBTTagCompound data) { readStatementsFromNBT(data); + if (data.hasKey("wireState[0]")) { for (PipeWire wire : PipeWire.VALUES) { - broadcastSignal.set(wire.ordinal(), data.getBoolean("wireState[" + wire.ordinal() + "]")); + if (data.getBoolean("wireState[" + wire.ordinal() + "]")) { + broadcastSignal |= 1 << wire.ordinal(); + } + } + } else { + broadcastSignal = data.getByte("wireState"); } redstoneOutput = data.getByte("redstoneOutput"); @@ -375,10 +381,8 @@ public void resolveActions() { boolean wasActive = activeActions.size() > 0; - BitSet temp = prevBroadcastSignal; - temp.clear(); prevBroadcastSignal = broadcastSignal; - broadcastSignal = temp; + broadcastSignal = 0; // Tell the gate to prepare for resolving actions. (Disable pulser) startResolution(); @@ -481,8 +485,8 @@ public void resolveActions() { pipe.updateNeighbors(true); } - if (!prevBroadcastSignal.equals(broadcastSignal)) { - pipe.updateSignalState(); + if (prevBroadcastSignal != broadcastSignal) { + pipe.scheduleWireUpdate(); } boolean isActive = activeActions.size() > 0; @@ -625,7 +629,7 @@ private void recalculateActionGroups() { } public void broadcastSignal(PipeWire color) { - broadcastSignal.set(color.ordinal()); + broadcastSignal |= 1 << color.ordinal(); } public IPipe getPipe() { diff --git a/common/buildcraft/transport/IDiamondPipe.java b/common/buildcraft/transport/IDiamondPipe.java index a88a7d0988..a42fb76cf8 100644 --- a/common/buildcraft/transport/IDiamondPipe.java +++ b/common/buildcraft/transport/IDiamondPipe.java @@ -1,5 +1,5 @@ /** 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; diff --git a/common/buildcraft/transport/IEmeraldPipe.java b/common/buildcraft/transport/IEmeraldPipe.java index c4512186b4..e82cdfb6cc 100644 --- a/common/buildcraft/transport/IEmeraldPipe.java +++ b/common/buildcraft/transport/IEmeraldPipe.java @@ -4,13 +4,13 @@ public interface IEmeraldPipe extends IFilteredPipe { - public enum FilterMode { + enum FilterMode { WHITE_LIST, BLACK_LIST, ROUND_ROBIN } - public class EmeraldPipeSettings { + class EmeraldPipeSettings { private FilterMode filterMode; public EmeraldPipeSettings(FilterMode defaultMode) { diff --git a/common/buildcraft/transport/IFilteredPipe.java b/common/buildcraft/transport/IFilteredPipe.java index 16e1038027..6c153c67bc 100644 --- a/common/buildcraft/transport/IFilteredPipe.java +++ b/common/buildcraft/transport/IFilteredPipe.java @@ -1,5 +1,5 @@ /** 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; @@ -10,5 +10,4 @@ public interface IFilteredPipe extends ISerializable { IInventory getFilters(); - } diff --git a/common/buildcraft/transport/IMCHandlerTransport.java b/common/buildcraft/transport/IMCHandlerTransport.java index a3b57e3341..8b6929de11 100644 --- a/common/buildcraft/transport/IMCHandlerTransport.java +++ b/common/buildcraft/transport/IMCHandlerTransport.java @@ -40,13 +40,14 @@ public static void processGateExpansionRecipeAddIMC(IMCEvent event, IMCMessage m NBTTagCompound recipe = msg.getNBTValue(); if (!recipe.hasKey("id") || !recipe.hasKey("expansion") || !recipe.hasKey("input")) { failed = true; - return; - } + } else { IGateExpansion exp = GateExpansions.getExpansion(recipe.getString("expansion")); ItemStack is = ItemStack.loadItemStackFromNBT(recipe.getCompoundTag("input")); if (exp == null || is == null) { failed = true; - return; + } else { + GateExpansions.registerExpansion(exp, is); + } } } if (failed) { diff --git a/common/buildcraft/transport/IPipeConnectionForced.java b/common/buildcraft/transport/IPipeConnectionForced.java index 7992a49633..3d86506827 100644 --- a/common/buildcraft/transport/IPipeConnectionForced.java +++ b/common/buildcraft/transport/IPipeConnectionForced.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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; import net.minecraft.util.EnumFacing; diff --git a/common/buildcraft/transport/IPipeTransportFluidsHook.java b/common/buildcraft/transport/IPipeTransportFluidsHook.java index 81a1df335c..7fc12b59c3 100644 --- a/common/buildcraft/transport/IPipeTransportFluidsHook.java +++ b/common/buildcraft/transport/IPipeTransportFluidsHook.java @@ -1,13 +1,16 @@ -/** 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 */ +/** + * 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; import net.minecraft.util.EnumFacing; import net.minecraftforge.fluids.FluidStack; public interface IPipeTransportFluidsHook { - int fill(EnumFacing from, FluidStack resource, boolean doFill); } diff --git a/common/buildcraft/transport/IPipeTransportPowerHook.java b/common/buildcraft/transport/IPipeTransportPowerHook.java index 353b680149..bfcd4d0495 100644 --- a/common/buildcraft/transport/IPipeTransportPowerHook.java +++ b/common/buildcraft/transport/IPipeTransportPowerHook.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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; import net.minecraft.util.EnumFacing; diff --git a/common/buildcraft/transport/ISolidSideTile.java b/common/buildcraft/transport/ISolidSideTile.java index 484c972098..870e28436e 100644 --- a/common/buildcraft/transport/ISolidSideTile.java +++ b/common/buildcraft/transport/ISolidSideTile.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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; import net.minecraft.util.EnumFacing; diff --git a/common/buildcraft/transport/ItemFacade.java b/common/buildcraft/transport/ItemFacade.java index 605079dfcd..51aec24f2c 100644 --- a/common/buildcraft/transport/ItemFacade.java +++ b/common/buildcraft/transport/ItemFacade.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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; import java.util.ArrayList; @@ -33,6 +37,7 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import buildcraft.BuildCraftCore; import buildcraft.BuildCraftTransport; import buildcraft.api.core.JavaTools; import buildcraft.api.facades.FacadeType; @@ -145,8 +150,13 @@ public static FacadeState[] readArray(NBTTagList list) { private static final Block NULL_BLOCK = null; private static final ItemStack NO_MATCH = new ItemStack(NULL_BLOCK, 0, 0); + private static final Block[] PREVIEW_FACADES = new Block[]{ + Blocks.planks, Blocks.stonebrick, Blocks.glass + }; + private static int RANDOM_FACADE_ID = -1; + public ItemFacade() { - super(BCCreativeTab.get("facades")); + super(BuildCraftTransport.showAllFacadesCreative ? BCCreativeTab.get("facades") : BCCreativeTab.get("main")); setHasSubtypes(true); setMaxDamage(0); @@ -156,7 +166,9 @@ public ItemFacade() { public String getItemStackDisplayName(ItemStack itemstack) { switch (getFacadeType(itemstack)) { case Basic: - return super.getItemStackDisplayName(itemstack) + ": " + getFacadeStateDisplayName(getFacadeStates(itemstack)[0]); + FacadeState[] states = getFacadeStates(itemstack); + String displayName = states.length > 0 ? getFacadeStateDisplayName(states[0]) : "CORRUPT"; + return super.getItemStackDisplayName(itemstack) + ": " + displayName; case Phased: return StringUtils.localize("item.FacadePhased.name"); default: @@ -215,12 +227,30 @@ public static String getFacadeStateDisplayName(FacadeState state) { @Override @SideOnly(Side.CLIENT) public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) { + if (BuildCraftTransport.showAllFacadesCreative) { for (ItemStack stack : allFacades) { itemList.add(stack); } for (ItemStack stack : allHollowFacades) { itemList.add(stack); } + } else { + List hollowFacades = new ArrayList(); + for (Block b : PREVIEW_FACADES) { + if (isBlockValidForFacade(b) && !isBlockBlacklisted(b)) { + ItemStack facade = getFacadeForBlock(b.getStateFromMeta(0)); + itemList.add(facade); + FacadeState state = getFacadeStates(facade)[0]; + hollowFacades.add(getFacade(new FacadeState(state.state, state.wire, true))); + } + } + if (RANDOM_FACADE_ID < 0) { + RANDOM_FACADE_ID = BuildCraftCore.random.nextInt(allFacades.size()); + } + itemList.add(allFacades.get(RANDOM_FACADE_ID)); + itemList.addAll(hollowFacades); + itemList.add(allHollowFacades.get(RANDOM_FACADE_ID)); + } } public void initialize() { diff --git a/common/buildcraft/transport/ItemGateCopier.java b/common/buildcraft/transport/ItemGateCopier.java index 4fd118162a..f8a79d8679 100644 --- a/common/buildcraft/transport/ItemGateCopier.java +++ b/common/buildcraft/transport/ItemGateCopier.java @@ -9,9 +9,11 @@ import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import buildcraft.api.transport.IPipeTile; import buildcraft.api.transport.pluggable.PipePluggable; import buildcraft.core.lib.items.ItemBuildCraft; import buildcraft.core.lib.utils.ModelHelper; @@ -43,32 +45,41 @@ public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, Bloc Block block = world.getBlockState(pos).getBlock(); TileEntity tile = world.getTileEntity(pos); NBTTagCompound data = NBTUtils.getItemData(stack); + PipePluggable pluggable = null; Gate gate = null; - if (tile == null || !(tile instanceof TileGenericPipe) || !(block instanceof BlockGenericPipe)) { + if (tile == null || !(tile instanceof IPipeTile)) { isCopying = true; } else { - RaytraceResult rayTraceResult = ((BlockGenericPipe) block).doRayTrace(world, pos, player); - - if (rayTraceResult != null && rayTraceResult.boundingBox != null && rayTraceResult.hitPart == Part.Pluggable) { - PipePluggable pluggable = ((TileGenericPipe) tile).getPipePluggable(rayTraceResult.sideHit); - if (pluggable instanceof GatePluggable) { - gate = ((TileGenericPipe) tile).pipe.gates[rayTraceResult.sideHit.ordinal()]; + if (tile instanceof TileGenericPipe && block instanceof BlockGenericPipe) { + RaytraceResult rayTraceResult = ((BlockGenericPipe) block).doRayTrace(world, pos, player); + if (rayTraceResult != null && rayTraceResult.boundingBox != null && rayTraceResult.hitPart == Part.Pluggable) { + pluggable = ((TileGenericPipe) tile).getPipePluggable(rayTraceResult.sideHit); } + } else { + pluggable = ((IPipeTile) tile).getPipePluggable(side); } } + if (pluggable instanceof GatePluggable) { + gate = ((GatePluggable) pluggable).realGate; + } + if (isCopying) { if (gate == null) { stack.setTagCompound(new NBTTagCompound()); player.addChatMessage(new ChatComponentTranslation("chat.gateCopier.clear")); - } else { - gate.writeStatementsToNBT(data); - data.setByte("material", (byte) gate.material.ordinal()); - data.setByte("logic", (byte) gate.logic.ordinal()); - player.addChatMessage(new ChatComponentTranslation("chat.gateCopier.gateCopied")); + return true; } + data = new NBTTagCompound(); + stack.setTagCompound(data); + + gate.writeStatementsToNBT(data); + data.setByte("material", (byte) gate.material.ordinal()); + data.setByte("logic", (byte) gate.logic.ordinal()); + player.addChatMessage(new ChatComponentTranslation("chat.gateCopier.gateCopied")); + // Tell ItemModelMesher that this is NOT damageable, so it will use the meta for the icon data.setBoolean("Unbreakable", true); @@ -104,7 +115,9 @@ public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, Bloc player.addChatMessage(new ChatComponentTranslation("chat.gateCopier.warning.load")); } - ((TileGenericPipe) tile).sendNetworkUpdate(); + if (tile instanceof TileGenericPipe) { + ((TileGenericPipe) tile).sendNetworkUpdate(); + } player.addChatMessage(new ChatComponentTranslation("chat.gateCopier.gatePasted")); return true; } diff --git a/common/buildcraft/transport/ItemPipe.java b/common/buildcraft/transport/ItemPipe.java index d026599514..b024ba209a 100644 --- a/common/buildcraft/transport/ItemPipe.java +++ b/common/buildcraft/transport/ItemPipe.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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; import java.util.List; @@ -70,7 +74,7 @@ public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World w return true; } - if (BlockGenericPipe.placePipe(pipe, world, pos, block.getDefaultState(), entityplayer)) { + if (BlockGenericPipe.placePipe(pipe, world, pos, block.getDefaultState(), entityplayer, side)) { block.onBlockPlacedBy(world, pos, block.getDefaultState(), entityplayer, itemstack); if (!world.isRemote) { @@ -82,12 +86,14 @@ public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World w .getVolume() + 1.0F) / 2.0F, block.stepSound.getFrequency() * 0.8F); itemstack.stackSize--; - } return true; } else { return false; } + } else { + return false; + } } @SideOnly(Side.CLIENT) @@ -116,7 +122,7 @@ public void addInformation(ItemStack stack, EntityPlayer player, List list, bool int color = (stack.getItemDamage() - 1) & 15; list.add(ColorUtils.getFormattingTooltip(color) + EnumChatFormatting.ITALIC + StringUtils.localize("color." + ColorUtils.getName(color))); } - Class pipe = BlockGenericPipe.pipes.get(this); + Class> pipe = BlockGenericPipe.pipes.get(this); List toolTip = PipeToolTipManager.getToolTip(pipe, advanced); list.addAll(toolTip); } diff --git a/common/buildcraft/transport/ItemPipeWire.java b/common/buildcraft/transport/ItemPipeWire.java index f18f11e4c3..86ca85affd 100644 --- a/common/buildcraft/transport/ItemPipeWire.java +++ b/common/buildcraft/transport/ItemPipeWire.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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; import java.util.List; diff --git a/common/buildcraft/transport/LensFilterHandler.java b/common/buildcraft/transport/LensFilterHandler.java index e98dbf95d4..c66fca5014 100644 --- a/common/buildcraft/transport/LensFilterHandler.java +++ b/common/buildcraft/transport/LensFilterHandler.java @@ -22,12 +22,17 @@ public void eventHandler(PipeEventItem.FindDest event) { for (EnumFacing dir : event.destinations) { int sideColor = -1; + int sideLensColor = -1; // Get the side's color // (1/2) From this pipe's outpost PipePluggable pluggable = container.getPipePluggable(dir); - if (pluggable != null && pluggable instanceof LensPluggable && ((LensPluggable) pluggable).isFilter) { + if (pluggable != null && pluggable instanceof LensPluggable) { + if (((LensPluggable) pluggable).isFilter) { sideColor = ((LensPluggable) pluggable).color; + } else { + sideLensColor = ((LensPluggable) pluggable).color; + } } // (2/2) From the other pipe's outpost @@ -37,9 +42,16 @@ public void eventHandler(PipeEventItem.FindDest event) { pluggable = otherContainer.getPipePluggable(dir.getOpposite()); if (pluggable != null && pluggable instanceof LensPluggable && ((LensPluggable) pluggable).isFilter) { int otherColor = ((LensPluggable) pluggable).color; - // Check if colors conflict - if so, the side is unpassable if (sideColor >= 0 && otherColor != sideColor) { + // Filter colors conflict - the side is unpassable continue; + } else if (sideLensColor >= 0) { + // The closer lens color differs from the further away filter color - the side is unpassable OR treated as colorless + if (sideLensColor == otherColor) { + sideColor = -1; + } else { + continue; + } } else { sideColor = otherColor; } diff --git a/common/buildcraft/transport/Pipe.java b/common/buildcraft/transport/Pipe.java index 3689d6b3ce..36829ae1f6 100644 --- a/common/buildcraft/transport/Pipe.java +++ b/common/buildcraft/transport/Pipe.java @@ -1,14 +1,10 @@ /** 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; -import java.util.ArrayList; -import java.util.Collection; -import java.util.LinkedList; -import java.util.List; -import java.util.Random; +import java.util.*; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -41,7 +37,7 @@ import buildcraft.transport.pipes.events.PipeEvent; import buildcraft.transport.statements.ActionValve.ValveState; -public abstract class Pipe implements IDropControlInventory, IPipe { +public abstract class Pipe implements IDropControlInventory, IPipe, Comparable> { // TODO: Change this to EventBusProviderASM! private static final IEventBusProvider eventProvider = PipeEventBus.Provider.INSTANCE; @@ -53,8 +49,8 @@ public abstract class Pipe implements IDropControlInven public final Gate[] gates = new Gate[EnumFacing.VALUES.length]; public IEventBus eventBus = eventProvider.newBus(); - private boolean internalUpdateScheduled = false; private boolean initialized = false; + private boolean scheduleWireUpdate; private ArrayList actionStates = new ArrayList(); @@ -63,8 +59,6 @@ public Pipe(T transport, Item item) { 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) { @@ -80,7 +74,7 @@ public void resolveActions() { } } - public boolean blockActivated(EntityPlayer entityplayer) { + public boolean blockActivated(EntityPlayer player, EnumFacing side) { return false; } @@ -91,8 +85,9 @@ public void onBlockPlaced() { public void onBlockPlacedBy(EntityLivingBase placer) {} public void onNeighborBlockChange(int blockId) { - transport.onNeighborBlockChange(blockId); - + for (EnumFacing face : EnumFacing.values()) { + transport.onNeighborChange(face); + } } public boolean canPipeConnect(TileEntity tile, EnumFacing side) { @@ -134,11 +129,6 @@ public int getIconIndexForItem() { public void updateEntity() { transport.updateEntity(); - if (internalUpdateScheduled) { - internalUpdate(); - internalUpdateScheduled = false; - } - actionStates.clear(); // Update the gate if we have any @@ -149,11 +139,11 @@ public void updateEntity() { gate.tick(); } } - } - } - private void internalUpdate() { - updateSignalState(); + if (scheduleWireUpdate) { + updateSignalState(); + } + } } public void writeToNBT(NBTTagCompound data) { @@ -207,107 +197,91 @@ public void initialize() { initialized = true; } - private void readNearbyPipesSignal(PipeWire color) { - boolean foundBiggerSignal = false; - - for (EnumFacing o : EnumFacing.VALUES) { - TileEntity tile = container.getTile(o); + public void updateSignalState() { + for (PipeWire c : PipeWire.values()) { + if (wireSet[c.ordinal()]) { + updateSignalState(c); + } + } + } - if (tile instanceof IPipeTile) { - IPipeTile tilePipe = (IPipeTile) tile; - Pipe pipe = (Pipe) tilePipe.getPipe(); + private void updateSignalState(PipeWire c) { + int prevStrength = signalStrength[c.ordinal()]; + boolean isBroadcast = false; - if (BlockGenericPipe.isFullyDefined(pipe)) { - if (isWireConnectedTo(tile, color, o)) { - foundBiggerSignal |= receiveSignal(pipe.signalStrength[color.ordinal()] - 1, color); - } - } + for (Gate g : gates) { + if (g != null && (g.broadcastSignal & (1 << c.ordinal())) != 0) { + isBroadcast = true; + break; } } - if (!foundBiggerSignal && signalStrength[color.ordinal()] != 0) { - signalStrength[color.ordinal()] = 0; - // worldObj.markBlockNeedsUpdate(container.xCoord, container.yCoord, zCoord); - container.scheduleRenderUpdate(); - - for (EnumFacing o : EnumFacing.VALUES) { - TileEntity tile = container.getTile(o); + if (isBroadcast) { + if (prevStrength < 255) { + propagateSignalState(c, 255); + } + } else { + List> pipes = new ArrayList>(); + int maxStrength = 0; + for (EnumFacing dir : EnumFacing.values()) { + TileEntity tile = container.getTile(dir); if (tile instanceof IPipeTile) { - IPipeTile tilePipe = (IPipeTile) tile; - Pipe pipe = (Pipe) tilePipe.getPipe(); - - if (BlockGenericPipe.isFullyDefined(pipe)) { - pipe.internalUpdateScheduled = true; + Pipe pipe = (Pipe) ((IPipeTile) tile).getPipe(); + if (isWireConnectedTo(tile, pipe, c, dir)) { + pipes.add(pipe); + int pipeStrength = pipe.signalStrength[c.ordinal()]; + if (pipeStrength > maxStrength) { + maxStrength = pipeStrength; + } } } } - } - } - - public void updateSignalState() { - for (PipeWire c : PipeWire.values()) { - updateSignalStateForColor(c); - } - } - - private void updateSignalStateForColor(PipeWire wire) { - if (!wireSet[wire.ordinal()]) { - return; - } - - // STEP 1: compute internal signal strength - boolean readNearbySignal = true; - for (Gate gate : gates) { - if (gate != null && gate.broadcastSignal.get(wire.ordinal())) { - receiveSignal(255, wire); - readNearbySignal = false; + if (maxStrength > prevStrength && maxStrength > 1) { + signalStrength[c.ordinal()] = maxStrength - 1; + } else { + signalStrength[c.ordinal()] = 0; } - } - - if (readNearbySignal) { - readNearbyPipesSignal(wire); - } - // STEP 2: transmit signal in nearby blocks - - if (signalStrength[wire.ordinal()] > 1) { - for (EnumFacing o : EnumFacing.VALUES) { - TileEntity tile = container.getTile(o); - - if (tile instanceof IPipeTile) { - IPipeTile tilePipe = (IPipeTile) tile; - Pipe pipe = (Pipe) tilePipe.getPipe(); + if (prevStrength != signalStrength[c.ordinal()]) { + container.scheduleRenderUpdate(); + } - if (BlockGenericPipe.isFullyDefined(pipe) && pipe.wireSet[wire.ordinal()]) { - if (isWireConnectedTo(tile, wire, o)) { - pipe.receiveSignal(signalStrength[wire.ordinal()] - 1, wire); - } + if (signalStrength[c.ordinal()] == 0) { + for (Pipe p : pipes) { + if (p.signalStrength[c.ordinal()] > 0) { + p.updateSignalState(c); + } + } + } else { + for (Pipe p : pipes) { + if (p.signalStrength[c.ordinal()] < (signalStrength[c.ordinal()] - 1)) { + p.updateSignalState(c); } } } } } - private boolean receiveSignal(int signal, PipeWire color) { - if (container.getWorld() == null) { - return false; - } - - int oldSignal = signalStrength[color.ordinal()]; - - if (signal >= signalStrength[color.ordinal()] && signal != 0) { - signalStrength[color.ordinal()] = signal; - internalUpdateScheduled = true; - - if (oldSignal == 0) { - container.scheduleRenderUpdate(); + protected void propagateSignalState(PipeWire c, int s) { + signalStrength[c.ordinal()] = s; + for (EnumFacing face : EnumFacing.values()) { + TileEntity tile = container.getTile(face); + if (tile instanceof IPipeTile) { + Pipe pipe = (Pipe) ((IPipeTile) tile).getPipe(); + if (isWireConnectedTo(tile, pipe, c, face)) { + if (s == 0) { + if (pipe.signalStrength[c.ordinal()] > 0) { + pipe.updateSignalState(c); + } + } else { + if (pipe.signalStrength[c.ordinal()] < s) { + pipe.updateSignalState(c); + } + } + } } - - return true; - } else { - return false; } } @@ -426,9 +400,7 @@ public ArrayList computeItemDrop() { for (EnumFacing direction : EnumFacing.VALUES) { if (container.hasPipePluggable(direction)) { - for (ItemStack stack : container.getPipePluggable(direction).getDropItems(container)) { - result.add(stack); - } + Collections.addAll(result, container.getPipePluggable(direction).getDropItems(container)); } } @@ -454,7 +426,7 @@ public void resetGates() { gates[i] = null; } - internalUpdateScheduled = true; + scheduleWireUpdate = true; container.scheduleRenderUpdate(); } @@ -469,8 +441,10 @@ public boolean isWireConnectedTo(TileEntity tile, PipeWire color, EnumFacing dir return false; } - Pipe pipe = (Pipe) ((IPipeTile) tile).getPipe(); + return isWireConnectedTo(tile, (Pipe) (((IPipeTile) tile).getPipe()), color, dir); + } + public boolean isWireConnectedTo(TileEntity tile, Pipe pipe, PipeWire color, EnumFacing dir) { if (!BlockGenericPipe.isFullyDefined(pipe)) { return false; } @@ -558,4 +532,12 @@ private void pushActionState(ActionState state) { private Collection getActionStates() { return actionStates; } + + public void scheduleWireUpdate() { + scheduleWireUpdate = true; + } + + public int compareTo(Pipe pipe) { + return 0; + } } diff --git a/common/buildcraft/transport/PipeColoringRecipe.java b/common/buildcraft/transport/PipeColoringRecipe.java index ecbfabaa69..2d9644342d 100644 --- a/common/buildcraft/transport/PipeColoringRecipe.java +++ b/common/buildcraft/transport/PipeColoringRecipe.java @@ -10,7 +10,6 @@ import buildcraft.core.lib.utils.ColorUtils; public class PipeColoringRecipe implements IRecipe { - private ItemStack getResult(InventoryCrafting crafting) { ItemStack oneColorPipeStack = null; ItemStack pipeStack = null; diff --git a/common/buildcraft/transport/PipeConnectionBans.java b/common/buildcraft/transport/PipeConnectionBans.java index ed3af99371..2bb5c87c54 100644 --- a/common/buildcraft/transport/PipeConnectionBans.java +++ b/common/buildcraft/transport/PipeConnectionBans.java @@ -1,5 +1,5 @@ /** 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; @@ -16,11 +16,10 @@ public final class PipeConnectionBans { static { // Fluid pipes - banConnection(PipeFluidsStone.class, PipeFluidsCobblestone.class); + banConnection(PipeFluidsStone.class, PipeFluidsCobblestone.class, PipeFluidsQuartz.class); banConnection(PipeFluidsWood.class); banConnection(PipeFluidsEmerald.class); banConnection(PipeFluidsWood.class, PipeFluidsEmerald.class); - banConnection(PipeFluidsEmerald.class); // Item Pipes banConnection(PipeItemsStone.class, PipeItemsCobblestone.class, PipeItemsQuartz.class); diff --git a/common/buildcraft/transport/PipeEventBus.java b/common/buildcraft/transport/PipeEventBus.java index 6e20180b90..65fdf49c47 100644 --- a/common/buildcraft/transport/PipeEventBus.java +++ b/common/buildcraft/transport/PipeEventBus.java @@ -97,7 +97,7 @@ public void registerHandler(Object handler) { for (Method m : handler.getClass().getDeclaredMethods()) { if ("eventHandler".equals(m.getName())) { - Class[] parameters = m.getParameterTypes(); + Class[] parameters = m.getParameterTypes(); if (parameters.length == 1 && PipeEvent.class.isAssignableFrom(parameters[0])) { Class eventType = (Class) parameters[0]; List eventHandlerList = getHandlerList(eventType); diff --git a/common/buildcraft/transport/PipeIconProvider.java b/common/buildcraft/transport/PipeIconProvider.java index 86b0d7ca55..43d72b9bdf 100644 --- a/common/buildcraft/transport/PipeIconProvider.java +++ b/common/buildcraft/transport/PipeIconProvider.java @@ -1,5 +1,5 @@ /** 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; @@ -10,13 +10,14 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.item.EnumDyeColor; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import buildcraft.BuildCraftCore; -import buildcraft.api.core.EnumColor; import buildcraft.api.core.IIconProvider; public class PipeIconProvider implements IIconProvider { @@ -104,6 +105,7 @@ public enum TYPE { PipeFluidsSandstone("sandstone_fluid"), PipeFluidsStone("stone_fluid"), PipeFluidsVoid("void_fluid"), + PipeFluidsClay("clay_fluid"), // PipeFluidsDiamond_Item("diamond_fluid_itemstack"), PipeFluidsDiamond_Center("diamond_fluid"), @@ -163,19 +165,19 @@ public enum TYPE { @SideOnly(Side.CLIENT) private TextureAtlasSprite icon; - private TYPE(String iconTag, String iconTagColorBlind) { + TYPE(String iconTag, String iconTagColorBlind) { this.iconTag = iconTag; this.iconTagColorBlind = iconTagColorBlind; } - private TYPE(String iconTag) { + TYPE(String iconTag) { this(iconTag, iconTag); } @SideOnly(Side.CLIENT) private void registerIcon(TextureMap iconRegister) { String name = BuildCraftCore.colorBlindMode ? iconTagColorBlind : iconTag; - if (name.indexOf(":") < 0) { + if (!name.contains(":")) { name = "transport:pipes/" + name; } icon = iconRegister.registerSprite(new ResourceLocation("buildcraft" + name)); @@ -187,7 +189,7 @@ public TextureAtlasSprite getIcon() { } public static final Map diamondPipeItems, diamondPipeFluids; - public static final Map lapisPipe, dazuliPipe; + public static final Map lapisPipe, dazuliPipe; static { diamondPipeItems = Maps.newHashMap(); @@ -202,7 +204,7 @@ public TextureAtlasSprite getIcon() { lapisPipe = Maps.newHashMap(); dazuliPipe = Maps.newHashMap(); - for (EnumColor face : EnumColor.VALUES) { + for (EnumDyeColor face : EnumDyeColor.values()) { lapisPipe.put(face, TYPE.VALUES[TYPE.PipeItemsLapis_Black.ordinal() + face.ordinal()]); dazuliPipe.put(face, TYPE.VALUES[TYPE.PipeItemsDaizuli_Black.ordinal() + face.ordinal()]); } diff --git a/common/buildcraft/transport/PipePluggableState.java b/common/buildcraft/transport/PipePluggableState.java index 115a067e4a..58b077a594 100644 --- a/common/buildcraft/transport/PipePluggableState.java +++ b/common/buildcraft/transport/PipePluggableState.java @@ -11,7 +11,7 @@ import io.netty.buffer.ByteBuf; -public class PipePluggableState implements ISerializable, IPipePluggableState { +public class PipePluggableState implements ISerializable, IPipePluggableState , Comparable{ private PipePluggable[] pluggables = new PipePluggable[6]; private final ConnectionMatrix pluggableMatrix = new ConnectionMatrix(); @@ -48,12 +48,17 @@ public void readData(ByteBuf data) { for (EnumFacing dir : EnumFacing.VALUES) { if (this.pluggableMatrix.isConnected(dir)) { try { - PipePluggable p = PipeManager.pipePluggables.get(data.readUnsignedShort()).newInstance(); - p.readData(data); + Class pc = PipeManager.pipePluggables.get(data.readUnsignedShort()); + if (pluggables[dir.ordinal()] == null || pc != pluggables[dir.ordinal()].getClass()) { + PipePluggable p = pc.newInstance(); pluggables[dir.ordinal()] = p; + } } catch (Exception e) { e.printStackTrace(); } + if (pluggables[dir.ordinal()] != null) { + pluggables[dir.ordinal()].readData(data); + } } else { pluggables[dir.ordinal()] = null; } @@ -72,4 +77,9 @@ public PipePluggable getPluggable(EnumFacing face) { } return pluggables[face.ordinal()]; } + + @Override + public int compareTo(PipePluggableState o) { + return 0; + } } diff --git a/common/buildcraft/transport/PipeRenderState.java b/common/buildcraft/transport/PipeRenderState.java index 8e53bb54aa..8d724a9ee1 100644 --- a/common/buildcraft/transport/PipeRenderState.java +++ b/common/buildcraft/transport/PipeRenderState.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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; import net.minecraft.util.EnumFacing; @@ -15,7 +19,7 @@ import io.netty.buffer.ByteBuf; -public class PipeRenderState implements ISerializable, IPipeRenderState { +public class PipeRenderState implements ISerializable, IPipeRenderState, Comparable { public final ConnectionMatrix pipeConnectionMatrix = new ConnectionMatrix(); public final ConnectionMatrix pipeConnectionExtensions = new ConnectionMatrix(); public final ConnectionMatrix pipeConnectionBanned = new ConnectionMatrix(); @@ -42,7 +46,10 @@ public byte getGlassColor() { } public void setGlassColor(byte color) { + if (this.glassColor != color) { this.glassColor = color; + this.glassColorDirty = true; + } } public boolean isDirty() { @@ -109,4 +116,9 @@ public void readData(ByteBuf data) { public IConnectionMatrix getPipeConnectionMatrix() { return pipeConnectionMatrix; } + + @Override + public int compareTo(PipeRenderState o) { + return 0; + } } diff --git a/common/buildcraft/transport/PipeToolTipManager.java b/common/buildcraft/transport/PipeToolTipManager.java index 521fda2fd4..a1990af739 100644 --- a/common/buildcraft/transport/PipeToolTipManager.java +++ b/common/buildcraft/transport/PipeToolTipManager.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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; import java.util.ArrayList; @@ -53,7 +57,7 @@ public static void addToolTip(Class> pipe, String toolTip) { toolTips.put(pipe, toolTip); } - public static List getToolTip(Class pipe, boolean advanced) { + public static List getToolTip(Class> pipe, boolean advanced) { List tips = new ArrayList(); addTipToList("tip." + pipe.getSimpleName(), tips); diff --git a/common/buildcraft/transport/PipeTransport.java b/common/buildcraft/transport/PipeTransport.java index b6bc6aeaef..14441d1d45 100644 --- a/common/buildcraft/transport/PipeTransport.java +++ b/common/buildcraft/transport/PipeTransport.java @@ -1,7 +1,7 @@ /** 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 */ + *

+ * 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; import java.util.ArrayList; @@ -39,8 +39,8 @@ public World getWorld() { public void readFromNBT(NBTTagCompound nbt) { if (nbt.hasKey("inputOpen") && nbt.hasKey("outputOpen")) { - BitSet inputBuf = BitSetUtils.fromByteArray(new byte[] { nbt.getByte("inputOpen") }); - BitSet outputBuf = BitSetUtils.fromByteArray(new byte[] { nbt.getByte("outputOpen") }); + BitSet inputBuf = BitSetUtils.fromByteArray(new byte[]{nbt.getByte("inputOpen")}); + BitSet outputBuf = BitSetUtils.fromByteArray(new byte[]{nbt.getByte("outputOpen")}); for (int b = 0; b < EnumFacing.VALUES.length; b++) { inputsOpen[b] = inputBuf.get(b); @@ -81,7 +81,7 @@ public boolean canPipeConnect(TileEntity tile, EnumFacing side) { return true; } - public void onNeighborBlockChange(int blockId) {} + public void onNeighborChange(EnumFacing direction) {} public void onBlockPlaced() {} diff --git a/common/buildcraft/transport/PipeTransportFluids.java b/common/buildcraft/transport/PipeTransportFluids.java index d80cc5d7b3..101d047047 100644 --- a/common/buildcraft/transport/PipeTransportFluids.java +++ b/common/buildcraft/transport/PipeTransportFluids.java @@ -5,7 +5,7 @@ import java.util.List; import java.util.Map; -import com.google.common.collect.HashMultiset; +import com.google.common.collect.EnumMultiset; import com.google.common.collect.Multiset; import net.minecraft.nbt.NBTTagCompound; @@ -15,7 +15,6 @@ import net.minecraft.util.Vec3; import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidEvent; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTankInfo; @@ -23,10 +22,10 @@ import buildcraft.BuildCraftCore; import buildcraft.BuildCraftTransport; +import buildcraft.api.core.EnumPipePart; import buildcraft.api.core.SafeTimeTracker; import buildcraft.api.tiles.IDebuggable; import buildcraft.api.transport.IPipeTile; -import buildcraft.api.transport.pipe_bc8.EnumPipePart; import buildcraft.core.DefaultProps; import buildcraft.core.lib.utils.MathUtils; import buildcraft.core.lib.utils.Utils; @@ -40,7 +39,6 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler, /** The amount of liquid contained by a pipe section. For simplicity, all pipe sections are assumed to be of the * same volume. */ - public static int LIQUID_IN_PIPE = FluidContainerRegistry.BUCKET_VOLUME / 4; public static int MAX_TRAVEL_DELAY = 12; public static short INPUT_TTL = 60; // 100 public static short OUTPUT_TTL = 80; // 80 @@ -101,7 +99,7 @@ public void reset() { } /** Get the amount of fluid available to move. This nicely takes care of the travel delay mechanic. - * + * * @return */ public int getAvailable() { int all = amount; @@ -112,7 +110,7 @@ public int getAvailable() { } public int getMaxFillRate() { - return Math.min(capacity - amount, flowRate - incoming[currentTime]); + return Math.min(getCapacity() - amount, flowRate - incoming[currentTime]); } public void readFromNBT(NBTTagCompound compoundTag) { @@ -144,7 +142,6 @@ public void writeToNBT(NBTTagCompound subTag) { private final short[] outputTTL = new short[] { OUTPUT_TTL, OUTPUT_TTL, OUTPUT_TTL, OUTPUT_TTL, OUTPUT_TTL, OUTPUT_TTL }; private final short[] outputCooldown = new short[] { 0, 0, 0, 0, 0, 0 }; private final boolean[] canReceiveCache = new boolean[6]; - private byte initClient = 0; private int clientSyncCounter = 0; private int capacity, flowRate; private int travelDelay = MAX_TRAVEL_DELAY; @@ -169,6 +166,9 @@ public PipeTransportFluids() { sections[6] = new PipeSection(); } + /** This value has to be the same on client and server! + * + * @return */ public int getCapacity() { return capacity; } @@ -178,9 +178,9 @@ public int getFlowRate() { } public void initFromPipe(Class> pipeClass) { - capacity = LIQUID_IN_PIPE; + capacity = 25 * Math.min(1000, BuildCraftTransport.pipeFluidsBaseFlowRate); flowRate = fluidCapacities.get(pipeClass); - travelDelay = MathUtils.clamp(Math.round(16 / (flowRate / 10)), 1, MAX_TRAVEL_DELAY); + travelDelay = MathUtils.clamp(Math.round(16F / (flowRate / BuildCraftTransport.pipeFluidsBaseFlowRate)), 1, MAX_TRAVEL_DELAY); } @Override @@ -229,13 +229,11 @@ public void updateEntity() { flow[i] = 0; } - if (fluidType != null) { - moveFluids(); - } + moveFluids(); if (networkSyncTracker.markTimeIfDelay(container.getWorld())) { boolean init = false; - if (++clientSyncCounter > BuildCraftCore.longUpdateFactor) { + if (++clientSyncCounter > BuildCraftCore.longUpdateFactor * 2) { clientSyncCounter = 0; init = true; } @@ -248,17 +246,20 @@ public void updateEntity() { } private void moveFluids() { - short newTimeSlot = (short) (container.getWorld().getTotalWorldTime() % travelDelay); - short outputCount = computeCurrentConnectionStatesAndTickFlows(newTimeSlot > 0 && newTimeSlot < travelDelay ? newTimeSlot : 0); + if (fluidType != null) { + short newTimeSlot = (short) (container.getWorld().getTotalWorldTime() % travelDelay); + int outputCount = computeCurrentConnectionStatesAndTickFlows(newTimeSlot > 0 && newTimeSlot < travelDelay ? newTimeSlot : 0); - moveFromPipe(outputCount); - moveFromCenter(); - moveToCenter(); + moveFromPipe(outputCount); + moveFromCenter(); + moveToCenter(); + } else { + computeTTLs(); + } } - private void moveFromPipe(short outputCount) { + private void moveFromPipe(int outputCount) { // Move liquid from the non-center to the connected output blocks - boolean pushed = false; if (outputCount > 0) { for (EnumFacing o : directions) { if (transferState[o.ordinal()] == TransferState.Output) { @@ -272,28 +273,15 @@ private void moveFromPipe(short outputCount) { if (liquidToPush.amount > 0) { int filled = ((IFluidHandler) target).fill(o.getOpposite(), liquidToPush, true); - section.drain(filled, true); - pushed = true; if (filled <= 0) { outputTTL[o.ordinal()]--; + } else { + section.drain(filled, true); } } } } } - - if (pushed) { - boolean hasFluid = false; - for (PipeSection s : sections) { - if (s.amount > 0) { - hasFluid = true; - break; - } - } - if (!hasFluid) { - setFluidType(null); - } - } } private void moveFromCenter() { @@ -306,7 +294,7 @@ private void moveFromCenter() { int testAmount = flowRate; // Move liquid from the center to the output sides - Multiset realDirections = HashMultiset.create(6); + Multiset realDirections = EnumMultiset.create(EnumFacing.class); for (EnumFacing direction : directions) { if (transferState[direction.ordinal()] == TransferState.Output) { realDirections.add(direction); @@ -336,21 +324,22 @@ private void moveFromCenter() { private void moveToCenter() { int transferInCount = 0; - int spaceAvailable = capacity - sections[6].amount; + int spaceAvailable = getCapacity() - sections[6].amount; for (EnumFacing dir : directions) { inputPerTick[dir.ordinal()] = 0; if (transferState[dir.ordinal()] != TransferState.Output) { inputPerTick[dir.ordinal()] = sections[dir.ordinal()].drain(flowRate, false); - transferInCount++; + if (inputPerTick[dir.ordinal()] > 0) { + transferInCount++; + } } } float min = Math.min(flowRate * transferInCount, spaceAvailable) / (float) flowRate / transferInCount; for (EnumFacing dir : directions) { // Move liquid from input sides to the center - if (transferState[dir.ordinal()] != TransferState.Output && inputPerTick[dir.ordinal()] > 0) { - + if (inputPerTick[dir.ordinal()] > 0) { int amountToDrain = (int) (inputPerTick[dir.ordinal()] * min); if (amountToDrain < 1) { amountToDrain++; @@ -366,46 +355,71 @@ private void moveToCenter() { } } - private short computeCurrentConnectionStatesAndTickFlows(short newTimeSlot) { - short outputCount = 0; + private void computeTTLs() { + for (int i = 0; i < 6; i++) { + if (transferState[i] == TransferState.Input) { + if (inputTTL[i] > 0) { + inputTTL[i]--; + } else { + transferState[i] = TransferState.None; + } + } + + if (outputCooldown[i] > 0) { + outputCooldown[i]--; + } + } + } + + private int computeCurrentConnectionStatesAndTickFlows(short newTimeSlot) { + int outputCount = 0; + int fluidAmount = 0; // Processes all internal tanks - for (int ordinal : orientations) { - sections[ordinal].setTime(newTimeSlot); - sections[ordinal].moveFluids(); - if (ordinal == 6) { + for (EnumPipePart direction : EnumPipePart.values()) { + int dirI = direction.ordinal(); + PipeSection section = sections[dirI]; + + fluidAmount += section.amount; + section.setTime(newTimeSlot); + section.moveFluids(); + + // Input processing + if (direction == EnumPipePart.CENTER) { continue; } - EnumFacing direction = EnumFacing.VALUES[ordinal]; - sections[ordinal].setTime(newTimeSlot); - sections[ordinal].moveFluids(); - if (transferState[ordinal] == TransferState.Input) { - inputTTL[ordinal]--; - if (inputTTL[ordinal] <= 0) { - transferState[ordinal] = TransferState.None; + if (transferState[dirI] == TransferState.Input) { + inputTTL[dirI]--; + if (inputTTL[dirI] <= 0) { + transferState[dirI] = TransferState.None; } continue; } - if (!container.pipe.outputOpen(direction)) { - transferState[ordinal] = TransferState.None; + if (!container.pipe.outputOpen(direction.face)) { + transferState[dirI] = TransferState.None; continue; } - if (outputCooldown[ordinal] > 0) { - outputCooldown[ordinal]--; + if (outputCooldown[dirI] > 0) { + outputCooldown[dirI]--; continue; } - if (outputTTL[ordinal] <= 0) { - transferState[ordinal] = TransferState.None; - outputCooldown[ordinal] = OUTPUT_COOLDOWN; - outputTTL[ordinal] = OUTPUT_TTL; + if (outputTTL[dirI] <= 0) { + transferState[dirI] = TransferState.None; + outputCooldown[dirI] = OUTPUT_COOLDOWN; + outputTTL[dirI] = OUTPUT_TTL; continue; } - if (canReceiveCache[ordinal] && outputOpen(direction)) { - transferState[ordinal] = TransferState.Output; + if (canReceiveCache[dirI] && container.pipe.outputOpen(direction.face)) { + transferState[dirI] = TransferState.Output; outputCount++; } } + + if (fluidAmount == 0) { + setFluidType(null); + } + return outputCount; } @@ -418,21 +432,14 @@ private PacketFluidUpdate computeFluidUpdate(boolean initPacket, boolean persist boolean changed = false; BitSet delta = new BitSet(8); - if (initClient > 0) { - initClient -= NETWORK_SYNC_TICKS; - if (initClient <= 1) { - changed = true; - initClient = 0; - delta.set(0, 8); - } - } - FluidRenderData renderCacheCopy = this.renderCache; - if ((fluidType == null && renderCacheCopy.fluidID != 0) || (fluidType != null && renderCacheCopy.fluidID != fluidType.getFluid().getID())) { + if (initPacket || (fluidType == null && renderCacheCopy.fluidID != 0) || (fluidType != null && renderCacheCopy.fluidID != fluidType.getFluid() + .getID())) { changed = true; renderCache.fluidID = fluidType != null ? fluidType.getFluid().getID() : 0; renderCache.color = fluidType != null ? fluidType.getFluid().getColor(fluidType) : 0; + renderCache.flags = FluidRenderData.getFlags(fluidType); delta.set(0); } @@ -443,7 +450,7 @@ private PacketFluidUpdate computeFluidUpdate(boolean initPacket, boolean persist if (displayQty == 0 && camount > 0 || initPacket) { displayQty = camount; } - displayQty = Math.min(capacity, displayQty); + displayQty = Math.min(getCapacity(), displayQty); if (pamount != displayQty || initPacket) { changed = true; @@ -483,7 +490,8 @@ private void setFluidType(FluidStack type) { public void sendDescriptionPacket() { super.sendDescriptionPacket(); - initClient = 6; + PacketFluidUpdate update = computeFluidUpdate(true, true); + BuildCraftTransport.instance.sendToPlayers(update, container.getWorld(), container.getPos(), DefaultProps.PIPE_CONTENTS_RENDER_DIST); } public FluidStack getStack(EnumFacing direction) { @@ -615,18 +623,16 @@ public FluidTankInfo[] getTankInfo(EnumFacing from) { } @Override - public void onNeighborBlockChange(int blockId) { - super.onNeighborBlockChange(blockId); + public void onNeighborChange(EnumFacing direction) { + super.onNeighborChange(direction); - for (EnumFacing direction : directions) { - if (!container.isPipeConnected(direction)) { - sections[direction.ordinal()].reset(); - transferState[direction.ordinal()] = TransferState.None; - renderCache.amount[direction.ordinal()] = 0; - canReceiveCache[direction.ordinal()] = false; - } else { - canReceiveCache[direction.ordinal()] = canReceiveFluid(direction); - } + if (!container.isPipeConnected(direction)) { + sections[direction.ordinal()].reset(); + transferState[direction.ordinal()] = TransferState.None; + renderCache.amount[direction.ordinal()] = 0; + canReceiveCache[direction.ordinal()] = false; + } else { + canReceiveCache[direction.ordinal()] = canReceiveFluid(direction); } } @@ -647,16 +653,21 @@ public boolean canPipeConnect(TileEntity tile, EnumFacing side) { } static { + fluidCapacities.put(PipeFluidsVoid.class, 1 * BuildCraftTransport.pipeFluidsBaseFlowRate); + + fluidCapacities.put(PipeFluidsWood.class, 1 * BuildCraftTransport.pipeFluidsBaseFlowRate); fluidCapacities.put(PipeFluidsCobblestone.class, 1 * BuildCraftTransport.pipeFluidsBaseFlowRate); - fluidCapacities.put(PipeFluidsDiamond.class, 8 * BuildCraftTransport.pipeFluidsBaseFlowRate); + + fluidCapacities.put(PipeFluidsSandstone.class, 2 * BuildCraftTransport.pipeFluidsBaseFlowRate); + fluidCapacities.put(PipeFluidsStone.class, 2 * BuildCraftTransport.pipeFluidsBaseFlowRate); + + fluidCapacities.put(PipeFluidsClay.class, 4 * BuildCraftTransport.pipeFluidsBaseFlowRate); fluidCapacities.put(PipeFluidsEmerald.class, 4 * BuildCraftTransport.pipeFluidsBaseFlowRate); - fluidCapacities.put(PipeFluidsGold.class, 8 * BuildCraftTransport.pipeFluidsBaseFlowRate); fluidCapacities.put(PipeFluidsIron.class, 4 * BuildCraftTransport.pipeFluidsBaseFlowRate); fluidCapacities.put(PipeFluidsQuartz.class, 4 * BuildCraftTransport.pipeFluidsBaseFlowRate); - fluidCapacities.put(PipeFluidsSandstone.class, 2 * BuildCraftTransport.pipeFluidsBaseFlowRate); - fluidCapacities.put(PipeFluidsStone.class, 2 * BuildCraftTransport.pipeFluidsBaseFlowRate); - fluidCapacities.put(PipeFluidsVoid.class, 1 * BuildCraftTransport.pipeFluidsBaseFlowRate); - fluidCapacities.put(PipeFluidsWood.class, 1 * BuildCraftTransport.pipeFluidsBaseFlowRate); + + fluidCapacities.put(PipeFluidsDiamond.class, 8 * BuildCraftTransport.pipeFluidsBaseFlowRate); + fluidCapacities.put(PipeFluidsGold.class, 8 * BuildCraftTransport.pipeFluidsBaseFlowRate); } @Override @@ -672,7 +683,7 @@ public void getDebugInfo(List left, List right, EnumFacing side) } String line = " - " + sectionName + " = "; line += (pipe.amount > 0 ? EnumChatFormatting.GREEN : ""); - line += pipe.amount + "" + EnumChatFormatting.RESET + "/" + LIQUID_IN_PIPE + "mB"; + line += pipe.amount + "" + EnumChatFormatting.RESET + "mB"; left.add(line); } } diff --git a/common/buildcraft/transport/PipeTransportItems.java b/common/buildcraft/transport/PipeTransportItems.java index 768bfcd8f2..032c095a3f 100644 --- a/common/buildcraft/transport/PipeTransportItems.java +++ b/common/buildcraft/transport/PipeTransportItems.java @@ -1,5 +1,5 @@ /** 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; @@ -22,6 +22,7 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing.Axis; import net.minecraft.util.Vec3; + import net.minecraftforge.common.util.Constants; import buildcraft.BuildCraftTransport; @@ -54,19 +55,23 @@ public void readjustSpeed(TravelingItem item) { PipeEventItem.AdjustSpeed event = new PipeEventItem.AdjustSpeed(container.pipe, item); container.pipe.eventBus.handleEvent(event); if (!event.handled) { - defaultReajustSpeed(item); + defaultReadjustSpeed(item, event.slowdownAmount); } } - public void defaultReajustSpeed(TravelingItem item) { + protected void defaultReadjustSpeed(TravelingItem item, float slowdownAmount) { float speed = item.getSpeed(); - if (speed > TransportConstants.PIPE_NORMAL_SPEED) { - speed -= TransportConstants.PIPE_NORMAL_SPEED; + if (speed > TransportConstants.PIPE_MAX_SPEED) { + speed = TransportConstants.PIPE_MAX_SPEED; + } + + if (speed > TransportConstants.PIPE_MIN_SPEED) { + speed -= slowdownAmount; } - if (speed < TransportConstants.PIPE_NORMAL_SPEED) { - speed = TransportConstants.PIPE_NORMAL_SPEED; + if (speed < TransportConstants.PIPE_MIN_SPEED) { + speed = TransportConstants.PIPE_MIN_SPEED; } item.setSpeed(speed); @@ -224,9 +229,6 @@ private boolean canReceivePipeObjects(EnumFacing o, TravelingItem item) { if (entity instanceof IPipeTile) { Pipe pipe = (Pipe) ((IPipeTile) entity).getPipe(); - if (pipe == null || pipe.transport == null) { - return false; - } if (pipe == null || pipe.transport == null) { return false; @@ -287,6 +289,14 @@ private void moveSolids() { continue; } + if (item.output == null) { + // TODO: Figure out why this is actually happening. + items.scheduleRemoval(item); + BCLog.logger.warn("Glitched item [Output direction UNKNOWN] removed from world @ " + container.x() + ", " + container.y() + ", " + + container.z() + "!"); + continue; + } + TileEntity tile = container.getTile(item.output, true); PipeEventItem.ReachedEnd event = new PipeEventItem.ReachedEnd(container.pipe, item, tile); @@ -297,7 +307,6 @@ private void moveSolids() { if (handleItem && items.scheduleRemoval(item)) { handleTileReached(item, tile); } - } } items.iterating = false; diff --git a/common/buildcraft/transport/PipeTransportPower.java b/common/buildcraft/transport/PipeTransportPower.java index c406244150..c81f7d2d07 100644 --- a/common/buildcraft/transport/PipeTransportPower.java +++ b/common/buildcraft/transport/PipeTransportPower.java @@ -1,5 +1,5 @@ /** 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; @@ -27,6 +27,7 @@ import buildcraft.api.transport.IPipeTile; import buildcraft.core.CompatHooks; import buildcraft.core.lib.block.TileBuildCraft; +import buildcraft.core.lib.utils.AverageInt; import buildcraft.core.lib.utils.Utils; import buildcraft.transport.network.PacketPowerUpdate; import buildcraft.transport.pipes.PipePowerCobblestone; @@ -39,12 +40,10 @@ import buildcraft.transport.pipes.PipePowerStone; import buildcraft.transport.pipes.PipePowerWood; -// TODO: MAKE POWER FLOW WORK! public class PipeTransportPower extends PipeTransport implements IDebuggable { public static final Map>, Integer> powerCapacities = new HashMap>, Integer>(); public static final Map>, Float> powerResistances = new HashMap>, Float>(); - private static final int DISPLAY_SMOOTHING = 10; private static final int OVERLOAD_TICKS = 60; public static final short POWER_STAGES = 1 << 6; @@ -60,13 +59,12 @@ public class PipeTransportPower extends PipeTransport implements IDebuggable { public int[] dbgEnergyOutput = new int[6]; public int[] dbgEnergyOffered = new int[6]; + private final AverageInt[] powerAverage = new AverageInt[6]; private final TileEntity[] tiles = new TileEntity[6]; private final Object[] providers = new Object[6]; private boolean needsInit = true; - private short[] prevDisplayPower = new short[6]; - private int[] powerQuery = new int[6]; private long currentDate; @@ -82,6 +80,7 @@ public class PipeTransportPower extends PipeTransport implements IDebuggable { public PipeTransportPower() { for (int i = 0; i < 6; ++i) { powerQuery[i] = 0; + powerAverage[i] = new AverageInt(10); } } @@ -116,8 +115,11 @@ public boolean canPipeConnect(TileEntity tile, EnumFacing side) { // Disregard engines for this. return false; } - if (tile instanceof IEnergyHandler || tile instanceof IEnergyReceiver) { - IEnergyConnection handler = (IEnergyConnection) tile; + + Object provider = CompatHooks.INSTANCE.getEnergyProvider(tile); + + if (provider instanceof IEnergyHandler || provider instanceof IEnergyReceiver) { + IEnergyConnection handler = (IEnergyConnection) provider; if (handler.canConnectEnergy(side.getOpposite())) { return true; } @@ -146,11 +148,9 @@ public boolean isPowerSource(TileEntity tile, EnumFacing side) { } @Override - public void onNeighborBlockChange(int blockId) { - super.onNeighborBlockChange(blockId); - for (EnumFacing side : EnumFacing.VALUES) { - updateTile(side); - } + public void onNeighborChange(EnumFacing side) { + super.onNeighborChange(side); + updateTile(side); } private void updateTile(EnumFacing side) { @@ -162,7 +162,7 @@ private void updateTile(EnumFacing side) { tiles[o] = null; internalPower[o] = 0; internalNextPower[o] = 0; - displayPower[o] = 0; + powerAverage[o].clear(); displayFlow[o] = 0; } providers[o] = getEnergyProvider(o); @@ -204,8 +204,7 @@ public void updateEntity() { } } - System.arraycopy(displayPower, 0, prevDisplayPower, 0, 6); - Arrays.fill(displayPower, (short) 0); + // FIXME: LEFT OVER FROM MERGE! LOOK AT THIS! Arrays.fill(displayFlow, (short) 0); // Send the power to nearby pipes who requested it @@ -222,56 +221,58 @@ public void updateEntity() { } if (totalPowerQuery > 0) { - double[] internalPowerHold = new double[6]; - System.arraycopy(internalPower, 0, internalPowerHold, 0, 6); - + int unusedPowerQuery = totalPowerQuery; for (int j = 0; j < 6; ++j) { if (j != i && powerQuery[j] > 0) { Object ep = providers[j]; - double watts = Math.min(internalPower[i] * powerQuery[j] / totalPowerQuery, internalPower[i]); + double watts = Math.min(internalPower[i] * powerQuery[j] / unusedPowerQuery, internalPower[i]); + unusedPowerQuery -= powerQuery[j]; - if (ep instanceof IPipeTile) { + if (ep instanceof IPipeTile && ((IPipeTile) ep).getPipeType() == IPipeTile.PipeType.POWER) { Pipe nearbyPipe = (Pipe) ((IPipeTile) ep).getPipe(); PipeTransportPower nearbyTransport = (PipeTransportPower) nearbyPipe.transport; watts = nearbyTransport.receiveEnergy(EnumFacing.VALUES[j].getOpposite(), watts); internalPower[i] -= watts; dbgEnergyOutput[j] += watts; + + powerAverage[j].push((int) Math.ceil(watts)); + powerAverage[i].push((int) Math.ceil(watts)); } else { int iWatts = (int) watts; if (ep instanceof IEnergyHandler) { IEnergyHandler handler = (IEnergyHandler) ep; - if (handler.canConnectEnergy(EnumFacing.VALUES[j].getOpposite())) { - watts = handler.receiveEnergy(EnumFacing.VALUES[j].getOpposite(), iWatts, false); + if (handler.canConnectEnergy(EnumFacing.values()[j].getOpposite())) { + iWatts = handler.receiveEnergy(EnumFacing.values()[j].getOpposite(), iWatts, false); } - internalPower[i] -= iWatts; - dbgEnergyOutput[j] += iWatts; } else if (ep instanceof IEnergyReceiver) { IEnergyReceiver handler = (IEnergyReceiver) ep; - if (handler.canConnectEnergy(EnumFacing.VALUES[j].getOpposite())) { - watts = handler.receiveEnergy(EnumFacing.VALUES[j].getOpposite(), iWatts, false); + if (handler.canConnectEnergy(EnumFacing.values()[j].getOpposite())) { + iWatts = handler.receiveEnergy(EnumFacing.values()[j].getOpposite(), iWatts, false); } - internalPower[i] -= iWatts; - dbgEnergyOutput[j] += iWatts; } - } - displayPower[j] += watts; - displayPower[i] += watts; - displayFlow[i] = 1; - displayFlow[j] = -1; + internalPower[i] -= iWatts; + dbgEnergyOutput[j] += iWatts; + + powerAverage[j].push(iWatts); + powerAverage[i].push(iWatts); + } } } } } } - float highestPower = 0.0F; + + short highestPower = 0; for (int i = 0; i < 6; i++) { - displayPower[i] = (short) Math.floor((float) (prevDisplayPower[i] * (DISPLAY_SMOOTHING - 1) + displayPower[i]) / DISPLAY_SMOOTHING); + powerAverage[i].tick(); + displayPower[i] = (short) Math.round(powerAverage[i].getAverage()); if (displayPower[i] > highestPower) { highestPower = displayPower[i]; } } - overload += highestPower > ((float) maxPower) * 0.95F ? 1 : -1; + + overload += highestPower > (maxPower * 0.95F) ? 1 : -1; if (overload < 0) { overload = 0; } @@ -287,7 +288,8 @@ public void updateEntity() { Object tile = providers[dir.ordinal()]; - if (tile instanceof IPipeTile && ((Pipe) ((IPipeTile) tile).getPipe()).transport instanceof PipeTransportPower) { + if (tile instanceof IPipeTile && ((IPipeTile) tile).getPipe() != null && ((Pipe) ((IPipeTile) tile) + .getPipe()).transport instanceof PipeTransportPower) { continue; } if (tile instanceof IEnergyHandler) { @@ -328,9 +330,9 @@ public void updateEntity() { for (int i = 0; i < 6; ++i) { if (transferQuery[i] != 0 && tiles[i] != null) { TileEntity entity = tiles[i]; - if (entity instanceof IPipeTile) { + if (entity instanceof IPipeTile && ((IPipeTile) entity).getPipeType() == IPipeTile.PipeType.POWER) { IPipeTile nearbyTile = (IPipeTile) entity; - if (nearbyTile.getPipe() == null) { + if (nearbyTile.getPipe() == null || nearbyTile.getPipeType() != IPipeTile.PipeType.POWER) { continue; } PipeTransportPower nearbyTransport = (PipeTransportPower) ((Pipe) nearbyTile.getPipe()).transport; @@ -478,15 +480,15 @@ public boolean isQueryingPower() { } static { - powerCapacities.put(PipePowerCobblestone.class, 80); - powerCapacities.put(PipePowerStone.class, 160); - powerCapacities.put(PipePowerWood.class, 320); - powerCapacities.put(PipePowerSandstone.class, 320); - powerCapacities.put(PipePowerQuartz.class, 640); - powerCapacities.put(PipePowerIron.class, 1280); - powerCapacities.put(PipePowerGold.class, 2560); - powerCapacities.put(PipePowerEmerald.class, 2560); - powerCapacities.put(PipePowerDiamond.class, 10240); + powerCapacities.put(PipePowerCobblestone.class, TransportConstants.PIPE_POWER_BASE_CAP); + powerCapacities.put(PipePowerStone.class, 2 * TransportConstants.PIPE_POWER_BASE_CAP); + powerCapacities.put(PipePowerWood.class, 4 * TransportConstants.PIPE_POWER_BASE_CAP); + powerCapacities.put(PipePowerSandstone.class, 4 * TransportConstants.PIPE_POWER_BASE_CAP); + powerCapacities.put(PipePowerQuartz.class, 8 * TransportConstants.PIPE_POWER_BASE_CAP); + powerCapacities.put(PipePowerIron.class, 16 * TransportConstants.PIPE_POWER_BASE_CAP); + powerCapacities.put(PipePowerGold.class, 32 * TransportConstants.PIPE_POWER_BASE_CAP); + powerCapacities.put(PipePowerEmerald.class, 32 * TransportConstants.PIPE_POWER_BASE_CAP); + powerCapacities.put(PipePowerDiamond.class, 128 * TransportConstants.PIPE_POWER_BASE_CAP); powerResistances.put(PipePowerCobblestone.class, 0.05F); powerResistances.put(PipePowerStone.class, 0.025F); diff --git a/common/buildcraft/transport/PipeTransportStructure.java b/common/buildcraft/transport/PipeTransportStructure.java index b53b5855cc..26efee2ad1 100644 --- a/common/buildcraft/transport/PipeTransportStructure.java +++ b/common/buildcraft/transport/PipeTransportStructure.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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; import net.minecraft.tileentity.TileEntity; @@ -10,7 +14,6 @@ import buildcraft.api.transport.IPipeTile; public class PipeTransportStructure extends PipeTransport { - @Override public IPipeTile.PipeType getPipeType() { return IPipeTile.PipeType.STRUCTURE; diff --git a/common/buildcraft/transport/PipeTriggerProvider.java b/common/buildcraft/transport/PipeTriggerProvider.java index 32f1f851e4..efb1eae8db 100644 --- a/common/buildcraft/transport/PipeTriggerProvider.java +++ b/common/buildcraft/transport/PipeTriggerProvider.java @@ -1,5 +1,5 @@ /** 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; @@ -30,10 +30,7 @@ public LinkedList getInternalTriggers(IStatementContainer cont return result; } - boolean containsGate = false; - if (container instanceof Gate) { - containsGate = true; ((Gate) container).addTriggers(result); } diff --git a/common/buildcraft/transport/TileFilteredBuffer.java b/common/buildcraft/transport/TileFilteredBuffer.java index 34f5ef88f5..91318c0c9c 100644 --- a/common/buildcraft/transport/TileFilteredBuffer.java +++ b/common/buildcraft/transport/TileFilteredBuffer.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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; import net.minecraft.entity.player.EntityPlayer; diff --git a/common/buildcraft/transport/TileGenericPipe.java b/common/buildcraft/transport/TileGenericPipe.java index 6f6160c878..6d299a5afc 100644 --- a/common/buildcraft/transport/TileGenericPipe.java +++ b/common/buildcraft/transport/TileGenericPipe.java @@ -1,5 +1,5 @@ /** 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; @@ -18,12 +18,8 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.*; import net.minecraft.util.EnumFacing.Axis; -import net.minecraft.util.ITickable; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraftforge.common.util.Constants; @@ -38,27 +34,17 @@ import buildcraft.BuildCraftCore; import buildcraft.BuildCraftTransport; -import buildcraft.api.core.BCLog; -import buildcraft.api.core.EnumColor; -import buildcraft.api.core.IIconProvider; -import buildcraft.api.core.ISerializable; +import buildcraft.api.core.*; import buildcraft.api.gates.IGateExpansion; import buildcraft.api.power.IRedstoneEngineReceiver; import buildcraft.api.tiles.IDebuggable; -import buildcraft.api.transport.ICustomPipeConnection; -import buildcraft.api.transport.IPipe; -import buildcraft.api.transport.IPipeConnection; -import buildcraft.api.transport.IPipeTile; -import buildcraft.api.transport.PipeConnectionAPI; -import buildcraft.api.transport.PipeManager; -import buildcraft.api.transport.PipeWire; +import buildcraft.api.transport.*; import buildcraft.api.transport.pluggable.IFacadePluggable; import buildcraft.api.transport.pluggable.PipePluggable; import buildcraft.core.DefaultProps; import buildcraft.core.internal.IDropControlInventory; import buildcraft.core.lib.ITileBufferHolder; import buildcraft.core.lib.TileBuffer; -import buildcraft.core.lib.block.IAdditionalDataTile; import buildcraft.core.lib.network.IGuiReturnHandler; import buildcraft.core.lib.network.ISyncedTile; import buildcraft.core.lib.network.PacketTileState; @@ -73,8 +59,8 @@ import io.netty.buffer.ByteBuf; -public class TileGenericPipe extends TileEntity implements ITickable, IFluidHandler, IPipeTile, ITileBufferHolder, IEnergyHandler, - IDropControlInventory, ISyncedTile, ISolidSideTile, IGuiReturnHandler, IRedstoneEngineReceiver, IDebuggable, IAdditionalDataTile { +public class TileGenericPipe extends TileEntity implements IFluidHandler, IPipeTile, ITileBufferHolder, IEnergyHandler, IDropControlInventory, + ISyncedTile, ISolidSideTile, IGuiReturnHandler, IRedstoneEngineReceiver, IDebuggable, IPipeConnection, ITickable { public boolean initialized = false; public final PipeRenderState renderState = new PipeRenderState(); @@ -89,6 +75,7 @@ public class TileGenericPipe extends TileEntity implements ITickable, IFluidHand protected boolean deletePipe = false; protected boolean sendClientUpdate = false; protected boolean blockNeighborChange = false; + protected int blockNeighborChangedSides = 0; protected boolean refreshRenderState = false; protected boolean pipeBound = false; protected boolean resyncGateExpansions = false; @@ -98,7 +85,7 @@ public class TileGenericPipe extends TileEntity implements ITickable, IFluidHand private TileBuffer[] tileBuffer; private int glassColor = -1; - public static class CoreState implements ISerializable { + public static class CoreState implements ISerializable, Comparable { public String pipeId = null; @Override @@ -110,6 +97,11 @@ public void writeData(ByteBuf data) { public void readData(ByteBuf data) { pipeId = NetworkUtils.readUTF(data); } + + @Override + public int compareTo(CoreState o) { + return 0; + } } public static class SideProperties { @@ -138,30 +130,16 @@ public void readFromNBT(NBTTagCompound nbt) { } try { NBTTagCompound pluggableData = nbt.getCompoundTag(key); - Class pluggableClass = null; - // Migration support for 6.1.x/6.2.x // No Longer Required - // if (pluggableData.hasKey("pluggableClass")) { - // String c = pluggableData.getString("pluggableClass"); - // if ("buildcraft.transport.gates.ItemGate$GatePluggable".equals(c)) { - // pluggableClass = GatePluggable.class; - // } else if ("buildcraft.transport.ItemFacade$FacadePluggable".equals(c)) { - // pluggableClass = FacadePluggable.class; - // } else if ("buildcraft.transport.ItemPlug$PlugPluggable".equals(c)) { - // pluggableClass = PlugPluggable.class; - // } else if ("buildcraft.transport.gates.ItemRobotStation$RobotStationPluggable".equals(c) - // || "buildcraft.transport.ItemRobotStation$RobotStationPluggable".equals(c)) { - // pluggableClass = PipeManager.getPluggableByName("robotStation"); - // } - // } else { - pluggableClass = PipeManager.getPluggableByName(pluggableData.getString("pluggableName")); - // } - if (!PipePluggable.class.isAssignableFrom(pluggableClass)) { - BCLog.logger.warn("Wrong pluggable class: " + pluggableClass); - continue; + Class pluggableClass = PipeManager.getPluggableByName(pluggableData.getString("pluggableName")); + if (pluggableClass != null) { + if (!PipePluggable.class.isAssignableFrom(pluggableClass)) { + BCLog.logger.warn("Wrong pluggable class: " + pluggableClass); + continue; + } + PipePluggable pluggable = (PipePluggable) pluggableClass.newInstance(); + pluggable.readFromNBT(pluggableData); + pluggables[i] = pluggable; } - PipePluggable pluggable = (PipePluggable) pluggableClass.newInstance(); - pluggable.readFromNBT(pluggableData); - pluggables[i] = pluggable; } catch (Exception e) { BCLog.logger.warn("Failed to load side state"); e.printStackTrace(); @@ -367,7 +345,7 @@ protected void notifyBlockChanged() { scheduleRenderUpdate(); sendNetworkUpdate(); if (pipe != null) { - BlockGenericPipe.updateNeighbourSignalState(pipe); + pipe.scheduleWireUpdate(); } } @@ -422,7 +400,12 @@ public void update() { } if (blockNeighborChange) { - computeConnections(); + for (int i = 0; i < 6; i++) { + if ((blockNeighborChangedSides & (1 << i)) != 0) { + blockNeighborChangedSides ^= 1 << i; + computeConnection(EnumFacing.getFront(i)); + } + } pipe.onNeighborBlockChange(0); blockNeighborChange = false; refreshRenderState = true; @@ -473,7 +456,6 @@ public int getPipeColor() { public boolean setPipeColor(int color) { if (!worldObj.isRemote && color >= -1 && color < 16 && glassColor != color) { - renderState.glassColorDirty = true; glassColor = color; notifyBlockChanged(); worldObj.notifyBlockOfStateChange(pos, blockType); @@ -556,14 +538,20 @@ protected boolean refreshRenderState() { boolean changed = renderState.isDirty(); // TODO (Pass 1): If the pluggable state has changed, also update it! - if (renderState.isDirty()) { + if (renderState.isDirty()) + + { renderState.clean(); } + sendNetworkUpdate(); return changed; + } public void initialize(Pipe pipe) { + initialized = false; + this.blockType = getBlockType(); if (pipe == null) { @@ -612,6 +600,12 @@ public boolean isInitialized() { public void scheduleNeighborChange() { blockNeighborChange = true; + blockNeighborChangedSides = 0x3F; + } + + public void scheduleNeighborChange(EnumPipePart part) { + blockNeighborChange = true; + blockNeighborChangedSides |= part == EnumPipePart.CENTER ? 0x3F : (1 << part.ordinal()); } @Override @@ -630,6 +624,10 @@ public int injectItem(ItemStack payload, boolean doAdd, EnumFacing from, EnumCol Vec3 itemPos = Utils.convertMiddle(getPos()).add(Utils.convert(from, 0.4)); TravelingItem pipedItem = TravelingItem.make(itemPos, payload); + if (pipedItem.isCorrupted()) { + return 0; + } + pipedItem.color = color; ((PipeTransportItems) pipe.transport).injectItem(pipedItem, from.getOpposite()); } @@ -699,7 +697,6 @@ public net.minecraft.network.Packet getDescriptionPacket() { return null; } - @Override public void sendNetworkUpdate() { sendClientUpdate = true; } @@ -832,29 +829,34 @@ public boolean hasBlockingPluggable(EnumFacing side) { } protected void computeConnections() { + for (EnumFacing face : EnumFacing.values()) { + computeConnection(face); + } + } + + protected void computeConnection(EnumFacing side) { TileBuffer[] cache = getTileCache(); if (cache == null) { return; } - for (EnumFacing side : EnumFacing.VALUES) { - TileBuffer t = cache[side.ordinal()]; - // For blocks which are not loaded, keep the old connection value. - // if (t.exists() || !initialized) { - // t.refresh(); + TileBuffer t = cache[side.ordinal()]; + // For blocks which are not loaded, keep the old connection value. + // if (t.exists() || !initialized) { + // t.refresh(); - pipeConnectionsBuffer[side.ordinal()] = canPipeConnect(worldObj.getTileEntity(pos.offset(side))/* t.getTile( - * ) */, side); - // } - } + pipeConnectionsBuffer[side.ordinal()] = canPipeConnect(worldObj.getTileEntity(pos.offset(side))/* t.getTile( + * ) */, side); + // } } @Override public boolean isPipeConnected(EnumFacing with) { if (worldObj.isRemote) { return renderState.pipeConnectionMatrix.isConnected(with); + } else { + return pipeConnectionsBuffer[with.ordinal()]; } - return pipeConnectionsBuffer[with.ordinal()]; } @Override @@ -1291,4 +1293,12 @@ public void getDebugInfo(List left, List right, EnumFacing side) ((IDebuggable) getPipePluggable(side)).getDebugInfo(left, right, side); } } + + @Override + public ConnectOverride overridePipeConnection(PipeType type, EnumFacing with) { + if (type == PipeType.POWER && hasPipePluggable(with) && getPipePluggable(with) instanceof IEnergyHandler) { + return ConnectOverride.CONNECT; + } + return ConnectOverride.DEFAULT; + } } diff --git a/common/buildcraft/transport/TransportConstants.java b/common/buildcraft/transport/TransportConstants.java index c6c2f4f8d0..3a0edef0ba 100644 --- a/common/buildcraft/transport/TransportConstants.java +++ b/common/buildcraft/transport/TransportConstants.java @@ -1,5 +1,5 @@ /** 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; @@ -7,7 +7,18 @@ public final class TransportConstants { public static final float FACADE_THICKNESS = 2F / 16F; - public static final float PIPE_NORMAL_SPEED = 0.01F; + + // public static final float PIPE_MIN_SPEED = (1.0F / 80.0F); + // public static final float PIPE_MAX_SPEED = (1.0F / 7.0F); + // public static final float PIPE_SLOWDOWN_SPEED = 0.008F; + // public static final float PIPE_DEFAULT_SPEED = (1.0F / 25.0F); + + public static final int PIPE_POWER_BASE_CAP = 80; + public static final float PIPE_SPEEDUP_MULTIPLIER = 4F; + public static final float PIPE_MIN_SPEED = 0.01F; + public static final float PIPE_MAX_SPEED = 0.15F; + public static final float PIPE_SLOWDOWN_SPEED = 0.01F; + public static final float PIPE_DEFAULT_SPEED = PIPE_MIN_SPEED; /** Deactivate constructor */ private TransportConstants() {} diff --git a/common/buildcraft/transport/TransportGuiHandler.java b/common/buildcraft/transport/TransportGuiHandler.java index 3771f25ef2..3ec1a5b0c9 100644 --- a/common/buildcraft/transport/TransportGuiHandler.java +++ b/common/buildcraft/transport/TransportGuiHandler.java @@ -1,5 +1,5 @@ /** 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; @@ -10,6 +10,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockPos; import net.minecraft.world.World; + import net.minecraftforge.fml.common.network.IGuiHandler; import buildcraft.api.core.BCLog; @@ -37,13 +38,13 @@ public Object getServerGuiElement(int id, EntityPlayer player, World world, int return new ContainerFilteredBuffer(player, filteredBuffer); } - if (!(tile instanceof IPipeTile)) { + if (!(tile instanceof IPipeTile)) { return null; } - IPipeTile pipe = (IPipeTile) tile; + IPipeTile pipe = (IPipeTile) tile; - if (pipe.getPipe() == null) { + if (pipe.getPipe() == null) { return null; } @@ -87,31 +88,31 @@ public Object getClientGuiElement(int id, EntityPlayer player, World world, int return new GuiFilteredBuffer(player, filteredBuffer); } - if (!(tile instanceof TileGenericPipe)) { + if (!(tile instanceof IPipeTile)) { return null; } - TileGenericPipe pipe = (TileGenericPipe) tile; + IPipeTile pipe = (IPipeTile) tile; - if (pipe.pipe == null) { + if (pipe.getPipe() == null) { return null; } switch (id) { case GuiIds.PIPE_DIAMOND: - return new GuiDiamondPipe(player, (IDiamondPipe) pipe.pipe); + return new GuiDiamondPipe(player, (IDiamondPipe) pipe.getPipe()); case GuiIds.PIPE_EMERALD_ITEM: - return new GuiEmeraldPipe(player, (PipeItemsEmerald) pipe.pipe); + return new GuiEmeraldPipe(player, (PipeItemsEmerald) pipe.getPipe()); case GuiIds.PIPE_LOGEMERALD_ITEM: - return new GuiEmzuliPipe(player, (PipeItemsEmzuli) pipe.pipe); + return new GuiEmzuliPipe(player, (PipeItemsEmzuli) pipe.getPipe()); case GuiIds.PIPE_EMERALD_FLUID: - return new GuiEmeraldFluidPipe(player, (PipeFluidsEmerald) pipe.pipe); + return new GuiEmeraldFluidPipe(player, (PipeFluidsEmerald) pipe.getPipe()); case GuiIds.GATES: - return new GuiGateInterface(player, pipe.pipe); + return new GuiGateInterface(player, pipe.getPipe()); default: return null; diff --git a/common/buildcraft/transport/TransportPipes_BC8.java b/common/buildcraft/transport/TransportPipes_BC8.java index 8146dcfb2f..14e2fd0855 100644 --- a/common/buildcraft/transport/TransportPipes_BC8.java +++ b/common/buildcraft/transport/TransportPipes_BC8.java @@ -20,6 +20,7 @@ import buildcraft.api.transport.pipe_bc8.PipeAPI_BC8; import buildcraft.api.transport.pipe_bc8.PipeDefinition_BC8; import buildcraft.core.BCCreativeTab; +import buildcraft.core.BCRegistry; import buildcraft.core.proxy.CoreProxy; import buildcraft.transport.api.impl.EnumPipeType; import buildcraft.transport.pipes.bc8.EnumPipeMaterial; @@ -163,7 +164,7 @@ private static void registerDefinition(EnumPipeMaterial material, EnumPipeType t Item item = PipeAPI_BC8.PIPE_REGISTRY.registerDefinition(definition); // item.setUnlocalizedName("buildcraft_" + item.getUnlocalizedName().replace("item.", "")); pipes.put(material, type, definition); - CoreProxy.proxy.registerItem(item); + BCRegistry.INSTANCE.registerItem(item, false); item.setCreativeTab(BCCreativeTab.get("neptune")); } diff --git a/common/buildcraft/transport/TransportProxy.java b/common/buildcraft/transport/TransportProxy.java index 2b6408500b..f71ff6ad9a 100644 --- a/common/buildcraft/transport/TransportProxy.java +++ b/common/buildcraft/transport/TransportProxy.java @@ -1,5 +1,5 @@ /** 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; @@ -11,7 +11,6 @@ import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.registry.GameRegistry; -import buildcraft.BuildCraftTransport; import buildcraft.core.CompatHooks; import buildcraft.transport.pipes.bc8.TilePipe_BC8; @@ -34,9 +33,9 @@ public void registerTileEntities() { public void registerRenderers() {} - public void initIconProviders(BuildCraftTransport instance) {} - public void setIconProviderFromPipe(ItemPipe item, Pipe dummyPipe) {} public void obsidianPipePickup(World world, EntityItem item, TileEntity tile) {} + + public void clearDisplayList(int displayList) {} } diff --git a/common/buildcraft/transport/TransportProxyClient.java b/common/buildcraft/transport/TransportProxyClient.java index cd00d6589f..0986292ca4 100644 --- a/common/buildcraft/transport/TransportProxyClient.java +++ b/common/buildcraft/transport/TransportProxyClient.java @@ -1,5 +1,5 @@ /** 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; @@ -7,13 +7,10 @@ import net.minecraft.entity.item.EntityItem; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; + import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.client.registry.ClientRegistry; -import net.minecraftforge.fml.common.FMLCommonHandler; -import buildcraft.transport.pipes.bc8.TilePipe_BC8; -import buildcraft.transport.render.TileEntityPickupFX; import buildcraft.transport.render.shader.FluidShaderManager; import buildcraft.transport.render.tile.PipeRendererTESR; @@ -24,19 +21,18 @@ public void registerTileEntities() { super.registerTileEntities(); PipeRendererTESR rp = new PipeRendererTESR(); ClientRegistry.bindTileEntitySpecialRenderer(TileGenericPipe.class, rp); - -// ClientRegistry.bindTileEntitySpecialRenderer(TilePipe_BC8.class, new ); + + // ClientRegistry.bindTileEntitySpecialRenderer(TilePipe_BC8.class, new ); } @Override public void obsidianPipePickup(World world, EntityItem item, TileEntity tile) { - FMLClientHandler.instance().getClient().effectRenderer.addEffect(new TileEntityPickupFX(world, item, tile)); + // FMLClientHandler.instance().getClient().effectRenderer.addEffect(new TileEntityPickupFX(world, item, tile)); } @Override public void registerRenderers() { MinecraftForge.EVENT_BUS.register(FluidShaderManager.INSTANCE); - FMLCommonHandler.instance().bus().register(FluidShaderManager.INSTANCE); } @Override diff --git a/common/buildcraft/transport/TransportSiliconRecipes.java b/common/buildcraft/transport/TransportSiliconRecipes.java index 37b03de356..81cf61f7fb 100644 --- a/common/buildcraft/transport/TransportSiliconRecipes.java +++ b/common/buildcraft/transport/TransportSiliconRecipes.java @@ -5,16 +5,19 @@ import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; + import net.minecraftforge.fml.common.Optional; import net.minecraftforge.fml.common.registry.GameRegistry; +import buildcraft.BuildCraftCore; import buildcraft.BuildCraftTransport; import buildcraft.api.enums.EnumRedstoneChipset; import buildcraft.api.gates.GateExpansions; import buildcraft.api.recipes.BuildcraftRecipeRegistry; import buildcraft.api.transport.PipeWire; -import buildcraft.BuildCraftCore; import buildcraft.core.lib.utils.ColorUtils; +import buildcraft.core.lib.utils.Utils; +import buildcraft.silicon.ItemRedstoneChipset; import buildcraft.transport.gates.GateDefinition; import buildcraft.transport.gates.GateExpansionPulsar; import buildcraft.transport.gates.GateExpansionRedstoneFader; @@ -33,46 +36,53 @@ public static void loadSiliconRecipes() { GameRegistry.addShapelessRecipe(new ItemStack(BuildCraftTransport.gateCopier, 1), new ItemStack(BuildCraftCore.wrenchItem), EnumRedstoneChipset.RED.getStack(1)); - // PIPE WIRE - BuildcraftRecipeRegistry.assemblyTable.addRecipe("buildcraft:redWire", 5000, PipeWire.RED.getStack(8), "dyeRed", "dustRedstone", "ingotIron"); - BuildcraftRecipeRegistry.assemblyTable.addRecipe("buildcraft:blueWire", 5000, PipeWire.BLUE.getStack(8), "dyeBlue", "dustRedstone", - "ingotIron"); - BuildcraftRecipeRegistry.assemblyTable.addRecipe("buildcraft:greenWire", 5000, PipeWire.GREEN.getStack(8), "dyeGreen", "dustRedstone", - "ingotIron"); - BuildcraftRecipeRegistry.assemblyTable.addRecipe("buildcraft:yellowWire", 5000, PipeWire.YELLOW.getStack(8), "dyeYellow", "dustRedstone", - "ingotIron"); - - // Lenses, Filters - for (int i = 0; i < 16; i++) { - BuildcraftRecipeRegistry.assemblyTable.addRecipe("buildcraft:lens:" + i, 10000, new ItemStack(BuildCraftTransport.lensItem, 2, i), - ColorUtils.getOreDictionaryName(15 - i), "blockGlass", "ingotIron"); - BuildcraftRecipeRegistry.assemblyTable.addRecipe("buildcraft:filter:" + i, 10000, new ItemStack(BuildCraftTransport.lensItem, 2, i + 16), - ColorUtils.getOreDictionaryName(15 - i), "blockGlass", Blocks.iron_bars); + if (Utils.isRegistered(BuildCraftTransport.lensItem)) { + // Lenses, Filters + for (int i = 0; i < 16; i++) { + BuildcraftRecipeRegistry.assemblyTable.addRecipe("buildcraft:lens:" + i, 10000, new ItemStack(BuildCraftTransport.lensItem, 2, i), + ColorUtils.getOreDictionaryName(15 - i), "blockGlass"); + BuildcraftRecipeRegistry.assemblyTable.addRecipe("buildcraft:filter:" + i, 10000, new ItemStack(BuildCraftTransport.lensItem, 2, i + + 16), ColorUtils.getOreDictionaryName(15 - i), "blockGlass", Blocks.iron_bars); + } } - // GATES - BuildcraftRecipeRegistry.assemblyTable.addRecipe("buildcraft:simpleGate", (int) Math.round(100000 * BuildCraftTransport.gateCostMultiplier), - ItemGate.makeGateItem(GateDefinition.GateMaterial.REDSTONE, GateDefinition.GateLogic.AND), EnumRedstoneChipset.RED.getStack(1), - PipeWire.RED.getStack()); + // PIPE WIRE + if (Utils.isRegistered(PipeWire.item)) { + BuildcraftRecipeRegistry.assemblyTable.addRecipe("buildcraft:redWire", 5000, PipeWire.RED.getStack(8), "dyeRed", "dustRedstone", + "ingotIron"); + BuildcraftRecipeRegistry.assemblyTable.addRecipe("buildcraft:blueWire", 5000, PipeWire.BLUE.getStack(8), "dyeBlue", "dustRedstone", + "ingotIron"); + BuildcraftRecipeRegistry.assemblyTable.addRecipe("buildcraft:greenWire", 5000, PipeWire.GREEN.getStack(8), "dyeGreen", "dustRedstone", + "ingotIron"); + BuildcraftRecipeRegistry.assemblyTable.addRecipe("buildcraft:yellowWire", 5000, PipeWire.YELLOW.getStack(8), "dyeYellow", "dustRedstone", + "ingotIron"); + + if (Utils.isRegistered(ItemRedstoneChipset.Chipset.RED.getStack()) && Utils.isRegistered(BuildCraftTransport.pipeGate)) { + // GATES + BuildcraftRecipeRegistry.assemblyTable.addRecipe("buildcraft:simpleGate", Math.round(100000 * BuildCraftTransport.gateCostMultiplier), + ItemGate.makeGateItem(GateDefinition.GateMaterial.REDSTONE, GateDefinition.GateLogic.AND), ItemRedstoneChipset.Chipset.RED + .getStack(), PipeWire.RED.getStack()); - addGateRecipe("Iron", (int) Math.round(200000 * BuildCraftTransport.gateCostMultiplier), GateDefinition.GateMaterial.IRON, - EnumRedstoneChipset.IRON, PipeWire.RED, PipeWire.BLUE); - addGateRecipe("Gold", (int) Math.round(400000 * BuildCraftTransport.gateCostMultiplier), GateDefinition.GateMaterial.GOLD, - EnumRedstoneChipset.GOLD, PipeWire.RED, PipeWire.BLUE, PipeWire.GREEN); - addGateRecipe("Quartz", (int) Math.round(600000 * BuildCraftTransport.gateCostMultiplier), GateDefinition.GateMaterial.QUARTZ, - EnumRedstoneChipset.QUARTZ, PipeWire.RED, PipeWire.BLUE, PipeWire.GREEN); - addGateRecipe("Diamond", (int) Math.round(800000 * BuildCraftTransport.gateCostMultiplier), GateDefinition.GateMaterial.DIAMOND, - EnumRedstoneChipset.DIAMOND, PipeWire.RED, PipeWire.BLUE, PipeWire.GREEN, PipeWire.YELLOW); - addGateRecipe("Emerald", (int) Math.round(1200000 * BuildCraftTransport.gateCostMultiplier), GateDefinition.GateMaterial.EMERALD, - EnumRedstoneChipset.EMERALD, PipeWire.RED, PipeWire.BLUE, PipeWire.GREEN, PipeWire.YELLOW); + addGateRecipe("Iron", Math.round(200000 * BuildCraftTransport.gateCostMultiplier), GateDefinition.GateMaterial.IRON, + EnumRedstoneChipset.IRON, PipeWire.RED, PipeWire.BLUE); + addGateRecipe("Gold", Math.round(400000 * BuildCraftTransport.gateCostMultiplier), GateDefinition.GateMaterial.GOLD, + EnumRedstoneChipset.GOLD, PipeWire.RED, PipeWire.BLUE, PipeWire.GREEN); + addGateRecipe("Quartz", Math.round(600000 * BuildCraftTransport.gateCostMultiplier), GateDefinition.GateMaterial.QUARTZ, + EnumRedstoneChipset.QUARTZ, PipeWire.RED, PipeWire.BLUE, PipeWire.GREEN); + addGateRecipe("Diamond", Math.round(800000 * BuildCraftTransport.gateCostMultiplier), GateDefinition.GateMaterial.DIAMOND, + EnumRedstoneChipset.DIAMOND, PipeWire.RED, PipeWire.BLUE, PipeWire.GREEN, PipeWire.YELLOW); + addGateRecipe("Emerald", Math.round(1200000 * BuildCraftTransport.gateCostMultiplier), GateDefinition.GateMaterial.EMERALD, + EnumRedstoneChipset.EMERALD, PipeWire.RED, PipeWire.BLUE, PipeWire.GREEN, PipeWire.YELLOW); - BuildcraftRecipeRegistry.integrationTable.addRecipe(new GateExpansionRecipe()); - BuildcraftRecipeRegistry.integrationTable.addRecipe(new AdvancedFacadeRecipe()); + BuildcraftRecipeRegistry.integrationTable.addRecipe(new GateExpansionRecipe()); + BuildcraftRecipeRegistry.integrationTable.addRecipe(new AdvancedFacadeRecipe()); - // This will only add recipes to the gate expansions. - GateExpansions.registerExpansion(GateExpansionPulsar.INSTANCE, EnumRedstoneChipset.PULSATING.getStack()); - GateExpansions.registerExpansion(GateExpansionTimer.INSTANCE, EnumRedstoneChipset.QUARTZ.getStack()); - GateExpansions.registerExpansion(GateExpansionRedstoneFader.INSTANCE, EnumRedstoneChipset.COMP.getStack()); + // This will only add recipes to the gate expansions. + GateExpansions.registerExpansion(GateExpansionPulsar.INSTANCE, EnumRedstoneChipset.PULSATING.getStack()); + GateExpansions.registerExpansion(GateExpansionTimer.INSTANCE, EnumRedstoneChipset.QUARTZ.getStack()); + GateExpansions.registerExpansion(GateExpansionRedstoneFader.INSTANCE, EnumRedstoneChipset.COMP.getStack()); + } + } } @Optional.Method(modid = "BuildCraft|Silicon") diff --git a/common/buildcraft/transport/TravelerSet.java b/common/buildcraft/transport/TravelerSet.java index 189ad1960c..15b5290c96 100644 --- a/common/buildcraft/transport/TravelerSet.java +++ b/common/buildcraft/transport/TravelerSet.java @@ -1,5 +1,5 @@ /** 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; @@ -12,7 +12,9 @@ import com.google.common.collect.Sets; /** Um, no. This is not needed anymore, as indervidual items will be stored in a Map, - * provided there are no problems implementing it. */ + * provided there are no problems implementing it. + * + * AND NEPTUNE IS A THING :) */ @Deprecated public class TravelerSet extends ForwardingSet { @@ -98,7 +100,10 @@ public boolean unscheduleRemoval(TravelingItem item) { } void removeScheduledItems() { - items.removeAll(toRemove); + for (TravelingItem i : toRemove) { + i.cleanup(); + items.remove(i); + } toRemove.clear(); } diff --git a/common/buildcraft/transport/TravelingItem.java b/common/buildcraft/transport/TravelingItem.java index 596150bb3d..81ef087733 100644 --- a/common/buildcraft/transport/TravelingItem.java +++ b/common/buildcraft/transport/TravelingItem.java @@ -1,5 +1,5 @@ /** 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; @@ -16,6 +16,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.Vec3; + import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.relauncher.Side; @@ -125,14 +126,6 @@ public boolean hasExtraData() { return extraData != null; } - @Deprecated - public void setInsetionHandler(InsertionHandler handler) { - if (handler == null) { - return; - } - this.insertionHandler = handler; - } - public void setInsertionHandler(InsertionHandler handler) { if (handler == null) { return; @@ -298,20 +291,25 @@ public boolean equals(Object obj) { return true; } + public void cleanup() { + if (hasDisplayList) { + TransportProxy.proxy.clearDisplayList(displayList); + hasDisplayList = false; + } + } + @Override public String toString() { return "TravelingItem: " + id; } public static class InsertionHandler { - public boolean canInsertItem(TravelingItem item, IInventory inv) { return true; } } public static class TravelingItemCache { - private final Map itemCache = new MapMaker().weakValues().makeMap(); public void cache(TravelingItem item) { diff --git a/common/buildcraft/transport/WireIconProvider.java b/common/buildcraft/transport/WireIconProvider.java index b860af1e48..20631d964e 100644 --- a/common/buildcraft/transport/WireIconProvider.java +++ b/common/buildcraft/transport/WireIconProvider.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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; import java.util.Locale; diff --git a/common/buildcraft/transport/gates/ActionIterator.java b/common/buildcraft/transport/gates/ActionIterator.java index f647dc6dc1..3fd580025d 100755 --- a/common/buildcraft/transport/gates/ActionIterator.java +++ b/common/buildcraft/transport/gates/ActionIterator.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.gates; import java.util.Iterator; @@ -13,7 +17,7 @@ import buildcraft.api.transport.IPipe; public class ActionIterator implements Iterable { - private IPipe pipe; + private final IPipe pipe; public ActionIterator(IPipe iPipe) { pipe = iPipe; diff --git a/common/buildcraft/transport/gates/GateDefinition.java b/common/buildcraft/transport/gates/GateDefinition.java index 231e74b26a..76621fae22 100644 --- a/common/buildcraft/transport/gates/GateDefinition.java +++ b/common/buildcraft/transport/gates/GateDefinition.java @@ -1,5 +1,5 @@ /** 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.gates; @@ -29,7 +29,7 @@ public static String getLocalizedName(GateMaterial material, GateLogic logic) { } } - public static enum GateMaterial { + public enum GateMaterial { REDSTONE("gate_interface_1.png", 146, 1, 0, 0, 1), IRON("gate_interface_2.png", 164, 2, 0, 0, 2), @@ -50,7 +50,7 @@ public static enum GateMaterial { @SideOnly(Side.CLIENT) private TextureAtlasSprite iconItem; - private GateMaterial(String guiFile, int guiHeight, int numSlots, int triggerParameterSlots, int actionParameterSlots, int maxWireColor) { + GateMaterial(String guiFile, int guiHeight, int numSlots, int triggerParameterSlots, int actionParameterSlots, int maxWireColor) { this.guiFile = new ResourceLocation("buildcrafttransport:textures/gui/" + guiFile); this.guiHeight = guiHeight; this.numSlots = numSlots; @@ -95,7 +95,7 @@ public static GateMaterial fromOrdinal(int ordinal) { } } - public static enum GateLogic { + public enum GateLogic { AND, OR; diff --git a/common/buildcraft/transport/gates/GateExpansionBuildcraft.java b/common/buildcraft/transport/gates/GateExpansionBuildcraft.java index c61ed033bd..7baa7a83a9 100644 --- a/common/buildcraft/transport/gates/GateExpansionBuildcraft.java +++ b/common/buildcraft/transport/gates/GateExpansionBuildcraft.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.gates; import net.minecraft.client.renderer.texture.TextureAtlasSprite; diff --git a/common/buildcraft/transport/gates/GateExpansionLightSensor.java b/common/buildcraft/transport/gates/GateExpansionLightSensor.java index 25cedd4ae2..cfa3dc0676 100644 --- a/common/buildcraft/transport/gates/GateExpansionLightSensor.java +++ b/common/buildcraft/transport/gates/GateExpansionLightSensor.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.gates; import java.util.List; diff --git a/common/buildcraft/transport/gates/GateExpansionNote.java b/common/buildcraft/transport/gates/GateExpansionNote.java index 748acd38c4..e701802f93 100644 --- a/common/buildcraft/transport/gates/GateExpansionNote.java +++ b/common/buildcraft/transport/gates/GateExpansionNote.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.gates; import net.minecraft.tileentity.TileEntity; diff --git a/common/buildcraft/transport/gates/GateExpansionPulsar.java b/common/buildcraft/transport/gates/GateExpansionPulsar.java index a7ec061171..4f54f2be93 100644 --- a/common/buildcraft/transport/gates/GateExpansionPulsar.java +++ b/common/buildcraft/transport/gates/GateExpansionPulsar.java @@ -1,5 +1,5 @@ /** 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.gates; @@ -11,12 +11,12 @@ import cofh.api.energy.IEnergyHandler; +import buildcraft.BuildCraftTransport; import buildcraft.api.gates.GateExpansionController; import buildcraft.api.gates.IGate; import buildcraft.api.gates.IGateExpansion; import buildcraft.api.statements.IActionInternal; import buildcraft.api.statements.IStatement; -import buildcraft.BuildCraftTransport; import buildcraft.transport.statements.ActionEnergyPulsar; import buildcraft.transport.statements.ActionSingleEnergyPulse; diff --git a/common/buildcraft/transport/gates/GateExpansionRedstoneFader.java b/common/buildcraft/transport/gates/GateExpansionRedstoneFader.java index 57e411c3a0..9d51134061 100644 --- a/common/buildcraft/transport/gates/GateExpansionRedstoneFader.java +++ b/common/buildcraft/transport/gates/GateExpansionRedstoneFader.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.gates; import java.util.Arrays; diff --git a/common/buildcraft/transport/gates/GateExpansionTimer.java b/common/buildcraft/transport/gates/GateExpansionTimer.java index eb33c7dbe5..feea663e04 100644 --- a/common/buildcraft/transport/gates/GateExpansionTimer.java +++ b/common/buildcraft/transport/gates/GateExpansionTimer.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.gates; import java.util.List; diff --git a/common/buildcraft/transport/gates/GateFactory.java b/common/buildcraft/transport/gates/GateFactory.java index 078e9c2e54..c0b6e91079 100644 --- a/common/buildcraft/transport/gates/GateFactory.java +++ b/common/buildcraft/transport/gates/GateFactory.java @@ -1,13 +1,18 @@ -/** 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 */ +/** + * 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.gates; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.EnumFacing; + import net.minecraftforge.common.util.Constants; import buildcraft.api.gates.GateExpansionController; diff --git a/common/buildcraft/transport/gates/GatePluggable.java b/common/buildcraft/transport/gates/GatePluggable.java index 2a04490fb2..6a18379149 100644 --- a/common/buildcraft/transport/gates/GatePluggable.java +++ b/common/buildcraft/transport/gates/GatePluggable.java @@ -1,32 +1,27 @@ package buildcraft.transport.gates; -import java.util.List; import java.util.Set; -import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagString; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.EnumFacing; + import net.minecraftforge.common.util.Constants; import buildcraft.api.gates.GateExpansions; import buildcraft.api.gates.IGateExpansion; -import buildcraft.api.transport.IPipe; import buildcraft.api.transport.IPipeTile; import buildcraft.api.transport.pluggable.IPipePluggableDynamicRenderer; -import buildcraft.api.transport.pluggable.IPipePluggableState; import buildcraft.api.transport.pluggable.IPipePluggableStaticRenderer; -import buildcraft.api.transport.pluggable.IPipeRenderState; import buildcraft.api.transport.pluggable.PipePluggable; import buildcraft.core.CoreConstants; import buildcraft.core.lib.utils.MatrixTranformations; import buildcraft.transport.Gate; import buildcraft.transport.TileGenericPipe; import buildcraft.transport.render.GatePluggableRenderer; -import buildcraft.transport.render.tile.PipeRendererTESR; import io.netty.buffer.ByteBuf; @@ -87,7 +82,8 @@ public void writeData(ByteBuf buf) { buf.writeBoolean(realGate != null ? realGate.isGatePulsing() : false); final int expansionsSize = expansions.length; - buf.writeInt(expansionsSize); + buf.writeShort(expansionsSize); + for (IGateExpansion expansion : expansions) { buf.writeShort(GateExpansions.getExpansionID(expansion)); } @@ -100,8 +96,9 @@ public void readData(ByteBuf buf) { isLit = buf.readBoolean(); isPulsing = buf.readBoolean(); - final int expansionsSize = buf.readInt(); + final int expansionsSize = buf.readUnsignedShort(); expansions = new IGateExpansion[expansionsSize]; + for (int i = 0; i < expansionsSize; i++) { expansions[i] = GateExpansions.getExpansionByID(buf.readUnsignedShort()); } diff --git a/common/buildcraft/transport/gates/ItemGate.java b/common/buildcraft/transport/gates/ItemGate.java index 9d13579869..2ce732fba0 100755 --- a/common/buildcraft/transport/gates/ItemGate.java +++ b/common/buildcraft/transport/gates/ItemGate.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.gates; import java.util.ArrayList; diff --git a/common/buildcraft/transport/gui/ContainerDiamondPipe.java b/common/buildcraft/transport/gui/ContainerDiamondPipe.java index 64ba955186..3a288d7fc0 100644 --- a/common/buildcraft/transport/gui/ContainerDiamondPipe.java +++ b/common/buildcraft/transport/gui/ContainerDiamondPipe.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.gui; import net.minecraft.entity.player.EntityPlayer; diff --git a/common/buildcraft/transport/gui/ContainerEmeraldFluidPipe.java b/common/buildcraft/transport/gui/ContainerEmeraldFluidPipe.java index 6f3212d19b..7f0a8770f3 100644 --- a/common/buildcraft/transport/gui/ContainerEmeraldFluidPipe.java +++ b/common/buildcraft/transport/gui/ContainerEmeraldFluidPipe.java @@ -1,5 +1,5 @@ /** 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.gui; diff --git a/common/buildcraft/transport/gui/ContainerEmeraldPipe.java b/common/buildcraft/transport/gui/ContainerEmeraldPipe.java index b37e8e8c65..d5c1d1cb3a 100644 --- a/common/buildcraft/transport/gui/ContainerEmeraldPipe.java +++ b/common/buildcraft/transport/gui/ContainerEmeraldPipe.java @@ -1,5 +1,5 @@ /** 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.gui; diff --git a/common/buildcraft/transport/gui/ContainerEmzuliPipe.java b/common/buildcraft/transport/gui/ContainerEmzuliPipe.java index f3a5671bb1..1c36680ada 100644 --- a/common/buildcraft/transport/gui/ContainerEmzuliPipe.java +++ b/common/buildcraft/transport/gui/ContainerEmzuliPipe.java @@ -1,5 +1,5 @@ /** 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.gui; @@ -14,6 +14,7 @@ import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -78,8 +79,8 @@ public void onCraftGuiOpened(ICrafting player) { public void detectAndSendChanges() { super.detectAndSendChanges(); - for (int i = 0; i < crafters.size(); ++i) { - ICrafting player = (ICrafting) crafters.get(i); + for (Object crafter : crafters) { + ICrafting player = (ICrafting) crafter; for (int slot = 0; slot < pipe.slotColors.length; slot++) { if (prevSlotColors[slot] != pipe.slotColors[slot]) { diff --git a/common/buildcraft/transport/gui/ContainerFilteredBuffer.java b/common/buildcraft/transport/gui/ContainerFilteredBuffer.java index 1ff7ebfcde..2c92bcaa3b 100644 --- a/common/buildcraft/transport/gui/ContainerFilteredBuffer.java +++ b/common/buildcraft/transport/gui/ContainerFilteredBuffer.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.gui; import net.minecraft.entity.player.EntityPlayer; diff --git a/common/buildcraft/transport/gui/ContainerGateInterface.java b/common/buildcraft/transport/gui/ContainerGateInterface.java index 45232bb7a6..7487c47ced 100644 --- a/common/buildcraft/transport/gui/ContainerGateInterface.java +++ b/common/buildcraft/transport/gui/ContainerGateInterface.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.gui; import java.util.Collection; @@ -205,8 +209,8 @@ public void detectAndSendChanges() { int state = calculateTriggerState(); if (state != lastTriggerState) { - for (int i = 0; i < this.crafters.size(); i++) { - ICrafting viewingPlayer = (ICrafting) this.crafters.get(i); + for (Object crafter : this.crafters) { + ICrafting viewingPlayer = (ICrafting) crafter; viewingPlayer.sendProgressBarUpdate(this, 0 /* State update */, state); } diff --git a/common/buildcraft/transport/gui/GuiDiamondPipe.java b/common/buildcraft/transport/gui/GuiDiamondPipe.java index b4a2e1e2b6..71207dc166 100644 --- a/common/buildcraft/transport/gui/GuiDiamondPipe.java +++ b/common/buildcraft/transport/gui/GuiDiamondPipe.java @@ -1,5 +1,5 @@ /** 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.gui; @@ -22,6 +22,7 @@ public class GuiDiamondPipe extends GuiBuildCraft { IInventory filterInventory; static { + // FIXME: Make this listen to the property update in-game if (!BuildCraftCore.colorBlindMode) { TEXTURE = new ResourceLocation("buildcrafttransport:textures/gui/filter.png"); } else { diff --git a/common/buildcraft/transport/gui/GuiEmeraldFluidPipe.java b/common/buildcraft/transport/gui/GuiEmeraldFluidPipe.java index d9999c58bc..79b931c74d 100644 --- a/common/buildcraft/transport/gui/GuiEmeraldFluidPipe.java +++ b/common/buildcraft/transport/gui/GuiEmeraldFluidPipe.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.gui; import org.lwjgl.opengl.GL11; @@ -16,7 +20,7 @@ public class GuiEmeraldFluidPipe extends GuiBuildCraft { - private static final ResourceLocation TEXTURE = new ResourceLocation("buildcrafttransport:textures/gui/generic_one_slot.png"); + private static final ResourceLocation TEXTURE = new ResourceLocation("buildcraftcore:textures/gui/generic_one_slot.png"); IInventory playerInventory; IInventory filterInventory; diff --git a/common/buildcraft/transport/gui/GuiEmeraldPipe.java b/common/buildcraft/transport/gui/GuiEmeraldPipe.java index 08f9e6b211..906ba11bf4 100644 --- a/common/buildcraft/transport/gui/GuiEmeraldPipe.java +++ b/common/buildcraft/transport/gui/GuiEmeraldPipe.java @@ -1,5 +1,5 @@ /** 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.gui; @@ -8,11 +8,14 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; import buildcraft.core.lib.gui.GuiBuildCraft; import buildcraft.core.lib.gui.buttons.GuiImageButton; import buildcraft.core.lib.gui.buttons.IButtonClickEventListener; import buildcraft.core.lib.gui.buttons.IButtonClickEventTrigger; +import buildcraft.core.lib.gui.tooltips.ToolTip; +import buildcraft.core.lib.gui.tooltips.ToolTipLine; import buildcraft.core.lib.network.PacketGuiReturn; import buildcraft.core.lib.utils.StringUtils; import buildcraft.transport.pipes.PipeItemsEmerald; @@ -21,7 +24,7 @@ public class GuiEmeraldPipe extends GuiBuildCraft implements IButtonClickEventListener { private static final ResourceLocation TEXTURE = new ResourceLocation("buildcrafttransport:textures/gui/pipe_emerald.png"); - + private static final ResourceLocation TEXTURE_BUTTON = new ResourceLocation("buildcrafttransport:textures/gui/pipe_emerald_button.png"); private static final int WHITE_LIST_BUTTON_ID = 1; private static final int BLACK_LIST_BUTTON_ID = 2; private static final int ROUND_ROBIN_BUTTON_ID = 3; @@ -37,8 +40,6 @@ public GuiEmeraldPipe(EntityPlayer player, PipeItemsEmerald pipe) { this.pipe = pipe; - pipe.getFilters(); - xSize = 175; ySize = 161; } @@ -49,18 +50,19 @@ public void initGui() { this.buttonList.clear(); - this.whiteListButton = new GuiImageButton(WHITE_LIST_BUTTON_ID, this.guiLeft + 7, this.guiTop + 41, GuiImageButton.ButtonImage.WHITE_LIST); + this.whiteListButton = new GuiImageButton(WHITE_LIST_BUTTON_ID, this.guiLeft + 7, this.guiTop + 41, 18, TEXTURE_BUTTON, 19, 19); this.whiteListButton.registerListener(this); + this.whiteListButton.setToolTip(new ToolTip(500, new ToolTipLine(StatCollector.translateToLocal("tip.PipeItemsEmerald.whitelist")))); this.buttonList.add(this.whiteListButton); - this.blackListButton = new GuiImageButton(BLACK_LIST_BUTTON_ID, this.guiLeft + 7 + 18, this.guiTop + 41, - GuiImageButton.ButtonImage.BLACK_LIST); + this.blackListButton = new GuiImageButton(BLACK_LIST_BUTTON_ID, this.guiLeft + 7 + 18, this.guiTop + 41, 18, TEXTURE_BUTTON, 37, 19); this.blackListButton.registerListener(this); + this.blackListButton.setToolTip(new ToolTip(500, new ToolTipLine(StatCollector.translateToLocal("tip.PipeItemsEmerald.blacklist")))); this.buttonList.add(this.blackListButton); - this.roundRobinButton = new GuiImageButton(ROUND_ROBIN_BUTTON_ID, this.guiLeft + 7 + 36, this.guiTop + 41, - GuiImageButton.ButtonImage.ROUND_ROBIN); + this.roundRobinButton = new GuiImageButton(ROUND_ROBIN_BUTTON_ID, this.guiLeft + 7 + 36, this.guiTop + 41, 18, TEXTURE_BUTTON, 55, 19); this.roundRobinButton.registerListener(this); + this.roundRobinButton.setToolTip(new ToolTip(500, new ToolTipLine(StatCollector.translateToLocal("tip.PipeItemsEmerald.roundrobin")))); this.buttonList.add(this.roundRobinButton); switch (pipe.getSettings().getFilterMode()) { @@ -76,16 +78,6 @@ public void initGui() { } } - @Override - public void onGuiClosed() { - if (pipe.getWorld().isRemote) { - PacketGuiReturn pkt = new PacketGuiReturn(pipe.getContainer()); - pkt.sendPacket(); - } - - super.onGuiClosed(); - } - @Override public void handleButtonClick(IButtonClickEventTrigger sender, int buttonId) { switch (buttonId) { @@ -111,6 +103,11 @@ public void handleButtonClick(IButtonClickEventTrigger sender, int buttonId) { pipe.getSettings().setFilterMode(FilterMode.ROUND_ROBIN); break; } + + if (pipe.getWorld().isRemote) { + PacketGuiReturn pkt = new PacketGuiReturn(pipe.getContainer()); + pkt.sendPacket(); + } } @Override diff --git a/common/buildcraft/transport/gui/GuiEmzuliPipe.java b/common/buildcraft/transport/gui/GuiEmzuliPipe.java index 3d323ba3d9..9ba8917af3 100644 --- a/common/buildcraft/transport/gui/GuiEmzuliPipe.java +++ b/common/buildcraft/transport/gui/GuiEmzuliPipe.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.gui; import net.minecraft.entity.player.EntityPlayer; diff --git a/common/buildcraft/transport/gui/GuiFilteredBuffer.java b/common/buildcraft/transport/gui/GuiFilteredBuffer.java index e2a3d33af6..83dbccd773 100644 --- a/common/buildcraft/transport/gui/GuiFilteredBuffer.java +++ b/common/buildcraft/transport/gui/GuiFilteredBuffer.java @@ -1,5 +1,5 @@ /** 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.gui; diff --git a/common/buildcraft/transport/gui/GuiGateInterface.java b/common/buildcraft/transport/gui/GuiGateInterface.java index be6f470702..690d7def2d 100644 --- a/common/buildcraft/transport/gui/GuiGateInterface.java +++ b/common/buildcraft/transport/gui/GuiGateInterface.java @@ -1,5 +1,5 @@ /** 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.gui; @@ -22,6 +22,7 @@ import buildcraft.api.statements.IStatement; import buildcraft.api.statements.IStatementParameter; import buildcraft.api.statements.StatementMouseClick; +import buildcraft.api.transport.IPipe; import buildcraft.core.client.CoreIconProvider; import buildcraft.core.lib.gui.AdvancedSlot; import buildcraft.core.lib.gui.GuiAdvancedInterface; @@ -30,14 +31,13 @@ import buildcraft.core.lib.utils.StringUtils; import buildcraft.transport.ActionActiveState; import buildcraft.transport.Gate; -import buildcraft.transport.Pipe; import buildcraft.transport.gates.GateDefinition.GateMaterial; public class GuiGateInterface extends GuiAdvancedInterface { IInventory playerInventory; private final ContainerGateInterface container; private final GuiGateInterface instance; - private final Pipe pipe; + private final IPipe pipe; private Gate gate; // Used for dragging triggers and actions to their correct positions @@ -46,7 +46,7 @@ public class GuiGateInterface extends GuiAdvancedInterface { private String tooltip = null; private class TriggerSlot extends StatementSlot { - public TriggerSlot(int x, int y, Pipe pipe, int slot) { + public TriggerSlot(int x, int y, IPipe pipe, int slot) { super(instance, x, y, slot); } @@ -57,7 +57,7 @@ public IStatement getStatement() { } private class ActionSlot extends StatementSlot { - public ActionSlot(int x, int y, Pipe pipe, int slot) { + public ActionSlot(int x, int y, IPipe pipe, int slot) { super(instance, x, y, slot); } @@ -68,7 +68,7 @@ public IStatement getStatement() { } class TriggerParameterSlot extends StatementParameterSlot { - public TriggerParameterSlot(int x, int y, Pipe pipe, int slot, StatementSlot iStatementSlot) { + public TriggerParameterSlot(int x, int y, IPipe pipe, int slot, StatementSlot iStatementSlot) { super(instance, x, y, slot, iStatementSlot); } @@ -84,7 +84,7 @@ public void setParameter(IStatementParameter param, boolean notifyServer) { } class ActionParameterSlot extends StatementParameterSlot { - public ActionParameterSlot(int x, int y, Pipe pipe, int slot, StatementSlot iStatementSlot) { + public ActionParameterSlot(int x, int y, IPipe pipe, int slot, StatementSlot iStatementSlot) { super(instance, x, y, slot, iStatementSlot); } @@ -99,7 +99,7 @@ public void setParameter(IStatementParameter param, boolean notifyServer) { } } - public GuiGateInterface(EntityPlayer player, Pipe pipe) { + public GuiGateInterface(EntityPlayer player, IPipe pipe) { super(new ContainerGateInterface(player, pipe), null, null); container = (ContainerGateInterface) this.inventorySlots; @@ -263,7 +263,7 @@ protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { } } - drawBackgroundSlots(); + drawBackgroundSlots(x, y); Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture); @@ -319,16 +319,16 @@ protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { i--; } - AdvancedSlot hoverSlot = getSlotAtLocation(x, y); - boolean isValid = (trigger && hoverSlot instanceof TriggerSlot) || (!trigger && hoverSlot instanceof ActionSlot); + AdvancedSlot hoverSlot = getSlotAtLocation(x, y); + boolean isValid = (trigger && hoverSlot instanceof TriggerSlot) || (!trigger && hoverSlot instanceof ActionSlot); - if (!isValid) { - GlStateManager.color(0.95f, 0.6f, 0.6f); - } + if (!isValid) { + GlStateManager.color(0.95f, 0.6f, 0.6f); + } drawStatement(x - 8, y - 8, state); - GlStateManager.color(1.0f, 1.0f, 1.0f); + GlStateManager.color(1.0f, 1.0f, 1.0f); } GL11.glEnable(GL11.GL_LIGHTING); diff --git a/common/buildcraft/transport/network/PacketFluidUpdate.java b/common/buildcraft/transport/network/PacketFluidUpdate.java index d02d770078..6119006edd 100644 --- a/common/buildcraft/transport/network/PacketFluidUpdate.java +++ b/common/buildcraft/transport/network/PacketFluidUpdate.java @@ -1,5 +1,5 @@ /** 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.network; @@ -9,6 +9,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; + import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; @@ -34,8 +35,8 @@ public PacketFluidUpdate(TileGenericPipe tileG) { super(tileG); } - public PacketFluidUpdate(TileGenericPipe tileG, boolean chunkPacket) { - this(tileG); + public PacketFluidUpdate(TileGenericPipe tileGP, boolean chunkPacket) { + super(tileGP); this.isChunkDataPacket = chunkPacket; } @@ -71,13 +72,13 @@ public void writeData(ByteBuf data) { super.writeData(data); byte[] dBytes = BitSetUtils.toByteArray(delta, 1); - // System.out.printf("write %d, %d, %d = %s, %s%n", posX, posY, posZ, Arrays.toString(dBytes), delta); data.writeBytes(dBytes); if (delta.get(0)) { data.writeShort(renderCache.fluidID); if (renderCache.fluidID != 0) { data.writeInt(renderCache.color); + data.writeByte(renderCache.flags); } } diff --git a/common/buildcraft/transport/network/PacketHandlerTransport.java b/common/buildcraft/transport/network/PacketHandlerTransport.java index 284d1aaf91..7f54620789 100644 --- a/common/buildcraft/transport/network/PacketHandlerTransport.java +++ b/common/buildcraft/transport/network/PacketHandlerTransport.java @@ -1,5 +1,5 @@ /** 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.network; @@ -9,6 +9,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockPos; import net.minecraft.world.World; + import net.minecraftforge.fml.common.network.NetworkRegistry; import buildcraft.core.lib.network.PacketSlotChange; diff --git a/common/buildcraft/transport/network/PacketPipeTransportItemStack.java b/common/buildcraft/transport/network/PacketPipeTransportItemStack.java index 273a045281..f0692bfea0 100644 --- a/common/buildcraft/transport/network/PacketPipeTransportItemStack.java +++ b/common/buildcraft/transport/network/PacketPipeTransportItemStack.java @@ -1,5 +1,5 @@ /** 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.network; diff --git a/common/buildcraft/transport/network/PacketPipeTransportItemStackRequest.java b/common/buildcraft/transport/network/PacketPipeTransportItemStackRequest.java index 6d99582e30..3a5de91ef4 100644 --- a/common/buildcraft/transport/network/PacketPipeTransportItemStackRequest.java +++ b/common/buildcraft/transport/network/PacketPipeTransportItemStackRequest.java @@ -1,5 +1,5 @@ /** 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.network; diff --git a/common/buildcraft/transport/network/PacketPipeTransportTraveler.java b/common/buildcraft/transport/network/PacketPipeTransportTraveler.java index 7c95dc47ef..846eb39e2c 100644 --- a/common/buildcraft/transport/network/PacketPipeTransportTraveler.java +++ b/common/buildcraft/transport/network/PacketPipeTransportTraveler.java @@ -1,5 +1,5 @@ /** 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.network; diff --git a/common/buildcraft/transport/network/PacketPowerUpdate.java b/common/buildcraft/transport/network/PacketPowerUpdate.java index a4795a5da5..b71e33893a 100644 --- a/common/buildcraft/transport/network/PacketPowerUpdate.java +++ b/common/buildcraft/transport/network/PacketPowerUpdate.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.network; import net.minecraft.entity.player.EntityPlayer; diff --git a/common/buildcraft/transport/pipes/PipeFluidsClay.java b/common/buildcraft/transport/pipes/PipeFluidsClay.java new file mode 100644 index 0000000000..b558b5ef99 --- /dev/null +++ b/common/buildcraft/transport/pipes/PipeFluidsClay.java @@ -0,0 +1,68 @@ +/** 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.pipes; + +import java.util.HashSet; +import java.util.Set; + +import net.minecraft.item.Item; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; + +import net.minecraftforge.fluids.IFluidHandler; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +import buildcraft.BuildCraftTransport; +import buildcraft.api.core.IIconProvider; +import buildcraft.api.transport.IPipeTile; +import buildcraft.transport.Pipe; +import buildcraft.transport.PipeIconProvider; +import buildcraft.transport.PipeTransportFluids; +import buildcraft.transport.pipes.events.PipeEventFluid; + +public class PipeFluidsClay extends Pipe { + + public PipeFluidsClay(Item item) { + super(new PipeTransportFluids(), item); + + transport.initFromPipe(getClass()); + } + + @Override + @SideOnly(Side.CLIENT) + public IIconProvider getIconProvider() { + return BuildCraftTransport.instance.pipeIconProvider; + } + + @Override + public int getIconIndex(EnumFacing direction) { + return PipeIconProvider.TYPE.PipeFluidsClay.ordinal(); + } + + public void eventHandler(PipeEventFluid.FindDest event) { + Set machineDirs = new HashSet(); + Set pipeDirs = new HashSet(); + + for (EnumFacing dir : event.destinations) { + if (container.isPipeConnected(dir)) { + TileEntity e = container.getTile(dir); + if (e instanceof IFluidHandler) { + IFluidHandler h = (IFluidHandler) e; + if (h.fill(dir.getOpposite(), event.fluidStack, false) > 0) { + if (e instanceof IPipeTile) { + pipeDirs.add(dir); + } else { + machineDirs.add(dir); + } + } + } + } + } + + event.destinations.clear(); + event.destinations.addAll(machineDirs.size() > 0 ? machineDirs : pipeDirs); + } +} diff --git a/common/buildcraft/transport/pipes/PipeFluidsCobblestone.java b/common/buildcraft/transport/pipes/PipeFluidsCobblestone.java index 0b759ca373..77e78b506d 100644 --- a/common/buildcraft/transport/pipes/PipeFluidsCobblestone.java +++ b/common/buildcraft/transport/pipes/PipeFluidsCobblestone.java @@ -1,16 +1,21 @@ -/** 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 */ +/** + * 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.pipes; import net.minecraft.item.Item; import net.minecraft.util.EnumFacing; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import buildcraft.api.core.IIconProvider; import buildcraft.BuildCraftTransport; +import buildcraft.api.core.IIconProvider; import buildcraft.transport.Pipe; import buildcraft.transport.PipeIconProvider; import buildcraft.transport.PipeTransportFluids; diff --git a/common/buildcraft/transport/pipes/PipeFluidsDiamond.java b/common/buildcraft/transport/pipes/PipeFluidsDiamond.java index 6dde65dc47..e5281a2bdb 100644 --- a/common/buildcraft/transport/pipes/PipeFluidsDiamond.java +++ b/common/buildcraft/transport/pipes/PipeFluidsDiamond.java @@ -1,5 +1,5 @@ /** 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.pipes; @@ -14,26 +14,27 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; + import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import buildcraft.BuildCraftTransport; import buildcraft.api.core.IIconProvider; import buildcraft.core.GuiIds; import buildcraft.core.lib.inventory.SimpleInventory; import buildcraft.core.lib.utils.FluidUtils; import buildcraft.core.lib.utils.NetworkUtils; -import buildcraft.BuildCraftTransport; +import buildcraft.transport.BlockGenericPipe; import buildcraft.transport.IDiamondPipe; import buildcraft.transport.Pipe; import buildcraft.transport.PipeIconProvider; import buildcraft.transport.PipeTransportFluids; -import buildcraft.transport.BlockGenericPipe; import buildcraft.transport.pipes.events.PipeEventFluid; import io.netty.buffer.ByteBuf; -public class PipeFluidsDiamond extends Pipeimplements IDiamondPipe { +public class PipeFluidsDiamond extends Pipe implements IDiamondPipe { private class FilterInventory extends SimpleInventory { public boolean[] filteredDirections = new boolean[6]; @@ -94,7 +95,7 @@ public int getIconIndexForItem() { } @Override - public boolean blockActivated(EntityPlayer entityplayer) { + public boolean blockActivated(EntityPlayer entityplayer, EnumFacing direction) { if (entityplayer.getCurrentEquippedItem() != null) { if (Block.getBlockFromItem(entityplayer.getCurrentEquippedItem().getItem()) instanceof BlockGenericPipe) { return false; @@ -113,7 +114,7 @@ public void eventHandler(PipeEventFluid.FindDest event) { Fluid fluidInTank = event.fluidStack.getFluid(); Set originalDestinations = new HashSet(); originalDestinations.addAll(event.destinations.elementSet()); - boolean isFiltered = true; + boolean isFiltered = false; int[] filterCount = new int[6]; for (EnumFacing dir : originalDestinations) { @@ -162,13 +163,14 @@ public void writeToNBT(NBTTagCompound nbt) { @Override public void writeData(ByteBuf data) { NBTTagCompound nbt = new NBTTagCompound(); - writeToNBT(nbt); + filters.writeToNBT(nbt); NetworkUtils.writeNBT(data, nbt); } @Override public void readData(ByteBuf data) { NBTTagCompound nbt = NetworkUtils.readNBT(data); - readFromNBT(nbt); + filters.readFromNBT(nbt); + filters.markDirty(); } } diff --git a/common/buildcraft/transport/pipes/PipeFluidsEmerald.java b/common/buildcraft/transport/pipes/PipeFluidsEmerald.java index 9594a5323f..0282645846 100644 --- a/common/buildcraft/transport/pipes/PipeFluidsEmerald.java +++ b/common/buildcraft/transport/pipes/PipeFluidsEmerald.java @@ -1,5 +1,5 @@ /** 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.pipes; @@ -10,17 +10,18 @@ import net.minecraft.item.Item; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; + import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidHandler; +import buildcraft.BuildCraftTransport; import buildcraft.api.core.ISerializable; import buildcraft.core.GuiIds; import buildcraft.core.lib.inventory.SimpleInventory; import buildcraft.core.lib.utils.FluidUtils; import buildcraft.core.lib.utils.NetworkUtils; -import buildcraft.BuildCraftTransport; -import buildcraft.transport.PipeIconProvider; import buildcraft.transport.BlockGenericPipe; +import buildcraft.transport.PipeIconProvider; import io.netty.buffer.ByteBuf; @@ -61,14 +62,14 @@ public int extractFluid(IFluidHandler fluidHandler, EnumFacing side) { } @Override - public boolean blockActivated(EntityPlayer entityplayer) { + public boolean blockActivated(EntityPlayer entityplayer, EnumFacing side) { if (entityplayer.getCurrentEquippedItem() != null) { if (Block.getBlockFromItem(entityplayer.getCurrentEquippedItem().getItem()) instanceof BlockGenericPipe) { return false; } } - if (super.blockActivated(entityplayer)) { + if (super.blockActivated(entityplayer, side)) { return true; } @@ -83,14 +84,14 @@ public boolean blockActivated(EntityPlayer entityplayer) { @Override public void writeData(ByteBuf data) { NBTTagCompound nbt = new NBTTagCompound(); - writeToNBT(nbt); + filters.writeToNBT(nbt); NetworkUtils.writeNBT(data, nbt); } @Override public void readData(ByteBuf data) { NBTTagCompound nbt = NetworkUtils.readNBT(data); - readFromNBT(nbt); + filters.readFromNBT(nbt); } @Override diff --git a/common/buildcraft/transport/pipes/PipeFluidsGold.java b/common/buildcraft/transport/pipes/PipeFluidsGold.java index 1d7076192b..437f8dd4d4 100644 --- a/common/buildcraft/transport/pipes/PipeFluidsGold.java +++ b/common/buildcraft/transport/pipes/PipeFluidsGold.java @@ -1,16 +1,21 @@ -/** 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 */ +/** + * 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.pipes; import net.minecraft.item.Item; import net.minecraft.util.EnumFacing; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import buildcraft.api.core.IIconProvider; import buildcraft.BuildCraftTransport; +import buildcraft.api.core.IIconProvider; import buildcraft.transport.Pipe; import buildcraft.transport.PipeIconProvider; import buildcraft.transport.PipeTransportFluids; diff --git a/common/buildcraft/transport/pipes/PipeFluidsIron.java b/common/buildcraft/transport/pipes/PipeFluidsIron.java index dac560b5a4..521358a297 100644 --- a/common/buildcraft/transport/pipes/PipeFluidsIron.java +++ b/common/buildcraft/transport/pipes/PipeFluidsIron.java @@ -1,5 +1,5 @@ /** 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.pipes; @@ -11,15 +11,17 @@ import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; + import net.minecraftforge.fluids.IFluidHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import buildcraft.BuildCraftTransport; +import buildcraft.api.core.EnumPipePart; import buildcraft.api.core.IIconProvider; import buildcraft.api.statements.IActionInternal; import buildcraft.api.statements.StatementSlot; import buildcraft.api.transport.IPipeTile; -import buildcraft.BuildCraftTransport; import buildcraft.transport.Pipe; import buildcraft.transport.PipeIconProvider; import buildcraft.transport.PipeTransportFluids; @@ -52,8 +54,8 @@ public PipeFluidsIron(Item item) { } @Override - public boolean blockActivated(EntityPlayer entityplayer) { - return logic.blockActivated(entityplayer); + public boolean blockActivated(EntityPlayer entityplayer, EnumFacing side) { + return logic.blockActivated(entityplayer, EnumPipePart.fromFacing(side)); } @Override diff --git a/common/buildcraft/transport/pipes/PipeFluidsQuartz.java b/common/buildcraft/transport/pipes/PipeFluidsQuartz.java index 6391d9dc10..96f88d2fba 100644 --- a/common/buildcraft/transport/pipes/PipeFluidsQuartz.java +++ b/common/buildcraft/transport/pipes/PipeFluidsQuartz.java @@ -1,16 +1,21 @@ -/** 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 */ +/** + * 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.pipes; import net.minecraft.item.Item; import net.minecraft.util.EnumFacing; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import buildcraft.api.core.IIconProvider; import buildcraft.BuildCraftTransport; +import buildcraft.api.core.IIconProvider; import buildcraft.transport.Pipe; import buildcraft.transport.PipeIconProvider; import buildcraft.transport.PipeTransportFluids; diff --git a/common/buildcraft/transport/pipes/PipeFluidsSandstone.java b/common/buildcraft/transport/pipes/PipeFluidsSandstone.java index 37a326f290..b7317e8e42 100644 --- a/common/buildcraft/transport/pipes/PipeFluidsSandstone.java +++ b/common/buildcraft/transport/pipes/PipeFluidsSandstone.java @@ -1,5 +1,5 @@ /** 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.pipes; @@ -7,20 +7,21 @@ import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; + import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import buildcraft.BuildCraftTransport; import buildcraft.api.core.IIconProvider; import buildcraft.api.transport.IPipeTile; -import buildcraft.BuildCraftTransport; import buildcraft.transport.IPipeConnectionForced; import buildcraft.transport.IPipeTransportFluidsHook; import buildcraft.transport.Pipe; import buildcraft.transport.PipeIconProvider; import buildcraft.transport.PipeTransportFluids; -public class PipeFluidsSandstone extends Pipeimplements IPipeTransportFluidsHook, IPipeConnectionForced { +public class PipeFluidsSandstone extends Pipe implements IPipeTransportFluidsHook, IPipeConnectionForced { public PipeFluidsSandstone(Item item) { super(new PipeTransportFluids(), item); diff --git a/common/buildcraft/transport/pipes/PipeFluidsStone.java b/common/buildcraft/transport/pipes/PipeFluidsStone.java index 9c48e8f3a6..135815e37b 100644 --- a/common/buildcraft/transport/pipes/PipeFluidsStone.java +++ b/common/buildcraft/transport/pipes/PipeFluidsStone.java @@ -1,16 +1,21 @@ -/** 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 */ +/** + * 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.pipes; import net.minecraft.item.Item; import net.minecraft.util.EnumFacing; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import buildcraft.api.core.IIconProvider; import buildcraft.BuildCraftTransport; +import buildcraft.api.core.IIconProvider; import buildcraft.transport.Pipe; import buildcraft.transport.PipeIconProvider; import buildcraft.transport.PipeTransportFluids; diff --git a/common/buildcraft/transport/pipes/PipeFluidsVoid.java b/common/buildcraft/transport/pipes/PipeFluidsVoid.java index e11203b1b1..8a81fd3548 100644 --- a/common/buildcraft/transport/pipes/PipeFluidsVoid.java +++ b/common/buildcraft/transport/pipes/PipeFluidsVoid.java @@ -1,17 +1,22 @@ -/** 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 */ +/** + * 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.pipes; import net.minecraft.item.Item; import net.minecraft.util.EnumFacing; + import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import buildcraft.api.core.IIconProvider; import buildcraft.BuildCraftTransport; +import buildcraft.api.core.IIconProvider; import buildcraft.transport.IPipeTransportFluidsHook; import buildcraft.transport.Pipe; import buildcraft.transport.PipeIconProvider; diff --git a/common/buildcraft/transport/pipes/PipeFluidsWood.java b/common/buildcraft/transport/pipes/PipeFluidsWood.java index b3038242cf..2b99186f50 100644 --- a/common/buildcraft/transport/pipes/PipeFluidsWood.java +++ b/common/buildcraft/transport/pipes/PipeFluidsWood.java @@ -1,5 +1,5 @@ /** 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.pipes; @@ -10,6 +10,7 @@ import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; + import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTankInfo; import net.minecraftforge.fluids.IFluidHandler; @@ -18,18 +19,19 @@ import cofh.api.energy.IEnergyHandler; +import buildcraft.BuildCraftTransport; +import buildcraft.api.core.EnumPipePart; import buildcraft.api.core.IIconProvider; import buildcraft.api.core.ISerializable; import buildcraft.api.tiles.IDebuggable; import buildcraft.api.transport.IPipeTile; -import buildcraft.BuildCraftTransport; import buildcraft.transport.Pipe; import buildcraft.transport.PipeIconProvider; import buildcraft.transport.PipeTransportFluids; import io.netty.buffer.ByteBuf; -public class PipeFluidsWood extends Pipeimplements IEnergyHandler, ISerializable, IDebuggable { +public class PipeFluidsWood extends Pipe implements IEnergyHandler, ISerializable, IDebuggable { private static final int ENERGY_MULTIPLIER = 50; public int fluidToExtract; @@ -58,13 +60,13 @@ public PipeFluidsWood(Item item) { } @Override - public boolean blockActivated(EntityPlayer entityplayer) { - return logic.blockActivated(entityplayer); + public boolean blockActivated(EntityPlayer entityplayer, EnumFacing side) { + return logic.blockActivated(entityplayer, EnumPipePart.fromFacing(side)); } @Override public void onNeighborBlockChange(int blockId) { - logic.onNeighborBlockChange(blockId); + logic.onNeighborBlockChange(); super.onNeighborBlockChange(blockId); } @@ -108,7 +110,7 @@ public int extractFluid(IFluidHandler fluidHandler, EnumFacing side) { FluidTankInfo tankInfo = transport.getTankInfo(side)[0]; FluidStack extracted; - if (tankInfo.fluid != null && tankInfo.fluid != null) { + if (tankInfo.fluid != null) { extracted = fluidHandler.drain(side.getOpposite(), new FluidStack(tankInfo.fluid, amount), false); } else { extracted = fluidHandler.drain(side.getOpposite(), amount, false); @@ -119,13 +121,22 @@ public int extractFluid(IFluidHandler fluidHandler, EnumFacing side) { if (extracted != null) { inserted = transport.fill(side, extracted, true); if (inserted > 0) { - fluidHandler.drain(side.getOpposite(), new FluidStack(extracted.getFluid(), inserted), true); + extracted.amount = inserted; + fluidHandler.drain(side.getOpposite(), extracted, true); } } return inserted; } + protected int getEnergyMultiplier() { + return 5 * BuildCraftTransport.pipeFluidsBaseFlowRate; + } + + protected int getMaxExtractionFluid() { + return 100 * BuildCraftTransport.pipeFluidsBaseFlowRate; + } + @Override @SideOnly(Side.CLIENT) public IIconProvider getIconProvider() { @@ -165,10 +176,10 @@ public int receiveEnergy(EnumFacing from, int maxReceive, boolean simulate) { return 0; } - int maxToReceive = (1000 - fluidToExtract) / ENERGY_MULTIPLIER; + int maxToReceive = (getMaxExtractionFluid() - fluidToExtract) / getEnergyMultiplier(); int received = Math.min(maxReceive, maxToReceive); if (!simulate) { - fluidToExtract += ENERGY_MULTIPLIER * received; + fluidToExtract += getEnergyMultiplier() * received; } return received; } @@ -185,7 +196,7 @@ public int getEnergyStored(EnumFacing from) { @Override public int getMaxEnergyStored(EnumFacing from) { - return 1000 / ENERGY_MULTIPLIER; + return 1000 / getEnergyMultiplier(); } @Override diff --git a/common/buildcraft/transport/pipes/PipeItemsClay.java b/common/buildcraft/transport/pipes/PipeItemsClay.java index aba110b208..ad97e2fd86 100644 --- a/common/buildcraft/transport/pipes/PipeItemsClay.java +++ b/common/buildcraft/transport/pipes/PipeItemsClay.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.pipes; import java.util.LinkedList; diff --git a/common/buildcraft/transport/pipes/PipeItemsCobblestone.java b/common/buildcraft/transport/pipes/PipeItemsCobblestone.java index 25500d64e8..930467a2fc 100644 --- a/common/buildcraft/transport/pipes/PipeItemsCobblestone.java +++ b/common/buildcraft/transport/pipes/PipeItemsCobblestone.java @@ -1,16 +1,17 @@ /** 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.pipes; import net.minecraft.item.Item; import net.minecraft.util.EnumFacing; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import buildcraft.api.core.IIconProvider; import buildcraft.BuildCraftTransport; +import buildcraft.api.core.IIconProvider; import buildcraft.transport.Pipe; import buildcraft.transport.PipeIconProvider; import buildcraft.transport.PipeTransportItems; diff --git a/common/buildcraft/transport/pipes/PipeItemsDaizuli.java b/common/buildcraft/transport/pipes/PipeItemsDaizuli.java index 750582339d..3bd9ea965b 100644 --- a/common/buildcraft/transport/pipes/PipeItemsDaizuli.java +++ b/common/buildcraft/transport/pipes/PipeItemsDaizuli.java @@ -1,5 +1,5 @@ /** 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.pipes; @@ -14,30 +14,30 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import buildcraft.BuildCraftTransport; +import buildcraft.api.core.EnumColor; +import buildcraft.api.core.EnumPipePart; import buildcraft.api.core.IIconProvider; import buildcraft.api.core.ISerializable; -import buildcraft.api.core.EnumColor; import buildcraft.api.statements.IActionInternal; import buildcraft.api.statements.StatementSlot; import buildcraft.api.tools.IToolWrench; import buildcraft.api.transport.IPipeTile; import buildcraft.core.lib.utils.ColorUtils; -import buildcraft.BuildCraftTransport; import buildcraft.transport.Pipe; import buildcraft.transport.PipeIconProvider; import buildcraft.transport.PipeTransportItems; -import buildcraft.transport.TransportConstants; -import buildcraft.transport.TravelingItem; import buildcraft.transport.pipes.events.PipeEventItem; import buildcraft.transport.statements.ActionPipeColor; import buildcraft.transport.statements.ActionPipeDirection; import io.netty.buffer.ByteBuf; -public class PipeItemsDaizuli extends Pipeimplements ISerializable { +public class PipeItemsDaizuli extends Pipe implements ISerializable { private int standardIconIndex = PipeIconProvider.TYPE.PipeItemsDaizuli_Black.ordinal(); private int solidIconIndex = PipeIconProvider.TYPE.PipeItemsDaizuli_Solid.ordinal(); @@ -80,7 +80,7 @@ public void setColor(EnumColor c) { } @Override - public boolean blockActivated(EntityPlayer player) { + public boolean blockActivated(EntityPlayer player, EnumFacing side) { if (player.isSneaking()) { Item equipped = player.getCurrentEquippedItem() != null ? player.getCurrentEquippedItem().getItem() : null; if (equipped instanceof IToolWrench && ((IToolWrench) equipped).canWrench(player, container.getPos())) { @@ -96,7 +96,7 @@ public boolean blockActivated(EntityPlayer player) { return true; } - return logic.blockActivated(player); + return logic.blockActivated(player, EnumPipePart.fromFacing(side)); } @Override @@ -149,16 +149,7 @@ public void eventHandler(PipeEventItem.FindDest event) { } public void eventHandler(PipeEventItem.AdjustSpeed event) { - event.handled = true; - TravelingItem item = event.item; - - if (item.getSpeed() > TransportConstants.PIPE_NORMAL_SPEED) { - item.setSpeed(item.getSpeed() - TransportConstants.PIPE_NORMAL_SPEED / 4.0F); - } - - if (item.getSpeed() < TransportConstants.PIPE_NORMAL_SPEED) { - item.setSpeed(TransportConstants.PIPE_NORMAL_SPEED); - } + event.slowdownAmount /= 4; } @Override diff --git a/common/buildcraft/transport/pipes/PipeItemsDiamond.java b/common/buildcraft/transport/pipes/PipeItemsDiamond.java index 17973d6b4c..69d7f5a6c7 100644 --- a/common/buildcraft/transport/pipes/PipeItemsDiamond.java +++ b/common/buildcraft/transport/pipes/PipeItemsDiamond.java @@ -1,5 +1,5 @@ /** 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.pipes; @@ -13,6 +13,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -84,7 +85,7 @@ public int getIconIndexForItem() { } @Override - public boolean blockActivated(EntityPlayer entityplayer) { + public boolean blockActivated(EntityPlayer entityplayer, EnumFacing direction) { if (entityplayer.getCurrentEquippedItem() != null) { if (Block.getBlockFromItem(entityplayer.getCurrentEquippedItem().getItem()) instanceof BlockGenericPipe) { return false; @@ -123,6 +124,25 @@ private boolean findDest(PipeEventItem.FindDest event) { return false; } + private void clearDest(PipeEventItem.FindDest event) { + for (EnumFacing dir : event.destinations) { + if (filters.filterCounts[dir.ordinal()] > 0) { + for (int slot = 0; slot < 9; ++slot) { + int v = dir.ordinal() * 9 + slot; + if ((usedFilters & (1 << v)) == 0) { + continue; + } + + ItemStack filter = getFilters().getStackInSlot(v); + + if (StackHelper.isMatchingItemOrList(filter, event.item.getItemStack())) { + usedFilters ^= 1 << v; + } + } + } + } + } + @PipeEventPriority(priority = -4194304) public void eventHandler(PipeEventItem.FindDest event) { // We're running last and we can safely assume that nothing else @@ -134,7 +154,7 @@ public void eventHandler(PipeEventItem.FindDest event) { } if (usedFilters != 0) { - usedFilters = 0; + clearDest(event); if (findDest(event)) { return; } @@ -169,13 +189,17 @@ public void writeToNBT(NBTTagCompound nbt) { @Override public void writeData(ByteBuf data) { NBTTagCompound nbt = new NBTTagCompound(); - writeToNBT(nbt); + filters.writeToNBT(nbt); + nbt.setLong("usedFilters", usedFilters); NetworkUtils.writeNBT(data, nbt); } @Override public void readData(ByteBuf data) { NBTTagCompound nbt = NetworkUtils.readNBT(data); - readFromNBT(nbt); + filters.readFromNBT(nbt); + if (nbt.hasKey("usedFilters")) { + usedFilters = nbt.getLong("usedFilters"); + } } } diff --git a/common/buildcraft/transport/pipes/PipeItemsEmerald.java b/common/buildcraft/transport/pipes/PipeItemsEmerald.java index 313f60b792..377ad98bc8 100644 --- a/common/buildcraft/transport/pipes/PipeItemsEmerald.java +++ b/common/buildcraft/transport/pipes/PipeItemsEmerald.java @@ -1,5 +1,5 @@ /** 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.pipes; @@ -13,6 +13,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; +import buildcraft.BuildCraftTransport; import buildcraft.api.core.ISerializable; import buildcraft.core.GuiIds; import buildcraft.core.lib.inventory.InvUtils; @@ -21,9 +22,8 @@ import buildcraft.core.lib.inventory.StackHelper; import buildcraft.core.lib.network.IGuiReturnHandler; import buildcraft.core.lib.utils.NetworkUtils; -import buildcraft.BuildCraftTransport; -import buildcraft.transport.PipeIconProvider; import buildcraft.transport.BlockGenericPipe; +import buildcraft.transport.PipeIconProvider; import io.netty.buffer.ByteBuf; @@ -74,14 +74,14 @@ public PipeItemsEmerald(Item item) { } @Override - public boolean blockActivated(EntityPlayer entityplayer) { + public boolean blockActivated(EntityPlayer entityplayer, EnumFacing side) { if (entityplayer.getCurrentEquippedItem() != null) { if (Block.getBlockFromItem(entityplayer.getCurrentEquippedItem().getItem()) instanceof BlockGenericPipe) { return false; } } - if (super.blockActivated(entityplayer)) { + if (super.blockActivated(entityplayer, side)) { return true; } @@ -131,11 +131,15 @@ private ItemStack[] checkExtractFiltered(ISidedInventory inventory, boolean doRe if (doRemove) { int maxStackSize = stack.stackSize; int stackSize = Math.min(maxStackSize, battery.getEnergyStored() / 10); - speedMultiplier = Math.min(4.0F, battery.getEnergyStored() * 10 / stackSize); - int energyUsed = (int) (stackSize * 10 * speedMultiplier); - battery.useEnergy(energyUsed, energyUsed, false); + if (stackSize > 0) { + speedMultiplier = Math.min(4.0F, battery.getEnergyStored() * 10 / stackSize); + int energyUsed = (int) (stackSize * 10 * speedMultiplier); + battery.useEnergy(energyUsed, energyUsed, false); - stack = inventory.decrStackSize(k, stackSize); + stack = inventory.decrStackSize(k, stackSize); + } else { + return null; + } } return new ItemStack[] { stack }; @@ -196,20 +200,20 @@ private boolean isFiltered(ItemStack stack) { } private void incrementFilter() { - currentFilter++; + currentFilter = (currentFilter + 1) % filters.getSizeInventory(); int count = 0; - while (filters.getStackInSlot(currentFilter % filters.getSizeInventory()) == null && count < filters.getSizeInventory()) { - currentFilter++; + while (filters.getStackInSlot(currentFilter) == null && count < filters.getSizeInventory()) { + currentFilter = (currentFilter + 1) % filters.getSizeInventory(); count++; } } private ItemStack getCurrentFilter() { - ItemStack filter = filters.getStackInSlot(currentFilter % filters.getSizeInventory()); + ItemStack filter = filters.getStackInSlot(currentFilter); if (filter == null) { incrementFilter(); } - return filters.getStackInSlot(currentFilter % filters.getSizeInventory()); + return filters.getStackInSlot(currentFilter); } public IInventory getFilters() { @@ -223,14 +227,18 @@ public EmeraldPipeSettings getSettings() { @Override public void writeData(ByteBuf data) { NBTTagCompound nbt = new NBTTagCompound(); - writeToNBT(nbt); + filters.writeToNBT(nbt); + settings.writeToNBT(nbt); NetworkUtils.writeNBT(data, nbt); + data.writeByte(currentFilter); } @Override public void readData(ByteBuf data) { NBTTagCompound nbt = NetworkUtils.readNBT(data); - readFromNBT(nbt); + filters.readFromNBT(nbt); + settings.readFromNBT(nbt); + currentFilter = data.readUnsignedByte(); } @Override @@ -240,7 +248,7 @@ public void readFromNBT(NBTTagCompound nbt) { filters.readFromNBT(nbt); settings.readFromNBT(nbt); - currentFilter = nbt.getInteger("currentFilter"); + currentFilter = nbt.getInteger("currentFilter") % filters.getSizeInventory(); } @Override diff --git a/common/buildcraft/transport/pipes/PipeItemsEmzuli.java b/common/buildcraft/transport/pipes/PipeItemsEmzuli.java index 8b076a86dd..7f3122a27f 100644 --- a/common/buildcraft/transport/pipes/PipeItemsEmzuli.java +++ b/common/buildcraft/transport/pipes/PipeItemsEmzuli.java @@ -1,5 +1,5 @@ /** 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.pipes; @@ -11,12 +11,14 @@ import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; import net.minecraft.util.Vec3; +import buildcraft.BuildCraftTransport; import buildcraft.api.core.EnumColor; import buildcraft.api.statements.IActionInternal; import buildcraft.api.statements.StatementSlot; @@ -25,10 +27,9 @@ import buildcraft.core.lib.inventory.SimpleInventory; import buildcraft.core.lib.inventory.StackHelper; import buildcraft.core.lib.network.IGuiReturnHandler; -import buildcraft.BuildCraftTransport; +import buildcraft.transport.BlockGenericPipe; import buildcraft.transport.PipeIconProvider; import buildcraft.transport.TravelingItem; -import buildcraft.transport.BlockGenericPipe; import buildcraft.transport.statements.ActionExtractionPreset; import io.netty.buffer.ByteBuf; @@ -49,14 +50,23 @@ public PipeItemsEmzuli(Item item) { } @Override - public boolean blockActivated(EntityPlayer entityplayer) { + public void onPostTick() { + // TODO: This has a side-effect of skipping an extract every now and + // then if an item cannot be found, but at least it's 100% reliable. + + super.onPostTick(); + incrementFilter(); + } + + @Override + public boolean blockActivated(EntityPlayer entityplayer, EnumFacing side) { if (entityplayer.getCurrentEquippedItem() != null) { if (Block.getBlockFromItem(entityplayer.getCurrentEquippedItem().getItem()) instanceof BlockGenericPipe) { return false; } } - if (super.blockActivated(entityplayer)) { + if (super.blockActivated(entityplayer, side)) { return true; } @@ -80,15 +90,13 @@ protected TravelingItem makeItem(Vec3 pos, ItemStack stack) { /** Return the itemstack that can be if something can be extracted from this inventory, null if none. On certain * cases, the extractable slot depends on the position of the pipe. */ + @Override public ItemStack[] checkExtract(IInventory inventory, boolean doRemove, EnumFacing from) { - if (activeFlags.isEmpty()) { return null; } - incrementFilter(); - if (filters.getStackInSlot(currentFilter % filterCount) == null || !activeFlags.get(currentFilter % filterCount)) { return null; } @@ -104,26 +112,33 @@ public ItemStack[] checkExtract(IInventory inventory, boolean doRemove, EnumFaci } @Override - public ItemStack checkExtractGeneric(net.minecraft.inventory.ISidedInventory inventory, boolean doRemove, EnumFacing from) { - for (int i : inventory.getSlotsForFace(from)) { - ItemStack stack = inventory.getStackInSlot(i); - if (stack != null && stack.stackSize > 0) { - ItemStack filter = getCurrentFilter(); - if (filter == null) { - return null; - } - if (!StackHelper.isMatchingItemOrList(stack, filter)) { - continue; - } - if (!inventory.canExtractItem(i, stack, from)) { + public ItemStack checkExtractGeneric(ISidedInventory inventory, boolean doRemove, EnumFacing from) { + if (inventory == null) { + return null; + } + + ItemStack filter = getCurrentFilter(); + if (filter == null) { + return null; + } + + for (int k : inventory.getSlotsForFace(from)) { + ItemStack slot = inventory.getStackInSlot(k); + + if (slot != null && slot.stackSize > 0 && inventory.canExtractItem(k, slot, from)) { + if (!StackHelper.isMatchingItemOrList(slot, filter)) { continue; } + if (doRemove) { - int stackSize = (int) Math.floor(battery.useEnergy(10, stack.stackSize * 10, false) / 10); + int maxStackSize = slot.stackSize; + int stackSize = Math.min(maxStackSize, battery.getEnergyStored() / 10); + int energyUsed = (int) (stackSize * 10 * speedMultiplier); + battery.useEnergy(energyUsed, energyUsed, false); - return inventory.decrStackSize(i, stackSize); + return inventory.decrStackSize(k, stackSize); } else { - return stack; + return slot; } } } @@ -220,6 +235,6 @@ private void incrementFilter() { } private ItemStack getCurrentFilter() { - return filters.getStackInSlot(currentFilter % filters.getSizeInventory()); + return filters.getStackInSlot(currentFilter % filterCount); } } diff --git a/common/buildcraft/transport/pipes/PipeItemsGold.java b/common/buildcraft/transport/pipes/PipeItemsGold.java index a4a341f9bb..9645f95dcc 100644 --- a/common/buildcraft/transport/pipes/PipeItemsGold.java +++ b/common/buildcraft/transport/pipes/PipeItemsGold.java @@ -1,17 +1,18 @@ /** 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.pipes; import net.minecraft.item.Item; import net.minecraft.util.EnumFacing; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import buildcraft.BuildCraftTransport; import buildcraft.api.core.IIconProvider; import buildcraft.core.lib.utils.MathUtils; -import buildcraft.BuildCraftTransport; import buildcraft.transport.Pipe; import buildcraft.transport.PipeIconProvider; import buildcraft.transport.PipeTransportItems; @@ -39,6 +40,7 @@ public int getIconIndex(EnumFacing direction) { public void eventHandler(PipeEventItem.AdjustSpeed event) { event.handled = true; TravelingItem item = event.item; - item.setSpeed(MathUtils.clamp(item.getSpeed() * 4F, TransportConstants.PIPE_NORMAL_SPEED * 4F, TransportConstants.PIPE_NORMAL_SPEED * 15F)); + item.setSpeed(MathUtils.clamp(item.getSpeed() * TransportConstants.PIPE_SPEEDUP_MULTIPLIER, TransportConstants.PIPE_MIN_SPEED + * TransportConstants.PIPE_SPEEDUP_MULTIPLIER, TransportConstants.PIPE_MAX_SPEED)); } } diff --git a/common/buildcraft/transport/pipes/PipeItemsIron.java b/common/buildcraft/transport/pipes/PipeItemsIron.java index 508af3910f..4c9788f9f7 100644 --- a/common/buildcraft/transport/pipes/PipeItemsIron.java +++ b/common/buildcraft/transport/pipes/PipeItemsIron.java @@ -1,5 +1,5 @@ /** 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.pipes; @@ -12,10 +12,12 @@ import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import buildcraft.BuildCraftTransport; +import buildcraft.api.core.EnumPipePart; import buildcraft.api.core.IIconProvider; import buildcraft.api.statements.IActionInternal; import buildcraft.api.statements.StatementSlot; @@ -56,8 +58,8 @@ public PipeItemsIron(Item item) { } @Override - public boolean blockActivated(EntityPlayer entityplayer) { - return logic.blockActivated(entityplayer); + public boolean blockActivated(EntityPlayer entityplayer, EnumFacing side) { + return logic.blockActivated(entityplayer, EnumPipePart.fromFacing(side)); } @Override diff --git a/common/buildcraft/transport/pipes/PipeItemsLapis.java b/common/buildcraft/transport/pipes/PipeItemsLapis.java index d075a92c99..8cde09ddb2 100644 --- a/common/buildcraft/transport/pipes/PipeItemsLapis.java +++ b/common/buildcraft/transport/pipes/PipeItemsLapis.java @@ -1,5 +1,5 @@ /** 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.pipes; @@ -12,22 +12,21 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.util.EnumFacing; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import buildcraft.api.core.IIconProvider; +import buildcraft.BuildCraftTransport; import buildcraft.api.core.EnumColor; +import buildcraft.api.core.IIconProvider; import buildcraft.api.properties.BuildCraftProperties; import buildcraft.api.statements.IActionInternal; import buildcraft.api.statements.StatementSlot; import buildcraft.api.tools.IToolWrench; import buildcraft.core.lib.utils.ColorUtils; -import buildcraft.BuildCraftTransport; import buildcraft.transport.Pipe; import buildcraft.transport.PipeIconProvider; import buildcraft.transport.PipeTransportItems; -import buildcraft.transport.TransportConstants; -import buildcraft.transport.TravelingItem; import buildcraft.transport.pipes.events.PipeEventItem; import buildcraft.transport.statements.ActionPipeColor; @@ -52,7 +51,7 @@ public int getIconIndex(EnumFacing direction) { } @Override - public boolean blockActivated(EntityPlayer player) { + public boolean blockActivated(EntityPlayer player, EnumFacing direction) { Item equipped = player.getCurrentEquippedItem() != null ? player.getCurrentEquippedItem().getItem() : null; if (equipped instanceof IToolWrench && ((IToolWrench) equipped).canWrench(player, container.getPos())) { if (player.isSneaking()) { @@ -90,16 +89,7 @@ public void eventHandler(PipeEventItem.ReachedCenter event) { } public void eventHandler(PipeEventItem.AdjustSpeed event) { - event.handled = true; - TravelingItem item = event.item; - - if (item.getSpeed() > TransportConstants.PIPE_NORMAL_SPEED) { - item.setSpeed(item.getSpeed() - TransportConstants.PIPE_NORMAL_SPEED / 4.0F); - } - - if (item.getSpeed() < TransportConstants.PIPE_NORMAL_SPEED) { - item.setSpeed(TransportConstants.PIPE_NORMAL_SPEED); - } + event.slowdownAmount /= 4; } @Override diff --git a/common/buildcraft/transport/pipes/PipeItemsObsidian.java b/common/buildcraft/transport/pipes/PipeItemsObsidian.java index 35dca8e4c5..763368a4e5 100644 --- a/common/buildcraft/transport/pipes/PipeItemsObsidian.java +++ b/common/buildcraft/transport/pipes/PipeItemsObsidian.java @@ -1,27 +1,30 @@ /** 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.pipes; -import java.util.Arrays; import java.util.List; +import java.util.WeakHashMap; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.item.EntityMinecartChest; +import net.minecraft.entity.item.EntityMinecart; import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.init.Items; +import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.EnumFacing; import net.minecraft.util.Vec3; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import cofh.api.energy.IEnergyHandler; +import buildcraft.BuildCraftTransport; import buildcraft.api.core.IIconProvider; import buildcraft.core.lib.RFBattery; import buildcraft.core.lib.inventory.ITransactor; @@ -29,7 +32,6 @@ import buildcraft.core.lib.inventory.filters.StackFilter; import buildcraft.core.lib.utils.Utils; import buildcraft.core.proxy.CoreProxy; -import buildcraft.BuildCraftTransport; import buildcraft.transport.Pipe; import buildcraft.transport.PipeIconProvider; import buildcraft.transport.PipeTransportItems; @@ -38,17 +40,12 @@ import buildcraft.transport.pipes.events.PipeEventItem; import buildcraft.transport.utils.TransportUtils; -public class PipeItemsObsidian extends Pipeimplements IEnergyHandler { - private RFBattery battery = new RFBattery(2560, 640, 0); - - private int[] entitiesDropped; - private int entitiesDroppedIndex = 0; +public class PipeItemsObsidian extends Pipe implements IEnergyHandler { + private final RFBattery battery = new RFBattery(2560, 640, 0); + private final WeakHashMap entityDropTime = new WeakHashMap(); public PipeItemsObsidian(Item item) { super(new PipeTransportItems(), item); - - entitiesDropped = new int[32]; - Arrays.fill(entitiesDropped, -1); } @Override @@ -165,20 +162,20 @@ private boolean suckItem(int distance) { return true; } - if (distance == 1 && entity instanceof EntityMinecartChest) { - EntityMinecartChest cart = (EntityMinecartChest) entity; + if (distance == 1 && entity instanceof EntityMinecart && entity instanceof IInventory) { + EntityMinecart cart = (EntityMinecart) entity; if (!cart.isDead) { ITransactor trans = Transactor.getTransactorFor(cart); EnumFacing openOrientation = getOpenOrientation(); ItemStack stack = trans.remove(StackFilter.ALL, openOrientation, false); if (stack != null && battery.useEnergy(10, 10, false) > 0) { - trans.remove(StackFilter.ALL, openOrientation, true); - EntityItem entityitem = new EntityItem(container.getWorld(), cart.posX, cart.posY + 0.3F, cart.posZ, stack); - entityitem.setDefaultPickupDelay(); - container.getWorld().spawnEntityInWorld(entityitem); - pullItemIntoPipe(entityitem, 1); - + stack = trans.remove(StackFilter.ALL, openOrientation, true); + if (stack != null) { + Vec3 pos = Utils.convertMiddle(container.getPos()); + TravelingItem item = TravelingItem.make(pos, stack); + transport.injectItem(item, openOrientation.getOpposite()); + } return true; } } @@ -199,7 +196,7 @@ public void pullItemIntoPipe(Entity entity, int distance) { container.getWorld().playSoundAtEntity(entity, "random.pop", 0.2F, ((container.getWorld().rand.nextFloat() - container.getWorld().rand .nextFloat()) * 0.7F + 1.0F) * 2.0F); - ItemStack stack = null; + ItemStack stack; double speed = 0.01F; @@ -222,6 +219,8 @@ public void pullItemIntoPipe(Entity entity, int distance) { stack = contained.splitStack(energyUsed / distance / 10); } + battery.useEnergy(energyUsed, energyUsed, false); + speed = Math.sqrt(item.motionX * item.motionX + item.motionY * item.motionY + item.motionZ * item.motionZ); speed = speed / 2F - 0.05; @@ -249,12 +248,7 @@ public void pullItemIntoPipe(Entity entity, int distance) { } public void eventHandler(PipeEventItem.DropItem event) { - if (entitiesDroppedIndex + 1 >= entitiesDropped.length) { - entitiesDroppedIndex = 0; - } else { - entitiesDroppedIndex++; - } - entitiesDropped[entitiesDroppedIndex] = event.entity.getEntityId(); + entityDropTime.put(event.entity, event.entity.worldObj.getTotalWorldTime() + 200); } public boolean canSuck(Entity entity, int distance) { @@ -268,10 +262,9 @@ public boolean canSuck(Entity entity, int distance) { return false; } - for (int element : entitiesDropped) { - if (item.getEntityId() == element) { - return false; - } + long wt = entity.worldObj.getTotalWorldTime(); + if (entityDropTime.containsKey(entity) && entityDropTime.get(entity) >= wt) { + return false; } return battery.getEnergyStored() >= distance * 10; diff --git a/common/buildcraft/transport/pipes/PipeItemsQuartz.java b/common/buildcraft/transport/pipes/PipeItemsQuartz.java index 768be9e77e..4f131a7987 100644 --- a/common/buildcraft/transport/pipes/PipeItemsQuartz.java +++ b/common/buildcraft/transport/pipes/PipeItemsQuartz.java @@ -1,21 +1,24 @@ -/** 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 */ +/** + * 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.pipes; import net.minecraft.item.Item; import net.minecraft.util.EnumFacing; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import buildcraft.api.core.IIconProvider; import buildcraft.BuildCraftTransport; +import buildcraft.api.core.IIconProvider; import buildcraft.transport.Pipe; import buildcraft.transport.PipeIconProvider; import buildcraft.transport.PipeTransportItems; -import buildcraft.transport.TransportConstants; -import buildcraft.transport.TravelingItem; import buildcraft.transport.pipes.events.PipeEventItem; public class PipeItemsQuartz extends Pipe { @@ -37,15 +40,6 @@ public int getIconIndex(EnumFacing direction) { } public void eventHandler(PipeEventItem.AdjustSpeed event) { - event.handled = true; - TravelingItem item = event.item; - - if (item.getSpeed() > TransportConstants.PIPE_NORMAL_SPEED) { - item.setSpeed(item.getSpeed() - TransportConstants.PIPE_NORMAL_SPEED / 4.0F); - } - - if (item.getSpeed() < TransportConstants.PIPE_NORMAL_SPEED) { - item.setSpeed(TransportConstants.PIPE_NORMAL_SPEED); - } + event.slowdownAmount /= 4; } } diff --git a/common/buildcraft/transport/pipes/PipeItemsSandstone.java b/common/buildcraft/transport/pipes/PipeItemsSandstone.java index 04164b0af6..de9d3dd3fb 100644 --- a/common/buildcraft/transport/pipes/PipeItemsSandstone.java +++ b/common/buildcraft/transport/pipes/PipeItemsSandstone.java @@ -1,5 +1,5 @@ /** 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.pipes; @@ -7,18 +7,19 @@ import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import buildcraft.BuildCraftTransport; import buildcraft.api.core.IIconProvider; import buildcraft.api.transport.IPipeTile; -import buildcraft.BuildCraftTransport; import buildcraft.transport.IPipeConnectionForced; import buildcraft.transport.Pipe; import buildcraft.transport.PipeIconProvider; import buildcraft.transport.PipeTransportItems; -public class PipeItemsSandstone extends Pipeimplements IPipeConnectionForced { +public class PipeItemsSandstone extends Pipe implements IPipeConnectionForced { public PipeItemsSandstone(Item item) { super(new PipeTransportItems(), item); diff --git a/common/buildcraft/transport/pipes/PipeItemsStone.java b/common/buildcraft/transport/pipes/PipeItemsStone.java index 778a54e7da..a5db840115 100644 --- a/common/buildcraft/transport/pipes/PipeItemsStone.java +++ b/common/buildcraft/transport/pipes/PipeItemsStone.java @@ -1,21 +1,24 @@ -/** 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 */ +/** + * 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.pipes; import net.minecraft.item.Item; import net.minecraft.util.EnumFacing; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import buildcraft.api.core.IIconProvider; import buildcraft.BuildCraftTransport; +import buildcraft.api.core.IIconProvider; import buildcraft.transport.Pipe; import buildcraft.transport.PipeIconProvider; import buildcraft.transport.PipeTransportItems; -import buildcraft.transport.TransportConstants; -import buildcraft.transport.TravelingItem; import buildcraft.transport.pipes.events.PipeEventItem; public class PipeItemsStone extends Pipe { @@ -36,15 +39,6 @@ public int getIconIndex(EnumFacing direction) { } public void eventHandler(PipeEventItem.AdjustSpeed event) { - event.handled = true; - TravelingItem item = event.item; - - if (item.getSpeed() > TransportConstants.PIPE_NORMAL_SPEED) { - item.setSpeed(item.getSpeed() - TransportConstants.PIPE_NORMAL_SPEED / 2.0F); - } - - if (item.getSpeed() < TransportConstants.PIPE_NORMAL_SPEED) { - item.setSpeed(TransportConstants.PIPE_NORMAL_SPEED); - } + event.slowdownAmount /= 2; } } diff --git a/common/buildcraft/transport/pipes/PipeItemsStripes.java b/common/buildcraft/transport/pipes/PipeItemsStripes.java index 8759cf5426..ab9f0c3b6f 100644 --- a/common/buildcraft/transport/pipes/PipeItemsStripes.java +++ b/common/buildcraft/transport/pipes/PipeItemsStripes.java @@ -1,5 +1,5 @@ /** 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.pipes; @@ -8,6 +8,8 @@ import java.util.LinkedList; import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.block.BlockLiquid; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; @@ -18,31 +20,36 @@ import net.minecraft.util.Vec3; import net.minecraft.world.WorldServer; +import net.minecraftforge.fluids.IFluidBlock; + import cofh.api.energy.IEnergyHandler; +import buildcraft.BuildCraftTransport; +import buildcraft.api.core.EnumPipePart; import buildcraft.api.core.IIconProvider; import buildcraft.api.statements.IActionInternal; import buildcraft.api.statements.StatementSlot; +import buildcraft.api.transport.IPipeTile; import buildcraft.api.transport.IStripesHandler; import buildcraft.api.transport.IStripesHandler.StripesHandlerType; import buildcraft.api.transport.IStripesPipe; import buildcraft.api.transport.PipeManager; +import buildcraft.core.lib.RFBattery; import buildcraft.core.lib.inventory.InvUtils; import buildcraft.core.lib.utils.BlockUtils; import buildcraft.core.lib.utils.Utils; import buildcraft.core.proxy.CoreProxy; -import buildcraft.BuildCraftTransport; import buildcraft.transport.Pipe; import buildcraft.transport.PipeIconProvider; import buildcraft.transport.PipeTransportItems; -import buildcraft.transport.TileGenericPipe; import buildcraft.transport.TravelingItem; import buildcraft.transport.pipes.events.PipeEventItem; import buildcraft.transport.statements.ActionPipeDirection; import buildcraft.transport.utils.TransportUtils; -public class PipeItemsStripes extends Pipeimplements IEnergyHandler, IStripesPipe { - private EnumFacing actionDir = null; +public class PipeItemsStripes extends Pipe implements IEnergyHandler, IStripesPipe { + private RFBattery battery = new RFBattery(320 * 50, 640, 0); + private EnumPipePart actionDir = EnumPipePart.CENTER; public PipeItemsStripes(Item item) { super(new PipeTransportItems(), item); @@ -55,6 +62,52 @@ public void updateEntity() { if (container.getWorld().isRemote) { return; } + + if (battery.getEnergyStored() >= 10) { + EnumPipePart o = actionDir; + if (o == EnumPipePart.CENTER) { + o = EnumPipePart.fromFacing(getOpenOrientation()); + } + + if (o != EnumPipePart.CENTER) { + Vec3 vec = Utils.convert(container.getPos()).add(Utils.convert(o.face)); + BlockPos veci = Utils.convertFloor(vec); + + if (!BlockUtils.isUnbreakableBlock(getWorld(), Utils.convertFloor(vec))) { + IBlockState state = getWorld().getBlockState(Utils.convertFloor(vec)); + Block block = state.getBlock(); + + if (block instanceof BlockLiquid || block instanceof IFluidBlock) { + return; + } + + ItemStack stack = new ItemStack(block, 1, block.getMetaFromState(state)); + EntityPlayer player = CoreProxy.proxy.getBuildCraftPlayer((WorldServer) getWorld(), veci).get(); + + for (IStripesHandler handler : PipeManager.stripesHandlers) { + if (handler.getType() == StripesHandlerType.BLOCK_BREAK && handler.shouldHandle(stack)) { + if (handler.handle(getWorld(), veci, o.face, stack, player, this)) { + return; + } + } + } + + List stacks = block.getDrops(getWorld(), veci, state, 0); + + if (stacks != null) { + for (ItemStack s : stacks) { + if (s != null) { + sendItem(s, o.opposite().face); + } + } + } + + getWorld().setBlockToAir(veci); + } + } + + return; + } } public void eventHandler(PipeEventItem.DropItem event) { @@ -62,7 +115,7 @@ public void eventHandler(PipeEventItem.DropItem event) { return; } - EnumFacing direction = actionDir; + EnumFacing direction = actionDir.face; if (direction == null) { direction = event.direction; } @@ -135,18 +188,19 @@ protected void actionsActivated(Collection actions) { for (StatementSlot action : actions) { if (action.statement instanceof ActionPipeDirection) { - actionDir = ((ActionPipeDirection) action.statement).direction; + actionDir = EnumPipePart.fromFacing(((ActionPipeDirection) action.statement).direction); break; } } } @Override - public void sendItem(ItemStack itemStack, EnumFacing direction) { - Vec3 pos = new Vec3(container.x() + 0.5, container.y() + TransportUtils.getPipeFloorOf(itemStack), container.z() + 0.5); + public void sendItem(ItemStack stack, EnumFacing direction) { + Vec3 pos = Utils.convertMiddle(container.getPos()).addVector(0, TransportUtils.getPipeFloorOf(stack) - 0.5, 0); pos = pos.add(Utils.convert(direction, 0.25)); - TravelingItem newItem = TravelingItem.make(pos, itemStack); + TravelingItem newItem = TravelingItem.make(pos, stack); + transport.injectItem(newItem, direction); } @@ -161,11 +215,12 @@ public int getIconIndex(EnumFacing direction) { } @Override + public boolean canPipeConnect(TileEntity tile, EnumFacing side) { - if (tile instanceof TileGenericPipe) { - TileGenericPipe tilePipe = (TileGenericPipe) tile; + if (tile instanceof IPipeTile) { + IPipeTile tilePipe = (IPipeTile) tile; - if (tilePipe.pipe instanceof PipeItemsStripes) { + if (tilePipe.getPipe() instanceof PipeItemsStripes) { return false; } } @@ -180,52 +235,7 @@ public boolean canConnectEnergy(EnumFacing from) { @Override public int receiveEnergy(EnumFacing from, int maxReceive, boolean simulate) { - if (maxReceive == 0) { - return 0; - } else if (simulate) { - return maxReceive; - } - - EnumFacing o = actionDir; - if (o == null) { - o = getOpenOrientation(); - } - - if (o != null) { - Vec3 p = Utils.convert(container.getPos()); - p = p.add(Utils.convert(o)); - BlockPos pos = Utils.convertFloor(p); - - if (!BlockUtils.isUnbreakableBlock(getWorld(), pos)) { - IBlockState state = getWorld().getBlockState(pos); - - ItemStack stack = new ItemStack(state.getBlock(), 1, state.getBlock().getMetaFromState(state)); - - EntityPlayer player = CoreProxy.proxy.getBuildCraftPlayer((WorldServer) getWorld(), pos).get(); - - for (IStripesHandler handler : PipeManager.stripesHandlers) { - if (handler.getType() == StripesHandlerType.BLOCK_BREAK && handler.shouldHandle(stack)) { - if (handler.handle(getWorld(), pos, o, stack, player, this)) { - return maxReceive; - } - } - } - - List stacks = state.getBlock().getDrops(getWorld(), pos, state, 0); - - if (stacks != null) { - for (ItemStack s : stacks) { - if (s != null) { - sendItem(s, o.getOpposite()); - } - } - } - - getWorld().setBlockToAir(pos); - } - } - - return maxReceive; + return battery.receiveEnergy(maxReceive, simulate); } @Override diff --git a/common/buildcraft/transport/pipes/PipeItemsVoid.java b/common/buildcraft/transport/pipes/PipeItemsVoid.java index 39b34d16d7..96c701443f 100644 --- a/common/buildcraft/transport/pipes/PipeItemsVoid.java +++ b/common/buildcraft/transport/pipes/PipeItemsVoid.java @@ -1,16 +1,21 @@ -/** 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 */ +/** + * 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.pipes; import net.minecraft.item.Item; import net.minecraft.util.EnumFacing; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import buildcraft.api.core.IIconProvider; import buildcraft.BuildCraftTransport; +import buildcraft.api.core.IIconProvider; import buildcraft.transport.Pipe; import buildcraft.transport.PipeIconProvider; import buildcraft.transport.PipeTransportItems; diff --git a/common/buildcraft/transport/pipes/PipeItemsWood.java b/common/buildcraft/transport/pipes/PipeItemsWood.java index db222e0448..0c4ee56ceb 100644 --- a/common/buildcraft/transport/pipes/PipeItemsWood.java +++ b/common/buildcraft/transport/pipes/PipeItemsWood.java @@ -1,5 +1,5 @@ /** 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.pipes; @@ -12,24 +12,27 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.Vec3; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import cofh.api.energy.IEnergyHandler; +import buildcraft.BuildCraftTransport; +import buildcraft.api.core.EnumPipePart; import buildcraft.api.core.IIconProvider; import buildcraft.api.transport.IPipeTile; import buildcraft.core.lib.RFBattery; import buildcraft.core.lib.inventory.InvUtils; import buildcraft.core.lib.inventory.InventoryWrapper; import buildcraft.core.lib.utils.Utils; -import buildcraft.BuildCraftTransport; import buildcraft.transport.Pipe; import buildcraft.transport.PipeIconProvider; import buildcraft.transport.PipeTransportItems; +import buildcraft.transport.TransportConstants; import buildcraft.transport.TravelingItem; -public class PipeItemsWood extends Pipeimplements IEnergyHandler { +public class PipeItemsWood extends Pipe implements IEnergyHandler { protected RFBattery battery = new RFBattery(2560, 80, 0); protected int standardIconIndex = PipeIconProvider.TYPE.PipeItemsWood_Standard.ordinal(); @@ -56,13 +59,13 @@ public PipeItemsWood(Item item) { } @Override - public boolean blockActivated(EntityPlayer entityplayer) { - return logic.blockActivated(entityplayer); + public boolean blockActivated(EntityPlayer entityplayer, EnumFacing side) { + return logic.blockActivated(entityplayer, EnumPipePart.fromFacing(side)); } @Override public void onNeighborBlockChange(int blockId) { - logic.onNeighborBlockChange(blockId); + logic.onNeighborBlockChange(); super.onNeighborBlockChange(blockId); } @@ -111,13 +114,19 @@ public void updateEntity() { battery.setEnergy(0); ticksSincePull = 0; speedMultiplier = 1.0F; + + onPostTick(); } } + public void onPostTick() { + + } + private boolean shouldTick() { if (ticksSincePull < 8) { return false; - } else { + } else if (ticksSincePull < 16) { // Check if we have just enough energy for the next stack. int meta = container.getBlockMetadata(); @@ -176,8 +185,8 @@ private void extractItems() { Vec3 entPos = Utils.convertMiddle(tile.getPos()).add(Utils.convert(side, -0.6)); TravelingItem entity = makeItem(entPos, stack); - entity.setSpeed(entity.getSpeed() * speedMultiplier); - transport.injectItem(entity, side.getOpposite()); + entity.setSpeed(TransportConstants.PIPE_DEFAULT_SPEED); + transport.injectItem(entity, side); } } } diff --git a/common/buildcraft/transport/pipes/PipeLogicIron.java b/common/buildcraft/transport/pipes/PipeLogicIron.java index debebba5b1..7b233b2669 100644 --- a/common/buildcraft/transport/pipes/PipeLogicIron.java +++ b/common/buildcraft/transport/pipes/PipeLogicIron.java @@ -1,5 +1,5 @@ /** 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.pipes; @@ -11,6 +11,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; +import buildcraft.api.core.EnumPipePart; import buildcraft.api.properties.BuildCraftProperties; import buildcraft.api.tools.IToolWrench; import buildcraft.core.lib.TileBuffer; @@ -95,10 +96,19 @@ public boolean setFacing(EnumFacing facing) { return false; } + @Deprecated public boolean blockActivated(EntityPlayer entityplayer) { + return blockActivated(entityplayer, EnumPipePart.CENTER); + } + + public boolean blockActivated(EntityPlayer entityplayer, EnumPipePart side) { Item equipped = entityplayer.getCurrentEquippedItem() != null ? entityplayer.getCurrentEquippedItem().getItem() : null; if (equipped instanceof IToolWrench && ((IToolWrench) equipped).canWrench(entityplayer, pipe.container.getPos())) { - switchPosition(); + if (side == EnumPipePart.CENTER) { + switchPosition(); + } else { + setFacing(side.face); + } pipe.container.scheduleRenderUpdate(); ((IToolWrench) equipped).wrenchUsed(entityplayer, pipe.container.getPos()); diff --git a/common/buildcraft/transport/pipes/PipeLogicWood.java b/common/buildcraft/transport/pipes/PipeLogicWood.java index 696d8af33f..58578b9d97 100644 --- a/common/buildcraft/transport/pipes/PipeLogicWood.java +++ b/common/buildcraft/transport/pipes/PipeLogicWood.java @@ -1,5 +1,5 @@ /** 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.pipes; @@ -10,11 +10,10 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; -import buildcraft.BuildCraftTransport; -import buildcraft.api.core.BCLog; -import buildcraft.api.properties.BuildCraftProperties; +import buildcraft.api.core.EnumPipePart; import buildcraft.api.tools.IToolWrench; import buildcraft.core.lib.TileBuffer; +import buildcraft.transport.BlockGenericPipe; import buildcraft.transport.Pipe; public abstract class PipeLogicWood { @@ -27,27 +26,35 @@ public PipeLogicWood(Pipe pipe) { private void switchSource() { int meta = pipe.container.getBlockMetadata(); - EnumFacing newFacing = null; + EnumPipePart oldFacing = EnumPipePart.fromMeta(meta); + EnumPipePart newFacing = oldFacing.next(); - for (int i = meta + 1; i <= meta + 6; ++i) { - EnumFacing facing = EnumFacing.getFront(i % 6); - if (isValidFacing(facing)) { - newFacing = facing; + boolean first = true; + while (oldFacing != newFacing || first) { + first = false; + if (isValidFacing(newFacing.face)) { break; } + newFacing = oldFacing.next(); } - int ordinal = -1; - if (newFacing == null) { - ordinal = 6;// The old ForgeDirection.UNKNOWN ordinal - } else { - ordinal = newFacing.ordinal(); + if (newFacing == oldFacing) { + newFacing = EnumPipePart.CENTER; } - if (ordinal != meta) { - IBlockState state = pipe.container.getWorld().getBlockState(pipe.container.getPos()); - pipe.container.getWorld().setBlockState(pipe.container.getPos(), state.withProperty(BuildCraftProperties.GENERIC_PIPE_DATA, ordinal)); - pipe.container.scheduleRenderUpdate(); + setSource(newFacing); + } + + private void setSource(EnumPipePart newFacing) { + if (newFacing == EnumPipePart.CENTER || isValidFacing(newFacing.face)) { + int meta = pipe.container.getBlockMetadata(); + + if (newFacing.ordinal() != meta) { + IBlockState state = pipe.container.getWorld().getBlockState(pipe.container.getPos()); + state = state.withProperty(BlockGenericPipe.GENERIC_PIPE_DATA, newFacing.ordinal()); + pipe.container.getWorld().setBlockState(pipe.container.getPos(), state); + pipe.container.scheduleRenderUpdate(); + } } } @@ -90,10 +97,19 @@ public void initialize() { } } + @Deprecated public boolean blockActivated(EntityPlayer entityplayer) { + return blockActivated(entityplayer, EnumPipePart.CENTER); + } + + public boolean blockActivated(EntityPlayer entityplayer, EnumPipePart side) { Item equipped = entityplayer.getCurrentEquippedItem() != null ? entityplayer.getCurrentEquippedItem().getItem() : null; if (equipped instanceof IToolWrench && ((IToolWrench) equipped).canWrench(entityplayer, pipe.container.getPos())) { - switchSource(); + if (side != EnumPipePart.CENTER) { + setSource(side); + } else { + switchSource(); + } ((IToolWrench) equipped).wrenchUsed(entityplayer, pipe.container.getPos()); return true; } @@ -101,7 +117,7 @@ public boolean blockActivated(EntityPlayer entityplayer) { return false; } - public void onNeighborBlockChange(int blockId) { + public void onNeighborBlockChange() { if (!pipe.container.getWorld().isRemote) { switchSourceIfNeeded(); } diff --git a/common/buildcraft/transport/pipes/PipePowerCobblestone.java b/common/buildcraft/transport/pipes/PipePowerCobblestone.java index a4557ad302..db384b6f99 100644 --- a/common/buildcraft/transport/pipes/PipePowerCobblestone.java +++ b/common/buildcraft/transport/pipes/PipePowerCobblestone.java @@ -1,16 +1,21 @@ -/** 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 */ +/** + * 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.pipes; import net.minecraft.item.Item; import net.minecraft.util.EnumFacing; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import buildcraft.api.core.IIconProvider; import buildcraft.BuildCraftTransport; +import buildcraft.api.core.IIconProvider; import buildcraft.transport.Pipe; import buildcraft.transport.PipeIconProvider; import buildcraft.transport.PipeTransportPower; diff --git a/common/buildcraft/transport/pipes/PipePowerDiamond.java b/common/buildcraft/transport/pipes/PipePowerDiamond.java index 02e0494287..c3e1ea46d3 100644 --- a/common/buildcraft/transport/pipes/PipePowerDiamond.java +++ b/common/buildcraft/transport/pipes/PipePowerDiamond.java @@ -1,16 +1,21 @@ -/** 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 */ +/** + * 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.pipes; import net.minecraft.item.Item; import net.minecraft.util.EnumFacing; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import buildcraft.api.core.IIconProvider; import buildcraft.BuildCraftTransport; +import buildcraft.api.core.IIconProvider; import buildcraft.transport.Pipe; import buildcraft.transport.PipeIconProvider; import buildcraft.transport.PipeTransportPower; diff --git a/common/buildcraft/transport/pipes/PipePowerEmerald.java b/common/buildcraft/transport/pipes/PipePowerEmerald.java index 1806224f34..c929734096 100644 --- a/common/buildcraft/transport/pipes/PipePowerEmerald.java +++ b/common/buildcraft/transport/pipes/PipePowerEmerald.java @@ -1,40 +1,16 @@ package buildcraft.transport.pipes; import net.minecraft.item.Item; -import net.minecraft.util.EnumFacing; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; -import buildcraft.BuildCraftTransport; -import buildcraft.api.core.IIconProvider; -import buildcraft.core.lib.RFBattery; import buildcraft.transport.PipeIconProvider; public class PipePowerEmerald extends PipePowerWood { - - protected int standardIconIndex = PipeIconProvider.TYPE.PipePowerEmerald_Standard.ordinal(); - protected int solidIconIndex = PipeIconProvider.TYPE.PipePowerEmerald_Solid.ordinal(); - public PipePowerEmerald(Item item) { super(item); - battery = new RFBattery(2560 * 50, 2560, 0); + standardIconIndex = PipeIconProvider.TYPE.PipePowerEmerald_Standard.ordinal(); + solidIconIndex = PipeIconProvider.TYPE.PipePowerEmerald_Solid.ordinal(); transport.initFromPipe(this.getClass()); } - - @Override - @SideOnly(Side.CLIENT) - public IIconProvider getIconProvider() { - return BuildCraftTransport.instance.pipeIconProvider; - } - - @Override - public int getIconIndex(EnumFacing direction) { - if (direction != null && powerSources[direction.ordinal()]) { - return solidIconIndex; - } else { - return standardIconIndex; - } - } } diff --git a/common/buildcraft/transport/pipes/PipePowerGold.java b/common/buildcraft/transport/pipes/PipePowerGold.java index f3919ad7c4..3047238b18 100644 --- a/common/buildcraft/transport/pipes/PipePowerGold.java +++ b/common/buildcraft/transport/pipes/PipePowerGold.java @@ -1,16 +1,17 @@ /** 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.pipes; import net.minecraft.item.Item; import net.minecraft.util.EnumFacing; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import buildcraft.api.core.IIconProvider; import buildcraft.BuildCraftTransport; +import buildcraft.api.core.IIconProvider; import buildcraft.transport.Pipe; import buildcraft.transport.PipeIconProvider; import buildcraft.transport.PipeTransportPower; diff --git a/common/buildcraft/transport/pipes/PipePowerIron.java b/common/buildcraft/transport/pipes/PipePowerIron.java index 658317903b..2724075fdd 100644 --- a/common/buildcraft/transport/pipes/PipePowerIron.java +++ b/common/buildcraft/transport/pipes/PipePowerIron.java @@ -1,5 +1,5 @@ /** 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.pipes; @@ -10,21 +10,22 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; -import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.EnumFacing; + import net.minecraftforge.common.util.FakePlayer; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import buildcraft.BuildCraftCore; +import buildcraft.BuildCraftTransport; import buildcraft.api.core.IIconProvider; import buildcraft.api.properties.BuildCraftProperties; import buildcraft.api.statements.IActionInternal; import buildcraft.api.statements.StatementSlot; import buildcraft.api.tools.IToolWrench; -import buildcraft.BuildCraftCore; import buildcraft.core.PowerMode; import buildcraft.core.lib.utils.StringUtils; -import buildcraft.BuildCraftTransport; import buildcraft.transport.Pipe; import buildcraft.transport.PipeIconProvider; import buildcraft.transport.PipeTransportPower; @@ -46,7 +47,7 @@ public int getIconIndex(EnumFacing direction) { } @Override - public boolean blockActivated(EntityPlayer player) { + public boolean blockActivated(EntityPlayer player, EnumFacing direction) { Item equipped = player.getCurrentEquippedItem() != null ? player.getCurrentEquippedItem().getItem() : null; if (equipped instanceof IToolWrench && ((IToolWrench) equipped).canWrench(player, container.getPos())) { if (player.isSneaking()) { @@ -56,11 +57,10 @@ public boolean blockActivated(EntityPlayer player) { } if (getWorld().isRemote && !(player instanceof FakePlayer)) { if (BuildCraftCore.hidePowerNumbers) { - player.addChatMessage(new ChatComponentText(String.format(StringUtils.localize("chat.pipe.power.iron.mode.numberless"), - StringUtils.localize("chat.pipe.power.iron.level." + getMode().maxPower)))); + player.addChatMessage(new ChatComponentTranslation("chat.pipe.power.iron.mode.numberless", StringUtils.localize( + "chat.pipe.power.iron.level." + getMode().maxPower))); } else { - player.addChatMessage(new ChatComponentText(String.format(StringUtils.localize("chat.pipe.power.iron.mode"), - getMode().maxPower))); + player.addChatMessage(new ChatComponentTranslation("chat.pipe.power.iron.mode", getMode().maxPower)); } } diff --git a/common/buildcraft/transport/pipes/PipePowerQuartz.java b/common/buildcraft/transport/pipes/PipePowerQuartz.java index b8590d1005..9eccc0425b 100644 --- a/common/buildcraft/transport/pipes/PipePowerQuartz.java +++ b/common/buildcraft/transport/pipes/PipePowerQuartz.java @@ -1,16 +1,21 @@ -/** 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 */ +/** + * 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.pipes; import net.minecraft.item.Item; import net.minecraft.util.EnumFacing; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import buildcraft.api.core.IIconProvider; import buildcraft.BuildCraftTransport; +import buildcraft.api.core.IIconProvider; import buildcraft.transport.Pipe; import buildcraft.transport.PipeIconProvider; import buildcraft.transport.PipeTransportPower; diff --git a/common/buildcraft/transport/pipes/PipePowerSandstone.java b/common/buildcraft/transport/pipes/PipePowerSandstone.java index ff58fab119..9d0a50c601 100644 --- a/common/buildcraft/transport/pipes/PipePowerSandstone.java +++ b/common/buildcraft/transport/pipes/PipePowerSandstone.java @@ -1,5 +1,5 @@ /** 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.pipes; @@ -7,18 +7,19 @@ import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import buildcraft.BuildCraftTransport; import buildcraft.api.core.IIconProvider; import buildcraft.api.transport.IPipeTile; -import buildcraft.BuildCraftTransport; import buildcraft.transport.IPipeConnectionForced; import buildcraft.transport.Pipe; import buildcraft.transport.PipeIconProvider; import buildcraft.transport.PipeTransportPower; -public class PipePowerSandstone extends Pipeimplements IPipeConnectionForced { +public class PipePowerSandstone extends Pipe implements IPipeConnectionForced { public PipePowerSandstone(Item item) { super(new PipeTransportPower(), item); diff --git a/common/buildcraft/transport/pipes/PipePowerStone.java b/common/buildcraft/transport/pipes/PipePowerStone.java index c6cec0f75a..a6e47b6bb7 100644 --- a/common/buildcraft/transport/pipes/PipePowerStone.java +++ b/common/buildcraft/transport/pipes/PipePowerStone.java @@ -1,16 +1,21 @@ -/** 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 */ +/** + * 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.pipes; import net.minecraft.item.Item; import net.minecraft.util.EnumFacing; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import buildcraft.api.core.IIconProvider; import buildcraft.BuildCraftTransport; +import buildcraft.api.core.IIconProvider; import buildcraft.transport.Pipe; import buildcraft.transport.PipeIconProvider; import buildcraft.transport.PipeTransportPower; diff --git a/common/buildcraft/transport/pipes/PipePowerWood.java b/common/buildcraft/transport/pipes/PipePowerWood.java index 0757fe1cba..30b0c47b31 100644 --- a/common/buildcraft/transport/pipes/PipePowerWood.java +++ b/common/buildcraft/transport/pipes/PipePowerWood.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.pipes; import java.util.List; @@ -35,15 +39,13 @@ public class PipePowerWood extends Pipeimplements IPipeTrans protected int solidIconIndex = PipeIconProvider.TYPE.PipePowerWood_Solid.ordinal(); protected RFBattery battery; - private boolean full; - private int requestedEnergy, sources, lastRequestedEnergy; - + private int requestedEnergy, lastRequestedEnergy, sources; private boolean allowExtraction = false; public PipePowerWood(Item item) { super(new PipeTransportPower(), item); - battery = new RFBattery(320 * 50, 320, 0); + battery = new RFBattery(40960, 40960, 0); transport.initFromPipe(getClass()); } @@ -98,14 +100,10 @@ public void updateEntity() { return; } - if (sources == 0) { - return; - } - if (allowExtraction) { allowExtraction = false; - int energyMaxExtract = Math.min(battery.getMaxEnergyExtract(), battery.getMaxEnergyStored() - battery.getEnergyStored()); + int energyMaxExtract = Math.min(transport.maxPower, battery.getMaxEnergyStored() - battery.getEnergyStored()); energyMaxExtract /= sources; for (EnumFacing o : EnumFacing.VALUES) { @@ -195,7 +193,7 @@ public int receiveEnergy(EnumFacing from, int maxReceive, boolean simulate) { return maxReceive; } if (from.ordinal() < 6 && powerSources[from.ordinal()]) { - return battery.receiveEnergy(simulate ? Math.min(maxReceive, lastRequestedEnergy) : maxReceive, simulate); + return battery.receiveEnergy(simulate ? Math.min(maxReceive, lastRequestedEnergy) : Math.min(maxReceive, battery.getMaxEnergyStored() - battery.getEnergyStored()), simulate); } else { return 0; } diff --git a/common/buildcraft/transport/pipes/PipeStructureCobblestone.java b/common/buildcraft/transport/pipes/PipeStructureCobblestone.java index 80d4e500f6..5d7b56eba0 100644 --- a/common/buildcraft/transport/pipes/PipeStructureCobblestone.java +++ b/common/buildcraft/transport/pipes/PipeStructureCobblestone.java @@ -1,16 +1,21 @@ -/** 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 */ +/** + * 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.pipes; import net.minecraft.item.Item; import net.minecraft.util.EnumFacing; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import buildcraft.api.core.IIconProvider; import buildcraft.BuildCraftTransport; +import buildcraft.api.core.IIconProvider; import buildcraft.transport.Pipe; import buildcraft.transport.PipeIconProvider; import buildcraft.transport.PipeTransportStructure; diff --git a/common/buildcraft/transport/pipes/bc8/behaviour/BehaviourWood.java b/common/buildcraft/transport/pipes/bc8/behaviour/BehaviourWood.java index 41a34f78c7..02f874e291 100644 --- a/common/buildcraft/transport/pipes/bc8/behaviour/BehaviourWood.java +++ b/common/buildcraft/transport/pipes/bc8/behaviour/BehaviourWood.java @@ -13,13 +13,22 @@ import cofh.api.energy.IEnergyReceiver; -import buildcraft.api.transport.pipe_bc8.*; +import buildcraft.api.core.EnumPipePart; +import buildcraft.api.transport.pipe_bc8.BCPipeEventHandler; +import buildcraft.api.transport.pipe_bc8.IConnection_BC8; +import buildcraft.api.transport.pipe_bc8.IContentsFilter; import buildcraft.api.transport.pipe_bc8.IExtractionManager.IExtractable_BC8; import buildcraft.api.transport.pipe_bc8.IInsertionManager.IInsertable_BC8; +import buildcraft.api.transport.pipe_bc8.IPipeContents; +import buildcraft.api.transport.pipe_bc8.IPipeContentsEditable; import buildcraft.api.transport.pipe_bc8.IPipeContentsEditable.IPipeContentsEditableFluid; import buildcraft.api.transport.pipe_bc8.IPipeContentsEditable.IPipeContentsEditableItem; import buildcraft.api.transport.pipe_bc8.IPipeContentsEditable.IPipeContentsEditablePower; import buildcraft.api.transport.pipe_bc8.IPipeHelper.EnumCombiningOp; +import buildcraft.api.transport.pipe_bc8.IPipe_BC8; +import buildcraft.api.transport.pipe_bc8.PipeAPI_BC8; +import buildcraft.api.transport.pipe_bc8.PipeBehaviour_BC8; +import buildcraft.api.transport.pipe_bc8.PipeDefinition_BC8; import buildcraft.api.transport.pipe_bc8.event_bc8.IPipeEventConnection_BC8; import buildcraft.api.transport.pipe_bc8.event_bc8.IPipeEventConnection_BC8.AttemptCreate; import buildcraft.api.transport.pipe_bc8.event_bc8.IPipeEventInteract_BC8; diff --git a/common/buildcraft/transport/pipes/events/PipeEvent.java b/common/buildcraft/transport/pipes/events/PipeEvent.java index 6aabcf394d..c2de82e170 100644 --- a/common/buildcraft/transport/pipes/events/PipeEvent.java +++ b/common/buildcraft/transport/pipes/events/PipeEvent.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.pipes.events; import buildcraft.transport.Pipe; diff --git a/common/buildcraft/transport/pipes/events/PipeEventFluid.java b/common/buildcraft/transport/pipes/events/PipeEventFluid.java index 446f71a66c..38ed0de101 100644 --- a/common/buildcraft/transport/pipes/events/PipeEventFluid.java +++ b/common/buildcraft/transport/pipes/events/PipeEventFluid.java @@ -10,7 +10,7 @@ public abstract class PipeEventFluid extends PipeEvent { public final FluidStack fluidStack; - public PipeEventFluid(Pipe pipe, FluidStack fluidStack) { + public PipeEventFluid(Pipe pipe, FluidStack fluidStack) { super(pipe); this.fluidStack = fluidStack; } @@ -18,7 +18,7 @@ public PipeEventFluid(Pipe pipe, FluidStack fluidStack) { public static class FindDest extends PipeEventFluid { public final Multiset destinations; - public FindDest(Pipe pipe, FluidStack fluidStack, Multiset destinations) { + public FindDest(Pipe pipe, FluidStack fluidStack, Multiset destinations) { super(pipe, fluidStack); this.destinations = destinations; } diff --git a/common/buildcraft/transport/pipes/events/PipeEventItem.java b/common/buildcraft/transport/pipes/events/PipeEventItem.java index 51d2b09bf8..037045789e 100644 --- a/common/buildcraft/transport/pipes/events/PipeEventItem.java +++ b/common/buildcraft/transport/pipes/events/PipeEventItem.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.pipes.events; import java.util.List; @@ -11,13 +15,14 @@ import net.minecraft.util.EnumFacing; import buildcraft.transport.Pipe; +import buildcraft.transport.TransportConstants; import buildcraft.transport.TravelingItem; public abstract class PipeEventItem extends PipeEvent { public final TravelingItem item; - public PipeEventItem(Pipe pipe, TravelingItem item) { + public PipeEventItem(Pipe pipe, TravelingItem item) { super(pipe); this.item = item; } @@ -25,13 +30,13 @@ public PipeEventItem(Pipe pipe, TravelingItem item) { public static class Entered extends PipeEventItem { public boolean cancelled = false; - public Entered(Pipe pipe, TravelingItem item) { + public Entered(Pipe pipe, TravelingItem item) { super(pipe, item); } } public static class ReachedCenter extends PipeEventItem { - public ReachedCenter(Pipe pipe, TravelingItem item) { + public ReachedCenter(Pipe pipe, TravelingItem item) { super(pipe, item); } } @@ -40,7 +45,7 @@ public static class ReachedEnd extends PipeEventItem { public final TileEntity dest; public boolean handled = false; - public ReachedEnd(Pipe pipe, TravelingItem item, TileEntity dest) { + public ReachedEnd(Pipe pipe, TravelingItem item, TileEntity dest) { super(pipe, item); this.dest = dest; } @@ -50,7 +55,7 @@ public static class DropItem extends PipeEventItem { public EntityItem entity; public EnumFacing direction; - public DropItem(Pipe pipe, TravelingItem item, EntityItem entity) { + public DropItem(Pipe pipe, TravelingItem item, EntityItem entity) { super(pipe, item); this.entity = entity; this.direction = item.output != null ? item.output : item.input; @@ -61,7 +66,7 @@ public static class FindDest extends PipeEventItem { public final List destinations; public boolean shuffle = true; - public FindDest(Pipe pipe, TravelingItem item, List destinations) { + public FindDest(Pipe pipe, TravelingItem item, List destinations) { super(pipe, item); this.destinations = destinations; } @@ -69,8 +74,9 @@ public FindDest(Pipe pipe, TravelingItem item, List destinations) { public static class AdjustSpeed extends PipeEventItem { public boolean handled = false; + public float slowdownAmount = TransportConstants.PIPE_SLOWDOWN_SPEED; - public AdjustSpeed(Pipe pipe, TravelingItem item) { + public AdjustSpeed(Pipe pipe, TravelingItem item) { super(pipe, item); } } diff --git a/common/buildcraft/transport/pipes/events/PipeEventPower.java b/common/buildcraft/transport/pipes/events/PipeEventPower.java index 67493b11d7..a2a0695f21 100644 --- a/common/buildcraft/transport/pipes/events/PipeEventPower.java +++ b/common/buildcraft/transport/pipes/events/PipeEventPower.java @@ -9,14 +9,14 @@ public abstract class PipeEventPower extends PipeEvent { /** The amount of power left after processing. */ public int power; - public PipeEventPower(Pipe pipe, EnumFacing from, int power) { + public PipeEventPower(Pipe pipe, EnumFacing from, int power) { super(pipe); this.from = from; this.power = power; } public static class Request extends PipeEventPower { - public Request(Pipe pipe, EnumFacing from, int power) { + public Request(Pipe pipe, EnumFacing from, int power) { super(pipe, from, power); } } @@ -24,7 +24,7 @@ public Request(Pipe pipe, EnumFacing from, int power) { public static class Receive extends PipeEventPower { public boolean override; - public Receive(Pipe pipe, EnumFacing from, int power) { + public Receive(Pipe pipe, EnumFacing from, int power) { super(pipe, from, power); this.override = false; } diff --git a/common/buildcraft/transport/pluggable/ItemLens.java b/common/buildcraft/transport/pluggable/ItemLens.java index 4606509f1a..7f3e6e28f1 100755 --- a/common/buildcraft/transport/pluggable/ItemLens.java +++ b/common/buildcraft/transport/pluggable/ItemLens.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.pluggable; import java.util.List; diff --git a/common/buildcraft/transport/pluggable/ItemPlug.java b/common/buildcraft/transport/pluggable/ItemPlug.java index b94c721c3c..8fe49dfcd5 100755 --- a/common/buildcraft/transport/pluggable/ItemPlug.java +++ b/common/buildcraft/transport/pluggable/ItemPlug.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.pluggable; import net.minecraft.entity.player.EntityPlayer; diff --git a/common/buildcraft/transport/pluggable/ItemPowerAdapter.java b/common/buildcraft/transport/pluggable/ItemPowerAdapter.java index 03e73407a4..6319985686 100755 --- a/common/buildcraft/transport/pluggable/ItemPowerAdapter.java +++ b/common/buildcraft/transport/pluggable/ItemPowerAdapter.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.pluggable; import net.minecraft.entity.player.EntityPlayer; @@ -13,13 +17,11 @@ import cofh.api.energy.IEnergyHandler; import buildcraft.api.transport.IPipe; -import buildcraft.api.transport.IPipeTile; import buildcraft.api.transport.pluggable.IPipePluggableItem; import buildcraft.api.transport.pluggable.PipePluggable; import buildcraft.core.lib.items.ItemBuildCraft; public class ItemPowerAdapter extends ItemBuildCraft implements IPipePluggableItem { - public ItemPowerAdapter() { super(); } @@ -34,18 +36,9 @@ public boolean doesSneakBypassUse(World world, BlockPos pos, EntityPlayer player return true; } - // @Override - // @SideOnly(Side.CLIENT) - // public void registerIcons(TextureAtlasSpriteRegister par1IconRegister) { - // this.itemIcon = par1IconRegister.registerIcon("buildcraft:pipePowerAdapter"); - // } - - @Override - public PipePluggable createPipePluggable(IPipe pipe, EnumFacing side, ItemStack stack) { - if (pipe.getTile().getPipeType() != IPipeTile.PipeType.POWER && pipe instanceof IEnergyHandler) { + @Override + public PipePluggable createPipePluggable(IPipe pipe, EnumFacing side, ItemStack stack) { return new PowerAdapterPluggable(); - } else { - return null; - } } + } diff --git a/common/buildcraft/transport/pluggable/PlugPluggable.java b/common/buildcraft/transport/pluggable/PlugPluggable.java index d677cc5d6b..4a86d1d021 100644 --- a/common/buildcraft/transport/pluggable/PlugPluggable.java +++ b/common/buildcraft/transport/pluggable/PlugPluggable.java @@ -98,7 +98,7 @@ public void readFromNBT(NBTTagCompound nbt) { @Override public ItemStack[] getDropItems(IPipeTile pipe) { - return new ItemStack[] { new ItemStack(BuildCraftTransport.plugItem) }; + return new ItemStack[]{new ItemStack(BuildCraftTransport.plugItem)}; } @Override diff --git a/common/buildcraft/transport/pluggable/PowerAdapterPluggable.java b/common/buildcraft/transport/pluggable/PowerAdapterPluggable.java index 4faf371e0e..3fe87dbec4 100644 --- a/common/buildcraft/transport/pluggable/PowerAdapterPluggable.java +++ b/common/buildcraft/transport/pluggable/PowerAdapterPluggable.java @@ -10,6 +10,7 @@ import cofh.api.energy.IEnergyHandler; +import buildcraft.BuildCraftTransport; import buildcraft.api.transport.IPipe; import buildcraft.api.transport.IPipeTile; import buildcraft.api.transport.pluggable.IPipePluggableState; @@ -17,11 +18,11 @@ import buildcraft.api.transport.pluggable.IPipeRenderState; import buildcraft.api.transport.pluggable.PipePluggable; import buildcraft.core.lib.utils.MatrixTranformations; -import buildcraft.BuildCraftTransport; import io.netty.buffer.ByteBuf; public class PowerAdapterPluggable extends PipePluggable implements IEnergyHandler { + private static final int MAX_POWER = 40; private IPipeTile container; public class PowerAdapterPluggableRenderer implements IPipePluggableStaticRenderer { @@ -116,7 +117,7 @@ public void readFromNBT(NBTTagCompound nbt) { @Override public ItemStack[] getDropItems(IPipeTile pipe) { - return new ItemStack[] { new ItemStack(BuildCraftTransport.plugItem) }; + return new ItemStack[] { new ItemStack(BuildCraftTransport.powerAdapterItem) }; } @Override @@ -158,11 +159,11 @@ public void readData(ByteBuf data) { @Override public int receiveEnergy(EnumFacing from, int maxReceive, boolean simulate) { - int maxR = Math.min(40, maxReceive); - if (container instanceof IEnergyHandler) { - int energyCanReceive = ((IEnergyHandler) container).receiveEnergy(from, maxR, true); + int maxR = Math.min(MAX_POWER, maxReceive); + if (container != null && container.getPipe() instanceof IEnergyHandler) { + int energyCanReceive = ((IEnergyHandler) container.getPipe()).receiveEnergy(from, maxR, true); if (!simulate) { - return ((IEnergyHandler) container).receiveEnergy(from, energyCanReceive, false); + return ((IEnergyHandler) container.getPipe()).receiveEnergy(from, energyCanReceive, false); } else { return energyCanReceive; } @@ -177,8 +178,8 @@ public int extractEnergy(EnumFacing from, int maxExtract, boolean simulate) { @Override public int getEnergyStored(EnumFacing from) { - if (container instanceof IEnergyHandler) { - return ((IEnergyHandler) container).getEnergyStored(from); + if (container.getPipe() instanceof IEnergyHandler) { + return ((IEnergyHandler) container.getPipe()).getEnergyStored(from); } else { return 0; } @@ -186,8 +187,8 @@ public int getEnergyStored(EnumFacing from) { @Override public int getMaxEnergyStored(EnumFacing from) { - if (container instanceof IEnergyHandler) { - return ((IEnergyHandler) container).getMaxEnergyStored(from); + if (container.getPipe() instanceof IEnergyHandler) { + return ((IEnergyHandler) container.getPipe()).getMaxEnergyStored(from); } else { return 0; } @@ -197,4 +198,9 @@ public int getMaxEnergyStored(EnumFacing from) { public boolean canConnectEnergy(EnumFacing from) { return true; } + + @Override + public boolean requiresRenderUpdate(PipePluggable o) { + return false; + } } diff --git a/common/buildcraft/transport/recipes/AdvancedFacadeRecipe.java b/common/buildcraft/transport/recipes/AdvancedFacadeRecipe.java index 8a1282b6d3..624f812d56 100644 --- a/common/buildcraft/transport/recipes/AdvancedFacadeRecipe.java +++ b/common/buildcraft/transport/recipes/AdvancedFacadeRecipe.java @@ -1,5 +1,5 @@ /** 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.recipes; @@ -9,12 +9,12 @@ import net.minecraft.item.ItemStack; +import buildcraft.BuildCraftTransport; import buildcraft.api.core.JavaTools; import buildcraft.api.facades.FacadeType; import buildcraft.api.facades.IFacadeItem; import buildcraft.api.transport.PipeWire; import buildcraft.core.recipes.IntegrationRecipeBC; -import buildcraft.BuildCraftTransport; import buildcraft.transport.ItemFacade; import buildcraft.transport.ItemPipeWire; diff --git a/common/buildcraft/transport/recipes/GateExpansionRecipe.java b/common/buildcraft/transport/recipes/GateExpansionRecipe.java index 333dceba18..fec4be2372 100644 --- a/common/buildcraft/transport/recipes/GateExpansionRecipe.java +++ b/common/buildcraft/transport/recipes/GateExpansionRecipe.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.recipes; import java.util.ArrayList; diff --git a/common/buildcraft/transport/render/GateItemRenderer.java b/common/buildcraft/transport/render/GateItemRenderer.java deleted file mode 100644 index a3e1e9f004..0000000000 --- a/common/buildcraft/transport/render/GateItemRenderer.java +++ /dev/null @@ -1,164 +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.render; - -public class GateItemRenderer {// implements IItemRenderer { - // - // RenderItem renderItem = new RenderItem(); - // - // @Override - // public boolean handleRenderType(ItemStack stack, ItemRenderType type) { - // return type == ItemRenderType.INVENTORY || type == ItemRenderType.ENTITY || type == ItemRenderType.EQUIPPED - // || type == ItemRenderType.EQUIPPED_FIRST_PERSON; - // } - // - // @Override - // public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack stack, ItemRendererHelper helper) { - // return helper == ItemRendererHelper.ENTITY_BOBBING; - // } - // - // @Override - // public void renderItem(ItemRenderType type, ItemStack stack, Object... data) { - // if (type == ItemRenderType.INVENTORY) { - // render(ItemRenderType.INVENTORY, stack); - // } else if (type == ItemRenderType.ENTITY) { - // if (RenderManager.instance.options.fancyGraphics) { - // renderAsEntity(stack, (EntityItem) data[1]); - // } else { - // renderAsEntityFlat(stack); - // } - // } else if (type == ItemRenderType.EQUIPPED || type == ItemRenderType.EQUIPPED_FIRST_PERSON) { - // renderIn3D(stack); - // } - // } - // - // private void renderIn3D(ItemStack stack) { - // GL11.glPushMatrix(); - // - // renderLayerIn3D(ItemGate.getLogic(stack).getIconItem()); - // GL11.glScalef(1, 1, 1.05f); - // renderLayerIn3D(ItemGate.getMaterial(stack).getIconItem()); - // - // for (IGateExpansion expansion : ItemGate.getInstalledExpansions(stack)) { - // renderLayerIn3D(expansion.getOverlayItem()); - // } - // - // GL11.glPopMatrix(); - // } - // - // private void renderLayerIn3D(TextureAtlasSprite icon) { - // if (icon == null) { - // return; - // } - // GL11.glPushMatrix(); - // Tessellator tessellator = Tessellator.instance; - // - // float uv1 = icon.getMinU(); - // float uv2 = icon.getMaxU(); - // float uv3 = icon.getMinV(); - // float uv4 = icon.getMaxV(); - // - // ItemRenderer.renderItemIn2D(tessellator, uv2, uv3, uv1, uv4, icon.getIconWidth(), icon.getIconHeight(), 0.0625F); - // GL11.glPopMatrix(); - // } - // - // private void renderAsEntity(ItemStack stack, EntityItem entity) { - // GL11.glPushMatrix(); - // byte iterations = 1; - // if (stack.stackSize > 1) { - // iterations = 2; - // } - // if (stack.stackSize > 15) { - // iterations = 3; - // } - // if (stack.stackSize > 31) { - // iterations = 4; - // } - // - // Random rand = new Random(187L); - // - // float offsetZ = 0.0625F + 0.021875F; - // - // GL11.glRotatef(((entity.age + 1.0F) / 20.0F + entity.hoverStart) * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F); - // GL11.glTranslatef(-0.5F, -0.25F, -(offsetZ * iterations / 2.0F)); - // - // for (int count = 0; count < iterations; ++count) { - // if (count > 0) { - // float offsetX = (rand.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F; - // float offsetY = (rand.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F; - // float z = (rand.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F; - // GL11.glTranslatef(offsetX, offsetY, offsetZ); - // } else { - // GL11.glTranslatef(0f, 0f, offsetZ); - // } - // - // renderIn3D(stack); - // } - // GL11.glPopMatrix(); - // } - // - // private void renderAsEntityFlat(ItemStack stack) { - // GL11.glPushMatrix(); - // byte iterations = 1; - // if (stack.stackSize > 1) { - // iterations = 2; - // } - // if (stack.stackSize > 15) { - // iterations = 3; - // } - // if (stack.stackSize > 31) { - // iterations = 4; - // } - // - // Random rand = new Random(187L); - // - // for (int ii = 0; ii < iterations; ++ii) { - // GL11.glPushMatrix(); - // GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); - // GL11.glRotatef(180 - RenderManager.instance.playerViewY, 0.0F, 1.0F, 0.0F); - // - // if (ii > 0) { - // float var12 = (rand.nextFloat() * 2.0F - 1.0F) * 0.3F; - // float var13 = (rand.nextFloat() * 2.0F - 1.0F) * 0.3F; - // float var14 = (rand.nextFloat() * 2.0F - 1.0F) * 0.3F; - // GL11.glTranslatef(var12, var13, var14); - // } - // - // GL11.glTranslatef(0.5f, 0.8f, 0); - // GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); - // GL11.glScalef(1f / 16f, 1f / 16f, 1); - // - // render(ItemRenderType.ENTITY, stack); - // GL11.glPopMatrix(); - // } - // GL11.glPopMatrix(); - // } - // - // private void render(ItemRenderType type, ItemStack stack) { - // GL11.glPushMatrix(); - // GL11.glDisable(GL11.GL_LIGHTING); - // GL11.glEnable(GL11.GL_ALPHA_TEST); // In certain cases gets disabled by this point - // TextureAtlasSprite icon = ItemGate.getLogic(stack).getIconItem(); - // renderItem.renderIcon(0, 0, icon, 16, 16); - // - // if (type == ItemRenderType.ENTITY) { - // GL11.glTranslatef(0, 0, -0.01f); - // } - // - // icon = ItemGate.getMaterial(stack).getIconItem(); - // if (icon != null) { - // renderItem.renderIcon(0, 0, icon, 16, 16); - // } - // - // for (IGateExpansion expansion : ItemGate.getInstalledExpansions(stack)) { - // icon = expansion.getOverlayItem(); - // if (icon != null) { - // renderItem.renderIcon(0, 0, icon, 16, 16); - // } - // } - // GL11.glEnable(GL11.GL_LIGHTING); - // GL11.glPopMatrix(); - // } -} diff --git a/common/buildcraft/transport/render/PipeItemRenderer.java b/common/buildcraft/transport/render/PipeItemRenderer.java deleted file mode 100644 index 8f6e00efc7..0000000000 --- a/common/buildcraft/transport/render/PipeItemRenderer.java +++ /dev/null @@ -1,104 +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.render; - -public class PipeItemRenderer {// implements IItemRenderer { - // private static final float zFightOffset = 1 / 4096.0F; - // - // private void renderPipeItem(RenderBlocks render, ItemStack item, float translateX, float translateY, float - // translateZ) { - // GL11.glPushAttrib(GL11.GL_COLOR_BUFFER_BIT); // don't break other mods' guis when holding a pipe - // // force transparency - // GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - // GL11.glEnable(GL11.GL_BLEND); - // - // // GL11.glBindTexture(GL11.GL_TEXTURE_2D, 10); - // Tessellator tessellator = Tessellator.instance; - // - // Block block = FakeBlock.INSTANCE; - // TextureAtlasSprite icon = PipeIconProvider.TYPE.PipeStainedOverlay.getIcon(); - // - // if (item.getItemDamage() >= 1) { - // GL11.glPushMatrix(); - // - // int c = ColorUtils.getRGBColor(item.getItemDamage() - 1); - // GL11.glColor3ub((byte) (c >> 16), (byte) ((c >> 8) & 0xFF), (byte) (c & 0xFF)); - // block.setBlockBounds(CoreConstants.PIPE_MIN_POS + zFightOffset, 0.0F + zFightOffset, CoreConstants.PIPE_MIN_POS + - // zFightOffset, - // CoreConstants.PIPE_MAX_POS - zFightOffset, 1.0F - zFightOffset, CoreConstants.PIPE_MAX_POS - zFightOffset); - // block.setBlockBoundsForItemRender(); - // render.setRenderBoundsFromBlock(block); - // - // GL11.glTranslatef(translateX, translateY, translateZ); - // RenderUtils.drawBlockItem(render, tessellator, block, icon); - // block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); - // GL11.glColor3ub((byte) 255, (byte) 255, (byte) 255); - // GL11.glPopMatrix(); - // } - // - // block = BuildCraftTransport.genericPipeBlock; - // icon = item.getItem().getIconFromDamage(0); - // - // if (icon == null) { - // icon = ((TextureMap) - // Minecraft.getMinecraft().getTextureManager().getTexture(TextureMap.locationBlocksTexture)).getAtlasSprite( - // "missingno"); - // } - // - // block.setBlockBounds(CoreConstants.PIPE_MIN_POS, 0.0F, CoreConstants.PIPE_MIN_POS, CoreConstants.PIPE_MAX_POS, - // 1.0F, - // CoreConstants.PIPE_MAX_POS); - // block.setBlockBoundsForItemRender(); - // render.setRenderBoundsFromBlock(block); - // - // GL11.glTranslatef(translateX, translateY, translateZ); - // RenderUtils.drawBlockItem(render, tessellator, block, icon); - // GL11.glTranslatef(0.5F, 0.5F, 0.5F); - // block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); - // - // GL11.glPopAttrib(); // nicely leave the rendering how it was - // } - // - // /** IItemRenderer implementation * */ - // @Override - // public boolean handleRenderType(ItemStack item, ItemRenderType type) { - // switch (type) { - // case ENTITY: - // return true; - // case EQUIPPED: - // return true; - // case EQUIPPED_FIRST_PERSON: - // return true; - // case INVENTORY: - // return true; - // default: - // return false; - // } - // } - // - // @Override - // public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { - // return true; - // } - // - // @Override - // public void renderItem(ItemRenderType type, ItemStack item, Object... data) { - // switch (type) { - // case ENTITY: - // renderPipeItem((RenderBlocks) data[0], item, -0.5f, -0.5f, -0.5f); - // break; - // case EQUIPPED: - // renderPipeItem((RenderBlocks) data[0], item, -0.4f, 0.50f, 0.35f); - // break; - // case EQUIPPED_FIRST_PERSON: - // renderPipeItem((RenderBlocks) data[0], item, -0.4f, 0.50f, 0.35f); - // break; - // case INVENTORY: - // renderPipeItem((RenderBlocks) data[0], item, -0.5f, -0.5f, -0.5f); - // break; - // default: - // } - // } -} diff --git a/common/buildcraft/transport/render/PipeRendererWorld.java b/common/buildcraft/transport/render/PipeRendererWorld.java deleted file mode 100644 index 3d74f55588..0000000000 --- a/common/buildcraft/transport/render/PipeRendererWorld.java +++ /dev/null @@ -1,207 +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.render; - -// TODO (PASS 0): Rewrite this into a block model thingy, like how the chute works -public class PipeRendererWorld {// implements ISimpleBlockRenderingHandler { - // - // public static int renderPass = -1; - // public static float zFightOffset = 1F / 4096F; - // - // public void renderPipe(RenderBlocks renderblocks, IBlockAccess iblockaccess, TileGenericPipe tile, BlockPos pos) - // { - // PipeRenderState state = tile.renderState; - // IIconProvider icons = tile.getPipeIcons(); - // FakeBlock fakeBlock = FakeBlock.INSTANCE; - // int glassColor = tile.getPipeColor(); - // - // if (icons == null) { - // return; - // } - // - // if (renderPass == 0 || glassColor >= 0) { - // // Pass 0 handles the pipe texture, pass 1 handles the transparent stained glass - // int connectivity = state.pipeConnectionMatrix.getMask(); - // float[] dim = new float[6]; - // - // if (renderPass == 1) { - // fakeBlock.setColor(ColorUtils.getRGBColor(glassColor)); - // } - // - // // render the unconnected pipe faces of the center block (if any) - // - // if (connectivity != 0x3f) { // note: 0x3f = 0x111111 = all sides - // resetToCenterDimensions(dim); - // - // if (renderPass == 0) { - // fakeBlock.getTextureState().setToStack(icons.getIcon(state.textureMatrix.getTextureIndex(null))); - // } else { - // fakeBlock.getTextureState().set(PipeIconProvider.TYPE.PipeStainedOverlay.getIcon()); - // } - // - // fixForRenderPass(dim); - // - // renderTwoWayBlock(renderblocks, fakeBlock, pos, dim, connectivity ^ 0x3f); - // } - // - // // render the connecting pipe faces - // for (int dir = 0; dir < 6; dir++) { - // int mask = 1 << dir; - // - // if ((connectivity & mask) == 0) { - // continue; // no connection towards dir - // } - // - // // center piece offsets - // resetToCenterDimensions(dim); - // - // // extend block towards dir as it's connected to there - // dim[dir / 2] = dir % 2 == 0 ? 0 : CoreConstants.PIPE_MAX_POS; - // dim[dir / 2 + 3] = dir % 2 == 0 ? CoreConstants.PIPE_MIN_POS : 1; - // - // // the mask points to all faces perpendicular to dir, i.e. dirs 0+1 -> mask 111100, 1+2 -> 110011, 3+5 - // // -> 001111 - // int renderMask = (3 << (dir & 0x6)) ^ 0x3f; - // - // fixForRenderPass(dim); - // - // // render sub block - // if (renderPass == 0) { - // fakeBlock.getTextureState().setToStack(icons.getIcon(state.textureMatrix.getTextureIndex(EnumFacing.VALUES[dir]))); - // } else { - // fakeBlock.getTextureState().set(PipeIconProvider.TYPE.PipeStainedOverlay.getIcon()); - // } - // - // renderTwoWayBlock(renderblocks, fakeBlock, pos, dim, renderMask); - // - // // Render connecting block - // if (Minecraft.getMinecraft().gameSettings.fancyGraphics) { - // EnumFacing side = EnumFacing.getFront(dir); - // int px = x + side.offsetX; - // int py = y + side.offsetY; - // int pz = z + side.offsetZ; - // Block block = iblockaccess.getBlock(px, py, pz); - // if (!(block instanceof BlockGenericPipe) && !block.isOpaqueCube()) { - // - // double[] blockBB; - // if (block instanceof BlockChest) { - // // work around what sems to be a vanilla bug? - // blockBB = new double[] { 0, 0.0625F, 0.0625F, 0.875F, 0.9375F, 0.9375F }; - // } else { - // block.setBlockBoundsBasedOnState(iblockaccess, px, py, pz); - // - // blockBB = - // new double[] { block.getBlockBoundsMinY(), block.getBlockBoundsMinX(), block.getBlockBoundsMinZ(), - // block.getBlockBoundsMaxY(), block.getBlockBoundsMaxX(), block.getBlockBoundsMaxZ() }; - // } - // - // if ((dir % 2 == 1 && blockBB[dir / 2] != 0) || (dir % 2 == 0 && blockBB[dir / 2 + 3] != 1)) { - // resetToCenterDimensions(dim); - // - // if (dir % 2 == 1) { - // dim[dir / 2] = 0; - // dim[dir / 2 + 3] = (float) blockBB[dir / 2]; - // } else { - // dim[dir / 2] = (float) blockBB[dir / 2 + 3]; - // dim[dir / 2 + 3] = 1; - // } - // - // fixForRenderPass(dim); - // - // renderTwoWayBlock(renderblocks, fakeBlock, x + side.offsetX, y + side.offsetY, z + side.offsetZ, dim, - // renderMask); - // } - // } - // } - // } - // - // fakeBlock.setColor(0xFFFFFF); - // } - // - // renderblocks.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); - // - // for (EnumFacing dir : EnumFacing.VALUES) { - // if (tile.hasPipePluggable(dir)) { - // PipePluggable p = tile.getPipePluggable(dir); - // IPipePluggableRenderer r = p.getRenderer(); - // if (r != null) { - // r.renderPluggable(renderblocks, tile.getPipe(), dir, p, fakeBlock, renderPass, pos); - // } - // } - // } - // } - // - // private void fixForRenderPass(float[] dim) { - // if (renderPass == 1) { - // for (int i = 0; i < 3; i++) { - // dim[i] += zFightOffset; - // } - // - // for (int i = 3; i < 6; i++) { - // dim[i] -= zFightOffset; - // } - // } - // } - // - // private void resetToCenterDimensions(float[] dim) { - // for (int i = 0; i < 3; i++) { - // dim[i] = CoreConstants.PIPE_MIN_POS; - // } - // - // for (int i = 3; i < 6; i++) { - // dim[i] = CoreConstants.PIPE_MAX_POS; - // } - // } - // - // /** Render a block with normal and inverted vertex order so back face culling doesn't have any effect. */ - // private void renderTwoWayBlock(RenderBlocks renderblocks, FakeBlock stateHost, BlockPos pos, float[] dim, int - // mask) { - // assert mask != 0; - // - // stateHost.setRenderMask(mask); - // renderblocks.setRenderBounds(dim[2], dim[0], dim[1], dim[5], dim[3], dim[4]); - // renderblocks.renderStandardBlock(stateHost, pos); - // stateHost.setRenderMask((mask & 0x15) << 1 | (mask & 0x2a) >> 1); // pairwise swapped mask - // renderblocks.setRenderBounds(dim[5], dim[3], dim[4], dim[2], dim[0], dim[1]); - // renderblocks.renderStandardBlock(stateHost, pos); - // stateHost.setRenderAllSides(); - // } - // - // @Override - // public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { - // // Done with a special item renderer - // } - // - // @Override - // public boolean renderWorldBlock(IBlockAccess world, BlockPos pos, Block block, int modelId, RenderBlocks - // renderer) { - // TileEntity tile = world.getTileEntity(pos); - // - // // Here to prevent Minecraft from crashing when nothing renders on a render pass - // // (rarely in pass 0, often in pass 1) - // // This is a 1.7 bug. - // Tessellator.instance.addVertexWithUV(pos, 0, 0); - // Tessellator.instance.addVertexWithUV(pos, 0, 0); - // Tessellator.instance.addVertexWithUV(pos, 0, 0); - // Tessellator.instance.addVertexWithUV(pos, 0, 0); - // - // if (tile instanceof TileGenericPipe) { - // TileGenericPipe pipeTile = (TileGenericPipe) tile; - // renderPipe(renderer, world, pipeTile, pos); - // } - // - // return true; - // } - // - // @Override - // public boolean shouldRender3DInInventory(int modelId) { - // return false; - // } - // - // @Override - // public int getRenderId() { - // return TransportProxy.pipeModel; - // } -} diff --git a/common/buildcraft/transport/render/PlugItemRenderer.java b/common/buildcraft/transport/render/PlugItemRenderer.java deleted file mode 100644 index c82a32240d..0000000000 --- a/common/buildcraft/transport/render/PlugItemRenderer.java +++ /dev/null @@ -1,98 +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.render; - -public class PlugItemRenderer {// implements IItemRenderer { - // - // private void renderPlugItem(RenderBlocks render, ItemStack item, float translateX, float translateY, float - // translateZ) { - // // Render StructurePipe - // Block block = BuildCraftTransport.genericPipeBlock; - // Tessellator tessellator = Tessellator.instance; - // TextureAtlasSprite textureID = - // BuildCraftTransport.instance.pipeIconProvider.getIcon(PipeIconProvider.TYPE.PipeStructureCobblestone - // .ordinal()); // Structure - // // pipe - // - // block.setBlockBounds(0.25F, 0.25F, 0.25F, 0.75F, 0.375F, 0.75F); - // block.setBlockBoundsForItemRender(); - // render.setRenderBoundsFromBlock(block); - // GL11.glTranslatef(translateX, translateY, translateZ + 0.25F); - // - // tessellator.startDrawingQuads(); - // tessellator.setNormal(0.0F, -0F, 0.0F); - // render.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, textureID); - // tessellator.draw(); - // - // tessellator.startDrawingQuads(); - // tessellator.setNormal(0.0F, 1.0F, 0.0F); - // render.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, textureID); - // tessellator.draw(); - // - // tessellator.startDrawingQuads(); - // tessellator.setNormal(0.0F, 0.0F, -1F); - // render.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, textureID); - // tessellator.draw(); - // - // tessellator.startDrawingQuads(); - // tessellator.setNormal(0.0F, 0.0F, 1.0F); - // render.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, textureID); - // tessellator.draw(); - // - // tessellator.startDrawingQuads(); - // tessellator.setNormal(-1F, 0.0F, 0.0F); - // render.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, textureID); - // tessellator.draw(); - // - // tessellator.startDrawingQuads(); - // tessellator.setNormal(1.0F, 0.0F, 0.0F); - // render.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, textureID); - // tessellator.draw(); - // } - // - // @Override - // public boolean handleRenderType(ItemStack item, ItemRenderType type) { - // switch (type) { - // case ENTITY: - // return true; - // case EQUIPPED: - // return true; - // case EQUIPPED_FIRST_PERSON: - // return true; - // case INVENTORY: - // return true; - // default: - // return false; - // } - // } - // - // @Override - // public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { - // return helper != ItemRendererHelper.BLOCK_3D; - // } - // - // @Override - // public void renderItem(ItemRenderType type, ItemStack item, Object... data) { - // switch (type) { - // case ENTITY: - // GL11.glScalef(0.50F, 0.50F, 0.50F); - // renderPlugItem((RenderBlocks) data[0], item, -0.6F, 0f, -0.6F); - // break; - // case EQUIPPED: - // case EQUIPPED_FIRST_PERSON: - // GL11.glRotatef(70, 0, 0, 1F); - // GL11.glRotatef(-55, 1, 0, 0); - // GL11.glScalef(2F, 2F, 2F); - // GL11.glTranslatef(0, -0.6F, -0.4F); - // renderPlugItem((RenderBlocks) data[0], item, 0F, 0F, 0f); - // break; - // case INVENTORY: - // GL11.glScalef(1.1F, 1.1F, 1.1F); - // renderPlugItem((RenderBlocks) data[0], item, -0.3f, -0.35f, -0.7f); - // break; - // default: - // } - // } -} diff --git a/common/buildcraft/transport/render/TileEntityPickupFX.java b/common/buildcraft/transport/render/TileEntityPickupFX.java deleted file mode 100644 index 30d30d1d97..0000000000 --- a/common/buildcraft/transport/render/TileEntityPickupFX.java +++ /dev/null @@ -1,82 +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 */ -/** Based on EntityPickupFX */ -package buildcraft.transport.render; - -import org.lwjgl.opengl.GL11; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.particle.EntityFX; -import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.WorldRenderer; -import net.minecraft.entity.Entity; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -import buildcraft.transport.utils.TransportUtils; - -@SideOnly(Side.CLIENT) -public class TileEntityPickupFX extends EntityFX { - private Entity entityToPickUp; - private TileEntity tilePickingUp; - private int age = 0; - private int maxAge = 0; - - /** renamed from yOffset to fix shadowing Entity.yOffset */ - private double yOffs; - - public TileEntityPickupFX(World par1World, EntityItem par2Entity, TileEntity par3Entity) { - super(par1World, par2Entity.posX, par2Entity.posY, par2Entity.posZ, par2Entity.motionX, par2Entity.motionY, par2Entity.motionZ); - this.entityToPickUp = par2Entity; - this.tilePickingUp = par3Entity; - this.maxAge = 3; - this.yOffs = TransportUtils.getPipeFloorOf(par2Entity.getEntityItem()); - } - - @Override - public void renderParticle(WorldRenderer wr, Entity ent, float partialTicks, float par3, float par4, float par5, float par6, float par7) { - float agePercent = (this.age + partialTicks) / this.maxAge; - agePercent *= agePercent; - double entX = this.entityToPickUp.posX; - double entY = this.entityToPickUp.posY; - double entZ = this.entityToPickUp.posZ; - double tileX = this.tilePickingUp.getPos().getX() + 0.5; - double tileY = this.tilePickingUp.getPos().getY() + yOffs; - double tileZ = this.tilePickingUp.getPos().getZ() + 0.5; - double var21 = entX + (tileX - entX) * agePercent; - double var23 = entY + (tileY - entY) * agePercent; - double var25 = entZ + (tileZ - entZ) * agePercent; - int brightness = this.getBrightnessForRender(partialTicks); - int var31 = brightness % 0x10000; - int var32 = brightness / 0x10000; - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, var31 / 1.0F, var32 / 1.0F); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - var21 -= interpPosX; - var23 -= interpPosY; - var25 -= interpPosZ; - if (Minecraft.getMinecraft().renderEngine != null) { - Minecraft.getMinecraft().getRenderManager().renderEntityWithPosYaw(this.entityToPickUp, var21, var23, var25, - this.entityToPickUp.rotationYaw, partialTicks); - } - } - - /** Called to update the entity's position/logic. */ - @Override - public void onUpdate() { - ++this.age; - - if (this.age == this.maxAge) { - this.setDead(); - } - } - - @Override - public int getFXLayer() { - return 3; - } -} diff --git a/common/buildcraft/transport/schematics/BptPipeExtension.java b/common/buildcraft/transport/schematics/BptPipeExtension.java index 1d12238a7f..6f8a61c320 100755 --- a/common/buildcraft/transport/schematics/BptPipeExtension.java +++ b/common/buildcraft/transport/schematics/BptPipeExtension.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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 java.util.HashMap; diff --git a/common/buildcraft/transport/schematics/BptItemPipeFilters.java b/common/buildcraft/transport/schematics/BptPipeFiltered.java similarity index 93% rename from common/buildcraft/transport/schematics/BptItemPipeFilters.java rename to common/buildcraft/transport/schematics/BptPipeFiltered.java index cc2ece3ec5..0109b8d476 100644 --- a/common/buildcraft/transport/schematics/BptItemPipeFilters.java +++ b/common/buildcraft/transport/schematics/BptPipeFiltered.java @@ -1,5 +1,5 @@ /** 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; @@ -12,9 +12,9 @@ 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/BptPipeRotatable.java similarity index 91% rename from common/buildcraft/transport/schematics/BptPipeIron.java rename to common/buildcraft/transport/schematics/BptPipeRotatable.java index 8bb0f92b71..d2dc5ef6a7 100644 --- a/common/buildcraft/transport/schematics/BptPipeIron.java +++ b/common/buildcraft/transport/schematics/BptPipeRotatable.java @@ -1,5 +1,5 @@ /** 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; @@ -12,9 +12,9 @@ import buildcraft.api.blueprints.SchematicTile; import buildcraft.api.properties.BuildCraftProperties; -public class BptPipeIron extends BptPipeExtension { +public class BptPipeRotatable extends BptPipeExtension { - public BptPipeIron(Item i) { + public BptPipeRotatable(Item i) { super(i); } diff --git a/common/buildcraft/transport/schematics/SchematicPipe.java b/common/buildcraft/transport/schematics/SchematicPipe.java index cd5717ded9..c6319688be 100644 --- a/common/buildcraft/transport/schematics/SchematicPipe.java +++ b/common/buildcraft/transport/schematics/SchematicPipe.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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 java.util.ArrayList; diff --git a/common/buildcraft/transport/statements/ActionEnergyPulsar.java b/common/buildcraft/transport/statements/ActionEnergyPulsar.java index 5cf9b7b6a0..668af22e05 100644 --- a/common/buildcraft/transport/statements/ActionEnergyPulsar.java +++ b/common/buildcraft/transport/statements/ActionEnergyPulsar.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.statements; import buildcraft.api.statements.IActionInternal; diff --git a/common/buildcraft/transport/statements/ActionExtractionPreset.java b/common/buildcraft/transport/statements/ActionExtractionPreset.java index 4419171e6f..fb063ce83a 100644 --- a/common/buildcraft/transport/statements/ActionExtractionPreset.java +++ b/common/buildcraft/transport/statements/ActionExtractionPreset.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.statements; import java.util.Locale; diff --git a/common/buildcraft/transport/statements/ActionParameterSignal.java b/common/buildcraft/transport/statements/ActionParameterSignal.java index 5025f88411..892ba21b27 100644 --- a/common/buildcraft/transport/statements/ActionParameterSignal.java +++ b/common/buildcraft/transport/statements/ActionParameterSignal.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.statements; import java.util.Locale; diff --git a/common/buildcraft/transport/statements/ActionPipeColor.java b/common/buildcraft/transport/statements/ActionPipeColor.java index 695de0901a..3fff3919e2 100644 --- a/common/buildcraft/transport/statements/ActionPipeColor.java +++ b/common/buildcraft/transport/statements/ActionPipeColor.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.statements; import java.util.Locale; diff --git a/common/buildcraft/transport/statements/ActionPipeDirection.java b/common/buildcraft/transport/statements/ActionPipeDirection.java index 091cf0b174..608dc1f46c 100644 --- a/common/buildcraft/transport/statements/ActionPipeDirection.java +++ b/common/buildcraft/transport/statements/ActionPipeDirection.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.statements; import java.util.Locale; diff --git a/common/buildcraft/transport/statements/ActionPowerLimiter.java b/common/buildcraft/transport/statements/ActionPowerLimiter.java index 2b09acf653..27a6a94b00 100644 --- a/common/buildcraft/transport/statements/ActionPowerLimiter.java +++ b/common/buildcraft/transport/statements/ActionPowerLimiter.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.statements; import java.util.Locale; diff --git a/common/buildcraft/transport/statements/ActionRedstoneFaderOutput.java b/common/buildcraft/transport/statements/ActionRedstoneFaderOutput.java index 7117a81ed4..3772647e0e 100644 --- a/common/buildcraft/transport/statements/ActionRedstoneFaderOutput.java +++ b/common/buildcraft/transport/statements/ActionRedstoneFaderOutput.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.statements; import buildcraft.api.statements.IActionInternal; diff --git a/common/buildcraft/transport/statements/ActionSignalOutput.java b/common/buildcraft/transport/statements/ActionSignalOutput.java index 8f3dfc96cc..c473e5579a 100644 --- a/common/buildcraft/transport/statements/ActionSignalOutput.java +++ b/common/buildcraft/transport/statements/ActionSignalOutput.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.statements; import java.util.Locale; @@ -16,7 +20,7 @@ public class ActionSignalOutput extends BCStatement implements IActionInternal { - public PipeWire color; + public final PipeWire color; public ActionSignalOutput(PipeWire color) { super("buildcraft:pipe.wire.output." + color.name().toLowerCase(Locale.ENGLISH), "buildcraft.pipe.wire.output." + color.name().toLowerCase( diff --git a/common/buildcraft/transport/statements/ActionSingleEnergyPulse.java b/common/buildcraft/transport/statements/ActionSingleEnergyPulse.java index a6bcafa84b..44530ba240 100644 --- a/common/buildcraft/transport/statements/ActionSingleEnergyPulse.java +++ b/common/buildcraft/transport/statements/ActionSingleEnergyPulse.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.statements; import net.minecraft.util.ResourceLocation; diff --git a/common/buildcraft/transport/statements/ActionValve.java b/common/buildcraft/transport/statements/ActionValve.java index 40ba339c8b..74e8b9297e 100644 --- a/common/buildcraft/transport/statements/ActionValve.java +++ b/common/buildcraft/transport/statements/ActionValve.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.statements; import java.util.Locale; @@ -31,7 +35,7 @@ public enum ValveState { public final boolean inputOpen; public final boolean outputOpen; - private ValveState(boolean in, boolean out) { + ValveState(boolean in, boolean out) { inputOpen = in; outputOpen = out; } diff --git a/common/buildcraft/transport/statements/TriggerClockTimer.java b/common/buildcraft/transport/statements/TriggerClockTimer.java index e039e4ad71..023254294a 100644 --- a/common/buildcraft/transport/statements/TriggerClockTimer.java +++ b/common/buildcraft/transport/statements/TriggerClockTimer.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.statements; import java.util.Locale; @@ -22,7 +26,7 @@ public enum Time { public static final Time[] VALUES = values(); public final int delay; - private Time(int delay) { + Time(int delay) { this.delay = delay; } } diff --git a/common/buildcraft/transport/statements/TriggerLightSensor.java b/common/buildcraft/transport/statements/TriggerLightSensor.java index 25dc84250f..3124b27caa 100644 --- a/common/buildcraft/transport/statements/TriggerLightSensor.java +++ b/common/buildcraft/transport/statements/TriggerLightSensor.java @@ -11,7 +11,6 @@ import buildcraft.core.lib.utils.Utils; import buildcraft.core.statements.BCStatement; -/** Created by asie on 3/14/15. */ public class TriggerLightSensor extends BCStatement implements ITriggerInternal { private final boolean bright; diff --git a/common/buildcraft/transport/statements/TriggerParameterSignal.java b/common/buildcraft/transport/statements/TriggerParameterSignal.java index ff834aa9c4..38f5bdad17 100644 --- a/common/buildcraft/transport/statements/TriggerParameterSignal.java +++ b/common/buildcraft/transport/statements/TriggerParameterSignal.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.statements; import java.util.Locale; diff --git a/common/buildcraft/transport/statements/TriggerPipeContents.java b/common/buildcraft/transport/statements/TriggerPipeContents.java index ea0311de0f..d32aa11763 100644 --- a/common/buildcraft/transport/statements/TriggerPipeContents.java +++ b/common/buildcraft/transport/statements/TriggerPipeContents.java @@ -1,5 +1,5 @@ /** 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.statements; @@ -8,7 +8,6 @@ import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTankInfo; import buildcraft.api.gates.IGate; import buildcraft.api.statements.IStatementContainer; @@ -40,7 +39,7 @@ public enum PipeContents { public TriggerPipeContents(PipeContents kind) { super("buildcraft:pipe.contents." + kind.name().toLowerCase(Locale.ROOT), "buildcraft.pipe.contents." + kind.name()); - setBuildCraftLocation("transport", "triggers/trigger_pipecontents_" + kind.name().toLowerCase(Locale.ROOT)); + setBuildCraftLocation("transport", "triggers/trigger_pipecontents_" + kind.name().toLowerCase(Locale.ROOT)); this.kind = kind; kind.trigger = this; } @@ -88,46 +87,34 @@ public boolean isTriggerActive(IStatementContainer container, IStatementParamete } else if (pipe.transport instanceof PipeTransportFluids) { PipeTransportFluids transportFluids = (PipeTransportFluids) pipe.transport; - FluidStack searchedFluid = null; - - if (parameter != null && parameter.getItemStack() != null) { - searchedFluid = FluidContainerRegistry.getFluidForFilledItem(parameter.getItemStack()); - } - if (kind == PipeContents.empty) { - for (FluidTankInfo b : transportFluids.getTankInfo(null)) { - if (b.fluid != null && b.fluid.amount != 0) { - return false; - } - } - - return true; + return transportFluids.fluidType == null; } else { - for (FluidTankInfo b : transportFluids.getTankInfo(null)) { - if (b.fluid != null && b.fluid.amount != 0) { - if (searchedFluid == null || searchedFluid.isFluidEqual(b.fluid)) { - return true; - } + if (parameter != null && parameter.getItemStack() != null) { + FluidStack searchedFluid = FluidContainerRegistry.getFluidForFilledItem(parameter.getItemStack()); + + if (searchedFluid != null) { + return transportFluids.fluidType != null && searchedFluid.isFluidEqual(transportFluids.fluidType); } + } else { + return transportFluids.fluidType != null; } - - return false; } } else if (pipe.transport instanceof PipeTransportPower) { PipeTransportPower transportPower = (PipeTransportPower) pipe.transport; switch (kind) { case empty: - for (double s : transportPower.displayPower) { - if (s > 1e-4) { + for (short s : transportPower.displayPower) { + if (s > 0) { return false; } } return true; case containsEnergy: - for (double s : transportPower.displayPower) { - if (s > 1e-4) { + for (short s : transportPower.displayPower) { + if (s > 0) { return true; } } diff --git a/common/buildcraft/transport/statements/TriggerPipeSignal.java b/common/buildcraft/transport/statements/TriggerPipeSignal.java index f2c254d515..571d48e00c 100644 --- a/common/buildcraft/transport/statements/TriggerPipeSignal.java +++ b/common/buildcraft/transport/statements/TriggerPipeSignal.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.statements; import java.util.Locale; @@ -50,11 +54,11 @@ public boolean isTriggerActive(IStatementContainer container, IStatementParamete Pipe pipe = (Pipe) ((IGate) container).getPipe(); if (active) { - if (pipe.signalStrength[color.ordinal()] == 0) { + if (pipe.signalStrength[color.ordinal()] == 0) { return false; } } else { - if (pipe.signalStrength[color.ordinal()] > 0) { + if (pipe.signalStrength[color.ordinal()] > 0) { return false; } } @@ -65,11 +69,11 @@ public boolean isTriggerActive(IStatementContainer container, IStatementParamete if (signal.color != null) { if (signal.active) { - if (pipe.signalStrength[signal.color.ordinal()] == 0) { + if (pipe.signalStrength[signal.color.ordinal()] == 0) { return false; } } else { - if (pipe.signalStrength[signal.color.ordinal()] > 0) { + if (pipe.signalStrength[signal.color.ordinal()] > 0) { return false; } } diff --git a/common/buildcraft/transport/statements/TriggerRedstoneFaderInput.java b/common/buildcraft/transport/statements/TriggerRedstoneFaderInput.java index 1bdb06d9d6..9ff9823e5a 100644 --- a/common/buildcraft/transport/statements/TriggerRedstoneFaderInput.java +++ b/common/buildcraft/transport/statements/TriggerRedstoneFaderInput.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.statements; import buildcraft.api.gates.IGate; diff --git a/common/buildcraft/transport/stripes/PipeExtensionListener.java b/common/buildcraft/transport/stripes/PipeExtensionListener.java index 503739327e..799c1c7af1 100644 --- a/common/buildcraft/transport/stripes/PipeExtensionListener.java +++ b/common/buildcraft/transport/stripes/PipeExtensionListener.java @@ -15,19 +15,20 @@ import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraft.world.WorldServer; + import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; +import buildcraft.BuildCraftTransport; import buildcraft.api.transport.IStripesActivator; import buildcraft.core.lib.utils.Utils; import buildcraft.core.proxy.CoreProxy; -import buildcraft.BuildCraftTransport; +import buildcraft.transport.Pipe; import buildcraft.transport.PipeTransportItems; import buildcraft.transport.TileGenericPipe; import buildcraft.transport.TravelingItem; import buildcraft.transport.utils.TransportUtils; -/** Created by asie on 3/20/15. */ public class PipeExtensionListener { private class PipeExtensionRequest { public ItemStack stack; @@ -81,6 +82,8 @@ public void tick(TickEvent.WorldTickEvent event) { w.getTileEntity(r.pos).writeToNBT(nbt); w.setBlockToAir(r.pos); + boolean failedPlacement = false; + // Step 2: If retracting, remove previous pipe; if extending, add new pipe BlockPos targetPos = Utils.convertFloor(target); if (retract) { @@ -108,8 +111,8 @@ public void tick(TickEvent.WorldTickEvent event) { pipeTile.update(); // Step 4: Hope for the best, clean up. - PipeTransportItems items = (PipeTransportItems) pipeTile.pipe.transport; - if (!retract) { + PipeTransportItems items = (PipeTransportItems) ((Pipe) pipeTile.getPipe()).transport; + if (!retract && !failedPlacement) { r.stack.stackSize--; } @@ -122,10 +125,13 @@ public void tick(TickEvent.WorldTickEvent event) { } } - if (!retract) { + if (!retract && !failedPlacement) { TileGenericPipe newPipeTile = (TileGenericPipe) w.getTileEntity(r.pos); newPipeTile.update(); pipeTile.scheduleNeighborChange(); + if (pipeTile.getPipe() != null) { + ((Pipe) pipeTile.getPipe()).scheduleWireUpdate(); + } } } rSet.clear(); diff --git a/common/buildcraft/transport/stripes/StripesHandlerBucket.java b/common/buildcraft/transport/stripes/StripesHandlerBucket.java index 14fac32515..372ec9fa5e 100644 --- a/common/buildcraft/transport/stripes/StripesHandlerBucket.java +++ b/common/buildcraft/transport/stripes/StripesHandlerBucket.java @@ -10,6 +10,7 @@ import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; + import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidStack; @@ -42,12 +43,9 @@ public boolean shouldHandle(ItemStack stack) { @Override public boolean handle(World world, BlockPos pos, EnumFacing direction, ItemStack stack, EntityPlayer player, IStripesActivator activator) { - IBlockState state = world.getBlockState(pos); - Block block = state.getBlock(); - if (block == Blocks.air) { - IBlockState underblock = world.getBlockState(pos.down()); - - if (((ItemBucket) stack.getItem()).tryPlaceContainedLiquid(world, pos.down())) { + if (world.isAirBlock(pos)) { + BlockPos place = new BlockPos(pos.getX(), direction.ordinal() < 2 ? pos.getY() : (pos.getY() - 1), pos.getZ()); + if (((ItemBucket) stack.getItem()).tryPlaceContainedLiquid(world, place)) { activator.sendItem(emptyBucket, direction.getOpposite()); stack.stackSize--; if (stack.stackSize > 0) { @@ -55,30 +53,36 @@ public boolean handle(World world, BlockPos pos, EnumFacing direction, ItemStack } return true; - } else { - if (!FluidContainerRegistry.isEmptyContainer(stack)) { - activator.sendItem(stack, direction.getOpposite()); - return true; - } + } + } - FluidStack fluidStack = BlockUtils.drainBlock(underblock, world, pos.down(), true); - ItemStack filledBucket = getFilledBucket(fluidStack, underblock.getBlock()); + if (!FluidContainerRegistry.isEmptyContainer(stack)) { + activator.sendItem(stack, direction.getOpposite()); + return true; + } - if (fluidStack == null || filledBucket == null) { - activator.sendItem(stack, direction.getOpposite()); - return true; - } + IBlockState targetBlock = world.getBlockState(pos); + FluidStack fluidStack = BlockUtils.drainBlock(targetBlock, world, pos, true); - activator.sendItem(filledBucket, direction.getOpposite()); - stack.stackSize--; - if (stack.stackSize > 0) { - activator.sendItem(stack, direction.getOpposite()); - } + if (fluidStack == null) { + targetBlock = world.getBlockState(pos.down()); + fluidStack = BlockUtils.drainBlock(targetBlock, world, pos.down(), true); + } - return true; - } + ItemStack filledBucket = getFilledBucket(fluidStack, targetBlock.getBlock()); + + if (fluidStack == null || filledBucket == null) { + activator.sendItem(stack, direction.getOpposite()); + return true; } - return false; + + activator.sendItem(filledBucket, direction.getOpposite()); + stack.stackSize--; + if (stack.stackSize > 0) { + activator.sendItem(stack, direction.getOpposite()); + } + + return true; } } diff --git a/common/buildcraft/transport/stripes/StripesHandlerEntityInteract.java b/common/buildcraft/transport/stripes/StripesHandlerEntityInteract.java index 4012b6c7e9..9fb5e57586 100644 --- a/common/buildcraft/transport/stripes/StripesHandlerEntityInteract.java +++ b/common/buildcraft/transport/stripes/StripesHandlerEntityInteract.java @@ -1,5 +1,5 @@ /** 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.stripes; @@ -8,6 +8,7 @@ import java.util.LinkedList; import java.util.List; +import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -33,14 +34,15 @@ public boolean shouldHandle(ItemStack stack) { @Override public boolean handle(World world, BlockPos pos, EnumFacing direction, ItemStack stack, EntityPlayer player, IStripesActivator activator) { + AxisAlignedBB box = new AxisAlignedBB(pos, pos.add(1, 1, 1)); - List entities = world.getEntitiesWithinAABBExcludingEntity(null, box); + List entities = world.getEntitiesWithinAABBExcludingEntity(null, box); if (entities.size() <= 0) { return false; } List livingEntities = new LinkedList(); - for (Object entityObj : entities) { + for (Entity entityObj : entities) { if (entityObj instanceof EntityLivingBase) { livingEntities.add((EntityLivingBase) entityObj); } diff --git a/common/buildcraft/transport/stripes/StripesHandlerHoe.java b/common/buildcraft/transport/stripes/StripesHandlerHoe.java index e68de02f6a..08cf6551c2 100644 --- a/common/buildcraft/transport/stripes/StripesHandlerHoe.java +++ b/common/buildcraft/transport/stripes/StripesHandlerHoe.java @@ -1,7 +1,11 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ +/** + * Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team + * http://www.mod-buildcraft.com + *

+ * The BuildCraft API is distributed under the terms of the MIT License. + * Please check the contents of the license, which should be located + * as "LICENSE.API" in the BuildCraft source code distribution. + */ package buildcraft.transport.stripes; import net.minecraft.entity.player.EntityPlayer; diff --git a/common/buildcraft/transport/stripes/StripesHandlerMinecartDestroy.java b/common/buildcraft/transport/stripes/StripesHandlerMinecartDestroy.java index 27f566c274..6d80f886e5 100644 --- a/common/buildcraft/transport/stripes/StripesHandlerMinecartDestroy.java +++ b/common/buildcraft/transport/stripes/StripesHandlerMinecartDestroy.java @@ -1,5 +1,5 @@ /** 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.stripes; @@ -8,6 +8,7 @@ import java.util.LinkedList; import java.util.List; +import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityMinecart; import net.minecraft.entity.item.EntityMinecartContainer; import net.minecraft.entity.player.EntityPlayer; @@ -35,8 +36,7 @@ public boolean shouldHandle(ItemStack stack) { @Override public boolean handle(World world, BlockPos pos, EnumFacing direction, ItemStack stack, EntityPlayer player, IStripesActivator activator) { AxisAlignedBB box = new AxisAlignedBB(pos, pos.add(1, 1, 1)); - @SuppressWarnings("rawtypes") - List entities = world.getEntitiesWithinAABBExcludingEntity(null, box); + List entities = world.getEntitiesWithinAABBExcludingEntity(null, box); if (entities.size() <= 0) { return false; } diff --git a/common/buildcraft/transport/stripes/StripesHandlerPipeWires.java b/common/buildcraft/transport/stripes/StripesHandlerPipeWires.java index 857ff9890f..04e8f1e7d6 100644 --- a/common/buildcraft/transport/stripes/StripesHandlerPipeWires.java +++ b/common/buildcraft/transport/stripes/StripesHandlerPipeWires.java @@ -41,7 +41,7 @@ public boolean handle(World world, BlockPos pos, EnumFacing direction, ItemStack if (!pipeTile.pipe.wireSet[pipeWireColor]) { pipeTile.pipe.wireSet[pipeWireColor] = true; - pipeTile.pipe.signalStrength[pipeWireColor] = 0; + pipeTile.pipe.signalStrength[pipeWireColor] = 0; pipeTile.pipe.updateSignalState(); pipeTile.scheduleRenderUpdate(); diff --git a/common/buildcraft/transport/stripes/StripesHandlerPipes.java b/common/buildcraft/transport/stripes/StripesHandlerPipes.java index ba11e8c33f..d642e2eba9 100644 --- a/common/buildcraft/transport/stripes/StripesHandlerPipes.java +++ b/common/buildcraft/transport/stripes/StripesHandlerPipes.java @@ -1,5 +1,5 @@ /** 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.stripes; @@ -12,15 +12,15 @@ import net.minecraft.world.World; import net.minecraft.world.WorldServer; +import buildcraft.BuildCraftTransport; import buildcraft.api.transport.IStripesActivator; import buildcraft.api.transport.IStripesHandler; import buildcraft.core.lib.utils.Utils; import buildcraft.core.proxy.CoreProxy; -import buildcraft.BuildCraftTransport; -import buildcraft.transport.Pipe; -import buildcraft.transport.PipeTransportItems; import buildcraft.transport.BlockGenericPipe; import buildcraft.transport.ItemPipe; +import buildcraft.transport.Pipe; +import buildcraft.transport.PipeTransportItems; public class StripesHandlerPipes implements IStripesHandler { @@ -42,16 +42,16 @@ public boolean handle(World world, BlockPos pos, EnumFacing direction, ItemStack } Vec3 p = Utils.convert(pos).add(Utils.convert(direction, -1)); + BlockPos pi = Utils.convertFloor(p); Pipe pipe = BlockGenericPipe.createPipe((ItemPipe) stack.getItem()); + if (pipe.transport instanceof PipeTransportItems) { - // Checks done, request extension - BuildCraftTransport.pipeExtensionListener.requestPipeExtension(stack, world, Utils.convertFloor(p), direction, activator); + // Item pipe: request extending on end of tick + BuildCraftTransport.pipeExtensionListener.requestPipeExtension(stack, world, pi, direction, activator); } else { - // Fluid/power pipe, place in front instead - - stack.getItem().onItemUse(stack, CoreProxy.proxy.getBuildCraftPlayer((WorldServer) world, Utils.convertFloor(p)).get(), world, Utils - .convertFloor(p), EnumFacing.UP, 0, 0, 0); + // Non-item pipe: place in front of stripes (item) pipe + stack.getItem().onItemUse(stack, CoreProxy.proxy.getBuildCraftPlayer((WorldServer) world, pi).get(), world, pi, EnumFacing.UP, 0, 0, 0); } return true; } diff --git a/common/buildcraft/transport/stripes/StripesHandlerPlaceBlock.java b/common/buildcraft/transport/stripes/StripesHandlerPlaceBlock.java index db4bf2bf27..2081b903a3 100644 --- a/common/buildcraft/transport/stripes/StripesHandlerPlaceBlock.java +++ b/common/buildcraft/transport/stripes/StripesHandlerPlaceBlock.java @@ -1,5 +1,5 @@ /** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * + *

* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.transport.stripes; @@ -9,12 +9,10 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; -import net.minecraft.util.Vec3; import net.minecraft.world.World; import buildcraft.api.transport.IStripesActivator; import buildcraft.api.transport.IStripesHandler; -import buildcraft.core.lib.utils.Utils; public class StripesHandlerPlaceBlock implements IStripesHandler { @@ -30,13 +28,18 @@ public boolean shouldHandle(ItemStack stack) { @Override public boolean handle(World world, BlockPos pos, EnumFacing direction, ItemStack stack, EntityPlayer player, IStripesActivator activator) { - if (!world.isAirBlock(pos) && stack.onItemUse(player, world, pos, EnumFacing.UP, 0.0f, 0.0f, 0.0f)) { - return true; - } else if (world.isAirBlock(pos)) { - Vec3 src = Utils.convert(pos).add(Utils.convert(direction, -1)); - if (stack.onItemUse(player, world, Utils.convertFloor(src), direction, 0.0f, 0.0f, 0.0f)) { - return true; + if (!world.isAirBlock(pos)) { + return false; + } + + ItemBlock ib = (ItemBlock) stack.getItem(); + + if (ib.placeBlockAt(stack, player, world, pos, direction, 0.0f, 0.0f, 0.0f, ib.block.getStateFromMeta(stack.getMetadata()))) { + if (stack.stackSize > 0) { + activator.sendItem(stack, direction.getOpposite()); } + + return true; } return false; } diff --git a/common/buildcraft/transport/stripes/StripesHandlerShears.java b/common/buildcraft/transport/stripes/StripesHandlerShears.java index c7fd1b2632..17e095e2a5 100644 --- a/common/buildcraft/transport/stripes/StripesHandlerShears.java +++ b/common/buildcraft/transport/stripes/StripesHandlerShears.java @@ -12,6 +12,7 @@ import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; + import net.minecraftforge.common.IShearable; import buildcraft.api.transport.IStripesActivator; diff --git a/common/buildcraft/transport/utils/BitSetCodec.java b/common/buildcraft/transport/utils/BitSetCodec.java index 6bd09b8b4e..0afde91d03 100644 --- a/common/buildcraft/transport/utils/BitSetCodec.java +++ b/common/buildcraft/transport/utils/BitSetCodec.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.utils; import java.util.BitSet; diff --git a/common/buildcraft/transport/utils/ConnectionMatrix.java b/common/buildcraft/transport/utils/ConnectionMatrix.java index 9863ea6d18..9d81f48f6f 100644 --- a/common/buildcraft/transport/utils/ConnectionMatrix.java +++ b/common/buildcraft/transport/utils/ConnectionMatrix.java @@ -1,11 +1,9 @@ /** 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.utils; -import java.util.Set; - import net.minecraft.util.EnumFacing; import buildcraft.api.transport.pluggable.IConnectionMatrix; @@ -16,15 +14,7 @@ public class ConnectionMatrix implements IConnectionMatrix { private int mask = 0; private boolean dirty = false; - private Set s; - - public ConnectionMatrix() { - s = getSet(); - } - - public static Set getSet() { - return null; - } + public ConnectionMatrix() {} @Override public boolean isConnected(EnumFacing direction) { diff --git a/common/buildcraft/transport/utils/FluidRenderData.java b/common/buildcraft/transport/utils/FluidRenderData.java index 1777ce18e4..8316ca6e7e 100644 --- a/common/buildcraft/transport/utils/FluidRenderData.java +++ b/common/buildcraft/transport/utils/FluidRenderData.java @@ -1,8 +1,9 @@ package buildcraft.transport.utils; +import net.minecraftforge.fluids.FluidStack; + public class FluidRenderData { - public int fluidID, color; - /** Ordinals 0 through 5 are the normal EnumFacing.Values(), ordinal 6 is for the center bit of pipe */ + public int fluidID, color, flags; public int[] amount = new int[7]; public byte[] flow = new byte[6]; @@ -12,6 +13,14 @@ public FluidRenderData duplicate() { n.color = color; System.arraycopy(amount, 0, n.amount, 0, 7); System.arraycopy(flow, 0, n.flow, 0, 6); + n.flags = flags; return n; } + + public static int getFlags(FluidStack s) { + if (s == null) { + return 0; + } + return s.getFluid().getLuminosity(s); + } } diff --git a/common/buildcraft/transport/utils/TextureMatrix.java b/common/buildcraft/transport/utils/TextureMatrix.java index 19170421bf..a217df44a0 100644 --- a/common/buildcraft/transport/utils/TextureMatrix.java +++ b/common/buildcraft/transport/utils/TextureMatrix.java @@ -1,7 +1,3 @@ -/** 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.utils; import net.minecraft.util.EnumFacing; @@ -9,7 +5,6 @@ import io.netty.buffer.ByteBuf; public class TextureMatrix { - private final int[] iconIndexes = new int[7]; private boolean dirty = false; diff --git a/common/buildcraft/transport/utils/TransportUtils.java b/common/buildcraft/transport/utils/TransportUtils.java index 618d646340..158b5fa7e8 100644 --- a/common/buildcraft/transport/utils/TransportUtils.java +++ b/common/buildcraft/transport/utils/TransportUtils.java @@ -1,7 +1,11 @@ -/** 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 */ +/** + * 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.utils; import net.minecraft.item.ItemStack; diff --git a/common/buildcraft/transport/utils/WireMatrix.java b/common/buildcraft/transport/utils/WireMatrix.java index 22959b6c93..6606b465be 100644 --- a/common/buildcraft/transport/utils/WireMatrix.java +++ b/common/buildcraft/transport/utils/WireMatrix.java @@ -1,5 +1,5 @@ /** 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.utils; @@ -12,6 +12,7 @@ import io.netty.buffer.ByteBuf; +@Deprecated public class WireMatrix { // private final boolean[] _hasWire = new boolean[IPipe.WireColor.values().length]; diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a946f8c0cc..1c2911b44b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,14 @@ +<<<<<<< HEAD #Sat Jun 06 15:10:29 BST 2015 +======= +#Mon Sep 14 16:20:35 CEST 2015 +>>>>>>> origin/7.1.x distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists +<<<<<<< HEAD distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip +======= +distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-bin.zip +>>>>>>> origin/7.1.x diff --git a/guidelines/buildcraft.checkstyle b/guidelines/buildcraft.checkstyle index fd2579c1ea..ca5b2ea252 100755 --- a/guidelines/buildcraft.checkstyle +++ b/guidelines/buildcraft.checkstyle @@ -8,7 +8,7 @@ Checkstyle-Configuration: BuildCraft Description: none --> - + @@ -83,5 +83,10 @@ + + + + + diff --git a/misc/dist.sh b/misc/dist.sh deleted file mode 100755 index 327b0a5cdc..0000000000 --- a/misc/dist.sh +++ /dev/null @@ -1,30 +0,0 @@ -# This script requires a copy of pngout and kzip. -# THIS SCRIPT IS HIGHLY TEMPORARY - SHOULD BE REPLACED WITH A GRADLE VERSION - -#!/bin/sh -rm -rf dist -mkdir -p dist/tmp -mkdir -p dist/misc -mkdir -p dist/modules -cd dist -cp ../build/libs/buildcraft-$1* . -cd tmp -unzip ../../build/libs/buildcraft-$1.jar -rm ../buildcraft-$1.jar - -for i in `find -name *.png`; do ../../tools/pngout "$i"; done -../../tools/kzip -r -y ../buildcraft-$1.jar * - -../../tools/kzip -r -y ../modules/buildcraft-$1-core.jar assets/buildcraft assets/buildcraftcore buildcraft/BuildCraftCore* buildcraft/core \ - buildcraft/BuildCraftMod* buildcraft/api \ - cofh LICENSE* changelog mcmod.info versions.txt -../../tools/kzip -r -y ../modules/buildcraft-$1-builders.jar assets/buildcraftbuilders buildcraft/BuildCraftBuilders* buildcraft/builders LICENSE -../../tools/kzip -r -y ../modules/buildcraft-$1-energy.jar assets/buildcraftenergy buildcraft/BuildCraftEnergy* buildcraft/energy LICENSE -../../tools/kzip -r -y ../modules/buildcraft-$1-factory.jar assets/buildcraftfactory buildcraft/BuildCraftFactory* buildcraft/factory LICENSE -../../tools/kzip -r -y ../modules/buildcraft-$1-robotics.jar assets/buildcraftrobotics buildcraft/BuildCraftRobotics* buildcraft/robotics LICENSE -../../tools/kzip -r -y ../modules/buildcraft-$1-silicon.jar assets/buildcraftsilicon buildcraft/BuildCraftSilicon* buildcraft/silicon LICENSE -../../tools/kzip -r -y ../modules/buildcraft-$1-transport.jar assets/buildcrafttransport buildcraft/BuildCraftTransport* buildcraft/transport LICENSE - -cd .. -rm -rf tmp -cd .. diff --git a/misc/unused_textures/autoWorkbenchSide_alt.png b/misc/unused_textures/autoWorkbenchSide_alt.png new file mode 100755 index 0000000000..f02636f926 Binary files /dev/null and b/misc/unused_textures/autoWorkbenchSide_alt.png differ diff --git a/misc/unused_textures/block_0_0.png b/misc/unused_textures/block_0_0.png deleted file mode 100644 index dcaa55e850..0000000000 Binary files a/misc/unused_textures/block_0_0.png and /dev/null differ diff --git a/misc/unused_textures/block_12_13.png b/misc/unused_textures/block_12_13.png deleted file mode 100644 index 5e7071a0c9..0000000000 Binary files a/misc/unused_textures/block_12_13.png and /dev/null differ diff --git a/misc/unused_textures/block_12_14.png b/misc/unused_textures/block_12_14.png deleted file mode 100644 index 5e7071a0c9..0000000000 Binary files a/misc/unused_textures/block_12_14.png and /dev/null differ diff --git a/misc/unused_textures/block_12_15.png b/misc/unused_textures/block_12_15.png deleted file mode 100644 index 5e7071a0c9..0000000000 Binary files a/misc/unused_textures/block_12_15.png and /dev/null differ diff --git a/misc/unused_textures/block_13_14.png b/misc/unused_textures/block_13_14.png deleted file mode 100644 index 5e7071a0c9..0000000000 Binary files a/misc/unused_textures/block_13_14.png and /dev/null differ diff --git a/misc/unused_textures/block_13_15.png b/misc/unused_textures/block_13_15.png deleted file mode 100644 index 5e7071a0c9..0000000000 Binary files a/misc/unused_textures/block_13_15.png and /dev/null differ diff --git a/misc/unused_textures/block_15_0.png b/misc/unused_textures/block_15_0.png deleted file mode 100644 index f069049e16..0000000000 Binary files a/misc/unused_textures/block_15_0.png and /dev/null differ diff --git a/misc/unused_textures/block_15_1.png b/misc/unused_textures/block_15_1.png deleted file mode 100644 index 534af52e77..0000000000 Binary files a/misc/unused_textures/block_15_1.png and /dev/null differ diff --git a/misc/unused_textures/block_15_2.png b/misc/unused_textures/block_15_2.png deleted file mode 100644 index 6835c18588..0000000000 Binary files a/misc/unused_textures/block_15_2.png and /dev/null differ diff --git a/misc/unused_textures/block_15_3.png b/misc/unused_textures/block_15_3.png deleted file mode 100644 index 80419a572f..0000000000 Binary files a/misc/unused_textures/block_15_3.png and /dev/null differ diff --git a/misc/unused_textures/block_15_4.png b/misc/unused_textures/block_15_4.png deleted file mode 100644 index 35dd8052f0..0000000000 Binary files a/misc/unused_textures/block_15_4.png and /dev/null differ diff --git a/misc/unused_textures/block_15_5.png b/misc/unused_textures/block_15_5.png deleted file mode 100644 index b1d981cd20..0000000000 Binary files a/misc/unused_textures/block_15_5.png and /dev/null differ diff --git a/misc/unused_textures/block_15_6.png b/misc/unused_textures/block_15_6.png deleted file mode 100644 index cd4118c05e..0000000000 Binary files a/misc/unused_textures/block_15_6.png and /dev/null differ diff --git a/misc/unused_textures/block_15_7.png b/misc/unused_textures/block_15_7.png deleted file mode 100644 index 715faea526..0000000000 Binary files a/misc/unused_textures/block_15_7.png and /dev/null differ diff --git a/misc/unused_textures/block_15_8.png b/misc/unused_textures/block_15_8.png deleted file mode 100644 index 47fca57781..0000000000 Binary files a/misc/unused_textures/block_15_8.png and /dev/null differ diff --git a/misc/unused_textures/block_15_9.png b/misc/unused_textures/block_15_9.png deleted file mode 100644 index 9271e07aca..0000000000 Binary files a/misc/unused_textures/block_15_9.png and /dev/null differ diff --git a/misc/unused_textures/block_1_4.png b/misc/unused_textures/block_1_4.png deleted file mode 100644 index e786b70d73..0000000000 Binary files a/misc/unused_textures/block_1_4.png and /dev/null differ diff --git a/misc/unused_textures/block_5_0.png b/misc/unused_textures/block_5_0.png deleted file mode 100644 index 74cdf83011..0000000000 Binary files a/misc/unused_textures/block_5_0.png and /dev/null differ diff --git a/misc/unused_textures/block_5_1.png b/misc/unused_textures/block_5_1.png deleted file mode 100644 index a2ae29e9c0..0000000000 Binary files a/misc/unused_textures/block_5_1.png and /dev/null differ diff --git a/misc/unused_textures/block_5_10.png b/misc/unused_textures/block_5_10.png deleted file mode 100644 index bc5e901708..0000000000 Binary files a/misc/unused_textures/block_5_10.png and /dev/null differ diff --git a/misc/unused_textures/block_5_11.png b/misc/unused_textures/block_5_11.png deleted file mode 100644 index 7550a2c374..0000000000 Binary files a/misc/unused_textures/block_5_11.png and /dev/null differ diff --git a/misc/unused_textures/block_5_12.png b/misc/unused_textures/block_5_12.png deleted file mode 100644 index e70fabfdfd..0000000000 Binary files a/misc/unused_textures/block_5_12.png and /dev/null differ diff --git a/misc/unused_textures/block_5_13.png b/misc/unused_textures/block_5_13.png deleted file mode 100644 index 80ae47118d..0000000000 Binary files a/misc/unused_textures/block_5_13.png and /dev/null differ diff --git a/misc/unused_textures/block_5_14.png b/misc/unused_textures/block_5_14.png deleted file mode 100644 index 5febf6a8c5..0000000000 Binary files a/misc/unused_textures/block_5_14.png and /dev/null differ diff --git a/misc/unused_textures/block_5_15.png b/misc/unused_textures/block_5_15.png deleted file mode 100644 index 79b57a3cb0..0000000000 Binary files a/misc/unused_textures/block_5_15.png and /dev/null differ diff --git a/misc/unused_textures/block_5_2.png b/misc/unused_textures/block_5_2.png deleted file mode 100644 index c705dfe3b8..0000000000 Binary files a/misc/unused_textures/block_5_2.png and /dev/null differ diff --git a/misc/unused_textures/block_5_3.png b/misc/unused_textures/block_5_3.png deleted file mode 100644 index cd01cdc45e..0000000000 Binary files a/misc/unused_textures/block_5_3.png and /dev/null differ diff --git a/misc/unused_textures/block_5_4.png b/misc/unused_textures/block_5_4.png deleted file mode 100644 index a866be8683..0000000000 Binary files a/misc/unused_textures/block_5_4.png and /dev/null differ diff --git a/misc/unused_textures/block_5_5.png b/misc/unused_textures/block_5_5.png deleted file mode 100644 index 4f7fd4c47b..0000000000 Binary files a/misc/unused_textures/block_5_5.png and /dev/null differ diff --git a/misc/unused_textures/block_5_6.png b/misc/unused_textures/block_5_6.png deleted file mode 100644 index 0cb40ab12d..0000000000 Binary files a/misc/unused_textures/block_5_6.png and /dev/null differ diff --git a/misc/unused_textures/block_5_7.png b/misc/unused_textures/block_5_7.png deleted file mode 100644 index 3e38062b98..0000000000 Binary files a/misc/unused_textures/block_5_7.png and /dev/null differ diff --git a/misc/unused_textures/block_5_8.png b/misc/unused_textures/block_5_8.png deleted file mode 100644 index ab9b530633..0000000000 Binary files a/misc/unused_textures/block_5_8.png and /dev/null differ diff --git a/misc/unused_textures/block_5_9.png b/misc/unused_textures/block_5_9.png deleted file mode 100644 index f9a54405b1..0000000000 Binary files a/misc/unused_textures/block_5_9.png and /dev/null differ diff --git a/misc/unused_textures/block_7_11.png b/misc/unused_textures/block_7_11.png deleted file mode 100644 index de2c6a6b79..0000000000 Binary files a/misc/unused_textures/block_7_11.png and /dev/null differ diff --git a/misc/unused_textures/block_7_12.png b/misc/unused_textures/block_7_12.png deleted file mode 100644 index d3d0a98535..0000000000 Binary files a/misc/unused_textures/block_7_12.png and /dev/null differ diff --git a/misc/unused_textures/block_7_15.png b/misc/unused_textures/block_7_15.png deleted file mode 100644 index c37d3a0ded..0000000000 Binary files a/misc/unused_textures/block_7_15.png and /dev/null differ diff --git a/misc/unused_textures/block_7_5.png b/misc/unused_textures/block_7_5.png deleted file mode 100644 index 2f4c32f53b..0000000000 Binary files a/misc/unused_textures/block_7_5.png and /dev/null differ diff --git a/misc/unused_textures/block_7_7.png b/misc/unused_textures/block_7_7.png deleted file mode 100644 index 7ba4b2295d..0000000000 Binary files a/misc/unused_textures/block_7_7.png and /dev/null differ diff --git a/misc/unused_textures/block_7_9.png b/misc/unused_textures/block_7_9.png deleted file mode 100644 index b72fceda5b..0000000000 Binary files a/misc/unused_textures/block_7_9.png and /dev/null differ diff --git a/misc/unused_textures/block_8_0.png b/misc/unused_textures/block_8_0.png deleted file mode 100644 index 3db5ff4828..0000000000 Binary files a/misc/unused_textures/block_8_0.png and /dev/null differ diff --git a/misc/unused_textures/block_8_1.png b/misc/unused_textures/block_8_1.png deleted file mode 100644 index e2257f5c7f..0000000000 Binary files a/misc/unused_textures/block_8_1.png and /dev/null differ diff --git a/misc/unused_textures/block_8_2.png b/misc/unused_textures/block_8_2.png deleted file mode 100644 index 5e20912aa0..0000000000 Binary files a/misc/unused_textures/block_8_2.png and /dev/null differ diff --git a/misc/unused_textures/block_8_3.png b/misc/unused_textures/block_8_3.png deleted file mode 100644 index e1eb6e8b42..0000000000 Binary files a/misc/unused_textures/block_8_3.png and /dev/null differ diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/gui/filter_alt.png b/misc/unused_textures/filter_alt.png similarity index 100% rename from buildcraft_resources/assets/buildcrafttransport/textures/gui/filter_alt.png rename to misc/unused_textures/filter_alt.png diff --git a/buildcraft_resources/assets/buildcrafttransport/textures/gui/filter_alt2.png b/misc/unused_textures/filter_alt2.png similarity index 100% rename from buildcraft_resources/assets/buildcrafttransport/textures/gui/filter_alt2.png rename to misc/unused_textures/filter_alt2.png diff --git a/buildcraft_resources/assets/buildcraftfactory/textures/gui/hopper_gui_tier2.png b/misc/unused_textures/hopper_gui_tier2.png similarity index 100% rename from buildcraft_resources/assets/buildcraftfactory/textures/gui/hopper_gui_tier2.png rename to misc/unused_textures/hopper_gui_tier2.png diff --git a/buildcraft_resources/assets/buildcraftfactory/textures/gui/hopper_gui_tier2_alt.png b/misc/unused_textures/hopper_gui_tier2_alt.png similarity index 100% rename from buildcraft_resources/assets/buildcraftfactory/textures/gui/hopper_gui_tier2_alt.png rename to misc/unused_textures/hopper_gui_tier2_alt.png diff --git a/buildcraft_resources/assets/buildcraftfactory/textures/gui/hopper_gui_tier2_alt2.png b/misc/unused_textures/hopper_gui_tier2_alt2.png similarity index 100% rename from buildcraft_resources/assets/buildcraftfactory/textures/gui/hopper_gui_tier2_alt2.png rename to misc/unused_textures/hopper_gui_tier2_alt2.png diff --git a/misc/unused_textures/integrationtable_bottom.png b/misc/unused_textures/integrationtable_bottom.png deleted file mode 100644 index e162d02564..0000000000 Binary files a/misc/unused_textures/integrationtable_bottom.png and /dev/null differ diff --git a/misc/unused_textures/integrationtable_side.png b/misc/unused_textures/integrationtable_side.png deleted file mode 100644 index 3400a660c4..0000000000 Binary files a/misc/unused_textures/integrationtable_side.png and /dev/null differ diff --git a/misc/unused_textures/integrationtable_top.png b/misc/unused_textures/integrationtable_top.png deleted file mode 100644 index 76e478cc5d..0000000000 Binary files a/misc/unused_textures/integrationtable_top.png and /dev/null differ diff --git a/misc/unused_textures/pumpTop_alt.png b/misc/unused_textures/pumpTop_alt.png new file mode 100755 index 0000000000..3e21e55a89 Binary files /dev/null and b/misc/unused_textures/pumpTop_alt.png differ diff --git a/misc/unused_textures/pumpTop_alt2.png b/misc/unused_textures/pumpTop_alt2.png new file mode 100755 index 0000000000..41f27e23a4 Binary files /dev/null and b/misc/unused_textures/pumpTop_alt2.png differ diff --git a/buildcraft_resources/assets/buildcraftsilicon/textures/items/chipset/redstone_gold_chipset_alt.png b/misc/unused_textures/redstone_gold_chipset_alt.png similarity index 100% rename from buildcraft_resources/assets/buildcraftsilicon/textures/items/chipset/redstone_gold_chipset_alt.png rename to misc/unused_textures/redstone_gold_chipset_alt.png diff --git a/buildcraft_resources/assets/buildcraftsilicon/textures/items/chipset/redstone_gold_chipset_alt2.png b/misc/unused_textures/redstone_gold_chipset_alt2.png similarity index 100% rename from buildcraft_resources/assets/buildcraftsilicon/textures/items/chipset/redstone_gold_chipset_alt2.png rename to misc/unused_textures/redstone_gold_chipset_alt2.png diff --git a/misc/unused_textures/zoneplanner_front_on.png b/misc/unused_textures/zoneplanner_front_on.png new file mode 100755 index 0000000000..affa427430 Binary files /dev/null and b/misc/unused_textures/zoneplanner_front_on.png differ diff --git a/private.properties.example b/private.properties.example new file mode 100644 index 0000000000..8bf1c6530e --- /dev/null +++ b/private.properties.example @@ -0,0 +1,5 @@ +remotedir = /home/exemple/ +host = thehost +port = 22 +username = **** +password = ****** \ No newline at end of file diff --git a/tests/buildcraft/tests/BuildCraftTests.java b/tests/buildcraft/tests/BuildCraftTests.java index 94853e93bf..65feba8ec1 100755 --- a/tests/buildcraft/tests/BuildCraftTests.java +++ b/tests/buildcraft/tests/BuildCraftTests.java @@ -96,7 +96,7 @@ public void load(FMLInitializationEvent evt) { quitAfterRun = optionset.has(quitOption); if (testFile != null && !"".equals(testFile)) { - FMLCommonHandler.instance().bus().register(this); + MinecraftForge.EVENT_BUS.register(this); System.out.println("[TEST 0] [LOAD TEST] \"" + testFile + "\""); } }