Skip to content

Commit

Permalink
Undo isSolid replacement
Browse files Browse the repository at this point in the history
  • Loading branch information
Electro593 committed Nov 22, 2023
1 parent d6b9399 commit 0fb060b
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ protected void appendProperties(StateManager.Builder<Block, BlockState> builder)
public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) {
Direction targetDirection = state.get(FACING).getOpposite();
BlockPos targetPos = pos.offset(targetDirection);
return world.getBlockState(targetPos).isSolidBlock(world, targetPos);
return world.getBlockState(targetPos).isSolid();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ protected void appendProperties(StateManager.Builder<Block, BlockState> builder)
@Override
public void onDestroyedOnLanding(World world, BlockPos pos, FallingBlockEntity fallingBlockEntity) {
BlockState state = world.getBlockState(pos);
if (!state.isSolidBlock(world, pos) && state.getPistonBehavior() == PistonBehavior.DESTROY) {
if (!state.isSolid() && state.getPistonBehavior() == PistonBehavior.DESTROY) {
world.breakBlock(pos, true, fallingBlockEntity, 4);
}
super.onDestroyedOnLanding(world, pos, fallingBlockEntity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Ran
int zOffset = 2 - random.nextInt(5);

BlockPos targetPos = pos.add(xOffset, yOffset, zOffset);
if (world.getBlockState(targetPos).isAir() && world.getBlockState(targetPos.down()).isSolidBlock(world, targetPos.down())) {
if (world.getBlockState(targetPos).isAir() && world.getBlockState(targetPos.down()).isSolid()) {
world.setBlockState(targetPos, Blocks.FIRE.getDefaultState());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void inventoryTick(ItemStack stack, World world, Entity entity, int slot,
int zOffset = 3 - random.nextInt(7);

BlockPos targetPos = BlockPos.ofFloored(entity.getPos()).add(xOffset, yOffset, zOffset);
if (world.getBlockState(targetPos).isAir() && world.getBlockState(targetPos.down()).isSolidBlock(world, targetPos.down())) {
if (world.getBlockState(targetPos).isAir() && world.getBlockState(targetPos.down()).isSolid()) {
world.setBlockState(targetPos, Blocks.FIRE.getDefaultState());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public BlockRenderType getRenderType(BlockState state) {
@Override
public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) {
Direction targetDirection = state.get(FACING).getOpposite();
BlockPos targetPos = pos.offset(targetDirection);
return world.getBlockState(targetPos).isSolidBlock(world, targetPos);
BlockPos targetPos = pos.offset(targetDirection);
return world.getBlockState(targetPos).isSolid();
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import com.mojang.serialization.codecs.*;
import de.dafuqs.spectrum.registries.*;
import net.minecraft.block.*;
import net.minecraft.client.MinecraftClient;
import net.minecraft.structure.pool.*;
import net.minecraft.util.*;
import net.minecraft.util.math.*;
Expand Down Expand Up @@ -101,7 +100,6 @@ public StructureType<UndergroundJigsawStructure> getType() {
private static Optional<Integer> getFloorHeight(Random random, ChunkGenerator chunkGenerator, StructurePlacementType structurePlacementType, int startHeight, int structureHeight, BlockBox box, HeightLimitView world, NoiseConfig noiseConfig) {
int y = startHeight;
int lowestY = world.getBottomY() + 15;
MinecraftClient client = MinecraftClient.getInstance();

// if we are randomly picked a solid block:
// search downwards until we find the first non-solid block
Expand All @@ -111,7 +109,7 @@ private static Optional<Integer> getFloorHeight(Random random, ChunkGenerator ch
if (y < lowestY) {
return Optional.empty();
}
if (!heightLimitView.getState(y).isSolidBlock(client.world != null ? null : client.world, new BlockPos(box.getCenter().getX(), y, box.getCenter().getZ()))) {
if (!heightLimitView.getState(y).isSolid()) {
break;
}
y--;
Expand Down

0 comments on commit 0fb060b

Please sign in to comment.