Search in sources :

Example 1 with GeneratingKineticTileEntity

use of com.simibubi.create.content.contraptions.base.GeneratingKineticTileEntity in project Create by Creators-of-Create.

the class IWrenchable method onWrenched.

default InteractionResult onWrenched(BlockState state, UseOnContext context) {
    Level world = context.getLevel();
    BlockState rotated = getRotatedBlockState(state, context.getClickedFace());
    if (!rotated.canSurvive(world, context.getClickedPos()))
        return InteractionResult.PASS;
    KineticTileEntity.switchToBlockState(world, context.getClickedPos(), updateAfterWrenched(rotated, context));
    BlockEntity te = context.getLevel().getBlockEntity(context.getClickedPos());
    if (te instanceof GeneratingKineticTileEntity) {
        ((GeneratingKineticTileEntity) te).reActivateSource = true;
    }
    if (world.getBlockState(context.getClickedPos()) != state)
        playRotateSound(world, context.getClickedPos());
    return InteractionResult.SUCCESS;
}
Also used : BlockState(net.minecraft.world.level.block.state.BlockState) GeneratingKineticTileEntity(com.simibubi.create.content.contraptions.base.GeneratingKineticTileEntity) ServerLevel(net.minecraft.server.level.ServerLevel) Level(net.minecraft.world.level.Level) BlockEntity(net.minecraft.world.level.block.entity.BlockEntity)

Aggregations

GeneratingKineticTileEntity (com.simibubi.create.content.contraptions.base.GeneratingKineticTileEntity)1 ServerLevel (net.minecraft.server.level.ServerLevel)1 Level (net.minecraft.world.level.Level)1 BlockEntity (net.minecraft.world.level.block.entity.BlockEntity)1 BlockState (net.minecraft.world.level.block.state.BlockState)1