use of mcjty.rftoolsdim.dimensions.DimensionInformation in project RFToolsDimensions by McJty.
the class GenericWorldGenerator method generate.
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
RfToolsDimensionManager manager = RfToolsDimensionManager.getDimensionManager(world);
if (manager.getDimensionDescriptor(world.provider.getDimension()) == null) {
// Not an RFTools dimension
return;
}
DimensionInformation information = manager.getDimensionInformation(world.provider.getDimension());
IBlockState baseBlock = information.getBaseBlockForTerrain();
if (information.hasFeatureType(FeatureType.FEATURE_OREGEN)) {
for (IBlockState block : information.getExtraOregen()) {
addOreSpawn(block, baseBlock, world, random, chunkX * 16, chunkZ * 16, 7, 10, 12, 2, 60);
}
}
Block dimensionalShardBlock = ForgeRegistries.BLOCKS.getValue(new ResourceLocation("rftools", "dimensional_shard_ore"));
addOreSpawn(dimensionalShardBlock.getDefaultState(), Blocks.STONE.getDefaultState(), world, random, chunkX * 16, chunkZ * 16, WorldgenConfiguration.oreMinimumVeinSize, WorldgenConfiguration.oreMaximumVeinSize, WorldgenConfiguration.oreMaximumVeinCount, WorldgenConfiguration.oreMinimumHeight, WorldgenConfiguration.oreMaximumHeight);
if (information.isPatreonBitSet(PatreonType.PATREON_PUPPETEER) && Math.abs(chunkX) <= 1 && Math.abs(chunkZ) <= 1) {
generateBigSpawnPlatform(world, chunkX, chunkZ, puppeteerSpawnPlatform);
} else if (chunkX == 0 && chunkZ == 0) {
generateSpawnPlatform(world);
} else if ((Math.abs(chunkX) > 6 || Math.abs(chunkZ) > 6) && !information.hasFeatureType(FeatureType.FEATURE_NODIMLETBUILDINGS)) {
// Not too close to starting platform we possibly generate dungeons.
if (random.nextInt(WorldgenConfiguration.dungeonChance) == 1) {
generateDimletDungeon(random, chunkX, chunkZ, world);
}
}
if ((Math.abs(chunkX) >= 2 || Math.abs(chunkZ) >= 2) && information.isPatreonBitSet(PatreonType.PATREON_COLOREDPRISMS)) {
if (random.nextInt(10) == 1) {
generatePrism(chunkX, chunkZ, world);
}
}
if ((Math.abs(chunkX) >= 1 || Math.abs(chunkZ) >= 1) && information.isPatreonBitSet(PatreonType.PATREON_PINKPILLARS)) {
if (random.nextInt(2) == 1) {
generatePillar(random, chunkX, chunkZ, world);
}
}
if ((Math.abs(chunkX) >= 3 || Math.abs(chunkZ) >= 3) && information.hasFeatureType(FeatureType.FEATURE_VOLCANOES)) {
if (random.nextInt(WorldgenConfiguration.volcanoChance) == 1) {
generateVolcano(random, chunkX, chunkZ, world);
}
}
if (information.getTerrainType() == TerrainType.TERRAIN_LOSTCITIES) {
generateLootSpawners(random, chunkX, chunkZ, world);
generateVines(random, chunkX, chunkZ, world);
}
}
use of mcjty.rftoolsdim.dimensions.DimensionInformation in project RFToolsDimensions by McJty.
the class EssencePainterTileEntity method setName.
private void setName(String name) {
ItemStack realizedTab = inventoryHelper.getStackInSlot(EssencePainterContainer.SLOT_TAB);
if (realizedTab != null) {
NBTTagCompound tagCompound = realizedTab.getTagCompound();
if (tagCompound == null) {
tagCompound = new NBTTagCompound();
realizedTab.setTagCompound(tagCompound);
}
tagCompound.setString("name", name);
if (tagCompound.hasKey("id")) {
Integer id = tagCompound.getInteger("id");
RfToolsDimensionManager dimensionManager = RfToolsDimensionManager.getDimensionManager(getWorld());
DimensionInformation information = dimensionManager.getDimensionInformation(id);
if (information != null) {
information.setName(name);
dimensionManager.save(getWorld());
}
}
markDirty();
}
}
use of mcjty.rftoolsdim.dimensions.DimensionInformation in project RFToolsDimensions by McJty.
the class ActivityProbeBlock method breakBlock.
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state) {
super.breakBlock(world, pos, state);
if (!world.isRemote) {
RfToolsDimensionManager dimensionManager = RfToolsDimensionManager.getDimensionManager(world);
DimensionInformation information = dimensionManager.getDimensionInformation(world.provider.getDimension());
if (information != null) {
information.removeProbe();
}
dimensionManager.save(world);
}
}
use of mcjty.rftoolsdim.dimensions.DimensionInformation in project RFToolsDimensions by McJty.
the class CmdListDimensions method execute.
@Override
public void execute(ICommandSender sender, String[] args) {
WorldServer[] worlds = DimensionManager.getWorlds();
for (WorldServer world : worlds) {
int id = world.provider.getDimension();
String dimName = world.provider.getDimensionType().getName();
ITextComponent component = new TextComponentString(" Loaded: id:" + id + ", " + dimName);
if (sender instanceof EntityPlayer) {
((EntityPlayer) sender).sendStatusMessage(component, false);
} else {
sender.sendMessage(component);
}
}
RfToolsDimensionManager dimensionManager = RfToolsDimensionManager.getDimensionManager(sender.getEntityWorld());
DimensionStorage dimensionStorage = DimensionStorage.getDimensionStorage(sender.getEntityWorld());
for (Map.Entry<Integer, DimensionDescriptor> me : dimensionManager.getDimensions().entrySet()) {
int id = me.getKey();
DimensionInformation dimensionInformation = dimensionManager.getDimensionInformation(id);
String dimName = dimensionInformation.getName();
int energy = dimensionStorage.getEnergyLevel(id);
String ownerName = dimensionInformation.getOwnerName();
if (ownerName != null && !ownerName.isEmpty()) {
ITextComponent component = new TextComponentString(" RfTools: id:" + id + ", " + dimName + " (power " + energy + ") (owner " + ownerName + ")");
if (sender instanceof EntityPlayer) {
((EntityPlayer) sender).sendStatusMessage(component, false);
} else {
sender.sendMessage(component);
}
} else {
ITextComponent component = new TextComponentString(" RfTools: id:" + id + ", " + dimName + " (power " + energy + ")");
if (sender instanceof EntityPlayer) {
((EntityPlayer) sender).sendStatusMessage(component, false);
} else {
sender.sendMessage(component);
}
}
}
}
use of mcjty.rftoolsdim.dimensions.DimensionInformation in project RFToolsDimensions by McJty.
the class CmdSetPower method execute.
@Override
public void execute(ICommandSender sender, String[] args) {
if (args.length > 2) {
ITextComponent component = new TextComponentString(TextFormatting.RED + "Too many parameters!");
if (sender instanceof EntityPlayer) {
((EntityPlayer) sender).sendStatusMessage(component, false);
} else {
sender.sendMessage(component);
}
return;
}
int rf = fetchInt(sender, args, 1, PowerConfiguration.MAX_DIMENSION_POWER);
World world = sender.getEntityWorld();
int dim = world.provider.getDimension();
RfToolsDimensionManager dimensionManager = RfToolsDimensionManager.getDimensionManager(world);
DimensionInformation information = dimensionManager.getDimensionInformation(dim);
if (information == null) {
ITextComponent component = new TextComponentString(TextFormatting.RED + "Not an RFTools dimension!");
if (sender instanceof EntityPlayer) {
((EntityPlayer) sender).sendStatusMessage(component, false);
} else {
sender.sendMessage(component);
}
return;
}
DimensionStorage storage = DimensionStorage.getDimensionStorage(world);
storage.setEnergyLevel(dim, rf);
storage.save(world);
}
Aggregations