Cleanup...

This commit is contained in:
Lizbeth Rika committed 2015-02-28 23:57:12 +00:00
1 parent 2d2ee58766
commit 53f7f15010
45 files changed
+280 -297

No files matched your search

@@ -24,10 +24,10 @@ public interface ICosmeticAttachable {
* Gets the cosmetic item stored in the stack passed in.
*/
public ItemStack getCosmeticItem(ItemStack stack);
/**
* Sets the stack's cosmetic item to the one passed in.
*/
public void setCosmeticItem(ItemStack stack, ItemStack cosmetic);
}
@@ -13,7 +13,7 @@ package vazkii.botania.api.item;
/**
* A bauble that counts as a cosmetic only item. These can be added to
* other baubles to add the render to them. Other cosmetic baubles
* can't be stacked on this.
* can't be stacked on this.
*/
public interface ICosmeticBauble extends IBaubleRender {
@@ -22,7 +22,7 @@ public interface ISortableTool {
* Gets the type of tool that this is. A pick, axe or shovel.
*/
public ToolType getSortingType(ItemStack stack);
/**
* Gets the priority that this tool should have when being sorted. The
* tool with the highest priority will be picked. The way this is specified
@@ -39,9 +39,9 @@ public interface ISortableTool {
* that one in particular is priority 0 so it's never picked.
*/
public int getSortingPriority(ItemStack stack);
public static enum ToolType {
PICK, AXE, SHOVEL
}
}
@@ -24,11 +24,11 @@ public class LexiconEntry implements Comparable<LexiconEntry> {
public final LexiconCategory category;
private KnowledgeType type = BotaniaAPI.basicKnowledge;
public List<LexiconPage> pages = new ArrayList<LexiconPage>();
private boolean priority = false;
private ItemStack icon = null;
/**
* @param unlocalizedName The unlocalized name of this entry. This will be localized by the client display.
*/
@@ -56,7 +56,7 @@ public class LexiconEntry implements Comparable<LexiconEntry> {
public KnowledgeType getKnowledgeType() {
return type;
}
/**
* Sets the display icon for this entry. Overriding the one already there. When adding recipe pages to the
* entry, this will be called once for the result of the first found recipe.
@@ -64,7 +64,7 @@ public class LexiconEntry implements Comparable<LexiconEntry> {
public void setIcon(ItemStack stack) {
icon = stack;
}
public ItemStack getIcon() {
return icon;
}
@@ -30,7 +30,6 @@ import vazkii.botania.api.item.IBaubleRender.Helper;
import vazkii.botania.api.item.IBaubleRender.RenderType;
import vazkii.botania.api.item.ICosmeticAttachable;
import vazkii.botania.common.block.BlockModFlower;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.equipment.armor.terrasteel.ItemTerrasteelHelm;
@@ -88,12 +87,12 @@ public final class BaubleRenderHandler {
continue;
}
}
if(item instanceof IBaubleRender) {
GL11.glPushMatrix();
GL11.glColor4f(1F, 1F, 1F, 1F);
((IBaubleRender) stack.getItem()).onPlayerBaubleRender(stack, event, type);
GL11.glPopMatrix();
GL11.glPopMatrix();
}
}
}
@@ -139,7 +138,7 @@ public final class BaubleRenderHandler {
}
}
}
private void renderFancyExclusiveDevStuffBecauseImAnEvilDevWhoDoesntCareAboutTheCommunityBooo(RenderPlayerEvent event) {
GL11.glPushMatrix();
IIcon icon = ((ItemManaResource) ModItems.manaResource).tailIcon;
@@ -156,7 +155,7 @@ public final class BaubleRenderHandler {
if(event.entityPlayer.motionY < 0)
GL11.glRotatef((float) event.entityPlayer.motionY * 20F, 1F, 0F, 0F);
float r = -18F + (float) Math.sin(((float) ClientTickHandler.ticksInGame + event.partialRenderTick) * 0.05F) * 2F;
float r = -18F + (float) Math.sin((ClientTickHandler.ticksInGame + event.partialRenderTick) * 0.05F) * 2F;
GL11.glRotatef(r, 0F, 0F, 1F);
float s = 0.9F;
GL11.glScalef(s, s, s);
@@ -168,9 +167,9 @@ public final class BaubleRenderHandler {
GL11.glRotatef(r, 0F, 0F, 1F);
ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F);
GL11.glPopMatrix();
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
icon = ((BlockModFlower) ModBlocks.flower).icons[6];
icon = BlockModFlower.icons[6];
f = icon.getMinU();
f1 = icon.getMaxU();
f2 = icon.getMinV();
@@ -67,7 +67,7 @@ public class GuiLexicon extends GuiScreen {
boolean hasTutorialArrow;
int tutorialArrowX, tutorialArrowY;
int konamiIndex;
List<LexiconCategory> allCategories;
String title;
@@ -384,7 +384,7 @@ public class GuiLexicon extends GuiScreen {
mc.displayGuiScreen(null);
mc.setIngameFocus();
}
System.out.println(par2);
if(par2 == KONAMI_CODE[konamiIndex]) {
konamiIndex++;
@@ -393,7 +393,7 @@ public class GuiLexicon extends GuiScreen {
konamiIndex = 0;
}
} else konamiIndex = 0;
super.keyTyped(par1, par2);
}
@@ -38,7 +38,7 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
int page = 0;
int tutPage = -1;
GuiButton leftButton, rightButton, backButton;
GuiLexicon parent;
GuiTextField searchField;
@@ -113,7 +113,7 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
@Override
void populateIndex() {
LexiconEntry tutEntry = tutorial != null && !tutorial.isEmpty() ? tutorial.peek() : null;
for(int i = page * 12; i < (page + 1) * 12; i++) {
GuiButtonInvisible button = (GuiButtonInvisible) buttonList.get(i - page * 12);
LexiconEntry entry = i >= entriesToDisplay.size() ? null : entriesToDisplay.get(i);
@@ -140,7 +140,7 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
mc.fontRenderer.setUnicodeFlag(true);
String s = StatCollector.translateToLocal("botaniamisc.typeToSearch");
mc.fontRenderer.drawString(s, left + 120 - mc.fontRenderer.getStringWidth(s), top + guiHeight - 18, 0x666666);
mc.fontRenderer.setUnicodeFlag(unicode);
mc.fontRenderer.setUnicodeFlag(unicode);
}
}
@@ -152,7 +152,7 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
orientTutorialArrowWithButton(backButton);
return;
}
if(tutPage != -1 && tutPage != page) {
orientTutorialArrowWithButton(tutPage < page ? leftButton : rightButton);
return;
@@ -15,12 +15,10 @@ import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StringUtils;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.client.core.helper.FontHelper;
import vazkii.botania.client.gui.lexicon.GuiLexicon;
import vazkii.botania.common.lib.LibMisc;
@@ -30,13 +28,13 @@ public class GuiButtonInvisible extends GuiButtonLexicon {
GuiLexicon gui;
public ItemStack displayStack = null;
float timeHover = 0;
public GuiButtonInvisible(GuiLexicon gui, int par1, int par2, int par3, int par4, int par5, String par6Str) {
super(par1, par2, par3, par4, par5, par6Str);
this.gui = gui;
}
@Override
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
@@ -50,7 +48,7 @@ public class GuiButtonInvisible extends GuiButtonLexicon {
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glDisable(GL11.GL_ALPHA_TEST);
int color = 0;
String format = FontHelper.getFormatFromString(displayString);
@@ -58,26 +56,26 @@ public class GuiButtonInvisible extends GuiButtonLexicon {
char key = format.charAt(format.length() - 1);
if(key == 'o' && format.length() > 3)
key = format.charAt(1);
for(EnumChatFormatting ecf : EnumChatFormatting.class.getEnumConstants())
if(ecf.getFormattingCode() == key) {
if(ecf.ordinal() > 15)
ecf = EnumChatFormatting.BLACK;
color = LibMisc.CONTROL_CODE_COLORS[ecf.ordinal()];
color = LibMisc.CONTROL_CODE_COLORS[ecf.ordinal()];
break;
}
}
int maxalpha = 0x22;
int alpha = Math.min(maxalpha, (int) (timeHover / 4 * maxalpha));
drawRect(xPosition - 5, yPosition, (int) (xPosition - 5 + timeHover * 24), yPosition + height, alpha << 24 | color);
GL11.glEnable(GL11.GL_ALPHA_TEST);
boolean unicode = par1Minecraft.fontRenderer.getUnicodeFlag();
par1Minecraft.fontRenderer.setUnicodeFlag(true);
par1Minecraft.fontRenderer.drawString(displayString, xPosition + (showStack ? 7 : 0), yPosition + (height - 8) / 2, 0);
par1Minecraft.fontRenderer.setUnicodeFlag(unicode);
if(showStack) {
GL11.glScalef(0.5F, 0.5F, 0.5F);
RenderHelper.enableGUIStandardItemLighting();
@@ -88,5 +86,5 @@ public class GuiButtonInvisible extends GuiButtonLexicon {
}
GL11.glPopMatrix();
}
}
@@ -24,20 +24,20 @@ public class RecipeHandlerFloatingFlowers extends TemplateRecipeHandler {
public CachedFloatingFlowerRecipe(ItemStack floatingFlower,
ItemStack specialFlower, ItemStack output) {
this.inputs.add(new PositionedStack(floatingFlower, 25, 6));
this.inputs.add(new PositionedStack(specialFlower, 43, 6));
inputs.add(new PositionedStack(floatingFlower, 25, 6));
inputs.add(new PositionedStack(specialFlower, 43, 6));
this.output = new PositionedStack(output, 119, 24);
this.output.setMaxSize(1);
}
@Override
public List<PositionedStack> getIngredients() {
return this.getCycledIngredients(cycleticks / 20, this.inputs);
return getCycledIngredients(cycleticks / 20, inputs);
}
@Override
public PositionedStack getResult() {
return this.output;
return output;
}
}
@@ -67,7 +67,7 @@ public class RecipeHandlerFloatingFlowers extends TemplateRecipeHandler {
specialFlower.setTagCompound((NBTTagCompound) result
.getTagCompound().copy());
this.arecipes.add(new CachedFloatingFlowerRecipe(floatingFlower,
arecipes.add(new CachedFloatingFlowerRecipe(floatingFlower,
specialFlower, result.copy()));
}
}
@@ -81,7 +81,7 @@ public class RecipeHandlerFloatingFlowers extends TemplateRecipeHandler {
result.setTagCompound((NBTTagCompound) ingredient.getTagCompound()
.copy());
this.arecipes.add(new CachedFloatingFlowerRecipe(floatingFlower,
arecipes.add(new CachedFloatingFlowerRecipe(floatingFlower,
ingredient.copy(), result));
}
}
@@ -16,14 +16,11 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
import net.minecraftforge.client.IItemRenderer.ItemRendererHelper;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.ReflectionHelper;
import vazkii.botania.common.core.helper.ObfuscationHelper;
import vazkii.botania.common.lib.LibObfuscation;
import cpw.mods.fml.relauncher.ReflectionHelper;
public class RenderBow implements IItemRenderer {
@@ -85,7 +85,7 @@ public class RenderTileSpreader extends TileEntitySpecialRenderer {
RenderLens.render(stack, lens.getLensColor(stack));
GL11.glPopMatrix();
}
if(spreader.paddingColor != -1) {
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
@@ -99,12 +99,12 @@ public class RenderTileSpreader extends TileEntitySpecialRenderer {
render.renderBlockAsItem(block, color, 1F);
GL11.glRotatef(90F, 1F, 0F, 0F);
GL11.glRotatef(90F, 0F, 1F, 0F);
GL11.glPushMatrix();
GL11.glScalef(f * 14F, 1F, 1F);
render.renderBlockAsItem(block, color, 1F);
GL11.glPopMatrix();
GL11.glRotatef(90F, 1F, 0F, 0F);
GL11.glTranslatef(0F, 0F, -f / 2);
GL11.glScalef(f * 14F, 1F, f * 15F);
@@ -112,7 +112,7 @@ public class RenderTileSpreader extends TileEntitySpecialRenderer {
GL11.glTranslatef(0F, f * 15F, 0F);
render.renderBlockAsItem(block, color, 1F);
}
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}
@@ -114,7 +114,7 @@ public class BlockAltar extends BlockModContainer implements ILexiconable {
par5EntityPlayer.inventory.setInventorySlotContents(par5EntityPlayer.inventory.currentItem, bucket);
else if(!par5EntityPlayer.inventory.addItemStackToInventory(bucket))
par5EntityPlayer.dropPlayerItemWithRandomChoice(bucket, false);
if(tile.hasLava)
tile.setLava(false);
else tile.setWater(false);
@@ -212,7 +212,7 @@ public class BlockPistonRelay extends BlockMod implements IWandable, ILexiconabl
String[] tokens = s.split(":");
int worldId = Integer.parseInt(tokens[0]), x = Integer.parseInt(tokens[1]), y = Integer.parseInt(tokens[2]), z = Integer.parseInt(tokens[3]);
World world = server.worldServerForDimension(worldId);
if(world.isAirBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ))
if(world.isAirBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ))
world.setBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, ModBlocks.pistonRelay);
else if(!world.isRemote) {
ItemStack stack = new ItemStack(ModBlocks.pistonRelay);
@@ -267,7 +267,7 @@ public final class ModBlocks {
corporeaFunnel = new BlockCorporeaFunnel();
endStoneBrick = new BlockEndStoneBrick();
mushroom = new BlockModMushroom();
ModFluffBlocks.init();
for(int i = 0; i < 16; i++)
@@ -42,7 +42,7 @@ public class BlockCorporeaIndex extends BlockCorporeaBase implements ILexiconabl
public boolean renderAsNormalBlock() {
return false;
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
// NO-OP
@@ -13,23 +13,6 @@ package vazkii.botania.common.block.decor;
import java.util.List;
import java.util.Random;
import thaumcraft.api.crafting.IInfusionStabiliser;
import vazkii.botania.api.item.IGrassHornExcempt;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.client.core.helper.IconHelper;
import vazkii.botania.client.lib.LibRenderIDs;
import vazkii.botania.common.Botania;
import vazkii.botania.common.core.BotaniaCreativeTab;
import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.integration.coloredlights.ColoredLightHelper;
import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibBlockNames;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.BlockMushroom;
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -43,6 +26,22 @@ import net.minecraft.util.IIcon;
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.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.client.core.helper.IconHelper;
import vazkii.botania.common.Botania;
import vazkii.botania.common.core.BotaniaCreativeTab;
import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.integration.coloredlights.ColoredLightHelper;
import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibBlockNames;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@Optional.Interface(modid = "Thaumcraft", iface = "thaumcraft.api.crafting.IInfusionStabiliser", striprefs = true)
public class BlockModMushroom extends BlockMushroom implements IInfusionStabiliser, IGrassHornExcempt, ILexiconable {
@@ -107,7 +106,7 @@ public class BlockModMushroom extends BlockMushroom implements IInfusionStabilis
public int getLightValue(IBlockAccess world, int x, int y, int z) {
return ColoredLightHelper.getPackedColor(world.getBlockMetadata(x, y, z), originalLight);
}
@Override
public IIcon getIcon(int par1, int par2) {
return icons[par2];
@@ -40,7 +40,6 @@ import vazkii.botania.api.wand.IWireframeAABBProvider;
import vazkii.botania.client.lib.LibRenderIDs;
import vazkii.botania.common.block.BlockModContainer;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.tile.TileSimpleInventory;
import vazkii.botania.common.block.tile.mana.TileSpreader;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName;
@@ -305,7 +305,7 @@ public final class BotaniaCreativeTab extends CreativeTabs {
addBlock(ModBlocks.endStoneBrick);
addBlock(ModFluffBlocks.endStoneSlab);
addBlock(ModFluffBlocks.endStoneStairs);
addItem(ModItems.cosmetic);
}
@@ -48,7 +48,7 @@ public class BiomeDecorationHandler {
event.world.setBlock(x1, y1, z1, ModBlocks.flower, color, 2);
}
}
for(int i = 0; i < ConfigHandler.mushroomQuantity; i++) {
int x = event.chunkX + event.rand.nextInt(16) + 8;
int z = event.chunkZ + event.rand.nextInt(16) + 8;
@@ -164,7 +164,7 @@ public final class ConfigHandler {
desc = "The quantity of botania mushrooms to generate underground, in the world, defaults to 40, the lower the number the less patches generate.";
mushroomQuantity = loadPropInt("worldgen.mushroom.quantity", desc, mushroomQuantity);
potionIDSoulCross = loadPropPotionId(LibPotionNames.SOUL_CROSS, potionIDSoulCross);
potionIDFeatherfeet = loadPropPotionId(LibPotionNames.FEATHER_FEET, potionIDFeatherfeet);
potionIDEmptiness = loadPropPotionId(LibPotionNames.EMPTINESS, potionIDEmptiness);
@@ -83,7 +83,7 @@ public final class ItemNBTHelper {
public static void setString(ItemStack stack, String tag, String s) {
getNBT(stack).setString(tag, s);
}
public static void setList(ItemStack stack, String tag, NBTTagList list) {
getNBT(stack).setTag(tag, list);
}
@@ -131,9 +131,9 @@ public final class ItemNBTHelper {
public static String getString(ItemStack stack, String tag, String defaultExpected) {
return verifyExistance(stack, tag) ? getNBT(stack).getString(tag) : defaultExpected;
}
public static NBTTagList getList(ItemStack stack, String tag, int objtype, boolean nullifyOnFail) {
return (NBTTagList) (verifyExistance(stack, tag) ? getNBT(stack).getTagList(tag, objtype) : nullifyOnFail ? null : new NBTTagList());
return verifyExistance(stack, tag) ? getNBT(stack).getTagList(tag, objtype) : nullifyOnFail ? null : new NBTTagList();
}
}
@@ -32,7 +32,6 @@ import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.item.ItemSignalFlare;
import vazkii.botania.common.item.ItemTwigWand;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.lib.LibItemNames;
import vazkii.botania.common.lib.LibOreDict;
import cpw.mods.fml.common.registry.GameRegistry;
@@ -240,7 +239,7 @@ public final class ModCraftingRecipes {
public static List<IRecipe> recipesCosmeticItems;
public static List<IRecipe> recipesMushrooms;
public static IRecipe recipeSwapRing;
public static void init() {
// Lexicon Recipe
addShapelessOreDictRecipe(new ItemStack(ModItems.lexicon), "treeSapling", Items.book);
@@ -1549,28 +1548,28 @@ public final class ModCraftingRecipes {
recipeEndStoneChiseledBricks = BotaniaAPI.getLatestAddedRecipe();
// Livingwood Bow Recipe
addOreDictRecipe(new ItemStack(ModItems.livingwoodBow),
addOreDictRecipe(new ItemStack(ModItems.livingwoodBow),
" TS", "T S", " TS",
'T', LibOreDict.LIVINGWOOD_TWIG,
'S', LibOreDict.MANA_STRING);
recipeLivingwoodBow = BotaniaAPI.getLatestAddedRecipe();
// Crystal Bow Recipe
addOreDictRecipe(new ItemStack(ModItems.crystalBow),
addOreDictRecipe(new ItemStack(ModItems.crystalBow),
" DS", "T S", " DS",
'T', LibOreDict.LIVINGWOOD_TWIG,
'D', LibOreDict.DRAGONSTONE,
'S', LibOreDict.MANA_STRING);
recipeCrystalBow = BotaniaAPI.getLatestAddedRecipe();
// Cosmetic Items Recipes
for(int i = 0; i < 32; i++)
addOreDictRecipe(new ItemStack(ModItems.cosmetic, 1, i),
"PPP", "PSP", "PPP",
'P', new ItemStack(i < 16 ? ModItems.petal : ModItems.manaPetal, 1, i % 16),
'S', LibOreDict.MANA_STRING);
addOreDictRecipe(new ItemStack(ModItems.cosmetic, 1, i),
"PPP", "PSP", "PPP",
'P', new ItemStack(i < 16 ? ModItems.petal : ModItems.manaPetal, 1, i % 16),
'S', LibOreDict.MANA_STRING);
recipesCosmeticItems = BotaniaAPI.getLatestAddedRecipes(32);
// Shimmering Mushroom Recipes
for(int i = 0; i < 16; i++) {
GameRegistry.addShapelessRecipe(new ItemStack(ModBlocks.mushroom, 1, i), new ItemStack(Blocks.red_mushroom), new ItemStack(ModItems.dye, 1, i));
@@ -1578,14 +1577,14 @@ public final class ModCraftingRecipes {
}
recipesMushrooms = BotaniaAPI.getLatestAddedRecipes(32);
GameRegistry.addShapelessRecipe(new ItemStack(Items.mushroom_stew), new ItemStack(ModBlocks.mushroom, 1, Short.MAX_VALUE), new ItemStack(ModBlocks.mushroom, 1, Short.MAX_VALUE), new ItemStack(Items.bowl));
// Ring of Correction Recipe
addOreDictRecipe(new ItemStack(ModItems.swapRing),
addOreDictRecipe(new ItemStack(ModItems.swapRing),
"CM ", "M M", " M ",
'C', new ItemStack(Blocks.clay),
'M', LibOreDict.MANA_STEEL);
recipeSwapRing = BotaniaAPI.getLatestAddedRecipe();
// Storage Block Recipes
addOreDictRecipe(new ItemStack(ModBlocks.storage, 1, 0),
"III", "III", "III",
@@ -79,7 +79,7 @@ public final class ModManaInfusionRecipes {
managlassRecipe = BotaniaAPI.registerManaInfusionRecipe(new ItemStack(ModBlocks.manaGlass), new ItemStack(Blocks.glass), 150);
manaStringRecipe = BotaniaAPI.registerManaInfusionRecipe(new ItemStack(ModItems.manaResource, 1, 16), new ItemStack(Items.string), 5000);
BotaniaAPI.registerManaInfusionRecipe(new ItemStack(ModItems.manaBottle), new ItemStack(Items.glass_bottle), 5000);
}
@@ -14,10 +14,8 @@ import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.world.World;
import vazkii.botania.api.item.IAncientWillContainer;
import vazkii.botania.api.item.ICosmeticAttachable;
import vazkii.botania.api.item.ICosmeticBauble;
import vazkii.botania.common.item.ModItems;
public class CosmeticAttachRecipe implements IRecipe {
@@ -66,5 +66,5 @@ public class CosmeticRemoveRecipe implements IRecipe {
public ItemStack getRecipeOutput() {
return null;
}
}
@@ -33,7 +33,7 @@ import cpw.mods.fml.relauncher.ReflectionHelper;
public class EntityMagicMissile extends EntityThrowable {
private static final String TAG_TIME = "time";
EntityLivingBase target;
double lockX, lockY = -1, lockZ;
int time = 0;
@@ -70,7 +70,7 @@ public class EntityMagicMissile extends EntityThrowable {
setDead();
return;
}
boolean evil = isEvil();
Vector3 thisVec = Vector3.fromEntityCenter(this);
Vector3 oldPos = new Vector3(lastTickPosX, lastTickPosY, lastTickPosZ);
@@ -116,22 +116,22 @@ public class EntityMagicMissile extends EntityThrowable {
if(evil && diffVec.mag() < 1)
setDead();
}
time++;
}
@Override
public void writeEntityToNBT(NBTTagCompound cmp) {
super.writeEntityToNBT(cmp);
cmp.setInteger(TAG_TIME, time);
}
@Override
public void readEntityFromNBT(NBTTagCompound cmp) {
super.readEntityFromNBT(cmp);
time = cmp.getInteger(TAG_TIME);
}
public boolean getTarget() {
if(target != null && target.getHealth() > 0 && !target.isDead && worldObj.loadedEntityList.contains(target))
@@ -43,7 +43,7 @@ public class EntitySpark extends Entity implements ISparkEntity {
private static final int TRANSFER_RATE = 1000;
private static final String TAG_UPGRADE = "upgrade";
private static final String TAG_TRANSFERS = "tfs";
private static final String TAG_TRANSFER_ID = "id";
@@ -81,7 +81,7 @@ public class EntitySpark extends Entity implements ISparkEntity {
List<ISparkEntity> allSparks = null;
if(first || upgrade == 2 || upgrade == 3)
allSparks = SparkHelper.getSparksAround(worldObj, posX, posY, posZ);
if(first) {
for(ISparkEntity spark : allSparks)
particleBeam(this, (Entity) spark);
@@ -91,7 +91,7 @@ public class EntitySpark extends Entity implements ISparkEntity {
Collection<ISparkEntity> transfers = getTransfers();
if(upgrade != 0) {
switch(upgrade) {
case 1 : { // Dispersive
@@ -327,11 +327,11 @@ public class EntitySpark extends Entity implements ISparkEntity {
ItemStack transferDataContainer = getTransferDataContainer();
NBTTagList list = ItemNBTHelper.getList(transferDataContainer, TAG_TRANSFERS, 10, false);
NBTTagList newTransfers = new NBTTagList();
for(int i = 0; i < list.tagCount(); i++) {
NBTTagCompound cmp = list.getCompoundTagAt(i);
int id = cmp.getInteger(TAG_TRANSFER_ID);
boolean added = false;
Entity e = worldObj.getEntityByID(id);
if(e != null && e instanceof ISparkEntity) {
@@ -339,7 +339,7 @@ public class EntitySpark extends Entity implements ISparkEntity {
int upgr = getUpgrade();
int supgr = spark.getUpgrade();
ISparkAttachable atile = spark.getAttachedTile();
if(spark != this && !spark.areIncomingTransfersDone() && atile != null && !atile.isFull() && (upgr == 0 && supgr == 2 || upgr == 3 && (supgr == 0 || supgr == 1) || !(atile instanceof IManaPool))) {
entities.add((ISparkEntity) e);
added = true;
@@ -350,23 +350,23 @@ public class EntitySpark extends Entity implements ISparkEntity {
NBTTagCompound cmp_ = new NBTTagCompound();
cmp_.setInteger(TAG_TRANSFER_ID, id);
newTransfers.appendTag(cmp_);
}
}
ItemStack stack = transferDataContainer.copy();
ItemNBTHelper.setList(stack, TAG_TRANSFERS, list);
setTransferDataContainer(stack);
return entities;
}
private boolean hasTransfer(ISparkEntity entity) {
ItemStack transferDataContainer = getTransferDataContainer();
NBTTagList list = ItemNBTHelper.getList(transferDataContainer, TAG_TRANSFERS, 10, false);
NBTTagList newTransfers = new NBTTagList();
new NBTTagList();
int id = ((Entity) entity).getEntityId();
for(int i = 0; i < list.tagCount(); i++) {
NBTTagCompound cmp = list.getCompoundTagAt(i);
int tid = cmp.getInteger(TAG_TRANSFER_ID);
@@ -386,7 +386,7 @@ public class EntitySpark extends Entity implements ISparkEntity {
NBTTagCompound cmp_ = new NBTTagCompound();
cmp_.setInteger(TAG_TRANSFER_ID, ((Entity) entity).getEntityId());
list.appendTag(cmp_);
ItemStack stack = transferDataContainer.copy();
ItemNBTHelper.setList(stack, TAG_TRANSFERS, list);
setTransferDataContainer(stack);
@@ -401,11 +401,11 @@ public class EntitySpark extends Entity implements ISparkEntity {
public void setUpgrade(int upgrade) {
dataWatcher.updateObject(28, upgrade);
}
public ItemStack getTransferDataContainer() {
return dataWatcher.getWatchableObjectItemStack(29);
}
public void setTransferDataContainer(ItemStack stack) {
dataWatcher.updateObject(29, stack);
}
@@ -89,7 +89,7 @@ public class ItemManaMirror extends ItemMod implements IManaItem, ICoordBoundIte
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) {
if(par2World.isRemote)
return;
IManaPool pool = getManaPool(par1ItemStack);
if(!(pool instanceof DummyPool)) {
if(pool == null)
@@ -13,7 +13,6 @@ package vazkii.botania.common.item;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import vazkii.botania.client.core.helper.IconHelper;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.core.BotaniaCreativeTab;
@@ -22,7 +21,7 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemMod extends Item {
public ItemMod() {
super();
setCreativeTab(BotaniaCreativeTab.INSTANCE);
@@ -324,7 +324,7 @@ public final class ModItems {
crystalBow = new ItemCrystalBow();
cosmetic = new ItemBaubleCosmetic();
swapRing = new ItemSwapRing();
OreDictionary.registerOre(LibOreDict.LEXICON, lexicon);
for(int i = 0; i < 16; i++) {
OreDictionary.registerOre(LibOreDict.PETAL[i], new ItemStack(petal, 1, i));
@@ -46,7 +46,7 @@ public abstract class ItemBauble extends ItemMod implements IBauble, ICosmeticAt
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if(!EntityDoppleganger.isTruePlayer(par3EntityPlayer))
return par1ItemStack;
InventoryBaubles baubles = PlayerHandler.getPlayerBaubles(par3EntityPlayer);
for(int i = 0; i < baubles.getSizeInventory(); i++) {
if(baubles.isItemValidForSlot(i, par1ItemStack)) {
@@ -88,7 +88,7 @@ public abstract class ItemBauble extends ItemMod implements IBauble, ICosmeticAt
if(key != null)
addStringToTooltip(StatCollector.translateToLocal("botania.baubletooltip").replaceAll("%key%", key), par3List);
ItemStack cosmetic = getCosmeticItem(par1ItemStack);
if(cosmetic != null)
addStringToTooltip(String.format(StatCollector.translateToLocal("botaniamisc.hasCosmetic"), cosmetic.getDisplayName()), par3List);
@@ -144,7 +144,7 @@ public abstract class ItemBauble extends ItemMod implements IBauble, ICosmeticAt
return null;
return ItemStack.loadItemStackFromNBT(cmp);
}
@Override
public void setCosmeticItem(ItemStack stack, ItemStack cosmetic) {
NBTTagCompound cmp = new NBTTagCompound();
@@ -152,22 +152,22 @@ public abstract class ItemBauble extends ItemMod implements IBauble, ICosmeticAt
cosmetic.writeToNBT(cmp);
ItemNBTHelper.setCompound(stack, TAG_COSMETIC_ITEM, cmp);
}
@Override
public boolean hasContainerItem(ItemStack stack) {
return getContainerItem(stack) != null;
}
@Override
public ItemStack getContainerItem(ItemStack itemStack) {
return getCosmeticItem(itemStack);
}
@Override
public boolean doesContainerItemLeaveCraftingGrid(ItemStack p_77630_1_) {
return false;
}
public int getLastPlayerHashcode(ItemStack stack) {
return ItemNBTHelper.getInt(stack, TAG_HASHCODE, 0);
}
@@ -12,9 +12,6 @@ package vazkii.botania.common.item.equipment.bauble;
import java.util.List;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.Tessellator;
@@ -29,27 +26,26 @@ import net.minecraft.util.StatCollector;
import net.minecraftforge.client.event.RenderPlayerEvent;
import net.minecraftforge.oredict.RecipeSorter;
import net.minecraftforge.oredict.RecipeSorter.Category;
import org.lwjgl.opengl.GL11;
import vazkii.botania.api.item.ICosmeticBauble;
import vazkii.botania.api.item.IBaubleRender.Helper;
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.client.core.helper.IconHelper;
import vazkii.botania.common.crafting.recipe.CosmeticAttachRecipe;
import vazkii.botania.common.crafting.recipe.CosmeticRemoveRecipe;
import vazkii.botania.common.crafting.recipe.ManaGunClipRecipe;
import vazkii.botania.common.crafting.recipe.ManaGunLensRecipe;
import vazkii.botania.common.crafting.recipe.ManaGunRemoveLensRecipe;
import vazkii.botania.common.lib.LibItemNames;
import baubles.api.BaubleType;
import cpw.mods.fml.common.registry.GameRegistry;
public class ItemBaubleCosmetic extends ItemBauble implements ICosmeticBauble {
private static final int SUBTYPES = 32;
IIcon[] icons;
public ItemBaubleCosmetic() {
super(LibItemNames.COSMETIC);
setHasSubtypes(true);
GameRegistry.addRecipe(new CosmeticAttachRecipe());
GameRegistry.addRecipe(new CosmeticRemoveRecipe());
RecipeSorter.register("botania:cosmeticAttach", CosmeticAttachRecipe.class, Category.SHAPELESS, "");
@@ -62,18 +58,18 @@ public class ItemBaubleCosmetic extends ItemBauble implements ICosmeticBauble {
for(int i = 0; i < SUBTYPES; i++)
icons[i] = IconHelper.forItem(par1IconRegister, this, i);
}
@Override
public void getSubItems(Item item, CreativeTabs tab, List list) {
for(int i = 0; i < SUBTYPES; i++)
list.add(new ItemStack(item, 1, i));
}
@Override
public IIcon getIconFromDamage(int dmg) {
return icons[Math.min(SUBTYPES - 1, dmg)];
}
@Override
public String getUnlocalizedName(ItemStack par1ItemStack) {
return super.getUnlocalizedName(par1ItemStack) + par1ItemStack.getItemDamage();
@@ -89,7 +85,7 @@ public class ItemBaubleCosmetic extends ItemBauble implements ICosmeticBauble {
public BaubleType getBaubleType(ItemStack arg0) {
return BaubleType.AMULET;
}
@Override
public void onPlayerBaubleRender(ItemStack stack, RenderPlayerEvent event, RenderType type) {
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
@@ -272,20 +268,20 @@ public class ItemBaubleCosmetic extends ItemBauble implements ICosmeticBauble {
GL11.glTranslatef(0.35F, 0.3F, 0F);
renderIcon(3);
break;
case 12:
case 12:
chestTranslate();
scale(0.225F);
GL11.glTranslatef(1.2F, 1.9F, 0F);
renderIcon(12);
break;
case 13:
case 13:
chestTranslate();
GL11.glRotatef(-90F, 0F, 1F, 0F);
scale(0.5F);
GL11.glTranslatef(-1.3F, -0.4F, -1F);
renderIcon(13);
break;
case 14:
case 14:
chestTranslate();
scale(0.5F);
GL11.glTranslatef(2.3F, 1F, -0.05F);
@@ -296,19 +292,19 @@ public class ItemBaubleCosmetic extends ItemBauble implements ICosmeticBauble {
GL11.glTranslatef(-2.6F, 0F, 0.05F);
renderIcon(14);
break;
case 16:
case 16:
chestTranslate();
scale(0.225F);
GL11.glTranslatef(2.3F, 1.9F, 0F);
renderIcon(16);
break;
case 21:
case 21:
chestTranslate();
scale(0.3F);
GL11.glTranslatef(1.2F, 0.5F, 0F);
renderIcon(21);
break;
case 29:
case 29:
chestTranslate();
scale(0.8F);
GL11.glTranslatef(0.2F, -0.2F, -0.35F);
@@ -318,13 +314,13 @@ public class ItemBaubleCosmetic extends ItemBauble implements ICosmeticBauble {
}
}
}
public void faceTranslate() {
GL11.glRotatef(90F, 0F, 1F, 0F);
GL11.glRotatef(180F, 1F, 0F, 0F);
GL11.glTranslatef(-0.4F, 0.1F, -0.25F);
}
public void chestTranslate() {
GL11.glRotatef(180F, 1F, 0F, 0F);
GL11.glTranslatef(-0.5F, -0.7F, 0.15F);
@@ -333,7 +329,7 @@ public class ItemBaubleCosmetic extends ItemBauble implements ICosmeticBauble {
public void scale(float f) {
GL11.glScalef(f, f, f);
}
public void renderIcon(int i) {
IIcon icon = icons[i];
float f = icon.getMinU();
@@ -104,7 +104,7 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem, IBaub
stack.getTagCompound().removeTag("display");
}
}
@SubscribeEvent
public void updatePlayerFlyStatus(LivingUpdateEvent event) {
if(event.entityLiving instanceof EntityPlayer) {
@@ -282,7 +282,7 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem, IBaub
rx = 0F;
s = 1.5F;
h = 1.2F;
GL11.glColor4f(1F, 1F, 1F, 0.5F + (flying ? ((float) Math.cos((double) (event.entityPlayer.ticksExisted + event.partialRenderTick) * 0.3F) * 0.25F) + 0.25F : 0F));
GL11.glColor4f(1F, 1F, 1F, 0.5F + (flying ? (float) Math.cos((double) (event.entityPlayer.ticksExisted + event.partialRenderTick) * 0.3F) * 0.25F + 0.25F : 0F));
}
}
@@ -27,64 +27,64 @@ public class ItemSwapRing extends ItemBauble {
public ItemSwapRing() {
super(LibItemNames.SWAP_RING);
}
@Override
public void onWornTick(ItemStack stack, EntityLivingBase entity) {
if(!(entity instanceof EntityPlayer))
return;
if(!(entity instanceof EntityPlayer))
return;
EntityPlayer player = (EntityPlayer) entity;
ItemStack currentStack = player.getCurrentEquippedItem();
if(currentStack == null || !(currentStack.getItem() instanceof ISortableTool))
return;
ISortableTool tool = (ISortableTool) currentStack.getItem();
EntityPlayer player = (EntityPlayer) entity;
ItemStack currentStack = player.getCurrentEquippedItem();
if(currentStack == null || !(currentStack.getItem() instanceof ISortableTool))
return;
MovingObjectPosition pos = ToolCommons.raytraceFromEntity(entity.worldObj, entity, true, 4.5F);
ToolType typeToFind = null;
ISortableTool tool = (ISortableTool) currentStack.getItem();
if(player.isSwingInProgress && pos != null) {
Block block = entity.worldObj.getBlock(pos.blockX, pos.blockY, pos.blockZ);
MovingObjectPosition pos = ToolCommons.raytraceFromEntity(entity.worldObj, entity, true, 4.5F);
ToolType typeToFind = null;
if(block != null) {
Material mat = block.getMaterial();
if(ToolCommons.isRightMaterial(mat, ToolCommons.materialsPick))
typeToFind = ToolType.PICK;
else if(ToolCommons.isRightMaterial(mat, ToolCommons.materialsShovel))
typeToFind = ToolType.SHOVEL;
else if(ToolCommons.isRightMaterial(mat, ToolCommons.materialsAxe))
typeToFind = ToolType.AXE;
}
}
if(player.isSwingInProgress && pos != null) {
Block block = entity.worldObj.getBlock(pos.blockX, pos.blockY, pos.blockZ);
if(typeToFind == null)
return;
System.out.println(typeToFind);
if(block != null) {
Material mat = block.getMaterial();
if(ToolCommons.isRightMaterial(mat, ToolCommons.materialsPick))
typeToFind = ToolType.PICK;
else if(ToolCommons.isRightMaterial(mat, ToolCommons.materialsShovel))
typeToFind = ToolType.SHOVEL;
else if(ToolCommons.isRightMaterial(mat, ToolCommons.materialsAxe))
typeToFind = ToolType.AXE;
}
}
ItemStack bestTool = currentStack;
int bestToolPriority = tool.getSortingType(currentStack) == typeToFind ? tool.getSortingPriority(currentStack) : -1;
int bestSlot = -1;
for(int i = 0; i < player.inventory.getSizeInventory(); i++) {
ItemStack stackInSlot = player.inventory.getStackInSlot(i);
if (stackInSlot != null && stackInSlot.getItem() instanceof ISortableTool && stackInSlot != currentStack) {
ISortableTool toolInSlot = (ISortableTool) stackInSlot.getItem();
if(toolInSlot.getSortingType(stackInSlot).equals(typeToFind)) {
int priority = toolInSlot.getSortingPriority(stackInSlot);
if(priority > bestToolPriority) {
bestTool = stackInSlot;
bestToolPriority = priority;
bestSlot = i;
}
}
}
}
if(bestSlot != -1) {
player.inventory.setInventorySlotContents(player.inventory.currentItem, bestTool);
player.inventory.setInventorySlotContents(bestSlot, currentStack);
}
}
if(typeToFind == null)
return;
System.out.println(typeToFind);
ItemStack bestTool = currentStack;
int bestToolPriority = tool.getSortingType(currentStack) == typeToFind ? tool.getSortingPriority(currentStack) : -1;
int bestSlot = -1;
for(int i = 0; i < player.inventory.getSizeInventory(); i++) {
ItemStack stackInSlot = player.inventory.getStackInSlot(i);
if (stackInSlot != null && stackInSlot.getItem() instanceof ISortableTool && stackInSlot != currentStack) {
ISortableTool toolInSlot = (ISortableTool) stackInSlot.getItem();
if(toolInSlot.getSortingType(stackInSlot).equals(typeToFind)) {
int priority = toolInSlot.getSortingPriority(stackInSlot);
if(priority > bestToolPriority) {
bestTool = stackInSlot;
bestToolPriority = priority;
bestSlot = i;
}
}
}
}
if(bestSlot != -1) {
player.inventory.setInventorySlotContents(player.inventory.currentItem, bestTool);
player.inventory.setInventorySlotContents(bestSlot, currentStack);
}
}
@Override
public BaubleType getBaubleType(ItemStack arg0) {
@@ -83,5 +83,5 @@ public class ItemEnderDagger extends ItemManasteelSword {
public boolean usesMana(ItemStack stack) {
return false;
}
}
@@ -46,7 +46,7 @@ public class ItemGlassPick extends ItemManasteelPick {
public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) {
return par2ItemStack.getItem() == Item.getItemFromBlock(Blocks.glass) ? true : super.getIsRepairable(par1ItemStack, par2ItemStack);
}
@Override
public int getSortingPriority(ItemStack stack) {
return 0;
@@ -207,7 +207,7 @@ public class ItemTerraPick extends ItemManasteelPick implements IManaItem {
public int getMana(ItemStack stack) {
return getMana_(stack);
}
public static int getMana_(ItemStack stack) {
return ItemNBTHelper.getInt(stack, TAG_MANA, 0);
}
@@ -33,10 +33,10 @@ import vazkii.botania.common.item.equipment.tool.elementium.ItemElementiumPick;
public final class ToolCommons {
public static Material[] materialsPick = new Material[]{ Material.rock, Material.iron, Material.ice, Material.glass, Material.piston, Material.anvil };
public static Material[] materialsShovel = new Material[]{ Material.grass, Material.ground, Material.sand, Material.snow, Material.craftedSnow, Material.clay };
public static Material[] materialsAxe = new Material[]{ Material.coral, Material.leaves, Material.plants, Material.wood };
public static Material[] materialsPick = new Material[]{ Material.rock, Material.iron, Material.ice, Material.glass, Material.piston, Material.anvil };
public static Material[] materialsShovel = new Material[]{ Material.grass, Material.ground, Material.sand, Material.snow, Material.craftedSnow, Material.clay };
public static Material[] materialsAxe = new Material[]{ Material.coral, Material.leaves, Material.plants, Material.wood };
public static void damageItem(ItemStack stack, int dmg, EntityLivingBase entity, int manaPerDamage) {
int manaToRequest = dmg * manaPerDamage;
boolean manaRequested = entity instanceof EntityPlayer ? ManaItemHandler.requestManaExactForTool(stack, (EntityPlayer) entity, manaToRequest, true) : false;
@@ -95,11 +95,11 @@ public final class ToolCommons {
world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(blk) + (meta << 12));
}
}
public static int getToolPriority(ItemStack stack) {
if(stack == null)
return 0;
Item item = stack.getItem();
if(!(item instanceof ItemTool))
return 0;
@@ -113,11 +113,11 @@ public final class ToolCommons {
materialLevel = 11;
if(material == BotaniaAPI.terrasteelToolMaterial)
materialLevel = 20;
int modifier = 0;
if(item == ModItems.terraPick)
modifier = ItemTerraPick.getLevel(stack);
int efficiency = EnchantmentHelper.getEnchantmentLevel(Enchantment.efficiency.effectId, stack);
return materialLevel * 100 + modifier * 10 + efficiency;
}
@@ -22,31 +22,31 @@ import vazkii.botania.common.lib.LibItemNames;
public class ItemCrystalBow extends ItemLivingwoodBow {
private final int ARROW_COST = 200;
public ItemCrystalBow() {
super(LibItemNames.CRYSTAL_BOW);
}
@Override
float chargeVelocityMultiplier() {
return 2F;
}
@Override
boolean postsEvent() {
return false;
}
@Override
boolean canFire(ItemStack p_77615_1_, World p_77615_2_, EntityPlayer p_77615_3_, int p_77615_4_) {
int infinity = EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, p_77615_1_);
return ManaItemHandler.requestManaExactForTool(p_77615_1_, p_77615_3_, ARROW_COST / (infinity + 1), false);
}
@Override
void onFire(ItemStack p_77615_1_, World p_77615_2_, EntityPlayer p_77615_3_, int p_77615_4_, boolean infinity, EntityArrow arrow) {
arrow.canBePickedUp = 2;
arrow.canBePickedUp = 2;
ManaItemHandler.requestManaExactForTool(p_77615_1_, p_77615_3_, ARROW_COST / (infinity ? 2 : 1), false);
}
}
@@ -41,7 +41,7 @@ public class ItemLivingwoodBow extends ItemBow implements IManaUsingItem {
public static final int MANA_PER_DAMAGE = 40;
IIcon[] pullIcons = new IIcon[3];
public ItemLivingwoodBow() {
this(LibItemNames.LIVINGWOOD_BOW);
}
@@ -64,93 +64,93 @@ public class ItemLivingwoodBow extends ItemBow implements IManaUsingItem {
public String getUnlocalizedNameInefficiently(ItemStack par1ItemStack) {
return super.getUnlocalizedNameInefficiently(par1ItemStack).replaceAll("item.", "item." + LibResources.PREFIX_MOD);
}
@Override
public ItemStack onItemRightClick(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_) {
ArrowNockEvent event = new ArrowNockEvent(p_77659_3_, p_77659_1_);
MinecraftForge.EVENT_BUS.post(event);
if(event.isCanceled())
return event.result;
if(canFire(p_77659_1_, p_77659_2_, p_77659_3_, 0))
p_77659_3_.setItemInUse(p_77659_1_, this.getMaxItemUseDuration(p_77659_1_));
return p_77659_1_;
}
@Override
public void onPlayerStoppedUsing(ItemStack p_77615_1_, World p_77615_2_, EntityPlayer p_77615_3_, int p_77615_4_) {
public ItemStack onItemRightClick(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_) {
ArrowNockEvent event = new ArrowNockEvent(p_77659_3_, p_77659_1_);
MinecraftForge.EVENT_BUS.post(event);
if(event.isCanceled())
return event.result;
if(canFire(p_77659_1_, p_77659_2_, p_77659_3_, 0))
p_77659_3_.setItemInUse(p_77659_1_, getMaxItemUseDuration(p_77659_1_));
return p_77659_1_;
}
@Override
public void onPlayerStoppedUsing(ItemStack p_77615_1_, World p_77615_2_, EntityPlayer p_77615_3_, int p_77615_4_) {
int j = (int) ((getMaxItemUseDuration(p_77615_1_) - p_77615_4_) * chargeVelocityMultiplier());
ArrowLooseEvent event = new ArrowLooseEvent(p_77615_3_, p_77615_1_, j);
MinecraftForge.EVENT_BUS.post(event);
if(event.isCanceled())
return;
j = event.charge;
ArrowLooseEvent event = new ArrowLooseEvent(p_77615_3_, p_77615_1_, j);
MinecraftForge.EVENT_BUS.post(event);
if(event.isCanceled())
return;
j = event.charge;
boolean flag = canFire(p_77615_1_, p_77615_2_, p_77615_3_, p_77615_4_);
boolean infinity = EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, p_77615_1_) > 0;
if(flag) {
float f = (float)j / 20.0F;
f = (f * f + f * 2.0F) / 3.0F;
boolean flag = canFire(p_77615_1_, p_77615_2_, p_77615_3_, p_77615_4_);
boolean infinity = EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, p_77615_1_) > 0;
if((double)f < 0.1D)
return;
if(flag) {
float f = j / 20.0F;
f = (f * f + f * 2.0F) / 3.0F;
if(f > 1.0F)
f = 1.0F;
if(f < 0.1D)
return;
EntityArrow entityarrow = makeArrow(p_77615_1_, p_77615_2_, p_77615_3_, p_77615_4_, f);
if(f > 1.0F)
f = 1.0F;
if(f == 1.0F)
entityarrow.setIsCritical(true);
EntityArrow entityarrow = makeArrow(p_77615_1_, p_77615_2_, p_77615_3_, p_77615_4_, f);
int k = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, p_77615_1_);
if(f == 1.0F)
entityarrow.setIsCritical(true);
if(k > 0)
entityarrow.setDamage(entityarrow.getDamage() + (double)k * 0.5D + 0.5D);
int k = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, p_77615_1_);
int l = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, p_77615_1_);
if(k > 0)
entityarrow.setDamage(entityarrow.getDamage() + k * 0.5D + 0.5D);
if(l > 0)
entityarrow.setKnockbackStrength(l);
int l = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, p_77615_1_);
if(EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, p_77615_1_) > 0)
entityarrow.setFire(100);
if(l > 0)
entityarrow.setKnockbackStrength(l);
ToolCommons.damageItem(p_77615_1_, 1, p_77615_3_, MANA_PER_DAMAGE);
p_77615_2_.playSoundAtEntity(p_77615_3_, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F);
if(EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, p_77615_1_) > 0)
entityarrow.setFire(100);
onFire(p_77615_1_, p_77615_2_, p_77615_3_, p_77615_4_, infinity, entityarrow);
ToolCommons.damageItem(p_77615_1_, 1, p_77615_3_, MANA_PER_DAMAGE);
p_77615_2_.playSoundAtEntity(p_77615_3_, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F);
onFire(p_77615_1_, p_77615_2_, p_77615_3_, p_77615_4_, infinity, entityarrow);
if(!p_77615_2_.isRemote)
p_77615_2_.spawnEntityInWorld(entityarrow);
}
}
if(!p_77615_2_.isRemote)
p_77615_2_.spawnEntityInWorld(entityarrow);
}
}
float chargeVelocityMultiplier() {
return 1F;
}
boolean postsEvent() {
return true;
}
EntityArrow makeArrow(ItemStack p_77615_1_, World p_77615_2_, EntityPlayer p_77615_3_, int p_77615_4_, float f) {
return new EntityArrow(p_77615_2_, p_77615_3_, f * 2.0F);
}
boolean canFire(ItemStack p_77615_1_, World p_77615_2_, EntityPlayer p_77615_3_, int p_77615_4_) {
return p_77615_3_.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, p_77615_1_) > 0 || p_77615_3_.inventory.hasItem(Items.arrow);
}
void onFire(ItemStack p_77615_1_, World p_77615_2_, EntityPlayer p_77615_3_, int p_77615_4_, boolean infinity, EntityArrow arrow) {
if(infinity)
arrow.canBePickedUp = 2;
else p_77615_3_.inventory.consumeInventoryItem(Items.arrow);
if(infinity)
arrow.canBePickedUp = 2;
else p_77615_3_.inventory.consumeInventoryItem(Items.arrow);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister par1IconRegister) {
@@ -174,22 +174,22 @@ public class ItemLivingwoodBow extends ItemBow implements IManaUsingItem {
public boolean usesMana(ItemStack stack) {
return true;
}
@Override
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
if(stack != usingItem)
return itemIcon;
int j = (int) ((getMaxItemUseDuration(stack) - useRemaining) * chargeVelocityMultiplier());
if(j >= 18)
return pullIcons[2];
if(j > 13)
return pullIcons[1];
if(j > 0)
return pullIcons[0];
if(j >= 18)
return pullIcons[2];
if(j > 13)
return pullIcons[1];
if(j > 0)
return pullIcons[0];
return itemIcon;
}
}
@@ -24,7 +24,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.item.ISortableTool;
import vazkii.botania.api.item.ISortableTool.ToolType;
import vazkii.botania.api.mana.IManaUsingItem;
import vazkii.botania.api.mana.ManaItemHandler;
import vazkii.botania.client.core.handler.ItemsRemainingRenderHandler;
@@ -118,7 +117,7 @@ public class ItemManasteelPick extends ItemPickaxe implements IManaUsingItem, IS
public boolean usesMana(ItemStack stack) {
return true;
}
@Override
public ToolType getSortingType(ItemStack stack) {
return ToolType.PICK;
@@ -47,7 +47,7 @@ public class ItemManaResource extends ItemMod implements IFlowerComponent, IElve
IIcon[] icons;
public IIcon tailIcon = null;
public ItemManaResource() {
super();
setUnlocalizedName(LibItemNames.MANA_RESOURCE);
@@ -114,7 +114,7 @@ public class ItemManaResource extends ItemMod implements IFlowerComponent, IElve
icons = new IIcon[types];
for(int i = 0; i < icons.length; i++)
icons[i] = IconHelper.forName(par1IconRegister, LibItemNames.MANA_RESOURCE_NAMES[i]);
tailIcon = IconHelper.forName(par1IconRegister, "tail");
}
@@ -646,10 +646,10 @@ public final class LexiconData {
livingwoodBow = new BLexiconEntry(LibLexicon.TOOL_LIVINGWOOD_BOW, categoryTools);
livingwoodBow.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCraftingRecipes.recipeLivingwoodBow));
crystalBow = new ALexiconEntry(LibLexicon.TOOL_CRYSTAL_BOW, categoryTools);
crystalBow.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCraftingRecipes.recipeCrystalBow));
// ENDER ENTRIES
enderAir = new BLexiconEntry(LibLexicon.ENDER_AIR, categoryEnder);
enderAir.setPriority().setLexiconPages(new PageText("0"));
@@ -706,7 +706,7 @@ public final class LexiconData {
pages.add(new PageCraftingRecipe("" + (i + 2), ModCraftingRecipes.recipesCosmeticItems.get(i)));
cosmeticBaubles.setPriority().setLexiconPages(pages.toArray(new LexiconPage[pages.size()]));
}
tinyPlanet = new BLexiconEntry(LibLexicon.BAUBLE_TINY_PLANET, categoryBaubles);
tinyPlanet.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCraftingRecipes.recipeTinyPlanet), new PageCraftingRecipe("2", ModCraftingRecipes.recipeTinyPlanetBlock));
@@ -769,7 +769,7 @@ public final class LexiconData {
swapRing = new BLexiconEntry(LibLexicon.BAUBLE_SWAP_RING, categoryBaubles);
swapRing.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCraftingRecipes.recipeSwapRing));
// ALFHOMANCY ENTRIES
alfhomancyIntro = new BLexiconEntry(LibLexicon.ALF_INTRO, categoryAlfhomancy);
alfhomancyIntro.setPriority().setLexiconPages(new PageText("0"), new PageText("1"), new PageCraftingRecipe("2", ModCraftingRecipes.recipeAlfPortal), new PageCraftingRecipe("3", ModCraftingRecipes.recipeNaturaPylon),
@@ -833,7 +833,7 @@ public final class LexiconData {
mushrooms = new BLexiconEntry(LibLexicon.MISC_MUSHROOMS, categoryMisc);
mushrooms.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCraftingRecipes.recipesMushrooms));
if(Botania.bcTriggersLoaded) {
bcIntegration = new BLexiconEntry(LibLexicon.MISC_BC_INTEGRATION, categoryMisc);
bcIntegration.setLexiconPages(new PageText("0")).setIcon(new ItemStack(Items.redstone));
@@ -145,7 +145,7 @@ public final class LibLexicon {
public static final String TOOL_OVERGROWTH_SEED = "overgrowthSeed";
public static final String TOOL_LIVINGWOOD_BOW = "livingwoodBow";
public static final String TOOL_CRYSTAL_BOW = "crystalBow";
public static final String ENDER_AIR = "enderAir";
public static final String ENDER_ENDER_EYE_BLOCK = "enderEyeBlock";
public static final String ENDER_PISTON_RELAY = "pistonRelay";
@@ -32,7 +32,7 @@ public final class LibMisc {
public static final ForgeDirection[] CARDINAL_DIRECTIONS = new ForgeDirection[] {
ForgeDirection.NORTH, ForgeDirection.SOUTH, ForgeDirection.EAST, ForgeDirection.WEST
};
public static final int[] CONTROL_CODE_COLORS = new int[] {
0x000000, 0x0000AA, 0x00AA00, 0x00AAAA,
0xAA0000, 0xAA00AA, 0xFFAA00, 0xAAAAAA,