Skip to content

Commit

Permalink
Structrual Blocks (#64)
Browse files Browse the repository at this point in the history
* Added the first decorative blocks

* Fix model rendering issue.

* New structural blocks

* Even more variants for the structural blocks

* Added localization to structural blocks

---------

Co-authored-by: Loxo <loxo.Minecraft@gmail.com>
  • Loading branch information
Zalgo239 and loxoDev authored May 1, 2023
1 parent 1ea9e91 commit acaa8ef
Show file tree
Hide file tree
Showing 38 changed files with 384 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/java/supersymmetry/common/CommonProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ public static void registerBlocks(@NotNull RegistryEvent.Register<Block> event)
for (SusyStoneVariantBlock block : SuSyBlocks.SUSY_STONE_BLOCKS.values()) registry.register(block);
registry.register(SuSyBlocks.ALTERNATOR_COIL);
registry.register(SuSyBlocks.TURBINE_ROTOR);
registry.register(SuSyBlocks.STRUCTURAL_BLOCK);
registry.register(SuSyBlocks.STRUCTURAL_BLOCK_1);
}

@SubscribeEvent
Expand All @@ -63,6 +65,8 @@ public static void registerItems(@NotNull RegistryEvent.Register<Item> event) {
for (SusyStoneVariantBlock block : SuSyBlocks.SUSY_STONE_BLOCKS.values()) registry.register(createItemBlock(block, VariantItemBlock::new));
registry.register(createItemBlock(SuSyBlocks.ALTERNATOR_COIL, VariantItemBlock::new));
registry.register(createItemBlock(SuSyBlocks.TURBINE_ROTOR, VariantItemBlock::new));
registry.register(createItemBlock(SuSyBlocks.STRUCTURAL_BLOCK, VariantItemBlock::new));
registry.register(createItemBlock(SuSyBlocks.STRUCTURAL_BLOCK_1, VariantItemBlock::new));
}

@SubscribeEvent(priority = EventPriority.HIGH)
Expand Down
62 changes: 62 additions & 0 deletions src/main/java/supersymmetry/common/blocks/BlockStructural.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package supersymmetry.common.blocks;

import gregtech.api.block.IStateHarvestLevel;
import gregtech.api.block.VariantBlock;
import net.minecraft.block.SoundType;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.IStringSerializable;

import javax.annotation.Nonnull;

public class BlockStructural extends VariantBlock<BlockStructural.StructuralBlockType> {

public BlockStructural() {
super(net.minecraft.block.material.Material.IRON);
setTranslationKey("structural_block");
setHardness(5.0f);
setResistance(10.0f);
setSoundType(SoundType.METAL);
setHarvestLevel("wrench", 2);
setDefaultState(getState(StructuralBlockType.BASE_STRUCTURAL_BLOCK));
}

public static enum StructuralBlockType implements IStringSerializable, IStateHarvestLevel {
BASE_STRUCTURAL_BLOCK("base_structural_block", 1),
STRUCTURAL_BLOCK_LOW("structural_block_low", 1),
STRUCTURAL_BLOCK_LOWLIGHT("structural_block_lowlight", 1),
STRUCTURAL_BLOCK_DANGER_A("structural_block_danger_a", 1),
STRUCTURAL_BLOCK_DANGER_B("structural_block_danger_b", 1),
STRUCTURAL_BLOCK_DANGER_C("structural_block_danger_c", 1),
STRUCTURAL_BLOCK_DANGER_D("structural_block_danger_d", 1),
STRUCTURAL_BLOCK_COLUMN("structural_block_column", 1),
STRUCTURAL_BLOCK_COLUMN_OLD("structural_block_column_old", 1),
STRUCTURAL_BLOCK_LIGHT("structural_block_light", 1),
STRUCTURAL_BLOCK_LIGHT_BROKEN("structural_block_light_broken", 1),
STRUCTURAL_BLOCK_LIGHT_CABLE("structural_block_light_cable", 1),
STRUCTURAL_BLOCK_INSTRUMENTS("structural_block_instruments", 1),
STRUCTURAL_BLOCK_SIGN_0("structural_block_sign_0", 1),
STRUCTURAL_BLOCK_SIGN_1("structural_block_sign_1", 1),
STRUCTURAL_BLOCK_SIGN_2("structural_block_sign_2", 1);

private final String name;
private final int harvestLevel;

private StructuralBlockType(String name, int harvestLevel) {
this.name = name;
this.harvestLevel = harvestLevel;
}

@Nonnull
public String getName() {
return this.name;
}

public int getHarvestLevel(IBlockState state) {
return this.harvestLevel;
}

public String getHarvestTool(IBlockState state) {
return "wrench";
}
}
}
54 changes: 54 additions & 0 deletions src/main/java/supersymmetry/common/blocks/BlockStructural1.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package supersymmetry.common.blocks;

import gregtech.api.block.IStateHarvestLevel;
import gregtech.api.block.VariantBlock;
import net.minecraft.block.SoundType;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.IStringSerializable;

