• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java S3FPacketCustomPayload类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中net.minecraft.network.play.server.S3FPacketCustomPayload的典型用法代码示例。如果您正苦于以下问题:Java S3FPacketCustomPayload类的具体用法?Java S3FPacketCustomPayload怎么用?Java S3FPacketCustomPayload使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



S3FPacketCustomPayload类属于net.minecraft.network.play.server包,在下文中一共展示了S3FPacketCustomPayload类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: displayVillagerTradeGui

import net.minecraft.network.play.server.S3FPacketCustomPayload; //导入依赖的package包/类
public void displayVillagerTradeGui(IMerchant villager)
{
    this.getNextWindowId();
    this.openContainer = new ContainerMerchant(this.inventory, villager, this.worldObj);
    this.openContainer.windowId = this.currentWindowId;
    this.openContainer.onCraftGuiOpened(this);
    IInventory iinventory = ((ContainerMerchant)this.openContainer).getMerchantInventory();
    IChatComponent ichatcomponent = villager.getDisplayName();
    this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, "minecraft:villager", ichatcomponent, iinventory.getSizeInventory()));
    MerchantRecipeList merchantrecipelist = villager.getRecipes(this);

    if (merchantrecipelist != null)
    {
        PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
        packetbuffer.writeInt(this.currentWindowId);
        merchantrecipelist.writeToBuf(packetbuffer);
        this.playerNetServerHandler.sendPacket(new S3FPacketCustomPayload("MC|TrList", packetbuffer));
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:20,代码来源:EntityPlayerMP.java


示例2: channelRead0

import net.minecraft.network.play.server.S3FPacketCustomPayload; //导入依赖的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);
    }
}
 
开发者ID:SchrodingersSpy,项目名称:TRHS_Club_Mod_2016,代码行数:22,代码来源:NetworkDispatcher.java


示例3: displayGUIMerchant

