use of net.coderbot.iris.layer.OuterWrappedRenderType in project Iris by IrisShaders.
the class MixinBlockEntityRenderDispatcher method iris$beforeRender.
// I inject here in the method so that:
//
// 1. we can know that some checks we need have already been done
// 2. if someone cancels this method hopefully it gets cancelled before this point
@Inject(method = "render", at = @At(value = "INVOKE", target = RUN_REPORTED))
private void iris$beforeRender(BlockEntity blockEntity, float tickDelta, PoseStack poseStack, MultiBufferSource bufferSource, CallbackInfo ci) {
if (!(bufferSource instanceof WrappingMultiBufferSource)) {
return;
}
Object2IntMap<BlockState> blockStateIds = BlockRenderingSettings.INSTANCE.getBlockStateIds();
if (blockStateIds == null) {
return;
}
// At this point, based on where we are in BlockEntityRenderDispatcher:
// - The block entity is non-null
// - The block entity has a world
// - The block entity thinks that it's supported by a valid block
int intId = blockStateIds.getOrDefault(blockEntity.getBlockState(), -1);
RenderStateShard stateShard = BlockEntityRenderStateShard.forId(intId);
((WrappingMultiBufferSource) bufferSource).pushWrappingFunction(type -> new OuterWrappedRenderType("iris:is_block_entity", type, stateShard));
}
use of net.coderbot.iris.layer.OuterWrappedRenderType in project Iris by IrisShaders.
the class MixinEntityRenderDispatcher method iris$beginEntityRender.
// Inject after MatrixStack#push to increase the chances that we won't be caught out by a poorly-positioned
// cancellation in an inject.
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/vertex/PoseStack;pushPose()V", shift = At.Shift.AFTER))
private void iris$beginEntityRender(Entity entity, double x, double y, double z, float yaw, float tickDelta, PoseStack poseStack, MultiBufferSource bufferSource, int light, CallbackInfo ci) {
if (!(bufferSource instanceof WrappingMultiBufferSource)) {
return;
}
ResourceLocation entityId = Registry.ENTITY_TYPE.getKey(entity.getType());
Object2IntFunction<NamespacedId> entityIds = BlockRenderingSettings.INSTANCE.getEntityIds();
if (entityIds == null) {
return;
}
int intId = entityIds.applyAsInt(new NamespacedId(entityId.getNamespace(), entityId.getPath()));
RenderStateShard phase = EntityRenderStateShard.forId(intId);
((WrappingMultiBufferSource) bufferSource).pushWrappingFunction(layer -> new OuterWrappedRenderType("iris:is_entity", layer, phase));
}
Aggregations