Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hi there. I have a custom block where I pass this in the constructor:

super(Properties.of(Material.STONE)
                //.harvestLevel(HarvestLevel.STONE.value())
                //.harvestTool(ToolType.PICKAXE)
                .noDrops()
                .requiresCorrectToolForDrops()
                .strength(15f)

 

When I start my server, the following error is thrown:

[17:41:58] [main/ERROR] [ne.mi.fm.ja.FMLModContainer/]: Exception caught during firing event: STONE
        Index: 1
        Listeners:
                0: NORMAL
                1: ASM: net.minecraftforge.registries.DeferredRegister$EventDispatcher@fdd7c7d handleEvent(Lnet/minecraftforge/event/RegistryEvent$Register;)V
                2: ASM: net.minecraftforge.registries.DeferredRegister$EventDispatcher@3223a6e7 handleEvent(Lnet/minecraftforge/event/RegistryEvent$Register;)V
java.lang.NoSuchFieldError: STONE
        at TRANSFORMER/[email protected]/com.playarcanum.genesis.common.game.block.blocks.ore.BlockAmethystOre.<init>(BlockAmethystOre.java:27)
        at TRANSFORMER/[email protected]/net.minecraftforge.registries.DeferredRegister.lambda$register$0(DeferredRegister.java:214)
        at TRANSFORMER/[email protected]/net.minecraftforge.registries.DeferredRegister.addEntries(DeferredRegister.java:446)
        at TRANSFORMER/[email protected]/net.minecraftforge.registries.DeferredRegister$EventDispatcher.handleEvent(DeferredRegister.java:376)
        at net.minecraftforge.eventbus.ASMEventHandler_0_EventDispatcher_handleEvent_Register.invoke(.dynamic)
        at MC-BOOTSTRAP/[email protected]/net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:85)
        at MC-BOOTSTRAP/[email protected]/net.minecraftforge.eventbus.EventBus.post(EventBus.java:302)
        at MC-BOOTSTRAP/[email protected]/net.minecraftforge.eventbus.EventBus.post(EventBus.java:283)
        at LAYER PLUGIN/[email protected]/net.minecraftforge.fml.javafmlmod.FMLModContainer.acceptEvent(FMLModContainer.java:106)
        at LAYER PLUGIN/[email protected]/net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:107)
        at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804)
        at LAYER PLUGIN/[email protected]/net.minecraftforge.fml.ModWorkManager$SyncExecutor.driveOne(ModWorkManager.java:42)
        at LAYER PLUGIN/[email protected]/net.minecraftforge.fml.ModWorkManager$DrivenExecutor.drive(ModWorkManager.java:26)
        at LAYER PLUGIN/[email protected]/net.minecraftforge.fml.ModLoader.waitForTransition(ModLoader.java:201)
        at LAYER PLUGIN/[email protected]/net.minecraftforge.fml.ModLoader.lambda$dispatchAndHandleError$21(ModLoader.java:186)
        at java.base/java.util.Optional.ifPresent(Optional.java:178)
        at LAYER PLUGIN/[email protected]/net.minecraftforge.fml.ModLoader.dispatchAndHandleError(ModLoader.java:186)
        at LAYER PLUGIN/[email protected]/net.minecraftforge.fml.ModLoader.lambda$gatherAndInitializeMods$11(ModLoader.java:163)
        at java.base/java.lang.Iterable.forEach(Iterable.java:75)
        at LAYER PLUGIN/[email protected]/net.minecraftforge.fml.ModLoader.gatherAndInitializeMods(ModLoader.java:163)
        at TRANSFORMER/[email protected]/net.minecraftforge.server.loading.ServerModLoader.load(ServerModLoader.java:32)
        at TRANSFORMER/[email protected]/net.minecraft.server.Main.main(Main.java:112)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at MC-BOOTSTRAP/[email protected]/net.minecraftforge.fml.loading.targets.CommonServerLaunchHandler.lambda$launchService$0(CommonServerLaunchHandler.java:32)
        at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37)
        at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53)
        at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71)
        at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.Launcher.run(Launcher.java:106)
        at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.Launcher.main(Launcher.java:77)
        at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26)
        at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23)
        at [email protected]/cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:149)

 

The strange this is that `Material.STONE` very much exists. So that leaves me to guess that maybe it has something to do with Parchment mappings or my build.gradle, although I'm not entirely sure. Here's the build.gradle:

buildscript {
    repositories {
        // These repositories are only for Gradle plugins, put any other repositories in the repository block further below
        maven { url = 'https://maven.minecraftforge.net' }
        maven { url = 'https://maven.parchmentmc.org' }
        maven { url = 'https://repo.spongepowered.org/repository/maven-public/' }
        mavenCentral()
    }
    dependencies {
        classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
        classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT'
        classpath 'org.parchmentmc:librarian:1.+'
    }
}

plugins {
    id 'com.github.johnrengelman.shadow' version '6.0.0'
    id 'maven-publish'
}

apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'org.parchmentmc.librarian.forgegradle'
apply plugin: 'org.spongepowered.mixin'
apply plugin: 'com.github.johnrengelman.shadow'

group = "com.playarcanum"
version = "0.0.1"
archivesBaseName = "genesis"

java {
    toolchain.languageVersion = JavaLanguageVersion.of(17)
}

tasks.withType(JavaCompile).configureEach {
    options.encoding = 'UTF-8'
}

minecraft {
    mappings channel: 'parchment', version: '2022.08.02-1.18.2'

    runs {
        client {
            workingDirectory project.file('run')

            property 'forge.logging.markers', 'REGISTRIES'
            property 'forge.logging.console.level', 'debug'

            // Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
            property 'forge.enabledGameTestNamespaces', 'genesis'

            mods {
                genesis {
                    source sourceSets.main
                }
            }
        }

        server {
            workingDirectory project.file('run')

            property 'forge.logging.markers', 'REGISTRIES'
            property 'forge.logging.console.level', 'debug'
            property 'forge.enabledGameTestNamespaces', 'genesis'

            mods {
                genesis {
                    source sourceSets.main
                }
            }
        }

        gameTestServer {
            workingDirectory project.file('run')

            property 'forge.logging.markers', 'REGISTRIES'

            property 'forge.logging.console.level', 'debug'

            property 'forge.enabledGameTestNamespaces', 'genesis'

            mods {
                genesis {
                    source sourceSets.main
                }
            }
        }

        data {
            workingDirectory project.file('run')

            property 'forge.logging.markers', 'REGISTRIES'
            property 'forge.logging.console.level', 'debug'

            args '--mod', 'genesis', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')

            mods {
                genesis {
                    source sourceSets.main
                }
            }
        }
    }
}

mixin {
    add sourceSets.main, "genesis.refmap.json"
    config "genesis.mixins.json"
}

sourceSets.main.resources { srcDir 'src/generated/resources' }

repositories {
    maven { url 'https://jitpack.io' }
}

configurations {
    shade
}

ext {
    
}

dependencies {
    minecraft "net.minecraftforge:forge:1.18.2-40.1.0"

//    deobfProvided "mezz.jei:jei_${mc_version}:${jei_version}:api"
//    runtime "mezz.jei:jei_${mc_version}:${jei_version}"
//    compile "org.apache.httpcomponents:fluent-hc:${httpclient_version}"
}

// Example for how to get properties into the manifest for reading at runtime.
jar {
    manifest {
        attributes([
                "Specification-Title"     : "genesis",
                //"Specification-Vendor": "test authors",
                "Specification-Version"   : "1", // We are version 1 of ourselves
                "Implementation-Title"    : project.name,
                "Implementation-Version"  : project.jar.archiveVersion,
                //"Implementation-Vendor": "test authors",
                "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
        ])
    }
}

shadowJar {
    archiveName("${mod_name}-${mc_version}-${mod_version}.jar")
    classifier = ''
    configurations = [project.configurations.shade]
}

reobf {
    shadowJar{}
}

tasks.build.dependsOn reobfShadowJar
jar.finalizedBy('reobfShadowJar')


Any help is greatly appreciated! Thank you!

Edited by Jimmeh

8 hours ago, Jimmeh said:

Hi there. I have a custom block where I pass this in the constructor:

Please post the full class

  • Author
5 hours ago, Luis_ST said:

Please post the full class

Hi Luis, here's the full class for the example above:

public class BlockAmethystOre extends AbstractBlock implements Lootable {
    public BlockAmethystOre() {
        super(Properties.of(Material.STONE)
                //.harvestLevel(HarvestLevel.STONE.value())
                //.harvestTool(ToolType.PICKAXE)
                .noDrops()
                .requiresCorrectToolForDrops()
                .strength(15f),

                BlockTypes.AMETHYST_ORE,

                null);
    }

    @Override
    protected @NonNull InteractionResult onRightClick(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult traceResult, boolean clientSide) {
        return InteractionResult.PASS;
    }

    @Override
    protected @NonNull InteractionResult onLeftClick(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult traceResult, boolean clientSide) {
        return InteractionResult.PASS;
    }

    public static final class BlockItemAmethyst extends AbstractBlockItem {
        private static final Item.Properties properties = new Item.Properties().tab(ModItemGroups.GROUP);

        public BlockItemAmethyst(AbstractBlock block) {
            super(block, properties);
        }
    }
}


That extends my own "AbstractBlock" class, which is here:

public abstract class AbstractBlock extends Block {
    @Getter private final BlockType type;

    public AbstractBlock(Properties blockProperties, final @NonNull BlockType type) {
        super(blockProperties);

        this.type = type;
    }

    protected abstract @NonNull InteractionResult onRightClick(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult traceResult, boolean clientSide);
    protected abstract @NonNull InteractionResult onLeftClick(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult traceResult, boolean clientSide);

    //TODO this is deprecated. This is called from AbstractBlock.AbstractState#use. When updating, figure out what that calls
    @Override
    public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult traceResult) {
        return hand == InteractionHand.MAIN_HAND ? this.onLeftClick(state, world, pos, player, traceResult, world.isClientSide)
                : this.onRightClick(state, world, pos, player, traceResult, world.isClientSide);
    }
}

 

"BlockType" is also my own class. Hopefully that all makes sense. Thanks!

  • Author
5 minutes ago, diesieben07 said:

Make sure you imported the correct "Material" class.

I've imported: 

import net.minecraft.world.level.material.Material;

 

This worked prior to me updating to 1.18.2 from 1.16.5, which is why I thought that maybe I messed up my build.gradle somehow. 

  • Author

Update on this: I simply tried using a different task to build the jar, specifically using "reobfShadowJar" instead of "shadowJar" and it worked. 

  • Jimmeh changed the title to [Solved] Material.STONE Apparently Doesn't Exist...

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.