Add Custom Items
#1
How to add custom items to Cuberite? i need to add guns and cars. Can i add that?
Reply
Thanks given by:
#2
Items should be possible, entities not so much. In any case, you will need to have a client-side mod as well for those items to actually show up properly - there's no way for a server to push completely new content to the client, it can only reference what the client already has.
Reply
Thanks given by:
#3
Cuberite currently has no way to create custom entities, so cars will probably not be possible anytime soon. However, it doesn't care what item a person is carrying, so with a plugin you should be able to add custom handling for a specific item.
Reply
Thanks given by:
#4
hm... can any give little example ?
Reply
Thanks given by:
#5
It of course depends on what you want an item to do:
function OnPlayerRightClick(a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ)
	if (a_Player:GetEquippedItem().m_ItemType ~= <some custom item id>) then
		return false;
	end
	
	-- Add some custom handling like firing a projectile or something.
end
Don't forget to register the hook using cPluginManager:AddHook
Reply
Thanks given by:
#6
hm... i really badly know lua.,.. so in <some custom item id> i write custom item id from client ? where i installed custom items?

please, how to register the hook using cPluginManager:AddHook? i need more big example, please help me...
Reply
Thanks given by:
#7
I suggest you read the API docs, especially the examples there - it explains what hooks are and how to register them, and includes a full example plugin:
https://api.cuberite.org/
https://api.cuberite.org/Writing-a-Cuberite-plugin.html
Reply
Thanks given by:
#8
so i install flan`s mod and get crash minecraft client with this error


---- Minecraft Crash Report ----
// Ouch. That hurt Sad

Time: 22.03.17 11:25
Description: Rendering item

java.lang.NullPointerException: Rendering item
at net.minecraft.item.ItemStack.func_77960_j(ItemStack.java:235)
at net.minecraft.client.renderer.ItemModelMesher.func_178084_b(ItemModelMesher.java:70)
at net.minecraft.client.renderer.ItemModelMesher.func_178089_a(ItemModelMesher.java:43)
at net.minecraft.client.renderer.entity.RenderItem.func_175042_a(RenderItem.java:359)
at net.minecraft.client.renderer.entity.RenderItem.func_180450_b(RenderItem.java:410)
at net.minecraft.client.gui.GuiIngame.func_175184_a(SourceFile:878)
at net.minecraft.client.gui.GuiIngame.func_180479_a(SourceFile:334)
at net.minecraftforge.client.GuiIngameForge.func_180479_a(GuiIngameForge.java:306)
at net.minecraftforge.client.GuiIngameForge.func_175180_a(GuiIngameForge.java:130)
at net.minecraft.client.renderer.EntityRenderer.func_78480_b(EntityRenderer.java:1059)
at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:1055)
at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:345)
at net.minecraft.client.main.Main.main(SourceFile:120)
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)


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

-- Head --
Stacktrace:
at net.minecraft.item.ItemStack.func_77960_j(ItemStack.java:235)
at net.minecraft.client.renderer.ItemModelMesher.func_178084_b(ItemModelMesher.java:70)
at net.minecraft.client.renderer.ItemModelMesher.func_178089_a(ItemModelMesher.java:43)
at net.minecraft.client.renderer.entity.RenderItem.func_175042_a(RenderItem.java:359)

-- Item being rendered --
Details:
Item Type: null
Item Aux: ~~ERROR~~ NullPointerException: null
Item NBT: null
Item Foil: ~~ERROR~~ NullPointerException: null
Stacktrace:
at net.minecraft.client.renderer.entity.RenderItem.func_180450_b(RenderItem.java:410)
at net.minecraft.client.gui.GuiIngame.func_175184_a(SourceFile:878)
at net.minecraft.client.gui.GuiIngame.func_180479_a(SourceFile:334)
at net.minecraftforge.client.GuiIngameForge.func_180479_a(GuiIngameForge.java:306)
at net.minecraftforge.client.GuiIngameForge.func_175180_a(GuiIngameForge.java:130)

-- Affected level --
Details:
Level name: MpServer
All players: 1 total; [EntityPlayerSP['Boo'/78, l='MpServer', x=8,50, y=65,00, z=8,50]]
Chunk stats: MultiplayerChunkCache: 0, 0
Level seed: 0
Level generator: ID 00 - default, ver 1. Features enabled: false
Level generator options:
Level spawn location: -120,00,62,00,0,00 - World: (-120,62,0), Chunk: (at 8,3,0 in -8,0; contains blocks -128,0,0 to -113,255,15), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)
Level time: 43746 game time, 19745 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['Boo'/78, l='MpServer', x=8,50, y=65,00, z=8,50]]
Retry entities: 0 total; []
Server brand: ~~NULL~~
Server type: Non-integrated multiplayer server
Stacktrace:
at net.minecraft.client.multiplayer.WorldClient.func_72914_a(WorldClient.java:351)
at net.minecraft.client.Minecraft.func_71396_d(Minecraft.java:2502)
at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:367)
at net.minecraft.client.main.Main.main(SourceFile:120)
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)

-- System Details --
Details:
Minecraft Version: 1.8
Operating System: Windows 7 (x86) version 6.1
Java Version: 1.8.0_73, Oracle Corporation
Java VM Version: Java HotSpot™ Client VM (mixed mode), Oracle Corporation
Memory: 260939288 bytes (248 MB) / 513933312 bytes (490 MB) up to 1060372480 bytes (1011 MB)
JVM Flags: 5 total; -Xmx1024M -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:-UseAdaptiveSizePolicy -Xmn128M
IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 95
FML: MCP v9.10 FML v8.0.99.99 Minecraft Forge 11.14.4.1577 4 mods loaded, 4 mods active
States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
UCHIJAAAAAA mcp{9.05} [Minecraft Coder Pack] (minecraft.jar)
UCHIJAAAAAA FML{8.0.99.99} [Forge Mod Loader] (forge-1.8-11.14.4.1577.jar)
UCHIJAAAAAA Forge{11.14.4.1577} [Minecraft Forge] (forge-1.8-11.14.4.1577.jar)
UCHIJAAAAAA flansmod{5.3.1} [Flan's Mod] (Flans_Mod_1.8_5.3.1.jar)
Loaded coremods (and transformers):
GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.5.0 NVIDIA 358.50' Renderer: 'GeForce GT 630/PCIe/SSE2'
Launched Version: Forge 1.8
LWJGL: 2.9.1
OpenGL: GeForce GT 630/PCIe/SSE2 GL version 4.5.0 NVIDIA 358.50, 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: No
Is Modded: Definitely; Client brand changed to 'fml,forge'
Type: Client (map_client.txt)
Resource Packs: []
Current Language: Русский (Россия)
Profiler Position: N/A (disabled)
Reply
Thanks given by:
#9
When does that happen? When joining or when you did a specific action?
Reply
Thanks given by:
#10
when join on cuberite server.
Reply
Thanks given by:




Users browsing this thread: 1 Guest(s)