Jump to content

[Solved][1.15.2] Mod in jar has different or missing MC dependency?


MongoTheElder

Recommended Posts

I'm hoping I just missing something simple...

 

I have a mod that works when the client launched in the IDE (gradle task fg_runs/runClient) but when packaged into a JAR and started using the Minecraft launcher (with Forge installed) I get an error that Minecraft methods are not defined. Other mods in this install are functioning correctly.

 

The imports are not throwing an exception, only when the methods are referenced in my code.

I have verified that the correct 'minecraft' dependency is defined in 'build.gradle' (minecraft 'net.minecraftforge:forge:1.15.2-31.1.0')

Is there something that needs to be configured (or run) when building the JAR other than running the gradle build/jar task provided by Forge in the MDK?

 

The error:

[11Apr2020 15:26:05.555] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher running: args [--username, MongoTheElder, --version, 1.15.2-forge-31.1.0, --gameDir, C:\Users\Mongo\AppData\Roaming\.minecraft, --assetsDir, C:\Users\Mongo\AppData\Roaming\.minecraft\assets, --assetIndex, 1.15, --uuid, 79581d923bf442efa97d15615f673b29, --accessToken, ????????, --userType, mojang, --versionType, release, --launchTarget, fmlclient, --fml.forgeVersion, 31.1.0, --fml.mcVersion, 1.15.2, --fml.forgeGroup, net.minecraftforge, --fml.mcpVersion, 20200122.131323]
[11Apr2020 15:26:05.558] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher 5.0.0-milestone.4+67+b1a340b starting: java version 1.8.0_171 by Oracle Corporation
[11Apr2020 15:26:06.111] [main/INFO] [net.minecraftforge.fml.loading.FixSSL/CORE]: Added Lets Encrypt root certificates as additional trust
[11Apr2020 15:26:06.808] [main/INFO] [cpw.mods.modlauncher.LaunchServiceHandler/MODLAUNCHER]: Launching target 'fmlclient' with arguments [--version, 1.15.2-forge-31.1.0, --gameDir, C:\Users\Mongo\AppData\Roaming\.minecraft, --assetsDir, C:\Users\Mongo\AppData\Roaming\.minecraft\assets, --uuid, 79581d923bf442efa97d15615f673b29, --username, MongoTheElder, --assetIndex, 1.15, --accessToken, ????????, --userType, mojang, --versionType, release]
[11Apr2020 15:26:08.431] [Render thread/INFO] [net.minecraft.client.Minecraft/]: Setting user: MongoTheElder
[11Apr2020 15:26:14.017] [Render thread/INFO] [net.minecraft.client.Minecraft/]: Backend library: LWJGL version 3.2.2 build 10
[11Apr2020 15:26:15.210] [modloading-worker-2/INFO] [net.minecraftforge.common.ForgeMod/FORGEMOD]: Forge mod loading, version 31.1.0, for MC 1.15.2 with MCP 20200122.131323
[11Apr2020 15:26:15.210] [modloading-worker-2/INFO] [net.minecraftforge.common.MinecraftForge/FORGE]: MinecraftForge v31.1.0 Initialized
[11Apr2020 15:26:15.661] [Render thread/ERROR] [net.minecraftforge.fml.javafmlmod.FMLModContainer/]: Exception caught during firing event: net.minecraft.state.BooleanProperty.create(Ljava/lang/String;)Lnet/minecraft/state/BooleanProperty;
	Index: 1
	Listeners:
		0: NORMAL
		1: net.minecraftforge.eventbus.EventBus$$Lambda$2106/292099569@687f62a5
		2: net.minecraftforge.eventbus.EventBus$$Lambda$2106/292099569@7857cb1d
java.lang.NoSuchMethodError: net.minecraft.state.BooleanProperty.create(Ljava/lang/String;)Lnet/minecraft/state/BooleanProperty;
	at tv.mongotheelder.pitg.blocks.GlassPane.<clinit>(GlassPane.java:26)
	at tv.mongotheelder.pitg.setup.Registration.lambda$static$0(Registration.java:27)
	at net.minecraftforge.registries.DeferredRegister.lambda$register$0(DeferredRegister.java:84)
	at net.minecraftforge.registries.DeferredRegister.addEntries(DeferredRegister.java:117)
	at net.minecraftforge.eventbus.EventBus.doCastFilter(EventBus.java:212)
	at net.minecraftforge.eventbus.EventBus.lambda$addListener$11(EventBus.java:204)
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:258)
	at net.minecraftforge.fml.javafmlmod.FMLModContainer.fireEvent(FMLModContainer.java:106)
	at java.util.function.Consumer.lambda$andThen$0(Consumer.java:65)
	at java.util.function.Consumer.lambda$andThen$0(Consumer.java:65)
	at net.minecraftforge.fml.ModContainer.transitionState(ModContainer.java:112)
	at net.minecraftforge.fml.ModList.lambda$dispatchSynchronousEvent$5(ModList.java:125)
	at java.util.ArrayList.forEach(ArrayList.java:1257)
	at net.minecraftforge.fml.ModList.dispatchSynchronousEvent(ModList.java:125)
	at net.minecraftforge.fml.ModList.lambda$static$1(ModList.java:96)
	at net.minecraftforge.fml.LifecycleEventProvider.dispatch(LifecycleEventProvider.java:71)
	at net.minecraftforge.fml.ModLoader.dispatchAndHandleError(ModLoader.java:197)
	at net.minecraftforge.fml.ModLoader.lambda$gatherAndInitializeMods$24(ModLoader.java:189)
	at net.minecraftforge.registries.GameData.fireRegistryEvents(GameData.java:964)
	at net.minecraftforge.fml.ModLoader.gatherAndInitializeMods(ModLoader.java:189)
	at net.minecraftforge.fml.client.ClientModLoader.lambda$begin$2(ClientModLoader.java:97)
	at net.minecraftforge.fml.client.ClientModLoader.lambda$createRunnableWithCatch$5(ClientModLoader.java:113)
	at net.minecraftforge.fml.client.ClientModLoader.begin(ClientModLoader.java:97)
	at net.minecraft.client.Minecraft.<init>(Minecraft.java:393)
	at net.minecraft.client.main.Main.main(SourceFile:166)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at net.minecraftforge.fml.loading.FMLClientLaunchProvider.lambda$launchService$0(FMLClientLaunchProvider.java:56)
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37)
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54)
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72)
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:81)
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:65)

 

The code segment it is referring to:

package tv.mongotheelder.pitg.blocks;

import it.unimi.dsi.fastutil.objects.Object2IntMap;
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.IWaterLoggable;
import net.minecraft.fluid.Fluids;
import net.minecraft.fluid.IFluidState;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.pathfinding.PathType;
import net.minecraft.state.BooleanProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.util.Direction;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.shapes.VoxelShapes;
import net.minecraft.world.IBlockReader;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class GlassPane extends Block implements IWaterLoggable {
    public static final BooleanProperty NORTH = BooleanProperty.create("north");
    public static final BooleanProperty EAST = BooleanProperty.create("east");
    public static final BooleanProperty SOUTH = BooleanProperty.create("south");
    public static final BooleanProperty WEST = BooleanProperty.create("west");
    public static final BooleanProperty WATERLOGGED = BooleanProperty.create("waterlogged");
    public static final int NORTH_MASK = 0b0001;
    public static final int WEST_MASK = 0b0010;
    public static final int SOUTH_MASK = 0b0100;
    public static final int EAST_MASK = 0b1000;

    protected final VoxelShape[] shapes;
    protected final VoxelShape[] collisionShapes;
    private final Object2IntMap<BlockState> indexHash = new Object2IntOpenHashMap<>();
    private static final double PANE_WIDTH = 16.0;
    private static final double PANE_THICKNESS = 2.0;
    private static final double PANE_HEIGHT = 16.0;

    private static final double CORNER_HITBOX_SIZE = 0.25;

    private static final Logger LOGGER = LogManager.getLogger();

    public GlassPane(Properties properties) {
        super(properties);
        this.shapes = this.makeShapes(PANE_WIDTH, PANE_THICKNESS, PANE_HEIGHT);
        this.collisionShapes = this.makeShapes(PANE_WIDTH, PANE_THICKNESS, PANE_HEIGHT);
        this.setDefaultState(this.stateContainer.getBaseState()
                .with(NORTH, Boolean.FALSE)
                .with(EAST, Boolean.FALSE)
                .with(SOUTH, Boolean.FALSE)
                .with(WEST, Boolean.FALSE)
                .with(WATERLOGGED, Boolean.FALSE));
    }

 

 

The exception is happening on the definition of NORTH as a static BooleanProperty.

 

Things I have tried to remediate this:

1) Defined my own version of BooleanProperty. This works but it just pushes the exception to the next instance of code referencing a minecraft method

2) Doing a fresh install of MC and Forge

3) Changing the default Java path in the MinecraftLauncher profile to point to the same one used in the IDE (java 1.8_171)

4) Added a second mod (JEI) to make sure everything else is working

 

 

 

MC version 1.15.2

Forge version 31.1.0

MCP 20200122.131323

 

 

Edited by MongoTheElder
Issue solved
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.