-
-
Notifications
You must be signed in to change notification settings - Fork 882
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deprecate the concept of bundled block data (#2447)
* wip * do all platforms but bukkit & cli * use the paperweight adapters for material information on bukkit * Move bundled block data load to CLI * Drop this part, let it load when needed * Stray warning suppression * Swap to using an MC utility function for full block detection
- Loading branch information
Showing
27 changed files
with
1,108 additions
and
56 deletions.
There are no files selected for viewing
11 changes: 10 additions & 1 deletion
11
verification/src/changes/accepted-fabric-public-api-changes.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,11 @@ | ||
{ | ||
} | ||
"Removal of constructor in non-API class": [ | ||
{ | ||
"type": "com.sk89q.worldedit.fabric.FabricBlockMaterial", | ||
"member": "Constructor com.sk89q.worldedit.fabric.FabricBlockMaterial(net.minecraft.class_2680,com.sk89q.worldedit.world.registry.BlockMaterial)", | ||
"changes": [ | ||
"CONSTRUCTOR_REMOVED" | ||
] | ||
} | ||
] | ||
} |
11 changes: 10 additions & 1 deletion
11
verification/src/changes/accepted-neoforge-public-api-changes.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,11 @@ | ||
{ | ||
} | ||
"Removal of constructor in non-API class": [ | ||
{ | ||
"type": "com.sk89q.worldedit.neoforge.NeoForgeBlockMaterial", | ||
"member": "Constructor com.sk89q.worldedit.neoforge.NeoForgeBlockMaterial(net.minecraft.world.level.block.state.BlockState,com.sk89q.worldedit.world.registry.BlockMaterial)", | ||
"changes": [ | ||
"CONSTRUCTOR_REMOVED" | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
140 changes: 140 additions & 0 deletions
140
.../main/java/com/sk89q/worldedit/bukkit/adapter/impl/v1_20_R2/PaperweightBlockMaterial.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
/* | ||
* WorldEdit, a Minecraft world manipulation toolkit | ||
* Copyright (C) sk89q <http://www.sk89q.com> | ||
* Copyright (C) WorldEdit team and contributors | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.sk89q.worldedit.bukkit.adapter.impl.v1_20_R2; | ||
|
||
import com.sk89q.worldedit.world.registry.BlockMaterial; | ||
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; | ||
|
||
public class PaperweightBlockMaterial implements BlockMaterial { | ||
|
||
private final BlockState block; | ||
|
||
public PaperweightBlockMaterial(BlockState block) { | ||
this.block = block; | ||
} | ||
|
||
@Override | ||
public boolean isAir() { | ||
return block.isAir(); | ||
} | ||
|
||
@Override | ||
public boolean isFullCube() { | ||
return Block.isShapeFullBlock(block.getShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO)); | ||
} | ||
|
||
@Override | ||
public boolean isOpaque() { | ||
return block.canOcclude(); | ||
} | ||
|
||
@Override | ||
public boolean isPowerSource() { | ||
return block.isSignalSource(); | ||
} | ||
|
||
@Override | ||
@SuppressWarnings("deprecation") | ||
public boolean isLiquid() { | ||
return block.liquid(); | ||
} | ||
|
||
@Override | ||
@SuppressWarnings("deprecation") | ||
public boolean isSolid() { | ||
return block.isSolid(); | ||
} | ||
|
||
@Override | ||
public float getHardness() { | ||
return block.getDestroySpeed(EmptyBlockGetter.INSTANCE, BlockPos.ZERO); | ||
} | ||
|
||
@Override | ||
@SuppressWarnings("deprecation") | ||
public float getResistance() { | ||
return block.getBlock().getExplosionResistance(); | ||
} | ||
|
||
@Override | ||
public float getSlipperiness() { | ||
return block.getBlock().getFriction(); | ||
} | ||
|
||
@Override | ||
@SuppressWarnings("deprecation") | ||
public int getLightValue() { | ||
return block.getLightEmission(); | ||
} | ||
|
||
@Override | ||
public boolean isFragileWhenPushed() { | ||
return block.getPistonPushReaction() == PushReaction.DESTROY; | ||
} | ||
|
||
@Override | ||
public boolean isUnpushable() { | ||
return block.getPistonPushReaction() == PushReaction.BLOCK; | ||
} | ||
|
||
@Override | ||
public boolean isTicksRandomly() { | ||
return block.isRandomlyTicking(); | ||
} | ||
|
||
@Override | ||
@SuppressWarnings("deprecation") | ||
public boolean isMovementBlocker() { | ||
return block.blocksMotion(); | ||
} | ||
|
||
@Override | ||
public boolean isBurnable() { | ||
return block.ignitedByLava(); | ||
} | ||
|
||
@Override | ||
public boolean isToolRequired() { | ||
return block.requiresCorrectToolForDrops(); | ||
} | ||
|
||
@Override | ||
public boolean isReplacedDuringPlacement() { | ||
return block.canBeReplaced(); | ||
} | ||
|
||
@Override | ||
public boolean isTranslucent() { | ||
return !block.canOcclude(); | ||
} | ||
|
||
@Override | ||
public boolean hasContainer() { | ||
return block.getBlock() instanceof EntityBlock entityBlock | ||
&& entityBlock.newBlockEntity(BlockPos.ZERO, block) instanceof Clearable; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
140 changes: 140 additions & 0 deletions
140
.../main/java/com/sk89q/worldedit/bukkit/adapter/impl/v1_20_R3/PaperweightBlockMaterial.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
/* | ||
* WorldEdit, a Minecraft world manipulation toolkit | ||
* Copyright (C) sk89q <http://www.sk89q.com> | ||
* Copyright (C) WorldEdit team and contributors | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.sk89q.worldedit.bukkit.adapter.impl.v1_20_R3; | ||
|
||
import com.sk89q.worldedit.world.registry.BlockMaterial; | ||
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; | ||
|
||
public class PaperweightBlockMaterial implements BlockMaterial { | ||
|
||
private final BlockState block; | ||
|
||
public PaperweightBlockMaterial(BlockState block) { | ||
this.block = block; | ||
} | ||
|
||
@Override | ||
public boolean isAir() { | ||
return block.isAir(); | ||
} | ||
|
||
@Override | ||
public boolean isFullCube() { | ||
return Block.isShapeFullBlock(block.getShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO)); | ||
} | ||
|
||
@Override | ||
public boolean isOpaque() { | ||
return block.canOcclude(); | ||
} | ||
|
||
@Override | ||
public boolean isPowerSource() { | ||
return block.isSignalSource(); | ||
} | ||
|
||
@Override | ||
@SuppressWarnings("deprecation") | ||
public boolean isLiquid() { | ||
return block.liquid(); | ||
} | ||
|
||
@Override | ||
@SuppressWarnings("deprecation") | ||
public boolean isSolid() { | ||
return block.isSolid(); | ||
} | ||
|
||
@Override | ||
public float getHardness() { | ||
return block.getDestroySpeed(EmptyBlockGetter.INSTANCE, BlockPos.ZERO); | ||
} | ||
|
||
@Override | ||
@SuppressWarnings("deprecation") | ||
public float getResistance() { | ||
return block.getBlock().getExplosionResistance(); | ||
} | ||
|
||
@Override | ||
public float getSlipperiness() { | ||
return block.getBlock().getFriction(); | ||
} | ||
|
||
@Override | ||
@SuppressWarnings("deprecation") | ||
public int getLightValue() { | ||
return block.getLightEmission(); | ||
} | ||
|
||
@Override | ||
public boolean isFragileWhenPushed() { | ||
return block.getPistonPushReaction() == PushReaction.DESTROY; | ||
} | ||
|
||
@Override | ||
public boolean isUnpushable() { | ||
return block.getPistonPushReaction() == PushReaction.BLOCK; | ||
} | ||
|
||
@Override | ||
public boolean isTicksRandomly() { | ||
return block.isRandomlyTicking(); | ||
} | ||
|
||
@Override | ||
@SuppressWarnings("deprecation") | ||
public boolean isMovementBlocker() { | ||
return block.blocksMotion(); | ||
} | ||
|
||
@Override | ||
public boolean isBurnable() { | ||
return block.ignitedByLava(); | ||
} | ||
|
||
@Override | ||
public boolean isToolRequired() { | ||
return block.requiresCorrectToolForDrops(); | ||
} | ||
|
||
@Override | ||
public boolean isReplacedDuringPlacement() { | ||
return block.canBeReplaced(); | ||
} | ||
|
||
@Override | ||
public boolean isTranslucent() { | ||
return !block.canOcclude(); | ||
} | ||
|
||
@Override | ||
public boolean hasContainer() { | ||
return block.getBlock() instanceof EntityBlock entityBlock | ||
&& entityBlock.newBlockEntity(BlockPos.ZERO, block) instanceof Clearable; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.