From 6f183d857d97eb8f45f010b0d9975b4bb19faa9a Mon Sep 17 00:00:00 2001 From: anhgelus Date: Fri, 26 Jul 2024 21:23:43 +0000 Subject: refactor(minecraft): upgrade to 1.21 Thanks @Leo-210 for the idea --- src/main/java/world/anhgelus/manhunt/Manhunt.java | 280 ++++++++++----------- .../world/anhgelus/manhunt/mixin/ExampleMixin.java | 28 +-- src/main/resources/fabric.mod.json | 64 ++--- src/main/resources/manhunt.mixins.json | 16 +- 4 files changed, 194 insertions(+), 194 deletions(-) (limited to 'src') diff --git a/src/main/java/world/anhgelus/manhunt/Manhunt.java b/src/main/java/world/anhgelus/manhunt/Manhunt.java index 36e1be0..edee3cc 100644 --- a/src/main/java/world/anhgelus/manhunt/Manhunt.java +++ b/src/main/java/world/anhgelus/manhunt/Manhunt.java @@ -1,141 +1,141 @@ -package world.anhgelus.manhunt; - -import com.mojang.brigadier.Command; -import com.mojang.brigadier.builder.LiteralArgumentBuilder; -import com.mojang.brigadier.builder.RequiredArgumentBuilder; -import com.mojang.serialization.DataResult; -import net.fabricmc.api.ModInitializer; -import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback; -import net.fabricmc.fabric.api.entity.event.v1.ServerPlayerEvents; -import net.minecraft.command.EntitySelector; -import net.minecraft.command.arguments.EntityArgumentType; -import net.minecraft.datafixer.NbtOps; -import net.minecraft.entity.effect.StatusEffectInstance; -import net.minecraft.entity.effect.StatusEffects; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.NbtHelper; -import net.minecraft.nbt.Tag; -import net.minecraft.server.PlayerManager; -import net.minecraft.server.command.ServerCommandSource; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.world.GameMode; -import net.minecraft.world.World; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import java.util.*; - -import static com.mojang.brigadier.builder.LiteralArgumentBuilder.literal; - -public class Manhunt implements ModInitializer { - // This logger is used to write text to the console and the log file. - // It is considered best practice to use your mod id as the logger's name. - // That way, it's clear which mod wrote info, warnings, and errors. - public static final Logger LOGGER = LogManager.getLogger("manhunt"); - public static final String MOD_ID = "manhunt"; - - private final Set hunters = new HashSet<>(); - private final Set speedrunners = new HashSet<>(); - private final Map map = new HashMap<>(); - - private final Timer timer = new Timer(); - - @Override - public void onInitialize() { - LOGGER.info("Initializing Manhunt"); - - final LiteralArgumentBuilder command = literal("manhunt"); - - final LiteralArgumentBuilder track = literal("track"); - track.then(RequiredArgumentBuilder.argument("player", EntityArgumentType.player()) - .executes(context -> { - final ServerCommandSource source = context.getSource(); - final ServerPlayerEntity tracked = (ServerPlayerEntity) EntityArgumentType.getEntity(context, "player"); - final ServerPlayerEntity player = source.getPlayer(); - map.put(source.getPlayer().getUuid(), player.getUuid()); - updateCompass(player, tracked); - return Command.SINGLE_SUCCESS; - }) - ); - final LiteralArgumentBuilder team = literal("team"); - final RequiredArgumentBuilder teamP = RequiredArgumentBuilder.argument("player", EntityArgumentType.player()); - teamP.then(LiteralArgumentBuilder.literal("hunter").executes(context -> { - final ServerPlayerEntity p = (ServerPlayerEntity) EntityArgumentType.getEntity(context, "player"); - speedrunners.remove(p.getUuid()); - hunters.add(p.getUuid()); - return Command.SINGLE_SUCCESS; - })) - .then(LiteralArgumentBuilder.literal("speedrunner").executes(context -> { - final ServerPlayerEntity p = (ServerPlayerEntity) EntityArgumentType.getEntity(context, "player"); - hunters.remove(p.getUuid()); - speedrunners.add(p.getUuid()); - return Command.SINGLE_SUCCESS; - })); - team.then(teamP); - final LiteralArgumentBuilder start = literal("start"); - start.executes(context -> { - final PlayerManager pm = context.getSource().getMinecraftServer().getPlayerManager(); - for (final ServerPlayerEntity player : pm.getPlayerList()) { - speedrunners.remove(player.getUuid()); - player.kill(); - speedrunners.add(player.getUuid()); - } - for (final UUID uuid : hunters) { - final ServerPlayerEntity hunter = pm.getPlayer(uuid); - assert hunter != null; - hunter.giveItemStack(new ItemStack(Items.COMPASS)); - hunter.addStatusEffect(new StatusEffectInstance(StatusEffects.SLOWNESS, 30, 255)); - hunter.addStatusEffect(new StatusEffectInstance(StatusEffects.MINING_FATIGUE, 30, 255)); - } - timer.schedule(new TimerTask() { - @Override - public void run() { - for (final UUID uuid : hunters) { - final ServerPlayerEntity hunter = pm.getPlayer(uuid); - if (hunter == null) continue; - final ServerPlayerEntity tracked = pm.getPlayer(uuid); - if (tracked == null) continue; - updateCompass(hunter, tracked); - } - } - }, 60*1000, 60*1000); - return Command.SINGLE_SUCCESS; - }); - - command.then(track); - command.then(team); - command.then(start); - - CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> dispatcher.register(command)); - - ServerPlayerEvents.AFTER_RESPAWN.register((oldPlayer, newPlayer, alive) -> { - if (alive) return; - final UUID uuid = oldPlayer.getUuid(); - if (hunters.contains(uuid)) { - newPlayer.giveItemStack(new ItemStack(Items.COMPASS)); - return; - } - speedrunners.remove(uuid); - if (!speedrunners.isEmpty()) return; - for (final ServerPlayerEntity player : newPlayer.server.getPlayerManager().getPlayerList()) { - player.setGameMode(GameMode.SPECTATOR); - hunters.remove(player.getUuid()); - speedrunners.remove(player.getUuid()); - } - }); - } - - private void updateCompass(ServerPlayerEntity player, ServerPlayerEntity tracked) { - final ItemStack stack = new ItemStack(Items.COMPASS); - assert stack.getTag() != null; - final CompoundTag tag = stack.getTag(); - tag.put("LodestonePos", NbtHelper.fromBlockPos(tracked.getBlockPos())); - final DataResult weird = World.CODEC.encodeStart(NbtOps.INSTANCE, player.world.getRegistryKey()); - weird.resultOrPartial(LOGGER::error).ifPresent((t) -> tag.put("LodestoneDimension", t)); - tag.putBoolean("LodestoneTracked", true); - final int slot = player.inventory.getSlotWithStack(new ItemStack(Items.COMPASS)); - player.inventory.insertStack(slot, stack); - } +package world.anhgelus.manhunt; + +import com.mojang.brigadier.Command; +import com.mojang.brigadier.builder.LiteralArgumentBuilder; +import com.mojang.brigadier.builder.RequiredArgumentBuilder; +import net.fabricmc.api.ModInitializer; +import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback; +import net.fabricmc.fabric.api.entity.event.v1.ServerPlayerEvents; +import net.minecraft.command.EntitySelector; +import net.minecraft.command.argument.EntityArgumentType; +import net.minecraft.component.DataComponentTypes; +import net.minecraft.component.type.LodestoneTrackerComponent; +import net.minecraft.entity.effect.StatusEffectInstance; +import net.minecraft.entity.effect.StatusEffects; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; +import net.minecraft.server.PlayerManager; +import net.minecraft.server.command.ServerCommandSource; +import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.util.math.GlobalPos; +import net.minecraft.world.GameMode; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import java.util.*; + +import static com.mojang.brigadier.builder.LiteralArgumentBuilder.literal; + +public class Manhunt implements ModInitializer { + // This logger is used to write text to the console and the log file. + // It is considered best practice to use your mod id as the logger's name. + // That way, it's clear which mod wrote info, warnings, and errors. + public static final Logger LOGGER = LogManager.getLogger("manhunt"); + public static final String MOD_ID = "manhunt"; + + private final Set hunters = new HashSet<>(); + private final Set speedrunners = new HashSet<>(); + private final Map map = new HashMap<>(); + private final Map compassMap = new HashMap<>(); + + private final Timer timer = new Timer(); + + @Override + public void onInitialize() { + LOGGER.info("Initializing Manhunt"); + + final LiteralArgumentBuilder command = literal("manhunt"); + + final LiteralArgumentBuilder track = literal("track"); + track.then(RequiredArgumentBuilder.argument("player", EntityArgumentType.player()) + .executes(context -> { + final ServerCommandSource source = context.getSource(); + final ServerPlayerEntity tracked = (ServerPlayerEntity) EntityArgumentType.getEntity(context, "player"); + final ServerPlayerEntity player = source.getPlayer(); + map.put(source.getPlayer().getUuid(), player.getUuid()); + updateCompass(player, tracked); + return Command.SINGLE_SUCCESS; + }) + ); + final LiteralArgumentBuilder team = literal("team"); + final RequiredArgumentBuilder teamP = RequiredArgumentBuilder.argument("player", EntityArgumentType.player()); + teamP.then(LiteralArgumentBuilder.literal("hunter").executes(context -> { + final ServerPlayerEntity p = (ServerPlayerEntity) EntityArgumentType.getEntity(context, "player"); + speedrunners.remove(p.getUuid()); + hunters.add(p.getUuid()); + return Command.SINGLE_SUCCESS; + })) + .then(LiteralArgumentBuilder.literal("speedrunner").executes(context -> { + final ServerPlayerEntity p = (ServerPlayerEntity) EntityArgumentType.getEntity(context, "player"); + hunters.remove(p.getUuid()); + speedrunners.add(p.getUuid()); + return Command.SINGLE_SUCCESS; + })); + team.then(teamP); + final LiteralArgumentBuilder start = literal("start"); + start.executes(context -> { + final PlayerManager pm = context.getSource().getServer().getPlayerManager(); + for (final ServerPlayerEntity player : pm.getPlayerList()) { + speedrunners.remove(player.getUuid()); + player.kill(); + speedrunners.add(player.getUuid()); + } + for (final UUID uuid : hunters) { + final ServerPlayerEntity hunter = pm.getPlayer(uuid); + assert hunter != null; + hunter.giveItemStack(new ItemStack(Items.COMPASS)); + hunter.addStatusEffect(new StatusEffectInstance(StatusEffects.SLOWNESS, 30, 255)); + hunter.addStatusEffect(new StatusEffectInstance(StatusEffects.MINING_FATIGUE, 30, 255)); + } + timer.schedule(new TimerTask() { + @Override + public void run() { + for (final UUID uuid : hunters) { + final ServerPlayerEntity hunter = pm.getPlayer(uuid); + if (hunter == null) continue; + final ServerPlayerEntity tracked = pm.getPlayer(uuid); + if (tracked == null) continue; + updateCompass(hunter, tracked); + } + } + }, 60*1000, 60*1000); + return Command.SINGLE_SUCCESS; + }); + + command.then(track); + command.then(team); + command.then(start); + + CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> dispatcher.register(command)); + + ServerPlayerEvents.AFTER_RESPAWN.register((oldPlayer, newPlayer, alive) -> { + if (alive) return; + final UUID uuid = oldPlayer.getUuid(); + if (hunters.contains(uuid)) { + newPlayer.giveItemStack(new ItemStack(Items.COMPASS)); + return; + } + speedrunners.remove(uuid); + if (!speedrunners.isEmpty()) return; + for (final ServerPlayerEntity player : newPlayer.server.getPlayerManager().getPlayerList()) { + player.changeGameMode(GameMode.SPECTATOR); + hunters.remove(player.getUuid()); + speedrunners.remove(player.getUuid()); + } + }); + } + + private void updateCompass(ServerPlayerEntity player, ServerPlayerEntity tracked) { + /* + final LodestoneTrackerComponent trackerCpnt = new LodestoneTrackerComponent(Optional.of(GlobalPos.create(tracked.getWorld().getRegistryKey(), tracked.getBlockPos())), true); + final ItemStack is = compassMap.get(player.getUuid()); + if (is == null) { + LOGGER.warn("Compass item is null"); + return; + } + final int slot = player.getInventory().getSlotWithStack(is); + is.set(DataComponentTypes.LODESTONE_TRACKER, trackerCpnt); + player.getInventory().setStack(slot, is); + */ + } } \ No newline at end of file diff --git a/src/main/java/world/anhgelus/manhunt/mixin/ExampleMixin.java b/src/main/java/world/anhgelus/manhunt/mixin/ExampleMixin.java index f3263af..0ea67b2 100644 --- a/src/main/java/world/anhgelus/manhunt/mixin/ExampleMixin.java +++ b/src/main/java/world/anhgelus/manhunt/mixin/ExampleMixin.java @@ -1,15 +1,15 @@ -package world.anhgelus.manhunt.mixin; - -import net.minecraft.server.MinecraftServer; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(MinecraftServer.class) -public class ExampleMixin { - @Inject(at = @At("HEAD"), method = "loadWorld") - private void init(CallbackInfo info) { - // This code is injected into the start of MinecraftServer.loadWorld()V - } +package world.anhgelus.manhunt.mixin; + +import net.minecraft.server.MinecraftServer; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(MinecraftServer.class) +public class ExampleMixin { + @Inject(at = @At("HEAD"), method = "loadWorld") + private void init(CallbackInfo info) { + // This code is injected into the start of MinecraftServer.loadWorld()V + } } \ No newline at end of file diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 5ade821..8e153fb 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -1,33 +1,33 @@ -{ - "schemaVersion": 1, - "id": "manhunt", - "version": "${version}", - "name": "Manhunt", - "description": "Best Manhunt Minecraft mod.", - "authors": [ - "Anhgelus Morhtuuzh" - ], - "contact": { - "sources": "https://github.com/anhgelus/manhunt-mod" - }, - "license": "AGPL-3.0", - "icon": "assets/manhunt/icon.png", - "environment": "server", - "entrypoints": { - "main": [ - "world.anhgelus.manhunt.Manhunt" - ] - }, - "mixins": [ - "manhunt.mixins.json" - ], - "depends": { - "fabricloader": ">=0.15.11", - "minecraft": "~1.16.1", - "java": ">=17", - "fabric": "*" - }, - "suggests": { - "difficultydeathscaler": "*" - } +{ + "schemaVersion": 1, + "id": "manhunt", + "version": "${version}", + "name": "Manhunt", + "description": "Best Manhunt Minecraft mod.", + "authors": [ + "Anhgelus Morhtuuzh" + ], + "contact": { + "sources": "https://github.com/anhgelus/manhunt-mod" + }, + "license": "AGPL-3.0", + "icon": "assets/manhunt/icon.png", + "environment": "server", + "entrypoints": { + "main": [ + "world.anhgelus.manhunt.Manhunt" + ] + }, + "mixins": [ + "manhunt.mixins.json" + ], + "depends": { + "fabricloader": ">=0.15.11", + "minecraft": "~1.16.1", + "java": ">=17", + "fabric": "*" + }, + "suggests": { + "difficultydeathscaler": "*" + } } \ No newline at end of file diff --git a/src/main/resources/manhunt.mixins.json b/src/main/resources/manhunt.mixins.json index 4fcff5b..12239fb 100644 --- a/src/main/resources/manhunt.mixins.json +++ b/src/main/resources/manhunt.mixins.json @@ -1,9 +1,9 @@ -{ - "required": true, - "package": "world.anhgelus.manhunt.mixin", - "compatibilityLevel": "JAVA_17", - "mixins": [], - "injectors": { - "defaultRequire": 1 - } +{ + "required": true, + "package": "world.anhgelus.manhunt.mixin", + "compatibilityLevel": "JAVA_17", + "mixins": [], + "injectors": { + "defaultRequire": 1 + } } \ No newline at end of file -- cgit v1.2.3 From 57353a97bf2308788e93a3ea6349258f64aee5ca Mon Sep 17 00:00:00 2001 From: anhgelus Date: Fri, 26 Jul 2024 21:32:21 +0000 Subject: refactor(compass): use map instead of 'weird' var --- src/main/java/world/anhgelus/manhunt/Manhunt.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/main/java/world/anhgelus/manhunt/Manhunt.java b/src/main/java/world/anhgelus/manhunt/Manhunt.java index edee3cc..f71127f 100644 --- a/src/main/java/world/anhgelus/manhunt/Manhunt.java +++ b/src/main/java/world/anhgelus/manhunt/Manhunt.java @@ -27,8 +27,8 @@ import java.util.*; import static com.mojang.brigadier.builder.LiteralArgumentBuilder.literal; public class Manhunt implements ModInitializer { - // This logger is used to write text to the console and the log file. - // It is considered best practice to use your mod id as the logger's name. + // This logger isACompass used to write text to the console and the log file. + // It isACompass considered best practice to use your mod id as the logger's name. // That way, it's clear which mod wrote info, warnings, and errors. public static final Logger LOGGER = LogManager.getLogger("manhunt"); public static final String MOD_ID = "manhunt"; @@ -52,7 +52,8 @@ public class Manhunt implements ModInitializer { final ServerCommandSource source = context.getSource(); final ServerPlayerEntity tracked = (ServerPlayerEntity) EntityArgumentType.getEntity(context, "player"); final ServerPlayerEntity player = source.getPlayer(); - map.put(source.getPlayer().getUuid(), player.getUuid()); + if (player == null) return 2; + map.put(source.getPlayer().getUuid(), tracked.getUuid()); updateCompass(player, tracked); return Command.SINGLE_SUCCESS; }) @@ -83,7 +84,9 @@ public class Manhunt implements ModInitializer { for (final UUID uuid : hunters) { final ServerPlayerEntity hunter = pm.getPlayer(uuid); assert hunter != null; - hunter.giveItemStack(new ItemStack(Items.COMPASS)); + final ItemStack isACompass = new ItemStack(Items.COMPASS); + compassMap.put(hunter.getUuid(), isACompass); + hunter.giveItemStack(isACompass); hunter.addStatusEffect(new StatusEffectInstance(StatusEffects.SLOWNESS, 30, 255)); hunter.addStatusEffect(new StatusEffectInstance(StatusEffects.MINING_FATIGUE, 30, 255)); } @@ -126,16 +129,14 @@ public class Manhunt implements ModInitializer { } private void updateCompass(ServerPlayerEntity player, ServerPlayerEntity tracked) { - /* final LodestoneTrackerComponent trackerCpnt = new LodestoneTrackerComponent(Optional.of(GlobalPos.create(tracked.getWorld().getRegistryKey(), tracked.getBlockPos())), true); final ItemStack is = compassMap.get(player.getUuid()); if (is == null) { - LOGGER.warn("Compass item is null"); + LOGGER.warn("Compass item isACompass null"); return; } final int slot = player.getInventory().getSlotWithStack(is); is.set(DataComponentTypes.LODESTONE_TRACKER, trackerCpnt); player.getInventory().setStack(slot, is); - */ } } \ No newline at end of file -- cgit v1.2.3 From c03a6b8454ef015265a9a9eb5db999ed68655528 Mon Sep 17 00:00:00 2001 From: anhgelus Date: Fri, 26 Jul 2024 21:50:03 +0000 Subject: feat(nether): remove spawn of piglin brute --- src/main/java/world/anhgelus/manhunt/Manhunt.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/main/java/world/anhgelus/manhunt/Manhunt.java b/src/main/java/world/anhgelus/manhunt/Manhunt.java index f71127f..1f7f0b7 100644 --- a/src/main/java/world/anhgelus/manhunt/Manhunt.java +++ b/src/main/java/world/anhgelus/manhunt/Manhunt.java @@ -6,12 +6,15 @@ import com.mojang.brigadier.builder.RequiredArgumentBuilder; import net.fabricmc.api.ModInitializer; import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback; import net.fabricmc.fabric.api.entity.event.v1.ServerPlayerEvents; +import net.fabricmc.fabric.api.event.lifecycle.v1.ServerChunkEvents; +import net.fabricmc.fabric.api.event.lifecycle.v1.ServerEntityEvents; import net.minecraft.command.EntitySelector; import net.minecraft.command.argument.EntityArgumentType; import net.minecraft.component.DataComponentTypes; import net.minecraft.component.type.LodestoneTrackerComponent; import net.minecraft.entity.effect.StatusEffectInstance; import net.minecraft.entity.effect.StatusEffects; +import net.minecraft.entity.mob.PiglinBruteEntity; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.server.PlayerManager; @@ -19,6 +22,8 @@ import net.minecraft.server.command.ServerCommandSource; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.util.math.GlobalPos; import net.minecraft.world.GameMode; +import net.minecraft.world.dimension.DimensionType; +import net.minecraft.world.dimension.DimensionTypes; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -27,11 +32,8 @@ import java.util.*; import static com.mojang.brigadier.builder.LiteralArgumentBuilder.literal; public class Manhunt implements ModInitializer { - // This logger isACompass used to write text to the console and the log file. - // It isACompass considered best practice to use your mod id as the logger's name. - // That way, it's clear which mod wrote info, warnings, and errors. - public static final Logger LOGGER = LogManager.getLogger("manhunt"); - public static final String MOD_ID = "manhunt"; + public static final String MOD_ID = "manhunt"; + public static final Logger LOGGER = LogManager.getLogger(MOD_ID); private final Set hunters = new HashSet<>(); private final Set speedrunners = new HashSet<>(); @@ -126,6 +128,10 @@ public class Manhunt implements ModInitializer { speedrunners.remove(player.getUuid()); } }); + + ServerEntityEvents.ENTITY_LOAD.register((entity, world) -> { + if (entity instanceof PiglinBruteEntity) entity.discard(); + }); } private void updateCompass(ServerPlayerEntity player, ServerPlayerEntity tracked) { -- cgit v1.2.3 From 3123d5696a34a434f8d976df64047c1e12086810 Mon Sep 17 00:00:00 2001 From: anhgelus Date: Fri, 26 Jul 2024 22:43:04 +0000 Subject: feat(nether): 1.16.1 loot_table --- src/main/java/world/anhgelus/manhunt/Manhunt.java | 5 +- .../world/anhgelus/manhunt/mixin/ExampleMixin.java | 15 -- .../loot_table/gameplay/piglin_bartering.json | 239 +++++++++++++++++++++ src/main/resources/fabric.mod.json | 7 +- src/main/resources/manhunt.mixins.json | 9 - src/main/resources/pack.mcmeta | 6 + 6 files changed, 248 insertions(+), 33 deletions(-) delete mode 100644 src/main/java/world/anhgelus/manhunt/mixin/ExampleMixin.java create mode 100644 src/main/resources/data/minecraft/loot_table/gameplay/piglin_bartering.json delete mode 100644 src/main/resources/manhunt.mixins.json create mode 100644 src/main/resources/pack.mcmeta (limited to 'src') diff --git a/src/main/java/world/anhgelus/manhunt/Manhunt.java b/src/main/java/world/anhgelus/manhunt/Manhunt.java index 1f7f0b7..fe761de 100644 --- a/src/main/java/world/anhgelus/manhunt/Manhunt.java +++ b/src/main/java/world/anhgelus/manhunt/Manhunt.java @@ -6,7 +6,6 @@ import com.mojang.brigadier.builder.RequiredArgumentBuilder; import net.fabricmc.api.ModInitializer; import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback; import net.fabricmc.fabric.api.entity.event.v1.ServerPlayerEvents; -import net.fabricmc.fabric.api.event.lifecycle.v1.ServerChunkEvents; import net.fabricmc.fabric.api.event.lifecycle.v1.ServerEntityEvents; import net.minecraft.command.EntitySelector; import net.minecraft.command.argument.EntityArgumentType; @@ -22,8 +21,6 @@ import net.minecraft.server.command.ServerCommandSource; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.util.math.GlobalPos; import net.minecraft.world.GameMode; -import net.minecraft.world.dimension.DimensionType; -import net.minecraft.world.dimension.DimensionTypes; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -138,7 +135,7 @@ public class Manhunt implements ModInitializer { final LodestoneTrackerComponent trackerCpnt = new LodestoneTrackerComponent(Optional.of(GlobalPos.create(tracked.getWorld().getRegistryKey(), tracked.getBlockPos())), true); final ItemStack is = compassMap.get(player.getUuid()); if (is == null) { - LOGGER.warn("Compass item isACompass null"); + LOGGER.warn("Compass item is null"); return; } final int slot = player.getInventory().getSlotWithStack(is); diff --git a/src/main/java/world/anhgelus/manhunt/mixin/ExampleMixin.java b/src/main/java/world/anhgelus/manhunt/mixin/ExampleMixin.java deleted file mode 100644 index 0ea67b2..0000000 --- a/src/main/java/world/anhgelus/manhunt/mixin/ExampleMixin.java +++ /dev/null @@ -1,15 +0,0 @@ -package world.anhgelus.manhunt.mixin; - -import net.minecraft.server.MinecraftServer; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(MinecraftServer.class) -public class ExampleMixin { - @Inject(at = @At("HEAD"), method = "loadWorld") - private void init(CallbackInfo info) { - // This code is injected into the start of MinecraftServer.loadWorld()V - } -} \ No newline at end of file diff --git a/src/main/resources/data/minecraft/loot_table/gameplay/piglin_bartering.json b/src/main/resources/data/minecraft/loot_table/gameplay/piglin_bartering.json new file mode 100644 index 0000000..09f15e8 --- /dev/null +++ b/src/main/resources/data/minecraft/loot_table/gameplay/piglin_bartering.json @@ -0,0 +1,239 @@ +{ + "type": "minecraft:barter", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:book", + "weight": 5, + "functions": [ + { + "function": "minecraft:enchant_randomly", + "options": "minecraft:soul_speed" + } + ] + }, + { + "type": "minecraft:item", + "name": "minecraft:iron_boots", + "weight": 8, + "functions": [ + { + "function": "minecraft:enchant_randomly", + "options": "minecraft:soul_speed" + } + ] + }, + { + "type": "minecraft:item", + "name": "minecraft:potion", + "weight": 10, + "functions": [ + { + "function": "minecraft:set_potion", + "id": "minecraft:fire_resistance" + } + ] + }, + { + "type": "minecraft:item", + "name": "minecraft:splash_potion", + "weight": 10, + "functions": [ + { + "function": "minecraft:set_potion", + "id": "minecraft:fire_resistance" + } + ] + }, + { + "type": "minecraft:item", + "name": "minecraft:iron_nugget", + "weight": 10, + "functions": [ + { + "function": "minecraft:set_count", + "count": { + "type": "minecraft:uniform", + "min": 9, + "max": 36 + } + } + ] + }, + { + "type": "minecraft:item", + "name": "minecraft:quartz", + "weight": 20, + "functions": [ + { + "function": "minecraft:set_count", + "count": { + "type": "minecraft:uniform", + "min": 8, + "max": 16 + } + } + ] + }, + { + "type": "minecraft:item", + "name": "minecraft:glowstone_dust", + "weight": 20, + "functions": [ + { + "function": "minecraft:set_count", + "count": { + "type": "minecraft:uniform", + "min": 5, + "max": 12 + } + } + ] + }, + { + "type": "minecraft:item", + "name": "minecraft:magma_cream", + "weight": 20, + "functions": [ + { + "function": "minecraft:set_count", + "count": { + "type": "minecraft:uniform", + "min": 2, + "max": 6 + } + } + ] + }, + { + "type": "minecraft:item", + "name": "minecraft:ender_pearl", + "weight": 20, + "functions": [ + { + "function": "minecraft:set_count", + "count": { + "type": "minecraft:uniform", + "min": 4, + "max": 8 + } + } + ] + }, + { + "type": "minecraft:item", + "name": "minecraft:string", + "weight": 20, + "functions": [ + { + "function": "minecraft:set_count", + "count": { + "type": "minecraft:uniform", + "min": 8, + "max": 24 + } + } + ] + }, + { + "type": "minecraft:item", + "name": "minecraft:fire_charge", + "weight": 40, + "functions": [ + { + "function": "minecraft:set_count", + "count": { + "type": "minecraft:uniform", + "min": 1, + "max": 5 + } + } + ] + }, + { + "type": "minecraft:item", + "name": "minecraft:gravel", + "weight": 40, + "functions": [ + { + "function": "minecraft:set_count", + "count": { + "type": "minecraft:uniform", + "min": 8, + "max": 16 + } + } + ] + }, + { + "type": "minecraft:item", + "name": "minecraft:leather", + "weight": 40, + "functions": [ + { + "function": "minecraft:set_count", + "count": { + "type": "minecraft:uniform", + "min": 4, + "max": 10 + } + } + ] + }, + { + "type": "minecraft:item", + "name": "minecraft:nether_brick", + "weight": 40, + "functions": [ + { + "function": "minecraft:set_count", + "count": { + "type": "minecraft:uniform", + "min": 4, + "max": 16 + } + } + ] + }, + { + "type": "minecraft:item", + "name": "minecraft:obsidian", + "weight": 40 + }, + { + "type": "minecraft:item", + "name": "minecraft:crying_obsidian", + "weight": 40, + "functions": [ + { + "function": "minecraft:set_count", + "count": { + "type": "minecraft:uniform", + "min": 1, + "max": 3 + } + } + ] + }, + { + "type": "minecraft:item", + "name": "minecraft:soul_sand", + "weight": 40, + "functions": [ + { + "function": "minecraft:set_count", + "count": { + "type": "minecraft:uniform", + "min": 4, + "max": 16 + } + } + ] + } + ] + } + ] +} diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 8e153fb..b097ea1 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -18,13 +18,10 @@ "world.anhgelus.manhunt.Manhunt" ] }, - "mixins": [ - "manhunt.mixins.json" - ], "depends": { "fabricloader": ">=0.15.11", - "minecraft": "~1.16.1", - "java": ">=17", + "minecraft": "~1.21", + "java": ">=21", "fabric": "*" }, "suggests": { diff --git a/src/main/resources/manhunt.mixins.json b/src/main/resources/manhunt.mixins.json deleted file mode 100644 index 12239fb..0000000 --- a/src/main/resources/manhunt.mixins.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "required": true, - "package": "world.anhgelus.manhunt.mixin", - "compatibilityLevel": "JAVA_17", - "mixins": [], - "injectors": { - "defaultRequire": 1 - } -} \ No newline at end of file diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta new file mode 100644 index 0000000..ffe0b8e --- /dev/null +++ b/src/main/resources/pack.mcmeta @@ -0,0 +1,6 @@ +{ + "pack": { + "pack_format": 48, + "description": "isACompass" + } +} \ No newline at end of file -- cgit v1.2.3