Fixed intermittent stack overflow in text formatting

This commit is contained in:
Unknown 2019-08-27 09:22:26 +02:00 committed by unknown
parent 3efc76c328
commit a929400c5a
51 changed files with 343 additions and 318 deletions

View file

@ -151,14 +151,38 @@ public class Commons {
return result.toString();
}
public static Style styleCommand = new Style().setColor(TextFormatting.AQUA);
public static Style styleHeader = new Style().setColor(TextFormatting.GOLD);
public static Style styleCorrect = new Style().setColor(TextFormatting.GREEN);
public static Style styleDisabled = new Style().setColor(TextFormatting.GRAY);
public static Style styleNormal = new Style().setColor(TextFormatting.WHITE);
public static Style styleValue = new Style().setColor(TextFormatting.YELLOW);
public static Style styleVoltage = new Style().setColor(TextFormatting.DARK_GREEN);
public static Style styleWarning = new Style().setColor(TextFormatting.RED);
@Nonnull
public static Style getStyleCommand() {
return new Style().setColor(TextFormatting.AQUA);
}
@Nonnull
public static Style getStyleHeader() {
return new Style().setColor(TextFormatting.GOLD);
}
@Nonnull
public static Style getStyleCorrect() {
return new Style().setColor(TextFormatting.GREEN);
}
@Nonnull
public static Style getStyleDisabled() {
return new Style().setColor(TextFormatting.GRAY);
}
@Nonnull
public static Style getStyleNormal() {
return new Style().setColor(TextFormatting.WHITE);
}
@Nonnull
public static Style getStyleValue() {
return new Style().setColor(TextFormatting.YELLOW);
}
@Nonnull
public static Style getStyleVoltage() {
return new Style().setColor(TextFormatting.DARK_GREEN);
}
@Nonnull
public static Style getStyleWarning() {
return new Style().setColor(TextFormatting.RED);
}
@Nonnull
public static WarpDriveText getChatPrefix(@Nonnull final Block block) {
@ -172,36 +196,36 @@ public class Commons {
@Nonnull
public static WarpDriveText getChatPrefix(@Nonnull final String translationKey) {
return new WarpDriveText(styleHeader, "warpdrive.guide.prefix",
return new WarpDriveText(getStyleHeader(), "warpdrive.guide.prefix",
new TextComponentTranslation(translationKey));
}
@Nonnull
public static WarpDriveText getNamedPrefix(@Nonnull final String name) {
return new WarpDriveText(styleHeader, "warpdrive.guide.prefix",
return new WarpDriveText(getStyleHeader(), "warpdrive.guide.prefix",
new TextComponentString(name));
}
@Nonnull
public static WarpDriveText getChatValue(final boolean bool) {
if (bool) {
return new WarpDriveText(styleCorrect, "true");
return new WarpDriveText(getStyleCorrect(), "true");
} else {
return new WarpDriveText(styleWarning, "false");
return new WarpDriveText(getStyleWarning(), "false");
}
}
@Nonnull
public static WarpDriveText getChatValue(final int value) {
return new WarpDriveText(styleValue, "%s", value);
return new WarpDriveText(getStyleValue(), "%s", value);
}
@Nonnull
public static WarpDriveText getChatValue(@Nonnull final String value) {
if (value.equals("???")) {
return new WarpDriveText(styleDisabled, "???");
return new WarpDriveText(getStyleDisabled(), "???");
} else {
return new WarpDriveText(styleValue, "%s", value);
return new WarpDriveText(getStyleValue(), "%s", value);
}
}

View file

@ -161,7 +161,7 @@ public abstract class BlockAbstractBase extends Block implements IBlockBase {
if (upgradeSlot == null) {
// no more upgrades to dismount
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.styleWarning, "warpdrive.upgrade.result.no_upgrade_to_dismount"));
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.getStyleWarning(), "warpdrive.upgrade.result.no_upgrade_to_dismount"));
return true;
}
@ -172,7 +172,7 @@ public abstract class BlockAbstractBase extends Block implements IBlockBase {
entityItem.setNoPickupDelay();
final boolean isSuccess = world.spawnEntity(entityItem);
if (!isSuccess) {
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.styleWarning, "warpdrive.upgrade.result.spawn_denied",
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.getStyleWarning(), "warpdrive.upgrade.result.spawn_denied",
entityItem ));
return true;
}
@ -180,7 +180,7 @@ public abstract class BlockAbstractBase extends Block implements IBlockBase {
tileEntityAbstractBase.dismountUpgrade(upgradeSlot);
// upgrade dismounted
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.styleCorrect, "warpdrive.upgrade.result.dismounted",
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.upgrade.result.dismounted",
new TextComponentTranslation(upgradeSlot.itemStack.getTranslationKey() + ".name") ));
return true;
}
@ -195,13 +195,13 @@ public abstract class BlockAbstractBase extends Block implements IBlockBase {
&& upgradeSlot != null ) {// no sneaking and an upgrade in hand => mounting an upgrade
// validate quantity already installed
if (tileEntityAbstractBase.getUpgradeMaxCount(upgradeSlot) < tileEntityAbstractBase.getUpgradeCount(upgradeSlot) + 1) {
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.styleWarning,"warpdrive.upgrade.result.too_many_upgrades",
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.getStyleWarning(),"warpdrive.upgrade.result.too_many_upgrades",
tileEntityAbstractBase.getUpgradeMaxCount(upgradeSlot) ));
return true;
}
// validate dependency
if (!tileEntityAbstractBase.canMountUpgrade(upgradeSlot)) {
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.styleWarning,"warpdrive.upgrade.result.invalid_upgrade"));
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.getStyleWarning(),"warpdrive.upgrade.result.invalid_upgrade"));
return true;
}
@ -210,7 +210,7 @@ public abstract class BlockAbstractBase extends Block implements IBlockBase {
final int countRequired = upgradeSlot.itemStack.getCount();
if (itemStackHeld.getCount() < countRequired) {
// not enough upgrade items
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.styleWarning, "warpdrive.upgrade.result.not_enough_upgrades"));
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.getStyleWarning(), "warpdrive.upgrade.result.not_enough_upgrades"));
return true;
}
@ -221,7 +221,7 @@ public abstract class BlockAbstractBase extends Block implements IBlockBase {
// mount the new upgrade item
tileEntityAbstractBase.mountUpgrade(upgradeSlot);
// upgrade mounted
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.styleCorrect, "warpdrive.upgrade.result.mounted",
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.upgrade.result.mounted",
new TextComponentTranslation(upgradeSlot.itemStack.getTranslationKey() + ".name") ));
return true;

View file

@ -264,9 +264,9 @@ public abstract class TileEntityAbstractBase extends TileEntity implements IBloc
for (final Entry<UpgradeSlot, Integer> entry : upgradeSlots.entrySet()) {
final UpgradeSlot upgradeSlot = entry.getKey();
final String keyName = isShowingItemNames ? upgradeSlot.itemStack.getTranslationKey() + ".name" : upgradeSlot.getTranslationKey();
final Style style = entry.getValue() == 0 ? Commons.styleDisabled : Commons.styleCorrect;
warpDriveText.append(Commons.styleDisabled, "- %1$s/%2$s x %3$s",
new WarpDriveText(Commons.styleValue, "%1$s", entry.getValue()),
final Style style = entry.getValue() == 0 ? Commons.getStyleDisabled() : Commons.getStyleCorrect();
warpDriveText.append(Commons.getStyleDisabled(), "- %1$s/%2$s x %3$s",
new WarpDriveText(Commons.getStyleValue(), "%1$s", entry.getValue()),
entry.getKey().maxCount,
new WarpDriveText(style, keyName) );
}
@ -288,31 +288,31 @@ public abstract class TileEntityAbstractBase extends TileEntity implements IBloc
@Nonnull
protected WarpDriveText getBeamFrequencyStatus(final int beamFrequency) {
if (beamFrequency == -1) {
return new WarpDriveText(Commons.styleWarning, "warpdrive.beam_frequency.status_line.undefined");
return new WarpDriveText(Commons.getStyleWarning(), "warpdrive.beam_frequency.status_line.undefined");
} else if (beamFrequency < 0) {
return new WarpDriveText(Commons.styleWarning, "warpdrive.beam_frequency.status_line.invalid", beamFrequency);
return new WarpDriveText(Commons.getStyleWarning(), "warpdrive.beam_frequency.status_line.invalid", beamFrequency);
} else {
return new WarpDriveText(Commons.styleCorrect, "warpdrive.beam_frequency.status_line.valid", beamFrequency);
return new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.beam_frequency.status_line.valid", beamFrequency);
}
}
@Nonnull
protected WarpDriveText getVideoChannelStatus(final int videoChannel) {
if (videoChannel == -1) {
return new WarpDriveText(Commons.styleWarning, "warpdrive.video_channel.status_line.undefined");
return new WarpDriveText(Commons.getStyleWarning(), "warpdrive.video_channel.status_line.undefined");
} else if (videoChannel < 0) {
return new WarpDriveText(Commons.styleWarning, "warpdrive.video_channel.status_line.invalid",
return new WarpDriveText(Commons.getStyleWarning(), "warpdrive.video_channel.status_line.invalid",
videoChannel);
} else {
final CameraRegistryItem camera = WarpDrive.cameras.getCameraByVideoChannel(world, videoChannel);
if (camera == null) {
return new WarpDriveText(Commons.styleWarning, "warpdrive.video_channel.status_line.not_loaded",
return new WarpDriveText(Commons.getStyleWarning(), "warpdrive.video_channel.status_line.not_loaded",
videoChannel);
} else if (camera.isTileEntity(this)) {
return new WarpDriveText(Commons.styleCorrect, "warpdrive.video_channel.status_line.valid_self",
return new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.video_channel.status_line.valid_self",
videoChannel);
} else {
return new WarpDriveText(Commons.styleCorrect, "warpdrive.video_channel.status_line.valid_other",
return new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.video_channel.status_line.valid_other",
videoChannel,
Commons.format(world, camera.blockPos) );
}
@ -323,7 +323,7 @@ public abstract class TileEntityAbstractBase extends TileEntity implements IBloc
protected WarpDriveText getCoreSignatureStatus(final String nameSignature) {
// note: we only report 'undefined' status for Remote controllers
if (nameSignature != null && !nameSignature.isEmpty()) {
return new WarpDriveText(Commons.styleCorrect, "warpdrive.core_signature.status_line.defined",
return new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.core_signature.status_line.defined",
nameSignature);
}
return new WarpDriveText();
@ -370,7 +370,7 @@ public abstract class TileEntityAbstractBase extends TileEntity implements IBloc
showDetails = Keyboard.isKeyDown(keyCodeSneak);
if (!showDetails) {
message.append(null, "warpdrive.upgrade.status_line.upgradeable",
new WarpDriveText(Commons.styleCommand, "%1$s", keyName) );
new WarpDriveText(Commons.getStyleCommand(), "%1$s", keyName) );
}
}
if (showDetails) {

View file

@ -101,7 +101,7 @@ public abstract class TileEntityAbstractLaser extends TileEntityAbstractEnergyBa
cache_laserMedium_factor = 0.0D;
cache_laserMedium_energyStored = 0;
cache_laserMedium_maxStorage = 0;
textReason.append(Commons.styleWarning, "warpdrive.laser.status_line.missing_laser_medium",
textReason.append(Commons.getStyleWarning(), "warpdrive.laser.status_line.missing_laser_medium",
Commons.format(laserMedium_directionsValid) );
return false;
}

View file

@ -32,7 +32,7 @@ public abstract class TileEntityAbstractMachine extends TileEntityAbstractInterf
private boolean isDirtyAssembly = true;
private int tickScanAssembly = 0;
protected boolean isAssemblyValid = true;
protected WarpDriveText textValidityIssues = new WarpDriveText(Commons.styleWarning, "unknown");
protected WarpDriveText textValidityIssues = new WarpDriveText(Commons.getStyleWarning(), "unknown");
// allow only one computation at a time
protected static final AtomicBoolean isGlobalThreadRunning = new AtomicBoolean(false);
@ -96,7 +96,7 @@ public abstract class TileEntityAbstractMachine extends TileEntityAbstractInterf
final WarpDriveText textReason = new WarpDriveText();
final boolean isValid = doScanAssembly(isDirty, textReason);
if (!isValid && textReason.isEmpty()) {
textReason.append(Commons.styleWarning, "unknown");
textReason.append(Commons.getStyleWarning(), "unknown");
WarpDrive.logger.warn(String.format("Unknown assembly status %s %s, please report to mod author",
this, Commons.format(world, pos) ));
}

View file

@ -85,7 +85,7 @@ public class TileEntitySecurityStation extends TileEntityAbstractMachine impleme
if (entityPlayer.getName().equals(name)) {
players.remove(i);
WarpDriveText text = Commons.getChatPrefix(getBlockType());
text.appendSibling(new WarpDriveText(Commons.styleCorrect, "warpdrive.security_station.guide.player_unregistered",
text.appendSibling(new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.security_station.guide.player_unregistered",
getAttachedPlayersList()));
return text;
}
@ -94,7 +94,7 @@ public class TileEntitySecurityStation extends TileEntityAbstractMachine impleme
entityPlayer.attackEntityFrom(DamageSource.GENERIC, 1);
players.add(entityPlayer.getName());
WarpDriveText text = Commons.getChatPrefix(getBlockType());
text.appendSibling(new WarpDriveText(Commons.styleCorrect, "warpdrive.security_station.guide.player_registered",
text.appendSibling(new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.security_station.guide.player_registered",
getAttachedPlayersList()));
return text;
}

View file

@ -82,12 +82,12 @@ public class TileEntityAcceleratorControlPoint extends TileEntityAbstractMachine
private WarpDriveText getControlChannelStatus() {
if (controlChannel == -1) {
return new WarpDriveText(Commons.styleWarning, "warpdrive.control_channel.status_line.undefined");
return new WarpDriveText(Commons.getStyleWarning(), "warpdrive.control_channel.status_line.undefined");
} else if (controlChannel < CONTROL_CHANNEL_MIN || controlChannel > CONTROL_CHANNEL_MAX) {
return new WarpDriveText(Commons.styleWarning, "warpdrive.control_channel.status_line.invalid",
return new WarpDriveText(Commons.getStyleWarning(), "warpdrive.control_channel.status_line.invalid",
controlChannel);
} else {
return new WarpDriveText(Commons.styleCorrect, "warpdrive.control_channel.status_line.valid",
return new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.control_channel.status_line.valid",
controlChannel);
}
}

View file

@ -276,15 +276,15 @@ public class TileEntityAcceleratorCore extends TileEntityAbstractEnergyCoreOrCon
final WarpDriveText text = getStatusPrefix();
if (energyRequired > acceleratorSetup.energy_getMaxStorage()) {
text.append(Commons.styleWarning, "warpdrive.accelerator.guide.low_power.not_enough_storage",
text.append(Commons.getStyleWarning(), "warpdrive.accelerator.guide.low_power.not_enough_storage",
energyRequired, acceleratorSetup.energy_getMaxStorage() );
} else if (acceleratorSetup.setChillers.isEmpty()) {
text.append(Commons.styleWarning, "warpdrive.accelerator.guide.no_chiller");
text.append(Commons.getStyleWarning(), "warpdrive.accelerator.guide.no_chiller");
} else if (setParticleBunches.isEmpty()) {
text.append(Commons.styleWarning, "warpdrive.accelerator.guide.low_power.no_particles",
text.append(Commons.getStyleWarning(), "warpdrive.accelerator.guide.low_power.no_particles",
energyRequired, energyPotential);
} else {
text.append(Commons.styleWarning, "warpdrive.accelerator.guide.low_power.accelerating",
text.append(Commons.getStyleWarning(), "warpdrive.accelerator.guide.low_power.accelerating",
energyRequired, energyPotential);
}

View file

@ -295,9 +295,9 @@ public class TileEntityShipScanner extends TileEntityAbstractMachine implements
shipCore = tileEntityShipCore;
if (shipCore == null) {
if (blockStateShipCoreTooHigh == null) {
textReason.append(Commons.styleWarning, "warpdrive.builder.status_line.no_ship_core_in_range");
textReason.append(Commons.getStyleWarning(), "warpdrive.builder.status_line.no_ship_core_in_range");
} else {
textReason.append(Commons.styleWarning, "warpdrive.builder.status_line.ship_is_higher_tier",
textReason.append(Commons.getStyleWarning(), "warpdrive.builder.status_line.ship_is_higher_tier",
blockStateShipCoreTooHigh.getBlock().getLocalizedName(),
getBlockType().getLocalizedName() );
}
@ -315,7 +315,7 @@ public class TileEntityShipScanner extends TileEntityAbstractMachine implements
final int size = width * length * height;
if (width <= 0 || length <= 0 || height <= 0) {
reason.append(Commons.styleWarning, "warpdrive.scanner.guide.invalid_ship_dimensions");
reason.append(Commons.getStyleWarning(), "warpdrive.scanner.guide.invalid_ship_dimensions");
return false;
}
@ -466,7 +466,7 @@ public class TileEntityShipScanner extends TileEntityAbstractMachine implements
final double distance = MathHelper.sqrt(dX * dX + dY * dY + dZ * dZ);
if (distance > WarpDriveConfig.SS_MAX_DEPLOY_RADIUS_BLOCKS) {
reason.append(Commons.styleWarning, "warpdrive.builder.guide.deploying_out_of_range",
reason.append(Commons.getStyleWarning(), "warpdrive.builder.guide.deploying_out_of_range",
WarpDriveConfig.SS_MAX_DEPLOY_RADIUS_BLOCKS);
return false;
}
@ -528,7 +528,7 @@ public class TileEntityShipScanner extends TileEntityAbstractMachine implements
}
}
if (occupiedBlockCount > 0) {
reason.append(Commons.styleWarning, "warpdrive.builder.guide.deployment_area_occupied_by_blocks",
reason.append(Commons.getStyleWarning(), "warpdrive.builder.guide.deployment_area_occupied_by_blocks",
occupiedBlockCount);
return false;
}
@ -540,7 +540,7 @@ public class TileEntityShipScanner extends TileEntityAbstractMachine implements
isShipToken = isForced;
setState(EnumShipScannerState.DEPLOYING);
reason.append(Commons.styleCorrect, "warpdrive.builder.guide.deploying_ship",
reason.append(Commons.getStyleCorrect(), "warpdrive.builder.guide.deploying_ship",
fileName);
return true;
}
@ -555,7 +555,7 @@ public class TileEntityShipScanner extends TileEntityAbstractMachine implements
if (!(blockState.getBlock() instanceof BlockShipCore)) {
world.newExplosion(null, blockPos.getX(), blockPos.getY(), blockPos.getZ(),
1, false, false);
reason.append(Commons.styleWarning, "warpdrive.builder.guide.deployment_area_occupied_by_block",
reason.append(Commons.getStyleWarning(), "warpdrive.builder.guide.deployment_area_occupied_by_block",
blockState.getBlock().getLocalizedName(),
blockPos.getX(), blockPos.getY(), blockPos.getZ());
return false;
@ -563,9 +563,9 @@ public class TileEntityShipScanner extends TileEntityAbstractMachine implements
final TileEntity tileEntity = world.getTileEntity(blockPos);
if (!(tileEntity instanceof TileEntityShipCore)) {
reason.append(Commons.styleWarning, "warpdrive.builder.guide.deployment_area_corrupted_tile_entity",
reason.append(Commons.getStyleWarning(), "warpdrive.builder.guide.deployment_area_corrupted_tile_entity",
tileEntity);
reason.append(Commons.styleCommand, "warpdrive.builder.guide.contact_an_admin",
reason.append(Commons.getStyleCommand(), "warpdrive.builder.guide.contact_an_admin",
Commons.format(world, blockPos));
WarpDrive.logger.error(reason.toString());
world.newExplosion(null, blockPos.getX(), blockPos.getY(), blockPos.getZ(),
@ -576,15 +576,15 @@ public class TileEntityShipScanner extends TileEntityAbstractMachine implements
final TileEntityShipCore tileEntityShipCore = (TileEntityShipCore) tileEntity;
final String namePlayersAboard = tileEntityShipCore.getAllPlayersInArea();
if (!namePlayersAboard.isEmpty()) {
reason.append(Commons.styleWarning, "warpdrive.builder.guide.deployment_area_with_active_crew",
reason.append(Commons.getStyleWarning(), "warpdrive.builder.guide.deployment_area_with_active_crew",
namePlayersAboard);
reason.append(Commons.styleCommand, "warpdrive.builder.guide.wait_your_turn");
reason.append(Commons.getStyleCommand(), "warpdrive.builder.guide.wait_your_turn");
return false;
}
if (tileEntityShipCore.isBusy()) {
reason.append(Commons.styleWarning, "warpdrive.builder.guide.deployment_area_is_busy");
reason.append(Commons.styleCommand, "warpdrive.builder.guide.wait_your_turn");
reason.append(Commons.getStyleWarning(), "warpdrive.builder.guide.deployment_area_is_busy");
reason.append(Commons.getStyleCommand(), "warpdrive.builder.guide.wait_your_turn");
return false;
}
@ -594,15 +594,15 @@ public class TileEntityShipScanner extends TileEntityAbstractMachine implements
}
if (nameOnlineCrew.equals(nameRequestingPlayer)) {
reason.append(Commons.styleWarning, "warpdrive.builder.guide.deployment_area_occupied_by_your_ship1",
reason.append(Commons.getStyleWarning(), "warpdrive.builder.guide.deployment_area_occupied_by_your_ship1",
nameOnlineCrew);
reason.append(Commons.styleCommand, "warpdrive.builder.guide.deployment_area_occupied_by_your_ship2");
reason.append(Commons.getStyleCommand(), "warpdrive.builder.guide.deployment_area_occupied_by_your_ship2");
return false;
}
reason.append(Commons.styleWarning, "warpdrive.builder.guide.deployment_area_occupied_by_online_player1",
reason.append(Commons.getStyleWarning(), "warpdrive.builder.guide.deployment_area_occupied_by_online_player1",
nameOnlineCrew);
reason.append(Commons.styleCommand, "warpdrive.builder.guide.deployment_area_occupied_by_online_player2");
reason.append(Commons.getStyleCommand(), "warpdrive.builder.guide.deployment_area_occupied_by_online_player2");
return false;
}
@ -831,7 +831,7 @@ public class TileEntityShipScanner extends TileEntityAbstractMachine implements
}
if (entityPlayers.size() > 1) {
for (final EntityPlayer entityPlayer : entityPlayers) {
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.styleWarning, "warpdrive.builder.guide.too_many_players"));
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.getStyleWarning(), "warpdrive.builder.guide.too_many_players"));
shipToken_nextUpdate_ticks = SHIP_TOKEN_UPDATE_DELAY_FAILED_PRECONDITION_TICKS;
}
shipToken_idPlayer = null;
@ -852,7 +852,7 @@ public class TileEntityShipScanner extends TileEntityAbstractMachine implements
}
if ( itemStack == null
|| slotIndex >= entityPlayer.inventory.getSizeInventory() ) {
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.styleWarning, "warpdrive.builder.guide.no_ship_token"));
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.getStyleWarning(), "warpdrive.builder.guide.no_ship_token"));
shipToken_nextUpdate_ticks = SHIP_TOKEN_UPDATE_DELAY_FAILED_PRECONDITION_TICKS;
shipToken_idPlayer = null;
return;
@ -864,12 +864,12 @@ public class TileEntityShipScanner extends TileEntityAbstractMachine implements
shipToken_idPlayer = entityPlayer.getUniqueID();
shipToken_countWarmup = SHIP_TOKEN_PLAYER_WARMUP_PERIODS + 1;
shipToken_nameSchematic = ItemShipToken.getSchematicName(itemStack);
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.styleCorrect, "warpdrive.builder.guide.ship_token_detected",
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.builder.guide.ship_token_detected",
shipToken_nameSchematic));
}
shipToken_countWarmup--;
if (shipToken_countWarmup > 0) {
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.styleNormal, "warpdrive.builder.guide.ship_materialization_countdown",
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.getStyleNormal(), "warpdrive.builder.guide.ship_materialization_countdown",
shipToken_nameSchematic, shipToken_countWarmup));
return;
}

View file

@ -982,56 +982,56 @@ public class TileEntityLaserTreeFarm extends TileEntityAbstractMiner {
@Override
public WarpDriveText getStatusHeader() {
final int energy = laserMedium_getEnergyStored(true);
WarpDriveText textState = new WarpDriveText(Commons.styleWarning, "warpdrive.error.internal_check_console");
WarpDriveText textState = new WarpDriveText(Commons.getStyleWarning(), "warpdrive.error.internal_check_console");
if (currentState == STATE_IDLE) {
textState = new WarpDriveText(Commons.styleCorrect, "warpdrive.laser_tree_farm.status_line.idle");
textState = new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.laser_tree_farm.status_line.idle");
} else if (currentState == STATE_WARMING_UP) {
textState = new WarpDriveText(Commons.styleCorrect, "warpdrive.laser_tree_farm.status_line.warming_up");
textState = new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.laser_tree_farm.status_line.warming_up");
} else if (currentState == STATE_SCANNING) {
if (breakLeaves) {
textState = new WarpDriveText(Commons.styleCorrect, "warpdrive.laser_tree_farm.status_line.scanning_all");
textState = new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.laser_tree_farm.status_line.scanning_all");
} else {
textState = new WarpDriveText(Commons.styleCorrect, "warpdrive.laser_tree_farm.status_line.scanning_logs");
textState = new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.laser_tree_farm.status_line.scanning_logs");
}
} else if (currentState == STATE_HARVESTING) {
if (!tapTrees) {
if (!enableSilktouch) {
if (breakLeaves) {
textState = new WarpDriveText(Commons.styleCorrect, "warpdrive.laser_tree_farm.status_line.harvesting_all");
textState = new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.laser_tree_farm.status_line.harvesting_all");
} else {
textState = new WarpDriveText(Commons.styleCorrect, "warpdrive.laser_tree_farm.status_line.harvesting_logs");
textState = new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.laser_tree_farm.status_line.harvesting_logs");
}
} else {
if (breakLeaves) {
textState = new WarpDriveText(Commons.styleCorrect, "warpdrive.laser_tree_farm.status_line.harvesting_all_with_silktouch");
textState = new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.laser_tree_farm.status_line.harvesting_all_with_silktouch");
} else {
textState = new WarpDriveText(Commons.styleCorrect, "warpdrive.laser_tree_farm.status_line.harvesting_logs_with_silktouch");
textState = new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.laser_tree_farm.status_line.harvesting_logs_with_silktouch");
}
}
} else {
if (!enableSilktouch) {
if (breakLeaves) {
textState = new WarpDriveText(Commons.styleCorrect, "warpdrive.laser_tree_farm.status_line.tapping_all");
textState = new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.laser_tree_farm.status_line.tapping_all");
} else {
textState = new WarpDriveText(Commons.styleCorrect, "warpdrive.laser_tree_farm.status_line.tapping_logs");
textState = new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.laser_tree_farm.status_line.tapping_logs");
}
} else {
if (breakLeaves) {
textState = new WarpDriveText(Commons.styleCorrect, "warpdrive.laser_tree_farm.status_line.tapping_all_with_silktouch");
textState = new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.laser_tree_farm.status_line.tapping_all_with_silktouch");
} else {
textState = new WarpDriveText(Commons.styleCorrect, "warpdrive.laser_tree_farm.status_line.tapping_logs_with_silktouch");
textState = new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.laser_tree_farm.status_line.tapping_logs_with_silktouch");
}
}
}
} else if (currentState == STATE_PLANTING) {
textState = new WarpDriveText(Commons.styleCorrect, "warpdrive.laser_tree_farm.status_line.planting");
textState = new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.laser_tree_farm.status_line.planting");
}
if (energy <= 0) {
textState.appendSibling(new WarpDriveText(Commons.styleWarning, "warpdrive.mining_laser.status_line._insufficient_energy"));
textState.appendSibling(new WarpDriveText(Commons.getStyleWarning(), "warpdrive.mining_laser.status_line._insufficient_energy"));
} else if ( (currentState != STATE_IDLE)
&& (currentState != STATE_WARMING_UP)
&& !isPowered ) {
textState.appendSibling(new WarpDriveText(Commons.styleWarning, "warpdrive.mining_laser.status_line._insufficient_energy"));
textState.appendSibling(new WarpDriveText(Commons.getStyleWarning(), "warpdrive.mining_laser.status_line._insufficient_energy"));
}
return textState;
}

View file

@ -600,40 +600,40 @@ public class TileEntityMiningLaser extends TileEntityAbstractMiner {
@Override
public WarpDriveText getStatusHeader() {
final int energy = laserMedium_getEnergyStored(true);
WarpDriveText textState = new WarpDriveText(Commons.styleCorrect, "warpdrive.error.internal_check_console");
WarpDriveText textState = new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.error.internal_check_console");
if (stateCurrent == STATE_IDLE) {
textState = new WarpDriveText(Commons.styleCorrect, "warpdrive.mining_laser.status_line.idle");
textState = new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.mining_laser.status_line.idle");
} else if (stateCurrent == STATE_WARMING_UP) {
textState = new WarpDriveText(Commons.styleCorrect, "warpdrive.mining_laser.status_line.warming_up");
textState = new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.mining_laser.status_line.warming_up");
} else if ( stateCurrent == STATE_START_SCANNING
|| stateCurrent == STATE_DO_SCANNING ) {
if (mineAllBlocks) {
textState = new WarpDriveText(Commons.styleCorrect, "warpdrive.mining_laser.status_line.scanning_all");
textState = new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.mining_laser.status_line.scanning_all");
} else {
textState = new WarpDriveText(Commons.styleCorrect, "warpdrive.mining_laser.status_line.scanning_ores");
textState = new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.mining_laser.status_line.scanning_ores");
}
} else if (stateCurrent == STATE_MINING) {
if (!enableSilktouch) {
if (mineAllBlocks) {
textState = new WarpDriveText(Commons.styleCorrect, "warpdrive.mining_laser.status_line.mining_all");
textState = new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.mining_laser.status_line.mining_all");
} else {
textState = new WarpDriveText(Commons.styleCorrect, "warpdrive.mining_laser.status_line.mining_ores");
textState = new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.mining_laser.status_line.mining_ores");
}
} else {
if (mineAllBlocks) {
textState = new WarpDriveText(Commons.styleCorrect, "warpdrive.mining_laser.status_line.mining_all_with_silktouch");
textState = new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.mining_laser.status_line.mining_all_with_silktouch");
} else {
textState = new WarpDriveText(Commons.styleCorrect, "warpdrive.mining_laser.status_line.mining_ores_with_silktouch");
textState = new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.mining_laser.status_line.mining_ores_with_silktouch");
}
}
}
if (energy <= 0) {
textState.appendSibling(new WarpDriveText(Commons.styleWarning, "warpdrive.mining_laser.status_line._insufficient_energy"));
textState.appendSibling(new WarpDriveText(Commons.getStyleWarning(), "warpdrive.mining_laser.status_line._insufficient_energy"));
} else if ( ( stateCurrent == STATE_START_SCANNING
|| stateCurrent == STATE_DO_SCANNING
|| stateCurrent == STATE_MINING )
&& !isPowered ) {
textState.appendSibling(new WarpDriveText(Commons.styleWarning, "warpdrive.mining_laser.status_line._insufficient_energy"));
textState.appendSibling(new WarpDriveText(Commons.getStyleWarning(), "warpdrive.mining_laser.status_line._insufficient_energy"));
}
return textState;
}

View file

@ -57,6 +57,6 @@ public class BlockSiren extends BlockAbstractRotatingContainer {
final int range = MathHelper.floor(WarpDriveConfig.SIREN_RANGE_BLOCKS_BY_TIER[enumTier.getIndex()]);
final String unlocalizedName_withoutTier = getTranslationKey().replace("." + enumTier.getName(), "");
Commons.addTooltip(list, new TextComponentTranslation(unlocalizedName_withoutTier + ".tooltip.usage",
new WarpDriveText(Commons.styleValue, range) ).getFormattedText());
new WarpDriveText(Commons.getStyleValue(), range) ).getFormattedText());
}
}

View file

@ -259,16 +259,16 @@ public class TileEntityCloakingCore extends TileEntityAbstractEnergyCoreOrContro
// build status message
final float integrity = countIntegrity / 13.0F;
if (messageInnerCoils.length() > 0 && messageOuterCoils.length() > 0) {
textReason.append(Commons.styleWarning, "warpdrive.cloaking_core.missing_channeling_and_projecting_coils",
textReason.append(Commons.getStyleWarning(), "warpdrive.cloaking_core.missing_channeling_and_projecting_coils",
Math.round(100.0F * integrity), messageInnerCoils, messageOuterCoils);
} else if (messageInnerCoils.length() > 0) {
textReason.append(Commons.styleWarning, "warpdrive.cloaking_core.missing_channeling_coils",
textReason.append(Commons.getStyleWarning(), "warpdrive.cloaking_core.missing_channeling_coils",
Math.round(100.0F * integrity), messageInnerCoils);
} else if (messageOuterCoils.length() > 0) {
textReason.append(Commons.styleWarning, "warpdrive.cloaking_core.missing_projecting_coils",
textReason.append(Commons.getStyleWarning(), "warpdrive.cloaking_core.missing_projecting_coils",
Math.round(100.0F * integrity), messageOuterCoils);
} else {
textReason.append(Commons.styleCorrect, "warpdrive.cloaking_core.valid");
textReason.append(Commons.getStyleCorrect(), "warpdrive.cloaking_core.valid");
}
// Update cloaking field parameters defined by coils
@ -458,15 +458,15 @@ public class TileEntityCloakingCore extends TileEntityAbstractEnergyCoreOrContro
if (!isAssemblyValid) {
textStatus = textValidityIssues;
} else if (!isEnabled) {
textStatus = new WarpDriveText(Commons.styleNormal, "warpdrive.cloaking_core.disabled",
textStatus = new WarpDriveText(Commons.getStyleNormal(), "warpdrive.cloaking_core.disabled",
isFullyTransparent ? 2 : 1,
volume);
} else if (!isCloaking) {
textStatus = new WarpDriveText(Commons.styleWarning, "warpdrive.cloaking_core.low_power",
textStatus = new WarpDriveText(Commons.getStyleWarning(), "warpdrive.cloaking_core.low_power",
isFullyTransparent ? 2 : 1,
volume);
} else {
textStatus = new WarpDriveText(Commons.styleCorrect, "warpdrive.cloaking_core.cloaking",
textStatus = new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.cloaking_core.cloaking",
isFullyTransparent ? 2 : 1,
volume);
}

View file

@ -537,7 +537,7 @@ public class TileEntityEnanReactorCore extends TileEntityEnanReactorController {
final IBlockState blockState = world.getBlockState(mutableBlockPos);
final boolean isAir = blockState.getBlock().isAir(blockState, world, mutableBlockPos);
if (!isAir) {
textReason.append(Commons.styleWarning, "warpdrive.enan_reactor.status_line.non_air_block",
textReason.append(Commons.getStyleWarning(), "warpdrive.enan_reactor.status_line.non_air_block",
Commons.format(world, mutableBlockPos) );
isValid = false;
final Vector3 vPosition = new Vector3(mutableBlockPos).translate(0.5D);
@ -559,7 +559,7 @@ public class TileEntityEnanReactorCore extends TileEntityEnanReactorController {
if (tileEntity instanceof TileEntityEnanReactorLaser) {
((TileEntityEnanReactorLaser) tileEntity).setReactorFace(reactorFace, this);
} else {
textReason.append(Commons.styleWarning, "warpdrive.enan_reactor.status_line.missing_stabilization_laser",
textReason.append(Commons.getStyleWarning(), "warpdrive.enan_reactor.status_line.missing_stabilization_laser",
Commons.format(world, mutableBlockPos) );
isValid = false;
final Vector3 vPosition = new Vector3(mutableBlockPos).translate(0.5D);

View file

@ -176,7 +176,7 @@ public class TileEntityEnanReactorLaser extends TileEntityAbstractLaser implemen
final boolean isValid = super.doScanAssembly(isDirty, textReason);
if (reactorFace == ReactorFace.UNKNOWN) {
textReason.append(Commons.styleWarning, "warpdrive.enan_reactor.status_line.missing_reactor_core");
textReason.append(Commons.getStyleWarning(), "warpdrive.enan_reactor.status_line.missing_reactor_core");
return false;
}

View file

@ -189,11 +189,11 @@ public class TileEntityIC2reactorLaserMonitor extends TileEntityAbstractLaser {
if (facing != null) {
return super.getStatus()
.append(Commons.styleCorrect, "warpdrive.ic2_reactor_laser_cooler.reactor_found",
.append(Commons.getStyleCorrect(), "warpdrive.ic2_reactor_laser_cooler.reactor_found",
facing.name().toLowerCase());
} else {
return super.getStatus()
.append(Commons.styleWarning, "warpdrive.ic2_reactor_laser_cooler.no_reactor");
.append(Commons.getStyleWarning(), "warpdrive.ic2_reactor_laser_cooler.no_reactor");
}
}

View file

@ -240,7 +240,7 @@ public class BlockForceFieldProjector extends BlockAbstractForceField {
entityItem.setNoPickupDelay();
final boolean isSuccess = world.spawnEntity(entityItem);
if (!isSuccess) {
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.styleWarning, "warpdrive.upgrade.result.spawn_denied",
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.getStyleWarning(), "warpdrive.upgrade.result.spawn_denied",
entityItem ));
return true;
}
@ -248,16 +248,16 @@ public class BlockForceFieldProjector extends BlockAbstractForceField {
tileEntityForceFieldProjector.setShape(EnumForceFieldShape.NONE);
// shape dismounted
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.styleCorrect, "warpdrive.upgrade.result.shape_dismounted"));
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.upgrade.result.shape_dismounted"));
} else {
// wrong side
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.styleWarning, "warpdrive.upgrade.result.wrong_shape_side"));
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.getStyleWarning(), "warpdrive.upgrade.result.wrong_shape_side"));
}
} else {
// no shape to dismount
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.styleWarning, "warpdrive.upgrade.result.no_shape_to_dismount"));
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.getStyleWarning(), "warpdrive.upgrade.result.no_shape_to_dismount"));
}
return true;
}
@ -290,7 +290,7 @@ public class BlockForceFieldProjector extends BlockAbstractForceField {
entityItem.setNoPickupDelay();
final boolean isSuccess = world.spawnEntity(entityItem);
if (!isSuccess) {
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.styleWarning, "warpdrive.upgrade.result.spawn_denied",
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.getStyleWarning(), "warpdrive.upgrade.result.spawn_denied",
entityItem ));
return true;
}
@ -300,18 +300,18 @@ public class BlockForceFieldProjector extends BlockAbstractForceField {
// mount the new shape item(s)
tileEntityForceFieldProjector.setShape(EnumForceFieldShape.get(itemStackHeld.getItemDamage()));
// shape mounted
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.styleCorrect, "warpdrive.upgrade.result.shape_mounted"));
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.upgrade.result.shape_mounted"));
} else {
// wrong side
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.styleWarning, "warpdrive.upgrade.result.wrong_shape_side"));
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.getStyleWarning(), "warpdrive.upgrade.result.wrong_shape_side"));
}
return true;
} else if (itemStackHeld.getItem() instanceof ItemForceFieldUpgrade) {// no sneaking and an upgrade in hand => mounting an upgrade
// validate type
if (upgradeSlot == null) {
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.styleWarning, "warpdrive.upgrade.result.invalid_upgrade_for_projector"));
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.getStyleWarning(), "warpdrive.upgrade.result.invalid_upgrade_for_projector"));
return true;
}

View file

@ -117,7 +117,7 @@ public class BlockForceFieldRelay extends BlockAbstractForceField {
entityItem.setNoPickupDelay();
final boolean isSuccess = world.spawnEntity(entityItem);
if (!isSuccess) {
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.styleWarning, "warpdrive.upgrade.result.spawn_denied",
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.getStyleWarning(), "warpdrive.upgrade.result.spawn_denied",
entityItem ));
return true;
}
@ -125,13 +125,13 @@ public class BlockForceFieldRelay extends BlockAbstractForceField {
tileEntityForceFieldRelay.setUpgrade(EnumForceFieldUpgrade.NONE);
// upgrade dismounted
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.styleCorrect, "warpdrive.upgrade.result.dismounted",
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.upgrade.result.dismounted",
new TextComponentTranslation(enumForceFieldUpgrade.name()) ));
return true;
} else {
// no more upgrades to dismount
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.styleWarning, "warpdrive.upgrade.result.no_upgrade_to_dismount"));
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.getStyleWarning(), "warpdrive.upgrade.result.no_upgrade_to_dismount"));
return true;
}
@ -143,7 +143,7 @@ public class BlockForceFieldRelay extends BlockAbstractForceField {
// validate type
if (EnumForceFieldUpgrade.get(itemStackHeld.getItemDamage()).maxCountOnRelay <= 0) {
// invalid upgrade type
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.styleWarning, "warpdrive.upgrade.result.invalid_upgrade_for_relay"));
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.getStyleWarning(), "warpdrive.upgrade.result.invalid_upgrade_for_relay"));
return true;
}
@ -151,7 +151,7 @@ public class BlockForceFieldRelay extends BlockAbstractForceField {
// validate quantity
if (itemStackHeld.getCount() < 1) {
// not enough upgrade items
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.styleWarning, "warpdrive.upgrade.result.not_enough_upgrades"));
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.getStyleWarning(), "warpdrive.upgrade.result.not_enough_upgrades"));
return true;
}
@ -165,7 +165,7 @@ public class BlockForceFieldRelay extends BlockAbstractForceField {
entityItem.setNoPickupDelay();
final boolean isSuccess = world.spawnEntity(entityItem);
if (!isSuccess) {
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.styleWarning, "warpdrive.upgrade.result.spawn_denied",
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.getStyleWarning(), "warpdrive.upgrade.result.spawn_denied",
entityItem ));
return true;
}
@ -176,7 +176,7 @@ public class BlockForceFieldRelay extends BlockAbstractForceField {
final EnumForceFieldUpgrade enumForceFieldUpgrade = EnumForceFieldUpgrade.get(itemStackHeld.getItemDamage());
tileEntityForceFieldRelay.setUpgrade(enumForceFieldUpgrade);
// upgrade mounted
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.styleCorrect, "warpdrive.upgrade.result.mounted",
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.upgrade.result.mounted",
new TextComponentTranslation(enumForceFieldUpgrade.name()) ));
return true;
}

View file

@ -268,7 +268,7 @@ public class TileEntityForceFieldProjector extends TileEntityAbstractForceField
guideTicks = PROJECTOR_GUIDE_UPDATE_TICKS;
final WarpDriveText msg = Commons.getChatPrefix(getBlockType());
msg.appendSibling(new WarpDriveText(Commons.styleWarning, "warpdrive.force_field.guide.low_power"));
msg.appendSibling(new WarpDriveText(Commons.getStyleWarning(), "warpdrive.force_field.guide.low_power"));
final AxisAlignedBB axisalignedbb = new AxisAlignedBB(pos.getX() - 10, pos.getY() - 10, pos.getZ() - 10, pos.getX() + 10, pos.getY() + 10, pos.getZ() + 10);
final List<Entity> list = world.getEntitiesWithinAABBExcludingEntity(null, axisalignedbb);
@ -302,7 +302,7 @@ public class TileEntityForceFieldProjector extends TileEntityAbstractForceField
final boolean isValid = super.doScanAssembly(isDirty, textReason);
if (getShape() == EnumForceFieldShape.NONE) {
textReason.append(Commons.styleWarning, "warpdrive.force_field.shape.status_line.none");
textReason.append(Commons.getStyleWarning(), "warpdrive.force_field.shape.status_line.none");
return false;
}
@ -1003,7 +1003,7 @@ public class TileEntityForceFieldProjector extends TileEntityAbstractForceField
final EnumForceFieldShape enumForceFieldShape = getShape();
final WarpDriveText displayName = new WarpDriveText(null, "warpdrive.force_field.shape.status_line." + enumForceFieldShape.getName());
if (enumForceFieldShape == EnumForceFieldShape.NONE) {
return new WarpDriveText(Commons.styleWarning, "warpdrive.force_field.shape.status_line.none",
return new WarpDriveText(Commons.getStyleWarning(), "warpdrive.force_field.shape.status_line.none",
displayName);
} else if (isDoubleSided) {
return new WarpDriveText(null, "warpdrive.force_field.shape.status_line.double",

View file

@ -48,9 +48,9 @@ public class TileEntityForceFieldRelay extends TileEntityAbstractForceField impl
final EnumForceFieldUpgrade enumForceFieldUpgrade = getUpgrade();
final String keyName = ItemForceFieldUpgrade.getItemStack(enumForceFieldUpgrade).getTranslationKey() + ".name";
final int value = enumForceFieldUpgrade == EnumForceFieldUpgrade.NONE ? 0 : 1;
final Style style = value == 0 ? Commons.styleDisabled : Commons.styleCorrect;
warpDriveText.append(Commons.styleDisabled, "- %1$s/%2$s x %3$s",
new WarpDriveText(Commons.styleValue, "%1$s", value),
final Style style = value == 0 ? Commons.getStyleDisabled() : Commons.getStyleCorrect();
warpDriveText.append(Commons.getStyleDisabled(), "- %1$s/%2$s x %3$s",
new WarpDriveText(Commons.getStyleValue(), "%1$s", value),
1,
new WarpDriveText(style, keyName) );
return warpDriveText;

View file

@ -83,7 +83,7 @@ public class BlockShipController extends BlockAbstractContainer {
if (world.getBlockState(mutableBlockPos).getBlock() instanceof BlockShipCore) {
final EntityPlayer entityPlayer = world.getClosestPlayer(blockPos.getX() + 0.5D, blockPos.getY() + 0.5D, blockPos.getZ() + 0.5D, 5, false);
if (entityPlayer != null) {
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.styleWarning, "tile.warpdrive.movement.ship_controller.away_from_core"));
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.getStyleWarning(), "tile.warpdrive.movement.ship_controller.away_from_core"));
}
return false;
}

View file

@ -149,10 +149,10 @@ public class BlockShipCore extends BlockAbstractRotatingContainer {
super.addInformation(stack, world, list, advancedItemTooltips);
Commons.addTooltip(list, new TextComponentTranslation("tile.warpdrive.movement.ship_core.tooltip.constrains",
new WarpDriveText(Commons.styleValue, WarpDriveConfig.SHIP_SIZE_MAX_PER_SIDE_BY_TIER[enumTier.getIndex()]),
new WarpDriveText(Commons.styleValue, WarpDriveConfig.SHIP_MASS_MIN_BY_TIER[enumTier.getIndex()]),
new WarpDriveText(Commons.styleValue, WarpDriveConfig.SHIP_MASS_MAX_BY_TIER[enumTier.getIndex()]),
new WarpDriveText(Commons.styleValue, WarpDriveConfig.SHIP_MASS_MAX_ON_PLANET_SURFACE),
new WarpDriveText(Commons.styleValue, WarpDriveConfig.SHIP_MASS_MIN_FOR_HYPERSPACE) ).getFormattedText());
new WarpDriveText(Commons.getStyleValue(), WarpDriveConfig.SHIP_SIZE_MAX_PER_SIDE_BY_TIER[enumTier.getIndex()]),
new WarpDriveText(Commons.getStyleValue(), WarpDriveConfig.SHIP_MASS_MIN_BY_TIER[enumTier.getIndex()]),
new WarpDriveText(Commons.getStyleValue(), WarpDriveConfig.SHIP_MASS_MAX_BY_TIER[enumTier.getIndex()]),
new WarpDriveText(Commons.getStyleValue(), WarpDriveConfig.SHIP_MASS_MAX_ON_PLANET_SURFACE),
new WarpDriveText(Commons.getStyleValue(), WarpDriveConfig.SHIP_MASS_MIN_FOR_HYPERSPACE) ).getFormattedText());
}
}

View file

@ -125,16 +125,16 @@ public class ItemBlockController extends ItemBlockAbstractBase {
if ( uuidSignatureFromBlock == null
|| nameSignatureFromBlock == null
|| nameSignatureFromBlock.isEmpty() ) {
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.styleWarning, "warpdrive.core_signature.get_missing",
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.getStyleWarning(), "warpdrive.core_signature.get_missing",
null, nameItem, nameBlock ));
} else if (uuidSignatureFromBlock.equals(uuidSignatureFromItem)) {
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.styleCorrect, "warpdrive.core_signature.get_same",
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.core_signature.get_same",
nameSignatureFromItem, nameItem, nameBlock ));
} else {
final ItemStack itemStackNew = setNameAndSignature(itemStackHeld, nameSignatureFromBlock, uuidSignatureFromBlock);
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.styleCorrect, "warpdrive.core_signature.get",
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.core_signature.get",
nameSignatureFromBlock, nameItem, nameBlock ));
world.playSound(entityPlayer.posX + 0.5D, entityPlayer.posY + 0.5D, entityPlayer.posZ + 0.5D,
SoundEvents.ENTITY_ZOMBIE_VILLAGER_CURE, SoundCategory.PLAYERS,
@ -143,23 +143,23 @@ public class ItemBlockController extends ItemBlockAbstractBase {
} else {// set block signature
if (uuidSignatureFromItem == null) {
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.styleWarning, "warpdrive.core_signature.set_missing",
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.getStyleWarning(), "warpdrive.core_signature.set_missing",
null, nameItem, nameBlock ));
} else if (uuidSignatureFromItem.equals(uuidSignatureFromBlock)) {
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.styleCorrect, "warpdrive.core_signature.set_same",
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.core_signature.set_same",
nameSignatureFromItem, nameItem, nameBlock ));
} else {
final boolean isSuccess = ((IMultiBlockCoreOrController) tileEntity).setSignature(uuidSignatureFromItem, nameSignatureFromItem);
if (isSuccess) {
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.styleCorrect, "warpdrive.core_signature.set",
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.core_signature.set",
nameSignatureFromItem, nameItem, nameBlock));
world.playSound(entityPlayer.posX + 0.5D, entityPlayer.posY + 0.5D, entityPlayer.posZ + 0.5D,
SoundEvents.ENTITY_ZOMBIE_VILLAGER_CONVERTED, SoundCategory.PLAYERS,
1.0F, 1.2F + 0.2F * world.rand.nextFloat(), false);
} else {
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.styleWarning, "warpdrive.core_signature.set_not_supported",
Commons.addChatMessage(entityPlayer, new WarpDriveText(Commons.getStyleWarning(), "warpdrive.core_signature.set_not_supported",
null, nameItem, nameBlock ));
}
}

View file

@ -68,19 +68,19 @@ public class TileEntityShipController extends TileEntityAbstractShipController {
if (tileEntityShipCore == null) {
final StarMapRegistryItem starMapRegistryItem = WarpDrive.starMap.getByUUID(EnumStarMapEntryType.SHIP, uuid);
if (starMapRegistryItem == null) {
textReason.append(Commons.styleWarning, "warpdrive.core_signature.status_line.unknown_core_signature");
textReason.append(Commons.getStyleWarning(), "warpdrive.core_signature.status_line.unknown_core_signature");
return false;
}
final WorldServer worldServer = starMapRegistryItem.getWorldServerIfLoaded();
if (worldServer == null) {
textReason.append(Commons.styleWarning, "warpdrive.core_signature.status_line.world_not_loaded");
textReason.append(Commons.getStyleWarning(), "warpdrive.core_signature.status_line.world_not_loaded");
return false;
}
final TileEntity tileEntity = worldServer.getTileEntity(starMapRegistryItem.getBlockPos());
if ( !(tileEntity instanceof TileEntityShipCore)
|| tileEntity.isInvalid()
|| !((TileEntityShipCore) tileEntity).getSignatureUUID().equals(uuid) ) {
textReason.append(Commons.styleWarning, "warpdrive.core_signature.status_line.unknown_core_signature");
textReason.append(Commons.getStyleWarning(), "warpdrive.core_signature.status_line.unknown_core_signature");
return false;
}
tileEntityShipCore = (TileEntityShipCore) tileEntity;
@ -132,7 +132,7 @@ public class TileEntityShipController extends TileEntityAbstractShipController {
@Override
protected WarpDriveText getCoreSignatureStatus(final String nameSignature) {
if (nameSignature == null || nameSignature.isEmpty()) {
return new WarpDriveText(Commons.styleWarning, "warpdrive.core_signature.status_line.undefined");
return new WarpDriveText(Commons.getStyleWarning(), "warpdrive.core_signature.status_line.undefined");
}
return super.getCoreSignatureStatus(nameSignature);
}

View file

@ -214,14 +214,14 @@ public class TileEntityShipCore extends TileEntityAbstractShipController impleme
if ( getBack() == 0 && getFront() == 0
&& getLeft() == 0 && getRight() == 0
&& getDown() == 0 && getUp() == 0 ) {
textValidityIssues = new WarpDriveText(Commons.styleWarning, "warpdrive.ship.guide.no_dimension_set");
textValidityIssues = new WarpDriveText(Commons.getStyleWarning(), "warpdrive.ship.guide.no_dimension_set");
isAssemblyValid = false;
return;
}
if ( (getBack() + getFront()) > WarpDriveConfig.SHIP_SIZE_MAX_PER_SIDE_BY_TIER[enumTier.getIndex()]
|| (getLeft() + getRight()) > WarpDriveConfig.SHIP_SIZE_MAX_PER_SIDE_BY_TIER[enumTier.getIndex()]
|| (getDown() + getUp() ) > WarpDriveConfig.SHIP_SIZE_MAX_PER_SIDE_BY_TIER[enumTier.getIndex()] ) {
textValidityIssues = new WarpDriveText(Commons.styleWarning, "warpdrive.ship.guide.too_large_side_for_tier",
textValidityIssues = new WarpDriveText(Commons.getStyleWarning(), "warpdrive.ship.guide.too_large_side_for_tier",
WarpDriveConfig.SHIP_SIZE_MAX_PER_SIDE_BY_TIER[enumTier.getIndex()]);
isAssemblyValid = false;
return;
@ -265,7 +265,7 @@ public class TileEntityShipCore extends TileEntityAbstractShipController impleme
if (!isUnlimited) {
if ( shipMass > WarpDriveConfig.SHIP_MASS_MAX_ON_PLANET_SURFACE
&& CelestialObjectManager.isPlanet(world, pos.getX(), pos.getZ()) ) {
textValidityIssues = new WarpDriveText(Commons.styleWarning, "warpdrive.ship.guide.too_much_mass_for_planet",
textValidityIssues = new WarpDriveText(Commons.getStyleWarning(), "warpdrive.ship.guide.too_much_mass_for_planet",
WarpDriveConfig.SHIP_MASS_MAX_ON_PLANET_SURFACE, shipMass);
isAssemblyValid = false;
if (isEnabled) {
@ -275,7 +275,7 @@ public class TileEntityShipCore extends TileEntityAbstractShipController impleme
}
if ( shipMass < WarpDriveConfig.SHIP_MASS_MIN_FOR_HYPERSPACE
&& CelestialObjectManager.isInHyperspace(world, pos.getX(), pos.getZ()) ) {
textValidityIssues = new WarpDriveText(Commons.styleWarning, "warpdrive.ship.guide.insufficient_mass_for_hyperspace",
textValidityIssues = new WarpDriveText(Commons.getStyleWarning(), "warpdrive.ship.guide.insufficient_mass_for_hyperspace",
WarpDriveConfig.SHIP_MASS_MIN_FOR_HYPERSPACE, shipMass);
isAssemblyValid = false;
if (isEnabled) {
@ -284,7 +284,7 @@ public class TileEntityShipCore extends TileEntityAbstractShipController impleme
return;
}
if (shipMass < WarpDriveConfig.SHIP_MASS_MIN_BY_TIER[enumTier.getIndex()]) {
textValidityIssues = new WarpDriveText(Commons.styleWarning, "warpdrive.ship.guide.insufficient_mass_for_tier",
textValidityIssues = new WarpDriveText(Commons.getStyleWarning(), "warpdrive.ship.guide.insufficient_mass_for_tier",
WarpDriveConfig.SHIP_MASS_MIN_BY_TIER[enumTier.getIndex()], shipMass);
isAssemblyValid = false;
if (isEnabled) {
@ -293,7 +293,7 @@ public class TileEntityShipCore extends TileEntityAbstractShipController impleme
return;
}
if (shipMass > WarpDriveConfig.SHIP_MASS_MAX_BY_TIER[enumTier.getIndex()]) {
textValidityIssues = new WarpDriveText(Commons.styleWarning, "warpdrive.ship.guide.too_much_mass_for_tier",
textValidityIssues = new WarpDriveText(Commons.getStyleWarning(), "warpdrive.ship.guide.too_much_mass_for_tier",
WarpDriveConfig.SHIP_MASS_MAX_BY_TIER[enumTier.getIndex()], shipMass);
isAssemblyValid = false;
if (isEnabled) {
@ -447,19 +447,19 @@ public class TileEntityShipCore extends TileEntityAbstractShipController impleme
final TileEntityShipCore shipCoreIntersecting = WarpDrive.starMap.getIntersectingShipCore(this);
if (shipCoreIntersecting != null) {
commandDone(false, new WarpDriveText(Commons.styleWarning, "warpdrive.ship.guide.warp_field_overlapping",
commandDone(false, new WarpDriveText(Commons.getStyleWarning(), "warpdrive.ship.guide.warp_field_overlapping",
shipCoreIntersecting.getSignatureName() ));
return;
}
if (WarpDrive.cloaks.isCloaked(world.provider.getDimension(), pos)) {
commandDone(false, new WarpDriveText(Commons.styleWarning, "warpdrive.ship.guide.cloaking_field_overlapping"));
commandDone(false, new WarpDriveText(Commons.getStyleWarning(), "warpdrive.ship.guide.cloaking_field_overlapping"));
return;
}
doJump();
setCooldown(shipMovementCosts.cooldown_seconds * 20);
commandDone(true, new WarpDriveText(Commons.styleCorrect, "warpdrive.ship.guide.pre_jump_success"));
commandDone(true, new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.ship.guide.pre_jump_success"));
jumpCount++;
stateCurrent = EnumShipCoreState.IDLE;
isCooldownReported = false;
@ -532,7 +532,7 @@ public class TileEntityShipCore extends TileEntityAbstractShipController impleme
if (success || !commandCurrent.isMovement()) {
reason = reasonRaw;
} else {
reason = new WarpDriveText(Commons.styleWarning, "warpdrive.ship.guide.movement_aborted")
reason = new WarpDriveText(Commons.getStyleWarning(), "warpdrive.ship.guide.movement_aborted")
.append(reasonRaw);
}
super.commandDone(success, reason);
@ -653,7 +653,7 @@ public class TileEntityShipCore extends TileEntityAbstractShipController impleme
}
updateAfterResize();
if (!isAssemblyValid) {
Commons.addChatMessage(entityPlayerMP, new WarpDriveText(Commons.styleHeader, !name.isEmpty() ? name : "ShipCore")
Commons.addChatMessage(entityPlayerMP, new WarpDriveText(Commons.getStyleHeader(), !name.isEmpty() ? name : "ShipCore")
.appendSibling(textValidityIssues));
return false;
}
@ -707,7 +707,7 @@ public class TileEntityShipCore extends TileEntityAbstractShipController impleme
return;
}
}
final WarpDriveText message = new WarpDriveText(Commons.styleWarning, "warpdrive.teleportation.guide.no_safe_spot",
final WarpDriveText message = new WarpDriveText(Commons.getStyleWarning(), "warpdrive.teleportation.guide.no_safe_spot",
entityPlayer.getDisplayName());
Commons.messageToAllPlayersInArea(this, message);
Commons.addChatMessage(entityPlayer, message);
@ -864,10 +864,10 @@ public class TileEntityShipCore extends TileEntityAbstractShipController impleme
if (percent > 80F) {
return true;
} else if (percent <= 0.001) {
reason.append(Commons.styleWarning, "warpdrive.ship.guide.jumpgate_is_too_far");
reason.append(Commons.getStyleWarning(), "warpdrive.ship.guide.jumpgate_is_too_far");
return false;
} else {
reason.append(Commons.styleWarning, "warpdrive.ship.guide.jumpgate_partially_entered",
reason.append(Commons.getStyleWarning(), "warpdrive.ship.guide.jumpgate_partially_entered",
percent);
return false;
}
@ -918,7 +918,7 @@ public class TileEntityShipCore extends TileEntityAbstractShipController impleme
final StarMapRegistryItem jumpGate_target = WarpDrive.starMap.getByName(EnumStarMapEntryType.JUMP_GATE, targetName);
if (jumpGate_target == null) {
commandDone(false, new WarpDriveText(Commons.styleWarning, "warpdrive.ship.guide.jumpgate_not_defined",
commandDone(false, new WarpDriveText(Commons.getStyleWarning(), "warpdrive.ship.guide.jumpgate_not_defined",
targetName));
return;
}
@ -959,7 +959,7 @@ public class TileEntityShipCore extends TileEntityAbstractShipController impleme
}
if (!placeFound) {
commandDone(false, new WarpDriveText(Commons.styleWarning, "warpdrive.ship.guide.jumpgate_blocked"));
commandDone(false, new WarpDriveText(Commons.getStyleWarning(), "warpdrive.ship.guide.jumpgate_blocked"));
return;
}
@ -975,7 +975,7 @@ public class TileEntityShipCore extends TileEntityAbstractShipController impleme
jump.enable();
} else {
final String units = WarpDriveConfig.ENERGY_DISPLAY_UNITS;
Commons.messageToAllPlayersInArea(this, new WarpDriveText(Commons.styleWarning, "warpdrive.ship.guide.insufficient_energy",
Commons.messageToAllPlayersInArea(this, new WarpDriveText(Commons.getStyleWarning(), "warpdrive.ship.guide.insufficient_energy",
EnergyWrapper.format(energy_getEnergyStored(), units),
EnergyWrapper.format(shipMovementCosts.energyRequired, units),
units));
@ -988,7 +988,7 @@ public class TileEntityShipCore extends TileEntityAbstractShipController impleme
if (!energy_consume(requiredEnergy, true)) {
final String units = WarpDriveConfig.ENERGY_DISPLAY_UNITS;
commandDone(false, new WarpDriveText(Commons.styleWarning, "warpdrive.ship.guide.insufficient_energy",
commandDone(false, new WarpDriveText(Commons.getStyleWarning(), "warpdrive.ship.guide.insufficient_energy",
EnergyWrapper.format(energy_getEnergyStored(), units),
EnergyWrapper.format(requiredEnergy, units),
units));
@ -1012,7 +1012,7 @@ public class TileEntityShipCore extends TileEntityAbstractShipController impleme
final WarpDriveText reason = new WarpDriveText();
if (nearestGate == null || !isShipInJumpgate(nearestGate, reason)) {
commandDone(false, new WarpDriveText(Commons.styleWarning, "warpdrive.ship.guide.insufficient_mass_for_hyperspace",
commandDone(false, new WarpDriveText(Commons.getStyleWarning(), "warpdrive.ship.guide.insufficient_mass_for_hyperspace",
shipMass, WarpDriveConfig.SHIP_MASS_MIN_FOR_HYPERSPACE));
return;
}
@ -1027,7 +1027,7 @@ public class TileEntityShipCore extends TileEntityAbstractShipController impleme
default:
WarpDrive.logger.error(String.format("%s Aborting while trying to perform invalid jump command %s",
this, commandCurrent));
commandDone(false, new WarpDriveText(Commons.styleWarning, "warpdrive.error.internal_check_console"));
commandDone(false, new WarpDriveText(Commons.getStyleWarning(), "warpdrive.error.internal_check_console"));
commandCurrent = EnumShipCommand.IDLE;
stateCurrent = EnumShipCoreState.IDLE;
return;
@ -1035,7 +1035,7 @@ public class TileEntityShipCore extends TileEntityAbstractShipController impleme
if (!energy_consume(requiredEnergy, false)) {
final String units = WarpDriveConfig.ENERGY_DISPLAY_UNITS;
commandDone(false, new WarpDriveText(Commons.styleWarning, "warpdrive.ship.guide.insufficient_energy",
commandDone(false, new WarpDriveText(Commons.getStyleWarning(), "warpdrive.ship.guide.insufficient_energy",
EnergyWrapper.format(energy_getEnergyStored(), units),
EnergyWrapper.format(requiredEnergy, units),
units));

View file

@ -194,9 +194,9 @@ public class TileEntityTransporterBeacon extends TileEntityAbstractEnergyConsume
// TileEntityAbstractBase overrides
private WarpDriveText getSignatureStatus() {
if (uuidTransporterCore == null) {
return new WarpDriveText(Commons.styleWarning, "warpdrive.transporter_signature.status_line.invalid");
return new WarpDriveText(Commons.getStyleWarning(), "warpdrive.transporter_signature.status_line.invalid");
}
return new WarpDriveText(Commons.styleCorrect, "warpdrive.transporter_signature.status_line.valid",
return new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.transporter_signature.status_line.valid",
nameTransporterCore, uuidTransporterCore);
}

View file

@ -598,7 +598,7 @@ public class TileEntityTransporterCore extends TileEntityAbstractEnergyCoreOrCon
// only accept valid ones, spawn particles on others
final Collection<BlockPos> vValidContainments = ((BlockTransporterScanner) block).getValidContainment(world, mutableBlockPos);
if (vValidContainments == null || vValidContainments.isEmpty()) {
textReason.append(Commons.styleWarning, "warpdrive.transporter.status_line.missing_containment",
textReason.append(Commons.getStyleWarning(), "warpdrive.transporter.status_line.missing_containment",
Commons.format(world, mutableBlockPos) );
world.setBlockState(mutableBlockPos, blockState.withProperty(BlockProperties.ACTIVE, false), 2);
PacketHandler.sendSpawnParticlePacket(world, "jammed", (byte) 5,

View file

@ -9,7 +9,7 @@ import net.minecraft.util.text.TextComponentString;
public abstract class AbstractCommand extends CommandBase {
public ITextComponent getPrefix() {
return new TextComponentString("/" + getName()).setStyle(Commons.styleHeader)
return new TextComponentString("/" + getName()).setStyle(Commons.getStyleHeader())
.appendSibling(new TextComponentString(" "));
}

View file

@ -42,7 +42,7 @@ public class CommandBed extends AbstractCommand {
entityPlayerMPs = new EntityPlayerMP[1];
entityPlayerMPs[0] = (EntityPlayerMP) commandSender;
} else {
Commons.addChatMessage(commandSender, getPrefix().appendSibling(new WarpDriveText(Commons.styleWarning, "warpdrive.command.player_required")));
Commons.addChatMessage(commandSender, getPrefix().appendSibling(new WarpDriveText(Commons.getStyleWarning(), "warpdrive.command.player_required")));
return;
}
@ -65,7 +65,7 @@ public class CommandBed extends AbstractCommand {
entityPlayerMPs = new EntityPlayerMP[1];
entityPlayerMPs[0] = (EntityPlayerMP) commandSender;
} else {
Commons.addChatMessage(commandSender, new WarpDriveText(Commons.styleWarning, "warpdrive.command.player_not_found",
Commons.addChatMessage(commandSender, new WarpDriveText(Commons.getStyleWarning(), "warpdrive.command.player_not_found",
args[0] ));
return;
}
@ -75,10 +75,10 @@ public class CommandBed extends AbstractCommand {
for (final EntityPlayerMP entityPlayerMP : entityPlayerMPs) {
final BlockPos bedLocation = entityPlayerMP.getBedLocation(entityPlayerMP.world.provider.getDimension());
if (bedLocation == null) {
Commons.addChatMessage(entityPlayerMP, new WarpDriveText(Commons.styleWarning, "warpdrive.command.no_bed_to_teleport_to_self",
Commons.addChatMessage(entityPlayerMP, new WarpDriveText(Commons.getStyleWarning(), "warpdrive.command.no_bed_to_teleport_to_self",
Commons.format(entityPlayerMP.world) ));
if (args.length != 0) {
Commons.addChatMessage(commandSender, new WarpDriveText(Commons.styleWarning, "warpdrive.command.no_bed_to_teleport_to_other",
Commons.addChatMessage(commandSender, new WarpDriveText(Commons.getStyleWarning(), "warpdrive.command.no_bed_to_teleport_to_other",
entityPlayerMP.getName(),
Commons.format(entityPlayerMP.world) ));
}
@ -87,10 +87,10 @@ public class CommandBed extends AbstractCommand {
final Block block = entityPlayerMP.world.getBlockState(bedLocation).getBlock();
if (!(block instanceof BlockBed)) {
Commons.addChatMessage(entityPlayerMP, new WarpDriveText(Commons.styleWarning, "warpdrive.command.lost_bed_can_t_teleport_self",
Commons.addChatMessage(entityPlayerMP, new WarpDriveText(Commons.getStyleWarning(), "warpdrive.command.lost_bed_can_t_teleport_self",
Commons.format(entityPlayerMP.world) ));
if (args.length != 0) {
Commons.addChatMessage(commandSender, new WarpDriveText(Commons.styleWarning, "warpdrive.command.lost_bed_can_t_teleport_other",
Commons.addChatMessage(commandSender, new WarpDriveText(Commons.getStyleWarning(), "warpdrive.command.lost_bed_can_t_teleport_other",
entityPlayerMP.getName(),
Commons.format(entityPlayerMP.world) ));
}
@ -100,12 +100,12 @@ public class CommandBed extends AbstractCommand {
entityPlayerMP.setPositionAndUpdate(bedLocation.getX() + 0.5D, bedLocation.getY() + 0.5D, bedLocation.getZ() + 0.5D);
if (args.length == 0) {
Commons.addChatMessage(entityPlayerMP, new WarpDriveText(Commons.styleCorrect, "warpdrive.command.teleporting_to_x",
Commons.addChatMessage(entityPlayerMP, new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.command.teleporting_to_x",
Commons.format(entityPlayerMP.world, bedLocation) ));
} else {
Commons.addChatMessage(entityPlayerMP, new WarpDriveText(Commons.styleCorrect, "warpdrive.command.teleporting_by_x_to_y",
Commons.addChatMessage(entityPlayerMP, new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.command.teleporting_by_x_to_y",
Commons.format(entityPlayerMP.world, bedLocation) ));
Commons.addChatMessage(commandSender, new WarpDriveText(Commons.styleCorrect, "warpdrive.command.teleporting_player_x_to_y",
Commons.addChatMessage(commandSender, new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.command.teleporting_player_x_to_y",
entityPlayerMP.getName(),
Commons.format(entityPlayerMP.world, bedLocation) ));
}

View file

@ -69,7 +69,7 @@ public class CommandDump extends AbstractCommand {
final EntityPlayerMP[] entityPlayers = Commons.getOnlinePlayerByNameOrSelector(commandSender, args[1]);
if (entityPlayers == null || entityPlayers.length < 1) {
Commons.addChatMessage(commandSender, new WarpDriveText().append(getPrefix())
.append(Commons.styleWarning, "warpdrive.command.player_not_found",
.append(Commons.getStyleWarning(), "warpdrive.command.player_not_found",
args[1]) );
return;
}
@ -83,7 +83,7 @@ public class CommandDump extends AbstractCommand {
// validate context
if (entityPlayer == null) {
Commons.addChatMessage(commandSender, new WarpDriveText().append(getPrefix())
.append(Commons.styleWarning, "warpdrive.command.player_required") );
.append(Commons.getStyleWarning(), "warpdrive.command.player_required") );
return;
}
@ -97,14 +97,14 @@ public class CommandDump extends AbstractCommand {
//noinspection ConstantConditions
if (world == null || blockPos == null) {
Commons.addChatMessage(commandSender, new WarpDriveText().append(getPrefix())
.append(Commons.styleWarning, "warpdrive.command.invalid_location") );
.append(Commons.getStyleWarning(), "warpdrive.command.invalid_location") );
return;
}
final Collection<Object> inventories = InventoryWrapper.getConnectedInventories(world, blockPos);
if (inventories.isEmpty()) {
Commons.addChatMessage(commandSender, new WarpDriveText().append(getPrefix())
.append(Commons.styleWarning, "warpdrive.command.no_container") );
.append(Commons.getStyleWarning(), "warpdrive.command.no_container") );
return;
}
inventory = inventories.iterator().next();
@ -132,7 +132,7 @@ public class CommandDump extends AbstractCommand {
default:
Commons.addChatMessage(commandSender, new WarpDriveText().append(getPrefix())
.append(Commons.styleWarning, "warpdrive.command.invalid_parameter",
.append(Commons.getStyleWarning(), "warpdrive.command.invalid_parameter",
args[0])
.appendLineBreak()
.appendSibling(new TextComponentString(getUsage(commandSender))) );
@ -143,7 +143,7 @@ public class CommandDump extends AbstractCommand {
final int size = InventoryWrapper.getSize(inventory);
if (size == 0) {
Commons.addChatMessage(commandSender, new WarpDriveText().append(getPrefix())
.append(Commons.styleWarning, "warpdrive.command.empty_inventory") );
.append(Commons.getStyleWarning(), "warpdrive.command.empty_inventory") );
}
for (int indexSlot = 0; indexSlot < size; indexSlot++) {
final ItemStack itemStack = InventoryWrapper.getStackInSlot(inventory, indexSlot);

View file

@ -172,12 +172,12 @@ public class CommandEntity extends AbstractCommand {
}
}
if (count == 0) {
final ITextComponent textComponent = new TextComponentTranslation("warpdrive.command.no_matching_entity", radius).setStyle(Commons.styleWarning);
final ITextComponent textComponent = new TextComponentTranslation("warpdrive.command.no_matching_entity", radius).setStyle(Commons.getStyleWarning());
Commons.addChatMessage(commandSender, textComponent);
return;
}
ITextComponent textComponent = new TextComponentTranslation("warpdrive.command.x_matching_entities", count, radius).setStyle(Commons.styleCorrect);
ITextComponent textComponent = new TextComponentTranslation("warpdrive.command.x_matching_entities", count, radius).setStyle(Commons.getStyleCorrect());
Commons.addChatMessage(commandSender, textComponent);
if (counts.size() < 10) {
for (final Entry<String, Integer> entry : counts.entrySet()) {

View file

@ -48,7 +48,7 @@ public class CommandGenerate extends AbstractCommand {
//noinspection ConstantConditions
if (world == null || blockPos == null) {
Commons.addChatMessage(commandSender, getPrefix().appendSibling(new TextComponentTranslation("warpdrive.command.invalid_location").setStyle(Commons.styleWarning)));
Commons.addChatMessage(commandSender, getPrefix().appendSibling(new TextComponentTranslation("warpdrive.command.invalid_location").setStyle(Commons.getStyleWarning())));
return;
}
@ -68,7 +68,7 @@ public class CommandGenerate extends AbstractCommand {
// Reject command, if player is not in space
if (!CelestialObjectManager.isInSpace(world, blockPos.getX(), blockPos.getZ()) && (!"ship".equals(structure))) {
Commons.addChatMessage(commandSender, getPrefix().appendSibling(new TextComponentTranslation("warpdrive.command.only_in_space").setStyle(Commons.styleWarning)));
Commons.addChatMessage(commandSender, getPrefix().appendSibling(new TextComponentTranslation("warpdrive.command.only_in_space").setStyle(Commons.getStyleWarning())));
return;
}
@ -122,7 +122,7 @@ public class CommandGenerate extends AbstractCommand {
final AbstractStructure structure = StructureManager.getStructure(world.rand, group, name);
if (structure == null) {
Commons.addChatMessage(commandSender, getPrefix().appendSibling(new TextComponentTranslation("Invalid %1$s:%2$s, try one of the followings:\n%3$s",
group, name, StructureManager.getStructureNames(group)).setStyle(Commons.styleWarning)));
group, name, StructureManager.getStructureNames(group)).setStyle(Commons.getStyleWarning())));
} else {
WarpDrive.logger.info(String.format("/generate: Generating %s:%s %s",
group, structure.getName(), Commons.format(world, blockPos)));

View file

@ -1,6 +1,7 @@
package cr0s.warpdrive.command;
import cr0s.warpdrive.Commons;
import cr0s.warpdrive.api.WarpDriveText;
import cr0s.warpdrive.config.WarpDriveConfig;
import javax.annotation.Nonnull;
@ -31,7 +32,7 @@ public class CommandReload extends AbstractCommand {
@Override
public void execute(@Nonnull final MinecraftServer server, @Nonnull final ICommandSender commandSender, @Nonnull final String[] params) {
WarpDriveConfig.reload(server);
Commons.addChatMessage(commandSender, new TextComponentTranslation("warpdrive.command.configuration_reloaded").setStyle(Commons.styleCorrect));
Commons.addChatMessage(commandSender, new TextComponentTranslation("warpdrive.command.liability_warning").setStyle(Commons.styleWarning));
Commons.addChatMessage(commandSender, new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.command.configuration_reloaded"));
Commons.addChatMessage(commandSender, new WarpDriveText(Commons.getStyleWarning(), "warpdrive.command.liability_warning"));
}
}

View file

@ -49,7 +49,7 @@ public class CommandRender extends AbstractCommand {
// validate context
if (entityPlayer == null) {
Commons.addChatMessage(commandSender, new WarpDriveText().append(getPrefix())
.append(Commons.styleWarning, "warpdrive.command.player_required") );
.append(Commons.getStyleWarning(), "warpdrive.command.player_required") );
return;
}
@ -60,7 +60,7 @@ public class CommandRender extends AbstractCommand {
//noinspection ConstantConditions
if (world == null || blockPos == null) {
Commons.addChatMessage(commandSender, new WarpDriveText().append(getPrefix())
.append(Commons.styleWarning, "warpdrive.command.invalid_location") );
.append(Commons.getStyleWarning(), "warpdrive.command.invalid_location") );
return;
}
IBlockState blockState = world.getBlockState(blockPos);
@ -70,39 +70,39 @@ public class CommandRender extends AbstractCommand {
}
Commons.addChatMessage(commandSender, new WarpDriveText().append(getPrefix())
.appendInLine(Commons.styleCorrect, "Dumping render details %s",
.appendInLine(Commons.getStyleCorrect(), "Dumping render details %s",
Commons.format(world, blockPos) ) );
final Block block = blockState.getBlock();
Commons.addChatMessage(commandSender, new WarpDriveText().append(Commons.styleNormal, "Blockstate is %s (%s)",
Commons.addChatMessage(commandSender, new WarpDriveText().append(Commons.getStyleNormal(), "Blockstate is %s (%s)",
Commons.getChatValue(blockState.toString()),
Commons.getChatValue(block.getMetaFromState(blockState))));
Commons.addChatMessage(commandSender, new WarpDriveText().append(Commons.styleNormal, "Light opacity is %s / useNeighborBrightness is %s",
Commons.addChatMessage(commandSender, new WarpDriveText().append(Commons.getStyleNormal(), "Light opacity is %s / useNeighborBrightness is %s",
Commons.getChatValue(block.getLightOpacity(blockState)),
Commons.getChatValue(block.getUseNeighborBrightness(blockState))));
Commons.addChatMessage(commandSender, new WarpDriveText().append(Commons.styleNormal, "isFullBlock is %s / isFullCube is %s / isAir is %s",
Commons.addChatMessage(commandSender, new WarpDriveText().append(Commons.getStyleNormal(), "isFullBlock is %s / isFullCube is %s / isAir is %s",
Commons.getChatValue(block.isFullBlock(blockState)),
Commons.getChatValue(block.isFullCube(blockState)),
Commons.getChatValue(block.isAir(blockState, world, blockPos))));
Commons.addChatMessage(commandSender, new WarpDriveText().append(Commons.styleNormal, "isBlockNormalCube is %s / isNormalCube is %s",
Commons.addChatMessage(commandSender, new WarpDriveText().append(Commons.getStyleNormal(), "isBlockNormalCube is %s / isNormalCube is %s",
Commons.getChatValue(block.isBlockNormalCube(blockState)),
Commons.getChatValue(block.isNormalCube(blockState))));
Commons.addChatMessage(commandSender, new WarpDriveText().append(Commons.styleNormal, "isTopSolid is %s / causesSuffocation is %s",
Commons.addChatMessage(commandSender, new WarpDriveText().append(Commons.getStyleNormal(), "isTopSolid is %s / causesSuffocation is %s",
Commons.getChatValue(block.isTopSolid(blockState)),
Commons.getChatValue(block.causesSuffocation(blockState))));
Commons.addChatMessage(commandSender, new WarpDriveText().append(Commons.styleNormal, "Material isOpaque %s / Material blocksLight is %s",
Commons.addChatMessage(commandSender, new WarpDriveText().append(Commons.getStyleNormal(), "Material isOpaque %s / Material blocksLight is %s",
Commons.getChatValue(blockState.getMaterial().isOpaque()),
Commons.getChatValue(blockState.getMaterial().blocksLight())));
Commons.addChatMessage(commandSender, new WarpDriveText().append(Commons.styleNormal, "Material isLiquid %s / Material isSolid %s",
Commons.addChatMessage(commandSender, new WarpDriveText().append(Commons.getStyleNormal(), "Material isLiquid %s / Material isSolid %s",
Commons.getChatValue(blockState.getMaterial().isLiquid()),
Commons.getChatValue(blockState.getMaterial().isSolid())));
Commons.addChatMessage(commandSender, new WarpDriveText().append(Commons.styleNormal, "isOpaqueCube is %s / isTranslucent %s",
Commons.addChatMessage(commandSender, new WarpDriveText().append(Commons.getStyleNormal(), "isOpaqueCube is %s / isTranslucent %s",
Commons.getChatValue(blockState.isOpaqueCube()),
WarpDrive.proxy.isDedicatedServer() ? Commons.getChatValue("???") : Commons.getChatValue(blockState.isTranslucent())));
Commons.addChatMessage(commandSender, new WarpDriveText().append(Commons.styleNormal, "renderLayer is %s / renderType is %s",
Commons.addChatMessage(commandSender, new WarpDriveText().append(Commons.getStyleNormal(), "renderLayer is %s / renderType is %s",
WarpDrive.proxy.isDedicatedServer() ? Commons.getChatValue("???") : Commons.getChatValue(block.getRenderLayer().toString()),
Commons.getChatValue(block.getRenderType(blockState).toString())));
Commons.addChatMessage(commandSender, new WarpDriveText().append(Commons.styleNormal, "isSideSolid D %s, U %s, N %s, S %s, W %s, E %s",
Commons.addChatMessage(commandSender, new WarpDriveText().append(Commons.getStyleNormal(), "isSideSolid D %s, U %s, N %s, S %s, W %s, E %s",
Commons.getChatValue(block.isSideSolid(blockState, world, blockPos, EnumFacing.DOWN)),
Commons.getChatValue(block.isSideSolid(blockState, world, blockPos, EnumFacing.UP)),
Commons.getChatValue(block.isSideSolid(blockState, world, blockPos, EnumFacing.NORTH)),

View file

@ -67,7 +67,7 @@ public class CommandSpace extends AbstractCommand {
} else if (commandSender instanceof EntityPlayer) {
dimensionIdTarget = StarMapRegistry.getDimensionId(args[0], (EntityPlayer) commandSender);
} else {
Commons.addChatMessage(commandSender, getPrefix().appendSibling(new TextComponentTranslation("warpdrive.command.player_not_found", args[0]).setStyle(Commons.styleWarning)));
Commons.addChatMessage(commandSender, getPrefix().appendSibling(new TextComponentTranslation("warpdrive.command.player_not_found", args[0]).setStyle(Commons.getStyleWarning())));
return;
}
@ -76,19 +76,19 @@ public class CommandSpace extends AbstractCommand {
if (entityPlayerMPs_found != null) {
entityPlayerMPs = entityPlayerMPs_found;
} else {
Commons.addChatMessage(commandSender, getPrefix().appendSibling(new TextComponentTranslation("warpdrive.command.player_not_found", args[0]).setStyle(Commons.styleWarning)));
Commons.addChatMessage(commandSender, getPrefix().appendSibling(new TextComponentTranslation("warpdrive.command.player_not_found", args[0]).setStyle(Commons.getStyleWarning())));
return;
}
dimensionIdTarget = StarMapRegistry.getDimensionId(args[1], entityPlayerMPs[0]);
} else {
Commons.addChatMessage(commandSender, getPrefix().appendSibling(new TextComponentTranslation("warpdrive.command.too_many_arguments", args.length).setStyle(Commons.styleWarning)));
Commons.addChatMessage(commandSender, getPrefix().appendSibling(new TextComponentTranslation("warpdrive.command.too_many_arguments", args.length).setStyle(Commons.getStyleWarning())));
return;
}
// check player
if (entityPlayerMPs == null || entityPlayerMPs.length <= 0) {
Commons.addChatMessage(commandSender, getPrefix().appendSibling(new TextComponentTranslation("warpdrive.command.player_not_found", args[0]).setStyle(Commons.styleWarning)));
Commons.addChatMessage(commandSender, getPrefix().appendSibling(new TextComponentTranslation("warpdrive.command.player_not_found", args[0]).setStyle(Commons.getStyleWarning())));
return;
}
@ -101,8 +101,8 @@ public class CommandSpace extends AbstractCommand {
if (dimensionIdTarget == Integer.MAX_VALUE) {
if (celestialObjectCurrent == null) {
Commons.addChatMessage(commandSender, getPrefix().appendSibling(new TextComponentTranslation("warpdrive.command.player_in_unknown_dimension",
entityPlayerMP.getName(), entityPlayerMP.world.provider.getDimension()).setStyle(Commons.styleWarning)));
Commons.addChatMessage(commandSender, new TextComponentTranslation("warpdrive.command.specify_explicit_dimension").setStyle(Commons.styleCorrect));
entityPlayerMP.getName(), entityPlayerMP.world.provider.getDimension()).setStyle(Commons.getStyleWarning())));
Commons.addChatMessage(commandSender, new TextComponentTranslation("warpdrive.command.specify_explicit_dimension").setStyle(Commons.getStyleCorrect()));
continue;
}
if ( celestialObjectCurrent.isSpace()
@ -113,8 +113,8 @@ public class CommandSpace extends AbstractCommand {
dimensionIdTarget = 0;
} else if (celestialObjectChild.isVirtual()) {
Commons.addChatMessage(commandSender, getPrefix().appendSibling(new TextComponentTranslation("warpdrive.command.player_can_t_go_virtual",
entityPlayerMP.getName(), celestialObjectChild.getDisplayName()).setStyle(Commons.styleWarning) ));
Commons.addChatMessage(commandSender, new TextComponentTranslation("warpdrive.command.specify_explicit_dimension").setStyle(Commons.styleCorrect));
entityPlayerMP.getName(), celestialObjectChild.getDisplayName()).setStyle(Commons.getStyleWarning()) ));
Commons.addChatMessage(commandSender, new TextComponentTranslation("warpdrive.command.specify_explicit_dimension").setStyle(Commons.getStyleCorrect()));
continue;
} else {
dimensionIdTarget = celestialObjectChild.dimensionId;
@ -174,19 +174,19 @@ public class CommandSpace extends AbstractCommand {
final WorldServer worldTarget = Commons.getOrCreateWorldServer(dimensionIdTarget);
if (worldTarget == null) {
Commons.addChatMessage(commandSender, getPrefix().appendSibling(new TextComponentTranslation("warpdrive.command.undefined_dimension",
dimensionIdTarget).setStyle(Commons.styleWarning)));
dimensionIdTarget).setStyle(Commons.getStyleWarning())));
continue;
}
// inform player
final ITextComponent textComponent = new TextComponentTranslation("warpdrive.command.teleporting_player_x_to_y",
entityPlayerMP.getName(),
Commons.format(worldTarget)).setStyle(Commons.styleCorrect);
Commons.format(worldTarget)).setStyle(Commons.getStyleCorrect());
Commons.addChatMessage(commandSender, textComponent);
WarpDrive.logger.info(textComponent.getUnformattedText());
if (commandSender != entityPlayerMP) {
Commons.addChatMessage(entityPlayerMP, new TextComponentTranslation("warpdrive.command.teleporting_by_x_to_y",
commandSender.getName(), Commons.format(worldTarget), dimensionIdTarget).setStyle(Commons.styleCorrect));
commandSender.getName(), Commons.format(worldTarget), dimensionIdTarget).setStyle(Commons.getStyleCorrect()));
}
// find a good spot

View file

@ -57,7 +57,7 @@ public class CompatAppliedEnergistics2 implements IBlockTransformer {
try {
final Object object = methodTileQuantumBridge_getQEFrequency.invoke(tileEntity);
if (((Long)object) != 0L) {
reason.append(Commons.styleWarning, "warpdrive.compat.guide.quantum_field_interference");
reason.append(Commons.getStyleWarning(), "warpdrive.compat.guide.quantum_field_interference");
return false;
} else {
return true;

View file

@ -68,7 +68,7 @@ public class CompatBuildCraft implements IBlockTransformer {
|| classBlockQuarry.isInstance(block)
|| classBlockReplacer.isInstance(block)
|| classBlockZonePlanner.isInstance(block) ) {
reason.append(Commons.styleWarning, "warpdrive.compat.guide.block_detected_on_board",
reason.append(Commons.getStyleWarning(), "warpdrive.compat.guide.block_detected_on_board",
new TextComponentTranslation(block.getTranslationKey()));
return false;
}

View file

@ -96,7 +96,7 @@ public class CompatDraconicEvolution implements IBlockTransformer {
public boolean isJumpReady(final Block block, final int metadata, final TileEntity tileEntity, final WarpDriveText reason) {
if ( classBlockDislocatorReceptacle.isInstance(block)
|| classBlockPortal.isInstance(block) ) {
reason.append(Commons.styleWarning, "warpdrive.compat.guide.draconic_evolution_portal");
reason.append(Commons.getStyleWarning(), "warpdrive.compat.guide.draconic_evolution_portal");
return false;
}
return true;

View file

@ -51,7 +51,7 @@ public class CompatSGCraft implements IBlockTransformer {
final Object object = methodSGBaseTE_sgStateDescription.invoke(tileEntity);
final String state = (String)object;
if (!state.equalsIgnoreCase("Idle")) {
reason.append(Commons.styleWarning, "warpdrive.compat.guide.stargate_is_active", state);
reason.append(Commons.getStyleWarning(), "warpdrive.compat.guide.stargate_is_active", state);
return false;
}
} catch (final IllegalAccessException | IllegalArgumentException | InvocationTargetException exception) {

View file

@ -80,7 +80,7 @@ public class AcceleratorSetup extends GlobalPosition {
public double particleEnergy_energyCost_perTick;
protected boolean isAssemblyValid = true;
protected WarpDriveText textValidityIssues = new WarpDriveText(Commons.styleWarning, "-undefined accelerator setup-");
protected WarpDriveText textValidityIssues = new WarpDriveText(Commons.getStyleWarning(), "-undefined accelerator setup-");
public AcceleratorSetup(final int dimensionId, @Nonnull final BlockPos blockPos) {
super(dimensionId, blockPos.getX(), blockPos.getY(), blockPos.getZ());
@ -201,7 +201,7 @@ public class AcceleratorSetup extends GlobalPosition {
}
if (firstVoidShell == null) {
isAssemblyValid = false;
textValidityIssues = new WarpDriveText(Commons.styleWarning, "warpdrive.accelerator.status_line.missing_void_shell_connection");
textValidityIssues = new WarpDriveText(Commons.getStyleWarning(), "warpdrive.accelerator.status_line.missing_void_shell_connection");
return;
}
@ -226,7 +226,7 @@ public class AcceleratorSetup extends GlobalPosition {
}
if (trajectoryPoint == null) {
isAssemblyValid = false;
textValidityIssues = new WarpDriveText(Commons.styleWarning, "warpdrive.accelerator.status_line.missing_void_shell_connection");
textValidityIssues = new WarpDriveText(Commons.getStyleWarning(), "warpdrive.accelerator.status_line.missing_void_shell_connection");
return;
}
@ -377,21 +377,21 @@ public class AcceleratorSetup extends GlobalPosition {
// check counts
if (mapInjectors.isEmpty()) {
isValid = false;
textReason.append(Commons.styleWarning, "warpdrive.accelerator.status_line.missing_injector");
textReason.append(Commons.getStyleWarning(), "warpdrive.accelerator.status_line.missing_injector");
}
if (listColliders.isEmpty()) {
isValid = false;
textReason.append(Commons.styleWarning, "warpdrive.accelerator.status_line.missing_collider_node");
textReason.append(Commons.getStyleWarning(), "warpdrive.accelerator.status_line.missing_collider_node");
}
if (countMagnets[2] > 0 && countChillers[2] == 0) {
isValid = false;
textReason.append(Commons.styleWarning, "warpdrive.accelerator.status_line.missing_superior_chiller");
textReason.append(Commons.getStyleWarning(), "warpdrive.accelerator.status_line.missing_superior_chiller");
} else if (countMagnets[1] > 0 && countChillers[1] == 0) {
isValid = false;
textReason.append(Commons.styleWarning, "warpdrive.accelerator.status_line.missing_advanced_chiller");
textReason.append(Commons.getStyleWarning(), "warpdrive.accelerator.status_line.missing_advanced_chiller");
} else if (countMagnets[0] > 0 && countChillers[0] == 0) {
isValid = false;
textReason.append(Commons.styleWarning, "warpdrive.accelerator.status_line.missing_basic_chiller");
textReason.append(Commons.getStyleWarning(), "warpdrive.accelerator.status_line.missing_basic_chiller");
}
// update validity status

View file

@ -102,9 +102,9 @@ public class EnergyWrapper {
final String energyMaxStorage_units = EnergyWrapper.format(maxStorage, unitsToUse);
final WarpDriveText textRate = new WarpDriveText(null, "warpdrive.energy.status_line.charge")
.appendInLine(null, " ")
.appendInLine(Commons.styleValue, energyStored_units)
.appendInLine(Commons.getStyleValue(), energyStored_units)
.appendInLine(null, " / ")
.appendInLine(Commons.styleValue, energyMaxStorage_units)
.appendInLine(Commons.getStyleValue(), energyMaxStorage_units)
.appendInLine(null, String.format(" %s.", unitsToUse));
warpDriveText.append(textRate);
}
@ -162,11 +162,11 @@ public class EnergyWrapper {
final long amperage, final long voltage, final int tier, @Nonnull final String units) {
final WarpDriveText textRate = new WarpDriveText(null, translationKey)
.appendInLine(null, " ")
.appendInLine(Commons.styleValue, amperage)
.appendInLine(Commons.getStyleValue(), amperage)
.appendInLine(null, " x ")
.appendInLine(Commons.styleVoltage, voltage)
.appendInLine(Commons.getStyleVoltage(), voltage)
.appendInLine(null, String.format(" %s/t (", units))
.appendInLine(Commons.styleVoltage, EnergyWrapper.EU_nameTier[tier])
.appendInLine(Commons.getStyleVoltage(), EnergyWrapper.EU_nameTier[tier])
.appendInLine(null, ").");
warpDriveText.append(textRate);
}

View file

@ -92,7 +92,7 @@ public enum EnumShipMovementType implements IStringSerializable {
} else if (isInSpace) {
return HYPERSPACE_ENTERING;
}
reason.append(Commons.styleWarning, "warpdrive.ship.guide.unable_to_reach_hyperspace_from_planet");
reason.append(Commons.getStyleWarning(), "warpdrive.ship.guide.unable_to_reach_hyperspace_from_planet");
return null;
case MANUAL:
@ -126,7 +126,7 @@ public enum EnumShipMovementType implements IStringSerializable {
// invalid command?
WarpDrive.logger.error(String.format("Invalid command '%s'",
command));
reason.append(Commons.styleWarning, "warpdrive.error.internal_check_console");
reason.append(Commons.getStyleWarning(), "warpdrive.error.internal_check_console");
return null;
}
}

View file

@ -63,9 +63,9 @@ public class FluidWrapper {
final String energyMaxStorage_units = FluidWrapper.format(maxStorage, unitsToUse);
final WarpDriveText textRate = new WarpDriveText(null, "warpdrive.fluid.status_line.charge")
.appendInLine(null, " ")
.appendInLine(Commons.styleValue, energyStored_units)
.appendInLine(Commons.getStyleValue(), energyStored_units)
.appendInLine(null, " / ")
.appendInLine(Commons.styleValue, energyMaxStorage_units)
.appendInLine(Commons.getStyleValue(), energyMaxStorage_units)
.appendInLine(null, String.format(" %s.", unitsToUse));
warpDriveText.append(textRate);
}
@ -100,7 +100,7 @@ public class FluidWrapper {
final long rate, final String units) {
final String unitsToUse = units == null ? WarpDriveConfig.ENERGY_DISPLAY_UNITS : units;
final WarpDriveText textRate = new WarpDriveText(null, translationKey)
.appendInLine(Commons.styleValue, String.format(" %d", convert(rate, unitsToUse)))
.appendInLine(Commons.getStyleValue(), String.format(" %d", convert(rate, unitsToUse)))
.appendInLine(null, String.format(" %s/t.", unitsToUse));
warpDriveText.append(textRate);
}

View file

@ -55,7 +55,7 @@ public class JumpShip {
public static JumpShip createFromFile(final String fileName, final WarpDriveText reason) {
final NBTTagCompound schematic = Commons.readNBTFromFile(WarpDriveConfig.G_SCHEMATICS_LOCATION + "/" + fileName + ".schematic");
if (schematic == null) {
reason.append(Commons.styleWarning, "warpdrive.ship.guide.schematic_not_found",
reason.append(Commons.getStyleWarning(), "warpdrive.ship.guide.schematic_not_found",
fileName + ".schematic");
return null;
}
@ -76,7 +76,7 @@ public class JumpShip {
final int height = schematic.getInteger("Height");
final int length = schematic.getInteger("Length");
if (width <= 0 || height <= 0 || length <= 0) {
reason.append(new WarpDriveText(Commons.styleWarning, "warpdrive.ship.guide.schematic_invalid_format",
reason.append(new WarpDriveText(Commons.getStyleWarning(), "warpdrive.ship.guide.schematic_invalid_format",
String.format("Invalid size values: expecting strictly positive integers, found %1d %2d %3d.",
width, height, length) ));
return null;
@ -101,7 +101,7 @@ public class JumpShip {
// Offset is core position relative to origin
final int[] intOffset = schematic.getIntArray("Offset");
if (intOffset.length != 3) {
reason.append(new WarpDriveText(Commons.styleWarning, "warpdrive.ship.guide.schematic_invalid_format",
reason.append(new WarpDriveText(Commons.getStyleWarning(), "warpdrive.ship.guide.schematic_invalid_format",
String.format("Invalid offset format: expecting 3 integers, found %1d",
intOffset.length) ));
return null;
@ -114,7 +114,7 @@ public class JumpShip {
vOrigin = new VectorI(0, 0, 0 );
} else {
reason.append(new WarpDriveText(Commons.styleWarning, "warpdrive.ship.guide.schematic_invalid_format",
reason.append(new WarpDriveText(Commons.getStyleWarning(), "warpdrive.ship.guide.schematic_invalid_format",
"Unknown offset format"));
return null;
}
@ -159,7 +159,7 @@ public class JumpShip {
final byte[] localAddBlocks = schematic.hasKey("AddBlocks") ? schematic.getByteArray("AddBlocks") : null;
final byte[] localMetadata = blockStatePalette == null ? schematic.getByteArray("Data") : null;
if (localBlocks.length != jumpShip.jumpBlocks.length) {
reason.append(new WarpDriveText(Commons.styleWarning, "warpdrive.ship.guide.schematic_invalid_format",
reason.append(new WarpDriveText(Commons.getStyleWarning(), "warpdrive.ship.guide.schematic_invalid_format",
String.format("Invalid array size for Blocks: expecting %d (%d x %d x %d), found %d",
width, height, length,
jumpShip.jumpBlocks.length,
@ -168,7 +168,7 @@ public class JumpShip {
}
final int sizeAddBlocks = (int) Math.ceil((jumpShip.jumpBlocks.length + 1.0F) / 2);
if (localAddBlocks != null && localAddBlocks.length != sizeAddBlocks) {
reason.append(new WarpDriveText(Commons.styleWarning, "warpdrive.ship.guide.schematic_invalid_format",
reason.append(new WarpDriveText(Commons.getStyleWarning(), "warpdrive.ship.guide.schematic_invalid_format",
String.format("Invalid array size for AddBlocks: expecting %d (%d x %d x %d), found %d",
width, height, length,
jumpShip.jumpBlocks.length,
@ -176,7 +176,7 @@ public class JumpShip {
return null;
}
if (localMetadata != null && localMetadata.length != jumpShip.jumpBlocks.length) {
reason.append(new WarpDriveText(Commons.styleWarning, "warpdrive.ship.guide.schematic_invalid_format",
reason.append(new WarpDriveText(Commons.getStyleWarning(), "warpdrive.ship.guide.schematic_invalid_format",
String.format("Invalid array size for Metadata: expecting %d (%d x %d x %d), found %d",
width, height, length,
jumpShip.jumpBlocks.length,
@ -200,7 +200,7 @@ public class JumpShip {
} else if (tagCompoundTileEntity.hasKey("Pos")) {
final int[] intPosition = tagCompoundTileEntity.getIntArray("Pos");
if (intPosition.length != 3) {
reason.append(new WarpDriveText(Commons.styleWarning, "warpdrive.ship.guide.schematic_invalid_format",
reason.append(new WarpDriveText(Commons.getStyleWarning(), "warpdrive.ship.guide.schematic_invalid_format",
String.format("Invalid array size for TileEntity Pos: expecting 3, found %d in %s",
intPosition.length, tagCompoundTileEntity ) ));
return null;
@ -209,7 +209,7 @@ public class JumpShip {
yTileEntity = intPosition[1];
zTileEntity = intPosition[2];
} else {
reason.append(new WarpDriveText(Commons.styleWarning, "warpdrive.ship.guide.schematic_invalid_format",
reason.append(new WarpDriveText(Commons.getStyleWarning(), "warpdrive.ship.guide.schematic_invalid_format",
String.format("Missing position for TileEntity %s",
tagCompoundTileEntity ) ));
return null;
@ -314,7 +314,7 @@ public class JumpShip {
if (world == null) {
WarpDrive.logger.error("Invalid call to saveEntities, please report it to mod author: world is null");
reason.append(Commons.styleWarning, "warpdrive.error.internal_check_console");
reason.append(Commons.getStyleWarning(), "warpdrive.error.internal_check_console");
return false;
}
@ -328,7 +328,7 @@ public class JumpShip {
}
if (Dictionary.isAnchor(entity)) {
reason.append(Commons.styleWarning, "warpdrive.ship.guide.anchor_entity_detected",
reason.append(Commons.getStyleWarning(), "warpdrive.ship.guide.anchor_entity_detected",
Dictionary.getId(entity),
Math.round(entity.posX), Math.round(entity.posY), Math.round(entity.posZ) );
isSuccess = false;
@ -358,7 +358,7 @@ public class JumpShip {
public boolean removeEntities(final WarpDriveText reason) {
if (world == null) {
WarpDrive.logger.error("Invalid call to removeEntities, please report it to mod author: world is null");
reason.append(Commons.styleWarning, "warpdrive.error.internal_check_console");
reason.append(Commons.getStyleWarning(), "warpdrive.error.internal_check_console");
return false;
}
@ -487,10 +487,10 @@ public class JumpShip {
continue;
}
reason.append(Commons.styleWarning, "warpdrive.ship.guide.ship_snagged1",
reason.append(Commons.getStyleWarning(), "warpdrive.ship.guide.ship_snagged1",
blockState.getBlock().getLocalizedName(),
x, y, z);
reason.append(Commons.styleCommand, "warpdrive.ship.guide.ship_snagged2");
reason.append(Commons.getStyleCommand(), "warpdrive.ship.guide.ship_snagged2");
world.createExplosion(null, x, y, z, Math.min(4F * 30, 4F * (jumpBlocks.length / 50.0F)), false);
return false;
}
@ -548,7 +548,7 @@ public class JumpShip {
// Stop on non-movable blocks
if (Dictionary.BLOCKS_ANCHOR.contains(blockState.getBlock())) {
reason.append(Commons.styleWarning, "warpdrive.ship.guide.anchor_block_detected",
reason.append(Commons.getStyleWarning(), "warpdrive.ship.guide.anchor_block_detected",
blockState.getBlock().getLocalizedName(),
x, y, z);
return false;
@ -562,7 +562,7 @@ public class JumpShip {
final IBlockTransformer blockTransformer = WarpDriveConfig.blockTransformers.get(external.getKey());
if (blockTransformer != null) {
if (!blockTransformer.isJumpReady(jumpBlock.block, jumpBlock.blockMeta, tileEntity, reason)) {
reason.append(Commons.styleWarning, "warpdrive.ship.guide.block_not_ready_for_jump",
reason.append(Commons.getStyleWarning(), "warpdrive.ship.guide.block_not_ready_for_jump",
jumpBlock.block.getLocalizedName(),
jumpBlock.x, jumpBlock.y, jumpBlock.z);
return false;
@ -600,7 +600,7 @@ public class JumpShip {
actualMass = newMass;
} catch (final Exception exception) {
exception.printStackTrace();
final WarpDriveText textComponent = new WarpDriveText(Commons.styleWarning, "warpdrive.ship.guide.save_exception",
final WarpDriveText textComponent = new WarpDriveText(Commons.getStyleWarning(), "warpdrive.ship.guide.save_exception",
Commons.format(world, blockPos));
WarpDrive.logger.error(textComponent.getUnformattedText());
reason.appendSibling(textComponent);

View file

@ -417,39 +417,39 @@ public class TrajectoryPoint extends VectorI {
final String strPosition = String.format("(%d %d %d)",
x, y, z );
if ((errorCode & ERROR_DOUBLE_JUNCTION) != 0) {
textReason.append(Commons.styleWarning, "warpdrive.accelerator.status_line.invalid_double_junction",
textReason.append(Commons.getStyleWarning(), "warpdrive.accelerator.status_line.invalid_double_junction",
strPosition );
}
if ((errorCode & ERROR_VERTICAL_JUNCTION) != 0) {
textReason.append(Commons.styleWarning, "warpdrive.accelerator.status_line.invalid_vertical_junction",
textReason.append(Commons.getStyleWarning(), "warpdrive.accelerator.status_line.invalid_vertical_junction",
strPosition );
}
if ((errorCode & ERROR_MISSING_TURNING_MAGNET) != 0) {
textReason.append(Commons.styleWarning, "warpdrive.accelerator.status_line.missing_turning_magnet",
textReason.append(Commons.getStyleWarning(), "warpdrive.accelerator.status_line.missing_turning_magnet",
strPosition );
}
if ((errorCode & ERROR_MISSING_MAIN_MAGNET) != 0) {
textReason.append(Commons.styleWarning, "warpdrive.accelerator.status_line.missing_main_magnets",
textReason.append(Commons.getStyleWarning(), "warpdrive.accelerator.status_line.missing_main_magnets",
strPosition );
}
if ((errorCode & ERROR_MISSING_CORNER_MAGNET) != 0) {
textReason.append(Commons.styleWarning, "warpdrive.accelerator.status_line.missing_corner_magnets",
textReason.append(Commons.getStyleWarning(), "warpdrive.accelerator.status_line.missing_corner_magnets",
strPosition );
}
if ((errorCode & ERROR_MISSING_COLLIDER) != 0) {
textReason.append(Commons.styleWarning, "warpdrive.accelerator.status_line.missing_collider_block",
textReason.append(Commons.getStyleWarning(), "warpdrive.accelerator.status_line.missing_collider_block",
strPosition );
}
if ((errorCode & ERROR_MISSING_VOID_SHELL) != 0) {
textReason.append(Commons.styleWarning, "warpdrive.accelerator.status_line.missing_void_shell",
textReason.append(Commons.getStyleWarning(), "warpdrive.accelerator.status_line.missing_void_shell",
strPosition);
}
if ((errorCode & ERROR_TOO_MANY_VOID_SHELLS) != 0) {
textReason.append(Commons.styleWarning, "warpdrive.accelerator.status_line.too_many_void_shells",
textReason.append(Commons.getStyleWarning(), "warpdrive.accelerator.status_line.too_many_void_shells",
strPosition );
}
if (strReasonBefore.equals(textReason.getUnformattedText())) {
textReason.append(Commons.styleWarning, "warpdrive.accelerator.status_line.invalid_error_code",
textReason.append(Commons.getStyleWarning(), "warpdrive.accelerator.status_line.invalid_error_code",
errorCode, strPosition);
}
return false;

View file

@ -62,7 +62,7 @@ public class DeploySequencer extends JumpSequencer {
// Warn owner if deployment done but wait next tick for teleportation
final EntityPlayerMP entityPlayerMP = Commons.getOnlinePlayerByName(playerNameRequester);
if (entityPlayerMP != null) {
Commons.addChatMessage(entityPlayerMP, new WarpDriveText(Commons.styleCorrect, "warpdrive.builder.guide.ship_deployed"));
Commons.addChatMessage(entityPlayerMP, new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.builder.guide.ship_deployed"));
}
}
}
@ -77,7 +77,7 @@ public class DeploySequencer extends JumpSequencer {
if (tileEntity instanceof TileEntityShipCore) {
final boolean isSuccess = ((TileEntityShipCore) tileEntity).summonOwnerOnDeploy(entityPlayerMP);
if (isSuccess) {
Commons.addChatMessage(entityPlayerMP, new WarpDriveText(Commons.styleCorrect, "warpdrive.builder.guide.welcome_aboard"));
Commons.addChatMessage(entityPlayerMP, new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.builder.guide.welcome_aboard"));
} else {
WarpDrive.logger.warn(String.format("Failed to assign new captain %s",
playerNameRequester));

View file

@ -181,7 +181,7 @@ public class JumpSequencer extends AbstractSequencer {
if (isSuccessful) {
reason = reasonRaw;
} else {
reason = new WarpDriveText(Commons.styleWarning, "warpdrive.ship.guide.movement_aborted")
reason = new WarpDriveText(Commons.getStyleWarning(), "warpdrive.ship.guide.movement_aborted")
.append(reasonRaw);
}
disable(isSuccessful, reason);
@ -237,7 +237,7 @@ public class JumpSequencer extends AbstractSequencer {
}
if (ship.minY < 0 || ship.maxY > 255) {
disableAndMessage(false, new WarpDriveText(Commons.styleWarning, "warpdrive.ship.guide.invalid_y_coordinates"));
disableAndMessage(false, new WarpDriveText(Commons.getStyleWarning(), "warpdrive.ship.guide.invalid_y_coordinates"));
return true;
}
@ -358,7 +358,7 @@ public class JumpSequencer extends AbstractSequencer {
break;
default:
disableAndMessage(false, new WarpDriveText(Commons.styleWarning, "warpdrive.ship.guide.invalid_state"));
disableAndMessage(false, new WarpDriveText(Commons.getStyleWarning(), "warpdrive.ship.guide.invalid_state"));
return true;
}
return true;
@ -371,7 +371,7 @@ public class JumpSequencer extends AbstractSequencer {
}
sourceWorldTicket = ForgeChunkManager.requestTicket(WarpDrive.instance, sourceWorld, Type.NORMAL);
if (sourceWorldTicket == null) {
reason.append(Commons.styleWarning, "warpdrive.ship.guide.chunkloading_rejected_in_source_world",
reason.append(Commons.getStyleWarning(), "warpdrive.ship.guide.chunkloading_rejected_in_source_world",
Commons.format(sourceWorld));
return false;
}
@ -385,10 +385,10 @@ public class JumpSequencer extends AbstractSequencer {
for (int z = minZ; z <= maxZ; z++) {
chunkCount++;
if (chunkCount > sourceWorldTicket.getMaxChunkListDepth()) {
reason.append(Commons.styleWarning, "warpdrive.ship.guide.too_many_chunks_to_load",
reason.append(Commons.getStyleWarning(), "warpdrive.ship.guide.too_many_chunks_to_load",
(maxX - minX + 1) * (maxZ - minZ + 1),
sourceWorldTicket.getMaxChunkListDepth());
reason.append(Commons.styleCommand, "warpdrive.ship.guide.max_chunkloading");
reason.append(Commons.getStyleCommand(), "warpdrive.ship.guide.max_chunkloading");
return false;
}
ForgeChunkManager.forceChunk(sourceWorldTicket, new ChunkPos(x, z));
@ -405,7 +405,7 @@ public class JumpSequencer extends AbstractSequencer {
}
targetWorldTicket = ForgeChunkManager.requestTicket(WarpDrive.instance, targetWorld, Type.NORMAL);
if (targetWorldTicket == null) {
reason.append(Commons.styleWarning, "warpdrive.ship.guide.chunkloading_rejected_in_target_world",
reason.append(Commons.getStyleWarning(), "warpdrive.ship.guide.chunkloading_rejected_in_target_world",
Commons.format(targetWorld));
return false;
}
@ -421,10 +421,10 @@ public class JumpSequencer extends AbstractSequencer {
for (int z = minZ; z <= maxZ; z++) {
chunkCount++;
if (chunkCount > targetWorldTicket.getMaxChunkListDepth()) {
reason.append(Commons.styleWarning, "warpdrive.ship.guide.too_many_chunks_to_load",
reason.append(Commons.getStyleWarning(), "warpdrive.ship.guide.too_many_chunks_to_load",
(maxX - minX + 1) * (maxZ - minZ + 1),
targetWorldTicket.getMaxChunkListDepth());
reason.append(Commons.styleCommand, "warpdrive.ship.guide.max_chunkloading");
reason.append(Commons.getStyleCommand(), "warpdrive.ship.guide.max_chunkloading");
return false;
}
ForgeChunkManager.forceChunk(targetWorldTicket, new ChunkPos(x, z));
@ -607,7 +607,7 @@ public class JumpSequencer extends AbstractSequencer {
|| CelestialObjectManager.isPlanet(targetWorld, ship.core.getX() + moveX, ship.core.getZ() + moveZ) ) {
if (!ship.isUnlimited() && ship.actualMass > WarpDriveConfig.SHIP_MASS_MAX_ON_PLANET_SURFACE) {
LocalProfiler.stop();
disableAndMessage(false, new WarpDriveText(Commons.styleWarning, "warpdrive.ship.guide.too_much_mass_for_planet",
disableAndMessage(false, new WarpDriveText(Commons.getStyleWarning(), "warpdrive.ship.guide.too_much_mass_for_planet",
WarpDriveConfig.SHIP_MASS_MAX_ON_PLANET_SURFACE, ship.actualMass));
return;
}
@ -704,14 +704,14 @@ public class JumpSequencer extends AbstractSequencer {
doCollisionDamage(false);
// cancel jump
final WarpDriveText textOverlapping = new WarpDriveText(Commons.styleWarning, "warpdrive.ship.guide.overlapping_source_and_target");
final WarpDriveText textOverlapping = new WarpDriveText(Commons.getStyleWarning(), "warpdrive.ship.guide.overlapping_source_and_target");
final WarpDriveText textComponent;
if (firstAdjustmentReason.isEmpty()) {
textComponent = textOverlapping;
} else if (firstAdjustmentReason.getUnformattedText().equals(textOverlapping.getUnformattedText())) {
textComponent = firstAdjustmentReason;
} else {
textComponent = firstAdjustmentReason.append(Commons.styleWarning, "warpdrive.ship.guide.not_enough_space_after_adjustment");
textComponent = firstAdjustmentReason.append(Commons.getStyleWarning(), "warpdrive.ship.guide.not_enough_space_after_adjustment");
}
disableAndMessage(false, textComponent);
LocalProfiler.stop();
@ -730,7 +730,7 @@ public class JumpSequencer extends AbstractSequencer {
// are we in range?
if (!celestialObjectTarget.isInsideBorder(aabbTarget)) {
final AxisAlignedBB axisAlignedBB = celestialObjectTarget.getWorldBorderArea();
final WarpDriveText message = new WarpDriveText(Commons.styleWarning, "warpdrive.ship.guide.target_outside_planet_border",
final WarpDriveText message = new WarpDriveText(Commons.getStyleWarning(), "warpdrive.ship.guide.target_outside_planet_border",
(int) axisAlignedBB.minX, (int) axisAlignedBB.minY, (int) axisAlignedBB.minZ,
(int) axisAlignedBB.maxX, (int) axisAlignedBB.maxY, (int) axisAlignedBB.maxZ );
LocalProfiler.stop();
@ -852,7 +852,7 @@ public class JumpSequencer extends AbstractSequencer {
final CelestialObject celestialObject = CelestialObjectManager.getClosestChild(sourceWorld, ship.core.getX(), ship.core.getZ());
// anything defined?
if (celestialObject == null) {
reason.append(Commons.styleWarning, "warpdrive.ship.guide.no_celestial_object_in_hyperspace",
reason.append(Commons.getStyleWarning(), "warpdrive.ship.guide.no_celestial_object_in_hyperspace",
Commons.format(sourceWorld), sourceWorld.provider.getDimension());
return false;
}
@ -861,7 +861,7 @@ public class JumpSequencer extends AbstractSequencer {
final double distanceSquared = celestialObject.getSquareDistanceInParent(sourceWorld.provider.getDimension(), ship.core.getX(), ship.core.getZ());
if (distanceSquared > 0.0D) {
final AxisAlignedBB axisAlignedBB = celestialObject.getAreaInParent();
reason.append(Commons.styleWarning, "warpdrive.ship.guide.no_star_system_in_range",
reason.append(Commons.getStyleWarning(), "warpdrive.ship.guide.no_star_system_in_range",
(int) Math.sqrt(distanceSquared),
(int) axisAlignedBB.minX, (int) axisAlignedBB.minY, (int) axisAlignedBB.minZ,
(int) axisAlignedBB.maxX, (int) axisAlignedBB.maxY, (int) axisAlignedBB.maxZ);
@ -872,7 +872,7 @@ public class JumpSequencer extends AbstractSequencer {
final int dimensionIdSpace = celestialObject.dimensionId;
targetWorld = Commons.getOrCreateWorldServer(dimensionIdSpace);
if (targetWorld == null) {
reason.append(Commons.styleWarning, "warpdrive.ship.guide.exception_loading_dimension",
reason.append(Commons.getStyleWarning(), "warpdrive.ship.guide.exception_loading_dimension",
dimensionIdSpace);
return false;
}
@ -887,7 +887,7 @@ public class JumpSequencer extends AbstractSequencer {
case HYPERSPACE_ENTERING: {
// anything defined?
if (celestialObjectSource.parent == null) {
reason.append(Commons.styleWarning, "warpdrive.ship.guide.unable_to_reach_hyperspace_no_parent",
reason.append(Commons.getStyleWarning(), "warpdrive.ship.guide.unable_to_reach_hyperspace_no_parent",
Commons.format(sourceWorld), sourceWorld.provider.getDimension());
return false;
}
@ -897,7 +897,7 @@ public class JumpSequencer extends AbstractSequencer {
final int dimensionIdHyperspace = celestialObjectSource.parent.dimensionId;
targetWorld = Commons.getOrCreateWorldServer(dimensionIdHyperspace);
if (targetWorld == null) {
reason.append(Commons.styleWarning, "warpdrive.ship.guide.exception_loading_dimension",
reason.append(Commons.getStyleWarning(), "warpdrive.ship.guide.exception_loading_dimension",
dimensionIdHyperspace);
return false;
}
@ -912,7 +912,7 @@ public class JumpSequencer extends AbstractSequencer {
case PLANET_TAKEOFF: {
// anything defined?
if (celestialObjectSource.parent == null) {
reason.append(Commons.styleWarning, "warpdrive.ship.guide.unable_to_reach_space_no_parent",
reason.append(Commons.getStyleWarning(), "warpdrive.ship.guide.unable_to_reach_space_no_parent",
Commons.format(sourceWorld), sourceWorld.provider.getDimension());
return false;
}
@ -921,7 +921,7 @@ public class JumpSequencer extends AbstractSequencer {
final double distanceSquared = celestialObjectSource.getSquareDistanceOutsideBorder(ship.core.getX(), ship.core.getZ());
if (distanceSquared > 0) {
final AxisAlignedBB axisAlignedBB = celestialObjectSource.getAreaToReachParent();
reason.append(Commons.styleWarning, "warpdrive.ship.guide.unable_to_reach_space_outside_border",
reason.append(Commons.getStyleWarning(), "warpdrive.ship.guide.unable_to_reach_space_outside_border",
(int) Math.sqrt(distanceSquared),
(int) axisAlignedBB.minX, (int) axisAlignedBB.minY, (int) axisAlignedBB.minZ,
(int) axisAlignedBB.maxX, (int) axisAlignedBB.maxY, (int) axisAlignedBB.maxZ);
@ -932,7 +932,7 @@ public class JumpSequencer extends AbstractSequencer {
final int dimensionIdSpace = celestialObjectSource.parent.dimensionId;
targetWorld = Commons.getOrCreateWorldServer(dimensionIdSpace);
if (targetWorld == null) {
reason.append(Commons.styleWarning, "warpdrive.ship.guide.exception_loading_dimension",
reason.append(Commons.getStyleWarning(), "warpdrive.ship.guide.exception_loading_dimension",
dimensionIdSpace);
return false;
}
@ -948,7 +948,7 @@ public class JumpSequencer extends AbstractSequencer {
final CelestialObject celestialObject = CelestialObjectManager.getClosestChild(sourceWorld, ship.core.getX(), ship.core.getZ());
// anything defined?
if (celestialObject == null) {
reason.append(Commons.styleWarning, "warpdrive.ship.guide.no_celestial_object_in_space",
reason.append(Commons.getStyleWarning(), "warpdrive.ship.guide.no_celestial_object_in_space",
Commons.format(sourceWorld), sourceWorld.provider.getDimension());
return false;
}
@ -957,7 +957,7 @@ public class JumpSequencer extends AbstractSequencer {
final double distanceSquared = celestialObject.getSquareDistanceInParent(sourceWorld.provider.getDimension(), ship.core.getX(), ship.core.getZ());
if (distanceSquared > 0.0D) {
final AxisAlignedBB axisAlignedBB = celestialObject.getAreaInParent();
reason.append(Commons.styleWarning, "warpdrive.ship.guide.unable_to_land_outside_orbit",
reason.append(Commons.getStyleWarning(), "warpdrive.ship.guide.unable_to_land_outside_orbit",
(int) Math.sqrt(distanceSquared),
(int) axisAlignedBB.minX, (int) axisAlignedBB.minY, (int) axisAlignedBB.minZ,
(int) axisAlignedBB.maxX, (int) axisAlignedBB.maxY, (int) axisAlignedBB.maxZ);
@ -966,7 +966,7 @@ public class JumpSequencer extends AbstractSequencer {
// is it defined?
if (celestialObject.isVirtual()) {
reason.append(Commons.styleWarning, "warpdrive.ship.guide.unable_to_land_virtual_planet",
reason.append(Commons.getStyleWarning(), "warpdrive.ship.guide.unable_to_land_virtual_planet",
celestialObject.getDisplayName());
return false;
}
@ -974,7 +974,7 @@ public class JumpSequencer extends AbstractSequencer {
// validate world availability
targetWorld = Commons.getOrCreateWorldServer(celestialObject.dimensionId);
if (targetWorld == null) {
reason.append(Commons.styleWarning, "warpdrive.ship.guide.exception_loading_dimension",
reason.append(Commons.getStyleWarning(), "warpdrive.ship.guide.exception_loading_dimension",
celestialObject.getDisplayName(), celestialObject.dimensionId);
return false;
}
@ -997,7 +997,7 @@ public class JumpSequencer extends AbstractSequencer {
default:
WarpDrive.logger.error(String.format("Invalid movement type %s",
shipMovementType));
reason.append(Commons.styleWarning, "warpdrive.error.internal_check_console");
reason.append(Commons.getStyleWarning(), "warpdrive.error.internal_check_console");
return false;
}
@ -1324,7 +1324,7 @@ public class JumpSequencer extends AbstractSequencer {
doCollisionDamage(true);
disable(true, new WarpDriveText(Commons.styleCorrect, "warpdrive.ship.guide.jump_done"));
disable(true, new WarpDriveText(Commons.getStyleCorrect(), "warpdrive.ship.guide.jump_done"));
final int countAfter = targetWorld.loadedTileEntityList.size();
if (WarpDriveConfig.LOGGING_JUMP && countBefore != countAfter) {
WarpDrive.logger.info(String.format("Checking for TE duplicates: tileEntities in target world after jump, cleanup %d -> %d",
@ -1436,7 +1436,7 @@ public class JumpSequencer extends AbstractSequencer {
final double rx = Math.round(min.x + sourceWorld.rand.nextInt(Math.max(1, (int) (max.x - min.x))));
final double ry = Math.round(min.y + sourceWorld.rand.nextInt(Math.max(1, (int) (max.y - min.y))));
final double rz = Math.round(min.z + sourceWorld.rand.nextInt(Math.max(1, (int) (max.z - min.z))));
ship.messageToAllPlayersOnShip(new WarpDriveText(Commons.styleWarning, "warpdrive.ship.guide.ship_collision",
ship.messageToAllPlayersOnShip(new WarpDriveText(Commons.getStyleWarning(), "warpdrive.ship.guide.ship_collision",
(int) rx, (int) ry, (int) rz));
// randomize if too many collision points
final int nbExplosions = Math.min(5, collisionPoints.size());
@ -1560,7 +1560,7 @@ public class JumpSequencer extends AbstractSequencer {
blockPosCoreAtTarget.getY(),
blockPosCoreAtTarget.getZ(),
false,
new WarpDriveText(Commons.styleWarning, "warpdrive.ship.guide.overlapping_source_and_target") );
new WarpDriveText(Commons.getStyleWarning(), "warpdrive.ship.guide.overlapping_source_and_target") );
return result;
}
@ -1596,7 +1596,7 @@ public class JumpSequencer extends AbstractSequencer {
blockPosTarget.getY() + 0.5D - offset.y,
blockPosTarget.getZ() + 0.5D - offset.z,
true,
new WarpDriveText(Commons.styleWarning, "warpdrive.ship.guide.impassable_block_detected",
new WarpDriveText(Commons.getStyleWarning(), "warpdrive.ship.guide.impassable_block_detected",
blockStateTarget, blockPosTarget.getX(), blockPosTarget.getY(), blockPosTarget.getZ()) );
if (!fullCollisionDetails) {
return result;
@ -1614,7 +1614,7 @@ public class JumpSequencer extends AbstractSequencer {
blockPosTarget.getY() + 0.5D + offset.y * 0.1D,
blockPosTarget.getZ() + 0.5D + offset.z * 0.1D,
true,
new WarpDriveText(Commons.styleWarning, "warpdrive.ship.guide.obstacle_block_detected",
new WarpDriveText(Commons.getStyleWarning(), "warpdrive.ship.guide.obstacle_block_detected",
Commons.format(blockStateTarget, targetWorld, blockPosTarget),
blockPosTarget.getX(), blockPosTarget.getY(), blockPosTarget.getZ()) );
if (!fullCollisionDetails) {
@ -1632,7 +1632,7 @@ public class JumpSequencer extends AbstractSequencer {
blockPosTarget.getY(),
blockPosTarget.getZ(),
false,
new WarpDriveText(Commons.styleWarning, "warpdrive.ship.guide.entering_protected_area",
new WarpDriveText(Commons.getStyleWarning(), "warpdrive.ship.guide.entering_protected_area",
blockPosTarget.getX(), blockPosTarget.getZ(), blockPosTarget.getZ()) );
return result;
}
@ -1655,7 +1655,7 @@ public class JumpSequencer extends AbstractSequencer {
ship.core.getZ(), ship.core.getX() + 0.5D,
ship.maxY + testMovement.y + 1.0D,
ship.core.getZ() + 0.5D,
false, new WarpDriveText(Commons.styleWarning, "warpdrive.ship.guide.moving_too_high"));
false, new WarpDriveText(Commons.getStyleWarning(), "warpdrive.ship.guide.moving_too_high"));
return result;
}
@ -1664,7 +1664,7 @@ public class JumpSequencer extends AbstractSequencer {
ship.core.getX() + 0.5D,
ship.maxY + testMovement.y,
ship.core.getZ() + 0.5D,
false, new WarpDriveText(Commons.styleWarning, "warpdrive.ship.guide.moving_too_low"));
false, new WarpDriveText(Commons.getStyleWarning(), "warpdrive.ship.guide.moving_too_low"));
return result;
}

View file

@ -4,6 +4,7 @@ import cr0s.warpdrive.BreathingManager;
import cr0s.warpdrive.Commons;
import cr0s.warpdrive.LocalProfiler;
import cr0s.warpdrive.WarpDrive;
import cr0s.warpdrive.api.WarpDriveText;
import cr0s.warpdrive.block.forcefield.BlockForceField;
import cr0s.warpdrive.data.CelestialObjectManager;
import cr0s.warpdrive.config.Dictionary;
@ -30,7 +31,6 @@ import net.minecraft.util.DamageSource;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
@ -113,16 +113,16 @@ public class LivingHandler {
&& entityLivingBase instanceof EntityPlayer
&& entityLivingBase.ticksExisted % 40 == 0) {
Commons.addChatMessage( entityLivingBase,
new TextComponentTranslation("warpdrive.world_border.in_range",
(int) Math.sqrt(Math.abs(distanceSquared))).setStyle(Commons.styleWarning) );
new WarpDriveText(Commons.getStyleWarning(), "warpdrive.world_border.in_range",
(int) Math.sqrt(Math.abs(distanceSquared))) );
}
} else {
if (entityLivingBase instanceof EntityPlayerMP) {
if (((EntityPlayerMP) entityLivingBase).capabilities.isCreativeMode) {
if (entityLivingBase.ticksExisted % 100 == 0) {
Commons.addChatMessage( entityLivingBase,
new TextComponentTranslation("warpdrive.world_border.outside",
(int) Math.sqrt(Math.abs(distanceSquared))).setStyle(Commons.styleWarning) );
new WarpDriveText(Commons.getStyleWarning(), "warpdrive.world_border.outside",
(int) Math.sqrt(Math.abs(distanceSquared))) );
}
return;
}
@ -142,7 +142,7 @@ public class LivingHandler {
// spam chat if it's a player
if (entityLivingBase instanceof EntityPlayer && !entityLivingBase.isDead && entityLivingBase.deathTime <= 0) {
Commons.addChatMessage( entityLivingBase,
new TextComponentTranslation("warpdrive.world_border.reached").setStyle(Commons.styleWarning));
new WarpDriveText(Commons.getStyleWarning(), "warpdrive.world_border.reached"));
}
// delay damage for 'fast moving' players
@ -204,8 +204,8 @@ public class LivingHandler {
entityLivingBase));
// inform player then roll around to cooldown
Commons.addChatMessage( entityLivingBase,
new TextComponentTranslation("warpdrive.ship.guide.exception_loading_dimension",
celestialObjectChild.dimensionId ).setStyle(Commons.styleWarning));
new WarpDriveText(Commons.getStyleWarning(), "warpdrive.ship.guide.exception_loading_dimension",
celestialObjectChild.dimensionId ));
entityLivingBase.setPositionAndUpdate(entityLivingBase.posX, 260.0D, entityLivingBase.posZ);
} else {
final VectorI vEntry = celestialObjectChild.getEntryOffset();

View file

@ -330,8 +330,8 @@ public class ItemElectromagneticCell extends ItemAbstractBase implements IPartic
final Particle particle = particleStack.getParticle();
tooltip = new TextComponentTranslation("item.warpdrive.atomic.electromagnetic_cell.tooltip.filled",
new WarpDriveText(Commons.styleValue, particleStack.getAmount()),
new WarpDriveText(Commons.styleValue, particle.getLocalizedName()) ).getFormattedText();
new WarpDriveText(Commons.getStyleValue(), particleStack.getAmount()),
new WarpDriveText(Commons.getStyleValue(), particle.getLocalizedName()) ).getFormattedText();
Commons.addTooltip(list, tooltip);
final String particleTooltip = particle.getLocalizedTooltip();

View file

@ -353,19 +353,19 @@ public class ItemTuningDriver extends ItemAbstractBase implements IWarpTool {
final WarpDriveText textTooltip = new WarpDriveText();
textTooltip.append(null, "warpdrive.video_channel.tooltip",
new WarpDriveText(Commons.styleValue, getVideoChannel(itemStack)) );
new WarpDriveText(Commons.getStyleValue(), getVideoChannel(itemStack)) );
switch (itemStack.getItemDamage()) {
case MODE_VIDEO_CHANNEL:
textTooltip.append(null, "warpdrive.video_channel.tooltip",
new WarpDriveText(Commons.styleValue, getVideoChannel(itemStack)) );
new WarpDriveText(Commons.getStyleValue(), getVideoChannel(itemStack)) );
break;
case MODE_BEAM_FREQUENCY:
textTooltip.append(null, "warpdrive.beam_frequency.tooltip",
new WarpDriveText(Commons.styleValue, getBeamFrequency(itemStack)) );
new WarpDriveText(Commons.getStyleValue(), getBeamFrequency(itemStack)) );
break;
case MODE_CONTROL_CHANNEL:
textTooltip.append(null, "warpdrive.control_channel.tooltip",
new WarpDriveText(Commons.styleValue, getControlChannel(itemStack)) );
new WarpDriveText(Commons.getStyleValue(), getControlChannel(itemStack)) );
break;
default:
textTooltip.append(new TextComponentString("I'm broken :("));

View file

@ -163,11 +163,11 @@ public class ItemTuningFork extends ItemAbstractBase implements IWarpTool {
final WarpDriveText textTooltip = new WarpDriveText();
textTooltip.append(null, "warpdrive.video_channel.tooltip",
new WarpDriveText(Commons.styleValue, getVideoChannel(itemStack)) );
new WarpDriveText(Commons.getStyleValue(), getVideoChannel(itemStack)) );
textTooltip.append(null, "warpdrive.beam_frequency.tooltip",
new WarpDriveText(Commons.styleValue, getBeamFrequency(itemStack)) );
new WarpDriveText(Commons.getStyleValue(), getBeamFrequency(itemStack)) );
textTooltip.append(null, "warpdrive.control_channel.tooltip",
new WarpDriveText(Commons.styleValue, getControlChannel(itemStack)) );
new WarpDriveText(Commons.getStyleValue(), getControlChannel(itemStack)) );
textTooltip.appendLineBreak();
textTooltip.append(null, "item.warpdrive.tool.tuning_fork.tooltip.usage");