switch to new getDrops method

If this causes issues, its on other people's end to resolve it.  They
should stop overriding the old one.  But, this is basically asking for
trouble.
This commit is contained in:
Shadows_of_Fire 2017-09-17 02:47:04 -04:00
parent e8058e252a
commit 1fe930b395
11 changed files with 28 additions and 29 deletions

View file

@ -23,7 +23,7 @@ if(hasProperty('buildnumber')){
}
minecraft {
version = "1.12.1-14.22.0.2460"
version = "1.12.1-14.22.1.2481"
runDir = "run"
mappings = "snapshot_20170821"
replaceIn "ModUtil.java"

View file

@ -40,7 +40,8 @@ public class BlockWallAA extends BlockBase{
}
public BlockWallAA(String name, Block base, int meta){
@SuppressWarnings("deprecation")
public BlockWallAA(String name, Block base, int meta){
super(base.getDefaultState().getMaterial(), name);
this.meta = meta;
@ -95,6 +96,7 @@ public class BlockWallAA extends BlockBase{
@Override
@SideOnly(Side.CLIENT)
@Deprecated
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side){
return side != EnumFacing.DOWN || super.shouldSideBeRendered(blockState, blockAccess, pos, side);
}

View file

@ -15,7 +15,6 @@ import de.ellpeck.actuallyadditions.mod.data.PlayerData.PlayerSave;
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.LaserRelayConnectionHandler;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import io.netty.util.internal.ConcurrentSet;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.world.World;
@ -25,7 +24,6 @@ import net.minecraft.world.storage.WorldSavedData;
import net.minecraftforge.common.WorldSpecificSaveHandler;
import java.io.File;
import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

View file

@ -25,6 +25,7 @@ import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.NonNullList;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@ -103,8 +104,8 @@ public class DefaultFarmerBehavior implements IFarmerBehavior{
if(((BlockCrops)block).isMaxAge(state)){
List<ItemStack> seeds = new ArrayList<ItemStack>();
List<ItemStack> other = new ArrayList<ItemStack>();
List<ItemStack> drops = block.getDrops(world, pos, state, 0);
NonNullList<ItemStack> drops = NonNullList.create();
block.getDrops(drops, world, pos, state, 0);
for(ItemStack stack : drops){
if(this.getPlantableFromStack(stack) != null){
seeds.add(stack);

View file

@ -20,11 +20,10 @@ import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import java.util.List;
public class MelonPumpkinFarmerBehavior implements IFarmerBehavior{
@Override
@ -56,7 +55,8 @@ public class MelonPumpkinFarmerBehavior implements IFarmerBehavior{
IBlockState state = world.getBlockState(pos);
Block block = state.getBlock();
if(block == Blocks.PUMPKIN || block == Blocks.MELON_BLOCK){
List<ItemStack> drops = state.getBlock().getDrops(world, pos, state, 0);
NonNullList<ItemStack> drops = NonNullList.create();
block.getDrops(drops, world, pos, state, 0);
if(drops != null && !drops.isEmpty()){
if(farmer.addToOutputInventory(drops, false)){
world.playEvent(2001, pos, Block.getStateId(state));

View file

@ -19,11 +19,10 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import java.util.List;
public class ReedFarmerBehavior implements IFarmerBehavior{
@Override
@ -55,7 +54,8 @@ public class ReedFarmerBehavior implements IFarmerBehavior{
BlockPos up = pos.up(i);
IBlockState upState = world.getBlockState(up);
if(upState.getBlock() instanceof BlockReed){
List<ItemStack> drops = upState.getBlock().getDrops(world, up, upState, 0);
NonNullList<ItemStack> drops = NonNullList.create();
upState.getBlock().getDrops(drops, world, pos, state, 0);
if(drops != null && !drops.isEmpty()){
if(farmer.addToOutputInventory(drops, false)){

View file

@ -19,12 +19,11 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import java.util.List;
public abstract class ExUPlantFarmerBehavior implements IFarmerBehavior{
@Override
@ -73,8 +72,8 @@ public abstract class ExUPlantFarmerBehavior implements IFarmerBehavior{
if(reg != null && this.getPlantName().equals(reg.toString())){
if(block.getMetaFromState(state) >= this.getMaxStage()){
List<ItemStack> drops = block.getDrops(world, pos, state, 0);
NonNullList<ItemStack> drops = NonNullList.create();
block.getDrops(drops, world, pos, state, 0);
for(ItemStack stack : drops){
if(StackUtil.isValid(stack)){
ResourceLocation itemReg = stack.getItem().getRegistryName();

View file

@ -19,11 +19,10 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.fluids.IFluidBlock;
import java.util.List;
public class TileEntityBreaker extends TileEntityInventoryBase{
public boolean isPlacer;
@ -85,7 +84,8 @@ public class TileEntityBreaker extends TileEntityInventoryBase{
IBlockState stateToBreak = this.world.getBlockState(coordsBlock);
Block blockToBreak = stateToBreak.getBlock();
if(!this.isPlacer && blockToBreak != null && !this.world.isAirBlock(coordsBlock) && !(blockToBreak instanceof BlockLiquid) && !(blockToBreak instanceof IFluidBlock) && stateToBreak.getBlockHardness(this.world, coordsBlock) >= 0.0F){
List<ItemStack> drops = blockToBreak.getDrops(this.world, coordsBlock, stateToBreak, 0);
NonNullList<ItemStack> drops = NonNullList.create();
blockToBreak.getDrops(drops, world, pos, state, 0);
float chance = WorldUtil.fireFakeHarvestEventsForDropChance(drops, this.world, coordsBlock);
if(chance > 0 && this.world.rand.nextFloat() <= chance){

View file

@ -16,13 +16,12 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.energy.IEnergyStorage;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.List;
public class TileEntityDirectionalBreaker extends TileEntityInventoryBase{
public static final int RANGE = 8;
@ -84,7 +83,8 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase{
BlockPos coordsBlock = this.pos.offset(sideToManipulate, i+1);
Block blockToBreak = this.world.getBlockState(coordsBlock).getBlock();
if(blockToBreak != null && !this.world.isAirBlock(coordsBlock) && this.world.getBlockState(coordsBlock).getBlockHardness(this.world, coordsBlock) > -1.0F){
List<ItemStack> drops = blockToBreak.getDrops(this.world, coordsBlock, this.world.getBlockState(coordsBlock), 0);
NonNullList<ItemStack> drops = NonNullList.create();
blockToBreak.getDrops(drops, world, pos, state, 0);
float chance = WorldUtil.fireFakeHarvestEventsForDropChance(drops, this.world, coordsBlock);
if(chance > 0 && this.world.rand.nextFloat() <= chance){

View file

@ -23,13 +23,12 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.energy.IEnergyStorage;
import net.minecraftforge.fluids.IFluidBlock;
import net.minecraftforge.oredict.OreDictionary;
import java.util.List;
public class TileEntityMiner extends TileEntityInventoryBase implements IButtonReactor, IEnergyDisplay{
public static final int ENERGY_USE_PER_BLOCK = 650;
@ -124,7 +123,8 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IButtonR
int meta = block.getMetaFromState(state);
if(!block.isAir(this.world.getBlockState(pos), this.world, pos)){
if(block.getHarvestLevel(this.world.getBlockState(pos)) <= ItemDrill.HARVEST_LEVEL && state.getBlockHardness(this.world, pos) >= 0F && !(block instanceof BlockLiquid) && !(block instanceof IFluidBlock) && this.isMinable(block, meta)){
List<ItemStack> drops = block.getDrops(this.world, pos, this.world.getBlockState(pos), 0);
NonNullList<ItemStack> drops = NonNullList.create();
block.getDrops(drops, world, pos, state, 0);
float chance = WorldUtil.fireFakeHarvestEventsForDropChance(drops, this.world, pos);
if(chance > 0 && this.world.rand.nextFloat() <= chance){

View file

@ -21,12 +21,11 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.ArrayList;
public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements IPhantomTile, IButtonReactor{
public static final int RANGE = 3;
@ -134,8 +133,8 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements
if(this.isBreaker){
Block blockToBreak = this.world.getBlockState(this.boundPosition).getBlock();
if(blockToBreak != null && this.world.getBlockState(this.boundPosition).getBlockHardness(this.world, this.boundPosition) > -1.0F){
ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
drops.addAll(blockToBreak.getDrops(this.world, this.boundPosition, this.world.getBlockState(this.boundPosition), 0));
NonNullList<ItemStack> drops = NonNullList.create();
blockToBreak.getDrops(drops, world, pos, this.world.getBlockState(this.boundPosition), 0);
if(WorldUtil.addToInventory(this.slots, drops, false)){
this.world.playEvent(2001, this.boundPosition, Block.getStateId(this.world.getBlockState(this.boundPosition)));