mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-19 20:09:39 +00:00
Added abutting block detection and processing (#2068)
This commit is contained in:
1 parent
c36647af34
commit
b7d439e6b1
1 file changed
+21
-1
@@ -46,6 +46,7 @@ public abstract class TileOverride implements Comparable<TileOverride> {
|
||||
private final List<BlockStateMatcher> matchBlocks;
|
||||
private final Set<String> matchTiles;
|
||||
private final List<BlockStateMatcher> connectBlocks;
|
||||
private final List<BlockStateMatcher> abuttingBlocks;
|
||||
private final BlockFaceMatcher faceMatcher;
|
||||
private final int connectType;
|
||||
private final boolean innerSeams;
|
||||
@@ -164,7 +165,7 @@ public abstract class TileOverride implements Comparable<TileOverride> {
|
||||
matchTiles.add(baseFilename);
|
||||
}
|
||||
connectBlocks = getBlockList(properties.getString("connectBlocks", ""), properties.getString("connectMetadata", ""));
|
||||
|
||||
abuttingBlocks = getBlockList(properties.getString("abuttingBlocks", ""), properties.getString("abuttingMetaData", ""));
|
||||
faceMatcher = BlockFaceMatcher.create(properties.getString("faces", ""));
|
||||
|
||||
String connectType1 = properties.getString("connect", "")
|
||||
@@ -499,6 +500,9 @@ public abstract class TileOverride implements Comparable<TileOverride> {
|
||||
if (faceMatcher != null && !faceMatcher.match(renderBlockState)) {
|
||||
return null;
|
||||
}
|
||||
if (!abuttingBlocks.isEmpty() && !matchesAbuttingBlock(blockAccess, x,y,z, renderBlockState.getBlockFace())) {
|
||||
return null;
|
||||
}
|
||||
if (height != null && !height.get(y)) {
|
||||
return null;
|
||||
}
|
||||
@@ -508,6 +512,22 @@ public abstract class TileOverride implements Comparable<TileOverride> {
|
||||
return getTileWorld_Impl(renderBlockState, origIcon);
|
||||
}
|
||||
|
||||
private boolean matchesAbuttingBlock(IBlockAccess blockAccess, int x, int y, int z, int blockFace) {
|
||||
if (blockFace < 0) {
|
||||
return false;
|
||||
}
|
||||
int[] normal = NORMALS[blockFace];
|
||||
x += normal[0];
|
||||
y += normal[1];
|
||||
z += normal[2];
|
||||
for (BlockStateMatcher matcher : abuttingBlocks) {
|
||||
if (matcher.match(blockAccess, x, y , z)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public final IIcon getTileHeld(RenderBlockState renderBlockState, IIcon origIcon) {
|
||||
if (icons == null) {
|
||||
properties.error("no images loaded, disabling");
|
||||
|
||||
Reference in new issue
Block a user