-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
transform EnumBloodSource into a context object
- Loading branch information
1 parent
eaff090
commit 7aeb15e
Showing
20 changed files
with
194 additions
and
107 deletions.
There are no files selected for viewing
11 changes: 0 additions & 11 deletions
11
src/api/java/de/teamlapen/vampirism/api/entity/player/vampire/EnumBloodSource.java
This file was deleted.
Oops, something went wrong.
59 changes: 59 additions & 0 deletions
59
src/api/java/de/teamlapen/vampirism/api/entity/player/vampire/IDrinkBloodContext.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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package de.teamlapen.vampirism.api.entity.player.vampire; | ||
|
||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.world.entity.LivingEntity; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
|
||
import java.util.Optional; | ||
|
||
/** | ||
* Context for {@link de.teamlapen.vampirism.api.entity.vampire.IVampire#drinkBlood(int, float, boolean, IDrinkBloodContext)} | ||
*/ | ||
public interface IDrinkBloodContext { | ||
|
||
/** | ||
* @return The entity that is the source of the blood if the blood is obtained from an entity | ||
*/ | ||
Optional<LivingEntity> getEntity(); | ||
|
||
/** | ||
* @return The itemstack that is the source of the blood if the blood is obtained from an item | ||
*/ | ||
Optional<ItemStack> getStack(); | ||
|
||
/** | ||
* @return The blockstate that is the source of the blood if the blood is obtained from a block | ||
*/ | ||
Optional<BlockState> getBlockState(); | ||
|
||
/** | ||
* @return The blockpos that is the source of the blood if the blood is obtained from a block | ||
*/ | ||
Optional<BlockPos> getBlockPos(); | ||
|
||
@Deprecated(forRemoval = true) | ||
static IDrinkBloodContext none() { | ||
return new IDrinkBloodContext() { | ||
@Override | ||
public Optional<LivingEntity> getEntity() { | ||
return Optional.empty(); | ||
} | ||
|
||
@Override | ||
public Optional<ItemStack> getStack() { | ||
return Optional.empty(); | ||
} | ||
|
||
@Override | ||
public Optional<BlockState> getBlockState() { | ||
return Optional.empty(); | ||
} | ||
|
||
@Override | ||
public Optional<BlockPos> getBlockPos() { | ||
return Optional.empty(); | ||
} | ||
}; | ||
} | ||
} |
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
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
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.