Skip to content

Commit

Permalink
whoopies forgot that
Browse files Browse the repository at this point in the history
  • Loading branch information
IThundxr committed Nov 8, 2023
1 parent 7d655d5 commit 6421699
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 102 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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<VillagerTrades.ItemListing> getGenericTrades();
List<VillagerTrades.ItemListing> getRareTrades();
}
81 changes: 17 additions & 64 deletions src/main/java/org/violetmoon/zetaimplforge/ForgeZeta.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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<VillagerTrades.ItemListing> getGenericTrades() {
return e.getGenericTrades();
}

@Override
public List<VillagerTrades.ItemListing> getRareTrades() {
return e.getRareTrades();
}
}

0 comments on commit 6421699

Please sign in to comment.