Add config to let capsules be reusable (#2066)

* Add config option to make capsules non consumable

* Fix naming
This commit is contained in:
temp1011 authored and Nedelosk committed 2018-04-27 13:51:22 +02:00
1 parent dfb4504cde
commit 348149f4d6
2 files changed
+41 -25

No files matched your search

+29 -25
View File
@@ -63,7 +63,7 @@ public class Config {
//Humus
public static int humusDegradeDelimiter = 3;
//Greenhouse
public static int climateSourceRange = 36;
public static float climateSourceEnergyModifier = 1.5F;
@@ -125,6 +125,7 @@ public class Config {
// Fluids
public static boolean CapsuleFluidPickup = false;
public static boolean nonConsumableCapsules = false;
// Gui tabs (Ledger)
public static int guiTabSpeed = 8;
@@ -158,37 +159,39 @@ public class Config {
return enableExUtilEnderLily;
}
public static boolean isExUtilRedOrchidEnabled() { return enableExUtilRedOrchid; }
public static boolean isExUtilRedOrchidEnabled() {
return enableExUtilRedOrchid;
}
public static boolean isMagicalCropsSupportEnabled() {
return enableMagicalCropsSupport;
}
public static void blacklistTreeDim(int dimID) {
blacklistedTreeDims.add(dimID);
}
public static void whitelistTreeDim(int dimID) {
whitelistedTreeDims.add(dimID);
}
public static void blacklistOreDim(int dimID) {
blacklistedOreDims.add(dimID);
}
public static void whitelistOreDim(int dimID) {
whitelistedOreDims.add(dimID);
}
public static boolean isValidOreDim(int dimID) { //blacklist has priority
if(blacklistedOreDims.isEmpty() || !blacklistedOreDims.contains(dimID)) {
public static boolean isValidOreDim(int dimID) { //blacklist has priority
if (blacklistedOreDims.isEmpty() || !blacklistedOreDims.contains(dimID)) {
return whitelistedOreDims.isEmpty() || whitelistedOreDims.contains(dimID);
}
return false;
}
public static boolean isValidTreeDim(int dimID) { //blacklist has priority
if(blacklistedTreeDims.isEmpty() || !blacklistedTreeDims.contains(dimID)) {
public static boolean isValidTreeDim(int dimID) { //blacklist has priority
if (blacklistedTreeDims.isEmpty() || !blacklistedTreeDims.contains(dimID)) {
return whitelistedTreeDims.isEmpty() || whitelistedTreeDims.contains(dimID);
}
return false;
@@ -262,24 +265,24 @@ public class Config {
generateApatiteOre = configCommon.getBooleanLocalized("world.generate.ore", "apatite", generateApatiteOre);
generateCopperOre = configCommon.getBooleanLocalized("world.generate.ore", "copper", generateCopperOre);
generateTinOre = configCommon.getBooleanLocalized("world.generate.ore", "tin", generateTinOre);
for(int dimId : configCommon.get("world.generate.ore", "dimBlacklist", new int[0]).getIntList()) {
blacklistedOreDims.add(dimId);
for (int dimId : configCommon.get("world.generate.ore", "dimBlacklist", new int[0]).getIntList()) {
blacklistedOreDims.add(dimId);
}
for(int dimId : configCommon.get("world.generate.ore", "dimWhitelist", new int[0]).getIntList()) {
for (int dimId : configCommon.get("world.generate.ore", "dimWhitelist", new int[0]).getIntList()) {
whitelistedOreDims.add(dimId);
}
enableVillagers = configCommon.getBooleanLocalized("world.generate", "villagers", enableVillagers);
generateTrees = configCommon.getBooleanLocalized("world.generate", "trees", generateTrees);
for(int dimId : configCommon.get("world.generate.trees", "dimBlacklist", new int[0]).getIntList()){
blacklistedTreeDims.add(dimId);
for (int dimId : configCommon.get("world.generate.trees", "dimBlacklist", new int[0]).getIntList()) {
blacklistedTreeDims.add(dimId);
}
for(int dimId : configCommon.get("world.generate.trees", "dimWhitelist", new int[0]).getIntList()){
whitelistedTreeDims.add(dimId);
}
for (int dimId : configCommon.get("world.generate.trees", "dimWhitelist", new int[0]).getIntList()) {
whitelistedTreeDims.add(dimId);
}
craftingBronzeEnabled = configCommon.getBooleanLocalized("crafting", "bronze", craftingBronzeEnabled);
craftingStampsEnabled = configCommon.getBooleanLocalized("crafting.stamps", "enabled", true);
@@ -327,7 +330,8 @@ public class Config {
ringFarms = configCommon.getBooleanLocalized("tweaks.cultivation", "ring", ringFarms);
ringSize = configCommon.getIntLocalized("tweaks.cultivation", "ring_size", ringSize, 1, 8);
CapsuleFluidPickup = configCommon.getBooleanLocalized("tweaks", "capsule", CapsuleFluidPickup);
CapsuleFluidPickup = configCommon.getBooleanLocalized("tweaks.capsule", "capsulePickup", CapsuleFluidPickup);
nonConsumableCapsules = configCommon.getBooleanLocalized("tweaks.capsule", "capsuleReuseable", nonConsumableCapsules);
climateSourceRange = configCommon.getIntLocalized("tweaks.greenhouse", "range", climateSourceRange, 9, 270);
climateSourceEnergyModifier = configCommon.getFloatLocalized("tweaks.greenhouse", "energy", climateSourceEnergyModifier, 0.0F, 15.0F);
@@ -1,10 +1,13 @@
package forestry.core.items;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.templates.FluidHandlerItemStackSimple;
import forestry.core.config.Config;
public class FluidHandlerItemForestry extends FluidHandlerItemStackSimple.Consumable {
private final EnumContainerType containerType;
@@ -42,5 +45,14 @@ public class FluidHandlerItemForestry extends FluidHandlerItemStackSimple.Consum
super.setFluid(fluid);
container.setItemDamage(1); // show the filled container model
}
@Override
protected void setContainerToEmpty() {
if (Config.nonConsumableCapsules) { //default behaviour of FluidHandlerItemStack
container.getTagCompound().removeTag(FLUID_NBT_KEY);
} else {
super.setContainerToEmpty();
}
}
}