More fixes
This commit is contained in:
parent
26eb6165a7
commit
e7a6bdaa93
1 changed files with 71 additions and 29 deletions
|
@ -7,6 +7,7 @@ import java.util.Random;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.FallingBlock;
|
||||
import net.minecraft.state.property.Property;
|
||||
import net.minecraft.util.BlockMirror;
|
||||
import net.minecraft.util.BlockRotation;
|
||||
|
@ -114,7 +115,6 @@ public class BlocksHelper {
|
|||
}
|
||||
|
||||
public static void fixBlocks(WorldAccess world, BlockPos start, BlockPos end) {
|
||||
synchronized (world) {
|
||||
BlockState state;
|
||||
for (int x = start.getX(); x <= end.getX(); x++) {
|
||||
POS.setX(x);
|
||||
|
@ -123,7 +123,50 @@ public class BlocksHelper {
|
|||
for (int y = start.getY(); y <= end.getY(); y++) {
|
||||
POS.setY(y);
|
||||
state = world.getBlockState(POS);
|
||||
if (!state.canPlaceAt(world, POS)) {
|
||||
// Falling blocks
|
||||
if (state.getBlock() instanceof FallingBlock) {
|
||||
POS.setY(POS.getY() - 1);
|
||||
state = world.getBlockState(POS);
|
||||
if (state.getMaterial().isReplaceable()) {
|
||||
BlocksHelper.setWithoutUpdate(world, POS, Blocks.END_STONE.getDefaultState());
|
||||
if (world.getRandom().nextBoolean()) {
|
||||
POS.setY(POS.getY() - 1);
|
||||
state = world.getBlockState(POS);
|
||||
if (state.getMaterial().isReplaceable()) {
|
||||
BlocksHelper.setWithoutUpdate(world, POS, Blocks.END_STONE.getDefaultState());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Fluid fixes
|
||||
else if (!state.getFluidState().isEmpty()) {
|
||||
BlockState liquid = state;
|
||||
|
||||
BlockPos pos = POS.down();
|
||||
state = world.getBlockState(pos);
|
||||
boolean update = state.getMaterial().isReplaceable() && !state.getMaterial().isLiquid();
|
||||
|
||||
pos = POS.north();
|
||||
state = world.getBlockState(pos);
|
||||
update |= state.getMaterial().isReplaceable() && state.getFluidState().isEmpty();
|
||||
|
||||
pos = POS.south();
|
||||
state = world.getBlockState(pos);
|
||||
update |= state.getMaterial().isReplaceable() && state.getFluidState().isEmpty();
|
||||
|
||||
pos = POS.east();
|
||||
state = world.getBlockState(pos);
|
||||
update |= state.getMaterial().isReplaceable() && state.getFluidState().isEmpty();
|
||||
|
||||
pos = POS.west();
|
||||
state = world.getBlockState(pos);
|
||||
update |= state.getMaterial().isReplaceable() && state.getFluidState().isEmpty();
|
||||
|
||||
if (update) {
|
||||
world.setBlockState(POS, liquid, 1 | 2 | 8);
|
||||
}
|
||||
}
|
||||
else if (!state.canPlaceAt(world, POS)) {
|
||||
// Is blue Vine
|
||||
if (state.getBlock() instanceof BlockBlueVine) {
|
||||
while (!state.canPlaceAt(world, POS)) {
|
||||
|
@ -154,5 +197,4 @@ public class BlocksHelper {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue