mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-24 21:37:59 +01:00
1.20.1 -> 1.20.2
This commit is contained in:
parent
d346f7f60d
commit
47adfd5d83
30 changed files with 142 additions and 204 deletions
|
@ -4,8 +4,7 @@ buildscript {
|
|||
}
|
||||
}
|
||||
plugins {
|
||||
id 'java-library'
|
||||
id 'fabric-loom' version '1.1-SNAPSHOT'
|
||||
id 'fabric-loom' version '1.3-SNAPSHOT'
|
||||
id 'maven-publish'
|
||||
id 'com.modrinth.minotaur' version '2.+'
|
||||
id 'org.ajoberstar.reckon' version '0.13.0'
|
||||
|
@ -84,7 +83,10 @@ processResources {
|
|||
inputs.property "version", project.version.toString()
|
||||
|
||||
filesMatching("fabric.mod.json") {
|
||||
expand "version": project.version.toString()
|
||||
expand "version": project.version.toString(),
|
||||
"minecraftVersion": project.minecraft_version_range,
|
||||
"loaderVersion": ">=${project.loader_version}",
|
||||
"fabricVersion": ">=${project.fabric_version}"
|
||||
}
|
||||
|
||||
from 'LICENSE'
|
||||
|
@ -113,6 +115,7 @@ modrinth {
|
|||
versionNumber = version.toString()
|
||||
versionName = archivesBaseName + '-' + version
|
||||
changelog = "[Changelog](https://github.com/MineLittlePony/MineLittlePony/releases/tag/${version.toString()})"
|
||||
loaders = ['fabric', 'quilt']
|
||||
uploadFile = remapJar
|
||||
outlet.mcVersions().each{ver ->
|
||||
gameVersions.add ver
|
||||
|
|
|
@ -3,10 +3,10 @@ org.gradle.daemon=false
|
|||
|
||||
# Fabric Properties
|
||||
# check these on https://fabricmc.net/develop
|
||||
minecraft_version=1.20.1
|
||||
yarn_mappings=1.20.1+build.9
|
||||
loader_version=0.14.21
|
||||
fabric_version=0.85.0+1.20.1
|
||||
minecraft_version=1.20.2-rc1
|
||||
yarn_mappings=1.20.2-rc1+build.2
|
||||
loader_version=0.14.22
|
||||
fabric_version=0.88.5+1.20.2
|
||||
|
||||
# Mod Properties
|
||||
group=com.minelittlepony
|
||||
|
@ -15,12 +15,12 @@ org.gradle.daemon=false
|
|||
description=Mine Little Pony turns players and mobs into ponies. Press F9 ingame to access settings.
|
||||
|
||||
# Publishing
|
||||
minecraft_version_range=>=1.20.0
|
||||
minecraft_version_range=>=1.20.2
|
||||
modrinth_loader_type=fabric
|
||||
modrinth_project_id=JBjInUXM
|
||||
|
||||
# Dependencies
|
||||
modmenu_version=7.1.0
|
||||
kirin_version=1.15.2
|
||||
hd_skins_version=6.10.0+1.20
|
||||
mson_version=1.8.1
|
||||
modmenu_version=8.0.0-beta.1
|
||||
kirin_version=1.16.0-beta.1+1.20.2
|
||||
hd_skins_version=6.11.0-beta.2+1.20.2
|
||||
mson_version=1.9.0-beta.1
|
||||
|
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,5 +1,5 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
|
|
@ -1,20 +1,40 @@
|
|||
package com.minelittlepony.api.pony;
|
||||
|
||||
import net.minecraft.client.util.DefaultSkinHelper;
|
||||
import net.minecraft.client.util.SkinTextures;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import com.minelittlepony.api.pony.meta.Race;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public final class DefaultPonySkinHelper {
|
||||
public static final Identifier STEVE = new Identifier("minelittlepony", "textures/entity/player/wide/steve_pony.png");
|
||||
|
||||
private static final Map<Identifier, Identifier> SKINS = new HashMap<>();
|
||||
private static final Map<SkinTextures, SkinTextures> SKINS = new HashMap<>();
|
||||
|
||||
public static Identifier getPonySkin(Identifier original) {
|
||||
return SKINS.computeIfAbsent(original, DefaultPonySkinHelper::computePonySkin);
|
||||
public static SkinTextures getTextures(SkinTextures original) {
|
||||
return SKINS.computeIfAbsent(original, o -> {
|
||||
return new SkinTextures(
|
||||
new Identifier("minelittlepony", original.texture().getPath().replace(".png", "_pony.png")),
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
original.model(),
|
||||
false
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
private static Identifier computePonySkin(Identifier original) {
|
||||
return new Identifier("minelittlepony", original.getPath().replace(".png", "_pony.png"));
|
||||
public static String getModelType(UUID id) {
|
||||
SkinTextures textures = DefaultSkinHelper.getTexture(id);
|
||||
return getModelType(IPony.getManager().getPony(textures.texture(), id).race(), textures.model());
|
||||
}
|
||||
|
||||
public static String getModelType(Race race, SkinTextures.Model armShape) {
|
||||
if (race.isHuman()) {
|
||||
return armShape.getName();
|
||||
}
|
||||
return (armShape == SkinTextures.Model.SLIM) ? armShape.getName() + race.name().toLowerCase(Locale.ROOT) : race.name().toLowerCase(Locale.ROOT);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,8 +2,7 @@ package com.minelittlepony.api.pony.meta;
|
|||
|
||||
import com.minelittlepony.api.pony.TriggerPixelType;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
public enum Race implements TriggerPixelType<Race> {
|
||||
HUMAN (0x000000, false, false),
|
||||
|
@ -73,11 +72,4 @@ public enum Race implements TriggerPixelType<Race> {
|
|||
public int getColorCode() {
|
||||
return triggerPixel;
|
||||
}
|
||||
|
||||
public String getModelId(boolean isSlim) {
|
||||
if (isHuman()) {
|
||||
return isSlim ? "slim" : "default";
|
||||
}
|
||||
return isSlim ? "slim" + name().toLowerCase() : name().toLowerCase();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ import net.minecraft.client.gui.screen.Screen;
|
|||
import net.minecraft.text.*;
|
||||
|
||||
import com.minelittlepony.client.render.MobRenderers;
|
||||
import com.minelittlepony.client.render.PonyRenderDispatcher;
|
||||
import com.minelittlepony.client.settings.ClientPonyConfig;
|
||||
import com.minelittlepony.common.client.gui.GameGui;
|
||||
import com.minelittlepony.common.client.gui.ScrollContainer;
|
||||
|
@ -118,7 +117,7 @@ public class GuiPonySettings extends GameGui {
|
|||
.onChange(i == config.horsieMode ? (v -> {
|
||||
v = ((Setting<Boolean>)i).set(v);
|
||||
|
||||
PonyRenderDispatcher.getInstance().initialise(MinecraftClient.getInstance().getEntityRenderDispatcher(), true);
|
||||
MineLittlePony.getInstance().getRenderDispatcher().initialise(MinecraftClient.getInstance().getEntityRenderDispatcher(), true);
|
||||
return v;
|
||||
}) : (Setting<Boolean>)i)
|
||||
.setEnabled(enabled);
|
||||
|
@ -189,10 +188,10 @@ public class GuiPonySettings extends GameGui {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) {
|
||||
renderBackground(context);
|
||||
super.render(context, mouseX, mouseY, partialTicks);
|
||||
content.render(context, mouseX, mouseY, partialTicks);
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float tickDelta) {
|
||||
renderBackground(context, mouseX, mouseY, tickDelta);
|
||||
super.render(context, mouseX, mouseY, tickDelta);
|
||||
content.render(context, mouseX, mouseY, tickDelta);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -40,14 +40,14 @@ public class MineLittlePony implements ClientModInitializer {
|
|||
|
||||
public static final Logger logger = LogManager.getLogger("MineLittlePony");
|
||||
|
||||
private final PonyRenderDispatcher renderManager = PonyRenderDispatcher.getInstance();
|
||||
|
||||
private ClientPonyConfig config;
|
||||
private PonyManager ponyManager;
|
||||
private VariatedTextureSupplier variatedTextures;
|
||||
|
||||
private final KeyBinding keyBinding = new KeyBinding("key.minelittlepony.settings", InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_F9, "key.categories.misc");
|
||||
|
||||
private final PonyRenderDispatcher renderDispatcher = new PonyRenderDispatcher();
|
||||
|
||||
private boolean hasHdSkins;
|
||||
private boolean hasModMenu;
|
||||
|
||||
|
@ -82,7 +82,9 @@ public class MineLittlePony implements ClientModInitializer {
|
|||
// general events
|
||||
ClientReadyCallback.Handler.register();
|
||||
ClientTickEvents.END_CLIENT_TICK.register(this::onTick);
|
||||
ClientReadyCallback.EVENT.register(this::onClientReady);
|
||||
ClientReadyCallback.EVENT.register(client -> {
|
||||
renderDispatcher.initialise(client.getEntityRenderDispatcher(), false);
|
||||
});
|
||||
ScreenInitCallback.EVENT.register(this::onScreenInit);
|
||||
|
||||
config.load();
|
||||
|
@ -93,10 +95,6 @@ public class MineLittlePony implements ClientModInitializer {
|
|||
FabricLoader.getInstance().getEntrypoints("minelittlepony", ClientModInitializer.class).forEach(ClientModInitializer::onInitializeClient);
|
||||
}
|
||||
|
||||
private void onClientReady(MinecraftClient client) {
|
||||
renderManager.initialise(client.getEntityRenderDispatcher(), false);
|
||||
}
|
||||
|
||||
private void onTick(MinecraftClient client) {
|
||||
|
||||
boolean inGame = client.world != null && client.player != null && client.currentScreen == null;
|
||||
|
@ -148,5 +146,12 @@ public class MineLittlePony implements ClientModInitializer {
|
|||
public VariatedTextureSupplier getVariatedTextures() {
|
||||
return variatedTextures;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the static pony render manager responsible for all entity renderers.
|
||||
*/
|
||||
public PonyRenderDispatcher getRenderDispatcher() {
|
||||
return renderDispatcher;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ public class PonyBounds {
|
|||
float delta = MinecraftClient.getInstance().getTickDelta();
|
||||
|
||||
Entity vehicle = entity.getVehicle();
|
||||
double vehicleOffset = vehicle == null ? 0 : vehicle.getHeight() - vehicle.getMountedHeightOffset();
|
||||
double vehicleOffset = vehicle == null ? 0 : vehicle.getHeight() - entity.getRidingOffset(vehicle);
|
||||
|
||||
return new Vec3d(
|
||||
MathHelper.lerp(delta, entity.prevX, entity.getX()),
|
||||
|
|
|
@ -4,7 +4,6 @@ import com.minelittlepony.common.client.gui.ScrollContainer;
|
|||
import com.minelittlepony.common.client.gui.Tooltip;
|
||||
import com.minelittlepony.common.client.gui.element.Button;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
@ -25,15 +24,7 @@ public class SkinsProxy {
|
|||
@Nullable
|
||||
public Identifier getSkinTexture(GameProfile profile) {
|
||||
PlayerSkinProvider skins = MinecraftClient.getInstance().getSkinProvider();
|
||||
|
||||
@Nullable
|
||||
MinecraftProfileTexture texture = skins.getTextures(profile).get(MinecraftProfileTexture.Type.SKIN);
|
||||
|
||||
if (texture == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return skins.loadSkin(texture, MinecraftProfileTexture.Type.SKIN);
|
||||
return skins.getSkinTextures(profile).texture();
|
||||
}
|
||||
|
||||
public void renderOption(Screen screen, @Nullable Screen parent, int row, int RIGHT, ScrollContainer content) {
|
||||
|
|
|
@ -2,11 +2,9 @@ package com.minelittlepony.client.hdskins;
|
|||
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
|
||||
import com.minelittlepony.api.pony.IPony;
|
||||
import com.minelittlepony.api.pony.IPonyManager;
|
||||
import com.minelittlepony.api.pony.*;
|
||||
import com.minelittlepony.client.IPreviewModel;
|
||||
import com.minelittlepony.client.render.EquineRenderManager;
|
||||
import com.minelittlepony.hdskins.client.VanillaModels;
|
||||
import com.minelittlepony.hdskins.client.gui.player.*;
|
||||
import com.minelittlepony.hdskins.client.gui.player.skins.PlayerSkins;
|
||||
|
||||
|
@ -31,16 +29,4 @@ class DummyPony extends DummyPlayer implements IPreviewModel, IPonyManager.Force
|
|||
public boolean isSubmergedInWater() {
|
||||
return getTextures().getPosture().getActiveSkinType() == MineLPHDSkins.seaponySkinType || super.isSubmergedInWater();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModel() {
|
||||
if (getTextures().getPosture().getActiveSkinType() == MineLPHDSkins.seaponySkinType) {
|
||||
return VanillaModels.isSlim(getTextures().getSkinVariant()) ? "slimseapony" : "seapony";
|
||||
}
|
||||
return IPony.getManager()
|
||||
.getPony(this)
|
||||
.metadata()
|
||||
.getRace()
|
||||
.getModelId(VanillaModels.isSlim(getTextures().getSkinVariant()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.minelittlepony.client.hdskins;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
|
|
|
@ -118,13 +118,9 @@ public class MineLPHDSkins extends SkinsProxy implements ClientModInitializer {
|
|||
|
||||
@Override
|
||||
public Identifier getSkinTexture(GameProfile profile) {
|
||||
|
||||
Identifier skin = HDSkins.getInstance().getProfileRepository().getTextures(profile).get(SkinType.SKIN);
|
||||
|
||||
if (skin != null) {
|
||||
return skin;
|
||||
}
|
||||
|
||||
return super.getSkinTexture(profile);
|
||||
return HDSkins.getInstance().getProfileRepository()
|
||||
.getNow(profile)
|
||||
.getSkin(SkinType.SKIN)
|
||||
.orElseGet(() -> super.getSkinTexture(profile));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity implem
|
|||
|
||||
if (hasVehicle()) {
|
||||
value += getVehicle().getEyeHeight(getVehicle().getPose());
|
||||
value -= getVehicle().getMountedHeightOffset();
|
||||
value -= getRidingOffset(getVehicle());
|
||||
}
|
||||
|
||||
return Math.max(value, 0.1F);
|
||||
|
|
|
@ -2,11 +2,12 @@ package com.minelittlepony.client.mixin;
|
|||
|
||||
import com.minelittlepony.api.config.PonyLevel;
|
||||
import com.minelittlepony.api.pony.DefaultPonySkinHelper;
|
||||
import com.minelittlepony.api.pony.IPony;
|
||||
import com.minelittlepony.client.MineLittlePony;
|
||||
|
||||
import net.minecraft.client.util.DefaultSkinHelper;
|
||||
import net.minecraft.client.util.SkinTextures;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
|
@ -21,28 +22,16 @@ abstract class MixinDefaultSkinHelper {
|
|||
cancellable = true)
|
||||
private static void onGetTexture(CallbackInfoReturnable<Identifier> cir) {
|
||||
if (MineLittlePony.getInstance().getConfig().ponyLevel.get() == PonyLevel.PONIES) {
|
||||
cir.setReturnValue(DefaultPonySkinHelper.getPonySkin(cir.getReturnValue()));
|
||||
cir.setReturnValue(DefaultPonySkinHelper.STEVE);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "getTexture(Ljava/util/UUID;)Lnet/minecraft/util/Identifier;",
|
||||
@Inject(method = "getTexture(Ljava/util/UUID;)Lnet/minecraft/client/util/SkinTextures;",
|
||||
at = @At("RETURN"),
|
||||
cancellable = true)
|
||||
private static void onGetTexture(UUID uuid, CallbackInfoReturnable<Identifier> cir) {
|
||||
private static void onGetTexture(UUID uuid, CallbackInfoReturnable<SkinTextures> cir) {
|
||||
if (MineLittlePony.getInstance().getConfig().ponyLevel.get() == PonyLevel.PONIES) {
|
||||
cir.setReturnValue(DefaultPonySkinHelper.getPonySkin(cir.getReturnValue()));
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "getModel(Ljava/util/UUID;)Ljava/lang/String;",
|
||||
at = @At("RETURN"),
|
||||
cancellable = true)
|
||||
private static void onGetModel(UUID uuid, CallbackInfoReturnable<String> cir) {
|
||||
if (MineLittlePony.getInstance().getConfig().ponyLevel.get() == PonyLevel.PONIES) {
|
||||
cir.setReturnValue(IPony.getManager()
|
||||
.getPony(DefaultSkinHelper.getTexture(uuid), uuid)
|
||||
.race()
|
||||
.getModelId("slim".equalsIgnoreCase(cir.getReturnValue())));
|
||||
cir.setReturnValue(DefaultPonySkinHelper.getTextures(cir.getReturnValue()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
package com.minelittlepony.client.mixin;
|
||||
|
||||
import com.minelittlepony.api.pony.IPony;
|
||||
import com.minelittlepony.client.IPreviewModel;
|
||||
|
||||
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
||||
import net.minecraft.client.render.entity.EntityRenderDispatcher;
|
||||
import net.minecraft.entity.Entity;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(EntityRenderDispatcher.class)
|
||||
abstract class MixinEntityRenderDispatcher {
|
||||
@Redirect(
|
||||
method = "getRenderer(Lnet/minecraft/entity/Entity;)Lnet/minecraft/client/render/entity/EntityRenderer;",
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/client/network/AbstractClientPlayerEntity;getModel()Ljava/lang/String;"))
|
||||
private String getPlayerModel(AbstractClientPlayerEntity player, Entity entity) {
|
||||
if (player instanceof IPreviewModel) {
|
||||
return player.getModel();
|
||||
}
|
||||
return IPony.getManager()
|
||||
.getPony(player)
|
||||
.race()
|
||||
.getModelId(player.getModel().contains("slim"));
|
||||
}
|
||||
}
|
|
@ -4,7 +4,7 @@ import org.spongepowered.asm.mixin.Mixin;
|
|||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
import com.minelittlepony.client.render.PonyRenderDispatcher;
|
||||
import com.minelittlepony.client.MineLittlePony;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
|
@ -42,6 +42,6 @@ abstract class MixinHeldItemRenderer {
|
|||
VertexConsumerProvider renderContext,
|
||||
@Nullable World world,
|
||||
int lightUv, int overlayUv, int posLong) {
|
||||
PonyRenderDispatcher.getInstance().getMagicRenderer().renderItem(target, entity, item, transform, left, stack, renderContext, world, lightUv, posLong);
|
||||
MineLittlePony.getInstance().getRenderDispatcher().getMagicRenderer().renderItem(target, entity, item, transform, left, stack, renderContext, world, lightUv, posLong);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ import com.minelittlepony.api.config.PonyLevel;
|
|||
import com.minelittlepony.api.pony.IPony;
|
||||
import com.minelittlepony.api.pony.IPonyManager;
|
||||
import com.minelittlepony.client.MineLittlePony;
|
||||
import com.minelittlepony.client.render.PonyRenderDispatcher;
|
||||
import com.minelittlepony.client.render.blockentity.skull.PonySkullRenderer;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
@ -65,7 +64,7 @@ public class PonyManager implements IPonyManager, SimpleSynchronousResourceReloa
|
|||
}
|
||||
|
||||
if (entity instanceof LivingEntity living) {
|
||||
return Optional.ofNullable(PonyRenderDispatcher.getInstance().getPonyRenderer(living)).map(d -> d.getEntityPony(living));
|
||||
return Optional.ofNullable(MineLittlePony.getInstance().getRenderDispatcher().getPonyRenderer(living)).map(d -> d.getEntityPony(living));
|
||||
}
|
||||
|
||||
return Optional.empty();
|
||||
|
@ -76,14 +75,7 @@ public class PonyManager implements IPonyManager, SimpleSynchronousResourceReloa
|
|||
Identifier skin = getSkin(player);
|
||||
UUID uuid = player.getGameProfile() == null ? player.getUuid() : player.getGameProfile().getId();
|
||||
|
||||
if (skin == null) {
|
||||
if (config.ponyLevel.get() == PonyLevel.PONIES) {
|
||||
return getBackgroundPony(uuid);
|
||||
}
|
||||
|
||||
return getAsDefaulted(getPony(DefaultSkinHelper.getTexture(uuid)));
|
||||
}
|
||||
|
||||
if (skin != null) {
|
||||
if (player instanceof IPonyManager.ForcedPony) {
|
||||
return getPony(skin);
|
||||
}
|
||||
|
@ -91,6 +83,13 @@ public class PonyManager implements IPonyManager, SimpleSynchronousResourceReloa
|
|||
return getPony(skin, uuid);
|
||||
}
|
||||
|
||||
if (config.ponyLevel.get() == PonyLevel.PONIES) {
|
||||
return getBackgroundPony(uuid);
|
||||
}
|
||||
|
||||
return getAsDefaulted(getPony(DefaultSkinHelper.getTexture(uuid).texture()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPony getPony(Identifier resource, UUID uuid) {
|
||||
IPony pony = getPony(resource);
|
||||
|
@ -104,7 +103,7 @@ public class PonyManager implements IPonyManager, SimpleSynchronousResourceReloa
|
|||
|
||||
@Override
|
||||
public IPony getBackgroundPony(UUID uuid) {
|
||||
return getAsDefaulted(getPony(MineLittlePony.getInstance().getVariatedTextures().get(BACKGROUND_PONIES, uuid).orElse(DefaultSkinHelper.getTexture(uuid))));
|
||||
return getAsDefaulted(getPony(MineLittlePony.getInstance().getVariatedTextures().get(BACKGROUND_PONIES, uuid).orElse(DefaultSkinHelper.getTexture(uuid).texture())));
|
||||
}
|
||||
|
||||
private IPony getAsDefaulted(IPony pony) {
|
||||
|
@ -121,7 +120,7 @@ public class PonyManager implements IPonyManager, SimpleSynchronousResourceReloa
|
|||
return null;
|
||||
}
|
||||
if (player instanceof AbstractClientPlayerEntity) {
|
||||
return ((AbstractClientPlayerEntity)player).getSkinTexture();
|
||||
return ((AbstractClientPlayerEntity)player).method_52814().texture();
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -79,7 +79,7 @@ public class EquineRenderManager<T extends LivingEntity, M extends EntityModel<T
|
|||
if (entity.hasVehicle() && entity.getVehicle() instanceof LivingEntity) {
|
||||
|
||||
LivingEntity ridingEntity = (LivingEntity) entity.getVehicle();
|
||||
IPonyRenderContext<LivingEntity, ?> renderer = PonyRenderDispatcher.getInstance().getPonyRenderer(ridingEntity);
|
||||
IPonyRenderContext<LivingEntity, ?> renderer = MineLittlePony.getInstance().getRenderDispatcher().getPonyRenderer(ridingEntity);
|
||||
|
||||
if (renderer != null) {
|
||||
// negate vanilla translations so the rider begins at the ridees feet.
|
||||
|
|
|
@ -83,7 +83,7 @@ public final class MobRenderers {
|
|||
|
||||
public boolean set(boolean value) {
|
||||
value = option().set(value);
|
||||
apply(PonyRenderDispatcher.getInstance(), false);
|
||||
apply(MineLittlePony.getInstance().getRenderDispatcher(), false);
|
||||
return value;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
package com.minelittlepony.client.render;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import com.minelittlepony.api.pony.IPony;
|
||||
import com.minelittlepony.api.pony.meta.Race;
|
||||
import com.minelittlepony.client.mixin.MixinEntityRenderers;
|
||||
import com.minelittlepony.client.model.IPonyModel;
|
||||
|
@ -12,31 +15,25 @@ import org.jetbrains.annotations.Nullable;
|
|||
import com.minelittlepony.mson.api.Mson;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.render.entity.EntityRenderDispatcher;
|
||||
import net.minecraft.client.render.entity.EntityRenderer;
|
||||
import net.minecraft.client.render.entity.EntityRendererFactory;
|
||||
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
||||
import net.minecraft.client.render.entity.*;
|
||||
import net.minecraft.client.render.entity.model.EntityModel;
|
||||
import net.minecraft.client.util.SkinTextures;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
/**
|
||||
* Render manager responsible for replacing and restoring entity renderers when the client settings change.
|
||||
* Old values are persisted internally.
|
||||
*/
|
||||
public class PonyRenderDispatcher {
|
||||
|
||||
private static final PonyRenderDispatcher INSTANCE = new PonyRenderDispatcher();
|
||||
|
||||
/**
|
||||
* Gets the static pony render manager responsible for all entity renderers.
|
||||
*/
|
||||
public static PonyRenderDispatcher getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
private LevitatingItemRenderer magicRenderer = new LevitatingItemRenderer();
|
||||
|
||||
public LevitatingItemRenderer getMagicRenderer() {
|
||||
return magicRenderer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers all new player skin types. (currently only pony and slimpony).
|
||||
*/
|
||||
|
@ -50,14 +47,18 @@ public class PonyRenderDispatcher {
|
|||
}
|
||||
|
||||
private void registerPlayerSkin(EntityRenderDispatcher manager, Race race) {
|
||||
addPlayerSkin(manager, false, race);
|
||||
addPlayerSkin(manager, true, race);
|
||||
addPlayerSkin(manager, SkinTextures.Model.SLIM, race);
|
||||
addPlayerSkin(manager, SkinTextures.Model.WIDE, race);
|
||||
}
|
||||
|
||||
private void addPlayerSkin(EntityRenderDispatcher manager, boolean slimArms, Race race) {
|
||||
private void addPlayerSkin(EntityRenderDispatcher manager, SkinTextures.Model armShape, Race race) {
|
||||
Mson.getInstance().getEntityRendererRegistry().registerPlayerRenderer(
|
||||
race.getModelId(slimArms),
|
||||
ModelType.getPlayerModel(race).getFactory(slimArms)
|
||||
new Identifier("minelittlepony", race.name().toLowerCase(Locale.ROOT) + "/" + armShape.getName()),
|
||||
(Predicate<AbstractClientPlayerEntity>)(player -> {
|
||||
return IPony.getManager().getPony(player).metadata().getRace() == race
|
||||
&& player.method_52814().model() == armShape;
|
||||
}),
|
||||
ModelType.getPlayerModel(race).getFactory(armShape == SkinTextures.Model.SLIM)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -79,10 +80,6 @@ public class PonyRenderDispatcher {
|
|||
});
|
||||
}
|
||||
|
||||
public LevitatingItemRenderer getMagicRenderer() {
|
||||
return magicRenderer;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Nullable
|
||||
public <T extends LivingEntity, M extends EntityModel<T> & IPonyModel<T>> IPonyRenderContext<T, M> getPonyRenderer(@Nullable T entity) {
|
||||
|
|
|
@ -16,7 +16,6 @@ import net.minecraft.client.render.VertexConsumer;
|
|||
import net.minecraft.client.util.DefaultSkinHelper;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.Uuids;
|
||||
import net.minecraft.util.math.RotationAxis;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
@ -46,7 +45,7 @@ public class PlayerPonySkull implements ISkull {
|
|||
return skin;
|
||||
}
|
||||
|
||||
return DefaultSkinHelper.getTexture(Uuids.getUuidFromProfile(profile));
|
||||
return DefaultSkinHelper.getTexture(profile).texture();
|
||||
}
|
||||
|
||||
return DefaultSkinHelper.getTexture();
|
||||
|
|
|
@ -99,7 +99,7 @@ public abstract class AbstractPonyRenderer<T extends MobEntity, M extends Entity
|
|||
if (!entity.hasVehicle()) {
|
||||
stack.translate(0, 0, -entity.getWidth() / 2); // move us to the center of the shadow
|
||||
} else {
|
||||
stack.translate(0, entity.getHeightOffset(), 0);
|
||||
stack.translate(0, entity.getRidingOffset(entity.getVehicle()), 0);
|
||||
}
|
||||
|
||||
stack.scale(scale, scale, scale);
|
||||
|
|
|
@ -68,8 +68,8 @@ public class PlayerPonyRenderer extends PlayerEntityRenderer implements IPonyRen
|
|||
|
||||
@Override
|
||||
protected void scale(AbstractClientPlayerEntity entity, MatrixStack stack, float tickDelta) {
|
||||
if (manager.getModel().getAttributes().isSitting) {
|
||||
stack.translate(0, entity.getHeightOffset(), 0);
|
||||
if (manager.getModel().getAttributes().isSitting && entity.hasVehicle()) {
|
||||
stack.translate(0, entity.getRidingOffset(entity.getVehicle()), 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -144,7 +144,7 @@ public class PlayerPonyRenderer extends PlayerEntityRenderer implements IPonyRen
|
|||
stack.translate(reflect * 0.1F, -0.54F, 0);
|
||||
|
||||
Identifier texture = getTexture(player);
|
||||
Identifier playerSkin = player.getSkinTexture();
|
||||
Identifier playerSkin = player.method_52814().texture();
|
||||
VertexConsumerProvider interceptedContext = layer -> {
|
||||
return renderContext.getBuffer(RenderLayerUtil
|
||||
.getTexture(layer)
|
||||
|
|
|
@ -85,7 +85,7 @@ public class ArmourFeature<T extends LivingEntity, M extends EntityModel<T> & IP
|
|||
}
|
||||
|
||||
if (stack.getItem() instanceof ArmorItem armor) {
|
||||
ArmorTrim.getTrim(entity.getWorld().getRegistryManager(), stack).ifPresent(trim -> {
|
||||
ArmorTrim.getTrim(entity.getWorld().getRegistryManager(), stack, true).ifPresent(trim -> {
|
||||
pony.getArmourModel(stack, layer, ArmourVariant.TRIM)
|
||||
.filter(m -> m.poseModel(entity, limbAngle, limbDistance, age, headYaw, headPitch, armorSlot, layer, pony.body()))
|
||||
.ifPresent(m -> {
|
||||
|
@ -107,7 +107,7 @@ public class ArmourFeature<T extends LivingEntity, M extends EntityModel<T> & IP
|
|||
);
|
||||
|
||||
return sprite.getTextureSpecificVertexConsumer(
|
||||
ItemRenderer.getDirectItemGlintConsumer(provider, TexturedRenderLayers.getArmorTrims(), true, glint)
|
||||
ItemRenderer.getDirectItemGlintConsumer(provider, TexturedRenderLayers.getArmorTrims(trim.getPattern().value().decal()), true, glint)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,8 +25,8 @@ public class CapeFeature<M extends ClientPonyModel<AbstractClientPlayerEntity>>
|
|||
public void render(MatrixStack stack, VertexConsumerProvider renderContext, int lightUv, AbstractClientPlayerEntity player, float limbDistance, float limbAngle, float tickDelta, float age, float headYaw, float headPitch) {
|
||||
M model = getModelWrapper().body();
|
||||
|
||||
if (player.hasSkinTexture() && !player.isInvisible()
|
||||
&& player.isPartVisible(PlayerModelPart.CAPE) && player.getCapeTexture() != null
|
||||
if (!player.isInvisible()
|
||||
&& player.isPartVisible(PlayerModelPart.CAPE) && player.method_52814().capeTexture() != null
|
||||
&& player.getEquippedStack(EquipmentSlot.CHEST).getItem() != Items.ELYTRA) {
|
||||
|
||||
stack.push();
|
||||
|
@ -64,7 +64,7 @@ public class CapeFeature<M extends ClientPonyModel<AbstractClientPlayerEntity>>
|
|||
stack.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(180));
|
||||
stack.multiply(RotationAxis.POSITIVE_X.rotationDegrees(90));
|
||||
|
||||
VertexConsumer vertices = renderContext.getBuffer(RenderLayer.getEntitySolid(player.getCapeTexture()));
|
||||
VertexConsumer vertices = renderContext.getBuffer(RenderLayer.getEntitySolid(player.method_52814().capeTexture()));
|
||||
model.renderCape(stack, vertices, lightUv, OverlayTexture.DEFAULT_UV);
|
||||
stack.pop();
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ public class DJPon3Feature<T extends AbstractClientPlayerEntity, M extends Entit
|
|||
|
||||
deadMau5.setVisible(true);
|
||||
|
||||
VertexConsumer vertices = renderContext.getBuffer(deadMau5.getLayer(entity.getSkinTexture()));
|
||||
VertexConsumer vertices = renderContext.getBuffer(deadMau5.getLayer(entity.method_52814().texture()));
|
||||
|
||||
deadMau5.render(stack, vertices, OverlayTexture.DEFAULT_UV, lightUv, limbDistance, limbAngle, tickDelta, 1);
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ import net.minecraft.client.render.VertexConsumerProvider;
|
|||
import net.minecraft.client.render.entity.PlayerModelPart;
|
||||
import net.minecraft.client.render.entity.model.EntityModel;
|
||||
import net.minecraft.client.render.item.ItemRenderer;
|
||||
import net.minecraft.client.util.SkinTextures;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.Items;
|
||||
|
@ -66,21 +67,15 @@ public class ElytraFeature<T extends LivingEntity, M extends EntityModel<T> & IP
|
|||
}
|
||||
|
||||
protected Identifier getElytraTexture(T entity) {
|
||||
if (entity instanceof AbstractClientPlayerEntity) {
|
||||
AbstractClientPlayerEntity player = (AbstractClientPlayerEntity) entity;
|
||||
if (entity instanceof AbstractClientPlayerEntity player) {
|
||||
SkinTextures textures = player.method_52814();
|
||||
|
||||
Identifier result;
|
||||
|
||||
if (player.hasSkinTexture()) {
|
||||
result = player.getElytraTexture();
|
||||
|
||||
if (result != null) return result;
|
||||
if (textures.elytraTexture() != null) {
|
||||
return textures.elytraTexture();
|
||||
}
|
||||
|
||||
if (player.hasSkinTexture() && player.isPartVisible(PlayerModelPart.CAPE)) {
|
||||
result = player.getCapeTexture();
|
||||
|
||||
if (result != null) return result;
|
||||
if (textures.capeTexture() != null && player.isPartVisible(PlayerModelPart.CAPE)) {
|
||||
return textures.capeTexture();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@ import org.jetbrains.annotations.Nullable;
|
|||
import com.minelittlepony.api.pony.IPony;
|
||||
import com.minelittlepony.client.SkinsProxy;
|
||||
import com.minelittlepony.util.FunctionUtil;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class PlayerTextureSupplier {
|
||||
|
@ -25,24 +25,20 @@ public class PlayerTextureSupplier {
|
|||
}
|
||||
|
||||
static final class Entry {
|
||||
@Nullable
|
||||
private GameProfile profile;
|
||||
private final CompletableFuture<Identifier> profile;
|
||||
|
||||
Entry(LivingEntity entity) {
|
||||
SkullBlockEntity.loadProperties(new GameProfile(null, entity.getCustomName().getString()), resolved -> {
|
||||
profile = resolved;
|
||||
profile = SkullBlockEntity.fetchProfile(entity.getCustomName().getString()).thenApply(profile -> {
|
||||
return profile
|
||||
.map(p -> SkinsProxy.instance.getSkinTexture(p))
|
||||
.filter(skin -> !IPony.getManager().getPony(skin).race().isHuman())
|
||||
.orElse(null);
|
||||
});
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Identifier getTexture() {
|
||||
if (profile != null) {
|
||||
Identifier skin = SkinsProxy.instance.getSkinTexture(profile);
|
||||
if (skin != null && !IPony.getManager().getPony(skin).race().isHuman()) {
|
||||
return skin;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return profile.getNow(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,3 +9,5 @@ accessible method net/minecraft/client/render/RenderLayer
|
|||
accessible method net/minecraft/client/render/RenderLayer$MultiPhase getPhases ()Lnet/minecraft/client/render/RenderLayer$MultiPhaseParameters;
|
||||
accessible method net/minecraft/client/render/RenderPhase$TextureBase getId ()Ljava/util/Optional;
|
||||
accessible field net/minecraft/client/render/RenderLayer$MultiPhaseParameters texture Lnet/minecraft/client/render/RenderPhase$TextureBase;
|
||||
|
||||
accessible method net/minecraft/block/entity/SkullBlockEntity fetchProfile (Ljava/lang/String;)Ljava/util/concurrent/CompletableFuture;
|
|
@ -8,7 +8,6 @@
|
|||
"IResizeable",
|
||||
"MixinCamera",
|
||||
"MixinDefaultSkinHelper",
|
||||
"MixinEntityRenderDispatcher",
|
||||
"MixinEntityRenderers",
|
||||
"MixinSkullBlockEntityRenderer",
|
||||
"MixinHeldItemRenderer",
|
||||
|
|
Loading…
Reference in a new issue