mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-22 19:58:34 +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.NaturesAuraAPI;
|
||||||
import de.ellpeck.naturesaura.api.aura.item.IAuraRecharge;
|
import de.ellpeck.naturesaura.api.aura.item.IAuraRecharge;
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.TileEntityImpl;
|
import de.ellpeck.naturesaura.blocks.tiles.TileEntityImpl;
|
||||||
|
import net.minecraft.advancements.Advancement;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.properties.IProperty;
|
import net.minecraft.block.properties.IProperty;
|
||||||
import net.minecraft.block.state.IBlockState;
|
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.client.renderer.block.model.ItemCameraTransforms;
|
||||||
import net.minecraft.entity.item.EntityItemFrame;
|
import net.minecraft.entity.item.EntityItemFrame;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.init.SoundEvents;
|
import net.minecraft.init.SoundEvents;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.Ingredient;
|
import net.minecraft.item.crafting.Ingredient;
|
||||||
|
@ -230,4 +232,13 @@ public final class Helper {
|
||||||
public static Ingredient blockIng(Block block) {
|
public static Ingredient blockIng(Block block) {
|
||||||
return Ingredient.fromStacks(new ItemStack(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;
|
package de.ellpeck.naturesaura.events;
|
||||||
|
|
||||||
|
import de.ellpeck.naturesaura.Helper;
|
||||||
import de.ellpeck.naturesaura.ModConfig;
|
import de.ellpeck.naturesaura.ModConfig;
|
||||||
import de.ellpeck.naturesaura.NaturesAura;
|
import de.ellpeck.naturesaura.NaturesAura;
|
||||||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
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.api.aura.type.IAuraType;
|
||||||
import de.ellpeck.naturesaura.chunk.AuraChunk;
|
import de.ellpeck.naturesaura.chunk.AuraChunk;
|
||||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
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
|
@SubscribeEvent
|
||||||
public void onChunkWatch(ChunkWatchEvent.Watch event) {
|
public void onChunkWatch(ChunkWatchEvent.Watch event) {
|
||||||
Chunk chunk = event.getChunkInstance();
|
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.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=Ca-ching
|
||||||
advancement.naturesaura.aura_cache.desc=Create an Aura Cache to store Aura in your inventory
|
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>
|
command.naturesaura.aura.usage=/naaura <action> <amount> <range>
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"name": "Increase of Fertility",
|
"name": "Increase of Fertility",
|
||||||
"icon": "minecraft:egg",
|
"icon": "minecraft:egg",
|
||||||
"category": "effects",
|
"category": "effects",
|
||||||
"advancement": "naturesaura:flower_generator",
|
"advancement": "naturesaura:positive_imbalance",
|
||||||
"pages": [
|
"pages": [
|
||||||
{
|
{
|
||||||
"type": "text",
|
"type": "text",
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"name": "Breathlessness",
|
"name": "Breathlessness",
|
||||||
"icon": "minecraft:wool",
|
"icon": "minecraft:wool",
|
||||||
"category": "effects",
|
"category": "effects",
|
||||||
"advancement": "naturesaura:furnace_heater",
|
"advancement": "naturesaura:negative_imbalance",
|
||||||
"pages": [
|
"pages": [
|
||||||
{
|
{
|
||||||
"type": "text",
|
"type": "text",
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"name": "Natural Storage",
|
"name": "Natural Storage",
|
||||||
"icon": "naturesaura:aura_cache",
|
"icon": "naturesaura:aura_cache",
|
||||||
"category": "effects",
|
"category": "effects",
|
||||||
"advancement": "naturesaura:aura_cache",
|
"advancement": "naturesaura:positive_imbalance",
|
||||||
"pages": [
|
"pages": [
|
||||||
{
|
{
|
||||||
"type": "text",
|
"type": "text",
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"name": "Natural Decay",
|
"name": "Natural Decay",
|
||||||
"icon": "naturesaura:decayed_leaves",
|
"icon": "naturesaura:decayed_leaves",
|
||||||
"category": "effects",
|
"category": "effects",
|
||||||
"advancement": "naturesaura:furnace_heater",
|
"advancement": "naturesaura:negative_imbalance",
|
||||||
"pages": [
|
"pages": [
|
||||||
{
|
{
|
||||||
"type": "text",
|
"type": "text",
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"name": "Effect Powder",
|
"name": "Effect Powder",
|
||||||
"icon": "naturesaura:effect_powder{effect:'naturesaura:plant_boost'}",
|
"icon": "naturesaura:effect_powder{effect:'naturesaura:plant_boost'}",
|
||||||
"category": "effects",
|
"category": "effects",
|
||||||
"advancement": "naturesaura:aura_cache",
|
"advancement": "naturesaura:positive_imbalance",
|
||||||
"priority": true,
|
"priority": true,
|
||||||
"pages": [
|
"pages": [
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"name": "Unstable Outbreak",
|
"name": "Unstable Outbreak",
|
||||||
"icon": "minecraft:tnt",
|
"icon": "minecraft:tnt",
|
||||||
"category": "effects",
|
"category": "effects",
|
||||||
"advancement": "naturesaura:furnace_heater",
|
"advancement": "naturesaura:negative_imbalance",
|
||||||
"pages": [
|
"pages": [
|
||||||
{
|
{
|
||||||
"type": "text",
|
"type": "text",
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"name": "Vegetational Increase",
|
"name": "Vegetational Increase",
|
||||||
"icon": "minecraft:wheat_seeds",
|
"icon": "minecraft:wheat_seeds",
|
||||||
"category": "effects",
|
"category": "effects",
|
||||||
"advancement": "naturesaura:flower_generator",
|
"advancement": "naturesaura:positive_imbalance",
|
||||||
"pages": [
|
"pages": [
|
||||||
{
|
{
|
||||||
"type": "text",
|
"type": "text",
|
||||||
|
|
Loading…
Reference in a new issue