From 0427ab89f1753a44b30cbc35ce021cbbdc845109 Mon Sep 17 00:00:00 2001 From: Foghrye4 Date: Thu, 10 Aug 2017 18:52:45 +0300 Subject: fix missing source folder --- src/main/java/ihl/servitor/BoneBlock.java | 108 ++++++ src/main/java/ihl/servitor/FlameEntityFX.java | 87 +++++ src/main/java/ihl/servitor/FlameRenderFX.java | 55 +++ src/main/java/ihl/servitor/LostHeadEntity.java | 475 ++++++++++++++++++++++++ src/main/java/ihl/servitor/LostHeadRender.java | 40 ++ src/main/java/ihl/servitor/SkullItemRender.java | 78 ++++ src/main/java/ihl/servitor/SkullModel.java | 153 ++++++++ src/main/java/ihl/servitor/SkullModel.txt | 165 ++++++++ 8 files changed, 1161 insertions(+) create mode 100644 src/main/java/ihl/servitor/BoneBlock.java create mode 100644 src/main/java/ihl/servitor/FlameEntityFX.java create mode 100644 src/main/java/ihl/servitor/FlameRenderFX.java create mode 100644 src/main/java/ihl/servitor/LostHeadEntity.java create mode 100644 src/main/java/ihl/servitor/LostHeadRender.java create mode 100644 src/main/java/ihl/servitor/SkullItemRender.java create mode 100644 src/main/java/ihl/servitor/SkullModel.java create mode 100644 src/main/java/ihl/servitor/SkullModel.txt (limited to 'src/main/java/ihl/servitor') diff --git a/src/main/java/ihl/servitor/BoneBlock.java b/src/main/java/ihl/servitor/BoneBlock.java new file mode 100644 index 0000000..549a92b --- /dev/null +++ b/src/main/java/ihl/servitor/BoneBlock.java @@ -0,0 +1,108 @@ +package ihl.servitor; + +import java.util.List; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import ihl.IHLModInfo; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.passive.EntityPig; +import net.minecraft.init.Blocks; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.DamageSource; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BoneBlock extends Block { + IIcon textureSide2,textureSide3,textureSide4,textureTop; + + public BoneBlock(Material material) { + super(material); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister par1IconRegister) + { + this.blockIcon = par1IconRegister.registerIcon(IHLModInfo.MODID + ":boneBlockSide1"); + this.textureTop = par1IconRegister.registerIcon(IHLModInfo.MODID + ":boneBlockTop"); + this.textureSide2 = par1IconRegister.registerIcon(IHLModInfo.MODID + ":boneBlockSide2"); + this.textureSide3 = par1IconRegister.registerIcon(IHLModInfo.MODID + ":boneBlockSide3"); + this.textureSide4 = par1IconRegister.registerIcon(IHLModInfo.MODID + ":boneBlockSide4"); + } + + + @SuppressWarnings("rawtypes") + @Override + public void onNeighborBlockChange(World world, int x, int y, int z, Block block) + { + if(!world.isRemote) + { + if(world.getBlock(x, y+1, z)==Blocks.fire) + { + AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(x, y+1D, z, x+1D, y+2D, z+1D); + List pigList = world.getEntitiesWithinAABB(EntityPig.class, aabb); + if(pigList!=null && pigList.size()>0) + { + EntityPig pig = (EntityPig) pigList.get(0); + DamageSource ds = DamageSource.wither; + pig.attackEntityFrom(ds, 10F); + LostHeadEntity lh = new LostHeadEntity(world); + lh.setPosition(pig.posX,pig.posY,pig.posZ); + world.spawnEntityInWorld(lh); + } + } + } + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) + { + Block topBlock = world.getBlock(x, y+1, z); + Block bottomBlock = world.getBlock(x, y-1, z); + IIcon sideIcon = this.blockIcon; + if(topBlock==this && bottomBlock==this) + { + sideIcon = this.textureSide4; + } + else if(topBlock==this) + { + sideIcon = this.textureSide3; + } + else if(bottomBlock==this) + { + sideIcon = this.textureSide2; + } + switch (side) + { + case 0: + return this.textureTop; + case 1: + return this.textureTop; + default: + return sideIcon; + } + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int meta) + { + IIcon sideIcon = this.blockIcon; + switch (side) + { + case 0: + return this.textureTop; + case 1: + return this.textureTop; + default: + return sideIcon; + } + } +} diff --git a/src/main/java/ihl/servitor/FlameEntityFX.java b/src/main/java/ihl/servitor/FlameEntityFX.java new file mode 100644 index 0000000..783476e --- /dev/null +++ b/src/main/java/ihl/servitor/FlameEntityFX.java @@ -0,0 +1,87 @@ +package ihl.servitor; + +import net.minecraft.client.particle.EntityFX; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.world.World; + +public class FlameEntityFX extends EntityFX { + + public FlameEntityFX(World world, double x, double y, double z) + { + super(world, x, y, z); + this.renderDistanceWeight = 5.0D; + } + + public FlameEntityFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, float par14) + { + super(par1World, par2, par4, par6, 0.0D, 0.0D, 0.0D); + this.motionX *= 0.10000000149011612D; + this.motionY *= 0.10000000149011612D; + this.motionZ *= 0.10000000149011612D; + this.motionX += par8; + this.motionY += par10; + this.motionZ += par12; + this.particleScale *= par14; + this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D)); + this.noClip = false; + this.renderDistanceWeight = 6.0D; + } + + @Override + public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7) + { + float var8 = this.particleTextureIndexX / 4.0F; + float var9 = var8 + 0.0624375F*4F; + float var10 = this.particleTextureIndexY / 4.0F; + float var11 = var10 + 0.0624375F*4F; + float var12 = 0.1F * this.particleScale; + + float var13 = (float)(this.prevPosX + (this.posX - this.prevPosX) * par2 - interpPosX); + float var14 = (float)(this.prevPosY + (this.posY - this.prevPosY) * par2 - interpPosY); + float var15 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * par2 - interpPosZ); + par1Tessellator.addVertexWithUV(var13 - par3 * var12 - par6 * var12, var14 - par4 * var12, var15 - par5 * var12 - par7 * var12, var9, var11); + par1Tessellator.addVertexWithUV(var13 - par3 * var12 + par6 * var12, var14 + par4 * var12, var15 - par5 * var12 + par7 * var12, var9, var10); + par1Tessellator.addVertexWithUV(var13 + par3 * var12 + par6 * var12, var14 + par4 * var12, var15 + par5 * var12 + par7 * var12, var8, var10); + par1Tessellator.addVertexWithUV(var13 + par3 * var12 - par6 * var12, var14 - par4 * var12, var15 + par5 * var12 - par7 * var12, var8, var11); + } + + @Override + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + + if (this.particleAge++ >= this.particleMaxAge) + { + this.setDead(); + } + this.setParticleTextureIndex(this.particleAge * 15 / this.particleMaxAge); + this.motionY += 0.004D; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + + if (this.posY == this.prevPosY) + { + this.motionX *= 1.1D; + this.motionZ *= 1.1D; + } + + this.motionX *= 0.9599999785423279D; + this.motionY *= 0.9599999785423279D; + this.motionZ *= 0.9599999785423279D; + + if (this.onGround) + { + this.motionX *= 0.699999988079071D; + this.motionZ *= 0.699999988079071D; + } + } + + @Override + public void setParticleTextureIndex(int par1) + { + this.particleTextureIndexX = par1 % 4; + this.particleTextureIndexY = par1 / 4; + } + +} diff --git a/src/main/java/ihl/servitor/FlameRenderFX.java b/src/main/java/ihl/servitor/FlameRenderFX.java new file mode 100644 index 0000000..f90e378 --- /dev/null +++ b/src/main/java/ihl/servitor/FlameRenderFX.java @@ -0,0 +1,55 @@ +package ihl.servitor; + +import org.lwjgl.opengl.GL11; + +import net.minecraft.client.particle.EntityFX; +import net.minecraft.client.renderer.ActiveRenderInfo; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.entity.Entity; +import net.minecraft.util.ResourceLocation; + +public class FlameRenderFX extends Render{ + private ResourceLocation tex; + +public FlameRenderFX(String textureLocation) +{ + super(); + tex = new ResourceLocation(textureLocation); +} + +@Override +public void doRender(Entity entity, double x, double y, double z, + float arg4, float arg5) +{ + float var3 = ActiveRenderInfo.rotationX; + float var4 = ActiveRenderInfo.rotationZ; + float var5 = ActiveRenderInfo.rotationYZ; + float var6 = ActiveRenderInfo.rotationXY; + float var7 = ActiveRenderInfo.rotationXZ; + EntityFX.interpPosX = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * arg4; + EntityFX.interpPosY = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * arg4; + EntityFX.interpPosZ = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * arg4; + this.renderManager.renderEngine.bindTexture(tex); + GL11.glPushMatrix(); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glTranslatef((float)x, (float)y, (float)z); + GL11.glDepthMask(false); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); + Tessellator var9 = Tessellator.instance; + var9.startDrawingQuads(); + EntityFX var11 = (EntityFX) entity; + var11.renderParticle(var9, arg4, var3, var7, var4, var5, var6); + var9.draw(); + GL11.glDisable(GL11.GL_BLEND); + GL11.glDepthMask(true); + GL11.glPopMatrix(); +} + + @Override + protected ResourceLocation getEntityTexture(Entity arg0) + { + return tex; + } +} \ No newline at end of file diff --git a/src/main/java/ihl/servitor/LostHeadEntity.java b/src/main/java/ihl/servitor/LostHeadEntity.java new file mode 100644 index 0000000..704743b --- /dev/null +++ b/src/main/java/ihl/servitor/LostHeadEntity.java @@ -0,0 +1,475 @@ +package ihl.servitor; + +import java.util.List; + +import ic2.api.item.IC2Items; +import ihl.IHLMod; +import ihl.IHLModInfo; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityFlying; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.monster.IMob; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraft.world.EnumDifficulty; +import net.minecraft.world.World; + +public class LostHeadEntity extends EntityFlying implements IMob +{ + public int courseChangeCooldown; + public double waypointX; + public double waypointY; + public double waypointZ; + private Entity targetedEntity; + + /** Cooldown time between target loss and new target aquirement. */ + private int aggroCooldown; + public int prevAttackCounter; + public int attackCounter; + public int attackCounterIncrement; + + private final double psr = 0.5D; + private final double delta = 0.35D; + + private final double damage = 4D; + private final double knockbackStrength=2D; + + + public LostHeadEntity(World par1World) + { + super(par1World); + this.setSize(1.0F, 1.0F); + this.isImmuneToFire = true; + this.experienceValue = 5; + } + + public boolean func_110182_bF() + { + return this.dataWatcher.getWatchableObjectByte(16) != 0; + } + + /** + * Called when the entity is attacked. + */ + @Override + public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) + { + if (this.isEntityInvulnerable()) + { + return false; + } + else + { + return super.attackEntityFrom(par1DamageSource, par2); + } + } + + @Override + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(16, Byte.valueOf((byte)0)); + } + + @Override + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(10.0D); + } + + @SuppressWarnings("unchecked") + @Override + public void onLivingUpdate() + { + super.onLivingUpdate(); + if(worldObj.isRemote) + { + double x1,y1,z1,x2,z2; + x1=this.prevPosX+psr*Math.sin(-rotationYaw/180D*Math.PI+delta+Math.random()*0.1D-0.05D); + z1=this.prevPosZ+psr*Math.cos(-rotationYaw/180D*Math.PI+delta+Math.random()*0.1D-0.05D); + x2=this.prevPosX+psr*Math.sin(-rotationYaw/180D*Math.PI-delta+Math.random()*0.1D-0.05D); + z2=this.prevPosZ+psr*Math.cos(-rotationYaw/180D*Math.PI-delta+Math.random()*0.1D-0.05D); + y1=this.prevPosY+psr*Math.sin(rotationPitch/180D*Math.PI+Math.random()*0.1D-0.05D)+0.4D; + IHLMod.proxy.spawnParticle(0,worldObj, x1,y1,z1,0D,0.1D,0D,1F); + IHLMod.proxy.spawnParticle(0,worldObj, x2,y1,z2,0D,0.1D,0D,1F); + } + //this part was mindlessly taken from EntityArrow. + Vec3 var17 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ); + Vec3 var3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + MovingObjectPosition var4 = this.worldObj.func_147447_a(var17, var3, false, true, false); + var17 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ); + var3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + + if (var4 != null) + { + var3 = Vec3.createVectorHelper(var4.hitVec.xCoord, var4.hitVec.yCoord, var4.hitVec.zCoord); + } + + Entity var5 = null; + List var6 = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); + double var7 = 0.0D; + int var9; + float var11; + + for (var9 = 0; var9 < var6.size(); ++var9) + { + Entity var10 = (Entity)var6.get(var9); + + if (var10.canBeCollidedWith()) + { + var11 = 0.3F; + AxisAlignedBB var12 = var10.boundingBox.expand(var11, var11, var11); + MovingObjectPosition var13 = var12.calculateIntercept(var17, var3); + + if (var13 != null) + { + double var14 = var17.distanceTo(var13.hitVec); + + if (var14 < var7 || var7 == 0.0D) + { + var5 = var10; + var7 = var14; + } + } + } + } + + + if (var5 != null) + { + var4 = new MovingObjectPosition(var5); + } + + float var19; + float var26; + + if (var4 != null) + { + if (var4.entityHit != null) + { + var19 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); + int var23 = MathHelper.ceiling_double_int(var19 * this.damage); + + DamageSource var21 = DamageSource.causeThrownDamage(this, this); + + if (var4.entityHit.attackEntityFrom(var21, var23)) + { + if (var4.entityHit instanceof EntityLivingBase) + { + var26 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + if (var26 > 0.0F) + { + var4.entityHit.addVelocity(this.motionX * this.knockbackStrength * 0.6D / var26, 0.1D, this.motionZ * this.knockbackStrength * 0.6D / var26); + } + } + } + } + } + } + + + @Override + protected void updateEntityActionState() + { + if (!this.worldObj.isRemote && this.worldObj.difficultySetting == EnumDifficulty.PEACEFUL) + { + this.setDead(); + } + + this.despawnEntity(); + this.prevAttackCounter = this.attackCounter; + double var1 = this.waypointX - this.posX; + double var3 = this.waypointY - this.posY; + double var5 = this.waypointZ - this.posZ; + double var7 = var1 * var1 + var3 * var3 + var5 * var5; + + if (var7 < 1.0D || var7 > 3600.0D) + { + this.waypointX = this.posX + (this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F; + this.waypointY = this.posY + (this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F; + this.waypointZ = this.posZ + (this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F; + } + + if (this.courseChangeCooldown-- <= 0) + { + this.courseChangeCooldown += this.rand.nextInt(5) + 2; + var7 = MathHelper.sqrt_double(var7); + + if (this.isCourseTraversable(this.waypointX, this.waypointY, this.waypointZ, var7)) + { + this.motionX += var1 / var7 * 0.02D; + this.motionY += var3 / var7 * 0.02D; + this.motionZ += var5 / var7 * 0.02D; + } + else + { + this.waypointX = this.posX; + this.waypointY = this.posY; + this.waypointZ = this.posZ; + } + } + + if (this.targetedEntity != null && this.targetedEntity.isDead) + { + if (!this.worldObj.isRemote) + { + this.playSound(IHLModInfo.MODID+":lostHeadLaughtLong", 10F, this.getSoundPitch()); + } + this.targetedEntity = null; + } + + if (this.targetedEntity == null || this.aggroCooldown-- <= 0) + { + this.targetedEntity = this.worldObj.getClosestVulnerablePlayerToEntity(this, 100.0D); + + if (this.targetedEntity != null) + { + this.aggroCooldown = 20; + } + } + + double var9 = 64.0D; + + if (this.targetedEntity != null && this.targetedEntity.getDistanceSqToEntity(this) < var9 * var9) + { + double var11 = this.targetedEntity.posX - this.posX; + double var15 = this.targetedEntity.posZ - this.posZ; + this.renderYawOffset = this.rotationYaw = -((float)Math.atan2(var11, var15)) * 180.0F / (float)Math.PI; + + if (this.canEntityBeSeen(this.targetedEntity)) + { + if (this.attackCounter == 70) + { + //play attack scream before attack + if (!this.worldObj.isRemote) + { + this.playSound(IHLModInfo.MODID+":lostHeadLaught", 10F, this.getSoundPitch()); + } + } + + ++this.attackCounter; + + if (this.attackCounter == 80) + { + //play fire sound before attack + this.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1008, (int)this.posX, (int)this.posY, (int)this.posZ, 0); + double vX = this.targetedEntity.posX-this.posX; + double vY = this.targetedEntity.posY+this.targetedEntity.height-this.posY; + double vZ = this.targetedEntity.posZ-this.posZ; + this.motionX=vX*0.1D; + this.motionY=vY*0.1D; + this.motionZ=vZ*0.1D; + this.courseChangeCooldown=40; + this.attackCounter = -60; + } + } + else if (this.attackCounter > 0) + { + --this.attackCounter; + } + } + else + { + float rYaw=-((float)Math.atan2(this.motionX, this.motionZ)) * 180.0F / (float)Math.PI; + float rYawD=this.rotationYaw-rYaw; + this.renderYawOffset = this.rotationYaw -= rYawD*0.2F; + + if (this.attackCounter > 0) + { + --this.attackCounter; + } + } + + if (!this.worldObj.isRemote) + { + byte var21 = this.dataWatcher.getWatchableObjectByte(16); + byte var12 = (byte)(this.attackCounter > 10 ? 1 : 0); + + if (var21 != var12) + { + this.dataWatcher.updateObject(16, Byte.valueOf(var12)); + } + } + } + + /** + * True if the ghast has an unobstructed line of travel to the waypoint. + */ + private boolean isCourseTraversable(double par1, double par3, double par5, double par7) + { + double var9 = (this.waypointX - this.posX) / par7; + double var11 = (this.waypointY - this.posY) / par7; + double var13 = (this.waypointZ - this.posZ) / par7; + AxisAlignedBB var15 = this.boundingBox.copy(); + + for (int var16 = 1; var16 < par7; ++var16) + { + var15.offset(var9, var11, var13); + + if (!this.worldObj.getCollidingBoundingBoxes(this, var15).isEmpty()) + { + return false; + } + } + + return true; + } + + /** + * Returns the sound this mob makes while it's alive. + */ + @Override + protected String getLivingSound() + { + return IHLModInfo.MODID+":lostHeadCry"; + } + + @Override + public int getTalkInterval() + { + return 400; + } + /** + * Returns the sound this mob makes when it is hurt. + */ + @Override + protected String getHurtSound() + { + return IHLModInfo.MODID+":lostHeadScream"; + } + + /** + * Returns the sound this mob makes on death. + */ + @Override + protected String getDeathSound() + { + return IHLModInfo.MODID+":lostHeadDeath"; + } + + /** + * Drop 0-2 items of this living's type + */ + @Override + protected void dropFewItems(boolean par1, int par2) + { + int var3 = this.rand.nextInt(2) + this.rand.nextInt(1 + par2); + int var4; + + if(var3==0) + { + this.entityDropItem(new ItemStack(IHLMod.ihlSkull,1), 1); + } + else + { + for (var4 = 0; var4 < var3; ++var4) + { + this.entityDropItem(new ItemStack(Items.dye, 1, 15), 1); + } + } + + var3 = this.rand.nextInt(3) + this.rand.nextInt(1 + par2); + + for (var4 = 0; var4 < var3; ++var4) + { + this.entityDropItem(IC2Items.getItem("smallTinDust"), 1); + } + } + + /** + * Returns the volume for the sounds this mob makes. + */ + @Override + protected float getSoundVolume() + { + return 1.0F; + } + + /** + * Checks if the entity's current position is a valid location to spawn this entity. + */ + @Override + public boolean getCanSpawnHere() + { + return this.rand.nextInt(20) == 0 && super.getCanSpawnHere() && this.worldObj.difficultySetting != EnumDifficulty.PEACEFUL; + } + + /** + * Will return how many at most can spawn in a chunk at once. + */ + @Override + public int getMaxSpawnedInChunk() + { + return 1; + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + @Override + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + super.writeEntityToNBT(par1NBTTagCompound); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + @Override + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + super.readEntityFromNBT(par1NBTTagCompound); + } + + @Override + public void moveEntityWithHeading(float par1, float par2) + { + if (this.isInWater()) + { + this.moveFlying(par1, par2, 0.02F); + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.800000011920929D; + this.motionY *= 0.800000011920929D; + this.motionZ *= 0.800000011920929D; + } + else if (this.handleLavaMovement()) + { + this.moveFlying(par1, par2, 0.02F); + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.5D; + this.motionY *= 0.5D; + this.motionZ *= 0.5D; + } + else + { + float var3 = 0.91F; + + if (this.onGround) + { + var3 = this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ)).slipperiness * 0.91F; + } + + float var4 = 0.16277136F / (var3 * var3 * var3); + this.moveFlying(par1, par2, this.onGround ? 0.1F * var4 : 0.02F); + var3 = 0.98F; + + if (this.onGround) + { + var3 = this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ)).slipperiness * 0.91F; + } + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= var3; + this.motionY *= var3; + this.motionZ *= var3; + } + } +} diff --git a/src/main/java/ihl/servitor/LostHeadRender.java b/src/main/java/ihl/servitor/LostHeadRender.java new file mode 100644 index 0000000..f4e7cb9 --- /dev/null +++ b/src/main/java/ihl/servitor/LostHeadRender.java @@ -0,0 +1,40 @@ +package ihl.servitor; + +import org.lwjgl.opengl.GL11; + +import ihl.IHLModInfo; +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.entity.Entity; +import net.minecraft.util.ResourceLocation; + +public class LostHeadRender extends Render{ + private SkullModel model = new SkullModel(); + private ResourceLocation tex; + private float scale; + +public LostHeadRender() +{ + super(); + scale = 1F/80F; + tex = new ResourceLocation(IHLModInfo.MODID+":textures/items/skull.png"); +} + +@Override +public void doRender(Entity entity, double x, double y, double z, + float arg4, float arg5) +{ + bindTexture(tex); + GL11.glPushMatrix(); + GL11.glTranslated(x, y, z); + GL11.glScalef(1.0F, -1F, -1F); + GL11.glRotated(entity.rotationYaw+180D, 0D, 1.0D, 0D); + model.Base.render(scale); + GL11.glPopMatrix(); +} + + @Override + protected ResourceLocation getEntityTexture(Entity arg0) + { + return tex; + } +} \ No newline at end of file diff --git a/src/main/java/ihl/servitor/SkullItemRender.java b/src/main/java/ihl/servitor/SkullItemRender.java new file mode 100644 index 0000000..8b9e2b7 --- /dev/null +++ b/src/main/java/ihl/servitor/SkullItemRender.java @@ -0,0 +1,78 @@ +package ihl.servitor; + +import org.lwjgl.opengl.GL11; + +import ihl.IHLModInfo; +import net.minecraft.client.Minecraft; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.IItemRenderer; + +public class SkullItemRender implements IItemRenderer{ + private SkullModel model = new SkullModel(); + private ResourceLocation tex; + private float scale; + +public SkullItemRender() +{ + super(); + scale = 1F/80F; + tex = new ResourceLocation(IHLModInfo.MODID+":textures/items/skull.png"); +} + +@Override +public void renderItem(ItemRenderType type, ItemStack item, Object... data) +{ + GL11.glPushMatrix(); + switch(type) + { + case EQUIPPED_FIRST_PERSON: + GL11.glRotatef(80F, 0.0F, 1.0F, 0.0F); + GL11.glTranslatef(0F, 0.18F, 1F); + GL11.glScalef(1.5F, -1.5F, -1.5F); + break; + case ENTITY: + GL11.glTranslatef(0F, 1.0F, 0F); + GL11.glScalef(1.0F, -1F, -1F); + break; + case INVENTORY: + GL11.glRotatef(210F, 0F, 1.0F, -0.15F); + GL11.glTranslatef(0.0F,-0.75F,0.0F); + GL11.glScalef(1.5F, -1.5F, -1.5F); + break; + case EQUIPPED: + GL11.glTranslatef(0.5F,0.5F,0.25F); + GL11.glScalef(1.0F, -1F, -1F); + break; + default: + break; + } + Minecraft.getMinecraft().renderEngine.bindTexture(tex); + model.Base.render(scale); + GL11.glPopMatrix(); +} + +/** + * IItemRenderer implementation * + */ +@Override +public boolean handleRenderType(ItemStack item, ItemRenderType type) { + switch (type) { + case ENTITY: + return true; + case EQUIPPED: + return true; + case EQUIPPED_FIRST_PERSON: + return true; + case INVENTORY: + return true; + default: + return false; + } +} + +@Override +public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { + return true; +} +} \ No newline at end of file diff --git a/src/main/java/ihl/servitor/SkullModel.java b/src/main/java/ihl/servitor/SkullModel.java new file mode 100644 index 0000000..1bdbdcf --- /dev/null +++ b/src/main/java/ihl/servitor/SkullModel.java @@ -0,0 +1,153 @@ +package ihl.servitor; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class SkullModel extends ModelBase +{ + //fields + ModelRenderer Base; + + public SkullModel() + { + textureWidth = 256; + textureHeight = 256; + setTextureOffset("Base.Shape2", 110, 11); + setTextureOffset("Base.Shape3", 59, 62); + setTextureOffset("Base.Shape4", 83, 59); + setTextureOffset("Base.Shape5", 83, 59); + setTextureOffset("Base.Shape6", 0, 18); + setTextureOffset("Base.Shape8", 0, 26); + setTextureOffset("Base.Shape9", 2, 33); + setTextureOffset("Base.Shape10", 26, 37); + setTextureOffset("Base.Shape11", 28, 157); + setTextureOffset("Base.Shape12", 83, 111); + setTextureOffset("Base.Shape13", 67, 110); + setTextureOffset("Base.Shape14", 72, 99); + setTextureOffset("Base.Shape15", 92, 114); + setTextureOffset("Base.Shape16", 102, 112); + setTextureOffset("Base.Shape17", 82, 107); + setTextureOffset("Base.Shape18", 71, 108); + setTextureOffset("Base.Shape19", 89, 114); + setTextureOffset("Base.Shape20", 90, 124); + setTextureOffset("Base.Shape21", 106, 31); + setTextureOffset("Base.Shape22", 77, 139); + setTextureOffset("Base.Shape23", 115, 193); + setTextureOffset("Base.Shape24", 1, 163); + setTextureOffset("Base.Shape25", 127, 117); + setTextureOffset("Base.Shape26", 81, 116); + setTextureOffset("Base.Shape27", 81, 115); + setTextureOffset("Base.Shape28", 81, 114); + setTextureOffset("Base.Shape29", 6, 167); + setTextureOffset("Base.Shape1", 0, 154); + setTextureOffset("Base.Shape7", 92, 124); + setTextureOffset("Base.Shape30", 89, 124); + setTextureOffset("Base.Shape31", 128, 193); + setTextureOffset("Base.Shape32", 106, 88); + setTextureOffset("Base.Shape33", 109, 70); + setTextureOffset("Base.Shape34", 166, 109); + setTextureOffset("Base.Shape35", 100, 53); + setTextureOffset("Base.Shape36", 169, 98); + setTextureOffset("Base.Shape37", 99, 81); + setTextureOffset("Base.Shape38", 101, 108); + setTextureOffset("Base.Shape39", 92, 85); + setTextureOffset("Base.Shape40", 22, 89); + setTextureOffset("Base.Shape41", 62, 151); + setTextureOffset("Base.Shape42", 37, 97); + setTextureOffset("Base.Shape43", 9, 101); + setTextureOffset("Base.Shape44", 77, 15); + setTextureOffset("Base.Shape45", 18, 145); + setTextureOffset("Base.Shape46", 28, 156); + setTextureOffset("Base.Shape47", 28, 155); + setTextureOffset("Base.Shape48", 106, 104); + setTextureOffset("Base.Shape49", 77, 129); + setTextureOffset("Base.Shape50", 25, 82); + setTextureOffset("Base.Shape51", 46, 33); + setTextureOffset("Base.Shape52", 101, 85); + setTextureOffset("Base.Shape53", 141, 38); + setTextureOffset("Base.Shape54", 24, 149); + setTextureOffset("Base.Shape55", 83, 132); + setTextureOffset("Base.Shape56", 99, 132); + setTextureOffset("Base.Shape57", 30, 186); + setTextureOffset("Base.Shape58", 142, 220); + + Base = new ModelRenderer(this, "Base"); + Base.setRotationPoint(0F, -30F, -30F); + setRotation(Base, 0F, 0F, 0F); + Base.mirror = false; + Base.addBox("Shape2", -25F, -24F, 18F, 8, 24, 34); + Base.addBox("Shape3", -23F, -28F, 13F, 46, 4, 38); + Base.addBox("Shape4", -22F, -30F, 14F, 44, 2, 37); + Base.addBox("Shape5", -21F, -32F, 12F, 42, 2, 39); + Base.addBox("Shape6", -19F, -34F, 9F, 38, 2, 43); + Base.addBox("Shape8", -17F, -36F, 11F, 34, 2, 46); + Base.addBox("Shape9", -15F, -38F, 13F, 28, 2, 42); + Base.addBox("Shape10", -9F, -40F, 21F, 20, 2, 24); + Base.addBox("Shape11", -13F, -24F, 1F, 26, 26, 3); + Base.addBox("Shape12", -16F, -11.2F, 66F, 14, 4, 2); + Base.addBox("Shape13", 2F, -11.2F, 66F, 14, 4, 2); + Base.addBox("Shape14", -9F, -24F, 66F, 18, 17, 1); + Base.addBox("Shape15", -2F, -7F, 65F, 4, 7, 3); + Base.addBox("Shape16", -2F, -4F, 68F, 4, 4, 1); + Base.addBox("Shape17", 2F, -10F, 64F, 3, 4, 5); + Base.addBox("Shape18", -5F, -10F, 64F, 3, 4, 5); + Base.addBox("Shape19", -6F, 0F, 65F, 4, 1, 1); + Base.addBox("Shape20", -16F, 1F, 63F, 12, 5, 4); + Base.addBox("Shape21", -24F, 0F, 18F, 8, 4, 38); + Base.addBox("Shape22", -8F, 10F, 66F, 16, 5, 2); + Base.addBox("Shape23", -16F, 4F, 7F, 9, 3, 56); + Base.addBox("Shape24", -10F, 7F, 16F, 8, 3, 52); + Base.addBox("Shape25", -10F, 16F, 17F, 20, 1, 12); + Base.addBox("Shape26", -10F, 15F, 15F, 20, 1, 15); + Base.addBox("Shape27", -11F, 14F, 13F, 22, 1, 18); + Base.addBox("Shape28", -11F, 13F, 11F, 22, 1, 21); + Base.addBox("Shape29", -12F, 7.1F, 8F, 24, 6, 26); + Base.addBox("Shape1", 2F, 7F, 16F, 8, 3, 52); + Base.addBox("Shape7", 2F, 0F, 65F, 4, 1, 1); + Base.addBox("Shape30", 4F, 1F, 63F, 12, 5, 4); + Base.addBox("Shape31", 7F, 4F, 7F, 9, 3, 56); + Base.addBox("Shape32", 16F, 0F, 18F, 8, 4, 38); + Base.addBox("Shape33", 17F, -24F, 18F, 8, 24, 34); + Base.addBox("Shape34", 18F, -7F, 52F, 6, 7, 9); + Base.addBox("Shape35", -24F, -7F, 52F, 6, 7, 9); + Base.addBox("Shape36", 16F, -13F, 56F, 6, 16, 6); + Base.addBox("Shape37", 18F, -24F, 52F, 2, 17, 12); + Base.addBox("Shape38", -22F, -13F, 56F, 6, 16, 6); + Base.addBox("Shape39", -20F, -24F, 52F, 2, 17, 12); + Base.addBox("Shape40", -18F, -28F, 51F, 36, 4, 13); + Base.addBox("Shape41", -17.5F, -30F, 34F, 35, 2, 29); + Base.addBox("Shape42", -18F, -24F, 62F, 36, 17, 4); + Base.addBox("Shape43", -17F, -32F, 7F, 34, 2, 54); + Base.addBox("Shape44", -16.2F, -34F, 51F, 32, 2, 8); + Base.addBox("Shape45", -19.5F, -33F, 8F, 39, 37, 8); + Base.addBox("Shape46", -14F, -26F, 2F, 28, 30, 1); + Base.addBox("Shape47", -15F, -28F, 3F, 30, 32, 2); + Base.addBox("Shape48", -18F, -1F, 56F, 3, 5, 8); + Base.addBox("Shape49", 15F, -1F, 56F, 3, 5, 8); + Base.addBox("Shape50", -5F, -39F, 15F, 12, 1, 6); + Base.addBox("Shape51", -6F, -39F, 45F, 12, 1, 6); + Base.addBox("Shape52", -21.5F, -31F, 11F, 43, 34, 6); + Base.addBox("Shape53", -23.5F, -24F, 13F, 47, 26, 5); + Base.addBox("Shape54", -17F, -30F, 5F, 34, 34, 3); + Base.addBox("Shape55", 8F, 10F, 58F, 2, 4, 9); + Base.addBox("Shape56", -10F, 10F, 58F, 2, 4, 8); + Base.addBox("Shape57", -9F, 4F, 3F, 18, 5, 5); + Base.addBox("Shape58", -8F, 10F, 41F, 16, 1, 25); + } + + @Override +public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) + { + super.render(entity, f, f1, f2, f3, f4, f5); + Base.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) + { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + +} diff --git a/src/main/java/ihl/servitor/SkullModel.txt b/src/main/java/ihl/servitor/SkullModel.txt new file mode 100644 index 0000000..be648bd --- /dev/null +++ b/src/main/java/ihl/servitor/SkullModel.txt @@ -0,0 +1,165 @@ +// Date: 12.07.2014 13:37:52 +// Template version 1.1 +// Java generated by Techne +// Keep in mind that you still need to fill in some blanks +// - ZeuX + + + + + + +package net.minecraft.src; + +public class ModelShieldModel extends ModelBase +{ + //fields + ModelRenderer Base; + + public ModelShieldModel() + { + textureWidth = 256; + textureHeight = 256; + setTextureOffset("Base.Shape2", 110, 11); + setTextureOffset("Base.Shape3", 59, 62); + setTextureOffset("Base.Shape4", 83, 59); + setTextureOffset("Base.Shape5", 83, 59); + setTextureOffset("Base.Shape6", 0, 18); + setTextureOffset("Base.Shape8", 0, 26); + setTextureOffset("Base.Shape9", 2, 33); + setTextureOffset("Base.Shape10", 26, 37); + setTextureOffset("Base.Shape11", 28, 157); + setTextureOffset("Base.Shape12", 83, 111); + setTextureOffset("Base.Shape13", 67, 110); + setTextureOffset("Base.Shape14", 72, 99); + setTextureOffset("Base.Shape15", 92, 114); + setTextureOffset("Base.Shape16", 102, 112); + setTextureOffset("Base.Shape17", 82, 107); + setTextureOffset("Base.Shape18", 71, 108); + setTextureOffset("Base.Shape19", 89, 114); + setTextureOffset("Base.Shape20", 90, 124); + setTextureOffset("Base.Shape21", 106, 31); + setTextureOffset("Base.Shape22", 77, 139); + setTextureOffset("Base.Shape23", 115, 193); + setTextureOffset("Base.Shape24", 1, 163); + setTextureOffset("Base.Shape25", 127, 117); + setTextureOffset("Base.Shape26", 81, 116); + setTextureOffset("Base.Shape27", 81, 115); + setTextureOffset("Base.Shape28", 81, 114); + setTextureOffset("Base.Shape29", 6, 167); + setTextureOffset("Base.Shape1", 0, 154); + setTextureOffset("Base.Shape7", 92, 124); + setTextureOffset("Base.Shape30", 89, 124); + setTextureOffset("Base.Shape31", 128, 193); + setTextureOffset("Base.Shape32", 106, 88); + setTextureOffset("Base.Shape33", 109, 70); + setTextureOffset("Base.Shape34", 166, 109); + setTextureOffset("Base.Shape35", 100, 53); + setTextureOffset("Base.Shape36", 169, 98); + setTextureOffset("Base.Shape37", 99, 81); + setTextureOffset("Base.Shape38", 101, 108); + setTextureOffset("Base.Shape39", 92, 85); + setTextureOffset("Base.Shape40", 22, 89); + setTextureOffset("Base.Shape41", 62, 151); + setTextureOffset("Base.Shape42", 37, 97); + setTextureOffset("Base.Shape43", 9, 101); + setTextureOffset("Base.Shape44", 77, 15); + setTextureOffset("Base.Shape45", 18, 145); + setTextureOffset("Base.Shape46", 28, 156); + setTextureOffset("Base.Shape47", 28, 155); + setTextureOffset("Base.Shape48", 106, 104); + setTextureOffset("Base.Shape49", 77, 129); + setTextureOffset("Base.Shape50", 25, 82); + setTextureOffset("Base.Shape51", 46, 33); + setTextureOffset("Base.Shape52", 101, 85); + setTextureOffset("Base.Shape53", 141, 38); + setTextureOffset("Base.Shape54", 24, 149); + setTextureOffset("Base.Shape55", 83, 132); + setTextureOffset("Base.Shape56", 99, 132); + setTextureOffset("Base.Shape57", 30, 186); + setTextureOffset("Base.Shape58", 142, 220); + + Base = new ModelRenderer(this, "Base"); + Base.setRotationPoint(0F, -30F, -30F); + setRotation(Base, 0F, 0F, 0F); + Base.mirror = true; + Base.addBox("Shape2", -25F, -24F, 18F, 8, 24, 34); + Base.addBox("Shape3", -23F, -28F, 13F, 46, 4, 38); + Base.addBox("Shape4", -22F, -30F, 14F, 44, 2, 37); + Base.addBox("Shape5", -21F, -32F, 12F, 42, 2, 39); + Base.addBox("Shape6", -19F, -34F, 9F, 38, 2, 43); + Base.addBox("Shape8", -17F, -36F, 11F, 34, 2, 46); + Base.addBox("Shape9", -15F, -38F, 13F, 28, 2, 42); + Base.addBox("Shape10", -9F, -40F, 21F, 20, 2, 24); + Base.addBox("Shape11", -13F, -24F, 1F, 26, 26, 3); + Base.addBox("Shape12", -16F, -11,2F, 66F, 14, 4, 2); + Base.addBox("Shape13", 2F, -11,2F, 66F, 14, 4, 2); + Base.addBox("Shape14", -9F, -24F, 66F, 18, 17, 1); + Base.addBox("Shape15", -2F, -7F, 65F, 4, 7, 3); + Base.addBox("Shape16", -2F, -4F, 68F, 4, 4, 1); + Base.addBox("Shape17", 2F, -10F, 64F, 3, 4, 5); + Base.addBox("Shape18", -5F, -10F, 64F, 3, 4, 5); + Base.addBox("Shape19", -6F, 0F, 65F, 4, 1, 1); + Base.addBox("Shape20", -16F, 1F, 63F, 12, 5, 4); + Base.addBox("Shape21", -24F, 0F, 18F, 8, 4, 38); + Base.addBox("Shape22", -8F, 10F, 66F, 16, 5, 2); + Base.addBox("Shape23", -16F, 4F, 7F, 9, 3, 56); + Base.addBox("Shape24", -10F, 7F, 16F, 8, 3, 52); + Base.addBox("Shape25", -10F, 16F, 17F, 20, 1, 12); + Base.addBox("Shape26", -10F, 15F, 15F, 20, 1, 15); + Base.addBox("Shape27", -11F, 14F, 13F, 22, 1, 18); + Base.addBox("Shape28", -11F, 13F, 11F, 22, 1, 21); + Base.addBox("Shape29", -12F, 7,1F, 8F, 24, 6, 26); + Base.addBox("Shape1", 2F, 7F, 16F, 8, 3, 52); + Base.addBox("Shape7", 2F, 0F, 65F, 4, 1, 1); + Base.addBox("Shape30", 4F, 1F, 63F, 12, 5, 4); + Base.addBox("Shape31", 7F, 4F, 7F, 9, 3, 56); + Base.addBox("Shape32", 16F, 0F, 18F, 8, 4, 38); + Base.addBox("Shape33", 17F, -24F, 18F, 8, 24, 34); + Base.addBox("Shape34", 18F, -7F, 52F, 6, 7, 9); + Base.addBox("Shape35", -24F, -7F, 52F, 6, 7, 9); + Base.addBox("Shape36", 16F, -13F, 56F, 6, 16, 6); + Base.addBox("Shape37", 18F, -24F, 52F, 2, 17, 12); + Base.addBox("Shape38", -22F, -13F, 56F, 6, 16, 6); + Base.addBox("Shape39", -20F, -24F, 52F, 2, 17, 12); + Base.addBox("Shape40", -18F, -28F, 51F, 36, 4, 13); + Base.addBox("Shape41", -17,5F, -30F, 34F, 35, 2, 29); + Base.addBox("Shape42", -18F, -24F, 62F, 36, 17, 4); + Base.addBox("Shape43", -17F, -32F, 7F, 34, 2, 54); + Base.addBox("Shape44", -16,24F, -34,04F, 51F, 32, 2, 8); + Base.addBox("Shape45", -19,5F, -33F, 8F, 39, 37, 8); + Base.addBox("Shape46", -14F, -26F, 2F, 28, 30, 1); + Base.addBox("Shape47", -15F, -28F, 3F, 30, 32, 2); + Base.addBox("Shape48", -18F, -1F, 56F, 3, 5, 8); + Base.addBox("Shape49", 15F, -1F, 56F, 3, 5, 8); + Base.addBox("Shape50", -5F, -39F, 15F, 12, 1, 6); + Base.addBox("Shape51", -6F, -39F, 45F, 12, 1, 6); + Base.addBox("Shape52", -21,5F, -31F, 11F, 43, 34, 6); + Base.addBox("Shape53", -23,5F, -24F, 13F, 47, 26, 5); + Base.addBox("Shape54", -17F, -30F, 5F, 34, 34, 3); + Base.addBox("Shape55", 8F, 10F, 58F, 2, 4, 9); + Base.addBox("Shape56", -10F, 10F, 58F, 2, 4, 8); + Base.addBox("Shape57", -9F, 4F, 3F, 18, 5, 5); + Base.addBox("Shape58", -8F, 10F, 41F, 16, 1, 25); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) + { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5); + Base.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) + { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) + { + super.setRotationAngles(f, f1, f2, f3, f4, f5); + } + +} -- cgit v1.2.3