diff --git a/docs/content/Development/General-Topics/Global-Data.md b/docs/content/Development/General-Topics/Global-Data.md index 8442155303..0d40830191 100644 --- a/docs/content/Development/General-Topics/Global-Data.md +++ b/docs/content/Development/General-Topics/Global-Data.md @@ -18,7 +18,7 @@ When doing so, you need to ensure that remote and serverside instances don't get To make working with this requirement easier, You can use `SideLocal` to store your global data. It is similar to Java's `ThreadLocal`, but operates on the game's sides instead. -If you are currently on the remote side (`LDLib.isRemote()` / on the client's `main` thread), it will return the +If you are currently on the remote side (`GTCEuAPI.isClientThread()` / on the client's `main` thread), it will return the remote side's instance of your data. Otherwise, you will get the server side's instance. ??? example "Example Usage" diff --git a/src/main/java/com/gregtechceu/gtceu/GTCEu.java b/src/main/java/com/gregtechceu/gtceu/GTCEu.java index edfe13fea9..09fd3c85c3 100644 --- a/src/main/java/com/gregtechceu/gtceu/GTCEu.java +++ b/src/main/java/com/gregtechceu/gtceu/GTCEu.java @@ -6,16 +6,24 @@ import com.gregtechceu.gtceu.common.CommonProxy; import com.gregtechceu.gtceu.utils.FormattingUtil; -import com.lowdragmc.lowdraglib.LDLib; -import com.lowdragmc.lowdraglib.Platform; - +import net.minecraft.client.Minecraft; import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.MinecraftServer; import net.minecraftforge.fml.DistExecutor; +import net.minecraftforge.fml.ModList; import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.loading.FMLEnvironment; +import net.minecraftforge.fml.loading.FMLLoader; +import net.minecraftforge.fml.loading.FMLPaths; +import net.minecraftforge.server.ServerLifecycleHooks; +import dev.emi.emi.config.EmiConfig; +import me.shedaniel.rei.api.client.REIRuntime; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.nio.file.Path; + @Mod(GTCEu.MOD_ID) public class GTCEu { @@ -30,7 +38,7 @@ public GTCEu() { } public static void init() { - LOGGER.info("{} is initializing on platform: {}", NAME, Platform.platformName()); + LOGGER.info("{} is initializing...", NAME); } public static ResourceLocation id(String path) { @@ -53,45 +61,132 @@ public static ResourceLocation appendId(String id) { return new ResourceLocation(strings[0], strings[1]); } - public static boolean isKubeJSLoaded() { - return LDLib.isModLoaded(GTValues.MODID_KUBEJS); + /** + * @return if we're running in a production environment + */ + public static boolean isProd() { + return FMLLoader.isProduction(); } - public static boolean isIrisOculusLoaded() { - return LDLib.isModLoaded(GTValues.MODID_IRIS) || LDLib.isModLoaded(GTValues.MODID_OCULUS); + /** + * @return if we're not running in a production environment + */ + public static boolean isDev() { + return !isProd(); } - public static boolean isSodiumRubidiumEmbeddiumLoaded() { - return LDLib.isModLoaded(GTValues.MODID_SODIUM) || LDLib.isModLoaded(GTValues.MODID_RUBIDIUM) || - LDLib.isModLoaded(GTValues.MODID_EMBEDDIUM); + /** + * @return if we're running data generation + */ + public static boolean isDataGen() { + return FMLLoader.getLaunchHandler().isData(); } - public static boolean isAE2Loaded() { - return LDLib.isModLoaded(GTValues.MODID_APPENG); + /** + * A friendly reminder that the server instance is populated on the server side only, so null/side check it! + * + * @return the current minecraft server instance + */ + public static MinecraftServer getMinecraftServer() { + return ServerLifecycleHooks.getCurrentServer(); } - public static boolean isCuriosLoaded() { - return LDLib.isModLoaded(GTValues.MODID_CURIOS); + /** + * @param modId the mod id to check for + * @return if the mod whose id is {@code modId} is loaded or not + */ + public static boolean isModLoaded(String modId) { + return ModList.get().isLoaded(modId); } - public static boolean isShimmerLoaded() { - return LDLib.isModLoaded(GTValues.MODID_SHIMMER); + /** + * For async stuff use this, otherwise use {@link GTCEu isClientSide} + * + * @return if the current thread is the client thread + */ + public static boolean isClientThread() { + return isClientSide() && Minecraft.getInstance().isSameThread(); } - public static boolean isJAVDLoaded() { - return LDLib.isModLoaded(GTValues.MODID_JAVD); + /** + * @return if the FML environment is a client + */ + public static boolean isClientSide() { + return FMLEnvironment.dist.isClient(); } - public static boolean isFTBTeamsLoaded() { - return LDLib.isModLoaded(GTValues.MODID_FTB_TEAMS); + /** + * This check isn't the same for client and server! + * + * @return if it's safe to access the current instance {@link net.minecraft.world.level.Level Level} on client or if + * it's safe to access any level on server. + */ + public static boolean canGetServerLevel() { + if (isClientSide()) { + return Minecraft.getInstance().level != null; + } + var server = getMinecraftServer(); + return server != null && + !(server.isStopped() || server.isShutdown() || !server.isRunning() || server.isCurrentlySaving()); } - public static boolean isArgonautsLoaded() { - return LDLib.isModLoaded(GTValues.MODID_ARGONAUTS); + /** + * @return the path to the minecraft instance directory + */ + public static Path getGameDir() { + return FMLPaths.GAMEDIR.get(); } - @Deprecated(forRemoval = true, since = "1.0.21") - public static boolean isHighTier() { - return GTCEuAPI.isHighTier(); + public static class Mods { + + public static boolean isJEILoaded() { + return !(isModLoaded(GTValues.MODID_EMI) || isModLoaded(GTValues.MODID_REI)) && + isModLoaded(GTValues.MODID_JEI); + } + + public static boolean isREILoaded() { + return isModLoaded(GTValues.MODID_REI) && !(isClientSide() || REIRuntime.getInstance().isOverlayVisible()); + } + + public static boolean isEMILoaded() { + return isModLoaded(GTValues.MODID_EMI) && !(isClientSide() || EmiConfig.enabled); + } + + public static boolean isKubeJSLoaded() { + return isModLoaded(GTValues.MODID_KUBEJS); + } + + public static boolean isIrisOculusLoaded() { + return isModLoaded(GTValues.MODID_IRIS) || isModLoaded(GTValues.MODID_OCULUS); + } + + public static boolean isSodiumRubidiumEmbeddiumLoaded() { + return isModLoaded(GTValues.MODID_SODIUM) || isModLoaded(GTValues.MODID_RUBIDIUM) || + isModLoaded(GTValues.MODID_EMBEDDIUM); + } + + public static boolean isAE2Loaded() { + return isModLoaded(GTValues.MODID_APPENG); + } + + public static boolean isCuriosLoaded() { + return isModLoaded(GTValues.MODID_CURIOS); + } + + public static boolean isShimmerLoaded() { + return isModLoaded(GTValues.MODID_SHIMMER); + } + + public static boolean isJAVDLoaded() { + return isModLoaded(GTValues.MODID_JAVD); + } + + public static boolean isFTBTeamsLoaded() { + return isModLoaded(GTValues.MODID_FTB_TEAMS); + } + + public static boolean isArgonautsLoaded() { + return isModLoaded(GTValues.MODID_ARGONAUTS); + } } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/GTCEuAPI.java b/src/main/java/com/gregtechceu/gtceu/api/GTCEuAPI.java index 1214cdbf1e..e9bdd6edac 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/GTCEuAPI.java +++ b/src/main/java/com/gregtechceu/gtceu/api/GTCEuAPI.java @@ -12,8 +12,6 @@ import com.gregtechceu.gtceu.common.block.CoilBlock; import com.gregtechceu.gtceu.config.ConfigHolder; -import com.lowdragmc.lowdraglib.Platform; - import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.block.Block; import net.minecraftforge.eventbus.api.GenericEvent; @@ -49,7 +47,7 @@ public class GTCEuAPI { public static void initializeHighTier() { if (highTierInitialized) throw new IllegalStateException("High-Tier is already initialized."); highTier = ConfigHolder.INSTANCE.machines.highTierContent || - AddonFinder.getAddons().stream().anyMatch(IGTAddon::requiresHighTier) || Platform.isDevEnv(); + AddonFinder.getAddons().stream().anyMatch(IGTAddon::requiresHighTier) || GTCEu.isDev(); highTierInitialized = true; if (isHighTier()) GTCEu.LOGGER.info("High-Tier is Enabled."); diff --git a/src/main/java/com/gregtechceu/gtceu/api/GTValues.java b/src/main/java/com/gregtechceu/gtceu/api/GTValues.java index 390f962bdf..eede6c8a50 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/GTValues.java +++ b/src/main/java/com/gregtechceu/gtceu/api/GTValues.java @@ -104,6 +104,8 @@ public static int[] tiersBetween(int minInclusive, int maxInclusive) { public static final String MODID_TOP = "theoneprobe", MODID_JEI = "jei", + MODID_REI = "roughlyenoughitems", + MODID_EMI = "emi", MODID_APPENG = "ae2", MODID_KUBEJS = "kubejs", MODID_IRIS = "iris", diff --git a/src/main/java/com/gregtechceu/gtceu/api/block/MaterialBlock.java b/src/main/java/com/gregtechceu/gtceu/api/block/MaterialBlock.java index ec684acbcb..be17a8e898 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/block/MaterialBlock.java +++ b/src/main/java/com/gregtechceu/gtceu/api/block/MaterialBlock.java @@ -1,5 +1,6 @@ package com.gregtechceu.gtceu.api.block; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.blockentity.PipeBlockEntity; import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.data.tag.TagPrefix; @@ -10,8 +11,6 @@ import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.data.recipe.VanillaRecipeHelper; -import com.lowdragmc.lowdraglib.Platform; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.client.color.block.BlockColor; import net.minecraft.core.BlockPos; @@ -71,7 +70,7 @@ public MaterialBlock(Properties properties, TagPrefix tagPrefix, Material materi super(properties); this.material = material; this.tagPrefix = tagPrefix; - if (registerModel && Platform.isClient()) { + if (registerModel && GTCEu.isClientSide()) { MaterialBlockRenderer.create(this, tagPrefix.materialIconType(), material.getMaterialIconSet()); } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/block/OreBlock.java b/src/main/java/com/gregtechceu/gtceu/api/block/OreBlock.java index 2058d6a857..257a0d4611 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/block/OreBlock.java +++ b/src/main/java/com/gregtechceu/gtceu/api/block/OreBlock.java @@ -1,13 +1,12 @@ package com.gregtechceu.gtceu.api.block; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.data.tag.TagPrefix; import com.gregtechceu.gtceu.client.renderer.block.OreBlockRenderer; import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.integration.map.cache.server.ServerCache; -import com.lowdragmc.lowdraglib.Platform; - import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.InteractionHand; @@ -21,7 +20,7 @@ public class OreBlock extends MaterialBlock { public OreBlock(Properties properties, TagPrefix tagPrefix, Material material, boolean registerModel) { super(properties, tagPrefix, material, false); - if (registerModel && Platform.isClient()) { + if (registerModel && GTCEu.isClientSide()) { OreBlockRenderer.create(this); } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/blockentity/MetaMachineBlockEntity.java b/src/main/java/com/gregtechceu/gtceu/api/blockentity/MetaMachineBlockEntity.java index 8fc62de826..4344734f2a 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/blockentity/MetaMachineBlockEntity.java +++ b/src/main/java/com/gregtechceu/gtceu/api/blockentity/MetaMachineBlockEntity.java @@ -49,7 +49,10 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Set; /** * @author KilaBash @@ -269,7 +272,7 @@ public static LazyOptional getCapability(MetaMachine machine, @NotNull Ca return GTCapability.CAPABILITY_DATA_ACCESS.orEmpty(cap, LazyOptional.of(() -> list.get(0))); } } - if (GTCEu.isAE2Loaded()) { + if (GTCEu.Mods.isAE2Loaded()) { if (cap == Capabilities.IN_WORLD_GRID_NODE_HOST) { if (machine instanceof IInWorldGridNodeHost nodeHost) { return Capabilities.IN_WORLD_GRID_NODE_HOST.orEmpty(cap, LazyOptional.of(() -> nodeHost)); diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/ICoverable.java b/src/main/java/com/gregtechceu/gtceu/api/capability/ICoverable.java index da5b1a6976..eaa8de82d9 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/ICoverable.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/ICoverable.java @@ -1,5 +1,6 @@ package com.gregtechceu.gtceu.api.capability; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.block.IAppearance; import com.gregtechceu.gtceu.api.blockentity.ITickSubscription; import com.gregtechceu.gtceu.api.cover.CoverBehavior; @@ -7,8 +8,6 @@ import com.gregtechceu.gtceu.api.transfer.fluid.IFluidHandlerModifiable; import com.gregtechceu.gtceu.utils.GTUtil; -import com.lowdragmc.lowdraglib.LDLib; - import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.server.level.ServerPlayer; @@ -169,7 +168,7 @@ default boolean hasCover(Direction facing) { } default boolean isRemote() { - return getLevel() == null ? LDLib.isRemote() : getLevel().isClientSide; + return getLevel() == null ? GTCEu.isClientThread() : getLevel().isClientSide; } default VoxelShape[] addCoverCollisionBoundingBox() { diff --git a/src/main/java/com/gregtechceu/gtceu/api/cover/filter/FilterHandler.java b/src/main/java/com/gregtechceu/gtceu/api/cover/filter/FilterHandler.java index c2b7ab437a..ca2f9dd9ad 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/cover/filter/FilterHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/api/cover/filter/FilterHandler.java @@ -1,5 +1,6 @@ package com.gregtechceu.gtceu.api.cover.filter; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.cover.CoverBehavior; import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.api.gui.widget.SlotWidget; @@ -7,7 +8,6 @@ import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.api.transfer.item.CustomItemStackHandler; -import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup; import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; @@ -128,7 +128,7 @@ private CustomItemStackHandler getFilterSlot() { private void updateFilter() { var filterContainer = getFilterSlot(); - if (LDLib.isRemote()) { + if (GTCEu.isClientThread()) { if (!filterContainer.getStackInSlot(0).isEmpty() && !this.filterItem.isEmpty()) { return; } diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/info/MaterialIconSet.java b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/info/MaterialIconSet.java index edf2447771..a015487b90 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/info/MaterialIconSet.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/info/MaterialIconSet.java @@ -98,7 +98,7 @@ public String toString() { } public static void init() { - if (GTCEu.isKubeJSLoaded()) { + if (GTCEu.Mods.isKubeJSLoaded()) { GTRegistryInfo.registerFor(GTRegistryInfo.MATERIAL_ICON_SET.registryKey); } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/info/MaterialIconType.java b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/info/MaterialIconType.java index 19d4f58e4e..ad96915d1f 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/info/MaterialIconType.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/info/MaterialIconType.java @@ -3,7 +3,6 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.integration.kjs.GTRegistryInfo; -import com.lowdragmc.lowdraglib.Platform; import com.lowdragmc.lowdraglib.utils.ResourceHelper; import net.minecraft.client.Minecraft; @@ -127,7 +126,7 @@ public MaterialIconType(String name) { } public static void init() { - if (GTCEu.isKubeJSLoaded()) { + if (GTCEu.Mods.isKubeJSLoaded()) { GTRegistryInfo.registerFor(GTRegistryInfo.MATERIAL_ICON_TYPE.registryKey); } } @@ -158,7 +157,7 @@ public ResourceLocation getBlockTexturePath(@NotNull MaterialIconSet materialIco MaterialIconSet iconSet = materialIconSet; // noinspection ConstantConditions - if (!Platform.isClient() || Minecraft.getInstance() == null || + if (!GTCEu.isClientSide() || Minecraft.getInstance() == null || Minecraft.getInstance().getResourceManager() == null) return null; // check minecraft for null for CI environments if (!iconSet.isRootIconset) { @@ -197,7 +196,7 @@ public ResourceLocation getBlockModelPath(@NotNull MaterialIconSet materialIconS MaterialIconSet iconSet = materialIconSet; // noinspection ConstantConditions - if (!iconSet.isRootIconset && Platform.isClient() && Minecraft.getInstance() != null && + if (!iconSet.isRootIconset && GTCEu.isClientSide() && Minecraft.getInstance() != null && Minecraft.getInstance().getResourceManager() != null) { // check minecraft for null for CI environments while (!iconSet.isRootIconset) { ResourceLocation location = GTCEu @@ -224,7 +223,7 @@ public ResourceLocation getItemModelPath(@NotNull MaterialIconSet materialIconSe MaterialIconSet iconSet = materialIconSet; // noinspection ConstantConditions - if (!iconSet.isRootIconset && Platform.isClient() && Minecraft.getInstance() != null && + if (!iconSet.isRootIconset && GTCEu.isClientSide() && Minecraft.getInstance() != null && Minecraft.getInstance().getResourceManager() != null) { // check minecraft for null for CI environments while (!iconSet.isRootIconset) { ResourceLocation location = GTCEu @@ -263,7 +262,7 @@ public ResourceLocation getItemTexturePath(@NotNull MaterialIconSet materialIcon MaterialIconSet iconSet = materialIconSet; // noinspection ConstantConditions - if (!iconSet.isRootIconset && Platform.isClient() && Minecraft.getInstance() != null && + if (!iconSet.isRootIconset && GTCEu.isClientSide() && Minecraft.getInstance() != null && Minecraft.getInstance().getResourceManager() != null) { // check minecraft for null for CI environments while (!iconSet.isRootIconset) { ResourceLocation location = GTCEu diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/HazardProperty.java b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/HazardProperty.java index f63a34822f..dbafcf9f5a 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/HazardProperty.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/HazardProperty.java @@ -120,7 +120,7 @@ public boolean isProtected(LivingEntity livingEntity) { correctArmorItems.add(equipmentType); } } - if (!GTCEu.isCuriosLoaded() || this.curioSlots.isEmpty()) { + if (!GTCEu.Mods.isCuriosLoaded() || this.curioSlots.isEmpty()) { return correctArmorItems.containsAll(equipmentTypes); } Set correctCurios = new HashSet<>(); @@ -153,7 +153,7 @@ public void damageEquipment(Player player, int amount) { armor.hurtAndBreak(amount, player, p -> p.broadcastBreakEvent(type.getSlot())); } } - if (GTCEu.isCuriosLoaded()) { + if (GTCEu.Mods.isCuriosLoaded()) { ICuriosItemHandler curiosInventory = CuriosApi.getCuriosInventory(player) .resolve() .orElse(null); diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/MaterialProperties.java b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/MaterialProperties.java index 3838011fa3..f559c304f9 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/MaterialProperties.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/MaterialProperties.java @@ -3,8 +3,6 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.data.chemical.material.Material; -import com.lowdragmc.lowdraglib.Platform; - import java.util.*; public class MaterialProperties { @@ -74,7 +72,7 @@ public void verify() { if (propertyMap.keySet().stream().noneMatch(baseTypes::contains)) { if (propertyMap.isEmpty()) { - if (Platform.isDevEnv()) { + if (GTCEu.isDev()) { GTCEu.LOGGER.debug("Creating empty placeholder Material {}", material); } propertyMap.put(PropertyKey.EMPTY, PropertyKey.EMPTY.constructDefault()); diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/tag/TagPrefix.java b/src/main/java/com/gregtechceu/gtceu/api/data/tag/TagPrefix.java index e21b9e58fe..748e205a4a 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/tag/TagPrefix.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/tag/TagPrefix.java @@ -13,7 +13,10 @@ import com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey; import com.gregtechceu.gtceu.api.data.chemical.material.stack.MaterialStack; import com.gregtechceu.gtceu.api.item.tool.GTToolType; -import com.gregtechceu.gtceu.common.data.*; +import com.gregtechceu.gtceu.common.data.GTBlocks; +import com.gregtechceu.gtceu.common.data.GTMaterialBlocks; +import com.gregtechceu.gtceu.common.data.GTMaterialItems; +import com.gregtechceu.gtceu.common.data.GTMaterials; import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.integration.kjs.GTRegistryInfo; import com.gregtechceu.gtceu.integration.xei.widgets.GTOreByProduct; @@ -72,7 +75,7 @@ public class TagPrefix { public static void init() { AddonFinder.getAddons().forEach(IGTAddon::registerTagPrefixes); - if (GTCEu.isKubeJSLoaded()) { + if (GTCEu.Mods.isKubeJSLoaded()) { GTRegistryInfo.registerFor(GTRegistryInfo.TAG_PREFIX.registryKey); } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/WorldGenLayers.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/WorldGenLayers.java index 4aefcf064e..723d2e1eab 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/WorldGenLayers.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/WorldGenLayers.java @@ -59,7 +59,7 @@ public enum WorldGenLayers implements IWorldGenLayer, StringRepresentable { public static void registerAll() { AddonFinder.getAddons().forEach(IGTAddon::registerWorldgenLayers); - if (GTCEu.isKubeJSLoaded()) { + if (GTCEu.Mods.isKubeJSLoaded()) { GTRegistryInfo.registerFor(GTRegistryInfo.WORLD_GEN_LAYER.registryKey); } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/editor/EditableMachineUI.java b/src/main/java/com/gregtechceu/gtceu/api/gui/editor/EditableMachineUI.java index 98d767a451..6134c419e2 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/editor/EditableMachineUI.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/editor/EditableMachineUI.java @@ -1,9 +1,8 @@ package com.gregtechceu.gtceu.api.gui.editor; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.machine.MetaMachine; -import com.lowdragmc.lowdraglib.LDLib; -import com.lowdragmc.lowdraglib.Platform; import com.lowdragmc.lowdraglib.gui.editor.configurator.IConfigurableWidget; import com.lowdragmc.lowdraglib.gui.editor.data.Resources; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; @@ -76,10 +75,10 @@ public WidgetGroup createCustomUI() { public CompoundTag getCustomUI() { if (this.customUICache == null) { ResourceManager resourceManager = null; - if (LDLib.isClient()) { + if (GTCEu.isClientSide()) { resourceManager = Minecraft.getInstance().getResourceManager(); - } else if (Platform.getMinecraftServer() != null) { - resourceManager = Platform.getMinecraftServer().getResourceManager(); + } else if (GTCEu.getMinecraftServer() != null) { + resourceManager = GTCEu.getMinecraftServer().getResourceManager(); } if (resourceManager == null) { this.customUICache = new CompoundTag(); diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/factory/GTUIEditorFactory.java b/src/main/java/com/gregtechceu/gtceu/api/gui/factory/GTUIEditorFactory.java index 9c531f2edb..814491d6e6 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/factory/GTUIEditorFactory.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/factory/GTUIEditorFactory.java @@ -1,5 +1,6 @@ package com.gregtechceu.gtceu.api.gui.factory; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.gui.editor.GTUIEditor; import com.lowdragmc.lowdraglib.LDLib; @@ -43,7 +44,7 @@ public boolean isInvalid() { @Override public boolean isRemote() { - return LDLib.isRemote(); + return GTCEu.isClientThread(); } @Override diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/FancyMachineUIWidget.java b/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/FancyMachineUIWidget.java index fcd8798aad..fd68a5135b 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/FancyMachineUIWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/FancyMachineUIWidget.java @@ -1,9 +1,9 @@ package com.gregtechceu.gtceu.api.gui.fancy; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.config.ConfigHolder; -import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.util.ClickData; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; @@ -200,7 +200,7 @@ protected void setupFancyUI(IFancyUIProvider fancyUI, boolean showInventory) { Math.max(86, page.getSize().height + border * 2)); setSize(new Size(size.width, size.height + (!showInventory || playerInventory == null ? 0 : playerInventory.getSize().height))); - if (LDLib.isRemote() && getGui() != null) { + if (GTCEu.isClientSide() && getGui() != null) { getGui().setSize(getSize().width, getSize().height); } this.sideTabsWidget.setSize(new Size(24, size.height)); diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/misc/IGhostFluidTarget.java b/src/main/java/com/gregtechceu/gtceu/api/gui/misc/IGhostFluidTarget.java index b208a0f118..3324b34e81 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/misc/IGhostFluidTarget.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/misc/IGhostFluidTarget.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.api.gui.misc; -import com.lowdragmc.lowdraglib.LDLib; +import com.gregtechceu.gtceu.GTCEu; + import com.lowdragmc.lowdraglib.gui.ingredient.IGhostIngredientTarget; import com.lowdragmc.lowdraglib.gui.ingredient.Target; @@ -61,17 +62,17 @@ public void accept(@NotNull Object ingredient) { } default Object convertIngredient(Object ingredient) { - if (LDLib.isReiLoaded() && ingredient instanceof dev.architectury.fluid.FluidStack fluidStack) { + if (GTCEu.Mods.isREILoaded() && ingredient instanceof dev.architectury.fluid.FluidStack fluidStack) { ingredient = new FluidStack(fluidStack.getFluid(), (int) fluidStack.getAmount(), fluidStack.getTag()); } - if (LDLib.isEmiLoaded() && ingredient instanceof EmiStack fluidEmiStack) { + if (GTCEu.Mods.isEMILoaded() && ingredient instanceof EmiStack fluidEmiStack) { Fluid fluid = fluidEmiStack.getKeyOfType(Fluid.class); ingredient = fluid == null ? FluidStack.EMPTY : new FluidStack(fluid, (int) fluidEmiStack.getAmount(), fluidEmiStack.getNbt()); } - if (LDLib.isJeiLoaded() && ingredient instanceof net.minecraftforge.fluids.FluidStack fluidStack) { + if (GTCEu.Mods.isJEILoaded() && ingredient instanceof net.minecraftforge.fluids.FluidStack fluidStack) { ingredient = new FluidStack(fluidStack.getFluid(), fluidStack.getAmount(), fluidStack.getTag()); } return ingredient; diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/misc/IGhostItemTarget.java b/src/main/java/com/gregtechceu/gtceu/api/gui/misc/IGhostItemTarget.java index 28593addd8..e26f1e3052 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/misc/IGhostItemTarget.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/misc/IGhostItemTarget.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.api.gui.misc; -import com.lowdragmc.lowdraglib.LDLib; +import com.gregtechceu.gtceu.GTCEu; + import com.lowdragmc.lowdraglib.gui.ingredient.IGhostIngredientTarget; import com.lowdragmc.lowdraglib.gui.ingredient.Target; @@ -52,7 +53,7 @@ public void accept(@NotNull Object ingredient) { } default Object convertIngredient(Object ingredient) { - if (LDLib.isEmiLoaded() && ingredient instanceof EmiStack itemEmiStack) { + if (GTCEu.Mods.isEMILoaded() && ingredient instanceof EmiStack itemEmiStack) { Item item = itemEmiStack.getKeyOfType(Item.class); ItemStack itemStack = item == null ? ItemStack.EMPTY : new ItemStack(item, (int) itemEmiStack.getAmount()); if (!itemStack.isEmpty()) { @@ -61,7 +62,7 @@ default Object convertIngredient(Object ingredient) { ingredient = itemStack; } - if (LDLib.isJeiLoaded() && ingredient instanceof ITypedIngredient itemJeiStack) { + if (GTCEu.Mods.isJEILoaded() && ingredient instanceof ITypedIngredient itemJeiStack) { return itemJeiStack.getItemStack().orElse(ItemStack.EMPTY); } return ingredient; diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/EnumSelectorWidget.java b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/EnumSelectorWidget.java index 6e68b2d5bc..440031c6f2 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/EnumSelectorWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/EnumSelectorWidget.java @@ -1,9 +1,9 @@ package com.gregtechceu.gtceu.api.gui.widget; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.data.lang.LangHandler; -import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup; import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.widget.CycleButtonWidget; @@ -125,7 +125,7 @@ public void setSelected(@NotNull T value) { } private void updateTooltip() { - if (!LDLib.isRemote()) + if (!GTCEu.isClientThread()) return; T selectedValue = getCurrentValue(); diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/NumberInputWidget.java b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/NumberInputWidget.java index 59400619f4..53c6c49327 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/NumberInputWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/NumberInputWidget.java @@ -1,9 +1,9 @@ package com.gregtechceu.gtceu.api.gui.widget; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.utils.GTUtil; -import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup; import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.texture.TextTexture; @@ -133,7 +133,7 @@ private void buildUI() { private IGuiTexture getButtonTexture(String prefix, int buttonWidth) { var texture = new TextTexture(prefix + "1"); - if (!LDLib.isRemote()) { + if (!GTCEu.isClientThread()) { return texture; } diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/PatternPreviewWidget.java b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/PatternPreviewWidget.java index ce329dab36..54d1667b98 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/PatternPreviewWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/PatternPreviewWidget.java @@ -13,9 +13,10 @@ import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.integration.xei.handlers.item.CycleItemStackHandler; -import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.gui.editor.ColorPattern; -import com.lowdragmc.lowdraglib.gui.texture.*; +import com.lowdragmc.lowdraglib.gui.texture.ColorRectTexture; +import com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup; +import com.lowdragmc.lowdraglib.gui.texture.TextTexture; import com.lowdragmc.lowdraglib.gui.widget.*; import com.lowdragmc.lowdraglib.jei.IngredientIO; import com.lowdragmc.lowdraglib.utils.BlockInfo; @@ -44,7 +45,6 @@ import org.jetbrains.annotations.NotNull; import java.util.*; -import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -254,10 +254,10 @@ public static BlockPos locateNextRegion(int range) { public void updateScreen() { super.updateScreen(); // I can only think of this way - if (!isLoaded && LDLib.isEmiLoaded() && Minecraft.getInstance().screen instanceof RecipeScreen) { + if (!isLoaded && GTCEu.Mods.isEMILoaded() && Minecraft.getInstance().screen instanceof RecipeScreen) { setPage(0); isLoaded = true; - } else if (!isLoaded && LDLib.isReiLoaded() && + } else if (!isLoaded && GTCEu.Mods.isREILoaded() && Minecraft.getInstance().screen instanceof AbstractDisplayViewingScreen) { setPage(0); isLoaded = true; diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/PhantomFluidWidget.java b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/PhantomFluidWidget.java index b6ee5f605c..d20076126d 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/PhantomFluidWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/PhantomFluidWidget.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.api.gui.widget; -import com.lowdragmc.lowdraglib.LDLib; +import com.gregtechceu.gtceu.GTCEu; + import com.lowdragmc.lowdraglib.gui.editor.annotation.ConfigSetter; import com.lowdragmc.lowdraglib.gui.editor.annotation.LDLRegister; import com.lowdragmc.lowdraglib.gui.editor.configurator.IConfigurableWidget; @@ -100,9 +101,9 @@ public static FluidStack drainFrom(Object ingredient) { @Override @OnlyIn(Dist.CLIENT) public List getPhantomTargets(Object ingredient) { - if (LDLib.isReiLoaded() && ingredient instanceof dev.architectury.fluid.FluidStack fluidStack) { + if (GTCEu.Mods.isREILoaded() && ingredient instanceof dev.architectury.fluid.FluidStack fluidStack) { ingredient = new FluidStack(fluidStack.getFluid(), (int) fluidStack.getAmount(), fluidStack.getTag()); - } else if (LDLib.isEmiLoaded() && ingredient instanceof EmiStack emiStack) { + } else if (GTCEu.Mods.isEMILoaded() && ingredient instanceof EmiStack emiStack) { var key = emiStack.getKey(); if (key instanceof Fluid f) { int amount = emiStack.getAmount() == 0 ? 1000 : (int) emiStack.getAmount(); @@ -113,7 +114,7 @@ public List getPhantomTargets(Object ingredient) { } else { ingredient = null; } - } else if (LDLib.isJeiLoaded() && ingredient instanceof ITypedIngredient jeiStack) { + } else if (GTCEu.Mods.isJEILoaded() && ingredient instanceof ITypedIngredient jeiStack) { ingredient = jeiStack.getIngredient(); } @@ -132,11 +133,11 @@ public Rect2i getArea() { @Override public void accept(@Nonnull Object ingredient) { - if (LDLib.isReiLoaded() && ingredient instanceof dev.architectury.fluid.FluidStack fluidStack) { + if (GTCEu.Mods.isREILoaded() && ingredient instanceof dev.architectury.fluid.FluidStack fluidStack) { ingredient = new FluidStack(fluidStack.getFluid(), (int) fluidStack.getAmount(), fluidStack.getTag()); - } else if (LDLib.isEmiLoaded() && ingredient instanceof EmiStack emiStack) { + } else if (GTCEu.Mods.isEMILoaded() && ingredient instanceof EmiStack emiStack) { var key = emiStack.getKey(); if (key instanceof Fluid f) { int amount = emiStack.getAmount() == 0 ? 1000 : (int) emiStack.getAmount(); diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/PhantomSlotWidget.java b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/PhantomSlotWidget.java index 39addac870..3864a6e6e0 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/PhantomSlotWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/PhantomSlotWidget.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.api.gui.widget; -import com.lowdragmc.lowdraglib.LDLib; +import com.gregtechceu.gtceu.GTCEu; + import com.lowdragmc.lowdraglib.gui.editor.annotation.ConfigSetter; import com.lowdragmc.lowdraglib.gui.editor.annotation.Configurable; import com.lowdragmc.lowdraglib.gui.editor.annotation.LDLRegister; @@ -125,13 +126,13 @@ public boolean canPutStack(ItemStack stack) { @Override @OnlyIn(Dist.CLIENT) public List getPhantomTargets(Object ingredient) { - if (LDLib.isEmiLoaded() && ingredient instanceof EmiStack emiStack) { + if (GTCEu.Mods.isEMILoaded() && ingredient instanceof EmiStack emiStack) { Item item = emiStack.getKeyOfType(Item.class); if (item != null) { ingredient = new ItemStack(item, (int) emiStack.getAmount()); ((ItemStack) ingredient).setTag(emiStack.getNbt()); } - } else if (LDLib.isJeiLoaded() && ingredient instanceof ITypedIngredient jeiStack) { + } else if (GTCEu.Mods.isJEILoaded() && ingredient instanceof ITypedIngredient jeiStack) { ingredient = jeiStack.getItemStack().orElse(null); } if (!(ingredient instanceof ItemStack)) { @@ -149,13 +150,13 @@ public Rect2i getArea() { @Override public void accept(@Nonnull Object ingredient) { - if (LDLib.isEmiLoaded() && ingredient instanceof EmiStack emiStack) { + if (GTCEu.Mods.isEMILoaded() && ingredient instanceof EmiStack emiStack) { Item item = emiStack.getKeyOfType(Item.class); if (item != null) { ingredient = new ItemStack(item, (int) emiStack.getAmount()); ((ItemStack) ingredient).setTag(emiStack.getNbt()); } - } else if (LDLib.isJeiLoaded() && ingredient instanceof ITypedIngredient jeiStack) { + } else if (GTCEu.Mods.isJEILoaded() && ingredient instanceof ITypedIngredient jeiStack) { ingredient = jeiStack.getItemStack().orElse(null); } if (slotReference != null && ingredient instanceof ItemStack stack) { diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/SlotWidget.java b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/SlotWidget.java index 192e5f2c39..6ef83ff9c4 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/SlotWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/SlotWidget.java @@ -1,12 +1,12 @@ package com.gregtechceu.gtceu.api.gui.widget; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.integration.xei.entry.item.ItemEntryList; import com.gregtechceu.gtceu.integration.xei.entry.item.ItemStackList; import com.gregtechceu.gtceu.integration.xei.entry.item.ItemTagList; import com.gregtechceu.gtceu.integration.xei.handlers.item.CycleItemEntryHandler; import com.gregtechceu.gtceu.integration.xei.handlers.item.CycleItemStackHandler; -import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.gui.editor.annotation.LDLRegister; import com.lowdragmc.lowdraglib.gui.editor.configurator.ConfiguratorGroup; import com.lowdragmc.lowdraglib.gui.editor.configurator.WrapperConfigurator; @@ -204,11 +204,11 @@ public Object getXEIIngredientOverMouse(double mouseX, double mouseY) { } } - if (LDLib.isJeiLoaded() && !realStack.isEmpty()) { + if (GTCEu.Mods.isJEILoaded() && !realStack.isEmpty()) { return JEICallWrapper.getJEIStackClickable(realStack, getPosition(), getSize()); - } else if (LDLib.isReiLoaded()) { + } else if (GTCEu.Mods.isREILoaded()) { return EntryStacks.of(realStack); - } else if (LDLib.isEmiLoaded()) { + } else if (GTCEu.Mods.isEMILoaded()) { return EmiStack.of(realStack).setChance(getXEIChance()); } return realStack; @@ -230,11 +230,11 @@ public List getXEIIngredients() { } } - if (LDLib.isJeiLoaded() && !realStack.isEmpty()) { + if (GTCEu.Mods.isJEILoaded() && !realStack.isEmpty()) { return List.of(JEICallWrapper.getJEIStackClickable(realStack, getPosition(), getSize())); - } else if (LDLib.isReiLoaded()) { + } else if (GTCEu.Mods.isREILoaded()) { return List.of(EntryStacks.of(realStack)); - } else if (LDLib.isEmiLoaded()) { + } else if (GTCEu.Mods.isEMILoaded()) { return List.of(EmiStack.of(realStack).setChance(getXEIChance())); } return List.of(realStack); @@ -242,11 +242,11 @@ public List getXEIIngredients() { private List getXEIIngredients(CycleItemStackHandler handler, int index) { var stackList = handler.getStackList(index); - if (LDLib.isJeiLoaded()) { + if (GTCEu.Mods.isJEILoaded()) { return JEICallWrapper.getJEIIngredients(stackList, this::getRealStack); - } else if (LDLib.isReiLoaded()) { + } else if (GTCEu.Mods.isREILoaded()) { return REICallWrapper.getREIIngredients(stackList, this::getRealStack); - } else if (LDLib.isEmiLoaded()) { + } else if (GTCEu.Mods.isEMILoaded()) { return EMICallWrapper.getEMIIngredients(stackList, getXEIChance(), this::getRealStack); } return Collections.emptyList(); @@ -254,11 +254,11 @@ private List getXEIIngredients(CycleItemStackHandler handler, int index) private List getXEIIngredientsClickable(CycleItemStackHandler handler, int index) { var stackList = handler.getStackList(index); - if (LDLib.isJeiLoaded()) { + if (GTCEu.Mods.isJEILoaded()) { return JEICallWrapper.getJEIIngredientsClickable(stackList, getPosition(), getSize(), this::getRealStack); - } else if (LDLib.isReiLoaded()) { + } else if (GTCEu.Mods.isREILoaded()) { return REICallWrapper.getREIIngredients(stackList, this::getRealStack); - } else if (LDLib.isEmiLoaded()) { + } else if (GTCEu.Mods.isEMILoaded()) { return EMICallWrapper.getEMIIngredients(stackList, getXEIChance(), this::getRealStack); } return Collections.emptyList(); @@ -266,11 +266,11 @@ private List getXEIIngredientsClickable(CycleItemStackHandler handler, i private List getXEIIngredients(CycleItemEntryHandler handler, int index) { ItemEntryList entryList = handler.getEntry(index); - if (LDLib.isJeiLoaded()) { + if (GTCEu.Mods.isJEILoaded()) { return JEICallWrapper.getJEIIngredients(entryList, this::getRealStack); - } else if (LDLib.isReiLoaded()) { + } else if (GTCEu.Mods.isREILoaded()) { return REICallWrapper.getREIIngredients(entryList, this::getRealStack); - } else if (LDLib.isEmiLoaded()) { + } else if (GTCEu.Mods.isEMILoaded()) { return EMICallWrapper.getEMIIngredients(entryList, getXEIChance(), this::getRealStack); } return Collections.emptyList(); @@ -278,11 +278,11 @@ private List getXEIIngredients(CycleItemEntryHandler handler, int index) private List getXEIIngredientsClickable(CycleItemEntryHandler handler, int index) { ItemEntryList entryList = handler.getEntry(index); - if (LDLib.isJeiLoaded()) { + if (GTCEu.Mods.isJEILoaded()) { return JEICallWrapper.getJEIIngredientsClickable(entryList, getPosition(), getSize(), this::getRealStack); - } else if (LDLib.isReiLoaded()) { + } else if (GTCEu.Mods.isREILoaded()) { return REICallWrapper.getREIIngredients(entryList, this::getRealStack); - } else if (LDLib.isEmiLoaded()) { + } else if (GTCEu.Mods.isEMILoaded()) { return EMICallWrapper.getEMIIngredients(entryList, getXEIChance(), this::getRealStack); } return Collections.emptyList(); diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/TankWidget.java b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/TankWidget.java index 349ec88d5c..68fa74600c 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/TankWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/TankWidget.java @@ -1,5 +1,6 @@ package com.gregtechceu.gtceu.api.gui.widget; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.client.TooltipsHandler; import com.gregtechceu.gtceu.integration.xei.entry.fluid.FluidEntryList; import com.gregtechceu.gtceu.integration.xei.entry.fluid.FluidStackList; @@ -7,7 +8,6 @@ import com.gregtechceu.gtceu.integration.xei.handlers.fluid.CycleFluidEntryHandler; import com.gregtechceu.gtceu.integration.xei.handlers.fluid.CycleFluidStackHandler; -import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.gui.editor.annotation.Configurable; import com.lowdragmc.lowdraglib.gui.editor.annotation.LDLRegister; import com.lowdragmc.lowdraglib.gui.editor.configurator.ConfiguratorGroup; @@ -202,11 +202,11 @@ public Object getXEIIngredientOverMouse(double mouseX, double mouseY) { return getXEIIngredientsClickable(entryHandler, tank).get(0); } - if (LDLib.isJeiLoaded()) { + if (GTCEu.Mods.isJEILoaded()) { return JEICallWrapper.getJEIFluidClickable(lastFluidInTank, getPosition(), getSize()); - } else if (LDLib.isReiLoaded()) { + } else if (GTCEu.Mods.isREILoaded()) { return EntryStacks.of(REICallWrapper.toREIStack(lastFluidInTank)); - } else if (LDLib.isEmiLoaded()) { + } else if (GTCEu.Mods.isEMILoaded()) { return ForgeEmiStack.of(lastFluidInTank).setChance(XEIChance); } } @@ -223,11 +223,11 @@ public List getXEIIngredients() { return getXEIIngredientsClickable(entryHandler, tank); } - if (LDLib.isJeiLoaded()) { + if (GTCEu.Mods.isJEILoaded()) { return List.of(JEICallWrapper.getJEIFluidClickable(lastFluidInTank, getPosition(), getSize())); - } else if (LDLib.isReiLoaded()) { + } else if (GTCEu.Mods.isREILoaded()) { return List.of(EntryStacks.of(REICallWrapper.toREIStack(lastFluidInTank))); - } else if (LDLib.isEmiLoaded()) { + } else if (GTCEu.Mods.isEMILoaded()) { return List.of(ForgeEmiStack.of(lastFluidInTank).setChance(XEIChance)); } return List.of(lastFluidInTank); @@ -235,11 +235,11 @@ public List getXEIIngredients() { private List getXEIIngredients(CycleFluidStackHandler handler, int index) { FluidStackList stackList = handler.getStackList(index); - if (LDLib.isJeiLoaded()) { + if (GTCEu.Mods.isJEILoaded()) { return JEICallWrapper.getJEIIngredients(stackList); - } else if (LDLib.isReiLoaded()) { + } else if (GTCEu.Mods.isREILoaded()) { return REICallWrapper.getREIIngredients(stackList); - } else if (LDLib.isEmiLoaded()) { + } else if (GTCEu.Mods.isEMILoaded()) { return EMICallWrapper.getEMIIngredients(stackList, getXEIChance()); } return Collections.emptyList(); @@ -247,11 +247,11 @@ private List getXEIIngredients(CycleFluidStackHandler handler, int index private List getXEIIngredientsClickable(CycleFluidStackHandler handler, int index) { FluidStackList stackList = handler.getStackList(index); - if (LDLib.isJeiLoaded()) { + if (GTCEu.Mods.isJEILoaded()) { return JEICallWrapper.getJEIIngredientsClickable(stackList, getPosition(), getSize()); - } else if (LDLib.isReiLoaded()) { + } else if (GTCEu.Mods.isREILoaded()) { return REICallWrapper.getREIIngredients(stackList); - } else if (LDLib.isEmiLoaded()) { + } else if (GTCEu.Mods.isEMILoaded()) { return EMICallWrapper.getEMIIngredients(stackList, getXEIChance()); } return Collections.emptyList(); @@ -259,11 +259,11 @@ private List getXEIIngredientsClickable(CycleFluidStackHandler handler, private List getXEIIngredients(CycleFluidEntryHandler handler, int index) { FluidEntryList entryList = handler.getEntry(index); - if (LDLib.isJeiLoaded()) { + if (GTCEu.Mods.isJEILoaded()) { return JEICallWrapper.getJEIIngredients(entryList); - } else if (LDLib.isReiLoaded()) { + } else if (GTCEu.Mods.isREILoaded()) { return REICallWrapper.getREIIngredients(entryList); - } else if (LDLib.isEmiLoaded()) { + } else if (GTCEu.Mods.isEMILoaded()) { return EMICallWrapper.getEMIIngredients(entryList, getXEIChance()); } return Collections.emptyList(); @@ -271,11 +271,11 @@ private List getXEIIngredients(CycleFluidEntryHandler handler, int index private List getXEIIngredientsClickable(CycleFluidEntryHandler handler, int index) { FluidEntryList entryList = handler.getEntry(index); - if (LDLib.isJeiLoaded()) { + if (GTCEu.Mods.isJEILoaded()) { return JEICallWrapper.getJEIIngredientsClickable(entryList, getPosition(), getSize()); - } else if (LDLib.isReiLoaded()) { + } else if (GTCEu.Mods.isREILoaded()) { return REICallWrapper.getREIIngredients(entryList); - } else if (LDLib.isEmiLoaded()) { + } else if (GTCEu.Mods.isEMILoaded()) { return EMICallWrapper.getEMIIngredients(entryList, getXEIChance()); } return Collections.emptyList(); @@ -318,7 +318,7 @@ public List getFullTooltipTexts() { @Override public void setCurrentJEIRenderedIngredient(Object ingredient) { - if (LDLib.isJeiLoaded()) { + if (GTCEu.Mods.isJEILoaded()) { currentJEIRenderedIngredient = ingredient instanceof FluidStack f ? f : null; } else { currentJEIRenderedIngredient = null; diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/TagPrefixItem.java b/src/main/java/com/gregtechceu/gtceu/api/item/TagPrefixItem.java index 11b23d0da7..fc103beb22 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/TagPrefixItem.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/TagPrefixItem.java @@ -1,5 +1,6 @@ package com.gregtechceu.gtceu.api.item; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.data.chemical.material.properties.DustProperty; @@ -9,8 +10,6 @@ import com.gregtechceu.gtceu.client.renderer.item.TagPrefixItemRenderer; import com.gregtechceu.gtceu.common.data.GTDamageTypes; -import com.lowdragmc.lowdraglib.Platform; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.client.color.item.ItemColor; import net.minecraft.network.chat.Component; @@ -47,7 +46,7 @@ public TagPrefixItem(Properties properties, TagPrefix tagPrefix, Material materi super(properties); this.tagPrefix = tagPrefix; this.material = material; - if (Platform.isClient()) { + if (GTCEu.isClientSide()) { TagPrefixItemRenderer.create(this, tagPrefix.materialIconType(), material.getMaterialIconSet()); } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/component/ElectricStats.java b/src/main/java/com/gregtechceu/gtceu/api/item/component/ElectricStats.java index eff4f272f1..a179e27287 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/component/ElectricStats.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/component/ElectricStats.java @@ -104,7 +104,7 @@ public void inventoryTick(ItemStack stack, Level level, Entity entity, int slotI isInDischargeMode(stack) && electricItem.getCharge() > 0L) { long transferLimit = electricItem.getTransferLimit(); - if (GTCEu.isCuriosLoaded()) { + if (GTCEu.Mods.isCuriosLoaded()) { IItemHandler curios = CuriosApi.getCuriosInventory(player) .map(ICuriosItemHandler::getEquippedCurios) .orElse(EmptyHandler.INSTANCE); diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTAxeItem.java b/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTAxeItem.java index f3d1573194..6125513c54 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTAxeItem.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTAxeItem.java @@ -1,12 +1,11 @@ package com.gregtechceu.gtceu.api.item.tool; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.item.IGTTool; import com.gregtechceu.gtceu.api.sound.SoundEntry; import com.gregtechceu.gtceu.client.renderer.item.ToolItemRenderer; -import com.lowdragmc.lowdraglib.Platform; - import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; @@ -54,7 +53,7 @@ protected GTAxeItem(GTToolType toolType, MaterialToolTier tier, Material materia this.material = material; this.electricTier = toolType.electricTier; this.toolStats = toolStats; - if (Platform.isClient()) { + if (GTCEu.isClientSide()) { ToolItemRenderer.create(this, toolType); } definition$init(); diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTHoeItem.java b/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTHoeItem.java index 68a05d9b9e..c400840653 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTHoeItem.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTHoeItem.java @@ -1,12 +1,11 @@ package com.gregtechceu.gtceu.api.item.tool; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.item.IGTTool; import com.gregtechceu.gtceu.api.sound.SoundEntry; import com.gregtechceu.gtceu.client.renderer.item.ToolItemRenderer; -import com.lowdragmc.lowdraglib.Platform; - import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; @@ -53,7 +52,7 @@ protected GTHoeItem(GTToolType toolType, MaterialToolTier tier, Material materia this.material = material; this.electricTier = toolType.electricTier; this.toolStats = toolStats; - if (Platform.isClient()) { + if (GTCEu.isClientSide()) { ToolItemRenderer.create(this, toolType); } definition$init(); diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTShovelItem.java b/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTShovelItem.java index 4f031a34d3..ed4edaf533 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTShovelItem.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTShovelItem.java @@ -1,12 +1,11 @@ package com.gregtechceu.gtceu.api.item.tool; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.item.IGTTool; import com.gregtechceu.gtceu.api.sound.SoundEntry; import com.gregtechceu.gtceu.client.renderer.item.ToolItemRenderer; -import com.lowdragmc.lowdraglib.Platform; - import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; @@ -53,7 +52,7 @@ protected GTShovelItem(GTToolType toolType, MaterialToolTier tier, Material mate this.material = material; this.electricTier = toolType.electricTier; this.toolStats = toolStats; - if (Platform.isClient()) { + if (GTCEu.isClientSide()) { ToolItemRenderer.create(this, toolType); } definition$init(); diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTSwordItem.java b/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTSwordItem.java index f65cd3b950..ec679583cd 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTSwordItem.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTSwordItem.java @@ -1,12 +1,11 @@ package com.gregtechceu.gtceu.api.item.tool; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.item.IGTTool; import com.gregtechceu.gtceu.api.sound.SoundEntry; import com.gregtechceu.gtceu.client.renderer.item.ToolItemRenderer; -import com.lowdragmc.lowdraglib.Platform; - import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; @@ -53,7 +52,7 @@ protected GTSwordItem(GTToolType toolType, MaterialToolTier tier, Material mater this.material = material; this.electricTier = toolType.electricTier; this.toolStats = toolStats; - if (Platform.isClient()) { + if (GTCEu.isClientSide()) { ToolItemRenderer.create(this, toolType); } definition$init(); diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTToolItem.java b/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTToolItem.java index 9ad2a21888..552ff5ebc1 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTToolItem.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTToolItem.java @@ -1,12 +1,11 @@ package com.gregtechceu.gtceu.api.item.tool; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.item.IGTTool; import com.gregtechceu.gtceu.api.sound.SoundEntry; import com.gregtechceu.gtceu.client.renderer.item.ToolItemRenderer; -import com.lowdragmc.lowdraglib.Platform; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; @@ -62,7 +61,7 @@ protected GTToolItem(GTToolType toolType, MaterialToolTier tier, Material materi this.material = material; this.electricTier = toolType.electricTier; this.toolStats = definition; - if (Platform.isClient()) { + if (GTCEu.isClientSide()) { ToolItemRenderer.create(this, toolType); } definition$init(); diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/IMachineBlockEntity.java b/src/main/java/com/gregtechceu/gtceu/api/machine/IMachineBlockEntity.java index 35995154c4..72c583f910 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/IMachineBlockEntity.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/IMachineBlockEntity.java @@ -59,7 +59,6 @@ default long getOffsetTimer() { var server = level().getServer(); if (server != null) return server.getTickCount() + getOffset(); - return getOffset(); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/MetaMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/MetaMachine.java index 2fb3c5ba71..9b8a88ab0b 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/MetaMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/MetaMachine.java @@ -1,5 +1,6 @@ package com.gregtechceu.gtceu.api.machine; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.block.BlockProperties; import com.gregtechceu.gtceu.api.block.IAppearance; import com.gregtechceu.gtceu.api.block.MetaMachineBlock; @@ -26,7 +27,6 @@ import com.gregtechceu.gtceu.common.cover.ItemFilterCover; import com.gregtechceu.gtceu.common.item.tool.behavior.ToolModeSwitchBehavior; -import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; import com.lowdragmc.lowdraglib.syncdata.IEnhancedManaged; @@ -155,7 +155,7 @@ public BlockState getBlockState() { } public boolean isRemote() { - return getLevel() == null ? LDLib.isRemote() : getLevel().isClientSide; + return getLevel() == null ? GTCEu.isClientThread() : getLevel().isClientSide; } public void notifyBlockUpdate() { diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IUIMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IUIMachine.java index 567a487526..81bb408d6f 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IUIMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IUIMachine.java @@ -1,8 +1,8 @@ package com.gregtechceu.gtceu.api.machine.feature; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.gui.factory.MachineUIFactory; -import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.gui.modular.IUIHolder; import net.minecraft.server.level.ServerPlayer; @@ -41,7 +41,7 @@ default boolean isInvalid() { @Override default boolean isRemote() { var level = self().getLevel(); - return level == null ? LDLib.isRemote() : level.isClientSide; + return level == null ? GTCEu.isClientThread() : level.isClientSide; } @Override diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableItemStackHandler.java b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableItemStackHandler.java index eb43aeb94d..b5eeade6d7 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableItemStackHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableItemStackHandler.java @@ -26,7 +26,9 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import java.util.function.Function; /** @@ -166,7 +168,7 @@ public static List handleRecipe(IO io, GTRecipe recipe, List actions) { - if (!GTCEu.isKubeJSLoaded()) return null; + if (!GTCEu.Mods.isKubeJSLoaded()) return null; // noinspection unchecked var actioned = KJSCallWrapper.applyIngredientAction(storage, index, (List) actions); if (!actioned.isEmpty()) return actioned; diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/RecipeLogic.java b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/RecipeLogic.java index 7989ddc2b5..11040a748d 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/RecipeLogic.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/RecipeLogic.java @@ -1,5 +1,6 @@ package com.gregtechceu.gtceu.api.machine.trait; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.capability.IWorkable; import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.capability.recipe.RecipeCapability; @@ -13,7 +14,6 @@ import com.gregtechceu.gtceu.api.sound.AutoReleasedSound; import com.gregtechceu.gtceu.config.ConfigHolder; -import com.lowdragmc.lowdraglib.Platform; import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.syncdata.IEnhancedManaged; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; @@ -183,7 +183,7 @@ public boolean needFuel() { * it should be called on the server side restrictively. */ public RecipeManager getRecipeManager() { - return Platform.getMinecraftServer().getRecipeManager(); + return GTCEu.getMinecraftServer().getRecipeManager(); } public void serverTick() { diff --git a/src/main/java/com/gregtechceu/gtceu/api/pattern/MultiblockWorldSavedData.java b/src/main/java/com/gregtechceu/gtceu/api/pattern/MultiblockWorldSavedData.java index 735990c755..3d0be413e6 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/pattern/MultiblockWorldSavedData.java +++ b/src/main/java/com/gregtechceu/gtceu/api/pattern/MultiblockWorldSavedData.java @@ -3,8 +3,6 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiController; -import com.lowdragmc.lowdraglib.Platform; - import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.server.level.ServerLevel; @@ -114,7 +112,7 @@ public void removeAsyncLogic(IMultiController controller) { private void searchingTask() { try { - if (Platform.isServerNotSafe()) return; + if (!GTCEu.canGetServerLevel()) return; IN_SERVICE.set(true); for (var controller : controllers) { try { @@ -132,7 +130,7 @@ private void searchingTask() { } public static boolean isThreadService() { - return IN_SERVICE.get() && !Platform.isServerNotSafe(); + return IN_SERVICE.get() && GTCEu.canGetServerLevel(); } public void releaseExecutorService() { diff --git a/src/main/java/com/gregtechceu/gtceu/api/pattern/predicates/SimplePredicate.java b/src/main/java/com/gregtechceu/gtceu/api/pattern/predicates/SimplePredicate.java index 21160288f0..d4082a60db 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/pattern/predicates/SimplePredicate.java +++ b/src/main/java/com/gregtechceu/gtceu/api/pattern/predicates/SimplePredicate.java @@ -1,5 +1,6 @@ package com.gregtechceu.gtceu.api.pattern.predicates; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.pattern.MultiblockState; import com.gregtechceu.gtceu.api.pattern.TraceabilityPredicate; @@ -7,7 +8,6 @@ import com.gregtechceu.gtceu.api.pattern.error.SinglePredicateError; import com.gregtechceu.gtceu.data.lang.LangHandler; -import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.utils.BlockInfo; import net.minecraft.client.Minecraft; @@ -173,7 +173,7 @@ public boolean testLayer(MultiblockState blockWorldState) { } public List getCandidates() { - if (LDLib.isClient()) { + if (GTCEu.isClientSide()) { return candidates == null ? Collections.emptyList() : Arrays.stream(this.candidates.get()).filter(info -> info.getBlockState().getBlock() != Blocks.AIR) .map(blockInfo -> blockInfo.getItemStackForm(Minecraft.getInstance().level, BlockPos.ZERO)) diff --git a/src/main/java/com/gregtechceu/gtceu/api/pipenet/IPipeNode.java b/src/main/java/com/gregtechceu/gtceu/api/pipenet/IPipeNode.java index 741185dd2b..84a0ce52ef 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/pipenet/IPipeNode.java +++ b/src/main/java/com/gregtechceu/gtceu/api/pipenet/IPipeNode.java @@ -1,5 +1,6 @@ package com.gregtechceu.gtceu.api.pipenet; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.block.PipeBlock; import com.gregtechceu.gtceu.api.blockentity.IPaintable; import com.gregtechceu.gtceu.api.blockentity.ITickSubscription; @@ -7,8 +8,6 @@ import com.gregtechceu.gtceu.api.capability.ICoverable; import com.gregtechceu.gtceu.api.data.chemical.material.Material; -import com.lowdragmc.lowdraglib.LDLib; - import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.server.level.ServerLevel; @@ -107,7 +106,7 @@ default boolean isInValid() { default boolean isRemote() { var level = getPipeLevel(); if (level == null) { - return LDLib.isRemote(); + return GTCEu.isClientThread(); } return level.isClientSide; } diff --git a/src/main/java/com/gregtechceu/gtceu/api/pipenet/PipeNetWalker.java b/src/main/java/com/gregtechceu/gtceu/api/pipenet/PipeNetWalker.java index 64d904b00e..25bb61229c 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/pipenet/PipeNetWalker.java +++ b/src/main/java/com/gregtechceu/gtceu/api/pipenet/PipeNetWalker.java @@ -3,8 +3,6 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.utils.GTUtil; -import com.lowdragmc.lowdraglib.LDLib; - import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.server.level.ServerLevel; @@ -139,7 +137,7 @@ public void traversePipeNet(int maxWalks) { running = false; root.walked.clear(); if (i >= maxWalks) - LDLib.LOGGER.warn("The walker reached the maximum amount of walks {}", i); + GTCEu.LOGGER.warn("The walker reached the maximum amount of walks {}", i); invalid = true; } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipeSerializer.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipeSerializer.java index 9e147d54a0..8848adc348 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipeSerializer.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipeSerializer.java @@ -36,7 +36,7 @@ */ public class GTRecipeSerializer implements RecipeSerializer { - public static final Codec CODEC = makeCodec(GTCEu.isKubeJSLoaded()); + public static final Codec CODEC = makeCodec(GTCEu.Mods.isKubeJSLoaded()); public static final GTRecipeSerializer SERIALIZER = new GTRecipeSerializer(); @@ -131,7 +131,7 @@ public GTRecipe fromNetwork(@NotNull ResourceLocation id, @NotNull FriendlyByteB List conditions = buf.readCollection(c -> new ArrayList<>(), GTRecipeSerializer::conditionReader); List ingredientActions = new ArrayList<>(); - if (GTCEu.isKubeJSLoaded()) { + if (GTCEu.Mods.isKubeJSLoaded()) { ingredientActions = KJSCallWrapper.getIngredientActions(buf); } CompoundTag data = buf.readNbt(); @@ -186,7 +186,7 @@ public void toNetwork(FriendlyByteBuf buf, GTRecipe recipe) { (buf1, logic) -> buf1.writeUtf(GTRegistries.CHANCE_LOGICS.getKey(logic))); buf.writeCollection(recipe.conditions, GTRecipeSerializer::conditionWriter); - if (GTCEu.isKubeJSLoaded()) { + if (GTCEu.Mods.isKubeJSLoaded()) { KJSCallWrapper.writeIngredientActions(recipe.ingredientActions, buf); } buf.writeNbt(recipe.data); diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/category/GTRecipeCategory.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/category/GTRecipeCategory.java index 76e128733f..a7ee12b579 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/category/GTRecipeCategory.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/category/GTRecipeCategory.java @@ -6,7 +6,6 @@ import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.common.data.GTRecipeTypes; -import com.lowdragmc.lowdraglib.Platform; import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.texture.ItemStackTexture; @@ -71,7 +70,7 @@ public void addRecipe(GTRecipe recipe) { } public boolean shouldRegisterDisplays() { - return (isXEIVisible || Platform.isDevEnv()) && + return (isXEIVisible || GTCEu.isDev()) && this != GTRecipeTypes.FURNACE_RECIPES.getCategory(); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/IContentSerializer.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/IContentSerializer.java index 5a145a06f4..fbae53fd2f 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/IContentSerializer.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/IContentSerializer.java @@ -2,9 +2,9 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.recipe.chance.logic.ChanceLogic; +import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.lowdragmc.lowdraglib.LDLib; -import com.lowdragmc.lowdraglib.Platform; import net.minecraft.core.HolderLookup; import net.minecraft.nbt.NbtOps; @@ -20,12 +20,12 @@ public interface IContentSerializer { default void toNetwork(FriendlyByteBuf buf, T content) { - RegistryOps ops = RegistryOps.create(JsonOps.INSTANCE, Platform.getFrozenRegistry()); + RegistryOps ops = RegistryOps.create(JsonOps.INSTANCE, GTRegistries.builtinRegistry()); buf.writeUtf(codec().encodeStart(ops, content).getOrThrow(false, GTCEu.LOGGER::error).toString()); } default T fromNetwork(FriendlyByteBuf buf) { - RegistryOps ops = RegistryOps.create(JsonOps.INSTANCE, Platform.getFrozenRegistry()); + RegistryOps ops = RegistryOps.create(JsonOps.INSTANCE, GTRegistries.builtinRegistry()); return codec().parse(ops, LDLib.GSON.fromJson(buf.readUtf(), JsonElement.class)).getOrThrow(false, GTCEu.LOGGER::error); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/GTRecipeLookup.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/GTRecipeLookup.java index 626acd6ba1..e80ad531d6 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/GTRecipeLookup.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/GTRecipeLookup.java @@ -10,8 +10,6 @@ import com.gregtechceu.gtceu.common.item.armor.PowerlessJetpack; import com.gregtechceu.gtceu.config.ConfigHolder; -import com.lowdragmc.lowdraglib.Platform; - import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.world.item.ItemStack; @@ -515,7 +513,7 @@ private boolean recurseIngredientTreeAdd(@NotNull GTRecipe recipe, // handle the existing branch if (v.left().isEmpty() || v.left().get() != recipe) { // the recipe already there was not the one being added, so there is a conflict - if (ConfigHolder.INSTANCE.dev.debug || Platform.isDevEnv()) { + if (ConfigHolder.INSTANCE.dev.debug || GTCEu.isDev()) { GTCEu.LOGGER.warn( "Recipe duplicate or conflict found in GTRecipeType {} and was not added. See next lines for details", BuiltInRegistries.RECIPE_TYPE.getKey(this.recipeType)); diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/ui/GTRecipeTypeUI.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/ui/GTRecipeTypeUI.java index 5a96ac2d7b..bfb3d06797 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/ui/GTRecipeTypeUI.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/ui/GTRecipeTypeUI.java @@ -1,5 +1,6 @@ package com.gregtechceu.gtceu.api.recipe.ui; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.capability.recipe.FluidRecipeCapability; import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.capability.recipe.ItemRecipeCapability; @@ -19,8 +20,6 @@ import com.gregtechceu.gtceu.integration.jei.recipe.GTRecipeJEICategory; import com.gregtechceu.gtceu.integration.rei.recipe.GTRecipeREICategory; -import com.lowdragmc.lowdraglib.LDLib; -import com.lowdragmc.lowdraglib.Platform; import com.lowdragmc.lowdraglib.gui.editor.configurator.IConfigurableWidget; import com.lowdragmc.lowdraglib.gui.editor.data.Resources; import com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup; @@ -101,10 +100,10 @@ public GTRecipeTypeUI(@NotNull GTRecipeType recipeType) { public CompoundTag getCustomUI() { if (this.customUICache == null) { ResourceManager resourceManager = null; - if (LDLib.isClient()) { + if (GTCEu.isClientSide()) { resourceManager = Minecraft.getInstance().getResourceManager(); - } else if (Platform.getMinecraftServer() != null) { - resourceManager = Platform.getMinecraftServer().getResourceManager(); + } else if (GTCEu.getMinecraftServer() != null) { + resourceManager = GTCEu.getMinecraftServer().getResourceManager(); } if (resourceManager == null) { this.customUICache = new CompoundTag(); @@ -239,25 +238,25 @@ public IEditableUI createEditableUITemplate(final boo progress.add(dualProgressWidget); }); // add recipe button - if (!isJEI && (LDLib.isReiLoaded() || LDLib.isJeiLoaded() || LDLib.isEmiLoaded())) { + if (!isJEI && (GTCEu.Mods.isREILoaded() || GTCEu.Mods.isJEILoaded() || GTCEu.Mods.isEMILoaded())) { for (Widget widget : progress) { template.addWidget(new ButtonWidget(widget.getPosition().x, widget.getPosition().y, widget.getSize().width, widget.getSize().height, IGuiTexture.EMPTY, cd -> { if (cd.isRemote) { - if (LDLib.isReiLoaded()) { + if (GTCEu.Mods.isREILoaded()) { ViewSearchBuilder.builder().addCategories( recipeType.getCategories().stream() .filter(GTRecipeCategory::isXEIVisible) .map(GTRecipeREICategory::machineCategory) .collect(Collectors.toList())) .open(); - } else if (LDLib.isJeiLoaded()) { + } else if (GTCEu.Mods.isJEILoaded()) { JEIPlugin.jeiRuntime.getRecipesGui().showTypes( recipeType.getCategories().stream() .filter(GTRecipeCategory::isXEIVisible) .map(GTRecipeJEICategory::machineType) .collect(Collectors.toList())); - } else if (LDLib.isEmiLoaded()) { + } else if (GTCEu.Mods.isEMILoaded()) { EmiApi.displayRecipeCategory( GTRecipeEMICategory.machineCategory(recipeType.getCategory())); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/registry/GTRegistries.java b/src/main/java/com/gregtechceu/gtceu/api/registry/GTRegistries.java index 4c831ed956..e8abf3052e 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/registry/GTRegistries.java +++ b/src/main/java/com/gregtechceu/gtceu/api/registry/GTRegistries.java @@ -15,10 +15,10 @@ import com.gregtechceu.gtceu.api.recipe.condition.RecipeConditionType; import com.gregtechceu.gtceu.api.sound.SoundEntry; -import com.lowdragmc.lowdraglib.Platform; - +import net.minecraft.client.Minecraft; import net.minecraft.core.Registry; import net.minecraft.core.RegistryAccess; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; @@ -34,6 +34,7 @@ import net.minecraftforge.registries.ForgeRegistries; import com.mojang.serialization.Codec; +import org.jetbrains.annotations.ApiStatus; /** * @author KilaBash @@ -65,7 +66,6 @@ public final class GTRegistries { public static final GTRegistry.RL ORE_VEINS = new GTRegistry.RL<>(GTCEu.id("ore_vein")); public static final GTRegistry.RL DIMENSION_MARKERS = new GTRegistry.RL<>( GTCEu.id("dimension_marker")); - public static final DeferredRegister> TRUNK_PLACER_TYPE = DeferredRegister .create(Registries.TRUNK_PLACER_TYPE, GTCEu.MOD_ID); public static final DeferredRegister> PLACEMENT_MODIFIER = DeferredRegister @@ -101,7 +101,25 @@ public static void init(IEventBus eventBus) { GLOBAL_LOOT_MODIFIES.register(eventBus); } + private static final RegistryAccess BLANK = RegistryAccess.fromRegistryOfRegistries(BuiltInRegistries.REGISTRY); + private static RegistryAccess FROZEN = BLANK; + + /** + * You shouldn't call it, you should probably not even look at it just to be extra safe + * + * @param registryAccess the new value to set to the frozen registry access + */ + @ApiStatus.Internal + public static void updateFrozenRegistry(RegistryAccess registryAccess) { + FROZEN = registryAccess; + } + public static RegistryAccess builtinRegistry() { - return Platform.getFrozenRegistry(); + if (FROZEN == BLANK && GTCEu.isClientThread()) { + if (Minecraft.getInstance().getConnection() != null) { + return Minecraft.getInstance().getConnection().registryAccess(); + } + } + return FROZEN; } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/MachineBuilder.java b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/MachineBuilder.java index 7f43c9fef1..87d8e01355 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/MachineBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/MachineBuilder.java @@ -1,5 +1,6 @@ package com.gregtechceu.gtceu.api.registry.registrate; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.block.IMachineBlock; import com.gregtechceu.gtceu.api.blockentity.MetaMachineBlockEntity; @@ -22,7 +23,6 @@ import com.gregtechceu.gtceu.common.data.GTRecipeModifiers; import com.gregtechceu.gtceu.config.ConfigHolder; -import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.client.renderer.IRenderer; import net.minecraft.MethodsReturnNonnullByDefault; @@ -61,7 +61,10 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Objects; import java.util.function.*; import javax.annotation.ParametersAreNonnullByDefault; @@ -380,7 +383,7 @@ public DEFINITION register() { definition.setEditableUI(editableUI); } definition.setAppearance(appearance); - definition.setRenderer(LDLib.isClient() ? renderer.get() : IRenderer.EMPTY); + definition.setRenderer(GTCEu.isClientSide() ? renderer.get() : IRenderer.EMPTY); definition.setShape(shape); definition.setDefaultPaintingColor(paintingColor); definition.setRenderXEIPreview(renderMultiblockXEIPreview); diff --git a/src/main/java/com/gregtechceu/gtceu/api/transfer/fluid/FluidHandlerList.java b/src/main/java/com/gregtechceu/gtceu/api/transfer/fluid/FluidHandlerList.java index 34e6e9fef7..7c26dd9688 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/transfer/fluid/FluidHandlerList.java +++ b/src/main/java/com/gregtechceu/gtceu/api/transfer/fluid/FluidHandlerList.java @@ -1,6 +1,6 @@ package com.gregtechceu.gtceu.api.transfer.fluid; -import com.lowdragmc.lowdraglib.LDLib; +import com.gregtechceu.gtceu.GTCEu; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; @@ -141,7 +141,7 @@ public CompoundTag serializeNBT() { if (handler instanceof INBTSerializable serializable) { list.add(serializable.serializeNBT()); } else { - LDLib.LOGGER.warn("[FluidHandlerList] internal tank doesn't support serialization"); + GTCEu.LOGGER.warn("[FluidHandlerList] internal tank doesn't support serialization"); } } tag.put("tanks", list); @@ -156,7 +156,7 @@ public void deserializeNBT(CompoundTag nbt) { if (handlers[i] instanceof INBTSerializable serializable) { serializable.deserializeNBT(list.get(i)); } else { - LDLib.LOGGER.warn("[FluidHandlerList] internal tank doesn't support serialization"); + GTCEu.LOGGER.warn("[FluidHandlerList] internal tank doesn't support serialization"); } } } diff --git a/src/main/java/com/gregtechceu/gtceu/client/ClientProxy.java b/src/main/java/com/gregtechceu/gtceu/client/ClientProxy.java index 8b355dc4c3..c4219eda04 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/ClientProxy.java +++ b/src/main/java/com/gregtechceu/gtceu/client/ClientProxy.java @@ -1,5 +1,6 @@ package com.gregtechceu.gtceu.client; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.data.worldgen.GTOreDefinition; import com.gregtechceu.gtceu.api.data.worldgen.bedrockfluid.BedrockFluidDefinition; @@ -21,8 +22,6 @@ import com.gregtechceu.gtceu.integration.map.layer.builtin.OreRenderLayer; import com.gregtechceu.gtceu.utils.input.KeyBind; -import com.lowdragmc.lowdraglib.Platform; - import net.minecraft.client.model.BoatModel; import net.minecraft.client.model.ChestBoatModel; import net.minecraft.client.renderer.blockentity.HangingSignRenderer; @@ -57,7 +56,7 @@ public ClientProxy() { } public static void init() { - if (!Platform.isDatagen()) { + if (!GTCEu.isDataGen()) { ClientCacheManager.registerClientCache(GTClientCache.instance, "gtceu"); Layers.registerLayer(OreRenderLayer::new, "ore_veins"); Layers.registerLayer(FluidRenderLayer::new, "bedrock_fluids"); @@ -101,7 +100,7 @@ public void onRegisterParticleProviders(RegisterParticleProvidersEvent event) { @SubscribeEvent public void onClientSetup(FMLClientSetupEvent event) { if (ConfigHolder.INSTANCE.compat.minimap.toggle.ftbChunksIntegration && - Platform.isModLoaded(GTValues.MODID_FTB_CHUNKS)) { + GTCEu.isModLoaded(GTValues.MODID_FTB_CHUNKS)) { FTBChunksPlugin.addEventListeners(); } } diff --git a/src/main/java/com/gregtechceu/gtceu/client/model/WorkableOverlayModel.java b/src/main/java/com/gregtechceu/gtceu/client/model/WorkableOverlayModel.java index eaae6ae24c..d1bf380f27 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/model/WorkableOverlayModel.java +++ b/src/main/java/com/gregtechceu/gtceu/client/model/WorkableOverlayModel.java @@ -1,10 +1,10 @@ package com.gregtechceu.gtceu.client.model; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.client.util.StaticFaceBakery; import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.utils.GTUtil; -import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.client.model.ModelFactory; import com.lowdragmc.lowdraglib.client.renderer.IItemRendererProvider; @@ -126,7 +126,7 @@ private TextureAtlasSprite getTextureAtlasSprite(boolean active, boolean working public WorkableOverlayModel(ResourceLocation location) { this.location = location; - if (LDLib.isClient()) { + if (GTCEu.isClientSide()) { this.sprites = new EnumMap<>(OverlayFace.class); } } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/block/PipeBlockRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/block/PipeBlockRenderer.java index 389b231f6a..fafbe4f1e7 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/block/PipeBlockRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/block/PipeBlockRenderer.java @@ -1,5 +1,6 @@ package com.gregtechceu.gtceu.client.renderer.block; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialIconType; import com.gregtechceu.gtceu.api.data.tag.TagPrefix; import com.gregtechceu.gtceu.api.pipenet.IPipeNode; @@ -7,7 +8,6 @@ import com.gregtechceu.gtceu.client.renderer.cover.ICoverableRenderer; import com.gregtechceu.gtceu.common.data.GTMaterialBlocks; -import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.client.model.ModelFactory; import com.lowdragmc.lowdraglib.client.renderer.IRenderer; @@ -16,7 +16,7 @@ import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.resources.model.*; +import net.minecraft.client.resources.model.BakedModel; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.resources.ResourceLocation; @@ -49,7 +49,7 @@ public class PipeBlockRenderer implements IRenderer, ICoverableRenderer { public PipeBlockRenderer(PipeModel pipeModel) { this.pipeModel = pipeModel; - if (LDLib.isClient()) { + if (GTCEu.isClientSide()) { registerEvent(); } } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/block/TextureOverrideRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/block/TextureOverrideRenderer.java index 71750efdc3..71ff630578 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/block/TextureOverrideRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/block/TextureOverrideRenderer.java @@ -1,8 +1,8 @@ package com.gregtechceu.gtceu.client.renderer.block; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.client.model.SpriteOverrider; -import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.client.model.ModelFactory; import net.minecraft.client.renderer.block.model.BlockModel; @@ -40,7 +40,7 @@ public class TextureOverrideRenderer extends CTMModelRenderer { public TextureOverrideRenderer(ResourceLocation model, @NotNull Map override) { super(model); this.override = override; - if (LDLib.isClient()) { + if (GTCEu.isClientSide()) { registerEvent(); } } @@ -50,7 +50,7 @@ public TextureOverrideRenderer(ResourceLocation model, super(model); this.override = Collections.emptyMap(); this.overrideSupplier = overrideSupplier; - if (LDLib.isClient()) { + if (GTCEu.isClientSide()) { registerEvent(); } } @@ -58,7 +58,7 @@ public TextureOverrideRenderer(ResourceLocation model, public TextureOverrideRenderer(ResourceLocation model) { super(model); this.override = Collections.emptyMap(); - if (LDLib.isClient()) { + if (GTCEu.isClientSide()) { registerEvent(); } } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/ConveyorCoverRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/ConveyorCoverRenderer.java index 8cbfc2a8f4..611d268076 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/ConveyorCoverRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/ConveyorCoverRenderer.java @@ -6,7 +6,6 @@ import com.gregtechceu.gtceu.client.util.StaticFaceBakery; import com.gregtechceu.gtceu.common.cover.ConveyorCover; -import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.client.model.ModelFactory; import net.minecraft.client.renderer.block.model.BakedQuad; @@ -40,7 +39,7 @@ public class ConveyorCoverRenderer implements ICoverRenderer { .id("block/cover/overlay_conveyor_inverted_emissive"); protected ConveyorCoverRenderer() { - if (LDLib.isClient()) { + if (GTCEu.isClientSide()) { registerEvent(); } } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/FluidRegulatorCoverRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/FluidRegulatorCoverRenderer.java index 735d502630..9ca4807998 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/FluidRegulatorCoverRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/FluidRegulatorCoverRenderer.java @@ -6,7 +6,6 @@ import com.gregtechceu.gtceu.client.util.StaticFaceBakery; import com.gregtechceu.gtceu.common.cover.PumpCover; -import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.client.model.ModelFactory; import net.minecraft.client.renderer.block.model.BakedQuad; @@ -37,7 +36,7 @@ public class FluidRegulatorCoverRenderer implements ICoverRenderer { public final static ResourceLocation PUMP_OVERLAY_IN = GTCEu.id("block/cover/overlay_pump_inverted"); protected FluidRegulatorCoverRenderer() { - if (LDLib.isClient()) { + if (GTCEu.isClientSide()) { registerEvent(); } } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/PumpCoverRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/PumpCoverRenderer.java index 02efbe0c6e..30b92cff69 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/PumpCoverRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/PumpCoverRenderer.java @@ -6,7 +6,6 @@ import com.gregtechceu.gtceu.client.util.StaticFaceBakery; import com.gregtechceu.gtceu.common.cover.PumpCover; -import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.client.model.ModelFactory; import net.minecraft.client.renderer.block.model.BakedQuad; @@ -37,7 +36,7 @@ public class PumpCoverRenderer implements ICoverRenderer { public final static ResourceLocation PUMP_OVERLAY_IN = GTCEu.id("block/cover/overlay_pump_inverted"); protected PumpCoverRenderer() { - if (LDLib.isClient()) { + if (GTCEu.isClientSide()) { registerEvent(); } } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/RobotArmCoverRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/RobotArmCoverRenderer.java index 1a953cf9db..3eae8fa24b 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/RobotArmCoverRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/RobotArmCoverRenderer.java @@ -6,7 +6,6 @@ import com.gregtechceu.gtceu.client.util.StaticFaceBakery; import com.gregtechceu.gtceu.common.cover.RobotArmCover; -import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.client.model.ModelFactory; import net.minecraft.client.renderer.block.model.BakedQuad; @@ -34,7 +33,7 @@ public class RobotArmCoverRenderer implements ICoverRenderer { public final static ResourceLocation AR_OVERLAY_IN = GTCEu.id("block/cover/overlay_arm_inverted_emissive"); protected RobotArmCoverRenderer() { - if (LDLib.isClient()) { + if (GTCEu.isClientSide()) { registerEvent(); } } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/SimpleCoverRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/SimpleCoverRenderer.java index 8f1d7f0f9d..b761f531ac 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/SimpleCoverRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/SimpleCoverRenderer.java @@ -1,9 +1,9 @@ package com.gregtechceu.gtceu.client.renderer.cover; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.cover.CoverBehavior; import com.gregtechceu.gtceu.client.util.StaticFaceBakery; -import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.client.model.ModelFactory; import com.lowdragmc.lowdraglib.utils.ResourceHelper; @@ -35,7 +35,7 @@ public class SimpleCoverRenderer implements ICoverRenderer { public SimpleCoverRenderer(ResourceLocation texture) { this.texture = texture; - if (LDLib.isClient()) { + if (GTCEu.isClientSide()) { registerEvent(); } } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/FusionReactorRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/FusionReactorRenderer.java index 176f636da2..3476c1b384 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/FusionReactorRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/FusionReactorRenderer.java @@ -33,7 +33,7 @@ public void render(BlockEntity blockEntity, float partialTicks, PoseStack stack, int combinedLight, int combinedOverlay) { if (blockEntity instanceof IMachineBlockEntity machineBlockEntity && machineBlockEntity.getMetaMachine() instanceof FusionReactorMachine machine) { - if (GTCEu.isShimmerLoaded()) { + if (GTCEu.Mods.isShimmerLoaded()) { PoseStack finalStack = RenderUtils.copyPoseStack(stack); BloomUtils.entityBloom(source -> renderLightRing(machine, partialTicks, finalStack, source)); } else { diff --git a/src/main/java/com/gregtechceu/gtceu/common/CommonProxy.java b/src/main/java/com/gregtechceu/gtceu/common/CommonProxy.java index 985142e0de..32882139d3 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/CommonProxy.java +++ b/src/main/java/com/gregtechceu/gtceu/common/CommonProxy.java @@ -50,8 +50,6 @@ import com.gregtechceu.gtceu.integration.top.forge.TheOneProbePluginImpl; import com.gregtechceu.gtceu.utils.input.KeyBind; -import com.lowdragmc.lowdraglib.LDLib; -import com.lowdragmc.lowdraglib.Platform; import com.lowdragmc.lowdraglib.gui.factory.UIFactory; import net.minecraft.core.registries.BuiltInRegistries; @@ -91,7 +89,7 @@ public CommonProxy() { GTCEuAPI.materialManager = MaterialRegistryManager.getInstance(); ConfigHolder.init(); GTCEuAPI.initializeHighTier(); - if (Platform.isDevEnv()) { + if (GTCEu.isDev()) { ConfigHolder.INSTANCE.recipes.generateLowQualityGems = true; ConfigHolder.INSTANCE.compat.energy.enableFEConverters = true; } @@ -201,7 +199,7 @@ private static void initMaterials() { GTCEu.LOGGER.info("Registering addon Materials"); MaterialEvent materialEvent = new MaterialEvent(); ModLoader.get().postEvent(materialEvent); - if (GTCEu.isKubeJSLoaded()) { + if (GTCEu.Mods.isKubeJSLoaded()) { KJSEventWrapper.materialRegistry(); } @@ -209,7 +207,7 @@ private static void initMaterials() { // Block entirely new Materials from being added in the Post event managerInternal.closeRegistries(); ModLoader.get().postEvent(new PostMaterialEvent()); - if (GTCEu.isKubeJSLoaded()) { + if (GTCEu.Mods.isKubeJSLoaded()) { KJSEventWrapper.materialModification(); } @@ -243,7 +241,7 @@ public void commonSetup(FMLCommonSetupEvent event) { @SubscribeEvent public void loadComplete(FMLLoadCompleteEvent e) { e.enqueueWork(() -> { - if (LDLib.isModLoaded(GTValues.MODID_TOP)) { + if (GTCEu.isModLoaded(GTValues.MODID_TOP)) { GTCEu.LOGGER.info("TheOneProbe found. Enabling integration..."); TheOneProbePluginImpl.init(); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/block/SurfaceRockBlock.java b/src/main/java/com/gregtechceu/gtceu/common/block/SurfaceRockBlock.java index 9a0be75eaf..d04370bf9c 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/block/SurfaceRockBlock.java +++ b/src/main/java/com/gregtechceu/gtceu/common/block/SurfaceRockBlock.java @@ -1,12 +1,11 @@ package com.gregtechceu.gtceu.common.block; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.item.SurfaceRockBlockItem; import com.gregtechceu.gtceu.client.renderer.block.SurfaceRockRenderer; import com.gregtechceu.gtceu.integration.map.cache.server.ServerCache; -import com.lowdragmc.lowdraglib.Platform; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.client.color.block.BlockColor; import net.minecraft.client.color.item.ItemColor; @@ -62,7 +61,7 @@ public SurfaceRockBlock(Properties properties, Material material) { registerDefaultState(this.defaultBlockState().setValue(FACING, Direction.DOWN)); - if (Platform.isClient()) { + if (GTCEu.isClientSide()) { SurfaceRockRenderer.create(this); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/commands/GTCommands.java b/src/main/java/com/gregtechceu/gtceu/common/commands/GTCommands.java index ff0f9fb037..e346419276 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/commands/GTCommands.java +++ b/src/main/java/com/gregtechceu/gtceu/common/commands/GTCommands.java @@ -17,8 +17,6 @@ import com.gregtechceu.gtceu.data.loader.GTOreLoader; import com.gregtechceu.gtceu.data.pack.GTDynamicDataPack; -import com.lowdragmc.lowdraglib.Platform; - import net.minecraft.commands.CommandBuildContext; import net.minecraft.commands.CommandRuntimeException; import net.minecraft.commands.CommandSourceStack; @@ -102,7 +100,7 @@ public static void register(CommandDispatcher dispatcher, Co private static int dumpDataRegistry(CommandContext context, GTRegistry registry, Codec codec, String folder) { - Path parent = Platform.getGamePath().resolve("gtceu/dumped/data"); + Path parent = GTCEu.getGameDir().resolve("gtceu/dumped/data"); var ops = RegistryOps.create(JsonOps.INSTANCE, context.getSource().registryAccess()); int dumpedCount = 0; for (ResourceLocation id : registry.keys()) { diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/detector/AdvancedEnergyDetectorCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/detector/AdvancedEnergyDetectorCover.java index 4722ee30f0..8dc48f889f 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/detector/AdvancedEnergyDetectorCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/detector/AdvancedEnergyDetectorCover.java @@ -1,5 +1,6 @@ package com.gregtechceu.gtceu.common.cover.detector; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.capability.ICoverable; import com.gregtechceu.gtceu.api.capability.IEnergyInfoProvider; import com.gregtechceu.gtceu.api.cover.CoverDefinition; @@ -11,7 +12,6 @@ import com.gregtechceu.gtceu.utils.GTMath; import com.gregtechceu.gtceu.utils.RedstoneUtil; -import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.gui.widget.LabelWidget; import com.lowdragmc.lowdraglib.gui.widget.TextBoxWidget; import com.lowdragmc.lowdraglib.gui.widget.Widget; @@ -157,7 +157,7 @@ public void updateScreen() { } private void initializeMinMaxInputs(boolean wasPercent) { - if (LDLib.isRemote() || minValueInput == null || maxValueInput == null) + if (GTCEu.isClientThread() || minValueInput == null || maxValueInput == null) return; long energyCapacity = getEnergyInfoProvider().getEnergyInfo().capacity().longValue(); diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTDimensionMarkers.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTDimensionMarkers.java index 24b3247c2b..aec91b2262 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTDimensionMarkers.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTDimensionMarkers.java @@ -72,7 +72,7 @@ private static BlockEntry createMarker(String name) { public static void init() { ModLoader.get().postEvent(new GTCEuAPI.RegisterEvent<>(GTRegistries.DIMENSION_MARKERS, DimensionMarker.class)); - if (GTCEu.isKubeJSLoaded()) { + if (GTCEu.Mods.isKubeJSLoaded()) { GTRegistryInfo.registerFor(GTRegistries.DIMENSION_MARKERS.getRegistryName()); } GTRegistries.DIMENSION_MARKERS.freeze(); diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTElements.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTElements.java index 7c31949f65..112ef22840 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTElements.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTElements.java @@ -161,7 +161,7 @@ public static Element createAndRegister(long protons, long neutrons, long halfLi public static void init() { AddonFinder.getAddons().forEach(IGTAddon::registerElements); ModLoader.get().postEvent(new GTCEuAPI.RegisterEvent<>(GTRegistries.ELEMENTS, Element.class)); - if (GTCEu.isKubeJSLoaded()) { + if (GTCEu.Mods.isKubeJSLoaded()) { GTRegistryInfo.registerFor(GTRegistries.ELEMENTS.getRegistryName()); } GTRegistries.ELEMENTS.freeze(); diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTItems.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTItems.java index 3d6a960319..decd93b956 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTItems.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTItems.java @@ -34,8 +34,6 @@ import com.gregtechceu.gtceu.utils.GTUtil; import com.gregtechceu.gtceu.utils.SupplierMemoizer; -import com.lowdragmc.lowdraglib.LDLib; - import net.minecraft.client.color.item.ItemColor; import net.minecraft.client.renderer.item.ItemProperties; import net.minecraft.client.renderer.item.ItemPropertyFunction; @@ -76,7 +74,8 @@ import java.util.function.Supplier; import java.util.stream.Collectors; -import static com.gregtechceu.gtceu.common.data.GTCreativeModeTabs.*; +import static com.gregtechceu.gtceu.common.data.GTCreativeModeTabs.ITEM; +import static com.gregtechceu.gtceu.common.data.GTCreativeModeTabs.TOOL; import static com.gregtechceu.gtceu.common.data.GTModels.createTextureModel; import static com.gregtechceu.gtceu.common.data.GTModels.overrideModel; import static com.gregtechceu.gtceu.common.registry.GTRegistration.REGISTRATE; @@ -2655,7 +2654,7 @@ public static NonNullConsumer attach(IItemComponen public static NonNullConsumer modelPredicate(ResourceLocation predicate, Function property) { return item -> { - if (LDLib.isClient()) { + if (GTCEu.isClientSide()) { ItemProperties.register(item, predicate, (itemStack, c, l, i) -> property.apply(itemStack)); } }; @@ -2665,7 +2664,7 @@ public static NonNullConsumer modelPredicate(ResourceLocatio public static NonNullConsumer modelPredicate(ResourceLocation predicate, Supplier> property) { return item -> { - if (LDLib.isClient()) { + if (GTCEu.isClientSide()) { ItemProperties.register(item, predicate, property.get().get()); } }; diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTMachines.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTMachines.java index bf33252a42..e4291c6076 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTMachines.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTMachines.java @@ -7,8 +7,10 @@ import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.capability.recipe.ItemRecipeCapability; import com.gregtechceu.gtceu.api.data.RotationState; -import com.gregtechceu.gtceu.api.machine.*; -import com.gregtechceu.gtceu.api.machine.multiblock.*; +import com.gregtechceu.gtceu.api.machine.MachineDefinition; +import com.gregtechceu.gtceu.api.machine.SimpleTieredMachine; +import com.gregtechceu.gtceu.api.machine.multiblock.CleanroomType; +import com.gregtechceu.gtceu.api.machine.multiblock.PartAbility; import com.gregtechceu.gtceu.api.machine.steam.SimpleSteamMachine; import com.gregtechceu.gtceu.api.machine.steam.SteamBoilerMachine; import com.gregtechceu.gtceu.api.registry.GTRegistries; @@ -16,7 +18,6 @@ import com.gregtechceu.gtceu.client.util.TooltipHelper; import com.gregtechceu.gtceu.common.data.machines.*; import com.gregtechceu.gtceu.common.machine.electric.*; -import com.gregtechceu.gtceu.common.machine.multiblock.electric.*; import com.gregtechceu.gtceu.common.machine.multiblock.part.*; import com.gregtechceu.gtceu.common.machine.steam.SteamLiquidBoilerMachine; import com.gregtechceu.gtceu.common.machine.steam.SteamMinerMachine; @@ -41,16 +42,13 @@ import com.google.common.math.IntMath; import it.unimi.dsi.fastutil.Pair; -import java.util.*; +import java.util.List; import java.util.function.BiConsumer; import static com.gregtechceu.gtceu.api.GTValues.*; -import static com.gregtechceu.gtceu.api.capability.recipe.IO.*; -import static com.gregtechceu.gtceu.api.pattern.Predicates.*; -import static com.gregtechceu.gtceu.api.pattern.util.RelativeDirection.*; -import static com.gregtechceu.gtceu.common.data.GTBlocks.*; +import static com.gregtechceu.gtceu.api.capability.recipe.IO.IN; +import static com.gregtechceu.gtceu.api.capability.recipe.IO.OUT; import static com.gregtechceu.gtceu.common.data.GTCreativeModeTabs.MACHINE; -import static com.gregtechceu.gtceu.common.data.GTMaterials.*; import static com.gregtechceu.gtceu.common.data.GTRecipeTypes.DUMMY_RECIPES; import static com.gregtechceu.gtceu.common.data.GTRecipeTypes.STEAM_BOILER_RECIPES; import static com.gregtechceu.gtceu.common.data.machines.GTMachineUtils.*; @@ -1076,11 +1074,12 @@ public static void init() { GTMultiMachines.init(); GCYMMachines.init(); GTResearchMachines.init(); - if (GTCEu.isAE2Loaded()) { + + if (GTCEu.Mods.isAE2Loaded()) { GTAEMachines.init(); } - if (GTCEu.isKubeJSLoaded()) { + if (GTCEu.Mods.isKubeJSLoaded()) { GTRegistryInfo.registerFor(GTRegistries.MACHINES.getRegistryName()); } ModLoader.get().postEvent(new GTCEuAPI.RegisterEvent<>(GTRegistries.MACHINES, MachineDefinition.class)); diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeCategories.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeCategories.java index c006b57c6d..22fdc55b58 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeCategories.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeCategories.java @@ -39,7 +39,7 @@ public static GTRecipeCategory register(String categoryName, @NotNull GTRecipeTy } public static void init() { - if (GTCEu.isKubeJSLoaded()) { + if (GTCEu.Mods.isKubeJSLoaded()) { GTRegistryInfo.registerFor(GTRegistries.RECIPE_CATEGORIES.getRegistryName()); } ModLoader.get().postEvent(new GTCEuAPI.RegisterEvent<>(GTRegistries.RECIPE_CATEGORIES, GTRecipeCategory.class)); diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeTypes.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeTypes.java index a121e96242..ff2220ffd7 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeTypes.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeTypes.java @@ -681,7 +681,7 @@ public static GTRecipeType register(String name, String group, RecipeType... public static void init() { GCYMRecipeTypes.init(); - if (GTCEu.isKubeJSLoaded()) { + if (GTCEu.Mods.isKubeJSLoaded()) { GTRegistryInfo.registerFor(GTRegistries.RECIPE_TYPES.getRegistryName()); } ModLoader.get().postEvent(new GTCEuAPI.RegisterEvent<>(GTRegistries.RECIPE_TYPES, GTRecipeType.class)); diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/machines/GCYMMachines.java b/src/main/java/com/gregtechceu/gtceu/common/data/machines/GCYMMachines.java index 34dcd6c6dd..2e25302fc5 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/machines/GCYMMachines.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/machines/GCYMMachines.java @@ -17,7 +17,9 @@ import com.gregtechceu.gtceu.api.pattern.TraceabilityPredicate; import com.gregtechceu.gtceu.client.renderer.machine.gcym.LargeChemicalBathRenderer; import com.gregtechceu.gtceu.client.renderer.machine.gcym.LargeMixerRenderer; -import com.gregtechceu.gtceu.common.data.*; +import com.gregtechceu.gtceu.common.data.GTMaterials; +import com.gregtechceu.gtceu.common.data.GTRecipeModifiers; +import com.gregtechceu.gtceu.common.data.GTRecipeTypes; import com.gregtechceu.gtceu.common.machine.multiblock.electric.DistillationTowerMachine; import com.gregtechceu.gtceu.common.machine.multiblock.electric.gcym.LargeChemicalBathMachine; import com.gregtechceu.gtceu.common.machine.multiblock.electric.gcym.LargeMixerMachine; @@ -632,7 +634,7 @@ public static void init() {} .pattern(definition -> { TraceabilityPredicate casingPredicate = blocks(CASING_WATERTIGHT.get()).setMinGlobalLimited(40); TraceabilityPredicate exportPredicate = abilities(PartAbility.EXPORT_FLUIDS_1X); - if (GTCEu.isAE2Loaded()) + if (GTCEu.Mods.isAE2Loaded()) exportPredicate = exportPredicate.or(blocks(GTAEMachines.FLUID_EXPORT_HATCH_ME.get())); exportPredicate.setMaxLayerLimited(1); return FactoryBlockPattern.start(RIGHT, BACK, UP) diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/machines/GTMultiMachines.java b/src/main/java/com/gregtechceu/gtceu/common/data/machines/GTMultiMachines.java index d99011ee95..7734e21e61 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/machines/GTMultiMachines.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/machines/GTMultiMachines.java @@ -49,14 +49,13 @@ import java.util.Locale; import static com.gregtechceu.gtceu.api.GTValues.*; -import static com.gregtechceu.gtceu.api.GTValues.IV; import static com.gregtechceu.gtceu.api.pattern.Predicates.*; -import static com.gregtechceu.gtceu.api.pattern.Predicates.abilities; import static com.gregtechceu.gtceu.api.pattern.util.RelativeDirection.*; import static com.gregtechceu.gtceu.common.data.GTBlocks.*; import static com.gregtechceu.gtceu.common.data.GTMachines.*; -import static com.gregtechceu.gtceu.common.data.GTMaterials.*; -import static com.gregtechceu.gtceu.common.data.GTRecipeTypes.*; +import static com.gregtechceu.gtceu.common.data.GTMaterials.Aluminium; +import static com.gregtechceu.gtceu.common.data.GTMaterials.DrillingFluid; +import static com.gregtechceu.gtceu.common.data.GTRecipeTypes.DUMMY_RECIPES; import static com.gregtechceu.gtceu.common.data.machines.GTMachineUtils.*; import static com.gregtechceu.gtceu.common.registry.GTRegistration.REGISTRATE; import static com.gregtechceu.gtceu.utils.FormattingUtil.toRomanNumeral; @@ -439,7 +438,7 @@ public class GTMultiMachines { .appearanceBlock(CASING_STAINLESS_CLEAN) .pattern(definition -> { TraceabilityPredicate exportPredicate = abilities(PartAbility.EXPORT_FLUIDS_1X); - if (GTCEu.isAE2Loaded()) + if (GTCEu.Mods.isAE2Loaded()) exportPredicate = exportPredicate.or(blocks(GTAEMachines.FLUID_EXPORT_HATCH_ME.get())); exportPredicate.setMaxLayerLimited(1); return FactoryBlockPattern.start(RIGHT, BACK, UP) @@ -835,7 +834,7 @@ public class GTMultiMachines { tooltip.add(Component.translatable("gtceu.machine.cleanroom.tooltip.6")); tooltip.add(Component.translatable("gtceu.machine.cleanroom.tooltip.7")); // tooltip.add(Component.translatable("gtceu.machine.cleanroom.tooltip.8")); - if (GTCEu.isAE2Loaded()) { + if (GTCEu.Mods.isAE2Loaded()) { tooltip.add( Component.translatable(AEConfig.instance().getChannelMode() == ChannelMode.INFINITE ? "gtceu.machine.cleanroom.tooltip.ae2.no_channels" : diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/ColorSprayBehaviour.java b/src/main/java/com/gregtechceu/gtceu/common/item/ColorSprayBehaviour.java index 4b226860e0..48bf3de53d 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/ColorSprayBehaviour.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/ColorSprayBehaviour.java @@ -14,8 +14,6 @@ import com.gregtechceu.gtceu.utils.BreadthFirstBlockSearch; import com.gregtechceu.gtceu.utils.GradientUtil; -import com.lowdragmc.lowdraglib.Platform; - import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.registries.BuiltInRegistries; @@ -92,7 +90,7 @@ private static ResourceLocation getId(String modid, DyeColor color, String postf for (DyeColor color : DyeColor.values()) { // if there are > 16 colors (vanilla end) & tinted is loaded, use tinted blocks - if (color.ordinal() > 15 && Platform.isModLoaded(GTValues.MODID_TINTED)) { + if (color.ordinal() > 15 && GTCEu.isModLoaded(GTValues.MODID_TINTED)) { glassBuilder.put(color, BuiltInRegistries.BLOCK.get(getId(GTValues.MODID_TINTED, color, "stained_glass"))); glassPaneBuilder.put(color, @@ -235,7 +233,7 @@ private boolean handleSpecialBlockEntities(BlockEntity first, int limit, UseOnCo if (player == null) { return false; } - if (GTCEu.isAE2Loaded() && AE2CallWrapper.isAE2Cable(first)) { + if (GTCEu.Mods.isAE2Loaded() && AE2CallWrapper.isAE2Cable(first)) { var collected = AE2CallWrapper.collect(first, limit); var ae2Color = color == null ? AEColor.TRANSPARENT : AEColor.values()[color.ordinal()]; for (var c : collected) { diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/ItemMagnetBehavior.java b/src/main/java/com/gregtechceu/gtceu/common/item/ItemMagnetBehavior.java index b4027fc726..1a3e706630 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/ItemMagnetBehavior.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/ItemMagnetBehavior.java @@ -175,7 +175,7 @@ private boolean hasMagnet(@NotNull Player player) { } } - if (!GTCEu.isCuriosLoaded()) { + if (!GTCEu.Mods.isCuriosLoaded()) { return false; } return CuriosUtils.hasMagnetCurios(player); diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/armor/Jetpack.java b/src/main/java/com/gregtechceu/gtceu/common/item/armor/Jetpack.java index 08d5dcc8ce..4c072ff9d7 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/armor/Jetpack.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/armor/Jetpack.java @@ -7,8 +7,6 @@ import com.gregtechceu.gtceu.api.item.armor.ArmorUtils; import com.gregtechceu.gtceu.utils.input.KeyBind; -import com.lowdragmc.lowdraglib.Platform; - import net.minecraft.client.gui.GuiGraphics; import net.minecraft.core.particles.ParticleOptions; import net.minecraft.core.particles.ParticleTypes; @@ -36,7 +34,7 @@ public class Jetpack extends ArmorLogicSuite implements IJetpack { public Jetpack(int energyPerUse, long capacity, int tier) { super(energyPerUse, capacity, tier, ArmorItem.Type.CHESTPLATE); - if (Platform.isClient() && this.shouldDrawHUD()) { + if (GTCEu.isClientSide() && this.shouldDrawHUD()) { // noinspection NewExpressionSideOnly HUD = new ArmorUtils.ModularHUD(); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/armor/NanoMuscleSuite.java b/src/main/java/com/gregtechceu/gtceu/common/item/armor/NanoMuscleSuite.java index de83d20583..eff73b53b0 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/armor/NanoMuscleSuite.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/armor/NanoMuscleSuite.java @@ -8,8 +8,6 @@ import com.gregtechceu.gtceu.common.data.GTItems; import com.gregtechceu.gtceu.utils.input.KeyBind; -import com.lowdragmc.lowdraglib.Platform; - import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.nbt.CompoundTag; @@ -40,7 +38,7 @@ public class NanoMuscleSuite extends ArmorLogicSuite implements IStepAssist { public NanoMuscleSuite(ArmorItem.Type slot, int energyPerUse, long maxCapacity, int tier) { super(energyPerUse, maxCapacity, tier, slot); - if (Platform.isClient() && this.shouldDrawHUD()) { + if (GTCEu.isClientSide() && this.shouldDrawHUD()) { // noinspection NewExpressionSideOnly HUD = new ArmorUtils.ModularHUD(); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/armor/PowerlessJetpack.java b/src/main/java/com/gregtechceu/gtceu/common/item/armor/PowerlessJetpack.java index b235375b84..13d8d41fcb 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/armor/PowerlessJetpack.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/armor/PowerlessJetpack.java @@ -11,8 +11,6 @@ import com.gregtechceu.gtceu.utils.GradientUtil; import com.gregtechceu.gtceu.utils.input.KeyBind; -import com.lowdragmc.lowdraglib.Platform; - import net.minecraft.client.gui.GuiGraphics; import net.minecraft.core.NonNullList; import net.minecraft.nbt.CompoundTag; @@ -56,7 +54,7 @@ public class PowerlessJetpack implements IArmorLogic, IJetpack, IItemHUDProvider private ArmorUtils.ModularHUD HUD; public PowerlessJetpack() { - if (Platform.isClient()) + if (GTCEu.isClientSide()) HUD = new ArmorUtils.ModularHUD(); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/armor/QuarkTechSuite.java b/src/main/java/com/gregtechceu/gtceu/common/item/armor/QuarkTechSuite.java index c2dcc0cb7b..2862422ad8 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/armor/QuarkTechSuite.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/armor/QuarkTechSuite.java @@ -9,8 +9,6 @@ import com.gregtechceu.gtceu.core.IFireImmuneEntity; import com.gregtechceu.gtceu.utils.input.KeyBind; -import com.lowdragmc.lowdraglib.Platform; - import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.nbt.CompoundTag; @@ -63,7 +61,7 @@ public QuarkTechSuite(ArmorItem.Type slot, int energyPerUse, long capacity, int // potionRemovalCost.put(MobEffects.BAD_OMEN, 30000); potionRemovalCost.put(MobEffects.MOVEMENT_SLOWDOWN, 9000); potionRemovalCost.put(MobEffects.UNLUCK, 5000); - if (Platform.isClient() && this.shouldDrawHUD()) { + if (GTCEu.isClientSide() && this.shouldDrawHUD()) { HUD = new ArmorUtils.ModularHUD(); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/HullMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/HullMachine.java index c7fd20581e..e68d1bf795 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/HullMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/HullMachine.java @@ -35,7 +35,7 @@ public class HullMachine extends TieredPartMachine { public HullMachine(IMachineBlockEntity holder, int tier) { super(holder, tier); - if (GTCEu.isAE2Loaded()) { + if (GTCEu.Mods.isAE2Loaded()) { this.gridNodeHost = new GridNodeHostTrait(this); } else { this.gridNodeHost = null; @@ -52,7 +52,7 @@ protected void reinitializeEnergyContainer() { @Override public void onLoad() { super.onLoad(); - if (GTCEu.isAE2Loaded() && gridNodeHost instanceof GridNodeHostTrait connectedBlockEntity && + if (GTCEu.Mods.isAE2Loaded() && gridNodeHost instanceof GridNodeHostTrait connectedBlockEntity && getLevel() instanceof ServerLevel level) { level.getServer().tell(new TickTask(0, connectedBlockEntity::init)); } @@ -61,7 +61,7 @@ public void onLoad() { @Override public void onUnload() { super.onUnload(); - if (GTCEu.isAE2Loaded() && gridNodeHost instanceof GridNodeHostTrait connectedBlockEntity) { + if (GTCEu.Mods.isAE2Loaded() && gridNodeHost instanceof GridNodeHostTrait connectedBlockEntity) { connectedBlockEntity.getMainNode().destroy(); } } @@ -70,7 +70,7 @@ public void onUnload() { public void setFrontFacing(Direction facing) { super.setFrontFacing(facing); if (isFacingValid(facing)) { - if (GTCEu.isAE2Loaded() && gridNodeHost instanceof GridNodeHostTrait connectedBlockEntity) { + if (GTCEu.Mods.isAE2Loaded() && gridNodeHost instanceof GridNodeHostTrait connectedBlockEntity) { connectedBlockEntity.init(); } } @@ -84,7 +84,7 @@ public ManagedFieldHolder getFieldHolder() { @Override public void saveCustomPersistedData(@NotNull CompoundTag tag, boolean forDrop) { super.saveCustomPersistedData(tag, forDrop); - if (GTCEu.isAE2Loaded() && gridNodeHost instanceof IGridConnectedBlockEntity connectedBlockEntity) { + if (GTCEu.Mods.isAE2Loaded() && gridNodeHost instanceof IGridConnectedBlockEntity connectedBlockEntity) { CompoundTag nbt = new CompoundTag(); connectedBlockEntity.getMainNode().saveToNBT(nbt); tag.put("grid_node", nbt); @@ -94,7 +94,7 @@ public void saveCustomPersistedData(@NotNull CompoundTag tag, boolean forDrop) { @Override public void loadCustomPersistedData(@NotNull CompoundTag tag) { super.loadCustomPersistedData(tag); - if (GTCEu.isAE2Loaded() && gridNodeHost instanceof IGridConnectedBlockEntity connectedBlockEntity) { + if (GTCEu.Mods.isAE2Loaded() && gridNodeHost instanceof IGridConnectedBlockEntity connectedBlockEntity) { connectedBlockEntity.getMainNode().loadFromNBT(tag.getCompound("grid_node")); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/DiodePartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/DiodePartMachine.java index 826a880069..818f1d6b9d 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/DiodePartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/DiodePartMachine.java @@ -1,12 +1,12 @@ package com.gregtechceu.gtceu.common.machine.multiblock.part; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.api.machine.multiblock.part.TieredIOPartMachine; import com.gregtechceu.gtceu.api.machine.trait.NotifiableEnergyContainer; -import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; @@ -69,7 +69,7 @@ protected int getMaxAmperage() { public void onLoad() { super.onLoad(); - if (!LDLib.isRemote()) + if (!GTCEu.isClientThread()) reinitializeEnergyContainer(); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/owner/IMachineOwner.java b/src/main/java/com/gregtechceu/gtceu/common/machine/owner/IMachineOwner.java index 01107662b5..b1d58bdada 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/owner/IMachineOwner.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/owner/IMachineOwner.java @@ -66,8 +66,8 @@ static boolean canBreakOwnerMachine(Player player, IMachineBlockEntity machine) enum MachineOwnerType { PLAYER, - FTB(GTCEu::isFTBTeamsLoaded, "FTB Teams"), - ARGONAUTS(GTCEu::isArgonautsLoaded, "Argonauts Guild"); + FTB(GTCEu.Mods::isFTBTeamsLoaded, "FTB Teams"), + ARGONAUTS(GTCEu.Mods::isArgonautsLoaded, "Argonauts Guild"); public static final MachineOwnerType[] VALUES = values(); diff --git a/src/main/java/com/gregtechceu/gtceu/common/network/packets/SCPacketShareProspection.java b/src/main/java/com/gregtechceu/gtceu/common/network/packets/SCPacketShareProspection.java index 55d858fd0b..091fa9a209 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/network/packets/SCPacketShareProspection.java +++ b/src/main/java/com/gregtechceu/gtceu/common/network/packets/SCPacketShareProspection.java @@ -1,9 +1,9 @@ package com.gregtechceu.gtceu.common.network.packets; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.common.network.GTNetwork; import com.gregtechceu.gtceu.integration.map.ClientCacheManager; -import com.lowdragmc.lowdraglib.Platform; import com.lowdragmc.lowdraglib.networking.IHandlerContext; import com.lowdragmc.lowdraglib.networking.IPacket; @@ -80,7 +80,7 @@ public void execute(IHandlerContext handler) { isDimCache, dimension, data, first); GTNetwork.NETWORK.sendToPlayer(newPacket, - Platform.getMinecraftServer().getPlayerList().getPlayer(receiver)); + GTCEu.getMinecraftServer().getPlayerList().getPlayer(receiver)); } } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/network/packets/SPacketSyncBedrockOreVeins.java b/src/main/java/com/gregtechceu/gtceu/common/network/packets/SPacketSyncBedrockOreVeins.java index a42a9d5f8d..d74d959617 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/network/packets/SPacketSyncBedrockOreVeins.java +++ b/src/main/java/com/gregtechceu/gtceu/common/network/packets/SPacketSyncBedrockOreVeins.java @@ -2,9 +2,9 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.data.worldgen.bedrockore.BedrockOreDefinition; +import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.client.ClientProxy; -import com.lowdragmc.lowdraglib.Platform; import com.lowdragmc.lowdraglib.networking.IHandlerContext; import com.lowdragmc.lowdraglib.networking.IPacket; @@ -32,7 +32,7 @@ public SPacketSyncBedrockOreVeins() { @Override public void encode(FriendlyByteBuf buf) { - RegistryOps ops = RegistryOps.create(NbtOps.INSTANCE, Platform.getFrozenRegistry()); + RegistryOps ops = RegistryOps.create(NbtOps.INSTANCE, GTRegistries.builtinRegistry()); int size = veins.size(); buf.writeVarInt(size); for (var entry : veins.entrySet()) { @@ -45,7 +45,7 @@ public void encode(FriendlyByteBuf buf) { @Override public void decode(FriendlyByteBuf buf) { - RegistryOps ops = RegistryOps.create(NbtOps.INSTANCE, Platform.getFrozenRegistry()); + RegistryOps ops = RegistryOps.create(NbtOps.INSTANCE, GTRegistries.builtinRegistry()); Stream.generate(() -> { ResourceLocation id = buf.readResourceLocation(); CompoundTag tag = buf.readAnySizeNbt(); diff --git a/src/main/java/com/gregtechceu/gtceu/common/network/packets/SPacketSyncFluidVeins.java b/src/main/java/com/gregtechceu/gtceu/common/network/packets/SPacketSyncFluidVeins.java index b6e68ca612..450006be88 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/network/packets/SPacketSyncFluidVeins.java +++ b/src/main/java/com/gregtechceu/gtceu/common/network/packets/SPacketSyncFluidVeins.java @@ -2,9 +2,9 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.data.worldgen.bedrockfluid.BedrockFluidDefinition; +import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.client.ClientProxy; -import com.lowdragmc.lowdraglib.Platform; import com.lowdragmc.lowdraglib.networking.IHandlerContext; import com.lowdragmc.lowdraglib.networking.IPacket; @@ -32,7 +32,7 @@ public SPacketSyncFluidVeins() { @Override public void encode(FriendlyByteBuf buf) { - RegistryOps ops = RegistryOps.create(NbtOps.INSTANCE, Platform.getFrozenRegistry()); + RegistryOps ops = RegistryOps.create(NbtOps.INSTANCE, GTRegistries.builtinRegistry()); int size = veins.size(); buf.writeVarInt(size); for (var entry : veins.entrySet()) { @@ -45,7 +45,7 @@ public void encode(FriendlyByteBuf buf) { @Override public void decode(FriendlyByteBuf buf) { - RegistryOps ops = RegistryOps.create(NbtOps.INSTANCE, Platform.getFrozenRegistry()); + RegistryOps ops = RegistryOps.create(NbtOps.INSTANCE, GTRegistries.builtinRegistry()); Stream.generate(() -> { ResourceLocation id = buf.readResourceLocation(); CompoundTag tag = buf.readAnySizeNbt(); diff --git a/src/main/java/com/gregtechceu/gtceu/common/network/packets/SPacketSyncOreVeins.java b/src/main/java/com/gregtechceu/gtceu/common/network/packets/SPacketSyncOreVeins.java index 6ab3fa1673..522df81bab 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/network/packets/SPacketSyncOreVeins.java +++ b/src/main/java/com/gregtechceu/gtceu/common/network/packets/SPacketSyncOreVeins.java @@ -2,10 +2,10 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.data.worldgen.GTOreDefinition; +import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.client.ClientProxy; import com.gregtechceu.gtceu.integration.map.cache.client.GTClientCache; -import com.lowdragmc.lowdraglib.Platform; import com.lowdragmc.lowdraglib.networking.IHandlerContext; import com.lowdragmc.lowdraglib.networking.IPacket; @@ -33,7 +33,7 @@ public SPacketSyncOreVeins() { @Override public void encode(FriendlyByteBuf buf) { - RegistryOps ops = RegistryOps.create(NbtOps.INSTANCE, Platform.getFrozenRegistry()); + RegistryOps ops = RegistryOps.create(NbtOps.INSTANCE, GTRegistries.builtinRegistry()); int size = veins.size(); buf.writeVarInt(size); for (var entry : veins.entrySet()) { @@ -46,7 +46,7 @@ public void encode(FriendlyByteBuf buf) { @Override public void decode(FriendlyByteBuf buf) { - RegistryOps ops = RegistryOps.create(NbtOps.INSTANCE, Platform.getFrozenRegistry()); + RegistryOps ops = RegistryOps.create(NbtOps.INSTANCE, GTRegistries.builtinRegistry()); Stream.generate(() -> { ResourceLocation id = buf.readResourceLocation(); CompoundTag tag = buf.readAnySizeNbt(); diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/cable/EnergyNetWalker.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/cable/EnergyNetWalker.java index a81994d1f2..c4404a0f6d 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/cable/EnergyNetWalker.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/cable/EnergyNetWalker.java @@ -1,13 +1,12 @@ package com.gregtechceu.gtceu.common.pipelike.cable; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.capability.IEnergyContainer; import com.gregtechceu.gtceu.api.capability.forge.GTCapability; import com.gregtechceu.gtceu.api.data.chemical.material.properties.WireProperties; import com.gregtechceu.gtceu.api.pipenet.PipeNetWalker; import com.gregtechceu.gtceu.common.blockentity.CableBlockEntity; -import com.lowdragmc.lowdraglib.LDLib; - import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.level.block.entity.BlockEntity; @@ -28,7 +27,7 @@ public static List createNetData(EnergyNet pipeNet, BlockPos so walker.traversePipeNet(); return walker.routes; } catch (Exception e) { - LDLib.LOGGER.error("error while create net data for energynet", e); + GTCEu.LOGGER.error("error while create net data for energynet", e); } return null; } diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/LootDataManagerMixin.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/LootDataManagerMixin.java index 60798c0805..cf6b93c9f9 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/LootDataManagerMixin.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/LootDataManagerMixin.java @@ -1,9 +1,8 @@ package com.gregtechceu.gtceu.core.mixins; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.core.MixinHelpers; -import com.lowdragmc.lowdraglib.Platform; - import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.storage.loot.LootDataManager; import net.minecraft.world.level.storage.loot.LootDataType; @@ -22,7 +21,7 @@ public abstract class LootDataManagerMixin { @Inject(method = "apply", at = @At(value = "HEAD")) public void gtceu$injectLootTables(Map, Map> allElements, CallbackInfo ci) { - if (Platform.isDatagen()) return; + if (GTCEu.isDataGen()) return; Map lootTables = (Map) allElements .get(LootDataType.TABLE); diff --git a/src/main/java/com/gregtechceu/gtceu/data/loader/BedrockFluidLoader.java b/src/main/java/com/gregtechceu/gtceu/data/loader/BedrockFluidLoader.java index 18ea0b582d..f33419b26c 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/loader/BedrockFluidLoader.java +++ b/src/main/java/com/gregtechceu/gtceu/data/loader/BedrockFluidLoader.java @@ -52,7 +52,7 @@ protected void apply(Map resourceList, ResourceMa AddonFinder.getAddons().forEach(IGTAddon::registerFluidVeins); ModLoader.get().postEvent( new GTCEuAPI.RegisterEvent<>(GTRegistries.BEDROCK_FLUID_DEFINITIONS, BedrockFluidDefinition.class)); - if (GTCEu.isKubeJSLoaded()) { + if (GTCEu.Mods.isKubeJSLoaded()) { KJSCallWrapper.fireKJSEvent(); } RegistryOps ops = RegistryOps.create(JsonOps.INSTANCE, GTRegistries.builtinRegistry()); diff --git a/src/main/java/com/gregtechceu/gtceu/data/loader/BedrockOreLoader.java b/src/main/java/com/gregtechceu/gtceu/data/loader/BedrockOreLoader.java index a8f93b1da7..630a260c22 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/loader/BedrockOreLoader.java +++ b/src/main/java/com/gregtechceu/gtceu/data/loader/BedrockOreLoader.java @@ -9,8 +9,6 @@ import com.gregtechceu.gtceu.integration.kjs.GTCEuServerEvents; import com.gregtechceu.gtceu.integration.kjs.events.GTBedrockOreVeinEventJS; -import com.lowdragmc.lowdraglib.Platform; - import net.minecraft.resources.RegistryOps; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.ResourceManager; @@ -55,7 +53,7 @@ protected void apply(Map resourceList, ResourceMa AddonFinder.getAddons().forEach(IGTAddon::registerBedrockOreVeins); ModLoader.get().postEvent( new GTCEuAPI.RegisterEvent<>(GTRegistries.BEDROCK_ORE_DEFINITIONS, BedrockOreDefinition.class)); - if (GTCEu.isKubeJSLoaded()) { + if (GTCEu.Mods.isKubeJSLoaded()) { KJSCallWrapper.fireKJSEvent(); } @@ -79,7 +77,7 @@ protected void apply(Map resourceList, ResourceMa GTRegistries.BEDROCK_ORE_DEFINITIONS.freeze(); } - if (Platform.getMinecraftServer() != null) {} + if (GTCEu.getMinecraftServer() != null) {} } public static BedrockOreDefinition fromJson(ResourceLocation id, JsonObject json, RegistryOps ops) { diff --git a/src/main/java/com/gregtechceu/gtceu/data/loader/GTOreLoader.java b/src/main/java/com/gregtechceu/gtceu/data/loader/GTOreLoader.java index 6bd92c81dc..ff822c58e2 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/loader/GTOreLoader.java +++ b/src/main/java/com/gregtechceu/gtceu/data/loader/GTOreLoader.java @@ -56,7 +56,7 @@ protected void apply(Map resourceList, ResourceMa GTOres.init(); AddonFinder.getAddons().forEach(IGTAddon::registerOreVeins); ModLoader.get().postEvent(new GTCEuAPI.RegisterEvent<>(GTRegistries.ORE_VEINS, GTOreDefinition.class)); - if (GTCEu.isKubeJSLoaded()) { + if (GTCEu.Mods.isKubeJSLoaded()) { KJSCallWrapper.fireKJSEvent(); } diff --git a/src/main/java/com/gregtechceu/gtceu/data/pack/GTDynamicDataPack.java b/src/main/java/com/gregtechceu/gtceu/data/pack/GTDynamicDataPack.java index 4260a002f8..b8b64a3d17 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/pack/GTDynamicDataPack.java +++ b/src/main/java/com/gregtechceu/gtceu/data/pack/GTDynamicDataPack.java @@ -6,8 +6,6 @@ import com.gregtechceu.gtceu.common.data.GTRecipes; import com.gregtechceu.gtceu.config.ConfigHolder; -import com.lowdragmc.lowdraglib.Platform; - import net.minecraft.SharedConstants; import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.network.chat.Component; @@ -66,7 +64,7 @@ public static void clearServer() { public static void addRecipe(FinishedRecipe recipe) { JsonObject recipeJson = recipe.serializeRecipe(); - Path parent = Platform.getGamePath().resolve("gtceu/dumped/data"); + Path parent = GTCEu.getGameDir().resolve("gtceu/dumped/data"); ResourceLocation recipeId = recipe.getId(); if (ConfigHolder.INSTANCE.dev.dumpRecipes) { writeJson(recipeId, "recipes", parent, recipeJson); diff --git a/src/main/java/com/gregtechceu/gtceu/data/pack/GTDynamicResourcePack.java b/src/main/java/com/gregtechceu/gtceu/data/pack/GTDynamicResourcePack.java index 7265b1f989..fb0b80aa16 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/pack/GTDynamicResourcePack.java +++ b/src/main/java/com/gregtechceu/gtceu/data/pack/GTDynamicResourcePack.java @@ -5,8 +5,6 @@ import com.gregtechceu.gtceu.api.addon.IGTAddon; import com.gregtechceu.gtceu.config.ConfigHolder; -import com.lowdragmc.lowdraglib.Platform; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.SharedConstants; import net.minecraft.network.chat.Component; @@ -73,7 +71,7 @@ public static void clearClient() { public static void addBlockModel(ResourceLocation loc, JsonElement obj) { ResourceLocation l = getModelLocation(loc); if (ConfigHolder.INSTANCE.dev.dumpAssets) { - Path parent = Platform.getGamePath().resolve("gtceu/dumped/assets"); + Path parent = GTCEu.getGameDir().resolve("gtceu/dumped/assets"); writeJson(l, null, parent, obj); } DATA.put(l, obj.toString().getBytes(StandardCharsets.UTF_8)); @@ -86,7 +84,7 @@ public static void addBlockModel(ResourceLocation loc, Supplier obj public static void addItemModel(ResourceLocation loc, JsonElement obj) { ResourceLocation l = getItemModelLocation(loc); if (ConfigHolder.INSTANCE.dev.dumpAssets) { - Path parent = Platform.getGamePath().resolve("gtceu/dumped/assets"); + Path parent = GTCEu.getGameDir().resolve("gtceu/dumped/assets"); writeJson(l, null, parent, obj); } DATA.put(l, obj.toString().getBytes(StandardCharsets.UTF_8)); @@ -99,7 +97,7 @@ public static void addItemModel(ResourceLocation loc, Supplier obj) public static void addBlockState(ResourceLocation loc, JsonElement stateJson) { ResourceLocation l = getBlockStateLocation(loc); if (ConfigHolder.INSTANCE.dev.dumpAssets) { - Path parent = Platform.getGamePath().resolve("gtceu/dumped/assets"); + Path parent = GTCEu.getGameDir().resolve("gtceu/dumped/assets"); writeJson(l, null, parent, stateJson); } DATA.put(l, stateJson.toString().getBytes(StandardCharsets.UTF_8)); @@ -112,7 +110,7 @@ public static void addBlockState(ResourceLocation loc, Supplier gen public static void addBlockTexture(ResourceLocation loc, byte[] data) { ResourceLocation l = getTextureLocation("block", loc); if (ConfigHolder.INSTANCE.dev.dumpAssets) { - Path parent = Platform.getGamePath().resolve("gtceu/dumped/assets"); + Path parent = GTCEu.getGameDir().resolve("gtceu/dumped/assets"); writeByteArray(l, null, parent, data); } DATA.put(l, data); @@ -121,7 +119,7 @@ public static void addBlockTexture(ResourceLocation loc, byte[] data) { public static void addItemTexture(ResourceLocation loc, byte[] data) { ResourceLocation l = getTextureLocation("item", loc); if (ConfigHolder.INSTANCE.dev.dumpAssets) { - Path parent = Platform.getGamePath().resolve("gtceu/dumped/assets"); + Path parent = GTCEu.getGameDir().resolve("gtceu/dumped/assets"); writeByteArray(l, null, parent, data); } DATA.put(l, data); diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/GTCraftingComponents.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/GTCraftingComponents.java index 35d89977f3..fed70a8733 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/GTCraftingComponents.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/GTCraftingComponents.java @@ -754,7 +754,7 @@ public static void initializeComponents() { .add(UHV, new UnificationEntry(TagPrefix.spring, GTMaterials.Europium)); MinecraftForge.EVENT_BUS.post(new CraftingComponentModificationEvent()); - if (GTCEu.isKubeJSLoaded()) { + if (GTCEu.Mods.isKubeJSLoaded()) { KJSCallWrapper.craftingComponentModification(); } } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/BlastingRecipeBuilder.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/BlastingRecipeBuilder.java index fc9bf7c98e..99ae06bf22 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/BlastingRecipeBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/BlastingRecipeBuilder.java @@ -1,8 +1,8 @@ package com.gregtechceu.gtceu.data.recipe.builder; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.recipe.ingredient.NBTIngredient; -import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.utils.NBTToJsonConverter; import net.minecraft.core.registries.BuiltInRegistries; @@ -101,7 +101,7 @@ public void toJson(JsonObject json) { } if (output.isEmpty()) { - LDLib.LOGGER.error("shapeless recipe {} output is empty", id); + GTCEu.LOGGER.error("shapeless recipe {} output is empty", id); throw new IllegalArgumentException(id + ": output items is empty"); } else { JsonObject result = new JsonObject(); diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/CampfireRecipeBuilder.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/CampfireRecipeBuilder.java index 1239b8d0cf..f6a670d3a0 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/CampfireRecipeBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/CampfireRecipeBuilder.java @@ -1,8 +1,8 @@ package com.gregtechceu.gtceu.data.recipe.builder; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.recipe.ingredient.NBTIngredient; -import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.utils.NBTToJsonConverter; import net.minecraft.core.registries.BuiltInRegistries; @@ -101,7 +101,7 @@ public void toJson(JsonObject json) { } if (output.isEmpty()) { - LDLib.LOGGER.error("shapeless recipe {} output is empty", id); + GTCEu.LOGGER.error("shapeless recipe {} output is empty", id); throw new IllegalArgumentException(id + ": output items is empty"); } else { JsonObject result = new JsonObject(); diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/ShapelessRecipeBuilder.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/ShapelessRecipeBuilder.java index a5d89f33a2..e53e5dda97 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/ShapelessRecipeBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/ShapelessRecipeBuilder.java @@ -1,8 +1,8 @@ package com.gregtechceu.gtceu.data.recipe.builder; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.recipe.ingredient.NBTIngredient; -import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.utils.NBTToJsonConverter; import net.minecraft.core.registries.BuiltInRegistries; @@ -106,7 +106,7 @@ public void toJson(JsonObject json) { json.add("ingredients", jsonarray); if (output.isEmpty()) { - LDLib.LOGGER.error("shapeless recipe {} output is empty", id); + GTCEu.LOGGER.error("shapeless recipe {} output is empty", id); throw new IllegalArgumentException(id + ": output items is empty"); } else { JsonObject result = new JsonObject(); diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/SmeltingRecipeBuilder.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/SmeltingRecipeBuilder.java index 1206bfa24f..5deb55832a 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/SmeltingRecipeBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/SmeltingRecipeBuilder.java @@ -1,8 +1,8 @@ package com.gregtechceu.gtceu.data.recipe.builder; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.recipe.ingredient.NBTIngredient; -import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.utils.NBTToJsonConverter; import net.minecraft.core.registries.BuiltInRegistries; @@ -101,7 +101,7 @@ public void toJson(JsonObject json) { } if (output.isEmpty()) { - LDLib.LOGGER.error("shapeless recipe {} output is empty", id); + GTCEu.LOGGER.error("shapeless recipe {} output is empty", id); throw new IllegalArgumentException(id + ": output items is empty"); } else { JsonObject result = new JsonObject(); diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/SmokingRecipeBuilder.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/SmokingRecipeBuilder.java index 2cf526d892..607332899f 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/SmokingRecipeBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/SmokingRecipeBuilder.java @@ -1,8 +1,8 @@ package com.gregtechceu.gtceu.data.recipe.builder; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.recipe.ingredient.NBTIngredient; -import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.utils.NBTToJsonConverter; import net.minecraft.core.registries.BuiltInRegistries; @@ -101,7 +101,7 @@ public void toJson(JsonObject json) { } if (output.isEmpty()) { - LDLib.LOGGER.error("shapeless recipe {} output is empty", id); + GTCEu.LOGGER.error("shapeless recipe {} output is empty", id); throw new IllegalArgumentException(id + ": output items is empty"); } else { JsonObject result = new JsonObject(); diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MachineRecipeLoader.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MachineRecipeLoader.java index 9da21d0b69..4f3f3cbaa0 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MachineRecipeLoader.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MachineRecipeLoader.java @@ -1486,7 +1486,7 @@ private static void registerHatchConversion(Consumer provider) { VanillaRecipeHelper.addShapedRecipe(provider, "steam_bus_input_to_output", STEAM_IMPORT_BUS.asStack(), "d", "B", 'B', STEAM_EXPORT_BUS.asStack()); - if (GTCEu.isAE2Loaded()) { + if (GTCEu.Mods.isAE2Loaded()) { VanillaRecipeHelper.addShapedRecipe(provider, "me_fluid_hatch_output_to_input", GTAEMachines.FLUID_IMPORT_HATCH_ME.asStack(), "d", "B", 'B', GTAEMachines.FLUID_EXPORT_HATCH_ME.asStack()); diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MetaTileEntityMachineRecipeLoader.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MetaTileEntityMachineRecipeLoader.java index 09987b9acc..6fd47bc3e4 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MetaTileEntityMachineRecipeLoader.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MetaTileEntityMachineRecipeLoader.java @@ -549,7 +549,7 @@ public static void init(Consumer provider) { // ME Parts - if (GTCEu.isAE2Loaded()) { + if (GTCEu.Mods.isAE2Loaded()) { ItemStack meInterface = AEParts.INTERFACE.stack(1); ItemStack accelerationCard = AEItems.SPEED_CARD.stack(2); diff --git a/src/main/java/com/gregtechceu/gtceu/forge/ForgeCommonEventListener.java b/src/main/java/com/gregtechceu/gtceu/forge/ForgeCommonEventListener.java index 9fa56ceb83..5dfc4b7289 100644 --- a/src/main/java/com/gregtechceu/gtceu/forge/ForgeCommonEventListener.java +++ b/src/main/java/com/gregtechceu/gtceu/forge/ForgeCommonEventListener.java @@ -284,6 +284,7 @@ public static void registerReloadListeners(AddReloadListenerEvent event) { event.addListener(new GTOreLoader()); event.addListener(new BedrockFluidLoader()); event.addListener(new BedrockOreLoader()); + GTRegistries.updateFrozenRegistry(event.getRegistryAccess()); } @SubscribeEvent diff --git a/src/main/java/com/gregtechceu/gtceu/integration/emi/GTEMIPlugin.java b/src/main/java/com/gregtechceu/gtceu/integration/emi/GTEMIPlugin.java index 0e7cb10572..c699e3d000 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/emi/GTEMIPlugin.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/emi/GTEMIPlugin.java @@ -22,7 +22,6 @@ import com.gregtechceu.gtceu.integration.emi.recipe.GTEmiRecipeHandler; import com.gregtechceu.gtceu.integration.emi.recipe.GTRecipeEMICategory; -import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.gui.modular.ModularUIContainer; import net.minecraft.core.registries.BuiltInRegistries; @@ -62,10 +61,10 @@ public void register(EmiRegistry registry) { } } registry.addRecipeHandler(ModularUIContainer.MENUTYPE, new GTEmiRecipeHandler()); - if (GTCEu.isAE2Loaded()) { + if (GTCEu.Mods.isAE2Loaded()) { registry.addRecipeHandler(PatternEncodingTermMenu.TYPE, new Ae2PatternTerminalHandler<>()); } - if (LDLib.isModLoaded(GTValues.MODID_AE2WTLIB)) { + if (GTCEu.isModLoaded(GTValues.MODID_AE2WTLIB)) { registry.addRecipeHandler(WETMenu.TYPE, new Ae2PatternTerminalHandler<>()); } registry.addCategory(GTProgrammedCircuitCategory.CATEGORY); diff --git a/src/main/java/com/gregtechceu/gtceu/integration/emi/recipe/GTRecipeEMICategory.java b/src/main/java/com/gregtechceu/gtceu/integration/emi/recipe/GTRecipeEMICategory.java index e03963e9ec..403c15e755 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/emi/recipe/GTRecipeEMICategory.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/emi/recipe/GTRecipeEMICategory.java @@ -1,12 +1,12 @@ package com.gregtechceu.gtceu.integration.emi.recipe; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.machine.MachineDefinition; import com.gregtechceu.gtceu.api.recipe.GTRecipeType; import com.gregtechceu.gtceu.api.recipe.category.GTRecipeCategory; import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.common.data.GTRecipeTypes; -import com.lowdragmc.lowdraglib.Platform; import com.lowdragmc.lowdraglib.emi.IGui2Renderable; import net.minecraft.Util; @@ -48,7 +48,7 @@ public static void registerWorkStations(EmiRegistry registry) { for (GTRecipeType type : machine.getRecipeTypes()) { if (type == null) continue; for (GTRecipeCategory category : type.getCategories()) { - if (!category.isXEIVisible() && !Platform.isDevEnv()) continue; + if (!category.isXEIVisible() && !GTCEu.isDev()) continue; registry.addWorkstation(machineCategory(category), EmiStack.of(machine.asStack())); } } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/jade/GTJadePlugin.java b/src/main/java/com/gregtechceu/gtceu/integration/jade/GTJadePlugin.java index e471257121..269313b31d 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/jade/GTJadePlugin.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/jade/GTJadePlugin.java @@ -42,7 +42,7 @@ public void register(IWailaCommonRegistration registration) { registration.registerBlockDataProvider(new HazardCleanerBlockProvider(), BlockEntity.class); registration.registerBlockDataProvider(new TransformerBlockProvider(), BlockEntity.class); registration.registerBlockDataProvider(new PrimitivePumpBlockProvider(), BlockEntity.class); - if (GTCEu.isAE2Loaded()) { + if (GTCEu.Mods.isAE2Loaded()) { registration.registerBlockDataProvider(new MEPatternBufferProxyProvider(), BlockEntity.class); registration.registerBlockDataProvider(new MEPatternBufferProvider(), BlockEntity.class); } @@ -71,7 +71,7 @@ public void registerClient(IWailaClientRegistration registration) { registration.registerBlockComponent(new HazardCleanerBlockProvider(), Block.class); registration.registerBlockComponent(new TransformerBlockProvider(), Block.class); registration.registerBlockComponent(new PrimitivePumpBlockProvider(), Block.class); - if (GTCEu.isAE2Loaded()) { + if (GTCEu.Mods.isAE2Loaded()) { registration.registerBlockComponent(new MEPatternBufferProxyProvider(), Block.class); registration.registerBlockComponent(new MEPatternBufferProvider(), Block.class); } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/jei/GTJEIPlugin.java b/src/main/java/com/gregtechceu/gtceu/integration/jei/GTJEIPlugin.java index 057ad27640..cd74ea5f99 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/jei/GTJEIPlugin.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/jei/GTJEIPlugin.java @@ -19,8 +19,6 @@ import com.gregtechceu.gtceu.integration.jei.recipe.GTRecipeJEICategory; import com.gregtechceu.gtceu.integration.jei.subtype.PotionFluidSubtypeInterpreter; -import com.lowdragmc.lowdraglib.LDLib; - import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceLocation; @@ -58,7 +56,7 @@ public ResourceLocation getPluginUid() { @Override public void registerCategories(@NotNull IRecipeCategoryRegistration registry) { - if (LDLib.isReiLoaded() || LDLib.isEmiLoaded()) return; + if (GTCEu.Mods.isREILoaded() || GTCEu.Mods.isEMILoaded()) return; GTCEu.LOGGER.info("JEI register categories"); IJeiHelpers jeiHelpers = registry.getJeiHelpers(); registry.addRecipeCategories(new MultiblockInfoCategory(jeiHelpers)); @@ -78,7 +76,7 @@ public void registerCategories(@NotNull IRecipeCategoryRegistration registry) { @Override public void registerRecipeCatalysts(@NotNull IRecipeCatalystRegistration registration) { - if (LDLib.isReiLoaded() || LDLib.isEmiLoaded()) return; + if (GTCEu.Mods.isREILoaded() || GTCEu.Mods.isEMILoaded()) return; GTRecipeJEICategory.registerRecipeCatalysts(registration); if (!ConfigHolder.INSTANCE.compat.hideOreProcessingDiagrams) GTOreProcessingInfoCategory.registerRecipeCatalysts(registration); @@ -93,7 +91,7 @@ public void registerRecipeCatalysts(@NotNull IRecipeCatalystRegistration registr @Override public void registerRecipes(@NotNull IRecipeRegistration registration) { - if (LDLib.isReiLoaded() || LDLib.isEmiLoaded()) return; + if (GTCEu.Mods.isREILoaded() || GTCEu.Mods.isEMILoaded()) return; GTCEu.LOGGER.info("JEI register"); MultiblockInfoCategory.registerRecipes(registration); GTRecipeJEICategory.registerRecipes(registration); @@ -109,7 +107,7 @@ public void registerRecipes(@NotNull IRecipeRegistration registration) { @Override public void registerIngredients(@NotNull IModIngredientRegistration registry) { - if (LDLib.isReiLoaded() || LDLib.isEmiLoaded()) return; + if (GTCEu.Mods.isREILoaded() || GTCEu.Mods.isEMILoaded()) return; GTCEu.LOGGER.info("JEI register ingredients"); } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/jei/recipe/GTRecipeJEICategory.java b/src/main/java/com/gregtechceu/gtceu/integration/jei/recipe/GTRecipeJEICategory.java index 6a3555d6aa..ef90c494b8 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/jei/recipe/GTRecipeJEICategory.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/jei/recipe/GTRecipeJEICategory.java @@ -1,12 +1,12 @@ package com.gregtechceu.gtceu.integration.jei.recipe; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.machine.MachineDefinition; import com.gregtechceu.gtceu.api.recipe.GTRecipeType; import com.gregtechceu.gtceu.api.recipe.category.GTRecipeCategory; import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.common.data.GTRecipeTypes; -import com.lowdragmc.lowdraglib.Platform; import com.lowdragmc.lowdraglib.jei.IGui2IDrawable; import com.lowdragmc.lowdraglib.jei.ModularUIRecipeCategory; @@ -66,7 +66,7 @@ public static void registerRecipeCatalysts(IRecipeCatalystRegistration registrat for (GTRecipeType type : machine.getRecipeTypes()) { if (type == null) continue; for (GTRecipeCategory category : type.getCategories()) { - if (!category.isXEIVisible() && !Platform.isDevEnv()) continue; + if (!category.isXEIVisible() && !GTCEu.isDev()) continue; registration.addRecipeCatalyst(machine.asStack(), machineType(category)); } } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/map/GroupingMapRenderer.java b/src/main/java/com/gregtechceu/gtceu/integration/map/GroupingMapRenderer.java index c6eba71648..d05ad09e69 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/map/GroupingMapRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/map/GroupingMapRenderer.java @@ -1,5 +1,6 @@ package com.gregtechceu.gtceu.integration.map; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.data.worldgen.ores.GeneratedVeinMetadata; import com.gregtechceu.gtceu.api.gui.misc.ProspectorMode; @@ -8,8 +9,6 @@ import com.gregtechceu.gtceu.integration.map.journeymap.JourneymapRenderer; import com.gregtechceu.gtceu.integration.map.xaeros.XaerosRenderer; -import com.lowdragmc.lowdraglib.Platform; - import net.minecraft.resources.ResourceKey; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.Level; @@ -30,13 +29,13 @@ public class GroupingMapRenderer extends GenericMapRenderer { static { Map renderers = new HashMap<>(); var toggle = ConfigHolder.INSTANCE.compat.minimap.toggle; - if (toggle.journeyMapIntegration && Platform.isModLoaded(GTValues.MODID_JOURNEYMAP)) { + if (toggle.journeyMapIntegration && GTCEu.isModLoaded(GTValues.MODID_JOURNEYMAP)) { renderers.put(GTValues.MODID_JOURNEYMAP, new JourneymapRenderer()); } - if (toggle.xaerosMapIntegration && Platform.isModLoaded(GTValues.MODID_XAEROS_MINIMAP)) { + if (toggle.xaerosMapIntegration && GTCEu.isModLoaded(GTValues.MODID_XAEROS_MINIMAP)) { renderers.put(GTValues.MODID_XAEROS_MINIMAP, new XaerosRenderer()); } - if (toggle.ftbChunksIntegration && Platform.isModLoaded(GTValues.MODID_FTB_CHUNKS)) { + if (toggle.ftbChunksIntegration && GTCEu.isModLoaded(GTValues.MODID_FTB_CHUNKS)) { renderers.put(GTValues.MODID_FTB_CHUNKS, new FTBChunksRenderer()); } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/map/WaypointManager.java b/src/main/java/com/gregtechceu/gtceu/integration/map/WaypointManager.java index 04d86cef3f..7b4e19abeb 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/map/WaypointManager.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/map/WaypointManager.java @@ -1,13 +1,12 @@ package com.gregtechceu.gtceu.integration.map; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.integration.map.ftbchunks.FTBChunksWaypointHandler; import com.gregtechceu.gtceu.integration.map.journeymap.JourneymapWaypointHandler; import com.gregtechceu.gtceu.integration.map.xaeros.XaeroWaypointHandler; -import com.lowdragmc.lowdraglib.Platform; - import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.resources.ResourceKey; import net.minecraft.world.level.Level; @@ -30,15 +29,15 @@ public class WaypointManager { public static void init() { var toggle = ConfigHolder.INSTANCE.compat.minimap.toggle; - if (toggle.xaerosMapIntegration && Platform.isModLoaded(GTValues.MODID_XAEROS_MINIMAP)) { + if (toggle.xaerosMapIntegration && GTCEu.isModLoaded(GTValues.MODID_XAEROS_MINIMAP)) { WaypointManager.registerWaypointHandler(new XaeroWaypointHandler()); active = true; } - if (toggle.journeyMapIntegration && Platform.isModLoaded(GTValues.MODID_JOURNEYMAP)) { + if (toggle.journeyMapIntegration && GTCEu.isModLoaded(GTValues.MODID_JOURNEYMAP)) { WaypointManager.registerWaypointHandler(new JourneymapWaypointHandler()); active = true; } - if (toggle.ftbChunksIntegration && Platform.isModLoaded(GTValues.MODID_FTB_CHUNKS)) { + if (toggle.ftbChunksIntegration && GTCEu.isModLoaded(GTValues.MODID_FTB_CHUNKS)) { WaypointManager.registerWaypointHandler(new FTBChunksWaypointHandler()); active = true; } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/map/xaeros/XaerosMapPlugin.java b/src/main/java/com/gregtechceu/gtceu/integration/map/xaeros/XaerosMapPlugin.java index d691234dfa..49173bf775 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/map/xaeros/XaerosMapPlugin.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/map/xaeros/XaerosMapPlugin.java @@ -1,10 +1,9 @@ package com.gregtechceu.gtceu.integration.map.xaeros; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.config.ConfigHolder; -import com.lowdragmc.lowdraglib.Platform; - import it.unimi.dsi.fastutil.objects.Object2BooleanMap; import it.unimi.dsi.fastutil.objects.Object2BooleanOpenHashMap; import xaero.common.minimap.highlight.DimensionHighlighterHandler; @@ -34,7 +33,7 @@ public static void toggleOption(String name, boolean active) { } if (ConfigHolder.INSTANCE.compat.minimap.toggle.xaerosMapIntegration && - Platform.isModLoaded(GTValues.MODID_XAEROS_WORLDMAP)) { + GTCEu.isModLoaded(GTValues.MODID_XAEROS_WORLDMAP)) { WorldMapSession session = WorldMapSession.getCurrentSession(); MapWorld world = session.getMapProcessor().getMapWorld(); for (MapDimension mapDim : world.getDimensionsList()) { diff --git a/src/main/java/com/gregtechceu/gtceu/integration/rei/recipe/GTRecipeREICategory.java b/src/main/java/com/gregtechceu/gtceu/integration/rei/recipe/GTRecipeREICategory.java index 61624c20be..b9b318b68c 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/rei/recipe/GTRecipeREICategory.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/rei/recipe/GTRecipeREICategory.java @@ -1,12 +1,12 @@ package com.gregtechceu.gtceu.integration.rei.recipe; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.machine.MachineDefinition; import com.gregtechceu.gtceu.api.recipe.GTRecipeType; import com.gregtechceu.gtceu.api.recipe.category.GTRecipeCategory; import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.common.data.GTRecipeTypes; -import com.lowdragmc.lowdraglib.Platform; import com.lowdragmc.lowdraglib.rei.IGui2Renderer; import com.lowdragmc.lowdraglib.rei.ModularUIDisplayCategory; import com.lowdragmc.lowdraglib.utils.Size; @@ -62,7 +62,7 @@ public static void registerWorkStations(CategoryRegistry registry) { for (GTRecipeType type : machine.getRecipeTypes()) { if (type == null) continue; for (GTRecipeCategory category : type.getCategories()) { - if (!category.isXEIVisible() && !Platform.isDevEnv()) continue; + if (!category.isXEIVisible() && !GTCEu.isDev()) continue; registry.addWorkstations(machineCategory(category), EntryStacks.of(machine.asStack())); } } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/xei/widgets/GTRecipeWidget.java b/src/main/java/com/gregtechceu/gtceu/integration/xei/widgets/GTRecipeWidget.java index 0a0dee9336..10ca5b5c48 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/xei/widgets/GTRecipeWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/xei/widgets/GTRecipeWidget.java @@ -1,5 +1,6 @@ package com.gregtechceu.gtceu.integration.xei.widgets; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.capability.recipe.CWURecipeCapability; import com.gregtechceu.gtceu.api.capability.recipe.IO; @@ -17,7 +18,6 @@ import com.gregtechceu.gtceu.common.recipe.condition.DimensionCondition; import com.gregtechceu.gtceu.utils.FormattingUtil; -import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup; import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.texture.TextTexture; @@ -233,7 +233,7 @@ private int getVoltageXOffset() { case IV -> 12; default -> 14; }; - if (!LDLib.isEmiLoaded()) { + if (!GTCEu.Mods.isEMILoaded()) { x -= 3; } return x; diff --git a/src/main/java/com/gregtechceu/gtceu/utils/GTUtil.java b/src/main/java/com/gregtechceu/gtceu/utils/GTUtil.java index 401acac5e0..09fa0f4c18 100644 --- a/src/main/java/com/gregtechceu/gtceu/utils/GTUtil.java +++ b/src/main/java/com/gregtechceu/gtceu/utils/GTUtil.java @@ -10,8 +10,6 @@ import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.data.recipe.CustomTags; -import com.lowdragmc.lowdraglib.LDLib; - import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; import net.minecraft.core.BlockPos; @@ -303,7 +301,7 @@ public static Class getActualTypeParameter(Class thisClas } public static boolean isShiftDown() { - if (LDLib.isClient()) { + if (GTCEu.isClientSide()) { var id = Minecraft.getInstance().getWindow().getWindow(); return InputConstants.isKeyDown(id, GLFW.GLFW_KEY_LEFT_SHIFT) || InputConstants.isKeyDown(id, GLFW.GLFW_KEY_LEFT_SHIFT); @@ -312,7 +310,7 @@ public static boolean isShiftDown() { } public static boolean isCtrlDown() { - if (LDLib.isClient()) { + if (GTCEu.isClientSide()) { var id = Minecraft.getInstance().getWindow().getWindow(); return InputConstants.isKeyDown(id, GLFW.GLFW_KEY_LEFT_CONTROL) || InputConstants.isKeyDown(id, GLFW.GLFW_KEY_RIGHT_CONTROL); @@ -321,7 +319,7 @@ public static boolean isCtrlDown() { } public static boolean isAltDown() { - if (LDLib.isClient()) { + if (GTCEu.isClientSide()) { var id = Minecraft.getInstance().getWindow().getWindow(); return InputConstants.isKeyDown(id, GLFW.GLFW_KEY_LEFT_ALT) || InputConstants.isKeyDown(id, GLFW.GLFW_KEY_RIGHT_ALT); @@ -431,7 +429,7 @@ public static boolean canSeeSunClearly(Level world, BlockPos blockPos) { } ResourceLocation javdVoidBiome = new ResourceLocation("javd", "void"); - if (GTCEu.isJAVDLoaded() && + if (GTCEu.Mods.isJAVDLoaded() && world.registryAccess().registryOrThrow(Registries.BIOME).getKey(biome).equals(javdVoidBiome)) { return !world.isDay(); } else return world.isDay(); diff --git a/src/main/java/com/gregtechceu/gtceu/utils/input/KeyBind.java b/src/main/java/com/gregtechceu/gtceu/utils/input/KeyBind.java index 6590f2d556..82e6a6b61d 100644 --- a/src/main/java/com/gregtechceu/gtceu/utils/input/KeyBind.java +++ b/src/main/java/com/gregtechceu/gtceu/utils/input/KeyBind.java @@ -4,8 +4,6 @@ import com.gregtechceu.gtceu.common.network.GTNetwork; import com.gregtechceu.gtceu.common.network.packets.CPacketKeysPressed; -import com.lowdragmc.lowdraglib.Platform; - import net.minecraft.client.KeyMapping; import net.minecraft.client.Minecraft; import net.minecraft.server.level.ServerPlayer; @@ -50,7 +48,7 @@ public enum KeyBind { public static void init() { GTCEu.LOGGER.info("Registering KeyBinds"); - if (Platform.isClient()) { + if (GTCEu.isClientSide()) { MinecraftForge.EVENT_BUS.register(KeyBind.class); } } @@ -115,19 +113,19 @@ public static boolean scrollingDown() { // For Vanilla/Other Mod keybinds // Double Supplier to keep client classes from loading KeyBind(Supplier> keybindingGetter) { - if (Platform.isClient()) { + if (GTCEu.isClientSide()) { this.keybindingGetter = keybindingGetter; } } KeyBind(String langKey, int button) { - if (Platform.isClient()) { + if (GTCEu.isClientSide()) { this.keybinding = new KeyMapping(langKey, button, GTCEu.NAME); } } KeyBind(String langKey, IKeyConflictContext ctx, int button) { - if (Platform.isClient()) { + if (GTCEu.isClientSide()) { this.keybinding = new KeyMapping(langKey, ctx, InputConstants.Type.KEYSYM, button, GTCEu.NAME); } }