本文整理汇总了Java中net.minecraft.block.Block.getBlockFromName方法的典型用法代码示例。如果您正苦于以下问题:Java Block.getBlockFromName方法的具体用法?Java Block.getBlockFromName怎么用?Java Block.getBlockFromName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.block.Block
的用法示例。
在下文中一共展示了Block.getBlockFromName方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseParameters
import net.minecraft.block.Block; //导入方法依赖的package包/类
@Override
public boolean parseParameters(Object params)
{
if (params == null || !(params instanceof AgentQuitFromTouchingBlockType))
return false;
this.params = (AgentQuitFromTouchingBlockType)params;
// Flatten all the possible block type names for ease of matching later:
this.blockTypeNames = new ArrayList<String>();
for (BlockSpec bs : this.params.getBlock())
{
for (BlockType bt : bs.getType())
{
Block b = Block.getBlockFromName(bt.value());
this.blockTypeNames.add(b.getUnlocalizedName().toLowerCase());
}
}
return true;
}
示例2: readEntityFromNBT
import net.minecraft.block.Block; //导入方法依赖的package包/类
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
public void readEntityFromNBT(NBTTagCompound tagCompund)
{
this.xTile = tagCompund.getShort("xTile");
this.yTile = tagCompund.getShort("yTile");
this.zTile = tagCompund.getShort("zTile");
this.ticksInGround = tagCompund.getShort("life");
if (tagCompund.hasKey("inTile", 8))
{
this.inTile = Block.getBlockFromName(tagCompund.getString("inTile"));
}
else
{
this.inTile = Block.getBlockById(tagCompund.getByte("inTile") & 255);
}
this.inData = tagCompund.getByte("inData") & 255;
this.arrowShake = tagCompund.getByte("shake") & 255;
this.inGround = tagCompund.getByte("inGround") == 1;
if (tagCompund.hasKey("damage", 99))
{
this.damage = tagCompund.getDouble("damage");
}
if (tagCompund.hasKey("pickup", 99))
{
this.canBePickedUp = tagCompund.getByte("pickup");
}
else if (tagCompund.hasKey("player", 99))
{
this.canBePickedUp = tagCompund.getBoolean("player") ? 1 : 0;
}
}
示例3: findNameMatch
import net.minecraft.block.Block; //导入方法依赖的package包/类
private boolean findNameMatch(BlockSpec blockspec, String blockName)
{
for (BlockType bt : blockspec.getType())
{
Block b = Block.getBlockFromName(bt.value());
if (b.getUnlocalizedName().equalsIgnoreCase(blockName))
return true;
}
return false;
}
示例4: fromUniqueName
import net.minecraft.block.Block; //导入方法依赖的package包/类
public static BlockData fromUniqueName(String uniqueName) throws BlockDoesNotExistException, BadBlockEntryFormatException {
String[] split = uniqueName.split("::");
if(split.length < 1) throw new BadBlockEntryFormatException();
String name = split[0];
int meta = SafeConverter.toInteger(split.length > 1 ? split[1] : -1, -1);
Block block = Block.getBlockFromName(name);
if(block == null) throw new BlockDoesNotExistException(uniqueName + " is not a valid block");
BlockData data = new BlockData();
data.block = block;
data.meta = meta;
return data;
}
示例5: BlockMatcher
import net.minecraft.block.Block; //导入方法依赖的package包/类
BlockMatcher(BlockSpecWithRewardAndBehaviour spec) {
this.spec = spec;
// Get the allowed blocks:
// (Convert from the enum name to the unlocalised name.)
this.allowedBlockNames = new ArrayList<String>();
List<BlockType> allowedTypes = spec.getType();
if (allowedTypes != null) {
for (BlockType bt : allowedTypes) {
Block b = Block.getBlockFromName(bt.value());
this.allowedBlockNames.add(b.getUnlocalizedName());
}
}
}
示例6: canPlaceOn
import net.minecraft.block.Block; //导入方法依赖的package包/类
public boolean canPlaceOn(Block blockIn)
{
if (blockIn == this.canPlaceOnCacheBlock)
{
return this.canPlaceOnCacheResult;
}
else
{
this.canPlaceOnCacheBlock = blockIn;
if (this.hasTagCompound() && this.stackTagCompound.hasKey("CanPlaceOn", 9))
{
NBTTagList nbttaglist = this.stackTagCompound.getTagList("CanPlaceOn", 8);
for (int i = 0; i < nbttaglist.tagCount(); ++i)
{
Block block = Block.getBlockFromName(nbttaglist.getStringTagAt(i));
if (block == blockIn)
{
this.canPlaceOnCacheResult = true;
return true;
}
}
}
this.canPlaceOnCacheResult = false;
return false;
}
}
示例7: readEntityFromNBT
import net.minecraft.block.Block; //导入方法依赖的package包/类
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
public void readEntityFromNBT(NBTTagCompound tagCompund)
{
this.xTile = tagCompund.getShort("xTile");
this.yTile = tagCompund.getShort("yTile");
this.zTile = tagCompund.getShort("zTile");
if (tagCompund.hasKey("inTile", 8))
{
this.inTile = Block.getBlockFromName(tagCompund.getString("inTile"));
}
else
{
this.inTile = Block.getBlockById(tagCompund.getByte("inTile") & 255);
}
this.inGround = tagCompund.getByte("inGround") == 1;
if (tagCompund.hasKey("direction", 9))
{
NBTTagList nbttaglist = tagCompund.getTagList("direction", 6);
this.motionX = nbttaglist.getDoubleAt(0);
this.motionY = nbttaglist.getDoubleAt(1);
this.motionZ = nbttaglist.getDoubleAt(2);
}
else
{
this.setDead();
}
}
示例8: readEntityFromNBT
import net.minecraft.block.Block; //导入方法依赖的package包/类
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
public void readEntityFromNBT(NBTTagCompound tagCompund)
{
this.xTile = tagCompund.getShort("xTile");
this.yTile = tagCompund.getShort("yTile");
this.zTile = tagCompund.getShort("zTile");
if (tagCompund.hasKey("inTile", 8))
{
this.inTile = Block.getBlockFromName(tagCompund.getString("inTile"));
}
else
{
this.inTile = Block.getBlockById(tagCompund.getByte("inTile") & 255);
}
this.throwableShake = tagCompund.getByte("shake") & 255;
this.inGround = tagCompund.getByte("inGround") == 1;
this.thrower = null;
this.throwerName = tagCompund.getString("ownerName");
if (this.throwerName != null && this.throwerName.length() == 0)
{
this.throwerName = null;
}
this.thrower = this.getThrower();
}
示例9: canDestroy
import net.minecraft.block.Block; //导入方法依赖的package包/类
public boolean canDestroy(Block blockIn)
{
if (blockIn == this.canDestroyCacheBlock)
{
return this.canDestroyCacheResult;
}
else
{
this.canDestroyCacheBlock = blockIn;
if (this.hasTagCompound() && this.stackTagCompound.hasKey("CanDestroy", 9))
{
NBTTagList nbttaglist = this.stackTagCompound.getTagList("CanDestroy", 8);
for (int i = 0; i < nbttaglist.tagCount(); ++i)
{
Block block = Block.getBlockFromName(nbttaglist.getStringTagAt(i));
if (block == blockIn)
{
this.canDestroyCacheResult = true;
return true;
}
}
}
this.canDestroyCacheResult = false;
return false;
}
}
示例10: readEntityFromNBT
import net.minecraft.block.Block; //导入方法依赖的package包/类
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
public void readEntityFromNBT(NBTTagCompound compound)
{
this.xTile = compound.getInteger("xTile");
this.yTile = compound.getInteger("yTile");
this.zTile = compound.getInteger("zTile");
if (compound.hasKey("inTile", 8))
{
this.inTile = Block.getBlockFromName(compound.getString("inTile"));
}
else
{
this.inTile = Block.getBlockById(compound.getByte("inTile") & 255);
}
this.throwableShake = compound.getByte("shake") & 255;
this.inGround = compound.getByte("inGround") == 1;
this.thrower = null;
this.throwerName = compound.getString("ownerName");
if (this.throwerName != null && this.throwerName.isEmpty())
{
this.throwerName = null;
}
this.thrower = this.getThrower();
}
示例11: of
import net.minecraft.block.Block; //导入方法依赖的package包/类
public static IBlockQuery of(String blockName, boolean negated) throws BlockQueryParseException {
Block block = Block.getBlockFromName(blockName);
if (block == null) {
throw new BlockQueryParseException("No block called " + blockName);
} else {
IBlockQuery bm = new BlockQueryBlock(block);
return negated ? new BlockQueryNot(bm) : bm;
}
}
示例12: loadEntities
import net.minecraft.block.Block; //导入方法依赖的package包/类
public void loadEntities(World worldIn, NBTTagCompound compound, Chunk chunk)
{
NBTTagList nbttaglist1 = compound.getTagList("Entities", 10);
if (nbttaglist1 != null)
{
for (int j1 = 0; j1 < nbttaglist1.tagCount(); ++j1)
{
NBTTagCompound nbttagcompound1 = nbttaglist1.getCompoundTagAt(j1);
readChunkEntity(nbttagcompound1, worldIn, chunk);
chunk.setHasEntities(true);
}
}
NBTTagList nbttaglist2 = compound.getTagList("TileEntities", 10);
if (nbttaglist2 != null)
{
for (int k1 = 0; k1 < nbttaglist2.tagCount(); ++k1)
{
NBTTagCompound nbttagcompound2 = nbttaglist2.getCompoundTagAt(k1);
TileEntity tileentity = TileEntity.create(worldIn, nbttagcompound2);
if (tileentity != null)
{
chunk.addTileEntity(tileentity);
}
}
}
if (compound.hasKey("TileTicks", 9))
{
NBTTagList nbttaglist3 = compound.getTagList("TileTicks", 10);
if (nbttaglist3 != null)
{
for (int l1 = 0; l1 < nbttaglist3.tagCount(); ++l1)
{
NBTTagCompound nbttagcompound3 = nbttaglist3.getCompoundTagAt(l1);
Block block;
if (nbttagcompound3.hasKey("i", 8))
{
block = Block.getBlockFromName(nbttagcompound3.getString("i"));
}
else
{
block = Block.getBlockById(nbttagcompound3.getInteger("i"));
}
worldIn.scheduleBlockUpdate(new BlockPos(nbttagcompound3.getInteger("x"), nbttagcompound3.getInteger("y"), nbttagcompound3.getInteger("z")), block, nbttagcompound3.getInteger("t"), nbttagcompound3.getInteger("p"));
}
}
}
}
示例13: readEntityFromNBT
import net.minecraft.block.Block; //导入方法依赖的package包/类
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
protected void readEntityFromNBT(NBTTagCompound tagCompund)
{
if (tagCompund.getBoolean("CustomDisplayTile"))
{
int i = tagCompund.getInteger("DisplayData");
if (tagCompund.hasKey("DisplayTile", 8))
{
Block block = Block.getBlockFromName(tagCompund.getString("DisplayTile"));
if (block == null)
{
this.func_174899_a(Blocks.air.getDefaultState());
}
else
{
this.func_174899_a(block.getStateFromMeta(i));
}
}
else
{
Block block1 = Block.getBlockById(tagCompund.getInteger("DisplayTile"));
if (block1 == null)
{
this.func_174899_a(Blocks.air.getDefaultState());
}
else
{
this.func_174899_a(block1.getStateFromMeta(i));
}
}
this.setDisplayTileOffset(tagCompund.getInteger("DisplayOffset"));
}
if (tagCompund.hasKey("CustomName", 8) && tagCompund.getString("CustomName").length() > 0)
{
this.entityName = tagCompund.getString("CustomName");
}
}