本文整理匯總了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());
}
}
}
}
}
示例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);
}
}
}
}
}
示例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);
}
}
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
}
}
示例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);
}
示例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);
}
}
示例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));
}
}
}
示例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);
}
}
示例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 );
}
示例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;
}
}
}
示例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 );
}
}
示例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);
}