-
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.
Fzzy Update 2 - Update all item registries with their Identifiers, st…
…art in on custom ComponentTypes, implementing event hooks, custom Effect Types including registries
- Loading branch information
1 parent
8caafc3
commit 64921ad
Showing
63 changed files
with
1,731 additions
and
466 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.