Skip to content

Commit 0aecef9

Browse files
committed
Added RF support! Closes #8. Adds a Fuel generator closing #14
1 parent 1dfccb9 commit 0aecef9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+1474
-162
lines changed

README.md

Lines changed: 22 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,26 @@ Build Status:
66

77
Latest Builds can be found on <a href="https://drone.io/github.com/Vanhal/ModJam/files">drone.io</a>
88

9-
<p>This mod provides low tech automation tools for common tasks.&nbsp;<span style="font-size: 14.3px; line-height: 1.7;" data-mce-mark="1">The tools will be upgradable as the player progresses. You can see my spotlight of the mod below:</span></p>
10-
<p><iframe src="http://www.youtube.com/embed/rYgfP_eZ-kM?wmode=transparent" height="358" width="638"></iframe></p>
11-
<p><em><span style="font-size: 14.3px; line-height: 1.7;" data-mce-mark="1"><span>Mod requires Forge to be installed.</span></span></em></p>
12-
<h1><span style="font-size: 14.3px; line-height: 1.7;" data-mce-mark="1">The Miner</span></h1>
13-
<p>This is currently the only item that the mod adds.</p>
14-
<p>To start out you will need to make a wooden miner.</p>
15-
<p><img alt="Wooden Miner Recipe" src="https://dl.dropboxusercontent.com/u/3886989/World%20Snapshots/PA/WoodenMiner.png" height="115" width="256" /></p>
16-
<p>When placed this you can click on the miner to open the mining interface. To start the miner you will need to put the following items into it:</p>
17-
<ul>
18-
<li>Fuel - Coal, wood, anything that can be used to fuel a furnace</li>
19-
<li>Cobblestone - Blocks that are mined are replaced with cobble, you need to supply it constantly or it will stop.</li>
20-
<li>A pickaxe - The miner will use the pick to mine blocks, it will take durability but you can also enchant it.&nbsp;</li>
21-
<li>A Shovel - Like the pick, the miner will use the shovel to mine blocks like dirt and sand.</li>
22-
</ul>
23-
<p>The tools can only be up to the same level as the miner, so you can only put wooden tools in a wooden miner, and you can put wooden, stone and iron tools in a iron miner.&nbsp;<span style="font-size: 14.3px; line-height: 1.7;" data-mce-mark="1">Once running the miner will attempt to keep the cobblestone and fuel filled with the items that it mines. If the internal inventory is full the miner will eject items into the world. It will also automatically put items into any inventory (like a chest) on top of the miner.</span></p>
24-
<p>By default the miner will only mine directly underneath it but the range can be upgraded by a single block with each additional upgrade that is put into it. You can put as many upgrades as you wish into the miner but the upgrades need to be of the same type of the miner. To get the upgrades back just break the miner.</p>
25-
<h2>Recipes</h2>
26-
<p><strong>Miners</strong></p>
27-
<p>Stone Miner:</p>
28-
<p><strong><img alt="Stone Miner" src="https://dl.dropboxusercontent.com/u/3886989/World%20Snapshots/PA/StoneMiner.png" height="115" width="245" /><br /></strong></p>
29-
<p>Iron Miner:</p>
30-
<p><img alt="Iron Miner" src="https://dl.dropboxusercontent.com/u/3886989/World%20Snapshots/PA/IronMiner.png" height="115" width="245" /></p>
31-
<p>Diamond Miner:</p>
32-
<p><img alt="Diamond Miner" src="https://dl.dropboxusercontent.com/u/3886989/World%20Snapshots/PA/DiamondMiner.png" height="115" width="245" /></p>
33-
<p><strong>Upgrades</strong></p>
34-
<p>Wooden Upgrade:</p>
35-
<p><img alt="Wooden Upgrade" src="https://dl.dropboxusercontent.com/u/3886989/World%20Snapshots/PA/WoodenUpgrade.png" height="115" width="256" /></p>
36-
<p>Stone Upgrade:</p>
37-
<p><img alt="Stone Upgrade" src="https://dl.dropboxusercontent.com/u/3886989/World%20Snapshots/PA/StoneUpgrade.png" height="115" width="245" /></p>
38-
<p>Iron Upgrade:</p>
39-
<p><img alt="Iron Upgrade" src="https://dl.dropboxusercontent.com/u/3886989/World%20Snapshots/PA/IronUpgrade.png" height="115" width="245" /></p>
40-
<p>Diamond Upgrade:</p>
41-
<p><img alt="Diamond Upgrade" src="https://dl.dropboxusercontent.com/u/3886989/World%20Snapshots/PA/DiamondUpgrade.png" height="115" width="245" /></p>
9+
This mod provides low tech automation tools for common tasks.
4210

11+
_Mod requires Forge to be installed._
12+
13+
The mod has the following blocks and items:
14+
15+
## [Upgrades](Upgrades)
16+
There are 4 tiers of upgrades that will upgrade most of the machine in PA, normally range but they may do something else. Check out the block pages to find out what they do for that block.
17+
18+
## [RFEngine](RFEngine)
19+
You can put this little item into the fuel slot of any PA machine and it will enable the machine to accept and run off RF power instead of solid fuel.
20+
21+
## [The Miner](Miner)
22+
This is a simple mining block that requires fuel and tools to run.
23+
You can read more about how the miner works on the [Miners](Miner) page.
24+
25+
## [The Chopper](Chopper)
26+
A simple machine for creating a tree farm. Requires an axe and fuel to run.
27+
Read more about it on the [Chopper](Chopper) page.
28+
29+
## [The Generator](Generator)
30+
This is a simple Generator that just requires fuel to run. All tiers produce the same amount, the later tiers just produce it faster.
31+
You can read more about how the generator works on the [Generator](Generator) page.

build.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
minecraft_version=1.7.2
22
forge_version=10.12.2.1121
3-
mod_version=1.2
3+
mod_version=1.3
44
buildNum=0
5-
droneAlter=18
5+
droneAlter=21
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package cofh.api.energy;
2+
3+
import net.minecraftforge.common.util.ForgeDirection;
4+
5+
/**
6+
* Implement this interface on TileEntities which should connect to energy transportation blocks. This is intended for blocks which generate energy but do not
7+
* accept it; otherwise just use IEnergyHandler.
8+
*
9+
* Note that {@link IEnergyHandler} is an extension of this.
10+
*
11+
* @author King Lemming
12+
*
13+
*/
14+
public interface IEnergyConnection {
15+
16+
/**
17+
* Returns TRUE if the TileEntity can connect on a given side.
18+
*/
19+
boolean canConnectEnergy(ForgeDirection from);
20+
21+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
package cofh.api.energy;
2+
3+
import net.minecraftforge.common.util.ForgeDirection;
4+
5+
/**
6+
* Implement this interface on Tile Entities which should handle energy, generally storing it in one or more internal {@link IEnergyStorage} objects.
7+
*
8+
* A reference implementation is provided {@link TileEnergyHandler}.
9+
*
10+
* @author King Lemming
11+
*
12+
*/
13+
public interface IEnergyHandler extends IEnergyConnection {
14+
15+
/**
16+
* Add energy to an IEnergyHandler, internal distribution is left entirely to the IEnergyHandler.
17+
*
18+
* @param from
19+
* Orientation the energy is received from.
20+
* @param maxReceive
21+
* Maximum amount of energy to receive.
22+
* @param simulate
23+
* If TRUE, the charge will only be simulated.
24+
* @return Amount of energy that was (or would have been, if simulated) received.
25+
*/
26+
int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate);
27+
28+
/**
29+
* Remove energy from an IEnergyHandler, internal distribution is left entirely to the IEnergyHandler.
30+
*
31+
* @param from
32+
* Orientation the energy is extracted from.
33+
* @param maxExtract
34+
* Maximum amount of energy to extract.
35+
* @param simulate
36+
* If TRUE, the extraction will only be simulated.
37+
* @return Amount of energy that was (or would have been, if simulated) extracted.
38+
*/
39+
int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate);
40+
41+
/**
42+
* Returns the amount of energy currently stored.
43+
*/
44+
int getEnergyStored(ForgeDirection from);
45+
46+
/**
47+
* Returns the maximum amount of energy that can be stored.
48+
*/
49+
int getMaxEnergyStored(ForgeDirection from);
50+
51+
}

