Skip to content

Commit

Permalink
Certain End Tools now also has an increased chance to inflict Bleeding
Browse files Browse the repository at this point in the history
  • Loading branch information
Majrusz committed Jul 18, 2021
1 parent 58b35b7 commit a030ebb
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/java/com/majruszs_difficulty/Instances.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import com.majruszs_difficulty.effects.InfestedEffect;
import com.majruszs_difficulty.entities.EntitiesConfig;
import com.majruszs_difficulty.features.ExperienceBonus;
import com.majruszs_difficulty.features.end_items.when_damaged.EndToolsBleedingOnHurt;
import com.majruszs_difficulty.features.end_items.when_damaged.EndToolsLevitationOnAttack;
import com.majruszs_difficulty.features.on_death.SpawnParasitesOnDeath;
import com.majruszs_difficulty.features.treasure_bag.FishingRewarder;
import com.majruszs_difficulty.features.IncreaseGameDifficulty;
Expand All @@ -26,7 +28,6 @@
import com.majruszs_difficulty.generation.structures.FlyingEndIslandStructure;
import com.majruszs_difficulty.generation.structures.FlyingPhantomStructure;
import com.majruszs_difficulty.triggers.*;
import javafx.beans.binding.When;
import net.minecraft.advancements.CriteriaTriggers;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.SwordItem;
Expand Down Expand Up @@ -213,7 +214,6 @@ public class Instances {
WhenDamagedEvent.REGISTRY_LIST.add( new ThrownTridentBleedingOnHurt() );
WhenDamagedEvent.REGISTRY_LIST.add( new BiteBleedingOnAttack() );
WhenDamagedEvent.REGISTRY_LIST.add( new EndermanTeleportOnAttack() );
WhenDamagedEvent.REGISTRY_LIST.add( new EndSwordLevitationOnAttack() );
WhenDamagedEvent.REGISTRY_LIST.add( new TriggerAllEndermansOnAttack() );
WhenDamagedEvent.REGISTRY_LIST.add( new ShulkerBlindnessOnAttack() );
WhenDamagedEvent.REGISTRY_LIST.add( new NauseaAndSlownessWhenFalling() );
Expand All @@ -222,6 +222,8 @@ public class Instances {
WhenDamagedEvent.REGISTRY_LIST.add( new SlimeSlownessOnAttack() );
WhenDamagedEvent.REGISTRY_LIST.add( new ParasiteInfestOnAttack() );
WhenDamagedEvent.REGISTRY_LIST.add( new ParasiteDodgeOnHurt() );
WhenDamagedEvent.REGISTRY_LIST.add( new EndToolsLevitationOnAttack() );
WhenDamagedEvent.REGISTRY_LIST.add( new EndToolsBleedingOnHurt() );

// On enemy to be spawned
OnEnemyToBeSpawnedEvent.REGISTRY_LIST.add( new StrengthenedEntityAttributesOnSpawn() );
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.majruszs_difficulty.features.end_items.when_damaged;

import com.majruszs_difficulty.features.end_items.EndItems;
import com.majruszs_difficulty.features.when_damaged.WhenDamagedApplyBleedingBase;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.DamageSource;

import javax.annotation.Nullable;

/** Makes certain End Tools have an extra chance to inflict Bleeding effect. */
public class EndToolsBleedingOnHurt extends WhenDamagedApplyBleedingBase {
private static final String CONFIG_NAME = "EndToolsBleeding";
private static final String CONFIG_COMMENT = "End Axe, End Sword and End Hoe have a greater chance to inflict Bleeding.";

public EndToolsBleedingOnHurt() {
super( CONFIG_NAME, CONFIG_COMMENT, 0.5, 24.0 );
}

/** Checking if all conditions were met. */
@Override
public boolean shouldBeExecuted( @Nullable LivingEntity attacker, LivingEntity target, DamageSource damageSource ) {
return attacker != null && EndItems.haveExtraBleedingChance( attacker.getHeldItemMainhand()
.getItem() ) && super.shouldBeExecuted( attacker, target, damageSource );
}
}

0 comments on commit a030ebb

Please sign in to comment.