Add a config option to change the textures of the end ores to use the stone background.
I still need to add the other ores, but this is the main one that needs doing.
This commit is contained in:
parent
23b3b7335c
commit
d7ce35428c
4 changed files with 57 additions and 18 deletions
|
@ -58,6 +58,7 @@ import techreborn.world.config.IOreNameProvider;
|
|||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RebornRegistry(modID = ModInfo.MOD_ID)
|
||||
public class BlockOre extends Block implements IOreNameProvider {
|
||||
|
@ -66,8 +67,8 @@ public class BlockOre extends Block implements IOreNameProvider {
|
|||
"galena", "iridium", "ruby", "sapphire", "bauxite", "pyrite",
|
||||
"cinnabar", "sphalerite", "tungsten", "sheldonite", "peridot", "sodalite",
|
||||
"lead", "silver" };
|
||||
private static final List<String> oreNamesList = Lists.newArrayList(ArrayUtils.arrayToLowercase(ores));
|
||||
public static final PropertyString VARIANTS = new PropertyString("type", oreNamesList);
|
||||
public static List<String> oreNamesList = Lists.newArrayList(ArrayUtils.arrayToLowercase(ores));
|
||||
public static final PropertyString VARIANTS = getVarients();
|
||||
@ConfigRegistry(config = "misc", category = "blocks", key = "rubyMinQuatity", comment = "Minimum quantity of Ruby gems per Ruby ore")
|
||||
public static int rubyMinQuatity = 1;
|
||||
@ConfigRegistry(config = "misc", category = "blocks", key = "rubyMaxQuantity", comment = "Maximum quantity of Ruby gems per Ruby ore")
|
||||
|
@ -100,12 +101,13 @@ public class BlockOre extends Block implements IOreNameProvider {
|
|||
setHarvestLevel("pickaxe", 2);
|
||||
this.setDefaultState(this.getStateFromMeta(0));
|
||||
for (int i = 0; i < ores.length; i++) {
|
||||
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, i).setInvVariant("type=" + ores[i]).setFileName("ores"));
|
||||
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, i).setInvVariant("type=" + OreBlockStateManager.convert(ores[i])).setFileName("ores"));
|
||||
}
|
||||
TRRecipeHandler.hideEntry(this);
|
||||
}
|
||||
|
||||
public static ItemStack getOreByName(String name, int count) {
|
||||
name = OreBlockStateManager.invert(name);
|
||||
for (int i = 0; i < ores.length; i++) {
|
||||
if (ores[i].equalsIgnoreCase(name)) {
|
||||
return new ItemStack(ModBlocks.ORE, count, i);
|
||||
|
@ -119,6 +121,7 @@ public class BlockOre extends Block implements IOreNameProvider {
|
|||
}
|
||||
|
||||
public IBlockState getBlockStateFromName(String name) {
|
||||
name = OreBlockStateManager.invert(name);
|
||||
int index = -1;
|
||||
for (int i = 0; i < ores.length; i++) {
|
||||
if (ores[i].equalsIgnoreCase(name)) {
|
||||
|
@ -142,28 +145,22 @@ public class BlockOre extends Block implements IOreNameProvider {
|
|||
if (variant.equalsIgnoreCase("Ruby")) {
|
||||
OreDrop ruby = new OreDrop(ItemGems.getGemByName("ruby", rubyMinQuatity), rubyMaxQuantity);
|
||||
drops.add(ruby.getDrops(fortune, random));
|
||||
}
|
||||
else if (variant.equalsIgnoreCase("Sapphire")) {
|
||||
} else if (variant.equalsIgnoreCase("Sapphire")) {
|
||||
OreDrop sapphire = new OreDrop(ItemGems.getGemByName("sapphire", sapphireMinQuantity), sapphireMaxQuantity);
|
||||
drops.add(sapphire.getDrops(fortune, random));
|
||||
}
|
||||
else if (variant.equalsIgnoreCase("Pyrite")) {
|
||||
} else if (variant.equalsIgnoreCase("Pyrite")) {
|
||||
OreDrop pyriteDust = new OreDrop(ItemDusts.getDustByName("pyrite", pyriteMinQuatity), pyriteMaxQuantity);
|
||||
drops.add(pyriteDust.getDrops(fortune, random));
|
||||
}
|
||||
else if (variant.equalsIgnoreCase("Sodalite")) {
|
||||
} else if (variant.equalsIgnoreCase("Sodalite")) {
|
||||
OreDrop sodalite = new OreDrop(ItemDusts.getDustByName("sodalite", sodaliteMinQuatity), sodaliteMaxQuantity);
|
||||
drops.add(sodalite.getDrops(fortune, random));
|
||||
}
|
||||
else if (variant.equalsIgnoreCase("Cinnabar")) {
|
||||
drops.add(sodalite.getDrops(fortune, random));
|
||||
} else if (variant.equalsIgnoreCase("Cinnabar")) {
|
||||
OreDrop cinnabar = new OreDrop(ItemDusts.getDustByName("cinnabar", cinnabarMinQuatity), cinnabarMaxQuantity);
|
||||
drops.add(cinnabar.getDrops(fortune, random));
|
||||
}
|
||||
else if (variant.equalsIgnoreCase("Sphalerite")) {
|
||||
} else if (variant.equalsIgnoreCase("Sphalerite")) {
|
||||
OreDrop sphalerite = new OreDrop(ItemDusts.getDustByName("sphalerite", sphaleriteMinQuatity), sphaleriteMaxQuantity);
|
||||
drops.add(sphalerite.getDrops(fortune, random));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
drops.add(new ItemStack(Item.getItemFromBlock(this), 1, meta));
|
||||
}
|
||||
|
||||
|
@ -216,4 +213,13 @@ public class BlockOre extends Block implements IOreNameProvider {
|
|||
return StringUtils.toFirstCapital(oreNamesList.get(getMetaFromState(state)));
|
||||
}
|
||||
|
||||
public static PropertyString getVarients() {
|
||||
if (OreBlockStateManager.endOreStone) {
|
||||
oreNamesList = BlockOre.oreNamesList.stream().map(OreBlockStateManager::convert).collect(Collectors.toList());
|
||||
return new PropertyString("type", oreNamesList);
|
||||
} else {
|
||||
return new PropertyString("type", BlockOre.oreNamesList);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
28
src/main/java/techreborn/blocks/OreBlockStateManager.java
Normal file
28
src/main/java/techreborn/blocks/OreBlockStateManager.java
Normal file
|
@ -0,0 +1,28 @@
|
|||
package techreborn.blocks;
|
||||
|
||||
import reborncore.common.registration.RebornRegistry;
|
||||
import reborncore.common.registration.impl.ConfigRegistry;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
||||
|
||||
//This is in its own class as not to load the block class before
|
||||
@RebornRegistry(modID = ModInfo.MOD_ID, priority = 1, earlyReg = true)
|
||||
public class OreBlockStateManager {
|
||||
//This is a one off config, dont worry about it
|
||||
@ConfigRegistry(config = "misc", category = "misc", key = "endOreStone", comment = "Set to true to render the end ores with a stone background")
|
||||
public static boolean endOreStone = false;
|
||||
|
||||
public static String convert(String name){
|
||||
if (OreBlockStateManager.endOreStone && name.equals("tungsten")) {
|
||||
name = "tungsten_stone";
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
public static String invert(String name){
|
||||
if (name.equals("tungsten_stone")) {
|
||||
name = "tungsten";
|
||||
}
|
||||
return name;
|
||||
}
|
||||
}
|
|
@ -55,6 +55,11 @@
|
|||
"all": "techreborn:blocks/ore/tungsten_ore"
|
||||
}
|
||||
},
|
||||
"tungsten_stone": {
|
||||
"textures": {
|
||||
"all": "techreborn:blocks/ore/tungsten_ore_stone"
|
||||
}
|
||||
},
|
||||
"sheldonite": {
|
||||
"textures": {
|
||||
"all": "techreborn:blocks/ore/sheldonite_ore"
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 444 B |
Loading…
Add table
Reference in a new issue