Add lightbulb item for fixing lightbulb lamp

This commit is contained in:
Andrew-71 2023-08-06 23:32:19 +03:00
parent 8b1bc49709
commit cd0ba2f0e2
7 changed files with 22 additions and 17 deletions

View file

@ -1,13 +1,5 @@
Ideas for block functionality Ideas for block functionality
Radio: Inventory where you can put music disks, and a UI to play, shuffle (and pause?) them. Like a jukebox on steroids Radio: Like a jukebox on steroids. Maybe container for disks, maybe a way to connect to real radio. Who knows.
TV: CC compatible peripheral which combines a speaker and an 8x8 monitor TV: CC compatible peripheral which combines a speaker and an 8x8 monitor
Crate: Inventory, like a barrel but smaller Crate: Like a shulker box but much smaller (but cheaper!)
Air Raid Siren: when powered (?), plays chosen frequency in chosen way at chosen sound. CC Peripheral attached
Lamp: Both bedside and ceiling are one block, Lamp, that functions sort of like a lantern
Landmine:
попали -> кабум
тронули не лопатой -> кабум 80%
тронули лопатой(сломали) -> 25% кабум
обезвредили лопатой (ПКМ задержать) -> не кабум

View file

@ -26,6 +26,7 @@ import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView; import net.minecraft.world.WorldView;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import su.a71.new_soviet.registration.NSE_Custom; import su.a71.new_soviet.registration.NSE_Custom;
import su.a71.new_soviet.registration.NSE_Items;
public class LightBulbBlock extends Block implements Waterloggable { public class LightBulbBlock extends Block implements Waterloggable {
protected static final VoxelShape SHAPE; protected static final VoxelShape SHAPE;
@ -69,9 +70,12 @@ public class LightBulbBlock extends Block implements Waterloggable {
@Override @Override
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
// if (!world.isClient && !state.get(BROKEN)) { if (!world.isClient && state.get(BROKEN) && player.getInventory().getMainHandStack().getItem() == NSE_Items.LIGHT_BULB) {
// world.setBlockState(pos, (BlockState)state.with(ON, !state.get(ON)), 1); if (!player.isCreative())
// } player.getInventory().getMainHandStack().decrement(1);
world.setBlockState(pos, (BlockState)state.with(BROKEN, false)
.with(ON, world.isReceivingRedstonePower(pos)), 2);
}
return super.onUse(state, world, pos, player, hand, hit); return super.onUse(state, world, pos, player, hand, hit);
} }

View file

@ -29,7 +29,7 @@ public class NSE_Custom {
public static final TVBlock BROWN_TV = new TVBlock(FabricBlockSettings.create().mapColor(MapColor.TERRACOTTA_BROWN)); public static final TVBlock BROWN_TV = new TVBlock(FabricBlockSettings.create().mapColor(MapColor.TERRACOTTA_BROWN));
public static final RadioBlock RADIO = new RadioBlock(); public static final RadioBlock RADIO = new RadioBlock();
public static final LampBlock LAMP = new LampBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.LANTERN).strength(1f, 1.5f).mapColor(MapColor.WHITE)); public static final LampBlock LAMP = new LampBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.LANTERN).strength(1f, 1.5f).mapColor(MapColor.WHITE));
public static final LightBulbBlock LIGHT_BULB = new LightBulbBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.LANTERN).strength(1f, 1.5f).mapColor(MapColor.WHITE)); public static final LightBulbBlock LIGHT_BULB = new LightBulbBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.GLASS).strength(1f, 1.5f).mapColor(MapColor.WHITE));
public static final SoundEvent LIGHT_BULB_BROKEN_SOUND = SoundEvent.of(new Identifier("new_soviet", "light_bulb_broken_sound")); public static final SoundEvent LIGHT_BULB_BROKEN_SOUND = SoundEvent.of(new Identifier("new_soviet", "light_bulb_broken_sound"));
public static final CeilingFanBlock CEILING_FAN = new CeilingFanBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.METAL).strength(1f, 1.5f).mapColor(MapColor.WHITE)); public static final CeilingFanBlock CEILING_FAN = new CeilingFanBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.METAL).strength(1f, 1.5f).mapColor(MapColor.WHITE));

View file

