I'm trying to make a block that has a gui but every time I activate it, my game just crashes.
Code:
package com.jun2040.unixmod.blocks;
import com.jun2040.unixmod.UnixMod;
import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
public class BioreactorScreen extends ContainerScreen<BioreactorContainer> {
private ResourceLocation GUI = new ResourceLocation(UnixMod.MODID, "textures/gui/bioreactor.png");
public BioreactorScreen(BioreactorContainer container, PlayerInventory inv, ITextComponent name) {
super(container, inv, name);
}
@Override
public void render(int mouseX, int mouseY, float partialTicks) {
this.renderBackground();
super.render(mouseX, mouseY, partialTicks);
this.renderHoveredToolTip(mouseX, mouseY);
}
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
}
@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.minecraft.getTextureManager().bindTexture(GUI);
int relX = (this.width - this.xSize) / 2;
int relY = (this.height - this.ySize) / 2;
this.blit(relX, relY, 0, 0, this.xSize, this.ySize);
}
}
Error:
---- Minecraft Crash Report ----
// I bet Cylons wouldn't have this problem.
Time: 12/12/19 11:18 PM
Description: Ticking entity
java.lang.NullPointerException: Ticking entity
at com.jun2040.unixmod.blocks.BioreactorContainer.canInteractWith(BioreactorContainer.java:38) ~[?:?] {re:classloading}
at net.minecraft.entity.player.ServerPlayerEntity.tick(ServerPlayerEntity.java:338) ~[?:?] {re:classloading,pl:accesstransformer:B}
at net.minecraft.world.server.ServerWorld.updateEntity(ServerWorld.java:602) ~[?:?] {re:classloading}
at net.minecraft.world.World.func_217390_a(World.java:736) ~[?:?] {re:classloading,pl:accesstransformer:B}
at net.minecraft.world.server.ServerWorld.tick(ServerWorld.java:397) ~[?:?] {re:classloading}
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:865) ~[?:?] {re:classloading,pl:accesstransformer:B}
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:800) ~[?:?] {re:classloading,pl:accesstransformer:B}
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) ~[?:?] {re:classloading,pl:runtimedistcleaner:A}
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:646) [?:?] {re:classloading,pl:accesstransformer:B}
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_202] {}
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- Head --
Thread: Server thread
Stacktrace:
at com.jun2040.unixmod.blocks.BioreactorContainer.canInteractWith(BioreactorContainer.java:38)
at net.minecraft.entity.player.ServerPlayerEntity.tick(ServerPlayerEntity.java:338)
at net.minecraft.world.server.ServerWorld.updateEntity(ServerWorld.java:602)
-- Entity being ticked --
Details:
Entity Type: minecraft:player (net.minecraft.entity.player.ServerPlayerEntity)
Entity ID: 126
Entity Name: Dev
Entity's Exact location: -149.92, 22.00, -45.12
Entity's Block location: World: (-150,22,-46), Chunk: (at 10,1,2 in -10,-3; contains blocks -160,0,-48 to -145,255,-33), Region: (-1,-1; contains chunks -32,-32 to -1,-1, blocks -512,0,-512 to -1,255,-1)
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:736)
at net.minecraft.world.server.ServerWorld.tick(ServerWorld.java:397)
-- Affected level --
Details:
All players: 1 total; [ServerPlayerEntity['Dev'/126, l='mod test', x=-149.92, y=22.00, z=-45.12]]
Chunk stats: ServerChunkCache: 2246
Level dimension: DimensionType{minecraft:overworld}
Level name: mod test
Level seed: -2385347844768643725
Level generator: ID 01 - flat, ver 0. Features enabled: true
Level generator options: {biome:"minecraft:plains",layers:[{block:"minecraft:bedrock",height:1b},{block:"minecraft:dirt",height:20b},{block:"minecraft:grass_block",height:1b}],structures:{village:{}}}
Level spawn location: World: (-176,22,-112), Chunk: (at 0,1,0 in -11,-7; contains blocks -176,0,-112 to -161,255,-97), Region: (-1,-1; contains chunks -32,-32 to -1,-1, blocks -512,0,-512 to -1,255,-1)
Level time: 54794 game time, 3461 day time
Level storage version: 0x04ABD - Anvil
Level weather: Rain time: 36009 (now: false), thunder time: 52923 (now: false)
Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true
Stacktrace:
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:865)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:800)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:646)
at java.lang.Thread.run(Thread.java:748)
-- System Details --
Details:
Minecraft Version: 1.14.4
Minecraft Version ID: 1.14.4
Operating System: Windows 10 (amd64) version 10.0
Java Version: 1.8.0_202, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 535933160 bytes (511 MB) / 2076704768 bytes (1980 MB) up to 3771203584 bytes (3596 MB)
CPUs: 12
JVM Flags: 1 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump
ModLauncher: 4.1.0+62+5bfa59b
ModLauncher launch target: fmluserdevclient
ModLauncher naming: mcp
ModLauncher services:
/eventbus-1.0.0-service.jar eventbus PLUGINSERVICE
/forge-1.14.4-28.1.87_mapped_snapshot_20191111-1.14.3-launcher.jar object_holder_definalize PLUGINSERVICE
/forge-1.14.4-28.1.87_mapped_snapshot_20191111-1.14.3-launcher.jar runtime_enum_extender PLUGINSERVICE
/accesstransformers-1.0.1-milestone.0.1+94458e7-shadowed.jar accesstransformer PLUGINSERVICE
/forge-1.14.4-28.1.87_mapped_snapshot_20191111-1.14.3-launcher.jar capability_inject_definalize PLUGINSERVICE
/forge-1.14.4-28.1.87_mapped_snapshot_20191111-1.14.3-launcher.jar runtimedistcleaner PLUGINSERVICE
/forge-1.14.4-28.1.87_mapped_snapshot_20191111-1.14.3-launcher.jar fml TRANSFORMATIONSERVICE
FML: 28.1
Forge: net.minecraftforge:28.1.87
FML Language Providers:
[email protected]
minecraft@1
Mod List:
client-extra.jar Minecraft {
[email protected] DONE}
main UnixMod {
[email protected] DONE}
forge-1.14.4-28.1.87_mapped_snapshot_20191111-1.14.3-recomp.jar Forge {
[email protected] DONE}
Player Count: 1 / 8; [ServerPlayerEntity['Dev'/126, l='mod test', x=-149.92, y=22.00, z=-45.12]]
Data Packs: vanilla, mod:unixmod, mod:forge
Type: Integrated Server (map_client.txt)
Is Modded: Definitely; Client brand changed to 'forge'