Compare commits

..

No commits in common. "768b677e41986b7847a7e712bbdb6e1ca4d8b775" and "ab672f64745f492d158d44c4f48dea4cf28a7416" have entirely different histories.

37 changed files with 161 additions and 79 deletions

View file

@ -1,6 +1,7 @@
package de.ellpeck.actuallyadditions.mod;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvent;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.RegistryObject;

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, 0xFFFFFF);
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);
}
}

View file

@ -47,14 +47,9 @@ public class BlockCoffeeMachine extends DirectionalBlock.Container {
return super.use(state, world, pos, player, hand, hit);
}
@Override
public boolean hasTileEntity(BlockState state) {
return true;
}
@Nullable
@Override
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
//@Override
public TileEntity newBlockEntity(IBlockReader worldIn) {
return new TileEntityCoffeeMachine();
}

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, 0xFFFFFF);
minecraft.font.drawShadow(matrices, strg, resolution.getGuiScaledWidth() / 2f + 5, resolution.getGuiScaledHeight() / 2f + 5, StringUtil.DECIMAL_COLOR_WHITE);
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, 0xFFFFFF, true);
StringUtil.drawSplitString(minecraft.font, expl, resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 15, Integer.MAX_VALUE, StringUtil.DECIMAL_COLOR_WHITE, true);
}
}
}

View file

@ -26,7 +26,6 @@ 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;
@ -54,9 +53,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, 0xFFFFFF, true);
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);
} 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, 0xFFFFFF, true);
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);
}
}
}

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, TextFormatting.WHITE.getColor());
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);
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, 0xFFFFFF, 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, StringUtil.DECIMAL_COLOR_WHITE, 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, 0xFFFFFF, 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, StringUtil.DECIMAL_COLOR_WHITE, 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, 0xFFFFFF, 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, StringUtil.DECIMAL_COLOR_WHITE, true);
}
} else {
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());
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);
}
}
}

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, 0xFFFFFF);
minecraft.font.drawShadow(matrices, "UUID: " + TextFormatting.DARK_GREEN + face.connectedPlayer, resolution.getGuiScaledWidth() / 2f + 5, resolution.getGuiScaledHeight() / 2f + 15, 0xFFFFFF);
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);
}
}
}

View file

@ -27,7 +27,6 @@ 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;
@ -64,7 +63,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, 0xFFFFFF);
minecraft.font.drawShadow(matrices, info, resolution.getGuiScaledWidth() / 2f + 5, resolution.getGuiScaledHeight() / 2f - 20, StringUtil.DECIMAL_COLOR_WHITE);
}
}

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, 0xFFFFFF);
font.drawShadow(event.getMatrixStack(), strg, event.getWindow().getGuiScaledWidth() / 2f + 5, event.getWindow().getGuiScaledHeight() / 2f + 5, StringUtil.DECIMAL_COLOR_WHITE);
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, 0xFFFFFF);
font.drawShadow(event.getMatrixStack(), expl, event.getWindow().getGuiScaledWidth() / 2f + 5, event.getWindow().getGuiScaledHeight() / 2f + 15, StringUtil.DECIMAL_COLOR_WHITE);
}
}

View file

@ -36,12 +36,4 @@ public abstract class AAScreen<T extends Container> extends ContainerScreen<T> {
public void renderLabels(@Nonnull MatrixStack matrices, int x, int y) {
font.draw(matrices, this.title, titleLabelX, titleLabelY, 0xFFFFFF);
}
@Override
protected void init() {
super.init();
titleLabelX = (int) (imageWidth / 2.0f - font.width(title) / 2.0f);
titleLabelY = -10;
}
}

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, 0xFFFFFF);
mc.font.draw(matrices, new StringTextComponent(this.getOverlayText()), barX + 25, barY + 78, StringUtil.DECIMAL_COLOR_WHITE);
}
}

View file

