Merge branch 'master' into dev

This commit is contained in:
Myles 2018-12-05 19:10:52 +00:00
commit 7e8e3fef61
20 changed files with 229 additions and 214 deletions

View File

@ -12,6 +12,7 @@ public enum BlockFace {
NORTH(0, 0, -1, EnumAxis.Z), SOUTH(0, 0, 1, EnumAxis.Z), EAST(1, 0, 0, EnumAxis.X), WEST(-1, 0, 0, EnumAxis.X), TOP(0, 1, 0, EnumAxis.Y), BOTTOM(0, -1, 0, EnumAxis.Y); NORTH(0, 0, -1, EnumAxis.Z), SOUTH(0, 0, 1, EnumAxis.Z), EAST(1, 0, 0, EnumAxis.X), WEST(-1, 0, 0, EnumAxis.X), TOP(0, 1, 0, EnumAxis.Y), BOTTOM(0, -1, 0, EnumAxis.Y);
private static Map<BlockFace, BlockFace> opposites = new HashMap<>(); private static Map<BlockFace, BlockFace> opposites = new HashMap<>();
static { static {
opposites.put(BlockFace.NORTH, BlockFace.SOUTH); opposites.put(BlockFace.NORTH, BlockFace.SOUTH);
opposites.put(BlockFace.SOUTH, BlockFace.NORTH); opposites.put(BlockFace.SOUTH, BlockFace.NORTH);

View File

@ -40,10 +40,14 @@ public class RedstoneConnectionHandler extends ConnectionHandler {
private static int getState(String value) { private static int getState(String value) {
switch (value) { switch (value) {
case "none": return 0; case "none":
case "side" : return 1; return 0;
case "up" : return 2; case "side":
default: return 0; return 1;
case "up":
return 2;
default:
return 0;
} }
} }

View File

@ -32,7 +32,8 @@ public class WallConnectionHandler extends AbstractFenceConnectionHandler {
} }
public boolean up(UserConnection user, Position position) { public boolean up(UserConnection user, Position position) {
if(isWall(getBlockData(user, position.getRelative(BlockFace.BOTTOM))) || isWall(getBlockData(user, position.getRelative(BlockFace.TOP))))return true; if (isWall(getBlockData(user, position.getRelative(BlockFace.BOTTOM))) || isWall(getBlockData(user, position.getRelative(BlockFace.TOP))))
return true;
int blockFaces = getBlockFaces(user, position); int blockFaces = getBlockFaces(user, position);
if (blockFaces == 0 || blockFaces == 0xF) return true; if (blockFaces == 0 || blockFaces == 0xF) return true;
for (int i = 0; i < BLOCK_FACES.length; i++) { for (int i = 0; i < BLOCK_FACES.length; i++) {

View File

@ -16,17 +16,25 @@ public class BlockConnectionProvider implements Provider {
return -1; return -1;
} }
public void storeBlock(UserConnection connection, Position position, int blockState) {}; public void storeBlock(UserConnection connection, Position position, int blockState) {
public void removeBlock(UserConnection connection, Position position) {}; }
public void removeBlock(UserConnection connection, Position position) {
}
public void storeBlock(UserConnection connection, long x, long y, long z, int blockState) { public void storeBlock(UserConnection connection, long x, long y, long z, int blockState) {
storeBlock(connection, new Position(x, y, z), blockState); storeBlock(connection, new Position(x, y, z), blockState);
} }
public void clearStorage(UserConnection connection) {}; public void clearStorage(UserConnection connection) {
public void unloadChunk(UserConnection connection, int x, int z) {}; }
public void unloadChunk(UserConnection connection, int x, int z) {
}
public boolean storesBlocks() { public boolean storesBlocks() {
return false; return false;

View File

@ -66,6 +66,7 @@ public class BlockConnectionStorage extends StoredObject {
@Data @Data
private class BlockPositon { private class BlockPositon {
int x, y, z; int x, y, z;
public BlockPositon(Position position) { public BlockPositon(Position position) {
x = position.getX().intValue(); x = position.getX().intValue();
y = position.getY().intValue(); y = position.getY().intValue();

View File

@ -313,7 +313,7 @@ public class WorldPackets {
if (Via.getConfig().isShieldBlocking()) { if (Via.getConfig().isShieldBlocking()) {
EntityTracker tracker = wrapper.user().get(EntityTracker.class); EntityTracker tracker = wrapper.user().get(EntityTracker.class);
if (item != null && Protocol1_9TO1_8.isSword(item.getIdentifier())) { if (item != null && Protocol1_9TO1_8.isSword(item.getId())) {
if (hand == 0) { if (hand == 0) {
if (!tracker.isBlocking()) { if (!tracker.isBlocking()) {
tracker.setBlocking(true); tracker.setBlocking(true);