1.19.4 -> 1.20-pre6

This commit is contained in:
Sollace 2023-05-29 20:26:00 +01:00
parent f1b6bb23a7
commit dad8f83718
7 changed files with 33 additions and 35 deletions

View file

@ -3,10 +3,10 @@ org.gradle.daemon=false
# Fabric Properties # Fabric Properties
# check these on https://fabricmc.net/develop # check these on https://fabricmc.net/develop
minecraft_version=1.19.4 minecraft_version=1.20-pre6
yarn_mappings=1.19.4+build.1 yarn_mappings=1.20-pre6+build.2
loader_version=0.14.17 loader_version=0.14.21
fabric_version=0.76.0+1.19.4 fabric_version=0.82.1+1.20
# Mod Properties # Mod Properties
group=com.minelittlepony 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. description=Mine Little Pony turns players and mobs into ponies. Press F9 ingame to access settings.
# Publishing # Publishing
minecraft_version_range=>=1.19.4 minecraft_version_range=>=1.20.0
modrinth_loader_type=fabric modrinth_loader_type=fabric
modrinth_project_id=JBjInUXM modrinth_project_id=JBjInUXM
# Dependencies # Dependencies
modmenu_version=6.1.0-rc.4 modmenu_version=7.0.0-beta.2
kirin_version=1.14.0 kirin_version=1.15.0-beta.4
hd_skins_version=6.8.0 hd_skins_version=6.9.0-beta.1
mson_version=1.8.0 mson_version=1.8.0

View file

@ -5,10 +5,10 @@ import com.minelittlepony.api.pony.meta.Race;
import java.util.Optional; import java.util.Optional;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.minecraft.block.StairsBlock; import net.minecraft.block.StairsBlock;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.registry.tag.FluidTags;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
@ -73,7 +73,7 @@ public final class PonyPosture {
public static boolean isPartiallySubmerged(LivingEntity entity) { public static boolean isPartiallySubmerged(LivingEntity entity) {
return entity.isSubmergedInWater() 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) { public static boolean isSitting(LivingEntity entity) {

View file

@ -1,8 +1,8 @@
package com.minelittlepony.client; package com.minelittlepony.client;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.*; import net.minecraft.text.*;
import com.minelittlepony.client.render.MobRenderers; import com.minelittlepony.client.render.MobRenderers;
@ -189,10 +189,10 @@ public class GuiPonySettings extends GameGui {
} }
@Override @Override
public void render(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) { public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) {
renderBackground(matrices); renderBackground(context);
super.render(matrices, mouseX, mouseY, partialTicks); super.render(context, mouseX, mouseY, partialTicks);
content.render(matrices, mouseX, mouseY, partialTicks); content.render(context, mouseX, mouseY, partialTicks);
} }
@Override @Override

View file

@ -1,6 +1,6 @@
package com.minelittlepony.client.hdskins; 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.client.world.ClientWorld;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
@ -52,26 +52,26 @@ class PonyPreview extends PlayerPreview {
public void renderWorldAndPlayer(Optional<DummyPlayer> thePlayer, public void renderWorldAndPlayer(Optional<DummyPlayer> thePlayer,
Bounds frame, Bounds frame,
int horizon, int mouseX, int mouseY, int ticks, float partialTick, float scale, int horizon, int mouseX, int mouseY, int ticks, float partialTick, float scale,
MatrixStack matrices, @Nullable Consumer<DummyPlayer> postAction) { DrawContext context, @Nullable Consumer<DummyPlayer> postAction) {
super.renderWorldAndPlayer(thePlayer, frame, horizon, mouseX, mouseY, ticks, partialTick, scale, matrices, postAction); super.renderWorldAndPlayer(thePlayer, frame, horizon, mouseX, mouseY, ticks, partialTick, scale, context, postAction);
thePlayer.ifPresent(p -> { thePlayer.ifPresent(p -> {
IPonyData data = IPony.getManager().getPony(p).metadata(); IPonyData data = IPony.getManager().getPony(p).metadata();
int[] index = new int[1]; int[] index = new int[1];
data.getTriggerPixels().forEach((key, value) -> { 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 size = 10;
int yPos = y + index * size + 20; int yPos = y + index * size + 20;
fill(matrices, context.fill(
x, yPos, x, yPos,
x + size, yPos + size, x + size, yPos + size,
0xFF003333 0xFF003333
); );
fill(matrices, context.fill(
x + 1, yPos + 1, x + 1, yPos + 1,
x - 1 + size, yPos - 1 + size, x - 1 + size, yPos - 1 + size,
value.getColorCode() | 0xFF000000 value.getColorCode() | 0xFF000000
@ -82,7 +82,7 @@ class PonyPreview extends PlayerPreview {
symbol = key.charAt(0); symbol = key.charAt(0);
} }
minecraft.textRenderer.drawWithShadow(matrices, context.drawTextWithShadow(getFont(),
Text.of(String.valueOf(symbol).toUpperCase()), Text.of(String.valueOf(symbol).toUpperCase()),
x + 2, x + 2,
yPos + 1, yPos + 1,
@ -107,7 +107,7 @@ class PonyPreview extends PlayerPreview {
})); }));
} }
minecraft.currentScreen.renderTooltip(matrices, lines, mouseX, mouseY); context.drawTooltip(getFont(), lines, mouseX, mouseY);
} }
} }
} }

View file

@ -37,6 +37,7 @@ public class PlayerPonyRenderer extends PlayerEntityRenderer implements IPonyRen
addLayers(context); addLayers(context);
} }
@SuppressWarnings({"unchecked", "rawtypes"})
protected void addLayers(EntityRendererFactory.Context context) { protected void addLayers(EntityRendererFactory.Context context) {
// remove vanilla features (keep modded ones) // remove vanilla features (keep modded ones)
// TODO: test with https://github.com/Globox1997/BackSlot // TODO: test with https://github.com/Globox1997/BackSlot

View file

@ -19,7 +19,6 @@ import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.item.*; import net.minecraft.item.*;
import net.minecraft.item.trim.ArmorTrim; import net.minecraft.item.trim.ArmorTrim;
import net.minecraft.resource.featuretoggle.FeatureFlags;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
public class ArmourFeature<T extends LivingEntity, M extends EntityModel<T> & IPonyModel<T>> extends AbstractPonyFeature<T, M> { public class ArmourFeature<T extends LivingEntity, M extends EntityModel<T> & IPonyModel<T>> extends AbstractPonyFeature<T, M> {
@ -85,16 +84,14 @@ public class ArmourFeature<T extends LivingEntity, M extends EntityModel<T> & IP
}); });
} }
if (entity.world.getEnabledFeatures().contains(FeatureFlags.UPDATE_1_20)) { if (stack.getItem() instanceof ArmorItem armor) {
if (stack.getItem() instanceof ArmorItem armor) { ArmorTrim.getTrim(entity.getWorld().getRegistryManager(), stack).ifPresent(trim -> {
ArmorTrim.getTrim(entity.world.getRegistryManager(), stack).ifPresent(trim -> { pony.getArmourModel(stack, layer, ArmourVariant.TRIM)
pony.getArmourModel(stack, layer, ArmourVariant.TRIM) .filter(m -> m.poseModel(entity, limbAngle, limbDistance, age, headYaw, headPitch, armorSlot, layer, pony.body()))
.filter(m -> m.poseModel(entity, limbAngle, limbDistance, age, headYaw, headPitch, armorSlot, layer, pony.body())) .ifPresent(m -> {
.ifPresent(m -> { m.render(matrices, getTrimConsumer(renderContext, armor.getMaterial(), trim, layer, glint), light, OverlayTexture.DEFAULT_UV, 1, 1, 1, 1);
m.render(matrices, getTrimConsumer(renderContext, armor.getMaterial(), trim, layer, glint), light, OverlayTexture.DEFAULT_UV, 1, 1, 1, 1);
});
}); });
} });
} }
}); });
} }

View file

@ -76,7 +76,7 @@ public class SkullFeature<T extends LivingEntity, M extends EntityModel<T> & IPo
stack.translate(0, 0.6F, -0.21F); stack.translate(0, 0.6F, -0.21F);
MinecraftClient.getInstance().getItemRenderer() 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) { private void renderSkull(MatrixStack stack, VertexConsumerProvider renderContext, ItemStack itemstack, boolean isVillager, float limbDistance, int lightUv) {