mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-21 20:42:35 +00:00
Allow pipettes to fill a machine or tank in the world
This commit is contained in:
1 parent
a2881fbe1c
commit
da486ee941
2 files changed
+13
-10
No files matched your search
@@ -68,7 +68,8 @@ public class ContainerLiquidTanksHelper<T extends TileEntity & ILiquidTankTile>
|
||||
} else {
|
||||
FluidStack potential = pipette.drain(itemstack, pipette.getCapacity(itemstack), false);
|
||||
if (potential != null) {
|
||||
pipette.drain(itemstack, tank.fill(potential, true), true);
|
||||
int fill = tank.fill(potential, true);
|
||||
pipette.drain(itemstack, fill, true);
|
||||
player.updateHeldItem();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidContainerItem;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -29,21 +30,13 @@ import forestry.api.core.IToolPipette;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.fluids.PipetteContents;
|
||||
|
||||
public class ItemPipette extends ItemForestry implements IToolPipette {
|
||||
public class ItemPipette extends ItemForestry implements IToolPipette, IFluidContainerItem {
|
||||
|
||||
public ItemPipette() {
|
||||
setMaxStackSize(1);
|
||||
setFull3D();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if the item's stackTagCompound needs to be synchronized over SMP.
|
||||
*/
|
||||
@Override
|
||||
public boolean getShareTag() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPipette(ItemStack itemstack) {
|
||||
PipetteContents contained = PipetteContents.create(itemstack);
|
||||
@@ -159,6 +152,15 @@ public class ItemPipette extends ItemForestry implements IToolPipette {
|
||||
return new FluidStack(contained.getContents(), drained);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack getFluid(ItemStack container) {
|
||||
PipetteContents contained = PipetteContents.create(container);
|
||||
if (contained == null) {
|
||||
return null;
|
||||
}
|
||||
return contained.getContents();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCapacity(ItemStack pipette) {
|
||||
return Constants.BUCKET_VOLUME;
|
||||
|
||||
Reference in new issue
Block a user