import javax.annotation.Nonnull;

public class BlockStructural1 extends VariantBlock<BlockStructural1.StructuralBlock1Type> {

public BlockStructural1() {
super(net.minecraft.block.material.Material.IRON);
setTranslationKey("structural_block_1");
setHardness(5.0f);
setResistance(10.0f);
setSoundType(SoundType.METAL);
setHarvestLevel("wrench", 2);
setDefaultState(getState(StructuralBlock1Type.STRUCTURAL_BLOCK_1_EXPOSED));
}

public static enum StructuralBlock1Type implements IStringSerializable, IStateHarvestLevel {

STRUCTURAL_BLOCK_1_EXPOSED("structural_block_exposed", 1),
STRUCTURAL_BLOCK_1_EXPOSED_1("structural_block_exposed_1", 1),
STRUCTURAL_BLOCK_1_EXPOSED_2("structural_block_exposed_2", 1),
STRUCTURAL_BLOCK_1_DANGER_SIGN("structural_block_danger_sign", 1),
STRUCTURAL_BLOCK_1_CABLE("structural_block_cable", 1),
STRUCTURAL_BLOCK_1_CABLE_HORIZONTAL("structural_block_cable_horizontal", 1),
STRUCTURAL_BLOCK_1_CABLE_JUNCTION("structural_block_cable_junction", 1);

private final String name;
private final int harvestLevel;

private StructuralBlock1Type(String name, int harvestLevel) {
this.name = name;
this.harvestLevel = harvestLevel;
}

@Nonnull
public String getName() {
return this.name;
}

public int getHarvestLevel(IBlockState state) {
return this.harvestLevel;
}

public String getHarvestTool(IBlockState state) {
return "wrench";
}
}
}
10 changes: 10 additions & 0 deletions src/main/java/supersymmetry/common/blocks/SuSyBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public class SuSyBlocks {
public static final EnumMap<SusyStoneVariantBlock.StoneVariant, SusyStoneVariantBlock> SUSY_STONE_BLOCKS = new EnumMap(SusyStoneVariantBlock.StoneVariant.class);
public static BlockAlternatorCoil ALTERNATOR_COIL;
public static BlockTurbineRotor TURBINE_ROTOR;
public static BlockStructural STRUCTURAL_BLOCK;
public static BlockStructural1 STRUCTURAL_BLOCK_1;

public static void init() {
COOLING_COIL = new BlockCoolingCoil();
Expand All @@ -46,6 +48,12 @@ public static void init() {
TURBINE_ROTOR = new BlockTurbineRotor();
TURBINE_ROTOR.setRegistryName("turbine_rotor");

STRUCTURAL_BLOCK = new BlockStructural();
STRUCTURAL_BLOCK.setRegistryName("structural_block");

STRUCTURAL_BLOCK_1 = new BlockStructural1();
STRUCTURAL_BLOCK_1.setRegistryName("structural_block_1");

}

@SideOnly(Side.CLIENT)
Expand All @@ -57,6 +65,8 @@ public static void registerItemModels() {
registerItemModel(block);
registerItemModel(ALTERNATOR_COIL);
registerItemModel(TURBINE_ROTOR);
registerItemModel(STRUCTURAL_BLOCK);
registerItemModel(STRUCTURAL_BLOCK_1);
}

@SideOnly(Side.CLIENT)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"ctm": {
"ctm_version": 1,
"layer": "BLOOM",
"gregtech": true,
"extra": {
"light": 4
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"ctm": {
"ctm_version": 1,
"layer": "BLOOM",
"gregtech": true,
"extra": {
"light": 4
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"ctm": {
"ctm_version": 1,
"layer": "BLOOM",
"gregtech": true,
"extra": {
"light": 4
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"ctm": {
"ctm_version": 1,
"layer": "BLOOM",
"gregtech": true,
"extra": {
"light": 4
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
134 changes: 134 additions & 0 deletions src/main/resources/assets/susy/blockstates/structural_block.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
{
"forge_marker" : 1,
"defaults": {
"model": "minecraft:cube_bottom_top",
"textures": {
"bottom": "gregtech:blocks/decorative/structural_blocks/base_structural_block",
"top": "gregtech:blocks/decorative/structural_blocks/base_structural_block",
"side": "gregtech:blocks/decorative/structural_blocks/base_structural_block"
}
},
"variants" : {
"variant=base_structural_block" : {
"model" : "minecraft:cube_all",
"textures" : {
"all" : "gregtech:blocks/decorative/structural_blocks/base_structural_block"
}
},
"variant=structural_block_low" : {
"model": "minecraft:cube_bottom_top",
"textures" : {
"side" : "gregtech:blocks/decorative/structural_blocks/structural_block_low"
}
},
"variant=structural_block_lowlight" : {
"model" : "gregtech:cube_2_layer_bottom_top",
"textures" : {
"bot_side" : "gregtech:blocks/decorative/structural_blocks/structural_block_lowlight",
"bot_top" : "gregtech:blocks/decorative/structural_blocks/base_structural_block",
"bot_bottom" : "gregtech:blocks/decorative/structural_blocks/base_structural_block",
"top_side" : "gregtech:blocks/decorative/structural_blocks/structural_block_lowlight_bloom",
"top_top" : "gregtech:blocks/decorative/structural_blocks/structural_block_lowlight_top_bloom",
"top_bottom" : "gregtech:blocks/decorative/structural_blocks/structural_block_lowlight_top_bloom"
}
},
"variant=structural_block_danger_a" : {
"model" : "minecraft:cube_all",
"textures" : {
"all" : "gregtech:blocks/decorative/structural_blocks/structural_block_danger_a"
}
},
"variant=structural_block_danger_b" : {
"model" : "minecraft:cube_all",
"textures" : {
"all" : "gregtech:blocks/decorative/structural_blocks/structural_block_danger_b"
}
},
"variant=structural_block_danger_c" : {
"model" : "minecraft:cube_all",
"textures" : {
"all" : "gregtech:blocks/decorative/structural_blocks/structural_block_danger_c"
}
},
"variant=structural_block_danger_d" : {
"model" : "minecraft:cube_all",
"textures" : {
"all" : "gregtech:blocks/decorative/structural_blocks/structural_block_danger_d"
}
},
"variant=structural_block_column" : {
"model" : "minecraft:cube_all",
"textures" : {
"all" : "gregtech:blocks/decorative/structural_blocks/structural_block_column"
}
},
"variant=structural_block_column_old" : {
"model" : "minecraft:cube_all",
"textures" : {
"all" : "gregtech:blocks/decorative/structural_blocks/structural_block_column_old"
}
},
"variant=structural_block_light" : {
"model" : "gregtech:cube_2_layer_bottom_top",
"textures" : {
"bot_side" : "gregtech:blocks/decorative/structural_blocks/structural_block_light",
"bot_top" : "gregtech:blocks/decorative/structural_blocks/base_structural_block",
"bot_bottom" : "gregtech:blocks/decorative/structural_blocks/base_structural_block",
"top_side" : "gregtech:blocks/decorative/structural_blocks/structural_block_light_bloom",
"top_top" : "gregtech:blocks/decorative/structural_blocks/structural_block_lowlight_top_bloom",
"top_bottom" : "gregtech:blocks/decorative/structural_blocks/structural_block_lowlight_top_bloom"
}
},
"variant=structural_block_light_broken" : {
"model": "minecraft:cube_bottom_top",
"textures": {
"bottom": "gregtech:blocks/decorative/structural_blocks/base_structural_block",
"top": "gregtech:blocks/decorative/structural_blocks/base_structural_block",
"side": "gregtech:blocks/decorative/structural_blocks/structural_block_light_broken"
}
},
"variant=structural_block_light_cable" : {
"model": "minecraft:cube_bottom_top",
"textures": {
"bottom": "gregtech:blocks/decorative/structural_blocks/base_structural_block",
"top": "gregtech:blocks/decorative/structural_blocks/base_structural_block",
"side": "gregtech:blocks/decorative/structural_blocks/structural_block_light_cable"
}
},
"variant=structural_block_instruments" : {
"model" : "gregtech:cube_2_layer_bottom_top",
"textures" : {
"bot_side" : "gregtech:blocks/decorative/structural_blocks/structural_block_instruments",
"bot_top" : "gregtech:blocks/decorative/structural_blocks/base_structural_block",
"bot_bottom" : "gregtech:blocks/decorative/structural_blocks/base_structural_block",
"top_side" : "gregtech:blocks/decorative/structural_blocks/structural_block_instruments_bloom",
"top_top" : "gregtech:blocks/decorative/structural_blocks/structural_block_lowlight_top_bloom",
"top_bottom" : "gregtech:blocks/decorative/structural_blocks/structural_block_lowlight_top_bloom"
}
},
"variant=structural_block_sign_0" : {
"model": "minecraft:cube_bottom_top",
"textures": {
"bottom": "gregtech:blocks/decorative/structural_blocks/base_structural_block",
"top": "gregtech:blocks/decorative/structural_blocks/base_structural_block",
"side": "gregtech:blocks/decorative/structural_blocks/structural_block_sign_0"
}
},
"variant=structural_block_sign_1" : {
"model": "minecraft:cube_bottom_top",
"textures": {
"bottom": "gregtech:blocks/decorative/structural_blocks/base_structural_block",
"top": "gregtech:blocks/decorative/structural_blocks/base_structural_block",
"side": "gregtech:blocks/decorative/structural_blocks/structural_block_sign_1"
}
},
"variant=structural_block_sign_2" : {
"model": "minecraft:cube_bottom_top",
"textures": {
"bottom": "gregtech:blocks/decorative/structural_blocks/base_structural_block",
"top": "gregtech:blocks/decorative/structural_blocks/base_structural_block",
"side": "gregtech:blocks/decorative/structural_blocks/structural_block_sign_2"
}
}
}
}
Loading

0 comments on commit acaa8ef

Please sign in to comment.