aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/core/handler
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gtPlusPlus/core/handler')
-rw-r--r--src/main/java/gtPlusPlus/core/handler/AchievementHandler.java14
-rw-r--r--src/main/java/gtPlusPlus/core/handler/COMPAT_HANDLER.java20
-rw-r--r--src/main/java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java4
-rw-r--r--src/main/java/gtPlusPlus/core/handler/GuiHandler.java150
-rw-r--r--src/main/java/gtPlusPlus/core/handler/Recipes/RegistrationHandler.java2
-rw-r--r--src/main/java/gtPlusPlus/core/handler/events/BlockEventHandler.java211
-rw-r--r--src/main/java/gtPlusPlus/core/handler/events/GeneralTooltipEventHandler.java85
-rw-r--r--src/main/java/gtPlusPlus/core/handler/events/PickaxeBlockBreakEventHandler.java66
-rw-r--r--src/main/java/gtPlusPlus/core/handler/events/ZombieBackupSpawnEventHandler.java49
-rw-r--r--src/main/java/gtPlusPlus/core/handler/render/FirepitModel.java118
-rw-r--r--src/main/java/gtPlusPlus/core/handler/render/FirepitRender.java60
11 files changed, 14 insertions, 765 deletions
diff --git a/src/main/java/gtPlusPlus/core/handler/AchievementHandler.java b/src/main/java/gtPlusPlus/core/handler/AchievementHandler.java
index 489d26fa96..74f7287ca3 100644
--- a/src/main/java/gtPlusPlus/core/handler/AchievementHandler.java
+++ b/src/main/java/gtPlusPlus/core/handler/AchievementHandler.java
@@ -28,7 +28,6 @@ import gtPlusPlus.core.material.ELEMENT;
import gtPlusPlus.core.util.minecraft.ItemUtils;
import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils;
import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
-import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools;
public class AchievementHandler {
@@ -60,17 +59,6 @@ public class AchievementHandler {
"",
true);
- // Useful Info
- boolean cores = CORE.ConfigSwitches.requireControlCores;
- if (cores || GregtechMeta_MultiBlockBase.DEBUG_DISABLE_CORES_TEMPORARILY) {
- this.registerAchievement(
- "hatch.control",
- -2,
- -2,
- GregtechItemList.Hatch_Control_Core.get(1),
- aBaseAchievementName,
- false);
- }
this.registerAchievement(
"hatch.dynamo.buffered",
2,
@@ -84,7 +72,7 @@ public class AchievementHandler {
-4,
-2,
GregtechItemList.Industrial_AlloyBlastSmelter.get(1),
- cores ? "hatch.control" : aBaseAchievementName,
+ aBaseAchievementName,
true);
// Material Advancement
diff --git a/src/main/java/gtPlusPlus/core/handler/COMPAT_HANDLER.java b/src/main/java/gtPlusPlus/core/handler/COMPAT_HANDLER.java
index 8e9a1ca330..5b7d1de7fb 100644
--- a/src/main/java/gtPlusPlus/core/handler/COMPAT_HANDLER.java
+++ b/src/main/java/gtPlusPlus/core/handler/COMPAT_HANDLER.java
@@ -1,6 +1,5 @@
package gtPlusPlus.core.handler;
-import static gregtech.api.enums.Mods.EnderIO;
import static gregtech.api.enums.Mods.ExtraUtilities;
import static gregtech.api.enums.Mods.OpenBlocks;
import static gregtech.api.enums.Mods.PamsHarvestCraft;
@@ -20,7 +19,6 @@ import gtPlusPlus.api.interfaces.RunnableWithInfo;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.api.objects.data.AutoMap;
import gtPlusPlus.api.objects.minecraft.ItemPackage;
-import gtPlusPlus.core.common.compat.COMPAT_EnderIO;
import gtPlusPlus.core.common.compat.COMPAT_ExtraUtils;
import gtPlusPlus.core.common.compat.COMPAT_HarvestCraft;
import gtPlusPlus.core.common.compat.COMPAT_IC2;
@@ -29,7 +27,6 @@ import gtPlusPlus.core.common.compat.COMPAT_Thaumcraft;
import gtPlusPlus.core.common.compat.COMPAT_Witchery;
import gtPlusPlus.core.handler.Recipes.LateRegistrationHandler;
import gtPlusPlus.core.handler.Recipes.RegistrationHandler;
-import gtPlusPlus.core.item.ModItems;
import gtPlusPlus.core.material.Material;
import gtPlusPlus.core.material.MaterialGenerator;
import gtPlusPlus.core.recipe.RECIPES_GREGTECH;
@@ -37,8 +34,6 @@ import gtPlusPlus.core.recipe.RECIPES_LaserEngraver;
import gtPlusPlus.core.recipe.ShapedRecipeObject;
import gtPlusPlus.core.util.minecraft.ItemUtils;
import gtPlusPlus.core.util.minecraft.RecipeUtils;
-import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
-import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GregtechMetaGarbageCollector;
import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_FluidCanning;
import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_Recycling;
import gtPlusPlus.xmod.gregtech.loaders.recipe.RecipeLoader_ChemicalSkips;
@@ -93,7 +88,6 @@ import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechPowerSubStation;
import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechQuantumForceTransformer;
import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechRTG;
import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechRocketFuelGenerator;
-import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechSafeBlock;
import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechSemiFluidgenerators;
import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechSimpleWasher;
import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechSolarGenerators;
@@ -119,9 +113,6 @@ public class COMPAT_HANDLER {
Logger.INFO("Registering Materials with OreDict.");
// In-house
- // tools
- GT_OreDictUnificator.registerOre("craftingToolSandHammer", new ItemStack(ModItems.itemSandstoneHammer));
-
for (int i = 1; i <= 10; i++) {
GT_OreDictUnificator.registerOre(
"bufferCore_" + GT_Values.VN[i - 1],
@@ -130,13 +121,6 @@ public class COMPAT_HANDLER {
}
public static void registerGregtechMachines() {
- // Debug
- GregtechItemList.Garbage_Collector_Debug_Machine.set(
- new GregtechMetaGarbageCollector(
- "garbagecollector.01.tier.single",
- "JVM Garbage Collector",
- "Useful for debugging or smoother performance on local servers").getStackForm(1L));
-
// Free IDs
/*
* --- 859 to 868 --- 911 to 940
@@ -148,7 +132,6 @@ public class COMPAT_HANDLER {
GregtechLFTR.run();
GregtechNuclearSaltProcessingPlant.run();
GregtechSteamCondenser.run();
- GregtechSafeBlock.run();
GregtechIndustrialCentrifuge.run();
GregtechIndustrialCokeOven.run();
GregtechIndustrialPlatePress.run();
@@ -210,9 +193,6 @@ public class COMPAT_HANDLER {
// InterMod
public static void intermodOreDictionarySupport() {
- if (EnderIO.isModLoaded()) {
- COMPAT_EnderIO.OreDict();
- }
if (OpenBlocks.isModLoaded()) {
COMPAT_OpenBlocks.OreDict();
}
diff --git a/src/main/java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java b/src/main/java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java
index d51acebcac..f511e3e6ae 100644
--- a/src/main/java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java
+++ b/src/main/java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java
@@ -12,8 +12,6 @@ import gtPlusPlus.xmod.gregtech.HANDLER_GT;
import gtPlusPlus.xmod.ic2.HANDLER_IC2;
import gtPlusPlus.xmod.ob.HANDLER_OpenBlocks;
import gtPlusPlus.xmod.railcraft.HANDLER_Railcraft;
-import gtPlusPlus.xmod.sc2.HANDLER_SC2;
-import gtPlusPlus.xmod.sol.HANDLER_SpiceOfLife;
import gtPlusPlus.xmod.thaumcraft.HANDLER_Thaumcraft;
import gtPlusPlus.xmod.thermalfoundation.HANDLER_TF;
import gtPlusPlus.xmod.tinkers.HANDLER_Tinkers;
@@ -26,10 +24,8 @@ public class COMPAT_IntermodStaging {
HANDLER_FR.preInit();
HANDLER_IC2.preInit();
HANDLER_BiomesOPlenty.preInit();
- HANDLER_SC2.preInit();
HANDLER_CropsPlusPlus.preInit(preinit);
HANDLER_Railcraft.preInit();
- HANDLER_SpiceOfLife.preInit();
}
public static void init(FMLInitializationEvent init) {
diff --git a/src/main/java/gtPlusPlus/core/handler/GuiHandler.java b/src/main/java/gtPlusPlus/core/handler/GuiHandler.java
index 04ad22178b..e0b9e71c2d 100644
--- a/src/main/java/gtPlusPlus/core/handler/GuiHandler.java
+++ b/src/main/java/gtPlusPlus/core/handler/GuiHandler.java
@@ -10,86 +10,43 @@ import cpw.mods.fml.common.network.NetworkRegistry;
import gtPlusPlus.GTplusplus;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.block.machine.Machine_SuperJukebox.TileEntitySuperJukebox;
-import gtPlusPlus.core.container.Container_BackpackBase;
-import gtPlusPlus.core.container.Container_CircuitProgrammer;
-import gtPlusPlus.core.container.Container_DecayablesChest;
-import gtPlusPlus.core.container.Container_EggBox;
-import gtPlusPlus.core.container.Container_FishTrap;
-import gtPlusPlus.core.container.Container_Grindle;
-import gtPlusPlus.core.container.Container_ModularityTable;
-import gtPlusPlus.core.container.Container_PestKiller;
-import gtPlusPlus.core.container.Container_ProjectTable;
-import gtPlusPlus.core.container.Container_RoundRobinator;
-import gtPlusPlus.core.container.Container_SuperJukebox;
-import gtPlusPlus.core.container.Container_TradeTable;
-import gtPlusPlus.core.container.Container_VolumetricFlaskSetter;
-import gtPlusPlus.core.container.box.LunchBoxContainer;
-import gtPlusPlus.core.container.box.MagicBagContainer;
-import gtPlusPlus.core.container.box.ToolBoxContainer;
+import gtPlusPlus.core.container.*;
import gtPlusPlus.core.gui.beta.Gui_ID_Registry;
import gtPlusPlus.core.gui.beta.MU_GuiId;
-import gtPlusPlus.core.gui.item.GuiBaseBackpack;
-import gtPlusPlus.core.gui.item.GuiBaseGrindle;
-import gtPlusPlus.core.gui.item.box.LunchBoxGui;
-import gtPlusPlus.core.gui.item.box.MagicBagGui;
-import gtPlusPlus.core.gui.item.box.ToolBoxGui;
-import gtPlusPlus.core.gui.machine.GUI_CircuitProgrammer;
-import gtPlusPlus.core.gui.machine.GUI_DecayablesChest;
-import gtPlusPlus.core.gui.machine.GUI_EggBox;
-import gtPlusPlus.core.gui.machine.GUI_FishTrap;
-import gtPlusPlus.core.gui.machine.GUI_ModularityTable;
-import gtPlusPlus.core.gui.machine.GUI_PestKiller;
-import gtPlusPlus.core.gui.machine.GUI_ProjectTable;
-import gtPlusPlus.core.gui.machine.GUI_RoundRobinator;
-import gtPlusPlus.core.gui.machine.GUI_SuperJukebox;
-import gtPlusPlus.core.gui.machine.GUI_TradeTable;
-import gtPlusPlus.core.gui.machine.GUI_VolumetricFlaskSetter;
+import gtPlusPlus.core.gui.machine.*;
import gtPlusPlus.core.interfaces.IGuiManager;
-import gtPlusPlus.core.inventories.BaseInventoryBackpack;
-import gtPlusPlus.core.inventories.BaseInventoryGrindle;
-import gtPlusPlus.core.inventories.box.LunchBoxInventory;
-import gtPlusPlus.core.inventories.box.MagicBagInventory;
-import gtPlusPlus.core.inventories.box.ToolBoxInventory;
-import gtPlusPlus.core.tileentities.base.TileEntityBase;
import gtPlusPlus.core.tileentities.general.TileEntityCircuitProgrammer;
import gtPlusPlus.core.tileentities.general.TileEntityDecayablesChest;
-import gtPlusPlus.core.tileentities.general.TileEntityEggBox;
import gtPlusPlus.core.tileentities.general.TileEntityFishTrap;
import gtPlusPlus.core.tileentities.general.TileEntityVolumetricFlaskSetter;
-import gtPlusPlus.core.tileentities.machines.TileEntityModularityTable;
import gtPlusPlus.core.tileentities.machines.TileEntityPestKiller;
import gtPlusPlus.core.tileentities.machines.TileEntityProjectTable;
import gtPlusPlus.core.tileentities.machines.TileEntityRoundRobinator;
-import gtPlusPlus.core.tileentities.machines.TileEntityTradeTable;
public class GuiHandler implements IGuiHandler {
public static final int GUI1 = 0; // Project Table
- public static final int GUI2 = 1; // Helium Generator
- public static final int GUI3 = 2; // BackpackHandler
+ public static final int GUI2 = 1; // None
+ public static final int GUI3 = 2; // None
public static final int GUI4 = 3; // Workbench
public static final int GUI5 = 4; // Workbench Adv
public static final int GUI6 = 5; // Fish trap
- public static final int GUI7 = 6; // Trade table
+ public static final int GUI7 = 6; // None
public static final int GUI8 = 7; // Circuit Programmer
- public static final int GUI9 = 8; // Grindle
- public static final int GUI10 = 9; // Universal Toolbox
- public static final int GUI11 = 10; // Auto Lunchbox
- public static final int GUI12 = 11; // Bag for Magic Tools
+ public static final int GUI9 = 8; // None
+ public static final int GUI10 = 9; // None
+ public static final int GUI11 = 10; // None
+ public static final int GUI12 = 11; // None
public static final int GUI13 = 12; // Decayables Chest
public static final int GUI14 = 13; // Super Jukebox
public static final int GUI15 = 14; // Pest Killer
public static final int GUI16 = 15; // Round-Robinator
- public static final int GUI17 = 16; // Egg Box
+ public static final int GUI17 = 16; // None
public static final int GUI18 = 17; // Volumetric Flask Setter
public static void init() {
-
Logger.INFO("Registering GUIs.");
NetworkRegistry.INSTANCE.registerGuiHandler(GTplusplus.instance, new GuiHandler());
- // Register GuiHandler
- // NetworkRegistry.INSTANCE.registerGuiHandler(GTplusplus.instance, new
- // GuiHandler());
}
@Override // ContainerModTileEntity
@@ -100,29 +57,15 @@ public class GuiHandler implements IGuiHandler {
if (te != null) {
if (ID == GUI1) {
return new Container_ProjectTable(player.inventory, (TileEntityProjectTable) te);
- } else if (ID == GUI2) {
- return new Container_ModularityTable(player.inventory, (TileEntityModularityTable) te);
- }
- }
-
- if (ID == GUI3) {
- // Use the player's held item to create the inventory
- return new Container_BackpackBase(
- player,
- player.inventory,
- new BaseInventoryBackpack(player.getHeldItem()));
+ } else if (ID == GUI2) {}
}
if (te != null) {
- if (ID == GUI4) {
- // return new Container_Workbench(player.inventory, (TileEntityWorkbench) te);
- } else if (ID == GUI5) {
+ if (ID == GUI5) {
Logger.INFO("sad");
// return new Container_WorkbenchAdvanced(player.inventory, (TileEntityWorkbenchAdvanced) te);
} else if (ID == GUI6) {
return new Container_FishTrap(player.inventory, (TileEntityFishTrap) te);
- } else if (ID == GUI7) {
- return new Container_TradeTable(player.inventory, (TileEntityTradeTable) te);
} else if (ID == GUI8) {
return new Container_CircuitProgrammer(player.inventory, (TileEntityCircuitProgrammer) te);
} else if (ID == GUI13) {
@@ -133,27 +76,11 @@ public class GuiHandler implements IGuiHandler {
return new Container_PestKiller(player.inventory, (TileEntityPestKiller) te);
} else if (ID == GUI16) {
return new Container_RoundRobinator(player.inventory, (TileEntityRoundRobinator) te);
- } else if (ID == GUI17) {
- return new Container_EggBox(player.inventory, (TileEntityEggBox) te);
} else if (ID == GUI18) {
return new Container_VolumetricFlaskSetter(player.inventory, (TileEntityVolumetricFlaskSetter) te);
}
}
- if (ID == GUI9) {
- return new Container_Grindle(player, player.inventory, new BaseInventoryGrindle(player.getHeldItem()));
- }
- // Tool, lunch, magic
- if (ID == GUI10) {
- return new ToolBoxContainer(player, player.inventory, new ToolBoxInventory(player.getHeldItem()));
- }
- if (ID == GUI11) {
- return new LunchBoxContainer(player, player.inventory, new LunchBoxInventory(player.getHeldItem()));
- }
- if (ID == GUI12) {
- return new MagicBagContainer(player, player.inventory, new MagicBagInventory(player.getHeldItem()));
- }
-
return null;
}
@@ -175,34 +102,12 @@ public class GuiHandler implements IGuiHandler {
if (te != null) {
if (ID == GUI1) {
return new GUI_ProjectTable(player.inventory, (TileEntityProjectTable) te);
- } else if (ID == GUI2) {
- return new GUI_ModularityTable(player.inventory, (TileEntityModularityTable) te);
}
}
- if (ID == GUI3) {
- // We have to cast the new container as our custom class
- // and pass in currently held item for the inventory
- return new GuiBaseBackpack(
- new Container_BackpackBase(
- player,
- player.inventory,
- new BaseInventoryBackpack(player.getHeldItem())));
- }
-
if (te != null) {
- if (ID == GUI4) {
- // return new GUI_Workbench(player.inventory, (TileEntityWorkbench) te);
- } else if (ID == GUI5) {
- Logger.INFO("sad");
- // return new GUI_WorkbenchAdvanced(player.inventory, (TileEntityWorkbenchAdvanced) te);
- } else if (ID == GUI6) {
+ if (ID == GUI6) {
return new GUI_FishTrap(player.inventory, (TileEntityFishTrap) te);
- } else if (ID == GUI7) {
- return new GUI_TradeTable(
- player.inventory,
- (TileEntityTradeTable) te,
- ((TileEntityBase) te).getOwner());
} else if (ID == GUI8) {
return new GUI_CircuitProgrammer(player.inventory, (TileEntityCircuitProgrammer) te);
} else if (ID == GUI13) {
@@ -213,33 +118,12 @@ public class GuiHandler implements IGuiHandler {
return new GUI_PestKiller(player.inventory, (TileEntityPestKiller) te);
} else if (ID == GUI16) {
return new GUI_RoundRobinator(player.inventory, (TileEntityRoundRobinator) te);
- } else if (ID == GUI17) {
- return new GUI_EggBox(player.inventory, (TileEntityEggBox) te);
} else if (ID == GUI18) {
return new GUI_VolumetricFlaskSetter(
new Container_VolumetricFlaskSetter(player.inventory, (TileEntityVolumetricFlaskSetter) te));
}
}
- if (ID == GUI9) {
- return new GuiBaseGrindle(
- new Container_Grindle(player, player.inventory, new BaseInventoryGrindle(player.getHeldItem())));
- }
-
- // Tool, lunch, magic
- if (ID == GUI10) {
- return new ToolBoxGui(
- new ToolBoxContainer(player, player.inventory, new ToolBoxInventory(player.getHeldItem())));
- }
- if (ID == GUI11) {
- return new LunchBoxGui(
- new LunchBoxContainer(player, player.inventory, new LunchBoxInventory(player.getHeldItem())));
- }
- if (ID == GUI12) {
- return new MagicBagGui(
- new MagicBagContainer(player, player.inventory, new MagicBagInventory(player.getHeldItem())));
- }
-
return null;
}
@@ -265,12 +149,4 @@ public class GuiHandler implements IGuiHandler {
return (data << 16) | guiId.getId();
}
- private static MU_GuiId decodeGuiID(final int guiData) {
- final int guiId = guiData & 0xFF;
- return Gui_ID_Registry.getGuiId(guiId);
- }
-
- private static short decodeGuiData(final int guiId) {
- return (short) (guiId >> 16);
- }
}
diff --git a/src/main/java/gtPlusPlus/core/handler/Recipes/RegistrationHandler.java b/src/main/java/gtPlusPlus/core/handler/Recipes/RegistrationHandler.java
index 12acc8b4d3..005ebba204 100644
--- a/src/main/java/gtPlusPlus/core/handler/Recipes/RegistrationHandler.java
+++ b/src/main/java/gtPlusPlus/core/handler/Recipes/RegistrationHandler.java
@@ -5,7 +5,6 @@ import gtPlusPlus.core.handler.COMPAT_HANDLER;
import gtPlusPlus.core.recipe.RECIPES_General;
import gtPlusPlus.core.recipe.RECIPES_MachineComponents;
import gtPlusPlus.core.recipe.RECIPES_Machines;
-import gtPlusPlus.core.recipe.RECIPES_Tools;
import gtPlusPlus.core.recipe.RECIPE_Batteries;
public class RegistrationHandler {
@@ -18,7 +17,6 @@ public class RegistrationHandler {
}
private static final void init() {
- RECIPES_Tools.loadRecipes();
RECIPES_General.loadRecipes();
RECIPES_Machines.loadRecipes();
RECIPES_MachineComponents.loadRecipes();
diff --git a/src/main/java/gtPlusPlus/core/handler/events/BlockEventHandler.java b/src/main/java/gtPlusPlus/core/handler/events/BlockEventHandler.java
deleted file mode 100644
index e2ea5746a1..0000000000
--- a/src/main/java/gtPlusPlus/core/handler/events/BlockEventHandler.java
+++ /dev/null
@@ -1,211 +0,0 @@
-package gtPlusPlus.core.handler.events;
-
-import static gregtech.api.enums.Mods.Thaumcraft;
-import static gtPlusPlus.core.lib.CORE.ConfigSwitches.chanceToDropDrainedShard;
-import static gtPlusPlus.core.lib.CORE.ConfigSwitches.chanceToDropFluoriteOre;
-
-import java.util.ArrayList;
-
-import net.minecraft.block.Block;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.init.Blocks;
-import net.minecraft.item.ItemStack;
-import net.minecraftforge.event.entity.living.LivingDropsEvent;
-import net.minecraftforge.event.entity.player.PlayerInteractEvent;
-import net.minecraftforge.event.world.BlockEvent;
-import net.minecraftforge.oredict.OreDictionary;
-
-import cpw.mods.fml.common.eventhandler.SubscribeEvent;
-import gtPlusPlus.api.objects.Logger;
-import gtPlusPlus.core.item.ModItems;
-import gtPlusPlus.core.material.nuclear.FLUORIDES;
-import gtPlusPlus.core.util.math.MathUtils;
-import gtPlusPlus.core.util.minecraft.ItemUtils;
-import gtPlusPlus.core.util.minecraft.PlayerUtils;
-
-public class BlockEventHandler {
-
- public static ArrayList<ItemStack> oreLimestone;
- public static ArrayList<ItemStack> blockLimestone;
- public static ItemStack fluoriteOre;
-
- public static void init() {
- // Set Variables for Fluorite Block handling
- Logger.INFO("Setting some Variables for the block break event handler.");
- BlockEventHandler.oreLimestone = OreDictionary.getOres("oreLimestone");
- BlockEventHandler.blockLimestone = OreDictionary.getOres("limestone");
- BlockEventHandler.fluoriteOre = FLUORIDES.FLUORITE.getOre(1);
- }
-
- @SubscribeEvent
- public void onBlockLeftClicked(final PlayerInteractEvent event) {
- /*
- * if (event.action != PlayerInteractEvent.Action.LEFT_CLICK_BLOCK) return; ItemStack heldItem =
- * event.entityPlayer.getHeldItem(); Block block = event.world.getBlock(event.x, event.y, event.z); // If the
- * block clicked was Stone, the player was holding an Iron Pickaxe and a random integer from 0 (inclusive) to 2
- * (exclusive) is 0 (50% chance) if (block == Blocks.stone && heldItem != null && heldItem.getItem() ==
- * Items.iron_pickaxe && random.nextInt(2) == 0) { ForgeDirection direction =
- * ForgeDirection.getOrientation(event.face); // Convert the numeric face to a ForgeDirection int fireX =
- * event.x + direction.offsetX, fireY = event.y + direction.offsetY, fireZ = event.z + direction.offsetZ; //
- * Offset the block's coordinates according to the direction if (event.world.isAirBlock(fireX, fireY, fireZ)) {
- * // If the block at the new coordinates is Air event.world.setBlock(fireX, fireY, fireZ, Blocks.fire); //
- * Replace it with Fire event.useBlock = Event.Result.DENY; // Prevent the Fire from being extinguished (also
- * prevents Block#onBlockClicked from being called) } }
- */
- }
-
- @SubscribeEvent
- public void onEntityDrop(final LivingDropsEvent event) {
- /*
- * if (event.entityLiving instanceof EntityPig && event.source instanceof EntityDamageSource) { // getEntity
- * will return the Entity that caused the damage,even for indirect damage sources like arrows/fireballs //
- * (where it will return the Entity that shot the projectile rather than the projectile itself) Entity
- * sourceEntity = event.source.getEntity(); ItemStack heldItem = sourceEntity instanceof EntityLiving ?
- * ((EntityLiving) sourceEntity).getHeldItem() : sourceEntity instanceof EntityPlayer ? ((EntityPlayer)
- * sourceEntity).getHeldItem() : null; if (heldItem != null && heldItem.getItem() == Items.iron_pickaxe) {
- * System.out.println("EntityPig drops event"); event.drops.clear(); event.entityLiving.dropItem(Items.diamond,
- * 64); } }
- */
- }
-
- @SubscribeEvent
- public void onBlockBreak(final BlockEvent.BreakEvent event) {}
-
- // Used to handle Thaumcraft Shards when TC is not installed.
- @SubscribeEvent
- public void harvestDrops(final BlockEvent.HarvestDropsEvent event) {
- try {
-
- if (event != null && event.harvester != null && event.harvester.worldObj != null) {
- if (!event.harvester.worldObj.isRemote) {
-
- EntityPlayer p = event.harvester;
-
- if (PlayerUtils.isRealPlayer(p)) {
- // Spawns Fluorite from Lime Stone
- if (chanceToDropFluoriteOre != 0) {
- if (!oreLimestone.isEmpty() || !blockLimestone.isEmpty()) {
-
- ArrayList<Block> mBlockTypes = new ArrayList<Block>();
- if (!oreLimestone.isEmpty()) {
- for (int i = 0; i < oreLimestone.size(); i++) {
- if (ItemUtils.getModId(oreLimestone.get(i)) != null
- && !ItemUtils.getModId(oreLimestone.get(i)).toLowerCase()
- .contains("biomesoplenty")) {
- if (!mBlockTypes
- .contains(Block.getBlockFromItem(oreLimestone.get(i).getItem()))) {
- mBlockTypes.add(Block.getBlockFromItem(oreLimestone.get(i).getItem()));
- }
- }
- }
- }
- if (!blockLimestone.isEmpty()) {
- for (int i = 0; i < blockLimestone.size(); i++) {
- if (ItemUtils.getModId(blockLimestone.get(i)) != null
- && !ItemUtils.getModId(blockLimestone.get(i)).toLowerCase()
- .contains("biomesoplenty")) {
- if (!mBlockTypes.contains(
- Block.getBlockFromItem(blockLimestone.get(i).getItem()))) {
- mBlockTypes
- .add(Block.getBlockFromItem(blockLimestone.get(i).getItem()));
- }
- }
- }
- }
-
- Logger.WARNING("Found Limestone in OreDict.");
- if (!mBlockTypes.isEmpty()) {
- Logger.WARNING("1a | " + event.block.getUnlocalizedName());
- for (final Block temp : mBlockTypes) {
- Logger.WARNING("2a - " + temp.getUnlocalizedName());
- if (event.block == temp) {
- Logger.WARNING("3a - found " + temp.getUnlocalizedName());
- if (MathUtils.randInt(1, chanceToDropFluoriteOre) == 1) {
- Logger.WARNING("4a");
- event.drops.clear();
- event.drops.add(fluoriteOre.copy());
- }
- }
- }
- }
- }
-
- if (event.block.getUnlocalizedName().toLowerCase().contains("limestone")) {
- Logger.WARNING("1c");
- if (MathUtils.randInt(1, chanceToDropFluoriteOre) == 1) {
- Logger.WARNING("2c");
- event.drops.clear();
- event.drops.add(fluoriteOre.copy());
- }
- }
-
- if (event.block == Blocks.sandstone) {
- if (MathUtils.randInt(1, chanceToDropFluoriteOre * 20) == 1) {
- event.drops.clear();
- event.drops.add(fluoriteOre.copy());
- }
- }
- }
- }
-
- // Do things that can occur for fake players and real players
-
- // Spawn Dull Shards (Can spawn from Tree Logs, Grass or Stone. Stone going to
- // be the most common source.)
- if (((event.block == Blocks.stone) || (event.block == Blocks.sandstone)
- || (event.block == Blocks.log)
- || (event.block == Blocks.log2)
- || (event.block == Blocks.grass)) && !Thaumcraft.isModLoaded()
- && (chanceToDropDrainedShard != 0)) {
- // small chance for one to spawn per stone mined. 1 per 3 stacks~
- if (MathUtils.randInt(1, chanceToDropDrainedShard) == 1) {
- // Let's sort out a lucky charm for the player.
- final int FancyChance = MathUtils.randInt(1, 4);
- if (MathUtils.randInt(1, 100) < 90) {
- event.drops.add(new ItemStack(ModItems.shardDull));
- }
- // Make a Fire Shard
- else if (FancyChance == 1) {
- event.drops.add(new ItemStack(ModItems.shardIgnis));
- }
- // Make a Water Shard.
- else if (FancyChance == 2) {
- event.drops.add(new ItemStack(ModItems.shardAqua));
- }
- // Make an Earth Shard.
- else if (FancyChance == 3) {
- event.drops.add(new ItemStack(ModItems.shardTerra));
- }
- // Make an Air Shard.
- else if (FancyChance == 4) {
- event.drops.add(new ItemStack(ModItems.shardAer));
- }
- } else {
- Logger.WARNING("invalid chance");
- }
- }
- }
- }
- } catch (Throwable r) {
- Logger.INFO("Block Event Handler Failed. Please Report this to Alkalus.");
- r.printStackTrace();
- }
- }
-
- @SubscribeEvent
- public void logsHarvest(final BlockEvent.HarvestDropsEvent event) {
- /*
- * if (event.block instanceof BlockLog) { //
- * http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/
- * modification-development/2444501-harvestdropevent-changing-drops-of-vanilla- blocks //
- * Utils.sendServerMessage("Logs! Harvester: %s Drops: %s", event.harvester != null ?
- * event.harvester.getCommandSenderName() : "<none>",
- * event.drops.stream().map(ItemStack.toString()).collect(Collectors. joining(", "))); if (event.harvester !=
- * null) { ItemStack heldItem = event.harvester.getHeldItem(); if (heldItem == null ||
- * heldItem.getItem().getHarvestLevel(heldItem, "axe") < 1) { event.drops.clear();
- * Utils.sendServerMessage("Harvester had wrong tool, clearing drops"); } else {
- * Utils.sendServerMessage("Harvester had correct tool, not clearing drops"); } } else { event.drops.clear();
- * Utils.sendServerMessage("No harvester, clearing drops"); } }
- */
- }
-}
diff --git a/src/main/java/gtPlusPlus/core/handler/events/GeneralTooltipEventHandler.java b/src/main/java/gtPlusPlus/core/handler/events/GeneralTooltipEventHandler.java
index 6aa9fde2a8..867a2538f3 100644
--- a/src/main/java/gtPlusPlus/core/handler/events/GeneralTooltipEventHandler.java
+++ b/src/main/java/gtPlusPlus/core/handler/events/GeneralTooltipEventHandler.java
@@ -1,100 +1,15 @@
package gtPlusPlus.core.handler.events;
-import net.minecraft.block.Block;
import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import advsolar.common.AdvancedSolarPanel;
import cpw.mods.fml.common.Optional;
-import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import gregtech.api.enums.Mods;
-import gtPlusPlus.GTplusplus;
-import gtPlusPlus.GTplusplus.INIT_PHASE;
-import gtPlusPlus.core.block.ModBlocks;
-import gtPlusPlus.core.lib.CORE;
-import gtPlusPlus.core.util.math.MathUtils;
-import gtPlusPlus.core.util.minecraft.ItemUtils;
-import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
public class GeneralTooltipEventHandler {
- ItemStack[] mGregtechTurbines = new ItemStack[6];
- String mTurbine;
- String mExtra;
-
- @SubscribeEvent
- public void onItemTooltip(ItemTooltipEvent event) {
-
- if (GTplusplus.CURRENT_LOAD_PHASE != INIT_PHASE.STARTED
- && GTplusplus.CURRENT_LOAD_PHASE != INIT_PHASE.SERVER_START) {
- return;
- }
- if (event.itemStack == null) {
- return;
- }
- if (CORE.ConfigSwitches.chanceToDropFluoriteOre > 0) {
- if (BlockEventHandler.blockLimestone != null && !BlockEventHandler.blockLimestone.isEmpty()) {
- for (ItemStack h : BlockEventHandler.blockLimestone) {
- if (h != null && Block.getBlockFromItem(h.getItem())
- == Block.getBlockFromItem(event.itemStack.getItem())) {
- if (ItemUtils.getModId(h) != null
- && !ItemUtils.getModId(h).toLowerCase().contains("biomesoplenty")) {
- event.toolTip.add("May contain Fluorite Ore");
- }
- }
- }
- }
- if (BlockEventHandler.oreLimestone != null && !BlockEventHandler.oreLimestone.isEmpty()) {
- for (ItemStack h : BlockEventHandler.oreLimestone) {
- if (h != null && Block.getBlockFromItem(h.getItem())
- == Block.getBlockFromItem(event.itemStack.getItem())) {
- if (ItemUtils.getModId(h) != null
- && !ItemUtils.getModId(h).toLowerCase().contains("biomesoplenty")) {
- event.toolTip.add("May contain Fluorite Ore");
- }
- }
- }
- }
- }
-
- // Material Collector Tooltips
- if (ModBlocks.blockPooCollector != null
- && Block.getBlockFromItem(event.itemStack.getItem()) == ModBlocks.blockPooCollector) {
- // Normal
- if (event.itemStack.getItemDamage() == 0) {
- event.toolTip.add("Used to collect animal waste");
- event.toolTip.add("Collects in a 5x4x5 area starting at Y+1");
- event.toolTip.add("Use Hoppers/Pipes to empty");
- event.toolTip.add(EnumChatFormatting.GOLD + "Capacity: " + EnumChatFormatting.AQUA + "8000L");
- }
- // Advanced
- else {
- event.toolTip.add("Used to collect waste (Works on more than animals)");
- event.toolTip.add("Significantly faster than the simple version");
- event.toolTip.add("Collects in a 5x4x5 area starting at Y+1");
- event.toolTip.add("Use Hoppers/Pipes to empty");
- event.toolTip.add(EnumChatFormatting.GOLD + "Capacity: " + EnumChatFormatting.AQUA + "128000L");
- }
- }
-
- // Custom Flasks
-
- if (GregtechItemList.VOLUMETRIC_FLASK_8k.hasBeenSet()
- && event.itemStack.getItem() == GregtechItemList.VOLUMETRIC_FLASK_8k.getItem()) {
- event.toolTip.add("Max Capacity: " + MathUtils.formatNumbers(8000) + "L");
-