summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server/EntitySheep.java
diff options
context:
space:
mode:
authorAndrew Ardill <andrew.ardill@gmail.com>2011-01-17 11:03:19 +0800
committerDinner Bone <dinnerbone@dinnerbone.com>2011-01-18 00:13:32 +0800
commit5209e17e1bd0e0803035c697c1ec10c49831dfdb (patch)
tree849b2a1cae93687c886a0f55d63b0e93fb636cea /src/main/java/net/minecraft/server/EntitySheep.java
parent5f2c8108b776ab5710adfe597574fb0b7e929e36 (diff)
downloadcraftbukkit-5209e17e1bd0e0803035c697c1ec10c49831dfdb.tar
craftbukkit-5209e17e1bd0e0803035c697c1ec10c49831dfdb.tar.gz
craftbukkit-5209e17e1bd0e0803035c697c1ec10c49831dfdb.tar.lz
craftbukkit-5209e17e1bd0e0803035c697c1ec10c49831dfdb.tar.xz
craftbukkit-5209e17e1bd0e0803035c697c1ec10c49831dfdb.zip
Adding all Entities into CraftBukkit.
These are needed to properly allow for determining class type, in accordance with current practice.
Diffstat (limited to 'src/main/java/net/minecraft/server/EntitySheep.java')
-rw-r--r--src/main/java/net/minecraft/server/EntitySheep.java129
1 files changed, 129 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/EntitySheep.java b/src/main/java/net/minecraft/server/EntitySheep.java
new file mode 100644
index 00000000..dcb02d90
--- /dev/null
+++ b/src/main/java/net/minecraft/server/EntitySheep.java
@@ -0,0 +1,129 @@
+package net.minecraft.server;
+
+import java.util.Random;
+
+public class EntitySheep extends EntityAnimals {
+
+ public static final float a[][] = {
+ {
+ 1.0F, 1.0F, 1.0F
+ }, {
+ 0.95F, 0.7F, 0.2F
+ }, {
+ 0.9F, 0.5F, 0.85F
+ }, {
+ 0.6F, 0.7F, 0.95F
+ }, {
+ 0.9F, 0.9F, 0.2F
+ }, {
+ 0.5F, 0.8F, 0.1F
+ }, {
+ 0.95F, 0.7F, 0.8F
+ }, {
+ 0.3F, 0.3F, 0.3F
+ }, {
+ 0.6F, 0.6F, 0.6F
+ }, {
+ 0.3F, 0.6F, 0.7F
+ }, {
+ 0.7F, 0.4F, 0.9F
+ }, {
+ 0.2F, 0.4F, 0.8F
+ }, {
+ 0.5F, 0.4F, 0.3F
+ }, {
+ 0.4F, 0.5F, 0.2F
+ }, {
+ 0.8F, 0.3F, 0.3F
+ }, {
+ 0.1F, 0.1F, 0.1F
+ }
+ };
+
+ public EntitySheep(World world) {
+ super(world);
+ aP = "/mob/sheep.png";
+ a(0.9F, 1.3F);
+ }
+
+ protected void a() {
+ super.a();
+ af.a(16, ((new Byte((byte) 0))));
+ }
+
+ public boolean a(Entity entity, int i) {
+ if (!l.z && !f_() && (entity instanceof EntityLiving)) {
+ a(true);
+ int j = 1 + W.nextInt(3);
+
+ for (int k = 0; k < j; k++) {
+ EntityItem entityitem = a(new ItemStack(Block.ab.bi, 1, e_()), 1.0F);
+
+ entityitem.t += W.nextFloat() * 0.05F;
+ entityitem.s += (W.nextFloat() - W.nextFloat()) * 0.1F;
+ entityitem.u += (W.nextFloat() - W.nextFloat()) * 0.1F;
+ }
+ }
+ return super.a(entity, i);
+ }
+
+ public void a(NBTTagCompound nbttagcompound) {
+ super.a(nbttagcompound);
+ nbttagcompound.a("Sheared", f_());
+ nbttagcompound.a("Color", (byte) e_());
+ }
+
+ public void b(NBTTagCompound nbttagcompound) {
+ super.b(nbttagcompound);
+ a(nbttagcompound.l("Sheared"));
+ a(((int) (nbttagcompound.b("Color"))));
+ }
+
+ protected String e() {
+ return "mob.sheep";
+ }
+
+ protected String f() {
+ return "mob.sheep";
+ }
+
+ protected String g() {
+ return "mob.sheep";
+ }
+
+ public int e_() {
+ return af.a(16) & 0xf;
+ }
+
+ public void a(int i) {
+ byte byte0 = af.a(16);
+
+ af.b(16, ((Byte.valueOf((byte) (byte0 & 0xf0 | i & 0xf)))));
+ }
+
+ public boolean f_() {
+ return (af.a(16) & 0x10) != 0;
+ }
+
+ public void a(boolean flag) {
+ byte byte0 = af.a(16);
+
+ if (flag) {
+ af.b(16, ((Byte.valueOf((byte) (byte0 | 0x10)))));
+ } else {
+ af.b(16, ((Byte.valueOf((byte) (byte0 & 0xffffffef)))));
+ }
+ }
+
+ public static int a(Random random) {
+ int i = random.nextInt(100);
+
+ if (i < 5) {
+ return 15;
+ }
+ if (i < 10) {
+ return 7;
+ }
+ return i >= 15 ? 0 : 8;
+ }
+}