summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server/World.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/net/minecraft/server/World.java')
-rw-r--r--src/main/java/net/minecraft/server/World.java1023
1 files changed, 475 insertions, 548 deletions
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 3924a5cf..67247f60 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -44,46 +44,52 @@ public abstract class World implements IBlockAccess {
protected float o;
protected float p;
public int q;
- public boolean callingPlaceEvent = false; // CraftBukkit
- public int difficulty;
+ public EnumDifficulty difficulty;
public Random random = new Random();
public WorldProvider worldProvider; // CraftBukkit - remove final
protected List u = new ArrayList();
- public IChunkProvider chunkProvider; // CraftBukkit - protected -> public
+ public IChunkProvider chunkProvider; // CraftBukkit - public
protected final IDataManager dataManager;
- public WorldData worldData; // CraftBukkit - protected -> public
+ public WorldData worldData; // CraftBukkit - public
public boolean isLoading;
- public WorldMapCollection worldMaps;
- public final VillageCollection villages;
+ public PersistentCollection worldMaps;
+ public final PersistentVillage villages;
protected final VillageSiege siegeManager = new VillageSiege(this);
public final MethodProfiler methodProfiler;
private final Vec3DPool J = new Vec3DPool(300, 2000);
private final Calendar K = Calendar.getInstance();
public Scoreboard scoreboard = new Scoreboard(); // CraftBukkit - protected -> public
- private final IConsoleLogManager logAgent;
- private UnsafeList M = new UnsafeList(); // CraftBukkit - ArrayList -> UnsafeList
- private boolean N;
+ public boolean isStatic;
// CraftBukkit start - public, longhashset
- public boolean allowMonsters = true;
- public boolean allowAnimals = true;
protected LongHashSet chunkTickList = new LongHashSet();
+ private int L;
+ public boolean allowMonsters;
+ public boolean allowAnimals;
+ // Added the following
+ public boolean callingPlaceEvent = false;
public long ticksPerAnimalSpawns;
public long ticksPerMonsterSpawns;
// CraftBukkit end
- private int O;
- int[] H;
- public boolean isStatic;
+ private ArrayList M;
+ private boolean N;
+ int[] I;
public BiomeBase getBiome(int i, int j) {
if (this.isLoaded(i, 0, j)) {
Chunk chunk = this.getChunkAtWorldCoords(i, j);
- if (chunk != null) {
+ try {
return chunk.a(i & 15, j & 15, this.worldProvider.e);
+ } catch (Throwable throwable) {
+ CrashReport crashreport = CrashReport.a(throwable, "Getting biome");
+ CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Coordinates of biome request");
+
+ crashreportsystemdetails.a("Location", (Callable) (new CrashReportWorldLocation(this, i, j)));
+ throw new ReportedException(crashreport);
}
+ } else {
+ return this.worldProvider.e.getBiome(i, j);
}
-
- return this.worldProvider.e.getBiome(i, j);
}
public WorldChunkManager getWorldChunkManager() {
@@ -108,20 +114,22 @@ public abstract class World implements IBlockAccess {
return (CraftServer) Bukkit.getServer();
}
- // Changed signature
- public World(IDataManager idatamanager, String s, WorldSettings worldsettings, WorldProvider worldprovider, MethodProfiler methodprofiler, IConsoleLogManager iconsolelogmanager, ChunkGenerator gen, org.bukkit.World.Environment env) {
+ // Changed signature - added gen and env
+ public World(IDataManager idatamanager, String s, WorldSettings worldsettings, WorldProvider worldprovider, MethodProfiler methodprofiler, ChunkGenerator gen, org.bukkit.World.Environment env) {
this.generator = gen;
this.world = new CraftWorld((WorldServer) this, gen, env);
this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit
this.ticksPerMonsterSpawns = this.getServer().getTicksPerMonsterSpawns(); // CraftBukkit
// CraftBukkit end
- this.O = this.random.nextInt(12000);
- this.H = new int['\u8000'];
+ this.L = this.random.nextInt(12000);
+ this.allowMonsters = true;
+ this.allowAnimals = true;
+ this.M = new ArrayList();
+ this.I = new int['\u8000'];
this.dataManager = idatamanager;
this.methodProfiler = methodprofiler;
- this.worldMaps = new WorldMapCollection(idatamanager);
- this.logAgent = iconsolelogmanager;
+ this.worldMaps = new PersistentCollection(idatamanager);
this.worldData = idatamanager.getWorldData();
if (worldprovider != null) {
this.worldProvider = worldprovider;
@@ -157,13 +165,13 @@ public abstract class World implements IBlockAccess {
this.worldData.d(true);
}
- VillageCollection villagecollection = (VillageCollection) this.worldMaps.get(VillageCollection.class, "villages");
+ PersistentVillage persistentvillage = (PersistentVillage) this.worldMaps.get(PersistentVillage.class, "villages");
- if (villagecollection == null) {
- this.villages = new VillageCollection(this);
+ if (persistentvillage == null) {
+ this.villages = new PersistentVillage(this);
this.worldMaps.a("villages", this.villages);
} else {
- this.villages = villagecollection;
+ this.villages = persistentvillage;
this.villages.a(this);
}
@@ -179,56 +187,38 @@ public abstract class World implements IBlockAccess {
this.worldData.d(true);
}
- public int b(int i, int j) {
+ public Block b(int i, int j) {
int k;
for (k = 63; !this.isEmpty(i, k + 1, j); ++k) {
;
}
- return this.getTypeId(i, k, j);
+ return this.getType(i, k, j);
}
- public int getTypeId(int i, int j, int k) {
- if (i >= -30000000 && k >= -30000000 && i < 30000000 && k < 30000000) {
- if (j < 0) {
- return 0;
- } else if (j >= 256) {
- return 0;
- } else {
- Chunk chunk = null;
+ public Block getType(int i, int j, int k) {
+ if (i >= -30000000 && k >= -30000000 && i < 30000000 && k < 30000000 && j >= 0 && j < 256) {
+ Chunk chunk = null;
- try {
- chunk = this.getChunkAt(i >> 4, k >> 4);
- return chunk.getTypeId(i & 15, j, k & 15);
- } catch (Throwable throwable) {
- CrashReport crashreport = CrashReport.a(throwable, "Exception getting block type in world");
- CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Requested block coordinates");
-
- crashreportsystemdetails.a("Found chunk", Boolean.valueOf(chunk == null));
- crashreportsystemdetails.a("Location", CrashReportSystemDetails.a(i, j, k));
- throw new ReportedException(crashreport);
- }
+ try {
+ chunk = this.getChunkAt(i >> 4, k >> 4);
+ return chunk.getType(i & 15, j, k & 15);
+ } catch (Throwable throwable) {
+ CrashReport crashreport = CrashReport.a(throwable, "Exception getting block type in world");
+ CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Requested block coordinates");
+
+ crashreportsystemdetails.a("Found chunk", Boolean.valueOf(chunk == null));
+ crashreportsystemdetails.a("Location", CrashReportSystemDetails.a(i, j, k));
+ throw new ReportedException(crashreport);
}
} else {
- return 0;
+ return Blocks.AIR;
}
}
public boolean isEmpty(int i, int j, int k) {
- return this.getTypeId(i, j, k) == 0;
- }
-
- public boolean isTileEntity(int i, int j, int k) {
- int l = this.getTypeId(i, j, k);
-
- return Block.byId[l] != null && Block.byId[l].t();
- }
-
- public int e(int i, int j, int k) {
- int l = this.getTypeId(i, j, k);
-
- return Block.byId[l] != null ? Block.byId[l].d() : -1;
+ return this.getType(i, j, k).getMaterial() == Material.AIR;
}
public boolean isLoaded(int i, int j, int k) {
@@ -236,10 +226,10 @@ public abstract class World implements IBlockAccess {
}
public boolean areChunksLoaded(int i, int j, int k, int l) {
- return this.e(i - l, j - l, k - l, i + l, j + l, k + l);
+ return this.b(i - l, j - l, k - l, i + l, j + l, k + l);
}
- public boolean e(int i, int j, int k, int l, int i1, int j1) {
+ public boolean b(int i, int j, int k, int l, int i1, int j1) {
if (i1 >= 0 && j < 256) {
i >>= 4;
k >>= 4;
@@ -269,8 +259,8 @@ public abstract class World implements IBlockAccess {
return this.getChunkAt(i >> 4, j >> 4);
}
- // CraftBukkit start
public Chunk getChunkAt(int i, int j) {
+ // CraftBukkit start
Chunk result = null;
synchronized (this.chunkLock) {
if (this.lastChunkAccessed == null || this.lastXAccessed != i || this.lastZAccessed != j) {
@@ -281,10 +271,10 @@ public abstract class World implements IBlockAccess {
result = this.lastChunkAccessed;
}
return result;
+ // CraftBukkit end
}
- // CraftBukkit end
- public boolean setTypeIdAndData(int i, int j, int k, int l, int i1, int j1) {
+ public boolean setTypeAndData(int i, int j, int k, Block block, int l, int i1) {
if (i >= -30000000 && k >= -30000000 && i < 30000000 && k < 30000000) {
if (j < 0) {
return false;
@@ -292,28 +282,26 @@ public abstract class World implements IBlockAccess {
return false;
} else {
Chunk chunk = this.getChunkAt(i >> 4, k >> 4);
- int k1 = 0;
+ Block block1 = null;
- if ((j1 & 1) != 0) {
- k1 = chunk.getTypeId(i & 15, j, k & 15);
+ if ((i1 & 1) != 0) {
+ block1 = chunk.getType(i & 15, j, k & 15);
}
- boolean flag = chunk.a(i & 15, j, k & 15, l, i1);
+ boolean flag = chunk.a(i & 15, j, k & 15, block, l);
this.methodProfiler.a("checkLight");
- this.A(i, j, k);
+ this.t(i, j, k);
this.methodProfiler.b();
if (flag) {
- if ((j1 & 2) != 0 && (!this.isStatic || (j1 & 4) == 0)) {
+ if ((i1 & 2) != 0 && (!this.isStatic || (i1 & 4) == 0) && chunk.k()) {
this.notify(i, j, k);
}
- if (!this.isStatic && (j1 & 1) != 0) {
- this.update(i, j, k, k1);
- Block block = Block.byId[l];
-
- if (block != null && block.q_()) {
- this.m(i, j, k, l);
+ if (!this.isStatic && (i1 & 1) != 0) {
+ this.update(i, j, k, block1);
+ if (block.M()) {
+ this.f(i, j, k, block);
}
}
}
@@ -325,12 +313,6 @@ public abstract class World implements IBlockAccess {
}
}
- public Material getMaterial(int i, int j, int k) {
- int l = this.getTypeId(i, j, k);
-
- return l == 0 ? Material.AIR : Block.byId[l].material;
- }
-
public int getData(int i, int j, int k) {
if (i >= -30000000 && k >= -30000000 && i < 30000000 && k < 30000000) {
if (j < 0) {
@@ -359,21 +341,19 @@ public abstract class World implements IBlockAccess {
Chunk chunk = this.getChunkAt(i >> 4, k >> 4);
int j1 = i & 15;
int k1 = k & 15;
- boolean flag = chunk.b(j1, j, k1, l);
+ boolean flag = chunk.a(j1, j, k1, l);
if (flag) {
- int l1 = chunk.getTypeId(j1, j, k1);
+ Block block = chunk.getType(j1, j, k1);
- if ((i1 & 2) != 0 && (!this.isStatic || (i1 & 4) == 0)) {
+ if ((i1 & 2) != 0 && (!this.isStatic || (i1 & 4) == 0) && chunk.k()) {
this.notify(i, j, k);
}
if (!this.isStatic && (i1 & 1) != 0) {
- this.update(i, j, k, l1);
- Block block = Block.byId[l1];
-
- if (block != null && block.q_()) {
- this.m(i, j, k, l1);
+ this.update(i, j, k, block);
+ if (block.M()) {
+ this.f(i, j, k, block);
}
}
}
@@ -386,28 +366,28 @@ public abstract class World implements IBlockAccess {
}
public boolean setAir(int i, int j, int k) {
- return this.setTypeIdAndData(i, j, k, 0, 0, 3);
+ return this.setTypeAndData(i, j, k, Blocks.AIR, 0, 3);
}
public boolean setAir(int i, int j, int k, boolean flag) {
- int l = this.getTypeId(i, j, k);
+ Block block = this.getType(i, j, k);
- if (l > 0) {
- int i1 = this.getData(i, j, k);
+ if (block.getMaterial() == Material.AIR) {
+ return false;
+ } else {
+ int l = this.getData(i, j, k);
- this.triggerEffect(2001, i, j, k, l + (i1 << 12));
+ this.triggerEffect(2001, i, j, k, Block.b(block) + (l << 12));
if (flag) {
- Block.byId[l].c(this, i, j, k, i1, 0);
+ block.b(this, i, j, k, l, 0);
}
- return this.setTypeIdAndData(i, j, k, 0, 0, 3);
- } else {
- return false;
+ return this.setTypeAndData(i, j, k, Blocks.AIR, 0, 3);
}
}
- public boolean setTypeIdUpdate(int i, int j, int k, int l) {
- return this.setTypeIdAndData(i, j, k, l, 0, 3);
+ public boolean setTypeUpdate(int i, int j, int k, Block block) {
+ return this.setTypeAndData(i, j, k, block, 0, 3);
}
public void notify(int i, int j, int k) {
@@ -416,11 +396,11 @@ public abstract class World implements IBlockAccess {
}
}
- public void update(int i, int j, int k, int l) {
- this.applyPhysics(i, j, k, l);
+ public void update(int i, int j, int k, Block block) {
+ this.applyPhysics(i, j, k, block);
}
- public void e(int i, int j, int k, int l) {
+ public void b(int i, int j, int k, int l) {
int i1;
if (k > l) {
@@ -435,99 +415,96 @@ public abstract class World implements IBlockAccess {
}
}
- this.g(i, k, j, i, l, j);
+ this.c(i, k, j, i, l, j);
}
- public void g(int i, int j, int k, int l, int i1, int j1) {
+ public void c(int i, int j, int k, int l, int i1, int j1) {
for (int k1 = 0; k1 < this.u.size(); ++k1) {
((IWorldAccess) this.u.get(k1)).a(i, j, k, l, i1, j1);
}
}
- public void applyPhysics(int i, int j, int k, int l) {
- this.g(i - 1, j, k, l);
- this.g(i + 1, j, k, l);
- this.g(i, j - 1, k, l);
- this.g(i, j + 1, k, l);
- this.g(i, j, k - 1, l);
- this.g(i, j, k + 1, l);
+ public void applyPhysics(int i, int j, int k, Block block) {
+ this.e(i - 1, j, k, block);
+ this.e(i + 1, j, k, block);
+ this.e(i, j - 1, k, block);
+ this.e(i, j + 1, k, block);
+ this.e(i, j, k - 1, block);
+ this.e(i, j, k + 1, block);
}
- public void c(int i, int j, int k, int l, int i1) {
- if (i1 != 4) {
- this.g(i - 1, j, k, l);
+ public void b(int i, int j, int k, Block block, int l) {
+ if (l != 4) {
+ this.e(i - 1, j, k, block);
}
- if (i1 != 5) {
- this.g(i + 1, j, k, l);
+ if (l != 5) {
+ this.e(i + 1, j, k, block);
}
- if (i1 != 0) {
- this.g(i, j - 1, k, l);
+ if (l != 0) {
+ this.e(i, j - 1, k, block);
}
- if (i1 != 1) {
- this.g(i, j + 1, k, l);
+ if (l != 1) {
+ this.e(i, j + 1, k, block);
}
- if (i1 != 2) {
- this.g(i, j, k - 1, l);
+ if (l != 2) {
+ this.e(i, j, k - 1, block);
}
- if (i1 != 3) {
- this.g(i, j, k + 1, l);
+ if (l != 3) {
+ this.e(i, j, k + 1, block);
}
}
- public void g(int i, int j, int k, int l) {
+ public void e(int i, int j, int k, Block block) {
if (!this.isStatic) {
- int i1 = this.getTypeId(i, j, k);
- Block block = Block.byId[i1];
+ Block block1 = this.getType(i, j, k);
- if (block != null) {
- try {
- // CraftBukkit start
- CraftWorld world = ((WorldServer) this).getWorld();
- if (world != null) {
- BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(i, j, k), l);
- this.getServer().getPluginManager().callEvent(event);
-
- if (event.isCancelled()) {
- return;
- }
+ try {
+ // CraftBukkit start
+ CraftWorld world = ((WorldServer) this).getWorld();
+ if (world != null) {
+ BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(i, j, k), l);
+ this.getServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ return;
}
- // CraftBukkit end
-
- block.doPhysics(this, i, j, k, l);
- } catch (Throwable throwable) {
- CrashReport crashreport = CrashReport.a(throwable, "Exception while updating neighbours");
- CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Block being updated");
+ }
+ // CraftBukkit end
- int j1;
+ block1.doPhysics(this, i, j, k, block);
+ } catch (Throwable throwable) {
+ CrashReport crashreport = CrashReport.a(throwable, "Exception while updating neighbours");
+ CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Block being updated");
- try {
- j1 = this.getData(i, j, k);
- } catch (Throwable throwable1) {
- j1 = -1;
- }
+ int l;
- crashreportsystemdetails.a("Source block type", (Callable) (new CrashReportSourceBlockType(this, l)));
- CrashReportSystemDetails.a(crashreportsystemdetails, i, j, k, i1, j1);
- throw new ReportedException(crashreport);
+ try {
+ l = this.getData(i, j, k);
+ } catch (Throwable throwable1) {
+ l = -1;
}
+
+ crashreportsystemdetails.a("Source block type", (Callable) (new CrashReportSourceBlockType(this, block)));
+ CrashReportSystemDetails.a(crashreportsystemdetails, i, j, k, block1, l);
+ throw new ReportedException(crashreport);
}
}
}
- public boolean a(int i, int j, int k, int l) {
+ public boolean a(int i, int j, int k, Block block) {
return false;
}
- public boolean l(int i, int j, int k) {
+ public boolean i(int i, int j, int k) {
return this.getChunkAt(i >> 4, k >> 4).d(i & 15, j, k & 15);
}
- public int m(int i, int j, int k) {
+ public int j(int i, int j, int k) {
if (j < 0) {
return 0;
} else {
@@ -535,7 +512,7 @@ public abstract class World implements IBlockAccess {
j = 255;
}
- return this.getChunkAt(i >> 4, k >> 4).c(i & 15, j, k & 15, 0);
+ return this.getChunkAt(i >> 4, k >> 4).b(i & 15, j, k & 15, 0);
}
}
@@ -545,37 +522,31 @@ public abstract class World implements IBlockAccess {
public int b(int i, int j, int k, boolean flag) {
if (i >= -30000000 && k >= -30000000 && i < 30000000 && k < 30000000) {
- if (flag) {
- int l = this.getTypeId(i, j, k);
-
- if (Block.x[l]) {
- int i1 = this.b(i, j + 1, k, false);
- int j1 = this.b(i + 1, j, k, false);
- int k1 = this.b(i - 1, j, k, false);
- int l1 = this.b(i, j, k + 1, false);
- int i2 = this.b(i, j, k - 1, false);
-
- if (j1 > i1) {
- i1 = j1;
- }
-
- if (k1 > i1) {
- i1 = k1;
- }
+ if (flag && this.getType(i, j, k).n()) {
+ int l = this.b(i, j + 1, k, false);
+ int i1 = this.b(i + 1, j, k, false);
+ int j1 = this.b(i - 1, j, k, false);
+ int k1 = this.b(i, j, k + 1, false);
+ int l1 = this.b(i, j, k - 1, false);
+
+ if (i1 > l) {
+ l = i1;
+ }
- if (l1 > i1) {
- i1 = l1;
- }
+ if (j1 > l) {
+ l = j1;
+ }
- if (i2 > i1) {
- i1 = i2;
- }
+ if (k1 > l) {
+ l = k1;
+ }
- return i1;
+ if (l1 > l) {
+ l = l1;
}
- }
- if (j < 0) {
+ return l;
+ } else if (j < 0) {
return 0;
} else {
if (j >= 256) {
@@ -586,7 +557,7 @@ public abstract class World implements IBlockAccess {
i &= 15;
k &= 15;
- return chunk.c(i, j, k, this.j);
+ return chunk.b(i, j, k, this.j);
}
} else {
return 15;
@@ -603,7 +574,7 @@ public abstract class World implements IBlockAccess {
return chunk.b(i & 15, j & 15);
}
} else {
- return 0;
+ return 64;
}
}
@@ -614,10 +585,10 @@ public abstract class World implements IBlockAccess {
} else {
Chunk chunk = this.getChunkAt(i >> 4, j >> 4);
- return chunk.p;
+ return chunk.r;
}
} else {
- return 0;
+ return 64;
}
}
@@ -664,13 +635,13 @@ public abstract class World implements IBlockAccess {
}
}
- public void p(int i, int j, int k) {
+ public void m(int i, int j, int k) {
for (int l = 0; l < this.u.size(); ++l) {
((IWorldAccess) this.u.get(l)).b(i, j, k);
}
}
- public float q(int i, int j, int k) {
+ public float n(int i, int j, int k) {
return this.worldProvider.h[this.getLightLevel(i, j, k)];
}
@@ -679,14 +650,14 @@ public abstract class World implements IBlockAccess {
}
public MovingObjectPosition a(Vec3D vec3d, Vec3D vec3d1) {
- return this.rayTrace(vec3d, vec3d1, false, false);
+ return this.rayTrace(vec3d, vec3d1, false, false, false);
}
public MovingObjectPosition rayTrace(Vec3D vec3d, Vec3D vec3d1, boolean flag) {
- return this.rayTrace(vec3d, vec3d1, flag, false);
+ return this.rayTrace(vec3d, vec3d1, flag, false, false);
}
- public MovingObjectPosition rayTrace(Vec3D vec3d, Vec3D vec3d1, boolean flag, boolean flag1) {
+ public MovingObjectPosition rayTrace(Vec3D vec3d, Vec3D vec3d1, boolean flag, boolean flag1, boolean flag2) {
if (!Double.isNaN(vec3d.c) && !Double.isNaN(vec3d.d) && !Double.isNaN(vec3d.e)) {
if (!Double.isNaN(vec3d1.c) && !Double.isNaN(vec3d1.d) && !Double.isNaN(vec3d1.e)) {
int i = MathHelper.floor(vec3d1.c);
@@ -695,11 +666,10 @@ public abstract class World implements IBlockAccess {
int l = MathHelper.floor(vec3d.c);
int i1 = MathHelper.floor(vec3d.d);
int j1 = MathHelper.floor(vec3d.e);
- int k1 = this.getTypeId(l, i1, j1);
- int l1 = this.getData(l, i1, j1);
- Block block = Block.byId[k1];
+ Block block = this.getType(l, i1, j1);
+ int k1 = this.getData(l, i1, j1);
- if ((!flag1 || block == null || block.b(this, l, i1, j1) != null) && k1 > 0 && block.a(l1, flag)) {
+ if ((!flag1 || block.a(this, l, i1, j1) != null) && block.a(k1, flag)) {
MovingObjectPosition movingobjectposition = block.a(this, l, i1, j1, vec3d, vec3d1);
if (movingobjectposition != null) {
@@ -707,6 +677,8 @@ public abstract class World implements IBlockAccess {
}
}
+ MovingObjectPosition movingobjectposition1 = null;
+
k1 = 200;
while (k1-- >= 0) {
@@ -715,12 +687,12 @@ public abstract class World implements IBlockAccess {
}
if (l == i && i1 == j && j1 == k) {
- return null;
+ return flag2 ? movingobjectposition1 : null;
}
- boolean flag2 = true;
boolean flag3 = true;
boolean flag4 = true;
+ boolean flag5 = true;
double d0 = 999.0D;
double d1 = 999.0D;
double d2 = 999.0D;
@@ -730,7 +702,7 @@ public abstract class World implements IBlockAccess {
} else if (i < l) {
d0 = (double) l + 0.0D;
} else {
- flag2 = false;
+ flag3 = false;
}
if (j > i1) {
@@ -738,7 +710,7 @@ public abstract class World implements IBlockAccess {
} else if (j < i1) {
d1 = (double) i1 + 0.0D;
} else {
- flag3 = false;
+ flag4 = false;
}
if (k > j1) {
@@ -746,7 +718,7 @@ public abstract class World implements IBlockAccess {
} else if (k < j1) {
d2 = (double) j1 + 0.0D;
} else {
- flag4 = false;
+ flag5 = false;
}
double d3 = 999.0D;
@@ -756,19 +728,19 @@ public abstract class World implements IBlockAccess {
double d7 = vec3d1.d - vec3d.d;
double d8 = vec3d1.e - vec3d.e;
- if (flag2) {
+ if (flag3) {
d3 = (d0 - vec3d.c) / d6;
}
- if (flag3) {
+ if (flag4) {
d4 = (d1 - vec3d.d) / d7;
}
- if (flag4) {
+ if (flag5) {
d5 = (d2 - vec3d.e) / d8;
}
- boolean flag5 = false;
+ boolean flag6 = false;
byte b0;
if (d3 < d4 && d3 < d5) {
@@ -823,22 +795,25 @@ public abstract class World implements IBlockAccess {
++vec3d2.e;
}
- int i2 = this.getTypeId(l, i1, j1);
- int j2 = this.getData(l, i1, j1);
- Block block1 = Block.byId[i2];
+ Block block1 = this.getType(l, i1, j1);
+ int l1 = this.getData(l, i1, j1);
- if ((!flag1 || block1 == null || block1.b(this, l, i1, j1) != null) && i2 > 0 && block1.a(j2, flag)) {
- MovingObjectPosition movingobjectposition1 = block1.a(this, l, i1, j1, vec3d, vec3d1);
+ if (!flag1 || block1.a(this, l, i1, j1) != null) {
+ if (block1.a(l1, flag)) {
+ MovingObjectPosition movingobjectposition2 = block1.a(this, l, i1, j1, vec3d, vec3d1);
- if (movingobjectposition1 != null) {
- vec3d2.b.release(vec3d2); // CraftBukkit
- return movingobjectposition1;
+ if (movingobjectposition2 != null) {
+ vec3d2.b.release(vec3d2); // CraftBukkit
+ return movingobjectposition2;
+ }
+ } else {
+ movingobjectposition1 = new MovingObjectPosition(l, i1, j1, b0, vec3d, false);
}
}
vec3d2.b.release(vec3d2); // CraftBukkit
}
- return null;
+ return flag2 ? movingobjectposition1 : null;
} else {
return null;
}
@@ -848,26 +823,20 @@ public abstract class World implements IBlockAccess {
}
public void makeSound(Entity entity, String s, float f, float f1) {
- if (entity != null && s != null) {
- for (int i = 0; i < this.u.size(); ++i) {
- ((IWorldAccess) this.u.get(i)).a(s, entity.locX, entity.locY - (double) entity.height, entity.locZ, f, f1);
- }
+ for (int i = 0; i < this.u.size(); ++i) {
+ ((IWorldAccess) this.u.get(i)).a(s, entity.locX, entity.locY - (double) entity.height, entity.locZ, f, f1);
}
}
public void a(EntityHuman entityhuman, String s, float f, float f1) {
- if (entityhuman != null && s != null) {
- for (int i = 0; i < this.u.size(); ++i) {
- ((IWorldAccess) this.u.get(i)).a(entityhuman, s, entityhuman.locX, entityhuman.locY - (double) entityhuman.height, entityhuman.locZ, f, f1);
- }
+ for (int i = 0; i < this.u.size(); ++i) {
+ ((IWorldAccess) this.u.get(i)).a(entityhuman, s, entityhuman.locX, entityhuman.locY - (double) entityhuman.height, entityhuman.locZ, f, f1);
}
}
public void makeSound(double d0, double d1, double d2, String s, float f, float f1) {
- if (s != null) {
- for (int i = 0; i < this.u.size(); ++i) {
- ((IWorldAccess) this.u.get(i)).a(s, d0, d1, d2, f, f1);
- }
+ for (int i = 0; i < this.u.size(); ++i) {
+ ((IWorldAccess) this.u.get(i)).a(s, d0, d1, d2, f, f1);
}
}
@@ -890,8 +859,8 @@ public abstract class World implements IBlockAccess {
return true;
}
- // CraftBukkit start - Used for entities other than creatures
public boolean addEntity(Entity entity) {
+ // CraftBukkit start - Used for entities other than creatures
return this.addEntity(entity, SpawnReason.DEFAULT); // Set reason as DEFAULT
}
@@ -901,7 +870,7 @@ public abstract class World implements IBlockAccess {
int i = MathHelper.floor(entity.locX / 16.0D);
int j = MathHelper.floor(entity.locZ / 16.0D);
- boolean flag = entity.p;
+ boolean flag = entity.o;
if (entity instanceof EntityHuman) {
flag = true;
@@ -991,10 +960,10 @@ public abstract class World implements IBlockAccess {
this.everyoneSleeping();
}
- int i = entity.aj;
- int j = entity.al;
+ int i = entity.ai;
+ int j = entity.ak;
- if (entity.ai && this.isChunkLoaded(i, j)) {
+ if (entity.ah && this.isChunkLoaded(i, j)) {
this.getChunkAt(i, j).b(entity);
}
@@ -1019,11 +988,15 @@ public abstract class World implements IBlockAccess {
for (int l1 = i1; l1 < j1; ++l1) {
if (this.isLoaded(k1, 64, l1)) {
for (int i2 = k - 1; i2 < l; ++i2) {
- Block block = Block.byId[this.getTypeId(k1, i2, l1)];
+ Block block;
- if (block != null) {
- block.a(this, k1, i2, l1, axisalignedbb, this.M, entity);
+ if (k1 >= -30000000 && k1 < 30000000 && l1 >= -30000000 && l1 < 30000000) {
+ block = this.getType(k1, i2, l1);
+ } else {
+ block = Blocks.STONE;
}
+
+ block.a(this, k1, i2, l1, axisalignedbb, this.M, entity);
}
}
}
@@ -1033,7 +1006,7 @@ public abstract class World implements IBlockAccess {
List list = this.getEntities(entity, axisalignedbb.grow(d0, d0, d0));
for (int j2 = 0; j2 < list.size(); ++j2) {
- AxisAlignedBB axisalignedbb1 = ((Entity) list.get(j2)).E();
+ AxisAlignedBB axisalignedbb1 = ((Entity) list.get(j2)).J();
if (axisalignedbb1 != null && axisalignedbb1.b(axisalignedbb)) {
this.M.add(axisalignedbb1);
@@ -1061,11 +1034,15 @@ public abstract class World implements IBlockAccess {
for (int l1 = i1; l1 < j1; ++l1) {
if (this.isLoaded(k1, 64, l1)) {
for (int i2 = k - 1; i2 < l; ++i2) {
- Block block = Block.byId[this.getTypeId(k1, i2, l1)];
+ Block block;
- if (block != null) {
- block.a(this, k1, i2, l1, axisalignedbb, this.M, (Entity) null);
+ if (k1 >= -30000000 && k1 < 30000000 && l1 >= -30000000 && l1 < 30000000) {
+ block = this.getType(k1, i2, l1);
+ } else {
+ block = Blocks.BEDROCK;
}
+
+ block.a(this, k1, i2, l1, axisalignedbb, this.M, (Entity) null);
}
}
}
@@ -1087,7 +1064,7 @@ public abstract class World implements IBlockAccess {
}
f2 = 1.0F - f2;
- f2 = (float) ((double) f2 * (1.0D - (double) (this.i(f) * 5.0F) / 16.0D));
+ f2 = (float) ((double) f2 * (1.0D - (double) (this.j(f) * 5.0F) / 16.0D));
f2 = (float) ((double) f2 * (1.0D - (double) (this.h(f) * 5.0F) / 16.0D));
f2 = 1.0F - f2;
return (int) (f2 * 11.0F);
@@ -1118,9 +1095,9 @@ public abstract class World implements IBlockAccess {
i &= 15;
for (j &= 15; k > 0; --k) {
- int l = chunk.getTypeId(i, k, j);
+ Block block = chunk.getType(i, k, j);
- if (l != 0 && Block.byId[l].material.isSolid() && Block.byId[l].material != Material.LEAVES) {
+ if (block.getMaterial().isSolid() && block.getMaterial() != Material.LEAVES) {
return k + 1;
}
}
@@ -1128,11 +1105,11 @@ public abstract class World implements IBlockAccess {
return -1;
}
- public void a(int i, int j, int k, int l, int i1) {}
+ public void a(int i, int j, int k, Block block, int l) {}
- public void a(int i, int j, int k, int l, int i1, int j1) {}
+ public void a(int i, int j, int k, Block block, int l, int i1) {}
- public void b(int i, int j, int k, int l, int i1, int j1) {}
+ public void b(int i, int j, int k, Block block, int l, int i1) {}
public void tickEntities() {
this.methodProfiler.a("entities");
@@ -1158,7 +1135,7 @@ public abstract class World implements IBlockAccess {
try {
++entity.ticksLived;
- entity.l_();
+ entity.h();
} catch (Throwable throwable) {
crashreport = CrashReport.a(throwable, "Ticking entity");
crashreportsystemdetails = crashreport.a("Entity being ticked");
@@ -1184,9 +1161,9 @@ public abstract class World implements IBlockAccess {
for (i = 0; i < this.f.size(); ++i) {
entity = (Entity) this.f.get(i);
- j = entity.aj;
- k = entity.al;
- if (entity.ai && this.isChunkLoaded(j, k)) {
+ j = entity.ai;
+ k = entity.ak;
+ if (entity.ah && this.isChunkLoaded(j, k)) {
this.getChunkAt(j, k).b(entity);
}
}
@@ -1232,9 +1209,9 @@ public abstract class World implements IBlockAccess {
this.methodProfiler.b();
this.methodProfiler.a("remove");
if (entity.dead) {
- j = entity.aj;
- k = entity.al;
- if (entity.ai && this.isChunkLoaded(j, k)) {
+ j = entity.ai;
+ k = entity.ak;
+ if (entity.ah && this.isChunkLoaded(j, k)) {
this.getChunkAt(j, k).b(entity);
}
@@ -1245,7 +1222,7 @@ public abstract class World implements IBlockAccess {
this.methodProfiler.b();
}
- this.methodProfiler.c("tileEntities");
+ this.methodProfiler.c("blockEntities");
this.N = true;
Iterator iterator = this.tileEntityList.iterator();
@@ -1262,8 +1239,8 @@ public abstract class World implements IBlockAccess {
try {
tileentity.h();
} catch (Throwable throwable2) {
- crashreport = CrashReport.a(throwable2, "Ticking tile entity");
- crashreportsystemdetails = crashreport.a("Tile entity being ticked");
+ crashreport = CrashReport.a(throwable2, "Ticking block entity");
+ crashreportsystemdetails = crashreport.a("Block entity being ticked");
tileentity.a(crashreportsystemdetails);
throw new ReportedException(crashreport);
}
@@ -1287,7 +1264,7 @@ public abstract class World implements IBlockAccess {
this.b.clear();
}
- this.methodProfiler.c("pendingTileEntities");
+ this.methodProfiler.c("pendingBlockEntities");
if (!this.a.isEmpty()) {
for (int l = 0; l < this.a.size(); ++l) {
TileEntity tileentity1 = (TileEntity) this.a.get(l);
@@ -1340,32 +1317,32 @@ public abstract class World implements IBlockAccess {
int j = MathHelper.floor(entity.locZ);
byte b0 = 32;
- if (!flag || this.e(i - b0, 0, j - b0, i + b0, 0, j + b0)) {
- entity.U = entity.locX;
- entity.V = entity.locY;
- entity.W = entity.locZ;
+ if (!flag || this.b(i - b0, 0, j - b0, i + b0, 0, j + b0)) {
+ entity.T = entity.locX;
+ entity.U = entity.locY;
+ entity.V = entity.locZ;
entity.lastYaw = entity.yaw;
entity.lastPitch = entity.pitch;
- if (flag && entity.ai) {
+ if (flag && entity.ah) {
++entity.ticksLived;
if (entity.vehicle != null) {
- entity.V();
+ entity.ab();
} else {
- entity.l_();
+ entity.h();
}
}
this.methodProfiler.a("chunkCheck");
if (Double.isNaN(entity.locX) || Double.isInfinite(entity.locX)) {
- entity.locX = entity.U;
+ entity.locX = entity.T;
}
if (Double.isNaN(entity.locY) || Double.isInfinite(entity.locY)) {
- entity.locY = entity.V;
+ entity.locY = entity.U;
}
if (Double.isNaN(entity.locZ) || Double.isInfinite(entity.locZ)) {
- entity.locZ = entity.W;
+ entity.locZ = entity.V;
}
if (Double.isNaN((double) entity.pitch) || Double.isInfinite((double) entity.pitch)) {
@@ -1380,21 +1357,21 @@ public abstract class World implements IBlockAccess {
int l = MathHelper.floor(entity.locY / 16.0D);
int i1 = MathHelper.floor(entity.locZ / 16.0D);
- if (!entity.ai || entity.aj != k || entity.ak != l || entity.al != i1) {
- if (entity.ai && this.isChunkLoaded(entity.aj, entity.al)) {
- this.getChunkAt(entity.aj, entity.al).a(entity, entity.ak);
+ if (!entity.ah || entity.ai != k || entity.aj != l || entity.ak != i1) {
+ if (entity.ah && this.isChunkLoaded(entity.ai, entity.ak)) {
+ this.getChunkAt(entity.ai, entity.ak).a(entity, entity.aj);
}
if (this.isChunkLoaded(k, i1)) {
- entity.ai = true;
+ entity.ah = true;
this.getChunkAt(k, i1).a(entity);
} else {
- entity.ai = false;
+ entity.ah = false;
}
}
this.methodProfiler.b();
- if (flag && entity.ai && entity.passenger != null) {
+ if (flag && entity.ah && entity.passenger != null) {
if (!entity.passenger.dead && entity.passenger.vehicle == entity) {
this.playerJoinedWorld(entity.passenger);
} else {
@@ -1415,7 +1392,7 @@ public abstract class World implements IBlockAccess {
for (int i = 0; i < list.size(); ++i) {
Entity entity1 = (Entity) list.get(i);
- if (!entity1.dead && entity1.m && entity1 != entity) {
+ if (!entity1.dead && entity1.l && entity1 != entity) {
return false;
}
}
@@ -1446,9 +1423,9 @@ public abstract class World implements IBlockAccess {
for (int k1 = i; k1 < j; ++k1) {
for (int l1 = k; l1 < l; ++l1) {
for (int i2 = i1; i2 < j1; ++i2) {
- Block block = Block.byId[this.getTypeId(k1, l1, i2)];
+ Block block = this.getType(k1, l1, i2);
- if (block != null) {
+ if (block.getMaterial() != Material.AIR) {
return true;
}
}
@@ -1481,9 +1458,9 @@ public abstract class World implements IBlockAccess {
for (int k1 = i; k1 < j; ++k1) {
for (int l1 = k; l1 < l; ++l1) {
for (int i2 = i1; i2 < j1; ++i2) {
- Block block = Block.byId[this.getTypeId(k1, l1, i2)];
+ Block block = this.getType(k1, l1, i2);
- if (block != null && block.material.isLiquid()) {
+ if (block.getMaterial().isLiquid()) {
return true;
}
}
@@ -1501,13 +1478,13 @@ public abstract class World implements IBlockAccess {
int i1 = MathHelper.floor(axisalignedbb.c);
int j1 = MathHelper.floor(axisalignedbb.f + 1.0D);
- if (this.e(i, k, i1, j, l, j1)) {
+ if (this.b(i, k, i1, j, l, j1)) {
for (int k1 = i; k1 < j; ++k1) {
for (int l1 = k; l1 < l; ++l1) {
for (int i2 = i1; i2 < j1; ++i2) {
- int j2 = this.getTypeId(k1, l1, i2);
+ Block block = this.getType(k1, l1, i2);
- if (j2 == Block.FIRE.id || j2 == Block.LAVA.id || j2 == Block.STATIONARY_LAVA.id) {
+ if (block == Blocks.FIRE || block == Blocks.LAVA || block == Blocks.STATIONARY_LAVA) {
return true;
}
}
@@ -1526,7 +1503,7 @@ public abstract class World implements IBlockAccess {
int i1 = MathHelper.floor(axisalignedbb.c);
int j1 = MathHelper.floor(axisalignedbb.f + 1.0D);
- if (!this.e(i, k, i1, j, l, j1)) {
+ if (!this.b(i, k, i1, j, l, j1)) {
return false;
} else {
boolean flag = false;
@@ -1535,10 +1512,10 @@ public abstract class World implements IBlockAccess {
for (int k1 = i; k1 < j; ++k1) {
for (int l1 = k; l1 < l; ++l1) {
for (int i2 = i1; i2 < j1; ++i2) {
- Block block = Block.byId[this.getTypeId(k1, l1, i2)];
+ Block block = this.getType(k1, l1, i2);
- if (block != null && block.material == material) {
- double d0 = (double) ((float) (l1 + 1) - BlockFluids.d(this.getData(k1, l1, i2)));
+ if (block.getMaterial() == material) {
+ double d0 = (double) ((float) (l1 + 1) - BlockFluids.b(this.getData(k1, l1, i2)));
if ((double) l >= d0) {
flag = true;
@@ -1549,7 +1526,7 @@ public abstract class World implements IBlockAccess {
}
}
- if (vec3d.b() > 0.0D && entity.ax()) {
+ if (vec3d.b() > 0.0D && entity.aC()) {
vec3d = vec3d.a();
double d1 = 0.014D;
@@ -1574,9 +1551,7 @@ public abstract class World implements IBlockAccess {
for (int k1 = i; k1 < j; ++k1) {
for (int l1 = k; l1 < l; ++l1) {
for (int i2 = i1; i2 < j1; ++i2) {
- Block block = Block.byId[this.getTypeId(k1, l1, i2)];
-
- if (block != null && block.material == material) {
+ if (this.getType(k1, l1, i2).getMaterial() == material) {
return true;
}
}
@@ -1597,9 +1572,9 @@ public abstract class World implements IBlockAccess {
for (int k1 = i; k1 < j; ++k1) {
for (int l1 = k; l1 < l; ++l1) {
for (int i2 = i1; i2 < j1; ++i2) {
- Block block = Block.byId[this.getTypeId(k1, l1, i2)];
+ Block block = this.getType(k1, l1, i2);
- if (block != null && block.material == material) {
+ if (block.getMaterial() == material) {
int j2 = this.getData(k1, l1, i2);
double d0 = (double) (l1 + 1);
@@ -1685,7 +1660,7 @@ public abstract class World implements IBlockAccess {
++i;
}
- if (this.getTypeId(i, j, k) == Block.FIRE.id) {
+ if (this.getType(i, j, k) == Blocks.FIRE) {
this.a(entityhuman, 1004, i, j, k, 0);
this.setAir(i, j, k);
return true;
@@ -1746,7 +1721,7 @@ public abstract class World implements IBlockAccess {
TileEntity tileentity1 = (TileEntity) iterator.next();
if (tileentity1.x == i && tileentity1.y == j && tileentity1.z == k) {
- tileentity1.w_();
+ tileentity1.s();
iterator.remove();
}
}
@@ -1763,11 +1738,11 @@ public abstract class World implements IBlockAccess {
}
}
- public void s(int i, int j, int k) {
+ public void p(int i, int j, int k) {
TileEntity tileentity = this.getTileEntity(i, j, k);
if (tileentity != null && this.N) {
- tileentity.w_();
+ tileentity.s();
this.a.remove(tileentity);
} else {
if (tileentity != null) {
@@ -1787,36 +1762,17 @@ public abstract class World implements IBlockAccess {
this.b.add(tileentity);
}
- public boolean t(int i, int j, int k) {
- Block block = Block.byId[this.getTypeId(i, j, k)];
-
- return block == null ? false : block.c();
- }
+ public boolean q(int i, int j, int k) {
+ AxisAlignedBB axisalignedbb = this.getType(i, j, k).a(this, i, j, k);
- public boolean u(int i, int j, int k) {
- return Block.l(this.getTypeId(i, j, k));
+ return axisalignedbb != null && axisalignedbb.b() >= 1.0D;
}
- public boolean v(int i, int j, int k) {
- int l = this.getTypeId(i, j, k);
-
- if (l != 0 && Block.byId[l] != null) {
- AxisAlignedBB axisalignedbb = Block.byId[l].b(this, i, j, k);
+ public static boolean a(IBlockAccess iblockaccess, int i, int j, int k) {
+ Block block = iblockaccess.getType(i, j, k);
+ int l = iblockaccess.getData(i, j, k);
- return axisalignedbb != null && axisalignedbb.b() >= 1.0D;
- } else {
- return false;
- }
- }
-
- public boolean w(int i, int j, int k) {
- Block block = Block.byId[this.getTypeId(i, j, k)];
-
- return this.a(block, this.getData(i, j, k));
- }
-
- public boolean a(Block block, int i) {
- return block == null ? false : (block.material.k() && block.b() ? true : (block instanceof BlockStairs ? (i & 4) == 4 : (block instanceof BlockStepAbstract ? (i & 8) == 8 : (block instanceof BlockHopper ? true : (block instanceof BlockSnow ? (i & 7) == 7 : false)))));
+ return block.getMaterial().k() && block.d() ? true : (block instanceof BlockStairs ? (l & 4) == 4 : (block instanceof BlockStepAbstract ? (l & 8) == 8 : (block instanceof BlockHopper ? true : (block instanceof BlockSnow ? (l & 7) == 7 : false))));
}
public boolean c(int i, int j, int k, boolean flag) {
@@ -1824,9 +1780,9 @@ public abstract class World implements IBlockAccess {
Chunk chunk = this.chunkProvider.getOrCreateChunk(i >> 4, k >> 4);
if (chunk != null && !chunk.isEmpty()) {
- Block block = Block.byId[this.getTypeId(i, j, k)];
+ Block block = this.getType(i, j, k);
- return block == null ? false : block.material.k() && block.b();
+ return block.getMaterial().k() && block.d();
} else {
return flag;
}
@@ -1863,88 +1819,73 @@ public abstract class World implements IBlockAccess {
protected void o() {
if (!this.worldProvider.g) {
- int i = this.worldData.getThunderDuration();
+ if (!this.isStatic) {
+ int i = this.worldData.getThunderDuration();
- if (i <= 0) {
- if (this.worldData.isThundering()) {
- this.worldData.setThunderDuration(this.random.nextInt(12000) + 3600);
- } else {
- this.worldData.setThunderDuration(this.random.nextInt(168000) + 12000);
- }
- } else {
- --i;
- this.worldData.setThunderDuration(i);
if (i <= 0) {
- // CraftBukkit start
- ThunderChangeEvent thunder = new ThunderChangeEvent(this.getWorld(), !this.worldData.isThundering());
- this.getServer().getPluginManager().callEvent(thunder);
- if (!thunder.isCancelled()) {
- this.worldData.setThundering(!this.worldData.isThundering());
+ if (this.worldData.isThundering()) {
+ this.worldData.setThunderDuration(this.random.nextInt(12000) + 3600);
+ } else {
+ this.worldData.setThunderDuration(this.random.nextInt(168000) + 12000);
+ }
+ } else {
+ --i;
+ this.worldData.setThunderDuration(i);
+ if (i <= 0) {
+ // CraftBukkit start
+ ThunderChangeEvent thunder = new ThunderChangeEvent(this.getWorld(), !this.worldData.isThundering());
+ this.getServer().getPluginManager().callEvent(thunder);
+ if (!thunder.isCancelled()) {
+ this.worldData.setThundering(!this.worldData.isThundering());
+ }
+ // CraftBukkit end
}
- // CraftBukkit end
}
- }
- int j = this.worldData.getWeatherDuration();
-
- if (j <= 0) {
- if (this.worldData.hasStorm()) {
- this.worldData.setWeatherDuration(this.random.nextInt(12000) + 12000);
+ this.o = this.p;
+ if (this.worldData.isThundering()) {
+ this.p = (float) ((double) this.p + 0.01D);
} else {
- this.worldData.setWeatherDuration(this.random.nextInt(168000) + 12000);
+ this.p = (float) ((double) this.p - 0.01D);
}
- } else {
- --j;
- this.worldData.setWeatherDuration(j);
- if (j <= 0) {
- // CraftBukkit start
- WeatherChangeEvent weather = new WeatherChangeEvent(this.getWorld(), !this.worldData.hasStorm());
- this.getServer().getPluginManager().callEvent(weather);
- if (!weather.isCancelled()) {
- this.worldData.setStorm(!this.worldData.hasStorm());
+ this.p = MathHelper.a(this.p, 0.0F, 1.0F);
+ int j = this.worldData.getWeatherDuration();
+
+ if (j <= 0) {
+ if (this.worldData.hasStorm()) {
+ this.worldData.setWeatherDuration(this.random.nextInt(12000) + 12000);
+ } else {
+ this.worldData.setWeatherDuration(this.random.nextInt(168000) + 12000);
+ }
+ } else {
+ --j;
+ this.worldData.setWeatherDuration(j);
+ if (j <= 0) {
+ // CraftBukkit start
+ WeatherChangeEvent weather = new WeatherChangeEvent(this.getWorld(), !this.worldData.hasStorm());
+ this.getServer().getPluginManager().callEvent(weather);
+
+ if (!weather.isCancelled()) {
+ this.worldData.setStorm(!this.worldData.hasStorm());
+ }
+ // CraftBukkit end
}
- // CraftBukkit end
}
- }
-
- this.m = this.n;
- if (this.worldData.hasStorm()) {
- this.n = (float) ((double) this.n + 0.01D);
- } else {
- this.n = (float) ((double) this.n - 0.01D);
- }
- if (this.n < 0.0F) {
- this.n = 0.0F;
- }
-
- if (this.n > 1.0F) {
- this.n = 1.0F;
- }
-
- this.o = this.p;
- if (this.worldData.isThundering()) {
- this.p = (float) ((double) this.p + 0.01D);
- } else {
- this.p = (float) ((double) this.p - 0.01D);
- }
+ this.m = this.n;
+ if (this.worldData.hasStorm()) {
+ this.n = (float) ((double) this.n + 0.01D);
+ } else {
+ this.n = (float) ((double) this.n - 0.01D);
+ }
- if (this.p < 0.0F) {
- this.p = 0.0F;
- }
-
- if (this.p > 1.0F) {
- this.p = 1.0F;
+ this.n = MathHelper.a(this.n, 0.0F, 1.0F);
}
}
}
- public void B() {
- this.worldData.setWeatherDuration(1);
- }
-
- protected void C() {
+ protected void B() {
// this.chunkTickList.clear(); // CraftBukkit - removed
this.methodProfiler.a("buildList");
@@ -1974,8 +1915,8 @@ public abstract class World implements IBlockAccess {
}
this.methodProfiler.b();
- if (this.O > 0) {
- --this.O;
+ if (this.L > 0) {
+ --this.L;
}
this.methodProfiler.a("playerCheckLight");
@@ -1986,7 +1927,7 @@ public abstract class World implements IBlockAccess {
k = MathHelper.floor(entityhuman.locY) + this.random.nextInt(11) - 5;
int j1 = MathHelper.floor(entityhuman.locZ) + this.random.nextInt(11) - 5;
- this.A(j, k, j1);
+ this.t(j, k, j1);
}
this.methodProfiler.b();
@@ -1994,22 +1935,22 @@ public abstract class World implements IBlockAccess {
protected void a(int i, int j, Chunk chunk) {
this.methodProfiler.c("moodSound");
- if (this.O == 0 && !this.isStatic) {
+ if (this.L == 0 && !this.isStatic) {
this.k = this.k * 3 + 1013904223;
int k = this.k >> 2;
int l = k & 15;
int i1 = k >> 8 & 15;
- int j1 = k >> 16 & 255; // CraftBukkit - 127 -> 255
- int k1 = chunk.getTypeId(l, j1, i1);
+ int j1 = k >> 16 & 255;
+ Block block = chunk.getType(l, j1, i1);
l += i;
i1 += j;
- if (k1 == 0 && this.m(l, j1, i1) <= this.random.nextInt(8) && this.b(EnumSkyBlock.SKY, l, j1, i1) <= 0) {
+ if (block.getMaterial() == Material.AIR && this.j(l, j1, i1) <= this.random.nextInt(8) && this.b(EnumSkyBlock.SKY, l, j1, i1) <= 0) {
EntityHuman entityhuman = this.findNearbyPlayer((double) l + 0.5D, (double) j1 + 0.5D, (double) i1 + 0.5D, 8.0D);
if (entityhuman != null && entityhuman.e((double) l + 0.5D, (double) j1 + 0.5D, (double) i1 + 0.5D) > 4.0D) {
this.makeSound((double) l + 0.5D, (double) j1 + 0.5D, (double) i1 + 0.5D, "ambient.cave.cave", 0.7F, 0.8F + this.random.nextFloat() * 0.2F);
- this.O = this.random.nextInt(12000) + 6000;
+ this.L = this.random.nextInt(12000) + 6000;
}
}
}
@@ -2019,47 +1960,47 @@ public abstract class World implements IBlockAccess {
}
protected void g() {
- this.C();
+ this.B();
}
- public boolean x(int i, int j, int k) {
+ public boolean r(int i, int j, int k) {
return this.d(i, j, k, false);
}
- public boolean y(int i, int j, int k) {
+ public boolean s(int i, int j, int k) {
return this.d(i, j, k, true);
}
public boolean d(int i, int j, int k, boolean flag) {
BiomeBase biomebase = this.getBiome(i, k);
- float f = biomebase.j();
+ float f = biomebase.a(i, j, k);
if (f > 0.15F) {
return false;
} else {
if (j >= 0 && j < 256 && this.b(EnumSkyBlock.BLOCK, i, j, k) < 10) {
- int l = this.getTypeId(i, j, k);
+ Block block = this.getType(i, j, k);
- if ((l == Block.STATIONARY_WATER.id || l == Block.WATER.id) && this.getData(i, j, k) == 0) {
+ if ((block == Blocks.STATIONARY_WATER || block == Blocks.WATER) && this.getData(i, j, k) == 0) {
if (!flag) {
return true;
}
boolean flag1 = true;
- if (flag1 && this.getMaterial(i - 1, j, k) != Material.WATER) {
+ if (flag1 && this.getType(i - 1, j, k).getMaterial() != Material.WATER) {
flag1 = false;
}
- if (flag1 && this.getMaterial(i + 1, j, k) != Material.WATER) {
+ if (flag1 && this.getType(i + 1, j, k).getMaterial() != Material.WATER) {
flag1 = false;
}
- if (flag1 && this.getMaterial(i, j, k - 1) != Material.WATER) {
+ if (flag1 && this.getType(i, j, k - 1).getMaterial() != Material.WATER) {
flag1 = false;
}
- if (flag1 && this.getMaterial(i, j, k + 1) != Material.WATER) {
+ if (flag1 && this.getType(i, j, k + 1).getMaterial() != Material.WATER) {
flag1 = false;
}
@@ -2073,18 +2014,19 @@ public abstract class World implements IBlockAccess {
}
}
- public boolean z(int i, int j, int k) {
+ public boolean e(int i, int j, int k, boolean flag) {
BiomeBase biomebase = this.getBiome(i, k);
- float f = biomebase.j();
+ float f = biomebase.a(i, j, k);
if (f > 0.15F) {
return false;
+ } else if (!flag) {
+ return true;
} else {
if (j >= 0 && j < 256 && this.b(EnumSkyBlock.BLOCK, i, j, k) < 10) {
- int l = this.getTypeId(i, j - 1, k);
- int i1 = this.getTypeId(i, j, k);
+ Block block = this.getType(i, j, k);
- if (i1 == 0 && Block.SNOW.canPlace(this, i, j, k) && l != 0 && l != Block.ICE.id && Block.byId[l].material.isSolid()) {
+ if (block.getMaterial() == Material.AIR && Blocks.SNOW.canPlace(this, i, j, k)) {
return true;
}
}
@@ -2093,57 +2035,62 @@ public abstract class World implements IBlockAccess {
}
}
- public void A(int i, int j, int k) {
+ public boolean t(int i, int j, int k) {
+ boolean flag = false;
+
if (!this.worldProvider.g) {
- this.c(EnumSkyBlock.SKY, i, j, k);
+ flag |= this.c(EnumSkyBlock.SKY, i, j, k);
}
- this.c(EnumSkyBlock.BLOCK, i, j, k);
+ flag |= this.c(EnumSkyBlock.BLOCK, i, j, k);
+ return flag;
}
private int a(int i, int j, int k, EnumSkyBlock enumskyblock) {
- if (enumskyblock == EnumSkyBlock.SKY && this.l(i, j, k)) {
+ if (enumskyblock == EnumSkyBlock.SKY && this.i(i, j, k)) {
return 15;
} else {
- int l = this.getTypeId(i, j, k);
- int i1 = enumskyblock == EnumSkyBlock.SKY ? 0 : Block.lightEmission[l];
- int j1 = Block.lightBlock[l];
+ Block block = this.getType(i, j, k);
+ int l = enumskyblock == EnumSkyBlock.SKY ? 0 : block.m();
+ int i1 = block.k();
- if (j1 >= 15 && Block.lightEmission[l] > 0) {
- j1 = 1;
+ if (i1 >= 15 && block.m() > 0) {
+ i1 = 1;
}
- if (j1 < 1) {
- j1 = 1;
+ if (i1 < 1) {
+ i1 = 1;
}
- if (j1 >= 15) {
+ if (i1 >= 15) {
return 0;
- } else if (i1 >= 14) {
- return i1;
+ } else if (l >= 14) {
+ return l;
} else {
- for (int k1 = 0; k1 < 6; ++k1) {
- int l1 = i + Facing.b[k1];
- int i2 = j + Facing.c[k1];
- int j2 = k + Facing.d[k1];
- int k2 = this.b(enumskyblock, l1, i2, j2) - j1;
-
- if (k2 > i1) {
- i1 = k2;
+ for (int j1 = 0; j1 < 6; ++j1) {
+ int k1 = i + Facing.b[j1];
+ int l1 = j + Facing.c[j1];
+ int i2 = k + Facing.d[j1];
+ int j2 = this.b(enumskyblock, k1, l1, i2) - i1;
+
+ if (j2 > l) {
+ l = j2;
}
- if (i1 >= 14) {
- return i1;
+ if (l >= 14) {
+ return l;
}
}
- return i1;
+ return l;
}
}
}
- public void c(EnumSkyBlock enumskyblock, int i, int j, int k) {
- if (this.areChunksLoaded(i, j, k, 17)) {
+ public boolean c(EnumSkyBlock enumskyblock, int i, int j, int k) {
+ if (!this.areChunksLoaded(i, j, k, 17)) {
+ return false;
+ } else {
int l = 0;
int i1 = 0;
@@ -2161,12 +2108,12 @@ public abstract class World implements IBlockAccess {
int l3;
if (k1 > j1) {
- this.H[i1++] = 133152;
+ this.I[i1++] = 133152;
} else if (k1 < j1) {
- this.H[i1++] = 133152 | j1 << 18;
+ this.I[i1++] = 133152 | j1 << 18;
while (l < i1) {
- l1 = this.H[l++];
+ l1 = this.I[l++];
i2 = (l1 & 63) - 32 + i;
j2 = (l1 >> 6 & 63) - 32 + j;
k2 = (l1 >> 12 & 63) - 32 + k;
@@ -2183,11 +2130,11 @@ public abstract class World implements IBlockAccess {
int j4 = i2 + Facing.b[i4];
int k4 = j2 + Facing.c[i4];
int l4 = k2 + Facing.d[i4];
- int i5 = Math.max(1, Block.lightBlock[this.getTypeId(j4, k4, l4)]);
+ int i5 = Math.max(1, this.getType(j4, k4, l4).k());
i3 = this.b(enumskyblock, j4, k4, l4);
- if (i3 == l2 - i5 && i1 < this.H.length) {
- this.H[i1++] = j4 - i + 32 | k4 - j + 32 << 6 | l4 - k + 32 << 12 | l2 - i5 << 18;
+ if (i3 == l2 - i5 && i1 < this.I.length) {
+ this.I[i1++] = j4 - i + 32 | k4 - j + 32 << 6 | l4 - k + 32 << 12 | l2 - i5 << 18;
}
}
}
@@ -2202,7 +2149,7 @@ public abstract class World implements IBlockAccess {
this.methodProfiler.a("checkedPosition < toCheckCount");
while (l < i1) {
- l1 = this.H[l++];
+ l1 = this.I[l++];
i2 = (l1 & 63) - 32 + i;
j2 = (l1 >> 6 & 63) - 32 + j;
k2 = (l1 >> 12 & 63) - 32 + k;
@@ -2214,31 +2161,31 @@ public abstract class World implements IBlockAccess {
j3 = Math.abs(i2 - i);
l3 = Math.abs(j2 - j);
k3 = Math.abs(k2 - k);
- boolean flag = i1 < this.H.length - 6;
+ boolean flag = i1 < this.I.length - 6;
if (j3 + l3 + k3 < 17 && flag) {
if (this.b(enumskyblock, i2 - 1, j2, k2) < i3) {
- this.H[i1++] = i2 - 1 - i + 32 + (j2 - j + 32 << 6) + (k2 - k + 32 << 12);
+ this.I[i1++] = i2 - 1 - i + 32 + (j2 - j + 32 << 6) + (k2 - k + 32 << 12);
}
if (this.b(enumskyblock, i2 + 1, j2, k2) < i3) {
- this.H[i1++] = i2 + 1 - i + 32 + (j2 - j + 32 << 6) + (k2 - k + 32 << 12);
+ this.I[i1++] = i2 + 1 - i + 32 + (j2 - j + 32 << 6) + (k2 - k + 32 << 12);
}
if (this.b(enumskyblock, i2, j2 - 1, k2) < i3) {
- this.H[i1++] = i2 - i + 32 + (j2 - 1 - j + 32 << 6) + (k2 - k + 32 << 12);
+ this.I[i1++] = i2 - i + 32 + (j2 - 1 - j + 32 << 6) + (k2 - k + 32 << 12);
}
if (this.b(enumskyblock, i2, j2 + 1, k2) < i3) {
- this.H[i1++] = i2 - i + 32 + (j2 + 1 - j + 32 << 6) + (k2 - k + 32 << 12);
+ this.I[i1++] = i2 - i + 32 + (j2 + 1 - j + 32 << 6) + (k2 - k + 32 << 12);
}
if (this.b(enumskyblock, i2, j2, k2 - 1) < i3) {
- this.H[i1++] = i2 - i + 32 + (j2 - j + 32 << 6) + (k2 - 1 - k + 32 << 12);
+ this.I[i1++] = i2 - i + 32 + (j2 - j + 32 << 6) + (k2 - 1 - k + 32 << 12);
}
if (this.b(enumskyblock, i2, j2, k2 + 1) < i3) {
- this.H[i1++] = i2 - i + 32 + (j2 - j + 32 << 6) + (k2 + 1 - k + 32 << 12);
+ this.I[i1++] = i2 - i + 32 + (j2 - j + 32 << 6) + (k2 + 1 - k + 32 << 12);
}
}
}
@@ -2246,6 +2193,7 @@ public abstract class World implements IBlockAccess {
}
this.methodProfiler.b();
+ return true;
}
}
@@ -2345,9 +2293,10 @@ public abstract class World implements IBlockAccess {
}
if (oclass.isAssignableFrom(entity.getClass())) {
+ // if ((!(entity instanceof EntityInsentient) || !((EntityInsentient) entity).isPersistent()) && oclass.isAssignableFrom(entity.getClass())) {
+ // CraftBukkit end
++i;
}
- // CraftBukkit end
}
return i;
@@ -2355,7 +2304,9 @@ public abstract class World implements IBlockAccess {
public void a(List list) {
// CraftBukkit start
+ // this.entityList.addAll(list);
Entity entity = null;
+
for (int i = 0; i < list.size(); ++i) {
entity = (Entity) list.get(i);
if (entity == null) {
@@ -2371,28 +2322,12 @@ public abstract class World implements IBlockAccess {
this.f.addAll(list);
}
- public boolean mayPlace(int i, int j, int k, int l, boolean flag, int i1, Entity entity, ItemStack itemstack) {
- int j1 = this.getTypeId(j, k, l);
- Block block = Block.byId[j1];
- Block block1 = Block.byId[i];
- AxisAlignedBB axisalignedbb = block1.b(this, j, k, l);
-
- if (flag) {
- axisalignedbb = null;
- }
-
- boolean defaultReturn; // CraftBukkit - store the default action
+ public boolean mayPlace(Block block, int i, int j, int k, boolean flag, int l, Entity entity, ItemStack itemstack) {
+ Block block1 = this.getType(i, j, k);
+ AxisAlignedBB axisalignedbb = flag ? null : block.a(this, i, j, k);
- if (axisalignedbb != null && !this.a(axisalignedbb, entity)) {
- defaultReturn = false; // CraftBukkit
- } else {
- if (block != null && (block == Block.WATER || block == Block.STATIONARY_WATER || block == Block.LAVA || block == Block.STATIONARY_LAVA || block == Block.FIRE || block.material.isReplaceable())) {
- block = null;
- }
-
- // CraftBukkit
- defaultReturn = block != null && block.material == Material.ORIENTABLE && block1 == Block.ANVIL ? true : i > 0 && block == null && block1.canPlace(this, j, k, l, i1, itemstack);
- }
+ // CraftBukkit start - store default return
+ boolean defaultReturn = axisalignedbb != null && !this.a(axisalignedbb, entity) ? false : (block1.getMaterial() == Material.ORIENTABLE && block == Blocks.ANVIL ? true : block1.getMaterial().isReplaceable() && block.canPlace(this, i, j, k, l, itemstack));
// CraftBukkit start
BlockCanBuildEvent event = new BlockCanBuildEvent(this.getWorld().getBlockAt(j, k, l), i, defaultReturn);
@@ -2441,9 +2376,7 @@ public abstract class World implements IBlockAccess {
}
public int getBlockPower(int i, int j, int k, int l) {
- int i1 = this.getTypeId(i, j, k);
-
- return i1 == 0 ? 0 : Block.byId[i1].c(this, i, j, k, l);
+ return this.getType(i, j, k).c(this, i, j, k, l);
}
public int getBlockPower(int i, int j, int k) {
@@ -2483,13 +2416,7 @@ public abstract class World implements IBlockAccess {
}
public int getBlockFacePower(int i, int j, int k, int l) {
- if (this.u(i, j, k)) {
- return this.getBlockPower(i, j, k);
- } else {
- int i1 = this.getTypeId(i, j, k);
-
- return i1 == 0 ? 0 : Block.byId[i1].b(this, i, j, k, l);
- }
+ return this.getType(i, j, k).r() ? this.getBlockPower(i, j, k) : this.getType(i, j, k).b(this, i, j, k, l);
}
public boolean isBlockIndirectlyPowered(int i, int j, int k) {
@@ -2565,7 +2492,7 @@ public abstract class World implements IBlockAccess {
}
if (entityhuman1.isInvisible()) {
- float f = entityhuman1.bx();
+ float f = entityhuman1.bC();
if (f < 0.1F) {
f = 0.1F;
@@ -2594,7 +2521,7 @@ public abstract class World implements IBlockAccess {
return null;
}
- public void G() throws ExceptionWorldConflict { // CraftBukkit - added throws
+ public void F() throws ExceptionWorldConflict { // CraftBukkit - added throws
this.dataManager.checkSession();
}
@@ -2618,20 +2545,22 @@ public abstract class World implements IBlockAccess {
return new ChunkCoordinates(this.worldData.c(), this.worldData.d(), this.worldData.e());
}
+ public void x(int i, int j, int k) {
+ this.worldData.setSpawn(i, j, k);
+ }
+
public boolean a(EntityHuman entityhuman, int i, int j, int k) {
return true;
}
public void broadcastEntityEffect(Entity entity, byte b0) {}
- public IChunkProvider L() {
+ public IChunkProvider K() {
return this.chunkProvider;
}
- public void playNote(int i, int j, int k, int l, int i1, int j1) {
- if (l > 0) {
- Block.byId[l].b(this, i, j, k, i1, j1);
- }
+ public void playNote(int i, int j, int k, Block block, int l, int i1) {
+ block.a(this, i, j, k, l, i1);
}
public IDataManager getDataManager() {
@@ -2659,46 +2588,46 @@ public abstract class World implements IBlockAccess {
// CraftBukkit end
public float h(float f) {
- return (this.o + (this.p - this.o) * f) * this.i(f);
+ return (this.o + (this.p - this.o) * f) * this.j(f);
}
- public float i(float f) {
+ public float j(float f) {
return this.m + (this.n - this.m) * f;
}
- public boolean P() {
+ public boolean O() {
return (double) this.h(1.0F) > 0.9D;
}
- public boolean Q() {
- return (double) this.i(1.0F) > 0.2D;
+ public boolean P() {
+ return (double) this.j(1.0F) > 0.2D;
}
public boolean isRainingAt(int i, int j, int k) {
- if (!this.Q()) {
+ if (!this.P()) {
return false;
- } else if (!this.l(i, j, k)) {
+ } else if (!this.i(i, j, k)) {
return false;
} else if (this.h(i, k) > j) {
return false;
} else {
BiomeBase biomebase = this.getBiome(i, k);
- return biomebase.c() ? false : biomebase.d();
+ return biomebase.d() ? false : (this.e(i, j, k, false) ? false : biomebase.e());
}
}
- public boolean G(int i, int j, int k) {
+ public boolean z(int i, int j, int k) {
BiomeBase biomebase = this.getBiome(i, k);
- return biomebase.e();
+ return biomebase.f();
}
- public void a(String s, WorldMapBase worldmapbase) {
- this.worldMaps.a(s, worldmapbase);
+ public void a(String s, PersistentBase persistentbase) {
+ this.worldMaps.a(s, persistentbase);
}
- public WorldMapBase a(Class oclass, String s) {
+ public PersistentBase a(Class oclass, String s) {
return this.worldMaps.get(oclass, s);
}
@@ -2706,7 +2635,7 @@ public abstract class World implements IBlockAccess {
return this.worldMaps.a(s);
}
- public void d(int i, int j, int k, int l, int i1) {
+ public void b(int i, int j, int k, int l, int i1) {
for (int j1 = 0; j1 < this.u.size(); ++j1) {
((IWorldAccess) this.u.get(j1)).a(i, j, k, l, i1);
}
@@ -2737,15 +2666,11 @@ public abstract class World implements IBlockAccess {
return 256;
}
- public int S() {
+ public int R() {
return this.worldProvider.g ? 128 : 256;
}
- public IUpdatePlayerListBox a(EntityMinecartAbstract entityminecartabstract) {
- return null;
- }
-
- public Random H(int i, int j, int k) {
+ public Random A(int i, int j, int k) {
long l = (long) i * 341873128712L + (long) j * 132897987541L + this.getWorldData().getSeed() + (long) k;
this.random.setSeed(l);
@@ -2753,7 +2678,7 @@ public abstract class World implements IBlockAccess {
}
public ChunkPosition b(String s, int i, int j, int k) {
- return this.L().findNearestMapFeature(this, s, i, j, k);
+ return this.K().findNearestMapFeature(this, s, i, j, k);
}
public CrashReportSystemDetails a(CrashReport crashreport) {
@@ -2772,7 +2697,7 @@ public abstract class World implements IBlockAccess {
return crashreportsystemdetails;
}
- public void f(int i, int j, int k, int l, int i1) {
+ public void d(int i, int j, int k, int l, int i1) {
for (int j1 = 0; j1 < this.u.size(); ++j1) {
IWorldAccess iworldaccess = (IWorldAccess) this.u.get(j1);
@@ -2784,9 +2709,9 @@ public abstract class World implements IBlockAccess {
return this.J;
}
- public Calendar W() {
+ public Calendar V() {
if (this.getTime() % 600L == 0L) {
- this.K.setTimeInMillis(MinecraftServer.aq());
+ this.K.setTimeInMillis(MinecraftServer.ap());
}
return this.K;
@@ -2796,53 +2721,55 @@ public abstract class World implements IBlockAccess {
return this.scoreboard;
}
- public void m(int i, int j, int k, int l) {
- for (int i1 = 0; i1 < 4; ++i1) {
- int j1 = i + Direction.a[i1];
- int k1 = k + Direction.b[i1];
- int l1 = this.getTypeId(j1, j, k1);
-
- if (l1 != 0) {
- Block block = Block.byId[l1];
-
- if (Block.REDSTONE_COMPARATOR_OFF.g(l1)) {
- block.doPhysics(this, j1, j, k1, l);
- } else if (Block.l(l1)) {
- j1 += Direction.a[i1];
- k1 += Direction.b[i1];
- l1 = this.getTypeId(j1, j, k1);
- block = Block.byId[l1];
- if (Block.REDSTONE_COMPARATOR_OFF.g(l1)) {
- block.doPhysics(this, j1, j, k1, l);
- }
+ public void f(int i, int j, int k, Block block) {
+ for (int l = 0; l < 4; ++l) {
+ int i1 = i + Direction.a[l];
+ int j1 = k + Direction.b[l];
+ Block block1 = this.getType(i1, j, j1);
+
+ if (Blocks.REDSTONE_COMPARATOR_OFF.e(block1)) {
+ block1.doPhysics(this, i1, j, j1, block);
+ } else if (block1.r()) {
+ i1 += Direction.a[l];
+ j1 += Direction.b[l];
+ Block block2 = this.getType(i1, j, j1);
+
+ if (Blocks.REDSTONE_COMPARATOR_OFF.e(block2)) {
+ block2.doPhysics(this, i1, j, j1, block);
}
}
}
}
- public IConsoleLogManager getLogger() {
- return this.logAgent;
- }
-
public float b(double d0, double d1, double d2) {
- return this.I(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2));
+ return this.B(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2));
}
- public float I(int i, int j, int k) {
+ public float B(int i, int j, int k) {
float f = 0.0F;
- boolean flag = this.difficulty == 3;
+ boolean flag = this.difficulty == EnumDifficulty.HARD;
if (this.isLoaded(i, j, k)) {
float f1 = this.x();
- f += MathHelper.a((float) this.getChunkAtWorldCoords(i, k).q / 3600000.0F, 0.0F, 1.0F) * (flag ? 1.0F : 0.75F);
+ f += MathHelper.a((float) this.getChunkAtWorldCoords(i, k).s / 3600000.0F, 0.0F, 1.0F) * (flag ? 1.0F : 0.75F);
f += f1 * 0.25F;
}
- if (this.difficulty < 2) {
- f *= (float) this.difficulty / 2.0F;
+ if (this.difficulty == EnumDifficulty.EASY || this.difficulty == EnumDifficulty.PEACEFUL) {
+ f *= (float) this.difficulty.a() / 2.0F;
}
return MathHelper.a(f, 0.0F, flag ? 1.5F : 1.0F);
}
+
+ public void X() {
+ Iterator iterator = this.u.iterator();
+
+ while (iterator.hasNext()) {
+ IWorldAccess iworldaccess = (IWorldAccess) iterator.next();
+
+ iworldaccess.b();
+ }
+ }
}