Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hey!

So I have projectiles, they render on the singleplayer, but not on a server.

My classes:

Main:

@Mod(modid = "dinocraft", name = Reference.NAME, version = Reference.VERSION)
public class Dinocraft 
{
	me.dinocraft.handlers.EventHandler eventHandler = new me.dinocraft.handlers.EventHandler();
	
	public static final CreativeTabs BLOCKS = new TabDinocraftBlocks();
	public static final CreativeTabs ITEMS = new TabDinocraftItems();
	
	@Mod.Instance(Reference.MODID)
	public static Dinocraft instance;
	
	@SidedProxy(serverSide = Reference.SERVER_PROXY_CLASS, clientSide = Reference.CLIENT_PROXY_CLASS)
	public static ServerProxy PROXY;
	
	@EventHandler
	public void preInit(FMLPreInitializationEvent event)
	{
		DinocraftItems.register();
		DinocraftBlocks.register();
		DinocraftTools.register();
		DinocraftArmour.register();
		//DinocraftAchievements.register();
		
		PROXY.registerRenders();
		PROXY.preInit(event);
		
		DinocraftCapabilities.registerCapabilities();
	}
	
	@EventHandler
	public void init(FMLInitializationEvent event)
	{
		PROXY.init();
		RecipeHandler.registerCraftingRecipes();
		RecipeHandler.registerFurnaceRecipes();
		MinecraftForge.EVENT_BUS.register(DinocraftSoundEvents.class);
		MinecraftForge.EVENT_BUS.register(RecipeHandler.class);
		NetworkHandler.init();
		eventHandler.init();
	}
	
	@EventHandler
	public void postInit(FMLPostInitializationEvent event)
	{
		
	}
	
	@EventHandler
	public void serverLoad(FMLServerStartingEvent event)
	{
		event.registerServerCommand(new CommandMaxHealth());
		event.registerServerCommand(new CommandFeed());
		event.registerServerCommand(new CommandHeal());
		event.registerServerCommand(new CommandBoing());
		event.registerServerCommand(new CommandAsServer());
		event.registerServerCommand(new CommandPing());
		event.registerServerCommand(new CommandBreak());
		event.registerServerCommand(new CommandJump());
		event.registerServerCommand(new CommandFly());
		event.registerServerCommand(new CommandKaboom());
	}
}

DinocraftEntities:

public class DinocraftEntities
{
	@SideOnly(Side.CLIENT)
	public static void init()
	{
		int id = 0;

		EntityRegistry.registerModEntity(RenderEntities.VINE_BALL_TEXTURE, EntityVineBall.class, "vine_ball", id++, Dinocraft.instance, 64, 10, true);
		EntityRegistry.registerModEntity(RenderEntities.POISON_BALL_TEXTURE, EntityPoisonBall.class, "poison_ball", id++, Dinocraft.instance, 64, 10, true);
		EntityRegistry.registerModEntity(RenderEntities.RAY_BULLET_TEXTURE, EntityRayBullet.class, "ray_bullet", id++, Dinocraft.instance, 64, 10, true);
	} 
	/*
	private static int id;

	public static void preInit() 
	{
		registerEntity(EntityVineBall.class);
		registerEntity(EntityPoisonBall.class);
		registerEntity(EntityRayBullet.class);
	} */
/*
	private static void registerEntity(Class clazz) 
	{
		EntityRegistry.registerModEntity(new ResourceLocation(Reference.MODID + ":textures/items/vine_ball.png"), clazz, "vine_ball", ++id, Dinocraft.instance, 64, 3, true);
		EntityRegistry.registerModEntity(new ResourceLocation(Reference.MODID + ":textures/items/poison_ball.png"), clazz, "poison_ball", ++id, Dinocraft.instance, 64, 3, true);
		EntityRegistry.registerModEntity(new ResourceLocation(Reference.MODID + ":textures/items/ray_bullet.png"), clazz, "ray_bullet", ++id, Dinocraft.instance, 64, 3, true);

		/*
		String unlocalizedName = clazz.getSimpleName().replace("Entity", ""); 
		unlocalizedName = unlocalizedName.substring(0, 1).toLowerCase() + unlocalizedName.substring(1);
		ResourceLocation registryName = new ResourceLocation(Reference.MODID, unlocalizedName);
		EntityRegistry.registerModEntity(registryName, clazz, unlocalizedName, ++id, Dinocraft.instance, 64, 3, true);
	*/
	//}
}

RenderEntities:

public class RenderEntities extends RenderEntity 
{
	public RenderEntities(RenderManager render)
	{
	    super(render);
	}

	public static final ResourceLocation VINE_BALL_TEXTURE = new ResourceLocation(Reference.MODID + ":textures/items/vine_ball.png");
	public static final ResourceLocation POISON_BALL_TEXTURE = new ResourceLocation(Reference.MODID + ":textures/items/poison_ball.png");
	public static final ResourceLocation RAY_BULLET_TEXTURE = new ResourceLocation(Reference.MODID + ":textures/items/ray_bullet.png");
}

ServerProxy:

public class ServerProxy
{	
	public void preInit(FMLPreInitializationEvent event) 
	{

	}
	
	public void init()
	{
		GameRegistry.registerWorldGenerator(new OreGen(), 0);
	}
	
	public void registerRenders() 
	{
		
	}
	
	public EntityPlayer getPlayer()
	{
        return null;
    }
}

ClientProxy:

public class ClientProxy extends ServerProxy 
{
	@Override
	public void preInit(FMLPreInitializationEvent event)
	{
		super.preInit(event);
		initRenderers();
		DinocraftEntities.init();
		//registerEntityRenders();
	}
	
	@SideOnly(Side.CLIENT)
	private void initRenderers() 
	{
		RenderingRegistry.registerEntityRenderingHandler(EntityVineBall.class, renderManager -> new RenderSnowball(renderManager, DinocraftItems.VINE_BALL, Minecraft.getMinecraft().getRenderItem()));
		RenderingRegistry.registerEntityRenderingHandler(EntityPoisonBall.class, renderManager -> new RenderSnowball(renderManager, DinocraftItems.POISON_BALL, Minecraft.getMinecraft().getRenderItem()));
		RenderingRegistry.registerEntityRenderingHandler(EntityRayBullet.class, renderManager -> new RenderSnowball(renderManager, DinocraftItems.RAY_BULLET, Minecraft.getMinecraft().getRenderItem()));
	}
	
	/*
	private static void registerEntityRenders() 
	{
		RenderingRegistry.registerEntityRenderingHandler(EntityVineBall.class, RenderVineBall::new);
		RenderingRegistry.registerEntityRenderingHandler(EntityPoisonBall.class, RenderPoisonBall::new);
		RenderingRegistry.registerEntityRenderingHandler(EntityRayBullet.class, RenderRayBullet::new);
	} */
	
	@Override
	public void registerRenders() 
	{
		DinocraftItems.registerRenders();
		DinocraftBlocks.registerRenders();
		DinocraftTools.registerRenders();
		DinocraftArmour.registerRenders();
	}
	
	@Override
    public EntityPlayer getPlayer()
	{
        return FMLClientHandler.instance().getClient().player;
	}
}

 

I'm not too sure what's wrong, and I'll take any criticisms.

Any suggestions are welcome.

Thank you!

Edited by Differentiation

  • Author
19 minutes ago, diesieben07 said:

Why on earth do you only register your entities on the client? And you should use RegistryEvent.Register<EntityEntry> in combination with EntityEntryBuilder to register your entities.

 

I'll take the advice into consideration!

Thank you!

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.