Added wind and water mill
This commit is contained in:
parent
efbf4c59bb
commit
d0392dabb8
7 changed files with 179 additions and 0 deletions
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;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue