use of pokefenn.totemic.lib.WoodVariant in project Totemic by TeamTotemic.
the class ModItems method setItemModels.
@SubscribeEvent
@SideOnly(Side.CLIENT)
public static void setItemModels(ModelRegistryEvent event) {
setDefaultModel(ModBlocks.cedar_log);
setDefaultModel(ModBlocks.stripped_cedar_log);
setDefaultModel(ModBlocks.cedar_plank);
setDefaultModel(ModBlocks.cedar_sapling);
setDefaultModel(ModBlocks.cedar_leaves);
setDefaultModel(ModBlocks.totem_torch);
setDefaultModel(ModBlocks.drum);
setDefaultModel(ModBlocks.wind_chime);
setDefaultModel(ModBlocks.tipi);
for (WoodVariant var : WoodVariant.values()) {
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ModBlocks.totem_base), var.ordinal(), new ModelResourceLocation(ModBlocks.totem_base.getRegistryName(), "wood=" + var.getName()));
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ModBlocks.totem_pole), var.ordinal(), new ModelResourceLocation(ModBlocks.totem_pole.getRegistryName(), "wood=" + var.getName()));
}
setDefaultModel(flute);
setModel(flute, 1, flute.getRegistryName().toString());
setDefaultModel(rattle);
setDefaultModel(jingle_dress);
setDefaultModel(eagle_bone_whistle);
setDefaultModel(totem_whittling_knife);
setDefaultModel(bark_stripper);
setDefaultModel(totemic_staff);
setDefaultModel(totempedia);
setDefaultModel(buffalo_meat);
setDefaultModel(cooked_buffalo_meat);
setDefaultModel(baykok_bow);
setModel(medicine_bag, 0, medicine_bag.getRegistryName().toString() + "_closed");
setModel(medicine_bag, 1, medicine_bag.getRegistryName().toString() + "_open");
setDefaultModel(ceremony_cheat);
setModel(sub_items, 1, Strings.RESOURCE_PREFIX + ItemTotemicItems.Type.iron_bells.toString());
for (ItemBuffaloDrops.Type t : ItemBuffaloDrops.Type.values()) setModel(buffalo_items, t.ordinal(), Strings.RESOURCE_PREFIX + t.toString());
for (ItemEagleDrops.Type t : ItemEagleDrops.Type.values()) setModel(eagle_drops, t.ordinal(), Strings.RESOURCE_PREFIX + t.toString());
}
use of pokefenn.totemic.lib.WoodVariant in project Totemic by TeamTotemic.
the class ItemTotemWhittlingKnife method onItemUse.
@Override
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
ItemStack stack = player.getHeldItem(hand);
if (player.isSneaking()) {
player.setHeldItem(hand, changeIndex(stack, true));
return EnumActionResult.SUCCESS;
} else {
IBlockState state = world.getBlockState(pos);
WoodVariant wood = WoodVariant.fromLog(state);
if (wood == null) {
// Fall back to oak if it is an unrecognized log type
if (state.getBlock().isWood(world, pos) && state.getBlock() != ModBlocks.stripped_cedar_log)
wood = WoodVariant.OAK;
else
return EnumActionResult.FAIL;
}
TotemEffect effect = getCarvingEffect(stack);
if (effect != null) {
world.setBlockState(pos, ModBlocks.totem_pole.getDefaultState().withProperty(BlockTotemPole.WOOD, wood), 0);
TileTotemPole tile = (TileTotemPole) world.getTileEntity(pos);
tile.setEffect(effect);
tile.markForUpdate();
} else {
world.setBlockState(pos, ModBlocks.totem_base.getDefaultState().withProperty(BlockTotemBase.WOOD, wood), 3);
}
state = world.getBlockState(pos);
state.getBlock().onBlockPlacedBy(world, pos, state, player, stack);
stack.damageItem(1, player);
return EnumActionResult.SUCCESS;
}
}
Aggregations