Skip to content

Commit

Permalink
Porting to le 1.20 - 1073 errors remaining
Browse files Browse the repository at this point in the history
  • Loading branch information
IThundxr committed Nov 18, 2023
1 parent ccf43a0 commit abc84da
Show file tree
Hide file tree
Showing 250 changed files with 1,400 additions and 1,358 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.violetmoon.quark.addons.oddities.block;

import javax.annotation.Nonnull;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nullable;

import net.minecraft.core.BlockPos;
Expand Down Expand Up @@ -43,12 +43,12 @@ public CrateBlock(ZetaModule module) {
}

@Override
public boolean hasAnalogOutputSignal(@Nonnull BlockState state) {
public boolean hasAnalogOutputSignal(@NotNull BlockState state) {
return true;
}

@Override
public int getAnalogOutputSignal(@Nonnull BlockState state, @Nonnull Level world, @Nonnull BlockPos pos) {
public int getAnalogOutputSignal(@NotNull BlockState state, @NotNull Level world, @NotNull BlockPos pos) {
BlockEntity be = world.getBlockEntity(pos);
if(be instanceof CrateBlockEntity crate) {
var crateHandler = crate.itemHandler();
Expand All @@ -59,15 +59,15 @@ public int getAnalogOutputSignal(@Nonnull BlockState state, @Nonnull Level world

@Nullable
@Override
public MenuProvider getMenuProvider(@Nonnull BlockState state, Level level, @Nonnull BlockPos pos) {
public MenuProvider getMenuProvider(@NotNull BlockState state, Level level, @NotNull BlockPos pos) {
BlockEntity be = level.getBlockEntity(pos);
return be instanceof MenuProvider provider ? provider : null;
}


@Nonnull
@NotNull
@Override
public InteractionResult use(@Nonnull BlockState state, Level worldIn, @Nonnull BlockPos pos, @Nonnull Player player, @Nonnull InteractionHand handIn, @Nonnull BlockHitResult hit) {
public InteractionResult use(@NotNull BlockState state, Level worldIn, @NotNull BlockPos pos, @NotNull Player player, @NotNull InteractionHand handIn, @NotNull BlockHitResult hit) {
if(worldIn.isClientSide) {
return InteractionResult.SUCCESS;
} else {
Expand All @@ -84,7 +84,7 @@ public InteractionResult use(@Nonnull BlockState state, Level worldIn, @Nonnull
}

@Override
public void setPlacedBy(@Nonnull Level worldIn, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nullable LivingEntity placer, ItemStack stack) {
public void setPlacedBy(@NotNull Level worldIn, @NotNull BlockPos pos, @NotNull BlockState state, @Nullable LivingEntity placer, ItemStack stack) {
if(stack.hasCustomHoverName()) {
BlockEntity tileentity = worldIn.getBlockEntity(pos);
if(tileentity instanceof CrateBlockEntity crate)
Expand All @@ -93,14 +93,14 @@ public void setPlacedBy(@Nonnull Level worldIn, @Nonnull BlockPos pos, @Nonnull
}

@Override
public void tick(@Nonnull BlockState state, ServerLevel worldIn, @Nonnull BlockPos pos, @Nonnull RandomSource rand) {
public void tick(@NotNull BlockState state, ServerLevel worldIn, @NotNull BlockPos pos, @NotNull RandomSource rand) {
BlockEntity tileentity = worldIn.getBlockEntity(pos);
if(tileentity instanceof CrateBlockEntity)
((CrateBlockEntity)tileentity).crateTick();
}

@Override
public void onRemove(BlockState state, @Nonnull Level worldIn, @Nonnull BlockPos pos, BlockState newState, boolean isMoving) {
public void onRemove(BlockState state, @NotNull Level worldIn, @NotNull BlockPos pos, BlockState newState, boolean isMoving) {
if(!state.is(newState.getBlock())) {
BlockEntity tileentity = worldIn.getBlockEntity(pos);

Expand All @@ -118,12 +118,12 @@ protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockSt
}

@Override
public BlockEntity newBlockEntity(@Nonnull BlockPos pos, @Nonnull BlockState state) {
public BlockEntity newBlockEntity(@NotNull BlockPos pos, @NotNull BlockState state) {
return new CrateBlockEntity(pos, state);
}

@Override
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(@Nonnull Level world, @Nonnull BlockState state, @Nonnull BlockEntityType<T> type) {
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(@NotNull Level world, @NotNull BlockState state, @NotNull BlockEntityType<T> type) {
return createTickerHelper(type, CrateModule.blockEntityType, CrateBlockEntity::tick);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import java.util.List;

import javax.annotation.Nonnull;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nullable;

import net.minecraft.core.BlockPos;
Expand Down Expand Up @@ -47,7 +47,7 @@ public MagnetBlock(ZetaModule module) {
}

@Override
public void appendHoverText(@Nonnull ItemStack stack, @Nullable BlockGetter worldIn, @Nonnull List<Component> tooltip, @Nonnull TooltipFlag flagIn) {
public void appendHoverText(@NotNull ItemStack stack, @Nullable BlockGetter worldIn, @NotNull List<Component> tooltip, @NotNull TooltipFlag flagIn) {
if (stack.getHoverName().getString().equals("Q"))
tooltip.add(Component.literal("haha yes"));
}
Expand All @@ -58,7 +58,7 @@ protected void createBlockStateDefinition(Builder<Block, BlockState> builder) {
}

@Override
public void neighborChanged(@Nonnull BlockState state, @Nonnull Level worldIn, @Nonnull BlockPos pos, @Nonnull Block blockIn, @Nonnull BlockPos fromPos, boolean isMoving) {
public void neighborChanged(@NotNull BlockState state, @NotNull Level worldIn, @NotNull BlockPos pos, @NotNull Block blockIn, @NotNull BlockPos fromPos, boolean isMoving) {
super.neighborChanged(state, worldIn, pos, blockIn, fromPos, isMoving);

boolean wasPowered = state.getValue(POWERED);
Expand Down Expand Up @@ -125,25 +125,25 @@ public BlockState getStateForPlacement(BlockPlaceContext context) {
.setValue(POWERED, isPowered(context.getLevel(), context.getClickedPos(), facing));
}

@Nonnull
@NotNull
@Override
public BlockState rotate(@Nonnull BlockState state, Rotation rot) {
public BlockState rotate(@NotNull BlockState state, Rotation rot) {
return state.setValue(FACING, rot.rotate(state.getValue(FACING)));
}

@Nonnull
@NotNull
@Override
public BlockState mirror(@Nonnull BlockState state, Mirror mirrorIn) {
public BlockState mirror(@NotNull BlockState state, Mirror mirrorIn) {
return state.rotate(mirrorIn.getRotation(state.getValue(FACING)));
}

@Override
public BlockEntity newBlockEntity(@Nonnull BlockPos pos, @Nonnull BlockState state) {
public BlockEntity newBlockEntity(@NotNull BlockPos pos, @NotNull BlockState state) {
return new MagnetBlockEntity(pos, state);
}

@Override
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(@Nonnull Level world, @Nonnull BlockState state, @Nonnull BlockEntityType<T> type) {
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(@NotNull Level world, @NotNull BlockState state, @NotNull BlockEntityType<T> type) {
return createTickerHelper(type, MagnetsModule.magnetType, MagnetBlockEntity::tick);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import java.util.function.BooleanSupplier;

import javax.annotation.Nonnull;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nullable;

import com.mojang.math.Vector3f;
Expand Down Expand Up @@ -50,14 +50,14 @@ public MatrixEnchantingTableBlock(ZetaModule module) {
module.zeta.registry.registerBlock(this, "matrix_enchanter", true);
}

@Nonnull
@NotNull
@Override
public MutableComponent getName() {
return Blocks.ENCHANTING_TABLE.getName();
}

@Override
public void fillItemCategory(@Nonnull CreativeModeTab group, @Nonnull NonNullList<ItemStack> items) {
public void fillItemCategory(@NotNull CreativeModeTab group, @NotNull NonNullList<ItemStack> items) {
if(isEnabled() || group == CreativeModeTab.TAB_SEARCH)
super.fillItemCategory(group, items);
}
Expand All @@ -80,18 +80,18 @@ public ZetaModule getModule() {
}

@Override
public BlockEntity newBlockEntity(@Nonnull BlockPos pos, @Nonnull BlockState state) {
public BlockEntity newBlockEntity(@NotNull BlockPos pos, @NotNull BlockState state) {
return new MatrixEnchantingTableBlockEntity(pos, state);
}

@Override
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(@Nonnull Level world, @Nonnull BlockState state, @Nonnull BlockEntityType<T> type) {
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(@NotNull Level world, @NotNull BlockState state, @NotNull BlockEntityType<T> type) {
return createTickerHelper(type, MatrixEnchantingModule.blockEntityType, MatrixEnchantingTableBlockEntity::tick);
}

@Nonnull
@NotNull
@Override
public InteractionResult use(@Nonnull BlockState state, Level worldIn, @Nonnull BlockPos pos, @Nonnull Player player, @Nonnull InteractionHand handIn, @Nonnull BlockHitResult raytrace) {
public InteractionResult use(@NotNull BlockState state, Level worldIn, @NotNull BlockPos pos, @NotNull Player player, @NotNull InteractionHand handIn, @NotNull BlockHitResult raytrace) {
if(!(worldIn.getBlockEntity(pos) instanceof MatrixEnchantingTableBlockEntity))
worldIn.setBlockEntity(newBlockEntity(pos, state));

Expand All @@ -105,7 +105,7 @@ public InteractionResult use(@Nonnull BlockState state, Level worldIn, @Nonnull
}

@Override
public void animateTick(@Nonnull BlockState stateIn, @Nonnull Level worldIn, @Nonnull BlockPos pos, @Nonnull RandomSource rand) {
public void animateTick(@NotNull BlockState stateIn, @NotNull Level worldIn, @NotNull BlockPos pos, @NotNull RandomSource rand) {
boolean enabled = Quark.ZETA.modules.isEnabled(MatrixEnchantingModule.class);
boolean showInfluences = enabled && MatrixEnchantingModule.allowInfluencing;
boolean allowUnderwater = enabled && MatrixEnchantingModule.allowUnderwaterEnchanting;
Expand Down Expand Up @@ -167,7 +167,7 @@ public void animateTick(@Nonnull BlockState stateIn, @Nonnull Level worldIn, @No
}

@Override
public void setPlacedBy(@Nonnull Level worldIn, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull LivingEntity placer, @Nonnull ItemStack stack) {
public void setPlacedBy(@NotNull Level worldIn, @NotNull BlockPos pos, @NotNull BlockState state, @NotNull LivingEntity placer, @NotNull ItemStack stack) {
super.setPlacedBy(worldIn, pos, state, placer, stack);

if(stack.hasCustomHoverName()) {
Expand All @@ -179,7 +179,7 @@ public void setPlacedBy(@Nonnull Level worldIn, @Nonnull BlockPos pos, @Nonnull
}

@Override
public void onRemove(@Nonnull BlockState state, Level worldIn, @Nonnull BlockPos pos, @Nonnull BlockState newState, boolean isMoving) {
public void onRemove(@NotNull BlockState state, Level worldIn, @NotNull BlockPos pos, @NotNull BlockState newState, boolean isMoving) {
BlockEntity tileentity = worldIn.getBlockEntity(pos);

if(tileentity instanceof MatrixEnchantingTableBlockEntity enchanter) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import java.util.Collections;
import java.util.List;

import javax.annotation.Nonnull;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nullable;

import net.minecraft.core.BlockPos;
Expand Down Expand Up @@ -52,14 +52,14 @@ public MovingMagnetizedBlock(ZetaModule module) {
this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH));
}

@Nonnull
@NotNull
@Override
public RenderShape getRenderShape(@Nonnull BlockState state) {
public RenderShape getRenderShape(@NotNull BlockState state) {
return RenderShape.INVISIBLE;
}

@Override
public void onRemove(BlockState state, @Nonnull Level worldIn, @Nonnull BlockPos pos, @Nonnull BlockState newState, boolean isMoving) {
public void onRemove(BlockState state, @NotNull Level worldIn, @NotNull BlockPos pos, @NotNull BlockState newState, boolean isMoving) {
if (state.getBlock() != newState.getBlock()) {
MagnetizedBlockBlockEntity tile = getMagnetTileEntity(worldIn, pos);
if (tile != null)
Expand All @@ -68,13 +68,13 @@ public void onRemove(BlockState state, @Nonnull Level worldIn, @Nonnull BlockPos
}

@Override
public boolean useShapeForLightOcclusion(@Nonnull BlockState state) {
public boolean useShapeForLightOcclusion(@NotNull BlockState state) {
return true;
}

@Nonnull
@NotNull
@Override
public InteractionResult use(@Nonnull BlockState state, Level worldIn, @Nonnull BlockPos pos, @Nonnull Player player, @Nonnull InteractionHand handIn, @Nonnull BlockHitResult hit) {
public InteractionResult use(@NotNull BlockState state, Level worldIn, @NotNull BlockPos pos, @NotNull Player player, @NotNull InteractionHand handIn, @NotNull BlockHitResult hit) {
if (!worldIn.isClientSide && worldIn.getBlockEntity(pos) == null) {
worldIn.removeBlock(pos, false);
return InteractionResult.SUCCESS;
Expand All @@ -83,21 +83,21 @@ public InteractionResult use(@Nonnull BlockState state, Level worldIn, @Nonnull
}

@Override
@Nonnull
public List<ItemStack> getDrops(@Nonnull BlockState state, @Nonnull LootContext.Builder builder) {
@NotNull
public List<ItemStack> getDrops(@NotNull BlockState state, @NotNull LootContext.Builder builder) {
MagnetizedBlockBlockEntity tile = this.getMagnetTileEntity(builder.getLevel(), builder.getParameter(LootContextParams.ORIGIN)); // origin
return tile == null ? Collections.emptyList() : tile.getMagnetState().getDrops(builder);
}

@Override
@Nonnull
public VoxelShape getShape(@Nonnull BlockState state, @Nonnull BlockGetter worldIn, @Nonnull BlockPos pos, @Nonnull CollisionContext context) {
@NotNull
public VoxelShape getShape(@NotNull BlockState state, @NotNull BlockGetter worldIn, @NotNull BlockPos pos, @NotNull CollisionContext context) {
return Shapes.empty();
}

@Override
@Nonnull
public VoxelShape getCollisionShape(@Nonnull BlockState state, @Nonnull BlockGetter worldIn, @Nonnull BlockPos pos, @Nonnull CollisionContext context) {
@NotNull
public VoxelShape getCollisionShape(@NotNull BlockState state, @NotNull BlockGetter worldIn, @NotNull BlockPos pos, @NotNull CollisionContext context) {
MagnetizedBlockBlockEntity tile = this.getMagnetTileEntity(worldIn, pos);
return tile != null ? tile.getCollisionShape(worldIn, pos) : Shapes.empty();
}
Expand All @@ -115,20 +115,20 @@ private MagnetizedBlockBlockEntity getMagnetTileEntity(BlockGetter world, BlockP
}

@Override
@Nonnull
public ItemStack getCloneItemStack(@Nonnull BlockGetter worldIn, @Nonnull BlockPos pos, @Nonnull BlockState state) {
@NotNull
public ItemStack getCloneItemStack(@NotNull BlockGetter worldIn, @NotNull BlockPos pos, @NotNull BlockState state) {
return ItemStack.EMPTY;
}

@Override
@Nonnull
public BlockState rotate(@Nonnull BlockState state, Rotation rot) {
@NotNull
public BlockState rotate(@NotNull BlockState state, Rotation rot) {
return state.setValue(FACING, rot.rotate(state.getValue(FACING)));
}

@Override
@Nonnull
public BlockState mirror(@Nonnull BlockState state, Mirror mirrorIn) {
@NotNull
public BlockState mirror(@NotNull BlockState state, Mirror mirrorIn) {
return rotate(state, mirrorIn.getRotation(state.getValue(FACING)));
}

Expand All @@ -138,17 +138,17 @@ protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockSt
}

@Override
public boolean isPathfindable(@Nonnull BlockState state, @Nonnull BlockGetter worldIn, @Nonnull BlockPos pos, @Nonnull PathComputationType type) {
public boolean isPathfindable(@NotNull BlockState state, @NotNull BlockGetter worldIn, @NotNull BlockPos pos, @NotNull PathComputationType type) {
return false;
}

@Override
public BlockEntity newBlockEntity(@Nonnull BlockPos pos, @Nonnull BlockState state) {
public BlockEntity newBlockEntity(@NotNull BlockPos pos, @NotNull BlockState state) {
return null;
}

@Override
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(@Nonnull Level world, @Nonnull BlockState state, @Nonnull BlockEntityType<T> type) {
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(@NotNull Level world, @NotNull BlockState state, @NotNull BlockEntityType<T> type) {
return createTickerHelper(type, MagnetsModule.magnetizedBlockType, MagnetizedBlockBlockEntity::tick);
}

Expand Down
Loading

0 comments on commit abc84da

Please sign in to comment.