Working on the Ritual Master (with images for rituals)

Added a multi-block page for rituals
This commit is contained in:
WayofTime 2015-05-25 10:06:18 -04:00
parent 39fb9ead81
commit f553711573
48 changed files with 419 additions and 19 deletions

View file

@ -0,0 +1,145 @@
package WayofTime.alchemicalWizardry.api.guide;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import amerifrance.guideapi.api.abstraction.CategoryAbstract;
import amerifrance.guideapi.api.abstraction.EntryAbstract;
import amerifrance.guideapi.api.base.Book;
import amerifrance.guideapi.api.base.PageBase;
import amerifrance.guideapi.gui.GuiBase;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class PageMultiBlock extends PageBase
{
ItemStack[][][] structure;
boolean canTick = false;
int tick = 0;
int showLayer = -1;
float scaleFactor = 1;
boolean renderMouseOver = true;
public PageMultiBlock(ItemStack[][][] structure)
{
this.structure = structure;
initPage(structure);
}
int blockCount=0;
int[] countPerLevel;
int structureHeight = 0;
int structureLength = 0;
int structureWidth = 0;
public void initPage(ItemStack[][][] structure)
{
structureHeight = structure.length;
structureWidth=0;
structureLength=0;
countPerLevel = new int[structureHeight];
blockCount=0;
for(int h=0; h<structure.length; h++)
{
if(structure[h].length-1>structureLength)
structureLength = structure[h].length-1;
int perLvl=0;
for(int l=0; l<structure[h].length; l++)
{
if(structure[h][l].length-1>structureWidth)
structureWidth = structure[h][l].length-1;
for(ItemStack ss : structure[h][l])
if(ss!=null)
perLvl++;
}
countPerLevel[h] = perLvl;
blockCount += perLvl;
}
tick= (showLayer==-1?blockCount:countPerLevel[showLayer])*40;
int yOff = (structureHeight-1)*12+structureWidth*5+structureLength*5+16;
// pageButtons.add(new GuiButtonManualNavigation(gui, 100, x+4,y+yOff/2-5, 10,10, 4));
// pageButtons.add(new GuiButtonManualNavigation(gui, 101, x+4,y+yOff/2-8-16, 10,16, 3));
// pageButtons.add(new GuiButtonManualNavigation(gui, 102, x+4,y+yOff/2+8, 10,16, 2));
}
@Override
@SideOnly(Side.CLIENT)
public void draw(Book book, CategoryAbstract category, EntryAbstract entry, int guiLeft, int guiTop, int mouseX, int mouseY, GuiBase guiBase, FontRenderer fontRenderer)
{
// if(multiblock.getStructureManual()!=null)
Minecraft mc = Minecraft.getMinecraft();
int x = guiLeft + 32;
int y = guiTop + 30;
{
if(canTick)
tick++;
int prevLayers = 0;
if(showLayer!=-1)
for(int ll=0; ll<showLayer; ll++)
prevLayers+=countPerLevel[ll];
int limiter = prevLayers+ (tick/40)% ((showLayer==-1?blockCount:countPerLevel[showLayer])+4);
int xHalf = (structureWidth*5 - structureLength*5);
int yOffPartial = (structureHeight-1)*12+structureWidth*5+structureLength*5;
int yOffTotal = yOffPartial+16;
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glPushMatrix();
GL11.glTranslatef((1-scaleFactor)*(guiLeft + 64), (1-scaleFactor)*(guiTop+60), 0);
GL11.glScalef(scaleFactor, scaleFactor, scaleFactor);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderHelper.enableGUIStandardItemLighting();
RenderItem.getInstance().renderWithColor=true;
int i=0;
ItemStack highlighted = null;
for(int h=0; h<structure.length; h++)
if(showLayer==-1 || h<=showLayer)
{
ItemStack[][] level = structure[h];
for(int l=level.length-1; l>=0; l--)
{
ItemStack[] row = level[l];
for(int w=row.length-1; w>=0; w--)
{
int xx = 60 +xHalf -10*w +10*l -7;
int yy = yOffPartial - 5*w - 5*l -12*h;
GL11.glTranslated(0, 0, 1);
if(row[w]!=null && i<=limiter)
{
i++;
RenderItem.getInstance().renderItemIntoGUI(mc.fontRenderer, mc.renderEngine, row[w], x+xx, y+yy);
if(mouseX>=x+xx&&mouseX<x+xx+16 && mouseY>=y+yy&&mouseY<y+yy+16)
highlighted = row[w];
}
}
}
}
GL11.glTranslated(0, 0, -i);
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_DEPTH_TEST);
mc.fontRenderer.setUnicodeFlag(false);
if(highlighted!=null && renderMouseOver)
guiBase.renderToolTip(highlighted, mouseX, mouseY);
RenderHelper.disableStandardItemLighting();
// mc.fontRenderer.setUnicodeFlag(true);
// if(localizedText!=null&&!localizedText.isEmpty())
// manual.fontRenderer.drawSplitString(localizedText, x,y+yOffTotal, 120, manual.getTextColour());
}
}
}

View file

@ -0,0 +1,94 @@
package WayofTime.alchemicalWizardry.api.guide;
import java.util.List;
import net.minecraft.item.ItemStack;
import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.Rituals;
public class PageRitualMultiBlock extends PageMultiBlock
{
private static ItemStack blankStone;
private static ItemStack waterStone;
private static ItemStack fireStone;
private static ItemStack earthStone;
private static ItemStack airStone;
private static ItemStack duskStone;
private static ItemStack dawnStone;
static
{
blankStone = new ItemStack(ModBlocks.ritualStone, 1, RitualComponent.BLANK);
waterStone = new ItemStack(ModBlocks.ritualStone, 1, RitualComponent.WATER);
fireStone = new ItemStack(ModBlocks.ritualStone, 1, RitualComponent.FIRE);
earthStone = new ItemStack(ModBlocks.ritualStone, 1, RitualComponent.EARTH);
airStone = new ItemStack(ModBlocks.ritualStone, 1, RitualComponent.AIR);
duskStone = new ItemStack(ModBlocks.ritualStone, 1, RitualComponent.DUSK);
dawnStone = new ItemStack(ModBlocks.ritualStone, 1, RitualComponent.DAWN);
}
private PageRitualMultiBlock(ItemStack[][][] structure)
{
super(structure);
}
public static PageRitualMultiBlock getPageForRitual(String ritualID)
{
return getPageForRitual(Rituals.getRitualList(ritualID));
}
public static PageRitualMultiBlock getPageForRitual(List<RitualComponent> ritualComponents)
{
int minX = 0;
int minY = 0;
int minZ = 0;
int maxX = 0;
int maxY = 0;
int maxZ = 0;
for(RitualComponent comp : ritualComponents)
{
minX = Math.min(comp.getX(), minX);
minY = Math.min(comp.getY(), minY);
minZ = Math.min(comp.getZ(), minZ);
maxX = Math.max(comp.getX(), maxX);
maxY = Math.max(comp.getY(), maxY);
maxZ = Math.max(comp.getZ(), maxZ);
}
ItemStack[][][] tempStructure = new ItemStack[maxY-minY+1][maxX-minX+1][maxZ-minZ+1]; //First value is vertical, second is down to the left, third is down to the right
for(RitualComponent comp : ritualComponents)
{
tempStructure[comp.getY() - minY][comp.getX() - minX][comp.getZ() - minZ] = new ItemStack(ModBlocks.ritualStone, 1, comp.getStoneType());
}
tempStructure[-minY][-minX][-minZ] = new ItemStack(ModBlocks.blockMasterStone);
return new PageRitualMultiBlock(tempStructure);
}
private static ItemStack getStackForRitualStone(int type)
{
switch(type)
{
case RitualComponent.BLANK:
return blankStone;
case RitualComponent.WATER:
return waterStone;
case RitualComponent.FIRE:
return fireStone;
case RitualComponent.EARTH:
return earthStone;
case RitualComponent.AIR:
return airStone;
case RitualComponent.DUSK:
return duskStone;
case RitualComponent.DAWN:
return dawnStone;
}
return blankStone;
}
}

View file

@ -1,14 +1,13 @@
package WayofTime.alchemicalWizardry.client;
import WayofTime.alchemicalWizardry.client.renderer.RitualDivinerRender;
import net.minecraft.item.ItemBlock;
import net.minecraft.world.World;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.common.MinecraftForge;
import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.api.spell.EntitySpellProjectile;
import WayofTime.alchemicalWizardry.client.renderer.RitualDivinerRender;
import WayofTime.alchemicalWizardry.common.CommonProxy;
import WayofTime.alchemicalWizardry.common.book.BUEntries;
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGrunt;
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntEarth;
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntFire;
@ -110,7 +109,7 @@ public class ClientProxy extends CommonProxy
@Override
public void registerPostSideObjects()
{
BUEntries entries = new BUEntries();
// BUEntries entries = new BUEntries();
// entries.postInit();
}

View file

@ -8,9 +8,11 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.ModItems;
import WayofTime.alchemicalWizardry.api.guide.PageAltarRecipe;
import WayofTime.alchemicalWizardry.api.guide.PageOrbRecipe;
import WayofTime.alchemicalWizardry.api.guide.PageRitualMultiBlock;
import WayofTime.alchemicalWizardry.common.guide.RecipeHolder;
import amerifrance.guideapi.api.GuideRegistry;
import amerifrance.guideapi.api.abstraction.CategoryAbstract;
@ -31,6 +33,8 @@ public class BloodMagicGuide
public static void registerGuide()
{
registerArchitectBook();
registerRitualBook();
bloodMagicGuide = new Book(categories, "guide.BloodMagic.book.title", "guide.BloodMagic.welcomeMessage", "guide.BloodMagic.book.name", new Color(190, 10, 0));
GuideRegistry.registerBook(bloodMagicGuide);
}
@ -337,4 +341,42 @@ public class BloodMagicGuide
categories.add(new CategoryItemStack(entries, "guide.BloodMagic.category.architect", new ItemStack(ModItems.divinationSigil)));
}
public static void registerRitualBook()
{
List<EntryAbstract> entries = new ArrayList();
ArrayList<IPage> testPages = new ArrayList();
testPages.add(PageRitualMultiBlock.getPageForRitual("AW031Convocation"));
entries.add(new EntryUniText(testPages, "Test page"));
ArrayList<IPage> introPages = new ArrayList();
introPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.intro")));
entries.add(new EntryUniText(introPages, "guide.BloodMagic.entryName.rituals.intro"));
ArrayList<IPage> weakRitualPages = new ArrayList();
weakRitualPages.add(new PageOrbRecipe(RecipeHolder.weakRitualStoneRecipe));
weakRitualPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.weakRitual")));
entries.add(new EntryUniText(weakRitualPages, "guide.BloodMagic.entryName.rituals.weakRitual"));
ArrayList<IPage> ritualsPages = new ArrayList();
ritualsPages.add(new PageOrbRecipe(RecipeHolder.ritualStoneRecipe));
ritualsPages.add(new PageOrbRecipe(RecipeHolder.masterStoneRecipe));
ritualsPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.rituals")));
ritualsPages.add(new PageAltarRecipe(RecipeHolder.weakActivationRecipe));
entries.add(new EntryUniText(ritualsPages, "guide.BloodMagic.entryName.rituals.rituals"));
ArrayList<IPage> waterRitualPages = new ArrayList();
waterRitualPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/Water.png"), true));
waterRitualPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.waterRitual")));
entries.add(new EntryUniText(waterRitualPages, "guide.BloodMagic.entryName.rituals.waterRitual"));
ArrayList<IPage> lavaRitualPages = new ArrayList();
lavaRitualPages.add(new PageUnlocImage("", new ResourceLocation("alchemicalwizardry:textures/misc/screenshots/rituals/lava.png"), true));
lavaRitualPages.addAll(PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.rituals.lavaRitual")));
entries.add(new EntryUniText(lavaRitualPages, "guide.BloodMagic.entryName.rituals.lavaRitual"));
categories.add(new CategoryItemStack(entries, "guide.BloodMagic.category.rituals", new ItemStack(ModBlocks.blockMasterStone)));
}
}

View file

@ -36,6 +36,7 @@ public class RecipeHolder
public static IRecipe phantomBridgeRecipe;
public static IRecipe holdingSigilRecipe;
public static IRecipe affinitySigilRecipe;
public static IRecipe weakRitualStoneRecipe;
public static IRecipe ritualStoneRecipe;
public static IRecipe masterStoneRecipe;
public static IRecipe bloodLampRecipe;
@ -125,6 +126,7 @@ public class RecipeHolder
accelerationRuneRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.bloodRune, 1, 5));
harvestSigilRecipe = getRecipeForItemStack(new ItemStack(ModItems.itemHarvestSigil));
crystalCluserRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.blockCrystal));
weakRitualStoneRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.imperfectRitualStone));
weakBloodOrbRecipe = getAltarRecipeForItemStack(new ItemStack(ModItems.weakBloodOrb));
apprenticeBloodOrbRecipe = getAltarRecipeForItemStack(new ItemStack(ModItems.apprenticeBloodOrb));

View file

@ -1,15 +1,10 @@
package WayofTime.alchemicalWizardry.common.items.sigil.holding;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModItems;
import WayofTime.alchemicalWizardry.api.items.interfaces.IHolding;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
@ -17,10 +12,10 @@ import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.util.Constants;
import java.util.ArrayList;
import java.util.List;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class SigilOfHolding extends EnergyItems
{

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 189 KiB

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 KiB

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

File diff suppressed because one or more lines are too long