mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-22 04:52:26 +00:00
Fix #1235 Untextured particles when Loam block that is part of formed Charcoal Pile multiblock is broken, Fix #1234 Selecting Loam block broken, Fix #1232 Loam block drops 2 blocks when broken, Fix #1231 Charcoal Pile multiblock drops
This commit is contained in:
1 parent
fd6a1de27e
commit
0405151a8e
3 files changed
+51
-37
No files matched your search
@@ -40,6 +40,7 @@ import forestry.core.render.ParticleHelper;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockDirt;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -53,6 +54,7 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemSpade;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -71,6 +73,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.property.ExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -130,6 +133,20 @@ public abstract class BlockPile extends BlockStructure implements ITileEntityPro
|
||||
for (final EnumPileType type : EnumPileType.VALUES) {
|
||||
BlockPile pile = new BlockPile() {
|
||||
|
||||
@Override
|
||||
public String getHarvestTool(IBlockState state) {
|
||||
if(type == EnumPileType.WOOD){
|
||||
return "axe";
|
||||
}else{
|
||||
return "shovel";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHarvestLevel(IBlockState state) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumPileType getPileType() {
|
||||
return type;
|
||||
@@ -157,7 +174,6 @@ public abstract class BlockPile extends BlockStructure implements ITileEntityPro
|
||||
setHardness(1.0F);
|
||||
setUnlocalizedName("charcoal.pile");
|
||||
setCreativeTab(Tabs.tabArboriculture);
|
||||
setHarvestLevel("axe", 0);
|
||||
setDefaultState(blockState.getBaseState().withProperty(PILE_POSITION, EnumPilePosition.INTERIOR));
|
||||
|
||||
particleCallback = new PileParticleCallback(this);
|
||||
@@ -403,33 +419,7 @@ public abstract class BlockPile extends BlockStructure implements ITileEntityPro
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state) {
|
||||
if (world.isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof ICharcoalPileComponent) {
|
||||
ICharcoalPileComponent pile = (ICharcoalPileComponent) tile;
|
||||
ArrayList<ItemStack> list = new ArrayList<ItemStack>();
|
||||
if (getPileType() == EnumPileType.ASH) {
|
||||
if(pile.getTree() != null){
|
||||
ItemStack charcoal = TreeManager.treeRoot.getMemberStack(pile.getTree(), EnumGermlingType.CHARCOAL);
|
||||
charcoal.stackSize = pile.getTree().getGenome().getCarbonization();
|
||||
list.add(charcoal);
|
||||
list.add(new ItemStack(PluginCore.items.ash, 3));
|
||||
}else{
|
||||
list.add(new ItemStack(Blocks.DIRT, 2));
|
||||
list.add(new ItemStack(PluginCore.items.ash, 2));
|
||||
}
|
||||
} else if (getPileType() == EnumPileType.DIRT) {
|
||||
list.add(new ItemStack(this));
|
||||
} else {
|
||||
list.add(createWoodPile(pile.getTree()));
|
||||
}
|
||||
for(ItemStack items : list){
|
||||
ItemStackUtil.dropItemStackAsEntity(items, world, pos);
|
||||
}
|
||||
}
|
||||
//use to override world.removeTileEntity
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -479,11 +469,15 @@ public abstract class BlockPile extends BlockStructure implements ITileEntityPro
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof ICharcoalPileComponent) {
|
||||
return createWoodPile(((ICharcoalPileComponent) tile).getTree());
|
||||
if(getPileType() == EnumPileType.WOOD){
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof ICharcoalPileComponent) {
|
||||
return createWoodPile(((ICharcoalPileComponent) tile).getTree());
|
||||
}
|
||||
}else if(getPileType() == EnumPileType.DIRT){
|
||||
return super.getPickBlock(state, target, world, pos, player);
|
||||
}
|
||||
return super.getPickBlock(state, target, world, pos, player);
|
||||
return null;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -529,6 +523,25 @@ public abstract class BlockPile extends BlockStructure implements ITileEntityPro
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getBlockHardness(IBlockState blockState, World world, BlockPos pos) {
|
||||
if(getPileType() == EnumPileType.WOOD){
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof ICharcoalPileComponent) {
|
||||
|
||||
ITree tree = ((ICharcoalPileComponent)tile).getTree();
|
||||
if(tree != null){
|
||||
ItemStack wood = tree.getGenome().getPrimary().getWoodProvider().getWoodStack();
|
||||
if(wood != null){
|
||||
Block block = Block.getBlockFromItem(wood.getItem());
|
||||
return block.getStateFromMeta(wood.getMetadata()).getBlockHardness(world, pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.getBlockHardness(blockState, world, pos);
|
||||
}
|
||||
|
||||
public static ItemStack createWoodPile(ITree tree) {
|
||||
if (tree != null) {
|
||||
ItemStack stack = new ItemStack(PluginArboriculture.blocks.piles.get(EnumPileType.WOOD));
|
||||
|
||||
@@ -12,6 +12,7 @@ import forestry.api.arboriculture.IAlleleTreeSpecies;
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.arboriculture.genetics.Tree;
|
||||
import forestry.arboriculture.genetics.TreeDefinition;
|
||||
import forestry.arboriculture.tiles.TilePile;
|
||||
import forestry.core.blocks.propertys.UnlistedBlockAccess;
|
||||
import forestry.core.blocks.propertys.UnlistedBlockPos;
|
||||
@@ -95,7 +96,7 @@ public class ModelWoodPile extends BlankItemModel{
|
||||
|
||||
@Override
|
||||
public TextureAtlasSprite getParticleTexture() {
|
||||
return null;
|
||||
return TreeDefinition.Oak.getGenome().getPrimary().getWoodProvider().getSprite(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -30,14 +30,14 @@ public class PileParticleCallback extends ParticleHelper.DefaultCallback<BlockPi
|
||||
protected void setTexture(EntityDiggingFX fx, World world, BlockPos pos, IBlockState state) {
|
||||
EnumPileType type = block.getPileType();
|
||||
TilePile pile = TileUtil.getTile(world, pos, TilePile.class);
|
||||
if(pile == null || pile.getTree() == null){
|
||||
super.setTexture(fx, world, pos, state);
|
||||
return;
|
||||
}
|
||||
TextureAtlasSprite texture;
|
||||
if(type == EnumPileType.DIRT){
|
||||
texture = TextureManager.registerSprite(new ResourceLocation("forestry:blocks/loam"));
|
||||
}else if(type == EnumPileType.WOOD){
|
||||
if(pile == null || pile.getTree() == null){
|
||||
super.setTexture(fx, world, pos, state);
|
||||
return;
|
||||
}
|
||||
texture = pile.getTree().getGenome().getPrimary().getWoodProvider().getSprite(false);
|
||||
}else{
|
||||
texture = TextureManager.registerSprite(new ResourceLocation("forestry:blocks/ash"));
|
||||
|
||||
Reference in new issue
Block a user