mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-17 19:15:32 +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
@@ -19,6 +19,6 @@ public class BreedingTest
|
||||
|
||||
@SubscribeEvent
|
||||
public void onBabyBorn(BabyEntitySpawnEvent event) {
|
||||
event.setChild(new EntityCow(event.getChild().worldObj));
|
||||
event.setChild(new EntityCow(event.getParentA().worldObj));
|
||||
}
|
||||
}
|
||||
@@ -263,8 +263,11 @@ public class DynBucketTest
|
||||
{
|
||||
ItemStack heldItem = playerIn.getHeldItem(hand);
|
||||
IFluidHandler tank = FluidUtil.getFluidHandler(worldIn, pos, side.getOpposite());
|
||||
if (tank == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (null == null)
|
||||
if (heldItem.func_190926_b())
|
||||
{
|
||||
sendText(playerIn, tank);
|
||||
return false;
|
||||
|
||||
@@ -20,6 +20,7 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@Mod(modid = ItemLayerModelDebug.MODID, name = "ForgeDebugItemLayerModel", version = ItemLayerModelDebug.VERSION, acceptableRemoteVersions = "*")
|
||||
@@ -95,7 +96,7 @@ public class ItemLayerModelDebug
|
||||
@Override
|
||||
public int getHarvestLevel(ItemStack stack, String toolClass, @Nullable EntityPlayer player, @Nullable IBlockState blockState) {
|
||||
// This tool is a super pickaxe if the player is wearing a helment
|
||||
if("pickaxe".equals(toolClass) && player != null && player.getItemStackFromSlot(EntityEquipmentSlot.HEAD) != null) {
|
||||
if("pickaxe".equals(toolClass) && player != null && !player.getItemStackFromSlot(EntityEquipmentSlot.HEAD).func_190926_b()) {
|
||||
return 5;
|
||||
}
|
||||
return super.getHarvestLevel(stack, toolClass, player, blockState);
|
||||
|
||||
@@ -158,7 +158,7 @@ public class ModelAnimationDebug
|
||||
GameRegistry.register(new ItemBlock(Block.REGISTRY.getObject(blockId))
|
||||
{
|
||||
@Override
|
||||
public ICapabilityProvider initCapabilities(ItemStack stack, NBTTagCompound nbt)
|
||||
public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable NBTTagCompound nbt)
|
||||
{
|
||||
return new ItemAnimationHolder();
|
||||
}
|
||||
@@ -166,11 +166,13 @@ public class ModelAnimationDebug
|
||||
GameRegistry.registerTileEntity(Chest.class, MODID + ":" + "tile_" + blockName);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public abstract IAnimationStateMachine load(ResourceLocation location, ImmutableMap<String, ITimeValue> parameters);
|
||||
}
|
||||
|
||||
public static class ServerProxy extends CommonProxy
|
||||
{
|
||||
@Nullable
|
||||
public IAnimationStateMachine load(ResourceLocation location, ImmutableMap<String, ITimeValue> parameters)
|
||||
{
|
||||
return null;
|
||||
@@ -267,6 +269,7 @@ public class ModelAnimationDebug
|
||||
|
||||
public static class Chest extends TileEntity
|
||||
{
|
||||
@Nullable
|
||||
private final IAnimationStateMachine asm;
|
||||
private final VariableValue cycleLength = new VariableValue(4);
|
||||
private final VariableValue clickTime = new VariableValue(Float.NEGATIVE_INFINITY);
|
||||
|
||||
@@ -22,7 +22,6 @@ import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
@@ -49,6 +48,8 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.primitives.Ints;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@Mod(modid = ModelBakeEventDebug.MODID, name = "ForgeDebugModelBakeEvent", version = ModelBakeEventDebug.VERSION, acceptableRemoteVersions = "*")
|
||||
public class ModelBakeEventDebug
|
||||
{
|
||||
@@ -253,7 +254,7 @@ public class ModelBakeEventDebug
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(IBlockState state, EnumFacing side, long rand)
|
||||
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand)
|
||||
{
|
||||
if(side != null) return ImmutableList.of();
|
||||
IExtendedBlockState exState = (IExtendedBlockState)state;
|
||||
@@ -310,7 +311,7 @@ public class ModelBakeEventDebug
|
||||
case WEST: return new Vec3d(-vec.yCoord, vec.xCoord, vec.zCoord);
|
||||
case EAST: return new Vec3d( vec.yCoord, -vec.xCoord, vec.zCoord);
|
||||
}
|
||||
return null;
|
||||
throw new IllegalArgumentException("Unknown Side " + side);
|
||||
}
|
||||
|
||||
private static Vec3d revRotate(Vec3d vec, EnumFacing side)
|
||||
@@ -324,6 +325,6 @@ public class ModelBakeEventDebug
|
||||
case WEST: return new Vec3d( vec.yCoord, -vec.xCoord, vec.zCoord);
|
||||
case EAST: return new Vec3d(-vec.yCoord, vec.xCoord, vec.zCoord);
|
||||
}
|
||||
return null;
|
||||
throw new IllegalArgumentException("Unknown Side " + side);
|
||||
}
|
||||
}
|
||||
@@ -47,7 +47,7 @@ public class MultiLayerModelDebug
|
||||
public boolean isFullCube(IBlockState state) { return false; }
|
||||
|
||||
@Override
|
||||
public boolean canRenderInLayer(BlockRenderLayer layer)
|
||||
public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer)
|
||||
{
|
||||
return layer == BlockRenderLayer.SOLID || layer == BlockRenderLayer.TRANSLUCENT;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package net.minecraftforge.debug;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
Reference in new issue
Block a user