Update energy api
This commit is contained in:
parent
7e05b0da12
commit
a4a578917d
6 changed files with 21 additions and 11 deletions
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
[![](http://cf.way2muchnoise.eu/full_233564_downloads.svg)](https://minecraft.curseforge.com/projects/techreborn) [![](http://cf.way2muchnoise.eu/packs/233564.svg)](https://minecraft.curseforge.com/projects/techreborn) [![](http://cf.way2muchnoise.eu/versions/233564.svg)](https://minecraft.curseforge.com/projects/techreborn) [![](https://img.shields.io/badge/Discord-TeamReborn-738bd7.svg)](https://discord.gg/teamreborn) [![Crowdin](https://d322cqt584bo4o.cloudfront.net/techreborn/localized.svg)](https://translate.techreborn.ovh/project/techreborn)
|
[![](http://cf.way2muchnoise.eu/full_233564_downloads.svg)](https://minecraft.curseforge.com/projects/techreborn) [![](http://cf.way2muchnoise.eu/packs/233564.svg)](https://minecraft.curseforge.com/projects/techreborn) [![](http://cf.way2muchnoise.eu/versions/233564.svg)](https://minecraft.curseforge.com/projects/techreborn) [![](https://img.shields.io/badge/Discord-TeamReborn-738bd7.svg)](https://discord.gg/teamreborn) [![Crowdin](https://d322cqt584bo4o.cloudfront.net/techreborn/localized.svg)](https://translate.techreborn.ovh/project/techreborn)
|
||||||
|
|
||||||
# Tech Reborn for 1.13.1 (BUILD JOBS WILL NEED UPDATING) [![Build Status](https://jenkins.modmuss50.me/job/Team%20Reborn/job/TechReborn/job/1.12/badge/icon)](https://jenkins.modmuss50.me/job/Team%20Reborn/job/TechReborn/job/1.12/)
|
# Tech Reborn for 1.14.4 [![Build Status](https://jenkins.modmuss50.me/job/Team%20Reborn/job/TechReborn/job/1.12/badge/icon)](https://jenkins.modmuss50.me/job/Team%20Reborn/job/TechReborn/job/1.12/)
|
||||||
|
|
||||||
*Tech Reborn is a completely standalone tech mod including tools and machines to gather resources, process materials, and progress through the mod.*
|
*Tech Reborn is a completely standalone tech mod including tools and machines to gather resources, process materials, and progress through the mod.*
|
||||||
|
|
||||||
|
@ -21,12 +21,18 @@ Versions we determine are stable enough can always be found on our CurseForge pa
|
||||||
|
|
||||||
If you're looking for the latest bleeding edge build, these are found on our Jenkins page. Use these with caution, and please do not put these in modpacks:
|
If you're looking for the latest bleeding edge build, these are found on our Jenkins page. Use these with caution, and please do not put these in modpacks:
|
||||||
|
|
||||||
|
1.15 * - [![Build Status](https://jenkins.modmuss50.me/job/Team%20Reborn/job/TechReborn/job/1.15/badge/icon)](https://jenkins.modmuss50.me/job/Team%20Reborn/job/TechReborn/job/1.15/)
|
||||||
|
|
||||||
|
1.14.4 - [![Build Status](https://jenkins.modmuss50.me/job/Team%20Reborn/job/TechReborn/job/1.14/badge/icon)](https://jenkins.modmuss50.me/job/Team%20Reborn/job/TechReborn/job/1.14/)
|
||||||
|
|
||||||
1.12.2 - [![Build Status](https://jenkins.modmuss50.me/job/Team%20Reborn/job/TechReborn/job/1.12/badge/icon)](https://jenkins.modmuss50.me/job/Team%20Reborn/job/TechReborn/job/1.12/)
|
1.12.2 - [![Build Status](https://jenkins.modmuss50.me/job/Team%20Reborn/job/TechReborn/job/1.12/badge/icon)](https://jenkins.modmuss50.me/job/Team%20Reborn/job/TechReborn/job/1.12/)
|
||||||
|
|
||||||
1.11.2 - [![Build Status](https://jenkins.modmuss50.me/job/TeamReborn/job/TechReborn/job/TechReborn-1.11.2/badge/icon)](https://jenkins.modmuss50.me/job/TeamReborn/job/TechReborn/job/TechReborn-1.11.2/)
|
1.11.2 - [![Build Status](https://jenkins.modmuss50.me/job/TeamReborn/job/TechReborn/job/TechReborn-1.11.2/badge/icon)](https://jenkins.modmuss50.me/job/TeamReborn/job/TechReborn/job/TechReborn-1.11.2/)
|
||||||
|
|
||||||
1.10.2 - [![Build Status](https://jenkins.modmuss50.me/job/TeamReborn/job/TechReborn/job/TechReborn-1.10.2/badge/icon)](https://jenkins.modmuss50.me/job/TeamReborn/job/TechReborn/job/TechReborn-1.10.2/)
|
1.10.2 - [![Build Status](https://jenkins.modmuss50.me/job/TeamReborn/job/TechReborn/job/TechReborn-1.10.2/badge/icon)](https://jenkins.modmuss50.me/job/TeamReborn/job/TechReborn/job/TechReborn-1.10.2/)
|
||||||
|
|
||||||
|
* 1.15 versions are for snapshots, and may not always be upto date with the latest 1.15 snapshots.
|
||||||
|
|
||||||
# Issues and Suggestions
|
# Issues and Suggestions
|
||||||
|
|
||||||
To report an issue or make a suggestion, please head up to the `Issues` tab up above, and open a new issue. You will need a GitHub account for this (it's free!). **It is very important that you include the version of Tech Reborn you are using in your issue report.**
|
To report an issue or make a suggestion, please head up to the `Issues` tab up above, and open a new issue. You will need a GitHub account for this (it's free!). **It is very important that you include the version of Tech Reborn you are using in your issue report.**
|
||||||
|
|
|
@ -70,10 +70,10 @@ group = 'TechReborn'
|
||||||
dependencies {
|
dependencies {
|
||||||
minecraft "com.mojang:minecraft:1.14.4"
|
minecraft "com.mojang:minecraft:1.14.4"
|
||||||
mappings "net.fabricmc:yarn:1.14.4+build.2"
|
mappings "net.fabricmc:yarn:1.14.4+build.2"
|
||||||
modCompile "net.fabricmc:fabric-loader:0.4.8+build.159"
|
modCompile "net.fabricmc:fabric-loader:0.6.1+build.165"
|
||||||
|
|
||||||
//Fabric api
|
//Fabric api
|
||||||
modCompile "net.fabricmc.fabric-api:fabric-api:0.3.1+build.208"
|
modCompile "net.fabricmc.fabric-api:fabric-api:0.3.2+build.226-1.14"
|
||||||
|
|
||||||
modCompile "io.github.prospector:modmenu:1.7.7+build.116"
|
modCompile "io.github.prospector:modmenu:1.7.7+build.116"
|
||||||
modCompile ("me.shedaniel:RoughlyEnoughItems:3.0-pre+build.1") {
|
modCompile ("me.shedaniel:RoughlyEnoughItems:3.0-pre+build.1") {
|
||||||
|
@ -106,7 +106,7 @@ dependencies {
|
||||||
transitive = false
|
transitive = false
|
||||||
}
|
}
|
||||||
|
|
||||||
compile 'teamreborn:energy:0.0.6'
|
compile 'teamreborn:energy:0.0.7'
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
|
|
|
@ -63,11 +63,13 @@ public class ItemCloakingDevice extends ItemTRArmour implements EnergyHolder {
|
||||||
PlayerEntity player = (PlayerEntity) entityIn;
|
PlayerEntity player = (PlayerEntity) entityIn;
|
||||||
|
|
||||||
if (Energy.valid(stack)) {
|
if (Energy.valid(stack)) {
|
||||||
Energy.of(stack).use(usage, () -> player.setInvisible(true), () -> {
|
if(Energy.of(stack).use(usage)){
|
||||||
|
player.setInvisible(true);
|
||||||
|
} else {
|
||||||
if (!player.hasStatusEffect(StatusEffects.INVISIBILITY)) {
|
if (!player.hasStatusEffect(StatusEffects.INVISIBILITY)) {
|
||||||
player.setInvisible(false);
|
player.setInvisible(false);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -178,7 +178,7 @@ public class ItemIndustrialChainsaw extends ItemChainsaw {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Energy.of(stack).use(cost, () -> {
|
if(Energy.of(stack).use(cost)){
|
||||||
BlockState blockState = world.getBlockState(pos);
|
BlockState blockState = world.getBlockState(pos);
|
||||||
if (blockState.getHardness(world, pos) == -1.0F) {
|
if (blockState.getHardness(world, pos) == -1.0F) {
|
||||||
return;
|
return;
|
||||||
|
@ -192,7 +192,7 @@ public class ItemIndustrialChainsaw extends ItemChainsaw {
|
||||||
blockState.getBlock().afterBreak(world, (PlayerEntity) entityLiving, pos, blockState, world.getBlockEntity(pos), stack);
|
blockState.getBlock().afterBreak(world, (PlayerEntity) entityLiving, pos, blockState, world.getBlockEntity(pos), stack);
|
||||||
world.setBlockState(pos, Blocks.AIR.getDefaultState());
|
world.setBlockState(pos, Blocks.AIR.getDefaultState());
|
||||||
world.removeBlockEntity(pos);
|
world.removeBlockEntity(pos);
|
||||||
});
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,14 +121,14 @@ public class ItemIndustrialDrill extends ItemDrill {
|
||||||
private void breakBlock(BlockPos pos, World world, PlayerEntity playerIn, ItemStack drill) {
|
private void breakBlock(BlockPos pos, World world, PlayerEntity playerIn, ItemStack drill) {
|
||||||
BlockState blockState = world.getBlockState(pos);
|
BlockState blockState = world.getBlockState(pos);
|
||||||
|
|
||||||
Energy.of(drill).use(cost, () -> {
|
if(Energy.of(drill).use(cost)){
|
||||||
ExternalPowerSystems.requestEnergyFromArmor(drill, playerIn);
|
ExternalPowerSystems.requestEnergyFromArmor(drill, playerIn);
|
||||||
|
|
||||||
blockState.getBlock().onBlockRemoved(blockState, world, pos, blockState, true);
|
blockState.getBlock().onBlockRemoved(blockState, world, pos, blockState, true);
|
||||||
blockState.getBlock().afterBreak(world, playerIn, pos, blockState, world.getBlockEntity(pos), drill);
|
blockState.getBlock().afterBreak(world, playerIn, pos, blockState, world.getBlockEntity(pos), drill);
|
||||||
world.setBlockState(pos, Blocks.AIR.getDefaultState());
|
world.setBlockState(pos, Blocks.AIR.getDefaultState());
|
||||||
world.removeBlockEntity(pos);
|
world.removeBlockEntity(pos);
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean shouldBreak(PlayerEntity playerIn, World worldIn, BlockPos originalPos, BlockPos pos) {
|
private boolean shouldBreak(PlayerEntity playerIn, World worldIn, BlockPos originalPos, BlockPos pos) {
|
||||||
|
|
|
@ -107,7 +107,9 @@ public class ItemOmniTool extends PickaxeItem implements EnergyHolder, ItemDurab
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean postHit(ItemStack stack, LivingEntity entityliving, LivingEntity attacker) {
|
public boolean postHit(ItemStack stack, LivingEntity entityliving, LivingEntity attacker) {
|
||||||
Energy.of(stack).use(hitCost, () -> entityliving.damage(DamageSource.player((PlayerEntity) attacker), 8F));
|
if(Energy.of(stack).use(hitCost)) {
|
||||||
|
entityliving.damage(DamageSource.player((PlayerEntity) attacker), 8F);
|
||||||
|
}
|
||||||
ExternalPowerSystems.requestEnergyFromArmor(stack, entityliving);
|
ExternalPowerSystems.requestEnergyFromArmor(stack, entityliving);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue