You are not logged in.

IC2 Experimental builds (jenkins):
v2.0/2.1/2.2 / 2.3 / 2.5 / 2.6 (For Minecraft 1.6.4/1.7.2/1.7.10 / 1.8.9 / 1.9.4 / 1.10)
IndustrialCraft² recent version: v1.117! (For Minecraft 1.5.2 → topic)

1

Wednesday, May 20th 2015, 11:51am

Radiation protection API

Hello. There is a mod, called Modular Powersuits(https://github.com/MachineMuse/MachineMusePowersuits). I want to implement radiation protection module for it, but i can not find what are responsible for radiation protection(e.g which method called to deal radiation damage or which class is checked) by looking into provided IC2 API. :(

Can anybody help me with this?

Blood Asp

Coal Miner

  • "Blood Asp" is male

Posts: 1,402

Location: Germany

  • Send private message

2

Wednesday, May 20th 2015, 10:08pm

I searched for the same thing for my modular armor in GTExtras. In the end the only way i got to work was to remove the effect each tick... It is not perfect, sometimes the effect goes trough for one tick.

Maybe it's time to request such an api function?

Speiger

TMT & IC2 Classic Dev

  • "Speiger" is male

Posts: 997

Location: Germany

  • Send private message

3

Wednesday, May 20th 2015, 10:53pm

Yeah Radioactivity is a PotionEffect that you can detect and maybe even prevent... Well i do not know exactly if you can make a prevent Potion effect or something but you can detect the effect with the API files..
But thanks for that suggestion... I put that on my todolist.

4

Thursday, May 21st 2015, 12:32pm

Instead of removing it every tick, you could just give the armor a damage resistance of Integer.MAX_VALUE if the DamageSource irs radiation.
Check out my mods here.

5

Thursday, May 21st 2015, 12:38pm

Instead of removing it every tick, you could just give the armor a damage resistance of Integer.MAX_VALUE if the DamageSource irs radiation.
I am newbie in mod development, just put some small fixes to existing code before, no serious work.

How should i do that? Maybe i just "subscribe" to some damage event(LivingHurtEvent?) and cancel it if DamageSource is radiation(not sure if it's possible for this type of event, as i said, i am newbie and just began to read Forge docs).

By the way what constant should it be? Should i just compare source with DamageSource("radiation") ?

Blood Asp

Coal Miner

  • "Blood Asp" is male

Posts: 1,402

Location: Germany

  • Send private message

6

Thursday, May 21st 2015, 12:52pm

Instead of removing it every tick, you could just give the armor a damage resistance of Integer.MAX_VALUE if the DamageSource irs radiation.
That would stop the damage, but not the effects. The confusion and other effects that warp your sight, slow you down or are otherwise annoying. Also the radiation effect goes up to insanely long times quickly.

MauveCloud

Coal Miner

  • "MauveCloud" is male

Posts: 1,048

Location: California

  • Send private message

7

Thursday, May 21st 2015, 2:12pm

In answer to the original question of how IC2 checks for the hazmat suit to decide whether to apply the radiation effect, I found the following by decompiling, in ItemReactorUranium.class:

Source code

1
2
3
4
5
6
7
8
9
10
public void func_77663_a(ItemStack stack, World world, Entity entity, int slotIndex, boolean isCurrentItem)
  {
    if ((entity instanceof EntityLivingBase))
    {
      EntityLivingBase entityLiving = (EntityLivingBase)entity;
      if (!ItemArmorHazmat.hasCompleteHazmat(entityLiving)) {
        IC2Potion.radiation.applyTo(entityLiving, 200, 100);
      }
    }
  }


And here is ItemArmorHazmat.hasCompleteHazmat:

Source code

1
2
3
4
5
6
7
8
9
10
11
public static boolean hasCompleteHazmat(EntityLivingBase living)
  {
    for (int i = 1; i < 5; i++)
    {
      ItemStack stack = living.func_71124_b(i);
      if ((stack == null) || (!(stack.func_77973_b() instanceof ItemArmorHazmat))) {
        return false;
      }
    }
    return true;
  }


Thus it's not really part of the api currently, and it doesn't lend itself well to armor that can have radiation protection added or removed, but I think it also means that living things other than players that pick up radioactive items will be affected.

Chocohead

Drowning in mods.

  • "Chocohead" is male
  • Korea, Democratic People's Republic of United Kingdom

Posts: 5,983

Location: Badly generated chunks.

  • Send private message

8

Thursday, May 21st 2015, 3:07pm

I think it also means that living things other than players that pick up radioactive items will be affected.
There's no will about it, they are. I've killed other mod's mobs from them picking up U-238 before.
145 Mods isn't too many. 9 types of copper and 8 types of tin aren't too many. 3 types of coffee though?

I know that you believe that you understood what you think I said, but I am not sure you realise that what you read was not what I meant.


---- Minecraft Crash Report ----
// I just don't know what went wrong :(

I see this too much.

Counter:

Hits today: 12,620 | Hits yesterday: 35,349 | Hits record: 152,331 | Hits total: 65,344,060