Skip to content

Commit

Permalink
Add features and improve tags, etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
Onako2 committed Sep 29, 2024
1 parent 5d6b33b commit 717936d
Show file tree
Hide file tree
Showing 49 changed files with 776 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/client/java/rs/onako2/ClientInit.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ public class ClientInit implements ClientModInitializer {
@Override
public void onInitializeClient() {
BlockRenderLayerMap.INSTANCE.putBlock(Init.PALE_SHORT_GRASS, RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(Init.PALE_MOSS_CARPET, RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(Init.PALE_SAPLING, RenderLayer.getCutout());
}
}
13 changes: 12 additions & 1 deletion src/main/java/rs/onako2/Init.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,14 @@ public class Init implements ModInitializer {

public static final Block PALE_FENCE_GATE = new FenceGateBlock(WoodType.OAK, AbstractBlock.Settings.create().mapColor(PALE_PLANKS.getDefaultMapColor()).solid().instrument(NoteBlockInstrument.BASS).strength(2.0F, 3.0F).burnable());

public static final Block PALE_SAPLING = new SaplingBlock(PaleSapling.PALE, AbstractBlock.Settings.create().mapColor(MapColor.PALE_YELLOW).ticksRandomly().noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ).burnable().pistonBehavior(PistonBehavior.DESTROY));

public static final Block PALE_LEAVES = new LeavesBlock(AbstractBlock.Settings.create().mapColor(MapColor.DARK_GREEN).strength(0.2F).ticksRandomly().sounds(BlockSoundGroup.GRASS).nonOpaque().allowsSpawning(Blocks::canSpawnOnLeaves).suffocates(Blocks::never).blockVision(Blocks::never).burnable().pistonBehavior(PistonBehavior.DESTROY).solidBlock(Blocks::never));

public static final Block PALE_BUTTON = new ButtonBlock(ModBlockSetType.PALE, 30,AbstractBlock.Settings.create().noCollision().strength(0.5F).pistonBehavior(PistonBehavior.DESTROY));

public static final Block PALE_PRESSURE_PLATE = new PressurePlateBlock(ModBlockSetType.PALE, AbstractBlock.Settings.create().mapColor(PALE_PLANKS.getDefaultMapColor()).solid().instrument(NoteBlockInstrument.BASS).noCollision().strength(0.5F).burnable().pistonBehavior(PistonBehavior.DESTROY));

//public static final Block PALE_SAPLING = new SaplingBlock(PaleSapling.PALE, AbstractBlock.Settings.create().mapColor(MapColor.PALE_YELLOW).ticksRandomly().noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ).burnable().pistonBehavior(PistonBehavior.DESTROY));
private static final ItemGroup IWIE = FabricItemGroup.builder()
.icon(() -> new ItemStack(TEST))
.displayName(Text.translatable("itemGroup.iwie.main"))
Expand All @@ -57,9 +63,14 @@ public class Init implements ModInitializer {
entries.add(PALE_SLAB);
entries.add(PALE_FENCE);
entries.add(PALE_FENCE_GATE);
entries.add(PALE_SAPLING);
entries.add(PALE_LEAVES);
entries.add(PALE_BUTTON);
entries.add(PALE_PRESSURE_PLATE);
})
.build();
public static final Identifier Pale_FEATURE_ID = Identifier.of("iwie", "pale_tree");

public static final PaleTreeFeature Pale_FEATURE = new PaleTreeFeature(PaleFeatureConfig.CODEC);

@Override
Expand Down
24 changes: 24 additions & 0 deletions src/main/java/rs/onako2/ModBlockSetType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package rs.onako2;

import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap;
import net.minecraft.block.BlockSetType;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.sound.SoundEvent;

import java.util.Map;

public record ModBlockSetType(String name, boolean canOpenByHand, boolean canOpenByWindCharge, boolean canButtonBeActivatedByArrows, BlockSetType.ActivationRule pressurePlateSensitivity, BlockSoundGroup soundType, SoundEvent doorClose, SoundEvent doorOpen, SoundEvent trapdoorClose, SoundEvent trapdoorOpen, SoundEvent pressurePlateClickOff, SoundEvent pressurePlateClickOn, SoundEvent buttonClickOff, SoundEvent buttonClickOn) {
private static final Map<String, ModBlockSetType> VALUES = new Object2ObjectArrayMap();
public static final BlockSetType PALE;

static {
PALE = register(new BlockSetType("pale"));
}


private static BlockSetType register(BlockSetType blockSetType) {
ModBlockSetType modBlockSetType = new ModBlockSetType(blockSetType.name(), blockSetType.canOpenByHand(), blockSetType.canOpenByWindCharge(), blockSetType.canButtonBeActivatedByArrows(), blockSetType.pressurePlateSensitivity(), blockSetType.soundType(), blockSetType.doorClose(), blockSetType.doorOpen(), blockSetType.trapdoorClose(), blockSetType.trapdoorOpen(), blockSetType.pressurePlateClickOff(), blockSetType.pressurePlateClickOn(), blockSetType.buttonClickOff(), blockSetType.buttonClickOn());
VALUES.put(blockSetType.name(), modBlockSetType);
return blockSetType;
}
}
8 changes: 8 additions & 0 deletions src/main/java/rs/onako2/ModRegistry.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ public static void registerItems() {
Registry.register(Registries.ITEM, Identifier.of("iwie", "pale_slab"), new BlockItem(Init.PALE_SLAB, new Item.Settings()));
Registry.register(Registries.ITEM, Identifier.of("iwie", "pale_fence"), new BlockItem(Init.PALE_FENCE, new Item.Settings()));
Registry.register(Registries.ITEM, Identifier.of("iwie", "pale_fence_gate"), new BlockItem(Init.PALE_FENCE_GATE, new Item.Settings()));
Registry.register(Registries.ITEM, Identifier.of("iwie", "pale_sapling"), new BlockItem(Init.PALE_SAPLING, new Item.Settings()));
Registry.register(Registries.ITEM, Identifier.of("iwie", "pale_leaves"), new BlockItem(Init.PALE_LEAVES, new Item.Settings()));
Registry.register(Registries.ITEM, Identifier.of("iwie", "pale_button"), new BlockItem(Init.PALE_BUTTON, new Item.Settings()));
Registry.register(Registries.ITEM, Identifier.of("iwie", "pale_pressure_plate"), new BlockItem(Init.PALE_PRESSURE_PLATE, new Item.Settings()));
}

public static void registerBlocks() {
Expand All @@ -31,5 +35,9 @@ public static void registerBlocks() {
Registry.register(Registries.BLOCK, Identifier.of("iwie", "pale_slab"), Init.PALE_SLAB);
Registry.register(Registries.BLOCK, Identifier.of("iwie", "pale_fence"), Init.PALE_FENCE);
Registry.register(Registries.BLOCK, Identifier.of("iwie", "pale_fence_gate"), Init.PALE_FENCE_GATE);
Registry.register(Registries.BLOCK, Identifier.of("iwie", "pale_sapling"), Init.PALE_SAPLING);
Registry.register(Registries.BLOCK, Identifier.of("iwie", "pale_leaves"), Init.PALE_LEAVES);
Registry.register(Registries.BLOCK, Identifier.of("iwie", "pale_button"), Init.PALE_BUTTON);
Registry.register(Registries.BLOCK, Identifier.of("iwie", "pale_pressure_plate"), Init.PALE_PRESSURE_PLATE);
}
}
9 changes: 7 additions & 2 deletions src/main/java/rs/onako2/PaleSapling.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
package rs.onako2;

import net.minecraft.block.SaplingGenerator;
import net.minecraft.world.gen.feature.TreeConfiguredFeatures;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.util.Identifier;
import net.minecraft.world.gen.feature.ConfiguredFeature;

import java.util.Optional;

public class PaleSapling {
public static final SaplingGenerator PALE;

public static final RegistryKey<ConfiguredFeature<?, ?>> PALE_REGISTRY = RegistryKey.of(RegistryKeys.CONFIGURED_FEATURE, Identifier.of("iwie", "pale_tree"));

static {
PALE = new SaplingGenerator("pale", Optional.empty(), Optional.of(TreeConfiguredFeatures.OAK), Optional.empty());
PALE = new SaplingGenerator("pale", Optional.of(PALE_REGISTRY), Optional.empty(), Optional.empty());

}
}
118 changes: 118 additions & 0 deletions src/main/resources/assets/iwie/blockstates/pale_button.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
{
"variants": {
"face=ceiling,facing=east,powered=false": {
"model": "iwie:block/pale_button",
"x": 180,
"y": 270
},
"face=ceiling,facing=east,powered=true": {
"model": "iwie:block/pale_button_pressed",
"x": 180,
"y": 270
},
"face=ceiling,facing=north,powered=false": {
"model": "iwie:block/pale_button",
"x": 180,
"y": 180
},
"face=ceiling,facing=north,powered=true": {
"model": "iwie:block/pale_button_pressed",
"x": 180,
"y": 180
},
"face=ceiling,facing=south,powered=false": {
"model": "iwie:block/pale_button",
"x": 180
},
"face=ceiling,facing=south,powered=true": {
"model": "iwie:block/pale_button_pressed",
"x": 180
},
"face=ceiling,facing=west,powered=false": {
"model": "iwie:block/pale_button",
"x": 180,
"y": 90
},
"face=ceiling,facing=west,powered=true": {
"model": "iwie:block/pale_button_pressed",
"x": 180,
"y": 90
},
"face=floor,facing=east,powered=false": {
"model": "iwie:block/pale_button",
"y": 90
},
"face=floor,facing=east,powered=true": {
"model": "iwie:block/pale_button_pressed",
"y": 90
},
"face=floor,facing=north,powered=false": {
"model": "iwie:block/pale_button"
},
"face=floor,facing=north,powered=true": {
"model": "iwie:block/pale_button_pressed"
},
"face=floor,facing=south,powered=false": {
"model": "iwie:block/pale_button",
"y": 180
},
"face=floor,facing=south,powered=true": {
"model": "iwie:block/pale_button_pressed",
"y": 180
},
"face=floor,facing=west,powered=false": {
"model": "iwie:block/pale_button",
"y": 270
},
"face=floor,facing=west,powered=true": {
"model": "iwie:block/pale_button_pressed",
"y": 270
},
"face=wall,facing=east,powered=false": {
"model": "iwie:block/pale_button",
"uvlock": true,
"x": 90,
"y": 90
},
"face=wall,facing=east,powered=true": {
"model": "iwie:block/pale_button_pressed",
"uvlock": true,
"x": 90,
"y": 90
},
"face=wall,facing=north,powered=false": {
"model": "iwie:block/pale_button",
"uvlock": true,
"x": 90
},
"face=wall,facing=north,powered=true": {
"model": "iwie:block/pale_button_pressed",
"uvlock": true,
"x": 90
},
"face=wall,facing=south,powered=false": {
"model": "iwie:block/pale_button",
"uvlock": true,
"x": 90,
"y": 180
},
"face=wall,facing=south,powered=true": {
"model": "iwie:block/pale_button_pressed",
"uvlock": true,
"x": 90,
"y": 180
},
"face=wall,facing=west,powered=false": {
"model": "iwie:block/pale_button",
"uvlock": true,
"x": 90,
"y": 270
},
"face=wall,facing=west,powered=true": {
"model": "iwie:block/pale_button_pressed",
"uvlock": true,
"x": 90,
"y": 270
}
}
}
7 changes: 7 additions & 0 deletions src/main/resources/assets/iwie/blockstates/pale_leaves.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "iwie:block/pale_leaves"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"variants": {
"powered=false": {
"model": "iwie:block/pale_pressure_plate"
},
"powered=true": {
"model": "iwie:block/pale_pressure_plate_down"
}
}
}
7 changes: 7 additions & 0 deletions src/main/resources/assets/iwie/blockstates/pale_sapling.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "iwie:block/pale_sapling"
}
}
}
4 changes: 3 additions & 1 deletion src/main/resources/assets/iwie/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,7 @@
"block.iwie.pale_button": "Pale Button",
"block.iwie.pale_pressure_plate": "Pale Pressure Plate",
"block.iwie.pale_sign": "Pale Sign",
"block.iwie.pale_wall_sign": "Pale Wall Sign"
"block.iwie.pale_wall_sign": "Pale Wall Sign",
"block.iwie.pale_sapling": "Pale Sapling",
"block.iwie.pale_leaves": "Pale Leaves"
}
6 changes: 6 additions & 0 deletions src/main/resources/assets/iwie/models/block/pale_button.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/button",
"textures": {
"texture": "iwie:block/pale_planks"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/button_inventory",
"textures": {
"texture": "iwie:block/pale_planks"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/button_pressed",
"textures": {
"texture": "iwie:block/pale_planks"
}
}
6 changes: 6 additions & 0 deletions src/main/resources/assets/iwie/models/block/pale_leaves.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/leaves",
"textures": {
"all": "iwie:block/pale_leaves"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/pressure_plate_up",
"textures": {
"texture": "iwie:block/pale_planks"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/pressure_plate_down",
"textures": {
"texture": "iwie:block/pale_planks"
}
}
6 changes: 6 additions & 0 deletions src/main/resources/assets/iwie/models/block/pale_sapling.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/cross",
"textures": {
"cross": "iwie:block/pale_sapling"
}
}
3 changes: 3 additions & 0 deletions src/main/resources/assets/iwie/models/item/pale_button.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parent": "iwie:block/pale_button_inventory"
}
3 changes: 3 additions & 0 deletions src/main/resources/assets/iwie/models/item/pale_leaves.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parent": "iwie:block/pale_leaves"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parent": "iwie:block/pale_pressure_plate"
}
6 changes: 6 additions & 0 deletions src/main/resources/assets/iwie/models/item/pale_sapling.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "iwie:block/pale_sapling"
}
}
Loading

0 comments on commit 717936d

Please sign in to comment.