Added the Manaseer Monocle.

This commit is contained in:
Lizbeth Rika committed 2015-01-24 15:18:07 +00:00
1 parent 780228199c
commit 7498cc8d08
10 files changed
+111 -3

No files matched your search

@@ -0,0 +1,21 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under a
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
*
* File Created @ [Jan 24, 2015, 3:08:40 PM (GMT)]
*/
package vazkii.botania.api.item;
/**
* Base Interface for the Manaseer Monocle and items of the sort.
* Having a IBauble of this type equipped on the 0th slot (amulet)
* will draw bursts without depth testing.
*/
public interface IBurstViewerBauble {
}
@@ -15,6 +15,8 @@ import java.awt.Desktop;
import java.net.URI;
import java.util.Calendar;
import baubles.common.container.InventoryBaubles;
import baubles.common.lib.PlayerHandler;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.PlayerControllerMP;
@@ -23,12 +25,14 @@ import net.minecraft.client.renderer.entity.RenderSnowball;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntitySkull;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraft.world.WorldSettings.GameType;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.common.MinecraftForge;
import vazkii.botania.api.item.IBurstViewerBauble;
import vazkii.botania.api.item.IExtendedPlayerController;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.wiki.IWikiProvider;
@@ -221,6 +225,14 @@ public class ClientProxy extends CommonProxy {
public boolean isTheClientPlayer(EntityLivingBase entity) {
return entity == Minecraft.getMinecraft().thePlayer;
}
@Override
public boolean isClientPlayerWearingMonocle() {
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
InventoryBaubles inv = PlayerHandler.getPlayerBaubles(player);
ItemStack stack = inv.getStackInSlot(0);
return stack != null && stack.getItem() instanceof IBurstViewerBauble;
}
@Override
public void setExtraReach(EntityLivingBase entity, float reach) {
@@ -246,6 +246,7 @@ public final class BotaniaCreativeTab extends CreativeTabs {
addItem(ModItems.superTravelBelt);
addItem(ModItems.knockbackBelt);
addItem(ModItems.itemFinder);
addItem(ModItems.monocle);
addItem(ModItems.icePendant);
addItem(ModItems.lavaPendant);
addItem(ModItems.superLavaPendant);
@@ -129,6 +129,10 @@ public class CommonProxy {
public boolean isTheClientPlayer(EntityLivingBase entity) {
return false;
}
public boolean isClientPlayerWearingMonocle() {
return false;
}
public void setExtraReach(EntityLivingBase entity, float reach) {
if(entity instanceof EntityPlayerMP)
@@ -472,7 +472,7 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
ILensEffect lens = getLensInstance();
if(lens != null && !lens.doParticles(this, getSourceLens()))
return;
Color color = new Color(getColor());
float r = color.getRed() / 255F;
float g = color.getGreen() / 255F;
@@ -492,6 +492,10 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
if(!noParticles && shouldDoFakeParticles())
Botania.proxy.sparkleFX(worldObj, posX, posY, posZ, r, g, b, 0.4F * size, 1, true);
} else {
boolean monocle = Botania.proxy.isClientPlayerWearingMonocle();
if(monocle)
Botania.proxy.setWispFXDepthTest(false);
if(ConfigHandler.subtlePowerSystem)
Botania.proxy.wispFX(worldObj, posX, posY, posZ, r, g, b, 0.1F * size, (float) (Math.random() - 0.5F) * 0.02F, (float) (Math.random() - 0.5F) * 0.02F, (float) (Math.random() - 0.5F) * 0.01F);
else {
@@ -533,6 +537,9 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
posY = savedPosY;
posZ = savedPosZ;
}
if(monocle)
Botania.proxy.setWispFXDepthTest(true);
}
}
@@ -44,6 +44,7 @@ import vazkii.botania.common.item.equipment.bauble.ItemLavaPendant;
import vazkii.botania.common.item.equipment.bauble.ItemMagnetRing;
import vazkii.botania.common.item.equipment.bauble.ItemManaRing;
import vazkii.botania.common.item.equipment.bauble.ItemMiningRing;
import vazkii.botania.common.item.equipment.bauble.ItemMonocle;
import vazkii.botania.common.item.equipment.bauble.ItemPixieRing;
import vazkii.botania.common.item.equipment.bauble.ItemReachRing;
import vazkii.botania.common.item.equipment.bauble.ItemSuperLavaPendant;
@@ -188,7 +189,8 @@ public final class ModItems {
public static Item unholyCloak;
public static Item craftingHalo;
public static Item blackLotus;
public static Item monocle;
public static void init() {
lexicon = new ItemLexicon();
petal = new ItemPetal();
@@ -287,7 +289,8 @@ public final class ModItems {
unholyCloak = new ItemUnholyCloak();
craftingHalo = new ItemCraftingHalo();
blackLotus = new ItemBlackLotus();
monocle = new ItemMonocle();
OreDictionary.registerOre(LibOreDict.LEXICON, lexicon);
for(int i = 0; i < 16; i++) {
OreDictionary.registerOre(LibOreDict.PETAL[i], new ItemStack(petal, 1, i));
@@ -0,0 +1,58 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under a
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
*
* File Created @ [Jan 24, 2015, 3:03:18 PM (GMT)]
*/
package vazkii.botania.common.item.equipment.bauble;
import org.lwjgl.opengl.GL11;
import vazkii.botania.api.item.IBaubleRender;
import vazkii.botania.api.item.IBurstViewerBauble;
import vazkii.botania.api.item.IBaubleRender.Helper;
import vazkii.botania.api.item.IBaubleRender.RenderType;
import vazkii.botania.common.lib.LibItemNames;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.event.RenderPlayerEvent;
import baubles.api.BaubleType;
public class ItemMonocle extends ItemBauble implements IBurstViewerBauble, IBaubleRender {
public ItemMonocle() {
super(LibItemNames.MONOCLE);
}
@Override
public BaubleType getBaubleType(ItemStack arg0) {
return BaubleType.AMULET;
}
@Override
public void onPlayerBaubleRender(ItemStack stack, RenderPlayerEvent event, RenderType type) {
if(type == RenderType.HEAD) {
float f = itemIcon.getMinU();
float f1 = itemIcon.getMaxU();
float f2 = itemIcon.getMinV();
float f3 = itemIcon.getMaxV();
boolean armor = event.entityPlayer.getCurrentArmor(3) != null;
Helper.translateToHeadLevel(event.entityPlayer);
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
GL11.glRotatef(90F, 0F, 1F, 0F);
GL11.glRotatef(180F, 1F, 0F, 0F);
GL11.glTranslatef(-0.35F, -0.1F, armor ? -0.3F : -0.25F);
GL11.glScalef(0.35F, 0.35F, 0.35F);
ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, itemIcon.getIconWidth(), itemIcon.getIconHeight(), 1F / 16F);
}
}
}
@@ -111,6 +111,7 @@ public final class LibItemNames {
public static final String UNHOLY_CLOAK = "unholyCloak";
public static final String CRAFTING_HALO = "craftingHalo";
public static final String BLACK_LOTUS = "blackLotus";
public static final String MONOCLE = "monocle";
public static final String[] LENS_NAMES = new String[] {
"lensNormal",