mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 08:48:34 +01:00
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:
parent
e8058e252a
commit
1fe930b395
11 changed files with 28 additions and 29 deletions
|
@ -23,7 +23,7 @@ if(hasProperty('buildnumber')){
|
||||||
}
|
}
|
||||||
|
|
||||||
minecraft {
|
minecraft {
|
||||||
version = "1.12.1-14.22.0.2460"
|
version = "1.12.1-14.22.1.2481"
|
||||||
runDir = "run"
|
runDir = "run"
|
||||||
mappings = "snapshot_20170821"
|
mappings = "snapshot_20170821"
|
||||||
replaceIn "ModUtil.java"
|
replaceIn "ModUtil.java"
|
||||||
|
|
|
@ -40,6 +40,7 @@ public class BlockWallAA extends BlockBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public BlockWallAA(String name, Block base, int meta){
|
public BlockWallAA(String name, Block base, int meta){
|
||||||
super(base.getDefaultState().getMaterial(), name);
|
super(base.getDefaultState().getMaterial(), name);
|
||||||
this.meta = meta;
|
this.meta = meta;
|
||||||
|
@ -95,6 +96,7 @@ public class BlockWallAA extends BlockBase{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
|
@Deprecated
|
||||||
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side){
|
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side){
|
||||||
return side != EnumFacing.DOWN || super.shouldSideBeRendered(blockState, blockAccess, pos, side);
|
return side != EnumFacing.DOWN || super.shouldSideBeRendered(blockState, blockAccess, pos, side);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.misc.apiimpl.LaserRelayConnectionHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||||
import io.netty.util.internal.ConcurrentSet;
|
import io.netty.util.internal.ConcurrentSet;
|
||||||
import net.minecraft.nbt.CompressedStreamTools;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
@ -25,7 +24,6 @@ import net.minecraft.world.storage.WorldSavedData;
|
||||||
import net.minecraftforge.common.WorldSpecificSaveHandler;
|
import net.minecraftforge.common.WorldSpecificSaveHandler;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
|
@ -25,6 +25,7 @@ import net.minecraft.item.ItemBlock;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.EnumActionResult;
|
import net.minecraft.util.EnumActionResult;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.util.SoundCategory;
|
import net.minecraft.util.SoundCategory;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
@ -103,8 +104,8 @@ public class DefaultFarmerBehavior implements IFarmerBehavior{
|
||||||
if(((BlockCrops)block).isMaxAge(state)){
|
if(((BlockCrops)block).isMaxAge(state)){
|
||||||
List<ItemStack> seeds = new ArrayList<ItemStack>();
|
List<ItemStack> seeds = new ArrayList<ItemStack>();
|
||||||
List<ItemStack> other = new ArrayList<ItemStack>();
|
List<ItemStack> other = new ArrayList<ItemStack>();
|
||||||
|
NonNullList<ItemStack> drops = NonNullList.create();
|
||||||
List<ItemStack> drops = block.getDrops(world, pos, state, 0);
|
block.getDrops(drops, world, pos, state, 0);
|
||||||
for(ItemStack stack : drops){
|
for(ItemStack stack : drops){
|
||||||
if(this.getPlantableFromStack(stack) != null){
|
if(this.getPlantableFromStack(stack) != null){
|
||||||
seeds.add(stack);
|
seeds.add(stack);
|
||||||
|
|
|
@ -20,11 +20,10 @@ import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class MelonPumpkinFarmerBehavior implements IFarmerBehavior{
|
public class MelonPumpkinFarmerBehavior implements IFarmerBehavior{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -56,7 +55,8 @@ public class MelonPumpkinFarmerBehavior implements IFarmerBehavior{
|
||||||
IBlockState state = world.getBlockState(pos);
|
IBlockState state = world.getBlockState(pos);
|
||||||
Block block = state.getBlock();
|
Block block = state.getBlock();
|
||||||
if(block == Blocks.PUMPKIN || block == Blocks.MELON_BLOCK){
|
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(drops != null && !drops.isEmpty()){
|
||||||
if(farmer.addToOutputInventory(drops, false)){
|
if(farmer.addToOutputInventory(drops, false)){
|
||||||
world.playEvent(2001, pos, Block.getStateId(state));
|
world.playEvent(2001, pos, Block.getStateId(state));
|
||||||
|
|
|
@ -19,11 +19,10 @@ import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class ReedFarmerBehavior implements IFarmerBehavior{
|
public class ReedFarmerBehavior implements IFarmerBehavior{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -55,7 +54,8 @@ public class ReedFarmerBehavior implements IFarmerBehavior{
|
||||||
BlockPos up = pos.up(i);
|
BlockPos up = pos.up(i);
|
||||||
IBlockState upState = world.getBlockState(up);
|
IBlockState upState = world.getBlockState(up);
|
||||||
if(upState.getBlock() instanceof BlockReed){
|
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(drops != null && !drops.isEmpty()){
|
||||||
if(farmer.addToOutputInventory(drops, false)){
|
if(farmer.addToOutputInventory(drops, false)){
|
||||||
|
|
|
@ -19,12 +19,11 @@ import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemBlock;
|
import net.minecraft.item.ItemBlock;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public abstract class ExUPlantFarmerBehavior implements IFarmerBehavior{
|
public abstract class ExUPlantFarmerBehavior implements IFarmerBehavior{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -73,8 +72,8 @@ public abstract class ExUPlantFarmerBehavior implements IFarmerBehavior{
|
||||||
|
|
||||||
if(reg != null && this.getPlantName().equals(reg.toString())){
|
if(reg != null && this.getPlantName().equals(reg.toString())){
|
||||||
if(block.getMetaFromState(state) >= this.getMaxStage()){
|
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){
|
for(ItemStack stack : drops){
|
||||||
if(StackUtil.isValid(stack)){
|
if(StackUtil.isValid(stack)){
|
||||||
ResourceLocation itemReg = stack.getItem().getRegistryName();
|
ResourceLocation itemReg = stack.getItem().getRegistryName();
|
||||||
|
|
|
@ -19,11 +19,10 @@ import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraftforge.fluids.IFluidBlock;
|
import net.minecraftforge.fluids.IFluidBlock;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class TileEntityBreaker extends TileEntityInventoryBase{
|
public class TileEntityBreaker extends TileEntityInventoryBase{
|
||||||
|
|
||||||
public boolean isPlacer;
|
public boolean isPlacer;
|
||||||
|
@ -85,7 +84,8 @@ public class TileEntityBreaker extends TileEntityInventoryBase{
|
||||||
IBlockState stateToBreak = this.world.getBlockState(coordsBlock);
|
IBlockState stateToBreak = this.world.getBlockState(coordsBlock);
|
||||||
Block blockToBreak = stateToBreak.getBlock();
|
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){
|
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);
|
float chance = WorldUtil.fireFakeHarvestEventsForDropChance(drops, this.world, coordsBlock);
|
||||||
|
|
||||||
if(chance > 0 && this.world.rand.nextFloat() <= chance){
|
if(chance > 0 && this.world.rand.nextFloat() <= chance){
|
||||||
|
|
|
@ -16,13 +16,12 @@ import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraftforge.energy.IEnergyStorage;
|
import net.minecraftforge.energy.IEnergyStorage;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class TileEntityDirectionalBreaker extends TileEntityInventoryBase{
|
public class TileEntityDirectionalBreaker extends TileEntityInventoryBase{
|
||||||
|
|
||||||
public static final int RANGE = 8;
|
public static final int RANGE = 8;
|
||||||
|
@ -84,7 +83,8 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase{
|
||||||
BlockPos coordsBlock = this.pos.offset(sideToManipulate, i+1);
|
BlockPos coordsBlock = this.pos.offset(sideToManipulate, i+1);
|
||||||
Block blockToBreak = this.world.getBlockState(coordsBlock).getBlock();
|
Block blockToBreak = this.world.getBlockState(coordsBlock).getBlock();
|
||||||
if(blockToBreak != null && !this.world.isAirBlock(coordsBlock) && this.world.getBlockState(coordsBlock).getBlockHardness(this.world, coordsBlock) > -1.0F){
|
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);
|
float chance = WorldUtil.fireFakeHarvestEventsForDropChance(drops, this.world, coordsBlock);
|
||||||
|
|
||||||
if(chance > 0 && this.world.rand.nextFloat() <= chance){
|
if(chance > 0 && this.world.rand.nextFloat() <= chance){
|
||||||
|
|
|
@ -23,13 +23,12 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraftforge.energy.IEnergyStorage;
|
import net.minecraftforge.energy.IEnergyStorage;
|
||||||
import net.minecraftforge.fluids.IFluidBlock;
|
import net.minecraftforge.fluids.IFluidBlock;
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class TileEntityMiner extends TileEntityInventoryBase implements IButtonReactor, IEnergyDisplay{
|
public class TileEntityMiner extends TileEntityInventoryBase implements IButtonReactor, IEnergyDisplay{
|
||||||
|
|
||||||
public static final int ENERGY_USE_PER_BLOCK = 650;
|
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);
|
int meta = block.getMetaFromState(state);
|
||||||
if(!block.isAir(this.world.getBlockState(pos), this.world, pos)){
|
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)){
|
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);
|
float chance = WorldUtil.fireFakeHarvestEventsForDropChance(drops, this.world, pos);
|
||||||
|
|
||||||
if(chance > 0 && this.world.rand.nextFloat() <= chance){
|
if(chance > 0 && this.world.rand.nextFloat() <= chance){
|
||||||
|
|
|
@ -21,12 +21,11 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumParticleTypes;
|
import net.minecraft.util.EnumParticleTypes;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements IPhantomTile, IButtonReactor{
|
public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements IPhantomTile, IButtonReactor{
|
||||||
|
|
||||||
public static final int RANGE = 3;
|
public static final int RANGE = 3;
|
||||||
|
@ -134,8 +133,8 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements
|
||||||
if(this.isBreaker){
|
if(this.isBreaker){
|
||||||
Block blockToBreak = this.world.getBlockState(this.boundPosition).getBlock();
|
Block blockToBreak = this.world.getBlockState(this.boundPosition).getBlock();
|
||||||
if(blockToBreak != null && this.world.getBlockState(this.boundPosition).getBlockHardness(this.world, this.boundPosition) > -1.0F){
|
if(blockToBreak != null && this.world.getBlockState(this.boundPosition).getBlockHardness(this.world, this.boundPosition) > -1.0F){
|
||||||
ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
|
NonNullList<ItemStack> drops = NonNullList.create();
|
||||||
drops.addAll(blockToBreak.getDrops(this.world, this.boundPosition, this.world.getBlockState(this.boundPosition), 0));
|
blockToBreak.getDrops(drops, world, pos, this.world.getBlockState(this.boundPosition), 0);
|
||||||
|
|
||||||
if(WorldUtil.addToInventory(this.slots, drops, false)){
|
if(WorldUtil.addToInventory(this.slots, drops, false)){
|
||||||
this.world.playEvent(2001, this.boundPosition, Block.getStateId(this.world.getBlockState(this.boundPosition)));
|
this.world.playEvent(2001, this.boundPosition, Block.getStateId(this.world.getBlockState(this.boundPosition)));
|
||||||
|
|
Loading…
Reference in a new issue