Fixed Model3D textures, fixed error spam on world load, fixed Digital Miner breaking blocks on top, general code cleanup
|
@ -1,7 +1,6 @@
|
||||||
package mekanism.api.gas;
|
package mekanism.api.gas;
|
||||||
|
|
||||||
import net.minecraft.util.Icon;
|
import net.minecraft.util.Icon;
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The gasses currently available in Mekanism.
|
* The gasses currently available in Mekanism.
|
||||||
|
@ -10,13 +9,12 @@ import net.minecraft.util.ResourceLocation;
|
||||||
*/
|
*/
|
||||||
public enum EnumGas
|
public enum EnumGas
|
||||||
{
|
{
|
||||||
NONE("None", null, null),
|
NONE("None", null),
|
||||||
OXYGEN("Oxygen", null, null),
|
OXYGEN("Oxygen", null),
|
||||||
HYDROGEN("Hydrogen", null, null);
|
HYDROGEN("Hydrogen", null);
|
||||||
|
|
||||||
public String name;
|
public String name;
|
||||||
public Icon gasIcon;
|
public Icon gasIcon;
|
||||||
public ResourceLocation texturePath;
|
|
||||||
|
|
||||||
public static EnumGas getFromName(String gasName)
|
public static EnumGas getFromName(String gasName)
|
||||||
{
|
{
|
||||||
|
@ -34,13 +32,12 @@ public enum EnumGas
|
||||||
|
|
||||||
public boolean hasTexture()
|
public boolean hasTexture()
|
||||||
{
|
{
|
||||||
return gasIcon != null && texturePath != null;
|
return gasIcon != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private EnumGas(String s, Icon icon, ResourceLocation path)
|
private EnumGas(String s, Icon icon)
|
||||||
{
|
{
|
||||||
name = s;
|
name = s;
|
||||||
gasIcon = icon;
|
gasIcon = icon;
|
||||||
texturePath = path;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ import java.io.File;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import mekanism.api.IConfigurable;
|
import mekanism.api.IConfigurable;
|
||||||
import mekanism.api.gas.EnumGas;
|
|
||||||
import mekanism.client.gui.GuiCombiner;
|
import mekanism.client.gui.GuiCombiner;
|
||||||
import mekanism.client.gui.GuiConfiguration;
|
import mekanism.client.gui.GuiConfiguration;
|
||||||
import mekanism.client.gui.GuiCredits;
|
import mekanism.client.gui.GuiCredits;
|
||||||
|
@ -71,6 +70,7 @@ import mekanism.common.tileentity.TileEntityChargepad;
|
||||||
import mekanism.common.tileentity.TileEntityCombiner;
|
import mekanism.common.tileentity.TileEntityCombiner;
|
||||||
import mekanism.common.tileentity.TileEntityCrusher;
|
import mekanism.common.tileentity.TileEntityCrusher;
|
||||||
import mekanism.common.tileentity.TileEntityDigitalMiner;
|
import mekanism.common.tileentity.TileEntityDigitalMiner;
|
||||||
|
import mekanism.common.tileentity.TileEntityDiversionTransporter;
|
||||||
import mekanism.common.tileentity.TileEntityDynamicTank;
|
import mekanism.common.tileentity.TileEntityDynamicTank;
|
||||||
import mekanism.common.tileentity.TileEntityDynamicValve;
|
import mekanism.common.tileentity.TileEntityDynamicValve;
|
||||||
import mekanism.common.tileentity.TileEntityElectricChest;
|
import mekanism.common.tileentity.TileEntityElectricChest;
|
||||||
|
@ -82,7 +82,6 @@ import mekanism.common.tileentity.TileEntityEnergyCube;
|
||||||
import mekanism.common.tileentity.TileEntityEnrichmentChamber;
|
import mekanism.common.tileentity.TileEntityEnrichmentChamber;
|
||||||
import mekanism.common.tileentity.TileEntityFactory;
|
import mekanism.common.tileentity.TileEntityFactory;
|
||||||
import mekanism.common.tileentity.TileEntityGasTank;
|
import mekanism.common.tileentity.TileEntityGasTank;
|
||||||
import mekanism.common.tileentity.TileEntityDiversionTransporter;
|
|
||||||
import mekanism.common.tileentity.TileEntityLogisticalSorter;
|
import mekanism.common.tileentity.TileEntityLogisticalSorter;
|
||||||
import mekanism.common.tileentity.TileEntityLogisticalTransporter;
|
import mekanism.common.tileentity.TileEntityLogisticalTransporter;
|
||||||
import mekanism.common.tileentity.TileEntityMechanicalPipe;
|
import mekanism.common.tileentity.TileEntityMechanicalPipe;
|
||||||
|
@ -93,8 +92,6 @@ import mekanism.common.tileentity.TileEntityPressurizedTube;
|
||||||
import mekanism.common.tileentity.TileEntityPurificationChamber;
|
import mekanism.common.tileentity.TileEntityPurificationChamber;
|
||||||
import mekanism.common.tileentity.TileEntityTeleporter;
|
import mekanism.common.tileentity.TileEntityTeleporter;
|
||||||
import mekanism.common.tileentity.TileEntityUniversalCable;
|
import mekanism.common.tileentity.TileEntityUniversalCable;
|
||||||
import mekanism.common.util.MekanismUtils;
|
|
||||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
@ -108,7 +105,6 @@ import cpw.mods.fml.client.registry.ClientRegistry;
|
||||||
import cpw.mods.fml.client.registry.KeyBindingRegistry;
|
import cpw.mods.fml.client.registry.KeyBindingRegistry;
|
||||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||||
import cpw.mods.fml.common.registry.GameRegistry;
|
|
||||||
import cpw.mods.fml.common.registry.TickRegistry;
|
import cpw.mods.fml.common.registry.TickRegistry;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
@ -279,18 +275,6 @@ public class ClientProxy extends CommonProxy
|
||||||
RenderingRegistry.registerBlockHandler(new TransmitterRenderingHandler());
|
RenderingRegistry.registerBlockHandler(new TransmitterRenderingHandler());
|
||||||
RenderingRegistry.registerBlockHandler(new BasicRenderingHandler());
|
RenderingRegistry.registerBlockHandler(new BasicRenderingHandler());
|
||||||
|
|
||||||
if(!EnumGas.HYDROGEN.hasTexture())
|
|
||||||
{
|
|
||||||
EnumGas.HYDROGEN.gasIcon = MekanismRenderer.getTextureMap(1).registerIcon("mekanism:LiquidHydrogen");
|
|
||||||
EnumGas.HYDROGEN.texturePath = MekanismUtils.getResource(ResourceType.TEXTURE_ITEMS, "LiquidHydrogen.png");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!EnumGas.OXYGEN.hasTexture())
|
|
||||||
{
|
|
||||||
EnumGas.OXYGEN.gasIcon = MekanismRenderer.getTextureMap(1).registerIcon("mekanism:LiquidOxygen");
|
|
||||||
EnumGas.OXYGEN.texturePath = MekanismUtils.getResource(ResourceType.TEXTURE_ITEMS, "LiquidOxygen.png");
|
|
||||||
}
|
|
||||||
|
|
||||||
System.out.println("[Mekanism] Render registrations complete.");
|
System.out.println("[Mekanism] Render registrations complete.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -420,6 +404,12 @@ public class ClientProxy extends CommonProxy
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void preInit()
|
||||||
|
{
|
||||||
|
MekanismRenderer.init();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getReach(EntityPlayer player)
|
public double getReach(EntityPlayer player)
|
||||||
{
|
{
|
||||||
|
|
|
@ -165,7 +165,7 @@ public class GuiConfiguration extends GuiMekanism
|
||||||
GL11.glEnable(GL11.GL_LIGHTING);
|
GL11.glEnable(GL11.GL_LIGHTING);
|
||||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||||
|
|
||||||
mc.getTextureManager().bindTexture(MekanismRenderer.getColorResource(configurable.getEjector().getOutputColor()));
|
mc.getTextureManager().bindTexture(MekanismRenderer.getBlocksTexture());
|
||||||
itemRenderer.renderIcon(80, 49, MekanismRenderer.getColorIcon(configurable.getEjector().getOutputColor()), 16, 16);
|
itemRenderer.renderIcon(80, 49, MekanismRenderer.getColorIcon(configurable.getEjector().getOutputColor()), 16, 16);
|
||||||
|
|
||||||
GL11.glDisable(GL11.GL_LIGHTING);
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
|
|
|
@ -94,7 +94,7 @@ public class GuiDynamicTank extends GuiContainer
|
||||||
scale = 0;
|
scale = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
mc.renderEngine.bindTexture(MekanismRenderer.getLiquidTexture());
|
mc.renderEngine.bindTexture(MekanismRenderer.getBlocksTexture());
|
||||||
drawTexturedModelRectFromIcon(width + xPos, height + yPos + 58 - renderRemaining - start, fluid.getFluid().getIcon(), 16, 16 - (16 - renderRemaining));
|
drawTexturedModelRectFromIcon(width + xPos, height + yPos + 58 - renderRemaining - start, fluid.getFluid().getIcon(), 16, 16 - (16 - renderRemaining));
|
||||||
start+=16;
|
start+=16;
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ public class GuiElectricPump extends GuiContainer
|
||||||
scale = 0;
|
scale = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
mc.renderEngine.bindTexture(MekanismRenderer.getLiquidTexture());
|
mc.renderEngine.bindTexture(MekanismRenderer.getBlocksTexture());
|
||||||
drawTexturedModelRectFromIcon(width + yPos, height + xPos + 58 - renderRemaining - start, fluid.getFluid().getIcon(), 16, 16 - (16 - renderRemaining));
|
drawTexturedModelRectFromIcon(width + yPos, height + xPos + 58 - renderRemaining - start, fluid.getFluid().getIcon(), 16, 16 - (16 - renderRemaining));
|
||||||
start+=16;
|
start+=16;
|
||||||
|
|
||||||
|
|
|
@ -330,7 +330,7 @@ public class GuiLogisticalSorter extends GuiMekanism
|
||||||
GL11.glEnable(GL11.GL_LIGHTING);
|
GL11.glEnable(GL11.GL_LIGHTING);
|
||||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||||
|
|
||||||
mc.getTextureManager().bindTexture(MekanismRenderer.getColorResource(tileEntity.color));
|
mc.getTextureManager().bindTexture(MekanismRenderer.getBlocksTexture());
|
||||||
itemRenderer.renderIcon(13, 137, MekanismRenderer.getColorIcon(tileEntity.color), 16, 16);
|
itemRenderer.renderIcon(13, 137, MekanismRenderer.getColorIcon(tileEntity.color), 16, 16);
|
||||||
|
|
||||||
GL11.glDisable(GL11.GL_LIGHTING);
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
|
|
|
@ -190,7 +190,7 @@ public class GuiTItemStackFilter extends GuiMekanism
|
||||||
GL11.glEnable(GL11.GL_LIGHTING);
|
GL11.glEnable(GL11.GL_LIGHTING);
|
||||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||||
|
|
||||||
mc.getTextureManager().bindTexture(MekanismRenderer.getColorResource(filter.color));
|
mc.getTextureManager().bindTexture(MekanismRenderer.getBlocksTexture());
|
||||||
itemRenderer.renderIcon(12, 44, MekanismRenderer.getColorIcon(filter.color), 16, 16);
|
itemRenderer.renderIcon(12, 44, MekanismRenderer.getColorIcon(filter.color), 16, 16);
|
||||||
|
|
||||||
GL11.glDisable(GL11.GL_LIGHTING);
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
|
|
|
@ -177,7 +177,7 @@ public class GuiTOreDictFilter extends GuiMekanism
|
||||||
GL11.glEnable(GL11.GL_LIGHTING);
|
GL11.glEnable(GL11.GL_LIGHTING);
|
||||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||||
|
|
||||||
mc.getTextureManager().bindTexture(MekanismRenderer.getColorResource(filter.color));
|
mc.getTextureManager().bindTexture(MekanismRenderer.getBlocksTexture());
|
||||||
itemRenderer.renderIcon(12, 44, MekanismRenderer.getColorIcon(filter.color), 16, 16);
|
itemRenderer.renderIcon(12, 44, MekanismRenderer.getColorIcon(filter.color), 16, 16);
|
||||||
|
|
||||||
GL11.glDisable(GL11.GL_LIGHTING);
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
|
|
|
@ -4,10 +4,10 @@ import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import mekanism.api.EnumColor;
|
import mekanism.api.EnumColor;
|
||||||
|
import mekanism.api.gas.EnumGas;
|
||||||
import mekanism.common.ISpecialBounds;
|
import mekanism.common.ISpecialBounds;
|
||||||
import mekanism.common.ObfuscatedNames;
|
import mekanism.common.ObfuscatedNames;
|
||||||
import mekanism.common.util.MekanismUtils;
|
import mekanism.common.util.MekanismUtils;
|
||||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.GLAllocation;
|
import net.minecraft.client.renderer.GLAllocation;
|
||||||
|
@ -22,12 +22,16 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.Icon;
|
import net.minecraft.util.Icon;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.Timer;
|
import net.minecraft.util.Timer;
|
||||||
|
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
import net.minecraftforge.event.ForgeSubscribe;
|
||||||
import net.minecraftforge.fluids.Fluid;
|
import net.minecraftforge.fluids.Fluid;
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
import org.lwjgl.opengl.GL12;
|
import org.lwjgl.opengl.GL12;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.Mod.EventHandler;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
@ -38,9 +42,34 @@ public class MekanismRenderer
|
||||||
|
|
||||||
public static Icon[] colors = new Icon[256];
|
public static Icon[] colors = new Icon[256];
|
||||||
|
|
||||||
|
public static Icon energyIcon;
|
||||||
|
|
||||||
private static float lightmapLastX;
|
private static float lightmapLastX;
|
||||||
private static float lightmapLastY;
|
private static float lightmapLastY;
|
||||||
private static boolean optifineBreak = false;
|
private static boolean optifineBreak = false;
|
||||||
|
|
||||||
|
public static void init()
|
||||||
|
{
|
||||||
|
MinecraftForge.EVENT_BUS.register(new MekanismRenderer());
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
@ForgeSubscribe /* Screwy Forge code */
|
||||||
|
public void onStitch(TextureStitchEvent.Pre event)
|
||||||
|
{
|
||||||
|
if(event.map.textureType == 0)
|
||||||
|
{
|
||||||
|
for(EnumColor color : EnumColor.values())
|
||||||
|
{
|
||||||
|
colors[color.ordinal()] = event.map.registerIcon("mekanism:Overlay" + color.friendlyName.replace(" ", ""));
|
||||||
|
}
|
||||||
|
|
||||||
|
energyIcon = event.map.registerIcon("mekanism:LiquidEnergy");
|
||||||
|
|
||||||
|
EnumGas.HYDROGEN.gasIcon = event.map.registerIcon("mekanism:LiquidHydrogen");
|
||||||
|
EnumGas.OXYGEN.gasIcon = event.map.registerIcon("mekanism:LiquidOxygen");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static class Model3D
|
public static class Model3D
|
||||||
{
|
{
|
||||||
|
@ -152,18 +181,8 @@ public class MekanismRenderer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ResourceLocation getColorResource(EnumColor color)
|
|
||||||
{
|
|
||||||
return MekanismUtils.getResource(ResourceType.TEXTURE_BLOCKS, "Overlay" + color.friendlyName.replace(" ", "") + ".png");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Icon getColorIcon(EnumColor color)
|
public static Icon getColorIcon(EnumColor color)
|
||||||
{
|
{
|
||||||
if(colors[color.ordinal()] == null)
|
|
||||||
{
|
|
||||||
colors[color.ordinal()] = getTextureMap(0).registerIcon("mekanism:Overlay" + color.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
return colors[color.ordinal()];
|
return colors[color.ordinal()];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,9 +194,7 @@ public class MekanismRenderer
|
||||||
{
|
{
|
||||||
lightmapLastX = OpenGlHelper.lastBrightnessX;
|
lightmapLastX = OpenGlHelper.lastBrightnessX;
|
||||||
lightmapLastY = OpenGlHelper.lastBrightnessY;
|
lightmapLastY = OpenGlHelper.lastBrightnessY;
|
||||||
}
|
} catch(NoSuchFieldError e) {
|
||||||
catch(NoSuchFieldError e)
|
|
||||||
{
|
|
||||||
optifineBreak = true;
|
optifineBreak = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -428,8 +445,13 @@ public class MekanismRenderer
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ResourceLocation getLiquidTexture()
|
public static ResourceLocation getBlocksTexture()
|
||||||
{
|
{
|
||||||
return TextureMap.locationBlocksTexture;
|
return TextureMap.locationBlocksTexture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ResourceLocation getItemsTexture()
|
||||||
|
{
|
||||||
|
return TextureMap.locationItemsTexture;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,12 +14,10 @@ import mekanism.common.util.MekanismUtils.ResourceType;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.GLAllocation;
|
import net.minecraft.client.renderer.GLAllocation;
|
||||||
import net.minecraft.client.renderer.texture.TextureMap;
|
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.Icon;
|
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.util.MovingObjectPosition;
|
import net.minecraft.util.MovingObjectPosition;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
@ -68,7 +66,7 @@ public class RenderConfigurableMachine extends TileEntitySpecialRenderer
|
||||||
|
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.4F);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.4F);
|
||||||
|
|
||||||
bindTexture(MekanismUtils.getResource(ResourceType.TEXTURE_BLOCKS, "Overlay" + color.friendlyName.replace(" ", "") + ".png"));
|
bindTexture(MekanismRenderer.getBlocksTexture());
|
||||||
GL11.glTranslatef((float)x, (float)y, (float)z);
|
GL11.glTranslatef((float)x, (float)y, (float)z);
|
||||||
|
|
||||||
int display = getOverlayDisplay(world, ForgeDirection.getOrientation(pos.sideHit), color).display;
|
int display = getOverlayDisplay(world, ForgeDirection.getOrientation(pos.sideHit), color).display;
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class RenderDynamicTank extends TileEntitySpecialRenderer
|
||||||
data.length = tileEntity.structure.volLength;
|
data.length = tileEntity.structure.volLength;
|
||||||
data.width = tileEntity.structure.volWidth;
|
data.width = tileEntity.structure.volWidth;
|
||||||
|
|
||||||
bindTexture(MekanismRenderer.getLiquidTexture());
|
bindTexture(MekanismRenderer.getBlocksTexture());
|
||||||
|
|
||||||
if(data.location != null && data.height > 0 && tileEntity.structure.fluidStored.getFluid() != null)
|
if(data.location != null && data.height > 0 && tileEntity.structure.fluidStored.getFluid() != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -84,28 +84,31 @@ public class RenderLogisticalTransporter extends TileEntitySpecialRenderer
|
||||||
|
|
||||||
for(TransporterStack stack : tileEntity.transit)
|
for(TransporterStack stack : tileEntity.transit)
|
||||||
{
|
{
|
||||||
GL11.glPushMatrix();
|
if(stack != null)
|
||||||
entityItem.setEntityItemStack(stack.itemStack);
|
|
||||||
|
|
||||||
float[] pos = TransporterUtils.getStackPosition(tileEntity, stack, partialTick*TileEntityLogisticalTransporter.SPEED);
|
|
||||||
|
|
||||||
GL11.glTranslated(x + pos[0], y + pos[1] - entityItem.yOffset, z + pos[2]);
|
|
||||||
GL11.glScalef(0.75F, 0.75F, 0.75F);
|
|
||||||
|
|
||||||
renderer.doRenderItem(entityItem, 0, 0, 0, 0, 0);
|
|
||||||
GL11.glPopMatrix();
|
|
||||||
|
|
||||||
if(stack.color != null)
|
|
||||||
{
|
{
|
||||||
bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "TransporterBox.png"));
|
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
MekanismRenderer.glowOn();
|
entityItem.setEntityItemStack(stack.itemStack);
|
||||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
|
||||||
GL11.glColor4f(stack.color.getColor(0), stack.color.getColor(1), stack.color.getColor(2), 1.0F);
|
float[] pos = TransporterUtils.getStackPosition(tileEntity, stack, partialTick*TileEntityLogisticalTransporter.SPEED);
|
||||||
GL11.glTranslatef((float)(x + pos[0]), (float)(y + pos[1] - entityItem.yOffset - (stack.itemStack.itemID < 256 ? 0.1 : 0)), (float)(z + pos[2]));
|
|
||||||
modelBox.render(0.0625F);
|
GL11.glTranslated(x + pos[0], y + pos[1] - entityItem.yOffset, z + pos[2]);
|
||||||
MekanismRenderer.glowOff();
|
GL11.glScalef(0.75F, 0.75F, 0.75F);
|
||||||
|
|
||||||
|
renderer.doRenderItem(entityItem, 0, 0, 0, 0, 0);
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
|
|
||||||
|
if(stack.color != null)
|
||||||
|
{
|
||||||
|
bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "TransporterBox.png"));
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
MekanismRenderer.glowOn();
|
||||||
|
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||||
|
GL11.glColor4f(stack.color.getColor(0), stack.color.getColor(1), stack.color.getColor(2), 1.0F);
|
||||||
|
GL11.glTranslatef((float)(x + pos[0]), (float)(y + pos[1] - entityItem.yOffset - (stack.itemStack.itemID < 256 ? 0.1 : 0)), (float)(z + pos[2]));
|
||||||
|
modelBox.render(0.0625F);
|
||||||
|
MekanismRenderer.glowOff();
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class RenderMechanicalPipe extends TileEntitySpecialRenderer
|
||||||
MekanismRenderer.glowOn();
|
MekanismRenderer.glowOn();
|
||||||
}
|
}
|
||||||
|
|
||||||
bindTexture(MekanismRenderer.getLiquidTexture());
|
bindTexture(MekanismRenderer.getBlocksTexture());
|
||||||
GL11.glTranslatef((float)x, (float)y, (float)z);
|
GL11.glTranslatef((float)x, (float)y, (float)z);
|
||||||
|
|
||||||
for(int i = 0; i < 6; i++)
|
for(int i = 0; i < 6; i++)
|
||||||
|
|
|
@ -118,7 +118,7 @@ public class RenderPressurizedTube extends TileEntitySpecialRenderer
|
||||||
push();
|
push();
|
||||||
|
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, tileEntity.gasScale);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, tileEntity.gasScale);
|
||||||
bindTexture(tileEntity.refGas.texturePath);
|
bindTexture(MekanismRenderer.getBlocksTexture());
|
||||||
GL11.glTranslatef((float)x, (float)y, (float)z);
|
GL11.glTranslatef((float)x, (float)y, (float)z);
|
||||||
|
|
||||||
if(tileEntity.gasScale > 0)
|
if(tileEntity.gasScale > 0)
|
||||||
|
|
|
@ -30,8 +30,6 @@ public class RenderUniversalCable extends TileEntitySpecialRenderer
|
||||||
{
|
{
|
||||||
private static ModelTransmitter model = new ModelTransmitter(Size.SMALL);
|
private static ModelTransmitter model = new ModelTransmitter(Size.SMALL);
|
||||||
|
|
||||||
private static Icon renderIcon = MekanismRenderer.getTextureMap(1).registerIcon("mekanism:LiquidEnergy");
|
|
||||||
|
|
||||||
private static Model3D[] energy = null;
|
private static Model3D[] energy = null;
|
||||||
|
|
||||||
private static Map<ForgeDirection, DisplayInteger> sideDisplayLists = new HashMap<ForgeDirection, DisplayInteger>();
|
private static Map<ForgeDirection, DisplayInteger> sideDisplayLists = new HashMap<ForgeDirection, DisplayInteger>();
|
||||||
|
@ -75,7 +73,7 @@ public class RenderUniversalCable extends TileEntitySpecialRenderer
|
||||||
|
|
||||||
MekanismRenderer.glowOn();
|
MekanismRenderer.glowOn();
|
||||||
GL11.glColor4f(1F, 1F, 1F, tileEntity.getEnergyScale());
|
GL11.glColor4f(1F, 1F, 1F, tileEntity.getEnergyScale());
|
||||||
bindTexture(MekanismUtils.getResource(ResourceType.TEXTURE_ITEMS, "LiquidEnergy.png"));
|
bindTexture(MekanismRenderer.getBlocksTexture());
|
||||||
GL11.glTranslatef((float)x, (float)y, (float)z);
|
GL11.glTranslatef((float)x, (float)y, (float)z);
|
||||||
|
|
||||||
if(energy == null)
|
if(energy == null)
|
||||||
|
@ -125,7 +123,7 @@ public class RenderUniversalCable extends TileEntitySpecialRenderer
|
||||||
Model3D[] energyArray = new Model3D[7];
|
Model3D[] energyArray = new Model3D[7];
|
||||||
Model3D centerModel = new Model3D();
|
Model3D centerModel = new Model3D();
|
||||||
centerModel.baseBlock = Block.waterStill;
|
centerModel.baseBlock = Block.waterStill;
|
||||||
centerModel.setTexture(renderIcon);
|
centerModel.setTexture(MekanismRenderer.energyIcon);
|
||||||
|
|
||||||
centerModel.minX = 0.3 + offset;
|
centerModel.minX = 0.3 + offset;
|
||||||
centerModel.minY = 0.3 + offset;
|
centerModel.minY = 0.3 + offset;
|
||||||
|
@ -141,7 +139,7 @@ public class RenderUniversalCable extends TileEntitySpecialRenderer
|
||||||
{
|
{
|
||||||
Model3D toReturn = new Model3D();
|
Model3D toReturn = new Model3D();
|
||||||
toReturn.baseBlock = Block.waterStill;
|
toReturn.baseBlock = Block.waterStill;
|
||||||
toReturn.setTexture(renderIcon);
|
toReturn.setTexture(MekanismRenderer.energyIcon);
|
||||||
|
|
||||||
toReturn.setSideRender(side, false);
|
toReturn.setSideRender(side, false);
|
||||||
toReturn.setSideRender(side.getOpposite(), false);
|
toReturn.setSideRender(side.getOpposite(), false);
|
||||||
|
|
|
@ -314,6 +314,8 @@ public class CommonProxy
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void preInit() {}
|
||||||
|
|
||||||
public double getReach(EntityPlayer player)
|
public double getReach(EntityPlayer player)
|
||||||
{
|
{
|
||||||
if(player instanceof EntityPlayerMP)
|
if(player instanceof EntityPlayerMP)
|
||||||
|
|
|
@ -39,6 +39,14 @@ public class HashList<T> implements Iterable<T>
|
||||||
{
|
{
|
||||||
if(!list.contains(obj))
|
if(!list.contains(obj))
|
||||||
{
|
{
|
||||||
|
if(index > size())
|
||||||
|
{
|
||||||
|
for(int i = size(); i <= index-1; i++)
|
||||||
|
{
|
||||||
|
list.add(i, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
list.add(index, obj);
|
list.add(index, obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1057,6 +1057,8 @@ public class Mekanism
|
||||||
System.out.println("[Mekanism] Detected Tekkit in root directory - hello, fellow user!");
|
System.out.println("[Mekanism] Detected Tekkit in root directory - hello, fellow user!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Mekanism.proxy.preInit();
|
||||||
|
|
||||||
MinecraftForge.EVENT_BUS.register(hooks);
|
MinecraftForge.EVENT_BUS.register(hooks);
|
||||||
|
|
||||||
//Register infuses
|
//Register infuses
|
||||||
|
|
|
@ -984,7 +984,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
||||||
{
|
{
|
||||||
for(int x = xCoord-1; x <= xCoord+1; x++)
|
for(int x = xCoord-1; x <= xCoord+1; x++)
|
||||||
{
|
{
|
||||||
for(int y = yCoord; y <= yCoord+2; y++)
|
for(int y = yCoord; y <= yCoord+1; y++)
|
||||||
{
|
{
|
||||||
for(int z = zCoord-1; z <= zCoord+1; z++)
|
for(int z = zCoord-1; z <= zCoord+1; z++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -374,7 +374,7 @@ public class TileEntityLogisticalSorter extends TileEntityElectricBlock implemen
|
||||||
|
|
||||||
if(back instanceof IInventory)
|
if(back instanceof IInventory)
|
||||||
{
|
{
|
||||||
return TransporterUtils.canInsert(back, null, stack, ForgeDirection.getOrientation(facing).getOpposite().ordinal(), true);
|
return InventoryUtils.canInsert(back, null, stack, ForgeDirection.getOrientation(facing).getOpposite().ordinal(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -52,7 +52,10 @@ public class TileEntityLogisticalTransporter extends TileEntity implements ITile
|
||||||
{
|
{
|
||||||
for(TransporterStack stack : transit)
|
for(TransporterStack stack : transit)
|
||||||
{
|
{
|
||||||
stack.progress = Math.min(100, stack.progress+SPEED);
|
if(stack != null)
|
||||||
|
{
|
||||||
|
stack.progress = Math.min(100, stack.progress+SPEED);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -143,7 +146,7 @@ public class TileEntityLogisticalTransporter extends TileEntity implements ITile
|
||||||
{
|
{
|
||||||
if(stack.isFinal(this))
|
if(stack.isFinal(this))
|
||||||
{
|
{
|
||||||
if(stack.pathType == Path.DEST && !TransporterUtils.canInsert(stack.getDest().getTileEntity(worldObj), stack.color, stack.itemStack, stack.getSide(this), false))
|
if(stack.pathType == Path.DEST && !InventoryUtils.canInsert(stack.getDest().getTileEntity(worldObj), stack.color, stack.itemStack, stack.getSide(this), false))
|
||||||
{
|
{
|
||||||
if(!recalculate(stack, null))
|
if(!recalculate(stack, null))
|
||||||
{
|
{
|
||||||
|
@ -151,7 +154,7 @@ public class TileEntityLogisticalTransporter extends TileEntity implements ITile
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(stack.pathType == Path.HOME && !TransporterUtils.canInsert(stack.getDest().getTileEntity(worldObj), stack.color, stack.itemStack, stack.getSide(this), true))
|
else if(stack.pathType == Path.HOME && !InventoryUtils.canInsert(stack.getDest().getTileEntity(worldObj), stack.color, stack.itemStack, stack.getSide(this), true))
|
||||||
{
|
{
|
||||||
if(!recalculate(stack, null))
|
if(!recalculate(stack, null))
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,8 +14,7 @@ import mekanism.common.tileentity.TileEntityLogisticalSorter;
|
||||||
import mekanism.common.tileentity.TileEntityLogisticalTransporter;
|
import mekanism.common.tileentity.TileEntityLogisticalTransporter;
|
||||||
import mekanism.common.transporter.TransporterPathfinder.Pathfinder.DestChecker;
|
import mekanism.common.transporter.TransporterPathfinder.Pathfinder.DestChecker;
|
||||||
import mekanism.common.transporter.TransporterStack.Path;
|
import mekanism.common.transporter.TransporterStack.Path;
|
||||||
import mekanism.common.util.TransporterUtils;
|
import mekanism.common.util.InventoryUtils;
|
||||||
import net.minecraft.inventory.IInventory;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
|
@ -213,7 +212,7 @@ public final class TransporterPathfinder
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(TransporterUtils.canInsert(tile, transportStack.color, transportStack.itemStack, side.ordinal(), false))
|
if(InventoryUtils.canInsert(tile, transportStack.color, transportStack.itemStack, side.ordinal(), false))
|
||||||
{
|
{
|
||||||
destsFound.add(Object3D.get(tile));
|
destsFound.add(Object3D.get(tile));
|
||||||
}
|
}
|
||||||
|
@ -240,7 +239,7 @@ public final class TransporterPathfinder
|
||||||
@Override
|
@Override
|
||||||
public boolean isValid(TransporterStack stack, int side, TileEntity tile)
|
public boolean isValid(TransporterStack stack, int side, TileEntity tile)
|
||||||
{
|
{
|
||||||
return TransporterUtils.canInsert(tile, stack.color, stack.itemStack, side, false);
|
return InventoryUtils.canInsert(tile, stack.color, stack.itemStack, side, false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -507,7 +506,7 @@ public final class TransporterPathfinder
|
||||||
@Override
|
@Override
|
||||||
public boolean isValid(TransporterStack stack, int side, TileEntity tile)
|
public boolean isValid(TransporterStack stack, int side, TileEntity tile)
|
||||||
{
|
{
|
||||||
return TransporterUtils.canInsert(tile, stack.color, stack.itemStack, side, true);
|
return InventoryUtils.canInsert(tile, stack.color, stack.itemStack, side, true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package mekanism.common.util;
|
package mekanism.common.util;
|
||||||
|
|
||||||
|
import mekanism.api.EnumColor;
|
||||||
|
import mekanism.api.IConfigurable;
|
||||||
import mekanism.common.tileentity.TileEntityBin;
|
import mekanism.common.tileentity.TileEntityBin;
|
||||||
import mekanism.common.tileentity.TileEntityLogisticalSorter;
|
import mekanism.common.tileentity.TileEntityLogisticalSorter;
|
||||||
import mekanism.common.transporter.InvStack;
|
import mekanism.common.transporter.InvStack;
|
||||||
|
@ -7,6 +9,7 @@ import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.inventory.ISidedInventory;
|
import net.minecraft.inventory.ISidedInventory;
|
||||||
import net.minecraft.inventory.InventoryLargeChest;
|
import net.minecraft.inventory.InventoryLargeChest;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.tileentity.TileEntityChest;
|
import net.minecraft.tileentity.TileEntityChest;
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
|
|
||||||
|
@ -332,4 +335,117 @@ public final class InventoryUtils
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean canInsert(TileEntity tileEntity, EnumColor color, ItemStack itemStack, int side, boolean force)
|
||||||
|
{
|
||||||
|
if(!(tileEntity instanceof IInventory))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(force && tileEntity instanceof TileEntityLogisticalSorter)
|
||||||
|
{
|
||||||
|
return ((TileEntityLogisticalSorter)tileEntity).canSendHome(itemStack);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!force && tileEntity instanceof IConfigurable)
|
||||||
|
{
|
||||||
|
IConfigurable config = (IConfigurable)tileEntity;
|
||||||
|
int tileSide = config.getOrientation();
|
||||||
|
EnumColor configColor = config.getEjector().getInputColor(ForgeDirection.getOrientation(MekanismUtils.getBaseOrientation(side, tileSide)).getOpposite());
|
||||||
|
|
||||||
|
if(config.getEjector().hasStrictInput() && configColor != null && configColor != color)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IInventory inventory = (IInventory)tileEntity;
|
||||||
|
|
||||||
|
if(!(inventory instanceof ISidedInventory))
|
||||||
|
{
|
||||||
|
inventory = InventoryUtils.checkChestInv(inventory);
|
||||||
|
|
||||||
|
for(int i = 0; i <= inventory.getSizeInventory() - 1; i++)
|
||||||
|
{
|
||||||
|
if(!force)
|
||||||
|
{
|
||||||
|
if(!inventory.isItemValidForSlot(i, itemStack))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemStack inSlot = inventory.getStackInSlot(i);
|
||||||
|
|
||||||
|
if(inSlot == null)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if(inSlot.isItemEqual(itemStack) && inSlot.stackSize < inSlot.getMaxStackSize())
|
||||||
|
{
|
||||||
|
if(inSlot.stackSize + itemStack.stackSize <= inSlot.getMaxStackSize())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
int rejects = (inSlot.stackSize + itemStack.stackSize) - inSlot.getMaxStackSize();
|
||||||
|
|
||||||
|
if(rejects < itemStack.stackSize)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ISidedInventory sidedInventory = (ISidedInventory)inventory;
|
||||||
|
int[] slots = sidedInventory.getAccessibleSlotsFromSide(ForgeDirection.getOrientation(side).getOpposite().ordinal());
|
||||||
|
|
||||||
|
if(slots != null && slots.length != 0)
|
||||||
|
{
|
||||||
|
if(force && sidedInventory instanceof TileEntityBin && ForgeDirection.getOrientation(side).getOpposite().ordinal() == 0)
|
||||||
|
{
|
||||||
|
slots = sidedInventory.getAccessibleSlotsFromSide(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int get = 0; get <= slots.length - 1; get++)
|
||||||
|
{
|
||||||
|
int slotID = slots[get];
|
||||||
|
|
||||||
|
if(!force)
|
||||||
|
{
|
||||||
|
if(!sidedInventory.isItemValidForSlot(slotID, itemStack) || !sidedInventory.canInsertItem(slotID, itemStack, ForgeDirection.getOrientation(side).getOpposite().ordinal()))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemStack inSlot = inventory.getStackInSlot(slotID);
|
||||||
|
|
||||||
|
if(inSlot == null)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if(inSlot.isItemEqual(itemStack) && inSlot.stackSize < inSlot.getMaxStackSize())
|
||||||
|
{
|
||||||
|
if(inSlot.stackSize + itemStack.stackSize <= inSlot.getMaxStackSize())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
int rejects = (inSlot.stackSize + itemStack.stackSize) - inSlot.getMaxStackSize();
|
||||||
|
|
||||||
|
if(rejects < itemStack.stackSize)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -200,120 +200,6 @@ public final class TransporterUtils
|
||||||
return tileEntity.insertRR(outputter, itemStack.copy(), color);
|
return tileEntity.insertRR(outputter, itemStack.copy(), color);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean canInsert(TileEntity tileEntity, EnumColor color, ItemStack itemStack, int side, boolean force)
|
|
||||||
{
|
|
||||||
if(!(tileEntity instanceof IInventory))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(force && tileEntity instanceof TileEntityLogisticalSorter)
|
|
||||||
{
|
|
||||||
return ((TileEntityLogisticalSorter)tileEntity).canSendHome(itemStack);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!force && tileEntity instanceof IConfigurable)
|
|
||||||
{
|
|
||||||
IConfigurable config = (IConfigurable)tileEntity;
|
|
||||||
int tileSide = config.getOrientation();
|
|
||||||
EnumColor configColor = config.getEjector().getInputColor(ForgeDirection.getOrientation(MekanismUtils.getBaseOrientation(side, tileSide)).getOpposite());
|
|
||||||
|
|
||||||
if(config.getEjector().hasStrictInput() && configColor != null && configColor != color)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
IInventory inventory = (IInventory)tileEntity;
|
|
||||||
|
|
||||||
if(!(inventory instanceof ISidedInventory))
|
|
||||||
{
|
|
||||||
inventory = InventoryUtils.checkChestInv(inventory);
|
|
||||||
|
|
||||||
for(int i = 0; i <= inventory.getSizeInventory() - 1; i++)
|
|
||||||
{
|
|
||||||
if(!force)
|
|
||||||
{
|
|
||||||
if(!inventory.isItemValidForSlot(i, itemStack))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemStack inSlot = inventory.getStackInSlot(i);
|
|
||||||
|
|
||||||
if(inSlot == null)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if(inSlot.isItemEqual(itemStack) && inSlot.stackSize < inSlot.getMaxStackSize())
|
|
||||||
{
|
|
||||||
if(inSlot.stackSize + itemStack.stackSize <= inSlot.getMaxStackSize())
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
int rejects = (inSlot.stackSize + itemStack.stackSize) - inSlot.getMaxStackSize();
|
|
||||||
|
|
||||||
if(rejects < itemStack.stackSize)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ISidedInventory sidedInventory = (ISidedInventory)inventory;
|
|
||||||
int[] slots = sidedInventory.getAccessibleSlotsFromSide(ForgeDirection.getOrientation(side).getOpposite().ordinal());
|
|
||||||
|
|
||||||
if(slots != null && slots.length != 0)
|
|
||||||
{
|
|
||||||
if(force && sidedInventory instanceof TileEntityBin && ForgeDirection.getOrientation(side).getOpposite().ordinal() == 0)
|
|
||||||
{
|
|
||||||
slots = sidedInventory.getAccessibleSlotsFromSide(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
for(int get = 0; get <= slots.length - 1; get++)
|
|
||||||
{
|
|
||||||
int slotID = slots[get];
|
|
||||||
|
|
||||||
if(!force)
|
|
||||||
{
|
|
||||||
if(!sidedInventory.isItemValidForSlot(slotID, itemStack) || !sidedInventory.canInsertItem(slotID, itemStack, ForgeDirection.getOrientation(side).getOpposite().ordinal()))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemStack inSlot = inventory.getStackInSlot(slotID);
|
|
||||||
|
|
||||||
if(inSlot == null)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if(inSlot.isItemEqual(itemStack) && inSlot.stackSize < inSlot.getMaxStackSize())
|
|
||||||
{
|
|
||||||
if(inSlot.stackSize + itemStack.stackSize <= inSlot.getMaxStackSize())
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
int rejects = (inSlot.stackSize + itemStack.stackSize) - inSlot.getMaxStackSize();
|
|
||||||
|
|
||||||
if(rejects < itemStack.stackSize)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static EnumColor increment(EnumColor color)
|
public static EnumColor increment(EnumColor color)
|
||||||
{
|
{
|
||||||
if(color == null)
|
if(color == null)
|
||||||
|
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"animation": {
|
||||||
|
"frametime": 2
|
||||||
|
}
|
||||||
|
}
|
Before Width: | Height: | Size: 9.7 KiB After Width: | Height: | Size: 9.7 KiB |
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"animation": {
|
||||||
|
"frametime": 2
|
||||||
|
}
|
||||||
|
}
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"animation": {
|
||||||
|
"frametime": 2
|
||||||
|
}
|
||||||
|
}
|
Before Width: | Height: | Size: 4.2 KiB |
|
@ -1,32 +0,0 @@
|
||||||
0*2
|
|
||||||
1*2
|
|
||||||
2*2
|
|
||||||
3*2
|
|
||||||
4*2
|
|
||||||
5*2
|
|
||||||
6*2
|
|
||||||
7*2
|
|
||||||
8*2
|
|
||||||
9*2
|
|
||||||
10*2
|
|
||||||
11*2
|
|
||||||
12*2
|
|
||||||
13*2
|
|
||||||
14*2
|
|
||||||
15*2
|
|
||||||
16*2
|
|
||||||
17*2
|
|
||||||
18*2
|
|
||||||
19*2
|
|
||||||
20*2
|
|
||||||
21*2
|
|
||||||
22*2
|
|
||||||
23*2
|
|
||||||
24*2
|
|
||||||
25*2
|
|
||||||
26*2
|
|
||||||
27*2
|
|
||||||
28*2
|
|
||||||
29*2
|
|
||||||
30*2
|
|
||||||
31*2
|
|
|
@ -1,32 +0,0 @@
|
||||||
0*2
|
|
||||||
1*2
|
|
||||||
2*2
|
|
||||||
3*2
|
|
||||||
4*2
|
|
||||||
5*2
|
|
||||||
6*2
|
|
||||||
7*2
|
|
||||||
8*2
|
|
||||||
9*2
|
|
||||||
10*2
|
|
||||||
11*2
|
|
||||||
12*2
|
|
||||||
13*2
|
|
||||||
14*2
|
|
||||||
15*2
|
|
||||||
16*2
|
|
||||||
17*2
|
|
||||||
18*2
|
|
||||||
19*2
|
|
||||||
20*2
|
|
||||||
21*2
|
|
||||||
22*2
|
|
||||||
23*2
|
|
||||||
24*2
|
|
||||||
25*2
|
|
||||||
26*2
|
|
||||||
27*2
|
|
||||||
28*2
|
|
||||||
29*2
|
|
||||||
30*2
|
|
||||||
31*2
|
|
|
@ -1,32 +0,0 @@
|
||||||
0*2
|
|
||||||
1*2
|
|
||||||
2*2
|
|
||||||
3*2
|
|
||||||
4*2
|
|
||||||
5*2
|
|
||||||
6*2
|
|
||||||
7*2
|
|
||||||
8*2
|
|
||||||
9*2
|
|
||||||
10*2
|
|
||||||
11*2
|
|
||||||
12*2
|
|
||||||
13*2
|
|
||||||
14*2
|
|
||||||
15*2
|
|
||||||
16*2
|
|
||||||
17*2
|
|
||||||
18*2
|
|
||||||
19*2
|
|
||||||
20*2
|
|
||||||
21*2
|
|
||||||
22*2
|
|
||||||
23*2
|
|
||||||
24*2
|
|
||||||
25*2
|
|
||||||
26*2
|
|
||||||
27*2
|
|
||||||
28*2
|
|
||||||
29*2
|
|
||||||
30*2
|
|
||||||
31*2
|
|