-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
74 additions
and
13 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
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
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
44 changes: 35 additions & 9 deletions
44
src/main/java/net/foxdenstudio/sponge/foxcore/plugin/util/IWorldBounded.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 |
---|---|---|
@@ -1,24 +1,50 @@ | ||
package net.foxdenstudio.sponge.foxcore.plugin.util; | ||
|
||
|
||
import com.flowpowered.math.vector.Vector3d; | ||
import com.flowpowered.math.vector.Vector3i; | ||
import org.spongepowered.api.world.Location; | ||
import org.spongepowered.api.world.World; | ||
|
||
/** | ||
* Created by Fox on 6/5/2017. | ||
*/ | ||
public interface IWorldBounded extends IWorldlessBounded, IBounded { | ||
|
||
public interface IWorldBounded { | ||
World getWorld(); | ||
|
||
boolean contains(int x, int y, int z); | ||
@Override | ||
default boolean contains(int x, int y, int z, World world) { | ||
return world == this.getWorld() && this.contains(x, y, z); | ||
} | ||
|
||
default boolean contains(Vector3i vec) { | ||
return this.contains(vec.getX(), vec.getY(), vec.getZ()); | ||
@Override | ||
default boolean contains(Vector3i vec, World world) { | ||
return world == this.getWorld() && this.contains(vec); | ||
} | ||
|
||
boolean contains(double x, double y, double z); | ||
@Override | ||
default boolean containsBlock(Location<World> loc) { | ||
return loc.getExtent() == this.getWorld() && this.contains(loc.getBlockPosition()); | ||
} | ||
|
||
default boolean contains(Vector3d vec) { | ||
return this.contains(vec.getX(), vec.getY(), vec.getZ()); | ||
@Override | ||
default boolean contains(double x, double y, double z, World world) { | ||
return world == this.getWorld() && this.contains(x, y, z); | ||
} | ||
|
||
default boolean isInChunk(Vector3i chunk) { | ||
return true; | ||
@Override | ||
default boolean contains(Vector3d vec, World world) { | ||
return world == this.getWorld() && this.contains(vec); | ||
} | ||
|
||
@Override | ||
default boolean contains(Location<World> loc) { | ||
return loc.getExtent() == this.getWorld() && this.contains(loc.getPosition()); | ||
} | ||
|
||
@Override | ||
default boolean isInChunk(Vector3i chunk, World world) { | ||
return world == this.getWorld() && this.isInChunk(chunk); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
src/main/java/net/foxdenstudio/sponge/foxcore/plugin/util/IWorldlessBounded.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,24 @@ | ||
package net.foxdenstudio.sponge.foxcore.plugin.util; | ||
|
||
import com.flowpowered.math.vector.Vector3d; | ||
import com.flowpowered.math.vector.Vector3i; | ||
|
||
public interface IWorldlessBounded { | ||
|
||
boolean contains(int x, int y, int z); | ||
|
||
default boolean contains(Vector3i vec) { | ||
return this.contains(vec.getX(), vec.getY(), vec.getZ()); | ||
} | ||
|
||
boolean contains(double x, double y, double z); | ||
|
||
default boolean contains(Vector3d vec) { | ||
return this.contains(vec.getX(), vec.getY(), vec.getZ()); | ||
} | ||
|
||
default boolean isInChunk(Vector3i chunk) { | ||
return true; | ||
} | ||
|
||
} |