mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-23 21:59:44 +00:00
Generalize non-terrain block's material ID setting (#1981)
This commit is contained in:
1 parent
6c5eedb7c1
commit
b5dd1c04ce
13 files changed
+514
-40
No files matched your search
@@ -1,5 +1,9 @@
|
||||
package net.coderbot.iris.uniforms;
|
||||
|
||||
import net.coderbot.iris.Iris;
|
||||
import net.coderbot.iris.pipeline.DeferredWorldRenderingPipeline;
|
||||
import net.coderbot.iris.pipeline.WorldRenderingPipeline;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
@@ -23,6 +27,13 @@ public class ItemIdManager {
|
||||
CapturedRenderingState.INSTANCE.setCurrentRenderedItem(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the item ID for a Block rendered outside of terrain.
|
||||
*/
|
||||
public static void setBlockId(Block block, int metadata) {
|
||||
CapturedRenderingState.INSTANCE.setCurrentRenderedItem(Math.max(0, ItemMaterialHelper.getMaterialId(block, metadata)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the item ID to 0.
|
||||
* Used when entering/exiting render sections or before glint rendering.
|
||||
@@ -30,4 +41,28 @@ public class ItemIdManager {
|
||||
public static void resetItemId() {
|
||||
CapturedRenderingState.INSTANCE.setCurrentRenderedItem(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* The currently bound item ID.
|
||||
*/
|
||||
public static int getItemId() {
|
||||
return CapturedRenderingState.INSTANCE.getCurrentRenderedItem();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set an already-resolved item ID without performing a lookup.
|
||||
*/
|
||||
public static void setItemIdRaw(int id) {
|
||||
CapturedRenderingState.INSTANCE.setCurrentRenderedItem(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Honestly I don't know why there's comments on a lot of these.
|
||||
* Guess I thought documentation is good but man if you can't figure this out
|
||||
* you're in trouble.
|
||||
*/
|
||||
public static boolean isWorldRenderActive() {
|
||||
final WorldRenderingPipeline pipeline = Iris.getPipelineManager().getPipelineNullable();
|
||||
return pipeline instanceof DeferredWorldRenderingPipeline drp && drp.isRenderingLevelGeometry();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user