Résolu Crash/ Bloc rendu avancé collision entité
-
Bien le bonsoir, le bonjour sinon.
Actuellement je met au point un mod d’aménagement urbain (routes avec tracés corrects, feux tricolores, éclairages urbains, je suis preneur d’idées ça me motive à apprendre)
Voilà voilà, donc mon problème qui me fait venir vous voir encore aujourd’hui ce sont mes blocs avec rendu avancé.
Si vous regardez un peu l’historique j’avais eu quelques soucis avec ces blocs mais en cherchant on trouve le/s erreur/s.Une fois testé en solo, j’attrape ma Dirty bike (qui visiblement se sert de montures/chevaux avec un rendu de moto) et je teste pour voir si les collisions sont bonnes.
En solo… Oui.
Sur mon serveur multi… Aïe. Quand la moto touche l’un de mes blocs cela fait crash client instant et le serveur fait de même quasi instantanément.Je cherche tout de suite les fonctions traitant de collisions entre blocs/entité/n’importe quoi tant que ça m’aide et… Noobitude de rang suprême en modding n’aidant pas 4heures de recherches et de tests aussi infructueux que décevants, ça crash toujours.
Voilà je viens tout juste de trouver le F3+B pour afficher les boites de collision et ça me conforte dans mon idée qu’il me manque clairement une fonction de collision.
Alors je vous montre où en est le code d’un bloc type le trophée au sol en jaune:
:::package fr.heroesconflict.modhc.common; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import fr.heroesconflict.modhc.proxy.ClientProxy; public class Trophee extends Block { public Trophee(Material mat) { super(mat); } //Déclaration du bloc trophée dans la classe principale // trophee = new Trophee(Material.rock).setBlockName("trophee").setHardness(10F).setBlockTextureName(MODID + ":trophee").setCreativeTab(Modhc.tabHc2); // GameRegistry.registerBlock(trophee, "trophee"); public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) { this.setBlockBounds(0.2F, 0.0F, 0.2F, 0.8F, 0.95F, 0.8F); } public boolean hasTileEntity(int metadata) { return true; } public TileEntity createTileEntity(World world, int metadata) { return new TileEntityTrophee(); } public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase living, ItemStack stack) { if(stack.getItemDamage() == 0) { TileEntity tile = world.getTileEntity(x, y, z); if(tile instanceof TileEntityTrophee) { int direction = MathHelper.floor_double((double)(living.rotationYaw * 4.0F / 360.0F) + 2.5D) & 3; ((TileEntityTrophee)tile).setDirection((byte)direction); } } } @Override public boolean rotateBlock(World world, int x, int y, int z, ForgeDirection axis) { if((axis == ForgeDirection.UP || axis == ForgeDirection.DOWN) && !world.isRemote && world.getBlockMetadata(x, y, z) == 0) { TileEntity tile = world.getTileEntity(x, y, z); if(tile instanceof TileEntityTrophee) { TileEntityTrophee tileDirectional = (TileEntityTrophee)tile; byte direction = tileDirectional.getDirection(); direction++; if(direction > 3) { direction = 0; } tileDirectional.setDirection(direction); return true; } } return false; } public ForgeDirection[] getValidRotations(World world, int x, int y, int z) { return world.getBlockMetadata(x, y, z) == 0 ? new ForgeDirection[] {ForgeDirection.UP, ForgeDirection.DOWN} : ForgeDirection.VALID_DIRECTIONS; } public boolean canCollideCheck(int p_149678_1_, boolean p_149678_2_) { return this.isCollidable(); //ça par exemple je pensais que ça allait m'aider } public boolean isOpaqueCube() { return false; } public boolean renderAsNormalBlock() { return false; } @SideOnly(Side.CLIENT) public int getRenderBlockPass() { return 0; } public int getRenderType() { return ClientProxy.tesrRenderId; } }
:::
:::
public void addCollisionBoxesToList(World p_149743_1_, int p_149743_2_, int p_149743_3_, int p_149743_4_, AxisAlignedBB p_149743_5_, List p_149743_6_, Entity p_149743_7_) { AxisAlignedBB axisalignedbb1 = this.getCollisionBoundingBoxFromPool(p_149743_1_, p_149743_2_, p_149743_3_, p_149743_4_); if (axisalignedbb1 != null && p_149743_5_.intersectsWith(axisalignedbb1)) { p_149743_6_.add(axisalignedbb1); } } public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) { return AxisAlignedBB.getBoundingBox((double)p_149668_2_ + this.minX, (double)p_149668_3_ + this.minY, (double)p_149668_4_ + this.minZ, (double)p_149668_2_ + this.maxX, (double)p_149668_3_ + this.maxY, (double)p_149668_4_ + this.maxZ); }
:::
Voilà j’ai également un bloc type plafonnier sur lequel le fait de sauter entraine un crash (le prob doit être le même), bon ce bloc est fait pour être au plafond et ne pas entrer en collision avec des moto ou autre mais c’est toujours bon d’avoir un code aussi propre et fonctionnel possible.
Si l’un de vous a sa petite idée sur la question, ça doit être un prob courant ou typique, mais je n’en ai pas trouvé la solution seul.
-
Sans le rapport de crash on ne peut pas vraiment t’aider.
-
Au temps pour moi, le voici.
:::
Script Engines Available:[15:23:50] [Server thread/WARN]: [15:23:50][FINE][noppes.npcs.controllers.ScriptController:64] ECMAScript: .js
[15:23:50] [Server thread/ERROR]: The entity ID 6000 for mod Dirtbike is not an unsigned byte and may not work
[15:23:50] [Server thread/ERROR]: The mod Dirtbike has attempted to register an entity ID 6000 which is already reserved. This could cause severe problems
[15:23:50] [Server thread/ERROR]: The entity ID 6001 for mod Dirtbike is not an unsigned byte and may not work
::: -
C’est pas un rapport de crash çà
-
Ce n’est pas un rapport de crash.
(Tu utilises des ids trop élevé pour l’enregistrement de tes entités)
-
Bah le mod Dirty Bike n’est pas à moi, c’est un mod que j’utilise sur mon serveur et qui rentre en conflit avec mes blocs.
Le problème ne viendrait pas du fait que les blocs de mon mod n’ont pas de boite de collision? (ou ils en ont mais le f3+B n’affiche rien)
-
F3 + B affiche les collisions des entités pas les collisions des blocs.
-
Rapport de crash –-- Minecraft Crash Report ----// Don't do that. Time: 8/30/15 10:21 PMDescription: Ticking entity java.lang.NoClassDefFoundError: net/minecraft/client/renderer/tileentity/TileEntitySpecialRenderer at fr.heroesconflict.modhc.common.BlockLampadaire.func_149645_b(BlockLampadaire.java:231) at net.minecraft.pathfinding.PathFinder.func_82565_a(SourceFile:199) at net.minecraft.entity.ai.EntityAIControlledByPlayer.func_75246_d(SourceFile:105) at net.minecraft.entity.ai.EntityAITasks.func_75774_a(SourceFile:103) at net.minecraft.entity.EntityLiving.func_70619_bc(EntityLiving.java:582) at net.minecraft.entity.EntityLivingBase.func_70636_d(EntityLivingBase.java:2035) at net.minecraft.entity.EntityLiving.func_70636_d(EntityLiving.java:388) at sheenrox82.Dirtbike.src.entity.EntityDirtbikeCore.func_70636_d(EntityDirtbikeCore.java:41) at sheenrox82.Dirtbike.src.entity.EntityPurpleDirtbike.func_70636_d(EntityPurpleDirtbike.java:21) at net.minecraft.entity.EntityLivingBase.func_70071_h_(EntityLivingBase.java:1868) at net.minecraft.entity.EntityLiving.func_70071_h_(EntityLiving.java:213) at net.minecraft.world.World.func_72866_a(World.java:2643) at net.minecraft.world.WorldServer.func_72866_a(WorldServer.java:838) at net.minecraft.world.World.func_72870_g(World.java:2596) at net.minecraft.world.World.func_72939_s(World.java:2408) at net.minecraft.world.WorldServer.func_72939_s(WorldServer.java:669) at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:943) at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:423) at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:798) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:658) at java.lang.Thread.run(Thread.java:701)Caused by: java.lang.ClassNotFoundException: net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:323) at java.lang.ClassLoader.loadClass(ClassLoader.java:268) ... 21 moreCaused by: java.lang.NullPointerException A detailed walkthrough of the error, its code path and all known details is as follows:--------------------------------------------------------------------------------------- -- Head --Stacktrace: at fr.heroesconflict.modhc.common.BlockLampadaire.func_149645_b(BlockLampadaire.java:231) at net.minecraft.pathfinding.PathFinder.func_82565_a(SourceFile:199) at net.minecraft.entity.ai.EntityAIControlledByPlayer.func_75246_d(SourceFile:105) at net.minecraft.entity.ai.EntityAITasks.func_75774_a(SourceFile:103) at net.minecraft.entity.EntityLiving.func_70619_bc(EntityLiving.java:582) at net.minecraft.entity.EntityLivingBase.func_70636_d(EntityLivingBase.java:2035) at net.minecraft.entity.EntityLiving.func_70636_d(EntityLiving.java:388) at sheenrox82.Dirtbike.src.entity.EntityDirtbikeCore.func_70636_d(EntityDirtbikeCore.java:41) at sheenrox82.Dirtbike.src.entity.EntityPurpleDirtbike.func_70636_d(EntityPurpleDirtbike.java:21) at net.minecraft.entity.EntityLivingBase.func_70071_h_(EntityLivingBase.java:1868) at net.minecraft.entity.EntityLiving.func_70071_h_(EntityLiving.java:213) at net.minecraft.world.World.func_72866_a(World.java:2643) at net.minecraft.world.WorldServer.func_72866_a(WorldServer.java:838) at net.minecraft.world.World.func_72870_g(World.java:2596) -- Entity being ticked --Details: Entity Type: Purple Dirtbike (sheenrox82.Dirtbike.src.entity.EntityPurpleDirtbike) Entity ID: 114 Entity Name: Purple Dirtbike Entity's Exact location: 281.03, 72.00, -189.15 Entity's Block location: World: (281,72,-190), Chunk: (at 9,4,2 in 17,-12; contains blocks 272,0,-192 to 287,255,-177), Region: (0,-1; contains chunks 0,-32 to 31,-1, blocks 0,0,-512 to 511,255,-1) Entity's Momentum: 0.00, -0.08, 0.14Stacktrace: at net.minecraft.world.World.func_72939_s(World.java:2408) at net.minecraft.world.WorldServer.func_72939_s(WorldServer.java:669) -- Affected level --Details: Level name: world All players: 2 total; [EntityPlayerMP['Pulchranix'/0, l='world', x=273.24, y=72.00, z=-187.75](Pulchranix at 273.23612054526893,72.0,-187.75360826588326), EntityPlayerMP['Valvar67'/53, l='world', x=281.03, y=72.66, z=-189.15](Valvar67 at 281.03105182777,72.66249996423721,-189.15189122459722)] Chunk stats: ServerChunkCache: 724 Drop: 0 Level seed: 227290 Level generator: ID 00 - default, ver 1\. Features enabled: true Level generator options: Level spawn location: World: (0,67,0), Chunk: (at 0,4,0 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: 656603 game time, 691677 day time Level dimension: 0 Level storage version: 0x04ABD - Anvil Level weather: Rain time: 1361319 (now: false), thunder time: 122584 (now: false) Level game mode: Game mode: survival (ID 0). Hardcore: false. Cheats: trueStacktrace: at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:943) at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:423) at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:798) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:658) at java.lang.Thread.run(Thread.java:701) – System Details --Details: Minecraft Version: 1.7.10 Operating System: Linux (amd64) version 3.14.32-xxxx-std-ipv6-64 Java Version: 1.6.0_36, Sun Microsystems Inc. Java VM Version: OpenJDK 64-Bit Server VM (mixed mode), Sun Microsystems Inc. Memory: 471889168 bytes (450 MB) / 2388328448 bytes (2277 MB) up to 15177809920 bytes (14474 MB) JVM Flags: 2 total; -Xmx16284M -Xms1028M AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used IntCache: cache: 1, tcache: 1, allocated: 12, tallocated: 94 FML: MCP v9.05 FML v7.10.25.1207 Minecraft Forge 10.13.0.1207 12 mods loaded, 12 mods active mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available FML{7.10.25.1207} [Forge Mod Loader] (cauldron-1.7.10-1.1207.01.198-server.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Forge{10.13.0.1207} [Minecraft Forge] (cauldron-1.7.10-1.1207.01.198-server.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available betterrecords{1.7.10-1.1.9} [Better Records] (betterrecords-1.7.10-1.1.9.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available customnpcs{1.7.10c} [CustomNpcs] (CustomNPCs_1.7.10c.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Dirtbike{v1.2.0} [Dirtbike Mod] (Dirtbike Mod - v1.2.0.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available SlimevoidLib{2.0.4.7} [Slimevoid Library] (SlimevoidLibrary-2.0.4.7 (1).jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available DynamicTransport{0.1.2.0} [Dynamic Transport] (DynamicTransport-0.1.2.0 .jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Dynmap{2.0.0-alpha-2-17} [Dynmap] (Dynmap-2.0.0-alpha-2-forge-10.13.0.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available flansmod{4.10.0} [Flan's Mod] (Flans Mod-1.7.10-4.10.0.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available modhc{1.0.0} [Mod Heroes Conflict] (ModHc-1.3.0.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available StorageDrawers{1.7.10-1.5.14} [Storage Drawers] (StorageDrawers-1.7.10-1.5.14.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Profiler Position: N/A (disabled) Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used Player Count: 2 / 50; [EntityPlayerMP['Pulchranix'/0, l='world', x=273.24, y=72.00, z=-187.75](Pulchranix at 273.23612054526893,72.0,-187.75360826588326), EntityPlayerMP['Valvar67'/53, l='world', x=281.03, y=72.66, z=-189.15](Valvar67 at 281.03105182777,72.66249996423721,-189.15189122459722)] Is Modded: Definitely; Server brand changed to 'cauldron,craftbukkit,mcpc,fml,forge' Type: Dedicated Server (map_server.txt)
Voici la bête, désolé pour l’erreur.
-
Dans la classe BlockLampadaire ajoutes un @SideOnly au dessus de la fonction getRenderType
-
@‘robin4002’:
Dans la classe BlockLampadaire ajoutes un @SideOnly au dessus de la fonction getRenderType
Grand merci, ce forum est une bénédiction.