More luv to computer cube block

This commit is contained in:
drcrazy 2017-09-07 01:04:20 +03:00
parent bc390fa0e0
commit 015fd889f2
3 changed files with 79 additions and 1 deletions

View file

@ -31,18 +31,22 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import prospector.shootingstar.ShootingStar;
import prospector.shootingstar.model.ModelCompound;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.common.blocks.BlockMachineBase;
import techreborn.Core;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTab;
import techreborn.lib.ModInfo;
public class BlockComputerCube extends BlockMachineBase {
public BlockComputerCube(final Material material) {
public BlockComputerCube() {
super();
this.setUnlocalizedName("techreborn.computercube");
this.setCreativeTab(TechRebornCreativeTab.instance);
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, "machines/tier2_machines"));
}
@Override

View file

@ -66,6 +66,9 @@ import techreborn.tiles.transformers.TileHVTransformer;
import techreborn.tiles.transformers.TileLVTransformer;
import techreborn.tiles.transformers.TileMVTransformer;
/**
* Registers all TR blocks
*/
public class ModBlocks {
public static Block THERMAL_GENERATOR;
@ -140,6 +143,11 @@ public class ModBlocks {
public static Block FLARE;
public static Block CABLE;
public static Block COMPUTER_CUBE;
/**
* Register blocks
*/
public static void init() {
THERMAL_GENERATOR = new BlockThermalGenerator();
registerBlock(THERMAL_GENERATOR, "thermal_generator");
@ -395,6 +403,9 @@ public class ModBlocks {
registerBlock(SCRAPBOXINATOR, "scrapboxinator");
GameRegistry.registerTileEntity(TileScrapboxinator.class, "TileScrapboxinatorTR");
COMPUTER_CUBE = new BlockComputerCube();
registerBlock(COMPUTER_CUBE, "computer_cube");
//TODO enable when done
// flare = new BlockFlare();
// registerBlock(flare, "flare");
@ -408,18 +419,32 @@ public class ModBlocks {
Core.logHelper.info("TechReborns Blocks Loaded");
}
/**
* Wrapper method for RebornRegistry
* @param block Block to register
* @param name Name of block to register
*/
public static void registerBlock(Block block, String name) {
name = name.toLowerCase();
block.setUnlocalizedName(ModInfo.MOD_ID + ":" + name);
RebornRegistry.registerBlock(block, new ResourceLocation(ModInfo.MOD_ID, name));
}
/**
* Wrapper method for RebornRegistry
* @param block Block to Register
* @param itemclass Itemblock of block to register
* @param name Name of block to register
*/
public static void registerBlock(Block block, Class<? extends ItemBlock> itemclass, String name) {
name = name.toLowerCase();
block.setUnlocalizedName(ModInfo.MOD_ID + ":" + name);
RebornRegistry.registerBlock(block, itemclass, new ResourceLocation(ModInfo.MOD_ID, name));
}
/**
* Register ores and ore blocks
*/
public static void registerOreDict() {
for (String ore : BlockOre.ores) {
OreUtil.registerOre("ore" + StringUtils.toFirstCapital(ore), BlockOre.getOreByName(ore));

View file

@ -0,0 +1,49 @@
{
"forge_marker": 1,
"defaults": {
"transform": "forge:default-block",
"model": "orientable",
"textures": {
"particle": "techreborn:blocks/machines/tier2_machines/computer_cube_front",
"top": "techreborn:blocks/machines/tier2_machines/machine_top",
"down": "techreborn:blocks/machines/tier2_machines/machine_bottom",
"side": "techreborn:blocks/machines/tier2_machines/computer_cube_side"
}
},
"variants": {
"normal": [{}],
"inventory": {
"transform": "forge:default-block",
"model": "orientable",
"textures": {
"front": "techreborn:blocks/machines/tier0_machines/computer_cube_front"
}
},
"facing": {
"north": {
},
"east": {
"y": 90
},
"south": {
"y": 180
},
"west": {
"y": 270
}
},
"active": {
"true": {
"textures": {
"front": "techreborn:blocks/machines/tier2_machines/computer_cube_front"
}
},
"false": {
"textures": {
"front": "techreborn:blocks/machines/tier2_machines/computer_cube_front"
}
}
}
}
}