本文整理汇总了Java中net.minecraft.util.RegistrySimple类的典型用法代码示例。如果您正苦于以下问题:Java RegistrySimple类的具体用法?Java RegistrySimple怎么用?Java RegistrySimple使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RegistrySimple类属于net.minecraft.util包,在下文中一共展示了RegistrySimple类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: registerItems
import net.minecraft.util.RegistrySimple; //导入依赖的package包/类
public static void registerItems() {
if (!((RegistrySimple)BlockDispenser.dispenseBehaviorRegistry).containsKey((Object)Items.glass_bottle)) {
BlockDispenser.dispenseBehaviorRegistry.putObject((Object)Items.glass_bottle, (Object)new BehaviorDefaultDispenseItem() {
private final BehaviorDefaultDispenseItem field_150840_b = new BehaviorDefaultDispenseItem();
public ItemStack dispenseStack(final IBlockSource par1IBlockSource, final ItemStack par2ItemStack) {
final EnumFacing enumfacing = BlockDispenser.func_149937_b(par1IBlockSource.getBlockMetadata());
final World world = par1IBlockSource.getWorld();
final int i = par1IBlockSource.getXInt() + enumfacing.getFrontOffsetX();
final int j = par1IBlockSource.getYInt() + enumfacing.getFrontOffsetY();
final int k = par1IBlockSource.getZInt() + enumfacing.getFrontOffsetZ();
final Material material = world.getBlock(i, j, k).getMaterial();
final int l = world.getBlockMetadata(i, j, k);
if (Material.water.equals(material) && l == 0) {
final Item item = (Item)Items.potionitem;
if (--par2ItemStack.stackSize == 0) {
par2ItemStack.func_150996_a(item);
par2ItemStack.stackSize = 1;
par2ItemStack.setTagCompound((NBTTagCompound)null);
}
else if (((TileEntityDispenser)par1IBlockSource.getBlockTileEntity()).func_146019_a(new ItemStack(item)) < 0) {
this.field_150840_b.dispense(par1IBlockSource, new ItemStack(item));
}
return par2ItemStack;
}
return super.dispenseStack(par1IBlockSource, par2ItemStack);
}
});
}
}
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:31,代码来源:DispenserStuff.java
示例2: replaceBlock
import net.minecraft.util.RegistrySimple; //导入依赖的package包/类
/**
* Replaces a block with another block. May not work.
* @param nonNumericId The string id of the block to remove.
* @param newBlock The new Block to put in it's place.
*/
@DocumentationAnnotations.Experimental(firstAppearance = "1.0")
public static final void replaceBlock(String nonNumericId, Block newBlock)
{
Map<String, Block> blocksMap = ReflectionManipulateValues.getValue(RegistrySimple.class, Block.blockRegistry, "registryObjects");
blocksMap.remove(nonNumericId);
blocksMap.put(nonNumericId, newBlock);
ReflectionManipulateValues.setValue(RegistrySimple.class, Block.blockRegistry, "registryObjects", blocksMap);
}
开发者ID:Niadel,项目名称:N-API,代码行数:15,代码来源:BlockRegistry.java
示例3: matchItem
import net.minecraft.util.RegistrySimple; //导入依赖的package包/类
public boolean matchItem(final Item item) {
return ((RegistrySimple)BlockDispenser.dispenseBehaviorRegistry).containsKey((Object)item);
}
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:4,代码来源:AdvancedNodeUpgrades.java
注:本文中的net.minecraft.util.RegistrySimple类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论