mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 15:17:59 +01:00
Update renderers, entity renderers, and models (includes: Bulbs now have their hurt overlay)
This commit is contained in:
parent
8b71579539
commit
db413622a1
32 changed files with 94 additions and 75 deletions
|
@ -22,7 +22,7 @@ public class AnimalPoser {
|
||||||
.filter(eq -> eq instanceof Creature)
|
.filter(eq -> eq instanceof Creature)
|
||||||
.map(Creature.class::cast)
|
.map(Creature.class::cast)
|
||||||
.ifPresent(creature -> {
|
.ifPresent(creature -> {
|
||||||
float tickDelta = MinecraftClient.getInstance().getTickDelta();
|
float tickDelta = MinecraftClient.getInstance().getRenderTickCounter().getTickDelta(false);
|
||||||
float headAngle = creature.getHeadAngle(tickDelta);
|
float headAngle = creature.getHeadAngle(tickDelta);
|
||||||
float neckAngle = 12;
|
float neckAngle = 12;
|
||||||
|
|
||||||
|
|
|
@ -153,7 +153,7 @@ public class DisguisedArmsFeatureRenderer<E extends LivingEntity> implements Acc
|
||||||
}
|
}
|
||||||
|
|
||||||
model.animateModel(entity, 0, 0, 0);
|
model.animateModel(entity, 0, 0, 0);
|
||||||
model.setAngles(entity, 0, 0, 0, 0, client.getTickDelta());
|
model.setAngles(entity, 0, 0, 0, 0, client.getRenderTickCounter().getTickDelta(false));
|
||||||
|
|
||||||
float signum = right ? 1 : -1;
|
float signum = right ? 1 : -1;
|
||||||
float srtSwingProgress = MathHelper.sqrt(swingProgress);
|
float srtSwingProgress = MathHelper.sqrt(swingProgress);
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class HeldEntityFeatureRenderer<E extends LivingEntity> implements Access
|
||||||
@Override
|
@Override
|
||||||
public boolean beforeRenderArms(ArmRenderer sender, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, E entity, int light) {
|
public boolean beforeRenderArms(ArmRenderer sender, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, E entity, int light) {
|
||||||
return Pony.of(entity).flatMap(Pony::getEntityInArms).filter(passenger -> {
|
return Pony.of(entity).flatMap(Pony::getEntityInArms).filter(passenger -> {
|
||||||
float swingProgress = entity.getHandSwingProgress(MinecraftClient.getInstance().getTickDelta());
|
float swingProgress = entity.getHandSwingProgress(MinecraftClient.getInstance().getRenderTickCounter().getTickDelta(false));
|
||||||
float f = -0.4f * MathHelper.sin(MathHelper.sqrt(swingProgress) * (float)Math.PI);
|
float f = -0.4f * MathHelper.sin(MathHelper.sqrt(swingProgress) * (float)Math.PI);
|
||||||
float g = 0.2f * MathHelper.sin(MathHelper.sqrt(swingProgress) * ((float)Math.PI * 2));
|
float g = 0.2f * MathHelper.sin(MathHelper.sqrt(swingProgress) * ((float)Math.PI * 2));
|
||||||
float h = -0.2f * MathHelper.sin(swingProgress * (float)Math.PI);
|
float h = -0.2f * MathHelper.sin(swingProgress * (float)Math.PI);
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class HornFeatureRenderer<E extends LivingEntity> implements AccessoryFea
|
||||||
if (canRender(entity)) {
|
if (canRender(entity)) {
|
||||||
model.setAngles(context.getModel());
|
model.setAngles(context.getModel());
|
||||||
model.setState(false);
|
model.setState(false);
|
||||||
model.render(stack, ItemRenderer.getArmorGlintConsumer(renderContext, RenderLayer.getArmorCutoutNoCull(TEXTURE), false), lightUv, OverlayTexture.DEFAULT_UV, 1, 1, 1, 1);
|
model.render(stack, ItemRenderer.getArmorGlintConsumer(renderContext, RenderLayer.getArmorCutoutNoCull(TEXTURE), false), lightUv, OverlayTexture.DEFAULT_UV, Colors.WHITE);
|
||||||
|
|
||||||
Pony.of(entity).flatMap(pony -> {
|
Pony.of(entity).flatMap(pony -> {
|
||||||
return pony.getAbilities().getActiveStat()
|
return pony.getAbilities().getActiveStat()
|
||||||
|
@ -60,7 +60,7 @@ public class HornFeatureRenderer<E extends LivingEntity> implements AccessoryFea
|
||||||
.map(spell -> spell.getTypeAndTraits().type().getColor()));
|
.map(spell -> spell.getTypeAndTraits().type().getColor()));
|
||||||
}).ifPresent(color -> {
|
}).ifPresent(color -> {
|
||||||
model.setState(true);
|
model.setState(true);
|
||||||
model.render(stack, ItemRenderer.getArmorGlintConsumer(renderContext, RenderLayers.getMagicColored((0x99 << 24) | color), false), lightUv, OverlayTexture.DEFAULT_UV, 1, 1, 1, 1);
|
model.render(stack, ItemRenderer.getArmorGlintConsumer(renderContext, RenderLayers.getMagicColored((0x99 << 24) | color), false), lightUv, OverlayTexture.DEFAULT_UV, Colors.WHITE);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ public final class LeavesAdditionsModel extends ForwardingBakedModel {
|
||||||
public static void bootstrap() {
|
public static void bootstrap() {
|
||||||
ModelLoadingPlugin.register(ctx -> {
|
ModelLoadingPlugin.register(ctx -> {
|
||||||
ctx.modifyModelAfterBake().register(ModelModifier.WRAP_PHASE, (model, context) -> {
|
ctx.modifyModelAfterBake().register(ModelModifier.WRAP_PHASE, (model, context) -> {
|
||||||
Identifier id = context.id();
|
Identifier id = context.resourceId();
|
||||||
if (!id.getPath().endsWith("_flowering") || !(Registries.BLOCK.get(id.withPath(p -> p.replace("block/", "").replace("_flowering", ""))) instanceof FruitBearingBlock)) {
|
if (!id.getPath().endsWith("_flowering") || !(Registries.BLOCK.get(id.withPath(p -> p.replace("block/", "").replace("_flowering", ""))) instanceof FruitBearingBlock)) {
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,6 @@ import net.minecraft.util.math.RotationAxis;
|
||||||
import net.minecraft.registry.Registries;
|
import net.minecraft.registry.Registries;
|
||||||
|
|
||||||
public class PolearmRenderer implements DynamicItemRenderer, ClampedModelPredicateProvider {
|
public class PolearmRenderer implements DynamicItemRenderer, ClampedModelPredicateProvider {
|
||||||
|
|
||||||
private static final PolearmRenderer INSTANCE = new PolearmRenderer();
|
private static final PolearmRenderer INSTANCE = new PolearmRenderer();
|
||||||
private static final Identifier THROWING = Identifier.ofVanilla("throwing");
|
private static final Identifier THROWING = Identifier.ofVanilla("throwing");
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.minelittlepony.unicopia.client.render;
|
package com.minelittlepony.unicopia.client.render;
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
@ -16,7 +15,7 @@ public interface RenderLayerUtil {
|
||||||
static void createUnionBuffer(Consumer<VertexConsumerProvider> action, VertexConsumerProvider vertices, Function<Identifier, RenderLayer> overlayFunction) {
|
static void createUnionBuffer(Consumer<VertexConsumerProvider> action, VertexConsumerProvider vertices, Function<Identifier, RenderLayer> overlayFunction) {
|
||||||
Immediate immediate = MinecraftClient.getInstance().getBufferBuilders().getEffectVertexConsumers();
|
Immediate immediate = MinecraftClient.getInstance().getBufferBuilders().getEffectVertexConsumers();
|
||||||
action.accept(layer -> {
|
action.accept(layer -> {
|
||||||
Identifier texture = RenderLayerUtil.getTexture(layer).orElse(null);
|
Identifier texture = com.minelittlepony.common.util.render.RenderLayerUtil.getTexture(layer).orElse(null);
|
||||||
|
|
||||||
if (texture == null || texture.equals(SHADOW_TEXTURE) || texture.equals(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE)) {
|
if (texture == null || texture.equals(SHADOW_TEXTURE) || texture.equals(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE)) {
|
||||||
return vertices.getBuffer(layer);
|
return vertices.getBuffer(layer);
|
||||||
|
|
|
@ -16,6 +16,7 @@ import net.minecraft.client.render.VertexConsumer;
|
||||||
import net.minecraft.client.render.VertexConsumerProvider;
|
import net.minecraft.client.render.VertexConsumerProvider;
|
||||||
import net.minecraft.client.render.WorldRenderer;
|
import net.minecraft.client.render.WorldRenderer;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
|
import net.minecraft.util.Colors;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.math.Box;
|
import net.minecraft.util.math.Box;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
@ -43,7 +44,7 @@ public class SmittenEyesRenderer {
|
||||||
float scale = 1F + (1.3F + MathHelper.sin(pony.asEntity().age / 3F) * 0.06F);
|
float scale = 1F + (1.3F + MathHelper.sin(pony.asEntity().age / 3F) * 0.06F);
|
||||||
matrices.scale(scale, scale, scale);
|
matrices.scale(scale, scale, scale);
|
||||||
matrices.translate(0, 0.05F, 0);
|
matrices.translate(0, 0.05F, 0);
|
||||||
model.render(matrices, buffer, light, overlay, 1, 1, 1, 1);
|
model.render(matrices, buffer, light, overlay, Colors.WHITE);
|
||||||
|
|
||||||
if (client.getEntityRenderDispatcher().shouldRenderHitboxes()) {
|
if (client.getEntityRenderDispatcher().shouldRenderHitboxes()) {
|
||||||
VertexConsumer lines = vertices.getBuffer(RenderLayer.getLines());
|
VertexConsumer lines = vertices.getBuffer(RenderLayer.getLines());
|
||||||
|
|
|
@ -24,6 +24,7 @@ import net.minecraft.client.render.item.ItemRenderer;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.util.Colors;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
public class WingsFeatureRenderer<E extends LivingEntity> implements AccessoryFeatureRenderer.Feature<E> {
|
public class WingsFeatureRenderer<E extends LivingEntity> implements AccessoryFeatureRenderer.Feature<E> {
|
||||||
|
@ -48,7 +49,7 @@ public class WingsFeatureRenderer<E extends LivingEntity> implements AccessoryFe
|
||||||
VertexConsumer consumer = ItemRenderer.getArmorGlintConsumer(renderContext, RenderLayer.getEntityTranslucent(texture), false);
|
VertexConsumer consumer = ItemRenderer.getArmorGlintConsumer(renderContext, RenderLayer.getEntityTranslucent(texture), false);
|
||||||
|
|
||||||
model.setAngles(entity, context.getModel());
|
model.setAngles(entity, context.getModel());
|
||||||
model.render(matrices, consumer, lightUv, OverlayTexture.DEFAULT_UV, 1, 1, 1, 1);
|
model.render(matrices, consumer, lightUv, OverlayTexture.DEFAULT_UV, Colors.WHITE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,8 +107,8 @@ public class WingsFeatureRenderer<E extends LivingEntity> implements AccessoryFe
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(MatrixStack matrices, VertexConsumer vertexConsumer, int i, int j, float f, float g, float h, float k) {
|
public void render(MatrixStack matrices, VertexConsumer vertexConsumer, int light, int overlay, int color) {
|
||||||
root.render(matrices, vertexConsumer, i, j, f, g, h, k);
|
root.render(matrices, vertexConsumer, light, overlay, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
static class Wing {
|
static class Wing {
|
||||||
|
|
|
@ -134,7 +134,7 @@ public class AirBalloonEntityModel extends EntityModel<AirBalloonEntity> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setAngles(AirBalloonEntity entity, float limbDistance, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) {
|
public void setAngles(AirBalloonEntity entity, float limbDistance, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) {
|
||||||
float tickDelta = MinecraftClient.getInstance().getTickDelta();
|
float tickDelta = MinecraftClient.getInstance().getRenderTickCounter().getTickDelta(false);
|
||||||
inflation = entity.getInflation(tickDelta);
|
inflation = entity.getInflation(tickDelta);
|
||||||
|
|
||||||
root.yaw = MathHelper.PI;
|
root.yaw = MathHelper.PI;
|
||||||
|
@ -230,15 +230,15 @@ public class AirBalloonEntityModel extends EntityModel<AirBalloonEntity> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(MatrixStack matrices, VertexConsumer vertexConsumer, int light, int overlay, float r, float g, float b, float a) {
|
public void render(MatrixStack matrices, VertexConsumer vertexConsumer, int light, int overlay, int color) {
|
||||||
if (isBalloon) {
|
if (isBalloon) {
|
||||||
matrices.push();
|
matrices.push();
|
||||||
matrices.translate(0, 1 * (1 - inflation), 0);
|
matrices.translate(0, 1 * (1 - inflation), 0);
|
||||||
matrices.scale(1, MathHelper.lerp(inflation, -0.05F, 1), 1);
|
matrices.scale(1, MathHelper.lerp(inflation, -0.05F, 1), 1);
|
||||||
root.render(matrices, vertexConsumer, light, overlay, r, g, b, a);
|
root.render(matrices, vertexConsumer, light, overlay, color);
|
||||||
matrices.pop();
|
matrices.pop();
|
||||||
} else {
|
} else {
|
||||||
root.render(matrices, vertexConsumer, light, overlay, r, g, b, a);
|
root.render(matrices, vertexConsumer, light, overlay, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -17,6 +17,7 @@ import net.minecraft.client.render.entity.feature.FeatureRenderer;
|
||||||
import net.minecraft.client.render.entity.feature.FeatureRendererContext;
|
import net.minecraft.client.render.entity.feature.FeatureRendererContext;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.item.Items;
|
import net.minecraft.item.Items;
|
||||||
|
import net.minecraft.util.Colors;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
|
@ -89,7 +90,7 @@ public class AirBalloonEntityRenderer extends MobEntityRenderer<AirBalloonEntity
|
||||||
if (texture.getPath().indexOf("sandbags") != -1) {
|
if (texture.getPath().indexOf("sandbags") != -1) {
|
||||||
model = new AirBalloonEntityModel(AirBalloonEntityModel.getSandbagsModelData().createModel());
|
model = new AirBalloonEntityModel(AirBalloonEntityModel.getSandbagsModelData().createModel());
|
||||||
}
|
}
|
||||||
render(getModel(), model, texture, matrices, vertices, lightFunc.apply(light, entity), entity, limbAngle, limbDistance, 0, yaw, pitch, tickDelta, 1, 1, 1);
|
render(getModel(), model, texture, matrices, vertices, lightFunc.apply(light, entity), entity, limbAngle, limbDistance, 0, yaw, pitch, tickDelta, Colors.WHITE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,13 +42,13 @@ public class ButterflyEntityRenderer extends MobEntityRenderer<ButterflyEntity,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setupTransforms(ButterflyEntity entity, MatrixStack matrices, float age, float yaw, float ticks) {
|
protected void setupTransforms(ButterflyEntity entity, MatrixStack matrices, float age, float yaw, float ticks, float scale) {
|
||||||
|
|
||||||
if (!entity.isResting()) {
|
if (!entity.isResting()) {
|
||||||
matrices.translate(0, MathHelper.cos(age / 3F) / 10F, 0);
|
matrices.translate(0, MathHelper.cos(age / 3F) / 10F, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
super.setupTransforms(entity, matrices, age, yaw, ticks);
|
super.setupTransforms(entity, matrices, age, yaw, ticks, scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -65,7 +65,7 @@ public class ButterflyEntityRenderer extends MobEntityRenderer<ButterflyEntity,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getSkyLight(ButterflyEntity entity, BlockPos pos) {
|
protected int getSkyLight(ButterflyEntity entity, BlockPos pos) {
|
||||||
return (int)(super.getSkyLight(entity, pos) * (entity.getWorld() instanceof ClientWorld w ? w.getSkyBrightness(MinecraftClient.getInstance().getTickDelta()) : 1));
|
return (int)(super.getSkyLight(entity, pos) * (entity.getWorld() instanceof ClientWorld w ? w.getSkyBrightness(MinecraftClient.getInstance().getRenderTickCounter().getTickDelta(false)) : 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ButterflyEntityModel extends EntityModel<ButterflyEntity> {
|
public static class ButterflyEntityModel extends EntityModel<ButterflyEntity> {
|
||||||
|
@ -96,8 +96,8 @@ public class ButterflyEntityRenderer extends MobEntityRenderer<ButterflyEntity,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(MatrixStack matrices, VertexConsumer vertexConsumer, int light, int overlay, float red, float green, float blue, float alpha) {
|
public void render(MatrixStack matrices, VertexConsumer vertexConsumer, int light, int overlay, int color) {
|
||||||
body.render(matrices, vertexConsumer, light, overlay, red, green, blue, alpha);
|
body.render(matrices, vertexConsumer, light, overlay, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -2,7 +2,6 @@ package com.minelittlepony.unicopia.client.render.entity;
|
||||||
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import com.minelittlepony.common.util.Color;
|
|
||||||
import com.minelittlepony.unicopia.Unicopia;
|
import com.minelittlepony.unicopia.Unicopia;
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.Spell;
|
import com.minelittlepony.unicopia.ability.magic.spell.Spell;
|
||||||
import com.minelittlepony.unicopia.client.render.model.PlaneModel;
|
import com.minelittlepony.unicopia.client.render.model.PlaneModel;
|
||||||
|
@ -18,6 +17,7 @@ import net.minecraft.client.render.entity.EntityRendererFactory;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.screen.PlayerScreenHandler;
|
import net.minecraft.screen.PlayerScreenHandler;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
import net.minecraft.util.math.ColorHelper.Argb;
|
||||||
import net.minecraft.util.math.RotationAxis;
|
import net.minecraft.util.math.RotationAxis;
|
||||||
|
|
||||||
public class CastSpellEntityRenderer extends EntityRenderer<CastSpellEntity> {
|
public class CastSpellEntityRenderer extends EntityRenderer<CastSpellEntity> {
|
||||||
|
@ -71,10 +71,6 @@ public class CastSpellEntityRenderer extends EntityRenderer<CastSpellEntity> {
|
||||||
|
|
||||||
int color = spell == null ? 0 : spell.getTypeAndTraits().type().getColor();
|
int color = spell == null ? 0 : spell.getTypeAndTraits().type().getColor();
|
||||||
|
|
||||||
float red = Color.r(color);
|
|
||||||
float green = Color.g(color);
|
|
||||||
float blue = Color.b(color);
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
SpellRenderer<?> renderer = spell == null ? null : SpellEffectsRenderDispatcher.INSTANCE.getRenderer(spell);
|
SpellRenderer<?> renderer = spell == null ? null : SpellEffectsRenderDispatcher.INSTANCE.getRenderer(spell);
|
||||||
|
|
||||||
|
@ -91,7 +87,7 @@ public class CastSpellEntityRenderer extends EntityRenderer<CastSpellEntity> {
|
||||||
matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(angle * ringSpeed));
|
matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(angle * ringSpeed));
|
||||||
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(angle * ringSpeed * dim));
|
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(angle * ringSpeed * dim));
|
||||||
matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(angle * ringSpeed * dim));
|
matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(angle * ringSpeed * dim));
|
||||||
PlaneModel.INSTANCE.render(matrices, buffer, light, 0, 1, red, green, blue, scale / ((float)(dim * 3) + 1));
|
PlaneModel.INSTANCE.render(matrices, buffer, light, 0, 1, Argb.withAlpha(color, (int)(255 * (scale / ((float)(dim * 3) + 1)))));
|
||||||
matrices.pop();
|
matrices.pop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class CrystalShardsEntityModel extends EntityModel<CrystalShardsEntity> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(MatrixStack matrices, VertexConsumer vertexConsumer, int light, int overlay, float red, float green, float blue, float alpha) {
|
public void render(MatrixStack matrices, VertexConsumer vertexConsumer, int light, int overlay, int color) {
|
||||||
part.render(matrices, vertexConsumer, light, overlay, red, green, blue, alpha);
|
part.render(matrices, vertexConsumer, light, overlay, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -10,6 +10,7 @@ import net.minecraft.client.render.VertexConsumerProvider;
|
||||||
import net.minecraft.client.render.entity.EntityRenderer;
|
import net.minecraft.client.render.entity.EntityRenderer;
|
||||||
import net.minecraft.client.render.entity.EntityRendererFactory;
|
import net.minecraft.client.render.entity.EntityRendererFactory;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
|
import net.minecraft.util.Colors;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.math.RotationAxis;
|
import net.minecraft.util.math.RotationAxis;
|
||||||
|
|
||||||
|
@ -39,7 +40,7 @@ public class CrystalShardsEntityRenderer extends EntityRenderer<CrystalShardsEnt
|
||||||
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(yaw));
|
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(yaw));
|
||||||
|
|
||||||
model.setAngles(entity, 0, 0, 0, 0, 0);
|
model.setAngles(entity, 0, 0, 0, 0, 0);
|
||||||
model.render(matrices, vertices.getBuffer(model.getLayer(getTexture(entity))), light, OverlayTexture.DEFAULT_UV, 1, 1, 1, 1);
|
model.render(matrices, vertices.getBuffer(model.getLayer(getTexture(entity))), light, OverlayTexture.DEFAULT_UV, Colors.WHITE);
|
||||||
matrices.pop();
|
matrices.pop();
|
||||||
super.render(entity, yaw, tickDelta, matrices, vertices, light);
|
super.render(entity, yaw, tickDelta, matrices, vertices, light);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,8 @@ import net.minecraft.client.render.entity.model.EntityModel;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.screen.PlayerScreenHandler;
|
import net.minecraft.screen.PlayerScreenHandler;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
import net.minecraft.util.math.ColorHelper;
|
||||||
|
import net.minecraft.util.math.ColorHelper.Argb;
|
||||||
|
|
||||||
public class FairyEntityRenderer extends MobEntityRenderer<FairyEntity, FairyEntityRenderer.Model> {
|
public class FairyEntityRenderer extends MobEntityRenderer<FairyEntity, FairyEntityRenderer.Model> {
|
||||||
public FairyEntityRenderer(EntityRendererFactory.Context context) {
|
public FairyEntityRenderer(EntityRendererFactory.Context context) {
|
||||||
|
@ -31,14 +33,15 @@ public class FairyEntityRenderer extends MobEntityRenderer<FairyEntity, FairyEnt
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(MatrixStack matrices, VertexConsumer vertexConsumer, int light, int overlay, float red, float green, float blue, float alpha) {
|
public void render(MatrixStack matrices, VertexConsumer vertexConsumer, int light, int overlay, int color) {
|
||||||
float thickness = 0.05F;
|
float thickness = 0.05F;
|
||||||
|
|
||||||
matrices.push();
|
matrices.push();
|
||||||
matrices.translate(0, 1.5, 0);
|
matrices.translate(0, 1.5, 0);
|
||||||
|
|
||||||
SphereModel.SPHERE.render(matrices, vertexConsumer, light, overlay, radius - thickness, red, green, blue, 0.5F);
|
|
||||||
SphereModel.SPHERE.render(matrices, vertexConsumer, light, overlay, radius, red, green, blue, 0.3F);
|
SphereModel.SPHERE.render(matrices, vertexConsumer, light, overlay, radius - thickness, Argb.withAlpha(color, 127));
|
||||||
|
SphereModel.SPHERE.render(matrices, vertexConsumer, light, overlay, radius, Argb.withAlpha(color, 85));
|
||||||
|
|
||||||
matrices.pop();
|
matrices.pop();
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,8 +81,7 @@ public class FloatingArtefactEntityRenderer extends EntityRenderer<FloatingArtef
|
||||||
final MatrixStack.Entry entry = matrices.peek();
|
final MatrixStack.Entry entry = matrices.peek();
|
||||||
final OverlayVertexConsumer destructionOverlay = new OverlayVertexConsumer(
|
final OverlayVertexConsumer destructionOverlay = new OverlayVertexConsumer(
|
||||||
MinecraftClient.getInstance().getBufferBuilders().getEffectVertexConsumers().getBuffer(RenderLayers.getCrumbling(MathHelper.clamp(stage, 0, ModelLoader.field_32983 - 1))),
|
MinecraftClient.getInstance().getBufferBuilders().getEffectVertexConsumers().getBuffer(RenderLayers.getCrumbling(MathHelper.clamp(stage, 0, ModelLoader.field_32983 - 1))),
|
||||||
entry.getPositionMatrix(),
|
entry,
|
||||||
entry.getNormalMatrix(),
|
|
||||||
scale
|
scale
|
||||||
);
|
);
|
||||||
return layer -> layer.hasCrumbling() ? VertexConsumers.union(destructionOverlay, vertices.getBuffer(layer)) : vertices.getBuffer(layer);
|
return layer -> layer.hasCrumbling() ? VertexConsumers.union(destructionOverlay, vertices.getBuffer(layer)) : vertices.getBuffer(layer);
|
||||||
|
|
|
@ -79,7 +79,7 @@ public class IgnominiousBulbEntityModel extends EntityModel<IgnominiousBulbEntit
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(MatrixStack matrices, VertexConsumer vertices, int light, int overlay, float red, float green, float blue, float alpha) {
|
public void render(MatrixStack matrices, VertexConsumer vertices, int light, int overlay, int color) {
|
||||||
part.render(matrices, vertices, light, overlay);
|
part.render(matrices, vertices, light, overlay, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import net.minecraft.client.render.VertexConsumerProvider;
|
||||||
import net.minecraft.client.render.entity.EntityRenderer;
|
import net.minecraft.client.render.entity.EntityRenderer;
|
||||||
import net.minecraft.client.render.entity.EntityRendererFactory;
|
import net.minecraft.client.render.entity.EntityRendererFactory;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
|
import net.minecraft.util.Colors;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
public class IgnominiousBulbEntityRenderer extends EntityRenderer<IgnominiousBulbEntity> {
|
public class IgnominiousBulbEntityRenderer extends EntityRenderer<IgnominiousBulbEntity> {
|
||||||
|
@ -27,7 +28,7 @@ public class IgnominiousBulbEntityRenderer extends EntityRenderer<IgnominiousBul
|
||||||
matrices.translate(0, -1.5F, 0);
|
matrices.translate(0, -1.5F, 0);
|
||||||
|
|
||||||
model.setAngles(entity, 0, 0, tickDelta, 180 + yaw, entity.getPitch(tickDelta));
|
model.setAngles(entity, 0, 0, tickDelta, 180 + yaw, entity.getPitch(tickDelta));
|
||||||
model.render(matrices, vertices.getBuffer(model.getLayer(getTexture(entity))), light, OverlayTexture.DEFAULT_UV, 1, 1, 1, 1);
|
model.render(matrices, vertices.getBuffer(model.getLayer(getTexture(entity))), light, OverlayTexture.getUv(0, entity.hurtTime > 0), Colors.WHITE);
|
||||||
matrices.pop();
|
matrices.pop();
|
||||||
super.render(entity, yaw, tickDelta, matrices, vertices, light);
|
super.render(entity, yaw, tickDelta, matrices, vertices, light);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ import net.minecraft.client.render.entity.EntityRendererFactory;
|
||||||
import net.minecraft.client.render.entity.model.EntityModel;
|
import net.minecraft.client.render.entity.model.EntityModel;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.screen.PlayerScreenHandler;
|
import net.minecraft.screen.PlayerScreenHandler;
|
||||||
|
import net.minecraft.util.Colors;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
@ -61,7 +62,7 @@ public class MagicBeamEntityRenderer extends EntityRenderer<MagicBeamEntity> {
|
||||||
.map(RenderLayers::getMagicColored)
|
.map(RenderLayers::getMagicColored)
|
||||||
.orElseGet(RenderLayers::getMagicColored);
|
.orElseGet(RenderLayers::getMagicColored);
|
||||||
|
|
||||||
model.render(matrices, vertexConsumers.getBuffer(layer), light, OverlayTexture.DEFAULT_UV, 1, 1, 1, 1);
|
model.render(matrices, vertexConsumers.getBuffer(layer), light, OverlayTexture.DEFAULT_UV, Colors.WHITE);
|
||||||
|
|
||||||
matrices.pop();
|
matrices.pop();
|
||||||
super.render(entity, yaw, tickDelta, matrices, vertexConsumers, light);
|
super.render(entity, yaw, tickDelta, matrices, vertexConsumers, light);
|
||||||
|
@ -94,8 +95,8 @@ public class MagicBeamEntityRenderer extends EntityRenderer<MagicBeamEntity> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(MatrixStack matrices, VertexConsumer vertexConsumer, int light, int overlay, float red, float green, float blue, float alpha) {
|
public void render(MatrixStack matrices, VertexConsumer vertexConsumer, int light, int overlay, int color) {
|
||||||
part.render(matrices, vertexConsumer, light, overlay, red, green, blue, alpha);
|
part.render(matrices, vertexConsumer, light, overlay, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,8 +169,8 @@ public class MimicEntityRenderer extends MobEntityRenderer<MimicEntity, MimicEnt
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(MatrixStack matrices, VertexConsumer vertices, int light, int overlay, float red, float green, float blue, float alpha) {
|
public void render(MatrixStack matrices, VertexConsumer vertices, int light, int overlay, int color) {
|
||||||
part.render(matrices, vertices, light, overlay);
|
part.render(matrices, vertices, light, overlay, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -114,7 +114,7 @@ public class SombraEntityModel extends EntityModel<SombraEntity> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(MatrixStack matrices, VertexConsumer vertexConsumer, int light, int overlay, float red, float green, float blue, float alpha) {
|
public void render(MatrixStack matrices, VertexConsumer vertexConsumer, int light, int overlay, int color) {
|
||||||
part.render(matrices, vertexConsumer, light, overlay, red, green, blue, alpha);
|
part.render(matrices, vertexConsumer, light, overlay, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -34,7 +34,7 @@ public class SpecterEntityRenderer extends BipedEntityRenderer<SpecterEntity, Sp
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(MatrixStack matrices, VertexConsumer vertices, int light, int overlay, float red, float green, float blue, float alpha) {
|
public void render(MatrixStack matrices, VertexConsumer vertices, int light, int overlay, int color) {
|
||||||
// noop
|
// noop
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.minelittlepony.unicopia.client.render.entity;
|
package com.minelittlepony.unicopia.client.render.entity;
|
||||||
|
|
||||||
import org.joml.Matrix3f;
|
|
||||||
import org.joml.Matrix4f;
|
import org.joml.Matrix4f;
|
||||||
|
|
||||||
import com.minelittlepony.unicopia.Unicopia;
|
import com.minelittlepony.unicopia.Unicopia;
|
||||||
|
@ -39,13 +38,14 @@ public class SpellbookEntityRenderer extends LivingEntityRenderer<SpellbookEntit
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setupTransforms(SpellbookEntity entity, MatrixStack matrices, float f, float g, float partialTicks) {
|
protected void setupTransforms(SpellbookEntity entity, MatrixStack matrices, float animationProgress, float bodyYaw, float tickDelta, float scale) {
|
||||||
super.setupTransforms(entity, matrices, f, g + 90, partialTicks);
|
super.setupTransforms(entity, matrices, animationProgress, bodyYaw + 90, tickDelta, scale);
|
||||||
|
|
||||||
if (entity.isOpen()) {
|
if (entity.isOpen()) {
|
||||||
matrices.translate(-1.25F, -0.35F, 0);
|
// TODO: Check that this is correct for extreme scales
|
||||||
|
matrices.translate(-1.25F * scale, -0.35F * scale, 0);
|
||||||
|
|
||||||
float floatPosition = MathHelper.sin((entity.age + partialTicks + entity.getId()) / 20) * 0.04F;
|
float floatPosition = MathHelper.sin((animationProgress + entity.getId()) / 20) * 0.04F;
|
||||||
|
|
||||||
matrices.translate(0, floatPosition, 0);
|
matrices.translate(0, floatPosition, 0);
|
||||||
matrices.multiply(RotationAxis.NEGATIVE_Z.rotationDegrees(60));
|
matrices.multiply(RotationAxis.NEGATIVE_Z.rotationDegrees(60));
|
||||||
|
@ -122,16 +122,15 @@ public class SpellbookEntityRenderer extends LivingEntityRenderer<SpellbookEntit
|
||||||
float minU = 0;
|
float minU = 0;
|
||||||
MatrixStack.Entry entry = matrices.peek();
|
MatrixStack.Entry entry = matrices.peek();
|
||||||
Matrix4f positionMat = entry.getPositionMatrix();
|
Matrix4f positionMat = entry.getPositionMatrix();
|
||||||
Matrix3f normalMat = entry.getNormalMatrix();
|
|
||||||
|
|
||||||
for (int i = 1; i <= sides; i++) {
|
for (int i = 1; i <= sides; i++) {
|
||||||
float o = MathHelper.sin(i * MathHelper.TAU / sides) * diameter;
|
float o = MathHelper.sin(i * MathHelper.TAU / sides) * diameter;
|
||||||
float p = MathHelper.cos(i * MathHelper.TAU / sides) * diameter;
|
float p = MathHelper.cos(i * MathHelper.TAU / sides) * diameter;
|
||||||
float maxU = i / (float)sides;
|
float maxU = i / (float)sides;
|
||||||
buffer.vertex(positionMat, segmentX * 0.2F, segmentY * 0.2F, 0).color(0, 0, 0, 255).texture(minU, minV).overlay(OverlayTexture.DEFAULT_UV).light(light).normal(normalMat, 0, -1, 0).next();
|
buffer.vertex(positionMat, segmentX * 0.2F, segmentY * 0.2F, 0).color(0, 0, 0, 255).texture(minU, minV).overlay(OverlayTexture.DEFAULT_UV).light(light).normal(entry, 0, -1, 0);
|
||||||
buffer.vertex(positionMat, segmentX, segmentY, distance).color(r, g, b, 1).texture(minU, maxV).overlay(OverlayTexture.DEFAULT_UV).light(light).normal(normalMat, 0, -1, 0).next();
|
buffer.vertex(positionMat, segmentX, segmentY, distance).color(r, g, b, 1).texture(minU, maxV).overlay(OverlayTexture.DEFAULT_UV).light(light).normal(entry, 0, -1, 0);
|
||||||
buffer.vertex(positionMat, o, p, distance).color(r, g, b, 1).texture(maxU, maxV).overlay(OverlayTexture.DEFAULT_UV).light(light).normal(normalMat, 0, -1, 0).next();
|
buffer.vertex(positionMat, o, p, distance).color(r, g, b, 1).texture(maxU, maxV).overlay(OverlayTexture.DEFAULT_UV).light(light).normal(entry, 0, -1, 0);
|
||||||
buffer.vertex(positionMat, o * 0.2F, p * 0.2F, 0).color(0, 0, 0, 255).texture(maxU, minV).overlay(OverlayTexture.DEFAULT_UV).light(light).normal(normalMat, 0, -1, 0).next();
|
buffer.vertex(positionMat, o * 0.2F, p * 0.2F, 0).color(0, 0, 0, 255).texture(maxU, minV).overlay(OverlayTexture.DEFAULT_UV).light(light).normal(entry, 0, -1, 0);
|
||||||
segmentX = o;
|
segmentX = o;
|
||||||
segmentY = p;
|
segmentY = p;
|
||||||
minU = maxU;
|
minU = maxU;
|
||||||
|
|
|
@ -24,8 +24,8 @@ public class SpellbookModel extends EntityModel<SpellbookEntity> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(MatrixStack matrices, VertexConsumer vertexConsumer, int light, int overlay, float red, float green, float blue, float alpha) {
|
public void render(MatrixStack matrices, VertexConsumer vertexConsumer, int light, int overlay, int color) {
|
||||||
book.render(matrices, vertexConsumer, light, overlay, red, green, blue, alpha);
|
book.render(matrices, vertexConsumer, light, overlay, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -116,11 +116,11 @@ public class StormCloudEntityModel extends EntityModel<StormCloudEntity> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(MatrixStack matrices, VertexConsumer vertexConsumer, int light, int overlay, float red, float green, float blue, float alpha) {
|
public void render(MatrixStack matrices, VertexConsumer vertexConsumer, int light, int overlay, int color) {
|
||||||
matrices.push();
|
matrices.push();
|
||||||
part.rotate(matrices);
|
part.rotate(matrices);
|
||||||
smallPuffs.render(matrices, vertexConsumer, light, overlay, red, green, blue, alpha);
|
smallPuffs.render(matrices, vertexConsumer, light, overlay, color);
|
||||||
anvilHeads.render(matrices, vertexConsumer, light, overlay, red, green, blue, alpha);
|
anvilHeads.render(matrices, vertexConsumer, light, overlay, color);
|
||||||
|
|
||||||
|
|
||||||
int puffCount = rng.nextInt(7);
|
int puffCount = rng.nextInt(7);
|
||||||
|
@ -131,7 +131,7 @@ public class StormCloudEntityModel extends EntityModel<StormCloudEntity> {
|
||||||
rng.nextGaussian(),
|
rng.nextGaussian(),
|
||||||
rng.nextGaussian()
|
rng.nextGaussian()
|
||||||
).mul(16));
|
).mul(16));
|
||||||
puff.render(matrices, vertexConsumer, light, overlay, red, green, blue, alpha);
|
puff.render(matrices, vertexConsumer, light, overlay, color);
|
||||||
}
|
}
|
||||||
matrices.pop();
|
matrices.pop();
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,11 +9,14 @@ import net.minecraft.client.render.VertexConsumerProvider;
|
||||||
import net.minecraft.client.render.entity.EntityRenderer;
|
import net.minecraft.client.render.entity.EntityRenderer;
|
||||||
import net.minecraft.client.render.entity.EntityRendererFactory;
|
import net.minecraft.client.render.entity.EntityRendererFactory;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
|
import net.minecraft.util.Colors;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
import net.minecraft.util.math.ColorHelper.Argb;
|
||||||
import net.minecraft.util.math.RotationAxis;
|
import net.minecraft.util.math.RotationAxis;
|
||||||
|
|
||||||
public class StormCloudEntityRenderer extends EntityRenderer<StormCloudEntity> {
|
public class StormCloudEntityRenderer extends EntityRenderer<StormCloudEntity> {
|
||||||
private static final Identifier TEXTURE = Unicopia.id("textures/entity/storm_cloud.png");
|
private static final Identifier TEXTURE = Unicopia.id("textures/entity/storm_cloud.png");
|
||||||
|
private static final int DEFAULT_COLOR = Argb.withAlpha(Colors.WHITE, (int)(255 * 0.9F));
|
||||||
|
|
||||||
private final StormCloudEntityModel model;
|
private final StormCloudEntityModel model;
|
||||||
|
|
||||||
|
@ -33,10 +36,11 @@ public class StormCloudEntityRenderer extends EntityRenderer<StormCloudEntity> {
|
||||||
matrices.scale(scale, scale, scale);
|
matrices.scale(scale, scale, scale);
|
||||||
matrices.translate(0, -1.45F, 0);
|
matrices.translate(0, -1.45F, 0);
|
||||||
|
|
||||||
|
|
||||||
model.setAngles(entity, 0, 0, 0, 0, 0);
|
model.setAngles(entity, 0, 0, 0, 0, 0);
|
||||||
model.render(matrices, vertices.getBuffer(model.getLayer(getTexture(entity))),
|
model.render(matrices, vertices.getBuffer(model.getLayer(getTexture(entity))),
|
||||||
entity.isStormy() ? 0 : light,
|
entity.isStormy() ? 0 : light,
|
||||||
OverlayTexture.DEFAULT_UV, 1, 1, 1, 0.9F);
|
OverlayTexture.DEFAULT_UV, DEFAULT_COLOR);
|
||||||
matrices.pop();
|
matrices.pop();
|
||||||
super.render(entity, yaw, tickDelta, matrices, vertices, light);
|
super.render(entity, yaw, tickDelta, matrices, vertices, light);
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,7 +141,7 @@ public class TentacleEntityModel extends EntityModel<TentacleEntity> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(MatrixStack matrices, VertexConsumer vertices, int light, int overlay, float red, float green, float blue, float alpha) {
|
public void render(MatrixStack matrices, VertexConsumer vertices, int light, int overlay, int color) {
|
||||||
part.render(matrices, vertices, light, overlay);
|
part.render(matrices, vertices, light, overlay, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,6 +8,7 @@ import net.minecraft.client.render.VertexConsumerProvider;
|
||||||
import net.minecraft.client.render.entity.EntityRenderer;
|
import net.minecraft.client.render.entity.EntityRenderer;
|
||||||
import net.minecraft.client.render.entity.EntityRendererFactory;
|
import net.minecraft.client.render.entity.EntityRendererFactory;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
|
import net.minecraft.util.Colors;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
|
@ -32,7 +33,7 @@ public class TentacleEntityRenderer extends EntityRenderer<TentacleEntity> {
|
||||||
matrices.scale(scale, scale, scale);
|
matrices.scale(scale, scale, scale);
|
||||||
|
|
||||||
model.setAngles(entity, 0, 0, tickDelta, entity.getYaw(tickDelta), entity.getPitch(tickDelta));
|
model.setAngles(entity, 0, 0, tickDelta, entity.getYaw(tickDelta), entity.getPitch(tickDelta));
|
||||||
model.render(matrices, vertices.getBuffer(model.getLayer(getTexture(entity))), light, OverlayTexture.DEFAULT_UV, 1, 1, 1, 1);
|
model.render(matrices, vertices.getBuffer(model.getLayer(getTexture(entity))), light, OverlayTexture.getUv(0, entity.hurtTime > 0), Colors.WHITE);
|
||||||
matrices.pop();
|
matrices.pop();
|
||||||
super.render(entity, yaw, tickDelta, matrices, vertices, light);
|
super.render(entity, yaw, tickDelta, matrices, vertices, light);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class BakedModel {
|
||||||
vertices.add(new RenderUtil.Vertex(x, y, z, u, v));
|
vertices.add(new RenderUtil.Vertex(x, y, z, u, v));
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void render(MatrixStack matrices, VertexConsumer buffer, int light, int overlay, float scale, float r, float g, float b, float a) {
|
public final void render(MatrixStack matrices, VertexConsumer buffer, int light, int overlay, float scale, int color) {
|
||||||
scale = Math.abs(scale);
|
scale = Math.abs(scale);
|
||||||
if (scale < 0.001F) {
|
if (scale < 0.001F) {
|
||||||
return;
|
return;
|
||||||
|
@ -44,13 +44,13 @@ public class BakedModel {
|
||||||
for (RenderUtil.Vertex vertex : vertices) {
|
for (RenderUtil.Vertex vertex : vertices) {
|
||||||
Vector4f pos = vertex.position(positionmatrix);
|
Vector4f pos = vertex.position(positionmatrix);
|
||||||
Vector4f tex = vertex.texture(textureMatrix);
|
Vector4f tex = vertex.texture(textureMatrix);
|
||||||
buffer.vertex(pos.x, pos.y, pos.z, r, g, b, a, tex.x, tex.y, overlay, light, 0, 0, 0);
|
buffer.vertex(pos.x, pos.y, pos.z, color, tex.x, tex.y, overlay, light, 0, 0, 0);
|
||||||
}
|
}
|
||||||
matrices.pop();
|
matrices.pop();
|
||||||
textureMatrix.identity();
|
textureMatrix.identity();
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void render(MatrixStack matrices, VertexConsumer buffer, int light, float scale, float r, float g, float b, float a) {
|
public final void render(MatrixStack matrices, VertexConsumer buffer, int light, float scale, int color) {
|
||||||
scale = Math.abs(scale);
|
scale = Math.abs(scale);
|
||||||
if (scale < 0.001F) {
|
if (scale < 0.001F) {
|
||||||
return;
|
return;
|
||||||
|
@ -62,7 +62,7 @@ public class BakedModel {
|
||||||
for (RenderUtil.Vertex vertex : vertices) {
|
for (RenderUtil.Vertex vertex : vertices) {
|
||||||
Vector4f pos = vertex.position(positionmatrix);
|
Vector4f pos = vertex.position(positionmatrix);
|
||||||
Vector4f tex = vertex.texture(textureMatrix);
|
Vector4f tex = vertex.texture(textureMatrix);
|
||||||
buffer.vertex(pos.x, pos.y, pos.z).texture(tex.x, tex.y).color(r, g, b, a).light(getLightAt(pos, light)).next();
|
buffer.vertex(pos.x, pos.y, pos.z).texture(tex.x, tex.y).color(color).light(getLightAt(pos, light));
|
||||||
}
|
}
|
||||||
matrices.pop();
|
matrices.pop();
|
||||||
textureMatrix.identity();
|
textureMatrix.identity();
|
||||||
|
|
|
@ -6,7 +6,6 @@ import org.joml.Vector2f;
|
||||||
import org.joml.Vector3f;
|
import org.joml.Vector3f;
|
||||||
import org.joml.Vector4f;
|
import org.joml.Vector4f;
|
||||||
|
|
||||||
import com.minelittlepony.common.util.Color;
|
|
||||||
import com.minelittlepony.unicopia.client.render.RenderUtil;
|
import com.minelittlepony.unicopia.client.render.RenderUtil;
|
||||||
import com.minelittlepony.unicopia.client.render.RenderUtil.Vertex;
|
import com.minelittlepony.unicopia.client.render.RenderUtil.Vertex;
|
||||||
|
|
||||||
|
@ -60,7 +59,6 @@ public class CubeModel {
|
||||||
float x0, float y0, float z0, float x1, float y1, float z1,
|
float x0, float y0, float z0, float x1, float y1, float z1,
|
||||||
int color, int light, int overlay,
|
int color, int light, int overlay,
|
||||||
Direction... directions) {
|
Direction... directions) {
|
||||||
float r = Color.r(color), g = Color.g(color), b = Color.b(color);
|
|
||||||
float du = u1 - u0, dv = v1 - v0;
|
float du = u1 - u0, dv = v1 - v0;
|
||||||
float dx = x1 - x0, dy = y1 - y0, dz = z1 - z0;
|
float dx = x1 - x0, dy = y1 - y0, dz = z1 - z0;
|
||||||
Matrix4f position = matrices.peek().getPositionMatrix();
|
Matrix4f position = matrices.peek().getPositionMatrix();
|
||||||
|
@ -70,7 +68,7 @@ public class CubeModel {
|
||||||
Vector4f pos = position.transform(RenderUtil.TEMP_VECTOR.set(vertex.position(), 1).mul(dx, dy, dz, 1).add(x0, y0, z0, 0));
|
Vector4f pos = position.transform(RenderUtil.TEMP_VECTOR.set(vertex.position(), 1).mul(dx, dy, dz, 1).add(x0, y0, z0, 0));
|
||||||
Vector2f tex = TEMP_UV_VECTOR.set(vertex.texture().x, vertex.texture().y).mul(du, dv).add(u0, v0);
|
Vector2f tex = TEMP_UV_VECTOR.set(vertex.texture().x, vertex.texture().y).mul(du, dv).add(u0, v0);
|
||||||
Vector3f norm = normal.transform(RenderUtil.TEMP_NORMAL_VECTOR.set(direction.getOffsetX(), direction.getOffsetY(), direction.getOffsetZ()));
|
Vector3f norm = normal.transform(RenderUtil.TEMP_NORMAL_VECTOR.set(direction.getOffsetX(), direction.getOffsetY(), direction.getOffsetZ()));
|
||||||
buffer.vertex(pos.x, pos.y, pos.z, r, g, b, 1, tex.x, tex.y, overlay, light, norm.x, norm.y, norm.z);
|
buffer.vertex(pos.x, pos.y, pos.z, color, tex.x, tex.y, overlay, light, norm.x, norm.y, norm.z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ import com.minelittlepony.unicopia.util.shape.Sphere;
|
||||||
|
|
||||||
import net.minecraft.command.argument.EntityAnchorArgumentType.EntityAnchor;
|
import net.minecraft.command.argument.EntityAnchorArgumentType.EntityAnchor;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.EntityStatuses;
|
||||||
import net.minecraft.entity.EntityType;
|
import net.minecraft.entity.EntityType;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.entity.MovementType;
|
import net.minecraft.entity.MovementType;
|
||||||
|
@ -55,6 +56,8 @@ public class TentacleEntity extends AbstractDecorationEntity {
|
||||||
private int ticksActive;
|
private int ticksActive;
|
||||||
private int prevMotionOffset;
|
private int prevMotionOffset;
|
||||||
|
|
||||||
|
public int hurtTime;
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private LivingEntity target;
|
private LivingEntity target;
|
||||||
private final Comparator<LivingEntity> targetSorting = Comparator.comparing(this::distanceTo);
|
private final Comparator<LivingEntity> targetSorting = Comparator.comparing(this::distanceTo);
|
||||||
|
@ -144,6 +147,10 @@ public class TentacleEntity extends AbstractDecorationEntity {
|
||||||
}
|
}
|
||||||
addActiveTicks(20 + getWorld().random.nextInt(30));
|
addActiveTicks(20 + getWorld().random.nextInt(30));
|
||||||
playSound(USounds.ENTITY_TENTACLE_ROAR, 5, 1);
|
playSound(USounds.ENTITY_TENTACLE_ROAR, 5, 1);
|
||||||
|
|
||||||
|
hurtTime = 10;
|
||||||
|
getWorld().sendEntityStatus(this, EntityStatuses.PLAY_ATTACK_SOUND);
|
||||||
|
|
||||||
emitGameEvent(GameEvent.RESONATE_15);
|
emitGameEvent(GameEvent.RESONATE_15);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -159,6 +166,11 @@ public class TentacleEntity extends AbstractDecorationEntity {
|
||||||
prevGrowth = growth;
|
prevGrowth = growth;
|
||||||
super.tick();
|
super.tick();
|
||||||
prevAttackingTicks = attackingTicks;
|
prevAttackingTicks = attackingTicks;
|
||||||
|
|
||||||
|
if (hurtTime > 0) {
|
||||||
|
hurtTime--;
|
||||||
|
}
|
||||||
|
|
||||||
if (isAttacking()) {
|
if (isAttacking()) {
|
||||||
if (--attackingTicks == 12) {
|
if (--attackingTicks == 12) {
|
||||||
if (target != null) {
|
if (target != null) {
|
||||||
|
@ -271,6 +283,9 @@ public class TentacleEntity extends AbstractDecorationEntity {
|
||||||
case ATTACK_STATUS:
|
case ATTACK_STATUS:
|
||||||
attackingTicks = 30;
|
attackingTicks = 30;
|
||||||
break;
|
break;
|
||||||
|
case EntityStatuses.PLAY_ATTACK_SOUND:
|
||||||
|
hurtTime = 10;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
super.handleStatus(status);
|
super.handleStatus(status);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue