Skip to content

Instantly share code, notes, and snippets.

@robot9706
Created April 13, 2019 11:23
Show Gist options
  • Select an option

  • Save robot9706/5fda11a15bba0994126545fe99f5e338 to your computer and use it in GitHub Desktop.

Select an option

Save robot9706/5fda11a15bba0994126545fe99f5e338 to your computer and use it in GitHub Desktop.
//Get ores
String[] allOres = OreDictionary.getOreNames();
List<String> ores = new ArrayList<String>();
for(String ore : allOres) {
if (ore.startsWith("ore")) {
ores.add(ore);
}
}
ores.size();
//States (lumberjack)
Block block = Blocks.LOG;
List<Integer> possibleMeta = new ArrayList<Integer>();
for (IBlockState state : block.getBlockState().getValidStates()) {
int meta = block.getMetaFromState(state);
if (!possibleMeta.contains(meta)){
possibleMeta.add(meta);
}
}
possibleMeta.size();
//Hunting
List<Class> animalList = new ArrayList<Class>();
for (Entry<ResourceLocation, EntityEntry> e : ForgeRegistries.ENTITIES.getEntries()) {
EntityEntry entity = e.getValue();
Class<? extends Entity> entityClass = entity.getEntityClass();
if (EntityAnimal.class.isAssignableFrom(entityClass)) {
animalList.add(entityClass);
}
}
animalList.size();
//Foods
Map<ItemStack, ItemStack> cookRecipes = FurnaceRecipes.instance().getSmeltingList();
for (Entry<ResourceLocation, Item> i : ForgeRegistries.ITEMS.getEntries()) {
Item item = i.getValue();
Class itemClass = item.getClass();
if (ItemFood.class.isAssignableFrom(itemClass)) {
for (ItemStack input : cookRecipes.keySet()) {
if (input.getItem() == item) {
Item cookOutput = cookRecipes.get(input).getItem();
break;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment