summaryrefslogtreecommitdiff
path: root/src/main/java/darkknight/jewelrycraft/curses
diff options
context:
space:
mode:
authorOnyxDarkKnight <sor1n.iliutza16@gmail.com>2015-04-23 18:08:44 +0100
committerOnyxDarkKnight <sor1n.iliutza16@gmail.com>2015-04-23 18:08:44 +0100
commit05f43b228ae0de5bd33ccd303ebbadfaaa464bc7 (patch)
treedf2067001e0b28c2d40edc5ccde43830616ec8ce /src/main/java/darkknight/jewelrycraft/curses
parent2a7e0a624f482a28af1c770dbcf2a20f52f94f78 (diff)
Added new curses!
Diffstat (limited to 'src/main/java/darkknight/jewelrycraft/curses')
-rw-r--r--src/main/java/darkknight/jewelrycraft/curses/Curse.java14
-rw-r--r--src/main/java/darkknight/jewelrycraft/curses/CurseInfamy.java24
-rw-r--r--src/main/java/darkknight/jewelrycraft/curses/CurseList.java26
-rw-r--r--src/main/java/darkknight/jewelrycraft/curses/CursePentagram.java67
-rw-r--r--src/main/java/darkknight/jewelrycraft/curses/CurseRabbitsPaw.java62
5 files changed, 186 insertions, 7 deletions
diff --git a/src/main/java/darkknight/jewelrycraft/curses/Curse.java b/src/main/java/darkknight/jewelrycraft/curses/Curse.java
index f833542..75b4056 100644
--- a/src/main/java/darkknight/jewelrycraft/curses/Curse.java
+++ b/src/main/java/darkknight/jewelrycraft/curses/Curse.java
@@ -3,8 +3,11 @@ package darkknight.jewelrycraft.curses;
import java.util.ArrayList;
import java.util.Random;
import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
+import net.minecraftforge.client.event.RenderPlayerEvent;
public class Curse
{
@@ -77,7 +80,10 @@ public class Curse
* @param world
* @param player
*/
- public void deathAction(World world, EntityPlayer player)
+ public void playerDeathAction(World world, EntityPlayer player)
+ {}
+
+ public void entityDeathAction(World world, EntityLivingBase target, EntityPlayer player)
{}
/**
@@ -101,6 +107,12 @@ public class Curse
public void attackedByPlayerAction(World world, EntityPlayer player, Entity target)
{}
+ public void entityDropItems(EntityPlayer player, Entity target, ArrayList<EntityItem> drops)
+ {}
+
+ public void playerRender(EntityPlayer player, RenderPlayerEvent.Specials.Post event)
+ {}
+
public boolean itemToss()
{
return false;
diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseInfamy.java b/src/main/java/darkknight/jewelrycraft/curses/CurseInfamy.java
index 1a86862..ad80ec8 100644
--- a/src/main/java/darkknight/jewelrycraft/curses/CurseInfamy.java
+++ b/src/main/java/darkknight/jewelrycraft/curses/CurseInfamy.java
@@ -1,21 +1,27 @@
package darkknight.jewelrycraft.curses;
+import org.lwjgl.opengl.GL11;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
+import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
+import net.minecraftforge.client.event.RenderPlayerEvent;
import darkknight.jewelrycraft.damage.DamageSourceList;
import darkknight.jewelrycraft.entities.EntityHalfHeart;
import darkknight.jewelrycraft.entities.EntityHeart;
+import darkknight.jewelrycraft.entities.renders.RenderHelper;
+import darkknight.jewelrycraft.item.render.MaskRender;
import darkknight.jewelrycraft.util.JewelrycraftUtil;
import darkknight.jewelrycraft.util.PlayerUtils;
import darkknight.jewelrycraft.util.Variables;
public class CurseInfamy extends Curse
{
+ MaskRender mask = new MaskRender();
public CurseInfamy(int id, String name, int text)
{
super(id, name, text);
@@ -35,6 +41,24 @@ public class CurseInfamy extends Curse
}
}
+ public void playerRender(EntityPlayer player, RenderPlayerEvent.Specials.Post event)
+ {
+ float yaw = player.prevRotationYawHead + (player.rotationYawHead - player.prevRotationYawHead) * event.partialRenderTick;
+ float yawOffset = player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * event.partialRenderTick;
+ float pitch = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * event.partialRenderTick;
+ GL11.glPushMatrix();
+ GL11.glColor4f(1, 1, 1, 1);
+ GL11.glRotatef(yawOffset, 0, -1, 0);
+ GL11.glRotatef(yaw - 90, 0, 1, 0);
+ GL11.glRotatef(pitch, 0, 0, -1);
+ GL11.glRotatef(90F, 0, 1F, 0F);
+ RenderHelper.translateToHeadLevel(player);
+ GL11.glScalef(1.6f, 1.6f, 1.6f);
+ GL11.glTranslatef(-0.25F, -0.25F, -0.25F);
+ mask.doRender(event.entityPlayer, 0F, 0F, 0F, 0F, 0F);
+ GL11.glPopMatrix();
+ }
+
public String getDescription()
{
return "What have you done?!";
diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseList.java b/src/main/java/darkknight/jewelrycraft/curses/CurseList.java
index e4105c8..e31db02 100644
--- a/src/main/java/darkknight/jewelrycraft/curses/CurseList.java
+++ b/src/main/java/darkknight/jewelrycraft/curses/CurseList.java
@@ -5,12 +5,19 @@ import darkknight.jewelrycraft.util.Variables;
public class CurseList
{
- private static Curse rotten;
- private static Curse flaming;
- private static Curse blind;
- private static Curse greed;
- private static Curse infamy;
- private static Curse midasTouch;
+ public static Curse rotten;
+ public static Curse flaming;
+ public static Curse blind;
+ public static Curse greed;
+ public static Curse infamy;
+ public static Curse midasTouch;
+ public static Curse rabbitsPaw;
+ public static Curse pentagram;
+ public static Curse vampireHunger;
+ public static Curse humbleBundle;
+ public static Curse deathsTouch;
+ public static Curse antichrist;
+ public static Curse moneyEqualsPower;
public static void preInit(FMLPreInitializationEvent e)
{
@@ -20,5 +27,12 @@ public class CurseList
blind = new CurseBlind(3, Variables.MODNAME + ":" + "Blind", 0);
infamy = new CurseInfamy(4, Variables.MODNAME + ":" + "Infamy", 0);
midasTouch = new CurseMidasTouch(5, Variables.MODNAME + ":" + "Midas Touch", 0);
+ rabbitsPaw = new CurseRabbitsPaw(6, Variables.MODNAME + ":" + "Rabbit's Paw", 0);
+ pentagram = new CursePentagram(7, Variables.MODNAME + ":" + "Pentagram", 0);
+// vampireHunger = new CurseMidasTouch(8, Variables.MODNAME + ":" + "Vampire Hunger", 0);
+// humbleBundle = new CurseMidasTouch(9, Variables.MODNAME + ":" + "Humble Bundle", 0);
+// deathsTouch = new CurseMidasTouch(10, Variables.MODNAME + ":" + "Deaths Touch", 0);
+// antichrist = new CurseMidasTouch(11, Variables.MODNAME + ":" + "Antichrist", 0);
+// moneyEqualsPower = new CurseMidasTouch(12, Variables.MODNAME + ":" + "Money Equals Power", 0);
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/curses/CursePentagram.java b/src/main/java/darkknight/jewelrycraft/curses/CursePentagram.java
new file mode 100644
index 0000000..4ea4ee7
--- /dev/null
+++ b/src/main/java/darkknight/jewelrycraft/curses/CursePentagram.java
@@ -0,0 +1,67 @@
+package darkknight.jewelrycraft.curses;
+
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.renderer.ItemRenderer;
+import net.minecraft.client.renderer.Tessellator;
+import net.minecraft.client.renderer.texture.TextureManager;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Items;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.world.World;
+import net.minecraftforge.client.event.RenderPlayerEvent;
+import org.lwjgl.opengl.GL11;
+import darkknight.jewelrycraft.item.render.MaskRender;
+import darkknight.jewelrycraft.util.Variables;
+
+public class CursePentagram extends Curse
+{
+ ResourceLocation curse = new ResourceLocation(Variables.MODID, "textures/gui/curses.png");
+ float rot = 0F;
+
+ public CursePentagram(int id, String name, int text)
+ {
+ super(id, name, text);
+ }
+
+ @Override
+ public void attackedByPlayerAction(World world, EntityPlayer player, Entity target)
+ {}
+
+ public void playerRender(EntityPlayer player, RenderPlayerEvent.Specials.Post event)
+ {
+ GL11.glPushMatrix();
+ GL11.glColor4f(1, 1, 1, 1);
+ Tessellator tessellator = Tessellator.instance;
+ TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
+ texturemanager.bindTexture(curse);
+ GL11.glRotatef(rot, 0F, 1F, 0F);
+ GL11.glScalef(0.1F, 0.1F, 0.1F);
+ GL11.glTranslatef(-16F, 15F, -16F);
+ GL11.glRotatef(90F, 1F, 0F, 0F);
+ rot+=3F;
+ if (rot > 360F) rot = 0F;
+ float f = 0.00390625F;
+ float f1 = 0.00390625F;
+ int x = 0;
+ int y = 0;
+ int u = 32 * 7;
+ int v = 0;
+ int width = 32;
+ int height = 32;
+ tessellator.startDrawingQuads();
+ tessellator.addVertexWithUV((double)(x + 0), (double)(y + height), (double)0, (double)((float)(u + 0) * f), (double)((float)(v + height) * f1));
+ tessellator.addVertexWithUV((double)(x + width), (double)(y + height), (double)0, (double)((float)(u + width) * f), (double)((float)(v + height) * f1));
+ tessellator.addVertexWithUV((double)(x + width), (double)(y + 0), (double)0, (double)((float)(u + width) * f), (double)((float)(v + 0) * f1));
+ tessellator.addVertexWithUV((double)(x + 0), (double)(y + 0), (double)0, (double)((float)(u + 0) * f), (double)((float)(v + 0) * f1));
+ tessellator.draw();
+ GL11.glPopMatrix();
+ }
+
+ public String getDescription()
+ {
+ return "The Dark Lord has misterious ways of showing you his love.";
+ }
+}
diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseRabbitsPaw.java b/src/main/java/darkknight/jewelrycraft/curses/CurseRabbitsPaw.java
new file mode 100644
index 0000000..0e831c2
--- /dev/null
+++ b/src/main/java/darkknight/jewelrycraft/curses/CurseRabbitsPaw.java
@@ -0,0 +1,62 @@
+/**
+ *
+ */
+package darkknight.jewelrycraft.curses;
+
+import java.util.ArrayList;
+import darkknight.jewelrycraft.entities.EntityHalfHeart;
+import darkknight.jewelrycraft.entities.EntityHeart;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.item.EntityXPOrb;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.World;
+
+public class CurseRabbitsPaw extends Curse
+{
+ public CurseRabbitsPaw(int id, String name, int text)
+ {
+ super(id, name, text);
+ }
+
+ @Override
+ public void entityDropItems(EntityPlayer player, Entity target, ArrayList<EntityItem> drops)
+ {
+ for(EntityItem item: drops){
+ ItemStack drop = item.getEntityItem().copy();
+ drop.stackSize = this.rand.nextInt(4);
+ if (drop.stackSize > 0) target.entityDropItem(drop, 0.5F);
+ }
+ }
+
+ public void entityDeathAction(World world, EntityLivingBase target, EntityPlayer player)
+ {
+ String[] types = {"Red", "Blue", "White", "Black"};
+ String type = types[rand.nextInt(4)];
+ if (rand.nextInt(3) == 0){
+ if (type == "White"){
+ EntityHeart h = new EntityHalfHeart(world);
+ h.setType(type);
+ h.setLocationAndAngles(target.posX, target.posY, target.posZ, MathHelper.wrapAngleTo180_float(rand.nextFloat() * 360.0F), 0.0F);
+ world.spawnEntityInWorld(h);
+ }else{
+ for(int i = 1; i <= 1 + rand.nextInt(1 + (int)(target.getMaxHealth() / 20)); i++){
+ EntityHeart[] hearts = {new EntityHeart(world), new EntityHalfHeart(world)};
+ EntityHeart h = hearts[rand.nextInt(2)];
+ h.setType(type);
+ h.setLocationAndAngles(target.posX, target.posY, target.posZ, MathHelper.wrapAngleTo180_float(rand.nextFloat() * 360.0F), 0.0F);
+ world.spawnEntityInWorld(h);
+ }
+ }
+ }
+ if (rand.nextInt(3) == 0) world.spawnEntityInWorld(new EntityXPOrb(world, target.posX, target.posY, target.posZ, 1 + rand.nextInt(40)));
+ }
+
+ public String getDescription()
+ {
+ return "The Dark One is giving you a gift. Don't lose it.";
+ }
+}