本文整理汇总了Java中net.minecraft.item.Item.getItemFromBlock方法的典型用法代码示例。如果您正苦于以下问题:Java Item.getItemFromBlock方法的具体用法?Java Item.getItemFromBlock怎么用?Java Item.getItemFromBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.item.Item
的用法示例。
在下文中一共展示了Item.getItemFromBlock方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerBlock
import net.minecraft.item.Item; //导入方法依赖的package包/类
/**
* Registers the given block.
* Also adds the respective TileEntity if the block has one.
*
* @param registerItemBlock - {@code true} to also register the block as item.
*/
private static void registerBlock(Block block, boolean registerItemBlock) {//TODO REGISTRY - Register block names with "oft." -prefix to avoid name clash between mods.
/* Determine block's unlocalised name. */
String name = block.getClass().getSimpleName().toLowerCase().substring(5);
/* Register block (and its TileEntity, if existent). */
if (block.getRegistryName() == null) {
GameRegistry.register(block.setRegistryName(name).setUnlocalizedName(name));
if(block instanceof ITileEntityProvider){
Class<? extends TileEntity> tileEntityClass = ((ITileEntityProvider) block).createNewTileEntity(null, 0).getClass();
GameRegistry.registerTileEntity(tileEntityClass, tileEntityClass.getSimpleName());
}
}
/* Register block's item if required. */
if (registerItemBlock && Item.getItemFromBlock(block) == null) {
GameRegistry.register(new ItemBlock(block).setRegistryName(name));
}
}
示例2: createStackedBlock
import net.minecraft.item.Item; //导入方法依赖的package包/类
@Nullable
protected ItemStack createStackedBlock(IBlockState state)
{
Item item = Item.getItemFromBlock(this);
if (item == null)
{
return null;
}
else
{
int i = 0;
if (item.getHasSubtypes())
{
i = this.getMetaFromState(state);
}
return new ItemStack(item, 1, i);
}
}
示例3: func_175422_a
import net.minecraft.item.Item; //导入方法依赖的package包/类
private void func_175422_a(EntityPlayer player, int slot) {
ItemStack itemstack = getEquipmentInSlot(slot);
int j = player.inventory.currentItem;
ItemStack itemstack1 = player.inventory.getStackInSlot(j);
ItemStack itemstack2;
if (player.capabilities.isCreativeMode && (itemstack == null || itemstack.getItem() == Item.getItemFromBlock(Blocks.air)) && itemstack1 != null) {
itemstack2 = itemstack1.copy();
itemstack2.stackSize = 1;
setCurrentItemOrArmor(slot, itemstack2);
} else if (itemstack1 != null && itemstack1.stackSize > 1) {
if (itemstack == null) {
itemstack2 = itemstack1.copy();
itemstack2.stackSize = 1;
setCurrentItemOrArmor(slot, itemstack2);
itemstack1.stackSize--;
}
} else {
setCurrentItemOrArmor(slot, itemstack1);
player.inventory.setInventorySlotContents(j, itemstack);
}
}
示例4: getItemDropped
import net.minecraft.item.Item; //导入方法依赖的package包/类
/**
* Get the Item that this Block should drop when harvested.
*/
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
if (fortune > 3)
{
fortune = 3;
}
return rand.nextInt(10 - fortune * 3) == 0 ? Items.flint : Item.getItemFromBlock(this);
}
示例5: getItemDropped
import net.minecraft.item.Item; //导入方法依赖的package包/类
/**
* Get the Item that this Block should drop when harvested.
*/
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
return Item.getItemFromBlock(Blocks.obsidian);
}
示例6: getItemDropped
import net.minecraft.item.Item; //导入方法依赖的package包/类
/**
* Get the Item that this Block should drop when harvested.
*/
@Nullable
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
return Item.getItemFromBlock(this);
}
示例7: getItemDropped
import net.minecraft.item.Item; //导入方法依赖的package包/类
public Item getItemDropped(int par1, Random random, int par2) {
return Item.getItemFromBlock(TechnicalBlock.WasherIdle);
}
示例8: getItemDropped
import net.minecraft.item.Item; //导入方法依赖的package包/类
/**
* Get the Item that this Block should drop when harvested.
*/
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
return Item.getItemFromBlock(Blocks.DAYLIGHT_DETECTOR);
}
示例9: transferStackInSlot
import net.minecraft.item.Item; //导入方法依赖的package包/类
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int fromId)
{
ItemStack movedStackDupe = null;
Slot slot = (Slot)inventorySlots.get(fromId);
if (slot != null && slot.getHasStack())
{
ItemStack movedStack = slot.getStack();
movedStackDupe = movedStack.copy();
if (fromId == TileEntitySmelter.OUTPUT)
{
if (!mergeItemStack(movedStack, 4, 40, true))
{
return null;
}
slot.onSlotChange(movedStack, movedStackDupe);
}
else if (fromId != TileEntitySmelter.FUEL && fromId != TileEntitySmelter.INPUT &&
fromId != TileEntitySmelter.BOOSTER)
{
if (SmelterRecipeHandler.instance().getSmeltingResult(movedStack) != null)
{
if (!mergeItemStack(movedStack, TileEntitySmelter.INPUT, TileEntitySmelter.INPUT + 1, false))
{
return null;
}
}
else if (movedStack.getItem() == Item.getItemFromBlock(Blocks.GRAVEL))
{
if (!mergeItemStack(movedStack, TileEntitySmelter.BOOSTER, TileEntitySmelter.BOOSTER + 1, false))
{
return null;
}
}
else if (FuelRegistry.getBurnTime(FuelConsumerType.SMELTER, movedStack) > 0)
{
if (!mergeItemStack(movedStack, TileEntitySmelter.FUEL, TileEntitySmelter.FUEL + 1, false))
{
return null;
}
}
else if (fromId >= 4 && fromId < 31)
{
if (!mergeItemStack(movedStack, 31, 40, false))
{
return null;
}
}
else if (fromId >= 31 && fromId < 40 && !mergeItemStack(movedStack, 4, 31, false))
{
return null;
}
}
else if (!mergeItemStack(movedStack, 4, 40, false))
{
return null;
}
if (movedStack.getCount() == 0)
{
slot.putStack(null);
}
else
{
slot.onSlotChanged();
}
if (movedStack.getCount() == movedStackDupe.getCount())
{
return null;
}
slot.onTake(player, movedStack);
}
return movedStackDupe;
}
示例10: getItem
import net.minecraft.item.Item; //导入方法依赖的package包/类
public Item getItem(World world, int par2, int par3, int par4) {
return Item.getItemFromBlock(TechnicalBlock.ElectricFurnaceAdvancedIdle);
}
示例11: createStackedBlock
import net.minecraft.item.Item; //导入方法依赖的package包/类
protected ItemStack createStackedBlock(IBlockState state)
{
return new ItemStack(Item.getItemFromBlock(this), 1, 0);
}
示例12: getItemDropped
import net.minecraft.item.Item; //导入方法依赖的package包/类
/**
* Get the Item that this Block should drop when harvested.
*/
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
return Item.getItemFromBlock(this);
}
示例13: getItemDropped
import net.minecraft.item.Item; //导入方法依赖的package包/类
/**
* Get the Item that this Block should drop when harvested.
*/
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
return Item.getItemFromBlock(Blocks.stone_slab2);
}
示例14: getItemDropped
import net.minecraft.item.Item; //导入方法依赖的package包/类
@Override
public Item getItemDropped(int meta, Random rand, int fortune) {
return Item.getItemFromBlock(this);
}
示例15: getItem
import net.minecraft.item.Item; //导入方法依赖的package包/类
public Item getItem(World world, int par2, int par3, int par4) {
return Item.getItemFromBlock(TechnicalBlock.GrinderMediumIdle);
}