Fixed water mill animation.
This commit is contained in:
parent
30302e241b
commit
d584aebcd8
2 changed files with 42 additions and 16 deletions
|
@ -32,6 +32,7 @@ import reborncore.api.IToolDrop;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||||
import reborncore.common.registration.RebornRegistry;
|
import reborncore.common.registration.RebornRegistry;
|
||||||
import reborncore.common.registration.impl.ConfigRegistry;
|
import reborncore.common.registration.impl.ConfigRegistry;
|
||||||
|
import techreborn.blocks.generator.BlockWindMill;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
import techreborn.lib.ModInfo;
|
import techreborn.lib.ModInfo;
|
||||||
|
|
||||||
|
@ -58,19 +59,23 @@ public class TileWaterMill extends TilePowerAcceptor implements IToolDrop {
|
||||||
@Override
|
@Override
|
||||||
public void update() {
|
public void update() {
|
||||||
super.update();
|
super.update();
|
||||||
if (this.world.getTotalWorldTime() % 20 == 0) {
|
if (world.getTotalWorldTime() % 20 == 0) {
|
||||||
this.checkForWater();
|
checkForWater();
|
||||||
}
|
}
|
||||||
if (this.waterblocks > 0) {
|
if (waterblocks > 0) {
|
||||||
this.addEnergy(this.waterblocks * energyMultiplier);
|
addEnergy(waterblocks * energyMultiplier);
|
||||||
|
world.setBlockState(pos, world.getBlockState(pos).withProperty(BlockWindMill.ACTIVE, true));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
world.setBlockState(pos, world.getBlockState(pos).withProperty(BlockWindMill.ACTIVE, false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkForWater() {
|
public void checkForWater() {
|
||||||
this.waterblocks = 0;
|
waterblocks = 0;
|
||||||
for (final EnumFacing facing : EnumFacing.HORIZONTALS) {
|
for (EnumFacing facing : EnumFacing.HORIZONTALS) {
|
||||||
if (this.world.getBlockState(this.getPos().offset(facing)).getBlock() == Blocks.WATER) {
|
if (world.getBlockState(pos.offset(facing)).getBlock() == Blocks.WATER) {
|
||||||
this.waterblocks++;
|
waterblocks++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,12 +86,12 @@ public class TileWaterMill extends TilePowerAcceptor implements IToolDrop {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canAcceptEnergy(final EnumFacing direction) {
|
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canProvideEnergy(final EnumFacing direction) {
|
public boolean canProvideEnergy(EnumFacing direction) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +106,7 @@ public class TileWaterMill extends TilePowerAcceptor implements IToolDrop {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getToolDrop(final EntityPlayer p0) {
|
public ItemStack getToolDrop(EntityPlayer playerIn) {
|
||||||
return new ItemStack(ModBlocks.WATER_MILL);
|
return new ItemStack(ModBlocks.WATER_MILL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,14 +14,35 @@
|
||||||
"transform": "forge:default-block",
|
"transform": "forge:default-block",
|
||||||
"model": "cube_bottom_top",
|
"model": "cube_bottom_top",
|
||||||
"textures": {
|
"textures": {
|
||||||
|
"top": "techreborn:blocks/machines/generators/watermill_top_off",
|
||||||
"side": "techreborn:blocks/machines/generators/watermill_side_off"
|
"side": "techreborn:blocks/machines/generators/watermill_side_off"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"normal": {
|
"facing": {
|
||||||
"transform": "forge:default-block",
|
"north": {
|
||||||
"model": "cube_bottom_top",
|
},
|
||||||
"textures": {
|
"east": {
|
||||||
"side": "techreborn:blocks/machines/generators/watermill_side_off"
|
"y": 90
|
||||||
|
},
|
||||||
|
"south": {
|
||||||
|
"y": 180
|
||||||
|
},
|
||||||
|
"west": {
|
||||||
|
"y": 270
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"active": {
|
||||||
|
"true": {
|
||||||
|
"textures": {
|
||||||
|
"top": "techreborn:blocks/machines/generators/watermill_top_on",
|
||||||
|
"side": "techreborn:blocks/machines/generators/watermill_side_on"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"false": {
|
||||||
|
"textures": {
|
||||||
|
"top": "techreborn:blocks/machines/generators/watermill_top_off",
|
||||||
|
"side": "techreborn:blocks/machines/generators/watermill_side_off"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue