当前位置: 首页>>代码示例>>Java>>正文


Java BreakSpeed类代码示例

本文整理汇总了Java中net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed的典型用法代码示例。如果您正苦于以下问题:Java BreakSpeed类的具体用法?Java BreakSpeed怎么用?Java BreakSpeed使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BreakSpeed类属于net.minecraftforge.event.entity.player.PlayerEvent包,在下文中一共展示了BreakSpeed类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: breakSpeed

import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed; //导入依赖的package包/类
@SubscribeEvent
public void breakSpeed(BreakSpeed event)
{
    ItemStack stack = event.entityPlayer.getCurrentEquippedItem();
    if (stack != null && !event.entityPlayer.isSneaking() && canHarvestBlock(event.entityPlayer, event.block, event.block, event.metadata, event.x, event.y, event.z))
    {
        if (ToolUpgrade.THREExONE.isOn(stack))
        {
            event.newSpeed *= Config.speedMult3x1;
        }
        if (ToolUpgrade.THREExTHREE.isOn(stack))
        {
            event.newSpeed *= Config.speedMult3x3;
        }
    }
}
 
开发者ID:wyldmods,项目名称:ToolUtilities,代码行数:17,代码来源:AOEHandler.java

示例2: onPlayerBreaking

import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed; //导入依赖的package包/类
@SubscribeEvent
public void onPlayerBreaking(BreakSpeed event) {
    if (event.entityPlayer.getCurrentEquippedItem() != null) {
        ItemStack stack = event.entityPlayer.getCurrentEquippedItem();
        if (stack.getItem() instanceof ItemTaintPickaxe) {
            World world = event.entityPlayer.worldObj;
            int x = event.x;
            int y = event.y;
            int z = event.z;
            float hardness = world.getBlock(x, y, z).getBlockHardness(world, x, y, z);
            if (hardness == 0.0F)
                event.newSpeed = 0.0F;
            else if (hardness < 5.0F)
                event.newSpeed = 0.1F;
            else if (hardness < 20.0F)
                event.newSpeed = hardness / 2.0F;
            else
                event.newSpeed = 5.0F + hardness;
        }
    }
}
 
开发者ID:SpitefulFox,项目名称:ForbiddenMagic,代码行数:22,代码来源:FMEventHandler.java

示例3: onBreakSpeed

import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed; //导入依赖的package包/类
@SubscribeEvent
public void onBreakSpeed(BreakSpeed event)
{
    if (event.block instanceof IBlockCustom)
    {
        BlockType type = ((IBlockCustom) event.block).getType(event.metadata);
        if (type.toolType.isEmpty())
        {
            return;
        }
        ItemStack held = event.entityPlayer.getHeldItem();
        if (held != null && !held.getItem().getToolClasses(held).contains(type.toolType))
        {
            event.newSpeed = ForgeHooks.canHarvestBlock(event.block, event.entityPlayer, event.metadata) ? 0.3f : 1;
        }
    }
}
 
开发者ID:tterrag1098,项目名称:CustomThings,代码行数:18,代码来源:BreakSpeedFixer.java

示例4: changeBreakSpeed

import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed; //导入依赖的package包/类
@SubscribeEvent
public void changeBreakSpeed(BreakSpeed speed) {
	if(speed.entityPlayer.getExtendedProperties(ExtendedPlayerProperties.PROP_NAME) != null && ConfigHelper.powersEnabled) {
		ExtendedPlayerProperties props = (ExtendedPlayerProperties) speed.entityPlayer.getExtendedProperties(ExtendedPlayerProperties.PROP_NAME);
		
		if(props.getAbilityUsageAmount() > 0 && props.getPowersEnabled()) {
			speed.newSpeed = speed.originalSpeed * 2;
			
			if(random.nextInt(149) == 1) {
				props.decreaseAbilityUsage();
			}
		} else {
			speed.newSpeed = speed.originalSpeed;
		}
	}
}
 
开发者ID:Tyler1555,项目名称:Mini-Bosses,代码行数:17,代码来源:MBEventHandler.java

示例5: breakSpeed

import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed; //导入依赖的package包/类
@SubscribeEvent
public void breakSpeed(BreakSpeed event)
{
	if (event.entityPlayer != null)
	{
		DarklightPlayer abilities = DarklightPlayer.get(event.entityPlayer);
		
		if (abilities != null)
		{
			LogHelper.info("Found player with ability trying to break block");
			if (abilities.isDark || abilities.isLight)
			{
				event.newSpeed = abilities.breakRate;
			}
		}
		else
		{
			LogHelper.info("Player tried break, but has no abilities");
		}
	}
}
 
开发者ID:FoolishDave,项目名称:Darklight,代码行数:22,代码来源:AbilityEventHandler.java

示例6: onBreaking

import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed; //导入依赖的package包/类
@ForgeSubscribe
public void onBreaking(BreakSpeed event) {
	if( event.entity instanceof EntityPlayer ) {
		EntityPlayer player = (EntityPlayer)event.entity;
		if( player.isInWater() ) {
			ItemStack chest = player.getCurrentItemOrArmor(3);
			if( chest != null ) {
				float speed1 = event.originalSpeed;
				if( chest.itemID == OceanicMain.wetsuitBody.itemID ) {
					event.newSpeed = speed1+(speed1*2F);//0.5F);
				}
				if( chest.itemID == OceanicMain.divingSuitBody.itemID ) {
					event.newSpeed = speed1*4F;//2F;
				}
			}
		}
	}
	
	
}
 
开发者ID:TheTemportalist,项目名称:CountryGamer_Oceanic,代码行数:21,代码来源:OceanicEventHandler.java

示例7: onBreakSpeed

import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed; //导入依赖的package包/类
@SubscribeEvent
public void onBreakSpeed(BreakSpeed event) {
  if (event.getState().getBlock() == this) {
    ItemStack held = event.getEntityPlayer().getHeldItemMainhand();
    if (held.isEmpty() || held.getItem().getHarvestLevel(held, "pickaxe", event.getEntityPlayer(), event.getState()) == -1) {
      event.setNewSpeed(event.getNewSpeed() + 2);
    }
    IConduitBundle te = (IConduitBundle) event.getEntity().world.getTileEntity(NullHelper.notnullF(event.getPos(), "BreakSpeed#getPos"));
    if (te != null && te.getFacadeType().isHardened()) {
      if (!YetaUtil.isSolidFacadeRendered(te, event.getEntityPlayer())) {
        event.setNewSpeed(event.getNewSpeed() * 6);
      } else {
        event.setNewSpeed(event.getNewSpeed() * 2);
      }
    }
  }
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:18,代码来源:BlockConduitBundle.java

示例8: fistingSpeed

import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed; //导入依赖的package包/类
@SubscribeEvent
public void fistingSpeed(BreakSpeed event) {
	
	ItemStack powerfist = BaublesApi.getBaublesHandler(event.getEntityPlayer()).getStackInSlot(6);
	if (powerfist == null || (powerfist != null && powerfist.getItem() != this)) return;
	
	ItemStack mininghand = event.getEntityPlayer().getHeldItemMainhand();
	if (mininghand != null) return;
	
	if (event.getNewSpeed() < 8.0F)
		event.setNewSpeed(8.0F);
}
 
开发者ID:bafomdad,项目名称:uniquecrops,代码行数:13,代码来源:EmblemPowerfist.java

示例9: onPlayerStrVsBlock

import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed; //导入依赖的package包/类
@SubscribeEvent
public void onPlayerStrVsBlock(BreakSpeed event)
{
	PlayerAether playerAether = PlayerAether.get(event.getEntityPlayer());

	if (playerAether != null)
	{
		event.setNewSpeed(playerAether.getCurrentPlayerStrVsBlock(event.getOriginalSpeed()));
	}
}
 
开发者ID:Modding-Legacy,项目名称:Aether-Legacy,代码行数:11,代码来源:PlayerAetherEvents.java

示例10: breakSpeed

import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed; //导入依赖的package包/类
public static boolean breakSpeed(BreakSpeed event) {
	try {
		float f = getWorldHandlerForDim(event.getEntityPlayer().world.provider.getDimension()).breakSpeed(event.getPos(), event.getEntityPlayer(), event.getOriginalSpeed());
		if (f < 0)
			return true;
		event.setNewSpeed(f);
	} catch (Exception e) {
	}
	return false;
}
 
开发者ID:tom5454,项目名称:Toms-Mod,代码行数:11,代码来源:WorldHandler.java

示例11: onEvent

import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed; //导入依赖的package包/类
@Override
public void onEvent(BreakSpeed event) {
	if (!(event.getEntityPlayer() instanceof EntityPlayerMP)) return;
	
	ServerPlayerSettings settings = getPlayerSettings((EntityPlayerMP) event.getEntityPlayer());
	event.setNewSpeed(settings.breakspeed > 0 ? settings.breakspeed : event.getOriginalSpeed());
}
 
开发者ID:MrNobody98,项目名称:morecommands,代码行数:8,代码来源:CommandBreakspeed.java

示例12: onBreakSpeed

import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed; //导入依赖的package包/类
@SubscribeEvent
public void onBreakSpeed(BreakSpeed event) {
    EntityPlayer player = event.getEntityPlayer();
    if (player != null) {
        Block block = event.getState().getBlock();
        int meta = block.getMetaFromState(event.getState());
        if (ProgressionEvents.isEventCancelled(event.getEntityPlayer(), ActionType.BREAKBLOCKWITH, event.getEntityPlayer().getHeldItemMainhand(), ActionType.BREAKBLOCK, BlockActionHelper.getStackFromBlockData(block, meta))) {
            event.setNewSpeed(0F);
        }
    }
}
 
开发者ID:joshiejack,项目名称:Progression,代码行数:12,代码来源:ActionBreakBlock.java

示例13: onBreakSpeed

import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed; //导入依赖的package包/类
@SubscribeEvent
public void onBreakSpeed(BreakSpeed event) { // player is trying to break a block
    final ImperiumPlayer playerImperium = ImperiumPlayer.get(event.entityPlayer); 
    if (event.block == Blocks.log)
        checkAbortTree(event, playerImperium);
    else if (event.block == Blocks.log2)
        checkAbortTree(event, playerImperium);
}
 
开发者ID:CosmicDan-Minecraft,项目名称:Imperium,代码行数:9,代码来源:EventHandlerRestrictions.java

示例14: checkAbortTree

import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed; //导入依赖的package包/类
public void checkAbortTree(final BreakSpeed event, final ImperiumPlayer playerImperium) {
    if (!PlayerData.hasAbility(playerImperium, PlayerAbilities.CANPUNCHWOOD)) {
        if (!playerImperium.eventListDone.toString().contains("WOODPUNCH")) {
            playerImperium.addInstantEvent(TutorialEvents.WOODPUNCH);
            playerImperium.syncToServer("events");
        }
        if(event.isCancelable()) { // not sure if needed but doesn't hurt
            event.entityPlayer.swingProgressInt = 0;
            event.setCanceled(true);
        }
    }
}
 
开发者ID:CosmicDan-Minecraft,项目名称:Imperium,代码行数:13,代码来源:EventHandlerRestrictions.java

示例15: onBreakSpeed

import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed; //导入依赖的package包/类
@SubscribeEvent
public void onBreakSpeed(BreakSpeed parEvent)
{
	if (parEvent.state.getBlock() instanceof BlockCrops)
	{
		ItemStack playerItem = parEvent.entityPlayer.getCurrentEquippedItem();
		if (playerItem != null && playerItem.getItem() == _Sickle.sickle)
		{
			if (!isFullGrownCrop(parEvent.entity.worldObj, parEvent.pos, parEvent.state))
			{
				parEvent.newSpeed = 0F;
			}
		}
	}
}
 
开发者ID:andykuo1,项目名称:mcplus_mods,代码行数:16,代码来源:EventHandlerSickle.java


注:本文中的net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。