Posted January 11, 20187 yr I am making an entity and it is almost an identical copy of a zombie that spawns in the nether (hell) and I am getting cascading World gen error when exploring in creative in the nether, even though I am adding over 10 entities in the overworld without any troubles. I tried un-registering the entity and the problem went away. I am not adding any extra mob gen and I do not even know how to add biomes or dimensions so I do not even know why this happens. My zombie class: public class EntityDoctorZombie extends EntityAnimatedZombie { private static final DataParameter<Byte> ACTIVE = EntityDataManager.<Byte>createKey(EntityDoctorZombie.class, DataSerializers.BYTE); static { EntityDoctorZombie.animHandler.addAnim(Reference.MOD_ID, "skeleton_walk", "zombie", true); EntityDoctorZombie.animHandler.addAnim(Reference.MOD_ID, "skeleton_walk_hands", "zombie", true); EntityDoctorZombie.animHandler.addAnim(Reference.MOD_ID, "doctor_throw", "zombie", false); EntityDoctorZombie.animHandler.addAnim(Reference.MOD_ID, "doctor_heal", "zombie", false); EntityDoctorZombie.animHandler.addAnim(Reference.MOD_ID, "lookat", new AnimationLookAt("Head")); EntityDoctorZombie.animHandler.addAnim(Reference.MOD_ID, "riding", new AnimationRiding()); } public EntityDoctorZombie(World worldIn) { super(worldIn); this.setSize(0.7F, 2F); } @Override protected void initEntityAI() { this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(1, new EntityAIDoctorHeal(this, 1.0D)); this.tasks.addTask(2, new EntityAIAvoidEntity(this, EntityPlayer.class, 3, 1D, 1.4D)); this.tasks.addTask(3, new EntityAIMoveTowardsRestriction(this, 1.0D)); this.tasks.addTask(4, new EntityAIMoveThroughVillage(this, 1.0D, false)); this.tasks.addTask(5, new EntityAIWanderAvoidWater(this, 1.0D)); this.tasks.addTask(6, new EntityAILookIdle(this)); this.targetTasks.addTask(1, new EntityAIDoctorTarget(this, false, EntityZombie.class, EntityZombieVillager.class, EntityKnightZombie.class, EntityWorkerZombie.class, EntityGoroZombie.class)); } @Override protected void entityInit() { super.entityInit(); this.dataManager.register(ACTIVE, Byte.valueOf((byte) 0)); } @Override protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).setBaseValue(40.0D); this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(20.0D); this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.26D); } public boolean isThrowing() { return this.dataManager.get(ACTIVE).byteValue() == 1; } public boolean isHealing() { return this.dataManager.get(ACTIVE).byteValue() == 2; } public void setActive(byte b) { if (this.dataManager.get(ACTIVE).byteValue() != b) { this.dataManager.set(ACTIVE, Byte.valueOf(b)); this.dataManager.setDirty(ACTIVE); } } @Override public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata) { super.onInitialSpawn(difficulty, livingdata); if (this.isChild()) { this.setChild(false); } if (this.isLeftHanded()) { this.setLeftHanded(false); } this.setItemStackToSlot(EntityEquipmentSlot.OFFHAND, new ItemStack(ModItems.health)); ItemStack potion = new ItemStack(Items.SPLASH_POTION, 1, 0); NBTTagCompound nbt = new NBTTagCompound(); nbt.setString("Potion", "minecraft:water"); potion.setTagCompound(nbt); this.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, potion); this.setEnchantmentBasedOnDifficulty(difficulty); return livingdata; } @Override public void onLivingUpdate() { super.onLivingUpdate(); if (!this.isWorldRemote()) { this.setMoving(Boolean.valueOf(this.isMoving(this))); } if (this.isWorldRemote()) { if (this.getAnimationHandler().isAnimationActive(Reference.MOD_ID, "skeleton_walk", this) && !this.getMoving()) { this.getAnimationHandler().stopAnimation(Reference.MOD_ID, "skeleton_walk", this); if (!this.isThrowing() && !this.isHealing()) { this.getAnimationHandler().stopAnimation(Reference.MOD_ID, "skeleton_walk_hands", this); } } if (this.isThrowing() && !this.getAnimationHandler().isAnimationActive(Reference.MOD_ID, "doctor_throw", this) && this.deathTime < 1) { this.getAnimationHandler().stopAnimation(Reference.MOD_ID, "skeleton_walk_hands", this); this.getAnimationHandler().startAnimation(Reference.MOD_ID, "doctor_throw", 0, this); } if (this.isHealing() && !this.getAnimationHandler().isAnimationActive(Reference.MOD_ID, "doctor_heal", this) && this.deathTime < 1) { this.getAnimationHandler().stopAnimation(Reference.MOD_ID, "skeleton_walk_hands", this); this.getAnimationHandler().startAnimation(Reference.MOD_ID, "doctor_heal", 0, this); } if (!this.getAnimationHandler().isAnimationActive(Reference.MOD_ID, "skeleton_walk", this) && this.getMoving() && this.deathTime < 1 && !this.isRiding()) { this.getAnimationHandler().startAnimation(Reference.MOD_ID, "skeleton_walk", 0, this); } if (!this.getAnimationHandler().isAnimationActive(Reference.MOD_ID, "skeleton_walk_hands", this) && !this.isThrowing() && !this.isHealing() && this.getAnimationHandler().isAnimationActive(Reference.MOD_ID, "skeleton_walk", this)) { this.getAnimationHandler().stopAnimation(Reference.MOD_ID, "doctor_throw", this); this.getAnimationHandler().stopAnimation(Reference.MOD_ID, "doctor_heal", this); this.getAnimationHandler().startAnimation(Reference.MOD_ID, "skeleton_walk_hands", 0, this); } if (!this.getAnimationHandler().isAnimationActive(Reference.MOD_ID, "lookat", this) && this.deathTime < 1) { this.getAnimationHandler().startAnimation(Reference.MOD_ID, "lookat", this); } if (!this.getAnimationHandler().isAnimationActive(Reference.MOD_ID, "riding", this) && this.isRiding()) { this.getAnimationHandler().stopAnimation(Reference.MOD_ID, "skeleton_walk", this); this.getAnimationHandler().startAnimation(Reference.MOD_ID, "riding", this); } } } } My Events class (that I stopped for testing and I still got the message): //@Mod.EventBusSubscriber public class CommonEvent { @SubscribeEvent public static void onLivingDeath(LivingDeathEvent e) { EntityLivingBase entity = e.getEntityLiving(); if (entity.getEntityData().getBoolean("is")) { if (entity.getRNG().nextInt(2) == 0) { e.setCanceled(true); entity.setHealth(entity.getMaxHealth()); entity.playSound(SoundEvents.ITEM_TOTEM_USE, 1f, 1f); } entity.getEntityData().setBoolean("is", false); } if (MobsConfig.zombies.magma.alwaysLava && e.getSource().getTrueSource() instanceof EntityPlayerMP) { EntityPlayerMP player = (EntityPlayerMP) e.getSource().getTrueSource(); if (player.getHeldItemMainhand().getItem() == ModItems.fireSword) { player.getHeldItemMainhand().damageItem(25, player); if (player.world.isAirBlock(entity.getPosition()) && entity.world.isSideSolid(entity.getPosition().add(0, -1, 0), EnumFacing.UP)) { player.world.setBlockState(entity.getPosition(), Blocks.FLOWING_LAVA.getDefaultState(), 3); } } } } @SubscribeEvent public static void onInteract(PlayerInteractEvent.RightClickBlock e) { TileEntity tile = e.getWorld().getTileEntity(e.getPos()); if (tile != null && tile instanceof TileEntityChest) { TileEntityLockableLoot chest = (TileEntityLockableLoot) tile; if (chest.getLootTable() != null && chest.getLootTable().equals(LootTableList.CHESTS_DESERT_PYRAMID) && e.getEntityPlayer().getRNG().nextFloat() < 0.02f) { BlockPos pos = findPos(e.getPos().getAllInBox(e.getPos().add(-1, 0, -1), e.getPos().add(1, 1, 1)), e.getWorld()); if (pos != null && MobsConfig.skeletons.corrupted.spawnFromLootChests) { EntityCorruptedSkeleton entity = new EntityCorruptedSkeleton(e.getWorld()); entity.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(Items.BONE)); entity.setLocationAndAngles(pos.getX(), pos.getY(), pos.getZ(), 0, 0); entity.setAttackTarget(e.getEntityPlayer()); if (entity.getCanSpawnHere()) { e.getWorld().spawnEntity(entity); } } } } } private static BlockPos findPos(Iterable<BlockPos> blocks, World world){ for(BlockPos pos : blocks){ if(world.isAirBlock(pos) && world.isAirBlock(pos.add(0, 1, 0))){ return pos; } } return null; } @SubscribeEvent public static void onLivingUpdate(LivingUpdateEvent e) { // for testing. // if(e.getEntityLiving() instanceof EntityPlayer){ // EntityPlayer player = (EntityPlayer) e.getEntityLiving(); // System.out.println(player.getHeldItemMainhand() + " " + // player.getHeldItemMainhand().getTagCompound()); // } System.out.println("hi"); if (e.getEntityLiving() != null && !e.getEntityLiving().isDead) { if (e.getEntityLiving() instanceof EntityPlayer) { if (!e.getEntityLiving().isPotionActive(ModPotions.potionJokerness)) { ModPotions.potionJokerness.isReady = false; } } } } @SubscribeEvent public static void onAttack(AttackEntityEvent e) { if (!e.getEntityPlayer().getHeldItemMainhand().isEmpty()) { if (e.getEntityPlayer().getCooldownTracker() .hasCooldown(e.getEntityPlayer().getHeldItemMainhand().getItem())) { e.setCanceled(true); } } } @SubscribeEvent public static void onJoin(EntityJoinWorldEvent e){ if (e.getEntity() instanceof EntityZombie) { EntityZombie zombie = (EntityZombie) e.getEntity(); EntityAIMoveToNearestDoctor task = new EntityAIMoveToNearestDoctor(zombie, 1.2D, 16D); if (!zombie.tasks.taskEntries.contains(task)) { zombie.tasks.addTask(1, task); } } if(e.getEntity() instanceof EntitySpider && e.getWorld().rand.nextInt(100) == 76){ EntitySpider spider = (EntitySpider) e.getEntity(); EntityMiniSpider mini = new EntityMiniSpider(spider.world); mini.setLocationAndAngles(spider.posX, spider.posY, spider.posZ, spider.rotationYaw, 0.0F); spider.world.spawnEntity(mini); mini.startRiding(spider); } } @SubscribeEvent public static void onImpact(ProjectileImpactEvent.Throwable e) { if (e.getThrowable() instanceof EntityPotion) { EntityPotion potion = (EntityPotion) e.getThrowable(); if (!potion.world.isRemote) { ItemStack itemstack = potion.getPotion(); PotionType potiontype = PotionUtils.getPotionFromItem(itemstack); List<PotionEffect> list = PotionUtils.getEffectsFromStack(itemstack); if (potiontype == PotionTypes.WATER && list.isEmpty()) { if (e.getRayTraceResult().entityHit != null) { e.getRayTraceResult().entityHit.extinguish(); } } } } } @SubscribeEvent public static void onConfigChanged(final ConfigChangedEvent.OnConfigChangedEvent event) { if (event.getModID().equals(Reference.MOD_ID)) { ConfigManager.sync(Reference.MOD_ID, Config.Type.INSTANCE); } } //@SubscribeEvent public static void spawnMiniSpider(ChunkEvent.Load e) { // if (!e.isSpawner() && e.getResult() == Result.ALLOW) { // if (e.getEntityLiving() instanceof EntityAnimatedSpider || e.getEntityLiving() instanceof EntitySpider) { // if (e.getEntityLiving().getRNG().nextFloat() < 0.01f) { // EntityMiniSpider mini = new EntityMiniSpider(e.getWorld()); // mini.setLocationAndAngles(e.getX() + e.getEntityLiving().getRNG().nextGaussian(), e.getY(), // e.getZ() + e.getEntityLiving().getRNG().nextGaussian(), 0, 0); // e.getWorld().spawnEntity(mini); // } // } // } // if (!e.isSpawner() && e.getResult() == Result.ALLOW) { // if (e.getEntityLiving() instanceof EntityAnimatedZombie || e.getEntityLiving() instanceof EntityZombie) { // if (e.getEntityLiving().getRNG().nextFloat() < 0.1f) { // EntityDoctorZombie doctor = new EntityDoctorZombie(e.getWorld()); // doctor.setLocationAndAngles(e.getX() + e.getEntityLiving().getRNG().nextGaussian(), e.getY(), // e.getZ() + e.getEntityLiving().getRNG().nextGaussian(), 0, 0); // e.getWorld().spawnEntity(doctor); // } // } // } } } The AI classes are just slightly modified versions of the vanilla ones and do not add any new methods (it just allow multi mob class select instead of adding tasks for each one)
January 11, 20187 yr As usual, mysterious runtime behavior demands an investigation in the debugger. Set breakpoints that will stop execution when you reach the problem stage of the game. When you get there, then set more breakpoints in methods that you want to why they're even being called. When they hit, look at the call stack. Home in on your problem from there and do some stepping. If chunk gen is really running away, then the "why" should become obvious after an iteration or three. The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.
January 11, 20187 yr Author but I am just getting warnings and I do not where to set breakpoints but I tried setting breakpoints all over my code but nothing is related to my mob because my mob is extremely basic and I am not that expert with this call stack stuff
January 11, 20187 yr (I honestly don't know much about entities and I never created one beefore, this is judt a general debugging suggestion...) Does it work if you only copy vanilla code? (If not it must have sth to do with registration...) If it does, try adding line for line until you find the problem and then try asking what's wrong with that... (I assume that you couldn't find the Problem whilst using ordinary debugging mechanisms) Another way would be to try to find the warning/error line in vanilla/forge code and then go back until you find the last call to your own code... (this way is probably more difficult...
January 12, 20187 yr Cascading world gen basically means that while generating a chunk something requires a neighboring chunk that isn't already loaded to get loaded (and generated) and then that chunk spills into another and so on. For example, if a tree was at the edge of a chunk that would happen and if your mod made a lot of trees the probably would get high for cascading. If your mod is only doing entities, I guess it may have to do with the spawning. For example, if you set the spawning funny maybe it is trying to spawn a lot of them and in large groups such that the group spawner needs to load a neighboring chunk to complete the group. Check out my tutorials here: http://jabelarminecraft.blogspot.com/
January 12, 20187 yr Author I found the bug. It is because I adding the move through village AI task to the entities in the nether and that causes chunks to load. I will mark it as solved.DO NOT ADD MOVE THROUGH VILLAGE AI TASK TO NETHER ENTITIES.
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.