even moar refactoring.

This commit is contained in:
Flanks255 2022-06-05 16:02:36 -05:00
parent 35bf265618
commit 768b677e41
16 changed files with 34 additions and 51 deletions

View file

@ -122,7 +122,7 @@ public class BlockAtomicReconstructor extends FullyDirectionalBlock.Container im
AssetUtil.renderStackToGui(slot, resolution.getGuiScaledWidth() / 2 + 15, resolution.getGuiScaledHeight() / 2 - 19, 1F);
}
minecraft.font.drawShadow(matrices, strg.plainCopy().withStyle(TextFormatting.YELLOW).withStyle(TextFormatting.ITALIC).getString(), resolution.getGuiScaledWidth() / 2 + 35, resolution.getGuiScaledHeight() / 2f - 15, StringUtil.DECIMAL_COLOR_WHITE);
minecraft.font.drawShadow(matrices, strg.plainCopy().withStyle(TextFormatting.YELLOW).withStyle(TextFormatting.ITALIC).getString(), resolution.getGuiScaledWidth() / 2 + 35, resolution.getGuiScaledHeight() / 2f - 15, 0xFFFFFF);
}
}

View file

@ -182,7 +182,7 @@ public class BlockLaserRelay extends FullyDirectionalBlock.Container implements
TileEntityLaserRelay relay = (TileEntityLaserRelay) tile;
String strg = relay.getExtraDisplayString();
minecraft.font.drawShadow(matrices, strg, resolution.getGuiScaledWidth() / 2f + 5, resolution.getGuiScaledHeight() / 2f + 5, StringUtil.DECIMAL_COLOR_WHITE);
minecraft.font.drawShadow(matrices, strg, resolution.getGuiScaledWidth() / 2f + 5, resolution.getGuiScaledHeight() / 2f + 5, 0xFFFFFF);
String expl;
if (compass) {
@ -191,7 +191,7 @@ public class BlockLaserRelay extends FullyDirectionalBlock.Container implements
expl = TextFormatting.GRAY.toString() + TextFormatting.ITALIC + StringUtil.localizeFormatted("info." + ActuallyAdditions.MODID + ".laserRelay.mode.noCompasss", StringUtil.localize(CommonConfig.Other.relayConfigureItem.getDescriptionId() + ".name"));
}
StringUtil.drawSplitString(minecraft.font, expl, resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 15, Integer.MAX_VALUE, StringUtil.DECIMAL_COLOR_WHITE, true);
StringUtil.drawSplitString(minecraft.font, expl, resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 15, Integer.MAX_VALUE, 0xFFFFFF, true);
}
}
}

View file

@ -26,6 +26,7 @@ import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.IBlockReader;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@ -53,9 +54,9 @@ public class BlockLavaFactoryController extends DirectionalBlock.Container imple
if (factory != null) {
int state = factory.isMultiblock();
if (state == TileEntityLavaFactoryController.NOT_MULTI) {
StringUtil.drawSplitString(minecraft.font, StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".factory.notPart.desc"), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 5, 200, StringUtil.DECIMAL_COLOR_WHITE, true);
StringUtil.drawSplitString(minecraft.font, StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".factory.notPart.desc"), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 5, 200, 0xFFFFFF, true);
} else if (state == TileEntityLavaFactoryController.HAS_AIR || state == TileEntityLavaFactoryController.HAS_LAVA) {
StringUtil.drawSplitString(minecraft.font, StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".factory.works.desc"), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 5, 200, StringUtil.DECIMAL_COLOR_WHITE, true);
StringUtil.drawSplitString(minecraft.font, StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".factory.works.desc"), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 5, 200, 0xFFFFFF, true);
}
}
}

View file

@ -127,22 +127,22 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay {
if (tile != null) {
if (tile instanceof IPhantomTile) {
IPhantomTile phantom = (IPhantomTile) tile;
minecraft.font.drawShadow(matrices, TextFormatting.GOLD + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".blockPhantomRange.desc") + ": " + phantom.getRange(), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 - 40, StringUtil.DECIMAL_COLOR_WHITE);
minecraft.font.drawShadow(matrices, TextFormatting.GOLD + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".blockPhantomRange.desc") + ": " + phantom.getRange(), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 - 40, TextFormatting.WHITE.getColor());
if (phantom.hasBoundPosition()) {
int distance = MathHelper.ceil(new Vector3d(pos.getX(), pos.getY(), pos.getZ()).distanceTo(new Vector3d(phantom.getBoundPosition().getX(), phantom.getBoundPosition().getY(), phantom.getBoundPosition().getZ())));
BlockState state = minecraft.level.getBlockState(phantom.getBoundPosition());
Block block = state.getBlock();
Item item = Item.byBlock(block);
String name = item.getName(new ItemStack(block)).getString();
StringUtil.drawSplitString(minecraft.font, StringUtil.localizeFormatted("tooltip." + ActuallyAdditions.MODID + ".phantom.blockInfo.desc", name, phantom.getBoundPosition().getX(), phantom.getBoundPosition().getY(), phantom.getBoundPosition().getZ(), distance), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 - 30, 200, StringUtil.DECIMAL_COLOR_WHITE, true);
StringUtil.drawSplitString(minecraft.font, StringUtil.localizeFormatted("tooltip." + ActuallyAdditions.MODID + ".phantom.blockInfo.desc", name, phantom.getBoundPosition().getX(), phantom.getBoundPosition().getY(), phantom.getBoundPosition().getZ(), distance), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 - 30, 200, 0xFFFFFF, true);
if (phantom.isBoundThingInRange()) {
StringUtil.drawSplitString(minecraft.font, TextFormatting.DARK_GREEN + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".phantom.connectedRange.desc"), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 25, 200, StringUtil.DECIMAL_COLOR_WHITE, true);
StringUtil.drawSplitString(minecraft.font, TextFormatting.DARK_GREEN + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".phantom.connectedRange.desc"), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 25, 200, 0xFFFFFF, true);
} else {
StringUtil.drawSplitString(minecraft.font, TextFormatting.DARK_RED + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".phantom.connectedNoRange.desc"), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 25, 200, StringUtil.DECIMAL_COLOR_WHITE, true);
StringUtil.drawSplitString(minecraft.font, TextFormatting.DARK_RED + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".phantom.connectedNoRange.desc"), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 25, 200, 0xFFFFFF, true);
}
} else {
minecraft.font.drawShadow(matrices, TextFormatting.RED + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".phantom.notConnected.desc"), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 25, StringUtil.DECIMAL_COLOR_WHITE);
minecraft.font.drawShadow(matrices, TextFormatting.RED + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".phantom.notConnected.desc"), resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 25, TextFormatting.WHITE.getColor());
}
}
}

View file

@ -73,8 +73,8 @@ public class BlockPlayerInterface extends BlockContainerBase implements IHudDisp
String name = face.playerName == null
? "Unknown"
: face.playerName;
minecraft.font.drawShadow(matrices, "Bound to: " + TextFormatting.RED + name, resolution.getGuiScaledWidth() / 2f + 5, resolution.getGuiScaledHeight() / 2f + 5, StringUtil.DECIMAL_COLOR_WHITE);
minecraft.font.drawShadow(matrices, "UUID: " + TextFormatting.DARK_GREEN + face.connectedPlayer, resolution.getGuiScaledWidth() / 2f + 5, resolution.getGuiScaledHeight() / 2f + 15, StringUtil.DECIMAL_COLOR_WHITE);
minecraft.font.drawShadow(matrices, "Bound to: " + TextFormatting.RED + name, resolution.getGuiScaledWidth() / 2f + 5, resolution.getGuiScaledHeight() / 2f + 5, 0xFFFFFF);
minecraft.font.drawShadow(matrices, "UUID: " + TextFormatting.DARK_GREEN + face.connectedPlayer, resolution.getGuiScaledWidth() / 2f + 5, resolution.getGuiScaledHeight() / 2f + 15, 0xFFFFFF);
}
}
}

View file

@ -27,6 +27,7 @@ import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
@ -63,7 +64,7 @@ public class BlockVerticalDigger extends DirectionalBlock.Container implements I
: miner.checkY == -1
? "Calculating positions..."
: "Mining at " + (miner.getBlockPos().getX() + miner.checkX) + ", " + miner.checkY + ", " + (miner.getBlockPos().getZ() + miner.checkZ) + ".";
minecraft.font.drawShadow(matrices, info, resolution.getGuiScaledWidth() / 2f + 5, resolution.getGuiScaledHeight() / 2f - 20, StringUtil.DECIMAL_COLOR_WHITE);
minecraft.font.drawShadow(matrices, info, resolution.getGuiScaledWidth() / 2f + 5, resolution.getGuiScaledHeight() / 2f - 20, 0xFFFFFF);
}
}

View file

@ -194,7 +194,7 @@ public class ClientEvents {
String strg = String.format("%s: %s", StringUtil.localize("info." + ActuallyAdditions.MODID + ".redstoneMode"), TextFormatting.DARK_RED + StringUtil.localize("info." + ActuallyAdditions.MODID + ".redstoneMode." + (base.isPulseMode
? "pulse"
: "deactivation")) + TextFormatting.RESET);
font.drawShadow(event.getMatrixStack(), strg, event.getWindow().getGuiScaledWidth() / 2f + 5, event.getWindow().getGuiScaledHeight() / 2f + 5, StringUtil.DECIMAL_COLOR_WHITE);
font.drawShadow(event.getMatrixStack(), strg, event.getWindow().getGuiScaledWidth() / 2f + 5, event.getWindow().getGuiScaledHeight() / 2f + 5, 0xFFFFFF);
String expl;
if (StackUtil.isValid(stack) && stack.getItem() == CommonConfig.Other.redstoneConfigureItem.asItem()) {
@ -202,7 +202,7 @@ public class ClientEvents {
} else {
expl = TextFormatting.GRAY.toString() + TextFormatting.ITALIC + StringUtil.localizeFormatted("info." + ActuallyAdditions.MODID + ".redstoneMode.invalidItem", StringUtil.localize(CommonConfig.Other.redstoneConfigureItem.asItem().getDescriptionId()));
}
font.drawShadow(event.getMatrixStack(), expl, event.getWindow().getGuiScaledWidth() / 2f + 5, event.getWindow().getGuiScaledHeight() / 2f + 15, StringUtil.DECIMAL_COLOR_WHITE);
font.drawShadow(event.getMatrixStack(), expl, event.getWindow().getGuiScaledWidth() / 2f + 5, event.getWindow().getGuiScaledHeight() / 2f + 15, 0xFFFFFF);
}
}

View file

@ -116,7 +116,7 @@ public class FluidDisplay extends AbstractGui {
}
if (this.drawTextNextTo) {
mc.font.draw(matrices, new StringTextComponent(this.getOverlayText()), barX + 25, barY + 78, StringUtil.DECIMAL_COLOR_WHITE);
mc.font.draw(matrices, new StringTextComponent(this.getOverlayText()), barX + 25, barY + 78, 0xFFFFFF);
}
}

View file

@ -92,8 +92,8 @@ public class GuiLaserRelayItemWhitelist extends AAScreen<ContainerLaserRelayItem
String s1 = StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.inbound");
String s2 = StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.outbound");
this.font.draw(matrices, s1, 46 - this.font.width(s1) / 2, 80, StringUtil.DECIMAL_COLOR_GRAY_TEXT);
this.font.draw(matrices, s2, 131 - this.font.width(s2) / 2, 80, StringUtil.DECIMAL_COLOR_GRAY_TEXT);
this.font.draw(matrices, s1, 46 - this.font.width(s1) / 2, 80, 0x404040);
this.font.draw(matrices, s2, 131 - this.font.width(s2) / 2, 80, 0x404040);
}
@Override

View file

@ -63,7 +63,7 @@ public class GuiMiner extends AAScreen<ContainerMiner> {
String mining = this.miner.onlyMineOres
? "Only Mining Ores"
: "Mining Everything";
this.font.draw(matrices, mining, this.leftPos + this.imageWidth / 2 - this.font.width(mining) / 2, this.topPos + 8, StringUtil.DECIMAL_COLOR_GRAY_TEXT);
this.font.draw(matrices, mining, this.leftPos + this.imageWidth / 2 - this.font.width(mining) / 2, this.topPos + 8, 0x404040);
}
// @Override

View file

@ -82,7 +82,7 @@ public class GuiXPSolidifier extends AAScreen<ContainerXPSolidifier> {
this.getMinecraft().getTextureManager().bind(RES_LOC);
this.blit(matrices, this.leftPos, this.topPos, 0, 0, 176, 93);
drawCenteredString(matrices, this.font, Integer.toString(this.solidifier.amount), this.leftPos + 88, this.topPos + 30, StringUtil.DECIMAL_COLOR_WHITE);
drawCenteredString(matrices, this.font, Integer.toString(this.solidifier.amount), this.leftPos + 88, this.topPos + 30, 0xFFFFFF);
}
// @Override

View file

