mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-22 11:53:29 +01:00
aura trove my dudes
This commit is contained in:
parent
a04fd29b9e
commit
8b02621c5d
9 changed files with 108 additions and 38 deletions
|
@ -20,44 +20,17 @@ import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class BaublesCompat {
|
public class BaublesCompat {
|
||||||
|
|
||||||
private final IBauble eye = stack -> BaubleType.CHARM;
|
|
||||||
private final IBauble cache = new IBauble() {
|
|
||||||
@Override
|
|
||||||
public BaubleType getBaubleType(ItemStack itemstack) {
|
|
||||||
return BaubleType.BELT;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onWornTick(ItemStack stack, EntityLivingBase player) {
|
|
||||||
stack.getItem().onUpdate(stack, player.world, player, -1, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean willAutoSync(ItemStack stack, EntityLivingBase player) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
private final IBauble shockwaveCreator = new IBauble() {
|
|
||||||
@Override
|
|
||||||
public BaubleType getBaubleType(ItemStack itemstack) {
|
|
||||||
return BaubleType.AMULET;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onWornTick(ItemStack stack, EntityLivingBase player) {
|
|
||||||
stack.getItem().onUpdate(stack, player.world, player, -1, false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onCapabilitiesAttach(AttachCapabilitiesEvent<ItemStack> event) {
|
public void onCapabilitiesAttach(AttachCapabilitiesEvent<ItemStack> event) {
|
||||||
Item item = event.getObject().getItem();
|
Item item = event.getObject().getItem();
|
||||||
if (item == ModItems.EYE || item == ModItems.EYE_IMPROVED)
|
if (item == ModItems.EYE || item == ModItems.EYE_IMPROVED)
|
||||||
this.addCap(event, this.eye);
|
this.addCap(event, stack -> BaubleType.CHARM);
|
||||||
else if (item == ModItems.AURA_CACHE)
|
else if (item == ModItems.AURA_CACHE)
|
||||||
this.addCap(event, this.cache);
|
this.addCap(event, new UpdatingBauble(BaubleType.BELT, true));
|
||||||
|
else if (item == ModItems.AURA_TROVE)
|
||||||
|
this.addCap(event, new UpdatingBauble(BaubleType.BELT, true));
|
||||||
else if (item == ModItems.SHOCKWAVE_CREATOR)
|
else if (item == ModItems.SHOCKWAVE_CREATOR)
|
||||||
this.addCap(event, this.shockwaveCreator);
|
this.addCap(event, new UpdatingBauble(BaubleType.AMULET, false));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,4 +48,30 @@ public class BaublesCompat {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static class UpdatingBauble implements IBauble {
|
||||||
|
|
||||||
|
private final BaubleType type;
|
||||||
|
private final boolean sync;
|
||||||
|
|
||||||
|
public UpdatingBauble(BaubleType type, boolean sync) {
|
||||||
|
this.type = type;
|
||||||
|
this.sync = sync;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaubleType getBaubleType(ItemStack itemstack) {
|
||||||
|
return this.type;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean willAutoSync(ItemStack itemstack, EntityLivingBase player) {
|
||||||
|
return this.sync;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onWornTick(ItemStack stack, EntityLivingBase player) {
|
||||||
|
stack.getItem().onUpdate(stack, player.world, player, -1, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ import de.ellpeck.naturesaura.blocks.tiles.TileEntityNatureAltar;
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.TileEntityRFConverter;
|
import de.ellpeck.naturesaura.blocks.tiles.TileEntityRFConverter;
|
||||||
import de.ellpeck.naturesaura.compat.Compat;
|
import de.ellpeck.naturesaura.compat.Compat;
|
||||||
import de.ellpeck.naturesaura.compat.patchouli.PatchouliCompat;
|
import de.ellpeck.naturesaura.compat.patchouli.PatchouliCompat;
|
||||||
|
import de.ellpeck.naturesaura.items.ItemAuraCache;
|
||||||
import de.ellpeck.naturesaura.items.ItemRangeVisualizer;
|
import de.ellpeck.naturesaura.items.ItemRangeVisualizer;
|
||||||
import de.ellpeck.naturesaura.items.ModItems;
|
import de.ellpeck.naturesaura.items.ModItems;
|
||||||
import de.ellpeck.naturesaura.particles.ParticleHandler;
|
import de.ellpeck.naturesaura.particles.ParticleHandler;
|
||||||
|
@ -165,7 +166,7 @@ public class ClientEvents {
|
||||||
for (int i = 0; i < baubles.getSlots(); i++) {
|
for (int i = 0; i < baubles.getSlots(); i++) {
|
||||||
ItemStack slot = baubles.getStackInSlot(i);
|
ItemStack slot = baubles.getStackInSlot(i);
|
||||||
if (!slot.isEmpty()) {
|
if (!slot.isEmpty()) {
|
||||||
if (slot.getItem() == ModItems.AURA_CACHE)
|
if (slot.getItem() instanceof ItemAuraCache)
|
||||||
heldCache = slot;
|
heldCache = slot;
|
||||||
else if (slot.getItem() == ModItems.EYE)
|
else if (slot.getItem() == ModItems.EYE)
|
||||||
heldEye = slot;
|
heldEye = slot;
|
||||||
|
@ -178,7 +179,7 @@ public class ClientEvents {
|
||||||
for (int i = 0; i < mc.player.inventory.getSizeInventory(); i++) {
|
for (int i = 0; i < mc.player.inventory.getSizeInventory(); i++) {
|
||||||
ItemStack slot = mc.player.inventory.getStackInSlot(i);
|
ItemStack slot = mc.player.inventory.getStackInSlot(i);
|
||||||
if (!slot.isEmpty()) {
|
if (!slot.isEmpty()) {
|
||||||
if (slot.getItem() == ModItems.AURA_CACHE)
|
if (slot.getItem() instanceof ItemAuraCache)
|
||||||
heldCache = slot;
|
heldCache = slot;
|
||||||
else if (slot.getItem() == ModItems.EYE && i <= 8)
|
else if (slot.getItem() == ModItems.EYE && i <= 8)
|
||||||
heldEye = slot;
|
heldEye = slot;
|
||||||
|
|
|
@ -26,8 +26,11 @@ import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class ItemAuraCache extends ItemImpl implements ITrinketItem {
|
public class ItemAuraCache extends ItemImpl implements ITrinketItem {
|
||||||
|
|
||||||
public ItemAuraCache() {
|
private final int capacity;
|
||||||
super("aura_cache");
|
|
||||||
|
public ItemAuraCache(String name, int capacity) {
|
||||||
|
super(name);
|
||||||
|
this.capacity = capacity;
|
||||||
this.setMaxStackSize(1);
|
this.setMaxStackSize(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,7 +85,7 @@ public class ItemAuraCache extends ItemImpl implements ITrinketItem {
|
||||||
@Override
|
@Override
|
||||||
public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable NBTTagCompound nbt) {
|
public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable NBTTagCompound nbt) {
|
||||||
return new ICapabilityProvider() {
|
return new ICapabilityProvider() {
|
||||||
private final ItemAuraContainer container = new ItemAuraContainer(stack, null, 400000);
|
private final ItemAuraContainer container = new ItemAuraContainer(stack, null, ItemAuraCache.this.capacity);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing facing) {
|
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing facing) {
|
||||||
|
|
|
@ -33,7 +33,8 @@ public final class ModItems {
|
||||||
public static final Item INFUSED_IRON = new ItemImpl("infused_iron");
|
public static final Item INFUSED_IRON = new ItemImpl("infused_iron");
|
||||||
public static final Item ANCIENT_STICK = new ItemImpl("ancient_stick");
|
public static final Item ANCIENT_STICK = new ItemImpl("ancient_stick");
|
||||||
public static final Item COLOR_CHANGER = new ItemColorChanger();
|
public static final Item COLOR_CHANGER = new ItemColorChanger();
|
||||||
public static final Item AURA_CACHE = new ItemAuraCache();
|
public static final Item AURA_CACHE = new ItemAuraCache("aura_cache", 400000);
|
||||||
|
public static final Item AURA_TROVE = new ItemAuraCache("aura_trove", 1200000);
|
||||||
public static final Item SHOCKWAVE_CREATOR = new ItemShockwaveCreator();
|
public static final Item SHOCKWAVE_CREATOR = new ItemShockwaveCreator();
|
||||||
public static final Item MULTIBLOCK_MAKER = new ItemMultiblockMaker();
|
public static final Item MULTIBLOCK_MAKER = new ItemMultiblockMaker();
|
||||||
public static final Item BOTTLE_TWO = new ItemImpl("bottle_two_the_rebottling");
|
public static final Item BOTTLE_TWO = new ItemImpl("bottle_two_the_rebottling");
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
"forge_marker": 1,
|
||||||
|
"defaults": {
|
||||||
|
"model": "minecraft:cube",
|
||||||
|
"textures": {
|
||||||
|
"particle": "naturesaura:blocks/projectile_generator",
|
||||||
|
"up": "naturesaura:blocks/projectile_generator_top",
|
||||||
|
"down": "#particle",
|
||||||
|
"north": "#particle",
|
||||||
|
"east": "#particle",
|
||||||
|
"south": "#particle",
|
||||||
|
"west": "#particle"
|
||||||
|
},
|
||||||
|
"transform": "forge:default-block"
|
||||||
|
},
|
||||||
|
"variants": {
|
||||||
|
"normal": [{}],
|
||||||
|
"inventory": [{}]
|
||||||
|
}
|
||||||
|
}
|
|
@ -95,6 +95,7 @@ item.naturesaura.token_sorrow.name=Token of Sorrow
|
||||||
item.naturesaura.token_terror.name=Token of Terror
|
item.naturesaura.token_terror.name=Token of Terror
|
||||||
item.naturesaura.ender_access.name=Ender Ocular
|
item.naturesaura.ender_access.name=Ender Ocular
|
||||||
item.naturesaura.cave_finder.name=Staff of Shadows
|
item.naturesaura.cave_finder.name=Staff of Shadows
|
||||||
|
item.naturesaura.aura_trove.name=Aura Trove
|
||||||
|
|
||||||
container.naturesaura.tree_ritual.name=Ritual of the Forest
|
container.naturesaura.tree_ritual.name=Ritual of the Forest
|
||||||
container.naturesaura.altar.name=Natural Altar Infusion
|
container.naturesaura.altar.name=Natural Altar Infusion
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "naturesaura:items/aura_trove"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"name": "Aura Trove",
|
||||||
|
"icon": "naturesaura:aura_trove",
|
||||||
|
"category": "items",
|
||||||
|
"advancement": "naturesaura:sky_ingot",
|
||||||
|
"pages": [
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"text": "Once the amount of $(aura) required becomes too much for the $(l:items/aura_cache)Aura Cache$() to store without having to refill it on too regular of a basis, one can employ the help of an $(item)Aura Trove$() - a higher tier version of the $(item)Aura Cache$() that has three times its storage capacity."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "crafting",
|
||||||
|
"text": "Creating the $(item)Aura Trove$()",
|
||||||
|
"recipe": "naturesaura:aura_trove"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
{
|
||||||
|
"type": "forge:ore_shaped",
|
||||||
|
"pattern": [
|
||||||
|
"SIS",
|
||||||
|
"IBI",
|
||||||
|
"SIS"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"S": {
|
||||||
|
"item": "naturesaura:infused_stone"
|
||||||
|
},
|
||||||
|
"I": {
|
||||||
|
"item": "naturesaura:sky_ingot"
|
||||||
|
},
|
||||||
|
"B": {
|
||||||
|
"item": "naturesaura:aura_cache"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"item": "naturesaura:aura_trove"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue