diff --git a/src/main/java/ru/dbotthepony/mc/otm/Registry.java b/src/main/java/ru/dbotthepony/mc/otm/Registry.java index 413a533be..fcda56757 100644 --- a/src/main/java/ru/dbotthepony/mc/otm/Registry.java +++ b/src/main/java/ru/dbotthepony/mc/otm/Registry.java @@ -28,6 +28,7 @@ import net.minecraftforge.registries.RegistryBuilder; import ru.dbotthepony.mc.otm.android.AndroidFeature; import ru.dbotthepony.mc.otm.android.AndroidResearchBuilder; import ru.dbotthepony.mc.otm.android.AndroidResearchType; +import ru.dbotthepony.mc.otm.android.feature.AndroidExtendedReach; import ru.dbotthepony.mc.otm.android.feature.AndroidLimbOverclocking; import ru.dbotthepony.mc.otm.android.feature.AndroidNanobotsArmor; import ru.dbotthepony.mc.otm.android.feature.AndroidNanobotsRegeneration; @@ -221,6 +222,8 @@ public class Registry { public static final ResourceLocation HYDRAULICS_OVERLOAD_2 = new ResourceLocation(OverdriveThatMatters.MOD_ID, "hydraulics_overload_2"); public static final ResourceLocation HYDRAULICS_OVERLOAD_3 = new ResourceLocation(OverdriveThatMatters.MOD_ID, "hydraulics_overload_3"); + public static final ResourceLocation EXTENDED_REACH = new ResourceLocation(OverdriveThatMatters.MOD_ID, "extended_reach"); + // stats public static final ResourceLocation DAMAGE_ABSORBED = new ResourceLocation(OverdriveThatMatters.MOD_ID, "damage_absorbed"); public static final ResourceLocation HEALTH_REGENERATED = new ResourceLocation(OverdriveThatMatters.MOD_ID, "health_regenerated"); @@ -639,12 +642,14 @@ public class Registry { public static final AndroidFeatureType LIMB_OVERCLOCKING = new AndroidFeatureType<>(AndroidLimbOverclocking::new); public static final AndroidFeatureType NANOBOTS_REGENERATION = new AndroidFeatureType<>(AndroidNanobotsRegeneration::new); public static final AndroidFeatureType NANOBOTS_ARMOR = new AndroidFeatureType<>(AndroidNanobotsArmor::new); + public static final AndroidFeatureType EXTENDED_REACH = new AndroidFeatureType<>(AndroidExtendedReach::new); static { AIR_BAGS.setRegistryName(Names.AIR_BAGS); LIMB_OVERCLOCKING.setRegistryName(Names.LIMB_OVERCLOCKING); NANOBOTS_REGENERATION.setRegistryName(Names.NANOBOTS_REGENERATION); NANOBOTS_ARMOR.setRegistryName(Names.NANOBOTS_ARMOR); + EXTENDED_REACH.setRegistryName(Names.EXTENDED_REACH); } @SubscribeEvent @@ -653,6 +658,7 @@ public class Registry { event.getRegistry().register(LIMB_OVERCLOCKING); event.getRegistry().register(NANOBOTS_REGENERATION); event.getRegistry().register(NANOBOTS_ARMOR); + event.getRegistry().register(EXTENDED_REACH); } } @@ -725,6 +731,14 @@ public class Registry { .withIcon(ICON_AIR_BAGS) .build(); + public static final AndroidResearchType EXTENDED_REACH = + new AndroidResearchBuilder() + .setExperienceCost(40) + .addFeatureResult(AndroidFeatures.EXTENDED_REACH) + .withDescription() + .withIcon(ICON_UNKNOWN) + .build(); + public static final AndroidResearchType[] LIMB_OVERCLOCKING = new AndroidResearchType[4]; public static final AndroidResearchType[] NANOBOTS_REGENERATION = new AndroidResearchType[4]; public static final AndroidResearchType[] NANOBOTS_ARMOR_STRENGTH = new AndroidResearchType[3]; @@ -750,6 +764,7 @@ public class Registry { AIR_BAGS.setRegistryName(Names.AIR_BAGS); NANOBOTS.setRegistryName(Names.NANOBOTS); NANOBOTS_ARMOR.setRegistryName(Names.NANOBOTS_ARMOR); + EXTENDED_REACH.setRegistryName(Names.EXTENDED_REACH); for (int i = 0; i < 4; i++) { var limbs = new AndroidResearchBuilder() @@ -834,6 +849,7 @@ public class Registry { event.getRegistry().register(AIR_BAGS); event.getRegistry().register(NANOBOTS); event.getRegistry().register(NANOBOTS_ARMOR); + event.getRegistry().register(EXTENDED_REACH); event.getRegistry().register(LIMB_OVERCLOCKING[0]); event.getRegistry().register(LIMB_OVERCLOCKING[1]); diff --git a/src/main/java/ru/dbotthepony/mc/otm/android/feature/AndroidExtendedReach.java b/src/main/java/ru/dbotthepony/mc/otm/android/feature/AndroidExtendedReach.java new file mode 100644 index 000000000..60695778e --- /dev/null +++ b/src/main/java/ru/dbotthepony/mc/otm/android/feature/AndroidExtendedReach.java @@ -0,0 +1,37 @@ +package ru.dbotthepony.mc.otm.android.feature; + +import net.minecraft.world.entity.ai.attributes.AttributeModifier; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraftforge.common.ForgeMod; +import ru.dbotthepony.mc.otm.android.AndroidFeature; +import ru.dbotthepony.mc.otm.android.AndroidFeatureType; +import ru.dbotthepony.mc.otm.capability.android.IAndroidCapability; + +import java.util.UUID; + +public class AndroidExtendedReach extends AndroidFeature { + public static final UUID MODIFIER_ID = UUID.fromString("4a3fae46-47a8-a03f-857d-f5c2b2c8f2f2"); + + public AndroidExtendedReach(AndroidFeatureType type, IAndroidCapability capability) { + super(type, capability); + } + + @Override + public void applyModifiers() { + var reach = capability.getEntity().getAttribute(ForgeMod.REACH_DISTANCE.get()); + + if (reach != null) { + reach.removePermanentModifier(MODIFIER_ID); + reach.addPermanentModifier(new AttributeModifier(MODIFIER_ID, type.getDisplayName().toString(), level + 1, AttributeModifier.Operation.ADDITION)); + } + } + + @Override + public void removeModifiers() { + var reach = capability.getEntity().getAttribute(ForgeMod.REACH_DISTANCE.get()); + + if (reach != null) { + reach.removePermanentModifier(MODIFIER_ID); + } + } +} diff --git a/src/main/resources/assets/overdrive_that_matters/lang/en_us.json b/src/main/resources/assets/overdrive_that_matters/lang/en_us.json index ec295c4e9..c6a183f6f 100644 --- a/src/main/resources/assets/overdrive_that_matters/lang/en_us.json +++ b/src/main/resources/assets/overdrive_that_matters/lang/en_us.json @@ -85,6 +85,9 @@ "android_research.overdrive_that_matters.nanobots_armor_strength": "Nanobots armor strength %s", "android_research.overdrive_that_matters.nanobots_armor_strength.description": "Increases impact absorption strength of nanobots", + "android_research.overdrive_that_matters.extended_reach": "Extended Reach", + "android_research.overdrive_that_matters.extended_reach.description": "Increases block interaction distance", + "stat.overdrive_that_matters.health_regenerated": "Damage Regenerated by Nanobots", "stat.overdrive_that_matters.damage_absorbed": "Damage Absorbed by Nanobots", "stat.overdrive_that_matters.power_consumed": "MtE Burnt as Android",