mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-22 13:09:42 +00:00
Getting started with Baubles integration...
This commit is contained in:
1 parent
ef6d40a5b3
commit
42601c4e85
6 files changed
+151
-2
No files matched your search
@@ -45,6 +45,7 @@ public final class BotaniaCreativeTab extends CreativeTabs {
|
||||
this.list = list;
|
||||
|
||||
addItem(ModItems.lexicon);
|
||||
addItem(ModItems.test);
|
||||
|
||||
addBlock(ModBlocks.flower);
|
||||
addBlock(ModBlocks.specialFlower);
|
||||
|
||||
@@ -23,6 +23,7 @@ import vazkii.botania.common.item.equipment.armor.ItemTerrasteelBoots;
|
||||
import vazkii.botania.common.item.equipment.armor.ItemTerrasteelChest;
|
||||
import vazkii.botania.common.item.equipment.armor.ItemTerrasteelHelm;
|
||||
import vazkii.botania.common.item.equipment.armor.ItemTerrasteelLegs;
|
||||
import vazkii.botania.common.item.equipment.bauble.ItemSimpleRing;
|
||||
import vazkii.botania.common.item.equipment.tool.ItemManasteelAxe;
|
||||
import vazkii.botania.common.item.equipment.tool.ItemManasteelPick;
|
||||
import vazkii.botania.common.item.equipment.tool.ItemManasteelShears;
|
||||
@@ -66,6 +67,7 @@ public final class ModItems {
|
||||
public static Item terrasteelLegs;
|
||||
public static Item terrasteelBoots;
|
||||
public static Item terraSword;
|
||||
public static Item test;
|
||||
|
||||
public static void init() {
|
||||
lexicon = new ItemLexicon();
|
||||
@@ -101,7 +103,8 @@ public final class ModItems {
|
||||
terrasteelLegs = new ItemTerrasteelLegs();
|
||||
terrasteelBoots = new ItemTerrasteelBoots();
|
||||
terraSword = new ItemTerraSword();
|
||||
|
||||
test = new ItemSimpleRing();
|
||||
|
||||
OreDictionary.registerOre(LibOreDict.LEXICON, lexicon);
|
||||
for(int i = 0; i < 16; i++) {
|
||||
OreDictionary.registerOre(LibOreDict.PETAL[i], new ItemStack(petal, 1, i));
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
/**
|
||||
* 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 a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Apr 20, 2014, 3:30:06 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.common.item.equipment.bauble;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import vazkii.botania.common.item.ItemMod;
|
||||
import baubles.api.BaubleType;
|
||||
import baubles.api.IBauble;
|
||||
import baubles.common.container.InventoryBaubles;
|
||||
import baubles.common.lib.PlayerHandler;
|
||||
|
||||
public abstract class ItemBauble extends ItemMod implements IBauble {
|
||||
|
||||
public ItemBauble(String name) {
|
||||
super();
|
||||
setMaxStackSize(1);
|
||||
setUnlocalizedName(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
if(!par2World.isRemote) {
|
||||
InventoryBaubles baubles = PlayerHandler.getPlayerBaubles(par3EntityPlayer);
|
||||
for(int i = 0; i < baubles.getSizeInventory(); i++)
|
||||
if(baubles.getStackInSlot(i) == null && baubles.isItemValidForSlot(i, par1ItemStack)) {
|
||||
baubles.setInventorySlotContents(i, par1ItemStack.copy());
|
||||
if(!par3EntityPlayer.capabilities.isCreativeMode)
|
||||
par3EntityPlayer.inventory.setInventorySlotContents(par3EntityPlayer.inventory.currentItem, null);
|
||||
|
||||
onEquipped(par1ItemStack, par3EntityPlayer);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
|
||||
BaubleType type = getBaubleType(par1ItemStack);
|
||||
if(GuiScreen.isShiftKeyDown()) {
|
||||
addStringToTooltip(StatCollector.translateToLocal("botania.baubletype." + type.name().toLowerCase()), par3List);
|
||||
|
||||
KeyBinding key = null;
|
||||
KeyBinding[] keys = Minecraft.getMinecraft().gameSettings.keyBindings;
|
||||
for(KeyBinding otherKey : keys)
|
||||
if(otherKey.getKeyDescription().equals("Baubles Inventory")) {
|
||||
key = otherKey;
|
||||
break;
|
||||
}
|
||||
|
||||
if(key != null)
|
||||
addStringToTooltip(StatCollector.translateToLocal("botania.baubletooltip").replaceAll("%key%", Keyboard.getKeyName(key.getKeyCode())), par3List);
|
||||
} else addStringToTooltip(StatCollector.translateToLocal("botania.baubleinfo"), par3List);
|
||||
}
|
||||
|
||||
private void addStringToTooltip(String s, List<String> tooltip) {
|
||||
tooltip.add(s.replaceAll("&", "\u00a7"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEquip(ItemStack stack, EntityLivingBase player) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUnequip(ItemStack stack, EntityLivingBase player) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEquipped(ItemStack stack, EntityLivingBase player) {
|
||||
if(!player.worldObj.isRemote) player.worldObj.playSoundAtEntity(player, "random.orb", 0.1F, 1.3F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUnequipped(ItemStack stack, EntityLivingBase player) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWornTick(ItemStack stack, EntityLivingBase player) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* 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 a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Apr 20, 2014, 3:48:19 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.common.item.equipment.bauble;
|
||||
|
||||
import baubles.api.BaubleType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
|
||||
public class ItemSimpleRing extends ItemBauble {
|
||||
|
||||
public ItemSimpleRing() {
|
||||
super(LibItemNames.TEST);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaubleType getBaubleType(ItemStack itemstack) {
|
||||
return BaubleType.RING;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -48,7 +48,8 @@ public final class LibItemNames {
|
||||
public static final String TERRASTEEL_LEGS = LibResources.PREFIX_MOD + "terrasteelLegs";
|
||||
public static final String TERRASTEEL_BOOTS = LibResources.PREFIX_MOD + "terrasteelBoots";
|
||||
public static final String TERRA_SWORD = LibResources.PREFIX_MOD + "terraSword";
|
||||
|
||||
public static final String TEST = LibResources.PREFIX_MOD + "test";
|
||||
|
||||
public static final String[] LENS_NAMES = new String[] {
|
||||
LibResources.PREFIX_MOD + "lensNormal",
|
||||
LibResources.PREFIX_MOD + "lensSpeed",
|
||||
|
||||
@@ -41,6 +41,13 @@ botania.color14=Red
|
||||
botania.color15=Black
|
||||
botania.color16=Rainbow
|
||||
|
||||
# BAUBLE TOOLTIPS
|
||||
botania.baubletype.amulet=Equippable in the &aAmulet&7 slot
|
||||
botania.baubletype.ring=Equippable in the &aRing&7 slot
|
||||
botania.baubletype.belt=Equippable in the &aBelt&7 slot
|
||||
botania.baubletooltip=Press &b%key%&7 to open the Baubles menu
|
||||
botania.baubleinfo=Hold &bSHIFT&7 for more info
|
||||
|
||||
# BLOCK NAMES
|
||||
tile.botania:flower0.name=Mystical White Flower
|
||||
tile.botania:flower1.name=Mystical Orange Flower
|
||||
|
||||
Reference in new issue
Block a user