diff --git a/changelog b/changelog index d4ebe75e8..a00313c4c 100644 --- a/changelog +++ b/changelog @@ -39,6 +39,7 @@ * Glyphids spawned by radioactive hives are immune to fire, twice as fast and five times as strong * Radioactive glpyhids however are NOT immune to radiation, and typically die quickly * Radioactive hives are sterile, they will not spawn scouts +* PWR core capacity is now limited to 500%, meaning the maximum amount of heatsinks usable is 80 ## Fixed * The conveyor grabber should no longer skip over items when used in long lines diff --git a/src/main/java/com/hbm/items/weapon/sedna/impl/ItemGunStinger.java b/src/main/java/com/hbm/items/weapon/sedna/impl/ItemGunStinger.java index 9f1bcce05..6fcd39e19 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/impl/ItemGunStinger.java +++ b/src/main/java/com/hbm/items/weapon/sedna/impl/ItemGunStinger.java @@ -16,8 +16,11 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre; public class ItemGunStinger extends ItemGunBaseNT { - + public static final String KEY_LOCKINGON = "lockingon"; + public static final String KEY_LOCKEDON = "lockedon"; + public static final String KEY_LOCKONTARGET = "lockontarget"; + public static final String KEY_LOCKONPROGRESS = "lockonprogress"; public static float prevLockon; public static float lockon; @@ -30,17 +33,45 @@ public class ItemGunStinger extends ItemGunBaseNT { public void onUpdate(ItemStack stack, World world, Entity entity, int slot, boolean isHeld) { super.onUpdate(stack, world, entity, slot, isHeld); - if(!world.isRemote && !isHeld && this.getIsLockingOn(stack)) { - this.setIsLockingOn(stack, false); - } - - this.prevLockon = this.lockon; - if(isHeld && this.getIsLockingOn(stack)) { - this.lockon += (1F / 100F); - } else { - this.lockon = 0F; + if(entity instanceof EntityPlayer) { + EntityPlayer player = (EntityPlayer) entity; + if(!world.isRemote && !isHeld && this.getIsLockingOn(stack)) { + this.setIsLockingOn(stack, false); + } + + this.prevLockon = this.lockon; + int prevTarget = this.getLockonTarget(stack); + if(isHeld && this.getIsLockingOn(stack) && this.getIsAiming(stack)) { + int newLockonTarget = this.getLockonTarget(player); + + if(newLockonTarget == -1) { + resetLockon(world, stack); + } else { + if(newLockonTarget != prevTarget) { + resetLockon(world, stack); + this.setLockonTarget(stack, newLockonTarget); + } + progressLockon(world, stack); + } + } else { + resetLockon(world, stack); + } } } + + public void resetLockon(World world, ItemStack stack) { + if(world.isRemote) this.lockon = 0F; + if(!world.isRemote) this.setLockonProgress(stack, 0); + } + + public void progressLockon(World world, ItemStack stack) { + if(world.isRemote) this.lockon += (1F / 100F); + if(!world.isRemote) this.setLockonProgress(stack, this.getLockonProgress(stack) + 1); + } + + public static int getLockonTarget(EntityPlayer player) { + return -1; + } @Override @SideOnly(Side.CLIENT) @@ -67,7 +98,13 @@ public class ItemGunStinger extends ItemGunBaseNT { } } } - + public static boolean getIsLockingOn(ItemStack stack) { return getValueBool(stack, KEY_LOCKINGON); } public static void setIsLockingOn(ItemStack stack, boolean value) { setValueBool(stack, KEY_LOCKINGON, value); } + public static boolean getIsLockedOn(ItemStack stack) { return getValueBool(stack, KEY_LOCKEDON); } + public static void setIsLockedOn(ItemStack stack, boolean value) { setValueBool(stack, KEY_LOCKEDON, value); } + public static int getLockonTarget(ItemStack stack) { return getValueInt(stack, KEY_LOCKONTARGET); } + public static void setLockonTarget(ItemStack stack, int value) { setValueInt(stack, KEY_LOCKONTARGET, value); } + public static int getLockonProgress(ItemStack stack) { return getValueInt(stack, KEY_LOCKONPROGRESS); } + public static void setLockonProgress(ItemStack stack, int value) { setValueInt(stack, KEY_LOCKONPROGRESS, value); } } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityPWRController.java b/src/main/java/com/hbm/tileentity/machine/TileEntityPWRController.java index 248b587fd..0d7e8edd0 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityPWRController.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityPWRController.java @@ -148,6 +148,7 @@ public class TileEntityPWRController extends TileEntityMachineBase implements IG connections = connectionsDouble / 2; connectionsControlled = connectionsControlledDouble / 2; + heatsinkCount = Math.min(heatsinkCount, 80); //switching this to int64 because after 2127 heatsinks the capacity exceeds the int32 which is well within the 4000+ threshold we are working with. oops! this.coreHeatCapacity = this.coreHeatCapacityBase + this.heatsinkCount * (this.coreHeatCapacityBase / 20);