mirror of
https://github.com/GTNewHorizons/Avaritia.git
synced 2026-10-25 20:22:24 +00:00
add optional Draconic Evolution configurable integration (#83)
This commit is contained in:
1 parent
77468df939
commit
59d9cafe1e
26 files changed
+1108
-148
No files matched your search
@@ -4,6 +4,7 @@ dependencies {
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.9.39:dev")
|
||||
devOnlyNonPublishable("com.github.GTNewHorizons:NotEnoughItems:2.8.75-GTNH:dev")
|
||||
|
||||
compileOnly("com.github.GTNewHorizons:Draconic-Evolution:1.5.26-GTNH:dev") {transitive = false}
|
||||
compileOnly("com.github.GTNewHorizons:ForestryMC:4.11.8:api") {transitive = false}
|
||||
compileOnly("com.github.GTNewHorizons:Botania:1.13.16-GTNH:dev") {transitive = false}
|
||||
compileOnly("com.github.GTNewHorizons:Mantle:0.5.1:dev") {transitive = false}
|
||||
|
||||
@@ -28,7 +28,9 @@ import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.EventPriority;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import fox.spiteful.avaritia.compat.draconicevolution.InfinityArmorSetConfigHelpers;
|
||||
import fox.spiteful.avaritia.items.ItemFracturedOre;
|
||||
import fox.spiteful.avaritia.items.ItemMatterCluster;
|
||||
import fox.spiteful.avaritia.items.LudicrousItems;
|
||||
@@ -192,23 +194,31 @@ public class LudicrousEvents {
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@SubscribeEvent(priority = EventPriority.LOWEST)
|
||||
public void onGetHurt(LivingHurtEvent event) {
|
||||
if (!(event.entityLiving instanceof EntityPlayer player)) return;
|
||||
if (player.getHeldItem() != null && player.getHeldItem().getItem() == LudicrousItems.infinity_sword
|
||||
&& player.isUsingItem())
|
||||
event.setCanceled(true);
|
||||
if (LudicrousItems.isInfinite(player) && !event.source.damageType.equals("infinity")) event.setCanceled(true);
|
||||
if (InfinityArmorSetConfigHelpers.isInfinitySetEquipped(player)
|
||||
&& InfinityArmorSetConfigHelpers.isDamageImmune(player)
|
||||
&& !event.source.damageType.equals("infinity")) {
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@SubscribeEvent(priority = EventPriority.LOWEST)
|
||||
public void onAttacked(LivingAttackEvent event) {
|
||||
if (!(event.entityLiving instanceof EntityPlayer player)) return;
|
||||
if (event.source.getEntity() != null && event.source.getEntity() instanceof EntityPlayer) return;
|
||||
if (player.getHeldItem() != null && player.getHeldItem().getItem() == LudicrousItems.infinity_sword
|
||||
&& player.isUsingItem())
|
||||
event.setCanceled(true);
|
||||
if (LudicrousItems.isInfinite(player) && !event.source.damageType.equals("infinity")) event.setCanceled(true);
|
||||
if (InfinityArmorSetConfigHelpers.isInfinitySetEquipped(player)
|
||||
&& InfinityArmorSetConfigHelpers.isDamageImmune(player)
|
||||
&& !event.source.damageType.equals("infinity")) {
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@@ -287,10 +297,12 @@ public class LudicrousEvents {
|
||||
return false;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@SubscribeEvent(priority = EventPriority.LOWEST)
|
||||
public void onDeath(LivingDeathEvent event) {
|
||||
if (event.entityLiving instanceof EntityPlayer player) {
|
||||
if (LudicrousItems.isInfinite(player) && !event.source.getDamageType().equals("infinity")) {
|
||||
if (InfinityArmorSetConfigHelpers.isInfinitySetEquipped(player)
|
||||
&& InfinityArmorSetConfigHelpers.isDeathImmune(player)
|
||||
&& !event.source.getDamageType().equals("infinity")) {
|
||||
event.setCanceled(true);
|
||||
player.setHealth(player.getMaxHealth());
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ public class Compat {
|
||||
public static boolean am2 = false;
|
||||
public static boolean forestry = false;
|
||||
public static boolean te = false;
|
||||
public static boolean draconicEvolution = false;
|
||||
|
||||
public static void census() {
|
||||
nei = Loader.isModLoaded("NotEnoughItems");
|
||||
@@ -65,6 +66,7 @@ public class Compat {
|
||||
am2 = Loader.isModLoaded("arsmagica2") && Config.am2;
|
||||
forestry = Loader.isModLoaded("Forestry") && Config.forestry;
|
||||
te = Loader.isModLoaded("ThermalExpansion") && Config.te;
|
||||
draconicEvolution = Loader.isModLoaded("DraconicEvolution");
|
||||
|
||||
if (thaumic) {
|
||||
Lucrum.initTermination();
|
||||
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
package fox.spiteful.avaritia.compat.draconicevolution;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class InfinityArmorAbilityResolver {
|
||||
|
||||
private static final float LEGACY_SPEED_MULTIPLIER = 0F;
|
||||
private static final float LEGACY_JUMP_MULTIPLIER = 0F;
|
||||
private static final float LEGACY_FLIGHT_SPEED_MULTIPLIER = 1F;
|
||||
private static final float LEGACY_VERTICAL_ACCELERATION = 0F;
|
||||
|
||||
private InfinityArmorAbilityResolver() {}
|
||||
|
||||
public static float getSpeedModifier(ItemStack stack, EntityPlayer player) {
|
||||
return InfinityArmorConfigHelpers.getConditionalMultiplier(
|
||||
stack,
|
||||
player,
|
||||
InfinityArmorConfigKeys.ARMOR_SPEED_MULT,
|
||||
LEGACY_SPEED_MULTIPLIER);
|
||||
}
|
||||
|
||||
public static float getJumpModifier(ItemStack stack, EntityPlayer player) {
|
||||
return InfinityArmorConfigHelpers.getConditionalMultiplier(
|
||||
stack,
|
||||
player,
|
||||
InfinityArmorConfigKeys.ARMOR_JUMP_MULT,
|
||||
LEGACY_JUMP_MULTIPLIER);
|
||||
}
|
||||
|
||||
public static boolean hasHillStep(ItemStack stack, EntityPlayer player) {
|
||||
if (!InfinityArmorConfigHelpers.getBoolean(stack, InfinityArmorConfigKeys.ARMOR_HILL_STEP, true)) {
|
||||
return false;
|
||||
}
|
||||
if (!InfinityArmorConfigHelpers.getBoolean(stack, InfinityArmorConfigKeys.ARMOR_SPRINT_ONLY, false)) {
|
||||
return true;
|
||||
}
|
||||
return InfinityArmorConfigHelpers.isSprintConditionActive(stack, player);
|
||||
}
|
||||
|
||||
public static boolean[] getFlightState(ItemStack stack) {
|
||||
return new boolean[] { true,
|
||||
InfinityArmorConfigHelpers.getBoolean(stack, InfinityArmorConfigKeys.ARMOR_FLIGHT_LOCK, false),
|
||||
InfinityArmorConfigHelpers
|
||||
.getBoolean(stack, InfinityArmorConfigKeys.ARMOR_INERTIA_CANCELLATION, false) };
|
||||
}
|
||||
|
||||
public static float getFlightSpeedModifier(ItemStack stack, EntityPlayer player) {
|
||||
return InfinityArmorConfigHelpers.getConditionalFlightMultiplier(
|
||||
stack,
|
||||
player,
|
||||
InfinityArmorConfigKeys.ARMOR_FLIGHT_SPEED_MULT,
|
||||
LEGACY_FLIGHT_SPEED_MULTIPLIER);
|
||||
}
|
||||
|
||||
public static float getFlightVerticalModifier(ItemStack stack, EntityPlayer player) {
|
||||
return InfinityArmorConfigHelpers.getConditionalFlightMultiplier(
|
||||
stack,
|
||||
player,
|
||||
InfinityArmorConfigKeys.ARMOR_VERTICAL_ACCELERATION,
|
||||
LEGACY_VERTICAL_ACCELERATION);
|
||||
}
|
||||
}
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
package fox.spiteful.avaritia.compat.draconicevolution;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.utils.ItemConfigField;
|
||||
|
||||
public class InfinityArmorConfigFactory {
|
||||
|
||||
private InfinityArmorConfigFactory() {}
|
||||
|
||||
public static List<ItemConfigField> createFields(ItemStack stack, int slot, int armorType) {
|
||||
List<ItemConfigField> fields = new ArrayList<>();
|
||||
|
||||
if (armorType == 0) {
|
||||
fields.add(
|
||||
new ItemConfigField(References.BOOLEAN_ID, slot, InfinityArmorConfigKeys.ARMOR_NIGHT_VISION_ACTIVE)
|
||||
.readFromItem(stack, true));
|
||||
fields.add(
|
||||
new ItemConfigField(References.BOOLEAN_ID, slot, InfinityArmorConfigKeys.ARMOR_NIGHT_VISION_LOCK)
|
||||
.readFromItem(stack, true));
|
||||
fields.add(
|
||||
new ItemConfigField(References.BOOLEAN_ID, slot, InfinityArmorConfigKeys.ARMOR_WATER_BREATHING)
|
||||
.readFromItem(stack, true));
|
||||
fields.add(
|
||||
new ItemConfigField(References.BOOLEAN_ID, slot, InfinityArmorConfigKeys.ARMOR_AUTO_FEED)
|
||||
.readFromItem(stack, true));
|
||||
} else if (armorType == 1) {
|
||||
fields.add(
|
||||
new ItemConfigField(References.FLOAT_ID, slot, InfinityArmorConfigKeys.ARMOR_VERTICAL_ACCELERATION)
|
||||
.setMinMaxAndIncromente(0F, 8F, 0.1F).readFromItem(stack, 0F).setModifier("PLUSPERCENT"));
|
||||
fields.add(
|
||||
new ItemConfigField(References.FLOAT_ID, slot, InfinityArmorConfigKeys.ARMOR_FLIGHT_SPEED_MULT)
|
||||
.setMinMaxAndIncromente(0F, 6F, 0.1F).readFromItem(stack, 1F).setModifier("PLUSPERCENT"));
|
||||
fields.add(
|
||||
new ItemConfigField(References.BOOLEAN_ID, slot, InfinityArmorConfigKeys.ARMOR_EFFECTIVE_ON_SPRINT)
|
||||
.readFromItem(stack, false));
|
||||
fields.add(
|
||||
new ItemConfigField(References.BOOLEAN_ID, slot, InfinityArmorConfigKeys.ARMOR_FLIGHT_LOCK)
|
||||
.readFromItem(stack, false));
|
||||
fields.add(
|
||||
new ItemConfigField(References.BOOLEAN_ID, slot, InfinityArmorConfigKeys.ARMOR_INERTIA_CANCELLATION)
|
||||
.readFromItem(stack, false));
|
||||
fields.add(
|
||||
new ItemConfigField(References.BOOLEAN_ID, slot, InfinityArmorConfigKeys.ARMOR_REMOVE_NEGATIVE)
|
||||
.readFromItem(stack, true));
|
||||
fields.add(
|
||||
new ItemConfigField(References.BOOLEAN_ID, slot, InfinityArmorConfigKeys.ARMOR_DAMAGE_IMMUNITY)
|
||||
.readFromItem(stack, true));
|
||||
fields.add(
|
||||
new ItemConfigField(References.BOOLEAN_ID, slot, InfinityArmorConfigKeys.ARMOR_DEATH_IMMUNITY)
|
||||
.readFromItem(stack, true));
|
||||
} else if (armorType == 2) {
|
||||
fields.add(
|
||||
new ItemConfigField(References.FLOAT_ID, slot, InfinityArmorConfigKeys.ARMOR_SPEED_MULT)
|
||||
.setMinMaxAndIncromente(0F, 8F, 0.1F).readFromItem(stack, 0F).setModifier("PLUSPERCENT"));
|
||||
fields.add(
|
||||
new ItemConfigField(References.BOOLEAN_ID, slot, InfinityArmorConfigKeys.ARMOR_SPRINT_ONLY)
|
||||
.readFromItem(stack, false));
|
||||
fields.add(
|
||||
new ItemConfigField(References.BOOLEAN_ID, slot, InfinityArmorConfigKeys.ARMOR_EXTINGUISH)
|
||||
.readFromItem(stack, true));
|
||||
} else if (armorType == 3) {
|
||||
fields.add(
|
||||
new ItemConfigField(References.FLOAT_ID, slot, InfinityArmorConfigKeys.ARMOR_JUMP_MULT)
|
||||
.setMinMaxAndIncromente(0F, 15F, 0.1F).readFromItem(stack, 0F).setModifier("PLUSPERCENT"));
|
||||
fields.add(
|
||||
new ItemConfigField(References.BOOLEAN_ID, slot, InfinityArmorConfigKeys.ARMOR_SPRINT_ONLY)
|
||||
.readFromItem(stack, false));
|
||||
fields.add(
|
||||
new ItemConfigField(References.BOOLEAN_ID, slot, InfinityArmorConfigKeys.ARMOR_HILL_STEP)
|
||||
.readFromItem(stack, true));
|
||||
}
|
||||
|
||||
return fields;
|
||||
}
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
package fox.spiteful.avaritia.compat.draconicevolution;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import fox.spiteful.avaritia.compat.Compat;
|
||||
|
||||
public class InfinityArmorConfigHelpers {
|
||||
|
||||
private InfinityArmorConfigHelpers() {}
|
||||
|
||||
public static boolean getBoolean(ItemStack stack, String key, boolean defaultValue) {
|
||||
if (!Compat.draconicEvolution || stack == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
return InfinityConfigProfileBridge.getBoolean(stack, key, defaultValue);
|
||||
}
|
||||
|
||||
public static float getFloat(ItemStack stack, String key, float defaultValue) {
|
||||
if (!Compat.draconicEvolution || stack == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
return InfinityConfigProfileBridge.getFloat(stack, key, defaultValue);
|
||||
}
|
||||
|
||||
public static boolean isSprintConditionActive(ItemStack stack, EntityPlayer player) {
|
||||
return player.isSprinting() || player.isSneaking();
|
||||
}
|
||||
|
||||
public static float getConditionalMultiplier(ItemStack stack, EntityPlayer player, String key, float defaultValue) {
|
||||
float configuredValue = getFloat(stack, key, defaultValue);
|
||||
if (!getBoolean(stack, InfinityArmorConfigKeys.ARMOR_SPRINT_ONLY, false)) {
|
||||
return configuredValue;
|
||||
}
|
||||
return isSprintConditionActive(stack, player) ? configuredValue : configuredValue / 5F;
|
||||
}
|
||||
|
||||
public static float getConditionalFlightMultiplier(ItemStack stack, EntityPlayer player, String key,
|
||||
float defaultValue) {
|
||||
float configuredValue = getFloat(stack, key, defaultValue);
|
||||
if (!getBoolean(stack, InfinityArmorConfigKeys.ARMOR_EFFECTIVE_ON_SPRINT, false)) {
|
||||
return configuredValue;
|
||||
}
|
||||
return isSprintConditionActive(stack, player) ? configuredValue : 0F;
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package fox.spiteful.avaritia.compat.draconicevolution;
|
||||
|
||||
public class InfinityArmorConfigKeys {
|
||||
|
||||
public static final String ARMOR_NIGHT_VISION_ACTIVE = "ArmorNVActive";
|
||||
public static final String ARMOR_NIGHT_VISION_LOCK = "ArmorNVLock";
|
||||
public static final String ARMOR_VERTICAL_ACCELERATION = "VerticalAcceleration";
|
||||
public static final String ARMOR_FLIGHT_SPEED_MULT = "ArmorFlightSpeedMult";
|
||||
public static final String ARMOR_EFFECTIVE_ON_SPRINT = "EffectiveOnSprint";
|
||||
public static final String ARMOR_FLIGHT_LOCK = "ArmorFlightLock";
|
||||
public static final String ARMOR_INERTIA_CANCELLATION = "ArmorInertiaCancellation";
|
||||
public static final String ARMOR_SPEED_MULT = "ArmorSpeedMult";
|
||||
public static final String ARMOR_SPRINT_ONLY = "ArmorSprintOnly";
|
||||
public static final String ARMOR_JUMP_MULT = "ArmorJumpMult";
|
||||
public static final String ARMOR_HILL_STEP = "ArmorHillStep";
|
||||
public static final String ARMOR_AUTO_FEED = "AvaritiaArmorAutoFeed";
|
||||
public static final String ARMOR_REMOVE_NEGATIVE = "AvaritiaArmorRemoveNegative";
|
||||
public static final String ARMOR_EXTINGUISH = "AvaritiaArmorExtinguish";
|
||||
public static final String ARMOR_WATER_BREATHING = "AvaritiaArmorWaterBreathing";
|
||||
public static final String ARMOR_DAMAGE_IMMUNITY = "AvaritiaArmorDamageImmunity";
|
||||
public static final String ARMOR_DEATH_IMMUNITY = "AvaritiaArmorDeathImmunity";
|
||||
|
||||
private InfinityArmorConfigKeys() {}
|
||||
}
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
package fox.spiteful.avaritia.compat.draconicevolution;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
|
||||
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
||||
|
||||
public class InfinityArmorEffectHandler {
|
||||
|
||||
private InfinityArmorEffectHandler() {}
|
||||
|
||||
public static void handleArmorTick(EntityPlayer player, ItemStack stack, int armorType) {
|
||||
if (armorType == 0) {
|
||||
handleHelmetTick(player, stack);
|
||||
return;
|
||||
}
|
||||
if (armorType == 1) {
|
||||
handleChestTick(player, stack);
|
||||
return;
|
||||
}
|
||||
if (armorType == 2) {
|
||||
handleLeggingsTick(player, stack);
|
||||
}
|
||||
}
|
||||
|
||||
private static void handleHelmetTick(EntityPlayer player, ItemStack stack) {
|
||||
boolean nightVisionActive = InfinityArmorConfigHelpers
|
||||
.getBoolean(stack, InfinityArmorConfigKeys.ARMOR_NIGHT_VISION_ACTIVE, true);
|
||||
boolean nightVisionLock = InfinityArmorConfigHelpers
|
||||
.getBoolean(stack, InfinityArmorConfigKeys.ARMOR_NIGHT_VISION_LOCK, true);
|
||||
boolean lowLight = player.worldObj
|
||||
.getBlockLightValue((int) Math.floor(player.posX), (int) player.posY + 1, (int) Math.floor(player.posZ))
|
||||
< 5;
|
||||
|
||||
if (nightVisionActive && (nightVisionLock || lowLight)) {
|
||||
player.addPotionEffect(new PotionEffect(Potion.nightVision.id, 419, 0, true));
|
||||
} else if (player.isPotionActive(Potion.nightVision.id)) {
|
||||
player.removePotionEffect(Potion.nightVision.id);
|
||||
}
|
||||
|
||||
if (InfinityArmorConfigHelpers.getBoolean(stack, InfinityArmorConfigKeys.ARMOR_WATER_BREATHING, true)) {
|
||||
player.setAir(300);
|
||||
}
|
||||
if (InfinityArmorConfigHelpers.getBoolean(stack, InfinityArmorConfigKeys.ARMOR_AUTO_FEED, true)) {
|
||||
player.getFoodStats().addStats(20, 20F);
|
||||
}
|
||||
}
|
||||
|
||||
private static void handleChestTick(EntityPlayer player, ItemStack stack) {
|
||||
if (!InfinityArmorConfigHelpers.getBoolean(stack, InfinityArmorConfigKeys.ARMOR_REMOVE_NEGATIVE, true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Collection<PotionEffect> effects = player.getActivePotionEffects();
|
||||
if (effects.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
IntArrayList negativeEffectIds = null;
|
||||
for (PotionEffect potion : effects) {
|
||||
if (Potion.potionTypes[potion.getPotionID()].isBadEffect) {
|
||||
if (negativeEffectIds == null) {
|
||||
negativeEffectIds = new IntArrayList();
|
||||
}
|
||||
negativeEffectIds.add(potion.getPotionID());
|
||||
}
|
||||
}
|
||||
|
||||
if (negativeEffectIds == null || negativeEffectIds.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int potionId : negativeEffectIds) {
|
||||
player.removePotionEffect(potionId);
|
||||
}
|
||||
}
|
||||
|
||||
private static void handleLeggingsTick(EntityPlayer player, ItemStack stack) {
|
||||
if (InfinityArmorConfigHelpers.getBoolean(stack, InfinityArmorConfigKeys.ARMOR_EXTINGUISH, true)
|
||||
&& player.isBurning()) {
|
||||
player.extinguish();
|
||||
}
|
||||
}
|
||||
}
|
||||
+194
@@ -0,0 +1,194 @@
|
||||
package fox.spiteful.avaritia.compat.draconicevolution;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import fox.spiteful.avaritia.Config;
|
||||
import fox.spiteful.avaritia.compat.Compat;
|
||||
import fox.spiteful.avaritia.items.LudicrousItems;
|
||||
import fox.spiteful.avaritia.mixins.early.minecraft.EntityLivingBaseAccessor;
|
||||
|
||||
public class InfinityArmorRuntimeHandler {
|
||||
|
||||
private static final float BASE_FLY_SPEED = 0.05F;
|
||||
private static final float BASE_WALK_SPEED = 0.15F;
|
||||
private static final float BASE_JUMP_BOOST = 0.4F;
|
||||
private static final float LEGACY_FLIGHT_SPEED_BONUS = 1.0F;
|
||||
private static final float LEGACY_VERTICAL_ACCELERATION = 1.0F;
|
||||
|
||||
private final Set<String> playersWithChest = new HashSet<>();
|
||||
private final Set<String> playersWithFoot = new HashSet<>();
|
||||
|
||||
@SubscribeEvent
|
||||
public void updatePlayerAbilityStatus(LivingUpdateEvent event) {
|
||||
if (!(event.entityLiving instanceof EntityPlayer player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
String key = playerKey(player);
|
||||
updateFlight(player, key);
|
||||
updateFootAbilities(player, key);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void jumpBoost(LivingJumpEvent event) {
|
||||
if (!(event.entityLiving instanceof EntityPlayer player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack boots = getInfinityArmor(player, 0);
|
||||
if (boots == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
float jumpModifier = InfinityArmorAbilityResolver.getJumpModifier(boots, player);
|
||||
player.motionY += BASE_JUMP_BOOST + resolveJumpBonus(jumpModifier);
|
||||
}
|
||||
|
||||
private void updateFlight(EntityPlayer player, String key) {
|
||||
ItemStack chest = getInfinityArmor(player, 2);
|
||||
if (chest != null) {
|
||||
boolean[] flightState = InfinityArmorAbilityResolver.getFlightState(chest);
|
||||
player.capabilities.allowFlying = flightState[0];
|
||||
if (flightState[1]) {
|
||||
player.capabilities.isFlying = true;
|
||||
}
|
||||
float flightSpeedModifier = InfinityArmorAbilityResolver.getFlightSpeedModifier(chest, player);
|
||||
player.capabilities.setFlySpeed(resolveFlySpeed(flightSpeedModifier));
|
||||
playersWithChest.add(key);
|
||||
return;
|
||||
}
|
||||
|
||||
if (playersWithChest.remove(key) && !player.capabilities.isCreativeMode) {
|
||||
player.capabilities.allowFlying = false;
|
||||
player.capabilities.isFlying = false;
|
||||
}
|
||||
player.capabilities.setFlySpeed(0.05F);
|
||||
}
|
||||
|
||||
private void updateFootAbilities(EntityPlayer player, String key) {
|
||||
ItemStack boots = Config.fast ? getInfinityArmor(player, 0) : null;
|
||||
if (boots == null) {
|
||||
if (playersWithFoot.remove(key) && Config.stepUp) {
|
||||
player.stepHeight = 0.5F;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
boolean flying = player.capabilities.isFlying;
|
||||
boolean swimming = player.isInsideOfMaterial(Material.water) || player.isInWater();
|
||||
if (player.onGround || flying || swimming) {
|
||||
updateStepHeight(player, boots);
|
||||
applyHorizontalMovement(player, boots, flying);
|
||||
if (flying) {
|
||||
applyFlightVerticalMovement(player);
|
||||
applyFlightInertia(player);
|
||||
}
|
||||
}
|
||||
playersWithFoot.add(key);
|
||||
}
|
||||
|
||||
private void updateStepHeight(EntityPlayer player, ItemStack boots) {
|
||||
boolean sneaking = player.isSneaking();
|
||||
if (InfinityArmorAbilityResolver.hasHillStep(boots, player)) {
|
||||
player.stepHeight = sneaking ? 0.501F : 1.001F;
|
||||
} else if (Config.stepUp) {
|
||||
player.stepHeight = 0.5F;
|
||||
}
|
||||
}
|
||||
|
||||
private void applyHorizontalMovement(EntityPlayer player, ItemStack boots, boolean flying) {
|
||||
boolean sneaking = player.isSneaking();
|
||||
float configuredSpeed = InfinityArmorAbilityResolver.getSpeedModifier(boots, player);
|
||||
float speed = resolveHorizontalSpeed(configuredSpeed, flying, sneaking);
|
||||
|
||||
if (player.moveForward > 0F) {
|
||||
player.moveFlying(0F, 1F, speed);
|
||||
} else if (player.moveForward < 0F) {
|
||||
player.moveFlying(0F, 1F, -speed * 0.3F);
|
||||
}
|
||||
|
||||
if (player.moveStrafing != 0F) {
|
||||
player.moveFlying(1F, 0F, speed * 0.5F * Math.signum(player.moveStrafing));
|
||||
}
|
||||
}
|
||||
|
||||
private void applyFlightVerticalMovement(EntityPlayer player) {
|
||||
ItemStack chest = getInfinityArmor(player, 2);
|
||||
if (chest == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
boolean jumping = ((EntityLivingBaseAccessor) player).getIsJumping();
|
||||
float verticalMultiplier = InfinityArmorAbilityResolver.getFlightVerticalModifier(chest, player);
|
||||
float accelerationScale = resolveVerticalAccelerationScale(verticalMultiplier);
|
||||
if (jumping && player.motionY > 0 && player.motionY < 2) {
|
||||
player.motionY *= accelerationScale;
|
||||
} else if (player.isSneaking() && player.motionY < 0 && player.motionY > -2) {
|
||||
player.motionY *= accelerationScale;
|
||||
}
|
||||
}
|
||||
|
||||
private void applyFlightInertia(EntityPlayer player) {
|
||||
ItemStack chest = getInfinityArmor(player, 2);
|
||||
if (chest == null || player.moveForward != 0F || player.moveStrafing != 0F) {
|
||||
return;
|
||||
}
|
||||
|
||||
boolean inertiaCancellation = InfinityArmorAbilityResolver.getFlightState(chest)[2];
|
||||
if (inertiaCancellation) {
|
||||
player.motionX *= 0.5D;
|
||||
player.motionZ *= 0.5D;
|
||||
}
|
||||
}
|
||||
|
||||
private ItemStack getInfinityArmor(EntityPlayer player, int armorSlot) {
|
||||
ItemStack armor = player.getCurrentArmor(armorSlot);
|
||||
if (armor == null) {
|
||||
return null;
|
||||
}
|
||||
return armor.getItem() == LudicrousItems.infinity_armor || armor.getItem() == LudicrousItems.infinity_helm
|
||||
|| armor.getItem() == LudicrousItems.infinity_pants
|
||||
|| armor.getItem() == LudicrousItems.infinity_shoes ? armor : null;
|
||||
}
|
||||
|
||||
private String playerKey(EntityPlayer player) {
|
||||
return player.getGameProfile().getName() + ":" + player.worldObj.isRemote;
|
||||
}
|
||||
|
||||
private float resolveJumpBonus(float configuredValue) {
|
||||
return Compat.draconicEvolution ? configuredValue : BASE_JUMP_BOOST;
|
||||
}
|
||||
|
||||
private float resolveFlySpeed(float configuredValue) {
|
||||
if (Compat.draconicEvolution) {
|
||||
return BASE_FLY_SPEED * (1.0F + configuredValue);
|
||||
}
|
||||
return BASE_FLY_SPEED + (BASE_FLY_SPEED * LEGACY_FLIGHT_SPEED_BONUS);
|
||||
}
|
||||
|
||||
private float resolveHorizontalSpeed(float configuredValue, boolean flying, boolean sneaking) {
|
||||
float speed = Compat.draconicEvolution ? BASE_WALK_SPEED * configuredValue : BASE_WALK_SPEED;
|
||||
if (flying) {
|
||||
speed *= 1.1F;
|
||||
}
|
||||
if (sneaking) {
|
||||
speed *= 0.1F;
|
||||
}
|
||||
return speed;
|
||||
}
|
||||
|
||||
private float resolveVerticalAccelerationScale(float configuredValue) {
|
||||
if (Compat.draconicEvolution) {
|
||||
return configuredValue <= 0F ? 1.0F : 1.5F + (configuredValue * 0.1F);
|
||||
}
|
||||
return 1.5F + (LEGACY_VERTICAL_ACCELERATION * 0.1F);
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package fox.spiteful.avaritia.compat.draconicevolution;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import fox.spiteful.avaritia.items.LudicrousItems;
|
||||
|
||||
public class InfinityArmorSetConfigHelpers {
|
||||
|
||||
private InfinityArmorSetConfigHelpers() {}
|
||||
|
||||
public static boolean isInfinitySetEquipped(EntityPlayer player) {
|
||||
return LudicrousItems.isInfinite(player);
|
||||
}
|
||||
|
||||
public static boolean isDamageImmune(EntityPlayer player) {
|
||||
ItemStack chest = player.getEquipmentInSlot(3);
|
||||
if (chest == null || chest.getItem() != LudicrousItems.infinity_armor) {
|
||||
return false;
|
||||
}
|
||||
return InfinityArmorConfigHelpers.getBoolean(chest, InfinityArmorConfigKeys.ARMOR_DAMAGE_IMMUNITY, true);
|
||||
}
|
||||
|
||||
public static boolean isDeathImmune(EntityPlayer player) {
|
||||
ItemStack chest = player.getEquipmentInSlot(3);
|
||||
if (chest == null || chest.getItem() != LudicrousItems.infinity_armor) {
|
||||
return false;
|
||||
}
|
||||
return InfinityArmorConfigHelpers.getBoolean(chest, InfinityArmorConfigKeys.ARMOR_DEATH_IMMUNITY, true);
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package fox.spiteful.avaritia.compat.draconicevolution;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.utils.IConfigurableItem;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
|
||||
public class InfinityConfigProfileBridge {
|
||||
|
||||
private InfinityConfigProfileBridge() {}
|
||||
|
||||
@Optional.Method(modid = "DraconicEvolution")
|
||||
public static boolean getBoolean(ItemStack stack, String key, boolean defaultValue) {
|
||||
return IConfigurableItem.ProfileHelper.getBoolean(stack, key, defaultValue);
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "DraconicEvolution")
|
||||
public static float getFloat(ItemStack stack, String key, float defaultValue) {
|
||||
return IConfigurableItem.ProfileHelper.getFloat(stack, key, defaultValue);
|
||||
}
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
package fox.spiteful.avaritia.compat.draconicevolution;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.utils.ItemConfigField;
|
||||
|
||||
public class InfinityToolConfigFactory {
|
||||
|
||||
private InfinityToolConfigFactory() {}
|
||||
|
||||
public static List<ItemConfigField> createSwordFields(ItemStack stack, int slot) {
|
||||
List<ItemConfigField> fields = new ArrayList<>();
|
||||
fields.add(
|
||||
new ItemConfigField(References.BOOLEAN_ID, slot, InfinityToolConfigKeys.SWORD_EXECUTION_ENABLED)
|
||||
.readFromItem(stack, true));
|
||||
fields.add(
|
||||
new ItemConfigField(References.BOOLEAN_ID, slot, InfinityToolConfigKeys.SWORD_CREATIVE_BYPASS_ENABLED)
|
||||
.readFromItem(stack, true));
|
||||
fields.add(
|
||||
new ItemConfigField(References.FLOAT_ID, slot, InfinityToolConfigKeys.SWORD_ATTACK_DAMAGE)
|
||||
.setMinMaxAndIncromente(1F, 10000F, 1F).readFromItem(stack, 1000F));
|
||||
return fields;
|
||||
}
|
||||
|
||||
public static List<ItemConfigField> createPickaxeFields(ItemStack stack, int slot) {
|
||||
List<ItemConfigField> fields = new ArrayList<>();
|
||||
fields.add(
|
||||
new ItemConfigField(References.BOOLEAN_ID, slot, InfinityToolConfigKeys.PICKAXE_HAMMER_ENABLED)
|
||||
.readFromItem(stack, true));
|
||||
fields.add(
|
||||
new ItemConfigField(References.FLOAT_ID, slot, InfinityToolConfigKeys.PICKAXE_HAMMER_RANGE)
|
||||
.setMinMaxAndIncromente(1F, 16F, 1F).readFromItem(stack, 8F));
|
||||
return fields;
|
||||
}
|
||||
|
||||
public static List<ItemConfigField> createAxeFields(ItemStack stack, int slot) {
|
||||
List<ItemConfigField> fields = new ArrayList<>();
|
||||
fields.add(
|
||||
new ItemConfigField(References.BOOLEAN_ID, slot, InfinityToolConfigKeys.AXE_VEIN_ENABLED)
|
||||
.readFromItem(stack, true));
|
||||
fields.add(
|
||||
new ItemConfigField(References.FLOAT_ID, slot, InfinityToolConfigKeys.AXE_CLEAVE_RANGE)
|
||||
.setMinMaxAndIncromente(1F, 24F, 1F).readFromItem(stack, 13F));
|
||||
return fields;
|
||||
}
|
||||
|
||||
public static List<ItemConfigField> createShovelFields(ItemStack stack, int slot) {
|
||||
List<ItemConfigField> fields = new ArrayList<>();
|
||||
fields.add(
|
||||
new ItemConfigField(References.BOOLEAN_ID, slot, InfinityToolConfigKeys.SHOVEL_DESTROYER_ENABLED)
|
||||
.readFromItem(stack, true));
|
||||
fields.add(
|
||||
new ItemConfigField(References.FLOAT_ID, slot, InfinityToolConfigKeys.SHOVEL_DESTROYER_RANGE)
|
||||
.setMinMaxAndIncromente(1F, 16F, 1F).readFromItem(stack, 8F));
|
||||
return fields;
|
||||
}
|
||||
|
||||
public static List<ItemConfigField> createBowFields(ItemStack stack, int slot) {
|
||||
List<ItemConfigField> fields = new ArrayList<>();
|
||||
fields.add(
|
||||
new ItemConfigField(References.BOOLEAN_ID, slot, InfinityToolConfigKeys.BOW_RAPID_FIRE_ENABLED)
|
||||
.readFromItem(stack, true));
|
||||
fields.add(
|
||||
new ItemConfigField(References.BOOLEAN_ID, slot, InfinityToolConfigKeys.BOW_SWORD_RAIN_ENABLED)
|
||||
.readFromItem(stack, true));
|
||||
return fields;
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package fox.spiteful.avaritia.compat.draconicevolution;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import fox.spiteful.avaritia.compat.Compat;
|
||||
|
||||
public class InfinityToolConfigHelpers {
|
||||
|
||||
private InfinityToolConfigHelpers() {}
|
||||
|
||||
public static boolean getBoolean(ItemStack stack, String key, boolean defaultValue) {
|
||||
if (!Compat.draconicEvolution || stack == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
return InfinityConfigProfileBridge.getBoolean(stack, key, defaultValue);
|
||||
}
|
||||
|
||||
public static int getInteger(ItemStack stack, String key, int defaultValue) {
|
||||
if (!Compat.draconicEvolution || stack == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
return Math.round(InfinityConfigProfileBridge.getFloat(stack, key, defaultValue));
|
||||
}
|
||||
|
||||
public static float getFloat(ItemStack stack, String key, float defaultValue) {
|
||||
if (!Compat.draconicEvolution || stack == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
return InfinityConfigProfileBridge.getFloat(stack, key, defaultValue);
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package fox.spiteful.avaritia.compat.draconicevolution;
|
||||
|
||||
public class InfinityToolConfigKeys {
|
||||
|
||||
public static final String SWORD_ATTACK_DAMAGE = "AvaritiaSwordAttackDamage";
|
||||
public static final String SWORD_EXECUTION_ENABLED = "AvaritiaSwordExecutionEnabled";
|
||||
public static final String SWORD_CREATIVE_BYPASS_ENABLED = "AvaritiaSwordCreativeBypassEnabled";
|
||||
public static final String PICKAXE_HAMMER_ENABLED = "AvaritiaPickaxeHammerEnabled";
|
||||
public static final String PICKAXE_HAMMER_RANGE = "AvaritiaPickaxeHammerRange";
|
||||
public static final String AXE_VEIN_ENABLED = "AvaritiaAxeVeinEnabled";
|
||||
public static final String AXE_CLEAVE_RANGE = "AvaritiaAxeCleaveRange";
|
||||
public static final String SHOVEL_DESTROYER_ENABLED = "AvaritiaShovelDestroyerEnabled";
|
||||
public static final String SHOVEL_DESTROYER_RANGE = "AvaritiaShovelDestroyerRange";
|
||||
public static final String BOW_RAPID_FIRE_ENABLED = "AvaritiaBowRapidFireEnabled";
|
||||
public static final String BOW_SWORD_RAIN_ENABLED = "AvaritiaBowSwordRainEnabled";
|
||||
|
||||
private InfinityToolConfigKeys() {}
|
||||
}
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
package fox.spiteful.avaritia.compat.draconicevolution;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import fox.spiteful.avaritia.compat.Compat;
|
||||
|
||||
public class InfinityToolRuntimeHelpers {
|
||||
|
||||
private static final float LEGACY_SWORD_DAMAGE = Float.MAX_VALUE;
|
||||
|
||||
private InfinityToolRuntimeHelpers() {}
|
||||
|
||||
public static float getSwordDamage(ItemStack stack) {
|
||||
if (!Compat.draconicEvolution) {
|
||||
return LEGACY_SWORD_DAMAGE;
|
||||
}
|
||||
return InfinityToolConfigHelpers.getFloat(stack, InfinityToolConfigKeys.SWORD_ATTACK_DAMAGE, 1000F);
|
||||
}
|
||||
|
||||
public static boolean isSwordExecutionEnabled(ItemStack stack) {
|
||||
if (!Compat.draconicEvolution) {
|
||||
return true;
|
||||
}
|
||||
return InfinityToolConfigHelpers.getBoolean(stack, InfinityToolConfigKeys.SWORD_EXECUTION_ENABLED, true);
|
||||
}
|
||||
|
||||
public static boolean isSwordCreativeBypassEnabled(ItemStack stack) {
|
||||
if (!Compat.draconicEvolution) {
|
||||
return true;
|
||||
}
|
||||
return InfinityToolConfigHelpers.getBoolean(stack, InfinityToolConfigKeys.SWORD_CREATIVE_BYPASS_ENABLED, true);
|
||||
}
|
||||
|
||||
public static boolean isPickaxeHammerEnabled(ItemStack stack) {
|
||||
if (!Compat.draconicEvolution) {
|
||||
return true;
|
||||
}
|
||||
return InfinityToolConfigHelpers.getBoolean(stack, InfinityToolConfigKeys.PICKAXE_HAMMER_ENABLED, true);
|
||||
}
|
||||
|
||||
public static int getPickaxeHammerRange(ItemStack stack) {
|
||||
if (!Compat.draconicEvolution) {
|
||||
return 8;
|
||||
}
|
||||
return InfinityToolConfigHelpers.getInteger(stack, InfinityToolConfigKeys.PICKAXE_HAMMER_RANGE, 8);
|
||||
}
|
||||
|
||||
public static boolean isAxeVeinEnabled(ItemStack stack) {
|
||||
if (!Compat.draconicEvolution) {
|
||||
return true;
|
||||
}
|
||||
return InfinityToolConfigHelpers.getBoolean(stack, InfinityToolConfigKeys.AXE_VEIN_ENABLED, true);
|
||||
}
|
||||
|
||||
public static int getAxeCleaveRange(ItemStack stack) {
|
||||
if (!Compat.draconicEvolution) {
|
||||
return 13;
|
||||
}
|
||||
return InfinityToolConfigHelpers.getInteger(stack, InfinityToolConfigKeys.AXE_CLEAVE_RANGE, 13);
|
||||
}
|
||||
|
||||
public static boolean isShovelDestroyerEnabled(ItemStack stack) {
|
||||
if (!Compat.draconicEvolution) {
|
||||
return true;
|
||||
}
|
||||
return InfinityToolConfigHelpers.getBoolean(stack, InfinityToolConfigKeys.SHOVEL_DESTROYER_ENABLED, true);
|
||||
}
|
||||
|
||||
public static int getShovelDestroyerRange(ItemStack stack) {
|
||||
if (!Compat.draconicEvolution) {
|
||||
return 8;
|
||||
}
|
||||
return InfinityToolConfigHelpers.getInteger(stack, InfinityToolConfigKeys.SHOVEL_DESTROYER_RANGE, 8);
|
||||
}
|
||||
|
||||
public static boolean isBowRapidFireEnabled(ItemStack stack) {
|
||||
if (!Compat.draconicEvolution) {
|
||||
return true;
|
||||
}
|
||||
return InfinityToolConfigHelpers.getBoolean(stack, InfinityToolConfigKeys.BOW_RAPID_FIRE_ENABLED, true);
|
||||
}
|
||||
|
||||
public static boolean isBowSwordRainEnabled(ItemStack stack) {
|
||||
if (!Compat.draconicEvolution) {
|
||||
return true;
|
||||
}
|
||||
return InfinityToolConfigHelpers.getBoolean(stack, InfinityToolConfigKeys.BOW_SWORD_RAIN_ENABLED, true);
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import net.minecraft.world.World;
|
||||
public class EntityHeavenArrow extends EntityArrow {
|
||||
|
||||
public boolean impacted = false;
|
||||
public boolean swordRainEnabled = true;
|
||||
public Random randy = new Random();
|
||||
|
||||
public EntityHeavenArrow(World world, double x, double y, double z) {
|
||||
@@ -41,7 +42,7 @@ public class EntityHeavenArrow extends EntityArrow {
|
||||
}
|
||||
|
||||
if (this.impacted) {
|
||||
if (!this.worldObj.isRemote) {
|
||||
if (!this.worldObj.isRemote && this.swordRainEnabled) {
|
||||
this.barrage();
|
||||
}
|
||||
}
|
||||
@@ -56,6 +57,7 @@ public class EntityHeavenArrow extends EntityArrow {
|
||||
public void writeEntityToNBT(NBTTagCompound tag) {
|
||||
super.writeEntityToNBT(tag);
|
||||
tag.setBoolean("impacted", this.impacted);
|
||||
tag.setBoolean("swordRainEnabled", this.swordRainEnabled);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -65,6 +67,11 @@ public class EntityHeavenArrow extends EntityArrow {
|
||||
public void readEntityFromNBT(NBTTagCompound tag) {
|
||||
super.readEntityFromNBT(tag);
|
||||
this.impacted = tag.getBoolean("impacted");
|
||||
this.swordRainEnabled = !tag.hasKey("swordRainEnabled") || tag.getBoolean("swordRainEnabled");
|
||||
}
|
||||
|
||||
public void setSwordRainEnabled(boolean swordRainEnabled) {
|
||||
this.swordRainEnabled = swordRainEnabled;
|
||||
}
|
||||
|
||||
public void barrage() {
|
||||
|
||||
@@ -5,12 +5,8 @@ import static net.minecraft.util.EnumChatFormatting.DARK_PURPLE;
|
||||
import static net.minecraft.util.EnumChatFormatting.ITALIC;
|
||||
import static net.minecraft.util.EnumChatFormatting.RESET;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -20,30 +16,30 @@ import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.EnumHelper;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.items.armor.ICustomArmor;
|
||||
import com.brandon3055.draconicevolution.common.utils.IConfigurableItem;
|
||||
import com.brandon3055.draconicevolution.common.utils.ItemConfigField;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
import fox.spiteful.avaritia.Config;
|
||||
import fox.spiteful.avaritia.LudicrousText;
|
||||
import fox.spiteful.avaritia.compat.Compat;
|
||||
import fox.spiteful.avaritia.compat.draconicevolution.InfinityArmorAbilityResolver;
|
||||
import fox.spiteful.avaritia.compat.draconicevolution.InfinityArmorConfigFactory;
|
||||
import fox.spiteful.avaritia.compat.draconicevolution.InfinityArmorEffectHandler;
|
||||
import fox.spiteful.avaritia.entity.EntityImmortalItem;
|
||||
import fox.spiteful.avaritia.mixins.early.minecraft.EntityLivingBaseAccessor;
|
||||
import fox.spiteful.avaritia.render.ICosmicRenderItem;
|
||||
import fox.spiteful.avaritia.render.ModelArmorInfinity;
|
||||
import gregtech.api.hazards.Hazard;
|
||||
import gregtech.api.hazards.IHazardProtector;
|
||||
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
||||
import thaumcraft.api.IGoggles;
|
||||
import thaumcraft.api.IVisDiscountGear;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
@@ -58,9 +54,15 @@ import vazkii.botania.api.mana.IManaDiscountArmor;
|
||||
@Optional.Interface(iface = "vazkii.botania.api.item.IPhantomInkable", modid = "Botania"),
|
||||
@Optional.Interface(iface = "vazkii.botania.api.mana.IManaDiscountArmor", modid = "Botania"),
|
||||
@Optional.Interface(iface = "vazkii.botania.api.item.IManaProficiencyArmor", modid = "Botania"),
|
||||
@Optional.Interface(
|
||||
iface = "com.brandon3055.draconicevolution.common.utils.IConfigurableItem",
|
||||
modid = "DraconicEvolution"),
|
||||
@Optional.Interface(
|
||||
iface = "com.brandon3055.draconicevolution.common.items.armor.ICustomArmor",
|
||||
modid = "DraconicEvolution"),
|
||||
@Optional.Interface(iface = "gregtech.api.hazards.IHazardProtector", modid = "gregtech_nh") })
|
||||
public class ItemArmorInfinity extends ItemArmor implements ICosmicRenderItem, IGoggles, IRevealer, IVisDiscountGear,
|
||||
IPhantomInkable, IManaDiscountArmor, IManaProficiencyArmor, IHazardProtector {
|
||||
IPhantomInkable, IManaDiscountArmor, IManaProficiencyArmor, IHazardProtector, IConfigurableItem, ICustomArmor {
|
||||
|
||||
public static final ArmorMaterial infinite_armor = EnumHelper
|
||||
.addArmorMaterial("infinity", 9999, new int[] { 6, 16, 12, 6 }, 1000);
|
||||
@@ -87,28 +89,19 @@ public class ItemArmorInfinity extends ItemArmor implements ICosmicRenderItem, I
|
||||
|
||||
@Override
|
||||
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
|
||||
if (armorType == 0) {
|
||||
player.setAir(300);
|
||||
player.getFoodStats().addStats(20, 20F);
|
||||
} else if (armorType == 1) {
|
||||
Collection<PotionEffect> effects = player.getActivePotionEffects();
|
||||
if (effects.isEmpty()) return;
|
||||
InfinityArmorEffectHandler.handleArmorTick(player, itemStack, armorType);
|
||||
}
|
||||
|
||||
IntArrayList bad = null;
|
||||
for (PotionEffect potion : effects) {
|
||||
if (Potion.potionTypes[potion.getPotionID()].isBadEffect) {
|
||||
if (bad == null) bad = new IntArrayList();
|
||||
bad.add(potion.getPotionID());
|
||||
}
|
||||
}
|
||||
@Optional.Method(modid = "DraconicEvolution")
|
||||
@Override
|
||||
public List<ItemConfigField> getFields(ItemStack stack, int slot) {
|
||||
return InfinityArmorConfigFactory.createFields(stack, slot, armorType);
|
||||
}
|
||||
|
||||
if (bad == null || bad.isEmpty()) return;
|
||||
for (int potionID : bad) {
|
||||
player.removePotionEffect(potionID);
|
||||
}
|
||||
} else if (armorType == 2) {
|
||||
if (player.isBurning()) player.extinguish();
|
||||
}
|
||||
@Optional.Method(modid = "DraconicEvolution")
|
||||
@Override
|
||||
public boolean hasProfiles() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -223,98 +216,89 @@ public class ItemArmorInfinity extends ItemArmor implements ICosmicRenderItem, I
|
||||
return false;
|
||||
}
|
||||
|
||||
public static class AbilityHandler {
|
||||
@Optional.Method(modid = "DraconicEvolution")
|
||||
@Override
|
||||
public float getProtectionPoints(ItemStack stack) {
|
||||
return 0F;
|
||||
}
|
||||
|
||||
private static final Set<String> playersWithChest = new HashSet<>();
|
||||
private static final Set<String> playersWithFoot = new HashSet<>();
|
||||
@Optional.Method(modid = "DraconicEvolution")
|
||||
@Override
|
||||
public int getRecoveryPoints(ItemStack stack) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static boolean playerHasHat(EntityPlayer player) {
|
||||
ItemStack armour = player.getCurrentArmor(3);
|
||||
return armour != null && armour.getItem() == LudicrousItems.infinity_helm;
|
||||
}
|
||||
@Optional.Method(modid = "DraconicEvolution")
|
||||
@Override
|
||||
public float getSpeedModifier(ItemStack stack, EntityPlayer player) {
|
||||
return InfinityArmorAbilityResolver.getSpeedModifier(stack, player);
|
||||
}
|
||||
|
||||
public static boolean playerHasChest(EntityPlayer player) {
|
||||
ItemStack armour = player.getCurrentArmor(2);
|
||||
return armour != null && armour.getItem() == LudicrousItems.infinity_armor;
|
||||
}
|
||||
@Optional.Method(modid = "DraconicEvolution")
|
||||
@Override
|
||||
public float getJumpModifier(ItemStack stack, EntityPlayer player) {
|
||||
return InfinityArmorAbilityResolver.getJumpModifier(stack, player);
|
||||
}
|
||||
|
||||
public static boolean playerHasLeg(EntityPlayer player) {
|
||||
ItemStack armour = player.getCurrentArmor(1);
|
||||
return armour != null && armour.getItem() == LudicrousItems.infinity_pants;
|
||||
}
|
||||
@Optional.Method(modid = "DraconicEvolution")
|
||||
@Override
|
||||
public boolean hasHillStep(ItemStack stack, EntityPlayer player) {
|
||||
return InfinityArmorAbilityResolver.hasHillStep(stack, player);
|
||||
}
|
||||
|
||||
public static boolean playerHasFoot(EntityPlayer player) {
|
||||
ItemStack armour = player.getCurrentArmor(0);
|
||||
return armour != null && armour.getItem() == LudicrousItems.infinity_shoes;
|
||||
}
|
||||
@Optional.Method(modid = "DraconicEvolution")
|
||||
@Override
|
||||
public float getFireResistance(ItemStack stack) {
|
||||
return 1F;
|
||||
}
|
||||
|
||||
public static String playerKey(EntityPlayer player) {
|
||||
return player.getGameProfile().getName() + ":" + player.worldObj.isRemote;
|
||||
}
|
||||
@Optional.Method(modid = "DraconicEvolution")
|
||||
@Override
|
||||
public boolean[] hasFlight(ItemStack stack) {
|
||||
return armorType == 1 ? InfinityArmorAbilityResolver.getFlightState(stack)
|
||||
: new boolean[] { false, false, false };
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void updatePlayerAbilityStatus(LivingUpdateEvent event) {
|
||||
if (!(event.entityLiving instanceof EntityPlayer player)) return;
|
||||
@Optional.Method(modid = "DraconicEvolution")
|
||||
@Override
|
||||
public float getFlightSpeedModifier(ItemStack stack, EntityPlayer player) {
|
||||
return armorType == 1 ? InfinityArmorAbilityResolver.getFlightSpeedModifier(stack, player) : 0F;
|
||||
}
|
||||
|
||||
String key = playerKey(player);
|
||||
@Optional.Method(modid = "DraconicEvolution")
|
||||
@Override
|
||||
public float getFlightVModifier(ItemStack stack, EntityPlayer player) {
|
||||
return armorType == 1 ? InfinityArmorAbilityResolver.getFlightVerticalModifier(stack, player) : 0F;
|
||||
}
|
||||
|
||||
// chest
|
||||
boolean hasChest = playerHasChest(player);
|
||||
if (hasChest) {
|
||||
player.capabilities.allowFlying = true;
|
||||
playersWithChest.add(key);
|
||||
} else if (playersWithChest.remove(key)) {
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
player.capabilities.allowFlying = false;
|
||||
player.capabilities.isFlying = false;
|
||||
}
|
||||
}
|
||||
@Optional.Method(modid = "DraconicEvolution")
|
||||
@Override
|
||||
public int getEnergyPerProtectionPoint() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// shoes
|
||||
boolean hasFoot = Config.fast && playerHasFoot(player);
|
||||
if (hasFoot) {
|
||||
boolean flying = player.capabilities.isFlying;
|
||||
boolean swimming = player.isInsideOfMaterial(Material.water) || player.isInWater();
|
||||
if (player.onGround || flying || swimming) {
|
||||
boolean sneaking = player.isSneaking();
|
||||
if (Config.stepUp) player.stepHeight = sneaking ? 0.501f : 1.001f;
|
||||
@Optional.Method(modid = "DraconicEvolution")
|
||||
@Override
|
||||
public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
float speed = 0.15f * (flying ? 1.1f : 1.0f) * (sneaking ? 0.1f : 1.0f);
|
||||
@Optional.Method(modid = "DraconicEvolution")
|
||||
@Override
|
||||
public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (player.moveForward > 0f) {
|
||||
player.moveFlying(0f, 1f, speed);
|
||||
} else if (player.moveForward < 0f) {
|
||||
player.moveFlying(0f, 1f, -speed * 0.3f);
|
||||
}
|
||||
@Optional.Method(modid = "DraconicEvolution")
|
||||
@Override
|
||||
public int getEnergyStored(ItemStack container) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (player.moveStrafing != 0f) {
|
||||
player.moveFlying(1f, 0f, speed * 0.5f * Math.signum(player.moveStrafing));
|
||||
}
|
||||
|
||||
// +50% speed up and down when flying
|
||||
if (flying) {
|
||||
boolean jumping = ((EntityLivingBaseAccessor) player).getIsJumping();
|
||||
if (jumping && player.motionY > 0 && player.motionY < 2) {
|
||||
player.motionY *= 1.5f;
|
||||
} else if (sneaking && player.motionY < 0 && player.motionY > -2) {
|
||||
player.motionY *= 1.5f;
|
||||
}
|
||||
}
|
||||
}
|
||||
playersWithFoot.add(key);
|
||||
} else if (playersWithFoot.remove(key)) {
|
||||
if (Config.stepUp) player.stepHeight = 0.5f;
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void jumpBoost(LivingJumpEvent event) {
|
||||
if (event.entityLiving instanceof EntityPlayer player) {
|
||||
if (playerHasFoot(player)) {
|
||||
player.motionY += 0.4f;
|
||||
}
|
||||
}
|
||||
}
|
||||
@Optional.Method(modid = "DraconicEvolution")
|
||||
@Override
|
||||
public int getMaxEnergyStored(ItemStack container) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// GT5 Hazmat protection
|
||||
|
||||
@@ -12,6 +12,7 @@ import net.minecraftforge.common.util.EnumHelper;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
import fox.spiteful.avaritia.Config;
|
||||
import fox.spiteful.avaritia.compat.draconicevolution.InfinityArmorRuntimeHandler;
|
||||
import fox.spiteful.avaritia.items.tools.ItemAxeInfinity;
|
||||
import fox.spiteful.avaritia.items.tools.ItemBowInfinity;
|
||||
import fox.spiteful.avaritia.items.tools.ItemPickaxeInfinity;
|
||||
@@ -92,7 +93,7 @@ public class LudicrousItems {
|
||||
infinity_axe = register(new ItemAxeInfinity(), "Infinity_Axe");
|
||||
// morv_in_a_box = register(new ItemMorvInABox(), "MorvInABox");
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(new ItemArmorInfinity.AbilityHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new InfinityArmorRuntimeHandler());
|
||||
}
|
||||
|
||||
public static boolean isInfinite(EntityPlayer player) {
|
||||
|
||||
@@ -27,14 +27,23 @@ import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.common.util.EnumHelper;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.utils.IConfigurableItem;
|
||||
import com.brandon3055.draconicevolution.common.utils.ItemConfigField;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
import fox.spiteful.avaritia.compat.draconicevolution.InfinityToolConfigFactory;
|
||||
import fox.spiteful.avaritia.compat.draconicevolution.InfinityToolRuntimeHelpers;
|
||||
import fox.spiteful.avaritia.entity.EntityImmortalItem;
|
||||
import fox.spiteful.avaritia.items.LudicrousItems;
|
||||
|
||||
public class ItemAxeInfinity extends ItemAxe {
|
||||
@Optional.Interface(
|
||||
iface = "com.brandon3055.draconicevolution.common.utils.IConfigurableItem",
|
||||
modid = "DraconicEvolution")
|
||||
public class ItemAxeInfinity extends ItemAxe implements IConfigurableItem {
|
||||
|
||||
private static final ToolMaterial opAxe = EnumHelper
|
||||
.addToolMaterial("INFINITY_PICKAXE", 32, 9999, 9999F, 20.0F, 200);
|
||||
@@ -68,12 +77,12 @@ public class ItemAxeInfinity extends ItemAxe {
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
if (player.isSneaking()) {
|
||||
if (player.isSneaking() && InfinityToolRuntimeHelpers.isAxeVeinEnabled(stack)) {
|
||||
player.swingItem();
|
||||
int fortune = EnchantmentHelper.getFortuneModifier(player);
|
||||
boolean silk = EnchantmentHelper.getSilkTouchModifier(player);
|
||||
|
||||
int range = 13;
|
||||
int range = InfinityToolRuntimeHelpers.getAxeCleaveRange(stack);
|
||||
|
||||
ToolHelper.removeBlocksInIteration(
|
||||
player,
|
||||
@@ -99,6 +108,9 @@ public class ItemAxeInfinity extends ItemAxe {
|
||||
|
||||
@Override
|
||||
public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPlayer player) {
|
||||
if (!InfinityToolRuntimeHelpers.isAxeVeinEnabled(stack)) {
|
||||
return false;
|
||||
}
|
||||
MovingObjectPosition raycast = ToolHelper.raytraceFromEntity(player.worldObj, player, true, 10);
|
||||
if (raycast != null) {
|
||||
breakOtherBlock(player, stack, x, y, z, x, y, z, raycast.sideHit);
|
||||
@@ -110,7 +122,16 @@ public class ItemAxeInfinity extends ItemAxe {
|
||||
int originZ, int side) {
|
||||
if (player.isSneaking()) return;
|
||||
ChunkCoordinates coords = new ChunkCoordinates(x, y, z);
|
||||
addBlockSwapper(player.worldObj, player, stack, coords, coords, 32, false, true, new ArrayList<>());
|
||||
addBlockSwapper(
|
||||
player.worldObj,
|
||||
player,
|
||||
stack,
|
||||
coords,
|
||||
coords,
|
||||
InfinityToolRuntimeHelpers.getAxeCleaveRange(stack) * 2 + 6,
|
||||
false,
|
||||
true,
|
||||
new ArrayList<>());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -128,6 +149,18 @@ public class ItemAxeInfinity extends ItemAxe {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "DraconicEvolution")
|
||||
@Override
|
||||
public List<ItemConfigField> getFields(ItemStack stack, int slot) {
|
||||
return InfinityToolConfigFactory.createAxeFields(stack, slot);
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "DraconicEvolution")
|
||||
@Override
|
||||
public boolean hasProfiles() {
|
||||
return true;
|
||||
}
|
||||
|
||||
private static BlockSwapper addBlockSwapper(World world, EntityPlayer player, ItemStack stack,
|
||||
ChunkCoordinates origCoords, ChunkCoordinates coords, int steps, boolean leaves, boolean force,
|
||||
List<String> posChecked) {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package fox.spiteful.avaritia.items.tools;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
@@ -14,14 +16,27 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.player.ArrowNockEvent;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.utils.IConfigurableItem;
|
||||
import com.brandon3055.draconicevolution.common.utils.ItemConfigField;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
import fox.spiteful.avaritia.compat.draconicevolution.InfinityToolConfigFactory;
|
||||
import fox.spiteful.avaritia.compat.draconicevolution.InfinityToolRuntimeHelpers;
|
||||
import fox.spiteful.avaritia.entity.EntityHeavenArrow;
|
||||
import fox.spiteful.avaritia.render.CosmicBowRenderer;
|
||||
import fox.spiteful.avaritia.render.ICosmicRenderItem;
|
||||
|
||||
public class ItemBowInfinity extends Item implements ICosmicRenderItem {
|
||||
@Optional.Interface(
|
||||
iface = "com.brandon3055.draconicevolution.common.utils.IConfigurableItem",
|
||||
modid = "DraconicEvolution")
|
||||
public class ItemBowInfinity extends Item implements ICosmicRenderItem, IConfigurableItem {
|
||||
|
||||
private static final int RAPID_FIRE_USE_DURATION = 13;
|
||||
private static final int STANDARD_BOW_USE_DURATION = 72000;
|
||||
private static final int BOW_FRAME_COUNT = 3;
|
||||
|
||||
private IIcon[] iconArray;
|
||||
private IIcon[] maskArray;
|
||||
@@ -42,20 +57,22 @@ public class ItemBowInfinity extends Item implements ICosmicRenderItem {
|
||||
|
||||
@Override
|
||||
public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer player, int useCount) {
|
||||
// this.fire(stack, world, player, useCount);
|
||||
if (!InfinityToolRuntimeHelpers.isBowRapidFireEnabled(stack)) {
|
||||
this.fire(stack, world, player, useCount);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUsingTick(ItemStack stack, EntityPlayer player, int count) {
|
||||
if (count == 1) {
|
||||
this.fire(stack, player.worldObj, player, 0);
|
||||
if (InfinityToolRuntimeHelpers.isBowRapidFireEnabled(stack) && count == 1) {
|
||||
this.fire(stack, player.worldObj, player, count);
|
||||
player.setItemInUse(stack, RAPID_FIRE_USE_DURATION);
|
||||
}
|
||||
}
|
||||
|
||||
public void fire(ItemStack stack, World world, EntityPlayer player, int useCount) {
|
||||
int max = this.getMaxItemUseDuration(stack);
|
||||
float maxf = (float) max;
|
||||
int j = max - useCount;
|
||||
float maxf = (float) RAPID_FIRE_USE_DURATION;
|
||||
int j = getDrawProgress(stack, useCount);
|
||||
|
||||
/*
|
||||
* ArrowLooseEvent event = new ArrowLooseEvent(player, stack, j); MinecraftForge.EVENT_BUS.post(event); if
|
||||
@@ -78,6 +95,9 @@ public class ItemBowInfinity extends Item implements ICosmicRenderItem {
|
||||
}
|
||||
|
||||
EntityArrow entityarrow = new EntityHeavenArrow(world, player, f * 2.0F);
|
||||
if (entityarrow instanceof EntityHeavenArrow heavenArrow) {
|
||||
heavenArrow.setSwordRainEnabled(InfinityToolRuntimeHelpers.isBowSwordRainEnabled(stack));
|
||||
}
|
||||
entityarrow.setDamage(60.0);
|
||||
|
||||
if (f == 1.0F) {
|
||||
@@ -117,7 +137,8 @@ public class ItemBowInfinity extends Item implements ICosmicRenderItem {
|
||||
|
||||
@Override
|
||||
public int getMaxItemUseDuration(ItemStack stack) {
|
||||
return 13;
|
||||
return InfinityToolRuntimeHelpers.isBowRapidFireEnabled(stack) ? RAPID_FIRE_USE_DURATION
|
||||
: STANDARD_BOW_USE_DURATION;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -134,7 +155,6 @@ public class ItemBowInfinity extends Item implements ICosmicRenderItem {
|
||||
}
|
||||
|
||||
player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
@@ -161,13 +181,12 @@ public class ItemBowInfinity extends Item implements ICosmicRenderItem {
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
|
||||
if (usingItem != null) {
|
||||
int max = stack.getMaxItemUseDuration();
|
||||
int pull = max - useRemaining;
|
||||
if (pull >= (max * 2) / 3.0) {
|
||||
int pull = getDrawProgress(stack, useRemaining);
|
||||
if (pull >= (RAPID_FIRE_USE_DURATION * 2) / 3.0) {
|
||||
return this.iconArray[2];
|
||||
}
|
||||
|
||||
if (pull > max / 3.0) {
|
||||
if (pull > RAPID_FIRE_USE_DURATION / 3.0) {
|
||||
return this.iconArray[1];
|
||||
}
|
||||
|
||||
@@ -208,4 +227,32 @@ public class ItemBowInfinity extends Item implements ICosmicRenderItem {
|
||||
public float getMaskMultiplier(ItemStack stack, EntityPlayer player) {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "DraconicEvolution")
|
||||
@Override
|
||||
public List<ItemConfigField> getFields(ItemStack stack, int slot) {
|
||||
return InfinityToolConfigFactory.createBowFields(stack, slot);
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "DraconicEvolution")
|
||||
@Override
|
||||
public boolean hasProfiles() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static int getDrawProgress(ItemStack stack, int useRemaining) {
|
||||
int maxUseDuration = InfinityToolRuntimeHelpers.isBowRapidFireEnabled(stack) ? RAPID_FIRE_USE_DURATION
|
||||
: STANDARD_BOW_USE_DURATION;
|
||||
int elapsedTicks = maxUseDuration - useRemaining;
|
||||
return Math.max(0, Math.min(RAPID_FIRE_USE_DURATION, elapsedTicks));
|
||||
}
|
||||
|
||||
public static int getDrawFrame(ItemStack stack, int useRemaining) {
|
||||
int progress = getDrawProgress(stack, useRemaining);
|
||||
if (progress <= 0) {
|
||||
return 0;
|
||||
}
|
||||
double ratio = progress / (double) RAPID_FIRE_USE_DURATION;
|
||||
return Math.max(0, Math.min(BOW_FRAME_COUNT - 1, (int) Math.ceil(ratio * BOW_FRAME_COUNT) - 1));
|
||||
}
|
||||
}
|
||||
@@ -24,13 +24,22 @@ import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.common.util.EnumHelper;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.utils.IConfigurableItem;
|
||||
import com.brandon3055.draconicevolution.common.utils.ItemConfigField;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
import fox.spiteful.avaritia.compat.draconicevolution.InfinityToolConfigFactory;
|
||||
import fox.spiteful.avaritia.compat.draconicevolution.InfinityToolRuntimeHelpers;
|
||||
import fox.spiteful.avaritia.entity.EntityImmortalItem;
|
||||
import fox.spiteful.avaritia.items.LudicrousItems;
|
||||
|
||||
public class ItemPickaxeInfinity extends ItemPickaxe {
|
||||
@Optional.Interface(
|
||||
iface = "com.brandon3055.draconicevolution.common.utils.IConfigurableItem",
|
||||
modid = "DraconicEvolution")
|
||||
public class ItemPickaxeInfinity extends ItemPickaxe implements IConfigurableItem {
|
||||
|
||||
private static final ToolMaterial opPickaxe = EnumHelper
|
||||
.addToolMaterial("INFINITY_PICKAXE", 32, 9999, 9999F, 6.0F, 200);
|
||||
@@ -99,7 +108,7 @@ public class ItemPickaxeInfinity extends ItemPickaxe {
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
if (player.isSneaking()) {
|
||||
if (player.isSneaking() && InfinityToolRuntimeHelpers.isPickaxeHammerEnabled(stack)) {
|
||||
NBTTagCompound tags = stack.getTagCompound();
|
||||
if (tags == null) {
|
||||
tags = new NBTTagCompound();
|
||||
@@ -133,7 +142,8 @@ public class ItemPickaxeInfinity extends ItemPickaxe {
|
||||
|
||||
@Override
|
||||
public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPlayer player) {
|
||||
if (stack.getTagCompound() != null && stack.getTagCompound().getBoolean("hammer")) {
|
||||
if (InfinityToolRuntimeHelpers.isPickaxeHammerEnabled(stack) && stack.getTagCompound() != null
|
||||
&& stack.getTagCompound().getBoolean("hammer")) {
|
||||
MovingObjectPosition raycast = ToolHelper.raytraceFromEntity(player.worldObj, player, true, 10);
|
||||
if (raycast != null) {
|
||||
breakOtherBlock(player, stack, x, y, z, x, y, z, raycast.sideHit);
|
||||
@@ -156,7 +166,7 @@ public class ItemPickaxeInfinity extends ItemPickaxe {
|
||||
boolean silk = EnchantmentHelper.getSilkTouchModifier(player);
|
||||
boolean doY = direction.offsetY == 0;
|
||||
|
||||
int range = 8;
|
||||
int range = InfinityToolRuntimeHelpers.getPickaxeHammerRange(stack);
|
||||
|
||||
ToolHelper.removeBlocksInIteration(
|
||||
player,
|
||||
@@ -194,4 +204,16 @@ public class ItemPickaxeInfinity extends ItemPickaxe {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "DraconicEvolution")
|
||||
@Override
|
||||
public List<ItemConfigField> getFields(ItemStack stack, int slot) {
|
||||
return InfinityToolConfigFactory.createPickaxeFields(stack, slot);
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "DraconicEvolution")
|
||||
@Override
|
||||
public boolean hasProfiles() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package fox.spiteful.avaritia.items.tools;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -17,13 +19,22 @@ import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.common.util.EnumHelper;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.utils.IConfigurableItem;
|
||||
import com.brandon3055.draconicevolution.common.utils.ItemConfigField;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
import fox.spiteful.avaritia.compat.draconicevolution.InfinityToolConfigFactory;
|
||||
import fox.spiteful.avaritia.compat.draconicevolution.InfinityToolRuntimeHelpers;
|
||||
import fox.spiteful.avaritia.entity.EntityImmortalItem;
|
||||
import fox.spiteful.avaritia.items.LudicrousItems;
|
||||
|
||||
public class ItemShovelInfinity extends ItemSpade {
|
||||
@Optional.Interface(
|
||||
iface = "com.brandon3055.draconicevolution.common.utils.IConfigurableItem",
|
||||
modid = "DraconicEvolution")
|
||||
public class ItemShovelInfinity extends ItemSpade implements IConfigurableItem {
|
||||
|
||||
public static final ToolMaterial opShovel = EnumHelper
|
||||
.addToolMaterial("INFINITY_SHOVEL", 32, 9999, 9999F, 7.0F, 200);
|
||||
@@ -81,7 +92,7 @@ public class ItemShovelInfinity extends ItemSpade {
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
if (player.isSneaking()) {
|
||||
if (player.isSneaking() && InfinityToolRuntimeHelpers.isShovelDestroyerEnabled(stack)) {
|
||||
NBTTagCompound tags = stack.getTagCompound();
|
||||
if (tags == null) {
|
||||
tags = new NBTTagCompound();
|
||||
@@ -95,7 +106,8 @@ public class ItemShovelInfinity extends ItemSpade {
|
||||
|
||||
@Override
|
||||
public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPlayer player) {
|
||||
if (stack.getTagCompound() != null && stack.getTagCompound().getBoolean("destroyer")) {
|
||||
if (InfinityToolRuntimeHelpers.isShovelDestroyerEnabled(stack) && stack.getTagCompound() != null
|
||||
&& stack.getTagCompound().getBoolean("destroyer")) {
|
||||
MovingObjectPosition raycast = ToolHelper.raytraceFromEntity(player.worldObj, player, true, 10);
|
||||
if (raycast != null) {
|
||||
breakOtherBlock(player, stack, x, y, z, x, y, z, raycast.sideHit);
|
||||
@@ -118,7 +130,7 @@ public class ItemShovelInfinity extends ItemSpade {
|
||||
boolean silk = EnchantmentHelper.getSilkTouchModifier(player);
|
||||
boolean doY = direction.offsetY == 0;
|
||||
|
||||
int range = 8;
|
||||
int range = InfinityToolRuntimeHelpers.getShovelDestroyerRange(stack);
|
||||
|
||||
ToolHelper.removeBlocksInIteration(
|
||||
player,
|
||||
@@ -156,4 +168,16 @@ public class ItemShovelInfinity extends ItemSpade {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "DraconicEvolution")
|
||||
@Override
|
||||
public List<ItemConfigField> getFields(ItemStack stack, int slot) {
|
||||
return InfinityToolConfigFactory.createShovelFields(stack, slot);
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "DraconicEvolution")
|
||||
@Override
|
||||
public boolean hasProfiles() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package fox.spiteful.avaritia.items.tools;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -12,17 +14,26 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.EnumHelper;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.utils.IConfigurableItem;
|
||||
import com.brandon3055.draconicevolution.common.utils.ItemConfigField;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
import fox.spiteful.avaritia.DamageSourceInfinitySword;
|
||||
import fox.spiteful.avaritia.achievements.Achievements;
|
||||
import fox.spiteful.avaritia.compat.Belmont;
|
||||
import fox.spiteful.avaritia.compat.draconicevolution.InfinityToolConfigFactory;
|
||||
import fox.spiteful.avaritia.compat.draconicevolution.InfinityToolRuntimeHelpers;
|
||||
import fox.spiteful.avaritia.entity.EntityImmortalItem;
|
||||
import fox.spiteful.avaritia.items.LudicrousItems;
|
||||
import fox.spiteful.avaritia.render.ICosmicRenderItem;
|
||||
|
||||
public class ItemSwordInfinity extends ItemSword implements ICosmicRenderItem {
|
||||
@Optional.Interface(
|
||||
iface = "com.brandon3055.draconicevolution.common.utils.IConfigurableItem",
|
||||
modid = "DraconicEvolution")
|
||||
public class ItemSwordInfinity extends ItemSword implements ICosmicRenderItem, IConfigurableItem {
|
||||
|
||||
private static final ToolMaterial opSword = EnumHelper
|
||||
.addToolMaterial("INFINITY_SWORD", 32, 9999, 9999F, -3.0F, 200);
|
||||
@@ -39,6 +50,8 @@ public class ItemSwordInfinity extends ItemSword implements ICosmicRenderItem {
|
||||
@Override
|
||||
public boolean hitEntity(ItemStack stack, EntityLivingBase victim, EntityLivingBase player) {
|
||||
if (player.worldObj.isRemote) return true;
|
||||
float attackDamage = InfinityToolRuntimeHelpers.getSwordDamage(stack);
|
||||
boolean executionEnabled = InfinityToolRuntimeHelpers.isSwordExecutionEnabled(stack);
|
||||
if (victim instanceof EntityPlayer pvp) {
|
||||
if (LudicrousItems.isInfinite(pvp)) {
|
||||
if (Belmont.isVampire(pvp)) victim.attackEntityFrom(
|
||||
@@ -55,9 +68,13 @@ public class ItemSwordInfinity extends ItemSword implements ICosmicRenderItem {
|
||||
victim.recentlyHit = 60;
|
||||
victim.func_110142_aN() // getCombatTracker
|
||||
.func_94547_a(new DamageSourceInfinitySword(player), victim.getHealth(), victim.getHealth());
|
||||
victim.setHealth(0);
|
||||
if (Belmont.isVampire(victim)) victim.onDeath(new EntityDamageSource("infinity", player).setFireDamage());
|
||||
else victim.onDeath(new EntityDamageSource("infinity", player));
|
||||
if (executionEnabled && attackDamage >= victim.getHealth()) {
|
||||
victim.setHealth(0);
|
||||
if (Belmont.isVampire(victim)) victim.onDeath(new EntityDamageSource("infinity", player).setFireDamage());
|
||||
else victim.onDeath(new EntityDamageSource("infinity", player));
|
||||
return true;
|
||||
}
|
||||
victim.attackEntityFrom(new DamageSourceInfinitySword(player).setDamageBypassesArmor(), attackDamage);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -66,6 +83,7 @@ public class ItemSwordInfinity extends ItemSword implements ICosmicRenderItem {
|
||||
if (!entity.worldObj.isRemote && entity instanceof EntityPlayer victim) {
|
||||
if (victim.capabilities.isCreativeMode && !victim.isDead
|
||||
&& victim.getHealth() > 0
|
||||
&& InfinityToolRuntimeHelpers.isSwordCreativeBypassEnabled(stack)
|
||||
&& !LudicrousItems.isInfinite(victim)) {
|
||||
victim.func_110142_aN() // getCombatTracker
|
||||
.func_94547_a(new DamageSourceInfinitySword(player), victim.getHealth(), victim.getHealth());
|
||||
@@ -135,4 +153,16 @@ public class ItemSwordInfinity extends ItemSword implements ICosmicRenderItem {
|
||||
public boolean hasEffect(ItemStack par1ItemStack, int pass) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "DraconicEvolution")
|
||||
@Override
|
||||
public List<ItemConfigField> getFields(ItemStack stack, int slot) {
|
||||
return InfinityToolConfigFactory.createSwordFields(stack, slot);
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "DraconicEvolution")
|
||||
@Override
|
||||
public boolean hasProfiles() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,8 @@ import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import fox.spiteful.avaritia.items.tools.ItemBowInfinity;
|
||||
|
||||
public class CosmicBowRenderer extends CosmicItemRenderer implements IItemRenderer {
|
||||
|
||||
@Override
|
||||
@@ -25,6 +27,9 @@ public class CosmicBowRenderer extends CosmicItemRenderer implements IItemRender
|
||||
public static int getBowFrame(EntityPlayer player) {
|
||||
ItemStack inuse = player.getItemInUse();
|
||||
|
||||
if (inuse != null && inuse.getItem() instanceof ItemBowInfinity) {
|
||||
return ItemBowInfinity.getDrawFrame(inuse, player.getItemInUseCount());
|
||||
}
|
||||
if (inuse != null) {
|
||||
int max = inuse.getMaxItemUseDuration();
|
||||
double pull = (max - player.getItemInUseCount()) / (double) max;
|
||||
|
||||
@@ -158,6 +158,23 @@ material.avaritia_neutronium=Neutronium
|
||||
material.avaritia_neutronium.ability=Supermassive
|
||||
material.avaritia_infinitymetal=Infinity
|
||||
material.avaritia_infinitymetal.ability=Cosmic
|
||||
button.de.AvaritiaArmorAutoFeed.name=Auto Feed
|
||||
button.de.AvaritiaArmorDamageImmunity.name=Damage Immunity
|
||||
button.de.AvaritiaArmorDeathImmunity.name=Death Immunity
|
||||
button.de.AvaritiaArmorExtinguish.name=Auto Extinguish
|
||||
button.de.AvaritiaArmorRemoveNegative.name=Remove Negative Effects
|
||||
button.de.AvaritiaArmorWaterBreathing.name=Water Breathing
|
||||
button.de.AvaritiaSwordExecutionEnabled.name=Sword Execution Enabled
|
||||
button.de.AvaritiaSwordCreativeBypassEnabled.name=Sword Creative Bypass Enabled
|
||||
button.de.AvaritiaSwordAttackDamage.name=Sword Attack Damage
|
||||
button.de.AvaritiaPickaxeHammerEnabled.name=Pickaxe Hammer Enabled
|
||||
button.de.AvaritiaPickaxeHammerRange.name=Pickaxe Hammer Range
|
||||
button.de.AvaritiaAxeVeinEnabled.name=Axe Vein Enabled
|
||||
button.de.AvaritiaAxeCleaveRange.name=Axe Cleave Range
|
||||
button.de.AvaritiaShovelDestroyerEnabled.name=Shovel Destroyer Enabled
|
||||
button.de.AvaritiaShovelDestroyerRange.name=Shovel Destroyer Range
|
||||
button.de.AvaritiaBowRapidFireEnabled.name=Bow Rapid Fire Enabled
|
||||
button.de.AvaritiaBowSwordRainEnabled.name=Bow Sword Rain Enabled
|
||||
#
|
||||
# Beeeeeeeeeeeees
|
||||
avaritia.bee.annoying=Annoying
|
||||
|
||||
@@ -146,6 +146,23 @@ material.avaritia_neutronium=宇宙中子态素
|
||||
material.avaritia_neutronium.ability=千斤坠沉
|
||||
material.avaritia_infinitymetal=无尽
|
||||
material.avaritia_infinitymetal.ability=寰宇
|
||||
button.de.AvaritiaArmorAutoFeed.name=自动饱食
|
||||
button.de.AvaritiaArmorDamageImmunity.name=伤害免疫
|
||||
button.de.AvaritiaArmorDeathImmunity.name=死亡免疫
|
||||
button.de.AvaritiaArmorExtinguish.name=自动灭火
|
||||
button.de.AvaritiaArmorRemoveNegative.name=清除负面效果
|
||||
button.de.AvaritiaArmorWaterBreathing.name=水下呼吸
|
||||
button.de.AvaritiaSwordExecutionEnabled.name=剑处决开关
|
||||
button.de.AvaritiaSwordCreativeBypassEnabled.name=剑创造绕过开关
|
||||
button.de.AvaritiaSwordAttackDamage.name=剑伤害
|
||||
button.de.AvaritiaPickaxeHammerEnabled.name=镐锤模式开关
|
||||
button.de.AvaritiaPickaxeHammerRange.name=镐锤范围
|
||||
button.de.AvaritiaAxeVeinEnabled.name=斧连锁开关
|
||||
button.de.AvaritiaAxeCleaveRange.name=斧连锁范围
|
||||
button.de.AvaritiaShovelDestroyerEnabled.name=铲破坏模式开关
|
||||
button.de.AvaritiaShovelDestroyerRange.name=铲破坏范围
|
||||
button.de.AvaritiaBowRapidFireEnabled.name=弓连发开关
|
||||
button.de.AvaritiaBowSwordRainEnabled.name=弓剑雨开关
|
||||
#
|
||||
# Beeeeeeeeeeeees
|
||||
avaritia.bee.annoying=嘈杂
|
||||
|
||||
Reference in new issue
Block a user