[Forge] 高版本Forge "已弃用"方法迁移到哪里了
众所周知,Forge每个版本都会改一些语法(大家写方块实体肯定对这三个方法熟悉:@Override
public BlockState mirror(BlockState pState, Mirror pMirror) {
return super.mirror(pState, pMirror);
}@Override
public BlockState rotate(BlockState pState, Rotation pRotation) {
return super.rotate(pState, pRotation);
}@Override
public VoxelShape getShape(BlockState pState, BlockGetter pLevel, BlockPos pPos, CollisionContext pContext) {
return super.getShape(pState, pLevel, pPos, pContext);
}这三个方法已经在高版本“被标记为弃用”了,但是很多教程都在重写这个方法
mirror和rotate的原文档:
/** @deprecated */
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
* @deprecated call via {@link net.minecraft.world.level.block.state.BlockBehaviour.BlockStateBase#rotate} whenever
* possible. Implementing/overriding is fine.
*/
/** @deprecated */
/**
* Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
* blockstate.
* @deprecated call via {@link net.minecraft.world.level.block.state.BlockBehaviour.BlockStateBase#mirror} whenever
* possible. Implementing/overriding is fine.
*/
推荐用BlockBehaviour.BlockStateBase里面的方法重写,不过好像这是游戏自动控制的(也许?
但是重写也没关系,主要实现复杂的旋转?
但是这个getShape()...
/** @deprecated */
只有这一句话...
不过有一个类似的方法getShapeForEachState()但是好像并没有什么用处(在FORGE START前面)确信
然后我翻到Slab的实现,发现就是用的getShape() 但是IDEA没有报警告(特性?)
所以Forge是废弃了一个方法但是又没有可替代方案吗...
页:
[1]