@ -47,6 +47,11 @@ public class GuiBioReactor extends AAScreen<ContainerBioReactor> {
//this.energy.render(mouseX, mouseY);
}
@Override
public void renderLabels(@Nonnull MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.tile);
}
@Override
public void renderBg(MatrixStack matrices, float partialTicks, int x, int y) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);

View file

@ -40,6 +40,8 @@ public class GuiBreaker extends AAScreen<ContainerBreaker> {
@Override
public void init(Minecraft pMinecraft, int pWidth, int pHeight) {
super.init(pMinecraft, pWidth, pHeight);
titleLabelX = (int) (imageWidth / 2.0f - font.width(title) / 2.0f);
titleLabelY = -10;
}
@Override

View file

@ -43,6 +43,9 @@ public class GuiCanolaPress extends AAScreen<ContainerCanolaPress> {
super.init();
this.energy = new EnergyDisplay(this.leftPos + 42, this.topPos + 5, this.press.storage);
this.fluid = new FluidDisplay(this.leftPos + 116, this.topPos + 5, this.press.tank);
titleLabelX = (int) (imageWidth / 2.0f - font.width(title) / 2.0f);
titleLabelY = -10;
}
@Override

View file

@ -43,6 +43,8 @@ public class GuiCoalGenerator extends AAScreen<ContainerCoalGenerator> {
public void init() {
super.init();
this.energy = new EnergyDisplay(this.leftPos + 42, this.topPos + 5, this.generator.storage);
titleLabelX = (int) (imageWidth / 2.0f - font.width(title) / 2.0f);
titleLabelY = -10;
}
@Override

View file

@ -14,24 +14,16 @@ import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerCoffeeMachine;
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoffeeMachine;
import de.ellpeck.actuallyadditions.mod.util.*;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.widget.button.Button;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TextComponent;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.client.gui.GuiUtils;
import javax.annotation.Nonnull;
import java.util.Arrays;
import java.util.Collections;
@OnlyIn(Dist.CLIENT)
public class GuiCoffeeMachine extends AAScreen<ContainerCoffeeMachine> {
@ -53,22 +45,20 @@ public class GuiCoffeeMachine extends AAScreen<ContainerCoffeeMachine> {
public void init() {
super.init();
this.addButton(new Button(this.leftPos + 60, this.topPos + 11, 58, 20, new TranslationTextComponent("info.actuallyadditions.gui.ok"),
(b) -> PacketHandlerHelper.sendButtonPacket(this.machine, 0)));
this.energy = new EnergyDisplay(this.leftPos + 16, this.topPos + 5, this.machine.storage);
this.fluid = new FluidDisplay(this.leftPos - 30, this.topPos + 1, this.machine.tank, true, false);
// Button buttonOkay = new Button(this.leftPos + 60, this.topPos + 11, 58, 20, StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.ok"));
// this.addButton(buttonOkay);
//
// this.energy = new EnergyDisplay(this.leftPos + 16, this.topPos + 5, this.machine.storage);
// this.fluid = new FluidDisplay(this.leftPos - 30, this.topPos + 1, this.machine.tank, true, false);
}
@Override
public void render(@Nonnull MatrixStack matrices, int x, int y, float f) {
super.render(matrices, x, y, f);
Minecraft mc = Minecraft.getInstance();
TextComponent text = new TranslationTextComponent("info.actuallyadditions.gui.coffee_amount", this.machine.coffeeCacheAmount, TileEntityCoffeeMachine.COFFEE_CACHE_MAX_AMOUNT);
String text2 = this.machine.coffeeCacheAmount + "/" + TileEntityCoffeeMachine.COFFEE_CACHE_MAX_AMOUNT + " " + StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.coffee");
if (x >= this.leftPos + 40 && y >= this.topPos + 25 && x <= this.leftPos + 49 && y <= this.topPos + 56) {
GuiUtils.drawHoveringText(matrices, Collections.singletonList(text), x, y, mc.getWindow().getWidth(), mc.getWindow().getWidth(), -1, font);
//this.drawHoveringText(Collections.singletonList(text2), x, y);
}
this.energy.render(matrices, x, y);
@ -76,7 +66,12 @@ public class GuiCoffeeMachine extends AAScreen<ContainerCoffeeMachine> {
}
@Override
public void renderBg(@Nonnull MatrixStack matrices, float f, int x, int y) {
public void renderLabels(@Nonnull MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.machine);
}
@Override
public void renderBg(MatrixStack matrices, float f, int x, int y) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION);
@ -101,4 +96,9 @@ public class GuiCoffeeMachine extends AAScreen<ContainerCoffeeMachine> {
this.energy.draw(matrices);
this.fluid.draw(matrices);
}
// @Override
// public void actionPerformed(Button button) {
// PacketHandlerHelper.sendButtonPacket(this.machine, button.id);
// }
}

View file

@ -46,9 +46,15 @@ public class GuiDirectionalBreaker extends AAScreen<ContainerDirectionalBreaker>
@Override
public void render(@Nonnull MatrixStack matrices, int x, int y, float f) {
super.render(matrices, x, y, f);
this.energy.render(matrices, x, y);
}
@Override
public void renderLabels(@Nonnull MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.breaker);
}
@Override
public void renderBg(MatrixStack matrices, float f, int x, int y) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);

View file

@ -49,6 +49,11 @@ public class GuiEnergizer extends AAScreen<ContainerEnergizer> {
this.energy.render(matrices, x, y);
}
@Override
public void renderLabels(@Nonnull MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.energizer);
}
@Override
public void renderBg(MatrixStack matrices, float f, int x, int y) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);

View file

@ -50,6 +50,11 @@ public class GuiEnervator extends AAScreen<ContainerEnervator> {
this.energy.render(matrices, x, y);
}
@Override
public void renderLabels(@Nonnull MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.enervator);
}
@Override
public void renderBg(MatrixStack matrices, float f, int x, int y) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);

View file

@ -44,6 +44,9 @@ public class GuiFarmer extends AAScreen<ContainerFarmer> {
super.init();
this.energy = new EnergyDisplay(this.leftPos + 33, this.topPos + 6, this.farmer.storage);
titleLabelX = (int) (imageWidth / 2.0f - font.width(title) / 2.0f);
titleLabelY = -10;
}
@Override

View file

@ -51,6 +51,11 @@ public class GuiFeeder extends AAScreen<ContainerFeeder> {
}
}
@Override
public void renderLabels(@Nonnull MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.tileFeeder);
}
@Override
public void renderBg(MatrixStack matrices, float f, int x, int y) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);

View file

@ -51,6 +51,9 @@ public class GuiFermentingBarrel extends AAScreen<ContainerFermentingBarrel> {
super.init();
this.input = new FluidDisplay(this.leftPos + 60, this.topPos + 5, this.press.tanks.inputTank);
this.output = new FluidDisplay(this.leftPos + 98, this.topPos + 5, this.press.tanks.outputTank);
titleLabelX = (int) (imageWidth / 2.0f - font.width(title) / 2.0f);
titleLabelY = -10;
}
@Override

View file

@ -49,6 +49,8 @@ public class GuiFluidCollector extends AAScreen<ContainerFluidCollector> {
public void init() {
super.init();
this.fluid = new FluidDisplay(this.leftPos + 67, this.topPos + 5, this.collector.tank);
titleLabelX = (int) (imageWidth / 2.0f - font.width(title) / 2.0f);
titleLabelY = -10;
}
@Override

View file

@ -65,6 +65,8 @@ public class GuiFurnaceDouble extends AAScreen<ContainerFurnaceDouble> {
public void init() {
super.init();
this.energy = new EnergyDisplay(this.leftPos + 27, this.topPos + 5, this.tileFurnace.storage);
titleLabelX = (int) (imageWidth / 2.0f - font.width(title) / 2.0f);
titleLabelY = -10;
this.buttonAutoSplit = new Buttons.SmallerButton(this.leftPos, this.topPos, new StringTextComponent("S"), (button) -> PacketHandlerHelper.sendButtonPacket(this.tileFurnace, 0));
buttonAutoSplit.setFGColor(this.tileFurnace.isAutoSplit ? TextFormatting.DARK_GREEN.getColor() : TextFormatting.RED.getColor());
this.addButton(this.buttonAutoSplit);

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, 0x404040);
this.font.draw(matrices, s2, 131 - this.font.width(s2) / 2, 80, 0x404040);
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);
}
@Override

