Config refactor
This commit is contained in:
parent
7f2bad86ca
commit
0f12a477e0
10 changed files with 408 additions and 265 deletions
56
src/main/java/ru/betterend/config/ConfigKey.java
Normal file
56
src/main/java/ru/betterend/config/ConfigKey.java
Normal file
|
@ -0,0 +1,56 @@
|
|||
package ru.betterend.config;
|
||||
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
public class ConfigKey {
|
||||
private final Identifier category;
|
||||
private final Identifier parameter;
|
||||
|
||||
public ConfigKey(Identifier category, Identifier parameter) {
|
||||
this.category = category;
|
||||
this.parameter = parameter;
|
||||
}
|
||||
|
||||
public Identifier getCategory() {
|
||||
return category;
|
||||
}
|
||||
|
||||
public Identifier getParameter() {
|
||||
return parameter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((category == null) ? 0 : category.hashCode());
|
||||
result = prime * result + ((parameter == null) ? 0 : parameter.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (!(obj instanceof ConfigKey)) {
|
||||
return false;
|
||||
}
|
||||
ConfigKey other = (ConfigKey) obj;
|
||||
if (category == null) {
|
||||
if (other.category != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!category.equals(other.category)) {
|
||||
return false;
|
||||
}
|
||||
if (parameter == null) {
|
||||
if (other.parameter != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!parameter.equals(other.parameter)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue