-
Notifications
You must be signed in to change notification settings - Fork 9
/
EntityFriendlyMagmaCube.java
173 lines (148 loc) · 3.57 KB
/
EntityFriendlyMagmaCube.java
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
package net.minecraft.src;
import java.util.List;
import java.util.Random;
public class EntityFriendlyMagmaCube extends EntityFriendlySlime
{
public EntityFriendlyMagmaCube(World par1World)
{
super(par1World);
texture = "/mob/lava.png";
isImmuneToFire = true;
landMovementFactor = 0.2F;
}
/**
* Checks if the entity's current position is a valid location to spawn this entity.
*/
public boolean getCanSpawnHere()
{
return worldObj.difficultySetting > 0 && worldObj.checkIfAABBIsClear(boundingBox) && worldObj.getCollidingBoundingBoxes(this, boundingBox).size() == 0 && !worldObj.isAnyLiquid(boundingBox);
}
/**
* Returns the current armor value as determined by a call to InventoryPlayer.getTotalArmorValue
*/
public int getTotalArmorValue()
{
return getSlimeSize() * 3;
}
public int getBrightnessForRender(float par1)
{
return 0xf000f0;
}
/**
* Gets how bright this entity is.
*/
public float getBrightness(float par1)
{
return 1.0F;
}
/**
* Returns the name of a particle effect that may be randomly created by EntitySlime.onUpdate()
*/
protected String getSlimeParticle()
{
return "flame";
}
protected EntityFriendlySlime createInstance()
{
return new EntityFriendlyMagmaCube(worldObj);
}
/**
* Returns the item ID for the item the mob drops on death.
*/
protected int getDropItemId()
{
return Item.magmaCream.shiftedIndex;
}
/**
* Drop 0-2 items of this living's type
*/
protected void dropFewItems(boolean par1, int par2)
{
int i = getDropItemId();
if (i > 0 && getSlimeSize() > 1)
{
int j = rand.nextInt(4) - 2;
if (par2 > 0)
{
j += rand.nextInt(par2 + 1);
}
for (int k = 0; k < j; k++)
{
dropItem(i, 1);
}
}
}
/**
* Returns true if the entity is on fire. Used by render to add the fire effect on rendering.
*/
public boolean isBurning()
{
return false;
}
protected int func_40131_af()
{
return super.func_40131_af() * 4;
}
protected void func_40136_ag()
{
field_40139_a = field_40139_a * 0.9F;
}
/**
* jump, Causes this entity to do an upwards motion (jumping)
*/
protected void jump()
{
motionY = 0.42F + (float)getSlimeSize() * 0.1F;
isAirBorne = true;
}
/**
* Called when the mob is falling. Calculates and applies fall damage.
*/
protected void fall(float f)
{
}
protected boolean func_40137_ah()
{
return true;
}
protected int func_40130_ai()
{
return super.func_40130_ai() + 2;
}
/**
* Returns the sound this mob makes when it is hurt.
*/
protected String getHurtSound()
{
return "mob.slime";
}
/**
* Returns the sound this mob makes on death.
*/
protected String getDeathSound()
{
return "mob.slime";
}
protected String func_40138_aj()
{
if (getSlimeSize() > 1)
{
return "mob.magmacube.big";
}
else
{
return "mob.magmacube.small";
}
}
/**
* Whether or not the current entity is in lava
*/
public boolean handleLavaMovement()
{
return false;
}
protected boolean func_40134_ak()
{
return true;
}
}