Fixed frozen effect rendering on boats when sodium is installed

This commit is contained in:
Sollace 2024-02-26 21:21:44 +00:00
parent 850aa8a9fd
commit 5d7227f547
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB
4 changed files with 22 additions and 11 deletions

View file

@ -30,6 +30,7 @@ public class ChillingBreathSpell extends AbstractSpell implements HomingSpell {
public boolean setTarget(Entity target) {
if (target instanceof LavaAffine affine) {
affine.setLavaAffine(!affine.isLavaAffine());
setDead();
}
return true;
}

View file

@ -34,7 +34,7 @@ class EntityDisguiseRenderer {
public boolean render(Living<?> pony, Disguise disguise,
double x, double y, double z,
float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light) {
float tickDelta, MatrixStack matrices, VertexConsumerProvider vertices, int light) {
int fireTicks = pony.asEntity().doesRenderOnFire() ? 1 : 0;
disguise.update(pony, false);
@ -51,20 +51,20 @@ class EntityDisguiseRenderer {
e.setBoundingBox(pony.asEntity().getBoundingBox());
}
render(ve, e, x, y, z, fireTicks, tickDelta, matrices, vertexConsumers, light);
render(ve, e, x, y, z, fireTicks, tickDelta, matrices, vertices, light);
ve.getAttachments().forEach(ee -> {
PehkUtil.copyScale(pony.asEntity(), ee);
Vec3d difference = ee.getPos().subtract(e.getPos());
render(ve, ee, x + difference.x, y + difference.y, z + difference.z, fireTicks, tickDelta, matrices, vertexConsumers, light);
render(ve, ee, x + difference.x, y + difference.y, z + difference.z, fireTicks, tickDelta, matrices, vertices, light);
PehkUtil.clearScale(ee);
});
matrices.push();
matrices.translate(x, y, z);
SpellEffectsRenderDispatcher.INSTANCE.render(matrices, vertexConsumers, light, pony, 0, 0, tickDelta, pony.asEntity().age + tickDelta, 0, 0);
SpellEffectsRenderDispatcher.INSTANCE.render(matrices, vertices, light, pony, 0, 0, tickDelta, pony.asEntity().age + tickDelta, 0, 0);
matrices.pop();
delegate.afterEntityRender(pony, matrices, light);
delegate.afterEntityRender(pony, matrices, vertices, light);
PehkUtil.clearScale(e);
return true;
}

View file

@ -31,6 +31,7 @@ import net.minecraft.util.math.*;
public class WorldRenderDelegate {
public static final WorldRenderDelegate INSTANCE = new WorldRenderDelegate();
private static final Optional<Vec3d> RED_SKY_COLOR = Optional.of(new Vec3d(1, 0, 0));
private static final Identifier SHADOW_TEXTURE = new Identifier("textures/misc/shadow.png");
private final EntityReplacementManager disguiseLookup = new EntityReplacementManager();
private final EntityDisguiseRenderer disguiseRenderer = new EntityDisguiseRenderer(this);
@ -71,13 +72,23 @@ public class WorldRenderDelegate {
if (MinecraftClient.getInstance().getResourceManager().getResource(frostingTexture).isPresent()) {
recurseFrosting = true;
Immediate immediate = MinecraftClient.getInstance().getBufferBuilders().getEffectVertexConsumers();
client.getEntityRenderDispatcher().render(entity, x, y, z, yaw, tickDelta, matrices, layer -> {
if (RenderLayerUtil.getTexture(layer).orElse(null) == null) {
Identifier texture = RenderLayerUtil.getTexture(layer).orElse(null);
if (texture == null || texture.equals(SHADOW_TEXTURE)) {
return vertices.getBuffer(layer);
}
return VertexConsumers.union(vertices.getBuffer(layer), vertices.getBuffer(RenderLayers.getEntityTranslucent(frostingTexture)));
return VertexConsumers.union(
vertices.getBuffer(layer),
immediate.getBuffer(RenderLayers.getEntityTranslucent(frostingTexture))
);
}, light);
recurseFrosting = false;
immediate.draw();
return true;
}
}
@ -89,14 +100,13 @@ public class WorldRenderDelegate {
return Equine.of(entity).filter(eq -> onEntityRender(eq, x, y, z, yaw, tickDelta, matrices, vertices, light)).isPresent();
}
public void afterEntityRender(Equine<?> pony, MatrixStack matrices, int light) {
public void afterEntityRender(Equine<?> pony, MatrixStack matrices, VertexConsumerProvider vertices, int light) {
if (recurseFrosting) {
return;
}
if (pony instanceof Creature creature && smittenEyesRenderer.isSmitten(creature)) {
Immediate immediate = MinecraftClient.getInstance().getBufferBuilders().getEntityVertexConsumers();
smittenEyesRenderer.render(creature, matrices, immediate, light, 0);
smittenEyesRenderer.render(creature, matrices, vertices, light, 0);
}
if (pony instanceof Pony p) {

View file

@ -27,6 +27,6 @@ abstract class MixinEntityRenderDispatcher {
@Inject(method = RENDER, at = @At("RETURN"))
private <E extends Entity> void afterRender(E entity, double x, double y, double z, float yaw, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo info) {
Equine.of(entity).ifPresent(eq -> WorldRenderDelegate.INSTANCE.afterEntityRender(eq, matrices, light));
Equine.of(entity).ifPresent(eq -> WorldRenderDelegate.INSTANCE.afterEntityRender(eq, matrices, vertexConsumers, light));
}
}