mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-27 13:38:34 +01:00
Compare commits
4 commits
5c40d29e23
...
e7cbb445c5
Author | SHA1 | Date | |
---|---|---|---|
e7cbb445c5 | |||
323fadab82 | |||
7b17349917 | |||
244ee2486e |
8 changed files with 17 additions and 13 deletions
|
@ -46,7 +46,7 @@ mod_name=NaturesAura
|
|||
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
||||
mod_license=MIT
|
||||
# The mod version. See https://semver.org/
|
||||
mod_version=39.3
|
||||
mod_version=39.4
|
||||
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
||||
# This should match the base package used for the mod sources.
|
||||
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
|
|
|
@ -31,6 +31,7 @@ import net.minecraft.world.item.crafting.Ingredient;
|
|||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
@ -338,12 +339,14 @@ public final class Helper {
|
|||
return pos;
|
||||
}
|
||||
|
||||
public static void mineRecursively(Level level, BlockPos pos, BlockPos start, boolean drop, int horizontalRange, int verticalRange, Predicate<BlockState> filter) {
|
||||
public static void mineRecursively(Level level, BlockPos pos, BlockPos start, ItemStack tool, int horizontalRange, int verticalRange, Predicate<BlockState> filter) {
|
||||
if (Math.abs(pos.getX() - start.getX()) >= horizontalRange || Math.abs(pos.getZ() - start.getZ()) >= horizontalRange || Math.abs(pos.getY() - start.getY()) >= verticalRange)
|
||||
return;
|
||||
|
||||
if (drop) {
|
||||
level.destroyBlock(pos, true);
|
||||
if (!tool.isEmpty()) {
|
||||
var state = level.getBlockState(pos);
|
||||
level.destroyBlock(pos, false);
|
||||
Block.dropResources(state, level, pos, state.hasBlockEntity() ? level.getBlockEntity(pos) : null, null, tool);
|
||||
} else {
|
||||
// in this case we don't want the block breaking particles, so we can't use destroyBlock
|
||||
level.setBlockAndUpdate(pos, Blocks.AIR.defaultBlockState());
|
||||
|
@ -358,7 +361,7 @@ public final class Helper {
|
|||
var offset = pos.offset(x, y, z);
|
||||
var state = level.getBlockState(offset);
|
||||
if (filter.test(state))
|
||||
Helper.mineRecursively(level, offset, start, drop, horizontalRange, verticalRange, filter);
|
||||
Helper.mineRecursively(level, offset, start, tool, horizontalRange, verticalRange, filter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ public class BlockEntityWoodStand extends BlockEntityImpl implements ITickableBl
|
|||
this.level.setBlockAndUpdate(pos, Blocks.AIR.defaultBlockState());
|
||||
return true;
|
||||
});
|
||||
Helper.mineRecursively(this.level, this.ritualPos, this.ritualPos, false, 6, 32, s -> s.is(BlockTags.LOGS) || s.getBlock() instanceof LeavesBlock);
|
||||
Helper.mineRecursively(this.level, this.ritualPos, this.ritualPos, ItemStack.EMPTY, 6, 32, s -> s.is(BlockTags.LOGS) || s.getBlock() instanceof LeavesBlock);
|
||||
|
||||
var item = new ItemEntity(this.level,
|
||||
this.ritualPos.getX() + 0.5, this.ritualPos.getY() + 4.5, this.ritualPos.getZ() + 0.5,
|
||||
|
@ -190,4 +190,5 @@ public class BlockEntityWoodStand extends BlockEntityImpl implements ITickableBl
|
|||
public IItemHandlerModifiable getItemHandler() {
|
||||
return this.items;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,8 +23,7 @@ public class ProcessorAltar implements IComponentProcessor {
|
|||
return switch (key) {
|
||||
case "input" -> PatchouliCompat.ingredientVariable(this.recipe.input);
|
||||
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 "name" -> IVariable.wrap(this.recipe.output.getHoverName().getString());
|
||||
default -> null;
|
||||
};
|
||||
|
@ -32,6 +31,7 @@ public class ProcessorAltar implements IComponentProcessor {
|
|||
|
||||
@Override
|
||||
public boolean allowRender(String group) {
|
||||
return group.isEmpty() || group.equals(this.recipe.catalyst == Ingredient.EMPTY ? "altar" : "catalyst");
|
||||
return group.isEmpty() || this.recipe != null && group.equals(this.recipe.catalyst == Ingredient.EMPTY ? "altar" : "catalyst");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ public class ItemArmor extends ArmorItem implements IModItem {
|
|||
if (source instanceof LivingEntity)
|
||||
((LivingEntity) source).addEffect(new MobEffectInstance(MobEffects.WITHER, 40));
|
||||
} else if (ItemArmor.isFullSetEquipped(entity, ModArmorMaterial.DEPTH)) {
|
||||
for (var other : entity.level().getEntitiesOfClass(LivingEntity.class, new AABB(entity.position(), Vec3.ZERO).inflate(2))) {
|
||||
for (var other : entity.level().getEntitiesOfClass(LivingEntity.class, new AABB(entity.position(), entity.position()).inflate(2))) {
|
||||
if (other != entity && (!(entity instanceof Player player) || !player.isAlliedTo(other)))
|
||||
other.addEffect(new MobEffectInstance(MobEffects.MOVEMENT_SLOWDOWN, 60, 255));
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public class ItemAxe extends AxeItem implements IModItem, ICustomItemModel {
|
|||
public boolean onBlockStartBreak(ItemStack stack, BlockPos pos, Player player) {
|
||||
if ((stack.getItem() == ModItems.SKY_AXE || stack.getItem() == ModItems.DEPTH_AXE) && Helper.isToolEnabled(stack) && player.level().getBlockState(pos).is(BlockTags.LOGS)) {
|
||||
var horRange = stack.getItem() == ModItems.DEPTH_AXE ? 6 : 1;
|
||||
Helper.mineRecursively(player.level(), pos, pos, true, horRange, 32, s -> s.is(BlockTags.LOGS));
|
||||
Helper.mineRecursively(player.level(), pos, pos, stack, horRange, 32, s -> s.is(BlockTags.LOGS));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -91,7 +91,7 @@ public class ItemPickaxe extends PickaxeItem implements IModItem, ICustomItemMod
|
|||
@Override
|
||||
public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, Player player) {
|
||||
if (itemstack.getItem() == ModItems.DEPTH_PICKAXE && Helper.isToolEnabled(itemstack) && player.level().getBlockState(pos).is(Tags.Blocks.ORES)) {
|
||||
Helper.mineRecursively(player.level(), pos, pos, true, 5, 5, s -> s.is(Tags.Blocks.ORES));
|
||||
Helper.mineRecursively(player.level(), pos, pos, itemstack, 5, 5, s -> s.is(Tags.Blocks.ORES));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -111,7 +111,7 @@ public class ItemShovel extends ShovelItem implements IModItem, ICustomItemModel
|
|||
return super.useOn(context);
|
||||
level.removeBlock(pos, false);
|
||||
var tile = state.hasBlockEntity() ? level.getBlockEntity(pos) : null;
|
||||
Block.dropResources(state, level, pos, tile, null, ItemStack.EMPTY);
|
||||
Block.dropResources(state, level, pos, tile, null, stack);
|
||||
var newContext = new UseOnContext(player, otherHand, new BlockHitResult(context.getClickLocation(), context.getClickedFace(), context.getClickedPos(), context.isInside()));
|
||||
other.useOn(newContext);
|
||||
stack.hurtAndBreak(1, player, p -> p.broadcastBreakEvent(context.getHand()));
|
||||
|
|
Loading…
Reference in a new issue