mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-19 19:59:42 +00:00
Cleanup some null checks and remove deprecated methods in Item and Block (#3429)
This commit is contained in:
1 parent
2823447b6e
commit
2bd8b95a3b
31 files changed
+175
-174
No files matched your search
@@ -23,6 +23,8 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.vecmath.Matrix4f;
|
||||
import javax.vecmath.Quat4f;
|
||||
|
||||
@@ -253,7 +255,8 @@ public final class ModelDynBucket implements IModel, IModelCustomData, IRetextur
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBakedModel handleItemState(IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity)
|
||||
@Nonnull
|
||||
public IBakedModel handleItemState(@Nonnull IBakedModel originalModel, @Nonnull ItemStack stack, @Nullable World world, @Nullable EntityLivingBase entity)
|
||||
{
|
||||
FluidStack fluidStack = FluidUtil.getFluidContained(stack);
|
||||
|
||||
|
||||
@@ -26,6 +26,8 @@ import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.vecmath.Matrix4f;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
@@ -72,7 +74,8 @@ public final class MultiModel implements IModel
|
||||
private final ItemOverrideList overrides = new ItemOverrideList(Lists.<ItemOverride>newArrayList())
|
||||
{
|
||||
@Override
|
||||
public IBakedModel handleItemState(IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity)
|
||||
@Nonnull
|
||||
public IBakedModel handleItemState(@Nonnull IBakedModel originalModel, @Nonnull ItemStack stack, @Nullable World world, @Nullable EntityLivingBase entity)
|
||||
{
|
||||
if(originalModel != Baked.this)
|
||||
{
|
||||
|
||||
+6
-2
@@ -39,6 +39,9 @@ import net.minecraftforge.common.model.animation.IAnimationStateMachine;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public final class AnimationItemOverrideList extends ItemOverrideList
|
||||
{
|
||||
private final IModel model;
|
||||
@@ -60,14 +63,15 @@ public final class AnimationItemOverrideList extends ItemOverrideList
|
||||
this.bakedTextureGetter = bakedTextureGetter;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBakedModel handleItemState(IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity)
|
||||
public IBakedModel handleItemState(@Nonnull IBakedModel originalModel, @Nonnull ItemStack stack, @Nullable World world, @Nullable EntityLivingBase entity)
|
||||
{
|
||||
if(stack.hasCapability(net.minecraftforge.common.model.animation.CapabilityAnimation.ANIMATION_CAPABILITY, null))
|
||||
{
|
||||
// TODO: caching?
|
||||
IAnimationStateMachine asm = stack.getCapability(CapabilityAnimation.ANIMATION_CAPABILITY, null);
|
||||
if(world == null)
|
||||
if(world == null && entity != null)
|
||||
{
|
||||
world = entity.worldObj;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user