use of cc.lasmgratel.foodcraftreloaded.minecraft.client.util.masking.CustomModelMasking in project FoodCraft-Reloaded by LasmGratel.
the class RegisterLoader method detectAndRegisterLiqueur.
public void detectAndRegisterLiqueur(RegistryEvent.Register<Item> event) {
event.getRegistry().getKeys().stream().filter(s -> s.getResourcePath().contains("liqueur")).map(ForgeRegistries.ITEMS::getValue).collect(Collectors.toList()).forEach(liqueur -> {
for (LiqueurType liqueurType : LiqueurTypes.values()) {
if (liqueurType == LiqueurTypes.NORMAL)
continue;
ItemGeneratedLiqueur typedLiqueur = new ItemGeneratedLiqueur(MathHelper.floor(liqueurType.getHealModifier() * ((ItemFood) liqueur).getHealAmount(new ItemStack(liqueur))));
typedLiqueur.setLiqueurType(liqueurType);
typedLiqueur.setItemStackDisplayNameCallback(liqueur::getItemStackDisplayName);
typedLiqueur.setRegistryName(liqueur.getRegistryName().getResourceDomain(), liqueurType.getUnlocalizedName() + "_" + liqueur.getRegistryName().getResourcePath());
typedLiqueur.setUnlocalizedName(liqueur.getUnlocalizedName());
event.getRegistry().register(typedLiqueur);
OreDictionary.registerOre("listAll" + StringUtils.capitalize(liqueurType.getUnlocalizedName()) + "liqueur", typedLiqueur);
OreDictionary.registerOre("listAllliqueur", typedLiqueur);
OreDictionary.registerOre("listAllfoods", typedLiqueur);
if (liqueur instanceof CustomModelMasking)
FoodCraftReloadedMod.getLoader(LiqueurLoader.class).get().getLiqueurCustomModelMap().put(typedLiqueur, (CustomModelMasking) liqueur);
}
});
}
use of cc.lasmgratel.foodcraftreloaded.minecraft.client.util.masking.CustomModelMasking in project FoodCraft-Reloaded by LasmGratel.
the class BlockLoader method registerRenders.
@Load(side = Side.CLIENT)
public void registerRenders() {
for (Field field : FCRBlocks.class.getFields()) {
field.setAccessible(true);
RegBlock anno = field.getAnnotation(RegBlock.class);
if (anno == null)
continue;
try {
Block block = (Block) field.get(null);
if (block instanceof CustomModelMasking) {
ModelLoader.setCustomStateMapper(block, b -> ((CustomModelMasking) b).getStateModelLocations());
if (((CustomModelMasking) block).getModelLocation() != null) {
registerRender(Item.getItemFromBlock(block), 0, ((CustomModelMasking) block).getModelLocation());
return;
}
}
registerRender(block, 0);
} catch (Exception e) {
FoodCraftReloaded.getLogger().warn("Un-able to register block " + field.toGenericString(), e);
}
}
}
use of cc.lasmgratel.foodcraftreloaded.minecraft.client.util.masking.CustomModelMasking in project FoodCraft-Reloaded by LasmGratel.
the class ItemLoader method registerRenders.
@Load(side = Side.CLIENT)
public void registerRenders() {
for (Field field : FCRItems.class.getFields()) {
field.setAccessible(true);
RegItem anno = field.getAnnotation(RegItem.class);
try {
if (anno == null)
continue;
Item item = (Item) field.get(null);
if (item instanceof CustomModelMasking && ((CustomModelMasking) item).getModelLocation() != null) {
ModelLoader.setCustomModelResourceLocation(item, 0, ((CustomModelMasking) item).getModelLocation());
}
if (item.getHasSubtypes()) {
if (item instanceof IMetadatable) {
for (int i = 0; i < ((IMetadatable) item).getMaxMetadata(); i++) registerRender(item, i);
}
} else {
registerRender(item, 0);
}
} catch (Exception e) {
FoodCraftReloaded.getLogger().warn("Un-able to register item " + field.toGenericString(), e);
}
}
}
Aggregations