-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Storm proc only when raining Bramblethorn added (AoE poison/slow on hit)
- Loading branch information
Showing
25 changed files
with
824 additions
and
15 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
51 changes: 51 additions & 0 deletions
51
src/main/java/net/sweenus/simplyswords/effect/PlagueEffect.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,51 @@ | ||
package net.sweenus.simplyswords.effect; | ||
|
||
import net.minecraft.entity.Entity; | ||
import net.minecraft.entity.LivingEntity; | ||
import net.minecraft.entity.effect.StatusEffect; | ||
import net.minecraft.entity.effect.StatusEffectCategory; | ||
import net.minecraft.entity.effect.StatusEffectInstance; | ||
import net.minecraft.entity.effect.StatusEffects; | ||
import net.minecraft.predicate.entity.EntityPredicates; | ||
import net.minecraft.server.world.ServerWorld; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.util.math.Box; | ||
import net.sweenus.simplyswords.config.SimplySwordsConfig; | ||
import net.sweenus.simplyswords.item.custom.PlagueSwordItem; | ||
|
||
public class PlagueEffect extends StatusEffect { | ||
public PlagueEffect(StatusEffectCategory statusEffectCategory, int color) {super (statusEffectCategory, color); } | ||
|
||
@Override | ||
public void applyUpdateEffect(LivingEntity pLivingEntity, int pAmplifier) { | ||
if (!pLivingEntity.world.isClient()) { | ||
ServerWorld world = (ServerWorld)pLivingEntity.world; | ||
BlockPos position = pLivingEntity.getBlockPos(); | ||
double x = pLivingEntity.getX(); | ||
double y = pLivingEntity.getY(); | ||
double z = pLivingEntity.getZ(); | ||
var attacker = pLivingEntity.getAttacker(); | ||
//int spreadchance = SimplySwordsConfig.getIntValue("plague_spread_chance"); | ||
|
||
if (pLivingEntity.getRandom().nextInt(100) <= 10) { | ||
Box box = new Box(x + 10, y + 5, z + 10, x - 10, y - 5, z - 10); | ||
|
||
for(Entity e: world.getOtherEntities(attacker, box, EntityPredicates.VALID_ENTITY)) { | ||
if (e != null) { | ||
//end me | ||
} | ||
} | ||
} | ||
|
||
} | ||
|
||
super.applyUpdateEffect(pLivingEntity, pAmplifier); | ||
|
||
} | ||
|
||
@Override | ||
public boolean canApplyUpdateEffect(int pDuration, int pAmplifier) { | ||
return 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
49 changes: 49 additions & 0 deletions
49
src/main/java/net/sweenus/simplyswords/item/custom/BrambleSwordItem.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,49 @@ | ||
package net.sweenus.simplyswords.item.custom; | ||
|
||
|
||
import net.minecraft.entity.Entity; | ||
import net.minecraft.entity.LivingEntity; | ||
import net.minecraft.entity.effect.StatusEffectInstance; | ||
import net.minecraft.entity.effect.StatusEffects; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.item.SwordItem; | ||
import net.minecraft.item.ToolMaterial; | ||
import net.minecraft.predicate.entity.EntityPredicates; | ||
import net.minecraft.server.world.ServerWorld; | ||
import net.minecraft.util.math.Box; | ||
import net.sweenus.simplyswords.config.SimplySwordsConfig; | ||
import net.sweenus.simplyswords.effect.ModEffects; | ||
|
||
public class BrambleSwordItem extends SwordItem { | ||
public BrambleSwordItem(ToolMaterial toolMaterial, int attackDamage, float attackSpeed, Settings settings) { | ||
super(toolMaterial, attackDamage, attackSpeed, settings); | ||
} | ||
|
||
@Override | ||
public boolean postHit(ItemStack stack, LivingEntity target, LivingEntity attacker) { | ||
int fhitchance = 50; //SimplySwordsConfig.getIntValue("brimstone_chance"); | ||
|
||
|
||
if (attacker.getRandom().nextInt(100) <= fhitchance) { | ||
if (!target.world.isClient()) { | ||
double x = target.getX(); | ||
double y = target.getY(); | ||
double z = target.getZ(); | ||
ServerWorld world = (ServerWorld) target.world; | ||
Box box = new Box(x + 10, y + 5, z + 10, x - 10, y - 5, z - 10); | ||
|
||
for(Entity e: world.getOtherEntities(attacker, box, EntityPredicates.VALID_LIVING_ENTITY)) { | ||
if (e != null) { | ||
target = (LivingEntity) e; | ||
target.addStatusEffect(new StatusEffectInstance(StatusEffects.POISON, 300, 1), attacker); | ||
target.addStatusEffect(new StatusEffectInstance(StatusEffects.SLOWNESS, 150, 1), attacker); | ||
} | ||
} | ||
} | ||
} | ||
|
||
return super.postHit(stack, target, attacker); | ||
|
||
} | ||
|
||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/net/sweenus/simplyswords/item/custom/PlagueSwordItem.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,32 @@ | ||
package net.sweenus.simplyswords.item.custom; | ||
|
||
|
||
import net.minecraft.entity.LivingEntity; | ||
import net.minecraft.entity.effect.StatusEffectInstance; | ||
import net.minecraft.entity.effect.StatusEffects; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.item.SwordItem; | ||
import net.minecraft.item.ToolMaterial; | ||
import net.sweenus.simplyswords.config.SimplySwordsConfig; | ||
import net.sweenus.simplyswords.effect.ModEffects; | ||
|
||
public class PlagueSwordItem extends SwordItem { | ||
public PlagueSwordItem(ToolMaterial toolMaterial, int attackDamage, float attackSpeed, Settings settings) { | ||
super(toolMaterial, attackDamage, attackSpeed, settings); | ||
} | ||
|
||
@Override | ||
public boolean postHit(ItemStack stack, LivingEntity target, LivingEntity attacker) { | ||
|
||
int phitchance = SimplySwordsConfig.getIntValue("plague_chance"); | ||
int pduration = SimplySwordsConfig.getIntValue("plague_duration"); | ||
|
||
if (attacker.getRandom().nextInt(100) <= phitchance) { | ||
target.addStatusEffect(new StatusEffectInstance(StatusEffects.WITHER, pduration, 1), attacker); | ||
} | ||
|
||
return super.postHit(stack, target, attacker); | ||
|
||
} | ||
|
||
} |
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
Oops, something went wrong.