mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-24 05:54:49 +00:00
IWandable and ILexiconable implementation for BlockSpecialFlower.
This commit is contained in:
1 parent
9316e2d52a
commit
a0b7718d62
6 files changed
+58
-5
No files matched your search
@@ -20,6 +20,6 @@ import net.minecraft.world.World;
|
||||
*/
|
||||
public interface IWandable {
|
||||
|
||||
public void onUsedByWand(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int side);
|
||||
public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int side);
|
||||
|
||||
}
|
||||
@@ -11,10 +11,13 @@
|
||||
*/
|
||||
package vazkii.botania.api.subtile;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Icon;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.LexiconEntry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -25,7 +28,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
*/
|
||||
public class SubTileEntity {
|
||||
|
||||
TileEntity supertile;
|
||||
protected TileEntity supertile;
|
||||
|
||||
public void setSupertile(TileEntity tile) {
|
||||
supertile = tile;
|
||||
@@ -61,4 +64,17 @@ public class SubTileEntity {
|
||||
return icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a Wand of the Forest is used on this sub tile.
|
||||
*/
|
||||
public boolean onWanded(EntityPlayer player, ItemStack wand) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets which Lexicon Entry to open when this sub tile is right clicked with a lexicon.
|
||||
*/
|
||||
public LexiconEntry getEntry() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -21,12 +21,16 @@ import net.minecraft.block.BlockFlower;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.ILexiconable;
|
||||
import vazkii.botania.api.ISpecialFlower;
|
||||
import vazkii.botania.api.IWandable;
|
||||
import vazkii.botania.api.LexiconEntry;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
import vazkii.botania.client.lib.LibRenderIDs;
|
||||
import vazkii.botania.common.block.tile.TileSpecialFlower;
|
||||
@@ -36,7 +40,7 @@ import vazkii.botania.common.lib.LibBlockIDs;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class BlockSpecialFlower extends BlockFlower implements ISpecialFlower, ITileEntityProvider {
|
||||
public class BlockSpecialFlower extends BlockFlower implements ISpecialFlower, ITileEntityProvider, IWandable, ILexiconable {
|
||||
|
||||
public static Map<String, Icon> icons = new HashMap();
|
||||
private static String[] subtypes = {
|
||||
@@ -122,4 +126,14 @@ public class BlockSpecialFlower extends BlockFlower implements ISpecialFlower, I
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) {
|
||||
return ((TileSpecialFlower) world.getBlockTileEntity(x, y, z)).getEntry();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int side) {
|
||||
return ((TileSpecialFlower) world.getBlockTileEntity(x, y, z)).onWanded(stack, player);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,9 +11,12 @@
|
||||
*/
|
||||
package vazkii.botania.common.block.tile;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.Icon;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.LexiconEntry;
|
||||
import vazkii.botania.api.subtile.SubTileEntity;
|
||||
|
||||
public class TileSpecialFlower extends TileMod {
|
||||
@@ -83,4 +86,12 @@ public class TileSpecialFlower extends TileMod {
|
||||
return subTile.getIcon();
|
||||
}
|
||||
|
||||
public LexiconEntry getEntry() {
|
||||
return subTile.getEntry();
|
||||
}
|
||||
|
||||
public boolean onWanded(ItemStack wand, EntityPlayer player) {
|
||||
return subTile.onWanded(player, wand);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,12 +14,16 @@ package vazkii.botania.common.item;
|
||||
import java.awt.Color;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.passive.EntitySheep;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.IWandable;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
import vazkii.botania.common.core.helper.ItemNBTHelper;
|
||||
import vazkii.botania.common.lib.LibItemIDs;
|
||||
@@ -37,6 +41,14 @@ public class ItemTwigWand extends Item16Colors {
|
||||
setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) {
|
||||
int id = par3World.getBlockId(par4, par5, par6);
|
||||
if(Block.blocksList[id] instanceof IWandable)
|
||||
return ((IWandable) Block.blocksList[id]).onUsedByWand(par2EntityPlayer, par1ItemStack, par3World, par4, par5, par6, par7);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IconRegister par1IconRegister) {
|
||||
icons = new Icon[3];
|
||||
|
||||
@@ -25,7 +25,7 @@ tile.botania:flower13.name=Mystical Green Flower
|
||||
tile.botania:flower14.name=Mystical Red Flower
|
||||
tile.botania:flower15.name=Mystical Black Flower
|
||||
tile.botania:altar.name=Petal Apothecary
|
||||
tile.botania.flower..name=Botania Flower
|
||||
tile.botania:flower..name=Botania Flower
|
||||
tile.botania:flower.daybloom.name=Daybloom
|
||||
|
||||
# ITEM NAMES
|
||||
|
||||
Reference in new issue
Block a user