Better support for material data, fix default legacy config typos

This commit is contained in:
Esophose 2019-03-31 03:08:41 -06:00
parent 86dbb57ac2
commit d47ebbb64b
3 changed files with 20 additions and 11 deletions

View File

@ -67,16 +67,18 @@ public class LegacyAdapter implements VersionAdapter {
treeBlockData = new LegacyBlockData(fallingBlock.getMaterial(), data);
} else return drops;
Set<IBlockData> typedBlockData = treeBlock.getTreeBlockType().equals(TreeBlockType.LOG) ? treeDefinition.getLogBlockData() : treeDefinition.getLeafBlockData();
IBlockData definitionBlockData = null;
if (treeBlock.getTreeBlockType().equals(TreeBlockType.LOG)) {
for (IBlockData blockData : treeDefinition.getLogBlockData()) {
if (blockData.getMaterial().equals(treeBlockData.getMaterial())) {
definitionBlockData = blockData;
break;
}
for (IBlockData blockData : typedBlockData) {
if (blockData.getMaterial().equals(treeBlockData.getMaterial()) && blockData.getData() == treeBlockData.getData()) {
definitionBlockData = blockData;
break;
}
} else {
for (IBlockData blockData : treeDefinition.getLeafBlockData()) {
}
if (definitionBlockData == null) {
for (IBlockData blockData : typedBlockData) {
if (blockData.getMaterial().equals(treeBlockData.getMaterial())) {
definitionBlockData = blockData;
break;

View File

@ -30,8 +30,12 @@ public class LegacyBlockData implements IBlockData {
@Override
public boolean isSimilar(IBlockData otherBlockData) {
if (this.data.size() == 1)
return this.material.equals(otherBlockData.getMaterial()) && this.getData() == otherBlockData.getData();
Material blockMaterial = otherBlockData.getMaterial();
byte blockData = otherBlockData.getData();
if (!this.material.equals(blockMaterial))
return false;
for (byte value : this.data)
@ -42,6 +46,9 @@ public class LegacyBlockData implements IBlockData {
@Override
public boolean isSimilar(Block block) {
if (this.data.size() == 1)
return this.material.equals(block.getType()) && this.getData() == block.getData();
Material blockMaterial = block.getType();
byte blockData = block.getData();
if (!this.material.equals(blockMaterial))

View File

@ -222,9 +222,9 @@ trees:
required-tools: []
dark_oak:
logs:
- LOG:1,5,9,13
- LOG_2:1,5,9,13
leaves:
- LEAVES:1,5,9,13
- LEAVES_2:1,5,9,13
sapling: SAPLING:5
plantable-soil: []
max-leaf-distance-from-log: 5
@ -248,7 +248,7 @@ trees:
sapling: BROWN_MUSHROOM
plantable-soil:
- MYCEL
max-leaf-distance-from-log: 4
max-leaf-distance-from-log: 6
search-for-leaves-diagonally: false
drop-original-log: false
drop-original-leaf: false