-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #280 from fzzyhmstrs/1.20.6
Fzzy Update 1 - Start work on Enchantment Datagen, Enchantment Tags, …
- Loading branch information
Showing
65 changed files
with
2,050 additions
and
440 deletions.
There are no files selected for viewing
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
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
45 changes: 45 additions & 0 deletions
45
src/main/java/dev/timefall/mcdw/data/ConfigEnchantmentEnabledCondition.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,45 @@ | ||
/* | ||
* Timefall Development License 1.2 | ||
* Copyright (c) 2020-2024. Chronosacaria, Kluzzio, Timefall Development. All Rights Reserved. | ||
* | ||
* This software's content is licensed under the Timefall Development License 1.2. You can find this license information here: https://github.com/Timefall-Development/Timefall-Development-Licence/blob/main/TimefallDevelopmentLicense1.2.txt | ||
*/ | ||
package dev.timefall.mcdw.data; | ||
|
||
|
||
import com.mojang.serialization.MapCodec; | ||
import com.mojang.serialization.codecs.RecordCodecBuilder; | ||
import dev.timefall.mcdw.Mcdw; | ||
import dev.timefall.mcdw.configs.McdwEnchantmentSettingsConfig; | ||
import net.fabricmc.fabric.api.resource.conditions.v1.ResourceCondition; | ||
import net.fabricmc.fabric.api.resource.conditions.v1.ResourceConditionType; | ||
import net.fabricmc.fabric.api.resource.conditions.v1.ResourceConditions; | ||
import net.minecraft.registry.RegistryWrapper; | ||
import net.minecraft.util.Identifier; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
public record ConfigEnchantmentEnabledCondition(Identifier enchant) implements ResourceCondition { | ||
|
||
private static final MapCodec<ConfigEnchantmentEnabledCondition> CODEC = RecordCodecBuilder.mapCodec(instance -> | ||
instance.group( | ||
Identifier.CODEC.fieldOf("enchant").forGetter(ConfigEnchantmentEnabledCondition::enchant) | ||
).apply(instance, ConfigEnchantmentEnabledCondition::new) | ||
); | ||
|
||
private static final ResourceConditionType<ConfigEnchantmentEnabledCondition> TYPE = ResourceConditionType.create(Mcdw.ID("enchant_enabled"), CODEC); | ||
|
||
public static void register(){ | ||
ResourceConditions.register(TYPE); | ||
} | ||
|
||
@Override | ||
public ResourceConditionType<?> getType() { | ||
return TYPE; | ||
} | ||
|
||
@Override | ||
public boolean test(@Nullable RegistryWrapper.WrapperLookup registryLookup) { | ||
return McdwEnchantmentSettingsConfig.CONFIG.isEnchantmentEnabled(enchant); | ||
} | ||
|
||
} |
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
Oops, something went wrong.