Fixed fences connecting with non full blocks

master
Wynd 2024-12-24 20:40:02 +02:00
parent c092414565
commit 8f29cfa7a5
3 changed files with 31 additions and 10 deletions

View File

@ -9,8 +9,8 @@ import java.util.HashMap;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.Player;
import net.minecraft.item.ItemInstance;
import net.minecraft.item.ItemType;
import net.minecraft.recipe.RecipeRegistry;
import net.minecraft.tile.Tile;
import xyz.pixelatedw.finalbeta.mixin.RecipeRegistryAccessor;
public class WyHelper {
@ -115,7 +115,8 @@ public class WyHelper {
// player.dropItem(new ItemInstance(Tile.SLAB, 64));
// player.dropItem(new ItemInstance(ItemType.minecart, 1));
// player.dropItem(new ItemInstance(ItemType.minecartFurnace, 1));
player.dropItem(new ItemInstance(ItemType.bucket, 1));
player.dropItem(new ItemInstance(Tile.FENCE, 1));
player.dropItem(new ItemInstance(Tile.STONE_SLAB, 1, 2));
// player.dropItem(new ItemInstance(Tile.GOLDEN_RAIL, 64));
// player.dropItem(new ItemInstance(Tile.COBBLESTONE, 64));

View File

@ -39,10 +39,20 @@ public class FenceTileMixin extends Tile {
private Box createFenceBox(Level level, int x, int y, int z, boolean isOutline) {
Tile tile = ((FenceTile)(Object)this);
boolean eastCheck = level.getMaterial(x + 1, y, z).isSolid();
boolean westCheck = level.getMaterial(x - 1, y, z).isSolid();
boolean southCheck = level.getMaterial(x, y, z + 1).isSolid();
boolean northCheck = level.getMaterial(x, y, z - 1).isSolid();
Tile xpTile = Tile.BY_ID[level.getTileId(x + 1, y, z)];
Tile xnTile = Tile.BY_ID[level.getTileId(x - 1, y, z)];
Tile zpTile = Tile.BY_ID[level.getTileId(x, y, z + 1)];
Tile znTile = Tile.BY_ID[level.getTileId(x, y, z - 1)];
boolean xpCheck = xpTile != null && (xpTile.isFullCube() || xpTile.id == Tile.FENCE.id);
boolean xnCheck = xnTile != null && (xnTile.isFullCube() || xnTile.id == Tile.FENCE.id);
boolean zpCheck = zpTile != null && (zpTile.isFullCube() || zpTile.id == Tile.FENCE.id);
boolean znCheck = znTile != null && (znTile.isFullCube() || znTile.id == Tile.FENCE.id);
boolean eastCheck = level.getMaterial(x + 1, y, z).isSolid() && xpCheck;
boolean westCheck = level.getMaterial(x - 1, y, z).isSolid() && xnCheck;
boolean southCheck = level.getMaterial(x, y, z + 1).isSolid() && zpCheck;
boolean northCheck = level.getMaterial(x, y, z - 1).isSolid() && znCheck;
Box box = Box.create(westCheck ? 0 : 0.375f, 0.0f, northCheck ? 0.0f : 0.375f, eastCheck ? 1.0f : 0.625f, 1.0F, southCheck ? 1.0f : 0.625f);

View File

@ -49,10 +49,20 @@ public class TileRendererMixin {
var9 = 1;
}
int var10 = this.field_82.getMaterial(x - 1, y, z).isSolid() ? 1 : 0;
int var11 = this.field_82.getMaterial(x + 1, y, z).isSolid() ? 1 : 0;
int var12 = this.field_82.getMaterial(x, y, z - 1).isSolid() ? 1 : 0;
int var13 = this.field_82.getMaterial(x, y, z + 1).isSolid() ? 1 : 0;
Tile xpTile = Tile.BY_ID[this.field_82.getTileId(x + 1, y, z)];
Tile xnTile = Tile.BY_ID[this.field_82.getTileId(x - 1, y, z)];
Tile zpTile = Tile.BY_ID[this.field_82.getTileId(x, y, z + 1)];
Tile znTile = Tile.BY_ID[this.field_82.getTileId(x, y, z - 1)];
boolean xpCheck = xpTile != null && (xpTile.isFullCube() || xpTile.id == Tile.FENCE.id);
boolean xnCheck = xnTile != null && (xnTile.isFullCube() || xnTile.id == Tile.FENCE.id);
boolean zpCheck = zpTile != null && (zpTile.isFullCube() || zpTile.id == Tile.FENCE.id);
boolean znCheck = znTile != null && (znTile.isFullCube() || znTile.id == Tile.FENCE.id);
int var10 = this.field_82.getMaterial(x - 1, y, z).isSolid() && xnCheck ? 1 : 0;
int var11 = this.field_82.getMaterial(x + 1, y, z).isSolid() && xpCheck ? 1 : 0;
int var12 = this.field_82.getMaterial(x, y, z - 1).isSolid() && znCheck ? 1 : 0;
int var13 = this.field_82.getMaterial(x, y, z + 1).isSolid() && zpCheck ? 1 : 0;
if (var8 == 0 && var9 == 0) {
var8 = 1;
}