mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 23:28:35 +01:00
Made solar panels work through non-solid blocks
This commit is contained in:
parent
ecb6eddc06
commit
541410be5e
4 changed files with 7 additions and 11 deletions
|
@ -45,11 +45,6 @@ public class CreativeTab extends CreativeTabs{
|
||||||
return 70;
|
return 70;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getIconItemStack(){
|
|
||||||
return new ItemStack(this.getTabIconItem());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getTabIconItem(){
|
public Item getTabIconItem(){
|
||||||
return InitItems.itemBooklet;
|
return InitItems.itemBooklet;
|
||||||
|
|
|
@ -87,7 +87,7 @@ public class TileEntityBreaker extends TileEntityInventoryBase{
|
||||||
BlockPos coordsBlock = this.pos.offset(sideToManipulate);
|
BlockPos coordsBlock = this.pos.offset(sideToManipulate);
|
||||||
IBlockState stateToBreak = this.worldObj.getBlockState(coordsBlock);
|
IBlockState stateToBreak = this.worldObj.getBlockState(coordsBlock);
|
||||||
Block blockToBreak = stateToBreak.getBlock();
|
Block blockToBreak = stateToBreak.getBlock();
|
||||||
if(!this.isPlacer && blockToBreak != null && !(blockToBreak instanceof BlockAir) && !(blockToBreak instanceof BlockLiquid) && !(blockToBreak instanceof IFluidBlock) && blockToBreak.getBlockHardness(stateToBreak, this.worldObj, coordsBlock) >= 0.0F){
|
if(!this.isPlacer && blockToBreak != null && !this.worldObj.isAirBlock(coordsBlock) && !(blockToBreak instanceof BlockLiquid) && !(blockToBreak instanceof IFluidBlock) && blockToBreak.getBlockHardness(stateToBreak, this.worldObj, coordsBlock) >= 0.0F){
|
||||||
List<ItemStack> drops = blockToBreak.getDrops(this.worldObj, coordsBlock, stateToBreak, 0);
|
List<ItemStack> drops = blockToBreak.getDrops(this.worldObj, coordsBlock, stateToBreak, 0);
|
||||||
float chance = ForgeEventFactory.fireBlockHarvesting(drops, this.worldObj, coordsBlock, this.worldObj.getBlockState(coordsBlock), 0, 1, false, null);
|
float chance = ForgeEventFactory.fireBlockHarvesting(drops, this.worldObj, coordsBlock, this.worldObj.getBlockState(coordsBlock), 0, 1, false, null);
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implem
|
||||||
for(int i = 0; i < RANGE; i++){
|
for(int i = 0; i < RANGE; i++){
|
||||||
BlockPos coordsBlock = this.pos.offset(sideToManipulate, i+1);
|
BlockPos coordsBlock = this.pos.offset(sideToManipulate, i+1);
|
||||||
Block blockToBreak = this.worldObj.getBlockState(coordsBlock).getBlock();
|
Block blockToBreak = this.worldObj.getBlockState(coordsBlock).getBlock();
|
||||||
if(blockToBreak != null && !(blockToBreak instanceof BlockAir) && blockToBreak.getBlockHardness(this.worldObj.getBlockState(coordsBlock), this.worldObj, this.pos) > -1.0F){
|
if(blockToBreak != null && !this.worldObj.isAirBlock(coordsBlock) && blockToBreak.getBlockHardness(this.worldObj.getBlockState(coordsBlock), this.worldObj, this.pos) > -1.0F){
|
||||||
List<ItemStack> drops = blockToBreak.getDrops(this.worldObj, coordsBlock, this.worldObj.getBlockState(coordsBlock), 0);
|
List<ItemStack> drops = blockToBreak.getDrops(this.worldObj, coordsBlock, this.worldObj.getBlockState(coordsBlock), 0);
|
||||||
float chance = ForgeEventFactory.fireBlockHarvesting(drops, this.worldObj, coordsBlock, this.worldObj.getBlockState(coordsBlock), 0, 1, false, null);
|
float chance = ForgeEventFactory.fireBlockHarvesting(drops, this.worldObj, coordsBlock, this.worldObj.getBlockState(coordsBlock), 0, 1, false, null);
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.tile;
|
package de.ellpeck.actuallyadditions.mod.tile;
|
||||||
|
|
||||||
import cofh.api.energy.EnergyStorage;
|
import cofh.api.energy.EnergyStorage;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.blocks.BlockFurnaceSolar;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
@ -76,10 +78,9 @@ public class TileEntityFurnaceSolar extends TileEntityBase implements ISharingEn
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasBlockAbove(){
|
public boolean hasBlockAbove(){
|
||||||
for(int y = 1; y <= this.worldObj.getHeight(); y++){
|
for(int y = 1; y <= this.worldObj.getHeight()-this.pos.getY(); y++){
|
||||||
BlockPos offset = this.pos.up(y);
|
IBlockState state = this.worldObj.getBlockState(this.pos.up(y));
|
||||||
IBlockState state = this.worldObj.getBlockState(offset);
|
if(state.getMaterial().isOpaque()){
|
||||||
if(!state.getBlock().isAir(state, this.worldObj, offset)){
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue