Flattened frames
This commit is contained in:
parent
94b1e19abf
commit
1d4116a215
51 changed files with 465 additions and 570 deletions
|
@ -112,13 +112,13 @@ public class BlockMachineCasing extends BlockMultiblockBase {
|
|||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
if (RebornCoreConfig.wrenchRequired){
|
||||
if (state.getValue(TYPE) == "reinforced") {
|
||||
drops.add(new ItemStack(ModBlocks.MACHINE_FRAMES, 1, 1));
|
||||
drops.add(new ItemStack(ModBlocks.MACHINE_BLOCK_ADVANCED));
|
||||
}
|
||||
else if (state.getValue(TYPE) == "advanced") {
|
||||
drops.add(new ItemStack(ModBlocks.MACHINE_FRAMES, 1, 2));
|
||||
drops.add(new ItemStack(ModBlocks.MACHINE_BLOCK_ELITE));
|
||||
}
|
||||
else {
|
||||
drops.add(new ItemStack(ModBlocks.MACHINE_FRAMES, 1, 0));
|
||||
drops.add(new ItemStack(ModBlocks.MACHINE_BLOCK_BASIC));
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -24,96 +24,71 @@
|
|||
|
||||
package techreborn.blocks;
|
||||
|
||||
import com.google.common.base.CaseFormat;
|
||||
import com.google.common.collect.Lists;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import reborncore.client.models.ModelCompound;
|
||||
import reborncore.client.models.RebornModelRegistry;
|
||||
import reborncore.common.BaseBlock;
|
||||
import reborncore.common.blocks.PropertyString;
|
||||
import reborncore.common.util.ArrayUtils;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.lib.ModInfo;
|
||||
import techreborn.utils.TechRebornCreativeTab;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockMachineFrames extends BaseBlock {
|
||||
public static final String[] types = new String[] { "basic", "advanced", "highly_advanced" };
|
||||
public static final PropertyString TYPE = new PropertyString("type", types);
|
||||
private static final List<String> typesList = Lists.newArrayList(ArrayUtils.arrayToLowercase(types));
|
||||
// public static final String[] types = new String[] { "basic", "advanced", "highly_advanced" };
|
||||
// public static final PropertyString TYPE = new PropertyString("type", types);
|
||||
// private static final List<String> typesList = Lists.newArrayList(ArrayUtils.arrayToLowercase(types));
|
||||
|
||||
public BlockMachineFrames() {
|
||||
super(Material.IRON);
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setHardness(1f);
|
||||
this.setDefaultState(this.getDefaultState().withProperty(TYPE, "basic"));
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
RebornModelRegistry.registerModel(new ModelCompound(ModInfo.MOD_ID, this, i, "machines/structure").setInvVariant("type=" + types[i]));
|
||||
}
|
||||
RebornModelRegistry.registerModel(new ModelCompound(ModInfo.MOD_ID, this, "machines/structure"));
|
||||
}
|
||||
|
||||
public static ItemStack getFrameByName(String name, int count) {
|
||||
name = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, name);
|
||||
if (name.equals("machine")) {
|
||||
return new ItemStack(ModBlocks.MACHINE_FRAMES, count, 0);
|
||||
}
|
||||
if (name.equals("advanced_machine")) {
|
||||
return new ItemStack(ModBlocks.MACHINE_FRAMES, count, 1);
|
||||
}
|
||||
if (name.equals("highly_advanced_machine")) {
|
||||
return new ItemStack(ModBlocks.MACHINE_FRAMES, count, 2);
|
||||
}
|
||||
// public static ItemStack getFrameByName(String name, int count) {
|
||||
// name = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, name);
|
||||
// if (name.equals("machine")) {
|
||||
// return new ItemStack(ModBlocks.MACHINE_FRAMES, count, 0);
|
||||
// }
|
||||
// if (name.equals("advanced_machine")) {
|
||||
// return new ItemStack(ModBlocks.MACHINE_FRAMES, count, 1);
|
||||
// }
|
||||
// if (name.equals("highly_advanced_machine")) {
|
||||
// return new ItemStack(ModBlocks.MACHINE_FRAMES, count, 2);
|
||||
// }
|
||||
//
|
||||
// for (int i = 0; i < types.length; i++) {
|
||||
// if (types[i].equalsIgnoreCase(name)) {
|
||||
// return new ItemStack(ModBlocks.MACHINE_FRAMES, count, i);
|
||||
// }
|
||||
// }
|
||||
// throw new InvalidParameterException("The part " + name + " could not be found.");
|
||||
// }
|
||||
//
|
||||
// public static ItemStack getFrameByName(String name) {
|
||||
// return getFrameByName(name, 1);
|
||||
// }
|
||||
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equalsIgnoreCase(name)) {
|
||||
return new ItemStack(ModBlocks.MACHINE_FRAMES, count, i);
|
||||
}
|
||||
}
|
||||
throw new InvalidParameterException("The part " + name + " could not be found.");
|
||||
}
|
||||
|
||||
public static ItemStack getFrameByName(String name) {
|
||||
return getFrameByName(name, 1);
|
||||
}
|
||||
// @Override
|
||||
// public int damageDropped(IBlockState state) {
|
||||
// return getMetaFromState(state);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public IBlockState getStateFromMeta(int meta) {
|
||||
// if (meta > types.length) {
|
||||
// meta = 0;
|
||||
// }
|
||||
// return getBlockState().getBaseState().withProperty(TYPE, typesList.get(meta));
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int getMetaFromState(IBlockState state) {
|
||||
// return typesList.indexOf(state.getValue(TYPE));
|
||||
// }
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(CreativeTabs creativeTabs, NonNullList<ItemStack> list) {
|
||||
for (int meta = 0; meta < types.length; meta++) {
|
||||
list.add(new ItemStack(this, 1, meta));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state) {
|
||||
return getMetaFromState(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
if (meta > types.length) {
|
||||
meta = 0;
|
||||
}
|
||||
return getBlockState().getBaseState().withProperty(TYPE, typesList.get(meta));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return typesList.indexOf(state.getValue(TYPE));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, TYPE);
|
||||
}
|
||||
// @Override
|
||||
// protected BlockStateContainer createBlockState() {
|
||||
// return new BlockStateContainer(this, TYPE);
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
|
@ -27,14 +27,11 @@ package techreborn.blocks;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.common.blocks.PropertyString;
|
||||
import reborncore.common.registration.RebornRegistry;
|
||||
import reborncore.common.registration.impl.ConfigRegistry;
|
||||
|
@ -42,12 +39,10 @@ import reborncore.common.util.OreDrop;
|
|||
import techreborn.init.TRIngredients;
|
||||
import techreborn.lib.ModInfo;
|
||||
import techreborn.utils.TechRebornCreativeTab;
|
||||
import techreborn.world.config.IOreNameProvider;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
@RebornRegistry(modID = ModInfo.MOD_ID)
|
||||
public class BlockOre extends Block implements IOreNameProvider {
|
||||
public class BlockOre extends Block {
|
||||
|
||||
public static final PropertyString VARIANTS = getVarients();
|
||||
@ConfigRegistry(config = "misc", category = "blocks", key = "rubyMinQuatity", comment = "Minimum quantity of Ruby gems per Ruby ore")
|
||||
|
@ -149,46 +144,22 @@ public class BlockOre extends Block implements IOreNameProvider {
|
|||
}
|
||||
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public void getSubBlocks(CreativeTabs creativeTabs, NonNullList<ItemStack> list) {
|
||||
// for (int meta = 0; meta < ores.length; meta++) {
|
||||
// list.add(new ItemStack(this, 1, meta));
|
||||
// }
|
||||
// public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
|
||||
// return new ItemStack(this, 1, getMetaFromState(state));
|
||||
// }
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
|
||||
return new ItemStack(this, 1, getMetaFromState(state));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state) {
|
||||
return getMetaFromState(state);
|
||||
}
|
||||
|
||||
//
|
||||
// @Override
|
||||
// public IBlockState getStateFromMeta(int meta) {
|
||||
// if (meta > ores.length) {
|
||||
// meta = 0;
|
||||
// }
|
||||
// return getBlockState().getBaseState().withProperty(VARIANTS, oreNamesList.get(meta));
|
||||
// public int damageDropped(IBlockState state) {
|
||||
// return getMetaFromState(state);
|
||||
// }
|
||||
|
||||
// @Override
|
||||
// public int getMetaFromState(IBlockState state) {
|
||||
// return oreNamesList.indexOf(state.getValue(VARIANTS));
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected BlockStateContainer createBlockState() {
|
||||
// return new BlockStateContainer(this, VARIANTS);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public String getUserLoclisedName(IBlockState state) {
|
||||
// return StringUtils.toFirstCapital(oreNamesList.get(getMetaFromState(state)));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static PropertyString getVarients() {
|
||||
// if (OreBlockStateManager.endOreStone) {
|
||||
|
|
|
@ -83,7 +83,7 @@ public class BlockCreativeSolarPanel extends BaseTileBlock {
|
|||
@Override
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
if (RebornCoreConfig.wrenchRequired) {
|
||||
drops.add(new ItemStack(ModBlocks.MACHINE_FRAMES, 1, 1));
|
||||
drops.add(new ItemStack(ModBlocks.MACHINE_BLOCK_ADVANCED));
|
||||
} else {
|
||||
super.getDrops(drops, world, pos, state, fortune);
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ public class BlockAdjustableSU extends BlockEnergyStorage {
|
|||
@Override
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
if (RebornCoreConfig.wrenchRequired) {
|
||||
drops.add(new ItemStack(ModBlocks.MACHINE_FRAMES, 1, 2));
|
||||
drops.add(new ItemStack(ModBlocks.MACHINE_BLOCK_ELITE));
|
||||
} else {
|
||||
super.getDrops(drops, world, pos, state, fortune);
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ public class BlockHighVoltageSU extends BlockEnergyStorage {
|
|||
@Override
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
if (RebornCoreConfig.wrenchRequired) {
|
||||
drops.add(new ItemStack(ModBlocks.MACHINE_FRAMES, 1, 1));
|
||||
drops.add(new ItemStack(ModBlocks.MACHINE_BLOCK_ADVANCED));
|
||||
} else {
|
||||
super.getDrops(drops, world, pos, state, fortune);
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ public class BlockInterdimensionalSU extends BlockEnergyStorage {
|
|||
@Override
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
if (RebornCoreConfig.wrenchRequired) {
|
||||
drops.add(new ItemStack(ModBlocks.MACHINE_FRAMES, 1, 1));
|
||||
drops.add(new ItemStack(ModBlocks.MACHINE_BLOCK_ADVANCED));
|
||||
} else {
|
||||
super.getDrops(drops, world, pos, state, fortune);
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ public class BlockLSUStorage extends BaseTileBlock {
|
|||
@Override
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
if (RebornCoreConfig.wrenchRequired) {
|
||||
drops.add(new ItemStack(ModBlocks.MACHINE_FRAMES, 1, 0));
|
||||
drops.add(new ItemStack(ModBlocks.MACHINE_BLOCK_BASIC));
|
||||
} else {
|
||||
super.getDrops(drops, world, pos, state, fortune);
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ public class BlockLapotronicSU extends BlockEnergyStorage {
|
|||
@Override
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
if (RebornCoreConfig.wrenchRequired) {
|
||||
drops.add(new ItemStack(ModBlocks.MACHINE_FRAMES, 1, 1));
|
||||
drops.add(new ItemStack(ModBlocks.MACHINE_BLOCK_ADVANCED));
|
||||
} else {
|
||||
super.getDrops(drops, world, pos, state, fortune);
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ public class BlockMediumVoltageSU extends BlockEnergyStorage {
|
|||
@Override
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
if (RebornCoreConfig.wrenchRequired) {
|
||||
drops.add(new ItemStack(ModBlocks.MACHINE_FRAMES, 1, 0));
|
||||
drops.add(new ItemStack(ModBlocks.MACHINE_BLOCK_BASIC));
|
||||
} else {
|
||||
super.getDrops(drops, world, pos, state, fortune);
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ public class BlockHVTransformer extends BlockTransformer {
|
|||
@Override
|
||||
public void getDrops(NonNullList<ItemStack> drops, final IBlockAccess world, final BlockPos pos, final IBlockState state, final int fortune) {
|
||||
if (RebornCoreConfig.wrenchRequired){
|
||||
drops.add(new ItemStack(ModBlocks.MACHINE_FRAMES, 1, 1));
|
||||
drops.add(new ItemStack(ModBlocks.MACHINE_BLOCK_ADVANCED));
|
||||
}
|
||||
else {
|
||||
drops.add(new ItemStack(this));
|
||||
|
|
|
@ -52,7 +52,7 @@ public class BlockMVTransformer extends BlockTransformer {
|
|||
@Override
|
||||
public void getDrops(NonNullList<ItemStack> drops, final IBlockAccess world, final BlockPos pos, final IBlockState state, final int fortune) {
|
||||
if (RebornCoreConfig.wrenchRequired){
|
||||
drops.add(new ItemStack(ModBlocks.MACHINE_FRAMES, 1, 0));
|
||||
drops.add(new ItemStack(ModBlocks.MACHINE_BLOCK_BASIC));
|
||||
}
|
||||
else {
|
||||
drops.add(new ItemStack(this));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue