-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Former-commit-id: 4832064
- Loading branch information
CoolLoong
committed
Jul 8, 2023
1 parent
9e6a2fc
commit fd7694c
Showing
9 changed files
with
68 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 0 additions & 33 deletions
33
Allay-API/src/main/java/cn/allay/api/world/biome/BiomeType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,20 @@ | ||
package cn.allay.api.world.biome; | ||
|
||
import cn.allay.api.data.VanillaBiomeId; | ||
import lombok.ToString; | ||
|
||
/** | ||
* Allay Project 2023/6/3 | ||
* | ||
* @author daoge_cmd | ||
*/ | ||
public interface BiomeType { | ||
|
||
static BiomeType create(VanillaBiomeId id) { | ||
var type = new SimpleBiomeType(id.getName(), id.getId()); | ||
BiomeTypeRegistry.getRegistry().register(type.getName(), type); | ||
return type; | ||
} | ||
|
||
//TODO: Custom biome | ||
|
||
String getName(); | ||
|
||
int getId(); | ||
|
||
@ToString | ||
final class SimpleBiomeType implements BiomeType { | ||
private final String name; | ||
private final int id; | ||
|
||
public SimpleBiomeType(String name, int id) { | ||
this.name = name; | ||
this.id = id; | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return name; | ||
} | ||
|
||
@Override | ||
public int getId() { | ||
return id; | ||
} | ||
|
||
public String name() { | ||
return name; | ||
} | ||
|
||
public int id() { | ||
return id; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
Allay-API/src/main/java/cn/allay/api/world/biome/SimpleBiomeType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package cn.allay.api.world.biome; | ||
|
||
import com.google.common.base.Objects; | ||
|
||
final class SimpleBiomeType implements BiomeType { | ||
private final String name; | ||
private final int id; | ||
|
||
public SimpleBiomeType(String name, int id) { | ||
this.name = name; | ||
this.id = id; | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return name; | ||
} | ||
|
||
@Override | ||
public int getId() { | ||
return id; | ||
} | ||
|
||
public String name() { | ||
return name; | ||
} | ||
|
||
public int id() { | ||
return id; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
SimpleBiomeType that = (SimpleBiomeType) o; | ||
return Objects.equal(name, that.name); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hashCode(name); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters