Jump to content

erce312

Members
  • Posts

    19
  • Joined

  • Last visited

Everything posted by erce312

  1. Well my game doesn't really crash, the entity just doesn't spawn and this is the output in the console. Sorry for using the wrong expression. I also realized I never posted the full class so here it is. package com.github.erce312.informatikacraft.entities; import com.github.erce312.informatikacraft.init.InformatikacraftEntities; import com.github.erce312.informatikacraft.init.InformatikacraftItems; import net.minecraft.entity.EntityType; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.ai.goal.MeleeAttackGoal; import net.minecraft.entity.ai.goal.RangedBowAttackGoal; import net.minecraft.entity.monster.AbstractSkeletonEntity; import net.minecraft.entity.monster.SkeletonEntity; import net.minecraft.entity.projectile.AbstractArrowEntity; import net.minecraft.entity.projectile.ProjectileHelper; import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.util.SoundEvent; import net.minecraft.util.SoundEvents; import net.minecraft.util.math.MathHelper; import net.minecraft.world.Difficulty; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.World; public class Reaper extends AbstractSkeletonEntity { private final RangedBowAttackGoal<AbstractSkeletonEntity> aiArrowAttack = new RangedBowAttackGoal<>(this, 1.0D, 20, 15.0F); private final MeleeAttackGoal aiAttackOnCollide = new MeleeAttackGoal(this, 1.2D, false) { public void resetTask() { super.resetTask(); Reaper.this.setAggroed(false); } public void startExecuting() { super.startExecuting(); Reaper.this.setAggroed(true); } }; public Reaper(EntityType<? extends AbstractSkeletonEntity> type, World wotldIn) { super((EntityType<? extends SkeletonEntity>) InformatikacraftEntities.REAPER, wotldIn); } @Override protected void setEquipmentBasedOnDifficulty(DifficultyInstance difficulty) { super.setEquipmentBasedOnDifficulty(difficulty); this.setItemStackToSlot(EquipmentSlotType.MAINHAND, new ItemStack(InformatikacraftItems.amethyst_bow)); } @Override protected SoundEvent getStepSound() { return null; } @Override public void setCombatTask() { if (this.world != null && !this.world.isRemote) { this.goalSelector.removeGoal(this.aiAttackOnCollide); this.goalSelector.removeGoal(this.aiArrowAttack); ItemStack itemstack = this.getHeldItem(ProjectileHelper.getHandWith(this, InformatikacraftItems.amethyst_bow)); if (itemstack.getItem() instanceof net.minecraft.item.BowItem) { int i = 20; if (this.world.getDifficulty() != Difficulty.HARD) { i = 40; } this.aiArrowAttack.setAttackCooldown(i); this.goalSelector.addGoal(4, this.aiArrowAttack); } else { this.goalSelector.addGoal(4, this.aiAttackOnCollide); } } } @Override public void attackEntityWithRangedAttack(LivingEntity target, float distanceFactor) { ItemStack itemstack = this.findAmmo(this.getHeldItem(ProjectileHelper.getHandWith(this, InformatikacraftItems.amethyst_bow))); AbstractArrowEntity abstractarrowentity = this.func_213624_b(itemstack, distanceFactor); if (this.getHeldItemMainhand().getItem() instanceof net.minecraft.item.BowItem) abstractarrowentity = ((net.minecraft.item.BowItem)this.getHeldItemMainhand().getItem()).customeArrow(abstractarrowentity); double d0 = target.posX - this.posX; double d1 = target.getBoundingBox().minY + (double)(target.getHeight() / 3.0F) - abstractarrowentity.posY; double d2 = target.posZ - this.posZ; double d3 = (double)MathHelper.sqrt(d0 * d0 + d2 * d2); abstractarrowentity.shoot(d0, d1 + d3 * (double)0.2F, d2, 1.6F, (float)(14 - this.world.getDifficulty().getId() * 4)); this.playSound(SoundEvents.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F)); this.world.addEntity(abstractarrowentity); super.attackEntityWithRangedAttack(target, distanceFactor); } } I've also changed the class a bit so here is the log again �[m�[1;31m[22:34:39] [Server thread/FATAL] [minecraft/ThreadTaskExecutor]: Error executing task on Server java.lang.NullPointerException: null at net.minecraft.entity.ai.goal.PrioritizedGoal.hashCode(PrioritizedGoal.java:97) ~[?:?] {re:classloading} at java.util.HashMap.hash(Unknown Source) ~[?:1.8.0_241] {} at java.util.HashMap.put(Unknown Source) ~[?:1.8.0_241] {} at java.util.HashSet.add(Unknown Source) ~[?:1.8.0_241] {} at net.minecraft.entity.ai.goal.GoalSelector.addGoal(GoalSelector.java:42) ~[?:?] {re:classloading} at com.github.erce312.informatikacraft.entities.Reaper.setCombatTask(Reaper.java:71) ~[?:?] {re:classloading} at net.minecraft.entity.monster.AbstractSkeletonEntity.<init>(AbstractSkeletonEntity.java:69) ~[?:?] {re:classloading,pl:accesstransformer:B} at com.github.erce312.informatikacraft.entities.Reaper.<init>(Reaper.java:43) ~[?:?] {re:classloading} at net.minecraft.entity.EntityType.create(EntityType.java:415) ~[?:?] {re:classloading} at net.minecraft.entity.EntityType.create(EntityType.java:305) ~[?:?] {re:classloading} at net.minecraft.entity.EntityType.spawn(EntityType.java:297) ~[?:?] {re:classloading} at net.minecraft.entity.EntityType.spawn(EntityType.java:292) ~[?:?] {re:classloading} at net.minecraft.item.SpawnEggItem.onItemUse(SpawnEggItem.java:80) ~[?:?] {re:classloading} at net.minecraftforge.common.ForgeHooks.onPlaceItemIntoWorld(ForgeHooks.java:607) ~[?:?] {re:classloading} at net.minecraft.item.ItemStack.onItemUse(ItemStack.java:168) ~[?:?] {re:classloading} at net.minecraft.server.management.PlayerInteractionManager.func_219441_a(PlayerInteractionManager.java:341) ~[?:?] {re:classloading} at net.minecraft.network.play.ServerPlayNetHandler.processTryUseItemOnBlock(ServerPlayNetHandler.java:870) ~[?:?] {re:classloading} at net.minecraft.network.play.client.CPlayerTryUseItemOnBlockPacket.processPacket(CPlayerTryUseItemOnBlockPacket.java:42) ~[?:?] {re:classloading} at net.minecraft.network.play.client.CPlayerTryUseItemOnBlockPacket.processPacket(CPlayerTryUseItemOnBlockPacket.java:12) ~[?:?] {re:classloading} at net.minecraft.network.PacketThreadUtil.lambda$checkThreadAndEnqueue$0(PacketThreadUtil.java:19) ~[?:?] {re:classloading} at net.minecraft.util.concurrent.TickDelayedTask.run(TickDelayedTask.java:20) ~[?:?] {re:classloading} at net.minecraft.util.concurrent.ThreadTaskExecutor.run(ThreadTaskExecutor.java:140) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.util.concurrent.RecursiveEventLoop.run(RecursiveEventLoop.java:22) [?:?] {re:classloading} at net.minecraft.util.concurrent.ThreadTaskExecutor.driveOne(ThreadTaskExecutor.java:110) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.func_213205_aW(MinecraftServer.java:726) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.driveOne(MinecraftServer.java:720) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.util.concurrent.ThreadTaskExecutor.driveUntil(ThreadTaskExecutor.java:123) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.runScheduledTasks(MinecraftServer.java:706) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:650) [?:?] {re:classloading,pl:accesstransformer:B} at java.lang.Thread.run(Unknown Source) [?:1.8.0_241] {}
  2. https://github.com/erec312/informatikacraft here it is
  3. I have tried to to that but had a lot of issues with aiArrowAttack and aiAttackOnCollide being set to private in the AbstractSkeletonEntity class. I've tried to rewrite them like this in my code private final RangedBowAttackGoal<AbstractSkeletonEntity> aiArrowAttack = new RangedBowAttackGoal<>(this, 1.0D, 20, 15.0F); private final MeleeAttackGoal aiAttackOnCollide = new MeleeAttackGoal(this, 1.2D, false) { public void resetTask() { super.resetTask(); Reaper.this.setAggroed(false); } public void startExecuting() { super.startExecuting(); Reaper.this.setAggroed(true); } }; and then override the setAttackGoal @Override public void setCombatTask() { if (this.world != null && !this.world.isRemote) { this.goalSelector.removeGoal(this.aiAttackOnCollide); this.goalSelector.removeGoal(this.aiArrowAttack); ItemStack itemstack = this.getHeldItem(ProjectileHelper.getHandWith(this, InformatikacraftItems.amethyst_bow)); if (itemstack.getItem() instanceof net.minecraft.item.BowItem) { int i = 20; if (this.world.getDifficulty() != Difficulty.HARD) { i = 40; } this.aiArrowAttack.setAttackCooldown(i); this.goalSelector.addGoal(4, this.aiArrowAttack); } else { this.goalSelector.addGoal(4, this.aiAttackOnCollide); } } } But the mob wouldn't spawn now. Here is the crash report [Server thread/FATAL] [minecraft/ThreadTaskExecutor]: Error executing task on Server java.lang.NullPointerException: null at net.minecraft.entity.ai.goal.PrioritizedGoal.hashCode(PrioritizedGoal.java:97) ~[?:?] {re:classloading} at java.util.HashMap.hash(HashMap.java:339) ~[?:1.8.0_221] {} at java.util.HashMap.put(HashMap.java:612) ~[?:1.8.0_221] {} at java.util.HashSet.add(HashSet.java:220) ~[?:1.8.0_221] {} at net.minecraft.entity.ai.goal.GoalSelector.addGoal(GoalSelector.java:42) ~[?:?] {re:classloading} at com.github.erce312.informatikacraft.entities.Reaper.setCombatTask(Reaper.java:87) ~[?:?] {re:classloading} at net.minecraft.entity.monster.AbstractSkeletonEntity.<init>(AbstractSkeletonEntity.java:69) ~[?:?] {re:classloading,pl:accesstransformer:B} at com.github.erce312.informatikacraft.entities.Reaper.<init>(Reaper.java:44) ~[?:?] {re:classloading} at net.minecraft.entity.EntityType.create(EntityType.java:415) ~[?:?] {re:classloading} at net.minecraft.entity.EntityType.create(EntityType.java:305) ~[?:?] {re:classloading} at net.minecraft.entity.EntityType.spawn(EntityType.java:297) ~[?:?] {re:classloading} at net.minecraft.entity.EntityType.spawn(EntityType.java:292) ~[?:?] {re:classloading} at net.minecraft.item.SpawnEggItem.onItemUse(SpawnEggItem.java:80) ~[?:?] {re:classloading} at net.minecraftforge.common.ForgeHooks.onPlaceItemIntoWorld(ForgeHooks.java:607) ~[?:?] {re:classloading} at net.minecraft.item.ItemStack.onItemUse(ItemStack.java:168) ~[?:?] {re:classloading} at net.minecraft.server.management.PlayerInteractionManager.func_219441_a(PlayerInteractionManager.java:341) ~[?:?] {re:classloading} at net.minecraft.network.play.ServerPlayNetHandler.processTryUseItemOnBlock(ServerPlayNetHandler.java:870) ~[?:?] {re:classloading} at net.minecraft.network.play.client.CPlayerTryUseItemOnBlockPacket.processPacket(CPlayerTryUseItemOnBlockPacket.java:42) ~[?:?] {re:classloading} at net.minecraft.network.play.client.CPlayerTryUseItemOnBlockPacket.processPacket(CPlayerTryUseItemOnBlockPacket.java:12) ~[?:?] {re:classloading} at net.minecraft.network.PacketThreadUtil.lambda$checkThreadAndEnqueue$0(PacketThreadUtil.java:19) ~[?:?] {re:classloading} at net.minecraft.util.concurrent.TickDelayedTask.run(TickDelayedTask.java:20) ~[?:?] {re:classloading} at net.minecraft.util.concurrent.ThreadTaskExecutor.run(ThreadTaskExecutor.java:140) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.util.concurrent.RecursiveEventLoop.run(RecursiveEventLoop.java:22) [?:?] {re:classloading} at net.minecraft.util.concurrent.ThreadTaskExecutor.driveOne(ThreadTaskExecutor.java:110) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.func_213205_aW(MinecraftServer.java:726) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.driveOne(MinecraftServer.java:720) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.util.concurrent.ThreadTaskExecutor.drainTasks(ThreadTaskExecutor.java:97) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.runScheduledTasks(MinecraftServer.java:705) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:650) [?:?] {re:classloading,pl:accesstransformer:B} at java.lang.Thread.run(Thread.java:748) [?:1.8.0_221] {} Here is the full class package com.github.erce312.informatikacraft.entities; import com.github.erce312.informatikacraft.init.InformatikacraftEntities; import com.github.erce312.informatikacraft.init.InformatikacraftItems; import net.minecraft.entity.EntityType; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.ai.goal.MeleeAttackGoal; import net.minecraft.entity.ai.goal.RangedBowAttackGoal; import net.minecraft.entity.monster.AbstractSkeletonEntity; import net.minecraft.entity.monster.SkeletonEntity; import net.minecraft.entity.projectile.AbstractArrowEntity; import net.minecraft.entity.projectile.ProjectileHelper; import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.util.SoundEvent; import net.minecraft.util.SoundEvents; import net.minecraft.util.math.MathHelper; import net.minecraft.world.Difficulty; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.World; public class Reaper extends AbstractSkeletonEntity { private final RangedBowAttackGoal<AbstractSkeletonEntity> aiArrowAttack = new RangedBowAttackGoal<>(this, 1.0D, 20, 15.0F); private final MeleeAttackGoal aiAttackOnCollide = new MeleeAttackGoal(this, 1.2D, false) { public void resetTask() { super.resetTask(); Reaper.this.setAggroed(false); } public void startExecuting() { super.startExecuting(); Reaper.this.setAggroed(true); } }; public Reaper(EntityType<? extends AbstractSkeletonEntity> type, World wotldIn) { super((EntityType<? extends SkeletonEntity>) InformatikacraftEntities.REAPER, wotldIn); } @Override protected void setEquipmentBasedOnDifficulty(DifficultyInstance difficulty) { super.setEquipmentBasedOnDifficulty(difficulty); this.setItemStackToSlot(EquipmentSlotType.MAINHAND, new ItemStack(InformatikacraftItems.amethyst_bow)); } @Override protected SoundEvent getStepSound() { return null; } @Override public void attackEntityWithRangedAttack(LivingEntity target, float distanceFactor) { ItemStack itemstack = this.findAmmo(this.getHeldItem(ProjectileHelper.getHandWith(this, InformatikacraftItems.amethyst_bow)));
  4. So I have made a custom skeleton and a custom bow item, however when I give it to the custom skeleton he doesn't use it. Here is my class. Any help would be greatly appreciated. package com.github.erce312.informatikacraft.entities; import com.github.erce312.informatikacraft.init.InformatikacraftEntities; import com.github.erce312.informatikacraft.init.InformatikacraftItems; import net.minecraft.entity.EntityType; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.monster.AbstractSkeletonEntity; import net.minecraft.entity.monster.SkeletonEntity; import net.minecraft.entity.projectile.AbstractArrowEntity; import net.minecraft.entity.projectile.ProjectileHelper; import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.item.ItemStack; import net.minecraft.util.SoundEvent; import net.minecraft.util.SoundEvents; import net.minecraft.util.math.MathHelper; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.World; public class Reaper extends AbstractSkeletonEntity { public Reaper(EntityType<? extends AbstractSkeletonEntity> type, World wotldIn) { super((EntityType<? extends SkeletonEntity>) InformatikacraftEntities.REAPER, wotldIn); } @Override protected void setEquipmentBasedOnDifficulty(DifficultyInstance difficulty) { super.setEquipmentBasedOnDifficulty(difficulty); this.setItemStackToSlot(EquipmentSlotType.MAINHAND, new ItemStack(InformatikacraftItems.amethyst_bow)); } @Override protected SoundEvent getStepSound() { return null; } @Override public void attackEntityWithRangedAttack(LivingEntity target, float distanceFactor) { ItemStack itemstack = this.findAmmo(this.getHeldItem(ProjectileHelper.getHandWith(this, InformatikacraftItems.amethyst_bow))); AbstractArrowEntity abstractarrowentity = this.func_213624_b(itemstack, distanceFactor); if (this.getHeldItemMainhand().getItem() instanceof net.minecraft.item.BowItem) abstractarrowentity = ((net.minecraft.item.BowItem)this.getHeldItemMainhand().getItem()).customeArrow(abstractarrowentity); double d0 = target.posX - this.posX; double d1 = target.getBoundingBox().minY + (double)(target.getHeight() / 3.0F) - abstractarrowentity.posY; double d2 = target.posZ - this.posZ; double d3 = (double)MathHelper.sqrt(d0 * d0 + d2 * d2); abstractarrowentity.shoot(d0, d1 + d3 * (double)0.2F, d2, 1.6F, (float)(14 - this.world.getDifficulty().getId() * 4)); this.playSound(SoundEvents.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F)); this.world.addEntity(abstractarrowentity); super.attackEntityWithRangedAttack(target, distanceFactor); } }
  5. So I have changed my class to this package com.github.erce312.informatikacraft.entities; import com.github.erce312.informatikacraft.init.InformatikacraftEntities; import com.github.erce312.informatikacraft.init.InformatikacraftItems; import net.minecraft.entity.EntityType; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.ai.goal.MeleeAttackGoal; import net.minecraft.entity.ai.goal.RangedBowAttackGoal; import net.minecraft.entity.monster.AbstractSkeletonEntity; import net.minecraft.entity.monster.SkeletonEntity; import net.minecraft.entity.projectile.AbstractArrowEntity; import net.minecraft.entity.projectile.ProjectileHelper; import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.util.SoundEvent; import net.minecraft.util.SoundEvents; import net.minecraft.util.math.MathHelper; import net.minecraft.world.Difficulty; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.World; public class Reaper extends AbstractSkeletonEntity { private final RangedBowAttackGoal<AbstractSkeletonEntity> aiArrowAttack = new RangedBowAttackGoal<>(this, 1.0D, 20, 15.0F); private final MeleeAttackGoal aiAttackOnCollide = new MeleeAttackGoal(this, 1.2D, false) { public void resetTask() { super.resetTask(); Reaper.this.setAggroed(false); } public void startExecuting() { super.startExecuting(); Reaper.this.setAggroed(true); } }; public Reaper(EntityType<? extends AbstractSkeletonEntity> type, World wotldIn) { super((EntityType<? extends SkeletonEntity>) InformatikacraftEntities.REAPER, wotldIn); } @Override protected void setEquipmentBasedOnDifficulty(DifficultyInstance difficulty) { super.setEquipmentBasedOnDifficulty(difficulty); this.setItemStackToSlot(EquipmentSlotType.MAINHAND, new ItemStack(InformatikacraftItems.amethyst_bow)); } @Override protected SoundEvent getStepSound() { return null; } @Override public void attackEntityWithRangedAttack(LivingEntity target, float distanceFactor) { ItemStack itemstack = this.findAmmo(this.getHeldItem(ProjectileHelper.getHandWith(this, InformatikacraftItems.amethyst_bow))); AbstractArrowEntity abstractarrowentity = this.func_213624_b(itemstack, distanceFactor); if (this.getHeldItemMainhand().getItem() instanceof net.minecraft.item.BowItem) abstractarrowentity = ((net.minecraft.item.BowItem)this.getHeldItemMainhand().getItem()).customeArrow(abstractarrowentity); double d0 = target.posX - this.posX; double d1 = target.getBoundingBox().minY + (double)(target.getHeight() / 3.0F) - abstractarrowentity.posY; double d2 = target.posZ - this.posZ; double d3 = (double)MathHelper.sqrt(d0 * d0 + d2 * d2); abstractarrowentity.shoot(d0, d1 + d3 * (double)0.2F, d2, 1.6F, (float)(14 - this.world.getDifficulty().getId() * 4)); this.playSound(SoundEvents.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F)); this.world.addEntity(abstractarrowentity); super.attackEntityWithRangedAttack(target, distanceFactor); } @Override public void setCombatTask() { if (this.world != null && !this.world.isRemote) { this.goalSelector.removeGoal(this.aiAttackOnCollide); this.goalSelector.removeGoal(this.aiArrowAttack); ItemStack itemstack = this.getHeldItem(ProjectileHelper.getHandWith(this, InformatikacraftItems.amethyst_bow)); if (itemstack.getItem() instanceof net.minecraft.item.BowItem) { int i = 20; if (this.world.getDifficulty() != Difficulty.HARD) { i = 40; } this.aiArrowAttack.setAttackCooldown(i); this.goalSelector.addGoal(4, this.aiArrowAttack); } else { this.goalSelector.addGoal(4, this.aiAttackOnCollide); } } } } But now I get an error when the entity is spawned. This is the crash report [Server thread/FATAL] [minecraft/ThreadTaskExecutor]: Error executing task on Server java.lang.NullPointerException: null at net.minecraft.entity.ai.goal.PrioritizedGoal.hashCode(PrioritizedGoal.java:97) ~[?:?] {re:classloading} at java.util.HashMap.hash(HashMap.java:339) ~[?:1.8.0_221] {} at java.util.HashMap.put(HashMap.java:612) ~[?:1.8.0_221] {} at java.util.HashSet.add(HashSet.java:220) ~[?:1.8.0_221] {} at net.minecraft.entity.ai.goal.GoalSelector.addGoal(GoalSelector.java:42) ~[?:?] {re:classloading} at com.github.erce312.informatikacraft.entities.Reaper.setCombatTask(Reaper.java:87) ~[?:?] {re:classloading} at net.minecraft.entity.monster.AbstractSkeletonEntity.<init>(AbstractSkeletonEntity.java:69) ~[?:?] {re:classloading,pl:accesstransformer:B} at com.github.erce312.informatikacraft.entities.Reaper.<init>(Reaper.java:44) ~[?:?] {re:classloading} at net.minecraft.entity.EntityType.create(EntityType.java:415) ~[?:?] {re:classloading} at net.minecraft.entity.EntityType.create(EntityType.java:305) ~[?:?] {re:classloading} at net.minecraft.entity.EntityType.spawn(EntityType.java:297) ~[?:?] {re:classloading} at net.minecraft.entity.EntityType.spawn(EntityType.java:292) ~[?:?] {re:classloading} at net.minecraft.item.SpawnEggItem.onItemUse(SpawnEggItem.java:80) ~[?:?] {re:classloading} at net.minecraftforge.common.ForgeHooks.onPlaceItemIntoWorld(ForgeHooks.java:607) ~[?:?] {re:classloading} at net.minecraft.item.ItemStack.onItemUse(ItemStack.java:168) ~[?:?] {re:classloading} at net.minecraft.server.management.PlayerInteractionManager.func_219441_a(PlayerInteractionManager.java:341) ~[?:?] {re:classloading} at net.minecraft.network.play.ServerPlayNetHandler.processTryUseItemOnBlock(ServerPlayNetHandler.java:870) ~[?:?] {re:classloading} at net.minecraft.network.play.client.CPlayerTryUseItemOnBlockPacket.processPacket(CPlayerTryUseItemOnBlockPacket.java:42) ~[?:?] {re:classloading} at net.minecraft.network.play.client.CPlayerTryUseItemOnBlockPacket.processPacket(CPlayerTryUseItemOnBlockPacket.java:12) ~[?:?] {re:classloading} at net.minecraft.network.PacketThreadUtil.lambda$checkThreadAndEnqueue$0(PacketThreadUtil.java:19) ~[?:?] {re:classloading} at net.minecraft.util.concurrent.TickDelayedTask.run(TickDelayedTask.java:20) ~[?:?] {re:classloading} at net.minecraft.util.concurrent.ThreadTaskExecutor.run(ThreadTaskExecutor.java:140) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.util.concurrent.RecursiveEventLoop.run(RecursiveEventLoop.java:22) [?:?] {re:classloading} at net.minecraft.util.concurrent.ThreadTaskExecutor.driveOne(ThreadTaskExecutor.java:110) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.func_213205_aW(MinecraftServer.java:726) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.driveOne(MinecraftServer.java:720) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.util.concurrent.ThreadTaskExecutor.drainTasks(ThreadTaskExecutor.java:97) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.runScheduledTasks(MinecraftServer.java:705) [?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:650) [?:?] {re:classloading,pl:accesstransformer:B} at java.lang.Thread.run(Thread.java:748) [?:1.8.0_221] {} It says something is wrong with this.goalSelector.addGoal(4, this.aiAttackOnCollide); But I haven't changed that part. Does anyone know what is going on ?
  6. Yes the class extends the AbstractSkeletonEntity.public class Reaper extends AbstractSkeletonEntity { public Reaper(EntityType<? extends AbstractSkeletonEntity> type, World wotldIn) { super((EntityType<? extends SkeletonEntity>) InformatikacraftEntities.REAPER, wotldIn); } @Override protected void setEquipmentBasedOnDifficulty(DifficultyInstance difficulty) { super.setEquipmentBasedOnDifficulty(difficulty); this.setItemStackToSlot(EquipmentSlotType.MAINHAND, new ItemStack(InformatikacraftItems.amethyst_bow)); } @Override protected SoundEvent getStepSound() { return null; } }
  7. I've made a custom skeleton entity and given him a custom bow but he doesn't shoot/use it. The skeleton just melee attacks me. I've tried to override the setCombatTask and attackEntityWithRangedAttack. @Override public void setCombatTask() { this.getHeldItem(ProjectileHelper.getHandWith(this, InformatikacraftItems.amethyst_bow)); super.setCombatTask(); } @Override public void attackEntityWithRangedAttack(LivingEntity target, float distanceFactor) { ItemStack itemstack = this.findAmmo(this.getHeldItem(ProjectileHelper.getHandWith(this, InformatikacraftItems.amethyst_bow))); super.attackEntityWithRangedAttack(target, distanceFactor); } InformatikacraftItems.amethyst_bow = new BowItem(new Item.Properties().defaultMaxDamage(1000).group(ItemGroup.TOOLS)).setRegistryName(location("amethyst_bow")), I've also checked if my custom bow is an instance of BowItem, which it is. try { BufferedWriter BR = new BufferedWriter(new FileWriter("C:\\Users\\erikp\\Documents\\test.txt")); if(InformatikacraftItems.amethyst_bow instanceof BowItem) BR.write("true"); else BR.write("false"); BR.flush(); BR.close(); }catch(Exception e) { }
  8. https://github.com/erec312/informatikacraft. Ok I have changed it. Thank you for your patience.
  9. https://github.com/erec312/informatikacraft
  10. I've tried to extend AbstarctSkeletonEntity insted of SkeletonEntity and also to give him a vanilla item. But in both cases the entity isn't holding the item.
  11. Yes the code is being called Reaper.setEquipmentBasedOnDifficulty(DifficultyInstance) line: 24 This is the stack from the debugger.
  12. package com.github.erce312.informatikacraft.entities; import com.github.erce312.informatikacraft.init.InformatikacraftEntities; import com.github.erce312.informatikacraft.init.InformatikacraftItems; import net.minecraft.entity.EntityType; import net.minecraft.entity.monster.SkeletonEntity; import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.item.ItemStack; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.World; public class Reaper extends SkeletonEntity { @SuppressWarnings("unchecked") public Reaper(EntityType<? extends SkeletonEntity> type, World wotldIn) { super((EntityType<? extends SkeletonEntity>) InformatikacraftEntities.REAPER, wotldIn); } @Override protected void setEquipmentBasedOnDifficulty(DifficultyInstance difficulty) { super.setEquipmentBasedOnDifficulty(difficulty); this.setItemStackToSlot(EquipmentSlotType.MAINHAND, new ItemStack(InformatikacraftItems.amethyst_bow)); } }
  13. The skeletons aren't holding the custom bow, nor using it when attacking.
  14. I've tried to Override the setEquipmentBasedOnDifficult, but haven't got it to work this way. Thanks for the quick reply. @Override protected void setEquipmentBasedOnDifficulty(DifficultyInstance difficulty) { super.setEquipmentBasedOnDifficulty(difficulty); this.setItemStackToSlot(EquipmentSlotType.MAINHAND, new ItemStack(InformatikacraftItems.amethyst_bow));
  15. I've been trying to make a custom mob that extends SkeletonEntity. However when I spawn him he isn't wearing a bow. I would like him to carry a custom bow which I have already created. I am new to the @Overrirde so I am asking for help.
  16. Right, so I am a little late. I had the same issue. Just copy the vanilla bow .json file and replace the name of the bow and modid. Then you need to create separate item .json's for all the stages of a bow being pulled. It's important than in the parent line you set the item as bow. Then once you make the textures for all stages it should work. "parent": "item/bow" The vanilla bow .json { "parent": "item/generated", "textures": { "layer0": "item/bow" }, "display": { "thirdperson_righthand": { "rotation": [ -80, 260, -40 ], "translation": [ -1, -2, 2.5 ], "scale": [ 0.9, 0.9, 0.9 ] }, "thirdperson_lefthand": { "rotation": [ -80, -280, 40 ], "translation": [ -1, -2, 2.5 ], "scale": [ 0.9, 0.9, 0.9 ] }, "firstperson_righthand": { "rotation": [ 0, -90, 25 ], "translation": [ 1.13, 3.2, 1.13], "scale": [ 0.68, 0.68, 0.68 ] }, "firstperson_lefthand": { "rotation": [ 0, 90, -25 ], "translation": [ 1.13, 3.2, 1.13], "scale": [ 0.68, 0.68, 0.68 ] } }, "overrides": [ { "predicate": { "pulling": 1 }, "model": "item/bow_pulling_0" }, { "predicate": { "pulling": 1, "pull": 0.65 }, "model": "item/bow_pulling_1" }, { "predicate": { "pulling": 1, "pull": 0.9 }, "model": "item/bow_pulling_2" } ] }
  17. I've been working on a new entity and the spawn egg shows up, however when I spawn it the texture is missing (black and purple). I can't figure out why. I've followed youtube tutorial. I would appreciate a little help.
×
×
  • Create New...

Important Information

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