Posted July 29, 20169 yr whenever i spawn the entity it crashes the client, then when i restart it entity is in world where it should be like nothing happened, any idea why its crashing? if(!worldObj.isRemote) { Entity spawn = null; spawn = Ref.altarlisttier1(this.display); spawn.setWorld(worldObj); EntityLiving entityliving = spawn instanceof EntityLiving ? (EntityLiving)spawn : null; spawn.setLocationAndAngles(pos.getX(), pos.getY()+1.25f, pos.getZ(), worldObj.rand.nextFloat() * 360.0F, 0.0F); AnvilChunkLoader.spawnEntity(spawn, worldObj); worldObj.playEvent(2004, pos, 0); if (entityliving != null) { entityliving.spawnExplosionParticle(); } } Description: Ticking entity java.lang.NullPointerException: Ticking entity at net.minecraft.entity.ai.EntityAITasks.onUpdateTasks(EntityAITasks.java:64) at net.minecraft.entity.EntityLiving.updateEntityActionState(EntityLiving.java:846) at net.minecraft.entity.EntityLivingBase.onLivingUpdate(EntityLivingBase.java:2392) at net.minecraft.entity.EntityLiving.onLivingUpdate(EntityLiving.java:643) at net.minecraft.entity.EntityAgeable.onLivingUpdate(EntityAgeable.java:178) at net.minecraft.entity.passive.EntityAnimal.onLivingUpdate(EntityAnimal.java:47) at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:2218) at net.minecraft.entity.EntityLiving.onUpdate(EntityLiving.java:342) at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2106) at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:872) at net.minecraft.world.World.updateEntity(World.java:2073) at net.minecraft.world.World.updateEntities(World.java:1886) at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:644) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:783) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:687) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:156) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:536) at java.lang.Thread.run(Unknown Source) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Client thread Stacktrace: at net.minecraft.entity.ai.EntityAITasks.onUpdateTasks(EntityAITasks.java:64) at net.minecraft.entity.EntityLiving.updateEntityActionState(EntityLiving.java:846) at net.minecraft.entity.EntityLivingBase.onLivingUpdate(EntityLivingBase.java:2392) at net.minecraft.entity.EntityLiving.onLivingUpdate(EntityLiving.java:643) at net.minecraft.entity.EntityAgeable.onLivingUpdate(EntityAgeable.java:178) at net.minecraft.entity.passive.EntityAnimal.onLivingUpdate(EntityAnimal.java:47) at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:2218) at net.minecraft.entity.EntityLiving.onUpdate(EntityLiving.java:342) at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2106) at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:872) at net.minecraft.world.World.updateEntity(World.java:2073) -- Entity being ticked -- Details: Entity Type: rv.voidbeast (com.ravvoid.entity.mob.EntityVoidBeast) Entity ID: 0 Entity Name: Void Beast Entity's Exact location: 237.00, 70.25, 303.00 Entity's Block location: World: (237,70,303), Chunk: (at 13,4,15 in 14,18; contains blocks 224,0,288 to 239,255,303), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511) Entity's Momentum: 0.00, 0.00, 0.00 Entity's Passengers: [] Entity's Vehicle: ~~ERROR~~ NullPointerException: null Stacktrace: at net.minecraft.world.World.updateEntities(World.java:1886) at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:644) -- Affected level -- Details: Level name: New World All players: 1 total; [EntityPlayerMP['Player368'/314, l='New World', x=231.35, y=69.00, z=301.42]] Chunk stats: ServerChunkCache: 639 Drop: 0 Level seed: 9049979599259575510 Level generator: ID 00 - default, ver 1. Features enabled: true Level generator options: Level spawn location: World: (256,64,256), Chunk: (at 0,4,0 in 16,16; contains blocks 256,0,256 to 271,255,271), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511) Level time: 12466 game time, 12466 day time Level dimension: 0 Level storage version: 0x04ABD - Anvil Level weather: Rain time: 87931 (now: false), thunder time: 115727 (now: false) Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true Stacktrace: at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:783) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:687) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:156) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:536) at java.lang.Thread.run(Unknown Source) -- System Details -- Details: Minecraft Version: 1.10.2 Operating System: Windows 10 (amd64) version 10.0 Java Version: 1.8.0_91, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 456852240 bytes (435 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M IntCache: cache: 0, tcache: 0, allocated: 12, tallocated: 94 FML: MCP 9.32 Powered by Forge 12.18.1.2011 4 mods loaded, 4 mods active States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored UCHIJAAAA mcp{9.19} [Minecraft Coder Pack] (minecraft.jar) UCHIJAAAA FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.10.2-12.18.1.2011.jar) UCHIJAAAA Forge{12.18.1.2011} [Minecraft Forge] (forgeSrc-1.10.2-12.18.1.2011.jar) UCHIJAAAA rv{1.10.2} [Ravenous Void] (bin) Loaded coremods (and transformers): GL info: ~~ERROR~~ RuntimeException: No OpenGL context found in the current thread. Profiler Position: N/A (disabled) Player Count: 1 / 8; [EntityPlayerMP['Player368'/314, l='New World', x=231.35, y=69.00, z=301.42]] Type: Integrated Server (map_client.txt) Is Modded: Definitely; Client brand changed to 'fml,forge' https://github.com/Zerahi/RavenousVoid/blob/master/src/main/java/com/ravvoid/tileentity/TileEntityAltar.java
July 29, 20169 yr Include the whole Entity class please. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
July 29, 20169 yr For one you are spawning the entity even if it is null. EntityLiving entityliving = spawn instanceof EntityLiving ? (EntityLiving)spawn : null; spawn.setLocationAndAngles(pos.getX(), pos.getY()+1.25f, pos.getZ(), worldObj.rand.nextFloat() * 360.0F, 0.0F); AnvilChunkLoader.spawnEntity(spawn, worldObj); VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
July 29, 20169 yr Author its not null ever its only triggered if the Ref.altarlisttier1(this.display) != null; and mob spawns fine from a spawn egg no crash package com.ravvoid.entity.mob; import com.google.common.base.Predicate; import com.ravvoid.Ref; import javax.annotation.Nullable; import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityAgeable; import net.minecraft.entity.EntityCreature; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.IEntityLivingData; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAIAttackMelee; import net.minecraft.entity.ai.EntityAIFollowParent; import net.minecraft.entity.ai.EntityAIHurtByTarget; import net.minecraft.entity.ai.EntityAILookIdle; import net.minecraft.entity.ai.EntityAINearestAttackableTarget; import net.minecraft.entity.ai.EntityAIPanic; import net.minecraft.entity.ai.EntityAISwimming; import net.minecraft.entity.ai.EntityAIWander; import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.passive.EntityAnimal; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.datasync.DataParameter; import net.minecraft.network.datasync.DataSerializers; import net.minecraft.network.datasync.EntityDataManager; import net.minecraft.util.DamageSource; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.World; import net.minecraft.world.storage.loot.LootTableList; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class EntityVoidBeast extends EntityAnimal { public EntityVoidBeast(World world) { super(world); this.setSize(0.9F, 1.1F); } /** * Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on * the animal type) */ public boolean isBreedingItem(ItemStack stack) { return false; } protected void initEntityAI() { super.initEntityAI(); this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(1, new EntityAIAttackMelee(this, 1.0D, false)); this.tasks.addTask(2, new EntityAIWander(this, 1.0D)); this.tasks.addTask(3, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); this.tasks.addTask(4, new EntityAILookIdle(this)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true)); } protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(15.0D); this.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).setBaseValue(20.0D); this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.25D); this.getAttributeMap().registerAttribute(SharedMonsterAttributes.ATTACK_DAMAGE); this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(3.0D); } protected SoundEvent getAmbientSound() { return SoundEvents.field_190026_er; } protected SoundEvent getHurtSound() { return SoundEvents.field_190029_eu; } protected SoundEvent getDeathSound() { return SoundEvents.field_190028_et; } protected void playStepSound(BlockPos pos, Block blockIn) { this.playSound(SoundEvents.field_190030_ev, 0.15F, 1.0F); } @Nullable protected ResourceLocation getLootTable() { return Ref.VOIDBEAST; } /** * (abstract) Protected helper method to read subclass entity data from NBT. */ public void readEntityFromNBT(NBTTagCompound compound) { super.readEntityFromNBT(compound); } /** * (abstract) Protected helper method to write subclass entity data to NBT. */ public void writeEntityToNBT(NBTTagCompound compound) { super.writeEntityToNBT(compound); } public boolean attackEntityAsMob(Entity entityIn) { boolean flag = entityIn.attackEntityFrom(DamageSource.causeMobDamage(this), (float)((int)this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).getAttributeValue())); if (flag) { this.applyEnchantments(this, entityIn); } return flag; } @Override public EntityAgeable createChild(EntityAgeable ageable) { // TODO Auto-generated method stub return null; } }
July 29, 20169 yr Is your Void Beast a hostile entity, if so you might be better to extend something that doesn't extend EntityAgeable VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
July 29, 20169 yr New Crash Report please. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
July 29, 20169 yr Entities aren't singletons, you can't just store a single instance and reuse it. You need to create a new instance every time you want to spawn one. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
July 29, 20169 yr Also it seems when you create that single instance, thank you for pointing that out Choonster, you are passing in a null parameter for world. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
July 29, 20169 yr Author yeah i see that now, what would be the best way to refer to an entity so i can spawn one of that type later, EntityRegistry? or just store the entity.class
July 29, 20169 yr All entities need to be registered with the EntityRegistry, but no instead of public static Entity altarlisttier1(ItemStack item) { for (Entry<ItemStack, Entity> entry : altarlisttier1.entrySet()) { if (ItemStack.areItemsEqual(item, (ItemStack)entry.getKey())) { return entry.getValue(); } else { return null; } } return null; } Some thing like public static Entity getEntityFromItemStackInAltar(World world, ItemStack stack) { // Only needs either instanceof or == if (stack != null && (stack.getItem() instanceof ItemClass || stack.getItem() == Items.diamond)) { return new Entity(world); } } VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
July 29, 20169 yr Author makes sense, i had just went of the furnace recipe list, still kinda new to modding, thanks both of you
July 29, 20169 yr Happy modding to you, and I'm glad I could help. write Solved in the topic subject. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
July 29, 20169 yr Author just replaced the ref with a string and made a new object on each check with a switch for string name to new entity output and no crashes
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.