aboutsummaryrefslogtreecommitdiff
path: root/versions
diff options
context:
space:
mode:
Diffstat (limited to 'versions')
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/internal/eggs/TechnobladeCrownRenderer.java38
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/RenderPigMixin.java25
-rw-r--r--versions/src/main/resources/mixins.oneconfig.json1
3 files changed, 64 insertions, 0 deletions
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/internal/eggs/TechnobladeCrownRenderer.java b/versions/src/main/java/cc/polyfrost/oneconfig/internal/eggs/TechnobladeCrownRenderer.java
new file mode 100644
index 0000000..b7e11b8
--- /dev/null
+++ b/versions/src/main/java/cc/polyfrost/oneconfig/internal/eggs/TechnobladeCrownRenderer.java
@@ -0,0 +1,38 @@
+//#if MC<=11202
+package cc.polyfrost.oneconfig.internal.eggs;
+
+import net.minecraft.client.model.ModelPig;
+import net.minecraft.client.renderer.entity.RenderPig;
+import net.minecraft.client.renderer.entity.layers.LayerRenderer;
+import net.minecraft.entity.passive.EntityPig;
+import net.minecraft.util.ResourceLocation;
+
+/**
+ * Adapted from technomodel under MIT
+ * <a href="https://github.com/thecolonel63/technomodel/blob/master/LICENSE">...</a>
+ */
+public class TechnobladeCrownRenderer<T extends EntityPig> implements LayerRenderer<T> {
+
+ private static final ResourceLocation CROWN_TEXTURE = new ResourceLocation("oneconfig", "textures/entity/pig/technocrown.png");
+ private final RenderPig renderer;
+ private final ModelPig pigModel = new ModelPig(0.5F);
+
+ public TechnobladeCrownRenderer(RenderPig renderPig) {
+ renderer = renderPig;
+ }
+
+ @Override
+ public void doRenderLayer(T entitylivingbaseIn, float f, float g, float partialTicks, float h, float i, float j, float scale) {
+ if (entitylivingbaseIn.hasCustomName() && entitylivingbaseIn.getCustomNameTag().equals("Technoblade")) {
+ this.renderer.bindTexture(CROWN_TEXTURE);
+ this.pigModel.setModelAttributes(renderer.getMainModel());
+ this.pigModel.render(entitylivingbaseIn, f, g, h, i, j, scale);
+ }
+ }
+
+ @Override
+ public boolean shouldCombineTextures() {
+ return true;
+ }
+}
+//#endif \ No newline at end of file
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/RenderPigMixin.java b/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/RenderPigMixin.java
new file mode 100644
index 0000000..1bd1fae
--- /dev/null
+++ b/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/RenderPigMixin.java
@@ -0,0 +1,25 @@
+//#if MC<=11202
+package cc.polyfrost.oneconfig.internal.mixin;
+
+import cc.polyfrost.oneconfig.internal.eggs.TechnobladeCrownRenderer;
+import net.minecraft.client.model.ModelBase;
+import net.minecraft.client.renderer.entity.RenderLiving;
+import net.minecraft.client.renderer.entity.RenderManager;
+import net.minecraft.client.renderer.entity.RenderPig;
+import net.minecraft.entity.passive.EntityPig;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+
+@Mixin(RenderPig.class)
+public abstract class RenderPigMixin extends RenderLiving<EntityPig> {
+ public RenderPigMixin(RenderManager renderManager, ModelBase modelBase, float f) {
+ super(renderManager, modelBase, f);
+ }
+ @Inject(method = "<init>", at = @At("TAIL"))
+ private void addCrown(RenderManager renderManager, ModelBase modelBase, float f, CallbackInfo ci) {
+ addLayer(new TechnobladeCrownRenderer<>((RenderPig) (Object) this));
+ }
+}
+//#endif \ No newline at end of file
diff --git a/versions/src/main/resources/mixins.oneconfig.json b/versions/src/main/resources/mixins.oneconfig.json
index 4a03fd0..1486c9d 100644
--- a/versions/src/main/resources/mixins.oneconfig.json
+++ b/versions/src/main/resources/mixins.oneconfig.json
@@ -14,6 +14,7 @@
"NetHandlerPlayClientMixin",
"NetworkManagerMixin",
"OptifineConfigMixin",
+ "RenderPigMixin",
"ShaderGroupAccessor",
"VigilantMixin",
"WorldClientMixin"