Updated Forge to 1813. Worked on the SentientArmour so that it is able to use the different will types depending on what is the highest.

This commit is contained in:
WayofTime 2016-03-29 09:22:25 -04:00
parent 4ea3e0ca92
commit 4a58fc5518
5 changed files with 217 additions and 64 deletions

View file

@ -1,5 +1,5 @@
# #
#Sat Mar 26 21:55:12 EDT 2016 #Tue Mar 29 09:15:42 EDT 2016
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
org.eclipse.jdt.core.formatter.brace_position_for_block=next_line org.eclipse.jdt.core.formatter.brace_position_for_block=next_line
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
@ -288,10 +288,10 @@ org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=next_line
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=next_line
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.formatter.blank_lines_after_package=1 org.eclipse.jdt.core.formatter.blank_lines_after_package=1
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16

View file

@ -2,7 +2,7 @@ mod_name=BloodMagic
package_group=com.wayoftime.bloodmagic package_group=com.wayoftime.bloodmagic
mod_version=2.0.0 mod_version=2.0.0
mc_version=1.9 mc_version=1.9
forge_version=12.16.0.1811-1.9 forge_version=12.16.0.1813-1.9
curse_id=224791 curse_id=224791
mappings_version=snapshot_20160321 mappings_version=snapshot_20160321

View file

@ -4,7 +4,6 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import WayofTime.bloodmagic.client.IMeshProvider;
import net.minecraft.client.renderer.ItemMeshDefinition; import net.minecraft.client.renderer.ItemMeshDefinition;
import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.Enchantment;
@ -19,19 +18,25 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.DamageSource; import net.minecraft.util.DamageSource;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.ISpecialArmor; import net.minecraftforge.common.ISpecialArmor;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import WayofTime.bloodmagic.BloodMagic; import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.api.Constants; import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.iface.IMultiWillTool;
import WayofTime.bloodmagic.api.soul.EnumDemonWillType; import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
import WayofTime.bloodmagic.api.soul.PlayerDemonWillHandler; import WayofTime.bloodmagic.api.soul.PlayerDemonWillHandler;
import WayofTime.bloodmagic.api.util.helper.NBTHelper; import WayofTime.bloodmagic.api.util.helper.NBTHelper;
import WayofTime.bloodmagic.client.IMeshProvider;
import WayofTime.bloodmagic.registry.ModItems; import WayofTime.bloodmagic.registry.ModItems;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class ItemSentientArmour extends ItemArmor implements ISpecialArmor, IMeshProvider public class ItemSentientArmour extends ItemArmor implements ISpecialArmor, IMeshProvider, IMultiWillTool
{ {
public static String[] names = { "helmet", "chest", "legs", "boots" }; public static String[] names = { "helmet", "chest", "legs", "boots" };
public static double[] willBracket = new double[] { 30, 200, 600, 1500, 4000, 6000, 8000, 16000 };
public static double[] consumptionPerHit = new double[] { 0.1, 0.12, 0.15, 0.2, 0.3, 0.35, 0.4, 0.5 };
public static double[] extraProtectionLevel = new double[] { 0, 0.25, 0.5, 0.6, 0.7, 0.75, 0.85, 0.9 };
public ItemSentientArmour(EntityEquipmentSlot armorType) public ItemSentientArmour(EntityEquipmentSlot armorType)
{ {
super(ItemArmor.ArmorMaterial.IRON, 0, armorType); super(ItemArmor.ArmorMaterial.IRON, 0, armorType);
@ -40,22 +45,43 @@ public class ItemSentientArmour extends ItemArmor implements ISpecialArmor, IMes
setCreativeTab(BloodMagic.tabBloodMagic); setCreativeTab(BloodMagic.tabBloodMagic);
} }
public EnumDemonWillType getDemonWillTypeConsumed(ItemStack stack)
{
return EnumDemonWillType.DEFAULT;
}
@Override @Override
public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type)
{ {
if (this == ModItems.sentientArmourChest || this == ModItems.sentientArmourHelmet || this == ModItems.sentientArmourBoots) if (this == ModItems.sentientArmourChest || this == ModItems.sentientArmourHelmet || this == ModItems.sentientArmourBoots)
{ {
switch (this.getCurrentType(stack))
{
case DEFAULT:
return "bloodmagic:models/armor/sentientArmour_layer_1.png";
case CORROSIVE:
return "bloodmagic:models/armor/sentientArmour_corrosive_layer_1.png";
case VENGEFUL:
return "bloodmagic:models/armor/sentientArmour_vengeful_layer_1.png";
case DESTRUCTIVE:
return "bloodmagic:models/armor/sentientArmour_destructive_layer_1.png";
case STEADFAST:
return "bloodmagic:models/armor/sentientArmour_steadfast_layer_1.png";
}
return "bloodmagic:models/armor/sentientArmour_layer_1.png"; return "bloodmagic:models/armor/sentientArmour_layer_1.png";
} }
if (this == ModItems.sentientArmourLegs) if (this == ModItems.sentientArmourLegs)
{ {
return "bloodmagic:models/armor/sentientArmour_layer_2.png"; switch (this.getCurrentType(stack))
{
case DEFAULT:
return "bloodmagic:models/armor/sentientArmour_layer_2.png";
case CORROSIVE:
return "bloodmagic:models/armor/sentientArmour_corrosive_layer_2.png";
case VENGEFUL:
return "bloodmagic:models/armor/sentientArmour_vengeful_layer_2.png";
case DESTRUCTIVE:
return "bloodmagic:models/armor/sentientArmour_destructive_layer_2.png";
case STEADFAST:
return "bloodmagic:models/armor/sentientArmour_steadfast_layer_2.png";
}
return "bloodmagic:models/armor/sentientArmour_layer_1.png";
} else } else
{ {
return null; return null;
@ -169,12 +195,13 @@ public class ItemSentientArmour extends ItemArmor implements ISpecialArmor, IMes
{ {
EntityPlayer player = (EntityPlayer) entity; EntityPlayer player = (EntityPlayer) entity;
EnumDemonWillType type = getDemonWillTypeConsumed(stack); EnumDemonWillType type = getCurrentType(stack);
double willRequired = this.getCostModifier(stack) * damage; double willRequired = this.getCostModifier(stack) * damage;
double willLeft = PlayerDemonWillHandler.getTotalDemonWill(type, player); double willLeft = PlayerDemonWillHandler.getTotalDemonWill(type, player);
if (willLeft >= willRequired) if (willLeft >= willRequired && canSustainArmour(type, willLeft))
{ {
this.setAbilitiesOfArmour(type, willLeft - willRequired, stack);
PlayerDemonWillHandler.consumeDemonWill(type, player, willRequired); PlayerDemonWillHandler.consumeDemonWill(type, player, willRequired);
} else } else
{ {
@ -218,14 +245,13 @@ public class ItemSentientArmour extends ItemArmor implements ISpecialArmor, IMes
@Override @Override
public String getUnlocalizedName(ItemStack stack) public String getUnlocalizedName(ItemStack stack)
{ {
return super.getUnlocalizedName(stack) + names[armorType.getIndex()]; return super.getUnlocalizedName(stack) + names[3 - armorType.getIndex()];
} }
public void revertArmour(EntityPlayer player, ItemStack itemStack) public void revertArmour(EntityPlayer player, ItemStack itemStack)
{ {
ItemStack stack = this.getContainedArmourStack(itemStack); ItemStack stack = this.getContainedArmourStack(itemStack);
player.setItemStackToSlot(armorType, stack); player.setItemStackToSlot(armorType, stack);
// player.inventory.armorInventory[3 - armorType.getIndex()] = stack;
} }
@Override @Override
@ -238,14 +264,16 @@ public class ItemSentientArmour extends ItemArmor implements ISpecialArmor, IMes
public ModelResourceLocation getModelLocation(ItemStack stack) public ModelResourceLocation getModelLocation(ItemStack stack)
{ {
assert getCustomLocation() != null; assert getCustomLocation() != null;
EnumDemonWillType type = ((ItemSentientArmour) ModItems.sentientArmourHelmet).getCurrentType(stack);
String additional = "_" + type.getName().toLowerCase();
if (stack.getItem() == ModItems.sentientArmourHelmet) if (stack.getItem() == ModItems.sentientArmourHelmet)
return new ModelResourceLocation(getCustomLocation(), "armour=head"); return new ModelResourceLocation(getCustomLocation(), "armour=head" + additional);
else if (stack.getItem() == ModItems.sentientArmourChest) else if (stack.getItem() == ModItems.sentientArmourChest)
return new ModelResourceLocation(getCustomLocation(), "armour=body"); return new ModelResourceLocation(getCustomLocation(), "armour=body" + additional);
else if (stack.getItem() == ModItems.sentientArmourLegs) else if (stack.getItem() == ModItems.sentientArmourLegs)
return new ModelResourceLocation(getCustomLocation(), "armour=leg"); return new ModelResourceLocation(getCustomLocation(), "armour=leg" + additional);
else else
return new ModelResourceLocation(getCustomLocation(), "armour=feet"); return new ModelResourceLocation(getCustomLocation(), "armour=feet" + additional);
} }
}; };
} }
@ -260,10 +288,16 @@ public class ItemSentientArmour extends ItemArmor implements ISpecialArmor, IMes
public List<String> getVariants() public List<String> getVariants()
{ {
List<String> ret = new ArrayList<String>(); List<String> ret = new ArrayList<String>();
ret.add("armour=head"); for (EnumDemonWillType type : EnumDemonWillType.values())
ret.add("armour=body"); {
ret.add("armour=leg"); String additional = "_" + type.getName().toLowerCase();
ret.add("armour=feet");
ret.add("armour=head" + additional);
ret.add("armour=body" + additional);
ret.add("armour=leg" + additional);
ret.add("armour=feet" + additional);
}
return ret; return ret;
} }
@ -315,18 +349,23 @@ public class ItemSentientArmour extends ItemArmor implements ISpecialArmor, IMes
return armourStack; return armourStack;
} }
public static boolean convertPlayerArmour(EntityPlayer player, double recurringCost, double protection) public static boolean convertPlayerArmour(EnumDemonWillType type, double will, EntityPlayer player)
{ {
if (!canSustainArmour(type, will))
{
return false;
}
ItemStack helmetStack = player.getItemStackFromSlot(EntityEquipmentSlot.HEAD); ItemStack helmetStack = player.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST); ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
ItemStack leggingsStack = player.getItemStackFromSlot(EntityEquipmentSlot.LEGS); ItemStack leggingsStack = player.getItemStackFromSlot(EntityEquipmentSlot.LEGS);
ItemStack bootsStack = player.getItemStackFromSlot(EntityEquipmentSlot.FEET); ItemStack bootsStack = player.getItemStackFromSlot(EntityEquipmentSlot.FEET);
{ {
ItemStack omegaHelmetStack = ((ItemSentientArmour) ModItems.sentientArmourHelmet).getSubstituteStack(helmetStack, recurringCost, protection); ItemStack omegaHelmetStack = ((ItemSentientArmour) ModItems.sentientArmourHelmet).getSubstituteStack(type, will, helmetStack);
ItemStack omegaChestStack = ((ItemSentientArmour) ModItems.sentientArmourChest).getSubstituteStack(chestStack, recurringCost, protection); ItemStack omegaChestStack = ((ItemSentientArmour) ModItems.sentientArmourChest).getSubstituteStack(type, will, chestStack);
ItemStack omegaLeggingsStack = ((ItemSentientArmour) ModItems.sentientArmourLegs).getSubstituteStack(leggingsStack, recurringCost, protection); ItemStack omegaLeggingsStack = ((ItemSentientArmour) ModItems.sentientArmourLegs).getSubstituteStack(type, will, leggingsStack);
ItemStack omegaBootsStack = ((ItemSentientArmour) ModItems.sentientArmourBoots).getSubstituteStack(bootsStack, recurringCost, protection); ItemStack omegaBootsStack = ((ItemSentientArmour) ModItems.sentientArmourBoots).getSubstituteStack(type, will, bootsStack);
player.setItemStackToSlot(EntityEquipmentSlot.HEAD, omegaHelmetStack); player.setItemStackToSlot(EntityEquipmentSlot.HEAD, omegaHelmetStack);
player.setItemStackToSlot(EntityEquipmentSlot.CHEST, omegaChestStack); player.setItemStackToSlot(EntityEquipmentSlot.CHEST, omegaChestStack);
@ -337,14 +376,71 @@ public class ItemSentientArmour extends ItemArmor implements ISpecialArmor, IMes
} }
} }
public ItemStack getSubstituteStack(ItemStack previousArmour, double recurringCost, double protection) public ItemStack getSubstituteStack(EnumDemonWillType type, double will, ItemStack previousArmour)
{ {
ItemStack newArmour = new ItemStack(this); ItemStack newArmour = new ItemStack(this);
this.setContainedArmourStack(newArmour, previousArmour); this.setContainedArmourStack(newArmour, previousArmour);
this.setCostModifier(newArmour, recurringCost); this.setAbilitiesOfArmour(type, will, newArmour);
this.setArmourModifier(newArmour, protection);
return newArmour; return newArmour;
} }
@Override
public EnumDemonWillType getCurrentType(ItemStack stack)
{
NBTHelper.checkNBT(stack);
NBTTagCompound tag = stack.getTagCompound();
if (!tag.hasKey(Constants.NBT.WILL_TYPE))
{
return EnumDemonWillType.DEFAULT;
}
return EnumDemonWillType.valueOf(tag.getString(Constants.NBT.WILL_TYPE));
}
public void setCurrentType(EnumDemonWillType type, ItemStack stack)
{
NBTHelper.checkNBT(stack);
NBTTagCompound tag = stack.getTagCompound();
tag.setString(Constants.NBT.WILL_TYPE, type.toString());
}
public void setAbilitiesOfArmour(EnumDemonWillType type, double willValue, ItemStack armourStack)
{
int willBracket = getWillBracket(willValue);
if (willBracket >= 0)
{
double recurringCost = consumptionPerHit[willBracket];
double protection = extraProtectionLevel[willBracket];
this.setCostModifier(armourStack, recurringCost);
this.setArmourModifier(armourStack, protection);
this.setCurrentType(type, armourStack);
}
}
public static boolean canSustainArmour(EnumDemonWillType type, double willValue)
{
return getWillBracket(willValue) >= 0;
}
public static int getWillBracket(double will)
{
int bracket = -1;
for (int i = 0; i < willBracket.length; i++)
{
if (will >= willBracket[i])
{
bracket = i;
}
}
return bracket;
}
} }

View file

@ -18,10 +18,6 @@ import WayofTime.bloodmagic.item.armour.ItemSentientArmour;
public class ItemSentientArmourGem extends Item public class ItemSentientArmourGem extends Item
{ {
public static double[] willBracket = new double[] { 30, 200, 600, 1500, 4000, 6000, 8000, 16000 };
public static double[] consumptionPerHit = new double[] { 0.1, 0.12, 0.15, 0.2, 0.3, 0.35, 0.4, 0.5 };
public static double[] extraProtectionLevel = new double[] { 0, 0.25, 0.5, 0.6, 0.7, 0.75, 0.85, 0.9 };
public ItemSentientArmourGem() public ItemSentientArmourGem()
{ {
super(); super();
@ -55,35 +51,16 @@ public class ItemSentientArmourGem extends Item
ItemSentientArmour.revertAllArmour(player); ItemSentientArmour.revertAllArmour(player);
} else } else
{ {
double will = PlayerDemonWillHandler.getTotalDemonWill(getCurrentType(stack), player); EnumDemonWillType type = PlayerDemonWillHandler.getLargestWillType(player);
double will = PlayerDemonWillHandler.getTotalDemonWill(type, player);
int bracket = getWillBracket(will);
if (bracket >= 0)
{
// PlayerDemonWillHandler.consumeDemonWill(player, willBracket[bracket]); // PlayerDemonWillHandler.consumeDemonWill(player, willBracket[bracket]);
ItemSentientArmour.convertPlayerArmour(player, consumptionPerHit[bracket], extraProtectionLevel[bracket]); ItemSentientArmour.convertPlayerArmour(type, will, player);
}
} }
return new ActionResult<ItemStack>(EnumActionResult.PASS, stack); return new ActionResult<ItemStack>(EnumActionResult.PASS, stack);
} }
public int getWillBracket(double will)
{
int bracket = -1;
for (int i = 0; i < willBracket.length; i++)
{
if (will >= willBracket[i])
{
bracket = i;
}
}
return bracket;
}
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining)
{ {

View file

@ -6,25 +6,105 @@
}, },
"variants": { "variants": {
"armour": { "armour": {
"head": { "head_default": {
"textures": { "textures": {
"layer0": "bloodmagic:items/SentientHelmet" "layer0": "bloodmagic:items/SentientHelmet"
} }
}, },
"body": { "body_default": {
"textures": { "textures": {
"layer0": "bloodmagic:items/SentientPlate" "layer0": "bloodmagic:items/SentientPlate"
} }
}, },
"leg": { "leg_default": {
"textures": { "textures": {
"layer0": "bloodmagic:items/SentientLeggings" "layer0": "bloodmagic:items/SentientLeggings"
} }
}, },
"feet": { "feet_default": {
"textures": { "textures": {
"layer0": "bloodmagic:items/SentientBoots" "layer0": "bloodmagic:items/SentientBoots"
} }
},
"head_corrosive": {
"textures": {
"layer0": "bloodmagic:items/SentientHelmet_corrosive"
}
},
"body_corrosive": {
"textures": {
"layer0": "bloodmagic:items/SentientPlate_corrosive"
}
},
"leg_corrosive": {
"textures": {
"layer0": "bloodmagic:items/SentientLeggings_corrosive"
}
},
"feet_corrosive": {
"textures": {
"layer0": "bloodmagic:items/SentientBoots_corrosive"
}
},
"head_vengeful": {
"textures": {
"layer0": "bloodmagic:items/SentientHelmet_vengeful"
}
},
"body_vengeful": {
"textures": {
"layer0": "bloodmagic:items/SentientPlate_vengeful"
}
},
"leg_vengeful": {
"textures": {
"layer0": "bloodmagic:items/SentientLeggings_vengeful"
}
},
"feet_vengeful": {
"textures": {
"layer0": "bloodmagic:items/SentientBoots_vengeful"
}
},
"head_destructive": {
"textures": {
"layer0": "bloodmagic:items/SentientHelmet_destructive"
}
},
"body_destructive": {
"textures": {
"layer0": "bloodmagic:items/SentientPlate_destructive"
}
},
"leg_destructive": {
"textures": {
"layer0": "bloodmagic:items/SentientLeggings_destructive"
}
},
"feet_destructive": {
"textures": {
"layer0": "bloodmagic:items/SentientBoots_destructive"
}
},
"head_steadfast": {
"textures": {
"layer0": "bloodmagic:items/SentientHelmet_steadfast"
}
},
"body_steadfast": {
"textures": {
"layer0": "bloodmagic:items/SentientPlate_steadfast"
}
},
"leg_steadfast": {
"textures": {
"layer0": "bloodmagic:items/SentientLeggings_steadfast"
}
},
"feet_steadfast": {
"textures": {
"layer0": "bloodmagic:items/SentientBoots_steadfast"
}
} }
} }
} }