mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-27 23:33:00 +00:00
Clean up more null issues
This commit is contained in:
1 parent
1fa461430e
commit
4abbc92472
142 files changed
+707
-617
No files matched your search
@@ -2,7 +2,6 @@ package forestry.plugins.compat;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import forestry.core.PluginCore;
|
||||
import forestry.core.blocks.BlockRegistryCore;
|
||||
import forestry.core.items.ItemRegistryCore;
|
||||
@@ -26,8 +25,7 @@ public class ForestryJeiPlugin extends BlankModPlugin {
|
||||
itemBlacklist.addItemToBlacklist(hiddenItem);
|
||||
}
|
||||
|
||||
ItemRegistryCore items = PluginCore.items;
|
||||
Preconditions.checkState(items != null);
|
||||
ItemRegistryCore items = PluginCore.getItems();
|
||||
|
||||
JeiUtil.addDescription(registry,
|
||||
items.solderingIron,
|
||||
@@ -39,8 +37,7 @@ public class ForestryJeiPlugin extends BlankModPlugin {
|
||||
items.fertilizerCompound
|
||||
);
|
||||
|
||||
BlockRegistryCore blocks = PluginCore.blocks;
|
||||
Preconditions.checkState(blocks != null);
|
||||
BlockRegistryCore blocks = PluginCore.getBlocks();
|
||||
|
||||
JeiUtil.addDescription(registry,
|
||||
blocks.analyzer,
|
||||
|
||||
@@ -139,7 +139,7 @@ public class PluginBiomesOPlenty extends BlankForestryPlugin {
|
||||
}
|
||||
|
||||
private static void addSqueezerRecipes() {
|
||||
ItemStack mulch = new ItemStack(PluginCore.items.mulch);
|
||||
ItemStack mulch = new ItemStack(PluginCore.getItems().mulch);
|
||||
|
||||
Item pinecone = ForgeRegistries.ITEMS.getValue(new ResourceLocation(BoP, "pinecone"));
|
||||
if (pinecone != null) {
|
||||
|
||||
@@ -40,7 +40,7 @@ public class PluginBuildCraftTransport extends BlankForestryPlugin {
|
||||
|
||||
@Override
|
||||
public void registerRecipes() {
|
||||
Item beeswax = PluginCore.items.beeswax;
|
||||
Item beeswax = PluginCore.getItems().beeswax;
|
||||
Item pipeWaterproof = ForgeRegistries.ITEMS.getValue(new ResourceLocation(BCT, "pipeWaterproof"));
|
||||
if (pipeWaterproof != null) {
|
||||
RecipeUtil.addShapelessRecipe(new ItemStack(pipeWaterproof), beeswax);
|
||||
|
||||
@@ -84,7 +84,7 @@ public class PluginExtraUtilities extends BlankForestryPlugin {
|
||||
super.registerRecipes();
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FARMING) && Circuits.farmEnderManaged != null) {
|
||||
ICircuitLayout layoutManaged = ChipsetManager.circuitRegistry.getLayout("forestry.farms.managed");
|
||||
ChipsetManager.solderManager.addRecipe(layoutManaged, PluginCore.items.tubes.get(EnumElectronTube.ENDER, 1), Circuits.farmEnderManaged);
|
||||
ChipsetManager.solderManager.addRecipe(layoutManaged, PluginCore.getItems().tubes.get(EnumElectronTube.ENDER, 1), Circuits.farmEnderManaged);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,17 +12,17 @@ package forestry.plugins.compat;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static forestry.core.PluginCore.items;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.farming.Farmables;
|
||||
import forestry.api.fuels.FuelManager;
|
||||
import forestry.api.fuels.MoistenerFuel;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.core.PluginCore;
|
||||
import forestry.core.PluginFluids;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.items.ItemRegistryCore;
|
||||
import forestry.core.recipes.RecipeUtil;
|
||||
import forestry.core.utils.ModUtil;
|
||||
import forestry.farming.logic.FarmableAgingCrop;
|
||||
@@ -270,13 +270,14 @@ public class PluginHarvestCraft extends BlankForestryPlugin {
|
||||
plants.add(vegetableName);
|
||||
}
|
||||
|
||||
ItemRegistryCore coreItems = PluginCore.getItems();
|
||||
for (String grainName : grains) {
|
||||
ItemStack grain = getItemStack(grainName + "Item");
|
||||
ItemStack grainSeed = getItemStack(grainName + "seedItem");
|
||||
Block grainBlock = getBlock("pam" + grainName + "Crop");
|
||||
if (grain != null && wheatamount > 0) {
|
||||
RecipeUtil.addRecipe(items.fertilizerBio.getItemStack(wheatamount), " X ", "X#X", " X ", '#', Blocks.DIRT, 'X', grain);
|
||||
FuelManager.moistenerResource.put(grain, new MoistenerFuel(grain, items.mouldyWheat.getItemStack(), 0, 300));
|
||||
RecipeUtil.addRecipe(coreItems.fertilizerBio.getItemStack(wheatamount), " X ", "X#X", " X ", '#', Blocks.DIRT, 'X', grain);
|
||||
FuelManager.moistenerResource.put(grain, new MoistenerFuel(grain, coreItems.mouldyWheat.getItemStack(), 0, 300));
|
||||
}
|
||||
if (grainSeed != null) {
|
||||
RecipeManagers.squeezerManager.addRecipe(10, grainSeed, Fluids.SEED_OIL.getFluid(seedamount));
|
||||
@@ -383,7 +384,7 @@ public class PluginHarvestCraft extends BlankForestryPlugin {
|
||||
|
||||
ItemStack hcBeeswaxItem = getItemStack("beeswaxItem");
|
||||
if (hcBeeswaxItem != null) {
|
||||
RecipeUtil.addRecipe(PluginFluids.items.waxCapsuleEmpty.getItemStack(ForestryAPI.activeMode.getIntegerSetting("recipe.output.capsule")), "XXX ", 'X', hcBeeswaxItem);
|
||||
RecipeUtil.addRecipe(PluginFluids.getItems().waxCapsuleEmpty.getItemStack(ForestryAPI.activeMode.getIntegerSetting("recipe.output.capsule")), "XXX ", 'X', hcBeeswaxItem);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package forestry.plugins.compat;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.farming.Farmables;
|
||||
import forestry.api.farming.ICrop;
|
||||
@@ -42,24 +43,31 @@ public class PluginImmersiveEngineering extends BlankForestryPlugin {
|
||||
public void postInit() {
|
||||
ItemStack hempSeed = getItemStack("seed");
|
||||
Block hempCrop = getBlock("hemp");
|
||||
int seedAmount = ForestryAPI.activeMode.getIntegerSetting("squeezer.liquid.seed");
|
||||
IProperty age = hempCrop.getBlockState().getProperties().stream().filter(p -> p.getName().equals("type")).findAny().orElseGet(null);
|
||||
if (hempCrop != null) {
|
||||
int seedAmount = ForestryAPI.activeMode.getIntegerSetting("squeezer.liquid.seed");
|
||||
IProperty age = hempCrop.getBlockState().getProperties().stream().filter(p -> p.getName().equals("type")).findAny().orElseGet(null);
|
||||
|
||||
if (hempSeed != null && hempCrop != Blocks.AIR && age != null) {
|
||||
IBlockState planted = hempCrop.getDefaultState().withProperty(age, (Comparable) age.parseValue("bottom0").get());
|
||||
IBlockState mature = hempCrop.getDefaultState().withProperty(age, (Comparable) age.parseValue("top0").get());
|
||||
Farmables.farmables.get("farmWheat").add(new FarmableBase(hempSeed, planted, mature, false) {
|
||||
@Override
|
||||
public ICrop getCropAt(World world, BlockPos pos, IBlockState blockState) {
|
||||
IBlockState stateUp = world.getBlockState(pos.up());
|
||||
if (stateUp != matureState) {
|
||||
return null;
|
||||
}
|
||||
return new CropDestroy(world, stateUp, pos.up(), null);
|
||||
if (hempSeed != null && hempCrop != Blocks.AIR && age != null) {
|
||||
Optional bottom0 = age.parseValue("bottom0");
|
||||
Optional top0 = age.parseValue("top0");
|
||||
if (bottom0.isPresent() && top0.isPresent()) {
|
||||
IBlockState defaultState = hempCrop.getDefaultState();
|
||||
IBlockState planted = defaultState.withProperty(age, (Comparable) bottom0.get());
|
||||
IBlockState mature = defaultState.withProperty(age, (Comparable) top0.get());
|
||||
Farmables.farmables.get("farmWheat").add(new FarmableBase(hempSeed, planted, mature, false) {
|
||||
@Override
|
||||
public ICrop getCropAt(World world, BlockPos pos, IBlockState blockState) {
|
||||
IBlockState stateUp = world.getBlockState(pos.up());
|
||||
if (stateUp != matureState) {
|
||||
return null;
|
||||
}
|
||||
return new CropDestroy(world, stateUp, pos.up(), null);
|
||||
}
|
||||
});
|
||||
|
||||
RecipeManagers.squeezerManager.addRecipe(10, hempSeed, Fluids.SEED_OIL.getFluid(seedAmount));
|
||||
}
|
||||
});
|
||||
|
||||
RecipeManagers.squeezerManager.addRecipe(10, hempSeed, Fluids.SEED_OIL.getFluid(seedAmount));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -54,15 +54,15 @@ public class PluginNatura extends BlankForestryPlugin {
|
||||
@Nullable
|
||||
private static Block saplingNaturaRare;
|
||||
|
||||
private static ItemStack berryBlight;
|
||||
private static ItemStack berryDusk;
|
||||
private static ItemStack berrySky;
|
||||
private static ItemStack berrySting;
|
||||
private static ItemStack berryRasp;
|
||||
private static ItemStack berryBlue;
|
||||
private static ItemStack berryBlack;
|
||||
private static ItemStack berryMalo;
|
||||
private static ItemStack itemBarley;
|
||||
private static ItemStack berryBlight = ItemStack.EMPTY;
|
||||
private static ItemStack berryDusk = ItemStack.EMPTY;
|
||||
private static ItemStack berrySky = ItemStack.EMPTY;
|
||||
private static ItemStack berrySting = ItemStack.EMPTY;
|
||||
private static ItemStack berryRasp = ItemStack.EMPTY;
|
||||
private static ItemStack berryBlue = ItemStack.EMPTY;
|
||||
private static ItemStack berryBlack = ItemStack.EMPTY;
|
||||
private static ItemStack berryMalo = ItemStack.EMPTY;
|
||||
private static ItemStack itemBarley = ItemStack.EMPTY;
|
||||
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
@@ -263,7 +263,7 @@ public class PluginNatura extends BlankForestryPlugin {
|
||||
amount = ForestryAPI.activeMode.getIntegerSetting("squeezer.liquid.apple") / 2;
|
||||
amount = Math.max(amount, 1); // Produce at least 1 mb of juice.
|
||||
ItemStack netherFood = getItemStack("Natura.netherfood", 0);
|
||||
ItemStack mulch = PluginCore.items.mulch.getItemStack();
|
||||
ItemStack mulch = PluginCore.getItems().mulch.getItemStack();
|
||||
RecipeManagers.squeezerManager.addRecipe(10, netherFood, Fluids.JUICE.getFluid(amount), mulch, ForestryAPI.activeMode.getIntegerSetting("squeezer.mulch.apple"));
|
||||
|
||||
amount = ForestryAPI.activeMode.getIntegerSetting("squeezer.liquid.apple") / 25;
|
||||
@@ -277,10 +277,10 @@ public class PluginNatura extends BlankForestryPlugin {
|
||||
RecipeUtil.addFermenterRecipes(itemBarley, ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.wheat"), Fluids.BIOMASS);
|
||||
int compostWheatAmount = ForestryAPI.activeMode.getIntegerSetting("recipe.output.compost.wheat");
|
||||
if (compostWheatAmount > 0) {
|
||||
ItemStack compostWheat = PluginCore.items.fertilizerBio.getItemStack(compostWheatAmount);
|
||||
ItemStack compostWheat = PluginCore.getItems().fertilizerBio.getItemStack(compostWheatAmount);
|
||||
RecipeUtil.addRecipe(compostWheat, " X ", "X#X", " X ", '#', Blocks.DIRT, 'X', itemBarley);
|
||||
}
|
||||
FuelManager.moistenerResource.put(itemBarley, new MoistenerFuel(itemBarley, PluginCore.items.mouldyWheat.getItemStack(), 0, 300));
|
||||
FuelManager.moistenerResource.put(itemBarley, new MoistenerFuel(itemBarley, PluginCore.getItems().mouldyWheat.getItemStack(), 0, 300));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user