gpt4 book ai didi

java - 类型为ItemVoidPickaxe的onItemRightClick(ItemStack,World,EntityPlayer,EnumHand)方法必须重写或实现父类(super class)型方法

转载 作者:行者123 更新时间:2023-12-03 05:58:06 26 4
gpt4 key购买 nike

我正在尝试使右键单击时损坏的项目。唯一的问题是...好吧,错误是此问题的标题...而且快速的解决方法是删除@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 ...事情...

因此,如果您可以提供帮助,那就太好了!

记住,我还不太擅长编码...

最佳答案

好吧,我与Gradle无关,但是阅读您的错误消息,您的方法不应该是这样吗?

@Override 
public ItemVoidPickaxe onItemRightClick(ItemStack itemstack, World worldIn, EntityPlayer playerIn, EnumHand handIn) {
super(...);
// the rest of the code
}

似乎您正在混淆各种方法...

关于java - 类型为ItemVoidPickaxe的onItemRightClick(ItemStack,World,EntityPlayer,EnumHand)方法必须重写或实现父类(super class)型方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43551264/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com