aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/Ic2ExpReactorPlanner/components/Plating.java
blob: d792e06035e32d6186484c45b98c82fdfee71ded (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
/*
 * 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 Ic2ExpReactorPlanner.Reactor;
import gregtech.api.objects.GT_ItemStack;

/**
 * Represents some form of plating, which changes how much heat the reactor can
 * hold before causing external effects (up to and including explosion), as well
 * as somewhat reducing explosion power.
 * @author Brian McCloud
 */
public class Plating extends ReactorItem {
    
    private final int heatAdjustment;
    
    public Plating(final int id, final String baseName, GT_ItemStack aItem, final double maxDamage, final double maxHeat, final String sourceMod, final int heatAdjustment, final double explosionPowerMultiplier) {
        super(id, baseName, aItem, maxDamage, maxHeat, sourceMod);
        this.heatAdjustment = heatAdjustment;
        this.explosionPowerMultiplier = explosionPowerMultiplier;
    }
    
    public Plating(Plating other) {
        super(other);
        this.heatAdjustment = other.heatAdjustment;
        this.explosionPowerMultiplier = other.explosionPowerMultiplier;
    }
    
    @Override
    public void addToReactor(final Reactor parent, final int row, final int col) {
        super.addToReactor(parent, row, col);
        if (parent != null) {
            parent.adjustMaxHeat(heatAdjustment);
        }
    }

    @Override
    public void removeFromReactor() {
        if (parent != null) {
            parent.adjustMaxHeat(-heatAdjustment);
        }
        super.removeFromReactor();
    }
    
}