Merge pull request #415 from Rushmead/1.9
Fixes solar panels being powered wierdly...
This commit is contained in:
commit
9ea37a0799
2 changed files with 30 additions and 10 deletions
|
@ -1,12 +1,15 @@
|
|||
package techreborn.blocks.generator;
|
||||
|
||||
import me.modmuss50.jsonDestroyer.api.ITexturedBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.common.BaseTileBlock;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
|
@ -54,6 +57,31 @@ public class BlockSolarPanel extends BaseTileBlock implements ITexturedBlock
|
|||
return new TileSolarPanel();
|
||||
}
|
||||
|
||||
@Override public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
|
||||
{
|
||||
if(worldIn.canBlockSeeSky(pos.up()) && !worldIn.isRaining() && !worldIn.isThundering()
|
||||
&& worldIn.isDaytime()){
|
||||
worldIn.setBlockState(pos,
|
||||
worldIn.getBlockState(pos).withProperty(BlockSolarPanel.ACTIVE, true));
|
||||
}else{
|
||||
|
||||
worldIn.setBlockState(pos,
|
||||
worldIn.getBlockState(pos).withProperty(BlockSolarPanel.ACTIVE, false));
|
||||
}
|
||||
}
|
||||
|
||||
@Override public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY,
|
||||
float hitZ, int meta, EntityLivingBase placer)
|
||||
{
|
||||
if(worldIn.canBlockSeeSky(pos.up()) && !worldIn.isRaining() && !worldIn.isThundering()
|
||||
&& worldIn.isDaytime()){
|
||||
return this.getDefaultState().withProperty(ACTIVE, true);
|
||||
|
||||
}else{
|
||||
return this.getDefaultState().withProperty(ACTIVE, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureNameFromState(IBlockState state, EnumFacing side)
|
||||
{
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
package techreborn.tiles.generator;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import techreborn.blocks.generator.BlockSolarPanel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 25/02/2016.
|
||||
|
@ -39,13 +38,6 @@ public class TileSolarPanel extends TilePowerAcceptor
|
|||
{
|
||||
powerToAdd = 0;
|
||||
}
|
||||
if (shouldMakePower != lastTickSate)
|
||||
{
|
||||
if (worldObj != null)
|
||||
worldObj.setBlockState(pos,
|
||||
worldObj.getBlockState(pos).withProperty(BlockSolarPanel.ACTIVE, shouldMakePower));
|
||||
}
|
||||
lastTickSate = shouldMakePower;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue