use of com.mraof.minestuck.util.GristSet in project Minestuck by mraof.
the class DeployList method registerItems.
public static void registerItems() {
registerItem(new ItemStack(MinestuckBlocks.sburbMachine, 1, 0), new GristSet(), new GristSet(GristType.Build, 100), 0);
registerItem(new ItemStack(MinestuckBlocks.sburbMachine, 1, 2), new GristSet(), new GristSet(GristType.Build, 100), 0);
registerItem(AlchemyRecipeHandler.createCard(new ItemStack(MinestuckItems.cruxiteApple), true), new GristSet(), null, 0);
registerItem(new ItemStack(MinestuckBlocks.sburbMachine, 1, 3), new GristSet(), new GristSet(GristType.Build, 100), 0);
registerItem(new ItemStack(MinestuckBlocks.sburbMachine, 1, 1), new GristSet(GristType.Shale, 4), 0);
}
use of com.mraof.minestuck.util.GristSet in project Minestuck by mraof.
the class GuiCrockerMachine method drawGuiContainerForegroundLayer.
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
fontRenderer.drawString(I18n.format("gui." + guis[type.ordinal()] + ".name"), 8, 6, 0xFFFFFF);
// draws "Inventory" or your regional equivalent
fontRenderer.drawString(I18n.format("container.inventory"), 8, ySize - 96 + 2, 0xFFFFFF);
if (type == MachineType.GRIST_WIDGET && !te.getStackInSlot(0).isEmpty()) {
// Render grist requirements
ItemStack stack = AlchemyRecipeHandler.getDecodedItem(te.getStackInSlot(0));
GristSet set = GristRegistry.getGristConversion(stack);
if (set != null) {
float multiplier = stack.getCount();
if (multiplier != 1) {
set = set.scaleGrist(multiplier);
}
set.scaleGrist(0.9F);
}
if (set != null && stack.isItemDamaged()) {
float multiplier = 1 - stack.getItem().getDamage(stack) / ((float) stack.getMaxDamage());
for (GristAmount amount : set.getArray()) {
set.setGrist(amount.getType(), (int) (amount.getAmount() * multiplier));
}
}
GuiUtil.drawGristBoard(set, GuiUtil.GristboardMode.GRIST_WIDGET, 9, 45, fontRenderer);
List<String> tooltip = GuiUtil.getGristboardTooltip(set, mouseX - this.guiLeft, mouseY - this.guiTop, 9, 45, fontRenderer);
if (tooltip != null)
this.drawHoveringText(tooltip, mouseX - this.guiLeft, mouseY - this.guiTop, fontRenderer);
}
}
use of com.mraof.minestuck.util.GristSet in project Minestuck by mraof.
the class GuiScreenMinestuck method drawGrist.
public void drawGrist(int xOffset, int yOffset, int xcor, int ycor, int page) {
// Show the name of the grist instead of the count if displaying a tooltip
boolean showName = false;
GristType tooltipType = null;
GristSet clientGrist = MinestuckPlayerData.getClientGrist();
List<GristType> types = new ArrayList<>(GristType.REGISTRY.getValues());
Collections.sort(types);
types = types.stream().skip(page * rows * columns).limit(rows * columns).collect(Collectors.toList());
int offset = 0;
for (GristType type : types) {
int column = offset % columns;
int row = offset / columns;
int gristXOffset = xOffset + (gristDisplayXOffset * column - column);
int gristYOffset = yOffset + (gristDisplayYOffset * row - row);
String amount = GuiUtil.addSuffix(clientGrist.getGrist(type));
if (this.isPointInRegion(gristXOffset + gristIconX, gristYOffset + gristIconY, 16, 16, xcor, ycor)) {
this.drawGradientRect(gristXOffset + gristIconX, gristYOffset + gristIconY, gristXOffset + gristIconX + 16, gristYOffset + gristIconY + 17, -2130706433, -2130706433);
tooltipType = type;
showName = true;
}
if (!String.valueOf(clientGrist.getGrist(type)).equals(amount) && this.isPointInRegion(gristXOffset + gristCountX - 1, gristYOffset + gristCountY - 1, 35, 10, xcor, ycor)) {
tooltipType = type;
showName = false;
}
this.drawIcon(gristXOffset + gristIconX, gristYOffset + gristIconY, type.getIcon());
mc.fontRenderer.drawString(amount, gristXOffset + gristCountX, gristYOffset + gristCountY, 0xddddee);
offset++;
}
if (tooltipType != null) {
if (showName) {
drawHoveringText(Collections.singletonList(I18n.format("grist.format", tooltipType.getDisplayName())), xcor, ycor, fontRenderer);
} else {
drawHoveringText(Collections.singletonList(String.valueOf(clientGrist.getGrist(tooltipType))), xcor, ycor, fontRenderer);
}
}
}
Aggregations