mirror of
https://github.com/GTNewHorizons/Electro-Magic-Tools.git
synced 2026-11-22 04:52:18 +00:00
Refractored Code
+added Solar Factory -removed unnessecary solar and essentia generator classes +started gtnh researches +added tooltip clearance on solars (maximal output) Signed-off-by: bartimaeusnek <[email protected]>
This commit is contained in:
1 parent
980df8516a
commit
0fecf28b65
397 files changed
+8693
-9288
No files matched your search
@@ -25,97 +25,97 @@ import thaumcraft.common.config.ConfigBlocks;
|
||||
import thaumcraft.common.entities.monster.EntityTaintChicken;
|
||||
|
||||
public class EMTEventHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onLivingHurt(LivingHurtEvent e) {
|
||||
if(!(e.entityLiving instanceof EntityPlayer) || e.source != DamageSource.fall)
|
||||
return;
|
||||
|
||||
ItemStack s = ((EntityPlayer)e.entityLiving).inventory.armorInventory[2];
|
||||
|
||||
if(s == null || !(s.getItem() instanceof ItemFeatherWing)) {
|
||||
return;
|
||||
}
|
||||
|
||||
e.ammount *= ((ItemFeatherWing)s.getItem()).getFallDamageMult();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerTickEvent(TickEvent.PlayerTickEvent e) {
|
||||
|
||||
ItemStack s = e.player.inventory.armorInventory[2];
|
||||
|
||||
if(s == null || !(s.getItem() instanceof ItemFeatherWing) || e.phase == Phase.START) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(e.player.motionY > 0) {
|
||||
if(e.player.fallDistance > 0)
|
||||
e.player.fallDistance -= e.player.motionY;
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onEntityLivingDrops(LivingDropsEvent event) {
|
||||
if (event.entityLiving instanceof EntityCreeper) {
|
||||
EntityCreeper creeper = (EntityCreeper) event.entityLiving;
|
||||
if (creeper.getPowered()) {
|
||||
event.entityLiving.entityDropItem(new ItemStack(EMTItems.itemEMTItems, 1, 6), 1);
|
||||
}
|
||||
}
|
||||
if (event.entityLiving instanceof EntityTaintChicken) {
|
||||
event.entityLiving.entityDropItem(new ItemStack(EMTItems.itemEMTItems, event.entityLiving.worldObj.rand.nextInt(3), 13), 1);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event) {
|
||||
if (event.modID.equals(EMT.MOD_ID)) {
|
||||
EMTConfigHandler.syncConfig();
|
||||
EMT.LOGGER.info("Refreshing configuration file.");
|
||||
}
|
||||
}
|
||||
@SubscribeEvent
|
||||
public void onLivingHurt(LivingHurtEvent e) {
|
||||
if (!(e.entityLiving instanceof EntityPlayer) || e.source != DamageSource.fall)
|
||||
return;
|
||||
|
||||
@SubscribeEvent
|
||||
public void onSetEntityAttack(LivingSetAttackTargetEvent e) {
|
||||
if (e.entityLiving != null && e.target != null && e.entityLiving instanceof EntityLiving && e.target instanceof EntityPlayer) {
|
||||
IInventory inventory = BaublesApi.getBaubles((EntityPlayer) e.target);
|
||||
|
||||
for(int i = 0; i < inventory.getSizeInventory(); i++) {
|
||||
ItemStack stack = inventory.getStackInSlot(i);
|
||||
|
||||
if(stack != null && stack.getItem() == EMTItems.onering) {
|
||||
((EntityLiving)e.entityLiving).setAttackTarget(null);
|
||||
}
|
||||
}
|
||||
ItemStack s = ((EntityPlayer) e.entityLiving).inventory.armorInventory[2];
|
||||
|
||||
if (s == null || !(s.getItem() instanceof ItemFeatherWing)) {
|
||||
return;
|
||||
}
|
||||
|
||||
e.ammount *= ((ItemFeatherWing) s.getItem()).getFallDamageMult();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerTickEvent(TickEvent.PlayerTickEvent e) {
|
||||
|
||||
ItemStack s = e.player.inventory.armorInventory[2];
|
||||
|
||||
if (s == null || !(s.getItem() instanceof ItemFeatherWing) || e.phase == Phase.START) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.player.motionY > 0) {
|
||||
if (e.player.fallDistance > 0)
|
||||
e.player.fallDistance -= e.player.motionY;
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onEntityLivingDrops(LivingDropsEvent event) {
|
||||
if (event.entityLiving instanceof EntityCreeper) {
|
||||
EntityCreeper creeper = (EntityCreeper) event.entityLiving;
|
||||
if (creeper.getPowered()) {
|
||||
event.entityLiving.entityDropItem(new ItemStack(EMTItems.itemEMTItems, 1, 6), 1);
|
||||
}
|
||||
}
|
||||
if (event.entityLiving instanceof EntityTaintChicken) {
|
||||
event.entityLiving.entityDropItem(new ItemStack(EMTItems.itemEMTItems, event.entityLiving.worldObj.rand.nextInt(3), 13), 1);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event) {
|
||||
if (event.modID.equals(EMT.MOD_ID)) {
|
||||
EMTConfigHandler.syncConfig();
|
||||
EMT.LOGGER.info("Refreshing configuration file.");
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onSetEntityAttack(LivingSetAttackTargetEvent e) {
|
||||
if (e.entityLiving instanceof EntityLiving && e.target instanceof EntityPlayer) {
|
||||
IInventory inventory = BaublesApi.getBaubles((EntityPlayer) e.target);
|
||||
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++) {
|
||||
ItemStack stack = inventory.getStackInSlot(i);
|
||||
|
||||
if (stack != null && stack.getItem() == EMTItems.onering) {
|
||||
((EntityLiving) e.entityLiving).setAttackTarget(null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void createCloud(PlayerInteractEvent e) {
|
||||
if (e.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK || e.world.isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
Block block = e.world.getBlock(e.x, e.y, e.z);
|
||||
int meta = e.world.getBlockMetadata(e.x, e.y, e.z);
|
||||
|
||||
if (block != ConfigBlocks.blockAiry || meta != 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack currentStack = e.entityPlayer.inventory.getCurrentItem();
|
||||
if (currentStack == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
double val = ElectricItem.manager.discharge(currentStack, 256, 4, false, true, false);
|
||||
if (val < 256) {
|
||||
return;
|
||||
}
|
||||
|
||||
e.world.setBlock(e.x, e.y, e.z, EMTBlocks.electricCloud);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void createCloud(PlayerInteractEvent e) {
|
||||
if(e.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK || e.world.isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
Block block = e.world.getBlock(e.x, e.y, e.z);
|
||||
int meta = e.world.getBlockMetadata(e.x, e.y, e.z);
|
||||
|
||||
if(block != ConfigBlocks.blockAiry || meta != 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack currentStack = e.entityPlayer.inventory.getCurrentItem();
|
||||
if(currentStack == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
double val = ElectricItem.manager.discharge(currentStack, 256, 4, false, true, false);
|
||||
if(val < 256) {
|
||||
return;
|
||||
}
|
||||
|
||||
e.world.setBlock(e.x, e.y, e.z, EMTBlocks.electricCloud);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user