mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-21 04:22:32 +00:00
Fix #1159 Stairs and Fireproof Stairs Break Instantly, #1170 Treealyzer Shift Click, Convert Vanilla Sapling to Germling in the Treealyzer
This commit is contained in:
1 parent
8299fe3a75
commit
ea6fd2e3c0
4 files changed
+58
-4
No files matched your search
@@ -28,6 +28,7 @@ import forestry.arboriculture.WoodHelper.WoodMeshDefinition;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import net.minecraft.block.BlockFenceGate;
|
||||
import net.minecraft.block.BlockPlanks.EnumType;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -35,6 +36,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -104,6 +106,13 @@ public class BlockArbFenceGate extends BlockFenceGate implements IWoodTyped, IIt
|
||||
list.add(TreeManager.woodItemAccess.getFenceGate(woodType, fireproof));
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getBlockHardness(IBlockState blockState, World worldIn, BlockPos pos) {
|
||||
int meta = getMetaFromState(blockState);
|
||||
EnumWoodType woodType = getWoodType(meta);
|
||||
return woodType.getHardness();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModel(Item item, IModelManager manager) {
|
||||
|
||||
@@ -20,7 +20,7 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -82,6 +82,13 @@ public class BlockArbStairs extends BlockStairs implements IWoodTyped, IItemMode
|
||||
public void registerStateMapper() {
|
||||
Proxies.render.registerStateMapper(this, new WoodTypeStateMapper(this, null));
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getBlockHardness(IBlockState blockState, World worldIn, BlockPos pos) {
|
||||
int meta = getMetaFromState(blockState);
|
||||
EnumWoodType woodType = getWoodType(meta);
|
||||
return woodType.getHardness();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face) {
|
||||
|
||||
@@ -13,6 +13,8 @@ package forestry.arboriculture.inventory;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
@@ -29,7 +31,7 @@ public class ItemInventoryTreealyzer extends ItemInventoryAlyzer implements IHin
|
||||
|
||||
@Override
|
||||
public boolean canSlotAccept(int slotIndex, ItemStack itemStack) {
|
||||
if (!TreeManager.treeRoot.isMember(itemStack)) {
|
||||
if (!TreeManager.treeRoot.isMember(itemStack) || itemStack.getItem() == Item.getItemFromBlock(Blocks.SAPLING)) {
|
||||
ItemStack ersatz = GeneticsUtil.convertSaplingToGeneticEquivalent(itemStack);
|
||||
if (ersatz != null) {
|
||||
return super.canSlotAccept(slotIndex, ersatz);
|
||||
@@ -41,7 +43,7 @@ public class ItemInventoryTreealyzer extends ItemInventoryAlyzer implements IHin
|
||||
@Override
|
||||
public void onSlotClick(EntityPlayer player) {
|
||||
ItemStack specimen = getStackInSlot(SLOT_SPECIMEN);
|
||||
if (!TreeManager.treeRoot.isMember(specimen)) {
|
||||
if (!TreeManager.treeRoot.isMember(specimen) || specimen.getItem() == Item.getItemFromBlock(Blocks.SAPLING)) {
|
||||
ItemStack ersatz = GeneticsUtil.convertSaplingToGeneticEquivalent(specimen);
|
||||
if (ersatz != null) {
|
||||
setInventorySlotContents(SLOT_SPECIMEN, ersatz);
|
||||
|
||||
@@ -11,17 +11,26 @@
|
||||
package forestry.core.items;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.ItemSpade;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemTool;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
import forestry.core.PluginCore;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
|
||||
public class ItemForestryTool extends ItemForestry {
|
||||
@@ -51,6 +60,33 @@ public class ItemForestryTool extends ItemForestry {
|
||||
}
|
||||
return super.getStrVsBlock(itemstack, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ){
|
||||
if(this == PluginCore.items.bronzeShovel){
|
||||
if (!playerIn.canPlayerEdit(pos.offset(facing), facing, stack)){
|
||||
return EnumActionResult.FAIL;
|
||||
}else{
|
||||
IBlockState iblockstate = worldIn.getBlockState(pos);
|
||||
Block block = iblockstate.getBlock();
|
||||
|
||||
if (facing != EnumFacing.DOWN && worldIn.getBlockState(pos.up()).getMaterial() == Material.AIR && block == Blocks.GRASS){
|
||||
IBlockState iblockstate1 = Blocks.GRASS_PATH.getDefaultState();
|
||||
worldIn.playSound(playerIn, pos, SoundEvents.ITEM_SHOVEL_FLATTEN, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
|
||||
if (!worldIn.isRemote){
|
||||
worldIn.setBlockState(pos, iblockstate1, 11);
|
||||
stack.damageItem(1, playerIn);
|
||||
}
|
||||
|
||||
return EnumActionResult.SUCCESS;
|
||||
}else{
|
||||
return EnumActionResult.PASS;
|
||||
}
|
||||
}
|
||||
}
|
||||
return EnumActionResult.PASS;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onDestroyCurrentItem(PlayerDestroyItemEvent event) {
|
||||
|
||||
Reference in new issue
Block a user