當前位置: 首頁>>代碼示例>>Java>>正文


Java StructureBoundingBox.isVecInside方法代碼示例

本文整理匯總了Java中net.minecraft.world.gen.structure.StructureBoundingBox.isVecInside方法的典型用法代碼示例。如果您正苦於以下問題:Java StructureBoundingBox.isVecInside方法的具體用法?Java StructureBoundingBox.isVecInside怎麽用?Java StructureBoundingBox.isVecInside使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.world.gen.structure.StructureBoundingBox的用法示例。


在下文中一共展示了StructureBoundingBox.isVecInside方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: spawnBailey

import net.minecraft.world.gen.structure.StructureBoundingBox; //導入方法依賴的package包/類
protected void spawnBailey(World worldIn, StructureBoundingBox structurebb, int x, int y, int z, int count)
  {
      int j = this.getXWithOffset(x, z);
      int k = this.getYWithOffset(y);
      int l = this.getZWithOffset(x, z);

      if (!structurebb.isVecInside(new BlockPos(j, k, l)))
      {
          return;
      }
      
      EntityBailey bailey = new EntityBailey(worldIn);
bailey.setLocationAndAngles((double) j + 0.5D, (double) k, (double) l + 0.5D, 180F, 0.0F);
      bailey.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(bailey)), (IEntityLivingData)null);
      worldIn.spawnEntity(bailey);
  }
 
開發者ID:ToroCraft,項目名稱:Dailies,代碼行數:17,代碼來源:BaileysShopVillagePiece.java

示例2: addComponentParts

import net.minecraft.world.gen.structure.StructureBoundingBox; //導入方法依賴的package包/類
/**
 * second Part of Structure generating, this for example places Spiderwebs,
 * Mob Spawners, it closes Mineshafts at the end, it adds Fences...
 */
@Override
public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox)
{
    final Block var4 = this.getBiomeSpecificBlock(Blocks.planks, 0);

    for (int var5 = this.boundingBox.minX; var5 <= this.boundingBox.maxX; ++var5)
    {
        for (int var6 = this.boundingBox.minZ; var6 <= this.boundingBox.maxZ; ++var6)
        {
            if (par3StructureBoundingBox.isVecInside(var5, 64, var6) && (par1World.getBlock(var5, par1World.getTopSolidOrLiquidBlock(var5, var6) - 1, var6) == GCBlocks.blockMoon && par1World.getBlockMetadata(var5, par1World.getTopSolidOrLiquidBlock(var5, var6) - 1, var6) == 5 || Blocks.air == par1World.getBlock(var5, par1World.getTopSolidOrLiquidBlock(var5, var6) - 1, var6)))
            {
                final int var7 = par1World.getTopSolidOrLiquidBlock(var5, var6) - 1;
                par1World.setBlock(var5, var7, var6, var4, 1, 3);
            }
        }
    }

    return true;
}
 
開發者ID:4Space,項目名稱:4Space-5,代碼行數:24,代碼來源:StructureComponentVillagePathGen.java

示例3: placeSpawnerAtCurrentPosition

import net.minecraft.world.gen.structure.StructureBoundingBox; //導入方法依賴的package包/類
protected void placeSpawnerAtCurrentPosition(World var1, Random var2, int var3, int var4, int var5, String var6, StructureBoundingBox var7)
{
    final int var8 = this.getXWithOffset(var3, var5);
    final int var9 = this.getYWithOffset(var4);
    final int var10 = this.getZWithOffset(var3, var5);

    if (var7.isVecInside(var8, var9, var10) && var1.getBlock(var8, var9, var10) != Blocks.mob_spawner)
    {
        var1.setBlock(var8, var9, var10, Blocks.mob_spawner, 0, 3);
        final TileEntityMobSpawner var11 = (TileEntityMobSpawner) var1.getTileEntity(var8, var9, var10);

        if (var11 != null)
        {
            var11.func_145881_a().setEntityName(var6);
        }
    }
}
 
開發者ID:4Space,項目名稱:4Space-5,代碼行數:18,代碼來源:StructureComponentGC.java

示例4: getAverageGroundLevel

import net.minecraft.world.gen.structure.StructureBoundingBox; //導入方法依賴的package包/類
protected int getAverageGroundLevel(World par1World, StructureBoundingBox par2StructureBoundingBox)
{
    int var3 = 0;
    int var4 = 0;

    for (int var5 = this.boundingBox.minZ; var5 <= this.boundingBox.maxZ; ++var5)
    {
        for (int var6 = this.boundingBox.minX; var6 <= this.boundingBox.maxX; ++var6)
        {
            if (par2StructureBoundingBox.isVecInside(var6, 64, var5))
            {
                var3 += Math.max(par1World.getTopSolidOrLiquidBlock(var6, var5), par1World.provider.getAverageGroundLevel());
                ++var4;
            }
        }
    }

    if (var4 == 0)
    {
        return -1;
    }
    else
    {
        return var3 / var4;
    }
}
 
開發者ID:4Space,項目名稱:4Space-5,代碼行數:27,代碼來源:StructureComponentVillage.java

示例5: spawnVillagers

import net.minecraft.world.gen.structure.StructureBoundingBox; //導入方法依賴的package包/類
protected void spawnVillagers(World par1World, StructureBoundingBox par2StructureBoundingBox, int par3, int par4, int par5, int par6)
{
    if (this.villagersSpawned < par6)
    {
        for (int var7 = this.villagersSpawned; var7 < par6; ++var7)
        {
            int var8 = this.getXWithOffset(par3 + var7, par5);
            final int var9 = this.getYWithOffset(par4);
            int var10 = this.getZWithOffset(par3 + var7, par5);

            var8 += par1World.rand.nextInt(3) - 1;
            var10 += par1World.rand.nextInt(3) - 1;

            if (!par2StructureBoundingBox.isVecInside(var8, var9, var10))
            {
                break;
            }

            ++this.villagersSpawned;
            final EntityAlienVillager var11 = new EntityAlienVillager(par1World);
            var11.setLocationAndAngles(var8 + 0.5D, var9, var10 + 0.5D, 0.0F, 0.0F);
            par1World.spawnEntityInWorld(var11);
        }
    }
}
 
開發者ID:4Space,項目名稱:4Space-5,代碼行數:26,代碼來源:StructureComponentVillage.java

示例6: getAverageGroundLevel

import net.minecraft.world.gen.structure.StructureBoundingBox; //導入方法依賴的package包/類
protected int getAverageGroundLevel(World par1World, StructureBoundingBox par2StructureBoundingBox) {
	int var3 = 0;
	int var4 = 0;

	for (int var5 = this.boundingBox.minZ; var5 <= this.boundingBox.maxZ; ++var5) {
		for (int var6 = this.boundingBox.minX; var6 <= this.boundingBox.maxX; ++var6) {
			if (par2StructureBoundingBox.isVecInside(var6, 64, var5)) {
				var3 += Math.max(par1World.getTopSolidOrLiquidBlock(var6, var5), par1World.provider.getAverageGroundLevel());
				++var4;
			}
		}
	}

	if (var4 == 0) {
		return -1;
	} else {
		return var3 / var4;
	}
}
 
開發者ID:4Space,項目名稱:4Space-5,代碼行數:20,代碼來源:PitStructureComponentRoom.java

示例7: spawnVillagers

import net.minecraft.world.gen.structure.StructureBoundingBox; //導入方法依賴的package包/類
protected void spawnVillagers(World par1World, StructureBoundingBox par2StructureBoundingBox, int par3, int par4, int par5, int par6) {
	if (this.villagersSpawned < par6) {
		for (int var7 = this.villagersSpawned; var7 < par6; ++var7) {
			int var8 = this.getXWithOffset(par3 + var7, par5);
			final int var9 = this.getYWithOffset(par4);
			int var10 = this.getZWithOffset(par3 + var7, par5);

			var8 += par1World.rand.nextInt(3) - 1;
			var10 += par1World.rand.nextInt(3) - 1;

			if (!par2StructureBoundingBox.isVecInside(var8, var9, var10)) {
				break;
			}

			++this.villagersSpawned;
			final EntityAlienVillager var11 = new EntityAlienVillager(par1World);
			var11.setLocationAndAngles(var8 + 0.5D, var9, var10 + 0.5D, 0.0F, 0.0F);
			par1World.spawnEntityInWorld(var11);
		}
	}
}
 
