Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,9 @@ public BiomeType adapt(Biome biome) {

public net.minecraft.world.level.block.state.BlockState adapt(BlockState blockState) {
int internalId = BlockStateIdAccess.getBlockStateId(blockState);
return Block.stateById(internalId);
return BlockStateIdAccess.isValidInternalId(internalId)
? Block.stateById(internalId)
: ((CraftBlockData) BukkitAdapter.adapt(blockState)).getState();
}

@Override
Expand Down Expand Up @@ -723,8 +725,7 @@ public boolean simulateItemUse(World world, BlockVector3 position, BaseItem item

@Override
public boolean canPlaceAt(World world, BlockVector3 position, BlockState blockState) {
int internalId = BlockStateIdAccess.getBlockStateId(blockState);
net.minecraft.world.level.block.state.BlockState blockData = Block.stateById(internalId);
net.minecraft.world.level.block.state.BlockState blockData = adapt(blockState);
return blockData.canSurvive(((CraftWorld) world).getHandle(), new BlockPos(position.x(), position.y(), position.z()));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

package com.sk89q.worldedit.bukkit.adapter.impl.v1_21_11;

import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.internal.block.BlockStateIdAccess;
import com.sk89q.worldedit.internal.wna.WorldNativeAccess;
import com.sk89q.worldedit.util.SideEffect;
import com.sk89q.worldedit.util.SideEffectSet;
Expand Down Expand Up @@ -71,10 +69,7 @@ public LevelChunk getChunk(int x, int z) {

@Override
public net.minecraft.world.level.block.state.BlockState toNative(BlockState state) {
int stateId = BlockStateIdAccess.getBlockStateId(state);
return BlockStateIdAccess.isValidInternalId(stateId)
? Block.stateById(stateId)
: ((CraftBlockData) BukkitAdapter.adapt(state)).getState();
return adapter.adapt(state);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,9 @@ public BiomeType adapt(Biome biome) {

public net.minecraft.world.level.block.state.BlockState adapt(BlockState blockState) {
int internalId = BlockStateIdAccess.getBlockStateId(blockState);
return Block.stateById(internalId);
return BlockStateIdAccess.isValidInternalId(internalId)
? Block.stateById(internalId)
: ((CraftBlockData) BukkitAdapter.adapt(blockState)).getState();
}

@Override
Expand Down Expand Up @@ -704,8 +706,7 @@ public boolean simulateItemUse(World world, BlockVector3 position, BaseItem item

@Override
public boolean canPlaceAt(World world, BlockVector3 position, BlockState blockState) {
int internalId = BlockStateIdAccess.getBlockStateId(blockState);
net.minecraft.world.level.block.state.BlockState blockData = Block.stateById(internalId);
net.minecraft.world.level.block.state.BlockState blockData = adapt(blockState);
return blockData.canSurvive(((CraftWorld) world).getHandle(), new BlockPos(position.x(), position.y(), position.z()));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

package com.sk89q.worldedit.bukkit.adapter.impl.v1_21_4;

import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.internal.block.BlockStateIdAccess;
import com.sk89q.worldedit.internal.wna.WorldNativeAccess;
import com.sk89q.worldedit.util.SideEffect;
import com.sk89q.worldedit.util.SideEffectSet;
Expand Down Expand Up @@ -71,10 +69,7 @@ public LevelChunk getChunk(int x, int z) {

@Override
public net.minecraft.world.level.block.state.BlockState toNative(BlockState state) {
int stateId = BlockStateIdAccess.getBlockStateId(state);
return BlockStateIdAccess.isValidInternalId(stateId)
? Block.stateById(stateId)
: ((CraftBlockData) BukkitAdapter.adapt(state)).getState();
return adapter.adapt(state);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,9 @@ public BiomeType adapt(Biome biome) {

public net.minecraft.world.level.block.state.BlockState adapt(BlockState blockState) {
int internalId = BlockStateIdAccess.getBlockStateId(blockState);
return Block.stateById(internalId);
return BlockStateIdAccess.isValidInternalId(internalId)
? Block.stateById(internalId)
: ((CraftBlockData) BukkitAdapter.adapt(blockState)).getState();
}

@Override
Expand Down Expand Up @@ -702,8 +704,7 @@ public boolean simulateItemUse(World world, BlockVector3 position, BaseItem item

@Override
public boolean canPlaceAt(World world, BlockVector3 position, BlockState blockState) {
int internalId = BlockStateIdAccess.getBlockStateId(blockState);
net.minecraft.world.level.block.state.BlockState blockData = Block.stateById(internalId);
net.minecraft.world.level.block.state.BlockState blockData = adapt(blockState);
return blockData.canSurvive(((CraftWorld) world).getHandle(), new BlockPos(position.x(), position.y(), position.z()));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

package com.sk89q.worldedit.bukkit.adapter.impl.v1_21_5;

import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.internal.block.BlockStateIdAccess;
import com.sk89q.worldedit.internal.wna.WorldNativeAccess;
import com.sk89q.worldedit.util.SideEffect;
import com.sk89q.worldedit.util.SideEffectSet;
Expand Down Expand Up @@ -71,10 +69,7 @@ public LevelChunk getChunk(int x, int z) {

@Override
public net.minecraft.world.level.block.state.BlockState toNative(BlockState state) {
int stateId = BlockStateIdAccess.getBlockStateId(state);
return BlockStateIdAccess.isValidInternalId(stateId)
? Block.stateById(stateId)
: ((CraftBlockData) BukkitAdapter.adapt(state)).getState();
return adapter.adapt(state);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,9 @@ public BiomeType adapt(Biome biome) {

public net.minecraft.world.level.block.state.BlockState adapt(BlockState blockState) {
int internalId = BlockStateIdAccess.getBlockStateId(blockState);
return Block.stateById(internalId);
return BlockStateIdAccess.isValidInternalId(internalId)
? Block.stateById(internalId)
: ((CraftBlockData) BukkitAdapter.adapt(blockState)).getState();
}

@Override
Expand Down Expand Up @@ -724,8 +726,7 @@ public boolean simulateItemUse(World world, BlockVector3 position, BaseItem item

@Override
public boolean canPlaceAt(World world, BlockVector3 position, BlockState blockState) {
int internalId = BlockStateIdAccess.getBlockStateId(blockState);
net.minecraft.world.level.block.state.BlockState blockData = Block.stateById(internalId);
net.minecraft.world.level.block.state.BlockState blockData = adapt(blockState);
return blockData.canSurvive(((CraftWorld) world).getHandle(), new BlockPos(position.x(), position.y(), position.z()));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

package com.sk89q.worldedit.bukkit.adapter.impl.v1_21_6;

import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.internal.block.BlockStateIdAccess;
import com.sk89q.worldedit.internal.wna.WorldNativeAccess;
import com.sk89q.worldedit.util.SideEffect;
import com.sk89q.worldedit.util.SideEffectSet;
Expand Down Expand Up @@ -71,10 +69,7 @@ public LevelChunk getChunk(int x, int z) {

@Override
public net.minecraft.world.level.block.state.BlockState toNative(BlockState state) {
int stateId = BlockStateIdAccess.getBlockStateId(state);
return BlockStateIdAccess.isValidInternalId(stateId)
? Block.stateById(stateId)
: ((CraftBlockData) BukkitAdapter.adapt(state)).getState();
return adapter.adapt(state);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,9 @@ public BiomeType adapt(Biome biome) {

public net.minecraft.world.level.block.state.BlockState adapt(BlockState blockState) {
int internalId = BlockStateIdAccess.getBlockStateId(blockState);
return Block.stateById(internalId);
return BlockStateIdAccess.isValidInternalId(internalId)
? Block.stateById(internalId)
: ((CraftBlockData) BukkitAdapter.adapt(blockState)).getState();
}

@Override
Expand Down Expand Up @@ -723,8 +725,7 @@ public boolean simulateItemUse(World world, BlockVector3 position, BaseItem item

@Override
public boolean canPlaceAt(World world, BlockVector3 position, BlockState blockState) {
int internalId = BlockStateIdAccess.getBlockStateId(blockState);
net.minecraft.world.level.block.state.BlockState blockData = Block.stateById(internalId);
net.minecraft.world.level.block.state.BlockState blockData = adapt(blockState);
return blockData.canSurvive(((CraftWorld) world).getHandle(), new BlockPos(position.x(), position.y(), position.z()));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

package com.sk89q.worldedit.bukkit.adapter.impl.v1_21_9;

import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.internal.block.BlockStateIdAccess;
import com.sk89q.worldedit.internal.wna.WorldNativeAccess;
import com.sk89q.worldedit.util.SideEffect;
import com.sk89q.worldedit.util.SideEffectSet;
Expand Down Expand Up @@ -71,10 +69,7 @@ public LevelChunk getChunk(int x, int z) {

@Override
public net.minecraft.world.level.block.state.BlockState toNative(BlockState state) {
int stateId = BlockStateIdAccess.getBlockStateId(state);
return BlockStateIdAccess.isValidInternalId(stateId)
? Block.stateById(stateId)
: ((CraftBlockData) BukkitAdapter.adapt(state)).getState();
return adapter.adapt(state);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,9 @@ public BiomeType adapt(Biome biome) {

public net.minecraft.world.level.block.state.BlockState adapt(BlockState blockState) {
int internalId = BlockStateIdAccess.getBlockStateId(blockState);
return Block.stateById(internalId);
return BlockStateIdAccess.isValidInternalId(internalId)
? Block.stateById(internalId)
: ((CraftBlockData) BukkitAdapter.adapt(blockState)).getState();
}

@Override
Expand Down Expand Up @@ -741,8 +743,7 @@ public boolean simulateItemUse(World world, BlockVector3 position, BaseItem item

@Override
public boolean canPlaceAt(World world, BlockVector3 position, BlockState blockState) {
int internalId = BlockStateIdAccess.getBlockStateId(blockState);
net.minecraft.world.level.block.state.BlockState blockData = Block.stateById(internalId);
net.minecraft.world.level.block.state.BlockState blockData = adapt(blockState);
return blockData.canSurvive(((CraftWorld) world).getHandle(), new BlockPos(position.x(), position.y(), position.z()));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

package com.sk89q.worldedit.bukkit.adapter.impl.v26_1;

import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.internal.block.BlockStateIdAccess;
import com.sk89q.worldedit.internal.wna.WorldNativeAccess;
import com.sk89q.worldedit.util.SideEffect;
import com.sk89q.worldedit.util.SideEffectSet;
Expand All @@ -34,7 +32,6 @@
import net.minecraft.world.level.chunk.LevelChunk;
import net.minecraft.world.level.redstone.ExperimentalRedstoneUtils;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
import org.bukkit.event.block.BlockPhysicsEvent;
import org.enginehub.linbus.tree.LinCompoundTag;

Expand Down Expand Up @@ -71,10 +68,7 @@ public LevelChunk getChunk(int x, int z) {

@Override
public net.minecraft.world.level.block.state.BlockState toNative(BlockState state) {
int stateId = BlockStateIdAccess.getBlockStateId(state);
return BlockStateIdAccess.isValidInternalId(stateId)
? Block.stateById(stateId)
: ((CraftBlockData) BukkitAdapter.adapt(state)).getState();
return adapter.adapt(state);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,9 @@ public BiomeType adapt(Biome biome) {

public net.minecraft.world.level.block.state.BlockState adapt(BlockState blockState) {
int internalId = BlockStateIdAccess.getBlockStateId(blockState);
return Block.stateById(internalId);
return BlockStateIdAccess.isValidInternalId(internalId)
? Block.stateById(internalId)
: ((CraftBlockData) BukkitAdapter.adapt(blockState)).getState();
}

@Override
Expand Down Expand Up @@ -746,8 +748,7 @@ public boolean simulateItemUse(World world, BlockVector3 position, BaseItem item

@Override
public boolean canPlaceAt(World world, BlockVector3 position, BlockState blockState) {
int internalId = BlockStateIdAccess.getBlockStateId(blockState);
net.minecraft.world.level.block.state.BlockState blockData = Block.stateById(internalId);
net.minecraft.world.level.block.state.BlockState blockData = adapt(blockState);
return blockData.canSurvive(((CraftWorld) world).getHandle(), new BlockPos(position.x(), position.y(), position.z()));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

package com.sk89q.worldedit.bukkit.adapter.impl.v26_2;

import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.internal.block.BlockStateIdAccess;
import com.sk89q.worldedit.internal.wna.WorldNativeAccess;
import com.sk89q.worldedit.util.SideEffect;
import com.sk89q.worldedit.util.SideEffectSet;
Expand All @@ -34,7 +32,6 @@
import net.minecraft.world.level.chunk.LevelChunk;
import net.minecraft.world.level.redstone.ExperimentalRedstoneUtils;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
import org.bukkit.event.block.BlockPhysicsEvent;
import org.enginehub.linbus.tree.LinCompoundTag;

Expand Down Expand Up @@ -71,10 +68,7 @@ public LevelChunk getChunk(int x, int z) {

@Override
public net.minecraft.world.level.block.state.BlockState toNative(BlockState state) {
int stateId = BlockStateIdAccess.getBlockStateId(state);
return BlockStateIdAccess.isValidInternalId(stateId)
? Block.stateById(stateId)
: ((CraftBlockData) BukkitAdapter.adapt(state)).getState();
return adapter.adapt(state);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,9 @@ public BiomeType adapt(Biome biome) {

public net.minecraft.world.level.block.state.BlockState adapt(BlockState blockState) {
int internalId = BlockStateIdAccess.getBlockStateId(blockState);
return Block.stateById(internalId);
return BlockStateIdAccess.isValidInternalId(internalId)
? Block.stateById(internalId)
: ((CraftBlockData) BukkitAdapter.adapt(blockState)).getState();
}

@Override
Expand Down Expand Up @@ -766,8 +768,7 @@ public boolean simulateItemUse(World world, BlockVector3 position, BaseItem item

@Override
public boolean canPlaceAt(World world, BlockVector3 position, BlockState blockState) {
int internalId = BlockStateIdAccess.getBlockStateId(blockState);
net.minecraft.world.level.block.state.BlockState blockData = Block.stateById(internalId);
net.minecraft.world.level.block.state.BlockState blockData = adapt(blockState);
return blockData.canSurvive(((CraftWorld) world).getHandle(), new BlockPos(position.x(), position.y(), position.z()));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

package com.sk89q.worldedit.bukkit.adapter.impl.v26_3;

import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.internal.block.BlockStateIdAccess;
import com.sk89q.worldedit.internal.wna.WorldNativeAccess;
import com.sk89q.worldedit.util.SideEffect;
import com.sk89q.worldedit.util.SideEffectSet;
Expand All @@ -34,7 +32,6 @@
import net.minecraft.world.level.chunk.LevelChunk;
import net.minecraft.world.level.redstone.ExperimentalRedstoneUtils;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
import org.bukkit.event.block.BlockPhysicsEvent;
import org.enginehub.linbus.tree.LinCompoundTag;

Expand Down Expand Up @@ -71,10 +68,7 @@ public LevelChunk getChunk(int x, int z) {

@Override
public net.minecraft.world.level.block.state.BlockState toNative(BlockState state) {
int stateId = BlockStateIdAccess.getBlockStateId(state);
return BlockStateIdAccess.isValidInternalId(stateId)
? Block.stateById(stateId)
: ((CraftBlockData) BukkitAdapter.adapt(state)).getState();
return adapter.adapt(state);
}

@Override
Expand Down
Loading