BlockRegistryChanges
This commit is contained in:
parent
f0c3296e48
commit
d530f10f08
4 changed files with 16 additions and 98 deletions
|
@ -1,9 +1,7 @@
|
||||||
package dark.farmtech;
|
package dark.farmtech;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
@ -25,11 +23,10 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||||
import cpw.mods.fml.common.network.NetworkMod;
|
import cpw.mods.fml.common.network.NetworkMod;
|
||||||
import dark.api.farm.CropAutomationHandler;
|
import dark.api.farm.CropAutomationHandler;
|
||||||
import dark.api.farm.DecayMatterList;
|
import dark.api.farm.DecayMatterList;
|
||||||
import dark.core.common.BlockRegistry;
|
|
||||||
import dark.core.common.BlockRegistry.BlockData;
|
|
||||||
import dark.core.common.DarkMain;
|
import dark.core.common.DarkMain;
|
||||||
import dark.core.prefab.ModPrefab;
|
import dark.core.prefab.ModPrefab;
|
||||||
import dark.core.prefab.items.ItemBlockHolder;
|
import dark.core.prefab.items.ItemBlockHolder;
|
||||||
|
import dark.core.registration.ModObjectRegistry;
|
||||||
import dark.farmtech.blocks.BlockFarmSoil;
|
import dark.farmtech.blocks.BlockFarmSoil;
|
||||||
|
|
||||||
@Mod(modid = FarmTech.MOD_ID, name = FarmTech.MOD_NAME, version = FarmTech.VERSION, dependencies = "after:DarkCore", useMetadata = true)
|
@Mod(modid = FarmTech.MOD_ID, name = FarmTech.MOD_NAME, version = FarmTech.VERSION, dependencies = "after:DarkCore", useMetadata = true)
|
||||||
|
@ -101,19 +98,16 @@ public class FarmTech extends ModPrefab
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<BlockData> getBlocks()
|
public void registerObjects()
|
||||||
{
|
{
|
||||||
List<BlockData> dataList = new ArrayList<BlockData>();
|
|
||||||
CONFIGURATION.load();
|
CONFIGURATION.load();
|
||||||
|
|
||||||
blockFarmSoil = new BlockFarmSoil(this.getNextID());
|
blockFarmSoil = ModObjectRegistry.createNewBlock(FarmTech.MOD_ID, BlockFarmSoil.class, ItemBlockHolder.class);
|
||||||
BlockRegistry.addBlockToRegister(new BlockData(blockFarmSoil, ItemBlockHolder.class, "FTFarmSoil"));
|
|
||||||
|
|
||||||
String compostList = CONFIGURATION.get("DecayMatter", "List", "5::8000:1", "Items or blocks beyond the built in ones that can be turned into compost. Entries go BlockID:Meta:Time:Amount").getString();
|
//String compostList = CONFIGURATION.get("DecayMatter", "List", "5::8000:1", "Items or blocks beyond the built in ones that can be turned into compost. Entries go BlockID:Meta:Time:Amount").getString();
|
||||||
DecayMatterList.parseConfigString(compostList);
|
//DecayMatterList.parseConfigString(compostList);
|
||||||
|
|
||||||
CONFIGURATION.save();
|
CONFIGURATION.save();
|
||||||
return dataList;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -10,26 +10,27 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.Icon;
|
import net.minecraft.util.Icon;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import dark.core.common.DarkMain;
|
||||||
import dark.farmtech.FarmTech;
|
import dark.farmtech.FarmTech;
|
||||||
|
|
||||||
/** Generic block set containing farm blocks: mulch, fertilizer, fertile dirt, mud
|
/** Generic block set containing farm blocks: mulch, fertilizer, fertile dirt, mud
|
||||||
*
|
*
|
||||||
* mulch/fertilizer -> fertileDirt -> mud -> dirt
|
* mulch/fertilizer -> fertileDirt -> mud -> dirt
|
||||||
*
|
*
|
||||||
* @mulch is a decor version of fertilizer made from wood. decays very slowly when actually used for
|
* @mulch is a decor version of fertilizer made from wood. decays very slowly when actually used for
|
||||||
* crops. Design is to be used with small plant for decor
|
* crops. Design is to be used with small plant for decor
|
||||||
*
|
*
|
||||||
* @fertilizer enriches the soil and is used to grow crops faster fertilizer can be created from
|
* @fertilizer enriches the soil and is used to grow crops faster fertilizer can be created from
|
||||||
* anything using several means
|
* anything using several means
|
||||||
*
|
*
|
||||||
* @author darkguardsman */
|
* @author darkguardsman */
|
||||||
public class BlockFarmSoil extends Block
|
public class BlockFarmSoil extends Block
|
||||||
{
|
{
|
||||||
Icon mulch, mulch_top, fertilizer, fertileDirt, fertileDirt_top, mud, mud_top;
|
Icon mulch, mulch_top, fertilizer, fertileDirt, fertileDirt_top, mud, mud_top;
|
||||||
|
|
||||||
public BlockFarmSoil(int blockID)
|
public BlockFarmSoil()
|
||||||
{
|
{
|
||||||
super(FarmTech.CONFIGURATION.getBlock("Soil", blockID).getInt(), Material.clay);
|
super(FarmTech.CONFIGURATION.getBlock("FarmSoil", DarkMain.getNextID()).getInt(), Material.clay);
|
||||||
this.setUnlocalizedName("FarmBlock");
|
this.setUnlocalizedName("FarmBlock");
|
||||||
this.setCreativeTab(FarmTech.TabFarmTech);
|
this.setCreativeTab(FarmTech.TabFarmTech);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,77 +0,0 @@
|
||||||
package dark.farmtech.machines;
|
|
||||||
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.client.renderer.texture.IconRegister;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.Icon;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
public class BlockBasicMachine extends BlockFT
|
|
||||||
{
|
|
||||||
Icon generic_side, wood_side, box_Top;
|
|
||||||
|
|
||||||
enum basicMachine
|
|
||||||
{
|
|
||||||
COMP_BOX("compostBox", TileEntityCompBox.class);
|
|
||||||
String name;
|
|
||||||
Class<? extends TileEntity> tile;
|
|
||||||
|
|
||||||
private basicMachine(String name, Class<? extends TileEntity> tile)
|
|
||||||
{
|
|
||||||
this.name = name;
|
|
||||||
this.tile = tile;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public BlockBasicMachine(String name, int blockID, Material material)
|
|
||||||
{
|
|
||||||
super(name, blockID, material);
|
|
||||||
// TODO Auto-generated constructor stub
|
|
||||||
}
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
@Override
|
|
||||||
public void registerIcons(IconRegister iconReg)
|
|
||||||
{
|
|
||||||
super.registerIcons(iconReg);
|
|
||||||
//this.source = iconReg.registerIcon(DarkMain.getInstance().PREFIX + "infSource");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public Icon getIcon(int side, int meta)
|
|
||||||
{
|
|
||||||
switch (meta)
|
|
||||||
{
|
|
||||||
default:
|
|
||||||
return this.blockIcon;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createTileEntity(World world, int metadata)
|
|
||||||
{
|
|
||||||
if (metadata < basicMachine.values().length)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return basicMachine.values()[metadata].tile.newInstance();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return super.createTileEntity(world, metadata);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World world)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -8,19 +8,19 @@ import net.minecraftforge.common.Configuration;
|
||||||
import dark.core.prefab.IExtraObjectInfo;
|
import dark.core.prefab.IExtraObjectInfo;
|
||||||
import dark.core.prefab.helpers.Pair;
|
import dark.core.prefab.helpers.Pair;
|
||||||
import dark.core.prefab.machine.BlockMachine;
|
import dark.core.prefab.machine.BlockMachine;
|
||||||
|
import dark.core.registration.ModObjectRegistry.BlockBuildData;
|
||||||
import dark.farmtech.FarmTech;
|
import dark.farmtech.FarmTech;
|
||||||
|
|
||||||
/** Prefab class for all farm blocks to remove the need for some configuration of the super class
|
/** Prefab class for all farm blocks to remove the need for some configuration of the super class
|
||||||
*
|
*
|
||||||
* @author Darkguardsman */
|
* @author Darkguardsman */
|
||||||
public abstract class BlockFT extends BlockMachine implements IExtraObjectInfo
|
public abstract class BlockFT extends BlockMachine implements IExtraObjectInfo
|
||||||
{
|
{
|
||||||
private boolean hasConfigFile = false;
|
private boolean hasConfigFile = false;
|
||||||
|
|
||||||
public BlockFT(String name, int blockID, Material material)
|
public BlockFT(Class<? extends BlockMachine> blockClass, String name, Material material)
|
||||||
{
|
{
|
||||||
super(name, FarmTech.CONFIGURATION, blockID, material);
|
super(new BlockBuildData(blockClass, name, material).setCreativeTab(FarmTech.TabFarmTech));
|
||||||
this.setCreativeTab(FarmTech.TabFarmTech);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue