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.

skylord11

Members
  • Joined

  • Last visited

Everything posted by skylord11

  1. Here is my GUI handler: package skylord11.mymod.proxy; import javax.annotation.Nullable; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.common.network.IGuiHandler; import skylord11.mymod.furnace.ContainerFastFurnace; import skylord11.mymod.furnace.GuiFastFurnace; import skylord11.mymod.furnace.TileFastFurnace; public class GuiHandler implements IGuiHandler { @Nullable @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { BlockPos pos = new BlockPos(x, y, z); TileEntity te = world.getTileEntity(pos); if (te instanceof TileFastFurnace) { return new ContainerFastFurnace(player.inventory, (TileFastFurnace) te); } return null; } @Nullable @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { BlockPos pos = new BlockPos(x, y, z); TileEntity te = world.getTileEntity(pos); if (te instanceof TileFastFurnace) { TileFastFurnace containerTileEntity = (TileFastFurnace) te; return new GuiFastFurnace(containerTileEntity, new ContainerFastFurnace(player.inventory, containerTileEntity)); } return null; } }
  2. Hello everyone, I am very new to modding, and I have been following MCJty's modding tutorials and I haven't been able to figure out why it keeps crashing when I try to open my custom gui. Here is the latest crash report: ---- Minecraft Crash Report ---- // You should try our sister game, Minceraft! Time: 2/24/19 5:20 PM Description: Ticking player java.lang.NullPointerException: Ticking player at net.minecraftforge.items.SlotItemHandler.getStack(SlotItemHandler.java:79) at net.minecraft.inventory.Container.detectAndSendChanges(Container.java:97) at net.minecraft.entity.player.EntityPlayerMP.onUpdate(EntityPlayerMP.java:365) at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2171) at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:871) at net.minecraft.world.World.updateEntity(World.java:2130) at net.minecraft.world.WorldServer.tickPlayers(WorldServer.java:672) at net.minecraft.world.World.updateEntities(World.java:1906) at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:643) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:842) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:743) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:192) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:592) at java.lang.Thread.run(Thread.java:748) 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:79) at net.minecraft.inventory.Container.detectAndSendChanges(Container.java:97) at net.minecraft.entity.player.EntityPlayerMP.onUpdate(EntityPlayerMP.java:365) at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2171) at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:871) at net.minecraft.world.World.updateEntity(World.java:2130) -- Player being ticked -- Details: Entity Type: null (net.minecraft.entity.player.EntityPlayerMP) Entity ID: 1169 Entity Name: Player12 Entity's Exact location: -0.38, 64.00, 134.28 Entity's Block location: World: (-1,64,134), Chunk: (at 15,4,6 in -1,8; contains blocks -16,0,128 to -1,255,143), 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.WorldServer.tickPlayers(WorldServer.java:672) at net.minecraft.world.World.updateEntities(World.java:1906) at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:643) -- Affected level -- Details: Level name: Test World 4 All players: 1 total; [EntityPlayerMP['Player12'/1169, l='Test World 4', x=-0.38, y=64.00, z=134.28]] Chunk stats: ServerChunkCache: 625 Drop: 0 Level seed: 7944287069950578853 Level generator: ID 00 - default, ver 1. Features enabled: true Level generator options: Level spawn location: World: (2,64,133), Chunk: (at 2,4,5 in 0,8; contains blocks 0,0,128 to 15,255,143), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511) Level time: 632 game time, 632 day time Level dimension: 0 Level storage version: 0x04ABD - Anvil Level weather: Rain time: 21371 (now: false), thunder time: 91626 (now: false) Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true Stacktrace: at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:842) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:743) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:192) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:592) at java.lang.Thread.run(Thread.java:748) -- System Details -- Details: Minecraft Version: 1.12.2 Operating System: Windows 10 (amd64) version 10.0 Java Version: 1.8.0_191, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 582999192 bytes (555 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 95 FML: MCP 9.42 Powered by Forge 14.23.5.2815 7 mods loaded, 7 mods active States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored | State | ID | Version | Source | Signature | |:------ |:----------- |:------------ |:-------------------------------- |:--------- | | LCHIJA | minecraft | 1.12.2 | minecraft.jar | None | | LCHIJA | mcp | 9.42 | minecraft.jar | None | | LCHIJA | FML | 8.0.99.99 | forgeSrc-1.12.2-14.23.5.2815.jar | None | | LCHIJA | forge | 14.23.5.2815 | forgeSrc-1.12.2-14.23.5.2815.jar | None | | LCHIJA | mymod | 0.0.1 | bin | None | | LCHIJA | jei | 4.14.4.264 | jei_1.12.2-4.14.4.264.jar | None | | LCHIJA | theoneprobe | 1.4.28 | theoneprobe-1.12-1.4.28.jar | None | Loaded coremods (and transformers): GL info: ~~ERROR~~ RuntimeException: No OpenGL context found in the current thread. Here is my Block file: package skylord11.mymod.furnace; 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.item.Item; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import skylord11.mymod.MyMod; public class BlockFastFurnace extends Block implements ITileEntityProvider { public static final PropertyDirection FACING = PropertyDirection.create("facing"); public static final ResourceLocation FAST_FURNACE = new ResourceLocation(MyMod.MODID, "fast_furnace"); public BlockFastFurnace() { super(Material.IRON); // mymod:furnace setRegistryName(FAST_FURNACE); setUnlocalizedName(MyMod.MODID + ".fast_furnace"); setHarvestLevel("pickaxe", 1); setCreativeTab(MyMod.creativeTab); setDefaultState(blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); } @Override public TileEntity createNewTileEntity(World worldIn, int meta) { return new TileFastFurnace(); } @Override public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { // Only execute on the server if (world.isRemote) { return true; } TileEntity te = world.getTileEntity(pos); if (!(te instanceof TileFastFurnace)) { return false; } player.openGui(MyMod.instance, 0, world, pos.getX(), pos.getY(), pos.getZ()); return true; } @SideOnly(Side.CLIENT) public void initModel() { ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(this), 0, new ModelResourceLocation(getRegistryName(), "inventory")); } @Override public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { return this.getDefaultState().withProperty(FACING, EnumFacing.getDirectionFromEntityLiving(pos, placer)); } @Override protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, FACING); } @Override public IBlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(FACING, EnumFacing.getFront(meta & 7)); } @Override public int getMetaFromState(IBlockState state) { return state.getValue(FACING).getIndex(); } } Here is my Container file: package skylord11.mymod.furnace; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.SlotItemHandler; public class ContainerFastFurnace extends Container { private TileFastFurnace te; public ContainerFastFurnace(IInventory playerInventory, TileFastFurnace te) { this.te = te; addOwnSlots(); addPlayerSlots(playerInventory); } private void addPlayerSlots(IInventory playerInventory) { //Slots for the main inventory for (int row = 0; row < 3; ++row) { for (int col = 0; col <3; ++col) { int x = 9 + col * 18; int y = row * 18 + 70; this.addSlotToContainer(new Slot(playerInventory, col + row * 9 + 18, x, y)); } } //Slots for the hotbar for (int row = 0; row < 9; ++row) { int x = 9 + row * 18; int y = 58 + 70; this.addSlotToContainer(new Slot(playerInventory, row, x, y)); } } private void addOwnSlots() { IItemHandler itemHandler = this.te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null); int x = 10; int y = 26; int slotIndex = 0; addSlotToContainer(new SlotItemHandler(itemHandler, slotIndex++, x, y)); x += 18; addSlotToContainer(new SlotItemHandler(itemHandler, slotIndex++, x, y)); x += 18; addSlotToContainer(new SlotItemHandler(itemHandler, slotIndex++, x, y)); x = 118; addSlotToContainer(new SlotItemHandler(itemHandler, slotIndex++, x, y)); x += 18; addSlotToContainer(new SlotItemHandler(itemHandler, slotIndex++, x, y)); x += 18; addSlotToContainer(new SlotItemHandler(itemHandler, slotIndex++, x, y)); // Add our own slots } @Override public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) { ItemStack itemstack = ItemStack.EMPTY; Slot slot = this.inventorySlots.get(index); if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); if (index < TileFastFurnace.SIZE) { if (!this.mergeItemStack(itemstack1, TileFastFurnace.SIZE, this.inventorySlots.size(), true)) { return ItemStack.EMPTY; } } else if (!this.mergeItemStack(itemstack1, 0, TileFastFurnace.SIZE, false)) { return ItemStack.EMPTY; } if (itemstack1.isEmpty()) { slot.putStack(ItemStack.EMPTY); } else { slot.onSlotChanged(); } } return itemstack; } @Override public boolean canInteractWith(EntityPlayer playerIn) { return te.canInteractWith(playerIn); } } Here is my GUI file: package skylord11.mymod.furnace; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.util.ResourceLocation; import skylord11.mymod.MyMod; public class GuiFastFurnace extends GuiContainer { public static final int WIDTH = 180; public static final int HEIGHT = 152; private static final ResourceLocation background = new ResourceLocation(MyMod.MODID, "gui/fast_furnace.png"); public GuiFastFurnace(TileFastFurnace tileEntity, ContainerFastFurnace container) { super(container); xSize = WIDTH; ySize = HEIGHT; } @Override protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { mc.getTextureManager().bindTexture(background); drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); } } And here is my Tile file: package skylord11.mymod.furnace; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.ItemStackHandler; public class TileFastFurnace extends TileEntity { public static final int SIZE = 3 + 3; private ItemStackHandler itemStackHandler = new ItemStackHandler(SIZE) { protected void onContentsChanged(int slot) { TileFastFurnace.this.markDirty(); } }; @Override public void readFromNBT(NBTTagCompound compound) { super.readFromNBT(compound); if (compound.hasKey("items")) { itemStackHandler.deserializeNBT((NBTTagCompound) compound.getTag("items")); } } @Override public NBTTagCompound writeToNBT(NBTTagCompound compound) { super.writeToNBT(compound); compound.setTag("items", itemStackHandler.serializeNBT()); return compound; } public boolean canInteractWith(EntityPlayer playerIn) { // If we are too far away from this tile entity you cannot use it return !isInvalid() && playerIn.getDistanceSq(pos.add(0.5D, 0.5D, 0.5D)) <= 64D; } @Override public boolean hasCapability(Capability<?> capability, EnumFacing facing) { if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { return true; } return super.hasCapability(capability, facing); } @Override public <T> T getCapability(Capability<T> capability, EnumFacing facing) { if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.cast(itemStackHandler)) { return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.cast(itemStackHandler); } return super.getCapability(capability, facing); } } Help would be appreciated!

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.