mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-21 12:42:57 +00:00
Fix JABBA-related issues with crafting station slots (#54)
* Fix shift-merging tools voiding items fixes <https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/11392> * Change 0-sized ItemStacks into null stacks in crafting station attached slots Fixes <https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/10425> * Update buildscript * spotlessApply
This commit is contained in:
1 parent
18bfeaff32
commit
39be06c23b
571 files changed
+25959
-28223
No files matched your search
@@ -10,55 +10,49 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.*;
|
||||
import tconstruct.TConstruct;
|
||||
|
||||
public class FaucetLogic extends TileEntity implements IFacingLogic, IActiveLogic, IFluidHandler
|
||||
{
|
||||
public class FaucetLogic extends TileEntity implements IFacingLogic, IActiveLogic, IFluidHandler {
|
||||
byte direction;
|
||||
boolean active;
|
||||
public FluidStack liquid;
|
||||
public boolean hasRedstonePower = false;
|
||||
|
||||
public boolean activateFaucet ()
|
||||
{
|
||||
if (liquid == null && active)
|
||||
{
|
||||
public boolean activateFaucet() {
|
||||
if (liquid == null && active) {
|
||||
int x = xCoord, z = zCoord;
|
||||
switch (getRenderDirection())
|
||||
{
|
||||
case 2:
|
||||
z++;
|
||||
break;
|
||||
case 3:
|
||||
z--;
|
||||
break;
|
||||
case 4:
|
||||
x++;
|
||||
break;
|
||||
case 5:
|
||||
x--;
|
||||
break;
|
||||
switch (getRenderDirection()) {
|
||||
case 2:
|
||||
z++;
|
||||
break;
|
||||
case 3:
|
||||
z--;
|
||||
break;
|
||||
case 4:
|
||||
x++;
|
||||
break;
|
||||
case 5:
|
||||
x--;
|
||||
break;
|
||||
}
|
||||
|
||||
TileEntity drainte = worldObj.getTileEntity(x, yCoord, z);
|
||||
TileEntity tankte = worldObj.getTileEntity(xCoord, yCoord - 1, zCoord);
|
||||
|
||||
if (drainte != null && drainte instanceof IFluidHandler && tankte != null && tankte instanceof IFluidHandler)
|
||||
{
|
||||
FluidStack templiquid = ((IFluidHandler) drainte).drain(getForgeDirection(), TConstruct.ingotLiquidValue, false);
|
||||
if (templiquid != null)
|
||||
{
|
||||
if (drainte != null
|
||||
&& drainte instanceof IFluidHandler
|
||||
&& tankte != null
|
||||
&& tankte instanceof IFluidHandler) {
|
||||
FluidStack templiquid =
|
||||
((IFluidHandler) drainte).drain(getForgeDirection(), TConstruct.ingotLiquidValue, false);
|
||||
if (templiquid != null) {
|
||||
int drained = ((IFluidHandler) tankte).fill(ForgeDirection.UP, templiquid, false);
|
||||
if (drained > 0)
|
||||
{
|
||||
if (drained > 0) {
|
||||
liquid = ((IFluidHandler) drainte).drain(getForgeDirection(), drained, true);
|
||||
((IFluidHandler) tankte).fill(ForgeDirection.UP, liquid, true);
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -66,16 +60,12 @@ public class FaucetLogic extends TileEntity implements IFacingLogic, IActiveLogi
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity ()
|
||||
{
|
||||
if (liquid != null)
|
||||
{
|
||||
public void updateEntity() {
|
||||
if (liquid != null) {
|
||||
liquid.amount -= TConstruct.liquidUpdateAmount;
|
||||
if (liquid.amount <= 0)
|
||||
{
|
||||
if (liquid.amount <= 0) {
|
||||
liquid = null;
|
||||
if (!activateFaucet())
|
||||
{
|
||||
if (!activateFaucet()) {
|
||||
active = false;
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
@@ -84,33 +74,26 @@ public class FaucetLogic extends TileEntity implements IFacingLogic, IActiveLogi
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte getRenderDirection ()
|
||||
{
|
||||
public byte getRenderDirection() {
|
||||
return direction;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForgeDirection getForgeDirection ()
|
||||
{
|
||||
public ForgeDirection getForgeDirection() {
|
||||
return ForgeDirection.VALID_DIRECTIONS[direction];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDirection (int side)
|
||||
{
|
||||
if (side != 0 && side != 1)
|
||||
{
|
||||
public void setDirection(int side) {
|
||||
if (side != 0 && side != 1) {
|
||||
direction = (byte) side;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
direction = 2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDirection (float yaw, float pitch, EntityLivingBase player)
|
||||
{
|
||||
public void setDirection(float yaw, float pitch, EntityLivingBase player) {
|
||||
/*int facing = MathHelper.floor_double((double) (yaw / 360) + 0.5D) & 3;
|
||||
switch (facing)
|
||||
{
|
||||
@@ -133,36 +116,28 @@ public class FaucetLogic extends TileEntity implements IFacingLogic, IActiveLogi
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT (NBTTagCompound tags)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tags) {
|
||||
super.readFromNBT(tags);
|
||||
readCustomNBT(tags);
|
||||
}
|
||||
|
||||
public void readCustomNBT (NBTTagCompound tags)
|
||||
{
|
||||
public void readCustomNBT(NBTTagCompound tags) {
|
||||
direction = tags.getByte("Direction");
|
||||
if (tags.getBoolean("hasLiquid"))
|
||||
{
|
||||
if (tags.getBoolean("hasLiquid")) {
|
||||
this.liquid = FluidStack.loadFluidStackFromNBT(tags.getCompoundTag("Fluid"));
|
||||
}
|
||||
else
|
||||
this.liquid = null;
|
||||
} else this.liquid = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT (NBTTagCompound tags)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tags) {
|
||||
super.writeToNBT(tags);
|
||||
writeCustomNBT(tags);
|
||||
}
|
||||
|
||||
public void writeCustomNBT (NBTTagCompound tags)
|
||||
{
|
||||
public void writeCustomNBT(NBTTagCompound tags) {
|
||||
tags.setByte("Direction", direction);
|
||||
tags.setBoolean("hasLiquid", liquid != null);
|
||||
if (liquid != null)
|
||||
{
|
||||
if (liquid != null) {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
liquid.writeToNBT(nbt);
|
||||
tags.setTag("Fluid", nbt);
|
||||
@@ -171,79 +146,65 @@ public class FaucetLogic extends TileEntity implements IFacingLogic, IActiveLogi
|
||||
|
||||
/* Packets */
|
||||
@Override
|
||||
public Packet getDescriptionPacket ()
|
||||
{
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
writeCustomNBT(tag);
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket (NetworkManager net, S35PacketUpdateTileEntity packet)
|
||||
{
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) {
|
||||
readCustomNBT(packet.func_148857_g());
|
||||
worldObj.func_147479_m(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getActive ()
|
||||
{
|
||||
public boolean getActive() {
|
||||
return active;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setActive (boolean flag)
|
||||
{
|
||||
if (!active)
|
||||
{
|
||||
public void setActive(boolean flag) {
|
||||
if (!active) {
|
||||
active = true;
|
||||
if (!activateFaucet())
|
||||
active = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!activateFaucet()) active = false;
|
||||
} else {
|
||||
active = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill (ForgeDirection from, FluidStack resource, boolean doFill)
|
||||
{
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain (ForgeDirection from, FluidStack resource, boolean doDrain)
|
||||
{
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain (ForgeDirection from, int maxDrain, boolean doDrain)
|
||||
{
|
||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill (ForgeDirection from, Fluid fluid)
|
||||
{
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain (ForgeDirection from, Fluid fluid)
|
||||
{
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo (ForgeDirection from)
|
||||
{
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user