Ores use json
|
@ -1,7 +1,7 @@
|
|||
package techreborn.blocks;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import me.modmuss50.jsonDestroyer.api.ITexturedBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
@ -10,7 +10,6 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
|
@ -18,7 +17,6 @@ import net.minecraft.world.IBlockAccess;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import reborncore.common.BaseBlock;
|
||||
import reborncore.common.blocks.PropertyString;
|
||||
import reborncore.common.util.ArrayUtils;
|
||||
import reborncore.common.util.OreDrop;
|
||||
|
@ -35,7 +33,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockOre extends BaseBlock implements ITexturedBlock, IOreNameProvider {
|
||||
public class BlockOre extends Block implements IOreNameProvider {
|
||||
|
||||
public static final String[] ores = new String[] {
|
||||
"galena", "iridium", "ruby", "sapphire", "bauxite", "pyrite",
|
||||
|
@ -181,16 +179,6 @@ public class BlockOre extends BaseBlock implements ITexturedBlock, IOreNameProvi
|
|||
// return meta;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public String getTextureNameFromState(IBlockState BlockStateContainer, EnumFacing facing) {
|
||||
return "techreborn:blocks/ore/ore" + ores[getMetaFromState(BlockStateContainer)];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int amountOfStates() {
|
||||
return ores.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state) {
|
||||
return getMetaFromState(state);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package techreborn.blocks;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import me.modmuss50.jsonDestroyer.api.ITexturedBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
@ -9,14 +9,12 @@ import net.minecraft.creativetab.CreativeTabs;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import reborncore.common.BaseBlock;
|
||||
import reborncore.common.blocks.PropertyString;
|
||||
import reborncore.common.util.ArrayUtils;
|
||||
import reborncore.common.util.StringUtils;
|
||||
|
@ -27,7 +25,7 @@ import techreborn.world.config.IOreNameProvider;
|
|||
import java.security.InvalidParameterException;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockOre2 extends BaseBlock implements ITexturedBlock, IOreNameProvider {
|
||||
public class BlockOre2 extends Block implements IOreNameProvider {
|
||||
|
||||
public static final String[] ores = new String[] { "copper", "tin" };
|
||||
static List<String> oreNamesList = Lists.newArrayList(ArrayUtils.arrayToLowercase(ores));
|
||||
|
@ -105,16 +103,6 @@ public class BlockOre2 extends BaseBlock implements ITexturedBlock, IOreNameProv
|
|||
// return meta;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public String getTextureNameFromState(IBlockState BlockStateContainer, EnumFacing facing) {
|
||||
return "techreborn:blocks/ore/ore" + StringUtils.toFirstCapital(ores[getMetaFromState(BlockStateContainer)]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int amountOfStates() {
|
||||
return ores.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state) {
|
||||
return getMetaFromState(state);
|
||||
|
|
|
@ -5,6 +5,8 @@ import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import techreborn.blocks.BlockOre;
|
||||
import techreborn.blocks.BlockOre2;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.init.ModItems;
|
||||
import techreborn.items.*;
|
||||
|
@ -39,6 +41,8 @@ public class RegisterItemJsons {
|
|||
register(ModItems.diamondJackhammer, "tool/diamond_jackhammer");
|
||||
register(ModItems.advancedJackhammer, "tool/advanced_jackhammer");
|
||||
register(ModBlocks.rubberSapling, "misc/rubber_sapling");
|
||||
register(ModBlocks.ore, "techreborn.ore");
|
||||
register(ModBlocks.ore2, "techreborn.ore2");
|
||||
|
||||
for (int i = 0; i < ItemIngots.types.length; ++i) {
|
||||
String[] name = ItemIngots.types.clone();
|
||||
|
@ -74,6 +78,16 @@ public class RegisterItemJsons {
|
|||
String[] name = ItemUpgrades.types.clone();
|
||||
registerBlockstate(ModItems.upgrades, i, name[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < BlockOre.ores.length; ++i) {
|
||||
String[] name = BlockOre.ores.clone();
|
||||
registerBlockstate(ModBlocks.ore, i, name[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < BlockOre2.ores.length; ++i) {
|
||||
String[] name = BlockOre2.ores.clone();
|
||||
registerBlockstate(ModBlocks.ore2, i, name[i]);
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerBlocks() {
|
||||
|
@ -101,4 +115,9 @@ public class RegisterItemJsons {
|
|||
ResourceLocation loc = i.getRegistryName();
|
||||
ModelLoader.setCustomModelResourceLocation(i, meta, new ModelResourceLocation(loc, "type=" + variant));
|
||||
}
|
||||
|
||||
private static void registerBlockstate(Block i, int meta, String variant) {
|
||||
ResourceLocation loc = i.getRegistryName();
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(i), meta, new ModelResourceLocation(loc, "type=" + variant));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,85 @@
|
|||
{
|
||||
"forge_marker": 1,
|
||||
"defaults": {
|
||||
"textures": {},
|
||||
"transform": "forge:default-block",
|
||||
"model": "cube_all"
|
||||
},
|
||||
"variants": {
|
||||
"inventory": [
|
||||
{}
|
||||
],
|
||||
"type": {
|
||||
"galena": {
|
||||
"textures": {
|
||||
"all": "techreborn:blocks/ore/galena_ore"
|
||||
}
|
||||
},
|
||||
"iridium": {
|
||||
"textures": {
|
||||
"all": "techreborn:blocks/ore/iridium_ore"
|
||||
}
|
||||
},
|
||||
"ruby": {
|
||||
"textures": {
|
||||
"all": "techreborn:blocks/ore/ruby_ore"
|
||||
}
|
||||
},
|
||||
"sapphire": {
|
||||
"textures": {
|
||||
"all": "techreborn:blocks/ore/sapphire_ore"
|
||||
}
|
||||
},
|
||||
"bauxite": {
|
||||
"textures": {
|
||||
"all": "techreborn:blocks/ore/bauxite_ore"
|
||||
}
|
||||
},
|
||||
"pyrite": {
|
||||
"textures": {
|
||||
"all": "techreborn:blocks/ore/pyrite_ore"
|
||||
}
|
||||
},
|
||||
"cinnabar": {
|
||||
"textures": {
|
||||
"all": "techreborn:blocks/ore/cinnabar_ore"
|
||||
}
|
||||
},
|
||||
"sphalerite": {
|
||||
"textures": {
|
||||
"all": "techreborn:blocks/ore/sphalerite_ore"
|
||||
}
|
||||
},
|
||||
"tungsten": {
|
||||
"textures": {
|
||||
"all": "techreborn:blocks/ore/tungsten_ore"
|
||||
}
|
||||
},
|
||||
"sheldonite": {
|
||||
"textures": {
|
||||
"all": "techreborn:blocks/ore/sheldonite_ore"
|
||||
}
|
||||
},
|
||||
"peridot": {
|
||||
"textures": {
|
||||
"all": "techreborn:blocks/ore/peridot_ore"
|
||||
}
|
||||
},
|
||||
"sodalite": {
|
||||
"textures": {
|
||||
"all": "techreborn:blocks/ore/sodalite_ore"
|
||||
}
|
||||
},
|
||||
"lead": {
|
||||
"textures": {
|
||||
"all": "techreborn:blocks/ore/lead_ore"
|
||||
}
|
||||
},
|
||||
"silver": {
|
||||
"textures": {
|
||||
"all": "techreborn:blocks/ore/silver_ore"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"forge_marker": 1,
|
||||
"defaults": {
|
||||
"textures": {},
|
||||
"transform": "forge:default-block",
|
||||
"model": "cube_all"
|
||||
},
|
||||
"variants": {
|
||||
"inventory": [
|
||||
{}
|
||||
],
|
||||
"type": {
|
||||
"copper": {
|
||||
"textures": {
|
||||
"all": "techreborn:blocks/ore/copper_ore"
|
||||
}
|
||||
},
|
||||
"tin": {
|
||||
"textures": {
|
||||
"all": "techreborn:blocks/ore/tin_ore"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 323 B After Width: | Height: | Size: 323 B |
Before Width: | Height: | Size: 633 B After Width: | Height: | Size: 633 B |
Before Width: | Height: | Size: 356 B After Width: | Height: | Size: 356 B |
Before Width: | Height: | Size: 220 B After Width: | Height: | Size: 220 B |
Before Width: | Height: | Size: 349 B After Width: | Height: | Size: 349 B |
Before Width: | Height: | Size: 204 B After Width: | Height: | Size: 204 B |
Before Width: | Height: | Size: 320 B After Width: | Height: | Size: 320 B |
Before Width: | Height: | Size: 675 B After Width: | Height: | Size: 675 B |
Before Width: | Height: | Size: 296 B After Width: | Height: | Size: 296 B |
Before Width: | Height: | Size: 296 B After Width: | Height: | Size: 296 B |
Before Width: | Height: | Size: 317 B After Width: | Height: | Size: 317 B |
Before Width: | Height: | Size: 225 B After Width: | Height: | Size: 225 B |
Before Width: | Height: | Size: 307 B After Width: | Height: | Size: 307 B |
Before Width: | Height: | Size: 636 B After Width: | Height: | Size: 636 B |
Before Width: | Height: | Size: 370 B After Width: | Height: | Size: 370 B |
Before Width: | Height: | Size: 315 B After Width: | Height: | Size: 315 B |