Fix bamboo block reflect wrapper

This commit is contained in:
Marc Baloup 2023-05-08 22:47:11 +02:00
parent df8dbe1e61
commit 3e0297c8af
3 changed files with 7 additions and 7 deletions

View File

@ -66,7 +66,7 @@ import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.PlayerDataStorage;
import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.SavedData; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.SavedData;
import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.Vec3; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.Vec3;
import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.VoxelShape; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.VoxelShape;
import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.block.BambooBlock; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.block.BambooStalkBlock;
import fr.pandacube.lib.paper.reflect.wrapper.netty.ByteBuf; import fr.pandacube.lib.paper.reflect.wrapper.netty.ByteBuf;
import fr.pandacube.lib.paper.reflect.wrapper.netty.Unpooled; import fr.pandacube.lib.paper.reflect.wrapper.netty.Unpooled;
import fr.pandacube.lib.paper.reflect.wrapper.paper.AABBVoxelShape; import fr.pandacube.lib.paper.reflect.wrapper.paper.AABBVoxelShape;
@ -164,7 +164,7 @@ public class PandalibPaperReflect {
// minecraft.util // minecraft.util
initWrapper(ProgressListener.class, ProgressListener.MAPPING.runtimeClass()); initWrapper(ProgressListener.class, ProgressListener.MAPPING.runtimeClass());
// minecraft.world.block // minecraft.world.block
initWrapper(BambooBlock.class, BambooBlock.MAPPING.runtimeClass()); initWrapper(BambooStalkBlock.class, BambooStalkBlock.MAPPING.runtimeClass());
// minecraft.world // minecraft.world
initWrapper(AABB.class, AABB.MAPPING.runtimeClass()); initWrapper(AABB.class, AABB.MAPPING.runtimeClass());
initWrapper(ChunkPos.class, ChunkPos.MAPPING.runtimeClass()); initWrapper(ChunkPos.class, ChunkPos.MAPPING.runtimeClass());

View File

@ -2,7 +2,7 @@ package fr.pandacube.lib.paper.reflect.util;
import fr.pandacube.lib.paper.PandaLibPaper; import fr.pandacube.lib.paper.PandaLibPaper;
import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.AABB; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.AABB;
import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.block.BambooBlock; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.world.block.BambooStalkBlock;
import fr.pandacube.lib.paper.reflect.wrapper.paper.AABBVoxelShape; import fr.pandacube.lib.paper.reflect.wrapper.paper.AABBVoxelShape;
import fr.pandacube.lib.util.Log; import fr.pandacube.lib.util.Log;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -21,7 +21,7 @@ public final class BedrockBambooCollisionFixer implements Listener {
public BedrockBambooCollisionFixer() { public BedrockBambooCollisionFixer() {
// Make the bamboo block have zero collision. // Make the bamboo block have zero collision.
try { try {
BambooBlock.COLLISION_SHAPE(new AABBVoxelShape(new AABB(0.5, 0, 0.5, 0.5, 0, 0.5))); BambooStalkBlock.COLLISION_SHAPE(new AABBVoxelShape(new AABB(0.5, 0, 0.5, 0.5, 0, 0.5)));
Log.info("Bamboo block collision box removed succesfully."); Log.info("Bamboo block collision box removed succesfully.");
} catch (Exception e) { } catch (Exception e) {
Log.severe("Unable to remove the collision box of the Bamboo block.", e); Log.severe("Unable to remove the collision box of the Bamboo block.", e);

View File

@ -8,8 +8,8 @@ import fr.pandacube.lib.reflect.ReflectField;
import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; import static fr.pandacube.lib.util.ThrowableUtil.wrapEx;
import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx;
public class BambooBlock extends ReflectWrapper { public class BambooStalkBlock extends ReflectWrapper {
public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.world.level.block.BambooBlock")); public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.world.level.block.BambooStalkBlock"));
public static final ReflectField<?> COLLISION_SHAPE = wrapEx(() -> MAPPING.mojField("COLLISION_SHAPE")); public static final ReflectField<?> COLLISION_SHAPE = wrapEx(() -> MAPPING.mojField("COLLISION_SHAPE"));
public static VoxelShape COLLISION_SHAPE() { public static VoxelShape COLLISION_SHAPE() {
@ -20,7 +20,7 @@ public class BambooBlock extends ReflectWrapper {
wrapReflectEx(() -> COLLISION_SHAPE.setStaticValue(unwrap(shape))); wrapReflectEx(() -> COLLISION_SHAPE.setStaticValue(unwrap(shape)));
} }
protected BambooBlock(Object obj) { protected BambooStalkBlock(Object obj) {
super(obj); super(obj);
} }
} }