Minecraft Forge 1.12.2自定义箭头拾取器不返回我的CustomArrow

时间:2018-02-14 18:01:41

标签: minecraft minecraft-forge

我希望玩家选择自定义箭头而不是普通箭头。 我认为它与ItemStack有关,这可以在Minecraft 1.12.2中做到吗? 我的箭头类名为CustomArrow:

package domain.items.objects;

import domain.entity.ECustomArrow;
import domain.register.RegisterItems;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemArrow;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;

public class LevitationArrow extends ItemArrow {
    public LevitationArrow(String Name) {
        this.setCreativeTab(CreativeTabs.COMBAT);
        this.setRegistryName(Name);
        this.setUnlocalizedName(Name);
        RegisterItems.ITEMS.add(this);
    }

    public ECustomArrow makeTippedArrow(World world, ItemStack itemstack, EntityLivingBase shooter) {
        return new ECustomArrow(world, shooter);
    }

}

箭头实体名为ECustomArrow

package domain.entity;

import domain.Utils;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.init.MobEffects;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;

public abstract class ECustomArrow extends EntityArrow {

    public ECustomArrow(World worldIn, EntityLivingBase shooter) {
        super(worldIn);

    }


    @Override
    public void arrowHit(EntityLivingBase living) {
        super.arrowHit(living);
        if (living != shootingEntity) {
            living.addPotionEffect(new PotionEffect(MobEffects.***EFFECT NAME***, Utils.SECS2TICKS(10), 1));
        }
    }
}

在我的主要课程中我得到了

...
public static ItemArrow customarrow;
...
customarrow = new CustomArrow("customarrow");
...

0 个答案:

没有答案