Skip to content

Commit

Permalink
Merge branch 'api5.2' into api6
Browse files Browse the repository at this point in the history
  • Loading branch information
gravityfox committed Jun 5, 2017
2 parents 4ced969 + 80356a4 commit fa2c35b
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 13 deletions.
6 changes: 4 additions & 2 deletions gradle/fox.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ ext.repoVersion = ''
if (System.env.TRAVIS) {
String tempVersion = ''
if (System.env.TRAVIS_TAG) {
tempVersion = System.env.TRAVIS_TAG;
tempVersion = System.env.TRAVIS_TAG
if (tempVersion.startsWith("v")) {
tempVersion = tempVersion.substring(1)
}
tempVersion += "-$System.env.TRAVIS_BUILD_NUMBER"
tempVersion.replaceAll('/', '-')
repoVersion = tempVersion
tempVersion += "-$System.env.TRAVIS_BUILD_NUMBER"
} else {
tempVersion = "$System.env.TRAVIS_BRANCH-SNAPSHOT"
tempVersion.replaceAll('/', '-')
repoVersion = tempVersion
tempVersion += "-$System.env.TRAVIS_BUILD_NUMBER"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
import com.flowpowered.math.vector.Vector3i;
import net.foxdenstudio.sponge.foxcore.plugin.util.BoundingBox3;
import net.foxdenstudio.sponge.foxcore.plugin.util.IModifiable;
import net.foxdenstudio.sponge.foxcore.plugin.util.IWorldBounded;
import net.foxdenstudio.sponge.foxcore.plugin.util.IWorldlessBounded;
import org.spongepowered.api.text.Text;

import java.util.Optional;

public interface ISelection extends Iterable<Vector3i>, IWorldBounded, IModifiable {
public interface ISelection extends Iterable<Vector3i>, IWorldlessBounded, IModifiable {

Text overview();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.flowpowered.math.vector.Vector3d;
import com.flowpowered.math.vector.Vector3i;
import org.spongepowered.api.world.Location;
import org.spongepowered.api.world.World;

/**
Expand All @@ -15,12 +16,20 @@ default boolean contains(Vector3i vec, World world) {
return this.contains(vec.getX(), vec.getY(), vec.getZ(), world);
}

default boolean containsBlock(Location<World> loc){
return this.contains(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), loc.getExtent());
}

boolean contains(double x, double y, double z, World world);

default boolean contains(Vector3d vec, World world) {
return this.contains(vec.getX(), vec.getY(), vec.getZ(), world);
}

default boolean contains(Location<World> loc){
return this.contains(loc.getX(), loc.getY(), loc.getZ(), loc.getExtent());
}

default boolean isInChunk(Vector3i chunk, World world) {
return true;
}
Expand Down
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);
}
}
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;
}

}

0 comments on commit fa2c35b

Please sign in to comment.