-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMisil.java
More file actions
137 lines (109 loc) · 3.57 KB
/
Copy pathMisil.java
File metadata and controls
137 lines (109 loc) · 3.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
package UselessMod.Items.MTele;
import cpw.mods.fml.relauncher.ReflectionHelper;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagDouble;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.Explosion;
import net.minecraft.world.World;
import UselessMod.base;
import UselessMod.Auxiliares.Entitys.EntityBullet;
import UselessMod.Auxiliares.Entitys.EntityPlayerMod;
import UselessMod.Configuracion.Datos;
import UselessMod.proxies.Client.PacketHandlerClient;
public class Misil extends EntityBullet {
public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) {
}
public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) {
this.setDead();
}
int vida = 500;
EntityPlayer player = null;
EntityPlayerMod playerm = null;
public Misil(World par1World) {
super(par1World);
player = Minecraft.getMinecraft().thePlayer;
}
public Misil(World par1World, EntityPlayer par3EntityPlayer, double par3,
double par5, double par7) {
super(par1World, par3EntityPlayer, par3, par5, par7);
player = par3EntityPlayer;
this.setSize(1, 1);
}
public Misil(World par2World, EntityPlayerMod playerMod, double motionX,
double motionY, double motionZ) {
super(par2World, playerMod.player, motionX, motionY, motionZ);
playerm = playerMod;
player = playerMod.player;
this.setSize(1, 1);
}
double fx, fy, fz;
public void onUpdate() {
player.fallDistance = 0;
if (this.worldObj.isRemote && player == null) {
setDead();
return;
}
if (ticksInAir == 0) {
fx = posX;
fy = posY;
fz = posZ;
}
if (this.ticksInAir > vida) {
Dead = true;
}
super.onUpdate();
if (this.worldObj.isRemote
&& base.proxy.tickHandlerServer.lanzadores
.containsKey(player.username)) {
setDead();
}
if (!this.isDead && this.worldObj.isRemote) {
player.setPosition(posX, posY, posZ);
}
player.fallDistance = 0;
this.esImpacto();
this.ticksInAir++;
if (this.worldObj.isRemote
&& this.rotationPitch != player.rotationPitch
|| this.rotationYaw != player.rotationYaw) {
motionX = (double) (-MathHelper.sin(player.rotationYaw / 180.0F
* (float) Math.PI) * MathHelper.cos(player.rotationPitch
/ 180.0F * (float) Math.PI));
motionZ = (double) (MathHelper.cos(player.rotationYaw / 180.0F
* (float) Math.PI) * MathHelper.cos(player.rotationPitch
/ 180.0F * (float) Math.PI));
motionY = (double) (-MathHelper.sin(player.rotationPitch / 180.0F
* (float) Math.PI));
this.rotationPitch = player.rotationPitch;
this.rotationYaw = player.rotationYaw;
}
}
boolean Dead = false;
protected void onImpact(MovingObjectPosition par1MovingObjectPosition) {
setDead();
if (playerm != null) {
playerm.deadPlayer = false;
playerm.setDead();
}
if (!worldObj.isRemote) {
Minecraft.getMinecraft().thePlayer.setPosition(playerm.posX,
playerm.posY, playerm.posZ);
PacketHandlerClient.sendPacketPosition(playerm.posX, playerm.posY,
playerm.posZ, Minecraft.getMinecraft().thePlayer);
this.worldObj.createExplosion(this, this.posX, this.posY,
this.posZ, 10, true);
if (base.proxy.tickHandlerClient.lanzadores
.containsKey(player.username)) {
base.proxy.tickHandlerClient.lanzadores.get(player.username)
.Dead(false);
}
base.proxy.tickHandlerClient.lanzadores.remove(player.username);
}
}
}