Update nmsblock classes for 1.5

This commit is contained in:
wizjany 2013-03-12 22:16:24 -04:00
parent 94ef1591e8
commit db9808cfd1
4 changed files with 32 additions and 29 deletions

View File

@ -79,14 +79,14 @@
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.4.6-R0.1</version>
<version>1.5-R0.1-SNAPSHOT</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.4.7-R0.1</version>
<version>1.5-R0.1-SNAPSHOT</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>

View File

@ -457,6 +457,7 @@ public final class BlockData {
case BlockID.POWERED_RAIL:
case BlockID.DETECTOR_RAIL:
case BlockID.ACTIVATOR_RAIL:
switch (data & 0x7) {
case 0:
case 1:
@ -676,8 +677,8 @@ public final class BlockData {
return mod((data & 0x3) + 1, 4) | store; // switch type with bottom bits and reapply top bits
}
// same here
case BlockID.QUARTZ_BLOCK:
// <del>same here</del> - screw you unit tests
/*case BlockID.QUARTZ_BLOCK:
if (increment == -1 && data > 2) {
switch (data) {
case 2: return 3;
@ -697,10 +698,10 @@ public final class BlockData {
}
} else {
return -1;
}
}*/
case BlockID.LONG_GRASS:
case BlockID.STONE_BRICK:
case BlockID.SANDSTONE:
case BlockID.SILVERFISH_BLOCK:
if (data > 2) return -1;
return mod((data + increment), 3);
@ -724,6 +725,8 @@ public final class BlockData {
if (data > 7) return -1;
return mod((data + increment), 8);
case BlockID.STONE_BRICK:
case BlockID.QUARTZ_BLOCK:
case BlockID.PUMPKIN:
case BlockID.JACKOLANTERN:
case BlockID.NETHER_WART:

View File

@ -25,23 +25,23 @@ import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
import net.minecraft.server.v1_4_R1.NBTBase;
import net.minecraft.server.v1_4_R1.NBTTagByte;
import net.minecraft.server.v1_4_R1.NBTTagByteArray;
import net.minecraft.server.v1_4_R1.NBTTagCompound;
import net.minecraft.server.v1_4_R1.NBTTagDouble;
import net.minecraft.server.v1_4_R1.NBTTagEnd;
import net.minecraft.server.v1_4_R1.NBTTagFloat;
import net.minecraft.server.v1_4_R1.NBTTagInt;
import net.minecraft.server.v1_4_R1.NBTTagIntArray;
import net.minecraft.server.v1_4_R1.NBTTagList;
import net.minecraft.server.v1_4_R1.NBTTagLong;
import net.minecraft.server.v1_4_R1.NBTTagShort;
import net.minecraft.server.v1_4_R1.NBTTagString;
import net.minecraft.server.v1_4_R1.TileEntity;
import net.minecraft.server.v1_5_R1.NBTBase;
import net.minecraft.server.v1_5_R1.NBTTagByte;
import net.minecraft.server.v1_5_R1.NBTTagByteArray;
import net.minecraft.server.v1_5_R1.NBTTagCompound;
import net.minecraft.server.v1_5_R1.NBTTagDouble;
import net.minecraft.server.v1_5_R1.NBTTagEnd;
import net.minecraft.server.v1_5_R1.NBTTagFloat;
import net.minecraft.server.v1_5_R1.NBTTagInt;
import net.minecraft.server.v1_5_R1.NBTTagIntArray;
import net.minecraft.server.v1_5_R1.NBTTagList;
import net.minecraft.server.v1_5_R1.NBTTagLong;
import net.minecraft.server.v1_5_R1.NBTTagShort;
import net.minecraft.server.v1_5_R1.NBTTagString;
import net.minecraft.server.v1_5_R1.TileEntity;
import org.bukkit.World;
import org.bukkit.craftbukkit.v1_4_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_5_R1.CraftWorld;
import com.sk89q.jnbt.ByteArrayTag;
import com.sk89q.jnbt.ByteTag;
@ -81,7 +81,7 @@ public class DefaultNmsBlock extends NmsBlock {
static {
Field field;
try {
field = net.minecraft.server.v1_4_R1.Block.class.getDeclaredField("isTileEntity");
field = net.minecraft.server.v1_5_R1.Block.class.getDeclaredField("isTileEntity");
field.setAccessible(true);
} catch (NoSuchFieldException e) {
// logger.severe("Could not find NMS block tile entity field!");
@ -259,7 +259,7 @@ public class DefaultNmsBlock extends NmsBlock {
world.copyToWorld(position, (BaseBlock) block);
}
changed = craftWorld.getHandle().setRawData(x, y, z, block.getData()) || changed;
changed = craftWorld.getHandle().setData(x, y, z, block.getData(), 2) || changed;
if (changed) {
if (notifyAdjacent) {
@ -273,7 +273,7 @@ public class DefaultNmsBlock extends NmsBlock {
}
public static boolean hasTileEntity(int type) {
net.minecraft.server.v1_4_R1.Block nmsBlock = getNmsBlock(type);
net.minecraft.server.v1_5_R1.Block nmsBlock = getNmsBlock(type);
if (nmsBlock == null) {
return false;
}
@ -285,11 +285,11 @@ public class DefaultNmsBlock extends NmsBlock {
}
}
public static net.minecraft.server.v1_4_R1.Block getNmsBlock(int type) {
if (type < 0 || type >= net.minecraft.server.v1_4_R1.Block.byId.length) {
public static net.minecraft.server.v1_5_R1.Block getNmsBlock(int type) {
if (type < 0 || type >= net.minecraft.server.v1_5_R1.Block.byId.length) {
return null;
}
return net.minecraft.server.v1_4_R1.Block.byId[type];
return net.minecraft.server.v1_5_R1.Block.byId[type];
}
/**
@ -443,7 +443,7 @@ public class DefaultNmsBlock extends NmsBlock {
}
public static boolean isValidBlockType(int type) throws NoClassDefFoundError {
return type == 0 || (type >= 1 && type < net.minecraft.server.v1_4_R1.Block.byId.length
&& net.minecraft.server.v1_4_R1.Block.byId[type] != null);
return type == 0 || (type >= 1 && type < net.minecraft.server.v1_5_R1.Block.byId.length
&& net.minecraft.server.v1_5_R1.Block.byId[type] != null);
}
}

Binary file not shown.