Move GUI classes to separate package
This commit is contained in:
@@ -0,0 +1,249 @@
|
||||
package electroblob.wizardry.client.gui;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import electroblob.wizardry.SpellGlyphData;
|
||||
import electroblob.wizardry.WizardData;
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.constants.Element;
|
||||
import electroblob.wizardry.item.ItemWand;
|
||||
import electroblob.wizardry.packet.PacketControlInput;
|
||||
import electroblob.wizardry.packet.WizardryPacketHandler;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.tileentity.ContainerArcaneWorkbench;
|
||||
import electroblob.wizardry.tileentity.TileEntityArcaneWorkbench;
|
||||
import electroblob.wizardry.util.WandHelper;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
||||
|
||||
public class GuiArcaneWorkbench extends GuiContainer {
|
||||
|
||||
private GuiButton applyBtn;
|
||||
private static final ResourceLocation texture = new ResourceLocation(Wizardry.MODID,
|
||||
"textures/gui/arcane_workbench.png");
|
||||
|
||||
private IInventory playerInventory;
|
||||
private IInventory arcaneWorkbenchInventory;
|
||||
|
||||
private final int tooltipWidth = 164;
|
||||
|
||||
// We report the actual size of the GUI to Minecraft when a wand is in so JEI doesn't overdraw it.
|
||||
// For calculations, we use the size without the tooltip.
|
||||
private final int xSizeNoTip = 176;
|
||||
|
||||
public GuiArcaneWorkbench(InventoryPlayer invPlayer, TileEntityArcaneWorkbench entity){
|
||||
super(new ContainerArcaneWorkbench(invPlayer, entity));
|
||||
this.playerInventory = invPlayer;
|
||||
this.arcaneWorkbenchInventory = entity;
|
||||
xSize = xSizeNoTip;
|
||||
ySize = 220;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int p_73863_1_, int p_73863_2_, float p_73863_3_){
|
||||
|
||||
// Tests if there is a wand in the workbench and edits the positioning accordingly
|
||||
if(this.inventorySlots.getSlot(ContainerArcaneWorkbench.CENTRE_SLOT).getHasStack() && this.inventorySlots
|
||||
.getSlot(ContainerArcaneWorkbench.CENTRE_SLOT).getStack().getItem() instanceof ItemWand){
|
||||
xSize = xSizeNoTip + tooltipWidth;
|
||||
guiLeft = (this.width - this.xSize) / 2;
|
||||
this.applyBtn.x = (this.width - tooltipWidth) / 2 + 48;
|
||||
}else{
|
||||
xSize = xSizeNoTip;
|
||||
guiLeft = (this.width - this.xSize) / 2;
|
||||
this.applyBtn.x = this.width / 2 + 48;
|
||||
}
|
||||
|
||||
if(this.inventorySlots.getSlot(ContainerArcaneWorkbench.CENTRE_SLOT).getHasStack()){
|
||||
this.applyBtn.enabled = true;
|
||||
}else{
|
||||
this.applyBtn.enabled = false;
|
||||
}
|
||||
|
||||
super.drawScreen(p_73863_1_, p_73863_2_, p_73863_3_);
|
||||
|
||||
// Required now, or item mouseover tooltips won't render.
|
||||
this.renderHoveredToolTip(p_73863_1_, p_73863_2_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY){
|
||||
|
||||
GlStateManager.color(1F, 1F, 1F, 1F);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
|
||||
|
||||
// Main inventory
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSizeNoTip, ySize);
|
||||
|
||||
// Changing slots
|
||||
for(int i = 0; i < ContainerArcaneWorkbench.CRYSTAL_SLOT; i++){
|
||||
Slot slot = this.inventorySlots.getSlot(i);
|
||||
if(slot.xPos >= 0 && slot.yPos >= 0)
|
||||
this.drawTexturedModalRect(guiLeft + slot.xPos - 10, guiTop + slot.yPos - 10, 0, 220, 36, 36);
|
||||
}
|
||||
|
||||
// Tooltip only drawn if there is a wand
|
||||
if(this.inventorySlots.getSlot(ContainerArcaneWorkbench.CENTRE_SLOT).getHasStack() && this.inventorySlots
|
||||
.getSlot(ContainerArcaneWorkbench.CENTRE_SLOT).getStack().getItem() instanceof ItemWand){
|
||||
|
||||
// Tooltip box
|
||||
drawTexturedModalRect(guiLeft + xSizeNoTip, guiTop, xSizeNoTip, 0, 256 - xSizeNoTip - 4, ySize);
|
||||
drawTexturedModalRect(guiLeft + 252, guiTop, xSizeNoTip + 4, 0, tooltipWidth - 2 * (256 - xSizeNoTip - 4), ySize);
|
||||
drawTexturedModalRect(guiLeft + xSize - (256 - xSizeNoTip - 4), guiTop, xSizeNoTip + 4, 0,
|
||||
256 - xSizeNoTip - 4, ySize);
|
||||
|
||||
ItemStack wand = this.inventorySlots.getSlot(ContainerArcaneWorkbench.CENTRE_SLOT).getStack();
|
||||
|
||||
Spell[] spells = WandHelper.getSpells(wand);
|
||||
|
||||
int i = 0;
|
||||
|
||||
for(Spell spell : spells){
|
||||
|
||||
boolean discovered = true;
|
||||
|
||||
if(!this.mc.player.capabilities.isCreativeMode && WizardData.get(this.mc.player) != null){
|
||||
discovered = WizardData.get(this.mc.player).hasSpellBeenDiscovered(spell);
|
||||
}
|
||||
// As of Wizardry 1.2, the icons have been split off into their own texture files to allow for add-on
|
||||
// mods to add their own.
|
||||
Minecraft.getMinecraft().renderEngine
|
||||
.bindTexture(discovered ? spell.element.getIcon() : Element.MAGIC.getIcon());
|
||||
|
||||
// Renders the little element icon
|
||||
WizardryUtilities.drawTexturedRect(guiLeft + xSizeNoTip + 5, guiTop + 34 + 10 * i++, 8, 8);
|
||||
}
|
||||
|
||||
int x = 0;
|
||||
int y = guiTop + 50 + spells.length * 10;
|
||||
|
||||
// Look how much shorter this is with the WandHelper class!
|
||||
for(Item item : WandHelper.getSpecialUpgrades()){
|
||||
|
||||
int level = WandHelper.getUpgradeLevel(wand, item);
|
||||
|
||||
if(level > 0){
|
||||
ItemStack stack = new ItemStack(item, level);
|
||||
GlStateManager.enableDepth();
|
||||
this.itemRender.renderItemAndEffectIntoGUI(stack, guiLeft + xSizeNoTip + 6 + x, y);
|
||||
this.itemRender.renderItemOverlayIntoGUI(this.fontRenderer, stack, guiLeft + xSizeNoTip + 6 + x, y,
|
||||
null);
|
||||
x += 18;
|
||||
GlStateManager.disableDepth();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
|
||||
|
||||
// Fixes the bug that caused the slot hightlight to render opaque. I don't know why it works, it just works!
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.enableAlpha();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY){
|
||||
|
||||
this.fontRenderer
|
||||
.drawString(this.arcaneWorkbenchInventory.hasCustomName() ? this.arcaneWorkbenchInventory.getName()
|
||||
: I18n.format(this.arcaneWorkbenchInventory.getName()), 8, 6, 4210752);
|
||||
this.fontRenderer.drawString(this.playerInventory.hasCustomName() ? this.playerInventory.getName()
|
||||
: I18n.format(this.playerInventory.getName()), 8, this.ySize - 96 + 2, 4210752);
|
||||
|
||||
if(this.inventorySlots.getSlot(ContainerArcaneWorkbench.CENTRE_SLOT).getHasStack() && this.inventorySlots
|
||||
.getSlot(ContainerArcaneWorkbench.CENTRE_SLOT).getStack().getItem() instanceof ItemWand){
|
||||
|
||||
ItemStack wand = this.inventorySlots.getSlot(ContainerArcaneWorkbench.CENTRE_SLOT).getStack();
|
||||
|
||||
this.fontRenderer.drawStringWithShadow("\u00A7f" + wand.getDisplayName(), xSizeNoTip + 6, 6, 0);
|
||||
this.fontRenderer.drawStringWithShadow(
|
||||
"\u00A77" + I18n.format("container." + Wizardry.MODID + ":arcane_workbench.mana") + " "
|
||||
+ (wand.getMaxDamage() - wand.getItemDamage()) + "/" + wand.getMaxDamage(),
|
||||
xSizeNoTip + 6, 20, 0);
|
||||
|
||||
Spell[] spells = WandHelper.getSpells(wand);
|
||||
|
||||
int y = 34;
|
||||
|
||||
for(Spell spell : spells){
|
||||
|
||||
boolean discovered = true;
|
||||
|
||||
if(!this.mc.player.capabilities.isCreativeMode && WizardData.get(this.mc.player) != null){
|
||||
discovered = WizardData.get(this.mc.player).hasSpellBeenDiscovered(spell);
|
||||
}
|
||||
|
||||
if(discovered){
|
||||
this.fontRenderer.drawStringWithShadow(spell.getDisplayNameWithFormatting(), xSizeNoTip + 16, y, 0);
|
||||
}else{
|
||||
this.mc.standardGalacticFontRenderer.drawStringWithShadow(
|
||||
"\u00A79" + SpellGlyphData.getGlyphName(spell, this.mc.world), xSizeNoTip + 16, y, 0);
|
||||
}
|
||||
y += 10;
|
||||
}
|
||||
|
||||
if(WandHelper.getTotalUpgrades(wand) > 0){
|
||||
|
||||
this.fontRenderer.drawStringWithShadow(
|
||||
"\u00A7f" + I18n.format("container." + Wizardry.MODID + ":arcane_workbench.upgrades"), xSizeNoTip + 6, y + 6, 0);
|
||||
|
||||
int x = 0;
|
||||
y = 50 + spells.length * 10;
|
||||
// Wand upgrade tooltips
|
||||
for(Item item : WandHelper.getSpecialUpgrades()){
|
||||
|
||||
int level = WandHelper.getUpgradeLevel(wand, item);
|
||||
|
||||
if(level > 0){
|
||||
// The javadoc for isPointInRegion is ambiguous; what it means is that the REGION is
|
||||
// relative to the GUI but the POINT isn't.
|
||||
if(isPointInRegion(xSizeNoTip + 6 + x, y, 16, 16, mouseX, mouseY)){
|
||||
ItemStack stack = new ItemStack(item, level);
|
||||
this.renderToolTip(stack, mouseX - guiLeft, mouseY - guiTop);
|
||||
}
|
||||
x += 18;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui(){
|
||||
this.mc.player.openContainer = this.inventorySlots;
|
||||
this.guiLeft = (this.width - this.xSize) / 2;
|
||||
this.guiTop = (this.height - this.ySize) / 2;
|
||||
Keyboard.enableRepeatEvents(true);
|
||||
this.buttonList.clear();
|
||||
this.buttonList.add(this.applyBtn = new GuiButtonApply(0, this.width / 2 + 48, this.height / 2 + 3));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGuiClosed(){
|
||||
super.onGuiClosed();
|
||||
Keyboard.enableRepeatEvents(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton button){
|
||||
if(button.enabled){
|
||||
if(button.id == 0){
|
||||
// Packet building
|
||||
IMessage msg = new PacketControlInput.Message(PacketControlInput.ControlType.APPLY_BUTTON);
|
||||
WizardryPacketHandler.net.sendToServer(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package electroblob.wizardry.client.gui;
|
||||
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
class GuiButtonApply extends GuiButton {
|
||||
|
||||
public GuiButtonApply(int id, int x, int y){
|
||||
super(id, x, y, 32, 16, I18n.format("container." + Wizardry.MODID + ":arcane_workbench.apply"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft minecraft, int mouseX, int mouseY, float partialTicks){
|
||||
|
||||
// Whether the button is highlighted
|
||||
this.hovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height;
|
||||
|
||||
int k = 36;
|
||||
int l = 220;
|
||||
int colour = 14737632;
|
||||
|
||||
if(this.enabled){
|
||||
if(this.hovered){
|
||||
k += this.width * 2;
|
||||
colour = 16777120;
|
||||
}
|
||||
}else{
|
||||
k += this.width;
|
||||
colour = 10526880;
|
||||
}
|
||||
|
||||
WizardryUtilities.drawTexturedRect(this.x, this.y, k, l, this.width, this.height, 256, 256);
|
||||
this.drawCenteredString(minecraft.fontRenderer, this.displayString, this.x + this.width / 2,
|
||||
this.y + (this.height - 8) / 2, colour);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package electroblob.wizardry.client.gui;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
class GuiButtonInvisible extends GuiButton {
|
||||
|
||||
public GuiButtonInvisible(int id, int x, int y, int width, int height){
|
||||
super(id, x, y, width, height, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft minecraft, int mouseX, int mouseY, float partialTicks){
|
||||
this.hovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package electroblob.wizardry.client.gui;
|
||||
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
class GuiButtonTurnPage extends GuiButton {
|
||||
|
||||
/** True for pointing right (next page), false for pointing left (previous page). */
|
||||
private final boolean nextPage;
|
||||
|
||||
private static final ResourceLocation texture = new ResourceLocation(Wizardry.MODID, "textures/gui/handbook.png");
|
||||
|
||||
public GuiButtonTurnPage(int id, int x, int y, boolean isNextPage){
|
||||
super(id, x, y, 23, 13, "");
|
||||
this.nextPage = isNextPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft minecraft, int mouseX, int mouseY, float partialTicks){
|
||||
|
||||
if(this.visible){
|
||||
|
||||
boolean flag = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height;
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
minecraft.getTextureManager().bindTexture(texture);
|
||||
int k = 0;
|
||||
int l = 192;
|
||||
|
||||
if(flag){
|
||||
k += 23;
|
||||
}
|
||||
|
||||
if(!this.nextPage){
|
||||
l += 13;
|
||||
}
|
||||
|
||||
WizardryUtilities.drawTexturedRect(this.x, this.y, k, l, 23, 13, 288, 256);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
package electroblob.wizardry.client.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import electroblob.wizardry.Settings;
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraftforge.common.config.ConfigElement;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.fml.client.config.DummyConfigElement.DummyCategoryElement;
|
||||
import net.minecraftforge.fml.client.config.GuiConfig;
|
||||
import net.minecraftforge.fml.client.config.GuiConfigEntries;
|
||||
import net.minecraftforge.fml.client.config.GuiConfigEntries.CategoryEntry;
|
||||
import net.minecraftforge.fml.client.config.IConfigElement;
|
||||
|
||||
public class GuiConfigWizardry extends GuiConfig {
|
||||
|
||||
public GuiConfigWizardry(GuiScreen parent){
|
||||
super(parent, getConfigEntries(), Wizardry.MODID, false, false,
|
||||
Wizardry.NAME + " - " + I18n.format("config." + Wizardry.MODID + ".title.general"));
|
||||
// this.titleLine2 = "File location: " + Wizardry.config.getConfigFile().getAbsolutePath();
|
||||
}
|
||||
|
||||
private static List<IConfigElement> getConfigEntries(){
|
||||
|
||||
List<IConfigElement> configList = new ArrayList<IConfigElement>(1);
|
||||
|
||||
configList.add(new DummyCategoryElement("gameplayConfig", "config." + Wizardry.MODID + ".category." + Settings.GAMEPLAY_CATEGORY, GameplayCategory.class));
|
||||
configList.add(new DummyCategoryElement("worldgenConfig", "config." + Wizardry.MODID + ".category." + Settings.WORLDGEN_CATEGORY, WorldgenCategory.class));
|
||||
configList.add(new DummyCategoryElement("commandsConfig", "config." + Wizardry.MODID + ".category." + Settings.COMMANDS_CATEGORY, CommandsCategory.class));
|
||||
configList.add(new DummyCategoryElement("clientConfig", "config." + Wizardry.MODID + ".category." + Settings.CLIENT_CATEGORY, ClientCategory.class));
|
||||
configList.add(new DummyCategoryElement("spellsConfig", "config." + Wizardry.MODID + ".category." + Settings.SPELLS_CATEGORY, SpellsCategory.class));
|
||||
configList.add(new DummyCategoryElement("resistancesConfig", "config." + Wizardry.MODID + ".category." + Settings.RESISTANCES_CATEGORY, ResistancesCategory.class));
|
||||
|
||||
configList.addAll(new ConfigElement(Wizardry.settings.getConfigCategory(Configuration.CATEGORY_GENERAL)).getChildElements());
|
||||
|
||||
return configList;
|
||||
}
|
||||
|
||||
// The reason this system is so convoluted is that it's designed for use with the @Config annotation. The problem is,
|
||||
// I'm not sure whether that will play well with the load phases. Hmmm...
|
||||
|
||||
public static abstract class CategoryBase extends CategoryEntry {
|
||||
|
||||
public CategoryBase(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement prop){
|
||||
super(owningScreen, owningEntryList, prop);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected GuiScreen buildChildScreen(){
|
||||
|
||||
String category = this.getCategory();
|
||||
|
||||
// This GuiConfig object specifies the configID of the object and as such will force-save when it is closed.
|
||||
// The parent GuiConfig object's entryList will also be refreshed to reflect the changes.
|
||||
GuiConfig childScreen = new GuiConfig(this.owningScreen,
|
||||
(new ConfigElement(Wizardry.settings.getConfigCategory(category))).getChildElements(),
|
||||
this.owningScreen.modID, category, false, false,
|
||||
Wizardry.NAME + " - " + I18n.format("config." + Wizardry.MODID + ".title." + category));
|
||||
|
||||
childScreen.titleLine2 = I18n.format("config." + Wizardry.MODID + ".subtitle." + category);
|
||||
|
||||
return childScreen;
|
||||
}
|
||||
|
||||
protected abstract String getCategory();
|
||||
}
|
||||
|
||||
/** Gameplay category of the config gui. */
|
||||
public static class GameplayCategory extends CategoryBase {
|
||||
|
||||
public GameplayCategory(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement prop){
|
||||
super(owningScreen, owningEntryList, prop);
|
||||
}
|
||||
|
||||
@Override protected String getCategory() { return Settings.GAMEPLAY_CATEGORY; }
|
||||
}
|
||||
|
||||
/** Spells category of the config gui. */
|
||||
public static class SpellsCategory extends CategoryBase {
|
||||
|
||||
public SpellsCategory(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement prop){
|
||||
super(owningScreen, owningEntryList, prop);
|
||||
}
|
||||
|
||||
@Override protected String getCategory() { return Settings.SPELLS_CATEGORY; }
|
||||
}
|
||||
|
||||
/** Resistances category of the config gui. */
|
||||
public static class ResistancesCategory extends CategoryBase {
|
||||
|
||||
public ResistancesCategory(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement prop){
|
||||
super(owningScreen, owningEntryList, prop);
|
||||
}
|
||||
|
||||
@Override protected String getCategory() { return Settings.RESISTANCES_CATEGORY; }
|
||||
}
|
||||
|
||||
/** Worldgen category of the config gui. */
|
||||
public static class WorldgenCategory extends CategoryBase {
|
||||
|
||||
public WorldgenCategory(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement prop){
|
||||
super(owningScreen, owningEntryList, prop);
|
||||
}
|
||||
|
||||
@Override protected String getCategory() { return Settings.WORLDGEN_CATEGORY; }
|
||||
}
|
||||
|
||||
/** Client category of the config gui. */
|
||||
public static class ClientCategory extends CategoryBase {
|
||||
|
||||
public ClientCategory(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement prop){
|
||||
super(owningScreen, owningEntryList, prop);
|
||||
}
|
||||
|
||||
@Override protected String getCategory() { return Settings.CLIENT_CATEGORY; }
|
||||
}
|
||||
|
||||
/** Commands category of the config gui. */
|
||||
public static class CommandsCategory extends CategoryBase {
|
||||
|
||||
public CommandsCategory(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement prop){
|
||||
super(owningScreen, owningEntryList, prop);
|
||||
}
|
||||
|
||||
@Override protected String getCategory() { return Settings.COMMANDS_CATEGORY; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package electroblob.wizardry.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.ContainerWorkbench;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/** Crafting table GUI that doesn't require a crafting table container object. */
|
||||
public class GuiPortableCrafting extends GuiContainer {
|
||||
|
||||
private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation(
|
||||
"textures/gui/container/crafting_table.png");
|
||||
|
||||
public GuiPortableCrafting(InventoryPlayer p_i1084_1_, World p_i1084_2_, BlockPos pos){
|
||||
super(new ContainerWorkbench(p_i1084_1_, p_i1084_2_, pos));
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the foreground layer for the GuiContainer (everything in front of the items)
|
||||
*/
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_){
|
||||
this.fontRenderer.drawString(I18n.format("container.crafting"), 28, 6, 4210752);
|
||||
this.fontRenderer.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_){
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.getTextureManager().bindTexture(craftingTableGuiTextures);
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package electroblob.wizardry.client.gui;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import electroblob.wizardry.SpellGlyphData;
|
||||
import electroblob.wizardry.WizardData;
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.constants.Tier;
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GuiSpellBook extends GuiScreen {
|
||||
|
||||
private int xSize, ySize;
|
||||
private Spell spell;
|
||||
|
||||
private static final ResourceLocation texture = new ResourceLocation(Wizardry.MODID, "textures/gui/spellbook.png");
|
||||
|
||||
public GuiSpellBook(Spell spell){
|
||||
super();
|
||||
xSize = 288;
|
||||
ySize = 180;
|
||||
this.spell = spell;
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws the screen and all the components in it.
|
||||
*/
|
||||
public void drawScreen(int par1, int par2, float par3){
|
||||
|
||||
int xPos = this.width / 2 - xSize / 2;
|
||||
int yPos = this.height / 2 - this.ySize / 2;
|
||||
|
||||
EntityPlayer player = Minecraft.getMinecraft().player;
|
||||
|
||||
boolean discovered = true;
|
||||
if(Wizardry.settings.discoveryMode && !player.capabilities.isCreativeMode && WizardData.get(player) != null
|
||||
&& !WizardData.get(player).hasSpellBeenDiscovered(spell)){
|
||||
discovered = false;
|
||||
}
|
||||
|
||||
// Draws spell illustration on opposite page, underneath the book so it shows through the hole.
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(discovered ? spell.getIcon() : Spells.none.getIcon());
|
||||
WizardryUtilities.drawTexturedRect(xPos + 145, yPos + 20, 0, 0, 128, 128, 128, 128);
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
|
||||
WizardryUtilities.drawTexturedRect(xPos, yPos, 0, 0, xSize, ySize, xSize, 256);
|
||||
|
||||
super.drawScreen(par1, par2, par3);
|
||||
|
||||
if(discovered){
|
||||
this.fontRenderer.drawString(spell.getDisplayName(), xPos + 17, yPos + 14, 0);
|
||||
this.fontRenderer.drawString(spell.type.getDisplayName(), xPos + 17, yPos + 25, 0x777777);
|
||||
}else{
|
||||
this.mc.standardGalacticFontRenderer.drawString(SpellGlyphData.getGlyphName(spell, player.world), xPos + 17,
|
||||
yPos + 14, 0);
|
||||
this.mc.standardGalacticFontRenderer.drawString(spell.type.getDisplayName(), xPos + 17, yPos + 25,
|
||||
0x777777);
|
||||
}
|
||||
|
||||
this.fontRenderer.drawString("-------------------", xPos + 17, yPos + 34, 0);
|
||||
|
||||
if(spell.tier == Tier.BASIC){
|
||||
// Basic is usually white but this doesn't show up.
|
||||
this.fontRenderer.drawString("Tier: \u00A77" + Tier.BASIC.getDisplayName(), xPos + 17, yPos + 44, 0);
|
||||
}else{
|
||||
this.fontRenderer.drawString("Tier: " + spell.tier.getDisplayNameWithFormatting(), xPos + 17, yPos + 44,
|
||||
0);
|
||||
}
|
||||
|
||||
String element = "Element: " + spell.element.getFormattingCode() + spell.element.getDisplayName();
|
||||
if(!discovered) element = "Element: ?";
|
||||
this.fontRenderer.drawString(element, xPos + 17, yPos + 56, 0);
|
||||
|
||||
String manaCost = "Mana Cost: " + spell.cost;
|
||||
if(spell.isContinuous) manaCost = "Mana Cost: " + spell.cost + "/second";
|
||||
if(!discovered) manaCost = "Mana Cost: ?";
|
||||
this.fontRenderer.drawString(manaCost, xPos + 17, yPos + 68, 0);
|
||||
|
||||
if(discovered){
|
||||
this.fontRenderer.drawSplitString(spell.getDescription(), xPos + 17, yPos + 82, 118, 0);
|
||||
}else{
|
||||
this.mc.standardGalacticFontRenderer.drawSplitString(
|
||||
SpellGlyphData.getGlyphDescription(spell, player.world), xPos + 17, yPos + 82, 118, 0);
|
||||
}
|
||||
|
||||
/* // Word wrapping int charNumber = 0; int lineNumber = 0;
|
||||
*
|
||||
* while(charNumber < spell.desc.length()){ int lineLength = 0; String line; if(spell.desc.length() - charNumber
|
||||
* > 22){ for(int i = charNumber; i < charNumber+23; i++){ if(spell.desc.charAt(i) == ' '){ lineLength = i -
|
||||
* charNumber; } } line = spell.desc.substring(charNumber, charNumber + lineLength); }else{ line =
|
||||
* spell.desc.substring(charNumber, spell.desc.length()); charNumber = spell.desc.length(); }
|
||||
* this.fontRendererObj.drawString("\u00A7o" + line, xPos+17, yPos+82+10*lineNumber, 0);
|
||||
* charNumber+=(lineLength+1); lineNumber++; } */
|
||||
}
|
||||
|
||||
public void initGui(){
|
||||
super.initGui();
|
||||
Keyboard.enableRepeatEvents(true);
|
||||
this.buttonList.clear();
|
||||
}
|
||||
|
||||
public void onGuiClosed(){
|
||||
super.onGuiClosed();
|
||||
Keyboard.enableRepeatEvents(false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
package electroblob.wizardry.client.gui;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import electroblob.wizardry.Settings.GuiPosition;
|
||||
import electroblob.wizardry.SpellGlyphData;
|
||||
import electroblob.wizardry.WizardData;
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.constants.Constants;
|
||||
import electroblob.wizardry.item.ItemWand;
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.registry.WizardryPotions;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.WandHelper;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.GlStateManager.DestFactor;
|
||||
import net.minecraft.client.renderer.GlStateManager.SourceFactor;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
public class GuiSpellDisplay extends Gui {
|
||||
|
||||
private Minecraft mc;
|
||||
|
||||
private static final ResourceLocation hudTexture = new ResourceLocation(Wizardry.MODID, "textures/gui/spell_hud.png");
|
||||
|
||||
public GuiSpellDisplay(Minecraft par1Minecraft){
|
||||
super();
|
||||
this.mc = par1Minecraft;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void draw(RenderGameOverlayEvent event){
|
||||
|
||||
EntityPlayer player = this.mc.player;
|
||||
|
||||
// If the player has a wand in each hand, only displays for the one in the main hand.
|
||||
|
||||
ItemStack wand = player.getHeldItemMainhand();
|
||||
|
||||
if(!(wand.getItem() instanceof ItemWand)){
|
||||
wand = player.getHeldItemOffhand();
|
||||
// If the player isn't holding a wand, then nothing else needs to be done.
|
||||
if(!(wand.getItem() instanceof ItemWand)) return;
|
||||
}
|
||||
|
||||
int width = event.getResolution().getScaledWidth();
|
||||
int height = event.getResolution().getScaledHeight();
|
||||
|
||||
Spell spell = WandHelper.getCurrentSpell(wand);
|
||||
int cooldown = WandHelper.getCurrentCooldown(wand);
|
||||
|
||||
float cooldownMultiplier = 1.0f - WandHelper.getUpgradeLevel(wand, WizardryItems.cooldown_upgrade) * Constants.COOLDOWN_REDUCTION_PER_LEVEL;
|
||||
|
||||
if(player.isPotionActive(WizardryPotions.font_of_mana)){
|
||||
// Dividing by this rather than setting it takes upgrades and font of mana into account simultaneously
|
||||
cooldownMultiplier /= 2 + player.getActivePotionEffect(WizardryPotions.font_of_mana).getAmplifier();
|
||||
}
|
||||
|
||||
// Coordinates of the top left corner of the HUD.
|
||||
int left = 0;
|
||||
int top = 0;
|
||||
boolean mirror = false;
|
||||
|
||||
if(Wizardry.settings.spellHUDPosition == GuiPosition.BOTTOM_LEFT){
|
||||
left = 0;
|
||||
top = height - 36;
|
||||
}else if(Wizardry.settings.spellHUDPosition == GuiPosition.TOP_LEFT){
|
||||
left = 0;
|
||||
top = 0;
|
||||
}else if(Wizardry.settings.spellHUDPosition == GuiPosition.TOP_RIGHT){
|
||||
left = width - 128;
|
||||
top = 0;
|
||||
mirror = true;
|
||||
}else if(Wizardry.settings.spellHUDPosition == GuiPosition.BOTTOM_RIGHT){
|
||||
left = width - 128;
|
||||
top = height - 36;
|
||||
mirror = true;
|
||||
}
|
||||
|
||||
boolean discovered = true;
|
||||
|
||||
if(!player.capabilities.isCreativeMode && WizardData.get(player) != null){
|
||||
discovered = WizardData.get(player).hasSpellBeenDiscovered(spell);
|
||||
}
|
||||
|
||||
if(event.getType() == RenderGameOverlayEvent.ElementType.TEXT){
|
||||
|
||||
// Makes spells greyed out if they are in cooldown or if the player has the arcane jammer effect
|
||||
String colour = cooldown > 0 || player.isPotionActive(WizardryPotions.arcane_jammer) ? "\u00A78" : spell.element.getFormattingCode();
|
||||
if(!discovered) colour = "\u00A79";
|
||||
String spellName = discovered ? spell.getDisplayName() : SpellGlyphData.getGlyphName(spell, player.world);
|
||||
FontRenderer font = discovered ? this.mc.fontRenderer : this.mc.standardGalacticFontRenderer;
|
||||
|
||||
int maxWidth = 90;
|
||||
|
||||
if(font.getStringWidth(spellName) <= maxWidth){
|
||||
// Single line is rendered more centrally
|
||||
font.drawStringWithShadow(colour + spellName, mirror ? left + 5 : left + 41, top + 13, 0xffffffff);
|
||||
|
||||
}else{
|
||||
|
||||
int lineNumber = 0;
|
||||
|
||||
List<String> lines = font.listFormattedStringToWidth(spellName, maxWidth);
|
||||
|
||||
for(Object line : lines){
|
||||
if(line instanceof String){
|
||||
font.drawStringWithShadow(colour + (String)line, mirror ? left + 5 : left + 41, top + 6 + 11 * lineNumber, 0xffffffff);
|
||||
}
|
||||
lineNumber++;
|
||||
}
|
||||
}
|
||||
|
||||
}else if(event.getType() == RenderGameOverlayEvent.ElementType.HOTBAR){
|
||||
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA);
|
||||
GlStateManager.color(1, 1, 1);
|
||||
|
||||
this.mc.renderEngine.bindTexture(hudTexture);
|
||||
|
||||
// Background of spell hud
|
||||
this.drawTexturedModalRect(left, top, 0, mirror ? 36 : 0, 128, 36);
|
||||
|
||||
// Cooldown bar
|
||||
if(cooldown > 0){
|
||||
this.drawTexturedModalRect(mirror ? left + 5 : left + 41, top + 28, 128, 6, 82, 6);
|
||||
|
||||
int l = (int)(((double)(spell.cooldown * cooldownMultiplier - cooldown) / (double)(spell.cooldown * cooldownMultiplier)) * 82);
|
||||
|
||||
this.drawTexturedModalRect(mirror ? left + 5 : left + 41, top + 28, 128, 0, l, 6);
|
||||
}
|
||||
|
||||
// Spell illustration
|
||||
this.mc.renderEngine.bindTexture(discovered ? spell.getIcon() : Spells.none.getIcon());
|
||||
|
||||
WizardryUtilities.drawTexturedRect(mirror ? left + 94 : left + 2, top + 2, 0, 0, 32, 32, 32, 32);
|
||||
|
||||
// Blend needs to be left enabled here because otherwise the hotbar becomes opaque
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,695 @@
|
||||
package electroblob.wizardry.client.gui;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.client.ClientProxy;
|
||||
import electroblob.wizardry.constants.Constants;
|
||||
import electroblob.wizardry.constants.Element;
|
||||
import electroblob.wizardry.constants.Tier;
|
||||
import electroblob.wizardry.registry.WizardryBlocks;
|
||||
import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GuiWizardHandbook extends GuiScreen {
|
||||
|
||||
private int xSize, ySize;
|
||||
private int pageNumber = 0;
|
||||
|
||||
private static final int PAGE_WIDTH = 120;
|
||||
/**
|
||||
* The integer colour for black passed into the font renderer methods. This used to be 0 but that's now white for
|
||||
* some reason, so I've made a it a constant in case it changes again.
|
||||
*/
|
||||
// I think this is actually ever-so-slightly lighter than pure black, but the difference is unnoticeable.
|
||||
private static final int BLACK = 1;
|
||||
|
||||
public static final ResourceLocation regularHandbook = new ResourceLocation(Wizardry.MODID, "textures/gui/handbook.png");
|
||||
public static final ResourceLocation ore = new ResourceLocation(Wizardry.MODID, "textures/gui/ore_picture.png");
|
||||
public static final ResourceLocation crystal = new ResourceLocation(Wizardry.MODID, "textures/items/magic_crystal.png");
|
||||
public static final ResourceLocation workbenchGui = new ResourceLocation(Wizardry.MODID, "textures/gui/arcane_workbench.png");
|
||||
public static final ResourceLocation craftingGrids = new ResourceLocation(Wizardry.MODID, "textures/gui/handbook_recipes.png");
|
||||
|
||||
private List<ArrayList<String>> text;
|
||||
private List<Section> sections;
|
||||
|
||||
private static final List<Pair<ItemStack, NonNullList<NonNullList<ItemStack>>>> RECIPES = new ArrayList<>();
|
||||
|
||||
private int guiPage, imagePage;
|
||||
|
||||
public GuiWizardHandbook(){
|
||||
super();
|
||||
xSize = 288;
|
||||
ySize = 180;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float par3){
|
||||
|
||||
int xPos = this.width / 2 - xSize / 2;
|
||||
int yPos = this.height / 2 - this.ySize / 2;
|
||||
|
||||
// Tests for crafting recipes section
|
||||
if(pageNumber >= (sections.get(sections.size() - 1).pageNumber - 1) / 2
|
||||
&& pageNumber < (sections.get(sections.size() - 1).pageNumber - 1) / 2 + 4){
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(craftingGrids);
|
||||
}else{
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(regularHandbook);
|
||||
}
|
||||
|
||||
WizardryUtilities.drawTexturedRect(xPos, yPos, 0, 0, xSize, ySize, xSize, 256);
|
||||
|
||||
// Arcane workbench gui picture
|
||||
if(pageNumber == (this.guiPage - 1) / 2){
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(workbenchGui);
|
||||
this.drawTexturedModalRect(this.guiPage % 2 == 1 ? xPos + 17 : this.width / 2 + 7, yPos + 14, 28, 12, 120,
|
||||
118);
|
||||
}
|
||||
|
||||
// Magic crystal and crystal ore images
|
||||
if(pageNumber == (this.imagePage - 1) / 2){
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(ore);
|
||||
WizardryUtilities.drawTexturedRect(this.imagePage % 2 == 1 ? xPos + 17 : this.width / 2 + 7, yPos + 80, 0,
|
||||
0, 64, 64, 64, 64);
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(crystal);
|
||||
drawTexturedStretchedRect(this.imagePage % 2 == 1 ? xPos + 17 + 64 : this.width / 2 + 7 + 62, yPos + 80, 0,
|
||||
0, 64, 64, 1, 1);
|
||||
|
||||
}
|
||||
|
||||
this.fontRenderer.drawString("" + (pageNumber * 2 + 1), xPos + xSize / 4 - 3, yPos + ySize - 20, 0);
|
||||
this.fontRenderer.drawString("" + (pageNumber * 2 + 2), xPos + 3 * xSize / 4 - 5, yPos + ySize - 20, 0);
|
||||
|
||||
super.drawScreen(mouseX, mouseY, par3);
|
||||
|
||||
int lineNumber = 0;
|
||||
|
||||
if(pageNumber == 1){
|
||||
for(Section s : sections){
|
||||
s.drawContents();
|
||||
}
|
||||
}else{
|
||||
for(Section s : sections){
|
||||
s.hideButton();
|
||||
}
|
||||
}
|
||||
|
||||
for(String paragraph : text.get(pageNumber * 2)){
|
||||
|
||||
this.fontRenderer.drawSplitString(paragraph, xPos + 17,
|
||||
yPos + 14 + lineNumber * this.fontRenderer.FONT_HEIGHT, PAGE_WIDTH, BLACK);
|
||||
|
||||
List<String> list = new ArrayList<String>(
|
||||
this.fontRenderer.listFormattedStringToWidth(paragraph, GuiWizardHandbook.PAGE_WIDTH));
|
||||
|
||||
lineNumber += list.size();
|
||||
}
|
||||
|
||||
lineNumber = 0;
|
||||
|
||||
// Prevents crash when the last page is blank (and hence is not in the list of pages)
|
||||
if(text.size() > pageNumber * 2 + 1){
|
||||
for(String paragraph : text.get(pageNumber * 2 + 1)){
|
||||
|
||||
// First page is centred
|
||||
if(pageNumber == 0){
|
||||
int startX = this.width / 2 + 7 + PAGE_WIDTH / 2
|
||||
- this.fontRenderer.getStringWidth(paragraph) / 2;
|
||||
this.fontRenderer.drawSplitString(paragraph, startX,
|
||||
yPos + 14 + lineNumber * this.fontRenderer.FONT_HEIGHT, PAGE_WIDTH, BLACK);
|
||||
}else{
|
||||
this.fontRenderer.drawSplitString(paragraph, this.width / 2 + 7,
|
||||
yPos + 14 + lineNumber * this.fontRenderer.FONT_HEIGHT, PAGE_WIDTH, BLACK);
|
||||
}
|
||||
|
||||
List<String> list = new ArrayList<String>(
|
||||
this.fontRenderer.listFormattedStringToWidth(paragraph, GuiWizardHandbook.PAGE_WIDTH));
|
||||
|
||||
lineNumber += list.size();
|
||||
}
|
||||
}
|
||||
|
||||
// Which page of the recipes this is
|
||||
int recipePage = pageNumber - (sections.get(sections.size() - 1).pageNumber - 1) / 2;
|
||||
|
||||
if(recipePage >= 0 && recipePage < 4){
|
||||
// 4 recipes per page, hence the recipePage*4
|
||||
this.renderCraftingRecipe(xPos + 23, yPos + 39, mouseX, mouseY, RECIPES.get(recipePage*4).getRight(), RECIPES.get(recipePage*4).getLeft());
|
||||
this.renderCraftingRecipe(xPos + 23, yPos + 98, mouseX, mouseY, RECIPES.get(recipePage*4+1).getRight(), RECIPES.get(recipePage*4+1).getLeft());
|
||||
this.renderCraftingRecipe(xPos + 156, yPos + 39, mouseX, mouseY, RECIPES.get(recipePage*4+2).getRight(), RECIPES.get(recipePage*4+2).getLeft());
|
||||
this.renderCraftingRecipe(xPos + 156, yPos + 98, mouseX, mouseY, RECIPES.get(recipePage*4+3).getRight(), RECIPES.get(recipePage*4+3).getLeft());
|
||||
|
||||
// Tooltips are rendered after recipes to prevent tooltips on the left appearing behind items on the right.
|
||||
this.renderCraftingTooltips(xPos + 23, yPos + 39, mouseX, mouseY, RECIPES.get(recipePage*4).getRight(), RECIPES.get(recipePage*4).getLeft());
|
||||
this.renderCraftingTooltips(xPos + 23, yPos + 98, mouseX, mouseY, RECIPES.get(recipePage*4+1).getRight(), RECIPES.get(recipePage*4+1).getLeft());
|
||||
this.renderCraftingTooltips(xPos + 156, yPos + 39, mouseX, mouseY, RECIPES.get(recipePage*4+2).getRight(), RECIPES.get(recipePage*4+2).getLeft());
|
||||
this.renderCraftingTooltips(xPos + 156, yPos + 98, mouseX, mouseY, RECIPES.get(recipePage*4+3).getRight(), RECIPES.get(recipePage*4+3).getLeft());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TODO: In 1.12, this all needs redoing nicely. With the crafting system halfway through changing in 1.11.2, this
|
||||
// isn't worth doing until then.
|
||||
|
||||
private void renderCraftingRecipe(int xPos, int yPos, int mouseX, int mouseY, NonNullList<NonNullList<ItemStack>> craftingGrid,
|
||||
ItemStack craftingResult){
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.enableRescaleNormal();
|
||||
GlStateManager.enableColorMaterial();
|
||||
GlStateManager.enableLighting();
|
||||
itemRender.zLevel = 100.0F;
|
||||
|
||||
for(int i = 0; i < craftingGrid.size(); i++){
|
||||
for(int j = 0; j < craftingGrid.get(i).size(); j++){
|
||||
ItemStack stack = craftingGrid.get(i).get(j);
|
||||
if(!stack.isEmpty()){
|
||||
itemRender.renderItemAndEffectIntoGUI(stack, xPos + 18 * i, yPos + 18 * j);
|
||||
itemRender.renderItemOverlays(this.fontRenderer, stack, xPos + 18 * i,
|
||||
yPos + 18 * j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!craftingResult.isEmpty()){
|
||||
itemRender.renderItemAndEffectIntoGUI(craftingResult, xPos + 86, yPos + 18);
|
||||
itemRender.renderItemOverlays(this.fontRenderer, craftingResult, xPos + 86, yPos + 18);
|
||||
}
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.enableDepth();
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
|
||||
}
|
||||
|
||||
private void renderCraftingTooltips(int xPos, int yPos, int mouseX, int mouseY, NonNullList<NonNullList<ItemStack>> craftingGrid,
|
||||
ItemStack craftingResult){
|
||||
|
||||
int guiLeft = this.width / 2 - xSize / 2;
|
||||
int guiTop = this.height / 2 - this.ySize / 2;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.enableRescaleNormal();
|
||||
GlStateManager.enableColorMaterial();
|
||||
itemRender.zLevel = 0.0F;
|
||||
GlStateManager.disableLighting();
|
||||
|
||||
for(int i = 0; i < craftingGrid.size(); i++){
|
||||
for(int j = 0; j < craftingGrid.get(i).size(); j++){
|
||||
ItemStack stack = craftingGrid.get(i).get(j);
|
||||
if(!stack.isEmpty()
|
||||
&& isPointInRegion(xPos + 18 * i, yPos + 18 * j, 16, 16, mouseX + guiLeft, mouseY + guiTop)){
|
||||
this.renderToolTip(stack, mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!craftingResult.isEmpty() && isPointInRegion(xPos + 86, yPos + 18, 16, 16, mouseX + guiLeft, mouseY + guiTop)){
|
||||
this.renderToolTip(craftingResult, mouseX, mouseY);
|
||||
}
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.enableDepth();
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui(){
|
||||
|
||||
super.initGui();
|
||||
Keyboard.enableRepeatEvents(true);
|
||||
|
||||
int nextButtonId = 0;
|
||||
|
||||
this.buttonList.clear();
|
||||
this.buttonList.add(new GuiButtonTurnPage(nextButtonId++, this.width / 2 + this.xSize / 2 - 22 - 23,
|
||||
this.height / 2 + this.ySize / 2 - 10 - 13, true));
|
||||
this.buttonList.add(new GuiButtonTurnPage(nextButtonId++, this.width / 2 - this.xSize / 2 + 21,
|
||||
this.height / 2 + this.ySize / 2 - 10 - 13, false));
|
||||
|
||||
text = new ArrayList<ArrayList<String>>(1);
|
||||
sections = new ArrayList<Section>(1);
|
||||
|
||||
BufferedReader bufferedreader = null;
|
||||
|
||||
String textFilepath = Wizardry.MODID + ":texts/handbook_"
|
||||
+ Minecraft.getMinecraft().getLanguageManager().getCurrentLanguage().getLanguageCode() + ".txt";
|
||||
|
||||
try{
|
||||
|
||||
bufferedreader = new BufferedReader(new InputStreamReader(
|
||||
this.mc.getResourceManager().getResource(new ResourceLocation(textFilepath)).getInputStream(),
|
||||
StandardCharsets.UTF_8));
|
||||
|
||||
}catch (IOException e){
|
||||
|
||||
Wizardry.logger.info(
|
||||
"Wizard handbook text file missing for the current language. Using default (English - US) instead.");
|
||||
|
||||
textFilepath = Wizardry.MODID + ":texts/handbook_en_us.txt";
|
||||
|
||||
try {
|
||||
|
||||
bufferedreader = new BufferedReader(new InputStreamReader(
|
||||
this.mc.getResourceManager().getResource(new ResourceLocation(textFilepath)).getInputStream(),
|
||||
StandardCharsets.UTF_8));
|
||||
|
||||
} catch (IOException x){
|
||||
Wizardry.logger.error("Couldn't find file: " + Wizardry.MODID + "/assets/texts/handbook_en_us.txt. The file may be"
|
||||
+ "missing; please try re-downloading and reinstalling Wizardry.", x);
|
||||
}
|
||||
}
|
||||
|
||||
if(bufferedreader != null){
|
||||
|
||||
try{
|
||||
|
||||
String paragraph = bufferedreader.readLine();
|
||||
ArrayList<String> page = new ArrayList<String>(1);
|
||||
|
||||
int linesPerPage = 16;
|
||||
|
||||
int lineNumber = 0;
|
||||
|
||||
while(paragraph != null){
|
||||
|
||||
// System.out.println(paragraph);
|
||||
|
||||
if(paragraph.contains("PAGEBREAK") || lineNumber >= linesPerPage){
|
||||
|
||||
text.add(page);
|
||||
|
||||
page = new ArrayList<String>(1);
|
||||
|
||||
lineNumber = 0;
|
||||
|
||||
if(paragraph.contains("PAGEBREAK")) paragraph = bufferedreader.readLine();
|
||||
|
||||
}else if(paragraph.contains("LINEBREAK")){
|
||||
|
||||
lineNumber++;
|
||||
|
||||
page.add("");
|
||||
|
||||
paragraph = bufferedreader.readLine();
|
||||
|
||||
}else if(paragraph.contains("SECTION")){
|
||||
|
||||
sections.add(
|
||||
new Section(paragraph.replace("SECTION ", ""), text.size() + 1, this.width / 2 + 7,
|
||||
this.height / 2 - this.ySize / 2 + 14
|
||||
+ (sections.size() + 2) * this.fontRenderer.FONT_HEIGHT,
|
||||
nextButtonId++));
|
||||
paragraph = bufferedreader.readLine();
|
||||
|
||||
}else if(paragraph.contains("IMAGE")){
|
||||
|
||||
if(paragraph.contains("WORKBENCH")){
|
||||
this.guiPage = text.size() + 1;
|
||||
}else if(paragraph.contains("CRYSTAL")){
|
||||
this.imagePage = text.size() + 1;
|
||||
}
|
||||
|
||||
paragraph = bufferedreader.readLine();
|
||||
|
||||
}else{
|
||||
|
||||
paragraph = paragraph.replaceAll("NEXT_SPELL_KEY", ClientProxy.NEXT_SPELL.getDisplayName());
|
||||
paragraph = paragraph.replaceAll("PREVIOUS_SPELL_KEY", ClientProxy.PREVIOUS_SPELL.getDisplayName());
|
||||
paragraph = paragraph.replaceAll("MANA_PER_CRYSTAL_MINUS_30", "" + (Constants.MANA_PER_CRYSTAL - 30));
|
||||
paragraph = paragraph.replaceAll("MANA_PER_CRYSTAL", "" + Constants.MANA_PER_CRYSTAL);
|
||||
paragraph = paragraph.replaceAll("BASIC_MAX_CHARGE", "" + Tier.BASIC.maxCharge);
|
||||
paragraph = paragraph.replaceAll("APPRENTICE_MAX_CHARGE", "" + Tier.APPRENTICE.maxCharge);
|
||||
paragraph = paragraph.replaceAll("ADVANCED_MAX_CHARGE", "" + Tier.ADVANCED.maxCharge);
|
||||
paragraph = paragraph.replaceAll("MASTER_MAX_CHARGE", "" + Tier.MASTER.maxCharge);
|
||||
paragraph = paragraph.replaceAll("BASIC_COLOUR", "\u00A77");
|
||||
paragraph = paragraph.replaceAll("APPRENTICE_COLOUR", Tier.APPRENTICE.getFormattingCode());
|
||||
paragraph = paragraph.replaceAll("ADVANCED_COLOUR", Tier.ADVANCED.getFormattingCode());
|
||||
paragraph = paragraph.replaceAll("MASTER_COLOUR", Tier.MASTER.getFormattingCode());
|
||||
paragraph = paragraph.replaceAll("FIRE_COLOUR", Element.FIRE.getFormattingCode());
|
||||
paragraph = paragraph.replaceAll("ICE_COLOUR", Element.ICE.getFormattingCode());
|
||||
paragraph = paragraph.replaceAll("LIGHTNING_COLOUR", Element.LIGHTNING.getFormattingCode());
|
||||
paragraph = paragraph.replaceAll("NECROMANCY_COLOUR", Element.NECROMANCY.getFormattingCode());
|
||||
paragraph = paragraph.replaceAll("EARTH_COLOUR", Element.EARTH.getFormattingCode());
|
||||
paragraph = paragraph.replaceAll("SORCERY_COLOUR", Element.SORCERY.getFormattingCode());
|
||||
paragraph = paragraph.replaceAll("HEALING_COLOUR", Element.HEALING.getFormattingCode());
|
||||
paragraph = paragraph.replaceAll("RESET_COLOUR", "\u00A70");
|
||||
paragraph = paragraph.replaceAll("MCVERSION", "1.12.2");
|
||||
paragraph = paragraph.replaceAll("VERSION", Wizardry.VERSION);
|
||||
|
||||
int linesInParagraph = this.fontRenderer
|
||||
.listFormattedStringToWidth(paragraph, GuiWizardHandbook.PAGE_WIDTH).size();
|
||||
|
||||
// Ignores empty lines at the top of a page.
|
||||
if(paragraph.isEmpty() && lineNumber == 0){
|
||||
|
||||
paragraph = bufferedreader.readLine();
|
||||
|
||||
// Normal paragraph, all on one page
|
||||
}else if(lineNumber + linesInParagraph <= linesPerPage){
|
||||
|
||||
page.add(paragraph);
|
||||
|
||||
lineNumber += linesInParagraph;
|
||||
|
||||
paragraph = bufferedreader.readLine();
|
||||
|
||||
// Paragraphs split across two pages (or more?)
|
||||
}else{
|
||||
|
||||
int linesInFirstPart = linesPerPage - lineNumber;
|
||||
|
||||
String paragraphFirstPart = "";
|
||||
String paragraphLastPart = "";
|
||||
|
||||
int i = 0;
|
||||
|
||||
List<String> strings = this.fontRenderer.listFormattedStringToWidth(paragraph,
|
||||
GuiWizardHandbook.PAGE_WIDTH);
|
||||
|
||||
for(Object s : strings){
|
||||
if(i < linesInFirstPart){
|
||||
paragraphFirstPart = paragraphFirstPart.concat((String)s + " ");
|
||||
}else{
|
||||
paragraphLastPart = paragraphLastPart.concat((String)s + " ");
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
// System.out.println("Paragraph crosses page boundary; string split into: \"" +
|
||||
// paragraphFirstPart + "\" and \"" + paragraphLastPart + "\"");
|
||||
|
||||
page.add(paragraphFirstPart);
|
||||
|
||||
lineNumber += linesInFirstPart;
|
||||
|
||||
paragraph = paragraphLastPart;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
text.add(page);
|
||||
|
||||
}catch (IOException e){
|
||||
Wizardry.logger.error("Something went wrong reading file: " + textFilepath
|
||||
+ ". The file may be damaged; please try re-downloading and reinstalling wizardry.", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class Section {
|
||||
|
||||
/** The integer text colour used for the section when it is moused over. Currently orange. */
|
||||
private static final int HIGHLIGHT_COLOUR = 0xdd4c1d;
|
||||
|
||||
String name;
|
||||
int pageNumber;
|
||||
int x, y;
|
||||
int buttonId;
|
||||
|
||||
Section(String name, int pageNumber, int x, int y, int id){
|
||||
this.name = name;
|
||||
this.pageNumber = pageNumber;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.buttonId = id;
|
||||
GuiWizardHandbook.this.buttonList.add(new GuiButtonInvisible(id, x, y, GuiWizardHandbook.PAGE_WIDTH,
|
||||
GuiWizardHandbook.this.fontRenderer.FONT_HEIGHT));
|
||||
}
|
||||
|
||||
void hideButton(){
|
||||
GuiWizardHandbook.this.buttonList.get(buttonId).visible = false;
|
||||
}
|
||||
|
||||
void drawContents(){
|
||||
|
||||
GuiWizardHandbook.this.buttonList.get(buttonId).visible = true;
|
||||
|
||||
GuiWizardHandbook.this.fontRenderer.drawString(name, x, y,
|
||||
GuiWizardHandbook.this.buttonList.get(buttonId).isMouseOver() ? HIGHLIGHT_COLOUR : BLACK);
|
||||
|
||||
int nameWidth = GuiWizardHandbook.this.fontRenderer.getStringWidth(name);
|
||||
|
||||
String dotsAndNumber = " " + this.pageNumber;
|
||||
|
||||
while(GuiWizardHandbook.this.fontRenderer.getStringWidth(dotsAndNumber) < GuiWizardHandbook.PAGE_WIDTH
|
||||
- nameWidth - 2){
|
||||
dotsAndNumber = "." + dotsAndNumber;
|
||||
}
|
||||
|
||||
GuiWizardHandbook.this.fontRenderer.drawString(dotsAndNumber, x + GuiWizardHandbook.PAGE_WIDTH
|
||||
- GuiWizardHandbook.this.fontRenderer.getStringWidth(dotsAndNumber), y, BLACK);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGuiClosed(){
|
||||
super.onGuiClosed();
|
||||
Keyboard.enableRepeatEvents(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e).
|
||||
*/
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton par1GuiButton){
|
||||
|
||||
if(par1GuiButton.enabled){
|
||||
if(par1GuiButton.id == 0){
|
||||
if(pageNumber < (text.size() - 1) / 2) pageNumber++;
|
||||
}else if(par1GuiButton.id == 1){
|
||||
if(pageNumber > 0) pageNumber--;
|
||||
}else{
|
||||
if(pageNumber == 1) pageNumber = (sections.get(par1GuiButton.id - 2).pageNumber - 1) / 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Args: left, top, width, height, pointX, pointY. Note: left, top are local to Gui, pointX, pointY are local to
|
||||
* screen
|
||||
*/
|
||||
protected boolean isPointInRegion(int par1, int par2, int par3, int par4, int par5, int par6){
|
||||
int k1 = this.width / 2 - xSize / 2;
|
||||
int l1 = this.height / 2 - this.ySize / 2;
|
||||
par5 -= k1;
|
||||
par6 -= l1;
|
||||
return par5 >= par1 - 1 && par5 < par1 + par3 + 1 && par6 >= par2 - 1 && par6 < par2 + par4 + 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws a textured rectangle, stretching the section of the image to fit the size given.
|
||||
*
|
||||
* @param x The x position of the rectangle
|
||||
* @param y The y position of the rectangle
|
||||
* @param u The x position of the top left corner of the section of the image wanted, expressed as a fraction of the
|
||||
* image width
|
||||
* @param v The y position of the top left corner of the section of the image wanted, expressed as a fraction of the
|
||||
* image width
|
||||
* @param finalWidth The width as rendered
|
||||
* @param finalHeight The height as rendered
|
||||
* @param width The width of the section, expressed as a fraction of the image width
|
||||
* @param height The height of the section, expressed as a fraction of the image width
|
||||
*/
|
||||
public static void drawTexturedStretchedRect(int x, int y, int u, int v, int finalWidth, int finalHeight, int width,
|
||||
int height){
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
BufferBuilder buffer = tessellator.getBuffer();
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
|
||||
buffer.pos((x), y + finalHeight, 0).tex(u, v + height).endVertex();
|
||||
buffer.pos(x + finalWidth, y + finalHeight, 0).tex(u + width, v + height).endVertex();
|
||||
buffer.pos(x + finalWidth, (y), 0).tex(u + width, v).endVertex();
|
||||
buffer.pos((x), (y), 0).tex(u, v).endVertex();
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
private static NonNullList<NonNullList<ItemStack>> createGrid(){
|
||||
NonNullList<NonNullList<ItemStack>> grid = NonNullList.withSize(3, NonNullList.create());
|
||||
for(int i=0; i<3; i++){
|
||||
grid.set(i, NonNullList.withSize(3, ItemStack.EMPTY));
|
||||
}
|
||||
return grid;
|
||||
}
|
||||
|
||||
/** Called from init() in the main mod class to initialise the recipes for display in the handbook. */
|
||||
public static void initDisplayRecipes(){
|
||||
|
||||
NonNullList<NonNullList<ItemStack>> craftingGrid;
|
||||
ItemStack craftingResult;
|
||||
|
||||
craftingGrid = createGrid();
|
||||
craftingGrid.get(0).set(0, new ItemStack(Items.GOLD_NUGGET));
|
||||
craftingGrid.get(1).set(0, new ItemStack(Blocks.CARPET, 1, 10));
|
||||
craftingGrid.get(2).set(0, new ItemStack(Items.GOLD_NUGGET));
|
||||
craftingGrid.get(0).set(1, new ItemStack(WizardryItems.magic_crystal));
|
||||
craftingGrid.get(1).set(1, new ItemStack(Blocks.LAPIS_BLOCK));
|
||||
craftingGrid.get(2).set(1, new ItemStack(WizardryItems.magic_crystal));
|
||||
craftingGrid.get(0).set(2, new ItemStack(Blocks.STONE));
|
||||
craftingGrid.get(1).set(2, new ItemStack(Blocks.STONE));
|
||||
craftingGrid.get(2).set(2, new ItemStack(Blocks.STONE));
|
||||
craftingResult = new ItemStack(WizardryBlocks.arcane_workbench);
|
||||
RECIPES.add(ImmutablePair.of(craftingResult, craftingGrid));
|
||||
|
||||
craftingGrid = createGrid();
|
||||
craftingGrid.get(2).set(0, new ItemStack(WizardryItems.magic_crystal));
|
||||
craftingGrid.get(1).set(1, new ItemStack(Items.STICK));
|
||||
craftingGrid.get(0).set(2, new ItemStack(Items.GOLD_NUGGET));
|
||||
craftingResult = new ItemStack(WizardryItems.magic_wand);
|
||||
RECIPES.add(ImmutablePair.of(craftingResult, craftingGrid));
|
||||
|
||||
craftingGrid = createGrid();
|
||||
craftingGrid.get(1).set(0, new ItemStack(WizardryItems.magic_crystal));
|
||||
craftingGrid.get(0).set(1, new ItemStack(WizardryItems.magic_crystal));
|
||||
craftingGrid.get(1).set(1, new ItemStack(Items.BOOK));
|
||||
craftingGrid.get(1).set(2, new ItemStack(WizardryItems.magic_crystal));
|
||||
craftingGrid.get(2).set(1, new ItemStack(WizardryItems.magic_crystal));
|
||||
craftingResult = new ItemStack(WizardryItems.spell_book, 1, 1);
|
||||
RECIPES.add(ImmutablePair.of(craftingResult, craftingGrid));
|
||||
|
||||
craftingGrid = createGrid();
|
||||
craftingGrid.get(0).set(0, new ItemStack(Items.BOOK));
|
||||
craftingGrid.get(1).set(0, new ItemStack(WizardryItems.magic_crystal));
|
||||
craftingResult = new ItemStack(WizardryItems.wizard_handbook);
|
||||
RECIPES.add(ImmutablePair.of(craftingResult, craftingGrid));
|
||||
|
||||
craftingGrid = createGrid();
|
||||
craftingGrid.get(0).set(0, new ItemStack(WizardryBlocks.crystal_flower));
|
||||
craftingResult = new ItemStack(WizardryItems.magic_crystal, 2);
|
||||
RECIPES.add(ImmutablePair.of(craftingResult, craftingGrid));
|
||||
|
||||
craftingGrid = createGrid();
|
||||
craftingGrid.get(0).set(0, new ItemStack(WizardryItems.magic_crystal));
|
||||
craftingGrid.get(1).set(0, new ItemStack(WizardryItems.magic_crystal));
|
||||
craftingGrid.get(2).set(0, new ItemStack(WizardryItems.magic_crystal));
|
||||
craftingGrid.get(0).set(1, new ItemStack(WizardryItems.magic_crystal));
|
||||
craftingGrid.get(1).set(1, new ItemStack(Items.GLASS_BOTTLE));
|
||||
craftingGrid.get(2).set(1, new ItemStack(WizardryItems.magic_crystal));
|
||||
craftingGrid.get(0).set(2, new ItemStack(WizardryItems.magic_crystal));
|
||||
craftingGrid.get(1).set(2, new ItemStack(WizardryItems.magic_crystal));
|
||||
craftingGrid.get(2).set(2, new ItemStack(WizardryItems.magic_crystal));
|
||||
craftingResult = new ItemStack(WizardryItems.mana_flask);
|
||||
RECIPES.add(ImmutablePair.of(craftingResult, craftingGrid));
|
||||
|
||||
craftingGrid = createGrid();
|
||||
craftingGrid.get(1).set(0, new ItemStack(Blocks.STONE));
|
||||
craftingGrid.get(0).set(1, new ItemStack(Blocks.STONE));
|
||||
craftingGrid.get(1).set(1, new ItemStack(WizardryItems.magic_crystal));
|
||||
craftingGrid.get(1).set(2, new ItemStack(Blocks.STONE));
|
||||
craftingGrid.get(2).set(1, new ItemStack(Blocks.STONE));
|
||||
craftingResult = new ItemStack(WizardryBlocks.transportation_stone, 2);
|
||||
RECIPES.add(ImmutablePair.of(craftingResult, craftingGrid));
|
||||
|
||||
craftingGrid = createGrid();
|
||||
craftingGrid.get(1).set(0, new ItemStack(Items.STRING));
|
||||
craftingGrid.get(0).set(1, new ItemStack(Items.STRING));
|
||||
craftingGrid.get(1).set(1, new ItemStack(WizardryItems.magic_crystal));
|
||||
craftingGrid.get(1).set(2, new ItemStack(Items.STRING));
|
||||
craftingGrid.get(2).set(1, new ItemStack(Items.STRING));
|
||||
craftingResult = new ItemStack(WizardryItems.magic_silk, 2);
|
||||
RECIPES.add(ImmutablePair.of(craftingResult, craftingGrid));
|
||||
|
||||
craftingGrid = createGrid();
|
||||
craftingGrid.get(0).set(0, new ItemStack(WizardryItems.magic_silk));
|
||||
craftingGrid.get(1).set(0, new ItemStack(WizardryItems.magic_silk));
|
||||
craftingGrid.get(2).set(0, new ItemStack(WizardryItems.magic_silk));
|
||||
craftingGrid.get(0).set(1, new ItemStack(WizardryItems.magic_silk));
|
||||
craftingGrid.get(2).set(1, new ItemStack(WizardryItems.magic_silk));
|
||||
craftingResult = new ItemStack(WizardryItems.wizard_hat);
|
||||
RECIPES.add(ImmutablePair.of(craftingResult, craftingGrid));
|
||||
|
||||
craftingGrid = createGrid();
|
||||
craftingGrid.get(0).set(0, new ItemStack(WizardryItems.magic_silk));
|
||||
craftingGrid.get(2).set(0, new ItemStack(WizardryItems.magic_silk));
|
||||
craftingGrid.get(0).set(1, new ItemStack(WizardryItems.magic_silk));
|
||||
craftingGrid.get(1).set(1, new ItemStack(WizardryItems.magic_silk));
|
||||
craftingGrid.get(2).set(1, new ItemStack(WizardryItems.magic_silk));
|
||||
craftingGrid.get(0).set(2, new ItemStack(WizardryItems.magic_silk));
|
||||
craftingGrid.get(1).set(2, new ItemStack(WizardryItems.magic_silk));
|
||||
craftingGrid.get(2).set(2, new ItemStack(WizardryItems.magic_silk));
|
||||
craftingResult = new ItemStack(WizardryItems.wizard_robe);
|
||||
RECIPES.add(ImmutablePair.of(craftingResult, craftingGrid));
|
||||
|
||||
craftingGrid = createGrid();
|
||||
craftingGrid.get(0).set(0, new ItemStack(WizardryItems.magic_silk));
|
||||
craftingGrid.get(1).set(0, new ItemStack(WizardryItems.magic_silk));
|
||||
craftingGrid.get(2).set(0, new ItemStack(WizardryItems.magic_silk));
|
||||
craftingGrid.get(0).set(1, new ItemStack(WizardryItems.magic_silk));
|
||||
craftingGrid.get(2).set(1, new ItemStack(WizardryItems.magic_silk));
|
||||
craftingGrid.get(0).set(2, new ItemStack(WizardryItems.magic_silk));
|
||||
craftingGrid.get(2).set(2, new ItemStack(WizardryItems.magic_silk));
|
||||
craftingResult = new ItemStack(WizardryItems.wizard_leggings);
|
||||
RECIPES.add(ImmutablePair.of(craftingResult, craftingGrid));
|
||||
|
||||
craftingGrid = createGrid();
|
||||
craftingGrid.get(0).set(0, new ItemStack(WizardryItems.magic_silk));
|
||||
craftingGrid.get(2).set(0, new ItemStack(WizardryItems.magic_silk));
|
||||
craftingGrid.get(0).set(1, new ItemStack(WizardryItems.magic_silk));
|
||||
craftingGrid.get(2).set(1, new ItemStack(WizardryItems.magic_silk));
|
||||
craftingResult = new ItemStack(WizardryItems.wizard_boots);
|
||||
RECIPES.add(ImmutablePair.of(craftingResult, craftingGrid));
|
||||
|
||||
craftingGrid = createGrid();
|
||||
craftingGrid.get(0).set(0, new ItemStack(Items.PAPER));
|
||||
craftingGrid.get(1).set(0, new ItemStack(Items.STRING));
|
||||
craftingResult = new ItemStack(WizardryItems.blank_scroll);
|
||||
RECIPES.add(ImmutablePair.of(craftingResult, craftingGrid));
|
||||
|
||||
craftingGrid = createGrid();
|
||||
craftingGrid.get(0).set(0, new ItemStack(Items.BLAZE_POWDER));
|
||||
craftingGrid.get(1).set(0, new ItemStack(Items.BLAZE_POWDER));
|
||||
craftingGrid.get(0).set(1, new ItemStack(Items.GLASS_BOTTLE));
|
||||
craftingGrid.get(1).set(1, new ItemStack(Items.GUNPOWDER));
|
||||
craftingResult = new ItemStack(WizardryItems.firebomb, 3);
|
||||
RECIPES.add(ImmutablePair.of(craftingResult, craftingGrid));
|
||||
|
||||
craftingGrid = createGrid();
|
||||
craftingGrid.get(0).set(0, new ItemStack(Items.SPIDER_EYE));
|
||||
craftingGrid.get(1).set(0, new ItemStack(Items.SPIDER_EYE));
|
||||
craftingGrid.get(0).set(1, new ItemStack(Items.GLASS_BOTTLE));
|
||||
craftingGrid.get(1).set(1, new ItemStack(Items.GUNPOWDER));
|
||||
craftingResult = new ItemStack(WizardryItems.poison_bomb, 3);
|
||||
RECIPES.add(ImmutablePair.of(craftingResult, craftingGrid));
|
||||
|
||||
craftingGrid = createGrid();
|
||||
craftingGrid.get(0).set(0, new ItemStack(Items.COAL));
|
||||
craftingGrid.get(1).set(0, new ItemStack(Items.COAL));
|
||||
craftingGrid.get(0).set(1, new ItemStack(Items.GLASS_BOTTLE));
|
||||
craftingGrid.get(1).set(1, new ItemStack(Items.GUNPOWDER));
|
||||
craftingResult = new ItemStack(WizardryItems.smoke_bomb, 3);
|
||||
RECIPES.add(ImmutablePair.of(craftingResult, craftingGrid));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user