code cleanup
This commit is contained in:
parent
d6d934f1f3
commit
aa0ff6cf96
26 changed files with 207 additions and 276 deletions
|
@ -66,7 +66,6 @@ import common.util.BlockPos;
|
|||
import common.util.BoundingBox;
|
||||
import common.util.ChunkPos;
|
||||
import common.util.ExtMath;
|
||||
import common.util.FileUtils;
|
||||
import common.util.IntHashMap;
|
||||
import common.util.LongHashMap;
|
||||
import common.util.NextTickListEntry;
|
||||
|
@ -1002,6 +1001,30 @@ public final class WorldServer extends AWorldServer {
|
|||
map.clear();
|
||||
}
|
||||
|
||||
private static boolean deleteFiles(File[] files) {
|
||||
if(files == null) {
|
||||
Log.JNI.warn("Konnte Ordner nicht löschen");
|
||||
return false;
|
||||
}
|
||||
|
||||
for(int i = 0; i < files.length; ++i) {
|
||||
File file = files[i];
|
||||
Log.JNI.info("Lösche " + file);
|
||||
|
||||
if(file.isDirectory() && !deleteFiles(file.listFiles())) {
|
||||
Log.JNI.warn("Konnte Ordner " + file + " nicht löschen");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!file.delete()) {
|
||||
Log.JNI.warn("Konnte Datei " + file + " nicht löschen");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void saveAllChunks() {
|
||||
if(/* (force || !this.disableSaving) && */ !this.debug) {
|
||||
// if(this.primary) {
|
||||
|
@ -1667,7 +1690,7 @@ public final class WorldServer extends AWorldServer {
|
|||
iter.remove();
|
||||
}
|
||||
Region.finishWrite();
|
||||
FileUtils.deleteFiles(this.chunkDir.listFiles(new FileFilter() {
|
||||
deleteFiles(this.chunkDir.listFiles(new FileFilter() {
|
||||
public boolean accept(File file) {
|
||||
return file.isDirectory();
|
||||
}
|
||||
|
|
|
@ -3,18 +3,15 @@ package server.worldgen.feature;
|
|||
import common.block.BlockSand;
|
||||
import common.block.BlockSlab;
|
||||
import common.init.Blocks;
|
||||
import common.pattern.BlockStateHelper;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.util.Predicates;
|
||||
import common.world.State;
|
||||
import server.world.WorldServer;
|
||||
import server.worldgen.FeatureGenerator;
|
||||
|
||||
public class WorldGenDesertWells extends FeatureGenerator
|
||||
{
|
||||
private static final BlockStateHelper field_175913_a = BlockStateHelper.forBlock(Blocks.sand).where(BlockSand.VARIANT, Predicates.equalTo(BlockSand.EnumType.SAND));
|
||||
private final State field_175911_b = Blocks.sandstone_slab.getState().withProperty(BlockSlab.FACING, Facing.DOWN);
|
||||
private final State field_175912_c = Blocks.sandstone.getState();
|
||||
private final State field_175910_d = Blocks.flowing_water.getState();
|
||||
|
@ -26,7 +23,8 @@ public class WorldGenDesertWells extends FeatureGenerator
|
|||
position = position.down();
|
||||
}
|
||||
|
||||
if (!field_175913_a.test(worldIn.getState(position)))
|
||||
State state = worldIn.getState(position);
|
||||
if (state.getBlock() != Blocks.sand || state.getValue(BlockSand.VARIANT) != BlockSand.EnumType.SAND)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue