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:
WayofTime 2016-07-12 16:57:22 -04:00
parent b79f7127b6
commit acde7ceccd
11 changed files with 163 additions and 25 deletions

View file

@ -3,6 +3,7 @@ Version 2.0.3-51
------------------------------------------------------ ------------------------------------------------------
- Added the Demon Will Aura Gauge to accurately determine the Will in the Aura. - Added the Demon Will Aura Gauge to accurately determine the Will in the Aura.
- Added the ability for rituals to have a Demon Will set on them. Now to get rituals to use them. - Added the ability for rituals to have a Demon Will set on them. Now to get rituals to use them.
- Fixed it so that the Crushing Ritual now ignores liquids
------------------------------------------------------ ------------------------------------------------------
Version 2.0.2-50 Version 2.0.2-50

View file

@ -257,7 +257,7 @@ public abstract class AreaDescriptor implements Iterator<BlockPos>
@Override @Override
public boolean isWithinRange(int verticalLimit, int horizontalLimit) 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;
} }
} }

View file

@ -18,6 +18,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.bloodmagic.api.soul.DemonWillHolder;
import WayofTime.bloodmagic.api.soul.EnumDemonWillType; import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler; import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
@ -221,7 +222,10 @@ public abstract class Ritual
public boolean setBlockRangeByBounds(String range, IMasterRitualStone master, BlockPos offset1, BlockPos offset2) public boolean setBlockRangeByBounds(String range, IMasterRitualStone master, BlockPos offset1, BlockPos offset2)
{ {
AreaDescriptor descriptor = this.getBlockRange(range); 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); descriptor.modifyAreaByBlockPositions(offset1, offset2);
return true; return true;
@ -230,12 +234,12 @@ public abstract class Ritual
return false; 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(); List<EnumDemonWillType> willConfig = master.getActiveWillConfig();
int maxVolume = getMaxVolumeForRange(range, willConfig); int maxVolume = getMaxVolumeForRange(range, willConfig, holder);
int maxVertical = getMaxVerticalRadiusForRange(range, willConfig); int maxVertical = getMaxVerticalRadiusForRange(range, willConfig, holder);
int maxHorizontal = getMaxHorizontalRadiusForRange(range, willConfig); int maxHorizontal = getMaxHorizontalRadiusForRange(range, willConfig, holder);
return (maxVolume <= 0 || descriptor.getVolumeForOffsets(offset1, offset2) <= maxVolume) && descriptor.isWithinRange(offset1, offset2, maxVertical, maxHorizontal); 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); 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); 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); 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); return horizontalRangeMap.get(range);
} }
@ -274,9 +278,13 @@ public abstract class Ritual
{ {
return new TextComponentTranslation("ritual.BloodMagic.blockRange.tooBig", "?"); return new TextComponentTranslation("ritual.BloodMagic.blockRange.tooBig", "?");
} }
int maxVolume = volumeRangeMap.get(range);
int maxVertical = verticalRangeMap.get(range); List<EnumDemonWillType> willConfig = master.getActiveWillConfig();
int maxHorizontal = horizontalRangeMap.get(range); 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) if (maxVolume > 0 && descriptor.getVolumeForOffsets(offset1, offset2) > maxVolume)
{ {

View file

@ -26,6 +26,11 @@ public class WorldDemonWillHandler
return null; 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) public static WillWorld getWillWorld(int dim)
{ {
return containedWills.get(dim); return containedWills.get(dim);

View file

@ -1,14 +1,65 @@
package WayofTime.bloodmagic.potion; 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.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class PotionBloodMagic extends Potion 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) public PotionBloodMagic(String name, ResourceLocation texture, boolean badEffect, int potionColor, int iconIndexX, int iconIndexY)
{ {
super(badEffect, potionColor); super(badEffect, potionColor);
this.setPotionName(name); this.setPotionName(name);
this.setIconIndex(iconIndexX, iconIndexY); 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();
}
} }

View file

@ -30,7 +30,7 @@ public class ModPotions
// drowning = new PotionBloodMagic("Drowning", new // drowning = new PotionBloodMagic("Drowning", new
// ResourceLocation(resourceLocation + // ResourceLocation(resourceLocation +
// drowning.getName().toLowerCase()), true, 0, 0, 0); // 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 + // new ResourceLocation(resourceLocation +
// boost.getName().toLowerCase()) // boost.getName().toLowerCase())

View file

@ -28,7 +28,6 @@ import WayofTime.bloodmagic.api.saving.SoulNetwork;
import WayofTime.bloodmagic.api.soul.EnumDemonWillType; import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper; import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler; import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
import WayofTime.bloodmagic.item.alchemy.ItemCuttingFluid;
import WayofTime.bloodmagic.registry.ModBlocks; import WayofTime.bloodmagic.registry.ModBlocks;
import WayofTime.bloodmagic.util.Utils; import WayofTime.bloodmagic.util.Utils;
@ -104,7 +103,7 @@ public class RitualCrushing extends Ritual
IBlockState state = world.getBlockState(newPos); IBlockState state = world.getBlockState(newPos);
Block block = state.getBlock(); 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; continue;
} }
@ -257,7 +256,7 @@ public class RitualCrushing extends Ritual
{ {
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>(); 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.addParallelRunes(components, 2, 0, EnumRuneType.FIRE);
this.addCornerRunes(components, 2, 0, EnumRuneType.DUSK); this.addCornerRunes(components, 2, 0, EnumRuneType.DUSK);
this.addParallelRunes(components, 2, 1, EnumRuneType.AIR); this.addParallelRunes(components, 2, 1, EnumRuneType.AIR);

View file

@ -1,18 +1,29 @@
package WayofTime.bloodmagic.ritual; package WayofTime.bloodmagic.ritual;
import WayofTime.bloodmagic.api.Constants; import java.util.ArrayList;
import WayofTime.bloodmagic.api.saving.SoulNetwork; import java.util.List;
import WayofTime.bloodmagic.api.ritual.*;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper; import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.bloodmagic.api.Constants;
import java.util.ArrayList; 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 class RitualLava extends Ritual
{ {
public static final String LAVA_RANGE = "lavaRange"; public static final String LAVA_RANGE = "lavaRange";
public static int destructiveWillDrain = 10;
public RitualLava() public RitualLava()
{ {
@ -34,14 +45,25 @@ public class RitualLava extends Ritual
return; return;
} }
BlockPos pos = masterRitualStone.getBlockPos();
int maxEffects = currentEssence / getRefreshCost(); int maxEffects = currentEssence / getRefreshCost();
int totalEffects = 0; int totalEffects = 0;
List<EnumDemonWillType> willConfig = masterRitualStone.getActiveWillConfig();
DemonWillHolder holder = WorldDemonWillHandler.getWillHolder(world, pos);
AreaDescriptor lavaRange = getBlockRange(LAVA_RANGE); 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()); world.setBlockState(newPos, Blocks.FLOWING_LAVA.getDefaultState());
totalEffects++; totalEffects++;
@ -83,4 +105,49 @@ public class RitualLava extends Ritual
{ {
return new RitualLava(); 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);
}
} }

View file

@ -8,6 +8,7 @@ import java.util.UUID;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockLiquid;
import net.minecraft.block.BlockPortal; import net.minecraft.block.BlockPortal;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.enchantment.EnchantmentHelper;
@ -802,6 +803,12 @@ public class Utils
return (state instanceof IFluidBlock || state.getMaterial().isLiquid()); 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) public static boolean spawnStackAtBlock(World world, BlockPos pos, @Nullable EnumFacing pushDirection, ItemStack stack)
{ {
EntityItem entityItem = new EntityItem(world); EntityItem entityItem = new EntityItem(world);

View file

@ -474,7 +474,7 @@ ritual.BloodMagic.regenerationRitual.info=Casts regeneration on entities within
ritual.BloodMagic.harvestRitual.info=Harvests plants within its range, dropping the results on the ground. ritual.BloodMagic.harvestRitual.info=Harvests plants within its range, dropping the results on the ground.
ritual.BloodMagic.magneticRitual.info=Pulls up ores from the ground and puts them into its placement range. ritual.BloodMagic.magneticRitual.info=Pulls up ores from the ground and puts them into its placement range.
ritual.BloodMagic.crushingRitual.info=Breaks blocks within its crushing range and places the items into the linked chest. ritual.BloodMagic.crushingRitual.info=Breaks blocks within its crushing range and places the items into the linked chest.
ritual.BloodMagic.crushingRitual.destructive.info=(Destructive) Blocks are broken down forcefuly: all blocks broken are affected by Fortune III. ritual.BloodMagic.crushingRitual.destructive.info=(Destructive) Blocks are broken down forcefully: all blocks broken are affected by Fortune III.
ritual.BloodMagic.crushingRitual.steadfast.info=(Steadfast) Causes all blocks that are broken to be picked up with silk touch. Overrides Fortune where applicable. ritual.BloodMagic.crushingRitual.steadfast.info=(Steadfast) Causes all blocks that are broken to be picked up with silk touch. Overrides Fortune where applicable.
ritual.BloodMagic.crushingRitual.corrosive.info=(Corrosive) All blocks are broken to be processed with a form of cutting fluid. Overrides Silk Touch where applicable. ritual.BloodMagic.crushingRitual.corrosive.info=(Corrosive) All blocks are broken to be processed with a form of cutting fluid. Overrides Silk Touch where applicable.

Binary file not shown.

After

Width:  |  Height:  |  Size: 748 B