-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
24 changed files
with
282 additions
and
384 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
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
14 changes: 14 additions & 0 deletions
14
origins/src/main/java/io/github/dueris/originspaper/mixin/CreeperMixin.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,14 @@ | ||
package io.github.dueris.originspaper.mixin; | ||
|
||
import com.dragoncommissions.mixbukkit.api.shellcode.impl.api.CallbackInfo; | ||
import io.github.dueris.originspaper.power.origins.ScareCreepersPower; | ||
import net.minecraft.world.entity.monster.Creeper; | ||
|
||
@Mixin(Creeper.class) | ||
public class CreeperMixin { | ||
|
||
@Inject(method = "registerGoals", locator = At.Value.RETURN) | ||
public static void origins$scareCreepers(Creeper creeper, CallbackInfo info) { | ||
ScareCreepersPower.modifyGoals(creeper); | ||
} | ||
} |
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
35 changes: 35 additions & 0 deletions
35
origins/src/main/java/io/github/dueris/originspaper/mixin/PlayerMixin.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,35 @@ | ||
package io.github.dueris.originspaper.mixin; | ||
|
||
import com.dragoncommissions.mixbukkit.api.shellcode.impl.api.CallbackInfo; | ||
import io.github.dueris.originspaper.power.origins.LikeWaterPower; | ||
import io.github.dueris.originspaper.storage.PowerHolderComponent; | ||
import net.minecraft.tags.FluidTags; | ||
import net.minecraft.world.effect.MobEffectInstance; | ||
import net.minecraft.world.effect.MobEffects; | ||
import net.minecraft.world.entity.EquipmentSlot; | ||
import net.minecraft.world.entity.player.Player; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.item.Items; | ||
import org.bukkit.event.entity.EntityPotionEffectEvent; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
@Mixin(Player.class) | ||
public class PlayerMixin { | ||
|
||
@Inject(method = "tick", locator = At.Value.HEAD) | ||
public static void apoli$likeWater(Player instance, CallbackInfo info) { | ||
LikeWaterPower.tick((org.bukkit.entity.Player) instance.getBukkitEntity()); | ||
} | ||
|
||
@Inject(method = "turtleHelmetTick", locator = At.Value.HEAD) | ||
public static void apoli$turtleHelmetTick(@NotNull Player instance, CallbackInfo info) { | ||
ItemStack itemstack = instance.getItemBySlot(EquipmentSlot.HEAD); | ||
|
||
if (itemstack.is(Items.TURTLE_HELMET) && PowerHolderComponent.hasPower(instance.getBukkitEntity(), "origins:water_breathing") == instance.isEyeInFluid(FluidTags.WATER)) { | ||
instance.addEffect(new MobEffectInstance(MobEffects.WATER_BREATHING, 200, 0, false, false, true), EntityPotionEffectEvent.Cause.TURTLE_HELMET); | ||
} | ||
|
||
info.setReturned(true); | ||
|
||
} | ||
} |
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
31 changes: 31 additions & 0 deletions
31
origins/src/main/java/io/github/dueris/originspaper/power/origins/LikeWaterPower.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,31 @@ | ||
package io.github.dueris.originspaper.power.origins; | ||
|
||
import io.github.dueris.originspaper.OriginsPaper; | ||
import io.github.dueris.originspaper.storage.PowerHolderComponent; | ||
import org.bukkit.attribute.Attribute; | ||
import org.bukkit.attribute.AttributeModifier; | ||
import org.bukkit.craftbukkit.util.CraftNamespacedKey; | ||
import org.bukkit.entity.Player; | ||
|
||
public class LikeWaterPower { | ||
private static final AttributeModifier modifier = new AttributeModifier(CraftNamespacedKey.fromMinecraft(OriginsPaper.originIdentifier("likewater")), -1, AttributeModifier.Operation.MULTIPLY_SCALAR_1); | ||
private static final String cachedPowerRefrenceString = "origins:like_water"; | ||
|
||
public static void tick(Player p) { | ||
if (!PowerHolderComponent.hasPower(p, cachedPowerRefrenceString)) { | ||
if (p.getAttribute(Attribute.GENERIC_GRAVITY).getModifiers().contains(modifier)) { | ||
p.getAttribute(Attribute.GENERIC_GRAVITY).removeModifier(modifier); | ||
} | ||
return; | ||
} | ||
if (p.isInWaterOrBubbleColumn() && !p.isSneaking()) { | ||
if (!p.getAttribute(Attribute.GENERIC_GRAVITY).getModifiers().contains(modifier)) { | ||
p.getAttribute(Attribute.GENERIC_GRAVITY).addTransientModifier(modifier); | ||
} | ||
} else { | ||
if (p.getAttribute(Attribute.GENERIC_GRAVITY).getModifiers().contains(modifier)) { | ||
p.getAttribute(Attribute.GENERIC_GRAVITY).removeModifier(modifier); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.