mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-12-22 14:59:22 +01:00
auto cleanup
This commit is contained in:
parent
a88458d6d0
commit
9c83d62055
14 changed files with 69 additions and 177 deletions
|
@ -44,7 +44,6 @@ import net.minecraftforge.common.util.LazyOptional;
|
|||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
import org.apache.commons.lang3.tuple.ImmutableTriple;
|
||||
import top.theillusivec4.curios.api.CuriosApi;
|
||||
import top.theillusivec4.curios.api.SlotResult;
|
||||
|
||||
|
|
|
@ -36,24 +36,18 @@ import java.util.function.BiConsumer;
|
|||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* The main class of the Nature's Aura API. This is where you can find recipe
|
||||
* lists and the {@link IInternalHooks} instance, which can be used to hook into
|
||||
* internal mod functions not exposed to the API.
|
||||
* The main class of the Nature's Aura API. This is where you can find recipe lists and the {@link IInternalHooks} instance, which can be used to hook into internal mod functions not exposed to the API.
|
||||
*/
|
||||
public final class NaturesAuraAPI {
|
||||
|
||||
public static final String MOD_ID = "naturesaura";
|
||||
|
||||
/**
|
||||
* A map of all the block states that the Botanist's Pickaxe can convert
|
||||
* into their mossy variations. Contains mossy brick and mossy cobblestone
|
||||
* by default, along with all blocks specified in the config file
|
||||
* A map of all the block states that the Botanist's Pickaxe can convert into their mossy variations. Contains mossy brick and mossy cobblestone by default, along with all blocks specified in the config file
|
||||
*/
|
||||
public static final BiMap<BlockState, BlockState> BOTANIST_PICKAXE_CONVERSIONS = HashBiMap.create();
|
||||
/**
|
||||
* A map of all {@link IAuraType} instances which are types of Aura present
|
||||
* in different types of levels. {@link BasicAuraType} instances can be
|
||||
* easily registered using {@link BasicAuraType#register()}.
|
||||
* A map of all {@link IAuraType} instances which are types of Aura present in different types of levels. {@link BasicAuraType} instances can be easily registered using {@link BasicAuraType#register()}.
|
||||
*/
|
||||
public static final Map<ResourceLocation, IAuraType> AURA_TYPES = new HashMap<>();
|
||||
public static final BasicAuraType TYPE_OVERWORLD = new BasicAuraType(new ResourceLocation(NaturesAuraAPI.MOD_ID, "overworld"), Level.OVERWORLD, 0x89cc37, 0).register();
|
||||
|
@ -61,75 +55,50 @@ public final class NaturesAuraAPI {
|
|||
public static final BasicAuraType TYPE_END = new BasicAuraType(new ResourceLocation(NaturesAuraAPI.MOD_ID, "end"), Level.END, 0x302624, 0).register();
|
||||
public static final BasicAuraType TYPE_OTHER = new BasicAuraType(new ResourceLocation(NaturesAuraAPI.MOD_ID, "other"), null, 0x2fa8a0, Integer.MIN_VALUE).register();
|
||||
/**
|
||||
* A map of all {@link IDrainSpotEffect} suppliers which are effects that
|
||||
* happen passively at every spot that Aura has been drained from in the
|
||||
* level. These effects include things like vegetational increase and
|
||||
* natural decay. To register your own drain spot effects, just add a
|
||||
* supplier for them to this map, and they will automatically be executed
|
||||
* once a second for every drain spot currently loaded.
|
||||
* A map of all {@link IDrainSpotEffect} suppliers which are effects that happen passively at every spot that Aura has been drained from in the level. These effects include things like vegetational increase and natural decay. To register your own drain spot effects, just add a supplier for them to this map, and they will automatically be executed once a second for every drain spot currently loaded.
|
||||
*/
|
||||
public static final Map<ResourceLocation, Supplier<IDrainSpotEffect>> DRAIN_SPOT_EFFECTS = new HashMap<>();
|
||||
/**
|
||||
* A map of all effect powder type. The integer the effect is registered to
|
||||
* is the color that the powder and its effect should have. To check if a
|
||||
* powder is active in any given area, use {@link IInternalHooks#isEffectPowderActive(Level,
|
||||
* BlockPos, ResourceLocation)}
|
||||
* A map of all effect powder type. The integer the effect is registered to is the color that the powder and its effect should have. To check if a powder is active in any given area, use {@link IInternalHooks#isEffectPowderActive(Level, BlockPos, ResourceLocation)}
|
||||
*/
|
||||
public static final Map<ResourceLocation, Integer> EFFECT_POWDERS = new HashMap<>();
|
||||
/**
|
||||
* A map of all {@link IMultiblock} objects which are multiblock structures
|
||||
* that can easily be looped through and checked, and also easily created
|
||||
* using the multiblock maker debug tool.
|
||||
* A map of all {@link IMultiblock} objects which are multiblock structures that can easily be looped through and checked, and also easily created using the multiblock maker debug tool.
|
||||
*/
|
||||
public static final Map<ResourceLocation, IMultiblock> MULTIBLOCKS = new HashMap<>();
|
||||
/**
|
||||
* A list of all {@link WeightedOre} objects that represent ores that can
|
||||
* spawn inside of stone blocks in the overworld
|
||||
* A list of all {@link WeightedOre} objects that represent ores that can spawn inside of stone blocks in the overworld
|
||||
*/
|
||||
public static final List<WeightedOre> OVERWORLD_ORES = new ArrayList<>();
|
||||
/**
|
||||
* A list of all {@link WeightedOre} objects that represent ores that can
|
||||
* spawn inside netherrack blocks in the nether
|
||||
* A list of all {@link WeightedOre} objects that represent ores that can spawn inside netherrack blocks in the nether
|
||||
*/
|
||||
public static final List<WeightedOre> NETHER_ORES = new ArrayList<>();
|
||||
/**
|
||||
* A map of all the entities' registry names to the amounts of aura they
|
||||
* each generate in the projectile generator
|
||||
* A map of all the entities' registry names to the amounts of aura they each generate in the projectile generator
|
||||
*/
|
||||
public static final Map<EntityType<?>, Integer> PROJECTILE_GENERATIONS = new HashMap<>();
|
||||
/**
|
||||
* A map of all the items that cause the {@link WeatherType} to be changed
|
||||
* using the weather changer
|
||||
* A map of all the items that cause the {@link WeatherType} to be changed using the weather changer
|
||||
*/
|
||||
public static final Map<ItemStack, WeatherType> WEATHER_CHANGER_CONVERSIONS = new HashMap<>();
|
||||
/**
|
||||
* The capability for any item or block that stores Aura in the form of an
|
||||
* {@link IAuraContainer}
|
||||
* The capability for any item or block that stores Aura in the form of an {@link IAuraContainer}
|
||||
*/
|
||||
public static final Capability<IAuraContainer> CAP_AURA_CONTAINER = CapabilityManager.get(new CapabilityToken<>() {
|
||||
});
|
||||
/**
|
||||
* The capability for any item that can be recharged from an Aura storage
|
||||
* container like the Aura Cache in the form of {@link IAuraRecharge} by a
|
||||
* player holding it in their hand
|
||||
* The capability for any item that can be recharged from an Aura storage container like the Aura Cache in the form of {@link IAuraRecharge} by a player holding it in their hand
|
||||
*/
|
||||
public static final Capability<IAuraRecharge> CAP_AURA_RECHARGE = CapabilityManager.get(new CapabilityToken<>() {
|
||||
});
|
||||
/**
|
||||
* The capability that any chunk in a level has to store Aura in it. As this
|
||||
* is only applicable to chunks and all chunks in the level automatically
|
||||
* get assigned this capability, using it directly is not necessary for
|
||||
* addon developers. To retrieve this capability from any chunk, use the
|
||||
* helper method {@link IAuraChunk#getAuraChunk(net.minecraft.world.level.Level,
|
||||
* BlockPos)}.
|
||||
* The capability that any chunk in a level has to store Aura in it. As this is only applicable to chunks and all chunks in the level automatically get assigned this capability, using it directly is not necessary for addon developers. To retrieve this capability from any chunk, use the helper method {@link IAuraChunk#getAuraChunk(net.minecraft.world.level.Level, BlockPos)}.
|
||||
*/
|
||||
public static final Capability<IAuraChunk> CAP_AURA_CHUNK = CapabilityManager.get(new CapabilityToken<>() {
|
||||
});
|
||||
/**
|
||||
* The capability that any level has to store Nature's Aura specific data in
|
||||
* it. To retrieve this capability from any level, use the helper methods
|
||||
* {@link ILevelData#getLevelData(net.minecraft.world.level.Level)} or
|
||||
* {@link ILevelData#getOverworldData(net.minecraft.world.level.Level)}.
|
||||
* The capability that any level has to store Nature's Aura specific data in it. To retrieve this capability from any level, use the helper methods {@link ILevelData#getLevelData(net.minecraft.world.level.Level)} or {@link ILevelData#getOverworldData(net.minecraft.world.level.Level)}.
|
||||
*/
|
||||
public static final Capability<ILevelData> CAP_LEVEL_DATA = CapabilityManager.get(new CapabilityToken<>() {
|
||||
});
|
||||
|
@ -144,8 +113,7 @@ public final class NaturesAuraAPI {
|
|||
}
|
||||
|
||||
/**
|
||||
* This method returns the active {@link IInternalHooks} instance which can
|
||||
* be used to hook into the mod's internal functionalities.
|
||||
* This method returns the active {@link IInternalHooks} instance which can be used to hook into the mod's internal functionalities.
|
||||
*
|
||||
* @return The active {@link IInternalHooks} instance
|
||||
*/
|
||||
|
@ -159,11 +127,7 @@ public final class NaturesAuraAPI {
|
|||
public interface IInternalHooks {
|
||||
|
||||
/**
|
||||
* Helper method to extract aura from an {@link IAuraContainer} in the
|
||||
* supplied player's inventory or baubles slots. The method returns true
|
||||
* if the aura could be extracted. Note that, if the player is in
|
||||
* creative mode, this method will always return true and no extraction
|
||||
* will take place.
|
||||
* Helper method to extract aura from an {@link IAuraContainer} in the supplied player's inventory or baubles slots. The method returns true if the aura could be extracted. Note that, if the player is in creative mode, this method will always return true and no extraction will take place.
|
||||
*
|
||||
* @param player The player
|
||||
* @param amount The amount to extract
|
||||
|
@ -173,9 +137,7 @@ public final class NaturesAuraAPI {
|
|||
boolean extractAuraFromPlayer(Player player, int amount, boolean simulate);
|
||||
|
||||
/**
|
||||
* Helper method to insert aura into an {@link IAuraContainer} in the
|
||||
* supplied player's inventory or baubles slots. The method returns true
|
||||
* if the aura could be inserted.
|
||||
* Helper method to insert aura into an {@link IAuraContainer} in the supplied player's inventory or baubles slots. The method returns true if the aura could be inserted.
|
||||
*
|
||||
* @param player The player
|
||||
* @param amount The amount to insert
|
||||
|
@ -185,10 +147,7 @@ public final class NaturesAuraAPI {
|
|||
boolean insertAuraIntoPlayer(Player player, int amount, boolean simulate);
|
||||
|
||||
/**
|
||||
* This method can be used to spawn the magic particle effect used by
|
||||
* Nature's Aura. It will not have an effect on the client side, so if
|
||||
* you want to send it from the server side, you need to create your own
|
||||
* packet.
|
||||
* This method can be used to spawn the magic particle effect used by Nature's Aura. It will not have an effect on the client side, so if you want to send it from the server side, you need to create your own packet.
|
||||
*
|
||||
* @param posX The x position
|
||||
* @param posY The y position
|
||||
|
@ -199,20 +158,14 @@ public final class NaturesAuraAPI {
|
|||
* @param color The color the particle should have, in hex
|
||||
* @param scale The scale of the particle
|
||||
* @param maxAge The max age before the particle should die
|
||||
* @param gravity The amount of gravity the particle should have, can
|
||||
* be 0
|
||||
* @param gravity The amount of gravity the particle should have, can be 0
|
||||
* @param collision If the particle should collide with blocks
|
||||
* @param fade If the particle should slowly fade out or suddenly
|
||||
* disappear
|
||||
* @param fade If the particle should slowly fade out or suddenly disappear
|
||||
*/
|
||||
void spawnMagicParticle(double posX, double posY, double posZ, double motionX, double motionY, double motionZ, int color, float scale, int maxAge, float gravity, boolean collision, boolean fade);
|
||||
|
||||
/**
|
||||
* This method can be used to spawn the magic particle effect used by
|
||||
* Nature's Aura. The particle will be created to spawn at the start
|
||||
* position and move towards the end position, dying when it reaches it.
|
||||
* It will not have an effect on the client side, so if you want to send
|
||||
* it from the server side, you need to create your own packet.
|
||||
* This method can be used to spawn the magic particle effect used by Nature's Aura. The particle will be created to spawn at the start position and move towards the end position, dying when it reaches it. It will not have an effect on the client side, so if you want to send it from the server side, you need to create your own packet.
|
||||
*
|
||||
* @param startX The start x
|
||||
* @param startY The start y
|
||||
|
@ -227,18 +180,14 @@ public final class NaturesAuraAPI {
|
|||
void spawnParticleStream(float startX, float startY, float startZ, float endX, float endY, float endZ, float speed, int color, float scale);
|
||||
|
||||
/**
|
||||
* Sets wether Nature's Aura particles that are spawned will be rendered
|
||||
* with depth test enabled or not. Default value is true, please reset
|
||||
* after changing.
|
||||
* Sets wether Nature's Aura particles that are spawned will be rendered with depth test enabled or not. Default value is true, please reset after changing.
|
||||
*
|
||||
* @param depth Wether depth test should be enabled or not
|
||||
*/
|
||||
void setParticleDepth(boolean depth);
|
||||
|
||||
/**
|
||||
* Sets the range that Nature's Aura particles that are spawned will
|
||||
* have to have from the player at most to actually be spawned. Default
|
||||
* value is 32, please reset after changing.
|
||||
* Sets the range that Nature's Aura particles that are spawned will have to have from the player at most to actually be spawned. Default value is 32, please reset after changing.
|
||||
*
|
||||
* @param range The range that particle spawning should have
|
||||
*/
|
||||
|
@ -247,25 +196,17 @@ public final class NaturesAuraAPI {
|
|||
void setParticleCulling(boolean cull);
|
||||
|
||||
/**
|
||||
* This method is used to create a custom multiblock from within the
|
||||
* API. The multiblock will automatically be registered both to Nature's
|
||||
* Aura's multiblock registry and Patchouli's multiblock registry.
|
||||
* This method is used to create a custom multiblock from within the API. The multiblock will automatically be registered both to Nature's Aura's multiblock registry and Patchouli's multiblock registry.
|
||||
*
|
||||
* @param name The name the multiblock should have
|
||||
* @param pattern The pattern that the multiblock should have, where
|
||||
* each character is mapped to a raw matcher
|
||||
* @param rawMatchers Each char matcher in the form of the char followed
|
||||
* by a matcher, either in the form of a Block, an
|
||||
* BlockState or a {@link Matcher}, similar to the
|
||||
* old way that crafting recipes work.
|
||||
* @param pattern The pattern that the multiblock should have, where each character is mapped to a raw matcher
|
||||
* @param rawMatchers Each char matcher in the form of the char followed by a matcher, either in the form of a Block, an BlockState or a {@link Matcher}, similar to the old way that crafting recipes work.
|
||||
* @return the multiblock instance
|
||||
*/
|
||||
IMultiblock createMultiblock(ResourceLocation name, String[][] pattern, Object... rawMatchers);
|
||||
|
||||
/**
|
||||
* Get all the active effect powders in the given area and consume the
|
||||
* position and the range that they have. To register a powder with the
|
||||
* supplied name, use {@link #EFFECT_POWDERS}
|
||||
* Get all the active effect powders in the given area and consume the position and the range that they have. To register a powder with the supplied name, use {@link #EFFECT_POWDERS}
|
||||
*
|
||||
* @param level The level
|
||||
* @param area The area to find powders in
|
||||
|
@ -275,11 +216,7 @@ public final class NaturesAuraAPI {
|
|||
List<Tuple<Vec3, Integer>> getActiveEffectPowders(Level level, AABB area, ResourceLocation name);
|
||||
|
||||
/**
|
||||
* Returns true if there is an effect powder entity active anywhere
|
||||
* around the given position based on the radius it has. This is a
|
||||
* shorthand function of {@link #getActiveEffectPowders(Level,
|
||||
* net.minecraft.world.phys.AABB, ResourceLocation)} that returns true
|
||||
* if the list is non-empty
|
||||
* Returns true if there is an effect powder entity active anywhere around the given position based on the radius it has. This is a shorthand function of {@link #getActiveEffectPowders(Level, net.minecraft.world.phys.AABB, ResourceLocation)} that returns true if the list is non-empty
|
||||
*
|
||||
* @param level The level
|
||||
* @param pos The center position
|
||||
|
|
|
@ -12,12 +12,9 @@ import org.apache.commons.lang3.tuple.Pair;
|
|||
import java.util.function.BiConsumer;
|
||||
|
||||
/**
|
||||
* A class whose instances hold information about the aura present in any given
|
||||
* {@link net.minecraft.world.level.chunk.LevelChunk}. To get an instance for a
|
||||
* chunk, use {@link #getAuraChunk(Level, BlockPos)}.
|
||||
* A class whose instances hold information about the aura present in any given {@link net.minecraft.world.level.chunk.LevelChunk}. To get an instance for a chunk, use {@link #getAuraChunk(Level, BlockPos)}.
|
||||
* <p>
|
||||
* It is not intended for API users to create custom implementation of this
|
||||
* class.
|
||||
* It is not intended for API users to create custom implementation of this class.
|
||||
*/
|
||||
public interface IAuraChunk extends INBTSerializable<CompoundTag> {
|
||||
|
||||
|
@ -27,8 +24,7 @@ public interface IAuraChunk extends INBTSerializable<CompoundTag> {
|
|||
int DEFAULT_AURA = 1000000;
|
||||
|
||||
/**
|
||||
* This method is used to get information about the Aura in any given chunk.
|
||||
* This is a convenience method.
|
||||
* This method is used to get information about the Aura in any given chunk. This is a convenience method.
|
||||
*
|
||||
* @param level The level
|
||||
* @param pos A position that the chunk contains
|
||||
|
@ -40,23 +36,19 @@ public interface IAuraChunk extends INBTSerializable<CompoundTag> {
|
|||
}
|
||||
|
||||
/**
|
||||
* This method uses the supplied consumer to iterate over all the drain
|
||||
* spots, represented as a position and the number of Aura in them, in any
|
||||
* given area.
|
||||
* This method uses the supplied consumer to iterate over all the drain spots, represented as a position and the number of Aura in them, in any given area.
|
||||
*
|
||||
* @param level The level
|
||||
* @param pos The center position
|
||||
* @param radius The radius around the center to search for spots in
|
||||
* @param consumer A consumer that gets given the position and amount of
|
||||
* aura in each drain spot found
|
||||
* @param consumer A consumer that gets given the position and amount of aura in each drain spot found
|
||||
*/
|
||||
static void getSpotsInArea(Level level, BlockPos pos, int radius, BiConsumer<BlockPos, Integer> consumer) {
|
||||
NaturesAuraAPI.instance().getAuraSpotsInArea(level, pos, radius, consumer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method that adds up the amount of aura spots from {@link
|
||||
* #getSpotsInArea(Level, BlockPos, int, BiConsumer)} and returns it.
|
||||
* Convenience method that adds up the amount of aura spots from {@link #getSpotsInArea(Level, BlockPos, int, BiConsumer)} and returns it.
|
||||
*
|
||||
* @param level The level
|
||||
* @param pos The center position
|
||||
|
@ -68,68 +60,48 @@ public interface IAuraChunk extends INBTSerializable<CompoundTag> {
|
|||
}
|
||||
|
||||
/**
|
||||
* Convenience method that adds up all of the aura from each drain spot from
|
||||
* {@link #getSpotsInArea(Level, BlockPos, int, BiConsumer)} and
|
||||
* conveniently returns it. For a better visual display with a more gradual
|
||||
* increase, use {@link #triangulateAuraInArea(Level, BlockPos, int)}.
|
||||
* Convenience method that adds up all of the aura from each drain spot from {@link #getSpotsInArea(Level, BlockPos, int, BiConsumer)} and conveniently returns it. For a better visual display with a more gradual increase, use {@link #triangulateAuraInArea(Level, BlockPos, int)}.
|
||||
*
|
||||
* @param level The level
|
||||
* @param pos The center position
|
||||
* @param radius The radius around the center to search for spots in
|
||||
* @return The amount of Aura present in that area, based on the drain spots
|
||||
* that are found
|
||||
* @return The amount of Aura present in that area, based on the drain spots that are found
|
||||
*/
|
||||
static int getAuraInArea(Level level, BlockPos pos, int radius) {
|
||||
return NaturesAuraAPI.instance().getAuraInArea(level, pos, radius);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method that combines {@link #getAuraInArea(Level, BlockPos,
|
||||
* int)} and {@link #getSpotAmountInArea(Level, BlockPos, int)} to increase
|
||||
* performance.
|
||||
* Convenience method that combines {@link #getAuraInArea(Level, BlockPos, int)} and {@link #getSpotAmountInArea(Level, BlockPos, int)} to increase performance.
|
||||
*
|
||||
* @param level The level
|
||||
* @param pos The center position
|
||||
* @param radius The radius around the center to search for spots in
|
||||
* @return A pair of the amount of aura in the area as the {@link
|
||||
* Pair#getLeft()} entry, and the amount of aura spots in the area as the
|
||||
* {@link Pair#getRight()} entry
|
||||
* @return A pair of the amount of aura in the area as the {@link Pair#getLeft()} entry, and the amount of aura spots in the area as the {@link Pair#getRight()} entry
|
||||
*/
|
||||
static Pair<Integer, Integer> getAuraAndSpotAmountInArea(Level level, BlockPos pos, int radius) {
|
||||
return NaturesAuraAPI.instance().getAuraAndSpotAmountInArea(level, pos, radius);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method that adds up all of the aura from each drain spot from
|
||||
* {@link #getSpotsInArea(Level, BlockPos, int, BiConsumer)}, but multiplies
|
||||
* their amount by the percentual distance to the supplied position. This
|
||||
* will cause for a lot more gradual of an increase and decrease of Aura
|
||||
* when moving closer to actual spots. This should be used for visual
|
||||
* purposes as it is more performance intensive than {@link
|
||||
* #getAuraInArea(Level, BlockPos, int)}.
|
||||
* Convenience method that adds up all of the aura from each drain spot from {@link #getSpotsInArea(Level, BlockPos, int, BiConsumer)}, but multiplies their amount by the percentual distance to the supplied position. This will cause for a lot more gradual of an increase and decrease of Aura when moving closer to actual spots. This should be used for visual purposes as it is more performance intensive than {@link #getAuraInArea(Level, BlockPos, int)}.
|
||||
*
|
||||
* @param level The level
|
||||
* @param pos The center position
|
||||
* @param radius The radius around the center to search for spots in
|
||||
* @return The amount of Aura presetn in that area, based on the drain spots
|
||||
* that are found and their distance to the center
|
||||
* @return The amount of Aura presetn in that area, based on the drain spots that are found and their distance to the center
|
||||
*/
|
||||
static int triangulateAuraInArea(Level level, BlockPos pos, int radius) {
|
||||
return NaturesAuraAPI.instance().triangulateAuraInArea(level, pos, radius);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the position of the lowest drain spot (meaning the
|
||||
* one that has the least Aura stored) in the given area. This should be
|
||||
* used with any machines that fill up Aura in an area, so that the most
|
||||
* drained spots get selected first. Note that, when there is no drain spot
|
||||
* with an amount lower than 0, the default will always be returned.
|
||||
* This method returns the position of the lowest drain spot (meaning the one that has the least Aura stored) in the given area. This should be used with any machines that fill up Aura in an area, so that the most drained spots get selected first. Note that, when there is no drain spot with an amount lower than 0, the default will always be returned.
|
||||
*
|
||||
* @param level The level
|
||||
* @param pos The center position
|
||||
* @param radius The radius around the center to search for spots in
|
||||
* @param defaultSpot A position that will be used to create a new drain
|
||||
* spot when none are found
|
||||
* @param defaultSpot A position that will be used to create a new drain spot when none are found
|
||||
* @return The position of the lowest drain spot
|
||||
*/
|
||||
static BlockPos getLowestSpot(Level level, BlockPos pos, int radius, BlockPos defaultSpot) {
|
||||
|
@ -137,17 +109,12 @@ public interface IAuraChunk extends INBTSerializable<CompoundTag> {
|
|||
}
|
||||
|
||||
/**
|
||||
* This method returns the position of the highest drain spot (meaning the
|
||||
* one that has the most Aura stored) in the given area. This should be used
|
||||
* with any machines that use up Aura so that the spots with the highest
|
||||
* amount are drained first. Note that, when there is no drain spot with an
|
||||
* amount greater than 0, the defautl will always be returned.
|
||||
* This method returns the position of the highest drain spot (meaning the one that has the most Aura stored) in the given area. This should be used with any machines that use up Aura so that the spots with the highest amount are drained first. Note that, when there is no drain spot with an amount greater than 0, the defautl will always be returned.
|
||||
*
|
||||
* @param level The level
|
||||
* @param pos The center position
|
||||
* @param radius The radius around the center to search for spots in
|
||||
* @param defaultSpot A position that will be used to create a new drain
|
||||
* spot when none are found
|
||||
* @param defaultSpot A position that will be used to create a new drain spot when none are found
|
||||
* @return The position of the highest drain spot
|
||||
*/
|
||||
static BlockPos getHighestSpot(Level level, BlockPos pos, int radius, BlockPos defaultSpot) {
|
||||
|
@ -155,48 +122,32 @@ public interface IAuraChunk extends INBTSerializable<CompoundTag> {
|
|||
}
|
||||
|
||||
/**
|
||||
* Drains the given amount of Aura from the given position. Returns the
|
||||
* amount of Aura that was drained.
|
||||
* Drains the given amount of Aura from the given position. Returns the amount of Aura that was drained.
|
||||
*
|
||||
* @param pos The position
|
||||
* @param amount The amount to drain
|
||||
* @param aimForZero If true, and draining the given amount would make the
|
||||
* level go from positive to negative, an amount will be
|
||||
* drained instead that will cause the spot's amount to be
|
||||
* 0.
|
||||
* @return The amount of Aura drained. Will only be different from the
|
||||
* supplied amount if stopAtZero is true
|
||||
* @param aimForZero If true, and draining the given amount would make the level go from positive to negative, an amount will be drained instead that will cause the spot's amount to be 0.
|
||||
* @return The amount of Aura drained. Will only be different from the supplied amount if stopAtZero is true
|
||||
*/
|
||||
int drainAura(BlockPos pos, int amount, boolean aimForZero, boolean simulate);
|
||||
|
||||
/**
|
||||
* Convenience version of {@link #drainAura(BlockPos, int, boolean,
|
||||
* boolean)} with aimForZero and simulate set to false, as this is the most
|
||||
* likely behavior you will want. Notice that {@link #storeAura(BlockPos,
|
||||
* int)} has aimForZero set to true.
|
||||
* Convenience version of {@link #drainAura(BlockPos, int, boolean, boolean)} with aimForZero and simulate set to false, as this is the most likely behavior you will want. Notice that {@link #storeAura(BlockPos, int)} has aimForZero set to true.
|
||||
*/
|
||||
int drainAura(BlockPos pos, int amount);
|
||||
|
||||
/**
|
||||
* Stores the given amount of Aura at the given position. Returns the amount
|
||||
* of Aura that was stored.
|
||||
* Stores the given amount of Aura at the given position. Returns the amount of Aura that was stored.
|
||||
*
|
||||
* @param pos The position
|
||||
* @param amount The amount to store
|
||||
* @param aimForZero If true, and storing the given amount would make the
|
||||
* level go from negative to positive, an amount will be
|
||||
* stored instead that will cause the spot's amount to be
|
||||
* 0.
|
||||
* @return The amount of Aura stored. Will only be different from the
|
||||
* supplied amount if stopAtZero is true
|
||||
* @param aimForZero If true, and storing the given amount would make the level go from negative to positive, an amount will be stored instead that will cause the spot's amount to be 0.
|
||||
* @return The amount of Aura stored. Will only be different from the supplied amount if stopAtZero is true
|
||||
*/
|
||||
int storeAura(BlockPos pos, int amount, boolean aimForZero, boolean simulate);
|
||||
|
||||
/**
|
||||
* Convenience version of {@link #storeAura(BlockPos, int, boolean,
|
||||
* boolean)} with aimForZero set to true and simulate set to false, as this
|
||||
* is the most likely behavior you will want. Notice that {@link
|
||||
* #drainAura(BlockPos, int)} has aimForZero set to false.
|
||||
* Convenience version of {@link #storeAura(BlockPos, int, boolean, boolean)} with aimForZero set to true and simulate set to false, as this is the most likely behavior you will want. Notice that {@link #drainAura(BlockPos, int)} has aimForZero set to false.
|
||||
*/
|
||||
int storeAura(BlockPos pos, int amount);
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package de.ellpeck.naturesaura.api.aura.container;
|
|||
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
|
||||
|
||||
public interface IAuraContainer {
|
||||
|
||||
int storeAura(int amountToStore, boolean simulate);
|
||||
|
||||
int drainAura(int amountToDrain, boolean simulate);
|
||||
|
|
|
@ -5,7 +5,10 @@ import de.ellpeck.naturesaura.blocks.tiles.ITickableBlockEntity;
|
|||
import de.ellpeck.naturesaura.blocks.tiles.ModBlockEntities;
|
||||
import de.ellpeck.naturesaura.data.BlockStateGenerator;
|
||||
import de.ellpeck.naturesaura.data.ItemModelGenerator;
|
||||
import de.ellpeck.naturesaura.reg.*;
|
||||
import de.ellpeck.naturesaura.reg.ICustomBlockState;
|
||||
import de.ellpeck.naturesaura.reg.ICustomItemModel;
|
||||
import de.ellpeck.naturesaura.reg.IModItem;
|
||||
import de.ellpeck.naturesaura.reg.ModRegistry;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
|
|
|
@ -151,7 +151,8 @@ public class BlockEntityImpl extends BlockEntity {
|
|||
var compound = new CompoundTag();
|
||||
this.writeNBT(compound, SaveType.BLOCK);
|
||||
if (!compound.isEmpty()) {
|
||||
if (!regularItem.hasTag()) regularItem.setTag(new CompoundTag());
|
||||
if (!regularItem.hasTag())
|
||||
regularItem.setTag(new CompoundTag());
|
||||
regularItem.getTag().put("data", compound);
|
||||
}
|
||||
}
|
||||
|
@ -159,7 +160,8 @@ public class BlockEntityImpl extends BlockEntity {
|
|||
public void loadDataOnPlace(ItemStack stack) {
|
||||
if (stack.hasTag()) {
|
||||
var compound = stack.getTag().getCompound("data");
|
||||
if (compound != null) this.readNBT(compound, SaveType.BLOCK);
|
||||
if (compound != null)
|
||||
this.readNBT(compound, SaveType.BLOCK);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,9 @@ import de.ellpeck.naturesaura.items.ItemAuraBottle;
|
|||
import net.minecraft.client.model.Model;
|
||||
import net.minecraft.client.model.geom.ModelPart;
|
||||
import net.minecraft.client.model.geom.PartPose;
|
||||
import net.minecraft.client.model.geom.builders.*;
|
||||
import net.minecraft.client.model.geom.builders.CubeListBuilder;
|
||||
import net.minecraft.client.model.geom.builders.LayerDefinition;
|
||||
import net.minecraft.client.model.geom.builders.MeshDefinition;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
||||
|
|
|
@ -13,7 +13,10 @@ import net.minecraft.util.Mth;
|
|||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.*;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.BushBlock;
|
||||
import net.minecraft.world.level.block.GrassBlock;
|
||||
import net.minecraft.world.level.block.LeavesBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.LevelChunk;
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ import de.ellpeck.naturesaura.api.aura.type.IAuraType;
|
|||
import de.ellpeck.naturesaura.api.misc.WeightedOre;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.tags.TagKey;
|
||||
|
|
|
@ -11,7 +11,6 @@ import net.minecraft.client.renderer.block.model.ItemTransforms;
|
|||
import net.minecraft.client.renderer.entity.EntityRenderer;
|
||||
import net.minecraft.client.renderer.entity.EntityRendererProvider;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlas;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.inventory.InventoryMenu;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
|
|
@ -3,7 +3,6 @@ package de.ellpeck.naturesaura.entities.render;
|
|||
import net.minecraft.client.renderer.culling.Frustum;
|
||||
import net.minecraft.client.renderer.entity.EntityRenderer;
|
||||
import net.minecraft.client.renderer.entity.EntityRendererProvider;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlas;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.inventory.InventoryMenu;
|
||||
|
|
|
@ -19,7 +19,6 @@ import net.minecraft.world.entity.EquipmentSlot;
|
|||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.CreativeModeTab;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
|
|
@ -3,7 +3,6 @@ package de.ellpeck.naturesaura.recipes;
|
|||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||
import de.ellpeck.naturesaura.api.misc.WeatherType;
|
||||
import de.ellpeck.naturesaura.api.misc.WeightedOre;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
package de.ellpeck.naturesaura.reg;
|
||||
|
||||
public interface INoItemBlock {
|
||||
}
|
||||
public interface INoItemBlock {}
|
||||
|
|
Loading…
Reference in a new issue