use of net.silentchaos512.gems.lib.EnumGem in project SilentGems by SilentChaos512.
the class BlockGemBrick method addRecipes.
@Override
public void addRecipes(RecipeMaker recipes) {
ItemStack bricks = new ItemStack(Blocks.STONEBRICK, 1, OreDictionary.WILDCARD_VALUE);
for (int i = 0; i < 16; ++i) {
EnumGem gem = getGem(i);
recipes.addSurroundOre(blockName + i, new ItemStack(this, 8, i), coated ? gem.getItemOreName() : gem.getShardOreName(), bricks);
}
}
use of net.silentchaos512.gems.lib.EnumGem in project SilentGems by SilentChaos512.
the class BlockGemSubtypes method getModels.
@Override
public void getModels(Map<Integer, ModelResourceLocation> models) {
for (int i = 0; i < 16; ++i) {
EnumGem gem = EnumGem.values()[i];
models.put(i, new ModelResourceLocation(getFullName().toLowerCase(), "gem=" + gem.getName()));
}
}
use of net.silentchaos512.gems.lib.EnumGem in project SilentGems by SilentChaos512.
the class ItemGlowRoseFertilizer method clOnItemUse.
@Override
protected EnumActionResult clOnItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
Random rand = SilentGems.random;
BlockPos center = pos.offset(EnumFacing.UP);
if (worldIn.isAirBlock(center)) {
// Always one at position used.
EnumGem gem = EnumGem.values()[rand.nextInt(16)];
IBlockState glowRose = ModBlocks.glowRose.getDefaultState().withProperty(EnumGem.VARIANT_GEM, gem);
// Fail to use if glow rose can't be placed at center.
if (!ModBlocks.glowRose.canBlockStay(worldIn, center, glowRose) || !worldIn.isAirBlock(center) || !worldIn.isAirBlock(center.up()))
return EnumActionResult.FAIL;
else // Only make changes on the server side!
if (worldIn.isRemote)
return EnumActionResult.SUCCESS;
worldIn.setBlockState(center, glowRose, 2);
// Random extras
int extraCount = rand.nextInt(3);
BlockPos target;
int x, y, z;
for (int i = 0; i < extraCount; ++i) {
x = center.getX() + rand.nextInt(7) - 3;
z = center.getZ() + rand.nextInt(7) - 3;
// Try place one block higher, move down 1-2 if needed.
for (y = center.getY() + 1; y > center.getY() - 2; --y) {
target = new BlockPos(x, y, z);
gem = EnumGem.values()[rand.nextInt(16)];
glowRose = ModBlocks.glowRose.getDefaultState().withProperty(EnumGem.VARIANT_GEM, gem);
if (ModBlocks.glowRose.canBlockStay(worldIn, target, glowRose) && worldIn.isAirBlock(target) && worldIn.isAirBlock(target.up())) {
worldIn.setBlockState(target, glowRose, 2);
break;
}
}
}
if (!playerIn.capabilities.isCreativeMode)
StackHelper.shrink(playerIn.getHeldItem(hand), 1);
return EnumActionResult.SUCCESS;
}
return EnumActionResult.FAIL;
}
use of net.silentchaos512.gems.lib.EnumGem in project SilentGems by SilentChaos512.
the class ItemReturnHome method clGetSubItems.
@Override
protected void clGetSubItems(Item item, CreativeTabs tab, List<ItemStack> list) {
if (!ItemHelper.isInCreativeTab(item, tab))
return;
for (EnumGem gem : EnumGem.values()) {
ItemStack stack = new ItemStack(item, 1, gem.ordinal());
setCharge(stack, getMaxCharge(stack));
list.add(stack);
}
}
use of net.silentchaos512.gems.lib.EnumGem in project SilentGems by SilentChaos512.
the class ItemReturnHome method addRecipes.
@Override
public void addRecipes(RecipeMaker recipes) {
for (EnumGem gem : EnumGem.values()) {
ItemStack result = new ItemStack(this, 1, gem.ordinal());
recipes.addShapedOre("return_home_" + gem.name(), result, " s ", "sgs", "ici", 's', ModItems.craftingMaterial.gildedString, 'g', gem.getItemOreName(), 'i', "ingotGold", 'c', new ItemStack(ModItems.chaosOrb, 1, ItemChaosOrb.Type.FRAGILE.ordinal()));
}
}
Aggregations