mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-27 15:23:16 +00:00
Redesigned Filter Cards to serve as Configuration Cards, fixed inventory interaction bug, fixed Creative Energy Cube bug, added new recipes
This commit is contained in:
1 parent
668643e663
commit
866c76bafe
32 files changed
+577
-306
No files matched your search
@@ -0,0 +1,34 @@
|
||||
package mekanism.api;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
/**
|
||||
* Implement this in your TileEntity class if you wish for Mekanism filters to be able to store any of their
|
||||
* information.
|
||||
* @author aidancbrady
|
||||
*
|
||||
*/
|
||||
public interface IConfigCardAccess
|
||||
{
|
||||
public static interface ISpecialConfigData extends IConfigCardAccess
|
||||
{
|
||||
/**
|
||||
* Collects the TileEntity's filter card data into the parameterized NBTTagCompound.
|
||||
* @param nbtTags - the NBTTagCompound of the filter card ItemStack
|
||||
* @return the NBTTagCompound that now contains the TileEntity's filter card data
|
||||
*/
|
||||
public NBTTagCompound getConfigurationData(NBTTagCompound nbtTags);
|
||||
|
||||
/**
|
||||
* Retrieves the TileEntity's data contained in the filter card based on the given NBTTagCompopund.
|
||||
* @param nbtTags - the NBTTagCompound of the filter card ItemStack
|
||||
*/
|
||||
public void setConfigurationData(NBTTagCompound nbtTags);
|
||||
|
||||
/**
|
||||
* A String name of this TileEntity that will be displayed as the type of data on the filter card.
|
||||
* @return the String name of this TileEntity
|
||||
*/
|
||||
public String getDataType();
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package mekanism.api;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
/**
|
||||
* Implement this in your TileEntity class if you wish for Mekanism filters to be able to store any of their
|
||||
* information.
|
||||
* @author aidancbrady
|
||||
*
|
||||
*/
|
||||
public interface IFilterAccess
|
||||
{
|
||||
/**
|
||||
* Collects the TileEntity's filter card data into the parameterized NBTTagCompound.
|
||||
* @param nbtTags - the NBTTagCompound of the filter card ItemStack
|
||||
* @return the NBTTagCompound that now contains the TileEntity's filter card data
|
||||
*/
|
||||
public NBTTagCompound getFilterData(NBTTagCompound nbtTags);
|
||||
|
||||
/**
|
||||
* Retrieves the TileEntity's data contained in the filter card based on the given NBTTagCompopund.
|
||||
* @param nbtTags - the NBTTagCompound of the filter card ItemStack
|
||||
*/
|
||||
public void setFilterData(NBTTagCompound nbtTags);
|
||||
|
||||
/**
|
||||
* A String name of this TileEntity that will be displayed as the type of data on the filter card.
|
||||
* @return the String name of this TileEntity
|
||||
*/
|
||||
public String getDataType();
|
||||
}
|
||||
@@ -139,6 +139,7 @@ public final class StackUtils
|
||||
|
||||
ItemStack ret = stack.copy();
|
||||
ret.stackSize = size;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,11 @@ public class GuiEnergyGauge extends GuiGauge
|
||||
@Override
|
||||
public int getScaledLevel()
|
||||
{
|
||||
if(infoHandler.getEnergyStorage().getEnergy() == Double.MAX_VALUE)
|
||||
{
|
||||
return height-2;
|
||||
}
|
||||
|
||||
return (int)(infoHandler.getEnergyStorage().getEnergy()*(height-2) / infoHandler.getEnergyStorage().getMaxEnergy());
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.particle.EntityBubbleFX;
|
||||
import net.minecraft.client.particle.EntityFX;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -165,6 +166,38 @@ public class RenderTickHandler
|
||||
}
|
||||
}
|
||||
|
||||
synchronized(Mekanism.gasmaskOn)
|
||||
{
|
||||
if(world.getWorldTime() % 4 == 0)
|
||||
{
|
||||
for(String s : Mekanism.gasmaskOn)
|
||||
{
|
||||
EntityPlayer p = mc.theWorld.getPlayerEntityByName(s);
|
||||
|
||||
if(p == null || !p.isInWater())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Pos3D playerPos = new Pos3D(p);
|
||||
|
||||
if(p != mc.thePlayer)
|
||||
{
|
||||
playerPos.translate(0, 1.7, 0);
|
||||
}
|
||||
|
||||
float xRand = (rand.nextFloat() - 0.5F) * 0.08F;
|
||||
float yRand = (rand.nextFloat() - 0.5F) * 0.05F;
|
||||
|
||||
Pos3D vec = new Pos3D(0, 0, 0.4).rotate(p.rotationYawHead, p.rotationPitch);
|
||||
Pos3D motion = vec.clone().scale(0.2).translate(new Pos3D(p.motionX, p.motionY, p.motionZ));
|
||||
|
||||
Pos3D v = playerPos.clone().translate(vec);
|
||||
spawnAndSetParticle("bubble", world, v.xPos, v.yPos, v.zPos, motion.xPos, motion.yPos, motion.zPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(world.getWorldTime() % 4 == 0)
|
||||
{
|
||||
for(EntityPlayer p : (List<EntityPlayer>)world.playerEntities)
|
||||
@@ -230,6 +263,10 @@ public class RenderTickHandler
|
||||
{
|
||||
fx = new EntityJetpackSmokeFX(world, x, y, z, velX, velY, velZ);
|
||||
}
|
||||
else if(s.equals("bubble"))
|
||||
{
|
||||
fx = new EntityBubbleFX(world, x, y, z, velX, velY, velZ);
|
||||
}
|
||||
|
||||
mc.effectRenderer.addEffect(fx);
|
||||
}
|
||||
|
||||
@@ -445,7 +445,7 @@ public class Mekanism
|
||||
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismItems.ArmoredJetpack.getEmptyItem(), new Object[] {
|
||||
"D D", "BSB", " J ", Character.valueOf('D'), "dustDiamond", Character.valueOf('B'), "ingotBronze", Character.valueOf('S'), "blockSteel", Character.valueOf('J'), MekanismItems.Jetpack.getEmptyItem()
|
||||
}));
|
||||
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismItems.FilterCard), new Object[] {
|
||||
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismItems.ConfigurationCard), new Object[] {
|
||||
" A ", "ACA", " A ", Character.valueOf('A'), MekanismItems.EnrichedAlloy, Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC)
|
||||
}));
|
||||
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismItems.SeismicReader.getUnchargedItem(), new Object[] {
|
||||
@@ -515,6 +515,9 @@ public class Mekanism
|
||||
MachineType.RESISTIVE_HEATER.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock3, 1, 4), new Object[] {
|
||||
"CRC", "RHR", "CEC", Character.valueOf('C'), "ingotTin", Character.valueOf('R'), "dustRedstone", Character.valueOf('H'), new ItemStack(MekanismBlocks.BasicBlock2, 1, 5), Character.valueOf('E'), MekanismItems.EnergyTablet.getUnchargedItem()
|
||||
}));;
|
||||
MachineType.QUANTUM_ENTANGLOPORTER.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock3, 1, 0), new Object[] {
|
||||
"OCO", "ATA", "OCO", Character.valueOf('O'), "ingotRefinedObsidian", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.ULTIMATE), Character.valueOf('A'), "alloyUltimate", Character.valueOf('T'), MekanismItems.TeleportationCore
|
||||
}));
|
||||
|
||||
//Energy Cube recipes
|
||||
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismUtils.getEnergyCube(EnergyCubeTier.BASIC), new Object[] {
|
||||
|
||||
@@ -13,7 +13,7 @@ import mekanism.common.item.ItemDust;
|
||||
import mekanism.common.item.ItemElectricBow;
|
||||
import mekanism.common.item.ItemEnergized;
|
||||
import mekanism.common.item.ItemFactoryInstaller;
|
||||
import mekanism.common.item.ItemFilterCard;
|
||||
import mekanism.common.item.ItemConfigurationCard;
|
||||
import mekanism.common.item.ItemFlamethrower;
|
||||
import mekanism.common.item.ItemFreeRunners;
|
||||
import mekanism.common.item.ItemGasMask;
|
||||
@@ -81,7 +81,7 @@ public class MekanismItems
|
||||
public static final ItemSeismicReader SeismicReader = (ItemSeismicReader)new ItemSeismicReader().setUnlocalizedName("SeismicReader");
|
||||
public static final Item Dictionary = new ItemDictionary().setUnlocalizedName("Dictionary");
|
||||
public static final ItemGaugeDropper GaugeDropper = (ItemGaugeDropper)new ItemGaugeDropper().setUnlocalizedName("GaugeDropper");
|
||||
public static final Item FilterCard = new ItemFilterCard().setUnlocalizedName("FilterCard");
|
||||
public static final Item ConfigurationCard = new ItemConfigurationCard().setUnlocalizedName("ConfigurationCard");
|
||||
public static final Item PartTransmitter = new ItemPartTransmitter().setUnlocalizedName("MultipartTransmitter");
|
||||
public static final Item GlowPanel = new ItemGlowPanel().setUnlocalizedName("GlowPanel");
|
||||
public static final ItemScubaTank ScubaTank = (ItemScubaTank)new ItemScubaTank().setUnlocalizedName("ScubaTank");
|
||||
@@ -152,7 +152,7 @@ public class MekanismItems
|
||||
GameRegistry.registerItem(Crystal, "Crystal");
|
||||
GameRegistry.registerItem(FreeRunners, "FreeRunners");
|
||||
GameRegistry.registerItem(ArmoredJetpack, "ArmoredJetpack");
|
||||
GameRegistry.registerItem(FilterCard, "FilterCard");
|
||||
GameRegistry.registerItem(ConfigurationCard, "ConfigurationCard");
|
||||
GameRegistry.registerItem(SeismicReader, "SeismicReader");
|
||||
GameRegistry.registerItem(Substrate, "Substrate");
|
||||
GameRegistry.registerItem(Polyethene, "Polyethene");
|
||||
|
||||
@@ -89,20 +89,29 @@ public final class Tier
|
||||
|
||||
protected void loadConfig()
|
||||
{
|
||||
maxEnergy = Mekanism.configuration.get("tier", getBaseTier().getName() + "EnergyCubeMaxEnergy", baseMaxEnergy).getDouble();
|
||||
output = Mekanism.configuration.get("tier", getBaseTier().getName() + "EnergyCubeOutput", baseOutput).getDouble();
|
||||
if(this != CREATIVE)
|
||||
{
|
||||
maxEnergy = Mekanism.configuration.get("tier", getBaseTier().getName() + "EnergyCubeMaxEnergy", baseMaxEnergy).getDouble();
|
||||
output = Mekanism.configuration.get("tier", getBaseTier().getName() + "EnergyCubeOutput", baseOutput).getDouble();
|
||||
}
|
||||
}
|
||||
|
||||
protected void readConfig(ByteBuf dataStream)
|
||||
{
|
||||
maxEnergy = dataStream.readDouble();
|
||||
output = dataStream.readDouble();
|
||||
if(this != CREATIVE)
|
||||
{
|
||||
maxEnergy = dataStream.readDouble();
|
||||
output = dataStream.readDouble();
|
||||
}
|
||||
}
|
||||
|
||||
protected void writeConfig(ByteBuf dataStream)
|
||||
{
|
||||
dataStream.writeDouble(maxEnergy);
|
||||
dataStream.writeDouble(output);
|
||||
if(this != CREATIVE)
|
||||
{
|
||||
dataStream.writeDouble(maxEnergy);
|
||||
dataStream.writeDouble(output);
|
||||
}
|
||||
}
|
||||
|
||||
public BaseTier getBaseTier()
|
||||
|
||||
@@ -2,7 +2,7 @@ package mekanism.common.base;
|
||||
|
||||
import ic2.api.energy.tile.IEnergySink;
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.IFilterAccess;
|
||||
import mekanism.api.IConfigCardAccess.ISpecialConfigData;
|
||||
import mekanism.api.energy.IStrictEnergyAcceptor;
|
||||
import mekanism.api.energy.IStrictEnergyStorage;
|
||||
import mekanism.common.integration.IComputerIntegration;
|
||||
@@ -16,7 +16,7 @@ import cpw.mods.fml.common.Optional.InterfaceList;
|
||||
@Interface(iface = "ic2.api.energy.tile.IEnergySink", modid = "IC2"),
|
||||
@Interface(iface = "cofh.api.energy.IEnergyHandler", modid = "CoFHCore")
|
||||
})
|
||||
public interface IAdvancedBoundingBlock extends IBoundingBlock, ISidedInventory, IEnergySink, IStrictEnergyAcceptor, IStrictEnergyStorage, IEnergyHandler, IComputerIntegration, IFilterAccess
|
||||
public interface IAdvancedBoundingBlock extends IBoundingBlock, ISidedInventory, IEnergySink, IStrictEnergyAcceptor, IStrictEnergyStorage, IEnergyHandler, IComputerIntegration, ISpecialConfigData
|
||||
{
|
||||
public int[] getBoundSlots(Coord4D location, int side);
|
||||
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
package mekanism.common.base;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public interface IEjector
|
||||
{
|
||||
public void outputItems();
|
||||
|
||||
public EnumColor getOutputColor();
|
||||
|
||||
public void setOutputColor(EnumColor color);
|
||||
|
||||
public EnumColor getInputColor(ForgeDirection side);
|
||||
|
||||
public void setInputColor(ForgeDirection side, EnumColor color);
|
||||
|
||||
public boolean hasStrictInput();
|
||||
|
||||
public void setStrictInput(boolean strict);
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package mekanism.common.base;
|
||||
|
||||
import mekanism.common.tile.component.TileComponentConfig;
|
||||
import mekanism.common.tile.component.TileComponentEjector;
|
||||
|
||||
/**
|
||||
* Implement this if your TileEntity is capable of being modified by a Configurator in it's 'modify' mode.
|
||||
@@ -25,5 +26,5 @@ public interface ISideConfiguration
|
||||
* Gets this machine's ejector.
|
||||
* @return
|
||||
*/
|
||||
public IEjector getEjector();
|
||||
public TileComponentEjector getEjector();
|
||||
}
|
||||
@@ -153,12 +153,30 @@ public class TransporterManager
|
||||
|
||||
if(inSlot == null)
|
||||
{
|
||||
copy.inventory[i] = toInsert;
|
||||
return;
|
||||
if(toInsert.stackSize <= inv.getInventoryStackLimit())
|
||||
{
|
||||
copy.inventory[i] = toInsert;
|
||||
return;
|
||||
}
|
||||
else {
|
||||
int rejects = toInsert.stackSize - inv.getInventoryStackLimit();
|
||||
|
||||
ItemStack toSet = toInsert.copy();
|
||||
toSet.stackSize = inv.getInventoryStackLimit();
|
||||
|
||||
ItemStack remains = toInsert.copy();
|
||||
remains.stackSize = rejects;
|
||||
|
||||
copy.inventory[i] = toSet;
|
||||
|
||||
toInsert = remains;
|
||||
}
|
||||
}
|
||||
else if(InventoryUtils.areItemsStackable(toInsert, inSlot) && inSlot.stackSize < inSlot.getMaxStackSize() && inSlot.stackSize < inv.getInventoryStackLimit())
|
||||
else if(InventoryUtils.areItemsStackable(toInsert, inSlot) && inSlot.stackSize < Math.min(inSlot.getMaxStackSize(), inv.getInventoryStackLimit()))
|
||||
{
|
||||
if(inSlot.stackSize + toInsert.stackSize <= inSlot.getMaxStackSize())
|
||||
int max = Math.min(inSlot.getMaxStackSize(), inv.getInventoryStackLimit());
|
||||
|
||||
if(inSlot.stackSize + toInsert.stackSize <= max)
|
||||
{
|
||||
ItemStack toSet = toInsert.copy();
|
||||
toSet.stackSize += inSlot.stackSize;
|
||||
@@ -167,10 +185,10 @@ public class TransporterManager
|
||||
return;
|
||||
}
|
||||
else {
|
||||
int rejects = (inSlot.stackSize + toInsert.stackSize) - inSlot.getMaxStackSize();
|
||||
int rejects = (inSlot.stackSize + toInsert.stackSize) - max;
|
||||
|
||||
ItemStack toSet = toInsert.copy();
|
||||
toSet.stackSize = inSlot.getMaxStackSize();
|
||||
toSet.stackSize = max;
|
||||
|
||||
ItemStack remains = toInsert.copy();
|
||||
remains.stackSize = rejects;
|
||||
@@ -224,12 +242,30 @@ public class TransporterManager
|
||||
|
||||
if(inSlot == null)
|
||||
{
|
||||
copy.inventory[slotID] = toInsert;
|
||||
return;
|
||||
if(toInsert.stackSize <= inv.getInventoryStackLimit())
|
||||
{
|
||||
copy.inventory[slotID] = toInsert;
|
||||
return;
|
||||
}
|
||||
else {
|
||||
int rejects = toInsert.stackSize - inv.getInventoryStackLimit();
|
||||
|
||||
ItemStack toSet = toInsert.copy();
|
||||
toSet.stackSize = inv.getInventoryStackLimit();
|
||||
|
||||
ItemStack remains = toInsert.copy();
|
||||
remains.stackSize = rejects;
|
||||
|
||||
copy.inventory[slotID] = toSet;
|
||||
|
||||
toInsert = remains;
|
||||
}
|
||||
}
|
||||
else if(InventoryUtils.areItemsStackable(toInsert, inSlot) && inSlot.stackSize < inSlot.getMaxStackSize() && inSlot.stackSize < inv.getInventoryStackLimit())
|
||||
else if(InventoryUtils.areItemsStackable(toInsert, inSlot) && inSlot.stackSize < Math.min(inSlot.getMaxStackSize(), inv.getInventoryStackLimit()))
|
||||
{
|
||||
if(inSlot.stackSize + toInsert.stackSize <= inSlot.getMaxStackSize())
|
||||
int max = Math.min(inSlot.getMaxStackSize(), inv.getInventoryStackLimit());
|
||||
|
||||
if(inSlot.stackSize + toInsert.stackSize <= max)
|
||||
{
|
||||
ItemStack toSet = toInsert.copy();
|
||||
toSet.stackSize += inSlot.stackSize;
|
||||
@@ -238,10 +274,10 @@ public class TransporterManager
|
||||
return;
|
||||
}
|
||||
else {
|
||||
int rejects = (inSlot.stackSize + toInsert.stackSize) - inSlot.getMaxStackSize();
|
||||
int rejects = (inSlot.stackSize + toInsert.stackSize) - max;
|
||||
|
||||
ItemStack toSet = toInsert.copy();
|
||||
toSet.stackSize = inSlot.getMaxStackSize();
|
||||
toSet.stackSize = max;
|
||||
|
||||
ItemStack remains = toInsert.copy();
|
||||
remains.stackSize = rejects;
|
||||
@@ -324,18 +360,35 @@ public class TransporterManager
|
||||
|
||||
ItemStack inSlot = copy.inventory[i];
|
||||
|
||||
if(inSlot == null || toInsert == null)
|
||||
if(toInsert == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else if(InventoryUtils.areItemsStackable(toInsert, inSlot) && inSlot.stackSize < inSlot.getMaxStackSize() && inSlot.stackSize < inventory.getInventoryStackLimit())
|
||||
else if(inSlot == null)
|
||||
{
|
||||
if(inSlot.stackSize + toInsert.stackSize <= inSlot.getMaxStackSize())
|
||||
if(toInsert.stackSize <= inventory.getInventoryStackLimit())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
int rejects = (inSlot.stackSize + toInsert.stackSize) - inSlot.getMaxStackSize();
|
||||
int rejects = toInsert.stackSize - inventory.getInventoryStackLimit();
|
||||
|
||||
if(rejects < toInsert.stackSize)
|
||||
{
|
||||
toInsert = StackUtils.size(toInsert, rejects);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(InventoryUtils.areItemsStackable(toInsert, inSlot) && inSlot.stackSize < Math.min(inSlot.getMaxStackSize(), inventory.getInventoryStackLimit()))
|
||||
{
|
||||
int max = Math.min(inSlot.getMaxStackSize(), inventory.getInventoryStackLimit());
|
||||
|
||||
if(inSlot.stackSize + toInsert.stackSize <= max)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
int rejects = (inSlot.stackSize + toInsert.stackSize) - max;
|
||||
|
||||
if(rejects < toInsert.stackSize)
|
||||
{
|
||||
@@ -381,23 +434,40 @@ public class TransporterManager
|
||||
}
|
||||
|
||||
ItemStack inSlot = copy.inventory[slotID];
|
||||
|
||||
if(inSlot == null)
|
||||
|
||||
if(toInsert == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else if(InventoryUtils.areItemsStackable(toInsert, inSlot) && inSlot.stackSize < inSlot.getMaxStackSize() && inSlot.stackSize < inventory.getInventoryStackLimit())
|
||||
else if(inSlot == null)
|
||||
{
|
||||
if(inSlot.stackSize + toInsert.stackSize <= inSlot.getMaxStackSize())
|
||||
if(toInsert.stackSize <= inventory.getInventoryStackLimit())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
int rejects = (inSlot.stackSize + toInsert.stackSize) - inSlot.getMaxStackSize();
|
||||
int rejects = toInsert.stackSize - inventory.getInventoryStackLimit();
|
||||
|
||||
if(rejects < toInsert.stackSize)
|
||||
{
|
||||
toInsert = StackUtils.size(toInsert, rejects);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(InventoryUtils.areItemsStackable(toInsert, inSlot) && inSlot.stackSize < Math.min(inSlot.getMaxStackSize(), inventory.getInventoryStackLimit()))
|
||||
{
|
||||
int max = Math.min(inSlot.getMaxStackSize(), inventory.getInventoryStackLimit());
|
||||
|
||||
if(inSlot.stackSize + toInsert.stackSize <= max)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
int rejects = (inSlot.stackSize + toInsert.stackSize) - max;
|
||||
|
||||
if(rejects < toInsert.stackSize)
|
||||
{
|
||||
toInsert = MekanismUtils.size(toInsert, rejects);
|
||||
toInsert = StackUtils.size(toInsert, rejects);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,14 +259,14 @@ public class ItemBlockEnergyCube extends ItemBlock implements IEnergizedItem, IE
|
||||
if(canReceive(theItem))
|
||||
{
|
||||
double energyNeeded = getMaxEnergy(theItem)-getEnergy(theItem);
|
||||
double toReceive = Math.min(energy* general.FROM_TE, energyNeeded);
|
||||
double toReceive = Math.min(energy*general.FROM_TE, energyNeeded);
|
||||
|
||||
if(!simulate)
|
||||
{
|
||||
setEnergy(theItem, getEnergy(theItem) + toReceive);
|
||||
}
|
||||
|
||||
return (int)Math.round(toReceive* general.TO_TE);
|
||||
return (int)Math.round(toReceive*general.TO_TE);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -278,14 +278,14 @@ public class ItemBlockEnergyCube extends ItemBlock implements IEnergizedItem, IE
|
||||
if(canSend(theItem))
|
||||
{
|
||||
double energyRemaining = getEnergy(theItem);
|
||||
double toSend = Math.min((energy* general.FROM_TE), energyRemaining);
|
||||
double toSend = Math.min((energy*general.FROM_TE), energyRemaining);
|
||||
|
||||
if(!simulate)
|
||||
{
|
||||
setEnergy(theItem, getEnergy(theItem) - toSend);
|
||||
}
|
||||
|
||||
return (int)Math.round(toSend* general.TO_TE);
|
||||
return (int)Math.round(toSend*general.TO_TE);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -294,13 +294,13 @@ public class ItemBlockEnergyCube extends ItemBlock implements IEnergizedItem, IE
|
||||
@Override
|
||||
public int getEnergyStored(ItemStack theItem)
|
||||
{
|
||||
return (int)(getEnergy(theItem)* general.TO_TE);
|
||||
return (int)(getEnergy(theItem)*general.TO_TE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored(ItemStack theItem)
|
||||
{
|
||||
return (int)(getMaxEnergy(theItem)* general.TO_TE);
|
||||
return (int)(getMaxEnergy(theItem)*general.TO_TE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,184 @@
|
||||
package mekanism.common.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.IConfigCardAccess;
|
||||
import mekanism.api.IConfigCardAccess.ISpecialConfigData;
|
||||
import mekanism.common.base.IRedstoneControl;
|
||||
import mekanism.common.base.IRedstoneControl.RedstoneControl;
|
||||
import mekanism.common.base.ISideConfiguration;
|
||||
import mekanism.common.tile.TileEntityContainerBlock;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemConfigurationCard extends ItemMekanism
|
||||
{
|
||||
public ItemConfigurationCard()
|
||||
{
|
||||
super();
|
||||
|
||||
setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag)
|
||||
{
|
||||
super.addInformation(itemstack, entityplayer, list, flag);
|
||||
|
||||
list.add(EnumColor.GREY + LangUtils.localize("gui.data") + ": " + EnumColor.INDIGO + LangUtils.localize(getDataType(itemstack)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if(!world.isRemote)
|
||||
{
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if(tileEntity instanceof IConfigCardAccess)
|
||||
{
|
||||
if(player.isSneaking())
|
||||
{
|
||||
NBTTagCompound data = getBaseData(tileEntity);
|
||||
|
||||
if(tileEntity instanceof ISpecialConfigData)
|
||||
{
|
||||
data = ((ISpecialConfigData)tileEntity).getConfigurationData(data);
|
||||
}
|
||||
|
||||
if(data != null)
|
||||
{
|
||||
data.setString("dataType", getNameFromTile(tileEntity));
|
||||
setData(stack, data);
|
||||
player.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + LangUtils.localize("tooltip.configurationCard.got").replaceAll("%s", EnumColor.INDIGO + LangUtils.localize(data.getString("dataType")) + EnumColor.GREY)));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if(getData(stack) != null)
|
||||
{
|
||||
if(getNameFromTile(tileEntity).equals(getDataType(stack)))
|
||||
{
|
||||
setBaseData(getData(stack), tileEntity);
|
||||
|
||||
if(tileEntity instanceof ISpecialConfigData)
|
||||
{
|
||||
((ISpecialConfigData)tileEntity).setConfigurationData(getData(stack));
|
||||
}
|
||||
|
||||
player.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.DARK_GREEN + LangUtils.localize("tooltip.configurationCard.set").replaceAll("%s", EnumColor.INDIGO + LangUtils.localize(getDataType(stack)) + EnumColor.DARK_GREEN)));
|
||||
setData(stack, null);
|
||||
}
|
||||
else {
|
||||
player.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.RED + LangUtils.localize("tooltip.configurationCard.unequal") + "."));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private NBTTagCompound getBaseData(TileEntity tile)
|
||||
{
|
||||
NBTTagCompound nbtTags = new NBTTagCompound();
|
||||
|
||||
if(tile instanceof IRedstoneControl)
|
||||
{
|
||||
nbtTags.setInteger("controlType", ((IRedstoneControl)tile).getControlType().ordinal());
|
||||
}
|
||||
|
||||
if(tile instanceof ISideConfiguration)
|
||||
{
|
||||
((ISideConfiguration)tile).getConfig().write(nbtTags);
|
||||
((ISideConfiguration)tile).getEjector().write(nbtTags);
|
||||
}
|
||||
|
||||
return nbtTags;
|
||||
}
|
||||
|
||||
private void setBaseData(NBTTagCompound nbtTags, TileEntity tile)
|
||||
{
|
||||
if(tile instanceof IRedstoneControl)
|
||||
{
|
||||
((IRedstoneControl)tile).setControlType(RedstoneControl.values()[nbtTags.getInteger("controlType")]);
|
||||
}
|
||||
|
||||
if(tile instanceof ISideConfiguration)
|
||||
{
|
||||
((ISideConfiguration)tile).getConfig().read(nbtTags);
|
||||
((ISideConfiguration)tile).getEjector().read(nbtTags);
|
||||
}
|
||||
}
|
||||
|
||||
private String getNameFromTile(TileEntity tile)
|
||||
{
|
||||
String ret = Integer.toString(tile.hashCode());
|
||||
|
||||
if(tile instanceof TileEntityContainerBlock)
|
||||
{
|
||||
ret = tile.getBlockType().getUnlocalizedName() + "." + ((TileEntityContainerBlock)tile).fullName + ".name";
|
||||
}
|
||||
|
||||
if(tile instanceof ISpecialConfigData)
|
||||
{
|
||||
ret = ((ISpecialConfigData)tile).getDataType();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public void setData(ItemStack itemstack, NBTTagCompound data)
|
||||
{
|
||||
if(itemstack.stackTagCompound == null)
|
||||
{
|
||||
itemstack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
if(data != null)
|
||||
{
|
||||
itemstack.stackTagCompound.setTag("data", data);
|
||||
}
|
||||
else {
|
||||
itemstack.stackTagCompound.removeTag("data");
|
||||
}
|
||||
}
|
||||
|
||||
public NBTTagCompound getData(ItemStack itemstack)
|
||||
{
|
||||
if(itemstack.stackTagCompound == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
NBTTagCompound data = itemstack.stackTagCompound.getCompoundTag("data");
|
||||
|
||||
if(data.hasNoTags())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
return itemstack.stackTagCompound.getCompoundTag("data");
|
||||
}
|
||||
}
|
||||
|
||||
public String getDataType(ItemStack itemstack)
|
||||
{
|
||||
NBTTagCompound data = getData(itemstack);
|
||||
|
||||
if(data != null)
|
||||
{
|
||||
return data.getString("dataType");
|
||||
}
|
||||
|
||||
return "gui.none";
|
||||
}
|
||||
}
|
||||
@@ -1,119 +0,0 @@
|
||||
package mekanism.common.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.IFilterAccess;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemFilterCard extends ItemMekanism
|
||||
{
|
||||
public ItemFilterCard()
|
||||
{
|
||||
super();
|
||||
|
||||
setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag)
|
||||
{
|
||||
super.addInformation(itemstack, entityplayer, list, flag);
|
||||
|
||||
list.add(EnumColor.GREY + LangUtils.localize("gui.data") + ": " + EnumColor.INDIGO + LangUtils.localize(getDataType(itemstack)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if(!world.isRemote)
|
||||
{
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if(tileEntity instanceof IFilterAccess)
|
||||
{
|
||||
if(player.isSneaking())
|
||||
{
|
||||
NBTTagCompound data = ((IFilterAccess)tileEntity).getFilterData(new NBTTagCompound());
|
||||
|
||||
if(data != null)
|
||||
{
|
||||
data.setString("dataType", ((IFilterAccess)tileEntity).getDataType());
|
||||
setData(stack, data);
|
||||
player.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + LangUtils.localize("tooltip.filterCard.got").replaceAll("%s", EnumColor.INDIGO + LangUtils.localize(data.getString("dataType")) + EnumColor.GREY)));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if(getData(stack) != null)
|
||||
{
|
||||
if(((IFilterAccess)tileEntity).getDataType().equals(getDataType(stack)))
|
||||
{
|
||||
((IFilterAccess)tileEntity).setFilterData(getData(stack));
|
||||
player.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.DARK_GREEN + LangUtils.localize("tooltip.filterCard.set").replaceAll("%s", EnumColor.INDIGO + LangUtils.localize(getDataType(stack)) + EnumColor.DARK_GREEN)));
|
||||
setData(stack, null);
|
||||
}
|
||||
else {
|
||||
player.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.RED + LangUtils.localize("tooltip.filterCard.unequal") + "."));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setData(ItemStack itemstack, NBTTagCompound data)
|
||||
{
|
||||
if(itemstack.stackTagCompound == null)
|
||||
{
|
||||
itemstack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
if(data != null)
|
||||
{
|
||||
itemstack.stackTagCompound.setTag("data", data);
|
||||
}
|
||||
else {
|
||||
itemstack.stackTagCompound.removeTag("data");
|
||||
}
|
||||
}
|
||||
|
||||
public NBTTagCompound getData(ItemStack itemstack)
|
||||
{
|
||||
if(itemstack.stackTagCompound == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
NBTTagCompound data = itemstack.stackTagCompound.getCompoundTag("data");
|
||||
|
||||
if(data.hasNoTags())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
return itemstack.stackTagCompound.getCompoundTag("data");
|
||||
}
|
||||
}
|
||||
|
||||
public String getDataType(ItemStack itemstack)
|
||||
{
|
||||
NBTTagCompound data = getData(itemstack);
|
||||
|
||||
if(data != null)
|
||||
{
|
||||
return data.getString("dataType");
|
||||
}
|
||||
|
||||
return "gui.none";
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@ package mekanism.common.tile;
|
||||
|
||||
import ic2.api.energy.tile.IEnergySink;
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.IFilterAccess;
|
||||
import mekanism.api.IConfigCardAccess.ISpecialConfigData;
|
||||
import mekanism.api.energy.IStrictEnergyAcceptor;
|
||||
import mekanism.common.base.IAdvancedBoundingBlock;
|
||||
import mekanism.common.integration.IComputerIntegration;
|
||||
@@ -22,7 +22,7 @@ import cpw.mods.fml.common.Optional.Method;
|
||||
@Interface(iface = "ic2.api.energy.tile.IEnergySink", modid = "IC2"),
|
||||
@Interface(iface = "cofh.api.energy.IEnergyHandler", modid = "CoFHCore")
|
||||
})
|
||||
public class TileEntityAdvancedBoundingBlock extends TileEntityBoundingBlock implements ISidedInventory, IEnergySink, IStrictEnergyAcceptor, IEnergyHandler, IComputerIntegration, IFilterAccess
|
||||
public class TileEntityAdvancedBoundingBlock extends TileEntityBoundingBlock implements ISidedInventory, IEnergySink, IStrictEnergyAcceptor, IEnergyHandler, IComputerIntegration, ISpecialConfigData
|
||||
{
|
||||
@Override
|
||||
public int getSizeInventory()
|
||||
@@ -410,25 +410,25 @@ public class TileEntityAdvancedBoundingBlock extends TileEntityBoundingBlock imp
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getFilterData(NBTTagCompound nbtTags)
|
||||
public NBTTagCompound getConfigurationData(NBTTagCompound nbtTags)
|
||||
{
|
||||
if(getInv() == null)
|
||||
{
|
||||
return new NBTTagCompound();
|
||||
}
|
||||
|
||||
return getInv().getFilterData(nbtTags);
|
||||
return getInv().getConfigurationData(nbtTags);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFilterData(NBTTagCompound nbtTags)
|
||||
public void setConfigurationData(NBTTagCompound nbtTags)
|
||||
{
|
||||
if(getInv() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
getInv().setFilterData(nbtTags);
|
||||
getInv().setConfigurationData(nbtTags);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -6,12 +6,12 @@ import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.IConfigCardAccess;
|
||||
import mekanism.api.MekanismConfig.general;
|
||||
import mekanism.api.Range4D;
|
||||
import mekanism.api.transmitters.TransmissionType;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.Upgrade;
|
||||
import mekanism.common.base.IEjector;
|
||||
import mekanism.common.base.IElectricMachine;
|
||||
import mekanism.common.base.IRedstoneControl;
|
||||
import mekanism.common.base.ISideConfiguration;
|
||||
@@ -29,7 +29,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public abstract class TileEntityBasicMachine<INPUT extends MachineInput<INPUT>, OUTPUT extends MachineOutput<OUTPUT>, RECIPE extends MachineRecipe<INPUT, OUTPUT, RECIPE>> extends TileEntityNoisyElectricBlock implements IElectricMachine<INPUT, OUTPUT, RECIPE>, IComputerIntegration, ISideConfiguration, IUpgradeTile, IRedstoneControl
|
||||
public abstract class TileEntityBasicMachine<INPUT extends MachineInput<INPUT>, OUTPUT extends MachineOutput<OUTPUT>, RECIPE extends MachineRecipe<INPUT, OUTPUT, RECIPE>> extends TileEntityNoisyElectricBlock implements IElectricMachine<INPUT, OUTPUT, RECIPE>, IComputerIntegration, ISideConfiguration, IUpgradeTile, IRedstoneControl, IConfigCardAccess
|
||||
{
|
||||
/** How much energy this machine uses per tick, un-upgraded. */
|
||||
public double BASE_ENERGY_PER_TICK;
|
||||
@@ -289,7 +289,7 @@ public abstract class TileEntityBasicMachine<INPUT extends MachineInput<INPUT>,
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEjector getEjector()
|
||||
public TileComponentEjector getEjector()
|
||||
{
|
||||
return ejectorComponent;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.ArrayList;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.IConfigCardAccess;
|
||||
import mekanism.api.MekanismConfig.usage;
|
||||
import mekanism.api.Range4D;
|
||||
import mekanism.api.gas.Gas;
|
||||
@@ -20,7 +21,6 @@ import mekanism.api.transmitters.TransmissionType;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.SideData;
|
||||
import mekanism.common.Upgrade;
|
||||
import mekanism.common.base.IEjector;
|
||||
import mekanism.common.base.IRedstoneControl;
|
||||
import mekanism.common.base.ISideConfiguration;
|
||||
import mekanism.common.base.ISustainedData;
|
||||
@@ -41,7 +41,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityChemicalCrystallizer extends TileEntityNoisyElectricBlock implements IGasHandler, ITubeConnection, IRedstoneControl, ISideConfiguration, IUpgradeTile, ISustainedData, ITankManager
|
||||
public class TileEntityChemicalCrystallizer extends TileEntityNoisyElectricBlock implements IGasHandler, ITubeConnection, IRedstoneControl, ISideConfiguration, IUpgradeTile, ISustainedData, ITankManager, IConfigCardAccess
|
||||
{
|
||||
public static final int MAX_GAS = 10000;
|
||||
|
||||
@@ -437,7 +437,7 @@ public class TileEntityChemicalCrystallizer extends TileEntityNoisyElectricBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEjector getEjector()
|
||||
public TileComponentEjector getEjector()
|
||||
{
|
||||
return ejectorComponent;
|
||||
}
|
||||
|
||||
@@ -1364,7 +1364,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getFilterData(NBTTagCompound nbtTags)
|
||||
public NBTTagCompound getConfigurationData(NBTTagCompound nbtTags)
|
||||
{
|
||||
nbtTags.setInteger("radius", radius);
|
||||
nbtTags.setInteger("minY", minY);
|
||||
@@ -1372,7 +1372,6 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
||||
nbtTags.setBoolean("doEject", doEject);
|
||||
nbtTags.setBoolean("doPull", doPull);
|
||||
nbtTags.setBoolean("silkTouch", silkTouch);
|
||||
nbtTags.setInteger("controlType", controlType.ordinal());
|
||||
nbtTags.setBoolean("inverse", inverse);
|
||||
|
||||
NBTTagList filterTags = new NBTTagList();
|
||||
@@ -1391,7 +1390,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFilterData(NBTTagCompound nbtTags)
|
||||
public void setConfigurationData(NBTTagCompound nbtTags)
|
||||
{
|
||||
radius = nbtTags.getInteger("radius");
|
||||
minY = nbtTags.getInteger("minY");
|
||||
@@ -1399,7 +1398,6 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
||||
doEject = nbtTags.getBoolean("doEject");
|
||||
doPull = nbtTags.getBoolean("doPull");
|
||||
silkTouch = nbtTags.getBoolean("silkTouch");
|
||||
controlType = RedstoneControl.values()[nbtTags.getInteger("controlType")];
|
||||
inverse = nbtTags.getBoolean("inverse");
|
||||
|
||||
if(nbtTags.hasKey("filters"))
|
||||
@@ -1416,7 +1414,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
||||
@Override
|
||||
public String getDataType()
|
||||
{
|
||||
return "tooltip.filterCard.digitalMiner";
|
||||
return getBlockType().getUnlocalizedName() + "." + fullName + ".name";
|
||||
}
|
||||
|
||||
public void writeSustainedData(ItemStack itemStack)
|
||||
|
||||
@@ -12,7 +12,6 @@ import mekanism.api.transmitters.TransmissionType;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.SideData;
|
||||
import mekanism.common.Tier.EnergyCubeTier;
|
||||
import mekanism.common.base.IEjector;
|
||||
import mekanism.common.base.IRedstoneControl;
|
||||
import mekanism.common.base.ISideConfiguration;
|
||||
import mekanism.common.integration.IComputerIntegration;
|
||||
@@ -279,7 +278,7 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements ICo
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEjector getEjector()
|
||||
public TileComponentEjector getEjector()
|
||||
{
|
||||
return ejectorComponent;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.util.List;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.IConfigCardAccess.ISpecialConfigData;
|
||||
import mekanism.api.MekanismConfig.general;
|
||||
import mekanism.api.MekanismConfig.usage;
|
||||
import mekanism.api.Range4D;
|
||||
@@ -31,7 +32,6 @@ import mekanism.common.PacketHandler;
|
||||
import mekanism.common.SideData;
|
||||
import mekanism.common.Tier.FactoryTier;
|
||||
import mekanism.common.Upgrade;
|
||||
import mekanism.common.base.IEjector;
|
||||
import mekanism.common.base.IFactory.RecipeType;
|
||||
import mekanism.common.base.IRedstoneControl;
|
||||
import mekanism.common.base.ISideConfiguration;
|
||||
@@ -60,7 +60,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class TileEntityFactory extends TileEntityNoisyElectricBlock implements IComputerIntegration, ISideConfiguration, IUpgradeTile, IRedstoneControl, IGasHandler, ITubeConnection
|
||||
public class TileEntityFactory extends TileEntityNoisyElectricBlock implements IComputerIntegration, ISideConfiguration, IUpgradeTile, IRedstoneControl, IGasHandler, ITubeConnection, ISpecialConfigData
|
||||
{
|
||||
/** This Factory's tier. */
|
||||
public FactoryTier tier;
|
||||
@@ -1080,7 +1080,7 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEjector getEjector()
|
||||
public TileComponentEjector getEjector()
|
||||
{
|
||||
return ejectorComponent;
|
||||
}
|
||||
@@ -1165,4 +1165,24 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getConfigurationData(NBTTagCompound nbtTags)
|
||||
{
|
||||
nbtTags.setBoolean("sorting", sorting);
|
||||
|
||||
return nbtTags;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setConfigurationData(NBTTagCompound nbtTags)
|
||||
{
|
||||
sorting = nbtTags.getBoolean("sorting");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDataType()
|
||||
{
|
||||
return tier.getBaseTier().getLocalizedName() + " " + recipeType.getLocalizedName() + " " + super.getInventoryName();
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,6 @@ import mekanism.api.transmitters.TransmissionType;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.SideData;
|
||||
import mekanism.common.Tier.GasTankTier;
|
||||
import mekanism.common.base.IEjector;
|
||||
import mekanism.common.base.IRedstoneControl;
|
||||
import mekanism.common.base.ISideConfiguration;
|
||||
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
||||
@@ -333,7 +332,7 @@ public class TileEntityGasTank extends TileEntityContainerBlock implements IGasH
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEjector getEjector()
|
||||
public TileComponentEjector getEjector()
|
||||
{
|
||||
return ejectorComponent;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import java.util.EnumSet;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.IFilterAccess;
|
||||
import mekanism.api.IConfigCardAccess.ISpecialConfigData;
|
||||
import mekanism.api.Range4D;
|
||||
import mekanism.common.HashList;
|
||||
import mekanism.common.Mekanism;
|
||||
@@ -37,7 +37,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.Constants.NBT;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityLogisticalSorter extends TileEntityElectricBlock implements IRedstoneControl, IActiveState, IFilterAccess, ISustainedData
|
||||
public class TileEntityLogisticalSorter extends TileEntityElectricBlock implements IRedstoneControl, IActiveState, ISpecialConfigData, ISustainedData
|
||||
{
|
||||
public HashList<TransporterFilter> filters = new HashList<TransporterFilter>();
|
||||
|
||||
@@ -589,10 +589,8 @@ public class TileEntityLogisticalSorter extends TileEntityElectricBlock implemen
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getFilterData(NBTTagCompound nbtTags)
|
||||
public NBTTagCompound getConfigurationData(NBTTagCompound nbtTags)
|
||||
{
|
||||
nbtTags.setInteger("controlType", controlType.ordinal());
|
||||
|
||||
if(color != null)
|
||||
{
|
||||
nbtTags.setInteger("color", TransporterUtils.colors.indexOf(color));
|
||||
@@ -621,10 +619,8 @@ public class TileEntityLogisticalSorter extends TileEntityElectricBlock implemen
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFilterData(NBTTagCompound nbtTags)
|
||||
public void setConfigurationData(NBTTagCompound nbtTags)
|
||||
{
|
||||
controlType = RedstoneControl.values()[nbtTags.getInteger("controlType")];
|
||||
|
||||
if(nbtTags.hasKey("color"))
|
||||
{
|
||||
color = TransporterUtils.colors.get(nbtTags.getInteger("color"));
|
||||
@@ -649,7 +645,7 @@ public class TileEntityLogisticalSorter extends TileEntityElectricBlock implemen
|
||||
@Override
|
||||
public String getDataType()
|
||||
{
|
||||
return "tooltip.filterCard.logisticalSorter";
|
||||
return getBlockType().getUnlocalizedName() + "." + fullName + ".name";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.EnumSet;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.IConfigCardAccess;
|
||||
import mekanism.api.MekanismConfig.general;
|
||||
import mekanism.api.MekanismConfig.usage;
|
||||
import mekanism.api.Range4D;
|
||||
@@ -20,7 +21,6 @@ import mekanism.common.MekanismItems;
|
||||
import mekanism.common.PacketHandler;
|
||||
import mekanism.common.SideData;
|
||||
import mekanism.common.Upgrade;
|
||||
import mekanism.common.base.IEjector;
|
||||
import mekanism.common.base.IFactory.RecipeType;
|
||||
import mekanism.common.base.IRedstoneControl;
|
||||
import mekanism.common.base.ISideConfiguration;
|
||||
@@ -42,7 +42,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMetallurgicInfuser extends TileEntityNoisyElectricBlock implements IComputerIntegration, ISideConfiguration, IUpgradeTile, IRedstoneControl
|
||||
public class TileEntityMetallurgicInfuser extends TileEntityNoisyElectricBlock implements IComputerIntegration, ISideConfiguration, IUpgradeTile, IRedstoneControl, IConfigCardAccess
|
||||
{
|
||||
/** The maxiumum amount of infuse this machine can store. */
|
||||
public int MAX_INFUSE = 1000;
|
||||
@@ -540,7 +540,7 @@ public class TileEntityMetallurgicInfuser extends TileEntityNoisyElectricBlock i
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEjector getEjector()
|
||||
public TileComponentEjector getEjector()
|
||||
{
|
||||
return ejectorComponent;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.IFilterAccess;
|
||||
import mekanism.api.IConfigCardAccess.ISpecialConfigData;
|
||||
import mekanism.api.Range4D;
|
||||
import mekanism.common.HashList;
|
||||
import mekanism.common.Mekanism;
|
||||
@@ -27,7 +27,7 @@ import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraftforge.common.util.Constants.NBT;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class TileEntityOredictionificator extends TileEntityContainerBlock implements IRedstoneControl, IFilterAccess, ISustainedData
|
||||
public class TileEntityOredictionificator extends TileEntityContainerBlock implements IRedstoneControl, ISpecialConfigData, ISustainedData
|
||||
{
|
||||
public static final int MAX_LENGTH = 24;
|
||||
|
||||
@@ -316,10 +316,8 @@ public class TileEntityOredictionificator extends TileEntityContainerBlock imple
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getFilterData(NBTTagCompound nbtTags)
|
||||
public NBTTagCompound getConfigurationData(NBTTagCompound nbtTags)
|
||||
{
|
||||
nbtTags.setInteger("controlType", controlType.ordinal());
|
||||
|
||||
NBTTagList filterTags = new NBTTagList();
|
||||
|
||||
for(OredictionificatorFilter filter : filters)
|
||||
@@ -338,10 +336,8 @@ public class TileEntityOredictionificator extends TileEntityContainerBlock imple
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFilterData(NBTTagCompound nbtTags)
|
||||
public void setConfigurationData(NBTTagCompound nbtTags)
|
||||
{
|
||||
controlType = RedstoneControl.values()[nbtTags.getInteger("controlType")];
|
||||
|
||||
if(nbtTags.hasKey("filters"))
|
||||
{
|
||||
NBTTagList tagList = nbtTags.getTagList("filters", NBT.TAG_COMPOUND);
|
||||
@@ -356,7 +352,7 @@ public class TileEntityOredictionificator extends TileEntityContainerBlock imple
|
||||
@Override
|
||||
public String getDataType()
|
||||
{
|
||||
return "tooltip.filterCard.oredictionificator";
|
||||
return getBlockType().getUnlocalizedName() + "." + fullName + ".name";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,17 +11,18 @@ import mekanism.api.IHeatTransfer;
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.api.gas.IGasHandler;
|
||||
import mekanism.api.gas.ITubeConnection;
|
||||
import mekanism.api.transmitters.TransmissionType;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.PacketHandler;
|
||||
import mekanism.common.SideData.IOState;
|
||||
import mekanism.common.base.IEjector;
|
||||
import mekanism.common.base.ISideConfiguration;
|
||||
import mekanism.common.base.ITankManager;
|
||||
import mekanism.common.content.entangloporter.InventoryFrequency;
|
||||
import mekanism.common.frequency.Frequency;
|
||||
import mekanism.common.frequency.FrequencyManager;
|
||||
import mekanism.common.frequency.IFrequencyHandler;
|
||||
import mekanism.common.integration.IComputerIntegration;
|
||||
import mekanism.common.tile.component.TileComponentConfig;
|
||||
import mekanism.common.tile.component.TileComponentEjector;
|
||||
import mekanism.common.util.CableUtils;
|
||||
@@ -38,7 +39,7 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
public class TileEntityQuantumEntangloporter extends TileEntityElectricBlock implements ISideConfiguration, ITankManager, IFluidHandler, IFrequencyHandler, IGasHandler, IHeatTransfer
|
||||
public class TileEntityQuantumEntangloporter extends TileEntityElectricBlock implements ISideConfiguration, ITankManager, IFluidHandler, IFrequencyHandler, IGasHandler, IHeatTransfer, ITubeConnection, IComputerIntegration
|
||||
{
|
||||
public String owner;
|
||||
|
||||
@@ -667,8 +668,44 @@ public class TileEntityQuantumEntangloporter extends TileEntityElectricBlock imp
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEjector getEjector()
|
||||
public TileComponentEjector getEjector()
|
||||
{
|
||||
return ejectorComponent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTubeConnect(ForgeDirection side)
|
||||
{
|
||||
return frequency != null && configComponent.getOutput(TransmissionType.GAS, side.ordinal(), facing).ioState != IOState.OFF;
|
||||
}
|
||||
|
||||
private static final String[] methods = new String[] {"setFrequency"};
|
||||
|
||||
@Override
|
||||
public String[] getMethods()
|
||||
{
|
||||
return methods;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] invoke(int method, Object[] arguments) throws Exception
|
||||
{
|
||||
switch(method)
|
||||
{
|
||||
case 0:
|
||||
if(!(arguments[0] instanceof String) || !(arguments[1] instanceof Boolean))
|
||||
{
|
||||
return new Object[] {"Invalid parameters."};
|
||||
}
|
||||
|
||||
String freq = ((String)arguments[0]).trim();
|
||||
boolean isPublic = (Boolean)arguments[1];
|
||||
|
||||
setFrequency(freq, isPublic);
|
||||
|
||||
return new Object[] {"Frequency set."};
|
||||
default:
|
||||
throw new NoSuchMethodException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -699,7 +699,7 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo
|
||||
return ChargeUtils.canBeOutputted(itemstack, false);
|
||||
}
|
||||
|
||||
private static final String[] methods = new String[] {"getEnergy", "canTeleport", "getMaxEnergy", "teleport", "set"};
|
||||
private static final String[] methods = new String[] {"getEnergy", "canTeleport", "getMaxEnergy", "teleport", "setFrequency"};
|
||||
|
||||
@Override
|
||||
public String[] getMethods()
|
||||
|
||||
@@ -14,7 +14,6 @@ import mekanism.api.gas.GasTank;
|
||||
import mekanism.api.gas.GasTransmission;
|
||||
import mekanism.api.transmitters.TransmissionType;
|
||||
import mekanism.common.SideData;
|
||||
import mekanism.common.base.IEjector;
|
||||
import mekanism.common.base.ISideConfiguration;
|
||||
import mekanism.common.base.ITankManager;
|
||||
import mekanism.common.base.ITileComponent;
|
||||
@@ -33,7 +32,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTank;
|
||||
|
||||
public class TileComponentEjector implements ITileComponent, IEjector
|
||||
public class TileComponentEjector implements ITileComponent
|
||||
{
|
||||
public TileEntityContainerBlock tileEntity;
|
||||
|
||||
@@ -164,7 +163,6 @@ public class TileComponentEjector implements ITileComponent, IEjector
|
||||
return outputSides;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void outputItems()
|
||||
{
|
||||
if(!getEjecting(TransmissionType.ITEM) || tileEntity.getWorldObj().isRemote)
|
||||
@@ -224,40 +222,34 @@ public class TileComponentEjector implements ITileComponent, IEjector
|
||||
tickDelay = 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasStrictInput()
|
||||
{
|
||||
return strictInput;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStrictInput(boolean strict)
|
||||
{
|
||||
strictInput = strict;
|
||||
MekanismUtils.saveChunk(tileEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOutputColor(EnumColor color)
|
||||
{
|
||||
outputColor = color;
|
||||
MekanismUtils.saveChunk(tileEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumColor getOutputColor()
|
||||
{
|
||||
return outputColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInputColor(ForgeDirection side, EnumColor color)
|
||||
{
|
||||
inputColors[side.ordinal()] = color;
|
||||
MekanismUtils.saveChunk(tileEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumColor getInputColor(ForgeDirection side)
|
||||
{
|
||||
return inputColors[side.ordinal()];
|
||||
|
||||
@@ -91,14 +91,33 @@ public final class InventoryUtils
|
||||
|
||||
if(inSlot == null)
|
||||
{
|
||||
inventory.setInventorySlotContents(i, toInsert);
|
||||
inventory.markDirty();
|
||||
|
||||
return null;
|
||||
if(toInsert.stackSize <= inventory.getInventoryStackLimit())
|
||||
{
|
||||
inventory.setInventorySlotContents(i, toInsert);
|
||||
inventory.markDirty();
|
||||
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
int rejects = toInsert.stackSize - inventory.getInventoryStackLimit();
|
||||
|
||||
ItemStack toSet = toInsert.copy();
|
||||
toSet.stackSize = inventory.getInventoryStackLimit();
|
||||
|
||||
ItemStack remains = toInsert.copy();
|
||||
remains.stackSize = rejects;
|
||||
|
||||
inventory.setInventorySlotContents(i, toSet);
|
||||
inventory.markDirty();
|
||||
|
||||
toInsert = remains;
|
||||
}
|
||||
}
|
||||
else if(areItemsStackable(toInsert, inSlot) && inSlot.stackSize < inSlot.getMaxStackSize() && inSlot.stackSize < inventory.getInventoryStackLimit())
|
||||
else if(areItemsStackable(toInsert, inSlot) && inSlot.stackSize < Math.min(inSlot.getMaxStackSize(), inventory.getInventoryStackLimit()))
|
||||
{
|
||||
if(inSlot.stackSize + toInsert.stackSize <= inSlot.getMaxStackSize())
|
||||
int max = Math.min(inSlot.getMaxStackSize(), inventory.getInventoryStackLimit());
|
||||
|
||||
if(inSlot.stackSize + toInsert.stackSize <= max)
|
||||
{
|
||||
ItemStack toSet = toInsert.copy();
|
||||
toSet.stackSize += inSlot.stackSize;
|
||||
@@ -109,10 +128,10 @@ public final class InventoryUtils
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
int rejects = (inSlot.stackSize + toInsert.stackSize) - inSlot.getMaxStackSize();
|
||||
int rejects = (inSlot.stackSize + toInsert.stackSize) - max;
|
||||
|
||||
ItemStack toSet = toInsert.copy();
|
||||
toSet.stackSize = inSlot.getMaxStackSize();
|
||||
toSet.stackSize = max;
|
||||
|
||||
ItemStack remains = toInsert.copy();
|
||||
remains.stackSize = rejects;
|
||||
@@ -152,14 +171,33 @@ public final class InventoryUtils
|
||||
|
||||
if(inSlot == null)
|
||||
{
|
||||
inventory.setInventorySlotContents(slotID, toInsert);
|
||||
inventory.markDirty();
|
||||
|
||||
return null;
|
||||
if(toInsert.stackSize <= inventory.getInventoryStackLimit())
|
||||
{
|
||||
inventory.setInventorySlotContents(slotID, toInsert);
|
||||
inventory.markDirty();
|
||||
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
int rejects = toInsert.stackSize - inventory.getInventoryStackLimit();
|
||||
|
||||
ItemStack toSet = toInsert.copy();
|
||||
toSet.stackSize = inventory.getInventoryStackLimit();
|
||||
|
||||
ItemStack remains = toInsert.copy();
|
||||
remains.stackSize = rejects;
|
||||
|
||||
inventory.setInventorySlotContents(slotID, toSet);
|
||||
inventory.markDirty();
|
||||
|
||||
toInsert = remains;
|
||||
}
|
||||
}
|
||||
else if(areItemsStackable(toInsert, inSlot) && inSlot.stackSize < inSlot.getMaxStackSize() && inSlot.stackSize < inventory.getInventoryStackLimit())
|
||||
else if(areItemsStackable(toInsert, inSlot) && inSlot.stackSize < Math.min(inSlot.getMaxStackSize(), inventory.getInventoryStackLimit()))
|
||||
{
|
||||
if(inSlot.stackSize + toInsert.stackSize <= inSlot.getMaxStackSize())
|
||||
int max = Math.min(inSlot.getMaxStackSize(), inventory.getInventoryStackLimit());
|
||||
|
||||
if(inSlot.stackSize + toInsert.stackSize <= max)
|
||||
{
|
||||
ItemStack toSet = toInsert.copy();
|
||||
toSet.stackSize += inSlot.stackSize;
|
||||
@@ -170,10 +208,10 @@ public final class InventoryUtils
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
int rejects = (inSlot.stackSize + toInsert.stackSize) - inSlot.getMaxStackSize();
|
||||
int rejects = (inSlot.stackSize + toInsert.stackSize) - max;
|
||||
|
||||
ItemStack toSet = toInsert.copy();
|
||||
toSet.stackSize = inSlot.getMaxStackSize();
|
||||
toSet.stackSize = max;
|
||||
|
||||
ItemStack remains = toInsert.copy();
|
||||
remains.stackSize = rejects;
|
||||
@@ -406,16 +444,29 @@ public final class InventoryUtils
|
||||
|
||||
if(inSlot == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if(areItemsStackable(itemStack, inSlot) && inSlot.stackSize < inSlot.getMaxStackSize() && inSlot.stackSize < inventory.getInventoryStackLimit())
|
||||
{
|
||||
if(inSlot.stackSize + itemStack.stackSize <= inSlot.getMaxStackSize())
|
||||
if(itemStack.stackSize <= inventory.getInventoryStackLimit())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
int rejects = (inSlot.stackSize + itemStack.stackSize) - inSlot.getMaxStackSize();
|
||||
int rejects = itemStack.stackSize - inventory.getInventoryStackLimit();
|
||||
|
||||
if(rejects < itemStack.stackSize)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(areItemsStackable(itemStack, inSlot) && inSlot.stackSize < Math.min(inSlot.getMaxStackSize(), inventory.getInventoryStackLimit()))
|
||||
{
|
||||
int max = Math.min(inSlot.getMaxStackSize(), inventory.getInventoryStackLimit());
|
||||
|
||||
if(inSlot.stackSize + itemStack.stackSize <= max)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
int rejects = (inSlot.stackSize + itemStack.stackSize) - max;
|
||||
|
||||
if(rejects < itemStack.stackSize)
|
||||
{
|
||||
@@ -452,16 +503,29 @@ public final class InventoryUtils
|
||||
|
||||
if(inSlot == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if(areItemsStackable(itemStack, inSlot) && inSlot.stackSize < inSlot.getMaxStackSize() && inSlot.stackSize < inventory.getInventoryStackLimit())
|
||||
{
|
||||
if(inSlot.stackSize + itemStack.stackSize <= inSlot.getMaxStackSize())
|
||||
if(itemStack.stackSize <= inventory.getInventoryStackLimit())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
int rejects = (inSlot.stackSize + itemStack.stackSize) - inSlot.getMaxStackSize();
|
||||
int rejects = itemStack.stackSize - inventory.getInventoryStackLimit();
|
||||
|
||||
if(rejects < itemStack.stackSize)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(areItemsStackable(itemStack, inSlot) && inSlot.stackSize < Math.min(inSlot.getMaxStackSize(), inventory.getInventoryStackLimit()))
|
||||
{
|
||||
int max = Math.min(inSlot.getMaxStackSize(), inventory.getInventoryStackLimit());
|
||||
|
||||
if(inSlot.stackSize + itemStack.stackSize <= max)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
int rejects = (inSlot.stackSize + itemStack.stackSize) - max;
|
||||
|
||||
if(rejects < itemStack.stackSize)
|
||||
{
|
||||
|
||||
@@ -1155,7 +1155,7 @@ public final class MekanismUtils
|
||||
*/
|
||||
public static String getEnergyDisplay(double energy)
|
||||
{
|
||||
if(energy == Integer.MAX_VALUE)
|
||||
if(energy == Double.MAX_VALUE)
|
||||
{
|
||||
return LangUtils.localize("gui.infinite");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user