Big bunch of bugfixes.

This commit is contained in:
Dragon2488 2016-12-24 04:34:30 +07:00
parent f531833a27
commit af2bd443a0
690 changed files with 378 additions and 360 deletions

View file

@ -101,6 +101,8 @@ dependencies {
//provided name: 'IC2NuclearControl', version: config.nc.version, ext: 'jar'
}
jar.exclude("**.bat")
compileJava {
sourceCompatibility = "1.8"
targetCompatibility = "1.8"

View file

@ -1,7 +1,7 @@
minecraft.version=1.10.2
forge.version=12.18.1.2079
gt.version=5.10.22
gt.version=5.10.23
forestry.version=5.2.7.220
ic2.version=2.6.99-ex110

View file

@ -197,7 +197,6 @@ public class GT_Mod implements IGT_Mod {
GregTech_API.sTimber = tMainConfig.get("general", "timber_axe", false).getBoolean(false);
GregTech_API.sDrinksAlwaysDrinkable = tMainConfig.get("general", "drinks_always_drinkable", false).getBoolean(false);
GregTech_API.sDoShowAllItemsInCreative = tMainConfig.get("general", "show_all_metaitems_in_creative_and_NEI", false).getBoolean(false);
GregTech_API.sMultiThreadedSounds = tMainConfig.get("general", "sound_multi_threading", false).getBoolean(false);
for (Dyes tDye : Dyes.values()) {
if ((tDye != Dyes._NULL) && (tDye.mIndex < 0)) {
tDye.mRGBa[0] = ((short) Math.min(255, Math.max(0, GregTech_API.sClientDataFile.get("ColorModulation." + tDye, "R", tDye.mRGBa[0]))));

View file

@ -5,6 +5,7 @@ import com.google.common.collect.HashBiMap;
import gregtech.common.blocks.GT_Block_Machines;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.init.SoundEvents;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import gregtech.api.enums.Materials;
@ -200,7 +201,7 @@ public class GregTech_API {
/**
* Getting assigned by the Config
*/
public static boolean sTimber = false, sDrinksAlwaysDrinkable = false, sMultiThreadedSounds = false, sDoShowAllItemsInCreative = false, sColoredGUI = true, sConstantEnergy = true, sMachineExplosions = true, sMachineFlammable = true, sMachineNonWrenchExplosions = true, sMachineRainExplosions = true, sMachineThunderExplosions = true, sMachineFireExplosions = true, sMachineWireFire = true;
public static boolean sTimber = false, sDrinksAlwaysDrinkable = false, sDoShowAllItemsInCreative = false, sColoredGUI = true, sConstantEnergy = true, sMachineExplosions = true, sMachineFlammable = true, sMachineNonWrenchExplosions = true, sMachineRainExplosions = true, sMachineThunderExplosions = true, sMachineFireExplosions = true, sMachineWireFire = true;
public static boolean mOutputRF = false;
public static boolean mInputRF = false;
public static boolean meIOLoaded = false;
@ -224,13 +225,13 @@ public class GregTech_API {
sDimensionalList.add(0);
sDimensionalList.add(1);
sSoundList.put(0, "random.break");
sSoundList.put(1, "random.anvil_use");
sSoundList.put(2, "random.anvil_break");
sSoundList.put(3, "random.click");
sSoundList.put(4, "random.fizz");
sSoundList.put(5, "random.explode");
sSoundList.put(6, "fire.ignite");
sSoundList.put(0, SoundEvents.ENTITY_ARROW_SHOOT.getSoundName().toString());
sSoundList.put(1, SoundEvents.BLOCK_ANVIL_USE.getSoundName().toString());
sSoundList.put(2, SoundEvents.BLOCK_ANVIL_BREAK.getSoundName().toString());
sSoundList.put(3, SoundEvents.BLOCK_STONE_BUTTON_CLICK_ON.getSoundName().toString());
sSoundList.put(4, SoundEvents.ENTITY_ITEM_BREAK.getSoundName().toString());
sSoundList.put(5, SoundEvents.ENTITY_GENERIC_EXPLODE.getSoundName().toString());
sSoundList.put(6, SoundEvents.ITEM_FIRECHARGE_USE.getSoundName().toString());
sSoundList.put(100, MOD_ID_IC2.toLowerCase() + ":" + "tools.Wrench");
sSoundList.put(101, MOD_ID_IC2.toLowerCase() + ":" + "tools.RubberTrampoline");
@ -370,7 +371,6 @@ public class GregTech_API {
public static void registerCover(ItemStack aStack, ITexture aCover, GT_CoverBehavior aBehavior) {
GT_ItemStack stack = new GT_ItemStack(aStack);
int coverId = stack.hashCode();
System.out.println("Cover " + aStack + " with id " + coverId);
sCoverItems.put(stack, coverId);
System.out.println();
sCovers.put(coverId, aCover == null || !aCover.isValidTexture() ? Textures.BlockIcons.ERROR_RENDERING[0] : aCover);

View file

@ -196,8 +196,7 @@ public enum Materials implements IColorModulationContainer, ISubTagContainer {
Amber ( 514, TextureSet.SET_RUBY , 4.0F, 128, 2, 1 |4|8 |64 , 255, 128, 0, 127, "Amber" , 5, 3, -1, 0, false, true, 1, 1, 1, Dyes.dyeOrange , Arrays.asList(new TC_AspectStack(TC_Aspects.VINCULUM, 2), new TC_AspectStack(TC_Aspects.VITREUS, 1))),
Ammonium ( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1 , 255, 255, 255, 0, "Ammonium" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ),
Amordrine ( -1, TextureSet.SET_NONE , 6.0F, 64, 2, 1|2 |8|16 |64 , 255, 255, 255, 0, "Amordrine" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ),
Andesite ( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1 |8 , 255, 255, 255, 0, "Andesite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ),
Angmallen ( 958, TextureSet.SET_METALLIC , 10.0F, 128, 2, 1|2 |8|16 |64 , 215, 225, 138, 0, "Angmallen" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ),
Angmallen ( 958, TextureSet.SET_METALLIC , 10.0F, 128, 2, 1|2 |8|16 |64 , 215, 225, 138, 0, "Angmallen" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ),
Ardite ( -1, TextureSet.SET_NONE , 6.0F, 64, 2, 1|2 |8 |64 , 255, 0, 0, 0, "Ardite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeYellow ),
Aredrite ( -1, TextureSet.SET_NONE , 6.0F, 64, 2, 1|2 |8 |64 , 255, 0, 0, 0, "Aredrite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeYellow ),
Atlarus ( 965, TextureSet.SET_METALLIC , 6.0F, 64, 2, 1|2 |8 |64 , 255, 255, 255, 0, "Atlarus" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL ),
@ -365,7 +364,7 @@ public enum Materials implements IColorModulationContainer, ISubTagContainer {
* Not possible to determine exact Components
*/
Antimatter ( -1, TextureSet.SET_NONE , 1.0F, 0, 0, 0 , 255, 255, 255, 0, "Antimatter" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyePink , Arrays.asList(new TC_AspectStack(TC_Aspects.POTENTIA, 9), new TC_AspectStack(TC_Aspects.PERFODIO, 8))),
BioFuel ( 705, TextureSet.SET_FLUID , 1.0F, 0, 0, 16 , 255, 128, 0, 0, "Biofuel" , 0, 6, -1, 0, false, false, 1, 1, 1, Dyes.dyeOrange ),
BioFuel ( 705, TextureSet.SET_FLUID , 1.0F, 0, 0, 16 , 255, 128, 0, 0, "Biofuel" , 0, 6, -1, 0, false, false, 1, 1, 1, Dyes.dyeOrange ),
Biomass ( 704, TextureSet.SET_FLUID , 1.0F, 0, 0, 16 , 0, 255, 0, 0, "Biomass" , 3, 8, -1, 0, false, false, 1, 1, 1, Dyes.dyeGreen ),
Cheese ( 894, TextureSet.SET_FINE , 1.0F, 0, 0, 1 |8 , 255, 255, 0, 0, "Cheese" , 0, 0, 320, 0, false, false, 1, 1, 1, Dyes.dyeYellow ),
Chili ( 895, TextureSet.SET_FINE , 1.0F, 0, 0, 1 , 200, 0, 0, 0, "Chili" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeRed ),
@ -600,7 +599,9 @@ public enum Materials implements IColorModulationContainer, ISubTagContainer {
CobaltBrass ( 343, TextureSet.SET_METALLIC , 8.0F, 256, 2, 1|2 |64|128 , 180, 180, 160, 0, "Cobalt Brass" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeOrange , 2, Arrays.asList(new MaterialStack(Brass, 7), new MaterialStack(Aluminium, 1), new MaterialStack(Cobalt, 1))),
Phosphorus ( 534, TextureSet.SET_FLINT , 1.0F, 0, 2, 1 |4|8|16 , 255, 255, 0, 0, "Phosphorus" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeYellow , 2, Arrays.asList(new MaterialStack(Calcium, 3), new MaterialStack(Phosphate, 2))),
Basalt ( 844, TextureSet.SET_ROUGH , 1.0F, 0, 1, 1 , 30, 20, 20, 0, "Basalt" , 0, 0, -1, 0, false, false, 2, 1, 1, Dyes.dyeBlack , 2, Arrays.asList(new MaterialStack(Olivine, 1), new MaterialStack(Calcite, 3), new MaterialStack(Flint, 8), new MaterialStack(DarkAsh, 4)), Arrays.asList(new TC_AspectStack(TC_Aspects.TENEBRAE, 1))),
GarnetRed ( 527, TextureSet.SET_RUBY , 7.0F, 128, 2, 1 |4|8 |64 , 200, 80, 80, 127, "Red Garnet" , 0, 0, -1, 0, false, true, 4, 1, 1, Dyes.dyeRed , 2, Arrays.asList(new MaterialStack(Pyrope, 3), new MaterialStack(Almandine, 5), new MaterialStack(Spessartine, 8)), Arrays.asList(new TC_AspectStack(TC_Aspects.VITREUS, 3))),
Andesite ( 298, TextureSet.SET_ROUGH , 4.0F, 32, 1, 1 |64|128 , 190, 190, 190, 0, "Andesite" , 0, 0, -1, 0, false, false, 0, 1, 1, Dyes.dyeLightGray , 1, Arrays.asList(new MaterialStack(Aluminium, 4), new MaterialStack(SiliconDioxide, 12), new MaterialStack(Magnesium, 1), new MaterialStack(Calcium, 2), new MaterialStack(Iron, 2), new MaterialStack(Sodium, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.TERRA, 1))),
Diorite ( 297, TextureSet.SET_ROUGH , 4.0F, 32, 1, 1 |64|128 , 255, 255, 255, 0, "Diorite" , 0, 0, -1, 0, false, false, 0, 1, 1, Dyes.dyeWhite , 1, Arrays.asList(new MaterialStack(Aluminium, 3), new MaterialStack(SiliconDioxide, 10), new MaterialStack(Magnesium, 2), new MaterialStack(Calcium, 3), new MaterialStack(Iron, 2), new MaterialStack(Sodium, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.TERRA, 1))),
GarnetRed ( 527, TextureSet.SET_RUBY , 7.0F, 128, 2, 1 |4|8 |64 , 200, 80, 80, 127, "Red Garnet" , 0, 0, -1, 0, false, true, 4, 1, 1, Dyes.dyeRed , 2, Arrays.asList(new MaterialStack(Pyrope, 3), new MaterialStack(Almandine, 5), new MaterialStack(Spessartine, 8)), Arrays.asList(new TC_AspectStack(TC_Aspects.VITREUS, 3))),
GarnetYellow ( 528, TextureSet.SET_RUBY , 7.0F, 128, 2, 1 |4|8 |64 , 200, 200, 80, 127, "Yellow Garnet" , 0, 0, -1, 0, false, true, 4, 1, 1, Dyes.dyeYellow , 2, Arrays.asList(new MaterialStack(Andradite, 5), new MaterialStack(Grossular, 8), new MaterialStack(Uvarovite, 3)), Arrays.asList(new TC_AspectStack(TC_Aspects.VITREUS, 3))),
Marble ( 845, TextureSet.SET_FINE , 1.0F, 0, 1, 1 , 200, 200, 200, 0, "Marble" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeWhite , 2, Arrays.asList(new MaterialStack(Magnesium, 1), new MaterialStack(Calcite, 7)), Arrays.asList(new TC_AspectStack(TC_Aspects.PERFODIO, 1))),
Sugar ( 803, TextureSet.SET_FINE , 1.0F, 0, 1, 1 , 250, 250, 250, 0, "Sugar" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeWhite , 1, Arrays.asList(new MaterialStack(Carbon, 2), new MaterialStack(Water, 5), new MaterialStack(Oxygen, 25)), Arrays.asList(new TC_AspectStack(TC_Aspects.HERBA, 1), new TC_AspectStack(TC_Aspects.AQUA, 1), new TC_AspectStack(TC_Aspects.AER, 1))),

View file

@ -1,7 +1,11 @@
package gregtech.api.enums;
import gregtech.api.GregTech_API;
import gregtech.api.interfaces.IIconContainer;
import gregtech.api.objects.RegIconContainer;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
/**
* For ore generation
@ -33,4 +37,30 @@ public enum StoneTypes {
this.stoneMaterial = stoneMaterial;
}
public static StoneTypes computeStoneType(IBlockState blockState) {
Block block = blockState.getBlock();
int metadata = block.getMetaFromState(blockState);
StoneTypes variantId = StoneTypes.STONE;
if(block == Blocks.STONE) {
variantId = StoneTypes.STONE;
} else if(block == GregTech_API.sBlockGranites) {
if(metadata == 0)
variantId = StoneTypes.BLACK_GRANITE;
else if(metadata == 8)
variantId = StoneTypes.RED_GRANITE;
} else if(block == GregTech_API.sBlockStones) {
if(metadata == 0)
variantId = StoneTypes.MARBLE;
else if(metadata == 8)
variantId = StoneTypes.BASALT;
} else if(block == Blocks.NETHERRACK) {
variantId = StoneTypes.NETHERRACK;
} else if(block == Blocks.END_STONE) {
variantId = StoneTypes.ENDSTONE;
}
return variantId;
}
}

View file

@ -30,9 +30,9 @@ public interface ITexture {
public boolean isValidTexture();
static int color(short[] mRGBa, boolean mAllowAlpha) {
int r = (int) (mRGBa[0] * 0.6F);
int g = (int) (mRGBa[1] * 0.6F);
int b = (int) (mRGBa[2] * 0.6F);
int r = (int) (mRGBa[0]);
int g = (int) (mRGBa[1]);
int b = (int) (mRGBa[2]);
int a = mAllowAlpha ? 255 - mRGBa[3] : 255;
return (r << 16) | (g << 8) | (b) | (a << 24);
}

View file

@ -1,8 +0,0 @@
package gregtech.api.interfaces.internal;
/**
* A simple compound Interface for generic BuildCraft Code.
*/
public interface IBCTileEntity /*extends IPowerReceptor*/ {
//
}

View file

@ -1,13 +0,0 @@
package gregtech.api.interfaces.internal;
import gregtech.api.interfaces.tileentity.IHasWorldObjectAndCoords;
import ic2.api.energy.tile.IEnergySink;
import ic2.api.energy.tile.IEnergySource;
import ic2.api.tile.IEnergyStorage;
/**
* A simple compound Interface for generic EnergyTileEntities. I don't want to have imports of the IC2-API in my main-code
*/
public interface IIC2TileEntity extends IEnergyStorage, IEnergySink, IEnergySource, IHasWorldObjectAndCoords {
//
}

View file

@ -1,6 +0,0 @@
package gregtech.api.interfaces.internal;
public interface IUETileEntity /*extends IElectrical*/ {
//
}

View file

@ -1,10 +1,16 @@
package gregtech.api.interfaces.tileentity;
import cofh.api.energy.IEnergyReceiver;
import gregtech.api.GregTech_API;
import gregtech.api.util.GT_Utility;
import ic2.api.energy.tile.IEnergyEmitter;
import ic2.api.energy.tile.IEnergySink;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import static gregtech.api.enums.GT_Values.V;
/**
* Interface for getting Connected to the GregTech Energy Network.
@ -55,35 +61,33 @@ public interface IEnergyConnected extends IColoredTileEntity, IHasWorldObjectAnd
if (tColor >= 0 && tColor != aEmitter.getColorization()) continue;
}
rUsedAmperes += ((IEnergyConnected) tTileEntity).injectEnergyUnits(j, aVoltage, aAmperage - rUsedAmperes);
// } else if (tTileEntity instanceof IEnergySink) {
// if (((IEnergySink)tTileEntity).acceptsEnergyFrom((TileEntity)aEmitter, EnumFacing.getOrientation(j))) {
// while (aAmperage > rUsedAmperes && ((IEnergySink)tTileEntity).demandedEnergyUnits() > 0 && ((IEnergySink)tTileEntity).injectEnergyUnits(EnumFacing.getOrientation(j), aVoltage) < aVoltage) rUsedAmperes++;
// }
} else if (tTileEntity instanceof IEnergySink) {
if (((IEnergySink) tTileEntity).acceptsEnergyFrom(aEmitter, EnumFacing.VALUES[j])) {
while (aAmperage > rUsedAmperes && ((IEnergySink) tTileEntity).getDemandedEnergy() > 0 && ((IEnergySink) tTileEntity).injectEnergy(EnumFacing.VALUES[j], aVoltage, aVoltage) < aVoltage)
rUsedAmperes++;
}
} /*else if (GregTech_API.mOutputRF && tTileEntity instanceof IEnergyReceiver) {
EnumFacing tDirection = EnumFacing.getOrientation(i).getOpposite();
} else if (tTileEntity instanceof IEnergyReceiver) {
System.out.println("Receive");
EnumFacing tDirection = EnumFacing.VALUES[i].getOpposite();
int rfOut = (int) (aVoltage * GregTech_API.mEUtoRF / 100);
if (((IEnergyReceiver) tTileEntity).receiveEnergy(tDirection, rfOut, true) == rfOut) {
((IEnergyReceiver) tTileEntity).receiveEnergy(tDirection, rfOut, false);
rUsedAmperes++;
}
System.out.println(rUsedAmperes);
if (GregTech_API.mRFExplosions && GregTech_API.sMachineExplosions && ((IEnergyReceiver) tTileEntity).getMaxEnergyStored(tDirection) < rfOut * 600) {
if (rfOut > 32 * GregTech_API.mEUtoRF / 100) {
int aExplosionPower = rfOut;
float tStrength = aExplosionPower < V[0] ? 1.0F : aExplosionPower < V[1] ? 2.0F : aExplosionPower < V[2] ? 3.0F : aExplosionPower < V[3] ? 4.0F : aExplosionPower < V[4] ? 5.0F : aExplosionPower < V[4] * 2 ? 6.0F : aExplosionPower < V[5] ? 7.0F : aExplosionPower < V[6] ? 8.0F : aExplosionPower < V[7] ? 9.0F : 10.0F;
int tX = tTileEntity.xCoord, tY = tTileEntity.yCoord, tZ = tTileEntity.zCoord;
World tWorld = tTileEntity.getWorldObj();
GT_Utility.sendSoundToPlayers(tWorld, GregTech_API.sSoundList.get(209), 1.0F, -1, tX, tY, tZ);
tWorld.setBlock(tX, tY, tZ, Blocks.air);
BlockPos position = tTileEntity.getPos();
World tWorld = tTileEntity.getWorld();
GT_Utility.sendSoundToPlayers(tWorld, GregTech_API.sSoundList.get(209), 1.0F, -1, position.getX(), position.getY(), position.getZ());
tWorld.setBlockToAir(position);
if (GregTech_API.sMachineExplosions)
tWorld.createExplosion(null, tX + 0.5, tY + 0.5, tZ + 0.5, tStrength, true);
tWorld.createExplosion(null, position.getX() + 0.5, position.getY() + 0.5, position.getZ() + 0.5, tStrength, true);
}
}
}*/
}
}
return rUsedAmperes;
}

View file

@ -1,31 +0,0 @@
package gregtech.api.interfaces.tileentity;
/**
* This File has just internal Information about the Fibre Redstone State of a TileEntity
*/
public interface IFibreConnected extends IColoredTileEntity, IHasWorldObjectAndCoords {
/**
* If this Blocks accepts Fibre from this Side
*/
public void inputFibreFrom(byte aSide);
/**
* If this Blocks emits Fibre to this Side
*/
public void outputsFibreTo(byte aSide);
/**
* Sets the Signal this Blocks outputs to this Fibre Color
*/
public void setFibreOutput(byte aSide, byte aColor, byte aRedstoneStrength);
/**
* Gets the Signal this Blocks outputs to this Fibre Color
*/
public byte getFibreOutput(byte aSide, byte aColor);
/**
* Gets the Signal this Blocks receives from this Fibre Color
*/
public byte getFibreInput(byte aSide, byte aColor);
}

View file

@ -15,7 +15,7 @@ public interface ITurnable {
/**
* Set the block's facing
*
* @param facing facing to set the block to
* @param aSide facing to set the block to
*/
void setFrontFacing(byte aSide);

View file

@ -13,10 +13,10 @@ import gregtech.api.util.GT_Config;
import gregtech.api.util.GT_LanguageManager;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Utility;
import ic2.api.item.IElectricItem;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.Item;
@ -29,6 +29,7 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nullable;
import java.awt.*;
import java.util.*;
import java.util.List;
@ -47,8 +48,9 @@ import static gregtech.api.enums.GT_Values.*;
* <p/>
* These Items can also have special RightClick abilities, electric Charge or even be set to become a Food alike Item.
*/
public abstract class GT_MetaGenerated_Item extends GT_MetaBase_Item implements IElectricItem {
public abstract class GT_MetaGenerated_Item extends GT_MetaBase_Item {
/**
public abstract class GT_MetaGenerated_Item extends GT_MetaB
* All instances of this Item Class are listed here.
* This gets used to register the Renderer to all Items of this Type, if useStandardMetaItemRenderer() returns true.
* <p/>
@ -302,17 +304,19 @@ public abstract class GT_MetaGenerated_Item extends GT_MetaBase_Item implements
return tStat == null ? EnumAction.NONE : tStat.getFoodAction(this, aStack);
}
/*@Override
public final ItemStack onEaten(ItemStack aStack, World aWorld, EntityPlayer aPlayer, EnumHand hand) {
IFoodStat tStat = mFoodStats.get((short) getDamage(aStack));
if (tStat != null) {
aPlayer.getFoodStats().addStats(tStat.getFoodLevel(this, aStack, aPlayer), tStat.getSaturation(this, aStack, aPlayer));
tStat.onEaten(this, aStack, aPlayer);
@Nullable
public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityLivingBase entityLiving) {
if (entityLiving instanceof EntityPlayer) {
EntityPlayer entityplayer = (EntityPlayer) entityLiving;
IFoodStat tStat = mFoodStats.get((short) getDamage(stack));
if (tStat != null) {
--stack.stackSize;
entityplayer.getFoodStats().addStats(tStat.getFoodLevel(this, stack, entityplayer), tStat.getSaturation(this, stack, entityplayer));
tStat.onEaten(this, stack, entityplayer);
}
}
return aStack;
}*/
return stack;
}
@Override
@SideOnly(Side.CLIENT)

View file

@ -8,6 +8,7 @@ import gregtech.api.enums.Materials;
import gregtech.api.enums.TC_Aspects.TC_AspectStack;
import gregtech.api.interfaces.IDamagableItem;
import gregtech.api.interfaces.IIconContainer;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.IToolStats;
import gregtech.api.util.GT_LanguageManager;
import gregtech.api.util.GT_ModHandler;
@ -710,20 +711,15 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item implements
@SideOnly(Side.CLIENT)
public int getColorFromItemStack(ItemStack stack, int tintIndex) {
IToolStats toolStats = getToolStats(stack);
switch (tintIndex) {
case 2:
case 3:
short[] colorsHead = toolStats.getRGBa(true, stack);
if(colorsHead != null)
return makeColor(colorsHead);
case 0:
case 1:
short[] colors = toolStats.getRGBa(false, stack);
if(colors != null)
return makeColor(colors);
default:
return makeColor(Materials._NULL.getRGBA());
if(tintIndex == 1) {
short[] colorsHead = toolStats.getRGBa(true, stack);
if(colorsHead != null)
return ITexture.color(colorsHead, true);
}
short[] colors = toolStats.getRGBa(false, stack);
if(colors != null)
return ITexture.color(colors, true);
return 0xFFFFFF;
}
@Override
@ -731,40 +727,25 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item implements
return GT_LanguageManager.getTranslation(getUnlocalizedName(stack) + ".name");
}
private int makeColor(short[] rgba) {
short[] nullRGBA = Materials._NULL.getRGBA();
short red = rgba[0] > 0 && 255 > rgba[0] ? rgba[0] : nullRGBA[0];
short green = rgba[1] > 0 && 255 > rgba[1] ? rgba[1] : nullRGBA[1];
short blue = rgba[2] > 0 && 255 > rgba[2] ? rgba[2] : nullRGBA[2];
short alpha = rgba[3] > 0 && 255 > rgba[3] ? rgba[3] : nullRGBA[3];
return new Color(red, green, blue, alpha).getRGB();
}
@Override
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getIcon(ItemStack stack, int pass) {
IToolStats toolStats = getToolStats(stack);
IIconContainer head = toolStats.getIcon(true, stack);
IIconContainer handle = toolStats.getIcon(false, stack);
if((pass == 0 || pass == 1) && handle == null) {
return null;
if(pass == 0 && handle != null) {
return handle.getIcon();
}
if((pass == 2 || pass == 3) && head == null) {
return null;
}
switch (pass) {
case 2: return head.getIcon();
case 3: return head.getOverlayIcon();
case 0: return handle.getIcon();
case 1: return handle.getOverlayIcon();
default: return null;
if(pass == 1 && head != null) {
return head.getIcon();
}
return null;
}
@Override
@SideOnly(Side.CLIENT)
public int getRenderPasses(ItemStack stack) {
return 4;
return 2;
}
@Override

View file

@ -1,9 +1,11 @@
package gregtech.api.metatileentity;
import gregtech.api.GregTech_API;
import gregtech.api.enums.Materials;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IEnergyConductor;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.interfaces.tileentity.IPipeRenderedTileEntity;
import gregtech.api.net.GT_Packet_TileEntity;
@ -46,7 +48,7 @@ import static gregtech.api.enums.GT_Values.NW;
* <p/>
* This is the main TileEntity for EVERYTHING.
*/
public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileEntity, IPipeRenderedTileEntity {
public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileEntity, IPipeRenderedTileEntity, IEnergyConductor {
private final GT_CoverBehavior[] mCoverBehaviors = new GT_CoverBehavior[]{GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior};
public byte mConnections = 0;
protected MetaPipeEntity mMetaTileEntity;
@ -449,6 +451,36 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
issueClientUpdate();
}
@Override
public boolean isConductor() {
return mMetaTileEntity.isConductor();
}
@Override
public long getMaxVoltage() {
return mMetaTileEntity.getMaxVoltage();
}
@Override
public long getMaxAmperage() {
return mMetaTileEntity.getMaxAmperage();
}
@Override
public long getLossPerMeter() {
return mMetaTileEntity.getLossPerMeter();
}
@Override
public Materials getCableMaterial() {
return mMetaTileEntity.getCableMaterial();
}
@Override
public Materials getInsulationMaterial() {
return mMetaTileEntity.getInsulationMaterial();
}
@Override
public byte getStrongestRedstone() {
return (byte) Math.max(getInternalInputRedstoneSignal((byte) 0), Math.max(getInternalInputRedstoneSignal((byte) 1), Math.max(getInternalInputRedstoneSignal((byte) 2), Math.max(getInternalInputRedstoneSignal((byte) 3), Math.max(getInternalInputRedstoneSignal((byte) 4), getInternalInputRedstoneSignal((byte) 5))))));

View file

@ -23,7 +23,6 @@ import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
@ -630,7 +629,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
mFacing = (byte) (aValue & 7);
mActive = ((aValue & 8) != 0);
mRedstone = ((aValue & 16) != 0);
// mLockUpgrade = ((aValue&32) != 0);
mLockUpgrade = ((aValue&32) != 0);
break;
case 1:
if (hasValidMetaTileEntity()) mMetaTileEntity.onValueUpdate((byte) aValue);

View file

@ -1,19 +1,18 @@
package gregtech.api.metatileentity;
import gregtech.api.GregTech_API;
import gregtech.api.enums.Materials;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.objects.GT_ItemStack;
import gregtech.api.util.GT_Config;
import gregtech.api.util.GT_LanguageManager;
import gregtech.api.util.GT_Utility;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
@ -22,7 +21,6 @@ import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
@ -117,6 +115,30 @@ public abstract class MetaPipeEntity implements IMetaTileEntity {
*/
public abstract boolean renderInside(byte aSide);
public boolean isConductor() {
return false;
}
public long getMaxVoltage() {
return 0;
}
public long getMaxAmperage() {
return 0;
}
public long getLossPerMeter() {
return 0;
}
public Materials getCableMaterial() {
return Materials.Air;
}
public Materials getInsulationMaterial() {
return Materials.Air;
}
@Override
public IGregTechTileEntity getBaseMetaTileEntity() {
return mBaseMetaTileEntity;

View file

@ -103,6 +103,36 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
return new AxisAlignedBB(aX + 0.125D, aY + 0.125D, aZ + 0.125D, aX + 0.875D, aY + 0.875D, aZ + 0.875D);
}
@Override
public boolean isConductor() {
return true;
}
@Override
public long getMaxVoltage() {
return mVoltage;
}
@Override
public long getMaxAmperage() {
return mAmperage;
}
@Override
public long getLossPerMeter() {
return mCableLossPerMeter;
}
@Override
public Materials getCableMaterial() {
return mMaterial;
}
@Override
public Materials getInsulationMaterial() {
return mInsulated ? Materials.Rubber : Materials.Air;
}
@Override
public boolean isSimpleMachine() {
return true;

View file

@ -1,19 +1,17 @@
package gregtech.api.threads;
import gregtech.api.util.GT_PlayedSound;
import gregtech.api.util.GT_Utility;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.ISound;
import net.minecraft.client.audio.Sound;
import net.minecraft.client.audio.SoundEventAccessor;
import net.minecraft.client.audio.SoundHandler;
import net.minecraft.client.audio.*;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvent;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nullable;
public class GT_Runnable_Sound implements Runnable, ISound {
public class GT_Runnable_Sound implements Runnable {
private final int mX, mY, mZ, mTimeUntilNextSound;
private final World mWorld;
private final ResourceLocation mSoundLocation;
@ -31,69 +29,14 @@ public class GT_Runnable_Sound implements Runnable, ISound {
}
@Override
@SideOnly(Side.CLIENT)
public void run() {
Minecraft.getMinecraft().getSoundHandler().playSound(this);
SoundEvent soundEvent = SoundEvent.REGISTRY.getObject(mSoundLocation);
if(soundEvent != null) {
PositionedSound sound = new PositionedSound(soundEvent, SoundCategory.BLOCKS) {};
Minecraft.getMinecraft().getSoundHandler().playSound(sound);
}
}
@Override
public ResourceLocation getSoundLocation() {
return mSoundLocation;
}
@Nullable
@Override
public SoundEventAccessor createAccessor(SoundHandler handler) {
return new SoundEventAccessor(mSoundLocation, "metal sound");
}
@Override
public Sound getSound() {
return new Sound(mSoundLocation.toString(), getVolume(), getPitch(), 1, Sound.Type.FILE, true);
}
@Override
public SoundCategory getCategory() {
return SoundCategory.AMBIENT;
}
@Override
public boolean canRepeat() {
return true;
}
@Override
public int getRepeatDelay() {
return mTimeUntilNextSound;
}
@Override
public float getVolume() {
return mSoundStrength;
}
@Override
public float getPitch() {
return mSoundModulation;
}
@Override
public float getXPosF() {
return mX;
}
@Override
public float getYPosF() {
return mY;
}
@Override
public float getZPosF() {
return mZ;
}
@Override
public AttenuationType getAttenuationType() {
return AttenuationType.NONE;
}
}

View file

@ -1,14 +1,5 @@
package gregtech.api.util;
import ic2.api.recipe.*;
import ic2.core.Ic2Items;
import ic2.core.block.state.IIdProvider;
import ic2.core.ref.BlockName;
import ic2.core.ref.FluidName;
import ic2.core.ref.ItemName;
import ic2.core.ref.TeBlock;
import net.minecraftforge.fml.common.event.FMLInterModComms;
import net.minecraftforge.fml.common.registry.GameRegistry;
import gregtech.api.GregTech_API;
import gregtech.api.enums.*;
import gregtech.api.interfaces.IDamagableItem;
@ -18,9 +9,15 @@ import gregtech.api.objects.GT_HashSet;
import gregtech.api.objects.GT_ItemStack;
import gregtech.api.objects.ItemData;
import ic2.api.item.IBoxable;
import ic2.api.item.IC2Items;
import ic2.api.item.IElectricItem;
import ic2.api.reactor.IReactorComponent;
import ic2.api.recipe.*;
import ic2.core.Ic2Items;
import ic2.core.block.state.IIdProvider;
import ic2.core.ref.BlockName;
import ic2.core.ref.FluidName;
import ic2.core.ref.ItemName;
import ic2.core.ref.TeBlock;
import net.minecraft.block.Block;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.EntityLivingBase;
@ -38,12 +35,13 @@ import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fml.common.event.FMLInterModComms;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import java.util.*;
import java.util.Map.Entry;
import static gregtech.api.enums.GT_Values.*;
@ -357,7 +355,7 @@ public class GT_ModHandler {
public static boolean addValuableOre(Block aBlock, int aMeta, int aValue) {
if (aValue <= 0) return false;
try {
Class.forName("ic2.core.IC2").getMethod("addValuableOre", IRecipeInput.class, int.class).invoke(null, new RecipeInputItemStack(new ItemStack(aBlock, 1, aMeta)), aValue);
Class.forName("ic2.core.init.OreValues").getMethod("add", ItemStack.class, int.class).invoke(null, new ItemStack(aBlock, 1, aMeta), aValue);
} catch (Throwable e) {/*Do nothing*/}
return true;
}

View file

@ -375,9 +375,9 @@ public class GT_Utility {
//BC_CHECK = true;
} catch (Throwable e) {/**/}
try {
//Class tClass = cofh.api.energy.IEnergyReceiver.class;
//tClass.getCanonicalName();
//RF_CHECK = true;
Class tClass = cofh.api.energy.IEnergyReceiver.class;
tClass.getCanonicalName();
RF_CHECK = true;
} catch (Throwable e) {/**/}
CHECK_ALL = false;
}
@ -928,10 +928,7 @@ public class GT_Utility {
public static boolean doSoundAtClient(String aSoundName, int aTimeUntilNextSound, float aSoundStrength, float aSoundModulation, double aX, double aY, double aZ) {
if (isStringInvalid(aSoundName) || !FMLCommonHandler.instance().getEffectiveSide().isClient() || GT.getThePlayer() == null || !GT.getThePlayer().worldObj.isRemote)
return false;
if (GregTech_API.sMultiThreadedSounds)
new Thread(new GT_Runnable_Sound(GT.getThePlayer().worldObj, MathHelper.floor_double(aX), MathHelper.floor_double(aY), MathHelper.floor_double(aZ), aTimeUntilNextSound, aSoundName, aSoundStrength, aSoundModulation), "Sound Effect").start();
else
new GT_Runnable_Sound(GT.getThePlayer().worldObj, MathHelper.floor_double(aX), MathHelper.floor_double(aY), MathHelper.floor_double(aZ), aTimeUntilNextSound, aSoundName, aSoundStrength, aSoundModulation).run();
new GT_Runnable_Sound(GT.getThePlayer().worldObj, MathHelper.floor_double(aX), MathHelper.floor_double(aY), MathHelper.floor_double(aZ), aTimeUntilNextSound, aSoundName, aSoundStrength, aSoundModulation).run();
return true;
}

View file

@ -2,14 +2,15 @@ package gregtech.api.world;
import gregtech.api.GregTech_API;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import java.util.ArrayList;
import java.util.Collection;
public abstract class GT_Worldgen_Ore extends GT_Worldgen {
public final int mBlockMeta, mAmount, mSize, mMinY, mMaxY, mProbability, mDimensionType;
public final Block mBlock;
public final int mAmount, mSize, mMinY, mMaxY, mProbability, mDimensionType;
public final IBlockState mBlockState;
public final Collection<String> mBiomeList;
@ -18,8 +19,7 @@ public abstract class GT_Worldgen_Ore extends GT_Worldgen {
public GT_Worldgen_Ore(String aName, boolean aDefault, Block aBlock, int aBlockMeta, int aDimensionType, int aAmount, int aSize, int aProbability, int aMinY, int aMaxY, Collection<String> aBiomeList, boolean aAllowToGenerateinVoid) {
super(aName, GregTech_API.sWorldgenList, aDefault);
mDimensionType = aDimensionType;
mBlock = aBlock;
mBlockMeta = Math.min(Math.max(aBlockMeta, 0), 15);
mBlockState = aBlock.getStateFromMeta(aBlockMeta);
mProbability = GregTech_API.sWorldgenFile.get("worldgen." + mWorldGenName, "Probability", aProbability);
mAmount = GregTech_API.sWorldgenFile.get("worldgen." + mWorldGenName, "Amount", aAmount);
mSize = GregTech_API.sWorldgenFile.get("worldgen." + mWorldGenName, "Size", aSize);

View file

@ -120,7 +120,8 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
"unfinishedTank", "valvePart", "aquaRegia", "leatherSeal", "leatherSlimeSeal", "hambone", "slimeball", "clay", "enrichedUranium", "camoPaste",
"antiBlock", "burntQuartz", "salmonRaw", "blockHopper", "blockEnderObsidian", "blockIcestone", "blockMagicWood", "blockEnderCore", "blockHeeEndium",
"oreHeeEndPowder", "oreHeeStardust", "oreHeeIgneousRock", "oreHeeInstabilityOrb", "crystalPureFluix", "shardNether", "gemFluorite",
"stickObsidian", "caveCrystal", "shardCrystal", "DYECrystal","shardFire","shardWater","shardAir","shardEarth","ingotRefinedIron","blockMarble","ingotUnstable"}));
"stickObsidian", "caveCrystal", "shardCrystal", "DYECrystal","shardFire","shardWater","shardAir","shardEarth","ingotRefinedIron","blockMarble","ingotUnstable",
"blockCactus", "blockPrismarineBrick", "blockPrismarineDark", "stoneGranitePolished", "stoneDioritePolished", "stoneAndesitePolished", "doorWood", "doorIron"}));
private final Collection<String> mInvalidNames = new HashSet<String>(Arrays.asList(new String[]{"diamondShard", "redstoneRoot", "obsidianStick", "bloodstoneOre",
"universalCable", "bronzeTube", "ironTube", "netherTube", "obbyTube", "infiniteBattery", "eliteBattery", "advancedBattery", "10kEUStore",
"blueDye", "MonazitOre", "quartzCrystal", "whiteLuminiteCrystal", "darkStoneIngot", "invisiumIngot", "demoniteOrb", "enderGem", "starconiumGem",

View file

@ -1,5 +1,6 @@
package gregtech.common;
import gregtech.api.enums.StoneTypes;
import gregtech.api.world.GT_Worldgen_Ore;
import gregtech.api.world.GT_Worldgen_Constants;
import gregtech.common.blocks.GT_Block_GeneratedOres;
@ -63,10 +64,12 @@ public class GT_Worldgen_Stone
temp.setPos(eX, eY, eZ);
IBlockState tTargetedBlock = aWorld.getBlockState(temp);
if (tTargetedBlock.getBlock() instanceof GT_Block_GeneratedOres) {
GT_Block_GeneratedOres block = (GT_Block_GeneratedOres) tTargetedBlock.getBlock();
StoneTypes stoneTypes = StoneTypes.computeStoneType(mBlockState);
aWorld.setBlockState(temp, block.overrideStoneType(tTargetedBlock, stoneTypes));
} else if ((this.mAllowToGenerateinVoid && aWorld.isAirBlock(temp)) ||
(tTargetedBlock != null && tTargetedBlock.getBlock().isReplaceableOreGen(tTargetedBlock, aWorld, temp, GT_Worldgen_Constants.ANY))) {
aWorld.setBlockState(temp, this.mBlock.getStateFromMeta(mBlockMeta));
aWorld.setBlockState(temp, mBlockState);
}
}
}

View file

@ -46,6 +46,10 @@ public class GT_Block_GeneratedOres extends GT_Generic_Block {
public static IBlockState[][] sGeneratedBlocks;
public static IBlockState[][] sGeneratedSmallBlocks;
public static IBlockState[][] getStates(boolean small) {
return small ? sGeneratedSmallBlocks : sGeneratedBlocks;
}
public static void doOreThings() {
System.out.println("MATERIALS META OFFSET: " + MATERIALS_META_OFFSET);
System.out.println("MATERIALS/BLOCK: " + MATERIALS_PER_BLOCK);
@ -100,7 +104,7 @@ public class GT_Block_GeneratedOres extends GT_Generic_Block {
return false;
}
IBlockState blockState = (small ? sGeneratedSmallBlocks : sGeneratedBlocks)[materialSubId][variantId];
IBlockState blockState = getStates(small)[materialSubId][variantId];
return world.setBlockState(pos, blockState);
}
@ -161,6 +165,10 @@ public class GT_Block_GeneratedOres extends GT_Generic_Block {
return StoneTypes.STONE;
}
public IBlockState overrideStoneType(IBlockState state, StoneTypes stoneTypes) {
return getStates(mSmall)[getMaterialSafe(state).mMetaItemSubID][stoneTypes.mId];
}
@Override
public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> list) {
for(int i = 0; i < mMaterials.length; i++) {
@ -182,12 +190,12 @@ public class GT_Block_GeneratedOres extends GT_Generic_Block {
@Override
public float getBlockHardness(IBlockState blockState, World worldIn, BlockPos pos) {
return 2.0F * (getHarvestLevel(blockState) + 1);
return 1.25F * (getHarvestLevel(blockState) + 1);
}
@Override
public float getExplosionResistance(World world, BlockPos pos, Entity exploder, Explosion explosion) {
return 3.5F * (getHarvestLevel(world.getBlockState(pos)) + 1);
return 1.75F * (getHarvestLevel(world.getBlockState(pos)) + 1);
}
@Override

View file

@ -291,11 +291,12 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo
@Override
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getParticleSprite(IBlockAccess worldObj, BlockPos aPos, EnumFacing side) {
TileEntity tileEntity = worldObj.getTileEntity(aPos);
if(tileEntity instanceof ITexturedTileEntity) {
ITexture[] textures = ((ITexturedTileEntity) tileEntity).getTexture(this, (byte) 1);
if(textures.length > 0 && textures[0].isValidTexture() && textures[0] instanceof GT_RenderedTexture) {
return ((GT_RenderedTexture) textures[0]).mIconContainer.getIcon();
IGregTechTileEntity tileEntity = getGregTile(worldObj, aPos);
if(tileEntity != null) {
ITexture[] textures = tileEntity.getTexture(this, (byte) side.getIndex());
for(int i = 0; i < textures.length; i++) {
if(textures[i] instanceof GT_RenderedTexture)
return ((GT_RenderedTexture) textures[i]).mIconContainer.getIcon();
}
}
return null;
@ -310,24 +311,25 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo
super.onBlockExploded(world, pos, explosion);
}
private ThreadLocal<IGregTechTileEntity> tileEntity = new ThreadLocal<>();
@Override
public void breakBlock(World aWorld, BlockPos pos, IBlockState blockState) {
GregTech_API.causeMachineUpdate(aWorld, pos.getX(), pos.getY(), pos.getZ());
TileEntity tTileEntity = aWorld.getTileEntity(pos);
if(tTileEntity instanceof IGregTechTileEntity) {
List<ItemStack> drops = getDrops((IGregTechTileEntity) tTileEntity);
for(ItemStack itemStack : drops) {
spawnAsEntity(aWorld, pos, itemStack);
}
}
System.out.println("Break");
super.breakBlock(aWorld, pos, blockState);
aWorld.removeTileEntity(pos);
public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player) {
tileEntity.set(getGregTile(worldIn, pos));
super.onBlockHarvested(worldIn, pos, state, player);
}
@Override
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
return Collections.emptyList();
IGregTechTileEntity gregTechTileEntity = getGregTile(world, pos);
if(gregTechTileEntity == null) {
gregTechTileEntity = tileEntity.get();
tileEntity.set(null);
}
if(gregTechTileEntity != null) {
return getDrops(gregTechTileEntity);
}
return Collections.EMPTY_LIST;
}
public List<ItemStack> getDrops(IGregTechTileEntity tGregTechTileEntity) {

View file

@ -6,6 +6,7 @@ import gregtech.api.enums.ItemList;
import gregtech.api.items.GT_Generic_Item;
import gregtech.api.util.GT_Utility;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
@ -52,6 +53,9 @@ public class GT_FluidDisplayItem extends GT_Generic_Item {
return GT_Utility.getTexture(tFluid.getStill());
}
@Override
public void registerIcons(TextureMap aIconRegister) {}
@Override
@SideOnly(Side.CLIENT)
public int getColorFromItemStack(ItemStack stack, int tintIndex) {

View file

@ -378,7 +378,7 @@ public class ModularArmor_Item extends GT_Generic_Item implements ISpecialArmor
@SideOnly(Side.CLIENT)
public void registerIcons(TextureMap aIconRegister) {
this.itemIcon = aIconRegister.registerSprite(new ResourceLocation(GT_Values.MOD_ID + ":" + mName));
this.itemIcon = aIconRegister.registerSprite(new ResourceLocation(GT_Values.MOD_ID + ":items/" + mName));
}
@SideOnly(Side.CLIENT)

View file

@ -2,7 +2,6 @@ package gregtech.common.render;
import codechicken.lib.render.item.CCRenderItem;
import codechicken.lib.render.item.IItemRenderer;
import codechicken.lib.render.item.IStackPerspectiveAwareModel;
import gregtech.api.GregTech_API;
import gregtech.api.items.GT_Generic_Block;
import gregtech.api.items.GT_Generic_Item;
@ -20,16 +19,15 @@ import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.ModelBakeEvent;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.client.model.IPerspectiveAwareModel;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.model.TRSRTransformation;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import javax.annotation.Nullable;
import javax.vecmath.*;
@ -37,15 +35,19 @@ import javax.vecmath.Matrix4f;
import java.util.Collections;
import java.util.List;
public class ItemRenderer implements IItemRenderer, IStackPerspectiveAwareModel {
public class ItemRenderer {
public static final ItemRenderer INSTANCE = new ItemRenderer();
private ModelResourceLocation LOCATION = new ModelResourceLocation("GT_ITEM", "inventory");
private ModelResourceLocation LOCATION_NORMAL = new ModelResourceLocation("gt/item/normal", "inventory");
private ModelResourceLocation LOCATION_HANDHELD = new ModelResourceLocation("gt/item/handheld", "inventory");
private ModelResourceLocation LOCATION_BLOCK = new ModelResourceLocation("gt/item/block", "inventory");
@SubscribeEvent
public void onModelsBake(ModelBakeEvent event) {
event.getModelRegistry().putObject(LOCATION, this);
event.getModelRegistry().putObject(LOCATION_NORMAL, new BakedModelItemRendererWrapper(ModelUtil.DEFAULT_TRANSFORMS));
event.getModelRegistry().putObject(LOCATION_HANDHELD, new BakedModelItemRendererWrapper(ModelUtil.HANDHELD_TRANSFORMS));
event.getModelRegistry().putObject(LOCATION_BLOCK, new BakedModelItemRendererWrapper(ModelUtil.BLOCK_TRANSFORMS));
}
@SubscribeEvent
@ -82,7 +84,14 @@ public class ItemRenderer implements IItemRenderer, IStackPerspectiveAwareModel
ItemMeshDefinition definition = new ItemMeshDefinition() {
@Override
public ModelResourceLocation getModelLocation(ItemStack stack) {
return LOCATION;
if(stack.getItem() instanceof ItemBlock) {
return LOCATION_BLOCK;
}
GT_Generic_Item generic_item = (GT_Generic_Item) stack.getItem();
if(generic_item.isHandheld(stack)) {
return LOCATION_HANDHELD;
}
return LOCATION_NORMAL;
}
};
@ -105,9 +114,9 @@ public class ItemRenderer implements IItemRenderer, IStackPerspectiveAwareModel
Block block = ((ItemBlock) item).block;
EnumBlockRenderType layer = block.getRenderType(block.getDefaultState());
GL11.glEnable(GL11.GL_BLEND);
//GL11.glEnable(GL11.GL_BLEND);
//GL11.glEnable(GL11.GL_CULL_FACE);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
//OpenGlHelper.glBlendFunc(770, 771, 1, 0);
texturemanager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
//GL11.glDepthMask(false);
//GL11.glDisable(GL11.GL_DEPTH_TEST);
@ -123,7 +132,7 @@ public class ItemRenderer implements IItemRenderer, IStackPerspectiveAwareModel
//GL11.glDepthMask(true);
//GL11.glEnable(GL11.GL_DEPTH_TEST);
//GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_BLEND);
//GL11.glDisable(GL11.GL_BLEND);
}
else
{
@ -154,7 +163,9 @@ public class ItemRenderer implements IItemRenderer, IStackPerspectiveAwareModel
//GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F);
//GL11.glRotatef(335.0F, 0.0F, 0.0F, 1.0F);
//GL11.glTranslatef(-0.9375F, -0.0625F, 0.0F);
GL11.glTranslatef(0f, 0f, 0.5f);
GL11.glRotatef(180f, 0f, 1f, 0f);
GL11.glTranslatef(-1f, 0f, -0.5f);
renderItemIn2D(tessellator, f1, f2, f, f3, iicon.getIconWidth(), iicon.getIconHeight(), 0.0625F, colors);
@ -279,8 +290,7 @@ public class ItemRenderer implements IItemRenderer, IStackPerspectiveAwareModel
tes.draw();
}
@Override
public void renderItem(ItemStack item) {
if(item.getItem() instanceof ItemBlock) {
renderItem(item, 0);
@ -292,53 +302,59 @@ public class ItemRenderer implements IItemRenderer, IStackPerspectiveAwareModel
}
}
@Override
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) {
return Collections.emptyList();
private final class BakedModelItemRendererWrapper implements IBakedModel, IPerspectiveAwareModel, IItemRenderer {
private ItemCameraTransforms transforms;
public BakedModelItemRendererWrapper(ItemCameraTransforms transforms) {
this.transforms = transforms;
}
@Override
public void renderItem(ItemStack item) {
ItemRenderer.this.renderItem(item);
}
@Override
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) {
return Collections.EMPTY_LIST;
}
@Override
public boolean isAmbientOcclusion() {
return false;
}
@Override
public boolean isGui3d() {
return false;
}
@Override
public boolean isBuiltInRenderer() {
return true;
}
@Override
public TextureAtlasSprite getParticleTexture() {
return null;
}
@Override
public ItemCameraTransforms getItemCameraTransforms() {
return transforms;
}
@Override
public ItemOverrideList getOverrides() {
return ItemOverrideList.NONE;
}
@Override
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) {
return ImmutablePair.of(this, new TRSRTransformation(getItemCameraTransforms().getTransform(cameraTransformType)).getMatrix());
}
}
@Override
public boolean isAmbientOcclusion() {
return false;
}
@Override
public boolean isGui3d() {
return false;
}
@Override
public boolean isBuiltInRenderer() {
return true;
}
@Override
public TextureAtlasSprite getParticleTexture() {
return null;
}
@Override
public ItemCameraTransforms getItemCameraTransforms() {
return ModelUtil.BLOCK_TRANSFORMS; //RenderEntityItem calls it directly
}
@Override
public ItemOverrideList getOverrides() {
return ItemOverrideList.NONE;
}
@Override
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(ItemStack stack, ItemCameraTransforms.TransformType cameraTransformType) {
Matrix4f mat = new Matrix4f();
mat.setIdentity();
ItemTransformVec3f vec =
(stack.getItem() instanceof ItemBlock ? ModelUtil.BLOCK_TRANSFORMS :
((GT_Generic_Item) stack.getItem()).isHandheld(stack) ? ModelUtil.HANDHELD_TRANSFORMS :
ModelUtil.DEFAULT_TRANSFORMS)
.getTransform(cameraTransformType);
TRSRTransformation t = new TRSRTransformation(vec);
return ImmutablePair.of(this, t.getMatrix());
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 348 B

After

Width:  |  Height:  |  Size: 281 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 303 B

After

Width:  |  Height:  |  Size: 252 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 297 B

After

Width:  |  Height:  |  Size: 260 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 276 B

After

Width:  |  Height:  |  Size: 240 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 482 B

After

Width:  |  Height:  |  Size: 452 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 375 B

After

Width:  |  Height:  |  Size: 371 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 563 B

After

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 443 B

After

Width:  |  Height:  |  Size: 455 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 375 B

After

Width:  |  Height:  |  Size: 371 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 454 B

After

Width:  |  Height:  |  Size: 307 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 464 B

After

Width:  |  Height:  |  Size: 305 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 543 B

After

Width:  |  Height:  |  Size: 331 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 757 B

After

Width:  |  Height:  |  Size: 488 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 757 B

After

Width:  |  Height:  |  Size: 381 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 878 B

After

Width:  |  Height:  |  Size: 535 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 379 B

After

Width:  |  Height:  |  Size: 233 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 337 B

After

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 B

After

Width:  |  Height:  |  Size: 287 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 691 B

After

Width:  |  Height:  |  Size: 600 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 436 B

After

Width:  |  Height:  |  Size: 340 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 727 B

After

Width:  |  Height:  |  Size: 638 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 728 B

After

Width:  |  Height:  |  Size: 637 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 415 B

After

Width:  |  Height:  |  Size: 329 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 401 B

After

Width:  |  Height:  |  Size: 320 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 744 B

After

Width:  |  Height:  |  Size: 651 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 342 B

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 398 B

After

Width:  |  Height:  |  Size: 316 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 642 B

After

Width:  |  Height:  |  Size: 557 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 442 B

After

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 428 B

After

Width:  |  Height:  |  Size: 337 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 679 B

After

Width:  |  Height:  |  Size: 593 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 737 B

After

Width:  |  Height:  |  Size: 652 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 385 B

After

Width:  |  Height:  |  Size: 294 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 739 B

After

Width:  |  Height:  |  Size: 653 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 446 B

After

Width:  |  Height:  |  Size: 346 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 735 B

After

Width:  |  Height:  |  Size: 642 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 445 B

After

Width:  |  Height:  |  Size: 342 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 444 B

After

Width:  |  Height:  |  Size: 342 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 822 B

After

Width:  |  Height:  |  Size: 280 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 603 B

After

Width:  |  Height:  |  Size: 532 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 653 B

After

Width:  |  Height:  |  Size: 567 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 417 B

After

Width:  |  Height:  |  Size: 321 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 598 B

After

Width:  |  Height:  |  Size: 511 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 442 B

After

Width:  |  Height:  |  Size: 341 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 439 B

After

Width:  |  Height:  |  Size: 344 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 413 B

After

Width:  |  Height:  |  Size: 328 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 447 B

After

Width:  |  Height:  |  Size: 353 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 385 B

After

Width:  |  Height:  |  Size: 294 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 596 B

After

Width:  |  Height:  |  Size: 510 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 432 B

After

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 424 B

After

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 508 B

After

Width:  |  Height:  |  Size: 420 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 442 B

After

Width:  |  Height:  |  Size: 349 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 442 B

After

Width:  |  Height:  |  Size: 349 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 682 B

After

Width:  |  Height:  |  Size: 591 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 697 B

After

Width:  |  Height:  |  Size: 608 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 702 B

After

Width:  |  Height:  |  Size: 612 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 320 B

After

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 693 B

After

Width:  |  Height:  |  Size: 603 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 710 B

After

Width:  |  Height:  |  Size: 619 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 539 B

After

Width:  |  Height:  |  Size: 452 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 539 B

After

Width:  |  Height:  |  Size: 452 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 B

After

Width:  |  Height:  |  Size: 313 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 721 B

After

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 398 B

After

Width:  |  Height:  |  Size: 294 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 442 B

After

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 437 B

After

Width:  |  Height:  |  Size: 346 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 728 B

After

Width:  |  Height:  |  Size: 639 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 722 B

After

Width:  |  Height:  |  Size: 635 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 401 B

After

Width:  |  Height:  |  Size: 306 B

Some files were not shown because too many files have changed in this diff Show more