Skip to content

Commit

Permalink
Merge pull request #4410 from IThundxr/zeta
Browse files Browse the repository at this point in the history
feat: Zeta
  • Loading branch information
quat1024 authored Nov 9, 2023
2 parents 7d655d5 + d8a8e0d commit 96ec900
Show file tree
Hide file tree
Showing 25 changed files with 191 additions and 204 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import org.violetmoon.quark.base.handler.advancement.QuarkAdvancementHandler;
import org.violetmoon.quark.base.handler.advancement.QuarkGenericTrigger;
import org.violetmoon.zeta.client.event.load.ZClientSetup;
import org.violetmoon.zeta.event.*;
import org.violetmoon.zeta.event.bus.LoadEvent;
import org.violetmoon.zeta.event.bus.PlayEvent;
import org.violetmoon.zeta.event.load.ZConfigChanged;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,17 @@
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.*;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.AddReloadListenerEvent;
import net.minecraftforge.event.TagsUpdatedEvent;
import net.minecraftforge.event.TickEvent.ServerTickEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;

import javax.annotation.Nullable;

import org.violetmoon.quark.api.event.RecipeCrawlEvent;
import org.violetmoon.quark.api.event.RecipeCrawlEvent.Visit;
import org.violetmoon.quark.base.Quark;
import org.violetmoon.zeta.event.bus.LoadEvent;
import org.violetmoon.zeta.event.bus.PlayEvent;
import org.violetmoon.zeta.event.load.ZAddReloadListener;
import org.violetmoon.zeta.event.load.ZTagsUpdated;
import org.violetmoon.zeta.event.play.ZServerTick;
import org.violetmoon.zeta.util.RegistryUtil;

import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
Expand Down Expand Up @@ -102,8 +98,8 @@ else if (recipe instanceof AbstractCookingRecipe acr)
}
}

