mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-22 13:10:13 +00:00
Compare commits
26
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a2da1c4832 | ||
|
|
a40e48f5d8 | ||
|
|
0e7bf1c530 | ||
|
|
81ac330ec8 | ||
|
|
c08af8ef02 | ||
|
|
15ed039813 | ||
|
|
a217fd3699 | ||
|
|
246a6d8f0a | ||
|
|
b652b79e61 | ||
|
|
27a0a443a2 | ||
|
|
c7a334c913 | ||
|
|
f512b210a5 | ||
|
|
e2b41a49c3 | ||
|
|
7f89eba8b5 | ||
|
|
76dabdf493 | ||
|
|
41c51754bb | ||
|
|
472b3649e1 | ||
|
|
806d162b19 | ||
|
|
ad1f98b03e | ||
|
|
f9bc80ef91 | ||
|
|
8807be5887 | ||
|
|
026a36d51d | ||
|
|
c6c539ea13 | ||
|
|
983a76dd1d | ||
|
|
f492c45f50 | ||
|
|
3093ea6180 |
No files matched your search
+1
-1
@@ -2,7 +2,7 @@ minecraft_version=1.7.10
|
||||
forge_version=10.13.4.1614-1.7.10
|
||||
forgeDep_version=10.13.4.1614
|
||||
|
||||
mod_version=2.3.1.13_beta
|
||||
mod_version=2.3.1.16_beta
|
||||
|
||||
#Comment out this line to get rid of the appendix
|
||||
#mod_appendix=beta
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import crazypants.enderio.conduit.gui.*;
|
||||
import mods.immibis.core.api.multipart.IMultipartRenderingBlockMarker;
|
||||
import mods.immibis.core.api.multipart.IMultipartSystem;
|
||||
import net.minecraft.block.Block;
|
||||
@@ -51,12 +52,6 @@ import crazypants.enderio.api.tool.ITool;
|
||||
import crazypants.enderio.conduit.facade.ItemConduitFacade.FacadeType;
|
||||
import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
import crazypants.enderio.conduit.geom.ConduitConnectorType;
|
||||
import crazypants.enderio.conduit.gui.ExternalConnectionContainer;
|
||||
import crazypants.enderio.conduit.gui.GuiExternalConnection;
|
||||
import crazypants.enderio.conduit.gui.GuiExternalConnectionSelector;
|
||||
import crazypants.enderio.conduit.gui.PacketFluidFilter;
|
||||
import crazypants.enderio.conduit.gui.PacketOpenConduitUI;
|
||||
import crazypants.enderio.conduit.gui.PacketSlotVisibility;
|
||||
import crazypants.enderio.conduit.gui.item.PacketExistingItemFilterSnapshot;
|
||||
import crazypants.enderio.conduit.gui.item.PacketModItemFilter;
|
||||
import crazypants.enderio.conduit.liquid.PacketFluidLevel;
|
||||
@@ -66,6 +61,7 @@ import crazypants.enderio.conduit.packet.PacketItemConduitFilter;
|
||||
import crazypants.enderio.conduit.packet.PacketOCConduitSignalColor;
|
||||
import crazypants.enderio.conduit.packet.PacketRedstoneConduitOutputStrength;
|
||||
import crazypants.enderio.conduit.packet.PacketRedstoneConduitSignalColor;
|
||||
import crazypants.enderio.conduit.packet.PacketRoundRobinMode;
|
||||
import crazypants.enderio.conduit.redstone.IInsulatedRedstoneConduit;
|
||||
import crazypants.enderio.conduit.redstone.IRedstoneConduit;
|
||||
import crazypants.enderio.conduit.redstone.InsulatedRedstoneConduit;
|
||||
@@ -97,6 +93,7 @@ public class BlockConduitBundle extends BlockEio implements IGuiHandler, IFacade
|
||||
PacketHandler.INSTANCE.registerMessage(PacketExistingItemFilterSnapshot.class, PacketExistingItemFilterSnapshot.class, PacketHandler.nextID(), Side.SERVER);
|
||||
PacketHandler.INSTANCE.registerMessage(PacketModItemFilter.class, PacketModItemFilter.class, PacketHandler.nextID(), Side.SERVER);
|
||||
PacketHandler.INSTANCE.registerMessage(PacketFluidFilter.class, PacketFluidFilter.class, PacketHandler.nextID(), Side.SERVER);
|
||||
PacketHandler.INSTANCE.registerMessage(PacketFluidChannel.class, PacketFluidChannel.class, PacketHandler.nextID(), Side.SERVER);
|
||||
PacketHandler.INSTANCE.registerMessage(PacketRedstoneConduitSignalColor.class, PacketRedstoneConduitSignalColor.class, PacketHandler.nextID(), Side.SERVER);
|
||||
PacketHandler.INSTANCE.registerMessage(PacketRedstoneConduitOutputStrength.class, PacketRedstoneConduitOutputStrength.class, PacketHandler.nextID(),
|
||||
Side.SERVER);
|
||||
@@ -104,6 +101,7 @@ public class BlockConduitBundle extends BlockEio implements IGuiHandler, IFacade
|
||||
PacketHandler.INSTANCE.registerMessage(PacketSlotVisibility.class, PacketSlotVisibility.class, PacketHandler.nextID(), Side.SERVER);
|
||||
PacketHandler.INSTANCE.registerMessage(PacketOCConduitSignalColor.class, PacketOCConduitSignalColor.class,
|
||||
PacketHandler.nextID(), Side.SERVER);
|
||||
PacketHandler.INSTANCE.registerMessage(PacketRoundRobinMode.class, PacketRoundRobinMode.class, PacketHandler.nextID(), Side.SERVER);
|
||||
|
||||
BlockConduitBundle result = new BlockConduitBundle();
|
||||
result.init();
|
||||
|
||||
@@ -19,6 +19,8 @@ import mods.immibis.microblocks.api.IMicroblockSystem;
|
||||
import mods.immibis.microblocks.api.MicroblockAPIUtils;
|
||||
import mods.immibis.microblocks.api.Part;
|
||||
import mods.immibis.microblocks.api.PartType;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -162,7 +164,19 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
facadeMeta = nbtRoot.getInteger("facadeMeta");
|
||||
|
||||
if(worldObj != null && worldObj.isRemote) {
|
||||
clientUpdated = true;
|
||||
if (conduits.size() == 1 && conduits.get(0) instanceof IItemConduit) {
|
||||
boolean itemConduitClientUpdated = false;
|
||||
for (Object o : Minecraft.getMinecraft().theWorld.playerEntities) {
|
||||
Entity e = ((Entity) o);
|
||||
if (e.getDistanceSq(this.xCoord, yCoord, zCoord) < 36) {
|
||||
itemConduitClientUpdated = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (itemConduitClientUpdated) clientUpdated = true;
|
||||
} else {
|
||||
clientUpdated = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (MicroblocksUtil.supportMicroblocks()) {
|
||||
|
||||
@@ -5,6 +5,8 @@ import java.awt.Rectangle;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.enderio.core.client.gui.button.ToggleButton;
|
||||
import crazypants.enderio.conduit.packet.PacketRoundRobinMode;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
@@ -41,12 +43,17 @@ public class LiquidSettings extends BaseSettingsPanel {
|
||||
static final int ID_REDSTONE_BUTTON = GuiExternalConnection.nextButtonId();
|
||||
|
||||
private static final int ID_COLOR_BUTTON = GuiExternalConnection.nextButtonId();
|
||||
private static final int ID_ROUND_ROBIN_BUTTON = GuiExternalConnection.nextButtonId();
|
||||
private static final int ID_WHITELIST = GuiExternalConnection.nextButtonId();
|
||||
|
||||
private static final int NEXT_FILTER_ID = 989322;
|
||||
|
||||
private static final int ID_CHANNEL = GuiExternalConnection.nextButtonId();
|
||||
|
||||
private final RedstoneModeButton rsB;
|
||||
private final ToggleButton roundRobinB;
|
||||
private final ColorButton colorB;
|
||||
private ColorButton channelB;
|
||||
|
||||
private static final String autoExtractStr = EnderIO.lang.localize("gui.conduit.fluid.autoExtract");
|
||||
private static final String filterStr = EnderIO.lang.localize("gui.conduit.fluid.filter");
|
||||
@@ -72,9 +79,11 @@ public class LiquidSettings extends BaseSettingsPanel {
|
||||
eConduit = (EnderLiquidConduit) con;
|
||||
isEnder = true;
|
||||
|
||||
int x = gui.getXSize() - 20;
|
||||
|
||||
int x = 52;
|
||||
int y = customTop;
|
||||
|
||||
|
||||
inOutNextB = MultiIconButton.createRightArrowButton(gui, NEXT_FILTER_ID, x, y);
|
||||
|
||||
x = filterX - 20;
|
||||
@@ -87,9 +96,17 @@ public class LiquidSettings extends BaseSettingsPanel {
|
||||
gui.getContainer().setInventorySlotsVisible(false);
|
||||
}
|
||||
|
||||
int x = gap + gui.getFontRenderer().getStringWidth(autoExtractStr) + gap * 2;
|
||||
int x = 66;
|
||||
int y = customTop;
|
||||
|
||||
if(isEnder)
|
||||
{
|
||||
channelB = new ColorButton(gui, ID_CHANNEL, x, y);
|
||||
channelB.setColorIndex(0);
|
||||
channelB.setToolTipHeading(EnderIO.lang.localize("gui.conduit.item.channel"));
|
||||
x += channelB.getWidth() + gap;
|
||||
}
|
||||
|
||||
rsB = new RedstoneModeButton(gui, ID_REDSTONE_BUTTON, x, y, new IRedstoneModeControlable() {
|
||||
|
||||
@Override
|
||||
@@ -112,6 +129,16 @@ public class LiquidSettings extends BaseSettingsPanel {
|
||||
colorB = new ColorButton(gui, ID_COLOR_BUTTON, x, y);
|
||||
colorB.setToolTipHeading(EnderIO.lang.localize("gui.conduit.redstone.signalColor"));
|
||||
colorB.setColorIndex(conduit.getExtractionSignalColor(gui.getDir()).ordinal());
|
||||
|
||||
if (isEnder) {
|
||||
x += rsB.getWidth() + gap;
|
||||
roundRobinB = new ToggleButton(gui, ID_ROUND_ROBIN_BUTTON, x, y, IconEIO.ROUND_ROBIN_OFF, IconEIO.ROUND_ROBIN);
|
||||
roundRobinB.setSelectedToolTip(EnderIO.lang.localize("gui.conduit.item.roundRobinEnabled"));
|
||||
roundRobinB.setUnselectedToolTip(EnderIO.lang.localize("gui.conduit.item.roundRobinDisabled"));
|
||||
roundRobinB.setPaintSelectedBorder(false);
|
||||
} else {
|
||||
roundRobinB = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void addFilterTooltips() {
|
||||
@@ -133,16 +160,48 @@ public class LiquidSettings extends BaseSettingsPanel {
|
||||
toggleBlacklist();
|
||||
} else if(guiButton.id == NEXT_FILTER_ID) {
|
||||
inOutShowIn = !inOutShowIn;
|
||||
if(channelB != null) {
|
||||
channelB.onGuiInit();
|
||||
if(isInput()) {
|
||||
channelB.setColorIndex(eConduit.getInputColor(gui.getDir()).ordinal());
|
||||
} else {
|
||||
channelB.setColorIndex(eConduit.getOutputColor(gui.getDir()).ordinal());
|
||||
}
|
||||
}
|
||||
if(isInput()) {
|
||||
if (isEnder) {
|
||||
roundRobinB.onGuiInit();
|
||||
}
|
||||
rsB.onGuiInit();
|
||||
colorB.onGuiInit();
|
||||
} else {
|
||||
if (isEnder) {
|
||||
roundRobinB.detach();
|
||||
}
|
||||
rsB.detach();
|
||||
colorB.detach();
|
||||
}
|
||||
if(isFilterVisible()) {
|
||||
updateWhiteListButton(eConduit.getFilter(gui.getDir(), isInput()));
|
||||
}
|
||||
} else if(guiButton.id == ID_CHANNEL) {
|
||||
if(isEnder) {
|
||||
|
||||
DyeColor col = DyeColor.values()[channelB.getColorIndex()];
|
||||
|
||||
if (isInput()) {
|
||||
eConduit.setInputColor(gui.getDir(), col);
|
||||
} else {
|
||||
eConduit.setOutputColor(gui.getDir(), col);
|
||||
}
|
||||
setConduitChannel(col);
|
||||
}
|
||||
} else if(guiButton.id == ID_ROUND_ROBIN_BUTTON) {
|
||||
if (isEnder && isInput()) {
|
||||
final boolean selected = roundRobinB.isSelected();
|
||||
eConduit.setRoundRobin(gui.getDir(), selected);
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketRoundRobinMode(eConduit, gui.getDir()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,8 +248,18 @@ public class LiquidSettings extends BaseSettingsPanel {
|
||||
|
||||
protected void setConduitFilter(FluidFilter filter) {
|
||||
eConduit.setFilter(gui.getDir(), filter, isInput());
|
||||
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketFluidFilter(eConduit, gui.getDir(), filter, isInput()));
|
||||
}
|
||||
protected void setConduitChannel(DyeColor channel) {
|
||||
if(isInput()) {
|
||||
eConduit.setInputColor(gui.getDir(), channel);
|
||||
} else {
|
||||
eConduit.setOutputColor(gui.getDir(), channel);
|
||||
}
|
||||
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketFluidChannel(eConduit, gui.getDir(), isInput(), channel));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initCustomOptions() {
|
||||
@@ -209,6 +278,21 @@ public class LiquidSettings extends BaseSettingsPanel {
|
||||
return;
|
||||
}
|
||||
|
||||
if(conduit.getConnectionMode(gui.getDir()) == ConnectionMode.DISABLED) {
|
||||
channelB.detach();
|
||||
} else {
|
||||
channelB.onGuiInit();
|
||||
if (isInput()) {
|
||||
channelB.setColorIndex(eConduit.getInputColor(gui.getDir()).ordinal());
|
||||
} else {
|
||||
channelB.setColorIndex(eConduit.getOutputColor(gui.getDir()).ordinal());
|
||||
}
|
||||
}
|
||||
if(isInput()) {
|
||||
roundRobinB.onGuiInit();
|
||||
roundRobinB.setSelected(eConduit.isRoundRobin(gui.getDir()));
|
||||
}
|
||||
|
||||
if(isFilterVisible()) {
|
||||
gui.getContainer().setInventorySlotsVisible(true);
|
||||
addFilterTooltips();
|
||||
@@ -241,6 +325,7 @@ public class LiquidSettings extends BaseSettingsPanel {
|
||||
rsB.detach();
|
||||
colorB.detach();
|
||||
if(isEnder) {
|
||||
roundRobinB.detach();
|
||||
gui.getContainer().setInventorySlotsVisible(false);
|
||||
if(filterToolTips != null) {
|
||||
for (GuiToolTip tt : filterToolTips) {
|
||||
@@ -251,25 +336,23 @@ public class LiquidSettings extends BaseSettingsPanel {
|
||||
}
|
||||
inOutNextB.detach();
|
||||
whiteListB.detach();
|
||||
channelB.detach();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderCustomOptions(int top, float par1, int par2, int par3) {
|
||||
boolean isInput = isInput();
|
||||
if(isInput) {
|
||||
int x = gui.getGuiLeft() + gap + gui.getFontRenderer().getStringWidth(autoExtractStr) + gap + 2;
|
||||
int y = top;
|
||||
gui.getFontRenderer().drawString(autoExtractStr, left, y, ColorUtil.getRGB(Color.DARK_GRAY));
|
||||
}
|
||||
if(isEnder && isFilterVisible()) {
|
||||
|
||||
String inOutStr = EnderIO.lang.localize("gui.conduit.ioMode.output");
|
||||
if(conduit.getConnectionMode(gui.getDir()) == ConnectionMode.IN_OUT) {
|
||||
String inOutStr = inOutShowIn ? EnderIO.lang.localize("gui.conduit.ioMode.input") : EnderIO.lang.localize("gui.conduit.ioMode.output");
|
||||
int x = gui.getGuiLeft() + gui.getXSize() - 20 - 5 - gui.getFontRenderer().getStringWidth(inOutStr);
|
||||
int y = top;
|
||||
gui.getFontRenderer().drawString(inOutStr, x, y, ColorUtil.getRGB(Color.DARK_GRAY));
|
||||
inOutStr = inOutShowIn ? EnderIO.lang.localize("gui.conduit.ioMode.input") : EnderIO.lang.localize("gui.conduit.ioMode.output");
|
||||
} else if(conduit.getConnectionMode(gui.getDir()) == ConnectionMode.INPUT){
|
||||
inOutStr = EnderIO.lang.localize("gui.conduit.ioMode.input");
|
||||
}
|
||||
int x = left;
|
||||
int y = top;
|
||||
gui.getFontRenderer().drawString(inOutStr, x, y, ColorUtil.getRGB(Color.DARK_GRAY));
|
||||
|
||||
GL11.glColor3f(1, 1, 1);
|
||||
gui.bindGuiTexture(1);
|
||||
@@ -277,8 +360,8 @@ public class LiquidSettings extends BaseSettingsPanel {
|
||||
|
||||
FontRenderer fr = gui.getFontRenderer();
|
||||
int sw = fr.getStringWidth(filterStr);
|
||||
int x = (gui.width / 2) - sw / 2;
|
||||
int y = top + 20;
|
||||
x = (gui.width / 2) - sw / 2;
|
||||
y = top + 20;
|
||||
fr.drawString(filterStr, x, y, ColorUtil.getRGB(Color.DARK_GRAY));
|
||||
|
||||
x = gui.getGuiLeft() + filterX;
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
package crazypants.enderio.conduit.gui;
|
||||
|
||||
import com.enderio.core.common.util.DyeColor;
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import crazypants.enderio.conduit.liquid.EnderLiquidConduit;
|
||||
import crazypants.enderio.conduit.liquid.FluidFilter;
|
||||
import crazypants.enderio.conduit.liquid.ILiquidConduit;
|
||||
import crazypants.enderio.conduit.packet.AbstractConduitPacket;
|
||||
import crazypants.enderio.conduit.packet.ConTypeEnum;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class PacketFluidChannel extends AbstractConduitPacket<ILiquidConduit> implements IMessageHandler<PacketFluidChannel, IMessage>{
|
||||
|
||||
private ForgeDirection dir;
|
||||
private boolean isInput;
|
||||
|
||||
private DyeColor channel;
|
||||
|
||||
public PacketFluidChannel() {
|
||||
}
|
||||
|
||||
public PacketFluidChannel(EnderLiquidConduit eConduit, ForgeDirection dir, boolean isInput, DyeColor channel) {
|
||||
super(eConduit.getBundle().getEntity(), ConTypeEnum.FLUID);
|
||||
this.dir = dir;
|
||||
this.isInput = isInput;
|
||||
this.channel = channel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
super.toBytes(buf);
|
||||
buf.writeShort(dir.ordinal());
|
||||
buf.writeBoolean(isInput);
|
||||
buf.writeShort(channel.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
super.fromBytes(buf);
|
||||
dir = ForgeDirection.values()[buf.readShort()];
|
||||
isInput = buf.readBoolean();
|
||||
channel = DyeColor.values()[buf.readShort()];
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(PacketFluidChannel message, MessageContext ctx) {
|
||||
ILiquidConduit conduit = message.getTileCasted(ctx);
|
||||
if(! (conduit instanceof EnderLiquidConduit)) {
|
||||
return null;
|
||||
}
|
||||
EnderLiquidConduit eCon = (EnderLiquidConduit)conduit;
|
||||
|
||||
if(message.isInput)
|
||||
eCon.setInputColor(message.dir, message.channel);
|
||||
else
|
||||
eCon.setOutputColor(message.dir, message.channel);
|
||||
|
||||
message.getWorld(ctx).markBlockForUpdate(message.x, message.y, message.z);
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -128,7 +128,7 @@ public class ItemSettings extends BaseSettingsPanel {
|
||||
}
|
||||
};
|
||||
|
||||
x += channelB.getWidth() + 4;
|
||||
x += channelB.getWidth() + gap;
|
||||
priLeft = x - 8;
|
||||
|
||||
rsB = new RedstoneModeButton(gui, ID_REDSTONE_BUTTON, x, y, new IRedstoneModeControlable() {
|
||||
@@ -149,18 +149,18 @@ public class ItemSettings extends BaseSettingsPanel {
|
||||
}
|
||||
});
|
||||
|
||||
x += rsB.getWidth() + 4;
|
||||
x += rsB.getWidth() + gap;
|
||||
colorB = new ColorButton(gui, ID_COLOR_BUTTON, x, y);
|
||||
colorB.setColorIndex(itemConduit.getExtractionSignalColor(gui.getDir()).ordinal());
|
||||
colorB.setToolTipHeading(EnderIO.lang.localize("gui.conduit.item.sigCol"));
|
||||
|
||||
x += 4 + colorB.getWidth();
|
||||
x += gap + colorB.getWidth();
|
||||
roundRobinB = new ToggleButton(gui, ID_ROUND_ROBIN, x, y, IconEIO.ROUND_ROBIN_OFF, IconEIO.ROUND_ROBIN);
|
||||
roundRobinB.setSelectedToolTip(EnderIO.lang.localize("gui.conduit.item.roundRobinEnabled"));
|
||||
roundRobinB.setUnselectedToolTip(EnderIO.lang.localize("gui.conduit.item.roundRobinDisabled"));
|
||||
roundRobinB.setPaintSelectedBorder(false);
|
||||
|
||||
x += 4 + roundRobinB.getWidth();
|
||||
x += gap + roundRobinB.getWidth();
|
||||
loopB = new ToggleButton(gui, ID_LOOP, x, y, IconEIO.LOOP_OFF, IconEIO.LOOP);
|
||||
loopB.setSelectedToolTip(EnderIO.lang.localize("gui.conduit.item.selfFeedEnabled"));
|
||||
loopB.setUnselectedToolTip(EnderIO.lang.localize("gui.conduit.item.selfFeedDisabled"));
|
||||
|
||||
@@ -1,10 +1,17 @@
|
||||
package crazypants.enderio.conduit.liquid;
|
||||
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import com.enderio.core.common.util.DyeColor;
|
||||
|
||||
import com.enderio.core.client.render.IconUtil;
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.conduit.*;
|
||||
import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
import crazypants.enderio.conduit.item.ItemConduit;
|
||||
import crazypants.enderio.machine.RedstoneControlMode;
|
||||
import crazypants.enderio.tool.ToolUtil;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -17,28 +24,22 @@ import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
|
||||
import com.enderio.core.client.render.IconUtil;
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.conduit.AbstractConduitNetwork;
|
||||
import crazypants.enderio.conduit.ConduitUtil;
|
||||
import crazypants.enderio.conduit.ConnectionMode;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.RaytraceResult;
|
||||
import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
import crazypants.enderio.machine.RedstoneControlMode;
|
||||
import crazypants.enderio.tool.ToolUtil;
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public class EnderLiquidConduit extends AbstractLiquidConduit {
|
||||
|
||||
public static final String ICON_KEY = "enderio:liquidConduitEnder";
|
||||
public static final String ICON_CORE_KEY = "enderio:liquidConduitCoreEnder";
|
||||
public static final String ICON_EXTRACT_KEY = "enderio:liquidConduitAdvancedInput";
|
||||
public static final String ICON_INSERT_KEY = "enderio:liquidConduitAdvancedOutput";
|
||||
public static final String ICON_IN_OUT_KEY = "enderio:liquidConduitAdvancedInOut";
|
||||
|
||||
public static final String ICON_KEY_INPUT = ItemConduit.ICON_KEY_INPUT;
|
||||
public static final String ICON_KEY_OUTPUT = ItemConduit.ICON_KEY_OUTPUT;
|
||||
public static final String ICON_KEY_IN_OUT_BG = ItemConduit.ICON_KEY_IN_OUT_BG;
|
||||
public static final String ICON_KEY_IN_OUT_OUT = ItemConduit.ICON_KEY_IN_OUT_OUT;
|
||||
public static final String ICON_KEY_IN_OUT_IN = ItemConduit.ICON_KEY_IN_OUT_IN;
|
||||
|
||||
static final Map<String, IIcon> ICONS = new HashMap<String, IIcon>();
|
||||
|
||||
@@ -50,9 +51,12 @@ public class EnderLiquidConduit extends AbstractLiquidConduit {
|
||||
public void registerIcons(IIconRegister register) {
|
||||
ICONS.put(ICON_KEY, register.registerIcon(ICON_KEY));
|
||||
ICONS.put(ICON_CORE_KEY, register.registerIcon(ICON_CORE_KEY));
|
||||
ICONS.put(ICON_EXTRACT_KEY, register.registerIcon(ICON_EXTRACT_KEY));
|
||||
ICONS.put(ICON_INSERT_KEY, register.registerIcon(ICON_INSERT_KEY));
|
||||
ICONS.put(ICON_IN_OUT_KEY, register.registerIcon(ICON_IN_OUT_KEY));
|
||||
|
||||
ICONS.put(ICON_KEY_INPUT, register.registerIcon(ICON_KEY_INPUT));
|
||||
ICONS.put(ICON_KEY_OUTPUT, register.registerIcon(ICON_KEY_OUTPUT));
|
||||
ICONS.put(ICON_KEY_IN_OUT_OUT, register.registerIcon(ICON_KEY_IN_OUT_OUT));
|
||||
ICONS.put(ICON_KEY_IN_OUT_IN, register.registerIcon(ICON_KEY_IN_OUT_IN));
|
||||
ICONS.put(ICON_KEY_IN_OUT_BG, register.registerIcon(ICON_KEY_IN_OUT_BG));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -69,6 +73,11 @@ public class EnderLiquidConduit extends AbstractLiquidConduit {
|
||||
private final EnumMap<ForgeDirection, FluidFilter> outputFilters = new EnumMap<ForgeDirection, FluidFilter>(ForgeDirection.class);
|
||||
private final EnumMap<ForgeDirection, FluidFilter> inputFilters = new EnumMap<ForgeDirection, FluidFilter>(ForgeDirection.class);
|
||||
|
||||
protected final EnumMap<ForgeDirection, DyeColor> outputColors = new EnumMap<ForgeDirection, DyeColor>(ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, DyeColor> inputColors = new EnumMap<ForgeDirection, DyeColor>(ForgeDirection.class);
|
||||
|
||||
private int roundRobin = 0;
|
||||
|
||||
@Override
|
||||
public ItemStack createItem() {
|
||||
return new ItemStack(EnderIO.itemLiquidConduit, 1, 2);
|
||||
@@ -165,17 +174,21 @@ public class EnderLiquidConduit extends AbstractLiquidConduit {
|
||||
}
|
||||
|
||||
public IIcon getTextureForInputMode() {
|
||||
return ICONS.get(ICON_EXTRACT_KEY);
|
||||
return ICONS.get(ICON_KEY_INPUT);
|
||||
}
|
||||
|
||||
public IIcon getTextureForOutputMode() {
|
||||
return ICONS.get(ICON_INSERT_KEY);
|
||||
return ICONS.get(ICON_KEY_OUTPUT);
|
||||
}
|
||||
|
||||
public IIcon getTextureForInOutMode() {
|
||||
return ICONS.get(ICON_IN_OUT_KEY);
|
||||
|
||||
public IIcon getTextureForInOutMode(boolean input) {
|
||||
return input ? ICONS.get(ICON_KEY_IN_OUT_IN) : ICONS.get(ICON_KEY_IN_OUT_OUT);
|
||||
}
|
||||
|
||||
public IIcon getTextureForInOutBackground() {
|
||||
return ICONS.get(ICON_KEY_IN_OUT_BG);
|
||||
}
|
||||
@Override
|
||||
public IIcon getTransmitionTextureForState(CollidableComponent component) {
|
||||
return null;
|
||||
@@ -298,10 +311,60 @@ public class EnderLiquidConduit extends AbstractLiquidConduit {
|
||||
}
|
||||
return network.getTankInfo(this, from);
|
||||
}
|
||||
//@Override
|
||||
public DyeColor getInputColor(ForgeDirection dir) {
|
||||
DyeColor result = inputColors.get(dir);
|
||||
if(result == null) {
|
||||
return DyeColor.GREEN;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//@Override
|
||||
public DyeColor getOutputColor(ForgeDirection dir) {
|
||||
DyeColor result = outputColors.get(dir);
|
||||
if(result == null) {
|
||||
return DyeColor.GREEN;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
//@Override
|
||||
public void setInputColor(ForgeDirection dir, DyeColor col) {
|
||||
inputColors.put(dir, col);
|
||||
if(network != null) {
|
||||
network.notifyNetworkOfUpdate();
|
||||
}
|
||||
setClientStateDirty();
|
||||
collidablesDirty = true;
|
||||
}
|
||||
|
||||
//@Override
|
||||
public void setOutputColor(ForgeDirection dir, DyeColor col) {
|
||||
outputColors.put(dir, col);
|
||||
if(network != null) {
|
||||
network.notifyNetworkOfUpdate();
|
||||
}
|
||||
setClientStateDirty();
|
||||
collidablesDirty = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void readTypeSettings(ForgeDirection dir, NBTTagCompound dataRoot) {
|
||||
super.readTypeSettings(dir, dataRoot);
|
||||
|
||||
if (dataRoot.hasKey("inputColor")) {
|
||||
setInputColor(dir, DyeColor.values()[dataRoot.getShort("inputColor")]);
|
||||
}
|
||||
if (dataRoot.hasKey("outputColor")) {
|
||||
setOutputColor(dir, DyeColor.values()[dataRoot.getShort("outputColor")]);
|
||||
}
|
||||
|
||||
if(dataRoot.hasKey("roundRobin")) {
|
||||
setRoundRobin(dir, dataRoot.getBoolean("roundRobin"));
|
||||
} else {
|
||||
setRoundRobin(dir, true);
|
||||
}
|
||||
|
||||
if (dataRoot.hasKey("outputFilters")) {
|
||||
FluidFilter out = new FluidFilter();
|
||||
out.readFromNBT(dataRoot.getCompoundTag("outputFilters"));
|
||||
@@ -317,6 +380,12 @@ public class EnderLiquidConduit extends AbstractLiquidConduit {
|
||||
@Override
|
||||
protected void writeTypeSettingsToNbt(ForgeDirection dir, NBTTagCompound dataRoot) {
|
||||
super.writeTypeSettingsToNbt(dir, dataRoot);
|
||||
|
||||
dataRoot.setShort("inputColor", (short)getInputColor(dir).ordinal());
|
||||
dataRoot.setShort("outputColor", (short)getOutputColor(dir).ordinal());
|
||||
|
||||
dataRoot.setBoolean("roundRobin", isRoundRobin(dir));
|
||||
|
||||
FluidFilter out = outputFilters.get(dir);
|
||||
if (out != null) {
|
||||
NBTTagCompound outTag = new NBTTagCompound();
|
||||
@@ -329,11 +398,13 @@ public class EnderLiquidConduit extends AbstractLiquidConduit {
|
||||
in.writeToNBT(inTag);
|
||||
dataRoot.setTag("inputFilters", inTag);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbtRoot) {
|
||||
super.writeToNBT(nbtRoot);
|
||||
nbtRoot.setInteger("roundRobin", roundRobin);
|
||||
for (Entry<ForgeDirection, FluidFilter> entry : inputFilters.entrySet()) {
|
||||
if(entry.getValue() != null) {
|
||||
FluidFilter f = entry.getValue();
|
||||
@@ -354,11 +425,29 @@ public class EnderLiquidConduit extends AbstractLiquidConduit {
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Entry<ForgeDirection, DyeColor> entry : inputColors.entrySet()) {
|
||||
if(entry.getValue() != null) {
|
||||
short ord = (short) entry.getValue().ordinal();
|
||||
nbtRoot.setShort("inSC." + entry.getKey().name(), ord);
|
||||
}
|
||||
}
|
||||
|
||||
for (Entry<ForgeDirection, DyeColor> entry : outputColors.entrySet()) {
|
||||
if(entry.getValue() != null) {
|
||||
short ord = (short) entry.getValue().ordinal();
|
||||
nbtRoot.setShort("outSC." + entry.getKey().name(), ord);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbtRoot, short nbtVersion) {
|
||||
super.readFromNBT(nbtRoot, nbtVersion);
|
||||
if(nbtRoot.hasKey("roundRobin")) {
|
||||
roundRobin = nbtRoot.getInteger("roundRobin");
|
||||
} else {
|
||||
roundRobin = 0b111111;
|
||||
}
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
String key = "inFilts." + dir.name();
|
||||
if(nbtRoot.hasKey(key)) {
|
||||
@@ -379,8 +468,34 @@ public class EnderLiquidConduit extends AbstractLiquidConduit {
|
||||
outputFilters.put(dir, f);
|
||||
}
|
||||
}
|
||||
|
||||
key = "inSC." + dir.name();
|
||||
if(nbtRoot.hasKey(key)) {
|
||||
short ord = nbtRoot.getShort(key);
|
||||
if(ord >= 0 && ord < DyeColor.values().length) {
|
||||
inputColors.put(dir, DyeColor.values()[ord]);
|
||||
}
|
||||
}
|
||||
|
||||
key = "outSC." + dir.name();
|
||||
if(nbtRoot.hasKey(key)) {
|
||||
short ord = nbtRoot.getShort(key);
|
||||
if(ord >= 0 && ord < DyeColor.values().length) {
|
||||
outputColors.put(dir, DyeColor.values()[ord]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean isRoundRobin(ForgeDirection dir) {
|
||||
return (roundRobin & dir.flag) != 0;
|
||||
}
|
||||
|
||||
public void setRoundRobin(ForgeDirection dir, boolean roundRobin) {
|
||||
if (roundRobin)
|
||||
this.roundRobin |= dir.flag;
|
||||
else
|
||||
this.roundRobin &= ~dir.flag;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,6 @@
|
||||
package crazypants.enderio.conduit.liquid;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
@@ -11,13 +8,51 @@ import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
import com.enderio.core.common.util.RoundRobinIterator;
|
||||
|
||||
import crazypants.enderio.conduit.AbstractConduitNetwork;
|
||||
import crazypants.enderio.conduit.ConnectionMode;
|
||||
import crazypants.enderio.config.Config;
|
||||
|
||||
public class EnderLiquidConduitNetwork extends AbstractConduitNetwork<ILiquidConduit, EnderLiquidConduit> {
|
||||
private class TankIterator implements Iterator<NetworkTank> {
|
||||
private int index = -1;
|
||||
private int currentCount = 0;
|
||||
|
||||
public TankIterator start() {
|
||||
currentCount = 0;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return !tanks.isEmpty() && currentCount < tanks.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NetworkTank next() {
|
||||
if (tanks.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
currentCount++;
|
||||
index++;
|
||||
if (index >= tanks.size()) {
|
||||
index = 0;
|
||||
}
|
||||
return tanks.get(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
}
|
||||
|
||||
public void rewind() {
|
||||
if (index == 0)
|
||||
index = tanks.size() - 1;
|
||||
else
|
||||
index--;
|
||||
currentCount--;
|
||||
}
|
||||
}
|
||||
|
||||
public static final int MAX_EXTRACT_PER_TICK = Config.enderFluidConduitExtractRate;
|
||||
public static final int MAX_IO_PER_TICK = Config.enderFluidConduitMaxIoRate;
|
||||
@@ -25,7 +60,7 @@ public class EnderLiquidConduitNetwork extends AbstractConduitNetwork<ILiquidCon
|
||||
List<NetworkTank> tanks = new ArrayList<NetworkTank>();
|
||||
Map<NetworkTankKey, NetworkTank> tankMap = new HashMap<NetworkTankKey, NetworkTank>();
|
||||
|
||||
Map<NetworkTank, RoundRobinIterator<NetworkTank>> iterators;
|
||||
Map<NetworkTank, TankIterator> iterators;
|
||||
|
||||
boolean filling;
|
||||
|
||||
@@ -93,17 +128,21 @@ public class EnderLiquidConduitNetwork extends AbstractConduitNetwork<ILiquidCon
|
||||
int remaining = resource.amount;
|
||||
//TODO: Only change starting pos of iterator is doFill is true so a false then true returns the same
|
||||
|
||||
for (NetworkTank target : getIteratorForTank(tank)) {
|
||||
if(!target.equals(tank) && target.acceptsOuput && target.isValid() && matchedFilter(resource, target.con, target.conDir, false)) {
|
||||
TankIterator iterator;
|
||||
for (iterator = getIteratorForTank(tank).start(); iterator.hasNext(); ) {
|
||||
NetworkTank target = iterator.next();
|
||||
if (!target.equals(tank) && target.con.getOutputColor(target.conDir).equals(tank.con.getInputColor(tank.conDir)) && target.acceptsOuput && target.isValid() && matchedFilter(resource, target.con, target.conDir, false)) {
|
||||
int vol = target.externalTank.fill(target.tankDir, resource.copy(), doFill);
|
||||
remaining -= vol;
|
||||
filled += vol;
|
||||
if(remaining <= 0) {
|
||||
return filled;
|
||||
if (remaining <= 0) {
|
||||
break;
|
||||
}
|
||||
resource.amount = remaining;
|
||||
}
|
||||
}
|
||||
if (!tank.con.isRoundRobin(tank.conDir))
|
||||
iterator.rewind();
|
||||
return filled;
|
||||
|
||||
} finally {
|
||||
@@ -122,13 +161,13 @@ public class EnderLiquidConduitNetwork extends AbstractConduitNetwork<ILiquidCon
|
||||
return filter.matchesFilter(drained);
|
||||
}
|
||||
|
||||
private Iterable<NetworkTank> getIteratorForTank(NetworkTank tank) {
|
||||
private TankIterator getIteratorForTank(NetworkTank tank) {
|
||||
if(iterators == null) {
|
||||
iterators = new HashMap<NetworkTank, RoundRobinIterator<NetworkTank>>();
|
||||
iterators = new HashMap<>();
|
||||
}
|
||||
RoundRobinIterator<NetworkTank> res = iterators.get(tank);
|
||||
TankIterator res = iterators.get(tank);
|
||||
if(res == null) {
|
||||
res = new RoundRobinIterator<NetworkTank>(tanks);
|
||||
res = new TankIterator();
|
||||
iterators.put(tank, res);
|
||||
}
|
||||
return res;
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package crazypants.enderio.conduit.liquid;
|
||||
|
||||
import com.enderio.core.common.util.DyeColor;
|
||||
import crazypants.enderio.conduit.item.IItemConduit;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import crazypants.enderio.conduit.ConnectionMode;
|
||||
@@ -26,19 +29,42 @@ public class EnderLiquidConduitRenderer extends DefaultConduitRenderer {
|
||||
public void renderEntity(ConduitBundleRenderer conduitBundleRenderer, IConduitBundle te, IConduit conduit, double x, double y, double z, float partialTick,
|
||||
float worldLight, RenderBlocks rb) {
|
||||
super.renderEntity(conduitBundleRenderer, te, conduit, x, y, z, partialTick, worldLight, rb);
|
||||
|
||||
EnderLiquidConduit pc = (EnderLiquidConduit) conduit;
|
||||
for (ForgeDirection dir : conduit.getExternalConnections()) {
|
||||
IIcon tex = null;
|
||||
DyeColor inChannel = null;
|
||||
DyeColor outChannel = null;
|
||||
IIcon inTex = null;
|
||||
IIcon outTex = null;
|
||||
boolean render = true;
|
||||
if(conduit.getConnectionMode(dir) == ConnectionMode.INPUT) {
|
||||
tex = pc.getTextureForInputMode();
|
||||
inTex = pc.getTextureForInputMode();
|
||||
inChannel = pc.getInputColor(dir);
|
||||
} else if(conduit.getConnectionMode(dir) == ConnectionMode.OUTPUT) {
|
||||
tex = pc.getTextureForOutputMode();
|
||||
outTex = pc.getTextureForOutputMode();
|
||||
outChannel = pc.getOutputColor(dir);
|
||||
} else if(conduit.getConnectionMode(dir) == ConnectionMode.IN_OUT) {
|
||||
tex = pc.getTextureForInOutMode();
|
||||
inTex = pc.getTextureForInOutMode(true);
|
||||
outTex = pc.getTextureForInOutMode(false);
|
||||
inChannel = pc.getInputColor(dir);
|
||||
outChannel = pc.getOutputColor(dir);
|
||||
} else {
|
||||
render = false;
|
||||
}
|
||||
if(tex != null) {
|
||||
if(render && !rb.hasOverrideBlockTexture()) {
|
||||
Offset offset = te.getOffset(ILiquidConduit.class, dir);
|
||||
ConnectionModeGeometry.renderModeConnector(dir, offset, tex, true);
|
||||
ConnectionModeGeometry.renderModeConnector(dir, offset, pc.getTextureForInOutBackground(), true);
|
||||
|
||||
if(inChannel != null) {
|
||||
Tessellator.instance.setColorOpaque_I(inChannel.getColor());
|
||||
ConnectionModeGeometry.renderModeConnector(dir, offset, inTex, false);
|
||||
}
|
||||
if(outChannel != null) {
|
||||
Tessellator.instance.setColorOpaque_I(outChannel.getColor());
|
||||
ConnectionModeGeometry.renderModeConnector(dir, offset, outTex, false);
|
||||
}
|
||||
|
||||
Tessellator.instance.setColorOpaque_F(1f, 1f, 1f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package crazypants.enderio.conduit.packet;
|
||||
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import crazypants.enderio.conduit.liquid.EnderLiquidConduit;
|
||||
import crazypants.enderio.conduit.liquid.ILiquidConduit;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class PacketRoundRobinMode extends AbstractConduitPacket<ILiquidConduit> implements IMessageHandler<PacketRoundRobinMode, IMessage> {
|
||||
private ForgeDirection dir;
|
||||
private boolean roundRobin;
|
||||
|
||||
public PacketRoundRobinMode() {
|
||||
}
|
||||
|
||||
public PacketRoundRobinMode(EnderLiquidConduit eConduit, ForgeDirection dir) {
|
||||
super(eConduit.getBundle().getEntity(), ConTypeEnum.FLUID);
|
||||
this.dir = dir;
|
||||
roundRobin = eConduit.isRoundRobin(dir);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
super.toBytes(buf);
|
||||
buf.writeShort(dir.ordinal());
|
||||
buf.writeBoolean(roundRobin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
super.fromBytes(buf);
|
||||
dir = ForgeDirection.values()[buf.readShort()];
|
||||
roundRobin = buf.readBoolean();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(PacketRoundRobinMode message, MessageContext ctx) {
|
||||
final ILiquidConduit conduit = message.getTileCasted(ctx);
|
||||
if (conduit instanceof EnderLiquidConduit) {
|
||||
((EnderLiquidConduit) conduit).setRoundRobin(message.dir, message.roundRobin);
|
||||
message.getWorld(ctx).markBlockForUpdate(message.x, message.y, message.z);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -185,6 +185,9 @@ public class ItemSoulVessel extends Item implements IResourceTooltipProvider {
|
||||
if(entity instanceof EntityPlayer) {
|
||||
return false;
|
||||
}
|
||||
if(entity.isDead) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String entityId = EntityList.getEntityString(entity);
|
||||
if(isBlackListed(entityId)) {
|
||||
|
||||
@@ -24,6 +24,7 @@ import crazypants.enderio.machine.farm.farmers.PlantableFarmer;
|
||||
import crazypants.enderio.machine.farm.farmers.RubberTreeFarmerIC2;
|
||||
import crazypants.enderio.machine.farm.farmers.StemFarmer;
|
||||
import crazypants.enderio.machine.farm.farmers.TreeFarmer;
|
||||
import crazypants.enderio.machine.farm.farmers.ForestryFarmer;
|
||||
|
||||
public final class FarmersRegistry {
|
||||
|
||||
@@ -34,13 +35,10 @@ public final class FarmersRegistry {
|
||||
addExtraUtilities();
|
||||
addNatura();
|
||||
addTiC();
|
||||
addStillHungry();
|
||||
addIC2();
|
||||
addMFR();
|
||||
addThaumcraft();
|
||||
addFlowers();
|
||||
addGrowableOres();
|
||||
addImmersiveEngineering();
|
||||
ForestryFarmer.init();
|
||||
|
||||
FarmersCommune.joinCommune(new StemFarmer(Blocks.reeds, new ItemStack(Items.reeds)));
|
||||
FarmersCommune.joinCommune(new StemFarmer(Blocks.cactus, new ItemStack(Blocks.cactus)));
|
||||
@@ -178,16 +176,6 @@ public final class FarmersRegistry {
|
||||
}
|
||||
}
|
||||
|
||||
private static void addMFR() {
|
||||
String mod = "MineFactoryReloaded";
|
||||
String blockName = "rubberwood.sapling";
|
||||
Block saplingBlock = GameRegistry.findBlock(mod, blockName);
|
||||
if(saplingBlock != null) {
|
||||
FarmersCommune.joinCommune(new TreeFarmer(saplingBlock, GameRegistry.findBlock(mod, "rubberwood.log")));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void addIC2() {
|
||||
RubberTreeFarmerIC2 rtf = new RubberTreeFarmerIC2();
|
||||
if(rtf.isValid()) {
|
||||
@@ -195,11 +183,6 @@ public final class FarmersRegistry {
|
||||
}
|
||||
}
|
||||
|
||||
private static void addStillHungry() {
|
||||
String mod = "stillhungry";
|
||||
addPickable(mod, "grapeBlock", "StillHungry_grapeSeed");
|
||||
}
|
||||
|
||||
private static void addExtraUtilities() {
|
||||
String mod = "ExtraUtilities";
|
||||
String name = "plant/ender_lilly";
|
||||
@@ -219,36 +202,6 @@ public final class FarmersRegistry {
|
||||
GameRegistry.findBlock("Botany", "flower"),
|
||||
GameRegistry.findBlock("Botania", "flower") ) );
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static void addGrowableOres() {
|
||||
String mod = "B0bGrowsOre";
|
||||
if (!Loader.isModLoaded(mod)) {
|
||||
return;
|
||||
}
|
||||
Pattern[] growableOres = { Pattern.compile("(.+)Reed"), Pattern.compile("oreGrowable(.+)") };
|
||||
|
||||
Iterator<Block> blockIter = Block.blockRegistry.iterator();
|
||||
while (blockIter.hasNext()) {
|
||||
Block block = blockIter.next();
|
||||
String name = Block.blockRegistry.getNameForObject(block);
|
||||
if (name != null && name.startsWith(mod)) {
|
||||
for (Pattern blockPattern : growableOres) {
|
||||
if (blockPattern.matcher(name).find()) {
|
||||
FarmersCommune.joinCommune(new StemFarmer(block, new ItemStack(block)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void addImmersiveEngineering() {
|
||||
Block hemp = GameRegistry.findBlock("ImmersiveEngineering", "hemp");
|
||||
Item hempSeed = GameRegistry.findItem("ImmersiveEngineering", "hemp");
|
||||
if (hemp != null && hempSeed != null) {
|
||||
FarmersCommune.joinCommune(new StemFarmer(hemp, new ItemStack(hempSeed)));
|
||||
}
|
||||
}
|
||||
|
||||
private FarmersRegistry() {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
package crazypants.enderio.machine.farm.farmers;
|
||||
|
||||
import com.enderio.core.common.util.BlockCoord;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import crazypants.enderio.Log;
|
||||
import crazypants.enderio.machine.farm.TileFarmStation;
|
||||
import forestry.api.arboriculture.EnumGermlingType;
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.arboriculture.ITreeRoot;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ForestryFarmer implements IFarmerJoe {
|
||||
private ITreeRoot root;
|
||||
private Item forestrySapling;
|
||||
|
||||
private ForestryFarmer(ITreeRoot root, Item forestrySapling) {
|
||||
this.root = root;
|
||||
this.forestrySapling = forestrySapling;
|
||||
}
|
||||
|
||||
public static void init() {
|
||||
ITreeRoot root = (ITreeRoot) AlleleManager.alleleRegistry.getSpeciesRoot("rootTrees");
|
||||
Item forestrySapling = GameRegistry.findItem("Forestry", "sapling");
|
||||
if (root != null && forestrySapling != null) {
|
||||
FarmersCommune.joinCommune(new ForestryFarmer(root, forestrySapling));
|
||||
Log.info("ForestryFarmer engaged.");
|
||||
} else {
|
||||
Log.info("ForestryFarmer borked.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlant(ItemStack stack) {
|
||||
return stack != null && stack.getItem() == forestrySapling && root.getType(stack) == EnumGermlingType.SAPLING;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean prepareBlock(TileFarmStation farm, BlockCoord bc, Block block, int meta) {
|
||||
ItemStack sapling = farm.getSeedTypeInSuppliesFor(bc);
|
||||
ITree tree = root.getMember(sapling);
|
||||
if (tree != null && tree.canStay(farm.getWorldObj(), bc.x, bc.y, bc.z)) {
|
||||
farm.takeSeedFromSupplies(sapling, bc, false);
|
||||
root.plantSapling(farm.getWorldObj(), tree, farm.getFakePlayer().getGameProfile(), bc.x, bc.y, bc.z);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHarvest(TileFarmStation farm, BlockCoord bc, Block block, int meta) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IHarvestResult harvestBlock(TileFarmStation farm, BlockCoord bc, Block block, int meta) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -118,7 +118,7 @@ public class BlockFusedQuartz extends BlockEio {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
Type type = Type.byMeta(meta);
|
||||
if (type.blastResistance) {
|
||||
return 2000;
|
||||
return 20;
|
||||
} else {
|
||||
return super.getExplosionResistance(par1Entity);
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ public class NEIEnderIOConfig implements IConfigureNEI {
|
||||
API.registerGuiOverlayHandler(GuiInventoryPanel.class, new InventoryPanelNEIOverlayHandler(), "crafting");
|
||||
|
||||
API.hideItem(new ItemStack(EnderIO.blockConduitFacade));
|
||||
API.hideItem(new ItemStack(EnderIO.blockLightNode));
|
||||
API.hideItem(new ItemStack(EnderIO.itemEnderface));
|
||||
API.hideItem(PainterUtil.applyDefaultPaintedState(new ItemStack(EnderIO.blockPaintedCarpet)));
|
||||
API.hideItem(PainterUtil.applyDefaultPaintedState(new ItemStack(EnderIO.blockPaintedSlab)));
|
||||
|
||||
Reference in new issue
Block a user