some hasty refactoring

This commit is contained in:
Jesse Boyd
2018-08-28 02:56:28 +10:00
parent a61c856adc
commit abd886acd7
55 changed files with 1238 additions and 819 deletions

View File

@ -306,23 +306,6 @@ public enum ClipboardFormat {
map.put("height", dimensions.getY());
map.put("length", dimensions.getZ());
map.put("creator", user);
if (clipboard instanceof BlockArrayClipboard) {
FaweClipboard fc = ((BlockArrayClipboard) clipboard).IMP;
final int[] ids = new int[BlockTypes.size()];
fc.streamCombinedIds(new NBTStreamer.ByteReader() {
@Override
public void run(int index, int byteValue) {
ids[byteValue & BlockTypes.BIT_MASK]++;
}
});
Map<String, Integer> blocks = new HashMap<String, Integer>();
for (int i = 0; i < ids.length; i++) {
if (ids[i] != 0) {
blocks.put(BlockTypes.get(i).getId(), ids[i]);
}
}
map.put("blocks", blocks);
}
Gson gson = new Gson();
String json = gson.toJson(map);
return MainUtil.upload(Settings.IMP.WEB.ASSETS, false, json, category, null, new RunnableVal<OutputStream>() {

View File

@ -154,7 +154,7 @@ public class BlockTransformExtent extends ResettableExtent {
int maskedId = internalId & mask;
int newMaskedId = arr[maskedId];
if (newMaskedId != -1) {
return BlockState.get(newMaskedId | (internalId & (~mask)));
return BlockState.getFromInternalId(newMaskedId | (internalId & (~mask)));
}
newMaskedId = state.getInternalId();
@ -169,7 +169,7 @@ public class BlockTransformExtent extends ResettableExtent {
}
}
arr[maskedId] = newMaskedId & mask;
return BlockState.get(newMaskedId);
return BlockState.getFromInternalId(newMaskedId);
}
public final BlockState transformFast(BlockState block) {