Skip to content

Commit

Permalink
Pet Fixes, Offhand Fix, Detonation, Mod Compat, Swiper Nerf, Addition…
Browse files Browse the repository at this point in the history
…al Protection Toggle

Transformer introduced (unfortunately) to fix a lot of issues
Compatibility for fishing mods in Advnced Lure and Advanced Luck of the Sea
Compatibility for looting in mods
Fix for offhand enchantments causing bugs
Option to prevent pets from using weapon enchantments
Fix for Adept adding experience to drops that normally give none
Swiper swipe no longer bypasses armor
Swiper swipe reduced range
Option to turn off extra protection effects
Bump gradle, transformer gradle
  • Loading branch information
Charles445 committed Nov 27, 2021
1 parent abbb177 commit d631227
Show file tree
Hide file tree
Showing 73 changed files with 2,351 additions and 230 deletions.
10 changes: 9 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ apply plugin: 'net.minecraftforge.gradle.forge'
//Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.


version = "0.5.2"
version = "0.5.3"
group = "com.Shultrea.Rin" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "SoManyEnchantments"

Expand Down Expand Up @@ -75,3 +75,11 @@ processResources {
exclude 'mcmod.info'
}
}

jar {
manifest
{
attributes "FMLCorePlugin": "com.Shultrea.Rin.Transformer.CoreLoader"
attributes "FMLCorePluginContainsFMLMod": "com.Shultrea.Rin.Main_Sector.somanyenchantments"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public float calcDamageByCreature(int level, EnumCreatureAttribute creatureType)
}

@Override
public void onEntityDamaged(EntityLivingBase user, Entity entiti, int level)
public void onEntityDamagedAlt(EntityLivingBase user, Entity entiti, ItemStack stack, int level)
{
if(entiti instanceof EntityLivingBase){
EntityLivingBase entity = (EntityLivingBase) entiti;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ public void onAxeAttackEfficiency(LivingHurtEvent fEvent)
if(EnchantmentHelper.getEnchantmentLevel(Smc_010.ExtremeEfficency, dmgSource) <= 0)
return;


if(this.isOffensivePetDisallowed(fEvent.getSource().getImmediateSource(), fEvent.getSource().getTrueSource()))
return;

int levelEE = EnchantmentHelper.getEnchantmentLevel(Smc_010.ExtremeEfficency, dmgSource);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public boolean canApply(ItemStack fTest)
return fTest.getItem() instanceof ItemAxe ? true : super.canApply(fTest);
}
@Override
public void onEntityDamaged(EntityLivingBase user, Entity entiti, int level)
public void onEntityDamagedAlt(EntityLivingBase user, Entity entiti, ItemStack stack, int level)
{
if(!(entiti instanceof EntityLivingBase))
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ public void HandleEnchant(LivingHurtEvent fEvent)
if(EnchantmentHelper.getEnchantmentLevel(Smc_010.BlessedEdge, dmgSource) <= 0)
return;

if(this.isOffensivePetDisallowed(fEvent.getSource().getImmediateSource(), fEvent.getSource().getTrueSource()))
return;

int levelBless = EnchantmentHelper.getEnchantmentLevel(Smc_010.BlessedEdge, dmgSource);

attacker.heal( fEvent.getAmount() * (levelBless * 0.03f));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ public void HandleEnchant(LivingHurtEvent fEvent)
if(EnchantmentHelper.getEnchantmentLevel(Smc_010.Butchering, dmgSource) <= 0)
return;

if(this.isOffensivePetDisallowed(fEvent.getSource().getImmediateSource(), fEvent.getSource().getTrueSource()))
return;

int levelButchering = EnchantmentHelper.getEnchantmentLevel(Smc_010.Butchering, dmgSource);
if(fEvent.getEntity() instanceof EntityAnimal)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ public void HandleEnchant(LivingDamageEvent fEvent)
if(EnchantmentHelper.getEnchantmentLevel(Smc_010.CursedEdge, dmgSource) <= 0)
return;

if(this.isOffensivePetDisallowed(fEvent.getSource().getImmediateSource(), fEvent.getSource().getTrueSource()))
return;

int levelCurse = EnchantmentHelper.getEnchantmentLevel(Smc_010.CursedEdge, dmgSource);

float Damage = fEvent.getAmount() * ((levelCurse * 0.20f) + 1.00f);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ public void HandleEnchant(LivingHurtEvent fEvent)
if(EnchantmentHelper.getEnchantmentLevel(Smc_010.Defusion, dmgSource) <= 0)
return;

if(this.isOffensivePetDisallowed(fEvent.getSource().getImmediateSource(), fEvent.getSource().getTrueSource()))
return;

int levelDefusing = EnchantmentHelper.getEnchantmentLevel(Smc_010.Defusion, dmgSource);
if(fEvent.getEntity() instanceof EntityCreeper)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public boolean canApplyTogether(Enchantment fTest)
}

@Override
public void onEntityDamaged(EntityLivingBase user, Entity target, int level)
public void onEntityDamagedAlt(EntityLivingBase user, Entity target, ItemStack stack, int level)
{
if(!(target instanceof EntityLivingBase))
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public int getMaxEnchantability(int par1)
}

@Override
public void onEntityDamaged (EntityLivingBase user, Entity target, int level) {
public void onEntityDamagedAlt(EntityLivingBase user, Entity target, ItemStack stack, int level) {

if(!(target instanceof EntityLivingBase))
return;
Expand All @@ -70,8 +70,7 @@ public void onEntityDamaged (EntityLivingBase user, Entity target, int level) {
return;

EntityLivingBase victim = (EntityLivingBase) target;
ItemStack item = user.getHeldItemMainhand();
int lvl = EnchantmentHelper.getEnchantmentLevel(Smc_010.Purification, item);
int lvl = EnchantmentHelper.getEnchantmentLevel(Smc_010.Purification, stack);

if(lvl <= 0)
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ public void HandleEnchant(LivingDamageEvent fEvent)

if(EnchantmentHelper.getEnchantmentLevel(Smc_010.ReviledBlade, weapon) > 0)
{
if(this.isOffensivePetDisallowed(fEvent.getSource().getImmediateSource(), fEvent.getSource().getTrueSource()))
return;

float defenderHealthPercent = fEvent.getEntityLiving().getHealth() / fEvent.getEntityLiving().getMaxHealth();
int levelfinish = EnchantmentHelper.getEnchantmentLevel(Smc_010.ReviledBlade, weapon);
float dmgMod = (1.0f - defenderHealthPercent) * ((levelfinish * 0.1f) + 0.9f);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ public void HandleEnchant(LivingHurtEvent fEvent)
if(pierceLevel <= 0)
return;

if(this.isOffensivePetDisallowed(fEvent.getSource().getImmediateSource(), fEvent.getSource().getTrueSource()))
return;

float damage = fEvent.getAmount() * 0.25f * pierceLevel;

fEvent.setAmount(fEvent.getAmount() - (fEvent.getAmount() * pierceLevel * 0.25f));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,10 @@ private int getLevel(ItemStack is, Enchantment enchantment) {


@Override
public void onEntityDamaged(EntityLivingBase user, Entity entiti, int level)
public void onEntityDamagedAlt(EntityLivingBase user, Entity entiti, ItemStack stack, int level)
{
if(level > 0)
user.getHeldItemMainhand().damageItem(1 + user.getRNG().nextInt(level * 2), user);
stack.damageItem(1 + user.getRNG().nextInt(level * 2), user);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ public void onHurt(LivingHurtEvent e) {
if(level <= 0)
return;

if(this.isOffensivePetDisallowed(e.getSource().getImmediateSource(), e.getSource().getTrueSource()))
return;

if(e.getEntityLiving().getActivePotionEffects().size() > 0)
e.setAmount(e.getAmount() + (0.625f * level) * e.getEntityLiving().getActivePotionEffects().size());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ public void HandleEnchant(LivingHurtEvent fEvent)
int level = EnchantmentHelper.getEnchantmentLevel(Smc_010.SwifterSlashes, weapon);
if(EnchantmentHelper.getEnchantmentLevel(Smc_010.SwifterSlashes, weapon) <= 0)
return;

if(this.isOffensivePetDisallowed(fEvent.getSource().getImmediateSource(), fEvent.getSource().getTrueSource()))
return;

if(fEvent.getEntityLiving().world.rand.nextInt(100) < 25 + (level * 4))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ public void HandleEnchant(LivingHurtEvent fEvent)
if(EnchantmentHelper.getEnchantmentLevel(Smc_010.WaterAspect, dmgSource) <= 0)
return;

if(this.isOffensivePetDisallowed(fEvent.getSource().getImmediateSource(), fEvent.getSource().getTrueSource()))
return;

int levelWaterAspect = EnchantmentHelper.getEnchantmentLevel(Smc_010.WaterAspect, dmgSource);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,10 @@ public int level(ItemStack stack) {


@Override
public void onEntityDamaged (EntityLivingBase user, Entity target, int level)
public void onEntityDamagedAlt(EntityLivingBase user, Entity target, ItemStack stack, int level)
{
if(target instanceof EntityLivingBase)
{
ItemStack stack = user.getHeldItemMainhand();
int levelknockBack = EnchantmentHelper.getEnchantmentLevel(Smc_020.AdvancedKnockback, stack);
int modKnockback = 1;
double Y = levelknockBack * 0.075D;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ public void HandleEnchant(LivingHurtEvent fEvent)
if(EnchantmentHelper.getEnchantmentLevel(Smc_020.Culling, dmgSource) <= 0)
return;

if(this.isOffensivePetDisallowed(fEvent.getSource().getImmediateSource(), fEvent.getSource().getTrueSource()))
return;

int level = EnchantmentHelper.getEnchantmentLevel(Smc_020.Culling, dmgSource);

float half = level;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ public void HandlingFirst(LivingHurtEvent fEvent)

if(EnchantmentHelper.getEnchantmentLevel(Smc_020.Lifesteal, weapon) <= 0)
return;


if(this.isOffensivePetDisallowed(fEvent.getSource().getImmediateSource(), fEvent.getSource().getTrueSource()))
return;

attacker.heal(fEvent.getAmount() * (levellifesteal * 0.025f + 0.025f));
UtilityAccessor.damageTarget(fEvent.getEntityLiving(), somanyenchantments.PhysicalDamage, fEvent.getAmount() * (0.05F + ((levellifesteal * 0.05F))));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ public void onDamage(LivingHurtEvent e){
if(level <= 0)
return;

if(this.isOffensivePetDisallowed(e.getSource().getImmediateSource(), e.getSource().getTrueSource()))
return;

if(!stack.hasTagCompound())
stack.setTagCompound(new NBTTagCompound());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ public void HandleEnchant(LivingHurtEvent fEvent)
if(!(fEvent.getEntity() instanceof EntityLivingBase))
return;

if(this.isOffensivePetDisallowed(fEvent.getSource().getImmediateSource(), fEvent.getSource().getTrueSource()))
return;

float ArmorDetector;

EntityLivingBase entity = (EntityLivingBase)fEvent.getEntity();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ public void HandleEnchant(LivingHurtEvent fEvent)
if(EnchantmentHelper.getEnchantmentLevel(this, stack) <= 0)
return;

if(this.isOffensivePetDisallowed(fEvent.getSource().getImmediateSource(), fEvent.getSource().getTrueSource()))
return;

if(EnchantmentHelper.getEnchantmentLevel(Smc_010.Rune_PiercingCapabilities, stack) != 0)
return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ public void HandleEnchant(LivingHurtEvent fEvent)
if(EnchantmentHelper.getEnchantmentLevel(Smc_020.Unpredictable, dmgSource) <= 0)
return;

if(this.isOffensivePetDisallowed(fEvent.getSource().getImmediateSource(), fEvent.getSource().getTrueSource()))
return;

int levelDamageRandomizer = EnchantmentHelper.getEnchantmentLevel(Smc_020.Unpredictable, dmgSource);
{
float random = (float) Math.random() * (fEvent.getAmount() * (levelDamageRandomizer * 1.25f));
Expand Down
Loading

0 comments on commit d631227

Please sign in to comment.