Merge branch 'emzuli'
This commit is contained in:
commit
5c10517acb
45 changed files with 876 additions and 356 deletions
Binary file not shown.
After Width: | Height: | Size: 297 B |
Binary file not shown.
Before Width: | Height: | Size: 325 B |
Binary file not shown.
After Width: | Height: | Size: 244 B |
Binary file not shown.
After Width: | Height: | Size: 235 B |
Binary file not shown.
Before Width: | Height: | Size: 215 B |
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
|
@ -2,6 +2,23 @@
|
||||||
|
|
||||||
chat.pipe.power.iron.mode=Switched to %d MJ/t limit
|
chat.pipe.power.iron.mode=Switched to %d MJ/t limit
|
||||||
|
|
||||||
|
color.black=Black
|
||||||
|
color.blue=Blue
|
||||||
|
color.brown=Brown
|
||||||
|
color.cyan=Cyan
|
||||||
|
color.gray=Gray
|
||||||
|
color.green=Green
|
||||||
|
color.light.blue=Light Blue
|
||||||
|
color.light.gray=Light Gray
|
||||||
|
color.lime=Lime
|
||||||
|
color.magenta=Magenta
|
||||||
|
color.orange=Orange
|
||||||
|
color.pink=Pink
|
||||||
|
color.purple=Purple
|
||||||
|
color.red=Red
|
||||||
|
color.white=White
|
||||||
|
color.yellow=Yellow
|
||||||
|
|
||||||
fillerpattern.clear=Clear
|
fillerpattern.clear=Clear
|
||||||
fillerpattern.fill=Fill
|
fillerpattern.fill=Fill
|
||||||
fillerpattern.flatten=Flatten
|
fillerpattern.flatten=Flatten
|
||||||
|
@ -23,6 +40,8 @@ gate.engine.blue=Engine Blue
|
||||||
gate.engine.green=Engine Green
|
gate.engine.green=Engine Green
|
||||||
gate.engine.yellow=Engine Yellow
|
gate.engine.yellow=Engine Yellow
|
||||||
gate.engine.red=Engine Red
|
gate.engine.red=Engine Red
|
||||||
|
gate.pipe.item.color=Paint Items %s
|
||||||
|
|
||||||
gui.building.resources=Building Resources
|
gui.building.resources=Building Resources
|
||||||
gui.del=Del
|
gui.del=Del
|
||||||
gui.filling.resources=Filling Resources
|
gui.filling.resources=Filling Resources
|
||||||
|
@ -41,7 +60,10 @@ gui.pipes.emerald.blocking=Blocking
|
||||||
gui.pipes.emerald.blocking.tip=Extraction is blocked if one element in filter is missing
|
gui.pipes.emerald.blocking.tip=Extraction is blocked if one element in filter is missing
|
||||||
gui.pipes.emerald.nonblocking=Non Blocking
|
gui.pipes.emerald.nonblocking=Non Blocking
|
||||||
gui.pipes.emerald.nonblocking.tip=Extraction continues with the next element in filter if one element is missing
|
gui.pipes.emerald.nonblocking.tip=Extraction continues with the next element in filter if one element is missing
|
||||||
gui.pipes.logemerald.title=Extraction presets
|
gui.pipes.emzuli.title=Extraction Presets
|
||||||
|
gui.pipes.emzuli.paint=Paint Items %s
|
||||||
|
gui.pipes.emzuli.nopaint=Don't Paint Items
|
||||||
|
|
||||||
item.bucketFuel=Fuel Bucket
|
item.bucketFuel=Fuel Bucket
|
||||||
item.bucketOil=Oil Bucket
|
item.bucketOil=Oil Bucket
|
||||||
item.woodenGearItem=Wood Gear
|
item.woodenGearItem=Wood Gear
|
||||||
|
@ -85,9 +107,9 @@ item.PipeItemsGold=Golden Transport Pipe
|
||||||
item.PipeItemsDiamond=Diamond Transport Pipe
|
item.PipeItemsDiamond=Diamond Transport Pipe
|
||||||
item.PipeItemsObsidian=Obsidian Transport Pipe
|
item.PipeItemsObsidian=Obsidian Transport Pipe
|
||||||
item.PipeItemsEmerald=Emerald Transport Pipe
|
item.PipeItemsEmerald=Emerald Transport Pipe
|
||||||
item.PipeItemsLapis=Lapis Transport Pipe
|
item.PipeItemsLapis=Lazuli Transport Pipe
|
||||||
item.PipeItemsDaizuli=Daizuli Transport Pipe
|
item.PipeItemsDaizuli=Daizuli Transport Pipe
|
||||||
item.PipeItemsLogemerald=Logemerald Transport Pipe
|
item.PipeItemsEmzuli=Emzuli Transport Pipe
|
||||||
item.PipeFluidsWood=Wooden Fluid Pipe
|
item.PipeFluidsWood=Wooden Fluid Pipe
|
||||||
item.PipeFluidsCobblestone=Cobblestone Fluid Pipe
|
item.PipeFluidsCobblestone=Cobblestone Fluid Pipe
|
||||||
item.PipeFluidsStone=Stone Fluid Pipe
|
item.PipeFluidsStone=Stone Fluid Pipe
|
||||||
|
@ -162,7 +184,7 @@ tip.PipeItemsSandstone=Only connects to other pipes
|
||||||
tip.PipeItemsStone=Basic pipe, medium drag\nWon't connect to Cobblestone or Quartz
|
tip.PipeItemsStone=Basic pipe, medium drag\nWon't connect to Cobblestone or Quartz
|
||||||
tip.PipeItemsVoid=Destroys items
|
tip.PipeItemsVoid=Destroys items
|
||||||
tip.PipeItemsWood=Extraction pipe
|
tip.PipeItemsWood=Extraction pipe
|
||||||
tip.PipeItemsLogemerald=Action controlled extraction pipe
|
tip.PipeItemsEmzuli=Gate controlled extraction pipe
|
||||||
tip.PipePowerWood=Power Input Pipe
|
tip.PipePowerWood=Power Input Pipe
|
||||||
tip.PipePowerIron=Selectable Limiter Pipe
|
tip.PipePowerIron=Selectable Limiter Pipe
|
||||||
tip.PipeStructureCobblestone=Support pipe
|
tip.PipeStructureCobblestone=Support pipe
|
||||||
|
|
|
@ -54,7 +54,7 @@ import buildcraft.transport.pipes.PipeItemsDiamond;
|
||||||
import buildcraft.transport.pipes.PipeItemsEmerald;
|
import buildcraft.transport.pipes.PipeItemsEmerald;
|
||||||
import buildcraft.transport.pipes.PipeItemsGold;
|
import buildcraft.transport.pipes.PipeItemsGold;
|
||||||
import buildcraft.transport.pipes.PipeItemsIron;
|
import buildcraft.transport.pipes.PipeItemsIron;
|
||||||
import buildcraft.transport.pipes.PipeItemsLogemerald;
|
import buildcraft.transport.pipes.PipeItemsEmzuli;
|
||||||
import buildcraft.transport.pipes.PipeItemsLapis;
|
import buildcraft.transport.pipes.PipeItemsLapis;
|
||||||
import buildcraft.transport.pipes.PipeItemsObsidian;
|
import buildcraft.transport.pipes.PipeItemsObsidian;
|
||||||
import buildcraft.transport.pipes.PipeItemsQuartz;
|
import buildcraft.transport.pipes.PipeItemsQuartz;
|
||||||
|
@ -128,7 +128,7 @@ public class BuildCraftTransport {
|
||||||
public static Item pipeItemsDaizuli;
|
public static Item pipeItemsDaizuli;
|
||||||
public static Item pipeItemsVoid;
|
public static Item pipeItemsVoid;
|
||||||
public static Item pipeItemsSandstone;
|
public static Item pipeItemsSandstone;
|
||||||
public static Item pipeItemsLogemerald;
|
public static Item pipeItemsEmzuli;
|
||||||
public static Item pipeFluidsWood;
|
public static Item pipeFluidsWood;
|
||||||
public static Item pipeFluidsCobblestone;
|
public static Item pipeFluidsCobblestone;
|
||||||
public static Item pipeFluidsStone;
|
public static Item pipeFluidsStone;
|
||||||
|
@ -292,7 +292,7 @@ public class BuildCraftTransport {
|
||||||
pipeItemsDaizuli = buildPipe(DefaultProps.PIPE_ITEMS_DAIZULI_ID, PipeItemsDaizuli.class, "Daizuli Transport Pipe", Block.blockLapis, Block.glass, Item.diamond);
|
pipeItemsDaizuli = buildPipe(DefaultProps.PIPE_ITEMS_DAIZULI_ID, PipeItemsDaizuli.class, "Daizuli Transport Pipe", Block.blockLapis, Block.glass, Item.diamond);
|
||||||
pipeItemsSandstone = buildPipe(DefaultProps.PIPE_ITEMS_SANDSTONE_ID, PipeItemsSandstone.class, "Sandstone Transport Pipe", Block.sandStone, Block.glass, Block.sandStone);
|
pipeItemsSandstone = buildPipe(DefaultProps.PIPE_ITEMS_SANDSTONE_ID, PipeItemsSandstone.class, "Sandstone Transport Pipe", Block.sandStone, Block.glass, Block.sandStone);
|
||||||
pipeItemsVoid = buildPipe(DefaultProps.PIPE_ITEMS_VOID_ID, PipeItemsVoid.class, "Void Transport Pipe", "dyeBlack", Block.glass, Item.redstone);
|
pipeItemsVoid = buildPipe(DefaultProps.PIPE_ITEMS_VOID_ID, PipeItemsVoid.class, "Void Transport Pipe", "dyeBlack", Block.glass, Item.redstone);
|
||||||
pipeItemsLogemerald = buildPipe(DefaultProps.PIPE_ITEMS_LOGEMERALD_ID, PipeItemsLogemerald.class, "Logemerald Transport Pipe", "logWood", Block.glass, Item.emerald);
|
pipeItemsEmzuli = buildPipe(DefaultProps.PIPE_ITEMS_EMZULI_ID, PipeItemsEmzuli.class, "Emzuli Transport Pipe", Block.blockLapis, Block.glass, Item.emerald);
|
||||||
|
|
||||||
pipeFluidsWood = buildPipe(DefaultProps.PIPE_LIQUIDS_WOOD_ID, PipeFluidsWood.class, "Wooden Waterproof Pipe", pipeWaterproof, pipeItemsWood);
|
pipeFluidsWood = buildPipe(DefaultProps.PIPE_LIQUIDS_WOOD_ID, PipeFluidsWood.class, "Wooden Waterproof Pipe", pipeWaterproof, pipeItemsWood);
|
||||||
pipeFluidsCobblestone = buildPipe(DefaultProps.PIPE_LIQUIDS_COBBLESTONE_ID, PipeFluidsCobblestone.class, "Cobblestone Waterproof Pipe", pipeWaterproof, pipeItemsCobblestone);
|
pipeFluidsCobblestone = buildPipe(DefaultProps.PIPE_LIQUIDS_COBBLESTONE_ID, PipeFluidsCobblestone.class, "Cobblestone Waterproof Pipe", pipeWaterproof, pipeItemsCobblestone);
|
||||||
|
|
|
@ -29,7 +29,7 @@ public final class IronEngineCoolant {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Coolant getCoolant(FluidStack fluidStack) {
|
public static Coolant getCoolant(FluidStack fluidStack) {
|
||||||
return fluidStack != null ? liquidCoolants.get(fluidStack.getFluid().getName()) : null;
|
return fluidStack != null && fluidStack.getFluid() != null ? liquidCoolants.get(fluidStack.getFluid().getName()) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IronEngineCoolant() {
|
private IronEngineCoolant() {
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class DefaultProps {
|
||||||
public static int PIPE_ITEMS_QUARTZ_ID = 19168;
|
public static int PIPE_ITEMS_QUARTZ_ID = 19168;
|
||||||
public static int PIPE_ITEMS_LAPIS_ID = 19169;
|
public static int PIPE_ITEMS_LAPIS_ID = 19169;
|
||||||
public static int PIPE_ITEMS_DAIZULI_ID = 19170;
|
public static int PIPE_ITEMS_DAIZULI_ID = 19170;
|
||||||
public static int PIPE_ITEMS_LOGEMERALD_ID = 19171;
|
public static int PIPE_ITEMS_EMZULI_ID = 19171;
|
||||||
|
|
||||||
public static int PIPE_LIQUIDS_WOOD_ID = 19180;
|
public static int PIPE_LIQUIDS_WOOD_ID = 19180;
|
||||||
public static int PIPE_LIQUIDS_COBBLESTONE_ID = 19181;
|
public static int PIPE_LIQUIDS_COBBLESTONE_ID = 19181;
|
||||||
|
|
|
@ -11,6 +11,11 @@ import buildcraft.core.gui.slots.IPhantomSlot;
|
||||||
import buildcraft.core.gui.slots.SlotBase;
|
import buildcraft.core.gui.slots.SlotBase;
|
||||||
import buildcraft.core.gui.widgets.Widget;
|
import buildcraft.core.gui.widgets.Widget;
|
||||||
import buildcraft.core.inventory.StackHelper;
|
import buildcraft.core.inventory.StackHelper;
|
||||||
|
import buildcraft.core.network.PacketGuiWidget;
|
||||||
|
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||||
|
import cpw.mods.fml.common.network.Player;
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
@ -42,6 +47,15 @@ public abstract class BuildCraftContainer extends Container {
|
||||||
widgets.add(widget);
|
widgets.add(widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void sendWidgetDataToClient(Widget widget, ICrafting player, byte[] data) {
|
||||||
|
PacketGuiWidget pkt = new PacketGuiWidget(windowId, widgets.indexOf(widget), data);
|
||||||
|
PacketDispatcher.sendPacketToPlayer(pkt.getPacket(), (Player) player);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleWidgetClientData(int widgetId, DataInputStream data) throws IOException {
|
||||||
|
widgets.get(widgetId).handleClientPacketData(data);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCraftingToCrafters(ICrafting player) {
|
public void addCraftingToCrafters(ICrafting player) {
|
||||||
super.addCraftingToCrafters(player);
|
super.addCraftingToCrafters(player);
|
||||||
|
|
|
@ -97,7 +97,7 @@ public abstract class GuiBuildCraft extends GuiContainer {
|
||||||
@Override
|
@Override
|
||||||
protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
|
protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
mc.renderEngine.bindTexture(texture);
|
bindTexture(texture);
|
||||||
int x = (width - xSize) / 2;
|
int x = (width - xSize) / 2;
|
||||||
int y = (height - ySize) / 2;
|
int y = (height - ySize) / 2;
|
||||||
drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
|
drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
|
||||||
|
@ -108,6 +108,7 @@ public abstract class GuiBuildCraft extends GuiContainer {
|
||||||
for (Widget widget : container.getWidgets()) {
|
for (Widget widget : container.getWidgets()) {
|
||||||
if (widget.hidden)
|
if (widget.hidden)
|
||||||
continue;
|
continue;
|
||||||
|
bindTexture(texture);
|
||||||
widget.draw(this, x, y, mX, mY);
|
widget.draw(this, x, y, mX, mY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -138,19 +139,51 @@ public abstract class GuiBuildCraft extends GuiContainer {
|
||||||
|
|
||||||
// / MOUSE CLICKS
|
// / MOUSE CLICKS
|
||||||
@Override
|
@Override
|
||||||
protected void mouseClicked(int par1, int par2, int mouseButton) {
|
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) {
|
||||||
super.mouseClicked(par1, par2, mouseButton);
|
int mX = mouseX - guiLeft;
|
||||||
|
int mY = mouseY - guiTop;
|
||||||
|
|
||||||
|
for (Widget widget : container.getWidgets()) {
|
||||||
|
if (widget.hidden)
|
||||||
|
continue;
|
||||||
|
if (!widget.isMouseOver(mX, mY))
|
||||||
|
continue;
|
||||||
|
if (widget.handleMouseClick(mX, mY, mouseButton))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||||
|
|
||||||
// / Handle ledger clicks
|
// / Handle ledger clicks
|
||||||
ledgerManager.handleMouseClicked(par1, par2, mouseButton);
|
ledgerManager.handleMouseClicked(mouseX, mouseY, mouseButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void mouseClickMove(int x, int y, int mouseButton, long time) {
|
protected void mouseClickMove(int mouseX, int mouseY, int mouseButton, long time) {
|
||||||
Slot slot = getSlotAtPosition(x, y);
|
int mX = mouseX - guiLeft;
|
||||||
|
int mY = mouseY - guiTop;
|
||||||
|
for (Widget widget : container.getWidgets()) {
|
||||||
|
if (widget.hidden)
|
||||||
|
continue;
|
||||||
|
widget.handleMouseMove(mX, mY, mouseButton, time);
|
||||||
|
}
|
||||||
|
|
||||||
|
Slot slot = getSlotAtPosition(mouseX, mouseY);
|
||||||
if (mouseButton == 1 && slot instanceof IPhantomSlot)
|
if (mouseButton == 1 && slot instanceof IPhantomSlot)
|
||||||
return;
|
return;
|
||||||
super.mouseClickMove(x, y, mouseButton, time);
|
super.mouseClickMove(mouseX, mouseY, mouseButton, time);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void mouseMovedOrUp(int mouseX, int mouseY, int eventType) {
|
||||||
|
super.mouseMovedOrUp(mouseX, mouseY, eventType);
|
||||||
|
|
||||||
|
int mX = mouseX - guiLeft;
|
||||||
|
int mY = mouseY - guiTop;
|
||||||
|
for (Widget widget : container.getWidgets()) {
|
||||||
|
if (widget.hidden)
|
||||||
|
continue;
|
||||||
|
widget.handleMouseRelease(mX, mY, eventType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Slot getSlotAtPosition(int x, int y) {
|
public Slot getSlotAtPosition(int x, int y) {
|
||||||
|
|
61
common/buildcraft/core/gui/widgets/ButtonWidget.java
Normal file
61
common/buildcraft/core/gui/widgets/ButtonWidget.java
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) SpaceToad, 2011-2012
|
||||||
|
* http://www.mod-buildcraft.com
|
||||||
|
*
|
||||||
|
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||||
|
* License 1.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.widgets;
|
||||||
|
|
||||||
|
import buildcraft.core.gui.GuiBuildCraft;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author CovertJaguar <http://www.railcraft.info/>
|
||||||
|
*/
|
||||||
|
public class ButtonWidget extends Widget {
|
||||||
|
|
||||||
|
private boolean pressed;
|
||||||
|
private int buttonPressed;
|
||||||
|
|
||||||
|
public ButtonWidget(int x, int y, int u, int v, int w, int h) {
|
||||||
|
super(x, y, u, v, w, h);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void draw(GuiBuildCraft gui, int guiX, int guiY, int mouseX, int mouseY) {
|
||||||
|
int vv = pressed ? v + h : v;
|
||||||
|
gui.drawTexturedModalRect(guiX + x, guiY + y, u, vv, w, h);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final boolean handleMouseClick(int mouseX, int mouseY, int mouseButton) {
|
||||||
|
pressed = true;
|
||||||
|
buttonPressed = mouseButton;
|
||||||
|
onPress(buttonPressed);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final void handleMouseRelease(int mouseX, int mouseY, int eventType) {
|
||||||
|
if (pressed) {
|
||||||
|
pressed = false;
|
||||||
|
onRelease(buttonPressed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final void handleMouseMove(int mouseX, int mouseY, int mouseButton, long time) {
|
||||||
|
if (pressed && !isMouseOver(mouseX, mouseY)) {
|
||||||
|
pressed = false;
|
||||||
|
onRelease(buttonPressed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onPress(int mouseButton) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onRelease(int mouseButton) {
|
||||||
|
}
|
||||||
|
}
|
|
@ -13,6 +13,8 @@ import buildcraft.core.gui.tooltips.IToolTipProvider;
|
||||||
import buildcraft.core.gui.tooltips.ToolTip;
|
import buildcraft.core.gui.tooltips.ToolTip;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
import net.minecraft.inventory.ICrafting;
|
import net.minecraft.inventory.ICrafting;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -50,10 +52,22 @@ public class Widget implements IToolTipProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public boolean mouseClicked(int mouseX, int mouseY, int button) {
|
public boolean handleMouseClick(int mouseX, int mouseY, int mouseButton) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void handleMouseRelease(int mouseX, int mouseY, int eventType) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void handleMouseMove(int mouseX, int mouseY, int mouseButton, long time) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void handleClientPacketData(DataInputStream data) throws IOException {
|
||||||
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void draw(GuiBuildCraft gui, int guiX, int guiY, int mouseX, int mouseY) {
|
public void draw(GuiBuildCraft gui, int guiX, int guiY, int mouseX, int mouseY) {
|
||||||
gui.drawTexturedModalRect(guiX + x, guiY + y, u, v, w, h);
|
gui.drawTexturedModalRect(guiX + x, guiY + y, u, v, w, h);
|
||||||
|
|
|
@ -14,7 +14,7 @@ import net.minecraft.world.World;
|
||||||
public abstract interface IGuiReturnHandler {
|
public abstract interface IGuiReturnHandler {
|
||||||
public World getWorld();
|
public World getWorld();
|
||||||
|
|
||||||
public void writeGuiData(DataOutputStream paramDataOutputStream) throws IOException;
|
public void writeGuiData(DataOutputStream data) throws IOException;
|
||||||
|
|
||||||
public void readGuiData(DataInputStream paramDataInputStream, EntityPlayer paramEntityPlayer) throws IOException;
|
public void readGuiData(DataInputStream data, EntityPlayer player) throws IOException;
|
||||||
}
|
}
|
||||||
|
|
59
common/buildcraft/core/network/PacketGuiWidget.java
Normal file
59
common/buildcraft/core/network/PacketGuiWidget.java
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) SpaceToad, 2011-2012
|
||||||
|
* http://www.mod-buildcraft.com
|
||||||
|
*
|
||||||
|
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||||
|
* License 1.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;
|
||||||
|
|
||||||
|
import buildcraft.core.gui.BuildCraftContainer;
|
||||||
|
import cpw.mods.fml.client.FMLClientHandler;
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import net.minecraft.client.entity.EntityClientPlayerMP;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author CovertJaguar <http://www.railcraft.info/>
|
||||||
|
*/
|
||||||
|
public class PacketGuiWidget extends BuildCraftPacket {
|
||||||
|
|
||||||
|
private byte windowId, widgetId;
|
||||||
|
private byte[] payload;
|
||||||
|
|
||||||
|
public PacketGuiWidget() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public PacketGuiWidget(int windowId, int widgetId, byte[] data) {
|
||||||
|
this.windowId = (byte) windowId;
|
||||||
|
this.widgetId = (byte) widgetId;
|
||||||
|
this.payload = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeData(DataOutputStream data) throws IOException {
|
||||||
|
data.writeByte(windowId);
|
||||||
|
data.writeByte(widgetId);
|
||||||
|
data.write(payload);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readData(DataInputStream data) throws IOException {
|
||||||
|
windowId = data.readByte();
|
||||||
|
widgetId = data.readByte();
|
||||||
|
|
||||||
|
EntityClientPlayerMP player = FMLClientHandler.instance().getClient().thePlayer;
|
||||||
|
|
||||||
|
if (player.openContainer instanceof BuildCraftContainer && player.openContainer.windowId == windowId)
|
||||||
|
((BuildCraftContainer) player.openContainer).handleWidgetClientData(widgetId, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getID() {
|
||||||
|
return PacketIds.GUI_WIDGET;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -37,27 +37,32 @@ public class PacketHandler implements IPacketHandler {
|
||||||
int packetID = data.read();
|
int packetID = data.read();
|
||||||
switch (packetID) {
|
switch (packetID) {
|
||||||
case PacketIds.TILE_UPDATE: {
|
case PacketIds.TILE_UPDATE: {
|
||||||
PacketTileUpdate packetT = new PacketTileUpdate();
|
PacketTileUpdate pkt = new PacketTileUpdate();
|
||||||
packetT.readData(data);
|
pkt.readData(data);
|
||||||
onTileUpdate((EntityPlayer) player, packetT);
|
onTileUpdate((EntityPlayer) player, pkt);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case PacketIds.STATE_UPDATE: {
|
case PacketIds.STATE_UPDATE: {
|
||||||
PacketTileState inPacket = new PacketTileState();
|
PacketTileState pkt = new PacketTileState();
|
||||||
inPacket.readData(data);
|
pkt.readData(data);
|
||||||
World world = ((EntityPlayer) player).worldObj;
|
World world = ((EntityPlayer) player).worldObj;
|
||||||
TileEntity tile = world.getBlockTileEntity(inPacket.posX, inPacket.posY, inPacket.posZ);
|
TileEntity tile = world.getBlockTileEntity(pkt.posX, pkt.posY, pkt.posZ);
|
||||||
if (tile instanceof ISyncedTile) {
|
if (tile instanceof ISyncedTile) {
|
||||||
inPacket.applyStates(data, (ISyncedTile) tile);
|
pkt.applyStates(data, (ISyncedTile) tile);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case PacketIds.GUI_RETURN: {
|
case PacketIds.GUI_RETURN: {
|
||||||
PacketGuiReturn packet1 = new PacketGuiReturn((EntityPlayer) player);
|
PacketGuiReturn pkt = new PacketGuiReturn((EntityPlayer) player);
|
||||||
packet1.readData(data);
|
pkt.readData(data);
|
||||||
// onGuiReturn((EntityPlayer) player, packet1);
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case PacketIds.GUI_WIDGET: {
|
||||||
|
PacketGuiWidget pkt = new PacketGuiWidget();
|
||||||
|
pkt.readData(data);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ public class PacketIds {
|
||||||
public static final int SELECTION_ADVANCED_WORKBENCH = 71;
|
public static final int SELECTION_ADVANCED_WORKBENCH = 71;
|
||||||
|
|
||||||
public static final int GUI_RETURN = 80;
|
public static final int GUI_RETURN = 80;
|
||||||
|
public static final int GUI_WIDGET = 81;
|
||||||
|
|
||||||
public static final int STATE_UPDATE = 100;
|
public static final int STATE_UPDATE = 100;
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,7 +157,7 @@ public enum EnumColor {
|
||||||
return NAMES[ordinal()];
|
return NAMES[ordinal()];
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTranslatedName() {
|
public String getLocalizedName() {
|
||||||
return StringUtils.localize(getTag());
|
return StringUtils.localize(getTag());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
65
common/buildcraft/core/utils/RevolvingList.java
Normal file
65
common/buildcraft/core/utils/RevolvingList.java
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
/**
|
||||||
|
* Copyright (c) SpaceToad, 2011 http://www.mod-buildcraft.com
|
||||||
|
*
|
||||||
|
* BuildCraft is distributed under the terms of the Minecraft Mod Public License
|
||||||
|
* 1.0, or MMPL. Please check the contents of the license located in
|
||||||
|
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||||
|
*/
|
||||||
|
package buildcraft.core.utils;
|
||||||
|
|
||||||
|
import com.google.common.collect.ForwardingCollection;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author CovertJaguar <http://www.railcraft.info>
|
||||||
|
*/
|
||||||
|
public class RevolvingList<T> extends ForwardingCollection<T> {
|
||||||
|
|
||||||
|
private Deque<T> list = new LinkedList<T>();
|
||||||
|
|
||||||
|
public RevolvingList() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public RevolvingList(Collection<? extends T> collection) {
|
||||||
|
list.addAll(collection);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Collection<T> delegate() {
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void rotateLeft() {
|
||||||
|
if (list.isEmpty())
|
||||||
|
return;
|
||||||
|
list.addFirst(list.removeLast());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void rotateRight() {
|
||||||
|
if (list.isEmpty())
|
||||||
|
return;
|
||||||
|
list.addLast(list.removeFirst());
|
||||||
|
}
|
||||||
|
|
||||||
|
public T getCurrent() {
|
||||||
|
if (list.isEmpty())
|
||||||
|
return null;
|
||||||
|
return list.getFirst();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurrent(T e) {
|
||||||
|
if (!contains(e))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (e == null) {
|
||||||
|
while (getCurrent() != null) {
|
||||||
|
rotateRight();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
while (getCurrent() == null || !getCurrent().equals(e)) {
|
||||||
|
rotateRight();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,15 +6,15 @@ import buildcraft.transport.gui.ContainerDiamondPipe;
|
||||||
import buildcraft.transport.gui.ContainerEmeraldPipe;
|
import buildcraft.transport.gui.ContainerEmeraldPipe;
|
||||||
import buildcraft.transport.gui.ContainerFilteredBuffer;
|
import buildcraft.transport.gui.ContainerFilteredBuffer;
|
||||||
import buildcraft.transport.gui.ContainerGateInterface;
|
import buildcraft.transport.gui.ContainerGateInterface;
|
||||||
import buildcraft.transport.gui.ContainerLogemeraldPipe;
|
import buildcraft.transport.gui.ContainerEmzuliPipe;
|
||||||
import buildcraft.transport.gui.GuiDiamondPipe;
|
import buildcraft.transport.gui.GuiDiamondPipe;
|
||||||
import buildcraft.transport.gui.GuiEmeraldPipe;
|
import buildcraft.transport.gui.GuiEmeraldPipe;
|
||||||
import buildcraft.transport.gui.GuiFilteredBuffer;
|
import buildcraft.transport.gui.GuiFilteredBuffer;
|
||||||
import buildcraft.transport.gui.GuiGateInterface;
|
import buildcraft.transport.gui.GuiGateInterface;
|
||||||
import buildcraft.transport.gui.GuiLogemeraldPipe;
|
import buildcraft.transport.gui.GuiEmzuliPipe;
|
||||||
import buildcraft.transport.pipes.PipeItemsDiamond;
|
import buildcraft.transport.pipes.PipeItemsDiamond;
|
||||||
import buildcraft.transport.pipes.PipeItemsEmerald;
|
import buildcraft.transport.pipes.PipeItemsEmerald;
|
||||||
import buildcraft.transport.pipes.PipeItemsLogemerald;
|
import buildcraft.transport.pipes.PipeItemsEmzuli;
|
||||||
import cpw.mods.fml.common.network.IGuiHandler;
|
import cpw.mods.fml.common.network.IGuiHandler;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
@ -52,7 +52,7 @@ public class GuiHandler implements IGuiHandler {
|
||||||
return new ContainerEmeraldPipe(player.inventory, (PipeItemsEmerald) pipe.pipe);
|
return new ContainerEmeraldPipe(player.inventory, (PipeItemsEmerald) pipe.pipe);
|
||||||
|
|
||||||
case GuiIds.PIPE_LOGEMERALD_ITEM:
|
case GuiIds.PIPE_LOGEMERALD_ITEM:
|
||||||
return new ContainerLogemeraldPipe(player.inventory, (PipeItemsLogemerald) pipe.pipe);
|
return new ContainerEmzuliPipe(player.inventory, (PipeItemsEmzuli) pipe.pipe);
|
||||||
|
|
||||||
case GuiIds.GATES:
|
case GuiIds.GATES:
|
||||||
if (pipe.pipe.hasGate())
|
if (pipe.pipe.hasGate())
|
||||||
|
@ -96,7 +96,7 @@ public class GuiHandler implements IGuiHandler {
|
||||||
return new GuiEmeraldPipe(player.inventory, (PipeItemsEmerald) pipe.pipe);
|
return new GuiEmeraldPipe(player.inventory, (PipeItemsEmerald) pipe.pipe);
|
||||||
|
|
||||||
case GuiIds.PIPE_LOGEMERALD_ITEM:
|
case GuiIds.PIPE_LOGEMERALD_ITEM:
|
||||||
return new GuiLogemeraldPipe(player.inventory, (PipeItemsLogemerald) pipe.pipe);
|
return new GuiEmzuliPipe(player.inventory, (PipeItemsEmzuli) pipe.pipe);
|
||||||
|
|
||||||
case GuiIds.GATES:
|
case GuiIds.GATES:
|
||||||
if (pipe.pipe.hasGate())
|
if (pipe.pipe.hasGate())
|
||||||
|
|
|
@ -2,6 +2,10 @@ package buildcraft.transport;
|
||||||
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated This has been replaced by the Pipe Event system.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public interface IItemTravelingHook {
|
public interface IItemTravelingHook {
|
||||||
|
|
||||||
public void drop(PipeTransportItems transport, TravelingItem item);
|
public void drop(PipeTransportItems transport, TravelingItem item);
|
||||||
|
@ -9,13 +13,14 @@ public interface IItemTravelingHook {
|
||||||
public void centerReached(PipeTransportItems transport, TravelingItem item);
|
public void centerReached(PipeTransportItems transport, TravelingItem item);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overrides default handling of what occurs when an Item reaches the end of the pipe.
|
* Overrides default handling of what occurs when an Item reaches the end of
|
||||||
*
|
* the pipe.
|
||||||
|
*
|
||||||
* @param transport
|
* @param transport
|
||||||
* @param item
|
* @param item
|
||||||
* @param tile
|
* @param tile
|
||||||
* @return false if the transport code should handle the item normally, true if its been handled
|
* @return false if the transport code should handle the item normally, true
|
||||||
|
* if its been handled
|
||||||
*/
|
*/
|
||||||
public boolean endReached(PipeTransportItems transport, TravelingItem item, TileEntity tile);
|
public boolean endReached(PipeTransportItems transport, TravelingItem item, TileEntity tile);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,20 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (c) SpaceToad, 2011
|
* Copyright (c) SpaceToad, 2011 http://www.mod-buildcraft.com
|
||||||
* http://www.mod-buildcraft.com
|
|
||||||
*
|
*
|
||||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
* BuildCraft is distributed under the terms of the Minecraft Mod Public License
|
||||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
* 1.0, or MMPL. Please check the contents of the license located in
|
||||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package buildcraft.transport;
|
package buildcraft.transport;
|
||||||
|
|
||||||
import buildcraft.api.core.Position;
|
import buildcraft.api.core.Position;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated This has been replaced by the Pipe Event system.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public interface IPipeTransportItemsHook {
|
public interface IPipeTransportItemsHook {
|
||||||
|
|
||||||
public LinkedList<ForgeDirection> filterPossibleMovements(LinkedList<ForgeDirection> possibleOrientations, Position pos, TravelingItem item);
|
public LinkedList<ForgeDirection> filterPossibleMovements(LinkedList<ForgeDirection> possibleOrientations, Position pos, TravelingItem item);
|
||||||
|
|
|
@ -19,15 +19,16 @@ import buildcraft.core.IDropControlInventory;
|
||||||
import buildcraft.core.inventory.InvUtils;
|
import buildcraft.core.inventory.InvUtils;
|
||||||
import buildcraft.core.network.TilePacketWrapper;
|
import buildcraft.core.network.TilePacketWrapper;
|
||||||
import buildcraft.core.utils.Utils;
|
import buildcraft.core.utils.Utils;
|
||||||
|
import buildcraft.transport.pipes.events.PipeEvent;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.item.EntityItem;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
@ -47,6 +48,7 @@ public abstract class Pipe<T extends PipeTransport> implements IPipe, IDropContr
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
private static Map<Class, TilePacketWrapper> networkWrappers = new HashMap<Class, TilePacketWrapper>();
|
private static Map<Class, TilePacketWrapper> networkWrappers = new HashMap<Class, TilePacketWrapper>();
|
||||||
public SafeTimeTracker actionTracker = new SafeTimeTracker();
|
public SafeTimeTracker actionTracker = new SafeTimeTracker();
|
||||||
|
private static Map<Class<? extends Pipe>, Map<Class<? extends PipeEvent>, EventHandler>> eventHandlers = new HashMap<Class<? extends Pipe>, Map<Class<? extends PipeEvent>, EventHandler>>();
|
||||||
|
|
||||||
public Pipe(T transport, int itemID) {
|
public Pipe(T transport, int itemID) {
|
||||||
this.transport = transport;
|
this.transport = transport;
|
||||||
|
@ -65,6 +67,39 @@ public abstract class Pipe<T extends PipeTransport> implements IPipe, IDropContr
|
||||||
transport.setTile((TileGenericPipe) tile);
|
transport.setTile((TileGenericPipe) tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static class EventHandler {
|
||||||
|
|
||||||
|
public final Method method;
|
||||||
|
|
||||||
|
public EventHandler(Method method) {
|
||||||
|
this.method = method;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public final void handlePipeEvent(PipeEvent event) {
|
||||||
|
Map<Class<? extends PipeEvent>, EventHandler> handlerMap = eventHandlers.get(getClass());
|
||||||
|
if (handlerMap == null) {
|
||||||
|
handlerMap = new HashMap<Class<? extends PipeEvent>, EventHandler>();
|
||||||
|
eventHandlers.put(getClass(), handlerMap);
|
||||||
|
}
|
||||||
|
EventHandler handler = handlerMap.get(event.getClass());
|
||||||
|
if (handler == null) {
|
||||||
|
try {
|
||||||
|
Method method = getClass().getDeclaredMethod("eventHandler", event.getClass());
|
||||||
|
handler = new EventHandler(method);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
handler = new EventHandler(null);
|
||||||
|
}
|
||||||
|
handlerMap.put(event.getClass(), handler);
|
||||||
|
}
|
||||||
|
if (handler.method == null)
|
||||||
|
return;
|
||||||
|
try {
|
||||||
|
handler.method.invoke(this, event);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean blockActivated(EntityPlayer entityplayer) {
|
public boolean blockActivated(EntityPlayer entityplayer) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -481,9 +516,6 @@ public abstract class Pipe<T extends PipeTransport> implements IPipe, IDropContr
|
||||||
transport.dropContents();
|
transport.dropContents();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onDropped(EntityItem item) {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If this pipe is open on one side, return it.
|
* If this pipe is open on one side, return it.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -12,7 +12,7 @@ import buildcraft.transport.pipes.PipeFluidsCobblestone;
|
||||||
import buildcraft.transport.pipes.PipeFluidsStone;
|
import buildcraft.transport.pipes.PipeFluidsStone;
|
||||||
import buildcraft.transport.pipes.PipeFluidsWood;
|
import buildcraft.transport.pipes.PipeFluidsWood;
|
||||||
import buildcraft.transport.pipes.PipeItemsCobblestone;
|
import buildcraft.transport.pipes.PipeItemsCobblestone;
|
||||||
import buildcraft.transport.pipes.PipeItemsLogemerald;
|
import buildcraft.transport.pipes.PipeItemsEmzuli;
|
||||||
import buildcraft.transport.pipes.PipeItemsObsidian;
|
import buildcraft.transport.pipes.PipeItemsObsidian;
|
||||||
import buildcraft.transport.pipes.PipeItemsQuartz;
|
import buildcraft.transport.pipes.PipeItemsQuartz;
|
||||||
import buildcraft.transport.pipes.PipeItemsStone;
|
import buildcraft.transport.pipes.PipeItemsStone;
|
||||||
|
@ -43,7 +43,7 @@ public class PipeConnectionBans {
|
||||||
|
|
||||||
banConnection(PipeItemsObsidian.class);
|
banConnection(PipeItemsObsidian.class);
|
||||||
|
|
||||||
banConnection(PipeItemsLogemerald.class);
|
banConnection(PipeItemsEmzuli.class);
|
||||||
|
|
||||||
// Power Pipes
|
// Power Pipes
|
||||||
banConnection(PipePowerWood.class);
|
banConnection(PipePowerWood.class);
|
||||||
|
|
|
@ -15,6 +15,7 @@ public class PipeIconProvider implements IIconProvider {
|
||||||
//
|
//
|
||||||
PipeItemsCobbleStone("pipeItemsCobblestone"),
|
PipeItemsCobbleStone("pipeItemsCobblestone"),
|
||||||
//
|
//
|
||||||
|
PipeItemsDiamond_Item("pipeItemsDiamond_item"),
|
||||||
PipeItemsDiamond_Center("pipeItemsDiamond_center"),
|
PipeItemsDiamond_Center("pipeItemsDiamond_center"),
|
||||||
PipeItemsDiamond_Down("pipeItemsDiamond_down"),
|
PipeItemsDiamond_Down("pipeItemsDiamond_down"),
|
||||||
PipeItemsDiamond_Up("pipeItemsDiamond_up"),
|
PipeItemsDiamond_Up("pipeItemsDiamond_up"),
|
||||||
|
@ -64,8 +65,8 @@ public class PipeIconProvider implements IIconProvider {
|
||||||
PipeItemsEmerald_Standard("pipeItemsEmerald_standard"),
|
PipeItemsEmerald_Standard("pipeItemsEmerald_standard"),
|
||||||
PipeAllEmerald_Solid("pipeAllEmerald_solid"),
|
PipeAllEmerald_Solid("pipeAllEmerald_solid"),
|
||||||
//
|
//
|
||||||
PipeItemsLogemerald_Standard("pipeItemsLogemerald_standard"),
|
PipeItemsEmzuli_Standard("pipeItemsEmzuli_standard"),
|
||||||
PipeAllLogemerald_Solid("pipeAllLogemerald_solid"),
|
PipeAllEmzuli_Solid("pipeAllEmzuli_solid"),
|
||||||
//
|
//
|
||||||
PipeItemsGold("pipeItemsGold"),
|
PipeItemsGold("pipeItemsGold"),
|
||||||
//
|
//
|
||||||
|
|
|
@ -22,6 +22,7 @@ import buildcraft.core.utils.BlockUtil;
|
||||||
import buildcraft.transport.network.PacketPipeTransportContent;
|
import buildcraft.transport.network.PacketPipeTransportContent;
|
||||||
import buildcraft.transport.network.PacketPipeTransportNBT;
|
import buildcraft.transport.network.PacketPipeTransportNBT;
|
||||||
import buildcraft.transport.network.PacketSimpleId;
|
import buildcraft.transport.network.PacketSimpleId;
|
||||||
|
import buildcraft.transport.pipes.events.PipeEventItem;
|
||||||
import buildcraft.transport.utils.TransportUtils;
|
import buildcraft.transport.utils.TransportUtils;
|
||||||
import com.google.common.collect.BiMap;
|
import com.google.common.collect.BiMap;
|
||||||
import com.google.common.collect.ForwardingSet;
|
import com.google.common.collect.ForwardingSet;
|
||||||
|
@ -125,9 +126,13 @@ public class PipeTransportItems extends PipeTransport {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void readjustSpeed(TravelingItem item) {
|
public void readjustSpeed(TravelingItem item) {
|
||||||
if (container.pipe instanceof IPipeTransportItemsHook)
|
if (container.pipe instanceof IPipeTransportItemsHook) {
|
||||||
((IPipeTransportItemsHook) container.pipe).readjustSpeed(item);
|
((IPipeTransportItemsHook) container.pipe).readjustSpeed(item);
|
||||||
else
|
return;
|
||||||
|
}
|
||||||
|
PipeEventItem.AdjustSpeed event = new PipeEventItem.AdjustSpeed(item);
|
||||||
|
container.pipe.handlePipeEvent(event);
|
||||||
|
if (!event.handled)
|
||||||
defaultReajustSpeed(item);
|
defaultReajustSpeed(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,8 +179,6 @@ public class PipeTransportItems extends PipeTransport {
|
||||||
item.reset();
|
item.reset();
|
||||||
item.input = inputOrientation;
|
item.input = inputOrientation;
|
||||||
|
|
||||||
items.add(item);
|
|
||||||
|
|
||||||
readjustSpeed(item);
|
readjustSpeed(item);
|
||||||
readjustPosition(item);
|
readjustPosition(item);
|
||||||
|
|
||||||
|
@ -188,6 +191,13 @@ public class PipeTransportItems extends PipeTransport {
|
||||||
((IPipeTransportItemsHook) container.pipe).entityEntered(item, inputOrientation);
|
((IPipeTransportItemsHook) container.pipe).entityEntered(item, inputOrientation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PipeEventItem.Entered event = new PipeEventItem.Entered(item);
|
||||||
|
container.pipe.handlePipeEvent(event);
|
||||||
|
if (event.cancelled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
items.add(item);
|
||||||
|
|
||||||
if (!container.worldObj.isRemote) {
|
if (!container.worldObj.isRemote) {
|
||||||
sendItemPacket(item);
|
sendItemPacket(item);
|
||||||
|
|
||||||
|
@ -231,8 +241,6 @@ public class PipeTransportItems extends PipeTransport {
|
||||||
// stage, avoid adding it to the pipe to avoid further exceptions.
|
// stage, avoid adding it to the pipe to avoid further exceptions.
|
||||||
return;
|
return;
|
||||||
|
|
||||||
items.unscheduleRemoval(item);
|
|
||||||
|
|
||||||
item.toCenter = true;
|
item.toCenter = true;
|
||||||
item.input = item.output.getOpposite();
|
item.input = item.output.getOpposite();
|
||||||
|
|
||||||
|
@ -246,6 +254,12 @@ public class PipeTransportItems extends PipeTransport {
|
||||||
if (container.pipe instanceof IPipeTransportItemsHook) {
|
if (container.pipe instanceof IPipeTransportItemsHook) {
|
||||||
((IPipeTransportItemsHook) container.pipe).entityEntered(item, item.input);
|
((IPipeTransportItemsHook) container.pipe).entityEntered(item, item.input);
|
||||||
}
|
}
|
||||||
|
PipeEventItem.Entered event = new PipeEventItem.Entered(item);
|
||||||
|
container.pipe.handlePipeEvent(event);
|
||||||
|
if (event.cancelled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
items.unscheduleRemoval(item);
|
||||||
|
|
||||||
if (!container.worldObj.isRemote) {
|
if (!container.worldObj.isRemote) {
|
||||||
sendItemPacket(item);
|
sendItemPacket(item);
|
||||||
|
@ -253,20 +267,19 @@ public class PipeTransportItems extends PipeTransport {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ForgeDirection resolveDestination(TravelingItem data) {
|
public ForgeDirection resolveDestination(TravelingItem data) {
|
||||||
LinkedList<ForgeDirection> listOfPossibleMovements = getPossibleMovements(data);
|
List<ForgeDirection> validDestinations = getPossibleMovements(data);
|
||||||
|
|
||||||
if (listOfPossibleMovements.isEmpty())
|
if (validDestinations.isEmpty())
|
||||||
return ForgeDirection.UNKNOWN;
|
return ForgeDirection.UNKNOWN;
|
||||||
|
|
||||||
int i = container.worldObj.rand.nextInt(listOfPossibleMovements.size());
|
return validDestinations.get(0);
|
||||||
return listOfPossibleMovements.get(i);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of all possible movements, that is to say adjacent
|
* Returns a list of all possible movements, that is to say adjacent
|
||||||
* implementers of IPipeEntry or TileEntityChest.
|
* implementers of IPipeEntry or TileEntityChest.
|
||||||
*/
|
*/
|
||||||
public LinkedList<ForgeDirection> getPossibleMovements(TravelingItem item) {
|
public List<ForgeDirection> getPossibleMovements(TravelingItem item) {
|
||||||
LinkedList<ForgeDirection> result = new LinkedList<ForgeDirection>();
|
LinkedList<ForgeDirection> result = new LinkedList<ForgeDirection>();
|
||||||
|
|
||||||
item.blacklist.add(item.input.getOpposite());
|
item.blacklist.add(item.input.getOpposite());
|
||||||
|
@ -282,6 +295,8 @@ public class PipeTransportItems extends PipeTransport {
|
||||||
Position pos = new Position(container.xCoord, container.yCoord, container.zCoord, item.input);
|
Position pos = new Position(container.xCoord, container.yCoord, container.zCoord, item.input);
|
||||||
result = ((IPipeTransportItemsHook) this.container.pipe).filterPossibleMovements(result, pos, item);
|
result = ((IPipeTransportItemsHook) this.container.pipe).filterPossibleMovements(result, pos, item);
|
||||||
}
|
}
|
||||||
|
PipeEventItem.FindDest event = new PipeEventItem.FindDest(item, result);
|
||||||
|
container.pipe.handlePipeEvent(event);
|
||||||
|
|
||||||
if (allowBouncing && result.isEmpty()) {
|
if (allowBouncing && result.isEmpty()) {
|
||||||
if (canReceivePipeObjects(item.input.getOpposite(), item)) {
|
if (canReceivePipeObjects(item.input.getOpposite(), item)) {
|
||||||
|
@ -289,6 +304,8 @@ public class PipeTransportItems extends PipeTransport {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Collections.shuffle(result);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,29 +358,23 @@ public class PipeTransportItems extends PipeTransport {
|
||||||
item.setPosition(container.xCoord + 0.5, container.yCoord + TransportUtils.getPipeFloorOf(item.getItemStack()), container.zCoord + 0.5);
|
item.setPosition(container.xCoord + 0.5, container.yCoord + TransportUtils.getPipeFloorOf(item.getItemStack()), container.zCoord + 0.5);
|
||||||
|
|
||||||
if (item.output == ForgeDirection.UNKNOWN) {
|
if (item.output == ForgeDirection.UNKNOWN) {
|
||||||
if (travelHook != null) {
|
if (items.scheduleRemoval(item))
|
||||||
travelHook.drop(this, item);
|
dropItem(item);
|
||||||
}
|
|
||||||
|
|
||||||
EntityItem dropped = null;
|
|
||||||
|
|
||||||
if (items.scheduleRemoval(item)) {
|
|
||||||
dropped = item.toEntityItem(item.input);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dropped != null) {
|
|
||||||
onDropped(dropped);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (travelHook != null) {
|
if (travelHook != null) {
|
||||||
travelHook.centerReached(this, item);
|
travelHook.centerReached(this, item);
|
||||||
}
|
}
|
||||||
|
PipeEventItem.ReachedCenter event = new PipeEventItem.ReachedCenter(item);
|
||||||
|
container.pipe.handlePipeEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (!item.toCenter && endReached(item)) {
|
} else if (!item.toCenter && endReached(item)) {
|
||||||
TileEntity tile = container.getTile(item.output);
|
TileEntity tile = container.getTile(item.output);
|
||||||
|
|
||||||
boolean handleItem = true;
|
PipeEventItem.ReachedEnd event = new PipeEventItem.ReachedEnd(item, tile);
|
||||||
|
container.pipe.handlePipeEvent(event);
|
||||||
|
boolean handleItem = !event.handled;
|
||||||
|
|
||||||
if (travelHook != null) {
|
if (travelHook != null) {
|
||||||
handleItem = !travelHook.endReached(this, item, tile);
|
handleItem = !travelHook.endReached(this, item, tile);
|
||||||
}
|
}
|
||||||
|
@ -404,19 +415,23 @@ public class PipeTransportItems extends PipeTransport {
|
||||||
reverseItem(item);
|
reverseItem(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else
|
||||||
if (travelHook != null) {
|
dropItem(item);
|
||||||
travelHook.drop(this, item);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
EntityItem dropped = item.toEntityItem(item.output);
|
private void dropItem(TravelingItem item) {
|
||||||
|
if (container.worldObj.isRemote)
|
||||||
|
return;
|
||||||
|
|
||||||
if (dropped != null) {
|
if (travelHook != null) {
|
||||||
// On SMP, the client side doesn't actually drops
|
travelHook.drop(this, item);
|
||||||
// items
|
|
||||||
onDropped(dropped);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PipeEventItem.DropItem event = new PipeEventItem.DropItem(item, item.toEntityItem());
|
||||||
|
container.pipe.handlePipeEvent(event);
|
||||||
|
if (event.entity == null)
|
||||||
|
return;
|
||||||
|
container.worldObj.spawnEntityInWorld(event.entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean middleReached(TravelingItem item) {
|
protected boolean middleReached(TravelingItem item) {
|
||||||
|
@ -514,6 +529,7 @@ public class PipeTransportItems extends PipeTransport {
|
||||||
|
|
||||||
item.setSpeed(packet.getSpeed());
|
item.setSpeed(packet.getSpeed());
|
||||||
|
|
||||||
|
item.toCenter = true;
|
||||||
item.input = packet.getInputOrientation();
|
item.input = packet.getInputOrientation();
|
||||||
item.output = packet.getOutputOrientation();
|
item.output = packet.getOutputOrientation();
|
||||||
item.color = packet.getColor();
|
item.color = packet.getColor();
|
||||||
|
@ -569,10 +585,6 @@ public class PipeTransportItems extends PipeTransport {
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onDropped(EntityItem item) {
|
|
||||||
this.container.pipe.onDropped(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void neighborChange() {
|
protected void neighborChange() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class TransportProxyClient extends TransportProxy {
|
||||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeItemsEmerald.itemID, pipeItemRenderer);
|
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeItemsEmerald.itemID, pipeItemRenderer);
|
||||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeItemsLapis.itemID, pipeItemRenderer);
|
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeItemsLapis.itemID, pipeItemRenderer);
|
||||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeItemsDaizuli.itemID, pipeItemRenderer);
|
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeItemsDaizuli.itemID, pipeItemRenderer);
|
||||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeItemsLogemerald.itemID, pipeItemRenderer);
|
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeItemsEmzuli.itemID, pipeItemRenderer);
|
||||||
|
|
||||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeFluidsWood.itemID, pipeItemRenderer);
|
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeFluidsWood.itemID, pipeItemRenderer);
|
||||||
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeFluidsCobblestone.itemID, pipeItemRenderer);
|
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeFluidsCobblestone.itemID, pipeItemRenderer);
|
||||||
|
|
|
@ -12,6 +12,7 @@ import buildcraft.api.core.Position;
|
||||||
import buildcraft.core.proxy.CoreProxy;
|
import buildcraft.core.proxy.CoreProxy;
|
||||||
import buildcraft.core.utils.EnumColor;
|
import buildcraft.core.utils.EnumColor;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.item.EntityItem;
|
import net.minecraft.entity.item.EntityItem;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
@ -102,12 +103,19 @@ public class TravelingItem {
|
||||||
return extraData != null;
|
return extraData != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public void setInsetionHandler(InsertionHandler handler) {
|
public void setInsetionHandler(InsertionHandler handler) {
|
||||||
if (handler == null)
|
if (handler == null)
|
||||||
return;
|
return;
|
||||||
this.insertionHandler = handler;
|
this.insertionHandler = handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setInsertionHandler(InsertionHandler handler) {
|
||||||
|
if (handler == null)
|
||||||
|
return;
|
||||||
|
this.insertionHandler = handler;
|
||||||
|
}
|
||||||
|
|
||||||
public InsertionHandler getInsertionHandler() {
|
public InsertionHandler getInsertionHandler() {
|
||||||
return insertionHandler;
|
return insertionHandler;
|
||||||
}
|
}
|
||||||
|
@ -157,25 +165,30 @@ public class TravelingItem {
|
||||||
data.setTag("extraData", extraData);
|
data.setTag("extraData", extraData);
|
||||||
}
|
}
|
||||||
|
|
||||||
public EntityItem toEntityItem(ForgeDirection dir) {
|
public EntityItem toEntityItem() {
|
||||||
if (container != null && !CoreProxy.proxy.isRenderWorld(container.worldObj)) {
|
if (container != null && !CoreProxy.proxy.isRenderWorld(container.worldObj)) {
|
||||||
if (getItemStack().stackSize <= 0)
|
if (getItemStack().stackSize <= 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
Position motion = new Position(0, 0, 0, dir);
|
Position motion = new Position(0, 0, 0, output);
|
||||||
motion.moveForwards(0.1 + getSpeed() * 2F);
|
motion.moveForwards(0.1 + getSpeed() * 2F);
|
||||||
|
|
||||||
EntityItem entityitem = new EntityItem(container.worldObj, xCoord, yCoord, zCoord, getItemStack());
|
ItemStack stack = getItemStack();
|
||||||
|
EntityItem entity = new EntityItem(container.worldObj, xCoord, yCoord, zCoord, getItemStack());
|
||||||
|
if (stack.getItem().hasCustomEntity(stack)) {
|
||||||
|
Entity e = stack.getItem().createEntity(container.worldObj, entity, stack);
|
||||||
|
if (e instanceof EntityItem)
|
||||||
|
entity = (EntityItem) e;
|
||||||
|
}
|
||||||
|
|
||||||
entityitem.lifespan = BuildCraftCore.itemLifespan;
|
entity.lifespan = BuildCraftCore.itemLifespan;
|
||||||
entityitem.delayBeforeCanPickup = 10;
|
entity.delayBeforeCanPickup = 10;
|
||||||
|
|
||||||
float f3 = 0.00F + container.worldObj.rand.nextFloat() * 0.04F - 0.02F;
|
float f3 = 0.00F + container.worldObj.rand.nextFloat() * 0.04F - 0.02F;
|
||||||
entityitem.motionX = (float) container.worldObj.rand.nextGaussian() * f3 + motion.x;
|
entity.motionX = (float) container.worldObj.rand.nextGaussian() * f3 + motion.x;
|
||||||
entityitem.motionY = (float) container.worldObj.rand.nextGaussian() * f3 + motion.y;
|
entity.motionY = (float) container.worldObj.rand.nextGaussian() * f3 + motion.y;
|
||||||
entityitem.motionZ = (float) container.worldObj.rand.nextGaussian() * f3 + +motion.z;
|
entity.motionZ = (float) container.worldObj.rand.nextGaussian() * f3 + +motion.z;
|
||||||
container.worldObj.spawnEntityInWorld(entityitem);
|
return entity;
|
||||||
return entityitem;
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -194,7 +207,7 @@ public class TravelingItem {
|
||||||
public boolean isCorrupted() {
|
public boolean isCorrupted() {
|
||||||
return getItemStack() == null || getItemStack().stackSize <= 0 || Item.itemsList[getItemStack().itemID] == null;
|
return getItemStack() == null || getItemStack().stackSize <= 0 || Item.itemsList[getItemStack().itemID] == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = 7;
|
int hash = 7;
|
||||||
|
|
176
common/buildcraft/transport/gui/ContainerEmzuliPipe.java
Normal file
176
common/buildcraft/transport/gui/ContainerEmzuliPipe.java
Normal file
|
@ -0,0 +1,176 @@
|
||||||
|
/**
|
||||||
|
* Copyright (c) SpaceToad, 2011 http://www.mod-buildcraft.com
|
||||||
|
*
|
||||||
|
* BuildCraft is distributed under the terms of the Minecraft Mod Public License
|
||||||
|
* 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 buildcraft.BuildCraftTransport;
|
||||||
|
import buildcraft.core.gui.BuildCraftContainer;
|
||||||
|
import buildcraft.core.gui.GuiBuildCraft;
|
||||||
|
import buildcraft.core.gui.slots.SlotPhantom;
|
||||||
|
import buildcraft.core.gui.tooltips.ToolTip;
|
||||||
|
import buildcraft.core.gui.tooltips.ToolTipLine;
|
||||||
|
import buildcraft.core.gui.widgets.ButtonWidget;
|
||||||
|
import buildcraft.core.network.IGuiReturnHandler;
|
||||||
|
import buildcraft.core.network.PacketGuiReturn;
|
||||||
|
import buildcraft.core.utils.EnumColor;
|
||||||
|
import buildcraft.core.utils.RevolvingList;
|
||||||
|
import buildcraft.core.utils.StringUtils;
|
||||||
|
import buildcraft.transport.pipes.PipeItemsEmzuli;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureMap;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.inventory.ICrafting;
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
|
import net.minecraft.inventory.Slot;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author SandGrainOne
|
||||||
|
*/
|
||||||
|
public class ContainerEmzuliPipe extends BuildCraftContainer {
|
||||||
|
|
||||||
|
private final PipeItemsEmzuli pipe;
|
||||||
|
private final IInventory filterInv;
|
||||||
|
private final byte[] prevSlotColors = new byte[4];
|
||||||
|
private final PaintWidget[] paintWidgets = new PaintWidget[4];
|
||||||
|
|
||||||
|
public ContainerEmzuliPipe(IInventory playerInventory, PipeItemsEmzuli pipe) {
|
||||||
|
super(pipe.getFilters().getSizeInventory());
|
||||||
|
|
||||||
|
this.pipe = pipe;
|
||||||
|
filterInv = pipe.getFilters();
|
||||||
|
|
||||||
|
addWidget(paintWidgets[0] = new PaintWidget(0, 51, 19));
|
||||||
|
addWidget(paintWidgets[1] = new PaintWidget(1, 104, 19));
|
||||||
|
addWidget(paintWidgets[2] = new PaintWidget(2, 51, 47));
|
||||||
|
addWidget(paintWidgets[3] = new PaintWidget(3, 104, 47));
|
||||||
|
|
||||||
|
addSlot(new SlotPhantom(filterInv, 0, 25, 21));
|
||||||
|
addSlot(new SlotPhantom(filterInv, 1, 134, 21));
|
||||||
|
addSlot(new SlotPhantom(filterInv, 2, 25, 49));
|
||||||
|
addSlot(new SlotPhantom(filterInv, 3, 134, 49));
|
||||||
|
|
||||||
|
for (int l = 0; l < 3; l++) {
|
||||||
|
for (int k1 = 0; k1 < 9; k1++) {
|
||||||
|
addSlotToContainer(new Slot(playerInventory, k1 + l * 9 + 9, 8 + k1 * 18, 84 + l * 18));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i1 = 0; i1 < 9; i1++) {
|
||||||
|
addSlotToContainer(new Slot(playerInventory, i1, 8 + i1 * 18, 142));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addCraftingToCrafters(ICrafting player) {
|
||||||
|
super.addCraftingToCrafters(player);
|
||||||
|
for (int slot = 0; slot < pipe.slotColors.length; slot++) {
|
||||||
|
prevSlotColors[slot] = pipe.slotColors[slot];
|
||||||
|
player.sendProgressBarUpdate(this, slot, pipe.slotColors[slot]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates crafting matrix; called from onCraftMatrixChanged. Args: none
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void detectAndSendChanges() {
|
||||||
|
super.detectAndSendChanges();
|
||||||
|
|
||||||
|
for (int i = 0; i < crafters.size(); ++i) {
|
||||||
|
ICrafting player = (ICrafting) crafters.get(i);
|
||||||
|
|
||||||
|
for (int slot = 0; slot < pipe.slotColors.length; slot++) {
|
||||||
|
if (prevSlotColors[slot] != pipe.slotColors[slot])
|
||||||
|
player.sendProgressBarUpdate(this, slot, pipe.slotColors[slot]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
System.arraycopy(pipe.slotColors, 0, prevSlotColors, 0, pipe.slotColors.length);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void updateProgressBar(int id, int data) {
|
||||||
|
paintWidgets[id].colors.setCurrent(data == 0 ? null : EnumColor.fromId(data - 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canInteractWith(EntityPlayer entityplayer) {
|
||||||
|
return pipe.container.isUseableByPlayer(entityplayer);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class PaintWidget extends ButtonWidget {
|
||||||
|
|
||||||
|
private final int slot;
|
||||||
|
private RevolvingList<EnumColor> colors = new RevolvingList<EnumColor>();
|
||||||
|
|
||||||
|
public PaintWidget(int slot, int x, int y) {
|
||||||
|
super(x, y, 176, 0, 20, 20);
|
||||||
|
this.slot = slot;
|
||||||
|
colors.add(null);
|
||||||
|
colors.addAll(Arrays.asList(EnumColor.VALUES));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void draw(GuiBuildCraft gui, int guiX, int guiY, int mouseX, int mouseY) {
|
||||||
|
super.draw(gui, guiX, guiY, mouseX, mouseY);
|
||||||
|
EnumColor color = colors.getCurrent();
|
||||||
|
if (color != null) {
|
||||||
|
gui.bindTexture(TextureMap.locationItemsTexture);
|
||||||
|
gui.drawTexturedModelRectFromIcon(guiX + x + 2, guiY + y + 2, BuildCraftTransport.actionPipeColor[color.ordinal()].getIcon(), 16, 16);
|
||||||
|
} else {
|
||||||
|
gui.drawTexturedModalRect(guiX + x + 2, guiY + y + 2, u, v + h + h, 16, 16);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRelease(int mouseButton) {
|
||||||
|
switch (mouseButton) {
|
||||||
|
case 0:
|
||||||
|
colors.rotateLeft();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
colors.rotateRight();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
colors.setCurrent(null);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
|
||||||
|
DataOutputStream data = new DataOutputStream(bytes);
|
||||||
|
data.writeByte(slot);
|
||||||
|
EnumColor color = colors.getCurrent();
|
||||||
|
data.writeByte(color == null ? 0 : color.ordinal() + 1);
|
||||||
|
PacketGuiReturn pkt = new PacketGuiReturn((IGuiReturnHandler) pipe.getContainer(), bytes.toByteArray());
|
||||||
|
pkt.sendPacket();
|
||||||
|
} catch (IOException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ToolTip getToolTip() {
|
||||||
|
return toolTip;
|
||||||
|
}
|
||||||
|
private ToolTip toolTip = new ToolTip(500) {
|
||||||
|
@Override
|
||||||
|
public void refresh() {
|
||||||
|
toolTip.clear();
|
||||||
|
EnumColor color = colors.getCurrent();
|
||||||
|
if (color != null)
|
||||||
|
toolTip.add(new ToolTipLine(String.format(StringUtils.localize("gui.pipes.emzuli.paint"), color.getLocalizedName())));
|
||||||
|
else
|
||||||
|
toolTip.add(new ToolTipLine(StringUtils.localize("gui.pipes.emzuli.nopaint")));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,49 +0,0 @@
|
||||||
/**
|
|
||||||
* Copyright (c) SpaceToad, 2011 http://www.mod-buildcraft.com
|
|
||||||
*
|
|
||||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public License
|
|
||||||
* 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 buildcraft.core.gui.BuildCraftContainer;
|
|
||||||
import buildcraft.core.gui.slots.SlotPhantom;
|
|
||||||
import buildcraft.transport.pipes.PipeItemsLogemerald;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.inventory.IInventory;
|
|
||||||
import net.minecraft.inventory.Slot;
|
|
||||||
|
|
||||||
public class ContainerLogemeraldPipe extends BuildCraftContainer {
|
|
||||||
|
|
||||||
private final PipeItemsLogemerald logemeraldPipe;
|
|
||||||
|
|
||||||
private final IInventory filterInv;
|
|
||||||
|
|
||||||
public ContainerLogemeraldPipe(IInventory playerInventory, PipeItemsLogemerald pipe) {
|
|
||||||
super(pipe.getFilters().getSizeInventory());
|
|
||||||
|
|
||||||
logemeraldPipe = pipe;
|
|
||||||
filterInv = logemeraldPipe.getFilters();
|
|
||||||
|
|
||||||
addSlotToContainer(new SlotPhantom(filterInv, 0, 44, 21));
|
|
||||||
addSlotToContainer(new SlotPhantom(filterInv, 1, 116, 21));
|
|
||||||
addSlotToContainer(new SlotPhantom(filterInv, 2, 44, 49));
|
|
||||||
addSlotToContainer(new SlotPhantom(filterInv, 3, 116, 49));
|
|
||||||
|
|
||||||
for (int l = 0; l < 3; l++) {
|
|
||||||
for (int k1 = 0; k1 < 9; k1++) {
|
|
||||||
addSlotToContainer(new Slot(playerInventory, k1 + l * 9 + 9, 8 + k1 * 18, 84 + l * 18));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i1 = 0; i1 < 9; i1++) {
|
|
||||||
addSlotToContainer(new Slot(playerInventory, i1, 8 + i1 * 18, 142));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canInteractWith(EntityPlayer entityplayer) {
|
|
||||||
return logemeraldPipe.container.isUseableByPlayer(entityplayer);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -10,43 +10,36 @@ package buildcraft.transport.gui;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
|
||||||
|
|
||||||
import buildcraft.core.DefaultProps;
|
import buildcraft.core.DefaultProps;
|
||||||
import buildcraft.core.gui.GuiBuildCraft;
|
import buildcraft.core.gui.GuiBuildCraft;
|
||||||
import buildcraft.core.utils.StringUtils;
|
import buildcraft.core.utils.StringUtils;
|
||||||
import buildcraft.transport.pipes.PipeItemsLogemerald;
|
import buildcraft.transport.pipes.PipeItemsEmzuli;
|
||||||
|
|
||||||
public class GuiLogemeraldPipe extends GuiBuildCraft {
|
/**
|
||||||
|
*
|
||||||
private static final ResourceLocation TEXTURE = new ResourceLocation("buildcraft", DefaultProps.TEXTURE_PATH_GUI + "/logemerald_pipe_gui.png");
|
* @author SandGrainOne
|
||||||
|
*/
|
||||||
|
public class GuiEmzuliPipe extends GuiBuildCraft {
|
||||||
|
|
||||||
|
private static final ResourceLocation TEXTURE = new ResourceLocation("buildcraft", DefaultProps.TEXTURE_PATH_GUI + "/pipe_emzuli.png");
|
||||||
IInventory filterInventory;
|
IInventory filterInventory;
|
||||||
PipeItemsLogemerald logemeraldPipe;
|
PipeItemsEmzuli pipe;
|
||||||
|
|
||||||
public GuiLogemeraldPipe(IInventory playerInventory, PipeItemsLogemerald pipe) {
|
public GuiEmzuliPipe(IInventory playerInventory, PipeItemsEmzuli pipe) {
|
||||||
super(new ContainerLogemeraldPipe(playerInventory, pipe), pipe.getFilters());
|
super(new ContainerEmzuliPipe(playerInventory, pipe), pipe.getFilters(), TEXTURE);
|
||||||
|
|
||||||
logemeraldPipe = pipe;
|
this.pipe = pipe;
|
||||||
filterInventory = pipe.getFilters();
|
filterInventory = pipe.getFilters();
|
||||||
|
|
||||||
xSize = 175;
|
xSize = 176;
|
||||||
ySize = 166;
|
ySize = 166;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
|
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
|
||||||
String title = StringUtils.localize("gui.pipes.logemerald.title");
|
String title = StringUtils.localize("gui.pipes.emzuli.title");
|
||||||
fontRenderer.drawString(title, (xSize - fontRenderer.getStringWidth(title)) / 2, 6, 0x404040);
|
fontRenderer.drawString(title, (xSize - fontRenderer.getStringWidth(title)) / 2, 6, 0x404040);
|
||||||
fontRenderer.drawString(StringUtils.localize("gui.inventory"), 8, ySize - 93, 0x404040);
|
fontRenderer.drawString(StringUtils.localize("gui.inventory"), 8, ySize - 93, 0x404040);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void drawGuiContainerBackgroundLayer(float f, int x, int y) {
|
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
|
||||||
mc.renderEngine.bindTexture(TEXTURE);
|
|
||||||
int j = (width - xSize) / 2;
|
|
||||||
int k = (height - ySize) / 2;
|
|
||||||
drawTexturedModalRect(j, k, 0, 0, xSize, ySize);
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -9,18 +9,17 @@ package buildcraft.transport.pipes;
|
||||||
|
|
||||||
import buildcraft.BuildCraftTransport;
|
import buildcraft.BuildCraftTransport;
|
||||||
import buildcraft.api.core.IIconProvider;
|
import buildcraft.api.core.IIconProvider;
|
||||||
import buildcraft.api.core.Position;
|
|
||||||
import buildcraft.api.gates.IAction;
|
import buildcraft.api.gates.IAction;
|
||||||
import buildcraft.api.tools.IToolWrench;
|
import buildcraft.api.tools.IToolWrench;
|
||||||
import buildcraft.core.network.TileNetworkData;
|
import buildcraft.core.network.TileNetworkData;
|
||||||
import buildcraft.core.utils.EnumColor;
|
import buildcraft.core.utils.EnumColor;
|
||||||
import buildcraft.transport.IPipeTransportItemsHook;
|
|
||||||
import buildcraft.transport.Pipe;
|
import buildcraft.transport.Pipe;
|
||||||
import buildcraft.transport.PipeIconProvider;
|
import buildcraft.transport.PipeIconProvider;
|
||||||
import buildcraft.transport.PipeTransportItems;
|
import buildcraft.transport.PipeTransportItems;
|
||||||
import buildcraft.transport.TileGenericPipe;
|
import buildcraft.transport.TileGenericPipe;
|
||||||
import buildcraft.transport.TransportConstants;
|
import buildcraft.transport.TransportConstants;
|
||||||
import buildcraft.transport.TravelingItem;
|
import buildcraft.transport.TravelingItem;
|
||||||
|
import buildcraft.transport.pipes.events.PipeEventItem;
|
||||||
import buildcraft.transport.triggers.ActionPipeColor;
|
import buildcraft.transport.triggers.ActionPipeColor;
|
||||||
import buildcraft.transport.triggers.ActionPipeDirection;
|
import buildcraft.transport.triggers.ActionPipeDirection;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
@ -35,12 +34,12 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
|
|
||||||
public class PipeItemsDaizuli extends Pipe<PipeTransportItems> implements IPipeTransportItemsHook {
|
public class PipeItemsDaizuli extends Pipe<PipeTransportItems> {
|
||||||
|
|
||||||
private int standardIconIndex = PipeIconProvider.TYPE.PipeItemsDaizuli_Black.ordinal();
|
private int standardIconIndex = PipeIconProvider.TYPE.PipeItemsDaizuli_Black.ordinal();
|
||||||
private int solidIconIndex = PipeIconProvider.TYPE.PipeAllDaizuli_Solid.ordinal();
|
private int solidIconIndex = PipeIconProvider.TYPE.PipeAllDaizuli_Solid.ordinal();
|
||||||
@TileNetworkData
|
@TileNetworkData
|
||||||
private int color = EnumColor.WHITE.ordinal();
|
private int color = EnumColor.BLACK.ordinal();
|
||||||
private PipeLogicIron logic = new PipeLogicIron(this) {
|
private PipeLogicIron logic = new PipeLogicIron(this) {
|
||||||
@Override
|
@Override
|
||||||
protected boolean isValidConnectingTile(TileEntity tile) {
|
protected boolean isValidConnectingTile(TileEntity tile) {
|
||||||
|
@ -119,33 +118,27 @@ public class PipeItemsDaizuli extends Pipe<PipeTransportItems> implements IPipeT
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void eventHandler(PipeEventItem.FindDest event) {
|
||||||
public LinkedList<ForgeDirection> filterPossibleMovements(LinkedList<ForgeDirection> possibleOrientations, Position pos, TravelingItem item) {
|
ForgeDirection output = ForgeDirection.getOrientation(container.getBlockMetadata());
|
||||||
LinkedList<ForgeDirection> newMovements = new LinkedList<ForgeDirection>();
|
if (event.item.color == getColor() && event.destinations.contains(output)) {
|
||||||
EnumColor c = getColor();
|
event.destinations.clear();
|
||||||
for (ForgeDirection dir : possibleOrientations) {
|
event.destinations.add(output);
|
||||||
if (item.color == c) {
|
return;
|
||||||
if (dir.ordinal() == container.getBlockMetadata())
|
|
||||||
newMovements.add(dir);
|
|
||||||
} else if (dir.ordinal() != container.getBlockMetadata()) {
|
|
||||||
newMovements.add(dir);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return newMovements;
|
event.destinations.remove(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void eventHandler(PipeEventItem.AdjustSpeed event) {
|
||||||
public void entityEntered(TravelingItem item, ForgeDirection orientation) {
|
event.handled = true;
|
||||||
}
|
TravelingItem item = event.item;
|
||||||
|
|
||||||
@Override
|
if (item.getSpeed() > TransportConstants.PIPE_NORMAL_SPEED) {
|
||||||
public void readjustSpeed(TravelingItem item) {
|
|
||||||
if (item.getSpeed() > TransportConstants.PIPE_NORMAL_SPEED)
|
|
||||||
item.setSpeed(item.getSpeed() - TransportConstants.PIPE_NORMAL_SPEED / 4.0F);
|
item.setSpeed(item.getSpeed() - TransportConstants.PIPE_NORMAL_SPEED / 4.0F);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.getSpeed() < TransportConstants.PIPE_NORMAL_SPEED) {
|
||||||
if (item.getSpeed() < TransportConstants.PIPE_NORMAL_SPEED)
|
|
||||||
item.setSpeed(TransportConstants.PIPE_NORMAL_SPEED);
|
item.setSpeed(TransportConstants.PIPE_NORMAL_SPEED);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -21,22 +21,20 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
import buildcraft.BuildCraftTransport;
|
import buildcraft.BuildCraftTransport;
|
||||||
import buildcraft.api.core.IIconProvider;
|
import buildcraft.api.core.IIconProvider;
|
||||||
import buildcraft.api.core.Position;
|
|
||||||
import buildcraft.core.GuiIds;
|
import buildcraft.core.GuiIds;
|
||||||
import buildcraft.core.inventory.SimpleInventory;
|
import buildcraft.core.inventory.SimpleInventory;
|
||||||
import buildcraft.core.inventory.StackHelper;
|
import buildcraft.core.inventory.StackHelper;
|
||||||
import buildcraft.core.network.IClientState;
|
import buildcraft.core.network.IClientState;
|
||||||
import buildcraft.core.proxy.CoreProxy;
|
import buildcraft.core.proxy.CoreProxy;
|
||||||
import buildcraft.transport.BlockGenericPipe;
|
import buildcraft.transport.BlockGenericPipe;
|
||||||
import buildcraft.transport.IPipeTransportItemsHook;
|
|
||||||
import buildcraft.transport.Pipe;
|
import buildcraft.transport.Pipe;
|
||||||
import buildcraft.transport.PipeIconProvider;
|
import buildcraft.transport.PipeIconProvider;
|
||||||
import buildcraft.transport.PipeTransportItems;
|
import buildcraft.transport.PipeTransportItems;
|
||||||
import buildcraft.transport.TravelingItem;
|
import buildcraft.transport.pipes.events.PipeEventItem;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class PipeItemsDiamond extends Pipe<PipeTransportItems> implements IPipeTransportItemsHook, IClientState {
|
public class PipeItemsDiamond extends Pipe<PipeTransportItems> implements IClientState {
|
||||||
|
|
||||||
private SimpleInventory filters = new SimpleInventory(54, "Filters", 1);
|
private SimpleInventory filters = new SimpleInventory(54, "Filters", 1);
|
||||||
|
|
||||||
|
@ -76,6 +74,11 @@ public class PipeItemsDiamond extends Pipe<PipeTransportItems> implements IPipeT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getIconIndexForItem() {
|
||||||
|
return PipeIconProvider.TYPE.PipeItemsDiamond_Item.ordinal();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean blockActivated(EntityPlayer entityplayer) {
|
public boolean blockActivated(EntityPlayer entityplayer) {
|
||||||
if (entityplayer.getCurrentEquippedItem() != null && entityplayer.getCurrentEquippedItem().itemID < Block.blocksList.length)
|
if (entityplayer.getCurrentEquippedItem() != null && entityplayer.getCurrentEquippedItem().itemID < Block.blocksList.length)
|
||||||
|
@ -89,13 +92,12 @@ public class PipeItemsDiamond extends Pipe<PipeTransportItems> implements IPipeT
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void eventHandler(PipeEventItem.FindDest event) {
|
||||||
public LinkedList<ForgeDirection> filterPossibleMovements(LinkedList<ForgeDirection> possibleOrientations, Position pos, TravelingItem item) {
|
|
||||||
LinkedList<ForgeDirection> filteredOrientations = new LinkedList<ForgeDirection>();
|
LinkedList<ForgeDirection> filteredOrientations = new LinkedList<ForgeDirection>();
|
||||||
LinkedList<ForgeDirection> defaultOrientations = new LinkedList<ForgeDirection>();
|
LinkedList<ForgeDirection> defaultOrientations = new LinkedList<ForgeDirection>();
|
||||||
|
|
||||||
// Filtered outputs
|
// Filtered outputs
|
||||||
for (ForgeDirection dir : possibleOrientations) {
|
for (ForgeDirection dir : event.destinations) {
|
||||||
boolean foundFilter = false;
|
boolean foundFilter = false;
|
||||||
|
|
||||||
// NB: if there's several of the same match, the probability
|
// NB: if there's several of the same match, the probability
|
||||||
|
@ -107,29 +109,20 @@ public class PipeItemsDiamond extends Pipe<PipeTransportItems> implements IPipeT
|
||||||
if (filter != null)
|
if (filter != null)
|
||||||
foundFilter = true;
|
foundFilter = true;
|
||||||
|
|
||||||
if (StackHelper.instance().isMatchingItem(filter, item.getItemStack(), true, false))
|
if (StackHelper.instance().isMatchingItem(filter, event.item.getItemStack(), true, false))
|
||||||
filteredOrientations.add(dir);
|
filteredOrientations.add(dir);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (!foundFilter)
|
if (!foundFilter)
|
||||||
defaultOrientations.add(dir);
|
defaultOrientations.add(dir);
|
||||||
}
|
}
|
||||||
|
event.destinations.clear();
|
||||||
if (!filteredOrientations.isEmpty())
|
if (!filteredOrientations.isEmpty())
|
||||||
return filteredOrientations;
|
event.destinations.addAll(filteredOrientations);
|
||||||
|
else
|
||||||
return defaultOrientations;
|
event.destinations.addAll(defaultOrientations);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void entityEntered(TravelingItem item, ForgeDirection orientation) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readjustSpeed(TravelingItem item) {
|
|
||||||
transport.defaultReajustSpeed(item);
|
|
||||||
}
|
|
||||||
/* SAVING & LOADING */
|
/* SAVING & LOADING */
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound nbt) {
|
public void readFromNBT(NBTTagCompound nbt) {
|
||||||
super.readFromNBT(nbt);
|
super.readFromNBT(nbt);
|
||||||
|
|
|
@ -25,27 +25,35 @@ import buildcraft.api.inventory.ISelectiveInventory;
|
||||||
import buildcraft.api.inventory.ISpecialInventory;
|
import buildcraft.api.inventory.ISpecialInventory;
|
||||||
import buildcraft.core.GuiIds;
|
import buildcraft.core.GuiIds;
|
||||||
import buildcraft.core.inventory.SimpleInventory;
|
import buildcraft.core.inventory.SimpleInventory;
|
||||||
|
import buildcraft.core.network.IGuiReturnHandler;
|
||||||
import buildcraft.core.proxy.CoreProxy;
|
import buildcraft.core.proxy.CoreProxy;
|
||||||
import buildcraft.core.utils.EnumColor;
|
import buildcraft.core.utils.EnumColor;
|
||||||
import buildcraft.core.utils.Utils;
|
import buildcraft.core.utils.Utils;
|
||||||
import buildcraft.transport.BlockGenericPipe;
|
import buildcraft.transport.BlockGenericPipe;
|
||||||
import buildcraft.transport.PipeIconProvider;
|
import buildcraft.transport.PipeIconProvider;
|
||||||
import buildcraft.transport.pipes.PipeItemsEmerald.ButtonState;
|
import buildcraft.transport.TravelingItem;
|
||||||
import buildcraft.transport.triggers.ActionExtractionPreset;
|
import buildcraft.transport.triggers.ActionExtractionPreset;
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
public class PipeItemsLogemerald extends PipeItemsWood {
|
/**
|
||||||
|
*
|
||||||
|
* @author SandGrainOne
|
||||||
|
*/
|
||||||
|
public class PipeItemsEmzuli extends PipeItemsWood implements IGuiReturnHandler {
|
||||||
|
|
||||||
|
public final byte[] slotColors = new byte[4];
|
||||||
private final SimpleInventory filters = new SimpleInventory(4, "Filters", 1);
|
private final SimpleInventory filters = new SimpleInventory(4, "Filters", 1);
|
||||||
|
private final BitSet activeFlags = new BitSet(4);
|
||||||
private BitSet activeFlags = new BitSet(4);
|
private final int filterCount = filters.getSizeInventory();
|
||||||
private int filterCount = filters.getSizeInventory();
|
|
||||||
private int currentFilter = 0;
|
private int currentFilter = 0;
|
||||||
|
|
||||||
public PipeItemsLogemerald(int itemID) {
|
public PipeItemsEmzuli(int itemID) {
|
||||||
super(itemID);
|
super(itemID);
|
||||||
|
|
||||||
standardIconIndex = PipeIconProvider.TYPE.PipeItemsLogemerald_Standard.ordinal();
|
standardIconIndex = PipeIconProvider.TYPE.PipeItemsEmzuli_Standard.ordinal();
|
||||||
solidIconIndex = PipeIconProvider.TYPE.PipeAllLogemerald_Solid.ordinal();
|
solidIconIndex = PipeIconProvider.TYPE.PipeAllEmzuli_Solid.ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -66,7 +74,16 @@ public class PipeItemsLogemerald extends PipeItemsWood {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected TravelingItem makeItem(double x, double y, double z, ItemStack stack) {
|
||||||
|
TravelingItem item = super.makeItem(x, y, z, stack);
|
||||||
|
int color = slotColors[currentFilter % filterCount];
|
||||||
|
if (color > 0)
|
||||||
|
item.color = EnumColor.fromId(color - 1);
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the itemstack that can be if something can be extracted from this
|
* Return the itemstack that can be if something can be extracted from this
|
||||||
* inventory, null if none. On certain cases, the extractable slot depends
|
* inventory, null if none. On certain cases, the extractable slot depends
|
||||||
|
@ -75,19 +92,19 @@ public class PipeItemsLogemerald extends PipeItemsWood {
|
||||||
@Override
|
@Override
|
||||||
public ItemStack[] checkExtract(IInventory inventory, boolean doRemove, ForgeDirection from) {
|
public ItemStack[] checkExtract(IInventory inventory, boolean doRemove, ForgeDirection from) {
|
||||||
|
|
||||||
if (activeFlags.isEmpty()){
|
if (activeFlags.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
incrementFilter();
|
incrementFilter();
|
||||||
|
|
||||||
if (filters.getStackInSlot(currentFilter % filterCount) == null || !activeFlags.get(currentFilter % filterCount)){
|
if (filters.getStackInSlot(currentFilter % filterCount) == null || !activeFlags.get(currentFilter % filterCount)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ISELECTIVEINVENTORY */
|
/* ISELECTIVEINVENTORY */
|
||||||
if (inventory instanceof ISelectiveInventory) {
|
if (inventory instanceof ISelectiveInventory) {
|
||||||
ItemStack[] stacks = ((ISelectiveInventory) inventory).extractItem(new ItemStack[] { getCurrentFilter() }, false, doRemove, from, (int) powerHandler.getEnergyStored());
|
ItemStack[] stacks = ((ISelectiveInventory) inventory).extractItem(new ItemStack[]{getCurrentFilter()}, false, doRemove, from, (int) powerHandler.getEnergyStored());
|
||||||
if (doRemove) {
|
if (doRemove) {
|
||||||
for (ItemStack stack : stacks) {
|
for (ItemStack stack : stacks) {
|
||||||
if (stack != null) {
|
if (stack != null) {
|
||||||
|
@ -133,9 +150,9 @@ public class PipeItemsLogemerald extends PipeItemsWood {
|
||||||
// This is a generic inventory
|
// This is a generic inventory
|
||||||
IInventory inv = Utils.getInventory(inventory);
|
IInventory inv = Utils.getInventory(inventory);
|
||||||
ItemStack result = checkExtractGeneric(inv, doRemove, from);
|
ItemStack result = checkExtractGeneric(inv, doRemove, from);
|
||||||
|
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
return new ItemStack[] { result };
|
return new ItemStack[]{result};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,11 +188,11 @@ public class PipeItemsLogemerald extends PipeItemsWood {
|
||||||
public IInventory getFilters() {
|
public IInventory getFilters() {
|
||||||
return filters;
|
return filters;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void actionsActivated(Map<IAction, Boolean> actions) {
|
protected void actionsActivated(Map<IAction, Boolean> actions) {
|
||||||
super.actionsActivated(actions);
|
super.actionsActivated(actions);
|
||||||
|
|
||||||
activeFlags.clear();
|
activeFlags.clear();
|
||||||
|
|
||||||
for (Entry<IAction, Boolean> action : actions.entrySet()) {
|
for (Entry<IAction, Boolean> action : actions.entrySet()) {
|
||||||
|
@ -186,28 +203,28 @@ public class PipeItemsLogemerald extends PipeItemsWood {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setActivePreset(EnumColor color) {
|
private void setActivePreset(EnumColor color) {
|
||||||
switch (color){
|
switch (color) {
|
||||||
case RED:
|
case RED:
|
||||||
activeFlags.set(0);
|
activeFlags.set(0);
|
||||||
break;
|
break;
|
||||||
case BLUE:
|
case BLUE:
|
||||||
activeFlags.set(1);
|
activeFlags.set(1);
|
||||||
break;
|
break;
|
||||||
case GREEN:
|
case GREEN:
|
||||||
activeFlags.set(2);
|
activeFlags.set(2);
|
||||||
break;
|
break;
|
||||||
case YELLOW:
|
case YELLOW:
|
||||||
activeFlags.set(3);
|
activeFlags.set(3);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LinkedList<IAction> getActions() {
|
public LinkedList<IAction> getActions() {
|
||||||
LinkedList<IAction> result = super.getActions();
|
LinkedList<IAction> result = super.getActions();
|
||||||
|
|
||||||
result.add(BuildCraftTransport.actionExtractionPresetRed);
|
result.add(BuildCraftTransport.actionExtractionPresetRed);
|
||||||
result.add(BuildCraftTransport.actionExtractionPresetBlue);
|
result.add(BuildCraftTransport.actionExtractionPresetBlue);
|
||||||
result.add(BuildCraftTransport.actionExtractionPresetGreen);
|
result.add(BuildCraftTransport.actionExtractionPresetGreen);
|
||||||
|
@ -216,11 +233,24 @@ public class PipeItemsLogemerald extends PipeItemsWood {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeGuiData(DataOutputStream paramDataOutputStream) throws IOException {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readGuiData(DataInputStream data, EntityPlayer paramEntityPlayer) throws IOException {
|
||||||
|
byte slot = data.readByte();
|
||||||
|
slotColors[slot] = data.readByte();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound nbt) {
|
public void readFromNBT(NBTTagCompound nbt) {
|
||||||
super.readFromNBT(nbt);
|
super.readFromNBT(nbt);
|
||||||
filters.readFromNBT(nbt);
|
filters.readFromNBT(nbt);
|
||||||
currentFilter = nbt.getInteger("currentFilter");
|
currentFilter = nbt.getInteger("currentFilter");
|
||||||
|
for (int slot = 0; slot < slotColors.length; slot++) {
|
||||||
|
slotColors[slot] = nbt.getByte("slotColors[" + slot + "]");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -228,19 +258,22 @@ public class PipeItemsLogemerald extends PipeItemsWood {
|
||||||
super.writeToNBT(nbt);
|
super.writeToNBT(nbt);
|
||||||
filters.writeToNBT(nbt);
|
filters.writeToNBT(nbt);
|
||||||
nbt.setInteger("currentFilter", currentFilter);
|
nbt.setInteger("currentFilter", currentFilter);
|
||||||
|
for (int slot = 0; slot < slotColors.length; slot++) {
|
||||||
|
nbt.setByte("slotColors[" + slot + "]", slotColors[slot]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void incrementFilter() {
|
private void incrementFilter() {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
currentFilter++;
|
currentFilter++;
|
||||||
|
|
||||||
while (!(filters.getStackInSlot(currentFilter % filterCount) != null && activeFlags.get(currentFilter % filterCount)) && count < filterCount) {
|
while (!(filters.getStackInSlot(currentFilter % filterCount) != null && activeFlags.get(currentFilter % filterCount)) && count < filterCount) {
|
||||||
currentFilter++;
|
currentFilter++;
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ItemStack getCurrentFilter() {
|
private ItemStack getCurrentFilter() {
|
||||||
return filters.getStackInSlot(currentFilter % filters.getSizeInventory());
|
return filters.getStackInSlot(currentFilter % filters.getSizeInventory());
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -9,19 +9,17 @@ package buildcraft.transport.pipes;
|
||||||
|
|
||||||
import buildcraft.BuildCraftTransport;
|
import buildcraft.BuildCraftTransport;
|
||||||
import buildcraft.api.core.IIconProvider;
|
import buildcraft.api.core.IIconProvider;
|
||||||
import buildcraft.api.core.Position;
|
|
||||||
import buildcraft.transport.IPipeTransportItemsHook;
|
|
||||||
import buildcraft.transport.Pipe;
|
import buildcraft.transport.Pipe;
|
||||||
import buildcraft.transport.PipeIconProvider;
|
import buildcraft.transport.PipeIconProvider;
|
||||||
import buildcraft.transport.PipeTransportItems;
|
import buildcraft.transport.PipeTransportItems;
|
||||||
import buildcraft.transport.TransportConstants;
|
import buildcraft.transport.TransportConstants;
|
||||||
import buildcraft.transport.TravelingItem;
|
import buildcraft.transport.TravelingItem;
|
||||||
|
import buildcraft.transport.pipes.events.PipeEventItem;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import java.util.LinkedList;
|
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
|
|
||||||
public class PipeItemsGold extends Pipe implements IPipeTransportItemsHook {
|
public class PipeItemsGold extends Pipe {
|
||||||
|
|
||||||
public PipeItemsGold(int itemID) {
|
public PipeItemsGold(int itemID) {
|
||||||
super(new PipeTransportItems(), itemID);
|
super(new PipeTransportItems(), itemID);
|
||||||
|
@ -38,18 +36,9 @@ public class PipeItemsGold extends Pipe implements IPipeTransportItemsHook {
|
||||||
return PipeIconProvider.TYPE.PipeItemsGold.ordinal();
|
return PipeIconProvider.TYPE.PipeItemsGold.ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void handleEvent(PipeEventItem.AdjustSpeed event) {
|
||||||
public LinkedList<ForgeDirection> filterPossibleMovements(LinkedList<ForgeDirection> possibleOrientations, Position pos, TravelingItem item) {
|
event.handled = true;
|
||||||
return possibleOrientations;
|
TravelingItem item = event.item;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void entityEntered(TravelingItem item, ForgeDirection orientation) {
|
|
||||||
readjustSpeed(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readjustSpeed(TravelingItem item) {
|
|
||||||
item.setSpeed(Math.min(Math.max(TransportConstants.PIPE_NORMAL_SPEED, item.getSpeed()) * 2f, TransportConstants.PIPE_NORMAL_SPEED * 20F));
|
item.setSpeed(Math.min(Math.max(TransportConstants.PIPE_NORMAL_SPEED, item.getSpeed()) * 2f, TransportConstants.PIPE_NORMAL_SPEED * 20F));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,17 +9,15 @@ package buildcraft.transport.pipes;
|
||||||
|
|
||||||
import buildcraft.BuildCraftTransport;
|
import buildcraft.BuildCraftTransport;
|
||||||
import buildcraft.api.core.IIconProvider;
|
import buildcraft.api.core.IIconProvider;
|
||||||
import buildcraft.api.core.Position;
|
|
||||||
import buildcraft.api.gates.IAction;
|
import buildcraft.api.gates.IAction;
|
||||||
import buildcraft.api.tools.IToolWrench;
|
import buildcraft.api.tools.IToolWrench;
|
||||||
import buildcraft.core.utils.EnumColor;
|
import buildcraft.core.utils.EnumColor;
|
||||||
import buildcraft.transport.IItemTravelingHook;
|
|
||||||
import buildcraft.transport.IPipeTransportItemsHook;
|
|
||||||
import buildcraft.transport.Pipe;
|
import buildcraft.transport.Pipe;
|
||||||
import buildcraft.transport.PipeIconProvider;
|
import buildcraft.transport.PipeIconProvider;
|
||||||
import buildcraft.transport.PipeTransportItems;
|
import buildcraft.transport.PipeTransportItems;
|
||||||
import buildcraft.transport.TransportConstants;
|
import buildcraft.transport.TransportConstants;
|
||||||
import buildcraft.transport.TravelingItem;
|
import buildcraft.transport.TravelingItem;
|
||||||
|
import buildcraft.transport.pipes.events.PipeEventItem;
|
||||||
import buildcraft.transport.triggers.ActionPipeColor;
|
import buildcraft.transport.triggers.ActionPipeColor;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
@ -29,14 +27,12 @@ import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
|
|
||||||
public class PipeItemsLapis extends Pipe<PipeTransportItems> implements IItemTravelingHook, IPipeTransportItemsHook {
|
public class PipeItemsLapis extends Pipe<PipeTransportItems> {
|
||||||
|
|
||||||
public PipeItemsLapis(int itemID) {
|
public PipeItemsLapis(int itemID) {
|
||||||
super(new PipeTransportItems(), itemID);
|
super(new PipeTransportItems(), itemID);
|
||||||
transport.travelHook = this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -48,7 +44,7 @@ public class PipeItemsLapis extends Pipe<PipeTransportItems> implements IItemTra
|
||||||
@Override
|
@Override
|
||||||
public int getIconIndex(ForgeDirection direction) {
|
public int getIconIndex(ForgeDirection direction) {
|
||||||
if (container == null)
|
if (container == null)
|
||||||
return PipeIconProvider.TYPE.PipeItemsLapis_White.ordinal();
|
return PipeIconProvider.TYPE.PipeItemsLapis_Black.ordinal();
|
||||||
return PipeIconProvider.TYPE.PipeItemsLapis_Black.ordinal() + container.getBlockMetadata();
|
return PipeIconProvider.TYPE.PipeItemsLapis_Black.ordinal() + container.getBlockMetadata();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,22 +76,14 @@ public class PipeItemsLapis extends Pipe<PipeTransportItems> implements IItemTra
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void eventHandler(PipeEventItem.ReachedCenter event) {
|
||||||
public void drop(PipeTransportItems transport, TravelingItem data) {
|
event.item.color = getColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void eventHandler(PipeEventItem.AdjustSpeed event) {
|
||||||
public void centerReached(PipeTransportItems transport, TravelingItem item) {
|
event.handled = true;
|
||||||
item.color = getColor();
|
TravelingItem item = event.item;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean endReached(PipeTransportItems pipe, TravelingItem item, TileEntity tile) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readjustSpeed(TravelingItem item) {
|
|
||||||
if (item.getSpeed() > TransportConstants.PIPE_NORMAL_SPEED) {
|
if (item.getSpeed() > TransportConstants.PIPE_NORMAL_SPEED) {
|
||||||
item.setSpeed(item.getSpeed() - TransportConstants.PIPE_NORMAL_SPEED / 4.0F);
|
item.setSpeed(item.getSpeed() - TransportConstants.PIPE_NORMAL_SPEED / 4.0F);
|
||||||
}
|
}
|
||||||
|
@ -105,15 +93,6 @@ public class PipeItemsLapis extends Pipe<PipeTransportItems> implements IItemTra
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public LinkedList<ForgeDirection> filterPossibleMovements(LinkedList<ForgeDirection> possibleOrientations, Position pos, TravelingItem travellingItem) {
|
|
||||||
return possibleOrientations;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void entityEntered(TravelingItem travellingItem, ForgeDirection orientation) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void actionsActivated(Map<IAction, Boolean> actions) {
|
protected void actionsActivated(Map<IAction, Boolean> actions) {
|
||||||
super.actionsActivated(actions);
|
super.actionsActivated(actions);
|
||||||
|
|
|
@ -22,6 +22,8 @@ import buildcraft.core.proxy.CoreProxy;
|
||||||
import buildcraft.transport.Pipe;
|
import buildcraft.transport.Pipe;
|
||||||
import buildcraft.transport.PipeIconProvider;
|
import buildcraft.transport.PipeIconProvider;
|
||||||
import buildcraft.transport.PipeTransportItems;
|
import buildcraft.transport.PipeTransportItems;
|
||||||
|
import buildcraft.transport.pipes.events.PipeEvent;
|
||||||
|
import buildcraft.transport.pipes.events.PipeEventItem;
|
||||||
import buildcraft.transport.utils.TransportUtils;
|
import buildcraft.transport.utils.TransportUtils;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
@ -234,15 +236,12 @@ public class PipeItemsObsidian extends Pipe<PipeTransportItems> implements IPowe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void eventHandler(PipeEventItem.DropItem event) {
|
||||||
public void onDropped(EntityItem item) {
|
if (entitiesDroppedIndex + 1 >= entitiesDropped.length)
|
||||||
if (entitiesDroppedIndex + 1 >= entitiesDropped.length) {
|
|
||||||
entitiesDroppedIndex = 0;
|
entitiesDroppedIndex = 0;
|
||||||
} else {
|
else
|
||||||
entitiesDroppedIndex++;
|
entitiesDroppedIndex++;
|
||||||
}
|
entitiesDropped[entitiesDroppedIndex] = event.entity.entityId;
|
||||||
|
|
||||||
entitiesDropped[entitiesDroppedIndex] = item.entityId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canSuck(Entity entity, int distance) {
|
public boolean canSuck(Entity entity, int distance) {
|
||||||
|
|
|
@ -9,19 +9,17 @@ package buildcraft.transport.pipes;
|
||||||
|
|
||||||
import buildcraft.BuildCraftTransport;
|
import buildcraft.BuildCraftTransport;
|
||||||
import buildcraft.api.core.IIconProvider;
|
import buildcraft.api.core.IIconProvider;
|
||||||
import buildcraft.api.core.Position;
|
|
||||||
import buildcraft.transport.IPipeTransportItemsHook;
|
|
||||||
import buildcraft.transport.Pipe;
|
import buildcraft.transport.Pipe;
|
||||||
import buildcraft.transport.PipeIconProvider;
|
import buildcraft.transport.PipeIconProvider;
|
||||||
import buildcraft.transport.PipeTransportItems;
|
import buildcraft.transport.PipeTransportItems;
|
||||||
import buildcraft.transport.TransportConstants;
|
import buildcraft.transport.TransportConstants;
|
||||||
import buildcraft.transport.TravelingItem;
|
import buildcraft.transport.TravelingItem;
|
||||||
|
import buildcraft.transport.pipes.events.PipeEventItem;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import java.util.LinkedList;
|
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
|
|
||||||
public class PipeItemsQuartz extends Pipe implements IPipeTransportItemsHook {
|
public class PipeItemsQuartz extends Pipe {
|
||||||
|
|
||||||
public PipeItemsQuartz(int itemID) {
|
public PipeItemsQuartz(int itemID) {
|
||||||
super(new PipeTransportItems(), itemID);
|
super(new PipeTransportItems(), itemID);
|
||||||
|
@ -39,8 +37,10 @@ public class PipeItemsQuartz extends Pipe implements IPipeTransportItemsHook {
|
||||||
return PipeIconProvider.TYPE.PipeItemsQuartz.ordinal();
|
return PipeIconProvider.TYPE.PipeItemsQuartz.ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void eventHandler(PipeEventItem.AdjustSpeed event) {
|
||||||
public void readjustSpeed(TravelingItem item) {
|
event.handled = true;
|
||||||
|
TravelingItem item = event.item;
|
||||||
|
|
||||||
if (item.getSpeed() > TransportConstants.PIPE_NORMAL_SPEED) {
|
if (item.getSpeed() > TransportConstants.PIPE_NORMAL_SPEED) {
|
||||||
item.setSpeed(item.getSpeed() - TransportConstants.PIPE_NORMAL_SPEED / 4.0F);
|
item.setSpeed(item.getSpeed() - TransportConstants.PIPE_NORMAL_SPEED / 4.0F);
|
||||||
}
|
}
|
||||||
|
@ -49,13 +49,4 @@ public class PipeItemsQuartz extends Pipe implements IPipeTransportItemsHook {
|
||||||
item.setSpeed(TransportConstants.PIPE_NORMAL_SPEED);
|
item.setSpeed(TransportConstants.PIPE_NORMAL_SPEED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public LinkedList<ForgeDirection> filterPossibleMovements(LinkedList<ForgeDirection> possibleOrientations, Position pos, TravelingItem item) {
|
|
||||||
return possibleOrientations;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void entityEntered(TravelingItem item, ForgeDirection orientation) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,19 +9,17 @@ package buildcraft.transport.pipes;
|
||||||
|
|
||||||
import buildcraft.BuildCraftTransport;
|
import buildcraft.BuildCraftTransport;
|
||||||
import buildcraft.api.core.IIconProvider;
|
import buildcraft.api.core.IIconProvider;
|
||||||
import buildcraft.api.core.Position;
|
|
||||||
import buildcraft.transport.IPipeTransportItemsHook;
|
|
||||||
import buildcraft.transport.Pipe;
|
import buildcraft.transport.Pipe;
|
||||||
import buildcraft.transport.PipeIconProvider;
|
import buildcraft.transport.PipeIconProvider;
|
||||||
import buildcraft.transport.PipeTransportItems;
|
import buildcraft.transport.PipeTransportItems;
|
||||||
import buildcraft.transport.TransportConstants;
|
import buildcraft.transport.TransportConstants;
|
||||||
import buildcraft.transport.TravelingItem;
|
import buildcraft.transport.TravelingItem;
|
||||||
|
import buildcraft.transport.pipes.events.PipeEventItem;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import java.util.LinkedList;
|
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
|
|
||||||
public class PipeItemsStone extends Pipe implements IPipeTransportItemsHook {
|
public class PipeItemsStone extends Pipe {
|
||||||
|
|
||||||
public PipeItemsStone(int itemID) {
|
public PipeItemsStone(int itemID) {
|
||||||
super(new PipeTransportItems(), itemID);
|
super(new PipeTransportItems(), itemID);
|
||||||
|
@ -38,8 +36,10 @@ public class PipeItemsStone extends Pipe implements IPipeTransportItemsHook {
|
||||||
return PipeIconProvider.TYPE.PipeItemsStone.ordinal();
|
return PipeIconProvider.TYPE.PipeItemsStone.ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void eventHandler(PipeEventItem.AdjustSpeed event) {
|
||||||
public void readjustSpeed(TravelingItem item) {
|
event.handled = true;
|
||||||
|
TravelingItem item = event.item;
|
||||||
|
|
||||||
if (item.getSpeed() > TransportConstants.PIPE_NORMAL_SPEED) {
|
if (item.getSpeed() > TransportConstants.PIPE_NORMAL_SPEED) {
|
||||||
item.setSpeed(item.getSpeed() - TransportConstants.PIPE_NORMAL_SPEED / 2.0F);
|
item.setSpeed(item.getSpeed() - TransportConstants.PIPE_NORMAL_SPEED / 2.0F);
|
||||||
}
|
}
|
||||||
|
@ -48,13 +48,4 @@ public class PipeItemsStone extends Pipe implements IPipeTransportItemsHook {
|
||||||
item.setSpeed(TransportConstants.PIPE_NORMAL_SPEED);
|
item.setSpeed(TransportConstants.PIPE_NORMAL_SPEED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public LinkedList<ForgeDirection> filterPossibleMovements(LinkedList<ForgeDirection> possibleOrientations, Position pos, TravelingItem item) {
|
|
||||||
return possibleOrientations;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void entityEntered(TravelingItem item, ForgeDirection orientation) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,21 +9,18 @@ package buildcraft.transport.pipes;
|
||||||
|
|
||||||
import buildcraft.BuildCraftTransport;
|
import buildcraft.BuildCraftTransport;
|
||||||
import buildcraft.api.core.IIconProvider;
|
import buildcraft.api.core.IIconProvider;
|
||||||
import buildcraft.transport.IItemTravelingHook;
|
|
||||||
import buildcraft.transport.Pipe;
|
import buildcraft.transport.Pipe;
|
||||||
import buildcraft.transport.PipeIconProvider;
|
import buildcraft.transport.PipeIconProvider;
|
||||||
import buildcraft.transport.PipeTransportItems;
|
import buildcraft.transport.PipeTransportItems;
|
||||||
import buildcraft.transport.TravelingItem;
|
import buildcraft.transport.pipes.events.PipeEventItem;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
|
|
||||||
public class PipeItemsVoid extends Pipe<PipeTransportItems> implements IItemTravelingHook {
|
public class PipeItemsVoid extends Pipe<PipeTransportItems> {
|
||||||
|
|
||||||
public PipeItemsVoid(int itemID) {
|
public PipeItemsVoid(int itemID) {
|
||||||
super(new PipeTransportItems(), itemID);
|
super(new PipeTransportItems(), itemID);
|
||||||
transport.travelHook = this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -37,20 +34,11 @@ public class PipeItemsVoid extends Pipe<PipeTransportItems> implements IItemTrav
|
||||||
return PipeIconProvider.TYPE.PipeItemsVoid.ordinal();
|
return PipeIconProvider.TYPE.PipeItemsVoid.ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is called if the void pipe is only connected to one pipe
|
public void handleEvent(PipeEventItem.DropItem event) {
|
||||||
@Override
|
event.entity = null;
|
||||||
public void drop(PipeTransportItems pipe, TravelingItem item) {
|
|
||||||
item.getItemStack().stackSize = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is called when the void pipe is connected to multiple pipes
|
public void handleEvent(PipeEventItem.ReachedCenter event) {
|
||||||
@Override
|
transport.items.scheduleRemoval(event.item);
|
||||||
public void centerReached(PipeTransportItems pipe, TravelingItem item) {
|
|
||||||
transport.items.scheduleRemoval(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean endReached(PipeTransportItems pipe, TravelingItem item, TileEntity tile) {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,13 +139,17 @@ public class PipeItemsWood extends Pipe<PipeTransportItems> implements IPowerRec
|
||||||
|
|
||||||
entityPos.moveForwards(0.6);
|
entityPos.moveForwards(0.6);
|
||||||
|
|
||||||
TravelingItem entity = new TravelingItem(entityPos.x, entityPos.y, entityPos.z, stack);
|
TravelingItem entity = makeItem(entityPos.x, entityPos.y, entityPos.z, stack);
|
||||||
|
|
||||||
transport.injectItem(entity, entityPos.orientation);
|
transport.injectItem(entity, entityPos.orientation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected TravelingItem makeItem(double x, double y, double z, ItemStack stack) {
|
||||||
|
return new TravelingItem(x, y, z, stack);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the itemstack that can be if something can be extracted from this
|
* Return the itemstack that can be if something can be extracted from this
|
||||||
* inventory, null if none. On certain cases, the extractable slot depends
|
* inventory, null if none. On certain cases, the extractable slot depends
|
||||||
|
|
16
common/buildcraft/transport/pipes/events/PipeEvent.java
Normal file
16
common/buildcraft/transport/pipes/events/PipeEvent.java
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) SpaceToad, 2011-2012
|
||||||
|
* http://www.mod-buildcraft.com
|
||||||
|
*
|
||||||
|
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||||
|
* License 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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author CovertJaguar <http://www.railcraft.info/>
|
||||||
|
*/
|
||||||
|
public abstract class PipeEvent {
|
||||||
|
}
|
84
common/buildcraft/transport/pipes/events/PipeEventItem.java
Normal file
84
common/buildcraft/transport/pipes/events/PipeEventItem.java
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) SpaceToad, 2011-2012
|
||||||
|
* http://www.mod-buildcraft.com
|
||||||
|
*
|
||||||
|
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||||
|
* License 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.TravelingItem;
|
||||||
|
import java.util.List;
|
||||||
|
import net.minecraft.entity.item.EntityItem;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author CovertJaguar <http://www.railcraft.info/>
|
||||||
|
*/
|
||||||
|
public abstract class PipeEventItem extends PipeEvent {
|
||||||
|
|
||||||
|
public final TravelingItem item;
|
||||||
|
|
||||||
|
public PipeEventItem(TravelingItem item) {
|
||||||
|
this.item = item;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Entered extends PipeEventItem {
|
||||||
|
|
||||||
|
public boolean cancelled = false;
|
||||||
|
|
||||||
|
public Entered(TravelingItem item) {
|
||||||
|
super(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ReachedCenter extends PipeEventItem {
|
||||||
|
|
||||||
|
public ReachedCenter(TravelingItem item) {
|
||||||
|
super(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ReachedEnd extends PipeEventItem {
|
||||||
|
|
||||||
|
public final TileEntity dest;
|
||||||
|
public boolean handled = false;
|
||||||
|
|
||||||
|
public ReachedEnd(TravelingItem item, TileEntity dest) {
|
||||||
|
super(item);
|
||||||
|
this.dest = dest;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class DropItem extends PipeEventItem {
|
||||||
|
|
||||||
|
public EntityItem entity;
|
||||||
|
|
||||||
|
public DropItem(TravelingItem item, EntityItem entity) {
|
||||||
|
super(item);
|
||||||
|
this.entity = entity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class FindDest extends PipeEventItem {
|
||||||
|
|
||||||
|
public final List<ForgeDirection> destinations;
|
||||||
|
|
||||||
|
public FindDest(TravelingItem item, List<ForgeDirection> destinations) {
|
||||||
|
super(item);
|
||||||
|
this.destinations = destinations;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class AdjustSpeed extends PipeEventItem {
|
||||||
|
|
||||||
|
public boolean handled = false;
|
||||||
|
|
||||||
|
public AdjustSpeed(TravelingItem item) {
|
||||||
|
super(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -9,6 +9,7 @@ package buildcraft.transport.triggers;
|
||||||
|
|
||||||
import buildcraft.core.triggers.BCAction;
|
import buildcraft.core.triggers.BCAction;
|
||||||
import buildcraft.core.utils.EnumColor;
|
import buildcraft.core.utils.EnumColor;
|
||||||
|
import buildcraft.core.utils.StringUtils;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import net.minecraft.client.renderer.texture.IconRegister;
|
import net.minecraft.client.renderer.texture.IconRegister;
|
||||||
import net.minecraft.util.Icon;
|
import net.minecraft.util.Icon;
|
||||||
|
@ -26,7 +27,7 @@ public class ActionPipeColor extends BCAction {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return color.getName() + " Pipe Color";
|
return String.format(StringUtils.localize("gate.pipe.item.color"), color.getLocalizedName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Add table
Reference in a new issue