Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-09-06 08:02:50 +02:00
WIP level dat for MCAWorld
Dieser Commit ist enthalten in:
Ursprung
d7b3db215e
Commit
54f62e689b
@ -0,0 +1,46 @@
|
|||||||
|
package com.boydti.fawe.jnbt.anvil;
|
||||||
|
|
||||||
|
import com.boydti.fawe.object.io.PGZIPOutputStream;
|
||||||
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
|
import com.sk89q.jnbt.NBTInputStream;
|
||||||
|
import com.sk89q.jnbt.NBTOutputStream;
|
||||||
|
import it.unimi.dsi.fastutil.io.FastBufferedInputStream;
|
||||||
|
import it.unimi.dsi.fastutil.io.FastBufferedOutputStream;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.zip.GZIPInputStream;
|
||||||
|
import java.util.zip.GZIPOutputStream;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkArgument;
|
||||||
|
|
||||||
|
public class LevelDat {
|
||||||
|
private final File file;
|
||||||
|
private CompoundTag tag;
|
||||||
|
|
||||||
|
public LevelDat(File file) {
|
||||||
|
checkArgument(file.exists());
|
||||||
|
this.file = file;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void load() throws IOException {
|
||||||
|
try (NBTInputStream nis = new NBTInputStream(new FastBufferedInputStream(new GZIPInputStream(new FastBufferedInputStream(new FileInputStream(file)))))) {
|
||||||
|
this.tag = (CompoundTag) nis.readNamedTag().getTag();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void save() throws IOException {
|
||||||
|
if (this.tag != null) {
|
||||||
|
try (NBTOutputStream nos = new NBTOutputStream(new FastBufferedOutputStream(new GZIPOutputStream(new FastBufferedOutputStream(new FileOutputStream(file)))))) {
|
||||||
|
nos.writeNamedTag("", tag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public CompoundTag getTag() {
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
|
}
|
@ -1,23 +1,93 @@
|
|||||||
package com.boydti.fawe.jnbt.anvil;
|
package com.boydti.fawe.jnbt.anvil;
|
||||||
|
|
||||||
|
import com.boydti.fawe.beta.IChunkGet;
|
||||||
|
import com.boydti.fawe.beta.implementation.packet.ChunkPacket;
|
||||||
|
import com.google.common.base.Preconditions;
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
|
import com.sk89q.worldedit.EditSession;
|
||||||
|
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
|
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||||
|
import com.sk89q.worldedit.entity.Player;
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
|
import com.sk89q.worldedit.math.Vector3;
|
||||||
|
import com.sk89q.worldedit.regions.Region;
|
||||||
|
import com.sk89q.worldedit.util.TreeGenerator;
|
||||||
|
import com.sk89q.worldedit.world.AbstractWorld;
|
||||||
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
|
|
||||||
public class MCAWorld implements Extent {
|
import javax.annotation.Nullable;
|
||||||
@Override
|
import java.io.File;
|
||||||
public BlockVector3 getMinimumPoint() {
|
|
||||||
return null;
|
import static com.google.common.base.Preconditions.checkArgument;
|
||||||
|
|
||||||
|
public class MCAWorld extends AbstractWorld {
|
||||||
|
private final File path;
|
||||||
|
|
||||||
|
public MCAWorld(File path) {
|
||||||
|
checkArgument(path.isDirectory());
|
||||||
|
this.path = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockVector3 getMaximumPoint() {
|
public String getName() {
|
||||||
return null;
|
return path.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setTile(int x, int y, int z, CompoundTag tile) throws WorldEditException {
|
public boolean setTile(int x, int y, int z, CompoundTag tile) throws WorldEditException {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean notifyAndLightBlock(BlockVector3 position, BlockState previousType) throws WorldEditException {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean clearContainerBlockContents(BlockVector3 position) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dropItem(Vector3 position, BaseItemStack item) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void simulateBlockMine(BlockVector3 position) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean regenerate(Region region, EditSession editSession) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean generateTree(TreeGenerator.TreeType type, EditSession editSession, BlockVector3 position) throws MaxChangedBlocksException {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockVector3 getSpawnPosition() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void refreshChunk(int chunkX, int chunkZ) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IChunkGet get(int x, int z) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendFakeChunk(@Nullable Player player, ChunkPacket packet) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren