Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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 @@ -8,5 +8,15 @@
"ANNOTATION_REMOVED"
]
}
],
"Replaced by default method": [
{
"type": "com.sk89q.worldedit.bukkit.BukkitBlockRegistry",
"member": "Method com.sk89q.worldedit.bukkit.BukkitBlockRegistry.getMaterial(com.sk89q.worldedit.world.block.BlockType)",
"changes": [
"METHOD_REMOVED",
"ANNOTATION_REMOVED"
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -141,5 +141,14 @@
"ANNOTATION_REMOVED"
]
}
],
"Why on earth is this even an issue?": [

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If someone was implementing BlockMaterial, this can sometimes cause weird issues that I don't recall exactly. But we should have the actual reasoning here, e.g.

Suggested change
"Why on earth is this even an issue?": [
"No one should be implementing BlockMaterial": [

{
"type": "com.sk89q.worldedit.world.registry.BlockMaterial",
"member": "Method com.sk89q.worldedit.world.registry.BlockMaterial.isFullCube()",
"changes": [
"METHOD_ABSTRACT_NOW_DEFAULT"
]
}
]
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,18 @@
{
"Replaced by default method": [
{
"type": "com.sk89q.worldedit.sponge.SpongeBlockRegistry",
"member": "Method com.sk89q.worldedit.sponge.SpongeBlockRegistry.getMaterial(com.sk89q.worldedit.world.block.BlockType)",
"changes": [
"METHOD_REMOVED"
]
},
{
"type": "com.sk89q.worldedit.sponge.SpongeBlockMaterial",
"member": "Method com.sk89q.worldedit.sponge.SpongeBlockMaterial.isFullCube()",
"changes": [
"METHOD_REMOVED"
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,11 @@ public BlockMaterial getBlockMaterial(BlockType blockType) {
return new PaperweightBlockMaterial(mcBlockState);
}

@Override
public BlockMaterial getBlockMaterial(BlockState blockState) {
return new PaperweightBlockMaterial(adapt(blockState));
}

@SuppressWarnings({ "unchecked", "rawtypes" })
private static final LoadingCache<net.minecraft.world.level.block.state.properties.Property, Property<?>> PROPERTY_CACHE = CacheBuilder.newBuilder().build(new CacheLoader<>() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,19 @@

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

import com.sk89q.worldedit.world.registry.BlockMaterial;
import com.sk89q.worldedit.blocks.ShapeType;
import com.sk89q.worldedit.internal.block.AbstractBlockMaterial;
import net.minecraft.core.BlockPos;
import net.minecraft.world.Clearable;
import net.minecraft.world.level.EmptyBlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.PushReaction;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;

public class PaperweightBlockMaterial implements BlockMaterial {
public class PaperweightBlockMaterial extends AbstractBlockMaterial<VoxelShape> {

private final BlockState block;

Expand All @@ -42,8 +45,16 @@ public boolean isAir() {
}

@Override
public boolean isFullCube() {
return Block.isShapeFullBlock(block.getShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO));
protected VoxelShape getShape(ShapeType shapeType) {
return switch (shapeType) {
case SHAPE -> block.getShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO, CollisionContext.empty());
case VISUAL_SHAPE -> block.getVisualShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO, CollisionContext.empty());
};
}

@Override
protected boolean isShapeFullBlock(VoxelShape shape) {
return Block.isShapeFullBlock(shape);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,11 @@ public BlockMaterial getBlockMaterial(BlockType blockType) {
return new PaperweightBlockMaterial(mcBlockState);
}

@Override
public BlockMaterial getBlockMaterial(BlockState blockState) {
return new PaperweightBlockMaterial(adapt(blockState));
}

@SuppressWarnings({ "unchecked", "rawtypes" })
private static final LoadingCache<net.minecraft.world.level.block.state.properties.Property, Property<?>> PROPERTY_CACHE = CacheBuilder.newBuilder().build(new CacheLoader<>() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,19 @@

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

import com.sk89q.worldedit.world.registry.BlockMaterial;
import com.sk89q.worldedit.blocks.ShapeType;
import com.sk89q.worldedit.internal.block.AbstractBlockMaterial;
import net.minecraft.core.BlockPos;
import net.minecraft.world.Clearable;
import net.minecraft.world.level.EmptyBlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.PushReaction;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;

public class PaperweightBlockMaterial implements BlockMaterial {
public class PaperweightBlockMaterial extends AbstractBlockMaterial<VoxelShape> {

private final BlockState block;

Expand All @@ -42,8 +45,16 @@ public boolean isAir() {
}

@Override
public boolean isFullCube() {
return Block.isShapeFullBlock(block.getShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO));
protected VoxelShape getShape(ShapeType shapeType) {
return switch (shapeType) {
case SHAPE -> block.getShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO, CollisionContext.empty());
case VISUAL_SHAPE -> block.getVisualShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO, CollisionContext.empty());
};
}

@Override
protected boolean isShapeFullBlock(VoxelShape shape) {
return Block.isShapeFullBlock(shape);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,11 @@ public BlockMaterial getBlockMaterial(BlockType blockType) {
return new PaperweightBlockMaterial(mcBlockState);
}

@Override
public BlockMaterial getBlockMaterial(BlockState blockState) {
return new PaperweightBlockMaterial(adapt(blockState));
}

@SuppressWarnings({ "unchecked", "rawtypes" })
private static final LoadingCache<net.minecraft.world.level.block.state.properties.Property, Property<?>> PROPERTY_CACHE = CacheBuilder.newBuilder().build(new CacheLoader<>() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,19 @@

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

import com.sk89q.worldedit.world.registry.BlockMaterial;
import com.sk89q.worldedit.blocks.ShapeType;
import com.sk89q.worldedit.internal.block.AbstractBlockMaterial;
import net.minecraft.core.BlockPos;
import net.minecraft.world.Clearable;
import net.minecraft.world.level.EmptyBlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.PushReaction;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;

public class PaperweightBlockMaterial implements BlockMaterial {
public class PaperweightBlockMaterial extends AbstractBlockMaterial<VoxelShape> {

private final BlockState block;

Expand All @@ -42,8 +45,16 @@ public boolean isAir() {
}

@Override
public boolean isFullCube() {
return Block.isShapeFullBlock(block.getShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO));
protected VoxelShape getShape(ShapeType shapeType) {
return switch (shapeType) {
case SHAPE -> block.getShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO, CollisionContext.empty());
case VISUAL_SHAPE -> block.getVisualShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO, CollisionContext.empty());
};
}

@Override
protected boolean isShapeFullBlock(VoxelShape shape) {
return Block.isShapeFullBlock(shape);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,11 @@ public BlockMaterial getBlockMaterial(BlockType blockType) {
return new PaperweightBlockMaterial(mcBlockState);
}

@Override
public BlockMaterial getBlockMaterial(BlockState blockState) {
return new PaperweightBlockMaterial(adapt(blockState));
}

@SuppressWarnings({ "unchecked", "rawtypes" })
private static final LoadingCache<net.minecraft.world.level.block.state.properties.Property, Property<?>> PROPERTY_CACHE = CacheBuilder.newBuilder().build(new CacheLoader<>() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,19 @@

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

import com.sk89q.worldedit.world.registry.BlockMaterial;
import com.sk89q.worldedit.blocks.ShapeType;
import com.sk89q.worldedit.internal.block.AbstractBlockMaterial;
import net.minecraft.core.BlockPos;
import net.minecraft.world.Clearable;
import net.minecraft.world.level.EmptyBlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.PushReaction;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;

public class PaperweightBlockMaterial implements BlockMaterial {
public class PaperweightBlockMaterial extends AbstractBlockMaterial<VoxelShape> {

private final BlockState block;

Expand All @@ -42,8 +45,16 @@ public boolean isAir() {
}

@Override
public boolean isFullCube() {
return Block.isShapeFullBlock(block.getShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO));
protected VoxelShape getShape(ShapeType shapeType) {
return switch (shapeType) {
case SHAPE -> block.getShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO, CollisionContext.empty());
case VISUAL_SHAPE -> block.getVisualShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO, CollisionContext.empty());
};
}

@Override
protected boolean isShapeFullBlock(VoxelShape shape) {
return Block.isShapeFullBlock(shape);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,11 @@ public BlockMaterial getBlockMaterial(BlockType blockType) {
return new PaperweightBlockMaterial(mcBlockState);
}

@Override
public BlockMaterial getBlockMaterial(BlockState blockState) {
return new PaperweightBlockMaterial(adapt(blockState));
}

@SuppressWarnings({ "unchecked", "rawtypes" })
private static final LoadingCache<net.minecraft.world.level.block.state.properties.Property, Property<?>> PROPERTY_CACHE = CacheBuilder.newBuilder().build(new CacheLoader<>() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,19 @@

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

import com.sk89q.worldedit.world.registry.BlockMaterial;
import com.sk89q.worldedit.blocks.ShapeType;
import com.sk89q.worldedit.internal.block.AbstractBlockMaterial;
import net.minecraft.core.BlockPos;
import net.minecraft.world.Clearable;
import net.minecraft.world.level.EmptyBlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.PushReaction;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;

public class PaperweightBlockMaterial implements BlockMaterial {
public class PaperweightBlockMaterial extends AbstractBlockMaterial<VoxelShape> {

private final BlockState block;

Expand All @@ -42,8 +45,16 @@ public boolean isAir() {
}

@Override
public boolean isFullCube() {
return Block.isShapeFullBlock(block.getShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO));
protected VoxelShape getShape(ShapeType shapeType) {
return switch (shapeType) {
case SHAPE -> block.getShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO, CollisionContext.empty());
case VISUAL_SHAPE -> block.getVisualShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO, CollisionContext.empty());
};
}

@Override
protected boolean isShapeFullBlock(VoxelShape shape) {
return Block.isShapeFullBlock(shape);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,11 @@ public BlockMaterial getBlockMaterial(BlockType blockType) {
return new PaperweightBlockMaterial(mcBlockState);
}

@Override
public BlockMaterial getBlockMaterial(BlockState blockState) {
return new PaperweightBlockMaterial(adapt(blockState));
}

@SuppressWarnings({ "unchecked", "rawtypes" })
private static final LoadingCache<net.minecraft.world.level.block.state.properties.Property, Property<?>> PROPERTY_CACHE = CacheBuilder.newBuilder().build(new CacheLoader<>() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,19 @@

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

import com.sk89q.worldedit.world.registry.BlockMaterial;
import com.sk89q.worldedit.blocks.ShapeType;
import com.sk89q.worldedit.internal.block.AbstractBlockMaterial;
import net.minecraft.core.BlockPos;
import net.minecraft.world.Clearable;
import net.minecraft.world.level.EmptyBlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.PushReaction;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;

public class PaperweightBlockMaterial implements BlockMaterial {
public class PaperweightBlockMaterial extends AbstractBlockMaterial<VoxelShape> {

private final BlockState block;

Expand All @@ -42,8 +45,16 @@ public boolean isAir() {
}

@Override
public boolean isFullCube() {
return Block.isShapeFullBlock(block.getShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO));
protected VoxelShape getShape(ShapeType shapeType) {
return switch (shapeType) {
case SHAPE -> block.getShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO, CollisionContext.empty());
case VISUAL_SHAPE -> block.getVisualShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO, CollisionContext.empty());
};
}

@Override
protected boolean isShapeFullBlock(VoxelShape shape) {
return Block.isShapeFullBlock(shape);
}

@Override
Expand Down
Loading
Loading