MinecraftScripterAI
Discord ↗
Link Copied to Clipboard
×
"Creates explosive arrows that if fired from a bow at an enemy will explode"
/* This mod creates explosive arrows that explode upon hitting an enemy. */ public class ExplosiveArrowEntity extends ArrowEntity { public ExplosiveArrowEntity(EntityType<? extends ArrowEntity> type, World worldIn) { super(type, worldIn); } public ExplosiveArrowEntity(World worldIn, LivingEntity shooter) { super(worldIn, shooter); } @Override protected void doPostHurtEffects(LivingEntity entity) { super.doPostHurtEffects(entity); this.level.explode(this, this.getX(), this.getY(0.0625D), this.getZ(), 2.0F, Explosion.Mode.NONE); } /* Other necessary methods like registerAttributes, createSpawnPacket, etc. */ } /* In your item class for the bow, override the createArrow method to return an instance of your explosive arrow. */ public class ExplosiveBowItem extends BowItem { public ExplosiveBowItem(Properties builder) { super(builder); } @Override public AbstractArrowEntity createArrow(World worldIn, ItemStack stack, LivingEntity shooter) { return new ExplosiveArrowEntity(worldIn, shooter); } }