Skip to content

Commit

Permalink
Merge pull request #8 from SourceWriters/feat/BoundingBoxes
Browse files Browse the repository at this point in the history
Feat/bounding boxes
  • Loading branch information
Lauriichan authored Jan 19, 2021
2 parents 1c22281 + fe9b6e1 commit b7369b3
Show file tree
Hide file tree
Showing 37 changed files with 796 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
/.project
/.gitlab-ci.yml
/test/
/libraries/spigot/
/libraries/spigot/
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
[![Contributors][contributors-shield]][contributors-url]
[![Stargazers][stars-shield]][stars-url]
[![Issues][issues-shield]][issues-url]
[![MIT License][license-shield]][license-url]
[![GPL-3.0 License][license-shield]][license-url]



Expand Down Expand Up @@ -103,7 +103,7 @@ Please notice that you need to authenticate with GitHub Packages ([Maven](https:
<depedency>
<groupId>net.sourcewriters.minecraft</groupId>
<artifactId>vcompat</artifactId>
<version>1.0</version>
<version>1.1.0</version>
<dependency>
<depedencies>
```
Expand All @@ -116,7 +116,7 @@ plugins {
}
dependencies {
implementation group: 'net.sourcewriters.minecraft', name: 'vcompat', version: '1.0'
implementation group: 'net.sourcewriters.minecraft', name: 'vcompat', version: '1.1.0'
}
```

Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<modelVersion>4.0.0</modelVersion>

<groupId>net.sourcewriters.minecraft</groupId>
<artifactId>vcompat</artifactId>
<version>1.0</version>
<artifactId>versiontools</artifactId>
<version>1.1.0</version>
<packaging>jar</packaging>
<name>vCompat</name>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package net.sourcewriters.minecraft.versiontools.reflection;

import net.sourcewriters.minecraft.versiontools.reflection.tools.BlockTools;
import net.sourcewriters.minecraft.versiontools.reflection.tools.ServerTools;
import net.sourcewriters.minecraft.versiontools.reflection.tools.SkinTools;

Expand All @@ -12,5 +13,7 @@ protected ToolProvider(V versionControl) {
public abstract SkinTools getSkinTools();

public abstract ServerTools getServerTools();

public abstract BlockTools getBlockTools();

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import org.bukkit.Location;
import org.bukkit.entity.Player;

import net.sourcewriters.minecraft.versiontools.reflection.utils.NmsBoundingBox;

public interface NmsEntity {

Object getHandle();
Expand Down Expand Up @@ -52,5 +54,7 @@ public interface NmsEntity {
Player[] getVisibleAsPlayer();

void kill();

NmsBoundingBox getBoundingBox();

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

public class ToolProvider1_10_R1 extends ToolProvider<VersionControl1_10_R1> {

private final BlockTools1_10_R1 blockTools = new BlockTools1_10_R1();
private final SkinTools1_10_R1 skinTools = new SkinTools1_10_R1();
private final ServerTools1_10_R1 serverTools = new ServerTools1_10_R1();

Expand All @@ -22,4 +23,9 @@ public ServerTools1_10_R1 getServerTools() {
return serverTools;
}

@Override
public BlockTools1_10_R1 getBlockTools() {
return blockTools;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
import net.minecraft.server.v1_10_R1.PacketPlayOutSpawnEntity;
import net.minecraft.server.v1_10_R1.PlayerConnection;
import net.minecraft.server.v1_10_R1.Vec3D;
import net.minecraft.server.v1_10_R1.AxisAlignedBB;
import net.sourcewriters.minecraft.versiontools.reflection.entity.NmsEntity;
import net.sourcewriters.minecraft.versiontools.reflection.utils.NmsBoundingBox;

public abstract class Entity1_10_R1<E extends Entity> implements NmsEntity {

Expand All @@ -46,6 +48,12 @@ public UUID getUniqueId() {
return handle.getUniqueID();
}

@Override
public NmsBoundingBox getBoundingBox() {
AxisAlignedBB box = handle.getBoundingBox();
return new NmsBoundingBox(box.a, box.b, box.c, box.d, box.e, box.f);
}

@Override
public void setCustomName(String name) {
handle.setCustomName(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

public class ToolProvider1_11_R1 extends ToolProvider<VersionControl1_11_R1> {

private final BlockTools1_11_R1 blockTools = new BlockTools1_11_R1();
private final SkinTools1_11_R1 skinTools = new SkinTools1_11_R1();
private final ServerTools1_11_R1 serverTools = new ServerTools1_11_R1();

Expand All @@ -21,5 +22,10 @@ public SkinTools1_11_R1 getSkinTools() {
public ServerTools1_11_R1 getServerTools() {
return serverTools;
}

@Override
public BlockTools1_11_R1 getBlockTools() {
return blockTools;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
import net.minecraft.server.v1_11_R1.PacketPlayOutSpawnEntity;
import net.minecraft.server.v1_11_R1.PlayerConnection;
import net.minecraft.server.v1_11_R1.Vec3D;
import net.minecraft.server.v1_11_R1.AxisAlignedBB;
import net.sourcewriters.minecraft.versiontools.reflection.entity.NmsEntity;
import net.sourcewriters.minecraft.versiontools.reflection.utils.NmsBoundingBox;

public abstract class Entity1_11_R1<E extends Entity> implements NmsEntity {

Expand All @@ -46,6 +48,12 @@ public UUID getUniqueId() {
return handle.getUniqueID();
}

@Override
public NmsBoundingBox getBoundingBox() {
AxisAlignedBB box = handle.getBoundingBox();
return new NmsBoundingBox(box.a, box.b, box.c, box.d, box.e, box.f);
}

@Override
public void setCustomName(String name) {
handle.setCustomName(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import net.sourcewriters.minecraft.versiontools.reflection.provider.v1_12_R1.tools.*;

public class ToolProvider1_12_R1 extends ToolProvider<VersionControl1_12_R1> {


private final BlockTools1_12_R1 blockTools = new BlockTools1_12_R1();
private final SkinTools1_12_R1 skinTools = new SkinTools1_12_R1();
private final ServerTools1_12_R1 serverTools = new ServerTools1_12_R1();

Expand All @@ -21,5 +22,10 @@ public SkinTools1_12_R1 getSkinTools() {
public ServerTools1_12_R1 getServerTools() {
return serverTools;
}

@Override
public BlockTools1_12_R1 getBlockTools() {
return blockTools;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
import net.minecraft.server.v1_12_R1.PacketPlayOutSpawnEntity;
import net.minecraft.server.v1_12_R1.PlayerConnection;
import net.minecraft.server.v1_12_R1.Vec3D;
import net.minecraft.server.v1_12_R1.AxisAlignedBB;
import net.sourcewriters.minecraft.versiontools.reflection.entity.NmsEntity;
import net.sourcewriters.minecraft.versiontools.reflection.utils.NmsBoundingBox;

public abstract class Entity1_12_R1<E extends Entity> implements NmsEntity {

Expand All @@ -46,6 +48,12 @@ public UUID getUniqueId() {
return handle.getUniqueID();
}

@Override
public NmsBoundingBox getBoundingBox() {
AxisAlignedBB box = handle.getBoundingBox();
return new NmsBoundingBox(box.a, box.b, box.c, box.d, box.e, box.f);
}

@Override
public void setCustomName(String name) {
handle.setCustomName(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import net.sourcewriters.minecraft.versiontools.reflection.provider.v1_13_R1.tools.*;

public class ToolProvider1_13_R1 extends ToolProvider<VersionControl1_13_R1> {


private final BlockTools1_13_R1 blockTools = new BlockTools1_13_R1();
private final SkinTools1_13_R1 skinTools = new SkinTools1_13_R1();
private final ServerTools1_13_R1 serverTools = new ServerTools1_13_R1();

Expand All @@ -21,5 +22,10 @@ public SkinTools1_13_R1 getSkinTools() {
public ServerTools1_13_R1 getServerTools() {
return serverTools;
}

@Override
public BlockTools1_13_R1 getBlockTools() {
return blockTools;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
import net.minecraft.server.v1_13_R1.PacketPlayOutSpawnEntity;
import net.minecraft.server.v1_13_R1.PlayerConnection;
import net.minecraft.server.v1_13_R1.Vec3D;
import net.minecraft.server.v1_13_R1.AxisAlignedBB;
import net.sourcewriters.minecraft.versiontools.reflection.entity.NmsEntity;
import net.sourcewriters.minecraft.versiontools.reflection.utils.NmsBoundingBox;

public abstract class Entity1_13_R1<E extends Entity> implements NmsEntity {

Expand All @@ -47,6 +49,12 @@ public UUID getUniqueId() {
return handle.getUniqueID();
}

@Override
public NmsBoundingBox getBoundingBox() {
AxisAlignedBB box = handle.getBoundingBox();
return new NmsBoundingBox(box.a, box.b, box.c, box.d, box.e, box.f);
}

@Override
public void setCustomName(String name) {
handle.setCustomName(CraftChatMessage.fromStringOrNull(name));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

public class ToolProvider1_13_R2 extends ToolProvider<VersionControl1_13_R2> {

private final BlockTools1_13_R2 blockTools = new BlockTools1_13_R2();
private final SkinTools1_13_R2 skinTools = new SkinTools1_13_R2();
private final ServerTools1_13_R2 serverTools = new ServerTools1_13_R2();

Expand All @@ -21,5 +22,10 @@ public SkinTools1_13_R2 getSkinTools() {
public ServerTools1_13_R2 getServerTools() {
return serverTools;
}

@Override
public BlockTools1_13_R2 getBlockTools() {
return blockTools;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
import net.minecraft.server.v1_13_R2.PacketPlayOutSpawnEntity;
import net.minecraft.server.v1_13_R2.PlayerConnection;
import net.minecraft.server.v1_13_R2.Vec3D;
import net.minecraft.server.v1_13_R2.AxisAlignedBB;
import net.sourcewriters.minecraft.versiontools.reflection.entity.NmsEntity;
import net.sourcewriters.minecraft.versiontools.reflection.utils.NmsBoundingBox;

public abstract class Entity1_13_R2<E extends Entity> implements NmsEntity {

Expand All @@ -47,6 +49,12 @@ public UUID getUniqueId() {
return handle.getUniqueID();
}

@Override
public NmsBoundingBox getBoundingBox() {
AxisAlignedBB box = handle.getBoundingBox();
return new NmsBoundingBox(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ);
}

@Override
public void setCustomName(String name) {
handle.setCustomName(CraftChatMessage.fromStringOrNull(name));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

public class ToolProvider1_14_R1 extends ToolProvider<VersionControl1_14_R1> {

private final BlockTools1_14_R1 blockTools = new BlockTools1_14_R1();
private final SkinTools1_14_R1 skinTools = new SkinTools1_14_R1();
private final ServerTools1_14_R1 serverTools = new ServerTools1_14_R1();

Expand All @@ -21,5 +22,10 @@ public SkinTools1_14_R1 getSkinTools() {
public ServerTools1_14_R1 getServerTools() {
return serverTools;
}

@Override
public BlockTools1_14_R1 getBlockTools() {
return blockTools;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
import net.minecraft.server.v1_14_R1.PacketPlayOutSpawnEntity;
import net.minecraft.server.v1_14_R1.PlayerConnection;
import net.minecraft.server.v1_14_R1.Vec3D;
import net.minecraft.server.v1_14_R1.AxisAlignedBB;
import net.sourcewriters.minecraft.versiontools.reflection.entity.NmsEntity;
import net.sourcewriters.minecraft.versiontools.reflection.utils.NmsBoundingBox;

public abstract class Entity1_14_R1<E extends Entity> implements NmsEntity {

Expand All @@ -46,6 +48,12 @@ public UUID getUniqueId() {
return handle.getUniqueID();
}

@Override
public NmsBoundingBox getBoundingBox() {
AxisAlignedBB box = handle.getBoundingBox();
return new NmsBoundingBox(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ);
}

@Override
public void setCustomName(String name) {
handle.setCustomName(CraftChatMessage.fromStringOrNull(name));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

public class ToolProvider1_15_R1 extends ToolProvider<VersionControl1_15_R1> {

private final BlockTools1_15_R1 blockTools = new BlockTools1_15_R1();
private final SkinTools1_15_R1 skinTools = new SkinTools1_15_R1();
private final ServerTools1_15_R1 serverTools = new ServerTools1_15_R1();

Expand All @@ -21,5 +22,10 @@ public SkinTools1_15_R1 getSkinTools() {
public ServerTools1_15_R1 getServerTools() {
return serverTools;
}

@Override
public BlockTools1_15_R1 getBlockTools() {
return blockTools;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
import net.minecraft.server.v1_15_R1.PacketPlayOutSpawnEntity;
import net.minecraft.server.v1_15_R1.PlayerConnection;
import net.minecraft.server.v1_15_R1.Vec3D;
import net.minecraft.server.v1_15_R1.AxisAlignedBB;
import net.sourcewriters.minecraft.versiontools.reflection.entity.NmsEntity;
import net.sourcewriters.minecraft.versiontools.reflection.utils.NmsBoundingBox;

public abstract class Entity1_15_R1<E extends Entity> implements NmsEntity {

Expand All @@ -46,6 +48,12 @@ public UUID getUniqueId() {
return handle.getUniqueID();
}

@Override
public NmsBoundingBox getBoundingBox() {
AxisAlignedBB box = handle.getBoundingBox();
return new NmsBoundingBox(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ);
}

@Override
public void setCustomName(String name) {
handle.setCustomName(CraftChatMessage.fromStringOrNull(name));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

public class ToolProvider1_16_R1 extends ToolProvider<VersionControl1_16_R1> {

private final BlockTools1_16_R1 blockTools = new BlockTools1_16_R1();
private final SkinTools1_16_R1 skinTools = new SkinTools1_16_R1();
private final ServerTools1_16_R1 serverTools = new ServerTools1_16_R1();

Expand All @@ -21,5 +22,10 @@ public SkinTools1_16_R1 getSkinTools() {
public ServerTools1_16_R1 getServerTools() {
return serverTools;
}

@Override
public BlockTools1_16_R1 getBlockTools() {
return blockTools;
}

}
Loading

0 comments on commit b7369b3

Please sign in to comment.