-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed Rocket Launch criterion not being triggered Added Rocket Destroy criterion and an advancement using it Added an advancement for eating a Lead Apple Added non US English
- Loading branch information
Showing
11 changed files
with
4,292 additions
and
9 deletions.
There are no files selected for viewing
1,030 changes: 1,030 additions & 0 deletions
1,030
astromine-core/src/main/resources/assets/astromine/lang/en_au.json
Large diffs are not rendered by default.
Oops, something went wrong.
1,030 changes: 1,030 additions & 0 deletions
1,030
astromine-core/src/main/resources/assets/astromine/lang/en_ca.json
Large diffs are not rendered by default.
Oops, something went wrong.
1,030 changes: 1,030 additions & 0 deletions
1,030
astromine-core/src/main/resources/assets/astromine/lang/en_gb.json
Large diffs are not rendered by default.
Oops, something went wrong.
1,030 changes: 1,030 additions & 0 deletions
1,030
astromine-core/src/main/resources/assets/astromine/lang/en_nz.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
...hub/chainmailstudios/astromine/discoveries/common/advancement/DestroyRocketCriterion.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/* | ||
* MIT License | ||
* | ||
* Copyright (c) 2020 Chainmail Studios | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
package com.github.chainmailstudios.astromine.discoveries.common.advancement; | ||
|
||
import net.minecraft.advancement.criterion.AbstractCriterion; | ||
import net.minecraft.advancement.criterion.AbstractCriterionConditions; | ||
import net.minecraft.predicate.entity.AdvancementEntityPredicateDeserializer; | ||
import net.minecraft.predicate.entity.EntityPredicate; | ||
import net.minecraft.server.network.ServerPlayerEntity; | ||
import net.minecraft.util.Identifier; | ||
|
||
import com.github.chainmailstudios.astromine.discoveries.registry.AstromineDiscoveriesCriteria; | ||
|
||
import com.google.gson.JsonObject; | ||
|
||
public class DestroyRocketCriterion extends AbstractCriterion<DestroyRocketCriterion.Conditions> { | ||
public final Identifier id; | ||
|
||
public DestroyRocketCriterion(Identifier id) { | ||
this.id = id; | ||
} | ||
|
||
@Override | ||
protected DestroyRocketCriterion.Conditions conditionsFromJson(JsonObject obj, EntityPredicate.Extended playerPredicate, AdvancementEntityPredicateDeserializer predicateDeserializer) { | ||
if(obj.has("intentional")) return new Conditions(this.id, playerPredicate, obj.get("intentional").getAsBoolean()); | ||
else return new Conditions(this.id, playerPredicate); | ||
} | ||
|
||
@Override | ||
public Identifier getId() { | ||
return id; | ||
} | ||
|
||
public void trigger(ServerPlayerEntity player, boolean intentional) { | ||
this.test(player, conditions -> conditions.matches(intentional)); | ||
} | ||
|
||
public static class Conditions extends AbstractCriterionConditions { | ||
private final Boolean intentional; | ||
|
||
public Conditions(Identifier id, EntityPredicate.Extended playerPredicate, Boolean intentional) { | ||
super(id, playerPredicate); | ||
this.intentional = intentional; | ||
} | ||
|
||
public Conditions(Identifier id, EntityPredicate.Extended playerPredicate) { | ||
super(id, playerPredicate); | ||
this.intentional = null; | ||
} | ||
|
||
public boolean matches(boolean intentional) { | ||
return intentional() == null || intentional == intentional(); | ||
} | ||
|
||
public Boolean intentional() { | ||
return intentional; | ||
} | ||
|
||
public static Conditions create(boolean intentional) { | ||
return new Conditions(AstromineDiscoveriesCriteria.DESTROY_ROCKET.getId(), EntityPredicate.Extended.EMPTY, intentional); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
.../main/resources/data/astromine/advancements/astromine/destroy_rocket_unintentionally.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"parent": "astromine:astromine/launch_rocket", | ||
"display": { | ||
"icon": { | ||
"item": "astromine:rocket" | ||
}, | ||
"title": { | ||
"translate": "advancements.astromine.destroy_rocket.title" | ||
}, | ||
"description": { | ||
"translate": "advancements.astromine.destroy_rocket.description" | ||
}, | ||
"frame": "task", | ||
"show_toast": true, | ||
"announce_to_chat": true, | ||
"hidden": false | ||
}, | ||
"criteria": { | ||
"destroy_rocket": { | ||
"trigger": "astromine:destroy_rocket", | ||
"conditions": { | ||
"intentional": false | ||
} | ||
} | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
...-foundations/src/main/resources/data/astromine/advancements/astromine/eat_lead_apple.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"parent": "astromine:astromine/root", | ||
"display": { | ||
"icon": { | ||
"item": "astromine:lead_apple" | ||
}, | ||
"title": { | ||
"translate": "advancements.astromine.eat_lead_apple.title" | ||
}, | ||
"description": { | ||
"translate": "advancements.astromine.eat_lead_apple.description" | ||
}, | ||
"frame": "task", | ||
"show_toast": true, | ||
"announce_to_chat": true, | ||
"hidden": false | ||
}, | ||
"criteria": { | ||
"eat_lead_apple": { | ||
"trigger": "minecraft:consume_item", | ||
"conditions": { | ||
"items": [ | ||
{ | ||
"item": "astromine:lead_apple" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} |