Archiviert
13
0

Updated to Minecraft 1.1

Dieser Commit ist enthalten in:
Erik Broes 2012-01-12 23:10:13 +01:00
Ursprung dd5ef8725c
Commit 7219d4dd85
82 geänderte Dateien mit 1472 neuen und 1687 gelöschten Zeilen

Datei anzeigen

@ -52,7 +52,7 @@
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>minecraft-server</artifactId>
<version>1.0.1_01</version>
<version>1.1</version>
<type>jar</type>
<scope>compile</scope>
</dependency>

Datei anzeigen

@ -284,10 +284,10 @@ public class Block {
}
public boolean a(int i, boolean flag) {
return this.v_();
return this.x_();
}
public boolean v_() {
public boolean x_() {
return true;
}
@ -571,6 +571,8 @@ public class Block {
return this.material.getPushReaction();
}
public void a(World world, int i, int j, int k, Entity entity, float f) {}
static {
Item.byId[WOOL.id] = (new ItemCloth(WOOL.id - 256)).a("cloth");
Item.byId[LOG.id] = (new ItemWithAuxData(LOG.id - 256, LOG)).a("log");

Datei anzeigen

@ -214,7 +214,7 @@ public class BlockFire extends Block {
}
}
public boolean v_() {
public boolean x_() {
return false;
}

Datei anzeigen

@ -35,7 +35,7 @@ public class BlockFlowing extends BlockFluids {
int l = this.g(world, i, j, k);
byte b0 = 1;
if (this.material == Material.LAVA && !world.worldProvider.d) {
if (this.material == Material.LAVA && !world.worldProvider.e) {
b0 = 2;
}

Datei anzeigen

@ -138,8 +138,15 @@ public class BlockLeaves extends BlockTransparant {
return Block.SAPLING.id;
}
public void dropNaturally(World world, int i, int j, int k, int l, float f, int i1) {
super.dropNaturally(world, i, j, k, l, f, i1);
if (!world.isStatic && (l & 3) == 0 && world.random.nextInt(200) == 0) {
this.a(world, i, j, k, new ItemStack(Item.APPLE, 1, 0));
}
}
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
if (!world.isStatic && entityhuman.P() != null && entityhuman.P().id == Item.SHEARS.id) {
if (!world.isStatic && entityhuman.Q() != null && entityhuman.Q().id == Item.SHEARS.id) {
entityhuman.a(StatisticList.C[this.id], 1);
this.a(world, i, j, k, new ItemStack(Block.LEAVES.id, 1, l & 3));
} else {

Datei anzeigen

@ -52,7 +52,7 @@ public class BlockMinecartDetector extends BlockMinecartTrack {
boolean flag = (l & 8) != 0;
boolean flag1 = false;
float f = 0.125F;
List list = world.a(EntityMinecart.class, AxisAlignedBB.b((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) j + 0.25D, (double) ((float) (k + 1) - f)));
List list = world.a(EntityMinecart.class, AxisAlignedBB.b((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) ((float) (j + 1) - f), (double) ((float) (k + 1) - f)));
if (list.size() > 0) {
flag1 = true;

Datei anzeigen

@ -171,7 +171,7 @@ public class BlockRedstoneWire extends Block {
}
}
if (k1 == 0 || l1 == 0) {
if (k1 < l1 || l1 == 0) {
this.b.add(new ChunkPosition(i, j, k));
this.b.add(new ChunkPosition(i - 1, j, k));
this.b.add(new ChunkPosition(i + 1, j, k));
@ -236,6 +236,10 @@ public class BlockRedstoneWire extends Block {
if (!world.isStatic) {
world.applyPhysics(i, j + 1, k, this.id);
world.applyPhysics(i, j - 1, k, this.id);
world.applyPhysics(i + 1, j, k, this.id);
world.applyPhysics(i - 1, j, k, this.id);
world.applyPhysics(i, j, k + 1, this.id);
world.applyPhysics(i, j, k - 1, this.id);
this.g(world, i, j, k);
this.h(world, i - 1, j, k);
this.h(world, i + 1, j, k);
@ -348,10 +352,8 @@ public class BlockRedstoneWire extends Block {
return true;
} else if (i1 == 0) {
return false;
} else if (Block.byId[i1].isPowerSource() && l != -1) {
return true;
} else if (i1 != Block.DIODE_OFF.id && i1 != Block.DIODE_ON.id) {
return false;
return Block.byId[i1].isPowerSource() && l != -1;
} else {
int j1 = iblockaccess.getData(i, j, k);

Datei anzeigen

@ -35,7 +35,7 @@ public class BlockSnow extends Block {
public boolean canPlace(World world, int i, int j, int k) {
int l = world.getTypeId(i, j - 1, k);
return l != 0 && Block.byId[l].a() ? world.getMaterial(i, j - 1, k).isSolid() : false;
return l != 0 && (l == Block.LEAVES.id || Block.byId[l].a()) ? world.getMaterial(i, j - 1, k).isSolid() : false;
}
public void doPhysics(World world, int i, int j, int k, int l) {

Datei anzeigen

@ -47,8 +47,8 @@ public class BlockSoil extends Block {
}
}
public void b(World world, int i, int j, int k, Entity entity) {
if (world.random.nextInt(4) == 0) {
public void a(World world, int i, int j, int k, Entity entity, float f) {
if (world.random.nextFloat() < f - 0.5F) {
// CraftBukkit start - Interact Soil
org.bukkit.event.Cancellable cancellable;
if (entity instanceof EntityHuman) {

Datei anzeigen

@ -1,151 +0,0 @@
package net.minecraft.server;
import java.util.ArrayList;
import java.util.Random;
public class BlockStairs extends Block {
private Block a;
protected BlockStairs(int i, Block block) {
super(i, block.textureId, block.material);
this.a = block;
this.c(block.strength);
this.b(block.durability / 3.0F);
this.a(block.stepSound);
this.g(255);
}
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
public AxisAlignedBB e(World world, int i, int j, int k) {
return super.e(world, i, j, k);
}
public boolean a() {
return false;
}
public boolean b() {
return false;
}
public int c() {
return 10;
}
public void a(World world, int i, int j, int k, AxisAlignedBB axisalignedbb, ArrayList arraylist) {
int l = world.getData(i, j, k);
if (l == 0) {
this.a(0.0F, 0.0F, 0.0F, 0.5F, 0.5F, 1.0F);
super.a(world, i, j, k, axisalignedbb, arraylist);
this.a(0.5F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
super.a(world, i, j, k, axisalignedbb, arraylist);
} else if (l == 1) {
this.a(0.0F, 0.0F, 0.0F, 0.5F, 1.0F, 1.0F);
super.a(world, i, j, k, axisalignedbb, arraylist);
this.a(0.5F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
super.a(world, i, j, k, axisalignedbb, arraylist);
} else if (l == 2) {
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 0.5F);
super.a(world, i, j, k, axisalignedbb, arraylist);
this.a(0.0F, 0.0F, 0.5F, 1.0F, 1.0F, 1.0F);
super.a(world, i, j, k, axisalignedbb, arraylist);
} else if (l == 3) {
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.5F);
super.a(world, i, j, k, axisalignedbb, arraylist);
this.a(0.0F, 0.0F, 0.5F, 1.0F, 0.5F, 1.0F);
super.a(world, i, j, k, axisalignedbb, arraylist);
}
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
public void b(World world, int i, int j, int k, EntityHuman entityhuman) {
this.a.b(world, i, j, k, entityhuman);
}
public void postBreak(World world, int i, int j, int k, int l) {
this.a.postBreak(world, i, j, k, l);
}
public float a(Entity entity) {
return this.a.a(entity);
}
public int a(int i, int j) {
return this.a.a(i, 0);
}
public int a(int i) {
return this.a.a(i, 0);
}
public int d() {
return this.a.d();
}
public void a(World world, int i, int j, int k, Entity entity, Vec3D vec3d) {
this.a.a(world, i, j, k, entity, vec3d);
}
public boolean v_() {
return this.a.v_();
}
public boolean a(int i, boolean flag) {
return this.a.a(i, flag);
}
public boolean canPlace(World world, int i, int j, int k) {
return this.a.canPlace(world, i, j, k);
}
public void onPlace(World world, int i, int j, int k) {
this.doPhysics(world, i, j, k, 0);
this.a.onPlace(world, i, j, k);
}
public void remove(World world, int i, int j, int k) {
this.a.remove(world, i, j, k);
}
public void b(World world, int i, int j, int k, Entity entity) {
this.a.b(world, i, j, k, entity);
}
public void a(World world, int i, int j, int k, Random random) {
this.a.a(world, i, j, k, random);
}
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman) {
return this.a.interact(world, i, j, k, entityhuman);
}
public void wasExploded(World world, int i, int j, int k) {
this.a.wasExploded(world, i, j, k);
}
public void postPlace(World world, int i, int j, int k, EntityLiving entityliving) {
int l = MathHelper.floor((double) (entityliving.yaw * 4.0F / 360.0F) + 0.5D) & 3;
if (l == 0) {
world.setData(i, j, k, 2);
}
if (l == 1) {
world.setData(i, j, k, 1);
}
if (l == 2) {
world.setData(i, j, k, 3);
}
if (l == 3) {
world.setData(i, j, k, 0);
}
}
}

Datei anzeigen

@ -121,7 +121,7 @@ public class BlockTrapdoor extends Block {
}
// CraftBukkit start
if (l > 0 && Block.byId[l] != null && Block.byId[l].isPowerSource()) {
if (l == 0 || l > 0 && Block.byId[l] != null && Block.byId[l].isPowerSource()) {
org.bukkit.World bworld = world.getWorld();
org.bukkit.block.Block block = bworld.getBlockAt(i, j, k);

Datei anzeigen

@ -108,7 +108,7 @@ public class Chunk {
i = l;
}
if (!this.world.worldProvider.e) {
if (!this.world.worldProvider.f) {
int j1 = 15;
int k1 = this.world.height - 1;
@ -239,7 +239,7 @@ public class Chunk {
l1 = this.z * 16 + k;
int j2;
if (!this.world.worldProvider.e) {
if (!this.world.worldProvider.f) {
if (i1 < l) {
for (i2 = i1; i2 < l; ++i2) {
this.h.a(i, i2, k, 15);
@ -274,7 +274,7 @@ public class Chunk {
k2 = l;
}
if (!this.world.worldProvider.e) {
if (!this.world.worldProvider.f) {
this.d(k1 - 1, l1, j2, k2);
this.d(k1 + 1, l1, j2, k2);
this.d(k1, l1 - 1, j2, k2);
@ -311,13 +311,13 @@ public class Chunk {
if (l1 != 0) {
if (!this.world.isStatic) {
Block.byId[l1].remove(this.world, i2, j, j2);
} else if (Block.byId[l1] instanceof BlockContainer) {
} else if (Block.byId[l1] instanceof BlockContainer && l1 != l) {
this.world.n(i2, j, j2);
}
}
this.g.a(i, j, k, i1);
if (!this.world.worldProvider.e) {
if (!this.world.worldProvider.f) {
if (Block.q[b0 & 255] != 0) {
if (j >= k1) {
this.g(i, j + 1, k);
@ -343,7 +343,7 @@ public class Chunk {
tileentity = this.d(i, j, k);
if (tileentity == null) {
tileentity = ((BlockContainer) Block.byId[l]).a_();
this.world.setTileEntity(i2, j, j2, tileentity); // CraftBukkit - Use world rather than in-chunk coords
this.world.setTileEntity(i2, j, j2, tileentity);
}
if (tileentity != null) {
@ -407,7 +407,7 @@ public class Chunk {
tileentity = this.d(i, j, k);
if (tileentity == null) {
tileentity = ((BlockContainer) Block.byId[l]).a_();
this.world.setTileEntity(l1, j, i2, tileentity); // CraftBukkit - Use world rather than in-chunk coords
this.world.setTileEntity(l1, j, i2, tileentity);
}
if (tileentity != null) {
@ -460,7 +460,7 @@ public class Chunk {
public void a(EnumSkyBlock enumskyblock, int i, int j, int k, int l) {
this.q = true;
if (enumskyblock == EnumSkyBlock.SKY) {
if (!this.world.worldProvider.e) {
if (!this.world.worldProvider.f) {
this.h.a(i, j, k, l);
}
} else {
@ -473,7 +473,7 @@ public class Chunk {
}
public int c(int i, int j, int k, int l) {
int i1 = this.world.worldProvider.e ? 0 : this.h.a(i, j, k);
int i1 = this.world.worldProvider.f ? 0 : this.h.a(i, j, k);
if (i1 > 0) {
a = true;
@ -512,15 +512,15 @@ public class Chunk {
k = this.entitySlices.length - 1;
}
entity.bW = true;
entity.bX = this.x;
entity.bY = k;
entity.bZ = this.z;
entity.bZ = true;
entity.ca = this.x;
entity.cb = k;
entity.cc = this.z;
this.entitySlices[k].add(entity);
}
public void b(Entity entity) {
this.a(entity, entity.bY);
this.a(entity, entity.cb);
}
public void a(Entity entity, int i) {
@ -670,7 +670,7 @@ public class Chunk {
if (entity1 != entity && entity1.boundingBox.a(axisalignedbb)) {
list.add(entity1);
Entity[] aentity = entity1.aG();
Entity[] aentity = entity1.aR();
if (aentity != null) {
for (int i1 = 0; i1 < aentity.length; ++i1) {
@ -848,7 +848,7 @@ public class Chunk {
}
public void i() {
if (this.v && !this.world.worldProvider.e) {
if (this.v && !this.world.worldProvider.f) {
this.k();
}
}

Datei anzeigen

@ -3,6 +3,7 @@ package net.minecraft.server;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
@ -56,6 +57,16 @@ public class ChunkProviderServer implements IChunkProvider {
}
}
public void c() {
Iterator iterator = this.chunkList.iterator();
while (iterator.hasNext()) {
Chunk chunk = (Chunk) iterator.next();
this.queueUnload(chunk.x, chunk.z);
}
}
public Chunk getChunkAt(int i, int j) {
// CraftBukkit start
this.unloadQueue.remove(i, j);
@ -254,6 +265,10 @@ public class ChunkProviderServer implements IChunkProvider {
return !this.world.savingDisabled;
}
public String d() {
return "ServerChunkCache: " + this.chunks.values().size() + " Drop: " + this.unloadQueue.size();
}
public List getMobsFor(EnumCreatureType enumcreaturetype, int i, int j, int k) {
return this.chunkProvider.getMobsFor(enumcreaturetype, i, j, k);
}

Datei anzeigen

@ -1,310 +0,0 @@
package net.minecraft.server;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public abstract class Container {
public List d = new ArrayList();
public List e = new ArrayList();
public int windowId = 0;
private short a = 0;
protected List listeners = new ArrayList();
private Set b = new HashSet();
public Container() {}
protected void a(Slot slot) {
slot.c = this.e.size();
this.e.add(slot);
this.d.add(null);
}
public void a(ICrafting icrafting) {
if (this.listeners.contains(icrafting)) {
throw new IllegalArgumentException("Listener already listening");
} else {
this.listeners.add(icrafting);
icrafting.a(this, this.b());
this.a();
}
}
public List b() {
ArrayList arraylist = new ArrayList();
for (int i = 0; i < this.e.size(); ++i) {
arraylist.add(((Slot) this.e.get(i)).getItem());
}
return arraylist;
}
public void a() {
for (int i = 0; i < this.e.size(); ++i) {
ItemStack itemstack = ((Slot) this.e.get(i)).getItem();
ItemStack itemstack1 = (ItemStack) this.d.get(i);
if (!ItemStack.equals(itemstack1, itemstack)) {
itemstack1 = itemstack == null ? null : itemstack.cloneItemStack();
this.d.set(i, itemstack1);
for (int j = 0; j < this.listeners.size(); ++j) {
((ICrafting) this.listeners.get(j)).a(this, i, itemstack1);
}
}
}
}
public boolean a(EntityHuman entityhuman, int i) {
return false;
}
public Slot a(IInventory iinventory, int i) {
for (int j = 0; j < this.e.size(); ++j) {
Slot slot = (Slot) this.e.get(j);
if (slot.a(iinventory, i)) {
return slot;
}
}
return null;
}
public Slot b(int i) {
return (Slot) this.e.get(i);
}
public ItemStack a(int i) {
Slot slot = (Slot) this.e.get(i);
return slot != null ? slot.getItem() : null;
}
public ItemStack a(int i, int j, boolean flag, EntityHuman entityhuman) {
ItemStack itemstack = null;
if (j > 1) {
return null;
} else {
if (j == 0 || j == 1) {
PlayerInventory playerinventory = entityhuman.inventory;
if (i == -999) {
if (playerinventory.l() != null && i == -999) {
if (j == 0) {
entityhuman.b(playerinventory.l());
playerinventory.b((ItemStack) null);
}
if (j == 1) {
entityhuman.b(playerinventory.l().a(1));
if (playerinventory.l().count == 0) {
playerinventory.b((ItemStack) null);
}
}
}
} else if (flag) {
ItemStack itemstack1 = this.a(i);
if (itemstack1 != null) {
int k = itemstack1.id;
itemstack = itemstack1.cloneItemStack();
Slot slot = (Slot) this.e.get(i);
if (slot != null && slot.getItem() != null && slot.getItem().id == k) {
this.b(i, j, flag, entityhuman);
}
}
} else {
if (i < 0) {
return null;
}
Slot slot1 = (Slot) this.e.get(i);
if (slot1 != null) {
slot1.d();
ItemStack itemstack2 = slot1.getItem();
ItemStack itemstack3 = playerinventory.l();
if (itemstack2 != null) {
itemstack = itemstack2.cloneItemStack();
}
int l;
if (itemstack2 == null) {
if (itemstack3 != null && slot1.isAllowed(itemstack3)) {
l = j == 0 ? itemstack3.count : 1;
if (l > slot1.a()) {
l = slot1.a();
}
slot1.c(itemstack3.a(l));
if (itemstack3.count == 0) {
playerinventory.b((ItemStack) null);
}
}
} else if (itemstack3 == null) {
l = j == 0 ? itemstack2.count : (itemstack2.count + 1) / 2;
ItemStack itemstack4 = slot1.a(l);
playerinventory.b(itemstack4);
if (itemstack2.count == 0) {
slot1.c((ItemStack) null);
}
slot1.b(playerinventory.l());
} else if (slot1.isAllowed(itemstack3)) {
// CraftBukkit
if (itemstack2.id == itemstack3.id && (!itemstack2.usesData() || itemstack2.getData() == itemstack3.getData()) &&
((itemstack2.tag == null && itemstack3.tag == null) || (itemstack2.tag != null && itemstack2.tag.equals(itemstack3.tag)))) {
l = j == 0 ? itemstack3.count : 1;
if (l > slot1.a() - itemstack2.count) {
l = slot1.a() - itemstack2.count;
}
if (l > itemstack3.getMaxStackSize() - itemstack2.count) {
l = itemstack3.getMaxStackSize() - itemstack2.count;
}
itemstack3.a(l);
if (itemstack3.count == 0) {
playerinventory.b((ItemStack) null);
}
itemstack2.count += l;
} else if (itemstack3.count <= slot1.a()) {
slot1.c(itemstack3);
playerinventory.b(itemstack2);
}
// CraftBukkit
} else if (itemstack2.id == itemstack3.id && (!itemstack2.usesData() || itemstack2.getData() == itemstack3.getData()) &&
((itemstack2.tag == null && itemstack3.tag == null) || (itemstack2 != null && itemstack2.tag.equals(itemstack3.tag)))) {
l = itemstack2.count;
if (l > 0 && l + itemstack3.count <= itemstack3.getMaxStackSize()) {
itemstack3.count += l;
itemstack2.a(l);
if (itemstack2.count == 0) {
slot1.c((ItemStack) null);
}
slot1.b(playerinventory.l());
}
}
}
}
}
return itemstack;
}
}
protected void b(int i, int j, boolean flag, EntityHuman entityhuman) {
this.a(i, j, flag, entityhuman);
}
public void a(EntityHuman entityhuman) {
PlayerInventory playerinventory = entityhuman.inventory;
if (playerinventory.l() != null) {
entityhuman.b(playerinventory.l());
playerinventory.b((ItemStack) null);
}
}
public void a(IInventory iinventory) {
this.a();
}
public void a(int i, ItemStack itemstack) {
this.b(i).c(itemstack);
}
public boolean c(EntityHuman entityhuman) {
return !this.b.contains(entityhuman);
}
public void a(EntityHuman entityhuman, boolean flag) {
if (flag) {
this.b.remove(entityhuman);
} else {
this.b.add(entityhuman);
}
}
public abstract boolean b(EntityHuman entityhuman);
protected boolean a(ItemStack itemstack, int i, int j, boolean flag) {
boolean flag1 = false;
int k = i;
if (flag) {
k = j - 1;
}
Slot slot;
ItemStack itemstack1;
if (itemstack.isStackable()) {
while (itemstack.count > 0 && (!flag && k < j || flag && k >= i)) {
slot = (Slot) this.e.get(k);
itemstack1 = slot.getItem();
if (itemstack1 != null && itemstack1.id == itemstack.id && (!itemstack.usesData() || itemstack.getData() == itemstack1.getData())) {
int l = itemstack1.count + itemstack.count;
if (l <= itemstack.getMaxStackSize()) {
itemstack.count = 0;
itemstack1.count = l;
slot.d();
flag1 = true;
} else if (itemstack1.count < itemstack.getMaxStackSize()) {
itemstack.count -= itemstack.getMaxStackSize() - itemstack1.count;
itemstack1.count = itemstack.getMaxStackSize();
slot.d();
flag1 = true;
}
}
if (flag) {
--k;
} else {
++k;
}
}
}
if (itemstack.count > 0) {
if (flag) {
k = j - 1;
} else {
k = i;
}
while (!flag && k < j || flag && k >= i) {
slot = (Slot) this.e.get(k);
itemstack1 = slot.getItem();
if (itemstack1 == null) {
slot.c(itemstack.cloneItemStack());
slot.d();
itemstack.count = 0;
flag1 = true;
break;
}
if (flag) {
--k;
} else {
++k;
}
}
}
return flag1;
}
}

Datei anzeigen

@ -75,7 +75,7 @@ public class CraftingManager {
this.registerShapedRecipe(new ItemStack(Block.STONE_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Block.SMOOTH_BRICK});
this.registerShapedRecipe(new ItemStack(Block.NETHER_BRICK_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Block.NETHER_BRICK});
this.registerShapedRecipe(new ItemStack(Item.PAINTING, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Item.STICK, Character.valueOf('X'), Block.WOOL});
this.registerShapedRecipe(new ItemStack(Item.GOLDEN_APPLE, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.GOLD_BLOCK, Character.valueOf('X'), Item.APPLE});
this.registerShapedRecipe(new ItemStack(Item.GOLDEN_APPLE, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Item.GOLD_NUGGET, Character.valueOf('X'), Item.APPLE});
this.registerShapedRecipe(new ItemStack(Block.LEVER, 1), new Object[] { "X", "#", Character.valueOf('#'), Block.COBBLESTONE, Character.valueOf('X'), Item.STICK});
this.registerShapedRecipe(new ItemStack(Block.REDSTONE_TORCH_ON, 1), new Object[] { "X", "#", Character.valueOf('#'), Item.STICK, Character.valueOf('X'), Item.REDSTONE});
this.registerShapedRecipe(new ItemStack(Item.DIODE, 1), new Object[] { "#X#", "III", Character.valueOf('#'), Block.REDSTONE_TORCH_ON, Character.valueOf('X'), Item.REDSTONE, Character.valueOf('I'), Block.STONE});

Datei anzeigen

@ -22,6 +22,10 @@ public abstract class Enchantment {
public static final Enchantment SILK_TOUCH = new EnchantmentSilkTouch(33, 1);
public static final Enchantment DURABILITY = new EnchantmentDurability(34, 5);
public static final Enchantment LOOT_BONUS_BLOCKS = new EnchantmentLootBonus(35, 2, EnchantmentSlotType.DIGGER);
public static final Enchantment ARROW_DAMAGE = new EnchantmentArrowDamage(48, 10);
public static final Enchantment ARROW_KNOCKBACK = new EnchantmentArrowKnockback(49, 2);
public static final Enchantment ARROW_FIRE = new EnchantmentFlameArrows(50, 2);
public static final Enchantment ARROW_INFINITE = new EnchantmentInfiniteArrows(51, 1);
public final int id;
private final int weight;
public EnchantmentSlotType slot;

Datei anzeigen

@ -1,242 +0,0 @@
package net.minecraft.server;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Random;
public class EnchantmentManager {
private static final Random random = new Random();
private static final EnchantmentModifierProtection b = new EnchantmentModifierProtection((EmptyClass3) null);
private static final EnchantmentModifierDamage c = new EnchantmentModifierDamage((EmptyClass3) null);
public EnchantmentManager() {}
public static int getEnchantmentLevel(int i, ItemStack itemstack) { // CraftBukkit - priv to pub
if (itemstack == null) {
return 0;
} else {
NBTTagList nbttaglist = itemstack.getEnchantments();
if (nbttaglist == null) {
return 0;
} else {
for (int j = 0; j < nbttaglist.size(); ++j) {
short short1 = ((NBTTagCompound) nbttaglist.get(j)).getShort("id");
short short2 = ((NBTTagCompound) nbttaglist.get(j)).getShort("lvl");
if (short1 == i) {
return short2;
}
}
return 0;
}
}
}
private static int getEnchantmentLevel(int i, ItemStack[] aitemstack) {
int j = 0;
ItemStack[] aitemstack1 = aitemstack;
int k = aitemstack.length;
for (int l = 0; l < k; ++l) {
ItemStack itemstack = aitemstack1[l];
int i1 = getEnchantmentLevel(i, itemstack);
if (i1 > j) {
j = i1;
}
}
return j;
}
private static void a(EnchantmentModifier enchantmentmodifier, ItemStack itemstack) {
if (itemstack != null) {
NBTTagList nbttaglist = itemstack.getEnchantments();
if (nbttaglist != null) {
for (int i = 0; i < nbttaglist.size(); ++i) {
short short1 = ((NBTTagCompound) nbttaglist.get(i)).getShort("id");
short short2 = ((NBTTagCompound) nbttaglist.get(i)).getShort("lvl");
if (Enchantment.byId[short1] != null) {
enchantmentmodifier.a(Enchantment.byId[short1], short2);
}
}
}
}
}
private static void a(EnchantmentModifier enchantmentmodifier, ItemStack[] aitemstack) {
ItemStack[] aitemstack1 = aitemstack;
int i = aitemstack.length;
for (int j = 0; j < i; ++j) {
ItemStack itemstack = aitemstack1[j];
a(enchantmentmodifier, itemstack);
}
}
public static int a(PlayerInventory playerinventory, DamageSource damagesource) {
b.a = 0;
b.b = damagesource;
a((EnchantmentModifier) b, playerinventory.armor);
if (b.a > 25) {
b.a = 25;
}
return (b.a + 1 >> 1) + random.nextInt((b.a >> 1) + 1);
}
public static int a(PlayerInventory playerinventory, EntityLiving entityliving) {
c.a = 0;
c.b = entityliving;
a((EnchantmentModifier) c, playerinventory.getItemInHand());
return c.a > 0 ? 1 + random.nextInt(c.a) : 0;
}
public static int getKnockbackEnchantmentLevel(PlayerInventory playerinventory, EntityLiving entityliving) {
return getEnchantmentLevel(Enchantment.KNOCKBACK.id, playerinventory.getItemInHand());
}
public static int getFireAspectEnchantmentLevel(PlayerInventory playerinventory, EntityLiving entityliving) {
return getEnchantmentLevel(Enchantment.FIRE_ASPECT.id, playerinventory.getItemInHand());
}
public static int getOxygenEnchantmentLevel(PlayerInventory playerinventory) {
return getEnchantmentLevel(Enchantment.OXYGEN.id, playerinventory.armor);
}
public static int getDigSpeedEnchantmentLevel(PlayerInventory playerinventory) {
return getEnchantmentLevel(Enchantment.DIG_SPEED.id, playerinventory.getItemInHand());
}
public static int getDurabilityEnchantmentLevel(PlayerInventory playerinventory) {
return getEnchantmentLevel(Enchantment.DURABILITY.id, playerinventory.getItemInHand());
}
public static boolean hasSilkTouchEnchantment(PlayerInventory playerinventory) {
return getEnchantmentLevel(Enchantment.SILK_TOUCH.id, playerinventory.getItemInHand()) > 0;
}
public static int getBonusBlockLootEnchantmentLevel(PlayerInventory playerinventory) {
return getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS.id, playerinventory.getItemInHand());
}
public static int getBonusMonsterLootEnchantmentLevel(PlayerInventory playerinventory) {
return getEnchantmentLevel(Enchantment.LOOT_BONUS_MOBS.id, playerinventory.getItemInHand());
}
public static boolean hasWaterWorkerEnchantment(PlayerInventory playerinventory) {
return getEnchantmentLevel(Enchantment.WATER_WORKER.id, playerinventory.armor) > 0;
}
public static int a(Random random, int i, int j, ItemStack itemstack) {
Item item = itemstack.getItem();
int k = item.c();
if (k <= 0) {
return 0;
} else {
if (j > 30) {
j = 30;
}
j = 1 + random.nextInt((j >> 1) + 1) + random.nextInt(j + 1);
int l = random.nextInt(5) + j;
return i == 0 ? (l >> 1) + 1 : (i == 1 ? l * 2 / 3 + 1 : l);
}
}
public static List a(Random random, ItemStack itemstack, int i) {
Item item = itemstack.getItem();
int j = item.c();
if (j <= 0) {
return null;
} else {
j = 1 + random.nextInt((j >> 1) + 1) + random.nextInt((j >> 1) + 1);
int k = j + i;
float f = (random.nextFloat() + random.nextFloat() - 1.0F) * 0.25F;
int l = (int) ((float) k * (1.0F + f) + 0.5F);
ArrayList arraylist = null;
Map map = a(l, itemstack);
if (map != null && !map.isEmpty()) {
EnchantmentInstance enchantmentinstance = (EnchantmentInstance) WeightedRandom.a(random, map.values());
if (enchantmentinstance != null) {
arraylist = new ArrayList();
arraylist.add(enchantmentinstance);
for (int i1 = l >> 1; random.nextInt(50) <= i1; i1 >>= 1) {
Iterator iterator = map.keySet().iterator();
while (iterator.hasNext()) {
Integer integer = (Integer) iterator.next();
boolean flag = true;
Iterator iterator1 = arraylist.iterator();
while (true) {
if (iterator1.hasNext()) {
EnchantmentInstance enchantmentinstance1 = (EnchantmentInstance) iterator1.next();
if (enchantmentinstance1.a.a(Enchantment.byId[integer.intValue()])) {
continue;
}
flag = false;
}
if (!flag) {
iterator.remove();
}
break;
}
}
if (!map.isEmpty()) {
EnchantmentInstance enchantmentinstance2 = (EnchantmentInstance) WeightedRandom.a(random, map.values());
arraylist.add(enchantmentinstance2);
}
}
}
}
return arraylist;
}
}
public static Map a(int i, ItemStack itemstack) {
Item item = itemstack.getItem();
HashMap hashmap = null;
Enchantment[] aenchantment = Enchantment.byId;
int j = aenchantment.length;
for (int k = 0; k < j; ++k) {
Enchantment enchantment = aenchantment[k];
if (enchantment != null && enchantment.slot.canEnchant(item)) {
for (int l = enchantment.getStartLevel(); l <= enchantment.getMaxLevel(); ++l) {
if (i >= enchantment.a(l) && i <= enchantment.b(l)) {
if (hashmap == null) {
hashmap = new HashMap();
}
hashmap.put(Integer.valueOf(enchantment.id), new EnchantmentInstance(enchantment, l));
}
}
}
}
return hashmap;
}
}

Datei anzeigen

@ -28,8 +28,8 @@ public abstract class Entity {
private static int entityCount = 0;
public int id;
public double bb;
public boolean bc;
public double be;
public boolean bf;
public Entity passenger;
public Entity vehicle;
public World world;
@ -49,76 +49,76 @@ public abstract class Entity {
public final AxisAlignedBB boundingBox;
public boolean onGround;
public boolean positionChanged;
public boolean bw;
public boolean bx;
public boolean velocityChanged;
protected boolean bz;
public boolean bz;
public boolean bA;
public boolean velocityChanged;
protected boolean bC;
public boolean bD;
public boolean dead;
public float height;
public float width;
public float length;
public float bF;
public float bG;
public float bI;
public float bJ;
public float fallDistance; // CraftBukkit - private -> public
private int b;
public double bI;
public double bJ;
public double bK;
public float bL;
public float bM;
public boolean bN;
public double bL;
public double bM;
public double bN;
public float bO;
public float bP;
public boolean bQ;
public float bR;
protected Random random;
public int ticksLived;
public int maxFireTicks;
public int fireTicks; // CraftBukkit - private -> public
protected boolean bS;
protected boolean bV;
public int noDamageTicks;
private boolean justCreated;
protected boolean fireProof;
protected DataWatcher datawatcher;
private double e;
private double f;
public boolean bW;
public int bX;
public int bY;
public int bZ;
public boolean ca;
public boolean cb;
public boolean bZ;
public int ca;
public int cb;
public int cc;
public boolean cd;
public boolean ce;
public UUID uniqueId = UUID.randomUUID(); // CraftBukkit
public Entity(World world) {
this.id = entityCount++;
this.bb = 1.0D;
this.bc = false;
this.be = 1.0D;
this.bf = false;
this.boundingBox = AxisAlignedBB.a(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
this.onGround = false;
this.bx = false;
this.bA = false;
this.velocityChanged = false;
this.bA = true;
this.bD = true;
this.dead = false;
this.height = 0.0F;
this.width = 0.6F;
this.length = 1.8F;
this.bF = 0.0F;
this.bG = 0.0F;
this.bI = 0.0F;
this.bJ = 0.0F;
this.fallDistance = 0.0F;
this.b = 1;
this.bL = 0.0F;
this.bM = 0.0F;
this.bN = false;
this.bO = 0.0F;
this.bP = 0.0F;
this.bQ = false;
this.bR = 0.0F;
this.random = new Random();
this.ticksLived = 0;
this.maxFireTicks = 1;
this.fireTicks = 0;
this.bS = false;
this.bV = false;
this.noDamageTicks = 0;
this.justCreated = true;
this.fireProof = false;
this.datawatcher = new DataWatcher();
this.bW = false;
this.bZ = false;
this.world = world;
this.setPosition(0.0D, 0.0D, 0.0D);
this.datawatcher.a(0, Byte.valueOf((byte) 0));
@ -188,21 +188,21 @@ public abstract class Entity {
float f = this.width / 2.0F;
float f1 = this.length;
this.boundingBox.c(d0 - (double) f, d1 - (double) this.height + (double) this.bL, d2 - (double) f, d0 + (double) f, d1 - (double) this.height + (double) this.bL + (double) f1, d2 + (double) f);
this.boundingBox.c(d0 - (double) f, d1 - (double) this.height + (double) this.bO, d2 - (double) f, d0 + (double) f, d1 - (double) this.height + (double) this.bO + (double) f1, d2 + (double) f);
}
public void w_() {
this.af();
public void y_() {
this.am();
}
public void af() {
public void am() {
// MethodProfiler.a("entityBaseTick"); // CraftBukkit - not in production code
if (this.vehicle != null && this.vehicle.dead) {
this.vehicle = null;
}
++this.ticksLived;
this.bF = this.bG;
this.bI = this.bJ;
this.lastX = this.locX;
this.lastY = this.locY;
this.lastZ = this.locZ;
@ -223,7 +223,7 @@ public abstract class Entity {
}
if (this.i_()) {
if (!this.bS && !this.justCreated) {
if (!this.bV && !this.justCreated) {
float f = MathHelper.a(this.motX * this.motX * 0.20000000298023224D + this.motY * this.motY + this.motZ * this.motZ * 0.20000000298023224D) * 0.2F;
if (f > 1.0F) {
@ -250,10 +250,10 @@ public abstract class Entity {
}
this.fallDistance = 0.0F;
this.bS = true;
this.bV = true;
this.fireTicks = 0;
} else {
this.bS = false;
this.bV = false;
}
if (this.world.isStatic) {
@ -284,13 +284,13 @@ public abstract class Entity {
}
}
if (this.aA()) {
this.av();
if (this.aL()) {
this.aG();
this.fallDistance *= 0.5F;
}
if (this.locY < -64.0D) {
this.ao();
this.az();
}
if (!this.world.isStatic) {
@ -302,7 +302,7 @@ public abstract class Entity {
// MethodProfiler.a(); // CraftBukkit - not in production code
}
protected void av() {
protected void aG() {
if (!this.fireProof) {
// CraftBukkit start - fallen in lava TODO: this event spams!
if (this instanceof EntityLiving) {
@ -352,7 +352,7 @@ public abstract class Entity {
this.fireTicks = 0;
}
protected void ao() {
protected void az() {
this.die();
}
@ -364,19 +364,19 @@ public abstract class Entity {
}
public void move(double d0, double d1, double d2) {
if (this.bN) {
if (this.bQ) {
this.boundingBox.d(d0, d1, d2);
this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D;
this.locY = this.boundingBox.b + (double) this.height - (double) this.bL;
this.locY = this.boundingBox.b + (double) this.height - (double) this.bO;
this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D;
} else {
// MethodProfiler.a("move"); // CraftBukkit - not in production code
this.bL *= 0.4F;
this.bO *= 0.4F;
double d3 = this.locX;
double d4 = this.locZ;
if (this.bz) {
this.bz = false;
if (this.bC) {
this.bC = false;
d0 *= 0.25D;
d1 *= 0.05000000074505806D;
d2 *= 0.25D;
@ -422,7 +422,7 @@ public abstract class Entity {
}
this.boundingBox.d(0.0D, d1, 0.0D);
if (!this.bA && d6 != d1) {
if (!this.bD && d6 != d1) {
d2 = 0.0D;
d1 = 0.0D;
d0 = 0.0D;
@ -437,7 +437,7 @@ public abstract class Entity {
}
this.boundingBox.d(d0, 0.0D, 0.0D);
if (!this.bA && d5 != d0) {
if (!this.bD && d5 != d0) {
d2 = 0.0D;
d1 = 0.0D;
d0 = 0.0D;
@ -448,7 +448,7 @@ public abstract class Entity {
}
this.boundingBox.d(0.0D, 0.0D, d2);
if (!this.bA && d7 != d2) {
if (!this.bD && d7 != d2) {
d2 = 0.0D;
d1 = 0.0D;
d0 = 0.0D;
@ -458,13 +458,13 @@ public abstract class Entity {
double d10;
int k;
if (this.bM > 0.0F && flag1 && (flag || this.bL < 0.05F) && (d5 != d0 || d7 != d2)) {
if (this.bP > 0.0F && flag1 && (flag || this.bO < 0.05F) && (d5 != d0 || d7 != d2)) {
d9 = d0;
d10 = d1;
double d11 = d2;
d0 = d5;
d1 = (double) this.bM;
d1 = (double) this.bP;
d2 = d7;
AxisAlignedBB axisalignedbb1 = this.boundingBox.clone();
@ -476,7 +476,7 @@ public abstract class Entity {
}
this.boundingBox.d(0.0D, d1, 0.0D);
if (!this.bA && d6 != d1) {
if (!this.bD && d6 != d1) {
d2 = 0.0D;
d1 = 0.0D;
d0 = 0.0D;
@ -487,7 +487,7 @@ public abstract class Entity {
}
this.boundingBox.d(d0, 0.0D, 0.0D);
if (!this.bA && d5 != d0) {
if (!this.bD && d5 != d0) {
d2 = 0.0D;
d1 = 0.0D;
d0 = 0.0D;
@ -498,18 +498,18 @@ public abstract class Entity {
}
this.boundingBox.d(0.0D, 0.0D, d2);
if (!this.bA && d7 != d2) {
if (!this.bD && d7 != d2) {
d2 = 0.0D;
d1 = 0.0D;
d0 = 0.0D;
}
if (!this.bA && d6 != d1) {
if (!this.bD && d6 != d1) {
d2 = 0.0D;
d1 = 0.0D;
d0 = 0.0D;
} else {
d1 = (double) (-this.bM);
d1 = (double) (-this.bP);
for (k = 0; k < list.size(); ++k) {
d1 = ((AxisAlignedBB) list.get(k)).b(this.boundingBox, d1);
@ -527,7 +527,7 @@ public abstract class Entity {
double d12 = this.boundingBox.b - (double) ((int) this.boundingBox.b);
if (d12 > 0.0D) {
this.bL = (float) ((double) this.bL + d12 + 0.01D);
this.bO = (float) ((double) this.bO + d12 + 0.01D);
}
}
}
@ -535,12 +535,12 @@ public abstract class Entity {
// MethodProfiler.a(); // CraftBukkit - not in production code
// MethodProfiler.a("rest"); // CraftBukkit - not in production code
this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D;
this.locY = this.boundingBox.b + (double) this.height - (double) this.bL;
this.locY = this.boundingBox.b + (double) this.height - (double) this.bO;
this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D;
this.positionChanged = d5 != d0 || d7 != d2;
this.bw = d6 != d1;
this.bz = d6 != d1;
this.onGround = d6 != d1 && d6 < 0.0D;
this.bx = this.positionChanged || this.bw;
this.bA = this.positionChanged || this.bz;
this.a(d1, this.onGround);
if (d5 != d0) {
this.motX = 0.0D;
@ -581,7 +581,7 @@ public abstract class Entity {
// CraftBukkit end
if (this.g_() && !flag && this.vehicle == null) {
this.bG = (float) ((double) this.bG + (double) MathHelper.a(d9 * d9 + d10 * d10) * 0.6D);
this.bJ = (float) ((double) this.bJ + (double) MathHelper.a(d9 * d9 + d10 * d10) * 0.6D);
l = MathHelper.floor(this.locX);
i1 = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height);
j1 = MathHelper.floor(this.locZ);
@ -590,8 +590,8 @@ public abstract class Entity {
k = this.world.getTypeId(l, i1 - 1, j1);
}
if (this.bG > (float) this.b && k > 0) {
this.b = (int) this.bG + 1;
if (this.bJ > (float) this.b && k > 0) {
this.b = (int) this.bJ + 1;
this.a(l, i1, j1, k);
Block.byId[k].b(this.world, l, i1, j1, this);
}
@ -618,7 +618,7 @@ public abstract class Entity {
}
}
boolean flag2 = this.ay();
boolean flag2 = this.aJ();
if (this.world.d(this.boundingBox.shrink(0.0010D, 0.0010D, 0.0010D))) {
this.burn(1);
@ -668,6 +668,21 @@ public abstract class Entity {
protected void a(double d0, boolean flag) {
if (flag) {
if (this.fallDistance > 0.0F) {
if (this instanceof EntityLiving) {
int i = MathHelper.floor(this.locX);
int j = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height);
int k = MathHelper.floor(this.locZ);
int l = this.world.getTypeId(i, j, k);
if (l == 0 && this.world.getTypeId(i, j - 1, k) == Block.FENCE.id) {
l = this.world.getTypeId(i, j - 1, k);
}
if (l > 0) {
Block.byId[l].a(this.world, i, j, k, this, this.fallDistance);
}
}
this.b(this.fallDistance);
this.fallDistance = 0.0F;
}
@ -708,12 +723,12 @@ public abstract class Entity {
}
}
public boolean ay() {
return this.bS || this.world.v(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
public boolean aJ() {
return this.bV || this.world.v(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
}
public boolean az() {
return this.bS;
public boolean aK() {
return this.bV;
}
public boolean i_() {
@ -721,7 +736,7 @@ public abstract class Entity {
}
public boolean a(Material material) {
double d0 = this.locY + (double) this.x();
double d0 = this.locY + (double) this.y();
int i = MathHelper.floor(this.locX);
int j = MathHelper.d((float) MathHelper.floor(d0));
int k = MathHelper.floor(this.locZ);
@ -737,11 +752,11 @@ public abstract class Entity {
}
}
public float x() {
public float y() {
return 0.0F;
}
public boolean aA() {
public boolean aL() {
return this.world.a(this.boundingBox.grow(-0.10000000149011612D, -0.4000000059604645D, -0.10000000149011612D), Material.LAVA);
}
@ -795,7 +810,7 @@ public abstract class Entity {
this.lastZ = this.locZ = d2;
this.lastYaw = this.yaw = f;
this.lastPitch = this.pitch = f1;
this.bL = 0.0F;
this.bO = 0.0F;
double d3 = (double) (this.lastYaw - f);
if (d3 < -180.0D) {
@ -811,9 +826,9 @@ public abstract class Entity {
}
public void setPositionRotation(double d0, double d1, double d2, float f, float f1) {
this.bI = this.lastX = this.locX = d0;
this.bJ = this.lastY = this.locY = d1 + (double) this.height;
this.bK = this.lastZ = this.locZ = d2;
this.bL = this.lastX = this.locX = d0;
this.bM = this.lastY = this.locY = d1 + (double) this.height;
this.bN = this.lastZ = this.locZ = d2;
this.yaw = f;
this.pitch = f1;
this.setPosition(this.locX, this.locY, this.locZ);
@ -873,8 +888,8 @@ public abstract class Entity {
d1 *= d3;
d0 *= 0.05000000074505806D;
d1 *= 0.05000000074505806D;
d0 *= (double) (1.0F - this.bO);
d1 *= (double) (1.0F - this.bO);
d0 *= (double) (1.0F - this.bR);
d1 *= (double) (1.0F - this.bR);
this.b_(-d0, 0.0D, -d1);
entity.b_(d0, 0.0D, d1);
}
@ -885,15 +900,15 @@ public abstract class Entity {
this.motX += d0;
this.motY += d1;
this.motZ += d2;
this.cb = true;
this.ce = true;
}
protected void aB() {
protected void aM() {
this.velocityChanged = true;
}
public boolean damageEntity(DamageSource damagesource, int i) {
this.aB();
this.aM();
return false;
}
@ -908,7 +923,7 @@ public abstract class Entity {
public void b(Entity entity, int i) {}
public boolean c(NBTTagCompound nbttagcompound) {
String s = this.aC();
String s = this.aN();
if (!this.dead && s != null) {
nbttagcompound.setString("id", s);
@ -920,7 +935,7 @@ public abstract class Entity {
}
public void d(NBTTagCompound nbttagcompound) {
nbttagcompound.set("Pos", this.a(new double[] { this.locX, this.locY + (double) this.bL, this.locZ}));
nbttagcompound.set("Pos", this.a(new double[] { this.locX, this.locY + (double) this.bO, this.locZ}));
nbttagcompound.set("Motion", this.a(new double[] { this.motX, this.motY, this.motZ}));
// CraftBukkit start - checking for NaN pitch/yaw and resetting to zero
@ -970,9 +985,9 @@ public abstract class Entity {
}
// CraftBukkit end */
this.lastX = this.bI = this.locX = ((NBTTagDouble) nbttaglist.get(0)).data;
this.lastY = this.bJ = this.locY = ((NBTTagDouble) nbttaglist.get(1)).data;
this.lastZ = this.bK = this.locZ = ((NBTTagDouble) nbttaglist.get(2)).data;
this.lastX = this.bL = this.locX = ((NBTTagDouble) nbttaglist.get(0)).data;
this.lastY = this.bM = this.locY = ((NBTTagDouble) nbttaglist.get(1)).data;
this.lastZ = this.bN = this.locZ = ((NBTTagDouble) nbttaglist.get(2)).data;
this.lastYaw = this.yaw = ((NBTTagFloat) nbttaglist2.get(0)).data;
this.lastPitch = this.pitch = ((NBTTagFloat) nbttaglist2.get(1)).data;
this.fallDistance = nbttagcompound.getFloat("FallDistance");
@ -1033,7 +1048,7 @@ public abstract class Entity {
// CraftBukkit end
}
protected final String aC() {
protected final String aN() {
return EntityTypes.b(this);
}
@ -1089,13 +1104,13 @@ public abstract class Entity {
return !this.dead;
}
public boolean T() {
public boolean U() {
for (int i = 0; i < 8; ++i) {
float f = ((float) ((i >> 0) % 2) - 0.5F) * this.width * 0.8F;
float f1 = ((float) ((i >> 1) % 2) - 0.5F) * 0.1F;
float f2 = ((float) ((i >> 2) % 2) - 0.5F) * this.width * 0.8F;
int j = MathHelper.floor(this.locX + (double) f);
int k = MathHelper.floor(this.locY + (double) this.x() + (double) f1);
int k = MathHelper.floor(this.locY + (double) this.y() + (double) f1);
int l = MathHelper.floor(this.locZ + (double) f2);
if (this.world.e(j, k, l)) {
@ -1114,14 +1129,14 @@ public abstract class Entity {
return null;
}
public void M() {
public void N() {
if (this.vehicle.dead) {
this.vehicle = null;
} else {
this.motX = 0.0D;
this.motY = 0.0D;
this.motZ = 0.0D;
this.w_();
this.y_();
if (this.vehicle != null) {
this.vehicle.i();
this.f += (double) (this.vehicle.yaw - this.vehicle.lastYaw);
@ -1171,10 +1186,10 @@ public abstract class Entity {
}
public void i() {
this.passenger.setPosition(this.locX, this.locY + this.q() + this.passenger.R(), this.locZ);
this.passenger.setPosition(this.locX, this.locY + this.q() + this.passenger.S(), this.locZ);
}
public double R() {
public double S() {
return (double) this.height;
}
@ -1259,7 +1274,7 @@ public abstract class Entity {
return 0.1F;
}
public Vec3D ap() {
public Vec3D aA() {
return null;
}
@ -1269,7 +1284,7 @@ public abstract class Entity {
return null;
}
public boolean z() {
public boolean A() {
return this.fireTicks > 0 || this.k(0);
}
@ -1289,7 +1304,7 @@ public abstract class Entity {
this.a(3, flag);
}
public void g(boolean flag) {
public void h(boolean flag) {
this.a(4, flag);
}
@ -1435,7 +1450,8 @@ public abstract class Entity {
}
public void s() {
this.bz = true;
this.bC = true;
this.fallDistance = 0.0F;
}
public String ad() {
@ -1448,7 +1464,7 @@ public abstract class Entity {
return LocaleI18n.a("entity." + s + ".name");
}
public Entity[] aG() {
public Entity[] aR() {
return null;
}

Datei anzeigen

@ -24,6 +24,8 @@ public class EntityArrow extends Entity {
public Entity shooter;
private int k;
private int l = 0;
private double damage = 2.0D;
private int n;
public boolean d = false;
public EntityArrow(World world) {
@ -43,7 +45,7 @@ public class EntityArrow extends Entity {
this.shooter = entityliving;
this.fromPlayer = entityliving instanceof EntityHuman;
this.b(0.5F, 0.5F);
this.setPositionRotation(entityliving.locX, entityliving.locY + (double) entityliving.x(), entityliving.locZ, entityliving.yaw, entityliving.pitch);
this.setPositionRotation(entityliving.locX, entityliving.locY + (double) entityliving.y(), entityliving.locZ, entityliving.yaw, entityliving.pitch);
this.locX -= (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * 0.16F);
this.locY -= 0.10000000149011612D;
this.locZ -= (double) (MathHelper.sin(this.yaw / 180.0F * 3.1415927F) * 0.16F);
@ -79,8 +81,8 @@ public class EntityArrow extends Entity {
this.k = 0;
}
public void w_() {
super.w_();
public void y_() {
super.y_();
if (this.lastPitch == 0.0F && this.lastYaw == 0.0F) {
float f = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ);
@ -171,7 +173,7 @@ public class EntityArrow extends Entity {
// CraftBukkit end
if (movingobjectposition.entity != null) {
f2 = MathHelper.a(this.motX * this.motX + this.motY * this.motY + this.motZ * this.motZ);
int l = (int) Math.ceil((double) f2 * 2.0D);
int l = (int) Math.ceil((double) f2 * this.damage);
if (this.d) {
l += this.random.nextInt(l / 2 + 2);
@ -185,6 +187,10 @@ public class EntityArrow extends Entity {
damagesource = DamageSource.arrow(this, this.shooter);
}
if (this.A()) {
movingobjectposition.entity.setOnFire(5);
}
// CraftBukkit start
boolean stick;
if (entity instanceof EntityLiving) {
@ -207,7 +213,14 @@ public class EntityArrow extends Entity {
if (stick) {
// CraftBukkit end
if (movingobjectposition.entity instanceof EntityLiving) {
++((EntityLiving) movingobjectposition.entity).aH;
++((EntityLiving) movingobjectposition.entity).aJ;
if (this.n > 0) {
float f3 = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ);
if (f3 > 0.0F) {
movingobjectposition.entity.b_(this.motX * (double) this.n * 0.6000000238418579D / (double) f3, 0.1D, this.motZ * (double) this.n * 0.6000000238418579D / (double) f3);
}
}
}
this.world.makeSound(this, "random.bowhit", 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F));
@ -270,22 +283,22 @@ public class EntityArrow extends Entity {
this.pitch = this.lastPitch + (this.pitch - this.lastPitch) * 0.2F;
this.yaw = this.lastYaw + (this.yaw - this.lastYaw) * 0.2F;
float f3 = 0.99F;
float f4 = 0.99F;
f1 = 0.05F;
if (this.az()) {
if (this.aK()) {
for (int i1 = 0; i1 < 4; ++i1) {
float f4 = 0.25F;
float f5 = 0.25F;
this.world.a("bubble", this.locX - this.motX * (double) f4, this.locY - this.motY * (double) f4, this.locZ - this.motZ * (double) f4, this.motX, this.motY, this.motZ);
this.world.a("bubble", this.locX - this.motX * (double) f5, this.locY - this.motY * (double) f5, this.locZ - this.motZ * (double) f5, this.motX, this.motY, this.motZ);
}
f3 = 0.8F;
f4 = 0.8F;
}
this.motX *= (double) f3;
this.motY *= (double) f3;
this.motZ *= (double) f3;
this.motX *= (double) f4;
this.motY *= (double) f4;
this.motZ *= (double) f4;
this.motY -= (double) f1;
this.setPosition(this.locX, this.locY, this.locZ);
}
@ -300,6 +313,7 @@ public class EntityArrow extends Entity {
nbttagcompound.setByte("shake", (byte) this.shake);
nbttagcompound.setByte("inGround", (byte) (this.inGround ? 1 : 0));
nbttagcompound.setBoolean("player", this.fromPlayer);
nbttagcompound.setDouble("damage", this.damage);
}
public void a(NBTTagCompound nbttagcompound) {
@ -311,6 +325,9 @@ public class EntityArrow extends Entity {
this.shake = nbttagcompound.getByte("shake") & 255;
this.inGround = nbttagcompound.getByte("inGround") == 1;
this.fromPlayer = nbttagcompound.getBoolean("player");
if (nbttagcompound.hasKey("damage")) {
this.damage = nbttagcompound.getDouble("damage");
}
}
public void a_(EntityHuman entityhuman) {
@ -336,4 +353,16 @@ public class EntityArrow extends Entity {
}
}
}
public void a(double d0) {
this.damage = d0;
}
public double j() {
return this.damage;
}
public void b(int i) {
this.n = i;
}
}

Datei anzeigen

@ -14,7 +14,7 @@ public class EntityBlaze extends EntityMonster {
this.texture = "/mob/fire.png";
this.fireProof = true;
this.damage = 6;
this.az = 10;
this.aA = 10;
}
public int getMaxHealth() {
@ -52,7 +52,7 @@ public class EntityBlaze extends EntityMonster {
public void d() {
if (!this.world.isStatic) {
if (this.ay()) {
if (this.aJ()) {
this.damageEntity(DamageSource.DROWN, 1);
}
@ -62,7 +62,7 @@ public class EntityBlaze extends EntityMonster {
this.a = 0.5F + (float) this.random.nextGaussian() * 3.0F;
}
if (this.E() != null && this.E().locY + (double) this.E().x() > this.locY + (double) this.x() + (double) this.a) {
if (this.F() != null && this.F().locY + (double) this.F().y() > this.locY + (double) this.y() + (double) this.a) {
this.motY += (0.30000001192092896D - this.motY) * 0.30000001192092896D;
}
}
@ -137,8 +137,8 @@ public class EntityBlaze extends EntityMonster {
return Item.BLAZE_ROD.id;
}
public boolean z() {
return this.A();
public boolean A() {
return this.B();
}
protected void dropDeathLoot(boolean flag, int i) {
@ -156,7 +156,7 @@ public class EntityBlaze extends EntityMonster {
}
}
public boolean A() {
public boolean B() {
return (this.datawatcher.getByte(16) & 1) != 0;
}
@ -172,7 +172,7 @@ public class EntityBlaze extends EntityMonster {
this.datawatcher.watch(16, Byte.valueOf(b0));
}
protected boolean y() {
protected boolean z() {
return true;
}
}

Datei anzeigen

@ -46,7 +46,7 @@ public class EntityBoat extends Entity {
public EntityBoat(World world) {
super(world);
this.bc = true;
this.bf = true;
this.b(1.5F, 0.6F);
this.height = this.length / 2.0F;
}
@ -108,7 +108,7 @@ public class EntityBoat extends Entity {
this.d(-this.l());
this.c(10);
this.setDamage(this.getDamage() + i * 10);
this.aB();
this.aM();
if (this.getDamage() > 40) {
// CraftBukkit start
VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, attacker);
@ -147,7 +147,7 @@ public class EntityBoat extends Entity {
return !this.dead;
}
public void w_() {
public void y_() {
// CraftBukkit start
double prevX = this.locX;
double prevY = this.locY;
@ -156,7 +156,7 @@ public class EntityBoat extends Entity {
float prevPitch = this.pitch;
// CraftBukkit end
super.w_();
super.y_();
if (this.k() > 0) {
this.c(this.k() - 1);
}
@ -407,7 +407,7 @@ public class EntityBoat extends Entity {
double d0 = Math.cos((double) this.yaw * 3.141592653589793D / 180.0D) * 0.4D;
double d1 = Math.sin((double) this.yaw * 3.141592653589793D / 180.0D) * 0.4D;
this.passenger.setPosition(this.locX + d0, this.locY + this.q() + this.passenger.R(), this.locZ + d1);
this.passenger.setPosition(this.locX + d0, this.locY + this.q() + this.passenger.S(), this.locZ + d1);
}
}

Datei anzeigen

@ -91,7 +91,7 @@ public class EntityChicken extends EntityAnimal {
loot.add(new org.bukkit.inventory.ItemStack(Item.FEATHER.id, j));
}
if (this.z()) {
if (this.A()) {
loot.add(new org.bukkit.inventory.ItemStack(Item.COOKED_CHICKEN.id, 1));
} else {
loot.add(new org.bukkit.inventory.ItemStack(Item.RAW_CHICKEN.id, 1));

Datei anzeigen

@ -61,7 +61,7 @@ public class EntityCow extends EntityAnimal {
j = this.random.nextInt(3) + 1 + this.random.nextInt(1 + i);
if (j > 0) {
loot.add(new org.bukkit.inventory.ItemStack(this.z() ? Item.COOKED_BEEF.id : Item.RAW_BEEF.id, j));
loot.add(new org.bukkit.inventory.ItemStack(this.A() ? Item.COOKED_BEEF.id : Item.RAW_BEEF.id, j));
}
CraftEventFactory.callEntityDeathEvent(this, loot);

Datei anzeigen

@ -17,7 +17,7 @@ public abstract class EntityCreature extends EntityLiving {
super(world);
}
protected boolean w() {
protected boolean v() {
return false;
}
@ -27,7 +27,7 @@ public abstract class EntityCreature extends EntityLiving {
--this.f;
}
this.e = this.w();
this.e = this.v();
float f = 16.0F;
if (this.target == null) {
@ -76,13 +76,13 @@ public abstract class EntityCreature extends EntityLiving {
// MethodProfiler.a(); // CraftBukkit - not in production code
if (!this.e && this.target != null && (this.pathEntity == null || this.random.nextInt(20) == 0)) {
this.pathEntity = this.world.findPath(this, this.target, f);
} else if (!this.e && (this.pathEntity == null && this.random.nextInt(180) == 0 || this.random.nextInt(120) == 0 || this.f > 0) && this.aS < 100) {
this.C();
} else if (!this.e && (this.pathEntity == null && this.random.nextInt(180) == 0 || this.random.nextInt(120) == 0 || this.f > 0) && this.aV < 100) {
this.D();
}
int i = MathHelper.floor(this.boundingBox.b + 0.5D);
boolean flag = this.az();
boolean flag1 = this.aA();
boolean flag = this.aK();
boolean flag1 = this.aL();
this.pitch = 0.0F;
if (this.pathEntity != null && this.random.nextInt(100) != 0) {
@ -100,7 +100,7 @@ public abstract class EntityCreature extends EntityLiving {
}
}
this.aW = false;
this.aZ = false;
if (vec3d != null) {
double d1 = vec3d.a - this.locX;
double d2 = vec3d.c - this.locZ;
@ -109,7 +109,7 @@ public abstract class EntityCreature extends EntityLiving {
float f2 = (float) (TrigMath.atan2(d2, d1) * 180.0D / 3.1415927410125732D) - 90.0F;
float f3 = f2 - this.yaw;
for (this.aU = this.aY; f3 < -180.0F; f3 += 360.0F) {
for (this.aX = this.bb; f3 < -180.0F; f3 += 360.0F) {
;
}
@ -133,12 +133,12 @@ public abstract class EntityCreature extends EntityLiving {
this.yaw = (float) (Math.atan2(d5, d4) * 180.0D / 3.1415927410125732D) - 90.0F;
f3 = (f4 - this.yaw + 90.0F) * 3.1415927F / 180.0F;
this.aT = -MathHelper.sin(f3) * this.aU * 1.0F;
this.aU = MathHelper.cos(f3) * this.aU * 1.0F;
this.aW = -MathHelper.sin(f3) * this.aX * 1.0F;
this.aX = MathHelper.cos(f3) * this.aX * 1.0F;
}
if (d3 > 0.0D) {
this.aW = true;
this.aZ = true;
}
}
@ -146,12 +146,12 @@ public abstract class EntityCreature extends EntityLiving {
this.a(this.target, 30.0F, 30.0F);
}
if (this.positionChanged && !this.D()) {
this.aW = true;
if (this.positionChanged && !this.E()) {
this.aZ = true;
}
if (this.random.nextFloat() < 0.8F && (flag || flag1)) {
this.aW = true;
this.aZ = true;
}
// MethodProfiler.a(); // CraftBukkit - not in production code
@ -161,7 +161,7 @@ public abstract class EntityCreature extends EntityLiving {
}
}
protected void C() {
protected void D() {
// MethodProfiler.a("stroll"); // CraftBukkit - not in production code
boolean flag = false;
int i = -1;
@ -195,7 +195,7 @@ public abstract class EntityCreature extends EntityLiving {
protected void b(Entity entity, float f) {}
protected float a(int i, int j, int k) {
public float a(int i, int j, int k) {
return 0.0F;
}
@ -211,7 +211,7 @@ public abstract class EntityCreature extends EntityLiving {
return super.g() && this.a(i, j, k) >= 0.0F;
}
public boolean D() {
public boolean E() {
return this.pathEntity != null;
}
@ -219,7 +219,7 @@ public abstract class EntityCreature extends EntityLiving {
this.pathEntity = pathentity;
}
public Entity E() {
public Entity F() {
return this.target;
}
@ -227,8 +227,8 @@ public abstract class EntityCreature extends EntityLiving {
this.target = entity;
}
protected float F() {
float f = super.F();
protected float G() {
float f = super.G();
if (this.f > 0) {
f *= 2.0F;

Datei anzeigen

@ -50,10 +50,10 @@ public class EntityCreeper extends EntityMonster {
}
}
public void w_() {
public void y_() {
this.b = this.fuseTicks;
if (this.world.isStatic) {
int i = this.A();
int i = this.B();
if (i > 0 && this.fuseTicks == 0) {
this.world.makeSound(this, "random.fuse", 1.0F, 0.5F);
@ -69,7 +69,7 @@ public class EntityCreeper extends EntityMonster {
}
}
super.w_();
super.y_();
if (this.target == null && this.fuseTicks > 0) {
this.b(-1);
--this.fuseTicks;
@ -90,13 +90,13 @@ public class EntityCreeper extends EntityMonster {
public void die(DamageSource damagesource) {
super.die(damagesource);
if (damagesource.getEntity() instanceof EntitySkeleton) {
this.b(Item.RECORD_1.id + this.random.nextInt(2), 1);
this.b(Item.RECORD_1.id + this.random.nextInt(10), 1);
}
}
protected void a(Entity entity, float f) {
if (!this.world.isStatic) {
int i = this.A();
int i = this.B();
if ((i > 0 || f >= 3.0F) && (i <= 0 || f >= 7.0F)) {
this.b(-1);
@ -140,7 +140,7 @@ public class EntityCreeper extends EntityMonster {
return Item.SULPHUR.id;
}
private int A() {
private int B() {
return this.datawatcher.getByte(16);
}

Datei anzeigen

@ -2,21 +2,25 @@ package net.minecraft.server;
public class EntityDamageSourceIndirect extends EntityDamageSource {
private Entity n;
private Entity o;
public EntityDamageSourceIndirect(String s, Entity entity, Entity entity1) {
super(s, entity);
this.n = entity1;
this.o = entity1;
}
public Entity b() {
return this.a;
}
public Entity getEntity() {
return this.n;
return this.o;
}
public String a(EntityHuman entityhuman) {
// CraftBukkit start
String source = (this.n == null) ? "Herobrine" : this.n.ad();
return LocaleI18n.a("death." + this.m, new Object[] { entityhuman.name, source});
String source = (this.o == null) ? "Herobrine" : this.o.ad();
return LocaleI18n.a("death." + this.n, new Object[] { entityhuman.name, source});
}
public Entity getProximateDamageSource() {

Datei anzeigen

@ -43,10 +43,10 @@ public class EntityEnderDragon extends EntityComplex {
this.setHealth(this.t);
this.texture = "/mob/enderdragon/ender.png";
this.b(16.0F, 8.0F);
this.bN = true;
this.bQ = true;
this.fireProof = true;
this.b = 100.0D;
this.ca = true;
this.cd = true;
}
protected void b() {
@ -99,7 +99,7 @@ public class EntityEnderDragon extends EntityComplex {
f1 = (this.random.nextFloat() - 0.5F) * 8.0F;
this.world.a("largeexplode", this.locX + (double) f, this.locY + 2.0D + (double) d05, this.locZ + (double) f1, 0.0D, 0.0D, 0.0D);
} else {
this.w();
this.v();
f = 0.2F / (MathHelper.a(this.motX * this.motX + this.motZ * this.motZ) * 10.0F + 1.0F);
f *= (float) Math.pow(2.0D, this.motY);
if (this.q) {
@ -136,12 +136,12 @@ public class EntityEnderDragon extends EntityComplex {
float f3;
if (this.world.isStatic) {
if (this.aK > 0) {
d0 = this.locX + (this.aL - this.locX) / (double) this.aK;
d1 = this.locY + (this.aM - this.locY) / (double) this.aK;
d2 = this.locZ + (this.aN - this.locZ) / (double) this.aK;
if (this.aN > 0) {
d0 = this.locX + (this.aO - this.locX) / (double) this.aN;
d1 = this.locY + (this.aP - this.locY) / (double) this.aN;
d2 = this.locZ + (this.aQ - this.locZ) / (double) this.aN;
for (d3 = this.aO - (double) this.yaw; d3 < -180.0D; d3 += 360.0D) {
for (d3 = this.aR - (double) this.yaw; d3 < -180.0D; d3 += 360.0D) {
;
}
@ -149,9 +149,9 @@ public class EntityEnderDragon extends EntityComplex {
d3 -= 360.0D;
}
this.yaw = (float) ((double) this.yaw + d3 / (double) this.aK);
this.pitch = (float) ((double) this.pitch + (this.aP - (double) this.pitch) / (double) this.aK);
--this.aK;
this.yaw = (float) ((double) this.yaw + d3 / (double) this.aN);
this.pitch = (float) ((double) this.pitch + (this.aS - (double) this.pitch) / (double) this.aN);
--this.aN;
this.setPosition(d0, d1, d2);
this.c(this.yaw, this.pitch);
}
@ -178,8 +178,8 @@ public class EntityEnderDragon extends EntityComplex {
this.c += this.random.nextGaussian() * 2.0D;
}
if (this.p || d3 < 100.0D || d3 > 22500.0D || this.positionChanged || this.bw) {
this.A();
if (this.p || d3 < 100.0D || d3 > 22500.0D || this.positionChanged || this.bz) {
this.B();
}
d1 /= (double) MathHelper.a(d0 * d0 + d2 * d2);
@ -228,7 +228,7 @@ public class EntityEnderDragon extends EntityComplex {
f4 = 0.0F;
}
this.aV *= 0.8F;
this.aY *= 0.8F;
float f5 = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ) * 1.0F + 1.0F;
double d10 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ) * 1.0D + 1.0D;
@ -236,8 +236,8 @@ public class EntityEnderDragon extends EntityComplex {
d10 = 40.0D;
}
this.aV = (float) ((double) this.aV + d9 * (0.699999988079071D / d10 / (double) f5));
this.yaw += this.aV * 0.1F;
this.aY = (float) ((double) this.aY + d9 * (0.699999988079071D / d10 / (double) f5));
this.yaw += this.aY * 0.1F;
float f6 = (float) (2.0D / (d10 + 1.0D));
float f7 = 0.06F;
@ -275,17 +275,17 @@ public class EntityEnderDragon extends EntityComplex {
float f11 = MathHelper.sin(f10);
float f12 = MathHelper.cos(f10);
this.h.w_();
this.h.y_();
this.h.setPositionRotation(this.locX + (double) (f11 * 0.5F), this.locY, this.locZ - (double) (f12 * 0.5F), 0.0F, 0.0F);
this.l.w_();
this.l.y_();
this.l.setPositionRotation(this.locX + (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ + (double) (f11 * 4.5F), 0.0F, 0.0F);
this.m.w_();
this.m.y_();
this.m.setPositionRotation(this.locX - (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ - (double) (f11 * 4.5F), 0.0F, 0.0F);
if (!this.world.isStatic) {
this.y();
this.z();
}
if (!this.world.isStatic && this.as == 0) {
if (!this.world.isStatic && this.at == 0) {
this.a(this.world.getEntities(this, this.l.boundingBox.grow(4.0D, 2.0D, 4.0D).d(0.0D, -2.0D, 0.0D)));
this.a(this.world.getEntities(this, this.m.boundingBox.grow(4.0D, 2.0D, 4.0D).d(0.0D, -2.0D, 0.0D)));
this.b(this.world.getEntities(this, this.g.boundingBox.grow(1.0D, 1.0D, 1.0D)));
@ -294,10 +294,10 @@ public class EntityEnderDragon extends EntityComplex {
double[] adouble = this.a(5, 1.0F);
double[] adouble1 = this.a(0, 1.0F);
f3 = MathHelper.sin(this.yaw * 3.1415927F / 180.0F - this.aV * 0.01F);
float f13 = MathHelper.cos(this.yaw * 3.1415927F / 180.0F - this.aV * 0.01F);
f3 = MathHelper.sin(this.yaw * 3.1415927F / 180.0F - this.aY * 0.01F);
float f13 = MathHelper.cos(this.yaw * 3.1415927F / 180.0F - this.aY * 0.01F);
this.g.w_();
this.g.y_();
this.g.setPositionRotation(this.locX + (double) (f3 * 5.5F * f1), this.locY + (adouble1[1] - adouble[1]) * 1.0D + (double) (f9 * 5.5F), this.locZ - (double) (f13 * 5.5F * f1), 0.0F, 0.0F);
for (int j = 0; j < 3; ++j) {
@ -322,7 +322,7 @@ public class EntityEnderDragon extends EntityComplex {
float f17 = 1.5F;
float f18 = (float) (j + 1) * 2.0F;
entitycomplexpart.w_();
entitycomplexpart.y_();
entitycomplexpart.setPositionRotation(this.locX - (double) ((f11 * f17 + f15 * f18) * f1), this.locY + (adouble2[1] - adouble[1]) * 1.0D - (double) ((f18 + f17) * f9) + 1.5D, this.locZ + (double) ((f12 * f17 + f16 * f18) * f1), 0.0F, 0.0F);
}
@ -332,7 +332,7 @@ public class EntityEnderDragon extends EntityComplex {
}
}
private void w() {
private void v() {
if (this.s != null) {
if (this.s.dead) {
if (!this.world.isStatic) {
@ -366,9 +366,9 @@ public class EntityEnderDragon extends EntityComplex {
}
}
private void y() {
private void z() {
if (this.ticksLived % 20 == 0) {
Vec3D vec3d = this.d(1.0F);
Vec3D vec3d = this.e(1.0F);
double d0 = 0.0D;
double d1 = -1.0D;
double d2 = 0.0D;
@ -415,7 +415,7 @@ public class EntityEnderDragon extends EntityComplex {
}
}
private void A() {
private void B() {
this.p = false;
if (this.random.nextInt(2) == 0 && this.world.players.size() > 0) {
this.u = (Entity) this.world.players.get(this.random.nextInt(this.world.players.size()));
@ -523,14 +523,14 @@ public class EntityEnderDragon extends EntityComplex {
this.b = this.locY + (double) (this.random.nextFloat() * 3.0F) + 1.0D;
this.c = this.locZ - (double) (f2 * 5.0F) + (double) ((this.random.nextFloat() - 0.5F) * 2.0F);
this.u = null;
if (damagesource.g() instanceof EntityHuman || damagesource == DamageSource.EXPLOSION) {
if (damagesource.getEntity() instanceof EntityHuman || damagesource == DamageSource.EXPLOSION) {
this.e(damagesource, i);
}
return true;
}
protected void ag() {
protected void an() {
++this.r;
if (this.r >= 180 && this.r <= 200) {
float f = (this.random.nextFloat() - 0.5F) * 8.0F;
@ -574,7 +574,7 @@ public class EntityEnderDragon extends EntityComplex {
}
this.a(MathHelper.floor(this.locX), MathHelper.floor(this.locZ));
this.an();
this.ay();
this.die();
}
}
@ -621,9 +621,9 @@ public class EntityEnderDragon extends EntityComplex {
BlockEnderPortal.a = false;
}
protected void ak() {}
protected void au() {}
public Entity[] aG() {
public Entity[] aR() {
return this.children;
}

Datei anzeigen

@ -6,6 +6,7 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
public class EntityEnderPearl extends EntityProjectile {
public EntityEnderPearl(World world) {
super(world);
}
@ -59,7 +60,7 @@ public class EntityEnderPearl extends EntityProjectile {
if (!damageEvent.isCancelled()) {
org.bukkit.entity.Player bPlayer = Bukkit.getPlayerExact(((EntityPlayer) this.shooter).name);
((CraftPlayer) bPlayer).getHandle().cg = -1; // Remove spawning invulnerability.
((CraftPlayer) bPlayer).getHandle().cj = -1; // Remove spawning invulnerability.
((CraftPlayer) bPlayer).getHandle().damageEntity(DamageSource.FALL, 5); // Damage the new player instead of the old
}
}

Datei anzeigen

@ -19,10 +19,10 @@ public class EntityEnderman extends EntityMonster {
public EntityEnderman(World world) {
super(world);
this.texture = "/mob/enderman.png";
this.aY = 0.2F;
this.bb = 0.2F;
this.damage = 7;
this.b(0.6F, 2.9F);
this.bM = 1.0F;
this.bP = 1.0F;
}
public int getMaxHealth() {
@ -74,8 +74,8 @@ public class EntityEnderman extends EntityMonster {
if (itemstack != null && itemstack.id == Block.PUMPKIN.id) {
return false;
} else {
Vec3D vec3d = entityhuman.d(1.0F).b();
Vec3D vec3d1 = Vec3D.create(this.locX - entityhuman.locX, this.boundingBox.b + (double) (this.length / 2.0F) - (entityhuman.locY + (double) entityhuman.x()), this.locZ - entityhuman.locZ);
Vec3D vec3d = entityhuman.e(1.0F).b();
Vec3D vec3d1 = Vec3D.create(this.locX - entityhuman.locX, this.boundingBox.b + (double) (this.length / 2.0F) - (entityhuman.locY + (double) entityhuman.y()), this.locZ - entityhuman.locZ);
double d0 = vec3d1.c();
vec3d1 = vec3d1.b();
@ -86,12 +86,12 @@ public class EntityEnderman extends EntityMonster {
}
public void d() {
if (this.ay()) {
if (this.aJ()) {
this.damageEntity(DamageSource.DROWN, 1);
}
this.a = this.target != null;
this.aY = this.target != null ? 6.5F : 0.3F;
this.bb = this.target != null ? 6.5F : 0.3F;
int i;
if (!this.world.isStatic) {
@ -146,16 +146,16 @@ public class EntityEnderman extends EntityMonster {
if (f > 0.5F && this.world.isChunkLoaded(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
this.target = null;
this.u_();
this.w_();
}
}
if (this.ay()) {
if (this.aJ()) {
this.target = null;
this.u_();
this.w_();
}
this.aW = false;
this.aZ = false;
if (this.target != null) {
this.a(this.target, 100.0F, 100.0F);
}
@ -163,10 +163,10 @@ public class EntityEnderman extends EntityMonster {
if (!this.world.isStatic && this.isAlive()) {
if (this.target != null) {
if (this.target instanceof EntityHuman && this.c((EntityHuman) this.target)) {
this.aT = this.aU = 0.0F;
this.aY = 0.0F;
this.aW = this.aX = 0.0F;
this.bb = 0.0F;
if (this.target.i(this) < 16.0D) {
this.u_();
this.w_();
}
this.g = 0;
@ -181,7 +181,7 @@ public class EntityEnderman extends EntityMonster {
super.d();
}
protected boolean u_() {
protected boolean w_() {
double d0 = this.locX + (this.random.nextDouble() - 0.5D) * 64.0D;
double d1 = this.locY + (double) (this.random.nextInt(64) - 32);
double d2 = this.locZ + (this.random.nextDouble() - 0.5D) * 64.0D;
@ -190,7 +190,7 @@ public class EntityEnderman extends EntityMonster {
}
protected boolean f(Entity entity) {
Vec3D vec3d = Vec3D.create(this.locX - entity.locX, this.boundingBox.b + (double) (this.length / 2.0F) - entity.locY + (double) entity.x(), this.locZ - entity.locZ);
Vec3D vec3d = Vec3D.create(this.locX - entity.locX, this.boundingBox.b + (double) (this.length / 2.0F) - entity.locY + (double) entity.y(), this.locZ - entity.locZ);
vec3d = vec3d.b();
double d0 = 16.0D;
@ -230,7 +230,7 @@ public class EntityEnderman extends EntityMonster {
if (flag1) {
this.setPosition(this.locX, this.locY, this.locZ);
if (this.world.a(this, this.boundingBox).size() == 0 && !this.world.c(this.boundingBox)) {
if (this.world.a((Entity) this, this.boundingBox).size() == 0 && !this.world.c(this.boundingBox)) {
flag = true;
}
}
@ -312,7 +312,7 @@ public class EntityEnderman extends EntityMonster {
public boolean damageEntity(DamageSource damagesource, int i) {
if (damagesource instanceof EntityDamageSourceIndirect) {
for (int j = 0; j < 64; ++j) {
if (this.u_()) {
if (this.w_()) {
return true;
}
}

Datei anzeigen

@ -32,8 +32,8 @@ public class EntityExperienceOrb extends Entity {
protected void b() {}
public void w_() {
super.w_();
public void y_() {
super.y_();
if (this.c > 0) {
--this.c;
}
@ -55,7 +55,7 @@ public class EntityExperienceOrb extends Entity {
if (entityhuman != null) {
double d1 = (entityhuman.locX - this.locX) / d0;
double d2 = (entityhuman.locY + (double) entityhuman.x() - this.locY) / d0;
double d2 = (entityhuman.locY + (double) entityhuman.y() - this.locY) / d0;
double d3 = (entityhuman.locZ - this.locZ) / d0;
double d4 = Math.sqrt(d1 * d1 + d2 * d2 + d3 * d3);
double d5 = 1.0D - d4;
@ -103,7 +103,7 @@ public class EntityExperienceOrb extends Entity {
}
public boolean damageEntity(DamageSource damagesource, int i) {
this.aB();
this.aM();
this.d -= i;
if (this.d <= 0) {
this.die();

Datei anzeigen

@ -14,7 +14,7 @@ public class EntityFallingBlock extends Entity {
public EntityFallingBlock(World world, double d0, double d1, double d2, int i, int data) {
super(world);
this.a = i;
this.bc = true;
this.bf = true;
this.data = data; // CraftBukkit
this.b(0.98F, 0.98F);
this.height = this.length / 2.0F;
@ -37,7 +37,7 @@ public class EntityFallingBlock extends Entity {
return !this.dead;
}
public void w_() {
public void y_() {
if (this.a == 0) {
this.die();
} else {

Datei anzeigen

@ -62,8 +62,8 @@ public class EntityFireball extends Entity {
}
// CraftBukkit end
public void w_() {
super.w_();
public void y_() {
super.y_();
this.setOnFire(1);
if (!this.world.isStatic && (this.shooter == null || this.shooter.dead)) {
this.die();
@ -159,7 +159,7 @@ public class EntityFireball extends Entity {
this.yaw = this.lastYaw + (this.yaw - this.lastYaw) * 0.2F;
float f2 = 0.95F;
if (this.az()) {
if (this.aK()) {
for (int k = 0; k < 4; ++k) {
float f3 = 0.25F;
@ -250,9 +250,9 @@ public class EntityFireball extends Entity {
}
public boolean damageEntity(DamageSource damagesource, int i) {
this.aB();
this.aM();
if (damagesource.getEntity() != null) {
Vec3D vec3d = damagesource.getEntity().ap();
Vec3D vec3d = damagesource.getEntity().aA();
if (vec3d != null) {
this.motX = vec3d.a;

Datei anzeigen

@ -33,12 +33,12 @@ public class EntityFishingHook extends Entity {
public EntityFishingHook(World world) {
super(world);
this.b(0.25F, 0.25F);
this.ca = true;
this.cd = true;
}
public EntityFishingHook(World world, EntityHuman entityhuman) {
super(world);
this.ca = true;
this.cd = true;
this.owner = entityhuman;
this.owner.hookedFish = this;
this.b(0.25F, 0.25F);
@ -80,8 +80,8 @@ public class EntityFishingHook extends Entity {
this.i = 0;
}
public void w_() {
super.w_();
public void y_() {
super.y_();
if (this.l > 0) {
double d0 = this.locX + (this.m - this.locX) / (double) this.l;
double d1 = this.locY + (this.n - this.locY) / (double) this.l;
@ -104,7 +104,7 @@ public class EntityFishingHook extends Entity {
this.c(this.yaw, this.pitch);
} else {
if (!this.world.isStatic) {
ItemStack itemstack = this.owner.P();
ItemStack itemstack = this.owner.Q();
if (this.owner.dead || !this.owner.isAlive() || itemstack == null || itemstack.getItem() != Item.FISHING_ROD || this.i(this.owner) > 1024.0D) {
this.die();

Datei anzeigen

@ -24,7 +24,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
this.texture = "/mob/ghast.png";
this.b(4.0F, 4.0F);
this.fireProof = true;
this.az = 5;
this.aA = 5;
}
public boolean damageEntity(DamageSource damagesource, int i) {
@ -46,8 +46,8 @@ public class EntityGhast extends EntityFlying implements IMonster {
return 10;
}
public void w_() {
super.w_();
public void y_() {
super.y_();
byte b0 = this.datawatcher.getByte(16);
this.texture = b0 == 1 ? "/mob/ghast_fire.png" : "/mob/ghast.png";
@ -58,7 +58,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
this.die();
}
this.ak();
this.au();
this.e = this.f;
double d0 = this.b - this.locX;
double d1 = this.c - this.locY;
@ -138,7 +138,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
this.world.a((EntityHuman) null, 1008, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
EntityFireball entityfireball = new EntityFireball(this.world, this, d5, d6, d7);
double d8 = 4.0D;
Vec3D vec3d = this.d(1.0F);
Vec3D vec3d = this.e(1.0F);
entityfireball.locX = this.locX + vec3d.a * d8;
entityfireball.locY = this.locY + (double) (this.length / 2.0F) + 0.5D;
@ -174,7 +174,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
for (int i = 1; (double) i < d3; ++i) {
axisalignedbb.d(d4, d5, d6);
if (this.world.a(this, axisalignedbb).size() > 0) {
if (this.world.a((Entity) this, axisalignedbb).size() > 0) {
return false;
}
}

Datei anzeigen

@ -74,8 +74,8 @@ public abstract class EntityHuman extends EntityLiving {
ChunkCoordinates chunkcoordinates = world.getSpawn();
this.setPositionRotation((double) chunkcoordinates.x + 0.5D, (double) (chunkcoordinates.y + 1), (double) chunkcoordinates.z + 0.5D, 0.0F, 0.0F);
this.af = "humanoid";
this.ae = 180.0F;
this.ah = "humanoid";
this.ag = 180.0F;
this.maxFireTicks = 20;
this.texture = "/mob/char.png";
}
@ -90,43 +90,43 @@ public abstract class EntityHuman extends EntityLiving {
this.datawatcher.a(17, Byte.valueOf((byte) 0));
}
public boolean H() {
public boolean I() {
return this.d != null;
}
public void I() {
public void J() {
if (this.d != null) {
this.d.a(this.world, this, this.e);
}
this.J();
this.K();
}
public void J() {
public void K() {
this.d = null;
this.e = 0;
if (!this.world.isStatic) {
this.g(false);
this.h(false);
}
}
public boolean K() {
return this.H() && Item.byId[this.d.id].d(this.d) == EnumAnimation.d;
public boolean L() {
return this.I() && Item.byId[this.d.id].d(this.d) == EnumAnimation.d;
}
public void w_() {
public void y_() {
if (this.d != null) {
ItemStack itemstack = this.inventory.getItemInHand();
if (itemstack != this.d) {
this.J();
this.K();
} else {
if (this.e <= 25 && this.e % 4 == 0) {
this.b(itemstack, 5);
}
if (--this.e == 0 && !this.world.isStatic) {
this.G();
this.H();
}
}
}
@ -142,7 +142,7 @@ public abstract class EntityHuman extends EntityLiving {
}
if (!this.world.isStatic) {
if (!this.C()) {
if (!this.B()) {
this.a(true, true, false);
} else if (this.world.e()) {
this.a(false, true, true);
@ -155,7 +155,7 @@ public abstract class EntityHuman extends EntityLiving {
}
}
super.w_();
super.y_();
if (!this.world.isStatic && this.activeContainer != null && !this.activeContainer.b(this)) {
this.closeInventory();
this.activeContainer = this.defaultContainer;
@ -167,7 +167,7 @@ public abstract class EntityHuman extends EntityLiving {
}
}
if (this.z() && this.abilities.isInvulnerable) {
if (this.A() && this.abilities.isInvulnerable) {
this.extinguish();
}
@ -231,7 +231,7 @@ public abstract class EntityHuman extends EntityLiving {
vec3d1.a(-this.pitch * 3.1415927F / 180.0F);
vec3d1.b(-this.yaw * 3.1415927F / 180.0F);
vec3d1 = vec3d1.add(this.locX, this.locY + (double) this.x(), this.locZ);
vec3d1 = vec3d1.add(this.locX, this.locY + (double) this.y(), this.locZ);
this.world.a("iconcrack_" + itemstack.getItem().id, vec3d1.a, vec3d1.b, vec3d1.c, vec3d.a, vec3d.b + 0.05D, vec3d.c);
}
@ -239,7 +239,7 @@ public abstract class EntityHuman extends EntityLiving {
}
}
protected void G() {
protected void H() {
if (this.d != null) {
this.b(this.d, 16);
int i = this.d.count;
@ -252,11 +252,11 @@ public abstract class EntityHuman extends EntityLiving {
}
}
this.J();
this.K();
}
}
protected boolean L() {
protected boolean M() {
return this.getHealth() <= 0 || this.isSleeping();
}
@ -264,23 +264,23 @@ public abstract class EntityHuman extends EntityLiving {
this.activeContainer = this.defaultContainer;
}
public void M() {
public void N() {
double d0 = this.locX;
double d1 = this.locY;
double d2 = this.locZ;
super.M();
super.N();
this.r = this.s;
this.s = 0.0F;
this.h(this.locX - d0, this.locY - d1, this.locZ - d2);
}
private int A() {
private int v() {
return this.hasEffect(MobEffectList.FASTER_DIG) ? 6 - (1 + this.getEffect(MobEffectList.FASTER_DIG).getAmplifier()) * 1 : (this.hasEffect(MobEffectList.SLOWER_DIG) ? 6 + (1 + this.getEffect(MobEffectList.SLOWER_DIG).getAmplifier()) * 2 : 6);
}
protected void m_() {
int i = this.A();
int i = this.v();
if (this.t) {
++this.u;
@ -292,7 +292,7 @@ public abstract class EntityHuman extends EntityLiving {
this.u = 0;
}
this.an = (float) this.u / (float) i;
this.ao = (float) this.u / (float) i;
}
public void d() {
@ -308,11 +308,11 @@ public abstract class EntityHuman extends EntityLiving {
this.inventory.i();
this.r = this.s;
super.d();
this.ak = this.P;
this.al = this.Q;
this.al = this.P;
this.am = this.Q;
if (this.isSprinting()) {
this.ak = (float) ((double) this.ak + (double) this.P * 0.3D);
this.al = (float) ((double) this.al + (double) this.Q * 0.3D);
this.al = (float) ((double) this.al + (double) this.P * 0.3D);
this.am = (float) ((double) this.am + (double) this.Q * 0.3D);
}
float f = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ);
@ -332,7 +332,7 @@ public abstract class EntityHuman extends EntityLiving {
}
this.s += (f - this.s) * 0.4F;
this.ax += (f1 - this.ax) * 0.8F;
this.ay += (f1 - this.ay) * 0.8F;
if (this.getHealth() > 0) {
List list = this.world.getEntities(this, this.boundingBox.grow(1.0D, 0.0D, 1.0D));
@ -363,8 +363,8 @@ public abstract class EntityHuman extends EntityLiving {
this.inventory.k();
if (damagesource != null) {
this.motX = (double) (-MathHelper.cos((this.at + this.yaw) * 3.1415927F / 180.0F) * 0.1F);
this.motZ = (double) (-MathHelper.sin((this.at + this.yaw) * 3.1415927F / 180.0F) * 0.1F);
this.motX = (double) (-MathHelper.cos((this.au + this.yaw) * 3.1415927F / 180.0F) * 0.1F);
this.motZ = (double) (-MathHelper.sin((this.au + this.yaw) * 3.1415927F / 180.0F) * 0.1F);
} else {
this.motX = this.motZ = 0.0D;
}
@ -388,7 +388,7 @@ public abstract class EntityHuman extends EntityLiving {
return j > 0 && this.random.nextInt(j + 1) > 0 ? i : super.f(i);
}
public void N() {
public void O() {
this.a(this.inventory.splitStack(this.inventory.itemInHandIndex, 1), false);
}
@ -398,7 +398,7 @@ public abstract class EntityHuman extends EntityLiving {
public void a(ItemStack itemstack, boolean flag) {
if (itemstack != null) {
EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY - 0.30000001192092896D + (double) this.x(), this.locZ, itemstack);
EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY - 0.30000001192092896D + (double) this.y(), this.locZ, itemstack);
entityitem.pickupDelay = 40;
float f = 0.1F;
@ -537,11 +537,11 @@ public abstract class EntityHuman extends EntityLiving {
public void receive(Entity entity, int i) {}
public float x() {
public float y() {
return 0.12F;
}
protected void w() {
protected void r_() {
this.height = 1.62F;
}
@ -549,7 +549,7 @@ public abstract class EntityHuman extends EntityLiving {
if (this.abilities.isInvulnerable && !damagesource.ignoresInvulnerability()) {
return false;
} else {
this.aS = 0;
this.aV = 0;
if (this.getHealth() <= 0) {
return false;
} else {
@ -628,17 +628,17 @@ public abstract class EntityHuman extends EntityLiving {
if (k > 0 && k <= 20) {
int l = 25 - k;
int i1 = j * l + this.aq;
int i1 = j * l + this.ar;
j = i1 / 25;
this.aq = i1 % 25;
this.ar = i1 % 25;
}
return j;
}
}
protected boolean y() {
protected boolean z() {
return false;
}
@ -652,7 +652,7 @@ public abstract class EntityHuman extends EntityLiving {
}
}
if (!(entityliving instanceof EntityHuman) || this.y()) {
if (!(entityliving instanceof EntityHuman) || this.z()) {
List list = this.world.a(EntityWolf.class, AxisAlignedBB.b(this.locX, this.locY, this.locZ, this.locX + 1.0D, this.locY + 1.0D, this.locZ + 1.0D).grow(16.0D, 4.0D, 16.0D));
Iterator iterator = list.iterator();
@ -660,7 +660,7 @@ public abstract class EntityHuman extends EntityLiving {
Entity entity = (Entity) iterator.next();
EntityWolf entitywolf1 = (EntityWolf) entity;
if (entitywolf1.isTamed() && entitywolf1.E() == null && this.name.equals(entitywolf1.getOwnerName()) && (!flag || !entitywolf1.isSitting())) {
if (entitywolf1.isTamed() && entitywolf1.F() == null && this.name.equals(entitywolf1.getOwnerName()) && (!flag || !entitywolf1.isSitting())) {
// CraftBukkit start
org.bukkit.entity.Entity bukkitTarget = entity == null ? null : entityliving.getBukkitEntity();
@ -689,19 +689,19 @@ public abstract class EntityHuman extends EntityLiving {
this.inventory.d(i);
}
protected int O() {
public int P() {
return this.inventory.j();
}
protected void c(DamageSource damagesource, int i) {
if (!damagesource.ignoresArmor() && this.K()) {
if (!damagesource.ignoresArmor() && this.L()) {
i = 1 + i >> 1;
}
i = this.d(damagesource, i);
i = this.b(damagesource, i);
this.c(damagesource.e());
super.c(damagesource, i);
this.c(damagesource.f());
this.health -= i;
}
public void a(TileEntityFurnace tileentityfurnace) {}
@ -714,33 +714,33 @@ public abstract class EntityHuman extends EntityLiving {
public void e(Entity entity) {
if (!entity.b(this)) {
ItemStack itemstack = this.P();
ItemStack itemstack = this.Q();
if (itemstack != null && entity instanceof EntityLiving) {
itemstack.a((EntityLiving) entity);
// CraftBukkit - bypass infinite items; <= 0 -> == 0
if (itemstack.count == 0) {
itemstack.a(this);
this.Q();
this.R();
}
}
}
}
public ItemStack P() {
public ItemStack Q() {
return this.inventory.getItemInHand();
}
public void Q() {
public void R() {
this.inventory.setItem(this.inventory.itemInHandIndex, (ItemStack) null);
}
public double R() {
public double S() {
return (double) (this.height - 0.5F);
}
public void r_() {
if (!this.t || this.u >= this.A() / 2 || this.u < 0) {
public void s_() {
if (!this.t || this.u >= this.v() / 2 || this.u < 0) {
this.u = -1;
this.t = true;
}
@ -770,7 +770,7 @@ public abstract class EntityHuman extends EntityLiving {
}
if (i > 0 || k > 0) {
boolean flag = this.fallDistance > 0.0F && !this.onGround && !this.r() && !this.az() && !this.hasEffect(MobEffectList.BLINDNESS) && this.vehicle == null && entity instanceof EntityLiving;
boolean flag = this.fallDistance > 0.0F && !this.onGround && !this.r() && !this.aK() && !this.hasEffect(MobEffectList.BLINDNESS) && this.vehicle == null && entity instanceof EntityLiving;
if (flag) {
i += this.random.nextInt(i / 2 + 2);
@ -822,14 +822,14 @@ public abstract class EntityHuman extends EntityLiving {
}
}
ItemStack itemstack = this.P();
ItemStack itemstack = this.Q();
if (itemstack != null && entity instanceof EntityLiving) {
itemstack.a((EntityLiving) entity, this);
// CraftBukkit - bypass infinite items; <= 0 -> == 0
if (itemstack.count == 0) {
itemstack.a(this);
this.Q();
this.R();
}
}
@ -871,8 +871,8 @@ public abstract class EntityHuman extends EntityLiving {
}
}
public boolean T() {
return !this.sleeping && super.T();
public boolean U() {
return !this.sleeping && super.U();
}
public EnumBedResult a(int i, int j, int k) {
@ -881,7 +881,7 @@ public abstract class EntityHuman extends EntityLiving {
return EnumBedResult.OTHER_PROBLEM;
}
if (this.world.worldProvider.c) {
if (this.world.worldProvider.d) {
return EnumBedResult.NOT_POSSIBLE_HERE;
}
@ -983,7 +983,7 @@ public abstract class EntityHuman extends EntityLiving {
if (this.fauxSleeping && !this.sleeping) return; // CraftBukkit - Can't leave bed if not in one!
this.b(0.6F, 1.8F);
this.w();
this.r_();
ChunkCoordinates chunkcoordinates = this.F;
ChunkCoordinates chunkcoordinates1 = this.F;
@ -1029,7 +1029,7 @@ public abstract class EntityHuman extends EntityLiving {
}
}
private boolean C() {
private boolean B() {
return this.world.getTypeId(this.F.x, this.F.y, this.F.z) == Block.BED.id;
}
@ -1078,8 +1078,8 @@ public abstract class EntityHuman extends EntityLiving {
public void a(Statistic statistic, int i) {}
protected void X() {
super.X();
protected void o_() {
super.o_();
this.a(StatisticList.u, 1);
if (this.isSprinting()) {
this.c(0.8F);
@ -1095,12 +1095,12 @@ public abstract class EntityHuman extends EntityLiving {
if (this.abilities.isFlying) {
double d3 = this.motY;
float f2 = this.al;
float f2 = this.am;
this.al = 0.05F;
this.am = 0.05F;
super.a(f, f1);
this.motY = d3 * 0.6D;
this.al = f2;
this.am = f2;
} else {
super.a(f, f1);
}
@ -1118,7 +1118,7 @@ public abstract class EntityHuman extends EntityLiving {
this.a(StatisticList.q, i);
this.c(0.015F * (float) i * 0.01F);
}
} else if (this.az()) {
} else if (this.aK()) {
i = Math.round(MathHelper.a(d0 * d0 + d2 * d2) * 100.0F);
if (i > 0) {
this.a(StatisticList.m, i);
@ -1194,11 +1194,16 @@ public abstract class EntityHuman extends EntityLiving {
public void giveExp(int i) {
this.q += i;
this.exp += (float) i / (float) this.getExpTolevel();
this.expTotal += i;
int j = Integer.MAX_VALUE - this.expTotal;
while (this.exp >= 1.0F) {
--this.exp;
if (i > j) {
i = j;
}
this.exp += (float) i / (float) this.getExpToLevel();
for (this.expTotal += i; this.exp >= 1.0F; this.exp /= (float) this.getExpToLevel()) {
this.exp = (this.exp - 1.0F) * (float) this.getExpToLevel();
this.levelUp();
}
}
@ -1210,7 +1215,7 @@ public abstract class EntityHuman extends EntityLiving {
}
}
public int getExpTolevel() {
public int getExpToLevel() {
return 7 + (this.expLevel * 7 >> 1);
}
@ -1243,7 +1248,7 @@ public abstract class EntityHuman extends EntityLiving {
this.d = itemstack;
this.e = i;
if (!this.world.isStatic) {
this.g(true);
this.h(true);
}
}
}

Datei anzeigen

@ -41,8 +41,8 @@ public class EntityItem extends Entity {
protected void b() {}
public void w_() {
super.w_();
public void y_() {
super.y_();
// CraftBukkit start
int currentTick = (int) (System.currentTimeMillis() / 50);
this.pickupDelay -= (currentTick - this.lastTick);
@ -96,7 +96,7 @@ public class EntityItem extends Entity {
}
public boolean damageEntity(DamageSource damagesource, int i) {
this.aB();
this.aM();
this.f -= i;
if (this.f <= 0) {
this.die();

Datei anzeigen

@ -4,6 +4,7 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
// CraftBukkit start
import org.bukkit.craftbukkit.TrigMath;
@ -21,77 +22,117 @@ public abstract class EntityLiving extends Entity {
public float U;
public float V = 0.0F;
public float W = 0.0F;
protected float X;
protected float Y;
public float X = 0.0F;
public float Y = 0.0F;
protected float Z;
protected float aa;
protected boolean ab = true;
protected String texture = "/mob/char.png";
protected float ab;
protected float ac;
protected boolean ad = true;
protected float ae = 0.0F;
protected String af = null;
protected float ag = 1.0F;
protected int ah = 0;
protected float ai = 0.0F;
public boolean aj = false;
public float ak = 0.1F;
public float al = 0.02F;
public float am;
protected String texture = "/mob/char.png";
protected boolean af = true;
protected float ag = 0.0F;
protected String ah = null;
protected float ai = 1.0F;
protected int aj = 0;
protected float ak = 0.0F;
public float al = 0.1F;
public float am = 0.02F;
public float an;
public float ao;
protected int health = this.getMaxHealth();
public int ap;
protected int aq;
public int aq;
protected int ar;
private int a;
public int hurtTicks;
public int as;
public float at = 0.0F;
public int at;
public float au = 0.0F;
public int deathTicks = 0;
public int attackTicks = 0;
public float aw;
public float ax;
protected boolean ay = false;
protected int az;
public int aA = -1;
public float aB = (float) (Math.random() * 0.8999999761581421D + 0.10000000149011612D);
public float aC;
public float ay;
protected boolean az = false;
protected int aA;
public int aB = -1;
public float aC = (float) (Math.random() * 0.8999999761581421D + 0.10000000149011612D);
public float aD;
public float aE;
public float aF;
public EntityHuman killer = null; // CraftBukkit - prot to pub
protected int aG = 0;
public int aH = 0;
public int aI = 0;
protected int aH = 0;
protected EntityLiving aI = null;
public int aJ = 0;
public int aK = 0;
protected HashMap effects = new HashMap();
private boolean b = true;
private int c;
protected int aK;
protected double aL;
protected double aM;
protected double aN;
private ControllerLook lookController;
private ControllerMove moveController;
private ControllerJump jumpController;
private Navigation navigation;
protected PathfinderGoalSelector goalSelector = new PathfinderGoalSelector();
protected int aN;
protected double aO;
protected double aP;
float aQ = 0.0F;
protected double aQ;
protected double aR;
protected double aS;
float aT = 0.0F;
public int lastDamage = 0; // CraftBukkit - protected -> public
protected int aS = 0;
protected float aT;
protected float aU;
protected float aV;
protected boolean aW = false;
protected float aX = 0.0F;
protected float aY = 0.7F;
private int d = 0;
private Entity e;
protected int aZ = 0;
protected int aV = 0;
protected float aW;
protected float aX;
protected float aY;
protected boolean aZ = false;
protected float ba = 0.0F;
protected float bb = 0.7F;
private int h = 0;
private Entity i;
protected int bc = 0;
public int expToDrop = 0; // CraftBukkit
public int maxAirTicks = 300; // CraftBukkit
public EntityLiving(World world) {
super(world);
this.bc = true;
this.bf = true;
this.lookController = new ControllerLook(this);
this.moveController = new ControllerMove(this, this.bb);
this.jumpController = new ControllerJump(this);
this.navigation = new PathfinderNavigation(this, world);
this.U = (float) (Math.random() + 1.0D) * 0.01F;
this.setPosition(this.locX, this.locY, this.locZ);
this.T = (float) Math.random() * 12398.0F;
this.yaw = (float) (Math.random() * 3.1415927410125732D * 2.0D);
this.bM = 0.5F;
this.X = this.yaw;
this.bP = 0.5F;
}
public ControllerLook getControllerLook() {
return this.lookController;
}
public ControllerMove getControllerMove() {
return this.moveController;
}
public ControllerJump getControllerJump() {
return this.jumpController;
}
public Navigation ah() {
return this.navigation;
}
public Random ai() {
return this.random;
}
public EntityLiving aj() {
return this.aI;
}
public int ak() {
return this.aV;
}
protected void b() {
@ -99,7 +140,7 @@ public abstract class EntityLiving extends Entity {
}
public boolean g(Entity entity) {
return this.world.a(Vec3D.create(this.locX, this.locY + (double) this.x(), this.locZ), Vec3D.create(entity.locX, entity.locY + (double) entity.x(), entity.locZ)) == null;
return this.world.a(Vec3D.create(this.locX, this.locY + (double) this.y(), this.locZ), Vec3D.create(entity.locX, entity.locY + (double) entity.y(), entity.locZ)) == null;
}
public boolean e_() {
@ -110,7 +151,7 @@ public abstract class EntityLiving extends Entity {
return !this.dead;
}
public float x() {
public float y() {
return this.length * 0.85F;
}
@ -118,25 +159,25 @@ public abstract class EntityLiving extends Entity {
return 80;
}
public void ae() {
public void al() {
String s = this.c_();
if (s != null) {
this.world.makeSound(this, s, this.o(), this.w());
this.world.makeSound(this, s, this.o(), this.v());
}
}
public void af() {
this.am = this.an;
super.af();
public void am() {
this.an = this.ao;
super.am();
// MethodProfiler.a("mobBaseTick"); // CraftBukkit - not in production code
if (this.random.nextInt(1000) < this.a++) {
this.a = -this.h();
this.ae();
this.al();
}
// CraftBukkit start - don't inline the damage, perform it with an event
if (this.isAlive() && this.T()) {
if (this.isAlive() && this.U()) {
EntityDamageEvent event = new EntityDamageEvent(this.getBukkitEntity(), EntityDamageEvent.DamageCause.SUFFOCATION, 1);
this.world.getServer().getPluginManager().callEvent(event);
@ -180,7 +221,7 @@ public abstract class EntityLiving extends Entity {
}
}
this.aw = this.ax;
this.ax = this.ay;
if (this.attackTicks > 0) {
--this.attackTicks;
}
@ -194,18 +235,19 @@ public abstract class EntityLiving extends Entity {
}
if (this.health <= 0) {
this.ag();
this.an();
}
if (this.aG > 0) {
--this.aG;
if (this.aH > 0) {
--this.aH;
} else {
this.killer = null;
}
this.aq();
this.aa = this.Z;
this.aB();
this.ac = this.ab;
this.W = this.V;
this.Y = this.X;
this.lastYaw = this.yaw;
this.lastPitch = this.pitch;
// MethodProfiler.a(); // CraftBukkit - not in production code
@ -213,9 +255,9 @@ public abstract class EntityLiving extends Entity {
// CraftBukkit start
public int getExpReward() {
int exp = a(this.killer);
int exp = this.a(this.killer);
if (!this.world.isStatic && (this.aG > 0 || this.ac()) && !this.l()) {
if (!this.world.isStatic && (this.aH > 0 || this.ac()) && !this.l()) {
return exp;
} else {
return 0;
@ -223,7 +265,7 @@ public abstract class EntityLiving extends Entity {
}
// CraftBukkit end
protected void ag() {
protected void an() {
++this.deathTicks;
if (this.deathTicks >= 20 && !this.dead) { // CraftBukkit - (this.deathTicks == 20) -> (this.deathTicks >= 20 && !this.dead).
int i;
@ -238,7 +280,7 @@ public abstract class EntityLiving extends Entity {
}
// CraftBukkit end
this.an();
this.ay();
this.die();
for (i = 0; i < 20; ++i) {
@ -256,14 +298,14 @@ public abstract class EntityLiving extends Entity {
}
protected int a(EntityHuman entityhuman) {
return this.az;
return this.aA;
}
protected boolean ac() {
return false;
}
public void ah() {
public void ao() {
for (int i = 0; i < 20; ++i) {
double d0 = this.random.nextGaussian() * 0.02D;
double d1 = this.random.nextGaussian() * 0.02D;
@ -274,23 +316,23 @@ public abstract class EntityLiving extends Entity {
}
}
public void M() {
super.M();
this.X = this.Y;
this.Y = 0.0F;
public void N() {
super.N();
this.Z = this.aa;
this.aa = 0.0F;
this.fallDistance = 0.0F;
}
public void w_() {
super.w_();
if (this.aH > 0) {
if (this.aI <= 0) {
this.aI = 60;
public void y_() {
super.y_();
if (this.aJ > 0) {
if (this.aK <= 0) {
this.aK = 60;
}
--this.aI;
if (this.aI <= 0) {
--this.aH;
--this.aK;
if (this.aK <= 0) {
--this.aJ;
}
}
@ -301,7 +343,7 @@ public abstract class EntityLiving extends Entity {
float f1 = this.V;
float f2 = 0.0F;
this.X = this.Y;
this.Z = this.aa;
float f3 = 0.0F;
if (f > 0.05F) {
@ -311,7 +353,7 @@ public abstract class EntityLiving extends Entity {
f1 = (float) TrigMath.atan2(d1, d0) * 180.0F / 3.1415927F - 90.0F;
}
if (this.an > 0.0F) {
if (this.ao > 0.0F) {
f1 = this.yaw;
}
@ -319,7 +361,7 @@ public abstract class EntityLiving extends Entity {
f3 = 0.0F;
}
this.Y += (f3 - this.Y) * 0.3F;
this.aa += (f3 - this.aa) * 0.3F;
float f4;
@ -386,7 +428,7 @@ public abstract class EntityLiving extends Entity {
this.lastPitch += 360.0F;
}
this.Z += f2;
this.ab += f2;
}
protected void b(float f, float f1) {
@ -433,13 +475,13 @@ public abstract class EntityLiving extends Entity {
if (this.world.isStatic) {
return false;
} else {
this.aS = 0;
this.aV = 0;
if (this.health <= 0) {
return false;
} else if (damagesource.k() && this.hasEffect(MobEffectList.FIRE_RESISTANCE)) {
return false;
} else {
this.aD = 1.5F;
this.aE = 1.5F;
boolean flag = true;
if ((float) this.noDamageTicks > (float) this.maxNoDamageTicks / 2.0F) {
@ -452,24 +494,24 @@ public abstract class EntityLiving extends Entity {
flag = false;
} else {
this.lastDamage = i;
this.ap = this.health;
this.aq = this.health;
this.noDamageTicks = this.maxNoDamageTicks;
this.c(damagesource, i);
this.hurtTicks = this.as = 10;
this.hurtTicks = this.at = 10;
}
this.at = 0.0F;
this.au = 0.0F;
Entity entity = damagesource.getEntity();
if (entity != null) {
if (entity instanceof EntityHuman) {
this.aG = 60;
this.aH = 60;
this.killer = (EntityHuman) entity;
} else if (entity instanceof EntityWolf) {
EntityWolf entitywolf = (EntityWolf) entity;
if (entitywolf.isTamed()) {
this.aG = 60;
this.aH = 60;
this.killer = null;
}
}
@ -477,7 +519,7 @@ public abstract class EntityLiving extends Entity {
if (flag) {
this.world.a(this, (byte) 2);
this.aB();
this.aM();
if (entity != null) {
double d0 = entity.locX - this.locX;
@ -487,21 +529,21 @@ public abstract class EntityLiving extends Entity {
d0 = (Math.random() - Math.random()) * 0.01D;
}
this.at = (float) (Math.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - this.yaw;
this.au = (float) (Math.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - this.yaw;
this.a(entity, i, d0, d1);
} else {
this.at = (float) ((int) (Math.random() * 2.0D) * 180);
this.au = (float) ((int) (Math.random() * 2.0D) * 180);
}
}
if (this.health <= 0) {
if (flag) {
this.world.makeSound(this, this.n(), this.o(), this.w());
this.world.makeSound(this, this.n(), this.o(), this.v());
}
this.die(damagesource);
} else if (flag) {
this.world.makeSound(this, this.m(), this.o(), this.w());
this.world.makeSound(this, this.m(), this.o(), this.v());
}
return true;
@ -509,11 +551,11 @@ public abstract class EntityLiving extends Entity {
}
}
private float w() {
private float v() {
return this.l() ? (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.5F : (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F;
}
protected int O() {
public int P() {
return 0;
}
@ -521,12 +563,12 @@ public abstract class EntityLiving extends Entity {
protected int d(DamageSource damagesource, int i) {
if (!damagesource.ignoresArmor()) {
int j = 25 - this.O();
int k = i * j + this.aq;
int j = 25 - this.P();
int k = i * j + this.ar;
this.g(i);
i = k / 25;
this.aq = k % 25;
this.ar = k % 25;
}
return i;
@ -536,10 +578,10 @@ public abstract class EntityLiving extends Entity {
if (this.hasEffect(MobEffectList.RESISTANCE)) {
int j = (this.getEffect(MobEffectList.RESISTANCE).getAmplifier() + 1) * 5;
int k = 25 - j;
int l = i * k + this.aq;
int l = i * k + this.ar;
i = l / 25;
this.aq = l % 25;
this.ar = l % 25;
}
return i;
@ -568,7 +610,7 @@ public abstract class EntityLiving extends Entity {
}
public void a(Entity entity, int i, double d0, double d1) {
this.cb = true;
this.ce = true;
float f = MathHelper.a(d0 * d0 + d1 * d1);
float f1 = 0.4F;
@ -576,7 +618,7 @@ public abstract class EntityLiving extends Entity {
this.motY /= 2.0D;
this.motZ /= 2.0D;
this.motX -= d0 / (double) f * (double) f1;
this.motY += 0.4000000059604645D;
this.motY += (double) f1;
this.motZ -= d1 / (double) f * (double) f1;
if (this.motY > 0.4000000059604645D) {
this.motY = 0.4000000059604645D;
@ -586,15 +628,15 @@ public abstract class EntityLiving extends Entity {
public void die(DamageSource damagesource) {
Entity entity = damagesource.getEntity();
if (this.ah >= 0 && entity != null) {
entity.b(this, this.ah);
if (this.aj >= 0 && entity != null) {
entity.b(this, this.aj);
}
if (entity != null) {
entity.a(this);
}
this.ay = true;
this.az = true;
if (!this.world.isStatic) {
int i = 0;
@ -603,7 +645,7 @@ public abstract class EntityLiving extends Entity {
}
if (!this.l()) {
this.dropDeathLoot(this.aG > 0, i);
this.dropDeathLoot(this.aH > 0, i);
}
}
@ -656,8 +698,8 @@ public abstract class EntityLiving extends Entity {
this.damageEntity(DamageSource.FALL, i);
}
// CraftBukkit end
// CraftBukkit end
int j = this.world.getTypeId(MathHelper.floor(this.locX), MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height), MathHelper.floor(this.locZ));
if (j > 0) {
@ -671,7 +713,7 @@ public abstract class EntityLiving extends Entity {
public void a(float f, float f1) {
double d0;
if (this.az()) {
if (this.aK()) {
d0 = this.locY;
this.a(f, f1, 0.02F);
this.move(this.motX, this.motY, this.motZ);
@ -682,7 +724,7 @@ public abstract class EntityLiving extends Entity {
if (this.positionChanged && this.d(this.motX, this.motY + 0.6000000238418579D - this.locY + d0, this.motZ)) {
this.motY = 0.30000001192092896D;
}
} else if (this.aA()) {
} else if (this.aL()) {
d0 = this.locY;
this.a(f, f1, 0.02F);
this.move(this.motX, this.motY, this.motZ);
@ -706,7 +748,7 @@ public abstract class EntityLiving extends Entity {
}
float f3 = 0.16277136F / (f2 * f2 * f2);
float f4 = this.onGround ? this.ak * f3 : this.al;
float f4 = this.onGround ? this.al * f3 : this.am;
this.a(f, f1, f4);
f2 = 0.91F;
@ -759,7 +801,7 @@ public abstract class EntityLiving extends Entity {
this.motZ *= (double) f2;
}
this.aC = this.aD;
this.aD = this.aE;
d0 = this.locX - this.lastX;
double d1 = this.locZ - this.lastZ;
float f6 = MathHelper.a(d0 * d0 + d1 * d1) * 4.0F;
@ -768,8 +810,8 @@ public abstract class EntityLiving extends Entity {
f6 = 1.0F;
}
this.aD += (f6 - this.aD) * 0.4F;
this.aE += this.aD;
this.aE += (f6 - this.aE) * 0.4F;
this.aF += this.aE;
}
public boolean r() {
@ -834,19 +876,31 @@ public abstract class EntityLiving extends Entity {
return false;
}
public void d(float f) {
this.aX = f;
}
public void e(boolean flag) {
this.aZ = flag;
}
public float ar() {
return this.bb;
}
public void d() {
if (this.d > 0) {
--this.d;
if (this.h > 0) {
--this.h;
}
if (this.aK > 0) {
double d0 = this.locX + (this.aL - this.locX) / (double) this.aK;
double d1 = this.locY + (this.aM - this.locY) / (double) this.aK;
double d2 = this.locZ + (this.aN - this.locZ) / (double) this.aK;
if (this.aN > 0) {
double d0 = this.locX + (this.aO - this.locX) / (double) this.aN;
double d1 = this.locY + (this.aP - this.locY) / (double) this.aN;
double d2 = this.locZ + (this.aQ - this.locZ) / (double) this.aN;
double d3;
for (d3 = this.aO - (double) this.yaw; d3 < -180.0D; d3 += 360.0D) {
for (d3 = this.aR - (double) this.yaw; d3 < -180.0D; d3 += 360.0D) {
;
}
@ -854,12 +908,12 @@ public abstract class EntityLiving extends Entity {
d3 -= 360.0D;
}
this.yaw = (float) ((double) this.yaw + d3 / (double) this.aK);
this.pitch = (float) ((double) this.pitch + (this.aP - (double) this.pitch) / (double) this.aK);
--this.aK;
this.yaw = (float) ((double) this.yaw + d3 / (double) this.aN);
this.pitch = (float) ((double) this.pitch + (this.aS - (double) this.pitch) / (double) this.aN);
--this.aN;
this.setPosition(d0, d1, d2);
this.c(this.yaw, this.pitch);
List list = this.world.a(this, this.boundingBox.shrink(0.03125D, 0.0D, 0.03125D));
List list = this.world.a((Entity) this, this.boundingBox.shrink(0.03125D, 0.0D, 0.03125D));
if (list.size() > 0) {
double d4 = 0.0D;
@ -878,40 +932,45 @@ public abstract class EntityLiving extends Entity {
}
// MethodProfiler.a("ai"); // CraftBukkit - not in production code
if (this.L()) {
this.aW = false;
this.aT = 0.0F;
this.aU = 0.0F;
this.aV = 0.0F;
} else if (!this.aj) {
this.m_();
if (this.M()) {
this.aZ = false;
this.aW = 0.0F;
this.aX = 0.0F;
this.aY = 0.0F;
} else if (this.at()) {
if (this.as()) {
this.av();
} else {
this.m_();
this.X = this.yaw;
}
}
// MethodProfiler.a(); // CraftBukkit - not in production code
boolean flag = this.az();
boolean flag1 = this.aA();
boolean flag = this.aK();
boolean flag1 = this.aL();
if (this.aW) {
if (this.aZ) {
if (flag) {
this.motY += 0.03999999910593033D;
} else if (flag1) {
this.motY += 0.03999999910593033D;
} else if (this.onGround && this.d == 0) {
this.X();
this.d = 10;
} else if (this.onGround && this.h == 0) {
this.o_();
this.h = 10;
}
} else {
this.d = 0;
this.h = 0;
}
this.aT *= 0.98F;
this.aU *= 0.98F;
this.aV *= 0.9F;
float f = this.ak;
this.aW *= 0.98F;
this.aX *= 0.98F;
this.aY *= 0.9F;
float f = this.al;
this.ak *= this.F();
this.a(this.aT, this.aU);
this.ak = f;
this.al *= this.G();
this.a(this.aW, this.aX);
this.al = f;
// MethodProfiler.a("push"); // CraftBukkit - not in production code
List list1 = this.world.getEntities(this, this.boundingBox.grow(0.20000000298023224D, 0.0D, 0.20000000298023224D));
@ -928,15 +987,23 @@ public abstract class EntityLiving extends Entity {
// MethodProfiler.a(); // CraftBukkit - not in production code
}
protected boolean L() {
return this.health <= 0;
}
public boolean K() {
protected boolean as() {
return false;
}
protected void X() {
protected boolean at() {
return !this.world.isStatic;
}
protected boolean M() {
return this.health <= 0;
}
public boolean L() {
return false;
}
protected void o_() {
this.motY = 0.41999998688697815D;
if (this.hasEffect(MobEffectList.JUMP)) {
this.motY += (double) ((float) (this.getEffect(MobEffectList.JUMP).getAmplifier() + 1) * 0.1F);
@ -949,14 +1016,14 @@ public abstract class EntityLiving extends Entity {
this.motZ += (double) (MathHelper.cos(f) * 0.2F);
}
this.cb = true;
this.ce = true;
}
protected boolean d_() {
return true;
}
protected void ak() {
protected void au() {
EntityHuman entityhuman = this.world.findNearbyPlayer(this, -1.0D);
if (entityhuman != null) {
@ -969,56 +1036,70 @@ public abstract class EntityLiving extends Entity {
this.die();
}
if (this.aS > 600 && this.random.nextInt(800) == 0 && d3 > 1024.0D && this.d_()) {
if (this.aV > 600 && this.random.nextInt(800) == 0 && d3 > 1024.0D && this.d_()) {
this.die();
} else if (d3 < 1024.0D) {
this.aS = 0;
this.aV = 0;
}
}
}
protected void av() {
++this.aV;
this.au();
if (this.aI != null && !this.aI.isAlive()) {
this.aI = null;
}
this.goalSelector.a();
this.navigation.a();
this.moveController.a();
this.lookController.a();
this.jumpController.b();
}
protected void m_() {
++this.aS;
++this.aV;
EntityHuman entityhuman = this.world.findNearbyPlayer(this, -1.0D);
this.ak();
this.aT = 0.0F;
this.aU = 0.0F;
this.au();
this.aW = 0.0F;
this.aX = 0.0F;
float f = 8.0F;
if (this.random.nextFloat() < 0.02F) {
entityhuman = this.world.findNearbyPlayer(this, (double) f);
if (entityhuman != null) {
this.e = entityhuman;
this.aZ = 10 + this.random.nextInt(20);
this.i = entityhuman;
this.bc = 10 + this.random.nextInt(20);
} else {
this.aV = (this.random.nextFloat() - 0.5F) * 20.0F;
this.aY = (this.random.nextFloat() - 0.5F) * 20.0F;
}
}
if (this.e != null) {
this.a(this.e, 10.0F, (float) this.q_());
if (this.aZ-- <= 0 || this.e.dead || this.e.i(this) > (double) (f * f)) {
this.e = null;
if (this.i != null) {
this.a(this.i, 10.0F, (float) this.x());
if (this.bc-- <= 0 || this.i.dead || this.i.i(this) > (double) (f * f)) {
this.i = null;
}
} else {
if (this.random.nextFloat() < 0.05F) {
this.aV = (this.random.nextFloat() - 0.5F) * 20.0F;
this.aY = (this.random.nextFloat() - 0.5F) * 20.0F;
}
this.yaw += this.aV;
this.pitch = this.aX;
this.yaw += this.aY;
this.pitch = this.ba;
}
boolean flag = this.az();
boolean flag1 = this.aA();
boolean flag = this.aK();
boolean flag1 = this.aL();
if (flag || flag1) {
this.aW = this.random.nextFloat() < 0.8F;
this.aZ = this.random.nextFloat() < 0.8F;
}
}
protected int q_() {
public int x() {
return 40;
}
@ -1030,9 +1111,9 @@ public abstract class EntityLiving extends Entity {
if (entity instanceof EntityLiving) {
EntityLiving entityliving = (EntityLiving) entity;
d2 = this.locY + (double) this.x() - (entityliving.locY + (double) entityliving.x());
d2 = this.locY + (double) this.y() - (entityliving.locY + (double) entityliving.y());
} else {
d2 = (entity.boundingBox.b + entity.boundingBox.e) / 2.0D - (this.locY + (double) this.x());
d2 = (entity.boundingBox.b + entity.boundingBox.e) / 2.0D - (this.locY + (double) this.y());
}
double d3 = (double) MathHelper.a(d0 * d0 + d1 * d1);
@ -1043,12 +1124,12 @@ public abstract class EntityLiving extends Entity {
this.yaw = this.b(this.yaw, f2, f);
}
public boolean al() {
return this.e != null;
public boolean aw() {
return this.i != null;
}
public Entity am() {
return this.e;
public Entity ax() {
return this.i;
}
private float b(float f, float f1, float f2) {
@ -1073,13 +1154,13 @@ public abstract class EntityLiving extends Entity {
return f + f3;
}
public void an() {}
public void ay() {}
public boolean g() {
return this.world.containsEntity(this.boundingBox) && this.world.a(this, this.boundingBox).size() == 0 && !this.world.c(this.boundingBox);
return this.world.containsEntity(this.boundingBox) && this.world.a((Entity) this, this.boundingBox).size() == 0 && !this.world.c(this.boundingBox);
}
protected void ao() {
protected void az() {
// CraftBukkit start
EntityDamageByBlockEvent event = new EntityDamageByBlockEvent(null, this.getBukkitEntity(), EntityDamageEvent.DamageCause.VOID, 4);
this.world.getServer().getPluginManager().callEvent(event);
@ -1092,11 +1173,11 @@ public abstract class EntityLiving extends Entity {
// CraftBukkit end
}
public Vec3D ap() {
return this.d(1.0F);
public Vec3D aA() {
return this.e(1.0F);
}
public Vec3D d(float f) {
public Vec3D e(float f) {
float f1;
float f2;
float f3;
@ -1128,7 +1209,7 @@ public abstract class EntityLiving extends Entity {
return false;
}
protected void aq() {
protected void aB() {
Iterator iterator = this.effects.keySet().iterator();
while (iterator.hasNext()) {
@ -1168,7 +1249,7 @@ public abstract class EntityLiving extends Entity {
}
}
public void ar() {
public void aC() {
Iterator iterator = this.effects.keySet().iterator();
while (iterator.hasNext()) {
@ -1218,7 +1299,7 @@ public abstract class EntityLiving extends Entity {
return true;
}
public boolean at() {
public boolean aE() {
return this.getMonsterType() == MonsterType.UNDEAD;
}
@ -1234,7 +1315,7 @@ public abstract class EntityLiving extends Entity {
this.b = true;
}
protected float F() {
protected float G() {
float f = 1.0F;
if (this.hasEffect(MobEffectList.FASTER_MOVEMENT)) {
@ -1272,7 +1353,7 @@ public abstract class EntityLiving extends Entity {
vec3d1.a(-this.pitch * 3.1415927F / 180.0F);
vec3d1.b(-this.yaw * 3.1415927F / 180.0F);
vec3d1 = vec3d1.add(this.locX, this.locY + (double) this.x(), this.locZ);
vec3d1 = vec3d1.add(this.locX, this.locY + (double) this.y(), this.locZ);
this.world.a("iconcrack_" + itemstack.getItem().id, vec3d1.a, vec3d1.b, vec3d1.c, vec3d.a, vec3d.b + 0.05D, vec3d.c);
}
}

Datei anzeigen

@ -1,19 +1,22 @@
package net.minecraft.server;
import java.util.List; // CraftBukkit
import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
public class EntityMagmaCube extends EntitySlime {
public EntityMagmaCube(World world) {
super(world);
this.texture = "/mob/lava.png";
this.fireProof = true;
this.ak = 0.2F;
this.al = 0.2F;
}
public boolean g() {
return this.world.difficulty > 0 && this.world.containsEntity(this.boundingBox) && this.world.a(this, this.boundingBox).size() == 0 && !this.world.c(this.boundingBox);
return this.world.difficulty > 0 && this.world.containsEntity(this.boundingBox) && this.world.a((Entity) this, this.boundingBox).size() == 0 && !this.world.c(this.boundingBox);
}
protected int O() {
public int P() {
return this.getSize() * 3;
}
@ -21,43 +24,62 @@ public class EntityMagmaCube extends EntitySlime {
return 1.0F;
}
protected String w() {
protected String v() {
return "flame";
}
protected EntitySlime y() {
protected EntitySlime z() {
return new EntityMagmaCube(this.world);
}
protected int e() {
return 0;
return Item.MAGMA_CREAM.id;
}
public boolean z() {
protected void dropDeathLoot(boolean flag, int i) {
// CraftBukkit start - whole method
List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
int j = this.e();
if (j > 0 && this.getSize() > 1) {
int k = this.random.nextInt(4) - 2;
if (i > 0) {
k += this.random.nextInt(i + 1);
}
loot.add(new org.bukkit.inventory.ItemStack(j, k));
}
CraftEventFactory.callEntityDeathEvent(this, loot);
// CraftBukkit end
}
public boolean A() {
return false;
}
protected int A() {
return super.A() * 4;
protected int B() {
return super.B() * 4;
}
protected void B() {
protected void C() {
this.a *= 0.9F;
}
protected void X() {
protected void o_() {
this.motY = (double) (0.42F + (float) this.getSize() * 0.1F);
this.cb = true;
this.ce = true;
}
protected void b(float f) {}
protected boolean C() {
protected boolean D() {
return true;
}
protected int D() {
return super.D() + 2;
protected int E() {
return super.E() + 2;
}
protected String m() {
@ -68,15 +90,15 @@ public class EntityMagmaCube extends EntitySlime {
return "mob.slime";
}
protected String E() {
protected String F() {
return this.getSize() > 1 ? "mob.magmacube.big" : "mob.magmacube.small";
}
public boolean aA() {
public boolean aL() {
return false;
}
protected boolean G() {
protected boolean H() {
return true;
}
}

Datei anzeigen

@ -51,7 +51,7 @@ public class EntityMinecart extends Entity implements IInventory {
this.items = new ItemStack[27]; // CraftBukkit
this.e = 0;
this.f = false;
this.bc = true;
this.bf = true;
this.b(0.98F, 0.7F);
this.height = this.length / 2.0F;
}
@ -115,7 +115,7 @@ public class EntityMinecart extends Entity implements IInventory {
this.d(-this.m());
this.c(10);
this.aB();
this.aM();
this.setDamage(this.getDamage() + i * 10);
if (this.getDamage() > 40) {
if (this.passenger != null) {
@ -211,7 +211,7 @@ public class EntityMinecart extends Entity implements IInventory {
super.die();
}
public void w_() {
public void y_() {
// CraftBukkit start
double prevX = this.locX;
double prevY = this.locY;
@ -748,8 +748,8 @@ public class EntityMinecart extends Entity implements IInventory {
d1 *= d3;
d0 *= 0.10000000149011612D;
d1 *= 0.10000000149011612D;
d0 *= (double) (1.0F - this.bO);
d1 *= (double) (1.0F - this.bO);
d0 *= (double) (1.0F - this.bR);
d1 *= (double) (1.0F - this.bR);
d0 *= 0.5D;
d1 *= 0.5D;
if (entity instanceof EntityMinecart) {

Datei anzeigen

@ -14,21 +14,21 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
public EntityMonster(World world) {
super(world);
this.az = 5;
this.aA = 5;
}
public void d() {
float f = this.a(1.0F);
if (f > 0.5F) {
this.aS += 2;
this.aV += 2;
}
super.d();
}
public void w_() {
super.w_();
public void y_() {
super.y_();
if (!this.world.isStatic && this.world.difficulty == 0) {
this.die();
}
@ -55,8 +55,10 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
if (!event.isCancelled()) {
if (event.getTarget() == null) {
this.target = null;
this.aI = null;
} else {
this.target = ((CraftEntity) event.getTarget()).getHandle();
this.aI = this.target instanceof EntityLiving ? (EntityLiving) this.target : null;
}
}
// CraftBukkit end
@ -71,7 +73,7 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
}
}
protected boolean d(Entity entity) {
public boolean d(Entity entity) {
int i = this.damage;
if (this.hasEffect(MobEffectList.INCREASE_DAMAGE)) {
@ -110,7 +112,7 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
}
}
protected float a(int i, int j, int k) {
public float a(int i, int j, int k) {
return 0.5F - this.world.m(i, j, k);
}
@ -122,7 +124,7 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
super.a(nbttagcompound);
}
protected boolean y() {
protected boolean z() {
int i = MathHelper.floor(this.locX);
int j = MathHelper.floor(this.boundingBox.b);
int k = MathHelper.floor(this.locZ);
@ -145,6 +147,6 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
}
public boolean g() {
return this.y() && super.g();
return this.z() && super.g();
}
}

Datei anzeigen

@ -120,7 +120,7 @@ public class EntityPainting extends Entity {
return i == 32 ? 0.5F : (i == 64 ? 0.5F : 0.0F);
}
public void w_() {
public void y_() {
if (this.f++ == 100 && !this.world.isStatic) {
this.f = 0;
if (!this.survives()) {
@ -237,7 +237,7 @@ public class EntityPainting extends Entity {
// CraftBukkit end
this.die();
this.aB();
this.aM();
this.world.addEntity(new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.PAINTING)));
}

Datei anzeigen

@ -56,7 +56,7 @@ public class EntityPig extends EntityAnimal {
}
protected int e() {
return this.z() ? Item.GRILLED_PORK.id : Item.PORK.id;
return this.A() ? Item.GRILLED_PORK.id : Item.PORK.id;
}
public boolean hasSaddle() {

Datei anzeigen

@ -18,22 +18,26 @@ public class EntityPigZombie extends EntityZombie {
public EntityPigZombie(World world) {
super(world);
this.texture = "/mob/pigzombie.png";
this.aY = 0.5F;
this.bb = 0.5F;
this.damage = 5;
this.fireProof = true;
}
public void w_() {
this.aY = this.target != null ? 0.95F : 0.5F;
protected boolean as() {
return false;
}
public void y_() {
this.bb = this.target != null ? 0.95F : 0.5F;
if (this.soundDelay > 0 && --this.soundDelay == 0) {
this.world.makeSound(this, "mob.zombiepig.zpigangry", this.o() * 2.0F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 1.8F);
}
super.w_();
super.y_();
}
public boolean g() {
return this.world.difficulty > 0 && this.world.containsEntity(this.boundingBox) && this.world.a(this, this.boundingBox).size() == 0 && !this.world.c(this.boundingBox);
return this.world.difficulty > 0 && this.world.containsEntity(this.boundingBox) && this.world.a((Entity) this, this.boundingBox).size() == 0 && !this.world.c(this.boundingBox);
}
public void b(NBTTagCompound nbttagcompound) {

Datei anzeigen

@ -24,13 +24,13 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public double e;
public List chunkCoordIntPairQueue = new LinkedList();
public Set playerChunkCoordIntPairs = new HashSet();
private int cc = -99999999;
private int cd = -99999999;
private boolean ce = true;
private int cf = -99999999;
private int cg = -99999999;
private boolean ch = true;
public int lastSentExp = -99999999; // CraftBukkit - priv to pub
public int cg = 60; // CraftBukkit - private to public; temporary until we get an API out
private ItemStack[] ch = new ItemStack[] { null, null, null, null, null};
private int ci = 0;
public int cj = 60; // CraftBukkit - private to public; temporary until we get an API out
private ItemStack[] ck = new ItemStack[] { null, null, null, null, null};
private int cl = 0;
public boolean h;
public int ping;
public boolean j = false;
@ -44,7 +44,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
int j = chunkcoordinates.z;
int k = chunkcoordinates.y;
if (!world.worldProvider.e) {
if (!world.worldProvider.f) {
i += this.random.nextInt(20) - 10;
k = world.f(i, j);
j += this.random.nextInt(20) - 10;
@ -52,7 +52,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.setPositionRotation((double) i + 0.5D, (double) k, (double) j + 0.5D, 0.0F, 0.0F);
this.b = minecraftserver;
this.bM = 0.0F;
this.bP = 0.0F;
this.name = s;
this.height = 0.0F;
@ -119,28 +119,28 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
public ItemStack[] getEquipment() {
return this.ch;
return this.ck;
}
protected void w() {
protected void r_() {
this.height = 0.0F;
}
public float x() {
public float y() {
return 1.62F;
}
public void w_() {
public void y_() {
this.itemInWorldManager.c();
--this.cg;
--this.cj;
this.activeContainer.a();
for (int i = 0; i < 5; ++i) {
ItemStack itemstack = this.c(i);
if (itemstack != this.ch[i]) {
if (itemstack != this.ck[i]) {
this.b.getTracker(this.dimension).a(this, new Packet5EntityEquipment(this.id, i, itemstack));
this.ch[i] = itemstack;
this.ck[i] = itemstack;
}
}
}
@ -187,7 +187,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
public boolean damageEntity(DamageSource damagesource, int i) {
if (this.cg > 0) {
if (this.cj > 0) {
return false;
} else {
// CraftBukkit - this.b.pvpMode -> this.world.pvpMode
@ -211,7 +211,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
}
protected boolean y() {
protected boolean z() {
return this.b.pvpMode;
}
@ -220,7 +220,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
public void a(boolean flag) {
super.w_();
super.y_();
for (int i = 0; i < this.inventory.getSize(); ++i) {
ItemStack itemstack = this.inventory.getItem(i);
@ -282,8 +282,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.b.serverConfigurationManager.changeDimension(this, b0);
this.lastSentExp = -1;
this.cc = -1;
this.cd = -1;
this.cf = -1;
this.cg = -1;
this.a((Statistic) AchievementList.x);
}
}
@ -304,11 +304,11 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
--this.I;
}
if (this.getHealth() != this.cc || this.cd != this.foodData.a() || this.foodData.c() == 0.0F != this.ce) {
if (this.getHealth() != this.cf || this.cg != this.foodData.a() || this.foodData.c() == 0.0F != this.ch) {
this.netServerHandler.sendPacket(new Packet8UpdateHealth(this.getHealth(), this.foodData.a(), this.foodData.c()));
this.cc = this.getHealth();
this.cd = this.foodData.a();
this.ce = this.foodData.c() == 0.0F;
this.cf = this.getHealth();
this.cg = this.foodData.a();
this.ch = this.foodData.c() == 0.0F;
}
if (this.expTotal != this.lastSentExp) {
@ -335,8 +335,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.b.serverConfigurationManager.changeDimension(this, 1);
this.lastSentExp = -1;
this.cc = -1;
this.cd = -1;
this.cf = -1;
this.cg = -1;
}
}
@ -371,7 +371,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.activeContainer.a();
}
public void r_() {
public void s_() {
if (!this.t) {
this.u = -1;
this.t = true;
@ -381,7 +381,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
}
public void A() {}
public void B() {}
public EnumBedResult a(int i, int j, int k) {
EnumBedResult enumbedresult = super.a(i, j, k);
@ -433,55 +433,55 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
super.a(d0, flag);
}
private void aH() {
this.ci = this.ci % 100 + 1;
private void aS() {
this.cl = this.cl % 100 + 1;
}
public void b(int i, int j, int k) {
this.aH();
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.ci, 1, "Crafting", 9));
this.aS();
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.cl, 1, "Crafting", 9));
this.activeContainer = new ContainerWorkbench(this.inventory, this.world, i, j, k);
this.activeContainer.windowId = this.ci;
this.activeContainer.windowId = this.cl;
this.activeContainer.a((ICrafting) this);
}
public void c(int i, int j, int k) {
this.aH();
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.ci, 4, "Enchanting", 9));
this.aS();
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.cl, 4, "Enchanting", 9));
this.activeContainer = new ContainerEnchantTable(this.inventory, this.world, i, j, k);
this.activeContainer.windowId = this.ci;
this.activeContainer.windowId = this.cl;
this.activeContainer.a((ICrafting) this);
}
public void a(IInventory iinventory) {
this.aH();
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.ci, 0, iinventory.getName(), iinventory.getSize()));
this.aS();
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.cl, 0, iinventory.getName(), iinventory.getSize()));
this.activeContainer = new ContainerChest(this.inventory, iinventory);
this.activeContainer.windowId = this.ci;
this.activeContainer.windowId = this.cl;
this.activeContainer.a((ICrafting) this);
}
public void a(TileEntityFurnace tileentityfurnace) {
this.aH();
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.ci, 2, tileentityfurnace.getName(), tileentityfurnace.getSize()));
this.aS();
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.cl, 2, tileentityfurnace.getName(), tileentityfurnace.getSize()));
this.activeContainer = new ContainerFurnace(this.inventory, tileentityfurnace);
this.activeContainer.windowId = this.ci;
this.activeContainer.windowId = this.cl;
this.activeContainer.a((ICrafting) this);
}
public void a(TileEntityDispenser tileentitydispenser) {
this.aH();
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.ci, 3, tileentitydispenser.getName(), tileentitydispenser.getSize()));
this.aS();
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.cl, 3, tileentitydispenser.getName(), tileentitydispenser.getSize()));
this.activeContainer = new ContainerDispenser(this.inventory, tileentitydispenser);
this.activeContainer.windowId = this.ci;
this.activeContainer.windowId = this.cl;
this.activeContainer.a((ICrafting) this);
}
public void a(TileEntityBrewingStand tileentitybrewingstand) {
this.aH();
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.ci, 5, tileentitybrewingstand.getName(), tileentitybrewingstand.getSize()));
this.aS();
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.cl, 5, tileentitybrewingstand.getName(), tileentitybrewingstand.getSize()));
this.activeContainer = new ContainerBrewingStand(this.inventory, tileentitybrewingstand);
this.activeContainer.windowId = this.ci;
this.activeContainer.windowId = this.cl;
this.activeContainer.a((ICrafting) this);
}
@ -510,32 +510,23 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void closeInventory() {
this.netServerHandler.sendPacket(new Packet101CloseWindow(this.activeContainer.windowId));
this.D();
this.E();
}
public void C() {
public void D() {
if (!this.h) {
this.netServerHandler.sendPacket(new Packet103SetSlot(-1, -1, this.inventory.l()));
}
}
public void D() {
public void E() {
this.activeContainer.a((EntityHuman) this);
this.activeContainer = this.defaultContainer;
}
public void a(float f, float f1, boolean flag, boolean flag1, float f2, float f3) {
this.aT = f;
this.aU = f1;
this.aW = flag;
this.setSneak(flag1);
this.pitch = f2;
this.yaw = f3;
}
public void a(Statistic statistic, int i) {
if (statistic != null) {
if (!statistic.g) {
if (!statistic.f) {
while (i > 100) {
this.netServerHandler.sendPacket(new Packet200Statistic(statistic.e, 100));
i -= 100;
@ -546,7 +537,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
}
public void E() {
public void F() {
if (this.vehicle != null) {
this.mount(this.vehicle);
}
@ -560,20 +551,20 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
}
public void s_() {
this.cc = -99999999;
public void t_() {
this.cf = -99999999;
}
public void a(String s) {
LocaleLanguage localelanguage = LocaleLanguage.a();
String s1 = localelanguage.a(s);
String s1 = localelanguage.b(s);
this.netServerHandler.sendPacket(new Packet3Chat(s1));
}
protected void G() {
protected void H() {
this.netServerHandler.sendPacket(new Packet38EntityStatus(this.id, (byte) 9));
super.G();
super.H();
}
public void a(ItemStack itemstack, int i) {

Datei anzeigen

@ -30,7 +30,7 @@ public abstract class EntityProjectile extends Entity {
super(world);
this.shooter = entityliving;
this.b(0.25F, 0.25F);
this.setPositionRotation(entityliving.locX, entityliving.locY + (double) entityliving.x(), entityliving.locZ, entityliving.yaw, entityliving.pitch);
this.setPositionRotation(entityliving.locX, entityliving.locY + (double) entityliving.y(), entityliving.locZ, entityliving.yaw, entityliving.pitch);
this.locX -= (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * 0.16F);
this.locY -= 0.10000000149011612D;
this.locZ -= (double) (MathHelper.sin(this.yaw / 180.0F * 3.1415927F) * 0.16F);
@ -82,11 +82,11 @@ public abstract class EntityProjectile extends Entity {
this.h = 0;
}
public void w_() {
this.bI = this.locX;
this.bJ = this.locY;
this.bK = this.locZ;
super.w_();
public void y_() {
this.bL = this.locX;
this.bM = this.locY;
this.bN = this.locZ;
super.y_();
if (this.shake > 0) {
--this.shake;
}
@ -190,7 +190,7 @@ public abstract class EntityProjectile extends Entity {
float f2 = 0.99F;
float f3 = this.e();
if (this.az()) {
if (this.aK()) {
for (int k = 0; k < 4; ++k) {
float f4 = 0.25F;

Datei anzeigen

@ -6,6 +6,7 @@ import org.bukkit.craftbukkit.event.CraftEventFactory;
public class EntitySheep extends EntityAnimal {
public static final float[][] a = new float[][] { { 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}};
private int b;
public EntitySheep(World world) {
super(world);
@ -38,13 +39,75 @@ public class EntitySheep extends EntityAnimal {
return Block.WOOL.id;
}
public void d() {
super.d();
if (this.b > 0) {
--this.b;
}
}
protected void o_() {
if (this.b <= 0) {
super.o_();
}
}
protected void m_() {
super.m_();
int i;
int j;
int k;
if (!this.E() && this.b <= 0 && (this.l() && this.random.nextInt(50) == 0 || this.random.nextInt(1000) == 0)) {
i = MathHelper.floor(this.locX);
j = MathHelper.floor(this.locY);
k = MathHelper.floor(this.locZ);
if (this.world.getTypeId(i, j, k) == Block.LONG_GRASS.id && this.world.getData(i, j, k) == 1 || this.world.getTypeId(i, j - 1, k) == Block.GRASS.id) {
this.b = 40;
this.world.a(this, (byte) 10);
}
} else if (this.b == 4) {
i = MathHelper.floor(this.locX);
j = MathHelper.floor(this.locY);
k = MathHelper.floor(this.locZ);
boolean flag = false;
if (this.world.getTypeId(i, j, k) == Block.LONG_GRASS.id) {
this.world.f(2001, i, j, k, Block.LONG_GRASS.id + 256);
this.world.setTypeId(i, j, k, 0);
flag = true;
} else if (this.world.getTypeId(i, j - 1, k) == Block.GRASS.id) {
this.world.f(2001, i, j - 1, k, Block.GRASS.id);
this.world.setTypeId(i, j - 1, k, Block.DIRT.id);
flag = true;
}
if (flag) {
this.setSheared(false);
if (this.l()) {
int l = this.getAge() + 1200;
if (l > 0) {
l = 0;
}
this.setAge(l);
}
}
}
}
protected boolean v() {
return this.b > 0;
}
public boolean b(EntityHuman entityhuman) {
ItemStack itemstack = entityhuman.inventory.getItemInHand();
if (itemstack != null && itemstack.id == Item.SHEARS.id && !this.isSheared()) {
if (itemstack != null && itemstack.id == Item.SHEARS.id && !this.isSheared() && !this.l()) {
if (!this.world.isStatic) {
this.setSheared(true);
int i = 2 + this.random.nextInt(3);
int i = 1 + this.random.nextInt(3);
for (int j = 0; j < i; ++j) {
EntityItem entityitem = this.a(new ItemStack(Block.WOOL.id, 1, this.getColor()), 1.0F);

Datei anzeigen

@ -36,7 +36,7 @@ public class EntitySkeleton extends EntityMonster {
public void die(DamageSource damagesource) {
super.die(damagesource);
if (damagesource.g() instanceof EntityArrow && damagesource.getEntity() instanceof EntityHuman) {
if (damagesource.b() instanceof EntityArrow && damagesource.getEntity() instanceof EntityHuman) {
EntityHuman entityhuman = (EntityHuman) damagesource.getEntity();
double d0 = entityhuman.locX - this.locX;
double d1 = entityhuman.locZ - this.locZ;
@ -73,7 +73,7 @@ public class EntitySkeleton extends EntityMonster {
if (this.attackTicks == 0) {
EntityArrow entityarrow = new EntityArrow(this.world, this, 1.0F);
double d2 = entity.locY + (double) entity.x() - 0.699999988079071D - entityarrow.locY;
double d2 = entity.locY + (double) entity.y() - 0.699999988079071D - entityarrow.locY;
float f1 = MathHelper.a(d0 * d0 + d1 * d1) * 0.2F;
this.world.makeSound(this, "random.bow", 1.0F, 1.0F / (this.random.nextFloat() * 0.4F + 0.8F));

Datei anzeigen

@ -15,7 +15,7 @@ public class EntitySlime extends EntityLiving implements IMonster {
this.height = 0.0F;
this.jumpDelay = this.random.nextInt(20) + 10;
this.setSize(i);
this.az = i;
this.aA = i;
}
protected void b() {
@ -50,15 +50,15 @@ public class EntitySlime extends EntityLiving implements IMonster {
this.setSize(nbttagcompound.getInt("Size") + 1);
}
protected String w() {
protected String v() {
return "slime";
}
protected String E() {
protected String F() {
return "mob.slime";
}
public void w_() {
public void y_() {
if (!this.world.isStatic && this.world.difficulty == 0 && this.getSize() > 0) {
this.dead = true;
}
@ -67,7 +67,7 @@ public class EntitySlime extends EntityLiving implements IMonster {
this.c = this.b;
boolean flag = this.onGround;
super.w_();
super.y_();
if (this.onGround && !flag) {
int i = this.getSize();
@ -77,21 +77,21 @@ public class EntitySlime extends EntityLiving implements IMonster {
float f2 = MathHelper.sin(f) * (float) i * 0.5F * f1;
float f3 = MathHelper.cos(f) * (float) i * 0.5F * f1;
this.world.a(this.w(), this.locX + (double) f2, this.boundingBox.b, this.locZ + (double) f3, 0.0D, 0.0D, 0.0D);
this.world.a(this.v(), this.locX + (double) f2, this.boundingBox.b, this.locZ + (double) f3, 0.0D, 0.0D, 0.0D);
}
if (this.G()) {
this.world.makeSound(this, this.E(), this.o(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) / 0.8F);
if (this.H()) {
this.world.makeSound(this, this.F(), this.o(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) / 0.8F);
}
this.a = -0.5F;
}
this.B();
this.C();
}
protected void m_() {
this.ak();
this.au();
EntityHuman entityhuman = this.world.findNearbyVulnerablePlayer(this, 16.0D);
if (entityhuman != null) {
@ -99,36 +99,36 @@ public class EntitySlime extends EntityLiving implements IMonster {
}
if (this.onGround && this.jumpDelay-- <= 0) {
this.jumpDelay = this.A();
this.jumpDelay = this.B();
if (entityhuman != null) {
this.jumpDelay /= 3;
}
this.aW = true;
if (this.I()) {
this.world.makeSound(this, this.E(), this.o(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 0.8F);
this.aZ = true;
if (this.J()) {
this.world.makeSound(this, this.F(), this.o(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 0.8F);
}
this.a = 1.0F;
this.aT = 1.0F - this.random.nextFloat() * 2.0F;
this.aU = (float) (1 * this.getSize());
this.aW = 1.0F - this.random.nextFloat() * 2.0F;
this.aX = (float) (1 * this.getSize());
} else {
this.aW = false;
this.aZ = false;
if (this.onGround) {
this.aT = this.aU = 0.0F;
this.aW = this.aX = 0.0F;
}
}
}
protected void B() {
protected void C() {
this.a *= 0.6F;
}
protected int A() {
protected int B() {
return this.random.nextInt(20) + 10;
}
protected EntitySlime y() {
protected EntitySlime z() {
return new EntitySlime(this.world);
}
@ -153,7 +153,7 @@ public class EntitySlime extends EntityLiving implements IMonster {
for (int k = 0; k < j; ++k) {
float f = ((float) (k % 2) - 0.5F) * (float) i / 4.0F;
float f1 = ((float) (k / 2) - 0.5F) * (float) i / 4.0F;
EntitySlime entityslime = this.y();
EntitySlime entityslime = this.z();
entityslime.setSize(i / 2);
entityslime.setPositionRotation(this.locX + (double) f, this.locY + 0.5D, this.locZ + (double) f1, this.random.nextFloat() * 360.0F, 0.0F);
@ -165,20 +165,20 @@ public class EntitySlime extends EntityLiving implements IMonster {
}
public void a_(EntityHuman entityhuman) {
if (this.C()) {
if (this.D()) {
int i = this.getSize();
if (this.g(entityhuman) && (double) this.h(entityhuman) < 0.6D * (double) i && entityhuman.damageEntity(DamageSource.mobAttack(this), this.D())) {
if (this.g(entityhuman) && (double) this.h(entityhuman) < 0.6D * (double) i && entityhuman.damageEntity(DamageSource.mobAttack(this), this.E())) {
this.world.makeSound(this, "mob.slimeattack", 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
}
}
}
protected boolean C() {
protected boolean D() {
return this.getSize() > 1;
}
protected int D() {
protected int E() {
return this.getSize();
}
@ -204,15 +204,15 @@ public class EntitySlime extends EntityLiving implements IMonster {
return 0.4F * (float) this.getSize();
}
protected int q_() {
public int x() {
return 0;
}
protected boolean I() {
protected boolean J() {
return this.getSize() > 1;
}
protected boolean G() {
protected boolean H() {
return this.getSize() > 2;
}
}

Datei anzeigen

@ -17,7 +17,7 @@ public class EntitySnowman extends EntityGolem {
public void d() {
super.d();
if (this.target == null && !this.D() && this.world.random.nextInt(100) == 0) {
if (this.target == null && !this.E() && this.world.random.nextInt(100) == 0) {
List list = this.world.a(EntityMonster.class, AxisAlignedBB.b(this.locX, this.locY, this.locZ, this.locX + 1.0D, this.locY + 1.0D, this.locZ + 1.0D).grow(16.0D, 4.0D, 16.0D));
if (!list.isEmpty()) {
@ -51,7 +51,7 @@ public class EntitySnowman extends EntityGolem {
if (this.attackTicks == 0) {
EntitySnowball entitysnowball = new EntitySnowball(this.world, this);
double d2 = entity.locY + (double) entity.x() - 1.100000023841858D - entitysnowball.locY;
double d2 = entity.locY + (double) entity.y() - 1.100000023841858D - entitysnowball.locY;
float f1 = MathHelper.a(d0 * d0 + d1 * d1) * 0.2F;
this.world.makeSound(this, "random.bow", 1.0F, 1.0F / (this.random.nextFloat() * 0.4F + 0.8F));

Datei anzeigen

@ -14,7 +14,7 @@ public class EntitySpider extends EntityMonster {
super(world);
this.texture = "/mob/spider.png";
this.b(1.4F, 0.9F);
this.aY = 0.8F;
this.bb = 0.8F;
}
protected void b() {
@ -26,8 +26,8 @@ public class EntitySpider extends EntityMonster {
super.d();
}
public void w_() {
super.w_();
public void y_() {
super.y_();
if (!this.world.isStatic) {
this.a(this.positionChanged);
}
@ -138,7 +138,7 @@ public class EntitySpider extends EntityMonster {
}
public boolean r() {
return this.o_();
return this.u();
}
public void s() {}
@ -151,7 +151,7 @@ public class EntitySpider extends EntityMonster {
return mobeffect.getEffectId() == MobEffectList.POISON.id ? false : super.a(mobeffect);
}
public boolean o_() {
public boolean u() {
return (this.datawatcher.getByte(16) & 1) != 0;
}

Datei anzeigen

@ -75,7 +75,7 @@ public class EntitySquid extends EntityWaterAnimal {
return super.b(entityhuman);
}
public boolean az() {
public boolean aK() {
return this.world.a(this.boundingBox.grow(0.0D, -0.6000000238418579D, 0.0D), Material.WATER, this);
}
@ -93,7 +93,7 @@ public class EntitySquid extends EntityWaterAnimal {
}
}
if (this.az()) {
if (this.aK()) {
float f;
if (this.h < 3.1415927F) {
@ -111,7 +111,7 @@ public class EntitySquid extends EntityWaterAnimal {
this.n *= 0.99F;
}
if (!this.aj) {
if (!this.world.isStatic) {
this.motX = (double) (this.o * this.l);
this.motY = (double) (this.p * this.l);
this.motZ = (double) (this.q * this.l);
@ -124,7 +124,7 @@ public class EntitySquid extends EntityWaterAnimal {
this.a += (-((float) Math.atan2((double) f, this.motY)) * 180.0F / 3.1415927F - this.a) * 0.1F;
} else {
this.j = MathHelper.abs(MathHelper.sin(this.h)) * 3.1415927F * 0.25F;
if (!this.aj) {
if (!this.world.isStatic) {
this.motX = 0.0D;
this.motY -= 0.08D;
this.motY *= 0.9800000190734863D;
@ -140,10 +140,10 @@ public class EntitySquid extends EntityWaterAnimal {
}
protected void m_() {
++this.aS;
if (this.aS > 100) {
++this.aV;
if (this.aV > 100) {
this.o = this.p = this.q = 0.0F;
} else if (this.random.nextInt(50) == 0 || !this.bS || this.o == 0.0F && this.p == 0.0F && this.q == 0.0F) {
} else if (this.random.nextInt(50) == 0 || !this.bV || this.o == 0.0F && this.p == 0.0F && this.q == 0.0F) {
float f = this.random.nextFloat() * 3.1415927F * 2.0F;
this.o = MathHelper.cos(f) * 0.2F;
@ -151,7 +151,7 @@ public class EntitySquid extends EntityWaterAnimal {
this.q = MathHelper.sin(f) * 0.2F;
}
this.ak();
this.au();
}
public boolean g() {

Datei anzeigen

@ -16,7 +16,7 @@ public class EntityTNTPrimed extends Entity {
public EntityTNTPrimed(World world) {
super(world);
this.fuseTicks = 0;
this.bc = true;
this.bf = true;
this.b(0.98F, 0.98F);
this.height = this.length / 2.0F;
}
@ -45,7 +45,7 @@ public class EntityTNTPrimed extends Entity {
return !this.dead;
}
public void w_() {
public void y_() {
this.lastX = this.locX;
this.lastY = this.locY;
this.lastZ = this.locZ;

Datei anzeigen

@ -60,7 +60,7 @@ public class EntityTrackerEntry {
}
++this.t;
if (++this.l % this.c == 0 || this.tracker.cb) {
if (++this.l % this.c == 0 || this.tracker.ce) {
int i = MathHelper.floor(this.tracker.locX * 32.0D);
int j = MathHelper.floor(this.tracker.locY * 32.0D);
int k = MathHelper.floor(this.tracker.locZ * 32.0D);
@ -126,7 +126,7 @@ public class EntityTrackerEntry {
}
}
this.tracker.cb = false;
this.tracker.ce = false;
if (this.tracker.velocityChanged) {
// CraftBukkit start - create PlayerVelocity event
boolean cancelled = false;
@ -329,17 +329,17 @@ public class EntityTrackerEntry {
return new Packet23VehicleSpawn(this.tracker, 51);
} else {
if (this.tracker instanceof EntityFallingBlock) {
EntityFallingBlock entityfallingsand = (EntityFallingBlock) this.tracker;
EntityFallingBlock entityfallingblock = (EntityFallingBlock) this.tracker;
if (entityfallingsand.a == Block.SAND.id) {
if (entityfallingblock.a == Block.SAND.id) {
return new Packet23VehicleSpawn(this.tracker, 70);
}
if (entityfallingsand.a == Block.GRAVEL.id) {
if (entityfallingblock.a == Block.GRAVEL.id) {
return new Packet23VehicleSpawn(this.tracker, 71);
}
if (entityfallingsand.a == Block.DRAGON_EGG.id) {
if (entityfallingblock.a == Block.DRAGON_EGG.id) {
return new Packet23VehicleSpawn(this.tracker, 74);
}
}

Datei anzeigen

@ -73,8 +73,8 @@ public class EntityWeatherLighting extends EntityWeather {
}
}
public void w_() {
super.w_();
public void y_() {
super.y_();
if (this.lifeTicks == 2) {
this.world.makeSound(this.locX, this.locY, this.locZ, "ambient.weather.thunder", 10000.0F, 0.8F + this.random.nextFloat() * 0.2F);
this.world.makeSound(this.locX, this.locY, this.locZ, "random.explode", 2.0F, 0.5F + this.random.nextFloat() * 0.2F);

Datei anzeigen

@ -27,7 +27,7 @@ public class EntityWolf extends EntityAnimal {
super(world);
this.texture = "/mob/wolf.png";
this.b(0.8F, 0.8F);
this.aY = 1.1F;
this.bb = 1.1F;
}
public int getMaxHealth() {
@ -94,7 +94,7 @@ public class EntityWolf extends EntityAnimal {
protected void m_() {
super.m_();
if (!this.e && !this.D() && this.isTamed() && this.vehicle == null) {
if (!this.e && !this.E() && this.isTamed() && this.vehicle == null) {
EntityHuman entityhuman = this.world.a(this.getOwnerName());
if (entityhuman != null) {
@ -103,10 +103,10 @@ public class EntityWolf extends EntityAnimal {
if (f > 5.0F) {
this.c(entityhuman, f);
}
} else if (!this.az()) {
} else if (!this.aK()) {
this.setSitting(true);
}
} else if (this.target == null && !this.D() && !this.isTamed() && this.world.random.nextInt(100) == 0) {
} else if (this.target == null && !this.E() && !this.isTamed() && this.world.random.nextInt(100) == 0) {
List list = this.world.a(EntitySheep.class, AxisAlignedBB.b(this.locX, this.locY, this.locZ, this.locX + 1.0D, this.locY + 1.0D, this.locZ + 1.0D).grow(16.0D, 4.0D, 16.0D));
if (!list.isEmpty()) {
@ -124,7 +124,7 @@ public class EntityWolf extends EntityAnimal {
}
}
if (this.az()) {
if (this.aK()) {
this.setSitting(false);
}
@ -136,8 +136,8 @@ public class EntityWolf extends EntityAnimal {
public void d() {
super.d();
this.a = false;
if (this.al() && !this.D() && !this.isAngry()) {
Entity entity = this.am();
if (this.aw() && !this.E() && !this.isAngry()) {
Entity entity = this.ax();
if (entity instanceof EntityHuman) {
EntityHuman entityhuman = (EntityHuman) entity;
@ -147,13 +147,13 @@ public class EntityWolf extends EntityAnimal {
if (!this.isTamed() && itemstack.id == Item.BONE.id) {
this.a = true;
} else if (this.isTamed() && Item.byId[itemstack.id] instanceof ItemFood) {
this.a = ((ItemFood) Item.byId[itemstack.id]).p();
this.a = ((ItemFood) Item.byId[itemstack.id]).q();
}
}
}
}
if (!this.aj && this.g && !this.h && !this.D() && this.onGround) {
if (!this.world.isStatic && this.g && !this.h && !this.E() && this.onGround) {
this.h = true;
this.i = 0.0F;
this.j = 0.0F;
@ -161,8 +161,8 @@ public class EntityWolf extends EntityAnimal {
}
}
public void w_() {
super.w_();
public void y_() {
super.y_();
this.c = this.b;
if (this.a) {
this.b += (1.0F - this.b) * 0.4F;
@ -171,10 +171,10 @@ public class EntityWolf extends EntityAnimal {
}
if (this.a) {
this.aZ = 10;
this.bc = 10;
}
if (this.ay()) {
if (this.aJ()) {
this.g = true;
this.h = false;
this.i = 0.0F;
@ -207,12 +207,12 @@ public class EntityWolf extends EntityAnimal {
}
}
public float x() {
public float y() {
return this.length * 0.8F;
}
protected int q_() {
return this.isSitting() ? 20 : super.q_();
public int x() {
return this.isSitting() ? 20 : super.x();
}
private void c(Entity entity, float f) {
@ -236,7 +236,7 @@ public class EntityWolf extends EntityAnimal {
}
}
protected boolean w() {
protected boolean v() {
return this.isSitting() || this.h;
}
@ -386,9 +386,9 @@ public class EntityWolf extends EntityAnimal {
if (itemstack != null && Item.byId[itemstack.id] instanceof ItemFood) {
ItemFood itemfood = (ItemFood) Item.byId[itemstack.id];
if (itemfood.p() && this.datawatcher.getInt(18) < 20) {
if (itemfood.q() && this.datawatcher.getInt(18) < 20) {
--itemstack.count;
this.d(itemfood.n(), RegainReason.EATING); // CraftBukkit
this.d(itemfood.o(), RegainReason.EATING); // CraftBukkit
if (itemstack.count <= 0) {
entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null);
}
@ -400,7 +400,7 @@ public class EntityWolf extends EntityAnimal {
if (entityhuman.name.equalsIgnoreCase(this.getOwnerName())) {
if (!this.world.isStatic) {
this.setSitting(!this.isSitting());
this.aW = false;
this.aZ = false;
this.setPathEntity((PathEntity) null);
}

Datei anzeigen

@ -7,18 +7,27 @@ public class EntityZombie extends EntityMonster {
public EntityZombie(World world) {
super(world);
this.texture = "/mob/zombie.png";
this.aY = 0.5F;
this.bb = 0.5F;
this.damage = 4;
this.goalSelector.a(1, new PathfinderGoalFloat(this));
this.goalSelector.a(2, new PathfinderGoalMeleeAttack(this, world, 16.0F));
this.goalSelector.a(3, new PathfinderGoalRandomStroll(this));
this.goalSelector.a(4, new PathfinderGoalLookAtPlayer(this, world, 8.0F));
this.goalSelector.a(4, new PathfinderGoalRandomLookaround(this));
}
public int getMaxHealth() {
return 20;
}
protected int O() {
public int P() {
return 2;
}
protected boolean as() {
return false;
}
public void d() {
if (this.world.e() && !this.world.isStatic) {
float f = this.a(1.0F);

Datei anzeigen

@ -23,7 +23,7 @@ public class FoodMetaData {
}
public void a(ItemFood itemfood) {
this.a(itemfood.n(), itemfood.o());
this.a(itemfood.o(), itemfood.p());
}
public void a(EntityHuman entityhuman) {

Datei anzeigen

@ -36,7 +36,7 @@ public class ItemBoat extends Item {
if (movingobjectposition == null) {
return itemstack;
} else {
Vec3D vec3d2 = entityhuman.d(f);
Vec3D vec3d2 = entityhuman.e(f);
boolean flag = false;
float f9 = 1.0F;
List list = world.getEntities(entityhuman, entityhuman.boundingBox.a(vec3d2.a * d3, vec3d2.b * d3, vec3d2.c * d3).grow((double) f9, (double) f9, (double) f9));

Datei anzeigen

@ -128,7 +128,7 @@ public class ItemBucket extends Item {
}
// CraftBukkit end
if (world.worldProvider.d && this.a == Block.WATER.id) {
if (world.worldProvider.e && this.a == Block.WATER.id) {
world.makeSound(d0 + 0.5D, d1 + 0.5D, d2 + 0.5D, "random.fizz", 0.5F, 2.6F + (world.random.nextFloat() - world.random.nextFloat()) * 0.8F);
for (int l = 0; l < 8; ++l) {

Datei anzeigen

@ -15,7 +15,7 @@ public class ItemFishingRod extends Item {
int i = entityhuman.hookedFish.j();
itemstack.damage(i, entityhuman);
entityhuman.r_();
entityhuman.s_();
} else {
// CraftBukkit start
PlayerFishEvent playerFishEvent = new PlayerFishEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), null,PlayerFishEvent.State.FISHING);
@ -31,7 +31,7 @@ public class ItemFishingRod extends Item {
world.addEntity(new EntityFishingHook(world, entityhuman));
}
entityhuman.r_();
entityhuman.s_();
}
return itemstack;

Datei anzeigen

@ -6,20 +6,20 @@ public class ItemFood extends Item {
public final int a;
private final int b;
private final float bR;
private final boolean bS;
private boolean bT;
private int bU;
private final float bS;
private final boolean bT;
private boolean bU;
private int bV;
private int bW;
private float bX;
private int bX;
private float bY;
public ItemFood(int i, int j, float f, boolean flag) {
super(i);
this.a = 32;
this.b = j;
this.bS = flag;
this.bR = f;
this.bT = flag;
this.bS = f;
}
public ItemFood(int i, int j, boolean flag) {
@ -31,16 +31,16 @@ public class ItemFood extends Item {
// CraftBukkit start
int oldFoodLevel = entityhuman.getFoodData().foodLevel;
FoodLevelChangeEvent event = new FoodLevelChangeEvent(entityhuman.getBukkitEntity(), Math.min(this.n() + entityhuman.getFoodData().foodLevel, 20));
FoodLevelChangeEvent event = new FoodLevelChangeEvent(entityhuman.getBukkitEntity(), Math.min(this.o() + entityhuman.getFoodData().foodLevel, 20));
entityhuman.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
entityhuman.getFoodData().a(event.getFoodLevel() - oldFoodLevel, this.o());
entityhuman.getFoodData().a(event.getFoodLevel() - oldFoodLevel, this.p());
}
// CraftBukkit end
if (!world.isStatic && this.bU > 0 && world.random.nextFloat() < this.bX) {
entityhuman.addEffect(new MobEffect(this.bU, this.bV * 20, this.bW));
if (!world.isStatic && this.bV > 0 && world.random.nextFloat() < this.bY) {
entityhuman.addEffect(new MobEffect(this.bV, this.bW * 20, this.bX));
}
return itemstack;
@ -55,35 +55,35 @@ public class ItemFood extends Item {
}
public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) {
if (entityhuman.b(this.bT)) {
if (entityhuman.b(this.bU)) {
entityhuman.a(itemstack, this.c(itemstack));
}
return itemstack;
}
public int n() {
public int o() {
return this.b;
}
public float o() {
return this.bR;
}
public boolean p() {
public float p() {
return this.bS;
}
public boolean q() {
return this.bT;
}
public ItemFood a(int i, int j, int k, float f) {
this.bU = i;
this.bV = j;
this.bW = k;
this.bX = f;
this.bV = i;
this.bW = j;
this.bX = k;
this.bY = f;
return this;
}
public ItemFood q() {
this.bT = true;
public ItemFood r() {
this.bU = true;
return this;
}

Datei anzeigen

@ -221,14 +221,14 @@ public class ItemInWorldManager {
if (this.b()) {
((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.world));
} else {
ItemStack itemstack = this.player.P();
ItemStack itemstack = this.player.Q();
boolean flag1 = this.player.b(Block.byId[l]);
if (itemstack != null) {
itemstack.a(l, i, j, k, this.player);
if (itemstack.count == 0) {
itemstack.a(this.player);
this.player.Q();
this.player.R();
}
}

Datei anzeigen

@ -228,6 +228,10 @@ public final class ItemStack {
}
public static boolean equals(ItemStack itemstack, ItemStack itemstack1) {
return itemstack == null && itemstack1 == null ? true : (itemstack != null && itemstack1 != null ? (itemstack.tag == null && itemstack1.tag != null ? false : itemstack.tag == null || itemstack.tag.equals(itemstack1.tag)) : false);
}
public static boolean matches(ItemStack itemstack, ItemStack itemstack1) {
return itemstack == null && itemstack1 == null ? true : (itemstack != null && itemstack1 != null ? itemstack.d(itemstack1) : false);
}
@ -293,15 +297,11 @@ public final class ItemStack {
}
public void setTag(NBTTagCompound nbttagcompound) {
if (Item.byId[this.id].getMaxStackSize() != 1) {
throw new IllegalArgumentException("Cannot add tag data to a stackable item");
} else {
this.tag = nbttagcompound;
}
this.tag = nbttagcompound;
}
public boolean q() {
return !this.getItem().e(this) ? false : !this.hasEnchantments();
return !this.getItem().f(this) ? false : !this.hasEnchantments();
}
public void addEnchantment(Enchantment enchantment, int i) {

Datei anzeigen

@ -48,7 +48,7 @@ public class ItemWorldMap extends ItemWorldMapBase {
int i1 = MathHelper.floor(entity.locZ - (double) k) / i + short2 / 2;
int j1 = 128 / i;
if (world.worldProvider.e) {
if (world.worldProvider.f) {
j1 /= 2;
}
@ -82,7 +82,7 @@ public class ItemWorldMap extends ItemWorldMapBase {
int l4;
int i5;
if (world.worldProvider.e) {
if (world.worldProvider.f) {
l4 = i3 + j3 * 231871;
l4 = l4 * l4 * 31287121 + l4 * 11;
if ((l4 >> 20 & 1) == 0) {

Datei anzeigen

@ -0,0 +1,157 @@
package net.minecraft.server;
public class LongHashMap {
private transient LongHashMapEntry[] entries = new LongHashMapEntry[16];
private transient int count;
private int c = 12;
private final float d = 0.75F;
private transient volatile int e;
public LongHashMap() {}
private static int g(long i) {
return a((int) (i ^ i >>> 32));
}
private static int a(int i) {
i ^= i >>> 20 ^ i >>> 12;
return i ^ i >>> 7 ^ i >>> 4;
}
private static int a(int i, int j) {
return i & j - 1;
}
public int count() {
return this.count;
}
public Object getEntry(long i) {
int j = g(i);
for (LongHashMapEntry longhashmapentry = this.entries[a(j, this.entries.length)]; longhashmapentry != null; longhashmapentry = longhashmapentry.c) {
if (longhashmapentry.a == i) {
return longhashmapentry.b;
}
}
return null;
}
public boolean contains(long i) {
return this.c(i) != null;
}
final LongHashMapEntry c(long i) {
int j = g(i);
for (LongHashMapEntry longhashmapentry = this.entries[a(j, this.entries.length)]; longhashmapentry != null; longhashmapentry = longhashmapentry.c) {
if (longhashmapentry.a == i) {
return longhashmapentry;
}
}
return null;
}
public void put(long i, Object object) {
int j = g(i);
int k = a(j, this.entries.length);
for (LongHashMapEntry longhashmapentry = this.entries[k]; longhashmapentry != null; longhashmapentry = longhashmapentry.c) {
if (longhashmapentry.a == i) {
longhashmapentry.b = object;
}
}
++this.e;
this.a(j, i, object, k);
}
private void b(int i) {
LongHashMapEntry[] alonghashmapentry = this.entries;
int j = alonghashmapentry.length;
if (j == 1073741824) {
this.c = Integer.MAX_VALUE;
} else {
LongHashMapEntry[] alonghashmapentry1 = new LongHashMapEntry[i];
this.a(alonghashmapentry1);
this.entries = alonghashmapentry1;
this.c = (int) ((float) i * this.d);
}
}
private void a(LongHashMapEntry[] alonghashmapentry) {
LongHashMapEntry[] alonghashmapentry1 = this.entries;
int i = alonghashmapentry.length;
for (int j = 0; j < alonghashmapentry1.length; ++j) {
LongHashMapEntry longhashmapentry = alonghashmapentry1[j];
if (longhashmapentry != null) {
alonghashmapentry1[j] = null;
LongHashMapEntry longhashmapentry1;
do {
longhashmapentry1 = longhashmapentry.c;
int k = a(longhashmapentry.d, i);
longhashmapentry.c = alonghashmapentry[k];
alonghashmapentry[k] = longhashmapentry;
longhashmapentry = longhashmapentry1;
} while (longhashmapentry1 != null);
}
}
}
public Object remove(long i) {
LongHashMapEntry longhashmapentry = this.e(i);
return longhashmapentry == null ? null : longhashmapentry.b;
}
final LongHashMapEntry e(long i) {
int j = g(i);
int k = a(j, this.entries.length);
LongHashMapEntry longhashmapentry = this.entries[k];
LongHashMapEntry longhashmapentry1;
LongHashMapEntry longhashmapentry2;
for (longhashmapentry1 = longhashmapentry; longhashmapentry1 != null; longhashmapentry1 = longhashmapentry2) {
longhashmapentry2 = longhashmapentry1.c;
if (longhashmapentry1.a == i) {
++this.e;
--this.count;
if (longhashmapentry == longhashmapentry1) {
this.entries[k] = longhashmapentry2;
} else {
longhashmapentry.c = longhashmapentry2;
}
return longhashmapentry1;
}
longhashmapentry = longhashmapentry1;
}
return longhashmapentry1;
}
private void a(int i, long j, Object object, int k) {
LongHashMapEntry longhashmapentry = this.entries[k];
this.entries[k] = new LongHashMapEntry(i, j, object, longhashmapentry);
if (this.count++ >= this.c) {
this.b(2 * this.entries.length);
}
}
static int f(long i) {
return g(i);
}
}

Datei anzeigen

@ -40,8 +40,8 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
public static Logger log = Logger.getLogger("Minecraft");
public static HashMap trackerList = new HashMap();
private String s;
private int t;
private String t;
private int u;
public NetworkListenThread networkListenThread;
public PropertyManager propertyManager;
// public WorldServer[] worldServer; // CraftBukkit - removed!
@ -54,16 +54,17 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
int ticks = 0;
public String k;
public int l;
private List w = new ArrayList();
private List x = Collections.synchronizedList(new ArrayList());
private List x = new ArrayList();
private List y = Collections.synchronizedList(new ArrayList());
// public EntityTracker[] tracker = new EntityTracker[3]; // CraftBukkit - removed!
public boolean onlineMode;
public boolean spawnAnimals;
public boolean spawnNPCs;
public boolean pvpMode;
public boolean allowFlight;
public String r;
private RemoteStatusListener y;
private RemoteControlListener z;
public String s;
private RemoteStatusListener z;
private RemoteControlListener A;
// CraftBukkit start
public List<WorldServer> worlds = new ArrayList<WorldServer>();
@ -110,24 +111,25 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
log.info("Loading properties");
this.propertyManager = new PropertyManager(this.options); // CraftBukkit - CLI argument support
this.s = this.propertyManager.getString("server-ip", "");
this.t = this.propertyManager.getString("server-ip", "");
this.onlineMode = this.propertyManager.getBoolean("online-mode", true);
this.spawnAnimals = this.propertyManager.getBoolean("spawn-animals", true);
this.spawnNPCs = this.propertyManager.getBoolean("spawn-npcs", true);
this.pvpMode = this.propertyManager.getBoolean("pvp", true);
this.allowFlight = this.propertyManager.getBoolean("allow-flight", false);
this.r = this.propertyManager.getString("motd", "A Minecraft Server");
this.r.replace('\u00a7', '$');
this.s = this.propertyManager.getString("motd", "A Minecraft Server");
this.s.replace('\u00a7', '$');
InetAddress inetaddress = null;
if (this.s.length() > 0) {
inetaddress = InetAddress.getByName(this.s);
if (this.t.length() > 0) {
inetaddress = InetAddress.getByName(this.t);
}
this.t = this.propertyManager.getInt("server-port", 25565);
log.info("Starting Minecraft server on " + (this.s.length() == 0 ? "*" : this.s) + ":" + this.t);
this.u = this.propertyManager.getInt("server-port", 25565);
log.info("Starting Minecraft server on " + (this.t.length() == 0 ? "*" : this.t) + ":" + this.u);
try {
this.networkListenThread = new NetworkListenThread(this, inetaddress, this.t);
this.networkListenThread = new NetworkListenThread(this, inetaddress, this.u);
} catch (Throwable ioexception) { // CraftBukkit - IOException -> Throwable
log.warning("**** FAILED TO BIND TO PORT!");
log.log(Level.WARNING, "The exception was: " + ioexception.toString());
@ -147,6 +149,7 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
long i = System.nanoTime();
String s = this.propertyManager.getString("level-name", "world");
String s1 = this.propertyManager.getString("level-seed", "");
String s2 = this.propertyManager.getString("level-type", "DEFAULT");
long j = (new Random()).nextLong();
if (s1.length() > 0) {
@ -161,8 +164,14 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
}
}
WorldType worldtype = WorldType.a(s2);
if (worldtype == null) {
worldtype = WorldType.NORMAL;
}
log.info("Preparing level \"" + s + "\"");
this.a(new WorldLoaderServer(new File(".")), s, j);
this.a(new WorldLoaderServer(new File(".")), s, j, worldtype);
// CraftBukkit start - display seconds for the completion time
long elapsed = System.nanoTime() - i;
@ -172,14 +181,14 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
if (this.propertyManager.getBoolean("enable-query", false)) {
log.info("Starting GS4 status listener");
this.y = new RemoteStatusListener(this);
this.y.a();
this.z = new RemoteStatusListener(this);
this.z.a();
}
if (this.propertyManager.getBoolean("enable-rcon", false)) {
log.info("Starting remote control listener");
this.z = new RemoteControlListener(this);
this.z.a();
this.A = new RemoteControlListener(this);
this.A.a();
this.remoteConsole = new CraftRemoteConsoleCommandSender();
}
@ -195,7 +204,7 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
return true;
}
private void a(Convertable convertable, String s, long i) {
private void a(Convertable convertable, String s, long i, WorldType worldtype) {
if (convertable.isConvertable(s)) {
log.info("Converting map!");
convertable.convert(s, new ConvertProgressUpdater(this));
@ -234,7 +243,7 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
String name = (dimension == 0) ? s : s + "_" + worldType;
ChunkGenerator gen = this.server.getGenerator(name);
WorldSettings settings = new WorldSettings(i, j, true, false);
WorldSettings settings = new WorldSettings(i, j, true, false, worldtype);
if (k == 0) {
world = new WorldServer(this, new ServerNBTManager(server.getWorldContainer(), s, true), s, dimension, settings, org.bukkit.World.Environment.getEnvironment(dimension), gen); // CraftBukkit
@ -291,37 +300,37 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
// CraftBukkit start
for (int i1 = 0; i1 < this.worlds.size(); ++i1) {
// if (i1 == 0 || this.propertyManager.getBoolean("allow-nether", true)) {
WorldServer worldserver = this.worlds.get(i1);
log.info("Preparing start region for level " + i1 + " (Seed: " + worldserver.getSeed() + ")");
if (worldserver.getWorld().getKeepSpawnInMemory()) {
// CraftBukkit end
ChunkCoordinates chunkcoordinates = worldserver.getSpawn();
if (!worldserver.getWorld().getKeepSpawnInMemory()) {
continue;
}
// CraftBukkit end
ChunkCoordinates chunkcoordinates = worldserver.getSpawn();
for (int j1 = -short1; j1 <= short1 && this.isRunning; j1 += 16) {
for (int k1 = -short1; k1 <= short1 && this.isRunning; k1 += 16) {
long l1 = System.currentTimeMillis();
for (int j1 = -short1; j1 <= short1 && this.isRunning; j1 += 16) {
for (int k1 = -short1; k1 <= short1 && this.isRunning; k1 += 16) {
long l1 = System.currentTimeMillis();
if (l1 < l) {
l = l1;
}
if (l1 < l) {
l = l1;
}
if (l1 > l + 1000L) {
int i2 = (short1 * 2 + 1) * (short1 * 2 + 1);
int j2 = (j1 + short1) * (short1 * 2 + 1) + k1 + 1;
if (l1 > l + 1000L) {
int i2 = (short1 * 2 + 1) * (short1 * 2 + 1);
int j2 = (j1 + short1) * (short1 * 2 + 1) + k1 + 1;
this.b("Preparing spawn area", j2 * 100 / i2);
l = l1;
}
this.b("Preparing spawn area", j2 * 100 / i2);
l = l1;
}
worldserver.chunkProviderServer.getChunkAt(chunkcoordinates.x + j1 >> 4, chunkcoordinates.z + k1 >> 4);
worldserver.chunkProviderServer.getChunkAt(chunkcoordinates.x + j1 >> 4, chunkcoordinates.z + k1 >> 4);
while (worldserver.updateLights() && this.isRunning) {
;
}
while (worldserver.updateLights() && this.isRunning) {
;
}
}
} // CraftBukkit
}
}
// CraftBukkit start
@ -379,13 +388,13 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
this.serverConfigurationManager.savePlayers();
}
// CraftBukkit start - multiworld is handled in saveChunks() already.
WorldServer worldserver = this.worlds.get(0);
// for (int i = 0; i < this.worldServer.length; ++i) { // CraftBukkit - multiworld is handled in saveChunks() already.
WorldServer worldserver = this.worlds.get(0); // CraftBukkit
if (worldserver != null) {
this.saveChunks();
}
// CraftBukkit end
if (worldserver != null) {
this.saveChunks();
}
// } // CraftBukkit
}
public void safeShutdown() {
@ -531,8 +540,8 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
}
// CraftBukkit end
for (k = 0; k < this.w.size(); ++k) {
((IUpdatePlayerListBox) this.w.get(k)).a();
for (k = 0; k < this.x.size(); ++k) {
((IUpdatePlayerListBox) this.x.get(k)).a();
}
try {
@ -545,12 +554,12 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
}
public void issueCommand(String s, ICommandListener icommandlistener) {
this.x.add(new ServerCommand(s, icommandlistener));
this.y.add(new ServerCommand(s, icommandlistener));
}
public void b() {
while (this.x.size() > 0) {
ServerCommand servercommand = (ServerCommand) this.x.remove(0);
while (this.y.size() > 0) {
ServerCommand servercommand = (ServerCommand) this.y.remove(0);
// CraftBukkit start - ServerCommand for preprocessing
ServerCommandEvent event = new ServerCommandEvent(Event.Type.SERVER_COMMAND, this.console, servercommand.command);
@ -564,7 +573,7 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
}
public void a(IUpdatePlayerListBox iupdateplayerlistbox) {
this.w.add(iupdateplayerlistbox);
this.x.add(iupdateplayerlistbox);
}
public static void main(final OptionSet options) { // CraftBukkit - replaces main(String args[])
@ -636,19 +645,19 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
}
public String getMotd() {
return this.s;
}
public int getPort() {
return this.t;
}
public int getPort() {
return this.u;
}
public String getServerAddress() {
return this.r;
return this.s;
}
public String getVersion() {
return "1.0.1";
return "1.1";
}
public int getPlayerCount() {

Datei anzeigen

@ -69,8 +69,8 @@ public class NetLoginHandler extends NetHandler {
public void a(Packet1Login packet1login) {
this.g = packet1login.name;
if (packet1login.a != 22) {
if (packet1login.a > 22) {
if (packet1login.a != 23) {
if (packet1login.a > 23) {
this.disconnect("Outdated server!");
} else {
this.disconnect("Outdated client!");
@ -104,7 +104,7 @@ public class NetLoginHandler extends NetHandler {
if (maxPlayers > 60) {
maxPlayers = 60;
}
netserverhandler.sendPacket(new Packet1Login("", entityplayer.id, worldserver.getSeed(), entityplayer.itemInWorldManager.getGameMode(), (byte) worldserver.worldProvider.dimension, (byte) worldserver.difficulty, (byte) worldserver.height, (byte) maxPlayers));
netserverhandler.sendPacket(new Packet1Login("", entityplayer.id, worldserver.getSeed(), worldserver.getWorldData().getType(), entityplayer.itemInWorldManager.getGameMode(), (byte) worldserver.worldProvider.dimension, (byte) worldserver.difficulty, (byte) worldserver.height, (byte) maxPlayers));
// CraftBukkit end
netserverhandler.sendPacket(new Packet6SpawnPosition(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z));
@ -137,7 +137,7 @@ public class NetLoginHandler extends NetHandler {
if (this.networkManager.f() == null) return; // CraftBukkit - fix NPE when a client queries a server that is unable to handle it.
try {
// CraftBukkit start
ServerListPingEvent pingEvent = CraftEventFactory.callServerListPingEvent(this.server.server, getSocket().getInetAddress(), this.server.r, this.server.serverConfigurationManager.getPlayerCount(), this.server.serverConfigurationManager.getMaxPlayers());
ServerListPingEvent pingEvent = CraftEventFactory.callServerListPingEvent(this.server.server, getSocket().getInetAddress(), this.server.s, this.server.serverConfigurationManager.getPlayerCount(), this.server.serverConfigurationManager.getMaxPlayers());
String s = pingEvent.getMotd() + "\u00A7" + this.server.serverConfigurationManager.getPlayerCount() + "\u00A7" + pingEvent.getMaxPlayers();
// CraftBukkit end

Datei anzeigen

@ -46,11 +46,12 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
private long j;
private static Random k = new Random();
private long l;
private int m = 0;
private double x;
private double y;
private double z;
private boolean checkMovement = true;
private IntHashMap q = new IntHashMap();
private IntHashMap r = new IntHashMap();
public NetServerHandler(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) {
this.minecraftServer = minecraftserver;
@ -97,40 +98,42 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
this.i = k.nextInt();
this.sendPacket(new Packet0KeepAlive(this.i));
}
if (this.m > 0) {
--this.m;
}
}
public void disconnect(String s) {
// CraftBukkit start
String leaveMessage = "\u00A7e" + this.player.name + " left the game.";
if (!this.disconnected) {
// CraftBukkit start
String leaveMessage = "\u00A7e" + this.player.name + " left the game.";
PlayerKickEvent event = new PlayerKickEvent(this.server.getPlayer(this.player), s, leaveMessage);
this.server.getPluginManager().callEvent(event);
PlayerKickEvent event = new PlayerKickEvent(this.server.getPlayer(this.player), s, leaveMessage);
this.server.getPluginManager().callEvent(event);
if (event.isCancelled()) {
// Do not kick the player
return;
if (event.isCancelled()) {
// Do not kick the player
return;
}
// Send the possibly modified leave message
s = event.getReason();
// CraftBukkit end
this.player.F();
this.sendPacket(new Packet255KickDisconnect(s));
this.networkManager.d();
// CraftBukkit start
leaveMessage = event.getLeaveMessage();
if (leaveMessage != null) {
this.minecraftServer.serverConfigurationManager.sendAll(new Packet3Chat(leaveMessage));
}
// CraftBukkit end
this.minecraftServer.serverConfigurationManager.disconnect(this.player);
this.disconnected = true;
}
// Send the possibly modified leave message
s = event.getReason();
// CraftBukkit end
this.player.E();
this.sendPacket(new Packet255KickDisconnect(s));
this.networkManager.d();
// CraftBukkit start
leaveMessage = event.getLeaveMessage();
if (leaveMessage != null) {
this.minecraftServer.serverConfigurationManager.sendAll(new Packet3Chat(leaveMessage));
}
// CraftBukkit end
this.minecraftServer.serverConfigurationManager.disconnect(this.player);
this.disconnected = true;
}
public void a(Packet27PlayerInput packet27playerinput) {
this.player.a(packet27playerinput.c(), packet27playerinput.e(), packet27playerinput.g(), packet27playerinput.h(), packet27playerinput.d(), packet27playerinput.f());
}
public void a(Packet10Flying packet10flying) {
@ -305,7 +308,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
}
this.player.a(true);
this.player.bL = 0.0F;
this.player.bO = 0.0F;
this.player.setLocation(this.x, this.y, this.z, f2, f3);
if (!this.checkMovement) {
return;
@ -452,9 +455,9 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
}
}
// CraftBukkit end
this.player.N();
this.player.O();
} else if (packet14blockdig.e == 5) {
this.player.I();
this.player.J();
} else {
boolean flag = worldserver.weirdIsOpCache = worldserver.dimension != 0 || this.minecraftServer.serverConfigurationManager.isOp(this.player.name); // CraftBukkit
boolean flag1 = false;
@ -635,7 +638,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
this.player.activeContainer.a();
this.player.h = false;
// CraftBukkit - TODO CHECK IF NEEDED -- new if structure might not need 'always'. Kept it in for now, but may be able to remove in future
if (!ItemStack.equals(this.player.inventory.getItemInHand(), packet15place.itemstack) || always) {
if (!ItemStack.matches(this.player.inventory.getItemInHand(), packet15place.itemstack) || always) {
this.sendPacket(new Packet103SetSlot(this.player.activeContainer.windowId, slot.c, this.player.inventory.getItemInHand()));
}
}
@ -706,7 +709,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
s = s.trim();
for (int i = 0; i < s.length(); ++i) {
if (SharedConstants.allowedCharacters.indexOf(s.charAt(i)) < 0) {
if (SharedConstants.allowedCharacters.indexOf(s.charAt(i)) < 0 && s.charAt(i) < 32) {
this.disconnect("Illegal characters in chat");
return;
}
@ -736,11 +739,16 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
for (Player recipient : event.getRecipients()) {
recipient.sendMessage(s);
}
// CraftBukkit end
}
this.m += 20;
if (this.m > 200) {
this.disconnect("disconnect.spam");
}
}
return false;
// CraftBukkit end
return false; // CraftBukkit
}
private void handleCommand(String s) {
@ -833,7 +841,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
if (event.isCancelled()) return;
// CraftBukkit end
this.player.r_();
this.player.s_();
}
}
@ -948,7 +956,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
public void a(Packet101CloseWindow packet101closewindow) {
if (this.player.dead) return; // CraftBukkit
this.player.D();
this.player.E();
}
public void a(Packet102WindowClick packet102windowclick) {
@ -957,14 +965,14 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
if (this.player.activeContainer.windowId == packet102windowclick.a && this.player.activeContainer.c(this.player)) {
ItemStack itemstack = this.player.activeContainer.a(packet102windowclick.b, packet102windowclick.c, packet102windowclick.f, this.player);
if (ItemStack.equals(packet102windowclick.e, itemstack)) {
if (ItemStack.matches(packet102windowclick.e, itemstack)) {
this.player.netServerHandler.sendPacket(new Packet106Transaction(packet102windowclick.a, packet102windowclick.d, true));
this.player.h = true;
this.player.activeContainer.a();
this.player.C();
this.player.D();
this.player.h = false;
} else {
this.q.a(this.player.activeContainer.windowId, Short.valueOf(packet102windowclick.d));
this.r.a(this.player.activeContainer.windowId, Short.valueOf(packet102windowclick.d));
this.player.netServerHandler.sendPacket(new Packet106Transaction(packet102windowclick.a, packet102windowclick.d, false));
this.player.activeContainer.a(this.player, false);
ArrayList arraylist = new ArrayList();
@ -1009,7 +1017,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
public void a(Packet106Transaction packet106transaction) {
if (this.player.dead) return; // CraftBukkit
Short oshort = (Short) this.q.a(this.player.activeContainer.windowId);
Short oshort = (Short) this.r.a(this.player.activeContainer.windowId);
if (oshort != null && packet106transaction.b == oshort.shortValue() && this.player.activeContainer.windowId == packet106transaction.a && !this.player.activeContainer.c(this.player)) {
this.player.activeContainer.a(this.player, true);

Datei anzeigen

@ -237,10 +237,12 @@ public class NetworkManager {
}
public void d() {
this.a();
this.q = true;
this.s.interrupt();
(new NetworkMonitorThread(this)).start();
if (!this.q) {
this.a();
this.q = true;
this.s.interrupt();
(new NetworkMonitorThread(this)).start();
}
}
public int e() {

Datei anzeigen

@ -148,7 +148,7 @@ public abstract class Packet {
short short2 = datainputstream.readShort();
itemstack = new ItemStack(short1, b0, short2);
if (Item.byId[short1].g()) {
if (Item.byId[short1].g() || Item.byId[short1].i()) {
itemstack.tag = this.c(datainputstream);
}
}
@ -163,7 +163,7 @@ public abstract class Packet {
dataoutputstream.writeShort(itemstack.id);
dataoutputstream.writeByte(itemstack.count);
dataoutputstream.writeShort(itemstack.getData());
if (itemstack.getItem().g()) {
if (itemstack.getItem().g() || itemstack.getItem().i()) {
this.a(itemstack.tag, dataoutputstream);
}
}
@ -221,7 +221,6 @@ public abstract class Packet {
a(24, true, false, Packet24MobSpawn.class);
a(25, true, false, Packet25EntityPainting.class);
a(26, true, false, Packet26AddExpOrb.class);
a(27, false, false, Packet27PlayerInput.class); // CraftBukkit - true -> false; disabled unused packet. TODO -- check if needed
a(28, true, false, Packet28EntityVelocity.class);
a(29, true, false, Packet29DestroyEntity.class);
a(30, true, false, Packet30Entity.class);
@ -257,6 +256,7 @@ public abstract class Packet {
a(131, true, false, Packet131ItemData.class);
a(200, true, false, Packet200Statistic.class);
a(201, true, false, Packet201PlayerInfo.class);
a(250, true, true, Packet250CustomPayload.class);
a(254, false, true, Packet254GetInfo.class);
a(255, true, true, Packet255KickDisconnect.class);
}

Datei anzeigen

@ -34,6 +34,6 @@ public class Packet3Chat extends Packet {
}
public int a() {
return this.message.length();
return 2 + this.message.length() * 2;
}
}

Datei anzeigen

@ -162,14 +162,10 @@ class PlayerInstance {
this.sendAll(new Packet52MultiBlockChange(this.chunkX, this.chunkZ, this.dirtyBlocks, this.dirtyCount, worldserver));
for (i = 0; i < this.dirtyCount; ++i) {
// CraftBukkit start - Fixes TileEntity updates occurring upon a multi-block change; dirtyCount -> dirtyBlocks[i]
j = this.chunkX * 16 + (this.dirtyBlocks[i] >> 12 & 15);
k = this.dirtyBlocks[i] & 255;
l = this.chunkZ * 16 + (this.dirtyBlocks[i] >> 8 & 15);
// CraftBukkit end
if (Block.isTileEntity[worldserver.getTypeId(j, k, l)]) {
// System.out.println("Sending!"); // CraftBukkit
this.sendTileEntity(worldserver.getTileEntity(j, k, l));
}
}

Datei anzeigen

@ -43,7 +43,7 @@ public class PlayerInventory implements IInventory {
private int firstPartial(ItemStack itemstack) {
for (int i = 0; i < this.items.length; ++i) {
if (this.items[i] != null && this.items[i].id == itemstack.id && this.items[i].isStackable() && this.items[i].count < this.items[i].getMaxStackSize() && this.items[i].count < this.getMaxStackSize() && (!this.items[i].usesData() || this.items[i].getData() == itemstack.getData())) {
if (this.items[i] != null && this.items[i].id == itemstack.id && this.items[i].isStackable() && this.items[i].count < this.items[i].getMaxStackSize() && this.items[i].count < this.getMaxStackSize() && (!this.items[i].usesData() || this.items[i].getData() == itemstack.getData()) && ItemStack.equals(this.items[i], itemstack)) {
return i;
}
}
@ -104,6 +104,9 @@ public class PlayerInventory implements IInventory {
} else {
if (this.items[k] == null) {
this.items[k] = new ItemStack(i, 0, itemstack.getData());
if (itemstack.hasTag()) {
this.items[k].setTag((NBTTagCompound) itemstack.getTag().clone());
}
}
int l = j;

Datei anzeigen

@ -35,6 +35,14 @@ public class PlayerManager {
}
this.c.clear();
if (this.managedPlayers.isEmpty()) {
WorldServer worldserver = this.server.getWorldServer(this.e);
WorldProvider worldprovider = worldserver.worldProvider;
if (!worldprovider.c()) {
worldserver.chunkProviderServer.c();
}
}
}
private PlayerInstance a(int i, int j, boolean flag) {

Datei anzeigen

@ -279,7 +279,7 @@ public class ServerConfigurationManager {
// CraftBukkit start
byte actualDimension = (byte) (worldserver.getWorld().getEnvironment().getId());
entityplayer1.netServerHandler.sendPacket(new Packet9Respawn(actualDimension, (byte) worldserver.difficulty, worldserver.getSeed(), worldserver.height, entityplayer1.itemInWorldManager.getGameMode()));
entityplayer1.netServerHandler.sendPacket(new Packet9Respawn(actualDimension, (byte) worldserver.difficulty, worldserver.getSeed(), entityplayer1.world.getWorldData().getType(), worldserver.height, entityplayer.itemInWorldManager.getGameMode()));
entityplayer1.spawnIn(worldserver);
entityplayer1.dead = false;
entityplayer1.netServerHandler.teleport(new Location(worldserver.getWorld(), entityplayer1.locX, entityplayer1.locY, entityplayer1.locZ, entityplayer1.yaw, entityplayer1.pitch));
@ -705,7 +705,7 @@ public class ServerConfigurationManager {
public void updateClient(EntityPlayer entityplayer) {
entityplayer.updateInventory(entityplayer.defaultContainer);
entityplayer.s_();
entityplayer.t_();
entityplayer.lastSentExp = -1; // CraftBukkit
}

Datei anzeigen

@ -82,7 +82,7 @@ public class TileEntityMobSpawner extends TileEntity {
// CraftBukkit end
this.world.f(2004, this.x, this.y, this.z, 0);
entityliving.ah();
entityliving.ao();
this.e();
}
}

Datei anzeigen

@ -83,7 +83,7 @@ public class World implements IBlockAccess {
public boolean isStatic;
public WorldChunkManager getWorldChunkManager() {
return this.worldProvider.b;
return this.worldProvider.c;
}
// CraftBukkit start
@ -192,53 +192,57 @@ public class World implements IBlockAccess {
}
protected void c() {
this.isLoading = true;
WorldChunkManager worldchunkmanager = this.getWorldChunkManager();
List list = worldchunkmanager.a();
Random random = new Random(this.getSeed());
ChunkPosition chunkposition = worldchunkmanager.a(0, 0, 256, list, random);
int i = 0;
int j = this.height / 2;
int k = 0;
if (!this.worldProvider.c()) {
this.worldData.setSpawn(0, this.worldProvider.getSeaLevel(), 0);
} else {
this.isLoading = true;
WorldChunkManager worldchunkmanager = this.getWorldChunkManager();
List list = worldchunkmanager.a();
Random random = new Random(this.getSeed());
ChunkPosition chunkposition = worldchunkmanager.a(0, 0, 256, list, random);
int i = 0;
int j = this.worldProvider.getSeaLevel();
int k = 0;
// CraftBukkit start
if (this.generator != null) {
Random rand = new Random(this.getSeed());
Location spawn = this.generator.getFixedSpawnLocation(((WorldServer) this).getWorld(), rand);
// CraftBukkit start
if (this.generator != null) {
Random rand = new Random(this.getSeed());
Location spawn = this.generator.getFixedSpawnLocation(((WorldServer) this).getWorld(), rand);
if (spawn != null) {
if (spawn.getWorld() != ((WorldServer) this).getWorld()) {
throw new IllegalStateException("Cannot set spawn point for " + this.worldData.name + " to be in another world (" + spawn.getWorld().getName() + ")");
} else {
this.worldData.setSpawn(spawn.getBlockX(), spawn.getBlockY(), spawn.getBlockZ());
this.isLoading = false;
return;
if (spawn != null) {
if (spawn.getWorld() != ((WorldServer) this).getWorld()) {
throw new IllegalStateException("Cannot set spawn point for " + this.worldData.name + " to be in another world (" + spawn.getWorld().getName() + ")");
} else {
this.worldData.setSpawn(spawn.getBlockX(), spawn.getBlockY(), spawn.getBlockZ());
this.isLoading = false;
return;
}
}
}
}
// CraftBukkit end
// CraftBukkit end
if (chunkposition != null) {
i = chunkposition.x;
k = chunkposition.z;
} else {
System.out.println("Unable to find spawn biome");
}
int l = 0;
// CraftBukkit - use out own canSpawn
while (!this.canSpawn(i, k)) {
i += random.nextInt(64) - random.nextInt(64);
k += random.nextInt(64) - random.nextInt(64);
++l;
if (l == 1000) {
break;
if (chunkposition != null) {
i = chunkposition.x;
k = chunkposition.z;
} else {
System.out.println("Unable to find spawn biome");
}
}
this.worldData.setSpawn(i, j, k);
this.isLoading = false;
int l = 0;
// CraftBukkit - use out own canSpawn
while (!this.canSpawn(i, k)) {
i += random.nextInt(64) - random.nextInt(64);
k += random.nextInt(64) - random.nextInt(64);
++l;
if (l == 1000) {
break;
}
}
this.worldData.setSpawn(i, j, k);
this.isLoading = false;
}
}
public ChunkCoordinates d() {
@ -472,7 +476,7 @@ public class World implements IBlockAccess {
k = i1;
}
if (!this.worldProvider.e) {
if (!this.worldProvider.f) {
for (i1 = k; i1 <= l; ++i1) {
this.b(EnumSkyBlock.SKY, i, i1, j);
}
@ -652,7 +656,7 @@ public class World implements IBlockAccess {
}
public float m(int i, int j, int k) {
return this.worldProvider.f[this.getLightLevel(i, j, k)];
return this.worldProvider.g[this.getLightLevel(i, j, k)];
}
public boolean e() {
@ -945,10 +949,10 @@ public class World implements IBlockAccess {
this.everyoneSleeping();
}
int i = entity.bX;
int j = entity.bZ;
int i = entity.ca;
int j = entity.cc;
if (entity.bW && this.isChunkLoaded(i, j)) {
if (entity.bZ && this.isChunkLoaded(i, j)) {
this.getChunkAt(i, j).b(entity);
}
@ -1099,7 +1103,7 @@ public class World implements IBlockAccess {
continue;
}
// CraftBukkit end
entity.w_();
entity.y_();
if (entity.dead) {
this.j.remove(i--);
}
@ -1113,9 +1117,9 @@ public class World implements IBlockAccess {
for (i = 0; i < this.J.size(); ++i) {
entity = (Entity) this.J.get(i);
j = entity.bX;
k = entity.bZ;
if (entity.bW && this.isChunkLoaded(j, k)) {
j = entity.ca;
k = entity.cc;
if (entity.bZ && this.isChunkLoaded(j, k)) {
this.getChunkAt(j, k).b(entity);
}
}
@ -1144,9 +1148,9 @@ public class World implements IBlockAccess {
// MethodProfiler.a("remove"); // CraftBukkit - not in production code
if (entity.dead) {
j = entity.bX;
k = entity.bZ;
if (entity.bW && this.isChunkLoaded(j, k)) {
j = entity.ca;
k = entity.cc;
if (entity.bZ && this.isChunkLoaded(j, k)) {
this.getChunkAt(j, k).b(entity);
}
@ -1241,30 +1245,30 @@ public class World implements IBlockAccess {
byte b0 = 32;
if (!flag || this.a(i - b0, 0, j - b0, i + b0, this.height, j + b0)) {
entity.bI = entity.locX;
entity.bJ = entity.locY;
entity.bK = entity.locZ;
entity.bL = entity.locX;
entity.bM = entity.locY;
entity.bN = entity.locZ;
entity.lastYaw = entity.yaw;
entity.lastPitch = entity.pitch;
if (flag && entity.bW) {
if (flag && entity.bZ) {
if (entity.vehicle != null) {
entity.M();
entity.N();
} else {
entity.w_();
entity.y_();
}
}
// MethodProfiler.a("chunkCheck"); // CraftBukkit - not in production code
if (Double.isNaN(entity.locX) || Double.isInfinite(entity.locX)) {
entity.locX = entity.bI;
entity.locX = entity.bL;
}
if (Double.isNaN(entity.locY) || Double.isInfinite(entity.locY)) {
entity.locY = entity.bJ;
entity.locY = entity.bM;
}
if (Double.isNaN(entity.locZ) || Double.isInfinite(entity.locZ)) {
entity.locZ = entity.bK;
entity.locZ = entity.bN;
}
if (Double.isNaN((double) entity.pitch) || Double.isInfinite((double) entity.pitch)) {
@ -1279,21 +1283,21 @@ public class World implements IBlockAccess {
int l = MathHelper.floor(entity.locY / 16.0D);
int i1 = MathHelper.floor(entity.locZ / 16.0D);
if (!entity.bW || entity.bX != k || entity.bY != l || entity.bZ != i1) {
if (entity.bW && this.isChunkLoaded(entity.bX, entity.bZ)) {
this.getChunkAt(entity.bX, entity.bZ).a(entity, entity.bY);
if (!entity.bZ || entity.ca != k || entity.cb != l || entity.cc != i1) {
if (entity.bZ && this.isChunkLoaded(entity.ca, entity.cc)) {
this.getChunkAt(entity.ca, entity.cc).a(entity, entity.cb);
}
if (this.isChunkLoaded(k, i1)) {
entity.bW = true;
entity.bZ = true;
this.getChunkAt(k, i1).a(entity);
} else {
entity.bW = false;
entity.bZ = false;
}
}
// MethodProfiler.a(); // CraftBukkit - not in production code
if (flag && entity.bW && entity.passenger != null) {
if (flag && entity.bZ && entity.passenger != null) {
if (!entity.passenger.dead && entity.passenger.vehicle == entity) {
this.playerJoinedWorld(entity.passenger);
} else {
@ -1305,12 +1309,12 @@ public class World implements IBlockAccess {
}
public boolean containsEntity(AxisAlignedBB axisalignedbb) {
List list = this.getEntities(null, axisalignedbb);
List list = this.getEntities((Entity) null, axisalignedbb);
for (int i = 0; i < list.size(); ++i) {
Entity entity = (Entity) list.get(i);
if (!entity.dead && entity.bc) {
if (!entity.dead && entity.bf) {
return false;
}
}
@ -1753,7 +1757,7 @@ public class World implements IBlockAccess {
}
protected void i() {
if (!this.worldProvider.e) {
if (!this.worldProvider.f) {
if (this.r > 0) {
--this.r;
}
@ -1941,35 +1945,37 @@ public class World implements IBlockAccess {
}
// MethodProfiler.b("iceandsnow"); // CraftBukkit - not in production code
this.l = this.l * 3 + 1013904223;
l1 = this.l >> 2;
i2 = l1 & 15;
j2 = l1 >> 8 & 15;
k2 = this.e(i2 + k1, j2 + j);
if (this.q(i2 + k1, k2 - 1, j2 + j)) {
// CraftBukkit start
BlockState blockState = this.getWorld().getBlockAt(i2 + k1, k2 - 1, j2 + j).getState();
blockState.setTypeId(Block.ICE.id);
if (this.random.nextInt(16) == 0) {
this.l = this.l * 3 + 1013904223;
l1 = this.l >> 2;
i2 = l1 & 15;
j2 = l1 >> 8 & 15;
k2 = this.e(i2 + k1, j2 + j);
if (this.q(i2 + k1, k2 - 1, j2 + j)) {
// CraftBukkit start
BlockState blockState = this.getWorld().getBlockAt(i2 + k1, k2 - 1, j2 + j).getState();
blockState.setTypeId(Block.ICE.id);
BlockFormEvent iceBlockForm = new BlockFormEvent(blockState.getBlock(), blockState);
this.getServer().getPluginManager().callEvent(iceBlockForm);
if (!iceBlockForm.isCancelled()) {
blockState.update(true);
BlockFormEvent iceBlockForm = new BlockFormEvent(blockState.getBlock(), blockState);
this.getServer().getPluginManager().callEvent(iceBlockForm);
if (!iceBlockForm.isCancelled()) {
blockState.update(true);
}
// CraftBukkit end
}
// CraftBukkit end
}
if (this.w() && this.r(i2 + k1, k2, j2 + j)) {
// CraftBukkit start
BlockState blockState = this.getWorld().getBlockAt(i2 + k1, k2, j2 + j).getState();
blockState.setTypeId(Block.SNOW.id);
if (this.w() && this.r(i2 + k1, k2, j2 + j)) {
// CraftBukkit start
BlockState blockState = this.getWorld().getBlockAt(i2 + k1, k2, j2 + j).getState();
blockState.setTypeId(Block.SNOW.id);
BlockFormEvent snow = new BlockFormEvent(blockState.getBlock(), blockState);
this.getServer().getPluginManager().callEvent(snow);
if (!snow.isCancelled()) {
blockState.update(true);
BlockFormEvent snow = new BlockFormEvent(blockState.getBlock(), blockState);
this.getServer().getPluginManager().callEvent(snow);
if (!snow.isCancelled()) {
blockState.update(true);
}
// CraftBukkit end
}
// CraftBukkit end
}
// MethodProfiler.b("checkLight"); // CraftBukkit - not in production code
@ -2065,7 +2071,7 @@ public class World implements IBlockAccess {
}
public void s(int i, int j, int k) {
if (!this.worldProvider.e) {
if (!this.worldProvider.f) {
this.b(EnumSkyBlock.SKY, i, j, k);
}

Datei anzeigen

@ -5,6 +5,7 @@ import java.util.List;
public class WorldData {
private long seed;
private WorldType type;
private int spawnX;
private int spawnY;
private int spawnZ;
@ -21,10 +22,21 @@ public class WorldData {
private int thunderTicks;
private int gameType;
private boolean useMapFeatures;
private boolean hardcore = false;
private boolean hardcore;
public WorldData(NBTTagCompound nbttagcompound) {
this.type = WorldType.NORMAL;
this.hardcore = false;
this.seed = nbttagcompound.getLong("RandomSeed");
if (nbttagcompound.hasKey("generatorName")) {
String s = nbttagcompound.getString("generatorName");
this.type = WorldType.a(s);
if (this.type == null) {
this.type = WorldType.NORMAL;
}
}
this.gameType = nbttagcompound.getInt("GameType");
if (nbttagcompound.hasKey("MapFeatures")) {
this.useMapFeatures = nbttagcompound.getBoolean("MapFeatures");
@ -52,15 +64,21 @@ public class WorldData {
}
public WorldData(WorldSettings worldsettings, String s) {
this.type = WorldType.NORMAL;
this.hardcore = false;
this.seed = worldsettings.a();
this.gameType = worldsettings.b();
this.useMapFeatures = worldsettings.d();
this.name = s;
this.hardcore = worldsettings.c();
this.type = worldsettings.e();
}
public WorldData(WorldData worlddata) {
this.type = WorldType.NORMAL;
this.hardcore = false;
this.seed = worlddata.seed;
this.type = worlddata.type;
this.gameType = worlddata.gameType;
this.useMapFeatures = worlddata.useMapFeatures;
this.spawnX = worlddata.spawnX;
@ -107,6 +125,7 @@ public class WorldData {
private void a(NBTTagCompound nbttagcompound, NBTTagCompound nbttagcompound1) {
nbttagcompound.setLong("RandomSeed", this.seed);
nbttagcompound.setString("generatorName", this.type.name());
nbttagcompound.setInt("GameType", this.gameType);
nbttagcompound.setBoolean("MapFeatures", this.useMapFeatures);
nbttagcompound.setInt("SpawnX", this.spawnX);
@ -228,4 +247,8 @@ public class WorldData {
public boolean isHardcore() {
return this.hardcore;
}
public WorldType getType() {
return this.type;
}
}

Datei anzeigen

@ -102,6 +102,9 @@ public class WorldServer extends World implements BlockChangeDelegate {
entity.die();
}
// CraftBukkit end */
if (!this.server.spawnNPCs && entity instanceof NPC) {
entity.die();
}
if (entity.passenger == null || !(entity.passenger instanceof EntityHuman)) {
super.entityJoinedWorld(entity, flag);
@ -171,7 +174,7 @@ public class WorldServer extends World implements BlockChangeDelegate {
protected void c(Entity entity) {
super.c(entity);
this.N.a(entity.id, entity);
Entity[] aentity = entity.aG();
Entity[] aentity = entity.aR();
if (aentity != null) {
for (int i = 0; i < aentity.length; ++i) {
@ -183,7 +186,7 @@ public class WorldServer extends World implements BlockChangeDelegate {
protected void d(Entity entity) {
super.d(entity);
this.N.d(entity.id);
Entity[] aentity = entity.aG();
Entity[] aentity = entity.aR();
if (aentity != null) {
for (int i = 0; i < aentity.length; ++i) {

Datei anzeigen

@ -55,6 +55,7 @@ import net.minecraft.server.WorldMap;
import net.minecraft.server.WorldMapCollection;
import net.minecraft.server.WorldNBTStorage;
import net.minecraft.server.WorldSettings;
import net.minecraft.server.WorldType;
import org.bukkit.*;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.YamlConfiguration;
@ -512,6 +513,7 @@ public final class CraftServer implements Server {
ChunkGenerator generator = creator.generator();
File folder = new File(name);
World world = getWorld(name);
WorldType type = WorldType.a(creator.type().getName());
if (world != null) {
return world;
@ -533,7 +535,7 @@ public final class CraftServer implements Server {
int dimension = 10 + console.worlds.size();
boolean hardcore = false;
WorldServer internal = new WorldServer(console, new ServerNBTManager(getWorldContainer(), name, true), name, dimension, new WorldSettings(creator.seed(), getDefaultGameMode().getValue(), true, hardcore), creator.environment(), generator);
WorldServer internal = new WorldServer(console, new ServerNBTManager(getWorldContainer(), name, true), name, dimension, new WorldSettings(creator.seed(), getDefaultGameMode().getValue(), true, hardcore, type), creator.environment(), generator);
if (!(worlds.containsKey(name.toLowerCase()))) {
return null;

Datei anzeigen

@ -43,6 +43,8 @@ public class CraftEnchantment extends Enchantment {
return EnchantmentTarget.TOOL;
case WEAPON:
return EnchantmentTarget.WEAPON;
case BOW:
return EnchantmentTarget.BOW;
default:
return null;
}
@ -90,6 +92,14 @@ public class CraftEnchantment extends Enchantment {
return "DURABILITY";
case 35:
return "LOOT_BONUS_BLOCKS";
case 48:
return "ARROW_DAMAGE";
case 49:
return "ARROW_KNOCKBACK";
case 50:
return "ARROW_FIRE";
case 51:
return "ARROW_INFINITE";
default:
return "UNKNOWN_ENCHANT_" + target.id;
}

Datei anzeigen

@ -21,6 +21,10 @@ public class LongHashset extends LongHash {
}
}
public int size() {
return count;
}
public void add(int msw, int lsw) {
add(toLong(msw, lsw));
}