Added configurable restrictive input colors to all configurable machines, added some dandy sound effects
This commit is contained in:
parent
3b746e4a1d
commit
1ff600b4a9
17 changed files with 262 additions and 84 deletions
|
@ -1,12 +1,18 @@
|
|||
package mekanism.api;
|
||||
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public interface IEjector
|
||||
{
|
||||
public void onOutput();
|
||||
|
||||
public EnumColor getColor();
|
||||
public EnumColor getOutputColor();
|
||||
|
||||
public void setColor(EnumColor color);
|
||||
public void setOutputColor(EnumColor color);
|
||||
|
||||
public EnumColor getInputColor(ForgeDirection side);
|
||||
|
||||
public void setInputColor(ForgeDirection side, EnumColor color);
|
||||
|
||||
public boolean isEjecting();
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ import mekanism.common.network.PacketConfiguratorState;
|
|||
import mekanism.common.network.PacketElectricBowState;
|
||||
import mekanism.common.network.PacketWalkieTalkieState;
|
||||
import mekanism.common.tileentity.TileEntityUniversalCable;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -108,6 +109,7 @@ public class ClientPlayerTickHandler implements ITickHandler
|
|||
int newChan = item.getChannel(stack) < 9 ? item.getChannel(stack)+1 : 1;
|
||||
item.setChannel(stack, newChan);
|
||||
PacketHandler.sendPacket(Transmission.SERVER, new PacketWalkieTalkieState().setParams(newChan));
|
||||
Minecraft.getMinecraft().sndManager.playSoundFX("mekanism:etc.ChanSwitch", 1.0F, 1.0F);
|
||||
lastTickUpdate = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package mekanism.client.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -14,7 +13,6 @@ import mekanism.common.PacketHandler.Transmission;
|
|||
import mekanism.common.block.BlockMachine.MachineType;
|
||||
import mekanism.common.inventory.container.ContainerNull;
|
||||
import mekanism.common.network.PacketConfigurationUpdate;
|
||||
import mekanism.common.network.PacketTileEntity;
|
||||
import mekanism.common.network.PacketConfigurationUpdate.ConfigurationPacket;
|
||||
import mekanism.common.network.PacketSimpleGui;
|
||||
import mekanism.common.tileentity.TileEntityContainerBlock;
|
||||
|
@ -22,16 +20,16 @@ import mekanism.common.util.MekanismUtils;
|
|||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import universalelectricity.core.electricity.ElectricityDisplay;
|
||||
import universalelectricity.core.electricity.ElectricityDisplay.ElectricUnit;
|
||||
|
||||
public class GuiConfiguration extends GuiMekanism
|
||||
{
|
||||
public Map<Integer, GuiPos> positions = new HashMap<Integer, GuiPos>();
|
||||
public Map<Integer, GuiPos> slotPosMap = new HashMap<Integer, GuiPos>();
|
||||
|
||||
public Map<Integer, GuiPos> inputPosMap = new HashMap<Integer, GuiPos>();
|
||||
|
||||
public IConfigurable configurable;
|
||||
|
||||
|
@ -43,12 +41,19 @@ public class GuiConfiguration extends GuiMekanism
|
|||
|
||||
configurable = tile;
|
||||
|
||||
positions.put(0, new GuiPos(110, 63));
|
||||
positions.put(1, new GuiPos(110, 33));
|
||||
positions.put(2, new GuiPos(110, 48));
|
||||
positions.put(3, new GuiPos(95, 63));
|
||||
positions.put(4, new GuiPos(95, 48));
|
||||
positions.put(5, new GuiPos(125, 48));
|
||||
slotPosMap.put(0, new GuiPos(126, 64));
|
||||
slotPosMap.put(1, new GuiPos(126, 34));
|
||||
slotPosMap.put(2, new GuiPos(126, 49));
|
||||
slotPosMap.put(3, new GuiPos(111, 64));
|
||||
slotPosMap.put(4, new GuiPos(111, 49));
|
||||
slotPosMap.put(5, new GuiPos(141, 49));
|
||||
|
||||
inputPosMap.put(0, new GuiPos(36, 64));
|
||||
inputPosMap.put(1, new GuiPos(36, 34));
|
||||
inputPosMap.put(2, new GuiPos(36, 49));
|
||||
inputPosMap.put(3, new GuiPos(21, 64));
|
||||
inputPosMap.put(4, new GuiPos(21, 49));
|
||||
inputPosMap.put(5, new GuiPos(51, 49));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -81,12 +86,12 @@ public class GuiConfiguration extends GuiMekanism
|
|||
drawTexturedModalRect(guiWidth + 6, guiHeight + 6, 176 + 28, 14, 14, 14);
|
||||
}
|
||||
|
||||
for(int i = 0; i < positions.size(); i++)
|
||||
for(int i = 0; i < slotPosMap.size(); i++)
|
||||
{
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
int x = positions.get(i).xPos;
|
||||
int y = positions.get(i).yPos;
|
||||
int x = slotPosMap.get(i).xPos;
|
||||
int y = slotPosMap.get(i).yPos;
|
||||
|
||||
SideData data = configurable.getSideData().get(configurable.getConfiguration()[i]);
|
||||
|
||||
|
@ -104,6 +109,29 @@ public class GuiConfiguration extends GuiMekanism
|
|||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < inputPosMap.size(); i++)
|
||||
{
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
int x = inputPosMap.get(i).xPos;
|
||||
int y = inputPosMap.get(i).yPos;
|
||||
|
||||
EnumColor color = configurable.getEjector().getInputColor(ForgeDirection.getOrientation(i));
|
||||
|
||||
if(color != null)
|
||||
{
|
||||
GL11.glColor4f(color.getColor(0), color.getColor(1), color.getColor(2), 1);
|
||||
}
|
||||
|
||||
if(xAxis >= x && xAxis <= x+14 && yAxis >= y && yAxis <= y+14)
|
||||
{
|
||||
drawTexturedModalRect(guiWidth + x, guiHeight + y, 176, 0, 14, 14);
|
||||
}
|
||||
else {
|
||||
drawTexturedModalRect(guiWidth + x, guiHeight + y, 176, 14, 14, 14);
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
|
@ -120,26 +148,28 @@ public class GuiConfiguration extends GuiMekanism
|
|||
fontRenderer.drawString("Configuration", 60, 5, 0x404040);
|
||||
fontRenderer.drawString("Eject: " + ejecting, 53, 17, 0x00CD00);
|
||||
|
||||
fontRenderer.drawString("Color:", 38, 37, 0x404040);
|
||||
fontRenderer.drawString("Input", 32, 81, 0x787878);
|
||||
fontRenderer.drawString("Output", 72, 68, 0x787878);
|
||||
fontRenderer.drawString("Slots", 122, 81, 0x787878);
|
||||
|
||||
if(configurable.getEjector().getColor() != null)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
mc.getTextureManager().bindTexture(MekanismRenderer.getColorResource(configurable.getEjector().getColor()));
|
||||
itemRenderer.renderIcon(44, 48, MekanismRenderer.getColorIcon(configurable.getEjector().getColor()), 16, 16);
|
||||
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if(configurable.getEjector().getOutputColor() != null)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
mc.getTextureManager().bindTexture(MekanismRenderer.getColorResource(configurable.getEjector().getOutputColor()));
|
||||
itemRenderer.renderIcon(80, 49, MekanismRenderer.getColorIcon(configurable.getEjector().getOutputColor()), 16, 16);
|
||||
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
for(int i = 0; i < positions.size(); i++)
|
||||
for(int i = 0; i < slotPosMap.size(); i++)
|
||||
{
|
||||
int x = positions.get(i).xPos;
|
||||
int y = positions.get(i).yPos;
|
||||
int x = slotPosMap.get(i).xPos;
|
||||
int y = slotPosMap.get(i).yPos;
|
||||
|
||||
SideData data = configurable.getSideData().get(configurable.getConfiguration()[i]);
|
||||
|
||||
|
@ -149,11 +179,24 @@ public class GuiConfiguration extends GuiMekanism
|
|||
}
|
||||
}
|
||||
|
||||
if(xAxis >= 44 && xAxis <= 60 && yAxis >= 48 && yAxis <= 64)
|
||||
for(int i = 0; i < inputPosMap.size(); i++)
|
||||
{
|
||||
int x = inputPosMap.get(i).xPos;
|
||||
int y = inputPosMap.get(i).yPos;
|
||||
|
||||
EnumColor color = configurable.getEjector().getInputColor(ForgeDirection.getOrientation(i));
|
||||
|
||||
if(xAxis >= x && xAxis <= x+14 && yAxis >= y && yAxis <= y+14)
|
||||
{
|
||||
drawCreativeTabHoveringText(color != null ? color.getName() : "None", xAxis, yAxis);
|
||||
}
|
||||
}
|
||||
|
||||
if(xAxis >= 80 && xAxis <= 96 && yAxis >= 49 && yAxis <= 65)
|
||||
{
|
||||
if(configurable.getEjector().getColor() != null)
|
||||
if(configurable.getEjector().getOutputColor() != null)
|
||||
{
|
||||
drawCreativeTabHoveringText(configurable.getEjector().getColor().getName(), xAxis, yAxis);
|
||||
drawCreativeTabHoveringText(configurable.getEjector().getOutputColor().getName(), xAxis, yAxis);
|
||||
}
|
||||
else {
|
||||
drawCreativeTabHoveringText("None", xAxis, yAxis);
|
||||
|
@ -198,16 +241,16 @@ public class GuiConfiguration extends GuiMekanism
|
|||
PacketHandler.sendPacket(Transmission.SERVER, new PacketConfigurationUpdate().setParams(ConfigurationPacket.EJECT, Object3D.get(tile)));
|
||||
}
|
||||
|
||||
if(xAxis >= 44 && xAxis <= 60 && yAxis >= 48 && yAxis <= 64)
|
||||
if(xAxis >= 80 && xAxis <= 96 && yAxis >= 49 && yAxis <= 65)
|
||||
{
|
||||
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
|
||||
PacketHandler.sendPacket(Transmission.SERVER, new PacketConfigurationUpdate().setParams(ConfigurationPacket.EJECT_COLOR, Object3D.get((TileEntity)configurable)));
|
||||
PacketHandler.sendPacket(Transmission.SERVER, new PacketConfigurationUpdate().setParams(ConfigurationPacket.EJECT_COLOR, Object3D.get(tile)));
|
||||
}
|
||||
|
||||
for(int i = 0; i < positions.size(); i++)
|
||||
for(int i = 0; i < slotPosMap.size(); i++)
|
||||
{
|
||||
int x = positions.get(i).xPos;
|
||||
int y = positions.get(i).yPos;
|
||||
int x = slotPosMap.get(i).xPos;
|
||||
int y = slotPosMap.get(i).yPos;
|
||||
|
||||
if(xAxis >= x && xAxis <= x+14 && yAxis >= y && yAxis <= y+14)
|
||||
{
|
||||
|
@ -215,6 +258,18 @@ public class GuiConfiguration extends GuiMekanism
|
|||
PacketHandler.sendPacket(Transmission.SERVER, new PacketConfigurationUpdate().setParams(ConfigurationPacket.SIDE_DATA, Object3D.get(tile), i));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < inputPosMap.size(); i++)
|
||||
{
|
||||
int x = inputPosMap.get(i).xPos;
|
||||
int y = inputPosMap.get(i).yPos;
|
||||
|
||||
if(xAxis >= x && xAxis <= x+14 && yAxis >= y && yAxis <= y+14)
|
||||
{
|
||||
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
|
||||
PacketHandler.sendPacket(Transmission.SERVER, new PacketConfigurationUpdate().setParams(ConfigurationPacket.INPUT_COLOR, Object3D.get(tile), i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -122,12 +122,14 @@ public class GuiPasswordEnter extends GuiScreen
|
|||
if(passwordField.getText() == null || passwordField.getText() == "")
|
||||
{
|
||||
displayText = EnumColor.DARK_RED + "Field empty";
|
||||
mc.sndManager.playSoundFX("mekanism:etc.Error", 1.0F, 1.0F);
|
||||
ticker = 30;
|
||||
}
|
||||
else if(!getPassword().equals(passwordField.getText()))
|
||||
{
|
||||
displayText = EnumColor.DARK_RED + "Invalid";
|
||||
passwordField.setText("");
|
||||
mc.sndManager.playSoundFX("mekanism:etc.Error", 1.0F, 1.0F);
|
||||
ticker = 30;
|
||||
}
|
||||
else {
|
||||
|
@ -140,6 +142,8 @@ public class GuiPasswordEnter extends GuiScreen
|
|||
((IEnergizedItem)itemStack.getItem()).setEnergy(itemStack, ((IEnergizedItem)itemStack.getItem()).getEnergy(itemStack) - 100);
|
||||
PacketHandler.sendPacket(Transmission.SERVER, new PacketElectricChest().setParams(ElectricChestPacketType.SERVER_OPEN, true, false));
|
||||
}
|
||||
|
||||
mc.sndManager.playSoundFX("mekanism:etc.Success", 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,19 @@ public class SoundHandler
|
|||
}
|
||||
}
|
||||
|
||||
mc.sndManager.addSound("mekanism:etc/Click.ogg");
|
||||
url = getClass().getClassLoader().getResource("assets/mekanism/sound/etc");
|
||||
dir = new File(url.getFile());
|
||||
|
||||
if(dir != null)
|
||||
{
|
||||
for(File file : dir.listFiles())
|
||||
{
|
||||
if(file.getName().endsWith(".ogg"))
|
||||
{
|
||||
mc.sndManager.addSound("mekanism:etc/" + file.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void preloadSound(String sound)
|
||||
|
|
|
@ -26,7 +26,9 @@ public class TileComponentEjector implements ITileComponent, IEjector
|
|||
|
||||
public boolean ejecting;
|
||||
|
||||
public EnumColor ejectColor;
|
||||
public EnumColor outputColor;
|
||||
|
||||
public EnumColor[] inputColors = new EnumColor[] {null, null, null, null, null, null};
|
||||
|
||||
public SideData sideData;
|
||||
|
||||
|
@ -102,7 +104,7 @@ public class TileComponentEjector implements ITileComponent, IEjector
|
|||
}
|
||||
else if(tile instanceof TileEntityLogisticalTransporter)
|
||||
{
|
||||
if(TransporterUtils.insert(tileEntity, (TileEntityLogisticalTransporter)tile, stack, ejectColor))
|
||||
if(TransporterUtils.insert(tileEntity, (TileEntityLogisticalTransporter)tile, stack, outputColor))
|
||||
{
|
||||
stack = null;
|
||||
}
|
||||
|
@ -136,15 +138,27 @@ public class TileComponentEjector implements ITileComponent, IEjector
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setColor(EnumColor color)
|
||||
public void setOutputColor(EnumColor color)
|
||||
{
|
||||
ejectColor = color;
|
||||
outputColor = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumColor getColor()
|
||||
public EnumColor getOutputColor()
|
||||
{
|
||||
return ejectColor;
|
||||
return outputColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInputColor(ForgeDirection side, EnumColor color)
|
||||
{
|
||||
inputColors[side.ordinal()] = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumColor getInputColor(ForgeDirection side)
|
||||
{
|
||||
return inputColors[side.ordinal()];
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -157,13 +171,29 @@ public class TileComponentEjector implements ITileComponent, IEjector
|
|||
|
||||
if(nbtTags.hasKey("ejectColor"))
|
||||
{
|
||||
ejectColor = TransporterUtils.colors.get(nbtTags.getInteger("ejectColor"));
|
||||
outputColor = TransporterUtils.colors.get(nbtTags.getInteger("ejectColor"));
|
||||
}
|
||||
|
||||
for(int i = 0; i < sideData.availableSlots.length; i++)
|
||||
{
|
||||
trackers[i] = nbtTags.getInteger("tracker" + i);
|
||||
}
|
||||
|
||||
for(int i = 0; i < 6; i++)
|
||||
{
|
||||
if(nbtTags.hasKey("inputColors" + i))
|
||||
{
|
||||
int inC = nbtTags.getInteger("inputColors" + i);
|
||||
|
||||
if(inC != -1)
|
||||
{
|
||||
inputColors[i] = TransporterUtils.colors.get(inC);
|
||||
}
|
||||
else {
|
||||
inputColors[i] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -175,10 +205,23 @@ public class TileComponentEjector implements ITileComponent, IEjector
|
|||
|
||||
if(c != -1)
|
||||
{
|
||||
ejectColor = TransporterUtils.colors.get(c);
|
||||
outputColor = TransporterUtils.colors.get(c);
|
||||
}
|
||||
else {
|
||||
ejectColor = null;
|
||||
outputColor = null;
|
||||
}
|
||||
|
||||
for(int i = 0; i < 6; i++)
|
||||
{
|
||||
int inC = dataStream.readInt();
|
||||
|
||||
if(inC != -1)
|
||||
{
|
||||
inputColors[i] = TransporterUtils.colors.get(inC);
|
||||
}
|
||||
else {
|
||||
inputColors[i] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -187,15 +230,26 @@ public class TileComponentEjector implements ITileComponent, IEjector
|
|||
{
|
||||
nbtTags.setBoolean("ejecting", ejecting);
|
||||
|
||||
if(ejectColor != null)
|
||||
if(outputColor != null)
|
||||
{
|
||||
nbtTags.setInteger("ejectColor", TransporterUtils.colors.indexOf(ejectColor));
|
||||
nbtTags.setInteger("ejectColor", TransporterUtils.colors.indexOf(outputColor));
|
||||
}
|
||||
|
||||
for(int i = 0; i < sideData.availableSlots.length; i++)
|
||||
{
|
||||
nbtTags.setInteger("tracker" + i, trackers[i]);
|
||||
}
|
||||
|
||||
for(int i = 0; i < 6; i++)
|
||||
{
|
||||
if(inputColors[i] == null)
|
||||
{
|
||||
nbtTags.setInteger("inputColors" + i, -1);
|
||||
}
|
||||
else {
|
||||
nbtTags.setInteger("inputColors" + i, TransporterUtils.colors.indexOf(inputColors[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -203,12 +257,23 @@ public class TileComponentEjector implements ITileComponent, IEjector
|
|||
{
|
||||
data.add(ejecting);
|
||||
|
||||
if(ejectColor != null)
|
||||
if(outputColor != null)
|
||||
{
|
||||
data.add(TransporterUtils.colors.indexOf(ejectColor));
|
||||
data.add(TransporterUtils.colors.indexOf(outputColor));
|
||||
}
|
||||
else {
|
||||
data.add(-1);
|
||||
}
|
||||
|
||||
for(int i = 0; i < 6; i++)
|
||||
{
|
||||
if(inputColors[i] == null)
|
||||
{
|
||||
data.add(-1);
|
||||
}
|
||||
else {
|
||||
data.add(TransporterUtils.colors.indexOf(inputColors[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import mekanism.common.util.TransporterUtils;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
|
@ -22,6 +23,8 @@ public class PacketConfigurationUpdate implements IMekanismPacket
|
|||
|
||||
public int configIndex;
|
||||
|
||||
public int inputSide;
|
||||
|
||||
public ConfigurationPacket packetType;
|
||||
|
||||
@Override
|
||||
|
@ -42,6 +45,11 @@ public class PacketConfigurationUpdate implements IMekanismPacket
|
|||
configIndex = (Integer)data[2];
|
||||
}
|
||||
|
||||
if(packetType == ConfigurationPacket.INPUT_COLOR)
|
||||
{
|
||||
inputSide = (Integer)data[2];
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -52,36 +60,32 @@ public class PacketConfigurationUpdate implements IMekanismPacket
|
|||
|
||||
object3D = new Object3D(dataStream.readInt(), dataStream.readInt(), dataStream.readInt(), dataStream.readInt());
|
||||
|
||||
if(packetType == ConfigurationPacket.EJECT)
|
||||
TileEntity tile = object3D.getTileEntity(world);
|
||||
|
||||
if(tile instanceof IConfigurable)
|
||||
{
|
||||
TileEntity tile = object3D.getTileEntity(world);
|
||||
IConfigurable config = (IConfigurable)tile;
|
||||
|
||||
if(tile instanceof IConfigurable)
|
||||
if(packetType == ConfigurationPacket.EJECT)
|
||||
{
|
||||
IConfigurable config = (IConfigurable)tile;
|
||||
config.getEjector().setEjecting(!config.getEjector().isEjecting());
|
||||
}
|
||||
}
|
||||
else if(packetType == ConfigurationPacket.SIDE_DATA)
|
||||
{
|
||||
configIndex = dataStream.readInt();
|
||||
|
||||
TileEntity tile = object3D.getTileEntity(world);
|
||||
|
||||
if(tile instanceof IConfigurable)
|
||||
else if(packetType == ConfigurationPacket.SIDE_DATA)
|
||||
{
|
||||
configIndex = dataStream.readInt();
|
||||
|
||||
MekanismUtils.incrementOutput((IConfigurable)tile, configIndex);
|
||||
PacketHandler.sendPacket(Transmission.CLIENTS_RANGE, new PacketTileEntity().setParams(object3D, ((ITileNetwork)tile).getNetworkedData(new ArrayList())), object3D, 50D);
|
||||
}
|
||||
}
|
||||
else if(packetType == ConfigurationPacket.EJECT_COLOR)
|
||||
{
|
||||
TileEntity tile = object3D.getTileEntity(world);
|
||||
|
||||
if(tile instanceof IConfigurable)
|
||||
else if(packetType == ConfigurationPacket.EJECT_COLOR)
|
||||
{
|
||||
IConfigurable config = (IConfigurable)tile;
|
||||
config.getEjector().setColor(TransporterUtils.increment(config.getEjector().getColor()));
|
||||
config.getEjector().setOutputColor(TransporterUtils.increment(config.getEjector().getOutputColor()));
|
||||
}
|
||||
else if(packetType == ConfigurationPacket.INPUT_COLOR)
|
||||
{
|
||||
inputSide = dataStream.readInt();
|
||||
ForgeDirection side = ForgeDirection.getOrientation(inputSide);
|
||||
config.getEjector().setInputColor(side, TransporterUtils.increment(config.getEjector().getInputColor(side)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -101,10 +105,15 @@ public class PacketConfigurationUpdate implements IMekanismPacket
|
|||
{
|
||||
dataStream.writeInt(configIndex);
|
||||
}
|
||||
|
||||
if(packetType == ConfigurationPacket.INPUT_COLOR)
|
||||
{
|
||||
dataStream.writeInt(inputSide);
|
||||
}
|
||||
}
|
||||
|
||||
public static enum ConfigurationPacket
|
||||
{
|
||||
EJECT, SIDE_DATA, EJECT_COLOR
|
||||
EJECT, SIDE_DATA, EJECT_COLOR, INPUT_COLOR
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ import mekanism.common.PacketHandler;
|
|||
import mekanism.common.PacketHandler.Transmission;
|
||||
import mekanism.common.network.PacketDataRequest;
|
||||
import mekanism.common.network.PacketTileEntity;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
@ -26,6 +27,8 @@ public abstract class TileEntityBasicBlock extends TileEntity implements IWrench
|
|||
/** The direction this block is facing. */
|
||||
public int facing;
|
||||
|
||||
public int clientFacing;
|
||||
|
||||
/** The players currently using this block. */
|
||||
public Set<EntityPlayer> playersUsing = new HashSet<EntityPlayer>();
|
||||
|
||||
|
@ -65,6 +68,13 @@ public abstract class TileEntityBasicBlock extends TileEntity implements IWrench
|
|||
{
|
||||
facing = dataStream.readInt();
|
||||
|
||||
if(clientFacing != facing)
|
||||
{
|
||||
MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord);
|
||||
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, worldObj.getBlockId(xCoord, yCoord, zCoord));
|
||||
clientFacing = facing;
|
||||
}
|
||||
|
||||
for(ITileComponent component : components)
|
||||
{
|
||||
component.read(dataStream);
|
||||
|
@ -149,8 +159,12 @@ public abstract class TileEntityBasicBlock extends TileEntity implements IWrench
|
|||
facing = direction;
|
||||
}
|
||||
|
||||
PacketHandler.sendPacket(Transmission.ALL_CLIENTS, new PacketTileEntity().setParams(Object3D.get(this), getNetworkedData(new ArrayList())));
|
||||
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, worldObj.getBlockId(xCoord, yCoord, zCoord));
|
||||
if(facing != clientFacing)
|
||||
{
|
||||
PacketHandler.sendPacket(Transmission.ALL_CLIENTS, new PacketTileEntity().setParams(Object3D.get(this), getNetworkedData(new ArrayList())));
|
||||
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, worldObj.getBlockId(xCoord, yCoord, zCoord));
|
||||
clientFacing = facing;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -58,7 +58,7 @@ public class TileEntityChargepad extends TileEntityElectricBlock implements IAct
|
|||
{
|
||||
isActive = false;
|
||||
|
||||
List<EntityLiving> entities = worldObj.getEntitiesWithinAABB(EntityLiving.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord+1, yCoord+0.2, zCoord+1));
|
||||
List<EntityLiving> entities = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord+1, yCoord+0.2, zCoord+1));
|
||||
|
||||
for(EntityLivingBase entity : entities)
|
||||
{
|
||||
|
|
|
@ -134,7 +134,7 @@ public class TileEntityLogisticalTransporter extends TileEntity implements ITile
|
|||
{
|
||||
if(stack.isFinal(this))
|
||||
{
|
||||
if(!TransporterUtils.canInsert(stack.getDest().getTileEntity(worldObj), stack.itemStack, stack.getSide(this)) && !stack.noTarget)
|
||||
if(!TransporterUtils.canInsert(stack.getDest().getTileEntity(worldObj), stack.color, stack.itemStack, stack.getSide(this)) && !stack.noTarget)
|
||||
{
|
||||
if(!recalculate(stack, null))
|
||||
{
|
||||
|
|
|
@ -168,7 +168,7 @@ public final class TransporterPathfinder
|
|||
{
|
||||
TileEntity tile = pointer.getFromSide(side).getTileEntity(worldObj);
|
||||
|
||||
if(TransporterUtils.canInsert(tile, transportStack.itemStack, side.ordinal()) && !(tile instanceof TileEntityLogisticalTransporter))
|
||||
if(TransporterUtils.canInsert(tile, transportStack.color, transportStack.itemStack, side.ordinal()) && !(tile instanceof TileEntityLogisticalTransporter))
|
||||
{
|
||||
destinations.add(new Destination(currentPath, Object3D.get(tile), dist));
|
||||
}
|
||||
|
|
|
@ -4,12 +4,12 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.IConfigurable;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.api.transmitters.ITransmitter;
|
||||
import mekanism.common.tileentity.TileEntityLogisticalTransporter;
|
||||
import mekanism.common.transporter.SlotInfo;
|
||||
import mekanism.common.transporter.TransporterStack;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
|
@ -147,13 +147,24 @@ public final class TransporterUtils
|
|||
return tileEntity.insert(Object3D.get(outputter), itemStack.copy(), color);
|
||||
}
|
||||
|
||||
public static boolean canInsert(TileEntity tileEntity, ItemStack itemStack, int side)
|
||||
public static boolean canInsert(TileEntity tileEntity, EnumColor color, ItemStack itemStack, int side)
|
||||
{
|
||||
if(!(tileEntity instanceof IInventory))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(tileEntity instanceof IConfigurable)
|
||||
{
|
||||
IConfigurable config = (IConfigurable)tileEntity;
|
||||
EnumColor configColor = config.getEjector().getInputColor(ForgeDirection.getOrientation(side).getOpposite());
|
||||
|
||||
if(configColor != null && configColor != color)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
IInventory inventory = (IInventory)tileEntity;
|
||||
|
||||
if(!(inventory instanceof ISidedInventory))
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.4 KiB |
BIN
resources/assets/mekanism/sound/etc/Beep.ogg
Executable file
BIN
resources/assets/mekanism/sound/etc/Beep.ogg
Executable file
Binary file not shown.
BIN
resources/assets/mekanism/sound/etc/ChanSwitch.ogg
Executable file
BIN
resources/assets/mekanism/sound/etc/ChanSwitch.ogg
Executable file
Binary file not shown.
BIN
resources/assets/mekanism/sound/etc/Error.ogg
Normal file
BIN
resources/assets/mekanism/sound/etc/Error.ogg
Normal file
Binary file not shown.
BIN
resources/assets/mekanism/sound/etc/Success.ogg
Normal file
BIN
resources/assets/mekanism/sound/etc/Success.ogg
Normal file
Binary file not shown.
Loading…
Reference in a new issue