Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,9 @@ protected void addTranslations()
add("ritual.bloodmagic.geode.acceleration.info", "(Acceleration) The range in which growth is sped up");

add("ritual.bloodmagic.waterRitual.info", "Generates a source of water from the Master Ritual Stone.");
add("ritual.bloodmagic.waterRitual.default.info", "(Raw) Allows the water to be directly placed into a tank or other fluid-handling block. This will simulate insertion from the top of the target.");
add("ritual.bloodmagic.lavaRitual.info", "Generates a source of lava from the master ritual stone.");
add("ritual.bloodmagic.lavaRitual.default.info", "(Raw) Decreases the LP cost of placing lava and allows the lava to be directly placed into a tank or other fluid-handling block.");
add("ritual.bloodmagic.lavaRitual.default.info", "(Raw) Decreases the LP cost of placing lava and allows the lava to be directly placed into a tank or other fluid-handling block. This will simulate insertion from the top of the target.");
add("ritual.bloodmagic.lavaRitual.corrosive.info", "(Corrosive) Entities within range that are immune to fire are damaged severely.");
add("ritual.bloodmagic.lavaRitual.destructive.info", "(Destructive) Lava placement range is increased based on the total amount of Destructive Will in the Aura.");
add("ritual.bloodmagic.lavaRitual.vengeful.info", "(Vengeful) Entities within range have Fire Fuse applied to them.");
Expand Down Expand Up @@ -325,11 +326,11 @@ protected void addTranslations()
add("ritual.bloodmagic.greenGroveRitual.vengeful.info", "(Vengeful) Increases the rate that a growth tick is successful.");
add("ritual.bloodmagic.greenGroveRitual.steadfast.info", "(Steadfast) Seeds are replanted and blocks are hydrated within the Hydration range.");
add("ritual.bloodmagic.greenGroveRitual.destructive.info", "(Destructive) Increases the maximum growth range of the ritual based on the total amount of Destructive Will in the Aura.");
add("ritual.bloodmagic.featheredKnifeRitual.default.info", "(Raw) Increases the speed of the ritual based on the total amount of Raw Will in the Aura.");
add("ritual.bloodmagic.featheredKnifeRitual.default.info", "(Raw) Doubles the rate at which sacrifices happen.");
add("ritual.bloodmagic.featheredKnifeRitual.destructive.info", "(Destructive) Increases the yield of the ritual based on the total amount of Destructive Will in the Aura.");
add("ritual.bloodmagic.featheredKnifeRitual.vengeful.info", "(Vengeful) Sets the minimum health for sacrificing to 10%%. Overridden by Steadfast for the Owner if active.");
add("ritual.bloodmagic.featheredKnifeRitual.vengeful.info", "(Vengeful) Sets the minimum health for sacrificing to 10%%. Overridden by Steadfast for the Owner only if active.");
add("ritual.bloodmagic.featheredKnifeRitual.corrosive.info", "(Corrosive) Uses the player's current Incense Bonus (if any) to increase the yield. Stand near an Incense Altar to maintain this bonus.");
add("ritual.bloodmagic.featheredKnifeRitual.steadfast.info", "(Steadfast) Sets the minimum health for sacrificing from 30%% to 70%%.");
add("ritual.bloodmagic.featheredKnifeRitual.steadfast.info", "(Steadfast) Sets the minimum health for sacrificing from 30%% to 70%%. In combination with Vengeful this affects only the Owner");
add("ritual.bloodmagic.speedRitual.default.info", "(Raw) Increases the velocity caused by the ritual based on total Will.");
add("ritual.bloodmagic.speedRitual.vengeful.info", "(Vengeful) Prevents adult mobs and players from being transported. Players are transported if paired with Destructive.");
add("ritual.bloodmagic.speedRitual.destructive.info", "(Destructive) Prevents child mobs and players from being transported. Players are transported if paired with Vengeful.");
Expand Down
126 changes: 56 additions & 70 deletions src/main/java/wayoftime/bloodmagic/common/item/ItemRitualReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
import net.minecraft.world.item.context.UseOnContext;
import net.minecraft.world.level.ClipContext.Fluid;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.HitResult;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
Expand Down Expand Up @@ -87,7 +89,7 @@ public InteractionResultHolder<ItemStack> use(Level world, Player player, Intera
cycleReader(stack, player);
}

return new InteractionResultHolder<>(InteractionResult.SUCCESS, stack);
return InteractionResultHolder.success(stack);
}

return new InteractionResultHolder<>(InteractionResult.PASS, stack);
Expand All @@ -101,37 +103,38 @@ public InteractionResult useOn(UseOnContext context)

Player player = context.getPlayer();
ItemStack stack = context.getItemInHand();
InteractionHand hand = context.getHand();
Direction direction = context.getClickedFace();

// ItemStack stack = player.getHeldItem(hand);
if (!world.isClientSide)
EnumRitualReaderState state = this.getState(stack);
BlockEntity tile = world.getBlockEntity(pos);
if (tile instanceof IMasterRitualStone master)
{
EnumRitualReaderState state = this.getState(stack);
BlockEntity tile = world.getBlockEntity(pos);
if (tile instanceof IMasterRitualStone master)
{
if (master.getCurrentRitual() == null)
super.useOn(context);
this.setMasterBlockPos(stack, pos);
this.setBlockPos(stack, BlockPos.ZERO);
if (master.getCurrentRitual() == null) {
return super.useOn(context);
}
this.setMasterBlockPos(stack, pos);
this.setBlockPos(stack, BlockPos.ZERO);

switch (state)
{
switch (state)
{
case INFORMATION:
master.provideInformationOfRitualToPlayer(player);

break;
return InteractionResult.SUCCESS;
case SET_AREA:
ClientHandler.setRitualRangeHolo((TileMasterRitualStone) tile, true);
if (player.isShiftKeyDown() && player.getItemInHand(InteractionHand.OFF_HAND).getItem() instanceof ItemBloodOrb)
{
Ritual ritual = master.getCurrentRitual();
for (String range : ritual.getListOfRanges())
{
AreaDescriptor aabb = ritual.getBlockRange(range);
master.setBlockRange(range, aabb);
tile.setChanged();
BlockState blockState = world.getBlockState(pos);
world.sendBlockUpdated(pos, blockState, blockState, Block.UPDATE_ALL_IMMEDIATE);
ClientHandler.setRitualRangeHolo((TileMasterRitualStone) tile, true);
}
break;
return InteractionResult.SUCCESS;
}

String range = this.getCurrentBlockRange(stack);
Expand All @@ -145,7 +148,7 @@ public InteractionResult useOn(UseOnContext context)

master.provideInformationOfRangeToPlayer(player, range);

break;
return InteractionResult.SUCCESS;
case SET_WILL_TYPES:
List<EnumDemonWillType> typeList = new ArrayList<>();
NonNullList<ItemStack> inv = player.getInventory().items;
Expand All @@ -169,46 +172,46 @@ public InteractionResult useOn(UseOnContext context)

master.setActiveWillConfig(player, typeList);
master.provideInformationOfWillConfigToPlayer(player, typeList);
break;
}
return InteractionResult.SUCCESS;
}

return InteractionResult.FAIL;
} else
return InteractionResult.FAIL;
} else
{
if (state == EnumRitualReaderState.SET_AREA)
{
if (state == EnumRitualReaderState.SET_AREA)
BlockPos masterPos = this.getMasterBlockPos(stack);
if (!masterPos.equals(BlockPos.ZERO))
{
BlockPos masterPos = this.getMasterBlockPos(stack);
if (!masterPos.equals(BlockPos.ZERO))
BlockPos containedPos = getBlockPos(stack);
if (containedPos.equals(BlockPos.ZERO))
{
BlockPos containedPos = getBlockPos(stack);
if (containedPos.equals(BlockPos.ZERO))
{
BlockPos pos1 = pos.subtract(masterPos);
this.setBlockPos(stack, pos1);
player.displayClientMessage(Component.translatable("ritual.bloodmagic.blockRange.firstBlock"), true);
} else
BlockPos pos1 = pos.subtract(masterPos);
this.setBlockPos(stack, pos1);
player.displayClientMessage(Component.translatable("ritual.bloodmagic.blockRange.firstBlock"), true);
} else
{
tile = world.getBlockEntity(masterPos);
if (tile instanceof IMasterRitualStone master)
{
tile = world.getBlockEntity(masterPos);
if (tile instanceof IMasterRitualStone master)
BlockPos pos2 = pos.subtract(masterPos);
String range = this.getCurrentBlockRange(stack);
if (range == null || range.isEmpty())
{
String newRange = master.getNextBlockRange(range);
range = newRange;
this.setCurrentBlockRange(stack, newRange);
}
Ritual ritual = master.getCurrentRitual();
List<EnumDemonWillType> willConfig = master.getActiveWillConfig();
DemonWillHolder holder = WorldDemonWillHandler.getWillHolder(master.getWorldObj(), master.getMasterBlockPos());

int maxHorizontalRange = ritual.getMaxHorizontalRadiusForRange(range, willConfig, holder);
int maxVerticalRange = ritual.getMaxVerticalRadiusForRange(range, willConfig, holder);
int maxVolume = ritual.getMaxVolumeForRange(range, willConfig, holder);

switch (master.setBlockRangeByBounds(player, range, containedPos, pos2))
{
BlockPos pos2 = pos.subtract(masterPos);
String range = this.getCurrentBlockRange(stack);
if (range == null || range.isEmpty())
{
String newRange = master.getNextBlockRange(range);
range = newRange;
this.setCurrentBlockRange(stack, newRange);
}
Ritual ritual = master.getCurrentRitual();
List<EnumDemonWillType> willConfig = master.getActiveWillConfig();
DemonWillHolder holder = WorldDemonWillHandler.getWillHolder(master.getWorldObj(), master.getMasterBlockPos());

int maxHorizontalRange = ritual.getMaxHorizontalRadiusForRange(range, willConfig, holder);
int maxVerticalRange = ritual.getMaxVerticalRadiusForRange(range, willConfig, holder);
int maxVolume = ritual.getMaxVolumeForRange(range, willConfig, holder);

switch (master.setBlockRangeByBounds(player, range, containedPos, pos2))
{
case SUCCESS:
player.displayClientMessage(Component.translatable("ritual.bloodmagic.blockRange.success"), true);
break;
Expand All @@ -221,29 +224,12 @@ public InteractionResult useOn(UseOnContext context)
default:
player.displayClientMessage(Component.translatable("ritual.bloodmagic.blockRange.noRange"), false);
break;
}
}
this.setBlockPos(stack, BlockPos.ZERO);
}
this.setBlockPos(stack, BlockPos.ZERO);
}
}
}
} else
{
EnumRitualReaderState state = this.getState(stack);

if (state == EnumRitualReaderState.SET_AREA)
{
BlockEntity tile = world.getBlockEntity(pos);
if (tile instanceof TileMasterRitualStone)
{

// System.out.println("Setting range holo... I think");
ClientHandler.setRitualRangeHolo((TileMasterRitualStone) tile, true);

}
}

}

return super.useOn(context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class RitualFeatheredKnife extends Ritual
public static double vengefulWillThreshold = 10;
public static int defaultRefreshTime = 20;
public int refreshTime = 20;
public BlockPos altarOffsetPos = new BlockPos(0, 0, 0); // TODO: Save!
public BlockPos altarOffsetPos = new BlockPos(0, 2, 0);

public RitualFeatheredKnife()
{
Expand All @@ -53,10 +53,6 @@ public RitualFeatheredKnife()
public void performRitual(IMasterRitualStone masterRitualStone)
{
Level world = masterRitualStone.getWorldObj();
// if (world.isRemote)
// {
// return;
// }
int currentEssence = masterRitualStone.getOwnerNetwork().getCurrentEssence();

if (currentEssence < getRefreshCost())
Expand Down Expand Up @@ -119,11 +115,20 @@ public void performRitual(IMasterRitualStone masterRitualStone)

for (Player player : entities)
{
float healthThreshold = steadfastWill >= steadfastWillThreshold ? 0.7f : 0.3f;
boolean useSteadfast = steadfastWill >= steadfastWillThreshold;
boolean useVengeful = vengefulWill >= vengefulWillThreshold;
float healthThreshold = 0.3f;

if (vengefulWill >= vengefulWillThreshold && !player.getGameProfile().getId().equals(masterRitualStone.getOwner()))
if (useSteadfast) {
healthThreshold = 0.7f;
}

if (useVengeful)
{
healthThreshold = 0.1f;
if (useSteadfast && player.getGameProfile().getId().equals(masterRitualStone.getOwner())) {
healthThreshold = 0.7f;
}
}

float health = player.getHealth();
Expand Down Expand Up @@ -177,7 +182,7 @@ public void performRitual(IMasterRitualStone masterRitualStone)

if (destructiveDrain > 0)
{
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.STEADFAST, destructiveDrain, true);
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.DESTRUCTIVE, destructiveDrain, true);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package wayoftime.bloodmagic.ritual.types;

import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.network.chat.Component;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.effect.MobEffects;
Expand Down Expand Up @@ -125,7 +126,7 @@ public void performRitual(IMasterRitualStone masterRitualStone)
{
if (tile != null)
{
LazyOptional<IFluidHandler> capability = tile.getCapability(ForgeCapabilities.FLUID_HANDLER, null);
LazyOptional<IFluidHandler> capability = tile.getCapability(ForgeCapabilities.FLUID_HANDLER, Direction.UP);
if (capability.isPresent())
{
IFluidHandler handler = capability.resolve().get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.List;
import java.util.function.Consumer;

import net.minecraft.core.Direction;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.level.block.entity.BlockEntity;
Expand Down Expand Up @@ -93,7 +94,7 @@ public void performRitual(IMasterRitualStone masterRitualStone)
{
if (tile != null)
{
LazyOptional<IFluidHandler> capability = tile.getCapability(ForgeCapabilities.FLUID_HANDLER, null);
LazyOptional<IFluidHandler> capability = tile.getCapability(ForgeCapabilities.FLUID_HANDLER, Direction.UP);
if (capability.isPresent())
{
IFluidHandler handler = capability.resolve().get();
Expand Down