Added support for command blocks in Nukkit.

This commit is contained in:
Dominik Renzel 2019-09-22 16:14:35 +02:00
parent 58243b6757
commit ba9aff2a8a
6 changed files with 902 additions and 893 deletions

View File

@ -152,6 +152,9 @@ public class FaweCache {
int id = i >> 4;
int data = i & 0xf;
if (FaweCache.hasNBT(id)) {
if (id == 137 || id == 188 || id == 189){
System.out.println("Has NBT: " + id + " Data: " + data);
}
CACHE_BLOCK[i] = new ImmutableNBTBlock(id, data);
} else if (FaweCache.hasData(id)) {
CACHE_BLOCK[i] = new ImmutableBlock(id, data);
@ -544,8 +547,6 @@ public class FaweCache {
case 185:
case 186:
case 187:
case 188:
case 189:
case 190:
case 191:
case 192:
@ -658,6 +659,8 @@ public class FaweCache {
case 142:
case 27:
case 137:
case 188:
case 189:
case 52:
case 154:
case 84:
@ -862,8 +865,6 @@ public class FaweCache {
case 185:
case 186:
case 187:
case 188:
case 189:
case 190:
case 191:
case 192:

View File

@ -315,8 +315,6 @@ public abstract class CharFaweChunk<T, V extends FaweQueue> extends FaweChunk<T>
case 172:
case 173:
case 174:
case 188:
case 189:
case 190:
case 191:
case 192:
@ -330,6 +328,9 @@ public abstract class CharFaweChunk<T, V extends FaweQueue> extends FaweChunk<T>
case 10:
case 54:
case 146:
case 137:
case 188:
case 189:
case 61:
case 65:
case 68: // removed

View File

@ -137,9 +137,7 @@ public abstract class FaweChunk<T> implements Callable<FaweChunk> {
* @param layer
* @return char[] or null
*/
public
@Nullable
char[] getIdArray(int layer) {
public @Nullable char[] getIdArray(int layer) {
char[] ids = new char[4096];
int by = layer << 4;
int index = 0;
@ -299,8 +297,7 @@ public abstract class FaweChunk<T> implements Callable<FaweChunk> {
*
* @return
* @see com.boydti.fawe.util.MathMan#unpair16x (get0) => x
* @see com.boydti.fawe.util.MathMan#unpair16y (get0) => z
* get1 => y
* @see com.boydti.fawe.util.MathMan#unpair16y (get0) => z get1 => y
*/
public abstract Map<Short, CompoundTag> getTiles();

View File

@ -1,5 +1,8 @@
package com.boydti.fawe.object.extent;
import java.util.List;
import java.util.Map;
import com.boydti.fawe.FaweCache;
import com.boydti.fawe.object.FaweQueue;
import com.boydti.fawe.object.HasFaweQueue;
@ -21,8 +24,6 @@ import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.biome.BaseBiome;
import java.util.List;
import java.util.Map;
public class FastWorldEditExtent extends AbstractDelegateExtent implements HasFaweQueue {
@ -37,6 +38,7 @@ public class FastWorldEditExtent extends AbstractDelegateExtent implements HasFa
this.maxY = world.getMaxY();
}
@Override
public FaweQueue getQueue() {
return queue;
}
@ -223,8 +225,6 @@ public class FastWorldEditExtent extends AbstractDelegateExtent implements HasFa
case 172:
case 173:
case 174:
case 188:
case 189:
case 190:
case 191:
case 192:
@ -376,6 +376,8 @@ public class FastWorldEditExtent extends AbstractDelegateExtent implements HasFa
case 142:
case 27:
case 137:
case 188:
case 189:
case 52:
case 154:
case 84:
@ -424,6 +426,7 @@ public class FastWorldEditExtent extends AbstractDelegateExtent implements HasFa
case 233:
case 234:
default: {
CompoundTag nbt = block.getNbtData();
if (nbt != null) {
return queue.setBlock(x, y, z, id, block.getData(), nbt);

View File

@ -214,6 +214,8 @@ public class CuboidClipboard {
case 142:
case 27:
case 137:
case 188:
case 189:
case 52:
case 154:
case 84:
@ -343,8 +345,6 @@ public class CuboidClipboard {
case 172:
case 173:
case 174:
case 188:
case 189:
case 190:
case 191:
case 192: {

View File

@ -98,6 +98,13 @@ public class BundledBlockData {
List<BlockEntry> entries = gson.fromJson(data, new TypeToken<List<BlockEntry>>() {
}.getType());
for (BlockEntry entry : entries) {
if (entry.legacyId == 210){
entry.legacyId = 188;
} else if (entry.legacyId == 211){
entry.legacyId = 189;
}
System.out.println("BundledBlockData::Adding block entry: " + entry.id + " (" + entry.legacyId + ")");
add(entry, overwrite);
}
}