我正在尝试制作一个右键单击损坏的项目。唯一的问题是......好吧,错误是这个问题的标题......快速解决方法是删除@Override注释但是它实际上什么都没做...这是我的代码:
package com.AFranklin78000.VoidMod.items;
import javax.xml.ws.Action;
import com.AFranklin78000.VoidMod.Refrence;
import com.AFranklin78000.VoidMod.VoidMod;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.Item;
import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemStack;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.Mod.EventHandler;
public class ItemVoidPickaxe extends ItemPickaxe {
public ItemVoidPickaxe(ToolMaterial material, String unlocalizedName) {
super(material);
this.setUnlocalizedName(unlocalizedName);
this.setRegistryName(new ResourceLocation(Refrence.MODID, unlocalizedName));
this.setCreativeTab(VoidMod.tabVoidMod);
}
@Override
public public ItemStack onItemRightClick(ItemStack itemstack, World worldIn, EntityPlayer playerIn, EnumHand handIn) {
if (true) {
if (playerIn instanceof EntityPlayerMP) {
MinecraftServer minecraftserver = FMLCommonHandler.instance().getMinecraftServerInstance();
if (minecraftserver != null)
minecraftserver.getCommandManager().executeCommand((EntityPlayerMP) playerIn, "gamerule sendCommandFeedback false");
minecraftserver.getCommandManager().executeCommand((EntityPlayerMP) playerIn, "particle portal ~ ~1 ~ 0 0 0 2.5 5000");
minecraftserver.getCommandManager().executeCommand((EntityPlayerMP) playerIn, "fill ~5 ~5 ~5 ~-5 ~ ~-5 air 0 destroy");
}
}
return onItemRightClick(itemstack, worldIn, playerIn, handIn);
}
}
这是Java代码。这是Gradle ......事情......
所以,如果你能提供帮助,那就太棒了!
请记住,我在编码时并不是很好......
答案 0 :(得分:0)
好吧,我与Gradle没什么关系,但是看了你的错误信息,你的方法不应该是这样吗?
$types=array();
foreach($_FILES as $filename=>$arrayofvalues){
$types[]=$arrayofvalues['type'];
}
似乎某种程度上你混淆了方法......
答案 1 :(得分:0)
好的,事实证明我需要使用:playerIn.getHeldItemMainhand().damageItem(1, playerIn);
而不是:itemstack.damageItem(1, playerIn);