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


Java WorldServer.getStructureTemplateManager方法代码示例

本文整理汇总了Java中net.minecraft.world.WorldServer.getStructureTemplateManager方法的典型用法代码示例。如果您正苦于以下问题:Java WorldServer.getStructureTemplateManager方法的具体用法?Java WorldServer.getStructureTemplateManager怎么用?Java WorldServer.getStructureTemplateManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.world.WorldServer的用法示例。


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

示例1: generate

import net.minecraft.world.WorldServer; //导入方法依赖的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.WorldServer; //导入方法依赖的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: save

import net.minecraft.world.WorldServer; //导入方法依赖的package包/类
public boolean save(boolean p_189712_1_)
{
    if (this.mode == TileEntityStructure.Mode.SAVE && !this.world.isRemote && !StringUtils.isNullOrEmpty(this.name))
    {
        BlockPos blockpos = this.getPos().add(this.position);
        WorldServer worldserver = (WorldServer)this.world;
        MinecraftServer minecraftserver = this.world.getMinecraftServer();
        TemplateManager templatemanager = worldserver.getStructureTemplateManager();
        Template template = templatemanager.getTemplate(minecraftserver, new ResourceLocation(this.name));
        template.takeBlocksFromWorld(this.world, blockpos, this.size, !this.ignoreEntities, Blocks.STRUCTURE_VOID);
        template.setAuthor(this.author);
        return !p_189712_1_ || templatemanager.writeTemplate(minecraftserver, new ResourceLocation(this.name));
    }
    else
    {
        return false;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:19,代码来源:TileEntityStructure.java

示例4: save

import net.minecraft.world.WorldServer; //导入方法依赖的package包/类
public boolean save(boolean p_189712_1_)
{
    if (this.mode == TileEntityStructure.Mode.SAVE && !this.worldObj.isRemote && !StringUtils.isNullOrEmpty(this.name))
    {
        BlockPos blockpos = this.getPos().add(this.position);
        WorldServer worldserver = (WorldServer)this.worldObj;
        MinecraftServer minecraftserver = this.worldObj.getMinecraftServer();
        TemplateManager templatemanager = worldserver.getStructureTemplateManager();
        Template template = templatemanager.getTemplate(minecraftserver, new ResourceLocation(this.name));
        template.takeBlocksFromWorld(this.worldObj, blockpos, this.size, !this.ignoreEntities, Blocks.STRUCTURE_VOID);
        template.setAuthor(this.author);
        return !p_189712_1_ || templatemanager.writeTemplate(minecraftserver, new ResourceLocation(this.name));
    }
    else
    {
        return false;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:19,代码来源:TileEntityStructure.java

示例5: isStructureLoadable

import net.minecraft.world.WorldServer; //导入方法依赖的package包/类
public boolean isStructureLoadable()
{
    if (this.mode == TileEntityStructure.Mode.LOAD && !this.world.isRemote)
    {
        WorldServer worldserver = (WorldServer)this.world;
        MinecraftServer minecraftserver = this.world.getMinecraftServer();
        TemplateManager templatemanager = worldserver.getStructureTemplateManager();
        return templatemanager.get(minecraftserver, new ResourceLocation(this.name)) != null;
    }
    else
    {
        return false;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:15,代码来源:TileEntityStructure.java

示例6: isStructureLoadable

import net.minecraft.world.WorldServer; //导入方法依赖的package包/类
public boolean isStructureLoadable()
{
    if (this.mode == TileEntityStructure.Mode.LOAD && !this.worldObj.isRemote)
    {
        WorldServer worldserver = (WorldServer)this.worldObj;
        MinecraftServer minecraftserver = this.worldObj.getMinecraftServer();
        TemplateManager templatemanager = worldserver.getStructureTemplateManager();
        return templatemanager.get(minecraftserver, new ResourceLocation(this.name)) != null;
    }
    else
    {
        return false;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:15,代码来源:TileEntityStructure.java

示例7: load

import net.minecraft.world.WorldServer; //导入方法依赖的package包/类
public boolean load(boolean p_189714_1_)
{
    if (this.mode == TileEntityStructure.Mode.LOAD && !this.world.isRemote && !StringUtils.isNullOrEmpty(this.name))
    {
        BlockPos blockpos = this.getPos();
        BlockPos blockpos1 = blockpos.add(this.position);
        WorldServer worldserver = (WorldServer)this.world;
        MinecraftServer minecraftserver = this.world.getMinecraftServer();
        TemplateManager templatemanager = worldserver.getStructureTemplateManager();
        Template template = templatemanager.get(minecraftserver, new ResourceLocation(this.name));

        if (template == null)
        {
            return false;
        }
        else
        {
            if (!StringUtils.isNullOrEmpty(template.getAuthor()))
            {
                this.author = template.getAuthor();
            }

            BlockPos blockpos2 = template.getSize();
            boolean flag = this.size.equals(blockpos2);

            if (!flag)
            {
                this.size = blockpos2;
                this.markDirty();
                IBlockState iblockstate = this.world.getBlockState(blockpos);
                this.world.notifyBlockUpdate(blockpos, iblockstate, iblockstate, 3);
            }

            if (p_189714_1_ && !flag)
            {
                return false;
            }
            else
            {
                PlacementSettings placementsettings = (new PlacementSettings()).setMirror(this.mirror).setRotation(this.rotation).setIgnoreEntities(this.ignoreEntities).setChunk((ChunkPos)null).setReplacedBlock((Block)null).setIgnoreStructureBlock(false);

                if (this.integrity < 1.0F)
                {
                    placementsettings.setIntegrity(MathHelper.clamp(this.integrity, 0.0F, 1.0F)).setSeed(Long.valueOf(this.seed));
                }

                template.addBlocksToWorldChunk(this.world, blockpos1, placementsettings);
                return true;
            }
        }
    }
    else
    {
        return false;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:57,代码来源:TileEntityStructure.java

示例8: unloadStructure

import net.minecraft.world.WorldServer; //导入方法依赖的package包/类
public void unloadStructure()
{
    WorldServer worldserver = (WorldServer)this.world;
    TemplateManager templatemanager = worldserver.getStructureTemplateManager();
    templatemanager.remove(new ResourceLocation(this.name));
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:7,代码来源:TileEntityStructure.java

示例9: load

import net.minecraft.world.WorldServer; //导入方法依赖的package包/类
public boolean load(boolean p_189714_1_)
{
    if (this.mode == TileEntityStructure.Mode.LOAD && !this.worldObj.isRemote && !StringUtils.isNullOrEmpty(this.name))
    {
        BlockPos blockpos = this.getPos();
        BlockPos blockpos1 = blockpos.add(this.position);
        WorldServer worldserver = (WorldServer)this.worldObj;
        MinecraftServer minecraftserver = this.worldObj.getMinecraftServer();
        TemplateManager templatemanager = worldserver.getStructureTemplateManager();
        Template template = templatemanager.get(minecraftserver, new ResourceLocation(this.name));

        if (template == null)
        {
            return false;
        }
        else
        {
            if (!StringUtils.isNullOrEmpty(template.getAuthor()))
            {
                this.author = template.getAuthor();
            }

            BlockPos blockpos2 = template.getSize();
            boolean flag = this.size.equals(blockpos2);

            if (!flag)
            {
                this.size = blockpos2;
                this.markDirty();
                IBlockState iblockstate = this.worldObj.getBlockState(blockpos);
                this.worldObj.notifyBlockUpdate(blockpos, iblockstate, iblockstate, 3);
            }

            if (p_189714_1_ && !flag)
            {
                return false;
            }
            else
            {
                PlacementSettings placementsettings = (new PlacementSettings()).setMirror(this.mirror).setRotation(this.rotation).setIgnoreEntities(this.ignoreEntities).setChunk((ChunkPos)null).setReplacedBlock((Block)null).setIgnoreStructureBlock(false);

                if (this.integrity < 1.0F)
                {
                    placementsettings.setIntegrity(MathHelper.clamp_float(this.integrity, 0.0F, 1.0F)).setSeed(Long.valueOf(this.seed));
                }

                template.addBlocksToWorldChunk(this.worldObj, blockpos1, placementsettings);
                return true;
            }
        }
    }
    else
    {
        return false;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:57,代码来源:TileEntityStructure.java

示例10: unloadStructure

import net.minecraft.world.WorldServer; //导入方法依赖的package包/类
public void unloadStructure()
{
    WorldServer worldserver = (WorldServer)this.worldObj;
    TemplateManager templatemanager = worldserver.getStructureTemplateManager();
    templatemanager.remove(new ResourceLocation(this.name));
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:7,代码来源:TileEntityStructure.java


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