当前位置: 首页>>代码示例>>Java>>正文


Java TileEntityChest类代码示例

本文整理汇总了Java中net.minecraft.tileentity.TileEntityChest的典型用法代码示例。如果您正苦于以下问题:Java TileEntityChest类的具体用法?Java TileEntityChest怎么用?Java TileEntityChest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TileEntityChest类属于net.minecraft.tileentity包,在下文中一共展示了TileEntityChest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setLootTable

import net.minecraft.tileentity.TileEntityChest; //导入依赖的package包/类
private static void setLootTable(TileEntityChest chestEntity, World world, int multiplier)
{
	double common = 75 / multiplier;
	double uncommon = 15;
	double rare = 6;
	double legendary = 3;
	double exotic = 1;
	
	RandomCollection<ResourceLocation> loottables = new RandomCollection<ResourceLocation>();
	
	loottables.add(common, ModLootTables.common_chest);
	loottables.add(uncommon, ModLootTables.uncommon_chest);
	loottables.add(rare, ModLootTables.rare_chest);
	loottables.add(legendary, ModLootTables.legendary_chest);
	loottables.add(exotic, ModLootTables.exotic_chest);
	
	ResourceLocation table = loottables.next(world.rand);
	chestEntity.setLootTable(table, world.rand.nextLong());
	
	if (table == ModLootTables.common_chest) chestEntity.setCustomName("Common Chest");
	else if (table == ModLootTables.uncommon_chest) chestEntity.setCustomName("Uncommon Chest");
	else if (table == ModLootTables.rare_chest) chestEntity.setCustomName("Rare Chest");
	else if (table == ModLootTables.legendary_chest) chestEntity.setCustomName("Legendary Chest");
	else if (table == ModLootTables.exotic_chest) chestEntity.setCustomName("Exotic Chest");
}
 
开发者ID:TheXFactor117,项目名称:Loot-Slash-Conquer,代码行数:26,代码来源:DungeonHelper.java

示例2: generate

import net.minecraft.tileentity.TileEntityChest; //导入依赖的package包/类
@Override
public boolean generate(World worldIn, Random rand, BlockPos position) {
	if(size.equals(BlockPos.ORIGIN) && rand.nextFloat() < this.chance)
	{
		worldIn.setBlockState(position, Blocks.CHEST.getDefaultState().withProperty(BlockChest.FACING, EnumFacing.HORIZONTALS[rand.nextInt(4)]), 3);
		((TileEntityChest)worldIn.getTileEntity(position)).setLootTable(lootTable, rand.nextLong());
		return false;
	}
	for(int x = 0; x < size.getX(); x++)
		for(int z = 0; z < size.getZ(); z++)
			if(rand.nextFloat() < this.chance)
			{
				BlockPos blockpos = new BlockPos(position.add(x, 0, z));
				boolean flag = false;
				for(EnumFacing facing : EnumFacing.HORIZONTALS)
					if(worldIn.getBlockState(blockpos.offset(facing)).getBlock() == Blocks.CHEST)
						flag = true;
				if(flag || !worldIn.isAirBlock(blockpos))
					continue;
				if(setBlock)
					worldIn.setBlockState(blockpos, Blocks.CHEST.getDefaultState().withProperty(BlockChest.FACING, EnumFacing.HORIZONTALS[rand.nextInt(4)]), 3);
				((TileEntityChest)worldIn.getTileEntity(blockpos)).setLootTable(lootTable, rand.nextLong());
			}
	return false;
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:26,代码来源:ChestGenerator.java

示例3: postAddition

import net.minecraft.tileentity.TileEntityChest; //导入依赖的package包/类
@Override
public void postAddition(World world, BlockPos pos, Random random) {
	pos = pos.subtract(originAddition);
	world.setBlockState(pos, Blocks.CHEST.getDefaultState().withProperty(BlockChest.FACING, EnumFacing.HORIZONTALS[random.nextInt(4)]), 3);
	if(world instanceof WorldServer && world.getTileEntity(pos) != null)
	{
		TileEntityChest chest = (TileEntityChest)world.getTileEntity(pos);
		chest.setInventorySlotContents(13, HarshenUtils.getItemsFromLootTable(world, HarshenLootTables.shrine).get(0));
		for(ItemStack stack : HarshenUtils.getItemsFromLootPool(world, HarshenLootTables.shrine, "extras"))
			for(int count = 0; count < stack.getCount(); count++)
			{
				int slot = new Random().nextInt(27);
				while(chest.getStackInSlot(slot).getItem() != Item.getItemFromBlock(Blocks.AIR))
					slot = new Random().nextInt(27);
				ItemStack stack1 = stack.copy();
				stack1.setCount(1);
				chest.setInventorySlotContents(slot, stack1);
			}
	}
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:21,代码来源:Shrine.java

示例4: generateChestContents

import net.minecraft.tileentity.TileEntityChest; //导入依赖的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;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:23,代码来源:StructureComponent.java

示例5: getWeakPower

import net.minecraft.tileentity.TileEntityChest; //导入依赖的package包/类
public int getWeakPower(IBlockAccess worldIn, BlockPos pos, IBlockState state, EnumFacing side)
{
    if (!this.canProvidePower())
    {
        return 0;
    }
    else
    {
        int i = 0;
        TileEntity tileentity = worldIn.getTileEntity(pos);

        if (tileentity instanceof TileEntityChest)
        {
            i = ((TileEntityChest)tileentity).numPlayersUsing;
        }

        return MathHelper.clamp_int(i, 0, 15);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:20,代码来源:BlockChest.java

示例6: TileEntityRendererDispatcher

import net.minecraft.tileentity.TileEntityChest; //导入依赖的package包/类
private TileEntityRendererDispatcher()
{
    this.mapSpecialRenderers.put(TileEntitySign.class, new TileEntitySignRenderer());
    this.mapSpecialRenderers.put(TileEntityMobSpawner.class, new TileEntityMobSpawnerRenderer());
    this.mapSpecialRenderers.put(TileEntityPiston.class, new TileEntityPistonRenderer());
    this.mapSpecialRenderers.put(TileEntityChest.class, new TileEntityChestRenderer());
    this.mapSpecialRenderers.put(TileEntityEnderChest.class, new TileEntityEnderChestRenderer());
    this.mapSpecialRenderers.put(TileEntityEnchantmentTable.class, new TileEntityEnchantmentTableRenderer());
    this.mapSpecialRenderers.put(TileEntityEndPortal.class, new TileEntityEndPortalRenderer());
    this.mapSpecialRenderers.put(TileEntityBeacon.class, new TileEntityBeaconRenderer());
    this.mapSpecialRenderers.put(TileEntitySkull.class, new TileEntitySkullRenderer());
    this.mapSpecialRenderers.put(TileEntityBanner.class, new TileEntityBannerRenderer());

    for (TileEntitySpecialRenderer<?> tileentityspecialrenderer : this.mapSpecialRenderers.values())
    {
        tileentityspecialrenderer.setRendererDispatcher(this);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:19,代码来源:TileEntityRendererDispatcher.java

示例7: getAttachedChest

import net.minecraft.tileentity.TileEntityChest; //导入依赖的package包/类
public TileEntityChest getAttachedChest()
{
	TileEntity ent = null;
	ent = this.worldObj.getTileEntity(this.pos.add(1, 0, 0));
	if(ent != null && ent instanceof TileEntityChest)
		return (TileEntityChest)ent;
	ent = this.worldObj.getTileEntity(this.pos.add(-1, 0, 0));
	if(ent != null && ent instanceof TileEntityChest)
		return (TileEntityChest)ent;
	ent = this.worldObj.getTileEntity(this.pos.add(0, 0, 1));
	if(ent != null && ent instanceof TileEntityChest)
		return (TileEntityChest)ent;
	ent = this.worldObj.getTileEntity(this.pos.add(0, 0, -1));
	if(ent != null && ent instanceof TileEntityChest)
		return (TileEntityChest)ent;
	
	return null;
}
 
开发者ID:ImagicTheCat,项目名称:FundamentalChemistry,代码行数:19,代码来源:TileItemAssembler.java

示例8: onRender

import net.minecraft.tileentity.TileEntityChest; //导入依赖的package包/类
@EventTarget
private void onRender(final Render3DEvent event) {
    GlStateManager.pushMatrix();
    for (final Object o : this.mc.theWorld.loadedTileEntityList) {
    	final TileEntity ent = (TileEntity)o;
        if (!(ent instanceof TileEntityChest) && !(ent instanceof TileEntityDispenser) && !(ent instanceof TileEntityEnderChest)) {
            continue;
        }
        if (ent instanceof TileEntityChest && !StorageEsp.chest) {
            continue;
        }
        if (ent instanceof TileEntityDispenser && !StorageEsp.dispenser) {
            continue;
        }
        if (ent instanceof TileEntityEnderChest && !StorageEsp.enderChest) {
            continue;
        }
        this.drawEsp(ent, event.partialTicks);
    }
    GlStateManager.popMatrix();
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:22,代码来源:StorageEsp.java

示例9: func_191080_a

import net.minecraft.tileentity.TileEntityChest; //导入依赖的package包/类
protected boolean func_191080_a(World p_191080_1_, StructureBoundingBox p_191080_2_, Random p_191080_3_, BlockPos p_191080_4_, ResourceLocation p_191080_5_, @Nullable IBlockState p_191080_6_)
{
    if (p_191080_2_.isVecInside(p_191080_4_) && p_191080_1_.getBlockState(p_191080_4_).getBlock() != Blocks.CHEST)
    {
        if (p_191080_6_ == null)
        {
            p_191080_6_ = Blocks.CHEST.correctFacing(p_191080_1_, p_191080_4_, Blocks.CHEST.getDefaultState());
        }

        p_191080_1_.setBlockState(p_191080_4_, p_191080_6_, 2);
        TileEntity tileentity = p_191080_1_.getTileEntity(p_191080_4_);

        if (tileentity instanceof TileEntityChest)
        {
            ((TileEntityChest)tileentity).setLootTable(p_191080_5_, p_191080_3_.nextLong());
        }

        return true;
    }
    else
    {
        return false;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:25,代码来源:StructureComponent.java

示例10: getWeakPower

import net.minecraft.tileentity.TileEntityChest; //导入依赖的package包/类
public int getWeakPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
    if (!blockState.canProvidePower())
    {
        return 0;
    }
    else
    {
        int i = 0;
        TileEntity tileentity = blockAccess.getTileEntity(pos);

        if (tileentity instanceof TileEntityChest)
        {
            i = ((TileEntityChest)tileentity).numPlayersUsing;
        }

        return MathHelper.clamp(i, 0, 15);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:20,代码来源:BlockChest.java

示例11: TileEntityRendererDispatcher

import net.minecraft.tileentity.TileEntityChest; //导入依赖的package包/类
private TileEntityRendererDispatcher()
{
    this.mapSpecialRenderers.put(TileEntitySign.class, new TileEntitySignRenderer());
    this.mapSpecialRenderers.put(TileEntityMobSpawner.class, new TileEntityMobSpawnerRenderer());
    this.mapSpecialRenderers.put(TileEntityPiston.class, new TileEntityPistonRenderer());
    this.mapSpecialRenderers.put(TileEntityChest.class, new TileEntityChestRenderer());
    this.mapSpecialRenderers.put(TileEntityEnderChest.class, new TileEntityEnderChestRenderer());
    this.mapSpecialRenderers.put(TileEntityEnchantmentTable.class, new TileEntityEnchantmentTableRenderer());
    this.mapSpecialRenderers.put(TileEntityEndPortal.class, new TileEntityEndPortalRenderer());
    this.mapSpecialRenderers.put(TileEntityEndGateway.class, new TileEntityEndGatewayRenderer());
    this.mapSpecialRenderers.put(TileEntityBeacon.class, new TileEntityBeaconRenderer());
    this.mapSpecialRenderers.put(TileEntitySkull.class, new TileEntitySkullRenderer());
    this.mapSpecialRenderers.put(TileEntityBanner.class, new TileEntityBannerRenderer());
    this.mapSpecialRenderers.put(TileEntityStructure.class, new TileEntityStructureRenderer());
    this.mapSpecialRenderers.put(TileEntityShulkerBox.class, new TileEntityShulkerBoxRenderer(new ModelShulker()));

    for (TileEntitySpecialRenderer<?> tileentityspecialrenderer : this.mapSpecialRenderers.values())
    {
        tileentityspecialrenderer.setRendererDispatcher(this);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:22,代码来源:TileEntityRendererDispatcher.java

示例12: equals

import net.minecraft.tileentity.TileEntityChest; //导入依赖的package包/类
@Override
public boolean equals(Object o)
{
    if (this == o)
        return true;
    if (o == null || getClass() != o.getClass())
        return false;

    VanillaDoubleChestItemHandler that = (VanillaDoubleChestItemHandler) o;

    if (hashCode != that.hashCode)
        return false;

    final TileEntityChest otherChest = getOtherChest();
    if (mainChestIsUpper == that.mainChestIsUpper)
        return Objects.equal(mainChest, that.mainChest) && Objects.equal(otherChest, that.getOtherChest());
    else
        return Objects.equal(mainChest, that.getOtherChest()) && Objects.equal(otherChest, that.mainChest);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:20,代码来源:VanillaDoubleChestItemHandler.java

示例13: generateChest

import net.minecraft.tileentity.TileEntityChest; //导入依赖的package包/类
/**
 * Adds chest to the structure and sets its contents
 */
protected boolean generateChest(World worldIn, StructureBoundingBox structurebb, Random randomIn, int x, int y, int z, ResourceLocation loot)
{
    BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z));

    if (structurebb.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)
        {
            ((TileEntityChest)tileentity).setLootTable(loot, randomIn.nextLong());
        }

        return true;
    }
    else
    {
        return false;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:26,代码来源:StructureComponent.java

示例14: getWeakPower

import net.minecraft.tileentity.TileEntityChest; //导入依赖的package包/类
public int getWeakPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
    if (!blockState.canProvidePower())
    {
        return 0;
    }
    else
    {
        int i = 0;
        TileEntity tileentity = blockAccess.getTileEntity(pos);

        if (tileentity instanceof TileEntityChest)
        {
            i = ((TileEntityChest)tileentity).numPlayersUsing;
        }

        return MathHelper.clamp_int(i, 0, 15);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:20,代码来源:BlockChest.java

示例15: TileEntityRendererDispatcher

import net.minecraft.tileentity.TileEntityChest; //导入依赖的package包/类
private TileEntityRendererDispatcher()
{
    this.mapSpecialRenderers.put(TileEntitySign.class, new TileEntitySignRenderer());
    this.mapSpecialRenderers.put(TileEntityMobSpawner.class, new TileEntityMobSpawnerRenderer());
    this.mapSpecialRenderers.put(TileEntityPiston.class, new TileEntityPistonRenderer());
    this.mapSpecialRenderers.put(TileEntityChest.class, new TileEntityChestRenderer());
    this.mapSpecialRenderers.put(TileEntityEnderChest.class, new TileEntityEnderChestRenderer());
    this.mapSpecialRenderers.put(TileEntityEnchantmentTable.class, new TileEntityEnchantmentTableRenderer());
    this.mapSpecialRenderers.put(TileEntityEndPortal.class, new TileEntityEndPortalRenderer());
    this.mapSpecialRenderers.put(TileEntityEndGateway.class, new TileEntityEndGatewayRenderer());
    this.mapSpecialRenderers.put(TileEntityBeacon.class, new TileEntityBeaconRenderer());
    this.mapSpecialRenderers.put(TileEntitySkull.class, new TileEntitySkullRenderer());
    this.mapSpecialRenderers.put(TileEntityBanner.class, new TileEntityBannerRenderer());
    this.mapSpecialRenderers.put(TileEntityStructure.class, new TileEntityStructureRenderer());

    for (TileEntitySpecialRenderer<?> tileentityspecialrenderer : this.mapSpecialRenderers.values())
    {
        tileentityspecialrenderer.setRendererDispatcher(this);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:21,代码来源:TileEntityRendererDispatcher.java


注:本文中的net.minecraft.tileentity.TileEntityChest类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。