@ -28,16 +28,16 @@ public class NSE_Items {
// Like an iron axe but a hoe and slightly faster (-2.8f vs -3.1f) and a bit weaker (6 vs 6.5 damage) // Like an iron axe but a hoe and slightly faster (-2.8f vs -3.1f) and a bit weaker (6 vs 6.5 damage)
public static final ToolItem SICKLE = new HoeItem(ToolMaterials.IRON, 6, -2.8F, new Item.Settings()); public static final ToolItem SICKLE = new HoeItem(ToolMaterials.IRON, 6, -2.8F, new Item.Settings());
// TODO: Currently same as golden apple
public static final FoodComponent COCONUT_FC = (new FoodComponent.Builder()).hunger(4).saturationModifier(1.2F).statusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 100, 1), 1.0F).statusEffect(new StatusEffectInstance(StatusEffects.ABSORPTION, 2400, 0), 1.0F).alwaysEdible().build(); public static final FoodComponent COCONUT_FC = (new FoodComponent.Builder()).hunger(4).saturationModifier(1.2F).statusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 100, 1), 1.0F).statusEffect(new StatusEffectInstance(StatusEffects.ABSORPTION, 2400, 0), 1.0F).alwaysEdible().build();
public static final Item COCONUT = new Item(new Item.Settings().food(COCONUT_FC).rarity(Rarity.EPIC)); public static final Item COCONUT = new Item(new Item.Settings().food(COCONUT_FC).rarity(Rarity.EPIC));
public static final DiceItem DICE_D6 = new DiceItem(new Item.Settings().maxCount(6)); public static final DiceItem DICE_D6 = new DiceItem(new Item.Settings().maxCount(6));
public static final DiceD4Item DICE_D4 = new DiceD4Item(new Item.Settings().maxCount(6)); public static final DiceD4Item DICE_D4 = new DiceD4Item(new Item.Settings().maxCount(6));
public static final DiceD20Item DICE_D20 = new DiceD20Item(new Item.Settings().maxCount(6)); public static final DiceD20Item DICE_D20 = new DiceD20Item(new Item.Settings().maxCount(6));
public static final SoundEvent DICE_SOUND = SoundEvent.of(new Identifier("new_soviet", "dice_sound")); public static final SoundEvent DICE_SOUND = SoundEvent.of(new Identifier("new_soviet", "dice_sound"));
public static final Item LIGHT_BULB = new Item(new Item.Settings());
private static final ItemGroup NSE_ITEMS_TAB = FabricItemGroup.builder() private static final ItemGroup NSE_ITEMS_TAB = FabricItemGroup.builder()
.icon(() -> new ItemStack(SICKLE)) .icon(() -> new ItemStack(SICKLE))
.displayName(Text.translatable("itemGroup.new_soviet.items")) .displayName(Text.translatable("itemGroup.new_soviet.items"))
@ -60,6 +60,7 @@ public class NSE_Items {
register("dice_d6", () -> DICE_D6, NSE_ITEMS_TAB); register("dice_d6", () -> DICE_D6, NSE_ITEMS_TAB);
register("dice_d4", () -> DICE_D4, NSE_ITEMS_TAB); register("dice_d4", () -> DICE_D4, NSE_ITEMS_TAB);
register("dice_d20", () -> DICE_D20, NSE_ITEMS_TAB); register("dice_d20", () -> DICE_D20, NSE_ITEMS_TAB);
register("light_bulb_item", () -> LIGHT_BULB, NSE_ITEMS_TAB);
Registry.register(Registries.SOUND_EVENT, new Identifier("new_soviet", "dice_sound"), DICE_SOUND); Registry.register(Registries.SOUND_EVENT, new Identifier("new_soviet", "dice_sound"), DICE_SOUND);
} }

View file

@ -150,5 +150,6 @@
"block.new_soviet.blue_concrete_with_bars": "Blue Concrete With Bars", "block.new_soviet.blue_concrete_with_bars": "Blue Concrete With Bars",
"block.new_soviet.red_concrete_with_bars": "Red Concrete With Bars", "block.new_soviet.red_concrete_with_bars": "Red Concrete With Bars",
"subtitles.new_soviet.light_bulb_broken": "Light bulb breaks", "subtitles.new_soviet.light_bulb_broken": "Light bulb breaks",
"block.new_soviet.light_bulb": "Light Bulb" "block.new_soviet.light_bulb": "Light Bulb Lamp",
"item.new_soviet.light_bulb_item": "Light Bulb"
} }

View file

@ -0,0 +1,7 @@
{
"credit": "Karoter2",
"parent": "item/generated",
"textures": {
"layer0": "new_soviet:item/bulb"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 B