Search in sources :

Example 1 with FluidTankTileEntity

use of com.simibubi.create.content.contraptions.fluids.tank.FluidTankTileEntity in project Create by Creators-of-Create.

the class Contraption method getTileEntityNBT.

@Nullable
protected CompoundTag getTileEntityNBT(Level world, BlockPos pos) {
    BlockEntity tileentity = world.getBlockEntity(pos);
    if (tileentity == null)
        return null;
    CompoundTag nbt = tileentity.saveWithFullMetadata();
    nbt.remove("x");
    nbt.remove("y");
    nbt.remove("z");
    if ((tileentity instanceof FluidTankTileEntity || tileentity instanceof ItemVaultTileEntity) && nbt.contains("Controller"))
        nbt.put("Controller", NbtUtils.writeBlockPos(toLocalPos(NbtUtils.readBlockPos(nbt.getCompound("Controller")))));
    return nbt;
}
Also used : FluidTankTileEntity(com.simibubi.create.content.contraptions.fluids.tank.FluidTankTileEntity) ItemVaultTileEntity(com.simibubi.create.content.logistics.block.vault.ItemVaultTileEntity) CompoundTag(net.minecraft.nbt.CompoundTag) BlockEntity(net.minecraft.world.level.block.entity.BlockEntity) Nullable(javax.annotation.Nullable)

Example 2 with FluidTankTileEntity

use of com.simibubi.create.content.contraptions.fluids.tank.FluidTankTileEntity in project Create by Creators-of-Create.

the class MountedFluidStorage method tick.

public void tick(Entity entity, BlockPos pos, boolean isRemote) {
    if (!isRemote) {
        if (packetCooldown > 0)
            packetCooldown--;
        else if (sendPacket) {
            sendPacket = false;
            AllPackets.channel.send(PacketDistributor.TRACKING_ENTITY.with(() -> entity), new ContraptionFluidPacket(entity.getId(), pos, tank.getFluid()));
            packetCooldown = 8;
        }
        return;
    }
    if (!(te instanceof FluidTankTileEntity))
        return;
    FluidTankTileEntity tank = (FluidTankTileEntity) te;
    tank.getFluidLevel().tick();
}
Also used : ContraptionFluidPacket(com.simibubi.create.content.contraptions.components.structureMovement.sync.ContraptionFluidPacket) CreativeFluidTankTileEntity(com.simibubi.create.content.contraptions.fluids.tank.CreativeFluidTankTileEntity) FluidTankTileEntity(com.simibubi.create.content.contraptions.fluids.tank.FluidTankTileEntity)

Example 3 with FluidTankTileEntity

use of com.simibubi.create.content.contraptions.fluids.tank.FluidTankTileEntity in project Create by Creators-of-Create.

the class FluidMovementActorScenes method transfer.

