Merge branch 'buildcraft131' of github.com:SirSengir/BuildCraft into buildcraft131
This commit is contained in:
commit
5ad6bd1d57
1 changed files with 22 additions and 8 deletions
|
@ -11,17 +11,31 @@ package buildcraft.energy;
|
||||||
|
|
||||||
import buildcraft.BuildCraftEnergy;
|
import buildcraft.BuildCraftEnergy;
|
||||||
import net.minecraft.src.ItemStack;
|
import net.minecraft.src.ItemStack;
|
||||||
|
import net.minecraft.src.MovingObjectPosition;
|
||||||
import net.minecraft.src.World;
|
import net.minecraft.src.World;
|
||||||
import net.minecraft.src.forge.IBucketHandler;
|
import net.minecraftforge.event.ForgeSubscribe;
|
||||||
|
import net.minecraftforge.event.entity.player.FillBucketEvent;
|
||||||
|
|
||||||
public class OilBucketHandler implements IBucketHandler {
|
public class OilBucketHandler{
|
||||||
|
|
||||||
|
@ForgeSubscribe
|
||||||
|
public void onBucketFill(FillBucketEvent event){
|
||||||
|
ItemStack result=fillCustomBucket(event.world,event.target);
|
||||||
|
if(result==null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
event.result=result;
|
||||||
|
event.setHandeled();
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
public ItemStack fillCustomBucket(World w,MovingObjectPosition pos) {
|
||||||
|
int blockID=w.getBlockId(pos.blockX,pos.blockY,pos.blockZ);
|
||||||
|
if (( blockID== BuildCraftEnergy.oilStill.blockID || blockID == BuildCraftEnergy.oilMoving.blockID)
|
||||||
|
&& w.getBlockMetadata(pos.blockX,pos.blockY,pos.blockZ) == 0) {
|
||||||
|
|
||||||
@Override
|
w.setBlockWithNotify(pos.blockX,pos.blockY,pos.blockZ, 0);
|
||||||
public ItemStack fillCustomBucket(World w, int i, int j, int k) {
|
|
||||||
if ((w.getBlockId(i, j, k) == BuildCraftEnergy.oilStill.blockID || w.getBlockId(i, j, k) == BuildCraftEnergy.oilMoving.blockID)
|
|
||||||
&& w.getBlockMetadata(i, j, k) == 0) {
|
|
||||||
|
|
||||||
w.setBlockWithNotify(i, j, k, 0);
|
|
||||||
|
|
||||||
return new ItemStack(BuildCraftEnergy.bucketOil);
|
return new ItemStack(BuildCraftEnergy.bucketOil);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue