mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-18 19:39:09 +00:00
Respect shader render layer overrides (#1293)
This commit is contained in:
1 parent
2f2fc22df3
commit
f79774df65
10 files changed
+98
-67
No files matched your search
@@ -1,10 +1,9 @@
|
||||
package net.coderbot.iris.block_rendering;
|
||||
|
||||
import com.gtnewhorizons.angelica.compat.toremove.RenderLayer;
|
||||
import com.gtnewhorizons.angelica.rendering.celeritas.BlockRenderLayer;
|
||||
import it.unimi.dsi.fastutil.ints.Int2IntMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||
import it.unimi.dsi.fastutil.objects.Reference2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.objects.Reference2ObjectOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap;
|
||||
@@ -36,33 +35,37 @@ public class BlockMaterialMapping {
|
||||
return blockMatches;
|
||||
}
|
||||
|
||||
public static Map<Block, RenderLayer> createBlockTypeMap(Map<NamespacedId, BlockRenderType> blockPropertiesMap) {
|
||||
Map<Block, RenderLayer> blockTypeIds = new Reference2ReferenceOpenHashMap<>();
|
||||
public static Map<Block, BlockRenderLayer> createBlockTypeMap(Map<NamespacedId, BlockRenderType> blockPropertiesMap) {
|
||||
Map<Block, BlockRenderLayer> blockTypeIds = new Reference2ReferenceOpenHashMap<>();
|
||||
|
||||
blockPropertiesMap.forEach((id, blockType) -> {
|
||||
ResourceLocation resourceLocation = new ResourceLocation(id.getNamespace(), id.getName());
|
||||
final ResourceLocation resourceLocation = new ResourceLocation(id.getNamespace(), id.getName());
|
||||
final Block block = Block.getBlockFromName(resourceLocation.toString());
|
||||
|
||||
Block block = Block.getBlockFromName(resourceLocation.toString());
|
||||
if (block == null || block == Blocks.air) {
|
||||
return;
|
||||
}
|
||||
|
||||
blockTypeIds.put(block, convertBlockToRenderType(blockType));
|
||||
final BlockRenderLayer layer = convertBlockToRenderLayer(blockType);
|
||||
if (layer != null) {
|
||||
blockTypeIds.put(block, layer);
|
||||
}
|
||||
});
|
||||
|
||||
return blockTypeIds;
|
||||
}
|
||||
|
||||
private static RenderLayer convertBlockToRenderType(BlockRenderType type) {
|
||||
private static BlockRenderLayer convertBlockToRenderLayer(BlockRenderType type) {
|
||||
if (type == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return switch (type) {
|
||||
// Everything renders in cutout or translucent in 1.7.10
|
||||
case SOLID, CUTOUT, CUTOUT_MIPPED -> RenderLayer.cutout();
|
||||
// case SOLID -> RenderLayer.solid();
|
||||
// case CUTOUT_MIPPED -> RenderLayer.cutoutMipped();
|
||||
case TRANSLUCENT -> RenderLayer.translucent();
|
||||
default -> null;
|
||||
};
|
||||
return switch (type) {
|
||||
case SOLID -> BlockRenderLayer.SOLID;
|
||||
case CUTOUT -> BlockRenderLayer.CUTOUT;
|
||||
case CUTOUT_MIPPED -> BlockRenderLayer.CUTOUT_MIPPED;
|
||||
case TRANSLUCENT -> BlockRenderLayer.TRANSLUCENT;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.coderbot.iris.block_rendering;
|
||||
|
||||
import com.gtnewhorizons.angelica.compat.toremove.RenderLayer;
|
||||
import com.gtnewhorizons.angelica.rendering.celeritas.BlockRenderLayer;
|
||||
import it.unimi.dsi.fastutil.ints.Int2IntMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntFunction;
|
||||
import it.unimi.dsi.fastutil.objects.Reference2ObjectMap;
|
||||
@@ -18,7 +18,7 @@ public class BlockRenderingSettings {
|
||||
@Getter
|
||||
private boolean reloadRequired;
|
||||
private Reference2ObjectMap<Block, Int2IntMap> blockMetaMatches;
|
||||
private Map<Block, RenderLayer> blockTypeIds;
|
||||
private Map<Block, BlockRenderLayer> blockTypeIds;
|
||||
private Object2IntFunction<NamespacedId> entityIds;
|
||||
private Object2IntFunction<NamespacedId> itemIds;
|
||||
private float ambientOcclusionLevel;
|
||||
@@ -55,7 +55,7 @@ public class BlockRenderingSettings {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Map<Block, RenderLayer> getBlockTypeIds() {
|
||||
public Map<Block, BlockRenderLayer> getBlockTypeIds() {
|
||||
return blockTypeIds;
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ public class BlockRenderingSettings {
|
||||
this.blockMetaMatches = blockMetaIds;
|
||||
}
|
||||
|
||||
public void setBlockTypeIds(Map<Block, RenderLayer> blockTypeIds) {
|
||||
public void setBlockTypeIds(Map<Block, BlockRenderLayer> blockTypeIds) {
|
||||
if (this.blockTypeIds != null && this.blockTypeIds.equals(blockTypeIds)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user