generated from CleanroomMC/TemplateDevEnv
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
modify frozen and vanilla registries too
- Loading branch information
Showing
4 changed files
with
118 additions
and
16 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
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
48 changes: 48 additions & 0 deletions
48
src/main/java/com/cleanroommc/groovyscript/registry/VirtualizedForgeRegistryEntry.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,48 @@ | ||
package com.cleanroommc.groovyscript.registry; | ||
|
||
import net.minecraftforge.registries.IForgeRegistryEntry; | ||
|
||
import java.util.Objects; | ||
|
||
public class VirtualizedForgeRegistryEntry<T extends IForgeRegistryEntry<T>> { | ||
|
||
private final T value; | ||
private final int id; | ||
private final Object override; | ||
|
||
public VirtualizedForgeRegistryEntry(T value, int id, Object override) { | ||
this.value = value; | ||
this.id = id; | ||
this.override = override; | ||
} | ||
|
||
public T getValue() { | ||
return value; | ||
} | ||
|
||
public int getId() { | ||
return id; | ||
} | ||
|
||
public Object getOverride() { | ||
return override; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
VirtualizedForgeRegistryEntry<?> that = (VirtualizedForgeRegistryEntry<?>) o; | ||
return id == that.id && Objects.equals(value, that.value); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(value, id); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return value.getRegistryName().toString(); | ||
} | ||
} |