Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.

Commit

Permalink
fixed qodana problems
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRealEmissions committed Mar 27, 2024
1 parent ba10f78 commit 45d35a2
Show file tree
Hide file tree
Showing 14 changed files with 16 additions and 31 deletions.
2 changes: 0 additions & 2 deletions src/main/java/net/dumbcode/projectnublar/ProjectNublar.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
import net.dumbcode.projectnublar.config.ClientConfig;
import com.mojang.logging.LogUtils;
import net.dumbcode.projectnublar.config.ServerConfig;
import net.dumbcode.projectnublar.core.data.DataGenerator;
import net.dumbcode.projectnublar.core.registry.Registrar;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.ModLoadingContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.storage.loot.LootTable;
import net.minecraftforge.registries.RegistryObject;
import org.jetbrains.annotations.NotNull;
Expand All @@ -29,7 +28,6 @@
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.function.UnaryOperator;
import java.util.stream.Collectors;

import static net.dumbcode.projectnublar.ProjectNublar.MOD_ID;

Expand Down Expand Up @@ -87,6 +85,9 @@ public enum Blocks {

Blocks(Function<DumbBlockEntities.Entities, IDumbBlock> blockConstructor, @NotNull UnaryOperator<Metadata.Builder> metadata) {
this.metadata = metadata.apply(new Metadata.Builder()).build();
if (this.metadata.associatedEntity == null) {
throw new IllegalStateException("Associated entity is required when using this constructor. Call it with Metadata#associatedEntity method.");
}
this.blockConstructor = () -> blockConstructor.apply(this.metadata.associatedEntity);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ public SoundBlock() {
super(Properties.ofFullCopy(Blocks.GOLD_BLOCK));
}
@Override
public @NotNull InteractionResult use(@NotNull BlockState pState, @NotNull Level pLevel, BlockPos pPos, Player pPlayer, InteractionHand pHand, BlockHitResult pHit) {
@SuppressWarnings("deprecation")
public @NotNull InteractionResult use(@NotNull BlockState pState, @NotNull Level pLevel, @NotNull BlockPos pPos, @NotNull Player pPlayer, @NotNull InteractionHand pHand, @NotNull BlockHitResult pHit) {
pLevel.playSound(pPlayer, pPos, SoundEvents.NOTE_BLOCK_BASS.get(), SoundSource.BLOCKS, 1f, 1f);
return InteractionResult.SUCCESS;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
package net.dumbcode.projectnublar.core.blocks.entity;

import com.google.common.base.Function;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import software.bernie.geckolib.animatable.GeoBlockEntity;
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache;
import software.bernie.geckolib.renderer.GeoBlockRenderer;
import software.bernie.geckolib.util.GeckoLibUtil;

public abstract class DumbBlockEntity extends BlockEntity implements GeoBlockEntity {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.function.Supplier;

public abstract class DumbEntityBlock extends DumbBlock implements EntityBlock {
private final DumbBlockEntities.Entities entity;
protected DumbEntityBlock(DumbBlockEntities.Entities entity, Properties properties) {
Expand All @@ -19,6 +17,7 @@ protected DumbEntityBlock(DumbBlockEntities.Entities entity, Properties properti
}

@Override
@SuppressWarnings("deprecation")
public @NotNull RenderShape getRenderShape(@NotNull BlockState pState) {
return RenderShape.ENTITYBLOCK_ANIMATED;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import net.dumbcode.projectnublar.core.blocks.entity.DumbBlockEntities;
import net.dumbcode.projectnublar.core.blocks.entity.DumbBlockEntity;
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.state.BlockState;
import org.jetbrains.annotations.NotNull;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import java.util.Arrays;
import java.util.List;
import java.util.function.Supplier;
import java.util.stream.Collectors;

import static net.dumbcode.projectnublar.ProjectNublar.MOD_ID;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protected void addTags(HolderLookup.@NotNull Provider provider) {
for (Field field : fields) {
if (!field.getType().equals(TagKey.class)) continue;
try {
TagKey<Item> tagKey = (TagKey<Item>) field.get(null);
@SuppressWarnings("unchecked") TagKey<Item> tagKey = (TagKey<Item>) field.get(null);
if (tagKey == null) continue;
Item[] itemsArray = Arrays.stream(DumbItems.Items.values())
.filter(x -> x.getMetadata().tags().itemTags().contains(tagKey))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -831,9 +831,9 @@ public Builder smeltingResultFromBase(ItemLike requires) {
/**
* Creates a recipe for a 9-block storage block
* @param packed Is the result packed or unpacked? If it's somehow both two recipes will be created: one for packed, one for unpacked
* @param category
* @param item
* @param group
* @param category The category of the recipe
* @param item The item to be used in the recipe
* @param group The group of the recipe
* @return An iterable of two recipes if the packed state is undefined, otherwise a single recipe (already built)
*/
public Iterable<Builder> nineBlockStorage(@NotNull QuantumBoolean packed, RecipeCategory category, ItemLike item, String group) {
Expand Down Expand Up @@ -991,6 +991,7 @@ protected void buildRecipes(@NotNull RecipeOutput recipeOutput) {
}
}

@SuppressWarnings("deprecation")
public static @NotNull Criterion<EnterBlockTrigger.TriggerInstance> insideOf(@NotNull Block block) {
return CriteriaTriggers.ENTER_BLOCK.createCriterion(new EnterBlockTrigger.TriggerInstance(Optional.empty(), Optional.of(block.builtInRegistryHolder()), Optional.empty()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import net.dumbcode.projectnublar.core.blocks.DumbBlocks;
import net.minecraft.data.loot.BlockLootSubProvider;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.StringRepresentable;
import net.minecraft.world.flag.FeatureFlags;
import net.minecraft.world.item.Item;
Expand All @@ -13,14 +12,10 @@
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition;
import net.minecraft.world.level.storage.loot.providers.number.NumberProvider;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.Arrays;
import java.util.Set;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;

public class ModBlockLootTables extends BlockLootSubProvider {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public FuelProperties burnTime(int burnTime) {
}

@Override
public @NotNull FuelProperties food(FoodProperties food) {
public @NotNull FuelProperties food(@NotNull FoodProperties food) {
return (FuelProperties) super.food(food);
}

Expand All @@ -43,12 +43,12 @@ public FuelProperties burnTime(int burnTime) {
}

@Override
public @NotNull FuelProperties craftRemainder(Item craftingRemainingItem) {
public @NotNull FuelProperties craftRemainder(@NotNull Item craftingRemainingItem) {
return (FuelProperties) super.craftRemainder(craftingRemainingItem);
}

@Override
public @NotNull FuelProperties rarity(Rarity rarity) {
public @NotNull FuelProperties rarity(@NotNull Rarity rarity) {
return (FuelProperties) super.rarity(rarity);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
package net.dumbcode.projectnublar.core.items;

import net.dumbcode.projectnublar.core.blocks.DumbBlocks;
import net.dumbcode.projectnublar.core.data.ModRecipeProvider;
import net.dumbcode.projectnublar.core.items.elements.AcornItem;
import net.dumbcode.projectnublar.core.items.elements.OreDetectorItem;
import net.dumbcode.projectnublar.core.items.elements.StrawberryItem;
import net.dumbcode.projectnublar.core.items.elements.TestItem;
import net.dumbcode.projectnublar.core.registry.Registrar;
import net.dumbcode.projectnublar.core.tags.DumbTags;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Item;
Expand All @@ -22,7 +20,6 @@
import java.util.List;
import java.util.function.Supplier;
import java.util.function.UnaryOperator;
import java.util.stream.Collectors;

import static net.dumbcode.projectnublar.ProjectNublar.MOD_ID;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.food.FoodProperties;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.Rarity;
import org.jetbrains.annotations.NotNull;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import net.minecraft.world.entity.*;
import net.minecraft.world.entity.animal.Animal;
import net.minecraft.world.level.Level;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import software.bernie.geckolib.animatable.GeoEntity;
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache;
Expand All @@ -20,9 +21,8 @@ public DinosaurMob(EntityType<? extends Animal> pEntityType, Level pLevel) {
super(pEntityType, pLevel);
}

@Nullable
@Override
public AgeableMob getBreedOffspring(ServerLevel serverLevel, AgeableMob ageableMob) {
public @Nullable AgeableMob getBreedOffspring(@NotNull ServerLevel serverLevel, @NotNull AgeableMob ageableMob) {
return ageableMob;
}

Expand Down

0 comments on commit 45d35a2

Please sign in to comment.