diff options
author | Wyvest <45589059+Wyvest@users.noreply.github.com> | 2022-07-07 10:32:56 +0900 |
---|---|---|
committer | Wyvest <45589059+Wyvest@users.noreply.github.com> | 2022-07-07 10:32:56 +0900 |
commit | 52350839ef257791aaeaab2cfd464f4d0fba3377 (patch) | |
tree | 54f952d03832cd3cf93bb4597b66ee80cfc7b9d8 /versions/src/main/java/cc/polyfrost/oneconfig/internal | |
parent | bf0d2189dd881faa8f401d60c891bd8c1b7086b5 (diff) | |
download | OneConfig-52350839ef257791aaeaab2cfd464f4d0fba3377.tar.gz OneConfig-52350839ef257791aaeaab2cfd464f4d0fba3377.tar.bz2 OneConfig-52350839ef257791aaeaab2cfd464f4d0fba3377.zip |
egg 1
Diffstat (limited to 'versions/src/main/java/cc/polyfrost/oneconfig/internal')
-rw-r--r-- | versions/src/main/java/cc/polyfrost/oneconfig/internal/eggs/TechnobladeCrownRenderer.java | 38 | ||||
-rw-r--r-- | versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/RenderPigMixin.java | 25 |
2 files changed, 63 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 |