SHARE
TWEET

Untitled

a guest Sep 21st, 2019 101 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package io.github.voidcloud.untitledmod.playerdata;
  2.  
  3. import nerdhub.cardinal.components.api.ComponentType;
  4. import nerdhub.cardinal.components.api.component.Component;
  5. import nerdhub.cardinal.components.api.util.sync.EntitySyncedComponent;
  6. import net.minecraft.entity.Entity;
  7. import net.minecraft.entity.player.PlayerEntity;
  8. import net.minecraft.nbt.CompoundTag;
  9.  
  10. public class HasArmComponent implements BoolComponent, EntitySyncedComponent {
  11.  
  12.     private boolean value = false;
  13.     private PlayerEntity player;
  14.  
  15.     public HasArmComponent(PlayerEntity player, boolean baseValue){
  16.         this.value = baseValue;
  17.         this.player = player;
  18.     }
  19.  
  20.     @Override
  21.     public boolean getValue() {
  22.         return this.value;
  23.     }
  24.  
  25.     @Override
  26.     public void setValue(boolean value) {
  27.         this.value = value;
  28.         this.markDirty();
  29.     }
  30.  
  31.     @Override
  32.     public void fromTag(CompoundTag compoundTag) {
  33.         this.value = compoundTag.getBoolean("value");
  34.     }
  35.  
  36.     @Override
  37.     public CompoundTag toTag(CompoundTag compoundTag) {
  38.         compoundTag.putBoolean("value", this.value);
  39.         return compoundTag;
  40.     }
  41.  
  42.     @Override
  43.     public Entity getEntity() {
  44.         return this.player;
  45.     }
  46.  
  47.     @Override
  48.     public ComponentType<?> getComponentType() {
  49.         return Components.PLAYER_HAS_ARM;
  50.     }
  51. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top