diff --git a/build.gradle b/build.gradle index 88f4fe0..eb0d8a3 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ plugins { id 'java-library' id "architectury-plugin" version "3.4-SNAPSHOT" - id "dev.architectury.loom" version "0.12.0-SNAPSHOT" apply false + id "dev.architectury.loom" version "1.2-SNAPSHOT" apply false } java { diff --git a/common/src/main/java/draylar/identity/Identity.java b/common/src/main/java/draylar/identity/Identity.java index c64bb3f..df4576a 100644 --- a/common/src/main/java/draylar/identity/Identity.java +++ b/common/src/main/java/draylar/identity/Identity.java @@ -23,7 +23,7 @@ import net.minecraft.network.PacketByteBuf; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registries; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -98,7 +98,7 @@ public static boolean isAquatic(LivingEntity entity) { } public static int getCooldown(EntityType type) { - String id = Registry.ENTITY_TYPE.getId(type).toString(); + String id = Registries.ENTITY_TYPE.getId(type).toString(); return IdentityConfig.getInstance().getAbilityCooldownMap().getOrDefault(id, 20); } } diff --git a/common/src/main/java/draylar/identity/ability/AbilityOverlayRenderer.java b/common/src/main/java/draylar/identity/ability/AbilityOverlayRenderer.java index 7e4ed4f..75c2e0f 100644 --- a/common/src/main/java/draylar/identity/ability/AbilityOverlayRenderer.java +++ b/common/src/main/java/draylar/identity/ability/AbilityOverlayRenderer.java @@ -111,7 +111,7 @@ else if(ticksSinceUpdate > fadingProgress) { // BakedModel heldItemModel = MinecraftClient.getInstance().getItemRenderer().getHeldItemModel(stack, client.world, player); // renderGuiItemModel(matrices, stack, (int) (width * .95f), (int) (height * .92f), heldItemModel); MinecraftClient.getInstance().getItemRenderer() - .renderGuiItemIcon(stack, (int) (width * .95f), (int) (height * .92f)); + .renderGuiItemIcon(matrices, stack, (int) (width * .95f), (int) (height * .92f)); RenderSystem.disableScissor(); matrices.pop(); diff --git a/common/src/main/java/draylar/identity/ability/impl/CreeperAbility.java b/common/src/main/java/draylar/identity/ability/impl/CreeperAbility.java index 133792d..ea9a314 100644 --- a/common/src/main/java/draylar/identity/ability/impl/CreeperAbility.java +++ b/common/src/main/java/draylar/identity/ability/impl/CreeperAbility.java @@ -6,13 +6,14 @@ import net.minecraft.item.Item; import net.minecraft.item.Items; import net.minecraft.world.World; +import net.minecraft.world.World.ExplosionSourceType; import net.minecraft.world.explosion.Explosion; public class CreeperAbility extends IdentityAbility { @Override public void onUse(PlayerEntity player, CreeperEntity identity, World world) { - world.createExplosion(player, player.getX(), player.getY(), player.getZ(), 3.0f, Explosion.DestructionType.NONE); + world.createExplosion(player, player.getX(), player.getY(), player.getZ(), 3.0f, ExplosionSourceType.NONE); } @Override diff --git a/common/src/main/java/draylar/identity/ability/impl/EvokerAbility.java b/common/src/main/java/draylar/identity/ability/impl/EvokerAbility.java index a15c64a..ef5b43e 100644 --- a/common/src/main/java/draylar/identity/ability/impl/EvokerAbility.java +++ b/common/src/main/java/draylar/identity/ability/impl/EvokerAbility.java @@ -30,7 +30,7 @@ public void onUse(PlayerEntity player, EvokerEntity identity, World world) { // If the block underneath is solid, we are good to go. EvokerFangsEntity fangs = new EvokerFangsEntity(world, origin.getX(), origin.getY(), origin.getZ(), player.getYaw(), blockOut * 2, player); - BlockPos underneathPosition = new BlockPos(origin).down(); + BlockPos underneathPosition = BlockPos.ofFloored(origin).down(); BlockState underneath = world.getBlockState(underneathPosition); if(underneath.isSideSolidFullSquare(world, underneathPosition, Direction.UP) && world.isAir(underneathPosition.up())) { world.spawnEntity(fangs); @@ -38,7 +38,7 @@ public void onUse(PlayerEntity player, EvokerEntity identity, World world) { } // Check underneath (2x down) again... - BlockPos underneath2Position = new BlockPos(origin).down(2); + BlockPos underneath2Position = BlockPos.ofFloored(origin).down(2); BlockState underneath2 = world.getBlockState(underneath2Position); if(underneath2.isSideSolidFullSquare(world, underneath2Position, Direction.UP) && world.isAir(underneath2Position.up())) { fangs.setPos(fangs.getX(), fangs.getY() - 1, fangs.getZ()); @@ -48,7 +48,7 @@ public void onUse(PlayerEntity player, EvokerEntity identity, World world) { } // Check above (1x up) - BlockPos upPosition = new BlockPos(origin).up(); + BlockPos upPosition = BlockPos.ofFloored(origin).up(); BlockState up = world.getBlockState(underneath2Position); if(up.isSideSolidFullSquare(world, upPosition, Direction.UP) && world.isAir(upPosition)) { fangs.setPos(fangs.getX(), fangs.getY() + 1, fangs.getZ()); diff --git a/common/src/main/java/draylar/identity/api/IdentityGranting.java b/common/src/main/java/draylar/identity/api/IdentityGranting.java index 779551d..1641322 100644 --- a/common/src/main/java/draylar/identity/api/IdentityGranting.java +++ b/common/src/main/java/draylar/identity/api/IdentityGranting.java @@ -8,7 +8,7 @@ import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.stat.Stats; import net.minecraft.text.Text; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registries; public class IdentityGranting { @@ -18,7 +18,7 @@ public static void grantByAttack(PlayerEntity player, IdentityType granted) { // If the player has to kill a certain number of mobs before unlocking an Identity, check their statistic for the specific type. if(IdentityConfig.getInstance().requiresKillsForIdentity()) { - String id = Registry.ENTITY_TYPE.getId(granted.getEntityType()).toString(); + String id = Registries.ENTITY_TYPE.getId(granted.getEntityType()).toString(); // Check against a specific count requirement or the default count. int required = IdentityConfig.getInstance().getRequiredKillsForIdentity(); diff --git a/common/src/main/java/draylar/identity/api/PlayerFavorites.java b/common/src/main/java/draylar/identity/api/PlayerFavorites.java index 3b7b02f..1c91e02 100644 --- a/common/src/main/java/draylar/identity/api/PlayerFavorites.java +++ b/common/src/main/java/draylar/identity/api/PlayerFavorites.java @@ -1,22 +1,12 @@ package draylar.identity.api; -import dev.architectury.networking.NetworkManager; import draylar.identity.api.variant.IdentityType; import draylar.identity.impl.PlayerDataProvider; -import draylar.identity.network.NetworkHandler; import draylar.identity.network.impl.FavoritePackets; -import io.netty.buffer.Unpooled; import net.minecraft.entity.EntityType; import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.nbt.NbtList; -import net.minecraft.nbt.NbtString; -import net.minecraft.network.PacketByteBuf; import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; -import java.util.List; import java.util.Set; public class PlayerFavorites { diff --git a/common/src/main/java/draylar/identity/api/PlayerIdentity.java b/common/src/main/java/draylar/identity/api/PlayerIdentity.java index d6aab1d..3ef42f0 100644 --- a/common/src/main/java/draylar/identity/api/PlayerIdentity.java +++ b/common/src/main/java/draylar/identity/api/PlayerIdentity.java @@ -10,7 +10,7 @@ import net.minecraft.nbt.NbtCompound; import net.minecraft.network.PacketByteBuf; import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registries; public class PlayerIdentity { @@ -57,7 +57,7 @@ public static void sync(ServerPlayerEntity changed, ServerPlayerEntity packetTar // put entity type ID under the key "id", or "minecraft:empty" if no identity is equipped (or the identity entity type is invalid) packet.writeUuid(changed.getUuid()); - packet.writeString(identity == null ? "minecraft:empty" : Registry.ENTITY_TYPE.getId(identity.getType()).toString()); + packet.writeString(identity == null ? "minecraft:empty" : Registries.ENTITY_TYPE.getId(identity.getType()).toString()); packet.writeNbt(entityTag); NetworkManager.sendToPlayer(packetTarget, NetworkHandler.IDENTITY_SYNC, packet); } diff --git a/common/src/main/java/draylar/identity/api/PlayerUnlocks.java b/common/src/main/java/draylar/identity/api/PlayerUnlocks.java index 834459d..41f33a4 100644 --- a/common/src/main/java/draylar/identity/api/PlayerUnlocks.java +++ b/common/src/main/java/draylar/identity/api/PlayerUnlocks.java @@ -1,23 +1,14 @@ package draylar.identity.api; import dev.architectury.event.EventResult; -import dev.architectury.networking.NetworkManager; import draylar.identity.api.event.UnlockIdentityCallback; import draylar.identity.api.variant.IdentityType; import draylar.identity.impl.PlayerDataProvider; -import draylar.identity.network.NetworkHandler; import draylar.identity.network.impl.UnlockPackets; -import io.netty.buffer.Unpooled; import net.minecraft.entity.EntityType; import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.nbt.NbtList; -import net.minecraft.nbt.NbtString; -import net.minecraft.network.PacketByteBuf; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.util.ActionResult; -import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; public class PlayerUnlocks { diff --git a/common/src/main/java/draylar/identity/api/model/EntityArms.java b/common/src/main/java/draylar/identity/api/model/EntityArms.java index ad34c7a..1ba16c0 100644 --- a/common/src/main/java/draylar/identity/api/model/EntityArms.java +++ b/common/src/main/java/draylar/identity/api/model/EntityArms.java @@ -8,8 +8,8 @@ import net.minecraft.entity.EntityType; import net.minecraft.entity.LivingEntity; import net.minecraft.util.Pair; -import net.minecraft.util.math.Vec3f; import org.jetbrains.annotations.Nullable; +import draylar.identity.math.math; import java.util.LinkedHashMap; import java.util.Map; @@ -71,15 +71,15 @@ public static void init() { register(LlamaEntityModel.class, (llama, model) -> ((LlamaEntityModelAccessor) model).getRightFrontLeg(), (stack, model) -> {}); register(PandaEntityModel.class, (llama, model) -> ((QuadrupedEntityModelAccessor) model).getRightFrontLeg(), (stack, model) -> stack.translate(0, -0.5, 0)); register(BlazeEntityModel.class, (llama, model) -> ((BlazeEntityModelAccessor) model).getRods()[10], (stack, model) -> { - stack.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(45)); - stack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(-15)); - stack.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(-25)); + stack.multiply(math.getDegreesQuaternion(math.POSITIVE_Z(), 45)); + stack.multiply(math.getDegreesQuaternion(math.POSITIVE_Y(), -15)); + stack.multiply(math.getDegreesQuaternion(math.POSITIVE_X(), -25)); stack.translate(0, 0, -.25); }); register(OcelotEntityModel.class, (ocelot, model) -> ((OcelotEntityModelAccessor) model).getRightFrontLeg(), (stack, model) -> {}); register(SpiderEntityModel.class, (spider, model) -> ((SpiderEntityModelAccessor) model).getRightFrontLeg(), (stack, model) -> { - stack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(-15)); - stack.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(15)); + stack.multiply(math.getDegreesQuaternion(math.POSITIVE_Y(), -15)); + stack.multiply(math.getDegreesQuaternion(math.POSITIVE_X(), 15)); stack.translate(0, 0, 0); }); register(IronGolemEntityModel.class, (golem, model) -> model.getRightArm(), (stack, model) -> { @@ -101,7 +101,7 @@ public static void init() { // types register(EntityType.PILLAGER, (pillager, model) -> ((IllagerEntityModelAccessor) model).getRightArm(), (stack, model) -> { - stack.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(-10)); + stack.multiply(math.getDegreesQuaternion(math.POSITIVE_X(), -10)); stack.translate(0, .5, -.3); }); } diff --git a/common/src/main/java/draylar/identity/api/variant/IdentityType.java b/common/src/main/java/draylar/identity/api/variant/IdentityType.java index 22b6703..de16a5f 100644 --- a/common/src/main/java/draylar/identity/api/variant/IdentityType.java +++ b/common/src/main/java/draylar/identity/api/variant/IdentityType.java @@ -7,7 +7,7 @@ import net.minecraft.nbt.NbtCompound; import net.minecraft.text.Text; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registries; import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; @@ -78,16 +78,16 @@ public static IdentityType from(Z entity) { @Nullable public static IdentityType from(NbtCompound compound) { Identifier id = new Identifier(compound.getString("EntityID")); - if(!Registry.ENTITY_TYPE.containsId(id)) { + if(!Registries.ENTITY_TYPE.containsId(id)) { return null; } - return new IdentityType(Registry.ENTITY_TYPE.get(id), compound.contains("Variant") ? compound.getInt("Variant") : -1); + return new IdentityType(Registries.ENTITY_TYPE.get(id), compound.contains("Variant") ? compound.getInt("Variant") : -1); } public static List> getAllTypes(World world) { if(LIVING_TYPE_CASH.isEmpty()) { - for (EntityType type : Registry.ENTITY_TYPE) { + for (EntityType type : Registries.ENTITY_TYPE) { Entity instance = type.create(world); if(instance instanceof LivingEntity) { LIVING_TYPE_CASH.add((EntityType) type); @@ -124,7 +124,7 @@ public static IdentityType from(EntityType entity public NbtCompound writeCompound() { NbtCompound compound = new NbtCompound(); - compound.putString("EntityID", Registry.ENTITY_TYPE.getId(type).toString()); + compound.putString("EntityID", Registries.ENTITY_TYPE.getId(type).toString()); compound.putInt("Variant", variantData); return compound; } diff --git a/common/src/main/java/draylar/identity/command/IdentityCommand.java b/common/src/main/java/draylar/identity/command/IdentityCommand.java index 63530c8..be90e68 100644 --- a/common/src/main/java/draylar/identity/command/IdentityCommand.java +++ b/common/src/main/java/draylar/identity/command/IdentityCommand.java @@ -7,7 +7,7 @@ import draylar.identity.api.platform.IdentityConfig; import draylar.identity.api.variant.IdentityType; import net.minecraft.command.argument.EntityArgumentType; -import net.minecraft.command.argument.EntitySummonArgumentType; +import net.minecraft.command.argument.RegistryEntryArgumentType; import net.minecraft.command.argument.NbtCompoundArgumentType; import net.minecraft.command.suggestion.SuggestionProviders; import net.minecraft.entity.Entity; @@ -20,7 +20,8 @@ import net.minecraft.server.world.ServerWorld; import net.minecraft.text.Text; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.Registries; import org.jetbrains.annotations.Nullable; public class IdentityCommand { @@ -50,12 +51,12 @@ public static void register() { return 1; }) ) - .then(CommandManager.argument("identity", EntitySummonArgumentType.entitySummon()).suggests(SuggestionProviders.SUMMONABLE_ENTITIES) + .then(CommandManager.argument("identity", RegistryEntryArgumentType.registryEntry(ctx, RegistryKeys.ENTITY_TYPE)).suggests(SuggestionProviders.SUMMONABLE_ENTITIES) .executes(context -> { grant( context.getSource().getPlayer(), EntityArgumentType.getPlayer(context, "player"), - EntitySummonArgumentType.getEntitySummon(context, "identity"), + EntityType.getId(RegistryEntryArgumentType.getSummonableEntityType(context, "identity").value()), null ); return 1; @@ -67,7 +68,7 @@ public static void register() { grant( context.getSource().getPlayer(), EntityArgumentType.getPlayer(context, "player"), - EntitySummonArgumentType.getEntitySummon(context, "identity"), + EntityType.getId(RegistryEntryArgumentType.getSummonableEntityType(context, "identity").value()), nbt ); @@ -93,12 +94,12 @@ public static void register() { return 1; }) ) - .then(CommandManager.argument("identity", EntitySummonArgumentType.entitySummon()).suggests(SuggestionProviders.SUMMONABLE_ENTITIES) + .then(CommandManager.argument("identity", RegistryEntryArgumentType.registryEntry(ctx, RegistryKeys.ENTITY_TYPE)).suggests(SuggestionProviders.SUMMONABLE_ENTITIES) .executes(context -> { revoke( context.getSource().getPlayer(), EntityArgumentType.getPlayer(context, "player"), - EntitySummonArgumentType.getEntitySummon(context, "identity"), + EntityType.getId(RegistryEntryArgumentType.getSummonableEntityType(context, "identity").value()), null ); return 1; @@ -110,7 +111,7 @@ public static void register() { revoke( context.getSource().getPlayer(), EntityArgumentType.getPlayer(context, "player"), - EntitySummonArgumentType.getEntitySummon(context, "identity"), + EntityType.getId(RegistryEntryArgumentType.getSummonableEntityType(context, "identity").value()), nbt ); @@ -124,11 +125,11 @@ public static void register() { LiteralCommandNode equip = CommandManager .literal("equip") .then(CommandManager.argument("player", EntityArgumentType.players()) - .then(CommandManager.argument("identity", EntitySummonArgumentType.entitySummon()).suggests(SuggestionProviders.SUMMONABLE_ENTITIES) + .then(CommandManager.argument("identity", RegistryEntryArgumentType.registryEntry(ctx, RegistryKeys.ENTITY_TYPE)).suggests(SuggestionProviders.SUMMONABLE_ENTITIES) .executes(context -> { equip(context.getSource().getPlayer(), EntityArgumentType.getPlayer(context, "player"), - EntitySummonArgumentType.getEntitySummon(context, "identity"), + EntityType.getId(RegistryEntryArgumentType.getSummonableEntityType(context, "identity").value()), null); return 1; @@ -139,7 +140,7 @@ public static void register() { equip(context.getSource().getPlayer(), EntityArgumentType.getPlayer(context, "player"), - EntitySummonArgumentType.getEntitySummon(context, "identity"), + EntityType.getId(RegistryEntryArgumentType.getSummonableEntityType(context, "identity").value()), nbt); return 1; @@ -166,22 +167,22 @@ public static void register() { .literal("test") .then(CommandManager.argument("player", EntityArgumentType.player()) .then(CommandManager.literal("not") - .then(CommandManager.argument("identity", EntitySummonArgumentType.entitySummon()).suggests(SuggestionProviders.SUMMONABLE_ENTITIES) + .then(CommandManager.argument("identity", RegistryEntryArgumentType.registryEntry(ctx, RegistryKeys.ENTITY_TYPE)).suggests(SuggestionProviders.SUMMONABLE_ENTITIES) .executes(context -> { return testNot( context.getSource().getPlayer(), EntityArgumentType.getPlayer(context, "player"), - EntitySummonArgumentType.getEntitySummon(context, "identity") + EntityType.getId(RegistryEntryArgumentType.getSummonableEntityType(context, "identity").value()) ); }) ) ) - .then(CommandManager.argument("identity", EntitySummonArgumentType.entitySummon()).suggests(SuggestionProviders.SUMMONABLE_ENTITIES) + .then(CommandManager.argument("identity", RegistryEntryArgumentType.registryEntry(ctx, RegistryKeys.ENTITY_TYPE)).suggests(SuggestionProviders.SUMMONABLE_ENTITIES) .executes(context -> { return test( context.getSource().getPlayer(), EntityArgumentType.getPlayer(context, "player"), - EntitySummonArgumentType.getEntitySummon(context, "identity") + EntityType.getId(RegistryEntryArgumentType.getSummonableEntityType(context, "identity").value()) ); }) ) @@ -199,7 +200,7 @@ public static void register() { } private static int test(ServerPlayerEntity source, ServerPlayerEntity player, Identifier identity) { - EntityType type = Registry.ENTITY_TYPE.get(identity); + EntityType type = Registries.ENTITY_TYPE.get(identity); if(PlayerIdentity.getIdentity(player) != null && PlayerIdentity.getIdentity(player).getType().equals(type)) { if(IdentityConfig.getInstance().logCommands()) { @@ -217,7 +218,7 @@ private static int test(ServerPlayerEntity source, ServerPlayerEntity player, Id } private static int testNot(ServerPlayerEntity source, ServerPlayerEntity player, Identifier identity) { - EntityType type = Registry.ENTITY_TYPE.get(identity); + EntityType type = Registries.ENTITY_TYPE.get(identity); if(PlayerIdentity.getIdentity(player) != null && !PlayerIdentity.getIdentity(player).getType().equals(type)) { if(IdentityConfig.getInstance().logCommands()) { @@ -235,7 +236,7 @@ private static int testNot(ServerPlayerEntity source, ServerPlayerEntity player, } private static void grant(ServerPlayerEntity source, ServerPlayerEntity player, Identifier id, @Nullable NbtCompound nbt) { - IdentityType type = new IdentityType(Registry.ENTITY_TYPE.get(id)); + IdentityType type = new IdentityType(Registries.ENTITY_TYPE.get(id)); Text name = Text.translatable(type.getEntityType().getTranslationKey()); // If the specified granting NBT is not null, change the IdentityType to reflect potential variants. @@ -265,7 +266,7 @@ private static void grant(ServerPlayerEntity source, ServerPlayerEntity player, } private static void revoke(ServerPlayerEntity source, ServerPlayerEntity player, Identifier id, @Nullable NbtCompound nbt) { - IdentityType type = new IdentityType(Registry.ENTITY_TYPE.get(id)); + IdentityType type = new IdentityType(Registries.ENTITY_TYPE.get(id)); Text name = Text.translatable(type.getEntityType().getTranslationKey()); // If the specified granting NBT is not null, change the IdentityType to reflect potential variants. @@ -303,7 +304,7 @@ private static void equip(ServerPlayerEntity source, ServerPlayerEntity player, ServerWorld serverWorld = source.getWorld(); created = EntityType.loadEntityWithPassengers(copy, serverWorld, it -> it); } else { - EntityType entity = Registry.ENTITY_TYPE.get(identity); + EntityType entity = Registries.ENTITY_TYPE.get(identity); created = entity.create(player.world); } diff --git a/common/src/main/java/draylar/identity/impl/tick/identity/FrogTickHandler.java b/common/src/main/java/draylar/identity/impl/tick/identity/FrogTickHandler.java index 6e0713a..4e2b95b 100644 --- a/common/src/main/java/draylar/identity/impl/tick/identity/FrogTickHandler.java +++ b/common/src/main/java/draylar/identity/impl/tick/identity/FrogTickHandler.java @@ -14,12 +14,13 @@ public void tick(PlayerEntity player, FrogEntity frog) { boolean walk = player.isOnGround() && player.getVelocity().horizontalLengthSquared() > 1.0E-6 && !player.isInsideWaterOrBubbleColumn(); boolean swim = player.getVelocity().horizontalLengthSquared() > 1.0E-6 && player.isInsideWaterOrBubbleColumn(); + /* // Walking implementation if (walk) { frog.walkingAnimationState.startIfNotRunning(frog.age); } else { frog.walkingAnimationState.stop(); - } + }*/ // Jumping if(!player.isOnGround() && !swim && !walk && !player.isInsideWaterOrBubbleColumn()) { @@ -31,12 +32,12 @@ public void tick(PlayerEntity player, FrogEntity frog) { // Swimming if (swim) { frog.idlingInWaterAnimationState.stop(); - frog.swimmingAnimationState.startIfNotRunning(frog.age); + //frog.swimmingAnimationState.startIfNotRunning(frog.age); } else if (player.isInsideWaterOrBubbleColumn()) { - frog.swimmingAnimationState.stop(); + //frog.swimmingAnimationState.stop(); frog.idlingInWaterAnimationState.startIfNotRunning(frog.age); } else { - frog.swimmingAnimationState.stop(); + //frog.swimmingAnimationState.stop(); frog.idlingInWaterAnimationState.stop(); } diff --git a/common/src/main/java/draylar/identity/impl/variant/CatTypeProvider.java b/common/src/main/java/draylar/identity/impl/variant/CatTypeProvider.java index 0fc0ca5..e3fce50 100644 --- a/common/src/main/java/draylar/identity/impl/variant/CatTypeProvider.java +++ b/common/src/main/java/draylar/identity/impl/variant/CatTypeProvider.java @@ -6,7 +6,7 @@ import net.minecraft.entity.passive.CatEntity; import net.minecraft.text.MutableText; import net.minecraft.text.Text; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registries; import net.minecraft.world.World; import java.util.Map; @@ -30,13 +30,13 @@ public class CatTypeProvider extends TypeProvider { @Override public int getVariantData(CatEntity entity) { - return Registry.CAT_VARIANT.getRawId(entity.getVariant()); + return Registries.CAT_VARIANT.getRawId(entity.getVariant()); } @Override public CatEntity create(EntityType type, World world, int data) { CatEntity cat = new CatEntity(type, world); - cat.setVariant(Registry.CAT_VARIANT.get(data)); + cat.setVariant(Registries.CAT_VARIANT.get(data)); return cat; } diff --git a/common/src/main/java/draylar/identity/impl/variant/FoxTypeProvider.java b/common/src/main/java/draylar/identity/impl/variant/FoxTypeProvider.java index 1898e88..bf3a0ef 100644 --- a/common/src/main/java/draylar/identity/impl/variant/FoxTypeProvider.java +++ b/common/src/main/java/draylar/identity/impl/variant/FoxTypeProvider.java @@ -12,13 +12,13 @@ public class FoxTypeProvider extends TypeProvider { @Override public int getVariantData(FoxEntity entity) { - return entity.getFoxType().getId(); + return entity.getVariant().getId(); } @Override public FoxEntity create(EntityType type, World world, int data) { FoxEntity fox = new FoxEntity(type, world); - ((FoxEntityAccessor) fox).callSetType(FoxEntity.Type.fromId(data)); + ((FoxEntityAccessor) fox).callSetVariant(FoxEntity.Type.fromId(data)); return fox; } @@ -34,6 +34,6 @@ public int getRange() { @Override public Text modifyText(FoxEntity entity, MutableText text) { - return Text.literal(formatTypePrefix(FoxEntity.Type.fromId(getVariantData(entity)).getKey()) + " ").append(text); + return Text.literal(formatTypePrefix(FoxEntity.Type.fromId(getVariantData(entity)).name()) + " ").append(text); } } diff --git a/common/src/main/java/draylar/identity/impl/variant/FrogTypeProvider.java b/common/src/main/java/draylar/identity/impl/variant/FrogTypeProvider.java index e2c332e..9e65fe7 100644 --- a/common/src/main/java/draylar/identity/impl/variant/FrogTypeProvider.java +++ b/common/src/main/java/draylar/identity/impl/variant/FrogTypeProvider.java @@ -3,11 +3,10 @@ import com.google.common.collect.ImmutableMap; import draylar.identity.api.variant.TypeProvider; import net.minecraft.entity.EntityType; -import net.minecraft.entity.passive.CatEntity; import net.minecraft.entity.passive.FrogEntity; import net.minecraft.text.MutableText; import net.minecraft.text.Text; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registries; import net.minecraft.world.World; import java.util.Map; @@ -23,13 +22,13 @@ public class FrogTypeProvider extends TypeProvider { @Override public int getVariantData(FrogEntity entity) { - return Registry.FROG_VARIANT.getRawId(entity.getVariant()); + return Registries.FROG_VARIANT.getRawId(entity.getVariant()); } @Override public FrogEntity create(EntityType type, World world, int data) { FrogEntity frog = new FrogEntity(type, world); - frog.setVariant(Registry.FROG_VARIANT.get(data)); + frog.setVariant(Registries.FROG_VARIANT.get(data)); return frog; } diff --git a/common/src/main/java/draylar/identity/impl/variant/ParrotTypeProvider.java b/common/src/main/java/draylar/identity/impl/variant/ParrotTypeProvider.java index b8c1dd9..f292d4b 100644 --- a/common/src/main/java/draylar/identity/impl/variant/ParrotTypeProvider.java +++ b/common/src/main/java/draylar/identity/impl/variant/ParrotTypeProvider.java @@ -21,13 +21,13 @@ public class ParrotTypeProvider extends TypeProvider { @Override public int getVariantData(ParrotEntity entity) { - return entity.getVariant(); + return entity.getVariant().getId(); } @Override public ParrotEntity create(EntityType type, World world, int data) { ParrotEntity parrot = new ParrotEntity(type, world); - parrot.setVariant(data); + parrot.setVariant(ParrotEntity.Variant.byIndex(data)); return parrot; } diff --git a/common/src/main/java/draylar/identity/impl/variant/TropicalFishTypeProvider.java b/common/src/main/java/draylar/identity/impl/variant/TropicalFishTypeProvider.java index fdf8aa5..2b360dc 100644 --- a/common/src/main/java/draylar/identity/impl/variant/TropicalFishTypeProvider.java +++ b/common/src/main/java/draylar/identity/impl/variant/TropicalFishTypeProvider.java @@ -3,6 +3,7 @@ import draylar.identity.api.variant.TypeProvider; import net.minecraft.entity.EntityType; import net.minecraft.entity.passive.TropicalFishEntity; +import net.minecraft.entity.passive.TropicalFishEntity.Variety; import net.minecraft.text.MutableText; import net.minecraft.text.Text; import net.minecraft.world.World; @@ -12,13 +13,13 @@ public class TropicalFishTypeProvider extends TypeProvider { @Override public int getVariantData(TropicalFishEntity entity) { - return entity.getVariant(); + return entity.getVariant().getId(); } @Override public TropicalFishEntity create(EntityType type, World world, int data) { TropicalFishEntity fish = new TropicalFishEntity(type, world); - fish.setVariant(data); + fish.setVariant(TropicalFishEntity.getVariety(data)); return fish; } diff --git a/common/src/main/java/draylar/identity/math/math.java b/common/src/main/java/draylar/identity/math/math.java new file mode 100644 index 0000000..d2f97ea --- /dev/null +++ b/common/src/main/java/draylar/identity/math/math.java @@ -0,0 +1,20 @@ +package draylar.identity.math; + +import org.joml.Quaternionf; +import org.joml.Vector3f; + +public class math { + final public static Vector3f POSITIVE_X() { + return new Vector3f(1, 0, 0); + } + final public static Vector3f POSITIVE_Y() { + return new Vector3f(0, 1, 0); + } + final public static Vector3f POSITIVE_Z() { + return new Vector3f(0, 0, 1); + } + + public static Quaternionf getDegreesQuaternion(Vector3f axis, float angle) { + return new Quaternionf().fromAxisAngleDeg(axis, angle); + } +} diff --git a/common/src/main/java/draylar/identity/mixin/DrownedOverlayMixin.java b/common/src/main/java/draylar/identity/mixin/DrownedOverlayMixin.java index e4a6741..ca4a478 100644 --- a/common/src/main/java/draylar/identity/mixin/DrownedOverlayMixin.java +++ b/common/src/main/java/draylar/identity/mixin/DrownedOverlayMixin.java @@ -30,7 +30,7 @@ private void onRender(MatrixStack matrixStack, VertexConsumerProvider vertexCons DrownedEntityModel model = getContextModel(); if (model != null) { - model.setAttributes(this.model); + this.model.copyBipedStateTo(model); model.sneaking = drownedEntity.isSneaking(); } } diff --git a/common/src/main/java/draylar/identity/mixin/InGameHudMixin.java b/common/src/main/java/draylar/identity/mixin/InGameHudMixin.java index 07a9995..14cdbb7 100644 --- a/common/src/main/java/draylar/identity/mixin/InGameHudMixin.java +++ b/common/src/main/java/draylar/identity/mixin/InGameHudMixin.java @@ -7,8 +7,8 @@ import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.fluid.Fluid; -import net.minecraft.tag.FluidTags; -import net.minecraft.tag.TagKey; +import net.minecraft.registry.tag.FluidTags; +import net.minecraft.registry.tag.TagKey; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -21,7 +21,7 @@ public abstract class InGameHudMixin { @ModifyArg( method = "renderStatusBars", - at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;isSubmergedIn(Lnet/minecraft/tag/TagKey;)Z") + at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;isSubmergedIn(Lnet/minecraft/registry/tag/TagKey;)Z") ) private TagKey shouldRenderBreath(TagKey tag) { PlayerEntity player = this.getCameraPlayer(); diff --git a/common/src/main/java/draylar/identity/mixin/LivingEntityMixin.java b/common/src/main/java/draylar/identity/mixin/LivingEntityMixin.java index 6a86075..9748c4a 100644 --- a/common/src/main/java/draylar/identity/mixin/LivingEntityMixin.java +++ b/common/src/main/java/draylar/identity/mixin/LivingEntityMixin.java @@ -20,7 +20,7 @@ import net.minecraft.entity.passive.DolphinEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.fluid.FluidState; -import net.minecraft.tag.FluidTags; +import net.minecraft.registry.tag.FluidTags; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; @@ -129,7 +129,7 @@ private void handleFallDamage(float fallDistance, float damageMultiplier, Damage LivingEntity.FallSounds fallSounds = identity.getFallSounds(); this.playSound(damageAmount > 4 ? fallSounds.big() : fallSounds.small(), 1.0F, 1.0F); ((LivingEntityAccessor) identity).callPlayBlockFallSound(); - this.damage(DamageSource.FALL, (float) damageAmount); + this.damage(world.getDamageSources().fall(), (float) damageAmount); cir.setReturnValue(true); } else { cir.setReturnValue(false); diff --git a/common/src/main/java/draylar/identity/mixin/PiglinBruteBrainMixin.java b/common/src/main/java/draylar/identity/mixin/PiglinBruteBrainMixin.java index 4ca672b..6502899 100644 --- a/common/src/main/java/draylar/identity/mixin/PiglinBruteBrainMixin.java +++ b/common/src/main/java/draylar/identity/mixin/PiglinBruteBrainMixin.java @@ -21,9 +21,7 @@ public class PiglinBruteBrainMixin { * * @reason method_30255 is the desugared lambda used by method_30249 that searches for a nearby player to aggro on. * This mixin modifies the search logic to exclude players disguised as anything besides a Wither Skeleton or Wither. - * We target fabric and forge separately due to arch not being able to find the backed methods of the targeted lambdas */ - @Group(name = "method_30249FilterLambda", min = 1, max = 1) @Inject( method = "method_30255", at = @At("HEAD"), expect = 0, cancellable = true) private static void identity$method_30249FilterLambdaIntermediary(AbstractPiglinEntity abstractPiglinEntity, LivingEntity livingEntity, CallbackInfoReturnable cir) { if(livingEntity instanceof PlayerEntity player) { @@ -34,16 +32,4 @@ public class PiglinBruteBrainMixin { } } } - - @Group(name = "method_30249FilterLambda", min = 1, max = 1) - @Inject(method = "m_35106_", at = @At("HEAD"), remap = false, expect = 0, cancellable = true) - private static void identity$method_30249FilterLambdaSRG(AbstractPiglinEntity abstractPiglinEntity, LivingEntity livingEntity, CallbackInfoReturnable cir) { - if(livingEntity instanceof PlayerEntity player) { - LivingEntity identity = PlayerIdentity.getIdentity(player); - - if(identity != null && !(identity instanceof WitherSkeletonEntity) && !(identity instanceof WitherEntity)) { - cir.setReturnValue(false); - } - } - } } diff --git a/common/src/main/java/draylar/identity/mixin/PlayerEntityMixin.java b/common/src/main/java/draylar/identity/mixin/PlayerEntityMixin.java index baff03d..691356b 100644 --- a/common/src/main/java/draylar/identity/mixin/PlayerEntityMixin.java +++ b/common/src/main/java/draylar/identity/mixin/PlayerEntityMixin.java @@ -10,6 +10,7 @@ import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.*; import net.minecraft.entity.damage.DamageSource; +import net.minecraft.entity.damage.DamageSources; import net.minecraft.entity.mob.MobEntity; import net.minecraft.entity.mob.RavagerEntity; import net.minecraft.entity.mob.WardenEntity; @@ -18,10 +19,10 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.vehicle.BoatEntity; import net.minecraft.item.ItemStack; +import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.sound.SoundEvent; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.registry.RegistryEntry; import net.minecraft.world.World; import net.minecraft.world.biome.Biome; import org.spongepowered.asm.mixin.Mixin; @@ -96,7 +97,7 @@ private void tickAquaticBreathingOutsideWater(CallbackInfo ci) { // Air has ran out, start drowning if(this.getAir() == -20) { this.setAir(0); - this.damage(DamageSource.DROWN, 2.0F); + this.damage(world.getDamageSources().drown(), 2.0F); } } else { this.setAir(300); @@ -315,7 +316,7 @@ private void tickFire(CallbackInfo ci) { private boolean isInDaylight() { if(world.isDay() && !world.isClient) { float brightnessAtEyes = getBrightnessAtEyes(); - BlockPos daylightTestPosition = new BlockPos(getX(), (double) Math.round(getY()), getZ()); + BlockPos daylightTestPosition = BlockPos.ofFloored(getX(), (double) Math.round(getY()), getZ()); // move test position up one block for boats if(getVehicle() instanceof BoatEntity) { @@ -341,8 +342,8 @@ private void tickTemperature(CallbackInfo ci) { // damage player if they are an identity that gets hurt by high temps (eg. snow golem in nether) if(type.isIn(IdentityEntityTags.HURT_BY_HIGH_TEMPERATURE)) { Biome biome = world.getBiome(getBlockPos()).value(); - if (biome.isHot(getBlockPos())) { - player.damage(DamageSource.ON_FIRE, 1.0f); + if (!biome.isCold(getBlockPos())) { + player.damage(world.getDamageSources().onFire(), 1.0f); } } } diff --git a/common/src/main/java/draylar/identity/mixin/PlayerEntityRendererMixin.java b/common/src/main/java/draylar/identity/mixin/PlayerEntityRendererMixin.java index 5447ab7..f2bdfda 100644 --- a/common/src/main/java/draylar/identity/mixin/PlayerEntityRendererMixin.java +++ b/common/src/main/java/draylar/identity/mixin/PlayerEntityRendererMixin.java @@ -9,6 +9,7 @@ import draylar.identity.mixin.accessor.EntityAccessor; import draylar.identity.mixin.accessor.LivingEntityAccessor; import draylar.identity.mixin.accessor.LivingEntityRendererAccessor; +import draylar.identity.mixin.accessor.LimbAnimatorAccessor; import net.minecraft.client.MinecraftClient; import net.minecraft.client.model.ModelPart; import net.minecraft.client.network.AbstractClientPlayerEntity; @@ -22,6 +23,8 @@ import net.minecraft.entity.EntityType; import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.attribute.EntityAttribute; +import net.minecraft.entity.attribute.EntityAttributes; import net.minecraft.entity.mob.MobEntity; import net.minecraft.entity.mob.PhantomEntity; import net.minecraft.entity.passive.TameableEntity; @@ -59,9 +62,9 @@ private void redirectRender(LivingEntityRenderer renderer, LivingEntity player, // sync player data to identity identity if(identity != null) { - identity.lastLimbDistance = player.lastLimbDistance; - identity.limbDistance = player.limbDistance; - identity.limbAngle = player.limbAngle; + ((LimbAnimatorAccessor)identity.limbAnimator).setPrevSpeed(((LimbAnimatorAccessor)player.limbAnimator).getPrevSpeed()); + identity.limbAnimator.setSpeed(player.limbAnimator.getSpeed()); + ((LimbAnimatorAccessor)identity.limbAnimator).setPos(player.limbAnimator.getPos()); identity.handSwinging = player.handSwinging; identity.handSwingTicks = player.handSwingTicks; identity.lastHandSwingProgress = player.lastHandSwingProgress; @@ -113,6 +116,7 @@ private void redirectRender(LivingEntityRenderer renderer, LivingEntity player, ((LivingEntityAccessor) identity).callSetLivingFlag(1, player.isUsingItem()); identity.getItemUseTime(); ((LivingEntityAccessor) identity).callTickActiveItemStack(); + identity.hurtTime = player.hurtTime; // update identity specific properties EntityUpdater entityUpdater = EntityUpdaters.getUpdater((EntityType) identity.getType()); diff --git a/common/src/main/java/draylar/identity/mixin/PlayerManagerMixin.java b/common/src/main/java/draylar/identity/mixin/PlayerManagerMixin.java index bc02858..e2c343a 100644 --- a/common/src/main/java/draylar/identity/mixin/PlayerManagerMixin.java +++ b/common/src/main/java/draylar/identity/mixin/PlayerManagerMixin.java @@ -15,15 +15,12 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import org.spongepowered.asm.mixin.injection.callback.LocalCapture; @Mixin(PlayerManager.class) public class PlayerManagerMixin { - @Inject(at = @At( - value = "INVOKE", - target = "Lnet/minecraft/server/network/ServerPlayNetworkHandler;sendPacket(Lnet/minecraft/network/Packet;)V", - ordinal = 0 - ), method = "onPlayerConnect") + @Inject(method = "onPlayerConnect", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/world/ServerWorld;onPlayerConnected(Lnet/minecraft/server/network/ServerPlayerEntity;)V"), locals = LocalCapture.CAPTURE_FAILSOFT) private void connect(ClientConnection connection, ServerPlayerEntity player, CallbackInfo ci) { PlayerJoinCallback.EVENT.invoker().onPlayerJoin(player); } diff --git a/common/src/main/java/draylar/identity/mixin/PlayerSonicBoomMixin.java b/common/src/main/java/draylar/identity/mixin/PlayerSonicBoomMixin.java index 5905465..6a2f501 100644 --- a/common/src/main/java/draylar/identity/mixin/PlayerSonicBoomMixin.java +++ b/common/src/main/java/draylar/identity/mixin/PlayerSonicBoomMixin.java @@ -77,7 +77,7 @@ private void tickSonicBoom(CallbackInfo ci) { ((ServerWorld) world).spawnParticles(ParticleTypes.SONIC_BOOM, particlePos.x, particlePos.y, particlePos.z, 1, 0.0, 0.0, 0.0, 0.0); // Locate entities around the particle location for damage - hit.addAll(world.getEntitiesByClass(LivingEntity.class, new Box(new BlockPos(particlePos.getX(), particlePos.getY(), particlePos.getZ())).expand(2), it -> !(it instanceof WolfEntity))); + hit.addAll(world.getEntitiesByClass(LivingEntity.class, new Box(BlockPos.ofFloored(particlePos.getX(), particlePos.getY(), particlePos.getZ())).expand(2), it -> !(it instanceof WolfEntity))); } // Don't hit ourselves @@ -86,7 +86,7 @@ private void tickSonicBoom(CallbackInfo ci) { // Find for (Entity hitTarget : hit) { if(hitTarget instanceof LivingEntity living) { - living.damage(DamageSource.sonicBoom((PlayerEntity) (Object) this), 10.0f); + living.damage(world.getDamageSources().sonicBoom((PlayerEntity) (Object) this), 10.0f); double vertical = 0.5 * (1.0 - living.getAttributeValue(EntityAttributes.GENERIC_KNOCKBACK_RESISTANCE)); double horizontal = 2.5 * (1.0 - living.getAttributeValue(EntityAttributes.GENERIC_KNOCKBACK_RESISTANCE)); living.addVelocity(normalized.getX() * horizontal, normalized.getY() * vertical, normalized.getZ() * horizontal); diff --git a/common/src/main/java/draylar/identity/mixin/PlayerSwimmingMixin.java b/common/src/main/java/draylar/identity/mixin/PlayerSwimmingMixin.java index 4048cec..2bd9be6 100644 --- a/common/src/main/java/draylar/identity/mixin/PlayerSwimmingMixin.java +++ b/common/src/main/java/draylar/identity/mixin/PlayerSwimmingMixin.java @@ -5,7 +5,7 @@ import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.fluid.Fluid; -import net.minecraft.tag.TagKey; +import net.minecraft.registry.tag.TagKey; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; diff --git a/common/src/main/java/draylar/identity/mixin/RavagerEntityMixin.java b/common/src/main/java/draylar/identity/mixin/RavagerEntityMixin.java index 534ac3a..80cbd61 100644 --- a/common/src/main/java/draylar/identity/mixin/RavagerEntityMixin.java +++ b/common/src/main/java/draylar/identity/mixin/RavagerEntityMixin.java @@ -24,7 +24,7 @@ public void travel(Vec3d movementInput) { // Ensure Ravager has a passenger if (hasPassengers()) { - LivingEntity rider = (LivingEntity) getPrimaryPassenger(); + LivingEntity rider = (LivingEntity) getFirstPassenger(); // Only players should be able to control Ravager if (rider instanceof PlayerEntity) { @@ -44,7 +44,7 @@ public void travel(Vec3d movementInput) { } // Update movement/velocity - this.airStrafingSpeed = this.getMovementSpeed() * 0.1F; + //this.airStrafingSpeed = this.getMovementSpeed() * 0.1F; if (this.isLogicalSideForUpdatingMovement()) { this.setMovementSpeed((float) this.getAttributeValue(EntityAttributes.GENERIC_MOVEMENT_SPEED)); super.travel(new Vec3d(sidewaysSpeed, movementInput.y, forwardSpeed)); @@ -53,7 +53,7 @@ public void travel(Vec3d movementInput) { } // Limb updates for movement - this.updateLimbs(this, false); + this.updateLimbs(false); return; } } diff --git a/common/src/main/java/draylar/identity/mixin/ServerPlayerEntityMixin.java b/common/src/main/java/draylar/identity/mixin/ServerPlayerEntityMixin.java index 0c7e761..d8eacd0 100644 --- a/common/src/main/java/draylar/identity/mixin/ServerPlayerEntityMixin.java +++ b/common/src/main/java/draylar/identity/mixin/ServerPlayerEntityMixin.java @@ -10,12 +10,10 @@ import net.minecraft.entity.LivingEntity; import net.minecraft.entity.damage.DamageSource; import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.network.encryption.PlayerPublicKey; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.text.Text; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -29,8 +27,8 @@ public abstract class ServerPlayerEntityMixin extends PlayerEntity { @Shadow public abstract boolean isSpectator(); @Shadow public abstract void sendMessage(Text message, boolean actionBar); - public ServerPlayerEntityMixin(World world, BlockPos pos, float yaw, GameProfile gameProfile, @Nullable PlayerPublicKey publicKey) { - super(world, pos, yaw, gameProfile, publicKey); + public ServerPlayerEntityMixin(World world, BlockPos pos, float yaw, GameProfile gameProfile) { + super(world, pos, yaw, gameProfile); } @Inject( diff --git a/common/src/main/java/draylar/identity/mixin/StrayOverlayMixin.java b/common/src/main/java/draylar/identity/mixin/StrayOverlayMixin.java index 53775e3..8fa0ce7 100644 --- a/common/src/main/java/draylar/identity/mixin/StrayOverlayMixin.java +++ b/common/src/main/java/draylar/identity/mixin/StrayOverlayMixin.java @@ -34,7 +34,7 @@ private void onRender(MatrixStack matrixStack, VertexConsumerProvider vertexCons M model = getContextModel(); if (model instanceof BipedEntityModel) { - ((BipedEntityModel) model).setAttributes(this.model); + this.model.copyBipedStateTo((BipedEntityModel) model); ((BipedEntityModel) model).sneaking = mobEntity.isInSneakingPose(); } } diff --git a/common/src/main/java/draylar/identity/mixin/accessor/FoxEntityAccessor.java b/common/src/main/java/draylar/identity/mixin/accessor/FoxEntityAccessor.java index dd9ac54..172e96f 100644 --- a/common/src/main/java/draylar/identity/mixin/accessor/FoxEntityAccessor.java +++ b/common/src/main/java/draylar/identity/mixin/accessor/FoxEntityAccessor.java @@ -8,5 +8,5 @@ public interface FoxEntityAccessor { @Invoker - void callSetType(FoxEntity.Type type); + void callSetVariant(FoxEntity.Type type); } diff --git a/common/src/main/java/draylar/identity/mixin/accessor/LimbAnimatorAccessor.java b/common/src/main/java/draylar/identity/mixin/accessor/LimbAnimatorAccessor.java new file mode 100644 index 0000000..cd0d715 --- /dev/null +++ b/common/src/main/java/draylar/identity/mixin/accessor/LimbAnimatorAccessor.java @@ -0,0 +1,18 @@ +package draylar.identity.mixin.accessor; + +import net.minecraft.entity.LimbAnimator; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +@Mixin(LimbAnimator.class) +public interface LimbAnimatorAccessor +{ + @Accessor("prevSpeed") + float getPrevSpeed(); + + @Accessor("pos") + void setPos(float pos); + + @Accessor("prevSpeed") + void setPrevSpeed(float prevSpeed); +} diff --git a/common/src/main/java/draylar/identity/mixin/player/ClientPlayerDataCacheMixin.java b/common/src/main/java/draylar/identity/mixin/player/ClientPlayerDataCacheMixin.java index 53e2694..03c8308 100644 --- a/common/src/main/java/draylar/identity/mixin/player/ClientPlayerDataCacheMixin.java +++ b/common/src/main/java/draylar/identity/mixin/player/ClientPlayerDataCacheMixin.java @@ -14,9 +14,6 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import java.util.HashMap; -import java.util.Map; - @Environment(EnvType.CLIENT) @Mixin(ClientPlayNetworkHandler.class) public class ClientPlayerDataCacheMixin { @@ -33,7 +30,7 @@ private void beforePlayerReset(PlayerRespawnS2CPacket packet, CallbackInfo ci) { // This inject applies data cached from the previous inject. // Re-applying on the client will help to prevent sync blips which occur when wiping data and waiting for the server to send a sync packet. - @Inject(method = "onPlayerRespawn", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;getRegistryKey()Lnet/minecraft/util/registry/RegistryKey;", ordinal = 1)) + @Inject(method = "onPlayerRespawn", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;getRegistryKey()Lnet/minecraft/registry/RegistryKey;", ordinal = 1)) private void afterPlayerReset(PlayerRespawnS2CPacket packet, CallbackInfo ci) { if(dataCache != null && client.player != null) { ((PlayerDataProvider) client.player).setIdentity(dataCache.getIdentity()); diff --git a/common/src/main/java/draylar/identity/mixin/player/PlayerEntityDataMixin.java b/common/src/main/java/draylar/identity/mixin/player/PlayerEntityDataMixin.java index 8377207..829f73e 100644 --- a/common/src/main/java/draylar/identity/mixin/player/PlayerEntityDataMixin.java +++ b/common/src/main/java/draylar/identity/mixin/player/PlayerEntityDataMixin.java @@ -25,7 +25,7 @@ import net.minecraft.server.world.ServerWorld; import net.minecraft.sound.SoundEvent; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registries; import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Mixin; @@ -62,8 +62,8 @@ private void readNbt(NbtCompound tag, CallbackInfo info) { NbtList unlockedIdList = tag.getList("UnlockedMorphs", NbtElement.STRING_TYPE); unlockedIdList.forEach(entityRegistryID -> { Identifier id = new Identifier(entityRegistryID.asString()); - if(Registry.ENTITY_TYPE.containsId(id)) { - EntityType type = Registry.ENTITY_TYPE.get(id); + if(Registries.ENTITY_TYPE.containsId(id)) { + EntityType type = Registries.ENTITY_TYPE.get(id); // The variant added from the UnlockedMorphs list will default to the fallback value if needed (eg. Sheep => White) // This value will be re-serialize in UnlockedIdentities list, so this is 100% for old save conversions @@ -90,8 +90,8 @@ private void readNbt(NbtCompound tag, CallbackInfo info) { NbtList favoriteIdList = tag.getList("FavoriteIdentities", NbtElement.STRING_TYPE); favoriteIdList.forEach(registryID -> { Identifier id = new Identifier(registryID.asString()); - if(Registry.ENTITY_TYPE.containsId(id)) { - EntityType type = Registry.ENTITY_TYPE.get(id); + if(Registries.ENTITY_TYPE.containsId(id)) { + EntityType type = Registries.ENTITY_TYPE.get(id); favorites.add(new IdentityType(type)); } }); @@ -156,7 +156,7 @@ private NbtCompound writeCurrentIdentity(NbtCompound tag) { } // put entity type ID under the key "id", or "minecraft:empty" if no identity is equipped (or the identity entity type is invalid) - tag.putString("id", identity == null ? "minecraft:empty" : Registry.ENTITY_TYPE.getId(identity.getType()).toString()); + tag.putString("id", identity == null ? "minecraft:empty" : Registries.ENTITY_TYPE.getId(identity.getType()).toString()); tag.put("EntityData", entityTag); return tag; } diff --git a/common/src/main/java/draylar/identity/network/ServerNetworking.java b/common/src/main/java/draylar/identity/network/ServerNetworking.java index 4b177fc..73c3815 100644 --- a/common/src/main/java/draylar/identity/network/ServerNetworking.java +++ b/common/src/main/java/draylar/identity/network/ServerNetworking.java @@ -3,7 +3,6 @@ import dev.architectury.networking.NetworkManager; import draylar.identity.ability.AbilityRegistry; import draylar.identity.api.PlayerIdentity; -import draylar.identity.api.platform.IdentityConfig; import draylar.identity.api.PlayerAbilities; import draylar.identity.network.impl.FavoritePackets; import draylar.identity.network.impl.SwapPackets; @@ -11,7 +10,6 @@ import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.util.registry.Registry; public class ServerNetworking implements NetworkHandler { diff --git a/common/src/main/java/draylar/identity/network/impl/FavoritePackets.java b/common/src/main/java/draylar/identity/network/impl/FavoritePackets.java index 51e76ed..d6479dd 100644 --- a/common/src/main/java/draylar/identity/network/impl/FavoritePackets.java +++ b/common/src/main/java/draylar/identity/network/impl/FavoritePackets.java @@ -13,7 +13,7 @@ import net.minecraft.nbt.NbtList; import net.minecraft.network.PacketByteBuf; import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registries; import org.jetbrains.annotations.Nullable; import java.util.Set; @@ -22,7 +22,7 @@ public class FavoritePackets { public static void sendFavoriteRequest(IdentityType type, boolean favorite) { PacketByteBuf packet = new PacketByteBuf(Unpooled.buffer()); - packet.writeIdentifier(Registry.ENTITY_TYPE.getId(type.getEntityType())); + packet.writeIdentifier(Registries.ENTITY_TYPE.getId(type.getEntityType())); packet.writeInt(type.getVariantData()); packet.writeBoolean(favorite); NetworkManager.sendToServer(ClientNetworking.FAVORITE_UPDATE, packet); @@ -30,7 +30,7 @@ public static void sendFavoriteRequest(IdentityType type, boolean favorite) { public static void registerFavoriteRequestHandler() { NetworkManager.registerReceiver(NetworkManager.Side.C2S, NetworkHandler.FAVORITE_UPDATE, (buf, context) -> { - EntityType entityType = Registry.ENTITY_TYPE.get(buf.readIdentifier()); + EntityType entityType = Registries.ENTITY_TYPE.get(buf.readIdentifier()); int variant = buf.readInt(); boolean favorite = buf.readBoolean(); ServerPlayerEntity player = (ServerPlayerEntity) context.getPlayer(); diff --git a/common/src/main/java/draylar/identity/network/impl/SwapPackets.java b/common/src/main/java/draylar/identity/network/impl/SwapPackets.java index 80ac7f1..6088d12 100644 --- a/common/src/main/java/draylar/identity/network/impl/SwapPackets.java +++ b/common/src/main/java/draylar/identity/network/impl/SwapPackets.java @@ -12,7 +12,7 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.network.PacketByteBuf; import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registries; import org.jetbrains.annotations.Nullable; public class SwapPackets { @@ -21,7 +21,7 @@ public static void registerIdentityRequestPacketHandler() { NetworkManager.registerReceiver(NetworkManager.Side.C2S, NetworkHandler.IDENTITY_REQUEST, (buf, context) -> { boolean validType = buf.readBoolean(); if(validType) { - EntityType entityType = Registry.ENTITY_TYPE.get(buf.readIdentifier()); + EntityType entityType = Registries.ENTITY_TYPE.get(buf.readIdentifier()); int variant = buf.readInt(); context.getPlayer().getServer().execute(() -> { @@ -59,7 +59,7 @@ public static void sendSwapRequest(@Nullable IdentityType type) { packet.writeBoolean(type != null); if(type != null) { - packet.writeIdentifier(Registry.ENTITY_TYPE.getId(type.getEntityType())); + packet.writeIdentifier(Registries.ENTITY_TYPE.getId(type.getEntityType())); packet.writeInt(type.getVariantData()); } diff --git a/common/src/main/java/draylar/identity/registry/IdentityEntityTags.java b/common/src/main/java/draylar/identity/registry/IdentityEntityTags.java index e1deda1..cc0a912 100644 --- a/common/src/main/java/draylar/identity/registry/IdentityEntityTags.java +++ b/common/src/main/java/draylar/identity/registry/IdentityEntityTags.java @@ -2,8 +2,8 @@ import draylar.identity.Identity; import net.minecraft.entity.EntityType; -import net.minecraft.tag.TagKey; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.tag.TagKey; +import net.minecraft.registry.RegistryKeys; public class IdentityEntityTags { @@ -26,6 +26,6 @@ public static void init() { } private static TagKey> register(String id) { - return TagKey.of(Registry.ENTITY_TYPE_KEY, Identity.id(id)); + return TagKey.of(RegistryKeys.ENTITY_TYPE, Identity.id(id)); } } diff --git a/common/src/main/java/draylar/identity/screen/IdentityScreen.java b/common/src/main/java/draylar/identity/screen/IdentityScreen.java index a6e9e20..0551317 100644 --- a/common/src/main/java/draylar/identity/screen/IdentityScreen.java +++ b/common/src/main/java/draylar/identity/screen/IdentityScreen.java @@ -14,6 +14,7 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.Selectable; import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.gui.tooltip.Tooltip; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.PressableWidget; import net.minecraft.client.network.ClientPlayerEntity; @@ -25,6 +26,7 @@ import net.minecraft.text.Text; import java.util.ArrayList; +import java.util.Collections; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -115,6 +117,7 @@ public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) { MinecraftClient.getInstance().textRenderer.draw(matrices, message, xPosition, yPosition, 0xFFFFFF); } + /* // tooltips for (Selectable selectable : ((ScreenAccessor) this).getSelectables()) { if(selectable instanceof PressableWidget button) { @@ -123,7 +126,7 @@ public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) { break; } } - } + }*/ searchBar.render(matrices, mouseX, mouseY, delta); playerButton.render(matrices, mouseX, mouseY, delta); @@ -154,7 +157,7 @@ public void renderEntityWidgets(MatrixStack matrices, int mouseX, int mouseY, fl @Override public boolean mouseScrolled(double mouseX, double mouseY, double amount) { if(entityWidgets.size() > 0) { - float firstPos = entityWidgets.get(0).y; + float firstPos = entityWidgets.get(0).getY(); // Top section should always have mobs, prevent scrolling the entire list down the screen if(amount == 1 && firstPos >= 35) { @@ -163,7 +166,7 @@ public boolean mouseScrolled(double mouseX, double mouseY, double amount) { ((ScreenAccessor) this).getSelectables().forEach(button -> { if(button instanceof EntityWidget widget) { - widget.y = (int) (widget.y + amount * 10); + widget.setPosition(widget.getX(), (int) (widget.getY() + amount * 10)); } }); } @@ -204,6 +207,7 @@ private void populateEntityWidgets(ClientPlayerEntity player, List @Override public boolean mouseClicked(double mouseX, double mouseY, int button) { - boolean bl = mouseX >= (double) this.x && mouseX < (double) (this.x + this.width) && mouseY >= (double) this.y && mouseY < (double) (this.y + this.height); + boolean bl = mouseX >= (double) this.getX() && mouseX < (double) (this.getX() + this.width) && mouseY >= (double) this.getY() && mouseY < (double) (this.getY() + this.height); if(bl) { // Update current Identity @@ -78,7 +79,7 @@ public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) { // Some entities (namely Aether mobs) crash when rendered in a GUI. // Unsure as to the cause, but this try/catch should prevent the game from entirely dipping out. try { - InventoryScreen.drawEntity(x + this.getWidth() / 2, (int) (y + this.getHeight() * .75f), size, -10, -10, entity); + InventoryScreen.drawEntity(matrices, this.getX() + this.getWidth() / 2, (int) (this.getY() + this.getHeight() * .75f), size, -10, -10, entity); } catch (Exception ignored) { } @@ -86,13 +87,13 @@ public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) { // Render selected outline if(active) { RenderSystem.setShaderTexture(0, Identity.id("textures/gui/selected.png")); - DrawableHelper.drawTexture(matrices, x, y, getWidth(), getHeight(), 0, 0, 48, 32, 48, 32); + DrawableHelper.drawTexture(matrices, this.getX(), this.getY(), getWidth(), getHeight(), 0, 0, 48, 32, 48, 32); } // Render favorite star if(starred) { RenderSystem.setShaderTexture(0, Identity.id("textures/gui/star.png")); - DrawableHelper.drawTexture(matrices, x, y, 0, 0, 15, 15, 15, 15); + DrawableHelper.drawTexture(matrices, this.getX(), this.getY(), 0, 0, 15, 15, 15, 15); } // Draw tooltip @@ -122,16 +123,7 @@ public void onPress() { } @Override - public void renderTooltip(MatrixStack matrices, int mouseX, int mouseY) { - Screen currentScreen = MinecraftClient.getInstance().currentScreen; - - if(currentScreen != null) { - currentScreen.renderTooltip(matrices, Collections.singletonList(type.createTooltipText(entity)), mouseX, mouseY); - } - } - - @Override - public void appendNarrations(NarrationMessageBuilder builder) { + public void appendClickableNarrations(NarrationMessageBuilder builder) { } } diff --git a/common/src/main/java/draylar/identity/screen/widget/HelpWidget.java b/common/src/main/java/draylar/identity/screen/widget/HelpWidget.java index 25451ae..9980203 100644 --- a/common/src/main/java/draylar/identity/screen/widget/HelpWidget.java +++ b/common/src/main/java/draylar/identity/screen/widget/HelpWidget.java @@ -14,15 +14,6 @@ public class HelpWidget extends ButtonWidget { public HelpWidget(int x, int y, int width, int height) { super(x, y, width, height, Text.of("?"), (widget) -> { MinecraftClient.getInstance().setScreen(new IdentityHelpScreen()); - }); - } - - @Override - public void renderTooltip(MatrixStack matrices, int mouseX, int mouseY) { - Screen currentScreen = MinecraftClient.getInstance().currentScreen; - - if(currentScreen != null) { - currentScreen.renderTooltip(matrices, Collections.singletonList(Text.translatable("identity.help")), mouseX, mouseY + 15); - } + }, null); } } diff --git a/common/src/main/java/draylar/identity/screen/widget/PlayerWidget.java b/common/src/main/java/draylar/identity/screen/widget/PlayerWidget.java index 16464d2..b57c28f 100644 --- a/common/src/main/java/draylar/identity/screen/widget/PlayerWidget.java +++ b/common/src/main/java/draylar/identity/screen/widget/PlayerWidget.java @@ -32,7 +32,7 @@ public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) { // RenderSystem.setShaderTexture(0, Identity.id("textures/gui/player.png")); - DrawableHelper.drawTexture(matrices, x, y, 16, 16, 0, 0, 8, 8, 8, 8); + DrawableHelper.drawTexture(matrices, this.getX(), this.getY(), 16, 16, 0, 0, 8, 8, 8, 8); super.render(matrices, mouseX, mouseY, delta); } @@ -49,7 +49,7 @@ public void onPress() { } @Override - public void appendNarrations(NarrationMessageBuilder builder) { + public void appendClickableNarrations(NarrationMessageBuilder builder) { } } diff --git a/common/src/main/resources/identity.mixins.json b/common/src/main/resources/identity.mixins.json index 61e1b4f..3e85fec 100644 --- a/common/src/main/resources/identity.mixins.json +++ b/common/src/main/resources/identity.mixins.json @@ -2,7 +2,7 @@ "required": true, "minVersion": "0.8", "package": "draylar.identity.mixin", - "compatibilityLevel": "JAVA_16", + "compatibilityLevel": "JAVA_17", "mixins": [ "ActiveTargetGoalMixin", "CreeperEntityMixin", @@ -36,6 +36,7 @@ "accessor.FoxEntityAccessor", "accessor.IronGolemEntityAccessor", "accessor.LivingEntityAccessor", + "accessor.LimbAnimatorAccessor", "accessor.MobEntityAccessor", "accessor.ParrotEntityAccessor", "accessor.RavagerEntityAccessor", @@ -57,6 +58,7 @@ "accessor.BlazeEntityModelAccessor", "accessor.EntityShadowAccessor", "accessor.IllagerEntityModelAccessor", + "accessor.LimbAnimatorAccessor", "accessor.LivingEntityRendererAccessor", "accessor.LlamaEntityModelAccessor", "accessor.OcelotEntityModelAccessor", diff --git a/fabric/build.gradle b/fabric/build.gradle index 6c40b3e..9a4e1ae 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -1,5 +1,5 @@ plugins { - id "com.github.johnrengelman.shadow" version "7.1.0" + id "com.github.johnrengelman.shadow" version "8.1.1" } architectury { @@ -16,7 +16,7 @@ configurations { } repositories { - maven { url 'https://jitpack.io' } + maven { url 'https://maven.draylar.dev/releases' } } @@ -29,7 +29,7 @@ dependencies { shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive = false } // config - modImplementation include ("com.github.Draylar.omega-config:omega-config-base:1.2.3-1.18.1") { + modImplementation include ("dev.draylar.omega-config:omega-config-base:1.3.0+1.19.2") { exclude group: "net.fabricmc.fabric-api" } } @@ -46,17 +46,17 @@ processResources { shadowJar { configurations = [project.configurations.shadowCommon] - classifier "dev-shadow" + archiveClassifier.set("dev-shadow") } remapJar { input.set shadowJar.archiveFile dependsOn shadowJar - classifier "fabric" + archiveClassifier.set("fabric") } jar { - classifier "dev" + archiveClassifier.set("dev") } sourcesJar { diff --git a/fabric/gradle.properties b/fabric/gradle.properties index 6fc4a24..4fa6150 100644 --- a/fabric/gradle.properties +++ b/fabric/gradle.properties @@ -3,10 +3,10 @@ org.gradle.jvmargs=-Xmx4G # Fabric Properties # check these on https://fabricmc.net/use -minecraft_version=1.19 -yarn_mappings=1.19+build.4 -loader_version=0.14.8 +minecraft_version=1.19.4 +yarn_mappings=1.19.4+build.2 +loader_version=0.14.19 # Dependencies # currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api -fabric_version=0.57.0+1.19 \ No newline at end of file +fabric_version=0.81.1+1.19.4 \ No newline at end of file diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index 214bdfb..5fa91f6 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -29,7 +29,7 @@ ], "depends": { "fabricloader": ">=0.8.7+build.201", - "fabric": "*", + "fabric-api": "*", "architectury": "*" } } diff --git a/fabric/src/main/resources/identity-fabric.mixins.json b/fabric/src/main/resources/identity-fabric.mixins.json index f5c3129..8991085 100644 --- a/fabric/src/main/resources/identity-fabric.mixins.json +++ b/fabric/src/main/resources/identity-fabric.mixins.json @@ -2,7 +2,7 @@ "required": true, "minVersion": "0.8", "package": "draylar.identity.fabric.mixin", - "compatibilityLevel": "JAVA_16", + "compatibilityLevel": "JAVA_17", "mixins": [ "WitherEntityMixin" ], diff --git a/forge/build.gradle b/forge/build.gradle index 80260fb..a3a223b 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -1,5 +1,5 @@ plugins { - id "com.github.johnrengelman.shadow" version "7.1.0" + id "com.github.johnrengelman.shadow" version "8.1.1" } loom { @@ -40,17 +40,17 @@ processResources { shadowJar { exclude "fabric.mod.json" configurations = [project.configurations.shadowCommon] - classifier "dev-shadow" + archiveClassifier.set("dev-shadow") } remapJar { input.set shadowJar.archiveFile dependsOn shadowJar - classifier "forge" + archiveClassifier.set("forge") } jar { - classifier "dev" + archiveClassifier.set("dev") } sourcesJar { diff --git a/forge/src/main/resources/identity-forge.mixins.json b/forge/src/main/resources/identity-forge.mixins.json index 12f6d00..c5eeda9 100644 --- a/forge/src/main/resources/identity-forge.mixins.json +++ b/forge/src/main/resources/identity-forge.mixins.json @@ -2,7 +2,7 @@ "required": true, "minVersion": "0.8", "package": "draylar.identity.forge.mixin", - "compatibilityLevel": "JAVA_16", + "compatibilityLevel": "JAVA_17", "mixins": [ "WitherEntityMixin" ], diff --git a/gradle.properties b/gradle.properties index 044fe8f..485222e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,16 +1,16 @@ org.gradle.jvmargs=-Xmx4G # Base Versions -minecraft_version=1.19.1 +minecraft_version=1.19.4 archives_base_name=identity -mod_version=2.6.1 +mod_version=2.7.0 maven_group=dev.draylar # Loader Versions -fabric_loader_version=0.14.8 -fabric_api_version=0.58.5+1.19.1 -yarn_mappings=1.19.1+build.5 -forge_version=42.0.1 +fabric_loader_version=0.14.19 +fabric_api_version=0.81.1+1.19.4 +yarn_mappings=1.19.4+build.2 +forge_version=45.0.64 # Dependency Versions -architectury_version=6.0.34 \ No newline at end of file +architectury_version=8.1.80 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 5c2d1cf..c1962a7 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index fe753c9..37aef8d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists \ No newline at end of file +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 8e25e6c..aeb74cb 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,78 +17,110 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -97,7 +129,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -105,84 +137,109 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=$((i+1)) + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" fi +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index 9618d8d..6689b85 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,100 +1,92 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega