Compare commits

...

5 commits

Author SHA1 Message Date
Ell
9c83d62055 auto cleanup 2023-02-15 23:52:52 +01:00
Ell
a88458d6d0 big cleanup 2023-02-15 23:45:50 +01:00
Ell
570379fd36 some texture improvements 2023-02-15 23:08:50 +01:00
Ell
36b5114da3 still allow using the nether altar layout 2023-02-15 22:59:14 +01:00
Ell
9294a90e1a this may seem weird to some people, but
removed the nether altar
2023-02-15 22:46:32 +01:00
119 changed files with 312 additions and 551 deletions

View file

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "naturesaura:block/conversion_catalyst"
}
}
}

View file

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "naturesaura:block/crushing_catalyst"
}
}
}

View file

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "naturesaura:block/nature_altar"
}
}
}

View file

@ -1,6 +0,0 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "naturesaura:block/conversion_catalyst_nether"
}
}

View file

@ -1,6 +0,0 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "naturesaura:block/crushing_catalyst_nether"
}
}

View file

@ -1,15 +1,15 @@
{ {
"values": [ "values": [
"naturesaura:ancient_stairs", "naturesaura:flower_generator",
"naturesaura:offering_table",
"naturesaura:wood_stand",
"naturesaura:auto_crafter",
"naturesaura:ancient_bark",
"naturesaura:oak_generator",
"naturesaura:ancient_slab",
"naturesaura:ancient_log", "naturesaura:ancient_log",
"naturesaura:offering_table",
"naturesaura:ancient_planks", "naturesaura:ancient_planks",
"naturesaura:ancient_stairs",
"naturesaura:oak_generator",
"naturesaura:wood_stand",
"naturesaura:ancient_bark",
"naturesaura:ancient_slab",
"naturesaura:nether_wart_mushroom", "naturesaura:nether_wart_mushroom",
"naturesaura:flower_generator" "naturesaura:auto_crafter"
] ]
} }

View file

@ -1,46 +1,46 @@
{ {
"values": [ "values": [
"naturesaura:pickup_stopper",
"naturesaura:rf_converter",
"naturesaura:infused_slab",
"naturesaura:aura_detector",
"naturesaura:infused_stairs",
"naturesaura:infused_iron_block",
"naturesaura:item_distributor",
"naturesaura:placer",
"naturesaura:infused_stone",
"naturesaura:gold_brick",
"naturesaura:generator_limit_remover",
"naturesaura:crushing_catalyst",
"naturesaura:chunk_loader",
"naturesaura:projectile_generator",
"naturesaura:furnace_heater",
"naturesaura:powder_placer",
"naturesaura:animal_generator",
"naturesaura:animal_container",
"naturesaura:weather_changer",
"naturesaura:firework_generator",
"naturesaura:aura_timer",
"naturesaura:hopper_upgrade",
"naturesaura:spring", "naturesaura:spring",
"naturesaura:blast_furnace_booster", "naturesaura:aura_detector",
"naturesaura:infused_brick_stairs", "naturesaura:infused_slab",
"naturesaura:chorus_generator",
"naturesaura:time_changer",
"naturesaura:moss_generator",
"naturesaura:conversion_catalyst",
"naturesaura:snow_creator",
"naturesaura:ender_crate",
"naturesaura:gold_nether_brick",
"naturesaura:nature_altar",
"naturesaura:tainted_gold_block", "naturesaura:tainted_gold_block",
"naturesaura:spawn_lamp",
"naturesaura:nether_grass",
"naturesaura:field_creator",
"naturesaura:grated_chute", "naturesaura:grated_chute",
"naturesaura:snow_creator",
"naturesaura:infused_brick", "naturesaura:infused_brick",
"naturesaura:weather_changer",
"naturesaura:infused_brick_slab", "naturesaura:infused_brick_slab",
"naturesaura:field_creator",
"naturesaura:infused_stone",
"naturesaura:time_changer",
"naturesaura:nature_altar",
"naturesaura:placer",
"naturesaura:firework_generator",
"naturesaura:infused_stairs",
"naturesaura:projectile_generator",
"naturesaura:item_distributor",
"naturesaura:chunk_loader",
"naturesaura:rf_converter",
"naturesaura:spawn_lamp",
"naturesaura:blast_furnace_booster",
"naturesaura:nether_grass",
"naturesaura:animal_container",
"naturesaura:moss_generator",
"naturesaura:generator_limit_remover",
"naturesaura:pickup_stopper",
"naturesaura:aura_timer",
"naturesaura:animal_spawner",
"naturesaura:ender_crate",
"naturesaura:animal_generator",
"naturesaura:chorus_generator",
"naturesaura:hopper_upgrade",
"naturesaura:furnace_heater",
"naturesaura:potion_generator", "naturesaura:potion_generator",
"naturesaura:animal_spawner" "naturesaura:infused_brick_stairs",
"naturesaura:infused_iron_block",
"naturesaura:powder_placer",
"naturesaura:crushing_catalyst",
"naturesaura:conversion_catalyst",
"naturesaura:gold_nether_brick",
"naturesaura:gold_brick"
] ]
} }

View file

@ -0,0 +1,6 @@
{
"values": [
"minecraft:red_nether_bricks",
"minecraft:chiseled_stone_bricks"
]
}

View file

@ -0,0 +1,6 @@
{
"values": [
"naturesaura:gold_brick",
"naturesaura:gold_nether_brick"
]
}

View file

@ -1,5 +1,6 @@
{ {
"values": [ "values": [
"#minecraft:stone_bricks" "#minecraft:stone_bricks",
"minecraft:nether_bricks"
] ]
} }

View file

@ -1,5 +1,7 @@
{ {
"values": [ "values": [
"#minecraft:planks" "#minecraft:planks",
"minecraft:crimson_planks",
"minecraft:warped_planks"
] ]
} }

View file

@ -1,5 +0,0 @@
{
"values": [
"minecraft:nether_bricks"
]
}

View file

@ -1,6 +0,0 @@
{
"values": [
"minecraft:crimson_planks",
"minecraft:warped_planks"
]
}

View file

