diff options
| author | Benjamin Culkin <scorpress@gmail.com> | 2024-08-24 08:16:37 -0400 |
|---|---|---|
| committer | Benjamin Culkin <scorpress@gmail.com> | 2024-08-24 08:16:37 -0400 |
| commit | 70c1354a4a96698758a88c032866288f79de6f5a (patch) | |
| tree | eca51294e84b90a4cb3230bc2c7900469e784184 /src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicSpeed.java | |
Diffstat (limited to 'src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicSpeed.java')
| -rw-r--r-- | src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicSpeed.java | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicSpeed.java b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicSpeed.java new file mode 100644 index 0000000..54e478f --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicSpeed.java @@ -0,0 +1,48 @@ +package jp.plusplus.fbs.alchemy.characteristic;
+
+import com.mojang.realmsclient.gui.ChatFormatting;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+import net.minecraft.world.World;
+
+/**
+ * Created by plusplus_F on 2015/02/23.
+ */
+public class CharacteristicSpeed extends CharacteristicBase {
+ protected boolean reverse;
+ public CharacteristicSpeed(boolean minus){
+ reverse=minus;
+ setUnlocalizedName("fbs.speed."+(reverse?"lose":"gain"));
+ }
+
+ @Override
+ public Type getType() {
+ return Type.LENGTH;
+ }
+
+ @Override
+ public void affectEntity(World world, EntityLivingBase entity) {
+ int d = 10 + 10 * getType().getCorrectedValue(value);
+
+ if (reverse) {
+ entity.removePotionEffect(Potion.moveSlowdown.getId());
+ entity.addPotionEffect(new PotionEffect(Potion.moveSpeed.getId(), 20 * d, 1));
+ } else {
+ entity.removePotionEffect(Potion.moveSpeed.getId());
+ entity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.getId(), 20 * d, 1));
+ }
+ }
+
+ @Override
+ public ChatFormatting getNameColor(){
+ return reverse?ChatFormatting.RED:ChatFormatting.DARK_GREEN;
+ }
+
+ public static class Gain extends CharacteristicSpeed {
+ public Gain(){ super(false); }
+ }
+ public static class Lose extends CharacteristicSpeed {
+ public Lose(){ super(true); }
+ }
+}
|
