From ce4dbfaa07d4c980fc9bd0aea6c4435a154b4113 Mon Sep 17 00:00:00 2001 From: anhgelus Date: Sun, 27 Oct 2024 12:51:55 +0000 Subject: feat(minecraft): supports minecraft 1.21.2 and 1.21.3 #4 --- gradle.properties | 12 ++++++------ src/main/java/world/anhgelus/manhunt/Manhunt.java | 16 +++++++++------- src/main/resources/fabric.mod.json | 6 ++++-- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/gradle.properties b/gradle.properties index bfebea2..7efd6a2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,17 +4,17 @@ org.gradle.parallel=true # Fabric Properties # check these on https://fabricmc.net/develop -minecraft_version=1.21 -yarn_mappings=1.21+build.9 -loader_version=0.15.11 +minecraft_version=1.21.3 +yarn_mappings=1.21.3+build.2 +loader_version=0.16.7 # Fabric API -fabric_version=0.100.7+1.21 +fabric_version=0.107.0+1.21.3 # Libs -midnightlib_version=1.5.7-fabric +midnightlib_version=1.6.4-fabric # Mod Properties -mod_version=1.1.1 +mod_version=1.2.0 maven_group=world.anhgelus.manhunt archives_base_name=manhunt diff --git a/src/main/java/world/anhgelus/manhunt/Manhunt.java b/src/main/java/world/anhgelus/manhunt/Manhunt.java index cf09dc1..17aed6c 100644 --- a/src/main/java/world/anhgelus/manhunt/Manhunt.java +++ b/src/main/java/world/anhgelus/manhunt/Manhunt.java @@ -27,7 +27,9 @@ import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.text.Text; import net.minecraft.util.Identifier; import net.minecraft.util.math.GlobalPos; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.GameMode; +import net.minecraft.world.TeleportTarget; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -112,10 +114,10 @@ public class Manhunt implements ModInitializer { player.setExperienceLevel(0); player.getInventory().clear(); player.getHungerManager().eat( - new FoodComponent(20, 20.0f, true, 0f, Optional.empty(), new ArrayList<>()) + new FoodComponent(20, 20.0f, true) ); final var spawn = player.getServerWorld().getSpawnPos(); - player.teleport(player.getServerWorld(), spawn.getX(), spawn.getY(), spawn.getZ(), 0f, 0f); + player.teleport(spawn.getX(), spawn.getY(), spawn.getZ(), false); } state = State.ON; for (final UUID uuid : hunters) { @@ -124,7 +126,7 @@ public class Manhunt implements ModInitializer { final var isACompass = new ItemStack(Items.COMPASS); hunter.giveItemStack(isACompass); hunter.addStatusEffect(new StatusEffectInstance(StatusEffects.MINING_FATIGUE, Config.secondsBeforeRelease*20, 255, false, false)); - var attr = hunter.getAttributeInstance(EntityAttributes.GENERIC_MOVEMENT_SPEED); + var attr = hunter.getAttributeInstance(EntityAttributes.MOVEMENT_SPEED); if (attr != null) { final var modifier = new EntityAttributeModifier( Identifier.of("manhunt.speed"), @@ -133,7 +135,7 @@ public class Manhunt implements ModInitializer { ); attr.addTemporaryModifier(modifier); } - attr = hunter.getAttributeInstance(EntityAttributes.GENERIC_GRAVITY); + attr = hunter.getAttributeInstance(EntityAttributes.GRAVITY); if (attr != null) { final var modifier = new EntityAttributeModifier( Identifier.of("manhunt.gravity"), @@ -151,17 +153,17 @@ public class Manhunt implements ModInitializer { for (final UUID uuid : hunters) { final var hunter = pm.getPlayer(uuid); assert hunter != null; - var attr = hunter.getAttributeInstance(EntityAttributes.GENERIC_MOVEMENT_SPEED); + var attr = hunter.getAttributeInstance(EntityAttributes.MOVEMENT_SPEED); if (attr != null) { attr.removeModifier(Identifier.of("manhunt.speed")); } - attr = hunter.getAttributeInstance(EntityAttributes.GENERIC_GRAVITY); + attr = hunter.getAttributeInstance(EntityAttributes.GRAVITY); if (attr != null) { attr.removeModifier(Identifier.of("manhunt.gravity")); } } } - }, Config.secondsBeforeRelease*1000); + }, Config.secondsBeforeRelease*1000L); setTimer(pm); context.getSource().sendFeedback(() -> Text.literal("Game started!"), true); return Command.SINGLE_SUCCESS; diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index d20a285..fe49b5f 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -8,7 +8,9 @@ "Anhgelus Morhtuuzh" ], "contact": { - "sources": "https://github.com/anhgelus/manhunt-mod" + "sources": "https://github.com/anhgelus/manhunt-mod", + "issues": "https://github.com/anhgelus/manhunt-mod/issues", + "homepage": "https://modrinth.com/mod/manhunt-remastered" }, "license": "AGPL-3.0", "icon": "assets/manhunt/icon.png", @@ -22,7 +24,7 @@ "manhunt.mixins.json" ], "depends": { - "fabricloader": ">=0.15.11", + "fabricloader": ">=0.16.7", "minecraft": "~1.21", "java": ">=21", "fabric": "*" -- cgit v1.2.3