本文整理汇总了Java中net.minecraft.network.play.client.CPacketCreativeInventoryAction类的典型用法代码示例。如果您正苦于以下问题:Java CPacketCreativeInventoryAction类的具体用法?Java CPacketCreativeInventoryAction怎么用?Java CPacketCreativeInventoryAction使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CPacketCreativeInventoryAction类属于net.minecraft.network.play.client包,在下文中一共展示了CPacketCreativeInventoryAction类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: call
import net.minecraft.network.play.client.CPacketCreativeInventoryAction; //导入依赖的package包/类
@Override
public void call(String[] args) throws CmdException
{
if(args.length > 0)
throw new CmdSyntaxError();
// check for creative mode
EntityPlayerSP player = WMinecraft.getPlayer();
if(!player.capabilities.isCreativeMode)
throw new CmdError("Creative mode only.");
// validate item
ItemStack item = player.inventory.getCurrentItem();
if(item == null)
throw new CmdError("You need an item in your hand.");
if(!item.isItemStackDamageable())
throw new CmdError("This item can't take damage.");
if(!item.isItemDamaged())
throw new CmdError("This item is not damaged.");
// repair item
item.setItemDamage(0);
WConnection.sendPacket(new CPacketCreativeInventoryAction(
36 + player.inventory.currentItem, item));
}
示例2: placeStackInHotbar
import net.minecraft.network.play.client.CPacketCreativeInventoryAction; //导入依赖的package包/类
public static boolean placeStackInHotbar(ItemStack stack)
{
for(int i = 0; i < 9; i++)
if(isSlotEmpty(i))
{
WConnection.sendPacket(
new CPacketCreativeInventoryAction(36 + i, stack));
return true;
}
return false;
}
示例3: onUpdate
import net.minecraft.network.play.client.CPacketCreativeInventoryAction; //导入依赖的package包/类
@Override
public void onUpdate()
{
if(infinite)
{
Item item = null;
while(item == null)
item = Item.getItemById(new Random().nextInt(431));
WConnection.sendPacket(new CPacketCreativeInventoryAction(-1,
new ItemStack(item, 64)));
return;
}
if(wurst.special.yesCheatSpf.getProfile().ordinal() >= Profile.OLDER_NCP
.ordinal())
{
timer++;
if(timer >= 5)
{
WPlayerController.windowClick_THROW(counter);
counter++;
timer = 0;
if(counter >= 45)
wurst.events.remove(UpdateListener.class, this);
}
}else
{
for(int i = 9; i < 45; i++)
WPlayerController.windowClick_THROW(i);
wurst.events.remove(UpdateListener.class, this);
}
}
示例4: sendSlotPacket
import net.minecraft.network.play.client.CPacketCreativeInventoryAction; //导入依赖的package包/类
/**
* Used in PlayerControllerMP to update the server with an ItemStack in a slot.
*/
public void sendSlotPacket(ItemStack itemStackIn, int slotId)
{
if (this.currentGameType.isCreative())
{
this.connection.sendPacket(new CPacketCreativeInventoryAction(slotId, itemStackIn));
}
}
示例5: sendPacketDropItem
import net.minecraft.network.play.client.CPacketCreativeInventoryAction; //导入依赖的package包/类
/**
* Sends a Packet107 to the server to drop the item on the ground
*/
public void sendPacketDropItem(ItemStack itemStackIn)
{
if (this.currentGameType.isCreative() && !itemStackIn.func_190926_b())
{
this.connection.sendPacket(new CPacketCreativeInventoryAction(-1, itemStackIn));
}
}
示例6: placeStackInHotbar
import net.minecraft.network.play.client.CPacketCreativeInventoryAction; //导入依赖的package包/类
public static boolean placeStackInHotbar(IItemStack stack) {
for (int i = 0; i < 9; i++)
if (getStackInSlot(i).isEmpty()) {
Minecraft.getMinecraft().player.connection
.sendPacket(new CPacketCreativeInventoryAction(36 + i, stack.getStack()));
return true;
}
return false;
}
示例7: sendPacketDropItem
import net.minecraft.network.play.client.CPacketCreativeInventoryAction; //导入依赖的package包/类
/**
* Sends a Packet107 to the server to drop the item on the ground
*/
public void sendPacketDropItem(ItemStack itemStackIn)
{
if (this.currentGameType.isCreative() && itemStackIn != null)
{
this.connection.sendPacket(new CPacketCreativeInventoryAction(-1, itemStackIn));
}
}
示例8: processCreativeInventoryAction
import net.minecraft.network.play.client.CPacketCreativeInventoryAction; //导入依赖的package包/类
/**
* Update the server with an ItemStack in a slot.
*/
public void processCreativeInventoryAction(CPacketCreativeInventoryAction packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerWorld());
if (this.playerEntity.interactionManager.isCreative())
{
boolean flag = packetIn.getSlotId() < 0;
ItemStack itemstack = packetIn.getStack();
if (!itemstack.func_190926_b() && itemstack.hasTagCompound() && itemstack.getTagCompound().hasKey("BlockEntityTag", 10))
{
NBTTagCompound nbttagcompound = itemstack.getTagCompound().getCompoundTag("BlockEntityTag");
if (nbttagcompound.hasKey("x") && nbttagcompound.hasKey("y") && nbttagcompound.hasKey("z"))
{
BlockPos blockpos = new BlockPos(nbttagcompound.getInteger("x"), nbttagcompound.getInteger("y"), nbttagcompound.getInteger("z"));
TileEntity tileentity = this.playerEntity.world.getTileEntity(blockpos);
if (tileentity != null)
{
NBTTagCompound nbttagcompound1 = tileentity.writeToNBT(new NBTTagCompound());
nbttagcompound1.removeTag("x");
nbttagcompound1.removeTag("y");
nbttagcompound1.removeTag("z");
itemstack.setTagInfo("BlockEntityTag", nbttagcompound1);
}
}
}
boolean flag1 = packetIn.getSlotId() >= 1 && packetIn.getSlotId() <= 45;
boolean flag2 = itemstack.func_190926_b() || itemstack.getMetadata() >= 0 && itemstack.func_190916_E() <= 64 && !itemstack.func_190926_b();
if (flag1 && flag2)
{
if (itemstack.func_190926_b())
{
this.playerEntity.inventoryContainer.putStackInSlot(packetIn.getSlotId(), ItemStack.field_190927_a);
}
else
{
this.playerEntity.inventoryContainer.putStackInSlot(packetIn.getSlotId(), itemstack);
}
this.playerEntity.inventoryContainer.setCanCraft(this.playerEntity, true);
}
else if (flag && flag2 && this.itemDropThreshold < 200)
{
this.itemDropThreshold += 20;
EntityItem entityitem = this.playerEntity.dropItem(itemstack, true);
if (entityitem != null)
{
entityitem.setAgeToCreativeDespawnTime();
}
}
}
}
示例9: processCreativeInventoryAction
import net.minecraft.network.play.client.CPacketCreativeInventoryAction; //导入依赖的package包/类
/**
* Update the server with an ItemStack in a slot.
*/
public void processCreativeInventoryAction(CPacketCreativeInventoryAction packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerWorld());
if (this.playerEntity.interactionManager.isCreative())
{
boolean flag = packetIn.getSlotId() < 0;
ItemStack itemstack = packetIn.getStack();
if (itemstack != null && itemstack.hasTagCompound() && itemstack.getTagCompound().hasKey("BlockEntityTag", 10))
{
NBTTagCompound nbttagcompound = itemstack.getTagCompound().getCompoundTag("BlockEntityTag");
if (nbttagcompound.hasKey("x") && nbttagcompound.hasKey("y") && nbttagcompound.hasKey("z"))
{
BlockPos blockpos = new BlockPos(nbttagcompound.getInteger("x"), nbttagcompound.getInteger("y"), nbttagcompound.getInteger("z"));
TileEntity tileentity = this.playerEntity.worldObj.getTileEntity(blockpos);
if (tileentity != null)
{
NBTTagCompound nbttagcompound1 = tileentity.writeToNBT(new NBTTagCompound());
nbttagcompound1.removeTag("x");
nbttagcompound1.removeTag("y");
nbttagcompound1.removeTag("z");
itemstack.setTagInfo("BlockEntityTag", nbttagcompound1);
}
}
}
boolean flag1 = packetIn.getSlotId() >= 1 && packetIn.getSlotId() <= 45;
boolean flag2 = itemstack == null || itemstack.getItem() != null;
boolean flag3 = itemstack == null || itemstack.getMetadata() >= 0 && itemstack.stackSize <= 64 && itemstack.stackSize > 0;
if (flag1 && flag2 && flag3)
{
if (itemstack == null)
{
this.playerEntity.inventoryContainer.putStackInSlot(packetIn.getSlotId(), (ItemStack)null);
}
else
{
this.playerEntity.inventoryContainer.putStackInSlot(packetIn.getSlotId(), itemstack);
}
this.playerEntity.inventoryContainer.setCanCraft(this.playerEntity, true);
}
else if (flag && flag2 && flag3 && this.itemDropThreshold < 200)
{
this.itemDropThreshold += 20;
EntityItem entityitem = this.playerEntity.dropItem(itemstack, true);
if (entityitem != null)
{
entityitem.setAgeToCreativeDespawnTime();
}
}
}
}
示例10: processCreativeInventoryAction
import net.minecraft.network.play.client.CPacketCreativeInventoryAction; //导入依赖的package包/类
@Override
public void processCreativeInventoryAction(CPacketCreativeInventoryAction p_147344_1_) {
}
示例11: processCreativeInventoryAction
import net.minecraft.network.play.client.CPacketCreativeInventoryAction; //导入依赖的package包/类
@Override
public void processCreativeInventoryAction(@Nonnull CPacketCreativeInventoryAction p_147344_1_) {
}
示例12: processCreativeInventoryAction
import net.minecraft.network.play.client.CPacketCreativeInventoryAction; //导入依赖的package包/类
@Override
public void processCreativeInventoryAction(CPacketCreativeInventoryAction packetIn) {
}
示例13: processCreativeInventoryAction
import net.minecraft.network.play.client.CPacketCreativeInventoryAction; //导入依赖的package包/类
/**
* Update the server with an ItemStack in a slot.
*/
void processCreativeInventoryAction(CPacketCreativeInventoryAction packetIn);