mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 15:17:59 +01:00
Fixed frozen effect rendering on boats when sodium is installed
This commit is contained in:
parent
850aa8a9fd
commit
5d7227f547
4 changed files with 22 additions and 11 deletions
|
@ -30,6 +30,7 @@ public class ChillingBreathSpell extends AbstractSpell implements HomingSpell {
|
||||||
public boolean setTarget(Entity target) {
|
public boolean setTarget(Entity target) {
|
||||||
if (target instanceof LavaAffine affine) {
|
if (target instanceof LavaAffine affine) {
|
||||||
affine.setLavaAffine(!affine.isLavaAffine());
|
affine.setLavaAffine(!affine.isLavaAffine());
|
||||||
|
setDead();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ class EntityDisguiseRenderer {
|
||||||
|
|
||||||
public boolean render(Living<?> pony, Disguise disguise,
|
public boolean render(Living<?> pony, Disguise disguise,
|
||||||
double x, double y, double z,
|
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;
|
int fireTicks = pony.asEntity().doesRenderOnFire() ? 1 : 0;
|
||||||
disguise.update(pony, false);
|
disguise.update(pony, false);
|
||||||
|
|
||||||
|
@ -51,20 +51,20 @@ class EntityDisguiseRenderer {
|
||||||
e.setBoundingBox(pony.asEntity().getBoundingBox());
|
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 -> {
|
ve.getAttachments().forEach(ee -> {
|
||||||
PehkUtil.copyScale(pony.asEntity(), ee);
|
PehkUtil.copyScale(pony.asEntity(), ee);
|
||||||
Vec3d difference = ee.getPos().subtract(e.getPos());
|
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);
|
PehkUtil.clearScale(ee);
|
||||||
});
|
});
|
||||||
|
|
||||||
matrices.push();
|
matrices.push();
|
||||||
matrices.translate(x, y, z);
|
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();
|
matrices.pop();
|
||||||
|
|
||||||
delegate.afterEntityRender(pony, matrices, light);
|
delegate.afterEntityRender(pony, matrices, vertices, light);
|
||||||
PehkUtil.clearScale(e);
|
PehkUtil.clearScale(e);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ import net.minecraft.util.math.*;
|
||||||
public class WorldRenderDelegate {
|
public class WorldRenderDelegate {
|
||||||
public static final WorldRenderDelegate INSTANCE = new 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 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 EntityReplacementManager disguiseLookup = new EntityReplacementManager();
|
||||||
private final EntityDisguiseRenderer disguiseRenderer = new EntityDisguiseRenderer(this);
|
private final EntityDisguiseRenderer disguiseRenderer = new EntityDisguiseRenderer(this);
|
||||||
|
@ -71,13 +72,23 @@ public class WorldRenderDelegate {
|
||||||
|
|
||||||
if (MinecraftClient.getInstance().getResourceManager().getResource(frostingTexture).isPresent()) {
|
if (MinecraftClient.getInstance().getResourceManager().getResource(frostingTexture).isPresent()) {
|
||||||
recurseFrosting = true;
|
recurseFrosting = true;
|
||||||
|
|
||||||
|
Immediate immediate = MinecraftClient.getInstance().getBufferBuilders().getEffectVertexConsumers();
|
||||||
|
|
||||||
client.getEntityRenderDispatcher().render(entity, x, y, z, yaw, tickDelta, matrices, layer -> {
|
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 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);
|
}, light);
|
||||||
recurseFrosting = false;
|
recurseFrosting = false;
|
||||||
|
immediate.draw();
|
||||||
return true;
|
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();
|
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) {
|
if (recurseFrosting) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pony instanceof Creature creature && smittenEyesRenderer.isSmitten(creature)) {
|
if (pony instanceof Creature creature && smittenEyesRenderer.isSmitten(creature)) {
|
||||||
Immediate immediate = MinecraftClient.getInstance().getBufferBuilders().getEntityVertexConsumers();
|
smittenEyesRenderer.render(creature, matrices, vertices, light, 0);
|
||||||
smittenEyesRenderer.render(creature, matrices, immediate, light, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pony instanceof Pony p) {
|
if (pony instanceof Pony p) {
|
||||||
|
|
|
@ -27,6 +27,6 @@ abstract class MixinEntityRenderDispatcher {
|
||||||
|
|
||||||
@Inject(method = RENDER, at = @At("RETURN"))
|
@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) {
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue