Remove IModUtilities

This commit is contained in:
Matthew Messinger 2019-07-02 19:57:45 -04:00
parent e3fac2476c
commit d4375dde47
20 changed files with 73 additions and 85 deletions

View file

@ -18,5 +18,5 @@ org.gradle.daemon=false
# Dependencies # Dependencies
fabric_version=0.3.0+ fabric_version=0.3.0+
kirin_version=1.14.3-1.2.0-SNAPSHOT kirin_version=1.14.3-1.3.0-SNAPSHOT
hd_skins_version=1.14.3-5.2.1-SNAPSHOT hd_skins_version=1.14.3-5.2.1-SNAPSHOT

View file

@ -6,11 +6,10 @@ import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import com.minelittlepony.client.gui.hdskins.IndirectHDSkins; import com.minelittlepony.client.gui.hdskins.IndirectHDSkins;
import com.minelittlepony.vendor.fabricmc.ModImpl;
import javax.annotation.Nullable; import javax.annotation.Nullable;
public class FabMod implements ClientModInitializer, ClientTickCallback, ModImpl { public class FabMod implements ClientModInitializer, ClientTickCallback {
@Nullable @Nullable
private MineLPClient mlp; private MineLPClient mlp;
@ -22,9 +21,9 @@ public class FabMod implements ClientModInitializer, ClientTickCallback, ModImpl
ClientTickCallback.EVENT.register(this); ClientTickCallback.EVENT.register(this);
if (FabricLoader.getInstance().isModLoaded("hdskins")) { if (FabricLoader.getInstance().isModLoaded("hdskins")) {
mlp = IndirectHDSkins.getConstructor().apply(this); mlp = IndirectHDSkins.getConstructor().get();
} else { } else {
mlp = new MineLPClient(this); mlp = new MineLPClient();
} }
} }

View file

@ -5,7 +5,7 @@ import com.minelittlepony.client.gui.GuiPonySettings;
import com.minelittlepony.client.pony.PonyManager; import com.minelittlepony.client.pony.PonyManager;
import com.minelittlepony.client.render.tileentities.skull.PonySkullRenderer; import com.minelittlepony.client.render.tileentities.skull.PonySkullRenderer;
import com.minelittlepony.client.settings.ClientPonyConfig; import com.minelittlepony.client.settings.ClientPonyConfig;
import com.minelittlepony.common.client.IModUtilities; import com.minelittlepony.common.util.GamePaths;
import com.minelittlepony.settings.JsonConfig; import com.minelittlepony.settings.JsonConfig;
import com.minelittlepony.settings.PonyConfig; import com.minelittlepony.settings.PonyConfig;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
@ -16,6 +16,8 @@ import javax.annotation.Nullable;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import net.fabricmc.fabric.api.client.keybinding.FabricKeyBinding;
import net.fabricmc.fabric.api.client.keybinding.KeyBindingRegistry;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.TitleScreen; import net.minecraft.client.gui.screen.TitleScreen;
import net.minecraft.client.options.KeyBinding; import net.minecraft.client.options.KeyBinding;
@ -43,22 +45,21 @@ public class MineLPClient extends MineLittlePony {
private PonyConfig config; private PonyConfig config;
private PonyManager ponyManager; private PonyManager ponyManager;
private final IModUtilities utilities;
private final PonyRenderManager renderManager = PonyRenderManager.getInstance(); private final PonyRenderManager renderManager = PonyRenderManager.getInstance();
private KeyBinding keyBinding; private FabricKeyBinding keyBinding;
public static MineLPClient getInstance() { public static MineLPClient getInstance() {
return (MineLPClient)MineLittlePony.getInstance(); return (MineLPClient)MineLittlePony.getInstance();
} }
public MineLPClient(IModUtilities utils) { public MineLPClient() {
utilities = utils;
config = JsonConfig.of(utils.getConfigDirectory().resolve("minelp.json"), this::createConfig); config = JsonConfig.of(GamePaths.getConfigDirectory().resolve("minelp.json"), this::createConfig);
ponyManager = new PonyManager(config); ponyManager = new PonyManager(config);
keyBinding = utilities.registerKeybind("key.categories.misc", "minelittlepony:settings", GLFW.GLFW_KEY_F9);
keyBinding = FabricKeyBinding.Builder.create(new Identifier("minelittlepony", "settings"), InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_F9, "key.categories.misc").build();
KeyBindingRegistry.INSTANCE.register(keyBinding);
} }
protected ClientPonyConfig createConfig() { protected ClientPonyConfig createConfig() {
@ -140,7 +141,4 @@ public class MineLPClient extends MineLittlePony {
return config; return config;
} }
public IModUtilities getModUtilities() {
return utilities;
}
} }

View file

@ -1,7 +1,6 @@
package com.minelittlepony.client; package com.minelittlepony.client;
import java.util.Map; import java.util.Map;
import java.util.function.Function;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.minelittlepony.client.model.IPonyModel; import com.minelittlepony.client.model.IPonyModel;
@ -13,10 +12,13 @@ import com.minelittlepony.client.render.entities.player.RenderPonyPlayer;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import com.minelittlepony.common.mixin.MixinEntityRenderDispatcher;
import net.fabricmc.fabric.api.client.render.EntityRendererRegistry;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.entity.EntityRenderDispatcher; import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.client.render.entity.EntityRenderer; import net.minecraft.client.render.entity.EntityRenderer;
import net.minecraft.client.render.entity.LivingEntityRenderer; import net.minecraft.client.render.entity.LivingEntityRenderer;
import net.minecraft.client.render.entity.PlayerEntityRenderer;
import net.minecraft.client.render.entity.model.EntityModel; import net.minecraft.client.render.entity.model.EntityModel;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
@ -62,7 +64,12 @@ public class PonyRenderManager {
private void addPlayerSkin(EntityRenderDispatcher manager, boolean slimArms, PlayerModels playerModel) { private void addPlayerSkin(EntityRenderDispatcher manager, boolean slimArms, PlayerModels playerModel) {
RenderPonyPlayer renderer = playerModel.createRenderer(manager, slimArms); RenderPonyPlayer renderer = playerModel.createRenderer(manager, slimArms);
MineLPClient.getInstance().getModUtilities().addRenderer(playerModel.getId(slimArms), renderer); addPlayerRenderer(playerModel.getId(slimArms), renderer);
}
private static void addPlayerRenderer(String modelType, PlayerEntityRenderer renderer) {
EntityRenderDispatcher mx = MinecraftClient.getInstance().getEntityRenderManager();
((MixinEntityRenderDispatcher)mx).getPlayerRenderers().put(modelType, renderer);
} }
/** /**
@ -74,16 +81,15 @@ public class PonyRenderManager {
* @param factory The replacement value * @param factory The replacement value
* @param <T> The entity type * @param <T> The entity type
*/ */
@SuppressWarnings({"unchecked"}) public <T extends Entity, V extends T> void switchRenderer(boolean state, Class<V> type, EntityRendererRegistry.Factory factory) {
public <T extends Entity, V extends T> void switchRenderer(boolean state, Class<V> type, Function<EntityRenderDispatcher, EntityRenderer<T>> factory) {
if (state) { if (state) {
if (!renderMap.containsKey(type)) { if (!renderMap.containsKey(type)) {
renderMap.put(type, MinecraftClient.getInstance().getEntityRenderManager().getRenderer(type)); renderMap.put(type, MinecraftClient.getInstance().getEntityRenderManager().getRenderer(type));
} }
MineLPClient.getInstance().getModUtilities().addRenderer((Class<T>)type, factory); EntityRendererRegistry.INSTANCE.register(type, factory);
} else { } else {
if (renderMap.containsKey(type)) { if (renderMap.containsKey(type)) {
MineLPClient.getInstance().getModUtilities().addRenderer(type, m -> (EntityRenderer<V>)renderMap.get(type)); EntityRendererRegistry.INSTANCE.register(type, (m, c) -> renderMap.get(type));
} }
} }
} }

View file

@ -1,18 +0,0 @@
package com.minelittlepony.client.gui.hdskins;
import com.minelittlepony.client.settings.ClientPonyConfig;
import com.minelittlepony.hdskins.HDSkins;
import com.minelittlepony.settings.PonyLevel;
class ClientPonyConfigHDSkins extends ClientPonyConfig {
@Override
public void setPonyLevel(PonyLevel ponylevel) {
// only trigger reloads when the value actually changes
if (ponylevel != getPonyLevel()) {
HDSkins.getInstance().parseSkins();
}
super.setPonyLevel(ponylevel);
}
}

View file

@ -1,12 +1,11 @@
package com.minelittlepony.client.gui.hdskins; package com.minelittlepony.client.gui.hdskins;
import com.minelittlepony.client.MineLPClient; import com.minelittlepony.client.MineLPClient;
import com.minelittlepony.common.client.IModUtilities;
import java.util.function.Function; import java.util.function.Supplier;
public final class IndirectHDSkins { public final class IndirectHDSkins {
public static Function<IModUtilities, MineLPClient> getConstructor() { public static Supplier<MineLPClient> getConstructor() {
return MineLPHDSkins::new; return MineLPHDSkins::new;
} }
} }

View file

@ -1,12 +1,11 @@
package com.minelittlepony.client.gui.hdskins; package com.minelittlepony.client.gui.hdskins;
import net.fabricmc.fabric.api.client.render.EntityRendererRegistry;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import com.minelittlepony.common.client.IModUtilities;
import com.minelittlepony.client.MineLPClient; import com.minelittlepony.client.MineLPClient;
import com.minelittlepony.client.LegacySkinConverter; import com.minelittlepony.client.LegacySkinConverter;
import com.minelittlepony.client.settings.ClientPonyConfig;
import com.minelittlepony.hdskins.HDSkins; import com.minelittlepony.hdskins.HDSkins;
import com.minelittlepony.hdskins.ISkinCacheClearListener; import com.minelittlepony.hdskins.ISkinCacheClearListener;
import com.minelittlepony.hdskins.net.LegacySkinServer; import com.minelittlepony.hdskins.net.LegacySkinServer;
@ -28,9 +27,7 @@ class MineLPHDSkins extends MineLPClient implements ISkinCacheClearListener {
private static final String MINELP_LEGACY_SERVER = "http://minelpskins.voxelmodpack.com"; private static final String MINELP_LEGACY_SERVER = "http://minelpskins.voxelmodpack.com";
private static final String MINELP_LEGACY_GATEWAY = "http://minelpskinmanager.voxelmodpack.com"; private static final String MINELP_LEGACY_GATEWAY = "http://minelpskinmanager.voxelmodpack.com";
public MineLPHDSkins(IModUtilities utils) { public MineLPHDSkins() {
super(utils);
SkinServer legacy = new LegacySkinServer(MINELP_LEGACY_SERVER, MINELP_LEGACY_GATEWAY); SkinServer legacy = new LegacySkinServer(MINELP_LEGACY_SERVER, MINELP_LEGACY_GATEWAY);
SkinServer valhalla = new ValhallaSkinServer(MINELP_VALHALLA_SERVER); SkinServer valhalla = new ValhallaSkinServer(MINELP_VALHALLA_SERVER);
// Register pony servers // Register pony servers
@ -56,7 +53,7 @@ class MineLPHDSkins extends MineLPClient implements ISkinCacheClearListener {
super.postInit(minecraft); super.postInit(minecraft);
// Preview on the select skin gui // Preview on the select skin gui
getModUtilities().addRenderer(DummyPony.class, RenderDummyPony::new); EntityRendererRegistry.INSTANCE.register(DummyPony.class, RenderDummyPony::new);
HDSkins manager = HDSkins.getInstance(); HDSkins manager = HDSkins.getInstance();
@ -70,11 +67,6 @@ class MineLPHDSkins extends MineLPClient implements ISkinCacheClearListener {
manager.setSkinsGui(GuiSkinsMineLP::new); manager.setSkinsGui(GuiSkinsMineLP::new);
} }
@Override
protected ClientPonyConfig createConfig() {
return new ClientPonyConfigHDSkins();
}
@Override @Override
public Map<MinecraftProfileTexture.Type, Identifier> getProfileTextures(@Nullable GameProfile profile) { public Map<MinecraftProfileTexture.Type, Identifier> getProfileTextures(@Nullable GameProfile profile) {
return HDSkins.getInstance().getTextures(profile); return HDSkins.getInstance().getTextures(profile);

View file

@ -14,6 +14,7 @@ import com.minelittlepony.pony.meta.Race;
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type; import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
import com.mojang.blaze3d.platform.GlStateManager; 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.EntityRenderDispatcher;
import net.minecraft.client.render.entity.feature.FeatureRenderer; import net.minecraft.client.render.entity.feature.FeatureRenderer;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
@ -25,8 +26,8 @@ class RenderDummyPony extends RenderDummyPlayer<DummyPony, ClientPonyModel<Dummy
protected final RenderPony<DummyPony, ClientPonyModel<DummyPony>> renderPony = new RenderPony<>(this); protected final RenderPony<DummyPony, ClientPonyModel<DummyPony>> renderPony = new RenderPony<>(this);
public RenderDummyPony(EntityRenderDispatcher manager) { public RenderDummyPony(EntityRenderDispatcher manager, EntityRendererRegistry.Context context) {
super(manager); super(manager, context);
addFeature(new LayerGear<>(this)); addFeature(new LayerGear<>(this));
} }

View file

@ -6,6 +6,7 @@ import com.minelittlepony.client.render.layer.LayerHeldPonyItem;
import com.minelittlepony.client.render.layer.LayerHeldPonyItemMagical; import com.minelittlepony.client.render.layer.LayerHeldPonyItemMagical;
import com.minelittlepony.client.render.layer.LayerEyeGlow.IGlowingRenderer; import com.minelittlepony.client.render.layer.LayerEyeGlow.IGlowingRenderer;
import net.fabricmc.fabric.api.client.render.EntityRendererRegistry;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.client.render.entity.EntityRenderDispatcher; import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.client.render.entity.feature.StuckArrowsFeatureRenderer; import net.minecraft.client.render.entity.feature.StuckArrowsFeatureRenderer;
@ -22,7 +23,7 @@ public class RenderEnderStallion extends RenderPonyMob<EndermanEntity, ModelEnde
private final Random rnd = new Random(); private final Random rnd = new Random();
public RenderEnderStallion(EntityRenderDispatcher manager) { public RenderEnderStallion(EntityRenderDispatcher manager, EntityRendererRegistry.Context context) {
super(manager, new ModelEnderStallion()); super(manager, new ModelEnderStallion());
} }

View file

@ -9,6 +9,7 @@ import com.minelittlepony.client.render.layer.LayerHeldPonyItem;
import com.minelittlepony.client.render.layer.LayerHeldPonyItemMagical; import com.minelittlepony.client.render.layer.LayerHeldPonyItemMagical;
import com.mojang.blaze3d.platform.GlStateManager; 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.EntityRenderDispatcher;
import net.minecraft.client.render.entity.GuardianEntityRenderer; import net.minecraft.client.render.entity.GuardianEntityRenderer;
import net.minecraft.entity.EntityDimensions; import net.minecraft.entity.EntityDimensions;
@ -22,7 +23,7 @@ public class RenderPonyGuardian extends GuardianEntityRenderer {
private final Proxy<GuardianEntity, ModelGuardianPony> ponyRenderer; private final Proxy<GuardianEntity, ModelGuardianPony> ponyRenderer;
public RenderPonyGuardian(EntityRenderDispatcher manager) { public RenderPonyGuardian(EntityRenderDispatcher manager, EntityRendererRegistry.Context context) {
super(manager); super(manager);
features.clear(); features.clear();
@ -68,8 +69,8 @@ public class RenderPonyGuardian extends GuardianEntityRenderer {
public static class Elder extends RenderPonyGuardian { public static class Elder extends RenderPonyGuardian {
public Elder(EntityRenderDispatcher manager) { public Elder(EntityRenderDispatcher manager, EntityRendererRegistry.Context context) {
super(manager); super(manager, context);
} }
@Override @Override

View file

@ -5,6 +5,7 @@ import com.minelittlepony.client.render.layer.LayerHeldItemIllager;
import com.minelittlepony.client.render.layer.LayerHeldPonyItem; import com.minelittlepony.client.render.layer.LayerHeldPonyItem;
import com.mojang.blaze3d.platform.GlStateManager; 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.EntityRenderDispatcher;
import net.minecraft.entity.mob.EvokerEntity; import net.minecraft.entity.mob.EvokerEntity;
import net.minecraft.entity.mob.IllagerEntity; import net.minecraft.entity.mob.IllagerEntity;
@ -37,7 +38,7 @@ public abstract class RenderPonyIllager<T extends IllagerEntity> extends RenderP
public static class Vindicator extends RenderPonyIllager<VindicatorEntity> { public static class Vindicator extends RenderPonyIllager<VindicatorEntity> {
public Vindicator(EntityRenderDispatcher manager) { public Vindicator(EntityRenderDispatcher manager, EntityRendererRegistry.Context context) {
super(manager); super(manager);
} }
@ -50,7 +51,7 @@ public abstract class RenderPonyIllager<T extends IllagerEntity> extends RenderP
public static class Evoker extends RenderPonyIllager<EvokerEntity> { public static class Evoker extends RenderPonyIllager<EvokerEntity> {
public Evoker(EntityRenderDispatcher manager) { public Evoker(EntityRenderDispatcher manager, EntityRendererRegistry.Context context) {
super(manager); super(manager);
} }
@ -62,7 +63,7 @@ public abstract class RenderPonyIllager<T extends IllagerEntity> extends RenderP
public static class Illusionist extends RenderPonyIllager<IllusionerEntity> { public static class Illusionist extends RenderPonyIllager<IllusionerEntity> {
public Illusionist(EntityRenderDispatcher manager) { public Illusionist(EntityRenderDispatcher manager, EntityRendererRegistry.Context context) {
super(manager); super(manager);
} }

View file

@ -1,5 +1,6 @@
package com.minelittlepony.client.render.entities; package com.minelittlepony.client.render.entities;
import net.fabricmc.fabric.api.client.render.EntityRendererRegistry;
import net.minecraft.client.render.entity.EntityRenderDispatcher; import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.entity.mob.PillagerEntity; import net.minecraft.entity.mob.PillagerEntity;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
@ -12,7 +13,7 @@ public class RenderPonyPillager extends RenderPonyMob<PillagerEntity, ModelPilla
private static final Identifier TEXTURES = new Identifier("minelittlepony", "textures/entity/illager/pillager_pony.png"); private static final Identifier TEXTURES = new Identifier("minelittlepony", "textures/entity/illager/pillager_pony.png");
public RenderPonyPillager(EntityRenderDispatcher manager) { public RenderPonyPillager(EntityRenderDispatcher manager, EntityRendererRegistry.Context context) {
super(manager, new ModelPillagerPony<PillagerEntity>()); super(manager, new ModelPillagerPony<PillagerEntity>());
} }

View file

@ -6,6 +6,7 @@ import com.minelittlepony.client.render.layer.LayerHeldPonyItemMagical;
import com.minelittlepony.client.render.layer.LayerPonyStrayOverlay; import com.minelittlepony.client.render.layer.LayerPonyStrayOverlay;
import com.mojang.blaze3d.platform.GlStateManager; 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.EntityRenderDispatcher;
import net.minecraft.entity.mob.AbstractSkeletonEntity; import net.minecraft.entity.mob.AbstractSkeletonEntity;
import net.minecraft.entity.mob.StrayEntity; import net.minecraft.entity.mob.StrayEntity;
@ -18,7 +19,7 @@ public class RenderPonySkeleton<Skeleton extends AbstractSkeletonEntity> extends
public static final Identifier WITHER = new Identifier("minelittlepony", "textures/entity/skeleton/skeleton_wither_pony.png"); 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 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<>()); super(manager, new ModelSkeletonPony<>());
} }
@ -34,8 +35,8 @@ public class RenderPonySkeleton<Skeleton extends AbstractSkeletonEntity> extends
public static class Stray extends RenderPonySkeleton<StrayEntity> { public static class Stray extends RenderPonySkeleton<StrayEntity> {
public Stray(EntityRenderDispatcher manager) { public Stray(EntityRenderDispatcher manager, EntityRendererRegistry.Context context) {
super(manager); super(manager, context);
addFeature(new LayerPonyStrayOverlay<>(this)); addFeature(new LayerPonyStrayOverlay<>(this));
} }
@ -47,8 +48,8 @@ public class RenderPonySkeleton<Skeleton extends AbstractSkeletonEntity> extends
public static class Wither extends RenderPonySkeleton<WitherSkeletonEntity> { public static class Wither extends RenderPonySkeleton<WitherSkeletonEntity> {
public Wither(EntityRenderDispatcher manager) { public Wither(EntityRenderDispatcher manager, EntityRendererRegistry.Context context) {
super(manager); super(manager, context);
} }
@Override @Override

View file

@ -1,5 +1,6 @@
package com.minelittlepony.client.render.entities; package com.minelittlepony.client.render.entities;
import net.fabricmc.fabric.api.client.render.EntityRendererRegistry;
import net.minecraft.client.render.entity.EntityRenderDispatcher; import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.entity.passive.WanderingTraderEntity; import net.minecraft.entity.passive.WanderingTraderEntity;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
@ -11,7 +12,7 @@ public class RenderPonyTrader extends RenderPonyMob.Caster<WanderingTraderEntity
public static final Identifier TEXTURE = new Identifier("minelittlepony", "textures/entity/wandering_trader_pony.png"); public static final Identifier TEXTURE = new Identifier("minelittlepony", "textures/entity/wandering_trader_pony.png");
public RenderPonyTrader(EntityRenderDispatcher manager) { public RenderPonyTrader(EntityRenderDispatcher manager, EntityRendererRegistry.Context context) {
super(manager, new ModelAlicorn<>(false)); super(manager, new ModelAlicorn<>(false));
} }

View file

@ -1,5 +1,6 @@
package com.minelittlepony.client.render.entities; 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.BipedEntityRenderer;
import net.minecraft.client.render.entity.EntityRenderDispatcher; import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.entity.mob.VexEntity; import net.minecraft.entity.mob.VexEntity;
@ -16,7 +17,7 @@ public class RenderPonyVex extends BipedEntityRenderer<VexEntity, ModelBreezie<V
private static final Identifier VEX = new Identifier("minelittlepony", "textures/entity/illager/vex_pony.png"); private static final Identifier VEX = new Identifier("minelittlepony", "textures/entity/illager/vex_pony.png");
private static final Identifier VEX_CHARGING = new Identifier("minelittlepony", "textures/entity/illager/vex_charging_pony.png"); private static final Identifier VEX_CHARGING = new Identifier("minelittlepony", "textures/entity/illager/vex_charging_pony.png");
public RenderPonyVex(EntityRenderDispatcher manager) { public RenderPonyVex(EntityRenderDispatcher manager, EntityRendererRegistry.Context context) {
super(manager, new ModelBreezie<>(), 0.3F); super(manager, new ModelBreezie<>(), 0.3F);
} }

View file

@ -5,6 +5,7 @@ import com.minelittlepony.util.resources.FormattedTextureSupplier;
import com.minelittlepony.util.resources.ITextureSupplier; import com.minelittlepony.util.resources.ITextureSupplier;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.GlStateManager;
import net.fabricmc.fabric.api.client.render.EntityRendererRegistry;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.entity.EntityRenderDispatcher; import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.client.render.entity.feature.VillagerClothingFeatureRenderer; import net.minecraft.client.render.entity.feature.VillagerClothingFeatureRenderer;
@ -19,7 +20,7 @@ public class RenderPonyVillager extends RenderPonyMob.Caster<VillagerEntity, Mod
private static final ITextureSupplier<VillagerEntity> PROFESSIONS = new VillagerProfessionTextureCache<>(FORMATTER); private static final ITextureSupplier<VillagerEntity> PROFESSIONS = new VillagerProfessionTextureCache<>(FORMATTER);
public RenderPonyVillager(EntityRenderDispatcher manager) { public RenderPonyVillager(EntityRenderDispatcher manager, EntityRendererRegistry.Context context) {
super(manager, new ModelVillagerPony<>()); super(manager, new ModelVillagerPony<>());
} }

View file

@ -4,6 +4,7 @@ import com.minelittlepony.client.model.entities.ModelWitchPony;
import com.minelittlepony.client.render.layer.LayerHeldPonyItem; import com.minelittlepony.client.render.layer.LayerHeldPonyItem;
import com.mojang.blaze3d.platform.GlStateManager; 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.EntityRenderDispatcher;
import net.minecraft.client.render.model.json.ModelTransformation; import net.minecraft.client.render.model.json.ModelTransformation;
import net.minecraft.entity.mob.WitchEntity; import net.minecraft.entity.mob.WitchEntity;
@ -15,7 +16,7 @@ public class RenderPonyWitch extends RenderPonyMob<WitchEntity, ModelWitchPony>
private static final Identifier WITCH_TEXTURES = new Identifier("minelittlepony", "textures/entity/witch_pony.png"); 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()); super(manager, new ModelWitchPony());
} }

View file

@ -3,6 +3,7 @@ package com.minelittlepony.client.render.entities;
import com.minelittlepony.client.model.entities.ModelZombiePony; import com.minelittlepony.client.model.entities.ModelZombiePony;
import com.mojang.blaze3d.platform.GlStateManager; 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.EntityRenderDispatcher;
import net.minecraft.entity.mob.DrownedEntity; import net.minecraft.entity.mob.DrownedEntity;
import net.minecraft.entity.mob.GiantEntity; import net.minecraft.entity.mob.GiantEntity;
@ -18,7 +19,7 @@ public class RenderPonyZombie<Zombie extends ZombieEntity> extends RenderPonyMob
public static final Identifier PIGMAN = new Identifier("minelittlepony", "textures/entity/zombie/zombie_pigman_pony.png"); 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 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<>()); super(manager, new ModelZombiePony<>());
} }
@ -30,8 +31,8 @@ public class RenderPonyZombie<Zombie extends ZombieEntity> extends RenderPonyMob
public static class Drowned extends RenderPonyZombie<DrownedEntity> { public static class Drowned extends RenderPonyZombie<DrownedEntity> {
public Drowned(EntityRenderDispatcher manager) { public Drowned(EntityRenderDispatcher manager, EntityRendererRegistry.Context context) {
super(manager); super(manager, context);
} }
@Override @Override
@ -42,8 +43,8 @@ public class RenderPonyZombie<Zombie extends ZombieEntity> extends RenderPonyMob
public static class Pigman extends RenderPonyZombie<ZombiePigmanEntity> { public static class Pigman extends RenderPonyZombie<ZombiePigmanEntity> {
public Pigman(EntityRenderDispatcher manager) { public Pigman(EntityRenderDispatcher manager, EntityRendererRegistry.Context context) {
super(manager); super(manager, context);
} }
@Override @Override
@ -54,8 +55,8 @@ public class RenderPonyZombie<Zombie extends ZombieEntity> extends RenderPonyMob
public static class Husk extends RenderPonyZombie<HuskEntity> { public static class Husk extends RenderPonyZombie<HuskEntity> {
public Husk(EntityRenderDispatcher manager) { public Husk(EntityRenderDispatcher manager, EntityRendererRegistry.Context context) {
super(manager); super(manager, context);
} }
@Override @Override
@ -73,7 +74,7 @@ public class RenderPonyZombie<Zombie extends ZombieEntity> extends RenderPonyMob
public static class Giant extends RenderPonyMob.Caster<GiantEntity, ModelZombiePony<GiantEntity>> { public static class Giant extends RenderPonyMob.Caster<GiantEntity, ModelZombiePony<GiantEntity>> {
public Giant(EntityRenderDispatcher manager) { public Giant(EntityRenderDispatcher manager, EntityRendererRegistry.Context context) {
super(manager, new ModelZombiePony<>()); super(manager, new ModelZombiePony<>());
} }

View file

@ -4,6 +4,7 @@ import com.minelittlepony.client.model.entities.ModelZombieVillagerPony;
import com.minelittlepony.util.resources.FormattedTextureSupplier; import com.minelittlepony.util.resources.FormattedTextureSupplier;
import com.minelittlepony.util.resources.ITextureSupplier; import com.minelittlepony.util.resources.ITextureSupplier;
import net.fabricmc.fabric.api.client.render.EntityRendererRegistry;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.entity.EntityRenderDispatcher; import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.client.render.entity.feature.VillagerClothingFeatureRenderer; import net.minecraft.client.render.entity.feature.VillagerClothingFeatureRenderer;
@ -18,7 +19,7 @@ public class RenderPonyZombieVillager extends RenderPonyMob.Caster<ZombieVillage
private static final ITextureSupplier<ZombieVillagerEntity> PROFESSIONS = new VillagerProfessionTextureCache<>(FORMATTER); private static final ITextureSupplier<ZombieVillagerEntity> PROFESSIONS = new VillagerProfessionTextureCache<>(FORMATTER);
public RenderPonyZombieVillager(EntityRenderDispatcher manager) { public RenderPonyZombieVillager(EntityRenderDispatcher manager, EntityRendererRegistry.Context context) {
super(manager, new ModelZombieVillagerPony()); super(manager, new ModelZombieVillagerPony());
} }

View file

@ -2,13 +2,13 @@ package com.minelittlepony.client.render.tileentities.skull;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.minelittlepony.MineLittlePony; import com.minelittlepony.MineLittlePony;
import com.minelittlepony.client.MineLPClient;
import com.minelittlepony.client.render.LevitatingItemRenderer; import com.minelittlepony.client.render.LevitatingItemRenderer;
import com.minelittlepony.pony.IPony; import com.minelittlepony.pony.IPony;
import com.minelittlepony.settings.PonyConfig; import com.minelittlepony.settings.PonyConfig;
import com.minelittlepony.settings.PonySettings; import com.minelittlepony.settings.PonySettings;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import net.fabricmc.fabric.api.client.render.BlockEntityRendererRegistry;
import net.minecraft.block.SkullBlock; import net.minecraft.block.SkullBlock;
import net.minecraft.block.entity.SkullBlockEntity; import net.minecraft.block.entity.SkullBlockEntity;
import net.minecraft.client.render.block.entity.SkullBlockEntityRenderer; import net.minecraft.client.render.block.entity.SkullBlockEntityRenderer;
@ -48,7 +48,7 @@ public class PonySkullRenderer extends SkullBlockEntityRenderer {
if (PonySettings.PONYSKULLS.get()) { if (PonySettings.PONYSKULLS.get()) {
if (!(INSTANCE instanceof PonySkullRenderer)) { if (!(INSTANCE instanceof PonySkullRenderer)) {
backup = INSTANCE; backup = INSTANCE;
MineLPClient.getInstance().getModUtilities().addRenderer(SkullBlockEntity.class, ponyInstance); BlockEntityRendererRegistry.INSTANCE.register(SkullBlockEntity.class, ponyInstance);
INSTANCE = ponyInstance; INSTANCE = ponyInstance;
} }
} else { } else {
@ -57,7 +57,7 @@ public class PonySkullRenderer extends SkullBlockEntityRenderer {
if (backup == null) { if (backup == null) {
backup = new SkullBlockEntityRenderer(); backup = new SkullBlockEntityRenderer();
} }
MineLPClient.getInstance().getModUtilities().addRenderer(SkullBlockEntity.class, backup); BlockEntityRendererRegistry.INSTANCE.register(SkullBlockEntity.class, backup);
INSTANCE = backup; INSTANCE = backup;
} }
} }