aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/Ic2ExpReactorPlanner/components/Reflector.java
blob: f0b16f3d14a932d2c63d43296dc45cec54ea6bd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
 * To change this license header, choose License Headers in Project Properties. To change this template file, choose
 * Tools | Templates and open the template in the editor.
 */
package Ic2ExpReactorPlanner.components;

import gregtech.api.objects.GT_ItemStack;

/**
 * Represents a neutron reflector in a reactor.
 * 
 * @author Brian McCloud
 */
public class Reflector extends ReactorItem {

    private static String mcVersion = "1.12.2";

    public Reflector(final int id, final String baseName, final GT_ItemStack aStack, final double maxDamage,
            final double maxHeat, final String sourceMod) {
        super(id, baseName, aStack, maxDamage, maxHeat, sourceMod);
    }

    public Reflector(final Reflector other) {
        super(other);
    }

    @Override
    public boolean isNeutronReflector() {
        return !isBroken();
    }

    @Override
    public double generateHeat() {
        ReactorItem component = parent.getComponentAt(row - 1, col);
        if (component != null) {
            applyDamage(component.getRodCount());
        }
        component = parent.getComponentAt(row, col + 1);
        if (component != null) {
            applyDamage(component.getRodCount());
        }
        component = parent.getComponentAt(row + 1, col);
        if (component != null) {
            applyDamage(component.getRodCount());
        }
        component = parent.getComponentAt(row, col - 1);
        if (component != null) {
            applyDamage(component.getRodCount());
        }
        return 0;
    }

    @Override
    public double getMaxDamage() {
        if (maxDamage > 1 && "1.7.10".equals(mcVersion)) {
            return maxDamage / 3;
        }
        return maxDamage;
    }

    public static void setMcVersion(String newVersion) {
        mcVersion = newVersion;
    }
}