Jump to content

Recommended Posts

Posted (edited)

Why is it?

Quote

---- Minecraft Crash Report ----
// My bad.

Time: 06.09.19 14:55
Description: Ticking entity

java.lang.NullPointerException: Ticking entity
    at net.minecraftforge.items.SlotItemHandler.getStack(SlotItemHandler.java:54) ~[?:?] {}
    at net.minecraft.inventory.container.Container.detectAndSendChanges(Container.java:128) ~[?:?] {}
    at net.minecraft.entity.player.ServerPlayerEntity.tick(ServerPlayerEntity.java:333) ~[?:?] {pl:accesstransformer:B}
    at net.minecraft.world.ServerWorld.updateEntity(ServerWorld.java:589) ~[?:?] {pl:accesstransformer:B}
    at net.minecraft.world.World.func_217390_a(World.java:737) ~[?:?] {pl:accesstransformer:B}
    at net.minecraft.world.ServerWorld.tick(ServerWorld.java:384) ~[?:?] {pl:accesstransformer:B}
    at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:847) ~[?:?] {pl:accesstransformer:B}
    at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:782) ~[?:?] {pl:accesstransformer:B}
    at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) ~[?:?] {pl:runtimedistcleaner:A}
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:631) [?:?] {pl:accesstransformer:B}
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_131] {}


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

-- Head --
Thread: Server thread
Stacktrace:
    at net.minecraftforge.items.SlotItemHandler.getStack(SlotItemHandler.java:54)
    at net.minecraft.inventory.container.Container.detectAndSendChanges(Container.java:128)
    at net.minecraft.entity.player.ServerPlayerEntity.tick(ServerPlayerEntity.java:333)
    at net.minecraft.world.ServerWorld.updateEntity(ServerWorld.java:589)

-- Entity being ticked --
Details:
    Entity Type: minecraft:player (net.minecraft.entity.player.ServerPlayerEntity)
    Entity ID: 107
    Entity Name: Dev
    Entity's Exact location: -21.88, 60.00, 156.54
    Entity's Block location: World: (-22,60,156), Chunk: (at 10,3,12 in -2,9; contains blocks -32,0,144 to -17,255,159), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)
    Entity's Momentum: 0.00, -0.08, 0.00
    Entity's Passengers: []
    Entity's Vehicle: ~~ERROR~~ NullPointerException: null
Stacktrace:
    at net.minecraft.world.World.func_217390_a(World.java:737)
    at net.minecraft.world.ServerWorld.tick(ServerWorld.java:384)

-- Affected level --
Details:
    Level name: Biome Test
    All players: 1 total; [ServerPlayerEntity['Dev'/107, l='Biome Test', x=-21.88, y=60.00, z=156.54]]
    Chunk stats: ServerChunkCache: 2809
    Level seed: 3165810158714979293
    Level generator: ID 05 - buffet, ver 0. Features enabled: true
    Level generator options: {biome_source:{options:{biomes:["morestuff:greeceforestmarble"]},type:"minecraft:fixed"},chunk_generator:{options:{default_fluid:"minecraft:water",default_block:"minecraft:stone"},type:"minecraft:floating_islands"}}
    Level spawn location: World: (-80,57,160), Chunk: (at 0,3,0 in -5,10; contains blocks -80,0,160 to -65,255,175), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)
    Level time: 153938 game time, 86542 day time
    Level dimension: 0
    Level storage version: 0x04ABD - Anvil
    Level weather: Rain time: 26445 (now: false), thunder time: 6026 (now: true)
    Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true
Stacktrace:
    at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:847)
    at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:782)
    at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:631)
    at java.lang.Thread.run(Thread.java:748)

-- System Details --
Details:
    Minecraft Version: 1.14.2
    Operating System: Windows 10 (amd64) version 10.0
    Java Version: 1.8.0_131, Oracle Corporation
    Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
    Memory: 277763632 bytes (264 MB) / 974127104 bytes (929 MB) up to 1430257664 bytes (1364 MB)
    JVM Flags: 1 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump
    FML: New FML!
    Loaded coremods (and transformers): Nothing
    Player Count: 1 / 8; [ServerPlayerEntity['Dev'/107, l='Biome Test', x=-21.88, y=60.00, z=156.54]]
    Data Packs: vanilla, mod:morestuff, mod:forge
    Type: Integrated Server (map_client.txt)
    Is Modded: Definitely; Client brand changed to 'forge'

 

