Added kill evil entities snap
This commit is contained in:
parent
ba91b9db69
commit
90d2609af9
|
@ -5,9 +5,11 @@ import anvil.infinity.config.ConfigHandler;
|
||||||
import anvil.infinity.capabilities.GauntletUserInformation;
|
import anvil.infinity.capabilities.GauntletUserInformation;
|
||||||
import anvil.infinity.helpers.GauntelHelper;
|
import anvil.infinity.helpers.GauntelHelper;
|
||||||
import anvil.infinity.registry.Effects;
|
import anvil.infinity.registry.Effects;
|
||||||
|
import lucraft.mods.lucraftcore.karma.capabilities.CapabilityKarma;
|
||||||
import lucraft.mods.lucraftcore.superpowers.abilities.supplier.IAbilityProvider;
|
import lucraft.mods.lucraftcore.superpowers.abilities.supplier.IAbilityProvider;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.entity.monster.EntityMob;
|
||||||
import net.minecraft.entity.passive.EntityRabbit;
|
import net.minecraft.entity.passive.EntityRabbit;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
@ -96,11 +98,25 @@ public class SnapHelper {
|
||||||
entities.addAll(worlds[i].loadedEntityList);
|
entities.addAll(worlds[i].loadedEntityList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PlayerList players = server.getPlayerList();
|
||||||
|
|
||||||
|
TextComponentString msg = new TextComponentString(entity.getName() + ": ");
|
||||||
|
msg.appendSibling(new TextComponentTranslation("infinity.snap.irontext"));
|
||||||
|
msg.getStyle().setColor(TextFormatting.RED);
|
||||||
|
msg.getStyle().setBold(true);
|
||||||
|
players.sendMessage(msg);
|
||||||
|
|
||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
for (int i = 0; i < entities.size(); i++) {
|
for (int i = 0; i < entities.size(); i++) {
|
||||||
if (entities.get(i) != entity && entities.get(i) instanceof EntityLivingBase) {
|
if (entities.get(i) != entity && entities.get(i) instanceof EntityLivingBase) {
|
||||||
EntityLivingBase e = ((EntityLivingBase) entities.get(i));
|
EntityLivingBase e = ((EntityLivingBase) entities.get(i));
|
||||||
e.addPotionEffect(new PotionEffect(Effects.snapEffect, random.nextInt((1200 - 10) + 1) - 10));
|
if (e instanceof EntityMob) {
|
||||||
|
e.addPotionEffect(new PotionEffect(Effects.snapEffect, random.nextInt((1200 - 10) + 1) - 10));
|
||||||
|
} else if (e instanceof EntityPlayer && e.hasCapability(CapabilityKarma.KARMA_CAP, null)) {
|
||||||
|
if (e.getCapability(CapabilityKarma.KARMA_CAP, null).getKarma() < 1) {
|
||||||
|
e.addPotionEffect(new PotionEffect(Effects.snapEffect, random.nextInt((1200 - 10) + 1) - 10));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,14 +8,23 @@ public enum SnapResult {
|
||||||
DESTROYSTONES,
|
DESTROYSTONES,
|
||||||
BRINGBACK,
|
BRINGBACK,
|
||||||
RECREATE,
|
RECREATE,
|
||||||
|
KILLEVIL,
|
||||||
CREATIVE;
|
CREATIVE;
|
||||||
|
|
||||||
|
final static String KILLHALFID = "Kill half";
|
||||||
|
final static String DESTROYSTONESID = "Destroy the Stones";
|
||||||
|
final static String BRINGBACKID = "Bring back the dusted (WIP)";
|
||||||
|
final static String RECREATEID = "Recreate the Universe (WIP)";
|
||||||
|
final static String KILLEVILID = "Kill evil entities";
|
||||||
|
final static String CREATIVEID = "Change to Creative";
|
||||||
|
|
||||||
public SnapResult next() {
|
public SnapResult next() {
|
||||||
switch(this) {
|
switch(this) {
|
||||||
case KILLHALF: return DESTROYSTONES;
|
case KILLHALF: return DESTROYSTONES;
|
||||||
case DESTROYSTONES: return BRINGBACK;
|
case DESTROYSTONES: return BRINGBACK;
|
||||||
case BRINGBACK: return RECREATE;
|
case BRINGBACK: return RECREATE;
|
||||||
case RECREATE: if (ConfigHandler.snapCreative) {return CREATIVE;} else {return KILLHALF;}
|
case RECREATE: return KILLEVIL;
|
||||||
|
case KILLEVIL: if (ConfigHandler.snapCreative) {return CREATIVE;} else {return KILLHALF;}
|
||||||
case CREATIVE: return KILLHALF;
|
case CREATIVE: return KILLHALF;
|
||||||
}
|
}
|
||||||
return KILLHALF;
|
return KILLHALF;
|
||||||
|
@ -25,12 +34,26 @@ public enum SnapResult {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
switch (this) {
|
switch (this) {
|
||||||
case KILLHALF: return "Kill half";
|
case KILLHALF: return KILLHALFID;
|
||||||
case DESTROYSTONES: return "Destroy the Stones";
|
case DESTROYSTONES: return DESTROYSTONESID;
|
||||||
case BRINGBACK: return "Bring back the dusted (WIP)";
|
case BRINGBACK: return BRINGBACKID;
|
||||||
case RECREATE: return "Recreate the Universe (WIP)";
|
case RECREATE: return RECREATEID;
|
||||||
case CREATIVE: return "Change to Creative";
|
case KILLEVIL: return KILLEVILID;
|
||||||
|
case CREATIVE: return CREATIVEID;
|
||||||
}
|
}
|
||||||
return "Kill half";
|
return "Kill half";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static SnapResult fromString(String s) {
|
||||||
|
switch (s) {
|
||||||
|
case KILLHALFID: return KILLHALF;
|
||||||
|
case DESTROYSTONESID: return DESTROYSTONES;
|
||||||
|
case BRINGBACKID: return BRINGBACK;
|
||||||
|
case RECREATEID: return RECREATE;
|
||||||
|
case KILLEVILID: return KILLEVIL;
|
||||||
|
case CREATIVEID: return CREATIVE;
|
||||||
|
}
|
||||||
|
return KILLHALF;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ item.soul_stone.name=Soul Stone
|
||||||
item.time_stone.name=Time Stone
|
item.time_stone.name=Time Stone
|
||||||
item.mind_stone.name=Mind Stone
|
item.mind_stone.name=Mind Stone
|
||||||
infinity.snap.text=You should have gone for the head.
|
infinity.snap.text=You should have gone for the head.
|
||||||
|
infinity.snap.irontext=And I am ... Iron Man
|
||||||
infinity.snap.death=was dusted away
|
infinity.snap.death=was dusted away
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue