use of mcjty.rftoolsdim.dimensions.dimlets.DimletKey in project RFToolsDimensions by McJty.
the class GuiEssencePainter method extractModifiersForType.
private List<DimletKey> extractModifiersForType(List<DimletKey> modifiers, DimletType type) {
List<DimletKey> modifiersForType = new ArrayList<DimletKey>();
int i = 0;
while (i < modifiers.size()) {
DimletKey modifier = modifiers.get(i);
if (type.dimletType.isModifiedBy(modifier.getType())) {
modifiersForType.add(modifier);
modifiers.remove(i);
} else {
i++;
}
}
return modifiersForType;
}
use of mcjty.rftoolsdim.dimensions.dimlets.DimletKey in project RFToolsDimensions by McJty.
the class DimletWorkbenchTileEntity method readRestorableFromNBT.
@Override
public void readRestorableFromNBT(NBTTagCompound tagCompound) {
super.readRestorableFromNBT(tagCompound);
readBufferFromNBT(tagCompound, inventoryHelper);
extracting = tagCompound.getInteger("extracting");
extractMode = tagCompound.getBoolean("extractMode");
idToExtract = null;
if (tagCompound.hasKey("extKtype")) {
DimletType type = DimletType.getTypeByOpcode(tagCompound.getString("extKtype"));
idToExtract = new DimletKey(type, tagCompound.getString("extDkey"));
} else {
idToExtract = null;
}
}
use of mcjty.rftoolsdim.dimensions.dimlets.DimletKey in project RFToolsDimensions by McJty.
the class GuiDimletWorkbench method suggestParts.
private void suggestParts() {
int selected = itemList.getSelected();
if (selected == -1) {
return;
}
Widget widget = itemList.getChild(selected);
Object userObject = widget.getUserObject();
if (userObject instanceof DimletKey) {
DimletKey key = (DimletKey) userObject;
sendServerCommand(RFToolsDimMessages.INSTANCE, DimletWorkbenchTileEntity.CMD_SUGGESTPARTS, new Argument("type", key.getType().dimletType.getName()), new Argument("id", key.getId()));
}
}
use of mcjty.rftoolsdim.dimensions.dimlets.DimletKey in project RFToolsDimensions by McJty.
the class FeatureDimletType method findFeatureDimlet.
private static DimletKey findFeatureDimlet(NBTTagCompound essenceCompound) {
String feature = essenceCompound.getString("feature");
DimletKey key = new DimletKey(DimletType.DIMLET_FEATURE, feature);
Settings settings = KnownDimletConfiguration.getSettings(key);
if (settings == null || !settings.isDimlet()) {
return null;
}
return key;
}
use of mcjty.rftoolsdim.dimensions.dimlets.DimletKey in project RFToolsDimensions by McJty.
the class FeatureDimletType method getRandomFluidArray.
private Block[] getRandomFluidArray(Random random, DimensionInformation dimensionInformation, Set<FeatureType> featureTypes, Map<FeatureType, List<DimletKey>> modifiersForFeature, FeatureType t, boolean allowEmpty) {
Block[] fluidsForLakes;
if (featureTypes.contains(t)) {
List<IBlockState> blocks = new ArrayList<>();
List<Block> fluids = new ArrayList<>();
DimensionInformation.getMaterialAndFluidModifiers(modifiersForFeature.get(t), blocks, fluids);
// If no fluids are specified we will usually have default fluid generation (water+lava). Otherwise some random selection.
if (fluids.isEmpty()) {
while (random.nextFloat() < WorldgenConfiguration.randomLakeFluidChance) {
DimletKey key = DimletRandomizer.getRandomFluidBlock(random);
if (key != null) {
dimensionInformation.updateCostFactor(key);
fluids.add(DimletObjectMapping.getFluid(key));
}
}
} else if (fluids.size() == 1 && fluids.get(0) == null) {
fluids.clear();
}
fluidsForLakes = fluids.toArray(new Block[fluids.size()]);
for (int i = 0; i < fluidsForLakes.length; i++) {
if (fluidsForLakes[i] == null) {
fluidsForLakes[i] = Blocks.WATER;
}
}
} else {
fluidsForLakes = new Block[0];
}
if (allowEmpty || fluidsForLakes.length > 0) {
return fluidsForLakes;
}
return new Block[] { Blocks.WATER };
}
Aggregations