Fixed some bugs and cleanup some code.

This commit is contained in:
Matthew Miller
2018-08-13 22:18:12 +10:00
parent f96487a2d1
commit e0e7778536
22 changed files with 92 additions and 394 deletions

View File

@ -51,29 +51,9 @@ public abstract class BlockBag {
public void fetchPlacedBlock(BlockState blockState) throws BlockBagException {
try {
// Blocks that can't be fetched...
// TODO switch (id) {
// case BlockID.BEDROCK:
// case BlockID.GOLD_ORE:
// case BlockID.IRON_ORE:
// case BlockID.COAL_ORE:
// case BlockID.DIAMOND_ORE:
// case BlockID.TNT:
// case BlockID.MOB_SPAWNER:
// case BlockID.CROPS:
// case BlockID.REDSTONE_ORE:
// case BlockID.GLOWING_REDSTONE_ORE:
// case BlockID.SNOW:
// case BlockID.LIGHTSTONE:
// case BlockID.PORTAL:
// throw new UnplaceableBlockException();
//
// case BlockID.WATER:
// case BlockID.STATIONARY_WATER:
// case BlockID.LAVA:
// case BlockID.STATIONARY_LAVA:
// // Override liquids
// return;
// }
if (blockState.getBlockType().getMaterial().isReplacedDuringPlacement()) {
return;
}
fetchBlock(blockState);
} catch (OutOfBlocksException e) {
BlockState placed = blockState;// TODO BlockType.getBlockBagItem(id, data);

View File

@ -21,10 +21,8 @@ package com.sk89q.worldedit.extent.reorder;
import com.google.common.collect.Iterators;
import com.sk89q.worldedit.BlockVector;
import com.sk89q.worldedit.PlayerDirection;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.blocks.BlockType;
import com.sk89q.worldedit.blocks.Blocks;
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
import com.sk89q.worldedit.extent.Extent;
@ -175,19 +173,18 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder
}
}
final PlayerDirection attachment = BlockType.getAttachment(blockStateHolder.getBlockType().getLegacyId(), 0); // TODO
if (attachment == null) {
if (!blockStateHolder.getBlockType().getMaterial().isFragileWhenPushed()) {
// Block is not attached to anything => we can place it
break;
}
current = current.add(attachment.vector()).toBlockVector();
if (!blocks.contains(current)) {
// We ran outside the remaining set => assume we can place blocks on this
break;
}
// current = current.add(attachment.vector()).toBlockVector();
//
// if (!blocks.contains(current)) {
// // We ran outside the remaining set => assume we can place blocks on this
// break;
// }
//
if (walked.contains(current)) {
// Cycle detected => This will most likely go wrong, but there's nothing we can do about it.
break;