From dad8f837183e11a1f59e58f6d62052b34634700e Mon Sep 17 00:00:00 2001 From: Sollace Date: Mon, 29 May 2023 20:26:00 +0100 Subject: [PATCH] 1.19.4 -> 1.20-pre6 --- gradle.properties | 16 ++++++++-------- .../minelittlepony/api/pony/PonyPosture.java | 4 ++-- .../minelittlepony/client/GuiPonySettings.java | 10 +++++----- .../client/hdskins/PonyPreview.java | 18 +++++++++--------- .../render/entity/PlayerPonyRenderer.java | 1 + .../render/entity/feature/ArmourFeature.java | 17 +++++++---------- .../render/entity/feature/SkullFeature.java | 2 +- 7 files changed, 33 insertions(+), 35 deletions(-) diff --git a/gradle.properties b/gradle.properties index ea565ba2..84d3dbe4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,10 +3,10 @@ org.gradle.daemon=false # Fabric Properties # check these on https://fabricmc.net/develop - minecraft_version=1.19.4 - yarn_mappings=1.19.4+build.1 - loader_version=0.14.17 - fabric_version=0.76.0+1.19.4 + minecraft_version=1.20-pre6 + yarn_mappings=1.20-pre6+build.2 + loader_version=0.14.21 + fabric_version=0.82.1+1.20 # 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.19.4 + minecraft_version_range=>=1.20.0 modrinth_loader_type=fabric modrinth_project_id=JBjInUXM # Dependencies - modmenu_version=6.1.0-rc.4 - kirin_version=1.14.0 - hd_skins_version=6.8.0 + modmenu_version=7.0.0-beta.2 + kirin_version=1.15.0-beta.4 + hd_skins_version=6.9.0-beta.1 mson_version=1.8.0 diff --git a/src/main/java/com/minelittlepony/api/pony/PonyPosture.java b/src/main/java/com/minelittlepony/api/pony/PonyPosture.java index fff85125..a0d61edc 100644 --- a/src/main/java/com/minelittlepony/api/pony/PonyPosture.java +++ b/src/main/java/com/minelittlepony/api/pony/PonyPosture.java @@ -5,10 +5,10 @@ import com.minelittlepony.api.pony.meta.Race; import java.util.Optional; import net.minecraft.block.BlockState; -import net.minecraft.block.Material; import net.minecraft.block.StairsBlock; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.registry.tag.FluidTags; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; @@ -73,7 +73,7 @@ public final class PonyPosture { public static boolean isPartiallySubmerged(LivingEntity entity) { return entity.isSubmergedInWater() - || entity.getEntityWorld().getBlockState(entity.getBlockPos()).getMaterial() == Material.WATER; + || entity.getEntityWorld().getBlockState(entity.getBlockPos()).getFluidState().isIn(FluidTags.WATER); } public static boolean isSitting(LivingEntity entity) { diff --git a/src/main/java/com/minelittlepony/client/GuiPonySettings.java b/src/main/java/com/minelittlepony/client/GuiPonySettings.java index 8b789489..37cc980c 100644 --- a/src/main/java/com/minelittlepony/client/GuiPonySettings.java +++ b/src/main/java/com/minelittlepony/client/GuiPonySettings.java @@ -1,8 +1,8 @@ package com.minelittlepony.client; import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.*; import com.minelittlepony.client.render.MobRenderers; @@ -189,10 +189,10 @@ public class GuiPonySettings extends GameGui { } @Override - public void render(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) { - renderBackground(matrices); - super.render(matrices, mouseX, mouseY, partialTicks); - content.render(matrices, mouseX, mouseY, partialTicks); + 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); } @Override diff --git a/src/main/java/com/minelittlepony/client/hdskins/PonyPreview.java b/src/main/java/com/minelittlepony/client/hdskins/PonyPreview.java index f26ee06b..445d1560 100644 --- a/src/main/java/com/minelittlepony/client/hdskins/PonyPreview.java +++ b/src/main/java/com/minelittlepony/client/hdskins/PonyPreview.java @@ -1,6 +1,6 @@ package com.minelittlepony.client.hdskins; -import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.world.ClientWorld; import net.minecraft.text.Text; import net.minecraft.util.Identifier; @@ -52,26 +52,26 @@ class PonyPreview extends PlayerPreview { public void renderWorldAndPlayer(Optional thePlayer, Bounds frame, int horizon, int mouseX, int mouseY, int ticks, float partialTick, float scale, - MatrixStack matrices, @Nullable Consumer postAction) { - super.renderWorldAndPlayer(thePlayer, frame, horizon, mouseX, mouseY, ticks, partialTick, scale, matrices, postAction); + DrawContext context, @Nullable Consumer postAction) { + super.renderWorldAndPlayer(thePlayer, frame, horizon, mouseX, mouseY, ticks, partialTick, scale, context, postAction); thePlayer.ifPresent(p -> { IPonyData data = IPony.getManager().getPony(p).metadata(); int[] index = new int[1]; data.getTriggerPixels().forEach((key, value) -> { - drawLegendBlock(matrices, index[0]++, frame.left, frame.top, mouseX, mouseY, key, value); + drawLegendBlock(context, index[0]++, frame.left, frame.top, mouseX, mouseY, key, value); }); }); } - private void drawLegendBlock(MatrixStack matrices, int index, int x, int y, int mouseX, int mouseY, String key, TriggerPixelType value) { + private void drawLegendBlock(DrawContext context, int index, int x, int y, int mouseX, int mouseY, String key, TriggerPixelType value) { int size = 10; int yPos = y + index * size + 20; - fill(matrices, + context.fill( x, yPos, x + size, yPos + size, 0xFF003333 ); - fill(matrices, + context.fill( x + 1, yPos + 1, x - 1 + size, yPos - 1 + size, value.getColorCode() | 0xFF000000 @@ -82,7 +82,7 @@ class PonyPreview extends PlayerPreview { symbol = key.charAt(0); } - minecraft.textRenderer.drawWithShadow(matrices, + context.drawTextWithShadow(getFont(), Text.of(String.valueOf(symbol).toUpperCase()), x + 2, yPos + 1, @@ -107,7 +107,7 @@ class PonyPreview extends PlayerPreview { })); } - minecraft.currentScreen.renderTooltip(matrices, lines, mouseX, mouseY); + context.drawTooltip(getFont(), lines, mouseX, mouseY); } } } diff --git a/src/main/java/com/minelittlepony/client/render/entity/PlayerPonyRenderer.java b/src/main/java/com/minelittlepony/client/render/entity/PlayerPonyRenderer.java index 5811aa84..a682b3b7 100644 --- a/src/main/java/com/minelittlepony/client/render/entity/PlayerPonyRenderer.java +++ b/src/main/java/com/minelittlepony/client/render/entity/PlayerPonyRenderer.java @@ -37,6 +37,7 @@ public class PlayerPonyRenderer extends PlayerEntityRenderer implements IPonyRen addLayers(context); } + @SuppressWarnings({"unchecked", "rawtypes"}) protected void addLayers(EntityRendererFactory.Context context) { // remove vanilla features (keep modded ones) // TODO: test with https://github.com/Globox1997/BackSlot diff --git a/src/main/java/com/minelittlepony/client/render/entity/feature/ArmourFeature.java b/src/main/java/com/minelittlepony/client/render/entity/feature/ArmourFeature.java index b5cceace..212e9cf0 100644 --- a/src/main/java/com/minelittlepony/client/render/entity/feature/ArmourFeature.java +++ b/src/main/java/com/minelittlepony/client/render/entity/feature/ArmourFeature.java @@ -19,7 +19,6 @@ import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.LivingEntity; import net.minecraft.item.*; import net.minecraft.item.trim.ArmorTrim; -import net.minecraft.resource.featuretoggle.FeatureFlags; import net.minecraft.util.Identifier; public class ArmourFeature & IPonyModel> extends AbstractPonyFeature { @@ -85,16 +84,14 @@ public class ArmourFeature & IP }); } - if (entity.world.getEnabledFeatures().contains(FeatureFlags.UPDATE_1_20)) { - if (stack.getItem() instanceof ArmorItem armor) { - ArmorTrim.getTrim(entity.world.getRegistryManager(), stack).ifPresent(trim -> { - pony.getArmourModel(stack, layer, ArmourVariant.TRIM) - .filter(m -> m.poseModel(entity, limbAngle, limbDistance, age, headYaw, headPitch, armorSlot, layer, pony.body())) - .ifPresent(m -> { - m.render(matrices, getTrimConsumer(renderContext, armor.getMaterial(), trim, layer, glint), light, OverlayTexture.DEFAULT_UV, 1, 1, 1, 1); - }); + if (stack.getItem() instanceof ArmorItem armor) { + ArmorTrim.getTrim(entity.getWorld().getRegistryManager(), stack).ifPresent(trim -> { + pony.getArmourModel(stack, layer, ArmourVariant.TRIM) + .filter(m -> m.poseModel(entity, limbAngle, limbDistance, age, headYaw, headPitch, armorSlot, layer, pony.body())) + .ifPresent(m -> { + m.render(matrices, getTrimConsumer(renderContext, armor.getMaterial(), trim, layer, glint), light, OverlayTexture.DEFAULT_UV, 1, 1, 1, 1); }); - } + }); } }); } diff --git a/src/main/java/com/minelittlepony/client/render/entity/feature/SkullFeature.java b/src/main/java/com/minelittlepony/client/render/entity/feature/SkullFeature.java index 4c1fed3b..e9098b7c 100644 --- a/src/main/java/com/minelittlepony/client/render/entity/feature/SkullFeature.java +++ b/src/main/java/com/minelittlepony/client/render/entity/feature/SkullFeature.java @@ -76,7 +76,7 @@ public class SkullFeature & IPo stack.translate(0, 0.6F, -0.21F); MinecraftClient.getInstance().getItemRenderer() - .renderItem(entity, itemstack, ModelTransformationMode.HEAD, false, stack, renderContext, entity.world, lightUv, OverlayTexture.DEFAULT_UV, entity.getId() + ModelTransformationMode.HEAD.ordinal()); + .renderItem(entity, itemstack, ModelTransformationMode.HEAD, false, stack, renderContext, entity.getWorld(), lightUv, OverlayTexture.DEFAULT_UV, entity.getId() + ModelTransformationMode.HEAD.ordinal()); } private void renderSkull(MatrixStack stack, VertexConsumerProvider renderContext, ItemStack itemstack, boolean isVillager, float limbDistance, int lightUv) {