Added the necessary infrastructure for Rituals to use Demon Will from the Aura.

Added the Demon Will Gauge.
This commit is contained in:
WayofTime 2016-07-10 21:51:17 -04:00
parent 12094c1153
commit 767b09221c
16 changed files with 189 additions and 27 deletions

View file

@ -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
------------------------------------------------------

View file

@ -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

View file

@ -238,7 +238,8 @@ public class Constants
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;

View file

@ -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();
}

View file

@ -26,7 +26,7 @@ import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
*/
@Getter
@RequiredArgsConstructor
@EqualsAndHashCode(exclude = { "modableRangeMap", "ritualComponents", "renderer" })
@EqualsAndHashCode(exclude = { "modableRangeMap", "ritualComponents", "renderer", "volumeRangeMap", "horizontalRangeMap", "verticalRangeMap" })
@ToString
public abstract class Ritual
{
@ -231,7 +231,7 @@ public abstract class Ritual
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);

View file

@ -16,6 +16,7 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent;
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
{
@ -37,20 +38,12 @@ public class HUDElementDemonWillAura extends HUDElement
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();
@ -58,9 +51,7 @@ public class HUDElementDemonWillAura extends HUDElement
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())
{

View file

@ -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;
}
}

View file

@ -27,6 +27,8 @@ import org.lwjgl.input.Keyboard;
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;
@ -119,6 +121,28 @@ public class ItemRitualReader extends Item implements IVariantProvider
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;
}

View file

@ -41,7 +41,13 @@ public class DemonAuraPacketProcessor implements IMessage, IMessageHandler<Demon
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);
}
}
}

View file

@ -29,6 +29,7 @@ import WayofTime.bloodmagic.item.ItemBoundSword;
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;
@ -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);
@ -273,6 +276,8 @@ public class ModItems
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)

View file

@ -303,6 +303,7 @@ public class ModRecipes
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()

View file

@ -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()
{
@ -99,6 +101,14 @@ public class TileMasterRitualStone extends TileEntity implements IMasterRitualSt
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
@ -118,6 +128,12 @@ public class TileMasterRitualStone extends TileEntity implements IMasterRitualSt
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;
}
@ -344,8 +360,7 @@ public class TileMasterRitualStone extends TileEntity implements IMasterRitualSt
@Override
public void setActiveWillConfig(EntityPlayer player, List<EnumDemonWillType> typeList)
{
// TODO Auto-generated method stub
this.currentActiveWillConfig = typeList;
}
@Override
@ -374,8 +389,34 @@ public class TileMasterRitualStone extends TileEntity implements IMasterRitualSt
}
@Override
public List<EnumDemonWillType> getCurrentActiveWillConfig()
public List<EnumDemonWillType> getActiveWillConfig()
{
return new ArrayList<EnumDemonWillType>();
return new ArrayList<EnumDemonWillType>(currentActiveWillConfig);
}
@Override
public void provideInformationOfWillConfigToPlayer(EntityPlayer player, List<EnumDemonWillType> typeList)
{
//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"));
}
}
}

View file

@ -0,0 +1,16 @@
{
"forge_marker": 1,
"defaults": {
"model": "builtin/generated",
"transform": "forge:default-item"
},
"variants": {
"type": {
"willgauge": {
"textures": {
"layer0": "bloodmagic:items/DemonWillGauge"
}
}
}
}
}

View file

@ -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
@ -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
@ -412,6 +420,8 @@ 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.
@ -419,6 +429,8 @@ ritual.BloodMagic.blockRange.inactive=The ritual stone is currently inactive, an
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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 740 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 779 B