本文整理汇总了Java中net.minecraft.network.play.client.CPacketHeldItemChange类的典型用法代码示例。如果您正苦于以下问题:Java CPacketHeldItemChange类的具体用法?Java CPacketHeldItemChange怎么用?Java CPacketHeldItemChange使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CPacketHeldItemChange类属于net.minecraft.network.play.client包,在下文中一共展示了CPacketHeldItemChange类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onPacketReceived
import net.minecraft.network.play.client.CPacketHeldItemChange; //导入依赖的package包/类
@SubscribeEvent
public void onPacketReceived(PacketEvent.Incoming.Pre event) {
if (event.getPacket() instanceof SPacketSetSlot && getLocalPlayer() != null) {
int currentSlot = getLocalPlayer().inventory.currentItem;
if (((SPacketSetSlot) event.getPacket()).getSlot() != currentSlot) {
getNetworkManager().sendPacket(new CPacketHeldItemChange(currentSlot)); // set server's slot back to our slot
FastReflection.Methods.KeyBinding_unPress.invoke(MC.gameSettings.keyBindUseItem); // likely will eating so stop right clicking
event.setCanceled(true);
}
}
}
开发者ID:fr1kin,项目名称:ForgeHax,代码行数:14,代码来源:AntiHeldItemChangeMod.java
示例2: processHeldItemChange
import net.minecraft.network.play.client.CPacketHeldItemChange; //导入依赖的package包/类
/**
* Updates which quickbar slot is selected
*/
public void processHeldItemChange(CPacketHeldItemChange packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerWorld());
if (packetIn.getSlotId() >= 0 && packetIn.getSlotId() < InventoryPlayer.getHotbarSize())
{
this.playerEntity.inventory.currentItem = packetIn.getSlotId();
this.playerEntity.markPlayerActive();
}
else
{
LOGGER.warn("{} tried to set an invalid carried item", new Object[] {this.playerEntity.getName()});
}
}
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:18,代码来源:NetHandlerPlayServer.java
示例3: syncCurrentPlayItem
import net.minecraft.network.play.client.CPacketHeldItemChange; //导入依赖的package包/类
/**
* Syncs the current player item with the server
*/
private void syncCurrentPlayItem()
{
//-ZMod-Cheat---------------------------------------------------------
if (!ZHandle.handle("allowItemSync", true)) return;
//--------------------------------------------------------------------
int i = this.mc.player.inventory.currentItem;
if (i != this.currentPlayerItem)
{
this.currentPlayerItem = i;
this.connection.sendPacket(new CPacketHeldItemChange(this.currentPlayerItem));
}
}
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:18,代码来源:PlayerControllerMP.java
示例4: syncCurrentPlayItem
import net.minecraft.network.play.client.CPacketHeldItemChange; //导入依赖的package包/类
/**
* Syncs the current player item with the server
*/
private void syncCurrentPlayItem()
{
int i = this.mc.player.inventory.currentItem;
if (i != this.currentPlayerItem)
{
this.currentPlayerItem = i;
this.connection.sendPacket(new CPacketHeldItemChange(this.currentPlayerItem));
}
}
开发者ID:sudofox,项目名称:Backmemed,代码行数:14,代码来源:PlayerControllerMP.java
示例5: syncCurrentPlayItem
import net.minecraft.network.play.client.CPacketHeldItemChange; //导入依赖的package包/类
/**
* Syncs the current player item with the server
*/
private void syncCurrentPlayItem()
{
int i = this.mc.thePlayer.inventory.currentItem;
if (i != this.currentPlayerItem)
{
this.currentPlayerItem = i;
this.connection.sendPacket(new CPacketHeldItemChange(this.currentPlayerItem));
}
}
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:14,代码来源:PlayerControllerMP.java
示例6: switchToRealItem
import net.minecraft.network.play.client.CPacketHeldItemChange; //导入依赖的package包/类
public void switchToRealItem() {
int realItem = this.mc.player.inventory.currentItem;
if (realItem != this.currentPlayerItem) {
this.connection.sendPacket(new CPacketHeldItemChange(realItem));
}
}
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:7,代码来源:PlayerControllerMP.java
示例7: switchToIdleItem
import net.minecraft.network.play.client.CPacketHeldItemChange; //导入依赖的package包/类
public void switchToIdleItem() {
int realItem = this.mc.player.inventory.currentItem;
if (realItem != this.currentPlayerItem) {
this.connection.sendPacket(new CPacketHeldItemChange(this.currentPlayerItem));
}
}
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:7,代码来源:PlayerControllerMP.java
示例8: processHeldItemChange
import net.minecraft.network.play.client.CPacketHeldItemChange; //导入依赖的package包/类
@Override
public void processHeldItemChange(CPacketHeldItemChange p_147355_1_) {
}
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:4,代码来源:FakeNetHandlerPlayServer.java
示例9: processHeldItemChange
import net.minecraft.network.play.client.CPacketHeldItemChange; //导入依赖的package包/类
@Override
public void processHeldItemChange(@Nonnull CPacketHeldItemChange p_147355_1_) {
}
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:4,代码来源:FakeNetHandlerPlayServer.java
示例10: processHeldItemChange
import net.minecraft.network.play.client.CPacketHeldItemChange; //导入依赖的package包/类
@Override
public void processHeldItemChange(CPacketHeldItemChange packetIn) {
}
开发者ID:p455w0rd,项目名称:DankNull,代码行数:5,代码来源:NetServerHandlerFake.java
示例11: processHeldItemChange
import net.minecraft.network.play.client.CPacketHeldItemChange; //导入依赖的package包/类
/**
* Updates which quickbar slot is selected
*/
void processHeldItemChange(CPacketHeldItemChange packetIn);
开发者ID:sudofox,项目名称:Backmemed,代码行数:5,代码来源:INetHandlerPlayServer.java
注:本文中的net.minecraft.network.play.client.CPacketHeldItemChange类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论