Did some work on the Crushing ritual and made it so that it ignores liquids.
The Lava Ritual now places source blocks when the fluid is flowing. Added the ability for my potions to (finally) have custom sprites.
This commit is contained in:
parent
b79f7127b6
commit
acde7ceccd
11 changed files with 163 additions and 25 deletions
|
@ -257,7 +257,7 @@ public abstract class AreaDescriptor implements Iterator<BlockPos>
|
|||
@Override
|
||||
public boolean isWithinRange(int verticalLimit, int horizontalLimit)
|
||||
{
|
||||
return minimumOffset.getY() >= -verticalLimit && maximumOffset.getY() < verticalLimit && minimumOffset.getX() >= -horizontalLimit && maximumOffset.getX() < horizontalLimit && minimumOffset.getZ() >= -horizontalLimit && maximumOffset.getZ() < horizontalLimit;
|
||||
return minimumOffset.getY() >= -verticalLimit && maximumOffset.getY() <= verticalLimit + 1 && minimumOffset.getX() >= -horizontalLimit && maximumOffset.getX() <= horizontalLimit + 1 && minimumOffset.getZ() >= -horizontalLimit && maximumOffset.getZ() <= horizontalLimit + 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.soul.DemonWillHolder;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
|
||||
|
||||
|
@ -221,7 +222,10 @@ public abstract class Ritual
|
|||
public boolean setBlockRangeByBounds(String range, IMasterRitualStone master, BlockPos offset1, BlockPos offset2)
|
||||
{
|
||||
AreaDescriptor descriptor = this.getBlockRange(range);
|
||||
if (canBlockRangeBeModified(range, descriptor, master, offset1, offset2))
|
||||
World world = master.getWorldObj();
|
||||
BlockPos masterPos = master.getBlockPos();
|
||||
DemonWillHolder holder = WorldDemonWillHandler.getWillHolder(world, masterPos);
|
||||
if (canBlockRangeBeModified(range, descriptor, master, offset1, offset2, holder))
|
||||
{
|
||||
descriptor.modifyAreaByBlockPositions(offset1, offset2);
|
||||
return true;
|
||||
|
@ -230,12 +234,12 @@ public abstract class Ritual
|
|||
return false;
|
||||
}
|
||||
|
||||
protected boolean canBlockRangeBeModified(String range, AreaDescriptor descriptor, IMasterRitualStone master, BlockPos offset1, BlockPos offset2)
|
||||
protected boolean canBlockRangeBeModified(String range, AreaDescriptor descriptor, IMasterRitualStone master, BlockPos offset1, BlockPos offset2, DemonWillHolder holder)
|
||||
{
|
||||
List<EnumDemonWillType> willConfig = master.getActiveWillConfig();
|
||||
int maxVolume = getMaxVolumeForRange(range, willConfig);
|
||||
int maxVertical = getMaxVerticalRadiusForRange(range, willConfig);
|
||||
int maxHorizontal = getMaxHorizontalRadiusForRange(range, willConfig);
|
||||
int maxVolume = getMaxVolumeForRange(range, willConfig, holder);
|
||||
int maxVertical = getMaxVerticalRadiusForRange(range, willConfig, holder);
|
||||
int maxHorizontal = getMaxHorizontalRadiusForRange(range, willConfig, holder);
|
||||
|
||||
return (maxVolume <= 0 || descriptor.getVolumeForOffsets(offset1, offset2) <= maxVolume) && descriptor.isWithinRange(offset1, offset2, maxVertical, maxHorizontal);
|
||||
}
|
||||
|
@ -252,17 +256,17 @@ public abstract class Ritual
|
|||
return descriptor.getVolume() <= maxVolume && descriptor.isWithinRange(maxVertical, maxHorizontal);
|
||||
}
|
||||
|
||||
public int getMaxVolumeForRange(String range, List<EnumDemonWillType> activeTypes)
|
||||
public int getMaxVolumeForRange(String range, List<EnumDemonWillType> activeTypes, DemonWillHolder holder)
|
||||
{
|
||||
return volumeRangeMap.get(range);
|
||||
}
|
||||
|
||||
public int getMaxVerticalRadiusForRange(String range, List<EnumDemonWillType> activeTypes)
|
||||
public int getMaxVerticalRadiusForRange(String range, List<EnumDemonWillType> activeTypes, DemonWillHolder holder)
|
||||
{
|
||||
return verticalRangeMap.get(range);
|
||||
}
|
||||
|
||||
public int getMaxHorizontalRadiusForRange(String range, List<EnumDemonWillType> activeTypes)
|
||||
public int getMaxHorizontalRadiusForRange(String range, List<EnumDemonWillType> activeTypes, DemonWillHolder holder)
|
||||
{
|
||||
return horizontalRangeMap.get(range);
|
||||
}
|
||||
|
@ -274,9 +278,13 @@ public abstract class Ritual
|
|||
{
|
||||
return new TextComponentTranslation("ritual.BloodMagic.blockRange.tooBig", "?");
|
||||
}
|
||||
int maxVolume = volumeRangeMap.get(range);
|
||||
int maxVertical = verticalRangeMap.get(range);
|
||||
int maxHorizontal = horizontalRangeMap.get(range);
|
||||
|
||||
List<EnumDemonWillType> willConfig = master.getActiveWillConfig();
|
||||
DemonWillHolder holder = WorldDemonWillHandler.getWillHolder(master.getWorldObj(), master.getBlockPos());
|
||||
|
||||
int maxVolume = this.getMaxVolumeForRange(range, willConfig, holder);
|
||||
int maxVertical = this.getMaxVerticalRadiusForRange(range, willConfig, holder);
|
||||
int maxHorizontal = this.getMaxHorizontalRadiusForRange(range, willConfig, holder);
|
||||
|
||||
if (maxVolume > 0 && descriptor.getVolumeForOffsets(offset1, offset2) > maxVolume)
|
||||
{
|
||||
|
|
|
@ -26,6 +26,11 @@ public class WorldDemonWillHandler
|
|||
return null;
|
||||
}
|
||||
|
||||
public static DemonWillHolder getWillHolder(World world, BlockPos pos)
|
||||
{
|
||||
return getWillHolder(world.provider.getDimension(), pos.getX() >> 4, pos.getZ() >> 4);
|
||||
}
|
||||
|
||||
public static WillWorld getWillWorld(int dim)
|
||||
{
|
||||
return containedWills.get(dim);
|
||||
|
|
|
@ -1,14 +1,65 @@
|
|||
package WayofTime.bloodmagic.potion;
|
||||
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class PotionBloodMagic extends Potion
|
||||
{
|
||||
public static ResourceLocation texture = new ResourceLocation(Constants.Mod.MODID, "textures/misc/potions.png");
|
||||
|
||||
public PotionBloodMagic(String name, ResourceLocation texture, boolean badEffect, int potionColor, int iconIndexX, int iconIndexY)
|
||||
{
|
||||
super(badEffect, potionColor);
|
||||
this.setPotionName(name);
|
||||
this.setIconIndex(iconIndexX, iconIndexY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRenderInvText(PotionEffect effect)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public PotionEffect apply(EntityLivingBase entity, int duration)
|
||||
{
|
||||
return apply(entity, duration, 0);
|
||||
}
|
||||
|
||||
public PotionEffect apply(EntityLivingBase entity, int duration, int level)
|
||||
{
|
||||
PotionEffect effect = new PotionEffect(this, duration, level, false, false);
|
||||
entity.addPotionEffect(effect);
|
||||
return effect;
|
||||
}
|
||||
|
||||
public int getLevel(EntityLivingBase entity)
|
||||
{
|
||||
PotionEffect effect = entity.getActivePotionEffect(this);
|
||||
if (effect != null)
|
||||
{
|
||||
return effect.getAmplifier();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender(PotionEffect effect)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getStatusIconIndex()
|
||||
{
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
|
||||
|
||||
return super.getStatusIconIndex();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ public class ModPotions
|
|||
// drowning = new PotionBloodMagic("Drowning", new
|
||||
// ResourceLocation(resourceLocation +
|
||||
// drowning.getName().toLowerCase()), true, 0, 0, 0);
|
||||
boost = registerPotion("Boost", new ResourceLocation("boost"), false, 0xFFFFFF, 0, 0);
|
||||
boost = registerPotion("Boost", new ResourceLocation("boost"), false, 0xFFFFFF, 0, 1);
|
||||
// new ResourceLocation(resourceLocation +
|
||||
// boost.getName().toLowerCase())
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
|||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
|
||||
import WayofTime.bloodmagic.item.alchemy.ItemCuttingFluid;
|
||||
import WayofTime.bloodmagic.registry.ModBlocks;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
|
||||
|
@ -104,7 +103,7 @@ public class RitualCrushing extends Ritual
|
|||
|
||||
IBlockState state = world.getBlockState(newPos);
|
||||
Block block = state.getBlock();
|
||||
if (block.equals(ModBlocks.ritualController) || block.equals(ModBlocks.ritualStone) || block.getBlockHardness(state, world, newPos) == -1.0F)
|
||||
if (block.equals(ModBlocks.ritualController) || block.equals(ModBlocks.ritualStone) || block.getBlockHardness(state, world, newPos) == -1.0F || Utils.isBlockLiquid(state))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -257,7 +256,7 @@ public class RitualCrushing extends Ritual
|
|||
{
|
||||
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
|
||||
|
||||
this.addParallelRunes(ritualComponents, 1, 0, EnumRuneType.EARTH);
|
||||
this.addParallelRunes(components, 1, 0, EnumRuneType.EARTH);
|
||||
this.addParallelRunes(components, 2, 0, EnumRuneType.FIRE);
|
||||
this.addCornerRunes(components, 2, 0, EnumRuneType.DUSK);
|
||||
this.addParallelRunes(components, 2, 1, EnumRuneType.AIR);
|
||||
|
|
|
@ -1,18 +1,29 @@
|
|||
package WayofTime.bloodmagic.ritual;
|
||||
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.ritual.*;
|
||||
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.ritual.AreaDescriptor;
|
||||
import WayofTime.bloodmagic.api.ritual.EnumRuneType;
|
||||
import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
|
||||
import WayofTime.bloodmagic.api.ritual.Ritual;
|
||||
import WayofTime.bloodmagic.api.ritual.RitualComponent;
|
||||
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.soul.DemonWillHolder;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
|
||||
public class RitualLava extends Ritual
|
||||
{
|
||||
public static final String LAVA_RANGE = "lavaRange";
|
||||
public static int destructiveWillDrain = 10;
|
||||
|
||||
public RitualLava()
|
||||
{
|
||||
|
@ -34,14 +45,25 @@ public class RitualLava extends Ritual
|
|||
return;
|
||||
}
|
||||
|
||||
BlockPos pos = masterRitualStone.getBlockPos();
|
||||
int maxEffects = currentEssence / getRefreshCost();
|
||||
int totalEffects = 0;
|
||||
|
||||
List<EnumDemonWillType> willConfig = masterRitualStone.getActiveWillConfig();
|
||||
DemonWillHolder holder = WorldDemonWillHandler.getWillHolder(world, pos);
|
||||
AreaDescriptor lavaRange = getBlockRange(LAVA_RANGE);
|
||||
|
||||
for (BlockPos newPos : lavaRange.getContainedPositions(masterRitualStone.getBlockPos()))
|
||||
int maxLavaVolume = getMaxVolumeForRange(LAVA_RANGE, willConfig, holder);
|
||||
if (!lavaRange.isWithinRange(getMaxVerticalRadiusForRange(LAVA_RANGE, willConfig, holder), getMaxHorizontalRadiusForRange(LAVA_RANGE, willConfig, holder)) || (maxLavaVolume != 0 && lavaRange.getVolume() > maxLavaVolume))
|
||||
{
|
||||
if (world.isAirBlock(newPos))
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
for (BlockPos newPos : lavaRange.getContainedPositions(pos))
|
||||
{
|
||||
IBlockState state = world.getBlockState(newPos);
|
||||
if (world.isAirBlock(newPos) || Utils.isFlowingLiquid(world, newPos, state))
|
||||
{
|
||||
world.setBlockState(newPos, Blocks.FLOWING_LAVA.getDefaultState());
|
||||
totalEffects++;
|
||||
|
@ -83,4 +105,49 @@ public class RitualLava extends Ritual
|
|||
{
|
||||
return new RitualLava();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxVolumeForRange(String range, List<EnumDemonWillType> activeTypes, DemonWillHolder holder)
|
||||
{
|
||||
if (LAVA_RANGE.equals(range) && activeTypes.contains(EnumDemonWillType.DESTRUCTIVE))
|
||||
{
|
||||
double destructiveWill = holder.getWill(EnumDemonWillType.DESTRUCTIVE);
|
||||
if (destructiveWill > 0)
|
||||
{
|
||||
return 9 + (int) Math.pow(destructiveWill / 10, 1.5);
|
||||
}
|
||||
}
|
||||
|
||||
return volumeRangeMap.get(range);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxVerticalRadiusForRange(String range, List<EnumDemonWillType> activeTypes, DemonWillHolder holder)
|
||||
{
|
||||
if (LAVA_RANGE.equals(range) && activeTypes.contains(EnumDemonWillType.DESTRUCTIVE))
|
||||
{
|
||||
double destructiveWill = holder.getWill(EnumDemonWillType.DESTRUCTIVE);
|
||||
if (destructiveWill > 0)
|
||||
{
|
||||
return (int) (3 + destructiveWill / 10d);
|
||||
}
|
||||
}
|
||||
|
||||
return verticalRangeMap.get(range);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxHorizontalRadiusForRange(String range, List<EnumDemonWillType> activeTypes, DemonWillHolder holder)
|
||||
{
|
||||
if (LAVA_RANGE.equals(range) && activeTypes.contains(EnumDemonWillType.DESTRUCTIVE))
|
||||
{
|
||||
double destructiveWill = holder.getWill(EnumDemonWillType.DESTRUCTIVE);
|
||||
if (destructiveWill > 0)
|
||||
{
|
||||
return (int) (3 + destructiveWill / 10d);
|
||||
}
|
||||
}
|
||||
|
||||
return horizontalRangeMap.get(range);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import java.util.UUID;
|
|||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockLiquid;
|
||||
import net.minecraft.block.BlockPortal;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
|
@ -802,6 +803,12 @@ public class Utils
|
|||
return (state instanceof IFluidBlock || state.getMaterial().isLiquid());
|
||||
}
|
||||
|
||||
public static boolean isFlowingLiquid(World world, BlockPos pos, IBlockState state)
|
||||
{
|
||||
Block block = state.getBlock();
|
||||
return ((block instanceof IFluidBlock && Math.abs(((IFluidBlock) block).getFilledPercentage(world, pos)) == 1) || (block instanceof BlockLiquid && block.getMetaFromState(state) != 0));
|
||||
}
|
||||
|
||||
public static boolean spawnStackAtBlock(World world, BlockPos pos, @Nullable EnumFacing pushDirection, ItemStack stack)
|
||||
{
|
||||
EntityItem entityItem = new EntityItem(world);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue