Merge remote-tracking branch 'remotes/origin/1.14' into 1.15

# Conflicts:
#	build.gradle
#	src/main/java/techreborn/blocks/misc/BlockRubberLog.java
This commit is contained in:
modmuss50 2019-11-14 19:03:36 +00:00
commit d5e89c5e20
139 changed files with 1534 additions and 501 deletions

View file

@ -133,7 +133,7 @@ public class ItemDynamicCell extends Item implements ItemFluidInfo {
FluidState fluidState = usageContext.getWorld().getFluidState(pos);
if(fluidState.getFluid() != Fluids.EMPTY && fluidState.isStill()){
stack.decrement(1);
usageContext.getPlayer().inventory.insertStack(getCellWithFluid(fluidState.getFluid(), 1));
insertOrDropStack(usageContext.getPlayer(), getCellWithFluid(fluidState.getFluid(), 1));
usageContext.getWorld().setBlockState(pos, Blocks.AIR.getDefaultState());
playEmptyingSound(usageContext.getPlayer(), usageContext.getWorld(), pos, fluidState.getFluid());
}
@ -141,13 +141,19 @@ public class ItemDynamicCell extends Item implements ItemFluidInfo {
if(blockState.canReplace(new ItemPlacementContext(usageContext))){
usageContext.getWorld().setBlockState(pos, containedFluid.getDefaultState().getBlockState());
stack.decrement(1);
usageContext.getPlayer().inventory.insertStack(getEmpty());
insertOrDropStack(usageContext.getPlayer(), getEmpty());
playEmptyingSound(usageContext.getPlayer(), usageContext.getWorld(), pos, containedFluid);
}
}
return super.useOnBlock(usageContext);
}
private void insertOrDropStack(PlayerEntity playerEntity, ItemStack stack){
if(!playerEntity.inventory.insertStack(stack)){
playerEntity.dropStack(stack);
}
}
//Thanks vanilla :)
private void playEmptyingSound(@Nullable PlayerEntity playerEntity, IWorld world, BlockPos blockPos, Fluid fluid) {
SoundEvent soundEvent = fluid.matches(FluidTags.LAVA) ? SoundEvents.ITEM_BUCKET_EMPTY_LAVA : SoundEvents.ITEM_BUCKET_EMPTY;

View file

@ -35,10 +35,10 @@ import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DefaultedList;
import net.minecraft.world.World;
import reborncore.common.powerSystem.ExternalPowerSystems;
import reborncore.common.powerSystem.PowerSystem;
import reborncore.common.util.ItemDurabilityExtensions;
import reborncore.common.util.ItemUtils;
import team.reborn.energy.Energy;
import team.reborn.energy.EnergyHolder;
import team.reborn.energy.EnergyTier;
import techreborn.TechReborn;
@ -62,9 +62,18 @@ public class ItemLithiumIonBatpack extends ArmorItem implements EnergyHolder, It
return;
}
if(!Energy.valid(itemStack)){
return;
}
for (int i = 0; i < player.inventory.getInvSize(); i++) {
if (!player.inventory.getInvStack(i).isEmpty()) {
ExternalPowerSystems.chargeItem(itemStack, player.inventory.getInvStack(i));
if (Energy.valid(player.inventory.getInvStack(i))) {
Energy.of(itemStack)
.into(
Energy
.of(player.inventory.getInvStack(i))
)
.move();
}
}
}

View file

@ -35,7 +35,6 @@ import net.minecraft.item.*;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import reborncore.common.powerSystem.ExternalPowerSystems;
import reborncore.common.powerSystem.PowerSystem;
import reborncore.common.util.ItemDurabilityExtensions;
import reborncore.common.util.ItemUtils;
@ -80,9 +79,8 @@ public class ItemChainsaw extends AxeItem implements EnergyHolder, ItemDurabilit
if (Energy.of(stack).getEnergy() >= cost
&& (state.getMaterial() == Material.WOOD)) {
return this.poweredSpeed;
} else {
return super.getMiningSpeed(stack, state);
}
return super.getMiningSpeed(stack, state);
}
// ItemTool
@ -91,7 +89,6 @@ public class ItemChainsaw extends AxeItem implements EnergyHolder, ItemDurabilit
Random rand = new Random();
if (rand.nextInt(EnchantmentHelper.getLevel(Enchantments.UNBREAKING, stack) + 1) == 0) {
Energy.of(stack).use(cost);
ExternalPowerSystems.requestEnergyFromArmor(stack, entityLiving);
}
return true;
}

View file

@ -31,7 +31,6 @@ import net.minecraft.entity.LivingEntity;
import net.minecraft.item.*;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import reborncore.common.powerSystem.ExternalPowerSystems;
import reborncore.common.powerSystem.PowerSystem;
import reborncore.common.util.ItemDurabilityExtensions;
import reborncore.common.util.ItemUtils;
@ -76,7 +75,6 @@ public class ItemDrill extends PickaxeItem implements EnergyHolder, ItemDurabili
Random rand = new Random();
if (rand.nextInt(EnchantmentHelper.getLevel(Enchantments.UNBREAKING, stack) + 1) == 0) {
Energy.of(stack).use(cost);
ExternalPowerSystems.requestEnergyFromArmor(stack, entityLiving);
}
return true;
}

View file

@ -36,7 +36,6 @@ import net.minecraft.item.PickaxeItem;
import net.minecraft.item.ToolMaterials;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import reborncore.common.powerSystem.ExternalPowerSystems;
import reborncore.common.powerSystem.PowerSystem;
import reborncore.common.util.ItemDurabilityExtensions;
import reborncore.common.util.ItemUtils;
@ -75,7 +74,6 @@ public class ItemJackhammer extends PickaxeItem implements EnergyHolder, ItemDur
Random rand = new Random();
if (rand.nextInt(EnchantmentHelper.getLevel(Enchantments.UNBREAKING, stack) + 1) == 0) {
Energy.of(stack).use(cost);
ExternalPowerSystems.requestEnergyFromArmor(stack, entityLiving);
}
return true;
}

View file

@ -35,7 +35,6 @@ import net.minecraft.item.*;
import net.minecraft.util.DefaultedList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import reborncore.common.powerSystem.ExternalPowerSystems;
import reborncore.common.powerSystem.PowerSystem;
import reborncore.common.util.ItemDurabilityExtensions;
import reborncore.common.util.ItemUtils;
@ -84,7 +83,6 @@ public class ItemRockCutter extends PickaxeItem implements EnergyHolder, ItemDur
Random rand = new Random();
if (rand.nextInt(EnchantmentHelper.getLevel(Enchantments.UNBREAKING, stack) + 1) == 0) {
Energy.of(stack).use(cost);
ExternalPowerSystems.requestEnergyFromArmor(stack, entityLiving);
}
return true;
}

View file

@ -44,7 +44,6 @@ import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.World;
import reborncore.common.powerSystem.ExternalPowerSystems;
import reborncore.common.util.ChatUtils;
import reborncore.common.util.ItemUtils;
import team.reborn.energy.Energy;
@ -187,8 +186,6 @@ public class ItemIndustrialChainsaw extends ItemChainsaw {
return;
}
ExternalPowerSystems.requestEnergyFromArmor(stack, entityLiving);
blockState.getBlock().afterBreak(world, (PlayerEntity) entityLiving, pos, blockState, world.getBlockEntity(pos), stack);
world.setBlockState(pos, Blocks.AIR.getDefaultState());
world.removeBlockEntity(pos);

View file

@ -47,7 +47,6 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.RayTraceContext;
import net.minecraft.world.World;
import reborncore.common.powerSystem.ExternalPowerSystems;
import reborncore.common.util.ChatUtils;
import reborncore.common.util.ItemUtils;
import team.reborn.energy.Energy;
@ -122,8 +121,6 @@ public class ItemIndustrialDrill extends ItemDrill {
BlockState blockState = world.getBlockState(pos);
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());

View file

@ -42,7 +42,6 @@ import net.minecraft.text.TranslatableText;
import net.minecraft.util.*;
import net.minecraft.world.World;
import reborncore.api.items.ItemStackModifiers;
import reborncore.common.powerSystem.ExternalPowerSystems;
import reborncore.common.powerSystem.PowerSystem;
import reborncore.common.util.ChatUtils;
import reborncore.common.util.ItemDurabilityExtensions;
@ -90,9 +89,7 @@ public class ItemNanosaber extends SwordItem implements EnergyHolder, ItemDurabi
// ItemSword
@Override
public boolean postHit(ItemStack stack, LivingEntity entityHit, LivingEntity entityHitter) {
boolean used = Energy.of(stack).use(cost);
ExternalPowerSystems.requestEnergyFromArmor(stack, entityHitter);
return used;
return Energy.of(stack).use(cost);
}
@Override

View file

@ -39,7 +39,6 @@ import net.minecraft.util.DefaultedList;
import net.minecraft.util.Formatting;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import reborncore.common.powerSystem.ExternalPowerSystems;
import reborncore.common.powerSystem.PowerSystem;
import reborncore.common.util.ItemDurabilityExtensions;
import reborncore.common.util.ItemUtils;
@ -80,7 +79,6 @@ public class ItemOmniTool extends PickaxeItem implements EnergyHolder, ItemDurab
@Override
public boolean postMine(ItemStack stack, World worldIn, BlockState blockIn, BlockPos pos, LivingEntity entityLiving) {
Energy.of(stack).use(cost);
ExternalPowerSystems.requestEnergyFromArmor(stack, entityLiving);
return true;
}
@ -110,7 +108,6 @@ public class ItemOmniTool extends PickaxeItem implements EnergyHolder, ItemDurab
if(Energy.of(stack).use(hitCost)) {
entityliving.damage(DamageSource.player((PlayerEntity) attacker), 8F);
}
ExternalPowerSystems.requestEnergyFromArmor(stack, entityliving);
return false;
}