@ -44,8 +44,8 @@ import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.IForgeRegistry; import net.minecraftforge.registries.IForgeRegistry;
import org.apache.commons.lang3.tuple.ImmutableTriple;
import top.theillusivec4.curios.api.CuriosApi; import top.theillusivec4.curios.api.CuriosApi;
import top.theillusivec4.curios.api.SlotResult;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@ -310,7 +310,7 @@ public final class Helper {
public static ItemStack getEquippedItem(Predicate<ItemStack> predicate, Player player) { public static ItemStack getEquippedItem(Predicate<ItemStack> predicate, Player player) {
if (Compat.hasCompat("curios")) { if (Compat.hasCompat("curios")) {
var stack = CuriosApi.getCuriosHelper().findEquippedCurio(predicate, player).map(ImmutableTriple::getRight); var stack = CuriosApi.getCuriosHelper().findFirstCurio(player, predicate).map(SlotResult::stack);
if (stack.isPresent()) if (stack.isPresent())
return stack.get(); return stack.get();
} }

View file

@ -36,24 +36,18 @@ import java.util.function.BiConsumer;
import java.util.function.Supplier; import java.util.function.Supplier;
/** /**
* The main class of the Nature's Aura API. This is where you can find recipe * 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.
* 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 final class NaturesAuraAPI {
public static final String MOD_ID = "naturesaura"; public static final String MOD_ID = "naturesaura";
/** /**
* A map of all the block states that the Botanist's Pickaxe can convert * 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
* 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(); public static final BiMap<BlockState, BlockState> BOTANIST_PICKAXE_CONVERSIONS = HashBiMap.create();
/** /**
* A map of all {@link IAuraType} instances which are types of Aura present * 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()}.
* 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 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(); 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_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(); 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 * 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.
* 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<>(); 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 * 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)}
* 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<>(); public static final Map<ResourceLocation, Integer> EFFECT_POWDERS = new HashMap<>();
/** /**
* A map of all {@link IMultiblock} objects which are multiblock structures * 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.
* 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<>(); public static final Map<ResourceLocation, IMultiblock> MULTIBLOCKS = new HashMap<>();
/** /**
* A list of all {@link WeightedOre} objects that represent ores that can * A list of all {@link WeightedOre} objects that represent ores that can spawn inside of stone blocks in the overworld
* spawn inside of stone blocks in the overworld
*/ */
public static final List<WeightedOre> OVERWORLD_ORES = new ArrayList<>(); public static final List<WeightedOre> OVERWORLD_ORES = new ArrayList<>();
/** /**
* A list of all {@link WeightedOre} objects that represent ores that can * A list of all {@link WeightedOre} objects that represent ores that can spawn inside netherrack blocks in the nether
* spawn inside netherrack blocks in the nether
*/ */
public static final List<WeightedOre> NETHER_ORES = new ArrayList<>(); public static final List<WeightedOre> NETHER_ORES = new ArrayList<>();
/** /**
* A map of all the entities' registry names to the amounts of aura they * A map of all the entities' registry names to the amounts of aura they each generate in the projectile generator
* each generate in the projectile generator
*/ */
public static final Map<EntityType<?>, Integer> PROJECTILE_GENERATIONS = new HashMap<>(); public static final Map<EntityType<?>, Integer> PROJECTILE_GENERATIONS = new HashMap<>();
/** /**
* A map of all the items that cause the {@link WeatherType} to be changed * A map of all the items that cause the {@link WeatherType} to be changed using the weather changer
* using the weather changer
*/ */
public static final Map<ItemStack, WeatherType> WEATHER_CHANGER_CONVERSIONS = new HashMap<>(); 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 * The capability for any item or block that stores Aura in the form of an {@link IAuraContainer}
* {@link IAuraContainer}
*/ */
public static final Capability<IAuraContainer> CAP_AURA_CONTAINER = CapabilityManager.get(new CapabilityToken<>() { 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 * 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
* 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<>() { 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 * 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)}.
* 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<>() { 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 * 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)}.
* 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<>() { 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 * This method returns the active {@link IInternalHooks} instance which can be used to hook into the mod's internal functionalities.
* be used to hook into the mod's internal functionalities.
* *
* @return The active {@link IInternalHooks} instance * @return The active {@link IInternalHooks} instance
*/ */
@ -159,11 +127,7 @@ public final class NaturesAuraAPI {
public interface IInternalHooks { public interface IInternalHooks {
/** /**
* Helper method to extract aura from an {@link IAuraContainer} in the * 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.
* 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 player The player
* @param amount The amount to extract * @param amount The amount to extract
@ -173,9 +137,7 @@ public final class NaturesAuraAPI {
boolean extractAuraFromPlayer(Player player, int amount, boolean simulate); boolean extractAuraFromPlayer(Player player, int amount, boolean simulate);
/** /**
* Helper method to insert aura into an {@link IAuraContainer} in the * 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.
* supplied player's inventory or baubles slots. The method returns true
* if the aura could be inserted.
* *
* @param player The player * @param player The player
* @param amount The amount to insert * @param amount The amount to insert
@ -185,10 +147,7 @@ public final class NaturesAuraAPI {
boolean insertAuraIntoPlayer(Player player, int amount, boolean simulate); boolean insertAuraIntoPlayer(Player player, int amount, boolean simulate);
/** /**
* This method can be used to spawn the magic particle effect used by * 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.
* 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 posX The x position
* @param posY The y 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 color The color the particle should have, in hex
* @param scale The scale of the particle * @param scale The scale of the particle
* @param maxAge The max age before the particle should die * @param maxAge The max age before the particle should die
* @param gravity The amount of gravity the particle should have, can * @param gravity The amount of gravity the particle should have, can be 0
* be 0
* @param collision If the particle should collide with blocks * @param collision If the particle should collide with blocks
* @param fade If the particle should slowly fade out or suddenly * @param fade If the particle should slowly fade out or suddenly disappear
* 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); 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 * 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.
* 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 startX The start x
* @param startY The start y * @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); 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 * 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.
* with depth test enabled or not. Default value is true, please reset
* after changing.
* *
* @param depth Wether depth test should be enabled or not * @param depth Wether depth test should be enabled or not
*/ */
void setParticleDepth(boolean depth); void setParticleDepth(boolean depth);
/** /**
* Sets the range that Nature's Aura particles that are spawned will * 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.
* 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 * @param range The range that particle spawning should have
*/ */
@ -247,25 +196,17 @@ public final class NaturesAuraAPI {
void setParticleCulling(boolean cull); void setParticleCulling(boolean cull);
/** /**
* This method is used to create a custom multiblock from within the * 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.
* 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 name The name the multiblock should have
* @param pattern The pattern that the multiblock should have, where * @param pattern The pattern that the multiblock should have, where each character is mapped to a raw matcher
* 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 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 * @return the multiblock instance
*/ */
IMultiblock createMultiblock(ResourceLocation name, String[][] pattern, Object... rawMatchers); IMultiblock createMultiblock(ResourceLocation name, String[][] pattern, Object... rawMatchers);
/** /**
* Get all the active effect powders in the given area and consume the * 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}
* position and the range that they have. To register a powder with the
* supplied name, use {@link #EFFECT_POWDERS}
* *
* @param level The level * @param level The level
* @param area The area to find powders in * @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); List<Tuple<Vec3, Integer>> getActiveEffectPowders(Level level, AABB area, ResourceLocation name);
/** /**
* Returns true if there is an effect powder entity active anywhere * 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
* 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 level The level
* @param pos The center position * @param pos The center position

View file

@ -12,12 +12,9 @@ import org.apache.commons.lang3.tuple.Pair;
import java.util.function.BiConsumer; import java.util.function.BiConsumer;
/** /**
* A class whose instances hold information about the aura present in any given * 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)}.
* {@link net.minecraft.world.level.chunk.LevelChunk}. To get an instance for a
* chunk, use {@link #getAuraChunk(Level, BlockPos)}.
* <p> * <p>
* It is not intended for API users to create custom implementation of this * It is not intended for API users to create custom implementation of this class.
* class.
*/ */
public interface IAuraChunk extends INBTSerializable<CompoundTag> { public interface IAuraChunk extends INBTSerializable<CompoundTag> {
@ -27,8 +24,7 @@ public interface IAuraChunk extends INBTSerializable<CompoundTag> {
int DEFAULT_AURA = 1000000; int DEFAULT_AURA = 1000000;
/** /**
* This method is used to get information about the Aura in any given chunk. * This method is used to get information about the Aura in any given chunk. This is a convenience method.
* This is a convenience method.
* *
* @param level The level * @param level The level
* @param pos A position that the chunk contains * @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 * 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.
* spots, represented as a position and the number of Aura in them, in any
* given area.
* *
* @param level The level * @param level The level
* @param pos The center position * @param pos The center position
* @param radius The radius around the center to search for spots in * @param radius The radius around the center to search for spots in
* @param consumer A consumer that gets given the position and amount of * @param consumer A consumer that gets given the position and amount of aura in each drain spot found
* aura in each drain spot found
*/ */
static void getSpotsInArea(Level level, BlockPos pos, int radius, BiConsumer<BlockPos, Integer> consumer) { static void getSpotsInArea(Level level, BlockPos pos, int radius, BiConsumer<BlockPos, Integer> consumer) {
NaturesAuraAPI.instance().getAuraSpotsInArea(level, pos, radius, consumer); NaturesAuraAPI.instance().getAuraSpotsInArea(level, pos, radius, consumer);
} }
/** /**
* Convenience method that adds up the amount of aura spots from {@link * Convenience method that adds up the amount of aura spots from {@link #getSpotsInArea(Level, BlockPos, int, BiConsumer)} and returns it.
* #getSpotsInArea(Level, BlockPos, int, BiConsumer)} and returns it.
* *
* @param level The level * @param level The level
* @param pos The center position * @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 * 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)}.
* {@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 level The level
* @param pos The center position * @param pos The center position
* @param radius The radius around the center to search for spots in * @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 * @return The amount of Aura present in that area, based on the drain spots that are found
* that are found
*/ */
static int getAuraInArea(Level level, BlockPos pos, int radius) { static int getAuraInArea(Level level, BlockPos pos, int radius) {
return NaturesAuraAPI.instance().getAuraInArea(level, pos, radius); return NaturesAuraAPI.instance().getAuraInArea(level, pos, radius);
} }
/** /**
* Convenience method that combines {@link #getAuraInArea(Level, BlockPos, * Convenience method that combines {@link #getAuraInArea(Level, BlockPos, int)} and {@link #getSpotAmountInArea(Level, BlockPos, int)} to increase performance.
* int)} and {@link #getSpotAmountInArea(Level, BlockPos, int)} to increase
* performance.
* *
* @param level The level * @param level The level
* @param pos The center position * @param pos The center position
* @param radius The radius around the center to search for spots in * @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 * @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
* 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) { static Pair<Integer, Integer> getAuraAndSpotAmountInArea(Level level, BlockPos pos, int radius) {
return NaturesAuraAPI.instance().getAuraAndSpotAmountInArea(level, pos, radius); return NaturesAuraAPI.instance().getAuraAndSpotAmountInArea(level, pos, radius);
} }
/** /**
* Convenience method that adds up all of the aura from each drain spot from * 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)}.
* {@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 level The level
* @param pos The center position * @param pos The center position
* @param radius The radius around the center to search for spots in * @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 * @return The amount of Aura presetn in that area, based on the drain spots that are found and their distance to the center
* that are found and their distance to the center
*/ */
static int triangulateAuraInArea(Level level, BlockPos pos, int radius) { static int triangulateAuraInArea(Level level, BlockPos pos, int radius) {
return NaturesAuraAPI.instance().triangulateAuraInArea(level, pos, radius); return NaturesAuraAPI.instance().triangulateAuraInArea(level, pos, radius);
} }
/** /**
* This method returns the position of the lowest drain spot (meaning the * 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.
* 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 level The level
* @param pos The center position * @param pos The center position
* @param radius The radius around the center to search for spots in * @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 * @param defaultSpot A position that will be used to create a new drain spot when none are found
* spot when none are found
* @return The position of the lowest drain spot * @return The position of the lowest drain spot
*/ */
static BlockPos getLowestSpot(Level level, BlockPos pos, int radius, BlockPos defaultSpot) { 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 * 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.
* 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 level The level
* @param pos The center position * @param pos The center position
* @param radius The radius around the center to search for spots in * @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 * @param defaultSpot A position that will be used to create a new drain spot when none are found
* spot when none are found
* @return The position of the highest drain spot * @return The position of the highest drain spot
*/ */
static BlockPos getHighestSpot(Level level, BlockPos pos, int radius, BlockPos defaultSpot) { 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 * Drains the given amount of Aura from the given position. Returns the amount of Aura that was drained.
* amount of Aura that was drained.
* *
* @param pos The position * @param pos The position
* @param amount The amount to drain * @param amount The amount to drain
* @param aimForZero If true, and draining the given amount would make the * @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.
* level go from positive to negative, an amount will be * @return The amount of Aura drained. Will only be different from the supplied amount if stopAtZero is true
* 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); int drainAura(BlockPos pos, int amount, boolean aimForZero, boolean simulate);
/** /**
* Convenience version of {@link #drainAura(BlockPos, int, boolean, * 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.
* 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); int drainAura(BlockPos pos, int amount);
/** /**
* Stores the given amount of Aura at the given position. Returns the amount * Stores the given amount of Aura at the given position. Returns the amount of Aura that was stored.
* of Aura that was stored.
* *
* @param pos The position * @param pos The position
* @param amount The amount to store * @param amount The amount to store
* @param aimForZero If true, and storing the given amount would make the * @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.
* level go from negative to positive, an amount will be * @return The amount of Aura stored. Will only be different from the supplied amount if stopAtZero is true
* 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); int storeAura(BlockPos pos, int amount, boolean aimForZero, boolean simulate);
/** /**
* Convenience version of {@link #storeAura(BlockPos, int, boolean, * 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.
* 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); int storeAura(BlockPos pos, int amount);

View file

@ -3,6 +3,7 @@ package de.ellpeck.naturesaura.api.aura.container;
import de.ellpeck.naturesaura.api.aura.type.IAuraType; import de.ellpeck.naturesaura.api.aura.type.IAuraType;
public interface IAuraContainer { public interface IAuraContainer {
int storeAura(int amountToStore, boolean simulate); int storeAura(int amountToStore, boolean simulate);
int drainAura(int amountToDrain, boolean simulate); int drainAura(int amountToDrain, boolean simulate);

View file

@ -9,7 +9,7 @@ import net.minecraft.world.level.block.state.BlockState;
public record Matcher(BlockState defaultState, ICheck check) { public record Matcher(BlockState defaultState, ICheck check) {
public static Matcher wildcard() { public static Matcher any() {
return new Matcher(Blocks.AIR.defaultBlockState(), null); return new Matcher(Blocks.AIR.defaultBlockState(), null);
} }

View file

@ -19,6 +19,7 @@ import net.minecraft.world.level.material.Material;
import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.event.ForgeEventFactory; import net.minecraftforge.event.ForgeEventFactory;
import net.minecraftforge.eventbus.api.Event;
public class BlockAncientSapling extends BushBlock implements BonemealableBlock, IModItem, ICustomBlockState, ICustomItemModel { public class BlockAncientSapling extends BushBlock implements BonemealableBlock, IModItem, ICustomBlockState, ICustomItemModel {
@ -30,11 +31,13 @@ public class BlockAncientSapling extends BushBlock implements BonemealableBlock,
} }
@Override @Override
@SuppressWarnings("deprecation")
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) { public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
return BlockAncientSapling.SHAPE; return BlockAncientSapling.SHAPE;
} }
@Override @Override
@SuppressWarnings("deprecation")
public void randomTick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) { public void randomTick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) {
if (!level.isClientSide) { if (!level.isClientSide) {
super.randomTick(state, level, pos, random); super.randomTick(state, level, pos, random);
@ -55,7 +58,7 @@ public class BlockAncientSapling extends BushBlock implements BonemealableBlock,
} }
@Override @Override
public boolean isValidBonemealTarget(BlockGetter p_50897_, BlockPos p_50898_, BlockState p_50899_, boolean p_50900_) { public boolean isValidBonemealTarget(BlockGetter level, BlockPos pos, BlockState state, boolean b) {
return true; return true;
} }
@ -68,7 +71,7 @@ public class BlockAncientSapling extends BushBlock implements BonemealableBlock,
public void performBonemeal(ServerLevel level, RandomSource rand, BlockPos pos, BlockState state) { public void performBonemeal(ServerLevel level, RandomSource rand, BlockPos pos, BlockState state) {
if (state.getValue(SaplingBlock.STAGE) == 0) { if (state.getValue(SaplingBlock.STAGE) == 0) {
level.setBlock(pos, state.cycle(SaplingBlock.STAGE), 4); level.setBlock(pos, state.cycle(SaplingBlock.STAGE), 4);
} else if (ForgeEventFactory.saplingGrowTree(level, rand, pos)) { } else if (!ForgeEventFactory.blockGrowFeature(level, rand, pos, null).getResult().equals(Event.Result.DENY)) {
ModFeatures.Configured.ANCIENT_TREE.value().place(level, level.getChunkSource().getGenerator(), rand, pos); ModFeatures.Configured.ANCIENT_TREE.value().place(level, level.getChunkSource().getGenerator(), rand, pos);
} }
} }

View file

@ -30,6 +30,7 @@ public class BlockAnimalContainer extends BlockContainerImpl implements IVisuali
} }
@Override @Override
@SuppressWarnings("deprecation")
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) { public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
return BlockAnimalContainer.SHAPE; return BlockAnimalContainer.SHAPE;
} }

View file

@ -5,7 +5,10 @@ import de.ellpeck.naturesaura.blocks.tiles.ITickableBlockEntity;
import de.ellpeck.naturesaura.blocks.tiles.ModBlockEntities; import de.ellpeck.naturesaura.blocks.tiles.ModBlockEntities;
import de.ellpeck.naturesaura.data.BlockStateGenerator; import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.data.ItemModelGenerator; 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.core.BlockPos;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -52,12 +55,14 @@ public class BlockAuraBloom extends BushBlock implements IModItem, ICustomBlockS
} }
@Override @Override
@SuppressWarnings("deprecation")
public void entityInside(BlockState state, Level levelIn, BlockPos pos, Entity entityIn) { public void entityInside(BlockState state, Level levelIn, BlockPos pos, Entity entityIn) {
if (this == ModBlocks.AURA_CACTUS) if (this == ModBlocks.AURA_CACTUS)
entityIn.hurt(DamageSource.CACTUS, 1); entityIn.hurt(DamageSource.CACTUS, 1);
} }
@Override @Override
@SuppressWarnings("deprecation")
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) { public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
var vec3d = state.getOffset(levelIn, pos); var vec3d = state.getOffset(levelIn, pos);
return BlockAuraBloom.SHAPE.move(vec3d.x, vec3d.y, vec3d.z); return BlockAuraBloom.SHAPE.move(vec3d.x, vec3d.y, vec3d.z);

View file

@ -14,11 +14,13 @@ public class BlockAuraDetector extends BlockContainerImpl {
} }
@Override @Override
@SuppressWarnings("deprecation")
public boolean hasAnalogOutputSignal(BlockState state) { public boolean hasAnalogOutputSignal(BlockState state) {
return true; return true;
} }
@Override @Override
@SuppressWarnings("deprecation")
public int getAnalogOutputSignal(BlockState blockState, Level levelIn, BlockPos pos) { public int getAnalogOutputSignal(BlockState blockState, Level levelIn, BlockPos pos) {
var tile = levelIn.getBlockEntity(pos); var tile = levelIn.getBlockEntity(pos);
if (tile instanceof BlockEntityAuraDetector detector) if (tile instanceof BlockEntityAuraDetector detector)

View file

@ -41,6 +41,7 @@ public class BlockAuraTimer extends BlockContainerImpl implements ICustomBlockSt
} }
@Override @Override
@SuppressWarnings("deprecation")
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) { public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
return BlockAuraTimer.SHAPE; return BlockAuraTimer.SHAPE;
} }
@ -51,16 +52,19 @@ public class BlockAuraTimer extends BlockContainerImpl implements ICustomBlockSt
} }
@Override @Override
@SuppressWarnings("deprecation")
public InteractionResult use(BlockState state, Level levelIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult p_225533_6_) { public InteractionResult use(BlockState state, Level levelIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult p_225533_6_) {
return Helper.putStackOnTile(player, handIn, pos, 0, true); return Helper.putStackOnTile(player, handIn, pos, 0, true);
} }
@Override @Override
@SuppressWarnings("deprecation")
public boolean isSignalSource(BlockState state) { public boolean isSignalSource(BlockState state) {
return true; return true;
} }
@Override @Override
@SuppressWarnings("deprecation")
public int getSignal(BlockState state, BlockGetter level, BlockPos pos, Direction side) { public int getSignal(BlockState state, BlockGetter level, BlockPos pos, Direction side) {
return state.getValue(BlockStateProperties.POWERED) ? 15 : 0; return state.getValue(BlockStateProperties.POWERED) ? 15 : 0;
} }

View file

@ -31,6 +31,7 @@ public class BlockBlastFurnaceBooster extends BlockContainerImpl implements ICus
} }
@Override @Override
@SuppressWarnings("deprecation")
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) { public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
return BlockBlastFurnaceBooster.SHAPE; return BlockBlastFurnaceBooster.SHAPE;
} }

View file

@ -1,39 +0,0 @@
package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.reg.ICustomBlockState;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
public class BlockCatalyst extends BlockImpl implements ICustomBlockState {
public static final BooleanProperty NETHER = BlockNatureAltar.NETHER;
public BlockCatalyst(String baseName, Properties properties) {
super(baseName, properties);
this.registerDefaultState(this.defaultBlockState().setValue(BlockCatalyst.NETHER, false));
}
@Override
public BlockState getStateForPlacement(BlockPlaceContext context) {
var nether = IAuraType.forLevel(context.getLevel()).isSimilar(NaturesAuraAPI.TYPE_NETHER);
return super.getStateForPlacement(context).setValue(BlockCatalyst.NETHER, nether);
}
@Override
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
super.createBlockStateDefinition(builder);
builder.add(BlockCatalyst.NETHER);
}
@Override
public void generateCustomBlockState(BlockStateGenerator generator) {
generator.models().cubeAll(this.getBaseName(), generator.modLoc("block/" + this.getBaseName()));
generator.models().cubeAll(this.getBaseName() + "_nether", generator.modLoc("block/" + this.getBaseName() + "_nether"));
}
}

View file

@ -77,6 +77,7 @@ public class BlockChunkLoader extends BlockContainerImpl implements IVisualizabl
} }
@Override @Override
@SuppressWarnings("deprecation")
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) { public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
return BlockChunkLoader.SHAPE; return BlockChunkLoader.SHAPE;
} }

View file

@ -65,11 +65,13 @@ public class BlockContainerImpl extends BaseEntityBlock implements IModItem {
} }
@Override @Override
@SuppressWarnings("deprecation")
public FluidState getFluidState(BlockState state) { public FluidState getFluidState(BlockState state) {
return this.hasWaterlogging() && state.getValue(BlockStateProperties.WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); return this.hasWaterlogging() && state.getValue(BlockStateProperties.WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state);
} }
@Override @Override
@SuppressWarnings("deprecation")
public BlockState updateShape(BlockState stateIn, Direction facing, BlockState facingState, LevelAccessor levelIn, BlockPos currentPos, BlockPos facingPos) { public BlockState updateShape(BlockState stateIn, Direction facing, BlockState facingState, LevelAccessor levelIn, BlockPos currentPos, BlockPos facingPos) {
if (this.hasWaterlogging() && stateIn.getValue(BlockStateProperties.WATERLOGGED)) if (this.hasWaterlogging() && stateIn.getValue(BlockStateProperties.WATERLOGGED))
levelIn.scheduleTick(currentPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelIn)); levelIn.scheduleTick(currentPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelIn));
@ -110,6 +112,7 @@ public class BlockContainerImpl extends BaseEntityBlock implements IModItem {
} }
@Override @Override
@SuppressWarnings("deprecation")
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) { public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
var drops = super.getDrops(state, builder); var drops = super.getDrops(state, builder);
@ -126,11 +129,11 @@ public class BlockContainerImpl extends BaseEntityBlock implements IModItem {
} }
@Override @Override
public void playerWillDestroy(Level p_49852_, BlockPos p_49853_, BlockState p_49854_, Player p_49855_) { public void playerWillDestroy(Level level, BlockPos pos, BlockState state, Player player) {
var tile = p_49852_.getBlockEntity(p_49853_); var tile = level.getBlockEntity(pos);
if (tile instanceof BlockEntityImpl impl) if (tile instanceof BlockEntityImpl impl)
impl.dropInventory(); impl.dropInventory();
super.playerWillDestroy(p_49852_, p_49853_, p_49854_, p_49855_); super.playerWillDestroy(level, pos, state, player);
} }
@Override @Override
@ -141,6 +144,7 @@ public class BlockContainerImpl extends BaseEntityBlock implements IModItem {
} }
@Override @Override
@SuppressWarnings("deprecation")
public void neighborChanged(BlockState state, Level levelIn, BlockPos pos, Block blockIn, BlockPos fromPos, boolean isMoving) { public void neighborChanged(BlockState state, Level levelIn, BlockPos pos, Block blockIn, BlockPos fromPos, boolean isMoving) {
this.updateRedstoneState(levelIn, pos); this.updateRedstoneState(levelIn, pos);
} }
@ -157,6 +161,7 @@ public class BlockContainerImpl extends BaseEntityBlock implements IModItem {
} }
@Override @Override
@SuppressWarnings("deprecation")
public void tick(BlockState state, ServerLevel levelIn, BlockPos pos, RandomSource random) { public void tick(BlockState state, ServerLevel levelIn, BlockPos pos, RandomSource random) {
if (!levelIn.isClientSide) { if (!levelIn.isClientSide) {
var tile = levelIn.getBlockEntity(pos); var tile = levelIn.getBlockEntity(pos);

View file

@ -17,6 +17,7 @@ public class BlockDecayedLeaves extends BlockImpl implements ICustomBlockState {
} }
@Override @Override
@SuppressWarnings("deprecation")
public void tick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) { public void tick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) {
if (!level.isClientSide) { if (!level.isClientSide) {
level.setBlockAndUpdate(pos, Blocks.AIR.defaultBlockState()); level.setBlockAndUpdate(pos, Blocks.AIR.defaultBlockState());

View file

@ -7,7 +7,10 @@ import de.ellpeck.naturesaura.items.ModItems;
import de.ellpeck.naturesaura.packet.PacketClient; import de.ellpeck.naturesaura.packet.PacketClient;
import de.ellpeck.naturesaura.packet.PacketHandler; import de.ellpeck.naturesaura.packet.PacketHandler;
import de.ellpeck.naturesaura.packet.PacketParticles; import de.ellpeck.naturesaura.packet.PacketParticles;
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.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceKey;
@ -62,6 +65,7 @@ public class BlockDimensionRail extends BaseRailBlock implements IModItem, ICust
} }
@Override @Override
@SuppressWarnings("deprecation")
public InteractionResult use(BlockState state, Level levelIn, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { public InteractionResult use(BlockState state, Level levelIn, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
var stack = player.getItemInHand(hand); var stack = player.getItemInHand(hand);
if (stack.getItem() == ModItems.RANGE_VISUALIZER) { if (stack.getItem() == ModItems.RANGE_VISUALIZER) {
@ -133,6 +137,7 @@ public class BlockDimensionRail extends BaseRailBlock implements IModItem, ICust
} }
@Override @Override
@SuppressWarnings({"deprecation", "RedundantSuppression"})
public Property<RailShape> getShapeProperty() { public Property<RailShape> getShapeProperty() {
return BlockDimensionRail.SHAPE; return BlockDimensionRail.SHAPE;
} }

View file

@ -41,10 +41,11 @@ public class BlockEndFlower extends BushBlock implements IModItem, ICustomBlockS
super(Properties.of(Material.GRASS).noCollission().strength(0.5F).sound(SoundType.GRASS)); super(Properties.of(Material.GRASS).noCollission().strength(0.5F).sound(SoundType.GRASS));
MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(this);
ModRegistry.ALL_ITEMS.add(this); ModRegistry.ALL_ITEMS.add(this);
ModRegistry.ALL_ITEMS.add(new ModTileType<BlockEntityEndFlower>(BlockEntityEndFlower::new, this)); ModRegistry.ALL_ITEMS.add(new ModTileType<>(BlockEntityEndFlower::new, this));
} }
@Override @Override
@SuppressWarnings("deprecation")
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) { public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
var vec3d = state.getOffset(levelIn, pos); var vec3d = state.getOffset(levelIn, pos);
return BlockEndFlower.SHAPE.move(vec3d.x, vec3d.y, vec3d.z); return BlockEndFlower.SHAPE.move(vec3d.x, vec3d.y, vec3d.z);
@ -104,6 +105,7 @@ public class BlockEndFlower extends BushBlock implements IModItem, ICustomBlockS
} }
@Override @Override
@SuppressWarnings("deprecation")
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) { public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
var tile = builder.getOptionalParameter(LootContextParams.BLOCK_ENTITY); var tile = builder.getOptionalParameter(LootContextParams.BLOCK_ENTITY);
if (tile instanceof BlockEntityEndFlower f && f.isDrainMode) if (tile instanceof BlockEntityEndFlower f && f.isDrainMode)

View file

@ -87,6 +87,7 @@ public class BlockEnderCrate extends BlockContainerImpl implements ITESRProvider
} }
@Override @Override
@SuppressWarnings("deprecation")
public InteractionResult use(BlockState state, Level levelIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) { public InteractionResult use(BlockState state, Level levelIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) {
if (!levelIn.isClientSide) { if (!levelIn.isClientSide) {
var tile = levelIn.getBlockEntity(pos); var tile = levelIn.getBlockEntity(pos);

View file

@ -26,7 +26,8 @@ public class BlockFieldCreator extends BlockContainerImpl implements ICustomBloc
} }
@Override @Override
public InteractionResult use(BlockState state, Level levelIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult p_225533_6_) { @SuppressWarnings("deprecation")
public InteractionResult use(BlockState state, Level levelIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult result) {
var tile = levelIn.getBlockEntity(pos); var tile = levelIn.getBlockEntity(pos);
if (tile instanceof BlockEntityFieldCreator) { if (tile instanceof BlockEntityFieldCreator) {
if (!levelIn.isClientSide) { if (!levelIn.isClientSide) {

View file

@ -27,7 +27,7 @@ public class BlockFurnaceHeater extends BlockContainerImpl implements ICustomBlo
public static final DirectionProperty FACING = BlockStateProperties.FACING; public static final DirectionProperty FACING = BlockStateProperties.FACING;
private static final VoxelShape[] SHAPES = new VoxelShape[]{ private static final VoxelShape[] SHAPES = {
Block.box(2, 12, 2, 14, 16, 14), // Down Block.box(2, 12, 2, 14, 16, 14), // Down
Block.box(2, 0, 2, 14, 4, 14), // Up Block.box(2, 0, 2, 14, 4, 14), // Up
Block.box(2, 2, 12, 14, 14, 16), // North Block.box(2, 2, 12, 14, 14, 16), // North
@ -79,6 +79,7 @@ public class BlockFurnaceHeater extends BlockContainerImpl implements ICustomBlo
} }
@Override @Override
@SuppressWarnings("deprecation")
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) { public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
return BlockFurnaceHeater.SHAPES[state.getValue(BlockFurnaceHeater.FACING).get3DDataValue()]; return BlockFurnaceHeater.SHAPES[state.getValue(BlockFurnaceHeater.FACING).get3DDataValue()];
} }

View file

@ -31,7 +31,7 @@ public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock,
public static final EnumProperty<RedstoneSide> EAST = BlockStateProperties.EAST_REDSTONE; public static final EnumProperty<RedstoneSide> EAST = BlockStateProperties.EAST_REDSTONE;
public static final EnumProperty<RedstoneSide> SOUTH = BlockStateProperties.SOUTH_REDSTONE; public static final EnumProperty<RedstoneSide> SOUTH = BlockStateProperties.SOUTH_REDSTONE;
public static final EnumProperty<RedstoneSide> WEST = BlockStateProperties.WEST_REDSTONE; public static final EnumProperty<RedstoneSide> WEST = BlockStateProperties.WEST_REDSTONE;
protected static final VoxelShape[] SHAPES = new VoxelShape[]{Block.box(3.0D, 0.0D, 3.0D, 13.0D, 1.0D, 13.0D), Block.box(3.0D, 0.0D, 3.0D, 13.0D, 1.0D, 16.0D), Block.box(0.0D, 0.0D, 3.0D, 13.0D, 1.0D, 13.0D), Block.box(0.0D, 0.0D, 3.0D, 13.0D, 1.0D, 16.0D), Block.box(3.0D, 0.0D, 0.0D, 13.0D, 1.0D, 13.0D), Block.box(3.0D, 0.0D, 0.0D, 13.0D, 1.0D, 16.0D), Block.box(0.0D, 0.0D, 0.0D, 13.0D, 1.0D, 13.0D), Block.box(0.0D, 0.0D, 0.0D, 13.0D, 1.0D, 16.0D), Block.box(3.0D, 0.0D, 3.0D, 16.0D, 1.0D, 13.0D), Block.box(3.0D, 0.0D, 3.0D, 16.0D, 1.0D, 16.0D), Block.box(0.0D, 0.0D, 3.0D, 16.0D, 1.0D, 13.0D), Block.box(0.0D, 0.0D, 3.0D, 16.0D, 1.0D, 16.0D), Block.box(3.0D, 0.0D, 0.0D, 16.0D, 1.0D, 13.0D), Block.box(3.0D, 0.0D, 0.0D, 16.0D, 1.0D, 16.0D), Block.box(0.0D, 0.0D, 0.0D, 16.0D, 1.0D, 13.0D), Block.box(0.0D, 0.0D, 0.0D, 16.0D, 1.0D, 16.0D)}; protected static final VoxelShape[] SHAPES = {Block.box(3.0D, 0.0D, 3.0D, 13.0D, 1.0D, 13.0D), Block.box(3.0D, 0.0D, 3.0D, 13.0D, 1.0D, 16.0D), Block.box(0.0D, 0.0D, 3.0D, 13.0D, 1.0D, 13.0D), Block.box(0.0D, 0.0D, 3.0D, 13.0D, 1.0D, 16.0D), Block.box(3.0D, 0.0D, 0.0D, 13.0D, 1.0D, 13.0D), Block.box(3.0D, 0.0D, 0.0D, 13.0D, 1.0D, 16.0D), Block.box(0.0D, 0.0D, 0.0D, 13.0D, 1.0D, 13.0D), Block.box(0.0D, 0.0D, 0.0D, 13.0D, 1.0D, 16.0D), Block.box(3.0D, 0.0D, 3.0D, 16.0D, 1.0D, 13.0D), Block.box(3.0D, 0.0D, 3.0D, 16.0D, 1.0D, 16.0D), Block.box(0.0D, 0.0D, 3.0D, 16.0D, 1.0D, 13.0D), Block.box(0.0D, 0.0D, 3.0D, 16.0D, 1.0D, 16.0D), Block.box(3.0D, 0.0D, 0.0D, 16.0D, 1.0D, 13.0D), Block.box(3.0D, 0.0D, 0.0D, 16.0D, 1.0D, 16.0D), Block.box(0.0D, 0.0D, 0.0D, 16.0D, 1.0D, 13.0D), Block.box(0.0D, 0.0D, 0.0D, 16.0D, 1.0D, 16.0D)};
public BlockGoldPowder() { public BlockGoldPowder() {
super("gold_powder", Properties.copy(Blocks.REDSTONE_WIRE)); super("gold_powder", Properties.copy(Blocks.REDSTONE_WIRE));
@ -71,6 +71,7 @@ public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock,
} }
@Override @Override
@SuppressWarnings("deprecation")
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) { public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
return BlockGoldPowder.SHAPES[BlockGoldPowder.getShapeIndex(state)]; return BlockGoldPowder.SHAPES[BlockGoldPowder.getShapeIndex(state)];
} }
@ -83,6 +84,7 @@ public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock,
} }
@Override @Override
@SuppressWarnings("deprecation")
public BlockState updateShape(BlockState stateIn, Direction facing, BlockState facingState, LevelAccessor levelIn, BlockPos currentPos, BlockPos facingPos) { public BlockState updateShape(BlockState stateIn, Direction facing, BlockState facingState, LevelAccessor levelIn, BlockPos currentPos, BlockPos facingPos) {
if (facing == Direction.DOWN) { if (facing == Direction.DOWN) {
return stateIn; return stateIn;
@ -116,6 +118,7 @@ public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock,
} }
@Override @Override
@SuppressWarnings("deprecation")
public boolean canSurvive(BlockState state, LevelReader levelIn, BlockPos pos) { public boolean canSurvive(BlockState state, LevelReader levelIn, BlockPos pos) {
var blockpos = pos.below(); var blockpos = pos.below();
var blockstate = levelIn.getBlockState(blockpos); var blockstate = levelIn.getBlockState(blockpos);
@ -123,11 +126,13 @@ public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock,
} }
@Override @Override
@SuppressWarnings("deprecation")
public VoxelShape getCollisionShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) { public VoxelShape getCollisionShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
return Shapes.empty(); return Shapes.empty();
} }
@Override @Override
@SuppressWarnings("deprecation")
public void onPlace(BlockState state, Level levelIn, BlockPos pos, BlockState oldState, boolean isMoving) { public void onPlace(BlockState state, Level levelIn, BlockPos pos, BlockState oldState, boolean isMoving) {
if (oldState.getBlock() != state.getBlock() && !levelIn.isClientSide) { if (oldState.getBlock() != state.getBlock() && !levelIn.isClientSide) {
for (var direction : Direction.Plane.VERTICAL) { for (var direction : Direction.Plane.VERTICAL) {
@ -149,6 +154,7 @@ public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock,
} }
@Override @Override
@SuppressWarnings("deprecation")
public void onRemove(BlockState state, Level levelIn, BlockPos pos, BlockState newState, boolean isMoving) { public void onRemove(BlockState state, Level levelIn, BlockPos pos, BlockState newState, boolean isMoving) {
if (!isMoving && state.getBlock() != newState.getBlock()) { if (!isMoving && state.getBlock() != newState.getBlock()) {
super.onRemove(state, levelIn, pos, newState, isMoving); super.onRemove(state, levelIn, pos, newState, isMoving);
@ -173,6 +179,7 @@ public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock,
} }
@Override @Override
@SuppressWarnings("deprecation")
public void neighborChanged(BlockState state, Level levelIn, BlockPos pos, Block blockIn, BlockPos fromPos, boolean isMoving) { public void neighborChanged(BlockState state, Level levelIn, BlockPos pos, Block blockIn, BlockPos fromPos, boolean isMoving) {
if (!levelIn.isClientSide) { if (!levelIn.isClientSide) {
if (!state.canSurvive(levelIn, pos)) { if (!state.canSurvive(levelIn, pos)) {
@ -183,6 +190,7 @@ public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock,
} }
@Override @Override
@SuppressWarnings("deprecation")
public void updateIndirectNeighbourShapes(BlockState state, LevelAccessor levelIn, BlockPos pos, int flags, int recursionLeft) { public void updateIndirectNeighbourShapes(BlockState state, LevelAccessor levelIn, BlockPos pos, int flags, int recursionLeft) {
var pool = new BlockPos.MutableBlockPos(); var pool = new BlockPos.MutableBlockPos();
for (var direction : Direction.Plane.HORIZONTAL) { for (var direction : Direction.Plane.HORIZONTAL) {

View file

@ -60,6 +60,7 @@ public class BlockGratedChute extends BlockContainerImpl implements ICustomBlock
} }
@Override @Override
@SuppressWarnings("deprecation")
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) { public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
return switch (state.getValue(BlockGratedChute.FACING)) { return switch (state.getValue(BlockGratedChute.FACING)) {
case DOWN -> BlockGratedChute.DOWN_SHAPE; case DOWN -> BlockGratedChute.DOWN_SHAPE;
@ -72,6 +73,7 @@ public class BlockGratedChute extends BlockContainerImpl implements ICustomBlock
} }
@Override @Override
@SuppressWarnings("deprecation")
public VoxelShape getInteractionShape(BlockState state, BlockGetter levelIn, BlockPos pos) { public VoxelShape getInteractionShape(BlockState state, BlockGetter levelIn, BlockPos pos) {
return switch (state.getValue(BlockGratedChute.FACING)) { return switch (state.getValue(BlockGratedChute.FACING)) {
case DOWN -> BlockGratedChute.DOWN_RAYTRACE_SHAPE; case DOWN -> BlockGratedChute.DOWN_RAYTRACE_SHAPE;
@ -84,6 +86,7 @@ public class BlockGratedChute extends BlockContainerImpl implements ICustomBlock
} }
@Override @Override
@SuppressWarnings("deprecation")
public InteractionResult use(BlockState state, Level levelIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) { public InteractionResult use(BlockState state, Level levelIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) {
if (!player.isCrouching()) if (!player.isCrouching())
return InteractionResult.FAIL; return InteractionResult.FAIL;
@ -112,11 +115,13 @@ public class BlockGratedChute extends BlockContainerImpl implements ICustomBlock
} }
@Override @Override
public boolean hasAnalogOutputSignal(BlockState p_60457_) { @SuppressWarnings("deprecation")
public boolean hasAnalogOutputSignal(BlockState state) {
return true; return true;
} }
@Override @Override
@SuppressWarnings("deprecation")
public int getAnalogOutputSignal(BlockState blockState, Level levelIn, BlockPos pos) { public int getAnalogOutputSignal(BlockState blockState, Level levelIn, BlockPos pos) {
var tile = levelIn.getBlockEntity(pos); var tile = levelIn.getBlockEntity(pos);
if (tile instanceof BlockEntityGratedChute) { if (tile instanceof BlockEntityGratedChute) {

View file

@ -19,6 +19,7 @@ public class BlockItemDistributor extends BlockContainerImpl implements ICustomB
} }
@Override @Override
@SuppressWarnings("deprecation")
public InteractionResult use(BlockState state, Level levelIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) { public InteractionResult use(BlockState state, Level levelIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) {
if (!player.isCrouching()) if (!player.isCrouching())
return InteractionResult.FAIL; return InteractionResult.FAIL;

View file

@ -36,11 +36,13 @@ public class BlockLight extends BlockImpl implements ICustomBlockState, INoItemB
} }
@Override @Override
@SuppressWarnings("deprecation")
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) { public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
return BlockLight.SHAPE; return BlockLight.SHAPE;
} }
@Override @Override
@SuppressWarnings("deprecation")
public boolean canBeReplaced(BlockState state, BlockPlaceContext useContext) { public boolean canBeReplaced(BlockState state, BlockPlaceContext useContext) {
return true; return true;
} }

View file

@ -1,8 +1,6 @@
package de.ellpeck.naturesaura.blocks; package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.Helper; import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityNatureAltar; import de.ellpeck.naturesaura.blocks.tiles.BlockEntityNatureAltar;
import de.ellpeck.naturesaura.blocks.tiles.ModBlockEntities; import de.ellpeck.naturesaura.blocks.tiles.ModBlockEntities;
import de.ellpeck.naturesaura.blocks.tiles.render.RenderNatureAltar; import de.ellpeck.naturesaura.blocks.tiles.render.RenderNatureAltar;
@ -14,29 +12,22 @@ import net.minecraft.core.BlockPos;
import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.material.Material; import net.minecraft.world.level.material.Material;
import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraft.world.phys.shapes.VoxelShape;
import javax.annotation.Nullable;
public class BlockNatureAltar extends BlockContainerImpl implements ITESRProvider<BlockEntityNatureAltar>, ICustomBlockState { public class BlockNatureAltar extends BlockContainerImpl implements ITESRProvider<BlockEntityNatureAltar>, ICustomBlockState {
private static final VoxelShape SHAPE = Shapes.create(0, 0, 0, 1, 12 / 16F, 1); private static final VoxelShape SHAPE = Shapes.create(0, 0, 0, 1, 12 / 16F, 1);
public static final BooleanProperty NETHER = BooleanProperty.create("nether");
public BlockNatureAltar() { public BlockNatureAltar() {
super("nature_altar", BlockEntityNatureAltar.class, Block.Properties.of(Material.STONE).strength(4F)); super("nature_altar", BlockEntityNatureAltar.class, Block.Properties.of(Material.STONE).strength(4F));
this.registerDefaultState(this.defaultBlockState().setValue(BlockNatureAltar.NETHER, false));
} }
@Override @Override
@ -45,32 +36,20 @@ public class BlockNatureAltar extends BlockContainerImpl implements ITESRProvide
} }
@Override @Override
@SuppressWarnings("deprecation")
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) { public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
return BlockNatureAltar.SHAPE; return BlockNatureAltar.SHAPE;
} }
@Override @Override
@SuppressWarnings("deprecation")
public InteractionResult use(BlockState state, Level levelIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) { public InteractionResult use(BlockState state, Level levelIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) {
return Helper.putStackOnTile(player, handIn, pos, 0, true); return Helper.putStackOnTile(player, handIn, pos, 0, true);
} }
@Override @Override
public void generateCustomBlockState(BlockStateGenerator generator) { public void generateCustomBlockState(BlockStateGenerator generator) {
// noop generator.simpleBlock(this, generator.models().getExistingFile(generator.modLoc(this.getBaseName())));
}
@Override
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
super.createBlockStateDefinition(builder);
builder.add(BlockNatureAltar.NETHER);
}
@Nullable
@Override
public BlockState getStateForPlacement(BlockPlaceContext context) {
var nether = IAuraType.forLevel(context.getLevel()).isSimilar(NaturesAuraAPI.TYPE_NETHER);
return super.getStateForPlacement(context).setValue(BlockNatureAltar.NETHER, nether);
} }
@Override @Override

View file

@ -19,6 +19,7 @@ public class BlockNetherGrass extends BlockImpl implements ICustomBlockState, Bo
} }
@Override @Override
@SuppressWarnings("deprecation")
public void randomTick(BlockState state, ServerLevel levelIn, BlockPos pos, RandomSource random) { public void randomTick(BlockState state, ServerLevel levelIn, BlockPos pos, RandomSource random) {
var up = pos.above(); var up = pos.above();
var upState = levelIn.getBlockState(up); var upState = levelIn.getBlockState(up);

View file

@ -36,11 +36,13 @@ public class BlockOfferingTable extends BlockContainerImpl implements ITESRProvi
} }
@Override @Override
@SuppressWarnings("deprecation")
public InteractionResult use(BlockState state, Level levelIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) { public InteractionResult use(BlockState state, Level levelIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) {
return Helper.putStackOnTile(player, handIn, pos, 0, true); return Helper.putStackOnTile(player, handIn, pos, 0, true);
} }
@Override @Override
@SuppressWarnings("deprecation")
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) { public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
return BlockOfferingTable.SHAPE; return BlockOfferingTable.SHAPE;
} }

View file

@ -26,6 +26,7 @@ public class BlockPowderPlacer extends BlockContainerImpl implements ICustomBloc
} }
@Override @Override
@SuppressWarnings("deprecation")
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) { public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
return BlockPowderPlacer.SHAPE; return BlockPowderPlacer.SHAPE;
} }

View file

@ -79,6 +79,7 @@ public class BlockSpawnLamp extends BlockContainerImpl implements IVisualizable,
} }
@Override @Override
@SuppressWarnings("deprecation")
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) { public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
return BlockSpawnLamp.SHAPE; return BlockSpawnLamp.SHAPE;
} }

View file

@ -65,6 +65,7 @@ public class BlockSpring extends BlockContainerImpl implements ICustomBlockState
} }
@Override @Override
@SuppressWarnings({"deprecation", "RedundantSuppression"})
public Optional<SoundEvent> getPickupSound() { public Optional<SoundEvent> getPickupSound() {
return Fluids.WATER.getPickupSound(); return Fluids.WATER.getPickupSound();
} }

View file

@ -14,6 +14,7 @@ import net.minecraft.core.BlockPos;
import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
@ -48,6 +49,7 @@ public class BlockWoodStand extends BlockContainerImpl implements ITESRProvider<
} }
@Override @Override
@SuppressWarnings("deprecation")
public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) { public VoxelShape getShape(BlockState state, BlockGetter levelIn, BlockPos pos, CollisionContext context) {
return BlockWoodStand.SHAPE; return BlockWoodStand.SHAPE;
} }
@ -58,8 +60,7 @@ public class BlockWoodStand extends BlockContainerImpl implements ITESRProvider<
var pos = event.getPos(); var pos = event.getPos();
if (!level.isClientSide() && level instanceof Level) { if (!level.isClientSide() && level instanceof Level) {
if (Multiblocks.TREE_RITUAL.isComplete((Level) level, pos)) { if (Multiblocks.TREE_RITUAL.isComplete((Level) level, pos)) {
var sapling = level.getBlockState(pos); var saplingStack = new ItemStack(level.getBlockState(pos).getBlock());
var saplingStack = sapling.getBlock().getCloneItemStack(level, pos, sapling);
if (!saplingStack.isEmpty()) { if (!saplingStack.isEmpty()) {
for (var recipe : ((Level) level).getRecipeManager().getRecipesFor(ModRecipes.TREE_RITUAL_TYPE, null, null)) { for (var recipe : ((Level) level).getRecipeManager().getRecipesFor(ModRecipes.TREE_RITUAL_TYPE, null, null)) {
if (recipe.saplingType.test(saplingStack)) { if (recipe.saplingType.test(saplingStack)) {
@ -100,6 +101,7 @@ public class BlockWoodStand extends BlockContainerImpl implements ITESRProvider<
} }
@Override @Override
@SuppressWarnings("deprecation")
public InteractionResult use(BlockState state, Level levelIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) { public InteractionResult use(BlockState state, Level levelIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) {
return Helper.putStackOnTile(player, handIn, pos, 0, true); return Helper.putStackOnTile(player, handIn, pos, 0, true);
} }

View file

@ -2,7 +2,7 @@ package de.ellpeck.naturesaura.blocks;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
@SuppressWarnings("FieldNamingConvention") @SuppressWarnings("NonConstantFieldWithUpperCaseName")
public final class ModBlocks { public final class ModBlocks {
public static Block ANCIENT_LOG; public static Block ANCIENT_LOG;

View file

@ -4,41 +4,31 @@ import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.multiblock.IMultiblock; import de.ellpeck.naturesaura.api.multiblock.IMultiblock;
import de.ellpeck.naturesaura.api.multiblock.Matcher; import de.ellpeck.naturesaura.api.multiblock.Matcher;
import de.ellpeck.naturesaura.blocks.BlockNatureAltar;
import de.ellpeck.naturesaura.blocks.ModBlocks; import de.ellpeck.naturesaura.blocks.ModBlocks;
import de.ellpeck.naturesaura.data.BlockTagProvider; import de.ellpeck.naturesaura.data.BlockTagProvider;
import de.ellpeck.naturesaura.recipes.ModRecipes; import de.ellpeck.naturesaura.recipes.ModRecipes;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags; import net.minecraft.tags.BlockTags;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.SaplingBlock; import net.minecraft.world.level.block.SaplingBlock;
import net.minecraft.world.level.material.Material; import net.minecraft.world.level.material.Material;
public final class Multiblocks { public final class Multiblocks {
private static final String[][] ALTAR_PATTERN = new String[][]{
{" M ", " ", " ", " ", "M M", " ", " ", " ", " M "},
{" B ", " ", " ", " ", "B B", " ", " ", " ", " B "},
{" B ", " ", " M M ", " ", "B 0 B", " ", " M M ", " ", " B "},
{" ", " WBW ", " WBW ", " WWCWCWW ", " BBW WBB ", " WWCWCWW ", " WBW ", " WBW ", " "}};
public static final IMultiblock ALTAR = NaturesAuraAPI.instance().createMultiblock( public static final IMultiblock ALTAR = NaturesAuraAPI.instance().createMultiblock(
new ResourceLocation(NaturesAura.MOD_ID, "altar"), new ResourceLocation(NaturesAura.MOD_ID, "altar"),
Multiblocks.ALTAR_PATTERN, new String[][]{
'C', Blocks.CHISELED_STONE_BRICKS, {" M ", " ", " ", " ", "M M", " ", " ", " ", " M "},
{" B ", " ", " ", " ", "B B", " ", " ", " ", " B "},
{" B ", " ", " M M ", " ", "B 0 B", " ", " M M ", " ", " B "},
{" ", " WBW ", " WBW ", " WWCWCWW ", " BBW WBB ", " WWCWCWW ", " WBW ", " WBW ", " "}},
'C', Matcher.tag(Blocks.CHISELED_STONE_BRICKS, BlockTagProvider.ALTAR_FANCY_BRICK),
'B', Matcher.tag(Blocks.STONE_BRICKS, BlockTagProvider.ALTAR_STONE), 'B', Matcher.tag(Blocks.STONE_BRICKS, BlockTagProvider.ALTAR_STONE),
'W', Matcher.tag(Blocks.OAK_PLANKS, BlockTagProvider.ALTAR_WOOD), 'W', Matcher.tag(Blocks.OAK_PLANKS, BlockTagProvider.ALTAR_WOOD),
'M', ModBlocks.GOLD_BRICK, 'M', Matcher.tag(ModBlocks.GOLD_BRICK, BlockTagProvider.ALTAR_GOLD_BRICK),
'0', ModBlocks.NATURE_ALTAR, '0', ModBlocks.NATURE_ALTAR,
' ', Matcher.wildcard()); ' ', Matcher.any());
public static final IMultiblock NETHER_ALTAR = NaturesAuraAPI.instance().createMultiblock(
new ResourceLocation(NaturesAura.MOD_ID, "nether_altar"),
Multiblocks.ALTAR_PATTERN,
'C', Blocks.RED_NETHER_BRICKS,
'B', Matcher.tag(Blocks.NETHER_BRICKS, BlockTagProvider.NETHER_ALTAR_STONE),
'W', Matcher.tag(Blocks.CRIMSON_PLANKS, BlockTagProvider.NETHER_ALTAR_WOOD),
'M', ModBlocks.GOLD_NETHER_BRICK,
'0', ModBlocks.NATURE_ALTAR.defaultBlockState().setValue(BlockNatureAltar.NETHER, true),
' ', Matcher.wildcard());
public static final IMultiblock TREE_RITUAL = NaturesAuraAPI.instance().createMultiblock( public static final IMultiblock TREE_RITUAL = NaturesAuraAPI.instance().createMultiblock(
new ResourceLocation(NaturesAura.MOD_ID, "tree_ritual"), new ResourceLocation(NaturesAura.MOD_ID, "tree_ritual"),
new String[][]{ new String[][]{
@ -52,14 +42,14 @@ public final class Multiblocks {
return true; return true;
// try-catch to prevent blocks that need to have been placed crashing here // try-catch to prevent blocks that need to have been placed crashing here
try { try {
var stack = state.getBlock().getCloneItemStack(level, pos, state); var stack = new ItemStack(state.getBlock());
return !stack.isEmpty() && level.getRecipeManager().getRecipesFor(ModRecipes.TREE_RITUAL_TYPE, null, null).stream().anyMatch(r -> r.saplingType.test(stack)); return !stack.isEmpty() && level.getRecipeManager().getRecipesFor(ModRecipes.TREE_RITUAL_TYPE, null, null).stream().anyMatch(r -> r.saplingType.test(stack));
} catch (Exception e) { } catch (Exception e) {
return false; return false;
} }
} }
), ),
' ', Matcher.wildcard()); ' ', Matcher.any());
public static final IMultiblock POTION_GENERATOR = NaturesAuraAPI.instance().createMultiblock( public static final IMultiblock POTION_GENERATOR = NaturesAuraAPI.instance().createMultiblock(
new ResourceLocation(NaturesAura.MOD_ID, "potion_generator"), new ResourceLocation(NaturesAura.MOD_ID, "potion_generator"),
new String[][]{ new String[][]{
@ -70,7 +60,7 @@ public final class Multiblocks {
'N', Blocks.NETHER_BRICKS, 'N', Blocks.NETHER_BRICKS,
'R', Blocks.RED_NETHER_BRICKS, 'R', Blocks.RED_NETHER_BRICKS,
'0', ModBlocks.POTION_GENERATOR, '0', ModBlocks.POTION_GENERATOR,
' ', Matcher.wildcard()); ' ', Matcher.any());
public static final IMultiblock OFFERING_TABLE = NaturesAuraAPI.instance().createMultiblock( public static final IMultiblock OFFERING_TABLE = NaturesAuraAPI.instance().createMultiblock(
new ResourceLocation(NaturesAura.MOD_ID, "offering_table"), new ResourceLocation(NaturesAura.MOD_ID, "offering_table"),
new String[][]{ new String[][]{
@ -78,7 +68,7 @@ public final class Multiblocks {
'R', new Matcher(Blocks.POPPY.defaultBlockState(), 'R', new Matcher(Blocks.POPPY.defaultBlockState(),
(level, start, offset, pos, state, c) -> state.is(BlockTags.SMALL_FLOWERS)), (level, start, offset, pos, state, c) -> state.is(BlockTags.SMALL_FLOWERS)),
'0', ModBlocks.OFFERING_TABLE, '0', ModBlocks.OFFERING_TABLE,
' ', Matcher.wildcard()); ' ', Matcher.any());
public static final IMultiblock ANIMAL_SPAWNER = NaturesAuraAPI.instance().createMultiblock( public static final IMultiblock ANIMAL_SPAWNER = NaturesAuraAPI.instance().createMultiblock(
new ResourceLocation(NaturesAura.MOD_ID, "animal_spawner"), new ResourceLocation(NaturesAura.MOD_ID, "animal_spawner"),
new String[][]{ new String[][]{
@ -88,7 +78,7 @@ public final class Multiblocks {
'R', ModBlocks.INFUSED_BRICK, 'R', ModBlocks.INFUSED_BRICK,
'W', ModBlocks.ANCIENT_PLANKS, 'W', ModBlocks.ANCIENT_PLANKS,
'0', ModBlocks.ANIMAL_SPAWNER, '0', ModBlocks.ANIMAL_SPAWNER,
' ', Matcher.wildcard()); ' ', Matcher.any());
public static final IMultiblock AUTO_CRAFTER = NaturesAuraAPI.instance().createMultiblock( public static final IMultiblock AUTO_CRAFTER = NaturesAuraAPI.instance().createMultiblock(
new ResourceLocation(NaturesAura.MOD_ID, "auto_crafter"), new ResourceLocation(NaturesAura.MOD_ID, "auto_crafter"),
new String[][]{ new String[][]{
@ -96,7 +86,7 @@ public final class Multiblocks {
'P', ModBlocks.ANCIENT_PLANKS, 'P', ModBlocks.ANCIENT_PLANKS,
'L', ModBlocks.ANCIENT_LOG, 'L', ModBlocks.ANCIENT_LOG,
'0', ModBlocks.AUTO_CRAFTER, '0', ModBlocks.AUTO_CRAFTER,
' ', Matcher.wildcard()); ' ', Matcher.any());
public static final IMultiblock RF_CONVERTER = NaturesAuraAPI.instance().createMultiblock( public static final IMultiblock RF_CONVERTER = NaturesAuraAPI.instance().createMultiblock(
new ResourceLocation(NaturesAura.MOD_ID, "rf_converter"), new ResourceLocation(NaturesAura.MOD_ID, "rf_converter"),
new String[][]{ new String[][]{
@ -109,5 +99,5 @@ public final class Multiblocks {
{" ", " ", " ", " R ", " ", " ", " "}}, {" ", " ", " ", " R ", " ", " ", " "}},
'R', Blocks.REDSTONE_BLOCK, 'R', Blocks.REDSTONE_BLOCK,
'0', ModBlocks.RF_CONVERTER, '0', ModBlocks.RF_CONVERTER,
' ', Matcher.wildcard()); ' ', Matcher.any());
} }

View file

@ -151,7 +151,8 @@ public class BlockEntityImpl extends BlockEntity {
var compound = new CompoundTag(); var compound = new CompoundTag();
this.writeNBT(compound, SaveType.BLOCK); this.writeNBT(compound, SaveType.BLOCK);
if (!compound.isEmpty()) { if (!compound.isEmpty()) {
if (!regularItem.hasTag()) regularItem.setTag(new CompoundTag()); if (!regularItem.hasTag())
regularItem.setTag(new CompoundTag());
regularItem.getTag().put("data", compound); regularItem.getTag().put("data", compound);
} }
} }
@ -159,7 +160,8 @@ public class BlockEntityImpl extends BlockEntity {
public void loadDataOnPlace(ItemStack stack) { public void loadDataOnPlace(ItemStack stack) {
if (stack.hasTag()) { if (stack.hasTag()) {
var compound = stack.getTag().getCompound("data"); var compound = stack.getTag().getCompound("data");
if (compound != null) this.readNBT(compound, SaveType.BLOCK); if (compound != null)
this.readNBT(compound, SaveType.BLOCK);
} }
} }

View file

@ -57,11 +57,10 @@ public class BlockEntityNatureAltar extends BlockEntityImpl implements ITickable
}; };
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public int bobTimer; public int bobTimer;
public StructureState structureState = StructureState.INVALID; public boolean isComplete;
private AltarRecipe currentRecipe; private AltarRecipe currentRecipe;
private int timer; private int timer;
private int lastAura; private int lastAura;
private boolean firstTick = true; private boolean firstTick = true;
@ -79,7 +78,7 @@ public class BlockEntityNatureAltar extends BlockEntityImpl implements ITickable
for (var z = -2; z <= 2; z += 4) { for (var z = -2; z <= 2; z += 4) {
var offset = this.worldPosition.offset(x, 1, z); var offset = this.worldPosition.offset(x, 1, z);
var state = this.level.getBlockState(offset); var state = this.level.getBlockState(offset);
this.catalysts[index] = state.getBlock().getCloneItemStack(this.level, offset, state); this.catalysts[index] = new ItemStack(state.getBlock());
index++; index++;
} }
} }
@ -87,18 +86,18 @@ public class BlockEntityNatureAltar extends BlockEntityImpl implements ITickable
if (!this.level.isClientSide) { if (!this.level.isClientSide) {
if (this.level.getGameTime() % 40 == 0 || this.firstTick) { if (this.level.getGameTime() % 40 == 0 || this.firstTick) {
var newState = this.getNewState(); var complete = Multiblocks.ALTAR.isComplete(this.level, this.worldPosition);
if (newState != this.structureState) { if (complete != this.isComplete) {
this.structureState = newState; this.isComplete = complete;
this.sendToClients(); this.sendToClients();
} }
this.firstTick = false; this.firstTick = false;
} }
if (this.structureState != StructureState.INVALID) { if (this.isComplete) {
var type = IAuraType.forLevel(this.level);
var space = this.container.storeAura(300, true); var space = this.container.storeAura(300, true);
IAuraType expectedType = this.structureState == StructureState.NETHER ? NaturesAuraAPI.TYPE_NETHER : NaturesAuraAPI.TYPE_OVERWORLD; if (space > 0 && (type.isSimilar(NaturesAuraAPI.TYPE_OVERWORLD) || type.isSimilar(NaturesAuraAPI.TYPE_NETHER))) {
if (space > 0 && IAuraType.forLevel(this.level).isSimilar(expectedType)) {
var toStore = Math.min(IAuraChunk.getAuraInArea(this.level, this.worldPosition, 20), space); var toStore = Math.min(IAuraChunk.getAuraInArea(this.level, this.worldPosition, 20), space);
if (toStore > 0) { if (toStore > 0) {
var spot = IAuraChunk.getHighestSpot(this.level, this.worldPosition, 20, this.worldPosition); var spot = IAuraChunk.getHighestSpot(this.level, this.worldPosition, 20, this.worldPosition);
@ -167,7 +166,7 @@ public class BlockEntityNatureAltar extends BlockEntityImpl implements ITickable
this.sendToClients(); this.sendToClients();
} }
} else { } else {
if (this.structureState != StructureState.INVALID) { if (this.isComplete) {
if (rand.nextFloat() >= 0.7F) { if (rand.nextFloat() >= 0.7F) {
var fourths = this.container.getMaxAura() / 4; var fourths = this.container.getMaxAura() / 4;
if (this.container.getStoredAura() > 0) { if (this.container.getStoredAura() > 0) {
@ -199,33 +198,25 @@ public class BlockEntityNatureAltar extends BlockEntityImpl implements ITickable
} }
private AltarRecipe getRecipeForInput(ItemStack input) { private AltarRecipe getRecipeForInput(ItemStack input) {
var type = IAuraType.forLevel(this.level);
for (var recipe : this.level.getRecipeManager().getRecipesFor(ModRecipes.ALTAR_TYPE, null, null)) { for (var recipe : this.level.getRecipeManager().getRecipesFor(ModRecipes.ALTAR_TYPE, null, null)) {
if (recipe.input.test(input) && (recipe.requiredType == null || type.isSimilar(recipe.requiredType))) { if (recipe.input.test(input)) {
if (recipe.catalyst == Ingredient.EMPTY) if (recipe.catalyst == Ingredient.EMPTY)
return recipe; return recipe;
for (var stack : this.catalysts) for (var stack : this.catalysts) {
if (recipe.catalyst.test(stack)) if (recipe.catalyst.test(stack))
return recipe; return recipe;
}
} }
} }
return null; return null;
} }
private StructureState getNewState() {
if (Multiblocks.ALTAR.isComplete(this.level, this.worldPosition))
return StructureState.OVERWORLD;
if (Multiblocks.NETHER_ALTAR.isComplete(this.level, this.worldPosition))
return StructureState.NETHER;
return StructureState.INVALID;
}
@Override @Override
public void writeNBT(CompoundTag compound, SaveType type) { public void writeNBT(CompoundTag compound, SaveType type) {
super.writeNBT(compound, type); super.writeNBT(compound, type);
if (type != SaveType.BLOCK) { if (type != SaveType.BLOCK) {
compound.put("items", this.items.serializeNBT()); compound.put("items", this.items.serializeNBT());
compound.putString("state", this.structureState.name()); compound.putBoolean("complete", this.isComplete);
this.container.writeNBT(compound); this.container.writeNBT(compound);
} }
if (type == SaveType.TILE) { if (type == SaveType.TILE) {
@ -241,8 +232,7 @@ public class BlockEntityNatureAltar extends BlockEntityImpl implements ITickable
super.readNBT(compound, type); super.readNBT(compound, type);
if (type != SaveType.BLOCK) { if (type != SaveType.BLOCK) {
this.items.deserializeNBT(compound.getCompound("items")); this.items.deserializeNBT(compound.getCompound("items"));
if (compound.contains("state")) this.isComplete = compound.getBoolean("complete");
this.structureState = StructureState.valueOf(compound.getString("state"));
this.container.readNBT(compound); this.container.readNBT(compound);
} }
if (type == SaveType.TILE) { if (type == SaveType.TILE) {
@ -263,10 +253,4 @@ public class BlockEntityNatureAltar extends BlockEntityImpl implements ITickable
public IItemHandlerModifiable getItemHandler() { public IItemHandlerModifiable getItemHandler() {
return this.items; return this.items;
} }
public enum StructureState {
INVALID,
NETHER,
OVERWORLD
}
} }

View file

@ -50,7 +50,7 @@ public class BlockEntityPlacer extends BlockEntityImpl implements ITickableBlock
for (var y = -range; y <= range; y++) for (var y = -range; y <= range; y++)
for (var z = -range; z <= range; z++) { for (var z = -range; z <= range; z++) {
var pos = this.worldPosition.offset(x, y, z); var pos = this.worldPosition.offset(x, y, z);
if (!this.framesContain(frames, pos, this.level.getBlockState(pos))) if (!this.framesContain(frames, this.level.getBlockState(pos)))
continue; continue;
var up = pos.above(); var up = pos.above();
@ -82,8 +82,8 @@ public class BlockEntityPlacer extends BlockEntityImpl implements ITickableBlock
} }
} }
private boolean framesContain(List<ItemFrame> frames, BlockPos pos, BlockState state) { private boolean framesContain(List<ItemFrame> frames, BlockState state) {
var stack = state.getBlock().getCloneItemStack(this.level, pos, state); var stack = new ItemStack(state.getBlock());
if (stack.isEmpty()) if (stack.isEmpty())
return false; return false;

View file

@ -11,8 +11,8 @@ import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.ForgeCapabilities;
import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.energy.CapabilityEnergy;
import net.minecraftforge.energy.EnergyStorage; import net.minecraftforge.energy.EnergyStorage;
import net.minecraftforge.energy.IEnergyStorage; import net.minecraftforge.energy.IEnergyStorage;
@ -52,7 +52,7 @@ public class BlockEntityRFConverter extends BlockEntityImpl implements ITickable
var tile = this.level.getBlockEntity(this.worldPosition.relative(facing)); var tile = this.level.getBlockEntity(this.worldPosition.relative(facing));
if (tile == null) if (tile == null)
continue; continue;
var storage = tile.getCapability(CapabilityEnergy.ENERGY, facing.getOpposite()).orElse(null); var storage = tile.getCapability(ForgeCapabilities.ENERGY, facing.getOpposite()).orElse(null);
if (storage == null) if (storage == null)
continue; continue;
var canStore = storage.receiveEnergy(Integer.MAX_VALUE, true); var canStore = storage.receiveEnergy(Integer.MAX_VALUE, true);
@ -91,7 +91,7 @@ public class BlockEntityRFConverter extends BlockEntityImpl implements ITickable
@Nullable @Nullable
@Override @Override
public <T> LazyOptional<T> getCapability(Capability<T> capability, @Nullable Direction facing) { public <T> LazyOptional<T> getCapability(Capability<T> capability, @Nullable Direction facing) {
if (capability == CapabilityEnergy.ENERGY) if (capability == ForgeCapabilities.ENERGY)
return this.storageOptional.cast(); return this.storageOptional.cast();
else else
return super.getCapability(capability, facing); return super.getCapability(capability, facing);

View file

@ -136,7 +136,7 @@ public class BlockEntitySpring extends BlockEntityImpl implements ITickableBlock
private boolean isLava(BlockPos offset, boolean source) { private boolean isLava(BlockPos offset, boolean source) {
var state = this.level.getFluidState(offset); var state = this.level.getFluidState(offset);
return (!source || state.isSource()) && state.getType().is(FluidTags.LAVA); return (!source || state.isSource()) && state.is(FluidTags.LAVA);
} }
private class InfiniteTank implements IFluidTank, IFluidHandler { private class InfiniteTank implements IFluidTank, IFluidHandler {
@ -158,7 +158,7 @@ public class BlockEntitySpring extends BlockEntityImpl implements ITickableBlock
@Override @Override
public boolean isFluidValid(FluidStack stack) { public boolean isFluidValid(FluidStack stack) {
return stack.getFluid().is(FluidTags.WATER); return stack.getFluid().defaultFluidState().is(FluidTags.WATER);
} }
@Override @Override

View file

@ -2,7 +2,7 @@ package de.ellpeck.naturesaura.blocks.tiles;
import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.entity.BlockEntityType;
@SuppressWarnings("FieldNamingConvention") @SuppressWarnings("NonConstantFieldWithUpperCaseName")
public final class ModBlockEntities { public final class ModBlockEntities {
public static BlockEntityType<BlockEntityAncientLeaves> ANCIENT_LEAVES; public static BlockEntityType<BlockEntityAncientLeaves> ANCIENT_LEAVES;

View file

@ -8,7 +8,9 @@ import de.ellpeck.naturesaura.items.ItemAuraBottle;
import net.minecraft.client.model.Model; import net.minecraft.client.model.Model;
import net.minecraft.client.model.geom.ModelPart; import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.PartPose; 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.MultiBufferSource;
import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;

View file

@ -197,6 +197,7 @@ public class AuraChunk implements IAuraChunk {
return ret; return ret;
} }
@SuppressWarnings("unchecked")
public Pair<BlockPos, Integer>[] getLowestAndHighestSpots(BlockPos pos, int radius) { public Pair<BlockPos, Integer>[] getLowestAndHighestSpots(BlockPos pos, int radius) {
var ret = this.limitSpotCache.get(pos, radius); var ret = this.limitSpotCache.get(pos, radius);
if (ret == null) { if (ret == null) {

View file

@ -13,7 +13,10 @@ import net.minecraft.util.Mth;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level; 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.block.state.BlockState;
import net.minecraft.world.level.chunk.LevelChunk; import net.minecraft.world.level.chunk.LevelChunk;

View file

@ -9,7 +9,6 @@ import de.ellpeck.naturesaura.api.aura.type.IAuraType;
import de.ellpeck.naturesaura.api.misc.WeightedOre; import de.ellpeck.naturesaura.api.misc.WeightedOre;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.tags.TagKey; import net.minecraft.tags.TagKey;
@ -29,6 +28,7 @@ import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import net.minecraftforge.common.util.FakePlayerFactory; import net.minecraftforge.common.util.FakePlayerFactory;
import net.minecraftforge.registries.ForgeRegistries;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
@ -113,11 +113,10 @@ public class OreSpawnEffect implements IDrainSpotEffect {
var ore = WeightedRandom.getRandomItem(level.random, ores, totalWeight).orElse(null); var ore = WeightedRandom.getRandomItem(level.random, ores, totalWeight).orElse(null);
if (ore == null) if (ore == null)
continue; continue;
var tag = TagKey.create(Registry.BLOCK_REGISTRY, ore.tag); var tag = TagKey.create(ForgeRegistries.Keys.BLOCKS, ore.tag);
if (tag == null) if (tag == null)
continue; continue;
for (var holder : Registry.BLOCK.getTagOrEmpty(tag)) { for (var toPlace : ForgeRegistries.BLOCKS.tags().getTag(tag)) {
var toPlace = holder.value();
if (toPlace == null || toPlace == Blocks.AIR) if (toPlace == null || toPlace == Blocks.AIR)
continue; continue;

View file

@ -51,7 +51,6 @@ public class AltarCategory implements IRecipeCategory<AltarRecipe> {
public void setRecipe(IRecipeLayoutBuilder builder, AltarRecipe recipe, IFocusGroup focuses) { public void setRecipe(IRecipeLayoutBuilder builder, AltarRecipe recipe, IFocusGroup focuses) {
builder.addSlot(RecipeIngredientRole.INPUT, 1, 19).addItemStacks(Arrays.asList(recipe.input.getItems())); builder.addSlot(RecipeIngredientRole.INPUT, 1, 19).addItemStacks(Arrays.asList(recipe.input.getItems()));
builder.addSlot(RecipeIngredientRole.OUTPUT, 81, 19).addItemStack(recipe.output); builder.addSlot(RecipeIngredientRole.OUTPUT, 81, 19).addItemStack(recipe.output);
builder.addSlot(RecipeIngredientRole.CATALYST, 27, 19).addItemStacks(recipe.catalyst == Ingredient.EMPTY ? Collections.singletonList(this.altar) : Arrays.asList(recipe.catalyst.getItems())); builder.addSlot(RecipeIngredientRole.CATALYST, 38, 19).addItemStacks(recipe.catalyst == Ingredient.EMPTY ? Collections.singletonList(this.altar) : Arrays.asList(recipe.catalyst.getItems()));
builder.addSlot(RecipeIngredientRole.CATALYST, 52, 19).addItemStack(recipe.requiredType != null ? recipe.getDimensionBottle() : ItemStack.EMPTY);
} }
} }

View file

@ -23,7 +23,6 @@ public class ProcessorAltar implements IComponentProcessor {
case "input" -> PatchouliCompat.ingredientVariable(this.recipe.input); case "input" -> PatchouliCompat.ingredientVariable(this.recipe.input);
case "output" -> IVariable.from(this.recipe.output); case "output" -> IVariable.from(this.recipe.output);
case "catalyst" -> this.recipe.catalyst != Ingredient.EMPTY ? PatchouliCompat.ingredientVariable(this.recipe.catalyst) : null; case "catalyst" -> this.recipe.catalyst != Ingredient.EMPTY ? PatchouliCompat.ingredientVariable(this.recipe.catalyst) : null;
case "type" -> this.recipe.requiredType != null ? IVariable.from(this.recipe.getDimensionBottle()) : null;
case "name" -> IVariable.wrap(this.recipe.output.getHoverName().getString()); case "name" -> IVariable.wrap(this.recipe.output.getHoverName().getString());
default -> null; default -> null;
}; };

View file

@ -18,8 +18,8 @@ public class BlockTagProvider extends BlockTagsProvider {
public static final TagKey<Block> ALTAR_WOOD = BlockTags.create(new ResourceLocation(NaturesAura.MOD_ID, "altar_wood")); public static final TagKey<Block> ALTAR_WOOD = BlockTags.create(new ResourceLocation(NaturesAura.MOD_ID, "altar_wood"));
public static final TagKey<Block> ALTAR_STONE = BlockTags.create(new ResourceLocation(NaturesAura.MOD_ID, "altar_stone")); public static final TagKey<Block> ALTAR_STONE = BlockTags.create(new ResourceLocation(NaturesAura.MOD_ID, "altar_stone"));
public static final TagKey<Block> NETHER_ALTAR_WOOD = BlockTags.create(new ResourceLocation(NaturesAura.MOD_ID, "nether_altar_wood")); public static final TagKey<Block> ALTAR_GOLD_BRICK = BlockTags.create(new ResourceLocation(NaturesAura.MOD_ID, "altar_gold_brick"));
public static final TagKey<Block> NETHER_ALTAR_STONE = BlockTags.create(new ResourceLocation(NaturesAura.MOD_ID, "nether_altar_stone")); public static final TagKey<Block> ALTAR_FANCY_BRICK = BlockTags.create(new ResourceLocation(NaturesAura.MOD_ID, "altar_fancy_brick"));
public BlockTagProvider(DataGenerator gen, @Nullable ExistingFileHelper existingFileHelper) { public BlockTagProvider(DataGenerator gen, @Nullable ExistingFileHelper existingFileHelper) {
super(gen, NaturesAura.MOD_ID, existingFileHelper); super(gen, NaturesAura.MOD_ID, existingFileHelper);
@ -35,10 +35,10 @@ public class BlockTagProvider extends BlockTagsProvider {
this.tag(BlockTags.SLABS).add(ModBlocks.ANCIENT_SLAB, ModBlocks.INFUSED_SLAB, ModBlocks.INFUSED_BRICK_SLAB); this.tag(BlockTags.SLABS).add(ModBlocks.ANCIENT_SLAB, ModBlocks.INFUSED_SLAB, ModBlocks.INFUSED_BRICK_SLAB);
this.tag(BlockTags.DIRT).add(ModBlocks.NETHER_GRASS); this.tag(BlockTags.DIRT).add(ModBlocks.NETHER_GRASS);
this.tag(BlockTags.SMALL_FLOWERS).add(ModBlocks.END_FLOWER, ModBlocks.AURA_BLOOM); this.tag(BlockTags.SMALL_FLOWERS).add(ModBlocks.END_FLOWER, ModBlocks.AURA_BLOOM);
this.tag(BlockTagProvider.ALTAR_WOOD).addTag(BlockTags.PLANKS); this.tag(BlockTagProvider.ALTAR_WOOD).addTag(BlockTags.PLANKS).add(Blocks.CRIMSON_PLANKS, Blocks.WARPED_PLANKS);
this.tag(BlockTagProvider.ALTAR_STONE).addTag(BlockTags.STONE_BRICKS); this.tag(BlockTagProvider.ALTAR_STONE).addTag(BlockTags.STONE_BRICKS).add(Blocks.NETHER_BRICKS);
this.tag(BlockTagProvider.NETHER_ALTAR_WOOD).add(Blocks.CRIMSON_PLANKS, Blocks.WARPED_PLANKS); this.tag(BlockTagProvider.ALTAR_GOLD_BRICK).add(ModBlocks.GOLD_BRICK, ModBlocks.GOLD_NETHER_BRICK);
this.tag(BlockTagProvider.NETHER_ALTAR_STONE).add(Blocks.NETHER_BRICKS); this.tag(BlockTagProvider.ALTAR_FANCY_BRICK).add(Blocks.RED_NETHER_BRICKS, Blocks.CHISELED_STONE_BRICKS);
for (var item : ModRegistry.ALL_ITEMS) { for (var item : ModRegistry.ALL_ITEMS) {
if (!(item instanceof Block b)) if (!(item instanceof Block b))

View file

@ -2,7 +2,7 @@ package de.ellpeck.naturesaura.enchant;
import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.world.item.enchantment.Enchantment;
@SuppressWarnings("FieldNamingConvention") @SuppressWarnings("NonConstantFieldWithUpperCaseName")
public final class ModEnchantments { public final class ModEnchantments {
public static Enchantment AURA_MENDING; public static Enchantment AURA_MENDING;

View file

@ -2,7 +2,7 @@ package de.ellpeck.naturesaura.entities;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
@SuppressWarnings("FieldNamingConvention") @SuppressWarnings("NonConstantFieldWithUpperCaseName")
public final class ModEntities { public final class ModEntities {
public static EntityType<EntityMoverMinecart> MOVER_CART; public static EntityType<EntityMoverMinecart> MOVER_CART;

View file

@ -11,8 +11,8 @@ import net.minecraft.client.renderer.block.model.ItemTransforms;
import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.client.renderer.texture.TextureAtlas;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.inventory.InventoryMenu;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
@ -25,13 +25,13 @@ public class RenderEffectInhibitor extends EntityRenderer<EntityEffectInhibitor>
private final Map<ResourceLocation, ItemStack> items = new HashMap<>(); private final Map<ResourceLocation, ItemStack> items = new HashMap<>();
public RenderEffectInhibitor(EntityRendererProvider.Context p_174008_) { public RenderEffectInhibitor(EntityRendererProvider.Context ctx) {
super(p_174008_); super(ctx);
} }
@Override @Override
public ResourceLocation getTextureLocation(EntityEffectInhibitor entity) { public ResourceLocation getTextureLocation(EntityEffectInhibitor entity) {
return TextureAtlas.LOCATION_BLOCKS; return InventoryMenu.BLOCK_ATLAS;
} }
@Override @Override

View file

@ -3,14 +3,14 @@ package de.ellpeck.naturesaura.entities.render;
import net.minecraft.client.renderer.culling.Frustum; import net.minecraft.client.renderer.culling.Frustum;
import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.texture.TextureAtlas;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.inventory.InventoryMenu;
public class RenderStub<T extends Entity> extends EntityRenderer<T> { public class RenderStub<T extends Entity> extends EntityRenderer<T> {
public RenderStub(EntityRendererProvider.Context p_174008_) { public RenderStub(EntityRendererProvider.Context ctx) {
super(p_174008_); super(ctx);
} }
@Override @Override
@ -19,7 +19,7 @@ public class RenderStub<T extends Entity> extends EntityRenderer<T> {
} }
@Override @Override
public ResourceLocation getTextureLocation(T p_114482_) { public ResourceLocation getTextureLocation(T t) {
return TextureAtlas.LOCATION_BLOCKS; return InventoryMenu.BLOCK_ATLAS;
} }
} }

View file

@ -58,7 +58,7 @@ public class LevelGenAuraBloom extends Feature<NoneFeatureConfiguration> {
private boolean tryPlace(WorldGenLevel level, BlockPos pos) { private boolean tryPlace(WorldGenLevel level, BlockPos pos) {
var state = this.block.defaultBlockState(); var state = this.block.defaultBlockState();
if (this.block.canSurvive(state, level, pos)) { if (state.canSurvive(level, pos)) {
level.setBlock(pos, state, 3); level.setBlock(pos, state, 3);
var tile = level.getBlockEntity(pos); var tile = level.getBlockEntity(pos);
if (tile instanceof BlockEntityAuraBloom bloom) if (tile instanceof BlockEntityAuraBloom bloom)

View file

@ -7,7 +7,7 @@ import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConf
import net.minecraft.world.level.levelgen.feature.configurations.TreeConfiguration; import net.minecraft.world.level.levelgen.feature.configurations.TreeConfiguration;
import net.minecraft.world.level.levelgen.placement.PlacedFeature; import net.minecraft.world.level.levelgen.placement.PlacedFeature;
@SuppressWarnings("FieldNamingConvention") @SuppressWarnings("NonConstantFieldWithUpperCaseName")
public final class ModFeatures { public final class ModFeatures {
public static Feature<TreeConfiguration> ANCIENT_TREE; public static Feature<TreeConfiguration> ANCIENT_TREE;

View file

@ -2,7 +2,7 @@ package de.ellpeck.naturesaura.gui;
import net.minecraft.world.inventory.MenuType; import net.minecraft.world.inventory.MenuType;
@SuppressWarnings("FieldNamingConvention") @SuppressWarnings("NonConstantFieldWithUpperCaseName")
public final class ModContainers { public final class ModContainers {
public static MenuType<ContainerEnderCrate> ENDER_CRATE; public static MenuType<ContainerEnderCrate> ENDER_CRATE;

View file

@ -19,7 +19,6 @@ import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.enchantment.EnchantmentHelper;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
@ -53,7 +52,7 @@ public class ItemAuraCache extends ItemImpl implements ITrinketItem {
if (recharge != null) { if (recharge != null) {
if (recharge.rechargeFromContainer(container, itemSlot, i, player.getInventory().selected == i)) if (recharge.rechargeFromContainer(container, itemSlot, i, player.getInventory().selected == i))
break; break;
} else if (EnchantmentHelper.getItemEnchantmentLevel(ModEnchantments.AURA_MENDING, stack) > 0) { } else if (stack.getEnchantmentLevel(ModEnchantments.AURA_MENDING) > 0) {
var mainSize = player.getInventory().items.size(); var mainSize = player.getInventory().items.size();
var isArmor = i >= mainSize && i < mainSize + player.getInventory().armor.size(); var isArmor = i >= mainSize && i < mainSize + player.getInventory().armor.size();
if ((isArmor || player.getInventory().selected == i) && Helper.rechargeAuraItem(stack, container, 1000)) if ((isArmor || player.getInventory().selected == i) && Helper.rechargeAuraItem(stack, container, 1000))

View file

@ -2,7 +2,7 @@ package de.ellpeck.naturesaura.items;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
@SuppressWarnings("FieldNamingConvention") @SuppressWarnings("NonConstantFieldWithUpperCaseName")
public final class ModItems { public final class ModItems {
public static Item INFUSED_IRON_PICKAXE; public static Item INFUSED_IRON_PICKAXE;

View file

@ -88,6 +88,7 @@ public class ItemArmor extends ArmorItem implements IModItem {
if (equipped && !nbt.getBoolean(key)) { if (equipped && !nbt.getBoolean(key)) {
// we just equipped it // we just equipped it
nbt.putBoolean(key, true); nbt.putBoolean(key, true);
// TODO use new forge attribute for step height
player.maxUpStep = 1.1F; player.maxUpStep = 1.1F;
if (!speed.hasModifier(ItemArmor.SKY_MOVEMENT_MODIFIER)) if (!speed.hasModifier(ItemArmor.SKY_MOVEMENT_MODIFIER))
speed.addPermanentModifier(ItemArmor.SKY_MOVEMENT_MODIFIER); speed.addPermanentModifier(ItemArmor.SKY_MOVEMENT_MODIFIER);

View file

@ -264,14 +264,12 @@ public class PacketParticles {
level.random.nextGaussian() * 0.01F, level.random.nextGaussian() * 0.01F,
0xd3e4ff, 1.5F, 150, 0F, false, true); 0xd3e4ff, 1.5F, 150, 0F, false, true);
}), }),
PICKUP_STOPPER((message, level) -> { PICKUP_STOPPER((message, level) -> NaturesAuraAPI.instance().spawnMagicParticle(
NaturesAuraAPI.instance().spawnMagicParticle( message.posX, message.posY + 0.4F, message.posZ,
message.posX, message.posY + 0.4F, message.posZ, level.random.nextGaussian() * 0.005F,
level.random.nextGaussian() * 0.005F, level.random.nextFloat() * 0.005F,
level.random.nextFloat() * 0.005F, level.random.nextGaussian() * 0.005F,
level.random.nextGaussian() * 0.005F, 0xcc3116, 1.5F, 40, 0F, false, true)),
0xcc3116, 1.5F, 40, 0F, false, true);
}),
SPAWN_LAMP((message, level) -> { SPAWN_LAMP((message, level) -> {
for (var i = level.random.nextInt(5) + 5; i >= 0; i--) for (var i = level.random.nextInt(5) + 5; i >= 0; i--)
NaturesAuraAPI.instance().spawnMagicParticle( NaturesAuraAPI.instance().spawnMagicParticle(

View file

@ -2,7 +2,7 @@ package de.ellpeck.naturesaura.potion;
import net.minecraft.world.effect.MobEffect; import net.minecraft.world.effect.MobEffect;
@SuppressWarnings("FieldNamingConvention") @SuppressWarnings("NonConstantFieldWithUpperCaseName")
public final class ModPotions { public final class ModPotions {
public static MobEffect BREATHLESS; public static MobEffect BREATHLESS;

View file

@ -64,7 +64,7 @@ public class ClientProxy implements IProxy {
this.addColorProvidingBlock(color); this.addColorProvidingBlock(color);
if (item instanceof IColorProvidingItem color) if (item instanceof IColorProvidingItem color)
this.addColorProvidingItem(color); this.addColorProvidingItem(color);
if (item instanceof ITESRProvider provider) if (item instanceof ITESRProvider<?> provider)
provider.registerTESR(); provider.registerTESR();
} }
@ -75,6 +75,7 @@ public class ClientProxy implements IProxy {
} }
@Override @Override
@SuppressWarnings("removal")
public void postInit(FMLCommonSetupEvent event) { public void postInit(FMLCommonSetupEvent event) {
// TODO this uses a vanilla model so we can't just add the json entry to it // TODO this uses a vanilla model so we can't just add the json entry to it
ItemBlockRenderTypes.setRenderLayer(ModBlocks.GOLD_POWDER, RenderType.cutoutMipped()); ItemBlockRenderTypes.setRenderLayer(ModBlocks.GOLD_POWDER, RenderType.cutoutMipped());
@ -107,6 +108,7 @@ public class ClientProxy implements IProxy {
var colors = Minecraft.getInstance().getItemColors(); var colors = Minecraft.getInstance().getItemColors();
var color = item.getItemColor(); var color = item.getItemColor();
// TODO use event
if (item instanceof Item) { if (item instanceof Item) {
colors.register(color, (Item) item); colors.register(color, (Item) item);
} else if (item instanceof Block) { } else if (item instanceof Block) {

View file

@ -1,13 +1,7 @@
package de.ellpeck.naturesaura.recipes; package de.ellpeck.naturesaura.recipes;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
import de.ellpeck.naturesaura.items.ItemAuraBottle;
import de.ellpeck.naturesaura.items.ModItems;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.item.crafting.Ingredient;
@ -21,16 +15,14 @@ public class AltarRecipe extends ModRecipe {
public final Ingredient input; public final Ingredient input;
public final ItemStack output; public final ItemStack output;
public final IAuraType requiredType;
public final Ingredient catalyst; public final Ingredient catalyst;
public final int aura; public final int aura;
public final int time; public final int time;
public AltarRecipe(ResourceLocation name, Ingredient input, ItemStack output, IAuraType requiredType, Ingredient catalyst, int aura, int time) { public AltarRecipe(ResourceLocation name, Ingredient input, ItemStack output, Ingredient catalyst, int aura, int time) {
super(name); super(name);
this.input = input; this.input = input;
this.output = output; this.output = output;
this.requiredType = requiredType;
this.catalyst = catalyst; this.catalyst = catalyst;
this.aura = aura; this.aura = aura;
this.time = time; this.time = time;
@ -51,12 +43,6 @@ public class AltarRecipe extends ModRecipe {
return ModRecipes.ALTAR_TYPE; return ModRecipes.ALTAR_TYPE;
} }
public ItemStack getDimensionBottle() {
var bottle = ItemAuraBottle.setType(new ItemStack(ModItems.AURA_BOTTLE), this.requiredType);
bottle.setHoverName(Component.translatable("info." + NaturesAura.MOD_ID + ".required_aura_type." + this.requiredType.getName()));
return bottle;
}
public static class Serializer implements RecipeSerializer<AltarRecipe> { public static class Serializer implements RecipeSerializer<AltarRecipe> {
@Override @Override
@ -65,7 +51,6 @@ public class AltarRecipe extends ModRecipe {
recipeId, recipeId,
Ingredient.fromJson(json.getAsJsonObject("input")), Ingredient.fromJson(json.getAsJsonObject("input")),
CraftingHelper.getItemStack(json.getAsJsonObject("output"), true), CraftingHelper.getItemStack(json.getAsJsonObject("output"), true),
NaturesAuraAPI.AURA_TYPES.get(new ResourceLocation(json.get("aura_type").getAsString())),
json.has("catalyst") ? Ingredient.fromJson(json.getAsJsonObject("catalyst")) : Ingredient.EMPTY, json.has("catalyst") ? Ingredient.fromJson(json.getAsJsonObject("catalyst")) : Ingredient.EMPTY,
json.get("aura").getAsInt(), json.get("aura").getAsInt(),
json.get("time").getAsInt()); json.get("time").getAsInt());
@ -78,7 +63,6 @@ public class AltarRecipe extends ModRecipe {
recipeId, recipeId,
Ingredient.fromNetwork(buffer), Ingredient.fromNetwork(buffer),
buffer.readItem(), buffer.readItem(),
NaturesAuraAPI.AURA_TYPES.get(buffer.readResourceLocation()),
Ingredient.fromNetwork(buffer), Ingredient.fromNetwork(buffer),
buffer.readInt(), buffer.readInt(),
buffer.readInt()); buffer.readInt());
@ -88,7 +72,6 @@ public class AltarRecipe extends ModRecipe {
public void toNetwork(FriendlyByteBuf buffer, AltarRecipe recipe) { public void toNetwork(FriendlyByteBuf buffer, AltarRecipe recipe) {
recipe.input.toNetwork(buffer); recipe.input.toNetwork(buffer);
buffer.writeItem(recipe.output); buffer.writeItem(recipe.output);
buffer.writeResourceLocation(recipe.requiredType.getName());
recipe.catalyst.toNetwork(buffer); recipe.catalyst.toNetwork(buffer);
buffer.writeInt(recipe.aura); buffer.writeInt(recipe.aura);
buffer.writeInt(recipe.time); buffer.writeInt(recipe.time);

View file

@ -3,7 +3,6 @@ package de.ellpeck.naturesaura.recipes;
import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.misc.WeatherType; import de.ellpeck.naturesaura.api.misc.WeatherType;
import de.ellpeck.naturesaura.api.misc.WeightedOre; import de.ellpeck.naturesaura.api.misc.WeightedOre;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
@ -11,6 +10,7 @@ import net.minecraft.world.item.Items;
import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.item.crafting.Recipe;
import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.item.crafting.RecipeSerializer;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraftforge.registries.ForgeRegistries;
import java.util.List; import java.util.List;
@ -119,7 +119,7 @@ public final class ModRecipes {
@Override @Override
public String toString() { public String toString() {
return Registry.RECIPE_TYPE.getKey(this).toString(); return ForgeRegistries.RECIPE_TYPES.getKey(this).toString();
} }
} }
} }

View file

@ -1,4 +1,3 @@
package de.ellpeck.naturesaura.reg; package de.ellpeck.naturesaura.reg;
public interface INoItemBlock { public interface INoItemBlock {}
}

View file

@ -18,7 +18,7 @@ public enum ModArmorMaterial implements ArmorMaterial {
INFUSED(NaturesAura.MOD_ID + ":infused_iron", 19, new int[]{2, 5, 6, 2}, 16, SoundEvents.ARMOR_EQUIP_GENERIC, 0, () -> Ingredient.of(ModItems.INFUSED_IRON)), INFUSED(NaturesAura.MOD_ID + ":infused_iron", 19, new int[]{2, 5, 6, 2}, 16, SoundEvents.ARMOR_EQUIP_GENERIC, 0, () -> Ingredient.of(ModItems.INFUSED_IRON)),
SKY(NaturesAura.MOD_ID + ":sky", 33, new int[]{3, 6, 8, 3}, 12, SoundEvents.ARMOR_EQUIP_GENERIC, 2, () -> Ingredient.of(ModItems.SKY_INGOT)); SKY(NaturesAura.MOD_ID + ":sky", 33, new int[]{3, 6, 8, 3}, 12, SoundEvents.ARMOR_EQUIP_GENERIC, 2, () -> Ingredient.of(ModItems.SKY_INGOT));
private static final int[] MAX_DAMAGE_ARRAY = new int[]{13, 15, 16, 11}; private static final int[] MAX_DAMAGE_ARRAY = {13, 15, 16, 11};
private final String name; private final String name;
private final int maxDamageFactor; private final int maxDamageFactor;
private final int[] damageReductionAmountArray; private final int[] damageReductionAmountArray;

View file

@ -43,6 +43,7 @@ public enum ModItemTier implements Tier {
} }
@Override @Override
@SuppressWarnings({"deprecation", "RedundantSuppression"})
public int getLevel() { public int getLevel() {
return this.harvestLevel; return this.harvestLevel;
} }

View file

@ -22,7 +22,6 @@ import de.ellpeck.naturesaura.potion.ModPotions;
import de.ellpeck.naturesaura.potion.PotionBreathless; import de.ellpeck.naturesaura.potion.PotionBreathless;
import de.ellpeck.naturesaura.recipes.EnabledCondition; import de.ellpeck.naturesaura.recipes.EnabledCondition;
import de.ellpeck.naturesaura.recipes.ModRecipes; import de.ellpeck.naturesaura.recipes.ModRecipes;
import net.minecraft.data.worldgen.Structures;
import net.minecraft.data.worldgen.features.FeatureUtils; import net.minecraft.data.worldgen.features.FeatureUtils;
import net.minecraft.data.worldgen.placement.PlacementUtils; import net.minecraft.data.worldgen.placement.PlacementUtils;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
@ -82,8 +81,8 @@ public final class ModRegistry {
new BlockFurnaceHeater(), new BlockFurnaceHeater(),
new BlockPotionGenerator(), new BlockPotionGenerator(),
new BlockAuraDetector(), new BlockAuraDetector(),
new BlockCatalyst("conversion_catalyst", Block.Properties.of(Material.STONE).sound(SoundType.STONE).strength(2.5F)), new BlockImpl("conversion_catalyst", Block.Properties.of(Material.STONE).sound(SoundType.STONE).strength(2.5F)),
new BlockCatalyst("crushing_catalyst", Block.Properties.of(Material.STONE).sound(SoundType.STONE).strength(2.5F)), new BlockImpl("crushing_catalyst", Block.Properties.of(Material.STONE).sound(SoundType.STONE).strength(2.5F)),
new BlockFlowerGenerator(), new BlockFlowerGenerator(),
new BlockPlacer(), new BlockPlacer(),
new BlockHopperUpgrade(), new BlockHopperUpgrade(),
@ -217,7 +216,7 @@ public final class ModRegistry {
ModRegistry.ALL_ITEMS.add(new ModTileType<>(BlockEntityAuraBloom::new, "aura_bloom", ModRegistry.ALL_ITEMS.stream().filter(i -> i instanceof BlockAuraBloom).toArray(IModItem[]::new))); ModRegistry.ALL_ITEMS.add(new ModTileType<>(BlockEntityAuraBloom::new, "aura_bloom", ModRegistry.ALL_ITEMS.stream().filter(i -> i instanceof BlockAuraBloom).toArray(IModItem[]::new)));
for (var item : ModRegistry.ALL_ITEMS) { for (var item : ModRegistry.ALL_ITEMS) {
if (item instanceof ModTileType type) if (item instanceof ModTileType<?> type)
h.register(new ResourceLocation(NaturesAura.MOD_ID, type.getBaseName()), type.type); h.register(new ResourceLocation(NaturesAura.MOD_ID, type.getBaseName()), type.type);
} }
Helper.populateObjectHolders(ModBlockEntities.class, event.getForgeRegistry()); Helper.populateObjectHolders(ModBlockEntities.class, event.getForgeRegistry());

View file

@ -1,10 +0,0 @@
{
"variants": {
"nether=false": {
"model": "naturesaura:block/conversion_catalyst"
},
"nether=true": {
"model": "naturesaura:block/conversion_catalyst_nether"
}
}
}

View file

@ -1,10 +0,0 @@
{
"variants": {
"nether=false": {
"model": "naturesaura:block/crushing_catalyst"
},
"nether=true": {
"model": "naturesaura:block/crushing_catalyst_nether"
}
}
}

View file

@ -1,10 +0,0 @@
{
"variants": {
"nether=false": {
"model": "naturesaura:block/nature_altar"
},
"nether=true": {
"model": "naturesaura:block/nature_altar_nether"
}
}
}

View file

@ -1,33 +0,0 @@
{
"name": "The Crimson Altar",
"icon": "naturesaura:nature_altar",
"category": "naturesaura:using",
"advancement": "naturesaura:aura_bottle_nether",
"priority": true,
"turnin": "naturesaura:tainted_gold",
"pages": [
{
"type": "text",
"text": "The $(l:using/altar)Natural Altar$(), while having the ability to turn iron into $(item)Infused Iron$(), does not fare well in different regions, specifically the $(thing)Nether$(), where a much darker type of $(aura) is present. Here, the $(item)Crimson Altar$() can be built. A structure very similar to the $(thing)Natural Altar$(), which is able to, instead, turn $(item)Gold$() into $(item)Tainted Gold$(). For this, the structure on the following page needs to be assembled."
},
{
"type": "text",
"text": "It should be noted that, while looking different, the $(item)Crimson Altar$() itself is in fact not a different block - it is merely the $(item)Natural Altar$()'s appearance in an area where ghostly $(aura) is present, caused by its inherent magical infusion with $(aura). Similar can be said for any $(item)Catalysts$(): Merely placing them on top of the crimson altar will cause their ghostly recipes to work as well."
},
{
"type": "multiblock",
"multiblock_id": "naturesaura:nether_altar",
"text": "How to assemble the $(item)Crimson Altar$(). The $(item)Crimson Planks$() can be replaced with $(item)Warped Planks$()."
},
{
"type": "crafting",
"recipe": "naturesaura:gold_nether_brick",
"text": "Creating the $(item)Golden Nether Bricks$() that are used in the $(item)Crimson Altar$()'s multiblock"
},
{
"type": "naturesaura:altar",
"text": "Creating $(item)Tainted Gold$(), a material blessed with the powers of ghostly $(aura).$(br)Note that the same infusion is possible using the materials' block form.",
"recipe": "naturesaura:tainted_gold"
}
]
}

View file

@ -18,20 +18,14 @@
"group": "catalyst", "group": "catalyst",
"type": "patchouli:item", "type": "patchouli:item",
"item": "#catalyst", "item": "#catalyst",
"x": 36, "x": 48,
"y": 26
},
{
"type": "patchouli:item",
"item": "#type",
"x": 58,
"y": 26 "y": 26
}, },
{ {
"group": "altar", "group": "altar",
"type": "patchouli:item", "type": "patchouli:item",
"item": "naturesaura:nature_altar", "item": "naturesaura:nature_altar",
"x": 36, "x": 48,
"y": 26 "y": 26
}, },
{ {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 303 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 401 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 256 B

After

Width:  |  Height:  |  Size: 355 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 521 B

After

Width:  |  Height:  |  Size: 511 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 491 B

After

Width:  |  Height:  |  Size: 498 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 513 B

After

Width:  |  Height:  |  Size: 510 B

View file

@ -6,7 +6,6 @@
"output": { "output": {
"item": "minecraft:spectral_arrow" "item": "minecraft:spectral_arrow"
}, },
"aura_type": "naturesaura:overworld",
"catalyst": { "catalyst": {
"item": "naturesaura:conversion_catalyst" "item": "naturesaura:conversion_catalyst"
}, },

View file

@ -7,7 +7,6 @@
"item": "minecraft:blaze_powder", "item": "minecraft:blaze_powder",
"count": 4 "count": 4
}, },
"aura_type": "naturesaura:nether",
"catalyst": { "catalyst": {
"item": "naturesaura:crushing_catalyst" "item": "naturesaura:crushing_catalyst"
}, },

View file

@ -7,7 +7,6 @@
"item": "minecraft:bone_meal", "item": "minecraft:bone_meal",
"count": 6 "count": 6
}, },
"aura_type": "naturesaura:overworld",
"catalyst": { "catalyst": {
"item": "naturesaura:crushing_catalyst" "item": "naturesaura:crushing_catalyst"
}, },

View file

@ -9,7 +9,6 @@
"output": { "output": {
"item": "minecraft:dragon_breath" "item": "minecraft:dragon_breath"
}, },
"aura_type": "naturesaura:nether",
"catalyst": { "catalyst": {
"item": "naturesaura:conversion_catalyst" "item": "naturesaura:conversion_catalyst"
}, },

View file

@ -6,7 +6,6 @@
"output": { "output": {
"item": "minecraft:chorus_flower" "item": "minecraft:chorus_flower"
}, },
"aura_type": "naturesaura:overworld",
"catalyst": { "catalyst": {
"item": "naturesaura:conversion_catalyst" "item": "naturesaura:conversion_catalyst"
}, },

View file

@ -6,7 +6,6 @@
"output": { "output": {
"item": "minecraft:coal" "item": "minecraft:coal"
}, },
"aura_type": "naturesaura:overworld",
"catalyst": { "catalyst": {
"item": "naturesaura:conversion_catalyst" "item": "naturesaura:conversion_catalyst"
}, },

View file

@ -6,7 +6,6 @@
"output": { "output": {
"item": "minecraft:crimson_fungus" "item": "minecraft:crimson_fungus"
}, },
"aura_type": "naturesaura:nether",
"catalyst": { "catalyst": {
"item": "naturesaura:conversion_catalyst" "item": "naturesaura:conversion_catalyst"
}, },

View file

@ -6,7 +6,6 @@
"output": { "output": {
"item": "minecraft:egg" "item": "minecraft:egg"
}, },
"aura_type": "naturesaura:overworld",
"catalyst": { "catalyst": {
"item": "naturesaura:conversion_catalyst" "item": "naturesaura:conversion_catalyst"
}, },

View file

@ -6,7 +6,6 @@
"output": { "output": {
"item": "minecraft:fermented_spider_eye" "item": "minecraft:fermented_spider_eye"
}, },
"aura_type": "naturesaura:overworld",
"catalyst": { "catalyst": {
"item": "naturesaura:conversion_catalyst" "item": "naturesaura:conversion_catalyst"
}, },

View file

@ -6,7 +6,6 @@
"output": { "output": {
"item": "minecraft:gilded_blackstone" "item": "minecraft:gilded_blackstone"
}, },
"aura_type": "naturesaura:nether",
"catalyst": { "catalyst": {
"item": "naturesaura:conversion_catalyst" "item": "naturesaura:conversion_catalyst"
}, },

View file

@ -7,7 +7,6 @@
"item": "minecraft:glowstone_dust", "item": "minecraft:glowstone_dust",
"count": 4 "count": 4
}, },
"aura_type": "naturesaura:nether",
"catalyst": { "catalyst": {
"item": "naturesaura:crushing_catalyst" "item": "naturesaura:crushing_catalyst"
}, },

Some files were not shown because too many files have changed in this diff Show more