diff --git a/src/main/java/su/a71/new_soviet/blocks/CeilingFanBlock.java b/src/main/java/su/a71/new_soviet/blocks/CeilingFanBlock.java index 16f8838..1de6289 100644 --- a/src/main/java/su/a71/new_soviet/blocks/CeilingFanBlock.java +++ b/src/main/java/su/a71/new_soviet/blocks/CeilingFanBlock.java @@ -1,13 +1,10 @@ package su.a71.new_soviet.blocks; import net.minecraft.block.*; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; import net.minecraft.item.ItemPlacementContext; import net.minecraft.server.world.ServerWorld; import net.minecraft.state.StateManager; import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.Properties; import net.minecraft.state.property.Property; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; @@ -16,29 +13,25 @@ import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShapes; import net.minecraft.world.BlockView; import net.minecraft.world.World; -import net.minecraft.world.WorldAccess; import net.minecraft.world.WorldView; import net.minecraft.block.RedstoneLampBlock; import net.minecraft.block.TorchBlock; import org.jetbrains.annotations.Nullable; -public class CeilingFanBlock extends Block implements Waterloggable { +public class CeilingFanBlock extends Block { protected static final VoxelShape SHAPE; public static final BooleanProperty ON; - public static final BooleanProperty WATERLOGGED; public CeilingFanBlock(Block.Settings settings) { super(settings); - this.setDefaultState((BlockState)this.getDefaultState().with(ON, false).with(WATERLOGGED, false)); + this.setDefaultState((BlockState)this.getDefaultState().with(ON, false)); } @Nullable public BlockState getPlacementState(ItemPlacementContext ctx) { - return (BlockState)this.getDefaultState() - .with(ON, ctx.getWorld().isReceivingRedstonePower(ctx.getBlockPos())) - .with(WATERLOGGED, ctx.getWorld().getFluidState(ctx.getBlockPos()).getFluid() == Fluids.WATER); + return (BlockState)this.getDefaultState().with(ON, ctx.getWorld().isReceivingRedstonePower(ctx.getBlockPos())); } public void neighborUpdate(BlockState state, World world, BlockPos pos, Block sourceBlock, BlockPos sourcePos, boolean notify) { @@ -51,15 +44,8 @@ public class CeilingFanBlock extends Block implements Waterloggable { world.setBlockState(pos, (BlockState)state.cycle(ON), 2); } } - } - } - @Override - public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) { - if (state.get(WATERLOGGED)) { - world.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); } - return direction == Direction.UP && !state.canPlaceAt(world, pos) ? Blocks.AIR.getDefaultState() : super.getStateForNeighborUpdate(state, direction, neighborState, world, pos, neighborPos); } public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { @@ -69,17 +55,13 @@ public class CeilingFanBlock extends Block implements Waterloggable { } protected void appendProperties(StateManager.Builder builder) { - builder.add(new Property[]{ON, WATERLOGGED}); + builder.add(new Property[]{ON}); } public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { return SHAPE; } - public FluidState getFluidState(BlockState state) { - return state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state); - } - public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { Direction direction = Direction.UP; return Block.sideCoversSmallSquare(world, pos.offset(direction), direction.getOpposite()); @@ -88,6 +70,5 @@ public class CeilingFanBlock extends Block implements Waterloggable { static { SHAPE = VoxelShapes.union(Block.createCuboidShape(4.0, 2.0, 4.0, 12.0, 7.0, 12.0), Block.createCuboidShape(7.0, 7.0, 7.0, 9.0, 13.0, 9.0), Block.createCuboidShape(6.0, 13.0, 6.0, 10.0, 16.0, 10.0)); ON = RedstoneTorchBlock.LIT; - WATERLOGGED = Properties.WATERLOGGED; } } \ No newline at end of file diff --git a/src/main/java/su/a71/new_soviet/blocks/FUNC_IDEAS b/src/main/java/su/a71/new_soviet/blocks/FUNC_IDEAS index 43672b2..674942b 100644 --- a/src/main/java/su/a71/new_soviet/blocks/FUNC_IDEAS +++ b/src/main/java/su/a71/new_soviet/blocks/FUNC_IDEAS @@ -1,5 +1,13 @@ Ideas for block functionality -Radio: Like a jukebox on steroids. Maybe container for disks, maybe a way to connect to real radio. Who knows. +Radio: Inventory where you can put music disks, and a UI to play, shuffle (and pause?) them. Like a jukebox on steroids TV: CC compatible peripheral which combines a speaker and an 8x8 monitor -Crate: Like a shulker box but much smaller (but cheaper!) \ No newline at end of file +Crate: Inventory, like a barrel but smaller +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% кабум +обезвредили лопатой (ПКМ задержать) -> не кабум \ No newline at end of file diff --git a/src/main/java/su/a71/new_soviet/blocks/LightBulbBlock.java b/src/main/java/su/a71/new_soviet/blocks/LightBulbBlock.java index 85307c5..7e28816 100644 --- a/src/main/java/su/a71/new_soviet/blocks/LightBulbBlock.java +++ b/src/main/java/su/a71/new_soviet/blocks/LightBulbBlock.java @@ -3,8 +3,6 @@ package su.a71.new_soviet.blocks; import net.minecraft.block.*; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.projectile.ProjectileEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; import net.minecraft.item.ItemPlacementContext; import net.minecraft.server.world.ServerWorld; import net.minecraft.sound.SoundCategory; @@ -12,8 +10,6 @@ import net.minecraft.state.StateManager; import net.minecraft.state.property.BooleanProperty; import net.minecraft.state.property.Properties; import net.minecraft.state.property.Property; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; @@ -22,29 +18,23 @@ import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShapes; import net.minecraft.world.BlockView; import net.minecraft.world.World; -import net.minecraft.world.WorldAccess; import net.minecraft.world.WorldView; import org.jetbrains.annotations.Nullable; 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 { protected static final VoxelShape SHAPE; public static final BooleanProperty ON; public static final BooleanProperty BROKEN; - public static final BooleanProperty WATERLOGGED; public LightBulbBlock(Block.Settings settings) { - super(settings.luminance((BlockState state) -> state.get(ON) && !state.get(BROKEN) ? 12 : 0)); - this.setDefaultState((BlockState)this.getDefaultState().with(ON, false).with(BROKEN, false).with(WATERLOGGED, false)); + super(settings); + this.setDefaultState((BlockState)this.getDefaultState().with(ON, false).with(BROKEN, false)); } @Nullable public BlockState getPlacementState(ItemPlacementContext ctx) { - return (BlockState)this.getDefaultState() - .with(ON, ctx.getWorld().isReceivingRedstonePower(ctx.getBlockPos())) - .with(BROKEN, false) - .with(WATERLOGGED, ctx.getWorld().getFluidState(ctx.getBlockPos()).getFluid() == Fluids.WATER); + return (BlockState)this.getDefaultState().with(ON, ctx.getWorld().isReceivingRedstonePower(ctx.getBlockPos())).with(BROKEN, false); } public void neighborUpdate(BlockState state, World world, BlockPos pos, Block sourceBlock, BlockPos sourcePos, boolean notify) { @@ -60,25 +50,6 @@ public class LightBulbBlock extends Block implements Waterloggable { } } - @Override - public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) { - if (state.get(WATERLOGGED)) { - world.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); - } - return direction == Direction.UP && !state.canPlaceAt(world, pos) ? Blocks.AIR.getDefaultState() : super.getStateForNeighborUpdate(state, direction, neighborState, world, pos, neighborPos); - } - - @Override - public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { - if (!world.isClient && state.get(BROKEN) && player.getInventory().getMainHandStack().getItem() == NSE_Items.LIGHT_BULB) { - 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); - } - @Override public void onProjectileHit(World world, BlockState state, BlockHitResult hit, ProjectileEntity projectile) { if (!state.get(BROKEN)) { @@ -95,11 +66,7 @@ public class LightBulbBlock extends Block implements Waterloggable { } protected void appendProperties(StateManager.Builder builder) { - builder.add(new Property[]{ON, BROKEN, WATERLOGGED}); - } - - public FluidState getFluidState(BlockState state) { - return state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state); + builder.add(new Property[]{ON, BROKEN}); } public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { @@ -119,6 +86,5 @@ public class LightBulbBlock extends Block implements Waterloggable { SHAPE = VoxelShapes.union(Block.createCuboidShape(7, 15, 7, 9, 16, 9), Block.createCuboidShape(7, 6, 7, 9, 8, 9)); //VoxelShapes.union(Block.createCuboidShape(4.0, 2.0, 4.0, 12.0, 7.0, 12.0), Block.createCuboidShape(7.0, 7.0, 7.0, 9.0, 13.0, 9.0), Block.createCuboidShape(6.0, 13.0, 6.0, 10.0, 16.0, 10.0)); ON = RedstoneTorchBlock.LIT; BROKEN = Properties.CRACKED; - WATERLOGGED = Properties.WATERLOGGED; } } \ No newline at end of file diff --git a/src/main/java/su/a71/new_soviet/blocks/SirenBlock.java b/src/main/java/su/a71/new_soviet/blocks/SirenBlock.java index 9d87d0d..9b6a378 100644 --- a/src/main/java/su/a71/new_soviet/blocks/SirenBlock.java +++ b/src/main/java/su/a71/new_soviet/blocks/SirenBlock.java @@ -90,10 +90,11 @@ public class SirenBlock extends HorizontalFacingBlock { public float getSirenVolume(World world, BlockPos pos) { return switch (world.getReceivedRedstonePower(pos)) { - case 4, 5, 6 -> 2f; - case 7, 8, 9 -> 3f; - case 10, 11, 12 -> 4f; - case 13, 14, 15, 16 -> 5f; + case 1, 2, 3 -> 2f; + case 4, 5, 6 -> 3f; + case 7, 8, 9 -> 4f; + case 10, 11, 12 -> 5f; + case 13, 14, 15, 16 -> 6f; default -> 1f; }; } diff --git a/src/main/java/su/a71/new_soviet/registration/NSE_Custom.java b/src/main/java/su/a71/new_soviet/registration/NSE_Custom.java index 22a08de..aeccdde 100644 --- a/src/main/java/su/a71/new_soviet/registration/NSE_Custom.java +++ b/src/main/java/su/a71/new_soviet/registration/NSE_Custom.java @@ -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 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 LightBulbBlock LIGHT_BULB = new LightBulbBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.GLASS).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 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)); diff --git a/src/main/java/su/a71/new_soviet/registration/NSE_Items.java b/src/main/java/su/a71/new_soviet/registration/NSE_Items.java index 434f549..ee923f4 100644 --- a/src/main/java/su/a71/new_soviet/registration/NSE_Items.java +++ b/src/main/java/su/a71/new_soviet/registration/NSE_Items.java @@ -28,15 +28,15 @@ 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) 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 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 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 SoundEvent DICE_SOUND = SoundEvent.of(new Identifier("new_soviet", "dice_sound")); - public static final Item LIGHT_BULB = new Item(new Item.Settings()); + public static final SoundEvent DICE_SOUND = SoundEvent.of(new Identifier("new_soviet", "dice_sound")); private static final ItemGroup NSE_ITEMS_TAB = FabricItemGroup.builder() .icon(() -> new ItemStack(SICKLE)) @@ -60,7 +60,6 @@ public class NSE_Items { register("dice_d6", () -> DICE_D6, NSE_ITEMS_TAB); register("dice_d4", () -> DICE_D4, 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); } diff --git a/src/main/resources/assets/new_soviet/lang/en_us.json b/src/main/resources/assets/new_soviet/lang/en_us.json index 850aa9e..69ffd03 100644 --- a/src/main/resources/assets/new_soviet/lang/en_us.json +++ b/src/main/resources/assets/new_soviet/lang/en_us.json @@ -150,6 +150,5 @@ "block.new_soviet.blue_concrete_with_bars": "Blue Concrete With Bars", "block.new_soviet.red_concrete_with_bars": "Red Concrete With Bars", "subtitles.new_soviet.light_bulb_broken": "Light bulb breaks", - "block.new_soviet.light_bulb": "Light Bulb Lamp", - "item.new_soviet.light_bulb_item": "Light Bulb" + "block.new_soviet.light_bulb": "Light Bulb" } \ No newline at end of file diff --git a/src/main/resources/assets/new_soviet/models/item/light_bulb_item.json b/src/main/resources/assets/new_soviet/models/item/light_bulb_item.json deleted file mode 100644 index d12d23a..0000000 --- a/src/main/resources/assets/new_soviet/models/item/light_bulb_item.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "credit": "Karoter2", - "parent": "item/generated", - "textures": { - "layer0": "new_soviet:item/bulb" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/new_soviet/textures/item/bulb.png b/src/main/resources/assets/new_soviet/textures/item/bulb.png deleted file mode 100644 index fa266fd..0000000 Binary files a/src/main/resources/assets/new_soviet/textures/item/bulb.png and /dev/null differ