Résolu Crash bloc rendu tesr
-
Quelqu’un peut m’aider à trouver l’erreur ? J’avais 5 blocks avec un rendu tesr 3 posaient problemes je les ai delete et je pensais que c’était résolu mais maintenant ca me le fait avec les deux derniers, je comprends pas d’ou ca vient.
Le crash :
:::
net.minecraft.util.ReportedException: Ticking entity
at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:956) ~[MinecraftServer.class:?]
at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:431) ~[lt.class:?]
at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:811) ~[MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:671) [MinecraftServer.class:?]
at java.lang.Thread.run(Thread.java:722) [?:1.7.0]
Caused by: java.lang.NoClassDefFoundError: net/minecraft/client/renderer/tileentity/TileEntitySpecialRenderer
at BlocksPers.flagSpawn.func_149645_b(flagSpawn.java:43) ~[flagSpawn.class:?]
at net.minecraft.pathfinding.PathFinder.func_82565_a(SourceFile:199) ~[ayg.class:?]
at net.minecraft.pathfinding.PathFinder.func_75855_a(SourceFile:181) ~[ayg.class:?]
at net.minecraft.pathfinding.PathFinder.func_75858_a(SourceFile:133) ~[ayg.class:?]
at net.minecraft.pathfinding.PathFinder.func_75860_b(SourceFile:121) ~[ayg.class:?]
at net.minecraft.pathfinding.PathFinder.func_75861_a(SourceFile:89) ~[ayg.class:?]
at net.minecraft.pathfinding.PathFinder.func_75857_a(SourceFile:60) ~[ayg.class:?]
at net.minecraft.pathfinding.PathFinder.func_75859_a(SourceFile:36) ~[ayg.class:?]
at net.minecraft.world.World.func_72844_a(World.java:3979) ~[ahb.class:?]
at net.minecraft.entity.EntityCreature.func_70779_j(EntityCreature.java:254) ~[td.class:?]
at net.minecraft.entity.EntityCreature.func_70626_be(EntityCreature.java:132) ~[td.class:?]
at net.minecraft.entity.EntityLivingBase.func_70636_d(EntityLivingBase.java:2072) ~[sv.class:?]
at net.minecraft.entity.EntityLiving.func_70636_d(EntityLiving.java:388) ~[sw.class:?]
at net.minecraft.entity.monster.EntityMob.func_70636_d(EntityMob.java:36) ~[yg.class:?]
at net.minecraft.entity.EntityLivingBase.func_70071_h_(EntityLivingBase.java:1899) ~[sv.class:?]
at net.minecraft.entity.EntityLiving.func_70071_h_(EntityLiving.java:213) ~[sw.class:?]
at net.minecraft.entity.monster.EntityMob.func_70071_h_(EntityMob.java:41) ~[yg.class:?]
at net.minecraft.world.World.func_72866_a(World.java:2609) ~[ahb.class:?]
at net.minecraft.world.WorldServer.func_72866_a(WorldServer.java:840) ~[mt.class:?]
at net.minecraft.world.World.func_72870_g(World.java:2561) ~[ahb.class:?]
at net.minecraft.world.World.func_72939_s(World.java:2401) ~[ahb.class:?]
at net.minecraft.world.WorldServer.func_72939_s(WorldServer.java:672) ~[mt.class:?]
at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:939) ~[MinecraftServer.class:?]
… 4 more
Caused by: java.lang.ClassNotFoundException: net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191) ~[launchwrapper-1.12.jar:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:423) ~[?:1.7.0]
at java.lang.ClassLoader.loadClass(ClassLoader.java:356) ~[?:1.7.0]
at BlocksPers.flagSpawn.func_149645_b(flagSpawn.java:43) ~[flagSpawn.class:?]
at net.minecraft.pathfinding.PathFinder.func_82565_a(SourceFile:199) ~[ayg.class:?]
at net.minecraft.pathfinding.PathFinder.func_75855_a(SourceFile:181) ~[ayg.class:?]
at net.minecraft.pathfinding.PathFinder.func_75858_a(SourceFile:133) ~[ayg.class:?]
at net.minecraft.pathfinding.PathFinder.func_75860_b(SourceFile:121) ~[ayg.class:?]
at net.minecraft.pathfinding.PathFinder.func_75861_a(SourceFile:89) ~[ayg.class:?]
at net.minecraft.pathfinding.PathFinder.func_75857_a(SourceFile:60) ~[ayg.class:?]
at net.minecraft.pathfinding.PathFinder.func_75859_a(SourceFile:36) ~[ayg.class:?]
at net.minecraft.world.World.func_72844_a(World.java:3979) ~[ahb.class:?]
at net.minecraft.entity.EntityCreature.func_70779_j(EntityCreature.java:254) ~[td.class:?]
at net.minecraft.entity.EntityCreature.func_70626_be(EntityCreature.java:132) ~[td.class:?]
at net.minecraft.entity.EntityLivingBase.func_70636_d(EntityLivingBase.java:2072) ~[sv.class:?]
at net.minecraft.entity.EntityLiving.func_70636_d(EntityLiving.java:388) ~[sw.class:?]
at net.minecraft.entity.monster.EntityMob.func_70636_d(EntityMob.java:36) ~[yg.class:?]
at net.minecraft.entity.EntityLivingBase.func_70071_h_(EntityLivingBase.java:1899) ~[sv.class:?]
at net.minecraft.entity.EntityLiving.func_70071_h_(EntityLiving.java:213) ~[sw.class:?]
at net.minecraft.entity.monster.EntityMob.func_70071_h_(EntityMob.java:41) ~[yg.class:?]
at net.minecraft.world.World.func_72866_a(World.java:2609) ~[ahb.class:?]
at net.minecraft.world.WorldServer.func_72866_a(WorldServer.java:840) ~[mt.class:?]
at net.minecraft.world.World.func_72870_g(World.java:2561) ~[ahb.class:?]
at net.minecraft.world.World.func_72939_s(World.java:2401) ~[ahb.class:?]
at net.minecraft.world.WorldServer.func_72939_s(WorldServer.java:672) ~[mt.class:?]
at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:939) ~[MinecraftServer.class:?]
… 4 more
Caused by: java.lang.NullPointerException
[16:56:33] [Server thread/ERROR]: Cause of unexpected exception was
java.lang.NoClassDefFoundError: net/minecraft/client/renderer/tileentity/TileEntitySpecialRenderer
at BlocksPers.flagSpawn.func_149645_b(flagSpawn.java:43) ~[flagSpawn.class:?]
at net.minecraft.pathfinding.PathFinder.func_82565_a(SourceFile:199) ~[ayg.class:?]
at net.minecraft.pathfinding.PathFinder.func_75855_a(SourceFile:181) ~[ayg.class:?]
at net.minecraft.pathfinding.PathFinder.func_75858_a(SourceFile:133) ~[ayg.class:?]
at net.minecraft.pathfinding.PathFinder.func_75860_b(SourceFile:121) ~[ayg.class:?]
at net.minecraft.pathfinding.PathFinder.func_75861_a(SourceFile:89) ~[ayg.class:?]
at net.minecraft.pathfinding.PathFinder.func_75857_a(SourceFile:60) ~[ayg.class:?]
at net.minecraft.pathfinding.PathFinder.func_75859_a(SourceFile:36) ~[ayg.class:?]
at net.minecraft.world.World.func_72844_a(World.java:3979) ~[ahb.class:?]
at net.minecraft.entity.EntityCreature.func_70779_j(EntityCreature.java:254) ~[td.class:?]
at net.minecraft.entity.EntityCreature.func_70626_be(EntityCreature.java:132) ~[td.class:?]
at net.minecraft.entity.EntityLivingBase.func_70636_d(EntityLivingBase.java:2072) ~[sv.class:?]
at net.minecraft.entity.EntityLiving.func_70636_d(EntityLiving.java:388) ~[sw.class:?]
at net.minecraft.entity.monster.EntityMob.func_70636_d(EntityMob.java:36) ~[yg.class:?]
at net.minecraft.entity.EntityLivingBase.func_70071_h_(EntityLivingBase.java:1899) ~[sv.class:?]
at net.minecraft.entity.EntityLiving.func_70071_h_(EntityLiving.java:213) ~[sw.class:?]
at net.minecraft.entity.monster.EntityMob.func_70071_h_(EntityMob.java:41) ~[yg.class:?]
at net.minecraft.world.World.func_72866_a(World.java:2609) ~[ahb.class:?]
at net.minecraft.world.WorldServer.func_72866_a(WorldServer.java:840) ~[mt.class:?]
at net.minecraft.world.World.func_72870_g(World.java:2561) ~[ahb.class:?]
at net.minecraft.world.World.func_72939_s(World.java:2401) ~[ahb.class:?]
at net.minecraft.world.WorldServer.func_72939_s(WorldServer.java:672) ~[mt.class:?]
at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:939) ~[MinecraftServer.class:?]
at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:431) ~[lt.class:?]
at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:811) ~[MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:671) [MinecraftServer.class:?]
at java.lang.Thread.run(Thread.java:722) [?:1.7.0]
Caused by: java.lang.ClassNotFoundException: net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191) ~[launchwrapper-1.12.jar:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:423) ~[?:1.7.0]
at java.lang.ClassLoader.loadClass(ClassLoader.java:356) ~[?:1.7.0]
… 27 more
Caused by: java.lang.NullPointerException
:::Ma classe principale :
preinit:
barreFlag = new barreFlag(Material.rock).setBlockName(“barreFlag”).setCreativeTab(Main.CreaTabBlocks);GameRegistry.registerBlock(barreFlag, “barreFlag”);
init :
GameRegistry.registerTileEntity(TileEntityBarreFlag.class, “Main:barrespawn”);Ma classe de base:
package BlocksPers; import fr.shyfe.dcedo.proxy.ClientProxy; 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; public class barreFlag extends Block { public barreFlag(Material material) { super(material); } @Override public TileEntity createTileEntity(World world, int metadata) { return new TileEntityBarreFlag(); } @Override public boolean hasTileEntity(int metadata) { return true; } public boolean isOpaqueCube() { return false; } public boolean renderAsNormalBlock() { return false; } public int getRenderType() { return ClientProxy.tesrRenderId; } 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 TileEntityBarreFlag) { int direction = MathHelper.floor_double((double)(living.rotationYaw * 4.0F / 360.0F) + 2.5D) & 3; ((TileEntityBarreFlag)tile).setDirection((byte)direction); } } } public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); } }
Mon model:
package BlocksPers; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; public class ModelBarreFlag extends ModelBase { //fields ModelRenderer Shape1; public ModelBarreFlag() { textureWidth = 128; textureHeight = 32; Shape1 = new ModelRenderer(this, 0, 0); Shape1.addBox(0F, 0F, 0F, 48, 2, 2); Shape1.setRotationPoint(-8F, -1F, 0F); Shape1.setTextureSize(128, 32); Shape1.mirror = true; setRotation(Shape1, 0F, 0F, 0F); } public void renderAll() { Shape1.render(0.0625F); } private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) { } }
Mon TileEntity:
package BlocksPers; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; public class TileEntityBarreFlag extends TileEntity { private byte direction; @Override public void readFromNBT(NBTTagCompound compound) { super.readFromNBT(compound); this.direction = compound.getByte("Direction"); } @Override public void writeToNBT(NBTTagCompound compound) { super.writeToNBT(compound); compound.setByte("Direction", this.direction); } public byte getDirection() { return direction; } public void setDirection(byte direction) { this.direction = direction; this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); } public Packet getDescriptionPacket() { NBTTagCompound nbttagcompound = new NBTTagCompound(); this.writeToNBT(nbttagcompound); return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbttagcompound); } public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { this.readFromNBT(pkt.func_148857_g()); this.worldObj.markBlockRangeForRenderUpdate(this.xCoord, this.yCoord, this.zCoord, this.xCoord, this.yCoord, this.zCoord); } }
Mon TileEntitySpecialRenderer:
package BlocksPers; import org.lwjgl.opengl.GL11; import fr.shyfe.dcedo.common.Main; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; public class TileEntityBarreFlagSpecialRenderer extends TileEntitySpecialRenderer { public static ModelBarreFlag model = new ModelBarreFlag(); public static ResourceLocation texture = new ResourceLocation(Main.MODID, "textures/models/blocks/BarreFlag.png"); @Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialRenderTick) // la fonction qui était la de base { this.renderTileEntityBarreFlagAt((TileEntityBarreFlag)tile, x, y, z, partialRenderTick); // j'appelle ma fonction renderTileEntityTutorielAt en castant TileEntityTutoriel à l'argument tile } private void renderTileEntityBarreFlagAt(TileEntityBarreFlag tile, double x, double y, double z, float partialRenderTick) { GL11.glPushMatrix(); // ouvre une matrix GL11.glTranslated(x + 0.5D, y + 1.5D, z + 0.5D); // déplace le bloc sur les coordonnés et le centre GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); // met droit le bloc (par défaut il est à l'envers) GL11.glRotatef((90F * tile.getDirection()) -90F, 0.0F, 1.0F, 0.0F); this.bindTexture(texture); // affiche la texture model.renderAll(); // rend le modèle GL11.glPopMatrix(); // ferme la matrix } public TileEntityBarreFlagSpecialRenderer() // TileEntityTutorielSpecialRenderer dans mon cas, c'est la classe que nous avons fait dans la partie précédente { this.func_147497_a(TileEntityRendererDispatcher.instance); } }
Mon client proxy:
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBarreFlag.class, new TileEntityBarreFlagSpecialRenderer()); -
Le problème se situe dans la classe flagSpawn, si tu peux l’envoyer ^^
Ensuite, utilises des balise java et non pas code pour du code java, les lignes sont numérotées et tout est coloré, donc plus clair, en parlant de choses claires, je te conseilles de respecter la convention java (noms de de classes de la forme NomDeClasse, et changer celui de ton unique package), ce sera plus cliar pour toi et pour nous -
J’ai supprimé tout ce qui avait un rapport avec mes blocks personnalisés mais maintenant mes mobs ont tous la même apparence a savoir un rectangle blanc qui flotte… J’suis perdu, peut on faire un rollback sur eclipse ?
-
Il manque un @SideOnly(Side.CLIENT) au dessus de la fonction public int getRenderType()
Pas de rollback sur eclipse à la ma connaissance …
C’est pas ne supprimant tout qu’on corrige correctement des bugs -
@‘robin4002’:
Il manque un @SideOnly(Side.CLIENT) au dessus de la fonction public int getRenderType()
Pas de rollback sur eclipse à la ma connaissance …
C’est pas ne supprimant tout qu’on corrige correctement des bugsTotalement d’accord, j’ai voulu me précipiter, j’ai réussi à régler le problème j’ai eu de la chance.