Update energy api

This commit is contained in:
modmuss50 2019-09-16 23:11:56 +01:00
parent 7e05b0da12
commit a4a578917d
6 changed files with 21 additions and 11 deletions

View file

@ -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)
# 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.*
@ -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:
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.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.15 versions are for snapshots, and may not always be upto date with the latest 1.15 snapshots.
# 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.**

View file

@ -70,10 +70,10 @@ group = 'TechReborn'
dependencies {
minecraft "com.mojang:minecraft:1.14.4"
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
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 ("me.shedaniel:RoughlyEnoughItems:3.0-pre+build.1") {
@ -106,7 +106,7 @@ dependencies {
transitive = false
}
compile 'teamreborn:energy:0.0.6'
compile 'teamreborn:energy:0.0.7'
}
processResources {

View file

@ -63,11 +63,13 @@ public class ItemCloakingDevice extends ItemTRArmour implements EnergyHolder {
PlayerEntity player = (PlayerEntity) entityIn;
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)) {
player.setInvisible(false);
}
});
}
}
}
}

View file

@ -178,7 +178,7 @@ public class ItemIndustrialChainsaw extends ItemChainsaw {
return;
}
Energy.of(stack).use(cost, () -> {
if(Energy.of(stack).use(cost)){
BlockState blockState = world.getBlockState(pos);
if (blockState.getHardness(world, pos) == -1.0F) {
return;
@ -192,7 +192,7 @@ public class ItemIndustrialChainsaw extends ItemChainsaw {
blockState.getBlock().afterBreak(world, (PlayerEntity) entityLiving, pos, blockState, world.getBlockEntity(pos), stack);
world.setBlockState(pos, Blocks.AIR.getDefaultState());
world.removeBlockEntity(pos);
});
}
}
}

View file

@ -121,14 +121,14 @@ public class ItemIndustrialDrill extends ItemDrill {
private void breakBlock(BlockPos pos, World world, PlayerEntity playerIn, ItemStack drill) {
BlockState blockState = world.getBlockState(pos);
Energy.of(drill).use(cost, () -> {
if(Energy.of(drill).use(cost)){
ExternalPowerSystems.requestEnergyFromArmor(drill, playerIn);
blockState.getBlock().onBlockRemoved(blockState, world, pos, blockState, true);
blockState.getBlock().afterBreak(world, playerIn, pos, blockState, world.getBlockEntity(pos), drill);
world.setBlockState(pos, Blocks.AIR.getDefaultState());
world.removeBlockEntity(pos);
});
}
}
private boolean shouldBreak(PlayerEntity playerIn, World worldIn, BlockPos originalPos, BlockPos pos) {

View file

@ -107,7 +107,9 @@ public class ItemOmniTool extends PickaxeItem implements EnergyHolder, ItemDurab
@Override
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);
return false;
}