Jump to content

Recommended Posts

Posted

As by title, if i spawn an entity in a server world the game crash :/ This is the crash report

---- Minecraft Crash Report ----

WARNING: coremods are present:
  NowWithRendering (hopperducts-mc1.8-1.4.5.jar)
Contact their authors BEFORE contacting forge

// Ouch. That hurt 

Time: 12/22/15 12:41 PM
Description: Rendering entity in world

java.lang.NullPointerException: Rendering entity in world
at net.minecraft.client.renderer.entity.RendererLivingEntity.func_110813_b(RendererLivingEntity.java:563)
at net.minecraft.client.renderer.entity.RenderLiving.func_110813_b(SourceFile:22)
at net.minecraft.client.renderer.entity.RenderLiving.func_110813_b(SourceFile:15)
at net.minecraft.client.renderer.entity.RendererLivingEntity.func_77033_b(RendererLivingEntity.java:481)
at net.minecraft.client.renderer.entity.RendererLivingEntity.func_177067_a(RendererLivingEntity.java:578)
at net.minecraft.client.renderer.entity.Render.func_76986_a(SourceFile:39)
at net.minecraft.client.renderer.entity.RendererLivingEntity.func_76986_a(RendererLivingEntity.java:198)
at net.minecraft.client.renderer.entity.RenderLiving.func_76986_a(SourceFile:40)
at hl.entities.renderer.RenderBee.renderBee(RenderBee.java:55)
at hl.entities.renderer.RenderBee.func_76986_a(RenderBee.java:45)
at net.minecraft.client.renderer.entity.RenderManager.func_147939_a(RenderManager.java:370)
at net.minecraft.client.renderer.entity.RenderManager.func_147936_a(RenderManager.java:327)
at net.minecraft.client.renderer.entity.RenderManager.func_147937_a(RenderManager.java:294)
at net.minecraft.client.renderer.RenderGlobal.func_180446_a(RenderGlobal.java:786)
at net.minecraft.client.renderer.EntityRenderer.func_175068_a(EntityRenderer.java:1570)
at net.minecraft.client.renderer.EntityRenderer.func_78471_a(EntityRenderer.java:1458)
at net.minecraft.client.renderer.EntityRenderer.func_78480_b(EntityRenderer.java:1242)
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(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
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.client.renderer.entity.RendererLivingEntity.func_110813_b(RendererLivingEntity.java:563)
at net.minecraft.client.renderer.entity.RenderLiving.func_110813_b(SourceFile:22)
at net.minecraft.client.renderer.entity.RenderLiving.func_110813_b(SourceFile:15)
at net.minecraft.client.renderer.entity.RendererLivingEntity.func_77033_b(RendererLivingEntity.java:481)
at net.minecraft.client.renderer.entity.RendererLivingEntity.func_177067_a(RendererLivingEntity.java:578)
at net.minecraft.client.renderer.entity.Render.func_76986_a(SourceFile:39)
at net.minecraft.client.renderer.entity.RendererLivingEntity.func_76986_a(RendererLivingEntity.java:198)
at net.minecraft.client.renderer.entity.RenderLiving.func_76986_a(SourceFile:40)
at hl.entities.renderer.RenderBee.renderBee(RenderBee.java:55)
at hl.entities.renderer.RenderBee.func_76986_a(RenderBee.java:45)

-- Entity being rendered --
Details:
Entity Type: GiantBee (hl.entities.EntityBee)
Entity ID: 98772
Entity Name: Giant Bee
Entity's Exact location: 954.59, 68.00, 517.44
Entity's Block location: 954.00,68.00,517.00 - World: (954,68,517), Chunk: (at 10,4,5 in 59,32; contains blocks 944,0,512 to 959,255,527), Region: (1,1; contains chunks 32,32 to 63,63, blocks 512,0,512 to 1023,255,1023)
Entity's Momentum: 0.00, 0.00, 0.00
Entity's Rider: ~~ERROR~~ NullPointerException: null
Entity's Vehicle: ~~ERROR~~ NullPointerException: null

-- Renderer details --
Details:
Assigned renderer: hl.entities.renderer.RenderBee@5d53dc7a
Location: 2.78,-1.00,-17.23 - World: (2,-1,-18), Chunk: (at 2,-1,14 in 0,-2; contains blocks 0,0,-32 to 15,255,-17), Region: (0,-1; contains chunks 0,-32 to 31,-1, blocks 0,0,-512 to 511,255,-1)
Rotation: -60.46875
Delta: 0.17472082
Stacktrace:
at net.minecraft.client.renderer.entity.RenderManager.func_147939_a(RenderManager.java:370)
at net.minecraft.client.renderer.entity.RenderManager.func_147936_a(RenderManager.java:327)
at net.minecraft.client.renderer.entity.RenderManager.func_147937_a(RenderManager.java:294)
at net.minecraft.client.renderer.RenderGlobal.func_180446_a(RenderGlobal.java:786)
at net.minecraft.client.renderer.EntityRenderer.func_175068_a(EntityRenderer.java:1570)
at net.minecraft.client.renderer.EntityRenderer.func_78471_a(EntityRenderer.java:1458)

-- Affected level --
Details:
Level name: MpServer
All players: 1 total; [EntityPlayerSP['kenkune'/96278, l='MpServer', x=951.79, y=69.00, z=534.65]]
Chunk stats: MultiplayerChunkCache: 400, 400
Level seed: 0
Level generator: ID 00 - default, ver 1. Features enabled: false
Level generator options: 
Level spawn location: -216.00,64.00,256.00 - World: (-216,64,256), Chunk: (at 8,4,0 in -14,16; contains blocks -224,0,256 to -209,255,271), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)
Level time: 6757393 game time, 35350 day time
Level dimension: 0
Level storage version: 0x00000 - Unknown?
Level weather: Rain time: 0 (now: true), thunder time: 0 (now: false)
Level game mode: Game mode: survival (ID 0). Hardcore: false. Cheats: false
Forced entities: 81 total; [EntityZombie['Zombie'/96516, l='MpServer', x=948.50, y=59.00, z=556.50], EntityWolf['Wolf'/96527, l='MpServer', x=1001.50, y=64.00, z=546.50], EntityZombie['Zombie'/96529, l='MpServer', x=884.53, y=38.00, z=572.94], EntityCreeper['Creeper'/96530, l='MpServer', x=908.84, y=10.00, z=581.75], EntityPig['Pig'/96533, l='MpServer', x=897.50, y=70.00, z=569.50], EntityPig['Pig'/96532, l='MpServer', x=901.50, y=69.00, z=570.50], EntityZombie['Zombie'/98584, l='MpServer', x=893.22, y=42.00, z=563.78], EntityPig['Pig'/96541, l='MpServer', x=921.16, y=68.00, z=548.50], EntityPig['Pig'/96540, l='MpServer', x=932.94, y=67.00, z=536.00], EntityWolf['Wolf'/96543, l='MpServer', x=1014.50, y=70.00, z=544.75], EntityPig['Pig'/96542, l='MpServer', x=916.94, y=68.00, z=539.06], EntityZombie['Zombie'/98593, l='MpServer', x=907.97, y=18.00, z=462.50], EntityZombie['Zombie'/98592, l='MpServer', x=911.50, y=20.00, z=462.50], EntityZombie['Zombie'/96555, l='MpServer', x=886.50, y=38.00, z=574.50], EntitySkeleton['Skeleton'/96554, l='MpServer', x=885.50, y=38.00, z=569.50], EntityCreeper['Creeper'/97325, l='MpServer', x=887.41, y=44.00, z=585.94], EntitySkeleton['Skeleton'/96556, l='MpServer', x=891.63, y=42.00, z=563.31], EntityPig['Pig'/96561, l='MpServer', x=894.50, y=77.00, z=571.50], EntityPig['Pig'/96560, l='MpServer', x=894.50, y=71.00, z=568.50], EntitySpider['Spider'/96573, l='MpServer', x=875.69, y=44.09, z=588.69], EntityPig['Pig'/96575, l='MpServer', x=1033.50, y=65.00, z=555.50], EntityPig['Pig'/96577, l='MpServer', x=1033.50, y=65.00, z=553.50], EntityPig['Pig'/96576, l='MpServer', x=1032.50, y=67.00, z=553.50], EntityPig['Pig'/96578, l='MpServer', x=1034.50, y=64.00, z=553.50], EntityWolf['Wolf'/96581, l='MpServer', x=1005.50, y=64.00, z=543.50], EntityWolf['Wolf'/96582, l='MpServer', x=1006.50, y=64.00, z=543.50], EntityPig['Pig'/96589, l='MpServer', x=926.38, y=67.00, z=539.97], EntityPig['Pig'/96591, l='MpServer', x=1023.09, y=64.00, z=533.03], EntityPig['Pig'/96590, l='MpServer', x=1027.22, y=64.00, z=533.81], EntityPig['Pig'/96593, l='MpServer', x=962.19, y=69.00, z=515.13], EntityPig['Pig'/96853, l='MpServer', x=962.50, y=69.00, z=463.50], EntityPig['Pig'/96852, l='MpServer', x=962.50, y=69.00, z=463.50], EntityPig['Pig'/96854, l='MpServer', x=961.28, y=75.00, z=471.47], EntityPig['Pig'/96601, l='MpServer', x=957.16, y=63.00, z=524.50], EntityPig['Pig'/96603, l='MpServer', x=956.81, y=64.00, z=521.16], EntityPig['Pig'/96602, l='MpServer', x=955.19, y=64.00, z=522.78], EntityPig['Pig'/96605, l='MpServer', x=1030.66, y=65.00, z=527.53], EntityPig['Pig'/96604, l='MpServer', x=1025.63, y=64.00, z=534.38], EntityPig['Pig'/96871, l='MpServer', x=997.50, y=67.00, z=464.50], EntityPig['Pig'/96870, l='MpServer', x=994.50, y=67.00, z=464.50], EntityPig['Pig'/96873, l='MpServer', x=997.50, y=67.00, z=464.50], EntityPig['Pig'/96872, l='MpServer', x=998.50, y=67.00, z=461.50], EntitySheep['Sheep'/96912, l='MpServer', x=918.84, y=73.00, z=459.16], EntitySkeleton['Skeleton'/98201, l='MpServer', x=920.69, y=12.00, z=605.28], EntitySkeleton['Skeleton'/98200, l='MpServer', x=918.22, y=12.00, z=605.28], EntityPig['Pig'/96667, l='MpServer', x=887.50, y=72.00, z=494.16], EntitySkeleton['Skeleton'/96410, l='MpServer', x=982.25, y=27.47, z=593.69], EntityPig['Pig'/96666, l='MpServer', x=887.50, y=72.00, z=495.78], EntitySpider['Spider'/98202, l='MpServer', x=919.50, y=12.00, z=607.16], EntityPig['Pig'/96668, l='MpServer', x=887.50, y=71.00, z=492.50], EntityMinecartChest['container.minecart'/96421, l='MpServer', x=926.50, y=36.06, z=616.50], EntityPig['Pig'/96679, l='MpServer', x=909.50, y=71.00, z=515.50], EntityBat['Bat'/96422, l='MpServer', x=1017.50, y=39.97, z=611.47], EntityPig['Pig'/96678, l='MpServer', x=910.50, y=71.00, z=513.50], EntityBat['Bat'/96427, l='MpServer', x=963.77, y=27.98, z=587.20], EntityPig['Pig'/96443, l='MpServer', x=949.44, y=67.16, z=576.50], EntityBat['Bat'/96442, l='MpServer', x=959.75, y=30.10, z=588.88], EntityPig['Pig'/96444, l='MpServer', x=951.72, y=68.00, z=579.78], EntityPig['Pig'/96703, l='MpServer', x=919.78, y=69.00, z=516.28], EntityItem['item.tile.torch'/96448, l='MpServer', x=927.44, y=35.00, z=596.53], EntityPig['Pig'/96704, l='MpServer', x=912.81, y=69.00, z=521.84], EntityPig['Pig'/96453, l='MpServer', x=936.31, y=67.00, z=588.44], EntityZombie['Zombie'/98508, l='MpServer', x=880.50, y=26.00, z=457.50], EntityZombie['Zombie'/98510, l='MpServer', x=878.50, y=26.00, z=459.50], EntityPig['Pig'/96465, l='MpServer', x=900.44, y=70.00, z=603.38], EntityPig['Pig'/96467, l='MpServer', x=906.91, y=66.00, z=611.13], EntityPig['Pig'/96466, l='MpServer', x=898.16, y=70.00, z=604.50], EntityBee['Giant Bee'/98773, l='MpServer', x=954.81, y=68.00, z=520.16], EntitySkeleton['Skeleton'/96468, l='MpServer', x=917.50, y=13.00, z=583.50], EntityBee['Giant Bee'/98772, l='MpServer', x=954.59, y=68.00, z=517.44], EntityCreeper['Creeper'/96481, l='MpServer', x=943.00, y=60.00, z=573.44], EntityPig['Pig'/96480, l='MpServer', x=956.03, y=63.00, z=575.59], EntityPig['Pig'/96482, l='MpServer', x=956.81, y=68.00, z=574.81], EntityPlayerSP['kenkune'/96278, l='MpServer', x=951.79, y=69.00, z=534.65], EntityBat['Bat'/96495, l='MpServer', x=892.63, y=18.10, z=615.36], EntityCreeper['Creeper'/96501, l='MpServer', x=880.50, y=38.00, z=606.50], EntityBat['Bat'/96500, l='MpServer', x=887.25, y=12.56, z=599.24], EntityPig['Pig'/96503, l='MpServer', x=895.50, y=70.00, z=601.50], EntityZombie['Zombie'/96502, l='MpServer', x=892.59, y=38.00, z=600.41], EntityCreeper['Creeper'/96505, l='MpServer', x=915.28, y=17.00, z=567.28], EntityCreeper['Creeper'/96504, l='MpServer', x=914.97, y=15.00, z=569.63]]
Retry entities: 0 total; []
Server brand: fml,forge
Server type: Non-integrated multiplayer server
Stacktrace:
at net.minecraft.client.multiplayer.WorldClient.func_72914_a(WorldClient.java:407)
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(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
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 (amd64) version 6.1
Java Version: 1.8.0_25, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 267632296 bytes (255 MB) / 666447872 bytes (635 MB) up to 1060372480 bytes (1011 MB)
JVM Flags: 6 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xmx1G -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:-UseAdaptiveSizePolicy -Xmn128M
IntCache: cache: 7, tcache: 87, allocated: 13, tallocated: 95
FML: MCP v9.10 FML v8.0.99.99 Minecraft Forge 11.14.3.1450 Optifine OptiFine_1.8_HD_U_D5 7 mods loaded, 7 mods active
States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
UCHIJA	mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) 
UCHIJA	FML{8.0.99.99} [Forge Mod Loader] (forge-1.8-11.14.3.1450.jar) 
UCHIJA	Forge{11.14.3.1450} [Minecraft Forge] (forge-1.8-11.14.3.1450.jar) 
UCHIJA	Backpack{2.0.1} [backpack] (backpack-2.0.1-1.8.x.jar) 
UCHIJA	DeathChest{1.8} [Death Chest] (DeathChest-1.0.2.jar) 
UCHIJA	hl{1.0} [Half-Life 3 Mod] (HL3-1.1.1.jar) 
UCHIJA	hopperducts{1.4.5} [Hopper Ducts] (hopperducts-mc1.8-1.4.5.jar) 
Loaded coremods (and transformers): 
NowWithRendering (hopperducts-mc1.8-1.4.5.jar)
  net.fybertech.nwr.NowWithRendering
GL info: ' Vendor: 'ATI Technologies Inc.' Version: '4.5.13399 Compatibility Profile Context 15.200.1062.1004' Renderer: 'AMD Radeon R9 200 Series'
Launched Version: 1.8-Forge11.14.3.1450
LWJGL: 2.9.1
OpenGL: AMD Radeon R9 200 Series GL version 4.5.13399 Compatibility Profile Context 15.200.1062.1004, ATI Technologies Inc.
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: English (US)
Profiler Position: N/A (disabled)

 

It looks like something related to render, so this is the rendering class

package hl.entities.renderer;

import org.lwjgl.opengl.GL11;

import hl.entities.EntityBee;
import hl.models.ModelBee;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public class RenderBee extends RenderLiving {

protected ModelBee model;
public static final ResourceLocation beeTexture = new ResourceLocation("hl:textures/mobs/bee.png");
private float scale;


public RenderBee(RenderManager mgr, ModelBee par1ModelBase, float par2, float d)
{
	super(mgr, par1ModelBase, par2);
	model=((ModelBee)mainModel);
	this.scale = d;
}

protected void preRenderScale(EntityBee par1EntityBee, float par2)
{
	GL11.glScalef(this.scale, this.scale, this.scale);
}
protected void preRenderCallback(EntityLivingBase par1EntityLivingBase, float par2)
{
	this.preRenderScale((EntityBee)par1EntityLivingBase, par2);
}
@Override
protected ResourceLocation getEntityTexture(Entity entity) 
{
	return beeTexture;
}

@Override
public void doRender(Entity entity, double d0, double d1, double d2, float f, float f1) {
	renderBee((EntityBee)entity, d0, d1, d2, f, f1);
}

public void doRenderLiving(Entity par1EntityLiving, double par2, double par4, double par6, float par8, float par9)
{
	renderBee((EntityBee)par1EntityLiving, par2, par4, par6, par8, par9);
}

private void renderBee(EntityBee entity, double par2, double par4, double par6, float par8, float par9) 
{
	super.doRender(entity, par2, par4, par6, par8, par9);
}

}

 

The entity is registered in the preInit method by doing this

EntityHandler.registerMonsters(EntityBee.class, "GiantBee", 0xDDAB22, 0x000000F);

In EntityHandler i do this

int entityId = EntityRegistry.findGlobalUniqueEntityId();

EntityRegistry.registerGlobalEntityID(entityClass, name, entityId);
EntityRegistry.addSpawn(entityClass, 15, 2, 4, EnumCreatureType.AMBIENT);
EntityList.entityEggs.put(Integer.valueOf(entityId), new EntityList.EntityEggInfo(entityId, mainColor, subColor));

 

And then in ClientProxy i do this

RenderingRegistry.registerEntityRenderingHandler(EntityBee.class, new RenderBee(Minecraft.getMinecraft().getRenderManager(), new ModelBee(), 0.3F, 0.5F));

wich is called from the init method :/ So why it crashes on spawn? :/

Don't blame me if i always ask for your help. I just want to learn to be better :)

Posted

I don't know :/ In the client everything works fine. By the way here is the model and the entity class, just in case is needed

 

Model class


package hl.models;

import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.util.MathHelper;

public class ModelBee extends ModelBase
{
ModelRenderer head;
ModelRenderer rightantenna;
ModelRenderer leftantenna;
ModelRenderer mouth;
ModelRenderer body;
ModelRenderer butt;
ModelRenderer stinger;
ModelRenderer legs;
ModelRenderer leftwing;
ModelRenderer rightwing;

public ModelBee()
{
	textureWidth = 64;
	textureHeight = 32;

	head = new ModelRenderer(this, 0, 0);
	head.addBox(-2.5F, -9F, -4F, 5, 5, 4);
	head.setRotationPoint(0F, 0F, -2F);
	head.setTextureSize(64, 32);
	head.mirror = true;
	setRotation(head, 0F, 0F, 0F);

	rightantenna = new ModelRenderer(this, 0, 0);
	rightantenna.addBox(-1F, -11F, -2F, 1, 2, 1);
	rightantenna.setRotationPoint(0F, 0F, -2F);
	rightantenna.setTextureSize(64, 32);
	setRotation(rightantenna, 0F, 0.7853982F, 0F);
	rightantenna.mirror = false;

	leftantenna = new ModelRenderer(this, 0, 9);
	leftantenna.addBox(1F, -11F, 0F, 1, 2, 1);
	leftantenna.setRotationPoint(0F, 0F, -2F);
	leftantenna.setTextureSize(64, 32);
	leftantenna.mirror = true;
	setRotation(leftantenna, 0F, 0.7853982F, 0F);

	mouth = new ModelRenderer(this, 18, 0);
	mouth.addBox(-0.5F, -5F, -5F, 1, 1, 1);
	mouth.setRotationPoint(0F, 0F, -2F);
	mouth.setTextureSize(64, 32);
	mouth.mirror = false;
	setRotation(mouth, 0F, 0F, 0F);

	body = new ModelRenderer(this, 0, 12);
	body.addBox(-2.5F, -7.5F, 0F, 5, 5, 5);
	body.setRotationPoint(0F, -2F, -2F);
	body.setTextureSize(64, 32);
	body.mirror = true;
	setRotation(body, 0F, 0F, 0F);

	butt = new ModelRenderer(this, 24, 20);
	butt.addBox(-2.5F, -3F, 0F, 5, 5, 7);
	butt.setRotationPoint(0F, -6.5F, 3F);
	butt.setTextureSize(64, 32);
	butt.mirror = false;
	setRotation(butt, -0.2617994F, 0F, 0F);

	stinger = new ModelRenderer(this, 18, 6);
	stinger.addBox(-0.5F, -0F, 7F, 1, 1, 2);
	stinger.setRotationPoint(0F, -6.5F, 3F);
	stinger.setTextureSize(64, 32);
	stinger.mirror = false;
	setRotation(stinger, -0.2617994F, 0F, 0F);

	legs = new ModelRenderer(this, 0, 22);
	legs.addBox(-2.5F, -3F, 0F, 5, 3, 7);
	legs.setRotationPoint(0F, -2F, -2F);
	legs.setTextureSize(64, 32);
	legs.mirror = false;
	setRotation(legs, 0F, 0F, 0F);

	leftwing = new ModelRenderer(this, 34, 0);
	leftwing.addBox(0F, -6F, -2F, 0, 5, 4);
	leftwing.setRotationPoint(1.5F, -8.5F, 0F);
	leftwing.setTextureSize(64, 32);
	setRotation(leftwing, 0F, 3.141593F, 0F);
	leftwing.mirror = true;

	rightwing = new ModelRenderer(this, 26, 0);
	rightwing.addBox(0F, -6F, -2F, 0, 5, 4);
	rightwing.setRotationPoint(-1F, -8.5F, 0F);
	rightwing.setTextureSize(64, 32);
	rightwing.mirror = true;
	setRotation(rightwing, 0F, 0F, 0F);
}

public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
{
	super.render(entity, f, f1, f2, f3, f4, f5);
	setRotationAngles(f, f1, f2, f3, f4, f5, entity);

	head.render(f5);
	rightantenna.render(f5);
	leftantenna.render(f5);
	mouth.render(f5);
	body.render(f5);
	butt.render(f5);
	stinger.render(f5);
	legs.render(f5);
	leftwing.render(f5);
	rightwing.render(f5);

}

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, Entity entity)
{
	//super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);

	this.head.rotateAngleX = f5 / (180F / (float)Math.PI);
	this.head.rotateAngleY = f4 / (180F / (float)Math.PI);
	this.head.rotateAngleZ = 0.0F;

	this.mouth.rotateAngleX = this.head.rotateAngleX;
	this.mouth.rotateAngleY = this.head.rotateAngleY;
	this.mouth.rotateAngleZ = this.head.rotateAngleZ;

	this.leftantenna.rotateAngleX = this.head.rotateAngleX;
	this.leftantenna.rotateAngleY = this.head.rotateAngleY + 0.7853982F;
	this.leftantenna.rotateAngleZ = this.head.rotateAngleZ;

	this.rightantenna.rotateAngleX = this.head.rotateAngleX;
	this.rightantenna.rotateAngleY = this.head.rotateAngleY + 0.7853982F;
	this.rightantenna.rotateAngleZ = this.head.rotateAngleZ;

	this.rightwing.rotateAngleZ = (0.3F * MathHelper.sin(f2 * 1.3F) + 0.4F) - 45F;
	this.leftwing.rotateAngleZ = -this.rightwing.rotateAngleZ;

}

}

 

Entity class

package hl.entities;

import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIAttackOnCollide;
import net.minecraft.entity.ai.EntityAILeapAtTarget;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.pathfinding.PathEntity;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.BlockPos;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.world.EnumDifficulty;
import net.minecraft.world.World;

public class EntityBee extends EntityMob
{
/** Coordinates of where the bat spawned. */
private BlockPos spawnPosition;
private int allySummonCooldown;
private float heightOffset = 2;
public float field_70889_i = 1.0F;

public EntityBee(World par1World)
{
	super(par1World);
	this.setSize(0.5F, 0.9F);
	this.setIsBeeHanging(false);
	this.tasks.addTask(0, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, false));
	this.tasks.addTask(1, new EntityAISwimming(this));
	this.tasks.addTask(2, new EntityAIWander(this, 1.0D));
	this.tasks.addTask(3, new EntityAILookIdle(this));
	this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true));
	this.tasks.addTask(4, new EntityAILeapAtTarget(this, 0.38F));

}
protected void entityInit()
{
	super.entityInit();
	this.dataWatcher.addObject(16, new Byte((byte)0));
}
/**
 * Returns true if this entity should push and be pushed by other entities when colliding.
 */
public boolean canBePushed()
{
	return false;
}
protected void applyEntityAttributes()
{
	super.applyEntityAttributes();
	this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(6.0D);
	this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(1.0D);
	this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.6D);

}
public boolean getIsBeeHanging()
{
	return false;
}

