JEI support, build.gradle update

This commit is contained in:
Dragon2488 2016-09-12 18:07:17 +07:00
parent 41276f206a
commit d9aa2535e6
40 changed files with 1251 additions and 1266 deletions

View file

@ -86,6 +86,7 @@ dependencies {
//provided "codechicken:CodeChickenLib:${config.minecraft.version}-${config.codechickenlib.version}:dev"
//provided "codechicken:CodeChickenCore:${config.minecraft.version}-${config.codechickencore.version}:dev"
//provided "codechicken:NotEnoughItems:${config.minecraft.version}-${config.nei.version}:dev"
compile "org.javassist:javassist:3.20.0-GA"
provided "net.industrial-craft:industrialcraft-2:${config.ic2.version}:dev"
deobfCompile "net.sengir.forestry:forestry_${config.minecraft.version}:${config.forestry.version}"
deobfCompile "mezz.jei:jei_${config.minecraft.version}:+"
@ -100,7 +101,12 @@ dependencies {
//provided name: 'Railcraft', version: config.railcraft.version, ext: 'jar'
//provided name: 'IC2NuclearControl', version: config.nc.version, ext: 'jar'
}
//TODO: 1.10.2 dependencies
compileJava {
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
options.encoding = "UTF-8"
}
processResources
{
@ -125,14 +131,39 @@ processResources
task source(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
manifest {
attributes 'FMLCorePlugin': 'gregtech.asm.ASM'
attributes 'FMLCorePluginContainsFMLMod': 'true'
}
}
jar {
manifest {
attributes 'FMLCorePlugin': 'gregtech.asm.ASM'
attributes 'FMLCorePluginContainsFMLMod': 'true'
}
doFirst {
for(file in configurations.compile) {
if(file.name.contains("javassist")) {
from zipTree(file)
}
}
}
}
task dev(type: Jar) {
from sourceSets.main.output
classifier = 'dev'
manifest {
//attributes 'FMLCorePlugin': 'WhateverLoaderClass'
//attributes 'FMLCorePluginContainsFMLMod': 'true'
attributes 'FMLCorePlugin': 'gregtech.asm.ASM'
attributes 'FMLCorePluginContainsFMLMod': 'true'
}
doFirst {
for(file in configurations.compile) {
if(file.name.contains("javassist")) {
from zipTree(file)
}
}
}
}

View file

@ -1,5 +1,5 @@
minecraft.version=1.10.2
forge.version=12.18.1.2046
forge.version=12.18.1.2079
gt.version=5.09.22

View file

@ -133,7 +133,8 @@ public class GT_Mod implements IGT_Mod {
GT_Log.out.println("GT_Mod: Replacing IC2 recipes managers");
try {
for (Field f : Recipes.class.getFields()) {
if (Modifier.isStatic(f.getModifiers()) && f.getType() == IMachineRecipeManager.class) {
if (Modifier.isStatic(f.getModifiers()) && f.getType() == IMachineRecipeManager.class &&
!(f.getName().equals("recycler") || f.getName().equals("matterAmplifier"))) {
IMachineRecipeManager delegate = (IMachineRecipeManager) f.get(null);
if(delegate != null) {
f.set(null, new GT_IC2RecipesHandler());

View file

@ -1,5 +1,6 @@
package gregtech.api.items;
import gregtech.common.blocks.GT_Block_Ores;
import gregtech.common.blocks.UnlistedBlockPosProperty;
import gregtech.common.render.IIconRegister;
import gregtech.common.render.newblocks.IBlockIconProvider;
@ -9,6 +10,7 @@ import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@ -21,12 +23,15 @@ import net.minecraft.world.World;
import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty;
import net.minecraftforge.fml.client.FMLClientHandler;
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
import net.minecraftforge.fml.common.registry.GameRegistry;
import gregtech.api.util.GT_LanguageManager;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.item.ItemBlock;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import static gregtech.api.enums.GT_Values.W;
@ -71,8 +76,18 @@ public abstract class GT_Generic_Block extends Block {
}
@Override
public boolean isOpaqueCube(IBlockState state) {
return false;
public boolean getUseNeighborBrightness(IBlockState state) {
return true;
}
@Override
@SideOnly(Side.CLIENT)
public int getPackedLightmapCoords(IBlockState state, IBlockAccess source, BlockPos pos) {
World world = FMLClientHandler.instance().getWorldClient();
int i = world.getLightFromNeighborsFor(EnumSkyBlock.SKY, pos);
int j = world.getLightFromNeighborsFor(EnumSkyBlock.BLOCK, pos);
if(i < 2) i = 8;
return i << 20 | j << 4;
}
@Override
@ -80,9 +95,4 @@ public abstract class GT_Generic_Block extends Block {
return new ItemStack(this, 1, state.getValue(METADATA));
}
@Override
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) {
setLightOpacity(50);
return 1;
}
}

View file

@ -251,13 +251,15 @@ public abstract class GT_MetaGenerated_Item extends GT_MetaBase_Item implements
}
private int makeColor(short[] rgba) {
short[] nullRGBA = Materials._NULL.getRGBA();
short red = rgba[0] > 0 && 255 > rgba[0] ? rgba[0] : nullRGBA[0];
short green = rgba[1] > 0 && 255 > rgba[1] ? rgba[1] : nullRGBA[1];
short blue = rgba[2] > 0 && 255 > rgba[2] ? rgba[2] : nullRGBA[2];
short alpha = rgba[3] > 0 && 255 > rgba[3] ? rgba[3] : nullRGBA[3];
return new Color(red, green, blue, alpha).getRGB();
try {
for(int i = 0; i < 4; i++)
rgba[i] = (short) Math.max(0, rgba[i]);
return new Color(rgba[0], rgba[1], rgba[2], rgba[3]).getRGB();
} catch (IllegalArgumentException err) {
return Color.WHITE.getRGB();
}
}
/**
* @return the Color Modulation the Material is going to be rendered with.

View file

@ -1,10 +1,7 @@
package gregtech.api.items;
import gregtech.api.GregTech_API;
import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.enums.TextureSet;
import gregtech.api.enums.Textures;
import gregtech.api.enums.*;
import gregtech.api.interfaces.IIconContainer;
import gregtech.api.util.GT_LanguageManager;
import gregtech.api.util.GT_OreDictUnificator;
@ -62,6 +59,13 @@ public abstract class GT_MetaGenerated_Item_X32 extends GT_MetaGenerated_Item {
} else {
GT_OreDictUnificator.registerOre(tPrefix.get(tMaterial), tStack);
}
if(tPrefix == OrePrefixes.lens) {
Dyes materialColor = tMaterial.mColor;
if(materialColor != null) {
GT_OreDictUnificator.registerOre("craftingLens" + materialColor.mName.replace(' ', '\0'), tStack);
}
}
if ((tPrefix == OrePrefixes.stick || tPrefix == OrePrefixes.wireFine || tPrefix == OrePrefixes.ingot) && (tMaterial == Materials.Lead || tMaterial == Materials.Tin || tMaterial == Materials.SolderingAlloy)) {
GregTech_API.sSolderingMetalList.add(tStack);
}

View file

@ -11,6 +11,7 @@ import gregtech.api.objects.GT_ItemStack;
import gregtech.api.util.*;
import ic2.api.energy.tile.IEnergyAcceptor;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
@ -30,6 +31,8 @@ import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.capability.FluidTankProperties;
import net.minecraftforge.fluids.capability.IFluidTankProperties;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nullable;
import java.util.ArrayList;
@ -186,6 +189,22 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
mMetaTileEntity.setBaseMetaTileEntity(this);
}
if (isServerSide()) {
if (mTickTimer % 10 == 0) {
if (mSendClientData) {
NW.sendPacketToAllPlayersInRange(worldObj,
new GT_Packet_TileEntity(
getXCoord(), getYCoord(), getZCoord(), mID,
mCoverSides[0], mCoverSides[1], mCoverSides[2], mCoverSides[3], mCoverSides[4], mCoverSides[5],
oTextureData = mConnections, oUpdateData = hasValidMetaTileEntity() ? mMetaTileEntity.getUpdateData() : 0,
oRedstoneData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) |
((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0)
| ((mSidedRedstone[5] > 0) ? 32 : 0)), oColor = mColor), getXCoord(), getZCoord());
mSendClientData = false;
}
}
}
long tTime = System.currentTimeMillis();
for (int tCode = 0; hasValidMetaTileEntity() && tCode >= 0; ) {
@ -214,7 +233,7 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
}
if (mNeedsUpdate) {
worldObj.notifyNeighborsOfStateChange(getPos(), getBlockType());
causeChunkUpdate();
mNeedsUpdate = false;
}
}
@ -268,13 +287,6 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
case 11:
tCode++;
if (isServerSide()) {
if (mTickTimer % 10 == 0) {
if (mSendClientData) {
NW.sendPacketToAllPlayersInRange(worldObj, new GT_Packet_TileEntity(getXCoord(), getYCoord(), getZCoord(), mID, mCoverSides[0], mCoverSides[1], mCoverSides[2], mCoverSides[3], mCoverSides[4], mCoverSides[5], oTextureData = mConnections, oUpdateData = hasValidMetaTileEntity() ? mMetaTileEntity.getUpdateData() : 0, oRedstoneData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0)), oColor = mColor), getXCoord(), getZCoord());
mSendClientData = false;
}
}
if (mTickTimer > 10) {
if (mConnections != oTextureData) sendBlockEvent((byte) 0, oTextureData = mConnections);
byte tData = mMetaTileEntity.getUpdateData();
@ -420,6 +432,17 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
mNeedsBlockUpdate = true;
}
@SideOnly(Side.CLIENT)
public void causeChunkUpdate() {
int minX = pos.getX() - 5;
int minY = pos.getY() - 5;
int minZ = pos.getZ() - 5;
int maxX = pos.getX() + 5;
int maxY = pos.getY() + 5;
int maxZ = pos.getZ() + 5;
Minecraft.getMinecraft().renderGlobal.markBlockRangeForRenderUpdate(minX, minY, minZ, maxX, maxY, maxZ);
}
@Override
public void issueClientUpdate() {
mSendClientData = true;

View file

@ -596,12 +596,6 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
Minecraft.getMinecraft().renderGlobal.markBlockRangeForRenderUpdate(minX, minY, minZ, maxX, maxY, maxZ);
}
@Override
public SPacketUpdateTileEntity getUpdatePacket() {
issueClientUpdate();
return null;
}
public final void receiveMetaTileEntityData(short aID, int aCover0, int aCover1, int aCover2, int aCover3, int aCover4, int aCover5, byte aTextureData, byte aUpdateData, byte aRedstoneData, byte aColorData) {
issueTextureUpdate();
if (mID != aID && aID > 0) {

View file

@ -17,33 +17,37 @@ import net.minecraft.util.math.BlockPos;
import java.awt.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class GT_RenderedTexture implements ITexture {
private final IIconContainer mIconContainer;
public int mRGBa;
public int mRGBa = -1;
public GT_RenderedTexture(IIconContainer aIcon, short[] aRGBa) {
if (aRGBa.length != 4) throw new IllegalArgumentException("RGBa doesn't have 4 Values @ GT_RenderedTexture");
mIconContainer = aIcon;
mRGBa = makeColor(aRGBa);
if(aRGBa != null) {
this.mRGBa = makeColor(aRGBa);
}
}
public GT_RenderedTexture(String spriteName, short[] aRGBa) {
this(GT_Utility.sprite2Container(
Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(spriteName)),
aRGBa == null ? new short[] {255, 255, 255, 255} : aRGBa);
TextureAtlasSprite sprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(spriteName);
this.mIconContainer = GT_Utility.sprite2Container(sprite);
if(aRGBa != null) {
this.mRGBa = makeColor(aRGBa);
}
}
private int makeColor(short[] rgba) {
short[] nullRGBA = Materials._NULL.getRGBA();
short red = rgba[0] > 0 && 255 > rgba[0] ? rgba[0] : nullRGBA[0];
short green = rgba[1] > 0 && 255 > rgba[1] ? rgba[1] : nullRGBA[1];
short blue = rgba[2] > 0 && 255 > rgba[2] ? rgba[2] : nullRGBA[2];
short alpha = rgba[3] > 0 && 255 > rgba[3] ? rgba[3] : nullRGBA[3];
return new Color(red, green, blue, alpha).getRGB();
try {
for(int i = 0; i < 4; i++)
rgba[i] = (short) Math.max(0, rgba[i]);
return new Color(rgba[0], rgba[1], rgba[2], rgba[3]).getRGB();
} catch (IllegalArgumentException err) {
return Color.WHITE.getRGB();
}
}
public GT_RenderedTexture(IIconContainer aIcon, int aRGBa) {
@ -52,20 +56,19 @@ public class GT_RenderedTexture implements ITexture {
}
public GT_RenderedTexture(IIconContainer aIcon) {
this(aIcon, Dyes._NULL.mRGBa);
this.mIconContainer = aIcon;
}
@Override
public List<BakedQuad> getQuads(Block aBlock, BlockPos blockPos, EnumFacing side, int tintOff) {
ArrayList<BakedQuad> quads = new ArrayList<>();
TextureAtlasSprite sprite = mIconContainer.getIcon();
TextureAtlasSprite overlay = mIconContainer.getOverlayIcon();
if(sprite != null) {
quads.add(RenderUtil.renderSide(DefaultVertexFormats.BLOCK, sprite, side, tintOff, -0.003F, mRGBa));
quads.add(RenderUtil.renderSide(DefaultVertexFormats.BLOCK, sprite, side, tintOff, 0.0F, mRGBa, blockPos == null));
}
if(overlay != null) {
quads.add(RenderUtil.renderSide(DefaultVertexFormats.BLOCK, overlay, side, tintOff, -0.0023F, mRGBa));
quads.add(RenderUtil.renderSide(DefaultVertexFormats.BLOCK, overlay, side, tintOff + 1000, 0.001F, mRGBa, blockPos == null));
}
return quads;
}

View file

@ -3,6 +3,8 @@ package gregtech.api.util;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.*;
import net.minecraft.client.resources.I18n;
import net.minecraft.util.text.translation.*;
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
import gregtech.api.GregTech_API;
import net.minecraft.item.ItemStack;
@ -96,7 +98,12 @@ public class GT_LanguageManager implements IResourceManagerReloadListener {
public void onResourceManagerReload(IResourceManager resourceManager) {
Locale i18nLocale = ObfuscationReflectionHelper.getPrivateValue(I18n.class, null, 0);
Map<String, String> properties = ObfuscationReflectionHelper.getPrivateValue(Locale.class, i18nLocale, 2);
LanguageMap languageMap = ObfuscationReflectionHelper.getPrivateValue(net.minecraft.util.text.translation.I18n.class, null, 0);
Map<String, String> properties2 = ObfuscationReflectionHelper.getPrivateValue(LanguageMap.class, languageMap, 3);
properties.putAll(LOCALIZATION);
properties2.putAll(LOCALIZATION);
GT_Log.out.println("Resource manager reloaded. Localization injected.");
}

View file

@ -269,6 +269,15 @@ public class GT_Recipe {
return GT_Utility.copy(mInputs[aIndex]);
}
public ItemStack getNEIAdaptedInput(int aIndex) {
ItemStack input = getRepresentativeInput(aIndex);
if(input != null && input.stackSize == 0) {
input.stackSize = 1;
}
return input;
}
public ItemStack getOutput(int aIndex) {
if (aIndex < 0 || aIndex >= mOutputs.length) return null;
return GT_Utility.copy(mOutputs[aIndex]);
@ -455,7 +464,7 @@ public class GT_Recipe {
public static final GT_Recipe_Map sRockBreakerFakeRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(3), "gt.recipe.rockbreaker", "Rock Breaker", null, RES_PATH_GUI + "basicmachines/RockBreaker", 1, 1, 0, 0, 1, E, 1, E, true, true);
public static final GT_Recipe_Map sByProductList = new GT_Recipe_Map(new HashSet<GT_Recipe>(1000), "gt.recipe.byproductlist", "Ore Byproduct List", null, RES_PATH_GUI + "basicmachines/Default", 1, 6, 1, 0, 1, E, 1, E, true, true);
public static final GT_Recipe_Map sRepicatorFakeRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(100), "gt.recipe.replicator", "Replicator", null, RES_PATH_GUI + "basicmachines/Replicator", 0, 1, 0, 1, 1, E, 1, E, true, true);
public static final GT_Recipe_Map sAssemblylineFakeRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(30), "gt.recipe.scanner", "Scanner", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 1, 0, 1, E, 1, E, true, true);
public static final GT_Recipe_Map sAssemblylineFakeRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(30), "gt.recipe.assemblyline", "Assembly Line", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 1, 0, 1, E, 1, E, true, true);
public static final GT_Recipe_Map sPlasmaArcFurnaceRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(10000), "gt.recipe.plasmaarcfurnace", "Plasma Arc Furnace", null, RES_PATH_GUI + "basicmachines/PlasmaArcFurnace", 1, 4, 1, 1, 1, E, 1, E, true, true);
public static final GT_Recipe_Map sArcFurnaceRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(10000), "gt.recipe.arcfurnace", "Arc Furnace", null, RES_PATH_GUI + "basicmachines/ArcFurnace", 1, 4, 1, 1, 3, E, 1, E, true, true);

View file

@ -1,6 +1,8 @@
package gregtech.api.world;
import gregtech.api.GregTech_API;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraft.world.chunk.IChunkProvider;
@ -48,14 +50,31 @@ public abstract class GT_Worldgen {
return false;
}
public boolean isGenerationAllowed(World aWorld, int aDimensionType, int aAllowedDimensionType) {
public boolean isDimensionAllowed(World aWorld, int aDimensionType, boolean nether, boolean overworld, boolean end) {
String aDimName = aWorld.getProviderName();
Boolean tAllowed = mDimensionMap.get(aDimName);
if (tAllowed == null) {
boolean tValue = GregTech_API.sWorldgenFile.get("worldgen.dimensions." + mWorldGenName, aDimName, aDimensionType == aAllowedDimensionType);
boolean tValue = GregTech_API.sWorldgenFile.get("worldgen.dimensions." + mWorldGenName, aDimName, ((aDimensionType == -1) && nether) || ((aDimensionType == 0) && overworld) || ((aDimensionType == 1) && end));
mDimensionMap.put(aDimName, tValue);
return tValue;
}
return tAllowed;
}
public boolean isDimensionAllowed(World aWorld, int aDimensionType, int exceptedDimension) {
String aDimName = aWorld.getProviderName();
Boolean tAllowed = mDimensionMap.get(aDimName);
if (tAllowed == null) {
boolean tValue = GregTech_API.sWorldgenFile.get("worldgen.dimensions." + mWorldGenName, aDimName, aDimensionType == exceptedDimension);
mDimensionMap.put(aDimName, tValue);
return tValue;
}
return tAllowed;
}
public boolean isGenerationAllowed(World aWorld, BlockPos blockPos) {
IBlockState blockState = aWorld.getBlockState(blockPos);
return blockState.getBlock().isReplaceableOreGen(blockState, aWorld, blockPos, GT_Worldgen_Ore_Normal.ANY);
}
}

View file

@ -1,75 +0,0 @@
package gregtech.api.world;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraft.world.chunk.IChunkProvider;
import java.util.Collection;
import java.util.Random;
public class GT_Worldgen_Boulder extends GT_Worldgen_Ore {
public GT_Worldgen_Boulder(String aName, boolean aDefault, Block aBlock, int aBlockMeta, int aDimensionType, int aAmount, int aSize, int aProbability, int aMinY, int aMaxY, Collection<String> aBiomeList, boolean aAllowToGenerateinVoid) {
super(aName, aDefault, aBlock, aBlockMeta, aDimensionType, aAmount, aSize, aProbability, aMinY, aMaxY, aBiomeList, aAllowToGenerateinVoid);
}
@Override
public boolean executeWorldgen(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX, int aChunkZ, IChunkGenerator aChunkGenerator, IChunkProvider aChunkProvider) {
if (isGenerationAllowed(aWorld, aDimensionType, mDimensionType) && (mBiomeList.isEmpty() || mBiomeList.contains(aBiome)) && (mProbability <= 1 || aRandom.nextInt(mProbability) == 0)) {
for (int i = 0; i < mAmount; i++) {
int tX = aChunkX + aRandom.nextInt(16), tY = mMinY + aRandom.nextInt(mMaxY - mMinY), tZ = aChunkZ + aRandom.nextInt(16);
IBlockState tBlock = aWorld.getBlockState(new BlockPos(tX, tY - 7, tZ));
if (tBlock != null && tBlock.isOpaqueCube() && aWorld.isAirBlock(new BlockPos(tX, tY - 6, tZ))) {
float var6 = aRandom.nextFloat() * (float) Math.PI;
double var7 = ((tX + 8) + MathHelper.sin(var6) * mSize / 8.0F);
double var9 = ((tX + 8) - MathHelper.sin(var6) * mSize / 8.0F);
double var11 = ((tZ + 8) + MathHelper.cos(var6) * mSize / 8.0F);
double var13 = ((tZ + 8) - MathHelper.cos(var6) * mSize / 8.0F);
double var15 = (tY + aRandom.nextInt(3) - 2);
double var17 = (tY + aRandom.nextInt(3) - 2);
for (int var19 = 0; var19 <= mSize; ++var19) {
double var20 = var7 + (var9 - var7) * var19 / mSize;
double var22 = var15 + (var17 - var15) * var19 / mSize;
double var24 = var11 + (var13 - var11) * var19 / mSize;
double var26 = aRandom.nextDouble() * mSize / 16.0D;
double var28 = (MathHelper.sin(var19 * (float) Math.PI / mSize) + 1.0F) * var26 + 1.0D;
double var30 = (MathHelper.sin(var19 * (float) Math.PI / mSize) + 1.0F) * var26 + 1.0D;
int var32 = MathHelper.floor_double(var20 - var28 / 2.0D);
int var33 = MathHelper.floor_double(var22 - var30 / 2.0D);
int var34 = MathHelper.floor_double(var24 - var28 / 2.0D);
int var35 = MathHelper.floor_double(var20 + var28 / 2.0D);
int var36 = MathHelper.floor_double(var22 + var30 / 2.0D);
int var37 = MathHelper.floor_double(var24 + var28 / 2.0D);
for (int var38 = var32; var38 <= var35; ++var38) {
double var39 = (var38 + 0.5D - var20) / (var28 / 2.0D);
if (var39 * var39 < 1.0D) {
for (int var41 = var33; var41 <= var36; ++var41) {
double var42 = (var41 + 0.5D - var22) / (var30 / 2.0D);
if (var39 * var39 + var42 * var42 < 1.0D) {
for (int var44 = var34; var44 <= var37; ++var44) {
double var45 = (var44 + 0.5D - var24) / (var28 / 2.0D);
Block block = aWorld.getBlockState(new BlockPos(var38, var41, var44)).getBlock();
if (var39 * var39 + var42 * var42 + var45 * var45 < 1.0D && ((mAllowToGenerateinVoid &&
aWorld.isAirBlock(new BlockPos(var38, var41, var44))) ||
(block != null && !(block instanceof BlockContainer)))) {
aWorld.setBlockState(new BlockPos(var38, var41, var44), mBlock.getStateFromMeta(mBlockMeta));
}
}
}
}
}
}
}
}
}
return true;
}
return false;
}
}

View file

@ -18,74 +18,21 @@ import javax.annotation.Nullable;
import java.util.Collection;
import java.util.Random;
public class GT_Worldgen_Ore_Normal extends GT_Worldgen_Ore {
public GT_Worldgen_Ore_Normal(String aName, boolean aDefault, Block aBlock, int aBlockMeta, int aDimensionType, int aAmount, int aSize, int aProbability, int aMinY, int aMaxY, Collection<String> aBiomeList, boolean aAllowToGenerateinVoid) {
super(aName, aDefault, aBlock, aBlockMeta, aDimensionType, aAmount, aSize, aProbability, aMinY, aMaxY, aBiomeList, aAllowToGenerateinVoid);
}
@Override
public boolean executeWorldgen(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX, int aChunkZ, IChunkGenerator aChunkGenerator, IChunkProvider aChunkProvider) {
if (isGenerationAllowed(aWorld, aDimensionType, mDimensionType) && (mBiomeList.isEmpty() || mBiomeList.contains(aBiome)) && (mProbability <= 1 || aRandom.nextInt(mProbability) == 0)) {
for (int i = 0; i < mAmount; i++) {
int tX = aChunkX + aRandom.nextInt(16), tY = mMinY + aRandom.nextInt(mMaxY - mMinY), tZ = aChunkZ + aRandom.nextInt(16);
if (mAllowToGenerateinVoid || aWorld.isAirBlock(new BlockPos(tX, tY, tZ))) {
float var6 = aRandom.nextFloat() * (float) Math.PI;
double var7 = ((tX + 8) + MathHelper.sin(var6) * mSize / 8.0F);
double var9 = ((tX + 8) - MathHelper.sin(var6) * mSize / 8.0F);
double var11 = ((tZ + 8) + MathHelper.cos(var6) * mSize / 8.0F);
double var13 = ((tZ + 8) - MathHelper.cos(var6) * mSize / 8.0F);
double var15 = (tY + aRandom.nextInt(3) - 2);
double var17 = (tY + aRandom.nextInt(3) - 2);
for (int var19 = 0; var19 <= mSize; ++var19) {
double var20 = var7 + (var9 - var7) * var19 / mSize;
double var22 = var15 + (var17 - var15) * var19 / mSize;
double var24 = var11 + (var13 - var11) * var19 / mSize;
double var26 = aRandom.nextDouble() * mSize / 16.0D;
double var28 = (MathHelper.sin(var19 * (float) Math.PI / mSize) + 1.0F) * var26 + 1.0D;
double var30 = (MathHelper.sin(var19 * (float) Math.PI / mSize) + 1.0F) * var26 + 1.0D;
int var32 = MathHelper.floor_double(var20 - var28 / 2.0D);
int var33 = MathHelper.floor_double(var22 - var30 / 2.0D);
int var34 = MathHelper.floor_double(var24 - var28 / 2.0D);
int var35 = MathHelper.floor_double(var20 + var28 / 2.0D);
int var36 = MathHelper.floor_double(var22 + var30 / 2.0D);
int var37 = MathHelper.floor_double(var24 + var28 / 2.0D);
for (int var38 = var32; var38 <= var35; ++var38) {
double var39 = (var38 + 0.5D - var20) / (var28 / 2.0D);
if (var39 * var39 < 1.0D) {
for (int var41 = var33; var41 <= var36; ++var41) {
double var42 = (var41 + 0.5D - var22) / (var30 / 2.0D);
if (var39 * var39 + var42 * var42 < 1.0D) {
for (int var44 = var34; var44 <= var37; ++var44) {
double var45 = (var44 + 0.5D - var24) / (var28 / 2.0D);
BlockPos blockPos = new BlockPos(var38, var41, var44);
IBlockState block = aWorld.getBlockState(blockPos);
if (var39 * var39 + var42 * var42 + var45 * var45 < 1.0D && ((mAllowToGenerateinVoid && aWorld.isAirBlock(blockPos)) || block.getBlock().isReplaceableOreGen(block, aWorld, blockPos, STONE))) {
aWorld.setBlockState(new BlockPos(var38, var41, var44), mBlock.getStateFromMeta(mBlockMeta));
}
}
}
}
}
}
}
}
}
return true;
}
return false;
public class GT_Worldgen_Ore_Normal {
}
public static Predicate<IBlockState> STONE = input ->
public static Predicate<IBlockState> STONES = input ->
input.getBlock() == Blocks.STONE ||
input.getBlock() == Blocks.END_STONE ||
input.getBlock() == Blocks.NETHERRACK ||
input.getBlock() instanceof GT_Block_Granites ||
input.getBlock() instanceof GT_Block_Stones;
public static Predicate<IBlockState> NETHERRACK = input ->
input.getBlock() == Blocks.NETHERRACK;
public static Predicate<IBlockState> ENDSTONE = input ->
input.getBlock() == Blocks.END_STONE;
public static Predicate<IBlockState> ANY = input ->
STONES.apply(input) || NETHERRACK.apply(input) || ENDSTONE.apply(input);
}

View file

@ -1,34 +0,0 @@
package gregtech.api.world;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraft.world.chunk.IChunkProvider;
import java.util.Collection;
import java.util.Random;
public class GT_Worldgen_Ore_SingleBlock extends GT_Worldgen_Ore {
public GT_Worldgen_Ore_SingleBlock(String aName, boolean aDefault, Block aBlock, int aBlockMeta, int aDimensionType, int aAmount, int aSize, int aProbability, int aMinY, int aMaxY, Collection<String> aBiomeList, boolean aAllowToGenerateinVoid) {
super(aName, aDefault, aBlock, aBlockMeta, aDimensionType, aAmount, aSize, aProbability, aMinY, aMaxY, aBiomeList, aAllowToGenerateinVoid);
}
@Override
public boolean executeWorldgen(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX, int aChunkZ, IChunkGenerator aChunkGenerator, IChunkProvider aChunkProvider) {
if (isGenerationAllowed(aWorld, aDimensionType, mDimensionType) && (mBiomeList.isEmpty() || mBiomeList.contains(aBiome)) && (mProbability <= 1 || aRandom.nextInt(mProbability) == 0)) {
for (int i = 0; i < mAmount; i++) {
int tX = aChunkX + aRandom.nextInt(16), tY = mMinY + aRandom.nextInt(mMaxY - mMinY), tZ = aChunkZ + aRandom.nextInt(16);
BlockPos blockPos = new BlockPos(tX, tY, tZ);
IBlockState tBlock = aWorld.getBlockState(blockPos);
if ((mAllowToGenerateinVoid && aWorld.isAirBlock(blockPos)) || (tBlock.getBlock().isReplaceableOreGen(tBlock, aWorld, blockPos, GT_Worldgen_Ore_Normal.STONE))) {
aWorld.setBlockState(blockPos, mBlock.getStateFromMeta(mBlockMeta));
}
}
return true;
}
return false;
}
}

View file

@ -1,35 +0,0 @@
package gregtech.api.world;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraft.world.chunk.IChunkProvider;
import java.util.Collection;
import java.util.Random;
public class GT_Worldgen_Ore_SingleBlock_UnderLava extends GT_Worldgen_Ore {
public GT_Worldgen_Ore_SingleBlock_UnderLava(String aName, boolean aDefault, Block aBlock, int aBlockMeta, int aDimensionType, int aAmount, int aSize, int aProbability, int aMinY, int aMaxY, Collection<String> aBiomeList, boolean aAllowToGenerateinVoid) {
super(aName, aDefault, aBlock, aBlockMeta, aDimensionType, aAmount, aSize, aProbability, aMinY, aMaxY, aBiomeList, aAllowToGenerateinVoid);
}
@Override
public boolean executeCavegen(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX, int aChunkZ, IChunkGenerator aChunkGenerator, IChunkProvider aChunkProvider) {
if (isGenerationAllowed(aWorld, aDimensionType, mDimensionType) && (mBiomeList.isEmpty() || mBiomeList.contains(aBiome)) && (mProbability <= 1 || aRandom.nextInt(mProbability) == 0)) {
for (int i = 0; i < mAmount; i++) {
int tX = aChunkX + aRandom.nextInt(16), tY = mMinY + aRandom.nextInt(mMaxY - mMinY), tZ = aChunkZ + aRandom.nextInt(16);
BlockPos blockPos = new BlockPos(tX, tY, tZ);
IBlockState tBlock = aWorld.getBlockState(blockPos);
if ((mAllowToGenerateinVoid && aWorld.isAirBlock(blockPos)) || tBlock.getBlock().isReplaceableOreGen(tBlock, aWorld, blockPos, GT_Worldgen_Ore_Normal.STONE)) {
if (aWorld.getBlockState(blockPos.up()).getBlock() == Blocks.LAVA || aWorld.getBlockState(blockPos).getBlock() == Blocks.FLOWING_LAVA)
aWorld.setBlockState(blockPos, mBlock.getStateFromMeta(mBlockMeta));
}
}
return true;
}
return false;
}
}

View file

@ -1,73 +1,28 @@
package gregtech.common;
import com.google.common.collect.Lists;
import ic2.api.recipe.IMachineRecipeManager;
import ic2.api.recipe.IRecipeInput;
import ic2.api.recipe.RecipeOutput;
import ic2.core.recipe.BasicMachineRecipeManager;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
public class GT_IC2RecipesHandler implements IMachineRecipeManager {
private HashMap<RecipeInputWrapper, RecipeIoContainer> recipes = new HashMap<>();
private static class RecipeInputWrapper {
private IRecipeInput recipeInput;
public RecipeInputWrapper(IRecipeInput recipeInput) {
this.recipeInput = recipeInput;
}
//For easy gets and replacements
@Override
public boolean equals(Object object) {
if(object instanceof ItemStack) {
ItemStack stack = (ItemStack) object;
if(recipeInput.matches(stack)) {
if(stack.stackSize < recipeInput.getAmount() ||
stack.getItem().hasContainerItem(stack) &&
stack.stackSize != recipeInput.getAmount())
return false;
return true;
}
return false;
} else if(object instanceof RecipeInputWrapper) {
RecipeInputWrapper inputWrapper = (RecipeInputWrapper) object;
return Arrays.equals(recipeInput.getInputs().toArray(),
inputWrapper.recipeInput.getInputs().toArray());
}
return false;
}
//for fast access
@Override
public int hashCode() {
return Arrays.hashCode(recipeInput.getInputs().toArray());
}
}
private ArrayList<RecipeIoContainer> recipes = new ArrayList<>();
@Override
public boolean addRecipe(IRecipeInput iRecipeInput, NBTTagCompound metadata, boolean replace, ItemStack... itemStacks) {
RecipeIoContainer ioContainer = new RecipeIoContainer(iRecipeInput, new RecipeOutput(metadata, itemStacks));
RecipeInputWrapper inputWrapper = new RecipeInputWrapper(iRecipeInput);
RecipeIoContainer replaced = recipes.put(inputWrapper, ioContainer);
if(replaced != null) {
System.out.println("Replaced recipe " + replaced.input.getInputs() + " to " + iRecipeInput.getInputs());
}
recipes.add(ioContainer);
return true;
}
@Override
public RecipeOutput getOutputFor(ItemStack input, boolean adjustInput) {
RecipeIoContainer ioContainer = recipes.get(input);
if(ioContainer != null) {
for(RecipeIoContainer ioContainer : recipes) {
if (ioContainer.input.matches(input)) {
if (adjustInput) {
if (input.getItem().hasContainerItem(input)) {
ItemStack container = input.getItem().getContainerItem(input);
@ -81,13 +36,13 @@ public class GT_IC2RecipesHandler implements IMachineRecipeManager {
}
return ioContainer.output;
}
return new RecipeOutput(new NBTTagCompound(), Lists.newArrayList());
}
return null;
}
@Override
public Iterable<RecipeIoContainer> getRecipes() {
return recipes.values();
return recipes;
}
@Override

View file

@ -65,7 +65,7 @@ public class GT_MinableOreGenerator
BlockPos block = new BlockPos(var38, var41, var44);
IBlockState blockState = par1World.getBlockState(block);
if ((var39 * var39 + var42 * var42 + var45 * var45 < 1.0D) && ((this.allowVoid && par1World.isAirBlock(block)) ||
(block != null && (blockState.getBlock().isReplaceableOreGen(blockState, par1World, pos, GT_Worldgen_Ore_Normal.STONE))))) {
(block != null && (blockState.getBlock().isReplaceableOreGen(blockState, par1World, pos, GT_Worldgen_Ore_Normal.ANY))))) {
par1World.setBlockState(block, this.minableBlockId.getStateFromMeta(minableBlockMeta));
}
}

View file

@ -6,6 +6,7 @@ import gregtech.api.enums.Materials;
import gregtech.api.world.GT_Worldgen;
import gregtech.common.blocks.GT_TileEntity_Ores;
import gregtech.loaders.misc.GT_Achievements;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraft.world.chunk.IChunkProvider;
@ -62,7 +63,7 @@ public class GT_Worldgen_GT_Ore_Layer
if (!this.mBiome.equals("None") && !(this.mBiome.equals(aBiome))) {
return false; //Not the correct biome for ore mix
}
if (!isGenerationAllowed(aWorld, aDimensionType, ((aDimensionType == -1) && (this.mNether)) || ((aDimensionType == 0) && (this.mOverworld)) || ((aDimensionType == 1) && (this.mEnd)) ? aDimensionType : aDimensionType ^ 0xFFFFFFFF)) {
if (!isDimensionAllowed(aWorld, aDimensionType, mNether, mOverworld, mEnd)) {
return false;
}
int tMinY = this.mMinY + aRandom.nextInt(this.mMaxY - this.mMinY - 5);
@ -76,22 +77,34 @@ public class GT_Worldgen_GT_Ore_Layer
if (this.mSecondaryMeta > 0) {
for (int i = tMinY - 1; i < tMinY + 2; i++) {
if ((aRandom.nextInt(Math.max(1, Math.max(Math.abs(cZ - tZ), Math.abs(eZ - tZ)) / this.mDensity)) == 0) || (aRandom.nextInt(Math.max(1, Math.max(Math.abs(cX - tX), Math.abs(eX - tX)) / this.mDensity)) == 0)) {
GT_TileEntity_Ores.setOreBlock(aWorld, tX, i, tZ, this.mSecondaryMeta, false);
BlockPos blockPos = new BlockPos(tX, i, tZ);
if(isGenerationAllowed(aWorld, blockPos)) {
GT_TileEntity_Ores.setOreBlock(aWorld, blockPos, this.mSecondaryMeta, false);
}
}
}
}
if ((this.mBetweenMeta > 0) && ((aRandom.nextInt(Math.max(1, Math.max(Math.abs(cZ - tZ), Math.abs(eZ - tZ)) / this.mDensity)) == 0) || (aRandom.nextInt(Math.max(1, Math.max(Math.abs(cX - tX), Math.abs(eX - tX)) / this.mDensity)) == 0))) {
GT_TileEntity_Ores.setOreBlock(aWorld, tX, tMinY + 2 + aRandom.nextInt(2), tZ, this.mBetweenMeta, false);
BlockPos blockPos = new BlockPos(tX, tMinY + 2 + aRandom.nextInt(2), tZ);
if(isGenerationAllowed(aWorld, blockPos)) {
GT_TileEntity_Ores.setOreBlock(aWorld, blockPos, this.mBetweenMeta, false);
}
}
if (this.mPrimaryMeta > 0) {
for (int i = tMinY + 3; i < tMinY + 6; i++) {
if ((aRandom.nextInt(Math.max(1, Math.max(Math.abs(cZ - tZ), Math.abs(eZ - tZ)) / this.mDensity)) == 0) || (aRandom.nextInt(Math.max(1, Math.max(Math.abs(cX - tX), Math.abs(eX - tX)) / this.mDensity)) == 0)) {
GT_TileEntity_Ores.setOreBlock(aWorld, tX, i, tZ, this.mPrimaryMeta, false);
BlockPos blockPos = new BlockPos(tX, i, tZ);
if(isGenerationAllowed(aWorld, blockPos)) {
GT_TileEntity_Ores.setOreBlock(aWorld, blockPos, this.mPrimaryMeta, false);
}
}
}
}
if ((this.mSporadicMeta > 0) && ((aRandom.nextInt(Math.max(1, Math.max(Math.abs(cZ - tZ), Math.abs(eZ - tZ)) / this.mDensity)) == 0) || (aRandom.nextInt(Math.max(1, Math.max(Math.abs(cX - tX), Math.abs(eX - tX)) / this.mDensity)) == 0))) {
GT_TileEntity_Ores.setOreBlock(aWorld, tX, tMinY - 1 + aRandom.nextInt(7), tZ, this.mSporadicMeta, false);
BlockPos blockPos = new BlockPos(tX, tMinY - 1 + aRandom.nextInt(7), tZ);
if(isGenerationAllowed(aWorld, blockPos)) {
GT_TileEntity_Ores.setOreBlock(aWorld, blockPos, this.mSporadicMeta, false);
}
}
}
}

View file

@ -4,6 +4,7 @@ import gregtech.api.GregTech_API;
import gregtech.api.enums.Materials;
import gregtech.api.world.GT_Worldgen;
import gregtech.common.blocks.GT_TileEntity_Ores;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraft.world.chunk.IChunkProvider;
@ -38,13 +39,16 @@ public class GT_Worldgen_GT_Ore_SmallPieces
if (!this.mBiome.equals("None") && !(this.mBiome.equals(aBiome))) {
return false; //Not the correct biome for ore mix
}
if (!isGenerationAllowed(aWorld, aDimensionType, ((aDimensionType == -1) && (this.mNether)) || ((aDimensionType == 0) && (this.mOverworld)) || ((aDimensionType == 1) && (this.mEnd)) ? aDimensionType : aDimensionType ^ 0xFFFFFFFF)) {
if (!isDimensionAllowed(aWorld, aDimensionType, mNether, mOverworld, mEnd)) {
return false;
}
if (this.mMeta > 0) {
int i = 0;
for (int j = Math.max(1, this.mAmount / 2 + aRandom.nextInt(this.mAmount) / 2); i < j; i++) {
GT_TileEntity_Ores.setOreBlock(aWorld, aChunkX + aRandom.nextInt(16), this.mMinY + aRandom.nextInt(Math.max(1, this.mMaxY - this.mMinY)), aChunkZ + aRandom.nextInt(16), this.mMeta, true);
BlockPos blockPos = new BlockPos(aChunkX + aRandom.nextInt(16), this.mMinY + aRandom.nextInt(Math.max(1, this.mMaxY - this.mMinY)), aChunkZ + aRandom.nextInt(16));
if(isGenerationAllowed(aWorld, blockPos)) {
GT_TileEntity_Ores.setOreBlock(aWorld, blockPos, this.mMeta, true);
}
}
}
return true;

View file

@ -25,7 +25,7 @@ public class GT_Worldgen_Stone
@Override
public boolean executeWorldgen(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX, int aChunkZ, IChunkGenerator aChunkGenerator, IChunkProvider aChunkProvider) {
if ((isGenerationAllowed(aWorld, aDimensionType, this.mDimensionType)) && ((this.mBiomeList.isEmpty()) || (this.mBiomeList.contains(aBiome))) && ((this.mProbability <= 1) || (aRandom.nextInt(this.mProbability) == 0))) {
if ((isDimensionAllowed(aWorld, aDimensionType, this.mDimensionType)) && ((this.mBiomeList.isEmpty()) || (this.mBiomeList.contains(aBiome))) && ((this.mProbability <= 1) || (aRandom.nextInt(this.mProbability) == 0))) {
for (int i = 0; i < this.mAmount; i++) {
int tX = aChunkX + aRandom.nextInt(16);
int tY = this.mMinY + aRandom.nextInt(this.mMaxY - this.mMinY);
@ -71,7 +71,7 @@ public class GT_Worldgen_Stone
((GT_TileEntity_Ores)tTileEntity).overrideOreBlockMaterial(this.mBlock, (byte) this.mBlockMeta);
}
} else if ((this.mAllowToGenerateinVoid && aWorld.isAirBlock(randPos)) ||
(tTargetedBlock != null && tTargetedBlock.getBlock().isReplaceableOreGen(tTargetedBlock, aWorld, randPos, GT_Worldgen_Ore_Normal.STONE))) {
(tTargetedBlock != null && tTargetedBlock.getBlock().isReplaceableOreGen(tTargetedBlock, aWorld, randPos, GT_Worldgen_Ore_Normal.ANY))) {
aWorld.setBlockState(randPos, this.mBlock.getStateFromMeta(mBlockMeta));
}
}

View file

@ -21,6 +21,7 @@ import net.minecraft.world.gen.ChunkProviderHell;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.concurrent.CopyOnWriteArrayList;
public class GT_Worldgenerator implements IWorldGenerator {
@ -29,7 +30,7 @@ public class GT_Worldgenerator implements IWorldGenerator {
private static int endMinSize = 50;
private static int endMaxSize = 200;
private static boolean endAsteroids = true;
public List<Runnable> mList = new ArrayList();
public List<Runnable> mList = new CopyOnWriteArrayList<>();
public boolean mIsGenerating = false;
@ -43,23 +44,14 @@ public class GT_Worldgenerator implements IWorldGenerator {
@Override
public void generate(Random aRandom, int aX, int aZ, World aWorld, IChunkGenerator aChunkGenerator, IChunkProvider aChunkProvider) {
/*Biome biome = aWorld.getBiomeGenForCoords(new BlockPos(aX * 16 + 8, 16, aZ * 16 + 8));
this.mList.add(new WorldGenContainer(new Random(aRandom.nextInt()), aX * 16, aZ * 16,
(aChunkGenerator instanceof ChunkProviderEnd || biome == Biomes.SKY) ? 1 :
(aChunkGenerator instanceof ChunkProviderHell || biome == Biomes.HELL) ? -1 : 0,
aWorld, aChunkGenerator, aChunkProvider, biome.getBiomeName()));
if (!this.mIsGenerating) {
this.mIsGenerating = true;
for (Runnable aMList : this.mList) {
aMList.run();
}
this.mList.clear();
this.mIsGenerating = false;
}
if(aRandom.nextInt(4) == 0) {
//TODO less lag on ore gen
Biome biome = aWorld.getBiomeGenForCoords(new BlockPos(aX * 16 + 8, 16, aZ * 16 + 8));
new WorldGenContainer(new Random(aRandom.nextInt()), aX * 16, aZ * 16,
(aChunkGenerator instanceof ChunkProviderEnd || biome == Biomes.SKY) ? 1 :
(aChunkGenerator instanceof ChunkProviderHell || biome == Biomes.HELL) ? -1 : 0,
aWorld, aChunkGenerator, aChunkProvider, biome.getBiomeName()).run();*/
aWorld, aChunkGenerator, aChunkProvider, biome.getBiomeName()).run();
}
}
public static class WorldGenContainer
@ -197,14 +189,15 @@ public class GT_Worldgenerator implements IWorldGenerator {
if ((var39 * var39 + var42 * var42 + var45 * var45 < 1.0D) && mWorld.isAirBlock(randPos)) {
int ranOre = aRandom.nextInt(50);
if (ranOre < 3) {
GT_TileEntity_Ores.setOreBlock(mWorld, eX, eY, eZ, primaryMeta , true);
GT_TileEntity_Ores.setOreBlock(mWorld, randPos, primaryMeta , true);
} else if (ranOre < 6) {
GT_TileEntity_Ores.setOreBlock(mWorld, eX, eY, eZ, secondaryMeta , true);
GT_TileEntity_Ores.setOreBlock(mWorld, randPos, secondaryMeta , true);
} else if (ranOre < 8) {
GT_TileEntity_Ores.setOreBlock(mWorld, eX, eY, eZ, betweenMeta , true);
GT_TileEntity_Ores.setOreBlock(mWorld, randPos, betweenMeta , true);
} else if (ranOre < 10) {
GT_TileEntity_Ores.setOreBlock(mWorld, eX, eY, eZ, sporadicMeta , true);
} else {mWorld.setBlockState(randPos, Blocks.END_STONE.getDefaultState());
GT_TileEntity_Ores.setOreBlock(mWorld, randPos, sporadicMeta , true);
} else {
mWorld.setBlockState(randPos, Blocks.END_STONE.getDefaultState());
}
}
}

View file

@ -19,7 +19,6 @@ public class GT_Block_Granites extends GT_Block_Stones_Abstract {
public GT_Block_Granites() {
super(GT_Item_Granites.class, "gt.blockgranites");
setResistance(60.0F);
World w = null;
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "Black Granite");
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".1.name", "Black Granite Cobblestone");
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".2.name", "Mossy Black Granite Cobblestone");

View file

@ -27,11 +27,6 @@ public class GT_Block_Metal extends GT_Block_Storage implements IBlockIconProvid
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + i + ".name", "Block of " + aMats[i].mDefaultLocalName);
GT_OreDictUnificator.registerOre(aPrefix, aMats[i], new ItemStack(this, 1, i));
}
if (aMats.length < 16 && Loader.isModLoaded("JustEnoughItems")) {
for (int i = aMats.length; i < 16; i++) {
Internal.getHelpers().getItemBlacklist().addItemToBlacklist(new ItemStack(this, 1, i));
}
}
}
@Override