src/main/java/com/vanhal/progressiveautomation/PAConfig.java

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,46 @@ public class PAConfig {
1212
//blocks
1313
public static boolean minerEnabled;
1414
public static boolean chopperEnabled;
15+
public static boolean generatorEnabled;
1516

1617
//allow levels
1718
public static boolean allowWoodenLevel;
1819
public static boolean allowStoneLevel;
1920
public static boolean allowIronLevel;
2021
public static boolean allowDiamondLevel;
2122

23+
//rf options
24+
public static boolean rfSupport;
25+
public static int rfCost;
26+
public static int rfStored;
27+
public static int rfRate;
28+
public static boolean enableGenerator;
29+
2230

2331
public static void init(ConfigHandler handle) {
2432
config = handle;
2533
upgradeRange = config.get("upgrades", "UpdateRange", 1, "How many blocks does each upgrade add (default is 1)");
2634
fuelCost = config.get("general", "fuelCost", 2, "Number to divide the normal burn time by for all machines.");
27-
if (fuelCost==0) fuelCost = 1;
35+
if (fuelCost<=0) fuelCost = 1;
36+
37+
//rf options
38+
rfSupport = config.get("rfoptions", "enableRF", true, "Set to false to disable RF support in this mod");
39+
40+
rfCost = config.get("rfoptions", "rfCost", 40, "RF per tick that the machines use");
41+
if (rfCost<=0) rfCost = 1000; //Cheater! Take that! :P
42+
43+
rfStored = config.get("rfoptions", "rfStored", 40000, "Amount of RF that the Engines store, needs to be at least the same as the cost");
44+
if (rfStored<rfCost) rfStored = rfCost;
45+
46+
rfRate = config.get("rfoptions", "rfRate", 1000, "The max rate at which RF can flow into the machines");
47+
if (rfRate<=0) rfRate = 1000;
48+
49+
enableGenerator = config.get("rfoptions", "generator", true, "Allows the PA generator to be made");
2850

51+
//enable blocks
2952
minerEnabled = config.get("blocks", "miner", true, "Miner Block is enabled");
3053
chopperEnabled = config.get("blocks", "chopper", true, "Tree Chopper Block is enabled");
54+
generatorEnabled = config.get("blocks", "chopper", true, "Generator Block is enabled");
3155

3256
allowWoodenLevel = config.get("upgrades", "wooden", true, "Allow wooden level blocks");
3357
allowStoneLevel = config.get("upgrades", "stone", true, "Allow stone level blocks");

src/main/java/com/vanhal/progressiveautomation/blocks/BaseBlock.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import com.vanhal.progressiveautomation.ProgressiveAutomation;
66
import com.vanhal.progressiveautomation.entities.BaseTileEntity;
77
import com.vanhal.progressiveautomation.entities.IUpgradeable;
8-
import com.vanhal.progressiveautomation.entities.TileMiner;
8+
import com.vanhal.progressiveautomation.entities.miner.TileMiner;
99
import com.vanhal.progressiveautomation.ref.Ref;
1010
import com.vanhal.progressiveautomation.ref.ToolHelper;
1111

@@ -20,12 +20,14 @@
2020
import net.minecraft.client.renderer.texture.IIconRegister;
2121
import net.minecraft.entity.item.EntityItem;
2222
import net.minecraft.entity.player.EntityPlayer;
23+
import net.minecraft.init.Blocks;
2324
import net.minecraft.item.Item;
2425
import net.minecraft.item.ItemStack;
2526
import net.minecraft.nbt.NBTTagCompound;
2627
import net.minecraft.tileentity.TileEntity;
2728
import net.minecraft.tileentity.TileEntityChest;
2829
import net.minecraft.util.IIcon;
30+
import net.minecraft.world.IBlockAccess;
2931
import net.minecraft.world.World;
3032
import net.minecraftforge.common.util.ForgeDirection;
3133

@@ -47,11 +49,27 @@ public static String returnLevelName(int level) {
4749
return "";
4850
}
4951

52+
public int getFlammability(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
53+
if (blockLevel==ToolHelper.LEVEL_WOOD) {
54+
return 5;
55+
} else {
56+
return 0;
57+
}
58+
}
59+
5060
public BaseBlock(String baseName, int level) {
5161
this(baseName+returnLevelName(level));
5262
blockLevel = level;
5363
}
5464

65+
public String getLevelName() {
66+
String thisName = returnLevelName(blockLevel);
67+
if (thisName=="") {
68+
thisName = "Wooden";
69+
}
70+
return thisName;
71+
}
72+
5573
public BaseBlock(String blockName) {
5674
super(Material.iron);
5775
name = blockName;

src/main/java/com/vanhal/progressiveautomation/blocks/BlockChopper.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
package com.vanhal.progressiveautomation.blocks;
22

33
import com.vanhal.progressiveautomation.ProgressiveAutomation;
4-
import com.vanhal.progressiveautomation.entities.TileChopper;
5-
import com.vanhal.progressiveautomation.entities.TileChopperDiamond;
6-
import com.vanhal.progressiveautomation.entities.TileChopperIron;
7-
import com.vanhal.progressiveautomation.entities.TileChopperStone;
8-
import com.vanhal.progressiveautomation.entities.TileMiner;
9-
import com.vanhal.progressiveautomation.entities.TileMinerDiamond;
10-
import com.vanhal.progressiveautomation.entities.TileMinerIron;
11-
import com.vanhal.progressiveautomation.entities.TileMinerStone;
4+
import com.vanhal.progressiveautomation.entities.chopper.TileChopper;
5+
import com.vanhal.progressiveautomation.entities.chopper.TileChopperDiamond;
6+
import com.vanhal.progressiveautomation.entities.chopper.TileChopperIron;
7+
import com.vanhal.progressiveautomation.entities.chopper.TileChopperStone;
8+
import com.vanhal.progressiveautomation.entities.miner.TileMiner;
9+
import com.vanhal.progressiveautomation.entities.miner.TileMinerDiamond;
10+
import com.vanhal.progressiveautomation.entities.miner.TileMinerIron;
11+
import com.vanhal.progressiveautomation.entities.miner.TileMinerStone;
1212
import com.vanhal.progressiveautomation.ref.ToolHelper;
1313

1414
import cpw.mods.fml.common.registry.GameRegistry;
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
package com.vanhal.progressiveautomation.blocks;
2+
3+
import net.minecraft.block.Block;
4+
import net.minecraft.client.renderer.texture.IIconRegister;
5+
import net.minecraft.entity.EntityLivingBase;
6+
import net.minecraft.init.Blocks;
7+
import net.minecraft.init.Items;
8+
import net.minecraft.item.ItemStack;
9+
import net.minecraft.tileentity.TileEntity;
10+
import net.minecraft.tileentity.TileEntityFurnace;
11+
import net.minecraft.util.IIcon;
12+
import net.minecraft.util.MathHelper;
13+
import net.minecraft.world.IBlockAccess;
14+
import net.minecraft.world.World;
15+
import net.minecraftforge.common.util.ForgeDirection;
16+
import net.minecraftforge.oredict.ShapedOreRecipe;
17+
18+
import com.vanhal.progressiveautomation.ProgressiveAutomation;
19+
import com.vanhal.progressiveautomation.entities.generator.TileGenerator;
20+
import com.vanhal.progressiveautomation.entities.generator.TileGeneratorDiamond;
21+
import com.vanhal.progressiveautomation.entities.generator.TileGeneratorIron;
22+
import com.vanhal.progressiveautomation.entities.generator.TileGeneratorStone;
23+
import com.vanhal.progressiveautomation.items.PAItems;
24+
import com.vanhal.progressiveautomation.ref.Ref;
25+
import com.vanhal.progressiveautomation.ref.ToolHelper;
26+
27+
import cpw.mods.fml.common.registry.GameRegistry;
28+
import cpw.mods.fml.relauncher.Side;
29+
import cpw.mods.fml.relauncher.SideOnly;
30+
31+
public class BlockGenerator extends BaseBlock {
32+
public IIcon iconTop;
33+
public IIcon iconSide;
34+
public IIcon inactiveGenerator;
35+
public IIcon activeGenerator;
36+
37+
public BlockGenerator(int level) {
38+
super("Generator", level);
39+
GUIid = ProgressiveAutomation.guiHandler.GeneratorGUI;
40+
}
41+
42+
public TileEntity createNewTileEntity(World world, int var2) {
43+
if (blockLevel >= ToolHelper.LEVEL_DIAMOND) return new TileGeneratorDiamond();
44+
else if (blockLevel == ToolHelper.LEVEL_IRON) return new TileGeneratorIron();
45+
else if (blockLevel == ToolHelper.LEVEL_STONE) return new TileGeneratorStone();
46+
else return new TileGenerator();
47+
}
48+
49+
public void addRecipe() {
50+
ShapedOreRecipe recipe = null;
51+
52+
if (blockLevel == ToolHelper.LEVEL_STONE) {
53+
recipe = new ShapedOreRecipe(new ItemStack(this), new Object[]{
54+
"ses", "scs", "sss", 's', Blocks.stone, 'c', PABlocks.woodenGenerator, 'e', PAItems.rfEngine});
55+
} else if (blockLevel == ToolHelper.LEVEL_IRON) {
56+
recipe = new ShapedOreRecipe(new ItemStack(this), new Object[]{
57+
"ses", "scs", "sbs", 's', Items.iron_ingot, 'c', PABlocks.stoneGenerator, 'b', Blocks.iron_block, 'e', PAItems.rfEngine});
58+
} else if (blockLevel >= ToolHelper.LEVEL_DIAMOND) {
59+
recipe = new ShapedOreRecipe(new ItemStack(this), new Object[]{
60+
"ses", "scs", "sss", 's', Items.diamond, 'c', PABlocks.ironGenerator, 'e', PAItems.rfEngine});
61+
} else {
62+
recipe = new ShapedOreRecipe(new ItemStack(this), new Object[]{
63+
"sps", "ses", "srs", 's', Blocks.log, 'r', Blocks.furnace, 'p', Blocks.redstone_block, 'e', PAItems.rfEngine});
64+
}
65+
66+
67+
GameRegistry.addRecipe(recipe);
68+
}
69+
70+
@SideOnly(Side.CLIENT)
71+
public void registerBlockIcons(IIconRegister register) {
72+
iconTop = register.registerIcon(Ref.MODID+":generator/"+getLevelName()+"_Top");
73+
iconSide = register.registerIcon(Ref.MODID+":generator/"+getLevelName()+"_Side");
74+
inactiveGenerator = register.registerIcon(Ref.MODID+":generator/"+getLevelName()+"_Front");
75+
activeGenerator= register.registerIcon(Ref.MODID+":generator/"+getLevelName()+"_FrontActive");
76+
}
77+
78+
@SideOnly(Side.CLIENT)
79+
public IIcon getIcon(int side, int metadata) {
80+
if (metadata==0) metadata = 3;
81+
return side == 1 ? iconTop : (side == 0 ? iconTop : (side != metadata ? iconSide : inactiveGenerator));
82+
}
83+
84+
@SideOnly(Side.CLIENT)
85+
public IIcon getIcon(IBlockAccess block, int x, int y, int z, int side) {
86+
int metadata = block.getBlockMetadata(x, y, z);
87+
TileGenerator entity = (TileGenerator) block.getTileEntity(x, y, z);
88+
if ( (side==metadata) && (entity.isBurning()) ) return activeGenerator;
89+
return this.getIcon(side, metadata);
90+
}
91+
92+
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack itemStack) {
93+
int l = MathHelper.floor_double((double)(entity.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
94+
95+
if (l == 0) {
96+
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
97+
}
98+
99+
if (l == 1) {
100+
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
101+
}
102+
103+
if (l == 2) {
104+
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
105+
}
106+
107+
if (l == 3) {
108+
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
109+
}
110+
111+
if (itemStack.hasDisplayName()) {
112+
((TileEntityFurnace)world.getTileEntity(x, y, z)).func_145951_a(itemStack.getDisplayName());
113+
}
114+
}
115+
}

src/main/java/com/vanhal/progressiveautomation/blocks/BlockMiner.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package com.vanhal.progressiveautomation.blocks;
22

33
import com.vanhal.progressiveautomation.ProgressiveAutomation;
4-
import com.vanhal.progressiveautomation.entities.TileMiner;
5-
import com.vanhal.progressiveautomation.entities.TileMinerDiamond;
6-
import com.vanhal.progressiveautomation.entities.TileMinerIron;
7-
import com.vanhal.progressiveautomation.entities.TileMinerStone;
4+
import com.vanhal.progressiveautomation.entities.miner.TileMiner;
5+
import com.vanhal.progressiveautomation.entities.miner.TileMinerDiamond;
6+
import com.vanhal.progressiveautomation.entities.miner.TileMinerIron;
7+
import com.vanhal.progressiveautomation.entities.miner.TileMinerStone;
88
import com.vanhal.progressiveautomation.ref.ToolHelper;
99

1010
import cpw.mods.fml.common.registry.GameRegistry;

0 commit comments

Comments
 (0)