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

View File

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