Support new fabric block appearance API
This commit is contained in:
parent
3d5300e908
commit
878aa0a74d
4 changed files with 16 additions and 3 deletions
|
@ -29,7 +29,7 @@
|
||||||
],
|
],
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.14.8",
|
"fabricloader": ">=0.14.8",
|
||||||
"fabric-api": ">=0.62.0",
|
"fabric-api": ">=0.66.0",
|
||||||
"team_reborn_energy": ">=2.2.0",
|
"team_reborn_energy": ">=2.2.0",
|
||||||
"fabric-biome-api-v1": ">=3.0.0",
|
"fabric-biome-api-v1": ">=3.0.0",
|
||||||
"minecraft": "~1.19.2"
|
"minecraft": "~1.19.2"
|
||||||
|
|
|
@ -9,7 +9,7 @@ mod_version=5.3.4
|
||||||
minecraft_version=1.19.2
|
minecraft_version=1.19.2
|
||||||
yarn_version=1.19.2+build.10
|
yarn_version=1.19.2+build.10
|
||||||
loader_version=0.14.9
|
loader_version=0.14.9
|
||||||
fapi_version=0.62.0+1.19.2
|
fapi_version=0.66.0+1.19.2
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
energy_version=2.2.0
|
energy_version=2.2.0
|
||||||
|
|
|
@ -51,6 +51,7 @@ import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Direction;
|
import net.minecraft.util.math.Direction;
|
||||||
import net.minecraft.util.shape.VoxelShape;
|
import net.minecraft.util.shape.VoxelShape;
|
||||||
import net.minecraft.util.shape.VoxelShapes;
|
import net.minecraft.util.shape.VoxelShapes;
|
||||||
|
import net.minecraft.world.BlockRenderView;
|
||||||
import net.minecraft.world.BlockView;
|
import net.minecraft.world.BlockView;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.WorldAccess;
|
import net.minecraft.world.WorldAccess;
|
||||||
|
@ -260,4 +261,16 @@ public class CableBlock extends BlockWithEntity implements Waterloggable {
|
||||||
public FluidState getFluidState(BlockState state) {
|
public FluidState getFluidState(BlockState state) {
|
||||||
return state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state);
|
return state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockState getAppearance(BlockState state, BlockRenderView renderView, BlockPos pos, Direction side, @Nullable BlockState sourceState, @Nullable BlockPos sourcePos) {
|
||||||
|
if (state.get(COVERED)) {
|
||||||
|
if (renderView.getBlockEntity(pos) instanceof CableBlockEntity cableBlockEntity) {
|
||||||
|
final BlockState cover = cableBlockEntity.getCover();
|
||||||
|
return cover != null ? cover : Blocks.OAK_PLANKS.getDefaultState();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.getAppearance(state, renderView, pos, side, sourceState, sourcePos);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
},
|
},
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.14.8",
|
"fabricloader": ">=0.14.8",
|
||||||
"fabric-api": ">=0.62.0",
|
"fabric-api": ">=0.66.0",
|
||||||
"reborncore": "*",
|
"reborncore": "*",
|
||||||
"team_reborn_energy": ">=2.2.0",
|
"team_reborn_energy": ">=2.2.0",
|
||||||
"fabric-biome-api-v1": ">=3.0.0",
|
"fabric-biome-api-v1": ">=3.0.0",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue