use of gregtech.api.capability.impl.FluidHandlerProxy in project GregTech by GregTechCE.
the class MetaTileEntity method initializeInventory.
protected void initializeInventory() {
this.importItems = createImportItemHandler();
this.exportItems = createExportItemHandler();
this.itemInventory = new ItemHandlerProxy(importItems, exportItems);
this.importFluids = createImportFluidHandler();
this.exportFluids = createExportFluidHandler();
this.fluidInventory = new FluidHandlerProxy(importFluids, exportFluids);
}
use of gregtech.api.capability.impl.FluidHandlerProxy in project GregTech by GregTechCE.
the class PlungerBehaviour method onItemUseFirst.
@Override
public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) {
TileEntity tileEntity = world.getTileEntity(pos);
if (tileEntity == null) {
return EnumActionResult.PASS;
}
IFluidHandler fluidHandler = tileEntity.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, side);
if (fluidHandler == null) {
return EnumActionResult.PASS;
}
ItemStack toolStack = player.getHeldItem(hand);
boolean isShiftClick = player.isSneaking();
IFluidHandler handlerToRemoveFrom = isShiftClick ? (fluidHandler instanceof FluidHandlerProxy ? ((FluidHandlerProxy) fluidHandler).input : null) : (fluidHandler instanceof FluidHandlerProxy ? ((FluidHandlerProxy) fluidHandler).output : fluidHandler);
if (handlerToRemoveFrom != null && GTUtility.doDamageItem(toolStack, cost, false)) {
if (!world.isRemote) {
FluidStack drainStack = handlerToRemoveFrom.drain(1000, true);
int amountOfFluid = drainStack == null ? 0 : drainStack.amount;
if (amountOfFluid > 0) {
player.playSound(SoundEvents.ENTITY_SLIME_SQUISH, 1.0f, amountOfFluid / 1000.0f);
}
}
return EnumActionResult.SUCCESS;
}
return EnumActionResult.PASS;
}
use of gregtech.api.capability.impl.FluidHandlerProxy in project GregTech by GregTechCE.
the class MetaTileEntityCokeOvenHatch method addToMultiBlock.
@Override
public void addToMultiBlock(MultiblockControllerBase controllerBase) {
super.addToMultiBlock(controllerBase);
this.fluidInventory = new FluidHandlerProxy(new FluidTankList(false), controllerBase.getExportFluids());
this.itemInventory = new ItemHandlerProxy(controllerBase.getImportItems(), controllerBase.getExportItems());
}
use of gregtech.api.capability.impl.FluidHandlerProxy in project GregTech by GregTechCE.
the class SimpleMachineMetaTileEntity method initializeInventory.
@Override
protected void initializeInventory() {
super.initializeInventory();
this.outputItemInventory = new ItemHandlerProxy(new ItemStackHandler(0), exportItems);
this.outputFluidInventory = new FluidHandlerProxy(new FluidTankList(false), exportFluids);
}
Aggregations