From 64216992e960889ee99e6d6df44c4f8f9c7e8a62 Mon Sep 17 00:00:00 2001 From: IThundxr Date: Wed, 8 Nov 2023 16:24:56 -0500 Subject: [PATCH 1/6] 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(); + } +} From a932d84d2b45315dfcb690b97e411f6b869fc690 Mon Sep 17 00:00:00 2001 From: IThundxr Date: Wed, 8 Nov 2023 16:36:00 -0500 Subject: [PATCH 2/6] subscribe event is kil --- .../module/MatrixEnchantingModule.java | 1 - .../base/handler/RecipeCrawlHandler.java | 14 ++--- .../base/handler/ToolInteractionHandler.java | 33 +++++------ .../building/module/VariantChestsModule.java | 5 +- .../experimental/module/GameNerfsModule.java | 1 - .../tools/module/AncientTomesModule.java | 1 - .../tools/module/ColorRunesModule.java | 1 - .../tools/module/ParrotEggsModule.java | 1 - .../violetmoon/zeta/event/play/ZBlock.java | 7 +++ .../zeta/event/play/ZServerTick.java | 11 ++++ .../violetmoon/zetaimplforge/ForgeZeta.java | 12 ++++ .../zetaimplforge/client/ForgeZetaClient.java | 58 ++----------------- .../zetaimplforge/event/play/ForgeZBlock.java | 21 +++++++ .../event/play/ForgeZServerTick.java | 30 ++++++++++ 14 files changed, 105 insertions(+), 91 deletions(-) create mode 100644 src/main/java/org/violetmoon/zeta/event/play/ZServerTick.java create mode 100644 src/main/java/org/violetmoon/zetaimplforge/event/play/ForgeZServerTick.java diff --git a/src/main/java/org/violetmoon/quark/addons/oddities/module/MatrixEnchantingModule.java b/src/main/java/org/violetmoon/quark/addons/oddities/module/MatrixEnchantingModule.java index 86c69482d2..2bc8f63f01 100644 --- a/src/main/java/org/violetmoon/quark/addons/oddities/module/MatrixEnchantingModule.java +++ b/src/main/java/org/violetmoon/quark/addons/oddities/module/MatrixEnchantingModule.java @@ -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; diff --git a/src/main/java/org/violetmoon/quark/base/handler/RecipeCrawlHandler.java b/src/main/java/org/violetmoon/quark/base/handler/RecipeCrawlHandler.java index 3b99b4c4ac..e172021511 100644 --- a/src/main/java/org/violetmoon/quark/base/handler/RecipeCrawlHandler.java +++ b/src/main/java/org/violetmoon/quark/base/handler/RecipeCrawlHandler.java @@ -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; @@ -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(); diff --git a/src/main/java/org/violetmoon/quark/base/handler/ToolInteractionHandler.java b/src/main/java/org/violetmoon/quark/base/handler/ToolInteractionHandler.java index 0975920a5f..b3472f8986 100644 --- a/src/main/java/org/violetmoon/quark/base/handler/ToolInteractionHandler.java +++ b/src/main/java/org/violetmoon/quark/base/handler/ToolInteractionHandler.java @@ -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; @@ -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 { @@ -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)) { diff --git a/src/main/java/org/violetmoon/quark/content/building/module/VariantChestsModule.java b/src/main/java/org/violetmoon/quark/content/building/module/VariantChestsModule.java index 4bcd3a096b..fe582bd0f8 100644 --- a/src/main/java/org/violetmoon/quark/content/building/module/VariantChestsModule.java +++ b/src/main/java/org/violetmoon/quark/content/building/module/VariantChestsModule.java @@ -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; @@ -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; @@ -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; diff --git a/src/main/java/org/violetmoon/quark/content/experimental/module/GameNerfsModule.java b/src/main/java/org/violetmoon/quark/content/experimental/module/GameNerfsModule.java index da43e549e6..b739cbb2d1 100644 --- a/src/main/java/org/violetmoon/quark/content/experimental/module/GameNerfsModule.java +++ b/src/main/java/org/violetmoon/quark/content/experimental/module/GameNerfsModule.java @@ -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; diff --git a/src/main/java/org/violetmoon/quark/content/tools/module/AncientTomesModule.java b/src/main/java/org/violetmoon/quark/content/tools/module/AncientTomesModule.java index 28c89c41d3..93d836ce6c 100644 --- a/src/main/java/org/violetmoon/quark/content/tools/module/AncientTomesModule.java +++ b/src/main/java/org/violetmoon/quark/content/tools/module/AncientTomesModule.java @@ -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; diff --git a/src/main/java/org/violetmoon/quark/content/tools/module/ColorRunesModule.java b/src/main/java/org/violetmoon/quark/content/tools/module/ColorRunesModule.java index 937bb5deff..23f0b0f529 100644 --- a/src/main/java/org/violetmoon/quark/content/tools/module/ColorRunesModule.java +++ b/src/main/java/org/violetmoon/quark/content/tools/module/ColorRunesModule.java @@ -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; diff --git a/src/main/java/org/violetmoon/quark/content/tools/module/ParrotEggsModule.java b/src/main/java/org/violetmoon/quark/content/tools/module/ParrotEggsModule.java index 59e102603d..e4eebc6887 100644 --- a/src/main/java/org/violetmoon/quark/content/tools/module/ParrotEggsModule.java +++ b/src/main/java/org/violetmoon/quark/content/tools/module/ParrotEggsModule.java @@ -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; diff --git a/src/main/java/org/violetmoon/zeta/event/play/ZBlock.java b/src/main/java/org/violetmoon/zeta/event/play/ZBlock.java index 9f5a454d9d..e15275a5cd 100644 --- a/src/main/java/org/violetmoon/zeta/event/play/ZBlock.java +++ b/src/main/java/org/violetmoon/zeta/event/play/ZBlock.java @@ -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; @@ -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); + } } diff --git a/src/main/java/org/violetmoon/zeta/event/play/ZServerTick.java b/src/main/java/org/violetmoon/zeta/event/play/ZServerTick.java new file mode 100644 index 0000000000..1a29505d52 --- /dev/null +++ b/src/main/java/org/violetmoon/zeta/event/play/ZServerTick.java @@ -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 { } +} diff --git a/src/main/java/org/violetmoon/zetaimplforge/ForgeZeta.java b/src/main/java/org/violetmoon/zetaimplforge/ForgeZeta.java index 62745c9db7..88d4551f5a 100644 --- a/src/main/java/org/violetmoon/zetaimplforge/ForgeZeta.java +++ b/src/main/java/org/violetmoon/zetaimplforge/ForgeZeta.java @@ -185,6 +185,8 @@ public void start() { MinecraftForge.EVENT_BUS.addGenericListener(BlockEntity.class, this::blockEntityCaps); MinecraftForge.EVENT_BUS.addGenericListener(Level.class, this::levelCaps); + MinecraftForge.EVENT_BUS.addListener(this::serverTickStart); + MinecraftForge.EVENT_BUS.addListener(this::serverTickEnd); MinecraftForge.EVENT_BUS.addListener(this::levelTickStart); MinecraftForge.EVENT_BUS.addListener(this::levelTickEnd); MinecraftForge.EVENT_BUS.addListener(this::playerInteract); @@ -353,6 +355,16 @@ public void levelCaps(AttachCapabilitiesEvent e) { playBus.fire(new ForgeZAttachCapabilities.LevelCaps(capabilityManager, e), ZAttachCapabilities.LevelCaps.class); } + public void serverTickStart(TickEvent.ServerTickEvent e) { + if (e.phase == TickEvent.Phase.START) + playBus.fire(new ForgeZServerTick.Start(e), ZServerTick.Start.class); + } + + public void serverTickEnd(TickEvent.ServerTickEvent e) { + if (e.phase == TickEvent.Phase.END) + playBus.fire(new ForgeZServerTick.End(e), ZServerTick.End.class); + } + public void levelTickStart(TickEvent.LevelTickEvent e) { if (e.phase == TickEvent.Phase.START) playBus.fire(new ForgeZLevelTick.Start(e), ZLevelTick.Start.class); diff --git a/src/main/java/org/violetmoon/zetaimplforge/client/ForgeZetaClient.java b/src/main/java/org/violetmoon/zetaimplforge/client/ForgeZetaClient.java index b16f6da3e0..d7f59856fd 100644 --- a/src/main/java/org/violetmoon/zetaimplforge/client/ForgeZetaClient.java +++ b/src/main/java/org/violetmoon/zetaimplforge/client/ForgeZetaClient.java @@ -6,6 +6,7 @@ import net.minecraft.client.color.item.ItemColors; import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.block.Block; +import net.minecraftforge.client.event.*; import net.minecraftforge.client.gui.overlay.VanillaGuiOverlay; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.TickEvent; @@ -18,62 +19,13 @@ import org.violetmoon.zeta.Zeta; import org.violetmoon.zeta.client.ClientRegistryExtension; import org.violetmoon.zeta.client.ZetaClient; -import org.violetmoon.zeta.client.event.*; -import org.violetmoon.zeta.client.event.load.ZAddBlockColorHandlers; -import org.violetmoon.zeta.client.event.load.ZAddItemColorHandlers; -import org.violetmoon.zeta.client.event.load.ZAddModelLayers; -import org.violetmoon.zeta.client.event.load.ZAddModels; -import org.violetmoon.zeta.client.event.load.ZClientSetup; -import org.violetmoon.zeta.client.event.load.ZKeyMapping; -import org.violetmoon.zeta.client.event.load.ZModelBakingCompleted; -import org.violetmoon.zeta.client.event.load.ZPreTextureStitch; -import org.violetmoon.zeta.client.event.load.ZRegisterLayerDefinitions; -import org.violetmoon.zeta.client.event.load.ZRegisterReloadListeners; -import org.violetmoon.zeta.client.event.load.ZTooltipComponents; -import org.violetmoon.zeta.client.event.play.ZCustomizeDebugText; -import org.violetmoon.zeta.client.event.play.ZEndClientTick; -import org.violetmoon.zeta.client.event.play.ZFirstClientTick; -import org.violetmoon.zeta.client.event.play.ZGatherTooltipComponents; -import org.violetmoon.zeta.client.event.play.ZHighlightBlock; -import org.violetmoon.zeta.client.event.play.ZInput; -import org.violetmoon.zeta.client.event.play.ZInputUpdate; -import org.violetmoon.zeta.client.event.play.ZRenderContainerScreen; -import org.violetmoon.zeta.client.event.play.ZRenderGuiOverlay; -import org.violetmoon.zeta.client.event.play.ZRenderLiving; -import org.violetmoon.zeta.client.event.play.ZRenderPlayer; -import org.violetmoon.zeta.client.event.play.ZRenderTick; -import org.violetmoon.zeta.client.event.play.ZRenderTooltip; -import org.violetmoon.zeta.client.event.play.ZScreen; -import org.violetmoon.zeta.client.event.play.ZScreenshot; -import org.violetmoon.zeta.client.event.play.ZStartClientTick; -import org.violetmoon.zetaimplforge.client.event.*; -import org.violetmoon.zetaimplforge.client.event.load.ForgeZAddBlockColorHandlers; -import org.violetmoon.zetaimplforge.client.event.load.ForgeZAddItemColorHandlers; -import org.violetmoon.zetaimplforge.client.event.load.ForgeZAddModelLayers; -import org.violetmoon.zetaimplforge.client.event.load.ForgeZAddModels; -import org.violetmoon.zetaimplforge.client.event.load.ForgeZClientSetup; -import org.violetmoon.zetaimplforge.client.event.load.ForgeZKeyMapping; -import org.violetmoon.zetaimplforge.client.event.load.ForgeZModelBakingCompleted; -import org.violetmoon.zetaimplforge.client.event.load.ForgeZPreTextureStitch; -import org.violetmoon.zetaimplforge.client.event.load.ForgeZRegisterLayerDefinitions; -import org.violetmoon.zetaimplforge.client.event.load.ForgeZTooltipComponents; -import org.violetmoon.zetaimplforge.client.event.player.ForgeZCustomizeDebugText; -import org.violetmoon.zetaimplforge.client.event.player.ForgeZGatherTooltipComponents; -import org.violetmoon.zetaimplforge.client.event.player.ForgeZHighlightBlock; -import org.violetmoon.zetaimplforge.client.event.player.ForgeZInput; -import org.violetmoon.zetaimplforge.client.event.player.ForgeZInputUpdate; -import org.violetmoon.zetaimplforge.client.event.player.ForgeZRenderContainerScreen; -import org.violetmoon.zetaimplforge.client.event.player.ForgeZRenderGuiOverlay; -import org.violetmoon.zetaimplforge.client.event.player.ForgeZRenderLiving; -import org.violetmoon.zetaimplforge.client.event.player.ForgeZRenderPlayer; -import org.violetmoon.zetaimplforge.client.event.player.ForgeZRenderTick; -import org.violetmoon.zetaimplforge.client.event.player.ForgeZRenderTooltip; -import org.violetmoon.zetaimplforge.client.event.player.ForgeZScreen; +import org.violetmoon.zeta.client.event.load.*; +import org.violetmoon.zeta.client.event.play.*; +import org.violetmoon.zetaimplforge.client.event.load.*; +import org.violetmoon.zetaimplforge.client.event.player.*; import org.violetmoon.zetaimplforge.mixin.client.AccessorBlockColors; import org.violetmoon.zetaimplforge.mixin.client.AccessorItemColors; -import net.minecraftforge.client.event.*; - public class ForgeZetaClient extends ZetaClient { public ForgeZetaClient(Zeta z) { super(z); diff --git a/src/main/java/org/violetmoon/zetaimplforge/event/play/ForgeZBlock.java b/src/main/java/org/violetmoon/zetaimplforge/event/play/ForgeZBlock.java index d8c4f16a30..7aff8bd00a 100644 --- a/src/main/java/org/violetmoon/zetaimplforge/event/play/ForgeZBlock.java +++ b/src/main/java/org/violetmoon/zetaimplforge/event/play/ForgeZBlock.java @@ -1,5 +1,7 @@ package org.violetmoon.zetaimplforge.event.play; +import net.minecraftforge.common.ToolAction; +import org.jetbrains.annotations.Nullable; import org.violetmoon.zeta.event.play.ZBlock; import net.minecraft.core.BlockPos; @@ -57,4 +59,23 @@ public BlockState getPlacedBlock() { return e.getPlacedBlock(); } } + + public static class BlockToolModification extends ForgeZBlock implements ZBlock.BlockToolModification { + private final BlockEvent.BlockToolModificationEvent e; + + public BlockToolModification(BlockEvent.BlockToolModificationEvent e) { + super(e); + this.e = e; + } + + @Override + public ToolAction getToolAction() { + return e.getToolAction(); + } + + @Override + public void setFinalState(@Nullable BlockState finalState) { + e.setFinalState(finalState); + } + } } diff --git a/src/main/java/org/violetmoon/zetaimplforge/event/play/ForgeZServerTick.java b/src/main/java/org/violetmoon/zetaimplforge/event/play/ForgeZServerTick.java new file mode 100644 index 0000000000..bdbafc2fdf --- /dev/null +++ b/src/main/java/org/violetmoon/zetaimplforge/event/play/ForgeZServerTick.java @@ -0,0 +1,30 @@ +package org.violetmoon.zetaimplforge.event.play; + +import net.minecraft.server.MinecraftServer; +import net.minecraftforge.event.TickEvent; +import org.violetmoon.zeta.event.play.ZServerTick; + +public class ForgeZServerTick implements ZServerTick { + private final TickEvent.ServerTickEvent e; + + public ForgeZServerTick(TickEvent.ServerTickEvent e) { + this.e = e; + } + + @Override + public MinecraftServer getServer() { + return e.getServer(); + } + + public static class Start extends ForgeZServerTick implements ZServerTick.Start { + public Start(TickEvent.ServerTickEvent e) { + super(e); + } + } + + public static class End extends ForgeZServerTick implements ZServerTick.End { + public End(TickEvent.ServerTickEvent e) { + super(e); + } + } +} From 79c679b9fa3e0ea5baead0a4a8d7f7f4daacb49c Mon Sep 17 00:00:00 2001 From: IThundxr Date: Wed, 8 Nov 2023 16:57:05 -0500 Subject: [PATCH 3/6] fix build --- .../quark/content/client/module/ChestSearchingModule.java | 1 - .../quark/content/experimental/module/VariantSelectorModule.java | 1 - .../org/violetmoon/quark/content/tweaks/module/EmotesModule.java | 1 - 3 files changed, 3 deletions(-) diff --git a/src/main/java/org/violetmoon/quark/content/client/module/ChestSearchingModule.java b/src/main/java/org/violetmoon/quark/content/client/module/ChestSearchingModule.java index 1649b5f98b..5df725af4e 100644 --- a/src/main/java/org/violetmoon/quark/content/client/module/ChestSearchingModule.java +++ b/src/main/java/org/violetmoon/quark/content/client/module/ChestSearchingModule.java @@ -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; diff --git a/src/main/java/org/violetmoon/quark/content/experimental/module/VariantSelectorModule.java b/src/main/java/org/violetmoon/quark/content/experimental/module/VariantSelectorModule.java index af8768314c..1dd40a40c8 100644 --- a/src/main/java/org/violetmoon/quark/content/experimental/module/VariantSelectorModule.java +++ b/src/main/java/org/violetmoon/quark/content/experimental/module/VariantSelectorModule.java @@ -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; diff --git a/src/main/java/org/violetmoon/quark/content/tweaks/module/EmotesModule.java b/src/main/java/org/violetmoon/quark/content/tweaks/module/EmotesModule.java index cd80ab75f2..511f9b02e5 100644 --- a/src/main/java/org/violetmoon/quark/content/tweaks/module/EmotesModule.java +++ b/src/main/java/org/violetmoon/quark/content/tweaks/module/EmotesModule.java @@ -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; From fe6a42d454a9b7e444be1004b777edff4dba1067 Mon Sep 17 00:00:00 2001 From: IThundxr Date: Wed, 8 Nov 2023 17:38:34 -0500 Subject: [PATCH 4/6] cleanup --- .../module/HotbarChangerModule.java | 1 - .../zeta/event/bus/helpers/LivingGetter.java | 1 - .../zeta/event/bus/helpers/PlayerGetter.java | 1 - .../zeta/event/bus/helpers/README.md | 4 --- .../org/violetmoon/zeta/temp/EnvType.java | 31 +++++++++++++++++++ .../org/violetmoon/zeta/temp/Environment.java | 27 ++++++++++++++++ 6 files changed, 58 insertions(+), 7 deletions(-) delete mode 100644 src/main/java/org/violetmoon/zeta/event/bus/helpers/README.md create mode 100644 src/main/java/org/violetmoon/zeta/temp/EnvType.java create mode 100644 src/main/java/org/violetmoon/zeta/temp/Environment.java diff --git a/src/main/java/org/violetmoon/quark/content/management/module/HotbarChangerModule.java b/src/main/java/org/violetmoon/quark/content/management/module/HotbarChangerModule.java index 786db668b0..3aa1246764 100644 --- a/src/main/java/org/violetmoon/quark/content/management/module/HotbarChangerModule.java +++ b/src/main/java/org/violetmoon/quark/content/management/module/HotbarChangerModule.java @@ -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; diff --git a/src/main/java/org/violetmoon/zeta/event/bus/helpers/LivingGetter.java b/src/main/java/org/violetmoon/zeta/event/bus/helpers/LivingGetter.java index 612904fc2b..ff12a62f76 100644 --- a/src/main/java/org/violetmoon/zeta/event/bus/helpers/LivingGetter.java +++ b/src/main/java/org/violetmoon/zeta/event/bus/helpers/LivingGetter.java @@ -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(); } diff --git a/src/main/java/org/violetmoon/zeta/event/bus/helpers/PlayerGetter.java b/src/main/java/org/violetmoon/zeta/event/bus/helpers/PlayerGetter.java index a40a5a2239..e30bda39b3 100644 --- a/src/main/java/org/violetmoon/zeta/event/bus/helpers/PlayerGetter.java +++ b/src/main/java/org/violetmoon/zeta/event/bus/helpers/PlayerGetter.java @@ -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(); diff --git a/src/main/java/org/violetmoon/zeta/event/bus/helpers/README.md b/src/main/java/org/violetmoon/zeta/event/bus/helpers/README.md deleted file mode 100644 index ef2e1099b2..0000000000 --- a/src/main/java/org/violetmoon/zeta/event/bus/helpers/README.md +++ /dev/null @@ -1,4 +0,0 @@ -No idea where to place these so uhhh -//fixme -bwomp will eventually fix :3 -- IThundxr \ No newline at end of file diff --git a/src/main/java/org/violetmoon/zeta/temp/EnvType.java b/src/main/java/org/violetmoon/zeta/temp/EnvType.java new file mode 100644 index 0000000000..11dd371aef --- /dev/null +++ b/src/main/java/org/violetmoon/zeta/temp/EnvType.java @@ -0,0 +1,31 @@ +package org.violetmoon.zeta.temp; + +/** + * Represents a type of environment. + * + *

A type of environment is a jar file in a Minecraft version's json file's {@code download} + * subsection, including the {@code client.jar} and the {@code server.jar}.

+ * + * @see Environment + */ +public enum EnvType { + /** + * Represents the client environment type, in which the {@code client.jar} for a + * Minecraft version is the main game jar. + * + *

A client environment type has all client logic (client rendering and integrated + * server logic), the data generator logic, and dedicated server logic. It encompasses + * everything that is available on the {@linkplain #SERVER server environment type}.

+ */ + CLIENT, + /** + * Represents the server environment type, in which the {@code server.jar} for a + * Minecraft version is the main game jar. + * + *

A server environment type has the dedicated server logic and data generator + * logic, which are all included in the {@linkplain #CLIENT client environment type}. + * However, the server environment type has its libraries embedded compared to the + * client.

+ */ + SERVER +} \ No newline at end of file diff --git a/src/main/java/org/violetmoon/zeta/temp/Environment.java b/src/main/java/org/violetmoon/zeta/temp/Environment.java new file mode 100644 index 0000000000..3797485c71 --- /dev/null +++ b/src/main/java/org/violetmoon/zeta/temp/Environment.java @@ -0,0 +1,27 @@ +package org.violetmoon.zeta.temp; + +import java.lang.annotation.*; + +/** + * Applied to declare that the annotated element is present only in the specified environment. + * + *

Use with caution, as Fabric-loader will remove the annotated element in a mismatched environment!

+ * + *

When the annotated element is removed, bytecode associated with the element will not be removed. + * For example, if a field is removed, its initializer code will not, and will cause an error on execution.

+ * + *

If an overriding method has this annotation and its overridden method doesn't, + * unexpected behavior may happen. If an overridden method has this annotation + * while the overriding method doesn't, it is safe, but the method can be used from + * the overridden class only in the specified environment.

+ */ +@Retention(RetentionPolicy.CLASS) +@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.CONSTRUCTOR, ElementType.PACKAGE}) +@Documented +public @interface Environment { + /** + * Returns the environment type that the annotated element is only present in. + */ + EnvType value(); +} + From df2f108b2df40293a89a8f7e77a0a497fd364f11 Mon Sep 17 00:00:00 2001 From: IThundxr Date: Wed, 8 Nov 2023 18:44:25 -0500 Subject: [PATCH 5/6] update readme --- zeta-todo/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zeta-todo/README.md b/zeta-todo/README.md index 970029255e..56263c2373 100644 --- a/zeta-todo/README.md +++ b/zeta-todo/README.md @@ -25,7 +25,7 @@ So tl;dr for zeta-fying a module: * create cross-platform versions of any missing `@SubscribeEvent`s in Zeta and subscribe to them with `@PlayEvent`, * remove all other mentions of Forge and add an appropriate indirection layer in Zeta. -Repeat ~~164x~~ ~~136x~~ 47x. +Repeat ~~164x~~ ~~136x~~ ~~47x~~ 0x. # The initial Zeta pitch From d8a8e0d48824133068735e126b857db824785851 Mon Sep 17 00:00:00 2001 From: IThundxr Date: Wed, 8 Nov 2023 18:57:02 -0500 Subject: [PATCH 6/6] not needed yet --- .../org/violetmoon/zeta/temp/EnvType.java | 31 ------------------- .../org/violetmoon/zeta/temp/Environment.java | 27 ---------------- 2 files changed, 58 deletions(-) delete mode 100644 src/main/java/org/violetmoon/zeta/temp/EnvType.java delete mode 100644 src/main/java/org/violetmoon/zeta/temp/Environment.java diff --git a/src/main/java/org/violetmoon/zeta/temp/EnvType.java b/src/main/java/org/violetmoon/zeta/temp/EnvType.java deleted file mode 100644 index 11dd371aef..0000000000 --- a/src/main/java/org/violetmoon/zeta/temp/EnvType.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.violetmoon.zeta.temp; - -/** - * Represents a type of environment. - * - *

A type of environment is a jar file in a Minecraft version's json file's {@code download} - * subsection, including the {@code client.jar} and the {@code server.jar}.

- * - * @see Environment - */ -public enum EnvType { - /** - * Represents the client environment type, in which the {@code client.jar} for a - * Minecraft version is the main game jar. - * - *

A client environment type has all client logic (client rendering and integrated - * server logic), the data generator logic, and dedicated server logic. It encompasses - * everything that is available on the {@linkplain #SERVER server environment type}.

- */ - CLIENT, - /** - * Represents the server environment type, in which the {@code server.jar} for a - * Minecraft version is the main game jar. - * - *

A server environment type has the dedicated server logic and data generator - * logic, which are all included in the {@linkplain #CLIENT client environment type}. - * However, the server environment type has its libraries embedded compared to the - * client.

- */ - SERVER -} \ No newline at end of file diff --git a/src/main/java/org/violetmoon/zeta/temp/Environment.java b/src/main/java/org/violetmoon/zeta/temp/Environment.java deleted file mode 100644 index 3797485c71..0000000000 --- a/src/main/java/org/violetmoon/zeta/temp/Environment.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.violetmoon.zeta.temp; - -import java.lang.annotation.*; - -/** - * Applied to declare that the annotated element is present only in the specified environment. - * - *

Use with caution, as Fabric-loader will remove the annotated element in a mismatched environment!

- * - *

When the annotated element is removed, bytecode associated with the element will not be removed. - * For example, if a field is removed, its initializer code will not, and will cause an error on execution.

- * - *

If an overriding method has this annotation and its overridden method doesn't, - * unexpected behavior may happen. If an overridden method has this annotation - * while the overriding method doesn't, it is safe, but the method can be used from - * the overridden class only in the specified environment.

- */ -@Retention(RetentionPolicy.CLASS) -@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.CONSTRUCTOR, ElementType.PACKAGE}) -@Documented -public @interface Environment { - /** - * Returns the environment type that the annotated element is only present in. - */ - EnvType value(); -} -