@ -10,7 +10,6 @@
package de.ellpeck.actuallyadditions.mod.items.metalists;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.item.Rarity;
@Deprecated
@ -21,7 +20,7 @@ public enum TheDusts {
DIAMOND("diamond", 292003, Rarity.RARE),
EMERALD("emerald", 4319527, Rarity.EPIC),
LAPIS("lapis", 1849791, Rarity.UNCOMMON),
QUARTZ("quartz", StringUtil.DECIMAL_COLOR_WHITE, Rarity.UNCOMMON),
QUARTZ("quartz", 0xFFFFFF, Rarity.UNCOMMON),
COAL("coal", 0, Rarity.UNCOMMON),
QUARTZ_BLACK("quartz_black", 18, Rarity.RARE);

View file

@ -13,6 +13,7 @@ package de.ellpeck.actuallyadditions.mod.update;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist;
@ -45,11 +46,11 @@ public class UpdateChecker {
if (Minecraft.getInstance().player != null) {
PlayerEntity player = Minecraft.getInstance().player;
if (UpdateChecker.checkFailed) {
player.displayClientMessage(ITextComponent.Serializer.fromJson(StringUtil.localize("info." + ActuallyAdditions.MODID + ".update.failed")), false);
player.displayClientMessage(ITextComponent.Serializer.fromJson(I18n.get("info." + ActuallyAdditions.MODID + ".update.failed")), false);
} else if (UpdateChecker.needsUpdateNotify) {
player.displayClientMessage(ITextComponent.Serializer.fromJson(StringUtil.localize("info." + ActuallyAdditions.MODID + ".update.generic")), false);
player.displayClientMessage(ITextComponent.Serializer.fromJson(StringUtil.localizeFormatted("info." + ActuallyAdditions.MODID + ".update.versionCompare", ActuallyAdditions.VERSION, UpdateChecker.updateVersionString)), false);
player.displayClientMessage(ITextComponent.Serializer.fromJson(StringUtil.localizeFormatted("info." + ActuallyAdditions.MODID + ".update.buttons", UpdateChecker.CHANGELOG_LINK, UpdateChecker.DOWNLOAD_LINK)), false);
player.displayClientMessage(ITextComponent.Serializer.fromJson(I18n.get("info." + ActuallyAdditions.MODID + ".update.generic")), false);
player.displayClientMessage(ITextComponent.Serializer.fromJson(I18n.get("info." + ActuallyAdditions.MODID + ".update.versionCompare", ActuallyAdditions.VERSION, UpdateChecker.updateVersionString)), false);
player.displayClientMessage(ITextComponent.Serializer.fromJson(I18n.get("info." + ActuallyAdditions.MODID + ".update.buttons", UpdateChecker.CHANGELOG_LINK, UpdateChecker.DOWNLOAD_LINK)), false);
}
if (threadFinished) {
MinecraftForge.EVENT_BUS.unregister(this);

View file

@ -62,7 +62,7 @@ public final class AssetUtil {
@OnlyIn(Dist.CLIENT)
public static void displayNameString(MatrixStack matrices, FontRenderer font, int xSize, int yPositionOfMachineText, String text) {
font.draw(matrices, text, xSize / 2f - font.width(text) / 2f, yPositionOfMachineText, StringUtil.DECIMAL_COLOR_WHITE);
font.draw(matrices, text, xSize / 2f - font.width(text) / 2f, yPositionOfMachineText, 0xFFFFFF);
}
@OnlyIn(Dist.CLIENT)

View file

@ -22,14 +22,6 @@ import net.minecraftforge.fml.ForgeI18n;
@Deprecated
public final class StringUtil {
public static final int DECIMAL_COLOR_WHITE = 16777215;
public static final int DECIMAL_COLOR_GRAY_TEXT = 4210752;
public static final String BUGGED_ITEM_NAME = ActuallyAdditions.MODID + ".lolWutHowUDoDis";
//TODO: Remove
static LanguageMap cancerino;
/**
* Localizes a given String
*/
@ -77,15 +69,4 @@ public final class StringUtil {
font.draw(matrices, text, x, y, color);
matrices.popPose();
}
// static void setupLangMap() {
// try {
// Method m = LanguageMap.class.getDeclaredMethod("inject", LanguageMap.class, InputStream.class);
// m.setAccessible(true);
// m.invoke(null, cancerino = new LanguageMap(), ActuallyAdditions.class.getResourceAsStream("/assets/actuallyadditions/lang/en_us.json"));
// } catch (Exception e) {
// e.printStackTrace();
// throw new RuntimeException("Actually Additions failed to access LanguageMap.inject. Report this!");
// }
// }
}

View file

@ -89,11 +89,11 @@
"item.banner.actuallyadditionsDrill.orange": "Orange Drill Pattern",
"item.banner.actuallyadditionsDrill.white": "White Drill Pattern",
"_comment": "Damage Sources",
"death.actuallyadditions.atomicReconstructor.1": "%s got atomically reconstructed.",
"death.actuallyadditions.atomicReconstructor.2": "The Atomic Reconstructor caught %s in its sight.",
"death.actuallyadditions.atomicReconstructor.3": "Atomically reconstructing people like %s doesn't appear to work.",
"death.actuallyadditions.atomicReconstructor.4": "%s shouldn't have ate that Reconstructor!",
"death.actuallyadditions.atomicReconstructor.5": "%s should have used some re-construction foam.",
"death.actuallyadditions.atomicreconstructor.1": "%s got atomically reconstructed.",
"death.actuallyadditions.atomicreconstructor.2": "The Atomic Reconstructor caught %s in its sight.",
"death.actuallyadditions.atomicreconstructor.3": "Atomically reconstructing people like %s doesn't appear to work.",
"death.actuallyadditions.atomicreconstructor.4": "%s shouldn't have ate that Reconstructor!",
"death.actuallyadditions.atomicreconstructor.5": "%s should have used some re-construction foam.",
"_comment": "Blocks",
"block.actuallyadditions.compost": "Compost",
"block.actuallyadditions.ore_black_quartz": "Black Quartz Ore",