なぜこのエラーが発生しますか?Javaエラー:C17PacketCustomPayload(String、byte [])のコンストラクタは定義されていません
The constructor C17PacketCustomPayload(String, byte[]) is undefined
Javaコード:
package pw.cinque.ping;
import java.awt.Color;
import net.minecraft.client.Minecraft;
import net.minecraft.network.Packet;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.client.C17PacketCustomPayload;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.gameevent.InputEvent;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import java.awt.*;
import java.nio.ByteBuffer;
import org.lwjgl.input.Keyboard;
@Mod(modid = Packets.MODID, version = Packets.VERSION)
public class Packets
{
public static final String MODID = "Lower ur ping!";
public static final String VERSION = "1.0";
private static final Minecraft mc = Minecraft.getMinecraft();
private boolean textGui;
private final int textGuiKey = Keyboard.KEY_P;
private boolean reachToogle;
private final int reachKey = Keyboard.KEY_L;
@EventHandler
public void init(FMLInitializationEvent event)
{
FMLCommonHandler.instance().bus().register(this);
MinecraftForge.EVENT_BUS.register(this);
System.out.println("Intialized Reach Mod by Shiny");
}
@SubscribeEvent
public void onRender(TickEvent.RenderTickEvent e) {
if(textGui)
mc.fontRendererObj.drawStringWithShadow("Shiny", 2, 2, Color.BLACK.hashCode());
}
@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent e) {
if(Keyboard.isKeyDown(textGuiKey)) {
textGui = !textGui;
return;
}
else if(Keyboard.isKeyDown(reachKey)) {
reachToogle = !reachToogle;
}
Packet spoofedReachPacket = manipulateReachPacket(spoofReachValue(4.2));
mc.thePlayer.sendQueue.addToSendQueue(spoofedReachPacket);
}
private Packet manipulateReachPacket(byte[] spoofedReachValue) {
return new C17PacketCustomPayload("reach", spoofedReachValue);
}
private byte[] spoofReachValue(double reachValue) {
byte[] buffer = new byte[8];
ByteBuffer.wrap(buffer).putDouble(reachValue`enter code here`);
return buffer;
}
}
「C17PacketCustomPayload」にはどのようなコンストラクタがありますか? –
私は、そのコンストラクタが定義されていないことを意味していると思います。質問はなんですか? – EJoshuaS