@SubscribeEvent
public static void onTick(ServerTickEvent tick) {
@PlayEvent
public static void onTick(ZServerTick tick) {
synchronized(mutex) {
if(mayCrawl && needsCrawl) {
RecipeManager manager = tick.getServer().getRecipeManager();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,8 @@
package org.violetmoon.quark.base.handler;

import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import org.apache.commons.lang3.tuple.Pair;
import org.violetmoon.quark.base.handler.advancement.QuarkAdvancementHandler;
import org.violetmoon.quark.base.handler.advancement.mod.WaxModifier;
import org.violetmoon.zeta.event.bus.LoadEvent;
import org.violetmoon.zeta.event.bus.PlayEvent;
import org.violetmoon.zeta.event.load.ZCommonSetup;
import org.violetmoon.zeta.event.play.entity.player.ZRightClickBlock;
import org.violetmoon.zeta.module.ZetaModule;

import com.google.common.collect.HashBiMap;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;

import net.minecraft.advancements.CriteriaTriggers;
import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerPlayer;
Expand All @@ -32,8 +16,17 @@
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraftforge.common.ToolAction;
import net.minecraftforge.common.ToolActions;
import net.minecraftforge.event.level.BlockEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import org.apache.commons.lang3.tuple.Pair;
import org.violetmoon.quark.base.handler.advancement.QuarkAdvancementHandler;
import org.violetmoon.quark.base.handler.advancement.mod.WaxModifier;
import org.violetmoon.zeta.event.bus.LoadEvent;
import org.violetmoon.zeta.event.bus.PlayEvent;
import org.violetmoon.zeta.event.load.ZCommonSetup;
import org.violetmoon.zeta.event.play.ZBlock;
import org.violetmoon.zeta.event.play.entity.player.ZRightClickBlock;
import org.violetmoon.zeta.module.ZetaModule;

import java.util.*;

public final class ToolInteractionHandler {

Expand Down Expand Up @@ -73,8 +66,8 @@ public static void addModifiers(ZCommonSetup event) {
}
}

@SubscribeEvent
public static void toolActionEvent(BlockEvent.BlockToolModificationEvent event) {
@PlayEvent
public static void toolActionEvent(ZBlock.BlockToolModification event) {
ToolAction action = event.getToolAction();

if(interactionMaps.containsKey(action)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.structure.Structure;
import net.minecraftforge.common.Tags;

import javax.annotation.Nullable;

import org.violetmoon.quark.base.Quark;
import org.violetmoon.quark.base.config.Config;
import org.violetmoon.quark.base.handler.StructureBlockReplacementHandler;
Expand All @@ -44,7 +41,6 @@
import org.violetmoon.quark.mixin.accessor.AccessorAbstractChestedHorse;
import org.violetmoon.zeta.client.event.load.ZClientSetup;
import org.violetmoon.zeta.client.event.load.ZPreTextureStitch;
import org.violetmoon.zeta.event.*;
import org.violetmoon.zeta.event.bus.LoadEvent;
import org.violetmoon.zeta.event.bus.PlayEvent;
import org.violetmoon.zeta.event.load.ZConfigChanged;
Expand All @@ -57,6 +53,7 @@
import org.violetmoon.zeta.module.ZetaLoadModule;
import org.violetmoon.zeta.module.ZetaModule;

import javax.annotation.Nullable;
import java.util.*;
import java.util.function.BooleanSupplier;
import java.util.function.Consumer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import org.violetmoon.quark.base.handler.MiscUtil;
import org.violetmoon.quark.base.handler.SimilarBlockTypeHandler;
import org.violetmoon.quark.content.management.client.screen.widgets.MiniInventoryButton;
import org.violetmoon.zeta.client.event.*;
import org.violetmoon.zeta.client.event.load.ZClientSetup;
import org.violetmoon.zeta.client.event.play.ZRenderContainerScreen;
import org.violetmoon.zeta.client.event.play.ZScreen;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

import org.violetmoon.quark.base.Quark;
import org.violetmoon.quark.base.config.Config;
import org.violetmoon.zeta.event.*;
import org.violetmoon.zeta.event.bus.LoadEvent;
import org.violetmoon.zeta.event.bus.PlayEvent;
import org.violetmoon.zeta.event.bus.ZResult;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
import org.violetmoon.quark.content.experimental.client.tooltip.VariantsComponent;
import org.violetmoon.quark.content.experimental.config.BlockSuffixConfig;
import org.violetmoon.quark.content.experimental.item.HammerItem;
import org.violetmoon.zeta.client.event.*;
import org.violetmoon.zeta.client.event.load.ZKeyMapping;
import org.violetmoon.zeta.client.event.load.ZTooltipComponents;
import org.violetmoon.zeta.client.event.play.ZEndClientTick;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ public void onKeyInput(ZInput.Key event) {
acceptInput(event.getKey());
}

//fixme Needs splitting up
@PlayEvent
public void hudHeathPre(ZRenderGuiOverlay.PlayerHealth.Pre event) {
float shift = -getRealHeight(event.getPartialTick()) + 22;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
import org.violetmoon.quark.content.tools.item.AncientTomeItem;
import org.violetmoon.quark.content.tools.loot.EnchantTome;
import org.violetmoon.quark.content.world.module.MonsterBoxModule;
import org.violetmoon.zeta.event.*;
import org.violetmoon.zeta.event.bus.LoadEvent;
import org.violetmoon.zeta.event.bus.PlayEvent;
import org.violetmoon.zeta.event.load.ZCommonSetup;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import org.violetmoon.quark.base.network.message.UpdateTridentMessage;
import org.violetmoon.quark.content.tools.client.render.GlintRenderTypes;
import org.violetmoon.quark.content.tools.item.RuneItem;
import org.violetmoon.zeta.event.*;
import org.violetmoon.zeta.event.bus.LoadEvent;
import org.violetmoon.zeta.event.bus.PlayEvent;
import org.violetmoon.zeta.event.load.ZCommonSetup;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import org.violetmoon.quark.content.tools.entity.ParrotEgg;
import org.violetmoon.quark.content.tools.item.ParrotEggItem;
import org.violetmoon.zeta.client.event.load.ZClientSetup;
import org.violetmoon.zeta.event.*;
import org.violetmoon.zeta.event.bus.LoadEvent;
import org.violetmoon.zeta.event.bus.PlayEvent;
import org.violetmoon.zeta.event.load.ZCommonSetup;
Expand Down
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
Expand Up @@ -31,7 +31,6 @@
import org.violetmoon.quark.content.tweaks.client.emote.*;
import org.violetmoon.quark.content.tweaks.client.screen.widgets.EmoteButton;
import org.violetmoon.quark.content.tweaks.client.screen.widgets.TranslucentButton;
import org.violetmoon.zeta.client.event.*;
import org.violetmoon.zeta.client.event.load.ZClientSetup;
import org.violetmoon.zeta.client.event.load.ZKeyMapping;
import org.violetmoon.zeta.client.event.play.ZInput;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import net.minecraft.world.entity.LivingEntity;

//fixme Move this into a lifelong home & make other interfaces use this more
public interface LivingGetter {
LivingEntity getEntity();
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;

//fixme Move this into a lifelong home & make other interfaces use this more
public interface PlayerGetter extends LivingGetter {
default Player getPlayer() {
LivingEntity living = getEntity();
Expand Down
4 changes: 0 additions & 4 deletions src/main/java/org/violetmoon/zeta/event/bus/helpers/README.md

This file was deleted.

7 changes: 7 additions & 0 deletions src/main/java/org/violetmoon/zeta/event/play/ZBlock.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.violetmoon.zeta.event.play;

import net.minecraftforge.common.ToolAction;
import org.jetbrains.annotations.Nullable;
import org.violetmoon.zeta.event.bus.IZetaPlayEvent;

import net.minecraft.core.BlockPos;
Expand All @@ -19,4 +21,9 @@ interface Break extends ZBlock {
interface EntityPlace extends ZBlock {
BlockState getPlacedBlock();
}

interface BlockToolModification extends ZBlock {
ToolAction getToolAction();
void setFinalState(@Nullable BlockState finalState);
}
}
11 changes: 11 additions & 0 deletions src/main/java/org/violetmoon/zeta/event/play/ZServerTick.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.violetmoon.zeta.event.play;

import net.minecraft.server.MinecraftServer;
import org.violetmoon.zeta.event.bus.IZetaPlayEvent;

public interface ZServerTick extends IZetaPlayEvent {
MinecraftServer getServer();

interface Start extends ZServerTick { }
interface End extends ZServerTick { }
}
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();
}
Loading

0 comments on commit 96ec900

Please sign in to comment.