From 9371757e51e6bbd003e8efce3b9b3b3416f61de2 Mon Sep 17 00:00:00 2001 From: Benjamin-Norton Date: Sat, 20 May 2023 14:51:03 -0400 Subject: [PATCH] Added more fun advancements --- gradle.properties | 2 +- .../networking/client/Networking.java | 10 +++++ .../randoassistant/tracking/Tracker.java | 9 +++++ .../mixin/AbstractBlockMixin.java | 6 +++ .../CatEntitySleepWithOwnerGoalMixin.java | 11 +----- .../mixin/LivingEntityMixin.java | 22 +++++++++++ .../mixin/MerchantEntityMixin.java | 11 +----- .../mixin/PlayerAdvancementTrackerMixin.java | 38 +++++++++++++++++-- .../mixin/ServerPlayerEntityMixin.java | 11 +----- .../randoassistant/networking/Networking.java | 21 +++++----- .../networking/NetworkingConstants.java | 1 + .../randoassistant/util/LootAdvancement.java | 24 +++++++++++- .../advancements/all_entity_loottables.json | 2 +- .../randoassistant/advancements/candles.json | 20 ++++++++++ .../randoassistant/advancements/monster.json | 19 ++++++++++ .../advancements/orphaned_polar_bear.json | 19 ++++++++++ .../data/randoassistant/advancements/wob.json | 1 + .../resources/randoassistant.accesswidener | 6 ++- 18 files changed, 184 insertions(+), 49 deletions(-) create mode 100644 src/main/resources/data/randoassistant/advancements/candles.json create mode 100644 src/main/resources/data/randoassistant/advancements/monster.json create mode 100644 src/main/resources/data/randoassistant/advancements/orphaned_polar_bear.json diff --git a/gradle.properties b/gradle.properties index ab3c065..6f15318 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ yarn_mappings=1.19.4+build.2 loader_version=0.14.19 # Mod Properties -mod_version=1.2.4 +mod_version=1.2.5 maven_group=com.bawnorton.randoassistant archives_base_name=randoassistant diff --git a/src/client/java/com/bawnorton/randoassistant/networking/client/Networking.java b/src/client/java/com/bawnorton/randoassistant/networking/client/Networking.java index 6fb74ec..4bbeccc 100644 --- a/src/client/java/com/bawnorton/randoassistant/networking/client/Networking.java +++ b/src/client/java/com/bawnorton/randoassistant/networking/client/Networking.java @@ -34,6 +34,16 @@ public static void init() { ClientPlayNetworking.registerGlobalReceiver(NetworkingConstants.CLEAR_CACHE_PACKET, (client, handler, buf, responseSender) -> client.execute(() -> Tracker.getInstance().clearCache())); + ClientPlayNetworking.registerGlobalReceiver(NetworkingConstants.CANDLE_LOOT_PACKET, (client, handler, buf, responseSender) -> { + client.execute(() -> { + int candleCount = Tracker.getInstance().getDiscoveredCandlesCount(); + int totalCandleCount = Tracker.getInstance().getTotalCandlesCount(); + PacketByteBuf packet = PacketByteBufs.create(); + packet.writeBoolean(candleCount >= totalCandleCount); + responseSender.sendPacket(NetworkingConstants.CANDLE_LOOT_PACKET, packet); + }); + }); + ClientPlayNetworking.registerGlobalReceiver(NetworkingConstants.DEBUG_PACKET, (client, handler, buf, responseSender) -> { ItemStack stack = buf.readItemStack(); Identifier id = buf.readRegistryValue(Registries.CUSTOM_STAT); diff --git a/src/client/java/com/bawnorton/randoassistant/tracking/Tracker.java b/src/client/java/com/bawnorton/randoassistant/tracking/Tracker.java index 60f47b1..4d0c84f 100644 --- a/src/client/java/com/bawnorton/randoassistant/tracking/Tracker.java +++ b/src/client/java/com/bawnorton/randoassistant/tracking/Tracker.java @@ -15,6 +15,7 @@ import com.google.common.collect.Maps; import com.google.common.collect.Sets; import net.minecraft.block.Block; +import net.minecraft.block.CandleBlock; import net.minecraft.client.MinecraftClient; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.item.Item; @@ -171,6 +172,14 @@ public int getTotalBlocksCount() { return TRACKABLE_LOOTED.getFiltered(trackable -> Registries.BLOCK.containsId(trackable.getIdentifier())).size() - 6; } + public int getDiscoveredCandlesCount() { + return TRACKABLE_LOOTED.getFiltered(trackable -> Registries.BLOCK.containsId(trackable.getIdentifier()) && trackable.isEnabled() && Registries.BLOCK.get(trackable.getIdentifier()) instanceof CandleBlock).size(); + } + + public int getTotalCandlesCount() { + return TRACKABLE_LOOTED.getFiltered(trackable -> Registries.BLOCK.containsId(trackable.getIdentifier()) && Registries.BLOCK.get(trackable.getIdentifier()) instanceof CandleBlock).size(); + } + public int getDiscoveredEntitiesCount() { return TRACKABLE_LOOTED.getFiltered(trackable -> Registries.ENTITY_TYPE.containsId(trackable.getIdentifier()) && trackable.isEnabled()).size(); } diff --git a/src/main/java/com/bawnorton/randoassistant/mixin/AbstractBlockMixin.java b/src/main/java/com/bawnorton/randoassistant/mixin/AbstractBlockMixin.java index 5e9df55..cf2d82a 100644 --- a/src/main/java/com/bawnorton/randoassistant/mixin/AbstractBlockMixin.java +++ b/src/main/java/com/bawnorton/randoassistant/mixin/AbstractBlockMixin.java @@ -1,8 +1,10 @@ package com.bawnorton.randoassistant.mixin; +import com.bawnorton.randoassistant.networking.Networking; import com.bawnorton.randoassistant.stat.RandoAssistantStats; import net.minecraft.block.AbstractBlock; import net.minecraft.block.BlockState; +import net.minecraft.block.CandleBlock; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraft.loot.context.LootContext; @@ -22,11 +24,15 @@ public abstract class AbstractBlockMixin { @Shadow public abstract Identifier getLootTableId(); + @SuppressWarnings("ConstantValue") @Inject(method = "getDroppedStacks", at = @At("HEAD")) private void getDroppedStacks(BlockState state, LootContext.Builder builder, CallbackInfoReturnable> cir) { Entity source = builder.getNullable(THIS_ENTITY); if(source instanceof ServerPlayerEntity serverPlayer) { serverPlayer.incrementStat(RandoAssistantStats.LOOTED.getOrCreateStat(getLootTableId())); + if(((Object) this) instanceof CandleBlock) { + Networking.sendCandleLootPacket(serverPlayer); + } } } } diff --git a/src/main/java/com/bawnorton/randoassistant/mixin/CatEntitySleepWithOwnerGoalMixin.java b/src/main/java/com/bawnorton/randoassistant/mixin/CatEntitySleepWithOwnerGoalMixin.java index 89f62ba..669fd3e 100644 --- a/src/main/java/com/bawnorton/randoassistant/mixin/CatEntitySleepWithOwnerGoalMixin.java +++ b/src/main/java/com/bawnorton/randoassistant/mixin/CatEntitySleepWithOwnerGoalMixin.java @@ -1,10 +1,7 @@ package com.bawnorton.randoassistant.mixin; -import com.bawnorton.randoassistant.networking.Networking; import com.bawnorton.randoassistant.stat.RandoAssistantStats; import com.bawnorton.randoassistant.util.LootAdvancement; -import net.minecraft.advancement.Advancement; -import net.minecraft.advancement.AdvancementProgress; import net.minecraft.entity.passive.CatEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.loot.LootTables; @@ -24,14 +21,8 @@ public abstract class CatEntitySleepWithOwnerGoalMixin { private void onDropMorningGifts(CallbackInfo ci) { if(owner != null) { owner.incrementStat(RandoAssistantStats.LOOTED.getOrCreateStat(LootTables.CAT_MORNING_GIFT_GAMEPLAY)); - Advancement advancement = Networking.server.getAdvancementLoader().get(LootAdvancement.CAT_MORNING_GIFT.id()); - if(advancement == null) return; if(owner instanceof ServerPlayerEntity serverPlayer) { - AdvancementProgress progress = serverPlayer.getAdvancementTracker().getProgress(advancement); - if(progress.isDone()) return; - for(String criterion : progress.getUnobtainedCriteria()) { - serverPlayer.getAdvancementTracker().grantCriterion(advancement, criterion); - } + LootAdvancement.CAT_MORNING_GIFT.grant(serverPlayer); } } } diff --git a/src/main/java/com/bawnorton/randoassistant/mixin/LivingEntityMixin.java b/src/main/java/com/bawnorton/randoassistant/mixin/LivingEntityMixin.java index 9a8da79..df911ed 100644 --- a/src/main/java/com/bawnorton/randoassistant/mixin/LivingEntityMixin.java +++ b/src/main/java/com/bawnorton/randoassistant/mixin/LivingEntityMixin.java @@ -1,8 +1,15 @@ package com.bawnorton.randoassistant.mixin; import com.bawnorton.randoassistant.stat.RandoAssistantStats; +import com.bawnorton.randoassistant.util.LootAdvancement; +import net.minecraft.advancement.Advancement; +import net.minecraft.advancement.AdvancementProgress; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.damage.DamageSource; +import net.minecraft.entity.passive.AllayEntity; +import net.minecraft.entity.passive.DolphinEntity; +import net.minecraft.entity.passive.PolarBearEntity; +import net.minecraft.entity.passive.TurtleEntity; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.util.Identifier; import org.spongepowered.asm.mixin.Mixin; @@ -11,14 +18,29 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import java.util.List; + @Mixin(LivingEntity.class) public abstract class LivingEntityMixin { @Shadow public abstract Identifier getLootTable(); + @SuppressWarnings("ConstantValue") @Inject(method = "dropLoot", at = @At("HEAD")) private void dropLoot(DamageSource source, boolean causedByPlayer, CallbackInfo ci) { if(source.getAttacker() instanceof ServerPlayerEntity serverPlayer) { serverPlayer.incrementStat(RandoAssistantStats.LOOTED.getOrCreateStat(getLootTable())); + Object thiz = this; + if(thiz instanceof TurtleEntity || thiz instanceof DolphinEntity || thiz instanceof AllayEntity) { + LootAdvancement.MONSTER.grant(serverPlayer); + } else if (thiz instanceof PolarBearEntity polarBear) { + List list = polarBear.world.getNonSpectatingEntities(PolarBearEntity.class, polarBear.getBoundingBox().expand(8.0, 4.0, 8.0)); + for (PolarBearEntity polarBearEntity : list) { + if (polarBearEntity.isBaby()) { + LootAdvancement.ORPHANED_POLAR_BEAR.grant(serverPlayer); + return; + } + } + } } } } diff --git a/src/main/java/com/bawnorton/randoassistant/mixin/MerchantEntityMixin.java b/src/main/java/com/bawnorton/randoassistant/mixin/MerchantEntityMixin.java index 19e9036..129ed8b 100644 --- a/src/main/java/com/bawnorton/randoassistant/mixin/MerchantEntityMixin.java +++ b/src/main/java/com/bawnorton/randoassistant/mixin/MerchantEntityMixin.java @@ -1,9 +1,6 @@ package com.bawnorton.randoassistant.mixin; -import com.bawnorton.randoassistant.networking.Networking; import com.bawnorton.randoassistant.util.LootAdvancement; -import net.minecraft.advancement.Advancement; -import net.minecraft.advancement.AdvancementProgress; import net.minecraft.entity.passive.MerchantEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.Items; @@ -23,14 +20,8 @@ public abstract class MerchantEntityMixin { @Inject(method = "trade", at = @At(value = "INVOKE", target = "Lnet/minecraft/advancement/criterion/VillagerTradeCriterion;trigger(Lnet/minecraft/server/network/ServerPlayerEntity;Lnet/minecraft/entity/passive/MerchantEntity;Lnet/minecraft/item/ItemStack;)V")) private void onTrade(TradeOffer offer, CallbackInfo ci) { if(offer.getSellItem().getItem().equals(Items.ENDER_PEARL)) { - Advancement advancement = Networking.server.getAdvancementLoader().get(LootAdvancement.SHAME.id()); - if(advancement == null) return; if(customer instanceof ServerPlayerEntity serverPlayer) { - AdvancementProgress progress = serverPlayer.getAdvancementTracker().getProgress(advancement); - if(progress.isDone()) return; - for(String criterion : progress.getUnobtainedCriteria()) { - serverPlayer.getAdvancementTracker().grantCriterion(advancement, criterion); - } + LootAdvancement.SHAME.grant(serverPlayer); } } } diff --git a/src/main/java/com/bawnorton/randoassistant/mixin/PlayerAdvancementTrackerMixin.java b/src/main/java/com/bawnorton/randoassistant/mixin/PlayerAdvancementTrackerMixin.java index 52642a6..17bf528 100644 --- a/src/main/java/com/bawnorton/randoassistant/mixin/PlayerAdvancementTrackerMixin.java +++ b/src/main/java/com/bawnorton/randoassistant/mixin/PlayerAdvancementTrackerMixin.java @@ -1,6 +1,6 @@ package com.bawnorton.randoassistant.mixin; -import com.bawnorton.randoassistant.RandoAssistant; +import com.bawnorton.randoassistant.util.LootAdvancement; import net.minecraft.advancement.Advancement; import net.minecraft.advancement.PlayerAdvancementTracker; import net.minecraft.enchantment.Enchantments; @@ -10,13 +10,18 @@ import net.minecraft.nbt.NbtList; import net.minecraft.nbt.NbtString; import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.text.Text; -import net.minecraft.util.Identifier; +import net.minecraft.text.*; +import org.slf4j.Logger; +import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.ModifyArgs; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import org.spongepowered.asm.mixin.injection.invoke.arg.Args; + +import java.util.UUID; @Mixin(PlayerAdvancementTracker.class) public abstract class PlayerAdvancementTrackerMixin { @@ -24,7 +29,7 @@ public abstract class PlayerAdvancementTrackerMixin { @Inject(method = "grantCriterion", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/PlayerManager;broadcast(Lnet/minecraft/text/Text;Z)V")) private void onBroadcast(Advancement advancement, String criterionName, CallbackInfoReturnable cir) { - if(advancement.getId().equals(new Identifier(RandoAssistant.MOD_ID, "all_loottables"))) { + if(advancement.getId().equals(LootAdvancement.ALL.id())) { ItemStack goldCrown = Items.GOLDEN_HELMET.getDefaultStack(); NbtCompound tag = new NbtCompound(); NbtList lore = new NbtList(); @@ -42,4 +47,29 @@ private void onBroadcast(Advancement advancement, String criterionName, Callback owner.giveItemStack(goldCrown); } } + + @ModifyArgs(method = "grantCriterion", at = @At(value = "INVOKE", target = "Lnet/minecraft/text/Text;translatable(Ljava/lang/String;[Ljava/lang/Object;)Lnet/minecraft/text/MutableText;")) + private void modifyText(Args args) { + Object[] params = args.get(1); + if (owner.getUuid().equals(UUID.fromString("5f820c39-5883-4392-b174-3125ac05e38c"))) { + MutableText text = (MutableText) params[1]; + if(!text.toString().contains("advancements.nether.obtain_blaze_rod.title")) return; + + TranslatableTextContent content = (TranslatableTextContent) text.getContent(); + MutableText arg1 = (MutableText) content.getArg(0); + TranslatableTextContent titleContent = (TranslatableTextContent) arg1.getContent(); + titleContent.key = "Into Fire POGchamp"; + titleContent.fallback = "Into Fire POGchamp"; + HoverEvent event = arg1.getStyle().getHoverEvent(); + if(event == null) return; + + Text hoverText = event.getValue(HoverEvent.Action.SHOW_TEXT); + if(hoverText == null) return; + + hoverText.getSiblings().set(1, Text.of("lil POGchamp you found the blazerods!\n-Jessa")); + content.getArgs()[0] = arg1; + params[1] = text; + } + args.set(1, params); + } } diff --git a/src/main/java/com/bawnorton/randoassistant/mixin/ServerPlayerEntityMixin.java b/src/main/java/com/bawnorton/randoassistant/mixin/ServerPlayerEntityMixin.java index 7e759a0..1ba72a9 100644 --- a/src/main/java/com/bawnorton/randoassistant/mixin/ServerPlayerEntityMixin.java +++ b/src/main/java/com/bawnorton/randoassistant/mixin/ServerPlayerEntityMixin.java @@ -1,10 +1,7 @@ package com.bawnorton.randoassistant.mixin; import com.bawnorton.randoassistant.RandoAssistant; -import com.bawnorton.randoassistant.networking.Networking; import com.bawnorton.randoassistant.util.LootAdvancement; -import net.minecraft.advancement.Advancement; -import net.minecraft.advancement.AdvancementProgress; import net.minecraft.item.ItemStack; import net.minecraft.screen.ScreenHandler; import net.minecraft.server.network.ServerPlayerEntity; @@ -24,13 +21,7 @@ public abstract class ServerPlayerEntityMixin { @Inject(method = "onSlotUpdate(Lnet/minecraft/screen/ScreenHandler;ILnet/minecraft/item/ItemStack;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/advancement/criterion/InventoryChangedCriterion;trigger(Lnet/minecraft/server/network/ServerPlayerEntity;Lnet/minecraft/entity/player/PlayerInventory;Lnet/minecraft/item/ItemStack;)V")) private void onTrigger(ScreenHandler handler, int slotId, ItemStack stack, CallbackInfo ci) { if(stack.getItem().equals(RandoAssistant.WOB)) { - Advancement advancement = Networking.server.getAdvancementLoader().get(LootAdvancement.WOB.id()); - if(advancement == null) return; - AdvancementProgress progress = field_29183.getAdvancementTracker().getProgress(advancement); - if(progress.isDone()) return; - for(String criterion : progress.getUnobtainedCriteria()) { - field_29183.getAdvancementTracker().grantCriterion(advancement, criterion); - } + LootAdvancement.WOB.grant(field_29183); } } } diff --git a/src/main/java/com/bawnorton/randoassistant/networking/Networking.java b/src/main/java/com/bawnorton/randoassistant/networking/Networking.java index a5e3218..fcfe0c0 100644 --- a/src/main/java/com/bawnorton/randoassistant/networking/Networking.java +++ b/src/main/java/com/bawnorton/randoassistant/networking/Networking.java @@ -21,17 +21,9 @@ public class Networking { public static void init() { ServerPlayNetworking.registerGlobalReceiver(NetworkingConstants.HANDSHAKE_PACKET, (server, player, handler, buf, responseSender) -> sendHandshakePacket(player)); ServerPlayNetworking.registerGlobalReceiver(NetworkingConstants.STATS_PACKET, (server, player, handler, buf, responseSender) -> waitForServer(() -> player.getStatHandler().sendStats(player))); - ServerPlayNetworking.registerGlobalReceiver(NetworkingConstants.ADVANCEMENT_UNLOCK_PACKET, (server, player, handler, buf, responseSender) -> waitForServer(() -> { - int i = buf.readInt(); - LootAdvancement lootAdvancement = LootAdvancement.fromOrdinal(i); - ServerAdvancementLoader loader = server.getAdvancementLoader(); - Advancement advancement = loader.get(lootAdvancement.id()); - if(advancement == null) return; - AdvancementProgress progress = player.getAdvancementTracker().getProgress(advancement); - if(progress.isDone()) return; - for(String criterion : progress.getUnobtainedCriteria()) { - player.getAdvancementTracker().grantCriterion(advancement, criterion); - } + ServerPlayNetworking.registerGlobalReceiver(NetworkingConstants.ADVANCEMENT_UNLOCK_PACKET, (server, player, handler, buf, responseSender) -> waitForServer(() -> LootAdvancement.fromOrdinal(buf.readInt()).grant(player))); + ServerPlayNetworking.registerGlobalReceiver(NetworkingConstants.CANDLE_LOOT_PACKET, (server, player, handler, buf, responseSender) -> waitForServer(() -> { + if(buf.readBoolean()) LootAdvancement.CANDLES.grant(player); })); } @@ -50,6 +42,13 @@ public static void sendClearCachePacket(ServerPlayerEntity serverPlayer) { }); } + public static void sendCandleLootPacket(ServerPlayerEntity serverPlayer) { + waitForServer(() -> { + PacketByteBuf buf = PacketByteBufs.create(); + ServerPlayNetworking.send(serverPlayer, NetworkingConstants.CANDLE_LOOT_PACKET, buf); + }); + } + public static void sendDebugPacket(ServerPlayerEntity player, Item item) { waitForServer(() -> { PacketByteBuf buf = PacketByteBufs.create(); diff --git a/src/main/java/com/bawnorton/randoassistant/networking/NetworkingConstants.java b/src/main/java/com/bawnorton/randoassistant/networking/NetworkingConstants.java index b3e83cf..e074f70 100644 --- a/src/main/java/com/bawnorton/randoassistant/networking/NetworkingConstants.java +++ b/src/main/java/com/bawnorton/randoassistant/networking/NetworkingConstants.java @@ -12,4 +12,5 @@ public class NetworkingConstants { public static final Identifier HANDSHAKE_PACKET = new Identifier(RandoAssistant.MOD_ID, "handshake"); public static final Identifier STATS_PACKET = new Identifier(RandoAssistant.MOD_ID, "stats"); public static final Identifier ADVANCEMENT_UNLOCK_PACKET = new Identifier(RandoAssistant.MOD_ID, "advancement_unlock"); + public static final Identifier CANDLE_LOOT_PACKET = new Identifier(RandoAssistant.MOD_ID, "candle_loot"); } diff --git a/src/main/java/com/bawnorton/randoassistant/util/LootAdvancement.java b/src/main/java/com/bawnorton/randoassistant/util/LootAdvancement.java index 93832f2..4d3bd37 100644 --- a/src/main/java/com/bawnorton/randoassistant/util/LootAdvancement.java +++ b/src/main/java/com/bawnorton/randoassistant/util/LootAdvancement.java @@ -1,6 +1,10 @@ package com.bawnorton.randoassistant.util; import com.bawnorton.randoassistant.RandoAssistant; +import net.minecraft.advancement.Advancement; +import net.minecraft.advancement.AdvancementProgress; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.util.Identifier; public enum LootAdvancement { @@ -14,7 +18,10 @@ public enum LootAdvancement { ALL_OTHER(new Identifier(RandoAssistant.MOD_ID, "all_other_loottables")), CAT_MORNING_GIFT(new Identifier(RandoAssistant.MOD_ID, "cat_morning_gift")), SHAME(new Identifier(RandoAssistant.MOD_ID, "shame")), - WOB(new Identifier(RandoAssistant.MOD_ID, "wob")); + MONSTER(new Identifier(RandoAssistant.MOD_ID, "monster")), + ORPHANED_POLAR_BEAR(new Identifier(RandoAssistant.MOD_ID, "orphaned_polar_bear")), + WOB(new Identifier(RandoAssistant.MOD_ID, "wob")), + CANDLES(new Identifier(RandoAssistant.MOD_ID, "candles")); private final Identifier id; @@ -29,4 +36,19 @@ public Identifier id() { public static LootAdvancement fromOrdinal(int ordinal) { return LootAdvancement.values()[ordinal]; } + + public void grant(ServerPlayerEntity serverPlayer) { + MinecraftServer server = serverPlayer.getServer(); + if(server == null) return; + + Advancement advancement = server.getAdvancementLoader().get(id()); + if(advancement == null) return; + + AdvancementProgress progress = serverPlayer.getAdvancementTracker().getProgress(advancement); + if(progress.isDone()) return; + + for(String criterion : progress.getUnobtainedCriteria()) { + serverPlayer.getAdvancementTracker().grantCriterion(advancement, criterion); + } + } } diff --git a/src/main/resources/data/randoassistant/advancements/all_entity_loottables.json b/src/main/resources/data/randoassistant/advancements/all_entity_loottables.json index 60653df..dacd870 100644 --- a/src/main/resources/data/randoassistant/advancements/all_entity_loottables.json +++ b/src/main/resources/data/randoassistant/advancements/all_entity_loottables.json @@ -10,7 +10,7 @@ "announce_to_chat": true, "hidden": false }, - "parent": "fasguys_toolbox:loot_table_randomizer/main", + "parent": "randoassistant:monster", "criteria": { "requirement": { "trigger": "minecraft:impossible" diff --git a/src/main/resources/data/randoassistant/advancements/candles.json b/src/main/resources/data/randoassistant/advancements/candles.json new file mode 100644 index 0000000..7a1cfd7 --- /dev/null +++ b/src/main/resources/data/randoassistant/advancements/candles.json @@ -0,0 +1,20 @@ +{ + "display": { + "icon": { + "item": "minecraft:candle" + }, + "title": "I Didn't Wax For This", + "description": "Broke every candle in the game.", + "frame": "challenge", + "show_toast": true, + "announce_to_chat": true, + "hidden": true + }, + "parent": "fasguys_toolbox:loot_table_randomizer/main", + "criteria": { + "requirement": { + "trigger": "minecraft:impossible" + } + } +} + diff --git a/src/main/resources/data/randoassistant/advancements/monster.json b/src/main/resources/data/randoassistant/advancements/monster.json new file mode 100644 index 0000000..ad3e60d --- /dev/null +++ b/src/main/resources/data/randoassistant/advancements/monster.json @@ -0,0 +1,19 @@ +{ + "display": { + "icon": { + "item": "minecraft:skeleton_skull" + }, + "title": "How Could You!?", + "description": "It was so innocent. Was it even worth it?", + "frame": "task", + "show_toast": true, + "announce_to_chat": true, + "hidden": true + }, + "parent": "fasguys_toolbox:loot_table_randomizer/main", + "criteria": { + "requirement": { + "trigger": "minecraft:impossible" + } + } +} diff --git a/src/main/resources/data/randoassistant/advancements/orphaned_polar_bear.json b/src/main/resources/data/randoassistant/advancements/orphaned_polar_bear.json new file mode 100644 index 0000000..7f9b31f --- /dev/null +++ b/src/main/resources/data/randoassistant/advancements/orphaned_polar_bear.json @@ -0,0 +1,19 @@ +{ + "display": { + "icon": { + "item": "minecraft:cod" + }, + "title": "It Had a Child", + "description": "What are you gonna do with the cub now?", + "frame": "task", + "show_toast": true, + "announce_to_chat": true, + "hidden": true + }, + "parent": "fasguys_toolbox:loot_table_randomizer/main", + "criteria": { + "requirement": { + "trigger": "minecraft:impossible" + } + } +} diff --git a/src/main/resources/data/randoassistant/advancements/wob.json b/src/main/resources/data/randoassistant/advancements/wob.json index d6d039e..5b4af5b 100644 --- a/src/main/resources/data/randoassistant/advancements/wob.json +++ b/src/main/resources/data/randoassistant/advancements/wob.json @@ -17,3 +17,4 @@ } } } + diff --git a/src/main/resources/randoassistant.accesswidener b/src/main/resources/randoassistant.accesswidener index f260fac..bbc106e 100644 --- a/src/main/resources/randoassistant.accesswidener +++ b/src/main/resources/randoassistant.accesswidener @@ -2,4 +2,8 @@ accessWidener v2 named accessible field net/minecraft/item/AxeItem STRIPPED_BLOCKS Ljava/util/Map; accessible field net/minecraft/client/gui/screen/ingame/HandledScreen y I accessible field net/minecraft/client/gui/screen/ingame/HandledScreen x I -accessible class net/minecraft/entity/passive/CatEntity$SleepWithOwnerGoal \ No newline at end of file +accessible class net/minecraft/entity/passive/CatEntity$SleepWithOwnerGoal +accessible field net/minecraft/text/TranslatableTextContent key Ljava/lang/String; +accessible field net/minecraft/text/TranslatableTextContent fallback Ljava/lang/String; +mutable field net/minecraft/text/TranslatableTextContent key Ljava/lang/String; +mutable field net/minecraft/text/TranslatableTextContent fallback Ljava/lang/String; \ No newline at end of file