-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ea23d78
commit e5e5a49
Showing
34 changed files
with
460 additions
and
261 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 4 additions & 16 deletions
20
src/main/java/limonblaze/originsclasses/common/apoli/power/ModifyBreedingPower.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,29 @@ | ||
package limonblaze.originsclasses.common.apoli.power; | ||
|
||
import io.github.edwinmindcraft.apoli.api.component.IPowerContainer; | ||
import io.github.edwinmindcraft.apoli.api.power.IValueModifyingPower; | ||
import io.github.edwinmindcraft.apoli.api.power.configuration.ConfiguredBiEntityAction; | ||
import io.github.edwinmindcraft.apoli.api.power.configuration.ConfiguredBiEntityCondition; | ||
import io.github.edwinmindcraft.apoli.api.power.configuration.ConfiguredEntityAction; | ||
import io.github.edwinmindcraft.apoli.api.power.configuration.ConfiguredPower; | ||
import io.github.edwinmindcraft.apoli.api.power.factory.PowerFactory; | ||
import io.github.edwinmindcraft.apoli.api.power.factory.power.ValueModifyingPowerFactory; | ||
import limonblaze.originsclasses.common.apoli.configuration.ModifyBreedingConfiguration; | ||
import limonblaze.originsclasses.common.registry.OriginsClassesPowers; | ||
import limonblaze.originsclasses.util.PowerUtil; | ||
import net.minecraft.world.entity.Entity; | ||
import net.minecraft.world.entity.ai.attributes.AttributeModifier; | ||
import limonblaze.originsclasses.util.MathUtils; | ||
import net.minecraft.world.entity.animal.Animal; | ||
import net.minecraft.world.entity.player.Player; | ||
|
||
import javax.annotation.Nonnull; | ||
import java.util.List; | ||
|
||
public class ModifyBreedingPower extends PowerFactory<ModifyBreedingConfiguration> implements IValueModifyingPower<ModifyBreedingConfiguration> { | ||
public class ModifyBreedingPower extends ValueModifyingPowerFactory<ModifyBreedingConfiguration> { | ||
|
||
public ModifyBreedingPower() { | ||
super(ModifyBreedingConfiguration.CODEC); | ||
} | ||
|
||
public static int getBreedAmount(Player player, Animal actor, Animal target) { | ||
return PowerUtil.naturalRandFloor(IPowerContainer.modify(player, OriginsClassesPowers.MODIFY_BREEDING.get(), 1.0D, | ||
return MathUtils.naturalRandFloor(IPowerContainer.modify(player, OriginsClassesPowers.MODIFY_BREEDING.get(), 1.0D, | ||
cp -> cp.isActive(player) && ConfiguredBiEntityCondition.check(cp.getConfiguration().parentsCondition(), actor, target), | ||
cp -> { | ||
ConfiguredBiEntityAction.execute(cp.getConfiguration().parentsAction(), actor, target); | ||
ConfiguredEntityAction.execute(cp.getConfiguration().playerAction(), player); | ||
}), player.getRandom()); | ||
} | ||
|
||
@Override | ||
public @Nonnull List<AttributeModifier> getModifiers(ConfiguredPower<ModifyBreedingConfiguration, ?> configuredPower, Entity entity) { | ||
return configuredPower.getConfiguration().modifiers().getContent(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.