summaryrefslogtreecommitdiff
path: root/src/main/java/jp/plusplus/fbs/entity
diff options
context:
space:
mode:
authorBenjamin Culkin <scorpress@gmail.com>2024-08-24 08:16:37 -0400
committerBenjamin Culkin <scorpress@gmail.com>2024-08-24 08:16:37 -0400
commit70c1354a4a96698758a88c032866288f79de6f5a (patch)
treeeca51294e84b90a4cb3230bc2c7900469e784184 /src/main/java/jp/plusplus/fbs/entity
Initial commitHEADtrunk
Diffstat (limited to 'src/main/java/jp/plusplus/fbs/entity')
-rw-r--r--src/main/java/jp/plusplus/fbs/entity/EntityButterfly.classbin0 -> 3516 bytes
-rw-r--r--src/main/java/jp/plusplus/fbs/entity/EntityButterfly.java121
-rw-r--r--src/main/java/jp/plusplus/fbs/entity/EntityLivingDummy.classbin0 -> 1026 bytes
-rw-r--r--src/main/java/jp/plusplus/fbs/entity/EntityLivingDummy.java34
-rw-r--r--src/main/java/jp/plusplus/fbs/entity/EntityMagicArrow.classbin0 -> 2600 bytes
-rw-r--r--src/main/java/jp/plusplus/fbs/entity/EntityMagicArrow.java45
-rw-r--r--src/main/java/jp/plusplus/fbs/entity/EntityMagicArrowFlexible.classbin0 -> 6572 bytes
-rw-r--r--src/main/java/jp/plusplus/fbs/entity/EntityMagicArrowFlexible.java147
-rw-r--r--src/main/java/jp/plusplus/fbs/entity/EntityMagicAuthor.classbin0 -> 2539 bytes
-rw-r--r--src/main/java/jp/plusplus/fbs/entity/EntityMagicAuthor.java57
-rw-r--r--src/main/java/jp/plusplus/fbs/entity/EntityMagicDig.classbin0 -> 2810 bytes
-rw-r--r--src/main/java/jp/plusplus/fbs/entity/EntityMagicDig.java68
-rw-r--r--src/main/java/jp/plusplus/fbs/entity/EntityMagicFireBolt.classbin0 -> 3753 bytes
-rw-r--r--src/main/java/jp/plusplus/fbs/entity/EntityMagicFireBolt.java101
-rw-r--r--src/main/java/jp/plusplus/fbs/entity/EntityMagicHealingBall.classbin0 -> 5704 bytes
-rw-r--r--src/main/java/jp/plusplus/fbs/entity/EntityMagicHealingBall.java135
-rw-r--r--src/main/java/jp/plusplus/fbs/entity/EntityMagicProjectileBase.classbin0 -> 16083 bytes
-rw-r--r--src/main/java/jp/plusplus/fbs/entity/EntityMagicProjectileBase.java547
-rw-r--r--src/main/java/jp/plusplus/fbs/entity/EntityMagicWedge.classbin0 -> 3575 bytes
-rw-r--r--src/main/java/jp/plusplus/fbs/entity/EntityMagicWedge.java70
-rw-r--r--src/main/java/jp/plusplus/fbs/entity/EntityTableware.classbin0 -> 11634 bytes
-rw-r--r--src/main/java/jp/plusplus/fbs/entity/EntityTableware.java398
-rw-r--r--src/main/java/jp/plusplus/fbs/entity/render/RenderAuthor.classbin0 -> 842 bytes
-rw-r--r--src/main/java/jp/plusplus/fbs/entity/render/RenderAuthor.java19
-rw-r--r--src/main/java/jp/plusplus/fbs/entity/render/RenderButterfly.classbin0 -> 2164 bytes
-rw-r--r--src/main/java/jp/plusplus/fbs/entity/render/RenderButterfly.java59
-rw-r--r--src/main/java/jp/plusplus/fbs/entity/render/RenderMagicBase.classbin0 -> 2035 bytes
-rw-r--r--src/main/java/jp/plusplus/fbs/entity/render/RenderMagicBase.java52
-rw-r--r--src/main/java/jp/plusplus/fbs/entity/render/RenderTableware.classbin0 -> 2392 bytes
-rw-r--r--src/main/java/jp/plusplus/fbs/entity/render/RenderTableware.java62
30 files changed, 1915 insertions, 0 deletions
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
--- /dev/null
+++ b/src/main/java/jp/plusplus/fbs/entity/EntityButterfly.class
Binary files 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
--- /dev/null
+++ b/src/main/java/jp/plusplus/fbs/entity/EntityLivingDummy.class
Binary files 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
--- /dev/null
+++ b/src/main/java/jp/plusplus/fbs/entity/EntityMagicArrow.class
Binary files 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
--- /dev/null
+++ b/src/main/java/jp/plusplus/fbs/entity/EntityMagicArrowFlexible.class
Binary files 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<nbttaglist.tagCount();i++){
+ NBTTagCompound nbt1 = nbttaglist.getCompoundTagAt(i);
+ magics[i]=Registry.GetMagic(nbt1.getString("MagicName"));
+ }
+ }
+ public void writeMagicsToNBT(NBTTagCompound nbt){
+ NBTTagList nbttaglist = new NBTTagList();
+ for(int i=0;i<magics.length;i++){
+ Registry.MagicData md=magics[i];
+ NBTTagCompound nbt1 = new NBTTagCompound();
+ nbt1.setString("MagicName", md.title);
+ nbttaglist.appendTag(nbt1);
+ }
+ nbt.setTag("EnchantMagics", nbttaglist);
+ }
+
+ @Override
+ protected void readEntityFromNBT(NBTTagCompound nbt) {
+ super.readEntityFromNBT(nbt);
+ readMagicsFromNBT(nbt);
+ }
+ @Override
+ protected void writeEntityToNBT(NBTTagCompound nbt) {
+ super.writeEntityToNBT(nbt);
+ writeMagicsToNBT(nbt);
+ }
+
+ public void hitWith(EntityLivingBase e){
+ float dValue=0.f;
+ float dScale=1.f;
+
+ //IMagicEnchantのインスタンス化
+ //スタッフによる使用なので常に詠唱破棄状態
+ IMagicEnchant[] me=new IMagicEnchant[magics.length];
+ for(int i=0;i<me.length;i++){
+ me[i]=(IMagicEnchant)magics[i].getMagic(worldObj, (EntityPlayer)shootingEntity, false);
+ dValue+=me[i].damageValue(e);
+ dScale*=me[i].damageScale(e);
+ }
+
+ //攻撃
+ e.attackEntityFrom(DamageSource.causeIndirectMagicDamage(shootingEntity, e), (getDamage()+dValue)*dScale);
+
+ //エンチャント
+ for(int i=0;i<me.length;i++){
+ me[i].enchant(e, true);
+ }
+
+ setDead();
+ }
+
+ @Override
+ public boolean canExist(){ return worldObj.isRemote || ticksExisted<20*1.5; }
+
+ @Override
+ public void onCollideWithPlayer(MovingObjectPosition pos, EntityPlayer entity){
+ if(!worldObj.isRemote && !shootingEntity.isEntityEqual(entity)) {
+ hitWith(entity);
+ }
+ }
+ @Override
+ public void onCollideWithMob(MovingObjectPosition pos, EntityMob entity){
+ if(!worldObj.isRemote) {
+ hitWith(entity);
+ }
+ }
+ @Override
+ public void onCollideWithLiving(MovingObjectPosition pos, EntityLiving entity){
+ if(!worldObj.isRemote) {
+ hitWith(entity);
+ }
+ }
+
+ @Override
+ protected void setParticleColor(){
+ if(magics==null) return;
+
+ //インスタンスの生成
+ if(instances==null){
+ instances=new IMagicEnchant[magics.length];
+ for(int i=0;i<instances.length;i++){
+ instances[i]=(IMagicEnchant)magics[i].getMagic(worldObj, (EntityPlayer)shootingEntity, false);
+ }
+ }
+
+ //色の設定
+ int i=rand.nextInt(magics.length);
+ IMagicEnchant.ParticleColor col=instances[i].setParticleColor();
+ if(col!=null){
+ particleRed=col.red;
+ particleGreen=col.green;
+ particleBlue=col.blue;
+ }
+ else{
+ particleRed=particleGreen=particleBlue=1;
+ }
+ }
+
+ @Override
+ public void onUpdate() {
+ super.onUpdate();
+ if(ticksInAir==1 && !worldObj.isRemote){
+ PacketHandler.INSTANCE.sendToDimension(new MessageMagicFlexible(this), worldObj.provider.dimensionId);
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/entity/EntityMagicAuthor.class b/src/main/java/jp/plusplus/fbs/entity/EntityMagicAuthor.class
new file mode 100644
index 0000000..bb88bf4
--- /dev/null
+++ b/src/main/java/jp/plusplus/fbs/entity/EntityMagicAuthor.class
Binary files differ
diff --git a/src/main/java/jp/plusplus/fbs/entity/EntityMagicAuthor.java b/src/main/java/jp/plusplus/fbs/entity/EntityMagicAuthor.java
new file mode 100644
index 0000000..a7da41d
--- /dev/null
+++ b/src/main/java/jp/plusplus/fbs/entity/EntityMagicAuthor.java
@@ -0,0 +1,57 @@
+package jp.plusplus.fbs.entity;
+
+import cpw.mods.fml.common.registry.EntityRegistry;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.Registry;
+import net.minecraft.entity.ai.EntityAIBase;
+import net.minecraft.entity.ai.EntityAIFollowGolem;
+import net.minecraft.entity.ai.EntityAITasks;
+import net.minecraft.entity.ai.EntityAIVillagerMate;
+import net.minecraft.entity.passive.EntityVillager;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Items;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+import shift.mceconomy2.api.MCEconomyAPI;
+
+/**
+ * Created by plusplus_F on 2016/02/24.
+ */
+public class EntityMagicAuthor extends EntityVillager {
+ public EntityMagicAuthor(World p_i1748_1_) {
+ super(p_i1748_1_);
+
+ //必要のないタスクを削除
+ for(int i=0;i<tasks.taskEntries.size();i++){
+ EntityAIBase ai=((EntityAITasks.EntityAITaskEntry)tasks.taskEntries.get(i)).action;
+ if(ai instanceof EntityAIVillagerMate || ai instanceof EntityAIFollowGolem){
+ tasks.removeTask(ai);
+ }
+ }
+
+
+ }
+
+ public void onLivingUpdate(){
+ super.onLivingUpdate();
+ setGrowingAge(100);
+ }
+
+ @Override
+ public boolean interact(EntityPlayer player) {
+ ItemStack itemstack = player.inventory.getCurrentItem();
+ boolean flag = itemstack != null && itemstack.getItem() == Items.spawn_egg;
+
+ if (!flag && this.isEntityAlive() && !this.isTrading() && !this.isChild() && !player.isSneaking()) {
+ if (!this.worldObj.isRemote) {
+ //this.setCustomer(player);
+ //MCEconomyAPI.openShopGui(Registry.shopAuthorId,player,worldObj,(int)posX, (int)posY, (int)posZ);
+ player.openGui(FBS.instance, FBS.GUI_SHOP_AUTHOR_ID, worldObj, (int)posX, (int)posY, (int)posZ);
+ }
+
+ return true;
+ } else {
+ return super.interact(player);
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/entity/EntityMagicDig.class b/src/main/java/jp/plusplus/fbs/entity/EntityMagicDig.class
new file mode 100644
index 0000000..f4e5894
--- /dev/null
+++ b/src/main/java/jp/plusplus/fbs/entity/EntityMagicDig.class
Binary files differ
diff --git a/src/main/java/jp/plusplus/fbs/entity/EntityMagicDig.java b/src/main/java/jp/plusplus/fbs/entity/EntityMagicDig.java
new file mode 100644
index 0000000..3b38d4a
--- /dev/null
+++ b/src/main/java/jp/plusplus/fbs/entity/EntityMagicDig.java
@@ -0,0 +1,68 @@
+package jp.plusplus.fbs.entity;
+
+import cpw.mods.fml.common.FMLLog;
+import net.minecraft.block.Block;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.init.Blocks;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.MathHelper;
+import net.minecraft.util.MovingObjectPosition;
+import net.minecraft.world.World;
+
+/**
+ * Createdby pluslus_Fon 2015/06/07.
+ */
+public class EntityMagicDig extends EntityMagicProjectileBase {
+ protected int till;
+ protected boolean isPenetrate;
+
+ public EntityMagicDig(World p_i1582_1_) {
+ super(p_i1582_1_);
+ till=10;
+ }
+ public EntityMagicDig(World par1World, EntityLivingBase par2EntityLivingBase, float speed, float speed2, int till, boolean isPenetrate) {
+ super(par1World, par2EntityLivingBase, speed, speed2, 0, 0, 0);
+ this.till=10+till;
+ this.isPenetrate=isPenetrate;
+ }
+
+ @Override
+ protected void readEntityFromNBT(NBTTagCompound nbt) {
+ super.readEntityFromNBT(nbt);
+ isPenetrate=nbt.getBoolean("IsPenetrate");
+ till=nbt.getInteger("magicTill");
+ }
+ @Override
+ protected void writeEntityToNBT(NBTTagCompound nbt) {
+ super.writeEntityToNBT(nbt);
+ nbt.setBoolean("IsPenetrate", isPenetrate);
+ nbt.setInteger("magicTill", till);
+ }
+
+ public boolean canExist(){ return worldObj.isRemote || ticksExisted<till; }
+ public void onCollideWithBlock(MovingObjectPosition pos, Block block) {
+ if (!worldObj.isRemote) {
+ float h = block.getBlockHardness(worldObj, xTile, yTile, zTile);
+ if (h <= 30.0f && h != -1.0f){
+ worldObj.func_147480_a(xTile, yTile, zTile, true);
+ }
+ else{
+ setDead();
+ return;
+ }
+ }
+ if (isPenetrate) {
+ inTile = Blocks.air;
+ inData = 0;
+ } else {
+ setDead();
+ }
+ }
+
+ @Override
+ protected void setParticleColor(){
+ particleRed=0.5f+0.5f*rand.nextFloat();
+ particleGreen=0.25f+0.2f*rand.nextFloat();
+ particleBlue=0.2f*rand.nextFloat();
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/entity/EntityMagicFireBolt.class b/src/main/java/jp/plusplus/fbs/entity/EntityMagicFireBolt.class
new file mode 100644
index 0000000..d184e57
--- /dev/null
+++ b/src/main/java/jp/plusplus/fbs/entity/EntityMagicFireBolt.class
Binary files differ
diff --git a/src/main/java/jp/plusplus/fbs/entity/EntityMagicFireBolt.java b/src/main/java/jp/plusplus/fbs/entity/EntityMagicFireBolt.java
new file mode 100644
index 0000000..2e13778
--- /dev/null
+++ b/src/main/java/jp/plusplus/fbs/entity/EntityMagicFireBolt.java
@@ -0,0 +1,101 @@
+package jp.plusplus.fbs.entity;
+
+import net.minecraft.block.Block;
+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.init.Blocks;
+import net.minecraft.util.DamageSource;
+import net.minecraft.util.MovingObjectPosition;
+import net.minecraft.world.World;
+
+/**
+ * Createdby pluslus_Fon 2015/06/14.
+ */
+public class EntityMagicFireBolt extends EntityMagicProjectileBase {
+ public EntityMagicFireBolt(World p_i1582_1_) {
+ super(p_i1582_1_);
+ }
+
+ public EntityMagicFireBolt(World par1World, EntityLivingBase par2EntityLivingBase, float speed, float speed2, float damage) {
+ super(par1World, par2EntityLivingBase, speed, speed2, 0, 0, 0);
+ setDamage(damage);
+ }
+
+ @Override
+ public boolean canExist() {
+ return worldObj.isRemote || ticksExisted < 20 * 1.5;
+ }
+
+ @Override
+ public void onCollideWithPlayer(MovingObjectPosition pos, EntityPlayer entity) {
+ if (!worldObj.isRemote && !shootingEntity.isEntityEqual(entity)) {
+ entity.attackEntityFrom(DamageSource.causeIndirectMagicDamage(shootingEntity, entity), getDamage());
+ entity.setFire(20 * 3);
+ setDead();
+ }
+ }
+
+ @Override
+ public void onCollideWithMob(MovingObjectPosition pos, EntityMob entity) {
+ if (!worldObj.isRemote) {
+ entity.attackEntityFrom(DamageSource.causeIndirectMagicDamage(shootingEntity, entity), getDamage());
+ entity.setFire(20 * 3);
+ setDead();
+ }
+ }
+
+ @Override
+ public void onCollideWithLiving(MovingObjectPosition pos, EntityLiving entity) {
+ if (!worldObj.isRemote) {
+ entity.attackEntityFrom(DamageSource.causeIndirectMagicDamage(shootingEntity, entity), getDamage());
+ entity.setFire(20 * 3);
+ setDead();
+ }
+ }
+
+ @Override
+ public void onCollideWithBlock(MovingObjectPosition pos, Block block) {
+ if (!worldObj.isRemote) {
+
+ int i = pos.blockX;
+ int j = pos.blockY;
+ int k = pos.blockZ;
+
+ switch (pos.sideHit) {
+ case 0:
+ --j;
+ break;
+ case 1:
+ ++j;
+ break;
+ case 2:
+ --k;
+ break;
+ case 3:
+ ++k;
+ break;
+ case 4:
+ --i;
+ break;
+ case 5:
+ ++i;
+ }
+
+ if (this.worldObj.isAirBlock(i, j, k)) {
+ this.worldObj.setBlock(i, j, k, Blocks.fire);
+ }
+
+ setDead();
+ }
+ }
+
+ @Override
+ protected void setParticleColor(){
+ particleRed=0.8f+0.2f*rand.nextFloat();
+ particleGreen=0.5f*rand.nextFloat();
+ particleBlue=0;
+ }
+
+}
diff --git a/src/main/java/jp/plusplus/fbs/entity/EntityMagicHealingBall.class b/src/main/java/jp/plusplus/fbs/entity/EntityMagicHealingBall.class
new file mode 100644
index 0000000..5760197
--- /dev/null
+++ b/src/main/java/jp/plusplus/fbs/entity/EntityMagicHealingBall.class
Binary files differ
diff --git a/src/main/java/jp/plusplus/fbs/entity/EntityMagicHealingBall.java b/src/main/java/jp/plusplus/fbs/entity/EntityMagicHealingBall.java
new file mode 100644
index 0000000..3c58aa1
--- /dev/null
+++ b/src/main/java/jp/plusplus/fbs/entity/EntityMagicHealingBall.java
@@ -0,0 +1,135 @@
+package jp.plusplus.fbs.entity;
+
+import cpw.mods.fml.client.FMLClientHandler;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.event.FBSEventHandler;
+import jp.plusplus.fbs.particle.EntityTracksFX;
+import jp.plusplus.fbs.particle.EntityTrajectoryFX;
+import net.minecraft.client.entity.EntityClientPlayerMP;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLiving;
+import net.minecraft.entity.EntityLivingBase;
+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.potion.PotionEffect;
+import net.minecraft.util.*;
+import net.minecraft.world.World;
+
+import java.util.LinkedList;
+
+/**
+ * Createdby pluslus_Fon 2015/06/14.
+ */
+public class EntityMagicHealingBall extends EntityMagicProjectileBase {
+ LinkedList<Integer> entityIds=new LinkedList<Integer>();
+ 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<Integer>();
+ int s=nbt.getInteger("ListSize");
+ for(int i=0;i<s;i++){
+ entityIds.add(nbt.getInteger("EntityIds-Id"+i));
+ }
+ }
+ @Override
+ protected void writeEntityToNBT(NBTTagCompound nbt) {
+ super.writeEntityToNBT(nbt);
+ nbt.setInteger("Amplifier", amplifier);
+
+ nbt.setInteger("ListSize", entityIds.size());
+ for(int i=0;i<entityIds.size();i++){
+ nbt.setInteger("EntityIds-Id"+i, entityIds.get(i));
+ }
+ }
+
+
+ @Override
+ public void onUpdate() {
+ super.onUpdate();
+ float s=MathHelper.sin(2 * 3.14159265f / 10.0f * (ticksExisted % 10));
+ float c=MathHelper.cos(2 * 3.14159265f / 10.0f * (ticksExisted % 10));
+
+ float mx=0.15f*c;
+ float my=0;
+ float mz=0.15f*s;
+
+ this.motionX = mx;
+ this.motionY = my;
+ this.motionZ = mz;
+
+ if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) {
+ float f = MathHelper.sqrt_double(mx * mx + mz * mz);
+ this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(mx, mz) * 180.0D / Math.PI);
+ this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(my, (double) f) * 180.0D / Math.PI);
+ this.prevRotationPitch = this.rotationPitch;
+ this.prevRotationYaw = this.rotationYaw;
+ this.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
+ this.ticksInGround = 0;
+ }
+ }
+
+ @Override
+ public boolean canExist() {
+ return worldObj.isRemote || ticksExisted < 20 * 20;
+ }
+
+ @Override
+ public void onCollideWithPlayer(MovingObjectPosition pos, EntityPlayer entity) {
+ if (!worldObj.isRemote) {
+ for(Integer id : entityIds){
+ if(id==entity.getEntityId()){
+ return;
+ }
+ }
+
+ //entity.addPotionEffect(new PotionEffect(Potion.heal.getId(), 20, amplifier));
+ entity.setHealth(entity.getHealth()+0.5f*amplifier);
+ entityIds.add(entity.getEntityId());
+ }
+ }
+
+ @Override
+ public void onCollideWithLiving(MovingObjectPosition pos, EntityLiving entity) {
+ if (!worldObj.isRemote) {
+ for(Integer id : entityIds){
+ if(id==entity.getEntityId()){
+ return;
+ }
+ }
+
+ //entity.addPotionEffect(new PotionEffect(Potion.heal.getId(), 20, amplifier));
+ entity.setHealth(entity.getHealth() + 0.5f * amplifier);
+ entityIds.add(entity.getEntityId());
+ }
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ protected void spawnParticle(){
+ //setParticleColor();
+ particleRed=particleBlue=0.5f+0.2f*rand.nextFloat();
+ particleGreen=1.f;
+
+ EntityTracksFX fx=new EntityTracksFX(worldObj, posX, posY, posZ, 0, -(0.3f+0.6f*rand.nextFloat()), 0, particleRed, particleGreen, particleBlue, getParticleSize());
+ FMLClientHandler.instance().getClient().effectRenderer.addEffect(fx);
+ }
+
+}
diff --git a/src/main/java/jp/plusplus/fbs/entity/EntityMagicProjectileBase.class b/src/main/java/jp/plusplus/fbs/entity/EntityMagicProjectileBase.class
new file mode 100644
index 0000000..9cba97d
--- /dev/null
+++ b/src/main/java/jp/plusplus/fbs/entity/EntityMagicProjectileBase.class
Binary files differ
diff --git a/src/main/java/jp/plusplus/fbs/entity/EntityMagicProjectileBase.java b/src/main/java/jp/plusplus/fbs/entity/EntityMagicProjectileBase.java
new file mode 100644
index 0000000..6f9ed82
--- /dev/null
+++ b/src/main/java/jp/plusplus/fbs/entity/EntityMagicProjectileBase.java
@@ -0,0 +1,547 @@
+package jp.plusplus.fbs.entity;
+
+import cpw.mods.fml.client.FMLClientHandler;
+import cpw.mods.fml.common.FMLLog;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.event.FBSEventHandler;
+import jp.plusplus.fbs.particle.EntityGlowFX;
+import jp.plusplus.fbs.particle.EntityTracksFX;
+import jp.plusplus.fbs.particle.EntityTrajectoryFX;
+import net.minecraft.block.Block;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.particle.EffectRenderer;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLiving;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.IProjectile;
+import net.minecraft.entity.monster.EntityEnderman;
+import net.minecraft.entity.monster.EntityMob;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.projectile.EntityArrow;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemBow;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.*;
+import net.minecraft.world.World;
+import net.minecraft.world.biome.BiomeCache;
+
+import java.util.List;
+import java.util.Random;
+
+/**
+ * Createdby pluslus_Fon 2015/06/07.
+ */
+public class EntityMagicProjectileBase extends Entity implements IProjectile {
+ /* 地中判定に使うもの */
+ protected int xTile = -1;
+ protected int yTile = -1;
+ protected int zTile = -1;
+ protected Block inTile;
+ protected int inData;
+ protected boolean inGround;
+
+ /* この弾を撃ったエンティティ */
+ public Entity shootingEntity;
+
+ /* 地中・空中にいる時間 */
+ protected int ticksInGround;
+ protected int ticksInAir;
+
+ /* ダメージの大きさ */
+ protected float damage;
+
+ /* ノックバックの大きさ */
+ protected int knockbackStrength = 1;
+
+ /* パーティクル */
+ protected boolean enableParticle=true;
+ protected float particleRed=1.f;
+ protected float particleGreen=1.f;
+ protected float particleBlue=1.f;
+
+ /* パーティクル関係 */
+ protected boolean hasMatrix=false;
+ protected double[] matrix=new double[4*4];
+ protected double preMotionX;
+ protected double preMotionY;
+ protected double preMotionZ;
+
+ public EntityMagicProjectileBase(World p_i1582_1_) {
+ super(p_i1582_1_);
+ this.renderDistanceWeight = 10.0D;
+ this.setSize(0.1875F, 0.3125F);
+ rand=new Random();
+ }
+
+ public EntityMagicProjectileBase(World par1World, EntityLivingBase entity, float speed, float speed2, float adjustX, float adjustZ, float adjustY) {
+ super(par1World);
+ this.renderDistanceWeight = 10.0D;
+ this.shootingEntity = entity;
+ this.yOffset = 0.0F;
+ this.setSize(0.1875F, 0.3125F);
+
+ //初期状態での向きの決定
+ this.setLocationAndAngles(entity.posX, entity.posY + (double) entity.getEyeHeight() -0.10000000149011612D, entity.posZ, entity.rotationYaw, entity.rotationPitch);
+ //this.posY += adjustY-0.10000000149011612D;
+ this.setPosition(this.posX, this.posY, this.posZ);
+
+ xTile=(int)posX;
+ yTile=(int)posY;
+ zTile=(int)posZ;
+
+ //初速度
+ this.motionX = (double) (-MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI));
+ this.motionZ = (double) (MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI));
+ this.motionY = (double) (-MathHelper.sin(this.rotationPitch / 180.0F * (float) Math.PI));
+ this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, speed * 1.5F, speed2);
+ }
+
+ @Override
+ protected void readEntityFromNBT(NBTTagCompound nbt) {
+ this.xTile = nbt.getShort("xTile");
+ this.yTile = nbt.getShort("yTile");
+ this.zTile = nbt.getShort("zTile");
+
+ String t=nbt.getString("inTile");
+ if(t.equals("null")) inTile=null;
+ else this.inTile = Block.getBlockFromName(t);
+
+ this.inData = nbt.getByte("inData") & 255;
+ this.inGround = nbt.getByte("inGround") == 1;
+
+ if (nbt.hasKey("damage")) {
+ this.damage = nbt.getFloat("damage");
+ }
+
+ if(nbt.hasKey("EnableParticle")){
+ enableParticle=nbt.getBoolean("EnableParticle");
+ particleRed=nbt.getFloat("ParticleRed");
+ particleGreen=nbt.getFloat("ParticleGreen");
+ particleBlue=nbt.getFloat("ParticleBlue");
+ }
+
+ if(nbt.hasKey("ShooterId")){
+ shootingEntity=worldObj.getEntityByID(nbt.getInteger("ShooterId"));
+ }
+ }
+
+ @Override
+ protected void writeEntityToNBT(NBTTagCompound nbt) {
+ nbt.setShort("xTile", (short) this.xTile);
+ nbt.setShort("yTile", (short) this.yTile);
+ nbt.setShort("zTile", (short) this.zTile);
+ nbt.setString("inTile", inTile == null ? "null" : Block.blockRegistry.getNameForObject(inTile));
+ nbt.setByte("inData", (byte) this.inData);
+ nbt.setByte("inGround", (byte) (this.inGround ? 1 : 0));
+ nbt.setFloat("damage", this.damage);
+ nbt.setBoolean("EnableParticle", enableParticle);
+ nbt.setFloat("ParticleRed", particleRed);
+ nbt.setFloat("ParticleGreen", particleGreen);
+ nbt.setFloat("ParticleBlue", particleBlue);
+ nbt.setInteger("ShooterId", shootingEntity.getEntityId());
+ }
+
+ @Override
+ protected void entityInit() {
+ }
+
+ @Override
+ public void setThrowableHeading(double par1, double par3, double par5, float par7, float par8) {
+ float f2 = MathHelper.sqrt_double(par1 * par1 + par3 * par3 + par5 * par5);
+ par1 /= (double) f2;
+ par3 /= (double) f2;
+ par5 /= (double) f2;
+ par1 += this.rand.nextGaussian() * (double) (this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double) par8;
+ par3 += this.rand.nextGaussian() * (double) (this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double) par8;
+ par5 += this.rand.nextGaussian() * (double) (this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double) par8;
+ par1 *= (double) par7;
+ par3 *= (double) par7;
+ par5 *= (double) par7;
+ this.motionX = par1;
+ this.motionY = par3;
+ this.motionZ = par5;
+ float f3 = MathHelper.sqrt_double(par1 * par1 + par5 * par5);
+ this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(par1, par5) * 180.0D / Math.PI);
+ this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(par3, (double) f3) * 180.0D / Math.PI);
+ this.ticksInGround = 0;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void setVelocity(double par1, double par3, double par5) {
+ this.motionX = par1;
+ this.motionY = par3;
+ this.motionZ = par5;
+
+ if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) {
+ float f = MathHelper.sqrt_double(par1 * par1 + par5 * par5);
+ this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(par1, par5) * 180.0D / Math.PI);
+ this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(par3, (double) f) * 180.0D / Math.PI);
+ this.prevRotationPitch = this.rotationPitch;
+ this.prevRotationYaw = this.rotationYaw;
+ this.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
+ this.ticksInGround = 0;
+ }
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9) {
+ this.setPosition(par1, par3, par5);
+ this.setRotation(par7, par8);
+ }
+
+
+ public boolean isPenetrateBlock(){
+ return false;
+ }
+ public boolean isPenetrateEntity(){
+ return false;
+ }
+
+ public void onCollideWithPlayer(MovingObjectPosition pos, EntityPlayer entity){}
+
+ public void onCollideWithMob(MovingObjectPosition pos, EntityMob entity){}
+
+ public void onCollideWithLiving(MovingObjectPosition pos, EntityLiving entity){}
+
+ public void onCollideWithEntity(MovingObjectPosition pos, Entity entity){}
+
+ public void onCollideWithBlock(MovingObjectPosition pos, Block block){}
+
+ public void inWater(){}
+
+ public float fallSpeed(){ return 0; }
+
+ public DamageSource thisDamageSource(Entity entity) {
+ return entity != null ? EntityDamageSource.causeIndirectMagicDamage(entity, this) : DamageSource.magic;
+ }
+
+ public String getSoundName(){
+ return "random.bowhit";
+ }
+
+ public boolean canExist(){ return ticksExisted<20; }
+
+ protected boolean canTriggerWalking() {
+ return false;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public float getShadowSize() {
+ return 0.0F;
+ }
+
+ public void setDamage(float par1) {
+ this.damage = par1;
+ }
+
+ public float getDamage() {
+ return this.damage;
+ }
+
+ public void setKnockbackStrength(int par1) {
+ this.knockbackStrength = par1;
+ }
+
+ public boolean canAttackWithItem() {
+ return false;
+ }
+
+ /**
+ * パーティクル発生間隔
+ * @return
+ */
+ protected int getParticleInterval(){
+ return 1;
+ }
+
+ /**
+ * パーティクルの色を設定する。
+ * enableParticleがtrueでなければ呼ばれない
+ */
+ protected void setParticleColor(){
+ particleRed=particleGreen=particleBlue=1.f;
+ }
+
+ /**
+ * パーティクルの大きさを得る
+ * @return
+ */
+ protected float getParticleSize(){
+ return 0.75f+0.5f*rand.nextFloat();
+ }
+
+ protected void calcMatrix(){
+ double pc=MathHelper.cos(rotationPitch);
+ double ps=MathHelper.sin(rotationPitch);
+ double yc=MathHelper.cos(rotationYaw);
+ double ys=MathHelper.sin(rotationYaw);
+
+ // ロール・ピッチ・ヨーの回転行列を得る
+ matrix[0]=1*pc;
+ matrix[1]=1*ps*ys;
+ matrix[2]=1*ps*yc+0;
+ matrix[3]=0;
+
+ matrix[4]=ys*pc;
+ matrix[5]=0+1*yc;
+ matrix[6]=0-1*ys;
+ matrix[7]=0;
+
+ matrix[8]=-ps;
+ matrix[9]=pc*ys;
+ matrix[10]=pc*yc;
+ matrix[11]=0;
+
+ matrix[12]=matrix[13]=matrix[14]=0;
+ matrix[15]=1;
+ }
+
+ @SideOnly(Side.CLIENT)
+ protected void spawnParticle(){
+ //1.法線を得る
+ //Vec3 normal=Vec3.createVectorHelper(motionX, motionY, motionZ).normalize();
+
+ //2.法線から回転行列を得る(計算済み)
+
+ //3.x-z平面に360度の範囲で動くベクトルを得る
+ float angle=(float)(rand.nextDouble()*Math.PI*2);
+ float size=0.5f+0.75f*rand.nextFloat();
+ Vec3 baseV=Vec3.createVectorHelper(MathHelper.cos(angle), 0, MathHelper.sin(angle));
+ baseV.xCoord*=size;
+ baseV.zCoord*=size;
+
+ //4.回転行列でベクトルを回転させる
+ Vec3 vector=Vec3.createVectorHelper(0,0,0);
+ vector.xCoord=matrix[0]*baseV.xCoord+matrix[1]*baseV.yCoord+matrix[2]*baseV.zCoord+matrix[3]*1;
+ vector.yCoord=matrix[4]*baseV.xCoord+matrix[5]*baseV.yCoord+matrix[6]*baseV.zCoord+matrix[7]*1;
+ vector.zCoord=matrix[8]*baseV.xCoord+matrix[9]*baseV.yCoord+matrix[10]*baseV.zCoord+matrix[11]*1;
+
+ //5.パーティクルつくる
+ setParticleColor();
+
+ EntityTracksFX fx=new EntityTracksFX(worldObj, posX, posY, posZ, vector.xCoord, vector.yCoord, vector.zCoord, particleRed, particleGreen, particleBlue, getParticleSize());
+ FMLClientHandler.instance().getClient().effectRenderer.addEffect(fx);
+
+ if(this.ticksExisted%3==0){
+ EntityTrajectoryFX fx2=new EntityTrajectoryFX(worldObj, posX, posY, posZ, motionX, motionY, motionZ);
+ fx2.setParticleIcon(FBSEventHandler.SpellTexture);
+ fx2.setRBGColorF(particleRed, particleGreen, particleBlue);
+ FMLClientHandler.instance().getClient().effectRenderer.addEffect(fx2);
+ }
+ }
+
+ /*
+ * Tick毎に呼ばれる更新処理。
+ * 速度の更新、衝突判定などをここで行う。
+ */
+ public void onUpdate() {
+ super.onUpdate();
+
+ //パーティクル用行列の生成
+ if(!hasMatrix || preMotionX!=motionX || preMotionY!=motionY || preMotionZ!=motionZ){
+ calcMatrix();
+ hasMatrix=true;
+ preMotionX=motionX;
+ preMotionY=motionY;
+ preMotionZ=motionZ;
+ }
+
+ //パーティクルを生成
+ if(FBS.proxy.getClientWorld()!=null && worldObj.isRemote && enableParticle && this.ticksExisted%getParticleInterval()==0){
+ spawnParticle();
+ }
+
+ //直前のパラメータと新パラメータを一致させているところ。
+ //また、速度に応じてエンティティの向きを調整し、常に進行方向に前面が向くようにしている。
+ if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) {
+ float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
+ this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);
+ this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(this.motionY, (double) f) * 180.0D / Math.PI);
+ }
+
+ //激突したブロックを確認している
+ Block block=worldObj.getBlock(xTile, yTile, zTile);
+ if (block.getMaterial() != Material.air) {
+ block.setBlockBoundsBasedOnState(this.worldObj, xTile, yTile, zTile);
+ AxisAlignedBB axisalignedbb = block.getCollisionBoundingBoxFromPool(this.worldObj, xTile, yTile, zTile);
+
+ if (axisalignedbb != null && axisalignedbb.isVecInside(Vec3.createVectorHelper(this.posX, this.posY, this.posZ))) {
+ this.inGround = true;
+ }
+ }
+
+ //空気じゃないブロックに当たった
+ if (this.inGround) {
+ block = worldObj.getBlock(xTile, yTile, zTile);
+ int meta = worldObj.getBlockMetadata(xTile, yTile, zTile);
+
+ if (block == this.inTile && meta == this.inData) {
+ ++this.ticksInGround;
+
+ if (this.ticksInGround >= (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
--- /dev/null
+++ b/src/main/java/jp/plusplus/fbs/entity/EntityMagicWedge.class
Binary files 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
--- /dev/null
+++ b/src/main/java/jp/plusplus/fbs/entity/EntityTableware.class
Binary files 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
--- /dev/null
+++ b/src/main/java/jp/plusplus/fbs/entity/render/RenderAuthor.class
Binary files 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
--- /dev/null
+++ b/src/main/java/jp/plusplus/fbs/entity/render/RenderButterfly.class
Binary files 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
--- /dev/null
+++ b/src/main/java/jp/plusplus/fbs/entity/render/RenderMagicBase.class
Binary files 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
--- /dev/null
+++ b/src/main/java/jp/plusplus/fbs/entity/render/RenderTableware.class
Binary files 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;
+ }
+}