public static void transfer(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("portable_fluid_interface", "Contraption Fluid Exchange");
    scene.configureBasePlate(0, 0, 6);
    scene.scaleSceneView(0.95f);
    scene.setSceneOffsetY(-1);
    scene.showBasePlate();
    scene.idle(5);
    Selection pipes = util.select.fromTo(2, 1, 3, 0, 1, 3).add(util.select.position(0, 1, 4));
    BlockPos pumpPos = util.grid.at(0, 1, 4);
    Selection kinetics = util.select.fromTo(1, 1, 7, 1, 1, 4);
    Selection tank = util.select.fromTo(0, 1, 5, 0, 3, 5);
    Selection largeCog = util.select.position(2, 0, 7);
    FluidStack chocolate = new FluidStack(FluidHelper.convertToStill(AllFluids.CHOCOLATE.get()), 1000);
    BlockPos ct1 = util.grid.at(5, 3, 2);
    BlockPos ct2 = util.grid.at(6, 3, 2);
    BlockPos st = util.grid.at(0, 1, 5);
    Capability<IFluidHandler> fhc = CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY;
    Class<FluidTankTileEntity> type = FluidTankTileEntity.class;
    ItemStack bucket = AllFluids.CHOCOLATE.get().getAttributes().getBucket(chocolate);
    scene.world.modifyTileEntity(st, type, te -> te.getCapability(fhc).ifPresent(ifh -> ifh.fill(FluidHelper.copyStackWithAmount(chocolate, 10000), FluidAction.EXECUTE)));
    BlockPos bearing = util.grid.at(5, 1, 2);
    scene.world.showSection(util.select.position(bearing), Direction.DOWN);
    scene.idle(5);
    ElementLink<WorldSectionElement> contraption = scene.world.showIndependentSection(util.select.fromTo(5, 2, 2, 6, 4, 2), Direction.DOWN);
    scene.world.configureCenterOfRotation(contraption, util.vector.centerOf(bearing));
    scene.idle(10);
    scene.world.rotateBearing(bearing, 360, 70);
    scene.world.rotateSection(contraption, 0, 360, 0, 70);
    scene.overlay.showText(60).pointAt(util.vector.topOf(bearing.above(2))).colored(PonderPalette.RED).placeNearTarget().attachKeyFrame().text("Fluid Tanks on moving contraptions cannot be accessed by any pipes");
    scene.idle(70);
    BlockPos psi = util.grid.at(4, 2, 2);
    scene.world.showSectionAndMerge(util.select.position(psi), Direction.EAST, contraption);
    scene.idle(13);
    scene.effects.superGlue(psi, Direction.EAST, true);
    scene.overlay.showText(80).pointAt(util.vector.topOf(psi)).colored(PonderPalette.GREEN).placeNearTarget().attachKeyFrame().text("This component can interact with fluid tanks without the need to stop the contraption");
    scene.idle(90);
    BlockPos psi2 = psi.west(2);
    scene.world.showSection(util.select.position(psi2), Direction.DOWN);
    scene.overlay.showSelectionWithText(util.select.position(psi.west()), 50).colored(PonderPalette.RED).placeNearTarget().attachKeyFrame().text("Place a second one with a gap of 1 or 2 blocks inbetween");
    scene.idle(55);
    scene.world.rotateBearing(bearing, 360, 60);
    scene.world.rotateSection(contraption, 0, 360, 0, 60);
    scene.idle(20);
    scene.overlay.showText(40).placeNearTarget().pointAt(util.vector.of(3, 3, 2.5)).text("Whenever they pass by each other, they will engage in a connection");
    scene.idle(35);
    Selection both = util.select.fromTo(2, 2, 2, 4, 2, 2);
    Class<PortableFluidInterfaceTileEntity> psiClass = PortableFluidInterfaceTileEntity.class;
    scene.world.modifyTileNBT(both, psiClass, nbt -> {
        nbt.putFloat("Distance", 1);
        nbt.putFloat("Timer", 40);
    });
    scene.idle(20);
    scene.overlay.showOutline(PonderPalette.GREEN, psi, util.select.fromTo(5, 3, 2, 6, 4, 2), 80);
    scene.idle(10);
    scene.overlay.showSelectionWithText(util.select.position(psi2), 70).placeNearTarget().colored(PonderPalette.GREEN).attachKeyFrame().text("While engaged, the stationary interface will represent ALL Tanks on the contraption");
    scene.idle(80);
    ElementLink<WorldSectionElement> p = scene.world.showIndependentSection(tank, Direction.DOWN);
    scene.world.moveSection(p, util.vector.of(0, 0, -1), 0);
    scene.idle(5);
    scene.world.showSectionAndMerge(pipes, Direction.EAST, p);
    scene.idle(5);
    scene.world.showSectionAndMerge(largeCog, Direction.UP, p);
    scene.world.showSectionAndMerge(kinetics, Direction.NORTH, p);
    scene.idle(10);
    scene.overlay.showText(70).placeNearTarget().pointAt(util.vector.topOf(pumpPos)).attachKeyFrame().text("Fluid can now be inserted...");
    scene.idle(30);
    for (int i = 0; i < 16; i++) {
        if (i == 8)
            scene.overlay.showControls(new InputWindowElement(util.vector.blockSurface(util.grid.at(5, 3, 2), Direction.WEST).add(0, 0.5, 0), Pointing.LEFT).withItem(bucket), 30);
        scene.world.modifyTileEntity(st, type, te -> te.getCapability(fhc).ifPresent(ifh -> ifh.drain(1000, FluidAction.EXECUTE)));
        scene.world.modifyTileEntity(ct1, type, te -> te.getCapability(fhc).ifPresent(ifh -> ifh.fill(chocolate, FluidAction.EXECUTE)));
        scene.idle(2);
    }
    for (int i = 0; i < 8; i++) {
        scene.world.modifyTileEntity(st, type, te -> te.getCapability(fhc).ifPresent(ifh -> ifh.drain(1000, FluidAction.EXECUTE)));
        scene.world.modifyTileEntity(ct2, type, te -> te.getCapability(fhc).ifPresent(ifh -> ifh.fill(chocolate, FluidAction.EXECUTE)));
        scene.idle(2);
    }
    scene.idle(50);
    scene.overlay.showText(40).placeNearTarget().pointAt(util.vector.topOf(pumpPos)).text("...or extracted from the contraption");
    scene.world.multiplyKineticSpeed(util.select.everywhere(), -1);
    scene.world.propagatePipeChange(pumpPos);
    scene.idle(30);
    for (int i = 0; i < 8; i++) {
        scene.world.modifyTileEntity(ct2, type, te -> te.getCapability(fhc).ifPresent(ifh -> ifh.drain(1000, FluidAction.EXECUTE)));
        scene.world.modifyTileEntity(st, type, te -> te.getCapability(fhc).ifPresent(ifh -> ifh.fill(chocolate, FluidAction.EXECUTE)));
        scene.idle(2);
    }
    for (int i = 0; i < 16; i++) {
        scene.world.modifyTileEntity(ct1, type, te -> te.getCapability(fhc).ifPresent(ifh -> ifh.drain(1000, FluidAction.EXECUTE)));
        scene.world.modifyTileEntity(st, type, te -> te.getCapability(fhc).ifPresent(ifh -> ifh.fill(chocolate, FluidAction.EXECUTE)));
        scene.idle(2);
    }
    scene.world.modifyTileEntity(util.grid.at(2, 2, 3), type, te -> te.getCapability(fhc).ifPresent(ifh -> ifh.drain(8000, FluidAction.EXECUTE)));
    scene.idle(50);
    scene.overlay.showText(120).placeNearTarget().attachKeyFrame().pointAt(util.vector.topOf(psi2)).text("After no contents have been exchanged for a while, the contraption will continue on its way");
    scene.world.modifyTileNBT(both, psiClass, nbt -> nbt.putFloat("Timer", 9));
    scene.idle(15);
    scene.markAsFinished();
    scene.world.rotateBearing(bearing, 270, 120);
    scene.world.rotateSection(contraption, 0, 270, 0, 120);
}
Also used : AllFluids(com.simibubi.create.AllFluids) IFluidHandler(net.minecraftforge.fluids.capability.IFluidHandler) Selection(com.simibubi.create.foundation.ponder.Selection) SceneBuilder(com.simibubi.create.foundation.ponder.SceneBuilder) CapabilityFluidHandler(net.minecraftforge.fluids.capability.CapabilityFluidHandler) InputWindowElement(com.simibubi.create.foundation.ponder.element.InputWindowElement) Direction(net.minecraft.core.Direction) FluidAction(net.minecraftforge.fluids.capability.IFluidHandler.FluidAction) SceneBuildingUtil(com.simibubi.create.foundation.ponder.SceneBuildingUtil) Pointing(com.simibubi.create.foundation.utility.Pointing) FluidHelper(com.simibubi.create.foundation.fluid.FluidHelper) Capability(net.minecraftforge.common.capabilities.Capability) WorldSectionElement(com.simibubi.create.foundation.ponder.element.WorldSectionElement) ElementLink(com.simibubi.create.foundation.ponder.ElementLink) PonderPalette(com.simibubi.create.foundation.ponder.PonderPalette) BlockPos(net.minecraft.core.BlockPos) FluidStack(net.minecraftforge.fluids.FluidStack) FluidTankTileEntity(com.simibubi.create.content.contraptions.fluids.tank.FluidTankTileEntity) ItemStack(net.minecraft.world.item.ItemStack) PortableFluidInterfaceTileEntity(com.simibubi.create.content.contraptions.components.actors.PortableFluidInterfaceTileEntity) FluidTankTileEntity(com.simibubi.create.content.contraptions.fluids.tank.FluidTankTileEntity) Selection(com.simibubi.create.foundation.ponder.Selection) FluidStack(net.minecraftforge.fluids.FluidStack) PortableFluidInterfaceTileEntity(com.simibubi.create.content.contraptions.components.actors.PortableFluidInterfaceTileEntity) WorldSectionElement(com.simibubi.create.foundation.ponder.element.WorldSectionElement) IFluidHandler(net.minecraftforge.fluids.capability.IFluidHandler) InputWindowElement(com.simibubi.create.foundation.ponder.element.InputWindowElement) BlockPos(net.minecraft.core.BlockPos) ItemStack(net.minecraft.world.item.ItemStack)

