本文整理汇总了Java中net.minecraft.util.WeightedRandomChestContent类的典型用法代码示例。如果您正苦于以下问题:Java WeightedRandomChestContent类的具体用法?Java WeightedRandomChestContent怎么用?Java WeightedRandomChestContent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WeightedRandomChestContent类属于net.minecraft.util包,在下文中一共展示了WeightedRandomChestContent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateChestContents
import net.minecraft.util.WeightedRandomChestContent; //导入依赖的package包/类
protected boolean generateChestContents(World worldIn, StructureBoundingBox boundingBoxIn, Random rand, int x, int y, int z, List<WeightedRandomChestContent> listIn, int max)
{
BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z));
if (boundingBoxIn.isVecInside(blockpos) && worldIn.getBlockState(blockpos).getBlock() != Blocks.chest)
{
IBlockState iblockstate = Blocks.chest.getDefaultState();
worldIn.setBlockState(blockpos, Blocks.chest.correctFacing(worldIn, blockpos, iblockstate), 2);
TileEntity tileentity = worldIn.getTileEntity(blockpos);
if (tileentity instanceof TileEntityChest)
{
WeightedRandomChestContent.generateChestContents(rand, listIn, (TileEntityChest)tileentity, max);
}
return true;
}
else
{
return false;
}
}
示例2: generateDispenserContents
import net.minecraft.util.WeightedRandomChestContent; //导入依赖的package包/类
protected boolean generateDispenserContents(World worldIn, StructureBoundingBox boundingBoxIn, Random rand, int x, int y, int z, int meta, List<WeightedRandomChestContent> listIn, int max)
{
BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z));
if (boundingBoxIn.isVecInside(blockpos) && worldIn.getBlockState(blockpos).getBlock() != Blocks.dispenser)
{
worldIn.setBlockState(blockpos, Blocks.dispenser.getStateFromMeta(this.getMetadataWithOffset(Blocks.dispenser, meta)), 2);
TileEntity tileentity = worldIn.getTileEntity(blockpos);
if (tileentity instanceof TileEntityDispenser)
{
WeightedRandomChestContent.generateDispenserContents(rand, listIn, (TileEntityDispenser)tileentity, max);
}
return true;
}
else
{
return false;
}
}
示例3: generateChestContents
import net.minecraft.util.WeightedRandomChestContent; //导入依赖的package包/类
protected boolean generateChestContents(World worldIn, StructureBoundingBox boundingBoxIn, Random rand, int x, int y, int z, List<WeightedRandomChestContent> listIn, int max)
{
BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z));
if (boundingBoxIn.isVecInside(blockpos) && worldIn.getBlockState(blockpos).getBlock().getMaterial() == Material.air)
{
int i = rand.nextBoolean() ? 1 : 0;
worldIn.setBlockState(blockpos, Blocks.rail.getStateFromMeta(this.getMetadataWithOffset(Blocks.rail, i)), 2);
EntityMinecartChest entityminecartchest = new EntityMinecartChest(worldIn, (double)((float)blockpos.getX() + 0.5F), (double)((float)blockpos.getY() + 0.5F), (double)((float)blockpos.getZ() + 0.5F));
WeightedRandomChestContent.generateChestContents(rand, listIn, entityminecartchest, max);
worldIn.spawnEntityInWorld(entityminecartchest);
return true;
}
else
{
return false;
}
}
示例4: BeetrootSeeds
import net.minecraft.util.WeightedRandomChestContent; //导入依赖的package包/类
public BeetrootSeeds() {
super(ModBlocks.beetroot, Blocks.farmland);
setTextureName("beetroot_seeds");
setUnlocalizedName(Utils.getUnlocalisedName("beetroot_seeds"));
setCreativeTab(EtFuturum.enableBeetroot ? EtFuturum.creativeTab : null);
if (EtFuturum.enableBeetroot) {
ChestGenHooks.addItem(ChestGenHooks.MINESHAFT_CORRIDOR, new WeightedRandomChestContent(new ItemStack(this), 1, 2, 5));
ChestGenHooks.addItem(ChestGenHooks.PYRAMID_DESERT_CHEST, new WeightedRandomChestContent(new ItemStack(this), 1, 2, 5));
ChestGenHooks.addItem(ChestGenHooks.PYRAMID_JUNGLE_CHEST, new WeightedRandomChestContent(new ItemStack(this), 1, 2, 5));
ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CORRIDOR, new WeightedRandomChestContent(new ItemStack(this), 1, 2, 5));
ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_LIBRARY, new WeightedRandomChestContent(new ItemStack(this), 1, 2, 5));
ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CROSSING, new WeightedRandomChestContent(new ItemStack(this), 1, 2, 5));
ChestGenHooks.addItem(ChestGenHooks.DUNGEON_CHEST, new WeightedRandomChestContent(new ItemStack(this), 1, 2, 5));
}
}
示例5: getItems
import net.minecraft.util.WeightedRandomChestContent; //导入依赖的package包/类
/**
* Gets an array of all random objects that are associated with this category.
*
* @return The random objects
*/
public WeightedRandomChestContent[] getItems(Random rnd)
{
ArrayList<WeightedRandomChestContent> ret = new ArrayList<WeightedRandomChestContent>();
for (WeightedRandomChestContent orig : contents)
{
Item item = orig.field_76297_b.func_77973_b();
if (item != null)
{
WeightedRandomChestContent n = item.getChestGenBase(this, rnd, orig);
if (n != null)
{
ret.add(n);
}
}
}
return ret.toArray(new WeightedRandomChestContent[ret.size()]);
}
示例6: addToChests
import net.minecraft.util.WeightedRandomChestContent; //导入依赖的package包/类
public static void addToChests() {
int numHammers = 94;
for (int i = 0; i < numHammers ; i++) {
if(HammerMod.DEBUG_MODE == true) {
System.out.println("DEBUG: Injected Hammer with ID " + i + " into the Minecraft LootChests.");
}
ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH).addItem(new WeightedRandomChestContent(hammers.get(i), 0, 1, 1));
ChestGenHooks.getInfo(ChestGenHooks.MINESHAFT_CORRIDOR).addItem(new WeightedRandomChestContent(hammers.get(i), 0, 1, 1));
ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_DESERT_CHEST).addItem(new WeightedRandomChestContent(hammers.get(i), 0, 1, 1));
ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_JUNGLE_CHEST).addItem(new WeightedRandomChestContent(hammers.get(i), 0, 1, 1));
ChestGenHooks.getInfo(ChestGenHooks.STRONGHOLD_CORRIDOR).addItem(new WeightedRandomChestContent(hammers.get(i), 0, 1, 1));
ChestGenHooks.getInfo(ChestGenHooks.STRONGHOLD_LIBRARY).addItem(new WeightedRandomChestContent(hammers.get(i), 0, 1, 1));
ChestGenHooks.getInfo(ChestGenHooks.STRONGHOLD_CROSSING).addItem(new WeightedRandomChestContent(hammers.get(i), 0, 1, 1));
ChestGenHooks.getInfo(ChestGenHooks.BONUS_CHEST).addItem(new WeightedRandomChestContent(hammers.get(i), 0, 1, 1));
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(hammers.get(i), 0, 1, 1));
}
}
示例7: getItems
import net.minecraft.util.WeightedRandomChestContent; //导入依赖的package包/类
/**
* Gets an array of all random objects that are associated with this category.
*
* @return The random objects
*/
public WeightedRandomChestContent[] getItems(Random rnd)
{
ArrayList<WeightedRandomChestContent> ret = new ArrayList<WeightedRandomChestContent>();
for (WeightedRandomChestContent orig : contents)
{
Item item = orig.theItemId.getItem();
if (item != null)
{
WeightedRandomChestContent n = item.getChestGenBase(this, rnd, orig);
if (n != null)
{
ret.add(n);
}
}
}
return ret.toArray(new WeightedRandomChestContent[ret.size()]);
}
示例8: register
import net.minecraft.util.WeightedRandomChestContent; //导入依赖的package包/类
public void register() {
ChestGenHooks cat = ChestGenHooks.getInfo(category);
cat.setMin(minItems);
cat.setMax(maxItems);
if(entries != null) {
for(LootEntry entry : entries) {
if(entry != null) {
WeightedRandomChestContent content = entry.createContent();
if(content != null) {
cat.addItem(content);
}
}
}
}
}
示例9: populate
import net.minecraft.util.WeightedRandomChestContent; //导入依赖的package包/类
@Override
public boolean populate(World world) {
// world.setBlock(x, y, z, chestBlock.getBlock(), chestBlock.getMetadata(), 2);
IInventory chest = (IInventory) world.getTileEntity(x, y, z);
if (chest != null)
{
// this clears the chest
for (int i = 0; i < chest.getSizeInventory(); i++)
{
chest.setInventorySlotContents(i, null);
}
// hmm that is an interesting concept
ChestGenHooks info = ChestGenHooks.getInfo(chestGenName);
WeightedRandomChestContent.generateChestContents(world.rand, info.getItems(world.rand), chest, info.getCount(world.rand));
return true;
}
return false;
}
示例10: registerWorldGen
import net.minecraft.util.WeightedRandomChestContent; //导入依赖的package包/类
private void registerWorldGen()
{
if ( config.get( "world", "genPersistium", true ).getBoolean( true ) )
{
GameRegistry.registerWorldGenerator( persistiumOreGen = new PersistiumOreGenerator(), 10 );
}
if ( config.get( "world", "modifierEssenceLoot", true ).getBoolean( true ) )
{
ItemStack modStack = new ItemStack( items.modifierEssence );
WeightedRandomChestContent wrcc = new WeightedRandomChestContent( modStack, 1, 1, 1 );
ChestGenHooks.addItem( ChestGenHooks.MINESHAFT_CORRIDOR, wrcc );
ChestGenHooks.addItem( ChestGenHooks.VILLAGE_BLACKSMITH, wrcc );
ChestGenHooks.addItem( ChestGenHooks.PYRAMID_DESERT_CHEST, wrcc );
ChestGenHooks.addItem( ChestGenHooks.PYRAMID_JUNGLE_CHEST, wrcc );
ChestGenHooks.addItem( ChestGenHooks.STRONGHOLD_CORRIDOR, wrcc );
ChestGenHooks.addItem( ChestGenHooks.STRONGHOLD_LIBRARY, wrcc );
ChestGenHooks.addItem( ChestGenHooks.STRONGHOLD_CROSSING, wrcc );
ChestGenHooks.addItem( ChestGenHooks.DUNGEON_CHEST, wrcc );
}
}
示例11: getChestGenBase
import net.minecraft.util.WeightedRandomChestContent; //导入依赖的package包/类
@Override
public WeightedRandomChestContent getChestGenBase( ChestGenHooks chest, Random rnd, WeightedRandomChestContent original )
{
Modifier mod = Modifier.getModifier( Modifier.getTypes()[ rnd.nextInt( Modifier.getTypes().length ) ] );
int level = 1 + rnd.nextInt( mod.getMaxLevel() );
NBTTagCompound tag = new NBTTagCompound();
tag.setString( "Modifier", mod.type );
tag.setInteger( "Level", level );
ItemStack loot = new ItemStack( this );
loot.setTagCompound( tag );
original.theItemId = loot;
//System.out.println( "Did generation " + chest.category + " " + mod.type + " " + level );
return original;
}
示例12: addWorldgen
import net.minecraft.util.WeightedRandomChestContent; //导入依赖的package包/类
public static void addWorldgen()
{
if(BBConfig.spawnMarshmallows){
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(
RegisterItems.marshmallow), 1, 5, 100));
ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_DESERT_CHEST)
.addItem(new WeightedRandomChestContent(new ItemStack(RegisterItems.marshmallow), 1, 10, 200));
ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_JUNGLE_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(
RegisterItems.marshmallow), 1, 10, 200));
ChestGenHooks.getInfo(ChestGenHooks.STRONGHOLD_CROSSING)
.addItem(new WeightedRandomChestContent(new ItemStack(RegisterItems.marshmallow), 1, 12, 150));
ChestGenHooks.getInfo(ChestGenHooks.STRONGHOLD_CORRIDOR)
.addItem(new WeightedRandomChestContent(new ItemStack(RegisterItems.marshmallow), 1, 12, 150));
ChestGenHooks.getInfo(ChestGenHooks.MINESHAFT_CORRIDOR)
.addItem(new WeightedRandomChestContent(new ItemStack(RegisterItems.marshmallow), 1, 12, 150));
}
}
示例13: generateStructureChestContents
import net.minecraft.util.WeightedRandomChestContent; //导入依赖的package包/类
/**
* Used to generate chests with items in it. ex: Temple Chests, Village Blacksmith Chests, Mineshaft Chests.
*/
protected boolean generateStructureChestContents(World par1World, StructureBoundingBox par2StructureBoundingBox, Random par3Random, int par4, int par5, int par6, WeightedRandomChestContent[] par7ArrayOfWeightedRandomChestContent, int par8)
{
int var9 = this.getXWithOffset(par4, par6);
int var10 = this.getYWithOffset(par5);
int var11 = this.getZWithOffset(par4, par6);
if (par2StructureBoundingBox.isVecInside(var9, var10, var11) && par1World.getBlock(var9, var10, var11) != Blocks.chest)
{
par1World.setBlock(var9, var10, var11, Blocks.chest, 0, 2);
TileEntityChest var12 = (TileEntityChest)par1World.getTileEntity(var9, var10, var11);
if (var12 != null)
{
WeightedRandomChestContent.generateChestContents(par3Random, par7ArrayOfWeightedRandomChestContent, var12, par8);
}
return true;
}
else
{
return false;
}
}
示例14: generateStructureDispenserContents
import net.minecraft.util.WeightedRandomChestContent; //导入依赖的package包/类
/**
* Used to generate dispenser contents for structures. ex: Jungle Temples.
*/
protected boolean generateStructureDispenserContents(World par1World, StructureBoundingBox par2StructureBoundingBox, Random par3Random, int par4, int par5, int par6, int par7, WeightedRandomChestContent[] par8ArrayOfWeightedRandomChestContent, int par9)
{
int var10 = this.getXWithOffset(par4, par6);
int var11 = this.getYWithOffset(par5);
int var12 = this.getZWithOffset(par4, par6);
if (par2StructureBoundingBox.isVecInside(var10, var11, var12) && par1World.getBlock(var10, var11, var12) != Blocks.dispenser)
{
par1World.setBlock(var10, var11, var12, Blocks.dispenser, this.func_151555_a(Blocks.dispenser, par7), 2);
TileEntityDispenser var13 = (TileEntityDispenser)par1World.getTileEntity(var10, var11, var12);
if (var13 != null)
{
WeightedRandomChestContent.func_150706_a(par3Random, par8ArrayOfWeightedRandomChestContent, var13, par9);
}
return true;
}
else
{
return false;
}
}
示例15: generateStructureChestContents
import net.minecraft.util.WeightedRandomChestContent; //导入依赖的package包/类
protected boolean generateStructureChestContents(World par1World, StructureBoundingBox par2StructureBoundingBox, Random par3Random, int par4, int par5, int par6, WeightedRandomChestContent[] par7ArrayOfWeightedRandomChestContent, int par8)
{
int var9 = this.getXWithOffset(par4, par6);
int var10 = this.getYWithOffset(par5);
int var11 = this.getZWithOffset(par4, par6);
if (par2StructureBoundingBox.isVecInside(var9, var10, var11) && par1World.getBlock(var9, var10, var11).getMaterial() == Material.air)
{
int var12 = par3Random.nextBoolean() ? 1 : 0;
par1World.setBlock(var9, var10, var11, Blocks.rail, this.func_151555_a(Blocks.rail, var12), 2);
EntityMinecartChest var13 = new EntityMinecartChest(par1World, (double)((float)var9 + 0.5F), (double)((float)var10 + 0.5F), (double)((float)var11 + 0.5F));
WeightedRandomChestContent.generateChestContents(par3Random, par7ArrayOfWeightedRandomChestContent, var13, par8);
par1World.spawnEntityInWorld(var13);
return true;
}
else
{
return false;
}
}
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:21,代码来源:StructureMineshaftPieces.java