Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.11] Custom tool - custom drop


Villfuk02
 Share

Recommended Posts

  • Replies 52
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

because i thought it didn't work because of different metadata or something

 

.equals() won't work on ItemStacks either, by the way. You need to use ItemStack.areStacksEqual()

Or compare the item/metadata directly.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

I think he means that no tool with silk touch can harvest it, and will get the drop that he set...

YouTube:

https://www.youtube.com/channel/UCaK5oRw4yd7PurBWww9tVhA

Kuribo64 (where I am most active):

http://kuribo64.net/board/profile.php?id=1423

 

Thanks for your answer!

 

Current projects:

 

3D Geometry Dash: 13%

Terracraft (MC Mod): 8%

New Super Kaizo Bros DS: 100% (no download for now :'( )

New Super Kaizo Bros. Wii: 12%

Super Mario Galaxy 1.5: 96%

New Super Mario Bros Galaxy: 85%

Kerbal Space Program Advance: 47%

MC CREATE: 20%

Mystery Projects: 10%, 40%, 13%, and 94%

Link to comment
Share on other sites

So, i did this:

@Override
public boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchantment) {
	if(enchantment.equals(Enchantment.getEnchantmentByID(33))){
		return false;
	}
	return super.canApplyAtEnchantingTable(stack, enchantment);
}

And it seems to be working - i enchanted about 60 of them and no silk touch, but you can still apply silk touch on it using book and anvil :(

And i tested other enchantments and every one except efficiency works

Link to comment
Share on other sites

No, i didn't. What is it used for?

 

And i'm using my custom materials:

public static final ToolMaterial gemMaterial = EnumHelper.addToolMaterial(Reference.MODID + "gem", 3, 400, 0.3F, 3.0F, 10);
public static final ToolMaterial obsidianMaterial = EnumHelper.addToolMaterial(Reference.MODID + "gem", 3, 800, 0.3F, 3.5F, 12);

 

Link to comment
Share on other sites

Don't use hardcoded IDs. Use the constants in the

Enchantments

class.

For anvil enchantments use

isBookEnchantable

in your Item class.

 

You shouldn't be using a hardcoded list of Blocks. Instead use tool classes. To add a tool class use

setHarvestLevel

in your Item constructor, recognized values are "pickaxe", "axe" and "shovel", mods might add others. The harvest level is documented in the method Javadoc.

Blocks can then decide their effectiveness using

isToolEffective

, which takes the tool class.

Link to comment
Share on other sites

how do i get stored enchantments out of the book ItemStack?
EnchantmentHelper.getEnchantments

 

And what about not working efficiency?
You shouldn't be using a hardcoded list of Blocks. Instead use tool classes. To add a tool class use
setHarvestLevel

in your Item constructor, recognized values are "pickaxe", "axe" and "shovel", mods might add others. The harvest level is documented in the method Javadoc.

Blocks can then decide their effectiveness using

isToolEffective

, which takes the tool class.

Link to comment
Share on other sites

I can't figure out a way to test if there is silk touch in the Map
Do you know how Maps work? If not, you need to look that up.

 

And for the efficiency i meant efficiency enchantment, not EFFECTIVE_ON.
I can't see anything in your code that would stop efficiency from working, but it's hard to say from just looking at snippets of code. It would be ideal if you could post a working git repo.
Link to comment
Share on other sites

Maybe it has something to do with this:

Efficiency

Increases mining speed. See Breaking Speed for details. One must use the proper tool for a block in order to receive the speed. Does not matter if you mine it with the incorrect tier. The speed increase applies to all blocks that when mined, will drop an item.

 

 

maybe it's because the blocks have harvest level set to "shovel" and this tool isnt technically a shovel

Link to comment
Share on other sites

i tried this just for testing:

@Override
public boolean isBookEnchantable(ItemStack stack, ItemStack book) {
	Utils.getLogger().info(EnchantmentHelper.getEnchantments(book));
	if(EnchantmentHelper.getEnchantments(book).containsKey(Enchantments.UNBREAKING)){
		return true;
	}
	return false;
}

 

When i try to put any book containing unbreaking on the tool, all the enchantments are passed onto the tool (i want just Unbreaking), and when i try any book, that doesn't contain unbreaking, the game crashes.  :'(

 

I'm sorry if this code is just a mess, because i don't understand, what am i supposed to do with this method

 

please help

Link to comment
Share on other sites

When i try to put any book containing unbreaking on the tool, all the enchantments are passed onto the tool (i want just Unbreaking), and when i try any book, that doesn't contain unbreaking, the game crashes.  :'(

 

1ie46g.jpg

 

 

Edit by larsgerrits: fixed image :)

 

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

When i try to put any book containing unbreaking on the tool, all the enchantments are passed onto the tool (i want just Unbreaking), and when i try any book, that doesn't contain unbreaking, the game crashes.  :'(

 

1ie46g.jpg

 

the image doesn't show but i managed to find it

 

here's the log when trying to put the efficiency V book on it:

[16:38:25] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:600]: ---- Minecraft Crash Report ----
// Everything's going to plan. No, really, that was supposed to happen.

Time: 26.1.17 16:38
Description: Updating screen events

java.lang.NullPointerException: Updating screen events
at net.minecraft.inventory.ContainerRepair.updateRepairOutput(ContainerRepair.java:324)
at net.minecraft.inventory.ContainerRepair.onCraftMatrixChanged(ContainerRepair.java:161)
at net.minecraft.inventory.ContainerRepair$1.markDirty(ContainerRepair.java:56)
at net.minecraft.inventory.InventoryBasic.setInventorySlotContents(InventoryBasic.java:152)
at net.minecraft.inventory.Slot.putStack(Slot.java:97)
at net.minecraft.inventory.Container.slotClick(Container.java:298)
at net.minecraft.client.multiplayer.PlayerControllerMP.windowClick(PlayerControllerMP.java:594)
at net.minecraft.client.gui.inventory.GuiContainer.handleMouseClick(GuiContainer.java:687)
at net.minecraft.client.gui.inventory.GuiContainer.mouseReleased(GuiContainer.java:643)
at net.minecraft.client.gui.GuiScreen.handleMouseInput(GuiScreen.java:621)
at net.minecraft.client.gui.GuiScreen.handleInput(GuiScreen.java:576)
at net.minecraft.client.Minecraft.runTick(Minecraft.java:1790)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1117)
at net.minecraft.client.Minecraft.run(Minecraft.java:405)
at net.minecraft.client.main.Main.main(Main.java:118)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
at GradleStart.main(GradleStart.java:26)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Client thread
Stacktrace:
at net.minecraft.inventory.ContainerRepair.updateRepairOutput(ContainerRepair.java:324)
at net.minecraft.inventory.ContainerRepair.onCraftMatrixChanged(ContainerRepair.java:161)
at net.minecraft.inventory.ContainerRepair$1.markDirty(ContainerRepair.java:56)
at net.minecraft.inventory.InventoryBasic.setInventorySlotContents(InventoryBasic.java:152)
at net.minecraft.inventory.Slot.putStack(Slot.java:97)
at net.minecraft.inventory.Container.slotClick(Container.java:298)
at net.minecraft.client.multiplayer.PlayerControllerMP.windowClick(PlayerControllerMP.java:594)
at net.minecraft.client.gui.inventory.GuiContainer.handleMouseClick(GuiContainer.java:687)
at net.minecraft.client.gui.inventory.GuiContainer.mouseReleased(GuiContainer.java:643)
at net.minecraft.client.gui.GuiScreen.handleMouseInput(GuiScreen.java:621)
at net.minecraft.client.gui.GuiScreen.handleInput(GuiScreen.java:576)

-- Affected screen --
Details:
Screen name: net.minecraft.client.gui.GuiRepair

-- Affected level --
Details:
Level name: MpServer
All players: 1 total; [EntityPlayerSP['Player31'/1, l='MpServer', x=-8,15, y=7,00, z=-1,32]]
Chunk stats: MultiplayerChunkCache: 169, 169
Level seed: 0
Level generator: ID 01 - flat, ver 0. Features enabled: false
Level generator options: 
Level spawn location: World: (8,4,, Chunk: (at 8,0,8 in 0,0; contains blocks 0,0,0 to 15,255,15), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
Level time: 63937 game time, 63937 day time
Level dimension: 0
Level storage version: 0x00000 - Unknown?
Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false
Forced entities: 1 total; [EntityPlayerSP['Player31'/1, l='MpServer', x=-8,15, y=7,00, z=-1,32]]
Retry entities: 0 total; []
Server brand: fml,forge
Server type: Integrated singleplayer server
Stacktrace:
at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:451)
at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2772)
at net.minecraft.client.Minecraft.run(Minecraft.java:426)
at net.minecraft.client.main.Main.main(Main.java:118)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
at GradleStart.main(GradleStart.java:26)

-- System Details --
Details:
Minecraft Version: 1.11
Operating System: Windows 10 (amd64) version 10.0
Java Version: 1.8.0_111, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 1814375584 bytes (1730 MB) / 2130051072 bytes (2031 MB) up to 2130051072 bytes (2031 MB)
JVM Flags: 3 total; -Xincgc -Xmx2048M -Xms2048M
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP 9.35 Powered by Forge 13.19.1.2189 5 mods loaded, 5 mods active
States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
UCHIJAAAA	mcp{9.19} [Minecraft Coder Pack] (minecraft.jar) 
UCHIJAAAA	FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.11-13.19.1.2189.jar) 
UCHIJAAAA	forge{13.19.1.2189} [Minecraft Forge] (forgeSrc-1.11-13.19.1.2189.jar) 
UCHIJAAAA	archeology{0.0.0 (Alpha)} [Archeology] (bin) 
UCHIJAAAA	jei{4.1.1.208} [Just Enough Items] (jei_1.11-4.1.1.208.jar) 
Loaded coremods (and transformers): 
GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.5.0 NVIDIA 369.09' Renderer: 'GeForce GT 610/PCIe/SSE2'
Launched Version: 1.11
LWJGL: 2.9.4
OpenGL: GeForce GT 610/PCIe/SSE2 GL version 4.5.0 NVIDIA 369.09, NVIDIA Corporation
GL Caps: Using GL 1.3 multitexturing.
Using GL 1.3 texture combiners.
Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
Shaders are available because OpenGL 2.1 is supported.
VBOs are available because OpenGL 1.5 is supported.

Using VBOs: Yes
Is Modded: Definitely; Client brand changed to 'fml,forge'
Type: Client (map_client.txt)
Resource Packs: 
Current Language: English (US)
Profiler Position: N/A (disabled)
CPU: 2x Pentium(R) Dual-Core CPU E5700 @ 3.00GHz
[16:38:25] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:600]: #@!@# Game crashed! Crash report saved to: #@!@# C:\Users\Villfuk\Desktop\ancient\run\.\crash-reports\crash-2017-01-26_16.38.25-client.txt
AL lib: (EE) alc_cleanup: 1 device not closed
Java HotSpot(TM) 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share




×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.