1.14: Fixed recipe condition bug (issue #65).

This commit is contained in:
stfwi 2019-11-20 19:53:33 +01:00
parent eadec80234
commit 1c71841ed8
7 changed files with 21 additions and 7 deletions

View file

@ -5,4 +5,4 @@ version_minecraft=1.14.4
version_forge_minecraft=1.14.4-28.1.90
version_fml_mappings=20190719-1.14.3
version_jei=1.14.4:6.0.0.10
version_engineersdecor=1.0.16-b4
version_engineersdecor=1.0.16-b5

View file

@ -1,6 +1,7 @@
{
"homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/",
"1.14.4": {
"1.0.16-b5": "[F] Fixed recipe condition bug (issue #65, thx Nachtflame for the report, and gigaherz & killjoy for the help).",
"1.0.16-b4": "[U] Updated to Forge 1.14.4-28.1.90/20190719-1.14.3.\n[M] Increased slag brick recipe yield to 8.\n[M] Parent specs in model files adapted.",
"1.0.16-b3": "[A] Config options (opt-outs and tweaks) added.\n[M] Increased clinker brick recipe yield to 8 for the builders needs.",
"1.0.16-b2": "[A] Added Gas Concrete (including wall, stairs, slab, and slab slice).\n[F] Fixed Small Block Breaker active model.\n[F] Fixed item-on-ground display glitch (issue #61, thx Federsavo for the hint).\n[F] Added two missing recipes.",
@ -34,6 +35,6 @@
},
"promos": {
"1.14.4-recommended": "",
"1.14.4-latest": "1.0.16-b4"
"1.14.4-latest": "1.0.16-b5"
}
}

View file

@ -11,6 +11,9 @@ Mod sources for Minecraft version 1.14.4.
## Version history
- v1.0.16-b5 [F] Fixed recipe condition bug (issue #65, thx Nachtflame for the report,
and gigaherz & killjoy for the help).
- v1.0.16-b4 [U] Updated to Forge 1.14.4-28.1.90/20190719-1.14.3.
[M] Increased slag brick recipe yield to 8.
[M] Parent specs in model files adapted.

View file

@ -17,7 +17,6 @@ import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraftforge.common.ForgeConfigSpec;
import org.apache.commons.lang3.tuple.Pair;
import wile.engineersdecor.blocks.BlockDecorMilker.BTileEntity;
import javax.annotation.Nullable;
import java.util.ArrayList;
@ -461,7 +460,7 @@ public class ModConfig
"Note this is a permanent standby power, not only when the device does something. " +
"Use zero to disable energy dependency and energy handling of the machine. " +
"The config value can be changed on-the-fly for tuning.")
.defineInRange("milking_machine_energy_consumption", BTileEntity.DEFAULT_ENERGY_CONSUMPTION, 0, 128);
.defineInRange("milking_machine_energy_consumption", BlockDecorMilker.BTileEntity.DEFAULT_ENERGY_CONSUMPTION, 0, 128);
builder.pop();
}
}
@ -564,6 +563,9 @@ public class ModConfig
public static boolean withExperimental()
{ return with_experimental_features_; }
public static boolean withoutRecipes()
{ return without_recipes_; }
//--------------------------------------------------------------------------------------------------------------------
// Cache
//--------------------------------------------------------------------------------------------------------------------
@ -573,6 +575,7 @@ public class ModConfig
public static boolean without_crafting_table = false;
public static boolean immersiveengineering_installed = false;
private static boolean with_experimental_features_ = false;
private static boolean without_recipes_ = false;
public static final CompoundNBT getServerConfig() // config that may be synchronized from server to client via net pkg.
{ return server_config_; }
@ -592,6 +595,7 @@ public class ModConfig
without_crafting_table = isOptedOut(ModContent.TREATED_WOOD_CRAFTING_TABLE);
immersiveengineering_installed = ModAuxiliaries.isModLoaded("immersiveengineering");
with_experimental_features_ = COMMON.with_experimental.get();
without_recipes_ = COMMON.without_recipes.get();
if(with_experimental_features_) {
ModEngineersDecor.logger().info("Config: EXPERIMENTAL FEATURES ENABLED.");
}

View file

@ -57,11 +57,16 @@ public class OptionalRecipeCondition implements ICondition
@Override
public boolean test()
{
if(ModConfig.withoutRecipes()) return false;
if((experimental) && (!ModConfig.withExperimental())) return false;
final IForgeRegistry<Block> block_registry = ForgeRegistries.BLOCKS;
final IForgeRegistry<Item> item_registry = ForgeRegistries.ITEMS;
if(result != null) {
if((!block_registry.containsKey(result)) && (!item_registry.containsKey(result))) return false; // required result not registered
boolean item_registered = item_registry.containsKey(result);
boolean block_registered = block_registry.containsKey(result);
if((!block_registered) && (!item_registered)) return false; // required result not registered
if(item_registered && ModConfig.isOptedOut(item_registry.getValue(result))) return false;
if(block_registered && ModConfig.isOptedOut(block_registry.getValue(result))) return false;
}
if(!all_required.isEmpty()) {
for(ResourceLocation rl:all_required) {