kaleah Posted July 18, 2017 Share Posted July 18, 2017 (edited) hallo ich bin gerade dabei mein erstes Werkzeug für mein eigenes Modpack zu programmieren.. Nun habe ich folgendes Problem: Das werkzeug ist richtig geschrieben dennoch kann ich damit Steinabbauen Ich möchte zb nur das ich mit einer dreckspitzhacke nur dreckblöcke bzw grasblöcke abbauen kann.. Hier mal mein jetziger code der Klasse ItemPickaxeDirt package de.DarkEmpire.Anfang; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.ItemPickaxe; import net.minecraftforge.common.util.EnumHelper; public class ItemPickaxeDirt extends ItemPickaxe { protected ItemPickaxeDirt(ToolMaterial material) { super(EnumHelper.addToolMaterial("DIRT", 0, 40, 0.5f, 0.0F, 1)); setCreativeTab(CreativeTabs.tabTools); setTextureName("AnfangsMod:ItemPickAxeDirt"); } } Anmerk ich fange erst an mit Modprogramierung also bitte keine Komplexen sachen die ich nicht Verstehe Verwendete Software den SourceCode der ForgeApi in der version 1492 sowie Gradlew und Eclipse Edited July 18, 2017 by kaleah Umgebung Hinzugefügt Link to comment Share on other sites More sharing options...
kaleah Posted July 18, 2017 Author Share Posted July 18, 2017 package de.DarkEmpire.Anfang; import java.util.Set; import com.google.common.collect.Sets; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.item.ItemPickaxe; import net.minecraftforge.common.util.EnumHelper; public class ItemPickaxeDirt extends ItemPickaxe { private static final Set Block = Sets.newHashSet(new Block[] {Blocks.grass, Blocks.dirt}); protected ItemPickaxeDirt(ToolMaterial material) { super(EnumHelper.addToolMaterial("WOOD", 0, 40, 0.5f, 0.0F, 1)); setCreativeTab(CreativeTabs.tabTools); setTextureName("AnfangsMod:ItemPickAxeDirt"); } @Override public boolean func_150897_b(Block p_150897_1_) { return p_150897_1_ == Blocks.cobblestone ? this.toolMaterial.getHarvestLevel() == 3 : (p_150897_1_ != Blocks.diamond_block && p_150897_1_ != Blocks.diamond_ore ? (p_150897_1_ != Blocks.emerald_ore && p_150897_1_ != Blocks.emerald_block ? (p_150897_1_ != Blocks.gold_block && p_150897_1_ != Blocks.gold_ore ? (p_150897_1_ != Blocks.iron_block && p_150897_1_ != Blocks.iron_ore ? (p_150897_1_ != Blocks.lapis_block && p_150897_1_ != Blocks.grass ? (p_150897_1_ != Blocks.redstone_ore && p_150897_1_ != Blocks.lit_redstone_ore ? (p_150897_1_.getMaterial() == Material.rock ? true : (p_150897_1_.getMaterial() == Material.iron ? true : p_150897_1_.getMaterial() == Material.anvil)) : this.toolMaterial.getHarvestLevel() >= 0) : this.toolMaterial.getHarvestLevel() >= 0) : this.toolMaterial.getHarvestLevel() >= 0) : this.toolMaterial.getHarvestLevel() >= 0) : this.toolMaterial.getHarvestLevel() >= 0) : this.toolMaterial.getHarvestLevel() >= 0); } } Ach so geht es nicht ich will doch nur mit meiner Selbsterstellten Pickaxe nur grass und dreckblöcke abbauen können.. Link to comment Share on other sites More sharing options...
SuchtyTV Posted August 6, 2017 Share Posted August 6, 2017 Am 19.7.2017 um 01:29 schrieb kaleah: package de.DarkEmpire.Anfang; import java.util.Set; import com.google.common.collect.Sets; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.item.ItemPickaxe; import net.minecraftforge.common.util.EnumHelper; public class ItemPickaxeDirt extends ItemPickaxe { private static final Set Block = Sets.newHashSet(new Block[] {Blocks.grass, Blocks.dirt}); protected ItemPickaxeDirt(ToolMaterial material) { super(EnumHelper.addToolMaterial("WOOD", 0, 40, 0.5f, 0.0F, 1)); setCreativeTab(CreativeTabs.tabTools); setTextureName("AnfangsMod:ItemPickAxeDirt"); } @Override public boolean func_150897_b(Block p_150897_1_) { return p_150897_1_ == Blocks.cobblestone ? this.toolMaterial.getHarvestLevel() == 3 : (p_150897_1_ != Blocks.diamond_block && p_150897_1_ != Blocks.diamond_ore ? (p_150897_1_ != Blocks.emerald_ore && p_150897_1_ != Blocks.emerald_block ? (p_150897_1_ != Blocks.gold_block && p_150897_1_ != Blocks.gold_ore ? (p_150897_1_ != Blocks.iron_block && p_150897_1_ != Blocks.iron_ore ? (p_150897_1_ != Blocks.lapis_block && p_150897_1_ != Blocks.grass ? (p_150897_1_ != Blocks.redstone_ore && p_150897_1_ != Blocks.lit_redstone_ore ? (p_150897_1_.getMaterial() == Material.rock ? true : (p_150897_1_.getMaterial() == Material.iron ? true : p_150897_1_.getMaterial() == Material.anvil)) : this.toolMaterial.getHarvestLevel() >= 0) : this.toolMaterial.getHarvestLevel() >= 0) : this.toolMaterial.getHarvestLevel() >= 0) : this.toolMaterial.getHarvestLevel() >= 0) : this.toolMaterial.getHarvestLevel() >= 0) : this.toolMaterial.getHarvestLevel() >= 0); } } Ach so geht es nicht ich will doch nur mit meiner Selbsterstellten Pickaxe nur grass und dreckblöcke abbauen können.. Dieser Stil alter ;D Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now