Change the plugin system to a module system and slit up modules

-Moved the woodpile from the arboriculture module to the charcoal module
-Moved the backpacks from the storage module to the backpacks module
-Moved the crates from the storage module to the creates module
-Added the database module with a new storage for individuals
-Added a gui element system to improve the alyzer api
-Added a species plugin interface to handle the database gui
-Added some alyzer methods to the species plugin to move the alyzer
integration later to it
This commit is contained in:
Nedelosk committed 2017-11-02 16:03:33 +01:00
1 parent ee272de168
commit 88fd031fb4
277 files changed
+7361 -1930

No files matched your search

@@ -25,6 +25,7 @@ import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.common.MinecraftForge;
@@ -42,7 +43,7 @@ import forestry.api.circuits.CircuitSocketType;
import forestry.api.circuits.ICircuitLayout;
import forestry.api.core.ForestryAPI;
import forestry.api.farming.IFarmRegistry;
import forestry.core.PluginCore;
import forestry.core.ModuleCore;
import forestry.core.circuits.CircuitLayout;
import forestry.core.circuits.Circuits;
import forestry.core.config.Config;
@@ -81,12 +82,12 @@ import forestry.farming.tiles.TileFarmHatch;
import forestry.farming.tiles.TileFarmPlain;
import forestry.farming.tiles.TileFarmValve;
import forestry.farming.triggers.FarmingTriggers;
import forestry.plugins.BlankForestryPlugin;
import forestry.plugins.ForestryPlugin;
import forestry.plugins.ForestryPluginUids;
import forestry.modules.BlankForestryModule;
import forestry.modules.ForestryModule;
import forestry.modules.ForestryModuleUids;
@ForestryPlugin(pluginID = ForestryPluginUids.FARMING, name = "Farming", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.farming.description")
public class PluginFarming extends BlankForestryPlugin {
@ForestryModule(containerID = Constants.MOD_ID, moduleID = ForestryModuleUids.FARMING, name = "Farming", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.module.farming.description")
public class ModuleFarming extends BlankForestryModule {
@SuppressWarnings("NullableProblems")
@SidedProxy(clientSide = "forestry.farming.proxy.ProxyFarmingClient", serverSide = "forestry.farming.proxy.ProxyFarming")
@@ -117,14 +118,14 @@ public class PluginFarming extends BlankForestryPlugin {
@Override
public void preInit() {
ItemRegistryCore coreItems = PluginCore.getItems();
ItemRegistryCore coreItems = ModuleCore.getItems();
BlockRegistryFarming blocks = getBlocks();
MinecraftForge.EVENT_BUS.register(this);
IFarmRegistry registry = ForestryAPI.farmRegistry;
registry.registerFarmables("farmArboreal", new FarmableVanillaSapling());
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.ARBORICULTURE)) {
if (ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.ARBORICULTURE))) {
registry.registerFarmables("farmArboreal", new FarmableGE());
}
@@ -174,7 +175,6 @@ public class PluginFarming extends BlankForestryPlugin {
@Override
public void doInit() {
super.doInit();
//Load config
File configFile = new File(Forestry.instance.getConfigFolder(), Config.CATEGORY_FARM + ".cfg");
@@ -216,7 +216,7 @@ public class PluginFarming extends BlankForestryPlugin {
@Override
public void registerRecipes() {
ItemRegistryCore coreItems = PluginCore.getItems();
ItemRegistryCore coreItems = ModuleCore.getItems();
BlockRegistryFarming blocks = getBlocks();
ItemStack basic = blocks.farm.get(EnumFarmBlockType.PLAIN, 1);
@@ -2,12 +2,14 @@ package forestry.farming.compat;
import net.minecraft.item.Item;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import forestry.api.core.ForestryAPI;
import forestry.farming.PluginFarming;
import forestry.core.config.Constants;
import forestry.farming.ModuleFarming;
import forestry.farming.blocks.BlockRegistryFarming;
import forestry.farming.models.EnumFarmBlockTexture;
import forestry.plugins.ForestryPluginUids;
import forestry.modules.ForestryModuleUids;
import mezz.jei.api.IModPlugin;
import mezz.jei.api.ISubtypeRegistry;
@@ -17,11 +19,11 @@ import mezz.jei.api.JEIPlugin;
public class FarmingJeiPlugin implements IModPlugin {
@Override
public void registerItemSubtypes(ISubtypeRegistry subtypeRegistry) {
if (!ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FARMING)) {
if (!ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.FARMING))) {
return;
}
BlockRegistryFarming blocks = PluginFarming.getBlocks();
BlockRegistryFarming blocks = ModuleFarming.getBlocks();
Item farmBlock = Item.getItemFromBlock(blocks.farm);
subtypeRegistry.registerSubtypeInterpreter(farmBlock, itemStack -> {
NBTTagCompound nbt = itemStack.getTagCompound();
@@ -11,7 +11,7 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.common.Optional;
import forestry.plugins.compat.PluginIC2;
import forestry.plugins.PluginIC2;
import ic2.api.crops.ICropTile;
@@ -18,7 +18,7 @@ import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import forestry.core.PluginCore;
import forestry.core.ModuleCore;
import forestry.core.blocks.BlockBogEarth;
import forestry.core.config.Constants;
import forestry.core.network.packets.PacketFXSignal;
@@ -45,7 +45,7 @@ public class CropPeat extends Crop {
@Override
protected NonNullList<ItemStack> harvestBlock(World world, BlockPos pos) {
NonNullList<ItemStack> drops = NonNullList.create();
drops.add(PluginCore.getItems().peat.getItemStack());
drops.add(ModuleCore.getItems().peat.getItemStack());
IBlockState blockState = world.getBlockState(pos);
@@ -28,7 +28,7 @@ import forestry.core.config.Constants;
import forestry.core.network.packets.PacketFXSignal;
import forestry.core.utils.ItemStackUtil;
import forestry.core.utils.NetworkUtil;
import forestry.plugins.compat.PluginIC2;
import forestry.plugins.PluginIC2;
public class CropRubber extends CropDestroy {
@@ -30,7 +30,7 @@ import forestry.api.farming.FarmDirection;
import forestry.api.farming.ICrop;
import forestry.api.farming.IFarmHousing;
import forestry.api.farming.IFarmable;
import forestry.core.PluginCore;
import forestry.core.ModuleCore;
import forestry.farming.FarmRegistry;
public class FarmLogicArboreal extends FarmLogicHomogeneous {
@@ -39,7 +39,7 @@ public class FarmLogicArboreal extends FarmLogicHomogeneous {
}
public FarmLogicArboreal() {
super(new ItemStack(Blocks.DIRT), PluginCore.getBlocks().humus.getDefaultState(), FarmRegistry.getInstance().getFarmables("farmArboreal"));
super(new ItemStack(Blocks.DIRT), ModuleCore.getBlocks().humus.getDefaultState(), FarmRegistry.getInstance().getFarmables("farmArboreal"));
}
@Override
@@ -34,7 +34,7 @@ import forestry.api.farming.ICrop;
import forestry.api.farming.IFarmHousing;
import forestry.api.farming.IFarmable;
import forestry.api.genetics.IFruitBearer;
import forestry.core.PluginCore;
import forestry.core.ModuleCore;
import forestry.core.tiles.TileUtil;
public class FarmLogicOrchard extends FarmLogic {
@@ -47,13 +47,13 @@ public class FarmLogicOrchard extends FarmLogic {
this.farmables = ForestryAPI.farmRegistry.getFarmables("farmOrchard");
ImmutableList.Builder<Block> traversalBlocksBuilder = ImmutableList.builder();
// if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.AGRICRAFT) || ForestryAPI.enabledPlugins.contains(ForestryPluginUids.INDUSTRIALCRAFT)) {
// if (ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.AGRICRAFT) || ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.INDUSTRIALCRAFT)) {
// traversalBlocksBuilder.add(Blocks.FARMLAND);
// }
// if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.INDUSTRIALCRAFT)) {
// if (ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.INDUSTRIALCRAFT)) {
// traversalBlocksBuilder.add(Blocks.DIRT);
// }
// if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.PLANTMEGAPACK)) {
// if (ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.PLANTMEGAPACK)) {
// traversalBlocksBuilder.add(Blocks.WATER);
// }
//
@@ -125,7 +125,7 @@ public class FarmLogicOrchard extends FarmLogic {
@Override
public ItemStack getIconItemStack() {
return new ItemStack(PluginCore.getItems().fruits);
return new ItemStack(ModuleCore.getItems().fruits);
}
@Override
@@ -21,14 +21,14 @@ import net.minecraft.world.World;
import forestry.api.farming.FarmDirection;
import forestry.api.farming.ICrop;
import forestry.core.PluginCore;
import forestry.core.ModuleCore;
import forestry.core.blocks.BlockBogEarth;
public class FarmLogicPeat extends FarmLogicWatered {
private static final ItemStack bogEarth = PluginCore.getBlocks().bogEarth.get(BlockBogEarth.SoilType.BOG_EARTH, 1);
private static final ItemStack bogEarth = ModuleCore.getBlocks().bogEarth.get(BlockBogEarth.SoilType.BOG_EARTH, 1);
public FarmLogicPeat() {
super(bogEarth, PluginCore.getBlocks().bogEarth.getDefaultState());
super(bogEarth, ModuleCore.getBlocks().bogEarth.getDefaultState());
}
@Override
@@ -37,7 +37,7 @@ public class FarmLogicPeat extends FarmLogicWatered {
return true;
}
return blockState.getBlock() == PluginCore.getBlocks().bogEarth;
return blockState.getBlock() == ModuleCore.getBlocks().bogEarth;
}
@Override
@@ -86,6 +86,6 @@ public class FarmLogicPeat extends FarmLogicWatered {
@Override
public ItemStack getIconItemStack() {
return new ItemStack(PluginCore.getItems().peat);
return new ItemStack(ModuleCore.getItems().peat);
}
}
@@ -27,7 +27,7 @@ import forestry.api.farming.ICrop;
import forestry.api.farming.IFarmHousing;
import forestry.core.utils.ItemStackUtil;
import forestry.core.utils.Log;
import forestry.plugins.compat.PluginIC2;
import forestry.plugins.PluginIC2;
public class FarmLogicRubber extends FarmLogic {
@@ -13,7 +13,7 @@ import net.minecraftforge.fml.common.Optional;
import forestry.api.farming.ICrop;
import forestry.api.farming.IFarmable;
import forestry.plugins.compat.PluginIC2;
import forestry.plugins.PluginIC2;
import ic2.api.crops.ICropTile;
@@ -22,8 +22,7 @@ import forestry.api.arboriculture.ITreeRoot;
import forestry.api.arboriculture.TreeManager;
import forestry.api.farming.ICrop;
import forestry.api.farming.IFarmable;
import forestry.arboriculture.PluginArboriculture;
import forestry.core.utils.GeneticsUtil;
import forestry.arboriculture.ModuleArboriculture;
public class FarmableGE implements IFarmable {
@@ -35,7 +34,7 @@ public class FarmableGE implements IFarmable {
}
Block block = world.getBlockState(pos).getBlock();
return PluginArboriculture.getBlocks().saplingGE == block;
return ModuleArboriculture.getBlocks().saplingGE == block;
}
@Override
@@ -12,7 +12,7 @@ package forestry.farming.proxy;
import forestry.core.models.BlockModelEntry;
import forestry.core.models.ModelManager;
import forestry.farming.PluginFarming;
import forestry.farming.ModuleFarming;
import forestry.farming.models.ModelFarmBlock;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
@@ -26,6 +26,6 @@ public class ProxyFarmingClient extends ProxyFarming {
public void initializeModels() {
ModelManager.getInstance().registerCustomBlockModel(new BlockModelEntry(new ModelResourceLocation("forestry:ffarm"),
new ModelResourceLocation("forestry:ffarm", "inventory"), new ModelFarmBlock(),
PluginFarming.getBlocks().farm));
ModuleFarming.getBlocks().farm));
}
}