當前位置: 首頁>>代碼示例>>Java>>正文


Java FillBucketEvent.setResult方法代碼示例

本文整理匯總了Java中net.minecraftforge.event.entity.player.FillBucketEvent.setResult方法的典型用法代碼示例。如果您正苦於以下問題:Java FillBucketEvent.setResult方法的具體用法?Java FillBucketEvent.setResult怎麽用?Java FillBucketEvent.setResult使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraftforge.event.entity.player.FillBucketEvent的用法示例。


在下文中一共展示了FillBucketEvent.setResult方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onFillBucket

import net.minecraftforge.event.entity.player.FillBucketEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onFillBucket(FillBucketEvent event) {
    RayTraceResult rtr = event.getTarget();
    if (rtr != null) {
        Block b = event.getWorld().getBlockState(rtr.getBlockPos()).getBlock();
        if (b instanceof IFluidBlock) {
            Fluid fluid = ((IFluidBlock) b).getFluid();
            ItemStack filled = FluidUtil.getFilledBucket(new FluidStack(fluid, 1000));
            if (!filled.isEmpty()) {
                event.setFilledBucket(FluidUtil.getFilledBucket(new FluidStack(fluid, 1000)));
                event.getWorld().setBlockToAir(rtr.getBlockPos());
                event.setResult(Result.ALLOW);
                if (TileEntityRefinery.isInputFluidValid(fluid, 4) && event.getEntityPlayer() instanceof EntityPlayerMP) {
                    AdvancementTriggers.OIL_BUCKET.trigger((EntityPlayerMP) event.getEntityPlayer());
                }
            }
        }
    }
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:20,代碼來源:EventHandlerPneumaticCraft.java

示例2: bucketFill

import net.minecraftforge.event.entity.player.FillBucketEvent; //導入方法依賴的package包/類
@ForgeSubscribe
/**
 * Called by ItemBucket when it tries to fill a bucket
 * @param evt
 */
public void bucketFill(FillBucketEvent evt) {
    if (evt.current.getItem().equals(Item.bucketEmpty) && evt.target.typeOfHit == EnumMovingObjectType.TILE) {
        if (evt.world.canMineBlock(evt.entityPlayer, evt.target.blockX, evt.target.blockY, evt.target.blockZ)) {
            if (evt.entityPlayer.canPlayerEdit(evt.target.blockX, evt.target.blockY, evt.target.blockZ, evt.target.sideHit, evt.current)) {
                if (evt.world.getBlockId(evt.target.blockX, evt.target.blockY, evt.target.blockZ) == blockID) {
                    evt.world.setBlockToAir(evt.target.blockX, evt.target.blockY, evt.target.blockZ);
                    evt.result = new ItemStack(Magitech.instance.magibucket);
                    evt.setResult(Result.ALLOW);
                }
            }
        }
    }
}
 
開發者ID:froschi3b,項目名稱:Magitech,代碼行數:19,代碼來源:BlockMagi.java

示例3: onBucketFill

import net.minecraftforge.event.entity.player.FillBucketEvent; //導入方法依賴的package包/類
@SubscribeEvent(priority = EventPriority.HIGH)
public void onBucketFill(FillBucketEvent evt) {
	if (evt.getResult() != Result.DEFAULT) return;

	if (evt.getEmptyBucket().getItem() != EMPTY_BUCKET) return;

	final RayTraceResult target = evt.getTarget();
	if (target == null || target.typeOfHit != RayTraceResult.Type.BLOCK) return;

	final TileEntity te = evt.getWorld().getTileEntity(target.getBlockPos());
	if (te == null) return;

	if (te.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, target.sideHit)) {
		final IFluidHandler source = te.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, target.sideHit);

		final FluidStack drained = source.drain(containedFluid, false);
		if (containedFluid.isFluidStackIdentical(drained)) {
			source.drain(containedFluid, true);
			evt.setFilledBucket(filledBucket.copy());
			evt.setResult(Result.ALLOW);
		}
	}
}
 
開發者ID:OpenMods,項目名稱:OpenModsLib,代碼行數:24,代碼來源:SingleFluidBucketFillHandler.java

示例4: onBucketFill

import net.minecraftforge.event.entity.player.FillBucketEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onBucketFill(FillBucketEvent event)
{
    MovingObjectPosition pos = event.target;

    ItemStack ret = fillBucket(event.world, pos);

    if (ret == null)
    {
        return;
    }

    event.result = ret;
    event.setResult(Result.ALLOW);
}
 
開發者ID:4Space,項目名稱:4Space-5,代碼行數:16,代碼來源:EventHandlerGC.java

示例5: onBucketFill

import net.minecraftforge.event.entity.player.FillBucketEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onBucketFill(FillBucketEvent event) {
	
	ItemStack result = fillCustomBucket(event.world, event.target);
	
	if (result == null)
		return;
	
	event.result = result;
	event.setResult(Event.Result.ALLOW);
}
 
開發者ID:austinv11,項目名稱:DartCraft2,代碼行數:12,代碼來源:BucketHandler.java

示例6: onBucketFill

import net.minecraftforge.event.entity.player.FillBucketEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onBucketFill(FillBucketEvent event) {

        ItemStack result = fillCustomBucket(event.world, event.target);

        if (result == null)
                return;

        event.result = result;
        event.setResult(Result.ALLOW);
}
 
開發者ID:planetguy32,項目名稱:Enterprise,代碼行數:12,代碼來源:FluidPrefab.java

示例7: bucketFill

import net.minecraftforge.event.entity.player.FillBucketEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void bucketFill(FillBucketEvent event) {
	//Prevent stupid shit in single player.
	if(!event.world.isRemote){
		MovingObjectPosition target = event.target;
		//Have we clicked a tile with an empty bucket?
		if (event.current.getItem() == Items.bucket && event.target.typeOfHit == MovingObjectType.BLOCK) {
			//Is there an entry for this block's ID?
			if(fluidToBucket.get(event.world.getBlock(target.blockX, target.blockY, target.blockZ)) != null) {
				//Set our event's item to our fluid.
				event.result = fluidToBucket.get(event.world.getBlock(target.blockX, target.blockY, target.blockZ)).copy();
				//Allow this to happen.
				event.setResult(Result.ALLOW);
				//Set the block to 0 so we don't just have infinite liquid.
				event.world.setBlockToAir(target.blockX, target.blockY, target.blockZ);
			}
			else {
				//Nothing we recognize.
				return;
			}
		}
		else {
			//Not an acceptable event.
			return;
		}
	}
}
 
開發者ID:NotGyro,項目名稱:WeirdScience,代碼行數:28,代碼來源:BucketEventManager.java

示例8: onBucketFill

import net.minecraftforge.event.entity.player.FillBucketEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onBucketFill(FillBucketEvent event) {

    ItemStack result = fillCustomBucket(event.world, event.target);

    if (result == null)
        return;

    event.result = result;
    event.setResult(Event.Result.ALLOW);
}
 
開發者ID:M4thG33k,項目名稱:M4thThings,代碼行數:12,代碼來源:BucketHandler.java

示例9: onBucketFill

import net.minecraftforge.event.entity.player.FillBucketEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onBucketFill(FillBucketEvent event)
{
	IBlockState block = event.world.getBlockState(event.target.getBlockPos());
	if (block.getBlock() == MBlocks.magma)
	{
		event.result = new ItemStack(MBlocks.magmaBucket);
		event.world.setBlockToAir(event.target.getBlockPos());
		event.setResult(Result.ALLOW);
	}
}
 
開發者ID:MinestrapTeam,項目名稱:Minestrappolation-4,代碼行數:12,代碼來源:MEventHandler.java

示例10: onBucketFill

import net.minecraftforge.event.entity.player.FillBucketEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onBucketFill(FillBucketEvent event) {
    if (event.getEntityPlayer() != null) {
        Biome biome = event.getWorld().getBiomeForCoordsBody(event.getTarget().getBlockPos());
        if (biome == Biomes.OCEAN || biome == Biomes.DEEP_OCEAN || biome == Biomes.FROZEN_OCEAN) {
            event.setResult(Event.Result.ALLOW);
            event.setFilledBucket(new ItemStack(PLItems.saltWaterBucket));
        }
    }
}
 
開發者ID:GoodTimeStudio,項目名稱:Production-Line,代碼行數:11,代碼來源:PLEvent.java

示例11: onBucketFill

import net.minecraftforge.event.entity.player.FillBucketEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onBucketFill(FillBucketEvent event) {
	Block block = event.world.getBlock(event.target.blockX, event.target.blockY, event.target.blockZ);
	Item bucket = bucketMap.get(block);
	
	if(bucket != null && event.world.getBlockMetadata(event.target.blockX, event.target.blockY, event.target.blockZ) == 0) {
		event.world.setBlockToAir(event.target.blockX, event.target.blockY, event.target.blockZ);
		
		event.result = new ItemStack(bucket);
		
		bucket.hasContainerItem(event.result);
		
		event.setResult(Result.ALLOW);
	}
}
 
開發者ID:zmaster587,項目名稱:AdvancedRocketry,代碼行數:16,代碼來源:BucketHandler.java

示例12: onBucketFill

import net.minecraftforge.event.entity.player.FillBucketEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onBucketFill( FillBucketEvent event )
{

  ItemStack result = fillCustomBucket( event.world, event.target );

  if( result == null )
    return;

  event.result = result;
  event.setResult( Result.ALLOW );
}
 
開發者ID:GTNewHorizons,項目名稱:Yamcl,代碼行數:13,代碼來源:BucketHandler.java

示例13: fillBucket

import net.minecraftforge.event.entity.player.FillBucketEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void fillBucket(FillBucketEvent event) {
    if(event.target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
        if(event.world.getBlock(event.target.blockX, event.target.blockY, event.target.blockZ) == RidiculousBlocks.liquidTimeBlock && event.world.getBlockMetadata(event.target.blockX, event.target.blockY, event.target.blockZ) == 0) {
            event.world.setBlockToAir(event.target.blockX, event.target.blockY, event.target.blockZ);
            event.result = new ItemStack(RidiculousItems.timeBucket);
            event.setResult(Event.Result.ALLOW);
            return;
        }

    }

}
 
開發者ID:SpitefulFox,項目名稱:RidiculousWorld,代碼行數:14,代碼來源:RWEventHandler.java

示例14: onBucketFill

import net.minecraftforge.event.entity.player.FillBucketEvent; //導入方法依賴的package包/類
@ForgeSubscribe
public void onBucketFill(FillBucketEvent event) // NO_UCD (unused code)
{
    ItemStack result = fillCustomBucket( event.world,
                                         event.target );

    if (result != null)
    {
        event.result = result;
        event.setResult( Result.ALLOW );
    }
}
 
開發者ID:Maxwolf,項目名稱:MC-MineAPI.Java,代碼行數:13,代碼來源:FluidBucketTemplate.java

示例15: onBucketFill

import net.minecraftforge.event.entity.player.FillBucketEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onBucketFill(FillBucketEvent event) {
        ItemStack result = fillCustomBucket(event.world, event.target);

        if (result == null)
                return;

        event.result = result;
        event.setResult(Result.ALLOW);
}
 
開發者ID:OmgImAlexis,項目名稱:TheStuffMod,代碼行數:11,代碼來源:BucketHandler.java


注:本文中的net.minecraftforge.event.entity.player.FillBucketEvent.setResult方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。