開發者ID:4Space,項目名稱:4Space-5,代碼行數:22,代碼來源:VillageStructureComponent.java

示例8: addComponentParts

import net.minecraft.world.gen.structure.StructureBoundingBox; //導入方法依賴的package包/類
/**
 * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at the end, it adds Fences...
 */
@Override
public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) {
	final Block var4 = this.getBiomeSpecificBlock(Blocks.planks, 0);

	for (int var5 = this.boundingBox.minX; var5 <= this.boundingBox.maxX; ++var5) {
		for (int var6 = this.boundingBox.minZ; var6 <= this.boundingBox.maxZ; ++var6) {
			if (par3StructureBoundingBox.isVecInside(var5, 64, var6) && (par1World.getBlock(var5, par1World.getTopSolidOrLiquidBlock(var5, var6) - 1, var6) == GCBlocks.blockMoon && par1World.getBlockMetadata(var5, par1World.getTopSolidOrLiquidBlock(var5, var6) - 1, var6) == 5 || Blocks.air == par1World.getBlock(var5, par1World.getTopSolidOrLiquidBlock(var5, var6) - 1, var6))) {
				final int var7 = par1World.getTopSolidOrLiquidBlock(var5, var6) - 1;
				par1World.setBlock(var5, var7, var6, var4, 1, 3);
			}
		}
	}

	return true;
}
 
開發者ID:4Space,項目名稱:4Space-5,代碼行數:19,代碼來源:VillageStructureComponentPathGen.java

示例9: placeChest

import net.minecraft.world.gen.structure.StructureBoundingBox; //導入方法依賴的package包/類
protected boolean placeChest(World world, StructureBoundingBox box, Random rand, int x, int y, int z, EnumFacing f, boolean a) {
	int i1 = this.getXWithOffset(x, z);
	int j1 = this.getYWithOffset(y);
	int k1 = this.getZWithOffset(x, z);
	BlockPos pos = new BlockPos(i1, j1, k1);
	if (f.getAxis() == Axis.Y)
		f = EnumFacing.NORTH;
	if (box.isVecInside(pos) && (world.getBlockState(pos).getBlock() != Blocks.CHEST)) {
		world.setBlockState(pos, Blocks.CHEST.getDefaultState().withProperty(BlockChest.FACING, f), 2);
		TileEntity tile = world.getTileEntity(pos);
		if (tile instanceof TileEntityChest)
			((TileEntityChest) tile).setLootTable(a ? loot2 : rand.nextInt(10) < 2 ? lootB : loot, rand.nextLong());
		return true;
	} else
		return false;
}
 
開發者ID:tom5454,項目名稱:Toms-Mod,代碼行數:17,代碼來源:VillageHouseScientist.java

示例10: addComponentParts

import net.minecraft.world.gen.structure.StructureBoundingBox; //導入方法依賴的package包/類
/**
 * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes
 * Mineshafts at the end, it adds Fences...
 */
public boolean addComponentParts(World p_74875_1_, Random p_74875_2_, StructureBoundingBox p_74875_3_)
{
    Block block = this.func_151558_b(Blocks.gravel, 0);

    for (int i = this.boundingBox.minX; i <= this.boundingBox.maxX; ++i)
    {
        for (int j = this.boundingBox.minZ; j <= this.boundingBox.maxZ; ++j)
        {
            if (p_74875_3_.isVecInside(i, 64, j))
            {
                int k = p_74875_1_.getTopSolidOrLiquidBlock(i, j) - 1;
                p_74875_1_.setBlock(i, k, j, block, 0, 2);
            }
        }
    }

    return true;
}
 
開發者ID:jtrent238,項目名稱:PopularMMOS-EpicProportions-Mod,代碼行數:23,代碼來源:StructureVillagePieces.java

示例11: spawnVillagers

import net.minecraft.world.gen.structure.StructureBoundingBox; //導入方法依賴的package包/類
/**
 * Spawns a number of villagers in this component. Parameters: world, component bounding box, x offset, y
 * offset, z offset, number of villagers
 */
protected void spawnVillagers(World p_74893_1_, StructureBoundingBox p_74893_2_, int p_74893_3_, int p_74893_4_, int p_74893_5_, int p_74893_6_)
{
    if (this.villagersSpawned < p_74893_6_)
    {
        for (int i1 = this.villagersSpawned; i1 < p_74893_6_; ++i1)
        {
            int j1 = this.getXWithOffset(p_74893_3_ + i1, p_74893_5_);
            int k1 = this.getYWithOffset(p_74893_4_);
            int l1 = this.getZWithOffset(p_74893_3_ + i1, p_74893_5_);

            if (!p_74893_2_.isVecInside(j1, k1, l1))
            {
                break;
            }

            ++this.villagersSpawned;
            EntityVillager entityvillager = new EntityVillager(p_74893_1_, this.getVillagerType(i1));
            entityvillager.setLocationAndAngles((double)j1 + 0.5D, (double)k1, (double)l1 + 0.5D, 0.0F, 0.0F);
            p_74893_1_.spawnEntityInWorld(entityvillager);
        }
    }
}
 
開發者ID:jtrent238,項目名稱:PopularMMOS-EpicProportions-Mod,代碼行數:27,代碼來源:StructureVillagePieces.java

示例12: getDataBlocks

import net.minecraft.world.gen.structure.StructureBoundingBox; //導入方法依賴的package包/類
public Map<BlockPos, String> getDataBlocks(BlockPos pos, PlacementSettings placementIn)
{
    Map<BlockPos, String> map = Maps.<BlockPos, String>newHashMap();
    StructureBoundingBox structureboundingbox = placementIn.getBoundingBox();

    for (Template.BlockInfo template$blockinfo : this.blocks)
    {
        BlockPos blockpos = transformedBlockPos(placementIn, template$blockinfo.pos).add(pos);

        if (structureboundingbox == null || structureboundingbox.isVecInside(blockpos))
        {
            IBlockState iblockstate = template$blockinfo.blockState;

            if (iblockstate.getBlock() instanceof BlockStructure && template$blockinfo.tileentityData != null)
            {
                TileEntityStructure.Mode tileentitystructure$mode = TileEntityStructure.Mode.valueOf(template$blockinfo.tileentityData.getString("mode"));

                if (tileentitystructure$mode == TileEntityStructure.Mode.DATA)
                {
                    map.put(blockpos, template$blockinfo.tileentityData.getString("metadata"));
                }
            }
        }
    }

    return map;
}
 
開發者ID:kenijey,項目名稱:harshencastle,代碼行數:28,代碼來源:HarshenTemplate.java

示例13: addEntitiesToWorld

import net.minecraft.world.gen.structure.StructureBoundingBox; //導入方法依賴的package包/類
private void addEntitiesToWorld(World worldIn, BlockPos pos, Mirror mirrorIn, Rotation rotationIn, @Nullable StructureBoundingBox aabb)
{
    for (Template.EntityInfo template$entityinfo : this.entities)
    {
        BlockPos blockpos = transformedBlockPos(template$entityinfo.blockPos, mirrorIn, rotationIn).add(pos);

        if (aabb == null || aabb.isVecInside(blockpos))
        {
            NBTTagCompound nbttagcompound = template$entityinfo.entityData;
            Vec3d vec3d = transformedVec3d(template$entityinfo.pos, mirrorIn, rotationIn);
            Vec3d vec3d1 = vec3d.addVector((double)pos.getX(), (double)pos.getY(), (double)pos.getZ());
            NBTTagList nbttaglist = new NBTTagList();
            nbttaglist.appendTag(new NBTTagDouble(vec3d1.x));
            nbttaglist.appendTag(new NBTTagDouble(vec3d1.y));
            nbttaglist.appendTag(new NBTTagDouble(vec3d1.z));
            nbttagcompound.setTag("Pos", nbttaglist);
            nbttagcompound.setUniqueId("UUID", UUID.randomUUID());
            Entity entity;

            try
            {
                entity = EntityList.createEntityFromNBT(nbttagcompound, worldIn);
            }
            catch (Exception var15)
            {
                entity = null;
            }

            if (entity != null)
            {
                float f = entity.getMirroredYaw(mirrorIn);
                f = f + (entity.rotationYaw - entity.getRotatedYaw(rotationIn));
                entity.setLocationAndAngles(vec3d1.x, vec3d1.y, vec3d1.z, f, entity.rotationPitch);
                worldIn.spawnEntity(entity);
            }
        }
    }
}
 
開發者ID:kenijey,項目名稱:harshencastle,代碼行數:39,代碼來源:HarshenTemplate.java

示例14: getDataBlocks

import net.minecraft.world.gen.structure.StructureBoundingBox; //導入方法依賴的package包/類
public Map<BlockPos, String> getDataBlocks(BlockPos pos, PlacementSettings placementIn)
{
    Map<BlockPos, String> map = Maps.<BlockPos, String>newHashMap();
    StructureBoundingBox structureboundingbox = placementIn.getBoundingBox();

    for (Template.BlockInfo template$blockinfo : this.blocks)
    {
        BlockPos blockpos = transformedBlockPos(placementIn, template$blockinfo.pos).add(pos);

        if (structureboundingbox == null || structureboundingbox.isVecInside(blockpos))
        {
            IBlockState iblockstate = template$blockinfo.blockState;

            if (iblockstate.getBlock() == Blocks.STRUCTURE_BLOCK && template$blockinfo.tileentityData != null)
            {
                TileEntityStructure.Mode tileentitystructure$mode = TileEntityStructure.Mode.valueOf(template$blockinfo.tileentityData.getString("mode"));

                if (tileentitystructure$mode == TileEntityStructure.Mode.DATA)
                {
                    map.put(blockpos, template$blockinfo.tileentityData.getString("metadata"));
                }
            }
        }
    }

    return map;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:28,代碼來源:Template.java

示例15: addEntitiesToWorld

import net.minecraft.world.gen.structure.StructureBoundingBox; //導入方法依賴的package包/類
private void addEntitiesToWorld(World worldIn, BlockPos pos, Mirror mirrorIn, Rotation rotationIn, @Nullable StructureBoundingBox aabb)
{
    for (Template.EntityInfo template$entityinfo : this.entities)
    {
        BlockPos blockpos = transformedBlockPos(template$entityinfo.blockPos, mirrorIn, rotationIn).add(pos);

        if (aabb == null || aabb.isVecInside(blockpos))
        {
            NBTTagCompound nbttagcompound = template$entityinfo.entityData;
            Vec3d vec3d = transformedVec3d(template$entityinfo.pos, mirrorIn, rotationIn);
            Vec3d vec3d1 = vec3d.addVector((double)pos.getX(), (double)pos.getY(), (double)pos.getZ());
            NBTTagList nbttaglist = new NBTTagList();
            nbttaglist.appendTag(new NBTTagDouble(vec3d1.xCoord));
            nbttaglist.appendTag(new NBTTagDouble(vec3d1.yCoord));
            nbttaglist.appendTag(new NBTTagDouble(vec3d1.zCoord));
            nbttagcompound.setTag("Pos", nbttaglist);
            nbttagcompound.setUniqueId("UUID", UUID.randomUUID());
            Entity entity;

            try
            {
                entity = EntityList.createEntityFromNBT(nbttagcompound, worldIn);
            }
            catch (Exception var15)
            {
                entity = null;
            }

            if (entity != null)
            {
                float f = entity.getMirroredYaw(mirrorIn);
                f = f + (entity.rotationYaw - entity.getRotatedYaw(rotationIn));
                entity.setLocationAndAngles(vec3d1.xCoord, vec3d1.yCoord, vec3d1.zCoord, f, entity.rotationPitch);
                worldIn.spawnEntityInWorld(entity);
            }
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:39,代碼來源:Template.java


注:本文中的net.minecraft.world.gen.structure.StructureBoundingBox.isVecInside方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。