mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-25 13:57:59 +01:00
1.18.2 -> 1.19
This commit is contained in:
parent
58265838b2
commit
6f9fd38cb0
14 changed files with 61 additions and 66 deletions
|
@ -5,7 +5,7 @@ buildscript {
|
|||
}
|
||||
plugins {
|
||||
id 'java-library'
|
||||
id 'fabric-loom' version '0.10-SNAPSHOT'
|
||||
id 'fabric-loom' version '0.12-SNAPSHOT'
|
||||
id 'maven-publish'
|
||||
id 'com.modrinth.minotaur' version '1.1.0'
|
||||
id 'org.ajoberstar.reckon' version '0.13.0'
|
||||
|
@ -59,7 +59,7 @@ dependencies {
|
|||
modApi fabricApi.module("fabric-api-base", project.fabric_version)
|
||||
modApi fabricApi.module("fabric-lifecycle-events-v1", project.fabric_version)
|
||||
modApi fabricApi.module("fabric-resource-loader-v0", project.fabric_version)
|
||||
modApi fabricApi.module("fabric-networking-v0", project.fabric_version)
|
||||
modApi fabricApi.module("fabric-networking-api-v1", project.fabric_version)
|
||||
|
||||
modApi "com.minelittlepony:kirin:${project.kirin_version}"
|
||||
include "com.minelittlepony:kirin:${project.kirin_version}"
|
||||
|
|
|
@ -3,10 +3,10 @@ org.gradle.daemon=false
|
|||
|
||||
# Fabric Properties
|
||||
# check these on https://fabricmc.net/develop
|
||||
minecraft_version=1.18.2
|
||||
yarn_mappings=1.18.2+build.1
|
||||
loader_version=0.13.3
|
||||
fabric_version=0.47.8+1.18.2
|
||||
minecraft_version=1.19
|
||||
yarn_mappings=1.19+build.1
|
||||
loader_version=0.14.7
|
||||
fabric_version=0.55.3+1.19
|
||||
|
||||
# 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.18.1
|
||||
minecraft_version_range=>=1.19.0
|
||||
modrinth_loader_type=fabric
|
||||
modrinth_project_id=JBjInUXM
|
||||
|
||||
# Dependencies
|
||||
modmenu_version=3.1.0
|
||||
kirin_version=1.10.0
|
||||
hd_skins_version=6.5.2
|
||||
mson_version=1.5.1
|
||||
modmenu_version=4.0.0
|
||||
kirin_version=1.11.0-beta.2
|
||||
hd_skins_version=6.6.0
|
||||
mson_version=1.6.0-beta.3
|
||||
|
|
|
@ -15,7 +15,7 @@ import com.minelittlepony.client.MineLittlePony;
|
|||
public interface PonyDataCallback {
|
||||
|
||||
Event<PonyDataCallback> EVENT = EventFactory.createArrayBacked(PonyDataCallback.class, listeners -> (sender, data, noSkin, env) -> {
|
||||
MineLittlePony.logger.info("Got pony data on the " + env + " from " + sender.getName().asString() + " with " + (noSkin ? "un" : "") + "set skin and he is a " + data.getRace() + "!");
|
||||
MineLittlePony.logger.info("Got pony data on the " + env + " from " + sender.getName().getString() + " with " + (noSkin ? "un" : "") + "set skin and he is a " + data.getRace() + "!");
|
||||
for (PonyDataCallback event : listeners) {
|
||||
event.onPonyDataAvailable(sender, data, noSkin, env);
|
||||
}
|
||||
|
|
|
@ -2,8 +2,7 @@ package com.minelittlepony.client;
|
|||
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
import net.minecraft.text.*;
|
||||
|
||||
import com.minelittlepony.client.render.MobRenderers;
|
||||
import com.minelittlepony.client.settings.ClientPonyConfig;
|
||||
|
@ -25,13 +24,16 @@ import org.jetbrains.annotations.Nullable;
|
|||
*
|
||||
*/
|
||||
public class GuiPonySettings extends GameGui {
|
||||
|
||||
private static final String OPTIONS_PREFIX = "minelp.options.";
|
||||
|
||||
private static final String PONY_LEVEL = OPTIONS_PREFIX + "ponylevel";
|
||||
|
||||
private static final String MOB_PREFIX = "minelp.mobs.";
|
||||
|
||||
public static final Text SCALE_MEGA = Text.translatable("minelp.debug.scale.meg");
|
||||
public static final Text SCALE_MAX = Text.translatable("minelp.debug.scale.max");
|
||||
public static final Text SCALE_MID = Text.translatable("minelp.debug.scale.mid");
|
||||
public static final Text SCALE_SHOW = Text.translatable("minelp.debug.scale.sa");
|
||||
public static final Text SCALE_MIN = Text.translatable("minelp.debug.scale.min");
|
||||
|
||||
private ClientPonyConfig config;
|
||||
|
||||
private final ScrollContainer content = new ScrollContainer();
|
||||
|
@ -39,7 +41,7 @@ public class GuiPonySettings extends GameGui {
|
|||
private final boolean hiddenOptions;
|
||||
|
||||
public GuiPonySettings(@Nullable Screen parent) {
|
||||
super(new LiteralText(OPTIONS_PREFIX + "title"), parent);
|
||||
super(Text.literal(OPTIONS_PREFIX + "title"), parent);
|
||||
|
||||
config = (ClientPonyConfig)MineLittlePony.getInstance().getConfig();
|
||||
|
||||
|
@ -83,7 +85,7 @@ public class GuiPonySettings extends GameGui {
|
|||
|
||||
content.addButton(new EnumSlider<>(LEFT, row += 20, config.ponyLevel.get())
|
||||
.onChange(config.ponyLevel::set)
|
||||
.setTextFormat(sender -> new TranslatableText(PONY_LEVEL + "." + sender.getValue().name().toLowerCase()))
|
||||
.setTextFormat(sender -> Text.translatable(PONY_LEVEL + "." + sender.getValue().name().toLowerCase()))
|
||||
.setTooltipFormat(sender -> Tooltip.of(PONY_LEVEL + "." + sender.getValue().name().toLowerCase() + ".tooltip", 200)));
|
||||
|
||||
boolean allowCameraChange = client.player == null || client.player.isCreative() || client.player.isSpectator() || client.isInSingleplayer();
|
||||
|
@ -110,7 +112,7 @@ public class GuiPonySettings extends GameGui {
|
|||
button.getStyle().setText(OPTIONS_PREFIX + i.name().toLowerCase());
|
||||
if (!enabled) {
|
||||
button.getStyle()
|
||||
.setTooltip(new TranslatableText(OPTIONS_PREFIX + "option.disabled"))
|
||||
.setTooltip(Text.translatable(OPTIONS_PREFIX + "option.disabled"))
|
||||
.setTooltipOffset(0, 0);
|
||||
}
|
||||
}
|
||||
|
@ -139,29 +141,29 @@ public class GuiPonySettings extends GameGui {
|
|||
SkinsProxy.instance.renderOption(this, parent, row, RIGHT, content);
|
||||
}
|
||||
|
||||
public TranslatableText describeCurrentScale(AbstractSlider<Float> sender) {
|
||||
public Text describeCurrentScale(AbstractSlider<Float> sender) {
|
||||
float value = sender.getValue();
|
||||
if (value >= 3) {
|
||||
return new TranslatableText("minelp.debug.scale.meg");
|
||||
return SCALE_MEGA;
|
||||
}
|
||||
if (value == 2) {
|
||||
return new TranslatableText("minelp.debug.scale.max");
|
||||
return SCALE_MAX;
|
||||
}
|
||||
if (value == 1) {
|
||||
return new TranslatableText("minelp.debug.scale.mid");
|
||||
return SCALE_MID;
|
||||
}
|
||||
if (value == 0.9F) {
|
||||
return new TranslatableText("minelp.debug.scale.sa");
|
||||
return SCALE_SHOW;
|
||||
}
|
||||
if (value <= 0.1F) {
|
||||
return new TranslatableText("minelp.debug.scale.min");
|
||||
return SCALE_MIN;
|
||||
}
|
||||
|
||||
value *= 100F;
|
||||
value = Math.round(value);
|
||||
value /= 100F;
|
||||
|
||||
return new TranslatableText("minelp.debug.scale.value", value);
|
||||
return Text.translatable("minelp.debug.scale.value", value);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.minelittlepony.client.hdskins;
|
|||
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
|
@ -101,7 +100,7 @@ class PonyPreview extends PlayerPreview {
|
|||
|
||||
List<Text> lines = value.getOptions().stream().map(option -> {
|
||||
boolean selected = value.matches(option);
|
||||
return new LiteralText((selected ? "* " : " ") + option.name()).styled(s -> {
|
||||
return Text.literal((selected ? "* " : " ") + option.name()).styled(s -> {
|
||||
int color = option.getChannelAdjustedColorCode();
|
||||
return (color == 0 ? s : s.withColor(color)).withItalic(selected);
|
||||
});
|
||||
|
@ -109,7 +108,7 @@ class PonyPreview extends PlayerPreview {
|
|||
|
||||
lines.add(0, Text.of(key.toUpperCase() + ": " + value.getHexValue()));
|
||||
if (lines.size() == 1) {
|
||||
lines.add(new LiteralText(value.name()).styled(s -> {
|
||||
lines.add(Text.literal(value.name()).styled(s -> {
|
||||
int color = value.getChannelAdjustedColorCode();
|
||||
return color == 0 ? s : s.withColor(value.getColorCode());
|
||||
}));
|
||||
|
|
|
@ -17,7 +17,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|||
|
||||
@Mixin(ClientPlayerEntity.class)
|
||||
abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity implements Pony.RegistrationHandler {
|
||||
public MixinClientPlayerEntity() { super(null, null); }
|
||||
public MixinClientPlayerEntity() { super(null, null, null); }
|
||||
|
||||
private Pony pony;
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ public class DefaultArmourTextureResolver implements IArmourTextureResolver {
|
|||
}
|
||||
|
||||
private final boolean isValid(Identifier texture) {
|
||||
return MinecraftClient.getInstance().getResourceManager().containsResource(texture);
|
||||
return MinecraftClient.getInstance().getResourceManager().getResource(texture).isPresent();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -33,7 +33,7 @@ class BackgroundPonyList {
|
|||
|
||||
public void reloadAll(ResourceManager resourceManager) {
|
||||
backgroundPonyList.clear();
|
||||
backgroundPonyList.addAll(resourceManager.findResources("textures/entity/pony", path -> path.endsWith(".png")));
|
||||
backgroundPonyList.addAll(resourceManager.findResources("textures/entity/pony", path -> path.getPath().endsWith(".png")).keySet());
|
||||
MineLittlePony.logger.info("Detected {} background ponies installed.", backgroundPonyList.size());
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.minelittlepony.client.pony;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.resource.Resource;
|
||||
import net.minecraft.util.Identifier;
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
@ -16,11 +15,8 @@ import com.minelittlepony.client.MineLittlePony;
|
|||
import com.minelittlepony.client.util.render.NativeUtil;
|
||||
import com.minelittlepony.common.util.animation.Interpolator;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
|
@ -45,24 +41,21 @@ public class PonyData implements IPonyData {
|
|||
return MEM_NULL;
|
||||
}
|
||||
|
||||
try (Resource res = MinecraftClient.getInstance().getResourceManager().getResource(identifier)) {
|
||||
PonyData data = res.getMetadata(SERIALISER);
|
||||
|
||||
if (data != null) {
|
||||
return Memoize.of(data);
|
||||
return MinecraftClient.getInstance().getResourceManager().getResource(identifier).flatMap(res -> {
|
||||
try {
|
||||
return res.getMetadata().decode(SERIALISER);
|
||||
} catch (IOException e) {
|
||||
MineLittlePony.logger.warn("Unable to read {} metadata", identifier, e);
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
// Ignore uploaded texture
|
||||
} catch (IOException e) {
|
||||
MineLittlePony.logger.warn("Unable to read {} metadata", identifier, e);
|
||||
}
|
||||
|
||||
return Memoize.load(callback -> {
|
||||
NativeUtil.parseImage(identifier, img -> {
|
||||
callback.accept(new NativePonyData(img));
|
||||
}, e -> {
|
||||
MineLittlePony.logger.fatal("Unable to read {} metadata", identifier, e);
|
||||
callback.accept(NULL);
|
||||
return null;
|
||||
}).map(Memoize::of).orElseGet(() -> {
|
||||
return Memoize.load(callback -> {
|
||||
NativeUtil.parseImage(identifier, img -> {
|
||||
callback.accept(new NativePonyData(img));
|
||||
}, e -> {
|
||||
MineLittlePony.logger.fatal("Unable to read {} metadata", identifier, e);
|
||||
callback.accept(NULL);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -3,10 +3,11 @@ package com.minelittlepony.client.pony;
|
|||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.minelittlepony.api.pony.IPonyData;
|
||||
|
||||
import net.minecraft.resource.metadata.ResourceMetadataReader;
|
||||
|
||||
class PonyDataSerialiser implements ResourceMetadataReader<PonyData> {
|
||||
class PonyDataSerialiser implements ResourceMetadataReader<IPonyData> {
|
||||
|
||||
private static final Gson gson = new GsonBuilder()
|
||||
.excludeFieldsWithoutExposeAnnotation()
|
||||
|
@ -18,7 +19,7 @@ class PonyDataSerialiser implements ResourceMetadataReader<PonyData> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public PonyData fromJson(JsonObject json) {
|
||||
public IPonyData fromJson(JsonObject json) {
|
||||
return gson.fromJson(json, PonyData.class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,8 +10,8 @@ import com.mojang.authlib.GameProfile;
|
|||
import net.minecraft.client.render.VertexConsumer;
|
||||
import net.minecraft.client.util.DefaultSkinHelper;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.dynamic.DynamicSerializableUuid;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
|
@ -35,7 +35,7 @@ public class PonySkull extends AbstractPonySkull {
|
|||
return skin;
|
||||
}
|
||||
|
||||
return DefaultSkinHelper.getTexture(PlayerEntity.getUuidFromProfile(profile));
|
||||
return DefaultSkinHelper.getTexture(DynamicSerializableUuid.getUuidFromProfile(profile));
|
||||
}
|
||||
|
||||
return DefaultSkinHelper.getTexture();
|
||||
|
|
|
@ -34,9 +34,9 @@ public class PonyStandRenderer extends ArmorStandEntityRenderer {
|
|||
|
||||
features.clear();
|
||||
addFeature(new Armour(this, context));
|
||||
addFeature(new HeldItemFeatureRenderer<>(this));
|
||||
addFeature(new HeldItemFeatureRenderer<>(this, context.getHeldItemRenderer()));
|
||||
addFeature(new ElytraFeatureRenderer<>(this, context.getModelLoader()));
|
||||
addFeature(new HeadFeatureRenderer<>(this, context.getModelLoader()));
|
||||
addFeature(new HeadFeatureRenderer<>(this, context.getModelLoader(), context.getHeldItemRenderer()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -89,6 +89,6 @@ public class PonyStandRenderer extends ArmorStandEntityRenderer {
|
|||
}
|
||||
|
||||
static boolean isPonita(ArmorStandEntity entity) {
|
||||
return entity.hasCustomName() && "Ponita".equals(entity.getCustomName().asString());
|
||||
return entity.hasCustomName() && "Ponita".equals(entity.getCustomName().getString());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,8 +12,7 @@ import net.minecraft.block.AbstractSkullBlock;
|
|||
import net.minecraft.block.SkullBlock;
|
||||
import net.minecraft.block.SkullBlock.SkullType;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.client.render.VertexConsumerProvider;
|
||||
import net.minecraft.client.render.*;
|
||||
import net.minecraft.client.render.block.entity.SkullBlockEntityModel;
|
||||
import net.minecraft.client.render.block.entity.SkullBlockEntityRenderer;
|
||||
import net.minecraft.client.render.entity.model.EntityModel;
|
||||
|
@ -76,7 +75,8 @@ public class SkullFeature<T extends LivingEntity, M extends EntityModel<T> & IPo
|
|||
stack.scale(0.625F, -0.625F, -0.625F);
|
||||
stack.translate(0, 0.6F, -0.21F);
|
||||
|
||||
MinecraftClient.getInstance().getHeldItemRenderer().renderItem(entity, itemstack, ModelTransformation.Mode.HEAD, false, stack, renderContext, lightUv);
|
||||
MinecraftClient.getInstance().getItemRenderer()
|
||||
.renderItem(entity, itemstack, ModelTransformation.Mode.HEAD, false, stack, renderContext, entity.world, lightUv, OverlayTexture.DEFAULT_UV, entity.getId() + ModelTransformation.Mode.HEAD.ordinal());
|
||||
}
|
||||
|
||||
private void renderSkull(MatrixStack stack, VertexConsumerProvider renderContext, ItemStack itemstack, boolean isVillager, float limbDistance, int lightUv) {
|
||||
|
|
|
@ -82,7 +82,7 @@ public class PonyTextures<T extends LivingEntity & VillagerDataContainer> implem
|
|||
}
|
||||
|
||||
protected Optional<Identifier> verifyTexture(Identifier texture) {
|
||||
if (!resourceManager.containsResource(texture)) {
|
||||
if (resourceManager.getResource(texture).isEmpty()) {
|
||||
MineLittlePony.logger.warn("Villager texture `" + texture + "` was not found.");
|
||||
return Optional.empty();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue