Search in sources :

Example 1 with EngineTileEntity

use of com.simibubi.create.content.contraptions.components.flywheel.engine.EngineTileEntity in project SteamPowered by TeamMoegMC.

the class MixinFlywheel method sp$tick.

@Inject(at = @At("HEAD"), method = "tick")
public void sp$tick(CallbackInfo cbi) {
    Direction at = FlywheelBlock.getConnection(getBlockState());
    if (at != null) {
        BlockPos eng = this.getBlockPos().relative(at, 2);
        Block b = this.getWorld().getBlockState(eng).getBlock();
        if (!(b instanceof EngineBlock)) {
            FlywheelBlock.setConnection(getWorld(), getBlockPos(), getBlockState(), null);
            this.setRotation(0, 0);
        } else {
            TileEntity te = this.getWorld().getBlockEntity(eng);
            if (te instanceof EngineTileEntity) {
                if (te instanceof SteamEngineTileEntity) {
                    SteamEngineTileEntity ete = (SteamEngineTileEntity) te;
                    if (ete.getFlywheel() != this.getBlockState().getBlock())
                        this.setRotation(0, 0);
                }
            } else
                this.setRotation(0, 0);
        }
    } else
        this.setRotation(0, 0);
}
Also used : SteamEngineTileEntity(com.teammoeg.steampowered.content.engine.SteamEngineTileEntity) FlywheelTileEntity(com.simibubi.create.content.contraptions.components.flywheel.FlywheelTileEntity) EngineTileEntity(com.simibubi.create.content.contraptions.components.flywheel.engine.EngineTileEntity) GeneratingKineticTileEntity(com.simibubi.create.content.contraptions.base.GeneratingKineticTileEntity) TileEntity(net.minecraft.tileentity.TileEntity) SteamEngineTileEntity(com.teammoeg.steampowered.content.engine.SteamEngineTileEntity) EngineTileEntity(com.simibubi.create.content.contraptions.components.flywheel.engine.EngineTileEntity) SteamEngineTileEntity(com.teammoeg.steampowered.content.engine.SteamEngineTileEntity) EngineBlock(com.simibubi.create.content.contraptions.components.flywheel.engine.EngineBlock) Block(net.minecraft.block.Block) FlywheelBlock(com.simibubi.create.content.contraptions.components.flywheel.FlywheelBlock) EngineBlock(com.simibubi.create.content.contraptions.components.flywheel.engine.EngineBlock) BlockPos(net.minecraft.util.math.BlockPos) Direction(net.minecraft.util.Direction) Inject(org.spongepowered.asm.mixin.injection.Inject)

Aggregations

GeneratingKineticTileEntity (com.simibubi.create.content.contraptions.base.GeneratingKineticTileEntity)1 FlywheelBlock (com.simibubi.create.content.contraptions.components.flywheel.FlywheelBlock)1 FlywheelTileEntity (com.simibubi.create.content.contraptions.components.flywheel.FlywheelTileEntity)1 EngineBlock (com.simibubi.create.content.contraptions.components.flywheel.engine.EngineBlock)1 EngineTileEntity (com.simibubi.create.content.contraptions.components.flywheel.engine.EngineTileEntity)1 SteamEngineTileEntity (com.teammoeg.steampowered.content.engine.SteamEngineTileEntity)1 Block (net.minecraft.block.Block)1 TileEntity (net.minecraft.tileentity.TileEntity)1 Direction (net.minecraft.util.Direction)1 BlockPos (net.minecraft.util.math.BlockPos)1 Inject (org.spongepowered.asm.mixin.injection.Inject)1