本文整理汇总了Java中net.minecraft.network.play.client.C17PacketCustomPayload类的典型用法代码示例。如果您正苦于以下问题:Java C17PacketCustomPayload类的具体用法?Java C17PacketCustomPayload怎么用?Java C17PacketCustomPayload使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
C17PacketCustomPayload类属于net.minecraft.network.play.client包,在下文中一共展示了C17PacketCustomPayload类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleJoinGame
import net.minecraft.network.play.client.C17PacketCustomPayload; //导入依赖的package包/类
/**
* Registers some server properties (gametype,hardcore-mode,terraintype,difficulty,player limit), creates a new
* WorldClient and sets the player initial dimension
*/
public void handleJoinGame(S01PacketJoinGame packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
this.gameController.playerController = new PlayerControllerMP(this.gameController, this);
this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(), packetIn.getWorldType()), packetIn.getDimension(), packetIn.getDifficulty(), this.gameController.mcProfiler);
this.gameController.gameSettings.difficulty = packetIn.getDifficulty();
this.gameController.loadWorld(this.clientWorldController);
this.gameController.thePlayer.dimension = packetIn.getDimension();
this.gameController.displayGuiScreen(new GuiDownloadTerrain(this));
this.gameController.thePlayer.setEntityId(packetIn.getEntityId());
this.currentServerMaxPlayers = packetIn.getMaxPlayers();
this.gameController.thePlayer.setReducedDebug(packetIn.isReducedDebugInfo());
this.gameController.playerController.setGameType(packetIn.getGameType());
this.gameController.gameSettings.sendSettingsToServer();
this.netManager.sendPacket(new C17PacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).writeString(ClientBrandRetriever.getClientModName())));
}
示例2: handleJoinGame
import net.minecraft.network.play.client.C17PacketCustomPayload; //导入依赖的package包/类
/**
* Registers some server properties
* (gametype,hardcore-mode,terraintype,difficulty,player limit), creates a new
* WorldClient and sets the player initial dimension
*/
public void handleJoinGame(S01PacketJoinGame packetIn) {
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
this.gameController.playerController = new PlayerControllerMP(this.gameController, this);
this.clientWorldController = new WorldClient(this,
new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(),
packetIn.getWorldType()),
packetIn.getDimension(), packetIn.getDifficulty(), this.gameController.mcProfiler);
this.gameController.gameSettings.difficulty = packetIn.getDifficulty();
this.gameController.loadWorld(this.clientWorldController);
this.gameController.thePlayer.dimension = packetIn.getDimension();
this.gameController.displayGuiScreen(new GuiDownloadTerrain(this));
this.gameController.thePlayer.setEntityId(packetIn.getEntityId());
this.currentServerMaxPlayers = packetIn.getMaxPlayers();
this.gameController.thePlayer.setReducedDebug(packetIn.isReducedDebugInfo());
this.gameController.playerController.setGameType(packetIn.getGameType());
this.gameController.gameSettings.sendSettingsToServer();
this.netManager.sendPacket(new C17PacketCustomPayload("MC|Brand",
(new PacketBuffer(Unpooled.buffer())).writeString(ClientBrandRetriever.getClientModName())));
}
示例3: channelRead0
import net.minecraft.network.play.client.C17PacketCustomPayload; //导入依赖的package包/类
@Override
protected void channelRead0(ChannelHandlerContext ctx, Packet msg) throws Exception
{
boolean handled = false;
if (msg instanceof C17PacketCustomPayload)
{
handled = handleServerSideCustomPacket((C17PacketCustomPayload) msg, ctx);
}
else if (msg instanceof S3FPacketCustomPayload)
{
handled = handleClientSideCustomPacket((S3FPacketCustomPayload)msg, ctx);
}
else if (state != ConnectionState.CONNECTED && state != ConnectionState.HANDSHAKECOMPLETE)
{
handled = handleVanilla(msg);
}
if (!handled)
{
ctx.fireChannelRead(msg);
}
}
示例4: syncGlidingCLIENT
import net.minecraft.network.play.client.C17PacketCustomPayload; //导入依赖的package包/类
public void syncGlidingCLIENT(int type, String name){ /*0 - add, 1 - remove*/
PacketBuffer pb = new PacketBuffer(Unpooled.buffer());
try {
pb.writeInt("gliderdata".getBytes().length);
pb.writeBytes("gliderdata".getBytes());
pb.writeInt(type);
pb.writeInt(name.getBytes().length);
pb.writeBytes(name.getBytes());
} catch (Exception ex) {
ex.printStackTrace();
}
C17PacketCustomPayload packet = new C17PacketCustomPayload("AvatarMisc", pb);
Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(packet);
}
示例5: sendState
import net.minecraft.network.play.client.C17PacketCustomPayload; //导入依赖的package包/类
private static void sendState(int state){
PacketBuffer pb = new PacketBuffer(Unpooled.buffer());
try {
pb.writeInt("keyInput".getBytes().length);
pb.writeBytes("keyInput".getBytes());
pb.writeInt(state);
pb.writeInt(Minecraft.getMinecraft().thePlayer.getDisplayName().getBytes().length);
pb.writeBytes(Minecraft.getMinecraft().thePlayer.getDisplayName().getBytes());
} catch (Exception ex) {
ex.printStackTrace();
}
C17PacketCustomPayload packet = new C17PacketCustomPayload("AvatarMisc", pb);
Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(packet);
}
示例6: sendSlotContents
import net.minecraft.network.play.client.C17PacketCustomPayload; //导入依赖的package包/类
/**
* Sends the contents of an inventory slot to the client-side Container. This doesn't have to match the actual
* contents of that slot. Args: Container, slot number, slot contents
*/
@Override
public void sendSlotContents(Container container, int updateID, ItemStack itemStack)
{
if (updateID == 0)
{
this.itemNameField.setText(itemStack == null ? "" : itemStack.getDisplayName());
this.itemNameField.setEnabled(itemStack != null); //set enabled
if (itemStack != null)
{
this.repairContainer.updateItemName(this.itemNameField.getText());
mc.thePlayer.sendQueue.addToSendQueue(new C17PacketCustomPayload("MC|ItemName", itemNameField.getText().getBytes(Charsets.UTF_8)));
}
}
}
示例7: renameItem
import net.minecraft.network.play.client.C17PacketCustomPayload; //导入依赖的package包/类
private void renameItem()
{
String s = this.nameField.getText();
Slot slot = this.anvil.getSlot(0);
if (slot != null && slot.getHasStack() && !slot.getStack().hasDisplayName() && s.equals(slot.getStack().getDisplayName()))
{
s = "";
}
this.anvil.updateItemName(s);
this.mc.thePlayer.sendQueue.addToSendQueue(new C17PacketCustomPayload("MC|ItemName", (new PacketBuffer(Unpooled.buffer())).writeString(s)));
}
示例8: actionPerformed
import net.minecraft.network.play.client.C17PacketCustomPayload; //导入依赖的package包/类
/**
* Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
*/
protected void actionPerformed(GuiButton button) throws IOException
{
boolean flag = false;
if (button == this.nextButton)
{
++this.selectedMerchantRecipe;
MerchantRecipeList merchantrecipelist = this.merchant.getRecipes(this.mc.thePlayer);
if (merchantrecipelist != null && this.selectedMerchantRecipe >= merchantrecipelist.size())
{
this.selectedMerchantRecipe = merchantrecipelist.size() - 1;
}
flag = true;
}
else if (button == this.previousButton)
{
--this.selectedMerchantRecipe;
if (this.selectedMerchantRecipe < 0)
{
this.selectedMerchantRecipe = 0;
}
flag = true;
}
if (flag)
{
((ContainerMerchant)this.inventorySlots).setCurrentRecipeIndex(this.selectedMerchantRecipe);
PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
packetbuffer.writeInt(this.selectedMerchantRecipe);
this.mc.getNetHandler().addToSendQueue(new C17PacketCustomPayload("MC|TrSel", packetbuffer));
}
}
示例9: actionPerformed
import net.minecraft.network.play.client.C17PacketCustomPayload; //导入依赖的package包/类
/**
* Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
*/
protected void actionPerformed(GuiButton button) throws IOException
{
if (button.enabled)
{
if (button.id == 1)
{
this.localCommandBlock.setTrackOutput(this.field_175389_t);
this.mc.displayGuiScreen((GuiScreen)null);
}
else if (button.id == 0)
{
PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
packetbuffer.writeByte(this.localCommandBlock.func_145751_f());
this.localCommandBlock.func_145757_a(packetbuffer);
packetbuffer.writeString(this.commandTextField.getText());
packetbuffer.writeBoolean(this.localCommandBlock.shouldTrackOutput());
this.mc.getNetHandler().addToSendQueue(new C17PacketCustomPayload("MC|AdvCdm", packetbuffer));
if (!this.localCommandBlock.shouldTrackOutput())
{
this.localCommandBlock.setLastOutput((IChatComponent)null);
}
this.mc.displayGuiScreen((GuiScreen)null);
}
else if (button.id == 4)
{
this.localCommandBlock.setTrackOutput(!this.localCommandBlock.shouldTrackOutput());
this.func_175388_a();
}
}
}
示例10: sendToServer
import net.minecraft.network.play.client.C17PacketCustomPayload; //导入依赖的package包/类
public static void sendToServer(RewiModPacket packet) {
ByteArrayDataOutput output = ByteStreams.newDataOutput();
output.write(packetRegistry.getIdByPacket(packet.getClass()));
packet.write(output);
ByteBuf byteBuf = Unpooled.buffer();
byteBuf.writeBytes(output.toByteArray());
C17PacketCustomPayload p = new C17PacketCustomPayload("RewiMod", new PacketBuffer(byteBuf));
Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(p);
}
示例11: renameItem
import net.minecraft.network.play.client.C17PacketCustomPayload; //导入依赖的package包/类
public void renameItem() {
String s = this.nameField.getText();
Slot slot = this.anvil.getSlot(0);
if (slot != null && slot.getHasStack() && !slot.getStack().hasDisplayName() && s.equals(slot.getStack().getDisplayName())) {
s = "";
}
this.anvil.updateItemName(s);
this.mc.thePlayer.sendQueue.addToSendQueue(new C17PacketCustomPayload("MC|ItemName", (new PacketBuffer(Unpooled.buffer())).writeString(s)));
}
示例12: make
import net.minecraft.network.play.client.C17PacketCustomPayload; //导入依赖的package包/类
private static Packet make(Side side, String channel) {
if (FMLCommonHandler.instance().getSide() == Side.SERVER && side == Side.CLIENT) {
return null;
}
if (side == Side.CLIENT) {
return new C17PacketCustomPayload(channel, new PacketBuffer(Unpooled.buffer(0)));
} else {
return new S3FPacketCustomPayload(channel, new PacketBuffer(Unpooled.buffer(0)));
}
}
示例13: getChannel
import net.minecraft.network.play.client.C17PacketCustomPayload; //导入依赖的package包/类
public String getChannel(Packet packet) {
if (packet instanceof C17PacketCustomPayload) {
C17PacketCustomPayload p = (C17PacketCustomPayload) packet;
return p.getChannelName();
}
return null;
}
示例14: keyTyped
import net.minecraft.network.play.client.C17PacketCustomPayload; //导入依赖的package包/类
@Override
protected void keyTyped(char c, int i)
{
if(itemNameField.textboxKeyTyped(c, i))
{
repairContainer.updateItemName(itemNameField.getText());
mc.thePlayer.sendQueue.addToSendQueue(new C17PacketCustomPayload("MC|ItemName", itemNameField.getText().getBytes()));
}
else {
super.keyTyped(c, i);
}
}
示例15: sendSlotContents
import net.minecraft.network.play.client.C17PacketCustomPayload; //导入依赖的package包/类
@Override
public void sendSlotContents(Container container, int slotID, ItemStack itemstack)
{
if(slotID == 0)
{
itemNameField.setText(itemstack == null ? "" : itemstack.getDisplayName());
itemNameField.setEnabled(itemstack != null);
if(itemstack != null)
{
repairContainer.updateItemName(itemNameField.getText());
mc.thePlayer.sendQueue.addToSendQueue(new C17PacketCustomPayload("MC|ItemName", itemNameField.getText().getBytes(Charsets.UTF_8)));
}
}
}