Jump to content

Recommended Posts

Posted (edited)

Hello, I am following along with McJty's 1.12 modding tutorials and am at the point where I am creating a Tile Entity. I have followed the tutorial and there are no errors in IntelliJ. However, when I try to load the game it crashes.

I was stupid and forgot to change something from his tutorial to fit my mod. 

Crash Log:

Spoiler

---- Minecraft Crash Report ----
// Ooh. Shiny.

Time: 7/15/17 5:49 PM
Description: Initializing game

java.lang.NullPointerException: Initializing game
    at atm2222.firstmod.proxy.CommonProxy.registerItems(CommonProxy.java:60)
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_5_CommonProxy_registerItems_Register.invoke(.dynamic)
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90)
    at net.minecraftforge.fml.common.eventhandler.EventBus$1.invoke(EventBus.java:143)
    at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:179)
    at net.minecraftforge.registries.GameData.fireRegistryEvents(GameData.java:723)
    at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:605)
    at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:266)
    at net.minecraft.client.Minecraft.init(Minecraft.java:508)
    at net.minecraft.client.Minecraft.run(Minecraft.java:416)
    at net.minecraft.client.main.Main.main(Main.java:118)
    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:497)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
    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:497)
    at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
    at GradleStart.main(GradleStart.java:26)
    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:497)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Client thread
Stacktrace:
    at atm2222.firstmod.proxy.CommonProxy.registerItems(CommonProxy.java:60)
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_5_CommonProxy_registerItems_Register.invoke(.dynamic)
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90)
    at net.minecraftforge.fml.common.eventhandler.EventBus$1.invoke(EventBus.java:143)
    at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:179)
    at net.minecraftforge.registries.GameData.fireRegistryEvents(GameData.java:723)
    at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:605)
    at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:266)
    at net.minecraft.client.Minecraft.init(Minecraft.java:508)

-- Initialization --
Details:
Stacktrace:
    at net.minecraft.client.Minecraft.run(Minecraft.java:416)
    at net.minecraft.client.main.Main.main(Main.java:118)
    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:497)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
    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:497)
    at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
    at GradleStart.main(GradleStart.java:26)
    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:497)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)

-- System Details --
Details:
    Minecraft Version: 1.12
    Operating System: Windows 10 (amd64) version 10.0
    Java Version: 1.8.0_73, Oracle Corporation
    Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
    Memory: 819777688 bytes (781 MB) / 1007157248 bytes (960 MB) up to 3808428032 bytes (3632 MB)
    JVM Flags: 0 total; 
    IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
    FML: MCP 9.40 Powered by Forge 14.21.1.2413 5 mods loaded, 5 mods active
    States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
    UCH    minecraft{1.12} [Minecraft] (minecraft.jar) 
    UCH    mcp{9.19} [Minecraft Coder Pack] (minecraft.jar) 
    UCH    FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.12-14.21.1.2413.jar) 
    UCH    forge{14.21.1.2413} [Minecraft Forge] (forgeSrc-1.12-14.21.1.2413.jar) 
    UCH    firstmod{0.0.1} [Atm2222s First Mod] (FirstMod_main) 
    Loaded coremods (and transformers): 
    GL info: ' Vendor: 'ATI Technologies Inc.' Version: '4.5.13474 Compatibility Profile Context 22.19.162.4' Renderer: 'AMD Radeon R9 200 Series'
    Launched Version: 1.12
    LWJGL: 2.9.4
    OpenGL: AMD Radeon R9 200 Series GL version 4.5.13474 Compatibility Profile Context 22.19.162.4, ATI Technologies Inc.
    GL Caps: Using GL 1.3 multitexturing.
Using GL 1.3 texture combiners.
Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
Shaders are available because OpenGL 2.1 is supported.
VBOs are available because OpenGL 1.5 is supported.

    Using VBOs: Yes
    Is Modded: Definitely; Client brand changed to 'fml,forge'
    Type: Client (map_client.txt)
    Resource Packs: 
    Current Language: English (US)
    Profiler Position: N/A (disabled)
    CPU: 4x Intel(R) Core(TM) i5-4690K CPU @ 3.50GHz

 

From this log, I know it occurs on line 60 or my CommonProxy Method.

CommonProxy:

Spoiler

package atm2222.firstmod.proxy;

import atm2222.firstmod.Config;
import atm2222.firstmod.FirstMod;
import atm2222.firstmod.ModBlocks;
import atm2222.firstmod.blocks.FirstBlock;
import atm2222.firstmod.blocks.datablock.DataBlock;
import atm2222.firstmod.blocks.datablock.DataTileEntity;
import atm2222.firstmod.items.FirstItem;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;

import java.io.File;

@Mod.EventBusSubscriber
public class CommonProxy {

    // Config instance
    public static Configuration config;

    public void preInit(FMLPreInitializationEvent e) {
        File directory = e.getModConfigurationDirectory();
        config = new Configuration(new File(directory.getPath(), "modtut.cfg"));
        Config.readConfig();
    }

    public void init(FMLInitializationEvent e) {
    }

    public void postInit(FMLPostInitializationEvent e) {
        if (config.hasChanged()) {
            config.save();
        }
    }

    @SubscribeEvent
    public static void registerBlocks(RegistryEvent.Register<Block> event) {
        event.getRegistry().register(new FirstBlock());

        event.getRegistry().register(new DataBlock());
        GameRegistry.registerTileEntity(DataTileEntity.class, FirstMod.MODID + "_datablock");
    }

    @SubscribeEvent
    public static void registerItems(RegistryEvent.Register<Item> event) {
        event.getRegistry().register(new ItemBlock(ModBlocks.firstBlock).setRegistryName(ModBlocks.firstBlock.getRegistryName()));

        event.getRegistry().register(new ItemBlock(ModBlocks.dataBlock).setRegistryName(ModBlocks.dataBlock.getRegistryName()));


        event.getRegistry().register(new FirstItem());

    }
}
 

Here are the two files pertaining to the TileEntity.

Spoiler

package atm2222.firstmod.blocks.datablock;

import atm2222.firstmod.FirstMod;
import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import java.util.List;

public class DataBlock extends Block implements ITileEntityProvider{

    public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL);

    public DataBlock() {
        super(Material.ROCK);
        setUnlocalizedName(FirstMod.MODID + ".datablock");
        setRegistryName("datablock");
    }

    @SideOnly(Side.CLIENT)
    public void initModel() {
        ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(this), 0, new ModelResourceLocation(getRegistryName(), "inventory"));
    }

    @Override
    public TileEntity createNewTileEntity(World worldIn, int meta) {
        return new DataTileEntity();
    }

    private DataTileEntity getTE(World world, BlockPos pos) {
        return (DataTileEntity) world.getTileEntity(pos);
    }

    //@Override
    public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand,
    ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
        if (!world.isRemote) {
            // We only count on the server side.

            if (side == state.getValue(FACING)) {
                int counter;
                if (hitY < .5f) {
                    counter = getTE(world, pos).decrement();
                } else {
                    counter = getTE(world, pos).increment();
                }
                player.sendStatusMessage(new TextComponentString(TextFormatting.GREEN + "Counter: " + counter), false);
            }
        }
        // Return true also on the client to make sure that MC knows we handled this and will not try to place
        // a block on the client
        return true;
    }

    @Override
    public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
        world.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing().getOpposite()), 2);
    }

    @Override
    public IBlockState getStateFromMeta(int meta) {
        // Since we only allow horizontal rotation we need only 2 bits for facing. North, South, West, East start at index 2 so we have to add 2 here.
        return getDefaultState().withProperty(FACING, EnumFacing.getFront((meta & 3) + 2));
    }

    @Override
    public int getMetaFromState(IBlockState state) {
        // Since we only allow horizontal rotation we need only 2 bits for facing. North, South, West, East start at index 2 so we have to subtract 2 here.
        return state.getValue(FACING).getIndex()-2;
    }

    @Override
    protected BlockStateContainer createBlockState() {
        return new BlockStateContainer(this, FACING);
    }
}
 
Spoiler

package atm2222.firstmod.blocks.datablock;

import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;

public class DataTileEntity extends TileEntity{

    private int counter = 0;

    public int decrement() {
        counter--;
        markDirty();
        return counter;
    }

    public int increment() {
        counter++;
        markDirty();
        return counter;
    }

    @Override
    public void readFromNBT(NBTTagCompound compound) {
        super.readFromNBT(compound);
        counter = compound.getInteger("counter");
    }

