-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Basestructure changes - animation progress
- Loading branch information
Showing
37 changed files
with
430 additions
and
146 deletions.
There are no files selected for viewing
This file contains 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
11 changes: 0 additions & 11 deletions
11
src/main/java/de/piinguiin/lootbox/animation/CosmicAnimation.java
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
src/main/java/de/piinguiin/lootbox/animation/DefaultAnimation.java
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
src/main/java/de/piinguiin/lootbox/animation/GalacticAnimation.java
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
src/main/java/de/piinguiin/lootbox/animation/MoonAnimation.java
This file was deleted.
Oops, something went wrong.
13 changes: 13 additions & 0 deletions
13
src/main/java/de/piinguiin/lootbox/animations/combined/CosmicCombinedAnimation.java
This file contains 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,13 @@ | ||
package de.piinguiin.lootbox.animations.combined; | ||
|
||
import de.piinguiin.lootbox.api.combined.AbstractCombinedAnimation; | ||
|
||
import java.util.Collections; | ||
|
||
public class CosmicCombinedAnimation extends AbstractCombinedAnimation { | ||
|
||
public CosmicCombinedAnimation() { | ||
this(Collections.unmodifiableList(/*falling | explosion | head rotation | give*/)); | ||
} | ||
|
||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/de/piinguiin/lootbox/animations/combined/GalacticCombinedAnimation.java
This file contains 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,13 @@ | ||
package de.piinguiin.lootbox.animations.combined; | ||
|
||
import de.piinguiin.lootbox.api.combined.AbstractCombinedAnimation; | ||
|
||
import java.util.Collections; | ||
|
||
public class GalacticCombinedAnimation extends AbstractCombinedAnimation { | ||
|
||
public GalacticCombinedAnimation() { | ||
this(Collections.unmodifiableList(/*falling | explosion | head rotation | give*/)); | ||
} | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/de/piinguiin/lootbox/animations/combined/MoonCombinedAnimation.java
This file contains 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,14 @@ | ||
package de.piinguiin.lootbox.animations.combined; | ||
|
||
import de.piinguiin.lootbox.animations.falling.DefaultFallingAnimation; | ||
import de.piinguiin.lootbox.api.combined.AbstractCombinedAnimation; | ||
|
||
import java.util.Arrays; | ||
|
||
public final class MoonCombinedAnimation extends AbstractCombinedAnimation { | ||
|
||
public MoonCombinedAnimation() { | ||
super(Arrays.asList(new DefaultFallingAnimation())); | ||
} | ||
|
||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/de/piinguiin/lootbox/animations/explosion/DefaultExplosionAnimation.java
This file contains 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,17 @@ | ||
package de.piinguiin.lootbox.animations.explosion; | ||
|
||
import de.piinguiin.lootbox.api.AbstractAnimation; | ||
import org.bukkit.Location; | ||
|
||
public class DefaultExplosionAnimation extends AbstractAnimation implements ExplosionAnimation { | ||
|
||
@Override | ||
public void tick() { | ||
|
||
} | ||
|
||
@Override | ||
public void start(final Location location) { | ||
|
||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/de/piinguiin/lootbox/animations/explosion/ExplosionAnimation.java
This file contains 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,9 @@ | ||
package de.piinguiin.lootbox.animations.explosion; | ||
|
||
import de.piinguiin.lootbox.api.Animation; | ||
|
||
public interface ExplosionAnimation extends Animation { | ||
|
||
|
||
} | ||
|
27 changes: 27 additions & 0 deletions
27
src/main/java/de/piinguiin/lootbox/animations/falling/DefaultFallingAnimation.java
This file contains 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,27 @@ | ||
package de.piinguiin.lootbox.animations.falling; | ||
|
||
import de.piinguiin.lootbox.api.AbstractAnimation; | ||
import org.bukkit.Location; | ||
import org.bukkit.Material; | ||
import org.bukkit.block.BlockFace; | ||
|
||
public final class DefaultFallingAnimation extends AbstractAnimation implements FallingAnimation { | ||
|
||
@Override | ||
public void tick() { | ||
if (isAirDownwards()) { | ||
//TODO spawn particle | ||
currentLocation.subtract(0, 0.2, 0); //TODO configure substraction vector | ||
} else finish(); | ||
} | ||
|
||
@Override | ||
public void start(final Location location) { | ||
currentLocation = location; | ||
} | ||
|
||
private boolean isAirDownwards() { | ||
return currentLocation.getBlock().getRelative(BlockFace.DOWN).getType().equals(Material.AIR); | ||
} | ||
|
||
} |
8 changes: 8 additions & 0 deletions
8
src/main/java/de/piinguiin/lootbox/animations/falling/FallingAnimation.java
This file contains 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,8 @@ | ||
package de.piinguiin.lootbox.animations.falling; | ||
|
||
import de.piinguiin.lootbox.api.Animation; | ||
|
||
public interface FallingAnimation extends Animation { | ||
|
||
|
||
} |
6 changes: 6 additions & 0 deletions
6
src/main/java/de/piinguiin/lootbox/animations/giving/DefaultGivingAnimation.java
This file contains 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,6 @@ | ||
package de.piinguiin.lootbox.animations.giving; | ||
|
||
public class DefaultGivingAnimation implements GivingAnimation { | ||
|
||
|
||
} |
4 changes: 4 additions & 0 deletions
4
src/main/java/de/piinguiin/lootbox/animations/giving/GivingAnimation.java
This file contains 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,4 @@ | ||
package de.piinguiin.lootbox.animations.giving; | ||
|
||
public interface GivingAnimation { | ||
} |
4 changes: 4 additions & 0 deletions
4
src/main/java/de/piinguiin/lootbox/animations/headspin/DefaultHeadSpinAnimation.java
This file contains 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,4 @@ | ||
package de.piinguiin.lootbox.animations.headspin; | ||
|
||
public class DefaultHeadSpinAnimation implements HeadSpinAnimation { | ||
} |
4 changes: 4 additions & 0 deletions
4
src/main/java/de/piinguiin/lootbox/animations/headspin/HeadSpinAnimation.java
This file contains 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,4 @@ | ||
package de.piinguiin.lootbox.animations.headspin; | ||
|
||
public interface HeadSpinAnimation { | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/de/piinguiin/lootbox/api/AbstractAnimation.java
This file contains 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,26 @@ | ||
package de.piinguiin.lootbox.api; | ||
|
||
import org.bukkit.Location; | ||
|
||
public abstract class AbstractAnimation implements Animation { | ||
|
||
protected Location currentLocation; | ||
@SuppressWarnings("WeakerAccess") | ||
protected boolean finished; | ||
|
||
@Override | ||
public void finish() { | ||
finished = true; | ||
} | ||
|
||
@Override | ||
public final boolean isFinished() { | ||
return finished; | ||
} | ||
|
||
@Override | ||
public final Location getCurrentLocation() { | ||
return currentLocation; | ||
} | ||
|
||
} |
This file contains 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,16 @@ | ||
package de.piinguiin.lootbox.api; | ||
|
||
import de.piinguiin.lootbox.api.finishable.Finishable; | ||
import org.bukkit.Location; | ||
|
||
public interface Animation extends Finishable { | ||
|
||
void tick(); | ||
|
||
void start(Location location); | ||
|
||
boolean isFinished(); | ||
|
||
Location getCurrentLocation(); | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
This file contains 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
47 changes: 47 additions & 0 deletions
47
src/main/java/de/piinguiin/lootbox/api/combined/AbstractCombinedAnimation.java
This file contains 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,47 @@ | ||
package de.piinguiin.lootbox.api.combined; | ||
|
||
import de.piinguiin.lootbox.api.AbstractAnimation; | ||
import de.piinguiin.lootbox.api.Animation; | ||
import org.bukkit.Location; | ||
|
||
import java.util.List; | ||
|
||
public abstract class AbstractCombinedAnimation extends AbstractAnimation implements CombinedAnimation { | ||
|
||
private final List<Animation> animations; | ||
private int currentAnimationPosition; | ||
|
||
public AbstractCombinedAnimation(final List<Animation> animations) { | ||
this.animations = animations; | ||
this.currentAnimationPosition = 0; | ||
} | ||
|
||
@Override | ||
public final void start(final Location location) { | ||
startNext(location); | ||
} | ||
|
||
@Override | ||
public final void tick() { | ||
if (currentAnimationPosition < animations.size()) { | ||
final Animation currentAnimation = animations.get(currentAnimationPosition); | ||
if (currentAnimation.isFinished()) { | ||
currentLocation = currentAnimation.getCurrentLocation(); | ||
startNext(currentLocation); | ||
} | ||
} else finish(); | ||
} | ||
|
||
@Override | ||
public final List<Animation> getAnimations() { | ||
return animations; | ||
} | ||
|
||
private void startNext(final Location location) { | ||
final Animation nextAnimation = animations.get(currentAnimationPosition); | ||
nextAnimation.start(location); | ||
this.currentAnimationPosition++; | ||
} | ||
|
||
|
||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/de/piinguiin/lootbox/api/combined/CombinedAnimation.java
This file contains 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,11 @@ | ||
package de.piinguiin.lootbox.api.combined; | ||
|
||
import de.piinguiin.lootbox.api.Animation; | ||
|
||
import java.util.List; | ||
|
||
public interface CombinedAnimation extends Animation { | ||
|
||
List<Animation> getAnimations(); | ||
|
||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/de/piinguiin/lootbox/api/finishable/DefaultFinishable.java
This file contains 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,12 @@ | ||
package de.piinguiin.lootbox.api.finishable; | ||
|
||
public interface DefaultFinishable extends Finishable { | ||
|
||
@Override | ||
default void finish() { | ||
|
||
//TODO explosion and head place | ||
|
||
} | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/de/piinguiin/lootbox/api/finishable/Finishable.java
This file contains 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,7 @@ | ||
package de.piinguiin.lootbox.api.finishable; | ||
|
||
public interface Finishable { | ||
|
||
void finish(); | ||
|
||
} |
Oops, something went wrong.