diff --git a/api/buildcraft/api/statements/IActionExternal.java b/api/buildcraft/api/statements/IActionExternal.java index 2aeb4510..3489df02 100644 --- a/api/buildcraft/api/statements/IActionExternal.java +++ b/api/buildcraft/api/statements/IActionExternal.java @@ -13,7 +13,5 @@ import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; public interface IActionExternal extends IStatement { - void actionActivate(TileEntity target, ForgeDirection side, IStatementContainer source, IStatementParameter[] parameters); - } diff --git a/buildcraft_resources/LICENSE.DEJAVU b/buildcraft_resources/LICENSE.DEJAVU new file mode 100644 index 00000000..929ed336 --- /dev/null +++ b/buildcraft_resources/LICENSE.DEJAVU @@ -0,0 +1,54 @@ +Fonts are © Bitstream (see below). DejaVu changes are in public domain. Explanation of copyright is on Gnome page on Bitstream Vera fonts. Glyphs imported from Arev fonts are © Tavmjung Bah (see +below) + +Bitstream Vera Fonts Copyright +--- + +Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is a trademark of Bitstream, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy of the fonts accompanying this license ("Fonts") and associated documentation files (the "Font Software"), to reproduce and +distribute the Font Software, including without limitation the rights to use, copy, merge, publish, distribute, and/or sell copies of the Font Software, and to permit persons to whom the Font Software +is furnished to do so, subject to the following conditions: + +The above copyright and trademark notices and this permission notice shall be included in all copies of one or more of the Font Software typefaces. + +The Font Software may be modified, altered, or added to, and in particular the designs of glyphs or characters in the Fonts may be modified and additional glyphs or characters may be added to the +Fonts, only if the fonts are renamed to names not containing either the words "Bitstream" or the word "Vera". + +This License becomes null and void to the extent applicable to Fonts or Font Software that has been modified and is distributed under the "Bitstream Vera" names. + +The Font Software may be sold as part of a larger software package but no copy of one or more of the Font Software typefaces may be sold by itself. + +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, +SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS +IN THE FONT SOFTWARE. + +Except as contained in this notice, the names of Gnome, the Gnome Foundation, and Bitstream Inc., shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Font +Software without prior written authorization from the Gnome Foundation or Bitstream Inc., respectively. For further information, contact: fonts at gnome dot org. + +Arev Fonts Copyright +--- + +Copyright (c) 2006 by Tavmjong Bah. All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy of the fonts accompanying this license ("Fonts") and associated documentation files (the "Font Software"), to reproduce and +distribute the modifications to the Bitstream Vera Font Software, including without limitation the rights to use, copy, merge, publish, distribute, and/or sell copies of the Font Software, and to +permit persons to whom the Font Software is furnished to do so, subject to the following conditions: + +The above copyright and trademark notices and this permission notice shall be included in all copies of one or more of the Font Software typefaces. + +The Font Software may be modified, altered, or added to, and in particular the designs of glyphs or characters in the Fonts may be modified and additional glyphs or characters may be added to the +Fonts, only if the fonts are renamed to names not containing either the words "Tavmjong Bah" or the word "Arev". + +This License becomes null and void to the extent applicable to Fonts or Font Software that has been modified and is distributed under the "Tavmjong Bah Arev" names. + +The Font Software may be sold as part of a larger software package but no copy of one or more of the Font Software typefaces may be sold by itself. + +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL TAVMJONG BAH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, +INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT +SOFTWARE. + +Except as contained in this notice, the name of Tavmjong Bah shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Font Software without prior written +authorization from Tavmjong Bah. For further information, contact: tavmjong @ free . fr. diff --git a/buildcraft_resources/assets/buildcraftcore/tablet/11.pf2 b/buildcraft_resources/assets/buildcraftcore/tablet/11.pf2 new file mode 100644 index 00000000..8333e384 Binary files /dev/null and b/buildcraft_resources/assets/buildcraftcore/tablet/11.pf2 differ diff --git a/buildcraft_resources/assets/buildcraftcore/tablet/13.pf2 b/buildcraft_resources/assets/buildcraftcore/tablet/13.pf2 new file mode 100644 index 00000000..b039354d Binary files /dev/null and b/buildcraft_resources/assets/buildcraftcore/tablet/13.pf2 differ diff --git a/buildcraft_resources/assets/buildcraftcore/tablet/16.pf2 b/buildcraft_resources/assets/buildcraftcore/tablet/16.pf2 new file mode 100644 index 00000000..2b911164 Binary files /dev/null and b/buildcraft_resources/assets/buildcraftcore/tablet/16.pf2 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 4146b79b..f5270366 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/changelog/6.4.10 b/buildcraft_resources/changelog/6.4.10 new file mode 100644 index 00000000..c807dcd8 --- /dev/null +++ b/buildcraft_resources/changelog/6.4.10 @@ -0,0 +1,2 @@ +Bugs fixed: +Further 1355+ fluid fixes (asie) diff --git a/buildcraft_resources/versions.txt b/buildcraft_resources/versions.txt index 636d8299..69b9fe6e 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.9 +1.7.10:BuildCraft:6.4.10 diff --git a/common/buildcraft/core/ZoneChunk.java b/common/buildcraft/core/ZoneChunk.java index e5d70544..dbdf3bd5 100755 --- a/common/buildcraft/core/ZoneChunk.java +++ b/common/buildcraft/core/ZoneChunk.java @@ -111,20 +111,19 @@ public class ZoneChunk implements ISerializable { @Override public void readData(ByteBuf stream) { - if (stream.readBoolean()) { + int flags = stream.readUnsignedByte(); + if ((flags & 1) != 0) { property = BitSetUtils.fromByteArray(NetworkUtils.readByteArray(stream)); } - fullSet = stream.readBoolean(); + fullSet = (flags & 2) != 0; } @Override public void writeData(ByteBuf stream) { + int flags = (fullSet ? 2 : 0) | (property != null ? 1 : 0); + stream.writeByte(flags); if (property != null) { - stream.writeBoolean(true); NetworkUtils.writeByteArray(stream, BitSetUtils.toByteArray(property)); - } else { - stream.writeBoolean(false); } - stream.writeBoolean(fullSet); } } diff --git a/common/buildcraft/core/lib/fluids/TankManager.java b/common/buildcraft/core/lib/fluids/TankManager.java index 21c912aa..47cf1ae7 100644 --- a/common/buildcraft/core/lib/fluids/TankManager.java +++ b/common/buildcraft/core/lib/fluids/TankManager.java @@ -18,6 +18,7 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTankInfo; import net.minecraftforge.fluids.IFluidHandler; @@ -125,8 +126,8 @@ public class TankManager extends ForwardingList implements IF public void readData(ByteBuf data) { for (Tank tank : tanks) { int fluidId = data.readShort(); - if (fluidId > 0) { - tank.setFluid(new FluidStack(fluidId, data.readInt())); + if (FluidRegistry.getFluid(fluidId) != null) { + tank.setFluid(new FluidStack(FluidRegistry.getFluid(fluidId), data.readInt())); tank.colorRenderCache = data.readInt(); } else { tank.setFluid(null); diff --git a/common/buildcraft/core/recipes/FlexibleRecipe.java b/common/buildcraft/core/recipes/FlexibleRecipe.java index 3ddc101b..5b6b9768 100644 --- a/common/buildcraft/core/recipes/FlexibleRecipe.java +++ b/common/buildcraft/core/recipes/FlexibleRecipe.java @@ -204,7 +204,7 @@ public class FlexibleRecipe implements IFlexibleRecipe, IFlexibleRecipeVie amount -= fluid.amount; } - result.usedFluids.add(new FluidStack(requirement.fluidID, amountUsed)); + result.usedFluids.add(new FluidStack(requirement.getFluid(), amountUsed)); } if (amount == 0) { diff --git a/common/buildcraft/core/tablet/TabletProgramMenu.java b/common/buildcraft/core/tablet/TabletProgramMenu.java index 465f3b4d..943212ae 100644 --- a/common/buildcraft/core/tablet/TabletProgramMenu.java +++ b/common/buildcraft/core/tablet/TabletProgramMenu.java @@ -6,8 +6,10 @@ import cpw.mods.fml.relauncher.Side; import buildcraft.api.tablet.ITablet; import buildcraft.api.tablet.TabletBitmap; import buildcraft.api.tablet.TabletProgram; +import buildcraft.core.tablet.utils.TabletDrawUtils; import buildcraft.core.tablet.utils.TabletFont; import buildcraft.core.tablet.utils.TabletFontManager; +import buildcraft.core.tablet.utils.TabletTextUtils; public class TabletProgramMenu extends TabletProgram { private final ITablet tablet; @@ -18,41 +20,20 @@ public class TabletProgramMenu extends TabletProgram { this.tablet = tablet; } - public String[] split(String text, TabletFont font, int width) { - List lines = new ArrayList(); - - int x = 0; - String line = ""; - boolean first = true; - - for (String s : text.split(" ")) { - String ts = first ? s : " " + s; - int w = font.getStringWidth(ts); - if (x + w > width) { - x = 0; - ts = s; - lines.add(line); - line = ""; - } - x += w; - line += ts; - first = false; - } - if (line.length() > 0) { - lines.add(line); - } - return lines.toArray(new String[lines.size()]); - } - public void tick(float time) { t+=time; if (!init && t > 2 && tablet.getSide() == Side.CLIENT) { TabletBitmap bitmap = new TabletBitmap(244, 306); try { TabletFont font = TabletFontManager.INSTANCE.register("DejaVu11", TabletProgramMenu.class.getClassLoader().getResourceAsStream("assets/buildcraftcore/tablet/11.pf2")); - String lorem = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque condimentum, nulla in tincidunt finibus, dolor enim condimentum felis, vitae vulputate lorem turpis nec purus. Nulla iaculis sed turpis in lacinia. Aliquam consectetur leo sit amet placerat blandit. Maecenas euismod magna eros, quis efficitur quam luctus mollis. Nulla facilisi. Quisque tempor turpis ipsum, ut auctor diam hendrerit dictum. Phasellus id viverra purus. Ut sagittis felis eu odio sagittis, vitae mollis felis feugiat. Morbi mi elit, varius id fringilla vel, vehicula ac risus. Curabitur aliquam orci at mollis posuere. Nam vitae neque tincidunt orci rhoncus rutrum."; - int y = 0; - String[] lines = split(lorem, font, 244); + String lorem = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque condimentum, nulla in tincidunt finibus, dolor enim condimentum felis, vitae vulputate lorem turpis nec purus. Nulla iaculis sed turpis in lacinia. Aliquam consectetur leo sit amet placerat blandit. Maecenas euismod magna eros, quis efficitur quam luctus mollis. Nulla facilisi. Quisque tempor turpis ipsum, ut auctor diam hendrerit dictum. Phasellus id viverra purus. Ut sagittis felis eu odio sagittis, vitae mollis felis feugiat. Morbi mi elit, varius id fringilla vel, vehicula ac risus. Curabitur aliquam orci at mollis posuere."; + TabletDrawUtils.drawRect(bitmap, 4, 4, 236, 280, 7); + int hxo = (244 - font.getStringWidth("Page 1")) / 2; + font.draw(bitmap, "Page 2/4", hxo, 287, 5); + int XO = 8; + int y = 8; + int W = 228; + String[] lines = TabletTextUtils.split(lorem, font, W, false); for (int i = 0; i < lines.length; i++) { String line = lines[i]; String[] words = line.split(" "); @@ -62,9 +43,9 @@ public class TabletProgramMenu extends TabletProgram { for (String s : words) { widthNoSpaces += font.getStringWidth(s); } - justifyValue = (244 - widthNoSpaces) / (float) (words.length - 1); + justifyValue = (W - widthNoSpaces) / (float) (words.length - 1); } - float x = 0; + float x = XO; for (String s: words) { x += font.draw(bitmap, s, (int) x, y, 7); x += justifyValue; diff --git a/common/buildcraft/core/tablet/utils/TabletDrawUtils.java b/common/buildcraft/core/tablet/utils/TabletDrawUtils.java new file mode 100644 index 00000000..aae16826 --- /dev/null +++ b/common/buildcraft/core/tablet/utils/TabletDrawUtils.java @@ -0,0 +1,30 @@ +package buildcraft.core.tablet.utils; + +import buildcraft.api.tablet.TabletBitmap; + +public class TabletDrawUtils { + private TabletDrawUtils() { + + } + + public static void drawRect(TabletBitmap bitmap, int x, int y, int w, int h, int shade) { + int x2 = x + w - 1; + int y2 = y + h - 1; + for (int i = 0; i < w; i++) { + bitmap.set(x + i, y, shade); + bitmap.set(x + i, y2, shade); + } + for (int i = 1; i < (h - 1); i++) { + bitmap.set(x, y + i, shade); + bitmap.set(x2, y + i, shade); + } + } + + public static void drawFilledRect(TabletBitmap bitmap, int x, int y, int w, int h, int shade) { + for (int j = 0; j < h; j++) { + for (int i = 0; i < w; i++) { + bitmap.set(x + i, y + j, bitmap); + } + } + } +} diff --git a/common/buildcraft/core/tablet/utils/TabletTextUtils.java b/common/buildcraft/core/tablet/utils/TabletTextUtils.java new file mode 100644 index 00000000..7bb02136 --- /dev/null +++ b/common/buildcraft/core/tablet/utils/TabletTextUtils.java @@ -0,0 +1,38 @@ +package buildcraft.core.tablet.utils; + +import java.util.ArrayList; +import java.util.List; + +public class TabletTextUtils { + private TabletTextUtils() { + + } + + public static String[] split(String text, TabletFont font, int width, boolean justify) { + List lines = new ArrayList(); + + int x = 0; + String line = ""; + boolean first = true; + + for (String s : text.split(" ")) { + String ts = first ? s : " " + s; + int w = font.getStringWidth(ts); + if (x + w > width) { + x = 0; + ts = s; + lines.add(line); + line = ""; + } + x += w; + line += ts; + first = false; + } + if (line.length() > 0) { + lines.add(line); + } + return lines.toArray(new String[lines.size()]); + } + + +} diff --git a/common/buildcraft/energy/TileEngineIron.java b/common/buildcraft/energy/TileEngineIron.java index d1fca7a8..a4c73c60 100644 --- a/common/buildcraft/energy/TileEngineIron.java +++ b/common/buildcraft/energy/TileEngineIron.java @@ -17,6 +17,7 @@ import net.minecraft.world.biome.BiomeGenBase; import net.minecraftforge.common.util.ForgeDirection; 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; @@ -46,6 +47,8 @@ public class TileEngineIron extends TileEngineWithInventory implements IFluidHan private int burnTime = 0; private float coolingBuffer = 0.0f; + private int tankFuelAmountCache = 0; + private int tankCoolantAmountCache = 0; private TankManager tankManager = new TankManager(); private IFuel currentFuel; @@ -295,33 +298,31 @@ public class TileEngineIron extends TileEngineWithInventory implements IFluidHan switch (id) { // Fluid Fuel ID case 15: - if (tankFuel.getFluid() == null) { - tankFuel.setFluid(new FluidStack(value, 0)); + if (FluidRegistry.getFluid(value) != null) { + tankFuel.setFluid(new FluidStack(value, tankFuelAmountCache)); } else { - tankFuel.getFluid().fluidID = value; + tankFuel.setFluid(null); } break; // Fluid Coolant ID case 16: - if (tankCoolant.getFluid() == null) { - tankCoolant.setFluid(new FluidStack(value, 0)); + if (FluidRegistry.getFluid(value) != null) { + tankCoolant.setFluid(new FluidStack(value, tankCoolantAmountCache)); } else { - tankCoolant.getFluid().fluidID = value; + tankCoolant.setFluid(null); } break; // Fluid Fuel amount case 17: - if (tankFuel.getFluid() == null) { - tankFuel.setFluid(new FluidStack(0, value)); - } else { + tankFuelAmountCache = value; + if (tankFuel.getFluid() != null) { tankFuel.getFluid().amount = value; } break; // Fluid Coolant amount case 18: - if (tankCoolant.getFluid() == null) { - tankCoolant.setFluid(new FluidStack(0, value)); - } else { + tankCoolantAmountCache = value; + if (tankCoolant.getFluid() != null) { tankCoolant.getFluid().amount = value; } break; @@ -339,8 +340,8 @@ public class TileEngineIron extends TileEngineWithInventory implements IFluidHan @Override public void sendGUINetworkData(Container containerEngine, ICrafting iCrafting) { super.sendGUINetworkData(containerEngine, iCrafting); - iCrafting.sendProgressBarUpdate(containerEngine, 15, tankFuel.getFluid() != null ? tankFuel.getFluid().fluidID : 0); - iCrafting.sendProgressBarUpdate(containerEngine, 16, tankCoolant.getFluid() != null ? tankCoolant.getFluid().fluidID : 0); + iCrafting.sendProgressBarUpdate(containerEngine, 15, tankFuel.getFluid() != null && tankFuel.getFluid().getFluid() != null ? tankFuel.getFluid().getFluid().getID() : 0); + iCrafting.sendProgressBarUpdate(containerEngine, 16, tankCoolant.getFluid() != null && tankFuel.getFluid().getFluid() != null ? tankCoolant.getFluid().getFluid().getID() : 0); iCrafting.sendProgressBarUpdate(containerEngine, 17, tankFuel.getFluid() != null ? tankFuel.getFluid().amount : 0); iCrafting.sendProgressBarUpdate(containerEngine, 18, tankCoolant.getFluid() != null ? tankCoolant.getFluid().amount : 0); iCrafting.sendProgressBarUpdate(containerEngine, 19, tankFuel.colorRenderCache); diff --git a/common/buildcraft/energy/fuels/CoolantManager.java b/common/buildcraft/energy/fuels/CoolantManager.java index abafe695..1d481b33 100644 --- a/common/buildcraft/energy/fuels/CoolantManager.java +++ b/common/buildcraft/energy/fuels/CoolantManager.java @@ -120,7 +120,7 @@ public final class CoolantManager implements ICoolantManager { return null; } int liquidAmount = (int) (stack.stackSize * liquid.fluidStack.amount * multiplier / solid.stack.stackSize); - return new FluidStack(liquid.fluidStack.fluidID, liquidAmount); + return new FluidStack(liquid.fluidStack.getFluid(), liquidAmount); } } } diff --git a/common/buildcraft/robotics/EntityRobot.java b/common/buildcraft/robotics/EntityRobot.java index cf0d1241..f122119f 100644 --- a/common/buildcraft/robotics/EntityRobot.java +++ b/common/buildcraft/robotics/EntityRobot.java @@ -1121,7 +1121,7 @@ public class EntityRobot extends EntityRobotBase implements @Override public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) { - if (tank != null && tank.fluidID == resource.fluidID) { + if (tank != null && tank.isFluidEqual(resource)) { return drain(from, resource.amount, doDrain); } else { return null; @@ -1161,14 +1161,14 @@ public class EntityRobot extends EntityRobotBase implements return tank == null || tank.amount == 0 || (tank.amount < maxFluid - && tank.fluidID == fluid.getID()); + && tank.getFluid().getID() == fluid.getID()); } @Override public boolean canDrain(ForgeDirection from, Fluid fluid) { return tank != null && tank.amount != 0 - && tank.fluidID == fluid.getID(); + && tank.getFluid().getID() == fluid.getID(); } @Override diff --git a/common/buildcraft/robotics/TileZonePlan.java b/common/buildcraft/robotics/TileZonePlan.java index 1f076ad9..05e35751 100644 --- a/common/buildcraft/robotics/TileZonePlan.java +++ b/common/buildcraft/robotics/TileZonePlan.java @@ -8,17 +8,26 @@ */ package buildcraft.robotics; +import java.util.List; import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.server.MinecraftServer; +import buildcraft.BuildCraftCore; +import buildcraft.api.core.IZone; +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.Packet; +import buildcraft.core.lib.network.command.CommandWriter; +import buildcraft.core.lib.network.command.PacketCommand; import buildcraft.core.lib.utils.NetworkUtils; +import buildcraft.robotics.gui.ContainerZonePlan; public class TileZonePlan extends TileBuildCraft implements IInventory { @@ -35,7 +44,7 @@ public class TileZonePlan extends TileBuildCraft implements IInventory { private ZonePlan[] selectedAreas = new ZonePlan[16]; private int currentSelectedArea = 0; - private SimpleInventory inv = new SimpleInventory(2, "inv", 64); + private SimpleInventory inv = new SimpleInventory(3, "inv", 64); @Override public void initialize() { @@ -132,6 +141,28 @@ public class TileZonePlan extends TileBuildCraft implements IInventory { mapName = NetworkUtils.readUTF(stream); } + private void importMap(ItemStack stack) { + if (stack.getItem() instanceof IMapLocation) { + final IZone zone = ((IMapLocation) stack.getItem()).getZone(stack); + if (zone != null && zone instanceof ZonePlan) { + selectedAreas[currentSelectedArea] = (ZonePlan) zone; + + for (EntityPlayer e : (List) MinecraftServer.getServer().getConfigurationManager().playerEntityList) { + if (e.openContainer != null && e.openContainer instanceof ContainerZonePlan + && ((ContainerZonePlan) e.openContainer).getTile() == this) { + Packet p = new PacketCommand(e.openContainer, "areaLoaded", new CommandWriter() { + public void write(ByteBuf data) { + ((ZonePlan) zone).writeData(data); + } + }); + + BuildCraftCore.instance.sendToPlayer(e, p); + } + } + } + } + } + public ZonePlan selectArea(int index) { if (selectedAreas[index] == null) { selectedAreas[index] = new ZonePlan(); @@ -170,6 +201,9 @@ public class TileZonePlan extends TileBuildCraft implements IInventory { public void setInventorySlotContents(int slotId, ItemStack itemstack) { inv.setInventorySlotContents(slotId, itemstack); + if (!worldObj.isRemote && slotId == 2) { + importMap(itemstack); + } } @Override diff --git a/common/buildcraft/robotics/gui/ContainerZonePlan.java b/common/buildcraft/robotics/gui/ContainerZonePlan.java index 5ea3ba90..4cedd9b2 100755 --- a/common/buildcraft/robotics/gui/ContainerZonePlan.java +++ b/common/buildcraft/robotics/gui/ContainerZonePlan.java @@ -41,6 +41,7 @@ public class ContainerZonePlan extends BuildCraftContainer implements ICommandRe addSlotToContainer(new Slot(iZonePlan, 0, 233, 9)); addSlotToContainer(new SlotOutput(iZonePlan, 1, 233, 57)); + addSlotToContainer(new Slot(iZonePlan, 2, 8, 125)); // Player inventory for (int l = 0; l < 3; l++) { @@ -54,6 +55,10 @@ public class ContainerZonePlan extends BuildCraftContainer implements ICommandRe } } + public TileZonePlan getTile() { + return map; + } + @Override public boolean canInteractWith(EntityPlayer player) { return true; diff --git a/common/buildcraft/robotics/gui/GuiZonePlan.java b/common/buildcraft/robotics/gui/GuiZonePlan.java index 8596feee..f3dec1a1 100755 --- a/common/buildcraft/robotics/gui/GuiZonePlan.java +++ b/common/buildcraft/robotics/gui/GuiZonePlan.java @@ -26,6 +26,7 @@ import buildcraft.core.ZonePlan; import buildcraft.core.lib.gui.AdvancedSlot; import buildcraft.core.lib.gui.GuiAdvancedInterface; import buildcraft.core.lib.gui.buttons.GuiBetterButton; +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; @@ -135,7 +136,7 @@ public class GuiZonePlan extends GuiAdvancedInterface { public void initGui() { super.initGui(); - tool = new GuiBetterButton(0, guiLeft + 5, guiTop + 20, 20, "+"); + tool = new GuiBetterButton(0, guiLeft + 27, guiTop + 111, 15, StandardButtonTextureSets.SMALL_BUTTON, "+"); tool.setToolTip(new ToolTip(new ToolTipLine(StringUtils.localize("tip.tool.add")))); buttonList.add(tool); @@ -208,7 +209,7 @@ public class GuiZonePlan extends GuiAdvancedInterface { GL11.glEnable(GL11.GL_ALPHA_TEST); drawTexturedModalRect(guiLeft + colorSelected.x, guiTop + colorSelected.y, 0, 228, 16, 16); - drawTexturedModalRect(guiLeft + 236, guiTop + 38, 16, 228, 8, + drawTexturedModalRect(guiLeft + 236, guiTop + 27, 16, 228, 8, (int) ((zonePlan.progress / (float) TileZonePlan.CRAFT_TIME) * 27)); } }