From 64354406fc650632b270cfe5f8954c91f1cdc731 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Thu, 3 Feb 2011 18:17:53 -0500 Subject: [PATCH 1/5] Added Creature.setTarget per jlogsdon By: James Logsdon --- .../craftbukkit/entity/CraftCreature.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftCreature.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftCreature.java index 24b8b22761..09e15c13db 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftCreature.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftCreature.java @@ -1,18 +1,36 @@ package org.bukkit.craftbukkit.entity; import net.minecraft.server.EntityCreature; +import net.minecraft.server.EntityLiving; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.Creature; +import org.bukkit.entity.LivingEntity; public class CraftCreature extends CraftLivingEntity implements Creature{ + private EntityCreature entity; public CraftCreature(CraftServer server, EntityCreature entity) { super(server, entity); + this.entity = entity; + } + + public void setTarget(LivingEntity target) { + if (target == null) { + entity.d = null; + } else if (target instanceof CraftLivingEntity) { + EntityLiving victim = ((CraftLivingEntity)target).getHandle(); + entity.d = victim; + entity.a = entity.world.a(entity, entity.d, 16.0F); + } + } + + @Override + public EntityCreature getHandle() { + return entity; } @Override public String toString() { return "CraftCreature"; } - } From 3b73bf14475e49205c79641c055888aa1f9ef6f6 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Wed, 9 Feb 2011 13:44:46 +0000 Subject: [PATCH 2/5] Added Creature.getTarget By: Dinnerbone --- .../java/org/bukkit/craftbukkit/entity/CraftCreature.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftCreature.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftCreature.java index 09e15c13db..d881c0e821 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftCreature.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftCreature.java @@ -24,6 +24,14 @@ public class CraftCreature extends CraftLivingEntity implements Creature{ } } + public CraftLivingEntity getTarget() { + if (entity.d == null) { + return null; + } else { + return (CraftLivingEntity)entity.d.getBukkitEntity(); + } + } + @Override public EntityCreature getHandle() { return entity; From 70fde138ab089144ca34b531bd1eb63ee4f60560 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Wed, 9 Feb 2011 20:00:17 +0000 Subject: [PATCH 3/5] Probably fixed getLoadedChunks() By: Dinnerbone --- .../src/main/java/org/bukkit/craftbukkit/CraftWorld.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 0abcc9417f..ea509d9ff9 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -73,11 +73,12 @@ public class CraftWorld implements World { } public Chunk[] getLoadedChunks() { - net.minecraft.server.Chunk[] chunks = (net.minecraft.server.Chunk[])provider.e.values().toArray(); + Object[] chunks = provider.e.values().toArray(); org.bukkit.Chunk[] craftChunks = new CraftChunk[chunks.length]; for (int i = 0; i < chunks.length; i++) { - craftChunks[i] = chunks[i].bukkitChunk; + net.minecraft.server.Chunk chunk = (net.minecraft.server.Chunk)chunks[i]; + craftChunks[i] = chunk.bukkitChunk; } return craftChunks; From 5528de8f3c9882bb45f22612a861e116239f0cd1 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Wed, 9 Feb 2011 20:25:14 +0000 Subject: [PATCH 4/5] Worlds are now in the order they are loaded, with [0] being default By: Dinnerbone --- .../src/main/java/org/bukkit/craftbukkit/CraftServer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java index a034bae108..623fc3f9e9 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -4,7 +4,7 @@ import org.bukkit.command.*; import org.bukkit.entity.Player; import java.io.File; import java.util.ArrayList; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.logging.Level; @@ -34,7 +34,7 @@ public final class CraftServer implements Server { private final CommandMap commandMap = new SimpleCommandMap(this); protected final MinecraftServer console; protected final ServerConfigurationManager server; - private final Map worlds = new HashMap(); + private final Map worlds = new LinkedHashMap(); public CraftServer(MinecraftServer console, ServerConfigurationManager server) { this.console = console; From 62b0d3e6bbaec1c5e81e13646ac7e1ce613af748 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Thu, 10 Feb 2011 13:27:53 +0000 Subject: [PATCH 5/5] Fixed chunk unloading By: Dinnerbone --- .../src/main/java/org/bukkit/craftbukkit/CraftWorld.java | 1 + 1 file changed, 1 insertion(+) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index ea509d9ff9..168d85e575 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -123,6 +123,7 @@ public class CraftWorld implements World { provider.a(chunk); } + provider.a.remove(x, z); provider.a.remove(x, z); provider.e.remove(x, z); provider.f.remove(chunk);