Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package io.github.voidcloud.untitledmod.playerdata;
- import nerdhub.cardinal.components.api.ComponentType;
- import nerdhub.cardinal.components.api.component.Component;
- import nerdhub.cardinal.components.api.util.sync.EntitySyncedComponent;
- import net.minecraft.entity.Entity;
- import net.minecraft.entity.player.PlayerEntity;
- import net.minecraft.nbt.CompoundTag;
- public class HasArmComponent implements BoolComponent, EntitySyncedComponent {
- private boolean value = false;
- private PlayerEntity player;
- public HasArmComponent(PlayerEntity player, boolean baseValue){
- this.value = baseValue;
- this.player = player;
- }
- @Override
- public boolean getValue() {
- return this.value;
- }
- @Override
- public void setValue(boolean value) {
- this.value = value;
- this.markDirty();
- }
- @Override
- public void fromTag(CompoundTag compoundTag) {
- this.value = compoundTag.getBoolean("value");
- }
- @Override
- public CompoundTag toTag(CompoundTag compoundTag) {
- compoundTag.putBoolean("value", this.value);
- return compoundTag;
- }
- @Override
- public Entity getEntity() {
- return this.player;
- }
- @Override
- public ComponentType<?> getComponentType() {
- return Components.PLAYER_HAS_ARM;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement