Search in sources :

Example 1 with HoneyCongealerTileEntity

use of com.teamresourceful.resourcefulbees.tileentity.HoneyCongealerTileEntity in project ResourcefulBees by Resourceful-Bees.

the class SyncGUIMessage method handle.

public static void handle(SyncGUIMessage message, Supplier<NetworkEvent.Context> context) {
    context.get().enqueueWork(() -> {
        AbstractClientPlayer player = Minecraft.getInstance().player;
        if (player != null && player.level.isLoaded(message.pos)) {
            BlockEntity tileEntity = player.level.getBlockEntity(message.pos);
            if (tileEntity instanceof CentrifugeTileEntity) {
                ((CentrifugeTileEntity) tileEntity).handleGUINetworkPacket(message.buffer);
            }
            if (tileEntity instanceof HoneyGeneratorTileEntity) {
                ((HoneyGeneratorTileEntity) tileEntity).handleGUINetworkPacket(message.buffer);
            }
            if (tileEntity instanceof HoneyCongealerTileEntity) {
                ((HoneyCongealerTileEntity) tileEntity).handleGUINetworkPacket(message.buffer);
            }
            if (tileEntity instanceof HoneyTankTileEntity) {
                ((HoneyTankTileEntity) tileEntity).handleGUINetworkPacket(message.buffer);
            }
        }
    });
    context.get().setPacketHandled(true);
}
Also used : AbstractClientPlayer(net.minecraft.client.player.AbstractClientPlayer) HoneyTankTileEntity(com.teamresourceful.resourcefulbees.tileentity.HoneyTankTileEntity) CentrifugeTileEntity(com.teamresourceful.resourcefulbees.tileentity.CentrifugeTileEntity) HoneyCongealerTileEntity(com.teamresourceful.resourcefulbees.tileentity.HoneyCongealerTileEntity) HoneyGeneratorTileEntity(com.teamresourceful.resourcefulbees.tileentity.HoneyGeneratorTileEntity) BlockEntity(net.minecraft.world.level.block.entity.BlockEntity)

Example 2 with HoneyCongealerTileEntity

use of com.teamresourceful.resourcefulbees.tileentity.HoneyCongealerTileEntity in project ResourcefulBees by Resourceful-Bees.

the class HoneyCongealer method animateTick.

@Override
public void animateTick(@NotNull BlockState stateIn, @NotNull Level world, @NotNull BlockPos pos, @NotNull Random rand) {
    HoneyCongealerTileEntity tank = getTileEntity(world, pos);
    if (tank == null) {
        return;
    }
    if (tank.getFluidTank().getFluid().getFluid() instanceof CustomHoneyFluid) {
        CustomHoneyFluid fluid = (CustomHoneyFluid) tank.getFluidTank().getFluid().getFluid();
        if (fluid.getHoneyData().getColor().isRainbow()) {
            world.sendBlockUpdated(pos, stateIn, stateIn, 2);
        }
    }
    super.animateTick(stateIn, world, pos, rand);
}
Also used : HoneyCongealerTileEntity(com.teamresourceful.resourcefulbees.tileentity.HoneyCongealerTileEntity) CustomHoneyFluid(com.teamresourceful.resourcefulbees.fluids.CustomHoneyFluid)

Aggregations

HoneyCongealerTileEntity (com.teamresourceful.resourcefulbees.tileentity.HoneyCongealerTileEntity)2 CustomHoneyFluid (com.teamresourceful.resourcefulbees.fluids.CustomHoneyFluid)1 CentrifugeTileEntity (com.teamresourceful.resourcefulbees.tileentity.CentrifugeTileEntity)1 HoneyGeneratorTileEntity (com.teamresourceful.resourcefulbees.tileentity.HoneyGeneratorTileEntity)1 HoneyTankTileEntity (com.teamresourceful.resourcefulbees.tileentity.HoneyTankTileEntity)1 AbstractClientPlayer (net.minecraft.client.player.AbstractClientPlayer)1 BlockEntity (net.minecraft.world.level.block.entity.BlockEntity)1