View file

@ -50,6 +50,12 @@ public class GuiMiner extends AAScreen<ContainerMiner> {
// });
// this.addButton(buttonReset);
}
@Override
public void renderLabels(@Nonnull MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.miner);
}
@Override
public void renderBg(MatrixStack matrices, float f, int x, int y) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
@ -63,7 +69,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, 0x404040);
this.font.draw(matrices, mining, this.leftPos + this.imageWidth / 2 - this.font.width(mining) / 2, this.topPos + 8, StringUtil.DECIMAL_COLOR_GRAY_TEXT);
}
// @Override

View file

@ -47,6 +47,8 @@ public class GuiOilGenerator extends AAScreen<ContainerOilGenerator> {
super.init();
this.energy = new EnergyDisplay(this.leftPos + 42, this.topPos + 5, this.generator.storage);
this.fluid = new FluidDisplay(this.leftPos + 116, this.topPos + 5, this.generator.tank);
titleLabelX = (int) (imageWidth / 2.0f - font.width(title) / 2.0f);
titleLabelY = -10;
}
@Override

View file

@ -78,6 +78,12 @@ public class GuiPhantomPlacer extends AAScreen<ContainerPhantomPlacer> {
// private String getSide() {
// return GuiInputter.SIDES[this.placer.side + 1];
// }
@Override
public void renderLabels(@Nonnull MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.placer);
}
@Override
public void renderBg(MatrixStack matrices, float f, int x, int y) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);

View file

@ -60,6 +60,11 @@ public class GuiRangedCollector extends AAScreen<ContainerRangedCollector> {
this.filter.tick();
}
@Override
public void renderLabels(@Nonnull MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.collector);
}
@Override
public void renderBg(MatrixStack matrices, float f, int x, int y) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);

View file

@ -72,6 +72,11 @@ public class GuiXPSolidifier extends AAScreen<ContainerXPSolidifier> {
// this.addButton(buttonAll);
}
@Override
public void renderLabels(@Nonnull MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.solidifier);
}
@Override
public void renderBg(MatrixStack matrices, float f, int x, int y) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
@ -82,7 +87,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, 0xFFFFFF);
drawCenteredString(matrices, this.font, Integer.toString(this.solidifier.amount), this.leftPos + 88, this.topPos + 30, StringUtil.DECIMAL_COLOR_WHITE);
}
// @Override

View file

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

View file

@ -158,7 +158,6 @@ public abstract class TileEntityBase extends TileEntity implements ITickableTile
// return !oldState.getBlock().isAssociatedBlock(newState.getBlock());
// }
@Deprecated
public String getNameForTranslation() {
return "removeme";// "container." + ActuallyAdditions.MODID + "." + this.name + ".name";
}

View file

