本帖最后由 数据system 于 2020-10-16 23:25 编辑
复制代码复制代码
设置似乎对生成的实体也没有什么作用
使用shoot方法似乎实体一直都保持不动。
Forge1.12.2-14.23.5.2847
- public EntityMagicBullet(World worldIn, EntityLivingBase throwerIn)
- {
- super(worldIn, throwerIn);
- shoot((Entity)throwerIn, throwerIn.rotationPitch, throwerIn.rotationYaw, 0.0f, 1.5f, 1.0f);
- }
- protected float getVelocity()
- {
- return 1.5F;
- }
-
- protected float getGravityVelocity()
- {
- return 1.0F; //重力影响极小
- }
-
- protected float getInaccuracy() {
- return 1.0F;
- }
设置似乎对生成的实体也没有什么作用
使用shoot方法似乎实体一直都保持不动。
Forge1.12.2-14.23.5.2847
本帖最后由 赤刃泉润CQR 于 2020-10-17 00:07 编辑
可以参考原版雪球的发射写法
复制代码发射雪球实体的是这段(从上段中提取的)复制代码
可以参考原版雪球的发射写法
- public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn)
- {
- ItemStack itemstack = playerIn.getHeldItem(handIn);
- if (!playerIn.capabilities.isCreativeMode)
- {
- itemstack.shrink(1);
- }
- worldIn.playSound((EntityPlayer)null, playerIn.posX, playerIn.posY, playerIn.posZ, SoundEvents.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
- if (!worldIn.isRemote)
- {
- EntitySnowball entitysnowball = new EntitySnowball(worldIn, playerIn);
- entitysnowball.shoot(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0F, 1.5F, 1.0F);
- worldIn.spawnEntity(entitysnowball);
- }
- playerIn.addStat(StatList.getObjectUseStats(this));
- return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, itemstack);
- }
- if (!worldIn.isRemote)
- {
- EntitySnowball entitysnowball = new EntitySnowball(worldIn, playerIn);
- entitysnowball.shoot(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0F, 1.5F, 1.0F);
- worldIn.spawnEntity(entitysnowball);
- }