Non résolu Comment créer une plante cultivable de 2 blocs de haut ?
-
Bonjour,
J’aimerai savoir si c’est possible de créer une plante cultivable de 2 blocs de haut à la manière des rosiers ou des tournesols…
j’utilise la version forge-1.7.10-10.13.4.1558 de forge…
J’espère avoir une réponse qui puisse m’aider…
Merci d’avance
-
Bonjour !
Utilise la classe des Cannes a sucres (Reeds).
Tu as juste a ajuster le code pour une hauteur de 2 au lieu de 4. -
Merci c’est déja une base…
mais est-ce que je peux faire en sorte que ça pousse comme du blé (texture qui change) ?
-
Regarde sur le forum, tu trouveras sûrement un tuto sur les métadatas
-
Je pense avoir réussi mon bloc de culture, mais mon jeu crash dès que je tente de planter ma graine…
Voilà mon rapport de crash :
[22:02:16] [Server thread/INFO]: Changing view distance to 9, from 10 [22:02:17] [Netty Client IO #0/INFO] [FML]: Server protocol version 2 [22:02:17] [Netty IO #1/INFO] [FML]: Client protocol version 2 [22:02:17] [Netty IO #1/INFO] [FML]: Client attempting to join with 4 mods : FML@7.10.99.99,plantsandfoodpack@1.0.0,Forge@10.13.4.1558,mcp@9.05 [22:02:17] [Netty IO #1/INFO] [FML]: Attempting connection with missing mods [] at CLIENT [22:02:17] [Netty Client IO #0/INFO] [FML]: Attempting connection with missing mods [] at SERVER [22:02:17] [Server thread/INFO] [FML]: [Server thread] Server side modded connection established [22:02:17] [Client thread/INFO] [FML]: [Client thread] Client side modded connection established [22:02:17] [Server thread/INFO]: themoney158[local:E:4b502657] logged in with entity id 379 at (2.7419429056527176, 68.0, 308.69999998807907) [22:02:17] [Server thread/INFO]: themoney158 a rejoint la partie [22:02:17] [Server thread/INFO]: Saving and pausing game... [22:02:17] [Server thread/INFO]: Saving chunks for level 'TEST 1'/Overworld [22:02:18] [Server thread/INFO]: Saving chunks for level 'TEST 1'/Nether [22:02:18] [Server thread/INFO]: Saving chunks for level 'TEST 1'/The End [22:02:28] [Server thread/INFO]: Stopping server [22:02:28] [Server thread/INFO]: Saving players [22:02:28] [Client thread/FATAL]: Unreported exception thrown! java.lang.NullPointerException at net.minecraft.block.BlockDoublePlant.func_149888_a(BlockDoublePlant.java:149) ~[BlockDoublePlant.class:?] at net.minecraft.client.renderer.RenderBlocks.renderBlockDoublePlant(RenderBlocks.java:3767) ~[RenderBlocks.class:?] at net.minecraft.client.renderer.RenderBlocks.renderBlockByRenderType(RenderBlocks.java:352) ~[RenderBlocks.class:?] at net.minecraft.client.renderer.WorldRenderer.updateRenderer(WorldRenderer.java:207) ~[WorldRenderer.class:?] at net.minecraft.client.renderer.RenderGlobal.updateRenderers(RenderGlobal.java:1618) ~[RenderGlobal.class:?] at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1263) ~[EntityRenderer.class:?] at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1087) ~[EntityRenderer.class:?] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1067) ~[Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:962) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_161] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_161] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_161] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_161] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?] at GradleStart.main(Unknown Source) [start/:?] [22:02:28] [Client thread/INFO] [STDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:388]: ---- Minecraft Crash Report ---- // You should try our sister game, Minceraft! Time: 13/06/18 22:02 Description: Unexpected error java.lang.NullPointerException: Unexpected error at net.minecraft.block.BlockDoublePlant.func_149888_a(BlockDoublePlant.java:149) at net.minecraft.client.renderer.RenderBlocks.renderBlockDoublePlant(RenderBlocks.java:3767) at net.minecraft.client.renderer.RenderBlocks.renderBlockByRenderType(RenderBlocks.java:352) at net.minecraft.client.renderer.WorldRenderer.updateRenderer(WorldRenderer.java:207) at net.minecraft.client.renderer.RenderGlobal.updateRenderers(RenderGlobal.java:1618) at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1263) at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1087) at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1067) at net.minecraft.client.Minecraft.run(Minecraft.java:962) at net.minecraft.client.main.Main.main(Main.java:164) 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 net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) at GradleStart.main(Unknown Source) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at net.minecraft.block.BlockDoublePlant.func_149888_a(BlockDoublePlant.java:149) at net.minecraft.client.renderer.RenderBlocks.renderBlockDoublePlant(RenderBlocks.java:3767) at net.minecraft.client.renderer.RenderBlocks.renderBlockByRenderType(RenderBlocks.java:352) at net.minecraft.client.renderer.WorldRenderer.updateRenderer(WorldRenderer.java:207) at net.minecraft.client.renderer.RenderGlobal.updateRenderers(RenderGlobal.java:1618) at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1263) -- Affected level -- Details: Level name: MpServer All players: 1 total; [EntityClientPlayerMP['themoney158'/379, l='MpServer', x=-5,17, y=69,62, z=308,17]] Chunk stats: MultiplayerChunkCache: 361, 361 Level seed: 0 Level generator: ID 00 - default, ver 1. Features enabled: false Level generator options: Level spawn location: World: (28,64,256), Chunk: (at 12,4,0 in 1,16; contains blocks 16,0,256 to 31,255,271), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511) Level time: 745115 game time, 192377 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: survival (ID 0). Hardcore: false. Cheats: false Forced entities: 121 total; [EntityPig['Cochon'/49, l='MpServer', x=-85,16, y=67,00, z=271,69], EntityBat['Chauve-souris'/51, l='MpServer', x=-76,88, y=56,17, z=316,75], EntityBat['Chauve-souris'/52, l='MpServer', x=-82,25, y=55,00, z=313,25], EntityCow['Vache'/53, l='MpServer', x=-80,75, y=72,00, z=334,66], EntitySkeleton['Squelette'/57, l='MpServer', x=-66,75, y=53,00, z=313,34], EntitySkeleton['Squelette'/58, l='MpServer', x=-76,16, y=52,00, z=316,25], EntitySkeleton['Squelette'/59, l='MpServer', x=-69,22, y=54,00, z=317,28], EntitySkeleton['Squelette'/60, l='MpServer', x=-65,25, y=53,00, z=315,16], EntityCreeper['Creeper'/61, l='MpServer', x=-69,50, y=54,00, z=320,50], EntityChicken['Poule'/62, l='MpServer', x=-65,47, y=69,00, z=332,56], EntitySkeleton['Squelette'/63, l='MpServer', x=-70,50, y=37,00, z=349,50], EntityZombie['Zombie'/64, l='MpServer', x=-69,50, y=36,00, z=353,50], EntityZombie['Zombie'/73, l='MpServer', x=-61,09, y=33,00, z=257,47], EntitySkeleton['Squelette'/74, l='MpServer', x=-56,50, y=33,00, z=257,50], EntityPig['Cochon'/75, l='MpServer', x=-61,09, y=69,00, z=252,03], EntitySpider['Araignée'/76, l='MpServer', x=-56,50, y=68,00, z=280,50], EntityCow['Vache'/77, l='MpServer', x=-62,94, y=68,00, z=291,16], EntityCow['Vache'/78, l='MpServer', x=-50,31, y=68,00, z=290,22], EntityBat['Chauve-souris'/79, l='MpServer', x=-47,82, y=49,00, z=318,44], EntitySkeleton['Squelette'/80, l='MpServer', x=-55,50, y=15,00, z=332,50], EntityCreeper['Creeper'/81, l='MpServer', x=-56,50, y=15,00, z=329,50], EntityCreeper['Creeper'/82, l='MpServer', x=-57,50, y=15,00, z=329,50], EntityCreeper['Creeper'/83, l='MpServer', x=-57,50, y=15,00, z=328,50], EntitySpider['Araignée'/84, l='MpServer', x=-50,34, y=16,00, z=334,44], EntityPig['Cochon'/85, l='MpServer', x=-58,81, y=69,00, z=334,88], EntityCow['Vache'/86, l='MpServer', x=-51,31, y=69,00, z=323,53], EntityPig['Cochon'/87, l='MpServer', x=-63,06, y=66,00, z=344,03], EntityPig['Cochon'/88, l='MpServer', x=-55,32, y=65,00, z=341,51], EntityZombie['Zombie'/89, l='MpServer', x=-60,13, y=67,00, z=336,59], EntityPig['Cochon'/90, l='MpServer', x=-61,65, y=64,00, z=357,22], EntityPig['Cochon'/91, l='MpServer', x=-59,41, y=70,00, z=387,31], EntitySheep['Mouton'/99, l='MpServer', x=-33,63, y=67,00, z=231,53], EntityCow['Vache'/100, l='MpServer', x=-35,09, y=67,00, z=240,88], EntityCreeper['Creeper'/101, l='MpServer', x=-43,91, y=17,00, z=279,56], EntityCreeper['Creeper'/102, l='MpServer', x=-45,50, y=68,00, z=287,50], EntitySkeleton['Squelette'/103, l='MpServer', x=-33,53, y=48,00, z=297,84], EntityCreeper['Creeper'/104, l='MpServer', x=-33,50, y=47,00, z=312,50], EntityBat['Chauve-souris'/105, l='MpServer', x=-45,40, y=30,77, z=302,74], EntityBat['Chauve-souris'/106, l='MpServer', x=-33,31, y=48,10, z=306,69], EntitySkeleton['Squelette'/107, l='MpServer', x=-53,50, y=17,00, z=321,90], EntityCow['Vache'/108, l='MpServer', x=-37,88, y=64,00, z=350,09], EntityCow['Vache'/109, l='MpServer', x=-43,75, y=64,00, z=353,63], EntityPig['Cochon'/110, l='MpServer', x=-40,28, y=68,00, z=356,13], EntityCreeper['Creeper'/111, l='MpServer', x=-33,50, y=24,00, z=382,00], EntityPig['Cochon'/117, l='MpServer', x=-20,03, y=66,00, z=230,84], EntitySkeleton['Squelette'/118, l='MpServer', x=-21,53, y=50,00, z=248,84], EntitySkeleton['Squelette'/119, l='MpServer', x=-27,91, y=49,00, z=254,91], EntitySpider['Araignée'/120, l='MpServer', x=-26,97, y=49,00, z=252,63], EntitySpider['Araignée'/121, l='MpServer', x=-30,34, y=49,00, z=253,56], EntityBat['Chauve-souris'/122, l='MpServer', x=-27,45, y=52,88, z=252,06], EntityBat['Chauve-souris'/123, l='MpServer', x=-20,32, y=50,14, z=253,49], EntityClientPlayerMP['themoney158'/379, l='MpServer', x=-5,17, y=69,62, z=308,17], EntityCow['Vache'/124, l='MpServer', x=-10,47, y=68,00, z=257,85], EntitySkeleton['Squelette'/125, l='MpServer', x=-19,47, y=66,00, z=252,88], EntitySkeleton['Squelette'/126, l='MpServer', x=-23,50, y=19,00, z=258,50], EntitySkeleton['Squelette'/127, l='MpServer', x=-21,69, y=40,00, z=252,50], EntityCreeper['Creeper'/128, l='MpServer', x=-21,31, y=33,00, z=280,97], EntityCreeper['Creeper'/129, l='MpServer', x=-21,69, y=33,00, z=282,69], EntityCow['Vache'/130, l='MpServer', x=-27,50, y=69,00, z=349,50], EntitySkeleton['Squelette'/134, l='MpServer', x=-14,50, y=11,00, z=239,50], EntitySheep['Mouton'/135, l='MpServer', x=-13,06, y=64,00, z=228,09], EntityPig['Cochon'/136, l='MpServer', x=-2,84, y=64,00, z=230,28], EntityBat['Chauve-souris'/137, l='MpServer', x=-21,69, y=35,82, z=246,79], EntitySkeleton['Squelette'/138, l='MpServer', x=-1,09, y=22,00, z=281,47], EntitySkeleton['Squelette'/139, l='MpServer', x=-20,38, y=52,00, z=298,83], EntityCreeper['Creeper'/140, l='MpServer', x=-6,31, y=54,00, z=305,47], EntitySpider['Araignée'/141, l='MpServer', x=-12,59, y=20,00, z=325,81], EntityCreeper['Creeper'/142, l='MpServer', x=-4,50, y=31,00, z=339,50], EntityZombie['Zombie'/143, l='MpServer', x=-0,25, y=36,00, z=348,63], EntityCow['Vache'/144, l='MpServer', x=-0,16, y=66,00, z=348,94], EntityBat['Chauve-souris'/145, l='MpServer', x=-13,35, y=28,70, z=356,54], EntityBat['Chauve-souris'/146, l='MpServer', x=-3,45, y=26,63, z=363,53], EntitySpider['Araignée'/147, l='MpServer', x=-6,28, y=41,00, z=369,19], EntityCow['Vache'/148, l='MpServer', x=-0,47, y=68,00, z=383,63], EntitySpider['Araignée'/163, l='MpServer', x=9,66, y=63,00, z=230,00], EntityZombie['Zombie'/164, l='MpServer', x=11,75, y=63,00, z=229,84], EntitySpider['Araignée'/166, l='MpServer', x=4,50, y=26,00, z=269,50], EntityCreeper['Creeper'/167, l='MpServer', x=10,53, y=26,00, z=274,03], EntityZombie['Zombie'/168, l='MpServer', x=0,50, y=24,00, z=287,50], EntityCreeper['Creeper'/169, l='MpServer', x=9,25, y=18,00, z=297,06], EntityBat['Chauve-souris'/170, l='MpServer', x=3,25, y=52,10, z=289,75], EntityBat['Chauve-souris'/171, l='MpServer', x=8,75, y=31,10, z=314,75], EntityCreeper['Creeper'/172, l='MpServer', x=22,03, y=39,00, z=322,56], EntityBat['Chauve-souris'/173, l='MpServer', x=1,56, y=50,10, z=327,25], EntitySkeleton['Squelette'/174, l='MpServer', x=4,25, y=32,00, z=344,78], EntityZombie['Zombie'/175, l='MpServer', x=4,09, y=37,00, z=342,59], EntityZombie['Zombie'/176, l='MpServer', x=0,69, y=36,00, z=346,47], EntityCow['Vache'/177, l='MpServer', x=15,47, y=79,00, z=346,53], EntitySpider['Araignée'/178, l='MpServer', x=5,91, y=39,00, z=365,66], EntityCreeper['Creeper'/179, l='MpServer', x=8,33, y=38,00, z=360,76], EntityPig['Cochon'/184, l='MpServer', x=15,03, y=63,00, z=386,97], EntityZombie['Zombie'/443, l='MpServer', x=72,50, y=24,00, z=346,50], EntityZombie['Zombie'/444, l='MpServer', x=65,63, y=23,00, z=350,13], EntitySheep['Mouton'/201, l='MpServer', x=29,34, y=63,00, z=234,34], EntityPig['Cochon'/202, l='MpServer', x=30,84, y=63,00, z=235,53], EntityPig['Cochon'/203, l='MpServer', x=16,59, y=63,00, z=236,31], EntityCreeper['Creeper'/204, l='MpServer', x=26,53, y=39,00, z=242,38], EntityZombie['Zombie'/205, l='MpServer', x=29,50, y=37,00, z=240,50], EntityZombie['Zombie'/206, l='MpServer', x=22,78, y=40,00, z=245,50], EntityCreeper['Creeper'/207, l='MpServer', x=27,50, y=38,00, z=242,34], EntityPig['Cochon'/208, l='MpServer', x=28,31, y=58,00, z=244,53], EntityCow['Vache'/209, l='MpServer', x=16,53, y=79,00, z=346,47], EntityCow['Vache'/210, l='MpServer', x=24,47, y=71,00, z=354,53], EntityPig['Cochon'/212, l='MpServer', x=16,94, y=64,00, z=384,06], EntityZombie['Zombie'/221, l='MpServer', x=36,03, y=30,00, z=229,50], EntityPig['Cochon'/222, l='MpServer', x=37,06, y=63,00, z=238,75], EntityPig['Cochon'/223, l='MpServer', x=43,03, y=64,00, z=229,16], EntityPig['Cochon'/224, l='MpServer', x=34,22, y=70,00, z=277,13], EntityZombie['Zombie'/225, l='MpServer', x=33,50, y=47,00, z=373,50], EntityZombie['Zombie'/226, l='MpServer', x=29,50, y=46,00, z=374,25], EntityPig['Cochon'/230, l='MpServer', x=63,53, y=78,00, z=245,31], EntityPig['Cochon'/231, l='MpServer', x=59,59, y=74,00, z=277,75], EntityPig['Cochon'/232, l='MpServer', x=53,22, y=75,00, z=282,09], EntityZombie['Zombie'/233, l='MpServer', x=58,50, y=32,00, z=336,50], EntityPig['Cochon'/234, l='MpServer', x=50,69, y=69,00, z=366,50], EntityPig['Cochon'/246, l='MpServer', x=74,06, y=76,00, z=250,06], EntityPig['Cochon'/247, l='MpServer', x=72,78, y=75,00, z=281,66], EntityBat['Chauve-souris'/248, l='MpServer', x=75,77, y=41,39, z=312,53], EntityPig['Cochon'/249, l='MpServer', x=68,72, y=66,00, z=383,13], EntityPig['Cochon'/250, l='MpServer', x=65,69, y=74,00, z=371,50], EntityPig['Cochon'/253, l='MpServer', x=65,31, y=69,00, z=385,50]] Retry entities: 0 total; [] Server brand: fml,forge Server type: Integrated singleplayer server Stacktrace: at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:415) at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2566) at net.minecraft.client.Minecraft.run(Minecraft.java:991) at net.minecraft.client.main.Main.main(Main.java:164) 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 net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) at GradleStart.main(Unknown Source) -- System Details -- Details: Minecraft Version: 1.7.10 Operating System: Windows 10 (amd64) version 10.0 Java Version: 1.8.0_161, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 628674280 bytes (599 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used IntCache: cache: 15, tcache: 0, allocated: 13, tallocated: 95 FML: MCP v9.05 FML v7.10.99.99 Minecraft Forge 10.13.4.1558 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 UCHIJAAAA mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) UCHIJAAAA FML{7.10.99.99} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.4.1558-1.7.10.jar) UCHIJAAAA Forge{10.13.4.1558} [Minecraft Forge] (forgeSrc-1.7.10-10.13.4.1558-1.7.10.jar) UCHIJAAAA plantsandfoodpack{1.0.0} [Plants & Food Pack Mod] (bin) GL info: ' Vendor: 'Intel' Version: '4.3.0 - Build 20.19.15.4549' Renderer: 'Intel(R) HD Graphics 4400' Launched Version: 1.7.10 LWJGL: 2.9.1 OpenGL: Intel(R) HD Graphics 4400 GL version 4.3.0 - Build 20.19.15.4549, Intel GL Caps: Using GL 1.3 multitexturing. Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported. Anisotropic filtering is supported and maximum anisotropy is 16. Shaders are available because OpenGL 2.1 is supported. Is Modded: Definitely; Client brand changed to 'fml,forge' Type: Client (map_client.txt) Resource Packs: [] Current Language: Français (France) Profiler Position: N/A (disabled) Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used Anisotropic Filtering: Off (1) [22:02:28] [Server thread/INFO]: Saving worlds [22:02:28] [Server thread/INFO]: Saving chunks for level 'TEST 1'/Overworld [22:02:28] [Client thread/INFO] [STDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:398]: #@!@# Game crashed! Crash report saved to: #@!@# C:\Users\dominique\Desktop\MODDING MINECRAFT\PlantsAndFoodPack 1.7.10 - by themoney158\eclipse\.\crash-reports\crash-2018-06-13_22.02.28-client.txt [22:02:28] [Client thread/INFO] [FML]: Waiting for the server to terminate/save. [22:02:28] [Server thread/INFO]: Saving chunks for level 'TEST 1'/Nether [22:02:28] [Server thread/INFO]: Saving chunks for level 'TEST 1'/The End [22:02:29] [Server thread/INFO] [FML]: Unloading dimension 0 [22:02:29] [Server thread/INFO] [FML]: Unloading dimension -1 [22:02:29] [Server thread/INFO] [FML]: Unloading dimension 1 [22:02:29] [Server thread/INFO] [FML]: Applying holder lookups [22:02:29] [Server thread/INFO] [FML]: Holder lookups applied [22:02:29] [Client thread/INFO] [FML]: Server terminated. 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
voilà… j’espère que vous pourrez m’aider…
Merci
-
Je pense qu’il faut ça aussi :
Classe principale :
package mod.plantsandfoodpack.common; import net.minecraft.block.Block; import net.minecraft.block.Block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.EnumAction; import net.minecraft.item.Item; import net.minecraft.item.ItemFood; import net.minecraft.item.ItemSeeds; import net.minecraft.item.ItemStack; import net.minecraftforge.common.MinecraftForge; import mod.plantsandfoodpack.proxy.CommonProxy; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; @Mod(modid= "plantsandfoodpack", name="Plants & Food Pack Mod", version ="1.0.0") public class ModPlantsandFoodPack{ public static final String MODID = "plantsandfoodpack"; @Instance(MODID) public static ModPlantsandFoodPack instance; @SidedProxy(clientSide = "mod.plantsandfoodpack.proxy.ClientProxy", serverSide ="mod.plantsandfoodpack.proxy.CommonProxy") public static CommonProxy proxy; public static Item flour, itemTomato, itemTomatoSeeds, itemLettuceSeeds, itemLettuceLeaf, itemCider, whiteMustardSeeds, blackMustardSeeds, itemVinegar, itemSunflowerSeeds, itemMustard, itemSunflowerOil, vinaigrette, itemLettuceSalad; public static Item itemStrawberrySeeds, itemStrawberry, itemTomatoSalad, itemVodka, itemGrapes, itemGrapesSeeds; public static Block blockSugar, blockTomatoCrop, blockLettuceCrop, blockKitchenCupboard, blockFermentator, mustard, blockStrawberryCrop, blockGrapesCrop; StructureGenerator structureGenerator = new StructureGenerator(); @EventHandler public void preInit(FMLPreInitializationEvent event){ blockSugar = new BlockSugar(Material.sand).setBlockName("sugarBlock").setBlockTextureName(MODID + ":sugar_block").setCreativeTab(CreativeTabs.tabBlock).setStepSound(Block.soundTypeSand); blockTomatoCrop = new BlockTomatoCrop().setBlockName("tomatoCrop").setBlockTextureName(MODID + ":tomato_crop"); blockLettuceCrop = new BlockLettuceCrop().setBlockName("lettuceCrop").setBlockTextureName(MODID + ":lettuce_crop"); blockKitchenCupboard = new BlockKitchenCupboard(Material.wood).setBlockName("kitchenCupboard").setCreativeTab(CreativeTabs.tabDecorations).setBlockTextureName(MODID + ":kitchen_cupboard"); blockFermentator = new BlockFermentator().setBlockName("fermentator").setBlockTextureName(MODID + ":fermentator").setCreativeTab(CreativeTabs.tabDecorations); mustard = new BlockMustard(0).setBlockName("mustard").setStepSound(Block.soundTypeGrass); blockStrawberryCrop = new BlockStrawberryCrop().setBlockName("strawberryCrop").setBlockTextureName(MODID + ":strawberry_crop"); blockGrapesCrop = new BlockGrapesCrop().setBlockName("grapesCrop").setBlockTextureName(MODID + ":grapes_crop"); flour = new ItemFlour().setUnlocalizedName("flour").setTextureName(MODID + ":flour").setCreativeTab(CreativeTabs.tabMaterials); itemTomato = new ItemTomato(3, 2.5F, false).setUnlocalizedName("tomato").setTextureName(MODID + ":tomato").setCreativeTab(CreativeTabs.tabFood); itemTomatoSeeds = new ItemSeeds(this.blockTomatoCrop, Blocks.farmland).setUnlocalizedName("tomatoSeed").setTextureName(MODID + ":tomato_seeds").setCreativeTab(CreativeTabs.tabMaterials); itemLettuceLeaf = new ItemFood(2, 1.5F, false).setUnlocalizedName("lettuceLeaf").setTextureName(MODID + ":lettuce_leaf").setCreativeTab(CreativeTabs.tabFood); itemLettuceSeeds = new ItemSeeds(this.blockLettuceCrop, Blocks.farmland).setUnlocalizedName("lettuceSeeds").setTextureName(MODID + ":lettuce_seeds").setCreativeTab(CreativeTabs.tabMaterials); itemCider = new ItemDrink(2, 1.5F, false).setUnlocalizedName("cider").setTextureName(MODID + ":cider").setCreativeTab(CreativeTabs.tabFood); whiteMustardSeeds = new ItemSeeds(mustard, Blocks.grass).setUnlocalizedName("whiteMustardSeeds").setTextureName(MODID + ":white_mustard_seeds").setCreativeTab(CreativeTabs.tabMaterials); blackMustardSeeds = new ItemSeeds(mustard, Blocks.grass).setUnlocalizedName("blackMustardSeeds").setTextureName(MODID + ":black_mustard_seeds").setCreativeTab(CreativeTabs.tabMaterials); itemVinegar = new Item().setUnlocalizedName("vinegar").setTextureName(MODID + ":vinegar").setCreativeTab(CreativeTabs.tabFood); itemSunflowerSeeds = new ItemSeeds(Blocks.double_plant, Blocks.grass).setUnlocalizedName("sunflowerSeeds").setTextureName(MODID + ":sunflower_seeds").setCreativeTab(CreativeTabs.tabMaterials); itemMustard = new ItemFood(2, 1.5F, false).setUnlocalizedName("mustard").setTextureName(MODID + ":mustard").setCreativeTab(CreativeTabs.tabFood); itemSunflowerOil = new Item().setUnlocalizedName("sunflowerOil").setTextureName(MODID + ":sunflower_oil").setCreativeTab(CreativeTabs.tabMaterials); vinaigrette = new ItemDrink(3, 1.5F, false).setUnlocalizedName("vinaigrette").setTextureName(MODID + ":vinaigrette").setCreativeTab(CreativeTabs.tabFood); itemLettuceSalad = new ItemLettuceSalad(4, 2.0F, false).setUnlocalizedName("lettuceSalad").setTextureName(MODID + ":lettuce_salad").setCreativeTab(CreativeTabs.tabFood); itemStrawberrySeeds = new ItemSeeds(blockStrawberryCrop, Blocks.farmland).setUnlocalizedName("strawberrySeeds").setTextureName(MODID + ":strawberry_seeds").setCreativeTab(CreativeTabs.tabMaterials); itemStrawberry = new ItemFood(2, 1.5F, false).setUnlocalizedName("strawberry").setTextureName(MODID + ":strawberry").setCreativeTab(CreativeTabs.tabFood); itemTomatoSalad = new ItemTomatoSalad(4, 3.0F, false).setUnlocalizedName("tomatoSalad").setTextureName(MODID + ":tomato_salad").setCreativeTab(CreativeTabs.tabFood); itemVodka = new ItemDrink(2, 1.5F, false).setUnlocalizedName("vodka").setTextureName(MODID + ":vodka").setCreativeTab(CreativeTabs.tabFood); itemGrapes = new ItemFood(4, 3.0F, false).setUnlocalizedName("grapes").setTextureName(MODID + ":grapes").setCreativeTab(CreativeTabs.tabFood); itemGrapesSeeds = new ItemSeeds(blockGrapesCrop, Blocks.farmland).setUnlocalizedName("grapes_seeds").setTextureName(MODID + ":grapes_seeds").setCreativeTab(CreativeTabs.tabMaterials); GameRegistry.registerBlock(blockSugar, "sugar_block"); GameRegistry.registerBlock(blockTomatoCrop, "tomatoCrop"); GameRegistry.registerBlock(blockLettuceCrop, "lettuceCrop"); GameRegistry.registerBlock(blockKitchenCupboard, "kitchenCupboard"); GameRegistry.registerBlock(blockFermentator, "fermentator"); GameRegistry.registerBlock(mustard, ItemBlockMustard.class, "mustard"); GameRegistry.registerBlock(blockStrawberryCrop, "strawberry_crop"); GameRegistry.registerBlock(blockGrapesCrop, "grapes_crops"); GameRegistry.registerItem(flour, "flour"); GameRegistry.registerItem(itemTomato, "tomato"); GameRegistry.registerItem(itemTomatoSeeds, "tomato_seeds"); GameRegistry.registerItem(itemLettuceLeaf, "lettuce_leaf"); GameRegistry.registerItem(itemLettuceSeeds, "lettuce_seeds"); GameRegistry.registerItem(itemCider, "cider"); GameRegistry.registerItem(whiteMustardSeeds, "white_mustard_seeds"); GameRegistry.registerItem(blackMustardSeeds, "black_mustard_seeds"); GameRegistry.registerItem(itemVinegar, "vinegar"); GameRegistry.registerItem(itemSunflowerSeeds, "sunflower_seeds"); GameRegistry.registerItem(itemMustard, "item_mustard"); GameRegistry.registerItem(itemSunflowerOil, "sunflower_oil"); GameRegistry.registerItem(vinaigrette, "vinaigrette"); GameRegistry.registerItem(itemLettuceSalad, "lettuce_salad"); GameRegistry.registerItem(itemStrawberrySeeds, "strawberry_seeds"); GameRegistry.registerItem(itemStrawberry, "strawberry"); GameRegistry.registerItem(itemTomatoSalad, "tomato_salad"); GameRegistry.registerItem(itemVodka, "vodka"); GameRegistry.registerItem(itemGrapes, "grapes"); GameRegistry.registerItem(itemGrapesSeeds, "grapes_seeds"); GameRegistry.registerWorldGenerator(structureGenerator,0); } @EventHandler public void Init(FMLInitializationEvent event){ GameRegistry.addRecipe(new ItemStack(flour, 1), new Object[] {"*", '*', Items.wheat}); GameRegistry.addRecipe(new ItemStack(blockSugar, 1), new Object[] {"###", "###", "###", '#', Items.sugar}); GameRegistry.addRecipe(new ItemStack(blockKitchenCupboard, 1), new Object[] {"WWW", "W W", "WWW", 'W', Blocks.log}); GameRegistry.addRecipe(new ItemStack(whiteMustardSeeds, 5), new Object[] {"+", '+', new ItemStack(mustard, 1, 0)}); GameRegistry.addRecipe(new ItemStack(blackMustardSeeds, 5), new Object[] {"-", '-', new ItemStack(mustard, 1, 1)}); GameRegistry.addRecipe(new ItemStack(itemSunflowerSeeds, 6), new Object[] {"s", 's', new ItemStack(Blocks.double_plant, 1, 0)}); GameRegistry.addRecipe(new ItemStack(itemSunflowerOil, 1), new Object[] {"SSS", 'S', new ItemStack(itemSunflowerSeeds, 1)}); GameRegistry.addRecipe(new ItemStack(itemMustard, 3), new Object[] {" W ", " M ", "VmO", 'W', Items.water_bucket, 'M', new ItemStack(whiteMustardSeeds), 'V', new ItemStack(itemVinegar), 'm', new ItemStack(blackMustardSeeds), 'O', new ItemStack(itemSunflowerOil)}); GameRegistry.addRecipe(new ItemStack(vinaigrette, 1), new Object[] {"OMO", " V ", 'M', itemMustard, 'O', itemSunflowerOil, 'V', itemVinegar}); GameRegistry.addRecipe(new ItemStack(itemLettuceSalad, 1), new Object[] {" V ", "LLL", " B ", 'V', vinaigrette, 'L', itemLettuceLeaf, 'B', Items.bowl}); GameRegistry.addRecipe(new ItemStack(itemStrawberrySeeds), new Object[] {"5", '5', itemStrawberry}); GameRegistry.addRecipe(new ItemStack(itemTomatoSalad, 1), new Object[] {" V ", "TTT", " B ", 'V', vinaigrette, 'T', itemTomato, 'B', Items.bowl}); GameRegistry.registerTileEntity(TileEntityKitchenCupboard.class, MODID + ":kitchenCupboard"); GameRegistry.registerTileEntity(TileEntityFermentator.class, MODID + ":MachineTutoTileEntity"); proxy.registerRender(); MinecraftForge.addGrassSeed(new ItemStack(itemTomatoSeeds), 12); MinecraftForge.addGrassSeed(new ItemStack(itemLettuceSeeds), 13); MinecraftForge.addGrassSeed(new ItemStack(itemStrawberrySeeds), 20); MinecraftForge.addGrassSeed(new ItemStack(itemGrapesSeeds), 40); NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandlerPlantsAndFoodPack()); } @EventHandler public void postInit(FMLPostInitializationEvent event){ } }
Et la classe de ma culture :
package mod.plantsandfoodpack.common; import java.util.Random; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.BlockDoublePlant; import net.minecraft.block.IGrowable; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; public class BlockGrapesCrop extends BlockDoublePlant implements IGrowable { protected int maxGrowthStage = 5; @SideOnly(Side.CLIENT) private IIcon[] doublePlantBottomIcons; @SideOnly(Side.CLIENT) private IIcon[] doublePlantTopIcons; public BlockGrapesCrop() { setTickRandomly(true); float f = 0.5F; setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); this.setHardness(0.0F); this.setStepSound(soundTypeGrass); this.setBlockName("grapesCrop"); disableStats(); } @Override protected boolean canPlaceBlockOn(Block block) { return block == Blocks.farmland; } public void incrementGrowStage(World parWorld, Random parRand, int parX, int parY, int parZ) { int growStage = parWorld.getBlockMetadata(parX, parY, parZ) + MathHelper.getRandomIntegerInRange(parRand, 2, 5); if (growStage > maxGrowthStage) { growStage = maxGrowthStage; } parWorld.setBlockMetadataWithNotify(parX, parY, parZ, growStage, 2); } public static boolean func_149887_c(int p_149887_0_) { return (p_149887_0_ & 8) != 0; } @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int p_149691_1_, int metadata) { return func_149887_c(metadata) ? this.doublePlantBottomIcons[metadata] : this.doublePlantBottomIcons[metadata]; } protected Item func_149866_i() { return ModPlantsandFoodPack.itemGrapesSeeds; } protected Item func_149865_P() { return ModPlantsandFoodPack.itemGrapes; } @Override public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { return p_149650_1_ == 5 ? this.func_149865_P() : this.func_149866_i(); } @Override public int quantityDropped(int meta, int fortune, Random random) { return meta == 5 ? 4 : 1; } @Override public boolean func_149851_a(World parWorld, int parX, int parY, int parZ, boolean p_149851_5_) { return parWorld.getBlockMetadata(parX, parY, parZ) != 5; } @Override public boolean func_149852_a(World p_149852_1_, Random parRand, int p_149852_3_, int p_149852_4_, int p_149852_5_) { return true; } @SideOnly(Side.CLIENT) public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) { return this.func_149866_i(); } @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister parIIconRegister) { doublePlantBottomIcons = new IIcon[maxGrowthStage+1]; doublePlantTopIcons = new IIcon[maxGrowthStage+1]; doublePlantBottomIcons[0] = parIIconRegister.registerIcon(ModPlantsandFoodPack.MODID + ":grapes_bottom_stage_0"); doublePlantBottomIcons[1] = parIIconRegister.registerIcon(ModPlantsandFoodPack.MODID + ":grapes_bottom_stage_1"); doublePlantBottomIcons[2] = parIIconRegister.registerIcon(ModPlantsandFoodPack.MODID + ":grapes_bottom_stage_2"); doublePlantBottomIcons[3] = parIIconRegister.registerIcon(ModPlantsandFoodPack.MODID + ":grapes_bottom_stage_3"); doublePlantBottomIcons[4] = parIIconRegister.registerIcon(ModPlantsandFoodPack.MODID + ":grapes_bottom_stage_4"); doublePlantBottomIcons[5] = parIIconRegister.registerIcon(ModPlantsandFoodPack.MODID + ":grapes_bottom_stage_5"); doublePlantTopIcons[0] = parIIconRegister.registerIcon(ModPlantsandFoodPack.MODID + ":grapes_top_stage_0"); doublePlantTopIcons[1] = parIIconRegister.registerIcon(ModPlantsandFoodPack.MODID + ":grapes_top_stage_1"); doublePlantTopIcons[2] = parIIconRegister.registerIcon(ModPlantsandFoodPack.MODID + ":grapes_top_stage_2"); doublePlantTopIcons[3] = parIIconRegister.registerIcon(ModPlantsandFoodPack.MODID + ":grapes_top_stage_3"); doublePlantTopIcons[4] = parIIconRegister.registerIcon(ModPlantsandFoodPack.MODID + ":grapes_top_stage_4"); doublePlantTopIcons[5] = parIIconRegister.registerIcon(ModPlantsandFoodPack.MODID + ":grapes_top_stage_5"); } @Override public void func_149853_b(World parWorld, Random parRand, int parX, int parY, int parZ) { incrementGrowStage(parWorld, parRand, parX, parY, parZ); } }
Je me suis inspiré du tutoriel de Jabelar : http://jabelarminecraft.blogspot.com/p/minecraft-forge-172-creating-custom.html
-
As-tu regardé le tutoriel de robin sur comment lire un crash report et sa stacktrace? Car là l’erreur est très évidente et probablement facile à résoudre, là voici d’ailleurs:
java.lang.NullPointerException
at net.minecraft.block.BlockDoublePlant.func_149888_a(BlockDoublePlant.java:149) ~[BlockDoublePlant.class:?] -
En fait j’avais déja réussi à réparer l’érreur…
Mais maintenant ma plante apparait mais seulement la partie du bas…
je n’arrive pas à faire apparaitre la partie du haut…
voici la classe :
package mod.plantsandfoodpack.common; import java.util.Random; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.BlockDoublePlant; import net.minecraft.block.IGrowable; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.stats.StatList; import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class BlockGrapesCrop extends BlockDoublePlant implements IGrowable { protected int maxGrowthStage = 5; @SideOnly(Side.CLIENT) private IIcon[] doublePlantBottomIcons; @SideOnly(Side.CLIENT) private IIcon[] doublePlantTopIcons; public BlockGrapesCrop() { setTickRandomly(true); float f = 0.5F; setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); this.setHardness(0.0F); this.setStepSound(soundTypeGrass); this.setBlockName("grapesCrop"); disableStats(); } public int getRenderType() { return 40; } public int func_149885_e(IBlockAccess p_149885_1_, int p_149885_2_, int p_149885_3_, int p_149885_4_) { int l = p_149885_1_.getBlockMetadata(p_149885_2_, p_149885_3_, p_149885_4_); return !func_149887_c(l) ? l & 7 : p_149885_1_.getBlockMetadata(p_149885_2_, p_149885_3_ - 1, p_149885_4_) & 7; } @Override protected boolean canPlaceBlockOn(Block block) { return block == Blocks.farmland; } public void incrementGrowStage(World parWorld, Random parRand, int parX, int parY, int parZ) { int growStage = parWorld.getBlockMetadata(parX, parY, parZ) + MathHelper.getRandomIntegerInRange(parRand, 2, 5); if (growStage > maxGrowthStage) { growStage = maxGrowthStage; } parWorld.setBlockMetadataWithNotify(parX, parY, parZ, growStage, 2); } public boolean canPlaceBlockAt(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_) { return super.canPlaceBlockAt(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_) && p_149742_1_.isAirBlock(p_149742_2_, p_149742_3_ + 1, p_149742_4_); } protected void checkAndDropBlock(World p_149855_1_, int p_149855_2_, int p_149855_3_, int p_149855_4_) { if (!this.canBlockStay(p_149855_1_, p_149855_2_, p_149855_3_, p_149855_4_)) { int l = p_149855_1_.getBlockMetadata(p_149855_2_, p_149855_3_, p_149855_4_); if (!func_149887_c(l)) { this.dropBlockAsItem(p_149855_1_, p_149855_2_, p_149855_3_, p_149855_4_, l, 0); if (p_149855_1_.getBlock(p_149855_2_, p_149855_3_ + 1, p_149855_4_) == this) { p_149855_1_.setBlock(p_149855_2_, p_149855_3_ + 1, p_149855_4_, Blocks.air, 0, 2); } } p_149855_1_.setBlock(p_149855_2_, p_149855_3_, p_149855_4_, Blocks.air, 0, 2); } } public boolean canBlockStay(World p_149718_1_, int p_149718_2_, int p_149718_3_, int p_149718_4_) { if (p_149718_1_.getBlock(p_149718_2_, p_149718_3_, p_149718_4_) != this) return super.canBlockStay(p_149718_1_, p_149718_2_, p_149718_3_, p_149718_4_); //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check. int l = p_149718_1_.getBlockMetadata(p_149718_2_, p_149718_3_, p_149718_4_); return func_149887_c(l) ? p_149718_1_.getBlock(p_149718_2_, p_149718_3_ - 1, p_149718_4_) == this : p_149718_1_.getBlock(p_149718_2_, p_149718_3_ + 1, p_149718_4_) == this && super.canBlockStay(p_149718_1_, p_149718_2_, p_149718_3_, p_149718_4_); } public static boolean func_149887_c(int p_149887_0_) { return (p_149887_0_ & 8) != 0; } public static int func_149890_d(int p_149890_0_) { return p_149890_0_ & 7; } @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int p_149691_1_, int metadata) { return func_149887_c(metadata) ? this.doublePlantBottomIcons[metadata] : this.doublePlantBottomIcons[metadata]; } @SideOnly(Side.CLIENT) public IIcon func_149888_a(boolean p_149888_1_, int metadata) { return p_149888_1_ ? this.doublePlantTopIcons[metadata] : this.doublePlantBottomIcons[metadata]; } @SideOnly(Side.CLIENT) public int colorMultiplier(IBlockAccess p_149720_1_, int p_149720_2_, int p_149720_3_, int p_149720_4_) { int l = this.func_149885_e(p_149720_1_, p_149720_2_, p_149720_3_, p_149720_4_); return l != 2 && l != 3 ? 16777215 : p_149720_1_.getBiomeGenForCoords(p_149720_2_, p_149720_4_).getBiomeGrassColor(p_149720_2_, p_149720_3_, p_149720_4_); } @Override public void func_149889_c(World p_149889_1_, int p_149889_2_, int p_149889_3_, int p_149889_4_, int p_149889_5_, int p_149889_6_) { p_149889_1_.setBlock(p_149889_2_, p_149889_3_, p_149889_4_, this, p_149889_5_, p_149889_6_); p_149889_1_.setBlock(p_149889_2_, p_149889_3_ + 1, p_149889_4_, this, 8, p_149889_6_); } public void onBlockHarvested(World p_149681_1_, int p_149681_2_, int p_149681_3_, int p_149681_4_, int p_149681_5_, EntityPlayer p_149681_6_) { if (func_149887_c(p_149681_5_)) { if (p_149681_1_.getBlock(p_149681_2_, p_149681_3_ - 1, p_149681_4_) == this) { if (!p_149681_6_.capabilities.isCreativeMode) { int i1 = p_149681_1_.getBlockMetadata(p_149681_2_, p_149681_3_ - 1, p_149681_4_); int j1 = func_149890_d(i1); if (j1 != 3 && j1 != 2) { p_149681_1_.func_147480_a(p_149681_2_, p_149681_3_ - 1, p_149681_4_, true); } else { if (!p_149681_1_.isRemote && p_149681_6_.getCurrentEquippedItem() != null && p_149681_6_.getCurrentEquippedItem().getItem() == Items.shears) { this.func_149886_b(p_149681_1_, p_149681_2_, p_149681_3_, p_149681_4_, i1, p_149681_6_); } p_149681_1_.setBlockToAir(p_149681_2_, p_149681_3_ - 1, p_149681_4_); } } else { p_149681_1_.setBlockToAir(p_149681_2_, p_149681_3_ - 1, p_149681_4_); } } } else if (p_149681_6_.capabilities.isCreativeMode && p_149681_1_.getBlock(p_149681_2_, p_149681_3_ + 1, p_149681_4_) == this) { p_149681_1_.setBlock(p_149681_2_, p_149681_3_ + 1, p_149681_4_, Blocks.air, 0, 2); } super.onBlockHarvested(p_149681_1_, p_149681_2_, p_149681_3_, p_149681_4_, p_149681_5_, p_149681_6_); } private boolean func_149886_b(World p_149886_1_, int p_149886_2_, int p_149886_3_, int p_149886_4_, int p_149886_5_, EntityPlayer p_149886_6_) { int i1 = func_149890_d(p_149886_5_); if (i1 != 3 && i1 != 2) { return false; } else { p_149886_6_.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(this)], 1); byte b0 = 1; if (i1 == 3) { b0 = 2; } return true; } } protected Item func_149866_i() { return ModPlantsandFoodPack.itemGrapesSeeds; } protected Item func_149865_P() { return ModPlantsandFoodPack.itemGrapes; } @Override public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { return p_149650_1_ == 5 ? this.func_149865_P() : this.func_149866_i(); } @Override public int quantityDropped(int meta, int fortune, Random random) { return meta == 5 ? 4 : 1; } public int getDamageValue(World p_149643_1_, int p_149643_2_, int p_149643_3_, int p_149643_4_) { int l = p_149643_1_.getBlockMetadata(p_149643_2_, p_149643_3_, p_149643_4_); return func_149887_c(l) ? func_149890_d(p_149643_1_.getBlockMetadata(p_149643_2_, p_149643_3_ - 1, p_149643_4_)) : func_149890_d(l); } @Override public boolean func_149851_a(World parWorld, int parX, int parY, int parZ, boolean p_149851_5_) { int l = this.func_149885_e(parWorld, parX, parY, parZ); return parWorld.getBlockMetadata(parX, parY, parZ) != 5; } @Override public boolean func_149852_a(World p_149852_1_, Random parRand, int p_149852_3_, int p_149852_4_, int p_149852_5_) { return true; } @SideOnly(Side.CLIENT) public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) { return this.func_149866_i(); } @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister parIIconRegister) { doublePlantBottomIcons = new IIcon[maxGrowthStage+1]; doublePlantTopIcons = new IIcon[maxGrowthStage+1]; doublePlantBottomIcons[0] = parIIconRegister.registerIcon(ModPlantsandFoodPack.MODID + ":grapes_bottom_stage_0"); doublePlantBottomIcons[1] = parIIconRegister.registerIcon(ModPlantsandFoodPack.MODID + ":grapes_bottom_stage_1"); doublePlantBottomIcons[2] = parIIconRegister.registerIcon(ModPlantsandFoodPack.MODID + ":grapes_bottom_stage_2"); doublePlantBottomIcons[3] = parIIconRegister.registerIcon(ModPlantsandFoodPack.MODID + ":grapes_bottom_stage_3"); doublePlantBottomIcons[4] = parIIconRegister.registerIcon(ModPlantsandFoodPack.MODID + ":grapes_bottom_stage_4"); doublePlantBottomIcons[5] = parIIconRegister.registerIcon(ModPlantsandFoodPack.MODID + ":grapes_bottom_stage_5"); doublePlantTopIcons[0] = parIIconRegister.registerIcon(ModPlantsandFoodPack.MODID + ":grapes_top_stage_0"); doublePlantTopIcons[1] = parIIconRegister.registerIcon(ModPlantsandFoodPack.MODID + ":grapes_top_stage_1"); doublePlantTopIcons[2] = parIIconRegister.registerIcon(ModPlantsandFoodPack.MODID + ":grapes_top_stage_2"); doublePlantTopIcons[3] = parIIconRegister.registerIcon(ModPlantsandFoodPack.MODID + ":grapes_top_stage_3"); doublePlantTopIcons[4] = parIIconRegister.registerIcon(ModPlantsandFoodPack.MODID + ":grapes_top_stage_4"); doublePlantTopIcons[5] = parIIconRegister.registerIcon(ModPlantsandFoodPack.MODID + ":grapes_top_stage_5"); } @Override public void func_149853_b(World parWorld, Random parRand, int parX, int parY, int parZ) { int l = this.func_149885_e(parWorld, parX, parY, parZ); incrementGrowStage(parWorld, parRand, parX, parY, parZ); } }
Voilà…
Merci pour votre aide… -
change les dimensions de ton block avec ```java
this.setBlockBounds(0F, 0F, F, 1F, 2F, 1F);
-
Merci !
ça m’affiche bien en jeu que le bloc fait 2 de haut mais la texture de la partie haute ne s’affiche pas
j’espère que vous pourrez m’aider… merci
-
personne ne sait comment m’aider ?..
-
Salut,
Pour faire un bloc dans Minecraft qui prend la place de plusieurs blocs, il faut en placer plusieurs. Il faut donc une classe d’item bloc custom et override la fonction qui gère le clic droit pour faire deux placement de bloc au lieu d’un seul.
Il faudrait assez pouvoir différencier si le bloc est celui du bas ou celui du haut, en général la solution la plus pour cela est d’utiliser des metadatas différents. -
euh… j’ai du mal à suivre…
-
Quel point faut-il détailler ?
S’il te faut du code, tu peux jeter un œil à la porte qui utilise ce principe.
-
ok je vais essayer
-
je comprends rien du tout…
-
j’ai modifié l’item de ma graine en ajoutant les codes présents dans ItemDoor et en essayant de les modifiers et quand je vais en jeu, ça me fait apparaître la plante à n’importe quel stade de croissance et la partie du haut apparaît mais disparait aussitôt…
-
Tu peux envoyer le code de ton item ?
-
Voila !!
La classe de mon Item :
package mod.plantsandfoodpack.common; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemSeeds; import net.minecraft.item.ItemStack; import net.minecraft.util.MathHelper; import net.minecraft.world.World; public class ItemGrapesSeeds extends ItemSeeds { public ItemGrapesSeeds(Block block, Block blockground) { super(block, blockground); } public boolean onItemUse(ItemStack p_77648_1_, EntityPlayer p_77648_2_, World p_77648_3_, int p_77648_4_, int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_) { if(p_77648_7_ !=1) { return false; } else { ++p_77648_5_; Block block = ModPlantsandFoodPack.blockGrapesCrop; if(p_77648_2_.canPlayerEdit(p_77648_4_, p_77648_5_, p_77648_6_, p_77648_7_, p_77648_1_) && p_77648_2_.canPlayerEdit(p_77648_4_, p_77648_5_ + 1, p_77648_6_, p_77648_7_, p_77648_1_)) { if(!block.canPlaceBlockAt(p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_)) { return false; } else { int i1 = MathHelper.floor_double((double)((p_77648_2_.rotationYaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3; placeDoorBlock(p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_, i1, block); --p_77648_1_.stackSize; return true; } } else { return false; } } } public static void placeDoorBlock(World p_150924_0_, int p_150924_1_, int p_150924_2_, int p_150924_3_, int p_150924_4_, Block p_150924_5_) { byte b0 = 0; byte b1 = 0; if (p_150924_4_ == 0) { b1 = 1; } if (p_150924_4_ == 1) { b0 = -1; } if (p_150924_4_ == 2) { b1 = -1; } if (p_150924_4_ == 3) { b0 = 1; } int i1 = (p_150924_0_.getBlock(p_150924_1_ - b0, p_150924_2_, p_150924_3_ - b1).isNormalCube() ? 1 : 0) + (p_150924_0_.getBlock(p_150924_1_ - b0, p_150924_2_ + 1, p_150924_3_ - b1).isNormalCube() ? 1 : 0); int j1 = (p_150924_0_.getBlock(p_150924_1_ + b0, p_150924_2_, p_150924_3_ + b1).isNormalCube() ? 1 : 0) + (p_150924_0_.getBlock(p_150924_1_ + b0, p_150924_2_ + 1, p_150924_3_ + b1).isNormalCube() ? 1 : 0); boolean flag = p_150924_0_.getBlock(p_150924_1_ - b0, p_150924_2_, p_150924_3_ - b1) == p_150924_5_ || p_150924_0_.getBlock(p_150924_1_ - b0, p_150924_2_ + 1, p_150924_3_ - b1) == p_150924_5_; boolean flag1 = p_150924_0_.getBlock(p_150924_1_ + b0, p_150924_2_, p_150924_3_ + b1) == p_150924_5_ || p_150924_0_.getBlock(p_150924_1_ + b0, p_150924_2_ + 1, p_150924_3_ + b1) == p_150924_5_; boolean flag2 = false; if (flag && !flag1) { flag2 = true; } else if (j1 > i1) { flag2 = true; } p_150924_0_.setBlock(p_150924_1_, p_150924_2_, p_150924_3_, p_150924_5_, p_150924_4_, 2); p_150924_0_.setBlock(p_150924_1_, p_150924_2_ + 1, p_150924_3_, p_150924_5_, 8 | (flag2 ? 1 : 0), 2); } }
Et la classe de ma culture (au cas où) :
package mod.plantsandfoodpack.common; import java.util.ArrayList; import java.util.List; import java.util.Random; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.BlockCrops; import net.minecraft.block.BlockDoublePlant; import net.minecraft.block.IGrowable; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.stats.StatList; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class BlockGrapesCrop extends BlockCrops implements IGrowable { protected int maxGrowthStage = 5; @SideOnly(Side.CLIENT) private IIcon[] doublePlantBottomIcons; @SideOnly(Side.CLIENT) private IIcon[] doublePlantTopIcons; public BlockGrapesCrop() { setTickRandomly(true); float f = 0.5F; this.setHardness(0.0F); this.setStepSound(soundTypeGrass); this.setBlockName("grapesCrop"); disableStats(); } public int getRenderType() { return 1; } public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_) { this.setBlockBounds(0F, 0F, 0F, 1F, 2F, 1F); } public int func_149885_e(IBlockAccess p_149885_1_, int p_149885_2_, int p_149885_3_, int p_149885_4_) { int l = p_149885_1_.getBlockMetadata(p_149885_2_, p_149885_3_, p_149885_4_); return !func_149887_c(l) ? l & 7 : p_149885_1_.getBlockMetadata(p_149885_2_, p_149885_3_ - 1, p_149885_4_) & 7; } @Override protected boolean canPlaceBlockOn(Block block) { return block == Blocks.farmland; } public void incrementGrowStage(World parWorld, Random parRand, int parX, int parY, int parZ) { int growStage = parWorld.getBlockMetadata(parX, parY, parZ) + MathHelper.getRandomIntegerInRange(parRand, 2, 5); if (growStage > maxGrowthStage) { growStage = maxGrowthStage; } parWorld.setBlockMetadataWithNotify(parX, parY, parZ, growStage, 2); } public boolean canPlaceBlockAt(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_) { return super.canPlaceBlockAt(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_) && p_149742_1_.isAirBlock(p_149742_2_, p_149742_3_ + 1, p_149742_4_); } protected void checkAndDropBlock(World p_149855_1_, int p_149855_2_, int p_149855_3_, int p_149855_4_) { if (!this.canBlockStay(p_149855_1_, p_149855_2_, p_149855_3_, p_149855_4_)) { int l = p_149855_1_.getBlockMetadata(p_149855_2_, p_149855_3_, p_149855_4_); if (!func_149887_c(l)) { this.dropBlockAsItem(p_149855_1_, p_149855_2_, p_149855_3_, p_149855_4_, l, 0); if (p_149855_1_.getBlock(p_149855_2_, p_149855_3_ + 1, p_149855_4_) == this) { p_149855_1_.setBlock(p_149855_2_, p_149855_3_ + 1, p_149855_4_, Blocks.air, 0, 2); } } p_149855_1_.setBlock(p_149855_2_, p_149855_3_, p_149855_4_, Blocks.air, 0, 2); } } public static boolean func_149887_c(int p_149887_0_) { return (p_149887_0_ & 8) != 0; } public static int func_149890_d(int p_149890_0_) { return p_149890_0_ & 7; } @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int p_149691_1_, int metadata) { if (metadata < 0 || metadata > 5) { metadata = 5; } return func_149887_c(metadata) ? this.doublePlantBottomIcons[metadata] : this.doublePlantBottomIcons[metadata]; } @SideOnly(Side.CLIENT) public IIcon func_149888_a(boolean p_149888_1_, int metadata) { return p_149888_1_ ? this.doublePlantTopIcons[metadata] : this.doublePlantBottomIcons[metadata]; } public void func_149889_c(World p_149889_1_, int p_149889_2_, int p_149889_3_, int p_149889_4_, int p_149889_5_, int p_149889_6_) { p_149889_1_.setBlock(p_149889_2_, p_149889_3_, p_149889_4_, this, p_149889_5_, p_149889_6_); p_149889_1_.setBlock(p_149889_2_, p_149889_3_ + 1, p_149889_4_, this, 8, p_149889_6_); } public void onBlockPlacedBy(World p_149689_1_, int p_149689_2_, int p_149689_3_, int p_149689_4_, EntityLivingBase p_149689_5_, ItemStack p_149689_6_) { int l = ((MathHelper.floor_double((double)(p_149689_5_.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3) + 2) % 4; p_149689_1_.setBlock(p_149689_2_, p_149689_3_ + 1, p_149689_4_, this, 8 | l, 2); } public void onBlockHarvested(World p_149681_1_, int p_149681_2_, int p_149681_3_, int p_149681_4_, int p_149681_5_, EntityPlayer p_149681_6_) { if (func_149887_c(p_149681_5_)) { if (p_149681_1_.getBlock(p_149681_2_, p_149681_3_ - 1, p_149681_4_) == this) { if (!p_149681_6_.capabilities.isCreativeMode) { int i1 = p_149681_1_.getBlockMetadata(p_149681_2_, p_149681_3_ - 1, p_149681_4_); int j1 = func_149890_d(i1); if (j1 != 3 && j1 != 2) { p_149681_1_.func_147480_a(p_149681_2_, p_149681_3_ - 1, p_149681_4_, true); } else { p_149681_1_.setBlockToAir(p_149681_2_, p_149681_3_ - 1, p_149681_4_); } } else { p_149681_1_.setBlockToAir(p_149681_2_, p_149681_3_ - 1, p_149681_4_); } } } else if (p_149681_6_.capabilities.isCreativeMode && p_149681_1_.getBlock(p_149681_2_, p_149681_3_ + 1, p_149681_4_) == this) { p_149681_1_.setBlock(p_149681_2_, p_149681_3_ + 1, p_149681_4_, Blocks.air, 0, 2); } super.onBlockHarvested(p_149681_1_, p_149681_2_, p_149681_3_, p_149681_4_, p_149681_5_, p_149681_6_); } private boolean func_149886_b(World p_149886_1_, int p_149886_2_, int p_149886_3_, int p_149886_4_, int p_149886_5_, EntityPlayer p_149886_6_) { int i1 = func_149890_d(p_149886_5_); if (i1 != 3 && i1 != 2) { return false; } else { p_149886_6_.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(this)], 1); byte b0 = 1; if (i1 == 3) { b0 = 2; } return true; } } protected Item func_149866_i() { return ModPlantsandFoodPack.itemGrapesSeeds; } protected Item func_149865_P() { return ModPlantsandFoodPack.itemGrapes; } @Override public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { return p_149650_1_ == 5 ? this.func_149865_P() : this.func_149866_i(); } @Override public int quantityDropped(int meta, int fortune, Random random) { return meta == 5 ? 4 : 1; } public int getDamageValue(World p_149643_1_, int p_149643_2_, int p_149643_3_, int p_149643_4_) { int l = p_149643_1_.getBlockMetadata(p_149643_2_, p_149643_3_, p_149643_4_); return func_149887_c(l) ? func_149890_d(p_149643_1_.getBlockMetadata(p_149643_2_, p_149643_3_ - 1, p_149643_4_)) : func_149890_d(l); } @Override public boolean func_149851_a(World parWorld, int parX, int parY, int parZ, boolean p_149851_5_) { int l = this.func_149885_e(parWorld, parX, parY, parZ); return parWorld.getBlockMetadata(parX, parY, parZ) != 5; } @Override public boolean func_149852_a(World p_149852_1_, Random parRand, int p_149852_3_, int p_149852_4_, int p_149852_5_) { return true; } @SideOnly(Side.CLIENT) public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) { return this.func_149866_i(); } @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister parIIconRegister) { doublePlantBottomIcons = new IIcon[maxGrowthStage+1]; doublePlantTopIcons = new IIcon[maxGrowthStage+2]; doublePlantBottomIcons[0] = parIIconRegister.registerIcon(ModPlantsandFoodPack.MODID + ":grapes_bottom_stage_0"); doublePlantBottomIcons[1] = parIIconRegister.registerIcon(ModPlantsandFoodPack.MODID + ":grapes_bottom_stage_1"); doublePlantBottomIcons[2] = parIIconRegister.registerIcon(ModPlantsandFoodPack.MODID + ":grapes_bottom_stage_2"); doublePlantBottomIcons[3] = parIIconRegister.registerIcon(ModPlantsandFoodPack.MODID + ":grapes_bottom_stage_3"); doublePlantBottomIcons[4] = parIIconRegister.registerIcon(ModPlantsandFoodPack.MODID + ":grapes_bottom_stage_4"); doublePlantBottomIcons[5] = parIIconRegister.registerIcon(ModPlantsandFoodPack.MODID + ":grapes_bottom_stage_5"); doublePlantTopIcons[0] = parIIconRegister.registerIcon(ModPlantsandFoodPack.MODID + ":grapes_top_stage_0"); doublePlantTopIcons[1] = parIIconRegister.registerIcon(ModPlantsandFoodPack.MODID + ":grapes_top_stage_1"); doublePlantTopIcons[2] = parIIconRegister.registerIcon(ModPlantsandFoodPack.MODID + ":grapes_top_stage_2"); doublePlantTopIcons[3] = parIIconRegister.registerIcon(ModPlantsandFoodPack.MODID + ":grapes_top_stage_3"); doublePlantTopIcons[4] = parIIconRegister.registerIcon(ModPlantsandFoodPack.MODID + ":grapes_top_stage_4"); doublePlantTopIcons[5] = parIIconRegister.registerIcon(ModPlantsandFoodPack.MODID + ":grapes_top_stage_5"); } @SideOnly(Side.CLIENT) public void getSubBlocks(Item p_149666_1_, CreativeTabs p_149666_2_, List p_149666_3_) { for (int i = 0; i < this.doublePlantBottomIcons.length; ++i) { p_149666_3_.add(new ItemStack(p_149666_1_, 1, i)); } } @Override public void func_149853_b(World parWorld, Random parRand, int parX, int parY, int parZ) { int l = this.func_149885_e(parWorld, parX, parY, parZ); incrementGrowStage(parWorld, parRand, parX, parY, parZ); } }
-
L’essentiel c’était d’avoir les deux setBlock.
Comme ceci c’est probablement mieux :package mod.plantsandfoodpack.common; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemSeeds; import net.minecraft.item.ItemStack; import net.minecraft.util.MathHelper; import net.minecraft.world.World; public class ItemGrapesSeeds extends ItemSeeds { public ItemGrapesSeeds(Block block, Block blockground) { super(block, blockground); } public boolean onItemUse(ItemStack p_77648_1_, EntityPlayer p_77648_2_, World p_77648_3_, int p_77648_4_, int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_) { if(p_77648_7_ !=1) { return false; } else { ++p_77648_5_; Block block = ModPlantsandFoodPack.blockGrapesCrop; if(p_77648_2_.canPlayerEdit(p_77648_4_, p_77648_5_, p_77648_6_, p_77648_7_, p_77648_1_) && p_77648_2_.canPlayerEdit(p_77648_4_, p_77648_5_ + 1, p_77648_6_, p_77648_7_, p_77648_1_)) { if(!block.canPlaceBlockAt(p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_)) { return false; } else { p_77648_3_.setBlock(p_77648_4_, p_77648_5_, p_77648_6_, block, 0, 2); p_77648_3_.setBlock(p_77648_4_, p_77648_5_ + 1, p_77648_6_, block, 8, 2); --p_77648_1_.stackSize; return true; } } else { return false; } } } }
Ce qui serait encore mieux, c’est de renommer les p_xxxxx en quelque chose de compréhensible.