summaryrefslogtreecommitdiff
path: root/java/darkknight/jewelrycraft/entities
diff options
context:
space:
mode:
authorOnyxDarkKnight <sor1n.iliutza16@gmail.com>2015-03-23 14:51:06 +0000
committerOnyxDarkKnight <sor1n.iliutza16@gmail.com>2015-03-23 14:51:06 +0000
commit6312636fd9a4d0f56dc7c9ff474a99d879bcb4e9 (patch)
treee3279753210bfb169a00cd3f146a80baf624150e /java/darkknight/jewelrycraft/entities
parente86949a1ad3269ec66c9de65e2c92f5e66251411 (diff)
Reworked the whole repo.
Diffstat (limited to 'java/darkknight/jewelrycraft/entities')
-rw-r--r--java/darkknight/jewelrycraft/entities/EntityHalfHeart.java45
-rw-r--r--java/darkknight/jewelrycraft/entities/EntityHeart.java107
-rw-r--r--java/darkknight/jewelrycraft/entities/renders/HeartRender.java44
-rw-r--r--java/darkknight/jewelrycraft/entities/renders/RenderHelper.java23
4 files changed, 0 insertions, 219 deletions
diff --git a/java/darkknight/jewelrycraft/entities/EntityHalfHeart.java b/java/darkknight/jewelrycraft/entities/EntityHalfHeart.java
deleted file mode 100644
index 4fc1e39..0000000
--- a/java/darkknight/jewelrycraft/entities/EntityHalfHeart.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- *
- */
-package darkknight.jewelrycraft.entities;
-
-import net.minecraft.entity.SharedMonsterAttributes;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.potion.Potion;
-import net.minecraft.potion.PotionEffect;
-import net.minecraft.world.World;
-import darkknight.jewelrycraft.JewelrycraftMod;
-import darkknight.jewelrycraft.network.PacketRequestPlayerInfo;
-import darkknight.jewelrycraft.util.PlayerUtils;
-
-/**
- * @author Sorin
- */
-public class EntityHalfHeart extends EntityHeart
-{
- public EntityHalfHeart(World world)
- {
- super(world);
- }
-
- @Override
- public void onCollideWithPlayer(EntityPlayer player)
- {
- if (!player.worldObj.isRemote){
- NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, "Jewelrycraft");
- if (getType().equals("Red") && player.getHealth() < player.getMaxHealth()){
- player.heal(1f);
- this.setDead();
- }else if (getType().equals("White") && playerInfo.getFloat("WhiteHeart") > 0.1F){
- playerInfo.setFloat(getType() + "Heart", 0F);
- player.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(player.getMaxHealth() + 2f);
- this.setDead();
- }else if (!getType().equals("Red") && playerInfo.getFloat(getType() + "Heart") < 20f){
- playerInfo.setFloat(getType() + "Heart", playerInfo.getFloat(getType() + "Heart") + 1.0F <= 20f ? playerInfo.getFloat(getType() + "Heart") + 1.0F : 20f);
- this.setDead();
- }
- }
- else JewelrycraftMod.netWrapper.sendToServer(new PacketRequestPlayerInfo());
- }
-}
diff --git a/java/darkknight/jewelrycraft/entities/EntityHeart.java b/java/darkknight/jewelrycraft/entities/EntityHeart.java
deleted file mode 100644
index ebd64e7..0000000
--- a/java/darkknight/jewelrycraft/entities/EntityHeart.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/**
- *
- */
-package darkknight.jewelrycraft.entities;
-
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
-import darkknight.jewelrycraft.JewelrycraftMod;
-import darkknight.jewelrycraft.network.PacketRequestPlayerInfo;
-import darkknight.jewelrycraft.util.PlayerUtils;
-import net.minecraft.block.material.Material;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.EntityLiving;
-import net.minecraft.entity.EntityLivingBase;
-import net.minecraft.entity.EnumCreatureAttribute;
-import net.minecraft.entity.SharedMonsterAttributes;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.entity.player.EntityPlayerMP;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.potion.Potion;
-import net.minecraft.util.DamageSource;
-import net.minecraft.world.World;
-
-/**
- * @author Sorin
- */
-public class EntityHeart extends EntityLiving
-{
- public EntityHeart(World world)
- {
- super(world);
- this.setSize(0.4F, 0.4F);
- }
-
- public boolean isEntityInvulnerable()
- {
- return true;
- }
-
- protected boolean canDespawn()
- {
- return false;
- }
-
- @Override
- public void onCollideWithPlayer(EntityPlayer player)
- {
- NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, "Jewelrycraft");
- if (getType() == "Red" && player.getHealth() < player.getMaxHealth()){
- player.heal(2f);
- this.setDead();
- }
- else if (getType() != "Red" && playerInfo.getFloat(getType() + "Heart") < 20f){
- playerInfo.setFloat(getType() + "Heart", playerInfo.getFloat(getType() + "Heart") + 2.0F <= 20f ? playerInfo.getFloat(getType() + "Heart") + 2.0F : 20f);
- JewelrycraftMod.netWrapper.sendToServer(new PacketRequestPlayerInfo());
- this.setDead();
- }
- }
-
- @Override
- protected void updateEntityActionState()
- {
- }
-
- @SideOnly(Side.CLIENT)
- public boolean canRenderOnFire()
- {
- return false;
- }
-
- protected void entityInit()
- {
- super.entityInit();
- this.dataWatcher.addObject(16, "Red");
- }
-
- public void writeEntityToNBT(NBTTagCompound nbt)
- {
- super.writeEntityToNBT(nbt);
- nbt.setString("Type", getType());
- }
-
- /**
- * (abstract) Protected helper method to read subclass entity data from NBT.
- */
- public void readEntityFromNBT(NBTTagCompound nbt)
- {
- super.readEntityFromNBT(nbt);
- setType(nbt.getString("Type"));
- }
-
- public String getType()
- {
- return this.dataWatcher.getWatchableObjectString(16);
- }
-
- public void setType(String type)
- {
- this.dataWatcher.updateObject(16, type);
- }
-
- public EnumCreatureAttribute getCreatureAttribute()
- {
- return EnumCreatureAttribute.UNDEAD;
- }
-
-}
diff --git a/java/darkknight/jewelrycraft/entities/renders/HeartRender.java b/java/darkknight/jewelrycraft/entities/renders/HeartRender.java
deleted file mode 100644
index 6005bb3..0000000
--- a/java/darkknight/jewelrycraft/entities/renders/HeartRender.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package darkknight.jewelrycraft.entities.renders;
-
-import org.lwjgl.opengl.GL11;
-import net.minecraft.client.model.ModelBase;
-import net.minecraft.client.renderer.entity.RenderLiving;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.EntityLivingBase;
-import net.minecraft.util.ResourceLocation;
-import darkknight.jewelrycraft.entities.EntityHeart;
-
-/**
- * @author Sorin
- */
-public class HeartRender extends RenderLiving
-{
- protected ResourceLocation texture;
-
- public HeartRender(ModelBase modelBase, float shadowSize)
- {
- super(modelBase, shadowSize);
-// texture = new ResourceLocation("jewelrycraft", "textures/entities/RedHeart.png");
- }
-
- @Override
- protected void preRenderCallback(EntityLivingBase entity, float f)
- {
- preRenderCallbackHeart((EntityHeart) entity, f);
- }
-
- protected void preRenderCallbackHeart(EntityHeart entity, float f)
- {
- GL11.glScalef(0.4F, 0.4F, 0.4F);
- GL11.glRotatef(55F, 1F, 0F, 0F);
- String type = entity.getType();
- if(type == "" || type == null) type = "Red";
- texture = new ResourceLocation("jewelrycraft", "textures/entities/"+type+"Heart.png");
- }
-
- @Override
- protected ResourceLocation getEntityTexture(Entity par1Entity)
- {
- return texture;
- }
-}
diff --git a/java/darkknight/jewelrycraft/entities/renders/RenderHelper.java b/java/darkknight/jewelrycraft/entities/renders/RenderHelper.java
deleted file mode 100644
index 16ddfe1..0000000
--- a/java/darkknight/jewelrycraft/entities/renders/RenderHelper.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package darkknight.jewelrycraft.entities.renders;
-
-import net.minecraft.client.Minecraft;
-import net.minecraft.entity.player.EntityPlayer;
-import org.lwjgl.opengl.GL11;
-
-public class RenderHelper
-{
- public static void rotateIfSneaking(EntityPlayer player)
- {
- if (player.isSneaking()) applySneakingRotation();
- }
-
- public static void applySneakingRotation()
- {
- GL11.glRotatef(28.64789F, 1.0F, 0.0F, 0.0F);
- }
-
- public static void translateToHeadLevel(EntityPlayer player)
- {
- GL11.glTranslated(0, (player != Minecraft.getMinecraft().thePlayer ? 1.62F : 0F) - player.getDefaultEyeHeight() + (player.isSneaking() ? 0.0625 : 0), 0);
- }
-} \ No newline at end of file