From 7222257c4ba66e8c92a4d0ee4bc958308c3e564d Mon Sep 17 00:00:00 2001 From: Jacky1356400 Date: Sat, 4 Nov 2017 22:27:24 +0800 Subject: [PATCH] Bumped version to 2.5.2 --- gradle.properties | 4 +- .../me/jacky1356400/exchangers/Config.java | 36 ++++++------- .../exchangers/handler/EventsHandler.java | 52 +++++++++++++++++++ .../exchangers/proxy/CommonProxy.java | 2 + .../me/jacky1356400/exchangers/util/Data.java | 2 +- src/main/resources/mcmod.info | 2 +- 6 files changed, 76 insertions(+), 22 deletions(-) create mode 100644 src/main/java/me/jacky1356400/exchangers/handler/EventsHandler.java diff --git a/gradle.properties b/gradle.properties index a0e7b5b..6d56266 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,6 +2,6 @@ # This is required to provide enough memory for the Minecraft decompilation process. org.gradle.jvmargs=-Xmx4G mc_version=1.12 -forge_version=1.12.2-14.23.0.2515 -mod_version=2.5.1 +forge_version=1.12.2-14.23.0.2529 +mod_version=2.5.2 mappings_version=snapshot_20170917 diff --git a/src/main/java/me/jacky1356400/exchangers/Config.java b/src/main/java/me/jacky1356400/exchangers/Config.java index b4b8898..612fae4 100644 --- a/src/main/java/me/jacky1356400/exchangers/Config.java +++ b/src/main/java/me/jacky1356400/exchangers/Config.java @@ -192,84 +192,84 @@ private static void initConfig(Configuration cfg) { conductiveMaxEnergy = cfg.getInt("Conductive Iron Exchanger Capacity", CATEGORY_TWEAKS_EIO, 80000, 1000, Integer.MAX_VALUE, "Set the RF capacity for Conductive Iron Exchanger"); conductivePerBlockUse = cfg.getInt("Conductive Iron Exchanger Power Consumption", - CATEGORY_TWEAKS_EIO, 10, 1, conductiveMaxEnergy, "Set the Rf consumption per block for Conductive Iron Exchanger"); + CATEGORY_TWEAKS_EIO, 10, 1, conductiveMaxEnergy / 10, "Set the Rf consumption per block for Conductive Iron Exchanger"); pulsatingMaxEnergy = cfg.getInt("Pulsating Iron Exchanger Capacity", CATEGORY_TWEAKS_EIO, 400000, 1000, Integer.MAX_VALUE, "Set the RF capacity for Pulsating Iron Exchanger"); pulsatingPerBlockUse = cfg.getInt("Pulsating Iron Exchanger Power Consumption", CATEGORY_TWEAKS_EIO, - 50, 1, pulsatingMaxEnergy, "Set the RF consumption per block for Pulsating Iron Exchanger"); + 50, 1, pulsatingMaxEnergy / 10, "Set the RF consumption per block for Pulsating Iron Exchanger"); electricalSteelMaxEnergy = cfg.getInt("Electrical Steel Exchanger Capacity", CATEGORY_TWEAKS_EIO, 800000, 1000, Integer.MAX_VALUE, "Set the RF capacity for Electrical Steel Exchanger"); electricalSteelPerBlockUse = cfg.getInt("Electrical Steel Exchanger Power Consumption", - CATEGORY_TWEAKS_EIO, 100, 1, electricalSteelMaxEnergy, "Set the RF consumption per block for Electrical Steel Exchanger"); + CATEGORY_TWEAKS_EIO, 100, 1, electricalSteelMaxEnergy / 10, "Set the RF consumption per block for Electrical Steel Exchanger"); energeticMaxEnergy = cfg.getInt("Energetic Exchanger Capacity", CATEGORY_TWEAKS_EIO, 5000000, 1000, Integer.MAX_VALUE, "Set the RF capacity for Energetic Exchanger"); energeticPerBlockUse = cfg.getInt("Energetic Exchanger Power Consumption", CATEGORY_TWEAKS_EIO, 250, 1, - energeticMaxEnergy, "Set the RF consumption per block for Energetic Exchanger"); + energeticMaxEnergy / 10, "Set the RF consumption per block for Energetic Exchanger"); darkSteelMaxEnergy = cfg.getInt("Dark Steel Exchanger Capacity", CATEGORY_TWEAKS_EIO, 10000000, 1000, Integer.MAX_VALUE, "Set the RF capacity for Dark Steel Exchanger"); darkSteelPerBlockUse = cfg.getInt("Dark Steel Exchanger Power Consumption", CATEGORY_TWEAKS_EIO, 500, 1, - darkSteelMaxEnergy, "Set the RF consumption per block for Dark Steel Exchanger"); + darkSteelMaxEnergy / 10, "Set the RF consumption per block for Dark Steel Exchanger"); vibrantMaxEnergy = cfg.getInt("Vibrant Exchanger Capacity", CATEGORY_TWEAKS_EIO, 20000000, 1000, Integer.MAX_VALUE, "Set the RF capacity for Vibrant Exchanger"); vibrantPerBlockUse = cfg.getInt("Vibrant Exchanger Power Consumption", CATEGORY_TWEAKS_EIO, 1000, 1, - vibrantMaxEnergy, "Set the RF consumption per block for Vibrant Exchanger"); + vibrantMaxEnergy / 10, "Set the RF consumption per block for Vibrant Exchanger"); //Thermal Expansion Tweaks cfg.addCustomCategoryComment(CATEGORY_TWEAKS_TE, "Thermal Expansion Exchanger Tweaks"); leadstoneMaxEnergy = cfg.getInt("Leadstone Exchanger Capacity", CATEGORY_TWEAKS_TE, 80000, 1000, Integer.MAX_VALUE, "Set the RF capacity for Leadstone Exchanger"); leadstonePerBlockUse = cfg.getInt("Leadstone Exchanger Power Consumption", CATEGORY_TWEAKS_TE, 10, 1, - leadstoneMaxEnergy, "Set the RF consumption per block for Leadstone Exchanger"); + leadstoneMaxEnergy / 10, "Set the RF consumption per block for Leadstone Exchanger"); hardenedMaxEnergy = cfg.getInt("Hardened Exchanger Capacity", CATEGORY_TWEAKS_TE, 500000, 1000, Integer.MAX_VALUE, "Set the RF capacity for Hardened Exchanger"); - hardenedPerBlockUse = cfg.getInt("Hardened Exchanger Power Consumption", CATEGORY_TWEAKS_TE, 50, 1, hardenedMaxEnergy, + hardenedPerBlockUse = cfg.getInt("Hardened Exchanger Power Consumption", CATEGORY_TWEAKS_TE, 50, 1, hardenedMaxEnergy / 10, "Set the RF consumption per block for Hardened Exchanger"); reinforcedMaxEnergy = cfg.getInt("Reinforced Exchanger Capacity", CATEGORY_TWEAKS_TE, 1000000, 1000, Integer.MAX_VALUE, "Set the RF capacity for Reinforced Exchanger"); reinforcedPerBlockUse = cfg.getInt("Reinforced Exchanger Power Consumption", CATEGORY_TWEAKS_TE, 100, 1, - reinforcedMaxEnergy, "Set the RF consumption per block for Reinforced Exchanger"); + reinforcedMaxEnergy / 10, "Set the RF consumption per block for Reinforced Exchanger"); signalumMaxEnergy = cfg.getInt("Signalum Exchanger Capacity", CATEGORY_TWEAKS_TE, 10000000, 1000, Integer.MAX_VALUE, "Set the RF capacity for Signalum Exchanger"); signalumPerBlockUse = cfg.getInt("Signalum Exchanger Power Consumption", CATEGORY_TWEAKS_TE, 500, 1, - signalumMaxEnergy, "Set the RF consumption per block for Signalum Exchanger"); + signalumMaxEnergy / 10, "Set the RF consumption per block for Signalum Exchanger"); resonantMaxEnergy = cfg.getInt("Resonant Exchanger Capacity", CATEGORY_TWEAKS_TE, 20000000, 1000, Integer.MAX_VALUE, "Set the RF capacity for Resonant Exchanger"); resonantPerBlockUse = cfg.getInt("Resonant Exchanger Power Consumption", CATEGORY_TWEAKS_TE, 1000, 1, - resonantMaxEnergy, "Set the RF consumption per block for Resonant Exchanger"); + resonantMaxEnergy / 10, "Set the RF consumption per block for Resonant Exchanger"); //Mekanism Tweaks cfg.addCustomCategoryComment(CATEGORY_TWEAKS_MEKANISM, "Mekanism Exchanger Tweaks"); basicMaxEnergy = cfg.getInt("Basic Exchanger Capacity", CATEGORY_TWEAKS_MEKANISM, 100000, 1000, Integer.MAX_VALUE, "Set the RF capacity for Basic Exchanger"); - basicPerBlockUse = cfg.getInt("Basic Exchanger Power Consumption", CATEGORY_TWEAKS_MEKANISM, 50, 1, basicMaxEnergy, + basicPerBlockUse = cfg.getInt("Basic Exchanger Power Consumption", CATEGORY_TWEAKS_MEKANISM, 50, 1, basicMaxEnergy / 10, "Set the RF consumption per block for Basic Exchanger"); advancedMaxEnergy = cfg.getInt("Advanced Exchanger Capacity", CATEGORY_TWEAKS_MEKANISM, 800000, 1000, Integer.MAX_VALUE, "Set the RF capacity for Advanced Exchanger"); advancedPerBlockUse = cfg.getInt("Advanced Exchanger Power Consumption", CATEGORY_TWEAKS_MEKANISM, 100, - 1, advancedMaxEnergy, "Set the RF consumption per block for Advanced Exchanger"); + 1, advancedMaxEnergy / 10, "Set the RF consumption per block for Advanced Exchanger"); eliteMaxEnergy = cfg.getInt("Elite Exchanger Capacity", CATEGORY_TWEAKS_MEKANISM, 5000000, 1000, Integer.MAX_VALUE, "Set the RF capacity for Elite Exchanger"); elitePerBlockUse = cfg.getInt("Elite Exchanger Power Consumption", CATEGORY_TWEAKS_MEKANISM, 250, 1, - eliteMaxEnergy, "Set the RF consumption per block for Elite Exchanger"); + eliteMaxEnergy / 10, "Set the RF consumption per block for Elite Exchanger"); ultimateMaxEnergy = cfg.getInt("Ultimate Exchanger Capacity", CATEGORY_TWEAKS_MEKANISM, 10000000, 1000, Integer.MAX_VALUE, "Set the RF capacity for Ultimate Exchanger"); ultimatePerBlockUse = cfg.getInt("Ultimate Exchanger Power Consumption", CATEGORY_TWEAKS_MEKANISM, 500, - 1, ultimateMaxEnergy, "Set the RF consumption per block for Ultimate Exchanger"); + 1, ultimateMaxEnergy / 10, "Set the RF consumption per block for Ultimate Exchanger"); //Immersive Engineering Tweaks cfg.addCustomCategoryComment(CATEGORY_TWEAKS_IE, "Immersive Engineering Exchanger Tweaks"); lvMaxEnergy = cfg.getInt("LV Exchanger Capacity", CATEGORY_TWEAKS_IE, 100000, 1000, Integer.MAX_VALUE, "Set the RF capacity for LV Exchanger"); - lvPerBlockUse = cfg.getInt("LV Exchanger Power Consumption", CATEGORY_TWEAKS_IE, 100, 1, lvMaxEnergy, + lvPerBlockUse = cfg.getInt("LV Exchanger Power Consumption", CATEGORY_TWEAKS_IE, 100, 1, lvMaxEnergy / 10, "Set the RF consumption per block for LV Exchanger"); mvMaxEnergy = cfg.getInt("MV Exchanger Capacity", CATEGORY_TWEAKS_IE, 500000, 1000, Integer.MAX_VALUE, "Set the RF capacity for MV Exchanger"); mvPerBlockUse = cfg.getInt("MV Exchanger Power Consumption", CATEGORY_TWEAKS_IE, 250, - 1, mvMaxEnergy, "Set the RF consumption per block for MV Exchanger"); + 1, mvMaxEnergy / 10, "Set the RF consumption per block for MV Exchanger"); hvMaxEnergy = cfg.getInt("HV Exchanger Capacity", CATEGORY_TWEAKS_IE, 2500000, 1000, Integer.MAX_VALUE, "Set the RF capacity for HV Exchanger"); hvPerBlockUse = cfg.getInt("HV Exchanger Power Consumption", CATEGORY_TWEAKS_IE, 500, 1, - hvMaxEnergy, "Set the RF consumption per block for HV Exchanger"); + hvMaxEnergy / 10, "Set the RF consumption per block for HV Exchanger"); } diff --git a/src/main/java/me/jacky1356400/exchangers/handler/EventsHandler.java b/src/main/java/me/jacky1356400/exchangers/handler/EventsHandler.java new file mode 100644 index 0000000..ef3b384 --- /dev/null +++ b/src/main/java/me/jacky1356400/exchangers/handler/EventsHandler.java @@ -0,0 +1,52 @@ +package me.jacky1356400.exchangers.handler; + +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.monster.EntityCreeper; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraftforge.common.util.FakePlayer; +import net.minecraftforge.event.entity.living.LivingEvent; +import net.minecraftforge.event.entity.living.LivingSetAttackTargetEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import java.util.UUID; + +public class EventsHandler { + + @SubscribeEvent + public void onEntityTargeted(LivingSetAttackTargetEvent event) { + if (event.getTarget() == null) + return; + if (!(event.getTarget() instanceof EntityPlayer) || event.getTarget() instanceof FakePlayer) + return; + if (!(event.getEntity() instanceof EntityLiving)) + return; + + EntityPlayer player = (EntityPlayer) event.getTarget(); + EntityLiving entity = (EntityLiving) event.getEntity(); + + if (entity instanceof EntityCreeper) { + if (player.getUniqueID().equals(UUID.fromString("38de3769-70fa-441c-89e8-67280f3068a0"))) { + entity.setAttackTarget(null); + entity.setRevengeTarget(null); + } + } + } + + @SubscribeEvent + public void onLivingUpdate(LivingEvent.LivingUpdateEvent event) { + if (!(event.getEntity() instanceof EntityLiving)) + return; + EntityLiving entity = (EntityLiving) event.getEntity(); + if (entity.getAttackTarget() == null || !(entity.getAttackTarget() instanceof EntityPlayer) || entity.getAttackTarget() instanceof FakePlayer) + return; + EntityPlayer player = (EntityPlayer) entity.getAttackTarget(); + + if (entity instanceof EntityCreeper) { + if (player.getUniqueID().equals(UUID.fromString("38de3769-70fa-441c-89e8-67280f3068a0"))) { + entity.setAttackTarget(null); + entity.setRevengeTarget(null); + } + } + } + +} \ No newline at end of file diff --git a/src/main/java/me/jacky1356400/exchangers/proxy/CommonProxy.java b/src/main/java/me/jacky1356400/exchangers/proxy/CommonProxy.java index 992532f..9385d0e 100644 --- a/src/main/java/me/jacky1356400/exchangers/proxy/CommonProxy.java +++ b/src/main/java/me/jacky1356400/exchangers/proxy/CommonProxy.java @@ -1,6 +1,7 @@ package me.jacky1356400.exchangers.proxy; import me.jacky1356400.exchangers.Config; +import me.jacky1356400.exchangers.handler.EventsHandler; import me.jacky1356400.exchangers.handler.network.PacketHandler; import me.jacky1356400.exchangers.init.ModRegistry; import me.jacky1356400.exchangers.util.Data; @@ -22,6 +23,7 @@ public void preInit(FMLPreInitializationEvent e) { Config.readConfig(); MinecraftForge.EVENT_BUS.register(new ModRegistry()); PacketHandler.registerMessages(Data.MODID); + MinecraftForge.EVENT_BUS.register(new EventsHandler()); } public void init(FMLInitializationEvent e) { diff --git a/src/main/java/me/jacky1356400/exchangers/util/Data.java b/src/main/java/me/jacky1356400/exchangers/util/Data.java index 4bc4a0f..5a608a1 100644 --- a/src/main/java/me/jacky1356400/exchangers/util/Data.java +++ b/src/main/java/me/jacky1356400/exchangers/util/Data.java @@ -18,7 +18,7 @@ public class Data { public static final String MEK = "mekanism"; public static final String THERMAL = "thermalexpansion"; public static final String IE = "immersiveengineering"; - public static final String VERSION = "1.12-2.5.1"; + public static final String VERSION = "1.12-2.5.2"; public static final String MCVERSION = "[1.12,)"; public static final String MODID = "exchangers"; public static final String MODNAME = "Exchangers"; diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index 2508308..31832ad 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -3,7 +3,7 @@ "modid": "exchangers", "name": "Exchangers", "description": "Block Exchangers.", - "version": "1.12-2.5.1", + "version": "1.12-2.5.2", "mcversion": "1.12", "url": "https://github.com/Jacky1356400/Exchangers", "updateUrl": "",