Jump to content

When item is in inventory minecraft crashes


Soulas97

Recommended Posts

i wan't to make that when, rune of vision, is in players inventory it gives nightvision and speed , pernament until you move it away from your inventory but when you remove it from main 9slots to other inventory slots minecraft crashes

 

 

RuneOfVision.class

 

package com.hogans.craft.relics;

 

import com.hogans.craft.HogansCraft;

 

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

import net.minecraft.client.renderer.texture.IIconRegister;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.entity.Entity;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraft.potion.Potion;

import net.minecraft.potion.PotionEffect;

import net.minecraft.world.World;

 

public class RuneOfVision extends Item {

 

public RuneOfVision() {

this.setCreativeTab(HogansCraft.HogansOresTab);

}

 

@SideOnly(Side.CLIENT)

public void registerIcons(IIconRegister iconRegister) {

this.itemIcon = iconRegister.registerIcon(HogansCraft.MODID + ":" + this.getUnlocalizedName().substring(5));

}

public void onUpdate(ItemStack itemstack, World world, Entity entity, int i, boolean flag)

{

EntityPlayer Player;

if(entity instanceof EntityPlayer)

{

Player = (EntityPlayer) entity;

 

if(Player.getCurrentEquippedItem().equals(this))

{

if(Player.isInWater())

{

Player.addPotionEffect((new PotionEffect(Potion.nightVision.getId(), 0, 1)));

Player.addPotionEffect((new PotionEffect(Potion.moveSpeed.getId(), 0, 5)));

}

}

else

{

Player.curePotionEffects(itemstack);

}

}

}

}

 

Proud mod developer of:

 

Mob Armor mod

Block monster mod

Clay Living Dolls mod

Much More Spiders mod

Elemental cows reborn

Mr gorilla mod

Link to comment
Share on other sites

---- Minecraft Crash Report ----

// Don't be sad, have a hug! <3

 

Time: 14.6.18 09.39

Description: Ticking entity

 

java.lang.NullPointerException: Ticking entity

at com.hogans.craft.relics.RuneOfVision.onUpdate(RuneOfVision.java:34)

at net.minecraft.item.ItemStack.updateAnimation(ItemStack.java:378)

at net.minecraft.entity.player.InventoryPlayer.decrementAnimations(InventoryPlayer.java:311)

at net.minecraft.entity.player.EntityPlayer.onLivingUpdate(EntityPlayer.java:539)

at net.minecraft.client.entity.EntityPlayerSP.onLivingUpdate(EntityPlayerSP.java:287)

at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:1603)

at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:289)

at net.minecraft.client.entity.EntityClientPlayerMP.onUpdate(SourceFile:63)

at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2019)

at net.minecraft.world.World.updateEntity(World.java:1983)

at net.minecraft.world.World.updateEntities(World.java:1836)

at net.minecraft.client.Minecraft.runTick(Minecraft.java:1956)

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:916)

at net.minecraft.client.Minecraft.run(Minecraft.java:835)

at net.minecraft.client.main.Main.main(SourceFile:103)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:134)

at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

 

 

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

---------------------------------------------------------------------------------------

 

-- Head --

Stacktrace:

at com.hogans.craft.relics.RuneOfVision.onUpdate(RuneOfVision.java:34)

at net.minecraft.item.ItemStack.updateAnimation(ItemStack.java:378)

at net.minecraft.entity.player.InventoryPlayer.decrementAnimations(InventoryPlayer.java:311)

at net.minecraft.entity.player.EntityPlayer.onLivingUpdate(EntityPlayer.java:539)

at net.minecraft.client.entity.EntityPlayerSP.onLivingUpdate(EntityPlayerSP.java:287)

at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:1603)

at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:289)

at net.minecraft.client.entity.EntityClientPlayerMP.onUpdate(SourceFile:63)

at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2019)

at net.minecraft.world.World.updateEntity(World.java:1983)

 

-- Entity being ticked --

Details:

Entity Type: null (net.minecraft.client.entity.EntityClientPlayerMP)

Entity ID: 64

Entity Name: Player57

Entity's Exact location: -1,43, 81,76, 1021,40

Entity's Block location: World: (-2,81,1021), Chunk: (at 14,5,13 in -1,63; contains blocks -16,0,1008 to -1,255,1023), Region: (-1,1; contains chunks -32,32 to -1,63, blocks -512,0,512 to -1,255,1023)

Entity's Momentum: 0,00, 0,00, 0,00

Stacktrace:

at net.minecraft.world.World.updateEntities(World.java:1836)

 

-- Affected level --

Details:

Level name: MpServer

All players: 1 total; [EntityClientPlayerMP['Player57'/64, l='MpServer', x=-1,43, y=81,76, z=1021,40]]

Chunk stats: MultiplayerChunkCache: 285, 285

Level seed: 0

Level generator: ID 00 - default, ver 1. Features enabled: false

Level generator options:

Level spawn location: World: (-9,64,998), Chunk: (at 7,4,6 in -1,62; contains blocks -16,0,992 to -1,255,1007), Region: (-1,1; contains chunks -32,32 to -1,63, blocks -512,0,512 to -1,255,1023)

Level time: 1198 game time, 1198 day time

Level dimension: 0

Level storage version: 0x00000 - Unknown?

Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)

Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false

Forced entities: 24 total; [EntitySquid['Squid'/136, l='MpServer', x=39,88, y=60,69, z=976,59], EntitySquid['Squid'/129, l='MpServer', x=34,19, y=56,73, z=978,16], EntitySquid['Squid'/133, l='MpServer', x=28,81, y=61,34, z=969,97], EntitySquid['Squid'/132, l='MpServer', x=36,81, y=55,69, z=981,22], EntitySquid['Squid'/135, l='MpServer', x=30,44, y=59,34, z=973,53], EntitySquid['Squid'/134, l='MpServer', x=34,44, y=60,38, z=975,13], EntityBat['Bat'/8871, l='MpServer', x=-60,25, y=28,23, z=1033,75], EntityBat['Bat'/8870, l='MpServer', x=-61,13, y=27,00, z=1031,59], EntitySquid['Squid'/237, l='MpServer', x=-65,72, y=53,80, z=1030,13], EntitySquid['Squid'/283, l='MpServer', x=-61,34, y=55,36, z=1010,25], EntitySquid['Squid'/281, l='MpServer', x=-61,41, y=53,78, z=1010,22], EntitySquid['Squid'/287, l='MpServer', x=-59,88, y=53,26, z=1019,03], EntitySquid['Squid'/286, l='MpServer', x=-61,59, y=54,14, z=1004,56], EntitySquid['Squid'/285, l='MpServer', x=-64,84, y=55,38, z=1012,91], EntityBat['Bat'/10028, l='MpServer', x=18,53, y=12,00, z=998,78], EntityBat['Bat'/10025, l='MpServer', x=9,63, y=14,29, z=995,56], EntityBat['Bat'/10008, l='MpServer', x=-45,25, y=32,51, z=942,22], EntitySquid['Squid'/351, l='MpServer', x=56,75, y=53,34, z=1001,44], EntitySquid['Squid'/350, l='MpServer', x=58,50, y=53,72, z=1000,88], EntitySquid['Squid'/352, l='MpServer', x=61,50, y=52,02, z=1001,28], EntitySquid['Squid'/398, l='MpServer', x=62,78, y=57,89, z=1003,78], EntityBat['Bat'/439, l='MpServer', x=65,75, y=32,10, z=971,63], EntityClientPlayerMP['Player57'/64, l='MpServer', x=-1,43, y=81,76, z=1021,40], EntityBat['Bat'/463, l='MpServer', x=-63,34, y=28,39, z=1034,09]]

Retry entities: 0 total; []

Server brand: fml,forge

Server type: Integrated singleplayer server

Stacktrace:

at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:368)

at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2382)

at net.minecraft.client.Minecraft.run(Minecraft.java:857)

at net.minecraft.client.main.Main.main(SourceFile:103)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:134)

at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

 

-- System Details --

Details:

Minecraft Version: 1.7.2

Operating System: Windows 7 (amd64) version 6.1

Java Version: 1.7.0_60, Oracle Corporation

Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

Memory: 870502704 bytes (830 MB) / 1056309248 bytes (1007 MB) up to 1056309248 bytes (1007 MB)

JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M

AABB Pool Size: 11194 (626864 bytes; 0 MB) allocated, 5 (280 bytes; 0 MB) used

IntCache: cache: 0, tcache: 0, allocated: 12, tallocated: 94

FML: MCP v9.03 FML v7.2.205.1101 Minecraft Forge 10.12.1.1101 4 mods loaded, 4 mods active

mcp{9.03} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

FML{7.2.205.1101} [Forge Mod Loader] (forgeBin-1.7.2-10.12.1.1101.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

Forge{10.12.1.1101} [Minecraft Forge] (forgeBin-1.7.2-10.12.1.1101.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

HogansCraft{Alpha 1.0} [HogansCraft] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

Launched Version: 1.6

LWJGL: 2.9.0

OpenGL: GeForce 8600 GT/PCI/SSE2 GL version 3.0.0, NVIDIA Corporation

Is Modded: Definitely; Client brand changed to 'fml,forge'

Type: Client (map_client.txt)

Resource Packs: []

Current Language: Canadian English (CA)

Profiler Position: N/A (disabled)

Vec3 Pool Size: 27231 (1524936 bytes; 1 MB) allocated, 19 (1064 bytes; 0 MB) used

Anisotropic Filtering: Off (1)

 

 

 

idk how to set time, im new at this stuff :D

Proud mod developer of:

 

Mob Armor mod

Block monster mod

Clay Living Dolls mod

Much More Spiders mod

Elemental cows reborn

Mr gorilla mod

Link to comment
Share on other sites

Please, if you are posting code, put it inside code tags [ code ] and [/ code ]      (NOTE: do not use spaces)

example:

public void doNothing()
{
    // What? You were expecting something?
}

 

Also, please use the spoiler [ spoiler ] and [/ spoiler ] (NOTE: also with no spaces) for your crash reports.

 

It just makes things A LOT easier to read.

We all stuff up sometimes... But I seem to be at the bottom of that pot.

Link to comment
Share on other sites

I got in the habit early on to do a lot of null checks espeically when initially testing something knew.  Helps a lot with figuring issues like this out.

 

EntityPlayer Player = xxxxx

 

If (player != null) {

 

} else {

 

  print out a message.

 

}

 

Item item = xxxx

 

if (item != null) {

Long time Bukkit & Forge Programmer

Happy to try and help

Link to comment
Share on other sites

idk how to setup it to be right? :o

 

public void onUpdate(ItemStack itemstack, World world, Entity entity, int i)

 

{

EntityPlayer Player;

if(entity instanceof EntityPlayer)

{

Player = (EntityPlayer) entity;

 

if(Player.getCurrentEquippedItem().equals(null))

{

if(Player.isSneaking());

{

Player.addPotionEffect((new PotionEffect(Potion.nightVision.getId(), 0, 1)));

Player.addPotionEffect((new PotionEffect(Potion.moveSpeed.getId(), 0, 5)));

}

}

else

{

Player.curePotionEffects(itemstack);

}

}

}}

 

Proud mod developer of:

 

Mob Armor mod

Block monster mod

Clay Living Dolls mod

Much More Spiders mod

Elemental cows reborn

Mr gorilla mod

Link to comment
Share on other sites

like this?

 

 

public void onUpdate(ItemStack itemstack, World world, Entity entity, int i)

 

{

EntityPlayer Player;

if(entity instanceof EntityPlayer)

{

Player = (EntityPlayer) entity;

 

 

Player.addPotionEffect((new PotionEffect(Potion.nightVision.getId(), 0, 1)));

Player.addPotionEffect((new PotionEffect(Potion.moveSpeed.getId(), 0, 5)));

}

 

}}

 

 

Proud mod developer of:

 

Mob Armor mod

Block monster mod

Clay Living Dolls mod

Much More Spiders mod

Elemental cows reborn

Mr gorilla mod

Link to comment
Share on other sites

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

    • Hello! My friends and I were attempting to add a few extra mods to the Create Chronicles modpack, and all was well until people started crashing when they opened their inventories. Any help finding the culprit would be MUCH appreciated, I've been scratching my head for the past few days on what went wrong. https://paste.ee/p/8pajP
    • >>>KLIK LOGIN DISINI SAYANG<<< >>>KLIK DAFTAR DISINI SAYANG<<< Pendahuluan Dalam dunia perjudian online, slot menjadi salah satu permainan yang paling diminati. Dengan munculnya berbagai platform, Togel2Win hadir sebagai salah satu pilihan menarik, terutama dengan fitur anti rungkad yang dijanjikan. Artikel ini akan membahas tentang Togel2Win, keunggulan slot terbaru, dan bagaimana server Thailand berperan dalam meningkatkan pengalaman bermain. Apa Itu Togel2Win? Togel2Win adalah platform permainan yang menawarkan berbagai jenis permainan, termasuk slot dan togel. Dengan antarmuka yang ramah pengguna dan beragam pilihan permainan, situs ini bertujuan untuk memberikan pengalaman bermain yang menyenangkan dan menguntungkan bagi para pemain. Keunggulan Slot Togel2Win Fitur Anti Rungkad: Salah satu keunggulan utama dari Togel2Win adalah fitur anti rungkad yang dirancang untuk mengurangi kemungkinan gangguan saat bermain. Ini memastikan bahwa pemain dapat menikmati permainan tanpa gangguan teknis, meningkatkan kenyamanan dan fokus. Beragam Pilihan Slot: Togel2Win menawarkan berbagai jenis slot, dari yang klasik hingga yang modern dengan grafis menawan dan tema yang menarik. Ini memberikan variasi yang cukup bagi pemain untuk menemukan permainan yang sesuai dengan preferensi mereka. Server Thailand yang Stabil: Server yang berlokasi di Thailand memberikan koneksi yang cepat dan stabil. Ini sangat penting untuk pengalaman bermain yang lancar, terutama saat bermain slot yang memerlukan respons cepat. Bonus dan Promosi Menarik: Togel2Win sering menawarkan bonus dan promosi yang menarik untuk menarik pemain baru dan mempertahankan loyalitas pemain yang sudah ada. Ini bisa berupa bonus deposit, putaran gratis, atau program loyalitas. Tips untuk Pemain Slot di Togel2Win Pilih Slot dengan RTP Tinggi: Sebelum memulai permainan, pastikan untuk memilih slot dengan tingkat pengembalian pemain (RTP) yang tinggi untuk meningkatkan peluang menang. Kelola Anggaran: Tentukan batasan anggaran sebelum bermain dan patuhi itu. Ini membantu mencegah kerugian besar dan menjaga pengalaman bermain tetap menyenangkan. Manfaatkan Bonus: Jangan ragu untuk memanfaatkan bonus dan promosi yang ditawarkan. Ini bisa memberikan tambahan modal untuk bermain lebih lama. Kesimpulan Togel2Win merupakan pilihan menarik bagi para penggemar slot, terutama dengan fitur anti rungkad dan server yang stabil. Dengan berbagai pilihan permainan dan bonus yang menggiurkan, Togel2Win siap memberikan pengalaman bermain yang tak terlupakan. Jika Anda mencari platform slot yang andal dan menyenangkan, Togel2Win bisa menjadi solusi yang tepat.
    • I'm trying to make my own modpack, but sometimes, in certain areas of the world, the game just says "server closed". Minecraft doesn't close, it just returns to the menu. When I tried to figure it out on my own and understand the logs, I didn't understand anything (English is not my native language, so it's difficult for me). I've been trying to solve the problem for the third month. So I ask if anyone is good at this and it's not difficult for you, to help me with this. If you need details, ask. I'll describe everything. What it looks like Logs
  • Topics

×
×
  • Create New...

Important Information

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