Created
August 15, 2019 11:12
-
-
Save arjolpanci/60b1ac925525f7b5374af9d45e2ee3bf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package teabx.vanillaextended.entities; | |
import net.minecraft.entity.Entity; | |
import net.minecraft.entity.EntityClassification; | |
import net.minecraft.entity.EntityType; | |
import net.minecraft.item.Item; | |
import net.minecraft.item.ItemGroup; | |
import net.minecraft.item.SpawnEggItem; | |
import net.minecraft.world.biome.Biome; | |
import net.minecraft.world.biome.Biomes; | |
import net.minecraftforge.event.RegistryEvent; | |
import teabx.vanillaextended.main.VanillaExtended; | |
public class EntityRegistry { | |
//Entities | |
public static EntityType<?> LOST_MINER = EntityType.Builder.create(LostMiner::new, EntityClassification.MONSTER) | |
.build("lost_miner").setRegistryName(VanillaExtended.rloc("lost_miner")); | |
//Item Eggs | |
public static Item lost_miner_egg; | |
public static void registerEntitySpawn(){ | |
getEntitySpawn(LOST_MINER, EntityClassification.MONSTER); | |
} | |
public static void getEntitySpawn(EntityType<?> e, EntityClassification e_class){ | |
Biome[] biomes = {Biomes.BADLANDS, Biomes.BADLANDS_PLATEAU, Biomes.BAMBOO_JUNGLE, Biomes.BAMBOO_JUNGLE_HILLS, | |
Biomes.BIRCH_FOREST, Biomes.BIRCH_FOREST_HILLS, Biomes.DARK_FOREST, Biomes.DARK_FOREST_HILLS, Biomes.DESERT, Biomes.DESERT_HILLS, | |
Biomes.END_BARRENS, Biomes.PLAINS}; | |
for(Biome biome : biomes){ | |
if(biome != null){ | |
biome.getSpawns(e_class).add(new Biome.SpawnListEntry(e, 10, 1, 8)); | |
} | |
} | |
} | |
public static Item generateSpawnEgg(EntityType<?> e, int col1, int col2, String name){ | |
SpawnEggItem egg = new SpawnEggItem(e, col1, col2, new Item.Properties().group(ItemGroup.MISC)); | |
egg.setRegistryName(VanillaExtended.rloc(name)); | |
return egg; | |
} | |
public static void registerSpawnEggs(final RegistryEvent.Register<Item> e){ | |
e.getRegistry().registerAll( | |
lost_miner_egg = generateSpawnEgg(LOST_MINER, 0x3273a8, 0xf7f411, "lost_miner_egg") | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment