mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-22 11:53:29 +01:00
made passive effects have their own advancements so that they're not gated behind random generators
This commit is contained in:
parent
1a2eee7ed9
commit
91a52460f9
12 changed files with 76 additions and 7 deletions
|
@ -3,6 +3,7 @@ package de.ellpeck.naturesaura;
|
|||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||
import de.ellpeck.naturesaura.api.aura.item.IAuraRecharge;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.TileEntityImpl;
|
||||
import net.minecraft.advancements.Advancement;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
@ -12,6 +13,7 @@ import net.minecraft.client.renderer.RenderHelper;
|
|||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||
import net.minecraft.entity.item.EntityItemFrame;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
|
@ -230,4 +232,13 @@ public final class Helper {
|
|||
public static Ingredient blockIng(Block block) {
|
||||
return Ingredient.fromStacks(new ItemStack(block));
|
||||
}
|
||||
|
||||
public static void addAdvancement(EntityPlayer player, ResourceLocation advancement, String criterion) {
|
||||
if (!(player instanceof EntityPlayerMP))
|
||||
return;
|
||||
EntityPlayerMP playerMp = (EntityPlayerMP) player;
|
||||
Advancement adv = playerMp.getServerWorld().getAdvancementManager().getAdvancement(advancement);
|
||||
if (adv != null)
|
||||
playerMp.getAdvancements().grantCriterion(adv, criterion);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package de.ellpeck.naturesaura.events;
|
||||
|
||||
import de.ellpeck.naturesaura.Helper;
|
||||
import de.ellpeck.naturesaura.ModConfig;
|
||||
import de.ellpeck.naturesaura.NaturesAura;
|
||||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
||||
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
|
||||
import de.ellpeck.naturesaura.chunk.AuraChunk;
|
||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
|
@ -46,6 +48,20 @@ public class CommonEvents {
|
|||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerTick(TickEvent.PlayerTickEvent event) {
|
||||
if (!event.player.world.isRemote && event.phase == TickEvent.Phase.END) {
|
||||
if (event.player.world.getTotalWorldTime() % 200 != 0)
|
||||
return;
|
||||
|
||||
int aura = IAuraChunk.triangulateAuraInArea(event.player.world, event.player.getPosition(), 25);
|
||||
if (aura <= 0)
|
||||
Helper.addAdvancement(event.player, new ResourceLocation(NaturesAura.MOD_ID, "negative_imbalance"), "triggered_in_code");
|
||||
else if (aura >= 15000)
|
||||
Helper.addAdvancement(event.player, new ResourceLocation(NaturesAura.MOD_ID, "positive_imbalance"), "triggered_in_code");
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onChunkWatch(ChunkWatchEvent.Watch event) {
|
||||
Chunk chunk = event.getChunkInstance();
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"display": {
|
||||
"icon": {
|
||||
"item": "naturesaura:decayed_leaves"
|
||||
},
|
||||
"title": {
|
||||
"translate": "advancement.naturesaura.negative_imbalance"
|
||||
},
|
||||
"description": {
|
||||
"translate": "advancement.naturesaura.negative_imbalance.desc"
|
||||
}
|
||||
},
|
||||
"parent": "naturesaura:altar",
|
||||
"criteria": {
|
||||
"triggered_in_code": {
|
||||
"trigger": "minecraft:impossible"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"display": {
|
||||
"icon": {
|
||||
"item": "minecraft:wheat_seeds"
|
||||
},
|
||||
"title": {
|
||||
"translate": "advancement.naturesaura.positive_imbalance"
|
||||
},
|
||||
"description": {
|
||||
"translate": "advancement.naturesaura.positive_imbalance.desc"
|
||||
}
|
||||
},
|
||||
"parent": "naturesaura:altar",
|
||||
"criteria": {
|
||||
"triggered_in_code": {
|
||||
"trigger": "minecraft:impossible"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -116,6 +116,10 @@ advancement.naturesaura.sky_ingot=Sturdy and light
|
|||
advancement.naturesaura.sky_ingot.desc=Create an Ingot of the Skies using the Offering to the Gods
|
||||
advancement.naturesaura.aura_cache=Ca-ching
|
||||
advancement.naturesaura.aura_cache.desc=Create an Aura Cache to store Aura in your inventory
|
||||
advancement.naturesaura.positive_imbalance=Luscious Surroundings
|
||||
advancement.naturesaura.positive_imbalance.desc=Create enough Aura to cause positive imbalance effects
|
||||
advancement.naturesaura.negative_imbalance=Deadly Day
|
||||
advancement.naturesaura.negative_imbalance.desc=Drain enough Aura to cause negative imbalance effects
|
||||
|
||||
command.naturesaura.aura.usage=/naaura <action> <amount> <range>
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"name": "Increase of Fertility",
|
||||
"icon": "minecraft:egg",
|
||||
"category": "effects",
|
||||
"advancement": "naturesaura:flower_generator",
|
||||
"advancement": "naturesaura:positive_imbalance",
|
||||
"pages": [
|
||||
{
|
||||
"type": "text",
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"name": "Breathlessness",
|
||||
"icon": "minecraft:wool",
|
||||
"category": "effects",
|
||||
"advancement": "naturesaura:furnace_heater",
|
||||
"advancement": "naturesaura:negative_imbalance",
|
||||
"pages": [
|
||||
{
|
||||
"type": "text",
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"name": "Natural Storage",
|
||||
"icon": "naturesaura:aura_cache",
|
||||
"category": "effects",
|
||||
"advancement": "naturesaura:aura_cache",
|
||||
"advancement": "naturesaura:positive_imbalance",
|
||||
"pages": [
|
||||
{
|
||||
"type": "text",
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"name": "Natural Decay",
|
||||
"icon": "naturesaura:decayed_leaves",
|
||||
"category": "effects",
|
||||
"advancement": "naturesaura:furnace_heater",
|
||||
"advancement": "naturesaura:negative_imbalance",
|
||||
"pages": [
|
||||
{
|
||||
"type": "text",
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"name": "Effect Powder",
|
||||
"icon": "naturesaura:effect_powder{effect:'naturesaura:plant_boost'}",
|
||||
"category": "effects",
|
||||
"advancement": "naturesaura:aura_cache",
|
||||
"advancement": "naturesaura:positive_imbalance",
|
||||
"priority": true,
|
||||
"pages": [
|
||||
{
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"name": "Unstable Outbreak",
|
||||
"icon": "minecraft:tnt",
|
||||
"category": "effects",
|
||||
"advancement": "naturesaura:furnace_heater",
|
||||
"advancement": "naturesaura:negative_imbalance",
|
||||
"pages": [
|
||||
{
|
||||
"type": "text",
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"name": "Vegetational Increase",
|
||||
"icon": "minecraft:wheat_seeds",
|
||||
"category": "effects",
|
||||
"advancement": "naturesaura:flower_generator",
|
||||
"advancement": "naturesaura:positive_imbalance",
|
||||
"pages": [
|
||||
{
|
||||
"type": "text",
|
||||
|
|
Loading…
Reference in a new issue