From 70c1354a4a96698758a88c032866288f79de6f5a Mon Sep 17 00:00:00 2001 From: Benjamin Culkin Date: Sat, 24 Aug 2024 08:16:37 -0400 Subject: Initial commit --- .../jp/plusplus/fbs/entity/EntityButterfly.class | Bin 0 -> 3516 bytes .../jp/plusplus/fbs/entity/EntityButterfly.java | 121 +++++ .../jp/plusplus/fbs/entity/EntityLivingDummy.class | Bin 0 -> 1026 bytes .../jp/plusplus/fbs/entity/EntityLivingDummy.java | 34 ++ .../jp/plusplus/fbs/entity/EntityMagicArrow.class | Bin 0 -> 2600 bytes .../jp/plusplus/fbs/entity/EntityMagicArrow.java | 45 ++ .../fbs/entity/EntityMagicArrowFlexible.class | Bin 0 -> 6572 bytes .../fbs/entity/EntityMagicArrowFlexible.java | 147 ++++++ .../jp/plusplus/fbs/entity/EntityMagicAuthor.class | Bin 0 -> 2539 bytes .../jp/plusplus/fbs/entity/EntityMagicAuthor.java | 57 +++ .../jp/plusplus/fbs/entity/EntityMagicDig.class | Bin 0 -> 2810 bytes .../jp/plusplus/fbs/entity/EntityMagicDig.java | 68 +++ .../plusplus/fbs/entity/EntityMagicFireBolt.class | Bin 0 -> 3753 bytes .../plusplus/fbs/entity/EntityMagicFireBolt.java | 101 ++++ .../fbs/entity/EntityMagicHealingBall.class | Bin 0 -> 5704 bytes .../fbs/entity/EntityMagicHealingBall.java | 135 +++++ .../fbs/entity/EntityMagicProjectileBase.class | Bin 0 -> 16083 bytes .../fbs/entity/EntityMagicProjectileBase.java | 547 +++++++++++++++++++++ .../jp/plusplus/fbs/entity/EntityMagicWedge.class | Bin 0 -> 3575 bytes .../jp/plusplus/fbs/entity/EntityMagicWedge.java | 70 +++ .../jp/plusplus/fbs/entity/EntityTableware.class | Bin 0 -> 11634 bytes .../jp/plusplus/fbs/entity/EntityTableware.java | 398 +++++++++++++++ .../plusplus/fbs/entity/render/RenderAuthor.class | Bin 0 -> 842 bytes .../plusplus/fbs/entity/render/RenderAuthor.java | 19 + .../fbs/entity/render/RenderButterfly.class | Bin 0 -> 2164 bytes .../fbs/entity/render/RenderButterfly.java | 59 +++ .../fbs/entity/render/RenderMagicBase.class | Bin 0 -> 2035 bytes .../fbs/entity/render/RenderMagicBase.java | 52 ++ .../fbs/entity/render/RenderTableware.class | Bin 0 -> 2392 bytes .../fbs/entity/render/RenderTableware.java | 62 +++ 30 files changed, 1915 insertions(+) create mode 100644 src/main/java/jp/plusplus/fbs/entity/EntityButterfly.class create mode 100644 src/main/java/jp/plusplus/fbs/entity/EntityButterfly.java create mode 100644 src/main/java/jp/plusplus/fbs/entity/EntityLivingDummy.class create mode 100644 src/main/java/jp/plusplus/fbs/entity/EntityLivingDummy.java create mode 100644 src/main/java/jp/plusplus/fbs/entity/EntityMagicArrow.class create mode 100644 src/main/java/jp/plusplus/fbs/entity/EntityMagicArrow.java create mode 100644 src/main/java/jp/plusplus/fbs/entity/EntityMagicArrowFlexible.class create mode 100644 src/main/java/jp/plusplus/fbs/entity/EntityMagicArrowFlexible.java create mode 100644 src/main/java/jp/plusplus/fbs/entity/EntityMagicAuthor.class create mode 100644 src/main/java/jp/plusplus/fbs/entity/EntityMagicAuthor.java create mode 100644 src/main/java/jp/plusplus/fbs/entity/EntityMagicDig.class create mode 100644 src/main/java/jp/plusplus/fbs/entity/EntityMagicDig.java create mode 100644 src/main/java/jp/plusplus/fbs/entity/EntityMagicFireBolt.class create mode 100644 src/main/java/jp/plusplus/fbs/entity/EntityMagicFireBolt.java create mode 100644 src/main/java/jp/plusplus/fbs/entity/EntityMagicHealingBall.class create mode 100644 src/main/java/jp/plusplus/fbs/entity/EntityMagicHealingBall.java create mode 100644 src/main/java/jp/plusplus/fbs/entity/EntityMagicProjectileBase.class create mode 100644 src/main/java/jp/plusplus/fbs/entity/EntityMagicProjectileBase.java create mode 100644 src/main/java/jp/plusplus/fbs/entity/EntityMagicWedge.class create mode 100644 src/main/java/jp/plusplus/fbs/entity/EntityMagicWedge.java create mode 100644 src/main/java/jp/plusplus/fbs/entity/EntityTableware.class create mode 100644 src/main/java/jp/plusplus/fbs/entity/EntityTableware.java create mode 100644 src/main/java/jp/plusplus/fbs/entity/render/RenderAuthor.class create mode 100644 src/main/java/jp/plusplus/fbs/entity/render/RenderAuthor.java create mode 100644 src/main/java/jp/plusplus/fbs/entity/render/RenderButterfly.class create mode 100644 src/main/java/jp/plusplus/fbs/entity/render/RenderButterfly.java create mode 100644 src/main/java/jp/plusplus/fbs/entity/render/RenderMagicBase.class create mode 100644 src/main/java/jp/plusplus/fbs/entity/render/RenderMagicBase.java create mode 100644 src/main/java/jp/plusplus/fbs/entity/render/RenderTableware.class create mode 100644 src/main/java/jp/plusplus/fbs/entity/render/RenderTableware.java (limited to 'src/main/java/jp/plusplus/fbs/entity') diff --git a/src/main/java/jp/plusplus/fbs/entity/EntityButterfly.class b/src/main/java/jp/plusplus/fbs/entity/EntityButterfly.class new file mode 100644 index 0000000..dfc5ecd Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/entity/EntityButterfly.class differ diff --git a/src/main/java/jp/plusplus/fbs/entity/EntityButterfly.java b/src/main/java/jp/plusplus/fbs/entity/EntityButterfly.java new file mode 100644 index 0000000..48cc74b --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/entity/EntityButterfly.java @@ -0,0 +1,121 @@ +package jp.plusplus.fbs.entity; + +import jp.plusplus.fbs.exprop.SanityManager; +import jp.plusplus.fbs.item.ItemCore; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.EntityTracker; +import net.minecraft.entity.EnumCreatureAttribute; +import net.minecraft.entity.item.EntityXPOrb; +import net.minecraft.entity.passive.EntityBat; +import net.minecraft.entity.passive.EntityCow; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +/** + * Created by pluslus_F on 2015/06/25. + * 蝶。 + */ +public class EntityButterfly extends EntityBat { + public float rotationW; + public boolean rotationFlag; + public int sinTicks; + public int nextDirTicks; + + public EntityButterfly(World p_i1582_1_) { + super(p_i1582_1_); + this.setIsBatHanging(false); + } + + public EntityButterfly(World w, float x, float y, float z) { + this(w); + setLocationAndAngles(x, y, z, 0, 0); + setIsBatHanging(false); + } + + @Override + public void readEntityFromNBT(NBTTagCompound p_70037_1_) { + super.readEntityFromNBT(p_70037_1_); + rotationFlag = p_70037_1_.getBoolean("RotationWingsFlag"); + rotationW = p_70037_1_.getFloat("RotationWingsAngle"); + sinTicks = p_70037_1_.getInteger("SinTicks"); + nextDirTicks = p_70037_1_.getInteger("NextDirTicks"); + } + + @Override + public void writeEntityToNBT(NBTTagCompound p_70014_1_) { + super.writeEntityToNBT(p_70014_1_); + p_70014_1_.setBoolean("RotationWingsFlag", rotationFlag); + p_70014_1_.setFloat("RotationWingsAngle", rotationW); + p_70014_1_.setInteger("SinTicks", sinTicks); + p_70014_1_.setInteger("NextDirTicks", nextDirTicks); + } + + public boolean attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_) { + if (this.isEntityInvulnerable()) { + return false; + } else { + if (!this.worldObj.isRemote) { + setDead(); + if (p_70097_1_.getSourceOfDamage() instanceof EntityPlayer) { + + EntityPlayer ep=(EntityPlayer)p_70097_1_.getSourceOfDamage(); + SanityManager.loseSanity(ep, 1, 6, true); + this.entityDropItem(new ItemStack(ItemCore.butterfly), 0); + } + } + return true; + } + } + + @Override + public void onUpdate(){ + //setDead(); + super.onUpdate(); + + //羽 + float rotS=20; + if(rotationFlag){ + rotationW+=rotS; + if(rotationW>=80){ + rotationFlag=!rotationFlag; + rotationW=80; + } + } + else{ + rotationW-=rotS; + if(rotationW<=-80){ + rotationFlag=!rotationFlag; + rotationW=-80; + } + } + + //func_145775_I(); + } + + @Override + protected String getLivingSound() { + return null; + } + + @Override + protected String getHurtSound() + { + return null; + } + + @Override + protected String getDeathSound() + { + return null; + } + + @Override + public EnumCreatureAttribute getCreatureAttribute(){ return EnumCreatureAttribute.UNDEFINED; } +} diff --git a/src/main/java/jp/plusplus/fbs/entity/EntityLivingDummy.class b/src/main/java/jp/plusplus/fbs/entity/EntityLivingDummy.class new file mode 100644 index 0000000..5440079 Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/entity/EntityLivingDummy.class differ diff --git a/src/main/java/jp/plusplus/fbs/entity/EntityLivingDummy.java b/src/main/java/jp/plusplus/fbs/entity/EntityLivingDummy.java new file mode 100644 index 0000000..7a3b977 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/entity/EntityLivingDummy.java @@ -0,0 +1,34 @@ +package jp.plusplus.fbs.entity; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +/** + * Created by plusplus_F on 2016/03/03. + */ +public class EntityLivingDummy extends EntityLivingBase { + public EntityLivingDummy(World p_i1594_1_) { + super(p_i1594_1_); + } + + @Override + public ItemStack getHeldItem() { + return null; + } + + @Override + public ItemStack getEquipmentInSlot(int p_71124_1_) { + return null; + } + + @Override + public void setCurrentItemOrArmor(int p_70062_1_, ItemStack p_70062_2_) { + + } + + @Override + public ItemStack[] getLastActiveItems() { + return new ItemStack[0]; + } +} diff --git a/src/main/java/jp/plusplus/fbs/entity/EntityMagicArrow.class b/src/main/java/jp/plusplus/fbs/entity/EntityMagicArrow.class new file mode 100644 index 0000000..d5ad24e Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/entity/EntityMagicArrow.class differ diff --git a/src/main/java/jp/plusplus/fbs/entity/EntityMagicArrow.java b/src/main/java/jp/plusplus/fbs/entity/EntityMagicArrow.java new file mode 100644 index 0000000..cfef033 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/entity/EntityMagicArrow.java @@ -0,0 +1,45 @@ +package jp.plusplus.fbs.entity; + +import net.minecraft.client.particle.EntityCritFX; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.monster.EntityMob; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; + +/** + * Createdby pluslus_Fon 2015/06/08. + */ +public class EntityMagicArrow extends EntityMagicProjectileBase { + public EntityMagicArrow(World p_i1582_1_) { + super(p_i1582_1_); + } + public EntityMagicArrow(World par1World, EntityLivingBase par2EntityLivingBase, float speed, float speed2, float damage) { + super(par1World, par2EntityLivingBase, speed, speed2, 0, 0, 0); + setDamage(damage); + } + + public boolean canExist(){ return worldObj.isRemote || ticksExisted<20*1.5; } + + public void onCollideWithPlayer(MovingObjectPosition pos, EntityPlayer entity){ + if(!worldObj.isRemote && !shootingEntity.isEntityEqual(entity)) { + entity.attackEntityFrom(DamageSource.causeIndirectMagicDamage(shootingEntity, entity), getDamage()); + setDead(); + } + } + public void onCollideWithMob(MovingObjectPosition pos, EntityMob entity){ + if(!worldObj.isRemote) { + entity.attackEntityFrom(DamageSource.causeIndirectMagicDamage(shootingEntity, entity), getDamage()); + setDead(); + } + } + public void onCollideWithLiving(MovingObjectPosition pos, EntityLiving entity){ + if(!worldObj.isRemote) { + entity.attackEntityFrom(DamageSource.causeIndirectMagicDamage(shootingEntity, entity), getDamage()); + setDead(); + } + } +} diff --git a/src/main/java/jp/plusplus/fbs/entity/EntityMagicArrowFlexible.class b/src/main/java/jp/plusplus/fbs/entity/EntityMagicArrowFlexible.class new file mode 100644 index 0000000..10880c0 Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/entity/EntityMagicArrowFlexible.class differ diff --git a/src/main/java/jp/plusplus/fbs/entity/EntityMagicArrowFlexible.java b/src/main/java/jp/plusplus/fbs/entity/EntityMagicArrowFlexible.java new file mode 100644 index 0000000..6e2a7ad --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/entity/EntityMagicArrowFlexible.java @@ -0,0 +1,147 @@ +package jp.plusplus.fbs.entity; + +import jp.plusplus.fbs.FBS; +import jp.plusplus.fbs.Registry; +import jp.plusplus.fbs.api.IMagicEnchant; +import jp.plusplus.fbs.packet.MessageMagicFlexible; +import jp.plusplus.fbs.packet.PacketHandler; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.monster.EntityMob; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S06PacketUpdateHealth; +import net.minecraft.network.play.server.S20PacketEntityProperties; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; + +/** + * Created by pluslus_F on 2015/06/23. + * 汎用共鳴魔法の矢 + */ +public class EntityMagicArrowFlexible extends EntityMagicProjectileBase { + protected Registry.MagicData[] magics; + protected IMagicEnchant[] instances; + + public EntityMagicArrowFlexible(World p_i1582_1_) { + super(p_i1582_1_); + } + public EntityMagicArrowFlexible(World par1World, EntityLivingBase par2EntityLivingBase, float speed, float speed2, float damage, Registry.MagicData... magics) { + super(par1World, par2EntityLivingBase, speed, speed2, 0, 0, 0); + setDamage(damage); + this.magics=magics; + } + + public void readMagicsFromNBT(NBTTagCompound nbt){ + NBTTagList nbttaglist = (NBTTagList)nbt.getTag("EnchantMagics"); + magics=new Registry.MagicData[nbttaglist.tagCount()]; + for(int i=0;i entityIds=new LinkedList(); + int amplifier; + + public EntityMagicHealingBall(World p_i1582_1_) { + super(p_i1582_1_); + this.setSize(0.25F, 0.25F); + } + public EntityMagicHealingBall(World par1World, EntityLivingBase par2EntityLivingBase, int amp) { + super(par1World, par2EntityLivingBase, 0, 0, 0, 0, 0); + amplifier=amp; + setPosition(posX, posY - 0.2D, posZ); + this.setSize(0.8F, 0.8F); + } + + @Override + protected void readEntityFromNBT(NBTTagCompound nbt) { + super.readEntityFromNBT(nbt); + amplifier=nbt.getInteger("Amplifier"); + + entityIds=new LinkedList(); + int s=nbt.getInteger("ListSize"); + for(int i=0;i= (isPenetrateBlock() ? 20 : 2)) { + this.setDead(); + } + } else { + this.inGround = false; + this.motionX *= (double) (this.rand.nextFloat() * 0.2F); + this.motionY *= (double) (this.rand.nextFloat() * 0.2F); + this.motionZ *= (double) (this.rand.nextFloat() * 0.2F); + this.ticksInGround = 0; + this.ticksInAir = 0; + } + } else{ + //埋まってない時。速度の更新。 + //ブロックとの衝突判定 + ++this.ticksInAir; + Vec3 vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ); + Vec3 vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + MovingObjectPosition movingobjectposition = this.worldObj.func_147447_a(vec31, vec3, false, true, false); + vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ); + vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + + //ブロック貫通がONの場合、ブロック衝突判定をスキップ + if (this.isPenetrateBlock()) { + movingobjectposition = null; + } + + //ブロックに当たった + if (movingobjectposition != null) { + vec3 = Vec3.createVectorHelper(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord); + } + + //Entityとの衝突判定。 + Entity entity = null; + List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); + double d0 = 0.0D; + int l; + float f1; + + //1ブロック分の範囲内にいるエンティティ全てに対して繰り返す + for (l = 0; l < list.size(); ++l) { + Entity entity1 = (Entity) list.get(l); + //FMLLog.severe("checking hit at:"+entity1.toString()); + //発射物自身or発射後5tick以外だとすりぬける + if (entity1.canBeCollidedWith() /*&& (entity1 != this.shootingEntity ||this.ticksInAir >= 5)*/ ) { + f1 = 0.3F; + AxisAlignedBB axisalignedbb1 = entity1.boundingBox.expand((double) f1, (double) f1, (double) f1); + MovingObjectPosition movingobjectposition1 = axisalignedbb1.calculateIntercept(vec3, vec31); + + if (movingobjectposition1 != null) { + double d1 = vec3.distanceTo(movingobjectposition1.hitVec); + + if (d1 < d0 || d0 == 0.0D) { + //FMLLog.severe("hit at:"+entity1.toString()); + entity = entity1; + d0 = d1; + } + } + } + } + + //エンティティに当たった + if (entity != null) { + movingobjectposition = new MovingObjectPosition(entity); + } + + int hitType=-1; + + /* 当たったエンティティそれそれについての判定部分。*/ + if (movingobjectposition != null && movingobjectposition.entityHit != null) { + if (movingobjectposition.entityHit instanceof EntityPlayer) { + hitType=0; + } else if(movingobjectposition.entityHit instanceof EntityMob){ + hitType=1; + } + else if (movingobjectposition.entityHit instanceof EntityLiving) { + hitType=2; + } else { + hitType=3; + } + + /* + //当たったあと、弾を消去する。エンティティ貫通がONの弾種はそのまま残す。 + if (!(movingobjectposition.entityHit instanceof EntityEnderman) && !this.isPenetrateEntity()) { + this.setDead(); + } + */ + } + + //当たったあとの処理 + if (movingobjectposition != null) { + if(movingobjectposition.entityHit!=null){ + switch (hitType){ + case 0: + onCollideWithPlayer(movingobjectposition, (EntityPlayer) movingobjectposition.entityHit); + break; + + case 1: + onCollideWithMob(movingobjectposition, (EntityMob)movingobjectposition.entityHit); + break; + + case 2: + onCollideWithLiving(movingobjectposition, (EntityLiving)movingobjectposition.entityHit); + break; + + case 3: + onCollideWithEntity(movingobjectposition, entity); + break; + + default: + break; + } + } + else { + //エンティティには当たってない。ブロックに当たった。 + this.xTile = movingobjectposition.blockX; + this.yTile = movingobjectposition.blockY; + this.zTile = movingobjectposition.blockZ; + this.inTile = this.worldObj.getBlock(this.xTile, this.yTile, this.zTile); + this.inData = this.worldObj.getBlockMetadata(this.xTile, this.yTile, this.zTile); + + onCollideWithBlock(movingobjectposition, worldObj.getBlock(xTile, yTile, zTile)); + + if (!isPenetrateBlock() && inTile.getMaterial()!=Material.air) { + this.motionX = (double) ((float) (movingobjectposition.hitVec.xCoord - this.posX)); + this.motionY = (double) ((float) (movingobjectposition.hitVec.yCoord - this.posY)); + this.motionZ = (double) ((float) (movingobjectposition.hitVec.zCoord - this.posZ)); + float f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); + this.posX -= this.motionX / (double) f2 * 0.05000000074505806D; + this.posY -= this.motionY / (double) f2 * 0.05000000074505806D; + this.posZ -= this.motionZ / (double) f2 * 0.05000000074505806D; + + this.playSound(getSoundName(), 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F)); + } + + //ブロックが破壊されていない場合 + if (this.inTile.getMaterial() != Material.air) { + this.inGround = true; + inTile.onEntityCollidedWithBlock(this.worldObj, this.xTile, this.yTile, this.zTile, this); + } + } + } + + //改めてポジションに速度を加算。 + this.posX += this.motionX; + this.posY += this.motionY; + this.posZ += this.motionZ; + motionY-=fallSpeed(); + + if(isInWater()){ + inWater(); + } + + if (!canExist()) { + this.setDead(); + } + + this.setPosition(this.posX, this.posY, this.posZ); + this.func_145775_I(); + + //ticksExisted++; + } + } +} diff --git a/src/main/java/jp/plusplus/fbs/entity/EntityMagicWedge.class b/src/main/java/jp/plusplus/fbs/entity/EntityMagicWedge.class new file mode 100644 index 0000000..b0486d0 Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/entity/EntityMagicWedge.class differ diff --git a/src/main/java/jp/plusplus/fbs/entity/EntityMagicWedge.java b/src/main/java/jp/plusplus/fbs/entity/EntityMagicWedge.java new file mode 100644 index 0000000..fdbd068 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/entity/EntityMagicWedge.java @@ -0,0 +1,70 @@ +package jp.plusplus.fbs.entity; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.monster.EntityMob; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; + +/** + * Createdby pluslus_Fon 2015/06/14. + */ +public class EntityMagicWedge extends EntityMagicProjectileBase { + protected int encLv; + protected int encDur; + + public EntityMagicWedge(World p_i1582_1_) { + super(p_i1582_1_); + } + public EntityMagicWedge(World par1World, EntityLivingBase par2EntityLivingBase, float speed, float speed2, float damage, int lv, int du) { + super(par1World, par2EntityLivingBase, speed, speed2, 0, 0, 0); + setDamage(damage); + encLv=lv; + encDur=du; + } + + public boolean canExist(){ return worldObj.isRemote || ticksExisted<20*3; } + + @Override + protected void readEntityFromNBT(NBTTagCompound nbt) { + super.readEntityFromNBT(nbt); + encLv=nbt.getInteger("EnchantLv"); + encDur=nbt.getInteger("EnchantDur"); + } + @Override + protected void writeEntityToNBT(NBTTagCompound nbt) { + super.writeEntityToNBT(nbt); + nbt.setInteger("EnchantLv", encLv); + nbt.setInteger("EnchantDur", encDur); + } + + public void onCollideWithPlayer(MovingObjectPosition pos, EntityPlayer entity){ + if(!worldObj.isRemote && !shootingEntity.isEntityEqual(entity)) { + entity.addPotionEffect(new PotionEffect(Potion.weakness.getId(), encDur, encLv)); + entity.attackEntityFrom(DamageSource.causeIndirectMagicDamage(shootingEntity, entity), getDamage()); + setDead(); + } + } + public void onCollideWithMob(MovingObjectPosition pos, EntityMob entity){ + if(!worldObj.isRemote) { + hitAt(entity); + } + } + public void onCollideWithLiving(MovingObjectPosition pos, EntityLiving entity){ + if(!worldObj.isRemote) { + hitAt(entity); + } + } + + protected void hitAt(EntityLiving entity){ + entity.addPotionEffect(new PotionEffect(Potion.weakness.getId(), encDur, encLv)); + entity.attackEntityFrom(DamageSource.causeIndirectMagicDamage(shootingEntity, entity), getDamage()); + setDead(); + } +} diff --git a/src/main/java/jp/plusplus/fbs/entity/EntityTableware.class b/src/main/java/jp/plusplus/fbs/entity/EntityTableware.class new file mode 100644 index 0000000..f34510b Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/entity/EntityTableware.class differ diff --git a/src/main/java/jp/plusplus/fbs/entity/EntityTableware.java b/src/main/java/jp/plusplus/fbs/entity/EntityTableware.java new file mode 100644 index 0000000..753f195 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/entity/EntityTableware.java @@ -0,0 +1,398 @@ +package jp.plusplus.fbs.entity; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import jp.plusplus.fbs.item.ItemCore; +import net.minecraft.block.material.Material; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.IHopper; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.*; +import net.minecraft.world.World; + +import java.util.List; + +/** + * Created by plusplus_F on 2015/11/06. + */ +public class EntityTableware extends Entity { + + protected int containerMeta; + private boolean field_70279_a; + private double speedMultiplier; + private int posRotationIncrements; + private double X; + private double Y; + private double Z; + private double yaw; + private double pitch; + @SideOnly(Side.CLIENT) + private double velocityX; + @SideOnly(Side.CLIENT) + private double velocityY; + @SideOnly(Side.CLIENT) + private double velocityZ; + + public EntityTableware(World world) { + super(world); + this.containerMeta = 0; + this.field_70279_a = true; + this.speedMultiplier = 0.07D; + this.setSize(0.3F * this.getSize(), 0.1F * this.getSize()); + this.yOffset = this.height; + } + + public EntityTableware(World world, ItemStack item) { + this(world); + this.setContainerMeta(item.getItemDamage()); + } + + public EntityTableware(World world, ItemStack item, double x, double y, double z) { + this(world, item); + this.setPosition(x, y + (double)this.yOffset, z); + this.motionX = 0.0D; + this.motionY = 0.0D; + this.motionZ = 0.0D; + this.prevPosX = x; + this.prevPosY = y; + this.prevPosZ = z; + } + + protected void entityInit() { + this.dataWatcher.addObject(17, new Integer(0)); + this.dataWatcher.addObject(18, new Integer(1)); + } + + protected void readEntityFromNBT(NBTTagCompound nbt) { + this.setContainerMeta(nbt.getShort("meta")); + } + + protected void writeEntityToNBT(NBTTagCompound nbt) { + nbt.setShort("meta", (short)this.getItemMetadata()); + } + + public int getItemMetadata() { + return this.dataWatcher.getWatchableObjectInt(17); + } + + public void setContainerMeta(int m) { + this.containerMeta = m; + this.dataWatcher.updateObject(17, Integer.valueOf(m)); + } + + public void setForwardDirection(int par1) { + this.dataWatcher.updateObject(18, Integer.valueOf(par1)); + } + + public int getForwardDirection() { + return this.dataWatcher.getWatchableObjectInt(18); + } + + protected boolean canTriggerWalking() { + return false; + } + + public boolean canBeCollidedWith() { + return !this.isDead; + } + + public AxisAlignedBB getCollisionBox(Entity par1Entity) { + return par1Entity.boundingBox; + } + + public AxisAlignedBB getBoundingBox() { + return this.boundingBox; + } + + public boolean canBePushed() { + return true; + } + + public double getMountedYOffset() { + return (double)this.getScale() * 0.4D - 0.06D; + } + + public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) { + if(this.isEntityInvulnerable()) { + return false; + } else if(!this.worldObj.isRemote && !this.isDead) { + this.setBeenAttacked(); + if(par1DamageSource instanceof EntityDamageSource) { + Entity by = ((EntityDamageSource)par1DamageSource).getEntity(); + if(by != null && by instanceof EntityPlayer) { + ItemStack drop1 = this.returnItem(); + if(drop1 != null) { + this.worldObj.playSoundAtEntity(this, "random.pop", 0.4F, 1.8F); + this.entityDropItem(drop1, 0.2F); + if(this.riddenByEntity != null) { + this.riddenByEntity.mountEntity(this); + } + + this.setDead(); + } + } + } + + return true; + } else { + return true; + } + } + + @SideOnly(Side.CLIENT) + public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9) { + if(this.field_70279_a) { + this.posRotationIncrements = par9 + 5; + } else { + double d3 = par1 - this.posX; + double d4 = par3 - this.posY; + double d5 = par5 - this.posZ; + double d6 = d3 * d3 + d4 * d4 + d5 * d5; + if(d6 <= 1.0D) { + return; + } + + this.posRotationIncrements = 3; + } + + this.X = par1; + this.Y = par3; + this.Z = par5; + this.yaw = (double)par7; + this.pitch = (double)par8; + this.motionX = this.velocityX; + this.motionY = this.velocityY; + this.motionZ = this.velocityZ; + } + + @SideOnly(Side.CLIENT) + public void setVelocity(double par1, double par3, double par5) { + this.velocityX = this.motionX = par1; + this.velocityY = this.motionY = par3; + this.velocityZ = this.motionZ = par5; + } + + public void onUpdate() { + super.onUpdate(); + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + byte b0 = 5; + double d0 = 0.0D; + boolean spl = false; + + int d3; + for(d3 = 0; d3 < b0; ++d3) { + double j = this.boundingBox.minY + (this.boundingBox.maxY - this.boundingBox.minY) * (double)(d3 + 0) / (double)b0 - 0.125D; + double tile = this.boundingBox.minY + (this.boundingBox.maxY - this.boundingBox.minY) * (double)(d3 + 1) / (double)b0 - 0.125D; + AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox(this.boundingBox.minX, j, this.boundingBox.minZ, this.boundingBox.maxX, tile, this.boundingBox.maxZ); + if(this.worldObj.isAABBInMaterial(axisalignedbb, Material.water)) { + d0 += 1.0D / (double)b0; + spl = true; + } + } + + if(!this.worldObj.isRemote) { + d3 = MathHelper.floor_double(this.posX); + int var21 = MathHelper.floor_double(this.posY); + int d4 = MathHelper.floor_double(this.posZ); + if(!this.worldObj.isAirBlock(d3, var21 - 1, d4) && this.worldObj.getTileEntity(d3, var21 - 1, d4) != null) { + TileEntity var23 = this.worldObj.getTileEntity(d3, var21 - 1, d4); + if(var23 instanceof IHopper) { + ItemStack d5 = this.returnItem(); + this.entityDropItem(d5, 0.1F); + this.setDead(); + } + } + } + + double var20 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); + double var22; + double var24; + if(var20 > 0.26249999999999996D && spl) { + var22 = Math.cos((double)this.rotationYaw * 3.141592653589793D / 180.0D); + var24 = Math.sin((double)this.rotationYaw * 3.141592653589793D / 180.0D); + + for(int d10 = 0; (double)d10 < 1.0D + var20 * 60.0D; ++d10) { + double d6 = (double)(this.rand.nextFloat() * 2.0F - 1.0F); + double d7 = (double)(this.rand.nextInt(2) * 2 - 1) * 0.7D; + double d8; + double l; + if(this.rand.nextBoolean()) { + d8 = this.posX - var22 * d6 * 0.8D + var24 * d7; + l = this.posZ - var24 * d6 * 0.8D - var22 * d7; + this.worldObj.spawnParticle("splash", d8, this.posY - 0.125D, l, this.motionX, this.motionY, this.motionZ); + } else { + d8 = this.posX + var22 + var24 * d6 * 0.7D; + l = this.posZ + var24 - var22 * d6 * 0.7D; + this.worldObj.spawnParticle("splash", d8, this.posY - 0.125D, l, this.motionX, this.motionY, this.motionZ); + } + } + } + + double d11; + double var25; + if(this.worldObj.isRemote && this.field_70279_a) { + if(this.posRotationIncrements > 0) { + var22 = this.posX + (this.X - this.posX) / (double)this.posRotationIncrements; + var24 = this.posY + (this.Y - this.posY) / (double)this.posRotationIncrements; + d11 = this.posZ + (this.Z - this.posZ) / (double)this.posRotationIncrements; + var25 = MathHelper.wrapAngleTo180_double(this.yaw - (double)this.rotationYaw); + this.rotationYaw = (float)((double)this.rotationYaw + var25 / (double)this.posRotationIncrements); + this.rotationPitch = (float)((double)this.rotationPitch + (this.pitch - (double)this.rotationPitch) / (double)this.posRotationIncrements); + --this.posRotationIncrements; + this.setPosition(var22, var24, d11); + this.setRotation(this.rotationYaw, this.rotationPitch); + } else { + var22 = this.posX + this.motionX; + var24 = this.posY + this.motionY; + d11 = this.posZ + this.motionZ; + this.setPosition(var22, var24, d11); + this.motionX *= 0.5D; + this.motionY *= 0.5D; + this.motionZ *= 0.5D; + this.motionX *= 0.9900000095367432D; + this.motionY *= 0.949999988079071D; + this.motionZ *= 0.9900000095367432D; + } + } else { + if(d0 < 1.0D) { + var22 = d0 * 2.0D - 1.0D; + this.motionY += 0.03999999910593033D * var22; + } else { + if(this.motionY < 0.0D) { + this.motionY /= 2.0D; + } + + this.motionY += 0.007000000216066837D; + } + + if(this.riddenByEntity != null && this.riddenByEntity instanceof EntityLivingBase) { + var22 = (double)((EntityLivingBase)this.riddenByEntity).moveForward; + if(var22 > 0.0D) { + var24 = -Math.sin((double)(this.riddenByEntity.rotationYaw * 3.1415927F / 180.0F)); + d11 = Math.cos((double)(this.riddenByEntity.rotationYaw * 3.1415927F / 180.0F)); + this.motionX += var24 * this.speedMultiplier * 0.05000000074505806D; + this.motionZ += d11 * this.speedMultiplier * 0.05000000074505806D; + } + } + + var22 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); + if(var22 > 0.35D) { + var24 = 0.35D / var22; + this.motionX *= var24; + this.motionZ *= var24; + var22 = 0.35D; + } + + if(var22 > var20 && this.speedMultiplier < 0.35D) { + this.speedMultiplier += (0.1D - this.speedMultiplier) / 35.0D; + if(this.speedMultiplier > 0.35D) { + this.speedMultiplier = 0.35D; + } + } else { + this.speedMultiplier -= (this.speedMultiplier - 0.07D) / 35.0D; + if(this.speedMultiplier < 0.07D) { + this.speedMultiplier = 0.07D; + } + } + + if(this.onGround) { + this.motionX *= 0.5D; + this.motionY *= 0.5D; + this.motionZ *= 0.5D; + } + + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.9900000095367432D; + this.motionY *= 0.949999988079071D; + this.motionZ *= 0.9900000095367432D; + this.rotationPitch = 0.0F; + var24 = (double)this.rotationYaw; + d11 = this.prevPosX - this.posX; + var25 = this.prevPosZ - this.posZ; + if(d11 * d11 + var25 * var25 > 0.001D) { + var24 = (double)((float)(Math.atan2(var25, d11) * 180.0D / 3.141592653589793D)); + } + + double d12 = MathHelper.wrapAngleTo180_double(var24 - (double)this.rotationYaw); + if(d12 > 20.0D) { + d12 = 20.0D; + } + + if(d12 < -20.0D) { + d12 = -20.0D; + } + + this.rotationYaw = (float)((double)this.rotationYaw + d12); + this.setRotation(this.rotationYaw, this.rotationPitch); + if(!this.worldObj.isRemote) { + List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.expand(0.20000000298023224D, 0.0D, 0.20000000298023224D)); + if(list != null && !list.isEmpty()) { + for(int var26 = 0; var26 < list.size(); ++var26) { + Entity entity = (Entity)list.get(var26); + if(entity != this.riddenByEntity && entity.canBePushed()) { + entity.applyEntityCollision(this); + } + } + } + + if(this.riddenByEntity != null && this.riddenByEntity.isDead) { + this.riddenByEntity = null; + } + } + } + } + + public void updateRiderPosition() { + if(this.riddenByEntity != null) { + double d0 = Math.cos((double)this.rotationYaw * 3.141592653589793D / 180.0D) * 0.4D; + double d1 = Math.sin((double)this.rotationYaw * 3.141592653589793D / 180.0D) * 0.4D; + this.riddenByEntity.setPosition(this.posX + d0, this.posY + this.getMountedYOffset() + this.riddenByEntity.getYOffset(), this.posZ + d1); + } + + } + + @SideOnly(Side.CLIENT) + public float getShadowSize() { + return 0.3F; + } + + public boolean interactFirst(EntityPlayer par1EntityPlayer) { + ItemStack has; + has = this.returnItem(); + if (has != null && !par1EntityPlayer.inventory.addItemStackToInventory(has) && !this.worldObj.isRemote) { + par1EntityPlayer.entityDropItem(has, 1.0F); + } + + this.setDead(); + this.worldObj.playSoundAtEntity(par1EntityPlayer, "random.pop", 0.4F, 1.8F); + return true; + } + + protected ItemStack returnItem(){ + return new ItemStack(ItemCore.tableware, 1, containerMeta); + } + + @SideOnly(Side.CLIENT) + public void func_70270_d(boolean par1) { + this.field_70279_a = par1; + } + + protected byte particleNumber() { + return (byte)0; + } + + protected float getScale() { + return 1.0F; + } + + protected float getSize() { + return 1.0F; + } + +} diff --git a/src/main/java/jp/plusplus/fbs/entity/render/RenderAuthor.class b/src/main/java/jp/plusplus/fbs/entity/render/RenderAuthor.class new file mode 100644 index 0000000..b0935ad Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/entity/render/RenderAuthor.class differ diff --git a/src/main/java/jp/plusplus/fbs/entity/render/RenderAuthor.java b/src/main/java/jp/plusplus/fbs/entity/render/RenderAuthor.java new file mode 100644 index 0000000..8b733fa --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/entity/render/RenderAuthor.java @@ -0,0 +1,19 @@ +package jp.plusplus.fbs.entity.render; + +import cpw.mods.fml.common.registry.VillagerRegistry; +import jp.plusplus.fbs.FBS; +import net.minecraft.client.renderer.entity.RenderVillager; +import net.minecraft.entity.passive.EntityVillager; +import net.minecraft.util.ResourceLocation; + +/** + * Created by plusplus_F on 2016/02/24. + */ +public class RenderAuthor extends RenderVillager { + private static final ResourceLocation rl = new ResourceLocation(FBS.MODID+":textures/entity/author.png"); + + @Override + protected ResourceLocation getEntityTexture(EntityVillager p_110775_1_) { + return rl; + } +} diff --git a/src/main/java/jp/plusplus/fbs/entity/render/RenderButterfly.class b/src/main/java/jp/plusplus/fbs/entity/render/RenderButterfly.class new file mode 100644 index 0000000..66a393f Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/entity/render/RenderButterfly.class differ diff --git a/src/main/java/jp/plusplus/fbs/entity/render/RenderButterfly.java b/src/main/java/jp/plusplus/fbs/entity/render/RenderButterfly.java new file mode 100644 index 0000000..ae5466e --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/entity/render/RenderButterfly.java @@ -0,0 +1,59 @@ +package jp.plusplus.fbs.entity.render; + +import jp.plusplus.fbs.FBS; +import jp.plusplus.fbs.entity.EntityButterfly; +import jp.plusplus.fbs.model.ModelButterfly; +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.entity.Entity; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +/** + * Created by pluslus_F on 2015/06/25. + */ +public class RenderButterfly extends Render { + private static final ResourceLocation bulletTextures = new ResourceLocation(FBS.MODID+":textures/entity/butterfly.png"); + + protected ModelButterfly model; + + public RenderButterfly() { + this.model = new ModelButterfly(); + this.shadowSize = 0.5F; + } + + @Override + public void doRender(Entity entity, double par2, double par4, double par6, float par8, float par9) { + //FMLLog.severe("render! at:"+par2+","+par4+","+par6); + + this.bindEntityTexture(entity); + GL11.glPushMatrix(); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + //GL11.glEnable(GL11.TRa); + GL11.glColor4f(2.0F, 2.0F, 2.0F, 1.0F); + GL11.glTranslatef((float) par2, (float) par4, (float) par6); + GL11.glRotatef(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * par9, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * par9, 0.0F, 0.0F, 1.0F); + GL11.glScalef(1.0F, -1.0F, -1.0F); + + model.render((Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); + + GL11.glRotatef(((EntityButterfly)entity).rotationW, 0, 0, 1); + model.renderWingsR(0.0625F); + GL11.glRotatef(-2*((EntityButterfly) entity).rotationW, 0, 0, 1); + model.renderWingsL(0.0625F); + + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_BLEND); + GL11.glPopMatrix(); + } + + @Override + protected ResourceLocation getEntityTexture(Entity p_110775_1_) { + return bulletTextures; + } +} diff --git a/src/main/java/jp/plusplus/fbs/entity/render/RenderMagicBase.class b/src/main/java/jp/plusplus/fbs/entity/render/RenderMagicBase.class new file mode 100644 index 0000000..2f82cc9 Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/entity/render/RenderMagicBase.class differ diff --git a/src/main/java/jp/plusplus/fbs/entity/render/RenderMagicBase.java b/src/main/java/jp/plusplus/fbs/entity/render/RenderMagicBase.java new file mode 100644 index 0000000..3d39189 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/entity/render/RenderMagicBase.java @@ -0,0 +1,52 @@ +package jp.plusplus.fbs.entity.render; + +import cpw.mods.fml.common.FMLLog; +import cpw.mods.fml.common.Mod; +import jp.plusplus.fbs.FBS; +import jp.plusplus.fbs.model.ModelMagicBase; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.entity.Entity; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +/** + * Createdby pluslus_Fon 2015/06/07. + */ +public class RenderMagicBase extends Render { + private static final ResourceLocation bulletTextures = new ResourceLocation(FBS.MODID+":textures/entity/magic0.png"); + + protected ModelBase modelBullet; + + public RenderMagicBase(ModelBase par1ModelBase) { + this.modelBullet = par1ModelBase; + this.shadowSize = 0.0F; + } + + @Override + public void doRender(Entity entity, double par2, double par4, double par6, float par8, float par9) { + //FMLLog.severe("render! at:"+par2+","+par4+","+par6); + + ModelMagicBase model = (ModelMagicBase) this.modelBullet; + + this.bindEntityTexture(entity); + GL11.glPushMatrix(); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glColor4f(2.0F, 2.0F, 2.0F, 1.0F); + GL11.glTranslatef((float)par2, (float)par4, (float)par6); + GL11.glRotatef(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * par9, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * par9, -1.0F, 0.0F, 0); + GL11.glScalef(1.0F, -1.0F, -1.0F); + model.render((Entity)null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glPopMatrix(); + } + + @Override + protected ResourceLocation getEntityTexture(Entity p_110775_1_) { + return bulletTextures; + } +} diff --git a/src/main/java/jp/plusplus/fbs/entity/render/RenderTableware.class b/src/main/java/jp/plusplus/fbs/entity/render/RenderTableware.class new file mode 100644 index 0000000..c45a1e5 Binary files /dev/null and b/src/main/java/jp/plusplus/fbs/entity/render/RenderTableware.class differ diff --git a/src/main/java/jp/plusplus/fbs/entity/render/RenderTableware.java b/src/main/java/jp/plusplus/fbs/entity/render/RenderTableware.java new file mode 100644 index 0000000..65d0fb2 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/entity/render/RenderTableware.java @@ -0,0 +1,62 @@ +package jp.plusplus.fbs.entity.render; + +import jp.plusplus.fbs.FBS; +import jp.plusplus.fbs.block.model.ModelFork; +import jp.plusplus.fbs.block.model.ModelKnife; +import jp.plusplus.fbs.block.model.ModelSpoon; +import jp.plusplus.fbs.entity.EntityButterfly; +import jp.plusplus.fbs.entity.EntityTableware; +import jp.plusplus.fbs.model.ModelButterfly; +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.entity.Entity; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +/** + * Created by plusplus_F on 2015/11/16. + */ +public class RenderTableware extends Render { + private static final ResourceLocation textures = new ResourceLocation(FBS.MODID+":textures/entity/Tableware.png"); + protected ModelSpoon spoon=new ModelSpoon(); + protected ModelFork fork=new ModelFork(); + protected ModelKnife knife=new ModelKnife(); + + @Override + public void doRender(Entity entity, double x, double y, double z, float p_76986_8_, float partialTick) { + if(!(entity instanceof EntityTableware)) return; + + this.bindEntityTexture(entity); + int meta=((EntityTableware) entity).getItemMetadata(); + + GL11.glPushMatrix(); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glTranslatef((float) x, (float) y, (float) z); + GL11.glRotatef(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTick, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTick, 0.0F, 0.0F, 1.0F); + GL11.glScalef(1.0F*.3f, -1.0F*.3f, -1.0F*.3f); + + switch (meta){ + case 0: + spoon.render((Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); + break; + case 1: + knife.render((Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); + break; + case 2: + fork.render((Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); + break; + } + + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glPopMatrix(); + } + + @Override + protected ResourceLocation getEntityTexture(Entity p_110775_1_) { + return textures; + } +} -- cgit v1.2.3