mirror of
https://github.com/GTNewHorizons/Electro-Magic-Tools.git
synced 2026-11-25 22:34:31 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6b3eaa9474 | ||
|
|
af69e17dfe | ||
|
|
568fc2c64f | ||
|
|
46fa64f4f7 | ||
|
|
893d79e147 | ||
|
|
4920c605bc |
No files matched your search
+2
-2
@@ -1,7 +1,7 @@
|
||||
// Add your dependencies here
|
||||
|
||||
dependencies {
|
||||
api('com.github.GTNewHorizons:Baubles-Expanded:2.1.13-GTNH:dev')
|
||||
api('com.github.GTNewHorizons:Baubles-Expanded:2.1.16-GTNH:dev')
|
||||
api('com.github.GTNewHorizons:ModularUI:1.2.20:dev')
|
||||
api('com.github.GTNewHorizons:ThaumicBoots:1.4.14:dev') {
|
||||
exclude group: 'com.github.GTNewHorizons', module: 'Electro-Magic-Tools'
|
||||
@@ -11,5 +11,5 @@ dependencies {
|
||||
api('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev')
|
||||
api('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
|
||||
|
||||
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.51.440:dev')
|
||||
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.51.474:dev')
|
||||
}
|
||||
+1
-1
@@ -17,7 +17,7 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.41'
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.44'
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ public class EMT_GT_Loader {
|
||||
GTValues.RA.stdBuilder()
|
||||
.itemInputs(
|
||||
new ItemStack(Items.book),
|
||||
GTOreDictUnificator.get(OrePrefixes.circuit, Materials.Basic, 1L),
|
||||
GTOreDictUnificator.get(OrePrefixes.circuit, Materials.LV, 1L),
|
||||
new ItemStack(ConfigItems.itemShard, 1, OreDictionary.WILDCARD_VALUE))
|
||||
.itemOutputs(mkbook()).duration(6 * SECONDS).eut(TierEU.RECIPE_MV / 2).addTo(assemblerRecipes);
|
||||
}
|
||||
|
||||
@@ -43,6 +43,28 @@ public class ItemElectricGoggles extends ItemArmor
|
||||
this.setCreativeTab(EMT.TAB);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow damage to be set to avoid breaking IC2 Energy bar or other features, while preventing the item from
|
||||
* breaking.
|
||||
*
|
||||
* @param stack the item stack
|
||||
* @param damage the new damage value
|
||||
*/
|
||||
@Override
|
||||
public void setDamage(ItemStack stack, int damage) {
|
||||
int max = stack.getMaxDamage();
|
||||
|
||||
if (max > 0) {
|
||||
if (damage >= max) {
|
||||
damage = max - 1;
|
||||
} else if (damage < 0) {
|
||||
damage = 0;
|
||||
}
|
||||
}
|
||||
|
||||
super.setDamage(stack, damage);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
|
||||
@@ -17,13 +17,5 @@ public class EMTDungeonChestGenerator {
|
||||
1,
|
||||
EMTConfigHandler.chanceTaintedMjolnir));
|
||||
}
|
||||
if (!EMTConfigHandler.oneRingSpawn) {
|
||||
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(
|
||||
new WeightedRandomChestContent(
|
||||
new ItemStack(EMTItems.onering),
|
||||
0,
|
||||
1,
|
||||
EMTConfigHandler.chanceOneRing));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,6 @@ import cpw.mods.fml.common.gameevent.TickEvent.Phase;
|
||||
import emt.EMT;
|
||||
import emt.init.EMTBlocks;
|
||||
import emt.init.EMTItems;
|
||||
import emt.item.armor.goggles.ItemElectricGoggles;
|
||||
import emt.item.armor.wings.ItemFeatherWing;
|
||||
import ic2.api.item.ElectricItem;
|
||||
import thaumcraft.common.config.ConfigBlocks;
|
||||
@@ -29,49 +28,21 @@ import thaumcraft.common.entities.monster.EntityTaintChicken;
|
||||
public class EMTEventHandler {
|
||||
|
||||
/**
|
||||
* Intercepts damage events for any living entity to apply custom effects for players wearing specific armor. This
|
||||
* method is a central handler for armor-based damage mitigation that cannot be handled by the ISpecialArmor
|
||||
* interface.
|
||||
* <p>
|
||||
* It triggers whenever an entity is about to be hurt and contains two primary logic blocks:
|
||||
* <ol>
|
||||
* <li>Reduces fall damage for players wearing Feather Wings.</li>
|
||||
* <li>Absorbs anvil/falling block damage for players wearing Electric Goggles, preventing the item from breaking
|
||||
* due to a hardcoded vanilla mechanic.</li>
|
||||
* </ol>
|
||||
*
|
||||
* @param e The LivingHurtEvent, containing information about the damage source, amount, and the entity being hurt.
|
||||
* Intercept the onLivingHurt event so that we can mitigate fall damage with feather wings
|
||||
*
|
||||
* @param e Entity that is being damaged
|
||||
*/
|
||||
@SubscribeEvent
|
||||
public void onLivingHurt(LivingHurtEvent e) {
|
||||
if (!(e.entityLiving instanceof EntityPlayer player)) {
|
||||
if (!(e.entityLiving instanceof EntityPlayer) || e.source != DamageSource.fall) return;
|
||||
|
||||
ItemStack s = ((EntityPlayer) e.entityLiving).inventory.armorInventory[2];
|
||||
|
||||
if (s == null || !(s.getItem() instanceof ItemFeatherWing)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.source == DamageSource.fall) {
|
||||
ItemStack chestplate = player.inventory.armorInventory[2];
|
||||
if (chestplate != null && chestplate.getItem() instanceof ItemFeatherWing) {
|
||||
e.ammount *= ((ItemFeatherWing) chestplate.getItem()).getFallDamageMult();
|
||||
}
|
||||
}
|
||||
|
||||
else if (e.source == DamageSource.anvil || e.source == DamageSource.fallingBlock) {
|
||||
ItemStack helmet = player.getEquipmentInSlot(4); // 4 for Helmet
|
||||
|
||||
if (helmet != null && helmet.getItem() instanceof ItemElectricGoggles goggles) {
|
||||
double energyRequired = e.ammount * goggles.getEnergyPerDamage();
|
||||
double currentEnergy = ElectricItem.manager.getCharge(helmet);
|
||||
|
||||
if (currentEnergy >= energyRequired) {
|
||||
ElectricItem.manager.discharge(helmet, energyRequired, Integer.MAX_VALUE, true, false, false);
|
||||
e.setCanceled(true);
|
||||
} else if (currentEnergy > 0) {
|
||||
float damageAbsorbed = (float) (currentEnergy / goggles.getEnergyPerDamage());
|
||||
ElectricItem.manager.discharge(helmet, currentEnergy, Integer.MAX_VALUE, true, false, false);
|
||||
e.ammount -= damageAbsorbed;
|
||||
}
|
||||
}
|
||||
}
|
||||
e.ammount *= ((ItemFeatherWing) s.getItem()).getFallDamageMult();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
||||
Reference in new issue
Block a user