Sounds
This commit is contained in:
parent
74992a7f68
commit
62698e8bf5
24 changed files with 64 additions and 30 deletions
|
@ -11,6 +11,7 @@ import ru.betterend.registry.BlockRegistry;
|
|||
import ru.betterend.registry.BlockTagRegistry;
|
||||
import ru.betterend.registry.FeatureRegistry;
|
||||
import ru.betterend.registry.ItemRegistry;
|
||||
import ru.betterend.registry.SoundsRegistry;
|
||||
import ru.betterend.util.Logger;
|
||||
import ru.betterend.world.generator.BetterEndBiomeSource;
|
||||
import ru.betterend.world.surface.DoubleBlockSurfaceBuilder;
|
||||
|
@ -22,6 +23,7 @@ public class BetterEnd implements ModInitializer {
|
|||
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
SoundsRegistry.register();
|
||||
DoubleBlockSurfaceBuilder.register();
|
||||
ItemRegistry.register();
|
||||
BlockRegistry.register();
|
||||
|
@ -34,10 +36,11 @@ public class BetterEnd implements ModInitializer {
|
|||
AlloyingRecipes.register();
|
||||
}
|
||||
|
||||
public static Identifier getIdentifier(String path) {
|
||||
public static Identifier makeID(String path) {
|
||||
return new Identifier(MOD_ID, path);
|
||||
}
|
||||
|
||||
// For what does this exists? //
|
||||
public static String getStringId(String id) {
|
||||
return String.format("%s:%s", MOD_ID, id);
|
||||
}
|
||||
|
|
|
@ -168,9 +168,9 @@ public class EChestBlockEntityRenderer extends BlockEntityRenderer<EChestBlockEn
|
|||
if (block instanceof BlockChest) {
|
||||
String name = Registry.BLOCK.getId(block).getPath();
|
||||
LAYERS.put(Block.getRawIdFromState(block.getDefaultState()), new RenderLayer[] {
|
||||
RenderLayer.getEntitySolid(BetterEnd.getIdentifier("textures/entity/chest/" + name + ".png")),
|
||||
RenderLayer.getEntitySolid(BetterEnd.getIdentifier("textures/entity/chest/" + name + "_left.png")),
|
||||
RenderLayer.getEntitySolid(BetterEnd.getIdentifier("textures/entity/chest/" + name + "_right.png"))
|
||||
RenderLayer.getEntitySolid(BetterEnd.makeID("textures/entity/chest/" + name + ".png")),
|
||||
RenderLayer.getEntitySolid(BetterEnd.makeID("textures/entity/chest/" + name + "_left.png")),
|
||||
RenderLayer.getEntitySolid(BetterEnd.makeID("textures/entity/chest/" + name + "_right.png"))
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ public class ESignBlockEntityRenderer extends BlockEntityRenderer<ESignBlockEnti
|
|||
Block block = ((BlockItem) item).getBlock();
|
||||
if (block instanceof BlockSign) {
|
||||
String name = Registry.BLOCK.getId(block).getPath();
|
||||
RenderLayer layer = RenderLayer.getEntitySolid(BetterEnd.getIdentifier("textures/entity/sign/" + name + ".png"));
|
||||
RenderLayer layer = RenderLayer.getEntitySolid(BetterEnd.makeID("textures/entity/sign/" + name + ".png"));
|
||||
LAYERS.put(Block.getRawIdFromState(block.getDefaultState()), layer);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import ru.betterend.BetterEnd;
|
|||
public class EndStoneSmelterScreen extends HandledScreen<EndStoneSmelterScreenHandler> implements RecipeBookProvider {
|
||||
|
||||
private final static Identifier RECIPE_BUTTON_TEXTURE = new Identifier("textures/gui/recipe_button.png");
|
||||
private final static Identifier BACKGROUND_TEXTURE = BetterEnd.getIdentifier("textures/gui/smelter_gui.png");
|
||||
private final static Identifier BACKGROUND_TEXTURE = BetterEnd.makeID("textures/gui/smelter_gui.png");
|
||||
|
||||
public final EndStoneSmelterRecipeBookScreen recipeBook;
|
||||
private boolean narrow;
|
||||
|
|
|
@ -28,7 +28,7 @@ import ru.betterend.recipe.AlloyingRecipe;
|
|||
public class EndStoneSmelterScreenHandler extends AbstractRecipeScreenHandler<Inventory> {
|
||||
|
||||
public final static ScreenHandlerType<EndStoneSmelterScreenHandler> HANDLER_TYPE = ScreenHandlerRegistry.registerSimple(
|
||||
BetterEnd.getIdentifier(EndStoneSmelter.ID), EndStoneSmelterScreenHandler::new);
|
||||
BetterEnd.makeID(EndStoneSmelter.ID), EndStoneSmelterScreenHandler::new);
|
||||
|
||||
private final Inventory inventory;
|
||||
private final PropertyDelegate propertyDelegate;
|
||||
|
|
|
@ -14,7 +14,7 @@ import ru.betterend.registry.BlockRegistry;
|
|||
@Environment(EnvType.CLIENT)
|
||||
public class REIPlugin implements REIPluginV0 {
|
||||
|
||||
public final static Identifier PLUGIN_ID = BetterEnd.getIdentifier("rei_plugin");
|
||||
public final static Identifier PLUGIN_ID = BetterEnd.makeID("rei_plugin");
|
||||
public final static EntryStack END_STONE_SMELTER = EntryStack.create(BlockRegistry.END_STONE_SMELTER);
|
||||
|
||||
@Override
|
||||
|
|
|
@ -33,10 +33,10 @@ import ru.betterend.util.MHelper;
|
|||
|
||||
@Mixin(WorldRenderer.class)
|
||||
public class WorldRendererMixin {
|
||||
private static final Identifier NEBULA_1 = BetterEnd.getIdentifier("textures/sky/nebula_2.png");
|
||||
private static final Identifier NEBULA_2 = BetterEnd.getIdentifier("textures/sky/nebula_3.png");
|
||||
private static final Identifier HORIZON = BetterEnd.getIdentifier("textures/sky/nebula_1.png");
|
||||
private static final Identifier FOG = BetterEnd.getIdentifier("textures/sky/fog.png");
|
||||
private static final Identifier NEBULA_1 = BetterEnd.makeID("textures/sky/nebula_2.png");
|
||||
private static final Identifier NEBULA_2 = BetterEnd.makeID("textures/sky/nebula_3.png");
|
||||
private static final Identifier HORIZON = BetterEnd.makeID("textures/sky/nebula_1.png");
|
||||
private static final Identifier FOG = BetterEnd.makeID("textures/sky/fog.png");
|
||||
|
||||
private static VertexBuffer stars1;
|
||||
private static VertexBuffer stars2;
|
||||
|
|
|
@ -28,7 +28,7 @@ public class AlloyingRecipe implements Recipe<Inventory> {
|
|||
public final static String GROUP = "alloying";
|
||||
public final static RecipeType<AlloyingRecipe> TYPE = EndRecipeManager.registerType(GROUP);
|
||||
public final static Serializer SERIALIZER = EndRecipeManager.registerSerializer(GROUP, new Serializer());
|
||||
public final static Identifier ID = BetterEnd.getIdentifier("alloying");
|
||||
public final static Identifier ID = BetterEnd.makeID("alloying");
|
||||
|
||||
protected final RecipeType<?> type;
|
||||
protected final Identifier id;
|
||||
|
@ -119,7 +119,7 @@ public class AlloyingRecipe implements Recipe<Inventory> {
|
|||
private final static Builder INSTANCE = new Builder();
|
||||
|
||||
public static Builder create(String id) {
|
||||
INSTANCE.id = BetterEnd.getIdentifier(id);
|
||||
INSTANCE.id = BetterEnd.makeID(id);
|
||||
INSTANCE.group = String.format("%s_%s", GROUP, id);
|
||||
INSTANCE.primaryInput = null;
|
||||
INSTANCE.secondaryInput = null;
|
||||
|
|
|
@ -65,7 +65,7 @@ public class EndRecipeManager {
|
|||
}
|
||||
|
||||
public static <T extends Recipe<?>> RecipeType<T> registerType(String type) {
|
||||
Identifier recipeTypeId = BetterEnd.getIdentifier(type);
|
||||
Identifier recipeTypeId = BetterEnd.makeID(type);
|
||||
return Registry.register(Registry.RECIPE_TYPE, recipeTypeId, new RecipeType<T>() {
|
||||
public String toString() {
|
||||
return type;
|
||||
|
|
|
@ -97,7 +97,7 @@ public class RecipeBuilder {
|
|||
int height = shape.length;
|
||||
int width = shape[0].length();
|
||||
ItemStack result = new ItemStack(output, count);
|
||||
Identifier id = BetterEnd.getIdentifier(name);
|
||||
Identifier id = BetterEnd.makeID(name);
|
||||
DefaultedList<Ingredient> materials = this.getMaterials(width, height);
|
||||
|
||||
CraftingRecipe recipe = shaped ? new ShapedRecipe(id, group, width, height, materials, result) : new ShapelessRecipe(id, group, result, materials);
|
||||
|
|
|
@ -30,7 +30,7 @@ public class BlockEntityRegistry {
|
|||
BlockEntityType.Builder.create(ESignBlockEntity::new, getSigns()));
|
||||
|
||||
public static <T extends BlockEntity> BlockEntityType<T> registerBlockEntity(String id, BlockEntityType.Builder<T> builder) {
|
||||
return Registry.register(Registry.BLOCK_ENTITY_TYPE, BetterEnd.getIdentifier(id), builder.build(null));
|
||||
return Registry.register(Registry.BLOCK_ENTITY_TYPE, BetterEnd.makeID(id), builder.build(null));
|
||||
}
|
||||
|
||||
public static void register() {}
|
||||
|
|
|
@ -68,12 +68,12 @@ public class BlockRegistry {
|
|||
public static void register() {}
|
||||
|
||||
public static Block registerBlock(String name, Block block) {
|
||||
Registry.register(Registry.BLOCK, BetterEnd.getIdentifier(name), block);
|
||||
Registry.register(Registry.BLOCK, BetterEnd.makeID(name), block);
|
||||
ItemRegistry.registerItem(name, new BlockItem(block, new Item.Settings().group(CreativeTab.END_TAB)));
|
||||
return block;
|
||||
}
|
||||
|
||||
public static Block registerBlockNI(String name, Block block) {
|
||||
return Registry.register(Registry.BLOCK, BetterEnd.getIdentifier(name), block);
|
||||
return Registry.register(Registry.BLOCK, BetterEnd.makeID(name), block);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ public class BlockTagRegistry {
|
|||
public static final Tag.Identified<Block> END_GROUND = makeTag("end_ground");
|
||||
|
||||
private static Tag.Identified<Block> makeTag(String name) {
|
||||
return (Identified<Block>) TagRegistry.block(BetterEnd.getIdentifier(name));
|
||||
return (Identified<Block>) TagRegistry.block(BetterEnd.makeID(name));
|
||||
}
|
||||
|
||||
public static void register() {
|
||||
|
|
|
@ -65,7 +65,7 @@ public class ItemRegistry {
|
|||
|
||||
protected static Item registerItem(String name, Item item) {
|
||||
if (item != Items.AIR) {
|
||||
Registry.register(Registry.ITEM, BetterEnd.getIdentifier(name), item);
|
||||
Registry.register(Registry.ITEM, BetterEnd.makeID(name), item);
|
||||
if (item instanceof BlockItem)
|
||||
MOD_BLOCKS.add(item);
|
||||
else
|
||||
|
@ -75,7 +75,7 @@ public class ItemRegistry {
|
|||
}
|
||||
|
||||
protected static ToolItem registerTool(String name, ToolItem item) {
|
||||
Registry.register(Registry.ITEM, BetterEnd.getIdentifier(name), item);
|
||||
Registry.register(Registry.ITEM, BetterEnd.makeID(name), item);
|
||||
MOD_ITEMS.add(item);
|
||||
|
||||
if (item instanceof ShovelItem) {
|
||||
|
|
|
@ -15,6 +15,6 @@ public class ParticleRegistry {
|
|||
}
|
||||
|
||||
private static DefaultParticleType register(String name) {
|
||||
return Registry.register(Registry.PARTICLE_TYPE, BetterEnd.getIdentifier(name), FabricParticleTypes.simple());
|
||||
return Registry.register(Registry.PARTICLE_TYPE, BetterEnd.makeID(name), FabricParticleTypes.simple());
|
||||
}
|
||||
}
|
||||
|
|
18
src/main/java/ru/betterend/registry/SoundsRegistry.java
Normal file
18
src/main/java/ru/betterend/registry/SoundsRegistry.java
Normal file
|
@ -0,0 +1,18 @@
|
|||
package ru.betterend.registry;
|
||||
|
||||
import net.minecraft.sound.SoundEvent;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import ru.betterend.BetterEnd;
|
||||
|
||||
public class SoundsRegistry
|
||||
{
|
||||
public static final SoundEvent AMBIENT_FOGGY_MUSHROOMLAND = registerAmbient("foggy_mushroomland");
|
||||
|
||||
public static void register() {}
|
||||
|
||||
private static SoundEvent registerAmbient(String id)
|
||||
{
|
||||
id = "betterend.ambient." + id;
|
||||
return Registry.register(Registry.SOUND_EVENT, id, new SoundEvent(BetterEnd.makeID(id)));
|
||||
}
|
||||
}
|
|
@ -9,7 +9,7 @@ import ru.betterend.registry.BlockRegistry;
|
|||
import ru.betterend.registry.ItemRegistry;
|
||||
|
||||
public class CreativeTab {
|
||||
public static final ItemGroup END_TAB = FabricItemGroupBuilder.create(BetterEnd.getIdentifier("items"))
|
||||
public static final ItemGroup END_TAB = FabricItemGroupBuilder.create(BetterEnd.makeID("items"))
|
||||
.icon(() -> new ItemStack(BlockRegistry.END_MYCELIUM)).appendItems(stacks -> {
|
||||
for (Item i : ItemRegistry.getModBlocks()) {
|
||||
stacks.add(new ItemStack(i));
|
||||
|
|
|
@ -57,7 +57,7 @@ public class BiomeDefinition {
|
|||
private ConfiguredSurfaceBuilder<?> surface;
|
||||
|
||||
public BiomeDefinition(String name) {
|
||||
this.id = BetterEnd.getIdentifier(name);
|
||||
this.id = BetterEnd.makeID(name);
|
||||
}
|
||||
|
||||
public BiomeDefinition setSurface(Block surfaceBlock) {
|
||||
|
|
|
@ -3,6 +3,7 @@ package ru.betterend.world.biome;
|
|||
import ru.betterend.registry.BlockRegistry;
|
||||
import ru.betterend.registry.FeatureRegistry;
|
||||
import ru.betterend.registry.ParticleRegistry;
|
||||
import ru.betterend.registry.SoundsRegistry;
|
||||
|
||||
public class BiomeFoggyMushroomland extends EndBiome {
|
||||
public BiomeFoggyMushroomland() {
|
||||
|
@ -13,6 +14,7 @@ public class BiomeFoggyMushroomland extends EndBiome {
|
|||
.setWaterFogColor(119, 227, 250)
|
||||
.setSurface(BlockRegistry.END_MOSS, BlockRegistry.END_MYCELIUM)
|
||||
.setParticles(ParticleRegistry.GLOWING_SPHERE, 0.001F)
|
||||
.setLoop(SoundsRegistry.AMBIENT_FOGGY_MUSHROOMLAND)
|
||||
.addFeature(FeatureRegistry.ENDER_ORE)
|
||||
.addFeature(FeatureRegistry.END_LAKE)
|
||||
.addFeature(FeatureRegistry.MOSSY_GLOWSHROOM)
|
||||
|
|
|
@ -27,21 +27,21 @@ public class EndFeature {
|
|||
private EndFeature() {}
|
||||
|
||||
public EndFeature(String name, Feature<DefaultFeatureConfig> feature, GenerationStep.Feature featureStep, ConfiguredFeature<?, ?> configuredFeature) {
|
||||
Identifier id = BetterEnd.getIdentifier(name);
|
||||
Identifier id = BetterEnd.makeID(name);
|
||||
this.featureStep = featureStep;
|
||||
this.feature = Registry.register(Registry.FEATURE, id, feature);
|
||||
this.featureConfigured = Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, id, configuredFeature);
|
||||
}
|
||||
|
||||
public EndFeature(String name, Feature<DefaultFeatureConfig> feature) {
|
||||
Identifier id = BetterEnd.getIdentifier(name);
|
||||
Identifier id = BetterEnd.makeID(name);
|
||||
this.featureStep = GenerationStep.Feature.VEGETAL_DECORATION;
|
||||
this.feature = Registry.register(Registry.FEATURE, id, feature);
|
||||
this.featureConfigured = Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, id, feature.configure(FeatureConfig.DEFAULT).decorate(Decorator.CHANCE.configure(new ChanceDecoratorConfig(100))));
|
||||
}
|
||||
|
||||
public EndFeature(String name, Feature<DefaultFeatureConfig> feature, int density) {
|
||||
Identifier id = BetterEnd.getIdentifier(name);
|
||||
Identifier id = BetterEnd.makeID(name);
|
||||
this.featureStep = GenerationStep.Feature.VEGETAL_DECORATION;
|
||||
this.feature = Registry.register(Registry.FEATURE, id, feature);
|
||||
this.featureConfigured = Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, id, feature.configure(FeatureConfig.DEFAULT).decorate(ConfiguredFeatures.Decorators.SQUARE_HEIGHTMAP).repeatRandomly(density));
|
||||
|
@ -68,7 +68,7 @@ public class EndFeature {
|
|||
.repeat(veins);
|
||||
newFeature.feature = Feature.ORE;
|
||||
newFeature.featureStep = GenerationStep.Feature.UNDERGROUND_ORES;
|
||||
newFeature.featureConfigured = Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, BetterEnd.getIdentifier(name), oreFeature);
|
||||
newFeature.featureConfigured = Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, BetterEnd.makeID(name), oreFeature);
|
||||
|
||||
return newFeature;
|
||||
}
|
||||
|
|
|
@ -75,6 +75,6 @@ public class BetterEndBiomeSource extends BiomeSource {
|
|||
}
|
||||
|
||||
public static void register() {
|
||||
Registry.register(Registry.BIOME_SOURCE, BetterEnd.getIdentifier("better_end_biome_source"), CODEC);
|
||||
Registry.register(Registry.BIOME_SOURCE, BetterEnd.makeID("better_end_biome_source"), CODEC);
|
||||
}
|
||||
}
|
||||
|
|
11
src/main/resources/assets/betterend/sounds.json
Normal file
11
src/main/resources/assets/betterend/sounds.json
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"betterend.ambient.foggy_mushroomland": {
|
||||
"category": "ambient",
|
||||
"sounds": [
|
||||
{
|
||||
"name": "betterend:ambient/foggy_mushroomland",
|
||||
"stream": false
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 561 B After Width: | Height: | Size: 1.9 KiB |
Loading…
Add table
Add a link
Reference in a new issue