use of net.minecraft.util.ResourceLocation in project ImmersiveEngineering by BluSunrize.
the class ActuallyAdditionsHelper method postInit.
@Override
public void postInit() {
Item coffeeSeeds = Item.REGISTRY.getObject(new ResourceLocation("actuallyadditions:itemCoffeeSeed"));
Item coffeeBeans = Item.REGISTRY.getObject(new ResourceLocation("actuallyadditions:itemCoffeeBeans"));
Block coffeeBlock = Block.REGISTRY.getObject(new ResourceLocation("actuallyadditions:blockCoffee"));
if (coffeeSeeds != null && coffeeBeans != null && coffeeBlock != null)
BelljarHandler.cropHandler.register(new ItemStack(coffeeSeeds), new ItemStack[] { new ItemStack(coffeeBeans, 3), new ItemStack(coffeeSeeds) }, new ItemStack(Blocks.DIRT), coffeeBlock.getDefaultState());
Item riceSeeds = Item.REGISTRY.getObject(new ResourceLocation("actuallyadditions:itemRiceSeed"));
Item food = Item.REGISTRY.getObject(new ResourceLocation("actuallyadditions:itemFood"));
Block riceBlock = Block.REGISTRY.getObject(new ResourceLocation("actuallyadditions:blockRice"));
if (riceSeeds != null && food != null && riceBlock != null)
BelljarHandler.cropHandler.register(new ItemStack(riceSeeds), new ItemStack[] { new ItemStack(food, 2, 16), new ItemStack(riceSeeds) }, new ItemStack(Blocks.DIRT), riceBlock.getDefaultState());
Item canolaSeeds = Item.REGISTRY.getObject(new ResourceLocation("actuallyadditions:itemCanolaSeed"));
Item misc = Item.REGISTRY.getObject(new ResourceLocation("actuallyadditions:itemMisc"));
Block canolaBlock = Block.REGISTRY.getObject(new ResourceLocation("actuallyadditions:blockCanola"));
if (canolaSeeds != null && misc != null && canolaBlock != null)
BelljarHandler.cropHandler.register(new ItemStack(canolaSeeds), new ItemStack[] { new ItemStack(misc, 3, 13), new ItemStack(canolaSeeds) }, new ItemStack(Blocks.DIRT), canolaBlock.getDefaultState());
Item flaxSeeds = Item.REGISTRY.getObject(new ResourceLocation("actuallyadditions:itemFlaxSeed"));
Block flaxBlock = Block.REGISTRY.getObject(new ResourceLocation("actuallyadditions:blockFlax"));
if (flaxSeeds != null && flaxBlock != null)
BelljarHandler.cropHandler.register(new ItemStack(flaxSeeds), new ItemStack[] { new ItemStack(Items.STRING, 4), new ItemStack(flaxSeeds) }, new ItemStack(Blocks.DIRT), flaxBlock.getDefaultState());
}
use of net.minecraft.util.ResourceLocation in project ImmersiveEngineering by BluSunrize.
the class AttainedDropsHelper method addType.
static void addType(String type, ItemStack out) {
Block soilBlock = Block.REGISTRY.getObject(new ResourceLocation("attaineddrops:" + type + "_soil"));
Block bulbBlock = Block.REGISTRY.getObject(new ResourceLocation("attaineddrops:" + type + "_bulb"));
if (soilBlock != null && bulbBlock != null) {
ComparableItemStack comp = new ComparableItemStack(new ItemStack(soilBlock));
soilOutputMap.put(comp, new ItemStack[] { out });
bulbMap.put(comp, bulbBlock.getDefaultState());
}
}
use of net.minecraft.util.ResourceLocation in project ImmersiveEngineering by BluSunrize.
the class AttainedDropsHelper method init.
@Override
public void init() {
Block blockPlant = Block.REGISTRY.getObject(new ResourceLocation("attaineddrops:plant"));
final Item itemSeed = Item.REGISTRY.getObject(new ResourceLocation("attaineddrops:itemseed"));
if (blockPlant == null || itemSeed == null)
return;
final IBlockState blockstatePlant = blockPlant.getDefaultState();
IProperty propertyAge = null;
for (IProperty prop : blockstatePlant.getPropertyNames()) if ("age".equals(prop.getName()) && prop instanceof PropertyInteger)
propertyAge = prop;
final IProperty propertyAge_final = propertyAge;
addType("slimeball", new ItemStack(Items.SLIME_BALL));
addType("bone", new ItemStack(Items.BONE));
addType("string", new ItemStack(Items.STRING));
addType("rottenflesh", new ItemStack(Items.ROTTEN_FLESH));
addType("ghasttear", new ItemStack(Items.GHAST_TEAR));
addType("spidereye", new ItemStack(Items.SPIDER_EYE));
addType("prismarine", new ItemStack(Items.PRISMARINE_SHARD));
addType("blaze", new ItemStack(Items.BLAZE_ROD));
addType("gunpowder", new ItemStack(Items.GUNPOWDER));
addType("witherskull", new ItemStack(Items.SKULL, 1, 1));
addType("enderpearl", new ItemStack(Items.ENDER_PEARL));
BelljarHandler.registerHandler(new IPlantHandler() {
@Override
public boolean isCorrectSoil(ItemStack seed, ItemStack soil) {
return soil != null && soilOutputMap.containsKey(new ComparableItemStack(soil));
}
@Override
public float getGrowthStep(ItemStack seed, ItemStack soil, float growth, TileEntity tile, float fertilizer, boolean render) {
return (growth < .5 ? .003125f : .0015625f) * fertilizer;
}
@Override
public float resetGrowth(ItemStack seed, ItemStack soil, float growth, TileEntity tile, boolean render) {
return .5f;
}
@Override
public ItemStack[] getOutput(ItemStack seed, ItemStack soil, TileEntity tile) {
ItemStack[] out = soilOutputMap.get(new ComparableItemStack(soil));
if (out == null)
return new ItemStack[0];
return out;
}
@Override
public boolean isValid(ItemStack seed) {
return seed != null && seed.getItem() == itemSeed;
}
@Override
@SideOnly(Side.CLIENT)
public IBlockState[] getRenderedPlant(ItemStack seed, ItemStack soil, float growth, TileEntity tile) {
return new IBlockState[0];
}
@Override
@SideOnly(Side.CLIENT)
public float getRenderSize(ItemStack seed, ItemStack soil, float growth, TileEntity tile) {
return .875f;
}
@Override
@SideOnly(Side.CLIENT)
public boolean overrideRender(ItemStack seed, ItemStack soil, float growth, TileEntity tile, BlockRendererDispatcher blockRenderer) {
IBlockState state = blockstatePlant.withProperty(propertyAge_final, growth >= .5 ? 7 : Math.min(7, Math.round(7 * growth * 2)));
IBakedModel model = blockRenderer.getModelForState(state);
GlStateManager.pushMatrix();
blockRenderer.getBlockModelRenderer().renderModelBrightness(model, state, 1, true);
GlStateManager.popMatrix();
if (growth >= .5) {
state = bulbMap.get(new ComparableItemStack(soil));
model = blockRenderer.getModelForState(state);
GlStateManager.pushMatrix();
float scale = (growth - .5f) * 2f;
GlStateManager.translate(.5 - scale / 2, 1, -.5 + scale / 2);
GlStateManager.scale(scale, scale, scale);
blockRenderer.getBlockModelRenderer().renderModelBrightness(model, state, 1, true);
GlStateManager.popMatrix();
}
return true;
}
});
}
use of net.minecraft.util.ResourceLocation in project ImmersiveEngineering by BluSunrize.
the class BetterWithModsHelper method init.
@Override
public void init() {
Item hempSeeds = Item.REGISTRY.getObject(new ResourceLocation("betterwithmods:hemp"));
Item material = Item.REGISTRY.getObject(new ResourceLocation("betterwithmods:material"));
Block hempBlock = Block.REGISTRY.getObject(new ResourceLocation("betterwithmods:hemp"));
if (hempSeeds != null && material != null && hempBlock != null)
BelljarHandler.cropHandler.register(new ItemStack(hempSeeds), new ItemStack[] { new ItemStack(material, 1, 2), new ItemStack(hempSeeds, 1) }, new ItemStack(Blocks.DIRT), hempBlock.getDefaultState());
}
use of net.minecraft.util.ResourceLocation in project ImmersiveEngineering by BluSunrize.
the class MysticalAgricultureHelper method addType.
static void addType(String type) {
Item itemSeeds = Item.REGISTRY.getObject(new ResourceLocation("mysticalagriculture:" + type + "_seeds"));
Item itemEssence = Item.REGISTRY.getObject(new ResourceLocation("mysticalagriculture:" + type + "_essence"));
Block blockCrop = Block.REGISTRY.getObject(new ResourceLocation("mysticalagriculture:" + type + "_crop"));
if (itemSeeds != null && itemEssence != null && blockCrop != null)
BelljarHandler.cropHandler.register(new ItemStack(itemSeeds), new ItemStack[] { new ItemStack(itemEssence), new ItemStack(itemSeeds) }, new ItemStack(Blocks.DIRT), blockCrop.getDefaultState());
}
Aggregations