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


Java PlacementSettings类代码示例

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


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

示例1: generate

import net.minecraft.world.gen.structure.template.PlacementSettings; //导入依赖的package包/类
@Override
public boolean generate(World world, Random rand, BlockPos position) 
{
	WorldServer server = (WorldServer) world;
	TemplateManager manager = server.getStructureTemplateManager();
	
	Template dungeonEntrance = manager.getTemplate(world.getMinecraftServer(), new ResourceLocation(Reference.MODID, "dungeons/test_entrance"));
	PlacementSettings settings = new PlacementSettings();
	
	if (LSCWorldGenerator.canSpawnHere(dungeonEntrance, world, position))
	{
		LootSlashConquer.LOGGER.info("Generating Dungeon at " + position);
		
		// spawn the entrance on the surface
		BlockPos entrancePos = DungeonHelper.translateToCorner(dungeonEntrance, position, Rotation.NONE);
		dungeonEntrance.addBlocksToWorld(world, entrancePos, new DungeonBlockProcessor(entrancePos, settings, Blocks.NETHER_BRICK, Blocks.NETHERRACK), settings, 2);
		
		// start the procedural generation
		procedurallyGenerate(manager, world, position, this.generateStaircase(manager, world, position));
		
		return true;
	}
	
	return false;
}
 
开发者ID:TheXFactor117,项目名称:Loot-Slash-Conquer,代码行数:26,代码来源:Dungeon.java

示例2: generateOverworldStructures

import net.minecraft.world.gen.structure.template.PlacementSettings; //导入依赖的package包/类
private void generateOverworldStructures(World world, Random random, int posX, int posZ) {

        if(OinkConfig.piggyActive) {
            WorldServer server = (WorldServer) world;
            TemplateManager manager = server.getStructureTemplateManager();

            Template piggy = manager.getTemplate(world.getMinecraftServer(), new ResourceLocation(TheOink.MODID, "pigstructure"));

            if ((int) (Math.random() * OinkConfig.piggyStructChance) == 0) {
                int randX = posX + (int) (Math.random() * 16);
                int randZ = posZ + (int) (Math.random() * 16);
                int groundY = getGroundFromAbove(world, randX, randZ);
                BlockPos pos = new BlockPos(randX, groundY, randZ);

                if (canSpawnHere(piggy, world, pos)) {
                    TheOink.LOGGER.info("Generating Pig at " + pos);
                    piggy.addBlocksToWorld(world, pos, new PlacementSettings());
                    handleDataBlocks(piggy, world, pos, new PlacementSettings());
                }
            }
        }
    }
 
开发者ID:OCDiary,项目名称:TheOink,代码行数:23,代码来源:OinkWorldGenerator.java

示例3: loadAndSetup

