Rendering overhaul & ores overhaul

This commit is contained in:
Dragon2488 2016-10-23 16:59:59 +07:00
parent 13155cb4da
commit 484a9e7640
55 changed files with 970 additions and 690 deletions

View file

@ -162,7 +162,7 @@ public class GregTech_API {
/**
* These Lists are getting executed at their respective timings. Useful if you have to do things right before/after I do them, without having to control the load order. Add your "Commands" in the Constructor or in a static Code Block of your Mods Main Class. These are not Threaded, I just use a native Java Interface for their execution. Implement just the Method run() and everything should work
*/
public static List<Runnable> sBeforeGTPreload = new ArrayList<Runnable>(), sAfterGTPreload = new ArrayList<Runnable>(), sBeforeGTLoad = new ArrayList<Runnable>(), sAfterGTLoad = new ArrayList<Runnable>(), sBeforeGTPostload = new ArrayList<Runnable>(), sAfterGTPostload = new ArrayList<Runnable>(), sBeforeGTServerstart = new ArrayList<Runnable>(), sAfterGTServerstart = new ArrayList<Runnable>(), sBeforeGTServerstop = new ArrayList<Runnable>(), sAfterGTServerstop = new ArrayList<Runnable>(), sGTBlockIconload = new ArrayList<Runnable>(), sGTItemIconload = new ArrayList<Runnable>();
public static List<Runnable> sBeforeGTPreload = new ArrayList<Runnable>(), sAfterGTPreload = new ArrayList<Runnable>(), sBeforeGTLoad = new ArrayList<Runnable>(), sAfterGTLoad = new ArrayList<Runnable>(), sBeforeGTPostload = new ArrayList<Runnable>(), sAfterGTPostload = new ArrayList<Runnable>(), sBeforeGTServerstart = new ArrayList<Runnable>(), sAfterGTServerstart = new ArrayList<Runnable>(), sBeforeGTServerstop = new ArrayList<Runnable>(), sAfterGTServerstop = new ArrayList<Runnable>(), sGTBlockIconload = new ArrayList<Runnable>(), sGTItemIconload = new ArrayList<Runnable>(), sAfterGTIconload = new ArrayList<Runnable>();
/**
* The Icon Registers from Blocks and Items. They will get set right before the corresponding Icon Load Phase as executed in the Runnable List above.
*/

View file

@ -1430,6 +1430,13 @@ public enum Materials implements IColorModulationContainer, ISubTagContainer {
}
}
public int getColorInt() {
return ((mRGBa[3] & 0xFF) << 24) |
((mRGBa[0] & 0xFF) << 16) |
((mRGBa[1] & 0xFF) << 8) |
((mRGBa[2] & 0xFF));
}
public boolean isRadioactive() {
if (mElement != null) return mElement.mHalfLifeSeconds >= 0;
for (MaterialStack tMaterial : mMaterialList) if (tMaterial.mMaterial.isRadioactive()) return true;

View file

@ -554,8 +554,8 @@ public enum OrePrefixes {
oreBasalt.mSecondaryMaterial = new MaterialStack(Materials.Basalt, dust.mMaterialAmount);
oreMarble.mSecondaryMaterial = new MaterialStack(Materials.Marble, dust.mMaterialAmount);
oreSand.mSecondaryMaterial = new MaterialStack(Materials.Sand, block.mMaterialAmount);
oreGravel.mSecondaryMaterial = new MaterialStack(Materials.Flint, gem.mMaterialAmount);
oreSand.mSecondaryMaterial = new MaterialStack(Materials.SiliconDioxide, dustTiny.mMaterialAmount);
oreGravel.mSecondaryMaterial = new MaterialStack(Materials.Flint, dustTiny.mMaterialAmount);
oreNetherrack.mSecondaryMaterial = new MaterialStack(Materials.Netherrack, dust.mMaterialAmount);
oreNether.mSecondaryMaterial = new MaterialStack(Materials.Netherrack, dust.mMaterialAmount);

View file

@ -1,21 +1,28 @@
package gregtech.api.enums;
import com.google.common.collect.ImmutableList;
import gregtech.api.GregTech_API;
import gregtech.api.interfaces.IIconContainer;
import gregtech.api.interfaces.ITexture;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.objects.GT_SidedTexture;
import gregtech.common.render.RenderUtil;
import gregtech.common.render.data.IIconData;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.EnumMap;
import static gregtech.api.enums.GT_Values.RES_PATH_BLOCK;
import static gregtech.api.enums.GT_Values.RES_PATH_ITEM;
public class Textures {
public enum BlockIcons implements IIconContainer, Runnable {
public enum BlockIcons implements IIconContainer, Runnable, IIconData {
VOID // The Empty Texture
, RENDERING_ERROR, PIPE_RESTRICTOR, INSULATION_FULL, INSULATION_TINY, INSULATION_SMALL, INSULATION_MEDIUM,
INSULATION_LARGE, INSULATION_HUGE, CFOAM_FRESH, CFOAM_HARDENED, SOLARPANEL, SOLARPANEL_8V, SOLARPANEL_LV, SOLARPANEL_MV, SOLARPANEL_HV, SOLARPANEL_EV, SOLARPANEL_IV, SOLARPANEL_LuV, SOLARPANEL_ZPM, SOLARPANEL_UV,
@ -53,8 +60,8 @@ public class Textures {
* Machine Casings by Tier
* 0 = 8V, 1 = LV, 2 = MV, 3 = HV, 4 = EV, 5 = IV, 6 = IV, 7 = IV, 8 = IV, 9 = IV
*/
public static final IIconContainer[]
MACHINECASINGS_SIDE = new IIconContainer[]{
public static final BlockIcons[]
MACHINECASINGS_SIDE = new BlockIcons[]{
MACHINE_8V_SIDE,
MACHINE_LV_SIDE,
MACHINE_MV_SIDE,
@ -72,7 +79,7 @@ public class Textures {
MACHINE_MAX_SIDE,
MACHINE_MAX_SIDE,
},
MACHINECASINGS_TOP = new IIconContainer[]{
MACHINECASINGS_TOP = new BlockIcons[]{
MACHINE_8V_TOP,
MACHINE_LV_TOP,
MACHINE_MV_TOP,
@ -90,7 +97,7 @@ public class Textures {
MACHINE_MAX_TOP,
MACHINE_MAX_TOP,
},
MACHINECASINGS_BOTTOM = new IIconContainer[]{
MACHINECASINGS_BOTTOM = new BlockIcons[]{
MACHINE_8V_BOTTOM,
MACHINE_LV_BOTTOM,
MACHINE_MV_BOTTOM,
@ -108,7 +115,7 @@ public class Textures {
MACHINE_MAX_BOTTOM,
MACHINE_MAX_BOTTOM,
},
GRANITES = new IIconContainer[]{
GRANITES = new BlockIcons[]{
GRANITE_BLACK_STONE,
GRANITE_BLACK_COBBLE,
GRANITE_BLACK_COBBLE_MOSSY,
@ -126,7 +133,7 @@ public class Textures {
GRANITE_RED_BRICKS_CHISELED,
GRANITE_RED_SMOOTH,
},
CONCRETES = new IIconContainer[]{
CONCRETES = new BlockIcons[]{
CONCRETE_DARK_STONE,
CONCRETE_DARK_COBBLE,
CONCRETE_DARK_COBBLE_MOSSY,
@ -144,7 +151,7 @@ public class Textures {
CONCRETE_LIGHT_BRICKS_CHISELED,
CONCRETE_LIGHT_SMOOTH,
},
STONES = new IIconContainer[]{
STONES = new BlockIcons[]{
MARBLE_STONE,
MARBLE_COBBLE,
MARBLE_COBBLE_MOSSY,
@ -162,7 +169,7 @@ public class Textures {
BASALT_BRICKS_CHISELED,
BASALT_SMOOTH,
},
TURBINE = new IIconContainer[]{
TURBINE = new BlockIcons[]{
LARGETURBINE_ST1,
LARGETURBINE_ST2,
LARGETURBINE_ST3,
@ -173,7 +180,7 @@ public class Textures {
LARGETURBINE_ST8,
LARGETURBINE_ST9
},
TURBINE_ACTIVE = new IIconContainer[]{
TURBINE_ACTIVE = new BlockIcons[]{
LARGETURBINE_ST_ACTIVE1,
LARGETURBINE_ST_ACTIVE2,
LARGETURBINE_ST_ACTIVE3,
@ -184,7 +191,7 @@ public class Textures {
LARGETURBINE_ST_ACTIVE8,
LARGETURBINE_ST_ACTIVE9
},
TURBINE1 = new IIconContainer[]{
TURBINE1 = new BlockIcons[]{
LARGETURBINE_SS1,
LARGETURBINE_SS2,
LARGETURBINE_SS3,
@ -195,7 +202,7 @@ public class Textures {
LARGETURBINE_SS8,
LARGETURBINE_SS9
},
TURBINE_ACTIVE1 = new IIconContainer[]{
TURBINE_ACTIVE1 = new BlockIcons[]{
LARGETURBINE_SS_ACTIVE1,
LARGETURBINE_SS_ACTIVE2,
LARGETURBINE_SS_ACTIVE3,
@ -206,7 +213,7 @@ public class Textures {
LARGETURBINE_SS_ACTIVE8,
LARGETURBINE_SS_ACTIVE9
},
TURBINE2 = new IIconContainer[]{
TURBINE2 = new BlockIcons[]{
LARGETURBINE_TI1,
LARGETURBINE_TI2,
LARGETURBINE_TI3,
@ -217,7 +224,7 @@ public class Textures {
LARGETURBINE_TI8,
LARGETURBINE_TI9
},
TURBINE_ACTIVE2 = new IIconContainer[]{
TURBINE_ACTIVE2 = new BlockIcons[]{
LARGETURBINE_TI_ACTIVE1,
LARGETURBINE_TI_ACTIVE2,
LARGETURBINE_TI_ACTIVE3,
@ -228,7 +235,7 @@ public class Textures {
LARGETURBINE_TI_ACTIVE8,
LARGETURBINE_TI_ACTIVE9
},
TURBINE3 = new IIconContainer[]{
TURBINE3 = new BlockIcons[]{
LARGETURBINE_TU1,
LARGETURBINE_TU2,
LARGETURBINE_TU3,
@ -239,7 +246,7 @@ public class Textures {
LARGETURBINE_TU8,
LARGETURBINE_TU9
},
TURBINE_ACTIVE3 = new IIconContainer[]{
TURBINE_ACTIVE3 = new BlockIcons[]{
LARGETURBINE_TU_ACTIVE1,
LARGETURBINE_TU_ACTIVE2,
LARGETURBINE_TU_ACTIVE3,
@ -250,7 +257,7 @@ public class Textures {
LARGETURBINE_TU_ACTIVE8,
LARGETURBINE_TU_ACTIVE9
},
CONNECTED_HULLS = new IIconContainer[]{
CONNECTED_HULLS = new BlockIcons[]{
CONCRETE_DARK_STONE,
FUSIONI_1,
FUSIONI_2,
@ -277,7 +284,7 @@ public class Textures {
FUSIONII_11,
FUSIONII_12,
},
STORAGE_BLOCKS1 = new IIconContainer[]{
STORAGE_BLOCKS1 = new BlockIcons[]{
BLOCK_ADAMANTIUM,
BLOCK_ALUMINIUM,
BLOCK_AMERICIUM,
@ -295,7 +302,7 @@ public class Textures {
BLOCK_BLUESTEEL,
BLOCK_BRASS
},
STORAGE_BLOCKS2 = new IIconContainer[]{
STORAGE_BLOCKS2 = new BlockIcons[]{
BLOCK_BRONZE,
BLOCK_CAESIUM,
BLOCK_CERIUM,
@ -313,7 +320,7 @@ public class Textures {
BLOCK_DYSPROSIUM,
BLOCK_ELECTRUM
},
STORAGE_BLOCKS3 = new IIconContainer[]{
STORAGE_BLOCKS3 = new BlockIcons[]{
BLOCK_ELECTRUMFLUX,
BLOCK_ENDERIUM,
BLOCK_ERBIUM,
@ -331,7 +338,7 @@ public class Textures {
BLOCK_IRONWOOD,
BLOCK_KANTHAL
},
STORAGE_BLOCKS4 = new IIconContainer[]{
STORAGE_BLOCKS4 = new BlockIcons[]{
BLOCK_KNIGHTMETAL,
BLOCK_LANTHANUM,
BLOCK_LEAD,
@ -349,7 +356,7 @@ public class Textures {
BLOCK_NAQUADAHENRICHED,
BLOCK_NAQUADRIA
},
STORAGE_BLOCKS5 = new IIconContainer[]{
STORAGE_BLOCKS5 = new BlockIcons[]{
BLOCK_NEODYMIUM,
BLOCK_NEODYMIUMMAGNETIC,
BLOCK_NEUTRONIUM,
@ -367,7 +374,7 @@ public class Textures {
BLOCK_PLUTONIUM241,
BLOCK_PRASEODYMIUM
},
STORAGE_BLOCKS6 = new IIconContainer[]{
STORAGE_BLOCKS6 = new BlockIcons[]{
BLOCK_PROMETHIUM,
BLOCK_REDALLOY,
BLOCK_REDSTEEL,
@ -385,7 +392,7 @@ public class Textures {
BLOCK_STEELMAGNETIC,
BLOCK_STERLINGSILVER
},
STORAGE_BLOCKS7 = new IIconContainer[]{
STORAGE_BLOCKS7 = new BlockIcons[]{
BLOCK_SUNNARIUM,
BLOCK_TANTALUM,
BLOCK_TELLURIUM,
@ -403,7 +410,7 @@ public class Textures {
BLOCK_URANIUM,
BLOCK_URANIUM235
},
STORAGE_BLOCKS8 = new IIconContainer[]{
STORAGE_BLOCKS8 = new BlockIcons[]{
BLOCK_VANADIUM,
BLOCK_VANADIUMGALLIUM,
BLOCK_WROUGHTIRON,
@ -417,7 +424,7 @@ public class Textures {
BLOCK_HSSE,
BLOCK_HSSS
},
STORAGE_BLOCKS9 = new IIconContainer[]{
STORAGE_BLOCKS9 = new BlockIcons[]{
BLOCK_AERCRYSTAL,
BLOCK_AMBER,
BLOCK_AMETHYST,
@ -435,7 +442,7 @@ public class Textures {
BLOCK_IGNISCRYSTAL,
BLOCK_JASPER
},
STORAGE_BLOCKS10 = new IIconContainer[]{
STORAGE_BLOCKS10 = new BlockIcons[]{
BLOCK_LAZURITE,
BLOCK_LIGNITE,
BLOCK_MONAZITE,
@ -453,7 +460,7 @@ public class Textures {
BLOCK_TANZANITE,
BLOCK_TERRACRYSTAL
},
STORAGE_BLOCKS11 = new IIconContainer[]{
STORAGE_BLOCKS11 = new BlockIcons[]{
BLOCK_TOPAZ,
BLOCK_VINTEUM,
BLOCK_YELLOWGARNET,
@ -543,9 +550,11 @@ public class Textures {
}
protected TextureAtlasSprite mIcon;
protected EnumMap<EnumFacing, ImmutableList<BakedQuad>> mQuadData = new EnumMap<>(EnumFacing.class);
BlockIcons() {
GregTech_API.sGTBlockIconload.add(this);
GregTech_API.sGTBlockIconload.add(this::run);
GregTech_API.sAfterGTIconload.add(this::afterRun);
}
@Override
@ -553,6 +562,8 @@ public class Textures {
return mIcon;
}
@Override
public TextureAtlasSprite getOverlayIcon() {
return null;
@ -563,6 +574,19 @@ public class Textures {
mIcon = GregTech_API.sBlockIcons.registerSprite(new ResourceLocation(RES_PATH_BLOCK + "iconsets/" + this));
}
public void afterRun() {
for(EnumFacing facing : EnumFacing.VALUES) {
ImmutableList<BakedQuad> bakedQuads = ImmutableList.of(
RenderUtil.renderSide(mIcon, facing, 0.0f, 0xffffff));
mQuadData.put(facing, bakedQuads);
}
}
@Override
public ImmutableList<BakedQuad> getQuads(EnumFacing side) {
return mQuadData.get(side);
}
public static class CustomIcon implements IIconContainer, Runnable {
@SideOnly(Side.CLIENT)

View file

@ -15,4 +15,7 @@ public interface ITexture {
public List<BakedQuad> getQuads(Block aBlock, BlockPos blockPos, EnumFacing side, float offset);
public boolean isValidTexture();
public boolean needsNonSidedRendering();
}

View file

@ -2,7 +2,7 @@ package gregtech.api.items;
import gregtech.api.interfaces.IIconContainer;
import gregtech.common.render.items.IItemIconContainerProvider;
import gregtech.common.render.IIconRegister;
import gregtech.common.render.data.IIconRegister;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.inventory.EntityEquipmentSlot;

View file

@ -9,7 +9,7 @@ import gregtech.api.util.GT_LanguageManager;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_Utility;
import gregtech.common.render.items.IItemIconContainerProvider;
import gregtech.common.render.IIconRegister;
import gregtech.common.render.data.IIconRegister;
import gregtech.common.render.items.IItemIconProvider;
import net.minecraft.block.BlockDispenser;
import net.minecraft.block.state.IBlockState;

View file

@ -1,7 +1,7 @@
package gregtech.api.items;
import gregtech.common.render.IItemColorMultiplier;
import gregtech.common.render.IIconRegister;
import gregtech.common.render.data.IIconRegister;
import gregtech.common.render.items.IItemIconProvider;
import ic2.api.item.IElectricItem;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;

View file

@ -29,6 +29,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.EnumAction;
import net.minecraft.item.Item;
import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
@ -212,6 +213,12 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item implements
return rStack;
}
@Override
public boolean canHarvestBlock(IBlockState state, ItemStack stack) {
IToolStats toolStats = getToolStats(stack);
return toolStats != null && toolStats.isMinableBlock(state);
}
/**
* Called by the Block Harvesting Event within the GT_Proxy
*/
@ -444,12 +451,21 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item implements
@Override
public float getStrVsBlock(ItemStack aStack, IBlockState state) {
if (!isItemStackUsable(aStack)) return 0.0F;
IToolStats tStats = getToolStats(aStack);
if (tStats == null || Math.max(0, getHarvestLevel(aStack, "")) < state.getBlock().getHarvestLevel(state)) return 0.0F;
return tStats.isMinableBlock(state) ?
Math.max(Float.MIN_NORMAL, tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed) :
0.0F;
//defSpeed is default item mining speed divided by 2
float defSpeed = 0.5f;
if (isItemStackUsable(aStack)) {
IToolStats toolStats = getToolStats(aStack);
if(toolStats != null && toolStats.isMinableBlock(state)) {
if(getHarvestLevel(aStack, null) > state.getBlock().getHarvestLevel(state)) {
float toolSpeed = toolStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed;
return Math.max(defSpeed, toolSpeed);
}
return defSpeed;
}
return defSpeed;
}
return defSpeed;
}
@Override
@ -495,8 +511,10 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item implements
}
public IToolStats getToolStats(ItemStack aStack) {
isItemStackUsable(aStack);
return getToolStatsInternal(aStack);
if(isItemStackUsable(aStack)) {
return getToolStatsInternal(aStack);
}
return null;
}
private IToolStats getToolStatsInternal(ItemStack aStack) {

View file

@ -40,6 +40,8 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
public long mRestRF;
public short mOverheat;
private GT_PipeRenderedTexture[][][] mTextures;
public GT_MetaPipeEntity_Cable(int aID, String aName, String aNameRegional, float aThickNess, Materials aMaterial, long aCableLossPerMeter, long aAmperage, long aVoltage, boolean aInsulated, boolean aCanShock) {
super(aID, aName, aNameRegional, 0);
mThickNess = aThickNess;
@ -49,9 +51,20 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
mInsulated = aInsulated;
mCanShock = aCanShock;
mCableLossPerMeter = aCableLossPerMeter;
GregTech_API.sAfterGTIconload.add(() -> {
mTextures = new GT_PipeRenderedTexture[2][][];
mTextures[0] = new GT_PipeRenderedTexture[Dyes.VALUES.length + 1][];
mTextures[1] = new GT_PipeRenderedTexture[Dyes.VALUES.length + 1][];
for(int i = 0; i < Dyes.VALUES.length + 1; i++) {
mTextures[0][i] = new GT_PipeRenderedTexture[] {createTexture(false, i)};
mTextures[1][i] = new GT_PipeRenderedTexture[] {createTexture(true, i)};
}
});
}
public GT_MetaPipeEntity_Cable(String aName, float aThickNess, Materials aMaterial, long aCableLossPerMeter, long aAmperage, long aVoltage, boolean aInsulated, boolean aCanShock) {
public GT_MetaPipeEntity_Cable(String aName, float aThickNess, Materials aMaterial, long aCableLossPerMeter, long aAmperage, long aVoltage, boolean aInsulated, boolean aCanShock, GT_PipeRenderedTexture[][][] textures) {
super(aName, 0);
mThickNess = aThickNess;
mMaterial = aMaterial;
@ -60,6 +73,31 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
mInsulated = aInsulated;
mCanShock = aCanShock;
mCableLossPerMeter = aCableLossPerMeter;
mTextures = textures;
}
public GT_PipeRenderedTexture createTexture(boolean aConnected, int aColorIndex) {
float tThickNess = getThickNess();
short[] rgba = Dyes.getOrDef(aColorIndex, Dyes.INSULATION);
IIconContainer[] textures = mMaterial.mIconSet.mTextures;
if (!mInsulated) {
return new GT_PipeRenderedTexture(mThickNess, aConnected, textures[TextureSet.INDEX_wire], mMaterial.mRGBa);
}
if (tThickNess < 0.37F)
return new GT_PipeRenderedTexture(tThickNess, aConnected, textures[TextureSet.INDEX_wire], mMaterial.mRGBa, Textures.BlockIcons.INSULATION_FULL, rgba);
if (tThickNess < 0.49F)
return new GT_PipeRenderedTexture(tThickNess, aConnected, textures[TextureSet.INDEX_wire], mMaterial.mRGBa, Textures.BlockIcons.INSULATION_FULL, rgba);
if (tThickNess < 0.74F)
return new GT_PipeRenderedTexture(tThickNess, aConnected, textures[TextureSet.INDEX_wire], mMaterial.mRGBa, Textures.BlockIcons.INSULATION_FULL, rgba);
if (tThickNess < 0.99F)
return new GT_PipeRenderedTexture(tThickNess, aConnected, textures[TextureSet.INDEX_wire], mMaterial.mRGBa, Textures.BlockIcons.INSULATION_FULL, rgba);
return new GT_PipeRenderedTexture(tThickNess, aConnected, textures[TextureSet.INDEX_wire], mMaterial.mRGBa, Textures.BlockIcons.INSULATION_FULL, rgba);
}
@Override
@ -69,7 +107,7 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
@Override
public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
return new GT_MetaPipeEntity_Cable(mName, mThickNess, mMaterial, mCableLossPerMeter, mAmperage, mVoltage, mInsulated, mCanShock);
return new GT_MetaPipeEntity_Cable(mName, mThickNess, mMaterial, mCableLossPerMeter, mAmperage, mVoltage, mInsulated, mCanShock, mTextures);
}
@Override
@ -85,27 +123,10 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
aConnected = false;
}
if (!mInsulated) {
return new ITexture[]{new GT_PipeRenderedTexture(mThickNess, aConnected, mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa)};
if(aColorIndex < 0 || aColorIndex >= Dyes.VALUES.length) {
aColorIndex = 16;
}
float tThickNess = getThickNess();
short[] rgba = Dyes.getOrDef(aColorIndex, Dyes.INSULATION);
IIconContainer[] textures = mMaterial.mIconSet.mTextures;
if (tThickNess < 0.37F)
return new ITexture[]{new GT_PipeRenderedTexture(tThickNess, aConnected, textures[TextureSet.INDEX_wire], mMaterial.mRGBa, Textures.BlockIcons.INSULATION_FULL, rgba)};
if (tThickNess < 0.49F)
return new ITexture[]{new GT_PipeRenderedTexture(tThickNess, aConnected, textures[TextureSet.INDEX_wire], mMaterial.mRGBa, Textures.BlockIcons.INSULATION_FULL, rgba)};
if (tThickNess < 0.74F)
return new ITexture[]{new GT_PipeRenderedTexture(tThickNess, aConnected, textures[TextureSet.INDEX_wire], mMaterial.mRGBa, Textures.BlockIcons.INSULATION_FULL, rgba)};
if (tThickNess < 0.99F)
return new ITexture[]{new GT_PipeRenderedTexture(tThickNess, aConnected, textures[TextureSet.INDEX_wire], mMaterial.mRGBa, Textures.BlockIcons.INSULATION_FULL, rgba)};
return new ITexture[]{new GT_PipeRenderedTexture(tThickNess, aConnected, textures[TextureSet.INDEX_wire], mMaterial.mRGBa, Textures.BlockIcons.INSULATION_FULL, rgba)};
return mTextures[aConnected ? 1 : 0][aColorIndex];
}
@Override

View file

@ -1,9 +1,7 @@
package gregtech.api.net;
import gregtech.GT_Mod;
import gregtech.common.blocks.GT_Packet_Ores;
import net.minecraft.world.World;
import net.minecraftforge.fml.client.FMLClientHandler;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
@ -15,7 +13,6 @@ public class GT_PacketHandler extends SimpleNetworkWrapper {
public GT_PacketHandler() {
super("gregtech_network");
registerMessage(0, GT_Packet_TileEntity.class, Side.CLIENT);
registerMessage(1, GT_Packet_Ores.class, Side.CLIENT);
registerMessage(2, GT_Packet_Sound.class, Side.CLIENT);
}

View file

@ -48,7 +48,7 @@ public class GT_CopiedBlockTexture implements ITexture {
public static TextureAtlasSprite getSide(Block aBlock, int aMeta, EnumFacing side) {
if (aBlock instanceof IBlockIconProvider) {
IBlockIconProvider iconProvider = ((IBlockIconProvider) aBlock);
return iconProvider.getIcon(FMLClientHandler.instance().getWorldClient(), null, side, aMeta);
return null;
}
System.out.println("Failed to copy texture of " + aBlock.getRegistryName() + " " + aMeta);
return Textures.BlockIcons.RENDERING_ERROR.getIcon();
@ -72,4 +72,9 @@ public class GT_CopiedBlockTexture implements ITexture {
return mBlock != null;
}
@Override
public boolean needsNonSidedRendering() {
return false;
}
}

View file

@ -38,4 +38,9 @@ public class GT_MultiTexture implements ITexture {
return true;
}
@Override
public boolean needsNonSidedRendering() {
return false;
}
}

View file

@ -161,7 +161,7 @@ public class GT_PipeRenderedTexture implements ITexture {
}
public BakedQuad makeQuad(TextureAtlasSprite sprite, float x, float y, float z, float width, float height, EnumFacing side, int rgba) {
return RenderUtil.renderQuadCustom(x, y, z, width, height, sprite, side, rgba);
return RenderUtil.renderQuadCustom(x * 16F, y * 16F, z * 16F, width * 16F, height * 16F, sprite, side, rgba);
}
@Override
@ -169,4 +169,9 @@ public class GT_PipeRenderedTexture implements ITexture {
return thickness > 0.0F;
}
@Override
public boolean needsNonSidedRendering() {
return false;
}
}

View file

@ -96,4 +96,9 @@ public class GT_RenderedTexture implements ITexture {
return mIconContainer != null;
}
@Override
public boolean needsNonSidedRendering() {
return false;
}
}

View file

@ -79,4 +79,9 @@ public class GT_SidedTexture implements ITexture {
mIconContainer[5] != null;
}
@Override
public boolean needsNonSidedRendering() {
return false;
}
}

View file

@ -1,5 +1,6 @@
package gregtech.api.objects;
import gregtech.api.GregTech_API;
import gregtech.api.interfaces.IIconContainer;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
@ -16,7 +17,8 @@ public class LazyCopiedIconContainer implements IIconContainer {
@Override
public TextureAtlasSprite getIcon() {
if(lazyComputedSprite == null) {
lazyComputedSprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(mSpriteName);
lazyComputedSprite = GregTech_API.sBlockIcons.getAtlasSprite(mSpriteName);
System.out.println("Lazy-initialized sprite " + lazyComputedSprite.getIconName() + " " + this);
}
return lazyComputedSprite;
}
@ -25,4 +27,6 @@ public class LazyCopiedIconContainer implements IIconContainer {
public TextureAtlasSprite getOverlayIcon() {
return null;
}
}

View file

@ -1390,7 +1390,9 @@ public class GT_ModHandler {
ItemStack[] tList = (ItemStack[]) tEntry.output.items.toArray();
if (tList.length == 0) break;
ItemStack[] rList = new ItemStack[aOutputSlots.length];
rRecipeMetaData.setTag("return", tEntry.output.metadata);
if(tEntry.output.metadata != null) {
rRecipeMetaData.setTag("return", tEntry.output.metadata);
}
for (byte i = 0; i < aOutputSlots.length && i < tList.length; i++) {
if (tList[i] != null) {
if (aOutputSlots[i] == null || (GT_Utility.areStacksEqual(tList[i], aOutputSlots[i]) && tList[i].stackSize + aOutputSlots[i].stackSize <= aOutputSlots[i].getMaxStackSize())) {

View file

@ -32,7 +32,14 @@ public class GT_Worldgen_Constants {
public static Predicate<IBlockState> ENDSTONE = input ->
input.getBlock() == Blocks.END_STONE;
public static Predicate<IBlockState> GRAVEL = input ->
input.getBlock() == Blocks.GRAVEL;
public static Predicate<IBlockState> SAND = input ->
input.getBlock() == Blocks.SANDSTONE;
public static Predicate<IBlockState> ANY = input ->
STONES.apply(input) || NETHERRACK.apply(input) || ENDSTONE.apply(input);
STONES.apply(input) || NETHERRACK.apply(input) || ENDSTONE.apply(input) || GRAVEL.apply(input) || SAND.apply(input);
}

View file

@ -78,37 +78,27 @@ public class GT_Worldgen_GT_Ore_Layer
int cZ = aChunkZ - aRandom.nextInt(this.mSize);
int eZ = aChunkZ + 16 + aRandom.nextInt(this.mSize);
for (int tZ = cZ; tZ <= eZ; tZ++) {
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)) {
BlockPos blockPos = new BlockPos(tX, i, tZ);
GT_TileEntity_Ores.setOreBlock(aWorld, blockPos, this.mPrimaryMeta, false);
}
}
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)) {
BlockPos blockPos = new BlockPos(tX, i, tZ);
if(isGenerationAllowed(aWorld, blockPos)) {
GT_TileEntity_Ores.setOreBlock(aWorld, blockPos, this.mSecondaryMeta, false);
}
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))) {
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))) {
BlockPos blockPos = new BlockPos(tX, tMinY + 2 + aRandom.nextInt(2), tZ);
if(isGenerationAllowed(aWorld, blockPos)) {
GT_TileEntity_Ores.setOreBlock(aWorld, blockPos, this.mBetweenMeta, false);
}
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)) {
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))) {
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))) {
BlockPos blockPos = new BlockPos(tX, tMinY - 1 + aRandom.nextInt(7), tZ);
if(isGenerationAllowed(aWorld, blockPos)) {
GT_TileEntity_Ores.setOreBlock(aWorld, blockPos, this.mSporadicMeta, false);
}
GT_TileEntity_Ores.setOreBlock(aWorld, blockPos, this.mSporadicMeta, false);
}
}
}

View file

@ -46,9 +46,7 @@ public class GT_Worldgen_GT_Ore_SmallPieces
int i = 0;
for (int j = Math.max(1, this.mAmount / 2 + aRandom.nextInt(this.mAmount) / 2); i < j; i++) {
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);
}
GT_TileEntity_Ores.setOreBlock(aWorld, blockPos, this.mMeta, true);
}
}
return true;

View file

@ -66,7 +66,7 @@ public class GT_Worldgen_Stone
TileEntity tTileEntity = aWorld.getTileEntity(randPos);
if ((tTileEntity instanceof GT_TileEntity_Ores)) {
if (tTargetedBlock != GregTech_API.sBlockOres1) {
((GT_TileEntity_Ores) tTileEntity).convertOreBlock(aWorld, eX, eY, eZ);
//((GT_TileEntity_Ores) tTileEntity).convertOreBlock(aWorld, eX, eY, eZ);
}
((GT_TileEntity_Ores)tTileEntity).overrideOreBlockMaterial(this.mBlock, (byte) this.mBlockMeta);
}

View file

@ -1,9 +1,11 @@
package gregtech.common.blocks;
import com.google.common.collect.ImmutableList;
import gregtech.api.enums.ItemList;
import gregtech.api.enums.Textures;
import gregtech.api.objects.GT_CopiedBlockTexture;
import gregtech.api.util.GT_LanguageManager;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
@ -53,31 +55,31 @@ public class GT_Block_Casings1 extends GT_Block_Casings_Abstract {
@Override
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getIcon(EnumFacing aSide, int aMeta) {
public ImmutableList<BakedQuad> getIcon(EnumFacing aSide, int aMeta) {
if ((aMeta >= 0) && (aMeta < 16)) {
switch (aMeta) {
case 10:
return Textures.BlockIcons.MACHINE_BRONZEPLATEDBRICKS.getIcon();
return Textures.BlockIcons.MACHINE_BRONZEPLATEDBRICKS.getQuads(aSide);
case 11:
return Textures.BlockIcons.MACHINE_HEATPROOFCASING.getIcon();
return Textures.BlockIcons.MACHINE_HEATPROOFCASING.getQuads(aSide);
case 12:
return Textures.BlockIcons.RENDERING_ERROR.getIcon();
return Textures.BlockIcons.RENDERING_ERROR.getQuads(aSide);
case 13:
return Textures.BlockIcons.RENDERING_ERROR.getIcon();
return Textures.BlockIcons.RENDERING_ERROR.getQuads(aSide);
case 14:
return Textures.BlockIcons.RENDERING_ERROR.getIcon();
return Textures.BlockIcons.RENDERING_ERROR.getQuads(aSide);
case 15:
return Textures.BlockIcons.MACHINE_COIL_SUPERCONDUCTOR.getIcon();
return Textures.BlockIcons.MACHINE_COIL_SUPERCONDUCTOR.getQuads(aSide);
}
if (aSide == EnumFacing.DOWN) {
return Textures.BlockIcons.MACHINECASINGS_BOTTOM[aMeta].getIcon();
return Textures.BlockIcons.MACHINECASINGS_BOTTOM[aMeta].getQuads(aSide);
}
if (aSide == EnumFacing.UP) {
return Textures.BlockIcons.MACHINECASINGS_TOP[aMeta].getIcon();
return Textures.BlockIcons.MACHINECASINGS_TOP[aMeta].getQuads(aSide);
}
return Textures.BlockIcons.MACHINECASINGS_SIDE[aMeta].getIcon();
return Textures.BlockIcons.MACHINECASINGS_SIDE[aMeta].getQuads(aSide);
}
return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon();
return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getQuads(aSide);
}

View file

@ -1,9 +1,11 @@
package gregtech.common.blocks;
import com.google.common.collect.ImmutableList;
import gregtech.api.enums.ItemList;
import gregtech.api.enums.Textures;
import gregtech.api.objects.GT_CopiedBlockTexture;
import gregtech.api.util.GT_LanguageManager;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
@ -58,42 +60,42 @@ public class GT_Block_Casings2 extends GT_Block_Casings_Abstract {
@Override
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getIcon(EnumFacing aSide, int aMeta) {
public ImmutableList<BakedQuad> getIcon(EnumFacing aSide, int aMeta) {
switch (aMeta) {
case 0:
return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon();
return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getQuads(aSide);
case 1:
return Textures.BlockIcons.MACHINE_CASING_FROST_PROOF.getIcon();
return Textures.BlockIcons.MACHINE_CASING_FROST_PROOF.getQuads(aSide);
case 2:
return Textures.BlockIcons.MACHINE_CASING_GEARBOX_BRONZE.getIcon();
return Textures.BlockIcons.MACHINE_CASING_GEARBOX_BRONZE.getQuads(aSide);
case 3:
return Textures.BlockIcons.MACHINE_CASING_GEARBOX_STEEL.getIcon();
return Textures.BlockIcons.MACHINE_CASING_GEARBOX_STEEL.getQuads(aSide);
case 4:
return Textures.BlockIcons.MACHINE_CASING_GEARBOX_TITANIUM.getIcon();
return Textures.BlockIcons.MACHINE_CASING_GEARBOX_TITANIUM.getQuads(aSide);
case 5:
return Textures.BlockIcons.MACHINE_CASING_GEARBOX_TUNGSTENSTEEL.getIcon();
return Textures.BlockIcons.MACHINE_CASING_GEARBOX_TUNGSTENSTEEL.getQuads(aSide);
case 6:
return Textures.BlockIcons.MACHINE_CASING_PROCESSOR.getIcon();
return Textures.BlockIcons.MACHINE_CASING_PROCESSOR.getQuads(aSide);
case 7:
return Textures.BlockIcons.MACHINE_CASING_DATA_DRIVE.getIcon();
return Textures.BlockIcons.MACHINE_CASING_DATA_DRIVE.getQuads(aSide);
case 8:
return Textures.BlockIcons.MACHINE_CASING_CONTAINMENT_FIELD.getIcon();
return Textures.BlockIcons.MACHINE_CASING_CONTAINMENT_FIELD.getQuads(aSide);
case 9:
return Textures.BlockIcons.MACHINE_CASING_ASSEMBLER.getIcon();
return Textures.BlockIcons.MACHINE_CASING_ASSEMBLER.getQuads(aSide);
case 10:
return Textures.BlockIcons.MACHINE_CASING_PUMP.getIcon();
return Textures.BlockIcons.MACHINE_CASING_PUMP.getQuads(aSide);
case 11:
return Textures.BlockIcons.MACHINE_CASING_MOTOR.getIcon();
return Textures.BlockIcons.MACHINE_CASING_MOTOR.getQuads(aSide);
case 12:
return Textures.BlockIcons.MACHINE_CASING_PIPE_BRONZE.getIcon();
return Textures.BlockIcons.MACHINE_CASING_PIPE_BRONZE.getQuads(aSide);
case 13:
return Textures.BlockIcons.MACHINE_CASING_PIPE_STEEL.getIcon();
return Textures.BlockIcons.MACHINE_CASING_PIPE_STEEL.getQuads(aSide);
case 14:
return Textures.BlockIcons.MACHINE_CASING_PIPE_TITANIUM.getIcon();
return Textures.BlockIcons.MACHINE_CASING_PIPE_TITANIUM.getQuads(aSide);
case 15:
return Textures.BlockIcons.MACHINE_CASING_PIPE_TUNGSTENSTEEL.getIcon();
return Textures.BlockIcons.MACHINE_CASING_PIPE_TUNGSTENSTEEL.getQuads(aSide);
}
return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon();
return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getQuads(aSide);
}
@Override

View file

@ -1,9 +1,11 @@
package gregtech.common.blocks;
import com.google.common.collect.ImmutableList;
import gregtech.api.enums.ItemList;
import gregtech.api.enums.Textures;
import gregtech.api.objects.GT_CopiedBlockTexture;
import gregtech.api.util.GT_LanguageManager;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
@ -53,41 +55,41 @@ public class GT_Block_Casings3 extends GT_Block_Casings_Abstract {
@Override
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getIcon(EnumFacing aSide, int aMeta) {
public ImmutableList<BakedQuad> getIcon(EnumFacing aSide, int aMeta) {
switch (aMeta) {
case 0:
return Textures.BlockIcons.MACHINE_CASING_STRIPES_A.getIcon();
return Textures.BlockIcons.MACHINE_CASING_STRIPES_A.getQuads(aSide);
case 1:
return Textures.BlockIcons.MACHINE_CASING_STRIPES_B.getIcon();
return Textures.BlockIcons.MACHINE_CASING_STRIPES_B.getQuads(aSide);
case 2:
return Textures.BlockIcons.MACHINE_CASING_RADIOACTIVEHAZARD.getIcon();
return Textures.BlockIcons.MACHINE_CASING_RADIOACTIVEHAZARD.getQuads(aSide);
case 3:
return Textures.BlockIcons.MACHINE_CASING_BIOHAZARD.getIcon();
return Textures.BlockIcons.MACHINE_CASING_BIOHAZARD.getQuads(aSide);
case 4:
return Textures.BlockIcons.MACHINE_CASING_EXPLOSIONHAZARD.getIcon();
return Textures.BlockIcons.MACHINE_CASING_EXPLOSIONHAZARD.getQuads(aSide);
case 5:
return Textures.BlockIcons.MACHINE_CASING_FIREHAZARD.getIcon();
return Textures.BlockIcons.MACHINE_CASING_FIREHAZARD.getQuads(aSide);
case 6:
return Textures.BlockIcons.MACHINE_CASING_ACIDHAZARD.getIcon();
return Textures.BlockIcons.MACHINE_CASING_ACIDHAZARD.getQuads(aSide);
case 7:
return Textures.BlockIcons.MACHINE_CASING_MAGICHAZARD.getIcon();
return Textures.BlockIcons.MACHINE_CASING_MAGICHAZARD.getQuads(aSide);
case 8:
return Textures.BlockIcons.MACHINE_CASING_FROSTHAZARD.getIcon();
return Textures.BlockIcons.MACHINE_CASING_FROSTHAZARD.getQuads(aSide);
case 9:
return Textures.BlockIcons.MACHINE_CASING_NOISEHAZARD.getIcon();
return Textures.BlockIcons.MACHINE_CASING_NOISEHAZARD.getQuads(aSide);
case 10:
return Textures.BlockIcons.MACHINE_CASING_GRATE.getIcon();
return Textures.BlockIcons.MACHINE_CASING_GRATE.getQuads(aSide);
case 11:
return Textures.BlockIcons.MACHINE_CASING_VENT.getIcon();
return Textures.BlockIcons.MACHINE_CASING_VENT.getQuads(aSide);
case 12:
return Textures.BlockIcons.MACHINE_CASING_RADIATIONPROOF.getIcon();
return Textures.BlockIcons.MACHINE_CASING_RADIATIONPROOF.getQuads(aSide);
case 13:
return aSide.getIndex() > 1 ? Textures.BlockIcons.MACHINE_CASING_FIREBOX_BRONZE.getIcon() : Textures.BlockIcons.MACHINE_BRONZEPLATEDBRICKS.getIcon();
return aSide.getIndex() > 1 ? Textures.BlockIcons.MACHINE_CASING_FIREBOX_BRONZE.getQuads(aSide) : Textures.BlockIcons.MACHINE_BRONZEPLATEDBRICKS.getQuads(aSide);
case 14:
return aSide.getIndex() > 1 ? Textures.BlockIcons.MACHINE_CASING_FIREBOX_STEEL.getIcon() : Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon();
return aSide.getIndex() > 1 ? Textures.BlockIcons.MACHINE_CASING_FIREBOX_STEEL.getQuads(aSide) : Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getQuads(aSide);
case 15:
return aSide.getIndex() > 1 ? Textures.BlockIcons.MACHINE_CASING_FIREBOX_TUNGSTENSTEEL.getIcon() : Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getIcon();
return aSide.getIndex() > 1 ? Textures.BlockIcons.MACHINE_CASING_FIREBOX_TUNGSTENSTEEL.getQuads(aSide) : Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getQuads(aSide);
}
return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon();
return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getQuads(aSide);
}
}

View file

@ -1,5 +1,6 @@
package gregtech.common.blocks;
import com.google.common.collect.ImmutableList;
import gregtech.api.enums.ItemList;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
@ -8,6 +9,7 @@ import gregtech.api.objects.GT_CopiedBlockTexture;
import gregtech.api.util.GT_LanguageManager;
import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_LargeTurbine;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
@ -57,63 +59,63 @@ public class GT_Block_Casings4 extends GT_Block_Casings_Abstract {
@Override
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getIcon(EnumFacing aSide, int aMeta) {
public ImmutableList<BakedQuad> getIcon(EnumFacing aSide, int aMeta) {
switch (aMeta) {
case 0:
return Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getIcon();
return Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getQuads(aSide);
case 1:
return Textures.BlockIcons.MACHINE_CASING_CLEAN_STAINLESSSTEEL.getIcon();
return Textures.BlockIcons.MACHINE_CASING_CLEAN_STAINLESSSTEEL.getQuads(aSide);
case 2:
return Textures.BlockIcons.MACHINE_CASING_STABLE_TITANIUM.getIcon();
return Textures.BlockIcons.MACHINE_CASING_STABLE_TITANIUM.getQuads(aSide);
case 3:
return aSide.getIndex() > 1 ? Textures.BlockIcons.MACHINE_CASING_FIREBOX_TITANIUM.getIcon() : Textures.BlockIcons.MACHINE_CASING_STABLE_TITANIUM.getIcon();
return aSide.getIndex() > 1 ? Textures.BlockIcons.MACHINE_CASING_FIREBOX_TITANIUM.getQuads(aSide) : Textures.BlockIcons.MACHINE_CASING_STABLE_TITANIUM.getQuads(aSide);
case 4:
return Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW.getIcon();
return Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW.getQuads(aSide);
case 5:
return Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS.getIcon();
return Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS.getQuads(aSide);
case 6:
return Textures.BlockIcons.MACHINE_CASING_FUSION.getIcon();
return Textures.BlockIcons.MACHINE_CASING_FUSION.getQuads(aSide);
case 7:
return Textures.BlockIcons.MACHINE_CASING_FUSION_COIL.getIcon();
return Textures.BlockIcons.MACHINE_CASING_FUSION_COIL.getQuads(aSide);
case 8:
return Textures.BlockIcons.MACHINE_CASING_FUSION_2.getIcon();
return Textures.BlockIcons.MACHINE_CASING_FUSION_2.getQuads(aSide);
case 9:
return Textures.BlockIcons.MACHINE_CASING_TURBINE.getIcon();
return Textures.BlockIcons.MACHINE_CASING_TURBINE.getQuads(aSide);
case 10:
return Textures.BlockIcons.MACHINE_CASING_CLEAN_STAINLESSSTEEL.getIcon();
return Textures.BlockIcons.MACHINE_CASING_CLEAN_STAINLESSSTEEL.getQuads(aSide);
case 11:
return Textures.BlockIcons.MACHINE_CASING_STABLE_TITANIUM.getIcon();
return Textures.BlockIcons.MACHINE_CASING_STABLE_TITANIUM.getQuads(aSide);
case 12:
return Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getIcon();
return Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getQuads(aSide);
case 13:
return Textures.BlockIcons.MACHINE_CASING_ENGINE_INTAKE.getIcon();
return Textures.BlockIcons.MACHINE_CASING_ENGINE_INTAKE.getQuads(aSide);
case 14:
return Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getIcon();
return Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getQuads(aSide);
case 15:
return Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getIcon();
return Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getQuads(aSide);
}
return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon();
return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getQuads(aSide);
}
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getTurbineCasing(int meta, int iconIndex, boolean active) {
public ImmutableList<BakedQuad> getTurbineCasing(int meta, int iconIndex, boolean active, EnumFacing aSide) {
switch (meta) {
case 9:
return active ? Textures.BlockIcons.TURBINE_ACTIVE[iconIndex].getIcon() : Textures.BlockIcons.TURBINE[iconIndex].getIcon();
return active ? Textures.BlockIcons.TURBINE_ACTIVE[iconIndex].getQuads(aSide) : Textures.BlockIcons.TURBINE[iconIndex].getQuads(aSide);
case 10:
return active ? Textures.BlockIcons.TURBINE_ACTIVE1[iconIndex].getIcon() : Textures.BlockIcons.TURBINE1[iconIndex].getIcon();
return active ? Textures.BlockIcons.TURBINE_ACTIVE1[iconIndex].getQuads(aSide) : Textures.BlockIcons.TURBINE1[iconIndex].getQuads(aSide);
case 11:
return active ? Textures.BlockIcons.TURBINE_ACTIVE2[iconIndex].getIcon() : Textures.BlockIcons.TURBINE2[iconIndex].getIcon();
return active ? Textures.BlockIcons.TURBINE_ACTIVE2[iconIndex].getQuads(aSide) : Textures.BlockIcons.TURBINE2[iconIndex].getQuads(aSide);
case 12:
return active ? Textures.BlockIcons.TURBINE_ACTIVE3[iconIndex].getIcon() : Textures.BlockIcons.TURBINE3[iconIndex].getIcon();
return active ? Textures.BlockIcons.TURBINE_ACTIVE3[iconIndex].getQuads(aSide) : Textures.BlockIcons.TURBINE3[iconIndex].getQuads(aSide);
default:
return active ? Textures.BlockIcons.TURBINE_ACTIVE[iconIndex].getIcon() : Textures.BlockIcons.TURBINE[iconIndex].getIcon();
return active ? Textures.BlockIcons.TURBINE_ACTIVE[iconIndex].getQuads(aSide) : Textures.BlockIcons.TURBINE[iconIndex].getQuads(aSide);
}
}
@SideOnly(Side.CLIENT)
@Override
public TextureAtlasSprite getIcon(IBlockAccess aWorld, BlockPos pos, EnumFacing aSide, int tMeta) {
public ImmutableList<BakedQuad> getIcon(IBlockAccess aWorld, BlockPos pos, EnumFacing aSide, int tMeta) {
if(pos == null) {
return getIcon(aSide, tMeta);
}
@ -127,115 +129,115 @@ public class GT_Block_Casings4 extends GT_Block_Casings_Abstract {
IMetaTileEntity tMetaTileEntity;
if ((null != (tTileEntity = aWorld.getTileEntity(pos.add(aSide == EnumFacing.SOUTH ? 1 : -1, -1, 0)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide.getIndex()) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine))) {
if (((IGregTechTileEntity) tTileEntity).isActive()) {
return getTurbineCasing(tMeta, 0, true);
return getTurbineCasing(tMeta, 0, true, aSide);
}
return getTurbineCasing(tMeta, 0, false);
return getTurbineCasing(tMeta, 0, false, aSide);
}
if ((null != (tTileEntity = aWorld.getTileEntity(pos.add(aSide == EnumFacing.SOUTH ? 1 : -1, 0, 0)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide.getIndex()) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine))) {
if (((IGregTechTileEntity) tTileEntity).isActive()) {
return getTurbineCasing(tMeta, 3, true);
return getTurbineCasing(tMeta, 3, true, aSide);
}
return getTurbineCasing(tMeta, 3, false);
return getTurbineCasing(tMeta, 3, false, aSide);
}
if ((null != (tTileEntity = aWorld.getTileEntity(pos.add(aSide == EnumFacing.SOUTH ? 1 : -1, 1, 0)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide.getIndex()) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine))) {
if (((IGregTechTileEntity) tTileEntity).isActive()) {
return getTurbineCasing(tMeta, 6, true);
return getTurbineCasing(tMeta, 6, true, aSide);
}
return getTurbineCasing(tMeta, 6, false);
return getTurbineCasing(tMeta, 6, false, aSide);
}
if ((null != (tTileEntity = aWorld.getTileEntity(pos.down()))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide.getIndex()) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine))) {
if (((IGregTechTileEntity) tTileEntity).isActive()) {
return getTurbineCasing(tMeta, 1, true);
return getTurbineCasing(tMeta, 1, true, aSide);
}
return getTurbineCasing(tMeta, 1, false);
return getTurbineCasing(tMeta, 1, false, aSide);
}
if ((null != (tTileEntity = aWorld.getTileEntity(pos.up()))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide.getIndex()) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine))) {
if (((IGregTechTileEntity) tTileEntity).isActive()) {
return getTurbineCasing(tMeta, 7, true);
return getTurbineCasing(tMeta, 7, true, aSide);
}
return getTurbineCasing(tMeta, 7, false);
return getTurbineCasing(tMeta, 7, false, aSide);
}
if ((null != (tTileEntity = aWorld.getTileEntity(pos.add(aSide == EnumFacing.NORTH ? 1 : -1, 1, 0)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide.getIndex()) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine))) {
if (((IGregTechTileEntity) tTileEntity).isActive()) {
return getTurbineCasing(tMeta, 8, true);
return getTurbineCasing(tMeta, 8, true, aSide);
}
return getTurbineCasing(tMeta, 8, false);
return getTurbineCasing(tMeta, 8, false, aSide);
}
if ((null != (tTileEntity = aWorld.getTileEntity(pos.add(aSide == EnumFacing.NORTH ? 1 : -1, 0, 0)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide.getIndex()) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine))) {
if (((IGregTechTileEntity) tTileEntity).isActive()) {
return getTurbineCasing(tMeta, 5, true);
return getTurbineCasing(tMeta, 5, true, aSide);
}
return getTurbineCasing(tMeta, 5, false);
return getTurbineCasing(tMeta, 5, false, aSide);
}
if ((null != (tTileEntity = aWorld.getTileEntity(pos.add(aSide == EnumFacing.NORTH ? 1 : -1, -1, 0)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide.getIndex()) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine))) {
if (((IGregTechTileEntity) tTileEntity).isActive()) {
return getTurbineCasing(tMeta, 2, true);
return getTurbineCasing(tMeta, 2, true, aSide);
}
return getTurbineCasing(tMeta, 2, false);
return getTurbineCasing(tMeta, 2, false, aSide);
}
} else if ((aSide == EnumFacing.WEST) || (aSide == EnumFacing.EAST)) {
TileEntity tTileEntity;
Object tMetaTileEntity;
if ((null != (tTileEntity = aWorld.getTileEntity(pos.add(0, -1, aSide == EnumFacing.WEST ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide.getIndex()) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine))) {
if (((IGregTechTileEntity) tTileEntity).isActive()) {
return getTurbineCasing(tMeta, 0, true);
return getTurbineCasing(tMeta, 0, true, aSide);
}
return getTurbineCasing(tMeta, 0, false);
return getTurbineCasing(tMeta, 0, false, aSide);
}
if ((null != (tTileEntity = aWorld.getTileEntity(pos.add(0, 0, aSide == EnumFacing.WEST ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide.getIndex()) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine))) {
if (((IGregTechTileEntity) tTileEntity).isActive()) {
return getTurbineCasing(tMeta, 3, true);
return getTurbineCasing(tMeta, 3, true, aSide);
}
return getTurbineCasing(tMeta, 3, false);
return getTurbineCasing(tMeta, 3, false, aSide);
}
if ((null != (tTileEntity = aWorld.getTileEntity(pos.add(0, 1, aSide == EnumFacing.WEST ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide.getIndex()) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine))) {
if (((IGregTechTileEntity) tTileEntity).isActive()) {
return getTurbineCasing(tMeta, 6, true);
return getTurbineCasing(tMeta, 6, true, aSide);
}
return getTurbineCasing(tMeta, 6, false);
return getTurbineCasing(tMeta, 6, false, aSide);
}
if ((null != (tTileEntity = aWorld.getTileEntity(pos.down()))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide.getIndex()) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine))) {
if (((IGregTechTileEntity) tTileEntity).isActive()) {
return getTurbineCasing(tMeta, 1, true);
return getTurbineCasing(tMeta, 1, true, aSide);
}
return getTurbineCasing(tMeta, 1, false);
return getTurbineCasing(tMeta, 1, false, aSide);
}
if ((null != (tTileEntity = aWorld.getTileEntity(pos.up()))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide.getIndex()) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine))) {
if (((IGregTechTileEntity) tTileEntity).isActive()) {
return getTurbineCasing(tMeta, 7, true);
return getTurbineCasing(tMeta, 7, true, aSide);
}
return getTurbineCasing(tMeta, 7, false);
return getTurbineCasing(tMeta, 7, false, aSide);
}
if ((null != (tTileEntity = aWorld.getTileEntity(pos.add(0, 1, aSide == EnumFacing.EAST ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide.getIndex()) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine))) {
if (((IGregTechTileEntity) tTileEntity).isActive()) {
return getTurbineCasing(tMeta, 8, true);
return getTurbineCasing(tMeta, 8, true, aSide);
}
return getTurbineCasing(tMeta, 8, false);
return getTurbineCasing(tMeta, 8, false, aSide);
}
if ((null != (tTileEntity = aWorld.getTileEntity(pos.add(0, 0, aSide == EnumFacing.EAST ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide.getIndex()) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine))) {
if (((IGregTechTileEntity) tTileEntity).isActive()) {
return getTurbineCasing(tMeta, 5, true);
return getTurbineCasing(tMeta, 5, true, aSide);
}
return getTurbineCasing(tMeta, 5, false);
return getTurbineCasing(tMeta, 5, false, aSide);
}
if ((null != (tTileEntity = aWorld.getTileEntity(pos.add(0, -1, aSide == EnumFacing.EAST ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide.getIndex()) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine))) {
if (((IGregTechTileEntity) tTileEntity).isActive()) {
return getTurbineCasing(tMeta, 2, true);
return getTurbineCasing(tMeta, 2, true, aSide);
}
return getTurbineCasing(tMeta, 2, false);
return getTurbineCasing(tMeta, 2, false, aSide);
}
}
switch (tMeta) {
case 9:
return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon();
return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getQuads(aSide);
case 10:
return Textures.BlockIcons.MACHINE_CASING_CLEAN_STAINLESSSTEEL.getIcon();
return Textures.BlockIcons.MACHINE_CASING_CLEAN_STAINLESSSTEEL.getQuads(aSide);
case 11:
return Textures.BlockIcons.MACHINE_CASING_STABLE_TITANIUM.getIcon();
return Textures.BlockIcons.MACHINE_CASING_STABLE_TITANIUM.getQuads(aSide);
case 12:
return Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getIcon();
return Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getQuads(aSide);
default:
return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon();
return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getQuads(aSide);
}
}
boolean[] tConnectedSides = {
@ -248,247 +250,247 @@ public class GT_Block_Casings4 extends GT_Block_Casings_Abstract {
switch (aSide) {
case DOWN:
if (tConnectedSides[0]) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getQuads(aSide);
}
if ((tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getQuads(aSide);
}
if ((!tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getQuads(aSide);
}
if ((tConnectedSides[4]) && (!tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getQuads(aSide);
}
if ((tConnectedSides[4]) && (tConnectedSides[5]) && (!tConnectedSides[2]) && (tConnectedSides[3])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getQuads(aSide);
}
if ((tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (!tConnectedSides[3])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getQuads(aSide);
}
if ((!tConnectedSides[4]) && (!tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getQuads(aSide);
}
if ((tConnectedSides[4]) && (!tConnectedSides[5]) && (!tConnectedSides[2]) && (tConnectedSides[3])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getQuads(aSide);
}
if ((tConnectedSides[4]) && (tConnectedSides[5]) && (!tConnectedSides[2]) && (!tConnectedSides[3])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getQuads(aSide);
}
if ((!tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (!tConnectedSides[3])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getQuads(aSide);
}
if ((!tConnectedSides[4]) && (!tConnectedSides[5]) && (!tConnectedSides[2]) && (!tConnectedSides[3])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getQuads(aSide);
}
if ((!tConnectedSides[4]) && (!tConnectedSides[2])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getQuads(aSide);
}
if ((!tConnectedSides[5]) && (!tConnectedSides[3])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex)].getQuads(aSide);
}
case UP:
if (tConnectedSides[1]) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getQuads(aSide);
}
if ((tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getQuads(aSide);
}
if ((!tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getQuads(aSide);
}
if ((tConnectedSides[4]) && (!tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getQuads(aSide);
}
if ((tConnectedSides[4]) && (tConnectedSides[5]) && (!tConnectedSides[2]) && (tConnectedSides[3])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getQuads(aSide);
}
if ((tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (!tConnectedSides[3])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getQuads(aSide);
}
if ((!tConnectedSides[4]) && (!tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getQuads(aSide);
}
if ((tConnectedSides[4]) && (!tConnectedSides[5]) && (!tConnectedSides[2]) && (tConnectedSides[3])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getQuads(aSide);
}
if ((tConnectedSides[4]) && (tConnectedSides[5]) && (!tConnectedSides[2]) && (!tConnectedSides[3])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getQuads(aSide);
}
if ((!tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (!tConnectedSides[3])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getQuads(aSide);
}
if ((!tConnectedSides[4]) && (!tConnectedSides[5]) && (!tConnectedSides[2]) && (!tConnectedSides[3])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getQuads(aSide);
}
if ((!tConnectedSides[2]) && (!tConnectedSides[4])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getQuads(aSide);
}
if ((!tConnectedSides[3]) && (!tConnectedSides[5])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex)].getQuads(aSide);
}
case NORTH:
if (tConnectedSides[5]) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getQuads(aSide);
}
if ((tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getQuads(aSide);
}
if ((!tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getQuads(aSide);
}
if ((tConnectedSides[2]) && (!tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getQuads(aSide);
}
if ((tConnectedSides[2]) && (tConnectedSides[0]) && (!tConnectedSides[4]) && (tConnectedSides[1])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getQuads(aSide);
}
if ((tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (!tConnectedSides[1])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getQuads(aSide);
}
if ((!tConnectedSides[2]) && (!tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getQuads(aSide);
}
if ((tConnectedSides[2]) && (!tConnectedSides[0]) && (!tConnectedSides[4]) && (tConnectedSides[1])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getQuads(aSide);
}
if ((tConnectedSides[2]) && (tConnectedSides[0]) && (!tConnectedSides[4]) && (!tConnectedSides[1])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getQuads(aSide);
}
if ((!tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (!tConnectedSides[1])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getQuads(aSide);
}
if ((!tConnectedSides[2]) && (!tConnectedSides[0]) && (!tConnectedSides[4]) && (!tConnectedSides[1])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getQuads(aSide);
}
if ((!tConnectedSides[2]) && (!tConnectedSides[4])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getQuads(aSide);
}
if ((!tConnectedSides[0]) && (!tConnectedSides[1])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex)].getQuads(aSide);
}
case SOUTH:
if (tConnectedSides[3]) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getQuads(aSide);
}
if ((tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getQuads(aSide);
}
if ((!tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getQuads(aSide);
}
if ((tConnectedSides[2]) && (!tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getQuads(aSide);
}
if ((tConnectedSides[2]) && (tConnectedSides[0]) && (!tConnectedSides[4]) && (tConnectedSides[1])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getQuads(aSide);
}
if ((tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (!tConnectedSides[1])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getQuads(aSide);
}
if ((!tConnectedSides[2]) && (!tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getQuads(aSide);
}
if ((tConnectedSides[2]) && (!tConnectedSides[0]) && (!tConnectedSides[4]) && (tConnectedSides[1])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getQuads(aSide);
}
if ((tConnectedSides[2]) && (tConnectedSides[0]) && (!tConnectedSides[4]) && (!tConnectedSides[1])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getQuads(aSide);
}
if ((!tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (!tConnectedSides[1])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getQuads(aSide);
}
if ((!tConnectedSides[2]) && (!tConnectedSides[0]) && (!tConnectedSides[4]) && (!tConnectedSides[1])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getQuads(aSide);
}
if ((!tConnectedSides[2]) && (!tConnectedSides[4])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getQuads(aSide);
}
if ((!tConnectedSides[0]) && (!tConnectedSides[1])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex)].getQuads(aSide);
}
case WEST:
if (tConnectedSides[4]) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getQuads(aSide);
}
if ((tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getQuads(aSide);
}
if ((!tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getQuads(aSide);
}
if ((tConnectedSides[0]) && (!tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getQuads(aSide);
}
if ((tConnectedSides[0]) && (tConnectedSides[3]) && (!tConnectedSides[1]) && (tConnectedSides[5])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getQuads(aSide);
}
if ((tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (!tConnectedSides[5])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getQuads(aSide);
}
if ((!tConnectedSides[0]) && (!tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getQuads(aSide);
}
if ((tConnectedSides[0]) && (!tConnectedSides[3]) && (!tConnectedSides[1]) && (tConnectedSides[5])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getQuads(aSide);
}
if ((tConnectedSides[0]) && (tConnectedSides[3]) && (!tConnectedSides[1]) && (!tConnectedSides[5])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getQuads(aSide);
}
if ((!tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (!tConnectedSides[5])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getQuads(aSide);
}
if ((!tConnectedSides[0]) && (!tConnectedSides[3]) && (!tConnectedSides[1]) && (!tConnectedSides[5])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getQuads(aSide);
}
if ((!tConnectedSides[0]) && (!tConnectedSides[1])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex)].getQuads(aSide);
}
if ((!tConnectedSides[3]) && (!tConnectedSides[5])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getQuads(aSide);
}
case EAST:
if (tConnectedSides[2]) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getQuads(aSide);
}
if ((tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getQuads(aSide);
}
if ((!tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getQuads(aSide);
}
if ((tConnectedSides[0]) && (!tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getQuads(aSide);
}
if ((tConnectedSides[0]) && (tConnectedSides[3]) && (!tConnectedSides[1]) && (tConnectedSides[5])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getQuads(aSide);
}
if ((tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (!tConnectedSides[5])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getQuads(aSide);
}
if ((!tConnectedSides[0]) && (!tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getQuads(aSide);
}
if ((tConnectedSides[0]) && (!tConnectedSides[3]) && (!tConnectedSides[1]) && (tConnectedSides[5])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getQuads(aSide);
}
if ((tConnectedSides[0]) && (tConnectedSides[3]) && (!tConnectedSides[1]) && (!tConnectedSides[5])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getQuads(aSide);
}
if ((!tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (!tConnectedSides[5])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getQuads(aSide);
}
if ((!tConnectedSides[0]) && (!tConnectedSides[3]) && (!tConnectedSides[1]) && (!tConnectedSides[5])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getQuads(aSide);
}
if ((!tConnectedSides[0]) && (!tConnectedSides[1])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex)].getQuads(aSide);
}
if ((!tConnectedSides[3]) && (!tConnectedSides[5])) {
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getQuads(aSide);
}
break;
}
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon();
return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getQuads(aSide);
}
public boolean stateAndMetaEquals(IBlockAccess access, BlockPos blockPos, int meta) {

View file

@ -1,5 +1,7 @@
package gregtech.common.blocks;
import com.google.common.collect.ImmutableList;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.fml.relauncher.Side;
@ -35,23 +37,23 @@ public class GT_Block_Casings5 extends GT_Block_Casings_Abstract {
}
@Override
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getIcon(EnumFacing aSide, int aMeta) {
public ImmutableList<BakedQuad> getIcon(EnumFacing aSide, int aMeta) {
switch (aMeta) {
case 0:
return Textures.BlockIcons.MACHINE_COIL_CUPRONICKEL.getIcon();
return Textures.BlockIcons.MACHINE_COIL_CUPRONICKEL.getQuads(aSide);
case 1:
return Textures.BlockIcons.MACHINE_COIL_KANTHAL.getIcon();
return Textures.BlockIcons.MACHINE_COIL_KANTHAL.getQuads(aSide);
case 2:
return Textures.BlockIcons.MACHINE_COIL_NICHROME.getIcon();
return Textures.BlockIcons.MACHINE_COIL_NICHROME.getQuads(aSide);
case 3:
return Textures.BlockIcons.MACHINE_COIL_TUNGSTENSTEEL.getIcon();
return Textures.BlockIcons.MACHINE_COIL_TUNGSTENSTEEL.getQuads(aSide);
case 4:
return Textures.BlockIcons.MACHINE_COIL_HSSG.getIcon();
return Textures.BlockIcons.MACHINE_COIL_HSSG.getQuads(aSide);
case 5:
return Textures.BlockIcons.MACHINE_COIL_NAQUADAH.getIcon();
return Textures.BlockIcons.MACHINE_COIL_NAQUADAH.getQuads(aSide);
case 6:
return Textures.BlockIcons.MACHINE_COIL_NAQUADAHALLOY.getIcon();
return Textures.BlockIcons.MACHINE_COIL_NAQUADAHALLOY.getQuads(aSide);
}
return Textures.BlockIcons.MACHINE_COIL_CUPRONICKEL.getIcon();
return Textures.BlockIcons.MACHINE_COIL_CUPRONICKEL.getQuads(aSide);
}
}

View file

@ -1,5 +1,6 @@
package gregtech.common.blocks;
import com.google.common.collect.ImmutableList;
import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.util.GT_LanguageManager;
@ -7,6 +8,7 @@ import gregtech.api.util.GT_OreDictUnificator;
import net.minecraft.block.Block;
import net.minecraft.block.BlockLiquid;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
@ -63,11 +65,11 @@ public class GT_Block_Concretes extends GT_Block_Stones_Abstract {
@Override
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getIcon(EnumFacing aSide, int aMeta) {
public ImmutableList<BakedQuad> getIcon(EnumFacing aSide, int aMeta) {
if ((aMeta >= 0) && (aMeta < 16)) {
return gregtech.api.enums.Textures.BlockIcons.CONCRETES[aMeta].getIcon();
return gregtech.api.enums.Textures.BlockIcons.CONCRETES[aMeta].getQuads(aSide);
}
return gregtech.api.enums.Textures.BlockIcons.CONCRETES[0].getIcon();
return gregtech.api.enums.Textures.BlockIcons.CONCRETES[0].getQuads(aSide);
}
@Override

View file

@ -1,10 +1,12 @@
package gregtech.common.blocks;
import com.google.common.collect.ImmutableList;
import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.util.GT_LanguageManager;
import gregtech.api.util.GT_OreDictUnificator;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.entity.Entity;
import net.minecraft.entity.boss.EntityWither;
@ -62,11 +64,11 @@ public class GT_Block_Granites extends GT_Block_Stones_Abstract {
@Override
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getIcon(EnumFacing aSide, int aMeta) {
public ImmutableList<BakedQuad> getIcon(EnumFacing aSide, int aMeta) {
if ((aMeta >= 0) && (aMeta < 16)) {
return gregtech.api.enums.Textures.BlockIcons.GRANITES[aMeta].getIcon();
return gregtech.api.enums.Textures.BlockIcons.GRANITES[aMeta].getQuads(aSide);
}
return gregtech.api.enums.Textures.BlockIcons.GRANITES[0].getIcon();
return gregtech.api.enums.Textures.BlockIcons.GRANITES[0].getQuads(aSide);
}
@Override

View file

@ -13,7 +13,7 @@ import gregtech.api.metatileentity.BaseTileEntity;
import gregtech.api.util.GT_LanguageManager;
import gregtech.api.util.GT_Log;
import gregtech.api.util.GT_Utility;
import gregtech.common.render.IIconRegister;
import gregtech.common.render.data.IIconRegister;
import gregtech.common.render.blocks.IBlockTextureProvider;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.SoundType;
@ -519,10 +519,20 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo
}
@Override
@SideOnly(Side.CLIENT)
//for multilayer blocks
public BlockRenderLayer getBlockLayer() {
return BlockRenderLayer.CUTOUT;
}
@Override
public boolean isOpaqueCube(IBlockState state) {
return false;
}
@Override
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
IGregTechTileEntity tileEntity = getGregTile(blockAccess, pos);
return super.shouldSideBeRendered(blockState, blockAccess, pos, side) ||
tileEntity != null && tileEntity instanceof BaseMetaPipeEntity;
}
}

View file

@ -1,6 +1,9 @@
package gregtech.common.blocks;
import com.google.common.collect.ImmutableList;
import gregtech.api.enums.Textures;
import gregtech.common.render.blocks.IBlockIconProvider;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.EnumFacing;
import gregtech.api.enums.Materials;
@ -16,9 +19,9 @@ import net.minecraftforge.fml.relauncher.SideOnly;
public class GT_Block_Metal extends GT_Block_Storage implements IBlockIconProvider {
public Materials[] mMats;
public OrePrefixes mPrefix;
public IIconContainer[] mBlockIcons;
public Textures.BlockIcons[] mBlockIcons;
public GT_Block_Metal(String aName, Materials[] aMats, OrePrefixes aPrefix, IIconContainer[] aBlockIcons) {
public GT_Block_Metal(String aName, Materials[] aMats, OrePrefixes aPrefix, Textures.BlockIcons[] aBlockIcons) {
super(GT_Item_Storage.class, aName, Material.IRON);
mMats = aMats;
mPrefix = aPrefix;
@ -31,11 +34,11 @@ public class GT_Block_Metal extends GT_Block_Storage implements IBlockIconProvid
@Override
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getIcon(EnumFacing aSide, int aDamage) {
public ImmutableList<BakedQuad> getIcon(EnumFacing aSide, int aDamage) {
if ((aDamage >= 0) && (aDamage < 16) && aDamage < mMats.length) {
return mBlockIcons[aDamage].getIcon();
return mBlockIcons[aDamage].getQuads(aSide);
}
return mBlockIcons[0].getIcon();
return mBlockIcons[0].getQuads(aSide);
}
}

View file

@ -4,9 +4,11 @@ import gregtech.api.GregTech_API;
import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.IIconContainer;
import gregtech.api.interfaces.ITexture;
import gregtech.api.objects.GT_CopiedBlockTexture;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.objects.LazyCopiedIconContainer;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
@ -17,44 +19,50 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
import java.util.Random;
public class GT_Block_Ores extends GT_Block_Ores_Abstract {
public static final ITexture[] TEXTURES = new ITexture[] {
new GT_RenderedTexture("minecraft:blocks/stone", null),
new GT_RenderedTexture("minecraft:blocks/netherrack", null),
new GT_RenderedTexture("minecraft:blocks/end_stone", null),
new GT_RenderedTexture(Textures.BlockIcons.GRANITE_BLACK_STONE),
new GT_RenderedTexture(Textures.BlockIcons.GRANITE_RED_STONE),
new GT_RenderedTexture(Textures.BlockIcons.MARBLE_STONE),
new GT_RenderedTexture(Textures.BlockIcons.BASALT_STONE),
new GT_RenderedTexture("minecraft:blocks/sand", null),
new GT_RenderedTexture("minecraft:blocks/gravel", null),
new GT_RenderedTexture("minecraft:blocks/stone", null),
new GT_RenderedTexture("minecraft:blocks/stone", null),
new GT_RenderedTexture("minecraft:blocks/stone", null),
new GT_RenderedTexture("minecraft:blocks/stone", null),
new GT_RenderedTexture("minecraft:blocks/stone", null),
new GT_RenderedTexture("minecraft:blocks/stone", null),
new GT_RenderedTexture("minecraft:blocks/stone", null)};
public static final IIconContainer[] TEXTURES = new IIconContainer[]{
new LazyCopiedIconContainer("minecraft:blocks/stone"),
new LazyCopiedIconContainer("minecraft:blocks/netherrack"),
new LazyCopiedIconContainer("minecraft:blocks/end_stone"),
Textures.BlockIcons.GRANITE_BLACK_STONE,
Textures.BlockIcons.GRANITE_RED_STONE,
Textures.BlockIcons.MARBLE_STONE,
Textures.BlockIcons.BASALT_STONE,
new LazyCopiedIconContainer("minecraft:blocks/stone_granite"),
new LazyCopiedIconContainer("minecraft:blocks/stone_diorite"),
new LazyCopiedIconContainer("minecraft:blocks/stone_andesite"),
new LazyCopiedIconContainer("minecraft:blocks/gravel"),
new LazyCopiedIconContainer("minecraft:blocks/sandstone_bottom"),
new LazyCopiedIconContainer("minecraft:blocks/stone"),
new LazyCopiedIconContainer("minecraft:blocks/stone"),
new LazyCopiedIconContainer("minecraft:blocks/stone"),
new LazyCopiedIconContainer("minecraft:blocks/stone")
};
public static final Materials[] DROPPED_MATERIALS = {
Materials.Stone, Materials.Netherrack, Materials.Endstone,
Materials.GraniteBlack, Materials.GraniteRed,
Materials.Marble, Materials.Basalt,
Materials.Stone, Materials.Stone, Materials.GraniteBlack,
null, null,
Materials.Stone, Materials.Stone, Materials.Stone, Materials.Stone, Materials.Stone, Materials.Stone};
Materials.Stone, Materials.Stone, Materials.Stone};
public static final OrePrefixes[] PROCESSING_PREFIXES = new OrePrefixes[] {
OrePrefixes.ore, OrePrefixes.oreNetherrack, OrePrefixes.oreEndstone,
OrePrefixes.oreBlackgranite, OrePrefixes.oreRedgranite,
OrePrefixes.oreMarble, OrePrefixes.oreBasalt,
OrePrefixes.ore, OrePrefixes.ore, OrePrefixes.oreBlackgranite,
OrePrefixes.oreSand, OrePrefixes.oreGravel,
null, null, null, null, null, null, null};
null, null, null, null};
public GT_Block_Ores() {
super("gt.blockores", Material.ROCK);
}
@Override
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
GT_TileEntity_Ores tileEntity_ores = (GT_TileEntity_Ores) world.getTileEntity(pos);
@ -75,7 +83,6 @@ public class GT_Block_Ores extends GT_Block_Ores_Abstract {
return GregTech_API.sBlockOres1;
}
@Override
public OrePrefixes[] getProcessingPrefix() { //Must have 16 entries; an entry can be null to disable automatic recipes.
return PROCESSING_PREFIXES;
@ -87,8 +94,13 @@ public class GT_Block_Ores extends GT_Block_Ores_Abstract {
}
@Override
public ITexture[] getTextureSet() { //Must have 16 entries.
public IIconContainer[] getTextureSet() { //Must have 16 entries.
return TEXTURES;
}
@Override
public boolean isGravelAlike(int aOreMeta) {
return aOreMeta > 11000;
}
}

View file

@ -1,21 +1,28 @@
package gregtech.common.blocks;
import com.google.common.collect.ImmutableList;
import gnu.trove.map.TIntObjectMap;
import gnu.trove.map.hash.TIntObjectHashMap;
import gregtech.GT_Mod;
import gregtech.api.GregTech_API;
import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.IIconContainer;
import gregtech.api.items.GT_Generic_Block;
import gregtech.api.util.GT_LanguageManager;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.common.render.blocks.IBlockTextureProvider;
import gregtech.common.render.blocks.IBlockIconProvider;
import gregtech.common.render.data.IIconData;
import gregtech.common.render.data.IIconRegister;
import gregtech.common.render.data.IconDataGetter;
import gregtech.jei.JEI_Compat;
import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
@ -28,15 +35,18 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.Explosion;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.Collections;
import java.util.ConcurrentModificationException;
import java.util.List;
public abstract class GT_Block_Ores_Abstract extends GT_Generic_Block implements ITileEntityProvider, IBlockTextureProvider {
public abstract class GT_Block_Ores_Abstract extends GT_Generic_Block implements ITileEntityProvider, IBlockIconProvider, IIconRegister {
@SideOnly(Side.CLIENT)
protected TIntObjectMap<IIconData> mGeneratedIconData = new TIntObjectHashMap<>();
protected GT_Block_Ores_Abstract(String aUnlocalizedName, Material aMaterial) {
super(GT_Item_Ores.class, aUnlocalizedName, aMaterial);
@ -50,43 +60,28 @@ public abstract class GT_Block_Ores_Abstract extends GT_Generic_Block implements
}
boolean hideOres = Loader.isModLoaded("JustEnoughItems") && GT_Mod.gregtechproxy.mHideUnusedOres;
for (int i = 1; i < GregTech_API.sGeneratedMaterials.length; i++) {
if (GregTech_API.sGeneratedMaterials[i] != null) {
for(int x = 0; x < 16; x++) {
if (isValidForCreativeTab(x)) {
String localizedName = getLocalizedName(GregTech_API.sGeneratedMaterials[i]);
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 1000 * x) + ".name", localizedName);
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 16000 + 1000 * x) + ".name", "Small " + localizedName);
Materials materials = GregTech_API.sGeneratedMaterials[i];
if (materials != null && (materials.mTypes & 0x8) != 0) {
OrePrefixes[] processingPrefixes = getProcessingPrefix();
for (int x = 0; x < processingPrefixes.length; x++) {
ItemStack oreStack = new ItemStack(this, 1, i + 1000 * x);
ItemStack smallOreStack = new ItemStack(this, 1, i + 1000 * x + 16000);
if (processingPrefixes[x] != null) {
GT_OreDictUnificator.registerOre(processingPrefixes[x].get(materials), oreStack);
}
}
if ((GregTech_API.sGeneratedMaterials[i].mTypes & 0x8) != 0) {
GT_OreDictUnificator.registerOre(this.getProcessingPrefix()[0] != null ? this.getProcessingPrefix()[0].get(GregTech_API.sGeneratedMaterials[i]) : "", new ItemStack(this, 1, i));
GT_OreDictUnificator.registerOre(this.getProcessingPrefix()[1] != null ? this.getProcessingPrefix()[1].get(GregTech_API.sGeneratedMaterials[i]) : "", new ItemStack(this, 1, i + 1000));
GT_OreDictUnificator.registerOre(this.getProcessingPrefix()[2] != null ? this.getProcessingPrefix()[2].get(GregTech_API.sGeneratedMaterials[i]) : "", new ItemStack(this, 1, i + 2000));
GT_OreDictUnificator.registerOre(this.getProcessingPrefix()[3] != null ? this.getProcessingPrefix()[3].get(GregTech_API.sGeneratedMaterials[i]) : "", new ItemStack(this, 1, i + 3000));
GT_OreDictUnificator.registerOre(this.getProcessingPrefix()[4] != null ? this.getProcessingPrefix()[4].get(GregTech_API.sGeneratedMaterials[i]) : "", new ItemStack(this, 1, i + 4000));
GT_OreDictUnificator.registerOre(this.getProcessingPrefix()[5] != null ? this.getProcessingPrefix()[5].get(GregTech_API.sGeneratedMaterials[i]) : "", new ItemStack(this, 1, i + 5000));
GT_OreDictUnificator.registerOre(this.getProcessingPrefix()[6] != null ? this.getProcessingPrefix()[6].get(GregTech_API.sGeneratedMaterials[i]) : "", new ItemStack(this, 1, i + 6000));
GT_OreDictUnificator.registerOre(this.getProcessingPrefix()[7] != null ? this.getProcessingPrefix()[7].get(GregTech_API.sGeneratedMaterials[i]) : "", new ItemStack(this, 1, i + 7000));
String localizedName = getLocalizedName(materials);
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (oreStack.getItemDamage()) + ".name", localizedName);
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (smallOreStack.getItemDamage()) + ".name", "Small " + localizedName);
if (hideOres) {
Item aItem = Item.getItemFromBlock(this);
for(int x = 0; x < 16; x++) {
if(isValidForCreativeTab(x)) {
JEI_Compat.hideItem(new ItemStack(aItem, 1, 1000 * x + i));
JEI_Compat.hideItem(new ItemStack(aItem, 1, 16000 + 1000 * x + i));
}
}
JEI_Compat.hideItem(oreStack);
JEI_Compat.hideItem(smallOreStack);
}
}
}
}
}
}
public String getLocalizedName(Materials aMaterial) {
switch (aMaterial) {
@ -120,12 +115,6 @@ public abstract class GT_Block_Ores_Abstract extends GT_Generic_Block implements
}
}
@Override
public boolean eventReceived(IBlockState state, World worldIn, BlockPos pos, int id, int param) {
TileEntity tileEntity = worldIn.getTileEntity(pos);
return tileEntity != null && tileEntity.receiveClientEvent(id, param);
}
@Override
public String getHarvestTool(IBlockState aMeta) {
return aMeta.getValue(METADATA) < 8 ? "pickaxe" : "shovel";
@ -133,7 +122,7 @@ public abstract class GT_Block_Ores_Abstract extends GT_Generic_Block implements
@Override
public int getHarvestLevel(IBlockState aMeta) {
return 2;
return aMeta.getValue(METADATA) % 8;
}
@Override
@ -151,94 +140,138 @@ public abstract class GT_Block_Ores_Abstract extends GT_Generic_Block implements
return false;
}
//public abstract String getUnlocalizedName();
public String getLocalizedName() {
return GT_LanguageManager.getTranslation(getUnlocalizedName() + ".name");
}
@Override
public boolean canBeReplacedByLeaves(IBlockState state, IBlockAccess world, BlockPos pos) {
return false;
}
@Override
public boolean isNormalCube(IBlockState state) {
return true;
}
@Override
public boolean isVisuallyOpaque() {
return true;
}
@Override
public boolean hasTileEntity() {
return true;
}
@Override
public TileEntity createNewTileEntity(World aWorld, int aMeta) {
return new GT_TileEntity_Ores();
}
@Override
@SideOnly(Side.CLIENT)
public ITexture[] getTexture(World world, BlockPos blockPos, IExtendedBlockState blockState, EnumFacing side) {
GT_TileEntity_Ores oreTile = (GT_TileEntity_Ores) world.getTileEntity(blockPos);
return oreTile.getTexture(this, (byte) side.getIndex());
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn) {
GT_TileEntity_Ores tileEntity_ores = (GT_TileEntity_Ores) world.getTileEntity(pos);
if (tileEntity_ores != null) {
tileEntity_ores.broadcastPacketIfNeeded();
}
}
@Override
public ImmutableList<BakedQuad> getIcon(EnumFacing aSide, int aDamage) {
return null;
}
@Override
@SideOnly(Side.CLIENT)
public ITexture[] getItemblockTexture(EntityPlayer player, ItemStack itemStack, EnumFacing side) {
int mMetaData = itemStack.getItemDamage();
Materials aMaterial = GregTech_API.sGeneratedMaterials[(mMetaData % 1000)];
if (aMaterial != null && mMetaData < 32000) {
return new ITexture[]{
getTextureSet()[(mMetaData / 1000) % 16],
aMaterial.mOreTextureSet[mMetaData / 16000 == 0 ? 0 : 1]};
public ImmutableList<BakedQuad> getIcon(IBlockAccess world, BlockPos pos, EnumFacing aSide, int metadata) {
try {
GT_TileEntity_Ores tileEntity_ores = (GT_TileEntity_Ores) world.getTileEntity(pos);
if (tileEntity_ores != null) {
IIconData iconData = mGeneratedIconData.get(tileEntity_ores.mMetaData);
if (iconData == null) {
return ImmutableList.of();
}
return iconData.getQuads(aSide);
}
//Dont know how and when it happens
} catch (ConcurrentModificationException dontknowhowandwhenithappens) {}
return ImmutableList.of();
}
@Override
public ImmutableList<BakedQuad> getIcon(EntityPlayer player, ItemStack itemStack, EnumFacing aSide) {
IIconData iconData = mGeneratedIconData.get(itemStack.getItemDamage());
if(iconData == null) {
return ImmutableList.of();
}
return new ITexture[]{
GT_Block_Ores.TEXTURES[0],
Materials._NULL.mOreTextureSet[0]};
return iconData.getQuads(aSide);
}
@Override
public void registerIcons(IconDataGetter quadGetter) {
System.out.println("Starting ore texture generation");
for(int i = 1; i < GregTech_API.sGeneratedMaterials.length; i++) {
Materials materials = GregTech_API.sGeneratedMaterials[i];
if (materials != null && (materials.mTypes & 0x8) != 0) {
IIconContainer[] materialTextures = materials.mIconSet.mTextures;
IIconContainer[] textureSet = getTextureSet();
for(int j = 0; j < textureSet.length; j++) {
IIconData normalIconData = quadGetter.makeIconData(
textureSet[j],
materialTextures[68],
materials.getColorInt());
IIconData smallIconData = quadGetter.makeIconData(
textureSet[j],
materialTextures[67],
materials.getColorInt());
mGeneratedIconData.put((i + 1000 * j), normalIconData);
mGeneratedIconData.put((i + 1000 * j + 16000), smallIconData);
}
}
}
System.out.println("Finished ore texture generation");
}
private static ThreadLocal<GT_TileEntity_Ores> STUPID_MOJANGS = new ThreadLocal<>();
@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
STUPID_MOJANGS.set((GT_TileEntity_Ores) worldIn.getTileEntity(pos));
super.breakBlock(worldIn, pos, state);
}
@Override
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
TileEntity tTileEntity = world.getTileEntity(pos);
if ((tTileEntity instanceof GT_TileEntity_Ores)) {
return ((GT_TileEntity_Ores) tTileEntity).getDrops(getDroppedBlock(), fortune);
GT_TileEntity_Ores tTileEntity = (GT_TileEntity_Ores) world.getTileEntity(pos);
if(tTileEntity == null && STUPID_MOJANGS.get() != null) {
tTileEntity = STUPID_MOJANGS.get();
STUPID_MOJANGS.remove();
}
if (tTileEntity != null) {
return tTileEntity.getDrops(getDroppedBlock(), fortune);
}
return Collections.EMPTY_LIST;
}
public abstract OrePrefixes[] getProcessingPrefix(); //Must have 17 entries; an entry can be null to disable automatic recipes.
public abstract OrePrefixes[] getProcessingPrefix(); //Must have 16 entries; an entry can be null to disable automatic recipes.
public abstract Block getDroppedBlock();
public abstract Materials[] getDroppedDusts(); //Must have 16 entries; can be null.
public abstract ITexture[] getTextureSet(); //Must have 16 entries.
public abstract IIconContainer[] getTextureSet(); //Must have 16 entries.
public abstract boolean isGravelAlike(int aOreMeta);
public boolean isValidForCreativeTab(int aOreMeta) {
return aOreMeta < 12000; //|| (metadata > 16000 && metadata < 25000);
}
@Override
public void getSubBlocks(Item aItem, CreativeTabs aTab, List<ItemStack> aList) {
int validMats = 0;
for (int i = 0; i < GregTech_API.sGeneratedMaterials.length; i++) {
Materials tMaterial = GregTech_API.sGeneratedMaterials[i];
if (tMaterial != null && (tMaterial.mTypes & 0x8) != 0) {
validMats++;
for(byte x = 0; x < 16; x++) {
if(isValidForCreativeTab(x)) {
aList.add(new ItemStack(aItem, 1, 1000 * x + i));
aList.add(new ItemStack(aItem, 1, 16000 + 1000 * x + i));
int metadata = 1000 * x + i;
if(isValidForCreativeTab(metadata)) {
aList.add(new ItemStack(aItem, 1, metadata));
}
metadata = 16000 + 1000 * x + i;
if(isValidForCreativeTab(metadata)) {
aList.add(new ItemStack(aItem, 1, metadata));
}
}
}
}
System.out.println(validMats + " valid ores");
}
public boolean isValidForCreativeTab(int baseBlockType) {
return baseBlockType <= 8;
}
@Override
@SideOnly(Side.CLIENT)

View file

@ -3,6 +3,7 @@ package gregtech.common.blocks;
import gregtech.api.GregTech_API;
import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.interfaces.IIconContainer;
import gregtech.api.interfaces.ITexture;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
@ -30,8 +31,13 @@ public class GT_Block_Ores_UB1 extends GT_Block_Ores_Abstract {
}
@Override
public ITexture[] getTextureSet() { //Must have 16 entries.
public IIconContainer[] getTextureSet() { //Must have 16 entries.
return GT_Block_Ores.TEXTURES;
//return new ITexture[]{new GT_CopiedBlockTexture(aUBBlock, 0, 0), new GT_CopiedBlockTexture(aUBBlock, 0, 1), new GT_CopiedBlockTexture(aUBBlock, 0, 2), new GT_CopiedBlockTexture(aUBBlock, 0, 3), new GT_CopiedBlockTexture(aUBBlock, 0, 4), new GT_CopiedBlockTexture(aUBBlock, 0, 5), new GT_CopiedBlockTexture(aUBBlock, 0, 6), new GT_CopiedBlockTexture(aUBBlock, 0, 7), new GT_CopiedBlockTexture(aUBBlock, 0, 0), new GT_CopiedBlockTexture(aUBBlock, 0, 1), new GT_CopiedBlockTexture(aUBBlock, 0, 2), new GT_CopiedBlockTexture(aUBBlock, 0, 3), new GT_CopiedBlockTexture(aUBBlock, 0, 4), new GT_CopiedBlockTexture(aUBBlock, 0, 5), new GT_CopiedBlockTexture(aUBBlock, 0, 6), new GT_CopiedBlockTexture(aUBBlock, 0, 7)};
}
@Override
public boolean isGravelAlike(int aOreMeta) {
return false;
}
}

View file

@ -3,6 +3,7 @@ package gregtech.common.blocks;
import gregtech.api.GregTech_API;
import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.interfaces.IIconContainer;
import gregtech.api.interfaces.ITexture;
import gregtech.api.objects.GT_CopiedBlockTexture;
import net.minecraft.block.Block;
@ -31,8 +32,13 @@ public class GT_Block_Ores_UB2 extends GT_Block_Ores_Abstract {
}
@Override
public ITexture[] getTextureSet() { //Must have 16 entries.
public IIconContainer[] getTextureSet() { //Must have 16 entries.
return GT_Block_Ores.TEXTURES;
//return new ITexture[]{new GT_CopiedBlockTexture(aUBBlock, 0, 0), new GT_CopiedBlockTexture(aUBBlock, 0, 1), new GT_CopiedBlockTexture(aUBBlock, 0, 2), new GT_CopiedBlockTexture(aUBBlock, 0, 3), new GT_CopiedBlockTexture(aUBBlock, 0, 4), new GT_CopiedBlockTexture(aUBBlock, 0, 5), new GT_CopiedBlockTexture(aUBBlock, 0, 6), new GT_CopiedBlockTexture(aUBBlock, 0, 7), new GT_CopiedBlockTexture(aUBBlock, 0, 0), new GT_CopiedBlockTexture(aUBBlock, 0, 1), new GT_CopiedBlockTexture(aUBBlock, 0, 2), new GT_CopiedBlockTexture(aUBBlock, 0, 3), new GT_CopiedBlockTexture(aUBBlock, 0, 4), new GT_CopiedBlockTexture(aUBBlock, 0, 5), new GT_CopiedBlockTexture(aUBBlock, 0, 6), new GT_CopiedBlockTexture(aUBBlock, 0, 7)};
}
@Override
public boolean isGravelAlike(int aOreMeta) {
return false;
}
}

View file

@ -1,5 +1,6 @@
package gregtech.common.blocks;
import gregtech.api.interfaces.IIconContainer;
import net.minecraftforge.fml.common.registry.GameRegistry;
import gregtech.api.GregTech_API;
import gregtech.api.enums.Materials;
@ -37,8 +38,13 @@ public class GT_Block_Ores_UB3 extends GT_Block_Ores_Abstract {
}
@Override
public ITexture[] getTextureSet() { //Must have 16 entries.
public IIconContainer[] getTextureSet() { //Must have 16 entries.
return GT_Block_Ores.TEXTURES;
//return new ITexture[]{new GT_CopiedBlockTexture(aUBBlock, 0, 0), new GT_CopiedBlockTexture(aUBBlock, 0, 1), new GT_CopiedBlockTexture(aUBBlock, 0, 2), new GT_CopiedBlockTexture(aUBBlock, 0, 3), new GT_CopiedBlockTexture(aUBBlock, 0, 4), new GT_CopiedBlockTexture(aUBBlock, 0, 5), new GT_CopiedBlockTexture(aUBBlock, 0, 6), new GT_CopiedBlockTexture(aUBBlock, 0, 7), new GT_CopiedBlockTexture(aUBBlock, 0, 0), new GT_CopiedBlockTexture(aUBBlock, 0, 1), new GT_CopiedBlockTexture(aUBBlock, 0, 2), new GT_CopiedBlockTexture(aUBBlock, 0, 3), new GT_CopiedBlockTexture(aUBBlock, 0, 4), new GT_CopiedBlockTexture(aUBBlock, 0, 5), new GT_CopiedBlockTexture(aUBBlock, 0, 6), new GT_CopiedBlockTexture(aUBBlock, 0, 7)};
}
@Override
public boolean isGravelAlike(int aOreMeta) {
return false;
}
}

View file

@ -1,5 +1,6 @@
package gregtech.common.blocks;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import gregtech.api.GregTech_API;
import gregtech.api.enums.ItemList;
@ -14,8 +15,12 @@ import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Utility;
import gregtech.common.render.blocks.IBlockIconProvider;
import gregtech.common.render.data.IIconData;
import gregtech.common.render.data.IIconRegister;
import gregtech.common.render.data.IconDataGetter;
import net.minecraft.block.SoundType;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
@ -33,7 +38,9 @@ import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.List;
public class GT_Block_Reinforced extends GT_Generic_Block implements IBlockIconProvider {
public class GT_Block_Reinforced extends GT_Generic_Block implements IBlockIconProvider, IIconRegister {
private IIconData COAL_BLOCK_ICON_DATA;
public GT_Block_Reinforced(String aName) {
super(GT_Item_Storage.class, aName, new GT_Material_Reinforced());
@ -80,28 +87,32 @@ public class GT_Block_Reinforced extends GT_Generic_Block implements IBlockIconP
@Override
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getIcon(EnumFacing aSide, int aMeta) {
public ImmutableList<BakedQuad> getIcon(EnumFacing aSide, int aMeta) {
if ((aMeta >= 0) && (aMeta < 16)) {
switch (aMeta) {
case 0:
return Textures.BlockIcons.BLOCK_BRONZEPREIN.getIcon();
return Textures.BlockIcons.BLOCK_BRONZEPREIN.getQuads(aSide);
case 1:
return Textures.BlockIcons.BLOCK_IRREIN.getIcon();
return Textures.BlockIcons.BLOCK_IRREIN.getQuads(aSide);
case 2:
return Textures.BlockIcons.BLOCK_PLASCRETE.getIcon();
return Textures.BlockIcons.BLOCK_PLASCRETE.getQuads(aSide);
case 3:
return Textures.BlockIcons.BLOCK_TSREIN.getIcon();
return Textures.BlockIcons.BLOCK_TSREIN.getQuads(aSide);
case 4:
return GT_Utility.getTexture("minecraft:blocks/coal_block");
return COAL_BLOCK_ICON_DATA.getQuads(aSide);
case 5:
return Textures.BlockIcons.COVER_WOOD_PLATE.getIcon();
return Textures.BlockIcons.COVER_WOOD_PLATE.getQuads(aSide);
case 6:
return GT_Utility.getTexture("minecraft:blocks/coal_block");
case 7:
return GT_Utility.getTexture("minecraft:blocks/coal_block");
return COAL_BLOCK_ICON_DATA.getQuads(aSide);
}
}
return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon();
return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getQuads(aSide);
}
@Override
public void registerIcons(IconDataGetter quadGetter) {
COAL_BLOCK_ICON_DATA = quadGetter.makeIconData("minecraft:blocks/coal_block");
}
@Override
@ -180,5 +191,4 @@ public class GT_Block_Reinforced extends GT_Generic_Block implements IBlockIconP
aList.add(new ItemStack(aItem, 1, i));
}
}
}

View file

@ -1,11 +1,13 @@
package gregtech.common.blocks;
import com.google.common.collect.ImmutableList;
import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.util.GT_LanguageManager;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.common.render.blocks.IBlockIconProvider;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
@ -65,11 +67,11 @@ public class GT_Block_Stones extends GT_Block_Stones_Abstract implements IBlockI
@Override
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getIcon(EnumFacing aSide, int aMeta) {
public ImmutableList<BakedQuad> getIcon(EnumFacing aSide, int aMeta) {
if ((aMeta >= 0) && (aMeta < 16)) {
return gregtech.api.enums.Textures.BlockIcons.STONES[aMeta].getIcon();
return gregtech.api.enums.Textures.BlockIcons.STONES[aMeta].getQuads(aSide);
}
return gregtech.api.enums.Textures.BlockIcons.STONES[0].getIcon();
return gregtech.api.enums.Textures.BlockIcons.STONES[0].getQuads(aSide);
}
}

View file

@ -1,5 +1,6 @@
package gregtech.common.blocks;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import gregtech.api.GregTech_API;
import gregtech.api.enums.*;
@ -12,6 +13,7 @@ import gregtech.common.render.blocks.IBlockIconProvider;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLiving;
@ -103,9 +105,9 @@ public abstract class GT_Block_Stones_Abstract extends GT_Generic_Block implemen
@Override
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getIcon(EnumFacing aSide, int aMeta) {
public ImmutableList<BakedQuad> getIcon(EnumFacing aSide, int aMeta) {
if ((aMeta >= 0) && (aMeta < 16)) {
return gregtech.api.enums.Textures.BlockIcons.GRANITES[aMeta].getIcon();
return gregtech.api.enums.Textures.BlockIcons.GRANITES[aMeta].getQuads(aSide);
}
return null;
}

View file

@ -41,7 +41,7 @@ public class GT_Item_Ores extends ItemBlock {
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState newState) {
short tDamage = (short) getDamage(stack);
if (tDamage > 0) {
if (!world.setBlockState(pos, block.getStateFromMeta(GT_TileEntity_Ores.getHarvestData(tDamage)))) {
if (!world.setBlockState(pos, block.getStateFromMeta(GT_TileEntity_Ores.getHarvestData((GT_Block_Ores_Abstract) block, tDamage)))) {
return false;
}
GT_TileEntity_Ores tTileEntity = (GT_TileEntity_Ores) world.getTileEntity(pos);

View file

@ -1,105 +0,0 @@
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 io.netty.buffer.ByteBuf;
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.common.FMLCommonHandler;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.ArrayList;
public class GT_Packet_Ores extends GT_Packet {
private ArrayList<OreInfo> ores = new ArrayList<>();
private static class OreInfo {
private int mX;
private int mZ;
private int mY;
private short mMetaData;
public OreInfo(BlockPos pos, short metadata) {
mX = pos.getX();
mY = pos.getY();
mZ = pos.getZ();
mMetaData = metadata;
}
private OreInfo() {}
public void encode(ByteBuf tOut) {
tOut.writeInt(this.mX);
tOut.writeShort(this.mY);
tOut.writeInt(this.mZ);
tOut.writeShort(this.mMetaData);
}
public void decode(ByteBuf buf) {
mX = buf.readInt();
mY = buf.readShort();
mZ = buf.readInt();
mMetaData = buf.readShort();
}
public static OreInfo decodeNew(ByteBuf buf) {
OreInfo oreInfo = new OreInfo();
oreInfo.decode(buf);
return oreInfo;
}
public void process(World aWorld) {
if (aWorld != null && mMetaData > 0) {
BlockPos blockPos = new BlockPos(this.mX, this.mY, this.mZ);
GT_TileEntity_Ores tileEntity_ores = (GT_TileEntity_Ores) aWorld.getTileEntity(blockPos);
if(tileEntity_ores != null) {
tileEntity_ores.mMetaData = mMetaData;
tileEntity_ores.causeChunkUpdate();
}
}
}
}
public GT_Packet_Ores() {}
public void addPos(GT_TileEntity_Ores tileEntity_ores) {
ores.add(new OreInfo(tileEntity_ores.getPos(), tileEntity_ores.mMetaData));
}
public boolean isEmpty() {
return ores.isEmpty();
}
@Override
public void encode(ByteBuf buf) {
buf.writeInt(ores.size());
for(int i = 0; i < ores.size(); i++) {
ores.get(i).encode(buf);
}
}
@Override
public void decode(ByteBuf buf) {
int size = buf.readInt();
for(int i = 0; i < size; i++) {
ores.add(OreInfo.decodeNew(buf));
}
}
@Override
public void process(World aWorld) {
for(OreInfo oreInfo : ores) {
oreInfo.process(aWorld);
}
}
}

View file

@ -4,47 +4,109 @@ import gregtech.GT_Mod;
import gregtech.api.GregTech_API;
import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.enums.TextureSet;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.ITexturedTileEntity;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Utility;
import gregtech.api.world.GT_Worldgen_Constants;
import net.minecraft.block.Block;
import net.minecraft.block.BlockStone;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.World;
import net.minecraft.world.chunk.storage.AnvilChunkLoader;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntity {
public class GT_TileEntity_Ores extends TileEntity {
private static final NBTTagCompound EMPTY_TAG = new NBTTagCompound();
static {
EMPTY_TAG.setInteger("y", -1);
}
public short mMetaData = 0;
public boolean mNatural = false;
private boolean mBlocked = true;
public static boolean isBlocked(World worldObj, BlockPos pos) {
return isOpaque(worldObj, pos.up()) &&
isOpaque(worldObj, pos.down()) &&
isOpaque(worldObj, pos.east()) &&
isOpaque(worldObj, pos.west()) &&
isOpaque(worldObj, pos.south()) &&
isOpaque(worldObj, pos.north());
}
public void updateBlocked() {
this.mBlocked = isBlocked(worldObj, getPos());
}
public boolean isBlocked() {
return mBlocked;
}
private static boolean isOpaque(World worldObj, BlockPos pos) {
return worldObj.getBlockState(pos).isOpaqueCube();
}
@Override
public NBTTagCompound getUpdateTag() {
//return writeToNBT(new NBTTagCompound());
updateBlocked();
if(mBlocked) {
return EMPTY_TAG;
}
NBTTagCompound tagCompound = new NBTTagCompound();
writeToNBT(tagCompound);
return tagCompound;
}
@Nullable
@Override
public SPacketUpdateTileEntity getUpdatePacket() {
return null;
}
public void broadcastPacketIfNeeded() {
updateBlocked();
if(!mBlocked) {
NBTTagCompound tagCompound = new NBTTagCompound();
writeNBTInternal(tagCompound);
SPacketUpdateTileEntity packet = new SPacketUpdateTileEntity(getPos(), 0, tagCompound);
if (packet != null) {
AxisAlignedBB box = new AxisAlignedBB(pos, pos).expand(256, 256, 256);
List<EntityPlayerMP> players = worldObj.getEntitiesWithinAABB(EntityPlayerMP.class, box);
for (EntityPlayerMP entityPlayer : players) {
entityPlayer.connection.sendPacket(packet);
}
}
}
}
@Override
public void handleUpdateTag(NBTTagCompound tag) {
readNBTInternal(tag);
//causeChunkUpdate();
}
@Override
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt) {
readNBTInternal(pkt.getNbtCompound());
causeChunkUpdate();
}
@Override
@ -72,119 +134,128 @@ public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntit
@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;
int minX = pos.getX();
int minY = pos.getY() - 1;
int minZ = pos.getZ();
int maxX = pos.getX();
int maxY = pos.getY() + 1;
int maxZ = pos.getZ();
Minecraft.getMinecraft().renderGlobal.markBlockRangeForRenderUpdate(minX, minY, minZ, maxX, maxY, maxZ);
}
public static byte getHarvestData(short aMetaData) {
public static int getHarvestData(GT_Block_Ores_Abstract aBlock, int aMetaData) {
Materials aMaterial = GregTech_API.sGeneratedMaterials[(aMetaData % 1000)];
byte tByte = aMaterial == null ? 0 : (byte) Math.max((aMetaData % 16000 / 1000 == 3) || (aMetaData % 16000 / 1000 == 4) ? 3 : 0, Math.min(7, aMaterial.mToolQuality - (aMetaData < 16000 ? 0 : 1)));
if(GT_Mod.gregtechproxy.mChangeHarvestLevels ){
tByte = aMaterial == null ? 0 : (byte) Math.max((aMetaData % 16000 / 1000 == 3) || (aMetaData % 16000 / 1000 == 4) ? GT_Mod.gregtechproxy.mGraniteHavestLevel : 0, Math.min(GT_Mod.gregtechproxy.mMaxHarvestLevel, GT_Mod.gregtechproxy.mHarvestLevel[aMaterial.mMetaItemSubID] - (aMetaData < 16000 ? 0 : 1)));
if(aMaterial != null) {
boolean gravelAlike = aBlock.isGravelAlike(aMetaData);
int toolQuality = Math.max(7, aMaterial.mToolQuality);
return gravelAlike ? 8 + toolQuality : toolQuality;
}
return tByte;
return 0;
}
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) {
if (!air) {
aY = Math.min(aWorld.getActualHeight(), Math.max(aY, 1));
}
BlockPos blockPos = new BlockPos(aX, aY, aZ);
IBlockState blockState = aWorld.getBlockState(blockPos);
Block tBlock = blockState.getBlock();
int BlockMeta = tBlock.getMetaFromState(blockState);
String BlockName = tBlock.getUnlocalizedName();
Block tOreBlock = GregTech_API.sBlockOres1;
GT_Block_Ores_Abstract tOreBlock = (GT_Block_Ores_Abstract) GregTech_API.sBlockOres1;
aMetaData += isSmallOre ? 16000 : 0;
if ((aMetaData > 0) && ((tBlock != Blocks.AIR) || air)) {
if (BlockName.equals("tile.igneousStone")) {
if (GregTech_API.sBlockOresUb1 != null) {
tOreBlock = GregTech_API.sBlockOresUb1;
aMetaData += (BlockMeta * 1000);
}
} else if (BlockName.equals("tile.metamorphicStone")) {
if (GregTech_API.sBlockOresUb2 != null) {
tOreBlock = GregTech_API.sBlockOresUb2;
aMetaData += (BlockMeta * 1000);
}
} else if (BlockName.equals("tile.sedimentaryStone")) {
if (GregTech_API.sBlockOresUb3 != null) {
tOreBlock = GregTech_API.sBlockOresUb3;
aMetaData += (BlockMeta * 1000);
}
} 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;
if(air && tBlock == Blocks.AIR) {
aMetaData += 0;
} else if(tBlock == Blocks.STONE) {
if(BlockMeta == 0) {
aMetaData += 0;
} else if(BlockMeta == 1) {
aMetaData += 7000;
} else if(BlockMeta == 3) {
aMetaData += 8000;
} else if(BlockMeta == 5) {
aMetaData += 9000;
} else {
return false;
}
aWorld.setBlockState(blockPos, tOreBlock.getStateFromMeta(getHarvestData((short) aMetaData)), 0);
TileEntity tTileEntity = aWorld.getTileEntity(blockPos);
if ((tTileEntity instanceof GT_TileEntity_Ores)) {
((GT_TileEntity_Ores) tTileEntity).mMetaData = ((short) aMetaData);
((GT_TileEntity_Ores) tTileEntity).mNatural = true;
}
return true;
} else if (tBlock == Blocks.NETHERRACK) {
aMetaData += 1000;
} else if (tBlock == Blocks.END_STONE) {
aMetaData += 2000;
} else if (tBlock == Blocks.SAND || tBlock == Blocks.SANDSTONE) {
aMetaData += 11000;
} else if (tBlock == Blocks.GRAVEL) {
aMetaData += 10000;
} 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;
} else {
return false;
}
return false;
aWorld.setBlockState(blockPos, tOreBlock.getStateFromMeta(getHarvestData(tOreBlock, aMetaData)));
GT_TileEntity_Ores tTileEntity = (GT_TileEntity_Ores) aWorld.getTileEntity(blockPos);
tTileEntity.mMetaData = ((short) aMetaData);
tTileEntity.mNatural = true;
return true;
}
public void overrideOreBlockMaterial(Block aOverridingStoneBlock, byte aOverridingStoneMeta) {
this.mMetaData = ((short) (int) (this.mMetaData % 1000L + this.mMetaData / 16000L * 16000L));
if (aOverridingStoneBlock.isReplaceableOreGen(worldObj.getBlockState(getPos()), this.worldObj, getPos(), state -> state.getBlock() == Blocks.NETHERRACK)) {
this.mMetaData = ((short) (this.mMetaData + 1000));
} else if (aOverridingStoneBlock.isReplaceableOreGen(worldObj.getBlockState(getPos()), this.worldObj, getPos(), state -> state.getBlock() == Blocks.END_STONE)) {
this.mMetaData = ((short) (this.mMetaData + 2000));
} else if (aOverridingStoneBlock.isReplaceableOreGen(worldObj.getBlockState(getPos()), this.worldObj, getPos(), state -> state.getBlock() == GregTech_API.sBlockGranites)) {
if (aOverridingStoneBlock == GregTech_API.sBlockGranites) {
if (aOverridingStoneMeta < 8) {
this.mMetaData = ((short) (this.mMetaData + 3000));
} else {
this.mMetaData = ((short) (this.mMetaData + 4000));
}
} else {
/*IBlockState blockState = worldObj.getBlockState(getPos());
GT_Block_Ores_Abstract tOresBlock = (GT_Block_Ores_Abstract) blockState.getBlock();
this.mMetaData = ((short) (int) (this.mMetaData % 1000L + this.mMetaData / 16000L * 16000L));
if (aOverridingStoneBlock.isReplaceableOreGen(blockState, this.worldObj, getPos(), state -> state.getBlock() == Blocks.NETHERRACK)) {
this.mMetaData = ((short) (this.mMetaData + 1000));
} else if (aOverridingStoneBlock.isReplaceableOreGen(blockState, this.worldObj, getPos(), state -> state.getBlock() == Blocks.END_STONE)) {
this.mMetaData = ((short) (this.mMetaData + 2000));
} else if (aOverridingStoneBlock.isReplaceableOreGen(blockState, this.worldObj, getPos(), state -> state.getBlock() == GregTech_API.sBlockGranites)) {
if (aOverridingStoneBlock == GregTech_API.sBlockGranites) {
if (aOverridingStoneMeta < 8) {
this.mMetaData = ((short) (this.mMetaData + 3000));
}
} else if (aOverridingStoneBlock.isReplaceableOreGen(worldObj.getBlockState(getPos()), this.worldObj, getPos(), GT_Worldgen_Constants.ANY)) {
if (aOverridingStoneBlock == GregTech_API.sBlockStones) {
if (aOverridingStoneMeta < 8) {
this.mMetaData = ((short) (this.mMetaData + 5000));
} else {
this.mMetaData = ((short) (this.mMetaData + 6000));
}
} else {
this.mMetaData = ((short) (this.mMetaData + 5000));
this.mMetaData = ((short) (this.mMetaData + 4000));
}
} else {
this.mMetaData = ((short) (this.mMetaData + 3000));
}
this.worldObj.setBlockState(getPos(), getBlockType().getStateFromMeta(getHarvestData(this.mMetaData)), 0);
} else {
if (aOverridingStoneBlock == GregTech_API.sBlockStones) {
if (aOverridingStoneMeta < 8) {
this.mMetaData = ((short) (this.mMetaData + 5000));
} else {
this.mMetaData = ((short) (this.mMetaData + 6000));
}
} else {
this.mMetaData = ((short) (this.mMetaData + 5000));
}
}
this.worldObj.setBlockState(
getPos(),
tOresBlock.getStateFromMeta(
getHarvestData(tOresBlock, this.mMetaData)), 0);*/
}
public void convertOreBlock(World aWorld, int aX, int aY, int aZ) {
/*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)));
TileEntity tTileEntity = aWorld.getTileEntity(new BlockPos(aX, aY, aZ));
if (tTileEntity instanceof GT_TileEntity_Ores) {
((GT_TileEntity_Ores) tTileEntity).mMetaData = aMeta;
}
}
}*/
public ArrayList<ItemStack> getDrops(Block aDroppedOre, int aFortune) {
ArrayList<ItemStack> rList = new ArrayList<>();
@ -261,20 +332,4 @@ public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntit
return rList;
}
@Override
public ITexture[] getTexture(Block aBlock, byte aSide) {
Materials aMaterial = GregTech_API.sGeneratedMaterials[(this.mMetaData % 1000)];
if ((aMaterial != null) && (this.mMetaData < 32000)) {
if (aBlock instanceof GT_Block_Ores_Abstract) {
GT_Block_Ores_Abstract oreBlock = (GT_Block_Ores_Abstract) aBlock;
return new ITexture[]{
oreBlock.getTextureSet()[((this.mMetaData / 1000) % 16)],
aMaterial.mOreTextureSet[this.mMetaData / 16000 == 0 ? 0 : 1]};
}
}
return new ITexture[]{
GT_Block_Ores.TEXTURES[0],
Materials._NULL.mOreTextureSet[0]};
}
}

View file

@ -1,16 +1,13 @@
package gregtech.common.items;
import gregtech.common.render.IIconRegister;
import net.minecraft.client.renderer.texture.TextureMap;
import gregtech.common.render.data.IIconRegister;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import gregtech.api.GregTech_API;
import gregtech.api.enums.ItemList;
import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.items.GT_Generic_Item;
import gregtech.api.util.GT_LanguageManager;
import gregtech.api.util.GT_Log;
import gregtech.api.util.GT_ModHandler;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;

View file

@ -11,7 +11,7 @@ import gregtech.api.enums.OrePrefixes;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Utility;
import gregtech.common.render.IItemColorMultiplier;
import gregtech.common.render.IIconRegister;
import gregtech.common.render.data.IIconRegister;
import gregtech.common.render.items.IItemIconProvider;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;

View file

@ -2,7 +2,7 @@ package gregtech.common.items.armor;
import gregtech.api.damagesources.GT_DamageSources;
import gregtech.api.enums.GT_Values;
import gregtech.common.render.IIconRegister;
import gregtech.common.render.data.IIconRegister;
import gregtech.common.render.items.IItemIconProvider;
import ic2.core.IC2;
import net.minecraft.client.Minecraft;

View file

@ -32,12 +32,6 @@ import java.util.List;
@SideOnly(Side.CLIENT)
public class GT_BlockRenderer {
/**
* Quads cache for standard icon provider blocks
* used for block and itemblock rendering
*/
public static HashMap<TextureAtlasSprite, HashMap<EnumFacing, ImmutableList<BakedQuad>>> quadsCache = new HashMap<>();
public static boolean shouldHook(IBlockState blockState) {
if(blockState.getBlock() instanceof IBlockIconProvider) {
return true;
@ -92,7 +86,7 @@ public class GT_BlockRenderer {
}
@Override
public TextureAtlasSprite getSideSprite(EnumFacing side, IBlockState state) {
public ImmutableList<BakedQuad> getSideSprite(EnumFacing side, IBlockState state) {
IBlockIconProvider provider = (IBlockIconProvider) block;
return provider.getIcon(holder, itemStack, side);
}
@ -102,7 +96,7 @@ public class GT_BlockRenderer {
private static class IconProviderModel extends AbstractIconProviderModel {
@Override
public TextureAtlasSprite getSideSprite(EnumFacing side, IBlockState blockState) {
public ImmutableList<BakedQuad> getSideSprite(EnumFacing side, IBlockState blockState) {
BlockPos pos = ((IExtendedBlockState) blockState).getValue(GT_Generic_Block.BLOCK_POS);
IBlockIconProvider provider = (IBlockIconProvider) blockState.getBlock();
return provider.getIcon(Minecraft.getMinecraft().theWorld, pos, side, blockState.getValue(GT_Generic_Block.METADATA));
@ -116,28 +110,19 @@ public class GT_BlockRenderer {
@Override
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) {
if(side != null) {
TextureAtlasSprite sideIcon = getSideSprite(side, state);
if (sideIcon != null) {
HashMap<EnumFacing, ImmutableList<BakedQuad>> quads = quadsCache.get(sideIcon);
if(quads == null) {
quads = new HashMap<>();
quadsCache.put(sideIcon, quads);
}
ImmutableList<BakedQuad> faceQuad = quads.get(side);
if(faceQuad == null) {
faceQuad = ImmutableList.of(RenderUtil.renderSide(sideIcon, side, 0.0F, 0xFFFFFF));
quads.put(side, faceQuad);
}
return faceQuad;
ImmutableList<BakedQuad> sideIcon = getSideSprite(side, state);
if(sideIcon != null) {
return sideIcon;
}
}
return Collections.EMPTY_LIST;
return ImmutableList.of();
}
public abstract TextureAtlasSprite getSideSprite(EnumFacing side, IBlockState blockState);
public abstract ImmutableList<BakedQuad> getSideSprite(EnumFacing side, IBlockState blockState);
}
//TODO null-side rendering
private static class TextureProviderModel extends AbstractModel {
@Override

View file

@ -6,6 +6,9 @@ import com.google.common.collect.ImmutableMap;
import gregtech.api.GregTech_API;
import gregtech.common.render.blocks.IBlockIconProvider;
import gregtech.common.render.blocks.IBlockTextureProvider;
import gregtech.common.render.data.DefaultDataGetter;
import gregtech.common.render.data.IIconRegister;
import gregtech.common.render.data.IconDataGetter;
import gregtech.common.render.items.IItemIconProvider;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
@ -13,6 +16,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemModelMesher;
import net.minecraft.client.renderer.block.model.*;
import net.minecraft.client.renderer.color.BlockColors;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.client.renderer.color.ItemColors;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
@ -46,6 +50,7 @@ public class GT_RenderDispatcher implements IBakedModel {
private static final ModelResourceLocation RESOURCE_LOCATION_BLOCK_TEXTURE = new ModelResourceLocation("gregtech", "IBlockTextureIconProvider");
private static final ModelResourceLocation RESOURCE_LOCATION_BLOCK_ICON = new ModelResourceLocation("gregtech", "IBlockIconProvider");
private static IconDataGetter DEFAULT_ICON_DATA_GETTER;
private ItemStack itemStack;
public GT_RenderDispatcher() {
@ -55,7 +60,7 @@ public class GT_RenderDispatcher implements IBakedModel {
@SubscribeEvent
public void onTextureMapStitch(TextureStitchEvent.Pre pre) {
DEFAULT_ICON_DATA_GETTER = new DefaultDataGetter(pre.getMap());
ItemColors itemColors = Minecraft.getMinecraft().getItemColors();
BlockColors blockColors = Minecraft.getMinecraft().getBlockColors();
System.out.println("Texture map stitch");
@ -84,7 +89,7 @@ public class GT_RenderDispatcher implements IBakedModel {
Item item = Item.REGISTRY.getObject(itemId);
if(item instanceof IIconRegister) {
((IIconRegister) item).registerIcons(pre.getMap());
((IIconRegister) item).registerIcons(DEFAULT_ICON_DATA_GETTER);
}
if(item instanceof IItemColorMultiplier) {
@ -93,9 +98,12 @@ public class GT_RenderDispatcher implements IBakedModel {
}
//we don't need color multiplier for standard blocks, only for ITexture-blocks
if(item instanceof ItemBlock && ((ItemBlock) item).block instanceof IBlockTextureProvider) {
//ITextures pass color as tint index
itemColors.registerItemColorHandler((stack, tintIndex) -> tintIndex, item);
if(item instanceof ItemBlock) {
ItemBlock itemBlock = (ItemBlock) item;
if(itemBlock.block instanceof IBlockTextureProvider || itemBlock.block instanceof IBlockIconProvider) {
//ITextures pass color as tint index
itemColors.registerItemColorHandler((stack, tintIndex) -> tintIndex, item);
}
}
}
@ -103,11 +111,10 @@ public class GT_RenderDispatcher implements IBakedModel {
Block block = Block.REGISTRY.getObject(blockId);
if(block instanceof IIconRegister) {
((IIconRegister) block).registerIcons(pre.getMap());
((IIconRegister) block).registerIcons(DEFAULT_ICON_DATA_GETTER);
}
//we don't need color multiplier for standard blocks, only for ITexture-blocks
if(block instanceof IBlockTextureProvider) {
if(block instanceof IBlockTextureProvider || block instanceof IBlockIconProvider) {
//ITextures pass color as tint index
blockColors.registerBlockColorHandler((state, worldIn, pos, tintIndex) -> tintIndex, block);
}
@ -117,6 +124,18 @@ public class GT_RenderDispatcher implements IBakedModel {
System.out.println("GT_Mod: Finished Icon Load Phase");
}
@SubscribeEvent
public void onTextureMapStitchFinish(TextureStitchEvent.Post post) {
for(Runnable runnable : GregTech_API.sAfterGTIconload) {
try {
runnable.run();
} catch (Exception err) {
System.out.println("Failed to call after load on " + runnable);
err.printStackTrace();
}
}
}
@SubscribeEvent
public void onModelsBake(ModelBakeEvent bakeEvent) {
System.out.println("Models bake");

View file

@ -1,5 +1,8 @@
package gregtech.common.render.blocks;
import com.google.common.collect.ImmutableList;
import gregtech.common.render.data.IIconRegister;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@ -14,22 +17,22 @@ import net.minecraftforge.fml.relauncher.SideOnly;
* For simple behavior just implement on block class and override {@link IBlockIconProvider#getIcon(EnumFacing, int)}
* If you care about {@link BlockPos} or @{@link ItemStack}, you can override getIcon based on them
*
* @see gregtech.common.render.IIconRegister
* @see IIconRegister
* @see TextureAtlasSprite
* @see IBlockIconProvider
*/
public interface IBlockIconProvider {
@SideOnly(Side.CLIENT)
TextureAtlasSprite getIcon(EnumFacing aSide, int aDamage);
ImmutableList<BakedQuad> getIcon(EnumFacing aSide, int aDamage);
@SideOnly(Side.CLIENT)
default TextureAtlasSprite getIcon(IBlockAccess world, BlockPos pos, EnumFacing aSide, int metadata) {
default ImmutableList<BakedQuad> getIcon(IBlockAccess world, BlockPos pos, EnumFacing aSide, int metadata) {
return getIcon(aSide, metadata);
}
@SideOnly(Side.CLIENT)
default TextureAtlasSprite getIcon(EntityPlayer player, ItemStack itemStack, EnumFacing aSide) {
default ImmutableList<BakedQuad> getIcon(EntityPlayer player, ItemStack itemStack, EnumFacing aSide) {
return getIcon(aSide, itemStack.getItemDamage());
}

View file

@ -1,6 +1,7 @@
package gregtech.common.render.blocks;
import gregtech.api.interfaces.ITexture;
import gregtech.common.render.data.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
@ -15,7 +16,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
* have custom rendering behaviour defined in {@link ITexture}s
*
* @see ITexture
* @see gregtech.common.render.IIconRegister
* @see IIconRegister
* @see IBlockIconProvider
*/
public interface IBlockTextureProvider {

View file

@ -0,0 +1,42 @@
package gregtech.common.render.data;
import gregtech.api.interfaces.IIconContainer;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.util.ResourceLocation;
public class DefaultDataGetter implements IconDataGetter {
private TextureMap textureMap;
public DefaultDataGetter(TextureMap textureMap) {
this.textureMap = textureMap;
}
@Override
public IIconData makeIconData(Object... iconPaths) {
//register sprites and replacing strings and resource locations with them
Object[] parsedData = new Object[iconPaths.length];
for(int i = 0; i < iconPaths.length; i++) {
Object object = iconPaths[i];
if(object instanceof String) {
String path = (String) object;
TextureAtlasSprite atlasSprite = textureMap.registerSprite(new ResourceLocation(path));
parsedData[i] = atlasSprite;
} else if(object instanceof ResourceLocation) {
ResourceLocation path = (ResourceLocation) object;
TextureAtlasSprite atlasSprite = textureMap.registerSprite(path);
parsedData[i] = atlasSprite;
} else {
parsedData[i] = object;
}
}
return new DefaultQuadData(parsedData);
}
@Override
public TextureMap getMap() {
return textureMap;
}
}

View file

@ -0,0 +1,55 @@
package gregtech.common.render.data;
import com.google.common.collect.ImmutableList;
import gregtech.api.GregTech_API;
import gregtech.api.interfaces.IIconContainer;
import gregtech.common.render.RenderUtil;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import java.util.EnumMap;
public class DefaultQuadData implements IIconData, Runnable {
private EnumMap<EnumFacing, ImmutableList<BakedQuad>> quads = new EnumMap<>(EnumFacing.class);
private Object[] iconData;
public DefaultQuadData(Object... iconData) {
this.iconData = iconData;
GregTech_API.sAfterGTIconload.add(this);
}
@Override
public ImmutableList<BakedQuad> getQuads(EnumFacing side) {
return quads.get(side);
}
@Override
public void run() {
for (EnumFacing enumFacing : EnumFacing.VALUES) {
ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
float offset = 0f;
for (int i = 0; i < iconData.length; i++) {
if (iconData[i] instanceof TextureAtlasSprite || iconData[i] instanceof IIconContainer) {
TextureAtlasSprite sprite = iconData[i] instanceof TextureAtlasSprite ?
(TextureAtlasSprite) iconData[i] :
((IIconContainer) iconData[i]).getIcon();
int color = 0x0ffffff;
if(iconData.length > i + 1 && iconData[i + 1] instanceof Integer) {
color = (Integer) iconData[i + 1]; i++;
}
builder.add(RenderUtil.renderSide(sprite, enumFacing, offset, color));
offset += 0.001f;
} else {
String typeTag = iconData[i] == null ? "null" : iconData[i].getClass().getName();
throw new IllegalArgumentException("Illegal type at index " + i + ": " + typeTag);
}
}
quads.put(enumFacing, builder.build());
}
}
}

View file

@ -0,0 +1,12 @@
package gregtech.common.render.data;
import com.google.common.collect.ImmutableList;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.EnumFacing;
public interface IIconData {
ImmutableList<BakedQuad> getQuads(EnumFacing side);
}

View file

@ -1,4 +1,4 @@
package gregtech.common.render;
package gregtech.common.render.data;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraftforge.fml.relauncher.Side;
@ -17,6 +17,11 @@ import net.minecraftforge.fml.relauncher.SideOnly;
public interface IIconRegister {
@SideOnly(Side.CLIENT)
void registerIcons(TextureMap textureMap);
default void registerIcons(IconDataGetter quadGetter) {
registerIcons(quadGetter.getMap());
}
@Deprecated //TODO split to item register and block register
default void registerIcons(TextureMap textureMap) {}
}

View file

@ -0,0 +1,10 @@
package gregtech.common.render.data;
import net.minecraft.client.renderer.texture.TextureMap;
public interface IconDataGetter {
IIconData makeIconData(Object... iconData);
TextureMap getMap();
}

View file

@ -1,5 +1,6 @@
package gregtech.common.render.items;
import gregtech.common.render.data.IIconRegister;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
@ -12,7 +13,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
* If you need multilayer, you can override {@link IItemIconProvider#getRenderPasses(ItemStack)}
* If you need handheld item, return true in {@link IItemIconProvider#isHandheld(ItemStack)}
*
* @see gregtech.common.render.IIconRegister
* @see IIconRegister
* @see TextureAtlasSprite
* @see IItemIconContainerProvider
*/