cleanup: getBlockSet/Replaced in class BlockChange

This commit is contained in:
Brokkonaut
2018-09-12 21:18:43 +02:00
parent 3ef6e48ca4
commit d214b646db
2 changed files with 12 additions and 4 deletions

View File

@ -70,8 +70,8 @@ public class BlockChange implements LookupCacheElement {
@Override
public String toString() {
BlockData type = MaterialConverter.getBlockData(typeMaterial, typeData);
BlockData replaced = MaterialConverter.getBlockData(replacedMaterial, replacedData);
BlockData type = getBlockSet();
BlockData replaced = getBlockReplaced();
String typeDetails = null;
if (BlockStateCodecs.hasCodec(type.getMaterial())) {
try {
@ -158,6 +158,14 @@ public class BlockChange implements LookupCacheElement {
return msg.toString();
}
public BlockData getBlockReplaced() {
return MaterialConverter.getBlockData(replacedMaterial, replacedData);
}
public BlockData getBlockSet() {
return MaterialConverter.getBlockData(typeMaterial, typeData);
}
@Override
public Location getLocation() {
return loc;

View File

@ -165,8 +165,8 @@ public class WorldEditor implements Runnable {
}
PerformResult perform() throws WorldEditorException {
BlockData replacedBlock = MaterialConverter.getBlockData(this.replacedMaterial, replacedData);
BlockData setBlock = MaterialConverter.getBlockData(this.typeMaterial, typeData);
BlockData replacedBlock = getBlockReplaced();
BlockData setBlock = getBlockSet();
if (replacedBlock == null || setBlock == null) {
throw new WorldEditorException("Could not parse the material", loc.clone());
}