@ -33,12 +33,10 @@ import net.minecraft.util.Direction;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.energy.IEnergyStorage;
import net.minecraftforge.fluids.FluidAttributes;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.IFluidHandler;
import net.minecraftforge.fluids.capability.templates.FluidTank;
@ -60,7 +58,7 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
public final CustomEnergyStorage storage = new CustomEnergyStorage(300000, 250, 0);
public final LazyOptional<IEnergyStorage> lazyEnergy = LazyOptional.of(() -> this.storage);
public final FluidTank tank = new FluidTank(4 * FluidAttributes.BUCKET_VOLUME) {
public final FluidTank tank = new FluidTank(4 * Util.BUCKET) {
@Nonnull
@Override
public FluidStack drain(int maxDrain, FluidAction action) {
@ -244,7 +242,7 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
@Override
public ITextComponent getDisplayName() {
return new TranslationTextComponent("container.actuallyadditions.coffeeMachine");
return StringTextComponent.EMPTY;
}
@Nullable

View file

@ -13,7 +13,6 @@ 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;
@ -46,11 +45,11 @@ public class UpdateChecker {
if (Minecraft.getInstance().player != null) {
PlayerEntity player = Minecraft.getInstance().player;
if (UpdateChecker.checkFailed) {
player.displayClientMessage(ITextComponent.Serializer.fromJson(I18n.get("info." + ActuallyAdditions.MODID + ".update.failed")), false);
player.displayClientMessage(ITextComponent.Serializer.fromJson(StringUtil.localize("info." + ActuallyAdditions.MODID + ".update.failed")), false);
} else if (UpdateChecker.needsUpdateNotify) {
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);
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);
}
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, 0xFFFFFF);
font.draw(matrices, text, xSize / 2f - font.width(text) / 2f, yPositionOfMachineText, StringUtil.DECIMAL_COLOR_WHITE);
}
@OnlyIn(Dist.CLIENT)

View file

@ -20,12 +20,18 @@ import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
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
*/
@Deprecated
@OnlyIn(Dist.CLIENT)
public static String localize(String text) {
return I18n.get(text);
@ -39,6 +45,12 @@ public final class StringUtil {
return I18n.get(text, replace);
}
@SuppressWarnings("deprecation")
//TODO: delete this shit and move ItemPotionRing's getItemStackDisplayName into getUnlocalizedName
public static String localizeIllegallyOnTheServerDontUseMePls(String langKey) {
return I18n.get(langKey);
}
// TODO: Move to official
@OnlyIn(Dist.CLIENT)
public static void drawSplitString(FontRenderer renderer, String strg, int x, int y, int width, int color, boolean shadow) {
@ -69,4 +81,25 @@ 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!");
// }
// }
// TODO: This might be wrong
public static String badTranslate(String someUnlocAAItemName) {
// if (cancerino == null) {
// cancerino = new LanguageMap();
// setupLangMap();
// }
// return cancerino.translateKey("item.actuallyadditions." + someUnlocAAItemName + ".name");
return ForgeI18n.parseFormat("item.actuallyadditions." + someUnlocAAItemName + ".name");
}
}

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",
@ -544,15 +544,14 @@
"info.actuallyadditions.gui.inbound": "INBOUND",
"info.actuallyadditions.gui.outbound": "OUTBOUND",
"info.actuallyadditions.gui.coffee": "Coffee",
"info.actuallyadditions.gui.coffee_amount": "%d/%d Coffee",
"info.actuallyadditions.gui.ok": "Ok",
"info.actuallyadditions.gui.the": "the",
"info.actuallyadditions.gui.smart": "Smart Whitelist",
"info.actuallyadditions.gui.smartInfo": "When pressing this, all items from inventories adjacent to this relay will be added to this part of the white- or blacklist. Adding Item Filters to the list before will cause them to also be filled.",
"info.actuallyadditions.inputter.info.1": "This is the first Slot in the connected Inventory to <p> at.",
"info.actuallyadditions.inputter.info.2": "This is the slot after the last Slot in the connected Inventory to <p> at. What that means: If you, for example, write 2 in the field to the left and 5 in this one, it will <p> at Slot 2, 3, and 4.",
"info.actuallyadditions.nolens": "No Lens",
"info.actuallyadditions.noitem": "No Items in Buffer",
"info.actuallyadditions.noLens": "No Lens",
"info.actuallyadditions.noItem": "No Items in Buffer",
"info.actuallyadditions.booklet.manualName.1.1": "Actually Additions",
"info.actuallyadditions.booklet.manualName.1.2": "Actual Additions",
"info.actuallyadditions.booklet.manualName.1.3": "Actually Addiction",