Fix dice and minor refactoring

This commit is contained in:
Andrew-71 2023-09-14 15:42:28 +03:00
parent 83a976ae8b
commit 5db68cbf85
27 changed files with 167 additions and 23 deletions

View file

@ -9,6 +9,7 @@ import net.fabricmc.fabric.api.datagen.v1.provider.FabricBlockLootTableProvider;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricModelProvider;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider;
import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraft.data.client.BlockStateModelGenerator;
import net.minecraft.data.client.ItemModelGenerator;
@ -825,6 +826,12 @@ public class DataGeneration implements DataGeneratorEntrypoint {
.add(NSE_Custom.RED_TV)
.add(NSE_Custom.BROWN_TV);
getOrCreateTagBuilder(NSE_Tags.Blocks.POST_LAMPS)
.add(NSE_Custom.CAGED_POST_LAMP)
.add(NSE_Custom.VINTAGE_POST_LAMP)
.add(NSE_Custom.MODERN_POST_LAMP)
.add(NSE_Custom.BIG_POST_LAMP);
getOrCreateTagBuilder(BlockTags.DOORS)
.add(NSE_Blocks.CHISELED_BIRCH_DOOR)
.add(NSE_Blocks.CHISELED_OAK_DOOR)
@ -1786,6 +1793,7 @@ public class DataGeneration implements DataGeneratorEntrypoint {
@Override
public void generateBlockStateModels(BlockStateModelGenerator blockStateModelGenerator) {
// BlockStateModelGenerator.createSlabBlockState()
// BlockStateModelGenerator.createWallBlockState()
// BlockStateModelGenerator.createStairsBlockState(NSE_Blocks.SAND_TILES_STAIRS, new Identifier(NewSoviet.MOD_ID, "sand_tiles_stairs"));
}

View file

@ -23,18 +23,19 @@ import net.minecraft.world.WorldView;
import org.jetbrains.annotations.Nullable;
import su.a71.new_soviet.util.Shapes;
import java.util.List;
public class LampPostLampBlock extends Block implements Waterloggable {
public static final DirectionProperty FACING;
public static final BooleanProperty WATERLOGGED;
public Shapes.HorizontalShape SHAPE;
public LampPostLampBlock(AbstractBlock.Settings settings, Shapes.HorizontalShape shape) {
public LampPostLampBlock(AbstractBlock.Settings settings, Shapes.HorizontalShape shape) {
super(settings.luminance((state) -> 14));
SHAPE = shape;
this.setDefaultState(this.stateManager.getDefaultState()
.with(WATERLOGGED, false)
.with(Properties.HORIZONTAL_FACING, Direction.NORTH));
}
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {

View file

@ -37,7 +37,13 @@ public class DiceItem extends Item {
world.playSound((PlayerEntity)null, user.getX(), user.getY(), user.getZ(), NSE_Sounds.DICE_SOUND, SoundCategory.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
output.append(NewSoviet.RANDOM.nextBetween(1, this.getSides())).append(", ");
}
user.sendMessage(Text.translatable(itemStack.getCount() == 1 ? "item.new_soviet.dice.thrown" : "item.new_soviet.dice.thrown_multiple").append(" " + output.subSequence(0, output.length() - 2)), !Config.INSTANCE.shouldAnnounceDice());
if (Config.INSTANCE.shouldAnnounceDice()) {
world.getPlayers().forEach(player -> {
player.sendMessage(Text.translatable(itemStack.getCount() == 1 ? "item.new_soviet.dice.thrown_announce" : "item.new_soviet.dice.thrown_multiple_announce", user.getDisplayName()).append(" " + output.subSequence(0, output.length() - 2)), false);
});
} else {
user.sendMessage(Text.translatable(itemStack.getCount() == 1 ? "item.new_soviet.dice.thrown" : "item.new_soviet.dice.thrown_multiple").append(" " + output.subSequence(0, output.length() - 2)), true);
}
}
user.increaseStat(Stats.USED.getOrCreateStat(this), itemStack.getCount());

View file

@ -46,29 +46,25 @@ public class NSE_Custom extends NSE_BaseRegistration {
public static final LampPostBaseBlock LAMP_POST_BASE = new LampPostBaseBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.METAL).strength(1f, 1.5f).mapColor(MapColor.IRON_GRAY));
public static final LampPostLampBlock CAGED_POST_LAMP = new LampPostLampBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.METAL).strength(1f, 1.5f).mapColor(MapColor.IRON_GRAY),
new Shapes.HorizontalShape(List.of(
List.of(5.0, 0.0, 5.0, 11.0, 2.0, 11.0),
List.of(7.0, 2.0, 7.0, 9.0, 4.0, 9.0),
List.of(6.0, 4.0, 6.0, 10.0, 5.0, 10.0),
List.of(3.0, 9.0, 3.0, 13.0, 13.0, 7.0))));
new Shapes.HorizontalShape(List.of(List.of(6.5, 0.0, 6.5, 9.5, 2.0, 9.5),
List.of(7.0, 2.0, 7.0, 9.0, 7.0, 9.0),
List.of(6.5, 7.0, 6.5, 9.5, 9.0, 9.5),
List.of(7.0, 9.0, 7.0, 9.0, 12.0, 9.0))));
public static final LampPostLampBlock MODERN_POST_LAMP = new LampPostLampBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.METAL).strength(1f, 1.5f).mapColor(MapColor.IRON_GRAY),
new Shapes.HorizontalShape(List.of(
List.of(5.0, 0.0, 5.0, 11.0, 2.0, 11.0),
List.of(7.0, 2.0, 7.0, 9.0, 4.0, 9.0),
List.of(6.0, 4.0, 6.0, 10.0, 5.0, 10.0),
List.of(3.0, 9.0, 3.0, 13.0, 13.0, 7.0))));
new Shapes.HorizontalShape(List.of(List.of(6.5, 0.0, 6.5, 9.5, 2.0, 9.5),
List.of(7.0, 2.0, 7.0, 9.0, 7.0, 9.0),
List.of(6.5, 7.0, 6.5, 9.5, 9.0, 9.5),
List.of(7.0, 9.0, 7.0, 9.0, 12.0, 9.0))));
public static final LampPostLampBlock BIG_POST_LAMP = new LampPostLampBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.METAL).strength(1f, 1.5f).mapColor(MapColor.IRON_GRAY),
new Shapes.HorizontalShape(List.of(
List.of(5.0, 0.0, 5.0, 11.0, 2.0, 11.0),
List.of(7.0, 2.0, 7.0, 9.0, 4.0, 9.0),
List.of(6.0, 4.0, 6.0, 10.0, 5.0, 10.0),
List.of(3.0, 9.0, 3.0, 13.0, 13.0, 7.0))));
new Shapes.HorizontalShape(List.of(List.of(6.5, 0.0, 6.5, 9.5, 2.0, 9.5),
List.of(7.0, 2.0, 7.0, 9.0, 7.0, 9.0),
List.of(6.5, 7.0, 6.5, 9.5, 9.0, 9.5),
List.of(7.0, 9.0, 7.0, 9.0, 12.0, 9.0))));
public static final LampPostLampBlock VINTAGE_POST_LAMP = new LampPostLampBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.METAL).strength(1f, 1.5f).mapColor(MapColor.IRON_GRAY),
new Shapes.HorizontalShape(List.of(
List.of(5.0, 0.0, 5.0, 11.0, 2.0, 11.0),
List.of(7.0, 2.0, 7.0, 9.0, 4.0, 9.0),
List.of(6.0, 4.0, 6.0, 10.0, 5.0, 10.0),
List.of(3.0, 9.0, 3.0, 13.0, 13.0, 7.0))));
new Shapes.HorizontalShape(List.of(List.of(6.5, 0.0, 6.5, 9.5, 2.0, 9.5),
List.of(7.0, 2.0, 7.0, 9.0, 7.0, 9.0),
List.of(6.5, 7.0, 6.5, 9.5, 9.0, 9.5),
List.of(7.0, 9.0, 7.0, 9.0, 12.0, 9.0))));
public static final CeilingFanBlock CEILING_FAN = new CeilingFanBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.METAL).strength(1f, 1.5f).mapColor(MapColor.WHITE));

View file

@ -11,5 +11,7 @@ public class NSE_Tags extends NSE_BaseRegistration{
public static final TagKey<Block> RAKE_MINEABLE = createTag("rake");
public static final TagKey<Block> TV = createTag("tv");
public static final TagKey<Block> POST_LAMPS = createTag("post_lamps");
}
}