本文整理匯總了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;
}
示例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());
}
}
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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));
}
示例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;
}
}
示例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));
}