Move Divination output to a HUD element

RIP chat spam 2014-2018

:hype:
This commit is contained in:
Nicholas Ignoffo 2018-02-12 19:45:09 -08:00
parent 3286849309
commit 7167aba23c
6 changed files with 188 additions and 69 deletions

View file

@ -5,7 +5,9 @@ import WayofTime.bloodmagic.apibutnotreally.Constants;
import WayofTime.bloodmagic.apibutnotreally.soul.DemonWillHolder;
import WayofTime.bloodmagic.client.IMeshProvider;
import WayofTime.bloodmagic.client.IVariantProvider;
import WayofTime.bloodmagic.client.Sprite;
import WayofTime.bloodmagic.client.helper.ShaderHelper;
import WayofTime.bloodmagic.client.hud.HUDElementCornerTile;
import WayofTime.bloodmagic.client.hud.HUDElementDemonWillAura;
import WayofTime.bloodmagic.client.hud.HUDElementHolding;
import WayofTime.bloodmagic.client.key.KeyBindings;
@ -20,6 +22,7 @@ import WayofTime.bloodmagic.entity.projectile.EntitySentientArrow;
import WayofTime.bloodmagic.entity.projectile.EntitySoulSnare;
import WayofTime.bloodmagic.tile.*;
import WayofTime.bloodmagic.tile.routing.TileRoutingNode;
import WayofTime.bloodmagic.util.helper.NumeralHelper;
import com.google.common.collect.ImmutableMap;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
@ -42,7 +45,9 @@ import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
import org.apache.commons.lang3.tuple.Pair;
import java.awt.Color;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
public class ClientProxy extends CommonProxy {
public static DemonWillHolder currentAura = new DemonWillHolder();
@ -118,6 +123,44 @@ public class ClientProxy extends CommonProxy {
public void postInit() {
new HUDElementHolding();
new HUDElementDemonWillAura();
new HUDElementCornerTile.BloodAltar(true) { // Divination Sigil
@Override
protected void addInformation(List<Pair<Sprite, Function<TileAltar, String>>> information) {
information.add(Pair.of(new Sprite(new ResourceLocation(BloodMagic.MODID, "textures/gui/widgets.png"), 0, 46, 16, 16), altar -> NumeralHelper.toRoman(altar.getTier().toInt())));
information.add(Pair.of(new Sprite(new ResourceLocation(BloodMagic.MODID, "textures/gui/widgets.png"), 16, 46, 16, 16), altar -> String.format("%d/%d", altar.getCurrentBlood(), altar.getCapacity())));
}
};
new HUDElementCornerTile.BloodAltar(false) { // Seer Sigil
@Override
protected void addInformation(List<Pair<Sprite, Function<TileAltar, String>>> information) {
information.add(Pair.of(
new Sprite(new ResourceLocation(BloodMagic.MODID, "textures/gui/widgets.png"), 0, 46, 16, 16),
altar -> NumeralHelper.toRoman(altar.getTier().toInt())
));
information.add(Pair.of(
new Sprite(new ResourceLocation(BloodMagic.MODID, "textures/gui/widgets.png"), 16, 46, 16, 16),
altar -> String.format("%d/%d", altar.getCurrentBlood(), altar.getCapacity())
));
information.add(Pair.of( // Craft Progress
new Sprite(new ResourceLocation(BloodMagic.MODID, "textures/gui/widgets.png"), 32, 46, 16, 16),
altar -> {
if (!altar.isActive())
return "Inactive"; // FIXME localize
int progress = altar.getProgress();
int totalLiquidRequired = altar.getLiquidRequired() * altar.getStackInSlot(0).getCount();
return String.format("%d/%d", progress, totalLiquidRequired);
}
));
information.add(Pair.of(
new Sprite(new ResourceLocation(BloodMagic.MODID, "textures/gui/widgets.png"), 48, 46, 16, 16),
altar -> String.valueOf((int) (altar.getConsumptionRate() * (altar.getConsumptionMultiplier() + 1)))
));
information.add(Pair.of(
new Sprite(new ResourceLocation(BloodMagic.MODID, "textures/gui/widgets.png"), 64, 46, 16, 16),
altar -> String.valueOf(altar.getTotalCharge())
));
}
};
}
@Override