OSDN Git Service

いろいろした
[chemicraft/chemicraft.git] / common / pcc / chemicraft / base / entity / EntityBlackSmoke.java
1 package pcc.chemicraft.base.entity;
2
3 import java.util.ArrayList;
4 import java.util.HashMap;
5 import java.util.Iterator;
6
7 import net.minecraft.entity.Entity;
8 import net.minecraft.entity.monster.EntityMob;
9 import net.minecraft.entity.player.EntityPlayer;
10 import net.minecraft.nbt.NBTTagCompound;
11 import net.minecraft.world.World;
12
13 /**
14  * なんか黒い煙みたいなのが出てくるやつです<br>
15  * Warning:WIP!!
16  * @author ponkotate
17  */
18 public class EntityBlackSmoke extends Entity {
19
20         private final int TIME = 5 * 20;
21
22         public HashMap<EntityMob, Integer> invisibilityMobsMap = new HashMap<EntityMob, Integer>();
23
24         private int restTime;
25
26         public EntityBlackSmoke(EntityPlayer par1EntityPlayer, World par2World, double par3, double par4, double par5) {
27                 super(par2World);
28                 this.posX = par3;
29                 this.posY = par4;
30                 this.posZ = par5;
31                 this.restTime = TIME;
32
33                 for (Entity var5:(ArrayList<Entity>)par2World.loadedEntityList){
34                         if (var5 instanceof EntityMob){
35                                 this.invisibilityMobsMap.put((EntityMob)var5, TIME);
36                         }
37                 }
38         }
39
40         @Override
41         protected void entityInit() {
42
43         }
44
45         @Override
46         public void onUpdate() {
47                 if (this.restTime < 0) {
48                         this.setDead();
49                 }
50                 Iterator<EntityMob> var1 = this.invisibilityMobsMap.keySet().iterator();
51                 while (var1.hasNext()) {
52                         EntityMob var2 = var1.next();
53                         var2.setTarget(this);
54                 }
55                 for (int i = 0; i < 5; i++){
56                         this.worldObj.spawnParticle("smoke", this.posX, this.posY, this.posZ, Math.random() * 0.1D - 0.05D, 0.05D, Math.random() * 0.1D - 0.05D);
57                 }
58                 this.restTime--;
59         }
60
61         @Override
62         protected void readEntityFromNBT(NBTTagCompound var1) {
63
64         }
65
66         @Override
67         protected void writeEntityToNBT(NBTTagCompound var1) {
68
69         }
70
71 }