mirror of
https://github.com/TeamMidnightDust/ThisRocks.git
synced 2025-12-17 03:15:09 +01:00
clean: improve code of rock fragments
This commit is contained in:
@@ -23,15 +23,11 @@ public enum RockType {
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
public String getSplitterName() {
|
||||
String splitterName = this.name().toLowerCase()+ "_splitter";
|
||||
if (this.equals(RockType.STONE)) splitterName = "cobblestone_splitter";
|
||||
return splitterName;
|
||||
}
|
||||
|
||||
public Identifier getStoneId() {
|
||||
if (this==STONE) return Identifier.ofVanilla("cobblestone");
|
||||
return Identifier.ofVanilla(this.toString().toLowerCase());
|
||||
}
|
||||
|
||||
public Block getStoneBlock() {
|
||||
return Registries.BLOCK.get(getStoneId());
|
||||
}
|
||||
@@ -54,4 +50,29 @@ public enum RockType {
|
||||
.replace("large_", "")
|
||||
.equals(type.getName())).findFirst().orElse(RockType.STONE);
|
||||
}
|
||||
|
||||
public Fragment getFragment() {
|
||||
return new Fragment(this);
|
||||
}
|
||||
|
||||
public static class Fragment {
|
||||
private final RockType type;
|
||||
|
||||
Fragment(RockType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
String splitterName = type.name().toLowerCase()+ "_splitter";
|
||||
if (type.equals(RockType.STONE)) splitterName = "cobblestone_splitter";
|
||||
return splitterName;
|
||||
}
|
||||
public Identifier getStoneId() {
|
||||
if (type==STONE) return Identifier.ofVanilla("cobblestone");
|
||||
return Identifier.ofVanilla(type.toString().toLowerCase());
|
||||
}
|
||||
public Block getStoneBlock() {
|
||||
return Registries.BLOCK.get(getStoneId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user