本文整理汇总了Java中net.minecraft.item.Item.getItemById方法的典型用法代码示例。如果您正苦于以下问题:Java Item.getItemById方法的具体用法?Java Item.getItemById怎么用?Java Item.getItemById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.item.Item
的用法示例。
在下文中一共展示了Item.getItemById方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readItemStackFromBuffer
import net.minecraft.item.Item; //导入方法依赖的package包/类
/**
* Reads an ItemStack from this buffer
*/
public ItemStack readItemStackFromBuffer() throws IOException
{
int i = this.readShort();
if (i < 0)
{
return ItemStack.field_190927_a;
}
else
{
int j = this.readByte();
int k = this.readShort();
ItemStack itemstack = new ItemStack(Item.getItemById(i), j, k);
itemstack.setTagCompound(this.readNBTTagCompoundFromBuffer());
return itemstack;
}
}
示例2: setTurretInventory
import net.minecraft.item.Item; //导入方法依赖的package包/类
public static void setTurretInventory(int entityID, int itemID, int itemSlot, int metadata)
{
Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(entityID);
if (entity == null) { return; } // Doesn't exist? Shame.
if (entity instanceof Entity_AA)
{
Entity_AA turret = (Entity_AA) entity;
if (itemSlot >= turret.storage.length) // Received a slot that is higher than what we got, so assuming that this turret has a storage upgrade
{
AI_Properties.applyStorageUpgrade(turret); // Safeguard
}
if (itemID == -1)
{
turret.storage[itemSlot] = null; // Empty
}
else
{
turret.storage[itemSlot] = new ItemStack(Item.getItemById(itemID), 1, metadata); // There ya go. Now the client knows about that too.
}
}
}
示例3: getSearchedStack
import net.minecraft.item.Item; //导入方法依赖的package包/类
@Nonnull
public static ItemStack getSearchedStack(ItemStack helmetStack) {
if (helmetStack.isEmpty() || !NBTUtil.hasTag(helmetStack, "SearchStack")) return ItemStack.EMPTY;
NBTTagCompound tag = NBTUtil.getCompoundTag(helmetStack, "SearchStack");
if (tag.getInteger("itemID") == -1) return ItemStack.EMPTY;
return new ItemStack(Item.getItemById(tag.getInteger("itemID")), 1, tag.getInteger("itemDamage"));
}
示例4: readFromNBT
import net.minecraft.item.Item; //导入方法依赖的package包/类
public void readFromNBT(NBTTagCompound compound)
{
super.readFromNBT(compound);
if (compound.hasKey("Item", 8))
{
this.flowerPotItem = Item.getByNameOrId(compound.getString("Item"));
}
else
{
this.flowerPotItem = Item.getItemById(compound.getInteger("Item"));
}
this.flowerPotData = compound.getInteger("Data");
}
示例5: handleSpawnPlayer
import net.minecraft.item.Item; //导入方法依赖的package包/类
/**
* Handles the creation of a nearby player entity, sets the position and held item
*/
public void handleSpawnPlayer(S0CPacketSpawnPlayer packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
double d0 = (double)packetIn.getX() / 32.0D;
double d1 = (double)packetIn.getY() / 32.0D;
double d2 = (double)packetIn.getZ() / 32.0D;
float f = (float)(packetIn.getYaw() * 360) / 256.0F;
float f1 = (float)(packetIn.getPitch() * 360) / 256.0F;
EntityOtherPlayerMP entityotherplayermp = new EntityOtherPlayerMP(this.gameController.theWorld, this.getPlayerInfo(packetIn.getPlayer()).getGameProfile());
entityotherplayermp.prevPosX = entityotherplayermp.lastTickPosX = (double)(entityotherplayermp.serverPosX = packetIn.getX());
entityotherplayermp.prevPosY = entityotherplayermp.lastTickPosY = (double)(entityotherplayermp.serverPosY = packetIn.getY());
entityotherplayermp.prevPosZ = entityotherplayermp.lastTickPosZ = (double)(entityotherplayermp.serverPosZ = packetIn.getZ());
int i = packetIn.getCurrentItemID();
if (i == 0)
{
entityotherplayermp.inventory.mainInventory[entityotherplayermp.inventory.currentItem] = null;
}
else
{
entityotherplayermp.inventory.mainInventory[entityotherplayermp.inventory.currentItem] = new ItemStack(Item.getItemById(i), 1, 0);
}
entityotherplayermp.setPositionAndRotation(d0, d1, d2, f, f1);
this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entityotherplayermp);
List<DataWatcher.WatchableObject> list = packetIn.func_148944_c();
if (list != null)
{
entityotherplayermp.getDataWatcher().updateWatchedObjectsFromList(list);
}
}
示例6: getDropItem
import net.minecraft.item.Item; //导入方法依赖的package包/类
protected Item getDropItem()
{
return Item.getItemById(-1);
}
示例7: readPacketData
import net.minecraft.item.Item; //导入方法依赖的package包/类
/**
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer buf) throws IOException
{
this.item = Item.getItemById(buf.readVarIntFromBuffer());
this.ticks = buf.readVarIntFromBuffer();
}
示例8: getModelTextures
import net.minecraft.item.Item; //导入方法依赖的package包/类
private String[] getModelTextures()
{
if (this.type == 1 && this.items.length == 1)
{
Item item = Item.getItemById(this.items[0]);
if (item == Items.potionitem && this.damage != null && this.damage.getCountRanges() > 0)
{
RangeInt rangeint = this.damage.getRange(0);
int i = rangeint.getMin();
boolean flag = (i & 16384) != 0;
String s5 = this.getMapTexture(this.mapTextures, "texture.potion_overlay", "items/potion_overlay");
String s6 = null;
if (flag)
{
s6 = this.getMapTexture(this.mapTextures, "texture.potion_bottle_splash", "items/potion_bottle_splash");
}
else
{
s6 = this.getMapTexture(this.mapTextures, "texture.potion_bottle_drinkable", "items/potion_bottle_drinkable");
}
return new String[] {s5, s6};
}
if (item instanceof ItemArmor)
{
ItemArmor itemarmor = (ItemArmor)item;
if (itemarmor.getArmorMaterial() == ItemArmor.ArmorMaterial.LEATHER)
{
String s = "leather";
String s1 = "helmet";
if (itemarmor.armorType == 0)
{
s1 = "helmet";
}
if (itemarmor.armorType == 1)
{
s1 = "chestplate";
}
if (itemarmor.armorType == 2)
{
s1 = "leggings";
}
if (itemarmor.armorType == 3)
{
s1 = "boots";
}
String s2 = s + "_" + s1;
String s3 = this.getMapTexture(this.mapTextures, "texture." + s2, "items/" + s2);
String s4 = this.getMapTexture(this.mapTextures, "texture." + s2 + "_overlay", "items/" + s2 + "_overlay");
return new String[] {s3, s4};
}
}
}
return new String[] {this.texture};
}
示例9: getEntityFX
import net.minecraft.item.Item; //导入方法依赖的package包/类
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
int i = p_178902_15_.length > 1 ? p_178902_15_[1] : 0;
return new EntityBreakingFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, Item.getItemById(p_178902_15_[0]), i);
}
示例10: getModelTextures
import net.minecraft.item.Item; //导入方法依赖的package包/类
private String[] getModelTextures()
{
if (this.type == 1 && this.items.length == 1)
{
Item item = Item.getItemById(this.items[0]);
boolean flag = item == Items.POTIONITEM || item == Items.SPLASH_POTION || item == Items.LINGERING_POTION;
if (flag && this.damage != null && this.damage.getCountRanges() > 0)
{
RangeInt rangeint = this.damage.getRange(0);
int i = rangeint.getMin();
boolean flag1 = (i & 16384) != 0;
String s5 = this.getMapTexture(this.mapTextures, "texture.potion_overlay", "items/potion_overlay");
String s6 = null;
if (flag1)
{
s6 = this.getMapTexture(this.mapTextures, "texture.potion_bottle_splash", "items/potion_bottle_splash");
}
else
{
s6 = this.getMapTexture(this.mapTextures, "texture.potion_bottle_drinkable", "items/potion_bottle_drinkable");
}
return new String[] {s5, s6};
}
if (item instanceof ItemArmor)
{
ItemArmor itemarmor = (ItemArmor)item;
if (itemarmor.getArmorMaterial() == ItemArmor.ArmorMaterial.LEATHER)
{
String s = "leather";
String s1 = "helmet";
if (itemarmor.armorType == EntityEquipmentSlot.HEAD)
{
s1 = "helmet";
}
if (itemarmor.armorType == EntityEquipmentSlot.CHEST)
{
s1 = "chestplate";
}
if (itemarmor.armorType == EntityEquipmentSlot.LEGS)
{
s1 = "leggings";
}
if (itemarmor.armorType == EntityEquipmentSlot.FEET)
{
s1 = "boots";
}
String s2 = s + "_" + s1;
String s3 = this.getMapTexture(this.mapTextures, "texture." + s2, "items/" + s2);
String s4 = this.getMapTexture(this.mapTextures, "texture." + s2 + "_overlay", "items/" + s2 + "_overlay");
return new String[] {s3, s4};
}
}
}
return new String[] {this.texture};
}
示例11: createParticle
import net.minecraft.item.Item; //导入方法依赖的package包/类
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
int i = p_178902_15_.length > 1 ? p_178902_15_[1] : 0;
return new ParticleBreaking(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, Item.getItemById(p_178902_15_[0]), i);
}
示例12: getItem
import net.minecraft.item.Item; //导入方法依赖的package包/类
public static Item getItem(int id) {
//return Item.itemsList[id]; // < 1.8
return Item.getItemById(id);
}
示例13: cloneWithoutEffects
import net.minecraft.item.Item; //导入方法依赖的package包/类
public static IItemStack cloneWithoutEffects(IItemStack stack) {
return new IItemStack(new ItemStack(Item.getItemById(Item.getIdFromItem(stack.getStack().getItem())),
stack.getStack().stackSize));
}