Worked on Snap Abilities
This commit is contained in:
parent
69ff7c2fb1
commit
b6866b0f16
|
@ -1,6 +1,7 @@
|
||||||
package anvil.infinity.snap;
|
package anvil.infinity.snap;
|
||||||
|
|
||||||
import anvil.infinity.config.ConfigHandler;
|
import anvil.infinity.config.ConfigHandler;
|
||||||
|
import anvil.infinity.data.EntityData;
|
||||||
import anvil.infinity.data.GauntletUserInformation;
|
import anvil.infinity.data.GauntletUserInformation;
|
||||||
import anvil.infinity.helpers.GauntelHelper;
|
import anvil.infinity.helpers.GauntelHelper;
|
||||||
import anvil.infinity.registry.Effects;
|
import anvil.infinity.registry.Effects;
|
||||||
|
@ -29,9 +30,10 @@ public class SnapHelper {
|
||||||
static MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
|
static MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
|
||||||
|
|
||||||
public static boolean snap(EntityLivingBase entity) {
|
public static boolean snap(EntityLivingBase entity) {
|
||||||
|
EntityData data = GauntletUserInformation.getDataByEntity(entity);
|
||||||
if (GauntelHelper.hasFullGauntlet(entity)) {
|
if (GauntelHelper.hasFullGauntlet(entity)) {
|
||||||
World w = entity.getEntityWorld();
|
World w = entity.getEntityWorld();
|
||||||
if (GauntletUserInformation.getDataByEntity(entity).selectedSnapResult == SnapResult.KILLHALF) {
|
if (data.selectedSnapResult == SnapResult.KILLHALF) {
|
||||||
List<Entity> entities = w.loadedEntityList;
|
List<Entity> entities = w.loadedEntityList;
|
||||||
boolean kill = false;
|
boolean kill = false;
|
||||||
|
|
||||||
|
@ -53,26 +55,32 @@ public class SnapHelper {
|
||||||
kill = !kill;
|
kill = !kill;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else if (GauntletUserInformation.getDataByEntity(entity).selectedSnapResult == SnapResult.DESTROYSTONES) {
|
} else if (data.selectedSnapResult == SnapResult.DESTROYSTONES) {
|
||||||
entity.setHealth(1);
|
entity.setHealth(1);
|
||||||
ItemStack gauntlet;
|
if (entity.getHeldItem(EnumHand.MAIN_HAND).getItem().equals(ModuleInfinity.INFINITY_GAUNTLET)) {
|
||||||
if (entity.getHeldItem(EnumHand.MAIN_HAND).getItem().equals(ModuleInfinity.INFINITY_GAUNTLET)) {
|
entity.setHeldItem(EnumHand.MAIN_HAND, new ItemStack(ModuleInfinity.INFINITY_GAUNTLET));
|
||||||
gauntlet = entity.getHeldItem(EnumHand.MAIN_HAND);
|
} else {
|
||||||
} else {
|
entity.setHeldItem(EnumHand.OFF_HAND, new ItemStack(ModuleInfinity.INFINITY_GAUNTLET));
|
||||||
gauntlet = entity.getHeldItem(EnumHand.OFF_HAND);
|
}
|
||||||
}
|
entity.setHealth(1);
|
||||||
|
|
||||||
} else if (GauntletUserInformation.getDataByEntity(entity).selectedSnapResult == SnapResult.CREATIVE) {
|
|
||||||
|
} else if (data.selectedSnapResult == SnapResult.CREATIVE) {
|
||||||
if (ConfigHandler.snapCreative) {
|
if (ConfigHandler.snapCreative) {
|
||||||
if (entity instanceof EntityPlayer) {
|
if (entity instanceof EntityPlayer) {
|
||||||
((EntityPlayer) entity).setGameType(GameType.CREATIVE);
|
|
||||||
|
if (((EntityPlayer) entity).capabilities.isCreativeMode) {
|
||||||
|
((EntityPlayer) entity).setGameType(GameType.SURVIVAL);
|
||||||
|
} else {
|
||||||
|
((EntityPlayer) entity).setGameType(GameType.CREATIVE);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (GauntletUserInformation.getDataByEntity(entity).selectedSnapResult == SnapResult.BRINGBACK) {
|
} else if (data.selectedSnapResult == SnapResult.BRINGBACK) {
|
||||||
|
|
||||||
|
} else if (data.selectedSnapResult == SnapResult.RECREATE) {
|
||||||
|
|
||||||
} else if (GauntletUserInformation.getDataByEntity(entity).selectedSnapResult == SnapResult.RECREATE) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue