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");
}
}

View file

@ -158,6 +158,8 @@
"item.new_soviet.dice_d20.tooltip": "Twenty sides",
"item.new_soviet.dice.thrown": "Dice was thrown with result:",
"item.new_soviet.dice.thrown_multiple": "Dice were thrown with result:",
"item.new_soviet.dice.thrown_announce": "Dice was thrown by %s with result:",
"item.new_soviet.dice.thrown_multiple_announce": "Dice were thrown by %s with result:",
"subtitles.new_soviet.dice_throw": "Dice thrown",
"block.new_soviet.landmine": "AP Landmine",
"block.new_soviet.chiseled_mangrove_door": "Chiseled Mangrove Door",

View file

@ -0,0 +1,129 @@
{
"credit": "Made with Blockbench",
"texture_size": [48, 48],
"textures": {
"0": "lamp_post",
"particle": "lamp_post"
},
"elements": [
{
"from": [6, 1, 6],
"to": [10, 8, 10],
"rotation": {"angle": 0, "axis": "z", "origin": [8, 0, 8]},
"faces": {
"north": {"uv": [5.344, 8.344, 6.656, 10.656], "rotation": 180, "texture": "#0"},
"east": {"uv": [6.67733, 8.344, 7.98933, 10.656], "rotation": 180, "texture": "#0"},
"south": {"uv": [2.67733, 8.344, 3.98933, 10.656], "rotation": 180, "texture": "#0"},
"west": {"uv": [4.01067, 8.344, 5.32267, 10.656], "rotation": 180, "texture": "#0"},
"up": {"uv": [6.656, 7.01067, 5.344, 8.32267], "rotation": 90, "texture": "#0"},
"down": {"uv": [5.32267, 8.32267, 4.01067, 7.01067], "rotation": 270, "texture": "#0"}
}
},
{
"from": [6.5, 8, 6.5],
"to": [9.5, 9, 9.5],
"rotation": {"angle": 0, "axis": "z", "origin": [8, 0, 8]},
"faces": {
"north": {"uv": [13.01067, 9.67733, 13.98933, 9.98933], "rotation": 180, "texture": "#0"},
"east": {"uv": [14.01067, 9.67733, 14.98933, 9.98933], "rotation": 180, "texture": "#0"},
"south": {"uv": [11.01067, 9.67733, 11.98933, 9.98933], "rotation": 180, "texture": "#0"},
"west": {"uv": [12.01067, 9.67733, 12.98933, 9.98933], "rotation": 180, "texture": "#0"},
"up": {"uv": [13.98933, 8.67733, 13.01067, 9.656], "rotation": 90, "texture": "#0"}
}
},
{
"from": [5.5, 2, 5.5],
"to": [10.5, 4, 10.5],
"rotation": {"angle": 0, "axis": "z", "origin": [8, 0, 8]},
"faces": {
"north": {"uv": [6.01067, 6.344, 7.656, 6.98933], "rotation": 180, "texture": "#0"},
"east": {"uv": [7.67733, 6.344, 9.32267, 6.98933], "rotation": 180, "texture": "#0"},
"south": {"uv": [2.67733, 6.344, 4.32267, 6.98933], "rotation": 180, "texture": "#0"},
"west": {"uv": [4.344, 6.344, 5.98933, 6.98933], "rotation": 180, "texture": "#0"},
"up": {"uv": [7.656, 4.67733, 6.01067, 6.32267], "rotation": 90, "texture": "#0"},
"down": {"uv": [5.98933, 6.32267, 4.344, 4.67733], "rotation": 270, "texture": "#0"}
}
},
{
"from": [5.5, 3.5, 7.5],
"to": [10.5, 8.5, 8.5],
"rotation": {"angle": 0, "axis": "z", "origin": [8, 0, 8]},
"faces": {
"east": {"uv": [12.344, 10.344, 12.656, 11.98933], "rotation": 180, "texture": "#0"},
"west": {"uv": [9.67733, 10.344, 9.98933, 11.98933], "rotation": 180, "texture": "#0"},
"up": {"uv": [10.656, 8.67733, 10.344, 10.32267], "rotation": 90, "texture": "#0"}
}
},
{
"from": [7.5, 3.5, 5.5],
"to": [8.5, 8.5, 10.5],
"rotation": {"angle": 0, "axis": "z", "origin": [8, 0, 8]},
"faces": {
"north": {"uv": [12.344, 10.344, 12.656, 11.98933], "rotation": 180, "texture": "#0"},
"south": {"uv": [9.67733, 10.344, 9.98933, 11.98933], "rotation": 180, "texture": "#0"},
"up": {"uv": [10.656, 8.67733, 10.344, 10.32267], "texture": "#0"}
}
},
{
"from": [5, 0, 5],
"to": [11, 1, 11],
"faces": {
"north": {"uv": [4.33333, 6.33333, 6, 6.66667], "texture": "#0"},
"east": {"uv": [4.33333, 6.33333, 6, 6.66667], "texture": "#0"},
"south": {"uv": [4.33333, 6.33333, 6, 6.66667], "texture": "#0"},
"west": {"uv": [4.33333, 6.33333, 6, 6.66667], "texture": "#0"},
"up": {"uv": [4.33333, 4.66667, 6, 6.33333], "texture": "#0"},
"down": {"uv": [4.33333, 4.66667, 6, 6.33333], "texture": "#0"}
}
}
],
"display": {
"thirdperson_righthand": {
"rotation": [75, 45, 0],
"translation": [0, -0.5, 0],
"scale": [0.375, 0.375, 0.375]
},
"thirdperson_lefthand": {
"rotation": [75, 45, 0],
"translation": [0, -0.5, 0],
"scale": [0.375, 0.375, 0.375]
},
"firstperson_righthand": {
"rotation": [0, 45, 0],
"translation": [1.75, 2, 0],
"scale": [0.4, 0.4, 0.4]
},
"firstperson_lefthand": {
"rotation": [0, 45, 0],
"translation": [1.75, 2, 0],
"scale": [0.4, 0.4, 0.4]
},
"ground": {
"translation": [0, -1.75, 0],
"scale": [0.25, 0.25, 0.25]
},
"gui": {
"rotation": [30, 225, 0],
"translation": [-2.5, 1.5, 0],
"scale": [0.625, 0.625, 0.625]
},
"head": {
"rotation": [85, -180, 90],
"translation": [-7, 22.5, 8]
},
"fixed": {
"rotation": [-90, 0, 0],
"translation": [0, 0, -16],
"scale": [2, 2, 2]
}
},
"groups": [
{
"name": "group",
"origin": [0, 0, 0],
"color": 0,
"children": [0, 1, 2, 3, 4]
},
5
]
}