aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus')
-rw-r--r--src/Java/gtPlusPlus/core/block/base/BlockBaseOre.java62
-rw-r--r--src/Java/gtPlusPlus/core/client/renderer/CustomOreBlockRenderer.java199
-rw-r--r--src/Java/gtPlusPlus/core/material/Material.java17
-rw-r--r--src/Java/gtPlusPlus/core/proxy/ClientProxy.java10
-rw-r--r--src/Java/gtPlusPlus/core/util/materials/MaterialUtils.java25
-rw-r--r--src/Java/gtPlusPlus/core/world/darkworld/gen/gt/WorldGen_GT_Base.java6
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Ore.java148
7 files changed, 421 insertions, 46 deletions
diff --git a/src/Java/gtPlusPlus/core/block/base/BlockBaseOre.java b/src/Java/gtPlusPlus/core/block/base/BlockBaseOre.java
index bc0c12fd2f..cb0961eb66 100644
--- a/src/Java/gtPlusPlus/core/block/base/BlockBaseOre.java
+++ b/src/Java/gtPlusPlus/core/block/base/BlockBaseOre.java
@@ -1,17 +1,22 @@
package gtPlusPlus.core.block.base;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
-import gtPlusPlus.core.block.base.BasicBlock.BlockTypes;
-import gtPlusPlus.core.lib.CORE;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.OrePrefixes;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.ITexturedTileEntity;
+import gregtech.api.objects.GT_CopiedBlockTexture;
+import gregtech.api.objects.GT_RenderedTexture;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.client.renderer.CustomOreBlockRenderer;
import gtPlusPlus.core.material.Material;
-import gtPlusPlus.core.util.math.MathUtils;
-import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.block.Block;
import net.minecraft.entity.EnumCreatureType;
+import net.minecraft.init.Blocks;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
-public class BlockBaseOre extends BlockBaseModular{
+public class BlockBaseOre extends BlockBaseModular implements ITexturedTileEntity {
@SuppressWarnings("unused")
private IIcon base;
@@ -24,7 +29,7 @@ public class BlockBaseOre extends BlockBaseModular{
}*/
protected Material blockMaterial;
-
+
protected int blockColour;
protected BlockTypes thisBlock;
protected String thisBlockMaterial;
@@ -32,8 +37,9 @@ public class BlockBaseOre extends BlockBaseModular{
public BlockBaseOre(final Material material, final BlockTypes blockType, final int colour) {
this(material.getUnlocalizedName(), material.getLocalizedName(), net.minecraft.block.material.Material.iron, blockType, colour, 3);
+ blockMaterial = material;
}
-
+
public BlockBaseOre(final String unlocalizedName, final String blockMaterial, final BlockTypes blockType, final int colour) {
this(unlocalizedName, blockMaterial, net.minecraft.block.material.Material.iron, blockType, colour, 2);
@@ -64,16 +70,16 @@ public class BlockBaseOre extends BlockBaseModular{
return true;
}*/
- @Override
+ /*@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(final IIconRegister iIcon)
{
this.blockIcon = iIcon.registerIcon(CORE.MODID + ":" + this.thisBlock.getTexture());
//this.base = iIcon.registerIcon(CORE.MODID + ":" + "blockStone");
//this.overlay = iIcon.registerIcon(CORE.MODID + ":" + "blockOre_Overlay");
- }
+ }*/
- @Override
+ /*@Override
public int colorMultiplier(final IBlockAccess par1IBlockAccess, final int par2, final int par3, final int par4){
if (this.blockColour == 0){
return MathUtils.generateSingularRandomHexValue();
@@ -87,13 +93,43 @@ public class BlockBaseOre extends BlockBaseModular{
return MathUtils.generateSingularRandomHexValue();
}
return this.blockColour;
- }
+ }*/
@Override
public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y, final int z) {
return false;
}
+ @Override
+ public int getRenderType() {
+ return CustomOreBlockRenderer.INSTANCE.mRenderID;
+ }
+
+ @Override
+ public IIcon getIcon(IBlockAccess aIBlockAccess, int aX, int aY, int aZ, int aSide) {
+ return Blocks.stone.getIcon(0, 0);
+ }
+
+ @Override
+ public IIcon getIcon(int aSide, int aMeta) {
+ return Blocks.stone.getIcon(0, 0);
+ }
+
+ /**
+ * GT Texture Handler
+ */
+
+ @Override
+ public ITexture[] getTexture(Block block, byte side) {
+ if (this.blockMaterial != null){
+ GT_RenderedTexture aIconSet = new GT_RenderedTexture(Materials.Iron.mIconSet.mTextures[OrePrefixes.ore.mTextureIndex], this.blockMaterial.getRGBA());
+ if (aIconSet != null){
+ //Logger.INFO("[Render] Good Overlay.");
+ return new ITexture[]{new GT_CopiedBlockTexture(Blocks.stone, 0, 0), aIconSet};
+ }
+ }
+ return new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.STONES[0], new short[]{240, 240, 240, 0})};
+ }
diff --git a/src/Java/gtPlusPlus/core/client/renderer/CustomOreBlockRenderer.java b/src/Java/gtPlusPlus/core/client/renderer/CustomOreBlockRenderer.java
new file mode 100644
index 0000000000..0c94cfe993
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/client/renderer/CustomOreBlockRenderer.java
@@ -0,0 +1,199 @@
+package gtPlusPlus.core.client.renderer;
+
+import org.lwjgl.opengl.GL11;
+
+import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
+import cpw.mods.fml.client.registry.RenderingRegistry;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.ITexturedTileEntity;
+import gtPlusPlus.api.objects.Logger;
+import net.minecraft.block.Block;
+import net.minecraft.client.renderer.RenderBlocks;
+import net.minecraft.client.renderer.Tessellator;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.IBlockAccess;
+
+public class CustomOreBlockRenderer implements ISimpleBlockRenderingHandler{
+
+ public static CustomOreBlockRenderer INSTANCE;
+ public final int mRenderID;
+
+ public CustomOreBlockRenderer() {
+ this.mRenderID = RenderingRegistry.getNextAvailableRenderId();
+ INSTANCE = this;
+ RenderingRegistry.registerBlockHandler(this);
+ Logger.INFO("Registered Custom Ore Block Renderer.");
+ }
+
+ public static boolean renderStandardBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, RenderBlocks aRenderer) {
+ Block tTileEntity = aBlock;
+ if ((tTileEntity instanceof ITexturedTileEntity)) {
+ return renderStandardBlock(aWorld, aX, aY, aZ, aBlock, aRenderer, new ITexture[][]{((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) 0), ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) 1), ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) 2), ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) 3), ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) 4), ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) 5)});
+ }
+ return false;
+ }
+
+ public static boolean renderStandardBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, RenderBlocks aRenderer, ITexture[][] aTextures) {
+ aBlock.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+
+ renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[0], true);
+ renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[1], true);
+ renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[2], true);
+ renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[3], true);
+ renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[4], true);
+ renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[5], true);
+ return true;
+ }
+
+ public static void renderNegativeYFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, ITexture[] aIcon, boolean aFullBlock) {
+ if (aWorld != null) {
+ if ((aFullBlock) && (!aBlock.shouldSideBeRendered(aWorld, aX, aY - 1, aZ, 0))) {
+ return;
+ }
+ Tessellator.instance.setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aFullBlock ? aY - 1 : aY, aZ));
+ }
+ if (aIcon != null) {
+ for (int i = 0; i < aIcon.length; i++) {
+ if (aIcon[i] != null) {
+ aIcon[i].renderYNeg(aRenderer, aBlock, aX, aY, aZ);
+ }
+ }
+ }
+ aRenderer.flipTexture = false;
+ }
+
+ public static void renderPositiveYFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, ITexture[] aIcon, boolean aFullBlock) {
+ if (aWorld != null) {
+ if ((aFullBlock) && (!aBlock.shouldSideBeRendered(aWorld, aX, aY + 1, aZ, 1))) {
+ return;
+ }
+ Tessellator.instance.setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aFullBlock ? aY + 1 : aY, aZ));
+ }
+ if (aIcon != null) {
+ for (int i = 0; i < aIcon.length; i++) {
+ if (aIcon[i] != null) {
+ aIcon[i].renderYPos(aRenderer, aBlock, aX, aY, aZ);
+ }
+ }
+ }
+ aRenderer.flipTexture = false;
+ }
+
+ public static void renderNegativeZFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, ITexture[] aIcon, boolean aFullBlock) {
+ if (aWorld != null) {
+ if ((aFullBlock) && (!aBlock.shouldSideBeRendered(aWorld, aX, aY, aZ - 1, 2))) {
+ return;
+ }
+ Tessellator.instance.setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aY, aFullBlock ? aZ - 1 : aZ));
+ }
+ aRenderer.flipTexture = (!aFullBlock);
+ if (aIcon != null) {
+ for (int i = 0; i < aIcon.length; i++) {
+ if (aIcon[i] != null) {
+ aIcon[i].renderZNeg(aRenderer, aBlock, aX, aY, aZ);
+ }
+ }
+ }
+ aRenderer.flipTexture = false;
+ }
+
+ public static void renderPositiveZFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, ITexture[] aIcon, boolean aFullBlock) {
+ if (aWorld != null) {
+ if ((aFullBlock) && (!aBlock.shouldSideBeRendered(aWorld, aX, aY, aZ + 1, 3))) {
+ return;
+ }
+ Tessellator.instance.setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aY, aFullBlock ? aZ + 1 : aZ));
+ }
+ if (aIcon != null) {
+ for (int i = 0; i < aIcon.length; i++) {
+ if (aIcon[i] != null) {
+ aIcon[i].renderZPos(aRenderer, aBlock, aX, aY, aZ);
+ }
+ }
+ }
+ aRenderer.flipTexture = false;
+ }
+
+ public static void renderNegativeXFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, ITexture[] aIcon, boolean aFullBlock) {
+ if (aWorld != null) {
+ if ((aFullBlock) && (!aBlock.shouldSideBeRendered(aWorld, aX - 1, aY, aZ, 4))) {
+ return;
+ }
+ Tessellator.instance.setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aFullBlock ? aX - 1 : aX, aY, aZ));
+ }
+ if (aIcon != null) {
+ for (int i = 0; i < aIcon.length; i++) {
+ if (aIcon[i] != null) {
+ aIcon[i].renderXNeg(aRenderer, aBlock, aX, aY, aZ);
+ }
+ }
+ }
+ aRenderer.flipTexture = false;
+ }
+
+ public static void renderPositiveXFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, ITexture[] aIcon, boolean aFullBlock) {
+ if (aWorld != null) {
+ if ((aFullBlock) && (!aBlock.shouldSideBeRendered(aWorld, aX + 1, aY, aZ, 5))) {
+ return;
+ }
+ Tessellator.instance.setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aFullBlock ? aX + 1 : aX, aY, aZ));
+ }
+ aRenderer.flipTexture = (!aFullBlock);
+ if (aIcon != null) {
+ for (int i = 0; i < aIcon.length; i++) {
+ if (aIcon[i] != null) {
+ aIcon[i].renderXPos(aRenderer, aBlock, aX, aY, aZ);
+ }
+ }
+ }
+ aRenderer.flipTexture = false;
+ }
+
+ public void renderInventoryBlock(Block aBlock, int aMeta, int aModelID, RenderBlocks aRenderer) {
+ aBlock.setBlockBoundsForItemRender();
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
+ GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
+ Tessellator.instance.startDrawingQuads();
+ Tessellator.instance.setNormal(0.0F, -1.0F, 0.0F);
+ renderNegativeYFacing(null, aRenderer, aBlock, 0, 0, 0, ((ITexturedTileEntity) aBlock).getTexture(aBlock, (byte) 0), true);
+ Tessellator.instance.draw();
+ Tessellator.instance.startDrawingQuads();
+ Tessellator.instance.setNormal(0.0F, 1.0F, 0.0F);
+ renderPositiveYFacing(null, aRenderer, aBlock, 0, 0, 0, ((ITexturedTileEntity) aBlock).getTexture(aBlock, (byte) 1), true);
+ Tessellator.instance.draw();
+ Tessellator.instance.startDrawingQuads();
+ Tessellator.instance.setNormal(0.0F, 0.0F, -1.0F);
+ renderNegativeZFacing(null, aRenderer, aBlock, 0, 0, 0, ((ITexturedTileEntity) aBlock).getTexture(aBlock, (byte) 2), true);
+ Tessellator.instance.draw();
+ Tessellator.instance.startDrawingQuads();
+ Tessellator.instance.setNormal(0.0F, 0.0F, 1.0F);
+ renderPositiveZFacing(null, aRenderer, aBlock, 0, 0, 0, ((ITexturedTileEntity) aBlock).getTexture(aBlock, (byte) 3), true);
+ Tessellator.instance.draw();
+ Tessellator.instance.startDrawingQuads();
+ Tessellator.instance.setNormal(-1.0F, 0.0F, 0.0F);
+ renderNegativeXFacing(null, aRenderer, aBlock, 0, 0, 0, ((ITexturedTileEntity) aBlock).getTexture(aBlock, (byte) 4), true);
+ Tessellator.instance.draw();
+ Tessellator.instance.startDrawingQuads();
+ Tessellator.instance.setNormal(1.0F, 0.0F, 0.0F);
+ renderPositiveXFacing(null, aRenderer, aBlock, 0, 0, 0, ((ITexturedTileEntity) aBlock).getTexture(aBlock, (byte) 5), true);
+ Tessellator.instance.draw();
+ aBlock.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
+ aRenderer.setRenderBoundsFromBlock(aBlock);
+ GL11.glTranslatef(0.5F, 0.5F, 0.5F);
+ }
+
+ public boolean renderWorldBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, int aModelID, RenderBlocks aRenderer) {
+ return renderStandardBlock(aWorld, aX, aY, aZ, aBlock, aRenderer);
+ }
+
+ public boolean shouldRender3DInInventory(int aModel) {
+ return true;
+ }
+
+ public int getRenderId() {
+ return this.mRenderID;
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/core/material/Material.java b/src/Java/gtPlusPlus/core/material/Material.java
index 796d48b967..751a371bdb 100644
--- a/src/Java/gtPlusPlus/core/material/Material.java
+++ b/src/Java/gtPlusPlus/core/material/Material.java
@@ -104,7 +104,10 @@ public class Material {
try {
this.unlocalizedName = Utils.sanitizeString(materialName);
this.localizedName = materialName;
+
this.materialState = defaultState;
+ Logger.MATERIALS(this.getLocalizedName()+" is "+defaultState.name()+".");
+
this.RGBA = rgba;
this.vGenerateCells = generateCells;
@@ -332,12 +335,24 @@ public class Material {
return this.materialState;
}
- final public short[] getRGBA(){
+ final public short[] getRGB(){
if (this.RGBA != null) {
return this.RGBA;
}
return new short[] {255,0,0};
}
+
+ final public short[] getRGBA(){
+ if (this.RGBA != null) {
+ if (this.RGBA.length == 4){
+ return this.RGBA;
+ }
+ else {
+ return new short[]{this.RGBA[0], this.RGBA[1], this.RGBA[2], 0};
+ }
+ }
+ return new short[] {255,0,0, 0};
+ }
final public int getRgbAsHex(){
diff --git a/src/Java/gtPlusPlus/core/proxy/ClientProxy.java b/src/Java/gtPlusPlus/core/proxy/ClientProxy.java
index f20c3ef91a..924a8070a4 100644
--- a/src/Java/gtPlusPlus/core/proxy/ClientProxy.java
+++ b/src/Java/gtPlusPlus/core/proxy/ClientProxy.java
@@ -78,6 +78,12 @@ public class ClientProxy extends CommonProxy implements Runnable{
if (LoadedMods.PlayerAPI){
this.init_PlayerAPI_INIT();
}
+
+ /**
+ * Custom Block Renderers
+ */
+ new CustomOreBlockRenderer();
+
super.init(e);
}
@@ -106,6 +112,10 @@ public class ClientProxy extends CommonProxy implements Runnable{
//MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.tutChest), new ItemRenderBloodSteelChest());
Logger.INFO("Registering Custom Renderer for the Fire Pit.");
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityFirepit.class, new FirepitRender());
+
+ //Special Renderers
+ //RenderingRegistry.registerBlockHandler((CustomOreBlockRenderer.mRenderID=RenderingRegistry.getNextAvailableRenderId()), new CustomOreBlockRenderer());
+
}
@Override
diff --git a/src/Java/gtPlusPlus/core/util/materials/MaterialUtils.java b/src/Java/gtPlusPlus/core/util/materials/MaterialUtils.java
index 48279a91d9..cc9a679193 100644
--- a/src/Java/gtPlusPlus/core/util/materials/MaterialUtils.java
+++ b/src/Java/gtPlusPlus/core/util/materials/MaterialUtils.java
@@ -5,6 +5,7 @@ import java.util.List;
import org.apache.commons.lang3.reflect.FieldUtils;
import gregtech.api.enums.*;
+import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.material.Material;
import gtPlusPlus.core.material.state.MaterialState;
import gtPlusPlus.core.util.StringUtils;
@@ -44,6 +45,7 @@ public class MaterialUtils {
final long neutrons = material.getNeutrons();
final boolean blastFurnace = material.mBlastFurnaceRequired;
final int durability = material.mDurability;
+ boolean mGenerateCell = false;
MaterialState materialState;
final String chemicalFormula = StringUtils.subscript(Utils.sanitizeString(material.mChemicalFormula));
final Element element = material.mElement;
@@ -53,19 +55,34 @@ public class MaterialUtils {
}
//Determine default state
- if (material.getMolten(1) != null){
+ Logger.MATERIALS("[Debug] Setting State of GT generated material.");
+ if (material.getMolten(1) != null || material.getSolid(1) != null){
materialState = MaterialState.SOLID;
+ Logger.MATERIALS("[Debug] Molten or Solid was not null.");
+ if (material.getMolten(1) == null && material.getSolid(1) != null){
+ Logger.MATERIALS("[Debug] Molten is Null, Solid is not. Enabling cell generation.");
+ mGenerateCell = true;
+ }
+ else if (material.getMolten(1) != null && material.getSolid(1) == null){
+ Logger.MATERIALS("[Debug] Molten is not Null, Solid is null. Not enabling cell generation.");
+ //mGenerateCell = true;
+ }
+ Logger.MATERIALS("[Debug] State set as solid.");
}
else if (material.getFluid(1) != null){
+ Logger.MATERIALS("[Debug] State set as liquid.");
materialState = MaterialState.LIQUID;
}
else if (material.getGas(1) != null){
+ Logger.MATERIALS("[Debug] State set as gas.");
materialState = MaterialState.GAS;
- }
+ }/*
else if (material.getPlasma(1) != null){
+ Logger.MATERIALS("[Debug] State set as plasma.");
materialState = MaterialState.PLASMA;
- }
+ }*/
else {
+ Logger.MATERIALS("[Debug] State set as solid.");
materialState = MaterialState.SOLID;
}
@@ -77,7 +94,7 @@ public class MaterialUtils {
if (hasValidRGBA(rgba) || (element == Element.H) || ((material == Materials.InfusedAir) || (material == Materials.InfusedFire) || (material == Materials.InfusedEarth) || (material == Materials.InfusedWater))){
//ModItems.itemBaseDecidust = UtilsItems.generateDecidust(material);
//ModItems.itemBaseCentidust = UtilsItems.generateCentidust(material);
- return new Material(name, materialState, durability, rgba, melting, boiling, protons, neutrons, blastFurnace, chemicalFormula, radioactivity, false);
+ return new Material(name, materialState, durability, rgba, melting, boiling, protons, neutrons, blastFurnace, chemicalFormula, radioactivity, mGenerateCell);
}
return null;
diff --git a/src/Java/gtPlusPlus/core/world/darkworld/gen/gt/WorldGen_GT_Base.java b/src/Java/gtPlusPlus/core/world/darkworld/gen/gt/WorldGen_GT_Base.java
index f04609dc6f..608bf91e58 100644
--- a/src/Java/gtPlusPlus/core/world/darkworld/gen/gt/WorldGen_GT_Base.java
+++ b/src/Java/gtPlusPlus/core/world/darkworld/gen/gt/WorldGen_GT_Base.java
@@ -109,10 +109,10 @@ public class WorldGen_GT_Base implements IWorldGenerator{
//...
}
- private void generateDarkWorld(Random aRandom, int aX, int aZ, World aWorld, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider){
+ private synchronized void generateDarkWorld(Random aRandom, int aX, int aZ, World aWorld, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider){
synchronized (listLock)
{
- WorldGen_GT_Base.mList.add(new WorldGenContainer(new XSTR(Math.abs(aRandom.nextInt()) +1), aX, aZ, ((aChunkGenerator instanceof ChunkProviderEnd)) || (aWorld.getBiomeGenForCoords(aX * 16 + 8, aZ * 16 + 8) == BiomeGenBase.sky) ? 1 : ((aChunkGenerator instanceof ChunkProviderHell)) || (aWorld.getBiomeGenForCoords(aX * 16 + 8, aZ * 16 + 8) == BiomeGenBase.hell) ? -1 : 0, aWorld, aChunkGenerator, aChunkProvider, aWorld.getBiomeGenForCoords(aX * 16 + 8, aZ * 16 + 8).biomeName));
+ WorldGen_GT_Base.mList.add(new WorldGenContainer(new CSPRNG(Math.abs(aRandom.nextInt()) +1), aX, aZ, ((aChunkGenerator instanceof ChunkProviderEnd)) || (aWorld.getBiomeGenForCoords(aX * 16 + 8, aZ * 16 + 8) == BiomeGenBase.sky) ? 1 : ((aChunkGenerator instanceof ChunkProviderHell)) || (aWorld.getBiomeGenForCoords(aX * 16 + 8, aZ * 16 + 8) == BiomeGenBase.hell) ? -1 : 0, aWorld, aChunkGenerator, aChunkProvider, aWorld.getBiomeGenForCoords(aX * 16 + 8, aZ * 16 + 8).biomeName));
if (debugWorldGen) GT_Log.out.println(
"ADD WorldSeed:"+aWorld.getSeed() +
" DimId" + aWorld.provider.dimensionId +
@@ -229,7 +229,7 @@ public class WorldGen_GT_Base implements IWorldGenerator{
);
// Search for a valid orevein for this dimension
- if(validOreveins.size() > 0 && !validOreveins.containsKey(oreveinSeed) ) {
+ if(!validOreveins.containsKey(oreveinSeed) ) {
if ( (oreveinPercentageRoll<oreveinPercentage) && (WorldGen_GT_Ore_Layer.sWeight > 0) && (WorldGen_GT_Ore_Layer.sList.size() > 0)) {
int placementAttempts = 0;
boolean oreveinFound = false;
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Ore.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Ore.java
index f060895ccc..5be4e13d28 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Ore.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Ore.java
@@ -1,7 +1,9 @@
package gtPlusPlus.xmod.gregtech.loaders;
+import gregtech.api.GregTech_API;
import gregtech.api.enums.GT_Values;
import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_Recipe;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.material.Material;
import gtPlusPlus.core.material.MaterialStack;
@@ -31,25 +33,26 @@ public class RecipeGen_Ore implements Runnable{
public static void generateRecipes(final Material material){
if (material.getMaterialComposites().length > 1){
- final int tVoltageMultiplier = material.getMeltingPointK() >= 2800 ? 60 : 15;
+ Logger.MATERIALS("[Recipe Generator Debug] ["+material.getLocalizedName()+"]");
+ final int tVoltageMultiplier = material.getMeltingPointK() >= 2800 ? 120 : 30;
final ItemStack dustStone = ItemUtils.getItemStackOfAmountFromOreDict("dustStone", 1);
Material bonusA; //Ni
Material bonusB; //Tin
- if (material.getComposites().get(1) != null){
+ if (material.getComposites().get(0) != null){
bonusA = material.getComposites().get(1).getStackMaterial();
}
else {
return ;
}
- if (material.getComposites().get(2) != null){
+ if (material.getComposites().get(1) != null){
bonusB = material.getComposites().get(2).getStackMaterial();
}
- else if (material.getComposites().get(1) != null){
- bonusB = material.getComposites().get(1).getStackMaterial();
+ else if (material.getComposites().get(0) != null){
+ bonusB = material.getComposites().get(0).getStackMaterial();
}
else {
- return ;
+ return;
}
AutoMap<Pair<Integer, Material>> componentMap = new AutoMap<Pair<Integer, Material>>();
@@ -64,40 +67,60 @@ public class RecipeGen_Ore implements Runnable{
* Macerate
*/
//Macerate ore to Crushed
- GT_Values.RA.addPulveriserRecipe(material.getOre(1), new ItemStack[]{material.getCrushed(2)}, new int[]{10000}, 20*20, 2);
+ if (GT_Values.RA.addPulveriserRecipe(material.getOre(1), new ItemStack[]{material.getCrushed(2)}, new int[]{10000}, 20*20, 2)){
+ Logger.MATERIALS("[Macerator] Added Recipe: 'Macerate ore to Crushed ore'");
+ }
//Macerate Crushed to Impure Dust
- GT_Values.RA.addPulveriserRecipe(material.getCrushed(1), new ItemStack[]{material.getDustImpure(1), bonusA.getDust(1)}, new int[]{10000, 1000}, 20*20, 2);
+ if (GT_Values.RA.addPulveriserRecipe(material.getCrushed(1), new ItemStack[]{material.getDustImpure(1), bonusA.getDust(1)}, new int[]{10000, 1000}, 20*20, 2)){
+ Logger.MATERIALS("[Macerator] Added Recipe: 'Macerate Crushed ore to Impure Dust'");
+ }
//Macerate Washed to Purified Dust
- GT_Values.RA.addPulveriserRecipe(material.getCrushedPurified(1), new ItemStack[]{material.getDustPurified(1), bonusA.getDust(1)}, new int[]{10000, 1000}, 20*20, 2);
+ if (GT_Values.RA.addPulveriserRecipe(material.getCrushedPurified(1), new ItemStack[]{material.getDustPurified(1), bonusA.getDust(1)}, new int[]{10000, 1000}, 20*20, 2)){
+ Logger.MATERIALS("[Macerator] Added Recipe: 'Macerate Washed ore to Purified Dust'");
+ }
//Macerate Centrifuged to Pure Dust
- GT_Values.RA.addPulveriserRecipe(material.getCrushedCentrifuged(1), new ItemStack[]{material.getDust(1), bonusA.getDust(1)}, new int[]{10000, 1000}, 20*20, 2);
+ if (GT_Values.RA.addPulveriserRecipe(material.getCrushedCentrifuged(1), new ItemStack[]{material.getDust(1), bonusA.getDust(1)}, new int[]{10000, 1000}, 20*20, 2)){
+ Logger.MATERIALS("[Macerator] Added Recipe: 'Macerate Centrifuged ore to Pure Dust'");
+ }
/**
* Wash
*/
//Wash into Purified Crushed
- GT_Values.RA.addOreWasherRecipe(material.getCrushed(1), material.getCrushedPurified(1), bonusA.getTinyDust(1), dustStone, FluidUtils.getWater(1000), 25*20, 16);
+ if (GT_Values.RA.addOreWasherRecipe(material.getCrushed(1), material.getCrushedPurified(1), bonusA.getTinyDust(1), dustStone, FluidUtils.getWater(1000), 25*20, 16)){
+ Logger.MATERIALS("[OreWasher] Added Recipe: 'Wash Crushed oer into Purified Crushed ore'");
+ }
/**
* Thermal Centrifuge
*/
//Crushed ore to Centrifuged Ore
- GT_Values.RA.addThermalCentrifugeRecipe(material.getCrushed(1), material.getCrushedCentrifuged(1), bonusB.getTinyDust(1), dustStone, 25*20, 24);
+ if (GT_Values.RA.addThermalCentrifugeRecipe(material.getCrushed(1), material.getCrushedCentrifuged(1), bonusB.getTinyDust(1), dustStone, 25*20, 24)){
+ Logger.MATERIALS("[ThermalCentrifuge] Added Recipe: 'Crushed ore to Centrifuged Ore'");
+ }
//Washed ore to Centrifuged Ore
- GT_Values.RA.addThermalCentrifugeRecipe(material.getCrushedPurified(1), material.getCrushedCentrifuged(1), bonusA.getTinyDust(1), dustStone, 25*20, 24);
+ if (GT_Values.RA.addThermalCentrifugeRecipe(material.getCrushedPurified(1), material.getCrushedCentrifuged(1), bonusA.getTinyDust(1), dustStone, 25*20, 24)){
+ Logger.MATERIALS("[ThermalCentrifuge] Added Recipe: 'Washed ore to Centrifuged Ore'");
+ }
/**
* Forge Hammer
*/
- GT_Values.RA.addForgeHammerRecipe(material.getCrushedCentrifuged(1), material.getDust(1), 10, 16);
- GT_Values.RA.addForgeHammerRecipe(material.getCrushedPurified(1), material.getDustPurified(1), 10, 16);
- GT_Values.RA.addForgeHammerRecipe(material.getOre(1), material.getCrushed(1), 10, 16);
+ if (GT_Values.RA.addForgeHammerRecipe(material.getCrushedCentrifuged(1), material.getDust(1), 10, 16)){
+ Logger.MATERIALS("[ForgeHammer] Added Recipe: 'Crushed Centrifuged to Pure Dust'");
+ }
+ if (GT_Values.RA.addForgeHammerRecipe(material.getCrushedPurified(1), material.getDustPurified(1), 10, 16)){
+ Logger.MATERIALS("[ForgeHammer] Added Recipe: 'Crushed Purified to Purified Dust'");
+ }
+ if (GT_Values.RA.addForgeHammerRecipe(material.getOre(1), material.getCrushed(1), 10, 16)){
+ Logger.MATERIALS("[ForgeHammer] Added Recipe: 'Ore to Crushed'");
+ }
/**
* Centrifuge
*/
//Purified Dust to Clean
- GT_Values.RA.addCentrifugeRecipe(
+ if (GT_Values.RA.addCentrifugeRecipe(
material.getDustPurified(1), null,
null, //In Fluid
null, //Out Fluid
@@ -105,7 +128,22 @@ public class RecipeGen_Ore implements Runnable{
null, null,null,
new int[]{10000, 10000}, //Chances
5*20, //Eu
- 5); //Time
+ 5)){ //Time
+ Logger.MATERIALS("[Centrifuge] Added Recipe: Purified Dust to Clean Dust");
+ }
+
+ //Impure Dust to Clean
+ if (GT_Values.RA.addCentrifugeRecipe(
+ material.getDustImpure(1), null,
+ null, //In Fluid
+ null, //Out Fluid
+ material.getDust(1), bonusB.getTinyDust(1),null,
+ null, null,null,
+ new int[]{10000, 10000}, //Chances
+ 5*20, //Eu
+ 5)){ //Time
+ Logger.MATERIALS("[Centrifuge] Added Recipe: Inpure Dust to Clean Dust");
+ }
/**
@@ -115,33 +153,68 @@ public class RecipeGen_Ore implements Runnable{
//Process Dust
if (componentMap.size() > 0 && componentMap.size() <= 6){
- ItemStack mInternalOutputs[] = new ItemStack[componentMap.size()];
- int mChances[] = new int[componentMap.size()];
+ ItemStack mInternalOutputs[] = new ItemStack[6];
+ int mChances[] = new int[6];
int mCellCount = 0;
+ int mTotalCount = 0;
+
int mCounter = 0;
for (Pair<Integer, Material> f : componentMap){
if (f.getValue().getState() != MaterialState.SOLID){
+ Logger.MATERIALS("[Electrolyzer] Found Fluid Component, adding "+f.getKey()+" cells of "+f.getValue().getLocalizedName()+".");
mInternalOutputs[mCounter++] = f.getValue().getCell(f.getKey());
mCellCount += f.getKey();
+ mTotalCount += f.getKey();
+ Logger.MATERIALS("[Electrolyzer] In total, adding "+mCellCount+" cells for "+material.getLocalizedName()+" processing.");
}
else {
+ Logger.MATERIALS("[Electrolyzer] Found Solid Component, adding "+f.getKey()+" dusts of "+f.getValue().getLocalizedName()+".");
mInternalOutputs[mCounter++] = f.getValue().getDust(f.getKey());
+ mTotalCount += f.getKey();
}
}
//Build Output Array
for (int g=0;g<mInternalOutputs.length;g++){
+ Logger.MATERIALS("[Electrolyzer] Is output["+g+"] valid with a chance? "+(mInternalOutputs[g] != null ? 10000 : 0));
mChances[g] = (mInternalOutputs[g] != null ? 10000 : 0);
}
ItemStack emptyCell = null;
if (mCellCount > 0){
emptyCell = ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", mCellCount);
+ Logger.MATERIALS("[Electrolyzer] Recipe now requires "+mCellCount+" empty cells as input.");
+ }
+
+ ItemStack mainDust = material.getDust(material.smallestStackSizeWhenProcessing);
+ if (mainDust != null){
+ Logger.MATERIALS("[Electrolyzer] Recipe now requires "+material.smallestStackSizeWhenProcessing+"x "+mainDust.getDisplayName()+" as input.");
+ }
+ else {
+ mainDust = material.getDust(mTotalCount);
+ Logger.MATERIALS("[Electrolyzer] Could not find valid input dust, trying alternative.");
+ if (mainDust != null){
+ Logger.MATERIALS("[Electrolyzer] Recipe now requires "+mTotalCount+"x "+mainDust.getDisplayName()+" as input.");
+ }
+ else {
+ Logger.MATERIALS("[Electrolyzer] Could not find valid input dust, exiting.");
+ }
}
- GT_Values.RA.addElectrolyzerRecipe(
- material.getDust(material.smallestStackSizeWhenProcessing),
+ for (int j=0;j<mInternalOutputs.length;j++){
+ if (mInternalOutputs[j] == null){
+ mInternalOutputs[j] = GT_Values.NI;
+ Logger.MATERIALS("[Electrolyzer] Set slot "+j+" to null.");
+ }
+ else {
+ Logger.MATERIALS("[Electrolyzer] Set slot "+j+" to "+mInternalOutputs[j].getDisplayName()+".");
+ }
+ }
+
+ try{
+ if (addElectrolyzerRecipe(
+ mainDust,
emptyCell, //input 2
null, //Input fluid 1
null, //Output fluid 1
@@ -153,10 +226,19 @@ public class RecipeGen_Ore implements Runnable{
mInternalOutputs[5],
mChances,
20*90,
- 240);
+ tVoltageMultiplier)){
+ Logger.MATERIALS("[Electrolyzer] Generated Electrolyzer recipe for "+material.getDust(1).getDisplayName());
+ }
+ else {
+ Logger.MATERIALS("[Electrolyzer] Failed to generate Electrolyzer recipe for "+material.getDust(1).getDisplayName());
+ }
+ }
+ catch(Throwable t){
+ t.printStackTrace();
+ }
}
else if (componentMap.size() > 6){
- Logger.MATERIALS("[Issue] "+material.getLocalizedName()+" is composed of over 6 materials, so a recipe for processing cannot be generated.");
+ Logger.MATERIALS("[Issue][Electrolyzer] "+material.getLocalizedName()+" is composed of over 6 materials, so a recipe for processing cannot be generated.");
}
@@ -237,6 +319,22 @@ public class RecipeGen_Ore implements Runnable{
}
-
+ public static boolean addElectrolyzerRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, ItemStack aOutput4, ItemStack aOutput5, ItemStack aOutput6, int[] aChances, int aDuration, int aEUt) {
+ if (((aInput1 == null) && (aFluidInput == null)) || ((aOutput1 == null) && (aFluidOutput == null))) {
+ Logger.MATERIALS("[Electrolyzer] Either both inputs or outputs are null.");
+ return false;
+ }
+ if ((aInput1 != null) && ((aDuration = GregTech_API.sRecipeFile.get("electrolyzer", aInput1, aDuration)) <= 0)) {
+ Logger.MATERIALS("[Electrolyzer] Fail 1.");
+ return false;
+ }
+ if ((aFluidInput != null) && ((aDuration = GregTech_API.sRecipeFile.get("electrolyzer", aFluidInput.getFluid().getName(), aDuration)) <= 0)) {
+ Logger.MATERIALS("[Electrolyzer] Fail 2.");
+ return false;
+ }
+ GT_Recipe.GT_Recipe_Map.sElectrolyzerRecipes.addRecipe(true, new ItemStack[]{aInput1, aInput2}, new ItemStack[]{aOutput1, aOutput2, aOutput3, aOutput4, aOutput5, aOutput6}, null, aChances, new FluidStack[]{aFluidInput}, new FluidStack[]{aFluidOutput}, aDuration, aEUt, 0);
+ Logger.MATERIALS("[Electrolyzer] Recipe added.");
+ return true;
+ }
}