use of mcjty.rftoolsdim.dimensions.dimlets.DimletKey in project RFToolsDimensions by McJty.
the class EffectDimletType method constructDimension.
@Override
public void constructDimension(List<Pair<DimletKey, List<DimletKey>>> dimlets, Random random, DimensionInformation dimensionInformation) {
Set<EffectType> effectTypes = dimensionInformation.getEffectTypes();
dimlets = DimensionInformation.extractType(DimletType.DIMLET_EFFECT, dimlets);
if (dimlets.isEmpty()) {
while (random.nextFloat() < WorldgenConfiguration.randomEffectChance) {
DimletKey key = DimletRandomizer.getRandomEffect(random);
if (key != null) {
EffectType effectType = DimletObjectMapping.getEffect(key);
if (!effectTypes.contains(effectType)) {
dimensionInformation.updateCostFactor(key);
effectTypes.add(effectType);
}
}
}
} else {
for (Pair<DimletKey, List<DimletKey>> dimletWithModifier : dimlets) {
DimletKey key = dimletWithModifier.getLeft();
EffectType effectType = DimletObjectMapping.getEffect(key);
if (effectType != EffectType.EFFECT_NONE) {
effectTypes.add(effectType);
}
}
}
}
use of mcjty.rftoolsdim.dimensions.dimlets.DimletKey in project RFToolsDimensions by McJty.
the class DimensionDescriptor method groupDimletsAndModifiers.
private void groupDimletsAndModifiers(List<DimletKey> descriptors, List<Pair<DimletKey, List<DimletKey>>> dimlets, List<DimletKey> currentModifiers) {
for (DimletKey key : descriptors) {
DimletType type = key.getType();
if (type.dimletType.isModifier()) {
// Keep the modifier here until we find a dimlet for which it fits.
currentModifiers.add(key);
} else {
List<DimletKey> modifiers = new ArrayList<DimletKey>();
if (!currentModifiers.isEmpty()) {
// Check if we collected modifiers that fit with this type.
List<DimletKey> copy = new ArrayList<DimletKey>(currentModifiers);
// Iterate over a copy so that we can delete from original list.
for (DimletKey modifier : copy) {
if (type.dimletType.isModifiedBy(modifier.getType())) {
modifiers.add(modifier);
currentModifiers.remove(modifier);
}
}
}
dimlets.add(Pair.of(key, modifiers));
}
}
}
use of mcjty.rftoolsdim.dimensions.dimlets.DimletKey in project RFToolsDimensions by McJty.
the class TimeAbsorberBlock method addInformation.
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack itemStack, EntityPlayer player, List<String> list, boolean whatIsThis) {
super.addInformation(itemStack, player, list, whatIsThis);
NBTTagCompound tagCompound = itemStack.getTagCompound();
if (tagCompound != null) {
if (tagCompound.hasKey("angle") && tagCompound.getFloat("angle") > -0.001f) {
float angle = tagCompound.getFloat("angle");
DimletKey key = TimeAbsorberTileEntity.findBestTimeDimlet(angle);
String name = KnownDimletConfiguration.getDisplayName(key);
if (name == null) {
name = "<unknown>";
}
list.add(TextFormatting.GREEN + "Dimlet: " + name + " (" + angle + ")");
int absorbing = tagCompound.getInteger("absorbing");
int pct = ((DimletConstructionConfiguration.maxTimeAbsorbtion - absorbing) * 100) / DimletConstructionConfiguration.maxTimeAbsorbtion;
list.add(TextFormatting.GREEN + "Absorbed: " + pct + "%");
int timeout = tagCompound.getInteger("registerTimeout");
list.add(TextFormatting.GREEN + "Timeout: " + timeout);
}
}
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
list.add(TextFormatting.WHITE + "Place this block outside and give it a redstone");
list.add(TextFormatting.WHITE + "signal around the time that you want to absorb.");
list.add(TextFormatting.WHITE + "You can use the end result in the Dimlet Workbench.");
} else {
list.add(TextFormatting.WHITE + RFToolsDim.SHIFT_MESSAGE);
}
}
use of mcjty.rftoolsdim.dimensions.dimlets.DimletKey in project RFToolsDimensions by McJty.
the class TimeAbsorberBlock method addProbeInfo.
@Override
public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data) {
super.addProbeInfo(mode, probeInfo, player, world, blockState, data);
TileEntity te = world.getTileEntity(data.getPos());
if (te instanceof TimeAbsorberTileEntity) {
TimeAbsorberTileEntity timeAbsorberTileEntity = (TimeAbsorberTileEntity) te;
float angle = timeAbsorberTileEntity.getAngle();
if (angle >= -0.01f) {
DimletKey key = TimeAbsorberTileEntity.findBestTimeDimlet(angle);
String name = KnownDimletConfiguration.getDisplayName(key);
if (name == null) {
name = "<unknown>";
}
int absorbing = timeAbsorberTileEntity.getAbsorbing();
int pct = ((DimletConstructionConfiguration.maxTimeAbsorbtion - absorbing) * 100) / DimletConstructionConfiguration.maxTimeAbsorbtion;
probeInfo.text(TextFormatting.GREEN + "Time: " + name).progress(pct, 100, probeInfo.defaultProgressStyle().suffix("%"));
} else {
probeInfo.text(TextFormatting.GREEN + "Give this block a redstone signal");
probeInfo.text(TextFormatting.GREEN + "at the right time you want to absorb");
}
}
}
use of mcjty.rftoolsdim.dimensions.dimlets.DimletKey in project RFToolsDimensions by McJty.
the class TimeAbsorberBlock method getWailaBody.
@SideOnly(Side.CLIENT)
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
super.getWailaBody(itemStack, currenttip, accessor, config);
TileEntity te = accessor.getTileEntity();
if (te instanceof TimeAbsorberTileEntity) {
TimeAbsorberTileEntity timeAbsorberTileEntity = (TimeAbsorberTileEntity) te;
float angle = timeAbsorberTileEntity.getAngle();
if (angle >= -0.01f) {
DimletKey key = TimeAbsorberTileEntity.findBestTimeDimlet(angle);
String name = KnownDimletConfiguration.getDisplayName(key);
if (name == null) {
name = "<unknown>";
}
int absorbing = timeAbsorberTileEntity.getAbsorbing();
int pct = ((DimletConstructionConfiguration.maxTimeAbsorbtion - absorbing) * 100) / DimletConstructionConfiguration.maxTimeAbsorbtion;
currenttip.add(TextFormatting.GREEN + "Dimlet: " + name + " (" + angle + ", " + pct + "%)");
} else {
currenttip.add(TextFormatting.GREEN + "Give this block a redstone signal");
currenttip.add(TextFormatting.GREEN + "at the right time you want to absorb");
}
}
return currenttip;
}
Aggregations