mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-13 00:09:09 +01:00
implement the aura bottle into the progression
This commit is contained in:
parent
b20c1be95f
commit
8e9979b192
22 changed files with 142 additions and 26 deletions
|
@ -80,15 +80,21 @@ public final class Helper {
|
|||
return ((a & 255) << 24) | ((r & 255) << 16) | ((g & 255) << 8) | (b & 255);
|
||||
}
|
||||
|
||||
public static int getItemIndex(List<ItemStack> list, ItemStack item) {
|
||||
public static int getItemIndex(List<ItemStack> list, ItemStack item, boolean nbt) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if (list.get(i).isItemEqual(item)) {
|
||||
if (areItemsEqual(list.get(i), item, nbt)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static boolean areItemsEqual(ItemStack first, ItemStack second, boolean nbt) {
|
||||
if (!ItemStack.areItemsEqual(first, second))
|
||||
return false;
|
||||
return !nbt || ItemStack.areItemStackShareTagsEqual(first, second);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void renderItemInWorld(ItemStack stack) {
|
||||
if (!stack.isEmpty()) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package de.ellpeck.naturesaura.blocks.tiles;
|
||||
|
||||
import de.ellpeck.naturesaura.Helper;
|
||||
import de.ellpeck.naturesaura.aura.chunk.AuraChunk;
|
||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticleStream;
|
||||
|
@ -69,7 +70,8 @@ public class TileEntityFurnaceHeater extends TileEntityImpl implements ITickable
|
|||
return false;
|
||||
|
||||
ItemStack currOutput = furnace.getStackInSlot(2);
|
||||
return currOutput.isEmpty() || output.isItemEqual(currOutput) && currOutput.getCount() + output.getCount() <= output.getMaxStackSize();
|
||||
return currOutput.isEmpty() ||
|
||||
Helper.areItemsEqual(currOutput, output, true) && currOutput.getCount() + output.getCount() <= output.getMaxStackSize();
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package de.ellpeck.naturesaura.blocks.tiles;
|
||||
|
||||
import de.ellpeck.naturesaura.Helper;
|
||||
import de.ellpeck.naturesaura.NaturesAura;
|
||||
import de.ellpeck.naturesaura.aura.AuraType;
|
||||
import de.ellpeck.naturesaura.aura.Capabilities;
|
||||
|
@ -111,7 +112,7 @@ public class TileEntityNatureAltar extends TileEntityImpl implements ITickable {
|
|||
this.currentRecipe = AltarRecipe.forInput(stack);
|
||||
}
|
||||
} else {
|
||||
if (stack.isEmpty() || !stack.isItemEqual(this.currentRecipe.input)) {
|
||||
if (stack.isEmpty() || !Helper.areItemsEqual(stack, this.currentRecipe.input, true)) {
|
||||
this.currentRecipe = null;
|
||||
this.timer = 0;
|
||||
} else if (this.hasCatalyst(this.currentRecipe.catalyst)) {
|
||||
|
|
|
@ -90,7 +90,7 @@ public class TileEntityPlacer extends TileEntityImpl implements ITickable {
|
|||
|
||||
for (EntityItemFrame frame : frames) {
|
||||
ItemStack frameStack = frame.getDisplayedItem();
|
||||
if (!frameStack.isEmpty() && stack.isItemEqual(frameStack))
|
||||
if (!frameStack.isEmpty() && Helper.areItemsEqual(stack, frameStack, false))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -151,7 +151,7 @@ public class TileEntityWoodStand extends TileEntityImpl implements ITickable {
|
|||
if (tile instanceof TileEntityWoodStand) {
|
||||
ItemStack stack = ((TileEntityWoodStand) tile).items.getStackInSlot(0);
|
||||
if (!stack.isEmpty()) {
|
||||
int index = Helper.getItemIndex(required, stack);
|
||||
int index = Helper.getItemIndex(required, stack, true);
|
||||
if (index >= 0) {
|
||||
required.remove(index);
|
||||
} else {
|
||||
|
|
|
@ -29,7 +29,7 @@ public class TerrainGenEvents {
|
|||
ItemStack saplingStack = sapling.getBlock().getItem(world, pos, sapling);
|
||||
if (!saplingStack.isEmpty()) {
|
||||
for (TreeRitualRecipe recipe : TreeRitualRecipe.RECIPES.values()) {
|
||||
if (recipe.saplingType.isItemEqual(saplingStack)) {
|
||||
if (Helper.areItemsEqual(saplingStack, recipe.saplingType, true)) {
|
||||
List<ItemStack> required = new ArrayList<>(Arrays.asList(recipe.items));
|
||||
MutableObject<TileEntityWoodStand> toPick = new MutableObject<>();
|
||||
|
||||
|
@ -39,7 +39,7 @@ public class TerrainGenEvents {
|
|||
TileEntityWoodStand stand = (TileEntityWoodStand) tile;
|
||||
ItemStack stack = stand.items.getStackInSlot(0);
|
||||
if (!stack.isEmpty()) {
|
||||
int index = Helper.getItemIndex(required, stack);
|
||||
int index = Helper.getItemIndex(required, stack, true);
|
||||
if (index >= 0) {
|
||||
required.remove(index);
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ public class ItemAuraBottle extends ItemImpl {
|
|||
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);
|
||||
AuraChunk.getAuraChunk(player.world, spot).drainAura(spot, 200);
|
||||
|
||||
player.world.playSound(null, player.posX, player.posY, player.posZ,
|
||||
SoundEvents.ITEM_BOTTLE_FILL_DRAGONBREATH, SoundCategory.PLAYERS, 1F, 1F);
|
||||
|
@ -76,6 +76,8 @@ public class ItemAuraBottle extends ItemImpl {
|
|||
if (!stack.hasTagCompound())
|
||||
return AuraType.OTHER;
|
||||
String type = stack.getTagCompound().getString("type");
|
||||
if (type.isEmpty())
|
||||
return AuraType.OTHER;
|
||||
return AuraType.valueOf(type);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package de.ellpeck.naturesaura.recipes;
|
||||
|
||||
import de.ellpeck.naturesaura.Helper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
@ -31,7 +32,7 @@ public class AltarRecipe {
|
|||
|
||||
public static AltarRecipe forInput(ItemStack input) {
|
||||
for (AltarRecipe recipe : RECIPES.values()) {
|
||||
if (recipe.input.isItemEqual(input)) {
|
||||
if (Helper.areItemsEqual(recipe.input, input, true)) {
|
||||
return recipe;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package de.ellpeck.naturesaura.recipes;
|
||||
|
||||
import de.ellpeck.naturesaura.NaturesAura;
|
||||
import de.ellpeck.naturesaura.aura.AuraType;
|
||||
import de.ellpeck.naturesaura.blocks.ModBlocks;
|
||||
import de.ellpeck.naturesaura.items.ItemAuraBottle;
|
||||
import de.ellpeck.naturesaura.items.ModItems;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
|
@ -23,7 +25,8 @@ public final class ModRecipes {
|
|||
new ItemStack(Blocks.STONE),
|
||||
new ItemStack(Blocks.STONE),
|
||||
new ItemStack(ModItems.GOLD_LEAF),
|
||||
new ItemStack(Items.GOLD_INGOT));
|
||||
new ItemStack(Items.GOLD_INGOT),
|
||||
ItemAuraBottle.setType(new ItemStack(ModItems.AURA_BOTTLE), AuraType.OVERWORLD));
|
||||
new TreeRitualRecipe(new ResourceLocation(NaturesAura.MOD_ID, "ancient_sapling"),
|
||||
new ItemStack(Blocks.SAPLING), new ItemStack(ModBlocks.ANCIENT_SAPLING), 200,
|
||||
new ItemStack(Blocks.SAPLING),
|
||||
|
@ -40,7 +43,8 @@ public final class ModRecipes {
|
|||
new ItemStack(ModItems.INFUSED_IRON),
|
||||
new ItemStack(Items.FIRE_CHARGE),
|
||||
new ItemStack(Items.FLINT),
|
||||
new ItemStack(Blocks.MAGMA));
|
||||
new ItemStack(Blocks.MAGMA),
|
||||
ItemAuraBottle.setType(new ItemStack(ModItems.AURA_BOTTLE), AuraType.NETHER));
|
||||
new TreeRitualRecipe(new ResourceLocation(NaturesAura.MOD_ID, "conversion_catalyst"),
|
||||
new ItemStack(Blocks.SAPLING, 1, 3), new ItemStack(ModBlocks.CONVERSION_CATALYST), 600,
|
||||
new ItemStack(Blocks.STONEBRICK, 1, 1),
|
||||
|
@ -58,8 +62,8 @@ public final class ModRecipes {
|
|||
null, 150, 40);
|
||||
|
||||
new AltarRecipe(new ResourceLocation(NaturesAura.MOD_ID, "chorus"),
|
||||
new ItemStack(Blocks.CHORUS_FLOWER), new ItemStack(Items.DRAGON_BREATH),
|
||||
ModBlocks.CONVERSION_CATALYST, 1000, 120);
|
||||
ItemAuraBottle.setType(new ItemStack(ModItems.AURA_BOTTLE), AuraType.END), new ItemStack(Items.DRAGON_BREATH),
|
||||
ModBlocks.CONVERSION_CATALYST, 350, 80);
|
||||
new AltarRecipe(new ResourceLocation(NaturesAura.MOD_ID, "leather"),
|
||||
new ItemStack(Items.ROTTEN_FLESH), new ItemStack(Items.LEATHER),
|
||||
ModBlocks.CONVERSION_CATALYST, 400, 50);
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
"translate": "advancement.naturesaura.altar.desc"
|
||||
}
|
||||
},
|
||||
"parent": "naturesaura:wood_stand",
|
||||
"parent": "naturesaura:aura_bottle_overworld",
|
||||
"criteria": {
|
||||
"book": {
|
||||
"trigger": "minecraft:inventory_changed",
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"display": {
|
||||
"icon": {
|
||||
"item": "naturesaura:aura_bottle",
|
||||
"nbt": "{\"type\":\"END\"}"
|
||||
},
|
||||
"title": {
|
||||
"translate": "advancement.naturesaura.aura_bottle_end"
|
||||
},
|
||||
"description": {
|
||||
"translate": "advancement.naturesaura.aura_bottle_end.desc"
|
||||
}
|
||||
},
|
||||
"parent": "naturesaura:wood_stand",
|
||||
"criteria": {
|
||||
"bottle": {
|
||||
"trigger": "minecraft:inventory_changed",
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "naturesaura:aura_bottle",
|
||||
"nbt": "{\"type\":\"END\"}"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"display": {
|
||||
"icon": {
|
||||
"item": "naturesaura:aura_bottle",
|
||||
"nbt": "{\"type\":\"NETHER\"}"
|
||||
},
|
||||
"title": {
|
||||
"translate": "advancement.naturesaura.aura_bottle_nether"
|
||||
},
|
||||
"description": {
|
||||
"translate": "advancement.naturesaura.aura_bottle_nether.desc"
|
||||
}
|
||||
},
|
||||
"parent": "naturesaura:wood_stand",
|
||||
"criteria": {
|
||||
"bottle": {
|
||||
"trigger": "minecraft:inventory_changed",
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "naturesaura:aura_bottle",
|
||||
"nbt": "{\"type\":\"NETHER\"}"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"display": {
|
||||
"icon": {
|
||||
"item": "naturesaura:aura_bottle",
|
||||
"nbt": "{\"type\":\"OVERWORLD\"}"
|
||||
},
|
||||
"title": {
|
||||
"translate": "advancement.naturesaura.aura_bottle_overworld"
|
||||
},
|
||||
"description": {
|
||||
"translate": "advancement.naturesaura.aura_bottle_overworld.desc"
|
||||
}
|
||||
},
|
||||
"parent": "naturesaura:wood_stand",
|
||||
"criteria": {
|
||||
"bottle": {
|
||||
"trigger": "minecraft:inventory_changed",
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "naturesaura:aura_bottle",
|
||||
"nbt": "{\"type\":\"OVERWORLD\"}"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -18,9 +18,6 @@
|
|||
"items": [
|
||||
{
|
||||
"item": "naturesaura:infused_iron"
|
||||
},
|
||||
{
|
||||
"item": "naturesaura:infused_stone"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
"translate": "advancement.naturesaura.potion_generator.desc"
|
||||
}
|
||||
},
|
||||
"parent": "naturesaura:flower_generator",
|
||||
"parent": "naturesaura:aura_bottle_nether",
|
||||
"criteria": {
|
||||
"generator": {
|
||||
"trigger": "minecraft:inventory_changed",
|
||||
|
|
|
@ -19,7 +19,8 @@
|
|||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"item": "patchouli:guide_book"
|
||||
"item": "patchouli:guide_book",
|
||||
"nbt": "{\"patchouli:book\":\"naturesaura:book\"}"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ advancement.naturesaura.wood_stand.desc=Create a Wooden Stand for the Ritual of
|
|||
advancement.naturesaura.altar=Empowered
|
||||
advancement.naturesaura.altar.desc=Create a Natural Altar using the Ritual of the Forest
|
||||
advancement.naturesaura.infused_materials=Iron Factory
|
||||
advancement.naturesaura.infused_materials.desc=Use the Natural Altar to create Infused Iron and Infused Rock
|
||||
advancement.naturesaura.infused_materials.desc=Use the Natural Altar to create Infused Iron
|
||||
advancement.naturesaura.furnace_heater=Cozy Warmth
|
||||
advancement.naturesaura.furnace_heater.desc=Create an Extraneous Firestarter to heat your furnace
|
||||
advancement.naturesaura.potion_generator=Lurking Powers
|
||||
|
@ -80,5 +80,11 @@ advancement.naturesaura.conversion_catalyst=Not so Equivalent Exchange
|
|||
advancement.naturesaura.conversion_catalyst.desc=Create a Conversion Catalyst for easy material conversion
|
||||
advancement.naturesaura.infused_tools=Gear Up Intensifies
|
||||
advancement.naturesaura.infused_tools.desc=Create an Infused Iron Pickaxe and Blade
|
||||
advancement.naturesaura.aura_bottle_overworld=A taste of Sunlight
|
||||
advancement.naturesaura.aura_bottle_overworld.desc=Collect Aura using a Bottle in the Overworld
|
||||
advancement.naturesaura.aura_bottle_nether=Spooky Scary Skeletons
|
||||
advancement.naturesaura.aura_bottle_nether.desc=Collect Aura using a Bottle in the Nether
|
||||
advancement.naturesaura.aura_bottle_end=Breathy Surroundings
|
||||
advancement.naturesaura.aura_bottle_end.desc=Collect Aura using a Bottle in the End
|
||||
|
||||
command.naturesaura.aura.usage=/naaura <action> <amount> <range>
|
|
@ -2,7 +2,7 @@
|
|||
"name": "The Natural Altar",
|
||||
"icon": "naturesaura:nature_altar",
|
||||
"category": "collecting",
|
||||
"advancement": "naturesaura:wood_stand",
|
||||
"advancement": "naturesaura:aura_bottle_overworld",
|
||||
"priority": true,
|
||||
"pages": [
|
||||
{
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"name": "Aura Bottling",
|
||||
"icon": "naturesaura:aura_bottle{type:'OVERWORLD'}",
|
||||
"category": "collecting",
|
||||
"advancement": "naturesaura:gold_leaf",
|
||||
"advancement": "naturesaura:wood_stand",
|
||||
"pages": [
|
||||
{
|
||||
"type": "text",
|
||||
|
@ -11,6 +11,7 @@
|
|||
{
|
||||
"type": "spotlight",
|
||||
"item": "naturesaura:aura_bottle{type:'OVERWORLD'}",
|
||||
"link_recipe": true,
|
||||
"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."
|
||||
}
|
||||
]
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"name": "Ritual of the Brewer",
|
||||
"icon": "naturesaura:potion_generator",
|
||||
"category": "creating",
|
||||
"advancement": "naturesaura:flower_generator",
|
||||
"advancement": "naturesaura:aura_bottle_nether",
|
||||
"pages": [
|
||||
{
|
||||
"type": "text",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"type": "forge:ore_shaped",
|
||||
"pattern": [
|
||||
"PIP",
|
||||
"PBP",
|
||||
"IFI",
|
||||
"PIP"
|
||||
],
|
||||
|
@ -16,6 +16,13 @@
|
|||
"F": {
|
||||
"item": "minecraft:double_plant",
|
||||
"data": 5
|
||||
},
|
||||
"B": {
|
||||
"type": "minecraft:item_nbt",
|
||||
"item": "naturesaura:aura_bottle",
|
||||
"nbt": {
|
||||
"type": "OVERWORLD"
|
||||
}
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
|
|
|
@ -16,7 +16,11 @@
|
|||
"item": "naturesaura:infused_iron"
|
||||
},
|
||||
"W": {
|
||||
"item": "minecraft:nether_wart"
|
||||
"type": "minecraft:item_nbt",
|
||||
"item": "naturesaura:aura_bottle",
|
||||
"nbt": {
|
||||
"type": "NETHER"
|
||||
}
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
|
|
Loading…
Reference in a new issue