adding some @NotNull's to overrides
This commit is contained in:
parent
db9309d9d8
commit
bf562f23e0
@ -63,7 +63,7 @@ public class ClusterTNTBlock extends TntBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wasExploded(Level level, BlockPos blockPos, Explosion pExplosion) {
|
||||
public void wasExploded(Level level, @NotNull BlockPos blockPos, @NotNull Explosion pExplosion) {
|
||||
if (!level.isClientSide) {
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
int ft = (short) (level.random.nextInt(fuseTime / 4) + fuseTime / 8);
|
||||
|
@ -48,7 +48,7 @@ public class blackHoleTNTBlock extends TntBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wasExploded(Level level, BlockPos blockPos, Explosion pExplosion) {
|
||||
public void wasExploded(Level level, @NotNull BlockPos blockPos, @NotNull Explosion pExplosion) {
|
||||
if (!level.isClientSide) {
|
||||
blackHolePrimedTNT primedtnt = new blackHolePrimedTNT(level, (double) blockPos.getX() + (double) 0.5F, (double) blockPos.getY(), (double) blockPos.getZ() + (double) 0.5F, pExplosion.getIndirectSourceEntity(), pRadius, fuseTime, speed);
|
||||
int i = primedtnt.getFuse();
|
||||
|
@ -32,7 +32,7 @@ public class blocks {
|
||||
public static final RegistryObject<Item> TNT_128_ITEM = ITEMS.register("tnt_128", () -> new BlockItem(TNT_128.get(), new Item.Properties()));
|
||||
|
||||
public static final RegistryObject<Block> TNT_CLUSTER_2 = BLOCKS.register("tnt_cluster_2", () -> new ClusterTNTBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED), 4.0f, 80, 2, 10));
|
||||
public static final RegistryObject<Item> TNT_CLUSTER__2ITEM = ITEMS.register("tnt_cluster_2", () -> new BlockItem(TNT_CLUSTER_2.get(), new Item.Properties()));
|
||||
public static final RegistryObject<Item> TNT_CLUSTER_2_ITEM = ITEMS.register("tnt_cluster_2", () -> new BlockItem(TNT_CLUSTER_2.get(), new Item.Properties()));
|
||||
|
||||
public static final RegistryObject<Block> TNT_CLUSTER_4 = BLOCKS.register("tnt_cluster_4", () -> new ClusterTNTBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED), 4.0f, 80, 4, 10));
|
||||
public static final RegistryObject<Item> TNT_CLUSTER_4_ITEM = ITEMS.register("tnt_cluster_4", () -> new BlockItem(TNT_CLUSTER_4.get(), new Item.Properties()));
|
||||
|
@ -49,7 +49,7 @@ public class homingTNTBlock extends TntBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wasExploded(Level level, BlockPos blockPos, Explosion pExplosion) {
|
||||
public void wasExploded(Level level, @NotNull BlockPos blockPos, @NotNull Explosion pExplosion) {
|
||||
if (!level.isClientSide) {
|
||||
homingPrimedTNT primedtnt = new homingPrimedTNT(level, (double) blockPos.getX() + (double) 0.5F, (double) blockPos.getY(), (double) blockPos.getZ() + (double) 0.5F, pExplosion.getIndirectSourceEntity(), pRadius, fuseTime, speed);
|
||||
int i = primedtnt.getFuse();
|
||||
|
@ -13,6 +13,7 @@ import net.minecraft.world.level.block.TntBlock;
|
||||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@ -27,7 +28,7 @@ public class strongerTNTBlock extends TntBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCaughtFire(BlockState state, Level world, BlockPos pos, @Nullable Direction face, @Nullable LivingEntity igniter) {
|
||||
public void onCaughtFire(@NotNull BlockState state, @NotNull Level world, @NotNull BlockPos pos, @Nullable Direction face, @Nullable LivingEntity igniter) {
|
||||
explode(world, pos, igniter, this.pRadius, this.fuseTime);
|
||||
}
|
||||
|
||||
@ -48,7 +49,7 @@ public class strongerTNTBlock extends TntBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wasExploded(Level level, BlockPos blockPos, Explosion pExplosion) {
|
||||
public void wasExploded(Level level, @NotNull BlockPos blockPos, @NotNull Explosion pExplosion) {
|
||||
if (!level.isClientSide) {
|
||||
int ft = (short) (level.random.nextInt(fuseTime / 4) + fuseTime / 8);
|
||||
StrongerPrimedTNT primedtnt = new StrongerPrimedTNT(level, (double) blockPos.getX() + (double) 0.5F, (double) blockPos.getY(), (double) blockPos.getZ() + (double) 0.5F, pExplosion.getIndirectSourceEntity(), pRadius, ft);
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.jenny.compressedtnt.datagen;
|
||||
|
||||
import com.jenny.compressedtnt.Compressedtnt;
|
||||
import com.jenny.compressedtnt.blocks.blocks;
|
||||
|
||||
import net.minecraft.data.PackOutput;
|
||||
@ -12,6 +11,7 @@ import net.minecraftforge.common.data.ExistingFileHelper;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
import net.minecraftforge.client.model.generators.ModelFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import static com.jenny.compressedtnt.Compressedtnt.MODID;
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.jenny.compressedtnt.entities;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.syncher.EntityDataAccessor;
|
||||
@ -94,7 +93,7 @@ public abstract class basePrimedTNT extends Entity implements TraceableEntity {
|
||||
return !this.isRemoved();
|
||||
}
|
||||
|
||||
protected Entity.MovementEmission getMovementEmission() {
|
||||
protected Entity.@NotNull MovementEmission getMovementEmission() {
|
||||
return Entity.MovementEmission.NONE;
|
||||
}
|
||||
|
||||
@ -121,7 +120,7 @@ public abstract class basePrimedTNT extends Entity implements TraceableEntity {
|
||||
return this.owner;
|
||||
}
|
||||
|
||||
public void setOwner(LivingEntity owner) {
|
||||
public void setOwner(@Nullable LivingEntity owner) {
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,6 @@ import net.minecraft.client.renderer.entity.EntityRendererProvider;
|
||||
import net.minecraft.client.renderer.entity.TntMinecartRenderer;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlas;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.projectile.Arrow;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
@ -5,9 +5,7 @@ import com.jenny.compressedtnt.entities.client.TNTArrowRenderer;
|
||||
import com.jenny.compressedtnt.entities.client.clusterTNTRenderer;
|
||||
import com.jenny.compressedtnt.items.arrows.entity.*;
|
||||
|
||||
import net.minecraft.client.renderer.entity.ArrowRenderer;
|
||||
import net.minecraft.client.renderer.entity.EntityRenderers;
|
||||
import net.minecraft.client.renderer.entity.TippableArrowRenderer;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.MobCategory;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
|
@ -13,12 +13,14 @@ import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.projectile.AbstractArrow;
|
||||
import net.minecraft.world.entity.projectile.Arrow;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.item.alchemy.Potion;
|
||||
import net.minecraft.world.item.alchemy.PotionUtils;
|
||||
import net.minecraft.world.item.alchemy.Potions;
|
||||
import net.minecraft.world.level.Level;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
@ -26,7 +28,7 @@ import java.util.Set;
|
||||
public class EntityArrowBase extends AbstractArrow {
|
||||
private static final int EXPOSED_POTION_DECAY_TIME = 600;
|
||||
private static final int NO_EFFECT_COLOR = -1;
|
||||
private static final EntityDataAccessor<Integer> ID_EFFECT_COLOR = SynchedEntityData.defineId(EntityArrowBase.class, EntityDataSerializers.INT);
|
||||
private static final EntityDataAccessor<Integer> ID_EFFECT_COLOR = SynchedEntityData.defineId(Arrow.class, EntityDataSerializers.INT);
|
||||
private static final byte EVENT_POTION_PUFF = 0;
|
||||
private Potion potion = Potions.EMPTY;
|
||||
private final Set<MobEffectInstance> effects = Sets.newHashSet();
|
||||
@ -135,7 +137,7 @@ public class EntityArrowBase extends AbstractArrow {
|
||||
this.entityData.set(ID_EFFECT_COLOR, pFixedColor);
|
||||
}
|
||||
|
||||
public void addAdditionalSaveData(CompoundTag pCompound) {
|
||||
public void addAdditionalSaveData(@NotNull CompoundTag pCompound) {
|
||||
super.addAdditionalSaveData(pCompound);
|
||||
if (this.potion != Potions.EMPTY) {
|
||||
pCompound.putString("Potion", BuiltInRegistries.POTION.getKey(this.potion).toString());
|
||||
@ -157,7 +159,7 @@ public class EntityArrowBase extends AbstractArrow {
|
||||
|
||||
}
|
||||
|
||||
public void readAdditionalSaveData(CompoundTag pCompound) {
|
||||
public void readAdditionalSaveData(@NotNull CompoundTag pCompound) {
|
||||
super.readAdditionalSaveData(pCompound);
|
||||
if (pCompound.contains("Potion", 8)) {
|
||||
this.potion = PotionUtils.getPotion(pCompound);
|
||||
@ -175,7 +177,7 @@ public class EntityArrowBase extends AbstractArrow {
|
||||
|
||||
}
|
||||
|
||||
protected void doPostHurtEffects(LivingEntity pLiving) {
|
||||
protected void doPostHurtEffects(@NotNull LivingEntity pLiving) {
|
||||
super.doPostHurtEffects(pLiving);
|
||||
Entity entity = this.getEffectSource();
|
||||
|
||||
@ -193,6 +195,7 @@ public class EntityArrowBase extends AbstractArrow {
|
||||
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected ItemStack getPickupItem() {
|
||||
if (this.effects.isEmpty() && this.potion == Potions.EMPTY) {
|
||||
return new ItemStack(Items.ARROW);
|
||||
|
@ -28,7 +28,7 @@ public class EntityArrowTNT extends EntityArrowBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doPostHurtEffects(LivingEntity pTarget) {
|
||||
protected void doPostHurtEffects(@NotNull LivingEntity pTarget) {
|
||||
this.level().explode(this, this.getX(), this.getY(), this.getZ(), 2, Level.ExplosionInteraction.TNT);
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,6 @@ package com.jenny.compressedtnt.items.arrows.item;
|
||||
import com.jenny.compressedtnt.items.arrows.entity.EntityArrowTNT;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.projectile.AbstractArrow;
|
||||
import net.minecraft.world.entity.projectile.Arrow;
|
||||
import net.minecraft.world.item.ArrowItem;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
@ -17,7 +16,7 @@ public class ArrowTNT extends ArrowItem {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public AbstractArrow createArrow(Level pLevel, ItemStack pStack, LivingEntity pShooter) {
|
||||
public AbstractArrow createArrow(@NotNull Level pLevel, @NotNull ItemStack pStack, @NotNull LivingEntity pShooter) {
|
||||
return new EntityArrowTNT(pLevel, pShooter);
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package com.jenny.compressedtnt.items;
|
||||
|
||||
import com.jenny.compressedtnt.items.arrows.item.*;
|
||||
|
||||
import net.minecraft.world.item.ArrowItem;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
|
Loading…
x
Reference in New Issue
Block a user