From 52350839ef257791aaeaab2cfd464f4d0fba3377 Mon Sep 17 00:00:00 2001 From: Wyvest <45589059+Wyvest@users.noreply.github.com> Date: Thu, 7 Jul 2022 10:32:56 +0900 Subject: egg 1 --- .../oneconfig/textures/entity/pig/technocrown.png | Bin 0 -> 252 bytes .../internal/eggs/TechnobladeCrownRenderer.java | 38 +++++++++++++++++++++ .../oneconfig/internal/mixin/RenderPigMixin.java | 25 ++++++++++++++ versions/src/main/resources/mixins.oneconfig.json | 1 + 4 files changed, 64 insertions(+) create mode 100644 src/main/resources/assets/oneconfig/textures/entity/pig/technocrown.png create mode 100644 versions/src/main/java/cc/polyfrost/oneconfig/internal/eggs/TechnobladeCrownRenderer.java create mode 100644 versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/RenderPigMixin.java diff --git a/src/main/resources/assets/oneconfig/textures/entity/pig/technocrown.png b/src/main/resources/assets/oneconfig/textures/entity/pig/technocrown.png new file mode 100644 index 0000000..b04b745 Binary files /dev/null and b/src/main/resources/assets/oneconfig/textures/entity/pig/technocrown.png differ 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 + * ... + */ +public class TechnobladeCrownRenderer implements LayerRenderer { + + 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 { + public RenderPigMixin(RenderManager renderManager, ModelBase modelBase, float f) { + super(renderManager, modelBase, f); + } + @Inject(method = "", 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" -- cgit