This repository was archived by the owner on Jun 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 47
LivingFallEvent and PlayerFlyableFallEvent #33
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
12fa2b0
Implements LivingFallEvent and PlayerFlyableFallEven
eecf8fd
Implements LivingFallEvent and PlayerFlyableFallEvent
a0153c5
Fixes comment typos
0d5682d
Shadows abilities for one method instead of two.
3ba5fd9
Changes so onLivingFall is called once instead of twice
47ab4d5
Clean up to be compliant with checkstyle
219461c
Removes the need for cancellable in hookHandleFallDamage
b3f5d4c
Renaming & Javadoc
3f94397
Nitpicks
7d0e1ef
Nitpicks
4de41b8
Fix license dates.
568c5ba
LivingFallEvent license 2019-2020
f69db6a
Fix merge conflicts
5460dee
Oops. Missed a few merge conflicts.
14e807e
Removed .vscode and restored .gitignore
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
...k-events-entity/src/main/java/net/minecraftforge/event/entity/living/LivingFallEvent.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| /* | ||
| * Minecraft Forge, Patchwork Project | ||
| * Copyright (c) 2016-2020, 2019-2020 | ||
| * | ||
| * This library is free software; you can redistribute it and/or | ||
| * modify it under the terms of the GNU Lesser General Public | ||
| * License as published by the Free Software Foundation version 2.1 | ||
| * of the License. | ||
| * | ||
| * This library is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| * Lesser General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Lesser General Public | ||
| * License along with this library; if not, write to the Free Software | ||
| * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| */ | ||
|
|
||
| package net.minecraftforge.event.entity.living; | ||
|
|
||
| import net.minecraft.entity.LivingEntity; | ||
|
|
||
| /** | ||
| * LivingFallEvent is fired when a {@link LivingEntity} is set to be falling. | ||
| * | ||
| * <p>This event is fired whenever a {@link LivingEntity} is set to fall in | ||
| * {@link LivingEntity#fall(float, float)}.</p> | ||
| * | ||
| * <p>For players that are able to fly, {@link net.minecraftforge.event.entity.player.PlayerFlyableFallEvent} will be fired instead.</p> | ||
| * | ||
| * <p>This event is fired via {@link com.patchworkmc.impl.event.entity.EntityEvents#onLivingFall(LivingEntity, float, float)}.</p> | ||
| * | ||
| * <p>{@link #distance} contains the distance the {@link LivingEntity} is to fall. If this event is cancelled, this value is set to 0.0F.</p> | ||
| * | ||
| * <p>This event is cancellable. | ||
| * If this event is cancelled, the {@link LivingEntity} does not take fall damage.</p> | ||
| * | ||
| * <p>This event is fired on the {@link MinecraftForge#EVENT_BUS}.</p> | ||
| */ | ||
| public class LivingFallEvent extends LivingEvent { | ||
| private float distance; | ||
| private float damageMultiplier; | ||
|
|
||
| // For EventBus | ||
| public LivingFallEvent() { | ||
| this(null, 0, 0); | ||
| } | ||
|
|
||
| public LivingFallEvent(LivingEntity entity, float distance, float damageMultiplier) { | ||
| super(entity); | ||
|
|
||
| this.setDistance(distance); | ||
| this.setDamageMultiplier(damageMultiplier); | ||
| } | ||
|
|
||
| public float getDistance() { | ||
| return distance; | ||
| } | ||
|
|
||
| public void setDistance(float distance) { | ||
| this.distance = distance; | ||
| } | ||
|
|
||
| public float getDamageMultiplier() { | ||
| return damageMultiplier; | ||
| } | ||
|
|
||
| public void setDamageMultiplier(float damageMultiplier) { | ||
| this.damageMultiplier = damageMultiplier; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean isCancelable() { | ||
| return true; | ||
| } | ||
| } |
59 changes: 59 additions & 0 deletions
59
...s-entity/src/main/java/net/minecraftforge/event/entity/player/PlayerFlyableFallEvent.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| /* | ||
| * Minecraft Forge, Patchwork Project | ||
| * Copyright (c) 2016-2020, 2019-2020 | ||
| * | ||
| * This library is free software; you can redistribute it and/or | ||
| * modify it under the terms of the GNU Lesser General Public | ||
| * License as published by the Free Software Foundation version 2.1 | ||
| * of the License. | ||
| * | ||
| * This library is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| * Lesser General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Lesser General Public | ||
| * License along with this library; if not, write to the Free Software | ||
| * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| */ | ||
|
|
||
| package net.minecraftforge.event.entity.player; | ||
|
|
||
| import net.minecraft.entity.player.PlayerEntity; | ||
|
|
||
| /** | ||
| * Occurs when a player falls, but is able to fly. | ||
| * {@link net.minecraftforge.event.entity.living.LivingFallEvent} will be fired for players that are not able to fly. | ||
| */ | ||
| public class PlayerFlyableFallEvent extends PlayerEvent { | ||
| private float distance; | ||
| private float multiplier; | ||
|
|
||
| // For EventBus | ||
| public PlayerFlyableFallEvent() { | ||
| this(null, 0, 0); | ||
| } | ||
|
|
||
| public PlayerFlyableFallEvent(PlayerEntity player, float distance, float multiplier) { | ||
| super(player); | ||
|
|
||
| this.distance = distance; | ||
| this.multiplier = multiplier; | ||
| } | ||
|
|
||
| public float getDistance() { | ||
| return distance; | ||
| } | ||
|
|
||
| public void setDistance(float distance) { | ||
| this.distance = distance; | ||
| } | ||
|
|
||
| public float getMultiplier() { | ||
| return multiplier; | ||
| } | ||
|
|
||
| public void setMultiplier(float multiplier) { | ||
| this.multiplier = multiplier; | ||
| } | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.