diff --git a/build.properties b/build.properties index 845a8e50..6566ef96 100644 --- a/build.properties +++ b/build.properties @@ -1,7 +1,7 @@ minecraft.version=1.10.2 forge.version=12.18.1.2079 -gt.version=5.10.33 +gt.version=5.10.34 forestry.version=5.2.7.220 ic2.version=2.6.99-ex110 diff --git a/build/libs/gregtech-5.10.34-dev.jar b/build/libs/gregtech-5.10.34-dev.jar new file mode 100644 index 00000000..fafd168a Binary files /dev/null and b/build/libs/gregtech-5.10.34-dev.jar differ diff --git a/build/libs/gregtech-5.10.34-sources.jar b/build/libs/gregtech-5.10.34-sources.jar new file mode 100644 index 00000000..a5bd94c9 Binary files /dev/null and b/build/libs/gregtech-5.10.34-sources.jar differ diff --git a/build/libs/gregtech-5.10.34.jar b/build/libs/gregtech-5.10.34.jar new file mode 100644 index 00000000..4ac0aa72 Binary files /dev/null and b/build/libs/gregtech-5.10.34.jar differ diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java index 8ab75fc0..e01a2e37 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java @@ -3,8 +3,11 @@ 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.IEnergyAcceptor; import ic2.api.energy.tile.IEnergyEmitter; import ic2.api.energy.tile.IEnergySink; +import ic2.api.energy.tile.IEnergySource; +import ic2.api.tile.IEnergyStorage; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; @@ -19,7 +22,7 @@ import static gregtech.api.enums.GT_Values.V; * IColoredTileEntity is needed for not connecting differently coloured Blocks to each other. * IHasWorldObjectAndCoords is needed for the InWorld related Stuff. @BaseTileEntity does implement most of that Interface. */ -public interface IEnergyConnected extends IColoredTileEntity, IHasWorldObjectAndCoords, IEnergyEmitter { +public interface IEnergyConnected extends IColoredTileEntity, IHasWorldObjectAndCoords, IEnergyAcceptor, IEnergyEmitter { /** * Inject Energy Call for Electricity. Gets called by EnergyEmitters to inject Energy into your Block *

@@ -67,14 +70,12 @@ public interface IEnergyConnected extends IColoredTileEntity, IHasWorldObjectAnd rUsedAmperes++; } } 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; diff --git a/src/main/java/gregtech/api/items/GT_MetaBase_Item.java b/src/main/java/gregtech/api/items/GT_MetaBase_Item.java index 872900c5..f766f927 100644 --- a/src/main/java/gregtech/api/items/GT_MetaBase_Item.java +++ b/src/main/java/gregtech/api/items/GT_MetaBase_Item.java @@ -150,9 +150,9 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item implements ISpeci } if (aStack.stackSize <= 0) { aPlayer.setHeldItem(hand, null); - return EnumActionResult.FAIL; + return EnumActionResult.SUCCESS; } - return EnumActionResult.FAIL; + return EnumActionResult.SUCCESS; } @@ -169,13 +169,13 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item implements ISpeci if (tList != null) for (IItemBehaviour tBehavior : tList) if (tBehavior.onItemUseFirst(this, aStack, aPlayer, aWorld, pos, side, hitX, hitY, hitZ, hand)) { if (aStack.stackSize <= 0) aPlayer.setHeldItem(hand, null); - return EnumActionResult.SUCCESS; + return EnumActionResult.PASS; } if (aStack.stackSize <= 0) { aPlayer.setHeldItem(hand, null); - return EnumActionResult.SUCCESS; + return EnumActionResult.PASS; } - return EnumActionResult.SUCCESS; + return EnumActionResult.PASS; } return EnumActionResult.PASS; } diff --git a/src/main/java/gregtech/api/items/GT_MetaGenerated_Tool.java b/src/main/java/gregtech/api/items/GT_MetaGenerated_Tool.java index bcfaff8c..c7d2925d 100644 --- a/src/main/java/gregtech/api/items/GT_MetaGenerated_Tool.java +++ b/src/main/java/gregtech/api/items/GT_MetaGenerated_Tool.java @@ -734,11 +734,19 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item implements IToolStats toolStats = getToolStats(stack); IIconContainer head = toolStats.getIcon(true, stack); IIconContainer handle = toolStats.getIcon(false, stack); - if(pass == 0 && handle != null) { - return handle.getIcon(); + if(handle != null) { + if(pass == 0) { + return handle.getIcon(); + } else if(pass == 1) { + return handle.getOverlayIcon(); + } } - if(pass == 1 && head != null) { - return head.getIcon(); + if(head != null) { + if(pass == 2) { + return head.getIcon(); + } else if(pass == 3) { + return head.getOverlayIcon(); + } } return null; } @@ -746,7 +754,7 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item implements @Override @SideOnly(Side.CLIENT) public int getRenderPasses(ItemStack stack) { - return 2; + return 4; } @Override diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java index 96d76ea4..e12826e2 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java @@ -12,6 +12,7 @@ import gregtech.api.net.GT_Packet_TileEntity; import gregtech.api.objects.GT_ItemStack; import gregtech.api.util.*; import ic2.api.energy.tile.IEnergyAcceptor; +import ic2.api.energy.tile.IEnergyEmitter; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; @@ -1398,6 +1399,11 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE return true; } + @Override + public boolean acceptsEnergyFrom(IEnergyEmitter iEnergyEmitter, EnumFacing enumFacing) { + return true; + } + @Override public IFluidTankProperties[] getTankProperties() { if(mMetaTileEntity != null) { diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java index c6e7e3dd..ba85b835 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java @@ -14,6 +14,7 @@ import gregtech.api.objects.GT_ItemStack; import gregtech.api.util.*; import gregtech.common.GT_Pollution; import ic2.api.energy.tile.IEnergyAcceptor; +import ic2.api.energy.tile.IEnergyEmitter; import ic2.api.info.Info; import net.minecraft.block.Block; import net.minecraft.block.BlockFire; @@ -25,12 +26,12 @@ import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.world.EnumSkyBlock; import net.minecraft.world.World; +import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; @@ -279,7 +280,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE boolean aSideServer = isServerSide(); boolean aSideClient = isClientSide(); - if (aSideServer && mTickTimer % 10 == 0) { + if (aSideServer && mTickTimer % 40 == 0) { NW.sendToAllAround(worldObj, new GT_Packet_TileEntity( getXCoord(), getYCoord(), getZCoord(), mID, mCoverSides[0], mCoverSides[1], mCoverSides[2], @@ -1232,7 +1233,6 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sScrewdriverList)) { if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 200, aPlayer)) { - System.out.println("Screwdriver click"); setCoverDataAtSide(aSide, getCoverBehaviorAtSide(aSide).onCoverScrewdriverclick(aSide, getCoverIDAtSide(aSide), getCoverDataAtSide(aSide), this, aPlayer, aX, aY, aZ)); mMetaTileEntity.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(100), 1.0F, -1, getXCoord(), getYCoord(), getZCoord()); @@ -1605,7 +1605,6 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE if (getCoverBehaviorAtSide(aSide).onCoverRemoval(aSide, getCoverIDAtSide(aSide), mCoverData[aSide], this, aForced) || aForced) { ItemStack tStack = getCoverBehaviorAtSide(aSide).getDrop(aSide, getCoverIDAtSide(aSide), getCoverDataAtSide(aSide), this); if (tStack != null) { - tStack.setTagCompound(null); EntityItem tEntity = new EntityItem(worldObj, getOffsetX(aDroppedSide, 1) + 0.5, getOffsetY(aDroppedSide, 1) + 0.5, getOffsetZ(aDroppedSide, 1) + 0.5, tStack); tEntity.motionX = 0; tEntity.motionY = 0; @@ -1764,14 +1763,17 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE return injectEnergyUnits((byte) aDirection.ordinal(), (int) aAmount, 1) > 0 ? 0 : aAmount; } - public boolean acceptsEnergyFrom(TileEntity aEmitter, EnumFacing aDirection) { + @Override + public boolean acceptsEnergyFrom(IEnergyEmitter aEmitter, EnumFacing aDirection) { return inputEnergyFrom((byte) aDirection.ordinal()); } - public boolean emitsEnergyTo(TileEntity aReceiver, EnumFacing aDirection) { + @Override + public boolean emitsEnergyTo(IEnergyAcceptor aReceiver, EnumFacing aDirection) { return outputsEnergyTo((byte) aDirection.ordinal()); } + public double getOfferedEnergy() { return (canAccessData() && getStoredEU() - mMetaTileEntity.getMinimumStoredEU() >= oOutput) ? Math.max(0, oOutput) : 0; } @@ -1781,10 +1783,6 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE decreaseStoredEU((int) amount, true); } - public int injectEnergy(EnumFacing aEnumFacing, int aAmount) { - return injectEnergyUnits((byte) aEnumFacing.ordinal(), aAmount, 1) > 0 ? 0 : aAmount; - } - public int addEnergy(int aEnergy) { if (!canAccessData()) return 0; if (aEnergy > 0) @@ -1914,11 +1912,6 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE mMetaTileEntity.onEntityCollidedWithBlock(aWorld, aX, aY, aZ, collider); } - @Override - public boolean emitsEnergyTo(IEnergyAcceptor iEnergyAcceptor, EnumFacing enumFacing) { - return true; - } - @Override public String getName() { return mMetaTileEntity.getName(); diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java index 51c50808..135c0d1f 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java @@ -1,6 +1,8 @@ package gregtech.api.metatileentity.implementations; +import cofh.api.energy.IEnergyReceiver; import gregtech.GT_Mod; +import gregtech.api.GregTech_API; import gregtech.api.enums.Dyes; import gregtech.api.enums.Materials; import gregtech.api.enums.TextureSet; @@ -15,6 +17,7 @@ import gregtech.api.metatileentity.BaseMetaPipeEntity; import gregtech.api.metatileentity.MetaPipeEntity; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Utility; +import ic2.api.energy.tile.IEnergyEmitter; import ic2.api.energy.tile.IEnergySink; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -190,26 +193,21 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile } else { rUsedAmperes += ((IEnergyConnected) tTileEntity).injectEnergyUnits(GT_Utility.getOppositeSide(i), aVoltage, aAmperage - rUsedAmperes); } -// } else if (tTileEntity instanceof IEnergySink) { -// EnumFacing tDirection = EnumFacing.getOrientation(i).getOpposite(); -// if (((IEnergySink)tTileEntity).acceptsEnergyFrom((TileEntity)getBaseMetaTileEntity(), tDirection)) { -// if (((IEnergySink)tTileEntity).demandedEnergyUnits() > 0 && ((IEnergySink)tTileEntity).injectEnergyUnits(tDirection, aVoltage) < aVoltage) rUsedAmperes++; -// } } else if (tTileEntity instanceof IEnergySink) { EnumFacing tDirection = EnumFacing.VALUES[i].getOpposite(); if (((IEnergySink) tTileEntity).acceptsEnergyFrom(getBaseMetaTileEntity(), tDirection)) { if (((IEnergySink) tTileEntity).getDemandedEnergy() > 0 && ((IEnergySink) tTileEntity).injectEnergy(tDirection, aVoltage, aVoltage) < aVoltage) rUsedAmperes++; } - } /*else if (GregTech_API.mOutputRF && tTileEntity instanceof IEnergyReceiver) { - EnumFacing tDirection = EnumFacing.getOrientation(i).getOpposite(); + } else if (GregTech_API.mOutputRF && tTileEntity instanceof IEnergyReceiver) { + 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++; } else if (((IEnergyReceiver) tTileEntity).receiveEnergy(tDirection, rfOut, true) > 0) { if (mRestRF == 0) { - int RFtrans = ((IEnergyReceiver) tTileEntity).receiveEnergy(tDirection, (int) rfOut, false); + int RFtrans = ((IEnergyReceiver) tTileEntity).receiveEnergy(tDirection, rfOut, false); rUsedAmperes++; mRestRF = rfOut - RFtrans; } else { @@ -220,7 +218,7 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile if (GregTech_API.mRFExplosions && ((IEnergyReceiver) tTileEntity).getMaxEnergyStored(tDirection) < rfOut * 600) { if (rfOut > 32 * GregTech_API.mEUtoRF / 100) this.doExplosion(rfOut); } - }*/ + } } } mTransferredAmperage += rUsedAmperes; @@ -267,16 +265,15 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile mConnections |= (1 << i); } - //if (GregTech_API.mOutputRF && tTileEntity instanceof IEnergyReceiver && ((IEnergyReceiver) tTileEntity).canConnectEnergy(EnumFacing.getOrientation(j))) { - // mConnections |= (1 << i); - // continue; - //} - /* + if (GregTech_API.mOutputRF && tTileEntity instanceof IEnergyReceiver && ((IEnergyReceiver) tTileEntity).canConnectEnergy(EnumFacing.VALUES[j])) { + mConnections |= (1 << i); + continue; + } - if (tTileEntity instanceof IEnergyEmitter && ((IEnergyEmitter)tTileEntity).emitsEnergyTo((TileEntity)aBaseMetaTileEntity, EnumFacing.getOrientation(j))) { + if (tTileEntity instanceof IEnergyEmitter && ((IEnergyEmitter)tTileEntity).emitsEnergyTo(aBaseMetaTileEntity, EnumFacing.VALUES[j])) { mConnections |= (1< 0) { - int storedRF = ((IPowerContainer) tTileEntity).getEnergyStored(); - int extractRF = (int) maxEUInput() * 100 / GregTech_API.mRFtoEU; - long tEU = 0; - if (tTileEntity instanceof TileCapBank) { - ICapBankNetwork network = ((TileCapBank) tTileEntity).getNetwork(); - if (network != null && network.getEnergyStoredL() > 0) { - tEU = Math.min((Math.min(Math.min(network.getEnergyStoredL(), storedRF - extractRF), network.getMaxOutput())) * GregTech_API.mRFtoEU / 100, maxEUInput()); - network.addEnergy((int) -(tEU * 100 / GregTech_API.mRFtoEU)); - } - } else { - if (storedRF > extractRF) { - ((IPowerContainer) tTileEntity).setEnergyStored(storedRF - extractRF); - tEU = maxEUInput(); - } else { - ((IPowerContainer) tTileEntity).setEnergyStored(0); - tEU = storedRF * GregTech_API.mRFtoEU / 100; - } - } - aBaseMetaTileEntity.injectEnergyUnits((byte) 6, Math.min(tEU, maxEUInput()), 1); - }*/ + } } } } diff --git a/src/main/java/gregtech/common/GT_Proxy.java b/src/main/java/gregtech/common/GT_Proxy.java index 9a19f5f4..9f9dca7a 100644 --- a/src/main/java/gregtech/common/GT_Proxy.java +++ b/src/main/java/gregtech/common/GT_Proxy.java @@ -62,6 +62,7 @@ import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fml.common.*; import net.minecraftforge.fml.common.eventhandler.Event.Result; +import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import net.minecraftforge.fml.common.network.FMLNetworkEvent; @@ -921,7 +922,6 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { return this.mDateFormat.format(new Date()); } - @SubscribeEvent public void onPlayerInteraction(PlayerInteractEvent.RightClickBlock aEvent) { ItemStack aStack = aEvent.getItemStack(); if (aStack != null && aStack.getItem() == Items.FLINT_AND_STEEL) { diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Machines.java b/src/main/java/gregtech/common/blocks/GT_Block_Machines.java index e727c50c..09ead87a 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Machines.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Machines.java @@ -271,10 +271,10 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo if (gregTechTileEntity.getTimer() < 50L) { return false; } - if (!worldIn.isRemote && gregTechTileEntity.isUseableByPlayer(playerIn)) { - gregTechTileEntity.onRightclick(playerIn, (byte) side.getIndex(), hitX, hitY, hitZ, EnumHand.MAIN_HAND); + if (gregTechTileEntity.isUseableByPlayer(playerIn)) { + return gregTechTileEntity.onRightclick(playerIn, (byte) side.getIndex(), hitX, hitY, hitZ, EnumHand.MAIN_HAND); } - return true; + return false; }