Skip to content

Commit

Permalink
fix: Save stored entity on solar panels
Browse files Browse the repository at this point in the history
Closes: GH-795
  • Loading branch information
Rover656 committed Sep 24, 2024
1 parent fad1a99 commit 38b0415
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.component.DataComponentMap;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.Inventory;
Expand Down Expand Up @@ -247,6 +248,15 @@ protected void applyImplicitComponents(DataComponentInput components) {
entityData = components.getOrDefault(EIODataComponents.STORED_ENTITY, StoredEntityData.EMPTY);
}

@Override
protected void collectImplicitComponents(DataComponentMap.Builder components) {
super.collectImplicitComponents(components);

if (entityData.hasEntity()) {
components.set(EIODataComponents.STORED_ENTITY, entityData);
}
}

public Optional<ResourceLocation> getEntityType() {
return entityData.entityType();
}
Expand Down

0 comments on commit 38b0415

Please sign in to comment.