Merge remote-tracking branch 'refs/remotes/sk89q/master'

# Conflicts:

#	worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBlockRegistry.java
#	worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java

#	worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BlockMaterial.java

#	worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloatingTreeRemover.java

#	worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/LongRangeBuildTool.java

#	worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/RecursivePickaxe.java

#	worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/GravityBrush.java

#	worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java

#	worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBagExtent.java
#	worldedit-core/src/main/java/com/sk89q/worldedit/util/TargetBlock.java

#	worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/OldChunk.java

#	worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/PassthroughBlockMaterial.java
This commit is contained in:
Jesse Boyd 2018-08-16 20:06:27 +10:00
commit 6ebdc00fba
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
5 changed files with 70 additions and 5 deletions

View File

@ -2424,6 +2424,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
if (dx2 + dz2 > radiusSq) {
continue;
}
<<<<<<< HEAD
outer:
for (int y = maxY; y >= 1; --y) {
BlockType type = getBlockType(x, y, z);
@ -2441,6 +2442,29 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
case JUNGLE_LEAVES:
case OAK_LEAVES:
case SPRUCE_LEAVES:
=======
for (int y = world.getMaxY(); y >= 1; --y) {
Vector pt = new Vector(x, y, z);
BlockType id = getBlock(pt).getBlockType();
if (id.getMaterial().isAir()) {
continue;
}
// Ice!
if (id == BlockTypes.WATER) {
if (setBlock(pt, ice)) {
++affected;
}
break;
}
// Snow should not cover these blocks
if (id.getMaterial().isTranslucent()) {
// Add snow on leaves
if (!BlockCategories.LEAVES.contains(id)) {
>>>>>>> refs/remotes/sk89q/master
break;
default:
if (type.getMaterial().isTranslucent()) {
@ -2545,6 +2569,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
* @return number of trees created
* @throws MaxChangedBlocksException thrown if too many blocks are changed
*/
<<<<<<< HEAD
public int makeForest(final Vector basePosition, final int size, final double density, TreeGenerator.TreeType treeType) {
try {
for (int x = basePosition.getBlockX() - size; x <= (basePosition.getBlockX() + size); ++x) {
@ -2576,6 +2601,35 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
default:
break;
}
=======
public int makeForest(Vector basePosition, int size, double density, TreeGenerator.TreeType treeType) throws MaxChangedBlocksException {
int affected = 0;
for (int x = basePosition.getBlockX() - size; x <= basePosition.getBlockX()
+ size; ++x) {
for (int z = basePosition.getBlockZ() - size; z <= basePosition.getBlockZ()
+ size; ++z) {
// Don't want to be in the ground
if (!getBlock(new Vector(x, basePosition.getBlockY(), z)).getBlockType().getMaterial().isAir()) {
continue;
}
// The gods don't want a tree here
if (Math.random() >= density) {
continue;
} // def 0.05
for (int y = basePosition.getBlockY(); y >= basePosition.getBlockY() - 10; --y) {
// Check if we hit the ground
BlockType t = getBlock(new Vector(x, y, z)).getBlockType();
if (t == BlockTypes.GRASS_BLOCK || t == BlockTypes.DIRT) {
treeType.generate(this, new Vector(x, y + 1, z));
++affected;
break;
} else if (t == BlockTypes.SNOW) {
setBlock(new Vector(x, y, z), BlockTypes.AIR.getDefaultState());
} else if (!t.getMaterial().isAir()) { // Trees won't grow on this!
break;
>>>>>>> refs/remotes/sk89q/master
}
}
}

View File

@ -25,8 +25,9 @@ package com.sk89q.worldedit.blocks;
public interface BlockMaterial {
/**
* Get if this block is air
* @return
* Gets if this block is a type of air.
*
* @return If it's air
*/
boolean isAir();

View File

@ -62,7 +62,7 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo
if (applied.getBlockType().getMaterial().isAir()) {
eS.setBlock(pos.toVector(), secondary);
} else {
eS.setBlock(pos.getDirection(), secondary);
eS.setBlock(pos.add(pos.getDirection()), secondary);
}
return true;
}
@ -76,7 +76,7 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo
if (applied.getBlockType().getMaterial().isAir()) {
eS.setBlock(pos.toVector(), primary);
} else {
eS.setBlock(pos.getDirection(), primary);
eS.setBlock(pos.add(pos.getDirection()), primary);
}
return true;
}

View File

@ -156,7 +156,7 @@ public class OldChunk implements Chunk {
@Override
public BlockState getBlock(Vector position) throws DataException {
if(position.getBlockY() >= 128) return BlockTypes.AIR.getDefaultState();
if(position.getBlockY() >= 128) return BlockTypes.VOID_AIR.getDefaultState();
int id, dataVal;
int x = position.getBlockX() - rootX * 16;

View File

@ -23,6 +23,7 @@ import com.sk89q.worldedit.blocks.BlockMaterial;
class SimpleBlockMaterial implements BlockMaterial {
private boolean isAir;
private boolean fullCube;
private boolean opaque;
private boolean powerSource;
@ -72,6 +73,15 @@ class SimpleBlockMaterial implements BlockMaterial {
this.lightOpacity = lightOpacity;
}
@Override
public boolean isAir() {
return this.isAir;
}
public void setIsAir(boolean isAir) {
this.isAir = isAir;
}
@Override
public boolean isFullCube() {
return fullCube;