mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-18 03:15:28 +00:00
Stop using some deprecated methods and classes
This commit is contained in:
1 parent
7306764c51
commit
1fcaacd41b
22 files changed
+197
-210
No files matched your search
@@ -11,7 +11,6 @@
|
||||
package forestry.apiculture.blocks;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
@@ -98,9 +97,7 @@ public class BlockBeeHives extends BlockContainer implements IItemModelRegister,
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
List<ItemStack> drops = new ArrayList<>();
|
||||
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
Random random = world instanceof World ? ((World) world).rand : RANDOM;
|
||||
|
||||
List<IHiveDrop> hiveDrops = getDropsForHive(getMetaFromState(state));
|
||||
@@ -144,8 +141,6 @@ public class BlockBeeHives extends BlockContainer implements IItemModelRegister,
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return drops;
|
||||
}
|
||||
|
||||
// / CREATIVE INVENTORY
|
||||
|
||||
@@ -14,10 +14,8 @@ import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.awt.Color;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
@@ -46,9 +44,10 @@ import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
@@ -241,9 +240,9 @@ public class BlockCandle extends BlockTorch implements IItemModelRegister, ITile
|
||||
drop.set(itemStack);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
ItemStack dropStack = drop.get();
|
||||
drop.remove();
|
||||
|
||||
@@ -252,10 +251,7 @@ public class BlockCandle extends BlockTorch implements IItemModelRegister, ITile
|
||||
dropStack = getCandleDrop(world, pos);
|
||||
}
|
||||
|
||||
ArrayList<ItemStack> drops = new ArrayList<>(1);
|
||||
drops.add(dropStack);
|
||||
|
||||
return drops;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -158,7 +158,7 @@ public abstract class BlockAbstractLeaves extends BlockLeaves implements IItemMo
|
||||
// Hack: When harvesting leaves we need to get the drops in onBlockHarvested,
|
||||
// because there is no Player parameter in getDrops()
|
||||
// and Mojang destroys the block and tile before calling getDrops.
|
||||
private final ThreadLocal<List<ItemStack>> drops = new ThreadLocal<>();
|
||||
private final ThreadLocal<NonNullList<ItemStack>> drops = new ThreadLocal<>();
|
||||
|
||||
/**
|
||||
* {@link IToolGrafter}'s drop bonus handling is done here.
|
||||
@@ -180,22 +180,22 @@ public abstract class BlockAbstractLeaves extends BlockLeaves implements IItemMo
|
||||
}
|
||||
|
||||
GameProfile playerProfile = player.getGameProfile();
|
||||
List<ItemStack> leafDrops = getLeafDrop(world, playerProfile, pos, saplingModifier, fortune);
|
||||
drops.set(leafDrops);
|
||||
NonNullList<ItemStack> drops = NonNullList.create();
|
||||
getLeafDrop(drops, world, playerProfile, pos, saplingModifier, fortune);
|
||||
this.drops.set(drops);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public final List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
List<ItemStack> ret = drops.get();
|
||||
drops.remove();
|
||||
|
||||
// leaves not harvested, get drops normally
|
||||
if (ret == null) {
|
||||
ret = getLeafDrop((World) world, null, pos, 1.0f, fortune);
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
List<ItemStack> ret = this.drops.get();
|
||||
this.drops.remove();
|
||||
if (ret != null) {
|
||||
drops.addAll(ret);
|
||||
} else {
|
||||
// leaves not harvested, get drops normally
|
||||
getLeafDrop(drops, (World) world, null, pos, 1.0f, fortune);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
protected abstract NonNullList<ItemStack> getLeafDrop(World world, @Nullable GameProfile playerProfile, BlockPos pos, float saplingModifier, int fortune);
|
||||
|
||||
protected abstract void getLeafDrop(NonNullList<ItemStack> drops, World world, @Nullable GameProfile playerProfile, BlockPos pos, float saplingModifier, int fortune);
|
||||
}
|
||||
@@ -1,12 +1,5 @@
|
||||
package forestry.arboriculture.blocks;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.core.IStateMapperRegister;
|
||||
import forestry.api.core.Tabs;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.MapColor;
|
||||
@@ -18,12 +11,20 @@ import net.minecraft.client.renderer.block.statemap.StateMap;
|
||||
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.IBlockAccess;
|
||||
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.core.IStateMapperRegister;
|
||||
import forestry.api.core.Tabs;
|
||||
|
||||
public class BlockCharcoal extends Block implements IStateMapperRegister, IItemModelRegister {
|
||||
|
||||
public static final PropertyInteger AMOUNT = PropertyInteger.create("amount", 0, 15);
|
||||
@@ -60,11 +61,11 @@ public class BlockCharcoal extends Block implements IStateMapperRegister, IItemM
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
if(state.getValue(AMOUNT) > 0){
|
||||
return Collections.singletonList(new ItemStack(Items.COAL, state.getValue(AMOUNT) + 9, 1));
|
||||
drops.add(new ItemStack(Items.COAL, state.getValue(AMOUNT) + 9, 1));
|
||||
}
|
||||
return super.getDrops(world, pos, state, fortune);
|
||||
super.getDrops(drops, world, pos, state, fortune);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
@@ -27,6 +27,7 @@ import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.common.IShearable;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -160,8 +161,8 @@ public abstract class BlockDecorativeLeaves extends Block implements IItemModelR
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
return Collections.emptyList();
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,14 +4,6 @@ import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import forestry.api.arboriculture.EnumGermlingType;
|
||||
import forestry.api.arboriculture.IFruitProvider;
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.arboriculture.ITreeGenome;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.arboriculture.genetics.TreeDefinition;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
@@ -24,10 +16,22 @@ import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.arboriculture.EnumGermlingType;
|
||||
import forestry.api.arboriculture.IFruitProvider;
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.arboriculture.ITreeGenome;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.arboriculture.genetics.TreeDefinition;
|
||||
|
||||
/**
|
||||
* Genetic leaves with no tile entity, used for worldgen trees.
|
||||
* Similar to decorative leaves, but these will drop saplings and can be used for pollination.
|
||||
@@ -120,19 +124,17 @@ public abstract class BlockDefaultLeaves extends BlockAbstractLeaves {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NonNullList<ItemStack> getLeafDrop(World world, @Nullable GameProfile playerProfile, BlockPos pos, float saplingModifier, int fortune) {
|
||||
NonNullList<ItemStack> prod = NonNullList.create();
|
||||
|
||||
protected void getLeafDrop(NonNullList<ItemStack> drops, World world, @Nullable GameProfile playerProfile, BlockPos pos, float saplingModifier, int fortune) {
|
||||
ITree tree = getTree(world, pos);
|
||||
if (tree == null) {
|
||||
return prod;
|
||||
return;
|
||||
}
|
||||
|
||||
// Add saplings
|
||||
List<ITree> saplings = tree.getSaplings(world, playerProfile, pos, saplingModifier);
|
||||
for (ITree sapling : saplings) {
|
||||
if (sapling != null) {
|
||||
prod.add(TreeManager.treeRoot.getMemberStack(sapling, EnumGermlingType.SAPLING));
|
||||
drops.add(TreeManager.treeRoot.getMemberStack(sapling, EnumGermlingType.SAPLING));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,10 +143,8 @@ public abstract class BlockDefaultLeaves extends BlockAbstractLeaves {
|
||||
IFruitProvider fruitProvider = genome.getFruitProvider();
|
||||
if (fruitProvider.isFruitLeaf(genome, world, pos)) {
|
||||
NonNullList<ItemStack> produceStacks = tree.produceStacks(world, pos, Integer.MAX_VALUE);
|
||||
prod.addAll(produceStacks);
|
||||
drops.addAll(produceStacks);
|
||||
}
|
||||
|
||||
return prod;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -14,21 +14,6 @@ import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import forestry.api.arboriculture.EnumGermlingType;
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.core.IToolScoop;
|
||||
import forestry.api.lepidopterology.ButterflyManager;
|
||||
import forestry.api.lepidopterology.EnumFlutterType;
|
||||
import forestry.api.lepidopterology.IButterfly;
|
||||
import forestry.arboriculture.PluginArboriculture;
|
||||
import forestry.arboriculture.tiles.TileLeaves;
|
||||
import forestry.core.blocks.properties.UnlistedBlockAccess;
|
||||
import forestry.core.blocks.properties.UnlistedBlockPos;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import net.minecraft.block.IGrowable;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
@@ -46,13 +31,32 @@ import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.common.property.ExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.arboriculture.EnumGermlingType;
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.core.IToolScoop;
|
||||
import forestry.api.lepidopterology.ButterflyManager;
|
||||
import forestry.api.lepidopterology.EnumFlutterType;
|
||||
import forestry.api.lepidopterology.IButterfly;
|
||||
import forestry.arboriculture.PluginArboriculture;
|
||||
import forestry.arboriculture.tiles.TileLeaves;
|
||||
import forestry.core.blocks.properties.UnlistedBlockAccess;
|
||||
import forestry.core.blocks.properties.UnlistedBlockPos;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
|
||||
public class BlockForestryLeaves extends BlockAbstractLeaves implements ITileEntityProvider, IGrowable {
|
||||
|
||||
public BlockForestryLeaves() {
|
||||
@@ -126,17 +130,15 @@ public class BlockForestryLeaves extends BlockAbstractLeaves implements ITileEnt
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NonNullList<ItemStack> getLeafDrop(World world, @Nullable GameProfile playerProfile, BlockPos pos, float saplingModifier, int fortune) {
|
||||
NonNullList<ItemStack> prod = NonNullList.create();
|
||||
|
||||
protected void getLeafDrop(NonNullList<ItemStack> drops, World world, @Nullable GameProfile playerProfile, BlockPos pos, float saplingModifier, int fortune) {
|
||||
TileLeaves tile = TileUtil.getTile(world, pos, TileLeaves.class);
|
||||
if (tile == null) {
|
||||
return prod;
|
||||
return;
|
||||
}
|
||||
|
||||
ITree tree = tile.getTree();
|
||||
if (tree == null) {
|
||||
return prod;
|
||||
return;
|
||||
}
|
||||
|
||||
// Add saplings
|
||||
@@ -144,16 +146,14 @@ public class BlockForestryLeaves extends BlockAbstractLeaves implements ITileEnt
|
||||
|
||||
for (ITree sapling : saplings) {
|
||||
if (sapling != null) {
|
||||
prod.add(TreeManager.treeRoot.getMemberStack(sapling, EnumGermlingType.SAPLING));
|
||||
drops.add(TreeManager.treeRoot.getMemberStack(sapling, EnumGermlingType.SAPLING));
|
||||
}
|
||||
}
|
||||
|
||||
// Add fruits
|
||||
if (tile.hasFruit()) {
|
||||
prod.addAll(tree.produceStacks(world, pos, tile.getRipeningTime()));
|
||||
drops.addAll(tree.produceStacks(world, pos, tile.getRipeningTime()));
|
||||
}
|
||||
|
||||
return prod;
|
||||
}
|
||||
|
||||
/* MODELS */
|
||||
|
||||
@@ -11,10 +11,27 @@
|
||||
package forestry.arboriculture.blocks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.BlockCocoa;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.arboriculture.IAlleleFruit;
|
||||
import forestry.api.core.IStateMapperRegister;
|
||||
import forestry.arboriculture.genetics.alleles.AlleleFruits;
|
||||
@@ -23,20 +40,6 @@ import forestry.arboriculture.tiles.TileFruitPod;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
import forestry.core.utils.BlockUtil;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import net.minecraft.block.BlockCocoa;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockFruitPod extends BlockCocoa implements IStateMapperRegister, ITileEntityProvider {
|
||||
|
||||
@@ -99,8 +102,8 @@ public class BlockFruitPod extends BlockCocoa implements IStateMapperRegister, I
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
return Collections.emptyList();
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,10 +11,31 @@
|
||||
package forestry.arboriculture.blocks;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.IGrowable;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.arboriculture.EnumGermlingType;
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
@@ -26,25 +47,6 @@ import forestry.arboriculture.render.SaplingStateMapper;
|
||||
import forestry.arboriculture.tiles.TileSapling;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.IGrowable;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockSapling extends BlockTreeContainer implements IGrowable, IStateMapperRegister, IItemModelRegister {
|
||||
protected static final AxisAlignedBB SAPLING_AABB = new AxisAlignedBB(0.09999999403953552D, 0.0D, 0.09999999403953552D, 0.8999999761581421D, 0.800000011920929D, 0.8999999761581421D);
|
||||
@@ -149,10 +151,10 @@ public class BlockSapling extends BlockTreeContainer implements IGrowable, IStat
|
||||
|
||||
/* REMOVING */
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
return new ArrayList<>();
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
|
||||
TileSapling sapling = TileUtil.getTile(world, pos, TileSapling.class);
|
||||
|
||||
@@ -2,13 +2,15 @@ package forestry.arboriculture.charcoal.jei;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
import forestry.api.arboriculture.ICharcoalPileWall;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class CharcoalPileWallWrapper extends BlankRecipeWrapper {
|
||||
import forestry.api.arboriculture.ICharcoalPileWall;
|
||||
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
public class CharcoalPileWallWrapper implements IRecipeWrapper {
|
||||
|
||||
private final ICharcoalPileWall pileWall;
|
||||
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.blocks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -33,6 +31,7 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -103,22 +102,18 @@ public class BlockBogEarth extends Block implements IItemModelRegister, IBlockWi
|
||||
public int tickRate(World world) {
|
||||
return 500;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
List<ItemStack> ret = new ArrayList<>();
|
||||
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
Integer maturity = state.getValue(MATURITY);
|
||||
SoilType type = SoilType.fromMaturity(maturity);
|
||||
|
||||
if (type == SoilType.PEAT) {
|
||||
ret.add(PluginCore.getItems().peat.getItemStack(2));
|
||||
ret.add(new ItemStack(Blocks.DIRT));
|
||||
drops.add(PluginCore.getItems().peat.getItemStack(2));
|
||||
drops.add(new ItemStack(Blocks.DIRT));
|
||||
} else {
|
||||
ret.add(new ItemStack(this, 1, SoilType.BOG_EARTH.ordinal()));
|
||||
drops.add(new ItemStack(this, 1, SoilType.BOG_EARTH.ordinal()));
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package forestry.core.blocks;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -25,6 +23,7 @@ import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -72,10 +71,10 @@ public class BlockHumus extends Block implements IItemModelRegister {
|
||||
public int tickRate(World world) {
|
||||
return 500;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
return Collections.singletonList(new ItemStack(Blocks.DIRT));
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
drops.add(new ItemStack(Blocks.DIRT));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,9 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.blocks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
@@ -69,10 +66,9 @@ public class BlockResourceOre extends Block implements IItemModelRegister, IBloc
|
||||
this.dropXpOnBlockBreak(world, pos, MathHelper.getInt(world.rand, 1, 4));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
List<ItemStack> drops = new ArrayList<>();
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
EnumResourceType type = state.getValue(ORE_RESOURCES);
|
||||
switch (type) {
|
||||
case APATITE: {
|
||||
@@ -96,8 +92,6 @@ public class BlockResourceOre extends Block implements IItemModelRegister, IBloc
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return drops;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package forestry.core.recipes.jei;
|
||||
|
||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
public abstract class ForestryRecipeWrapper<R> extends BlankRecipeWrapper {
|
||||
public abstract class ForestryRecipeWrapper<R> implements IRecipeWrapper {
|
||||
private final R recipe;
|
||||
|
||||
public ForestryRecipeWrapper(R recipe) {
|
||||
|
||||
@@ -39,6 +39,7 @@ import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import net.minecraftforge.client.model.PerspectiveMapWrapper;
|
||||
import net.minecraftforge.client.model.SimpleModelState;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -117,7 +118,7 @@ public class ModelUtil {
|
||||
|
||||
try {
|
||||
inputStream = resource.getInputStream();
|
||||
definition = ModelBlockDefinition.parseFromReader(new InputStreamReader(inputStream, Charsets.UTF_8));
|
||||
definition = ModelBlockDefinition.parseFromReader(new InputStreamReader(inputStream, Charsets.UTF_8), location);
|
||||
} catch (Exception exception) {
|
||||
throw new RuntimeException("Encountered an exception when loading model definition of \'" + location
|
||||
+ "\' from: \'" + resource.getResourceLocation() + "\' in resourcepack: \'"
|
||||
|
||||
@@ -2,12 +2,14 @@ package forestry.factory.recipes.jei.bottler;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class BottlerRecipeWrapper extends BlankRecipeWrapper {
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
public class BottlerRecipeWrapper implements IRecipeWrapper {
|
||||
public final ItemStack inputStack;
|
||||
public final FluidStack fluid;
|
||||
@Nullable
|
||||
|
||||
@@ -13,9 +13,9 @@ import forestry.api.fuels.RainSubstrate;
|
||||
import forestry.core.utils.Translator;
|
||||
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
public class RainmakerRecipeWrapper extends BlankRecipeWrapper {
|
||||
public class RainmakerRecipeWrapper implements IRecipeWrapper {
|
||||
private final RainSubstrate substrate;
|
||||
|
||||
public RainmakerRecipeWrapper(RainSubstrate substrate) {
|
||||
@@ -30,8 +30,6 @@ public class RainmakerRecipeWrapper extends BlankRecipeWrapper {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
|
||||
super.drawInfo(minecraft, recipeWidth, recipeHeight, mouseX, mouseY);
|
||||
|
||||
minecraft.fontRenderer.drawString(getEffectString(), 24, 0, Color.darkGray.getRGB());
|
||||
String speed = Translator.translateToLocalFormatted("for.jei.rainmaker.speed", substrate.getSpeed());
|
||||
minecraft.fontRenderer.drawString(speed, 24, 10, Color.gray.getRGB());
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
package forestry.farming.blocks;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -39,6 +38,7 @@ import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.common.property.ExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -142,10 +142,9 @@ public class BlockFarm extends BlockStructure {
|
||||
}
|
||||
return world.setBlockToAir(pos);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
ArrayList<ItemStack> drops = new ArrayList<>();
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
int meta = getMetaFromState(state);
|
||||
TileUtil.actOnTile(world, pos, TileFarm.class, farm -> {
|
||||
ItemStack stack = new ItemStack(this, 1, meta != 1 ? meta : 0);
|
||||
@@ -154,7 +153,6 @@ public class BlockFarm extends BlockStructure {
|
||||
stack.setTagCompound(compound);
|
||||
drops.add(stack);
|
||||
});
|
||||
return drops;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.farming.blocks;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
|
||||
@@ -101,14 +99,13 @@ public class BlockMushroom extends BlockBush implements IItemModelRegister, IGro
|
||||
public boolean getTickRandomly() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// / DROPS
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
MushroomType type = state.getValue(VARIANT);
|
||||
return Collections.singletonList(type.getDrop());
|
||||
drops.add(type.getDrop());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canPlaceBlockAt(World worldIn, BlockPos pos) {
|
||||
return super.canPlaceBlockAt(worldIn, pos) && this.canBlockStay(worldIn, pos, this.getDefaultState());
|
||||
|
||||
@@ -11,10 +11,29 @@
|
||||
package forestry.lepidopterology.blocks;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.core.IStateMapperRegister;
|
||||
@@ -26,23 +45,6 @@ import forestry.lepidopterology.genetics.alleles.AlleleButterflyCocoon;
|
||||
import forestry.lepidopterology.genetics.alleles.ButterflyAlleles;
|
||||
import forestry.lepidopterology.items.ItemButterflyGE;
|
||||
import forestry.lepidopterology.tiles.TileCocoon;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockCocoon extends Block implements ITileEntityProvider, IStateMapperRegister, IItemModelRegister {
|
||||
public static final AxisAlignedBB BOUNDING_BOX = new AxisAlignedBB(0.3125F, 0.3125F, 0.3125F, 0.6875F, 1F, 0.6875F);
|
||||
@@ -129,10 +131,10 @@ public class BlockCocoon extends Block implements ITileEntityProvider, IStateMap
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
return Collections.emptyList();
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos,
|
||||
EntityPlayer player) {
|
||||
|
||||
@@ -11,17 +11,7 @@
|
||||
package forestry.lepidopterology.blocks;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.core.IStateMapperRegister;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.lepidopterology.genetics.alleles.AlleleButterflyCocoon;
|
||||
import forestry.lepidopterology.genetics.alleles.ButterflyAlleles;
|
||||
import forestry.lepidopterology.tiles.TileCocoon;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.SoundType;
|
||||
@@ -36,10 +26,21 @@ import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.core.IStateMapperRegister;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.lepidopterology.genetics.alleles.AlleleButterflyCocoon;
|
||||
import forestry.lepidopterology.genetics.alleles.ButterflyAlleles;
|
||||
import forestry.lepidopterology.tiles.TileCocoon;
|
||||
|
||||
public class BlockSolidCocoon extends Block implements ITileEntityProvider, IStateMapperRegister, IItemModelRegister {
|
||||
private static final PropertyCocoon COCOON = AlleleButterflyCocoon.COCOON;
|
||||
|
||||
@@ -125,12 +126,12 @@ public class BlockSolidCocoon extends Block implements ITileEntityProvider, ISta
|
||||
worldIn.setBlockToAir(pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
return Collections.emptyList();
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getSelectedBoundingBox(IBlockState state, World worldIn, BlockPos pos) {
|
||||
return BlockCocoon.BOUNDING_BOX;
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
package forestry.lepidopterology.render;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.base.Throwables;
|
||||
import com.google.common.cache.Cache;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
@@ -32,6 +31,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||
import net.minecraftforge.client.model.IModel;
|
||||
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -67,7 +67,7 @@ public class ModelButterflyItem extends BlankModel {
|
||||
try {
|
||||
modelButterfly = ModelLoaderRegistry.getModel(new ResourceLocation("forestry:item/butterfly_ge"));
|
||||
} catch (Exception e) {
|
||||
Throwables.propagate(e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
if (modelButterfly == null) {
|
||||
throw new IllegalArgumentException("Could not bake butterfly model");
|
||||
|
||||
Reference in new issue
Block a user