View file

@ -11,9 +11,11 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.Explosion;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.Loader;
import gregtech.GT_Mod;
import gregtech.api.GregTech_API;
@ -36,12 +38,12 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
public abstract class GT_Block_Ores_Abstract extends GT_Generic_Block implements ITileEntityProvider, ITextureBlockIconProvider {
public static ThreadLocal<GT_TileEntity_Ores> mTemporaryTileEntity = new ThreadLocal<>();
public static boolean FUCKING_LOCK = false;
public static boolean tHideOres;
protected GT_Block_Ores_Abstract(String aUnlocalizedName, boolean aHideFirstMeta, Material aMaterial) {
@ -104,17 +106,14 @@ public abstract class GT_Block_Ores_Abstract extends GT_Generic_Block implements
}
}
@Override
public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor) {
if (!FUCKING_LOCK) {
FUCKING_LOCK = true;
TileEntity tTileEntity = world.getTileEntity(pos);
if ((tTileEntity instanceof GT_TileEntity_Ores)) {
((GT_TileEntity_Ores) tTileEntity).onUpdated();
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn) {
GT_TileEntity_Ores tileEntity_ores = (GT_TileEntity_Ores) worldIn.getTileEntity(pos);
if (tileEntity_ores != null && !worldIn.isRemote) {
tileEntity_ores.sendPacket();
}
}
FUCKING_LOCK = false;
}
public String getLocalizedName(Materials aMaterial) {
switch (aMaterial) {

View file

@ -10,6 +10,7 @@ import gregtech.api.util.GT_Log;
import gregtech.api.util.GT_Utility;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
@ -22,10 +23,11 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import java.awt.*;
import java.util.List;
public class GT_Item_Machines
extends ItemBlock {
extends ItemBlock implements IItemColor {
public GT_Item_Machines(Block par1) {
super(par1);
setMaxDamage(0);
@ -160,4 +162,8 @@ public class GT_Item_Machines
return true;
}
@Override
public int getColorFromItemstack(ItemStack stack, int tintIndex) {
return Color.WHITE.getRGB();
}
}

View file

@ -3,11 +3,14 @@ package gregtech.common.blocks;
import com.google.common.io.ByteArrayDataInput;
import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine;
import gregtech.api.net.GT_Packet;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class GT_Packet_Ores
extends GT_Packet {
@ -49,12 +52,10 @@ public class GT_Packet_Ores
public void process(IBlockAccess aWorld) {
if (aWorld != null) {
BlockPos blockPos = new BlockPos(this.mX, this.mY, this.mZ);
TileEntity tTileEntity = aWorld.getTileEntity(blockPos);
if ((tTileEntity instanceof GT_TileEntity_Ores)) {
((GT_TileEntity_Ores) tTileEntity).mMetaData = this.mMetaData;
}
if (((aWorld instanceof World)) && (((World) aWorld).isRemote)) {
((World) aWorld).markBlockRangeForRenderUpdate(blockPos, blockPos);
GT_TileEntity_Ores tileEntity_ores = (GT_TileEntity_Ores) aWorld.getTileEntity(blockPos);
if(tileEntity_ores != null) {
tileEntity_ores.mMetaData = mMetaData;
tileEntity_ores.causeChunkUpdate();
}
}
}

View file

@ -0,0 +1,111 @@
package gregtech.common.blocks;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import java.util.ArrayList;
import java.util.HashMap;
public class GT_TickHandler_Ores {
public static HashMap<Integer, HashMap<ChunkCoordIntPair, ArrayList<GT_TileEntity_Ores>>> data = new HashMap<>();
public GT_TickHandler_Ores() {
MinecraftForge.EVENT_BUS.register(this);
}
public static void loadChunkOre(GT_TileEntity_Ores gt_tileEntity_ores) {
getChunkData(
gt_tileEntity_ores.getWorld().provider.getDimension(),
new ChunkCoordIntPair(gt_tileEntity_ores.getPos()))
.add(gt_tileEntity_ores);
}
public static void unloadChunkOre(GT_TileEntity_Ores gt_tileEntity_ores) {
getChunkData(
gt_tileEntity_ores.getWorld().provider.getDimension(),
new ChunkCoordIntPair(gt_tileEntity_ores.getPos()))
.remove(gt_tileEntity_ores);
}
public static ArrayList<GT_TileEntity_Ores> getChunkData(int dimension, ChunkCoordIntPair chunk) {
HashMap<ChunkCoordIntPair, ArrayList<GT_TileEntity_Ores>> dimensionData = data.get(dimension);
if(dimensionData == null) {
dimensionData = new HashMap<>();
data.put(dimension, dimensionData);
}
ArrayList<GT_TileEntity_Ores> oresData = dimensionData.get(chunk);
if(oresData == null) {
oresData = new ArrayList<>();
dimensionData.put(chunk, oresData);
}
return oresData;
}
@SubscribeEvent
public void onPlayerTick(TickEvent.PlayerTickEvent player) {
EntityPlayer entityPlayer = player.player;
World world = entityPlayer.worldObj;
if(world.getWorldTime() % 40 == 0) {
ChunkCoordIntPair chunk = new ChunkCoordIntPair(new BlockPos(entityPlayer));
for (int x = -1; x < 1; x++) {
for (int z = -1; z < 1; z++) {
ChunkCoordIntPair offset = chunk.offset(x, z);
ArrayList<GT_TileEntity_Ores> ores = getChunkData(world.provider.getDimension(), offset);
ores.removeIf(TileEntity::isInvalid);
for(GT_TileEntity_Ores oresTile : ores) {
if(!oresTile.isBlocked()) oresTile.sendPacket();
}
}
}
}
}
public static class ChunkCoordIntPair {
public final int coordX;
public final int coordZ;
public ChunkCoordIntPair(BlockPos pos) {
this(pos.getX() >> 4, pos.getZ() >> 4);
}
public ChunkCoordIntPair(int coordX, int coordZ) {
this.coordX = coordX;
this.coordZ = coordZ;
}
public ChunkCoordIntPair offset(int x, int z) {
if(x == 0 && z == 0) return this;
return new ChunkCoordIntPair(coordX + x, coordZ + z);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof ChunkCoordIntPair)) return false;
ChunkCoordIntPair that = (ChunkCoordIntPair) o;
if (coordX != that.coordX) return false;
if (coordZ != that.coordZ) return false;
return true;
}
@Override
public int hashCode() {
int result = coordX;
result = 31 * result + coordZ;
return result;
}
}
}

View file

@ -7,31 +7,31 @@ import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.ITexturedTileEntity;
import gregtech.api.items.GT_Generic_Block;
import gregtech.api.objects.GT_CopiedBlockTexture;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Utility;
import gregtech.api.world.GT_Worldgen_Ore_Normal;
import net.minecraft.block.Block;
import net.minecraft.block.BlockAir;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Random;
public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntity {
public short mMetaData = 0;
public boolean mNatural = false;
public boolean mBlocked = true;
public static byte getHarvestData(short aMetaData) {
Materials aMaterial = GregTech_API.sGeneratedMaterials[(aMetaData % 1000)];
@ -42,8 +42,8 @@ public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntit
return tByte;
}
public static boolean setOreBlock(World aWorld, int aX, int aY, int aZ, int aMetaData, boolean isSmallOre) {
return setOreBlock(aWorld, aX, aY, aZ, aMetaData, isSmallOre, false);
public static boolean setOreBlock(World aWorld, BlockPos blockPos, int aMetaData, boolean isSmallOre) {
return setOreBlock(aWorld, blockPos.getX(), blockPos.getY(), blockPos.getZ(), aMetaData, isSmallOre, false);
}
public static boolean setOreBlock(World aWorld, int aX, int aY, int aZ, int aMetaData, boolean isSmallOre, boolean air) {
@ -53,10 +53,12 @@ public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntit
BlockPos blockPos = new BlockPos(aX, aY, aZ);
IBlockState blockState = aWorld.getBlockState(blockPos);
Block tBlock = blockState.getBlock();
Block tOreBlock = GregTech_API.sBlockOres1;
int BlockMeta = tBlock.getMetaFromState(blockState);
String BlockName = tBlock.getUnlocalizedName();
Block tOreBlock = GregTech_API.sBlockOres1;
aMetaData += isSmallOre ? 16000 : 0;
if ((aMetaData > 0) && ((tBlock != Blocks.AIR) || air)) {
if (BlockName.equals("tile.igneousStone")) {
if (GregTech_API.sBlockOresUb1 != null) {
@ -73,9 +75,20 @@ public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntit
tOreBlock = GregTech_API.sBlockOresUb3;
aMetaData += (BlockMeta * 1000);
}
} else if (tBlock.isReplaceableOreGen(blockState, aWorld, blockPos, GT_Worldgen_Ore_Normal.STONE)) {
} else if (tBlock == Blocks.NETHERRACK) {
aMetaData += 1000;
} else if(tBlock == Blocks.END_STONE) {
aMetaData += 2000;
} else if(tBlock == GregTech_API.sBlockGranites && BlockMeta == 0) {
aMetaData += 3000;
} else if(tBlock == GregTech_API.sBlockGranites && BlockMeta == 8) {
aMetaData += 4000;
} else if(tBlock == GregTech_API.sBlockStones && BlockMeta == 0) {
aMetaData += 5000;
} else if(tBlock == GregTech_API.sBlockStones && BlockMeta == 8) {
aMetaData += 6000;
}
aWorld.setBlockState(blockPos, tOreBlock.getStateFromMeta(getHarvestData((short) aMetaData)), 0);
TileEntity tTileEntity = aWorld.getTileEntity(blockPos);
if ((tTileEntity instanceof GT_TileEntity_Ores)) {
@ -102,32 +115,23 @@ public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntit
return aNBT;
}
public void onUpdated() {
if ((!this.worldObj.isRemote) && (this.mBlocked)) {
this.mBlocked = false;
GT_Values.NW.sendPacketToAllPlayersInRange(this.worldObj, new GT_Packet_Ores(getPos(), this.mMetaData), getPos().getX(), getPos().getZ());
public void sendPacket() {
if (!worldObj.isRemote) {
GT_Values.NW.sendPacketToAllPlayersInRange(this.worldObj,
new GT_Packet_Ores(getPos(), this.mMetaData),
getPos().getX(), getPos().getZ());
}
}
@Nullable
@Override
public SPacketUpdateTileEntity getUpdatePacket() {
if (!this.worldObj.isRemote) {
updateBlocked();
if (!this.mBlocked) {
GT_Values.NW.sendPacketToAllPlayersInRange(this.worldObj, new GT_Packet_Ores(getPos(), this.mMetaData), getPos().getX(), getPos().getZ());
}
}
return null;
}
public void updateBlocked() {
mBlocked = !(GT_Utility.isOpaqueBlock(worldObj, getPos().up()) ||
GT_Utility.isOpaqueBlock(worldObj, getPos().down()) ||
GT_Utility.isOpaqueBlock(worldObj, getPos().east()) ||
GT_Utility.isOpaqueBlock(worldObj, getPos().west()) ||
GT_Utility.isOpaqueBlock(worldObj, getPos().south()) ||
GT_Utility.isOpaqueBlock(worldObj, getPos().north()));
@SideOnly(Side.CLIENT)
public void causeChunkUpdate() {
int minX = pos.getX() - 5;
int minY = pos.getY() - 5;
int minZ = pos.getZ() - 5;
int maxX = pos.getX() + 5;
int maxY = pos.getY() + 5;
int maxZ = pos.getZ() + 5;
Minecraft.getMinecraft().renderGlobal.markBlockRangeForRenderUpdate(minX, minY, minZ, maxX, maxY, maxZ);
}
public void overrideOreBlockMaterial(Block aOverridingStoneBlock, byte aOverridingStoneMeta) {
@ -160,6 +164,26 @@ public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntit
this.worldObj.setBlockState(getPos(), getBlockType().getStateFromMeta(getHarvestData(this.mMetaData)), 0);
}
@Override
public void invalidate() {
super.invalidate();
GT_TickHandler_Ores.unloadChunkOre(this);
}
@Override
public void validate() {
super.validate();
GT_TickHandler_Ores.loadChunkOre(this);
}
public boolean isBlocked() {
for(EnumFacing offset : EnumFacing.VALUES) {
if(!GT_Utility.isOpaqueBlock(worldObj, pos.offset(offset)))
return false;
}
return true;
}
public void convertOreBlock(World aWorld, int aX, int aY, int aZ) {
short aMeta = ((short) (int) (this.mMetaData % 1000 + (this.mMetaData / 16000 * 16000)));
aWorld.setBlockState(new BlockPos(aX, aY, aZ), GregTech_API.sBlockOres1.getStateFromMeta(getHarvestData(aMeta)));

View file

@ -2,7 +2,9 @@ package gregtech.common.items;
import gregtech.api.interfaces.IIconContainer;
import gregtech.common.render.newitems.IItemIconContainerProvider;
import gregtech.common.render.newitems.IItemIconProvider;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@ -20,7 +22,7 @@ import net.minecraftforge.fluids.FluidRegistry;
import java.util.List;
public class GT_FluidDisplayItem extends GT_Generic_Item implements IItemColor, IItemIconContainerProvider {
public class GT_FluidDisplayItem extends GT_Generic_Item implements IItemColor {
public GT_FluidDisplayItem() {
super("GregTech_FluidDisplay", "Fluid Display", null);
ItemList.Display_Fluid.set(this);
@ -46,9 +48,9 @@ public class GT_FluidDisplayItem extends GT_Generic_Item implements IItemColor,
}
@Override
public IIconContainer getIconContainer(ItemStack stack) {
public TextureAtlasSprite getIcon(ItemStack stack, int pass) {
Fluid tFluid = FluidRegistry.getFluid(stack.getItemDamage());
return GT_Utility.sprite2Container(GT_Utility.getTexture(tFluid.getStill()));
return GT_Utility.getTexture(tFluid.getStill());
}
@Override

View file

@ -7,6 +7,8 @@ import gregtech.common.render.newitems.ModelUtil;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
@ -76,7 +78,7 @@ public class BlockRenderer {
if(side != null) {
TextureAtlasSprite sideIcon = getSideSprite(side);
if (sideIcon != null) {
BakedQuad faceQuad = RenderUtil.renderSide(DefaultVertexFormats.BLOCK, sideIcon, side, side.getIndex(), 0.0F, 0xFFFFFF);
BakedQuad faceQuad = RenderUtil.renderSide(DefaultVertexFormats.BLOCK, sideIcon, side, side.getIndex(), 0.0F, -1, true);
if (faceQuad != null) {
return Collections.singletonList(faceQuad);
}
@ -99,7 +101,7 @@ public class BlockRenderer {
if(side != null && state != null) {
TextureAtlasSprite sideIcon = getSideSprite(side, state);
if (sideIcon != null) {
BakedQuad faceQuad = RenderUtil.renderSide(DefaultVertexFormats.BLOCK, sideIcon, side, side.getIndex(), 0.0F, 0xFFFFFF);
BakedQuad faceQuad = RenderUtil.renderSide(DefaultVertexFormats.BLOCK, sideIcon, side, side.getIndex(), 0.0F, -1, false);
if (faceQuad != null) {
return Collections.singletonList(faceQuad);
}
@ -128,7 +130,7 @@ public class BlockRenderer {
ITexture[] textures = provider.getTexture(Minecraft.getMinecraft().theWorld, pos, blockState, side);
for (ITexture texture : textures) {
if(texture != null) {
quads.addAll(texture.getQuads(state.getBlock(), pos, side, 0));
quads.addAll(texture.getQuads(state.getBlock(), pos, side, side.getIndex()));
}
}
return quads;
@ -153,12 +155,14 @@ public class BlockRenderer {
@Override
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) {
if(side != null) {
GlStateManager.enableLighting();
RenderHelper.enableGUIStandardItemLighting();
ArrayList<BakedQuad> quads = new ArrayList<>();
ITextureBlockIconProvider provider = (ITextureBlockIconProvider) block;
ITexture[] textures = provider.getItemblockTexture(holder, itemStack, side);
for (ITexture texture : textures) {
if(texture != null) {
quads.addAll(texture.getQuads(block, null, side, side.getIndex() * 1000));
quads.addAll(texture.getQuads(block, null, side, side.getIndex()));
}
}
return quads;

View file

@ -12,12 +12,12 @@ import java.awt.*;
public class RenderUtil {
public static BakedQuad renderSide(VertexFormat vertexFormat, TextureAtlasSprite sprite, EnumFacing side, int tint, float offset, int color) {
public static BakedQuad renderSide(VertexFormat vertexFormat, TextureAtlasSprite sprite, EnumFacing side, int tint, float offset, int color, boolean hideSiding) {
switch (side) {
case NORTH:
//front
return buildQuad(vertexFormat, EnumFacing.NORTH, sprite, tint,
return buildQuad(vertexFormat, hideSiding ? null : EnumFacing.NORTH, sprite, tint,
0, 0, -offset, sprite.getMinU(), sprite.getMinV(),
0, 1, -offset, sprite.getMinU(), sprite.getMaxV(),
1, 1, -offset, sprite.getMaxU(), sprite.getMaxV(),
@ -25,35 +25,35 @@ public class RenderUtil {
color);
case SOUTH:
// back
return buildQuad(vertexFormat, EnumFacing.SOUTH, sprite, tint,
return buildQuad(vertexFormat, hideSiding ? null : EnumFacing.SOUTH, sprite, tint,
1, 0, 1 + offset, sprite.getMaxU(), sprite.getMinV(),
1, 1, 1 + offset, sprite.getMaxU(), sprite.getMaxV(),
0, 1, 1 + offset, sprite.getMinU(), sprite.getMaxV(),
0, 0, 1 + offset, sprite.getMinU(), sprite.getMinV(),
color);
case WEST:
return buildQuad(vertexFormat, EnumFacing.WEST, sprite, tint,
return buildQuad(vertexFormat, hideSiding ? null : EnumFacing.WEST, sprite, tint,
-offset, 0, 1, sprite.getMaxU(), sprite.getMaxV(),
-offset, 1, 1 , sprite.getMaxU(), sprite.getMinV(),
-offset, 1, 0, sprite.getMinU(), sprite.getMinV(),
-offset, 0, 0, sprite.getMinU(), sprite.getMaxV(),
color);
case EAST:
return buildQuad(vertexFormat, EnumFacing.EAST, sprite, tint,
return buildQuad(vertexFormat, hideSiding ? null : EnumFacing.EAST, sprite, tint,
1 + offset, 0, 0, sprite.getMaxU(), sprite.getMaxV(),
1 + offset, 1, 0 , sprite.getMaxU(), sprite.getMinV(),
1 + offset, 1, 1, sprite.getMinU(), sprite.getMinV(),
1 + offset, 0, 1, sprite.getMinU(), sprite.getMaxV(),
color);
case DOWN:
return buildQuad(vertexFormat, EnumFacing.DOWN, sprite, tint,
return buildQuad(vertexFormat, hideSiding ? null : EnumFacing.DOWN, sprite, tint,
0, -offset, 0, sprite.getMinU(), sprite.getMinV(),
1, -offset, 0, sprite.getMaxU(), sprite.getMinV(),
1, -offset, 1, sprite.getMaxU(), sprite.getMaxV(),
0, -offset, 1, sprite.getMinU(), sprite.getMaxV(),
color);
case UP:
return buildQuad(vertexFormat, EnumFacing.UP, sprite, tint,
return buildQuad(vertexFormat, hideSiding ? null : EnumFacing.UP, sprite, tint,
0, 1 + offset, 1, sprite.getMinU(), sprite.getMaxV(),
1, 1 + offset, 1, sprite.getMaxU(), sprite.getMaxV(),
1, 1 + offset, 0, sprite.getMaxU(), sprite.getMinV(),
@ -94,10 +94,14 @@ public class RenderUtil {
builder.put(e, x, y, z, 1);
break;
case COLOR:
if(color == -1) {
builder.put(e, 1f, 1f, 1f, 1f);
} else {
builder.put(e,
((color >> 16) & 0xFF) / 255.0F,
((color >> 8) & 0xFF) / 255.0F,
((color) & 0xFF) / 255.0F, 1f);
}
break;
case UV: if(format.getElement(e).getIndex() == 0)
{
@ -105,7 +109,7 @@ public class RenderUtil {
break;
}
case NORMAL:
builder.put(e, 0.0F, 0.0F, 0.0F, 1.0F);
builder.put(e, 0.0F, 0.0F, 1.0F, 0.0F);
break;
default:
builder.put(e);

View file

@ -0,0 +1,674 @@
package gregtech.jei;
import gregtech.api.util.GT_LanguageManager;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
import mezz.jei.Internal;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IGuiFluidStackGroup;
import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.gui.ITooltipCallback;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fluids.FluidStack;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
public class JEIGregtechRecipe implements IRecipeWrapper {
private IGuiHelper jeiHelper;
protected final GT_Recipe.GT_Recipe_Map mRecipeMap;
protected final GT_Recipe mRecipe;
public JEIGregtechRecipe(GT_Recipe.GT_Recipe_Map mRecipeMap, GT_Recipe mRecipe) {
this.mRecipe = mRecipe;
this.mRecipeMap = mRecipeMap;
this.jeiHelper = Internal.getHelpers().getGuiHelper();
jeiHelper.getSlotDrawable();
}
public void init(IRecipeLayout layout) {
int tStartIndex = 0;
IGuiItemStackGroup mInputs = layout.getItemStacks();
IGuiFluidStackGroup mFluids = layout.getFluidStacks();
switch (mRecipeMap.mUsualInputCount) {
case 0:
break;
case 1:
if (mRecipe.getNEIAdaptedInput(tStartIndex) != null) {
mInputs.init(tStartIndex, true, 48 + 3, 14);
mInputs.set(tStartIndex, mRecipe.getNEIAdaptedInput(tStartIndex));
}
tStartIndex++;
break;
case 2:
if (mRecipe.getNEIAdaptedInput(tStartIndex) != null) {
mInputs.init(tStartIndex, true, 30 + 3, 14);
mInputs.set(tStartIndex, mRecipe.getNEIAdaptedInput(tStartIndex));;
}
tStartIndex++;
if (mRecipe.getNEIAdaptedInput(tStartIndex) != null) {
mInputs.init(tStartIndex, true, 48 + 3, 14);
mInputs.set(tStartIndex, mRecipe.getNEIAdaptedInput(tStartIndex));
}
tStartIndex++;
break;
case 3:
if (mRecipe.getNEIAdaptedInput(tStartIndex) != null) {
mInputs.init(tStartIndex, true, 12 + 3, 14);
mInputs.set(tStartIndex, mRecipe.getNEIAdaptedInput(tStartIndex));
}
tStartIndex++;
if (mRecipe.getNEIAdaptedInput(tStartIndex) != null) {
mInputs.init(tStartIndex, true, 30 + 3, 14);
mInputs.set(tStartIndex, mRecipe.getNEIAdaptedInput(tStartIndex));
}
tStartIndex++;
if (mRecipe.getNEIAdaptedInput(tStartIndex) != null) {
mInputs.init(tStartIndex, true, 48 + 3, 14);
mInputs.set(tStartIndex, mRecipe.getNEIAdaptedInput(tStartIndex));
}
tStartIndex++;
break;
case 4:
if (mRecipe.getNEIAdaptedInput(tStartIndex) != null) {
mInputs.init(tStartIndex, true, 30 + 3, 5);
mInputs.set(tStartIndex, mRecipe.getNEIAdaptedInput(tStartIndex));
}
tStartIndex++;
if (mRecipe.getNEIAdaptedInput(tStartIndex) != null) {
mInputs.init(tStartIndex, true, 48 + 3, 5);
mInputs.set(tStartIndex, mRecipe.getNEIAdaptedInput(tStartIndex));
}
tStartIndex++;
if (mRecipe.getNEIAdaptedInput(tStartIndex) != null) {
mInputs.init(tStartIndex, true, 30 + 3, 23);
mInputs.set(tStartIndex, mRecipe.getNEIAdaptedInput(tStartIndex));
}
tStartIndex++;
if (mRecipe.getNEIAdaptedInput(tStartIndex) != null) {
mInputs.init(tStartIndex, true, 48 + 3, 23);
mInputs.set(tStartIndex, mRecipe.getNEIAdaptedInput(tStartIndex));
}
tStartIndex++;
break;
case 5:
if (mRecipe.getNEIAdaptedInput(tStartIndex) != null) {
mInputs.init(tStartIndex, true, 12 + 3, 5);
mInputs.set(tStartIndex, mRecipe.getNEIAdaptedInput(tStartIndex));
}
tStartIndex++;
if (mRecipe.getNEIAdaptedInput(tStartIndex) != null) {
mInputs.init(tStartIndex, true, 30 + 3, 5);
mInputs.set(tStartIndex, mRecipe.getNEIAdaptedInput(tStartIndex));
}
tStartIndex++;
if (mRecipe.getNEIAdaptedInput(tStartIndex) != null) {
mInputs.init(tStartIndex, true, 48 + 3, 5);
mInputs.set(tStartIndex, mRecipe.getNEIAdaptedInput(tStartIndex));
}
tStartIndex++;
if (mRecipe.getNEIAdaptedInput(tStartIndex) != null) {
mInputs.init(tStartIndex, true, 30 + 3, 23);
mInputs.set(tStartIndex, mRecipe.getNEIAdaptedInput(tStartIndex));
}
tStartIndex++;
if (mRecipe.getNEIAdaptedInput(tStartIndex) != null) {
mInputs.init(tStartIndex, true, 48 + 3, 23);
mInputs.set(tStartIndex, mRecipe.getNEIAdaptedInput(tStartIndex));
}
tStartIndex++;
break;
case 6:
if (mRecipe.getNEIAdaptedInput(tStartIndex) != null) {
mInputs.init(tStartIndex, true, 12 + 3, 5);
mInputs.set(tStartIndex, mRecipe.getNEIAdaptedInput(tStartIndex));
}
tStartIndex++;
if (mRecipe.getNEIAdaptedInput(tStartIndex) != null) {
mInputs.init(tStartIndex, true, 30 + 3, 5);
mInputs.set(tStartIndex, mRecipe.getNEIAdaptedInput(tStartIndex));
}
tStartIndex++;
if (mRecipe.getNEIAdaptedInput(tStartIndex) != null) {
mInputs.init(tStartIndex, true, 48 + 3, 5);
mInputs.set(tStartIndex, mRecipe.getNEIAdaptedInput(tStartIndex));
}
tStartIndex++;
if (mRecipe.getNEIAdaptedInput(tStartIndex) != null) {
mInputs.init(tStartIndex, true, 12 + 3, 23);
mInputs.set(tStartIndex, mRecipe.getNEIAdaptedInput(tStartIndex));
}
tStartIndex++;
if (mRecipe.getNEIAdaptedInput(tStartIndex) != null) {
mInputs.init(tStartIndex, true, 30 + 3, 23);
mInputs.set(tStartIndex, mRecipe.getNEIAdaptedInput(tStartIndex));
}
tStartIndex++;
if (mRecipe.getNEIAdaptedInput(tStartIndex) != null) {
mInputs.init(tStartIndex, true, 48 + 3, 23);
mInputs.set(tStartIndex, mRecipe.getNEIAdaptedInput(tStartIndex));
}
tStartIndex++;
break;
case 7:
if (mRecipe.getNEIAdaptedInput(tStartIndex) != null) {
mInputs.init(tStartIndex, true, 12 + 3, -4);
mInputs.set(tStartIndex, mRecipe.getNEIAdaptedInput(tStartIndex));
}
tStartIndex++;
if (mRecipe.getNEIAdaptedInput(tStartIndex) != null) {
mInputs.init(tStartIndex, true, 30 + 3, -4);
mInputs.set(tStartIndex, mRecipe.getNEIAdaptedInput(tStartIndex));
}
tStartIndex++;
if (mRecipe.getNEIAdaptedInput(tStartIndex) != null) {
mInputs.init(tStartIndex, true, 48 + 3, -4);
mInputs.set(tStartIndex, mRecipe.getNEIAdaptedInput(tStartIndex));
}
tStartIndex++;
if (mRecipe.getNEIAdaptedInput(tStartIndex) != null) {
mInputs.init(tStartIndex, true, 12 + 3, 14);
mInputs.set(tStartIndex, mRecipe.getNEIAdaptedInput(tStartIndex));
}
tStartIndex++;
if (mRecipe.getNEIAdaptedInput(tStartIndex) != null) {
mInputs.init(tStartIndex, true, 30 + 3, 14);
mInputs.set(tStartIndex, mRecipe.getNEIAdaptedInput(tStartIndex));
}
tStartIndex++;
if (mRecipe.getNEIAdaptedInput(tStartIndex) != null) {
mInputs.init(tStartIndex, true, 48 + 3, 14);
mInputs.set(tStartIndex, mRecipe.getNEIAdaptedInput(tStartIndex));
}
tStartIndex++;
if (mRecipe.getNEIAdaptedInput(tStartIndex) != null) {
mInputs.init(tStartIndex, true, 12 + 3, 32);
mInputs.set(tStartIndex, mRecipe.getNEIAdaptedInput(tStartIndex));
}
tStartIndex++;
break;
case 8:
if (mRecipe.getNEIAdaptedInput(tStartIndex) != null) {
mInputs.init(tStartIndex, true, 12 + 3, -4);
mInputs.set(tStartIndex, mRecipe.getNEIAdaptedInput(tStartIndex));
}
tStartIndex++;
if (mRecipe.getNEIAdaptedInput(tStartIndex) != null) {
mInputs.init(tStartIndex, true, 30 + 3, -4);
mInputs.set(tStartIndex, mRecipe.getNEIAdaptedInput(tStartIndex));
}
tStartIndex++;
if (mRecipe.getNEIAdaptedInput(tStartIndex) != null) {
mInputs.init(tStartIndex, true, 48 + 3, -4);
mInputs.set(tStartIndex, mRecipe.getNEIAdaptedInput(tStartIndex));
}
tStartIndex++;
if (mRecipe.getNEIAdaptedInput(tStartIndex) != null) {
mInputs.init(tStartIndex, true, 12 + 3, 14);
mInputs.set(tStartIndex, mRecipe.getNEIAdaptedInput(tStartIndex));
}
tStartIndex++;
if (mRecipe.getNEIAdaptedInput(tStartIndex) != null) {
mInputs.init(tStartIndex, true, 30 + 3, 32);
mInputs.set(tStartIndex, mRecipe.getNEIAdaptedInput(tStartIndex));
}
tStartIndex++;
if (mRecipe.getNEIAdaptedInput(tStartIndex) != null) {
mInputs.init(tStartIndex, true, 48 + 3, 32);
mInputs.set(tStartIndex, mRecipe.getNEIAdaptedInput(tStartIndex));
}
tStartIndex++;
if (mRecipe.getNEIAdaptedInput(tStartIndex) != null) {
mInputs.init(tStartIndex, true, 12 + 3, 32);
mInputs.set(tStartIndex, mRecipe.getNEIAdaptedInput(tStartIndex));
}
tStartIndex++;
if (mRecipe.getNEIAdaptedInput(tStartIndex) != null) {
mInputs.init(tStartIndex, true, 30 + 3, 32);
mInputs.set(tStartIndex, mRecipe.getNEIAdaptedInput(tStartIndex));
}
tStartIndex++;
break;
default:
if (mRecipe.getNEIAdaptedInput(tStartIndex) != null) {
mInputs.init(tStartIndex, true, 12 + 3, -4);
mInputs.set(tStartIndex, mRecipe.getNEIAdaptedInput(tStartIndex));
}
tStartIndex++;
if (mRecipe.getNEIAdaptedInput(tStartIndex) != null) {
mInputs.init(tStartIndex, true, 30 + 3, -4);
mInputs.set(tStartIndex, mRecipe.getNEIAdaptedInput(tStartIndex));
}
tStartIndex++;
if (mRecipe.getNEIAdaptedInput(tStartIndex) != null) {
mInputs.init(tStartIndex, true, 48 + 3, -4);
mInputs.set(tStartIndex, mRecipe.getNEIAdaptedInput(tStartIndex));
}
tStartIndex++;
if (mRecipe.getNEIAdaptedInput(tStartIndex) != null) {
mInputs.init(tStartIndex, true, 12 + 3, 14);
mInputs.set(tStartIndex, mRecipe.getNEIAdaptedInput(tStartIndex));
}
tStartIndex++;
if (mRecipe.getNEIAdaptedInput(tStartIndex) != null) {
mInputs.init(tStartIndex, true, 30 + 3, 14);
mInputs.set(tStartIndex, mRecipe.getNEIAdaptedInput(tStartIndex));
}
tStartIndex++;
if (mRecipe.getNEIAdaptedInput(tStartIndex) != null) {
mInputs.init(tStartIndex, true, 48 + 3, 14);
mInputs.set(tStartIndex, mRecipe.getNEIAdaptedInput(tStartIndex));
}
tStartIndex++;
if (mRecipe.getNEIAdaptedInput(tStartIndex) != null) {
mInputs.init(tStartIndex, true, 12 + 3, 32);
mInputs.set(tStartIndex, mRecipe.getNEIAdaptedInput(tStartIndex));
}
tStartIndex++;
if (mRecipe.getNEIAdaptedInput(tStartIndex) != null) {
mInputs.init(tStartIndex, true, 30 + 3, 32);
mInputs.set(tStartIndex, mRecipe.getNEIAdaptedInput(tStartIndex));
}
tStartIndex++;
if (mRecipe.getNEIAdaptedInput(tStartIndex) != null) {
mInputs.init(tStartIndex, true, 48 + 3, 32);
mInputs.set(tStartIndex, mRecipe.getNEIAdaptedInput(tStartIndex));
}
tStartIndex++;
}
if (mRecipe.mSpecialItems != null) {
mInputs.init(100, false, 120 + 3, 52);
if(mRecipe.mSpecialItems instanceof Collection)
mInputs.set(100, (Collection<ItemStack>) mRecipe.mSpecialItems);
else if(mRecipe.mSpecialItems instanceof ItemStack)
mInputs.set(100, (ItemStack) mRecipe.mSpecialItems);
}
tStartIndex = 1000;
switch (mRecipeMap.mUsualOutputCount) {
case 0:
break;
case 1:
if (mRecipe.getOutput(tStartIndex - 1000) != null) {
mInputs.init(tStartIndex, false, 105, 14);
mInputs.set(tStartIndex, mRecipe.getOutput(tStartIndex - 1000));
}
tStartIndex++;
break;
case 2:
if (mRecipe.getOutput(tStartIndex - 1000) != null) {
mInputs.init(tStartIndex, false, 102 + 3, 14);
mInputs.set(tStartIndex, mRecipe.getOutput(tStartIndex - 1000));
}
tStartIndex++;
if (mRecipe.getOutput(tStartIndex - 1000) != null) {
mInputs.init(tStartIndex, false, 120 + 3, 14);
mInputs.set(tStartIndex, mRecipe.getOutput(tStartIndex - 1000));
}
tStartIndex++;
break;
case 3:
if (mRecipe.getOutput(tStartIndex - 1000) != null) {
mInputs.init(tStartIndex, false, 102 + 3, 14);
mInputs.set(tStartIndex, mRecipe.getOutput(tStartIndex - 1000));
}
tStartIndex++;
if (mRecipe.getOutput(tStartIndex - 1000) != null) {
mInputs.init(tStartIndex, false, 120 + 3, 14);
mInputs.set(tStartIndex, mRecipe.getOutput(tStartIndex - 1000));
}
tStartIndex++;
if (mRecipe.getOutput(tStartIndex - 1000) != null) {
mInputs.init(tStartIndex, false, 138 + 3, 14);
mInputs.set(tStartIndex, mRecipe.getOutput(tStartIndex - 1000));
}
tStartIndex++;
break;
case 4:
if (mRecipe.getOutput(tStartIndex - 1000) != null) {
mInputs.init(tStartIndex, false, 102 + 3, 5);
mInputs.set(tStartIndex, mRecipe.getOutput(tStartIndex - 1000));
}
tStartIndex++;
if (mRecipe.getOutput(tStartIndex - 1000) != null) {
mInputs.init(tStartIndex, false, 120 + 3, 5);
mInputs.set(tStartIndex, mRecipe.getOutput(tStartIndex - 1000));
}
tStartIndex++;
if (mRecipe.getOutput(tStartIndex - 1000) != null) {
mInputs.init(tStartIndex, false, 102 + 3, 23);
mInputs.set(tStartIndex, mRecipe.getOutput(tStartIndex - 1000));
}
tStartIndex++;
if (mRecipe.getOutput(tStartIndex - 1000) != null) {
mInputs.init(tStartIndex, false, 120 + 3, 23);
mInputs.set(tStartIndex, mRecipe.getOutput(tStartIndex - 1000));
}
tStartIndex++;
break;
case 5:
if (mRecipe.getOutput(tStartIndex - 1000) != null) {
mInputs.init(tStartIndex, false, 102 + 3, 5);
mInputs.set(tStartIndex, mRecipe.getOutput(tStartIndex - 1000));
}
tStartIndex++;
if (mRecipe.getOutput(tStartIndex - 1000) != null) {
mInputs.init(tStartIndex, false, 120 + 3, 5);
mInputs.set(tStartIndex, mRecipe.getOutput(tStartIndex - 1000));
}
tStartIndex++;
if (mRecipe.getOutput(tStartIndex - 1000) != null) {
mInputs.init(tStartIndex, false, 138 + 3, 5);
mInputs.set(tStartIndex, mRecipe.getOutput(tStartIndex - 1000));
}
tStartIndex++;
if (mRecipe.getOutput(tStartIndex - 1000) != null) {
mInputs.init(tStartIndex, false, 102 + 3, 23);
mInputs.set(tStartIndex, mRecipe.getOutput(tStartIndex - 1000));
}
tStartIndex++;
if (mRecipe.getOutput(tStartIndex - 1000) != null) {
mInputs.init(tStartIndex, false, 120 + 3, 23);
mInputs.set(tStartIndex, mRecipe.getOutput(tStartIndex - 1000));
}
tStartIndex++;
break;
case 6:
if (mRecipe.getOutput(tStartIndex - 1000) != null) {
mInputs.init(tStartIndex, false, 102 + 3, 5);
mInputs.set(tStartIndex, mRecipe.getOutput(tStartIndex - 1000));
}
tStartIndex++;
if (mRecipe.getOutput(tStartIndex - 1000) != null) {
mInputs.init(tStartIndex, false, 120 + 3, 5);
mInputs.set(tStartIndex, mRecipe.getOutput(tStartIndex - 1000));
}
tStartIndex++;
if (mRecipe.getOutput(tStartIndex - 1000) != null) {
mInputs.init(tStartIndex, false, 138 + 3, 5);
mInputs.set(tStartIndex, mRecipe.getOutput(tStartIndex - 1000));
}
tStartIndex++;
if (mRecipe.getOutput(tStartIndex - 1000) != null) {
mInputs.init(tStartIndex, false, 102 + 3, 23);
mInputs.set(tStartIndex, mRecipe.getOutput(tStartIndex - 1000));
}
tStartIndex++;
if (mRecipe.getOutput(tStartIndex - 1000) != null) {
mInputs.init(tStartIndex, false, 120 + 3, 23);
mInputs.set(tStartIndex, mRecipe.getOutput(tStartIndex - 1000));
}
tStartIndex++;
if (mRecipe.getOutput(tStartIndex - 1000) != null) {
mInputs.init(tStartIndex, false, 138 + 3, 23);
mInputs.set(tStartIndex, mRecipe.getOutput(tStartIndex - 1000));
}
tStartIndex++;
break;
case 7:
if (mRecipe.getOutput(tStartIndex - 1000) != null) {
mInputs.init(tStartIndex, false, 102 + 3, -4);
mInputs.set(tStartIndex, mRecipe.getOutput(tStartIndex - 1000));
}
tStartIndex++;
if (mRecipe.getOutput(tStartIndex - 1000) != null) {
mInputs.init(tStartIndex, false, 120 + 3, -4);
mInputs.set(tStartIndex, mRecipe.getOutput(tStartIndex - 1000));
}
tStartIndex++;
if (mRecipe.getOutput(tStartIndex - 1000) != null) {
mInputs.init(tStartIndex, false, 138 + 3, -4);
mInputs.set(tStartIndex, mRecipe.getOutput(tStartIndex - 1000));
}
tStartIndex++;
if (mRecipe.getOutput(tStartIndex - 1000) != null) {
mInputs.init(tStartIndex, false, 102 + 3, 14);
mInputs.set(tStartIndex, mRecipe.getOutput(tStartIndex - 1000));
}
tStartIndex++;
if (mRecipe.getOutput(tStartIndex - 1000) != null) {
mInputs.init(tStartIndex, false, 120 + 3, 14);
mInputs.set(tStartIndex, mRecipe.getOutput(tStartIndex - 1000));
}
tStartIndex++;
if (mRecipe.getOutput(tStartIndex - 1000) != null) {
mInputs.init(tStartIndex, false, 138 + 3, 14);
mInputs.set(tStartIndex, mRecipe.getOutput(tStartIndex - 1000));
}
tStartIndex++;
if (mRecipe.getOutput(tStartIndex - 1000) != null) {
mInputs.init(tStartIndex, false, 102 + 3, 32);
mInputs.set(tStartIndex, mRecipe.getOutput(tStartIndex - 1000));
}
tStartIndex++;
break;
case 8:
if (mRecipe.getOutput(tStartIndex - 1000) != null) {
mInputs.init(tStartIndex, false, 102 + 3, -4);
mInputs.set(tStartIndex, mRecipe.getOutput(tStartIndex - 1000));
}
tStartIndex++;
if (mRecipe.getOutput(tStartIndex - 1000) != null) {
mInputs.init(tStartIndex, false, 120 + 3, -4);
mInputs.set(tStartIndex, mRecipe.getOutput(tStartIndex - 1000));
}
tStartIndex++;
if (mRecipe.getOutput(tStartIndex - 1000) != null) {
mInputs.init(tStartIndex, false, 138 + 3, -4);
mInputs.set(tStartIndex, mRecipe.getOutput(tStartIndex - 1000));
}
tStartIndex++;
if (mRecipe.getOutput(tStartIndex - 1000) != null) {
mInputs.init(tStartIndex, false, 102 + 3, 24);
mInputs.set(tStartIndex, mRecipe.getOutput(tStartIndex - 1000));
}
tStartIndex++;
if (mRecipe.getOutput(tStartIndex - 1000) != null) {
mInputs.init(tStartIndex, false, 120 + 3, 14);
mInputs.set(tStartIndex, mRecipe.getOutput(tStartIndex - 1000));
}
tStartIndex++;
if (mRecipe.getOutput(tStartIndex - 1000) != null) {
mInputs.init(tStartIndex, false, 138 + 3, 14);
mInputs.set(tStartIndex, mRecipe.getOutput(tStartIndex - 1000));
}
tStartIndex++;
if (mRecipe.getOutput(tStartIndex - 1000) != null) {
mInputs.init(tStartIndex, false, 102 + 3, 32);
mInputs.set(tStartIndex, mRecipe.getOutput(tStartIndex - 1000));
}
tStartIndex++;
if (mRecipe.getOutput(tStartIndex - 1000) != null) {
mInputs.init(tStartIndex, false, 120 + 3, 32);
mInputs.set(tStartIndex, mRecipe.getOutput(tStartIndex - 1000));
}
tStartIndex++;
break;
default:
if (mRecipe.getOutput(tStartIndex - 1000) != null) {
mInputs.init(tStartIndex, false, 102 + 3, -4);
mInputs.set(tStartIndex, mRecipe.getOutput(tStartIndex - 1000));
}
tStartIndex++;
if (mRecipe.getOutput(tStartIndex - 1000) != null) {
mInputs.init(tStartIndex, false, 120 + 3, -4);
mInputs.set(tStartIndex, mRecipe.getOutput(tStartIndex - 1000));
}
tStartIndex++;
if (mRecipe.getOutput(tStartIndex - 1000) != null) {
mInputs.init(tStartIndex, false, 138 + 3, -4);
mInputs.set(tStartIndex, mRecipe.getOutput(tStartIndex - 1000));
}
tStartIndex++;
if (mRecipe.getOutput(tStartIndex - 1000) != null) {
mInputs.init(tStartIndex, false, 102 + 3, 14);
mInputs.set(tStartIndex, mRecipe.getOutput(tStartIndex - 1000));
}
tStartIndex++;
if (mRecipe.getOutput(tStartIndex - 1000) != null) {
mInputs.init(tStartIndex, false, 120 + 3, 14);
mInputs.set(tStartIndex, mRecipe.getOutput(tStartIndex - 1000));
}
tStartIndex++;
if (mRecipe.getOutput(tStartIndex - 1000) != null) {
mInputs.init(tStartIndex, false, 138 + 3, 14);
mInputs.set(tStartIndex, mRecipe.getOutput(tStartIndex - 1000));
}
tStartIndex++;
if (mRecipe.getOutput(tStartIndex - 1000) != null) {
mInputs.init(tStartIndex, false, 102 + 3, 32);
mInputs.set(tStartIndex, mRecipe.getOutput(tStartIndex - 1000));
}
tStartIndex++;
if (mRecipe.getOutput(tStartIndex - 1000) != null) {
mInputs.init(tStartIndex, false, 120 + 3, 32);
mInputs.set(tStartIndex, mRecipe.getOutput(tStartIndex - 1000));
}
tStartIndex++;
if (mRecipe.getOutput(tStartIndex - 1000) != null) {
mInputs.init(tStartIndex, false, 138 + 3, 32);
mInputs.set(tStartIndex, mRecipe.getOutput(tStartIndex - 1000));
}
tStartIndex++;
}
if ((mRecipe.mFluidInputs.length > 0) && (mRecipe.mFluidInputs[0] != null) && (mRecipe.mFluidInputs[0].getFluid() != null)) {
mFluids.init(0, true, 48 + 4, 52 + 1, 16, 16, mRecipe.mFluidInputs[0].amount, true, null);
mFluids.set(0, mRecipe.mFluidInputs[0]);
if ((mRecipe.mFluidInputs.length > 1) && (mRecipe.mFluidInputs[1] != null) && (mRecipe.mFluidInputs[1].getFluid() != null)) {
mFluids.init(1, true, 30 + 4, 52 + 1, 16, 16, mRecipe.mFluidInputs[1].amount, true, null);
mFluids.set(1, mRecipe.mFluidInputs[1]);
}
}
if (mRecipe.mFluidOutputs.length > 1) {
if (mRecipe.mFluidOutputs[0] != null && (mRecipe.mFluidOutputs[0].getFluid() != null)) {
mFluids.init(2, false, 120 + 4, 5 + 1, 16, 16, mRecipe.mFluidOutputs[0].amount, true, null);
mFluids.set(2, mRecipe.mFluidOutputs[0]);
}
if (mRecipe.mFluidOutputs[1] != null && (mRecipe.mFluidOutputs[1].getFluid() != null)) {
mFluids.init(3, false, 138 + 4, 5 + 1, 16, 16, mRecipe.mFluidOutputs[1].amount, true, null);
mFluids.set(3, mRecipe.mFluidOutputs[1]);
}
if (mRecipe.mFluidOutputs.length > 2 && mRecipe.mFluidOutputs[2] != null && (mRecipe.mFluidOutputs[2].getFluid() != null)) {
mFluids.init(4, false, 102 + 4, 23 + 1, 16, 16, mRecipe.mFluidOutputs[2].amount, true, null);
mFluids.set(4, mRecipe.mFluidOutputs[2]);
}
if (mRecipe.mFluidOutputs.length > 3 && mRecipe.mFluidOutputs[3] != null && (mRecipe.mFluidOutputs[3].getFluid() != null)) {
mFluids.init(5, false, 120 + 4, 23 + 1, 16, 16, mRecipe.mFluidOutputs[3].amount, true, null);
mFluids.set(5, mRecipe.mFluidOutputs[3]);
}
if (mRecipe.mFluidOutputs.length > 4 && mRecipe.mFluidOutputs[4] != null && (mRecipe.mFluidOutputs[4].getFluid() != null)) {
mFluids.init(6, false, 138 + 4, 23 + 1, 16, 16, mRecipe.mFluidOutputs[4].amount, true, null);
mFluids.set(6, mRecipe.mFluidOutputs[4]);
}
} else if ((mRecipe.mFluidOutputs.length > 0) && (mRecipe.mFluidOutputs[0] != null) && (mRecipe.mFluidOutputs[0].getFluid() != null)) {
mFluids.init(7, false, 102 + 4, 52 + 1, 16, 16, mRecipe.mFluidOutputs[0].amount, true, null);
mFluids.set(7, mRecipe.mFluidOutputs[0]);
}
mInputs.addTooltipCallback((slotIndex, input, ingredient, tooltip) -> {
int slotType = slotIndex / 1000;
int inputIndex = slotType % 1000;
switch (slotType) {
case 1:
//it's output
int outputChance = mRecipe.getOutputChance(inputIndex);
if(outputChance != 10000) {
float floatChance = (outputChance * 1F / 10000F) * 100F;
String cutChance = String.format("%.2f", floatChance);
tooltip.add("Chance: " + cutChance + "%");
}
break;
case 0:
//it's input
if(mRecipe.getRepresentativeInput(inputIndex).stackSize == 0) {
tooltip.add("Does not get consumed in the process");
}
break;
}
});
mFluids.addTooltipCallback((slotIndex, input, ingredient, tooltip) -> {
tooltip.add(TextFormatting.BLUE + "Amount: " + ingredient.amount + TextFormatting.GRAY);
tooltip.add(TextFormatting.RED + "Temperature: " + ingredient.getFluid().getTemperature() + " K" + TextFormatting.GRAY);
tooltip.add(TextFormatting.GREEN + "State: " + (ingredient.getFluid().isGaseous() ? "Gas" : "Liquid") + TextFormatting.GRAY);
});
}
@Override
public List getInputs() {
return Arrays.asList(mRecipe.mInputs);
}
@Override
public List getOutputs() {
return Arrays.asList(mRecipe.mOutputs);
}
@Override
public List<FluidStack> getFluidInputs() {
return Arrays.asList(mRecipe.mFluidInputs);
}
@Override
public List<FluidStack> getFluidOutputs() {
return Arrays.asList(mRecipe.mFluidOutputs);
}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
int tEUt = mRecipe.mEUt;
int tDuration = mRecipe.mDuration;
if (tEUt != 0) {
drawText(10, 73, "Total: " + tDuration * tEUt + " EU", -16777216);
drawText(10, 83, "Usage: " + tEUt + " EU/t", -16777216);
if (this.mRecipeMap.mShowVoltageAmperageInNEI) {
drawText(10, 93, "Voltage: " + tEUt / this.mRecipeMap.mAmperage + " EU", -16777216);
drawText(10, 103, "Amperage: " + this.mRecipeMap.mAmperage, -16777216);
} else {
drawText(10, 93, "Voltage: unspecified", -16777216);
drawText(10, 103, "Amperage: unspecified", -16777216);
}
}
if (tDuration > 0) {
drawText(10, 113, "Time: " + (tDuration < 20 ? "< 1" : Integer.valueOf(tDuration / 20)) + " secs", -16777216);
}
if ((GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePre)) || (GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePost))) {
drawText(10, 123, this.mRecipeMap.mNEISpecialValuePre + mRecipe.mSpecialValue * this.mRecipeMap.mNEISpecialValueMultiplier + this.mRecipeMap.mNEISpecialValuePost, -16777216);
}
}
public static void drawText(int aX, int aY, String aString, int aColor) {
Minecraft.getMinecraft().fontRendererObj.drawString(aString, aX, aY, aColor);
}
@Override
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
}
@Nullable
@Override
public List<String> getTooltipStrings(int mouseX, int mouseY) {
return null;
}
@Override
public boolean handleClick(@Nonnull Minecraft minecraft, int mouseX, int mouseY, int mouseButton) {
return false;
}
}

View file

@ -0,0 +1,37 @@
package gregtech.jei;
import mezz.jei.api.recipe.IRecipeHandler;
import mezz.jei.api.recipe.IRecipeWrapper;
import javax.annotation.Nonnull;
public class JEIGregtechRecipeHandler implements IRecipeHandler<JEIGregtechRecipe> {
@Nonnull
@Override
public Class<JEIGregtechRecipe> getRecipeClass() {
return JEIGregtechRecipe.class;
}
@Nonnull
@Override
public String getRecipeCategoryUid() {
return null;
}
@Nonnull
@Override
public String getRecipeCategoryUid(@Nonnull JEIGregtechRecipe recipe) {
return recipe.mRecipeMap.mUnlocalizedName;
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull JEIGregtechRecipe recipe) {
return recipe;
}
@Override
public boolean isRecipeValid(@Nonnull JEIGregtechRecipe recipe) {
return true;
}
}

View file

@ -0,0 +1,58 @@
package gregtech.jei;
import gregtech.api.util.GT_LanguageManager;
import gregtech.api.util.GT_Recipe;
import mezz.jei.Internal;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.recipe.IRecipeCategory;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
import javax.annotation.Nonnull;
public class JEIGregtehRecipeCategory implements IRecipeCategory<JEIGregtechRecipe> {
protected final GT_Recipe.GT_Recipe_Map mRecipeMap;
protected final IDrawable background;
public JEIGregtehRecipeCategory(GT_Recipe.GT_Recipe_Map mRecipeMap) {
this.mRecipeMap = mRecipeMap;
this.background = Internal.getHelpers().getGuiHelper().createDrawable(
new ResourceLocation(mRecipeMap.mNEIGUIPath),
1, 3, 174, 78, -4, 0, -8, 0);
}
@Nonnull
@Override
public String getUid() {
return mRecipeMap.mUnlocalizedName;
}
@Nonnull
@Override
public String getTitle() {
return GT_LanguageManager.getTranslation(mRecipeMap.mUnlocalizedName);
}
@Nonnull
@Override
public IDrawable getBackground() {
return Internal.getHelpers().getGuiHelper().createDrawable(
new ResourceLocation(mRecipeMap.mNEIGUIPath),
1, 3, 174, 78, -7, 0, -0, 0);
}
@Override
public void drawExtras(@Nonnull Minecraft minecraft) {}
@Override
public void drawAnimations(@Nonnull Minecraft minecraft) {}
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull JEIGregtechRecipe recipeWrapper) {
recipeWrapper.init(recipeLayout);
}
}

View file

@ -0,0 +1,31 @@
package gregtech.jei;
import gregtech.api.util.GT_Recipe;
import mezz.jei.api.IJeiRuntime;
import mezz.jei.api.IModPlugin;
import mezz.jei.api.IModRegistry;
import mezz.jei.api.JEIPlugin;
import javax.annotation.Nonnull;
import java.util.stream.Collectors;
@JEIPlugin
public class JEI_GT_Plugin implements IModPlugin {
@Override
public void register(@Nonnull IModRegistry registry) {
registry.addRecipeHandlers(new JEIGregtechRecipeHandler());
for(GT_Recipe.GT_Recipe_Map recipe_map : GT_Recipe.GT_Recipe_Map.sMappings) {
if(recipe_map.mNEIAllowed) {
registry.addRecipeCategories(new JEIGregtehRecipeCategory(recipe_map));
registry.addRecipes(recipe_map.mRecipeList.stream()
.map(recipe -> new JEIGregtechRecipe(recipe_map, recipe))
.collect(Collectors.toList()));
}
}
}
@Override
public void onRuntimeAvailable(@Nonnull IJeiRuntime jeiRuntime) {}
}

View file

@ -16,8 +16,6 @@ import gregtech.common.items.*;
import gregtech.common.items.armor.ElectricModularArmor1;
import gregtech.common.items.armor.ModularArmor_Item;
import gregtech.common.items.armor.Values;
import ic2.core.IC2;
import ic2.core.block.machine.tileentity.TileEntityMatter;
import ic2.core.ref.FluidName;
import ic2.core.ref.ItemName;
import net.minecraft.init.Blocks;
@ -145,6 +143,7 @@ public class GT_Loader_Item_Block_And_Fluid
GregTech_API.sBlockOresUb2 = new GT_Block_Ores_UB2();
GregTech_API.sBlockOresUb3 = new GT_Block_Ores_UB3();
}
new GT_TickHandler_Ores();
GregTech_API.sBlockMetal1 = new GT_Block_Metal("gt.blockmetal1", new Materials[]{
Materials.Adamantium,
Materials.Aluminium,

View file

@ -138,7 +138,6 @@ public class GT_Loader_OreDictionary
GT_OreDictUnificator.registerOre(OrePrefixes.battery, Materials.Advanced, GT_ModHandler.getIC2Item(ItemName.advanced_re_battery, 1, 32767));
GT_OreDictUnificator.registerOre(OrePrefixes.battery, Materials.Elite, GT_ModHandler.getIC2Item(ItemName.energy_crystal, 1, 32767));
GT_OreDictUnificator.registerOre(OrePrefixes.battery, Materials.Master, GT_ModHandler.getIC2Item(ItemName.lapotron_crystal, 1, 32767));
GT_OreDictUnificator.registerOre(OreDictNames.craftingWireCopper, ItemCable.getCable(CableType.copper, 1));
GT_OreDictUnificator.registerOre(OreDictNames.craftingWireGold, ItemCable.getCable(CableType.gold, 1));
GT_OreDictUnificator.registerOre(OreDictNames.craftingWireIron, ItemCable.getCable(CableType.iron, 1));

View file

@ -1,803 +0,0 @@
package gregtech.nei;
public class GT_NEI_DefaultHandler {
/*public static final int sOffsetX = 5;
public static final int sOffsetY = 11;
static {
GuiContainerManager.addInputHandler(new GT_RectHandler());
GuiContainerManager.addTooltipHandler(new GT_RectHandler());
}
protected final GT_Recipe.GT_Recipe_Map mRecipeMap;
public GT_NEI_DefaultHandler(GT_Recipe.GT_Recipe_Map aRecipeMap) {
this.mRecipeMap = aRecipeMap;
this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(65, 13, 36, 18), getOverlayIdentifier(), new Object[0]));
if (!NEI_GT_Config.sIsAdded) {
FMLInterModComms.sendRuntimeMessage(GT_Values.GT, "NEIPlugins", "register-crafting-handler", "gregtech@" + getRecipeName() + "@" + getOverlayIdentifier());
GuiCraftingRecipe.craftinghandlers.add(this);
GuiUsageRecipe.usagehandlers.add(this);
}
}
public static void drawText(int aX, int aY, String aString, int aColor) {
Minecraft.getMinecraft().fontRendererObj.drawString(aString, aX, aY, aColor);
}
public TemplateRecipeHandler newInstance() {
return new GT_NEI_DefaultHandler(this.mRecipeMap);
}
public void loadCraftingRecipes(String outputId, Object... results) {
if (outputId.equals(getOverlayIdentifier())) {
for (GT_Recipe tRecipe : this.mRecipeMap.mRecipeList) {
if (!tRecipe.mHidden) {
this.arecipes.add(new CachedDefaultRecipe(tRecipe));
}
}
} else {
super.loadCraftingRecipes(outputId, results);
}
}
public void loadCraftingRecipes(ItemStack aResult) {
ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aResult);
ArrayList<ItemStack> tResults = new ArrayList();
tResults.add(aResult);
tResults.add(GT_OreDictUnificator.get(true, aResult));
if ((tPrefixMaterial != null) && (!tPrefixMaterial.mBlackListed) && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) {
for (OrePrefixes tPrefix : tPrefixMaterial.mPrefix.mFamiliarPrefixes) {
tResults.add(GT_OreDictUnificator.get(tPrefix, tPrefixMaterial.mMaterial.mMaterial, 1L));
}
}
FluidStack tFluid = GT_Utility.getFluidForFilledItem(aResult, true);
if (tFluid != null) {
tResults.add(GT_Utility.getFluidDisplayStack(tFluid, false));
for (FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) {
if (tData.fluid.isFluidEqual(tFluid)) {
tResults.add(GT_Utility.copy(new Object[]{tData.filledContainer}));
}
}
}
for (GT_Recipe tRecipe : this.mRecipeMap.mRecipeList) {
if (!tRecipe.mHidden) {
CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe);
for (ItemStack tStack : tResults) {
if (tNEIRecipe.contains(tNEIRecipe.mOutputs, tStack)) {
this.arecipes.add(tNEIRecipe);
break;
}
}
}
}
CachedDefaultRecipe tNEIRecipe;
}
public void loadUsageRecipes(ItemStack aInput) {
ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aInput);
ArrayList<ItemStack> tInputs = new ArrayList();
tInputs.add(aInput);
tInputs.add(GT_OreDictUnificator.get(false, aInput));
if ((tPrefixMaterial != null) && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) {
for (OrePrefixes tPrefix : tPrefixMaterial.mPrefix.mFamiliarPrefixes) {
tInputs.add(GT_OreDictUnificator.get(tPrefix, tPrefixMaterial.mMaterial.mMaterial, 1L));
}
}
FluidStack tFluid = GT_Utility.getFluidForFilledItem(aInput, true);
if (tFluid != null) {
tInputs.add(GT_Utility.getFluidDisplayStack(tFluid, false));
for (FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) {
if (tData.fluid.isFluidEqual(tFluid)) {
tInputs.add(GT_Utility.copy(new Object[]{tData.filledContainer}));
}
}
}
for (GT_Recipe tRecipe : this.mRecipeMap.mRecipeList) {
if (!tRecipe.mHidden) {
CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe);
for (ItemStack tStack : tInputs) {
if (tNEIRecipe.contains(tNEIRecipe.mInputs, tStack)) {
this.arecipes.add(tNEIRecipe);
break;
}
}
}
}
CachedDefaultRecipe tNEIRecipe;
}
public String getOverlayIdentifier() {
return this.mRecipeMap.mNEIName;
}
public void drawBackground(int recipe) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GuiDraw.changeTexture(getGuiTexture());
GuiDraw.drawTexturedModalRect(-4, -8, 1, 3, 174, 78);
}
public int recipiesPerPage() {
return 1;
}
public String getRecipeName() {
return GT_LanguageManager.getTranslation(this.mRecipeMap.mUnlocalizedName);
}
public String getGuiTexture() {
// return "gregtech:textures/gui/" + this.mRecipeMap.mUnlocalizedName + ".png";
return this.mRecipeMap.mNEIGUIPath;
}
public List<String> handleItemTooltip(GuiRecipe gui, ItemStack aStack, List<String> currenttip, int aRecipeIndex) {
TemplateRecipeHandler.CachedRecipe tObject = (TemplateRecipeHandler.CachedRecipe) this.arecipes.get(aRecipeIndex);
if ((tObject instanceof CachedDefaultRecipe)) {
CachedDefaultRecipe tRecipe = (CachedDefaultRecipe) tObject;
for (PositionedStack tStack : tRecipe.mOutputs) {
if (aStack == tStack.item) {
if ((!(tStack instanceof FixedPositionedStack)) || (((FixedPositionedStack) tStack).mChance <= 0) || (((FixedPositionedStack) tStack).mChance == 10000)) {
break;
}
currenttip.add("Chance: " + ((FixedPositionedStack) tStack).mChance / 100 + "." + (((FixedPositionedStack) tStack).mChance % 100 < 10 ? "0" + ((FixedPositionedStack) tStack).mChance % 100 : Integer.valueOf(((FixedPositionedStack) tStack).mChance % 100)) + "%");
break;
}
}
for (PositionedStack tStack : tRecipe.mInputs) {
if (aStack == tStack.item) {
if ((gregtech.api.enums.ItemList.Display_Fluid.isStackEqual(tStack.item, true, true)) ||
(tStack.item.stackSize != 0)) {
break;
}
currenttip.add("Does not get consumed in the process");
break;
}
}
}
return currenttip;
}
public void drawExtras(int aRecipeIndex) {
int tEUt = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mEUt;
int tDuration = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mDuration;
if (tEUt != 0) {
drawText(10, 73, "Total: " + tDuration * tEUt + " EU", -16777216);
drawText(10, 83, "Usage: " + tEUt + " EU/t", -16777216);
if (this.mRecipeMap.mShowVoltageAmperageInNEI) {
drawText(10, 93, "Voltage: " + tEUt / this.mRecipeMap.mAmperage + " EU", -16777216);
drawText(10, 103, "Amperage: " + this.mRecipeMap.mAmperage, -16777216);
} else {
drawText(10, 93, "Voltage: unspecified", -16777216);
drawText(10, 103, "Amperage: unspecified", -16777216);
}
}
if (tDuration > 0) {
drawText(10, 113, "Time: " + (tDuration < 20 ? "< 1" : Integer.valueOf(tDuration / 20)) + " secs", -16777216);
}
if ((GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePre)) || (GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePost))) {
drawText(10, 123, this.mRecipeMap.mNEISpecialValuePre + ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue * this.mRecipeMap.mNEISpecialValueMultiplier + this.mRecipeMap.mNEISpecialValuePost, -16777216);
}
}
@Override
public List getInputs() {
return this.mRecipeMap
}
@Override
public List getOutputs() {
return null;
}
@Override
public List<FluidStack> getFluidInputs() {
return null;
}
@Override
public List<FluidStack> getFluidOutputs() {
return null;
}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
}
@Override
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
}
@Nullable
@Override
public List<String> getTooltipStrings(int mouseX, int mouseY) {
return handleItemTooltip()
}
@Override
public boolean handleClick(@Nonnull Minecraft minecraft, int mouseX, int mouseY, int mouseButton) {
return false;
}
public static class GT_RectHandler
implements IContainerInputHandler, IContainerTooltipHandler {
public boolean mouseClicked(GuiContainer gui, int mousex, int mousey, int button) {
if (canHandle(gui)) {
if (button == 0) {
return transferRect(gui, false);
}
if (button == 1) {
return transferRect(gui, true);
}
}
return false;
}
public boolean lastKeyTyped(GuiContainer gui, char keyChar, int keyCode) {
return false;
}
public boolean canHandle(GuiContainer gui) {
return (((gui instanceof GT_GUIContainer_BasicMachine)) && (GT_Utility.isStringValid(((GT_GUIContainer_BasicMachine) gui).mNEI)) || ((gui instanceof GT_GUIContainer_FusionReactor)) && (GT_Utility.isStringValid(((GT_GUIContainer_FusionReactor) gui).mNEI)));
}
public List<String> handleTooltip(GuiContainer gui, int mousex, int mousey, List<String> currenttip) {
if ((canHandle(gui)) && (currenttip.isEmpty())) {
if (gui instanceof GT_GUIContainer_BasicMachine && new Rectangle(65, 13, 36, 18).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_BasicMachine) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_BasicMachine) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) {
currenttip.add("Recipes");
} else if (gui instanceof GT_GUIContainer_FusionReactor && new Rectangle(145, 0, 24, 24).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_FusionReactor) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_FusionReactor) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) {
currenttip.add("Recipes");
}
}
return currenttip;
}
private boolean transferRect(GuiContainer gui, boolean usage) {
if (gui instanceof GT_GUIContainer_BasicMachine) {
return (canHandle(gui)) && (new Rectangle(65, 13, 36, 18).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_BasicMachine) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_BasicMachine) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) && (usage ? GuiUsageRecipe.openRecipeGui(((GT_GUIContainer_BasicMachine) gui).mNEI, new Object[0]) : GuiCraftingRecipe.openRecipeGui(((GT_GUIContainer_BasicMachine) gui).mNEI, new Object[0]));
} else if (gui instanceof GT_GUIContainer_FusionReactor) {
return (canHandle(gui)) && (new Rectangle(145, 0, 24, 24).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_FusionReactor) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_FusionReactor) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) && (usage ? GuiUsageRecipe.openRecipeGui(((GT_GUIContainer_FusionReactor) gui).mNEI, new Object[0]) : GuiCraftingRecipe.openRecipeGui(((GT_GUIContainer_FusionReactor) gui).mNEI, new Object[0]));
}
return false;
}
public List<String> handleItemDisplayName(GuiContainer gui, ItemStack itemstack, List<String> currenttip) {
return currenttip;
}
public List<String> handleItemTooltip(GuiContainer gui, ItemStack itemstack, int mousex, int mousey, List<String> currenttip) {
return currenttip;
}
public boolean keyTyped(GuiContainer gui, char keyChar, int keyCode) {
return false;
}
public void onKeyTyped(GuiContainer gui, char keyChar, int keyID) {
}
public void onMouseClicked(GuiContainer gui, int mousex, int mousey, int button) {
}
public void onMouseUp(GuiContainer gui, int mousex, int mousey, int button) {
}
public boolean mouseScrolled(GuiContainer gui, int mousex, int mousey, int scrolled) {
return false;
}
public void onMouseScrolled(GuiContainer gui, int mousex, int mousey, int scrolled) {
}
public void onMouseDragged(GuiContainer gui, int mousex, int mousey, int button, long heldTime) {
}
}
public class FixedPositionedStack
extends PositionedStack {
public final int mChance;
public boolean permutated = false;
public FixedPositionedStack(Object object, int x, int y) {
this(object, x, y, 0);
}
public FixedPositionedStack(Object object, int x, int y, int aChance) {
super(object, x, y, true);
this.mChance = aChance;
}
public void generatePermutations() {
if (this.permutated) {
return;
}
ArrayList<ItemStack> tDisplayStacks = new ArrayList();
for (ItemStack tStack : this.items) {
if (GT_Utility.isStackValid(tStack)) {
if (tStack.getItemDamage() == 32767) {
List<ItemStack> permutations = codechicken.nei.ItemList.itemMap.get(tStack.getItem());
if (!permutations.isEmpty()) {
ItemStack stack;
for (Iterator i$ = permutations.iterator(); i$.hasNext(); tDisplayStacks.add(GT_Utility.copyAmount(tStack.stackSize, new Object[]{stack}))) {
stack = (ItemStack) i$.next();
}
} else {
ItemStack base = new ItemStack(tStack.getItem(), tStack.stackSize);
base.stackTagCompound = tStack.stackTagCompound;
tDisplayStacks.add(base);
}
} else {
tDisplayStacks.add(GT_Utility.copy(new Object[]{tStack}));
}
}
}
this.items = ((ItemStack[]) tDisplayStacks.toArray(new ItemStack[0]));
if (this.items.length == 0) {
this.items = new ItemStack[]{new ItemStack(Blocks.fire)};
}
this.permutated = true;
setPermutationToRender(0);
}
}
public class CachedDefaultRecipe
extends TemplateRecipeHandler.CachedRecipe {
public final GT_Recipe mRecipe;
public final List<PositionedStack> mOutputs = new ArrayList();
public final List<PositionedStack> mInputs = new ArrayList();
public CachedDefaultRecipe(GT_Recipe aRecipe) {
super();
this.mRecipe = aRecipe;
int tStartIndex = 0;
switch (GT_NEI_DefaultHandler.this.mRecipeMap.mUsualInputCount) {
case 0:
break;
case 1:
if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 14));
}
tStartIndex++;
break;
case 2:
if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 14));
}
tStartIndex++;
if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 14));
}
tStartIndex++;
break;
case 3:
if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 14));
}
tStartIndex++;
if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 14));
}
tStartIndex++;
if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 14));
}
tStartIndex++;
break;
case 4:
if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 5));
}
tStartIndex++;
if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 5));
}
tStartIndex++;
if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 23));
}
tStartIndex++;
if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 23));
}
tStartIndex++;
break;
case 5:
if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 5));
}
tStartIndex++;
if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 5));
}
tStartIndex++;
if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 5));
}
tStartIndex++;
if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 23));
}
tStartIndex++;
if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 23));
}
tStartIndex++;
break;
case 6:
if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 5));
}
tStartIndex++;
if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 5));
}
tStartIndex++;
if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 5));
}
tStartIndex++;
if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 23));
}
tStartIndex++;
if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 23));
}
tStartIndex++;
if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 23));
}
tStartIndex++;
break;
case 7:
if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, -4));
}
tStartIndex++;
if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, -4));
}
tStartIndex++;
if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, -4));
}
tStartIndex++;
if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 14));
}
tStartIndex++;
if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 14));
}
tStartIndex++;
if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 14));
}
tStartIndex++;
if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 32));
}
tStartIndex++;
break;
case 8:
if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, -4));
}
tStartIndex++;
if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, -4));
}
tStartIndex++;
if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, -4));
}
tStartIndex++;
if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 14));
}
tStartIndex++;
if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 14));
}
tStartIndex++;
if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 14));
}
tStartIndex++;
if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 32));
}
tStartIndex++;
if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 32));
}
tStartIndex++;
break;
default:
if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, -4));
}
tStartIndex++;
if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, -4));
}
tStartIndex++;
if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, -4));
}
tStartIndex++;
if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 14));
}
tStartIndex++;
if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 14));
}
tStartIndex++;
if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 14));
}
tStartIndex++;
if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 32));
}
tStartIndex++;
if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 32));
}
tStartIndex++;
if (aRecipe.getRepresentativeInput(tStartIndex) != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 32));
}
tStartIndex++;
}
if (aRecipe.mSpecialItems != null) {
this.mInputs.add(new FixedPositionedStack(aRecipe.mSpecialItems, 120, 52));
}
tStartIndex = 0;
switch (GT_NEI_DefaultHandler.this.mRecipeMap.mUsualOutputCount) {
case 0:
break;
case 1:
if (aRecipe.getOutput(tStartIndex) != null) {
this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 14, aRecipe.getOutputChance(tStartIndex)));
}
tStartIndex++;
break;
case 2:
if (aRecipe.getOutput(tStartIndex) != null) {
this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 14, aRecipe.getOutputChance(tStartIndex)));
}
tStartIndex++;
if (aRecipe.getOutput(tStartIndex) != null) {
this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 14, aRecipe.getOutputChance(tStartIndex)));
}
tStartIndex++;
break;
case 3:
if (aRecipe.getOutput(tStartIndex) != null) {
this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 14, aRecipe.getOutputChance(tStartIndex)));
}
tStartIndex++;
if (aRecipe.getOutput(tStartIndex) != null) {
this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 14, aRecipe.getOutputChance(tStartIndex)));
}
tStartIndex++;
if (aRecipe.getOutput(tStartIndex) != null) {
this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, 14, aRecipe.getOutputChance(tStartIndex)));
}
tStartIndex++;
break;
case 4:
if (aRecipe.getOutput(tStartIndex) != null) {
this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 5, aRecipe.getOutputChance(tStartIndex)));
}
tStartIndex++;
if (aRecipe.getOutput(tStartIndex) != null) {
this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 5, aRecipe.getOutputChance(tStartIndex)));
}
tStartIndex++;
if (aRecipe.getOutput(tStartIndex) != null) {
this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 23, aRecipe.getOutputChance(tStartIndex)));
}
tStartIndex++;
if (aRecipe.getOutput(tStartIndex) != null) {
this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 23, aRecipe.getOutputChance(tStartIndex)));
}
tStartIndex++;
break;
case 5:
if (aRecipe.getOutput(tStartIndex) != null) {
this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 5, aRecipe.getOutputChance(tStartIndex)));
}
tStartIndex++;
if (aRecipe.getOutput(tStartIndex) != null) {
this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 5, aRecipe.getOutputChance(tStartIndex)));
}
tStartIndex++;
if (aRecipe.getOutput(tStartIndex) != null) {
this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, 5, aRecipe.getOutputChance(tStartIndex)));
}
tStartIndex++;
if (aRecipe.getOutput(tStartIndex) != null) {
this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 23, aRecipe.getOutputChance(tStartIndex)));
}
tStartIndex++;
if (aRecipe.getOutput(tStartIndex) != null) {
this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 23, aRecipe.getOutputChance(tStartIndex)));
}
tStartIndex++;
break;
case 6:
if (aRecipe.getOutput(tStartIndex) != null) {
this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 5, aRecipe.getOutputChance(tStartIndex)));
}
tStartIndex++;
if (aRecipe.getOutput(tStartIndex) != null) {
this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 5, aRecipe.getOutputChance(tStartIndex)));
}
tStartIndex++;
if (aRecipe.getOutput(tStartIndex) != null) {
this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, 5, aRecipe.getOutputChance(tStartIndex)));
}
tStartIndex++;
if (aRecipe.getOutput(tStartIndex) != null) {
this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 23, aRecipe.getOutputChance(tStartIndex)));
}
tStartIndex++;
if (aRecipe.getOutput(tStartIndex) != null) {
this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 23, aRecipe.getOutputChance(tStartIndex)));
}
tStartIndex++;
if (aRecipe.getOutput(tStartIndex) != null) {
this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, 23, aRecipe.getOutputChance(tStartIndex)));
}
tStartIndex++;
break;
case 7:
if (aRecipe.getOutput(tStartIndex) != null) {
this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, -4, aRecipe.getOutputChance(tStartIndex)));
}
tStartIndex++;
if (aRecipe.getOutput(tStartIndex) != null) {
this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, -4, aRecipe.getOutputChance(tStartIndex)));
}
tStartIndex++;
if (aRecipe.getOutput(tStartIndex) != null) {
this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, -4, aRecipe.getOutputChance(tStartIndex)));
}
tStartIndex++;
if (aRecipe.getOutput(tStartIndex) != null) {
this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 14, aRecipe.getOutputChance(tStartIndex)));
}
tStartIndex++;
if (aRecipe.getOutput(tStartIndex) != null) {
this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 14, aRecipe.getOutputChance(tStartIndex)));
}
tStartIndex++;
if (aRecipe.getOutput(tStartIndex) != null) {
this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, 14, aRecipe.getOutputChance(tStartIndex)));
}
tStartIndex++;
if (aRecipe.getOutput(tStartIndex) != null) {
this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 32, aRecipe.getOutputChance(tStartIndex)));
}
tStartIndex++;
break;
case 8:
if (aRecipe.getOutput(tStartIndex) != null) {
this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, -4, aRecipe.getOutputChance(tStartIndex)));
}
tStartIndex++;
if (aRecipe.getOutput(tStartIndex) != null) {
this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, -4, aRecipe.getOutputChance(tStartIndex)));
}
tStartIndex++;
if (aRecipe.getOutput(tStartIndex) != null) {
this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, -4, aRecipe.getOutputChance(tStartIndex)));
}
tStartIndex++;
if (aRecipe.getOutput(tStartIndex) != null) {
this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 14, aRecipe.getOutputChance(tStartIndex)));
}
tStartIndex++;
if (aRecipe.getOutput(tStartIndex) != null) {
this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 14, aRecipe.getOutputChance(tStartIndex)));
}
tStartIndex++;
if (aRecipe.getOutput(tStartIndex) != null) {
this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, 14, aRecipe.getOutputChance(tStartIndex)));
}
tStartIndex++;
if (aRecipe.getOutput(tStartIndex) != null) {
this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 32, aRecipe.getOutputChance(tStartIndex)));
}
tStartIndex++;
if (aRecipe.getOutput(tStartIndex) != null) {
this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 32, aRecipe.getOutputChance(tStartIndex)));
}
tStartIndex++;
break;
default:
if (aRecipe.getOutput(tStartIndex) != null) {
this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, -4, aRecipe.getOutputChance(tStartIndex)));
}
tStartIndex++;
if (aRecipe.getOutput(tStartIndex) != null) {
this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, -4, aRecipe.getOutputChance(tStartIndex)));
}
tStartIndex++;
if (aRecipe.getOutput(tStartIndex) != null) {
this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, -4, aRecipe.getOutputChance(tStartIndex)));
}
tStartIndex++;
if (aRecipe.getOutput(tStartIndex) != null) {
this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 14, aRecipe.getOutputChance(tStartIndex)));
}
tStartIndex++;
if (aRecipe.getOutput(tStartIndex) != null) {
this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 14, aRecipe.getOutputChance(tStartIndex)));
}
tStartIndex++;
if (aRecipe.getOutput(tStartIndex) != null) {
this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, 14, aRecipe.getOutputChance(tStartIndex)));
}
tStartIndex++;
if (aRecipe.getOutput(tStartIndex) != null) {
this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 32, aRecipe.getOutputChance(tStartIndex)));
}
tStartIndex++;
if (aRecipe.getOutput(tStartIndex) != null) {
this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 32, aRecipe.getOutputChance(tStartIndex)));
}
tStartIndex++;
if (aRecipe.getOutput(tStartIndex) != null) {
this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, 32, aRecipe.getOutputChance(tStartIndex)));
}
tStartIndex++;
}
if ((aRecipe.mFluidInputs.length > 0) && (aRecipe.mFluidInputs[0] != null) && (aRecipe.mFluidInputs[0].getFluid() != null)) {
this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[0], true), 48, 52));
if ((aRecipe.mFluidInputs.length > 1) && (aRecipe.mFluidInputs[1] != null) && (aRecipe.mFluidInputs[1].getFluid() != null)) {
this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[1], true), 30, 52));
}
}
if (aRecipe.mFluidOutputs.length > 1) {
if (aRecipe.mFluidOutputs[0] != null && (aRecipe.mFluidOutputs[0].getFluid() != null)) {
this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[0], true), 120, 5));
}
if (aRecipe.mFluidOutputs[1] != null && (aRecipe.mFluidOutputs[1].getFluid() != null)) {
this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[1], true), 138, 5));
}
if (aRecipe.mFluidOutputs.length > 2 && aRecipe.mFluidOutputs[2] != null && (aRecipe.mFluidOutputs[2].getFluid() != null)) {
this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[2], true), 102, 23));
}
if (aRecipe.mFluidOutputs.length > 3 && aRecipe.mFluidOutputs[3] != null && (aRecipe.mFluidOutputs[3].getFluid() != null)) {
this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[3], true), 120, 23));
}
if (aRecipe.mFluidOutputs.length > 4 && aRecipe.mFluidOutputs[4] != null && (aRecipe.mFluidOutputs[4].getFluid() != null)) {
this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[4], true), 138, 23));
}
} else if ((aRecipe.mFluidOutputs.length > 0) && (aRecipe.mFluidOutputs[0] != null) && (aRecipe.mFluidOutputs[0].getFluid() != null)) {
this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[0], true), 102, 52));
}
}
public List<PositionedStack> getIngredients() {
return getCycledIngredients(GT_NEI_DefaultHandler.this.cycleticks / 10, this.mInputs);
}
public PositionedStack getResult() {
return null;
}
public List<PositionedStack> getOtherStacks() {
return this.mOutputs;
}
}*/
}

View file

@ -1,26 +0,0 @@
package gregtech.nei;
import gregtech.api.util.GT_Recipe;
public class NEI_GT_Config {
public static boolean sIsAdded = true;
public void loadConfig() {
/*sIsAdded = false;
for (GT_Recipe.GT_Recipe_Map tMap : GT_Recipe.GT_Recipe_Map.sMappings) {
if (tMap.mNEIAllowed) {
new GT_NEI_DefaultHandler(tMap);
}
}
sIsAdded = true;*/
}
public String getName() {
return "GregTech NEI Plugin";
}
public String getVersion() {
return "(5.03a)";
}
}