Skip to content

Commit

Permalink
Refine structure placement logic
Browse files Browse the repository at this point in the history
  • Loading branch information
jss2a98aj committed Mar 7, 2024
1 parent 69c5e52 commit 3e92d9e
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import net.minecraft.block.Block;
import net.minecraft.block.BlockLog;
import net.minecraft.block.material.Material;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
Expand All @@ -19,11 +20,12 @@ public abstract class MixinWorld implements IBlockAccess {
@Overwrite
public int getTopSolidOrLiquidBlock(int x, int z) {
Chunk chunk = getChunkFromBlockCoords(x, z);
int chunkX = x &= 15;
int chunkZ = z &= 15;
int chunkX = x & 15;
int chunkZ = z & 15;
for(int y = chunk.getTopFilledSegment() + 15; y > 0; --y) {
Block block = chunk.getBlock(chunkX, y, chunkZ);
if(block.getMaterial().blocksMovement() && !block.isLeaves(this, x, y, z) && !block.isFoliage(this, x, y, z) && !(block instanceof BlockLog)) {
Material material = block.getMaterial();
if(material.isLiquid() || (material.blocksMovement() && !material.isReplaceable() && !block.isLeaves(this, x, y, z) && !block.isFoliage(this, x, y, z) && !(block instanceof BlockLog))) {
return y + 1;
}
}
Expand Down

0 comments on commit 3e92d9e

Please sign in to comment.