Advertisement
Guest User

Untitled

a guest
Sep 21st, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.34 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement