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


Java EntityMinecartChest类代码示例

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


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

示例1: generateChestContents

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

示例2: generateChest

import net.minecraft.entity.item.EntityMinecartChest; //导入依赖的package包/类
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).getMaterial() == Material.AIR && worldIn.getBlockState(blockpos.down()).getMaterial() != Material.AIR)
    {
        IBlockState iblockstate = Blocks.RAIL.getDefaultState().withProperty(BlockRail.SHAPE, randomIn.nextBoolean() ? BlockRailBase.EnumRailDirection.NORTH_SOUTH : BlockRailBase.EnumRailDirection.EAST_WEST);
        this.setBlockState(worldIn, iblockstate, x, y, z, structurebb);
        EntityMinecartChest entityminecartchest = new EntityMinecartChest(worldIn, (double)((float)blockpos.getX() + 0.5F), (double)((float)blockpos.getY() + 0.5F), (double)((float)blockpos.getZ() + 0.5F));
        entityminecartchest.setLootTable(loot, randomIn.nextLong());
        worldIn.spawnEntityInWorld(entityminecartchest);
        return true;
    }
    else
    {
        return false;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:19,代码来源:StructureMineshaftPieces.java

示例3: generateChest

import net.minecraft.entity.item.EntityMinecartChest; //导入依赖的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).getMaterial() == Material.AIR && worldIn.getBlockState(blockpos.down()).getMaterial() != Material.AIR)
    {
        IBlockState iblockstate = Blocks.RAIL.getDefaultState().withProperty(BlockRail.SHAPE, randomIn.nextBoolean() ? BlockRailBase.EnumRailDirection.NORTH_SOUTH : BlockRailBase.EnumRailDirection.EAST_WEST);
        this.setBlockState(worldIn, iblockstate, x, y, z, structurebb);
        EntityMinecartChest entityminecartchest = new EntityMinecartChest(worldIn, (double)((float)blockpos.getX() + 0.5F), (double)((float)blockpos.getY() + 0.5F), (double)((float)blockpos.getZ() + 0.5F));
        entityminecartchest.setLootTable(loot, randomIn.nextLong());
        worldIn.spawnEntityInWorld(entityminecartchest);
        return true;
    }
    else
    {
        return false;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:22,代码来源:StructureMineshaftPieces.java

示例4: generateStructureChestContents

import net.minecraft.entity.item.EntityMinecartChest; //导入依赖的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

示例5: getMinecartData

import net.minecraft.entity.item.EntityMinecartChest; //导入依赖的package包/类
@Override
public Map<Object, Object> getMinecartData(EntityMinecart cart) {
	Map<Object, Object> ret = new HashMap<Object, Object>();
	
	if (cart.getClass() == EntityMinecartEmpty.class) {
		ret.put("__CART_TYPE__", "basic");
		ret.put("occupied", cart.riddenByEntity != null);
		if (cart.riddenByEntity != null) ret.put("username", cart.riddenByEntity.getEntityName());
	} else if (cart.getClass() == EntityMinecartChest.class) {
		ret.put("__CART_TYPE__", "storage");
	} else if (cart.getClass() == EntityMinecartFurnace.class) {
		ret.put("__CART_TYPE__", "furnace");
		NBTTagCompound workaround = new NBTTagCompound();
		cart.writeToNBT(workaround);
		ret.put("fuel", workaround.getInteger("Fuel"));
	} else if (cart.getClass() == EntityMinecartHopper.class) {
		ret.put("__CART_TYPE__", "hopper");
	} else if (cart.getClass() == EntityMinecartTNT.class) {
		ret.put("__CART_TYPE__", "tnt");
	} else if (cart.getClass() == EntityMinecartMobSpawner.class) {
		ret.put("__CART_TYPE__", "spawner");
	}
	
	return ret.containsKey("__CART_TYPE__") ? ret : null;
}
 
开发者ID:austinv11,项目名称:PeripheralsPlusPlus,代码行数:26,代码来源:TileRailReader.java

示例6: generateChest

import net.minecraft.entity.item.EntityMinecartChest; //导入依赖的package包/类
/**
 * Used to generate chests with items in it. ex: Temple Chests, Village Blacksmith Chests, Mineshaft Chests.
 */
@Override
protected boolean generateChest(World world, StructureBoundingBox structureboundingbox, Random rand, int x, int y, int z, ResourceLocation loot)
{
	BlockPos blockpos = new BlockPos(getXWithOffset(x, z), getYWithOffset(y), getZWithOffset(x, z));

	if (structureboundingbox.isVecInside(blockpos) && world.getBlockState(blockpos).getMaterial() == Material.AIR)
	{
		IBlockState iblockstate = Blocks.RAIL.getDefaultState().withProperty(BlockRail.SHAPE, rand.nextBoolean() ? BlockRailBase.EnumRailDirection.NORTH_SOUTH : BlockRailBase.EnumRailDirection.EAST_WEST);
		setBlockState(world, iblockstate, x, y, z, structureboundingbox);
		EntityMinecartChest entityminecartchest = new EntityMinecartChest(world, blockpos.getX() + 0.5F, blockpos.getY() + 0.5F, blockpos.getZ() + 0.5F);
		entityminecartchest.setLootTable(loot, rand.nextLong());
		world.spawnEntity(entityminecartchest);
		return true;
	} else
		return false;
}
 
开发者ID:Shinoow,项目名称:AbyssalCraft,代码行数:20,代码来源:StructureDreadlandsMinePieces.java

示例7: generateStructureChestContents

import net.minecraft.entity.item.EntityMinecartChest; //导入依赖的package包/类
protected boolean generateStructureChestContents(World p_74879_1_, StructureBoundingBox p_74879_2_, Random p_74879_3_, int p_74879_4_, int p_74879_5_, int p_74879_6_, WeightedRandomChestContent[] p_74879_7_, int p_74879_8_)
{
    int i1 = this.getXWithOffset(p_74879_4_, p_74879_6_);
    int j1 = this.getYWithOffset(p_74879_5_);
    int k1 = this.getZWithOffset(p_74879_4_, p_74879_6_);

    if (p_74879_2_.isVecInside(i1, j1, k1) && p_74879_1_.getBlock(i1, j1, k1).getMaterial() == Material.air)
    {
        int l1 = p_74879_3_.nextBoolean() ? 1 : 0;
        p_74879_1_.setBlock(i1, j1, k1, Blocks.rail, this.getMetadataWithOffset(Blocks.rail, l1), 2);
        EntityMinecartChest entityminecartchest = new EntityMinecartChest(p_74879_1_, (double)((float)i1 + 0.5F), (double)((float)j1 + 0.5F), (double)((float)k1 + 0.5F));
        WeightedRandomChestContent.generateChestContents(p_74879_3_, p_74879_7_, entityminecartchest, p_74879_8_);
        p_74879_1_.spawnEntityInWorld(entityminecartchest);
        return true;
    }
    else
    {
        return false;
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:21,代码来源:StructureMineshaftPieces.java

示例8: func_94090_a

import net.minecraft.entity.item.EntityMinecartChest; //导入依赖的package包/类
public static EntityMinecart func_94090_a(World p_94090_0_, double p_94090_1_, double p_94090_3_, double p_94090_5_, int p_94090_7_) {
   switch(p_94090_7_) {
   case 1:
      return new EntityMinecartChest(p_94090_0_, p_94090_1_, p_94090_3_, p_94090_5_);
   case 2:
      return new EntityMinecartFurnace(p_94090_0_, p_94090_1_, p_94090_3_, p_94090_5_);
   case 3:
      return new EntityMinecartTNT(p_94090_0_, p_94090_1_, p_94090_3_, p_94090_5_);
   case 4:
      return new EntityMinecartMobSpawner(p_94090_0_, p_94090_1_, p_94090_3_, p_94090_5_);
   case 5:
      return new EntityMinecartHopper(p_94090_0_, p_94090_1_, p_94090_3_, p_94090_5_);
   default:
      return new EntityMinecartEmpty(p_94090_0_, p_94090_1_, p_94090_3_, p_94090_5_);
   }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:17,代码来源:EntityMinecart.java

示例9: generateStructureChestContents

import net.minecraft.entity.item.EntityMinecartChest; //导入依赖的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 i1 = this.getXWithOffset(par4, par6);
    int j1 = this.getYWithOffset(par5);
    int k1 = this.getZWithOffset(par4, par6);

    if (par2StructureBoundingBox.isVecInside(i1, j1, k1) && par1World.getBlockId(i1, j1, k1) == 0)
    {
        par1World.setBlock(i1, j1, k1, Block.rail.blockID, this.getMetadataWithOffset(Block.rail.blockID, par3Random.nextBoolean() ? 1 : 0), 2);
        EntityMinecartChest entityminecartchest = new EntityMinecartChest(par1World, (double)((float)i1 + 0.5F), (double)((float)j1 + 0.5F), (double)((float)k1 + 0.5F));
        WeightedRandomChestContent.generateChestContents(par3Random, par7ArrayOfWeightedRandomChestContent, entityminecartchest, par8);
        par1World.spawnEntityInWorld(entityminecartchest);
        return true;
    }
    else
    {
        return false;
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:23,代码来源:ComponentMineshaftCorridor.java

示例10: generateStructureChestContents

import net.minecraft.entity.item.EntityMinecartChest; //导入依赖的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 i1 = this.getXWithOffset(par4, par6);
    int j1 = this.getYWithOffset(par5);
    int k1 = this.getZWithOffset(par4, par6);

    if (par2StructureBoundingBox.isVecInside(i1, j1, k1) && par1World.getBlock(i1, j1, k1).getMaterial() == Material.air)
    {
        int l1 = par3Random.nextBoolean() ? 1 : 0;
        par1World.setBlock(i1, j1, k1, Blocks.rail, this.getMetadataWithOffset(Blocks.rail, l1), 2);
        EntityMinecartChest entityminecartchest = new EntityMinecartChest(par1World, (double)((float)i1 + 0.5F), (double)((float)j1 + 0.5F), (double)((float)k1 + 0.5F));
        WeightedRandomChestContent.generateChestContents(par3Random, par7ArrayOfWeightedRandomChestContent, entityminecartchest, par8);
        par1World.spawnEntityInWorld(entityminecartchest);
        return true;
    }
    else
    {
        return false;
    }
}
 
开发者ID:wuppy29,项目名称:WuppyMods,代码行数:24,代码来源:StructureMineshaftPiecesSavannah.java

示例11: getEntityColor

import net.minecraft.entity.item.EntityMinecartChest; //导入依赖的package包/类
private int getEntityColor(Entity entity) {
    if(entity instanceof EntityMinecartChest)
        return Utils.Colors.ORANGE;
    else if(entity instanceof EntityItemFrame &&
            ((EntityItemFrame) entity).getDisplayedItem().getItem() instanceof ItemShulkerBox)
        return Utils.Colors.YELLOW;
    else
        return -1;
}
 
开发者ID:fr1kin,项目名称:ForgeHax,代码行数:10,代码来源:StorageESPMod.java

示例12: render

import net.minecraft.entity.item.EntityMinecartChest; //导入依赖的package包/类
@Override
public void render(ItemStack stack) {
	String id = "empty";
	Class<? extends EntityMinecart> clazz = EntityMinecartEmpty.class;
	
	if(stack.getItem() == Items.CHEST_MINECART){
		id = "chest";
		clazz = EntityMinecartChest.class;
	}
	
	if(stack.getItem() == Items.FURNACE_MINECART){
		id = "furnace";
		clazz = EntityMinecartFurnace.class;
	}
	
	if(stack.getItem() == Items.TNT_MINECART){
		id = "tnt";
		clazz = EntityMinecartTNT.class;
	}
	
	if(stack.getItem() == Items.HOPPER_MINECART){
		id = "hopper";
		clazz = EntityMinecartHopper.class;
	}
	
	if(stack.getItem() == Items.COMMAND_BLOCK_MINECART){
		id = "commandblock";
		clazz = EntityMinecartCommandBlock.class;
	}
	
	EntityMinecart minecart = getMinecart(id, clazz);
	if(minecart == null){
		return;
	}
	renderMinecart(minecart, lastTransform, true);
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:37,代码来源:ItemMinecartRender.java

示例13: MinecartInteractEvent

import net.minecraft.entity.item.EntityMinecartChest; //导入依赖的package包/类
@SubscribeEvent
public void MinecartInteractEvent(MinecartInteractEvent event) {
	if (event.entity instanceof EntityMinecartChest) {
		ItemStack curItem = event.player.getCurrentEquippedItem();
    	EntityMinecartChest oldCart = (EntityMinecartChest) event.entity;
    	if (curItem != null && curItem.getItem() == WoodIronUpgrade) {
    		EntityIronChestCart ironCart = new EntityIronChestCart(oldCart.worldObj);
    		ironCart.copyDataFrom(event.entity, true);
    		ironCart.setDisplayTileData(0);
 	        if (!event.entity.worldObj.isRemote) {
 	           	oldCart.worldObj.spawnEntityInWorld(ironCart);
 	        }
 	        for (int i = 0; i < oldCart.getSizeInventory(); i++) {
 	        	oldCart.setInventorySlotContents(i, null);
 	        }
    		oldCart.setDead();
    		event.player.destroyCurrentEquippedItem();
    		event.setCanceled(true);
    	} else if (curItem != null && curItem.getItem() == WoodCopperUpgrade) {	
    		EntityCopperChestCart copperCart = new EntityCopperChestCart(oldCart.worldObj);
    		copperCart.copyDataFrom(event.entity, true);
    		copperCart.setDisplayTileData(3);
 	        if (!event.entity.worldObj.isRemote) {
 	        	oldCart.worldObj.spawnEntityInWorld(copperCart);
 	        }
 	        for (int i = 0; i < oldCart.getSizeInventory(); i++) {
 	          	oldCart.setInventorySlotContents(i, null);
 	        }
    		oldCart.setDead();
    		event.player.destroyCurrentEquippedItem();
    		event.setCanceled(true);
    	}
    }
}
 
开发者ID:ScottDTA,项目名称:ExtraCarts-1.7.10,代码行数:35,代码来源:ECEventHandler.java

示例14: func_74879_a

import net.minecraft.entity.item.EntityMinecartChest; //导入依赖的package包/类
protected boolean func_74879_a(World p_74879_1_, StructureBoundingBox p_74879_2_, Random p_74879_3_, int p_74879_4_, int p_74879_5_, int p_74879_6_, WeightedRandomChestContent[] p_74879_7_, int p_74879_8_) {
   int var9 = this.func_74865_a(p_74879_4_, p_74879_6_);
   int var10 = this.func_74862_a(p_74879_5_);
   int var11 = this.func_74873_b(p_74879_4_, p_74879_6_);
   if(p_74879_2_.func_78890_b(var9, var10, var11) && p_74879_1_.func_72798_a(var9, var10, var11) == 0) {
      p_74879_1_.func_72832_d(var9, var10, var11, Block.field_72056_aG.field_71990_ca, this.func_74863_c(Block.field_72056_aG.field_71990_ca, p_74879_3_.nextBoolean()?1:0), 2);
      EntityMinecartChest var12 = new EntityMinecartChest(p_74879_1_, (double)((float)var9 + 0.5F), (double)((float)var10 + 0.5F), (double)((float)var11 + 0.5F));
      WeightedRandomChestContent.func_76293_a(p_74879_3_, p_74879_7_, var12, p_74879_8_);
      p_74879_1_.func_72838_d(var12);
      return true;
   } else {
      return false;
   }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:15,代码来源:ComponentMineshaftCorridor.java

示例15: onRender

import net.minecraft.entity.item.EntityMinecartChest; //导入依赖的package包/类
@Override
public void onRender() {
	if(isEnabled()) {
		for (Object o : Wrapper.getWorld().loadedTileEntityList) {
			if (o instanceof TileEntityChest) {
				TileEntityChest chest = (TileEntityChest) o;
				this.drawChestESP(chest, chest.getPos().getX(), chest.getPos().getY(), chest.getPos().getZ());
			}
			if (o instanceof TileEntityEnderChest) {
				TileEntityEnderChest enderChest = (TileEntityEnderChest) o;
				this.drawEnderChestESP(enderChest, enderChest.getPos().getX(), enderChest.getPos().getY(), enderChest.getPos().getZ());
			}
			if (o instanceof TileEntityFurnace) {
				TileEntityFurnace furnace = (TileEntityFurnace) o;
				RenderUtils.blockESP(furnace.getPos(), Color.white, 1.0, 1.0);
			}
			if (o instanceof TileEntityDispenser) {
				TileEntityDispenser dispenser = (TileEntityDispenser) o;
				RenderUtils.blockESP(dispenser.getPos(), Color.white, 1.0, 1.0);
			}
			if (o instanceof TileEntityDropper) {
				TileEntityDropper dropper = (TileEntityDropper) o;
				RenderUtils.blockESP(dropper.getPos(), Color.white, 1.0, 1.0);
			}
			if (o instanceof TileEntityHopper) {
				TileEntityHopper hopper = (TileEntityHopper) o;
				RenderUtils.blockESP(hopper.getPos(), Color.white, 1.0, 1.0);
			}
			if (o instanceof TileEntityShulkerBox) {
				TileEntityShulkerBox shulker = (TileEntityShulkerBox) o;
				RenderUtils.blockESP(shulker.getPos(), Color.yellow, 1.0, 1.0);
			}
			
		}
		for (Entity e: Wrapper.getWorld().loadedEntityList) {
			if (e instanceof EntityMinecartChest) {
				RenderUtils.blockESP(e.getPosition(), Color.green, 1.0, 1.0);
			}
			if (e instanceof EntityMinecartFurnace || e instanceof EntityMinecartHopper) {
				RenderUtils.blockESP(e.getPosition(), Color.white, 1.0, 1.0);
			}
		}
	}
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:45,代码来源:StorageESP.java


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