    @Override
    public NBTTagCompound writeToNBT(NBTTagCompound compound) {
        super.writeToNBT(compound);
        compound.setInteger("counter", counter);
        return compound;
    }
}
 

Here is another possibly important class:

Spoiler

package atm2222.firstmod;

import atm2222.firstmod.blocks.FirstBlock;
import atm2222.firstmod.blocks.datablock.DataBlock;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public class ModBlocks {

    @SideOnly(Side.CLIENT)
    public static void initModels() {
        dataBlock.initModel();
    }
    @GameRegistry.ObjectHolder("firstmod:firstblock")
    public static FirstBlock firstBlock;

    @GameRegistry.ObjectHolder("modtut:datablock")
    public static DataBlock dataBlock;


}
 

If anybody knows of any common causes of this issue, please tell me!

 

Thanks!!

Edited by Atm2222
Problem Solved
Posted

Oh, God thanks. I can't believe I was so stupid to not do that. modtut is mcjty's name, firstmod is mine. Thanks for helping by giving it a second look. :)

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

    • When i try to join my friends server with mods it just says failed to log in: the authentication servers are currently not reachable. I've been having this issue for a while now and no method I've tried to fix it works. I've seen a lot of people fixing it by modifying the host.txt file and removing anything related to Mojang but when I open mine there's nothing related to Mojang there. I also tried flushing DNS cache, and changing my IPV6 to 8888, but nothing works.  It only happens when the mods are on too. When I join my friends server on vanilla it works, but not with mods. I can join multiplayer servers like hypixel. I can also play singleplayer with the mods and it works perfectly. The mods are up to date with the versions and the servers, but it just never gets past "Logging in" when i try to join their server. I use Curseforge to launch my mods, so that could maybe have something to do with it because it's technically a third party server, but it hasn't given me any trouble besides this one issue. I do not have MCLeaks and don't know what that is, but how can i search for it anyway to make sure? I have uninstalled minecraft launcher, updated my microsoft and my videocard drivers, reset my wifi and checked my parental settings (I am the owner on my computer), flushed my dns, modifying my host file to delete mojang but there's nothing with mojang on there, disabled my firewall, changed my IPV6 domain to 8888, restarted my router, and none of that works. I have researched this issue thoroughly and tried every solution I have came across and nothing is fixing the problem so i have come here as a last ditch effort. All i want to do is play mods with my friend. My friend has no issues with the server or mods and he has it through curseforge too. I would like further assistance in any way you think could help or even refer me to another forum that could help with this. Genuinely I cannot figure out why it doesn't work I would love any sort of further help.  
    • been getting this error and followed the old tick loop post however i cant figure out what file to delete Description: Exception in server tick loop java.lang.NullPointerException: Cannot invoke "net.minecraft.world.level.LevelAccessor.m_7654_()" because the return value of "net.minecraftforge.event.level.LevelEvent$Unload.getLevel()" is null     at com.lion.graveyard.platform.forge.HordeSpawner.onWorldUnload(HordeSpawner.java:41) ~[The_Graveyard_3.1_(FORGE)_for_1.20.1.jar%23196!/:?] {re:classloading}     at com.lion.graveyard.platform.forge.__HordeSpawner_onWorldUnload_Unload.invoke(.dynamic) ~[The_Graveyard_3.1_(FORGE)_for_1.20.1.jar%23196!/:?] {re:classloading,pl:eventbus:B}     at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:73) ~[eventbus-6.0.5.jar%2352!/:?] {}     at net.minecraftforge.eventbus.EventBus.post(EventBus.java:315) ~[eventbus-6.0.5.jar%2352!/:?] {}     at net.minecraftforge.eventbus.EventBus.post(EventBus.java:296) ~[eventbus-6.0.5.jar%2352!/:?] {}     at net.mehvahdjukaar.moonlight.api.platform.forge.PlatHelperImpl.invokeLevelUnload(PlatHelperImpl.java:279) ~[moonlight-1.20-2.13.66-forge.jar%23185!/:?] {re:classloading}     at net.mehvahdjukaar.moonlight.api.platform.PlatHelper.invokeLevelUnload(PlatHelper.java) ~[moonlight-1.20-2.13.66-forge.jar%23185!/:?] {re:mixin,re:classloading}     at net.mehvahdjukaar.moonlight.core.misc.FakeLevelManager.invalidate(FakeLevelManager.java:29) ~[moonlight-1.20-2.13.66-forge.jar%23185!/:?] {re:classloading}     at net.mehvahdjukaar.supplementaries.common.utils.fake_level.BlockTestLevel.invalidate(BlockTestLevel.java:34) ~[supplementaries-1.20-3.1.13.jar%23192!/:?] {re:classloading}     at net.mehvahdjukaar.supplementaries.common.block.faucet.FaucetBehaviorsManager.onReloadWithLevel(FaucetBehaviorsManager.java:129) ~[supplementaries-1.20-3.1.13.jar%23192!/:?] {re:classloading}     at net.mehvahdjukaar.supplementaries.common.events.ServerEvents.onServerStart(ServerEvents.java:160) ~[supplementaries-1.20-3.1.13.jar%23192!/:?] {re:mixin,re:classloading}     at net.mehvahdjukaar.supplementaries.common.events.forge.ServerEventsForge.onServerStart(ServerEventsForge.java:119) ~[supplementaries-1.20-3.1.13.jar%23192!/:?] {re:classloading}     at net.mehvahdjukaar.supplementaries.common.events.forge.__ServerEventsForge_onServerStart_ServerStartedEvent.invoke(.dynamic) ~[supplementaries-1.20-3.1.13.jar%23192!/:?] {re:classloading,pl:eventbus:B}     at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:73) ~[eventbus-6.0.5.jar%2352!/:?] {}     at net.minecraftforge.eventbus.EventBus.post(EventBus.java:315) ~[eventbus-6.0.5.jar%2352!/:?] {}     at net.minecraftforge.eventbus.EventBus.post(EventBus.java:296) ~[eventbus-6.0.5.jar%2352!/:?] {}     at net.minecraftforge.server.ServerLifecycleHooks.handleServerStarted(ServerLifecycleHooks.java:115) ~[forge-1.20.1-47.3.29-universal.jar%23212!/:?] {re:classloading}     at net.minecraft.server.MinecraftServer.m_130011_(MinecraftServer.java:638) ~[server-1.20.1-20230612.114412-srg.jar%23207!/:?] {re:mixin,pl:accesstransformer:B,xf:fml:xaeroworldmap:xaero_wm_minecraftserver,xf:fml:xaerominimap:xaero_minecraftserver,re:classloading,pl:accesstransformer:B,xf:fml:xaeroworldmap:xaero_wm_minecraftserver,xf:fml:xaerominimap:xaero_minecraftserver,pl:mixin:APP:unionlib.mixins.json:MinecraftServerMixin,pl:mixin:APP:citadel.mixins.json:MinecraftServerMixin,pl:mixin:APP:balm.mixins.json:MinecraftServerMixin,pl:mixin:A}     at net.minecraft.server.MinecraftServer.m_206580_(MinecraftServer.java:251) ~[server-1.20.1-20230612.114412-srg.jar%23207!/:?] {re:mixin,pl:accesstransformer:B,xf:fml:xaeroworldmap:xaero_wm_minecraftserver,xf:fml:xaerominimap:xaero_minecraftserver,re:classloading,pl:accesstransformer:B,xf:fml:xaeroworldmap:xaero_wm_minecraftserver,xf:fml:xaerominimap:xaero_minecraftserver,pl:mixin:APP:unionlib.mixins.json:MinecraftServerMixin,pl:mixin:APP:citadel.mixins.json:MinecraftServerMixin,pl:mixin:APP:balm.mixins.json:MinecraftServerMixin,pl:mixin:A}     at java.lang.Thread.run(Thread.java:833) ~[?:?] {}  
    • Online forums in general seem to be declining in popularity imo. There’s still value here for certain types of content, such as written tutorials and blog posts which would otherwise get lost in the chat history fairly quickly on Discord. Also for those that prefer the forums format ofc. But for faster support related topics, I agree that the Discord is probably your best bet at the moment. The speed of responses is also down to the ratio of volunteers - the player support forum still seems pretty active, but the coding ones much less so. Once you’re feeling more confident in your modding skills, be the change you want to see
    • try the same link, i swapped logs after sitting in the world for a few minutes then leaving. Lmk if it keeps happening then ill just send a video of the live log on modrinth
    • It is an issue with chimes
  • Topics

×
×
  • Create New...

Important Information

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