Example 4 with FluidTankTileEntity

use of com.simibubi.create.content.contraptions.fluids.tank.FluidTankTileEntity in project Create by Creators-of-Create.

the class Contraption method readNBT.

public void readNBT(Level world, CompoundTag nbt, boolean spawnData) {
    blocks.clear();
    presentTileEntities.clear();
    specialRenderedTileEntities.clear();
    Tag blocks = nbt.get("Blocks");
    // used to differentiate between the 'old' and the paletted serialization
    boolean usePalettedDeserialization = blocks != null && blocks.getId() == 10 && ((CompoundTag) blocks).contains("Palette");
    readBlocksCompound(blocks, world, usePalettedDeserialization);
    actors.clear();
    nbt.getList("Actors", 10).forEach(c -> {
        CompoundTag comp = (CompoundTag) c;
        StructureBlockInfo info = this.blocks.get(NbtUtils.readBlockPos(comp.getCompound("Pos")));
        MovementContext context = MovementContext.readNBT(world, info, comp, this);
        getActors().add(MutablePair.of(info, context));
    });
    superglue.clear();
    NBTHelper.iterateCompoundList(nbt.getList("Superglue", Tag.TAG_COMPOUND), c -> superglue.add(Pair.of(NbtUtils.readBlockPos(c.getCompound("Pos")), Direction.from3DDataValue(c.getByte("Direction")))));
    seats.clear();
    NBTHelper.iterateCompoundList(nbt.getList("Seats", Tag.TAG_COMPOUND), c -> seats.add(NbtUtils.readBlockPos(c)));
    seatMapping.clear();
    NBTHelper.iterateCompoundList(nbt.getList("Passengers", Tag.TAG_COMPOUND), c -> seatMapping.put(NbtUtils.loadUUID(NBTHelper.getINBT(c, "Id")), c.getInt("Seat")));
    stabilizedSubContraptions.clear();
    NBTHelper.iterateCompoundList(nbt.getList("SubContraptions", Tag.TAG_COMPOUND), c -> stabilizedSubContraptions.put(c.getUUID("Id"), BlockFace.fromNBT(c.getCompound("Location"))));
    storage.clear();
    NBTHelper.iterateCompoundList(nbt.getList("Storage", Tag.TAG_COMPOUND), c -> storage.put(NbtUtils.readBlockPos(c.getCompound("Pos")), MountedStorage.deserialize(c.getCompound("Data"))));
    fluidStorage.clear();
    NBTHelper.iterateCompoundList(nbt.getList("FluidStorage", Tag.TAG_COMPOUND), c -> fluidStorage.put(NbtUtils.readBlockPos(c.getCompound("Pos")), MountedFluidStorage.deserialize(c.getCompound("Data"))));
    interactors.clear();
    NBTHelper.iterateCompoundList(nbt.getList("Interactors", Tag.TAG_COMPOUND), c -> {
        BlockPos pos = NbtUtils.readBlockPos(c.getCompound("Pos"));
        MovingInteractionBehaviour behaviour = AllInteractionBehaviours.of(getBlocks().get(pos).state.getBlock());
        if (behaviour != null)
            interactors.put(pos, behaviour);
    });
    if (spawnData)
        fluidStorage.forEach((pos, mfs) -> {
            BlockEntity tileEntity = presentTileEntities.get(pos);
            if (!(tileEntity instanceof FluidTankTileEntity))
                return;
            FluidTankTileEntity tank = (FluidTankTileEntity) tileEntity;
            IFluidTank tankInventory = tank.getTankInventory();
            if (tankInventory instanceof FluidTank)
                ((FluidTank) tankInventory).setFluid(mfs.tank.getFluid());
            tank.getFluidLevel().start(tank.getFillState());
            mfs.assignTileEntity(tank);
        });
    IItemHandlerModifiable[] handlers = new IItemHandlerModifiable[storage.size()];
    int index = 0;
    for (MountedStorage mountedStorage : storage.values()) handlers[index++] = mountedStorage.getItemHandler();
    IFluidHandler[] fluidHandlers = new IFluidHandler[fluidStorage.size()];
    index = 0;
    for (MountedFluidStorage mountedStorage : fluidStorage.values()) fluidHandlers[index++] = mountedStorage.getFluidHandler();
    inventory = new ContraptionInvWrapper(handlers);
    fluidInventory = new CombinedTankWrapper(fluidHandlers);
    if (nbt.contains("BoundsFront"))
        bounds = NBTHelper.readAABB(nbt.getList("BoundsFront", 5));
    stalled = nbt.getBoolean("Stalled");
    hasUniversalCreativeCrate = nbt.getBoolean("BottomlessSupply");
    anchor = NbtUtils.readBlockPos(nbt.getCompound("Anchor"));
}
Also used : BeltBlock(com.simibubi.create.content.contraptions.relays.belt.BeltBlock) Arrays(java.util.Arrays) AABB(net.minecraft.world.phys.AABB) SeatBlock(com.simibubi.create.content.contraptions.components.actors.SeatBlock) DebugPackets(net.minecraft.network.protocol.game.DebugPackets) Dist(net.minecraftforge.api.distmarker.Dist) Pair(org.apache.commons.lang3.tuple.Pair) Map(java.util.Map) IItemHandlerModifiable(net.minecraftforge.items.IItemHandlerModifiable) CombinedInvWrapper(net.minecraftforge.items.wrapper.CombinedInvWrapper) NbtUtils(net.minecraft.nbt.NbtUtils) ChestBlock(net.minecraft.world.level.block.ChestBlock) SimpleWaterloggedBlock(net.minecraft.world.level.block.SimpleWaterloggedBlock) Set(java.util.Set) PoiType(net.minecraft.world.entity.ai.village.poi.PoiType) BooleanOp(net.minecraft.world.phys.shapes.BooleanOp) BlockEntity(net.minecraft.world.level.block.entity.BlockEntity) AllInteractionBehaviours(com.simibubi.create.AllInteractionBehaviours) WindmillBearingBlock(com.simibubi.create.content.contraptions.components.structureMovement.bearing.WindmillBearingBlock) MechanicalPistonHeadBlock(com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonHeadBlock) FluidState(net.minecraft.world.level.material.FluidState) PulleyBlock(com.simibubi.create.content.contraptions.components.structureMovement.pulley.PulleyBlock) FluidStack(net.minecraftforge.fluids.FluidStack) ItemStack(net.minecraft.world.item.ItemStack) VoxelShape(net.minecraft.world.phys.shapes.VoxelShape) GantryShaftBlock(com.simibubi.create.content.contraptions.relays.advanced.GantryShaftBlock) ICoordinate(com.simibubi.create.foundation.utility.ICoordinate) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn) BlockState(net.minecraft.world.level.block.state.BlockState) CreativeCrateTileEntity(com.simibubi.create.content.logistics.block.inventories.CreativeCrateTileEntity) FilteringBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour) ArrayList(java.util.ArrayList) StickerBlock(com.simibubi.create.content.contraptions.components.structureMovement.chassis.StickerBlock) BiConsumer(java.util.function.BiConsumer) BlockFace(com.simibubi.create.foundation.utility.BlockFace) StructureBlockInfo(net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo) Nullable(javax.annotation.Nullable) SeatEntity(com.simibubi.create.content.contraptions.components.actors.SeatEntity) IFluidHandler(net.minecraftforge.fluids.capability.IFluidHandler) Iterate(com.simibubi.create.foundation.utility.Iterate) AllMovementBehaviours(com.simibubi.create.AllMovementBehaviours) MechanicalBearingBlock(com.simibubi.create.content.contraptions.components.structureMovement.bearing.MechanicalBearingBlock) CombinedTankWrapper(com.simibubi.create.foundation.fluid.CombinedTankWrapper) NBTHelper(com.simibubi.create.foundation.utility.NBTHelper) FluidTankTileEntity(com.simibubi.create.content.contraptions.fluids.tank.FluidTankTileEntity) ListTag(net.minecraft.nbt.ListTag) SuperGlueEntity(com.simibubi.create.content.contraptions.components.structureMovement.glue.SuperGlueEntity) EmptyLighter(com.simibubi.create.content.contraptions.components.structureMovement.render.EmptyLighter) IMultiTileContainer(com.simibubi.create.foundation.tileEntity.IMultiTileContainer) Direction(net.minecraft.core.Direction) RedstoneContactBlock(com.simibubi.create.content.logistics.block.redstone.RedstoneContactBlock) PressurePlateBlock(net.minecraft.world.level.block.PressurePlateBlock) FluidTank(net.minecraftforge.fluids.capability.templates.FluidTank) GantryCarriageBlock(com.simibubi.create.content.contraptions.components.structureMovement.gantry.GantryCarriageBlock) Rotation(net.minecraft.world.level.block.Rotation) MutablePair(org.apache.commons.lang3.tuple.MutablePair) GameData(net.minecraftforge.registries.GameData) RopeBlock(com.simibubi.create.content.contraptions.components.structureMovement.pulley.PulleyBlock.RopeBlock) MechanicalPistonBlock(com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock) AllConfigs(com.simibubi.create.foundation.config.AllConfigs) PulleyTileEntity(com.simibubi.create.content.contraptions.components.structureMovement.pulley.PulleyTileEntity) UniqueLinkedList(com.simibubi.create.foundation.utility.UniqueLinkedList) BlockStateProperties(net.minecraft.world.level.block.state.properties.BlockStateProperties) NBTProcessors(com.simibubi.create.foundation.utility.NBTProcessors) UUID(java.util.UUID) StabilizedContraption(com.simibubi.create.content.contraptions.components.structureMovement.bearing.StabilizedContraption) MagnetBlock(com.simibubi.create.content.contraptions.components.structureMovement.pulley.PulleyBlock.MagnetBlock) Collectors(java.util.stream.Collectors) Blocks(net.minecraft.world.level.block.Blocks) Objects(java.util.Objects) AbstractChassisBlock(com.simibubi.create.content.contraptions.components.structureMovement.chassis.AbstractChassisBlock) PistonExtensionPoleBlock(com.simibubi.create.content.contraptions.components.structureMovement.piston.PistonExtensionPoleBlock) List(java.util.List) CompoundTag(net.minecraft.nbt.CompoundTag) BlockPos(net.minecraft.core.BlockPos) HashMapPalette(net.minecraft.world.level.chunk.HashMapPalette) Entry(java.util.Map.Entry) Optional(java.util.Optional) LevelAccessor(net.minecraft.world.level.LevelAccessor) IFluidTank(net.minecraftforge.fluids.IFluidTank) Queue(java.util.Queue) Shapes(net.minecraft.world.phys.shapes.Shapes) Level(net.minecraft.world.level.Level) Tag(net.minecraft.nbt.Tag) PistonType(net.minecraft.world.level.block.state.properties.PistonType) KineticTileEntity(com.simibubi.create.content.contraptions.base.KineticTileEntity) FluidAction(net.minecraftforge.fluids.capability.IFluidHandler.FluidAction) HashMap(java.util.HashMap) CompletableFuture(java.util.concurrent.CompletableFuture) ServerLevel(net.minecraft.server.level.ServerLevel) HashSet(java.util.HashSet) ItemVaultTileEntity(com.simibubi.create.content.logistics.block.vault.ItemVaultTileEntity) Axis(net.minecraft.core.Direction.Axis) IRotate(com.simibubi.create.content.contraptions.base.IRotate) PushReaction(net.minecraft.world.level.material.PushReaction) ButtonBlock(net.minecraft.world.level.block.ButtonBlock) Fluids(net.minecraft.world.level.material.Fluids) AllBlocks(com.simibubi.create.AllBlocks) ChestType(net.minecraft.world.level.block.state.properties.ChestType) Iterator(java.util.Iterator) SuperGlueHandler(com.simibubi.create.content.contraptions.components.structureMovement.glue.SuperGlueHandler) MechanicalPistonBlock.isPistonHead(com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock.isPistonHead) PistonState(com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock.PistonState) Entity(net.minecraft.world.entity.Entity) MechanicalPistonBlock.isExtensionPole(com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock.isExtensionPole) ChassisTileEntity(com.simibubi.create.content.contraptions.components.structureMovement.chassis.ChassisTileEntity) Vec3(net.minecraft.world.phys.Vec3) Block(net.minecraft.world.level.block.Block) FluidTankTileEntity(com.simibubi.create.content.contraptions.fluids.tank.FluidTankTileEntity) IFluidHandler(net.minecraftforge.fluids.capability.IFluidHandler) FluidTank(net.minecraftforge.fluids.capability.templates.FluidTank) IFluidTank(net.minecraftforge.fluids.IFluidTank) IItemHandlerModifiable(net.minecraftforge.items.IItemHandlerModifiable) BlockPos(net.minecraft.core.BlockPos) ListTag(net.minecraft.nbt.ListTag) CompoundTag(net.minecraft.nbt.CompoundTag) Tag(net.minecraft.nbt.Tag) StructureBlockInfo(net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo) CompoundTag(net.minecraft.nbt.CompoundTag) IFluidTank(net.minecraftforge.fluids.IFluidTank) CombinedTankWrapper(com.simibubi.create.foundation.fluid.CombinedTankWrapper) BlockEntity(net.minecraft.world.level.block.entity.BlockEntity)

Example 5 with FluidTankTileEntity

use of com.simibubi.create.content.contraptions.fluids.tank.FluidTankTileEntity in project Create by Creators-of-Create.

the class MountedFluidStorage method updateFluid.

public void updateFluid(FluidStack fluid) {
    tank.setFluid(fluid);
    if (!(te instanceof FluidTankTileEntity))
        return;
    float fillState = tank.getFluidAmount() / (float) tank.getCapacity();
    FluidTankTileEntity tank = (FluidTankTileEntity) te;
    if (tank.getFluidLevel() == null)
        tank.setFluidLevel(new InterpolatedChasingValue().start(fillState));
    tank.getFluidLevel().target(fillState);
    IFluidTank tankInventory = tank.getTankInventory();
    if (tankInventory instanceof SmartFluidTank)
        ((SmartFluidTank) tankInventory).setFluid(fluid);
}
Also used : InterpolatedChasingValue(com.simibubi.create.foundation.utility.animation.InterpolatedChasingValue) CreativeFluidTankTileEntity(com.simibubi.create.content.contraptions.fluids.tank.CreativeFluidTankTileEntity) FluidTankTileEntity(com.simibubi.create.content.contraptions.fluids.tank.FluidTankTileEntity) IFluidTank(net.minecraftforge.fluids.IFluidTank) CreativeSmartFluidTank(com.simibubi.create.content.contraptions.fluids.tank.CreativeFluidTankTileEntity.CreativeSmartFluidTank) SmartFluidTank(com.simibubi.create.foundation.fluid.SmartFluidTank)

Aggregations

FluidTankTileEntity (com.simibubi.create.content.contraptions.fluids.tank.FluidTankTileEntity)5 CreativeFluidTankTileEntity (com.simibubi.create.content.contraptions.fluids.tank.CreativeFluidTankTileEntity)2 ItemVaultTileEntity (com.simibubi.create.content.logistics.block.vault.ItemVaultTileEntity)2 IFluidTank (net.minecraftforge.fluids.IFluidTank)2 AllBlocks (com.simibubi.create.AllBlocks)1 AllFluids (com.simibubi.create.AllFluids)1 AllInteractionBehaviours (com.simibubi.create.AllInteractionBehaviours)1 AllMovementBehaviours (com.simibubi.create.AllMovementBehaviours)1 IRotate (com.simibubi.create.content.contraptions.base.IRotate)1 KineticTileEntity (com.simibubi.create.content.contraptions.base.KineticTileEntity)1 PortableFluidInterfaceTileEntity (com.simibubi.create.content.contraptions.components.actors.PortableFluidInterfaceTileEntity)1 SeatBlock (com.simibubi.create.content.contraptions.components.actors.SeatBlock)1 SeatEntity (com.simibubi.create.content.contraptions.components.actors.SeatEntity)1 MechanicalBearingBlock (com.simibubi.create.content.contraptions.components.structureMovement.bearing.MechanicalBearingBlock)1 StabilizedContraption (com.simibubi.create.content.contraptions.components.structureMovement.bearing.StabilizedContraption)1 WindmillBearingBlock (com.simibubi.create.content.contraptions.components.structureMovement.bearing.WindmillBearingBlock)1 AbstractChassisBlock (com.simibubi.create.content.contraptions.components.structureMovement.chassis.AbstractChassisBlock)1 ChassisTileEntity (com.simibubi.create.content.contraptions.components.structureMovement.chassis.ChassisTileEntity)1 StickerBlock (com.simibubi.create.content.contraptions.components.structureMovement.chassis.StickerBlock)1 GantryCarriageBlock (com.simibubi.create.content.contraptions.components.structureMovement.gantry.GantryCarriageBlock)1