Skip to content

Commit 98f905b

Browse files
committed
Scorpion weapon tweaks
Fire Aspect and Poisonous (Fish's Undead Rising) will now boost the amount of seconds applied by earth and fire scorpion weapons.
1 parent 42ed354 commit 98f905b

File tree

5 files changed

+36
-15
lines changed

5 files changed

+36
-15
lines changed

src/main/java/drzhark/mocreatures/item/MoCItemArmor.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
package drzhark.mocreatures.item;
55

66
import drzhark.mocreatures.MoCConstants;
7-
import drzhark.mocreatures.MoCTools;
87
import drzhark.mocreatures.MoCreatures;
98
import drzhark.mocreatures.init.MoCItems;
109
import net.minecraft.client.util.ITooltipFlag;

src/main/java/drzhark/mocreatures/item/MoCItemAxe.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
import drzhark.mocreatures.MoCreatures;
88
import net.minecraft.client.resources.I18n;
99
import net.minecraft.client.util.ITooltipFlag;
10+
import net.minecraft.enchantment.Enchantment;
11+
import net.minecraft.enchantment.EnchantmentHelper;
1012
import net.minecraft.entity.EntityLivingBase;
1113
import net.minecraft.entity.player.EntityPlayer;
1214
import net.minecraft.init.MobEffects;
@@ -46,15 +48,18 @@ public MoCItemAxe(String name, Item.ToolMaterial material, float damage, float s
4648
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) {
4749
if (MoCreatures.proxy.weaponEffects) {
4850
int timer = 10; // In seconds
51+
int fire_aspect = 5 * EnchantmentHelper.getFireAspectModifier(attacker); // Fire Aspect
52+
int poisonous = 5 * EnchantmentHelper.getEnchantmentLevel(Enchantment.getEnchantmentByLocation("mod_lavacow:poisonous"), attacker.getHeldItem(attacker.getActiveHand())); // Poisonous (Fish's Undead Rising)
53+
4954
switch (this.specialWeaponType) {
5055
case 1: // Poison 2
51-
target.addPotionEffect(new PotionEffect(MobEffects.POISON, timer * 20, 1));
56+
target.addPotionEffect(new PotionEffect(MobEffects.POISON, (timer * 20) + poisonous, 1));
5257
break;
5358
case 2: // Slowness
5459
target.addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, timer * 20, 0));
5560
break;
5661
case 3: // Fire
57-
target.setFire(timer);
62+
target.setFire(timer + fire_aspect);
5863
break;
5964
case 4: // Weakness (Nausea for players)
6065
target.addPotionEffect(new PotionEffect(target instanceof EntityPlayer ? MobEffects.NAUSEA : MobEffects.WEAKNESS, timer * 20, 0));

src/main/java/drzhark/mocreatures/item/MoCItemMattock.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
import net.minecraft.block.state.IBlockState;
1010
import net.minecraft.client.resources.I18n;
1111
import net.minecraft.client.util.ITooltipFlag;
12+
import net.minecraft.enchantment.Enchantment;
13+
import net.minecraft.enchantment.EnchantmentHelper;
1214
import net.minecraft.entity.EntityLivingBase;
1315
import net.minecraft.entity.player.EntityPlayer;
1416
import net.minecraft.init.Blocks;
@@ -69,7 +71,8 @@ public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos p
6971
}
7072
}
7173

72-
if (!player.isSneaking()) return Items.IRON_SHOVEL.onItemUse(player, worldIn, pos, hand, facing, hitX, hitY, hitZ);
74+
if (!player.isSneaking())
75+
return Items.IRON_SHOVEL.onItemUse(player, worldIn, pos, hand, facing, hitX, hitY, hitZ);
7376
return Items.IRON_HOE.onItemUse(player, worldIn, pos, hand, facing, hitX, hitY, hitZ);
7477
}
7578

@@ -91,15 +94,18 @@ public Set<String> getToolClasses(ItemStack stack) {
9194
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) {
9295
if (MoCreatures.proxy.weaponEffects) {
9396
int timer = 10; // In seconds
97+
int fire_aspect = 5 * EnchantmentHelper.getFireAspectModifier(attacker); // Fire Aspect
98+
int poisonous = 5 * EnchantmentHelper.getEnchantmentLevel(Enchantment.getEnchantmentByLocation("mod_lavacow:poisonous"), attacker.getHeldItem(attacker.getActiveHand())); // Poisonous (Fish's Undead Rising)
99+
94100
switch (this.specialWeaponType) {
95101
case 1: // Poison 2
96-
target.addPotionEffect(new PotionEffect(MobEffects.POISON, timer * 20, 1));
102+
target.addPotionEffect(new PotionEffect(MobEffects.POISON, (timer * 20) + poisonous, 1));
97103
break;
98104
case 2: // Slowness
99105
target.addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, timer * 20, 0));
100106
break;
101107
case 3: // Fire
102-
target.setFire(timer);
108+
target.setFire(timer + fire_aspect);
103109
break;
104110
case 4: // Weakness (Nausea for players)
105111
target.addPotionEffect(new PotionEffect(target instanceof EntityPlayer ? MobEffects.NAUSEA : MobEffects.WEAKNESS, timer * 20, 0));

src/main/java/drzhark/mocreatures/item/MoCItemSword.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
import drzhark.mocreatures.MoCreatures;
88
import net.minecraft.client.resources.I18n;
99
import net.minecraft.client.util.ITooltipFlag;
10+
import net.minecraft.enchantment.Enchantment;
11+
import net.minecraft.enchantment.EnchantmentHelper;
1012
import net.minecraft.entity.EntityLivingBase;
1113
import net.minecraft.entity.player.EntityPlayer;
1214
import net.minecraft.init.MobEffects;
@@ -46,15 +48,18 @@ public MoCItemSword(String name, Item.ToolMaterial material, int damageType) {
4648
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) {
4749
if (MoCreatures.proxy.weaponEffects) {
4850
int timer = 8; // In seconds
51+
int fire_aspect = 4 * EnchantmentHelper.getFireAspectModifier(attacker); // Fire Aspect
52+
int poisonous = 4 * EnchantmentHelper.getEnchantmentLevel(Enchantment.getEnchantmentByLocation("mod_lavacow:poisonous"), attacker.getHeldItem(attacker.getActiveHand())); // Poisonous (Fish's Undead Rising)
53+
4954
switch (this.specialWeaponType) {
5055
case 1: // Poison 2
51-
target.addPotionEffect(new PotionEffect(MobEffects.POISON, timer * 20, 1));
56+
target.addPotionEffect(new PotionEffect(MobEffects.POISON, (timer * 20) + poisonous, 1));
5257
break;
5358
case 2: // Slowness
5459
target.addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, timer * 20, 0));
5560
break;
5661
case 3: // Fire
57-
target.setFire(timer);
62+
target.setFire(timer + fire_aspect);
5863
break;
5964
case 4: // Weakness (Nausea for players)
6065
target.addPotionEffect(new PotionEffect(target instanceof EntityPlayer ? MobEffects.NAUSEA : MobEffects.WEAKNESS, timer * 20, 0));

src/main/java/drzhark/mocreatures/item/MoCItemWeapon.java

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
import net.minecraft.block.state.IBlockState;
1313
import net.minecraft.client.resources.I18n;
1414
import net.minecraft.client.util.ITooltipFlag;
15+
import net.minecraft.enchantment.Enchantment;
16+
import net.minecraft.enchantment.EnchantmentHelper;
1517
import net.minecraft.entity.EntityLiving;
1618
import net.minecraft.entity.EntityLivingBase;
1719
import net.minecraft.entity.SharedMonsterAttributes;
@@ -41,12 +43,12 @@ public class MoCItemWeapon extends MoCItem {
4143
private final float attackDamage;
4244
private int specialWeaponType = 0;
4345

44-
public MoCItemWeapon(String name, Item.ToolMaterial par2ToolMaterial) {
46+
public MoCItemWeapon(String name, Item.ToolMaterial material) {
4547
super(name);
46-
this.material = par2ToolMaterial;
48+
this.material = material;
4749
this.maxStackSize = 1;
48-
this.setMaxDamage(par2ToolMaterial.getMaxUses());
49-
this.attackDamage = 3F + par2ToolMaterial.getAttackDamage();
50+
this.setMaxDamage(material.getMaxUses());
51+
this.attackDamage = 3F + material.getAttackDamage();
5052
}
5153

5254
public MoCItemWeapon(String name, ToolMaterial par2ToolMaterial, int damageType) {
@@ -71,15 +73,18 @@ public float getStrVsBlock(ItemStack stack, IBlockState state) {
7173
public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) {
7274
if (MoCreatures.proxy.weaponEffects) {
7375
int timer = 15; // In seconds
76+
int fire_aspect = 5 * EnchantmentHelper.getFireAspectModifier(attacker); // Fire Aspect
77+
int poisonous = 5 * EnchantmentHelper.getEnchantmentLevel(Enchantment.getEnchantmentByLocation("mod_lavacow:poisonous"), attacker.getHeldItem(attacker.getActiveHand())); // Poisonous (Fish's Undead Rising)
78+
7479
switch (this.specialWeaponType) {
7580
case 1: // Poison 2
76-
target.addPotionEffect(new PotionEffect(MobEffects.POISON, timer * 20, 1));
81+
target.addPotionEffect(new PotionEffect(MobEffects.POISON, (timer * 20) + poisonous, 1));
7782
break;
7883
case 2: // Slowness
7984
target.addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, timer * 20, 0));
8085
break;
8186
case 3: // Fire
82-
target.setFire(timer);
87+
target.setFire(timer + fire_aspect);
8388
break;
8489
case 4: // Weakness (Nausea for players)
8590
target.addPotionEffect(new PotionEffect(target instanceof EntityPlayer ? MobEffects.NAUSEA : MobEffects.WEAKNESS, timer * 20, 0));
@@ -164,6 +169,7 @@ public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) {
164169
*/
165170
public Multimap<String, AttributeModifier> getItemAttributeModifiers(EntityEquipmentSlot equipmentSlot) {
166171
Multimap<String, AttributeModifier> multimap = super.getItemAttributeModifiers(equipmentSlot);
172+
167173
if (equipmentSlot == EntityEquipmentSlot.MAINHAND) {
168174
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", this.attackDamage, 0));
169175
}
@@ -172,7 +178,7 @@ public Multimap<String, AttributeModifier> getItemAttributeModifiers(EntityEquip
172178

173179
@Override
174180
@SideOnly(Side.CLIENT)
175-
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
181+
public void addInformation(ItemStack stack, @Nullable World world, List<String> tooltip, ITooltipFlag flagIn) {
176182
if (MoCreatures.proxy.weaponEffects) {
177183
switch (this.specialWeaponType) {
178184
case 1: // Poison 2

0 commit comments

Comments
 (0)