Ores flattened
This commit is contained in:
parent
916c8c5ba4
commit
7393a8bdd6
3 changed files with 14 additions and 32 deletions
|
@ -26,7 +26,6 @@ package techreborn.blocks;
|
|||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
|
@ -36,8 +35,6 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.client.models.ModelCompound;
|
||||
import reborncore.client.models.RebornModelRegistry;
|
||||
import reborncore.common.blocks.PropertyString;
|
||||
import reborncore.common.registration.RebornRegistry;
|
||||
import reborncore.common.registration.impl.ConfigRegistry;
|
||||
|
@ -52,11 +49,6 @@ import java.util.Random;
|
|||
@RebornRegistry(modID = ModInfo.MOD_ID)
|
||||
public class BlockOre extends Block implements IOreNameProvider {
|
||||
|
||||
// public static final String[] ores = new String[] {
|
||||
// "galena", "iridium", "ruby", "sapphire", "bauxite", "pyrite",
|
||||
// "cinnabar", "sphalerite", "tungsten", "sheldonite", "peridot", "sodalite",
|
||||
// "lead", "silver" };
|
||||
// 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;
|
||||
|
@ -88,10 +80,6 @@ public class BlockOre extends Block implements IOreNameProvider {
|
|||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setHardness(2.0f);
|
||||
setHarvestLevel("pickaxe", 2);
|
||||
// TODO: Fix block
|
||||
// for (int i = 0; i < ores.length; i++) {
|
||||
// RebornModelRegistry.registerModel(new ModelCompound(ModInfo.MOD_ID, this, i).setInvVariant("type=" + OreBlockStateManager.convert(ores[i])).setFileName("ores"));
|
||||
// }
|
||||
}
|
||||
|
||||
// public static ItemStack getOreByName(String name, int count) {
|
||||
|
|
|
@ -150,20 +150,6 @@ public class RegisterItemJsons {
|
|||
});
|
||||
}
|
||||
|
||||
public static void setBlockStateMapper(Block block, String path, IProperty<?>... ignoredProperties) {
|
||||
final String slash = !path.isEmpty() ? "/" : "";
|
||||
ModelLoader.setCustomStateMapper(block, new DefaultStateMapper() {
|
||||
@Override
|
||||
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
|
||||
Map<IProperty<?>, Comparable<?>> map = Maps.<IProperty<?>, Comparable<?>>newLinkedHashMap(state.getProperties());
|
||||
for (IProperty<?> iproperty : ignoredProperties) {
|
||||
map.remove(iproperty);
|
||||
}
|
||||
return new ModelResourceLocation(new ResourceLocation(block.getRegistryName().getNamespace(), path + slash + block.getRegistryName().getPath()), this.getPropertyString(map));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static void registerBlocks() {
|
||||
register(ModBlocks.REFINED_IRON_FENCE, "iron_fence");
|
||||
}
|
||||
|
|
|
@ -24,11 +24,11 @@
|
|||
package techreborn.init;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.google.common.base.CaseFormat;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.block.statemap.DefaultStateMapper;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
@ -37,8 +37,6 @@ import net.minecraftforge.client.model.ModelLoader;
|
|||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import reborncore.RebornRegistry;
|
||||
import reborncore.client.models.ModelCompound;
|
||||
import reborncore.client.models.RebornModelRegistry;
|
||||
import techreborn.blocks.BlockOre;
|
||||
import techreborn.events.TRRecipeHandler;
|
||||
import techreborn.items.ItemTR;
|
||||
|
@ -97,8 +95,19 @@ public class TRIngredients {
|
|||
ResourceLocation platesRL = new ResourceLocation(ModInfo.MOD_ID, "items/materials/plates");
|
||||
Arrays.stream(Plates.values()).forEach(value -> ModelLoader.setCustomModelResourceLocation(value.item, 0,
|
||||
new ModelResourceLocation(platesRL, "type=" + value.name)));
|
||||
|
||||
ResourceLocation oresRL = new ResourceLocation(ModInfo.MOD_ID, "ores");
|
||||
for (Ores ore : Ores.values()) {
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ore.block), 0, new ModelResourceLocation(oresRL, "type=" + ore.name));
|
||||
ModelLoader.setCustomStateMapper(ore.block, new DefaultStateMapper() {
|
||||
@Override
|
||||
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
|
||||
return new ModelResourceLocation(oresRL, "type=" + ore.name);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static enum Ores implements IStringSerializable {
|
||||
BAUXITE, CINNABAR, COPPER, GALENA, IRIDIUM, LEAD, PERIDOT, PYRITE, RUBY, SAPPHIRE, SHELDONITE, SILVER, SODALITE,
|
||||
SPHALERITE, TIN, TUNGSTEN;
|
||||
|
@ -111,7 +120,6 @@ public class TRIngredients {
|
|||
block = new BlockOre();
|
||||
block.setRegistryName(new ResourceLocation(ModInfo.MOD_ID, name));
|
||||
block.setTranslationKey(ModInfo.MOD_ID + ".ore." + this.toString().toLowerCase());
|
||||
RebornModelRegistry.registerModel(new ModelCompound(ModInfo.MOD_ID, block).setInvVariant("type=" + name).setFileName("ores"));
|
||||
TRRecipeHandler.hideEntry(block);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue