mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 17:57:38 +00:00
Update nmsblock classes for 1.5
This commit is contained in:
parent
94ef1591e8
commit
db9808cfd1
4
pom.xml
4
pom.xml
@ -79,14 +79,14 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bukkit</groupId>
|
<groupId>org.bukkit</groupId>
|
||||||
<artifactId>bukkit</artifactId>
|
<artifactId>bukkit</artifactId>
|
||||||
<version>1.4.6-R0.1</version>
|
<version>1.5-R0.1-SNAPSHOT</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bukkit</groupId>
|
<groupId>org.bukkit</groupId>
|
||||||
<artifactId>craftbukkit</artifactId>
|
<artifactId>craftbukkit</artifactId>
|
||||||
<version>1.4.7-R0.1</version>
|
<version>1.5-R0.1-SNAPSHOT</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
@ -457,6 +457,7 @@ public final class BlockData {
|
|||||||
|
|
||||||
case BlockID.POWERED_RAIL:
|
case BlockID.POWERED_RAIL:
|
||||||
case BlockID.DETECTOR_RAIL:
|
case BlockID.DETECTOR_RAIL:
|
||||||
|
case BlockID.ACTIVATOR_RAIL:
|
||||||
switch (data & 0x7) {
|
switch (data & 0x7) {
|
||||||
case 0:
|
case 0:
|
||||||
case 1:
|
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
|
return mod((data & 0x3) + 1, 4) | store; // switch type with bottom bits and reapply top bits
|
||||||
}
|
}
|
||||||
|
|
||||||
// same here
|
// <del>same here</del> - screw you unit tests
|
||||||
case BlockID.QUARTZ_BLOCK:
|
/*case BlockID.QUARTZ_BLOCK:
|
||||||
if (increment == -1 && data > 2) {
|
if (increment == -1 && data > 2) {
|
||||||
switch (data) {
|
switch (data) {
|
||||||
case 2: return 3;
|
case 2: return 3;
|
||||||
@ -697,10 +698,10 @@ public final class BlockData {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
case BlockID.LONG_GRASS:
|
case BlockID.LONG_GRASS:
|
||||||
case BlockID.STONE_BRICK:
|
case BlockID.SANDSTONE:
|
||||||
case BlockID.SILVERFISH_BLOCK:
|
case BlockID.SILVERFISH_BLOCK:
|
||||||
if (data > 2) return -1;
|
if (data > 2) return -1;
|
||||||
return mod((data + increment), 3);
|
return mod((data + increment), 3);
|
||||||
@ -724,6 +725,8 @@ public final class BlockData {
|
|||||||
if (data > 7) return -1;
|
if (data > 7) return -1;
|
||||||
return mod((data + increment), 8);
|
return mod((data + increment), 8);
|
||||||
|
|
||||||
|
case BlockID.STONE_BRICK:
|
||||||
|
case BlockID.QUARTZ_BLOCK:
|
||||||
case BlockID.PUMPKIN:
|
case BlockID.PUMPKIN:
|
||||||
case BlockID.JACKOLANTERN:
|
case BlockID.JACKOLANTERN:
|
||||||
case BlockID.NETHER_WART:
|
case BlockID.NETHER_WART:
|
||||||
|
@ -25,23 +25,23 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import net.minecraft.server.v1_4_R1.NBTBase;
|
import net.minecraft.server.v1_5_R1.NBTBase;
|
||||||
import net.minecraft.server.v1_4_R1.NBTTagByte;
|
import net.minecraft.server.v1_5_R1.NBTTagByte;
|
||||||
import net.minecraft.server.v1_4_R1.NBTTagByteArray;
|
import net.minecraft.server.v1_5_R1.NBTTagByteArray;
|
||||||
import net.minecraft.server.v1_4_R1.NBTTagCompound;
|
import net.minecraft.server.v1_5_R1.NBTTagCompound;
|
||||||
import net.minecraft.server.v1_4_R1.NBTTagDouble;
|
import net.minecraft.server.v1_5_R1.NBTTagDouble;
|
||||||
import net.minecraft.server.v1_4_R1.NBTTagEnd;
|
import net.minecraft.server.v1_5_R1.NBTTagEnd;
|
||||||
import net.minecraft.server.v1_4_R1.NBTTagFloat;
|
import net.minecraft.server.v1_5_R1.NBTTagFloat;
|
||||||
import net.minecraft.server.v1_4_R1.NBTTagInt;
|
import net.minecraft.server.v1_5_R1.NBTTagInt;
|
||||||
import net.minecraft.server.v1_4_R1.NBTTagIntArray;
|
import net.minecraft.server.v1_5_R1.NBTTagIntArray;
|
||||||
import net.minecraft.server.v1_4_R1.NBTTagList;
|
import net.minecraft.server.v1_5_R1.NBTTagList;
|
||||||
import net.minecraft.server.v1_4_R1.NBTTagLong;
|
import net.minecraft.server.v1_5_R1.NBTTagLong;
|
||||||
import net.minecraft.server.v1_4_R1.NBTTagShort;
|
import net.minecraft.server.v1_5_R1.NBTTagShort;
|
||||||
import net.minecraft.server.v1_4_R1.NBTTagString;
|
import net.minecraft.server.v1_5_R1.NBTTagString;
|
||||||
import net.minecraft.server.v1_4_R1.TileEntity;
|
import net.minecraft.server.v1_5_R1.TileEntity;
|
||||||
|
|
||||||
import org.bukkit.World;
|
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.ByteArrayTag;
|
||||||
import com.sk89q.jnbt.ByteTag;
|
import com.sk89q.jnbt.ByteTag;
|
||||||
@ -81,7 +81,7 @@ public class DefaultNmsBlock extends NmsBlock {
|
|||||||
static {
|
static {
|
||||||
Field field;
|
Field field;
|
||||||
try {
|
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);
|
field.setAccessible(true);
|
||||||
} catch (NoSuchFieldException e) {
|
} catch (NoSuchFieldException e) {
|
||||||
// logger.severe("Could not find NMS block tile entity field!");
|
// logger.severe("Could not find NMS block tile entity field!");
|
||||||
@ -259,7 +259,7 @@ public class DefaultNmsBlock extends NmsBlock {
|
|||||||
world.copyToWorld(position, (BaseBlock) block);
|
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 (changed) {
|
||||||
if (notifyAdjacent) {
|
if (notifyAdjacent) {
|
||||||
@ -273,7 +273,7 @@ public class DefaultNmsBlock extends NmsBlock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasTileEntity(int type) {
|
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) {
|
if (nmsBlock == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -285,11 +285,11 @@ public class DefaultNmsBlock extends NmsBlock {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static net.minecraft.server.v1_4_R1.Block getNmsBlock(int type) {
|
public static net.minecraft.server.v1_5_R1.Block getNmsBlock(int type) {
|
||||||
if (type < 0 || type >= net.minecraft.server.v1_4_R1.Block.byId.length) {
|
if (type < 0 || type >= net.minecraft.server.v1_5_R1.Block.byId.length) {
|
||||||
return null;
|
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 {
|
public static boolean isValidBlockType(int type) throws NoClassDefFoundError {
|
||||||
return type == 0 || (type >= 1 && type < net.minecraft.server.v1_4_R1.Block.byId.length
|
return type == 0 || (type >= 1 && type < net.minecraft.server.v1_5_R1.Block.byId.length
|
||||||
&& net.minecraft.server.v1_4_R1.Block.byId[type] != null);
|
&& net.minecraft.server.v1_5_R1.Block.byId[type] != null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
BIN
src/main/resources/nmsblocks/CBXNmsBlock_147.class
Normal file
BIN
src/main/resources/nmsblocks/CBXNmsBlock_147.class
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user