aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/gregtech/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/api')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/enums/CustomGtTextures.java20
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechTextures.java1
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechToolDictNames.java2
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_Pump.java150
4 files changed, 156 insertions, 17 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/CustomGtTextures.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/CustomGtTextures.java
index 2a8802b6f4..554983c41c 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/CustomGtTextures.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/CustomGtTextures.java
@@ -13,22 +13,10 @@ import gtPlusPlus.core.lib.CORE;
public class CustomGtTextures {
public enum ItemIcons implements IIconContainer, Runnable {
- VOID // The Empty Texture
- , RENDERING_ERROR, WRENCH, MORTAR, CROWBAR,
- JACKHAMMER, WIRE_CUTTER, KNIFE, BUTCHERYKNIFE,
- SICKLE, SCOOP, GRAFTER, PLUNGER, ROLLING_PIN,
- HANDLE_SWORD, HANDLE_FILE, HANDLE_SAW,
- HANDLE_SCREWDRIVER, HANDLE_BUZZSAW,
- HANDLE_ELECTRIC_SCREWDRIVER, HANDLE_SOLDERING,
- POWER_UNIT_LV, POWER_UNIT_MV, POWER_UNIT_HV,
- DURABILITY_BAR_0, DURABILITY_BAR_1, DURABILITY_BAR_2,
- DURABILITY_BAR_3, DURABILITY_BAR_4, DURABILITY_BAR_5,
- DURABILITY_BAR_6, DURABILITY_BAR_7, DURABILITY_BAR_8,
- ENERGY_BAR_0, ENERGY_BAR_1, ENERGY_BAR_2, ENERGY_BAR_3,
- ENERGY_BAR_4, ENERGY_BAR_5, ENERGY_BAR_6, ENERGY_BAR_7,
- ENERGY_BAR_8,
-
- SKOOKUMCHOOCHER, TURBINE_SMALL, TURBINE_LARGE, TURBINE_HUGE;
+ VOID, // The Empty Texture
+ RENDERING_ERROR,
+ PUMP,
+ SKOOKUMCHOOCHER;
public static final ITexture[] ERROR_RENDERING = new ITexture[]{new GT_RenderedTexture(RENDERING_ERROR)};
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechTextures.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechTextures.java
index d2554de225..5b1a34590f 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechTextures.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechTextures.java
@@ -111,6 +111,7 @@ public class GregtechTextures {
VOID, // The Empty Texture
RENDERING_ERROR, //The Purple/Black Texture
SKOOKUMCHOOCHER, //The Skookum Tool Texture
+ PUMP, // The Hand Pump Texture
TURBINE_SMALL, TURBINE_LARGE, TURBINE_HUGE;
/* public static final Interface_IconContainer[]
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechToolDictNames.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechToolDictNames.java
index 2471e84f54..a6b5e78473 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechToolDictNames.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechToolDictNames.java
@@ -2,6 +2,6 @@ package gtPlusPlus.xmod.gregtech.api.enums;
public enum GregtechToolDictNames {
- craftingToolSkookumChoocher;
+ craftingToolSkookumChoocher, craftingToolHandPump;
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_Pump.java b/src/Java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_Pump.java
new file mode 100644
index 0000000000..f62d9e5cfa
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_Pump.java
@@ -0,0 +1,150 @@
+package gtPlusPlus.xmod.gregtech.api.items.types;
+
+import java.util.Arrays;
+import java.util.List;
+
+import net.minecraft.block.Block;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.World;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.items.GT_MetaBase_Item;
+import gregtech.api.items.GT_MetaGenerated_Tool;
+import gregtech.api.util.GT_LanguageManager;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_Utility;
+
+import ic2.api.tile.IWrenchable;
+import net.minecraftforge.common.util.ForgeDirection;
+
+public class ToolType_Pump
+extends ToolType_Base {
+ private final int mCosts;
+ private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.pump", "Sucks in Machine Input Fluid tank contents on Rightclick");
+
+ public ToolType_Pump(final int aCosts) {
+ this.mCosts = aCosts;
+ }
+
+ public boolean onItemUseFirst(final GT_MetaBase_Item aItem, final ItemStack aStack, final EntityPlayer aPlayer, final World aWorld, final int aX, final int aY, final int aZ, final int aSide, final float hitX, final float hitY, final float hitZ) {
+ if (aWorld.isRemote) {
+ return false;
+ }
+ final Block aBlock = aWorld.getBlock(aX, aY, aZ);
+ if (aBlock == null) {
+ return false;
+ }
+ final byte aMeta = (byte) aWorld.getBlockMetadata(aX, aY, aZ);
+ final byte aTargetSide = GT_Utility.determineWrenchingSide((byte) aSide, hitX, hitY, hitZ);
+ final TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ /*try {
+ if ((aTileEntity != null) && ((aTileEntity instanceof IWrenchable))) {
+ if (((IWrenchable) aTileEntity).wrenchCanSetFacing(aPlayer, aTargetSide)) {
+ if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) {
+ ((IWrenchable) aTileEntity).setFacing(aTargetSide);
+ GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ);
+ }
+ return true;
+ }
+ if (((IWrenchable) aTileEntity).wrenchCanRemove(aPlayer)) {
+ final int tDamage = ((IWrenchable) aTileEntity).getWrenchDropRate() < 1.0F ? 10 : 3;
+ if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, tDamage * this.mCosts))) {
+ ItemStack tOutput = ((IWrenchable) aTileEntity).getWrenchDrop(aPlayer);
+ for (final ItemStack tStack : aBlock.getDrops(aWorld, aX, aY, aZ, aMeta, 0)) {
+ if (tOutput == null) {
+ aWorld.spawnEntityInWorld(new EntityItem(aWorld, aX + 0.5D, aY + 0.5D, aZ + 0.5D, tStack));
+ } else {
+ aWorld.spawnEntityInWorld(new EntityItem(aWorld, aX + 0.5D, aY + 0.5D, aZ + 0.5D, tOutput));
+ tOutput = null;
+ }
+ }
+ aWorld.setBlockToAir(aX, aY, aZ);
+ GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ);
+ }
+ return true;
+ }
+ return true;
+ }
+ } catch (final Throwable e) {
+ }
+ if ((aBlock == Blocks.log) || (aBlock == Blocks.log2) || (aBlock == Blocks.hay_block)) {
+ if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) {
+ aWorld.setBlockMetadataWithNotify(aX, aY, aZ, (aMeta + 4) % 12, 3);
+ GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ);
+ }
+ return true;
+ }
+ if ((aBlock == Blocks.powered_repeater) || (aBlock == Blocks.unpowered_repeater)) {
+ if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) {
+ aWorld.setBlockMetadataWithNotify(aX, aY, aZ, ((aMeta / 4) * 4) + (((aMeta % 4) + 1) % 4), 3);
+ GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ);
+ }
+ return true;
+ }
+ if ((aBlock == Blocks.powered_comparator) || (aBlock == Blocks.unpowered_comparator)) {
+ if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) {
+ aWorld.setBlockMetadataWithNotify(aX, aY, aZ, ((aMeta / 4) * 4) + (((aMeta % 4) + 1) % 4), 3);
+ GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ);
+ }
+ return true;
+ }
+ if ((aBlock == Blocks.crafting_table) || (aBlock == Blocks.bookshelf)) {
+ if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) {
+ aWorld.spawnEntityInWorld(new EntityItem(aWorld, aX + 0.5D, aY + 0.5D, aZ + 0.5D, new ItemStack(aBlock, 1, aMeta)));
+ aWorld.setBlockToAir(aX, aY, aZ);
+ GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ);
+ }
+ return true;
+ }
+ if (aMeta == aTargetSide) {
+ if ((aBlock == Blocks.pumpkin) || (aBlock == Blocks.lit_pumpkin) || (aBlock == Blocks.piston) || (aBlock == Blocks.sticky_piston) || (aBlock == Blocks.dispenser) || (aBlock == Blocks.dropper) || (aBlock == Blocks.furnace) || (aBlock == Blocks.lit_furnace) || (aBlock == Blocks.chest) || (aBlock == Blocks.trapped_chest) || (aBlock == Blocks.ender_chest) || (aBlock == Blocks.hopper)) {
+ if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) {
+ aWorld.spawnEntityInWorld(new EntityItem(aWorld, aX + 0.5D, aY + 0.5D, aZ + 0.5D, new ItemStack(aBlock, 1, 0)));
+ aWorld.setBlockToAir(aX, aY, aZ);
+ GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ);
+ }
+ return true;
+ }
+ } else {
+ if ((aBlock == Blocks.piston) || (aBlock == Blocks.sticky_piston) || (aBlock == Blocks.dispenser) || (aBlock == Blocks.dropper)) {
+ if ((aMeta < 6) && ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts)))) {
+ aWorld.setBlockMetadataWithNotify(aX, aY, aZ, aTargetSide, 3);
+ GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ);
+ }
+ return true;
+ }
+ if ((aBlock == Blocks.pumpkin) || (aBlock == Blocks.lit_pumpkin) || (aBlock == Blocks.furnace) || (aBlock == Blocks.lit_furnace) || (aBlock == Blocks.chest) || (aBlock == Blocks.ender_chest) || (aBlock == Blocks.trapped_chest)) {
+ if ((aTargetSide > 1) && ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts)))) {
+ aWorld.setBlockMetadataWithNotify(aX, aY, aZ, aTargetSide, 3);
+ GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ);
+ }
+ return true;
+ }
+ if (aBlock == Blocks.hopper) {
+ if ((aTargetSide != 1) && ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts)))) {
+ aWorld.setBlockMetadataWithNotify(aX, aY, aZ, aTargetSide, 3);
+ GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ);
+ }
+ return true;
+ }
+ }
+ if ((Arrays.asList(aBlock.getValidRotations(aWorld, aX, aY, aZ)).contains(ForgeDirection.getOrientation(aTargetSide))) &&
+ ((aPlayer.capabilities.isCreativeMode) || (!GT_ModHandler.isElectricItem(aStack)) || (GT_ModHandler.canUseElectricItem(aStack, this.mCosts))) &&
+ (aBlock.rotateBlock(aWorld, aX, aY, aZ, ForgeDirection.getOrientation(aTargetSide)))) {
+ if (!aPlayer.capabilities.isCreativeMode) {
+ ((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts);
+ }
+ GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ);
+ }*/
+ return false;
+ }
+
+ public List<String> getAdditionalToolTips(final GT_MetaBase_Item aItem, final List<String> aList, final ItemStack aStack) {
+ aList.add(this.mTooltip);
+ return aList;
+ }
+}