Edited by MatsCraft1
Posted
21 hours ago, diesieben07 said:

Update to 1.14.4.

Post your code.

So I updated it.

Quote

[12:11:20] [Server thread/ERROR] [minecraft/MinecraftServer]: Encountered an unexpected exception
net.minecraft.crash.ReportedException: Ticking entity
    at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:869) ~[?:?] {pl:accesstransformer:B}
    at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:800) ~[?:?] {pl:accesstransformer:B}
    at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) ~[?:?] {pl:runtimedistcleaner:A}
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:646) [?:?] {pl:accesstransformer:B}
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_131] {}
Caused by: java.lang.NullPointerException
    at com.aug15.morestuff.blocks.containers.ContainerBarrelContainer.canInteractWith(ContainerBarrelContainer.java:64) ~[?:?] {}
    at net.minecraft.entity.player.ServerPlayerEntity.tick(ServerPlayerEntity.java:338) ~[?:?] {pl:accesstransformer:B}
    at net.minecraft.world.server.ServerWorld.updateEntity(ServerWorld.java:602) ~[?:?] {}
    at net.minecraft.world.World.func_217390_a(World.java:734) ~[?:?] {pl:accesstransformer:B}
    at net.minecraft.world.server.ServerWorld.tick(ServerWorld.java:397) ~[?:?] {}
    at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:865) ~[?:?] {pl:accesstransformer:B}
    ... 4 more

this is the piece of code

    @Override
    public boolean canInteractWith(PlayerEntity playerIn) {
        return isWithinUsableDistance(IWorldPosCallable.of(tileEntity.getWorld(), tileEntity.getPos()), playerEntity, ModBlocks.CONTAINEBARRELBLOCK);
    }

 

Posted
4 minutes ago, diesieben07 said:

Post the whole container class.

package com.aug15.morestuff.blocks.containers;

import com.aug15.morestuff.blocks.ModBlocks;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Container;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IWorldPosCallable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.SlotItemHandler;
import net.minecraftforge.items.wrapper.InvWrapper;

public class ContainerBarrelContainer extends Container {

    private TileEntity tileEntity;
    private PlayerEntity playerEntity;
    private IItemHandler playerInventory;

    public ContainerBarrelContainer(int windowId, World world, BlockPos pos, PlayerInventory playerInventory, PlayerEntity player)
    {
        super(ModBlocks.CONTAINEBARRELCONTAINER, windowId);
        TileEntity tileEntity = world.getTileEntity(pos);
        this.playerEntity = player;
        this.playerInventory = new InvWrapper(playerInventory);

        tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY).ifPresent(h -> {
            addSlot(new SlotItemHandler(h, 0, 64, 24));
        });
        layoutPlayerInventorySlots(10, 70);

    }

    private int addSlotRange(IItemHandler handler, int index, int x, int y, int amount, int dx) {
        for (int i = 0 ; i < amount ; i++) {
            addSlot(new SlotItemHandler(handler, index, x, y));
            x += dx;
            index++;
        }
        return index;
    }

    private int addSlotBox(IItemHandler handler, int index, int x, int y, int horAmount, int dx, int verAmount, int dy) {
        for (int j = 0 ; j < verAmount ; j++) {
            index = addSlotRange(handler, index, x, y, horAmount, dx);
            y += dy;
        }
        return index;
    }

    private void layoutPlayerInventorySlots(int leftCol, int topRow) {
        // Player inventory
        addSlotBox(playerInventory, 9, leftCol, topRow, 9, 18, 3, 18);

        // Hotbar
        topRow += 58;
        addSlotRange(playerInventory, 0, leftCol, topRow, 9, 18);
    }

    @Override
    public boolean canInteractWith(PlayerEntity playerIn) {
        return isWithinUsableDistance(IWorldPosCallable.of(tileEntity.getWorld(), tileEntity.getPos()), playerEntity, ModBlocks.CONTAINEBARRELBLOCK);
    }
    
}

 

I think I should also mention that the gui shows up for a second

Posted
13 minutes ago, diesieben07 said:

I doubt you own this domain.

 

Use EntityPlayer#getCapability instead of constructing your own capability wrapper.

 

You never initialize this field, so it's null.

Got it working!

I did this:

public class ContainerBarrelContainer extends Container {

    private TileEntity tileEntity;
    private PlayerEntity playerEntity;
    private IItemHandler playerInventory;

    public ContainerBarrelContainer(int windowId, World world, BlockPos pos, PlayerInventory playerInventory, PlayerEntity player)
    {
        super(ModBlocks.CONTAINEBARRELCONTAINER, windowId);
    tileEntity = world.getTileEntity(pos);
        this.playerEntity = player;
        this.playerInventory = new InvWrapper(playerInventory);

        tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY).ifPresent(h -> {
        addSlot(new SlotItemHandler(h, 0, 64, 24));
    });
    layoutPlayerInventorySlots(10, 70);
    }

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

    • logs too big for one pastebin https://pastebin.com/ZjUGHu3u  https://pastebin.com/RqCUZf3X  https://pastebin.com/6ZPS99nD
    • You probably used jd-gui to open it, didn't you? Nothing wrong with that, I also made that mistake, except that Notch was a smart guy and he obfuscated the code. That's why you only see files called "a", "b", "c" and then a file that combines them all. As I said, use RetroMCP to deobfuscate the code so that you will 100% understand it and be able to navigate it.
    • Decompiling minecraft indev, infdev, alpha, beta or whichever legacy version is really easy. I'm not a plug, I just also got interested in modding legacy versions (Infdev to be specific). Use https://github.com/MCPHackers/RetroMCP-Java Once you install their client and the Zulu Architecture that they say they recommend (or use your own Java). I encountered some problems, so I run it with: "java -jar RetroMCP-Java-CLI.jar". You should run it in a seperate folder (not in downloads), otherwise the files and folders will go all over the place. How to use RetroMCP: Type setup (every time you want change version), copy-paste the version number from their list (they support indev), write "decompile" and done! The code will now be deobfuscated and filenames will be normal, instead of "a", "b" and "c"! Hope I helped you, but I don't expect you to reply, as this discussion is 9 years old! What a piece of history!  
    • I know that this may be a basic question, but I am very new to modding. I am trying to have it so that I can create modified Vanilla loot tables that use a custom enchantment as a condition (i.e. enchantment present = item). However, I am having trouble trying to implement this; the LootItemRandomChanceWithEnchantedBonusCondition constructor needs a Holder<Enchantment> and I am unable to use the getOrThrow() method on the custom enchantment declared in my mod's enchantments class. Here is what I have so far in the GLM:   protected void start(HolderLookup.Provider registries) { HolderLookup.RegistryLookup<Enchantment> registrylookup = registries.lookupOrThrow(Registries.ENCHANTMENT); LootItemRandomChanceWithEnchantedBonusCondition lootItemRandomChanceWithEnchantedBonusCondition = new LootItemRandomChanceWithEnchantedBonusCondition(0.0f, LevelBasedValue.perLevel(0.07f), registrylookup.getOrThrow(*enchantment here*)); this.add("nebu_from_deepslate", new AddItemModifier(new LootItemCondition[]{ LootItemBlockStatePropertyCondition.hasBlockStateProperties(Blocks.DEEPSLATE).build(), LootItemRandomChanceCondition.randomChance(0.25f).build(), lootItemRandomChanceWithEnchantedBonusCondition }, OrichalcumItems.NEBU.get())); }   Inserting Enchantments.[vanilla enchantment here] actually works but trying to declare an enchantment from my custom enchantments class as [mod enchantment class].[custom enchantment] does not work even though they are both a ResourceKey and are registered in Registries.ENCHANTMENT. Basically, how would I go about making it so that a custom enchantment declared as a ResourceKey<Enchantment> of value ResourceKey.create(Registries.ENCHANTMENT, ResourceLocation.fromNamespaceAndPath([modid], [name])), declared in a seperate enchantments class, can be used in the LootItemRandomChanceWithEnchantedBonusCondition constructor as a Holder? I can't use getOrThrow() because there is no level or block entity/entity in the start() method and it is running as datagen. It's driving me nuts.
  • Topics

×
×
  • Create New...

Important Information

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