Updated celestial object template with latest changes

This commit is contained in:
LemADEC 2017-08-06 12:05:43 +02:00
parent fefebaa152
commit 3975953ccf
4 changed files with 35 additions and 22 deletions

View file

@ -144,15 +144,15 @@ public class WarpDriveConfig {
public static boolean RECIPES_ENABLE_VANILLA = false;
// Client
public static float CLIENT_LOCATION_SCALE = 0.5F;
public static String CLIENT_LOCATION_FORMAT = "§l";
public static float CLIENT_LOCATION_SCALE = 1.0F;
public static String CLIENT_LOCATION_FORMAT_TITLE = "§l%1$s";
public static int CLIENT_LOCATION_BACKGROUND_COLOR = Commons.colorARGBtoInt(64, 48, 48, 48);
public static int CLIENT_LOCATION_TEXT_COLOR = Commons.colorARGBtoInt(230, 180, 180, 240);
public static boolean CLIENT_LOCATION_HAS_SHADOW = true;
public static EnumDisplayAlignment CLIENT_LOCATION_SCREEN_ALIGNMENT = EnumDisplayAlignment.MIDDLE_RIGHT;
public static int CLIENT_LOCATION_SCREEN_OFFSET_X = -50;
public static int CLIENT_LOCATION_SCREEN_OFFSET_Y = 0;
public static EnumDisplayAlignment CLIENT_LOCATION_TEXT_ALIGNMENT = EnumDisplayAlignment.TOP_CENTER;
public static int CLIENT_LOCATION_SCREEN_OFFSET_X = 0;
public static int CLIENT_LOCATION_SCREEN_OFFSET_Y = -20;
public static EnumDisplayAlignment CLIENT_LOCATION_TEXT_ALIGNMENT = EnumDisplayAlignment.TOP_RIGHT;
public static float CLIENT_LOCATION_WIDTH_RATIO = 0.0F;
public static int CLIENT_LOCATION_WIDTH_MIN = 90;
@ -492,8 +492,8 @@ public class WarpDriveConfig {
CLIENT_LOCATION_SCALE = Commons.clamp(0.25F, 4.0F, (float) config.get("client", "location_scale", CLIENT_LOCATION_SCALE,
"Scale for location text font").getDouble() );
CLIENT_LOCATION_FORMAT = config.get("client", "location_format", CLIENT_LOCATION_FORMAT,
"Format prefix for location title").getString();
CLIENT_LOCATION_FORMAT_TITLE = config.get("client", "location_prefix", CLIENT_LOCATION_FORMAT_TITLE,
"Format for location title").getString();
{
String stringValue = config.get("client", "location_background_color", String.format("0x%6X", CLIENT_LOCATION_BACKGROUND_COLOR),
"Hexadecimal color code for location tile and description background (0xAARRGGBB where AA is alpha, RR is Red, GG is Green and BB is Blue component)").getString();
@ -901,6 +901,8 @@ public class WarpDriveConfig {
config.get("lift", "entity_cooldown_ticks", LIFT_ENTITY_COOLDOWN_TICKS, "Cooldown after moving an entity").getInt());
// Particles accelerator
ACCELERATOR_ENABLE = config.get("accelerator", "enable", ACCELERATOR_ENABLE, "Enable accelerator blocks. Requires a compatible server, as it won't work in single player").getBoolean(false);
ACCELERATOR_MAX_PARTICLE_BUNCHES = Commons.clamp(2, 100,
config.get("accelerator", "max_particle_bunches", ACCELERATOR_MAX_PARTICLE_BUNCHES, "Maximum number of particle bunches per accelerator controller").getInt());

View file

@ -5,6 +5,7 @@ import cr0s.warpdrive.WarpDrive;
import cr0s.warpdrive.config.Dictionary;
import cr0s.warpdrive.data.EnumDisplayAlignment;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
@ -152,19 +153,25 @@ public class RenderCommons {
}
public static void drawText(final int screen_width, final int screen_height, final String textHeader, final String textContent,
final float scale, final String formatHeaderPrefix, final int colorBackground, final int colorText, final boolean hasHeaderShadow,
final float scale, final String formatHeader, final int colorBackground, final int colorText, final boolean hasHeaderShadow,
final EnumDisplayAlignment enumScreenAnchor, final int xOffset, final int yOffset,
final EnumDisplayAlignment enumTextAlignment, final float widthTextRatio, final int widthTextMin) {
// prepare the string box content and dimensions
final String header_formatted = Commons.updateEscapeCodes(formatHeaderPrefix + StatCollector.translateToLocal(textHeader));
final String header_formatted = Commons.updateEscapeCodes(String.format(StatCollector.translateToLocal(textHeader), formatHeader));
final String content_formatted = Commons.updateEscapeCodes(StatCollector.translateToLocal(textContent));
final int scaled_box_width = Math.max(widthTextMin, Math.round(widthTextRatio * screen_width)) + 2 * TEXT_BORDER;
@SuppressWarnings("unchecked")
final List<String> listHeaderLines = minecraft.fontRenderer.listFormattedStringToWidth(header_formatted, scaled_box_width - 2 * TEXT_BORDER);
final List<String> listHeaderLines =
header_formatted.isEmpty() ? new ArrayList<>(0)
: minecraft.fontRenderer.listFormattedStringToWidth(header_formatted, scaled_box_width - 2 * TEXT_BORDER);
@SuppressWarnings("unchecked")
final List<String> listContentLines = minecraft.fontRenderer.listFormattedStringToWidth(content_formatted, scaled_box_width - 2 * TEXT_BORDER);
final int scaled_box_height = (listHeaderLines.size() + listContentLines.size()) * minecraft.fontRenderer.FONT_HEIGHT + 3 * TEXT_BORDER;
final List<String> listContentLines =
content_formatted.isEmpty() ? new ArrayList<>(0)
: minecraft.fontRenderer.listFormattedStringToWidth(content_formatted, scaled_box_width - 2 * TEXT_BORDER);
final boolean hasTileAndContent = listHeaderLines.size() > 0 && listContentLines.size() > 0;
final int scaled_box_height = (listHeaderLines.size() + listContentLines.size()) * minecraft.fontRenderer.FONT_HEIGHT
+ (hasTileAndContent ? 3 : 1) * TEXT_BORDER;
// compute the position
final int screen_text_x = Math.round(screen_width * enumScreenAnchor.xRatio + xOffset - enumTextAlignment.xRatio * scaled_box_width * scale);
@ -203,7 +210,9 @@ public class RenderCommons {
minecraft.fontRenderer.drawString(textLine, scaled_text_x, scaled_text_y, colorText, hasHeaderShadow);
scaled_text_y += minecraft.fontRenderer.FONT_HEIGHT;
}
scaled_text_y += TEXT_BORDER;
if (hasTileAndContent) {
scaled_text_y += TEXT_BORDER;
}
for (final String textLine : listContentLines) {
minecraft.fontRenderer.drawString(textLine, scaled_text_x, scaled_text_y, colorText, false);
scaled_text_y += minecraft.fontRenderer.FONT_HEIGHT;

View file

@ -48,7 +48,7 @@ public class RenderOverlayLocation {
// show current location name & description
RenderCommons.drawText(widthScreen, heightScreen, name, description,
WarpDriveConfig.CLIENT_LOCATION_SCALE,
WarpDriveConfig.CLIENT_LOCATION_FORMAT,
WarpDriveConfig.CLIENT_LOCATION_FORMAT_TITLE,
WarpDriveConfig.CLIENT_LOCATION_BACKGROUND_COLOR,
WarpDriveConfig.CLIENT_LOCATION_TEXT_COLOR,
WarpDriveConfig.CLIENT_LOCATION_HAS_SHADOW,

View file

@ -27,7 +27,7 @@
nbt defines a JSON string for custom tags. It's used by WarpDrive extensions.
-->
<size x="400000" z="400000" />
<name>§lHyperspace</name>
<name>Hyperspace</name>
<description>Your ship warp bubble is your\nonly protection.</description>
<!--
@ -78,6 +78,8 @@
<center x="50000" z="10000" />
</parent>
<size x="200000" z="200000" />
<name>Space</name>
<description>The void, filled with §6resources§r.</description>
<dimension id="-2" isBreathable="false" gravity="legacySpace">
<center x="0" z="0" />
<provider type="WarpDriveSpace" />
@ -122,9 +124,9 @@
In most cases, you want the first layer to be alpha="1.00", or the players will see the sky through the planet.
-->
<render red="0.80" green="0.50" blue="0.20" alpha="1.00" texture="" />
<render red="0.80" green="0.70" blue="0.30" alpha="0.40" texture="warpdrive:textures/celestial/planet_icy.png" periodU="-20" periodV="104" additive="true" />
<render red="0.80" green="0.55" blue="0.10" alpha="0.48" texture="warpdrive:textures/celestial/planet_metallic.png" periodU="-40" periodV="140" additive="true" />
<render red="0.80" green="0.45" blue="0.30" alpha="0.34" texture="warpdrive:textures/celestial/planet_magma.png" periodU="24" periodV="-35" additive="true" />
<render red="0.80" green="0.70" blue="0.30" alpha="0.40" texture="warpdrive:textures/celestial/surface_icy2.png" periodU="-20" periodV="104" additive="true" />
<render red="0.80" green="0.55" blue="0.10" alpha="0.48" texture="warpdrive:textures/celestial/surface_metallic1.png" periodU="-40" periodV="140" additive="true" />
<render red="0.80" green="0.45" blue="0.30" alpha="0.34" texture="warpdrive:textures/celestial/surface_magma1.png" periodU="24" periodV="-35" additive="true" />
<render red="0.80" green="0.50" blue="0.20" alpha="0.08" texture="" />
<render red="0.75" green="0.48" blue="0.20" alpha="0.08" texture="" />
<render red="0.70" green="0.55" blue="0.20" alpha="0.08" texture="" />
@ -140,10 +142,10 @@
<dimension id="0" isBreathable="true" gravity="normal">
<center x="0" z="0" />
</dimension>
<render red="0.70" green="0.70" blue="0.70" alpha="1.00" texture="warpdrive:textures/celestial/planet_temperate.png" />
<render red="0.90" green="0.95" blue="1.00" alpha="0.15" texture="warpdrive:textures/celestial/cloud_small.png" periodU="100" periodV="1100" additive="true" />
<render red="0.90" green="0.90" blue="1.00" alpha="0.15" texture="warpdrive:textures/celestial/cloud_medium.png" periodU="300" periodV="1500" additive="false" />
<render red="0.80" green="0.70" blue="1.00" alpha="0.15" texture="warpdrive:textures/celestial/cloud_large.png" periodU="500" periodV="2100" additive="false" />
<render red="0.70" green="0.70" blue="0.70" alpha="1.00" texture="warpdrive:textures/celestial/surface_temperate2.png" />
<render red="0.90" green="0.95" blue="1.00" alpha="0.15" texture="warpdrive:textures/celestial/cloud_small1.png" periodU="100" periodV="1100" additive="true" />
<render red="0.90" green="0.90" blue="1.00" alpha="0.15" texture="warpdrive:textures/celestial/cloud_medium1.png" periodU="300" periodV="1500" additive="false" />
<render red="0.80" green="0.70" blue="1.00" alpha="0.15" texture="warpdrive:textures/celestial/cloud_large1.png" periodU="500" periodV="2100" additive="false" />
<render red="0.50" green="0.50" blue="1.00" alpha="0.08" />
<render red="0.50" green="0.50" blue="1.00" alpha="0.08" />
<render red="0.50" green="0.50" blue="1.00" alpha="0.08" />