mirror of
https://github.com/GTNewHorizons/CraftTweaker.git
synced 2026-11-24 22:04:23 +00:00
[ci skip] spotlessApply with the new settings
This commit is contained in:
1 parent
6b208b98bc
commit
a309488cdf
214 files changed
+9283
-9265
No files matched your search
@@ -1,14 +1,15 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
* To change this license header, choose License Headers in Project Properties. To change this template file, choose
|
||||
* Tools | Templates and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.mc1710.data;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import minetweaker.api.data.IData;
|
||||
import minetweaker.api.data.IDataConverter;
|
||||
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
@@ -17,31 +18,32 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
* @author Stan
|
||||
*/
|
||||
public class NBTUpdater extends NBTConverter implements IDataConverter<NBTBase> {
|
||||
private final NBTTagCompound nbt;
|
||||
|
||||
public NBTUpdater(NBTTagCompound compound) {
|
||||
this.nbt = compound;
|
||||
}
|
||||
private final NBTTagCompound nbt;
|
||||
|
||||
@Override
|
||||
public NBTBase fromMap(Map<String, IData> map) {
|
||||
for (Map.Entry<String, IData> entry : map.entrySet()) {
|
||||
if (nbt.hasKey(entry.getKey())) {
|
||||
if (entry.getValue() == null) {
|
||||
nbt.removeTag(entry.getKey());
|
||||
} else {
|
||||
if (nbt.getTag(entry.getKey()).getId() == 10) {
|
||||
NBTTagCompound tag = (NBTTagCompound) nbt.getTag(entry.getKey());
|
||||
nbt.setTag(entry.getKey(), entry.getValue().convert(new NBTUpdater(nbt)));
|
||||
} else {
|
||||
nbt.setTag(entry.getKey(), from(entry.getValue()));
|
||||
}
|
||||
}
|
||||
} else if (entry.getValue() != null) {
|
||||
nbt.setTag(entry.getKey(), from(entry.getValue()));
|
||||
}
|
||||
}
|
||||
public NBTUpdater(NBTTagCompound compound) {
|
||||
this.nbt = compound;
|
||||
}
|
||||
|
||||
return nbt;
|
||||
}
|
||||
@Override
|
||||
public NBTBase fromMap(Map<String, IData> map) {
|
||||
for (Map.Entry<String, IData> entry : map.entrySet()) {
|
||||
if (nbt.hasKey(entry.getKey())) {
|
||||
if (entry.getValue() == null) {
|
||||
nbt.removeTag(entry.getKey());
|
||||
} else {
|
||||
if (nbt.getTag(entry.getKey()).getId() == 10) {
|
||||
NBTTagCompound tag = (NBTTagCompound) nbt.getTag(entry.getKey());
|
||||
nbt.setTag(entry.getKey(), entry.getValue().convert(new NBTUpdater(nbt)));
|
||||
} else {
|
||||
nbt.setTag(entry.getKey(), from(entry.getValue()));
|
||||
}
|
||||
}
|
||||
} else if (entry.getValue() != null) {
|
||||
nbt.setTag(entry.getKey(), from(entry.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
return nbt;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user