AutoSwitch support (#2175). Thanks to dexman545
This commit is contained in:
parent
d0c32e8efb
commit
a0644ac434
3 changed files with 48 additions and 1 deletions
|
@ -93,6 +93,8 @@ dependencies {
|
|||
compileOnly "com.google.code.findbugs:jsr305:3.0.2"
|
||||
|
||||
modApi 'teamreborn:energy:0.1.0'
|
||||
|
||||
optionalDependency "com.github.dexman545:autoswitch-api:-SNAPSHOT"
|
||||
}
|
||||
|
||||
def optionalDependency(String dep) {
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
package techreborn.compat.autoswitch;
|
||||
|
||||
import autoswitch.api.AutoSwitchApi;
|
||||
import autoswitch.api.AutoSwitchMap;
|
||||
import autoswitch.api.DurabilityGetter;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tag.Tag;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.items.tool.ChainsawItem;
|
||||
import techreborn.items.tool.DrillItem;
|
||||
import techreborn.items.tool.JackhammerItem;
|
||||
import techreborn.items.tool.advanced.RockCutterItem;
|
||||
import techreborn.items.tool.basic.ElectricTreetapItem;
|
||||
import techreborn.items.tool.industrial.NanosaberItem;
|
||||
import techreborn.items.tool.industrial.OmniToolItem;
|
||||
|
||||
public class AutoSwitchApiImpl implements AutoSwitchApi {
|
||||
|
||||
@Override
|
||||
public void moddedTargets(AutoSwitchMap<String, Object> targets, AutoSwitchMap<String, String> actionConfig, AutoSwitchMap<String, String> usableConfig) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moddedToolGroups(AutoSwitchMap<String, Pair<Tag<Item>, Class<?>>> toolGroupings) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void customDamageSystems(AutoSwitchMap<Class<?>, DurabilityGetter> damageMap) {
|
||||
// Multiple by 100 to get percentage out of decimal form
|
||||
damageMap.put(DrillItem.class, stack -> 100 * ItemUtils.getPowerForDurabilityBar(stack));
|
||||
damageMap.put(ChainsawItem.class, stack -> 100 * ItemUtils.getPowerForDurabilityBar(stack));
|
||||
damageMap.put(JackhammerItem.class, stack -> 100 * ItemUtils.getPowerForDurabilityBar(stack));
|
||||
damageMap.put(NanosaberItem.class, stack -> 100 * ItemUtils.getPowerForDurabilityBar(stack));
|
||||
damageMap.put(OmniToolItem.class, stack -> 100 * ItemUtils.getPowerForDurabilityBar(stack));
|
||||
damageMap.put(ElectricTreetapItem.class, stack -> 100 * ItemUtils.getPowerForDurabilityBar(stack));
|
||||
damageMap.put(RockCutterItem.class, stack -> 100 * ItemUtils.getPowerForDurabilityBar(stack));
|
||||
|
||||
}
|
||||
}
|
|
@ -24,6 +24,9 @@
|
|||
],
|
||||
"libcd": [
|
||||
"techreborn.compat.libcd.LibCDPlugin"
|
||||
],
|
||||
"autoswitch": [
|
||||
"techreborn.compat.autoswitch.AutoSwitchApiImpl"
|
||||
]
|
||||
},
|
||||
"depends": {
|
||||
|
|
Loading…
Reference in a new issue