Smaller changes to Debug Item

This commit is contained in:
Frank 2023-06-07 19:27:29 +02:00
parent fb5f0a933c
commit 2e2a23cd88
2 changed files with 9 additions and 6 deletions

View file

@ -226,7 +226,6 @@ public abstract class ComplexMaterial {
* Get initiated {@link Block} from this {@link ComplexMaterial}. * Get initiated {@link Block} from this {@link ComplexMaterial}.
* *
* @param key {@link MaterialSlot} The Block Entry * @param key {@link MaterialSlot} The Block Entry
* @param <M> The {@link ComplexMaterial} this slot is usable for Type
* @return {@link Block} or {@code null} if nothing is stored. * @return {@link Block} or {@code null} if nothing is stored.
*/ */
@Nullable @Nullable

View file

@ -115,7 +115,7 @@ public class DebugDataItem extends Item implements ItemModelProvider {
@Override @Override
public boolean canAttackBlock(BlockState blockState, Level level, BlockPos blockPos, Player player) { public boolean canAttackBlock(BlockState blockState, Level level, BlockPos blockPos, Player player) {
return false; return true;
} }
@Override @Override
@ -127,7 +127,7 @@ public class DebugDataItem extends Item implements ItemModelProvider {
BlockHitResult hit = level.isBlockInLine(new ClipBlockStateContext( BlockHitResult hit = level.isBlockInLine(new ClipBlockStateContext(
player.getEyePosition(), player.getEyePosition(),
player.getEyePosition().add(vec.scale(6.0)), player.getEyePosition().add(vec.scale(4.9)),
BlockBehaviour.BlockStateBase::isAir BlockBehaviour.BlockStateBase::isAir
)); ));
@ -190,6 +190,7 @@ public class DebugDataItem extends Item implements ItemModelProvider {
return forJigsaw( return forJigsaw(
pool == null ? Pools.EMPTY : pool, pool == null ? Pools.EMPTY : pool,
new ResourceLocation(modID, "building_entrance"), new ResourceLocation(modID, "building_entrance"),
pool == null ? new ResourceLocation("empty") : new ResourceLocation(modID, "street"),
JigsawBlockEntity.JointType.ALIGNED, JigsawBlockEntity.JointType.ALIGNED,
null, null,
null, null,
@ -208,7 +209,7 @@ public class DebugDataItem extends Item implements ItemModelProvider {
pool == null ? new ResourceLocation("empty") : new ResourceLocation(modID, "bottom"), pool == null ? new ResourceLocation("empty") : new ResourceLocation(modID, "bottom"),
JigsawBlockEntity.JointType.ROLLABLE, JigsawBlockEntity.JointType.ROLLABLE,
null, null,
pool == null ? FrontAndTop.NORTH_UP : null, pool == null ? FrontAndTop.DOWN_WEST : FrontAndTop.UP_WEST,
icon icon
); );
} }
@ -243,8 +244,11 @@ public class DebugDataItem extends Item implements ItemModelProvider {
var entity = level.getBlockEntity(pos); var entity = level.getBlockEntity(pos);
var targetState = finalState; var targetState = finalState;
if (!(entity instanceof JigsawBlockEntity)) { if (!(entity instanceof JigsawBlockEntity)) {
if (targetState == null) if (targetState == null) {
targetState = state;
targetState = state.isAir() ? Blocks.STRUCTURE_VOID.defaultBlockState() : state;
}
state = Blocks.JIGSAW.defaultBlockState(); state = Blocks.JIGSAW.defaultBlockState();
level.setBlock(pos, state, BlocksHelper.SET_SILENT); level.setBlock(pos, state, BlocksHelper.SET_SILENT);
entity = level.getBlockEntity(pos); entity = level.getBlockEntity(pos);