import net.minecraft.world.gen.structure.template.PlacementSettings; //导入依赖的package包/类
private void loadAndSetup(BlockPos p_186180_1_)
{
    Template template = StructureEndCityPieces.MANAGER.getTemplate((MinecraftServer)null, new ResourceLocation("endcity/" + this.pieceName));
    PlacementSettings placementsettings;

    if (this.overwrite)
    {
        placementsettings = StructureEndCityPieces.OVERWRITE.copy().setRotation(this.rotation);
    }
    else
    {
        placementsettings = StructureEndCityPieces.INSERT.copy().setRotation(this.rotation);
    }

    this.setup(template, p_186180_1_, placementsettings);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:17,代码来源:StructureEndCityPieces.java

示例4: fixRotationBlockPos

import net.minecraft.world.gen.structure.template.PlacementSettings; //导入依赖的package包/类
/**
 * Inserted in addComponentParts in net.minecraft.world.gen.structure.ComponentScatteredFeaturePieces$Igloo
 *
 * This modifies the blockpos passed to addBlocksToWorldChunk to keep the structure within the original bounding box.
 */
public static BlockPos fixRotationBlockPos(BlockPos bp, PlacementSettings ps, StructureComponent structure) {
    StructureBoundingBox structurebb = structure.getBoundingBox();
    EnumFacing facing = structure.getCoordBaseMode();
    BlockPos newpos = bp;
    switch (facing) {
        case SOUTH:
            ps.setRotation(Rotation.NONE);
            newpos = new BlockPos(structurebb.minX, structurebb.minY, structurebb.minZ);
            break;
        case EAST:
            ps.setRotation(Rotation.COUNTERCLOCKWISE_90);
            newpos = new BlockPos(structurebb.minX, structurebb.minY, structurebb.maxZ);
            break;
        case NORTH:
            ps.setRotation(Rotation.CLOCKWISE_180);
            newpos = new BlockPos(structurebb.maxX, structurebb.minY, structurebb.maxZ);
            break;
        case WEST:
            ps.setRotation(Rotation.CLOCKWISE_90);
            newpos = new BlockPos(structurebb.maxX, structurebb.minY, structurebb.minZ);
            break;
    }
    return newpos;
}
 
开发者ID:MinimumContent,项目名称:muon,代码行数:30,代码来源:MuonHooks.java

示例5: generateHallway

import net.minecraft.world.gen.structure.template.PlacementSettings; //导入依赖的package包/类
private PotentialPosition generateHallway(TemplateManager manager, World world, BlockPos roomCenter, Rotation rotation)
{			
	Template hallway = getRandomizedHallwayTemplate(manager, world); // get hallway and its center position
	BlockPos hallwayCenter = getHallwayPosition(hallway, roomCenter, rotation);
	
	for (BlockPos position : hallwayPositions) // check to make sure hallway can spawn. If not, exit.
	{
		if (position.equals(hallwayCenter))
			return null;
	}

	PlacementSettings settings = new PlacementSettings().setRotation(rotation);
	BlockPos hallwayCorner = translateHallwayToCorner(hallway, hallwayCenter, rotation);
	hallway.addBlocksToWorld(world, hallwayCorner, settings); // add hallway into world at translated position
	handleDataBlocks(hallway, world, hallwayCorner, settings);
	hallwayPositions.add(hallwayCenter); // add hallway to hallwayPositions list
	
	BlockPos potentialPosition = getRoomPosition(getRandomizedDungeonTemplate(manager, world), hallwayCenter, rotation);
	
	return new PotentialPosition(potentialPosition, rotation);
}
 
开发者ID:TheXFactor117,项目名称:Lost-Eclipse-Outdated,代码行数:22,代码来源:ProceduralDungeonBase.java

示例6: getPasteModePlacement

import net.minecraft.world.gen.structure.template.PlacementSettings; //导入依赖的package包/类
private PlacementSettings getPasteModePlacement(ItemStack stack, EntityPlayer player)
{
    EnumFacing facing = this.getTemplateFacing(stack);
    EnumFacing areaFacing = this.getAreaFacing(stack, Mode.PASTE);

    if (areaFacing == null)
    {
        areaFacing = facing;
    }

    Rotation rotation = PositionUtils.getRotation(facing, areaFacing);
    PlacementSettings placement = new PlacementSettings();
    boolean ignoreEntities = player.capabilities.isCreativeMode == false ||
            WandOption.AFFECT_ENTITIES.isEnabled(stack, Mode.PASTE) == false;
    placement.setMirror(this.getMirror(stack));
    placement.setRotation(rotation);
    placement.setIgnoreEntities(ignoreEntities);

    return placement;
}
 
开发者ID:maruohon,项目名称:enderutilities,代码行数:21,代码来源:ItemBuildersWand.java

示例7: generate

import net.minecraft.world.gen.structure.template.PlacementSettings; //导入依赖的package包/类
@Override
public void generate(World world, BlockPos pos)
{
    PlacementSettings settings = new PlacementSettings();
    Template temp = null;
    String suffix = world.provider.getDimensionType().getSuffix();
    String opts = world.getWorldInfo().getGeneratorOptions() + suffix;

    if (!Strings.isNullOrEmpty(opts))
        temp = StructureUtil.loadTemplate(new ResourceLocation(opts), (WorldServer)world, true);
    if (temp == null)
        temp = StructureUtil.loadTemplate(new ResourceLocation("/config/", this.fileName + suffix), (WorldServer)world, !Strings.isNullOrEmpty(suffix));
    if (temp == null)
        return; //If we're not in the overworld, and we don't have a template...

    BlockPos spawn = StructureUtil.findSpawn(temp, settings);
    if (spawn != null)
    {
        pos = pos.subtract(spawn);
        world.setSpawnPoint(pos);
    }

    temp.addBlocksToWorld(world, pos, settings, 0); //Push to world, with no neighbor notifications!
    world.getPendingBlockUpdates(new StructureBoundingBox(pos, pos.add(temp.getSize())), true); //Remove block updates, so that sand doesn't fall!
}
 
开发者ID:LexManos,项目名称:YUNoMakeGoodMap,代码行数:26,代码来源:StructureLoader.java

示例8: generateStaircase

import net.minecraft.world.gen.structure.template.PlacementSettings; //导入依赖的package包/类
/** Generates the staircase underneath the entrance. */
// WORKING
private List<DungeonRoomPosition> generateStaircase(TemplateManager manager, World world, BlockPos entranceCenter)
{
	Template encasedStaircase = manager.getTemplate(world.getMinecraftServer(), new ResourceLocation(Reference.MODID, "dungeons/encased_staircase"));
	Template bottomStaircase = manager.getTemplate(world.getMinecraftServer(), new ResourceLocation(Reference.MODID, "dungeons/bottom_staircase"));
	PlacementSettings settings = new PlacementSettings();
	int depth = 4; // how many staircases are generated?
	
	List<DungeonRoomPosition> list = null;
	
	for (int i = 0; i < depth; i++)
	{
		if (i < depth - 1) // make sure we aren't at the last staircase
		{
			BlockPos encasedStaircasePos = DungeonHelper.translateToCorner(encasedStaircase, entranceCenter.add(0, -4 * (i + 1), 0), Rotation.NONE); // get the staircase position; offset by height and multiply by depth.
			encasedStaircase.addBlocksToWorld(world, encasedStaircasePos, new DungeonBlockProcessor(encasedStaircasePos, settings, Blocks.NETHER_BRICK, Blocks.NETHERRACK), settings, 2);
		}
		else // we know this is the bottom staircase, so spawn bottom staircase and store potential rooms.
		{
			BlockPos bottomStaircaseCenteredPos = entranceCenter.add(0, -4 * (depth - 1) + -5, 0);
			BlockPos bottomStaircasePos = DungeonHelper.translateToCorner(bottomStaircase, bottomStaircaseCenteredPos, Rotation.NONE);
			bottomStaircase.addBlocksToWorld(world, bottomStaircasePos, new DungeonBlockProcessor(bottomStaircasePos, settings, Blocks.NETHER_BRICK, Blocks.NETHERRACK), settings, 2);
			roomList.add(DungeonHelper.getStructureBoundingBox(bottomStaircase, Rotation.NONE, bottomStaircaseCenteredPos)); // add StructureBoundingBox to room list. Used to make sure we don't generate rooms inside of other bounding boxes.
			
			list = this.generatePotentialRooms(manager, world, bottomStaircase, Rotation.NONE, bottomStaircaseCenteredPos, null);
		}
	}
	
	return list;
}
 
开发者ID:TheXFactor117,项目名称:Loot-Slash-Conquer,代码行数:32,代码来源:Dungeon.java

示例9: generateRoom

import net.minecraft.world.gen.structure.template.PlacementSettings; //导入依赖的package包/类
/** Generates a room based on the DungeonRoomPosition passed in. */
@Nullable
private List<DungeonRoomPosition> generateRoom(TemplateManager manager, World world, DungeonRoomPosition drp)
{
	Template template = drp.getTemplate();
	PlacementSettings settings = new PlacementSettings().setRotation(drp.getTemplateRotation());
	BlockPos centeredPosition = drp.getPos();
	BlockPos cornerPosition = DungeonHelper.translateToCorner(template, centeredPosition, settings.getRotation());
	
	template.addBlocksToWorld(world, cornerPosition, new DungeonBlockProcessor(cornerPosition, settings, Blocks.NETHER_BRICK, Blocks.NETHERRACK), settings, 2);
	DungeonHelper.handleDataBlocks(template, world, cornerPosition, settings, 1);
	roomList.add(drp.getBoundingBox());
	
	return this.generatePotentialRooms(manager, world, template, settings.getRotation(), centeredPosition, drp.getSide());
}
 
开发者ID:TheXFactor117,项目名称:Loot-Slash-Conquer,代码行数:16,代码来源:Dungeon.java

示例10: DungeonBlockProcessor

import net.minecraft.world.gen.structure.template.PlacementSettings; //导入依赖的package包/类
public DungeonBlockProcessor(BlockPos pos, PlacementSettings settings)
{
    this.chance = settings.getIntegrity();
    this.random = settings.getRandom(pos);
    this.outerBlock = null;
    this.innerBlock = null;
}
 
开发者ID:TheXFactor117,项目名称:Loot-Slash-Conquer,代码行数:8,代码来源:DungeonBlockProcessor.java

示例11: loadIntoWorld

import net.minecraft.world.gen.structure.template.PlacementSettings; //导入依赖的package包/类
public void loadIntoWorld(World world, BlockPos pos, Random random, boolean useRuin)
{
	if(world.isRemote)
		return;
	preAddition(world, pos, random);
	HarshenTemplate.getTemplate(location).addBlocksToWorld(world, pos, new PlacementSettings().setIgnoreEntities(false).setIgnoreStructureBlock(true), random, useRuin);
	postAddition(world, pos, random);
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:9,代码来源:HarshenStructure.java

示例12: getDataBlocks

import net.minecraft.world.gen.structure.template.PlacementSettings; //导入依赖的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: gen

import net.minecraft.world.gen.structure.template.PlacementSettings; //导入依赖的package包/类
@Override
void gen(World world, int x, int z, IChunkGenerator generator, IChunkProvider provider) {
	random.setSeed(world.getSeed());
	long good = random.nextLong();
	long succ = random.nextLong();

	good *= x >> 3;
	succ *= z >> 3;
	random.setSeed(good * succ * world.getSeed());
	//Generate
	if(GEN_CONFIG.MONOLITH_CONFIG.OBELISK_DECORATOR.rarity > 0D
			&& GEN_CONFIG.MONOLITH_CONFIG.OBELISK_DECORATOR.rarity / 100D > random.nextDouble()) {
		List<AxisAlignedBB> occupied = Lists.newArrayList();
		for(int i = 0; i < GEN_CONFIG.MONOLITH_CONFIG.OBELISK_DECORATOR.size; i++) {
			BlockPos top = world.getTopSolidOrLiquidBlock(randomVector().add(x, 0, z).toBlockPos());
			int below = random.nextInt(7);
			if(top.getY() > below) {
				top = top.add(0, -below, 0);
			}
			Template obelisk = obelisks.next().load(world);
			Rotation rotation = Rotation.values()[random.nextInt(4)];
			Vector3 vec = Vector3.create(obelisk.getSize()).rotate(rotation);
			AxisAlignedBB obeliskBB = new AxisAlignedBB(top, vec.add(top).toBlockPos()).grow(1);
			if(occupied.stream().noneMatch(bb -> bb.intersects(obeliskBB))) {
				PlacementSettings settings = new PlacementSettings();
				settings.setRotation(rotation);
				settings.setRandom(random);
				obelisk.addBlocksToWorld(world, top, settings);

				occupied.add(obeliskBB);
			}
		}
	}
}
 
开发者ID:ArekkuusuJerii,项目名称:Solar,代码行数:35,代码来源:ObeliskDecorator.java

示例14: genCubes

import net.minecraft.world.gen.structure.template.PlacementSettings; //导入依赖的package包/类
private void genCubes(World world, BlockPos pos) {
	//Gen Cube
	BlockPos origin = pos.add(5, 0, 5);
	Template template = Structure.ASHEN_CUBE.load(world);
	boolean loot = GEN_CONFIG.ASHEN_CUBE_STRUCTURE.loot / 100D > random.nextDouble();
	PlacementSettings integrity = new PlacementSettings();
	integrity.setIntegrity(loot ? 1F : 0.35F + 0.45F * random.nextFloat());
	template.addBlocksToWorld(world, origin, integrity);
	integrity.setIntegrity(!loot && random.nextFloat() > 0.45F ? 1F : random.nextFloat());
	Structure.ASHEN_CUBE_.generate(world, origin, integrity);
	//Add loot
	for (int i = 0; i < 6 + random.nextInt(6); i++) {
		loot = GEN_CONFIG.MONOLITH_CONFIG.MONOLITH_STRUCTURE.loot / 100D > random.nextDouble();
		if (loot) {
			BlockPos inside = origin.add(1 + random.nextInt(4), 1, 1 + random.nextInt(4));
			IBlockState pot = ModBlocks.LARGE_POT.getDefaultState().withProperty(State.POT_VARIANT, random.nextInt(3));
			world.setBlockState(inside, pot);
		}
	}
	//Gen Cubes
	AxisAlignedBB cubeBB = new AxisAlignedBB(origin, origin.add(template.getSize()));
	for(int i = 0; i < GEN_CONFIG.ASHEN_CUBE_STRUCTURE.size; i++) {
		Template cube = nuggets.next().load(world);
		Rotation rotation = Rotation.values()[random.nextInt(4)];
		Vector3 vec = Vector3.create(cube.getSize()).rotate(rotation);
		BlockPos offset = randomVector().add(pos).toBlockPos();
		if(offset.getY() < 1  || (world.canSeeSky(offset) && GEN_CONFIG.ASHEN_CUBE_STRUCTURE.underground)) continue;
		AxisAlignedBB nuggetBB = new AxisAlignedBB(offset, vec.add(offset).toBlockPos());
		if(!nuggetBB.intersects(cubeBB)) {
			PlacementSettings settings = new PlacementSettings();
			settings.setIntegrity(random.nextFloat() > 0.85F ? 0.9F : 0.35F + 0.45F * random.nextFloat());
			settings.setRotation(rotation);
			settings.setRandom(random);
			cube.addBlocksToWorld(world, offset, settings);
		}
	}
}
 
开发者ID:ArekkuusuJerii,项目名称:Solar,代码行数:38,代码来源:AshenCubeStructure.java

示例15: setup

import net.minecraft.world.gen.structure.template.PlacementSettings; //导入依赖的package包/类
protected void setup(Template p_186173_1_, BlockPos p_186173_2_, PlacementSettings p_186173_3_)
{
    this.template = p_186173_1_;
    this.setCoordBaseMode(EnumFacing.NORTH);
    this.templatePosition = p_186173_2_;
    this.placeSettings = p_186173_3_;
    this.setBoundingBoxFromTemplate();
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:9,代码来源:StructureComponentTemplate.java


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