Rewritten world generation, new ores.json config file
This commit is contained in:
parent
8ab9ecd28e
commit
28dda59ed5
12 changed files with 200 additions and 353 deletions
src/main/java/techreborn/blocks
|
@ -30,8 +30,9 @@ import techreborn.config.ConfigTechReborn;
|
|||
import techreborn.init.ModBlocks;
|
||||
import techreborn.items.ItemDusts;
|
||||
import techreborn.items.ItemGems;
|
||||
import techreborn.world.config.IOreNameProvider;
|
||||
|
||||
public class BlockOre extends BaseBlock implements ITexturedBlock {
|
||||
public class BlockOre extends BaseBlock implements ITexturedBlock, IOreNameProvider {
|
||||
|
||||
public static ItemStack getOreByName(String name, int count) {
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
|
@ -39,7 +40,7 @@ public class BlockOre extends BaseBlock implements ITexturedBlock {
|
|||
return new ItemStack(ModBlocks.ore, count, i);
|
||||
}
|
||||
}
|
||||
throw new InvalidParameterException("The storage block " + name + " could not be found.");
|
||||
throw new InvalidParameterException("The ore block " + name + " could not be found.");
|
||||
}
|
||||
|
||||
public static ItemStack getOreByName(String name) {
|
||||
|
@ -49,11 +50,14 @@ public class BlockOre extends BaseBlock implements ITexturedBlock {
|
|||
public IBlockState getBlockStateFromName(String name){
|
||||
int index = -1;
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equals(name)) {
|
||||
if (types[i].equalsIgnoreCase(name)) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(index == -1){
|
||||
return ModBlocks.ore2.getBlockStateFromName(name);
|
||||
}
|
||||
return getStateFromMeta(index);
|
||||
}
|
||||
|
||||
|
@ -188,4 +192,8 @@ public class BlockOre extends BaseBlock implements ITexturedBlock {
|
|||
return new BlockState(this, METADATA);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserLoclisedName(IBlockState state) {
|
||||
return types[state.getValue(METADATA)];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,8 +21,9 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
|||
import reborncore.common.BaseBlock;
|
||||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.world.config.IOreNameProvider;
|
||||
|
||||
public class BlockOre2 extends BaseBlock implements ITexturedBlock {
|
||||
public class BlockOre2 extends BaseBlock implements ITexturedBlock, IOreNameProvider {
|
||||
|
||||
public static ItemStack getOreByName(String name, int count) {
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
|
@ -30,7 +31,7 @@ public class BlockOre2 extends BaseBlock implements ITexturedBlock {
|
|||
return new ItemStack(ModBlocks.ore2, count, i);
|
||||
}
|
||||
}
|
||||
throw new InvalidParameterException("The storage block " + name + " could not be found.");
|
||||
throw new InvalidParameterException("The ore block " + name + " could not be found.");
|
||||
}
|
||||
|
||||
public static ItemStack getOreByName(String name) {
|
||||
|
@ -45,6 +46,9 @@ public class BlockOre2 extends BaseBlock implements ITexturedBlock {
|
|||
break;
|
||||
}
|
||||
}
|
||||
if(index == -1){
|
||||
throw new InvalidParameterException("The ore block " + name + " could not be found.");
|
||||
}
|
||||
return getStateFromMeta(index);
|
||||
}
|
||||
|
||||
|
@ -112,4 +116,8 @@ public class BlockOre2 extends BaseBlock implements ITexturedBlock {
|
|||
return new BlockState(this, METADATA);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserLoclisedName(IBlockState state) {
|
||||
return types[state.getValue(METADATA)];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue