Skip to content

Commit

Permalink
Merge pull request #33 from GrowthcraftCE/Growthcraft-1.19-29
Browse files Browse the repository at this point in the history
Fixed #29 Salt Block renders in world correctly and has more realisti…
  • Loading branch information
Alatyami authored Apr 21, 2023
2 parents b9a519d + a16f524 commit 93d80aa
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/main/java/growthcraft/core/init/GrowthcraftBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.material.Material;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
Expand Down Expand Up @@ -63,7 +62,7 @@ public class GrowthcraftBlocks {

public static final RegistryObject<Block> SALT_BLOCK = registerBlock(
Reference.UnlocalizedName.SALT_BLOCK,
() -> new GrowthcraftBlock(Material.STONE, SoundType.STONE)
() -> new GrowthcraftBlock(Blocks.GRAVEL, SoundType.GRAVEL)
);

public static final RegistryObject<Block> SALT_ORE = registerBlock(
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/growthcraft/lib/block/GrowthcraftBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,18 @@ public GrowthcraftBlock(Material material) {
this(getInitProperties(material, SoundType.WOOD));
}

public GrowthcraftBlock(Block block) {
this(getInitProperties(block, SoundType.WOOD));
}

public GrowthcraftBlock(Material material, SoundType soundType) {
this(getInitProperties(material, soundType));
}

public GrowthcraftBlock(Block block, SoundType soundType) {
this(getInitProperties(block, soundType));
}

public GrowthcraftBlock(Properties properties) {
super(properties);
}
Expand All @@ -27,4 +35,10 @@ private static Properties getInitProperties(Material material, SoundType soundTy
properties.sound(SoundType.WOOD);
return properties;
}

private static Properties getInitProperties(Block block, SoundType soundType) {
Properties properties = Properties.copy(block);
properties.sound(SoundType.WOOD);
return properties;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"variants": {
"": { "model": "growthcraft:block/salt_block" }
}
}

0 comments on commit 93d80aa

Please sign in to comment.