Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class CoolDownProvider implements ICapabilitySerializable<CompoundNBT>
- {
- private final DefaultCoolDownCapability ticksIn = new DefaultCoolDownCapability();
- private final LazyOptional<ICoolDown> ticksInOptional = LazyOptional.of(() -> ticksIn);
- public void invalidate() { ticksInOptional.invalidate(); }
- @Nullable
- @Override
- public <T> LazyOptional<T> getCapability( Capability<T> cap, Direction side) {
- return ticksInOptional.cast();
- }
- @Override
- public CompoundNBT serializeNBT() {
- if(CoolDownCapability.COOLDOWN_CAPABILITY == null)
- return new CompoundNBT();
- else
- return (CompoundNBT) CoolDownCapability.COOLDOWN_CAPABILITY.writeNBT(ticksIn, null);
- }
- @Override
- public void deserializeNBT(CompoundNBT nbt) {
- if(CoolDownCapability.COOLDOWN_CAPABILITY != null)
- CoolDownCapability.COOLDOWN_CAPABILITY.readNBT(ticksIn, null, nbt);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement