damascus_steel_wasnt_dropping

This commit is contained in:
KitsuShadow
2016-02-09 10:12:44 -05:00
parent 50a967254c
commit 74e18f37fc
9 changed files with 255 additions and 3 deletions

View File

@@ -57,7 +57,7 @@ public class Main {
public static final String MODID = "kitsumedievalcraft";
public static final String MODNAME = "ForgeCraft";
public static final String VERSION = "2.3.8";
public static final String VERSION = "2.3.9";
public static SimpleNetworkWrapper sNet;

View File

@@ -84,10 +84,9 @@ public class CrucibleWootz extends CrucibleBase{
if(meta == 2){
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(Blocks.stone_slab, 1, 0)));
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(ModBlocks.emptyCookedCrucible, 1, 0)));
//world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(ModBlocks.damascusIngot, 1, 0)));
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(ModBlocks.damascus, 1, 0)));
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(Blocks.glass, 1, 0)));
}
}
}

View File

@@ -0,0 +1,81 @@
/*
package com.kitsu.medievalcraft.model_loader;
import java.util.Collection;
import java.util.Map;
import com.google.common.collect.Maps;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.obj.ObjModelLoader;
import net.minecraftforge.client.model.techne.TechneModelLoader;
import net.minecraftforge.common.ForgeVersion.Status;
/**
* Common interface for advanced model loading from files, based on file suffix
* Model support can be queried through the {@link #getSupportedSuffixes()} method.
* Instances can be created by calling {loadModel(String)} with a class-loadable-path
*
* @author cpw
*
@SideOnly(Side.CLIENT)
public class AdvancedModelLoader {
private static Map<String, IModelCustomLoader> instances = Maps.newHashMap();
/**
* Register a new model handler
* @param modelHandler The model handler to register
public static void registerModelHandler(IModelCustomLoader modelHandler)
{
for (String suffix : modelHandler.getSuffixes())
{
instances.put(suffix, modelHandler);
}
}
/**
* Load the model from the supplied classpath resolvable resource name
* @param resource The resource name
* @return A model
* @throws IllegalArgumentException if the resource name cannot be understood
* @throws ModelFormatException if the underlying model handler cannot parse the model format
public static IModelCustom loadModel(ResourceLocation resource) throws IllegalArgumentException, ModelFormatException
{
String name = resource.getResourcePath();
int i = name.lastIndexOf('.');
if (i == -1)
{
FMLLog.severe("The resource name %s is not valid", resource);
throw new IllegalArgumentException("The resource name is not valid");
}
String suffix = name.substring(i+1);
IModelCustomLoader loader = instances.get(suffix);
if (loader == null)
{
FMLLog.severe("The resource name %s is not supported", resource);
throw new IllegalArgumentException("The resource name is not supported");
}
return loader.loadInstance(resource);
}
public static Collection<String> getSupportedSuffixes()
{
return instances.keySet();
}
static
{
registerModelHandler(new ObjModelLoader());
registerModelHandler(new TechneModelLoader());
}
}
*/

View File

@@ -0,0 +1,17 @@
package com.kitsu.medievalcraft.model_loader;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public interface IModelCustom
{
String getType();
@SideOnly(Side.CLIENT)
void renderAll();
@SideOnly(Side.CLIENT)
void renderOnly(String... groupNames);
@SideOnly(Side.CLIENT)
void renderPart(String partName);
@SideOnly(Side.CLIENT)
void renderAllExcept(String... excludedGroupNames);
}

View File

@@ -0,0 +1,30 @@
package com.kitsu.medievalcraft.model_loader;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.ModelFormatException;
/**
* Instances of this class act as factories for their model type
*
* @author cpw
*
*/
public interface IModelCustomLoader {
/**
* Get the main type name for this loader
* @return the type name
*/
String getType();
/**
* Get resource suffixes this model loader recognizes
* @return a list of suffixes
*/
String[] getSuffixes();
/**
* Load a model instance from the supplied path
* @param resource The ResourceLocation of the model
* @return A model instance
* @throws ModelFormatException if the model format is not correct
*/
IModelCustom loadInstance(ResourceLocation resource) throws ModelFormatException;
}

View File

@@ -0,0 +1,33 @@
package com.kitsu.medievalcraft.model_loader;
/**
* Thrown if there is a problem parsing the model
*
* @author cpw
*
*/
public class ModelFormatException extends RuntimeException {
private static final long serialVersionUID = 2023547503969671835L;
public ModelFormatException()
{
super();
}
public ModelFormatException(String message, Throwable cause)
{
super(message, cause);
}
public ModelFormatException(String message)
{
super(message);
}
public ModelFormatException(Throwable cause)
{
super(cause);
}
}

View File

@@ -0,0 +1,92 @@
/*
package com.kitsu.medievalcraft.model_loader.obj;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.util.Vec3;
import net.minecraftforge.client.model.obj.TextureCoordinate;
import net.minecraftforge.client.model.obj.Vertex;
public class Face
{
public Vertex[] vertices;
public Vertex[] vertexNormals;
public Vertex faceNormal;
public TextureCoordinate[] textureCoordinates;
@SideOnly(Side.CLIENT)
public void addFaceForRender(WorldRenderer worldRenderer)
{
addFaceForRender(worldRenderer, 0.0005F);
}
@SideOnly(Side.CLIENT)
public void addFaceForRender(WorldRenderer worldRenderer, float textureOffset)
{
if (faceNormal == null)
{
faceNormal = this.calculateFaceNormal();
}
//worldRenderer.normal(faceNormal.x, faceNormal.y, faceNormal.z);
float averageU = 0F;
float averageV = 0F;
if ((textureCoordinates != null) && (textureCoordinates.length > 0))
{
for (int i = 0; i < textureCoordinates.length; ++i)
{
averageU += textureCoordinates[i].u;
averageV += textureCoordinates[i].v;
}
averageU = averageU / textureCoordinates.length;
averageV = averageV / textureCoordinates.length;
}
float offsetU, offsetV;
for (int i = 0; i < vertices.length; ++i)
{
if ((textureCoordinates != null) && (textureCoordinates.length > 0))
{
offsetU = textureOffset;
offsetV = textureOffset;
if (textureCoordinates[i].u > averageU)
{
offsetU = -offsetU;
}
if (textureCoordinates[i].v > averageV)
{
offsetV = -offsetV;
}
worldRenderer.pos(vertices[i].x, vertices[i].y, vertices[i].z).tex(textureCoordinates[i].u + offsetU,
textureCoordinates[i].v + offsetV);
}
else
{
worldRenderer.pos(vertices[i].x, vertices[i].y, vertices[i].z);
}
}
}
public Vertex calculateFaceNormal()
{
Vec3 v0 = new Vec3(vertices[1].x - vertices[0].x, vertices[1].y - vertices[0].y, vertices[1].z - vertices[0].z);
//Vec3 v1 = new Vec3(, , );
//Vec3 v2 = new Vec3(vertices[2].x - vertices[0].x, vertices[2].y - vertices[0].y, vertices[2].z - vertices[0].z);
Vec3 normalVector = null;
//normalVector = v1.crossProduct(v2).normalize();
return new Vertex((float) normalVector.xCoord, (float) normalVector.yCoord, (float) normalVector.zCoord);
}
}
*/