Added wind and water mill

This commit is contained in:
modmuss50 2016-02-25 20:03:58 +00:00
parent efbf4c59bb
commit d0392dabb8
7 changed files with 179 additions and 0 deletions

View 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.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();
}
}

View 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();
}
}

View file

@ -80,6 +80,8 @@ public class ModBlocks {
public static Block Extractor;
public static Block ElectricFurnace;
public static Block solarPanel;
public static Block waterMill;
public static Block windMill;
public static BlockOre ore;
public static BlockOre2 ore2;
@ -289,6 +291,14 @@ public class ModBlocks {
GameRegistry.registerBlock(solarPanel, "techreborn.solarpanel");
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");
rubberLog = new BlockRubberLog();

View file

@ -60,6 +60,7 @@ public class RecipeCompact implements IRecipeCompact {
recipes.put("lvTransformer", ItemParts.getPartByName("lvTransformer"));
recipes.put("mvTransformer", ItemParts.getPartByName("mvTransformer"));
recipes.put("hvTransformer", ItemParts.getPartByName("hvTransformer"));
recipes.put("windMill", new ItemStack(ModBlocks.windMill));
inited = false;
}

View 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;
}
}

View 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;
}
}

View file

@ -65,6 +65,8 @@ tile.techreborn.ore2.tin.name=Tin Ore
tile.techreborn.storage2.copper.name=Copper Block
tile.techreborn.storage2.tin.name=Tin Block
tile.techreborn.solarpanel.name=Solar panel
tile.techreborn.watermill.name=Water Mill
tile.techreborn.windmill.name=Wind Mill
#Blocks
tile.techreborn.rubberlog.name=Rubber Wood