-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
227 additions
and
183 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package juuxel.adorn.lib; | ||
|
||
import juuxel.adorn.AdornCommon; | ||
import juuxel.adorn.config.Config; | ||
import juuxel.adorn.config.ConfigManager; | ||
import net.minecraft.world.GameRules; | ||
import net.minecraft.world.GameRules.BooleanRule; | ||
import net.minecraft.world.GameRules.Category; | ||
import net.minecraft.world.GameRules.Key; | ||
import net.minecraft.world.GameRules.Rule; | ||
import net.minecraft.world.GameRules.Type; | ||
|
||
import java.util.function.Predicate; | ||
|
||
public final class AdornGameRules { | ||
public static final Key<BooleanRule> SKIP_NIGHT_ON_SOFAS = | ||
register("skipNightOnSofas", Category.PLAYER, createBooleanRule(defaults -> defaults.skipNightOnSofas)); | ||
public static final Key<BooleanRule> INFINITE_KITCHEN_SINKS = | ||
register("infiniteKitchenSinks", Category.MISC, createBooleanRule(defaults -> defaults.infiniteKitchenSinks)); | ||
public static final Key<BooleanRule> DROP_LOCKED_TRADING_STATIONS = | ||
register("dropLockedTradingStations", Category.DROPS, createBooleanRule(defaults -> defaults.dropLockedTradingStations)); | ||
|
||
public static void init() { | ||
} | ||
|
||
private static Type<BooleanRule> createBooleanRule(Predicate<Config.GameRuleDefaults> defaultGetter) { | ||
return BooleanRule.create(defaultGetter.test(ConfigManager.Companion.config().gameRuleDefaults)); | ||
} | ||
|
||
private static <T extends Rule<T>> Key<T> register(String name, Category category, Type<T> type) { | ||
return GameRules.register(AdornCommon.NAMESPACE + ':' + name, category, type); | ||
} | ||
} |
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,89 @@ | ||
package juuxel.adorn.lib; | ||
|
||
import juuxel.adorn.AdornCommon; | ||
import juuxel.adorn.lib.registry.Registered; | ||
import juuxel.adorn.lib.registry.Registrar; | ||
import juuxel.adorn.lib.registry.RegistrarFactory; | ||
import net.minecraft.registry.RegistryKeys; | ||
import net.minecraft.sound.BlockSoundGroup; | ||
import net.minecraft.sound.SoundEvent; | ||
|
||
import java.util.function.Supplier; | ||
|
||
public final class AdornSounds { | ||
public static final Registrar<SoundEvent> SOUNDS = RegistrarFactory.get().create(RegistryKeys.SOUND_EVENT); | ||
|
||
public static final Registered<SoundEvent> BLOCK_CHAIN_LINK_FENCE_BREAK = register("block.adorn.chain_link_fence.break"); | ||
public static final Registered<SoundEvent> BLOCK_CHAIN_LINK_FENCE_STEP = register("block.adorn.chain_link_fence.step"); | ||
public static final Registered<SoundEvent> BLOCK_CHAIN_LINK_FENCE_PLACE = register("block.adorn.chain_link_fence.place"); | ||
public static final Registered<SoundEvent> BLOCK_CHAIN_LINK_FENCE_HIT = register("block.adorn.chain_link_fence.hit"); | ||
public static final Registered<SoundEvent> BLOCK_CHAIN_LINK_FENCE_FALL = register("block.adorn.chain_link_fence.fall"); | ||
public static final Registered<SoundEvent> ITEM_WATERING_CAN_WATER = register("item.adorn.watering_can.water"); | ||
|
||
public static final BlockSoundGroup CHAIN_LINK_FENCE = new LazyBlockSoundGroup( | ||
1.0F, | ||
1.5F, | ||
BLOCK_CHAIN_LINK_FENCE_BREAK, | ||
BLOCK_CHAIN_LINK_FENCE_STEP, | ||
BLOCK_CHAIN_LINK_FENCE_PLACE, | ||
BLOCK_CHAIN_LINK_FENCE_HIT, | ||
BLOCK_CHAIN_LINK_FENCE_FALL | ||
); | ||
|
||
public static void init() { | ||
} | ||
|
||
private static Registered<SoundEvent> register(String name) { | ||
return SOUNDS.register(name, () -> SoundEvent.of(AdornCommon.id(name))); | ||
} | ||
|
||
private static final class LazyBlockSoundGroup extends BlockSoundGroup { | ||
private final Supplier<SoundEvent> breakSound; | ||
private final Supplier<SoundEvent> stepSound; | ||
private final Supplier<SoundEvent> placeSound; | ||
private final Supplier<SoundEvent> hitSound; | ||
private final Supplier<SoundEvent> fallSound; | ||
|
||
LazyBlockSoundGroup( | ||
float volume, | ||
float pitch, | ||
Supplier<SoundEvent> breakSound, | ||
Supplier<SoundEvent> stepSound, | ||
Supplier<SoundEvent> placeSound, | ||
Supplier<SoundEvent> hitSound, | ||
Supplier<SoundEvent> fallSound | ||
) { | ||
super(volume, pitch, null, null, null, null, null); | ||
this.breakSound = breakSound; | ||
this.stepSound = stepSound; | ||
this.placeSound = placeSound; | ||
this.hitSound = hitSound; | ||
this.fallSound = fallSound; | ||
} | ||
|
||
@Override | ||
public SoundEvent getBreakSound() { | ||
return breakSound.get(); | ||
} | ||
|
||
@Override | ||
public SoundEvent getStepSound() { | ||
return stepSound.get(); | ||
} | ||
|
||
@Override | ||
public SoundEvent getPlaceSound() { | ||
return placeSound.get(); | ||
} | ||
|
||
@Override | ||
public SoundEvent getHitSound() { | ||
return hitSound.get(); | ||
} | ||
|
||
@Override | ||
public SoundEvent getFallSound() { | ||
return fallSound.get(); | ||
} | ||
} | ||
} |
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,27 @@ | ||
package juuxel.adorn.lib; | ||
|
||
import juuxel.adorn.AdornCommon; | ||
import net.minecraft.stat.StatFormatter; | ||
import net.minecraft.stat.Stats; | ||
import net.minecraft.util.Identifier; | ||
|
||
public final class AdornStats { | ||
public static final Identifier OPEN_BREWER = register("open_brewer", StatFormatter.DEFAULT); | ||
public static final Identifier OPEN_DRAWER = register("open_drawer", StatFormatter.DEFAULT); | ||
public static final Identifier OPEN_KITCHEN_CUPBOARD = register("open_kitchen_cupboard", StatFormatter.DEFAULT); | ||
public static final Identifier INTERACT_WITH_SHELF = register("interact_with_shelf", StatFormatter.DEFAULT); | ||
public static final Identifier INTERACT_WITH_TABLE_LAMP = register("interact_with_table_lamp", StatFormatter.DEFAULT); | ||
public static final Identifier INTERACT_WITH_TRADING_STATION = register("interact_with_trading_station", StatFormatter.DEFAULT); | ||
public static final Identifier DYE_TABLE_LAMP = register("dye_table_lamp", StatFormatter.DEFAULT); | ||
public static final Identifier DYE_SOFA = register("dye_sofa", StatFormatter.DEFAULT); | ||
public static final Identifier SIT_ON_CHAIR = register("sit_on_chair", StatFormatter.DEFAULT); | ||
public static final Identifier SIT_ON_SOFA = register("sit_on_sofa", StatFormatter.DEFAULT); | ||
public static final Identifier SIT_ON_BENCH = register("sit_on_bench", StatFormatter.DEFAULT); | ||
|
||
private static Identifier register(String id, StatFormatter formatter) { | ||
return Stats.register(AdornCommon.NAMESPACE + ':' + id, formatter); | ||
} | ||
|
||
public static void init() { | ||
} | ||
} |
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,56 @@ | ||
package juuxel.adorn.lib; | ||
|
||
import juuxel.adorn.AdornCommon; | ||
import net.minecraft.block.Block; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.registry.RegistryKeys; | ||
import net.minecraft.registry.tag.TagKey; | ||
|
||
public final class AdornTags { | ||
public static final TagPair CHAIRS = blockAndItem("chairs"); | ||
public static final TagPair TABLES = blockAndItem("tables"); | ||
public static final TagPair DRAWERS = blockAndItem("drawers"); | ||
public static final TagPair BENCHES = blockAndItem("benches"); | ||
public static final TagPair KITCHEN_COUNTERS = blockAndItem("kitchen_counters"); | ||
public static final TagPair KITCHEN_CUPBOARDS = blockAndItem("kitchen_cupboards"); | ||
public static final TagPair KITCHEN_SINKS = blockAndItem("kitchen_sinks"); | ||
public static final TagPair KITCHEN_BLOCKS = blockAndItem("kitchen_blocks"); | ||
public static final TagPair SOFAS = blockAndItem("sofas"); | ||
public static final TagPair POSTS = blockAndItem("posts"); | ||
public static final TagPair PLATFORMS = blockAndItem("platforms"); | ||
public static final TagPair STEPS = blockAndItem("steps"); | ||
public static final TagPair WOODEN_POSTS = blockAndItem("wooden_posts"); | ||
public static final TagPair WOODEN_PLATFORMS = blockAndItem("wooden_platforms"); | ||
public static final TagPair WOODEN_STEPS = blockAndItem("wooden_steps"); | ||
public static final TagPair STONE_POSTS = blockAndItem("stone_posts"); | ||
public static final TagPair STONE_PLATFORMS = blockAndItem("stone_platforms"); | ||
public static final TagPair STONE_STEPS = blockAndItem("stone_steps"); | ||
public static final TagPair SHELVES = blockAndItem("shelves"); | ||
public static final TagPair WOODEN_SHELVES = blockAndItem("wooden_shelves"); | ||
public static final TagPair CHIMNEYS = blockAndItem("chimneys"); | ||
public static final TagPair CRATES = blockAndItem("crates"); | ||
public static final TagPair COFFEE_TABLES = blockAndItem("coffee_tables"); | ||
public static final TagPair TABLE_LAMPS = blockAndItem("table_lamps"); | ||
public static final TagPair CANDLELIT_LANTERNS = blockAndItem("candlelit_lanterns"); | ||
public static final TagPair COPPER_PIPES = blockAndItem("copper_pipes"); | ||
public static final TagKey<Block> COPPER_PIPES_CONNECT_TO = block("copper_pipes_connect_to"); | ||
public static final TagKey<Item> WATERING_CAN_FERTILIZERS = item("watering_can_fertilizers"); | ||
|
||
public static void init() { | ||
} | ||
|
||
private static TagKey<Block> block(String path) { | ||
return TagKey.of(RegistryKeys.BLOCK, AdornCommon.id(path)); | ||
} | ||
|
||
private static TagKey<Item> item(String path) { | ||
return TagKey.of(RegistryKeys.ITEM, AdornCommon.id(path)); | ||
} | ||
|
||
private static TagPair blockAndItem(String path) { | ||
return new TagPair(block(path), item(path)); | ||
} | ||
|
||
public record TagPair(TagKey<Block> block, TagKey<Item> item) { | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.