Fixed Sink + Cleanedup imports
corrected sink item stack lose plus fixed potion to have a volume of 250 when used with my machines. Will take this a step better later to fix it for all mods installed with my mod to correct the volume diffrence.
This commit is contained in:
parent
a7683ab2fd
commit
6c1b16c5f4
35 changed files with 98 additions and 171 deletions
|
@ -1,13 +1,8 @@
|
|||
package liquidmechanics.api.helpers;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.liquids.ILiquidTank;
|
||||
import net.minecraftforge.liquids.ITankContainer;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
|
||||
public class connectionHelper
|
||||
{
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package liquidmechanics.api.liquids;
|
||||
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.liquids.ITankContainer;
|
||||
|
||||
public interface IPressure
|
||||
{
|
||||
|
|
|
@ -2,8 +2,6 @@ package liquidmechanics.api.liquids;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockFlowing;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
|
|
@ -4,7 +4,6 @@ import net.minecraft.block.BlockStationary;
|
|||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.liquids.ILiquid;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
|
|
@ -6,16 +6,13 @@ import java.util.Map;
|
|||
import java.util.Map.Entry;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
|
||||
import liquidmechanics.api.helpers.ColorCode;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.event.ForgeSubscribe;
|
||||
import net.minecraftforge.liquids.LiquidDictionary;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
import net.minecraftforge.liquids.LiquidDictionary.LiquidRegisterEvent;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
|
||||
public class LiquidHandler
|
||||
{
|
||||
|
|
|
@ -1,21 +1,17 @@
|
|||
package liquidmechanics.client.gui;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ContainerRepair;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiReleaseValve extends GuiContainer
|
||||
{
|
||||
|
|
|
@ -8,7 +8,6 @@ package liquidmechanics.client.model;
|
|||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class ModelPump extends ModelBase
|
||||
{
|
||||
|
|
|
@ -8,8 +8,6 @@ package liquidmechanics.client.model;
|
|||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public class ModelReleaseValve extends ModelBase
|
||||
{
|
||||
|
|
|
@ -8,7 +8,6 @@ package liquidmechanics.client.model;
|
|||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class ModelSink extends ModelBase
|
||||
{
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package liquidmechanics.client.render;
|
||||
|
||||
import liquidmechanics.api.helpers.connectionHelper;
|
||||
import liquidmechanics.client.model.ModelGearRod;
|
||||
import liquidmechanics.client.model.ModelGenerator;
|
||||
import liquidmechanics.client.model.ModelLargePipe;
|
||||
|
@ -9,11 +8,9 @@ import liquidmechanics.client.model.ModelPump;
|
|||
import liquidmechanics.client.model.ModelReleaseValve;
|
||||
import liquidmechanics.client.model.ModelSink;
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import liquidmechanics.common.tileentity.TileEntityReleaseValve;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
|
|
|
@ -4,13 +4,11 @@ import liquidmechanics.client.model.ModelGearRod;
|
|||
import liquidmechanics.client.model.ModelGenerator;
|
||||
import liquidmechanics.client.model.ModelLargePipe;
|
||||
import liquidmechanics.client.model.ModelLiquidTank;
|
||||
import liquidmechanics.client.model.ModelPump;
|
||||
import liquidmechanics.client.model.ModelReleaseValve;
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package liquidmechanics.client.render;
|
||||
|
||||
import liquidmechanics.api.liquids.LiquidData;
|
||||
import liquidmechanics.api.liquids.LiquidHandler;
|
||||
import liquidmechanics.client.model.ModelPump;
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import liquidmechanics.common.tileentity.TileEntityPump;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package liquidmechanics.client.render;
|
||||
|
||||
import liquidmechanics.api.helpers.ColorCode;
|
||||
import liquidmechanics.api.helpers.connectionHelper;
|
||||
import liquidmechanics.client.model.ModelLargePipe;
|
||||
import liquidmechanics.client.model.ModelReleaseValve;
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package liquidmechanics.client.render;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public class RenderRotation
|
||||
{
|
||||
|
|
|
@ -3,12 +3,8 @@ package liquidmechanics.client.render;
|
|||
import liquidmechanics.client.model.ModelSink;
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import liquidmechanics.common.tileentity.TileEntitySink;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
import net.minecraftforge.liquids.LiquidContainerRegistry;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
|
|
@ -2,8 +2,6 @@ package liquidmechanics.client.render;
|
|||
|
||||
import liquidmechanics.api.helpers.ColorCode;
|
||||
import liquidmechanics.api.helpers.connectionHelper;
|
||||
import liquidmechanics.api.liquids.LiquidData;
|
||||
import liquidmechanics.api.liquids.LiquidHandler;
|
||||
import liquidmechanics.client.model.ModelLiquidTank;
|
||||
import liquidmechanics.client.model.ModelLiquidTankCorner;
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
|
|
|
@ -4,11 +4,10 @@ import java.io.File;
|
|||
import java.util.logging.Logger;
|
||||
|
||||
import liquidmechanics.api.helpers.ColorCode;
|
||||
import liquidmechanics.api.liquids.LiquidData;
|
||||
import liquidmechanics.api.liquids.LiquidHandler;
|
||||
import liquidmechanics.common.block.BlockGenerator;
|
||||
import liquidmechanics.common.block.BlockPumpMachine;
|
||||
import liquidmechanics.common.block.BlockPipe;
|
||||
import liquidmechanics.common.block.BlockPumpMachine;
|
||||
import liquidmechanics.common.block.BlockReleaseValve;
|
||||
import liquidmechanics.common.block.BlockRod;
|
||||
import liquidmechanics.common.block.BlockSink;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package liquidmechanics.common;
|
||||
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public class MetaGroup
|
||||
{
|
||||
|
|
|
@ -6,7 +6,6 @@ import liquidmechanics.client.render.BlockRenderHelper;
|
|||
import liquidmechanics.common.LiquidMechanics;
|
||||
import liquidmechanics.common.TabLiquidMechanics;
|
||||
import liquidmechanics.common.tileentity.TileEntityGenerator;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
package liquidmechanics.common.block;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import liquidmechanics.api.helpers.ColorCode;
|
||||
import liquidmechanics.client.render.BlockRenderHelper;
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import liquidmechanics.common.TabLiquidMechanics;
|
||||
import liquidmechanics.common.tileentity.TileEntityPipe;
|
||||
|
@ -14,8 +11,6 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
import universalelectricity.prefab.BlockMachine;
|
||||
|
||||
public class BlockPipe extends BlockMachine
|
||||
|
|
|
@ -2,16 +2,11 @@ package liquidmechanics.common.block;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import universalelectricity.prefab.BlockMachine;
|
||||
import universalelectricity.prefab.tile.TileEntityAdvanced;
|
||||
import liquidmechanics.api.liquids.LiquidHandler;
|
||||
import liquidmechanics.client.render.BlockRenderHelper;
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import liquidmechanics.common.MetaGroup;
|
||||
import liquidmechanics.common.TabLiquidMechanics;
|
||||
import liquidmechanics.common.tileentity.TileEntityPump;
|
||||
import liquidmechanics.common.tileentity.TileEntityTank;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
|
@ -21,9 +16,8 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.liquids.LiquidContainerRegistry;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
import universalelectricity.prefab.BlockMachine;
|
||||
import universalelectricity.prefab.tile.TileEntityAdvanced;
|
||||
|
||||
public class BlockPumpMachine extends BlockMachine
|
||||
{
|
||||
|
|
|
@ -2,12 +2,9 @@ package liquidmechanics.common.block;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import liquidmechanics.client.render.BlockRenderHelper;
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import liquidmechanics.common.TabLiquidMechanics;
|
||||
import liquidmechanics.common.tileentity.TileEntityReleaseValve;
|
||||
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
|
|
@ -1,17 +1,13 @@
|
|||
package liquidmechanics.common.block;
|
||||
|
||||
import universalelectricity.prefab.BlockMachine;
|
||||
import universalelectricity.prefab.tile.TileEntityAdvanced;
|
||||
import liquidmechanics.api.liquids.LiquidHandler;
|
||||
import liquidmechanics.client.render.BlockRenderHelper;
|
||||
import liquidmechanics.common.MetaGroup;
|
||||
import liquidmechanics.common.TabLiquidMechanics;
|
||||
import liquidmechanics.common.tileentity.TileEntitySink;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.EnumArmorMaterial;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
|
@ -20,11 +16,11 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldProvider;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.liquids.ILiquidTank;
|
||||
import net.minecraftforge.liquids.LiquidContainerRegistry;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
import universalelectricity.prefab.BlockMachine;
|
||||
import universalelectricity.prefab.tile.TileEntityAdvanced;
|
||||
|
||||
public class BlockSink extends BlockMachine
|
||||
{
|
||||
|
@ -42,71 +38,88 @@ public class BlockSink extends BlockMachine
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onMachineActivated(World world, int x, int y, int z, EntityPlayer player, int side, float sx, float sy, float sz)
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (world.isRemote)
|
||||
if (entityplayer.isSneaking()) { return false; }
|
||||
ItemStack current = entityplayer.inventory.getCurrentItem();
|
||||
if (current != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ItemStack heldItem = player.inventory.getCurrentItem();
|
||||
TileEntity ent = world.getBlockTileEntity(x, y, z);
|
||||
ForgeDirection facing = ForgeDirection.getOrientation(side);
|
||||
if (heldItem == null || !(ent instanceof TileEntitySink))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
TileEntitySink sink = (TileEntitySink) ent;
|
||||
LiquidStack stack = sink.getStack();
|
||||
|
||||
if (heldItem.itemID == Item.bucketWater.itemID && stack != null && stack.amount < sink.getTanks(facing)[0].getCapacity())
|
||||
LiquidStack liquid = LiquidContainerRegistry.getLiquidForFilledItem(current);
|
||||
|
||||
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity instanceof TileEntitySink)
|
||||
{
|
||||
TileEntitySink tank = (TileEntitySink) tileEntity;
|
||||
|
||||
// Handle filled containers
|
||||
if (liquid != null)
|
||||
{
|
||||
int f = sink.fill(facing, LiquidContainerRegistry.getLiquidForFilledItem(heldItem), false);
|
||||
if (f >= (LiquidContainerRegistry.BUCKET_VOLUME / 2))
|
||||
if (current.isItemEqual(new ItemStack(Item.potion)))
|
||||
{
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
liquid = new LiquidStack(liquid.itemID, (LiquidContainerRegistry.BUCKET_VOLUME / 4), liquid.itemMeta);
|
||||
}
|
||||
int filled = tank.fill(ForgeDirection.UNKNOWN, liquid, true);
|
||||
|
||||
if (filled != 0 && !entityplayer.capabilities.isCreativeMode)
|
||||
{
|
||||
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, LiquidHandler.consumeItem(current));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
// Handle empty containers
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (current.getItem() instanceof ItemArmor && ((ItemArmor) current.getItem()).getArmorMaterial() == EnumArmorMaterial.CLOTH)
|
||||
{
|
||||
ItemArmor var13 = (ItemArmor) current.getItem();
|
||||
var13.removeColor(current);
|
||||
return true;
|
||||
}
|
||||
LiquidStack stack = tank.getStack();
|
||||
if (stack != null)
|
||||
{
|
||||
ItemStack liquidItem = LiquidContainerRegistry.fillLiquidContainer(stack, current);
|
||||
|
||||
liquid = LiquidContainerRegistry.getLiquidForFilledItem(liquidItem);
|
||||
|
||||
if (liquid != null)
|
||||
{
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, new ItemStack(Item.bucketEmpty));
|
||||
if (!entityplayer.capabilities.isCreativeMode)
|
||||
{
|
||||
if (current.stackSize > 1)
|
||||
{
|
||||
if (!entityplayer.inventory.addItemStackToInventory(liquidItem)) return false;
|
||||
else
|
||||
{
|
||||
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, LiquidHandler.consumeItem(current));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, LiquidHandler.consumeItem(current));
|
||||
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, liquidItem);
|
||||
}
|
||||
}
|
||||
int ammount = liquid.amount;
|
||||
if (current.isItemEqual(new ItemStack(Item.glassBottle)))
|
||||
{
|
||||
ammount = (LiquidContainerRegistry.BUCKET_VOLUME / 4);
|
||||
}
|
||||
tank.drain(null, ammount, true);
|
||||
return true;
|
||||
}
|
||||
sink.fill(facing, LiquidContainerRegistry.getLiquidForFilledItem(heldItem), true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else if (heldItem.itemID == Item.glassBottle.itemID && sink.drain(side, LiquidContainerRegistry.BUCKET_VOLUME, false).amount > (LiquidContainerRegistry.BUCKET_VOLUME / 4))
|
||||
{
|
||||
sink.drain(side, (LiquidContainerRegistry.BUCKET_VOLUME / 4), true);
|
||||
ItemStack var12 = new ItemStack(Item.potion, 1, 0);
|
||||
|
||||
if (!player.inventory.addItemStackToInventory(var12))
|
||||
{
|
||||
world.spawnEntityInWorld(new EntityItem(world, (double) x + 0.5D, (double) y + 1.5D, (double) z + 0.5D, var12));
|
||||
}
|
||||
else if (player instanceof EntityPlayerMP)
|
||||
{
|
||||
((EntityPlayerMP) player).sendContainerToPlayer(player.inventoryContainer);
|
||||
}
|
||||
|
||||
--heldItem.stackSize;
|
||||
|
||||
if (heldItem.stackSize <= 0)
|
||||
{
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, (ItemStack) null);
|
||||
}
|
||||
}
|
||||
else if (heldItem.getItem() instanceof ItemArmor && ((ItemArmor) heldItem.getItem()).getArmorMaterial() == EnumArmorMaterial.CLOTH)
|
||||
{
|
||||
ItemArmor var13 = (ItemArmor) heldItem.getItem();
|
||||
var13.removeColor(heldItem);
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -4,13 +4,12 @@ import java.util.List;
|
|||
|
||||
import liquidmechanics.api.liquids.LiquidHandler;
|
||||
import liquidmechanics.client.render.BlockRenderHelper;
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import liquidmechanics.common.TabLiquidMechanics;
|
||||
import liquidmechanics.common.tileentity.TileEntityPump;
|
||||
import liquidmechanics.common.tileentity.TileEntityTank;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
|
@ -53,9 +52,11 @@ public class BlockTank extends BlockMachine
|
|||
{
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (entityplayer.isSneaking()) { return false; }
|
||||
ItemStack current = entityplayer.inventory.getCurrentItem();
|
||||
if (current != null)
|
||||
{
|
||||
|
@ -71,6 +72,10 @@ public class BlockTank extends BlockMachine
|
|||
// Handle filled containers
|
||||
if (liquid != null)
|
||||
{
|
||||
if (current.isItemEqual(new ItemStack(Item.potion)))
|
||||
{
|
||||
liquid = new LiquidStack(liquid.itemID, (LiquidContainerRegistry.BUCKET_VOLUME / 4), liquid.itemMeta);
|
||||
}
|
||||
int filled = tank.fill(ForgeDirection.UNKNOWN, liquid, true);
|
||||
|
||||
if (filled != 0 && !entityplayer.capabilities.isCreativeMode)
|
||||
|
@ -110,7 +115,12 @@ public class BlockTank extends BlockMachine
|
|||
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, liquidItem);
|
||||
}
|
||||
}
|
||||
tank.drain(null, liquid.amount, true);
|
||||
int ammount = liquid.amount;
|
||||
if (current.isItemEqual(new ItemStack(Item.glassBottle)))
|
||||
{
|
||||
ammount = (LiquidContainerRegistry.BUCKET_VOLUME / 4);
|
||||
}
|
||||
tank.drain(null, ammount, true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -136,9 +146,10 @@ public class BlockTank extends BlockMachine
|
|||
return new ItemStack(this, 1, meta);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
{
|
||||
par3List.add(new ItemStack(par1, 1, 1));
|
||||
par3List.add(new ItemStack(par1, 1, 4));
|
||||
par3List.add(new ItemStack(par1, 1, 13));
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package liquidmechanics.common.handlers;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import liquidmechanics.api.helpers.ColorCode;
|
||||
import liquidmechanics.api.liquids.LiquidHandler;
|
||||
import liquidmechanics.common.tileentity.TileEntityPipe;
|
||||
import liquidmechanics.common.tileentity.TileEntityTank;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
/**
|
||||
* used to help convert older system to newer systems.
|
||||
|
|
|
@ -5,7 +5,6 @@ import java.util.List;
|
|||
import liquidmechanics.api.IReadOut;
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import liquidmechanics.common.TabLiquidMechanics;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
|
|
|
@ -4,7 +4,6 @@ import java.util.List;
|
|||
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import liquidmechanics.common.TabLiquidMechanics;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
|
|
@ -4,7 +4,6 @@ import java.util.List;
|
|||
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import liquidmechanics.common.TabLiquidMechanics;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
package liquidmechanics.common.tileentity;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.inventory.SlotFurnace;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerReleaseValve extends Container
|
||||
|
|
|
@ -8,7 +8,6 @@ import liquidmechanics.api.mech.IForce;
|
|||
import liquidmechanics.common.LiquidMechanics;
|
||||
import liquidmechanics.common.MetaGroup;
|
||||
import liquidmechanics.common.block.BlockGenerator;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
|
|
|
@ -2,38 +2,23 @@ package liquidmechanics.common.tileentity;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import liquidmechanics.api.IColorCoded;
|
||||
import liquidmechanics.api.IPipe;
|
||||
import liquidmechanics.api.IReadOut;
|
||||
import liquidmechanics.api.helpers.ColorCode;
|
||||
import liquidmechanics.api.helpers.connectionHelper;
|
||||
import liquidmechanics.api.liquids.IPressure;
|
||||
import liquidmechanics.api.liquids.LiquidData;
|
||||
import liquidmechanics.api.liquids.LiquidHandler;
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import liquidmechanics.common.handlers.UpdateConverter;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.liquids.ILiquidTank;
|
||||
import net.minecraftforge.liquids.ITankContainer;
|
||||
import net.minecraftforge.liquids.LiquidContainerRegistry;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
import net.minecraftforge.liquids.LiquidTank;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
import universalelectricity.prefab.network.IPacketReceiver;
|
||||
import universalelectricity.prefab.network.PacketManager;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
|
||||
public class TileEntityPipe extends TileEntity implements ITankContainer, IReadOut, IPipe
|
||||
{
|
||||
|
|
|
@ -9,22 +9,16 @@ import liquidmechanics.api.liquids.LiquidData;
|
|||
import liquidmechanics.api.liquids.LiquidHandler;
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import liquidmechanics.common.MetaGroup;
|
||||
import liquidmechanics.common.handlers.UpdateConverter;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.liquids.ILiquidTank;
|
||||
import net.minecraftforge.liquids.ITankContainer;
|
||||
import net.minecraftforge.liquids.LiquidContainerData;
|
||||
import net.minecraftforge.liquids.LiquidContainerRegistry;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
import net.minecraftforge.liquids.LiquidTank;
|
||||
import universalelectricity.core.electricity.ElectricityConnections;
|
||||
import universalelectricity.core.electricity.ElectricityNetwork;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
package liquidmechanics.common.tileentity;
|
||||
|
||||
import java.nio.channels.Pipe;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
|
||||
import liquidmechanics.api.IColorCoded;
|
||||
import liquidmechanics.api.IReadOut;
|
||||
import liquidmechanics.api.helpers.ColorCode;
|
||||
|
@ -23,9 +19,7 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.liquids.ILiquidTank;
|
||||
import net.minecraftforge.liquids.ITankContainer;
|
||||
import net.minecraftforge.liquids.LiquidContainerRegistry;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
import net.minecraftforge.liquids.LiquidTank;
|
||||
import universalelectricity.prefab.implement.IRedstoneReceptor;
|
||||
|
||||
public class TileEntityReleaseValve extends TileEntity implements IPressure, IReadOut, IRedstoneReceptor, IInventory
|
||||
|
|
|
@ -1,16 +1,9 @@
|
|||
package liquidmechanics.common.tileentity;
|
||||
|
||||
import javax.swing.colorchooser.ColorSelectionModel;
|
||||
|
||||
import liquidmechanics.api.IColorCoded;
|
||||
import liquidmechanics.api.IReadOut;
|
||||
import liquidmechanics.api.helpers.ColorCode;
|
||||
import liquidmechanics.api.helpers.connectionHelper;
|
||||
import liquidmechanics.api.liquids.IPressure;
|
||||
import liquidmechanics.api.liquids.LiquidData;
|
||||
import liquidmechanics.api.liquids.LiquidHandler;
|
||||
import liquidmechanics.common.LiquidMechanics;
|
||||
import liquidmechanics.common.handlers.UpdateConverter;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package liquidmechanics.common.tileentity;
|
||||
|
||||
import javax.swing.colorchooser.ColorSelectionModel;
|
||||
|
||||
import liquidmechanics.api.IColorCoded;
|
||||
import liquidmechanics.api.IReadOut;
|
||||
import liquidmechanics.api.helpers.ColorCode;
|
||||
|
|
Loading…
Reference in a new issue