-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enderite Pickaxe breaks bedrock Enderite Armor gives creative flight status effect
- Loading branch information
1 parent
174c516
commit 858cd3e
Showing
22 changed files
with
407 additions
and
28 deletions.
There are no files selected for viewing
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
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
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
19 changes: 19 additions & 0 deletions
19
src/main/java/jiraiyah/allthatmatters/effect/ModEffects.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,19 @@ | ||
package jiraiyah.allthatmatters.effect; | ||
|
||
import jiraiyah.allthatmatters.AllThatMatters; | ||
import jiraiyah.allthatmatters.effect.custom.FlightEffect; | ||
import net.minecraft.entity.effect.StatusEffect; | ||
import net.minecraft.entity.effect.StatusEffectCategory; | ||
import net.minecraft.registry.Registries; | ||
import net.minecraft.registry.Registry; | ||
|
||
public class ModEffects | ||
{ | ||
public static StatusEffect FLIGHT_EFFECT = Registry.register(Registries.STATUS_EFFECT, AllThatMatters.identifier("flight"), | ||
new FlightEffect(StatusEffectCategory.BENEFICIAL, 0xFFFFFF)); | ||
|
||
public static void register() | ||
{ | ||
AllThatMatters.LOGGER.info(">>> Registering Effects"); | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
src/main/java/jiraiyah/allthatmatters/effect/custom/FlightEffect.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,46 @@ | ||
package jiraiyah.allthatmatters.effect.custom; | ||
|
||
import io.github.ladysnake.pal.AbilitySource; | ||
import io.github.ladysnake.pal.Pal; | ||
import io.github.ladysnake.pal.VanillaAbilities; | ||
import jiraiyah.allthatmatters.AllThatMatters; | ||
import net.minecraft.entity.LivingEntity; | ||
import net.minecraft.entity.attribute.AttributeContainer; | ||
import net.minecraft.entity.effect.StatusEffect; | ||
import net.minecraft.entity.effect.StatusEffectCategory; | ||
import net.minecraft.server.network.ServerPlayerEntity; | ||
|
||
public class FlightEffect extends StatusEffect | ||
{ | ||
public static final AbilitySource FLIGHT_POTION = Pal.getAbilitySource(AllThatMatters.identifier("potion_flight")); | ||
|
||
private ServerPlayerEntity entity; | ||
|
||
public FlightEffect(StatusEffectCategory category, int color) | ||
{ | ||
super(category, color); | ||
} | ||
|
||
@Override | ||
public void onApplied(LivingEntity entity, int amplifier) | ||
{ | ||
super.onApplied(entity, amplifier); | ||
if(entity instanceof ServerPlayerEntity sp) | ||
{ | ||
Pal.grantAbility(sp, VanillaAbilities.ALLOW_FLYING, FLIGHT_POTION); | ||
Pal.grantAbility(sp, VanillaAbilities.FLYING, FLIGHT_POTION); | ||
this.entity = sp; | ||
} | ||
} | ||
|
||
@Override | ||
public void onRemoved(AttributeContainer attributeContainer) | ||
{ | ||
super.onRemoved(attributeContainer); | ||
if(this.entity != null) | ||
{ | ||
Pal.revokeAbility(this.entity, VanillaAbilities.ALLOW_FLYING, FLIGHT_POTION); | ||
Pal.revokeAbility(this.entity, VanillaAbilities.FLYING, FLIGHT_POTION); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.