mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-14 01:04:16 +00:00
Added the Spectral Rail.
This commit is contained in:
1 parent
b3182b5420
commit
bbf6d7e455
11 files changed
+126
-1
No files matched your search
@@ -0,0 +1,97 @@
|
||||
/**
|
||||
* 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 @ [Jun 9, 2015, 12:48:18 AM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.common.block;
|
||||
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.recipe.IElvenItem;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
import vazkii.botania.common.core.BotaniaCreativeTab;
|
||||
import vazkii.botania.common.item.block.ItemBlockElven;
|
||||
import vazkii.botania.common.item.block.ItemBlockMod;
|
||||
import vazkii.botania.common.lexicon.LexiconData;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockRailBase;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.minecart.MinecartUpdateEvent;
|
||||
|
||||
public class BlockGhostRail extends BlockRailBase implements ILexiconable {
|
||||
|
||||
private static final String TAG_FLOAT_TICKS = "Botania_FloatTicks";
|
||||
|
||||
public BlockGhostRail() {
|
||||
super(true);
|
||||
setCreativeTab(BotaniaCreativeTab.INSTANCE);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
setBlockName(LibBlockNames.GHOST_RAIL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block setBlockName(String par1Str) {
|
||||
GameRegistry.registerBlock(this, ItemBlockMod.class, par1Str);
|
||||
return super.setBlockName(par1Str);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
blockIcon = IconHelper.forBlock(par1IconRegister, this);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onMinecartUpdate(MinecartUpdateEvent event) {
|
||||
int x = MathHelper.floor_double(event.entity.posX);
|
||||
int y = MathHelper.floor_double(event.entity.posY);
|
||||
int z = MathHelper.floor_double(event.entity.posZ);
|
||||
Block block = event.entity.worldObj.getBlock(x, y, z);
|
||||
boolean air = block.isAir(event.entity.worldObj, x, y, z);
|
||||
int floatTicks = event.entity.getEntityData().getInteger(TAG_FLOAT_TICKS);
|
||||
|
||||
if(block == this)
|
||||
event.entity.getEntityData().setInteger(TAG_FLOAT_TICKS, 20);
|
||||
else if(block instanceof BlockRailBase || block == ModBlocks.dreamwood) {
|
||||
event.entity.getEntityData().setInteger(TAG_FLOAT_TICKS, 0);
|
||||
if(floatTicks > 0)
|
||||
event.entity.worldObj.playAuxSFX(2003, x, y, z, 0);
|
||||
}
|
||||
floatTicks = event.entity.getEntityData().getInteger(TAG_FLOAT_TICKS);
|
||||
|
||||
if(floatTicks > 0) {
|
||||
Block blockBelow = event.entity.worldObj.getBlock(x, y - 1, z);
|
||||
boolean airBelow = blockBelow.isAir(event.entity.worldObj, x, y - 1, z);
|
||||
if((air && airBelow) || !air && !(airBelow))
|
||||
event.entity.noClip = true;
|
||||
event.entity.motionY = 0.2;
|
||||
event.entity.motionX *= 1.4;
|
||||
event.entity.motionZ *= 1.4;
|
||||
event.entity.getEntityData().setInteger(TAG_FLOAT_TICKS, floatTicks - 1);
|
||||
event.entity.worldObj.playAuxSFX(2000, x, y, z, 0);
|
||||
} else event.entity.noClip = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) {
|
||||
return LexiconData.ghostRail;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -228,6 +228,7 @@ public final class ModBlocks {
|
||||
public static Block corporeaCrystalCube;
|
||||
public static Block incensePlate;
|
||||
public static Block hourglass;
|
||||
public static Block ghostRail;
|
||||
|
||||
public static void init() {
|
||||
flower = new BlockModFlower();
|
||||
@@ -300,6 +301,7 @@ public final class ModBlocks {
|
||||
corporeaCrystalCube = new BlockCorporeaCrystalCube();
|
||||
incensePlate = new BlockIncensePlate();
|
||||
hourglass = new BlockHourglass();
|
||||
ghostRail = new BlockGhostRail();
|
||||
|
||||
ModFluffBlocks.init();
|
||||
|
||||
|
||||
@@ -228,6 +228,7 @@ public final class BotaniaCreativeTab extends CreativeTabs {
|
||||
addBlock(ModBlocks.distributor);
|
||||
addBlock(ModBlocks.manaVoid);
|
||||
addBlock(ModBlocks.manaDetector);
|
||||
addBlock(ModBlocks.ghostRail);
|
||||
addItem(ModItems.poolMinecart);
|
||||
addBlock(ModBlocks.pump);
|
||||
addBlock(ModBlocks.rfGenerator);
|
||||
|
||||
@@ -261,6 +261,7 @@ public final class ModCraftingRecipes {
|
||||
public static IRecipe recipeIncensePlate;
|
||||
public static IRecipe recipeTerraAxe;
|
||||
public static IRecipe recipeHourglass;
|
||||
public static IRecipe recipeGhostRail;
|
||||
|
||||
public static void init() {
|
||||
// Lexicon Recipe
|
||||
@@ -1747,6 +1748,10 @@ public final class ModCraftingRecipes {
|
||||
'S', LibOreDict.MANA_STEEL);
|
||||
recipeHourglass = BotaniaAPI.getLatestAddedRecipe();
|
||||
|
||||
// Spectral Rail Recipe
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(ModBlocks.ghostRail), new ItemStack(Blocks.rail), new ItemStack(ModBlocks.platform, 1, 1));
|
||||
recipeGhostRail = BotaniaAPI.getLatestAddedRecipe();
|
||||
|
||||
// Storage Block Recipes
|
||||
addOreDictRecipe(new ItemStack(ModBlocks.storage, 1, 0),
|
||||
"III", "III", "III",
|
||||
|
||||
@@ -10,7 +10,11 @@
|
||||
*/
|
||||
package vazkii.botania.common.item;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockRail;
|
||||
import net.minecraft.block.BlockRailBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -18,9 +22,11 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityChest;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.event.entity.minecart.MinecartUpdateEvent;
|
||||
import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
|
||||
@@ -25,7 +25,9 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.entity.minecart.MinecartUpdateEvent;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.decor.IFloatingFlower.IslandType;
|
||||
@@ -132,7 +134,7 @@ public class ItemGrassSeeds extends ItemMod {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static BlockSwapper addBlockSwapper(World world, int x, int y, int z, int meta) {
|
||||
BlockSwapper swapper = swapperFromMeta(world, x, y, z, meta);
|
||||
|
||||
|
||||
@@ -147,6 +147,7 @@ public final class LexiconData {
|
||||
public static LexiconEntry complexBrews;
|
||||
public static LexiconEntry incense;
|
||||
public static LexiconEntry hourglass;
|
||||
public static LexiconEntry ghostRail;
|
||||
|
||||
public static LexiconEntry manaBlaster;
|
||||
public static LexiconEntry grassSeeds;
|
||||
@@ -591,6 +592,9 @@ public final class LexiconData {
|
||||
hourglass = new BLexiconEntry(LibLexicon.DEVICE_HOURGLASS, categoryDevices);
|
||||
hourglass.setLexiconPages(new PageText("0"), new PageText("1"), new PageText("2"), new PageText("3"), new PageText("4"), new PageCraftingRecipe("5", ModCraftingRecipes.recipeHourglass));
|
||||
|
||||
ghostRail = new ALexiconEntry(LibLexicon.DEVICE_GHOST_RAIL, categoryDevices);
|
||||
ghostRail.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCraftingRecipes.recipeGhostRail));
|
||||
|
||||
// TOOLS ENTRIES
|
||||
manaBlaster = new BLexiconEntry(LibLexicon.TOOL_MANA_BLASTER, categoryTools);
|
||||
manaBlaster.setLexiconPages(new PageText("0"), new PageText("1"), new PageText("2"), new PageCraftingRecipe("3", ModCraftingRecipes.recipeManaBlaster));
|
||||
|
||||
@@ -85,6 +85,7 @@ public final class LibBlockNames {
|
||||
public static final String CORPOREA_CRYSTAL_CUBE = "corporeaCrystalCube";
|
||||
public static final String INCENSE_PLATE = "incensePlate";
|
||||
public static final String HOURGLASS = "hourglass";
|
||||
public static final String GHOST_RAIL = "ghostRail";
|
||||
|
||||
public static final String SUBTILE_PUREDAISY = "puredaisy";
|
||||
public static final String SUBTILE_MANASTAR = "manastar";
|
||||
|
||||
@@ -119,6 +119,7 @@ public final class LibLexicon {
|
||||
public static final String DEVICE_COMPLEX_BREWS = "complexBrews";
|
||||
public static final String DEVICE_INCENSE = "incense";
|
||||
public static final String DEVICE_HOURGLASS = "hourglass";
|
||||
public static final String DEVICE_GHOST_RAIL = "ghostRail";
|
||||
|
||||
public static final String TOOL_MANA_BLASTER = "manaBlaster";
|
||||
public static final String TOOL_GRASS_SEEDS = "grassSeeds";
|
||||
|
||||
@@ -922,6 +922,7 @@ tile.botania:corporeaInterceptor.name=Corporea Interceptor
|
||||
tile.botania:corporeaCrystalCube.name=Corporea Crystal Cube
|
||||
tile.botania:incensePlate.name=Incense Plate
|
||||
tile.botania:hourglass.name=Hovering Hourglass
|
||||
tile.botania:ghostRail.name=Spectral Rail
|
||||
|
||||
# FLOWER NAMES
|
||||
tile.botania:flower..name=Botania Flower
|
||||
@@ -2082,6 +2083,11 @@ botania.page.hourglass3=Note that the sand is added all at once, so the size of
|
||||
botania.page.hourglass4=Right clicking the block with a &1Wand of the Forest&0 locks (and unlocks) it. When locked, sand can't be added or removed, just in case someone right clicks it on accident.<br>If a &4Mana Burst&0 collides with the block, it'll stop the flow of sand and pause the timer, colliding again continues it.
|
||||
botania.page.hourglass5=The sands of time
|
||||
|
||||
# -- SPECTRAL RAIL
|
||||
botania.entry.ghostRail=Spectral Rail
|
||||
botania.page.ghostRail0=Using a &1Spectral Platform&0 as a &1Rail&0 component gives some interesting abilities to a &1Minecart&0 that passes through it: when launched off the rail, the cart will float for a bit, it'll also be able to pass through walls.<br>This effect stops if the cart lands on a rail or collides with any variant of &1Dreamwood&0.
|
||||
botania.page.ghostRail1=Spirit Tracks, you could say
|
||||
|
||||
# - MYSTICAL INSTRUMENTS
|
||||
# -- MANA BLASTER
|
||||
botania.entry.manaBlaster=Mana Blaster
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
Reference in new issue
Block a user