-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
de97e50
commit 98d2ae5
Showing
3 changed files
with
54 additions
and
0 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
40 changes: 40 additions & 0 deletions
40
src/main/java/supersymmetry/datafix/SupercriticalDataFixer.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,40 @@ | ||
package supersymmetry.datafix; | ||
|
||
import net.minecraft.nbt.NBTTagCompound; | ||
import net.minecraft.util.datafix.IFixableData; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
public class SupercriticalDataFixer implements IFixableData { | ||
|
||
private static final Set<String> PREFIXES = new HashSet<>(); | ||
|
||
@Override | ||
public int getFixVersion() { | ||
return 3; | ||
} | ||
|
||
@Override | ||
public @NotNull NBTTagCompound fixTagCompound(@NotNull NBTTagCompound compound) { | ||
final short meta = compound.getShort("Damage"); | ||
final String id = compound.getString("id"); | ||
if (id.startsWith("gregtech:meta_")) { | ||
final String prefix = id.replace("gregtech:meta_", ""); | ||
if (PREFIXES.contains(prefix) && meta == 7047) { | ||
compound.setString("id", "supercritical:meta_" + prefix); | ||
compound.setShort("Damage", (short) 506); | ||
} | ||
} | ||
return compound; | ||
} | ||
|
||
static { | ||
PREFIXES.add("dust_tiny"); | ||
PREFIXES.add("dust"); | ||
PREFIXES.add("dust_small"); | ||
PREFIXES.add("gem"); | ||
PREFIXES.add("block_compressed_440"); | ||
} | ||
} |