use of mcjty.rftoolsdim.config.Settings in project RFToolsDimensions by McJty.
the class DimletWorkbenchTileEntity method startExtracting.
private void startExtracting() {
if (extracting > 0) {
// Already extracting
return;
}
ItemStack stack = inventoryHelper.getStackInSlot(DimletWorkbenchContainer.SLOT_INPUT);
if (!stack.isEmpty()) {
if (ModItems.knownDimletItem.equals(stack.getItem())) {
DimletKey key = KnownDimletConfiguration.getDimletKey(stack);
Settings settings = KnownDimletConfiguration.getSettings(key);
if (settings != null && settings.isDimlet()) {
if (!KnownDimletConfiguration.isCraftable(key)) {
extracting = 64;
idToExtract = key;
inventoryHelper.decrStackSize(DimletWorkbenchContainer.SLOT_INPUT, 1);
markDirty();
}
}
}
}
}
use of mcjty.rftoolsdim.config.Settings in project RFToolsDimensions by McJty.
the class CmdTestDimlet method execute.
@Override
public void execute(ICommandSender sender, String[] args) {
if (args.length != 4) {
ITextComponent component = new TextComponentString(TextFormatting.RED + "Bad parameters!");
if (sender instanceof EntityPlayer) {
((EntityPlayer) sender).sendStatusMessage(component, false);
} else {
sender.sendMessage(component);
}
return;
}
String typeString = fetchString(sender, args, 1, "material");
String mod = fetchString(sender, args, 2, "minecraft");
String name = fetchString(sender, args, 3, "");
DimletType type = DimletType.getTypeByName(typeString);
if (type == null) {
ITextComponent component = new TextComponentString(TextFormatting.RED + "Bad type!");
if (sender instanceof EntityPlayer) {
((EntityPlayer) sender).sendStatusMessage(component, false);
} else {
sender.sendMessage(component);
}
return;
}
Settings settings = DimletRules.getSettings(type, mod, name, Collections.emptySet(), 0, Collections.emptyMap());
ITextComponent component = new TextComponentString(TextFormatting.GREEN + settings.toString());
if (sender instanceof EntityPlayer) {
((EntityPlayer) sender).sendStatusMessage(component, false);
} else {
sender.sendMessage(component);
}
}
use of mcjty.rftoolsdim.config.Settings in project RFToolsDimensions by McJty.
the class DimletDebug method dumpLiquid.
private static void dumpLiquid(Map.Entry<String, Fluid> entry) {
Block block = entry.getValue().getBlock();
if (block != null) {
ResourceLocation nameForObject = Block.REGISTRY.getNameForObject(block);
String mod = nameForObject.getResourceDomain();
DimletKey key = new DimletKey(DimletType.DIMLET_LIQUID, block.getRegistryName() + "@0");
Settings settings = DimletRules.getSettings(key, mod);
Logging.log(key + ": " + settings.toString());
}
}
use of mcjty.rftoolsdim.config.Settings in project RFToolsDimensions by McJty.
the class DimletDebug method dumpDimlets.
public static void dumpDimlets() {
Map<DimletKey, Settings> knownDimlets = KnownDimletConfiguration.getKnownDimlets();
List<DimletKey> keys = new ArrayList<>(knownDimlets.keySet());
keys.sort(null);
for (DimletKey key : keys) {
Settings value = knownDimlets.get(key);
Logging.log(key + ": " + value);
}
}
use of mcjty.rftoolsdim.config.Settings in project RFToolsDimensions by McJty.
the class DimletRandomizer method setupWeightedRandomList.
private static void setupWeightedRandomList() {
if (randomDimlets != null) {
return;
}
SortedMap<DimletKey, Settings> knownDimlets = KnownDimletConfiguration.getKnownDimlets();
boolean rarityScalesBySize = DimletConfiguration.rarityScalesBySize;
float rarity0 = DimletConfiguration.rarity0;
float rarity1 = DimletConfiguration.rarity1;
float rarity2 = DimletConfiguration.rarity2;
float rarity3 = DimletConfiguration.rarity3;
float rarity4 = DimletConfiguration.rarity4;
float rarity5 = DimletConfiguration.rarity5;
float rarity6 = DimletConfiguration.rarity6;
randomDimlets = new RarityRandomSelector<>(rarityScalesBySize);
setupRarity(randomDimlets, rarity0, rarity1, rarity2, rarity3, rarity4, rarity5, rarity6);
randomUncraftableDimlets = new RarityRandomSelector<>(rarityScalesBySize);
setupRarity(randomUncraftableDimlets, rarity0, rarity1, rarity2, rarity3, rarity4, rarity5, rarity6);
for (Map.Entry<DimletKey, Settings> entry : knownDimlets.entrySet()) {
DimletKey key = entry.getKey();
Settings settings = KnownDimletConfiguration.getSettings(key);
if (settings == null) {
continue;
}
if (!settings.isWorldgen()) {
continue;
}
randomDimlets.addItem(entry.getValue().getRarity(), key);
if (key.getType() == DimletType.DIMLET_MATERIAL) {
if (randomMaterialDimlets == null) {
randomMaterialDimlets = new RarityRandomSelector<>(rarityScalesBySize);
setupRarity(randomMaterialDimlets, rarity0, rarity1, rarity2, rarity3, rarity4, rarity5, rarity6);
}
randomMaterialDimlets.addItem(entry.getValue().getRarity(), key);
} else if (key.getType() == DimletType.DIMLET_LIQUID) {
if (randomLiquidDimlets == null) {
randomLiquidDimlets = new RarityRandomSelector<>(rarityScalesBySize);
setupRarity(randomLiquidDimlets, rarity0, rarity1, rarity2, rarity3, rarity4, rarity5, rarity6);
}
randomLiquidDimlets.addItem(entry.getValue().getRarity(), key);
} else if (key.getType() == DimletType.DIMLET_MOB) {
if (randomMobDimlets == null) {
randomMobDimlets = new RarityRandomSelector<>(rarityScalesBySize);
setupRarity(randomMobDimlets, rarity0, rarity1, rarity2, rarity3, rarity4, rarity5, rarity6);
}
randomMobDimlets.addItem(entry.getValue().getRarity(), key);
} else if (key.getType() == DimletType.DIMLET_EFFECT) {
if (randomEffectDimlets == null) {
randomEffectDimlets = new RarityRandomSelector<>(rarityScalesBySize);
setupRarity(randomEffectDimlets, rarity0, rarity1, rarity2, rarity3, rarity4, rarity5, rarity6);
}
randomEffectDimlets.addItem(entry.getValue().getRarity(), key);
randomUncraftableDimlets.addItem(entry.getValue().getRarity(), key);
} else if (key.getType() == DimletType.DIMLET_FEATURE) {
if (randomFeatureDimlets == null) {
randomFeatureDimlets = new RarityRandomSelector<>(rarityScalesBySize);
setupRarity(randomFeatureDimlets, rarity0, rarity1, rarity2, rarity3, rarity4, rarity5, rarity6);
}
randomFeatureDimlets.addItem(entry.getValue().getRarity(), key);
randomUncraftableDimlets.addItem(entry.getValue().getRarity(), key);
} else if (key.getType() == DimletType.DIMLET_STRUCTURE) {
if (randomStructureDimlets == null) {
randomStructureDimlets = new RarityRandomSelector<>(rarityScalesBySize);
setupRarity(randomStructureDimlets, rarity0, rarity1, rarity2, rarity3, rarity4, rarity5, rarity6);
}
randomStructureDimlets.addItem(entry.getValue().getRarity(), key);
randomUncraftableDimlets.addItem(entry.getValue().getRarity(), key);
} else if (key.getType() == DimletType.DIMLET_TERRAIN) {
if (randomTerrainDimlets == null) {
randomTerrainDimlets = new RarityRandomSelector<>(rarityScalesBySize);
setupRarity(randomTerrainDimlets, rarity0, rarity1, rarity2, rarity3, rarity4, rarity5, rarity6);
}
randomTerrainDimlets.addItem(entry.getValue().getRarity(), key);
randomUncraftableDimlets.addItem(entry.getValue().getRarity(), key);
} else if (key.getType() == DimletType.DIMLET_WEATHER) {
if (randomWeatherDimlets == null) {
randomWeatherDimlets = new RarityRandomSelector<>(rarityScalesBySize);
setupRarity(randomWeatherDimlets, rarity0, rarity1, rarity2, rarity3, rarity4, rarity5, rarity6);
}
randomWeatherDimlets.addItem(entry.getValue().getRarity(), key);
randomUncraftableDimlets.addItem(entry.getValue().getRarity(), key);
} else if (key.getType() == DimletType.DIMLET_CONTROLLER) {
randomUncraftableDimlets.addItem(entry.getValue().getRarity(), key);
} else if (key.getType() == DimletType.DIMLET_SKY) {
if (randomSkyDimlets == null) {
randomSkyDimlets = new RarityRandomSelector<>(rarityScalesBySize);
setupRarity(randomSkyDimlets, rarity0, rarity1, rarity2, rarity3, rarity4, rarity5, rarity6);
}
randomSkyDimlets.addItem(entry.getValue().getRarity(), key);
if (SkyRegistry.isSkyBody(key)) {
if (randomSkyBodyDimlets == null) {
randomSkyBodyDimlets = new RarityRandomSelector<>(rarityScalesBySize);
setupRarity(randomSkyBodyDimlets, rarity0, rarity1, rarity2, rarity3, rarity4, rarity5, rarity6);
}
randomSkyBodyDimlets.addItem(entry.getValue().getRarity(), key);
}
randomUncraftableDimlets.addItem(entry.getValue().getRarity(), key);
}
}
}
Aggregations