diff options
author | Travis Watkins <amaranth@ubuntu.com> | 2013-03-13 17:33:27 -0500 |
---|---|---|
committer | Travis Watkins <amaranth@ubuntu.com> | 2013-03-15 13:28:59 -0500 |
commit | 83d29e461c85733f0113b6eb19db6e3b42da2949 (patch) | |
tree | b3063a1c28f478ab368d5ba3413a842def68c28f /src/main/java/org | |
parent | ba6e4c38cfa98ad291974195cc46d70a4f138ac1 (diff) | |
download | craftbukkit-83d29e461c85733f0113b6eb19db6e3b42da2949.tar craftbukkit-83d29e461c85733f0113b6eb19db6e3b42da2949.tar.gz craftbukkit-83d29e461c85733f0113b6eb19db6e3b42da2949.tar.lz craftbukkit-83d29e461c85733f0113b6eb19db6e3b42da2949.tar.xz craftbukkit-83d29e461c85733f0113b6eb19db6e3b42da2949.zip |
Update CraftBukkit to Minecraft 1.5
Diffstat (limited to 'src/main/java/org')
18 files changed, 159 insertions, 79 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index e7c0760f..37750226 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -522,7 +522,7 @@ public final class CraftServer implements Server { public void reload() { configuration = YamlConfiguration.loadConfiguration(getConfigFile()); - PropertyManager config = new PropertyManager(console.options); + PropertyManager config = new PropertyManager(console.options, console.getLogger()); ((DedicatedServer) console).propertyManager = config; @@ -707,7 +707,7 @@ public final class CraftServer implements Server { } while(used); boolean hardcore = false; - WorldServer internal = new WorldServer(console, new ServerNBTManager(getWorldContainer(), name, true), name, dimension, new WorldSettings(creator.seed(), EnumGamemode.a(getDefaultGameMode().getValue()), generateStructures, hardcore, type), console.methodProfiler, creator.environment(), generator); + WorldServer internal = new WorldServer(console, new ServerNBTManager(getWorldContainer(), name, true), name, dimension, new WorldSettings(creator.seed(), EnumGamemode.a(getDefaultGameMode().getValue()), generateStructures, hardcore, type), console.methodProfiler, console.getLogger(), creator.environment(), generator); if (!(worlds.containsKey(name.toLowerCase()))) { return null; @@ -830,7 +830,7 @@ public final class CraftServer implements Server { } public Logger getLogger() { - return MinecraftServer.log; + return console.getLogger().getLogger(); } public ConsoleReader getReader() { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 6e364b1a..9218f074 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -861,11 +861,17 @@ public class CraftWorld implements World { } } else if (Minecart.class.isAssignableFrom(clazz)) { if (PoweredMinecart.class.isAssignableFrom(clazz)) { - entity = new EntityMinecart(world, x, y, z, CraftMinecart.Type.PoweredMinecart.getId()); + entity = new EntityMinecartFurnace(world, x, y, z); } else if (StorageMinecart.class.isAssignableFrom(clazz)) { - entity = new EntityMinecart(world, x, y, z, CraftMinecart.Type.StorageMinecart.getId()); + entity = new EntityMinecartChest(world, x, y, z); + } else if (MinecartTNT.class.isAssignableFrom(clazz)) { + entity = new EntityMinecartTNT(world, x, y, z); + } else if (MinecartHopper.class.isAssignableFrom(clazz)) { + entity = new EntityMinecartHopper(world, x, y, z); + } else if (MinecartMobSpawner.class.isAssignableFrom(clazz)) { + entity = new EntityMinecartMobSpawner(world, x, y, z); } else { - entity = new EntityMinecart(world, x, y, z, CraftMinecart.Type.Minecart.getId()); + entity = new EntityMinecartRideable(world, x, y, z); } } else if (EnderSignal.class.isAssignableFrom(clazz)) { entity = new EntityEnderSignal(world, x, y, z); @@ -989,7 +995,7 @@ public class CraftWorld implements World { entity = null; } } else if (TNTPrimed.class.isAssignableFrom(clazz)) { - entity = new EntityTNTPrimed(world, x, y, z); + entity = new EntityTNTPrimed(world, x, y, z, null); } else if (ExperienceOrb.class.isAssignableFrom(clazz)) { entity = new EntityExperienceOrb(world, x, y, z, 0); } else if (Weather.class.isAssignableFrom(clazz)) { @@ -1102,7 +1108,7 @@ public class CraftWorld implements World { block.setType(org.bukkit.Material.AIR); // not sure what this does, seems to have something to do with the 'base' material of a block. // For example, WOODEN_STAIRS does something with WOOD in this method - net.minecraft.server.Block.byId[blockId].wasExploded(this.world, blockX, blockY, blockZ); + net.minecraft.server.Block.byId[blockId].wasExploded(this.world, blockX, blockY, blockZ, null); } public void sendPluginMessage(Plugin source, String channel, byte[] message) { diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java index 91677bbe..1e4953dc 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -7,6 +7,7 @@ import java.util.List; import net.minecraft.server.BiomeBase; import net.minecraft.server.BlockRedstoneWire; +import net.minecraft.server.Direction; import net.minecraft.server.EnumSkyBlock; import net.minecraft.server.NBTTagCompound; import net.minecraft.server.TileEntitySkull; @@ -84,14 +85,14 @@ public class CraftBlock implements Block { } public void setData(final byte data) { - chunk.getHandle().world.setData(x, y, z, data); + chunk.getHandle().world.setData(x, y, z, data, 3); } public void setData(final byte data, boolean applyPhysics) { if (applyPhysics) { - chunk.getHandle().world.setData(x, y, z, data); + chunk.getHandle().world.setData(x, y, z, data, 3); } else { - chunk.getHandle().world.setRawData(x, y, z, data); + chunk.getHandle().world.setData(x, y, z, data, 4); } } @@ -104,22 +105,22 @@ public class CraftBlock implements Block { } public boolean setTypeId(final int type) { - return chunk.getHandle().world.setTypeId(x, y, z, type); + return chunk.getHandle().world.setTypeIdAndData(x, y, z, type, getData(), 3); } public boolean setTypeId(final int type, final boolean applyPhysics) { if (applyPhysics) { return setTypeId(type); } else { - return chunk.getHandle().world.setRawTypeId(x, y, z, type); + return chunk.getHandle().world.setTypeIdAndData(x, y, z, type, getData(), 4); } } public boolean setTypeIdAndData(final int type, final byte data, final boolean applyPhysics) { if (applyPhysics) { - return chunk.getHandle().world.setTypeIdAndData(x, y, z, type, data); + return chunk.getHandle().world.setTypeIdAndData(x, y, z, type, data, 3); } else { - boolean success = chunk.getHandle().world.setRawTypeIdAndData(x, y, z, type, data); + boolean success = chunk.getHandle().world.setTypeIdAndData(x, y, z, type, data, 4); if (success) { chunk.getHandle().world.notify(x, y, z); } @@ -294,7 +295,7 @@ public class CraftBlock implements Block { } public boolean isBlockPowered() { - return chunk.getHandle().world.isBlockPowered(x, y, z); + return chunk.getHandle().world.getBlockPower(x, y, z) > 0; } public boolean isBlockIndirectlyPowered() { @@ -320,7 +321,14 @@ public class CraftBlock implements Block { } public boolean isBlockFaceIndirectlyPowered(BlockFace face) { - return chunk.getHandle().world.isBlockFaceIndirectlyPowered(x, y, z, blockFaceToNotch(face)); + int power = chunk.getHandle().world.getBlockFacePower(x, y, z, blockFaceToNotch(face)); + + Block relative = getRelative(face); + if (relative.getType() == Material.REDSTONE_WIRE) { + return Math.max(power, relative.getData()) > 0; + } + + return power > 0; } public int getBlockPower(BlockFace face) { diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java b/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java index fd2e6ba2..554eee9c 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java @@ -21,16 +21,16 @@ public class CraftCreatureSpawner extends CraftBlockState implements CreatureSpa @Deprecated public CreatureType getCreatureType() { - return CreatureType.fromName(spawner.mobName); + return CreatureType.fromName(spawner.a().getMobName()); } public EntityType getSpawnedType() { - return EntityType.fromName(spawner.mobName); + return EntityType.fromName(spawner.a().getMobName()); } @Deprecated public void setCreatureType(CreatureType creatureType) { - spawner.mobName = creatureType.getName(); + spawner.a().a(creatureType.getName()); } public void setSpawnedType(EntityType entityType) { @@ -38,12 +38,12 @@ public class CraftCreatureSpawner extends CraftBlockState implements CreatureSpa throw new IllegalArgumentException("Can't spawn EntityType " + entityType + " from mobspawners!"); } - spawner.mobName = entityType.getName(); + spawner.a().a(entityType.getName()); } @Deprecated public String getCreatureTypeId() { - return spawner.mobName; + return spawner.a().getMobName(); } @Deprecated @@ -52,7 +52,7 @@ public class CraftCreatureSpawner extends CraftBlockState implements CreatureSpa } public String getCreatureTypeName() { - return spawner.mobName; + return spawner.a().getMobName(); } public void setCreatureTypeByName(String creatureType) { @@ -65,11 +65,11 @@ public class CraftCreatureSpawner extends CraftBlockState implements CreatureSpa } public int getDelay() { - return spawner.spawnDelay; + return spawner.a().spawnDelay; } public void setDelay(int delay) { - spawner.spawnDelay = delay; + spawner.a().spawnDelay = delay; } } diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftJukebox.java b/src/main/java/org/bukkit/craftbukkit/block/CraftJukebox.java index c6ac1589..16960292 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftJukebox.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftJukebox.java @@ -23,7 +23,7 @@ public class CraftJukebox extends CraftBlockState implements Jukebox { } public Material getPlaying() { - ItemStack record = jukebox.record; + ItemStack record = jukebox.getRecord(); if (record == null) { return Material.AIR; } @@ -33,15 +33,15 @@ public class CraftJukebox extends CraftBlockState implements Jukebox { public void setPlaying(Material record) { if (record == null || Item.byId[record.getId()] == null) { record = Material.AIR; - jukebox.record = null; + jukebox.setRecord(null); } else { - jukebox.record = new ItemStack(Item.byId[record.getId()], 1); + jukebox.setRecord(new ItemStack(Item.byId[record.getId()], 1)); } jukebox.update(); if (record == Material.AIR) { - world.getHandle().setData(getX(), getY(), getZ(), 0); + world.getHandle().setData(getX(), getY(), getZ(), 0, 3); } else { - world.getHandle().setData(getX(), getY(), getZ(), 1); + world.getHandle().setData(getX(), getY(), getZ(), 1, 3); } world.playEffect(getLocation(), Effect.RECORD_PLAY, record.getId()); } diff --git a/src/main/java/org/bukkit/craftbukkit/command/CraftBlockCommandSender.java b/src/main/java/org/bukkit/craftbukkit/command/CraftBlockCommandSender.java index 89be6326..9c3848d8 100644 --- a/src/main/java/org/bukkit/craftbukkit/command/CraftBlockCommandSender.java +++ b/src/main/java/org/bukkit/craftbukkit/command/CraftBlockCommandSender.java @@ -16,7 +16,7 @@ public class CraftBlockCommandSender extends ServerCommandSender implements Bloc } public Block getBlock() { - return commandBlock.world.getWorld().getBlockAt(commandBlock.x, commandBlock.y, commandBlock.z); + return commandBlock.getWorld().getWorld().getBlockAt(commandBlock.x, commandBlock.y, commandBlock.z); } public void sendMessage(String message) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java index 99a8891b..f88092e1 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -136,13 +136,14 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { if (entity instanceof EntityLightning) { return new CraftLightningStrike(server, (EntityLightning) entity); } else { return new CraftWeather(server, (EntityWeather) entity); } } - else if (entity instanceof EntityMinecart) { - EntityMinecart mc = (EntityMinecart) entity; - if (mc.type == CraftMinecart.Type.StorageMinecart.getId()) { return new CraftStorageMinecart(server, mc); } - else if (mc.type == CraftMinecart.Type.PoweredMinecart.getId()) { return new CraftPoweredMinecart(server, mc); } - else { return new CraftMinecart(server, mc); } - } - else if (entity instanceof EntityHanging) { + else if (entity instanceof EntityMinecartAbstract) { + if (entity instanceof EntityMinecartFurnace) { return new CraftPoweredMinecart(server, (EntityMinecartFurnace) entity); } + else if (entity instanceof EntityMinecartChest) { return new CraftStorageMinecart(server, (EntityMinecartChest) entity); } + else if (entity instanceof EntityMinecartTNT) { return new CraftMinecartTNT(server, (EntityMinecartTNT) entity); } + else if (entity instanceof EntityMinecartHopper) { return new CraftMinecartHopper(server, (EntityMinecartHopper) entity); } + else if (entity instanceof EntityMinecartMobSpawner) { return new CraftMinecartMobSpawner(server, (EntityMinecartMobSpawner) entity); } + else { return new CraftMinecart(server, (EntityMinecartRideable) entity); } + } else if (entity instanceof EntityHanging) { if (entity instanceof EntityPainting) { return new CraftPainting(server, (EntityPainting) entity); } else if (entity instanceof EntityItemFrame) { return new CraftItemFrame(server, (EntityItemFrame) entity); } else { return new CraftHanging(server, (EntityHanging) entity); } @@ -302,7 +303,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { } public UUID getUniqueId() { - return getHandle().uniqueId; + return getHandle().uniqueID; } public int getTicksLived() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java index 9068a454..e79e5384 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -238,7 +238,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { String title = container.getBukkitView().getTitle(); int size = container.getBukkitView().getTopInventory().getSize(); - player.playerConnection.sendPacket(new Packet100OpenWindow(container.windowId, windowType, title, size)); + player.playerConnection.sendPacket(new Packet100OpenWindow(container.windowId, windowType, title, size, true)); getHandle().activeContainer = container; getHandle().activeContainer.addSlotListener(player); } @@ -270,7 +270,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { if (location == null) { location = getLocation(); } - getHandle().startEnchanting(location.getBlockX(), location.getBlockY(), location.getBlockZ()); + getHandle().startEnchanting(location.getBlockX(), location.getBlockY(), location.getBlockZ(), null); if (force) { getHandle().activeContainer.checkReachable = false; } @@ -303,7 +303,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { int windowType = CraftContainer.getNotchInventoryType(type); String title = inventory.getTitle(); int size = inventory.getTopInventory().getSize(); - player.playerConnection.sendPacket(new Packet100OpenWindow(container.windowId, windowType, title, size)); + player.playerConnection.sendPacket(new Packet100OpenWindow(container.windowId, windowType, title, size, false)); player.activeContainer = container; player.activeContainer.addSlotListener(player); } @@ -313,7 +313,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { } public boolean isBlocking() { - return getHandle().bh(); + return getHandle().bk(); // Should be isBlocking } public boolean setWindowProperty(InventoryView.Property prop, int value) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java index ef95acd6..f69480cf 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java @@ -50,7 +50,7 @@ public class CraftItemFrame extends CraftHanging implements ItemFrame { public void setRotation(Rotation rotation) { Validate.notNull(rotation, "Rotation cannot be null"); - getHandle().g(toInteger(rotation)); + getHandle().b(toInteger(rotation)); // Should be setRotation } static int toInteger(Rotation rotation) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java index 23a89b0f..1678db1c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -325,7 +325,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { } public boolean hasLineOfSight(Entity other) { - return getHandle().aA().canSee(((CraftEntity) other).getHandle()); // az should be getEntitySenses + return getHandle().aD().canSee(((CraftEntity) other).getHandle()); // az should be getEntitySenses } public boolean getRemoveWhenFarAway() { @@ -356,4 +356,30 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { return super.teleport(location, cause); } + + public void setCustomName(String name) { + if (name == null) { + name = ""; + } + + getHandle().setCustomName(name); + } + + public String getCustomName() { + String name = getHandle().getCustomName(); + + if (name == null || name.length() == 0) { + return null; + } + + return name; + } + + public void setCustomNameVisible(boolean flag) { + getHandle().setCustomNameVisible(flag); + } + + public boolean getCustomNameVisible() { + return getHandle().getCustomNameVisible(); + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java index 807bd2cf..73e807e1 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java @@ -1,33 +1,13 @@ package org.bukkit.craftbukkit.entity; -import net.minecraft.server.EntityMinecart; +import net.minecraft.server.EntityMinecartAbstract; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.EntityType; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; public class CraftMinecart extends CraftVehicle implements Minecart { - /** - * Stores the minecart type id, which is used by Minecraft to differentiate - * minecart types. Here we use subclasses. - */ - public enum Type { - Minecart(0), - StorageMinecart(1), - PoweredMinecart(2); - - private final int id; - - private Type(int id) { - this.id = id; - } - - public int getId() { - return id; - } - } - - public CraftMinecart(CraftServer server, EntityMinecart entity) { + public CraftMinecart(CraftServer server, EntityMinecartAbstract entity) { super(server, entity); } @@ -74,8 +54,8 @@ public class CraftMinecart extends CraftVehicle implements Minecart { } @Override - public EntityMinecart getHandle() { - return (EntityMinecart) entity; + public EntityMinecartAbstract getHandle() { + return (EntityMinecartAbstract) entity; } @Override diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java new file mode 100644 index 00000000..67fcbb47 --- /dev/null +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java @@ -0,0 +1,16 @@ +package org.bukkit.craftbukkit.entity; + +import net.minecraft.server.EntityMinecartHopper; +import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.MinecartHopper; + +final class CraftMinecartHopper extends CraftMinecart implements MinecartHopper { + CraftMinecartHopper(CraftServer server, EntityMinecartHopper entity) { + super(server, entity); + } + + public EntityType getType() { + return EntityType.MINECART_HOPPER; + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartMobSpawner.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartMobSpawner.java new file mode 100644 index 00000000..83be050b --- /dev/null +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartMobSpawner.java @@ -0,0 +1,16 @@ +package org.bukkit.craftbukkit.entity; + +import net.minecraft.server.EntityMinecartMobSpawner; +import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.MinecartMobSpawner; + +final class CraftMinecartMobSpawner extends CraftMinecart implements MinecartMobSpawner { + CraftMinecartMobSpawner(CraftServer server, EntityMinecartMobSpawner entity) { + super(server, entity); + } + + public EntityType getType() { + return EntityType.MINECART_MOB_SPAWNER; + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartTNT.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartTNT.java new file mode 100644 index 00000000..861b01fe --- /dev/null +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartTNT.java @@ -0,0 +1,11 @@ +package org.bukkit.craftbukkit.entity; + +import net.minecraft.server.EntityMinecartTNT; +import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.entity.MinecartTNT; + +final class CraftMinecartTNT extends CraftMinecart implements MinecartTNT { + CraftMinecartTNT(CraftServer server, EntityMinecartTNT entity) { + super(server, entity); + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPoweredMinecart.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPoweredMinecart.java index b261a0f1..a07829e2 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPoweredMinecart.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPoweredMinecart.java @@ -1,12 +1,13 @@ package org.bukkit.craftbukkit.entity; import org.bukkit.craftbukkit.entity.CraftMinecart; -import net.minecraft.server.EntityMinecart; +import net.minecraft.server.EntityMinecartFurnace; import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.entity.EntityType; import org.bukkit.entity.PoweredMinecart; public class CraftPoweredMinecart extends CraftMinecart implements PoweredMinecart { - public CraftPoweredMinecart(CraftServer server, EntityMinecart entity) { + public CraftPoweredMinecart(CraftServer server, EntityMinecartFurnace entity) { super(server, entity); } @@ -14,4 +15,8 @@ public class CraftPoweredMinecart extends CraftMinecart implements PoweredMineca public String toString() { return "CraftPoweredMinecart"; } + + public EntityType getType() { + return EntityType.MINECART_FURNACE; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftStorageMinecart.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftStorageMinecart.java index e7338a6c..ef86e413 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftStorageMinecart.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftStorageMinecart.java @@ -1,16 +1,17 @@ package org.bukkit.craftbukkit.entity; -import net.minecraft.server.EntityMinecart; +import net.minecraft.server.EntityMinecartChest; -import org.bukkit.inventory.Inventory; -import org.bukkit.craftbukkit.inventory.CraftInventory; import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.craftbukkit.inventory.CraftInventory; +import org.bukkit.entity.EntityType; import org.bukkit.entity.StorageMinecart; +import org.bukkit.inventory.Inventory; public class CraftStorageMinecart extends CraftMinecart implements StorageMinecart { private final CraftInventory inventory; - public CraftStorageMinecart(CraftServer server, EntityMinecart entity) { + public CraftStorageMinecart(CraftServer server, EntityMinecartChest entity) { super(server, entity); inventory = new CraftInventory(entity); } @@ -23,4 +24,8 @@ public class CraftStorageMinecart extends CraftMinecart implements StorageMineca public String toString() { return "CraftStorageMinecart{" + "inventory=" + inventory + '}'; } + + public EntityType getType() { + return EntityType.MINECART_CHEST; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java index 1f136dee..0b38125c 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java @@ -85,7 +85,7 @@ public class CraftContainer extends Container { setupSlots(top, bottom); } int size = getSize(); - player.getHandle().playerConnection.sendPacket(new Packet100OpenWindow(this.windowId, type, cachedTitle, size)); + player.getHandle().playerConnection.sendPacket(new Packet100OpenWindow(this.windowId, type, cachedTitle, size, true)); player.updateInventory(); } return true; diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java index 6fb6cb8b..efb28969 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java @@ -108,7 +108,7 @@ public class CraftInventoryCustom extends CraftInventory { public void update() {} - public boolean a_(EntityHuman entityhuman) { + public boolean a(EntityHuman entityhuman) { return true; } @@ -132,8 +132,6 @@ public class CraftInventoryCustom extends CraftInventory { return type; } - public void f() {} - public void g() {} public InventoryHolder getOwner() { @@ -141,5 +139,13 @@ public class CraftInventoryCustom extends CraftInventory { } public void startOpen() {} + + public boolean c() { + return false; + } + + public boolean b(int i, ItemStack itemstack) { + return true; + } } } |