Skip to content

Commit

Permalink
Update to support 1.18
Browse files Browse the repository at this point in the history
  • Loading branch information
Camotoy committed Dec 12, 2021
1 parent f7a4e02 commit c7d7d53
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.github.camotoy</groupId>
<groupId>net.camotoy</groupId>
<artifactId>bamboocollisionfix</artifactId>
<version>1.1-SNAPSHOT</version>
<version>1.2</version>
<packaging>jar</packaging>

<name>Bamboocollisionfix</name>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.camotoy.bamboocollisionfix;
package net.camotoy.bamboocollisionfix;

import org.bukkit.Bukkit;
import org.bukkit.Material;
Expand Down Expand Up @@ -63,8 +63,15 @@ private static void setBoundingBox(Field field, double x1, double y1, double z1,
Object boundingBox = boundingBoxConstructor.newInstance(x1, y1, z1, x2, y2, z2);
ReflectionAPI.setFinalValue(field, boundingBox);
} else if (field.getType().getSimpleName().equals("VoxelShape")) {
Method createVoxelShape = ReflectionAPI.getMethod(NMSReflection.getNMSClass("world.phys.shapes", "VoxelShapes"), "create",
double.class, double.class, double.class, double.class, double.class, double.class);
Method createVoxelShape;
try {
// 1.18+ - obfuscated methods
createVoxelShape = ReflectionAPI.getMethod(NMSReflection.getNMSClass("world.phys.shapes", "VoxelShapes"), "b",
double.class, double.class, double.class, double.class, double.class, double.class);
} catch (NoSuchMethodException e) {
createVoxelShape = ReflectionAPI.getMethod(NMSReflection.getNMSClass("world.phys.shapes", "VoxelShapes"), "create",
double.class, double.class, double.class, double.class, double.class, double.class);
}
Object boundingBox = ReflectionAPI.invokeMethod(createVoxelShape, x1, y1, z1, x2, y2, z2);
ReflectionAPI.setFinalValue(field, boundingBox);
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.camotoy.bamboocollisionfix;
package net.camotoy.bamboocollisionfix;

import org.bukkit.Bukkit;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.camotoy.bamboocollisionfix;
package net.camotoy.bamboocollisionfix;

import sun.misc.Unsafe;
import sun.reflect.ReflectionFactory;
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: BambooCollisionFix
version: ${project.version}
main: com.github.camotoy.bamboocollisionfix.BambooCollisionFix
main: net.camotoy.bamboocollisionfix.BambooCollisionFix
api-version: 1.13
authors: [ Camotoy ]

0 comments on commit c7d7d53

Please sign in to comment.