mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-20 12:09:39 +00:00
Fix #1223 Suvirvalist's Pickaxe
This commit is contained in:
1 parent
982aefa165
commit
2e1b62e58d
11 files changed
+36
-6
No files matched your search
@@ -12,10 +12,11 @@ package forestry.apiculture.blocks;
|
||||
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.core.blocks.BlockBase;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class BlockApiculture extends BlockBase<BlockTypeApiculture> {
|
||||
public BlockApiculture(BlockTypeApiculture type) {
|
||||
super(type);
|
||||
super(type, Material.WOOD);
|
||||
setCreativeTab(Tabs.tabApiculture);
|
||||
setHarvestLevel("axe", 0);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ package forestry.apiculture.blocks;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.core.Tabs;
|
||||
@@ -36,7 +37,7 @@ public class BlockRegistryApiculture extends BlockRegistry {
|
||||
beeHouse = new BlockApiculture(BlockTypeApiculture.BEE_HOUSE);
|
||||
registerBlock(beeHouse, new ItemBlockForestry(beeHouse), "bee_house");
|
||||
|
||||
beeChest = new BlockBase<>(BlockTypeApicultureTesr.APIARIST_CHEST);
|
||||
beeChest = new BlockBase<>(BlockTypeApicultureTesr.APIARIST_CHEST, Material.WOOD);
|
||||
registerBlock(beeChest, new ItemBlockForestry(beeChest), "bee_chest");
|
||||
beeChest.setCreativeTab(Tabs.tabApiculture);
|
||||
beeChest.setHarvestLevel("axe", 0);
|
||||
|
||||
@@ -12,10 +12,12 @@ package forestry.arboriculture.blocks;
|
||||
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.core.blocks.BlockBase;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class BlockArboriculture extends BlockBase<BlockTypeArboricultureTesr> {
|
||||
public BlockArboriculture(BlockTypeArboricultureTesr type) {
|
||||
super(type);
|
||||
super(type, Material.WOOD);
|
||||
setCreativeTab(Tabs.tabArboriculture);
|
||||
setHarvestLevel("axe", 0);
|
||||
}
|
||||
}
|
||||
@@ -74,8 +74,8 @@ public class BlockBase<P extends Enum<P> & IBlockType & IStringSerializable> ext
|
||||
|
||||
protected final BlockStateContainer blockState;
|
||||
|
||||
public BlockBase(@Nonnull P blockType) {
|
||||
super(Material.IRON);
|
||||
public BlockBase(@Nonnull P blockType, Material material) {
|
||||
super(material);
|
||||
|
||||
this.blockType = blockType;
|
||||
blockType.getMachineProperties().setBlock(this);
|
||||
@@ -90,6 +90,10 @@ public class BlockBase<P extends Enum<P> & IBlockType & IStringSerializable> ext
|
||||
|
||||
particleCallback = new MachineParticleCallback<>(this, blockType);
|
||||
}
|
||||
|
||||
public BlockBase(@Nonnull P blockType) {
|
||||
this(blockType, Material.IRON);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
|
||||
@@ -13,5 +13,6 @@ package forestry.core.blocks;
|
||||
public class BlockCore extends BlockBase<BlockTypeCoreTesr> {
|
||||
public BlockCore(BlockTypeCoreTesr blockType) {
|
||||
super(blockType);
|
||||
setHarvestLevel("pickaxe", 0);
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,9 @@ 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.ItemPickaxe;
|
||||
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;
|
||||
@@ -48,6 +50,15 @@ public class ItemForestryTool extends ItemForestry {
|
||||
public void setEfficiencyOnProperMaterial(float efficiencyOnProperMaterial) {
|
||||
this.efficiencyOnProperMaterial = efficiencyOnProperMaterial;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHarvestBlock(IBlockState block) {
|
||||
if(this == PluginCore.items.bronzePickaxe){
|
||||
Material material = block.getMaterial();
|
||||
return material == Material.ROCK ? true : (material == Material.IRON ? true : material == Material.ANVIL);
|
||||
}
|
||||
return super.canHarvestBlock(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getStrVsBlock(ItemStack itemstack, IBlockState state) {
|
||||
@@ -56,6 +67,10 @@ public class ItemForestryTool extends ItemForestry {
|
||||
return efficiencyOnProperMaterial;
|
||||
}
|
||||
}
|
||||
if(this == PluginCore.items.bronzePickaxe){
|
||||
Material material = state.getMaterial();
|
||||
return material != Material.IRON && material != Material.ANVIL && material != Material.ROCK ? super.getStrVsBlock(itemstack, state) : this.efficiencyOnProperMaterial;
|
||||
}
|
||||
return super.getStrVsBlock(itemstack, state);
|
||||
}
|
||||
|
||||
|
||||
@@ -56,6 +56,7 @@ public class BlockEngine extends BlockBase<BlockTypeEngine> {
|
||||
|
||||
public BlockEngine(BlockTypeEngine blockType) {
|
||||
super(blockType);
|
||||
setHarvestLevel("pickaxe", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,5 +15,6 @@ import forestry.core.blocks.BlockBase;
|
||||
public class BlockFactoryPlain extends BlockBase<BlockTypeFactoryPlain> {
|
||||
public BlockFactoryPlain(BlockTypeFactoryPlain type) {
|
||||
super(type);
|
||||
setHarvestLevel("pickaxe", 0);
|
||||
}
|
||||
}
|
||||
@@ -15,5 +15,6 @@ import forestry.core.blocks.BlockBase;
|
||||
public class BlockFactoryTESR extends BlockBase<BlockTypeFactoryTesr> {
|
||||
public BlockFactoryTESR(BlockTypeFactoryTesr type) {
|
||||
super(type);
|
||||
setHarvestLevel("pickaxe", 0);
|
||||
}
|
||||
}
|
||||
@@ -12,10 +12,12 @@ package forestry.lepidopterology.blocks;
|
||||
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.core.blocks.BlockBase;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class BlockLepidopterology extends BlockBase<BlockTypeLepidopterologyTesr> {
|
||||
public BlockLepidopterology(BlockTypeLepidopterologyTesr type) {
|
||||
super(type);
|
||||
super(type, Material.WOOD);
|
||||
setCreativeTab(Tabs.tabLepidopterology);
|
||||
setHarvestLevel("axe", 0);
|
||||
}
|
||||
}
|
||||
@@ -15,5 +15,6 @@ import forestry.core.blocks.BlockBase;
|
||||
public class BlockMail extends BlockBase<BlockTypeMail> {
|
||||
public BlockMail(BlockTypeMail blockType) {
|
||||
super(blockType);
|
||||
setHarvestLevel("pickaxe", 0);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user