Skip to content
This repository has been archived by the owner on May 13, 2023. It is now read-only.

Commit

Permalink
Added the necessary infrastructure for Rituals to use Demon Will from…
Browse files Browse the repository at this point in the history
… the Aura.

Added the Demon Will Gauge.
  • Loading branch information
WayofTime committed Jul 11, 2016
1 parent 12094c1 commit 767b092
Show file tree
Hide file tree
Showing 16 changed files with 190 additions and 28 deletions.
7 changes: 6 additions & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
------------------------------------------------------
Version 2.0.3-51
------------------------------------------------------
- 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.

------------------------------------------------------
Version 2.0.2-50
------------------------------------------------------
- Fixed bad NPE when using the WoS. (Well, I guess all NPEs are technically bad, but I guess it depends on your perspective. That said, I don't think a changelog is the best place for a theoretical discussion about the rights and wrongs of errors, so I will stop now.)


------------------------------------------------------
Version 2.0.2-49
------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mod_name=BloodMagic
package_group=com.wayoftime.bloodmagic
mod_version=2.0.2
mod_version=2.0.3
mc_version=1.9.4
forge_version=12.17.0.1957
curse_id=224791
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/WayofTime/bloodmagic/api/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ public enum BloodMagicItem
RITUAL_READER("ItemRitualReader"),
SANGUINE_BOOK("ItemSanguineBook"),
SIGIL_HOLDING("ItemSigilHolding"),
ARMOUR_POINTS_UPGRADE("ItemLivingArmourPointsUpgrade"), ;
ARMOUR_POINTS_UPGRADE("ItemLivingArmourPointsUpgrade"),
DEMON_WILL_GAUGE("ItemDemonWillGauge"), ;

@Getter
private final String regName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ public interface IMasterRitualStone

void provideInformationOfRangeToPlayer(EntityPlayer player, String range);

void provideInformationOfWillConfigToPlayer(EntityPlayer player, List<EnumDemonWillType> typeList);

void setActiveWillConfig(EntityPlayer player, List<EnumDemonWillType> typeList);

boolean setBlockRangeByBounds(EntityPlayer player, String range, BlockPos offset1, BlockPos offset2);

List<EnumDemonWillType> getCurrentActiveWillConfig();
List<EnumDemonWillType> getActiveWillConfig();
}
4 changes: 2 additions & 2 deletions src/main/java/WayofTime/bloodmagic/api/ritual/Ritual.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/
@Getter
@RequiredArgsConstructor
@EqualsAndHashCode(exclude = { "modableRangeMap", "ritualComponents", "renderer" })
@EqualsAndHashCode(exclude = { "modableRangeMap", "ritualComponents", "renderer", "volumeRangeMap", "horizontalRangeMap", "verticalRangeMap" })
@ToString
public abstract class Ritual
{
Expand Down Expand Up @@ -231,7 +231,7 @@ public boolean setBlockRangeByBounds(String range, IMasterRitualStone master, Bl

protected boolean canBlockRangeBeModified(String range, AreaDescriptor descriptor, IMasterRitualStone master, BlockPos offset1, BlockPos offset2)
{
List<EnumDemonWillType> willConfig = master.getCurrentActiveWillConfig();
List<EnumDemonWillType> willConfig = master.getActiveWillConfig();
int maxVolume = getMaxVolumeForRange(range, willConfig);
int maxVertical = getMaxVerticalRadiusForRange(range, willConfig);
int maxHorizontal = getMaxHorizontalRadiusForRange(range, willConfig);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
import WayofTime.bloodmagic.proxy.ClientProxy;
import WayofTime.bloodmagic.util.Utils;

public class HUDElementDemonWillAura extends HUDElement
{
Expand All @@ -37,30 +38,20 @@ public HUDElementDemonWillAura()
public void render(Minecraft minecraft, ScaledResolution resolution, float partialTicks)
{
EntityPlayer player = minecraft.thePlayer;
// ItemStack sigilHolding = minecraft.thePlayer.getHeldItemMainhand();
// // TODO - Clean this mess
// // Check mainhand for Sigil of Holding
// if (sigilHolding == null)
// return;
// if (!(sigilHolding.getItem() == ModItems.sigilHolding))
// sigilHolding = minecraft.thePlayer.getHeldItemOffhand();
// // Check offhand for Sigil of Holding
// if (sigilHolding == null)
// return;
// if (!(sigilHolding.getItem() == ModItems.sigilHolding))
// return;

Gui ingameGui = minecraft.ingameGUI;

if (!Utils.canPlayerSeeDemonWill(player))
{
return;
}

Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexBuffer = tessellator.getBuffer();

minecraft.getTextureManager().bindTexture(new ResourceLocation(Constants.Mod.MODID, "textures/gui/demonWillBar.png"));
GlStateManager.color(1.0F, 1.0F, 1.0F);
this.drawTexturedModalRect(getXOffset(), getYOffset(), 45, 0, 45, 65);

// GlStateManager.pushMatrix();

double maxAmount = 100;
double maxAmount = Utils.getDemonWillResolution(player);

for (EnumDemonWillType type : EnumDemonWillType.values())
{
Expand Down
58 changes: 58 additions & 0 deletions src/main/java/WayofTime/bloodmagic/item/ItemDemonWillGauge.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package WayofTime.bloodmagic.item;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;

import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.iface.IDemonWillViewer;
import WayofTime.bloodmagic.client.IVariantProvider;
import WayofTime.bloodmagic.util.helper.TextHelper;

public class ItemDemonWillGauge extends Item implements IVariantProvider, IDemonWillViewer
{
public ItemDemonWillGauge()
{
setUnlocalizedName(Constants.Mod.MODID + ".willGauge");
setMaxStackSize(1);
setCreativeTab(BloodMagic.tabBloodMagic);
}

@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced)
{
tooltip.addAll(Arrays.asList(TextHelper.cutLongString(TextHelper.localizeEffect("tooltip.BloodMagic.willGauge"))));
}

@Override
public List<Pair<Integer, String>> getVariants()
{
List<Pair<Integer, String>> ret = new ArrayList<Pair<Integer, String>>();
ret.add(new ImmutablePair<Integer, String>(0, "type=willgauge"));
return ret;
}

@Override
public boolean canSeeDemonWillAura(World world, ItemStack stack, EntityPlayer player)
{
return true;
}

@Override
public int getDemonWillAuraResolution(World world, ItemStack stack, EntityPlayer player)
{
return 100;
}
}
24 changes: 24 additions & 0 deletions src/main/java/WayofTime/bloodmagic/item/ItemRitualReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.ritual.EnumRitualReaderState;
import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
import WayofTime.bloodmagic.api.soul.IDiscreteDemonWill;
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
import WayofTime.bloodmagic.client.IVariantProvider;
import WayofTime.bloodmagic.util.ChatUtil;
Expand Down Expand Up @@ -119,6 +121,28 @@ public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World wo
master.provideInformationOfRangeToPlayer(player, range);
break;
case SET_WILL_TYPES:
List<EnumDemonWillType> typeList = new ArrayList<EnumDemonWillType>();
ItemStack[] inv = player.inventory.mainInventory;
for (int i = 0; i < 9; i++)
{
ItemStack testStack = inv[i];
if (testStack == null)
{
continue;
}

if (testStack.getItem() instanceof IDiscreteDemonWill)
{
EnumDemonWillType type = ((IDiscreteDemonWill) testStack.getItem()).getType(testStack);
if (!typeList.contains(type))
{
typeList.add(type);
}
}
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,13 @@ public void toBytes(ByteBuf buffer)
PacketBuffer buff = new PacketBuffer(buffer);
for (EnumDemonWillType type : EnumDemonWillType.values())
{
buff.writeDouble(currentWill.willMap.get(type));
if (currentWill.willMap.containsKey(type))
{
buff.writeDouble(currentWill.willMap.get(type));
} else
{
buff.writeDouble(0);
}
}
}

Expand Down
5 changes: 5 additions & 0 deletions src/main/java/WayofTime/bloodmagic/registry/ModItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import WayofTime.bloodmagic.item.ItemComponent;
import WayofTime.bloodmagic.item.ItemDaggerOfSacrifice;
import WayofTime.bloodmagic.item.ItemDemonCrystal;
import WayofTime.bloodmagic.item.ItemDemonWillGauge;
import WayofTime.bloodmagic.item.ItemExperienceBook;
import WayofTime.bloodmagic.item.ItemInscriptionTool;
import WayofTime.bloodmagic.item.ItemLavaCrystal;
Expand Down Expand Up @@ -171,6 +172,8 @@ public class ModItems

public static Item itemPointsUpgrade;

public static Item demonWillGauge;

public static Item.ToolMaterial boundToolMaterial = EnumHelper.addToolMaterial("BoundToolMaterial", 4, 1, 10, 8, 50);
public static Item.ToolMaterial soulToolMaterial = EnumHelper.addToolMaterial("SoulToolMaterial", 4, 520, 7, 8, 50);

Expand Down Expand Up @@ -273,6 +276,8 @@ public static void init()
sanguineBook = registerItem(new ItemSanguineBook(), Constants.BloodMagicItem.SANGUINE_BOOK.getRegName());

itemPointsUpgrade = registerItem(new ItemLivingArmourPointsUpgrade(), Constants.BloodMagicItem.ARMOUR_POINTS_UPGRADE.getRegName());

demonWillGauge = registerItem(new ItemDemonWillGauge(), Constants.BloodMagicItem.DEMON_WILL_GAUGE.getRegName());
}

@SideOnly(Side.CLIENT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ public static void addSoulForgeRecipes()
TartaricForgeRecipeRegistry.registerRecipe(new ItemStack(ModBlocks.demonCrucible), 400, 100, Items.CAULDRON, "stone", "gemLapis", "gemDiamond");
TartaricForgeRecipeRegistry.registerRecipe(new ItemStack(ModBlocks.demonPylon), 400, 50, "blockIron", "stone", "gemLapis", ModItems.itemDemonCrystal);
TartaricForgeRecipeRegistry.registerRecipe(new ItemStack(ModBlocks.demonCrystallizer), 500, 100, ModBlocks.soulForge, "stone", "gemLapis", "blockGlass");
TartaricForgeRecipeRegistry.registerRecipe(new ItemStack(ModItems.demonWillGauge), 400, 50, "ingotGold", "dustRedstone", "blockGlass", ModItems.itemDemonCrystal);
}

public static void addAlchemyTableRecipes()
Expand Down
49 changes: 45 additions & 4 deletions src/main/java/WayofTime/bloodmagic/tile/TileMasterRitualStone.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ public class TileMasterRitualStone extends TileEntity implements IMasterRitualSt
@Setter
private EnumFacing direction = EnumFacing.NORTH;

private List<EnumDemonWillType> currentActiveWillConfig = new ArrayList<EnumDemonWillType>();

@Override
public void update()
{
Expand Down Expand Up @@ -99,6 +101,14 @@ public void readFromNBT(NBTTagCompound tag)
activeTime = tag.getInteger(Constants.NBT.RUNTIME);
direction = EnumFacing.VALUES[tag.getInteger(Constants.NBT.DIRECTION)];
redstoned = tag.getBoolean(Constants.NBT.IS_REDSTONED);

for (EnumDemonWillType type : EnumDemonWillType.values())
{
if (tag.getBoolean("EnumWill" + type))
{
currentActiveWillConfig.add(type);
}
}
}

@Override
Expand All @@ -118,6 +128,12 @@ public NBTTagCompound writeToNBT(NBTTagCompound tag)
tag.setInteger(Constants.NBT.RUNTIME, getActiveTime());
tag.setInteger(Constants.NBT.DIRECTION, direction.getIndex());
tag.setBoolean(Constants.NBT.IS_REDSTONED, redstoned);

for (EnumDemonWillType type : currentActiveWillConfig)
{
tag.setBoolean("EnumWill" + type, true);
}

return tag;
}

Expand Down Expand Up @@ -344,8 +360,7 @@ public void provideInformationOfRangeToPlayer(EntityPlayer player, String range)
@Override
public void setActiveWillConfig(EntityPlayer player, List<EnumDemonWillType> typeList)
{
// TODO Auto-generated method stub

this.currentActiveWillConfig = typeList;
}

@Override
Expand Down Expand Up @@ -374,8 +389,34 @@ public boolean setBlockRangeByBounds(EntityPlayer player, String range, BlockPos
}

@Override
public List<EnumDemonWillType> getCurrentActiveWillConfig()
public List<EnumDemonWillType> getActiveWillConfig()
{
return new ArrayList<EnumDemonWillType>(currentActiveWillConfig);
}

@Override
public void provideInformationOfWillConfigToPlayer(EntityPlayer player, List<EnumDemonWillType> typeList)
{
return new ArrayList<EnumDemonWillType>();
//There is probably an easier way to make expanded chat messages
if (typeList.size() >= 1)
{
Object[] translations = new TextComponentTranslation[typeList.size()];
String constructedString = "%s";

for (int i = 1; i < typeList.size(); i++)
{
constructedString = constructedString + ", %s";
}

for (int i = 0; i < typeList.size(); i++)
{
translations[i] = new TextComponentTranslation("tooltip.BloodMagic.currentBaseType." + typeList.get(i).name.toLowerCase());
}

ChatUtil.sendNoSpam(player, new TextComponentTranslation("ritual.BloodMagic.willConfig.set", new TextComponentTranslation(constructedString, translations)));
} else
{
ChatUtil.sendNoSpam(player, new TextComponentTranslation("ritual.BloodMagic.willConfig.void"));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"forge_marker": 1,
"defaults": {
"model": "builtin/generated",
"transform": "forge:default-item"
},
"variants": {
"type": {
"willgauge": {
"textures": {
"layer0": "bloodmagic:items/DemonWillGauge"
}
}
}
}
}
12 changes: 12 additions & 0 deletions src/main/resources/assets/bloodmagic/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ item.BloodMagic.sanguineBook.name=Inspectoris Scandalum

item.BloodMagic.livingPointUpgrade.draftAngelus.name=Draft of Angelus

item.BloodMagic.willGauge.name=Demon Will Aura Gauge

# Blocks
tile.BloodMagic.fluid.lifeEssence.name=Life Essence

Expand Down Expand Up @@ -401,6 +403,12 @@ tooltip.BloodMagic.currentType.destructive=Contains: Destructive Will
tooltip.BloodMagic.currentType.vengeful=Contains: Vengeful Will
tooltip.BloodMagic.currentType.steadfast=Contains: Steadfast Will

tooltip.BloodMagic.currentBaseType.default=Raw
tooltip.BloodMagic.currentBaseType.corrosive=Corrosive
tooltip.BloodMagic.currentBaseType.destructive=Destructive
tooltip.BloodMagic.currentBaseType.vengeful=Vengeful
tooltip.BloodMagic.currentBaseType.steadfast=Steadfast

tooltip.BloodMagic.experienceTome=A book used to store experience
tooltip.BloodMagic.experienceTome.exp=Exp: %0.3f
tooltip.BloodMagic.experienceTome.expLevel=Level: %d
Expand All @@ -412,13 +420,17 @@ tooltip.BloodMagic.cuttingFluidRatio=%d/%d uses remaining

tooltip.BloodMagic.book.shifting=These symbols seem to be... &oshifting...

tooltip.BloodMagic.willGauge=A strange device that can measure the Demon Will in the Aura.

# Ritual
ritual.BloodMagic.blockRange.tooBig=The block range given is too big! Needs to be at most %s blocks.
ritual.BloodMagic.blockRange.tooFar=The block range given is too far! Needs to be within a vertical range of %s blocks and a horizontal range of %s blocks.
ritual.BloodMagic.blockRange.inactive=The ritual stone is currently inactive, and cannot have its range modified.
ritual.BloodMagic.blockRange.noRange=The range was not properly chosen.
ritual.BloodMagic.blockRange.firstBlock=First block for new range stored.
ritual.BloodMagic.blockRange.success=New range successfully set!
ritual.BloodMagic.willConfig.set=The ritual will use these Demon Will types: %s
ritual.BloodMagic.willConfig.void=The ritual no longer uses Demon Will

ritual.BloodMagic.testRitual=Test Ritual
ritual.BloodMagic.waterRitual=Ritual of the Full Spring
Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 767b092

Please sign in to comment.