Skip to content

Commit

Permalink
Fixed eliteMob
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrigan committed Jul 24, 2024
1 parent 81ba906 commit 28bd58c
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.Mob;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.ICapabilityProvider;
import net.minecraftforge.common.util.INBTSerializable;
Expand All @@ -21,12 +22,12 @@ public class AttacherEliteMob {
private static class EliteMobProvider implements ICapabilityProvider, INBTSerializable<CompoundTag> {

public static final ResourceLocation IDENTIFIER = new ResourceLocation(MODID, "elite_mob");
private final BuiltInEnchantments backend = new BuiltInEnchantments();
private final LazyOptional<BuiltInEnchantments> optionalData = LazyOptional.of(() -> backend);
private final EliteMob backend = new EliteMob();
private final LazyOptional<EliteMob> optionalData = LazyOptional.of(() -> backend);

@Override
public <T> @NotNull LazyOptional<T> getCapability(@NotNull Capability<T> cap, Direction side) {
return ModCapabilities.BUILT_IN_ENCHANTMENTS_CAPABILITY.orEmpty(cap, this.optionalData);
return ModCapabilities.ELITE_MOB_CAPABILITY.orEmpty(cap, this.optionalData);
}

@Override
Expand All @@ -41,7 +42,7 @@ public void deserializeNBT(CompoundTag nbt) {
}

public static void attach(final AttachCapabilitiesEvent<Entity> event) {
if (event.getObject() instanceof LivingEntity) {
if (event.getObject() instanceof Mob) {
final EliteMobProvider provider = new EliteMobProvider();
event.addCapability(EliteMobProvider.IDENTIFIER, provider);
}
Expand Down

0 comments on commit 28bd58c

Please sign in to comment.