mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-17 02:45:13 +00:00
Craftable bifrost blocks.
This commit is contained in:
1 parent
daf8a90118
commit
a1e8a78b57
10 files changed
+157
-6
No files matched your search
@@ -12,25 +12,39 @@ package vazkii.botania.common.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.client.render.block.InterpolatedIcon;
|
||||
import vazkii.botania.common.block.tile.TileBifrost;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.lexicon.LexiconData;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
|
||||
public class BlockBifrost extends BlockModContainer {
|
||||
public class BlockBifrost extends BlockModContainer implements ILexiconable {
|
||||
|
||||
public BlockBifrost() {
|
||||
super(Material.glass);
|
||||
setBlockName(LibBlockNames.BIFROST);
|
||||
setLightOpacity(0);
|
||||
setLightLevel(1F);
|
||||
setBlockUnbreakable();
|
||||
setStepSound(soundTypeGlass);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -47,7 +61,7 @@ public class BlockBifrost extends BlockModContainer {
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
|
||||
return new ItemStack(ModItems.rainbowRod);
|
||||
}
|
||||
|
||||
|
||||
public boolean shouldSideBeRendered1(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) {
|
||||
Block block = p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_);
|
||||
|
||||
@@ -68,10 +82,30 @@ public class BlockBifrost extends BlockModContainer {
|
||||
public int quantityDropped(int meta, int fortune, Random random) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void loadTextures(TextureStitchEvent.Pre event) {
|
||||
if(event.map.getTextureType() == 0) {
|
||||
TextureAtlasSprite icon = new InterpolatedIcon("botania:bifrost");
|
||||
if(event.map.setTextureEntry("botania:bifrost", icon))
|
||||
blockIcon = icon;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileBifrost();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) {
|
||||
return LexiconData.rainbowRod;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
* File Created @ [Aug 28, 2015, 10:46:20 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.common.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.tile.TileBifrost;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.lexicon.LexiconData;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
|
||||
public class BlockBifrostPerm extends BlockMod implements ILexiconable {
|
||||
|
||||
public BlockBifrostPerm() {
|
||||
super(Material.glass);
|
||||
setBlockName(LibBlockNames.BIFROST_PERM);
|
||||
setLightOpacity(0);
|
||||
setHardness(0.3F);
|
||||
setLightLevel(1F);
|
||||
setStepSound(soundTypeGlass);
|
||||
setTickRandomly(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return ModBlocks.bifrost.getIcon(side, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean shouldSideBeRendered1(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) {
|
||||
Block block = p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_);
|
||||
|
||||
return block == this ? false : super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) {
|
||||
return shouldSideBeRendered1(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, 1 - p_149646_5_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
if(rand.nextBoolean())
|
||||
Botania.proxy.sparkleFX(world, x + Math.random(), y + Math.random(), z + Math.random(), (float) Math.random(), (float) Math.random(), (float) Math.random(), 0.45F + 0.2F * (float) Math.random(), 6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderBlockPass() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) {
|
||||
return LexiconData.rainbowRod;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -244,6 +244,7 @@ public final class ModBlocks {
|
||||
public static Block manaBomb;
|
||||
public static Block cacophonium;
|
||||
public static Block bellows;
|
||||
public static Block bifrostPerm;
|
||||
|
||||
public static void init() {
|
||||
flower = new BlockModFlower();
|
||||
@@ -326,6 +327,7 @@ public final class ModBlocks {
|
||||
manaBomb = new BlockManaBomb();
|
||||
cacophonium = new BlockCacophonium();
|
||||
bellows = new BlockBellows();
|
||||
bifrostPerm = new BlockBifrostPerm();
|
||||
|
||||
ModFluffBlocks.init();
|
||||
|
||||
|
||||
@@ -83,6 +83,7 @@ public final class BotaniaCreativeTab extends CreativeTabs {
|
||||
addItem(ModItems.waterRod);
|
||||
addItem(ModItems.openBucket);
|
||||
addItem(ModItems.rainbowRod);
|
||||
addBlock(ModBlocks.bifrostPerm);
|
||||
addItem(ModItems.tornadoRod);
|
||||
addItem(ModItems.fireRod);
|
||||
addItem(ModItems.smeltRod);
|
||||
|
||||
@@ -287,7 +287,8 @@ public final class ModCraftingRecipes {
|
||||
public static IRecipe recipeManaweaveChest;
|
||||
public static IRecipe recipeManaweaveLegs;
|
||||
public static IRecipe recipeManaweaveBoots;
|
||||
|
||||
public static IRecipe recipeBifrost;
|
||||
|
||||
// Garden of Glass
|
||||
public static IRecipe recipeRootToSapling;
|
||||
public static IRecipe recipeRootToFertilizer;
|
||||
@@ -1963,6 +1964,10 @@ public final class ModCraftingRecipes {
|
||||
'S', LibOreDict.MANAWEAVE_CLOTH);
|
||||
recipeManaweaveBoots = BotaniaAPI.getLatestAddedRecipe();
|
||||
|
||||
// Bifrost Block Recipe
|
||||
addShapelessOreDictRecipe(new ItemStack(ModBlocks.bifrostPerm), new ItemStack(ModItems.rainbowRod), new ItemStack(ModBlocks.elfGlass));
|
||||
recipeBifrost = BotaniaAPI.getLatestAddedRecipe();
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Storage Block/Nugget Recipes
|
||||
|
||||
@@ -90,6 +90,21 @@ public class ItemRainbowRod extends ItemMod implements IManaUsingItem {
|
||||
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getContainerItem(ItemStack itemStack) {
|
||||
return itemStack.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasContainerItem(ItemStack stack) {
|
||||
return getContainerItem(stack) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesContainerItemLeaveCraftingGrid(ItemStack par1ItemStack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) {
|
||||
|
||||
@@ -687,7 +687,7 @@ public final class LexiconData {
|
||||
openBucket.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCraftingRecipes.recipeOpenBucket));
|
||||
|
||||
rainbowRod = new ALexiconEntry(LibLexicon.TOOL_RAINBOW_ROD, categoryTools);
|
||||
rainbowRod.setLexiconPages(new PageText("0"), new PageText("1"), new PageCraftingRecipe("2", ModCraftingRecipes.recipeRainbowRod));
|
||||
rainbowRod.setLexiconPages(new PageText("0"), new PageText("1"), new PageCraftingRecipe("2", ModCraftingRecipes.recipeRainbowRod), new PageCraftingRecipe("3", ModCraftingRecipes.recipeBifrost));
|
||||
|
||||
tornadoRod = new BLexiconEntry(LibLexicon.TOOL_TORNADO_ROD, categoryTools);
|
||||
tornadoRod.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCraftingRecipes.recipeTornadoRod));
|
||||
|
||||
@@ -95,6 +95,7 @@ public final class LibBlockNames {
|
||||
public static final String MANA_BOMB = "manaBomb";
|
||||
public static final String CACOPHONIUM = "cacophoniumBlock";
|
||||
public static final String BELLOWS = "bellows";
|
||||
public static final String BIFROST_PERM = "bifrostPerm";
|
||||
|
||||
public static final String SUBTILE_PUREDAISY = "puredaisy";
|
||||
public static final String SUBTILE_MANASTAR = "manastar";
|
||||
|
||||
@@ -1024,6 +1024,8 @@ tile.botania:buriedPetals14.name=Buried Red Petal
|
||||
tile.botania:buriedPetals15.name=Buried Black Petal
|
||||
tile.botania:cacophoniumBlock.name=Cacophonium Block
|
||||
tile.botania:bellows.name=Manatide Bellows
|
||||
tile.botania:bifrost.name=Temporary Bifrost Block
|
||||
tile.botania:bifrostPerm.name=Bifrost Block
|
||||
|
||||
# FLOWER NAMES
|
||||
tile.botania:flower..name=Botania Flower
|
||||
@@ -2614,11 +2616,12 @@ botania.entry.openBucket=Extrapolated Bucket
|
||||
botania.page.openBucket0=By creating a bucket out of &1Elementium&0 one seems to notice an interesting feature. The liquids acquired by it simply vanish into the ether, never to be seen again. This seems like a great clean up tool.
|
||||
botania.page.openBucket1=A Souvenir from Lewis
|
||||
|
||||
# -- ROD OF BIFROST
|
||||
# -- ROD OF THE BIFROST
|
||||
botania.entry.rainbowRod=Rod of the Bifrost
|
||||
botania.page.rainbowRod0=&4Bifrost&0, the rainbow bridge that reaches between the world and the realm of the gods.<br>While this item, the &1Rod of the Bifrost&0 doesn't exactly do that, it allows the holder, via a right click and at the cost of some &4Mana&0, to create a rainbow bridge in the direction he or she is looking at.
|
||||
botania.page.rainbowRod1=This bridge extends as far as a hundred blocks, and will vanish after about fifteen seconds.<br>Only one bridge can be created for any given &1Rod of the Bifrost&0 at a time, as soon as the old bridge vanishes, a new one can be created.
|
||||
botania.page.rainbowRod2=Going my way!! Cut open a path and go!
|
||||
botania.page.rainbowRod3=&1Bifrost Blocks&0 for decoration
|
||||
|
||||
# -- ROD OF THE SKIES
|
||||
botania.entry.tornadoRod=Rod of the Skies
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
{
|
||||
"animation": { }
|
||||
"animation": {
|
||||
"frametime": 10,
|
||||
"interpolate": true
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user