Fixed Fluid Placer not being able to place

This commit is contained in:
Ellpeck 2016-05-03 21:31:54 +02:00
parent 16c2c22cf7
commit af8356c9ef
2 changed files with 14 additions and 5 deletions

View file

@ -15,6 +15,7 @@ import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
@ -83,16 +84,20 @@ public class TileEntityFluidCollector extends TileEntityInventoryBase implements
} }
else if(this.isPlacer && PosUtil.getBlock(coordsBlock, this.worldObj).isReplaceable(this.worldObj, coordsBlock)){ else if(this.isPlacer && PosUtil.getBlock(coordsBlock, this.worldObj).isReplaceable(this.worldObj, coordsBlock)){
if(this.tank.getFluidAmount() >= FluidContainerRegistry.BUCKET_VOLUME){ if(this.tank.getFluidAmount() >= FluidContainerRegistry.BUCKET_VOLUME){
//TODO Fix this because apparently getting the item of the water block (for the ItemStack) returns null
Block block = this.tank.getFluid().getFluid().getBlock(); Block block = this.tank.getFluid().getFluid().getBlock();
if(block != null){ if(block != null){
WorldUtil.useItemAtSide(sideToManipulate, this.worldObj, this.pos, new ItemStack(block)); BlockPos offsetPos = this.pos.offset(sideToManipulate);
Block blockPresent = PosUtil.getBlock(offsetPos, this.worldObj);
boolean replaceable = blockPresent.isReplaceable(this.worldObj, offsetPos);
if(replaceable){
PosUtil.setBlock(offsetPos, this.worldObj, block, 0, 3);
this.tank.drain(FluidContainerRegistry.BUCKET_VOLUME, true); this.tank.drain(FluidContainerRegistry.BUCKET_VOLUME, true);
} }
} }
} }
} }
} }
}
@Override @Override
public int fill(EnumFacing from, FluidStack resource, boolean doFill){ public int fill(EnumFacing from, FluidStack resource, boolean doFill){

View file

@ -8,10 +8,14 @@
"normal": [{}], "normal": [{}],
"inventory": [{}], "inventory": [{}],
"meta": { "meta": {
"0": { "y" : 0 }, "0": { "y" : 0},
"1": { "y" : 180 }, "1": { "y" : 180 },
"2": { "y" : 270 }, "2": { "y" : 270 },
"3": { "y" : 90 } "3": { "y" : 90 },
"4": { "y" : 0, "model": "actuallyadditions:blockSmileyCloudFluffy" },
"5": { "y" : 180, "model": "actuallyadditions:blockSmileyCloudFluffy" },
"6": { "y" : 270, "model": "actuallyadditions:blockSmileyCloudFluffy" },
"7": { "y" : 90, "model": "actuallyadditions:blockSmileyCloudFluffy" }
} }
} }
} }