I'm trying to make a mod, but i keep getting an error when i get killed by an entity...
Error:
[11:08:45] [Server thread/ERROR] [minecraft/MinecraftServer]: Encountered an unexpected exception
net.minecraft.crash.ReportedException: Ticking entity
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:890) ~[?:?] {re:classloading,pl:accesstransformer:B}
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:821) ~[?:?] {re:classloading,pl:accesstransformer:B}
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:120) ~[?:?] {re:classloading,pl:runtimedistcleaner:A}
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:662) [?:?] {re:classloading,pl:accesstransformer:B}
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_261] {}
Caused by: java.lang.NullPointerException
at net.minecraft.entity.ai.controller.LookController.setLookPositionWithEntity(LookController.java:30) ~[?:?] {re:classloading}
at net.minecraft.entity.ai.goal.MeleeAttackGoal.tick(MeleeAttackGoal.java:114) ~[?:?] {re:classloading}
at net.minecraft.entity.ai.goal.PrioritizedGoal.tick(PrioritizedGoal.java:63) ~[?:?] {re:classloading}
at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184) ~[?:1.8.0_261] {}
at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175) ~[?:1.8.0_261] {}
at java.util.Iterator.forEachRemaining(Iterator.java:116) ~[?:1.8.0_261] {}
at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801) ~[?:1.8.0_261] {}
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482) ~[?:1.8.0_261] {}
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472) ~[?:1.8.0_261] {}
at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) ~[?:1.8.0_261] {}
at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) ~[?:1.8.0_261] {}
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:1.8.0_261] {}
at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418) ~[?:1.8.0_261] {}
at net.minecraft.entity.ai.goal.GoalSelector.tick(GoalSelector.java:89) ~[?:?] {re:classloading}
at net.minecraft.entity.MobEntity.updateEntityActionState(MobEntity.java:652) ~[?:?] {re:classloading,pl:accesstransformer:B}
at net.minecraft.entity.LivingEntity.livingTick(LivingEntity.java:2426) ~[?:?] {re:classloading}
at net.minecraft.entity.MobEntity.livingTick(MobEntity.java:512) ~[?:?] {re:classloading,pl:accesstransformer:B}
at net.minecraft.entity.monster.MonsterEntity.livingTick(MonsterEntity.java:41) ~[?:?] {re:classloading}
at net.minecraft.entity.LivingEntity.tick(LivingEntity.java:2264) ~[?:?] {re:classloading}
at net.minecraft.entity.MobEntity.tick(MobEntity.java:311) ~[?:?] {re:classloading,pl:accesstransformer:B}
at net.minecraft.world.server.ServerWorld.updateEntity(ServerWorld.java:615) ~[?:?] {re:classloading}
at net.minecraft.world.World.guardEntityTick(World.java:586) ~[?:?] {re:classloading,pl:accesstransformer:B}
at net.minecraft.world.server.ServerWorld.tick(ServerWorld.java:404) ~[?:?] {re:classloading}
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:886) ~[?:?] {re:classloading,pl:accesstransformer:B}
... 4 more
[11:08:45] [Server thread/ERROR] [minecraft/MinecraftServer]: This crash report has been saved to: C:\Users\lucas_j6k2fnm\TechnoMods\TechnoScpMod\run\.\crash-reports\crash-2020-08-19_11.08.45-server.txt
[11:08:45] [Server thread/INFO] [minecraft/MinecraftServer]: Stopping server
[11:08:45] [Server thread/INFO] [minecraft/MinecraftServer]: Saving players
[11:08:45] [Server thread/INFO] [minecraft/ServerPlayNetHandler]: Dev lost connection: Disconnected
[11:08:45] [Server thread/INFO] [minecraft/MinecraftServer]: Dev left the game
[11:08:45] [Render thread/INFO] [STDOUT/]: [net.minecraft.util.registry.Bootstrap:printToSYSOUT:110]: ---- Minecraft Crash Report ----
// Who set us up the TNT?
Time: 19/08/20 11:08
Description: Ticking entity
java.lang.NullPointerException: Ticking entity
at net.minecraft.entity.ai.controller.LookController.setLookPositionWithEntity(LookController.java:30) ~[?:?] {re:classloading}
at net.minecraft.entity.ai.goal.MeleeAttackGoal.tick(MeleeAttackGoal.java:114) ~[?:?] {re:classloading}
at net.minecraft.entity.ai.goal.PrioritizedGoal.tick(PrioritizedGoal.java:63) ~[?:?] {re:classloading}
at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184) ~[?:1.8.0_261] {}
at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175) ~[?:1.8.0_261] {}
at java.util.Iterator.forEachRemaining(Iterator.java:116) ~[?:1.8.0_261] {}
at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801) ~[?:1.8.0_261] {}
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482) ~[?:1.8.0_261] {}
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472) ~[?:1.8.0_261] {}
at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) ~[?:1.8.0_261] {}
at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) ~[?:1.8.0_261] {}
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:1.8.0_261] {}
at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418) ~[?:1.8.0_261] {}
at net.minecraft.entity.ai.goal.GoalSelector.tick(GoalSelector.java:89) ~[?:?] {re:classloading}
at net.minecraft.entity.MobEntity.updateEntityActionState(MobEntity.java:652) ~[?:?] {re:classloading,pl:accesstransformer:B}
at net.minecraft.entity.LivingEntity.livingTick(LivingEntity.java:2426) ~[?:?] {re:classloading}
at net.minecraft.entity.MobEntity.livingTick(MobEntity.java:512) ~[?:?] {re:classloading,pl:accesstransformer:B}
at net.minecraft.entity.monster.MonsterEntity.livingTick(MonsterEntity.java:41) ~[?:?] {re:classloading}
at net.minecraft.entity.LivingEntity.tick(LivingEntity.java:2264) ~[?:?] {re:classloading}
at net.minecraft.entity.MobEntity.tick(MobEntity.java:311) ~[?:?] {re:classloading,pl:accesstransformer:B}
at net.minecraft.world.server.ServerWorld.updateEntity(ServerWorld.java:615) ~[?:?] {re:classloading}
at net.minecraft.world.World.guardEntityTick(World.java:586) ~[?:?] {re:classloading,pl:accesstransformer:B}
at net.minecraft.world.server.ServerWorld.tick(ServerWorld.java:404) ~[?:?] {re:classloading}
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:886) ~[?:?] {re:classloading,pl:accesstransformer:B}
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:821) ~[?:?] {re:classloading,pl:accesstransformer:B}
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:120) ~[?:?] {re:classloading,pl:runtimedistcleaner:A}
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:662) ~[?:?] {re:classloading,pl:accesstransformer:B}
at java.lang.Thread.run(Thread.java:748) ~[?:1.8.0_261] {}
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- Head --
Thread: Render thread
Stacktrace:
at net.minecraft.entity.ai.controller.LookController.setLookPositionWithEntity(LookController.java:30)
at net.minecraft.entity.ai.goal.MeleeAttackGoal.tick(MeleeAttackGoal.java:114)
at net.minecraft.entity.ai.goal.PrioritizedGoal.tick(PrioritizedGoal.java:63)
at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
at java.util.Iterator.forEachRemaining(Iterator.java:116)
at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
at net.minecraft.entity.ai.goal.GoalSelector.tick(GoalSelector.java:89)
at net.minecraft.entity.MobEntity.updateEntityActionState(MobEntity.java:652)
at net.minecraft.entity.LivingEntity.livingTick(LivingEntity.java:2426)
at net.minecraft.entity.MobEntity.livingTick(MobEntity.java:512)
at net.minecraft.entity.monster.MonsterEntity.livingTick(MonsterEntity.java:41)
at net.minecraft.entity.LivingEntity.tick(LivingEntity.java:2264)
at net.minecraft.entity.MobEntity.tick(MobEntity.java:311)
at net.minecraft.world.server.ServerWorld.updateEntity(ServerWorld.java:615)
-- Entity being ticked --
Details:
Entity Type: technoscp:plague_doctor (com.techno.technoscp.entity.PlagueDoctor)
Entity ID: 1
Entity Name: SCP-049 (The Plague Doctor)
Entity's Exact location: 8.03, 4.00, 7.50
Entity's Block location: World: (8,4,7), Chunk: (at 8,0,7 in 0,0; contains blocks 0,0,0 to 15,255,15), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
Entity's Momentum: 0.06, -0.08, 0.00
Entity's Passengers: []
Entity's Vehicle: ~~ERROR~~ NullPointerException: null
Stacktrace:
at net.minecraft.world.World.guardEntityTick(World.java:586)
at net.minecraft.world.server.ServerWorld.tick(ServerWorld.java:404)
-- Affected level --
Details:
All players: 1 total; [ServerPlayerEntity['Dev'/2, l='New World', x=11.37, y=4.00, z=8.75]]
Chunk stats: ServerChunkCache: 3025
Level dimension: DimensionType{minecraft:overworld}
Level name: New World
Level seed: 1784877185438651786
Level generator: ID 01 - flat, ver 0. Features enabled: true
Level generator options: {biome:"minecraft:the_void",layers:[{block:"minecraft:air",height:1b}],structures:{decoration:{}}}
Level spawn location: World: (0,4,0), Chunk: (at 0,0,0 in 0,0; contains blocks 0,0,0 to 15,255,15), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
Level time: 6682 game time, 6682 day time
Known server brands: forge
Level was modded: true
Level storage version: 0x04ABD - Anvil
Level weather: Rain time: 58478 (now: false), thunder time: 172260 (now: false)
Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true
Stacktrace:
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:886)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:821)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:120)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:662)
at java.lang.Thread.run(Thread.java:748)
-- System Details --
Details:
Minecraft Version: 1.15.2
Minecraft Version ID: 1.15.2
Operating System: Windows 10 (amd64) version 10.0
Java Version: 1.8.0_261, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 216024112 bytes (206 MB) / 947912704 bytes (904 MB) up to 1901592576 bytes (1813 MB)
CPUs: 4
JVM Flags: 1 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump
ModLauncher: 5.1.2+70+master.2845bb9
ModLauncher launch target: fmluserdevclient
ModLauncher naming: mcp
ModLauncher services:
/eventbus-2.2.0-service.jar eventbus PLUGINSERVICE
/forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-launcher.jar object_holder_definalize PLUGINSERVICE
/forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-launcher.jar runtime_enum_extender PLUGINSERVICE
/accesstransformers-2.1.1-shadowed.jar accesstransformer PLUGINSERVICE
/forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-launcher.jar capability_inject_definalize PLUGINSERVICE
/forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-launcher.jar runtimedistcleaner PLUGINSERVICE
/forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-launcher.jar fml TRANSFORMATIONSERVICE
FML: 31.2
Forge: net.minecraftforge:31.2.0
FML Language Providers:
javafml@31.2
minecraft@1
Mod List:
client-extra.jar Minecraft {minecraft@1.15.2 DONE}
main Techno's SCP Mod {technoscp@1.15.2-1.0.0 DONE}
forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar Forge {forge@31.2.0 DONE}
Player Count: 1 / 8; [ServerPlayerEntity['Dev'/2, l='New World', x=11.37, y=4.00, z=8.75]]
Data Packs: vanilla, mod:technoscp, mod:forge (incompatible)
Type: Integrated Server (map_client.txt)
Is Modded: Definitely; Client brand changed to 'forge'
classes of the entities that give me the error:
PlagueDoctor
package com.techno.technoscp.entity;
import com.techno.technoscp.TechnoScp;
import com.techno.technoscp.init.ModEntityTypes;
import com.techno.technoscp.init.SoundTypes;
import net.minecraft.entity.*;
import net.minecraft.entity.ai.goal.*;
import net.minecraft.entity.merchant.villager.VillagerEntity;
import net.minecraft.entity.monster.MonsterEntity;
import net.minecraft.entity.monster.ZombieEntity;
import net.minecraft.entity.monster.ZombieVillagerEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.NBTDynamicOps;
import net.minecraft.util.DamageSource;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.Difficulty;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.common.Mod;
@Mod.EventBusSubscriber(modid = TechnoScp.MOD_ID,bus = Mod.EventBusSubscriber.Bus.FORGE,value = Dist.CLIENT)
public class PlagueDoctor extends MonsterEntity {
public PlagueDoctor(EntityType<? extends MonsterEntity> type, World worldIn) {
super(type, worldIn);
}
public PlagueDoctor createChild(AgeableEntity ageable) {
PlagueDoctor entity = new PlagueDoctor(ModEntityTypes.PLAGUE_DOCTOR.get(), this.world);
entity.onInitialSpawn(this.world, this.world.getDifficultyForLocation(new BlockPos(entity)), SpawnReason.BREEDING, (ILivingEntityData)null, (CompoundNBT)null);
return entity;
}
@Override
protected void registerGoals() {
super.registerGoals();
this.goalSelector.addGoal(0,new SwimGoal(this));
this.goalSelector.addGoal(1,new MeleeAttackGoal(this,1.5D, false));
this.goalSelector.addGoal(2,new NearestAttackableTargetGoal(this, PlayerEntity.class, true));
this.goalSelector.addGoal(3,new NearestAttackableTargetGoal(this, DPersonnel.class, true));
this.goalSelector.addGoal(4,new NearestAttackableTargetGoal(this, VillagerEntity.class, true));
this.goalSelector.addGoal(5,new RandomWalkingGoal(this,1.0D));
this.goalSelector.addGoal(6,new WaterAvoidingRandomWalkingGoal(this, 1.00D));
this.goalSelector.addGoal(7,new LookAtGoal(this, PlayerEntity.class, 7.50f));
}
@Override
protected void registerAttributes() {
super.registerAttributes();
this.getAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(25.0D);
this.getAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.15D);
this.getAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(5.0D);
this.getAttribute(SharedMonsterAttributes.FOLLOW_RANGE).setBaseValue(20.0D);
}
@Override
protected SoundEvent getAmbientSound() {
return SoundTypes.ENTITY_PLAGUE_DOCTOR_LINES.get();
}
@Override
public void onKillEntity(LivingEntity killedEntity) {
super.onKillEntity(killedEntity);
if (killedEntity instanceof DPersonnel) {
DPersonnel victimEntity = (DPersonnel) killedEntity;
Corpse corpseEntity = ModEntityTypes.CORPSE.get().create(this.world);
corpseEntity.copyLocationAndAnglesFrom(victimEntity);
victimEntity.remove();
corpseEntity.onInitialSpawn(this.world, this.world.getDifficultyForLocation(new BlockPos(corpseEntity)), SpawnReason.BREEDING, (ILivingEntityData) null, (CompoundNBT) null);
corpseEntity.setNoAI(victimEntity.isAIDisabled());
if (victimEntity.hasCustomName()) {
corpseEntity.setCustomName(victimEntity.getCustomName());
corpseEntity.setCustomNameVisible(victimEntity.isCustomNameVisible());
}
if (this.isNoDespawnRequired()) {
corpseEntity.enablePersistence();
}
corpseEntity.setInvulnerable(this.isInvulnerable());
this.world.addEntity(corpseEntity);
this.world.playEvent((PlayerEntity) null, 1026, new BlockPos(this), 0);
}
else {
return;
}
}
}
Corpse
package com.techno.technoscp.entity;
import com.techno.technoscp.TechnoScp;
import com.techno.technoscp.init.ModEntityTypes;
import com.techno.technoscp.init.SoundTypes;
import net.minecraft.entity.*;
import net.minecraft.entity.ai.goal.*;
import net.minecraft.entity.merchant.villager.VillagerEntity;
import net.minecraft.entity.monster.MonsterEntity;
import net.minecraft.entity.monster.ZombieEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.SoundEvents;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.common.Mod;
@Mod.EventBusSubscriber(modid = TechnoScp.MOD_ID,bus = Mod.EventBusSubscriber.Bus.FORGE,value = Dist.CLIENT)
public class Corpse extends MonsterEntity {
public Corpse(EntityType<? extends MonsterEntity> type, World worldIn) {
super(type, worldIn);
}
public Corpse createChild(AgeableEntity ageable) {
Corpse entity = new Corpse(ModEntityTypes.CORPSE.get(), this.world);
entity.onInitialSpawn(this.world, this.world.getDifficultyForLocation(new BlockPos(entity)), SpawnReason.BREEDING, (ILivingEntityData)null, (CompoundNBT)null);
return entity;
}
@Override
protected void registerGoals() {
super.registerGoals();
this.goalSelector.addGoal(0,new SwimGoal(this));
this.goalSelector.addGoal(1,new MeleeAttackGoal(this,1.5D, false));
this.goalSelector.addGoal(2,new NearestAttackableTargetGoal(this, PlayerEntity.class, true));
this.goalSelector.addGoal(3,new NearestAttackableTargetGoal(this, DPersonnel.class, true));
this.goalSelector.addGoal(4,new NearestAttackableTargetGoal(this, VillagerEntity.class, true));
this.goalSelector.addGoal(5,new RandomWalkingGoal(this,1.0D));
this.goalSelector.addGoal(6,new WaterAvoidingRandomWalkingGoal(this, 1.00D));
this.goalSelector.addGoal(7,new LookAtGoal(this, PlayerEntity.class, 7.50f));
}
@Override
protected void registerAttributes() {
super.registerAttributes();
this.getAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(25.0D);
this.getAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.15D);
this.getAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(5.0D);
this.getAttribute(SharedMonsterAttributes.FOLLOW_RANGE).setBaseValue(20.0D);
}
@Override
protected SoundEvent getAmbientSound() {
return SoundEvents.ENTITY_ZOMBIE_AMBIENT;
}
}
Can anyone help me?
EDIT: I've noticed a warning on the PlagueDoctor class, specifically on the line that says:
corpseEntity.copyLocationAndAnglesFrom(victimEntity);
i believe that the use of copyLocationAndAnglesFrom(victimEntity) is what's causing the error. In this case, what should i do?