Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class StaffStorage implements Capability.IStorage<IStaff> {
- @Deprecated
- @Override
- public INBT writeNBT(Capability<IStaff> capability, IStaff instance, Direction side) {
- CompoundNBT nbt = new CompoundNBT();
- if(instance.getCastSound().toString() != null)
- nbt.putString("cast_sound", Registry.SOUND_EVENT.getKey(instance.getCastSound()).toString());
- if(instance.getEmptySound().toString() != null)
- nbt.putString("empty_sound", Registry.SOUND_EVENT.getKey(instance.getEmptySound()).toString());
- return nbt;
- }
- @Deprecated
- @Override
- public void readNBT(Capability<IStaff> capability, IStaff instance, Direction side, INBT nbt) {
- CompoundNBT tag = (CompoundNBT)nbt;
- instance.castSound(Registry.SOUND_EVENT.getOptional(new ResourceLocation(tag.getString("cast_sound"))).orElse(SoundInit.BASIC_MAGIC_SHOOT));
- instance.emptySound(Registry.SOUND_EVENT.getOptional(new ResourceLocation(tag.getString("empty_sound"))).orElse(SoundInit.BASIC_EMPTY_SPELLCAST));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment