This commit is contained in:
Vasco Lavos committed 2015-10-25 00:02:45 +01:00
1 parent 73377e311d
commit a6729c088b
53 files changed
+259 -289

No files matched your search

@@ -23,10 +23,10 @@ public interface IAvatarTile extends IInventory, IManaReceiver {
* (has redstone signal).
*/
public int getElapsedFunctionalTicks();
/**
* Gets if this avatar is enabled (isn't powered by a redstone signal).
*/
public boolean isEnabled();
}
@@ -22,10 +22,10 @@ public interface IAvatarWieldable {
* Called on update of the avatar tile.
*/
public void onAvatarUpdate(IAvatarTile tile, ItemStack stack);
/**
* Gets the overlay resource to render on top of the avatar tile.
*/
public ResourceLocation getOverlayResource(IAvatarTile tile, ItemStack stack);
}
@@ -23,7 +23,7 @@ public interface IHornHarvestable {
* Note that the stack param can be null if it's a drum breaking it.
*/
public boolean canHornHarvest(World world, int x, int y, int z, ItemStack stack, EnumHornType hornType);
/**
* Returns true if harvestByHorn() should be called. If false it just uses the normal
* block breaking method.
@@ -36,29 +36,29 @@ public interface IHornHarvestable {
* Note that the stack param can be null if it's a drum breaking it.
*/
public void harvestByHorn(World world, int x, int y, int z, ItemStack stack, EnumHornType hornType);
public static enum EnumHornType {
/**
* Horn of the Wild, for grass and crops
*/
WILD,
/**
* Horn of the Canopy, for leaves
*/
CANOPY,
/**
* Horn of the Covering, for snow
*/
COVERING;
public static EnumHornType getTypeForMeta(int meta) {
EnumHornType[] values = EnumHornType.values();
return values[Math.min(values.length - 1, meta)];
}
};
}
@@ -127,22 +127,22 @@ public class LexiconEntry implements Comparable<LexiconEntry> {
ArrayList<ItemStack> list = new ArrayList();
for(LexiconPage page : pages) {
List<ItemStack> l = page.getDisplayedRecipes();
if(l != null) {
ArrayList<ItemStack> itemsAddedThisPage = new ArrayList();
for(ItemStack s : l) {
addItem: {
for(ItemStack s1 : itemsAddedThisPage)
if(s1.getItem() == s.getItem())
break addItem;
for(ItemStack s1 : list)
if(s1.isItemEqual(s) && ItemStack.areItemStackTagsEqual(s1, s))
break addItem;
itemsAddedThisPage.add(s);
list.add(s);
}
for(ItemStack s1 : itemsAddedThisPage)
if(s1.getItem() == s.getItem())
break addItem;
for(ItemStack s1 : list)
if(s1.isItemEqual(s) && ItemStack.areItemStackTagsEqual(s1, s))
break addItem;
itemsAddedThisPage.add(s);
list.add(s);
}
}
}
}
@@ -10,7 +10,6 @@
*/
package vazkii.botania.api.lexicon;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.gui.GuiButton;
@@ -94,7 +93,7 @@ public abstract class LexiconPage {
public void onPageAdded(LexiconEntry entry, int index) {
// NO-OP
}
/**
* Shows the list of recipes present in this page for display in the category
* page. Can return null for an entry with no recipes.
@@ -13,8 +13,8 @@ package vazkii.botania.api.lexicon;
import java.util.HashMap;
import java.util.Map;
import vazkii.botania.api.mana.IManaItem;
import net.minecraft.item.ItemStack;
import vazkii.botania.api.mana.IManaItem;
/**
* This class contains mappings for which entry and page correspond to each
@@ -54,13 +54,13 @@ public final class LexiconRecipeMappings {
if(stack.hasTagCompound() && stack.getItem() instanceof IRecipeKeyProvider)
return ((IRecipeKeyProvider) stack.getItem()).getKey(stack);
return stack.getUnlocalizedName() + (ignoreMeta(stack) ? "" : ("~" + stack.getItemDamage()));
return stack.getUnlocalizedName() + (ignoreMeta(stack) ? "" : "~" + stack.getItemDamage());
}
public static boolean ignoreMeta(ItemStack stack) {
return stack.isItemStackDamageable() || stack.getItem() instanceof IManaItem;
return stack.isItemStackDamageable() || stack.getItem() instanceof IManaItem;
}
public static class EntryData {
public final LexiconEntry entry;
@@ -22,5 +22,5 @@ public interface IManaTooltipDisplay {
* Returns the fraction of mana in this item for display. From 0 to 1 (exclusive).
*/
public float getManaFractionForDisplay(ItemStack stack);
}
@@ -1,3 +1,4 @@
@API(owner = "Botania", apiVersion = "66", provides = "BotaniaAPI")
package vazkii.botania.api;
import cpw.mods.fml.common.API;
@@ -38,7 +38,7 @@ public class ClientTickHandler {
public static int ticksInGame = 0;
public static float partialTicks = 0;
public static float delta = 0;
@SubscribeEvent
public void renderTick(RenderTickEvent event) {
if(event.phase == Phase.START) {
@@ -10,10 +10,7 @@
*/
package vazkii.botania.client.core.handler;
import ibxm.Player;
import java.awt.Color;
import java.util.Arrays;
import java.util.List;
import net.minecraft.client.Minecraft;
@@ -23,6 +20,7 @@ import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
@@ -35,7 +33,6 @@ import vazkii.botania.api.lexicon.ILexicon;
import vazkii.botania.api.lexicon.LexiconRecipeMappings;
import vazkii.botania.api.lexicon.LexiconRecipeMappings.EntryData;
import vazkii.botania.api.mana.IManaTooltipDisplay;
import vazkii.botania.client.core.helper.RenderHelper;
import vazkii.botania.common.Botania;
import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.item.ItemLexicon;
@@ -47,7 +44,7 @@ import cpw.mods.fml.relauncher.ReflectionHelper;
public final class TooltipAdditionDisplayHandler {
private static float lexiconLookupTime = 0F;
public static void render() {
Minecraft mc = Minecraft.getMinecraft();
GuiScreen gui = mc.currentScreen;
@@ -79,18 +76,18 @@ public final class TooltipAdditionDisplayHandler {
offy -= fixY;
if(offscreen)
offx = -13 - width;
if(stack.getItem() instanceof ItemTerraPick)
drawTerraPick(stack, mouseX, mouseY, offx, offy, width, height, font);
else if(stack.getItem() instanceof IManaTooltipDisplay)
drawManaBar(stack, (IManaTooltipDisplay) stack.getItem(), mouseX, mouseY, offx, offy, width, height);
EntryData data = LexiconRecipeMappings.getDataForStack(stack);
if(data != null) {
int lexSlot = -1;
ItemStack lexiconStack = null;
for(int i = 0; i < mc.thePlayer.inventory.getHotbarSize(); i++) {
for(int i = 0; i < InventoryPlayer.getHotbarSize(); i++) {
ItemStack stackAt = mc.thePlayer.inventory.getStackInSlot(i);
if(stackAt != null && stackAt.getItem() instanceof ILexicon && ((ILexicon) stackAt.getItem()).isKnowledgeUnlocked(stackAt, data.entry.getKnowledgeType())) {
lexiconStack = stackAt;
@@ -98,7 +95,7 @@ public final class TooltipAdditionDisplayHandler {
break;
}
}
if(lexSlot > -1) {
int x = mouseX + offx - 34;
int y = mouseY - offy;
@@ -106,10 +103,10 @@ public final class TooltipAdditionDisplayHandler {
Gui.drawRect(x - 4, y - 4, x + 20, y + 26, 0x44000000);
Gui.drawRect(x - 6, y - 6, x + 22, y + 28, 0x44000000);
if(ConfigHandler.useShiftForQuickLookup ? GuiScreen.isShiftKeyDown() : GuiScreen.isCtrlKeyDown()) {
lexiconLookupTime += ClientTickHandler.delta;
int cx = x + 8;
int cy = y + 8;
float r = 12;
@@ -122,32 +119,32 @@ public final class TooltipAdditionDisplayHandler {
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glBegin(GL11.GL_TRIANGLE_FAN);
float a = 0.5F + 0.2F * ((float) Math.cos((double) (ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) / 10) * 0.5F + 0.5F);
GL11.glColor4f(0F, 0.5F, 0F, a);
GL11.glVertex2i(cx, cy);
GL11.glColor4f(0F, 1F, 0F, 1F);
for(float i = angles; i > 0; i--) {
double rad = (i - 90) / 180F * Math.PI;
GL11.glVertex2d(cx + Math.cos(rad) * r, cy + Math.sin(rad) * r);
}
GL11.glVertex2i(cx, cy);
GL11.glEnd();
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glShadeModel(GL11.GL_FLAT);
if(lexiconLookupTime >= time) {
mc.thePlayer.inventory.currentItem = lexSlot;
Botania.proxy.setEntryToOpen(data.entry);
Botania.proxy.setLexiconStack(lexiconStack);
ItemLexicon.openBook(mc.thePlayer, lexiconStack, mc.theWorld, false);
}
} else lexiconLookupTime = 0F;
RenderItem.getInstance().renderItemIntoGUI(mc.fontRenderer, mc.renderEngine, new ItemStack(ModItems.lexicon), x, y);
GL11.glDisable(GL11.GL_LIGHTING);
@@ -163,7 +160,7 @@ public final class TooltipAdditionDisplayHandler {
} else lexiconLookupTime = 0F;
} else lexiconLookupTime = 0F;
}
private static void drawTerraPick(ItemStack stack, int mouseX, int mouseY, int offx, int offy, int width, int height, FontRenderer font) {
int level = ItemTerraPick.getLevel(stack);
int max = ItemTerraPick.LEVELS[Math.min(ItemTerraPick.LEVELS.length - 1, level + 1)];
@@ -192,11 +189,11 @@ public final class TooltipAdditionDisplayHandler {
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
}
private static void drawManaBar(ItemStack stack, IManaTooltipDisplay display, int mouseX, int mouseY, int offx, int offy, int width, int height) {
float fraction = display.getManaFractionForDisplay(stack);
int manaBarWidth = (int) Math.ceil(((float) width * fraction));
int manaBarWidth = (int) Math.ceil(width * fraction);
GL11.glDisable(GL11.GL_DEPTH_TEST);
Gui.drawRect(mouseX + offx - 1, mouseY - offy - height - 1, mouseX + offx + width + 1, mouseY - offy, 0xFF000000);
Gui.drawRect(mouseX + offx, mouseY - offy - height, mouseX + offx + manaBarWidth, mouseY - offy, Color.HSBtoRGB(0.528F, ((float) Math.sin((ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) * 0.2) + 1F) * 0.3F + 0.4F, 1F));
@@ -82,7 +82,6 @@ public class GuiLexicon extends GuiScreen {
public static Queue<LexiconEntry> tutorial = new ArrayDeque();
private static boolean checkedDoot = false;
public static final ResourceLocation texture = new ResourceLocation(LibResources.GUI_LEXICON);
public static final ResourceLocation textureToff = new ResourceLocation(LibResources.GUI_TOFF);
@@ -112,7 +111,7 @@ public class GuiLexicon extends GuiScreen {
@Override
public final void initGui() {
super.initGui();
if(PersistentVariableHelper.firstLoad) {
PersistentVariableHelper.firstLoad = false;
PersistentVariableHelper.saveSafe();
@@ -169,7 +168,7 @@ public class GuiLexicon extends GuiScreen {
GuiButtonUpdateWarning button = new GuiButtonUpdateWarning(-4, left - 6, top + guiHeight - 70);
buttonList.add(button);
if(PersistentVariableHelper.lastBotaniaVersion.equals(LibMisc.VERSION)) {
button.enabled = false;
button.visible = false;
@@ -292,7 +291,7 @@ public class GuiLexicon extends GuiScreen {
public void drawBookmark(int x, int y, String s, boolean drawLeft) {
drawBookmark(x, y, s, drawLeft, 0x111111);
}
public void drawBookmark(int x, int y, String s, boolean drawLeft, int color) {
// This function is called from the buttons so I can't use fontRendererObj
FontRenderer font = Minecraft.getMinecraft().fontRenderer;
@@ -324,19 +323,19 @@ public class GuiLexicon extends GuiScreen {
GL11.glColor4f(1F, 1F, 1F, 1F);
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
drawTexturedModalRect(left - 8, top + 9, 0, 224, 140, 31);
int color = 0xffd200;
boolean unicode = fontRendererObj.getUnicodeFlag();
fontRendererObj.drawString(title, left + 18, top + 13, color);
fontRendererObj.setUnicodeFlag(true);
fontRendererObj.drawString(String.format(StatCollector.translateToLocal("botaniamisc.edition"), ItemLexicon.getEdition()), left + 24, top + 22, color);
String s = EnumChatFormatting.BOLD + categoryHighlight;
fontRendererObj.drawString(s, left + guiWidth / 2 - fontRendererObj.getStringWidth(s) / 2, top + 36, 0);
fontRendererObj.setUnicodeFlag(unicode);
GL11.glPopMatrix();
categoryHighlight = "";
}
@@ -51,11 +51,11 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
GuiButton leftButton, rightButton, backButton;
GuiLexicon parent;
GuiTextField searchField;
GuiButton currentButton;
LexiconEntry currentEntry;
float infoTime;
List<LexiconEntry> entriesToDisplay = new ArrayList();
public GuiLexiconIndex() {
@@ -146,7 +146,7 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
} else button.displayString = "";
}
}
public void setHoveredButton(GuiButtonInvisible b) {
if(b == null)
currentEntry = null;
@@ -170,38 +170,38 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
mc.fontRenderer.drawString(s, left + 120 - mc.fontRenderer.getStringWidth(s), top + guiHeight - 18, 0x666666);
mc.fontRenderer.setUnicodeFlag(unicode);
}
float animationTime = 4F;
if(isShiftKeyDown()) {
if(currentButton != null)
infoTime = Math.min(animationTime, infoTime + timeDelta);
} else {
infoTime = Math.max(0, infoTime - timeDelta);
if(currentButton != null && infoTime == 0) {
int x = par1 + 10;
int y = par2;
x = currentButton.xPosition - 20;
y = currentButton.yPosition;
mc.fontRenderer.drawStringWithShadow("?", x, y, 0xFFFFFF);
GL11.glScalef(0.5F, 0.5F, 1F);
mc.fontRenderer.drawStringWithShadow(EnumChatFormatting.BOLD + "Shift", x * 2 - 6, y * 2 + 20, 0xFFFFFF);
GL11.glScalef(2F, 2F, 1F);
}
}
if(currentButton != null && infoTime > 0) {
float fract = infoTime / animationTime;
int x = currentButton.xPosition;
int y = currentButton.yPosition;
String s = StatCollector.translateToLocal(currentEntry.getTagline());
boolean unicode = mc.fontRenderer.getUnicodeFlag();
mc.fontRenderer.setUnicodeFlag(true);
int width = mc.fontRenderer.getStringWidth(s);
GL11.glPushMatrix();
GL11.glTranslatef(x, y, 0);
GL11.glScalef(fract, 1F, 1F);
@@ -209,15 +209,15 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
Gui.drawRect(10, -32, width + 22, -2, 0x44000000);
drawBookmark(width / 2 + 16, -8, s, true, 0xFFFFFF);
mc.fontRenderer.setUnicodeFlag(unicode);
net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
ItemStack paper = new ItemStack(Items.paper, currentEntry.pages.size());
RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, paper, 14, -28);
RenderItem.getInstance().renderItemOverlayIntoGUI(mc.fontRenderer, mc.renderEngine, paper, 14, -28);
List<ItemStack> stacks = currentEntry.getDisplayedRecipes();
if(stacks.size() > 0) {
int spaceForEach = Math.min(18, (width - 30) / stacks.size());
for(int i = 0; i < stacks.size(); i++) {
@@ -225,12 +225,12 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, stack, 38 + spaceForEach * i, -28);
}
}
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
GL11.glPopMatrix();
}
setHoveredButton(null);
}
@@ -10,27 +10,18 @@
*/
package vazkii.botania.client.gui.lexicon.button;
import java.util.Arrays;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.texture.ITextureObject;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraftforge.client.MinecraftForgeClient;
import org.lwjgl.opengl.ARBMultitexture;
import org.lwjgl.opengl.ARBShaderObjects;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL13;
import org.lwjgl.opengl.GL20;
import com.sun.prism.ps.Shader;
import vazkii.botania.api.internal.ShaderCallback;
import vazkii.botania.api.lexicon.LexiconCategory;
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.client.core.helper.RenderHelper;
import vazkii.botania.client.core.helper.ShaderHelper;
import vazkii.botania.client.gui.lexicon.GuiLexicon;
@@ -96,8 +87,6 @@ public class GuiButtonCategory extends GuiButtonLexicon {
float s = 1F / 32F;
float defAlpha = 0F;
float alpha = ticksHovered / time * (1F - defAlpha) + defAlpha;
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
@@ -40,8 +40,8 @@ public class GuiButtonInvisible extends GuiButtonLexicon {
field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
int k = getHoverState(field_146123_n);
boolean showStack = displayStack != null && !displayString.isEmpty();
if(!displayString.isEmpty() && k == 2) {
if(!displayString.isEmpty() && k == 2) {
timeHover = Math.min(5, timeHover + gui.timeDelta);
gui.setHoveredButton(this);
} else timeHover = Math.max(0, timeHover - gui.timeDelta);
@@ -148,5 +148,5 @@ public final class LibResources {
public static final String SHADER_FILM_GRAIN_FRAG = PREFIX_SHADER + "film_grain.frag";
public static final String SHADER_GOLD_FRAG = PREFIX_SHADER + "gold.frag";
public static final String SHADER_CATEGORY_BUTTON_FRAG = PREFIX_SHADER + "category_button.frag";
}
@@ -12,58 +12,57 @@ package vazkii.botania.client.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
public class ModelAvatar extends ModelBase {
public ModelRenderer body;
public ModelRenderer rightarm;
public ModelRenderer leftarm;
public ModelRenderer rightleg;
public ModelRenderer leftleg;
public ModelRenderer head;
public ModelAvatar() {
this.textureWidth = 32;
this.textureHeight = 32;
this.leftleg = new ModelRenderer(this, 0, 20);
this.leftleg.mirror = true;
this.leftleg.setRotationPoint(1.5F, 18.0F, -0.5F);
this.leftleg.addBox(-1.5F, 0.0F, -1.5F, 3, 6, 3, 0.0F);
this.rightarm = new ModelRenderer(this, 0, 20);
this.rightarm.setRotationPoint(-3.0F, 15.0F, -1.0F);
this.rightarm.addBox(-2.0F, -1.0F, -1.0F, 2, 6, 3, 0.0F);
this.setRotateAngle(rightarm, 0.0F, -0.0F, 0.08726646259971647F);
this.leftarm = new ModelRenderer(this, 0, 20);
this.leftarm.mirror = true;
this.leftarm.setRotationPoint(3.0F, 15.0F, -1.0F);
this.leftarm.addBox(0.0F, -1.0F, -1.0F, 2, 6, 3, 0.0F);
this.setRotateAngle(leftarm, 0.0F, -0.0F, -0.08726646259971647F);
this.head = new ModelRenderer(this, 0, 0);
this.head.setRotationPoint(0.0F, 14.0F, 0.0F);
this.head.addBox(-3.0F, -6.0F, -3.0F, 6, 6, 6, 0.0F);
this.rightleg = new ModelRenderer(this, 0, 20);
this.rightleg.setRotationPoint(-1.5F, 18.0F, -0.5F);
this.rightleg.addBox(-1.5F, 0.0F, -1.5F, 3, 6, 3, 0.0F);
this.body = new ModelRenderer(this, 0, 12);
this.body.setRotationPoint(0.0F, 14.0F, 0.0F);
this.body.addBox(-3.0F, 0.0F, -2.0F, 6, 4, 4, 0.0F);
}
public ModelRenderer body;
public ModelRenderer rightarm;
public ModelRenderer leftarm;
public ModelRenderer rightleg;
public ModelRenderer leftleg;
public ModelRenderer head;
public void render() {
float f5 = 1F / 15F;
this.leftleg.render(f5);
this.rightarm.render(f5);
this.leftarm.render(f5);
this.head.render(f5);
this.rightleg.render(f5);
this.body.render(f5);
}
public ModelAvatar() {
textureWidth = 32;
textureHeight = 32;
leftleg = new ModelRenderer(this, 0, 20);
leftleg.mirror = true;
leftleg.setRotationPoint(1.5F, 18.0F, -0.5F);
leftleg.addBox(-1.5F, 0.0F, -1.5F, 3, 6, 3, 0.0F);
rightarm = new ModelRenderer(this, 0, 20);
rightarm.setRotationPoint(-3.0F, 15.0F, -1.0F);
rightarm.addBox(-2.0F, -1.0F, -1.0F, 2, 6, 3, 0.0F);
setRotateAngle(rightarm, 0.0F, -0.0F, 0.08726646259971647F);
leftarm = new ModelRenderer(this, 0, 20);
leftarm.mirror = true;
leftarm.setRotationPoint(3.0F, 15.0F, -1.0F);
leftarm.addBox(0.0F, -1.0F, -1.0F, 2, 6, 3, 0.0F);
setRotateAngle(leftarm, 0.0F, -0.0F, -0.08726646259971647F);
head = new ModelRenderer(this, 0, 0);
head.setRotationPoint(0.0F, 14.0F, 0.0F);
head.addBox(-3.0F, -6.0F, -3.0F, 6, 6, 6, 0.0F);
rightleg = new ModelRenderer(this, 0, 20);
rightleg.setRotationPoint(-1.5F, 18.0F, -0.5F);
rightleg.addBox(-1.5F, 0.0F, -1.5F, 3, 6, 3, 0.0F);
body = new ModelRenderer(this, 0, 12);
body.setRotationPoint(0.0F, 14.0F, 0.0F);
body.addBox(-3.0F, 0.0F, -2.0F, 6, 4, 4, 0.0F);
}
public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) {
modelRenderer.rotateAngleX = x;
modelRenderer.rotateAngleY = y;
modelRenderer.rotateAngleZ = z;
}
public void render() {
float f5 = 1F / 15F;
leftleg.render(f5);
rightarm.render(f5);
leftarm.render(f5);
head.render(f5);
rightleg.render(f5);
body.render(f5);
}
public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) {
modelRenderer.rotateAngleX = x;
modelRenderer.rotateAngleY = y;
modelRenderer.rotateAngleZ = z;
}
}
@@ -22,7 +22,6 @@ import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.client.core.proxy.ClientProxy;
import vazkii.botania.client.gui.lexicon.GuiLexicon;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.item.ItemLexicon;
@@ -12,7 +12,6 @@ package vazkii.botania.client.render.tile;
import java.awt.Color;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.OpenGlHelper;
@@ -32,8 +31,6 @@ import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.client.model.ModelAvatar;
import vazkii.botania.common.block.tile.TileAvatar;
import vazkii.botania.common.block.tile.TileSparkChanger;
import vazkii.botania.common.core.handler.ConfigHandler;
public class RenderTileAvatar extends TileEntitySpecialRenderer {
@@ -47,7 +44,7 @@ public class RenderTileAvatar extends TileEntitySpecialRenderer {
@Override
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float pticks) {
TileAvatar avatar = (TileAvatar) tileentity;
GL11.glPushMatrix();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glColor4f(1F, 1F, 1F, 1F);
@@ -60,7 +57,7 @@ public class RenderTileAvatar extends TileEntitySpecialRenderer {
GL11.glScalef(1F, -1F, -1F);
GL11.glRotatef(ROTATIONS[Math.max(Math.min(ROTATIONS.length - 1, meta - 2), 0)], 0F, 1F, 0F);
model.render();
ItemStack stack = avatar.getStackInSlot(0);
if(stack != null) {
GL11.glPushMatrix();
@@ -88,16 +85,16 @@ public class RenderTileAvatar extends TileEntitySpecialRenderer {
renderPass++;
} while(renderPass < stack.getItem().getRenderPasses(stack.getItemDamage()));
GL11.glPopMatrix();
IAvatarWieldable wieldable = (IAvatarWieldable) stack.getItem();
Minecraft.getMinecraft().renderEngine.bindTexture(wieldable.getOverlayResource(avatar, stack));
s = 1.01F;
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glScalef(s, s, s);
GL11.glTranslatef(0F, -0.01F, 0F);
GL11.glTranslatef(0F, -0.01F, 0F);
int light = 15728880;
int lightmapX = light % 65536;
int lightmapY = light / 65536;
@@ -70,7 +70,7 @@ public class RenderTileEnchanter extends TileEntitySpecialRenderer {
GL11.glColor4f(1F, 1F, 1F, 1F);
GL11.glDisable(GL11.GL_ALPHA_TEST);
float alpha = (float) ((Math.sin((ClientTickHandler.ticksInGame + f) / 8D) + 1D) / 5D + 0.4D) * alphaMod;
if(alpha > 0) {
if(ShaderHelper.useShaders())
GL11.glColor4f(1F, 1F, 1F, alpha);
@@ -43,7 +43,7 @@ public class RenderTileSpreader extends TileEntitySpecialRenderer {
private static final ResourceLocation textureHalloween = new ResourceLocation(LibResources.MODEL_SPREADER_HALLOWEEN);
private static final ResourceLocation textureRsHalloween = new ResourceLocation(LibResources.MODEL_SPREADER_REDSTONE_HALLOWEEN);
private static final ResourceLocation textureDwHalloween = new ResourceLocation(LibResources.MODEL_SPREADER_DREAMWOOD_HALLOWEEN);
private static final ModelSpreader model = new ModelSpreader();
@Override
@@ -63,7 +63,7 @@ public class RenderTileSpreader extends TileEntitySpecialRenderer {
ResourceLocation r = spreader.isRedstone() ? textureRs : spreader.isDreamwood() ? textureDw : texture;
if(ClientProxy.dootDoot)
r = spreader.isRedstone() ? textureRsHalloween : spreader.isDreamwood() ? textureDwHalloween : textureHalloween;
Minecraft.getMinecraft().renderEngine.bindTexture(r);
GL11.glScalef(1F, -1F, -1F);
@@ -29,7 +29,6 @@ import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.common.util.RotationHelper;
import vazkii.botania.api.item.IAvatarWieldable;
import vazkii.botania.api.lexicon.ILexicon;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.client.lib.LibRenderIDs;
@@ -41,19 +40,19 @@ import vazkii.botania.common.lib.LibBlockNames;
public class BlockAvatar extends BlockModContainer implements ILexiconable {
private static final int[] META_ROTATIONS = new int[] { 2, 5, 3, 4 };
Random random;
protected BlockAvatar() {
super(Material.wood);
setHardness(2.0F);
setStepSound(soundTypeWood);
setBlockName(LibBlockNames.AVATAR);
setBlockBounds(true);
random = new Random();
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int s, float xs, float ys, float zs) {
TileAvatar avatar = (TileAvatar) world.getTileEntity(x, y, z);
@@ -71,27 +70,27 @@ public class BlockAvatar extends BlockModContainer implements ILexiconable {
stackOnPlayer.stackSize--;
return true;
}
return false;
}
@Override
public void setBlockBoundsBasedOnState(IBlockAccess w, int x, int y, int z) {
setBlockBounds(w.getBlockMetadata(x, y, z) < 4);
}
public void setBlockBounds(boolean horiz) {
float f = 1F / 16F;
float w = f * 9;
float l = f * 6;
float ws = (1F - w) / 2;
float ls = (1F - l) / 2;
if(horiz)
setBlockBounds(ws, 0F, ls, 1F - ws, 1F + f, 1F - ls);
else setBlockBounds(ls, 0F, ws, 1F - ls, 1F + f, 1F - ws);
}
@Override
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
TileSimpleInventory inv = (TileSimpleInventory) par1World.getTileEntity(par2, par3, par4);
@@ -129,18 +128,18 @@ public class BlockAvatar extends BlockModContainer implements ILexiconable {
super.breakBlock(par1World, par2, par3, par4, par5, par6);
}
@Override
public void onBlockPlacedBy(World p_149689_1_, int p_149689_2_, int p_149689_3_, int p_149689_4_, EntityLivingBase p_149689_5_, ItemStack p_149689_6_) {
int l = MathHelper.floor_double(p_149689_5_.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
p_149689_1_.setBlockMetadataWithNotify(p_149689_2_, p_149689_3_, p_149689_4_, META_ROTATIONS[l], 2);
}
@Override
public boolean rotateBlock(World worldObj, int x, int y, int z, ForgeDirection axis) {
return RotationHelper.rotateVanillaBlock(Blocks.furnace, worldObj, x, y, z, axis);
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
// NO-OP
@@ -358,7 +358,7 @@ public final class ModBlocks {
shimmerrock = new BlockShimmerrock();
shimmerwoodPlanks = new BlockShimmerwoodPlanks();
avatar = new BlockAvatar();
ModFluffBlocks.init();
for(int i = 0; i < 16; i++)
@@ -27,7 +27,6 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import thaumcraft.api.crafting.IInfusionStabiliser;
import vazkii.botania.api.item.IGrassHornExcempt;
import vazkii.botania.api.item.IHornHarvestable;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
@@ -17,7 +17,6 @@ import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import thaumcraft.api.crafting.IInfusionStabiliser;
import vazkii.botania.api.item.IGrassHornExcempt;
import vazkii.botania.api.item.IHornHarvestable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.common.block.BlockModFlower;
@@ -19,21 +19,20 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.subtile.ISubTileContainer;
import vazkii.botania.api.subtile.SubTileEntity;
import vazkii.botania.common.Botania;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibMisc;
public class SubTileDaybloom extends SubTilePassiveGenerating {
private static final String TAG_PRIME_POSITION_X = "primePositionX";
private static final String TAG_PRIME_POSITION_Y = "primePositionY";
private static final String TAG_PRIME_POSITION_Z = "primePositionZ";
private static final String TAG_SAVED_POSITION = "savedPosition";
int primePositionX, primePositionY, primePositionZ;
boolean savedPosition;
@Override
public int getColor() {
return 0xFFFF00;
@@ -42,27 +41,27 @@ public class SubTileDaybloom extends SubTilePassiveGenerating {
@Override
public void onUpdate() {
super.onUpdate();
if(isPrime() && (!savedPosition || primePositionX != supertile.xCoord || primePositionY != supertile.yCoord || primePositionZ != supertile.zCoord))
supertile.getWorldObj().setBlockToAir(supertile.xCoord, supertile.yCoord, supertile.zCoord);
}
public void setPrimusPosition() {
primePositionX = supertile.xCoord;
primePositionX = supertile.xCoord;
primePositionY = supertile.yCoord;
primePositionZ = supertile.zCoord;
savedPosition = true;
}
@Override
public ArrayList<ItemStack> getDrops(ArrayList<ItemStack> list) {
if(isPrime())
list.clear();
return super.getDrops(list);
}
@Override
public boolean canGeneratePassively() {
boolean rain = supertile.getWorldObj().getWorldChunkManager().getBiomeGenAt(supertile.xCoord, supertile.zCoord).getIntRainfall() > 0 && (supertile.getWorldObj().isRaining() || supertile.getWorldObj().isThundering());
@@ -71,7 +70,7 @@ public class SubTileDaybloom extends SubTilePassiveGenerating {
@Override
public int getDelayBetweenPassiveGeneration() {
return isPrime() ? 22 : (25 + (int) (getSurroundingFlowers() * 7.5));
return isPrime() ? 22 : 25 + (int) (getSurroundingFlowers() * 7.5);
}
public int getSurroundingFlowers() {
@@ -97,11 +96,11 @@ public class SubTileDaybloom extends SubTilePassiveGenerating {
return flowers;
}
@Override
public void writeToPacketNBT(NBTTagCompound cmp) {
super.writeToPacketNBT(cmp);
if(isPrime()) {
cmp.setInteger(TAG_PRIME_POSITION_X, primePositionX);
cmp.setInteger(TAG_PRIME_POSITION_Y, primePositionY);
@@ -109,11 +108,11 @@ public class SubTileDaybloom extends SubTilePassiveGenerating {
cmp.setBoolean(TAG_SAVED_POSITION, savedPosition);
}
}
@Override
public void readFromPacketNBT(NBTTagCompound cmp) {
super.readFromPacketNBT(cmp);
if(isPrime()) {
primePositionX = cmp.getInteger(TAG_PRIME_POSITION_X);
primePositionY = cmp.getInteger(TAG_PRIME_POSITION_Y);
@@ -126,7 +125,7 @@ public class SubTileDaybloom extends SubTilePassiveGenerating {
public boolean shouldSyncPassiveGeneration() {
return true;
}
@Override
public boolean isPassiveFlower() {
return !isPrime();
@@ -136,23 +135,23 @@ public class SubTileDaybloom extends SubTilePassiveGenerating {
public LexiconEntry getEntry() {
return LexiconData.daybloom;
}
public boolean isPrime() {
return false;
}
public static class Prime extends SubTileDaybloom {
@Override
public boolean isPrime() {
return true;
}
@Override
public LexiconEntry getEntry() {
return LexiconData.primusLoci;
}
}
}
@@ -34,19 +34,19 @@ public class SubTileNightshade extends SubTileDaybloom {
public LexiconEntry getEntry() {
return LexiconData.nightshade;
}
public static class Prime extends SubTileNightshade {
@Override
public boolean isPrime() {
return true;
}
@Override
public LexiconEntry getEntry() {
return LexiconData.primusLoci;
}
}
}
@@ -21,19 +21,19 @@ import vazkii.botania.common.lib.LibBlockNames;
public class TileAvatar extends TileSimpleInventory implements IAvatarTile, ISidedInventory {
private static final int MAX_MANA = 6400;
private static final String TAG_ENABLED = "enabled";
private static final String TAG_TICKS_ELAPSED = "ticksElapsed";
private static final String TAG_MANA = "ticksElapsed";
boolean enabled;
int ticksElapsed;
int mana;
@Override
public void updateEntity() {
super.updateEntity();
enabled = true;
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
int redstoneSide = worldObj.getIndirectPowerLevelTo(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir.ordinal());
@@ -42,17 +42,17 @@ public class TileAvatar extends TileSimpleInventory implements IAvatarTile, ISid
break;
}
}
ItemStack stack = getStackInSlot(0);
if(stack != null && stack.getItem() instanceof IAvatarWieldable) {
IAvatarWieldable wieldable = (IAvatarWieldable) stack.getItem();
wieldable.onAvatarUpdate(this, stack);
}
if(enabled)
ticksElapsed++;
}
@Override
public void writeCustomNBT(NBTTagCompound par1nbtTagCompound) {
super.writeCustomNBT(par1nbtTagCompound);
@@ -60,7 +60,7 @@ public class TileAvatar extends TileSimpleInventory implements IAvatarTile, ISid
par1nbtTagCompound.setInteger(TAG_TICKS_ELAPSED, ticksElapsed);
par1nbtTagCompound.setInteger(TAG_MANA, mana);
}
@Override
public void readCustomNBT(NBTTagCompound par1nbtTagCompound) {
super.readCustomNBT(par1nbtTagCompound);
@@ -68,7 +68,7 @@ public class TileAvatar extends TileSimpleInventory implements IAvatarTile, ISid
ticksElapsed = par1nbtTagCompound.getInteger(TAG_TICKS_ELAPSED);
mana = par1nbtTagCompound.getInteger(TAG_MANA);
}
@Override
public int getSizeInventory() {
return 1;
@@ -78,12 +78,12 @@ public class TileAvatar extends TileSimpleInventory implements IAvatarTile, ISid
public int getInventoryStackLimit() {
return 1;
}
@Override
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
return itemstack != null && itemstack.getItem() instanceof IAvatarTile;
}
@Override
public int[] getAccessibleSlotsFromSide(int p_94128_1_) {
return new int[0];
@@ -98,7 +98,7 @@ public class TileAvatar extends TileSimpleInventory implements IAvatarTile, ISid
public boolean canExtractItem(int p_102008_1_, ItemStack p_102008_2_, int p_102008_3_) {
return false;
}
@Override
public String getInventoryName() {
return LibBlockNames.AVATAR;
@@ -62,7 +62,7 @@ public class BiomeDecorationHandler {
} else {
event.world.setBlock(x1, y1, z1, ModBlocks.flower, color, 2);
if(event.rand.nextDouble() < ConfigHandler.flowerTallChance && ((BlockModFlower) ModBlocks.flower).func_149851_a(event.world, x1, y1, z1, false))
BlockModFlower.placeDoubleFlower(event.world, x1, y1, z1, color, 0);
BlockModFlower.placeDoubleFlower(event.world, x1, y1, z1, color, 0);
}
}
}
@@ -147,10 +147,10 @@ public final class ConfigHandler {
desc = "Set this to false to disable seasonal features, such as halloween and christmas.";
enableSeasonalFeatures = loadPropBool("seasonalFeatures.enabled", desc, enableSeasonalFeatures);
desc = "Set this to true to use Shift instead of Ctrl for the inventory lexica botania quick lookup feature.";
useShiftForQuickLookup = loadPropBool("quickLookup.useShift", desc, useShiftForQuickLookup);
desc = "The height of the mana display bar in above the XP bar. You can change this if you have a mod that changes where the XP bar is.";
manaBarHeight = loadPropInt("manaBar.height", desc, manaBarHeight);
@@ -301,7 +301,7 @@ public final class ModCraftingRecipes {
public static IRecipe recipeCorporeaRetainer;
public static IRecipe recipeTeruTeruBozu;
public static IRecipe recipeAvatar;
// Garden of Glass
public static IRecipe recipeRootToSapling;
public static IRecipe recipeRootToFertilizer;
@@ -2024,12 +2024,12 @@ public final class ModCraftingRecipes {
recipeTeruTeruBozu = BotaniaAPI.getLatestAddedRecipe();
// Livingwood Avatar Recipe
addOreDictRecipe(new ItemStack(ModBlocks.avatar),
addOreDictRecipe(new ItemStack(ModBlocks.avatar),
" W ", "WDW", "W W",
'W', LibOreDict.LIVING_WOOD,
'D', LibOreDict.MANA_DIAMOND);
recipeAvatar = BotaniaAPI.getLatestAddedRecipe();
///////////////////////////////////////////////////////////////////////////////////////////////////////////
// Storage Block/Nugget Recipes
@@ -57,21 +57,21 @@ public class EntityMagicMissile extends EntityThrowable {
public void setEvil(boolean evil) {
dataWatcher.updateObject(25, (byte) (evil ? 1 : 0));
}
public boolean isEvil() {
return dataWatcher.getWatchableObjectByte(25) == 1;
}
public void setTarget(EntityLivingBase e) {
dataWatcher.updateObject(26, e == null ? -1 : e.getEntityId());
}
public EntityLivingBase getTargetEntity() {
int id = dataWatcher.getWatchableObjectInt(26);
Entity e = worldObj.getEntityByID(id);
if(e != null && e instanceof EntityLivingBase)
return (EntityLivingBase) e;
return null;
}
@@ -80,7 +80,7 @@ public class EntityMagicMissile extends EntityThrowable {
double lastTickPosX = this.lastTickPosX;
double lastTickPosY = this.lastTickPosY;
double lastTickPosZ = this.lastTickPosZ;
super.onUpdate();
if(!worldObj.isRemote && (!getTarget() || time > 40)) {
@@ -127,7 +127,7 @@ public class ItemGrassHorn extends ItemMod {
int z = srcz + j;
Block block = world.getBlock(x, y, z);
if(block instanceof IHornHarvestable ? ((IHornHarvestable) block).canHornHarvest(world, x, y, z, stack, type) : (stackDmg == 0 && block instanceof BlockBush && !(block instanceof ISpecialFlower) && (!(block instanceof IGrassHornExcempt) || ((IGrassHornExcempt) block).canUproot(world, x, y, z)) || stackDmg == 1 && block.isLeaves(world, x, y, z) || stackDmg == 2 && block == Blocks.snow_layer))
if(block instanceof IHornHarvestable ? ((IHornHarvestable) block).canHornHarvest(world, x, y, z, stack, type) : stackDmg == 0 && block instanceof BlockBush && !(block instanceof ISpecialFlower) && (!(block instanceof IGrassHornExcempt) || ((IGrassHornExcempt) block).canUproot(world, x, y, z)) || stackDmg == 1 && block.isLeaves(world, x, y, z) || stackDmg == 2 && block == Blocks.snow_layer)
coords.add(new ChunkCoordinates(x, y, z));
}
@@ -144,7 +144,7 @@ public class ItemLexicon extends ItemMod implements ILexicon, IElvenItem {
public static void openBook(EntityPlayer player, ItemStack stack, World world, boolean skipSound) {
ILexicon l = (ILexicon) stack.getItem();
if(!l.isKnowledgeUnlocked(stack, BotaniaAPI.relicKnowledge) && l.isKnowledgeUnlocked(stack, BotaniaAPI.elvenKnowledge))
for(ItemStack rstack : ItemDice.relicStacks) {
Item item = rstack.getItem();
@@ -30,7 +30,7 @@ import cpw.mods.fml.relauncher.SideOnly;
public class ItemManaCookie extends ItemFood {
private IIcon totalBiscuitIcon;
public ItemManaCookie() {
super(0, 0.1F, false);
setPotionEffect(Potion.field_76443_y.id, 1, 0, 1F);
@@ -54,7 +54,7 @@ public class ItemManaCookie extends ItemFood {
public String getUnlocalizedNameInefficiently(ItemStack par1ItemStack) {
return super.getUnlocalizedNameInefficiently(par1ItemStack).replaceAll("item.", "item." + LibResources.PREFIX_MOD);
}
@Override
public IIcon getIcon(ItemStack stack, int pass) {
return getIconIndex(stack);
@@ -64,7 +64,7 @@ public class ItemManaCookie extends ItemFood {
public IIcon getIconIndex(ItemStack stack) {
return stack.getDisplayName().toLowerCase().equals("totalbiscuit") ? totalBiscuitIcon : super.getIconIndex(stack);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister par1IconRegister) {
@@ -268,7 +268,7 @@ public class ItemManaMirror extends ItemMod implements IManaItem, ICoordBoundIte
return pool == null || pool instanceof DummyPool ? null : getPoolCoords(stack);
}
@Override
public float getManaFractionForDisplay(ItemStack stack) {
return (float) getMana(stack) / (float) getMaxMana(stack);
@@ -10,9 +10,6 @@
*/
package vazkii.botania.common.item;
import com.mojang.authlib.GameProfile;
import cpw.mods.fml.common.Optional;
import mods.railcraft.api.core.items.IMinecartItem;
import net.minecraft.block.BlockRailBase;
import net.minecraft.entity.item.EntityMinecart;
@@ -26,6 +23,10 @@ import vazkii.botania.common.achievement.ModAchievements;
import vazkii.botania.common.entity.EntityPoolMinecart;
import vazkii.botania.common.lib.LibItemNames;
import com.mojang.authlib.GameProfile;
import cpw.mods.fml.common.Optional;
@Optional.Interface(modid = "Railcraft", iface = "mods.railcraft.api.core.items.IMinecartItem", striprefs = true)
public class ItemPoolMinecart extends ItemMod implements ICraftAchievement, IMinecartItem {
@@ -110,7 +110,7 @@ public class ItemManaRing extends ItemBauble implements IManaItem, IManaTooltipD
public boolean isNoExport(ItemStack stack) {
return false;
}
@Override
public float getManaFractionForDisplay(ItemStack stack) {
return (float) getMana(stack) / (float) getMaxMana(stack);
@@ -25,7 +25,6 @@ import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.IIcon;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.item.ISequentialBreaker;
import vazkii.botania.client.core.helper.IconHelper;
@@ -163,7 +162,7 @@ public class ItemTerraAxe extends ItemManasteelAxe implements ISequentialBreaker
if(steps == 0)
return;
for(int i = 0; i < 3; i++)
for(int i = 0; i < 3; i++)
for(int j = 0; j < 3; j++)
for(int k = 0; k < 3; k++) {
int x = coords.posX + i - 1;
@@ -16,7 +16,6 @@ import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.entity.passive.EntitySheep;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChunkCoordinates;
@@ -25,7 +24,6 @@ import net.minecraftforge.common.util.ForgeDirection;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.internal.IManaBurst;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.ModBlocks;
public class LensPaint extends Lens {
@@ -33,7 +33,7 @@ import vazkii.botania.common.lib.LibItemNames;
public class ItemDiviningRod extends ItemMod implements IManaUsingItem, IAvatarWieldable {
private static final ResourceLocation avatarOverlay = new ResourceLocation(LibResources.MODEL_AVATAR_DIVINING);
static final int COST = 3000;
public ItemDiviningRod() {
@@ -80,7 +80,7 @@ public class ItemDiviningRod extends ItemMod implements IManaUsingItem, IAvatarW
}
Botania.proxy.setWispFXDepthTest(true);
}
@Override
public boolean usesMana(ItemStack stack) {
return true;
@@ -29,7 +29,7 @@ import vazkii.botania.common.lib.LibItemNames;
public class ItemFireRod extends ItemMod implements IManaUsingItem, IAvatarWieldable {
private static final ResourceLocation avatarOverlay = new ResourceLocation(LibResources.MODEL_AVATAR_FIRE);
private static final int COST = 900;
private static final int COOLDOWN = 1200;
@@ -74,7 +74,7 @@ public class ItemFireRod extends ItemMod implements IManaUsingItem, IAvatarWield
public void onAvatarUpdate(IAvatarTile tile, ItemStack stack) {
TileEntity te = (TileEntity) tile;
World world = te.getWorldObj();
if(!world.isRemote && tile.getCurrentMana() >= COST && tile.getElapsedFunctionalTicks() % 300 == 0 && tile.isEnabled()) {
EntityFlameRing entity = new EntityFlameRing(world);
entity.setPosition(te.xCoord + 0.5, te.yCoord, te.zCoord + 0.5);
@@ -31,7 +31,7 @@ import vazkii.botania.common.lib.LibItemNames;
public class ItemMissileRod extends ItemMod implements IManaUsingItem, IAvatarWieldable {
private static final ResourceLocation avatarOverlay = new ResourceLocation(LibResources.MODEL_AVATAR_MISSILE);
private static final int COST_PER = 120;
private static final int COST_AVATAR = 40;
@@ -56,24 +56,24 @@ public class ItemMissileRod extends ItemMod implements IManaUsingItem, IAvatarWi
if(count != getMaxItemUseDuration(stack) && count % (IManaProficiencyArmor.Helper.hasProficiency(player) ? 1 : 2) == 0 && !player.worldObj.isRemote && ManaItemHandler.requestManaExactForTool(stack, player, COST_PER, false)) {
if(spawnMissile(player.worldObj, player, player.posX + (Math.random() - 0.5 * 0.1), player.posY + 2.4 + (Math.random() - 0.5 * 0.1), player.posZ + (Math.random() - 0.5 * 0.1)))
ManaItemHandler.requestManaExactForTool(stack, player, COST_PER, true);
Botania.proxy.sparkleFX(player.worldObj, player.posX, player.posY + 2.4, player.posZ, 1F, 0.4F, 1F, 6F, 6);
}
}
public boolean spawnMissile(World world, EntityLivingBase thrower, double x, double y, double z) {
EntityMagicMissile missile;
EntityMagicMissile missile;
if(thrower != null)
missile = new EntityMagicMissile(thrower, false);
else missile = new EntityMagicMissile(world);
missile.setPosition(x, y, z);
if(missile.getTarget()) {
if(!world.isRemote) {
world.playSoundEffect(x, y, z, "botania:missile", 0.6F, 0.8F + (float) Math.random() * 0.2F);
world.spawnEntityInWorld(missile);
}
return true;
}
return false;
@@ -103,7 +103,7 @@ public class ItemMissileRod extends ItemMod implements IManaUsingItem, IAvatarWi
if(spawnMissile(world, null, te.xCoord + 0.5 + (Math.random() - 0.5 * 0.1), te.yCoord + 2.5 + (Math.random() - 0.5 * 0.1), te.zCoord + (Math.random() - 0.5 * 0.1))) {
if(!world.isRemote)
tile.recieveMana(-COST_AVATAR);
Botania.proxy.sparkleFX(world, te.xCoord + 0.5, te.yCoord + 2.5, te.zCoord + 0.5, 1F, 0.4F, 1F, 6F, 6);
Botania.proxy.sparkleFX(world, te.xCoord + 0.5, te.yCoord + 2.5, te.zCoord + 0.5, 1F, 0.4F, 1F, 6F, 6);
}
}
@@ -38,7 +38,7 @@ import vazkii.botania.common.lib.LibItemNames;
public class ItemRainbowRod extends ItemMod implements IManaUsingItem, IAvatarWieldable {
private static final ResourceLocation avatarOverlay = new ResourceLocation(LibResources.MODEL_AVATAR_RAINBOW);
private static final int MANA_COST = 750;
private static final int MANA_COST_AVATAR = 10;
private static final int TIME = 600;
@@ -139,10 +139,10 @@ public class ItemRainbowRod extends ItemMod implements IManaUsingItem, IAvatarWi
public void onAvatarUpdate(IAvatarTile tile, ItemStack stack) {
TileEntity te = (TileEntity) tile;
World world = te.getWorldObj();
if(world.isRemote || tile.getCurrentMana() < MANA_COST_AVATAR * 25 || !tile.isEnabled())
return;
int x = te.xCoord;
int y = te.yCoord;
int z = te.zCoord;
@@ -164,40 +164,40 @@ public class ItemRainbowRod extends ItemMod implements IManaUsingItem, IAvatarWi
case 3 :
axis = AxisAlignedBB.getBoundingBox(x + 1, y - h, z - w, x + l + 1, y + h, z + w + 1);
}
List<EntityPlayer> players = world.getEntitiesWithinAABB(EntityPlayer.class, axis);
for(EntityPlayer p : players) {
int px = (int) MathHelper.floor_double(p.posX);
int py = (int) MathHelper.floor_double(p.posY) - 1;
int pz = (int) MathHelper.floor_double(p.posZ);
int px = MathHelper.floor_double(p.posX);
int py = MathHelper.floor_double(p.posY) - 1;
int pz = MathHelper.floor_double(p.posZ);
int dist = 5;
int diff = dist / 2;
for(int i = 0; i < dist; i++)
for(int j = 0; j < dist; j++) {
int ex = px + i - diff;
int ez = pz + j - diff;
if(!axis.isVecInside(Vec3.createVectorHelper(ex + 0.5, py + 1, ez + 0.5)))
continue;
Block block = world.getBlock(ex, py, ez);
if(block.isAir(world, ex, py, ez)) {
world.setBlock(ex, py, ez, ModBlocks.bifrost);
TileBifrost tileBifrost = (TileBifrost) world.getTileEntity(ex, py, ez);
for(int j = 0; j < dist; j++) {
int ex = px + i - diff;
int ez = pz + j - diff;
if(!axis.isVecInside(Vec3.createVectorHelper(ex + 0.5, py + 1, ez + 0.5)))
continue;
Block block = world.getBlock(ex, py, ez);
if(block.isAir(world, ex, py, ez)) {
world.setBlock(ex, py, ez, ModBlocks.bifrost);
TileBifrost tileBifrost = (TileBifrost) world.getTileEntity(ex, py, ez);
tileBifrost.ticks = 10;
tile.recieveMana(-MANA_COST_AVATAR);
} else if(block == ModBlocks.bifrost) {
TileBifrost tileBifrost = (TileBifrost) world.getTileEntity(ex, py, ez);
if(tileBifrost.ticks < 2) {
tileBifrost.ticks = 10;
tile.recieveMana(-MANA_COST_AVATAR);
} else if(block == ModBlocks.bifrost) {
TileBifrost tileBifrost = (TileBifrost) world.getTileEntity(ex, py, ez);
if(tileBifrost.ticks < 2) {
tileBifrost.ticks = 10;
tile.recieveMana(-MANA_COST_AVATAR);
}
}
}
}
}
}
@Override
@@ -39,7 +39,7 @@ import vazkii.botania.common.lib.LibItemNames;
public class ItemTornadoRod extends ItemMod implements IManaUsingItem, IAvatarWieldable {
private static final ResourceLocation avatarOverlay = new ResourceLocation(LibResources.MODEL_AVATAR_TORNADO);
private static final int FLY_TIME = 20;
private static final int FALL_MULTIPLIER = 3;
private static final int MAX_DAMAGE = FLY_TIME * FALL_MULTIPLIER;
@@ -163,11 +163,11 @@ public class ItemTornadoRod extends ItemMod implements IManaUsingItem, IAvatarWi
for(EntityPlayer p : players) {
if(p.motionY > 0.3 && p.motionY < 2 && !p.isSneaking()) {
p.motionY = 2.8;
for(int i = 0; i < 20; i++)
for(int j = 0; j < 5; j++)
Botania.proxy.wispFX(p.worldObj, p.posX, p.posY + i, p.posZ, 0.25F, 0.25F, 0.25F, 0.35F + (float) Math.random() * 0.1F, 0.2F * (float) (Math.random() - 0.5), -0.01F * (float) Math.random(), 0.2F * (float) (Math.random() - 0.5));
if(!world.isRemote) {
p.worldObj.playSoundAtEntity(p, "botania:dash", 1F, 1F);
p.addPotionEffect(new PotionEffect(ModPotions.featherfeet.id, 100, 0));
@@ -40,7 +40,7 @@ public class BLexiconEntry extends LexiconEntry {
public String getUnlocalizedName() {
return "botania.entry." + super.getUnlocalizedName();
}
@Override
public String getTagline() {
return "botania.tagline." + super.getUnlocalizedName();
@@ -43,7 +43,6 @@ import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
import vazkii.botania.common.lexicon.page.PageBrew;
import vazkii.botania.common.lexicon.page.PageCraftingRecipe;
import vazkii.botania.common.lexicon.page.PageElvenRecipe;
import vazkii.botania.common.lexicon.page.PageGuide;
import vazkii.botania.common.lexicon.page.PageImage;
import vazkii.botania.common.lexicon.page.PageLoreText;
import vazkii.botania.common.lexicon.page.PageManaInfusionRecipe;
@@ -536,7 +535,7 @@ public final class LexiconData {
primusLoci = new BLexiconEntry(LibLexicon.GFLOWER_PRIMUS_LOCI, categoryGenerationFlowers);
primusLoci.setPriority().setLexiconPages(new PageText("0"), new PageText("1"));
primusLoci.setIcon(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_DAYBLOOM_PRIME));
daybloom = new BLexiconEntry(LibLexicon.GFLOWER_DAYBLOOM, categoryGenerationFlowers);
daybloom.setPriority().setLexiconPages(new PageText("0"), new PageText(ConfigHandler.hardcorePassiveGeneration > 0 ? "1a" : "1"), new PageImage("3", LibResources.ENTRY_DIMINISHING_RETURNS), new PagePetalRecipe("2", ModPetalRecipes.daybloomRecipe), new PageText("4"), new PageText("5"));
@@ -669,7 +668,7 @@ public final class LexiconData {
avatar = new BLexiconEntry(LibLexicon.DEVICE_AVATAR, categoryDevices);
avatar.setLexiconPages(new PageText("0"), new PageText("1"), new PageCraftingRecipe("2", ModCraftingRecipes.recipeAvatar));
// TOOLS ENTRIES
manaBlaster = new BLexiconEntry(LibLexicon.TOOL_MANA_BLASTER, categoryTools);
manaBlaster.setLexiconPages(new PageText("0"), new PageText("1"), new PageText("2"), new PageCraftingRecipe("3", ModCraftingRecipes.recipeManaBlaster));
@@ -102,7 +102,7 @@ public class PageBrew extends PageRecipe implements ITwoNamedPage {
list.add(recipe.getOutput(new ItemStack(ModItems.vial)));
return list;
}
@Override
public void setSecondUnlocalizedName(String name) {
text = name;
@@ -177,13 +177,13 @@ public class PageCraftingRecipe extends PageRecipe {
renderItemAtGridPos(gui, 2, 0, recipe.getRecipeOutput(), false);
}
@Override
public List<ItemStack> getDisplayedRecipes() {
ArrayList<ItemStack> list = new ArrayList();
for(IRecipe r : recipes)
list.add(r.getRecipeOutput());
return list;
}
}
@@ -108,13 +108,13 @@ public class PageElvenRecipe extends PageRecipe {
}
++ticksElapsed;
}
@Override
public List<ItemStack> getDisplayedRecipes() {
ArrayList<ItemStack> list = new ArrayList();
for(RecipeElvenTrade r : recipes)
list.add(r.getOutput());
return list;
}
@@ -153,8 +153,8 @@ public class PageManaInfusionRecipe extends PageRecipe {
ArrayList<ItemStack> list = new ArrayList();
for(RecipeManaInfusion r : recipes)
list.add(r.getOutput());
return list;
}
}
@@ -26,7 +26,6 @@ import org.lwjgl.opengl.GL11;
import vazkii.botania.api.internal.IGuiLexiconEntry;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.lexicon.LexiconRecipeMappings;
import vazkii.botania.api.recipe.RecipeManaInfusion;
import vazkii.botania.api.recipe.RecipePetals;
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.client.lib.LibResources;
@@ -96,8 +95,8 @@ public class PagePetalRecipe<T extends RecipePetals> extends PageRecipe {
return new ItemStack(ModBlocks.altar);
}
@SideOnly(Side.CLIENT)
public void renderManaBar(IGuiLexiconEntry gui, T recipe, int mx, int my) {
// NO-OP
@@ -114,14 +113,14 @@ public class PagePetalRecipe<T extends RecipePetals> extends PageRecipe {
}
++ticksElapsed;
}
@Override
public List<ItemStack> getDisplayedRecipes() {
ArrayList<ItemStack> list = new ArrayList();
for(T r : recipes)
list.add(r.getOutput());
return list;
}
}
@@ -87,7 +87,7 @@ public class PageTerrasteel extends PageRecipe {
public void onPageAdded(LexiconEntry entry, int index) {
LexiconRecipeMappings.map(new ItemStack(ModItems.manaResource, 1, 4), entry, index);
}
@Override
public List<ItemStack> getDisplayedRecipes() {
ArrayList<ItemStack> list = new ArrayList();
@@ -11,9 +11,7 @@
package vazkii.botania.common.lexicon.page;
import java.awt.Desktop;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;