import net.minecraft.network.play.server.S3FPacketCustomPayload; //导入依赖的package包/类
public void displayGUIMerchant(IMerchant par1IMerchant, String par2Str)
{
    this.getNextWindowId();
    this.openContainer = new ContainerMerchant(this.inventory, par1IMerchant, this.worldObj);
    this.openContainer.windowId = this.currentWindowId;
    this.openContainer.addCraftingToCrafters(this);
    InventoryMerchant var3 = ((ContainerMerchant)this.openContainer).getMerchantInventory();
    this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, 6, par2Str == null ? "" : par2Str, var3.getSizeInventory(), par2Str != null));
    MerchantRecipeList var4 = par1IMerchant.getRecipes(this);

    if (var4 != null)
    {
        try
        {
            PacketBuffer var5 = new PacketBuffer(Unpooled.buffer());
            var5.writeInt(this.currentWindowId);
            var4.func_151391_a(var5);
            this.playerNetServerHandler.sendPacket(new S3FPacketCustomPayload("MC|TrList", var5));
        }
        catch (IOException var6)
        {
            logger.error("Couldn\'t send trade list", var6);
        }
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:26,代码来源:EntityPlayerMP.java


示例4: sendNameUpdate

import net.minecraft.network.play.server.S3FPacketCustomPayload; //导入依赖的package包/类
public void sendNameUpdate() {
	String name = this.dataWatcher.getWatchableObjectString(19);
	if (owner != null && name != null) {
		EntityPlayer o = (EntityPlayer) this.worldObj.getPlayerEntityByName(owner);
		if (o != null) {
			PacketBuffer pb = new PacketBuffer(Unpooled.buffer());
			try {
				pb.writeInt(1);
				pb.writeInt(name.getBytes().length);
				pb.writeBytes(name.getBytes());
			} catch (Exception ex) {
				ex.printStackTrace();
			}

			S3FPacketCustomPayload packet = new S3FPacketCustomPayload("AvatarFam", pb);
			
			((EntityPlayerMP) o).playerNetServerHandler.sendPacket(packet);
		}
	}
}
 
开发者ID:kieranvs,项目名称:Blockbender,代码行数:21,代码来源:EntityFamiliar.java


示例5: sendDeathUpdate

import net.minecraft.network.play.server.S3FPacketCustomPayload; //导入依赖的package包/类
public void sendDeathUpdate() {
	if (owner != null) {
		EntityPlayer o = (EntityPlayer) this.worldObj.getPlayerEntityByName(owner);
		if (o != null) {
			PacketBuffer pb = new PacketBuffer(Unpooled.buffer());
			try {
				pb.writeInt(4);
			} catch (Exception ex) {
				ex.printStackTrace();
			}

			S3FPacketCustomPayload packet = new S3FPacketCustomPayload("AvatarFam", pb);
			
			((EntityPlayerMP) o).playerNetServerHandler.sendPacket(packet);
		}

	}
}
 
开发者ID:kieranvs,项目名称:Blockbender,代码行数:19,代码来源:EntityFamiliar.java


示例6: sendHealthUpdate

import net.minecraft.network.play.server.S3FPacketCustomPayload; //导入依赖的package包/类
public void sendHealthUpdate() {
	if (owner != null) {
		EntityPlayer o = (EntityPlayer) this.worldObj.getPlayerEntityByName(owner);
		if (o != null) {
			PacketBuffer pb = new PacketBuffer(Unpooled.buffer());
			try {
				pb.writeInt(2);
				pb.writeInt((int) this.getHealth());
			} catch (Exception ex) {
				ex.printStackTrace();
			}

			S3FPacketCustomPayload packet = new S3FPacketCustomPayload("AvatarFam", pb);
			
			((EntityPlayerMP) o).playerNetServerHandler.sendPacket(packet);
			
			this.healthlastsent = (int) this.getHealth();
		}
	}
}
 
开发者ID:kieranvs,项目名称:Blockbender,代码行数:21,代码来源:EntityFamiliar.java


示例7: sendMoodUpdate

import net.minecraft.network.play.server.S3FPacketCustomPayload; //导入依赖的package包/类
public void sendMoodUpdate() {
	if (owner != null) {
		EntityPlayer o = (EntityPlayer) this.worldObj.getPlayerEntityByName(owner);
		if (o != null) {
			PacketBuffer pb = new PacketBuffer(Unpooled.buffer());
			try {
				pb.writeInt(3);
				pb.writeInt(this.mood);
			} catch (Exception ex) {
				ex.printStackTrace();
			}

			S3FPacketCustomPayload packet = new S3FPacketCustomPayload("AvatarFam", pb);
			
			((EntityPlayerMP) o).playerNetServerHandler.sendPacket(packet);
			
			this.moodlastsent = this.mood;
		}
		
		
	}
}
 
开发者ID:kieranvs,项目名称:Blockbender,代码行数:23,代码来源:EntityFamiliar.java


示例8: syncGlidingSERVER

import net.minecraft.network.play.server.S3FPacketCustomPayload; //导入依赖的package包/类
public void syncGlidingSERVER(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();
	}

	S3FPacketCustomPayload packet = new S3FPacketCustomPayload("AvatarMisc", pb);
	
	MinecraftServer.getServer().getConfigurationManager().sendPacketToAllPlayers(packet);
}
 
开发者ID:kieranvs,项目名称:Blockbender,代码行数:17,代码来源:Data.java


示例9: spawnParticle

import net.minecraft.network.play.server.S3FPacketCustomPayload; //导入依赖的package包/类
public static void spawnParticle(String particle, World w, double x, double y, double z, int total, double size) {

		PacketBuffer pb = new PacketBuffer(Unpooled.buffer());
		try {
			pb.writeInt(particle.getBytes().length);
			pb.writeBytes(particle.getBytes());
			pb.writeDouble(x);
			pb.writeDouble(y);
			pb.writeDouble(z);
			pb.writeInt(total);
			pb.writeDouble(size);
		} catch (Exception ex) {
			ex.printStackTrace();
		}

		S3FPacketCustomPayload packet = new S3FPacketCustomPayload("AvatarPar", pb);
		
		MinecraftServer.getServer().getConfigurationManager().sendPacketToAllPlayers(packet);

	}
 
开发者ID:kieranvs,项目名称:Blockbender,代码行数:21,代码来源:PacketSender.java


示例10: sendShield

import net.minecraft.network.play.server.S3FPacketCustomPayload; //导入依赖的package包/类
/**
 * 
 * @param location - where the shield will spawn around
 * @param height - of the shield
 * @param radius - of the shield
 * @param yquality - Y axis quality, don't mess with please. Higher is better quality.
 * @param xzquality - XZ axis quality, feel free to experiment. It is the number of degrees between particle spawns in the circle. Lower is better quality. 6 is a good value.
 * @param chance - The chance of particles spawning, feel free to experiment. eg 10 is one tenth. Lower is better quality. 10 is a good value.
 * @param element - Element of the shield (water, air or fire)
 */
public static void sendShield(Location location, int height, int radius, int yquality, int xzquality, int chance, int element){
	PacketBuffer pb = new PacketBuffer(Unpooled.buffer());
	try {
		pb.writeInt("Avatar_shield".getBytes().length);
		pb.writeBytes("Avatar_shield".getBytes());
		pb.writeDouble(location.getX());
		pb.writeDouble(location.getY());
		pb.writeDouble(location.getZ());
		pb.writeInt(0);
		pb.writeDouble(0);
		pb.writeInt(height);
		pb.writeInt(radius);
		pb.writeInt(yquality); 
		pb.writeInt(xzquality); 
		pb.writeInt(chance); 
		pb.writeInt(element);
	} catch (Exception ex) {
		ex.printStackTrace();
	}

	S3FPacketCustomPayload packet = new S3FPacketCustomPayload("AvatarPar", pb);

	MinecraftServer.getServer().getConfigurationManager().sendPacketToAllPlayers(packet);	
}
 
开发者ID:kieranvs,项目名称:Blockbender,代码行数:35,代码来源:PacketSender.java


示例11: sendCircle

import net.minecraft.network.play.server.S3FPacketCustomPayload; //导入依赖的package包/类
public static void sendCircle(Location location, double radius, int xzquality, int chance, int element){
	PacketBuffer pb = new PacketBuffer(Unpooled.buffer());
	try {
		pb.writeInt("Avatar_circle".getBytes().length);
		pb.writeBytes("Avatar_circle".getBytes());
		pb.writeDouble(location.getX());
		pb.writeDouble(location.getY());
		pb.writeDouble(location.getZ());
		pb.writeInt(0);
		pb.writeDouble(0);
		pb.writeDouble(radius);
		pb.writeInt(xzquality); //XZ axis quality, feel free to experiment. It is the number of degrees between particle spawns in the circle. Lower is better quality. 6 is a good value.
		pb.writeInt(chance); //The chance of particles spawning, feel free to experiment. eg 10 is one tenth. Lower is better quality. 10 is a good value.
		pb.writeInt(element); //Element
	} catch (Exception ex) {
		ex.printStackTrace();
	}

	S3FPacketCustomPayload packet = new S3FPacketCustomPayload("AvatarPar", pb);

	MinecraftServer.getServer().getConfigurationManager().sendPacketToAllPlayers(packet);	
}
 
开发者ID:kieranvs,项目名称:Blockbender,代码行数:23,代码来源:PacketSender.java


示例12: sendDisc

import net.minecraft.network.play.server.S3FPacketCustomPayload; //导入依赖的package包/类
public static void sendDisc(Location location, int radius, int xzquality, int chance, int element){
	PacketBuffer pb = new PacketBuffer(Unpooled.buffer());
	try {
		pb.writeInt("Avatar_disc".getBytes().length);
		pb.writeBytes("Avatar_disc".getBytes());
		pb.writeDouble(location.getX());
		pb.writeDouble(location.getY());
		pb.writeDouble(location.getZ());
		pb.writeInt(0);
		pb.writeDouble(0);
		pb.writeInt(radius);
		pb.writeInt(xzquality); //XZ axis quality, feel free to experiment. It is the number of degrees between particle spawns in the circle. Lower is better quality. 6 is a good value.
		pb.writeInt(chance); //The chance of particles spawning, feel free to experiment. eg 10 is one tenth. Lower is better quality. 10 is a good value.
		pb.writeInt(element); //Element
	} catch (Exception ex) {
		ex.printStackTrace();
	}

	S3FPacketCustomPayload packet = new S3FPacketCustomPayload("AvatarPar", pb);

	MinecraftServer.getServer().getConfigurationManager().sendPacketToAllPlayers(packet);	
}
 
开发者ID:kieranvs,项目名称:Blockbender,代码行数:23,代码来源:PacketSender.java


示例13: sendVelocity

import net.minecraft.network.play.server.S3FPacketCustomPayload; //导入依赖的package包/类
public static void sendVelocity(Entity entity, double x, double y, double z) {

		PacketBuffer pb = new PacketBuffer(Unpooled.buffer());
		try {
			pb.writeInt("velocity".getBytes().length);
			pb.writeBytes("velocity".getBytes());
			pb.writeInt(entity.getEntityId());
			pb.writeDouble(x);
			pb.writeDouble(y);
			pb.writeDouble(z);
		} catch (Exception ex) {
			ex.printStackTrace();
		}

		S3FPacketCustomPayload packet = new S3FPacketCustomPayload("AvatarMisc", pb);

		MinecraftServer.getServer().getConfigurationManager().sendPacketToAllPlayers(packet);		

		entity.motionX = x;
		entity.motionY = y;
		entity.motionZ = z;
	}
 
开发者ID:kieranvs,项目名称:Blockbender,代码行数:23,代码来源:PacketSender.java


示例14: sendIsBending

import net.minecraft.network.play.server.S3FPacketCustomPayload; //导入依赖的package包/类
public static void sendIsBending(Entity entity, boolean isBending, int element) {
	
	PacketBuffer pb = new PacketBuffer(Unpooled.buffer());
	try {
		pb.writeInt("isBending".getBytes().length);
		pb.writeBytes("isBending".getBytes());
		pb.writeBoolean(isBending);
		pb.writeInt(entity.getEntityId());
		pb.writeInt(element);
	} catch (Exception ex) {
		ex.printStackTrace();
	}

	S3FPacketCustomPayload packet = new S3FPacketCustomPayload("AvatarMisc", pb);

	MinecraftServer.getServer().getConfigurationManager().sendPacketToAllPlayers(packet);
	
}
 
开发者ID:kieranvs,项目名称:Blockbender,代码行数:19,代码来源:PacketSender.java


示例15: sendSupportedChannels

import net.minecraft.network.play.server.S3FPacketCustomPayload; //导入依赖的package包/类
public void sendSupportedChannels(){
    if(netHandler == null){
        return;
    }
    Set<String> listening = NailedPlatform.instance().getMessenger().getIncomingChannels();
    if(!listening.isEmpty()){
        ByteArrayOutputStream stream = new ByteArrayOutputStream();
        for (String channel : listening) {
            try{
                stream.write(channel.getBytes(CharsetUtil.UTF_8));
                stream.write((byte) 0);
            }catch(IOException e){
                logger.error("Could not send Plugin Channel REGISTER to " + getName(), e);
            }
        }
        sendPacket(new S3FPacketCustomPayload("REGISTER", Unpooled.copiedBuffer(stream.toByteArray())));
    }
}
 
开发者ID:nailed,项目名称:nailed,代码行数:19,代码来源:NailedPlayer.java


示例16: displayGUIBook

import net.minecraft.network.play.server.S3FPacketCustomPayload; //导入依赖的package包/类
/**
 * Displays the GUI for interacting with a book.
 */
public void displayGUIBook(ItemStack bookStack)
{
    Item item = bookStack.getItem();

    if (item == Items.written_book)
    {
        this.playerNetServerHandler.sendPacket(new S3FPacketCustomPayload("MC|BOpen", new PacketBuffer(Unpooled.buffer())));
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:13,代码来源:EntityPlayerMP.java


示例17: handleCustomPayload

import net.minecraft.network.play.server.S3FPacketCustomPayload; //导入依赖的package包/类
/**
 * Handles packets that have room for a channel specification. Vanilla
 * implemented channels are "MC|TrList" to acquire a MerchantRecipeList trades
 * for a villager merchant, "MC|Brand" which sets the server brand? on the
 * player instance and finally "MC|RPack" which the server uses to communicate
 * the identifier of the default server resourcepack for the client to load.
 */
public void handleCustomPayload(S3FPacketCustomPayload packetIn) {
	PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

	if ("MC|TrList".equals(packetIn.getChannelName())) {
		PacketBuffer packetbuffer = packetIn.getBufferData();

		try {
			int i = packetbuffer.readInt();
			GuiScreen guiscreen = this.gameController.currentScreen;

			if (guiscreen != null && guiscreen instanceof GuiMerchant
					&& i == this.gameController.thePlayer.openContainer.windowId) {
				IMerchant imerchant = ((GuiMerchant) guiscreen).getMerchant();
				MerchantRecipeList merchantrecipelist = MerchantRecipeList.readFromBuf(packetbuffer);
				imerchant.setRecipes(merchantrecipelist);
			}
		} catch (IOException ioexception) {
			logger.error((String) "Couldn\'t load trade info", (Throwable) ioexception);
		} finally {
			packetbuffer.release();
		}
	} else if ("MC|Brand".equals(packetIn.getChannelName())) {
		this.gameController.thePlayer.setClientBrand(packetIn.getBufferData().readStringFromBuffer(32767));
	} else if ("MC|BOpen".equals(packetIn.getChannelName())) {
		ItemStack itemstack = this.gameController.thePlayer.getCurrentEquippedItem();

		if (itemstack != null && itemstack.getItem() == Items.written_book) {
			this.gameController
					.displayGuiScreen(new GuiScreenBook(this.gameController.thePlayer, itemstack, false));
		}
	}
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:40,代码来源:NetHandlerPlayClient.java


示例18: make

import net.minecraft.network.play.server.S3FPacketCustomPayload; //导入依赖的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)));
    }
}
 
开发者ID:purpleposeidon,项目名称:Factorization,代码行数:11,代码来源:PacketJunction.java


示例19: getChannel

import net.minecraft.network.play.server.S3FPacketCustomPayload; //导入依赖的package包/类
@Override
public String getChannel(Packet packet) {
    if (packet instanceof S3FPacketCustomPayload) {
        S3FPacketCustomPayload p = (S3FPacketCustomPayload) packet;
        return p.getChannelName();
    }
    return super.getChannel(packet);
}
 
开发者ID:purpleposeidon,项目名称:Factorization,代码行数:9,代码来源:HammerClientProxy.java


示例20: dispatchCUIEvent

import net.minecraft.network.play.server.S3FPacketCustomPayload; //导入依赖的package包/类
@Override
public void dispatchCUIEvent(CUIEvent event) {
    String[] params = event.getParameters();
    String send = event.getTypeId();
    if (params.length > 0) {
        send = send + "|" + StringUtil.joinString(params, "|");
    }
    PacketBuffer buffer = new PacketBuffer(Unpooled.copiedBuffer(send.getBytes(WECUIPacketHandler.UTF_8_CHARSET)));
    S3FPacketCustomPayload packet = new S3FPacketCustomPayload(ForgeWorldEdit.CUI_PLUGIN_CHANNEL, buffer);
    this.player.playerNetServerHandler.sendPacket(packet);
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:12,代码来源:ForgePlayer.java



注:本文中的net.minecraft.network.play.server.S3FPacketCustomPayload类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ExpressionStmt类代码示例发布时间:2022-05-21
下一篇:
Java Cow类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap