mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-07 19:12:22 +01:00
Update CraftBukkit to Minecraft 1.4(.2).
By: Travis Watkins <amaranth@ubuntu.com>
This commit is contained in:
parent
b2439099d0
commit
1177b02708
29 changed files with 368 additions and 98 deletions
|
@ -4,7 +4,7 @@
|
|||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.3.2-R3.0</version>
|
||||
<version>1.4.2-R0.1-SNAPSHOT</version>
|
||||
<name>CraftBukkit</name>
|
||||
<url>http://www.bukkit.org</url>
|
||||
|
||||
|
@ -51,14 +51,14 @@
|
|||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.3.2-R3.0</version>
|
||||
<version>1.4.2-R0.1-SNAPSHOT</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>minecraft-server</artifactId>
|
||||
<version>1.3.2</version>
|
||||
<version>1.4.2</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
|
|
@ -731,10 +731,6 @@ public final class CraftServer implements Server {
|
|||
|
||||
ChunkCoordinates chunkcoordinates = internal.getSpawn();
|
||||
internal.chunkProviderServer.getChunkAt(chunkcoordinates.x + j >> 4, chunkcoordinates.z + k >> 4);
|
||||
|
||||
while (internal.updateLights()) {
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -429,16 +429,20 @@ public class CraftWorld implements World {
|
|||
CraftPlayer cp = (CraftPlayer) p;
|
||||
if (cp.getHandle().netServerHandler == null) continue;
|
||||
|
||||
cp.getHandle().netServerHandler.sendPacket(new Packet4UpdateTime(cp.getHandle().getPlayerTime()));
|
||||
cp.getHandle().netServerHandler.sendPacket(new Packet4UpdateTime(cp.getHandle().getPlayerTime(), cp.getHandle().world.F()));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean createExplosion(double x, double y, double z, float power) {
|
||||
return createExplosion(x, y, z, power, false);
|
||||
return createExplosion(x, y, z, power, false, true);
|
||||
}
|
||||
|
||||
public boolean createExplosion(double x, double y, double z, float power, boolean setFire) {
|
||||
return !world.createExplosion(null, x, y, z, power, setFire).wasCanceled;
|
||||
return createExplosion(x, y, z, power, setFire, true);
|
||||
}
|
||||
|
||||
public boolean createExplosion(double x, double y, double z, float power, boolean setFire, boolean breakBlocks) {
|
||||
return !world.createExplosion(null, x, y, z, power, setFire, breakBlocks).wasCanceled;
|
||||
}
|
||||
|
||||
public boolean createExplosion(Location loc, float power) {
|
||||
|
@ -755,7 +759,7 @@ public class CraftWorld implements World {
|
|||
Validate.notNull(effect, "Effect cannot be null");
|
||||
Validate.notNull(location.getWorld(), "World cannot be null");
|
||||
int packetData = effect.getId();
|
||||
Packet61WorldEvent packet = new Packet61WorldEvent(packetData, location.getBlockX(), location.getBlockY(), location.getBlockZ(), data);
|
||||
Packet61WorldEvent packet = new Packet61WorldEvent(packetData, location.getBlockX(), location.getBlockY(), location.getBlockZ(), data, false);
|
||||
int distance;
|
||||
radius *= radius;
|
||||
|
||||
|
@ -834,7 +838,7 @@ public class CraftWorld implements World {
|
|||
if (SmallFireball.class.isAssignableFrom(clazz)) {
|
||||
entity = new EntitySmallFireball(world);
|
||||
} else {
|
||||
entity = new EntityFireball(world);
|
||||
entity = new EntityLargeFireball(world);
|
||||
}
|
||||
((EntityFireball) entity).setPositionRotation(x, y, z, yaw, pitch);
|
||||
Vector direction = location.getDirection().multiply(10);
|
||||
|
|
|
@ -93,7 +93,7 @@ public class PortalTravelAgent implements TravelAgent {
|
|||
for (int k1 = i1 - this.searchRadius; k1 <= i1 + this.searchRadius; ++k1) {
|
||||
double d3 = (double) k1 + 0.5D - location.getZ();
|
||||
|
||||
for (int l1 = world.L() - 1; l1 >= 0; --l1) {
|
||||
for (int l1 = world.O() - 1; l1 >= 0; --l1) {
|
||||
if (world.getTypeId(j1, l1, k1) == Block.PORTAL.id) {
|
||||
while (world.getTypeId(j1, l1 - 1, k1) == Block.PORTAL.id) {
|
||||
--l1;
|
||||
|
@ -200,7 +200,7 @@ public class PortalTravelAgent implements TravelAgent {
|
|||
d2 = (double) j2 + 0.5D - location.getZ();
|
||||
|
||||
label271:
|
||||
for (l2 = world.L() - 1; l2 >= 0; --l2) {
|
||||
for (l2 = world.O() - 1; l2 >= 0; --l2) {
|
||||
if (world.isEmpty(i2, l2, j2)) {
|
||||
while (l2 > 0 && world.isEmpty(i2, l2 - 1, j2)) {
|
||||
--l2;
|
||||
|
@ -251,7 +251,7 @@ public class PortalTravelAgent implements TravelAgent {
|
|||
d2 = (double) j2 + 0.5D - location.getZ();
|
||||
|
||||
label219:
|
||||
for (l2 = world.L() - 1; l2 >= 0; --l2) {
|
||||
for (l2 = world.O() - 1; l2 >= 0; --l2) {
|
||||
if (world.isEmpty(i2, l2, j2)) {
|
||||
while (l2 > 0 && world.isEmpty(i2, l2 - 1, j2)) {
|
||||
--l2;
|
||||
|
@ -312,8 +312,8 @@ public class PortalTravelAgent implements TravelAgent {
|
|||
i1 = 70;
|
||||
}
|
||||
|
||||
if (i1 > world.L() - 10) {
|
||||
i1 = world.L() - 10;
|
||||
if (i1 > world.O() - 10) {
|
||||
i1 = world.O() - 10;
|
||||
}
|
||||
|
||||
j5 = i1;
|
||||
|
|
|
@ -372,7 +372,7 @@ public class CraftBlock implements Block {
|
|||
for (int i = 0; i < count; ++i) {
|
||||
int item = block.getDropType(data, chunk.getHandle().world.random, 0);
|
||||
if (item > 0) {
|
||||
drops.add(new ItemStack(item, 1, (short) net.minecraft.server.Block.getDropData(block, data)));
|
||||
drops.add(new ItemStack(item, 1, (short) block.getDropData(data)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public class CraftDispenser extends CraftBlockState implements Dispenser {
|
|||
if (block.getType() == Material.DISPENSER) {
|
||||
BlockDispenser dispense = (BlockDispenser) net.minecraft.server.Block.DISPENSER;
|
||||
|
||||
dispense.dispense(world.getHandle(), getX(), getY(), getZ(), new Random());
|
||||
dispense.dispense(world.getHandle(), getX(), getY(), getZ());
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.bukkit.craftbukkit.command;
|
|||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import net.minecraft.server.ChunkCoordinates;
|
||||
import net.minecraft.server.ICommandListener;
|
||||
import net.minecraft.server.LocaleLanguage;
|
||||
|
||||
|
@ -39,7 +40,11 @@ public class ServerCommandListener implements ICommandListener {
|
|||
return LocaleLanguage.a().a(s, aobject);
|
||||
}
|
||||
|
||||
public boolean b(String s) {
|
||||
public boolean a(int i, String s) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public ChunkCoordinates b() {
|
||||
return new ChunkCoordinates(0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import net.minecraft.server.EntityAmbient;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.Ambient;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
public class CraftAmbient extends CraftLivingEntity implements Ambient {
|
||||
public CraftAmbient(CraftServer server, EntityAmbient entity) {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityAmbient getHandle() {
|
||||
return (EntityAmbient) entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CraftAmbient";
|
||||
}
|
||||
|
||||
public EntityType getType() {
|
||||
return EntityType.UNKNOWN;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import net.minecraft.server.EntityBat;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.Bat;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
public class CraftBat extends CraftAmbient implements Bat {
|
||||
public CraftBat(CraftServer server, EntityBat entity) {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityBat getHandle() {
|
||||
return (EntityBat) entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CraftBat";
|
||||
}
|
||||
|
||||
public EntityType getType() {
|
||||
return EntityType.BAT;
|
||||
}
|
||||
}
|
|
@ -1,17 +1,17 @@
|
|||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import net.minecraft.server.EntityComplex;
|
||||
import net.minecraft.server.EntityLiving;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.ComplexLivingEntity;
|
||||
|
||||
public abstract class CraftComplexLivingEntity extends CraftLivingEntity implements ComplexLivingEntity {
|
||||
public CraftComplexLivingEntity(CraftServer server, EntityComplex entity) {
|
||||
public CraftComplexLivingEntity(CraftServer server, EntityLiving entity) {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityComplex getHandle() {
|
||||
return (EntityComplex) entity;
|
||||
public EntityLiving getHandle() {
|
||||
return (EntityLiving) entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import net.minecraft.server.EntityComplexPart;
|
||||
import net.minecraft.server.EntityEnderDragon;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.ComplexEntityPart;
|
||||
import org.bukkit.entity.ComplexLivingEntity;
|
||||
|
@ -13,7 +14,7 @@ public class CraftComplexPart extends CraftEntity implements ComplexEntityPart {
|
|||
}
|
||||
|
||||
public ComplexLivingEntity getParent() {
|
||||
return (ComplexLivingEntity) getHandle().owner.getBukkitEntity();
|
||||
return (ComplexLivingEntity) ((EntityEnderDragon) getHandle().owner).getBukkitEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -65,6 +65,8 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
|||
else if (entity instanceof EntityGiantZombie) { return new CraftGiant(server, (EntityGiantZombie) entity); }
|
||||
else if (entity instanceof EntitySkeleton) { return new CraftSkeleton(server, (EntitySkeleton) entity); }
|
||||
else if (entity instanceof EntityBlaze) { return new CraftBlaze(server, (EntityBlaze) entity); }
|
||||
else if (entity instanceof EntityWitch) { return new CraftWitch(server, (EntityWitch) entity); }
|
||||
else if (entity instanceof EntityWither) { return new CraftWither(server, (EntityWither) entity); }
|
||||
else if (entity instanceof EntitySpider) {
|
||||
if (entity instanceof EntityCaveSpider) { return new CraftCaveSpider(server, (EntityCaveSpider) entity); }
|
||||
else { return new CraftSpider(server, (EntitySpider) entity); }
|
||||
|
@ -94,8 +96,13 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
|||
if (entity instanceof EntityGhast) { return new CraftGhast(server, (EntityGhast) entity); }
|
||||
else { return new CraftFlying(server, (EntityFlying) entity); }
|
||||
}
|
||||
else if (entity instanceof EntityComplex) {
|
||||
if (entity instanceof EntityEnderDragon) { return new CraftEnderDragon(server, (EntityEnderDragon) entity); }
|
||||
else if (entity instanceof EntityEnderDragon) {
|
||||
return new CraftEnderDragon(server, (EntityEnderDragon) entity);
|
||||
}
|
||||
// Ambient
|
||||
else if (entity instanceof EntityAmbient) {
|
||||
if (entity instanceof EntityBat) { return new CraftBat(server, (EntityBat) entity); }
|
||||
else { return new CraftAmbient(server, (EntityAmbient) entity); }
|
||||
}
|
||||
else { return new CraftLivingEntity(server, (EntityLiving) entity); }
|
||||
}
|
||||
|
@ -117,6 +124,8 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
|||
else if (entity instanceof EntityFallingBlock) { return new CraftFallingSand(server, (EntityFallingBlock) entity); }
|
||||
else if (entity instanceof EntityFireball) {
|
||||
if (entity instanceof EntitySmallFireball) { return new CraftSmallFireball(server, (EntitySmallFireball) entity); }
|
||||
else if (entity instanceof EntityLargeFireball) { return new CraftLargeFireball(server, (EntityLargeFireball) entity); }
|
||||
else if (entity instanceof EntityWitherSkull) { return new CraftWitherSkull(server, (EntityWitherSkull) entity); }
|
||||
else { return new CraftFireball(server, (EntityFireball) entity); }
|
||||
}
|
||||
else if (entity instanceof EntityEnderSignal) { return new CraftEnderSignal(server, (EntityEnderSignal) entity); }
|
||||
|
@ -133,7 +142,11 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
|||
else if (mc.type == CraftMinecart.Type.PoweredMinecart.getId()) { return new CraftPoweredMinecart(server, mc); }
|
||||
else { return new CraftMinecart(server, mc); }
|
||||
}
|
||||
else if (entity instanceof EntityPainting) { return new CraftPainting(server, (EntityPainting) 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); }
|
||||
}
|
||||
else if (entity instanceof EntityTNTPrimed) { return new CraftTNTPrimed(server, (EntityTNTPrimed) entity); }
|
||||
|
||||
throw new IllegalArgumentException("Unknown entity");
|
||||
|
|
|
@ -63,6 +63,6 @@ public class CraftFireball extends AbstractProjectile implements Fireball {
|
|||
}
|
||||
|
||||
public EntityType getType() {
|
||||
return EntityType.FIREBALL;
|
||||
return EntityType.UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,83 @@
|
|||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import net.minecraft.server.EntityHanging;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Hanging;
|
||||
|
||||
public class CraftHanging extends CraftEntity implements Hanging {
|
||||
public CraftHanging(CraftServer server, EntityHanging entity) {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
public BlockFace getAttachedFace() {
|
||||
return getFacing().getOppositeFace();
|
||||
}
|
||||
|
||||
public void setFacingDirection(BlockFace face) {
|
||||
setFacingDirection(face, false);
|
||||
}
|
||||
|
||||
public boolean setFacingDirection(BlockFace face, boolean force) {
|
||||
Block block = getLocation().getBlock().getRelative(getAttachedFace()).getRelative(face.getOppositeFace()).getRelative(getFacing());
|
||||
EntityHanging hanging = getHandle();
|
||||
int x = hanging.x, y = hanging.y, z = hanging.z, dir = hanging.direction;
|
||||
hanging.x = block.getX();
|
||||
hanging.y = block.getY();
|
||||
hanging.z = block.getZ();
|
||||
switch (face) {
|
||||
case EAST:
|
||||
default:
|
||||
getHandle().setDirection(0);
|
||||
break;
|
||||
case NORTH:
|
||||
getHandle().setDirection(1);
|
||||
break;
|
||||
case WEST:
|
||||
getHandle().setDirection(2);
|
||||
break;
|
||||
case SOUTH:
|
||||
getHandle().setDirection(3);
|
||||
break;
|
||||
}
|
||||
if (!force && !hanging.survives()) {
|
||||
// Revert since it doesn't fit
|
||||
hanging.x = x;
|
||||
hanging.y = y;
|
||||
hanging.z = z;
|
||||
hanging.setDirection(dir);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public BlockFace getFacing() {
|
||||
switch (this.getHandle().direction) {
|
||||
case 0:
|
||||
default:
|
||||
return BlockFace.EAST;
|
||||
case 1:
|
||||
return BlockFace.NORTH;
|
||||
case 2:
|
||||
return BlockFace.WEST;
|
||||
case 3:
|
||||
return BlockFace.SOUTH;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityHanging getHandle() {
|
||||
return (EntityHanging) entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CraftHanging";
|
||||
}
|
||||
|
||||
public EntityType getType() {
|
||||
return EntityType.UNKNOWN;
|
||||
}
|
||||
}
|
|
@ -308,7 +308,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
|||
}
|
||||
|
||||
public boolean isBlocking() {
|
||||
return getHandle().aY();
|
||||
return getHandle().be();
|
||||
}
|
||||
|
||||
public boolean setWindowProperty(InventoryView.Property prop, int value) {
|
||||
|
|
|
@ -21,7 +21,7 @@ public class CraftIronGolem extends CraftGolem implements IronGolem {
|
|||
}
|
||||
|
||||
public boolean isPlayerCreated() {
|
||||
return getHandle().q();
|
||||
return getHandle().p();
|
||||
}
|
||||
|
||||
public void setPlayerCreated(boolean playerCreated) {
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import net.minecraft.server.EntityItemFrame;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.ItemFrame;
|
||||
|
||||
public class CraftItemFrame extends CraftHanging implements ItemFrame {
|
||||
public CraftItemFrame(CraftServer server, EntityItemFrame entity) {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityItemFrame getHandle() {
|
||||
return (EntityItemFrame) entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CraftItemFrame";
|
||||
}
|
||||
|
||||
public EntityType getType() {
|
||||
return EntityType.ITEM_FRAME;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import net.minecraft.server.EntityLargeFireball;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LargeFireball;
|
||||
|
||||
public class CraftLargeFireball extends CraftFireball implements LargeFireball {
|
||||
public CraftLargeFireball(CraftServer server, EntityLargeFireball entity) {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityLargeFireball getHandle() {
|
||||
return (EntityLargeFireball) entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CraftLargeFireball";
|
||||
}
|
||||
|
||||
public EntityType getType() {
|
||||
return EntityType.LARGE_FIREBALL;
|
||||
}
|
||||
}
|
|
@ -8,10 +8,11 @@ import java.util.List;
|
|||
|
||||
import net.minecraft.server.DamageSource;
|
||||
import net.minecraft.server.EntityArrow;
|
||||
import net.minecraft.server.EntityComplex;
|
||||
import net.minecraft.server.EntityEgg;
|
||||
import net.minecraft.server.EntityEnderDragon;
|
||||
import net.minecraft.server.EntityEnderPearl;
|
||||
import net.minecraft.server.EntityFireball;
|
||||
import net.minecraft.server.EntityLargeFireball;
|
||||
import net.minecraft.server.EntityLiving;
|
||||
import net.minecraft.server.EntitySmallFireball;
|
||||
import net.minecraft.server.EntitySnowball;
|
||||
|
@ -160,8 +161,8 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
|||
reason = DamageSource.mobAttack(((CraftLivingEntity) source).getHandle());
|
||||
}
|
||||
|
||||
if (entity instanceof EntityComplex) {
|
||||
((EntityComplex) entity).dealDamage(reason, amount);
|
||||
if (entity instanceof EntityEnderDragon) {
|
||||
((EntityEnderDragon) entity).dealDamage(reason, amount);
|
||||
} else {
|
||||
entity.damageEntity(reason, amount);
|
||||
}
|
||||
|
@ -279,7 +280,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
|||
if (SmallFireball.class.isAssignableFrom(projectile)) {
|
||||
launch = new EntitySmallFireball(world);
|
||||
} else {
|
||||
launch = new EntityFireball(world);
|
||||
launch = new EntityLargeFireball(world);
|
||||
}
|
||||
|
||||
Location location = getEyeLocation();
|
||||
|
@ -300,6 +301,6 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
|||
}
|
||||
|
||||
public boolean hasLineOfSight(Entity other) {
|
||||
return getHandle().at().canSee(((CraftEntity) other).getHandle()); // am should be getEntitySenses
|
||||
return getHandle().az().canSee(((CraftEntity) other).getHandle()); // az should be getEntitySenses
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ import net.minecraft.server.EnumArt;
|
|||
import net.minecraft.server.WorldServer;
|
||||
|
||||
import org.bukkit.Art;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.CraftArt;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
|
@ -13,7 +12,7 @@ import org.bukkit.craftbukkit.CraftWorld;
|
|||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Painting;
|
||||
|
||||
public class CraftPainting extends CraftEntity implements Painting {
|
||||
public class CraftPainting extends CraftHanging implements Painting {
|
||||
|
||||
public CraftPainting(CraftServer server, EntityPainting entity) {
|
||||
super(server, entity);
|
||||
|
@ -43,60 +42,13 @@ public class CraftPainting extends CraftEntity implements Painting {
|
|||
return true;
|
||||
}
|
||||
|
||||
public BlockFace getAttachedFace() {
|
||||
return getFacing().getOppositeFace();
|
||||
}
|
||||
|
||||
public void setFacingDirection(BlockFace face) {
|
||||
setFacingDirection(face, false);
|
||||
}
|
||||
|
||||
public boolean setFacingDirection(BlockFace face, boolean force) {
|
||||
Block block = getLocation().getBlock().getRelative(getAttachedFace()).getRelative(face.getOppositeFace()).getRelative(getFacing());
|
||||
EntityPainting painting = getHandle();
|
||||
int x = painting.x, y = painting.y, z = painting.z, dir = painting.direction;
|
||||
painting.x = block.getX();
|
||||
painting.y = block.getY();
|
||||
painting.z = block.getZ();
|
||||
switch (face) {
|
||||
case EAST:
|
||||
default:
|
||||
getHandle().setDirection(0);
|
||||
break;
|
||||
case NORTH:
|
||||
getHandle().setDirection(1);
|
||||
break;
|
||||
case WEST:
|
||||
getHandle().setDirection(2);
|
||||
break;
|
||||
case SOUTH:
|
||||
getHandle().setDirection(3);
|
||||
break;
|
||||
if (super.setFacingDirection(face, force)) {
|
||||
update();
|
||||
return true;
|
||||
}
|
||||
if (!force && !painting.survives()) {
|
||||
// Revert painting since it doesn't fit
|
||||
painting.x = x;
|
||||
painting.y = y;
|
||||
painting.z = z;
|
||||
painting.setDirection(dir);
|
||||
return false;
|
||||
}
|
||||
this.update();
|
||||
return true;
|
||||
}
|
||||
|
||||
public BlockFace getFacing() {
|
||||
switch (this.getHandle().direction) {
|
||||
case 0:
|
||||
default:
|
||||
return BlockFace.EAST;
|
||||
case 1:
|
||||
return BlockFace.NORTH;
|
||||
case 2:
|
||||
return BlockFace.WEST;
|
||||
case 3:
|
||||
return BlockFace.SOUTH;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void update() {
|
||||
|
|
|
@ -266,7 +266,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|||
if (getHandle().netServerHandler == null) return;
|
||||
|
||||
int packetData = effect.getId();
|
||||
Packet61WorldEvent packet = new Packet61WorldEvent(packetData, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), data);
|
||||
Packet61WorldEvent packet = new Packet61WorldEvent(packetData, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), data, false);
|
||||
getHandle().netServerHandler.sendPacket(packet);
|
||||
}
|
||||
|
||||
|
@ -598,7 +598,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|||
}
|
||||
|
||||
public void setBedSpawnLocation(Location location) {
|
||||
getHandle().setRespawnPosition(new ChunkCoordinates(location.getBlockX(), location.getBlockY(), location.getBlockZ()));
|
||||
setBedSpawnLocation(location, false);
|
||||
}
|
||||
|
||||
public void setBedSpawnLocation(Location location, boolean override) {
|
||||
getHandle().setRespawnPosition(new ChunkCoordinates(location.getBlockX(), location.getBlockY(), location.getBlockZ()), override);
|
||||
getHandle().spawnWorld = location.getWorld().getName();
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import net.minecraft.server.EntityWitch;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.Witch;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
public class CraftWitch extends CraftMonster implements Witch {
|
||||
public CraftWitch(CraftServer server, EntityWitch entity) {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityWitch getHandle() {
|
||||
return (EntityWitch) entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CraftWitch";
|
||||
}
|
||||
|
||||
public EntityType getType() {
|
||||
return EntityType.WITCH;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import net.minecraft.server.EntityWither;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.Wither;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
public class CraftWither extends CraftMonster implements Wither {
|
||||
public CraftWither(CraftServer server, EntityWither entity) {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityWither getHandle() {
|
||||
return (EntityWither) entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CraftWither";
|
||||
}
|
||||
|
||||
public EntityType getType() {
|
||||
return EntityType.WITHER;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import net.minecraft.server.EntityWitherSkull;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.WitherSkull;
|
||||
|
||||
public class CraftWitherSkull extends CraftFireball implements WitherSkull {
|
||||
public CraftWitherSkull(CraftServer server, EntityWitherSkull entity) {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityWitherSkull getHandle() {
|
||||
return (EntityWitherSkull) entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CraftWitherSkull";
|
||||
}
|
||||
|
||||
public EntityType getType() {
|
||||
return EntityType.WITHER_SKULL;
|
||||
}
|
||||
}
|
|
@ -4,5 +4,5 @@ import net.minecraft.server.IChunkProvider;
|
|||
import org.bukkit.generator.ChunkGenerator;
|
||||
|
||||
public abstract class InternalChunkGenerator extends ChunkGenerator implements IChunkProvider {
|
||||
|
||||
public void recreateStructures(int i, int j) {}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
package org.bukkit.craftbukkit.inventory;
|
||||
|
||||
import net.minecraft.server.IInventory;
|
||||
import org.bukkit.inventory.AnvilInventory;
|
||||
|
||||
public class CraftInventoryAnvil extends CraftInventory implements AnvilInventory {
|
||||
public CraftInventoryAnvil(IInventory anvil) {
|
||||
super(anvil);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package org.bukkit.craftbukkit.inventory;
|
||||
|
||||
import net.minecraft.server.TileEntityBeacon;
|
||||
import org.bukkit.inventory.BeaconInventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class CraftInventoryBeacon extends CraftInventory implements BeaconInventory {
|
||||
public CraftInventoryBeacon(TileEntityBeacon beacon) {
|
||||
super(beacon);
|
||||
}
|
||||
|
||||
public void setItem(ItemStack item) {
|
||||
setItem(0, item);
|
||||
}
|
||||
|
||||
public ItemStack getItem() {
|
||||
return getItem(0);
|
||||
}
|
||||
}
|
|
@ -32,8 +32,8 @@ public class CraftMapRenderer extends MapRenderer {
|
|||
while (cursors.size() > 0) {
|
||||
cursors.removeCursor(cursors.getCursor(0));
|
||||
}
|
||||
for (int i = 0; i < worldMap.decorations.size(); ++i) {
|
||||
WorldMapDecoration decoration = (WorldMapDecoration) worldMap.decorations.get(i);
|
||||
for (Object object : worldMap.g.values()) {
|
||||
WorldMapDecoration decoration = (WorldMapDecoration) object;
|
||||
cursors.addCursor(decoration.locX, decoration.locY, (byte) (decoration.rotation & 15), (byte) (decoration.type));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,9 +22,9 @@ public class ArtTest {
|
|||
|
||||
for (EnumArt enumArt : EnumArt.values()) {
|
||||
int id = enumArt.ordinal();
|
||||
String name = enumArt.A;
|
||||
int width = enumArt.B / UNIT_MULTIPLIER;
|
||||
int height = enumArt.C / UNIT_MULTIPLIER;
|
||||
String name = enumArt.B;
|
||||
int width = enumArt.C / UNIT_MULTIPLIER;
|
||||
int height = enumArt.D / UNIT_MULTIPLIER;
|
||||
|
||||
Art subject = Art.getById(id);
|
||||
|
||||
|
|
Loading…
Reference in a new issue