From 64216992e960889ee99e6d6df44c4f8f9c7e8a62 Mon Sep 17 00:00:00 2001 From: IThundxr Date: Wed, 8 Nov 2023 16:24:56 -0500 Subject: [PATCH] whoopies forgot that --- .../tools/module/PathfinderMapsModule.java | 69 +++++++--------- .../event/play/loading/ZWandererTrades.java | 11 +++ .../violetmoon/zetaimplforge/ForgeZeta.java | 81 ++++--------------- .../play/loading/ForgeZWandererTrades.java | 26 ++++++ 4 files changed, 85 insertions(+), 102 deletions(-) create mode 100644 src/main/java/org/violetmoon/zeta/event/play/loading/ZWandererTrades.java create mode 100644 src/main/java/org/violetmoon/zetaimplforge/event/play/loading/ForgeZWandererTrades.java diff --git a/src/main/java/org/violetmoon/quark/content/tools/module/PathfinderMapsModule.java b/src/main/java/org/violetmoon/quark/content/tools/module/PathfinderMapsModule.java index d0ab4753e5..46c54c1270 100644 --- a/src/main/java/org/violetmoon/quark/content/tools/module/PathfinderMapsModule.java +++ b/src/main/java/org/violetmoon/quark/content/tools/module/PathfinderMapsModule.java @@ -1,38 +1,7 @@ package org.violetmoon.quark.content.tools.module; -import java.util.LinkedList; -import java.util.List; -import java.util.function.Predicate; -import java.util.stream.Collectors; - -import javax.annotation.Nonnull; - -import org.violetmoon.quark.base.Quark; -import org.violetmoon.quark.base.QuarkClient; -import org.violetmoon.quark.base.config.Config; -import org.violetmoon.quark.base.config.type.IConfigType; -import org.violetmoon.quark.base.handler.advancement.QuarkAdvancementHandler; -import org.violetmoon.quark.base.handler.advancement.QuarkGenericTrigger; -import org.violetmoon.quark.content.tools.item.PathfindersQuillItem; -import org.violetmoon.quark.content.tools.loot.InBiomeCondition; -import org.violetmoon.zeta.client.event.load.ZAddItemColorHandlers; -import org.violetmoon.zeta.client.event.load.ZClientSetup; -import org.violetmoon.zeta.client.event.play.ZRenderGuiOverlay; -import org.violetmoon.zeta.event.bus.LoadEvent; -import org.violetmoon.zeta.event.bus.PlayEvent; -import org.violetmoon.zeta.event.load.ZConfigChanged; -import org.violetmoon.zeta.event.load.ZRegister; -import org.violetmoon.zeta.event.play.entity.living.ZLivingTick; -import org.violetmoon.zeta.event.play.entity.player.ZPlayerTick; -import org.violetmoon.zeta.event.play.loading.ZVillagerTrades; -import org.violetmoon.zeta.module.ZetaLoadModule; -import org.violetmoon.zeta.module.ZetaModule; -import org.violetmoon.zeta.util.Hint; -import org.violetmoon.zeta.util.ItemNBTHelper; - import com.mojang.blaze3d.platform.Window; import com.mojang.blaze3d.vertex.PoseStack; - import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import net.minecraft.client.Minecraft; import net.minecraft.client.color.item.ItemColor; @@ -62,10 +31,35 @@ import net.minecraft.world.level.storage.loot.functions.LootItemFunctionType; import net.minecraft.world.level.storage.loot.predicates.LootItemConditionType; import net.minecraft.world.phys.Vec3; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.event.village.WandererTradesEvent; -import net.minecraftforge.eventbus.api.SubscribeEvent; +import org.violetmoon.quark.base.Quark; +import org.violetmoon.quark.base.QuarkClient; +import org.violetmoon.quark.base.config.Config; +import org.violetmoon.quark.base.config.type.IConfigType; +import org.violetmoon.quark.base.handler.advancement.QuarkAdvancementHandler; +import org.violetmoon.quark.base.handler.advancement.QuarkGenericTrigger; +import org.violetmoon.quark.content.tools.item.PathfindersQuillItem; +import org.violetmoon.quark.content.tools.loot.InBiomeCondition; +import org.violetmoon.zeta.client.event.load.ZAddItemColorHandlers; +import org.violetmoon.zeta.client.event.load.ZClientSetup; +import org.violetmoon.zeta.client.event.play.ZRenderGuiOverlay; +import org.violetmoon.zeta.event.bus.LoadEvent; +import org.violetmoon.zeta.event.bus.PlayEvent; +import org.violetmoon.zeta.event.load.ZConfigChanged; +import org.violetmoon.zeta.event.load.ZRegister; +import org.violetmoon.zeta.event.play.entity.living.ZLivingTick; +import org.violetmoon.zeta.event.play.entity.player.ZPlayerTick; +import org.violetmoon.zeta.event.play.loading.ZVillagerTrades; +import org.violetmoon.zeta.event.play.loading.ZWandererTrades; +import org.violetmoon.zeta.module.ZetaLoadModule; +import org.violetmoon.zeta.module.ZetaModule; +import org.violetmoon.zeta.util.Hint; +import org.violetmoon.zeta.util.ItemNBTHelper; + +import javax.annotation.Nonnull; +import java.util.LinkedList; +import java.util.List; +import java.util.function.Predicate; +import java.util.stream.Collectors; @ZetaLoadModule(category = "tools") public class PathfinderMapsModule extends ZetaModule { @@ -162,9 +156,8 @@ public void onTradesLoaded(ZVillagerTrades event) { } } - //fixme Port - @SubscribeEvent - public void onWandererTradesLoaded(WandererTradesEvent event) { + @PlayEvent + public void onWandererTradesLoaded(ZWandererTrades event) { if(!addToWanderingTraderForced && (addToWanderingTraderGeneric || addToWanderingTraderRare)) synchronized (mutex) { if(!tradeList.isEmpty()) { diff --git a/src/main/java/org/violetmoon/zeta/event/play/loading/ZWandererTrades.java b/src/main/java/org/violetmoon/zeta/event/play/loading/ZWandererTrades.java new file mode 100644 index 0000000000..049bd0677c --- /dev/null +++ b/src/main/java/org/violetmoon/zeta/event/play/loading/ZWandererTrades.java @@ -0,0 +1,11 @@ +package org.violetmoon.zeta.event.play.loading; + +import net.minecraft.world.entity.npc.VillagerTrades; +import org.violetmoon.zeta.event.bus.IZetaPlayEvent; + +import java.util.List; + +public interface ZWandererTrades extends IZetaPlayEvent { + List getGenericTrades(); + List getRareTrades(); +} diff --git a/src/main/java/org/violetmoon/zetaimplforge/ForgeZeta.java b/src/main/java/org/violetmoon/zetaimplforge/ForgeZeta.java index e9bfe10902..62745c9db7 100644 --- a/src/main/java/org/violetmoon/zetaimplforge/ForgeZeta.java +++ b/src/main/java/org/violetmoon/zetaimplforge/ForgeZeta.java @@ -16,6 +16,7 @@ import net.minecraftforge.event.level.BlockEvent; import net.minecraftforge.event.level.NoteBlockEvent; import net.minecraftforge.event.village.VillagerTradesEvent; +import net.minecraftforge.event.village.WandererTradesEvent; import net.minecraftforge.eventbus.api.Event; import net.minecraftforge.eventbus.api.EventPriority; import net.minecraftforge.eventbus.api.IEventBus; @@ -32,45 +33,16 @@ import org.violetmoon.zeta.capability.ZetaCapabilityManager; import org.violetmoon.zeta.config.IZetaConfigInternals; import org.violetmoon.zeta.config.SectionDefinition; -import org.violetmoon.zeta.event.*; import org.violetmoon.zeta.event.bus.ZResult; -import org.violetmoon.zeta.event.load.ZAddReloadListener; -import org.violetmoon.zeta.event.load.ZCommonSetup; -import org.violetmoon.zeta.event.load.ZEntityAttributeCreation; -import org.violetmoon.zeta.event.load.ZLoadComplete; -import org.violetmoon.zeta.event.load.ZRegister; -import org.violetmoon.zeta.event.load.ZTagsUpdated; -import org.violetmoon.zeta.event.play.ZAnvilRepair; -import org.violetmoon.zeta.event.play.ZAnvilUpdate; -import org.violetmoon.zeta.event.play.ZBlock; -import org.violetmoon.zeta.event.play.ZBonemeal; -import org.violetmoon.zeta.event.play.ZLevelTick; -import org.violetmoon.zeta.event.play.ZPlayNoteBlock; -import org.violetmoon.zeta.event.play.entity.ZEntityConstruct; -import org.violetmoon.zeta.event.play.entity.ZEntityInteract; -import org.violetmoon.zeta.event.play.entity.ZEntityItemPickup; -import org.violetmoon.zeta.event.play.entity.ZEntityJoinLevel; -import org.violetmoon.zeta.event.play.entity.ZEntityMobGriefing; -import org.violetmoon.zeta.event.play.entity.ZEntityTeleport; -import org.violetmoon.zeta.event.play.entity.living.ZAnimalTame; -import org.violetmoon.zeta.event.play.entity.living.ZBabyEntitySpawn; -import org.violetmoon.zeta.event.play.entity.living.ZLivingChangeTarget; -import org.violetmoon.zeta.event.play.entity.living.ZLivingConversion; -import org.violetmoon.zeta.event.play.entity.living.ZLivingDeath; -import org.violetmoon.zeta.event.play.entity.living.ZLivingDrops; -import org.violetmoon.zeta.event.play.entity.living.ZLivingFall; -import org.violetmoon.zeta.event.play.entity.living.ZLivingSpawn; -import org.violetmoon.zeta.event.play.entity.living.ZLivingTick; -import org.violetmoon.zeta.event.play.entity.living.ZSleepingLocationCheck; -import org.violetmoon.zeta.event.play.entity.player.ZPlayer; -import org.violetmoon.zeta.event.play.entity.player.ZPlayerDestroyItem; -import org.violetmoon.zeta.event.play.entity.player.ZPlayerInteract; -import org.violetmoon.zeta.event.play.entity.player.ZPlayerTick; -import org.violetmoon.zeta.event.play.entity.player.ZRightClickBlock; -import org.violetmoon.zeta.event.play.entity.player.ZRightClickItem; +import org.violetmoon.zeta.event.load.*; +import org.violetmoon.zeta.event.play.*; +import org.violetmoon.zeta.event.play.entity.*; +import org.violetmoon.zeta.event.play.entity.living.*; +import org.violetmoon.zeta.event.play.entity.player.*; import org.violetmoon.zeta.event.play.loading.ZAttachCapabilities; import org.violetmoon.zeta.event.play.loading.ZLootTableLoad; import org.violetmoon.zeta.event.play.loading.ZVillagerTrades; +import org.violetmoon.zeta.event.play.loading.ZWandererTrades; import org.violetmoon.zeta.item.ext.ItemExtensionFactory; import org.violetmoon.zeta.network.ZetaNetworkHandler; import org.violetmoon.zeta.registry.BrewingRegistry; @@ -81,42 +53,18 @@ import org.violetmoon.zetaimplforge.capability.ForgeCapabilityManager; import org.violetmoon.zetaimplforge.config.ForgeBackedConfig; import org.violetmoon.zetaimplforge.config.TerribleForgeConfigHackery; -import org.violetmoon.zetaimplforge.event.*; import org.violetmoon.zetaimplforge.event.load.ForgeZAddReloadListener; import org.violetmoon.zetaimplforge.event.load.ForgeZCommonSetup; import org.violetmoon.zetaimplforge.event.load.ForgeZEntityAttributeCreation; import org.violetmoon.zetaimplforge.event.load.ForgeZLoadComplete; -import org.violetmoon.zetaimplforge.event.play.ForgeZAnvilRepair; -import org.violetmoon.zetaimplforge.event.play.ForgeZAnvilUpdate; -import org.violetmoon.zetaimplforge.event.play.ForgeZBlock; -import org.violetmoon.zetaimplforge.event.play.ForgeZBonemeal; -import org.violetmoon.zetaimplforge.event.play.ForgeZLevelTick; -import org.violetmoon.zetaimplforge.event.play.ForgeZPlayNoteBlock; -import org.violetmoon.zetaimplforge.event.play.entity.ForgeZEntityConstruct; -import org.violetmoon.zetaimplforge.event.play.entity.ForgeZEntityInteract; -import org.violetmoon.zetaimplforge.event.play.entity.ForgeZEntityItemPickup; -import org.violetmoon.zetaimplforge.event.play.entity.ForgeZEntityJoinLevel; -import org.violetmoon.zetaimplforge.event.play.entity.ForgeZEntityMobGriefing; -import org.violetmoon.zetaimplforge.event.play.entity.ForgeZEntityTeleport; -import org.violetmoon.zetaimplforge.event.play.entity.living.ForgeZAnimalTame; -import org.violetmoon.zetaimplforge.event.play.entity.living.ForgeZBabyEntitySpawn; -import org.violetmoon.zetaimplforge.event.play.entity.living.ForgeZLivingChangeTarget; -import org.violetmoon.zetaimplforge.event.play.entity.living.ForgeZLivingConversion; -import org.violetmoon.zetaimplforge.event.play.entity.living.ForgeZLivingDeath; -import org.violetmoon.zetaimplforge.event.play.entity.living.ForgeZLivingDrops; -import org.violetmoon.zetaimplforge.event.play.entity.living.ForgeZLivingFall; -import org.violetmoon.zetaimplforge.event.play.entity.living.ForgeZLivingSpawn; -import org.violetmoon.zetaimplforge.event.play.entity.living.ForgeZLivingTick; -import org.violetmoon.zetaimplforge.event.play.entity.living.ForgeZSleepingLocationCheck; -import org.violetmoon.zetaimplforge.event.play.entity.player.ForgeZPlayer; -import org.violetmoon.zetaimplforge.event.play.entity.player.ForgeZPlayerDestroyItem; -import org.violetmoon.zetaimplforge.event.play.entity.player.ForgeZPlayerInteract; -import org.violetmoon.zetaimplforge.event.play.entity.player.ForgeZPlayerTick; -import org.violetmoon.zetaimplforge.event.play.entity.player.ForgeZRightClickBlock; -import org.violetmoon.zetaimplforge.event.play.entity.player.ForgeZRightClickItem; +import org.violetmoon.zetaimplforge.event.play.*; +import org.violetmoon.zetaimplforge.event.play.entity.*; +import org.violetmoon.zetaimplforge.event.play.entity.living.*; +import org.violetmoon.zetaimplforge.event.play.entity.player.*; import org.violetmoon.zetaimplforge.event.play.loading.ForgeZAttachCapabilities; import org.violetmoon.zetaimplforge.event.play.loading.ForgeZLootTableLoad; import org.violetmoon.zetaimplforge.event.play.loading.ForgeZVillagerTrades; +import org.violetmoon.zetaimplforge.event.play.loading.ForgeZWandererTrades; import org.violetmoon.zetaimplforge.item.IForgeItemItemExtensions; import org.violetmoon.zetaimplforge.network.ForgeZetaNetworkHandler; import org.violetmoon.zetaimplforge.registry.ForgeBrewingRegistry; @@ -265,6 +213,7 @@ public void start() { MinecraftForge.EVENT_BUS.addListener(this::bonemeal); MinecraftForge.EVENT_BUS.addListener(this::entityTeleport); MinecraftForge.EVENT_BUS.addListener(this::livingFall); + MinecraftForge.EVENT_BUS.addListener(this::wandererTrades); } boolean registerDone = false; @@ -519,6 +468,10 @@ public void livingFall(LivingFallEvent e) { playBus.fire(new ForgeZLivingFall(e), ZLivingFall.class); } + public void wandererTrades(WandererTradesEvent e) { + playBus.fire(new ForgeZWandererTrades(e), ZWandererTrades.class); + } + public static ZResult from(Event.Result r) { return switch(r) { case DENY -> ZResult.DENY; diff --git a/src/main/java/org/violetmoon/zetaimplforge/event/play/loading/ForgeZWandererTrades.java b/src/main/java/org/violetmoon/zetaimplforge/event/play/loading/ForgeZWandererTrades.java new file mode 100644 index 0000000000..3ae0f81eb5 --- /dev/null +++ b/src/main/java/org/violetmoon/zetaimplforge/event/play/loading/ForgeZWandererTrades.java @@ -0,0 +1,26 @@ +package org.violetmoon.zetaimplforge.event.play.loading; + +import net.minecraft.world.entity.npc.VillagerTrades; +import net.minecraftforge.event.village.WandererTradesEvent; +import org.violetmoon.zeta.event.play.loading.ZWandererTrades; + +import java.util.List; + +public class ForgeZWandererTrades implements ZWandererTrades { + private final WandererTradesEvent e; + + public ForgeZWandererTrades(WandererTradesEvent e) { + this.e = e; + } + + + @Override + public List getGenericTrades() { + return e.getGenericTrades(); + } + + @Override + public List getRareTrades() { + return e.getRareTrades(); + } +}