Files
Create-The_Factory_Must_Grow/trash_bin/old/base/PumpjackBaseBlock.java
2024-01-27 20:47:04 +01:00

73 lines
2.6 KiB
Java

package com.drmangotea.createindustry.blocks.machines.oil_processing.pumpjack.old.base;
import com.drmangotea.createindustry.registry.TFMGBlockEntities;
import com.drmangotea.createindustry.registry.TFMGShapes;
import com.simibubi.create.content.equipment.wrench.IWrenchable;
import com.simibubi.create.foundation.block.IBE;
import net.minecraft.core.BlockPos;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.HorizontalDirectionalBlock;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
public class PumpjackBaseBlock extends HorizontalDirectionalBlock implements IWrenchable, IBE<PumpjackBaseBlockEntity> {
public PumpjackBaseBlock(Properties p_i48440_1_) {
super(p_i48440_1_);
}
@Override
public VoxelShape getShape(BlockState pState, BlockGetter worldIn, BlockPos pos, CollisionContext context) {
return TFMGShapes.PUMPJACK_BASE;
}
public BlockState rotate(BlockState p_54540_, Rotation p_54541_) {
return p_54540_.setValue(HorizontalDirectionalBlock.FACING, p_54541_.rotate(p_54540_.getValue(HorizontalDirectionalBlock.FACING)));
}
public BlockState mirror(BlockState p_54537_, Mirror p_54538_) {
return p_54537_.rotate(p_54538_.getRotation(p_54537_.getValue(HorizontalDirectionalBlock.FACING)));
}
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> p_54543_) {
p_54543_.add(HorizontalDirectionalBlock.FACING);
}
@Override
public BlockState getStateForPlacement(BlockPlaceContext context) {
return this.defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, context.getHorizontalDirection().getOpposite());
}
@Override
public void onRemove(BlockState state, Level world, BlockPos pos, BlockState newState, boolean isMoving) {
world.removeBlockEntity(pos);
}
@Override
public Class<PumpjackBaseBlockEntity> getBlockEntityClass() {
return PumpjackBaseBlockEntity.class;
}
@Override
public BlockEntityType<? extends PumpjackBaseBlockEntity> getBlockEntityType() {
return TFMGBlockEntities.PUMPJACK_BASE.get();
}
}