use of net.minecraft.world.level.block.state.properties.RedstoneSide in project additionaladditions by Dqu1J.
the class CopperPatinaBlock method animateTick.
public void animateTick(BlockState state, Level world, BlockPos pos, Random random) {
int i = (Integer) state.getValue(POWER);
if (i != 0) {
Iterator var6 = Plane.HORIZONTAL.iterator();
while (var6.hasNext()) {
Direction direction = (Direction) var6.next();
RedstoneSide wireConnection = (RedstoneSide) state.getValue((Property) DIRECTION_TO_WIRE_CONNECTION_PROPERTY.get(direction));
switch(wireConnection) {
case UP:
this.addPoweredParticles(world, random, pos, COLORS[i], direction, Direction.UP, -0.5F, 0.5F);
case SIDE:
this.addPoweredParticles(world, random, pos, COLORS[i], Direction.DOWN, direction, 0.0F, 0.5F);
break;
case NONE:
default:
this.addPoweredParticles(world, random, pos, COLORS[i], Direction.DOWN, direction, 0.0F, 0.3F);
}
}
}
}
use of net.minecraft.world.level.block.state.properties.RedstoneSide in project additionaladditions by Dqu1J.
the class CopperPatinaBlock method updateForNewState.
private void updateForNewState(Level world, BlockPos pos, BlockState oldState, BlockState newState) {
Iterator var5 = Plane.HORIZONTAL.iterator();
while (var5.hasNext()) {
Direction direction = (Direction) var5.next();
BlockPos blockPos = pos.relative(direction);
if (((RedstoneSide) oldState.getValue((Property) DIRECTION_TO_WIRE_CONNECTION_PROPERTY.get(direction))).isConnected() != ((RedstoneSide) newState.getValue((Property) DIRECTION_TO_WIRE_CONNECTION_PROPERTY.get(direction))).isConnected() && world.getBlockState(blockPos).isRedstoneConductor(world, blockPos)) {
world.updateNeighborsAtExceptFromFacing(blockPos, newState.getBlock(), direction.getOpposite());
}
}
}
use of net.minecraft.world.level.block.state.properties.RedstoneSide in project additionaladditions by Dqu1J.
the class CopperPatinaBlock method method_27843.
private BlockState method_27843(BlockGetter world, BlockState state, BlockPos pos) {
boolean bl = !world.getBlockState(pos.above()).isRedstoneConductor(world, pos);
Iterator var5 = Plane.HORIZONTAL.iterator();
while (var5.hasNext()) {
Direction direction = (Direction) var5.next();
if (!((RedstoneSide) state.getValue((Property) DIRECTION_TO_WIRE_CONNECTION_PROPERTY.get(direction))).isConnected()) {
RedstoneSide wireConnection = this.getRenderConnectionType(world, pos, direction, bl);
state = (BlockState) state.setValue((Property) DIRECTION_TO_WIRE_CONNECTION_PROPERTY.get(direction), wireConnection);
}
}
return state;
}
use of net.minecraft.world.level.block.state.properties.RedstoneSide in project additionaladditions by Dqu1J.
the class CopperPatinaBlock method getShapeForState.
private VoxelShape getShapeForState(BlockState state) {
VoxelShape voxelShape = DOT_SHAPE;
Iterator var3 = Plane.HORIZONTAL.iterator();
while (var3.hasNext()) {
Direction direction = (Direction) var3.next();
RedstoneSide wireConnection = (RedstoneSide) state.getValue((Property) DIRECTION_TO_WIRE_CONNECTION_PROPERTY.get(direction));
if (wireConnection == RedstoneSide.SIDE) {
voxelShape = Shapes.or(voxelShape, (VoxelShape) field_24414.get(direction));
} else if (wireConnection == RedstoneSide.UP) {
voxelShape = Shapes.or(voxelShape, (VoxelShape) field_24415.get(direction));
}
}
return voxelShape;
}
use of net.minecraft.world.level.block.state.properties.RedstoneSide in project additionaladditions by Dqu1J.
the class CopperPatinaBlock method updateIndirectNeighbourShapes.
public void updateIndirectNeighbourShapes(BlockState state, LevelAccessor world, BlockPos pos, int flags, int maxUpdateDepth) {
MutableBlockPos mutable = new MutableBlockPos();
Iterator var7 = Plane.HORIZONTAL.iterator();
while (var7.hasNext()) {
Direction direction = (Direction) var7.next();
RedstoneSide wireConnection = (RedstoneSide) state.getValue((Property) DIRECTION_TO_WIRE_CONNECTION_PROPERTY.get(direction));
if (wireConnection != RedstoneSide.NONE && !world.getBlockState(mutable.setWithOffset(pos, direction)).is(this)) {
mutable.move(Direction.DOWN);
BlockState blockState = world.getBlockState(mutable);
if (!blockState.is(Blocks.OBSERVER)) {
BlockPos blockPos = mutable.relative(direction.getOpposite());
BlockState blockState2 = blockState.updateShape(direction.getOpposite(), world.getBlockState(blockPos), world, mutable, blockPos);
updateOrDestroy(blockState, blockState2, world, mutable, flags, maxUpdateDepth);
}
mutable.setWithOffset(pos, direction).move(Direction.UP);
BlockState blockState3 = world.getBlockState(mutable);
if (!blockState3.is(Blocks.OBSERVER)) {
BlockPos blockPos2 = mutable.relative(direction.getOpposite());
BlockState blockState4 = blockState3.updateShape(direction.getOpposite(), world.getBlockState(blockPos2), world, mutable, blockPos2);
updateOrDestroy(blockState3, blockState4, world, mutable, flags, maxUpdateDepth);
}
}
}
}
Aggregations