Merge branch 'master' of https://github.com/aidancbrady/Mekanism
Conflicts: common/mekanism/client/render/tileentity/RenderLogisticalTransporter.java
|
@ -21,7 +21,7 @@
|
|||
<fileset dir="../Minecraft Forge Latest/"/>
|
||||
</copy>
|
||||
|
||||
<get src="http://www.chickenbones.craftsaddle.org/Files/New_Versions/1.6.4/NotEnoughItems-dev%201.6.1.5.jar"
|
||||
<get src="http://www.chickenbones.craftsaddle.org/Files/New_Versions/1.6.4/NotEnoughItems-dev%201.6.1.5_d1.jar"
|
||||
dest="${dir.mcp}/lib/NEI-dev.jar"/>
|
||||
|
||||
<get src="http://www.chickenbones.craftsaddle.org/Files/New_Versions/1.6.4/CodeChickenCore-dev%200.9.0.7.jar"
|
||||
|
|
|
@ -18,7 +18,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
@SideOnly(Side.CLIENT)
|
||||
public class ClientConnectionHandler implements IConnectionHandler
|
||||
{
|
||||
public VoiceClient voiceClient = new VoiceClient();
|
||||
public VoiceClient voiceClient;
|
||||
|
||||
@Override
|
||||
public void playerLoggedIn(Player player, NetHandler netHandler, INetworkManager manager) {}
|
||||
|
@ -32,21 +32,26 @@ public class ClientConnectionHandler implements IConnectionHandler
|
|||
@Override
|
||||
public void connectionOpened(NetHandler netClientHandler, String server, int port, INetworkManager manager)
|
||||
{
|
||||
voiceClient.start(server, 36123);
|
||||
try {
|
||||
voiceClient = new VoiceClient(server, 36123);
|
||||
voiceClient.run();
|
||||
} catch(Exception e) {}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connectionOpened(NetHandler netClientHandler, MinecraftServer server, INetworkManager manager)
|
||||
{
|
||||
try {
|
||||
voiceClient.start(InetAddress.getLocalHost().getHostAddress(), 36123);
|
||||
voiceClient = new VoiceClient(InetAddress.getLocalHost().getHostAddress(), 36123);
|
||||
voiceClient.run();
|
||||
} catch(Exception e) {}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connectionClosed(INetworkManager manager)
|
||||
{
|
||||
voiceClient.stop();
|
||||
voiceClient.disconnect();
|
||||
voiceClient = null;
|
||||
Mekanism.proxy.unloadSoundHandler();
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ import mekanism.client.gui.GuiEnergyCube;
|
|||
import mekanism.client.gui.GuiEnrichmentChamber;
|
||||
import mekanism.client.gui.GuiFactory;
|
||||
import mekanism.client.gui.GuiGasTank;
|
||||
import mekanism.client.gui.GuiLogisticalSorter;
|
||||
import mekanism.client.gui.GuiMetallurgicInfuser;
|
||||
import mekanism.client.gui.GuiOsmiumCompressor;
|
||||
import mekanism.client.gui.GuiPasswordEnter;
|
||||
|
@ -77,6 +78,7 @@ import mekanism.common.tileentity.TileEntityEnergyCube;
|
|||
import mekanism.common.tileentity.TileEntityEnrichmentChamber;
|
||||
import mekanism.common.tileentity.TileEntityFactory;
|
||||
import mekanism.common.tileentity.TileEntityGasTank;
|
||||
import mekanism.common.tileentity.TileEntityLogisticalSorter;
|
||||
import mekanism.common.tileentity.TileEntityLogisticalTransporter;
|
||||
import mekanism.common.tileentity.TileEntityMechanicalPipe;
|
||||
import mekanism.common.tileentity.TileEntityMetallurgicInfuser;
|
||||
|
@ -348,6 +350,8 @@ public class ClientProxy extends CommonProxy
|
|||
}
|
||||
case 25:
|
||||
return new GuiRobitRepair(player.inventory, world, x);
|
||||
case 26:
|
||||
return new GuiLogisticalSorter(player.inventory, (TileEntityLogisticalSorter)tileEntity);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -41,9 +41,9 @@ public class GuiGasTank extends GuiMekanism
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int mouseX, int mouseY)
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY)
|
||||
{
|
||||
super.drawGuiContainerBackgroundLayer(par1, mouseX, mouseY);
|
||||
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
|
||||
|
||||
mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiGasTank.png"));
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
|
54
common/mekanism/client/gui/GuiLogisticalSorter.java
Normal file
|
@ -0,0 +1,54 @@
|
|||
package mekanism.client.gui;
|
||||
|
||||
import mekanism.common.inventory.container.ContainerItemStackFilter;
|
||||
import mekanism.common.tileentity.TileEntityLogisticalSorter;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiLogisticalSorter extends GuiMekanism
|
||||
{
|
||||
public TileEntityLogisticalSorter tileEntity;
|
||||
|
||||
public GuiLogisticalSorter(InventoryPlayer inventory, TileEntityLogisticalSorter tentity)
|
||||
{
|
||||
super(new ContainerItemStackFilter(inventory, tentity));
|
||||
tileEntity = tentity;
|
||||
|
||||
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiLogisticalSorter.png")));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||
{
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
fontRenderer.drawString("Logistical Sorter", 43, 6, 0x404040);
|
||||
fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, ySize - 96 + 2, 0x404040);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY)
|
||||
{
|
||||
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
|
||||
|
||||
mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiLogisticalSorter.png"));
|
||||
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 - guiWidth;
|
||||
int yAxis = mouseY - guiHeight;
|
||||
}
|
||||
}
|
|
@ -5,8 +5,8 @@ import mekanism.client.model.ModelTransmitter;
|
|||
import mekanism.client.model.ModelTransmitter.Size;
|
||||
import mekanism.client.model.ModelTransporterBox;
|
||||
import mekanism.client.render.MekanismRenderer;
|
||||
import mekanism.common.TransporterStack;
|
||||
import mekanism.common.tileentity.TileEntityLogisticalTransporter;
|
||||
import mekanism.common.transporter.TransporterStack;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import mekanism.common.util.TransporterUtils;
|
||||
|
|
|
@ -12,10 +12,13 @@ import cpw.mods.fml.relauncher.Side;
|
|||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class VoiceClient
|
||||
public class VoiceClient extends Thread
|
||||
{
|
||||
public Socket socket;
|
||||
|
||||
public String ip;
|
||||
public int port;
|
||||
|
||||
public AudioFormat format = new AudioFormat(11025.0F, 8, 1, true, true);
|
||||
|
||||
public VoiceInput inputThread;
|
||||
|
@ -26,7 +29,14 @@ public class VoiceClient
|
|||
|
||||
public boolean running;
|
||||
|
||||
public void start(String ip, int port)
|
||||
public VoiceClient(String s, int i)
|
||||
{
|
||||
ip = s;
|
||||
port = i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
System.out.println("[Mekanism] VoiceServer: Starting client connection...");
|
||||
|
||||
|
@ -39,32 +49,50 @@ public class VoiceClient
|
|||
|
||||
(outputThread = new VoiceOutput(this)).start();
|
||||
(inputThread = new VoiceInput(this)).start();
|
||||
|
||||
System.out.println("[Mekanism] VoiceServer: Successfully connected to server.");
|
||||
} catch(Exception e) {
|
||||
System.err.println("[Mekanism] VoiceServer: Error while starting client connection.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void stop()
|
||||
public void disconnect()
|
||||
{
|
||||
System.out.println("[Mekanism] VoiceServer: Stopping client connection...");
|
||||
|
||||
try {
|
||||
inputThread.interrupt();
|
||||
outputThread.interrupt();
|
||||
try {
|
||||
inputThread.interrupt();
|
||||
outputThread.interrupt();
|
||||
} catch(Exception e) {}
|
||||
|
||||
inputThread.close();
|
||||
outputThread.close();
|
||||
try {
|
||||
interrupt();
|
||||
} catch(Exception e) {}
|
||||
|
||||
output.flush();
|
||||
output.close();
|
||||
output = null;
|
||||
try {
|
||||
inputThread.close();
|
||||
outputThread.close();
|
||||
} catch(Exception e) {}
|
||||
|
||||
try {
|
||||
output.flush();
|
||||
output.close();
|
||||
output = null;
|
||||
} catch(Exception e) {}
|
||||
|
||||
try {
|
||||
input.close();
|
||||
input = null;
|
||||
} catch(Exception e) {}
|
||||
|
||||
try {
|
||||
socket.close();
|
||||
socket = null;
|
||||
} catch(Exception e) {}
|
||||
|
||||
input.close();
|
||||
input = null;
|
||||
|
||||
socket.close();
|
||||
socket = null;
|
||||
running = false;
|
||||
} catch(Exception e) {
|
||||
System.err.println("[Mekanism] VoiceServer: Error while stopping client connection.");
|
||||
|
|
|
@ -9,6 +9,7 @@ import mekanism.common.inventory.container.ContainerElectricPump;
|
|||
import mekanism.common.inventory.container.ContainerEnergyCube;
|
||||
import mekanism.common.inventory.container.ContainerFactory;
|
||||
import mekanism.common.inventory.container.ContainerGasTank;
|
||||
import mekanism.common.inventory.container.ContainerItemStackFilter;
|
||||
import mekanism.common.inventory.container.ContainerMetallurgicInfuser;
|
||||
import mekanism.common.inventory.container.ContainerRobitCrafting;
|
||||
import mekanism.common.inventory.container.ContainerRobitInventory;
|
||||
|
@ -32,6 +33,7 @@ import mekanism.common.tileentity.TileEntityEnergyCube;
|
|||
import mekanism.common.tileentity.TileEntityEnrichmentChamber;
|
||||
import mekanism.common.tileentity.TileEntityFactory;
|
||||
import mekanism.common.tileentity.TileEntityGasTank;
|
||||
import mekanism.common.tileentity.TileEntityLogisticalSorter;
|
||||
import mekanism.common.tileentity.TileEntityLogisticalTransporter;
|
||||
import mekanism.common.tileentity.TileEntityMechanicalPipe;
|
||||
import mekanism.common.tileentity.TileEntityMetallurgicInfuser;
|
||||
|
@ -280,6 +282,8 @@ public class CommonProxy
|
|||
}
|
||||
case 25:
|
||||
return new ContainerRobitRepair(player.inventory, world);
|
||||
case 26:
|
||||
return new ContainerItemStackFilter(player.inventory, (TileEntityLogisticalSorter)tileEntity);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package mekanism.common;
|
||||
|
||||
import ic2.api.energy.event.EnergyTileLoadEvent;
|
||||
import ic2.api.energy.tile.IEnergyTile;
|
||||
import ic2.api.recipe.RecipeInputOreDict;
|
||||
import ic2.api.recipe.Recipes;
|
||||
|
||||
|
@ -19,7 +17,6 @@ import mekanism.api.infuse.InfuseRegistry;
|
|||
import mekanism.api.infuse.InfuseType;
|
||||
import mekanism.api.infuse.InfusionInput;
|
||||
import mekanism.api.transmitters.TransmitterNetworkRegistry;
|
||||
import mekanism.client.sound.SoundHandler;
|
||||
import mekanism.common.EnergyNetwork.EnergyTransferEvent;
|
||||
import mekanism.common.FluidNetwork.FluidTransferEvent;
|
||||
import mekanism.common.IFactory.RecipeType;
|
||||
|
@ -76,11 +73,10 @@ import mekanism.common.network.PacketWalkieTalkieState;
|
|||
import mekanism.common.network.PacketWeather;
|
||||
import mekanism.common.tileentity.TileEntityBoundingBlock;
|
||||
import mekanism.common.tileentity.TileEntityControlPanel;
|
||||
import mekanism.common.tileentity.TileEntityElectricBlock;
|
||||
import mekanism.common.tileentity.TileEntityEnergyCube;
|
||||
import mekanism.common.tileentity.TileEntityGasTank;
|
||||
import mekanism.common.tileentity.TileEntityLogisticalSorter;
|
||||
import mekanism.common.tileentity.TileEntityTeleporter;
|
||||
import mekanism.common.tileentity.TileEntityUniversalCable;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import mekanism.common.voice.VoiceServerManager;
|
||||
|
@ -89,11 +85,9 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.ForgeSubscribe;
|
||||
import net.minecraftforge.event.world.ChunkEvent;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
import rebelkeithy.mods.metallurgy.api.IOreInfo;
|
||||
|
@ -112,8 +106,6 @@ import cpw.mods.fml.common.network.NetworkMod;
|
|||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* Mekanism - the mod in which no true definition fits.
|
||||
|
@ -417,6 +409,9 @@ public class Mekanism
|
|||
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(WalkieTalkie), new Object[] {
|
||||
" O", "SCS", " S ", Character.valueOf('O'), "ingotOsmium", Character.valueOf('S'), "ingotSteel", Character.valueOf('C'), "circuitBasic"
|
||||
}));
|
||||
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(MachineBlock, 1, 15), new Object[] {
|
||||
"IPI", "ICI", "III", Character.valueOf('I'), Item.ingotIron, Character.valueOf('P'), Block.pistonBase, Character.valueOf('C'), "circuitBasic"
|
||||
}));
|
||||
|
||||
//Factory Recipes
|
||||
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(MekanismUtils.getFactory(FactoryTier.BASIC, RecipeType.SMELTING), new Object[] {
|
||||
|
@ -1033,6 +1028,7 @@ public class Mekanism
|
|||
GameRegistry.registerTileEntity(TileEntityControlPanel.class, "ControlPanel");
|
||||
GameRegistry.registerTileEntity(TileEntityGasTank.class, "GasTank");
|
||||
GameRegistry.registerTileEntity(TileEntityTeleporter.class, "MekanismTeleporter");
|
||||
GameRegistry.registerTileEntity(TileEntityLogisticalSorter.class, "LogisticalSorter");
|
||||
|
||||
//Load tile entities that have special renderers.
|
||||
proxy.registerSpecialTileEntities();
|
||||
|
|
|
@ -58,6 +58,7 @@ public class PacketHandler implements IPacketHandler
|
|||
packetType.read(dataStream, entityplayer, entityplayer.worldObj);
|
||||
} catch(Exception e) {
|
||||
System.err.println("[Mekanism] Error while reading '" + packetType.getName() + "' packet.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
} catch(Exception e) {
|
||||
System.err.println("[Mekanism] Error while handling packet.");
|
||||
|
|
|
@ -34,6 +34,7 @@ import mekanism.common.tileentity.TileEntityEliteFactory;
|
|||
import mekanism.common.tileentity.TileEntityEnergizedSmelter;
|
||||
import mekanism.common.tileentity.TileEntityEnrichmentChamber;
|
||||
import mekanism.common.tileentity.TileEntityFactory;
|
||||
import mekanism.common.tileentity.TileEntityLogisticalSorter;
|
||||
import mekanism.common.tileentity.TileEntityMetallurgicInfuser;
|
||||
import mekanism.common.tileentity.TileEntityOsmiumCompressor;
|
||||
import mekanism.common.tileentity.TileEntityPurificationChamber;
|
||||
|
@ -80,6 +81,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
* 12: Electric Pump
|
||||
* 13: Electric Chest
|
||||
* 14: Chargepad
|
||||
* 15: Logistical Sorter
|
||||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
|
@ -136,6 +138,12 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds
|
|||
icons[10][1] = register.registerIcon("mekanism:EnergizedSmelterFrontOn");
|
||||
icons[10][2] = register.registerIcon("mekanism:SteelCasing");
|
||||
icons[11][0] = register.registerIcon("mekanism:Teleporter");
|
||||
icons[15][0] = register.registerIcon("mekanism:LogisticalSorterSideOn");
|
||||
icons[15][1] = register.registerIcon("mekanism:LogisticalSorterSideOff");
|
||||
icons[15][2] = register.registerIcon("mekanism:LogisticalSorterFrontOn");
|
||||
icons[15][3] = register.registerIcon("mekanism:LogisticalSorterFrontOff");
|
||||
icons[15][4] = register.registerIcon("mekanism:LogisticalSorterBackOn");
|
||||
icons[15][5] = register.registerIcon("mekanism:LogisticalSorterBackOff");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -174,22 +182,22 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds
|
|||
float iRandom = 0.52F;
|
||||
float jRandom = random.nextFloat() * 0.6F - 0.3F;
|
||||
|
||||
if (tileEntity.facing == 4)
|
||||
if(tileEntity.facing == 4)
|
||||
{
|
||||
world.spawnParticle("smoke", (double)(xRandom - iRandom), (double)yRandom, (double)(zRandom + jRandom), 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("reddust", (double)(xRandom - iRandom), (double)yRandom, (double)(zRandom + jRandom), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
else if (tileEntity.facing == 5)
|
||||
else if(tileEntity.facing == 5)
|
||||
{
|
||||
world.spawnParticle("smoke", (double)(xRandom + iRandom), (double)yRandom, (double)(zRandom + jRandom), 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("reddust", (double)(xRandom + iRandom), (double)yRandom, (double)(zRandom + jRandom), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
else if (tileEntity.facing == 2)
|
||||
else if(tileEntity.facing == 2)
|
||||
{
|
||||
world.spawnParticle("smoke", (double)(xRandom + jRandom), (double)yRandom, (double)(zRandom - iRandom), 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("reddust", (double)(xRandom + jRandom), (double)yRandom, (double)(zRandom - iRandom), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
else if (tileEntity.facing == 3)
|
||||
else if(tileEntity.facing == 3)
|
||||
{
|
||||
world.spawnParticle("smoke", (double)(xRandom + jRandom), (double)yRandom, (double)(zRandom + iRandom), 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("reddust", (double)(xRandom + jRandom), (double)yRandom, (double)(zRandom + iRandom), 0.0D, 0.0D, 0.0D);
|
||||
|
@ -341,6 +349,20 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds
|
|||
{
|
||||
return icons[11][0];
|
||||
}
|
||||
else if(meta == 15)
|
||||
{
|
||||
if(side == 1)
|
||||
{
|
||||
return icons[15][3];
|
||||
}
|
||||
else if(side == 0)
|
||||
{
|
||||
return icons[15][5];
|
||||
}
|
||||
else {
|
||||
return icons[15][1];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -478,6 +500,20 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds
|
|||
{
|
||||
return icons[11][0];
|
||||
}
|
||||
else if(metadata == 15)
|
||||
{
|
||||
if(side == tileEntity.facing)
|
||||
{
|
||||
return MekanismUtils.isActive(world, x, y, z) ? icons[15][2] : icons[15][3];
|
||||
}
|
||||
else if(side == ForgeDirection.getOrientation(tileEntity.facing).getOpposite().ordinal())
|
||||
{
|
||||
return MekanismUtils.isActive(world, x, y, z) ? icons[15][4] : icons[15][5];
|
||||
}
|
||||
else {
|
||||
return MekanismUtils.isActive(world, x, y, z) ? icons[15][0] : icons[15][1];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -519,6 +555,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds
|
|||
list.add(new ItemStack(i, 1, 12));
|
||||
list.add(new ItemStack(i, 1, 13));
|
||||
list.add(new ItemStack(i, 1, 14));
|
||||
list.add(new ItemStack(i, 1, 15));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -794,31 +831,34 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds
|
|||
|
||||
public static enum MachineType
|
||||
{
|
||||
ENRICHMENT_CHAMBER(0, 3, Mekanism.enrichmentChamberUsage*400, TileEntityEnrichmentChamber.class, false),
|
||||
OSMIUM_COMPRESSOR(1, 4, Mekanism.osmiumCompressorUsage*400, TileEntityOsmiumCompressor.class, false),
|
||||
COMBINER(2, 5, Mekanism.combinerUsage*400, TileEntityCombiner.class, false),
|
||||
CRUSHER(3, 6, Mekanism.crusherUsage*400, TileEntityCrusher.class, false),
|
||||
THEORETICAL_ELEMENTIZER(4, 7, Mekanism.theoreticalElementizerUsage*400, TileEntityTheoreticalElementizer.class, true),
|
||||
BASIC_FACTORY(5, 11, Mekanism.factoryUsage*3*400, TileEntityFactory.class, false),
|
||||
ADVANCED_FACTORY(6, 11, Mekanism.factoryUsage*5*400, TileEntityAdvancedFactory.class, false),
|
||||
ELITE_FACTORY(7, 11, Mekanism.factoryUsage*7*400, TileEntityEliteFactory.class, false),
|
||||
METALLURGIC_INFUSER(8, 12, Mekanism.metallurgicInfuserUsage*400, TileEntityMetallurgicInfuser.class, true),
|
||||
PURIFICATION_CHAMBER(9, 15, Mekanism.purificationChamberUsage*400, TileEntityPurificationChamber.class, false),
|
||||
ENERGIZED_SMELTER(10, 16, Mekanism.energizedSmelterUsage*400, TileEntityEnergizedSmelter.class, false),
|
||||
TELEPORTER(11, 13, 5000000, TileEntityTeleporter.class, false),
|
||||
ELECTRIC_PUMP(12, 17, 10000, TileEntityElectricPump.class, true),
|
||||
ELECTRIC_CHEST(13, -1, 12000, TileEntityElectricChest.class, true),
|
||||
CHARGEPAD(14, -1, 9000, TileEntityChargepad.class, true);
|
||||
ENRICHMENT_CHAMBER(0, "EnrichmentChamber", 3, Mekanism.enrichmentChamberUsage*400, TileEntityEnrichmentChamber.class, false),
|
||||
OSMIUM_COMPRESSOR(1, "OsmiumCompressor", 4, Mekanism.osmiumCompressorUsage*400, TileEntityOsmiumCompressor.class, false),
|
||||
COMBINER(2, "Combiner", 5, Mekanism.combinerUsage*400, TileEntityCombiner.class, false),
|
||||
CRUSHER(3, "Crusher", 6, Mekanism.crusherUsage*400, TileEntityCrusher.class, false),
|
||||
THEORETICAL_ELEMENTIZER(4, "TheoreticalElementizer", 7, Mekanism.theoreticalElementizerUsage*400, TileEntityTheoreticalElementizer.class, true),
|
||||
BASIC_FACTORY(5, "BasicFactory", 11, Mekanism.factoryUsage*3*400, TileEntityFactory.class, false),
|
||||
ADVANCED_FACTORY(6, "AdvancedFactory", 11, Mekanism.factoryUsage*5*400, TileEntityAdvancedFactory.class, false),
|
||||
ELITE_FACTORY(7, "EliteFactory", 11, Mekanism.factoryUsage*7*400, TileEntityEliteFactory.class, false),
|
||||
METALLURGIC_INFUSER(8, "MetallurgicInfuser", 12, Mekanism.metallurgicInfuserUsage*400, TileEntityMetallurgicInfuser.class, true),
|
||||
PURIFICATION_CHAMBER(9, "PurificationChamber", 15, Mekanism.purificationChamberUsage*400, TileEntityPurificationChamber.class, false),
|
||||
ENERGIZED_SMELTER(10, "EnergizedSmelter", 16, Mekanism.energizedSmelterUsage*400, TileEntityEnergizedSmelter.class, false),
|
||||
TELEPORTER(11, "Teleporter", 13, 5000000, TileEntityTeleporter.class, false),
|
||||
ELECTRIC_PUMP(12, "ElectricPump", 17, 10000, TileEntityElectricPump.class, true),
|
||||
ELECTRIC_CHEST(13, "ElectricChest", -1, 12000, TileEntityElectricChest.class, true),
|
||||
CHARGEPAD(14, "Chargepad", -1, 9000, TileEntityChargepad.class, true),
|
||||
LOGISTICAL_SORTER(15, "LogisticalSorter", 26, 12000, TileEntityLogisticalSorter.class, false);
|
||||
|
||||
public int meta;
|
||||
public String name;
|
||||
public int guiId;
|
||||
public double baseEnergy;
|
||||
public Class<? extends TileEntity> tileEntityClass;
|
||||
public boolean hasModel;
|
||||
|
||||
private MachineType(int i, int j, double k, Class<? extends TileEntity> tileClass, boolean model)
|
||||
private MachineType(int i, String s, int j, double k, Class<? extends TileEntity> tileClass, boolean model)
|
||||
{
|
||||
meta = i;
|
||||
name = s;
|
||||
guiId = j;
|
||||
baseEnergy = k;
|
||||
tileEntityClass = tileClass;
|
||||
|
|
|
@ -16,6 +16,7 @@ import mekanism.common.tileentity.TileEntityLogisticalTransporter;
|
|||
import mekanism.common.tileentity.TileEntityMechanicalPipe;
|
||||
import mekanism.common.tileentity.TileEntityPressurizedTube;
|
||||
import mekanism.common.tileentity.TileEntityUniversalCable;
|
||||
import mekanism.common.transporter.TransporterPathfinder;
|
||||
import mekanism.common.util.CableUtils;
|
||||
import mekanism.common.util.TransporterUtils;
|
||||
import net.minecraft.block.Block;
|
||||
|
|
|
@ -0,0 +1,85 @@
|
|||
package mekanism.common.inventory.container;
|
||||
|
||||
import mekanism.api.gas.EnumGas;
|
||||
import mekanism.common.inventory.slot.SlotStorageTank;
|
||||
import mekanism.common.tileentity.TileEntityLogisticalSorter;
|
||||
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 ContainerItemStackFilter extends Container
|
||||
{
|
||||
private TileEntityLogisticalSorter tileEntity;
|
||||
|
||||
public ContainerItemStackFilter(InventoryPlayer inventory, TileEntityLogisticalSorter tentity)
|
||||
{
|
||||
tileEntity = tentity;
|
||||
addSlotToContainer(new Slot(tentity, 0, 8, 8));
|
||||
|
||||
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, 84 + slotX * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for(slotX = 0; slotX < 9; ++slotX)
|
||||
{
|
||||
addSlotToContainer(new Slot(inventory, slotX, 8 + slotX * 18, 142));
|
||||
}
|
||||
|
||||
tileEntity.openChest();
|
||||
tileEntity.playersUsing.add(inventory.player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onContainerClosed(EntityPlayer entityplayer)
|
||||
{
|
||||
super.onContainerClosed(entityplayer);
|
||||
tileEntity.closeChest();
|
||||
tileEntity.playersUsing.remove(entityplayer);
|
||||
}
|
||||
|
||||
@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();
|
||||
|
||||
//TODO
|
||||
|
||||
if(slotStack.stackSize == 0)
|
||||
{
|
||||
currentSlot.putStack((ItemStack)null);
|
||||
}
|
||||
else {
|
||||
currentSlot.onSlotChanged();
|
||||
}
|
||||
|
||||
if(slotStack.stackSize == stack.stackSize)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
currentSlot.onPickupFromSlot(player, slotStack);
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
}
|
|
@ -63,6 +63,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
* 12: Electric Pump
|
||||
* 13: Electric Chest
|
||||
* 14: Chargepad
|
||||
* 15: Logistical Sorter
|
||||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
|
@ -88,60 +89,7 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, IItem
|
|||
@Override
|
||||
public String getUnlocalizedName(ItemStack itemstack)
|
||||
{
|
||||
String name = "";
|
||||
switch(itemstack.getItemDamage())
|
||||
{
|
||||
case 0:
|
||||
name = "EnrichmentChamber";
|
||||
break;
|
||||
case 1:
|
||||
name = "OsmiumCompressor";
|
||||
break;
|
||||
case 2:
|
||||
name = "Combiner";
|
||||
break;
|
||||
case 3:
|
||||
name = "Crusher";
|
||||
break;
|
||||
case 4:
|
||||
name = "TheoreticalElementizer";
|
||||
break;
|
||||
case 5:
|
||||
name = "BasicFactory";
|
||||
break;
|
||||
case 6:
|
||||
name = "AdvancedFactory";
|
||||
break;
|
||||
case 7:
|
||||
name = "EliteFactory";
|
||||
break;
|
||||
case 8:
|
||||
name = "MetallurgicInfuser";
|
||||
break;
|
||||
case 9:
|
||||
name = "PurificationChamber";
|
||||
break;
|
||||
case 10:
|
||||
name = "EnergizedSmelter";
|
||||
break;
|
||||
case 11:
|
||||
name = "Teleporter";
|
||||
break;
|
||||
case 12:
|
||||
name = "ElectricPump";
|
||||
break;
|
||||
case 13:
|
||||
name = "ElectricChest";
|
||||
break;
|
||||
case 14:
|
||||
name = "Chargepad";
|
||||
break;
|
||||
default:
|
||||
name = "Unknown";
|
||||
break;
|
||||
}
|
||||
|
||||
return getUnlocalizedName() + "." + name;
|
||||
return getUnlocalizedName() + "." + MachineType.getFromMetadata(itemstack.getItemDamage()).name;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -81,7 +81,7 @@ public class ItemConfigurator extends ItemEnergized
|
|||
else if(world.getBlockTileEntity(x, y, z) instanceof TileEntityLogisticalTransporter)
|
||||
{
|
||||
TileEntityLogisticalTransporter transporter = (TileEntityLogisticalTransporter)world.getBlockTileEntity(x, y, z);
|
||||
transporter.insert(new Object3D(x, y, z).getFromSide(ForgeDirection.getOrientation(side)), new ItemStack(Item.appleRed));
|
||||
transporter.insert(new Object3D(x, y, z).getFromSide(ForgeDirection.getOrientation(side)), new ItemStack(Item.appleRed), EnumColor.RED);
|
||||
return true;
|
||||
}
|
||||
else if(world.getBlockTileEntity(x, y, z) instanceof ITransmitter)
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
package mekanism.common.network;
|
||||
|
||||
import java.io.DataOutputStream;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.common.ITileNetwork;
|
||||
import mekanism.common.PacketHandler;
|
||||
import mekanism.common.PacketHandler.Transmission;
|
||||
import mekanism.common.tileentity.TileEntityDynamicTank;
|
||||
import mekanism.common.tileentity.TileEntityLogisticalSorter;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
|
||||
public class PacketLogisticalSorterGui implements IMekanismPacket
|
||||
{
|
||||
public Object3D object3D;
|
||||
|
||||
public int filterIndex;
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return "LogisticalSorterGui";
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMekanismPacket setParams(Object... data)
|
||||
{
|
||||
object3D = (Object3D)data[0];
|
||||
filterIndex = (Integer)data[1];
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(ByteArrayDataInput dataStream, EntityPlayer player, World world) throws Exception
|
||||
{
|
||||
int x = dataStream.readInt();
|
||||
int y = dataStream.readInt();
|
||||
int z = dataStream.readInt();
|
||||
|
||||
int id = dataStream.readInt();
|
||||
|
||||
int index = dataStream.readInt();
|
||||
|
||||
World worldServer = FMLCommonHandler.instance().getMinecraftServerInstance().worldServerForDimension(id);
|
||||
|
||||
if(worldServer != null && worldServer.getBlockTileEntity(x, y, z) instanceof ITileNetwork)
|
||||
{
|
||||
TileEntity tileEntity = worldServer.getBlockTileEntity(x, y, z);
|
||||
|
||||
if(tileEntity instanceof TileEntityLogisticalSorter)
|
||||
{
|
||||
((TileEntityDynamicTank)tileEntity).sendStructure = true;
|
||||
}
|
||||
|
||||
PacketHandler.sendPacket(Transmission.ALL_CLIENTS, new PacketTileEntity().setParams(Object3D.get(worldServer.getBlockTileEntity(x, y, z)), ((ITileNetwork)worldServer.getBlockTileEntity(x, y, z)).getNetworkedData(new ArrayList())));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(DataOutputStream dataStream) throws Exception
|
||||
{
|
||||
dataStream.writeInt(object3D.xCoord);
|
||||
dataStream.writeInt(object3D.yCoord);
|
||||
dataStream.writeInt(object3D.zCoord);
|
||||
|
||||
dataStream.writeInt(object3D.dimensionId);
|
||||
|
||||
dataStream.writeInt(filterIndex);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,238 @@
|
|||
package mekanism.common.tileentity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.common.IActiveState;
|
||||
import mekanism.common.IRedstoneControl;
|
||||
import mekanism.common.PacketHandler;
|
||||
import mekanism.common.PacketHandler.Transmission;
|
||||
import mekanism.common.block.BlockMachine.MachineType;
|
||||
import mekanism.common.network.PacketTileEntity;
|
||||
import mekanism.common.transporter.SlotInfo;
|
||||
import mekanism.common.transporter.TransporterFilter;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.TransporterUtils;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
public class TileEntityLogisticalSorter extends TileEntityElectricBlock implements IRedstoneControl, IActiveState
|
||||
{
|
||||
public Set<TransporterFilter> filters = new HashSet<TransporterFilter>();
|
||||
|
||||
public RedstoneControl controlType = RedstoneControl.DISABLED;
|
||||
|
||||
public final int MAX_DELAY = 10;
|
||||
|
||||
public int delayTicks;
|
||||
|
||||
public boolean isActive;
|
||||
|
||||
public boolean clientActive;
|
||||
|
||||
public TileEntityLogisticalSorter()
|
||||
{
|
||||
super("LogisticalSorter", MachineType.LOGISTICAL_SORTER.baseEnergy);
|
||||
inventory = new ItemStack[1];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
super.onUpdate();
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
delayTicks = Math.max(0, delayTicks-1);
|
||||
|
||||
if(delayTicks == 8)
|
||||
{
|
||||
setActive(false);
|
||||
}
|
||||
|
||||
if(MekanismUtils.canFunction(this) && delayTicks == 0)
|
||||
{
|
||||
TileEntity back = Object3D.get(this).getFromSide(ForgeDirection.getOrientation(facing).getOpposite()).getTileEntity(worldObj);
|
||||
TileEntity front = Object3D.get(this).getFromSide(ForgeDirection.getOrientation(facing)).getTileEntity(worldObj);
|
||||
|
||||
if(back instanceof IInventory && front instanceof TileEntityLogisticalTransporter)
|
||||
{
|
||||
IInventory inventory = (IInventory)back;
|
||||
TileEntityLogisticalTransporter transporter = (TileEntityLogisticalTransporter)front;
|
||||
|
||||
SlotInfo inInventory = TransporterUtils.takeItem(inventory, facing);
|
||||
|
||||
EnumColor color = null;
|
||||
|
||||
for(TransporterFilter filter : filters)
|
||||
{
|
||||
if(filter.canFilter(inInventory.itemStack))
|
||||
{
|
||||
color = filter.color;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(inInventory != null && inInventory.itemStack != null)
|
||||
{
|
||||
if(TransporterUtils.insert(this, transporter, inInventory.itemStack, color))
|
||||
{
|
||||
inventory.setInventorySlotContents(inInventory.slotID, null);
|
||||
setActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
delayTicks = 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbtTags)
|
||||
{
|
||||
super.writeToNBT(nbtTags);
|
||||
|
||||
nbtTags.setInteger("controlType", controlType.ordinal());
|
||||
|
||||
NBTTagList filterTags = new NBTTagList();
|
||||
|
||||
for(TransporterFilter filter : filters)
|
||||
{
|
||||
NBTTagCompound tagCompound = new NBTTagCompound();
|
||||
filter.write(tagCompound);
|
||||
filterTags.appendTag(tagCompound);
|
||||
}
|
||||
|
||||
if(filterTags.tagCount() != 0)
|
||||
{
|
||||
nbtTags.setTag("filters", filterTags);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbtTags)
|
||||
{
|
||||
super.readFromNBT(nbtTags);
|
||||
|
||||
controlType = RedstoneControl.values()[nbtTags.getInteger("controlType")];
|
||||
|
||||
if(nbtTags.hasKey("filters"))
|
||||
{
|
||||
NBTTagList tagList = nbtTags.getTagList("filters");
|
||||
|
||||
for(int i = 0; i < tagList.tagCount(); i++)
|
||||
{
|
||||
filters.add(TransporterFilter.readFromNBT((NBTTagCompound)tagList.tagAt(i)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlePacketData(ByteArrayDataInput dataStream)
|
||||
{
|
||||
super.handlePacketData(dataStream);
|
||||
|
||||
isActive = dataStream.readBoolean();
|
||||
controlType = RedstoneControl.values()[dataStream.readInt()];
|
||||
|
||||
filters.clear();
|
||||
|
||||
int amount = dataStream.readInt();
|
||||
|
||||
for(int i = 0; i < amount; i++)
|
||||
{
|
||||
filters.add(TransporterFilter.readFromPacket(dataStream));
|
||||
}
|
||||
|
||||
MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList getNetworkedData(ArrayList data)
|
||||
{
|
||||
super.getNetworkedData(data);
|
||||
|
||||
data.add(isActive);
|
||||
data.add(controlType.ordinal());
|
||||
data.add(filters.size());
|
||||
|
||||
for(TransporterFilter filter : filters)
|
||||
{
|
||||
filter.write(data);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slotID, ItemStack itemstack, int side)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slotID, ItemStack itemstack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int side)
|
||||
{
|
||||
return new int[] {0};
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public RedstoneControl getControlType()
|
||||
{
|
||||
return controlType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setControlType(RedstoneControl type)
|
||||
{
|
||||
controlType = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setActive(boolean active)
|
||||
{
|
||||
isActive = active;
|
||||
|
||||
if(clientActive != active)
|
||||
{
|
||||
PacketHandler.sendPacket(Transmission.ALL_CLIENTS, new PacketTileEntity().setParams(Object3D.get(this), getNetworkedData(new ArrayList())));
|
||||
|
||||
clientActive = active;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getActive()
|
||||
{
|
||||
return isActive;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasVisual()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -9,9 +9,9 @@ import mekanism.api.Object3D;
|
|||
import mekanism.common.ITileNetwork;
|
||||
import mekanism.common.PacketHandler;
|
||||
import mekanism.common.PacketHandler.Transmission;
|
||||
import mekanism.common.TransporterStack;
|
||||
import mekanism.common.network.PacketDataRequest;
|
||||
import mekanism.common.network.PacketTileEntity;
|
||||
import mekanism.common.transporter.TransporterStack;
|
||||
import mekanism.common.util.TransporterUtils;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -196,15 +196,21 @@ public class TileEntityLogisticalTransporter extends TileEntity implements ITile
|
|||
return true;
|
||||
}
|
||||
|
||||
public boolean insert(Object3D original, ItemStack itemStack)
|
||||
public boolean insert(Object3D original, ItemStack itemStack, EnumColor color)
|
||||
{
|
||||
needsSync = true;
|
||||
TransporterStack stack = new TransporterStack();
|
||||
stack.itemStack = itemStack;
|
||||
stack.originalLocation = original;
|
||||
stack.color = color;
|
||||
|
||||
if(!stack.canInsert(this))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(stack.recalculatePath(this))
|
||||
{
|
||||
needsSync = true;
|
||||
transit.add(stack);
|
||||
return true;
|
||||
}
|
||||
|
@ -249,10 +255,7 @@ public class TileEntityLogisticalTransporter extends TileEntity implements ITile
|
|||
|
||||
for(int i = 0; i < amount; i++)
|
||||
{
|
||||
TransporterStack stack = new TransporterStack();
|
||||
stack.read(dataStream);
|
||||
|
||||
transit.add(stack);
|
||||
transit.add(TransporterStack.readFromPacket(dataStream));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -293,7 +296,7 @@ public class TileEntityLogisticalTransporter extends TileEntity implements ITile
|
|||
|
||||
for(int i = 0; i < tagList.tagCount(); i++)
|
||||
{
|
||||
transit.add(TransporterStack.read((NBTTagCompound)tagList.tagAt(i)));
|
||||
transit.add(TransporterStack.readFromNBT((NBTTagCompound)tagList.tagAt(i)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
71
common/mekanism/common/transporter/ItemStackFilter.java
Normal file
|
@ -0,0 +1,71 @@
|
|||
package mekanism.common.transporter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
import mekanism.common.util.TransporterUtils;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class ItemStackFilter extends TransporterFilter
|
||||
{
|
||||
public ItemStack itemType;
|
||||
|
||||
@Override
|
||||
public boolean canFilter(ItemStack itemStack)
|
||||
{
|
||||
return itemType.isItemEqual(itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(NBTTagCompound nbtTags)
|
||||
{
|
||||
super.write(nbtTags);
|
||||
|
||||
itemType.writeToNBT(nbtTags);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(NBTTagCompound nbtTags)
|
||||
{
|
||||
super.read(nbtTags);
|
||||
|
||||
itemType = ItemStack.loadItemStackFromNBT(nbtTags);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(ArrayList data)
|
||||
{
|
||||
super.write(data);
|
||||
|
||||
data.add(itemType.itemID);
|
||||
data.add(itemType.stackSize);
|
||||
data.add(itemType.getItemDamage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(ByteArrayDataInput dataStream)
|
||||
{
|
||||
super.read(dataStream);
|
||||
|
||||
itemType = new ItemStack(dataStream.readInt(), dataStream.readInt(), dataStream.readInt());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
int code = 1;
|
||||
code = 31 * code + super.hashCode();
|
||||
code = 31 * code + itemType.itemID;
|
||||
code = 31 * code + itemType.stackSize;
|
||||
code = 31 * code + itemType.getItemDamage();
|
||||
return code;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object filter)
|
||||
{
|
||||
return super.equals(filter) && filter instanceof ItemStackFilter && ((ItemStackFilter)filter).itemType.isItemEqual(itemType);
|
||||
}
|
||||
}
|
68
common/mekanism/common/transporter/OreDictFilter.java
Normal file
|
@ -0,0 +1,68 @@
|
|||
package mekanism.common.transporter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.TransporterUtils;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class OreDictFilter extends TransporterFilter
|
||||
{
|
||||
public String oreDictName;
|
||||
|
||||
@Override
|
||||
public boolean canFilter(ItemStack itemStack)
|
||||
{
|
||||
return MekanismUtils.oreDictCheck(itemStack, oreDictName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(NBTTagCompound nbtTags)
|
||||
{
|
||||
super.write(nbtTags);
|
||||
|
||||
nbtTags.setString("oreDictName", oreDictName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(NBTTagCompound nbtTags)
|
||||
{
|
||||
super.read(nbtTags);
|
||||
|
||||
oreDictName = nbtTags.getString("oreDictName");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(ArrayList data)
|
||||
{
|
||||
super.write(data);
|
||||
|
||||
data.add(oreDictName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(ByteArrayDataInput dataStream)
|
||||
{
|
||||
super.read(dataStream);
|
||||
|
||||
oreDictName = dataStream.readUTF();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
int code = 1;
|
||||
code = 31 * code + super.hashCode();
|
||||
code = 31 * code + oreDictName.hashCode();
|
||||
return code;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object filter)
|
||||
{
|
||||
return super.equals(filter) && filter instanceof OreDictFilter && ((OreDictFilter)filter).oreDictName.equals(oreDictName);
|
||||
}
|
||||
}
|
15
common/mekanism/common/transporter/SlotInfo.java
Normal file
|
@ -0,0 +1,15 @@
|
|||
package mekanism.common.transporter;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public final class SlotInfo
|
||||
{
|
||||
public ItemStack itemStack;
|
||||
public int slotID;
|
||||
|
||||
public SlotInfo(ItemStack stack, int i)
|
||||
{
|
||||
itemStack = stack;
|
||||
slotID = i;
|
||||
}
|
||||
}
|
71
common/mekanism/common/transporter/TransporterFilter.java
Normal file
|
@ -0,0 +1,71 @@
|
|||
package mekanism.common.transporter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.common.Teleporter.Code;
|
||||
import mekanism.common.util.TransporterUtils;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
public class TransporterFilter
|
||||
{
|
||||
public EnumColor color;
|
||||
|
||||
public boolean canFilter(ItemStack itemStack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public void write(NBTTagCompound nbtTags)
|
||||
{
|
||||
nbtTags.setInteger("color", TransporterUtils.colors.indexOf(color));
|
||||
}
|
||||
|
||||
public void read(NBTTagCompound nbtTags)
|
||||
{
|
||||
color = TransporterUtils.colors.get(nbtTags.getInteger("color"));
|
||||
}
|
||||
|
||||
public void write(ArrayList data)
|
||||
{
|
||||
data.add(TransporterUtils.colors.indexOf(color));
|
||||
}
|
||||
|
||||
public void read(ByteArrayDataInput dataStream)
|
||||
{
|
||||
color = TransporterUtils.colors.get(dataStream.readInt());
|
||||
}
|
||||
|
||||
public static TransporterFilter readFromNBT(NBTTagCompound nbtTags)
|
||||
{
|
||||
TransporterFilter filter = new TransporterFilter();
|
||||
filter.read(nbtTags);
|
||||
|
||||
return filter;
|
||||
}
|
||||
|
||||
public static TransporterFilter readFromPacket(ByteArrayDataInput dataStream)
|
||||
{
|
||||
TransporterFilter filter = new TransporterFilter();
|
||||
filter.read(dataStream);
|
||||
|
||||
return filter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
int code = 1;
|
||||
code = 31 * code + color.ordinal();
|
||||
return code;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object filter)
|
||||
{
|
||||
return filter instanceof TransporterFilter && ((TransporterFilter)filter).color == color;
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package mekanism.common;
|
||||
package mekanism.common.transporter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
@ -49,7 +49,7 @@ public final class TransporterPathfinder
|
|||
{
|
||||
TileEntity tile = Object3D.get(pointer).getFromSide(side).getTileEntity(worldObj);
|
||||
|
||||
if(tile instanceof TileEntityLogisticalTransporter && !iterated.contains(tile))
|
||||
if(transportStack.canInsert(tile) && !iterated.contains(tile))
|
||||
{
|
||||
loop((TileEntityLogisticalTransporter)tile);
|
||||
found = true;
|
||||
|
@ -290,8 +290,6 @@ public final class TransporterPathfinder
|
|||
Destination d = new Destination(start.worldObj, start, stack);
|
||||
Object3D closest = d.find();
|
||||
|
||||
System.out.println(closest);
|
||||
|
||||
if(closest == null)
|
||||
{
|
||||
return null;
|
|
@ -1,4 +1,4 @@
|
|||
package mekanism.common;
|
||||
package mekanism.common.transporter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -19,7 +19,7 @@ public class TransporterStack
|
|||
|
||||
public int progress;
|
||||
|
||||
public EnumColor color = EnumColor.AQUA;
|
||||
public EnumColor color = null;
|
||||
|
||||
public boolean initiatedPath = false;
|
||||
|
||||
|
@ -101,7 +101,7 @@ public class TransporterStack
|
|||
itemStack.writeToNBT(nbtTags);
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound nbtTags)
|
||||
public void read(NBTTagCompound nbtTags)
|
||||
{
|
||||
if(nbtTags.hasKey("color"))
|
||||
{
|
||||
|
@ -114,10 +114,18 @@ public class TransporterStack
|
|||
itemStack = ItemStack.loadItemStackFromNBT(nbtTags);
|
||||
}
|
||||
|
||||
public static TransporterStack read(NBTTagCompound nbtTags)
|
||||
public static TransporterStack readFromNBT(NBTTagCompound nbtTags)
|
||||
{
|
||||
TransporterStack stack = new TransporterStack();
|
||||
stack.readFromNBT(nbtTags);
|
||||
stack.read(nbtTags);
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
public static TransporterStack readFromPacket(ByteArrayDataInput dataStream)
|
||||
{
|
||||
TransporterStack stack = new TransporterStack();
|
||||
stack.read(dataStream);
|
||||
|
||||
return stack;
|
||||
}
|
|
@ -519,7 +519,7 @@ public final class MekanismUtils
|
|||
*/
|
||||
public static int getTicks(int speedUpgrade, int def)
|
||||
{
|
||||
return (int) (def * Math.pow(10, (-speedUpgrade/9.0)));
|
||||
return (int)(def * Math.pow(10, (-speedUpgrade/9.0)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -531,7 +531,7 @@ public final class MekanismUtils
|
|||
*/
|
||||
public static int getEnergyPerTick(int speedUpgrade, int energyUpgrade, int def)
|
||||
{
|
||||
return (int) (def * Math.pow(10, ((speedUpgrade-energyUpgrade)/9.0)));
|
||||
return (int)(def * Math.pow(10, ((speedUpgrade-energyUpgrade)/9.0)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -554,7 +554,7 @@ public final class MekanismUtils
|
|||
*/
|
||||
public static double getEnergy(int energyUpgrade, double def)
|
||||
{
|
||||
return (int) (def * Math.pow(10, (energyUpgrade/9.0)));
|
||||
return (int)(def * Math.pow(10, (energyUpgrade/9.0)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -593,31 +593,6 @@ public final class MekanismUtils
|
|||
world.updateAllLightTypes(x, y, z);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a ForgeDirection enum value to it's corresponding value in IndustrialCraft's 'Direction.' Using values()[ordinal()] will not work in this situation,
|
||||
* as IC2 uses different values from base MC direction theory.
|
||||
* @param side - ForgeDirection value
|
||||
* @return Direction value
|
||||
*/
|
||||
public static Direction toIC2Direction(ForgeDirection side)
|
||||
{
|
||||
switch(side)
|
||||
{
|
||||
case DOWN:
|
||||
return Direction.YN;
|
||||
case UP:
|
||||
return Direction.YP;
|
||||
case NORTH:
|
||||
return Direction.ZN;
|
||||
case SOUTH:
|
||||
return Direction.ZP;
|
||||
case WEST:
|
||||
return Direction.XN;
|
||||
default:
|
||||
return Direction.XP;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether or not a certain block is considered a fluid.
|
||||
* @param world - world the block is in
|
||||
|
|
|
@ -2,11 +2,13 @@ package mekanism.common.util;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.api.transmitters.ITransmitter;
|
||||
import mekanism.common.tileentity.TileEntityLogisticalTransporter;
|
||||
import mekanism.common.transporter.SlotInfo;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -138,9 +140,9 @@ public final class TransporterUtils
|
|||
return inventories;
|
||||
}
|
||||
|
||||
public static boolean insert(TileEntity outputter, TileEntityLogisticalTransporter tileEntity, ItemStack itemStack)
|
||||
public static boolean insert(TileEntity outputter, TileEntityLogisticalTransporter tileEntity, ItemStack itemStack, EnumColor color)
|
||||
{
|
||||
return tileEntity.insert(Object3D.get(outputter), itemStack);
|
||||
return tileEntity.insert(Object3D.get(outputter), itemStack, color);
|
||||
}
|
||||
|
||||
public static boolean canInsert(TileEntity tileEntity, ItemStack itemStack, int side)
|
||||
|
@ -308,7 +310,7 @@ public final class TransporterUtils
|
|||
return itemStack;
|
||||
}
|
||||
|
||||
public static ItemStack takeTopItemFromInventory(IInventory inventory, int side)
|
||||
public static SlotInfo takeItem(IInventory inventory, int side)
|
||||
{
|
||||
if(!(inventory instanceof ISidedInventory))
|
||||
{
|
||||
|
@ -317,16 +319,14 @@ public final class TransporterUtils
|
|||
if(inventory.getStackInSlot(i) != null)
|
||||
{
|
||||
ItemStack toSend = inventory.getStackInSlot(i).copy();
|
||||
toSend.stackSize = 1;
|
||||
inventory.setInventorySlotContents(i, null);
|
||||
|
||||
inventory.decrStackSize(i, 1);
|
||||
|
||||
return toSend;
|
||||
return new SlotInfo(toSend, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
ISidedInventory sidedInventory = (ISidedInventory) inventory;
|
||||
ISidedInventory sidedInventory = (ISidedInventory)inventory;
|
||||
int[] slots = sidedInventory.getAccessibleSlotsFromSide(side);
|
||||
|
||||
if(slots != null)
|
||||
|
@ -338,13 +338,12 @@ public final class TransporterUtils
|
|||
if(sidedInventory.getStackInSlot(slotID) != null)
|
||||
{
|
||||
ItemStack toSend = sidedInventory.getStackInSlot(slotID);
|
||||
toSend.stackSize = 1;
|
||||
|
||||
if(sidedInventory.canExtractItem(slotID, toSend, side))
|
||||
{
|
||||
sidedInventory.decrStackSize(slotID, 1);
|
||||
sidedInventory.setInventorySlotContents(slotID, null);
|
||||
|
||||
return toSend;
|
||||
return new SlotInfo(toSend, slotID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import mekanism.common.PacketHandler;
|
|||
import mekanism.common.RecipeHandler;
|
||||
import mekanism.common.Version;
|
||||
import mekanism.generators.common.block.BlockGenerator;
|
||||
import mekanism.generators.common.item.ItemBlockGenerator;
|
||||
import mekanism.generators.common.network.PacketElectrolyticSeparatorParticle;
|
||||
import mekanism.generators.common.tileentity.TileEntitySolarGenerator;
|
||||
import net.minecraft.block.Block;
|
||||
|
|
|
@ -413,7 +413,7 @@ public class BlockGenerator extends BlockContainer implements ISpecialBounds
|
|||
}
|
||||
}
|
||||
|
||||
if (tileEntity != null)
|
||||
if(tileEntity != null)
|
||||
{
|
||||
if(!entityplayer.isSneaking())
|
||||
{
|
||||
|
@ -551,21 +551,22 @@ public class BlockGenerator extends BlockContainer implements ISpecialBounds
|
|||
|
||||
public static enum GeneratorType
|
||||
{
|
||||
HEAT_GENERATOR(0, 0, 160000, TileEntityHeatGenerator.class, true),
|
||||
SOLAR_GENERATOR(1, 1, 96000, TileEntitySolarGenerator.class, false),
|
||||
ELECTROLYTIC_SEPARATOR(2, 2, 20000, TileEntityElectrolyticSeparator.class, true),
|
||||
HYDROGEN_GENERATOR(3, 3, 40000, TileEntityHydrogenGenerator.class, true),
|
||||
BIO_GENERATOR(4, 4, 160000, TileEntityBioGenerator.class, true),
|
||||
ADVANCED_SOLAR_GENERATOR(5, 1, 200000, TileEntityAdvancedSolarGenerator.class, true),
|
||||
WIND_TURBINE(6, 5, 200000, TileEntityWindTurbine.class, true);
|
||||
HEAT_GENERATOR(0, "HeatGenerator", 0, 160000, TileEntityHeatGenerator.class, true),
|
||||
SOLAR_GENERATOR(1, "SolarGenerator", 1, 96000, TileEntitySolarGenerator.class, false),
|
||||
ELECTROLYTIC_SEPARATOR(2, "ElectrolyticSeparator", 2, 20000, TileEntityElectrolyticSeparator.class, true),
|
||||
HYDROGEN_GENERATOR(3, "HydrogenGenerator", 3, 40000, TileEntityHydrogenGenerator.class, true),
|
||||
BIO_GENERATOR(4, "BioGenerator", 4, 160000, TileEntityBioGenerator.class, true),
|
||||
ADVANCED_SOLAR_GENERATOR(5, "AdvancedSolarGenerator", 1, 200000, TileEntityAdvancedSolarGenerator.class, true),
|
||||
WIND_TURBINE(6, "WindTurbine", 5, 200000, TileEntityWindTurbine.class, true);
|
||||
|
||||
public int meta;
|
||||
public String name;
|
||||
public int guiId;
|
||||
public double maxEnergy;
|
||||
public Class<? extends TileEntity> tileEntityClass;
|
||||
public boolean hasModel;
|
||||
|
||||
private GeneratorType(int i, int j, double k, Class<? extends TileEntity> tileClass, boolean model)
|
||||
private GeneratorType(int i, String name, int j, double k, Class<? extends TileEntity> tileClass, boolean model)
|
||||
{
|
||||
meta = i;
|
||||
guiId = j;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package mekanism.generators.common;
|
||||
package mekanism.generators.common.item;
|
||||
|
||||
import ic2.api.item.IElectricItemManager;
|
||||
import ic2.api.item.ISpecialElectricItem;
|
||||
|
@ -72,35 +72,7 @@ public class ItemBlockGenerator extends ItemBlock implements IEnergizedItem, IIt
|
|||
@Override
|
||||
public String getUnlocalizedName(ItemStack itemstack)
|
||||
{
|
||||
String name = "";
|
||||
switch(itemstack.getItemDamage())
|
||||
{
|
||||
case 0:
|
||||
name = "HeatGenerator";
|
||||
break;
|
||||
case 1:
|
||||
name = "SolarGenerator";
|
||||
break;
|
||||
case 2:
|
||||
name = "ElectrolyticSeparator";
|
||||
break;
|
||||
case 3:
|
||||
name = "HydrogenGenerator";
|
||||
break;
|
||||
case 4:
|
||||
name = "BioGenerator";
|
||||
break;
|
||||
case 5:
|
||||
name = "AdvancedSolarGenerator";
|
||||
break;
|
||||
case 6:
|
||||
name = "WindTurbine";
|
||||
break;
|
||||
default:
|
||||
name = "Unknown";
|
||||
break;
|
||||
}
|
||||
return getUnlocalizedName() + "." + name;
|
||||
return getUnlocalizedName() + "." + GeneratorType.getFromMetadata(itemstack.getItemDamage()).name;
|
||||
}
|
||||
|
||||
@Override
|
BIN
resources/assets/mekanism/gui/GuiItemStackFilter.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
resources/assets/mekanism/gui/GuiLogisticalSorter.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
resources/assets/mekanism/gui/GuiOreDictFilter.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
|
@ -58,6 +58,7 @@ tile.MachineBlock.Teleporter.name=Teleporter
|
|||
tile.MachineBlock.ElectricPump.name=Electric Pump
|
||||
tile.MachineBlock.ElectricChest.name=Electric Chest
|
||||
tile.MachineBlock.Chargepad.name=Chargepad
|
||||
tile.MachineBlock.LogisticalSorter.name=Logistical Sorter
|
||||
|
||||
//Ore Block
|
||||
tile.OreBlock.OsmiumOre.name=Osmium Ore
|
||||
|
|
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 4.2 KiB |
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"animation": {
|
||||
"frametime": 1
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 3 KiB After Width: | Height: | Size: 4.2 KiB |