Skip to content

Commit

Permalink
Fixed Bug: Lamp does not make sound upon interaction
Browse files Browse the repository at this point in the history
Changed Brazier Item Textures
  • Loading branch information
aqariio committed Sep 4, 2022
1 parent 43e906a commit 515eb56
Show file tree
Hide file tree
Showing 112 changed files with 24 additions and 88 deletions.
4 changes: 3 additions & 1 deletion src/main/java/aqario/twigs/block/BrazierBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEnt
world.playSound(player, pos, SoundEvents.ITEM_FIRECHARGE_USE, SoundCategory.BLOCKS, 1.0f, (random.nextFloat() - random.nextFloat()) * 0.2f + 1.0f);
world.emitGameEvent(player, GameEvent.BLOCK_PLACE, pos);
world.setBlockState(pos, state.with(LIT, true), Block.NOTIFY_ALL | Block.REDRAW_ON_MAIN_THREAD);
context.getStack().decrement(1);
if (!player.isCreative()) {
context.getStack().decrement(1);
}
return ActionResult.SUCCESS;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/aqario/twigs/block/LampBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ public class LampBlock extends Block {

public LampBlock(AbstractBlock.Settings settings) {
super(settings);
this.setDefaultState((BlockState)this.getDefaultState().with(LIT, true));
this.setDefaultState(this.getDefaultState().with(LIT, true));
}

@Override
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
if (!world.isClient) {
boolean currentState = state.get(LIT);
world.setBlockState(pos, state.with(LIT, !currentState), Block.NOTIFY_ALL);
world.playSound(null, pos, currentState ? TwigsSoundEvents.BLOCK_LAMP_EXTINGUISH : TwigsSoundEvents.BLOCK_LAMP_LIGHT, SoundCategory.PLAYERS, 0.3f, 2.0f);
world.playSound(null, pos, currentState ? TwigsSoundEvents.BLOCK_LAMP_EXTINGUISH : TwigsSoundEvents.BLOCK_LAMP_LIGHT, SoundCategory.BLOCKS, 0.3f, 2.0f);
}
return ActionResult.SUCCESS;
}
Expand Down
10 changes: 8 additions & 2 deletions src/main/java/aqario/twigs/sound/TwigsSoundEvents.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@
import aqario.twigs.Twigs;
import net.minecraft.sound.SoundEvent;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;

public class TwigsSoundEvents {

public static SoundEvent BLOCK_LAMP_LIGHT = new SoundEvent(new Identifier(Twigs.MODID, "block.lamp.light"));
public static SoundEvent BLOCK_LAMP_EXTINGUISH = new SoundEvent(new Identifier(Twigs.MODID, "block.lamp.extinguish"));
public static final SoundEvent BLOCK_LAMP_LIGHT = new SoundEvent(new Identifier(Twigs.MODID, "block.lamp.light"));
public static final SoundEvent BLOCK_LAMP_EXTINGUISH = new SoundEvent(new Identifier(Twigs.MODID, "block.lamp.extinguish"));
// TwigsSoundEvents.register("block.lamp.extinguish");

// private static SoundEvent register(String id) {
// Identifier identifier = new Identifier(Twigs.MODID, id);
// return Registry.register(Registry.SOUND_EVENT, identifier, new SoundEvent(identifier));
// }
}
73 changes: 3 additions & 70 deletions src/main/resources/assets/twigs/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,9 @@
{
"mod.twigs.name": "Twigs",

"subtitles.block.twigs.lamp.light": "Lamp lit",
"subtitles.block.twigs.lamp.extinguish": "Lamp extinguished",
"subtitles.twigs.block.lamp.light": "Lamp lit",
"subtitles.twigs.block.lamp.extinguish": "Lamp extinguished",

"entity.twigs.boat": "Boat",

"block.twigs.azalea_flowers": "Azalea Flowers",
"block.twigs.oak_table": "Oak Table",
"block.twigs.spruce_table": "Spruce Table",
"block.twigs.birch_table": "Birch Table",
"block.twigs.acacia_table": "Acacia Table",
"block.twigs.jungle_table": "Jungle Table",
"block.twigs.dark_oak_table": "Dark Oak Table",
"block.twigs.crimson_table": "Crimson Table",
"block.twigs.warped_table": "Warped Table",
"block.twigs.stripped_bamboo_table": "Stripped Bamboo Table",
"block.twigs.bamboo_leaves": "Bamboo Leaves",
"block.twigs.stripped_bundled_bamboo": "Stripped Bundled Bamboo",
"block.twigs.bundled_bamboo": "Bundled Bamboo",
"block.twigs.stripped_bamboo_mat": "Stripped Bamboo Mat",
"block.twigs.bamboo_thatch": "Bamboo Thatch",
"block.twigs.bamboo_thatch_wall": "Bamboo Thatch Wall",
"block.twigs.bamboo_thatch_slab": "Bamboo Thatch Slab",
"block.twigs.bamboo_thatch_stairs": "Bamboo Thatch Stairs",
"block.twigs.tuff_wall": "Tuff Wall",
"block.twigs.tuff_slab": "Tuff Slab",
"block.twigs.tuff_stairs": "Tuff Stairs",
Expand All @@ -46,20 +26,7 @@
"block.twigs.polished_calcite_brick_slab": "Polished Calcite Brick Slab",
"block.twigs.polished_calcite_brick_stairs": "Polished Calcite Brick Stairs",
"block.twigs.calcite_stairs": "Calcite Stairs",
"block.twigs.stripped_bamboo": "Stripped Bamboo",
"block.twigs.stripped_bamboo_planks": "Stripped Bamboo Planks",
"block.twigs.stripped_bamboo_door": "Stripped Bamboo Door",
"block.twigs.stripped_bamboo_trapdoor": "Stripped Bamboo Trapdoor",
"block.twigs.stripped_bamboo_slab": "Stripped Bamboo Slab",
"block.twigs.stripped_bamboo_stairs": "Stripped Bamboo Stairs",
"block.twigs.stripped_bamboo_pressure_plate": "Stripped Bamboo Pressure Plate",
"block.twigs.stripped_bamboo_button": "Stripped Bamboo Button",
"block.twigs.stripped_bamboo_fence": "Stripped Bamboo Fence",
"block.twigs.stripped_bamboo_fence_gate": "Stripped Bamboo Fence Gate",
"item.twigs.stripped_bamboo_boat": "Stripped Bamboo Boat",
"block.twigs.rocky_dirt": "Rocky Dirt",
"block.twigs.crimson_shroomlamp": "Crimson Shroomlamp",
"block.twigs.warped_shroomlamp": "Warped Shroomlamp",
"block.twigs.lamp": "Lamp",
"block.twigs.soul_lamp": "Soul Lamp",
"block.twigs.brazier": "Brazier",
Expand All @@ -73,15 +40,10 @@
"block.twigs.blue_orchid_paper_lantern": "Decorated Paper Lantern",
"block.twigs.red_paper_lantern": "Red Paper Lantern",
"block.twigs.chiseled_bricks": "Chiseled Bricks",
"block.twigs.polished_basalt_bricks": "Polished Basalt Bricks",
"block.twigs.mossy_bricks": "Mossy Bricks",
"block.twigs.mossy_brick_stairs": "Mossy Brick Stairs",
"block.twigs.mossy_brick_slab": "Mossy Brick Slab",
"block.twigs.mossy_brick_wall": "Mossy Brick Wall",
"block.twigs.smooth_basalt_bricks": "Smooth Basalt Bricks",
"block.twigs.smooth_basalt_brick_stairs": "Smooth Basalt Brick Stairs",
"block.twigs.smooth_basalt_brick_slab": "Smooth Basalt Brick Slab",
"block.twigs.smooth_basalt_brick_wall": "Smooth Basalt Brick Wall",
"block.twigs.cracked_bricks": "Cracked Bricks",
"block.twigs.mossy_cobblestone_bricks": "Mossy Cobblestone Bricks",
"block.twigs.mossy_cobblestone_brick_stairs": "Mossy Cobblestone Brick Stairs",
Expand All @@ -91,34 +53,5 @@
"block.twigs.cobblestone_brick_stairs": "Cobblestone Brick Stairs",
"block.twigs.cobblestone_brick_slab": "Cobblestone Brick Slab",
"block.twigs.cobblestone_brick_wall": "Cobblestone Brick Wall",
"block.twigs.cracked_cobblestone_bricks": "Cracked Cobblestone Bricks",
"block.twigs.polished_amethyst": "Polished Amethyst",
"block.twigs.chiseled_polished_amethyst": "Chiseled Polished Amethyst",
"block.twigs.polished_amethyst_slab": "Polished Amethyst Slab",
"block.twigs.polished_amethyst_stairs": "Polished Amethyst Stairs",
"block.twigs.polished_amethyst_bricks": "Polished Amethyst Bricks",
"block.twigs.cracked_polished_amethyst_bricks": "Cracked Polished Amethyst Bricks",
"block.twigs.polished_amethyst_brick_wall": "Polished Amethyst Brick Wall",
"block.twigs.polished_amethyst_brick_slab": "Polished Amethyst Brick Slab",
"block.twigs.polished_amethyst_brick_stairs": "Polished Amethyst Brick Stairs",
"block.twigs.weeping_polished_blackstone_bricks": "Weeping Polished Blackstone Bricks",
"block.twigs.weeping_polished_blackstone_brick_wall": "Weeping Polished Blackstone Brick Wall",
"block.twigs.weeping_polished_blackstone_brick_slab": "Weeping Polished Blackstone Brick Slab",
"block.twigs.weeping_polished_blackstone_brick_stairs": "Weeping Polished Blackstone Brick Stairs",
"block.twigs.twisting_polished_blackstone_bricks": "Twisting Polished Blackstone Bricks",
"block.twigs.twisting_polished_blackstone_brick_wall": "Twisting Polished Blackstone Brick Wall",
"block.twigs.twisting_polished_blackstone_brick_slab": "Twisting Polished Blackstone Brick Slab",
"block.twigs.twisting_polished_blackstone_brick_stairs": "Twisting Polished Blackstone Brick Stairs",
"block.twigs.twig": "Twig",
"block.twigs.pebble": "Pebble",
"block.twigs.sea_shell": "Sea Shell",
"block.twigs.stripped_bamboo_sign": "Stripped Bamboo Sign",
"block.twigs.copper_pillar": "Copper Pillar",
"block.twigs.exposed_copper_pillar": "Exposed Copper Pillar",
"block.twigs.weathered_copper_pillar": "Weathered Copper Pillar",
"block.twigs.oxidized_copper_pillar": "Oxidized Copper Pillar",
"block.twigs.waxed_copper_pillar": "Waxed Copper Pillar",
"block.twigs.waxed_exposed_copper_pillar": "Waxed Exposed Copper Pillar",
"block.twigs.waxed_weathered_copper_pillar": "Waxed Weathered Copper Pillar",
"block.twigs.waxed_oxidized_copper_pillar": "Waxed Oxidized Copper Pillar"
"block.twigs.cracked_cobblestone_bricks": "Cracked Cobblestone Bricks"
}
21 changes: 8 additions & 13 deletions src/main/resources/assets/twigs/sounds.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
{
"block.lamp.light": {
"sounds": [ "minecraft:mob/ghast/fireball4" ],
"subtitle": "subtitles.block.twigs.lamp.light"
"subtitle": "subtitles.twigs.block.lamp.light",
"sounds": [
"minecraft:mob/ghast/fireball4"
]
},
"block.lamp.extinguish": {
"sounds": [ "minecraft:random/fizz" ],
"subtitle": "subtitles.block.twigs.lamp.extinguish"
},

"block.flowering_azalea.shear": {
"sounds": [ "mob/sheep/shear" ],
"subtitle": "subtitles.item.shears.shear"
},
"block.bamboo.strip_shear": {
"sounds": [ "mob/sheep/shear" ],
"subtitle": "subtitles.item.shears.shear"
"subtitle": "subtitles.twigs.block.lamp.extinguish",
"sounds": [
"minecraft:random/fizz"
]
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified src/main/resources/assets/twigs/textures/block/brazier_fire.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file removed src/main/resources/assets/twigs/textures/block/twig.png
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file modified src/main/resources/assets/twigs/textures/item/brazier.png
Diff not rendered.
Diff not rendered.
Binary file modified src/main/resources/assets/twigs/textures/item/soul_brazier.png
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file removed src/main/resources/assets/twigs/textures/item/twig.png
Diff not rendered.

0 comments on commit 515eb56

Please sign in to comment.