Added wind and water mill
This commit is contained in:
parent
efbf4c59bb
commit
d0392dabb8
7 changed files with 179 additions and 0 deletions
|
@ -0,0 +1,25 @@
|
||||||
|
package techreborn.blocks.generator;
|
||||||
|
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import reborncore.common.BaseTileBlock;
|
||||||
|
import techreborn.client.TechRebornCreativeTab;
|
||||||
|
import techreborn.tiles.generator.TileWaterMill;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by mark on 25/02/2016.
|
||||||
|
*/
|
||||||
|
public class BlockWaterMill extends BaseTileBlock {
|
||||||
|
|
||||||
|
public BlockWaterMill() {
|
||||||
|
super(Material.iron);
|
||||||
|
setUnlocalizedName("techreborn.watermill");
|
||||||
|
setCreativeTab(TechRebornCreativeTab.instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TileEntity createNewTileEntity(World worldIn, int meta) {
|
||||||
|
return new TileWaterMill();
|
||||||
|
}
|
||||||
|
}
|
25
src/main/java/techreborn/blocks/generator/BlockWindMill.java
Normal file
25
src/main/java/techreborn/blocks/generator/BlockWindMill.java
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
package techreborn.blocks.generator;
|
||||||
|
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import reborncore.common.BaseTileBlock;
|
||||||
|
import techreborn.client.TechRebornCreativeTab;
|
||||||
|
import techreborn.tiles.generator.TileWindMill;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by mark on 25/02/2016.
|
||||||
|
*/
|
||||||
|
public class BlockWindMill extends BaseTileBlock {
|
||||||
|
|
||||||
|
public BlockWindMill() {
|
||||||
|
super(Material.iron);
|
||||||
|
setUnlocalizedName("techreborn.windmill");
|
||||||
|
setCreativeTab(TechRebornCreativeTab.instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TileEntity createNewTileEntity(World worldIn, int meta) {
|
||||||
|
return new TileWindMill();
|
||||||
|
}
|
||||||
|
}
|
|
@ -80,6 +80,8 @@ public class ModBlocks {
|
||||||
public static Block Extractor;
|
public static Block Extractor;
|
||||||
public static Block ElectricFurnace;
|
public static Block ElectricFurnace;
|
||||||
public static Block solarPanel;
|
public static Block solarPanel;
|
||||||
|
public static Block waterMill;
|
||||||
|
public static Block windMill;
|
||||||
|
|
||||||
public static BlockOre ore;
|
public static BlockOre ore;
|
||||||
public static BlockOre2 ore2;
|
public static BlockOre2 ore2;
|
||||||
|
@ -289,6 +291,14 @@ public class ModBlocks {
|
||||||
GameRegistry.registerBlock(solarPanel, "techreborn.solarpanel");
|
GameRegistry.registerBlock(solarPanel, "techreborn.solarpanel");
|
||||||
GameRegistry.registerTileEntity(TileSolarPanel.class, "TileSolarPanel");
|
GameRegistry.registerTileEntity(TileSolarPanel.class, "TileSolarPanel");
|
||||||
|
|
||||||
|
waterMill = new BlockWaterMill();
|
||||||
|
GameRegistry.registerBlock(waterMill, "techreborn.watermill");
|
||||||
|
GameRegistry.registerTileEntity(TileWaterMill.class, "TileWaterMill");
|
||||||
|
|
||||||
|
windMill = new BlockWindMill();
|
||||||
|
GameRegistry.registerBlock(windMill, "techreborn.windmill");
|
||||||
|
GameRegistry.registerTileEntity(TileWindMill.class, "TileWindMill");
|
||||||
|
|
||||||
GameRegistry.registerTileEntity(TileMachineBase.class, "TileMachineBaseTR");
|
GameRegistry.registerTileEntity(TileMachineBase.class, "TileMachineBaseTR");
|
||||||
|
|
||||||
rubberLog = new BlockRubberLog();
|
rubberLog = new BlockRubberLog();
|
||||||
|
|
|
@ -60,6 +60,7 @@ public class RecipeCompact implements IRecipeCompact {
|
||||||
recipes.put("lvTransformer", ItemParts.getPartByName("lvTransformer"));
|
recipes.put("lvTransformer", ItemParts.getPartByName("lvTransformer"));
|
||||||
recipes.put("mvTransformer", ItemParts.getPartByName("mvTransformer"));
|
recipes.put("mvTransformer", ItemParts.getPartByName("mvTransformer"));
|
||||||
recipes.put("hvTransformer", ItemParts.getPartByName("hvTransformer"));
|
recipes.put("hvTransformer", ItemParts.getPartByName("hvTransformer"));
|
||||||
|
recipes.put("windMill", new ItemStack(ModBlocks.windMill));
|
||||||
inited = false;
|
inited = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
63
src/main/java/techreborn/tiles/generator/TileWaterMill.java
Normal file
63
src/main/java/techreborn/tiles/generator/TileWaterMill.java
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
package techreborn.tiles.generator;
|
||||||
|
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by mark on 25/02/2016.
|
||||||
|
*/
|
||||||
|
public class TileWaterMill extends TilePowerAcceptor {
|
||||||
|
|
||||||
|
public TileWaterMill() {
|
||||||
|
super(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
int waterblocks = 0;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateEntity() {
|
||||||
|
super.updateEntity();
|
||||||
|
if(worldObj.getTotalWorldTime() % 20 == 0){
|
||||||
|
checkForWater();
|
||||||
|
}
|
||||||
|
if(waterblocks > 0){
|
||||||
|
addEnergy(waterblocks);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void checkForWater(){
|
||||||
|
waterblocks = 0;
|
||||||
|
for(EnumFacing facing : EnumFacing.HORIZONTALS){
|
||||||
|
if(worldObj.getBlockState(getPos().offset(facing)).getBlock() == Blocks.water){
|
||||||
|
waterblocks ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getMaxPower() {
|
||||||
|
return 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canProvideEnergy(EnumFacing direction) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getMaxOutput() {
|
||||||
|
return 32;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getMaxInput() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
53
src/main/java/techreborn/tiles/generator/TileWindMill.java
Normal file
53
src/main/java/techreborn/tiles/generator/TileWindMill.java
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
package techreborn.tiles.generator;
|
||||||
|
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by mark on 25/02/2016.
|
||||||
|
*/
|
||||||
|
public class TileWindMill extends TilePowerAcceptor {
|
||||||
|
|
||||||
|
public TileWindMill() {
|
||||||
|
super(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
int basePower = 480;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateEntity() {
|
||||||
|
super.updateEntity();
|
||||||
|
if(pos.getY() > 64){
|
||||||
|
int actualPower = basePower;
|
||||||
|
if(worldObj.isThundering()){
|
||||||
|
actualPower *= 1.25;
|
||||||
|
}
|
||||||
|
addEnergy(actualPower * (pos.getY() - 64)); //Value taken from http://wiki.industrial-craft.net/?title=Wind_Mill Not worth making more complicated
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getMaxPower() {
|
||||||
|
return 10000;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canProvideEnergy(EnumFacing direction) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getMaxOutput() {
|
||||||
|
return 128;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getMaxInput() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
|
@ -65,6 +65,8 @@ tile.techreborn.ore2.tin.name=Tin Ore
|
||||||
tile.techreborn.storage2.copper.name=Copper Block
|
tile.techreborn.storage2.copper.name=Copper Block
|
||||||
tile.techreborn.storage2.tin.name=Tin Block
|
tile.techreborn.storage2.tin.name=Tin Block
|
||||||
tile.techreborn.solarpanel.name=Solar panel
|
tile.techreborn.solarpanel.name=Solar panel
|
||||||
|
tile.techreborn.watermill.name=Water Mill
|
||||||
|
tile.techreborn.windmill.name=Wind Mill
|
||||||
|
|
||||||
#Blocks
|
#Blocks
|
||||||
tile.techreborn.rubberlog.name=Rubber Wood
|
tile.techreborn.rubberlog.name=Rubber Wood
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue