mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-26 06:42:56 +00:00
More work on entangloporters
This commit is contained in:
1 parent
c03b712ed2
commit
f8f8dfa737
11 files changed
+463
-43
No files matched your search
@@ -28,7 +28,6 @@ import mekanism.client.gui.GuiElectrolyticSeparator;
|
||||
import mekanism.client.gui.GuiEnergizedSmelter;
|
||||
import mekanism.client.gui.GuiEnergyCube;
|
||||
import mekanism.client.gui.GuiEnrichmentChamber;
|
||||
import mekanism.client.gui.GuiEntangledBlock;
|
||||
import mekanism.client.gui.GuiFactory;
|
||||
import mekanism.client.gui.GuiFluidTank;
|
||||
import mekanism.client.gui.GuiFluidicPlenisher;
|
||||
@@ -45,6 +44,7 @@ import mekanism.client.gui.GuiPasswordEnter;
|
||||
import mekanism.client.gui.GuiPasswordModify;
|
||||
import mekanism.client.gui.GuiPrecisionSawmill;
|
||||
import mekanism.client.gui.GuiPurificationChamber;
|
||||
import mekanism.client.gui.GuiQuantumEntangloporter;
|
||||
import mekanism.client.gui.GuiResistiveHeater;
|
||||
import mekanism.client.gui.GuiRobitCrafting;
|
||||
import mekanism.client.gui.GuiRobitInventory;
|
||||
@@ -148,7 +148,6 @@ import mekanism.common.tile.TileEntityEliteFactory;
|
||||
import mekanism.common.tile.TileEntityEnergizedSmelter;
|
||||
import mekanism.common.tile.TileEntityEnergyCube;
|
||||
import mekanism.common.tile.TileEntityEnrichmentChamber;
|
||||
import mekanism.common.tile.TileEntityQuantumEntangloporter;
|
||||
import mekanism.common.tile.TileEntityFactory;
|
||||
import mekanism.common.tile.TileEntityFluidTank;
|
||||
import mekanism.common.tile.TileEntityFluidicPlenisher;
|
||||
@@ -169,6 +168,7 @@ import mekanism.common.tile.TileEntityOsmiumCompressor;
|
||||
import mekanism.common.tile.TileEntityPRC;
|
||||
import mekanism.common.tile.TileEntityPrecisionSawmill;
|
||||
import mekanism.common.tile.TileEntityPurificationChamber;
|
||||
import mekanism.common.tile.TileEntityQuantumEntangloporter;
|
||||
import mekanism.common.tile.TileEntityResistiveHeater;
|
||||
import mekanism.common.tile.TileEntityRotaryCondensentrator;
|
||||
import mekanism.common.tile.TileEntitySeismicVibrator;
|
||||
@@ -510,7 +510,7 @@ public class ClientProxy extends CommonProxy
|
||||
case 45:
|
||||
return new GuiLaserTractorBeam(player.inventory, (TileEntityLaserTractorBeam)tileEntity);
|
||||
case 46:
|
||||
return new GuiEntangledBlock(player.inventory, (TileEntityQuantumEntangloporter)tileEntity);
|
||||
return new GuiQuantumEntangloporter(player.inventory, (TileEntityQuantumEntangloporter)tileEntity);
|
||||
case 47:
|
||||
return new GuiSolarNeutronActivator(player.inventory, (TileEntitySolarNeutronActivator)tileEntity);
|
||||
case 48:
|
||||
|
||||
@@ -1,5 +1,341 @@
|
||||
package mekanism.client.gui;
|
||||
|
||||
public class GuiQuantumEntangloporter {
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.client.gui.element.GuiScrollList;
|
||||
import mekanism.client.gui.element.GuiSideConfigurationTab;
|
||||
import mekanism.client.gui.element.GuiTransporterConfigTab;
|
||||
import mekanism.client.sound.SoundHandler;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.frequency.Frequency;
|
||||
import mekanism.common.inventory.container.ContainerQuantumEntangloporter;
|
||||
import mekanism.common.network.PacketPortableTeleporter.PortableTeleporterMessage;
|
||||
import mekanism.common.network.PacketPortableTeleporter.PortableTeleporterPacketType;
|
||||
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
||||
import mekanism.common.tile.TileEntityQuantumEntangloporter;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiQuantumEntangloporter extends GuiMekanism
|
||||
{
|
||||
public static int MAX_LENGTH = 16;
|
||||
|
||||
public ResourceLocation resource;
|
||||
|
||||
public TileEntityQuantumEntangloporter tileEntity;
|
||||
|
||||
public EntityPlayer entityPlayer;
|
||||
|
||||
public GuiButton publicButton;
|
||||
public GuiButton privateButton;
|
||||
|
||||
public GuiButton setButton;
|
||||
public GuiButton deleteButton;
|
||||
|
||||
public GuiButton teleportButton;
|
||||
|
||||
public GuiScrollList scrollList;
|
||||
|
||||
public GuiTextField frequencyField;
|
||||
|
||||
public boolean privateMode;
|
||||
|
||||
public GuiQuantumEntangloporter(InventoryPlayer inventory, TileEntityQuantumEntangloporter tentity)
|
||||
{
|
||||
super(tentity, new ContainerQuantumEntangloporter(inventory, tentity));
|
||||
tileEntity = tentity;
|
||||
resource = MekanismUtils.getResource(ResourceType.GUI, "GuiTeleporter.png");
|
||||
|
||||
guiElements.add(scrollList = new GuiScrollList(this, resource, 28, 37, 120, 4));
|
||||
guiElements.add(new GuiSideConfigurationTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiTeleporter.png")));
|
||||
guiElements.add(new GuiTransporterConfigTab(this, 34, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiTeleporter.png")));
|
||||
|
||||
if(tileEntity.frequency != null)
|
||||
{
|
||||
privateMode = !tileEntity.frequency.publicFreq;
|
||||
}
|
||||
|
||||
ySize+=64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
int guiWidth = (width - xSize) / 2;
|
||||
int guiHeight = (height - ySize) / 2;
|
||||
|
||||
buttonList.clear();
|
||||
|
||||
publicButton = new GuiButton(0, guiWidth + 27, guiHeight + 14, 60, 20, LangUtils.localize("gui.public"));
|
||||
privateButton = new GuiButton(1, guiWidth + 89, guiHeight + 14, 60, 20, LangUtils.localize("gui.private"));
|
||||
|
||||
setButton = new GuiButton(2, guiWidth + 27, guiHeight + 116, 60, 20, LangUtils.localize("gui.set"));
|
||||
deleteButton = new GuiButton(3, guiWidth + 89, guiHeight + 116, 60, 20, LangUtils.localize("gui.delete"));
|
||||
|
||||
frequencyField = new GuiTextField(fontRendererObj, guiWidth + 50, guiHeight + 104, 86, 11);
|
||||
frequencyField.setMaxStringLength(MAX_LENGTH);
|
||||
frequencyField.setEnableBackgroundDrawing(false);
|
||||
|
||||
updateButtons();
|
||||
|
||||
buttonList.add(publicButton);
|
||||
buttonList.add(privateButton);
|
||||
buttonList.add(setButton);
|
||||
buttonList.add(deleteButton);
|
||||
}
|
||||
|
||||
public void setFrequency(String freq)
|
||||
{
|
||||
if(freq.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ArrayList data = new ArrayList();
|
||||
data.add(0);
|
||||
data.add(freq);
|
||||
data.add(!privateMode);
|
||||
|
||||
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
|
||||
}
|
||||
|
||||
public String getSecurity(Frequency freq)
|
||||
{
|
||||
return !freq.publicFreq ? EnumColor.DARK_RED + LangUtils.localize("gui.private") : LangUtils.localize("gui.public");
|
||||
}
|
||||
|
||||
public void updateButtons()
|
||||
{
|
||||
if(tileEntity.owner == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
List<String> text = new ArrayList<String>();
|
||||
|
||||
if(privateMode)
|
||||
{
|
||||
for(Frequency freq : tileEntity.privateCache)
|
||||
{
|
||||
text.add(freq.name);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for(Frequency freq : tileEntity.publicCache)
|
||||
{
|
||||
text.add(freq.name + " (" + freq.owner + ")");
|
||||
}
|
||||
}
|
||||
|
||||
scrollList.setText(text);
|
||||
|
||||
if(privateMode)
|
||||
{
|
||||
publicButton.enabled = true;
|
||||
privateButton.enabled = false;
|
||||
}
|
||||
else {
|
||||
publicButton.enabled = false;
|
||||
privateButton.enabled = true;
|
||||
}
|
||||
|
||||
if(scrollList.hasSelection())
|
||||
{
|
||||
Frequency freq = privateMode ? tileEntity.privateCache.get(scrollList.selected) : tileEntity.publicCache.get(scrollList.selected);
|
||||
|
||||
if(tileEntity.getFrequency() == null || !tileEntity.getFrequency().equals(freq))
|
||||
{
|
||||
setButton.enabled = true;
|
||||
}
|
||||
else {
|
||||
setButton.enabled = false;
|
||||
}
|
||||
|
||||
if(tileEntity.owner.equals(freq.owner))
|
||||
{
|
||||
deleteButton.enabled = true;
|
||||
}
|
||||
else {
|
||||
deleteButton.enabled = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
setButton.enabled = false;
|
||||
deleteButton.enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateScreen()
|
||||
{
|
||||
super.updateScreen();
|
||||
|
||||
updateButtons();
|
||||
|
||||
frequencyField.updateCursorCounter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int mouseX, int mouseY, int button)
|
||||
{
|
||||
super.mouseClicked(mouseX, mouseY, button);
|
||||
|
||||
updateButtons();
|
||||
|
||||
frequencyField.mouseClicked(mouseX, mouseY, button);
|
||||
|
||||
if(button == 0)
|
||||
{
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
if(xAxis >= 137 && xAxis <= 148 && yAxis >= 103 && yAxis <= 114)
|
||||
{
|
||||
setFrequency(frequencyField.getText());
|
||||
frequencyField.setText("");
|
||||
SoundHandler.playSound("gui.button.press");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyTyped(char c, int i)
|
||||
{
|
||||
if(!frequencyField.isFocused() || i == Keyboard.KEY_ESCAPE)
|
||||
{
|
||||
super.keyTyped(c, i);
|
||||
}
|
||||
|
||||
if(i == Keyboard.KEY_RETURN)
|
||||
{
|
||||
if(frequencyField.isFocused())
|
||||
{
|
||||
setFrequency(frequencyField.getText());
|
||||
frequencyField.setText("");
|
||||
}
|
||||
}
|
||||
|
||||
if(Character.isDigit(c) || Character.isLetter(c) || i == Keyboard.KEY_BACK || i == Keyboard.KEY_DELETE || i == Keyboard.KEY_LEFT || i == Keyboard.KEY_RIGHT)
|
||||
{
|
||||
frequencyField.textboxKeyTyped(c, i);
|
||||
}
|
||||
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton)
|
||||
{
|
||||
super.actionPerformed(guibutton);
|
||||
|
||||
if(guibutton.id == 0)
|
||||
{
|
||||
privateMode = false;
|
||||
}
|
||||
else if(guibutton.id == 1)
|
||||
{
|
||||
privateMode = true;
|
||||
}
|
||||
else if(guibutton.id == 2)
|
||||
{
|
||||
int selection = scrollList.getSelection();
|
||||
|
||||
if(selection != -1)
|
||||
{
|
||||
Frequency freq = privateMode ? tileEntity.privateCache.get(selection) : tileEntity.publicCache.get(selection);
|
||||
setFrequency(freq.name);
|
||||
}
|
||||
}
|
||||
else if(guibutton.id == 3)
|
||||
{
|
||||
int selection = scrollList.getSelection();
|
||||
|
||||
if(selection != -1)
|
||||
{
|
||||
Frequency freq = privateMode ? tileEntity.privateCache.get(selection) : tileEntity.publicCache.get(selection);
|
||||
|
||||
if(tileEntity != null)
|
||||
{
|
||||
ArrayList data = new ArrayList();
|
||||
data.add(1);
|
||||
data.add(freq.name);
|
||||
data.add(freq.publicFreq);
|
||||
|
||||
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
|
||||
}
|
||||
else {
|
||||
Mekanism.packetHandler.sendToServer(new PortableTeleporterMessage(PortableTeleporterPacketType.DEL_FREQ, freq));
|
||||
Mekanism.packetHandler.sendToServer(new PortableTeleporterMessage(PortableTeleporterPacketType.DATA_REQUEST, null));
|
||||
}
|
||||
|
||||
scrollList.selected = -1;
|
||||
}
|
||||
}
|
||||
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||
{
|
||||
int xAxis = (mouseX-(width-xSize)/2);
|
||||
int yAxis = (mouseY-(height-ySize)/2);
|
||||
|
||||
fontRendererObj.drawString(tileEntity.getInventoryName(), (xSize/2)-(fontRendererObj.getStringWidth(tileEntity.getInventoryName())/2), 4, 0x404040);
|
||||
fontRendererObj.drawString(LangUtils.localize("gui.owner") + ": " + (tileEntity.owner != null ? tileEntity.owner : LangUtils.localize("gui.none")), 8, (ySize-96)+4, 0x404040);
|
||||
|
||||
fontRendererObj.drawString(LangUtils.localize("gui.freq") + ":", 32, 81, 0x404040);
|
||||
fontRendererObj.drawString(LangUtils.localize("gui.security") + ":", 32, 91, 0x404040);
|
||||
|
||||
fontRendererObj.drawString(" " + (tileEntity.getFrequency() != null ? tileEntity.getFrequency().name : EnumColor.DARK_RED + LangUtils.localize("gui.none")), 32 + fontRendererObj.getStringWidth(LangUtils.localize("gui.freq") + ":"), 81, 0x797979);
|
||||
fontRendererObj.drawString(" " + (tileEntity.getFrequency() != null ? getSecurity(tileEntity.getFrequency()) : EnumColor.DARK_RED + LangUtils.localize("gui.none")), 32 + fontRendererObj.getStringWidth(LangUtils.localize("gui.security") + ":"), 91, 0x797979);
|
||||
|
||||
String str = LangUtils.localize("gui.set") + ":";
|
||||
renderScaledText(str, 27, 104, 0x404040, 20);
|
||||
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY)
|
||||
{
|
||||
mc.renderEngine.bindTexture(resource);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
int guiWidth = (width-xSize)/2;
|
||||
int guiHeight = (height-ySize)/2;
|
||||
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
|
||||
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
if(xAxis >= 137 && xAxis <= 148 && yAxis >= 103 && yAxis <= 114)
|
||||
{
|
||||
drawTexturedModalRect(guiWidth + 137, guiHeight + 103, xSize, 0, 11, 11);
|
||||
}
|
||||
else {
|
||||
drawTexturedModalRect(guiWidth + 137, guiHeight + 103, xSize, 11, 11, 11);
|
||||
}
|
||||
|
||||
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
|
||||
|
||||
frequencyField.drawTextBox();
|
||||
}
|
||||
}
|
||||
@@ -42,6 +42,7 @@ import mekanism.common.inventory.container.ContainerMetallurgicInfuser;
|
||||
import mekanism.common.inventory.container.ContainerNull;
|
||||
import mekanism.common.inventory.container.ContainerOredictionificator;
|
||||
import mekanism.common.inventory.container.ContainerPRC;
|
||||
import mekanism.common.inventory.container.ContainerQuantumEntangloporter;
|
||||
import mekanism.common.inventory.container.ContainerResistiveHeater;
|
||||
import mekanism.common.inventory.container.ContainerRobitCrafting;
|
||||
import mekanism.common.inventory.container.ContainerRobitInventory;
|
||||
@@ -104,6 +105,7 @@ import mekanism.common.tile.TileEntityOsmiumCompressor;
|
||||
import mekanism.common.tile.TileEntityPRC;
|
||||
import mekanism.common.tile.TileEntityPrecisionSawmill;
|
||||
import mekanism.common.tile.TileEntityPurificationChamber;
|
||||
import mekanism.common.tile.TileEntityQuantumEntangloporter;
|
||||
import mekanism.common.tile.TileEntityResistiveHeater;
|
||||
import mekanism.common.tile.TileEntityRotaryCondensentrator;
|
||||
import mekanism.common.tile.TileEntitySeismicVibrator;
|
||||
@@ -528,7 +530,7 @@ public class CommonProxy implements IGuiProvider
|
||||
case 45:
|
||||
return new ContainerLaserTractorBeam(player.inventory, (TileEntityLaserTractorBeam)tileEntity);
|
||||
case 46:
|
||||
return new ContainerNull(player, (TileEntityContainerBlock)tileEntity);
|
||||
return new ContainerQuantumEntangloporter(player.inventory, (TileEntityQuantumEntangloporter)tileEntity);
|
||||
case 47:
|
||||
return new ContainerSolarNeutronActivator(player.inventory, (TileEntitySolarNeutronActivator)tileEntity);
|
||||
case 48:
|
||||
|
||||
@@ -175,10 +175,10 @@ public class Mekanism
|
||||
public static MultiblockManager<SynchronizedBoilerData> boilerManager = new MultiblockManager<SynchronizedBoilerData>("thermoelectricBoiler");
|
||||
|
||||
/** FrequencyManagers for various networks */
|
||||
public static FrequencyManager publicTeleporters = new FrequencyManager(Frequency.class);
|
||||
public static FrequencyManager publicTeleporters = new FrequencyManager(Frequency.class, "Teleporter");
|
||||
public static Map<String, FrequencyManager> privateTeleporters = new HashMap<String, FrequencyManager>();
|
||||
|
||||
public static FrequencyManager publicEntangloporters = new FrequencyManager(InventoryFrequency.class);
|
||||
public static FrequencyManager publicEntangloporters = new FrequencyManager(InventoryFrequency.class, "Entangloporter");
|
||||
public static Map<String, FrequencyManager> privateEntangloporters = new HashMap<String, FrequencyManager>();
|
||||
|
||||
/** Mekanism creative tab */
|
||||
|
||||
@@ -223,7 +223,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
|
||||
MekanismRenderer.loadDynamicTextures(register, MachineType.PRECISION_SAWMILL.name, icons[5], def);
|
||||
break;
|
||||
case MACHINE_BLOCK_3:
|
||||
icons[0][0] = register.registerIcon("mekanism:AmbientAccumulator");
|
||||
icons[0][0] = BASE_ICON;
|
||||
icons[2][0] = BASE_ICON;
|
||||
icons[4][0] = BASE_ICON;
|
||||
MekanismRenderer.loadDynamicTextures(register, MachineType.OREDICTIONIFICATOR.name, icons[3], DefIcon.getAll(register.registerIcon("mekanism:OredictionificatorSide")));
|
||||
@@ -1224,7 +1224,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
|
||||
|
||||
for(MachineType type : MachineType.values())
|
||||
{
|
||||
if(type != QUANTUM_ENTANGLOPORTER && type != AMBIENT_ACCUMULATOR)
|
||||
if(type != AMBIENT_ACCUMULATOR)
|
||||
{
|
||||
ret.add(type);
|
||||
}
|
||||
|
||||
@@ -3,12 +3,9 @@ package mekanism.common.content.entangloporter;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.api.gas.GasTank;
|
||||
import mekanism.api.transmitters.TransmissionType;
|
||||
import mekanism.common.frequency.Frequency;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -26,8 +23,6 @@ public class InventoryFrequency extends Frequency
|
||||
public ItemStack storedItem;
|
||||
public double temperature;
|
||||
|
||||
public Map<TransmissionType, TransferType> transmissions = new HashMap<TransmissionType, TransferType>();
|
||||
|
||||
public InventoryFrequency(String n, String o)
|
||||
{
|
||||
super(n, o);
|
||||
@@ -66,11 +61,6 @@ public class InventoryFrequency extends Frequency
|
||||
}
|
||||
|
||||
nbtTags.setDouble("temperature", temperature);
|
||||
|
||||
for(TransmissionType type : TransmissionType.values())
|
||||
{
|
||||
nbtTags.setInteger("transmission" + type.ordinal(), transmissions.get(type).ordinal());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -96,11 +86,6 @@ public class InventoryFrequency extends Frequency
|
||||
}
|
||||
|
||||
temperature = nbtTags.getDouble("temperature");
|
||||
|
||||
for(TransmissionType type : TransmissionType.values())
|
||||
{
|
||||
transmissions.put(type, TransferType.values()[nbtTags.getInteger("transmission" + type.ordinal())]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -131,11 +116,6 @@ public class InventoryFrequency extends Frequency
|
||||
}
|
||||
|
||||
data.add(temperature);
|
||||
|
||||
for(TransmissionType type : TransmissionType.values())
|
||||
{
|
||||
data.add(transmissions.get(type).ordinal());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -162,11 +142,6 @@ public class InventoryFrequency extends Frequency
|
||||
}
|
||||
|
||||
temperature = dataStream.readDouble();
|
||||
|
||||
for(TransmissionType type : TransmissionType.values())
|
||||
{
|
||||
transmissions.put(type, TransferType.values()[dataStream.readInt()]);
|
||||
}
|
||||
}
|
||||
|
||||
public static enum TransferType
|
||||
|
||||
@@ -28,17 +28,21 @@ public class FrequencyManager
|
||||
|
||||
private String owner;
|
||||
|
||||
private String name;
|
||||
|
||||
private Class<? extends Frequency> frequencyClass;
|
||||
|
||||
public FrequencyManager(Class c)
|
||||
public FrequencyManager(Class c, String n)
|
||||
{
|
||||
frequencyClass = c;
|
||||
name = n;
|
||||
|
||||
managers.add(this);
|
||||
}
|
||||
|
||||
public FrequencyManager(Class c, String s)
|
||||
public FrequencyManager(Class c, String n, String s)
|
||||
{
|
||||
this(c);
|
||||
this(c, n);
|
||||
|
||||
owner = s;
|
||||
}
|
||||
@@ -173,9 +177,9 @@ public class FrequencyManager
|
||||
}
|
||||
}
|
||||
|
||||
public static FrequencyManager loadOnly(World world, String owner, Class<? extends Frequency> freqClass)
|
||||
public static FrequencyManager loadOnly(World world, String owner, Class<? extends Frequency> freqClass, String n)
|
||||
{
|
||||
FrequencyManager manager = new FrequencyManager(freqClass);
|
||||
FrequencyManager manager = new FrequencyManager(freqClass, n);
|
||||
String name = manager.getName();
|
||||
|
||||
FrequencyDataHandler handler = (FrequencyDataHandler)world.perWorldStorage.loadData(FrequencyDataHandler.class, name);
|
||||
@@ -295,7 +299,7 @@ public class FrequencyManager
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return owner != null ? owner + "FrequencyHandler" : "FrequencyHandler";
|
||||
return owner != null ? (owner + "_" + name + "FrequencyHandler") : (name + "FrequencyHandler");
|
||||
}
|
||||
|
||||
public static void reset()
|
||||
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
package mekanism.common.inventory.container;
|
||||
|
||||
import mekanism.common.tile.TileEntityQuantumEntangloporter;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerQuantumEntangloporter extends Container
|
||||
{
|
||||
private TileEntityQuantumEntangloporter tileEntity;
|
||||
|
||||
public ContainerQuantumEntangloporter(InventoryPlayer inventory, TileEntityQuantumEntangloporter tentity)
|
||||
{
|
||||
tileEntity = tentity;
|
||||
|
||||
int slotX;
|
||||
|
||||
for(slotX = 0; slotX < 3; slotX++)
|
||||
{
|
||||
for(int slotY = 0; slotY < 9; slotY++)
|
||||
{
|
||||
addSlotToContainer(new Slot(inventory, slotY + slotX * 9 + 9, 8 + slotY * 18, 148 + slotX * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for(slotX = 0; slotX < 9; slotX++)
|
||||
{
|
||||
addSlotToContainer(new Slot(inventory, slotX, 8 + slotX * 18, 206));
|
||||
}
|
||||
|
||||
tileEntity.open(inventory.player);
|
||||
tileEntity.openInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onContainerClosed(EntityPlayer entityplayer)
|
||||
{
|
||||
super.onContainerClosed(entityplayer);
|
||||
|
||||
tileEntity.close(entityplayer);
|
||||
tileEntity.closeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer entityplayer)
|
||||
{
|
||||
return tileEntity.isUseableByPlayer(entityplayer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slotID)
|
||||
{
|
||||
ItemStack stack = null;
|
||||
Slot currentSlot = (Slot)inventorySlots.get(slotID);
|
||||
|
||||
if(currentSlot != null && currentSlot.getHasStack())
|
||||
{
|
||||
ItemStack slotStack = currentSlot.getStack();
|
||||
stack = slotStack.copy();
|
||||
|
||||
if(slotID >= 0 && slotID <= 26)
|
||||
{
|
||||
if(!mergeItemStack(slotStack, 27, inventorySlots.size(), false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if(slotID > 26)
|
||||
{
|
||||
if(!mergeItemStack(slotStack, 0, 26, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(!mergeItemStack(slotStack, 0, inventorySlots.size(), true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if(slotStack.stackSize == 0)
|
||||
{
|
||||
currentSlot.putStack((ItemStack)null);
|
||||
}
|
||||
else {
|
||||
currentSlot.onSlotChanged();
|
||||
}
|
||||
|
||||
if(slotStack.stackSize == stack.stackSize)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
currentSlot.onPickupFromSlot(player, slotStack);
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
@@ -62,7 +62,7 @@ public class TileEntityQuantumEntangloporter extends TileEntityElectricBlock imp
|
||||
{
|
||||
super("QuantumEntangloporter", 0);
|
||||
|
||||
configComponent = new TileComponentConfig(this, TransmissionType.ITEM, TransmissionType.ENERGY);
|
||||
configComponent = new TileComponentConfig(this, TransmissionType.ITEM, TransmissionType.FLUID, TransmissionType.GAS, TransmissionType.ENERGY, TransmissionType.HEAT);
|
||||
|
||||
for(TransmissionType type : TransmissionType.values())
|
||||
{
|
||||
@@ -190,7 +190,7 @@ public class TileEntityQuantumEntangloporter extends TileEntityElectricBlock imp
|
||||
}
|
||||
}
|
||||
|
||||
Frequency freq = new Frequency(name, owner).setPublic(publicFreq);
|
||||
Frequency freq = new InventoryFrequency(name, owner).setPublic(publicFreq);
|
||||
freq.activeCoords.add(Coord4D.get(this));
|
||||
manager.addFrequency(freq);
|
||||
frequency = (InventoryFrequency)freq;
|
||||
|
||||
@@ -179,6 +179,7 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo
|
||||
{
|
||||
frequency = freq;
|
||||
frequency.activeCoords.add(Coord4D.get(this));
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -221,7 +222,7 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo
|
||||
return Mekanism.privateTeleporters.get(owner);
|
||||
}
|
||||
|
||||
return FrequencyManager.loadOnly(world, owner, Frequency.class);
|
||||
return FrequencyManager.loadOnly(world, owner, Frequency.class, "Teleporter");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user