Skip to content

Commit

Permalink
should have stick with the built-in minecraft boilerplate then
Browse files Browse the repository at this point in the history
  • Loading branch information
commandblock2 committed Jul 12, 2023
1 parent 51995bc commit b8c741d
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 130 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
package github.jparrowsec.cnmandblock2.coffee_mod.datagen

import github.jparrowsec.cnmandblock2.coffee_mod.CoffeeMod
import github.jparrowsec.cnmandblock2.coffee_mod.datagen.criterion.AcquireAnyOfCoffeeCriterion
import github.jparrowsec.cnmandblock2.coffee_mod.datagen.criterion.FeedSupportedEntityCriterion
import github.jparrowsec.cnmandblock2.coffee_mod.datagen.criterion.ServerPlayerTriggerble
import github.jparrowsec.cnmandblock2.coffee_mod.item.CoffeeModItems
Expand All @@ -30,14 +29,16 @@ import net.fabricmc.fabric.api.datagen.v1.provider.FabricAdvancementProvider
import net.minecraft.advancement.Advancement
import net.minecraft.advancement.AdvancementDisplay
import net.minecraft.advancement.AdvancementFrame
import net.minecraft.advancement.criterion.AbstractCriterion
import net.minecraft.advancement.CriterionMerger
import net.minecraft.advancement.criterion.BrewedPotionCriterion
import net.minecraft.advancement.criterion.Criteria
import net.minecraft.advancement.criterion.Criterion
import net.minecraft.advancement.criterion.InventoryChangedCriterion
import net.minecraft.item.ItemStack
import net.minecraft.item.Items
import net.minecraft.item.PotionItem
import net.minecraft.potion.PotionUtil
import net.minecraft.predicate.item.ItemPredicate
import net.minecraft.predicate.entity.LootContextPredicate
import net.minecraft.text.Text
import net.minecraft.util.Identifier
import java.util.function.Consumer
Expand Down Expand Up @@ -83,7 +84,7 @@ class CoffeeModAdvancements(fabricDataOutput: FabricDataOutput) : FabricAdvancem
.criterion("feed_any_supported_entity", FeedSupportedEntityCriterion.Condition())
.build(it, "${CoffeeMod.MOD_ID}/feed-any")

val brewWithBrewingTable = Advancement.Builder
val brewWithBrewingTableButNotComplete = Advancement.Builder
.create()
.display(
AdvancementDisplay(
Expand All @@ -98,18 +99,21 @@ class CoffeeModAdvancements(fabricDataOutput: FabricDataOutput) : FabricAdvancem
)
)
.parent(rootAdvancement)
.criterion(
"brew_with_brewing_stand",
AcquireAnyOfCoffeeCriterion.Condition()

val brewWithBrewingTable = CoffeeModPotions.allPotions.fold(brewWithBrewingTableButNotComplete) {
acc, potion ->
acc.criterion("brew_${potion.baseName}",
BrewedPotionCriterion.Conditions(LootContextPredicate.EMPTY, potion)
)
}
.criteriaMerger(CriterionMerger.OR)
.build(it, "${CoffeeMod.MOD_ID}/brew")
}.accept(consumer)
}

companion object {
private val customCriteriaClasses : List<Class<out ServerPlayerTriggerble>> = listOf(
FeedSupportedEntityCriterion::class.java,
AcquireAnyOfCoffeeCriterion::class.java
)

private val _customCriteria = customCriteriaClasses.associateBy({ it }) {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,21 @@ object CoffeeModPotions {
private const val PROLONGED_HASTE_DURATION = 20 * 60 * 5

val REGULAR_COFFEE_POTION = CoffeeMod.register(
Registries.POTION, "regular_coffee_potion", Potion(
Registries.POTION, "regular_coffee_potion", Potion("regular_coffee_potion",
StatusEffectInstance(CoffeeModEffects.coffeeBuzzStatusEffect, REGULAR_DURATION),
StatusEffectInstance(StatusEffects.HASTE, REGULAR_HASTE_DURATION)
)
)

val BOOSTED_COFFEE_POTION = CoffeeMod.register(
Registries.POTION, "boosted_coffee_potion", Potion(
Registries.POTION, "boosted_coffee_potion", Potion("boosted_coffee_potion",
StatusEffectInstance(CoffeeModEffects.coffeeBuzzStatusEffect, BOOST_DURATION, 1),
StatusEffectInstance(StatusEffects.HASTE, BOOST_HASTE_DURATION, 1)
)
)

val PROLONGED_COFFEE_POTION = CoffeeMod.register(
Registries.POTION, "prolonged_coffee_potion", Potion(
Registries.POTION, "prolonged_coffee_potion", Potion("prolonged_coffee_potion",
StatusEffectInstance(CoffeeModEffects.coffeeBuzzStatusEffect, PROLONGED_DURATION),
StatusEffectInstance(StatusEffects.HASTE, PROLONGED_HASTE_DURATION)
)
Expand All @@ -68,23 +68,23 @@ object CoffeeModPotions {

val shitCoffeeRegularPotion = CoffeeMod.register(
Registries.POTION,
it.untranslatedName + "_shit_coffee_potion", Potion(
it.untranslatedName + "_shit_coffee_potion", Potion(it.untranslatedName + "_shit_coffee_potion",
StatusEffectInstance(CoffeeModEffects.specialEffectByEntityType[it], REGULAR_DURATION),
StatusEffectInstance(CoffeeModEffects.coffeeBuzzStatusEffect, REGULAR_DURATION),
StatusEffectInstance(StatusEffects.HASTE, REGULAR_HASTE_DURATION, if (it == EntityType.CAT) 1 else 0)
)
)
val shitCoffeeBoostedPotion = CoffeeMod.register(
Registries.POTION,
it.untranslatedName + "_shit_coffee_boosted_potion", Potion(
it.untranslatedName + "_shit_coffee_boosted_potion", Potion(it.untranslatedName + "_shit_coffee_boosted_potion",
StatusEffectInstance(CoffeeModEffects.specialEffectByEntityType[it], BOOST_DURATION),
StatusEffectInstance(CoffeeModEffects.coffeeBuzzStatusEffect, BOOST_DURATION),
StatusEffectInstance(StatusEffects.HASTE, BOOST_HASTE_DURATION, if (it == EntityType.CAT) 2 else 1)
)
)
val shitCoffeeProlongedPotion = CoffeeMod.register(
Registries.POTION,
it.untranslatedName + "_shit_coffee_prolonged_potion", Potion(
it.untranslatedName + "_shit_coffee_prolonged_potion", Potion(it.untranslatedName + "_shit_coffee_prolonged_potion",
StatusEffectInstance(CoffeeModEffects.specialEffectByEntityType[it], PROLONGED_DURATION),
StatusEffectInstance(CoffeeModEffects.coffeeBuzzStatusEffect, PROLONGED_DURATION),
StatusEffectInstance(StatusEffects.HASTE, PROLONGED_HASTE_DURATION, if (it == EntityType.CAT) 1 else 0)
Expand Down
3 changes: 2 additions & 1 deletion coffee-mod-hsds/src/main/resources/coffee_mod.accesswidener
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ accessible field net/minecraft/client/render/entity/LivingEntityRenderer model L
accessible field net/minecraft/client/render/entity/VillagerEntityRenderer TEXTURE Lnet/minecraft/util/Identifier;
mutable field net/minecraft/client/resource/language/TranslationStorage translations Ljava/util/Map;
accessible field net/minecraft/client/resource/language/TranslationStorage translations Ljava/util/Map;
accessible class net/minecraft/entity/SpawnRestriction$Entry
accessible class net/minecraft/entity/SpawnRestriction$Entry
accessible field net/minecraft/potion/Potion baseName Ljava/lang/String;
1 change: 0 additions & 1 deletion coffee-mod-hsds/src/main/resources/coffee_mod.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"defaultRequire": 1
},
"mixins": [
"minecraft.advancement.criterion.MixinInventoryChangedCriterion",
"minecraft.entity.MixinLivingEntity",
"minecraft.entity.MixinSpawnRestriction",
"minecraft.entity.passive.MixinVillagerEntity",
Expand Down

0 comments on commit b8c741d

Please sign in to comment.