diff --git a/src/main/java/com/minelittlepony/client/PonyRenderManager.java b/src/main/java/com/minelittlepony/client/PonyRenderManager.java index f9444ac1..9be0de75 100644 --- a/src/main/java/com/minelittlepony/client/PonyRenderManager.java +++ b/src/main/java/com/minelittlepony/client/PonyRenderManager.java @@ -13,6 +13,7 @@ import com.minelittlepony.client.render.entities.player.RenderPonyPlayer; import javax.annotation.Nullable; +import net.fabricmc.fabric.api.client.render.EntityRendererRegistry; import net.minecraft.client.MinecraftClient; import net.minecraft.client.render.entity.EntityRenderDispatcher; import net.minecraft.client.render.entity.EntityRenderer; @@ -71,19 +72,19 @@ public class PonyRenderManager { * * @param state True if we want ponies (the original will be stored) * @param type The type to replace - * @param renderer The replacement value + * @param factory The replacement value * @param The entity type */ @SuppressWarnings("unchecked") - public void switchRenderer(boolean state, Class type, Function> func) { + public void switchRenderer(boolean state, Class type, EntityRendererRegistry.Factory factory) { if (state) { if (!renderMap.containsKey(type)) { renderMap.put(type, MinecraftClient.getInstance().getEntityRenderManager().getRenderer(type)); } - MineLPClient.getInstance().getModUtilities().addRenderer((Class)type, func); + EntityRendererRegistry.INSTANCE.register(type, factory); } else { if (renderMap.containsKey(type)) { - MineLPClient.getInstance().getModUtilities().addRenderer(type, m -> (EntityRenderer)renderMap.get(type)); + EntityRendererRegistry.INSTANCE.register(type, (m1, c) -> ((Function>) m -> (EntityRenderer) renderMap.get(type)).apply(m1)); } } } diff --git a/src/main/java/com/minelittlepony/client/gui/hdskins/MineLPHDSkins.java b/src/main/java/com/minelittlepony/client/gui/hdskins/MineLPHDSkins.java index 23b3bc14..0e0bc342 100644 --- a/src/main/java/com/minelittlepony/client/gui/hdskins/MineLPHDSkins.java +++ b/src/main/java/com/minelittlepony/client/gui/hdskins/MineLPHDSkins.java @@ -1,5 +1,6 @@ package com.minelittlepony.client.gui.hdskins; +import net.fabricmc.fabric.api.client.render.EntityRendererRegistry; import net.minecraft.client.MinecraftClient; import net.minecraft.util.Identifier; @@ -56,7 +57,7 @@ class MineLPHDSkins extends MineLPClient implements ISkinCacheClearListener { super.postInit(minecraft); // Preview on the select skin gui - getModUtilities().addRenderer(DummyPony.class, RenderDummyPony::new); + EntityRendererRegistry.INSTANCE.register(DummyPony.class, RenderDummyPony::new); HDSkins manager = HDSkins.getInstance(); diff --git a/src/main/java/com/minelittlepony/client/gui/hdskins/RenderDummyPony.java b/src/main/java/com/minelittlepony/client/gui/hdskins/RenderDummyPony.java index bc1ab5e4..5ab801eb 100644 --- a/src/main/java/com/minelittlepony/client/gui/hdskins/RenderDummyPony.java +++ b/src/main/java/com/minelittlepony/client/gui/hdskins/RenderDummyPony.java @@ -14,6 +14,7 @@ import com.minelittlepony.pony.meta.Race; import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type; import com.mojang.blaze3d.platform.GlStateManager; +import net.fabricmc.fabric.api.client.render.EntityRendererRegistry; import net.minecraft.client.render.entity.EntityRenderDispatcher; import net.minecraft.client.render.entity.feature.FeatureRenderer; import net.minecraft.util.Identifier; @@ -25,8 +26,8 @@ class RenderDummyPony extends RenderDummyPlayer> renderPony = new RenderPony<>(this); - public RenderDummyPony(EntityRenderDispatcher manager) { - super(manager); + public RenderDummyPony(EntityRenderDispatcher manager, EntityRendererRegistry.Context context) { + super(manager, context); addFeature(new LayerGear<>(this)); } diff --git a/src/main/java/com/minelittlepony/client/render/entities/RenderEnderStallion.java b/src/main/java/com/minelittlepony/client/render/entities/RenderEnderStallion.java index 4f9a6375..05a3f54c 100644 --- a/src/main/java/com/minelittlepony/client/render/entities/RenderEnderStallion.java +++ b/src/main/java/com/minelittlepony/client/render/entities/RenderEnderStallion.java @@ -6,6 +6,7 @@ import com.minelittlepony.client.render.layer.LayerHeldPonyItem; import com.minelittlepony.client.render.layer.LayerHeldPonyItemMagical; import com.minelittlepony.client.render.layer.LayerEyeGlow.IGlowingRenderer; +import net.fabricmc.fabric.api.client.render.EntityRendererRegistry; import net.minecraft.block.BlockState; import net.minecraft.client.render.entity.EntityRenderDispatcher; import net.minecraft.client.render.entity.feature.StuckArrowsFeatureRenderer; @@ -22,7 +23,7 @@ public class RenderEnderStallion extends RenderPonyMob ponyRenderer; - public RenderPonyGuardian(EntityRenderDispatcher manager) { + public RenderPonyGuardian(EntityRenderDispatcher manager, EntityRendererRegistry.Context context) { super(manager); features.clear(); @@ -68,8 +69,8 @@ public class RenderPonyGuardian extends GuardianEntityRenderer { public static class Elder extends RenderPonyGuardian { - public Elder(EntityRenderDispatcher manager) { - super(manager); + public Elder(EntityRenderDispatcher manager, EntityRendererRegistry.Context context) { + super(manager, context); } @Override diff --git a/src/main/java/com/minelittlepony/client/render/entities/RenderPonyIllager.java b/src/main/java/com/minelittlepony/client/render/entities/RenderPonyIllager.java index 9aa6c892..9d769e53 100644 --- a/src/main/java/com/minelittlepony/client/render/entities/RenderPonyIllager.java +++ b/src/main/java/com/minelittlepony/client/render/entities/RenderPonyIllager.java @@ -5,6 +5,7 @@ import com.minelittlepony.client.render.layer.LayerHeldItemIllager; import com.minelittlepony.client.render.layer.LayerHeldPonyItem; import com.mojang.blaze3d.platform.GlStateManager; +import net.fabricmc.fabric.api.client.render.EntityRendererRegistry; import net.minecraft.client.render.entity.EntityRenderDispatcher; import net.minecraft.entity.mob.EvokerEntity; import net.minecraft.entity.mob.IllagerEntity; @@ -20,7 +21,7 @@ public abstract class RenderPonyIllager extends RenderP public static final Identifier EVOKER = new Identifier("minelittlepony", "textures/entity/illager/evoker_pony.png"); public static final Identifier VINDICATOR = new Identifier("minelittlepony", "textures/entity/illager/vindicator_pony.png"); - public RenderPonyIllager(EntityRenderDispatcher manager) { + public RenderPonyIllager(EntityRenderDispatcher manager, EntityRendererRegistry.Context context) { super(manager, new ModelIllagerPony<>()); } @@ -37,8 +38,8 @@ public abstract class RenderPonyIllager extends RenderP public static class Vindicator extends RenderPonyIllager { - public Vindicator(EntityRenderDispatcher manager) { - super(manager); + public Vindicator(EntityRenderDispatcher manager, EntityRendererRegistry.Context context) { + super(manager, context); } @@ -50,8 +51,8 @@ public abstract class RenderPonyIllager extends RenderP public static class Evoker extends RenderPonyIllager { - public Evoker(EntityRenderDispatcher manager) { - super(manager); + public Evoker(EntityRenderDispatcher manager, EntityRendererRegistry.Context context) { + super(manager, context); } @Override @@ -62,8 +63,8 @@ public abstract class RenderPonyIllager extends RenderP public static class Illusionist extends RenderPonyIllager { - public Illusionist(EntityRenderDispatcher manager) { - super(manager); + public Illusionist(EntityRenderDispatcher manager, EntityRendererRegistry.Context context) { + super(manager, context); } @Override diff --git a/src/main/java/com/minelittlepony/client/render/entities/RenderPonyPillager.java b/src/main/java/com/minelittlepony/client/render/entities/RenderPonyPillager.java index 017be91e..9f506b00 100644 --- a/src/main/java/com/minelittlepony/client/render/entities/RenderPonyPillager.java +++ b/src/main/java/com/minelittlepony/client/render/entities/RenderPonyPillager.java @@ -1,5 +1,6 @@ package com.minelittlepony.client.render.entities; +import net.fabricmc.fabric.api.client.render.EntityRendererRegistry; import net.minecraft.client.render.entity.EntityRenderDispatcher; import net.minecraft.entity.mob.PillagerEntity; import net.minecraft.util.Identifier; @@ -12,7 +13,7 @@ public class RenderPonyPillager extends RenderPonyMob()); } diff --git a/src/main/java/com/minelittlepony/client/render/entities/RenderPonySkeleton.java b/src/main/java/com/minelittlepony/client/render/entities/RenderPonySkeleton.java index e6c7497c..a9d86168 100644 --- a/src/main/java/com/minelittlepony/client/render/entities/RenderPonySkeleton.java +++ b/src/main/java/com/minelittlepony/client/render/entities/RenderPonySkeleton.java @@ -6,6 +6,7 @@ import com.minelittlepony.client.render.layer.LayerHeldPonyItemMagical; import com.minelittlepony.client.render.layer.LayerPonyStrayOverlay; import com.mojang.blaze3d.platform.GlStateManager; +import net.fabricmc.fabric.api.client.render.EntityRendererRegistry; import net.minecraft.client.render.entity.EntityRenderDispatcher; import net.minecraft.entity.mob.AbstractSkeletonEntity; import net.minecraft.entity.mob.StrayEntity; @@ -18,7 +19,7 @@ public class RenderPonySkeleton extends public static final Identifier WITHER = new Identifier("minelittlepony", "textures/entity/skeleton/skeleton_wither_pony.png"); public static final Identifier STRAY = new Identifier("minelittlepony", "textures/entity/skeleton/stray_pony.png"); - public RenderPonySkeleton(EntityRenderDispatcher manager) { + public RenderPonySkeleton(EntityRenderDispatcher manager, EntityRendererRegistry.Context context) { super(manager, new ModelSkeletonPony<>()); } @@ -34,8 +35,8 @@ public class RenderPonySkeleton extends public static class Stray extends RenderPonySkeleton { - public Stray(EntityRenderDispatcher rm) { - super(rm); + public Stray(EntityRenderDispatcher rm, EntityRendererRegistry.Context context) { + super(rm, context); addFeature(new LayerPonyStrayOverlay<>(this)); } @@ -47,8 +48,8 @@ public class RenderPonySkeleton extends public static class Wither extends RenderPonySkeleton { - public Wither(EntityRenderDispatcher rm) { - super(rm); + public Wither(EntityRenderDispatcher rm, EntityRendererRegistry.Context context) { + super(rm, context); } @Override diff --git a/src/main/java/com/minelittlepony/client/render/entities/RenderPonyTrader.java b/src/main/java/com/minelittlepony/client/render/entities/RenderPonyTrader.java index c06ad752..a54fa124 100644 --- a/src/main/java/com/minelittlepony/client/render/entities/RenderPonyTrader.java +++ b/src/main/java/com/minelittlepony/client/render/entities/RenderPonyTrader.java @@ -1,5 +1,6 @@ package com.minelittlepony.client.render.entities; +import net.fabricmc.fabric.api.client.render.EntityRendererRegistry; import net.minecraft.client.render.entity.EntityRenderDispatcher; import net.minecraft.entity.passive.WanderingTraderEntity; import net.minecraft.util.Identifier; @@ -11,7 +12,7 @@ public class RenderPonyTrader extends RenderPonyMob.Caster(false)); } diff --git a/src/main/java/com/minelittlepony/client/render/entities/RenderPonyVex.java b/src/main/java/com/minelittlepony/client/render/entities/RenderPonyVex.java index b9bd045c..c2c7f8fc 100644 --- a/src/main/java/com/minelittlepony/client/render/entities/RenderPonyVex.java +++ b/src/main/java/com/minelittlepony/client/render/entities/RenderPonyVex.java @@ -1,5 +1,6 @@ package com.minelittlepony.client.render.entities; +import net.fabricmc.fabric.api.client.render.EntityRendererRegistry; import net.minecraft.client.render.entity.BipedEntityRenderer; import net.minecraft.client.render.entity.EntityRenderDispatcher; import net.minecraft.entity.mob.VexEntity; @@ -16,7 +17,7 @@ public class RenderPonyVex extends BipedEntityRenderer(), 0.3F); } diff --git a/src/main/java/com/minelittlepony/client/render/entities/RenderPonyVillager.java b/src/main/java/com/minelittlepony/client/render/entities/RenderPonyVillager.java index df7bc630..41288d8a 100644 --- a/src/main/java/com/minelittlepony/client/render/entities/RenderPonyVillager.java +++ b/src/main/java/com/minelittlepony/client/render/entities/RenderPonyVillager.java @@ -5,6 +5,7 @@ import com.minelittlepony.util.resources.FormattedTextureSupplier; import com.minelittlepony.util.resources.ITextureSupplier; import com.mojang.blaze3d.platform.GlStateManager; +import net.fabricmc.fabric.api.client.render.EntityRendererRegistry; import net.minecraft.client.MinecraftClient; import net.minecraft.client.render.entity.EntityRenderDispatcher; import net.minecraft.client.render.entity.feature.VillagerClothingFeatureRenderer; @@ -19,7 +20,7 @@ public class RenderPonyVillager extends RenderPonyMob.Caster PROFESSIONS = new VillagerProfessionTextureCache<>(FORMATTER); - public RenderPonyVillager(EntityRenderDispatcher manager) { + public RenderPonyVillager(EntityRenderDispatcher manager, EntityRendererRegistry.Context context) { super(manager, new ModelVillagerPony<>()); } diff --git a/src/main/java/com/minelittlepony/client/render/entities/RenderPonyWitch.java b/src/main/java/com/minelittlepony/client/render/entities/RenderPonyWitch.java index 21f6e9e9..94b8939c 100644 --- a/src/main/java/com/minelittlepony/client/render/entities/RenderPonyWitch.java +++ b/src/main/java/com/minelittlepony/client/render/entities/RenderPonyWitch.java @@ -4,6 +4,7 @@ import com.minelittlepony.client.model.entities.ModelWitchPony; import com.minelittlepony.client.render.layer.LayerHeldPonyItem; import com.mojang.blaze3d.platform.GlStateManager; +import net.fabricmc.fabric.api.client.render.EntityRendererRegistry; import net.minecraft.client.render.entity.EntityRenderDispatcher; import net.minecraft.client.render.model.json.ModelTransformation; import net.minecraft.entity.mob.WitchEntity; @@ -15,7 +16,7 @@ public class RenderPonyWitch extends RenderPonyMob private static final Identifier WITCH_TEXTURES = new Identifier("minelittlepony", "textures/entity/witch_pony.png"); - public RenderPonyWitch(EntityRenderDispatcher manager) { + public RenderPonyWitch(EntityRenderDispatcher manager, EntityRendererRegistry.Context context) { super(manager, new ModelWitchPony()); } diff --git a/src/main/java/com/minelittlepony/client/render/entities/RenderPonyZombie.java b/src/main/java/com/minelittlepony/client/render/entities/RenderPonyZombie.java index 903bf9a2..b7618074 100644 --- a/src/main/java/com/minelittlepony/client/render/entities/RenderPonyZombie.java +++ b/src/main/java/com/minelittlepony/client/render/entities/RenderPonyZombie.java @@ -3,6 +3,7 @@ package com.minelittlepony.client.render.entities; import com.minelittlepony.client.model.entities.ModelZombiePony; import com.mojang.blaze3d.platform.GlStateManager; +import net.fabricmc.fabric.api.client.render.EntityRendererRegistry; import net.minecraft.client.render.entity.EntityRenderDispatcher; import net.minecraft.entity.mob.DrownedEntity; import net.minecraft.entity.mob.GiantEntity; @@ -18,7 +19,7 @@ public class RenderPonyZombie extends RenderPonyMob public static final Identifier PIGMAN = new Identifier("minelittlepony", "textures/entity/zombie/zombie_pigman_pony.png"); public static final Identifier DROWNED = new Identifier("minelittlepony", "textures/entity/zombie/drowned_pony.png"); - public RenderPonyZombie(EntityRenderDispatcher manager) { + public RenderPonyZombie(EntityRenderDispatcher manager, EntityRendererRegistry.Context context) { super(manager, new ModelZombiePony<>()); } @@ -30,8 +31,8 @@ public class RenderPonyZombie extends RenderPonyMob public static class Drowned extends RenderPonyZombie { - public Drowned(EntityRenderDispatcher manager) { - super(manager); + public Drowned(EntityRenderDispatcher manager, EntityRendererRegistry.Context context) { + super(manager, context); } @Override @@ -42,8 +43,8 @@ public class RenderPonyZombie extends RenderPonyMob public static class Pigman extends RenderPonyZombie { - public Pigman(EntityRenderDispatcher manager) { - super(manager); + public Pigman(EntityRenderDispatcher manager, EntityRendererRegistry.Context context) { + super(manager, context); } @Override @@ -54,8 +55,8 @@ public class RenderPonyZombie extends RenderPonyMob public static class Husk extends RenderPonyZombie { - public Husk(EntityRenderDispatcher manager) { - super(manager); + public Husk(EntityRenderDispatcher manager, EntityRendererRegistry.Context context) { + super(manager, context); } @Override @@ -73,7 +74,7 @@ public class RenderPonyZombie extends RenderPonyMob public static class Giant extends RenderPonyMob.Caster> { - public Giant(EntityRenderDispatcher manager) { + public Giant(EntityRenderDispatcher manager, EntityRendererRegistry.Context context) { super(manager, new ModelZombiePony<>()); } diff --git a/src/main/java/com/minelittlepony/client/render/entities/RenderPonyZombieVillager.java b/src/main/java/com/minelittlepony/client/render/entities/RenderPonyZombieVillager.java index 796e24df..4dc6602b 100644 --- a/src/main/java/com/minelittlepony/client/render/entities/RenderPonyZombieVillager.java +++ b/src/main/java/com/minelittlepony/client/render/entities/RenderPonyZombieVillager.java @@ -4,6 +4,7 @@ import com.minelittlepony.client.model.entities.ModelZombieVillagerPony; import com.minelittlepony.util.resources.FormattedTextureSupplier; import com.minelittlepony.util.resources.ITextureSupplier; +import net.fabricmc.fabric.api.client.render.EntityRendererRegistry; import net.minecraft.client.MinecraftClient; import net.minecraft.client.render.entity.EntityRenderDispatcher; import net.minecraft.client.render.entity.feature.VillagerClothingFeatureRenderer; @@ -18,7 +19,7 @@ public class RenderPonyZombieVillager extends RenderPonyMob.Caster PROFESSIONS = new VillagerProfessionTextureCache<>(FORMATTER); - public RenderPonyZombieVillager(EntityRenderDispatcher manager) { + public RenderPonyZombieVillager(EntityRenderDispatcher manager, EntityRendererRegistry.Context context) { super(manager, new ModelZombieVillagerPony()); } diff --git a/src/main/java/com/minelittlepony/client/render/tileentities/skull/PonySkullRenderer.java b/src/main/java/com/minelittlepony/client/render/tileentities/skull/PonySkullRenderer.java index f3c0c949..1849ae7d 100644 --- a/src/main/java/com/minelittlepony/client/render/tileentities/skull/PonySkullRenderer.java +++ b/src/main/java/com/minelittlepony/client/render/tileentities/skull/PonySkullRenderer.java @@ -2,13 +2,13 @@ package com.minelittlepony.client.render.tileentities.skull; import com.google.common.collect.Maps; import com.minelittlepony.MineLittlePony; -import com.minelittlepony.client.MineLPClient; import com.minelittlepony.client.render.LevitatingItemRenderer; import com.minelittlepony.pony.IPony; import com.minelittlepony.settings.PonyConfig; import com.minelittlepony.settings.PonySettings; import com.mojang.authlib.GameProfile; +import net.fabricmc.fabric.api.client.render.BlockEntityRendererRegistry; import net.minecraft.block.SkullBlock; import net.minecraft.block.entity.SkullBlockEntity; import net.minecraft.client.render.block.entity.SkullBlockEntityRenderer; @@ -48,7 +48,7 @@ public class PonySkullRenderer extends SkullBlockEntityRenderer { if (PonySettings.PONYSKULLS.get()) { if (!(INSTANCE instanceof PonySkullRenderer)) { backup = INSTANCE; - MineLPClient.getInstance().getModUtilities().addRenderer(SkullBlockEntity.class, ponyInstance); + BlockEntityRendererRegistry.INSTANCE.register(SkullBlockEntity.class, ponyInstance); INSTANCE = ponyInstance; } } else { @@ -57,7 +57,7 @@ public class PonySkullRenderer extends SkullBlockEntityRenderer { if (backup == null) { backup = new SkullBlockEntityRenderer(); } - MineLPClient.getInstance().getModUtilities().addRenderer(SkullBlockEntity.class, backup); + BlockEntityRendererRegistry.INSTANCE.register(SkullBlockEntity.class, backup); INSTANCE = backup; } }