Android extended reach

This commit is contained in:
DBotThePony 2021-09-10 09:49:02 +07:00
parent 3358b5247e
commit 54facf02c6
Signed by: DBot
GPG Key ID: DCC23B5715498507
3 changed files with 56 additions and 0 deletions

View File

@ -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<AndroidLimbOverclocking> LIMB_OVERCLOCKING = new AndroidFeatureType<>(AndroidLimbOverclocking::new);
public static final AndroidFeatureType<AndroidNanobotsRegeneration> NANOBOTS_REGENERATION = new AndroidFeatureType<>(AndroidNanobotsRegeneration::new);
public static final AndroidFeatureType<AndroidNanobotsArmor> NANOBOTS_ARMOR = new AndroidFeatureType<>(AndroidNanobotsArmor::new);
public static final AndroidFeatureType<AndroidExtendedReach> 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<ru.dbotthepony.mc.otm.android.AndroidResearch> EXTENDED_REACH =
new AndroidResearchBuilder()
.setExperienceCost(40)
.addFeatureResult(AndroidFeatures.EXTENDED_REACH)
.withDescription()
.withIcon(ICON_UNKNOWN)
.build();
public static final AndroidResearchType<ru.dbotthepony.mc.otm.android.AndroidResearch>[] LIMB_OVERCLOCKING = new AndroidResearchType[4];
public static final AndroidResearchType<ru.dbotthepony.mc.otm.android.AndroidResearch>[] NANOBOTS_REGENERATION = new AndroidResearchType[4];
public static final AndroidResearchType<ru.dbotthepony.mc.otm.android.AndroidResearch>[] 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]);

View File

@ -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);
}
}
}

View File

@ -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",