Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. {
  2. "conditions": {
  3. "config_property" : "minecolonies.ConfigCondition"
  4. }
  5. }
  6.  
  7. {
  8. "type": "minecraft:crafting_shaped",
  9. "pattern": [
  10. " ",
  11. "C C",
  12. "CCC"
  13. ],
  14. "conditions": [
  15. {
  16. "type": "supply",
  17. }
  18. ],
  19. "key": {
  20. "C": {
  21. "item": "minecraft:chest"
  22. }
  23. },
  24. "result": {
  25. "item": "minecolonies:supplycampdeployer"
  26. }
  27. }
  28.  
  29. package com.minecolonies.coremod.util;
  30.  
  31. import com.google.gson.JsonObject;
  32. import com.minecolonies.api.configuration.Configurations;
  33. import net.minecraft.util.JsonUtils;
  34. import net.minecraftforge.common.crafting.IConditionFactory;
  35. import net.minecraftforge.common.crafting.JsonContext;
  36.  
  37. import java.util.function.BooleanSupplier;
  38.  
  39. /**
  40. * Custom config conditions!
  41. */
  42. public class ConfigCondition implements IConditionFactory
  43. {
  44. /**
  45. * Supplyship string.
  46. */
  47. private static final String SUPPLIES = "supply";
  48.  
  49. /**
  50. * Supplyship string.
  51. */
  52. private static final String IN_DEV = "inDev";
  53.  
  54. @Override
  55. public BooleanSupplier parse(final JsonContext context, final JsonObject json)
  56. {
  57. String value = JsonUtils.getString(json , "type");
  58.  
  59. if(!Configurations.gameplay.enableInDevelopmentFeatures && SUPPLIES.equalsIgnoreCase(value))
  60. {
  61. return () -> false;
  62. }
  63.  
  64. if(!Configurations.gameplay.supplyChests && IN_DEV.equalsIgnoreCase(value))
  65. {
  66. return () -> false;
  67. }
  68.  
  69. return () -> true;
  70. }
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement