本文整理汇总了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;
}
}
}
示例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;
}
}
}
示例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;
}
}
}
示例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;
}
}
}
示例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");
}
}
}
示例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;
}
}
}
}
}
示例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);
}
}
}
}
示例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);
}
示例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()));
}
}
示例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;
}
示例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());
}
示例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);
}
}
}
示例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);
}
示例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);
}
}
}
示例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;
}
}
}
}