Jump to content

[Solved] Material.STONE Apparently Doesn't Exist...


Jimmeh

Recommended Posts

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
Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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. 

Link to comment
Share on other sites

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

×   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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Thank all of you so much you are fucking psychos for doing this thank you so much :)
    • i have this custome crossbow i made  it autoloads after the first shoot is nice and all    but i don't like how when aiming it begins missaligned a little to the right then it slowly trembles a few and aligning whit the crosshair   this is coze the bow animation id vertical and made this crosbow rotate 90degrees      public UseAnim getUseAnimation(ItemStack p_40678_) {         return UseAnim.BOW;     } why i dont use UseAnim.CROSSBOW  for a crossbow  you see  the vainilla crossbow from the CrossbowItem.class uses a tag to know if its pulling to load an arrow or to shoot  private static final String TAG_CHARGED = "Charged"; i copy this methods to mi crossbow and set to UseAnim.CROSSBOW  but dont seems to do nothing     public static boolean isCharged(ItemStack p_40933_) {       CompoundTag compoundtag = p_40933_.getTag();       return compoundtag != null && compoundtag.getBoolean("Charged");    }    public static void setCharged(ItemStack p_40885_, boolean p_40886_) {       CompoundTag compoundtag = p_40885_.getOrCreateTag();       compoundtag.putBoolean("Charged", p_40886_);    } inside LivingEntity.class there is this   .getUseItemRemainingTicks()  thats used to calculate the bow pulling but seems like theres no .setUseItemRemainingTicks()   hoping to be understandable          i need to override the way the pulling animation is calculated to set it to the max from the beginning just for the sake of aesthetics             
    • So I'm able to download modpacks from curse forge get the into the minecraft mod folder but once the upload starts on the launcher it get's to the end and just won't progress does any one know what the issue might be I've uninstalled and reinstalled everything but I keep having the same problem.
    • { "type": "minecraft:crafting_shaped", "pattern": [ "i i", " R ", "i i" ], "key": { "i": { "item": "minecraft:iron_ingot" }, "R": { "item": "minecraft:redstone" } }, "result": { "id": "minecraft:iron_ingot" } } I'm having a problem where I've created a simple crafting recipe that takes in redstone dust and 4 iron ingots and returns an iron ingot (just for testing purposes). I have the file in my resouces/data/(modid)/recipes directory. However, the recipe does not work and I get no output when actually using a crafting table. Any help would be useful.
    • try removing xaeros world map.
  • Topics

×
×
  • Create New...

Important Information

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