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

I really don'y know why my custom entity isn't spawning, I have done it like this before. I believe I am missing something really obvious here, but I am not sure.

 

package com.livingblocks.entities;

import java.util.List;

import net.minecraft.entity.EntityList;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.BiomeDictionary;
import net.minecraftforge.common.BiomeDictionary.Type;

import com.livingblocks.main.LivingBlocks;

import cpw.mods.fml.common.registry.EntityRegistry;

public class RegisterEntities {

public static void registerEntity() {

	createEntityBlockAll(EntityBlockAll.class, "entity_block_all", 0x79553A, 0x6FAE44);

}

public static void createEntityBlockAll(Class entityClass, String entityName, int solidColour, int spotColour) {

	int randomID = EntityRegistry.findGlobalUniqueEntityId();

	EntityRegistry.registerGlobalEntityID(entityClass, entityName, randomID);
	EntityRegistry.registerModEntity(entityClass, entityName, randomID, LivingBlocks.modInstance, 64, 1, true);
	EntityRegistry.addSpawn(entityName, 1000, 10, 10, EnumCreatureType.monster);

	CreateEgg(randomID, solidColour, spotColour);

}

public static void createEntityBlock(Class entityClass, String entityName, int solidColour, int spotColour) {

	BiomeGenBase[] a = BiomeDictionary.getBiomesForType(Type.FOREST);
	BiomeGenBase[] b = BiomeDictionary.getBiomesForType(Type.PLAINS);

	int randomID = EntityRegistry.findGlobalUniqueEntityId();

	EntityRegistry.registerGlobalEntityID(entityClass, entityName, randomID);
	EntityRegistry.registerModEntity(entityClass, entityName, randomID, LivingBlocks.modInstance, 64, 1, true);
	EntityRegistry.addSpawn(entityName, 1000, 1, 1, EnumCreatureType.creature, a);
	EntityRegistry.addSpawn(entityName, 1000, 1, 1, EnumCreatureType.creature, b);

	CreateEgg(randomID, solidColour, spotColour);

}

private static void CreateEgg(int randomID, int solidColour, int spotColour) {

	EntityList.entityEggs.put(Integer.valueOf(randomID), new EntityList.EntityEggInfo(randomID, solidColour, spotColour));

}

}

 

package com.livingblocks.main;

import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraftforge.common.BiomeDictionary;

import com.livingblocks.entities.RegisterEntities;
import com.livingblocks.items.ItemTab;
import com.livingblocks.network.ClientPacketHandler;
import com.livingblocks.network.ServerPacketHandler;

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.FMLEventChannel;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

@Mod(name = LivingBlocks.NAME, modid = LivingBlocks.MODID, version = LivingBlocks.VERSION)
public class LivingBlocks {

public static final String NAME = "Living Blocks";
public static final String MODID = "livingblocks";
public static final String VERSION = "2.0.0";

public static final String networkChannelName = "Living Blocks";
public static FMLEventChannel channel;

public final static int PACKET_TYPE_ENTITY_SYNC = 1;
public final static int PACKET_TYPE_C2S_TEST = 1;

@SidedProxy(clientSide = "com.livingblocks.main.ClientProxy", serverSide = "com.livingblocks.main.ServerProxy")
public static ServerProxy proxy;

@Instance(LivingBlocks.MODID)
public static LivingBlocks modInstance;

public static Item itemTab = new ItemTab();

public static CreativeTabs tabBlocklings = new CreativeTabs("tabBlocklings") {

	@Override
	@SideOnly(Side.CLIENT)
	public Item getTabIconItem() {

		return itemTab;

	}

};

@EventHandler
public void preInit(FMLPreInitializationEvent e) {

	RegisterEntities.registerEntity();

	BiomeDictionary.registerAllBiomes();

	proxy.renderThings();

}

@EventHandler
public void init(FMLInitializationEvent e) {

	LivingBlocks.channel = NetworkRegistry.INSTANCE.newEventDrivenChannel(LivingBlocks.networkChannelName);
	LivingBlocks.channel.register(new ServerPacketHandler());
	LivingBlocks.channel.register(new ClientPacketHandler());

	proxy.renderThings();

}

@EventHandler
public void postInit(FMLPostInitializationEvent e) {



}

}

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.