2017-10-04 17:05:04 +02:00
|
|
|
/*
|
|
|
|
* This file is part of Industrial Wires.
|
2018-02-28 21:06:33 +01:00
|
|
|
* Copyright (C) 2016-2018 malte0811
|
2017-10-04 17:05:04 +02:00
|
|
|
* Industrial Wires is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
* Industrial Wires is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with Industrial Wires. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2018-06-15 16:15:06 +02:00
|
|
|
package malte0811.industrialWires.mech_mb;
|
2017-10-04 17:05:04 +02:00
|
|
|
|
2018-02-17 20:37:53 +01:00
|
|
|
import blusunrize.immersiveengineering.ImmersiveEngineering;
|
2017-10-04 17:05:04 +02:00
|
|
|
import blusunrize.immersiveengineering.common.util.Utils;
|
|
|
|
import malte0811.industrialWires.util.LocalSidedWorld;
|
|
|
|
import net.minecraft.item.ItemStack;
|
2018-02-17 20:37:53 +01:00
|
|
|
import net.minecraft.util.ResourceLocation;
|
2017-10-04 17:05:04 +02:00
|
|
|
import net.minecraft.util.math.BlockPos;
|
|
|
|
import net.minecraftforge.oredict.OreDictionary;
|
|
|
|
|
|
|
|
public enum Material {
|
2018-02-17 20:37:53 +01:00
|
|
|
COPPER(8.96, 220, "blocks/storage_copper"),
|
|
|
|
ALUMINUM(2.7, 45, "blocks/storage_aluminum"),
|
|
|
|
LEAD(11.34, 12, "blocks/storage_lead"),
|
|
|
|
SILVER(10.49, 170, "blocks/storage_silver"),
|
|
|
|
NICKEL(8.908, 165, "blocks/storage_nickel"),
|
|
|
|
GOLD(19.3, 100, new ResourceLocation("minecraft", "blocks/gold_block")),
|
2018-02-28 21:03:26 +01:00
|
|
|
URANIUM(19.1, 400, "blocks/storage_uranium_side"),// This is a bit silly. But why not.
|
2018-02-17 20:37:53 +01:00
|
|
|
CONSTANTAN(8.885, 600, "blocks/storage_constantan"),
|
2018-05-12 19:04:38 +02:00
|
|
|
//Tensile strength is a guess ((GOLD+SILVER)/2), if anyone has better data I'll put it in
|
2018-06-04 18:10:52 +02:00
|
|
|
ELECTRUM((SILVER.density + GOLD.density) / 2e3, (SILVER.tensileStrength + GOLD.tensileStrength) / 2e6, "blocks/storage_electrum"),
|
2018-02-17 20:37:53 +01:00
|
|
|
STEEL(7.874, 1250, "blocks/storage_steel"),
|
|
|
|
IRON(7.874, 350, new ResourceLocation("minecraft", "blocks/iron_block")),
|
|
|
|
DIAMOND(3.5, 2800, new ResourceLocation("minecraft", "blocks/diamond_block"));
|
2018-02-02 17:20:53 +01:00
|
|
|
//in kg/m^3
|
2018-02-17 20:37:53 +01:00
|
|
|
public final double density;
|
|
|
|
public final double tensileStrength;
|
|
|
|
public final ResourceLocation blockTexture;
|
2017-10-04 17:05:04 +02:00
|
|
|
|
2018-02-08 22:08:21 +01:00
|
|
|
// density as parameter: g/cm^3
|
|
|
|
// tStrength: MPa
|
2018-02-17 20:37:53 +01:00
|
|
|
// assumes that resource domain is IE
|
|
|
|
Material(double density, double tensileStrength, String path) {
|
2018-02-02 17:20:53 +01:00
|
|
|
this.density = density*1e3;
|
2018-02-08 22:08:21 +01:00
|
|
|
this.tensileStrength = tensileStrength*1e6;
|
2018-02-17 20:37:53 +01:00
|
|
|
this.blockTexture = new ResourceLocation(ImmersiveEngineering.MODID, path);
|
|
|
|
}
|
|
|
|
Material(double density, double tensileStrength, ResourceLocation loc) {
|
|
|
|
this.density = density*1e3;
|
|
|
|
this.tensileStrength = tensileStrength*1e6;
|
|
|
|
this.blockTexture = loc;
|
2017-10-04 17:05:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public boolean matchesBlock(ItemStack block, String prefix) {
|
|
|
|
int[] ids = OreDictionary.getOreIDs(block);
|
|
|
|
for (int i : ids) {
|
|
|
|
if (OreDictionary.getOreName(i).equalsIgnoreCase(prefix + oreName())) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2018-02-17 20:37:53 +01:00
|
|
|
public String oreName() {
|
2017-10-04 17:05:04 +02:00
|
|
|
return name().substring(0, 1)+name().substring(1).toLowerCase();
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean matchesBlock(LocalSidedWorld w, BlockPos relative, String prefix) {
|
|
|
|
return Utils.isOreBlockAt(w.getWorld(), w.getRealPos(relative), prefix+oreName());
|
|
|
|
}
|
|
|
|
}
|