
erce312
Members-
Posts
19 -
Joined
-
Last visited
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
erce312's Achievements

Tree Puncher (2/8)
0
Reputation
-
[1.14.4] Custom Skeleton not using the custom bow
erce312 replied to erce312's topic in Modder Support
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] {} -
[1.14.4] Custom Skeleton not using the custom bow
erce312 replied to erce312's topic in Modder Support
https://github.com/erec312/informatikacraft here it is -
[1.14.4] Custom Skeleton not using the custom bow
erce312 replied to erce312's topic in Modder Support
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))); -
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); } }
-
[1.14.4.] Custom Skeleton not shooting custom bow
erce312 replied to erce312's topic in Modder Support
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 ? -
[1.14.4.] Custom Skeleton not shooting custom bow
erce312 replied to erce312's topic in Modder Support
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; } } -
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) { }
-
Thank you all
-
https://github.com/erec312/informatikacraft. Ok I have changed it. Thank you for your patience.
-
https://github.com/erec312/informatikacraft
-
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.
-
Could you post your code ?
-
Yes the code is being called Reaper.setEquipmentBasedOnDifficulty(DifficultyInstance) line: 24 This is the stack from the debugger.
-
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)); } }
-
The skeletons aren't holding the custom bow, nor using it when attacking.