-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
43 additions
and
38 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
...a/com/majruszs_difficulty/features/end_items/when_damaged/EndToolsLevitationOnAttack.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.majruszs_difficulty.features.end_items.when_damaged; | ||
|
||
import com.majruszs_difficulty.GameState; | ||
import com.majruszs_difficulty.features.end_items.EndItems; | ||
import com.majruszs_difficulty.features.when_damaged.WhenDamagedApplyStackableEffectBase; | ||
import com.mlib.TimeConverter; | ||
import net.minecraft.entity.LivingEntity; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.potion.Effects; | ||
import net.minecraft.util.DamageSource; | ||
import net.minecraft.world.Difficulty; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
/** Makes certain End Tools have a chance to apply Levitation. */ | ||
public class EndToolsLevitationOnAttack extends WhenDamagedApplyStackableEffectBase { | ||
private static final String CONFIG_NAME = "EndToolsLevitation"; | ||
private static final String CONFIG_COMMENT = "Makes End Pickaxe and End Shovel have a chance to inflict Levitation effect."; | ||
|
||
public EndToolsLevitationOnAttack() { | ||
super( CONFIG_NAME, CONFIG_COMMENT, 0.75, 4.0, GameState.State.NORMAL, false, Effects.LEVITATION, false, true, 0, | ||
TimeConverter.secondsToTicks( 60.0 ) | ||
); | ||
} | ||
|
||
/** Checking if all conditions were met. */ | ||
@Override | ||
public boolean shouldBeExecuted( @Nullable LivingEntity attacker, LivingEntity target, DamageSource damageSource ) { | ||
if( attacker != null ) { | ||
ItemStack heldItemStack = attacker.getHeldItemMainhand(); | ||
return !attacker.isSneaking() && EndItems.canInflictLevitation( heldItemStack.getItem() ) && super.shouldBeExecuted( attacker, target, | ||
damageSource | ||
); | ||
} | ||
|
||
return false; | ||
} | ||
|
||
@Override | ||
protected int getAmplifier( Difficulty difficulty ) { | ||
return 0; | ||
} | ||
} |
38 changes: 0 additions & 38 deletions
38
src/main/java/com/majruszs_difficulty/features/when_damaged/EndSwordLevitationOnAttack.java
This file was deleted.
Oops, something went wrong.