-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Storm status effect (AOE Lightning) Adjusted Watcher status effect - now hits all entities in proximity, except player but siphons less health Base wildfire chance reduced
- Loading branch information
Showing
16 changed files
with
707 additions
and
6 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
49 changes: 49 additions & 0 deletions
49
src/main/java/net/sweenus/simplyswords/effect/StormEffect.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.effect; | ||
|
||
import net.minecraft.entity.Entity; | ||
import net.minecraft.entity.EntityType; | ||
import net.minecraft.entity.LivingEntity; | ||
import net.minecraft.entity.SpawnReason; | ||
import net.minecraft.entity.effect.StatusEffect; | ||
import net.minecraft.entity.effect.StatusEffectCategory; | ||
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; | ||
|
||
public class StormEffect extends StatusEffect { | ||
public StormEffect(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 pPlayer = pLivingEntity.getAttacker(); | ||
Box box = new Box(x + 10, y +5, z + 10, x - 10, y - 5, z - 10); | ||
|
||
//for(Entity e: world.getEntitiesByType(pLivingEntity.getType(), box, EntityPredicates.VALID_ENTITY)) | ||
for(Entity e: world.getOtherEntities(pPlayer, box, EntityPredicates.VALID_ENTITY)) | ||
{ | ||
if (e != null) { | ||
var stormtarget = e.getBlockPos(); | ||
Entity storm = EntityType.LIGHTNING_BOLT.spawn(world, null, null, null, stormtarget, SpawnReason.TRIGGERED, true, true); | ||
} | ||
} | ||
|
||
} | ||
|
||
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
33 changes: 33 additions & 0 deletions
33
src/main/java/net/sweenus/simplyswords/item/custom/StormSwordItem.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,33 @@ | ||
package net.sweenus.simplyswords.item.custom; | ||
|
||
|
||
import net.minecraft.entity.LivingEntity; | ||
import net.minecraft.entity.effect.StatusEffectInstance; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.item.SwordItem; | ||
import net.minecraft.item.ToolMaterial; | ||
import net.minecraft.world.World; | ||
import net.minecraft.world.biome.Biome; | ||
import net.minecraft.world.gen.structure.OceanRuinStructure; | ||
import net.sweenus.simplyswords.config.SimplySwordsConfig; | ||
import net.sweenus.simplyswords.effect.ModEffects; | ||
|
||
public class StormSwordItem extends SwordItem { | ||
public StormSwordItem(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("storm_chance"); | ||
|
||
if (attacker.getRandom().nextInt(100) <= phitchance) { | ||
target.addStatusEffect(new StatusEffectInstance(ModEffects.STORM, 1, 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
Oops, something went wrong.