Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-05 02:50:05 +01:00
finish block registry
Dieser Commit ist enthalten in:
Ursprung
be5541b61b
Commit
2143b9b5b7
@ -177,7 +177,6 @@ public final class Spigot_v1_13_R2 extends CachedBukkitAdapter implements Bukkit
|
||||
|
||||
@Override
|
||||
public BlockMaterial getMaterial(BlockState state) {
|
||||
BlockType type = state.getBlockType();
|
||||
IBlockData bs = ((CraftBlockData) Bukkit.createBlockData(state.getAsString())).getState();
|
||||
return new BlockMaterial_1_13(bs.getBlock(), bs);
|
||||
}
|
||||
|
@ -62,6 +62,7 @@ import org.bukkit.command.TabCompleter;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.plugin.java.JavaPluginLoader;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -206,6 +206,7 @@ public class Schematic {
|
||||
final int relx = to.getBlockX() + bot.getBlockX() - origin.getBlockX();
|
||||
final int rely = to.getBlockY() + bot.getBlockY() - origin.getBlockY();
|
||||
final int relz = to.getBlockZ() + bot.getBlockZ() - origin.getBlockZ();
|
||||
|
||||
BlockArrayClipboard bac = (BlockArrayClipboard) clipboard;
|
||||
if (copyBiomes) {
|
||||
bac.IMP.forEach(new FaweClipboard.BlockReader() {
|
||||
|
@ -1066,12 +1066,12 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
||||
|
||||
@Override
|
||||
public BlockState getBlock(BlockVector3 position) {
|
||||
return world.getBlock(position);
|
||||
return extent.getBlock(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBlock getFullBlock(BlockVector3 position) {
|
||||
return world.getFullBlock(position);
|
||||
return extent.getFullBlock(position);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2610,7 +2610,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
||||
if ((BlockVector3.at(x, oy, z)).distanceSq(position) > radiusSq) {
|
||||
continue;
|
||||
}
|
||||
for (int y = world.getMaxY(); y >= 1; --y) {
|
||||
for (int y = maxY; y >= 1; --y) {
|
||||
BlockVector3 pt = BlockVector3.at(x, y, z);
|
||||
BlockType id = getBlock(pt).getBlockType();
|
||||
|
||||
@ -2658,7 +2658,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
||||
if ((BlockVector3.at(x, oy, z)).distanceSq(position) > radiusSq) {
|
||||
continue;
|
||||
}
|
||||
for (int y = world.getMaxY(); y >= 1; --y) {
|
||||
for (int y = maxY; y >= 1; --y) {
|
||||
BlockVector3 pt = BlockVector3.at(x, y, z);
|
||||
BlockType id = getBlock(pt).getBlockType();
|
||||
if (id.getMaterial().isAir()) {
|
||||
@ -2681,7 +2681,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
||||
}
|
||||
|
||||
// Too high?
|
||||
if (y == world.getMaxY()) {
|
||||
if (y == maxY) {
|
||||
break;
|
||||
}
|
||||
|
||||
@ -3469,7 +3469,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
||||
final int bx = cx << 4;
|
||||
final int bz = cz << 4;
|
||||
final BlockVector3 cmin = BlockVector3.at(bx, 0, bz);
|
||||
final BlockVector3 cmax = cmin.add(15, getMaxY(), 15);
|
||||
final BlockVector3 cmax = cmin.add(15, maxY, 15);
|
||||
final boolean containsBot1 = (fe == null || fe.contains(cmin.getBlockX(), cmin.getBlockY(), cmin.getBlockZ()));
|
||||
final boolean containsBot2 = region.contains(cmin);
|
||||
final boolean containsTop1 = (fe == null || fe.contains(cmax.getBlockX(), cmax.getBlockY(), cmax.getBlockZ()));
|
||||
@ -3488,7 +3488,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
||||
int xx = x + bx;
|
||||
for (int z = 0; z < 16; z++) {
|
||||
int zz = z + bz;
|
||||
for (int y = 0; y < getMaxY() + 1; y++) {
|
||||
for (int y = 0; y < maxY + 1; y++) {
|
||||
BaseBlock block = getFullBlock(mutable.setComponents(xx, y, zz));
|
||||
fcs.add(mbv, block, BlockTypes.AIR.getDefaultState().toBaseBlock());
|
||||
}
|
||||
@ -3497,13 +3497,13 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
||||
}
|
||||
} else {
|
||||
if (!conNextX) {
|
||||
setExistingBlocks(BlockVector3.at(bx + 16, 0, bz), BlockVector3.at(bx + 31, getMaxY(), bz + 15));
|
||||
setExistingBlocks(BlockVector3.at(bx + 16, 0, bz), BlockVector3.at(bx + 31, maxY, bz + 15));
|
||||
}
|
||||
if (!conNextZ) {
|
||||
setExistingBlocks(BlockVector3.at(bx, 0, bz + 16), BlockVector3.at(bx + 15, getMaxY(), bz + 31));
|
||||
setExistingBlocks(BlockVector3.at(bx, 0, bz + 16), BlockVector3.at(bx + 15, maxY, bz + 31));
|
||||
}
|
||||
if (!chunks.contains(mutable2D.setComponents(cx + 1, cz + 1)) && !conNextX && !conNextZ) {
|
||||
setExistingBlocks(BlockVector3.at(bx + 16, 0, bz + 16), BlockVector3.at(bx + 31, getMaxY(), bz + 31));
|
||||
setExistingBlocks(BlockVector3.at(bx + 16, 0, bz + 16), BlockVector3.at(bx + 31, maxY, bz + 31));
|
||||
}
|
||||
for (int x = 0; x < 16; x++) {
|
||||
int xx = x + bx;
|
||||
@ -3511,7 +3511,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
||||
for (int z = 0; z < 16; z++) {
|
||||
int zz = z + bz;
|
||||
mutable.mutZ(zz);
|
||||
for (int y = 0; y < getMaxY() + 1; y++) {
|
||||
for (int y = 0; y < maxY + 1; y++) {
|
||||
mutable.mutY(y);
|
||||
boolean contains = (fe == null || fe.contains(xx, y, zz)) && region.contains(mutable);
|
||||
if (contains) {
|
||||
|
@ -47,6 +47,7 @@ import java.util.Map;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
|
||||
|
@ -314,7 +314,7 @@ public class BlockState implements BlockStateHolder<BlockState>, FawePattern {
|
||||
|
||||
@Override
|
||||
public int getInternalId() {
|
||||
return blockType.getInternalId();
|
||||
return internalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -706,9 +706,9 @@ public final class BlockTypes {
|
||||
this.propertiesMapArr[key.ordinal()] = property;
|
||||
this.propertiesArr[prop_arr_i++] = property;
|
||||
propMap.put(entry.getKey(), property);
|
||||
bitOffset += property.getNumBits();
|
||||
|
||||
maxInternalStateId += (property.getValues().size() << bitOffset);
|
||||
bitOffset += property.getNumBits();
|
||||
}
|
||||
this.propertiesList = Arrays.asList(this.propertiesArr);
|
||||
this.propertiesMap = Collections.unmodifiableMap(propMap);
|
||||
@ -726,14 +726,17 @@ public final class BlockTypes {
|
||||
|
||||
if (!propertiesList.isEmpty()) {
|
||||
this.stateOrdinals = generateStateOrdinals(internalId, states.size(), maxInternalStateId, propertiesList);
|
||||
|
||||
for (int propId = 0; propId < this.stateOrdinals.length; propId++) {
|
||||
int ordinal = this.stateOrdinals[propId];
|
||||
if (ordinal != -1) {
|
||||
int stateId = internalId + (propId << BlockTypes.BIT_OFFSET);
|
||||
states.add(new BlockState(type, stateId, ordinal));
|
||||
BlockState state = new BlockState(type, stateId, ordinal);
|
||||
states.add(state);
|
||||
}
|
||||
}
|
||||
int defaultPropId = parseProperties(propertyString, propertiesMap) >> BlockTypes.BIT_OFFSET;
|
||||
|
||||
this.defaultState = states.get(this.stateOrdinals[defaultPropId]);
|
||||
} else {
|
||||
this.defaultState = new BlockState(type, internalId, states.size());
|
||||
@ -754,10 +757,10 @@ public final class BlockTypes {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static int[] generateStateOrdinals(int internalId, int ordinal, int maxStateId, List<AbstractProperty<?>> props) {
|
||||
if (props.isEmpty()) return null;
|
||||
int[] result = new int[maxStateId + 1];
|
||||
int[] result = new int[maxStateId];
|
||||
Arrays.fill(result, -1);
|
||||
int[] state = new int[props.size()];
|
||||
int[] sizes = new int[props.size()];
|
||||
@ -854,6 +857,7 @@ public final class BlockTypes {
|
||||
$REGISTRY.put(type.getId().toLowerCase(), type);
|
||||
}
|
||||
states = stateList.toArray(new BlockState[stateList.size()]);
|
||||
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren