3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-09 21:10:05 +01:00

Fix block rotations

Dieser Commit ist enthalten in:
wizjany 2013-03-17 11:11:41 -04:00
Ursprung 6c35d20306
Commit 83d5e2fd22
2 geänderte Dateien mit 47 neuen und 9 gelöschten Zeilen

Datei anzeigen

@ -126,10 +126,8 @@ public final class BlockData {
case BlockID.CHEST:
case BlockID.FURNACE:
case BlockID.BURNING_FURNACE:
case BlockID.DISPENSER:
case BlockID.ENDER_CHEST:
case BlockID.TRAPPED_CHEST:
case BlockID.DROPPER:
switch (data) {
case 2: return 5;
case 3: return 4;
@ -138,6 +136,17 @@ public final class BlockData {
}
break;
case BlockID.DISPENSER:
case BlockID.DROPPER:
int dispPower = data & 0x8;
switch (data & ~0x8) {
case 2: return 5 | dispPower;
case 3: return 4 | dispPower;
case 4: return 2 | dispPower;
case 5: return 3 | dispPower;
}
break;
case BlockID.PUMPKIN:
case BlockID.JACKOLANTERN:
switch (data) {
@ -309,10 +318,8 @@ public final class BlockData {
case BlockID.CHEST:
case BlockID.FURNACE:
case BlockID.BURNING_FURNACE:
case BlockID.DISPENSER:
case BlockID.ENDER_CHEST:
case BlockID.TRAPPED_CHEST:
case BlockID.DROPPER:
switch (data) {
case 5: return 2;
case 4: return 3;
@ -321,6 +328,16 @@ public final class BlockData {
}
break;
case BlockID.DISPENSER:
case BlockID.DROPPER:
int dispPower = data & 0x8;
switch (data & ~0x8) {
case 5: return 2 | dispPower;
case 4: return 3 | dispPower;
case 2: return 4 | dispPower;
case 3: return 5 | dispPower;
}
break;
case BlockID.PUMPKIN:
case BlockID.JACKOLANTERN:
switch (data) {
@ -526,10 +543,8 @@ public final class BlockData {
case BlockID.CHEST:
case BlockID.FURNACE:
case BlockID.BURNING_FURNACE:
case BlockID.DISPENSER:
case BlockID.ENDER_CHEST:
case BlockID.TRAPPED_CHEST:
case BlockID.DROPPER:
switch (data) {
case 2:
case 3:
@ -540,6 +555,22 @@ public final class BlockData {
}
break;
case BlockID.DROPPER:
case BlockID.DISPENSER:
int dispPower = data & 0x8;
switch (data & ~0x8) {
case 2:
case 3:
return (data ^ flipZ) | dispPower;
case 4:
case 5:
return (data ^ flipX) | dispPower;
case 0:
case 1:
return (data ^ flipY) | dispPower;
}
break;
case BlockID.PUMPKIN:
case BlockID.JACKOLANTERN:
if (data > 3) break;
@ -768,16 +799,21 @@ public final class BlockData {
case BlockID.FURNACE:
case BlockID.BURNING_FURNACE:
case BlockID.DISPENSER:
case BlockID.WALL_SIGN:
case BlockID.LADDER:
case BlockID.CHEST:
case BlockID.ENDER_CHEST:
case BlockID.TRAPPED_CHEST:
case BlockID.DROPPER:
if (data < 2 || data > 5) return -1;
return mod((data - 2 + increment), 4) + 2;
case BlockID.DISPENSER:
case BlockID.DROPPER:
store = data & 0x8;
data &= ~0x8;
if (data > 5) return -1;
return mod((data + increment), 6) | store;
case BlockID.REDSTONE_REPEATER_OFF:
case BlockID.REDSTONE_REPEATER_ON:
case BlockID.COMPARATOR_OFF:

Datei anzeigen

@ -253,12 +253,14 @@ public class DefaultNmsBlock extends NmsBlock {
// TileEntity te = craftWorld.getHandle().getTileEntity(x, y, z);
// craftWorld.getHandle().tileEntityList.remove(te);
boolean changed = craftWorld.getHandle().setTypeIdAndData(x, y, z, block.getId(), block.getData(), 0);
boolean changed = craftWorld.getHandle().setTypeIdAndData(x, y, z, block.getId(), 0, 0);
if (block instanceof BaseBlock) {
world.copyToWorld(position, (BaseBlock) block);
}
changed = craftWorld.getHandle().setData(x, y, z, block.getData(), 0);
if (changed) {
if (notifyAdjacent) {
craftWorld.getHandle().update(x, y, z, block.getId());