The Great Refactor of 2017 - More recipes moved over!
This commit is contained in:
parent
c8ebf402af
commit
e86c0d175c
7 changed files with 250 additions and 362 deletions
|
@ -1,5 +1,6 @@
|
|||
package techreborn.blocks;
|
||||
|
||||
import com.google.common.base.CaseFormat;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.PropertyInteger;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
|
@ -14,8 +15,10 @@ import net.minecraftforge.fml.relauncher.Side;
|
|||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import reborncore.common.multiblock.BlockMultiblockBase;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.tiles.TileMachineCasing;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockMachineCasing extends BlockMultiblockBase {
|
||||
|
@ -31,6 +34,20 @@ public class BlockMachineCasing extends BlockMultiblockBase {
|
|||
this.setDefaultState(this.getDefaultState().withProperty(METADATA, 0));
|
||||
}
|
||||
|
||||
public static ItemStack getStackByName(String name, int count) {
|
||||
name = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, name);
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equalsIgnoreCase(name)) {
|
||||
return new ItemStack(ModBlocks.MACHINE_CASINGS, count, i);
|
||||
}
|
||||
}
|
||||
throw new InvalidParameterException("The machine casing " + name + " could not be found.");
|
||||
}
|
||||
|
||||
public static ItemStack getStackByName(String name) {
|
||||
return getStackByName(name, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(METADATA, meta);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package techreborn.blocks;
|
||||
|
||||
import com.google.common.base.CaseFormat;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.PropertyInteger;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
|
@ -29,6 +30,7 @@ public class BlockMachineFrame extends BaseBlock {
|
|||
}
|
||||
|
||||
public static ItemStack getFrameByName(String name, int count) {
|
||||
name = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, name);
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equalsIgnoreCase(name)) {
|
||||
return new ItemStack(ModBlocks.MACHINE_FRAMES, count, i);
|
||||
|
@ -37,6 +39,10 @@ public class BlockMachineFrame extends BaseBlock {
|
|||
throw new InvalidParameterException("The part " + name + " could not be found.");
|
||||
}
|
||||
|
||||
public static ItemStack getFrameByName(String name) {
|
||||
return getFrameByName(name, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs creativeTabs, NonNullList<ItemStack> list) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue