use of gregtech.api.cover.CoverBehavior in project GregTech by GregTechCE.
the class PipeCoverableImplementation method readFromNBT.
public void readFromNBT(NBTTagCompound data) {
NBTTagList coversList = data.getTagList("Covers", NBT.TAG_COMPOUND);
for (int index = 0; index < coversList.tagCount(); index++) {
NBTTagCompound tagCompound = coversList.getCompoundTagAt(index);
if (tagCompound.hasKey("CoverId", NBT.TAG_STRING)) {
EnumFacing coverSide = EnumFacing.VALUES[tagCompound.getByte("Side")];
ResourceLocation coverId = new ResourceLocation(tagCompound.getString("CoverId"));
CoverDefinition coverDefinition = CoverDefinition.getCoverById(coverId);
CoverBehavior coverBehavior = coverDefinition.createCoverBehavior(this, coverSide);
coverBehavior.readFromNBT(tagCompound);
this.coverBehaviors[coverSide.getIndex()] = coverBehavior;
}
}
}
use of gregtech.api.cover.CoverBehavior in project GregTech by GregTechCE.
the class PipeCoverableImplementation method transferDataTo.
public void transferDataTo(PipeCoverableImplementation destImpl) {
for (EnumFacing coverSide : EnumFacing.VALUES) {
CoverBehavior behavior = coverBehaviors[coverSide.getIndex()];
if (behavior == null)
continue;
NBTTagCompound tagCompound = new NBTTagCompound();
behavior.writeToNBT(tagCompound);
CoverBehavior newBehavior = behavior.getCoverDefinition().createCoverBehavior(destImpl, coverSide);
newBehavior.readFromNBT(tagCompound);
destImpl.coverBehaviors[coverSide.getIndex()] = newBehavior;
}
}
Aggregations