Integrate screwdriver

This commit is contained in:
Andrew-71 2024-03-07 12:23:21 +03:00
parent 1b290d9169
commit 8f1af13933
6 changed files with 81 additions and 1 deletions

View file

@ -65,9 +65,10 @@ Due to sheer amount of changes, some may be undocumented. We hope you enjoy this
* Star
* Grain
* Added USSR anthem music disc
* Added a new screwdriver tool for tinkering with blocks
* Added a new antenna item to improve radio electronics recipes
* Parquet improvements
* Separated oak and dark oak parquet in naming
* Separated oak and dark oak parquet
* Added a few new types
* Siren improvements
* Now uses screwdriver to change sound

View file

@ -0,0 +1,48 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_iron_ingot": {
"conditions": {
"items": [
{
"items": [
"minecraft:iron_ingot"
]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_stick": {
"conditions": {
"items": [
{
"items": [
"minecraft:stick"
]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "new_soviet:screwdriver"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_iron_ingot",
"has_stick",
"has_the_recipe"
]
],
"rewards": {
"recipes": [
"new_soviet:screwdriver"
]
},
"sends_telemetry_event": false
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:crafting_shaped",
"category": "equipment",
"key": {
"I": {
"item": "minecraft:iron_ingot"
},
"S": {
"item": "minecraft:stick"
}
},
"pattern": [
"I",
"S"
],
"result": {
"item": "new_soviet:screwdriver"
},
"show_notification": true
}

View file

@ -13,6 +13,7 @@ import net.minecraft.server.world.ServerWorld;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvent;
import net.minecraft.stat.Stats;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.property.IntProperty;
@ -88,6 +89,7 @@ public class SirenBlock extends HorizontalFacingBlock implements Waterloggable {
world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), NSE_Sounds.SCREWDRIVER_SOUND, SoundCategory.BLOCKS, 1.0f, (float) NewSoviet.RANDOM.nextBetween(8, 11) / 10);
player.sendMessage(Text.translatable("block.new_soviet.siren.set").append(Text.translatable("block.new_soviet.siren.sound." + SIREN_SOUNDS.get(world.getBlockState(pos).get(SOUND_INDEX)).translation_key()).formatted(Formatting.YELLOW)), true);
player.incrementStat(Stats.USED.getOrCreateStat(NSE_Items.SCREWDRIVER));
return ActionResult.SUCCESS;
}
return super.onUse(state, world, pos, player, hand, hit);

View file

@ -12,6 +12,7 @@ import net.minecraft.item.ItemPlacementContext;
import net.minecraft.item.ItemStack;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
import net.minecraft.stat.Stats;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.property.EnumProperty;
@ -86,6 +87,7 @@ public class WindowBlock extends HorizontalFacingBlock {
player.sendMessage(Text.translatable("block.new_soviet.window.unfixed").formatted(Formatting.BOLD), true);
}
world.setBlockState(pos, state.with(CLOSED, !state.get(CLOSED)), 2);
player.incrementStat(Stats.USED.getOrCreateStat(NSE_Items.SCREWDRIVER));
return ActionResult.SUCCESS;
}
return super.onUse(state, world, pos, player, hand, hit);

View file

@ -906,5 +906,12 @@ public class RecipeGenerator extends FabricRecipeProvider {
List.of(NSE_Blocks.GREEN_LINOLEUM.asItem(), NSE_Blocks.ORANGE_LINOLEUM.asItem(), NSE_Blocks.BLUE_LINOLEUM.asItem(),
NSE_Blocks.RED_LINOLEUM.asItem(), NSE_Blocks.GRAY_LINOLEUM.asItem(), NSE_Blocks.BROWN_LINOLEUM.asItem(), NSE_Blocks.CYAN_LINOLEUM.asItem()),
"linoleum");
ShapedRecipeJsonBuilder.create(RecipeCategory.TOOLS, NSE_Items.SCREWDRIVER, 1)
.input('I', Items.IRON_INGOT).input('S', Items.STICK)
.pattern("I").pattern("S")
.criterion(hasItem(Items.IRON_INGOT), conditionsFromItem(Items.IRON_INGOT))
.criterion(hasItem(Items.STICK), conditionsFromItem(Items.STICK))
.offerTo(exporter);
}
}