public void setIsBeeHanging(boolean par1)
{
	byte b0 = this.dataWatcher.getWatchableObjectByte(16);

	if (par1)
	{
		this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 1)));
	}
	else
	{
		this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -2)));
	}
}
protected int getExperiencePoints(EntityPlayer par1EntityPlayer)
{

	this.experienceValue = (int)((float)this.experienceValue * 0.5F);


	return super.getExperiencePoints(par1EntityPlayer);
}
/**
 * Returns true if the newer Entity AI code should be run
 */
protected boolean isAIEnabled()
{
	return true;
}
@Override
public void onLivingUpdate()
{
	super.onLivingUpdate();

	this.field_70889_i = (float)((double)this.field_70889_i * 0.9D);

	if (!this.onGround && this.motionY < 0.0D)
	{
		this.motionY *= 0.6D;
	}
}
@Override
public void writeEntityToNBT(NBTTagCompound par1NGTTagCompound)
{
	super.writeEntityToNBT(par1NGTTagCompound);
}
@Override
public void readEntityFromNBT(NBTTagCompound par1NGTTagCompound)
{
	super.readEntityFromNBT(par1NGTTagCompound);
}

@Override
protected boolean canDespawn()
{
	return false;
}
/**
 * Called to update the entity's position/logic.
 */
public void onUpdate()
{
	super.onUpdate();

	if (!this.worldObj.isRemote)
	{
		this.setBesideClimbableBlock(this.isCollidedHorizontally);
	}
}
public void setBesideClimbableBlock(boolean par1)
{
	byte b0 = this.dataWatcher.getWatchableObjectByte(16);

	if (par1)
	{
		b0 = (byte)(b0 | 1);
	}
	else
	{
		b0 &= -2;
	}

	this.dataWatcher.updateObject(16, Byte.valueOf(b0));
}
@Override
protected String getLivingSound()
{
	return "hl:bee_idle";
}
@Override
protected String getHurtSound()
{
	return "hl:bee_hurt";
}
@Override
protected String getDeathSound()
{
	return "hl:bee_hurt";
}

/**
 * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to
 * prevent them from trampling crops
 */
protected boolean canTriggerWalking()
{
	return false;
}

/**
 * Called when the mob is falling. Calculates and applies fall damage.
 */
protected void fall(float par1) {}

/**
 * Takes in the distance the entity has fallen this tick and whether its on the ground to update the fall distance
 * and deal fall damage if landing on the ground.  Args: distanceFallenThisTick, onGround
 */
protected void updateFallState(double par1, boolean par3) {}

/**
 * Return whether this entity should NOT trigger a pressure plate or a tripwire.
 */
public boolean doesEntityNotTriggerPressurePlate()
{
	return true;
}
/**
 * Called when the entity is attacked.
 */
public boolean attackEntityFrom(DamageSource par1DamageSource, float par2)
{
	if (this.isEntityInvulnerable(par1DamageSource))
	{
		return false;
	}
	else
	{
		if (!this.worldObj.isRemote && this.getIsBeeHanging())
		{
			this.setIsBeeHanging(false);
		}

		return super.attackEntityFrom(par1DamageSource, par2);
	}
}
/**
 * Finds the closest player within 16 blocks to attack, or null if this Entity isn't interested in attacking
 * (Animals, Spiders at day, peaceful PigZombies).
 */
protected Entity findPlayerToAttack()
{
	double d0 = 8.0D;
	return this.worldObj.getClosestPlayerToEntity(this, d0);
}

public boolean attackEntityAsMob(Entity par1Entity)
{
	if (super.attackEntityAsMob(par1Entity))
	{
		if (par1Entity instanceof EntityLivingBase)
		{
			byte b0 = 0;

			if (this.worldObj.getDifficulty() == EnumDifficulty.NORMAL)
			{
				b0 = 7;
			}
			else if (this.worldObj.getDifficulty() == EnumDifficulty.HARD)
			{
				b0 = 15;
			}

			if (b0 > 7)
			{
				((EntityLivingBase)par1Entity).addPotionEffect(new PotionEffect(Potion.poison.id, b0 * 10, 0));
			}
			this.setHealth(0);
		}

		return true;
	}
	else
	{
		return false;
	}
}

public boolean getCanSpawnHere()
{
	BlockPos blockpos = new BlockPos(this.posX, this.getEntityBoundingBox().minY, this.posZ);
	return this.worldObj.getLight(blockpos) > 7;

}
}

Don't blame me if i always ask for your help. I just want to learn to be better :)

Posted
if i spawn an entity in a server...

java.lang.NullPointerException: Rendering entity in world

 

Server + Renderer = crash.

 

Renderers don't belong on servers

 

Also:

WARNING: coremods are present:

  NowWithRendering (hopperducts-mc1.8-1.4.5.jar)

Contact their authors BEFORE contacting forge

 

What did the core mod authors say about the renderer crash?

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Posted

It crashes also without the core mod :/ So basically i should register the rendering only client side? And in that case how?

EDIT: it crashes also client side. The line 45 and 55 refers to the doRender and renderBee functions in the rendering class

Don't blame me if i always ask for your help. I just want to learn to be better :)

Posted

Maybe not :/ I had that functions just because is a port from 1.7.10, and i'm not really expert with rendering in general :S So i'll try removing them and see if it works

Don't blame me if i always ask for your help. I just want to learn to be better :)

Posted

Removed that functions, still crash :/ My class now looks like this

package hl.entities.renderer;

import org.lwjgl.opengl.GL11;

import hl.entities.EntityBee;
import hl.models.ModelBee;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public class RenderBee extends RenderLiving {

private float scale;


public RenderBee(RenderManager mgr, ModelBee par1ModelBase, float par2, float d)
{
	super(mgr, par1ModelBase, par2);
	this.scale = d;
}

protected void preRenderScale(EntityBee par1EntityBee, float par2)
{
	GL11.glScalef(this.scale, this.scale, this.scale);
}
protected void preRenderCallback(EntityLivingBase par1EntityLivingBase, float par2)
{
	this.preRenderScale((EntityBee)par1EntityLivingBase, par2);
}
@Override
protected ResourceLocation getEntityTexture(Entity entity) 
{
	return new ResourceLocation("hl:textures/mobs/bee.png");
}

}

Don't blame me if i always ask for your help. I just want to learn to be better :)

Posted

So it turns out that the problem was that i registered the rendering in the preInit method instead of the init xD Thanks to all who tried to help me :)

Don't blame me if i always ask for your help. I just want to learn to be better :)

Join the conversation

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

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

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

×   Your previous content has been restored.   Clear editor

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

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • So me and a couple of friends are playing with a shitpost mod pack and one of the mods in the pack is corail tombstone and for some reason there is a problem with it, where on death to fire the player will get kicked out of the server and the tombstone will not spawn basically deleting an entire inventory, it doesn't matter what type of fire it is, whether it's from vanilla fire/lava, or from modded fire like ice&fire/lycanites and it's common enough to where everyone on the server has experienced at least once or twice and it doesn't give any crash log. a solution to this would be much appreciated thank you!
    • It is 1.12.2 - I have no idea if there is a 1.12 pack
    • Okay, but does the modpack works with 1.12 or just with 1.12.2, because I need the Forge client specifically for Minecraft 1.12, not 1.12.2
    • Version 1.19 - Forge 41.0.63 I want to create a wolf entity that I can ride, so far it seems to be working, but the problem is that when I get on the wolf, I can’t control it. I then discovered that the issue is that the server doesn’t detect that I’m riding the wolf, so I’m struggling with synchronization. However, it seems to not be working properly. As I understand it, the server receives the packet but doesn’t register it correctly. I’m a bit new to Java, and I’ll try to provide all the relevant code and prints *The comments and prints are translated by chatgpt since they were originally in Spanish* Thank you very much in advance No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. MountableWolfEntity package com.vals.valscraft.entity; import com.vals.valscraft.network.MountSyncPacket; import com.vals.valscraft.network.NetworkHandler; import net.minecraft.client.Minecraft; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.animal.Wolf; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.Entity; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; import net.minecraftforge.event.TickEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.network.PacketDistributor; public class MountableWolfEntity extends Wolf { private boolean hasSaddle; private static final EntityDataAccessor<Byte> DATA_ID_FLAGS = SynchedEntityData.defineId(MountableWolfEntity.class, EntityDataSerializers.BYTE); public MountableWolfEntity(EntityType<? extends Wolf> type, Level level) { super(type, level); this.hasSaddle = false; } @Override protected void defineSynchedData() { super.defineSynchedData(); this.entityData.define(DATA_ID_FLAGS, (byte)0); } public static AttributeSupplier.Builder createAttributes() { return Wolf.createAttributes() .add(Attributes.MAX_HEALTH, 20.0) .add(Attributes.MOVEMENT_SPEED, 0.3); } @Override public InteractionResult mobInteract(Player player, InteractionHand hand) { ItemStack itemstack = player.getItemInHand(hand); if (itemstack.getItem() == Items.SADDLE && !this.hasSaddle()) { if (!player.isCreative()) { itemstack.shrink(1); } this.setSaddle(true); return InteractionResult.SUCCESS; } else if (!level.isClientSide && this.hasSaddle()) { player.startRiding(this); MountSyncPacket packet = new MountSyncPacket(true); // 'true' means the player is mounted NetworkHandler.CHANNEL.sendToServer(packet); // Ensure the server handles the packet return InteractionResult.SUCCESS; } return InteractionResult.PASS; } @Override public void travel(Vec3 travelVector) { if (this.isVehicle() && this.getControllingPassenger() instanceof Player) { System.out.println("The wolf has a passenger."); System.out.println("The passenger is a player."); Player player = (Player) this.getControllingPassenger(); // Ensure the player is the controller this.setYRot(player.getYRot()); this.yRotO = this.getYRot(); this.setXRot(player.getXRot() * 0.5F); this.setRot(this.getYRot(), this.getXRot()); this.yBodyRot = this.getYRot(); this.yHeadRot = this.yBodyRot; float forward = player.zza; float strafe = player.xxa; if (forward <= 0.0F) { forward *= 0.25F; } this.flyingSpeed = this.getSpeed() * 0.1F; this.setSpeed((float) this.getAttributeValue(Attributes.MOVEMENT_SPEED) * 1.5F); this.setDeltaMovement(new Vec3(strafe, travelVector.y, forward).scale(this.getSpeed())); this.calculateEntityAnimation(this, false); } else { // The wolf does not have a passenger or the passenger is not a player System.out.println("No player is mounted, or the passenger is not a player."); super.travel(travelVector); } } public boolean hasSaddle() { return this.hasSaddle; } public void setSaddle(boolean hasSaddle) { this.hasSaddle = hasSaddle; } @Override protected void dropEquipment() { super.dropEquipment(); if (this.hasSaddle()) { this.spawnAtLocation(Items.SADDLE); this.setSaddle(false); } } @SubscribeEvent public static void onServerTick(TickEvent.ServerTickEvent event) { if (event.phase == TickEvent.Phase.START) { MinecraftServer server = net.minecraftforge.server.ServerLifecycleHooks.getCurrentServer(); if (server != null) { for (ServerPlayer player : server.getPlayerList().getPlayers()) { if (player.isPassenger() && player.getVehicle() instanceof MountableWolfEntity) { MountableWolfEntity wolf = (MountableWolfEntity) player.getVehicle(); System.out.println("Tick: " + player.getName().getString() + " is correctly mounted on " + wolf); } } } } } private boolean lastMountedState = false; @Override public void tick() { super.tick(); if (!this.level.isClientSide) { // Only on the server boolean isMounted = this.isVehicle() && this.getControllingPassenger() instanceof Player; // Only print if the state changed if (isMounted != lastMountedState) { if (isMounted) { Player player = (Player) this.getControllingPassenger(); // Verify the passenger is a player System.out.println("Server: Player " + player.getName().getString() + " is now mounted."); } else { System.out.println("Server: The wolf no longer has a passenger."); } lastMountedState = isMounted; } } } @Override public void addPassenger(Entity passenger) { super.addPassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(true)); } } } @Override public void removePassenger(Entity passenger) { super.removePassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is no longer mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(false)); } } } @Override public boolean isControlledByLocalInstance() { Entity entity = this.getControllingPassenger(); return entity instanceof Player; } @Override public void positionRider(Entity passenger) { if (this.hasPassenger(passenger)) { double xOffset = Math.cos(Math.toRadians(this.getYRot() + 90)) * 0.4; double zOffset = Math.sin(Math.toRadians(this.getYRot() + 90)) * 0.4; passenger.setPos(this.getX() + xOffset, this.getY() + this.getPassengersRidingOffset() + passenger.getMyRidingOffset(), this.getZ() + zOffset); } } } MountSyncPacket package com.vals.valscraft.network; import com.vals.valscraft.entity.MountableWolfEntity; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class MountSyncPacket { private final boolean isMounted; public MountSyncPacket(boolean isMounted) { this.isMounted = isMounted; } public void encode(FriendlyByteBuf buffer) { buffer.writeBoolean(isMounted); } public static MountSyncPacket decode(FriendlyByteBuf buffer) { return new MountSyncPacket(buffer.readBoolean()); } public void handle(NetworkEvent.Context context) { context.enqueueWork(() -> { ServerPlayer player = context.getSender(); // Get the player from the context if (player != null) { // Verifies if the player has dismounted if (!isMounted) { Entity vehicle = player.getVehicle(); if (vehicle instanceof MountableWolfEntity wolf) { // Logic to remove the player as a passenger wolf.removePassenger(player); System.out.println("Server: Player " + player.getName().getString() + " is no longer mounted."); } } } }); context.setPacketHandled(true); // Marks the packet as handled } } networkHandler package com.vals.valscraft.network; import com.vals.valscraft.valscraft; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.network.NetworkRegistry; import net.minecraftforge.network.simple.SimpleChannel; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class NetworkHandler { private static final String PROTOCOL_VERSION = "1"; public static final SimpleChannel CHANNEL = NetworkRegistry.newSimpleChannel( new ResourceLocation(valscraft.MODID, "main"), () -> PROTOCOL_VERSION, PROTOCOL_VERSION::equals, PROTOCOL_VERSION::equals ); public static void init() { int packetId = 0; // Register the mount synchronization packet CHANNEL.registerMessage( packetId++, MountSyncPacket.class, MountSyncPacket::encode, MountSyncPacket::decode, (msg, context) -> msg.handle(context.get()) // Get the context with context.get() ); } }  
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.