Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update nmsblock classes for 1.5

  • Loading branch information...
commit db9808cfd1b437d191f54085bf88431bcdd4ffcd 1 parent 94ef159
@wizjany wizjany authored
View
4 pom.xml
@@ -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
11 src/main/java/com/sk89q/worldedit/blocks/BlockData.java
@@ -457,6 +457,7 @@ public static int flip(int type, int data, FlipDirection direction) {
case BlockID.POWERED_RAIL:
case BlockID.DETECTOR_RAIL:
+ case BlockID.ACTIVATOR_RAIL:
switch (data & 0x7) {
case 0:
case 1:
@@ -676,8 +677,8 @@ public static int cycle(int type, int data, int increment) {
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 static int cycle(int type, int data, int increment) {
}
} 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 static int cycle(int type, int data, int increment) {
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
46 src/main/java/com/sk89q/worldedit/bukkit/DefaultNmsBlock.java
@@ -25,23 +25,23 @@
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 @@
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 static boolean setSafely(BukkitWorld world, Vector position,
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 static boolean setSafely(BukkitWorld world, Vector position,
}
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 static boolean hasTileEntity(int type) {
}
}
- 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 @@ private static NBTBase fromNative(Tag foreign) {
}
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);
}
}
View
BIN  src/main/resources/nmsblocks/CBXNmsBlock_147.class
Binary file not shown
Please sign in to comment.
Something went wrong with that request. Please try again.