mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-22 11:53:29 +01:00
added bottled aura
This commit is contained in:
parent
55c158111a
commit
b20c1be95f
12 changed files with 162 additions and 8 deletions
|
@ -0,0 +1,88 @@
|
|||
package de.ellpeck.naturesaura.items;
|
||||
|
||||
import de.ellpeck.naturesaura.NaturesAura;
|
||||
import de.ellpeck.naturesaura.aura.AuraType;
|
||||
import de.ellpeck.naturesaura.aura.chunk.AuraChunk;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
public class ItemAuraBottle extends ItemImpl {
|
||||
|
||||
public ItemAuraBottle() {
|
||||
super("aura_bottle");
|
||||
this.addPropertyOverride(new ResourceLocation(NaturesAura.MOD_ID, "type"),
|
||||
(stack, worldIn, entityIn) -> getType(stack).ordinal());
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onRightClick(PlayerInteractEvent.RightClickItem event) {
|
||||
ItemStack held = event.getItemStack();
|
||||
if (held.isEmpty() || held.getItem() != Items.GLASS_BOTTLE)
|
||||
return;
|
||||
EntityPlayer player = event.getEntityPlayer();
|
||||
RayTraceResult ray = this.rayTrace(player.world, player, true);
|
||||
if (ray != null && ray.typeOfHit == RayTraceResult.Type.BLOCK)
|
||||
return;
|
||||
BlockPos pos = player.getPosition();
|
||||
if (AuraChunk.getAuraInArea(player.world, pos, 30) < 1000)
|
||||
return;
|
||||
|
||||
if (!player.world.isRemote) {
|
||||
held.shrink(1);
|
||||
|
||||
player.inventory.addItemStackToInventory(
|
||||
setType(new ItemStack(this), AuraType.forWorld(player.world)));
|
||||
|
||||
BlockPos spot = AuraChunk.getHighestSpot(player.world, pos, 30, pos);
|
||||
AuraChunk.getAuraChunk(player.world, spot).drainAura(spot, 500);
|
||||
|
||||
player.world.playSound(null, player.posX, player.posY, player.posZ,
|
||||
SoundEvents.ITEM_BOTTLE_FILL_DRAGONBREATH, SoundCategory.PLAYERS, 1F, 1F);
|
||||
}
|
||||
player.swingArm(event.getHand());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> items) {
|
||||
if (this.isInCreativeTab(tab)) {
|
||||
for (AuraType type : AuraType.values()) {
|
||||
ItemStack stack = new ItemStack(this);
|
||||
setType(stack, type);
|
||||
items.add(stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
return I18n.translateToLocal(this.getUnlocalizedNameInefficiently(stack) + "." + getType(stack).name().toLowerCase() + ".name").trim();
|
||||
}
|
||||
|
||||
public static AuraType getType(ItemStack stack) {
|
||||
if (!stack.hasTagCompound())
|
||||
return AuraType.OTHER;
|
||||
String type = stack.getTagCompound().getString("type");
|
||||
return AuraType.valueOf(type);
|
||||
}
|
||||
|
||||
public static ItemStack setType(ItemStack stack, AuraType type) {
|
||||
if (!stack.hasTagCompound())
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
stack.getTagCompound().setString("type", type.name());
|
||||
return stack;
|
||||
}
|
||||
}
|
|
@ -9,6 +9,14 @@ import java.util.Locale;
|
|||
|
||||
public final class ModItems {
|
||||
|
||||
public static final Item.ToolMaterial TOOL_MATERIAL_INFUSED_IRON =
|
||||
EnumHelper.addToolMaterial(NaturesAura.MOD_ID.toUpperCase(Locale.ROOT) + "_INFUSED_IRON", 3, 300, 6.25F, 2.25F, 16);
|
||||
public static final Item INFUSED_PICKAXE = new ItemPickaxeNA("infused_iron_pickaxe", TOOL_MATERIAL_INFUSED_IRON);
|
||||
public static final Item INFUSED_AXE = new ItemAxeNA("infused_iron_axe", TOOL_MATERIAL_INFUSED_IRON, 8.25F, -3.2F);
|
||||
public static final Item INFUSED_SHOVEL = new ItemShovelNA("infused_iron_shovel", TOOL_MATERIAL_INFUSED_IRON);
|
||||
public static final Item INFUSED_HOE = new ItemHoeNA("infused_iron_hoe", TOOL_MATERIAL_INFUSED_IRON);
|
||||
public static final Item INFUSED_SWORD = new ItemSwordNA("infused_iron_sword", TOOL_MATERIAL_INFUSED_IRON);
|
||||
|
||||
public static final Item EYE = new ItemEye();
|
||||
public static final Item GOLD_FIBER = new ItemGoldFiber();
|
||||
public static final Item GOLD_LEAF = new ItemImpl("gold_leaf");
|
||||
|
@ -17,13 +25,6 @@ public final class ModItems {
|
|||
public static final Item COLOR_CHANGER = new ItemColorChanger();
|
||||
public static final Item AURA_CACHE = new ItemAuraCache();
|
||||
public static final Item SHOCKWAVE_CREATOR = new ItemShockwaveCreator();
|
||||
|
||||
public static final Item.ToolMaterial TOOL_MATERIAL_INFUSED_IRON =
|
||||
EnumHelper.addToolMaterial(NaturesAura.MOD_ID.toUpperCase(Locale.ROOT) + "_INFUSED_IRON", 3, 300, 6.25F, 2.25F, 16);
|
||||
public static final Item INFUSED_PICKAXE = new ItemPickaxeNA("infused_iron_pickaxe", TOOL_MATERIAL_INFUSED_IRON);
|
||||
public static final Item INFUSED_AXE = new ItemAxeNA("infused_iron_axe", TOOL_MATERIAL_INFUSED_IRON, 8.25F, -3.2F);
|
||||
public static final Item INFUSED_SHOVEL = new ItemShovelNA("infused_iron_shovel", TOOL_MATERIAL_INFUSED_IRON);
|
||||
public static final Item INFUSED_HOE = new ItemHoeNA("infused_iron_hoe", TOOL_MATERIAL_INFUSED_IRON);
|
||||
public static final Item INFUSED_SWORD = new ItemSwordNA("infused_iron_sword", TOOL_MATERIAL_INFUSED_IRON);
|
||||
public static final Item MULTIBLOCK_MAKER = new ItemMultiblockMaker();
|
||||
public static final Item AURA_BOTTLE = new ItemAuraBottle();
|
||||
}
|
||||
|
|
|
@ -44,6 +44,10 @@ item.naturesaura.color_changer.name=Bucket of Infinite Color
|
|||
item.naturesaura.book.name=Book of Natural Aura
|
||||
item.naturesaura.shockwave_creator.name=Amulet of Wrath
|
||||
item.naturesaura.multiblock_maker.name=Multiblock Maker
|
||||
item.naturesaura.aura_bottle.overworld.name=Bottled Sunlight
|
||||
item.naturesaura.aura_bottle.nether.name=Bottled Ghosts
|
||||
item.naturesaura.aura_bottle.end.name=Bottled Darkness
|
||||
item.naturesaura.aura_bottle.other.name=Bottled Substance
|
||||
|
||||
container.naturesaura.tree_ritual.name=Ritual of the Forest
|
||||
container.naturesaura.altar.name=Natural Altar Infusion
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "naturesaura:items/aura_bottle_overworld"
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"predicate": {
|
||||
"naturesaura:type": 1
|
||||
},
|
||||
"model": "naturesaura:item/aura_bottle_nether"
|
||||
},
|
||||
{
|
||||
"predicate": {
|
||||
"naturesaura:type": 2
|
||||
},
|
||||
"model": "naturesaura:item/aura_bottle_end"
|
||||
},
|
||||
{
|
||||
"predicate": {
|
||||
"naturesaura:type": 3
|
||||
},
|
||||
"model": "naturesaura:item/aura_bottle_other"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "naturesaura:items/aura_bottle_end"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "naturesaura:items/aura_bottle_nether"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "naturesaura:items/aura_bottle_other"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"name": "Aura Bottling",
|
||||
"icon": "naturesaura:aura_bottle{type:'OVERWORLD'}",
|
||||
"category": "collecting",
|
||||
"advancement": "naturesaura:gold_leaf",
|
||||
"pages": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": "$(aura) and its presence in the world has been a conundrum to researchers for decades. As such, they needed a way to better be able to analyze it, which is why $(item)Bottles$() were invented.$(br)While this might not be the full story of their conception, they can still be used to collect $(aura) in its purest form by simply interacting with the air directly while holding one in your hand."
|
||||
},
|
||||
{
|
||||
"type": "spotlight",
|
||||
"item": "naturesaura:aura_bottle{type:'OVERWORLD'}",
|
||||
"text": "Of course, based on the world that you are currently in, the type of $(aura) collected will slightly vary. For instance, in the normal world, $(aura) can be gathered in the form of sunlight, while in the Nether realm, $(aura) can be gathered in the form of ghosts."
|
||||
}
|
||||
]
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 301 B |
Binary file not shown.
After Width: | Height: | Size: 316 B |
Binary file not shown.
After Width: | Height: | Size: 310 B |
Binary file not shown.
After Width: | Height: | Size: 294 B |
Loading…
Reference in a new issue