Skip to content

Commit

Permalink
Implement an HDPE Reinforced Elytra and an Elytra Unit for the MekaSu…
Browse files Browse the repository at this point in the history
…it (mekanism/Mekanism-Feature-Requests#103, mekanism/Mekanism-Feature-Requests#55):

- Elytra Unit works with both the Jetpack Unit (when not in hover) and the Gravitational Modulating Unit
- The elytra unit on the MekaSuit also has special handling so that sneaking will exit elytra flight to allow easily switching back to going vertically with a jetpack or free falling if desired
- Also fixed some issues with functions being performed even when there was not quite enough power for the enhanced version of the function
- Fix nutritional injection unit wasting food and energy without transferring it all to the player
  • Loading branch information
pupnewfster committed Jun 15, 2021
1 parent 492fc0f commit 92cb41d
Show file tree
Hide file tree
Showing 30 changed files with 416 additions and 130 deletions.
28 changes: 16 additions & 12 deletions src/api/java/mekanism/api/gear/IModule.java
Expand Up @@ -103,20 +103,22 @@ public interface IModule<MODULE extends ICustomModule<MODULE>> {
* @param energy Energy amount to check.
*
* @return {@code true} if the energy can be used/provided.
*
* @implNote By default this method checks players in creative as well.
*/
boolean canUseEnergy(LivingEntity wearer, FloatingLong energy);

/**
* Helper to check if the item this module is installed on can provide the given amount of energy. If {@code checkCreative} is {@code false} this method will return
* {@code false} for players in creative or spectator.
*
* @param wearer Wearer/User of the item the module is installed on.
* @param energy Energy amount to check.
* @param checkCreative {@code true} to check the item for energy if the wearer is in creative.
* @param wearer Wearer/User of the item the module is installed on.
* @param energy Energy amount to check.
* @param ignoreCreative {@code true} to not check the item for energy if the wearer is in creative and just return {@code false} for player's in creative.
*
* @return {@code true} if the energy can be used/provided.
*/
boolean canUseEnergy(LivingEntity wearer, FloatingLong energy, boolean checkCreative);
boolean canUseEnergy(LivingEntity wearer, FloatingLong energy, boolean ignoreCreative);

/**
* Helper to check if the item this module is installed on can provide the given amount of energy. If the {@code energyContainer} is null this will return {@code
Expand All @@ -125,13 +127,13 @@ public interface IModule<MODULE extends ICustomModule<MODULE>> {
* @param wearer Wearer/User of the item the module is installed on.
* @param energyContainer Energy container, most likely gotten from {@link #getEnergyContainer()}.
* @param energy Energy amount to check.
* @param checkCreative {@code true} to check the item for energy if the wearer is in creative.
* @param ignoreCreative {@code true} to not check the item for energy if the wearer is in creative and just return {@code false} for player's in creative.
*
* @return {@code true} if the energy can be used/provided.
*
* @apiNote This method is mostly for use in not having to lookup the energy container multiple times.
*/
boolean canUseEnergy(LivingEntity wearer, @Nullable IEnergyContainer energyContainer, FloatingLong energy, boolean checkCreative);
boolean canUseEnergy(LivingEntity wearer, @Nullable IEnergyContainer energyContainer, FloatingLong energy, boolean ignoreCreative);

/**
* Helper to use energy from the item this module is installed on.
Expand All @@ -140,20 +142,22 @@ public interface IModule<MODULE extends ICustomModule<MODULE>> {
* @param energy Energy to use.
*
* @return Actual amount of energy used.
*
* @implNote By default this method does not use any energy from players that are in creative.
*/
FloatingLong useEnergy(LivingEntity wearer, FloatingLong energy);

/**
* Helper to use energy from the item this module is installed on. If {@code checkCreative} is {@code false} this method will return {@link FloatingLong#ZERO} for
* players in creative or spectator.
*
* @param wearer Wearer/User of the item the module is installed on.
* @param energy Energy to use.
* @param checkCreative {@code true} to use energy from the item even if the wearer is in creative.
* @param wearer Wearer/User of the item the module is installed on.
* @param energy Energy to use.
* @param freeCreative {@code true} to not use any energy from the item if the wearer is in creative.
*
* @return Actual amount of energy used.
*/
FloatingLong useEnergy(LivingEntity wearer, FloatingLong energy, boolean checkCreative);
FloatingLong useEnergy(LivingEntity wearer, FloatingLong energy, boolean freeCreative);

/**
* Helper to use energy from the given energy container. If the {@code energyContainer} is null this will return {@link FloatingLong#ZERO}. If {@code checkCreative}
Expand All @@ -162,11 +166,11 @@ public interface IModule<MODULE extends ICustomModule<MODULE>> {
* @param wearer Wearer/User of the item the module is installed on.
* @param energyContainer Energy container, most likely gotten from {@link #getEnergyContainer()}.
* @param energy Energy to use.
* @param checkCreative {@code true} to use energy from the item even if the wearer is in creative.
* @param freeCreative {@code true} to not use any energy from the item if the wearer is in creative.
*
* @return Actual amount of energy used.
*
* @apiNote This method is mostly for use in not having to lookup the energy container multiple times.
*/
FloatingLong useEnergy(LivingEntity wearer, @Nullable IEnergyContainer energyContainer, FloatingLong energy, boolean checkCreative);
FloatingLong useEnergy(LivingEntity wearer, @Nullable IEnergyContainer energyContainer, FloatingLong energy, boolean freeCreative);
}
7 changes: 5 additions & 2 deletions src/datagen/generated/mekanism/.cache/cache
Expand Up @@ -23,8 +23,8 @@ d5bd6c407c9250a90e22e1f2c8805738b3830abf assets/mekanism/blockstates/lithium.jso
c1be0ed56a542f711719367cf1e508f10063c695 assets/mekanism/blockstates/sulfuric_acid.json
f5e3eb6799a15d0b72969547614dfc51dac53419 assets/mekanism/blockstates/tin_ore.json
246c1904e7699b01a3a20f2a2b79b35b5d99aec9 assets/mekanism/blockstates/uranium_ore.json
bff13d66c2c444808054fd714fbdde4e460d5914 assets/mekanism/lang/en_ud.json
242e66bbac245cdc2d755c9afd2b8b94f4e742c7 assets/mekanism/lang/en_us.json
2edde9482bb27a819ac81a0593f0dc892d6dd98d assets/mekanism/lang/en_ud.json
a0f0748e02cb40a104e7484107d8acfbd28b59f5 assets/mekanism/lang/en_us.json
beea3be5a8af802be66d456a7a648678bede0f02 assets/mekanism/models/block/brine.json
beea3be5a8af802be66d456a7a648678bede0f02 assets/mekanism/models/block/chlorine.json
beea3be5a8af802be66d456a7a648678bede0f02 assets/mekanism/models/block/ethene.json
Expand Down Expand Up @@ -103,6 +103,7 @@ b5dc4be762e5689f01737622839f952c091567df assets/mekanism/models/item/module_atta
5dfc6e8af46641e44543c891af663e79fa4b7d76 assets/mekanism/models/item/module_charge_distribution_unit.json
b5b9a689ecf04fcc1b28e02f82e2d38fc5499da6 assets/mekanism/models/item/module_dosimeter_unit.json
95e7a4d233ed798641353d9964f8c8d2aa5d6ef4 assets/mekanism/models/item/module_electrolytic_breathing_unit.json
a811586ba8e759fc88ef27a15a8f732ab21b7627 assets/mekanism/models/item/module_elytra_unit.json
f4b051379d68d6b7d4998f21ecf8b311d9c91b3a assets/mekanism/models/item/module_energy_unit.json
19d43d726df4600be44ceb3bb5ba5a8456d07fd9 assets/mekanism/models/item/module_excavation_escalation_unit.json
e9577c89d42121bae7911605af43a62b9329521d assets/mekanism/models/item/module_farming_unit.json
Expand Down Expand Up @@ -1692,6 +1693,7 @@ d82c03f7900fd092bedd0365aa4043b34475e6d2 data/mekanism/recipes/hazmat_boots.json
921f887d9f04e01927a840fba3d9768a42c976f4 data/mekanism/recipes/hazmat_gown.json
e927292d052b0b4898b6d569a63a3a074f693e06 data/mekanism/recipes/hazmat_mask.json
712386bc3388e13f04da23ea25bee16bd594a781 data/mekanism/recipes/hazmat_pants.json
ac34080945e1aa819917e14e9c3519c9de9c7f69 data/mekanism/recipes/hdpe_elytra.json
163b280630711c9320ecdf19a9b835399a5718d3 data/mekanism/recipes/hdpe_rod.json
6879085115d9411909a69e204050e0383e901f3c data/mekanism/recipes/hdpe_sheet.json
9024089e3d778c3a715245c665ec55cba3a49d1f data/mekanism/recipes/hdpe_stick.json
Expand Down Expand Up @@ -1795,6 +1797,7 @@ f9b1db6908d63bafd1e47e1aec7d5a5d6ff5db3c data/mekanism/recipes/module_attack_amp
e360ae1044f926ef0e91ce024c1ad2c36fdf1e84 data/mekanism/recipes/module_charge_distribution_unit.json
710b4c8bbe0ad27bda2c12ab980ef23589de2ebf data/mekanism/recipes/module_dosimeter_unit.json
16f842a6dda3636d748c191160c0ad65361fa8d3 data/mekanism/recipes/module_electrolytic_breathing_unit.json
0b25d63934dc5e413d4dd70f467e8f79e956d064 data/mekanism/recipes/module_elytra_unit.json
8c19327dfddef1bd2b862f819b37052f411822b4 data/mekanism/recipes/module_energy_unit.json
72a4c0c2c4380d3cc74b8ec4297f534191767f25 data/mekanism/recipes/module_excavation_escalation_unit.json
9119a82ec8451c079b9a39d92c9aceca666ffef9 data/mekanism/recipes/module_farming_unit.json
Expand Down
Expand Up @@ -470,6 +470,7 @@
"description.mekanism.electric_pump": "\u02D9p\u1D09n\uA781\u025F \u025Fo \u01DDd\u028E\u0287 \u028Eu\u0250 \u1D77u\u1D09\u0287\u0254\u0250\u0279\u0287x\u01DD \u025Fo \u01DD\uA781q\u0250d\u0250\u0254 'd\u026Fnd \u01DD\uA781q\u0250\u01DDp\u0250\u0279\u1D77dn 'p\u01DD\u0254u\u0250\u028Cp\u0250 u\u2C6F",
"description.mekanism.electrolytic_breathing_unit": "\u02D9\u028E\u0279\u0250ss\u01DD\u0254\u01DDu u\u01DD\u0265\u028D u\u01DD\u1D77o\u0279p\u028E\u0265 \u0265\u0287\u1D09\u028D \u01DD\uA781npo\u026F \u029E\u0254\u0250d\u0287\u01DD\u027E \u0250 \uA781\uA781\u1D09\u025F os\uA781\u0250 \uA781\uA781\u1D09M \u02D9\u0279\u01DD\u0287\u0250\u028D \u026Fo\u0279\u025F u\u01DD\u1D77\u028Exo \u01DD\uA781q\u0250\u0265\u0287\u0250\u01DD\u0279q \u01DD\u0287\u0250\u01DD\u0279\u0254 o\u0287 s\u1D09s\u028E\uA781o\u0279\u0287\u0254\u01DD\uA781\u01DD s\u01DDs\u2229",
"description.mekanism.electrolytic_separator": "\u02D9s\u01DDs\u0250\u1D77 \u0287u\u01DD\u0279\u01DD\u025F\u025F\u1D09p o\u028D\u0287 o\u0287u\u1D09 s\u0250\u1D77 u\u1D09\u0250\u0287\u0279\u01DD\u0254 \u0250 \u0287\u0279\u0250d\u0250 \u0287\u1D09\uA781ds o\u0287 s\u1D09s\u028E\uA781o\u0279\u0287\u0254\u01DD\uA781\u01DD \u025Fo ss\u01DD\u0254o\u0279d \u01DD\u0265\u0287 s\u01DDsn \u0287\u0250\u0265\u0287 \u01DDu\u1D09\u0265\u0254\u0250\u026F \u2C6F",
"description.mekanism.elytra_unit": "\u02D9\u0287\u1D09nS\u0250\u029E\u01DDW \u01DD\u0265\u0287 o\u0287 \u0250\u0279\u0287\u028E\uA781\u018E p\u01DD\u0254\u0279o\u025Fu\u1D09\u01DD\u1D1A \u018E\u0500\u15E1H u\u0250 s\u01DD\u1D09\uA781dd\u2C6F",
"description.mekanism.energized_smelter": "\u02D9\u028E\u1D77\u0279\u01DDu\u01DD \u025Fo \u025F\u025Fo sun\u0279 \u0287\u0250\u0265\u0287 \u01DD\u0254\u0250u\u0279n\u025F p\u01DDs\u0250q-\u026Fs\u1D09u\u0250\u029E\u01DDW \u0250 s\u0250 s\u01DD\u028C\u0279\u01DDs \u0287\u0250\u0265\u0287 \u01DDu\u1D09\u0265\u0254\u0250\u026F \u01DD\uA781d\u026F\u1D09s \u2C6F",
"description.mekanism.energy_cube": "\u02D9\u028E\u1D77\u0279\u01DDu\u01DD \u1D77u\u1D09\u0287nq\u1D09\u0279\u0287s\u1D09p pu\u0250 \u1D77u\u1D09\u0279o\u0287s \u0279o\u025F \u01DD\u0254\u1D09\u028C\u01DDp p\u01DD\u0254u\u0250\u028Cp\u0250 u\u2C6F",
"description.mekanism.energy_unit": "\u02D9\u028E\u0287\u1D09\u0254\u0250d\u0250\u0254 \u028E\u1D77\u0279\u01DDu\u01DD \u026Fn\u026F\u1D09x\u0250\u026F s\u01DDs\u0250\u01DD\u0279\u0254uI",
Expand Down Expand Up @@ -911,6 +912,7 @@
"item.mekanism.hazmat_gown": "u\u028Do\u2141 \u0287\u0250\u026Fz\u0250H",
"item.mekanism.hazmat_mask": "\u029Es\u0250W \u0287\u0250\u026Fz\u0250H",
"item.mekanism.hazmat_pants": "s\u0287u\u0250\u0500 \u0287\u0250\u026Fz\u0250H",
"item.mekanism.hdpe_elytra": "\u0250\u0279\u0287\u028E\uA781\u018E p\u01DD\u0254\u0279o\u025Fu\u1D09\u01DD\u1D1A \u018E\u0500\u15E1H",
"item.mekanism.hdpe_pellet": "\u0287\u01DD\uA781\uA781\u01DD\u0500 \u018E\u0500\u15E1H",
"item.mekanism.hdpe_rod": "po\u1D1A \u018E\u0500\u15E1H",
"item.mekanism.hdpe_sheet": "\u0287\u01DD\u01DD\u0265S \u018E\u0500\u15E1H",
Expand Down Expand Up @@ -1061,6 +1063,7 @@
"module.mekanism.dosimeter_unit": "\u0287\u1D09u\u2229 \u0279\u01DD\u0287\u01DD\u026F\u1D09so\u15E1",
"module.mekanism.efficiency": "\u028E\u0254u\u01DD\u1D09\u0254\u1D09\u025F\u025F\u018E",
"module.mekanism.electrolytic_breathing_unit": "\u0287\u1D09u\u2229 \u1D77u\u1D09\u0265\u0287\u0250\u01DD\u0279\u15FA \u0254\u1D09\u0287\u028E\uA781o\u0279\u0287\u0254\u01DD\uA781\u018E",
"module.mekanism.elytra_unit": "\u0287\u1D09u\u2229 \u0250\u0279\u0287\u028E\uA781\u018E",
"module.mekanism.enabled": "p\u01DD\uA781q\u0250u\u018E",
"module.mekanism.enabled_lower": "p\u01DD\uA781q\u0250u\u01DD",
"module.mekanism.energy_unit": "\u0287\u1D09u\u2229 \u028E\u1D77\u0279\u01DDu\u018E",
Expand Down
Expand Up @@ -470,6 +470,7 @@
"description.mekanism.electric_pump": "An advanced, upgradeable pump, capable of extracting any type of fluid.",
"description.mekanism.electrolytic_breathing_unit": "Uses electrolysis to create breathable oxygen from water. Will also fill a jetpack module with hydrogen when necessary.",
"description.mekanism.electrolytic_separator": "A machine that uses the process of electrolysis to split apart a certain gas into two different gases.",
"description.mekanism.elytra_unit": "Applies an HDPE Reinforced Elytra to the MekaSuit.",
"description.mekanism.energized_smelter": "A simple machine that serves as a Mekanism-based furnace that runs off of energy.",
"description.mekanism.energy_cube": "An advanced device for storing and distributing energy.",
"description.mekanism.energy_unit": "Increases maximum energy capacity.",
Expand Down Expand Up @@ -911,6 +912,7 @@
"item.mekanism.hazmat_gown": "Hazmat Gown",
"item.mekanism.hazmat_mask": "Hazmat Mask",
"item.mekanism.hazmat_pants": "Hazmat Pants",
"item.mekanism.hdpe_elytra": "HDPE Reinforced Elytra",
"item.mekanism.hdpe_pellet": "HDPE Pellet",
"item.mekanism.hdpe_rod": "HDPE Rod",
"item.mekanism.hdpe_sheet": "HDPE Sheet",
Expand Down Expand Up @@ -1061,6 +1063,7 @@
"module.mekanism.dosimeter_unit": "Dosimeter Unit",
"module.mekanism.efficiency": "Efficiency",
"module.mekanism.electrolytic_breathing_unit": "Electrolytic Breathing Unit",
"module.mekanism.elytra_unit": "Elytra Unit",
"module.mekanism.enabled": "Enabled",
"module.mekanism.enabled_lower": "enabled",
"module.mekanism.energy_unit": "Energy Unit",
Expand Down
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "mekanism:item/module_elytra_unit"
}
}
@@ -0,0 +1,22 @@
{
"type": "mekanism:mek_data",
"result": {
"item": "mekanism:hdpe_elytra"
},
"pattern": [
"AHA",
"HPH",
"H H"
],
"key": {
"A": {
"tag": "mekanism:alloys/atomic"
},
"H": {
"item": "mekanism:hdpe_sheet"
},
"P": {
"item": "minecraft:elytra"
}
}
}
@@ -0,0 +1,28 @@
{
"type": "minecraft:crafting_shaped",
"result": {
"item": "mekanism:module_elytra_unit"
},
"pattern": [
"A#A",
"APA",
"HNH"
],
"key": {
"A": {
"tag": "forge:alloys/elite"
},
"P": {
"item": "mekanism:module_base"
},
"#": {
"item": "mekanism:hdpe_elytra"
},
"H": {
"tag": "forge:pellets/polonium"
},
"N": {
"item": "mekanism:pellet_antimatter"
}
}
}
Expand Up @@ -92,6 +92,7 @@ private void addItems() {
add(MekanismItems.FREE_RUNNERS, "Free Runners");
add(MekanismItems.JETPACK, "Jetpack");
add(MekanismItems.ARMORED_JETPACK, "Armored Jetpack");
add(MekanismItems.HDPE_REINFORCED_ELYTRA, "HDPE Reinforced Elytra");
add(MekanismItems.GEIGER_COUNTER, "Geiger Counter");
add(MekanismItems.DOSIMETER, "Dosimeter");
add(MekanismItems.CANTEEN, "Canteen");
Expand Down Expand Up @@ -1274,6 +1275,7 @@ private void addMisc() {
add(MekanismModules.NUTRITIONAL_INJECTION_UNIT, "Nutritional Injection Unit", "Automatically feeds the player Nutritional Paste when hungry.");
add(MekanismModules.JETPACK_UNIT, "Jetpack Unit", "Applies a hydrogen-fueled jetpack to the MekaSuit.");
add(MekanismModules.GRAVITATIONAL_MODULATING_UNIT, "Gravitational Modulating Unit", "Using experimental technologies and the tremendous energy of antimatter, allows the user to defy gravity.");
add(MekanismModules.ELYTRA_UNIT, "Elytra Unit", "Applies an HDPE Reinforced Elytra to the MekaSuit.");
add(MekanismModules.CHARGE_DISTRIBUTION_UNIT, "Charge Distribution Unit", "Evenly distributes charge throughout all worn MekaSuit armor.");
add(MekanismModules.DOSIMETER_UNIT, "Dosimeter Unit", "Displays the user's current radiation dose in the HUD.");
add(MekanismModules.GEIGER_UNIT, "Geiger Unit", "Displays the ambient radiation level in the HUD.");
Expand Down
Expand Up @@ -603,6 +603,16 @@ private void addMiscRecipes(Consumer<IFinishedRecipe> consumer) {
.key(Pattern.STEEL, MekanismTags.Items.STORAGE_BLOCKS_STEEL)
.key(Pattern.CONSTANT, MekanismTags.Items.DUSTS_DIAMOND)
.build(consumer);
//HDPE Elytra
MekDataShapedRecipeBuilder.shapedRecipe(MekanismItems.HDPE_REINFORCED_ELYTRA)
.pattern(RecipePattern.createPattern(
TripleLine.of(Pattern.ALLOY, HDPE_CHAR, Pattern.ALLOY),
TripleLine.of(HDPE_CHAR, Pattern.PREVIOUS, HDPE_CHAR),
TripleLine.of(HDPE_CHAR, Pattern.EMPTY, HDPE_CHAR))
).key(Pattern.ALLOY, MekanismTags.Items.ALLOYS_ATOMIC)
.key(HDPE_CHAR, MekanismItems.HDPE_SHEET)
.key(Pattern.PREVIOUS, Items.ELYTRA)
.build(consumer);
//Laser
MekDataShapedRecipeBuilder.shapedRecipe(MekanismBlocks.LASER)
.pattern(RecipePattern.createPattern(
Expand Down Expand Up @@ -1393,6 +1403,18 @@ private void addGearModuleRecipes(Consumer<IFinishedRecipe> consumer) {
.key(Pattern.ENERGY, MekanismBlocks.ULTIMATE_INDUCTION_PROVIDER)
.key(HDPE_CHAR, MekanismItems.ANTIMATTER_PELLET)
.build(consumer);
//Elytra Unit
ExtendedShapedRecipeBuilder.shapedRecipe(MekanismItems.MODULE_ELYTRA)
.pattern(RecipePattern.createPattern(
TripleLine.of(Pattern.ALLOY, Pattern.CONSTANT, Pattern.ALLOY),
TripleLine.of(Pattern.ALLOY, Pattern.PREVIOUS, Pattern.ALLOY),
TripleLine.of(HDPE_CHAR, Pattern.NUGGET, HDPE_CHAR))
).key(Pattern.ALLOY, MekanismTags.Items.ALLOYS_ELITE)
.key(Pattern.PREVIOUS, MekanismItems.MODULE_BASE)
.key(Pattern.CONSTANT, MekanismItems.HDPE_REINFORCED_ELYTRA)
.key(HDPE_CHAR, MekanismTags.Items.PELLETS_POLONIUM)
.key(Pattern.NUGGET, MekanismItems.ANTIMATTER_PELLET)
.build(consumer);
}

private void addLateGameRecipes(Consumer<IFinishedRecipe> consumer) {
Expand Down

0 comments on commit 92cb41d

Please sign in to comment.