9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-30 20:39:10 +00:00

Merge branch 'Xiao-MoMi:dev' into dev

This commit is contained in:
jhqwqmc
2025-04-26 21:04:48 +08:00
committed by GitHub
10 changed files with 221 additions and 11 deletions

View File

@@ -0,0 +1,32 @@
package net.momirealms.craftengine.bukkit.api;
import net.momirealms.craftengine.bukkit.entity.BukkitEntity;
import net.momirealms.craftengine.bukkit.plugin.BukkitCraftEngine;
import net.momirealms.craftengine.bukkit.plugin.user.BukkitServerPlayer;
import net.momirealms.craftengine.bukkit.world.BukkitWorld;
import net.momirealms.craftengine.bukkit.world.BukkitWorldBlock;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
public final class BukkitAdaptors {
private BukkitAdaptors() {}
public static BukkitServerPlayer adapt(final Player player) {
return BukkitCraftEngine.instance().adapt(player);
}
public static BukkitWorld adapt(final World world) {
return new BukkitWorld(world);
}
public static BukkitEntity adapt(final Entity entity) {
return new BukkitEntity(entity);
}
public static BukkitWorldBlock adapt(final Block block) {
return new BukkitWorldBlock(block);
}
}

View File

@@ -112,8 +112,6 @@ public final class CraftEngineBlocks {
Object worldServer = FastNMS.INSTANCE.field$CraftWorld$ServerLevel(location.getWorld());
Object blockPos = FastNMS.INSTANCE.constructor$BlockPos(location.getBlockX(), location.getBlockY(), location.getBlockZ());
Object blockState = block.customBlockState().handle();
System.out.println(blockPos);
System.out.println(blockState);
Object oldBlockState = FastNMS.INSTANCE.method$BlockGetter$getBlockState(worldServer, blockPos);
success = FastNMS.INSTANCE.method$LevelWriter$setBlock(worldServer, blockPos, blockState, option.flags());
if (success) {
@@ -122,7 +120,6 @@ public final class CraftEngineBlocks {
location.getWorld().playSound(location, block.sounds().placeSound().toString(), SoundCategory.BLOCKS, block.sounds().placeSound().volume(), block.sounds().placeSound().pitch());
}
}
System.out.println(success);
return success;
}