From ef2be7ca652aa363de11d1a81d46f9a7358f6bcd Mon Sep 17 00:00:00 2001 From: IThundxr Date: Fri, 2 Feb 2024 19:09:51 -0500 Subject: [PATCH] please work forge <3 --- .../violetmoon/zetaimplforge/ForgeZeta.java | 170 +++++------------- .../config/ConfigEventDispatcher.java | 8 +- 2 files changed, 42 insertions(+), 136 deletions(-) diff --git a/src/main/java/org/violetmoon/zetaimplforge/ForgeZeta.java b/src/main/java/org/violetmoon/zetaimplforge/ForgeZeta.java index ac804fb..658635f 100644 --- a/src/main/java/org/violetmoon/zetaimplforge/ForgeZeta.java +++ b/src/main/java/org/violetmoon/zetaimplforge/ForgeZeta.java @@ -1,5 +1,34 @@ package org.violetmoon.zetaimplforge; +import net.minecraft.core.BlockPos; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.FlowerPotBlock; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraftforge.common.ForgeConfigSpec; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.*; +import net.minecraftforge.event.entity.*; +import net.minecraftforge.event.entity.living.*; +import net.minecraftforge.event.entity.player.*; +import net.minecraftforge.event.furnace.FurnaceFuelBurnTimeEvent; +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; +import net.minecraftforge.fml.ModList; +import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; +import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent; +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; +import net.minecraftforge.fml.loading.FMLEnvironment; +import net.minecraftforge.registries.RegisterEvent; import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.Nullable; import org.violetmoon.zeta.Zeta; @@ -8,98 +37,34 @@ import org.violetmoon.zeta.config.IZetaConfigInternals; import org.violetmoon.zeta.config.SectionDefinition; 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.ZGatherAdvancementModifiers; -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.ZFurnaceFuelBurnTime; -import org.violetmoon.zeta.event.play.ZItemTooltip; -import org.violetmoon.zeta.event.play.ZLevelTick; -import org.violetmoon.zeta.event.play.ZPlayNoteBlock; -import org.violetmoon.zeta.event.play.ZServerTick; -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.ZLivingTick; -import org.violetmoon.zeta.event.play.entity.living.ZMobSpawnEvent; -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; -import org.violetmoon.zeta.registry.CraftingExtensionsRegistry; -import org.violetmoon.zeta.registry.CreativeTabManager; -import org.violetmoon.zeta.registry.PottedPlantRegistry; -import org.violetmoon.zeta.registry.ZetaRegistry; +import org.violetmoon.zeta.registry.*; import org.violetmoon.zeta.util.RaytracingUtil; import org.violetmoon.zeta.util.ZetaSide; -import org.violetmoon.zeta.util.zetalist.ZetaList; import org.violetmoon.zetaimplforge.api.GatherAdvancementModifiersEvent; import org.violetmoon.zetaimplforge.block.IForgeBlockBlockExtensions; import org.violetmoon.zetaimplforge.capability.ForgeCapabilityManager; +import org.violetmoon.zetaimplforge.config.ConfigEventDispatcher; import org.violetmoon.zetaimplforge.config.ForgeBackedConfig; import org.violetmoon.zetaimplforge.config.TerribleForgeConfigHackery; 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.ForgeZFurnaceFuelBurnTime; -import org.violetmoon.zetaimplforge.event.play.ForgeZItemTooltip; -import org.violetmoon.zetaimplforge.event.play.ForgeZLevelTick; -import org.violetmoon.zetaimplforge.event.play.ForgeZPlayNoteBlock; -import org.violetmoon.zetaimplforge.event.play.ForgeZServerTick; -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.ForgeZLivingTick; -import org.violetmoon.zetaimplforge.event.play.entity.living.ForgeZMobSpawnEvent; -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; @@ -111,60 +76,6 @@ import org.violetmoon.zetaimplforge.registry.ForgeZetaRegistry; import org.violetmoon.zetaimplforge.util.ForgeRaytracingUtil; -import net.minecraft.core.BlockPos; -import net.minecraft.world.InteractionHand; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.FlowerPotBlock; -import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.phys.BlockHitResult; -import net.minecraftforge.common.ForgeConfigSpec; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.AddReloadListenerEvent; -import net.minecraftforge.event.AnvilUpdateEvent; -import net.minecraftforge.event.AttachCapabilitiesEvent; -import net.minecraftforge.event.LootTableLoadEvent; -import net.minecraftforge.event.TagsUpdatedEvent; -import net.minecraftforge.event.TickEvent; -import net.minecraftforge.event.entity.EntityAttributeCreationEvent; -import net.minecraftforge.event.entity.EntityEvent; -import net.minecraftforge.event.entity.EntityJoinLevelEvent; -import net.minecraftforge.event.entity.EntityMobGriefingEvent; -import net.minecraftforge.event.entity.EntityTeleportEvent; -import net.minecraftforge.event.entity.living.AnimalTameEvent; -import net.minecraftforge.event.entity.living.BabyEntitySpawnEvent; -import net.minecraftforge.event.entity.living.LivingChangeTargetEvent; -import net.minecraftforge.event.entity.living.LivingConversionEvent; -import net.minecraftforge.event.entity.living.LivingDeathEvent; -import net.minecraftforge.event.entity.living.LivingDropsEvent; -import net.minecraftforge.event.entity.living.LivingEvent; -import net.minecraftforge.event.entity.living.LivingFallEvent; -import net.minecraftforge.event.entity.living.MobSpawnEvent; -import net.minecraftforge.event.entity.player.AnvilRepairEvent; -import net.minecraftforge.event.entity.player.BonemealEvent; -import net.minecraftforge.event.entity.player.EntityItemPickupEvent; -import net.minecraftforge.event.entity.player.ItemTooltipEvent; -import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent; -import net.minecraftforge.event.entity.player.PlayerEvent; -import net.minecraftforge.event.entity.player.PlayerInteractEvent; -import net.minecraftforge.event.entity.player.SleepingLocationCheckEvent; -import net.minecraftforge.event.furnace.FurnaceFuelBurnTimeEvent; -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; -import net.minecraftforge.fml.ModList; -import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; -import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent; -import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -import net.minecraftforge.fml.loading.FMLEnvironment; -import net.minecraftforge.registries.RegisterEvent; - /** * ideally do not touch quark from this package, it will later be split off */ @@ -270,6 +181,7 @@ public void start() { // TODO FIX very ugly & bad modbus.addListener(CreativeTabManager::buildContents); + modbus.addListener(ConfigEventDispatcher::configChanged); //play MinecraftForge.EVENT_BUS.addListener(this::rightClickBlock); diff --git a/src/main/java/org/violetmoon/zetaimplforge/config/ConfigEventDispatcher.java b/src/main/java/org/violetmoon/zetaimplforge/config/ConfigEventDispatcher.java index 826ebc3..6c722fe 100644 --- a/src/main/java/org/violetmoon/zetaimplforge/config/ConfigEventDispatcher.java +++ b/src/main/java/org/violetmoon/zetaimplforge/config/ConfigEventDispatcher.java @@ -1,17 +1,11 @@ package org.violetmoon.zetaimplforge.config; +import net.minecraftforge.fml.event.config.ModConfigEvent; import org.violetmoon.zeta.Zeta; import org.violetmoon.zeta.event.load.ZConfigChanged; import org.violetmoon.zeta.util.zetalist.ZetaList; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.common.Mod.EventBusSubscriber; -import net.minecraftforge.fml.event.config.ModConfigEvent; - -@EventBusSubscriber(modid = Zeta.ZETA_ID, bus = EventBusSubscriber.Bus.MOD) public class ConfigEventDispatcher { - - @SubscribeEvent public static void configChanged(ModConfigEvent event) { for(Zeta z : ZetaList.INSTANCE.getZetas()) { String modid = z.modid;