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

# Conflicts:
#	build.gradle
#	src/main/java/techreborn/client/render/DynamicBucketBakedModel.java
#	src/main/java/techreborn/client/render/DynamicCellBakedModel.java
This commit is contained in:
modmuss50 2019-09-21 12:36:37 +01:00
commit 2d8961589d
219 changed files with 2205 additions and 1634 deletions

View file

@ -46,13 +46,13 @@ import net.minecraft.world.BlockView;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
import reborncore.api.ToolManager;
import reborncore.api.power.EnergyBlockEntity;
import reborncore.common.blocks.BlockWrenchEventHandler;
import reborncore.common.util.WrenchUtils;
import team.reborn.energy.Energy;
import techreborn.blockentity.cable.CableBlockEntity;
import techreborn.config.TechRebornConfig;
import techreborn.init.ModSounds;
import techreborn.init.TRContent;
import techreborn.blockentity.cable.CableBlockEntity;
import techreborn.utils.damageSources.ElectrialShockSource;
import javax.annotation.Nullable;
@ -112,7 +112,7 @@ public class BlockCable extends BlockWithEntity {
private Boolean canConnectTo(IWorld world, BlockPos pos, Direction facing) {
BlockEntity blockEntity = world.getBlockEntity(pos);
if (blockEntity != null && (blockEntity instanceof EnergyBlockEntity || blockEntity instanceof CableBlockEntity)) {
if (blockEntity != null && (Energy.valid(blockEntity) || blockEntity instanceof CableBlockEntity)) {
return Boolean.TRUE;
}
return Boolean.FALSE;

View file

@ -24,11 +24,8 @@
package techreborn.blocks.lighting;
import net.minecraft.block.Block;
import net.minecraft.block.BlockRenderLayer;
import net.minecraft.block.BlockRenderType;
import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.*;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemPlacementContext;
@ -59,14 +56,13 @@ public class BlockLamp extends BaseBlockEntityProvider {
protected final VoxelShape[] shape;
private int cost;
private int brightness;
private static int brightness = 15;
public BlockLamp(int brightness, int cost, double depth, double width) {
super(Block.Settings.of(Material.REDSTONE_LAMP).strength(2f, 2f));
this.setDefaultState(this.stateFactory.getDefaultState().with(FACING, Direction.NORTH).with(ACTIVE, false));
public BlockLamp(int cost, double depth, double width) {
super(FabricBlockSettings.of(Material.REDSTONE_LAMP).strength(2f, 2f).lightLevel(brightness).build());
this.shape = GenCuboidShapes(depth, width);
this.cost = cost;
this.brightness = brightness;
this.setDefaultState(this.stateFactory.getDefaultState().with(FACING, Direction.NORTH).with(ACTIVE, false));
BlockWrenchEventHandler.wrenableBlocks.add(this);
}
@ -135,6 +131,7 @@ public class BlockLamp extends BaseBlockEntityProvider {
return state.get(ACTIVE) ? brightness : 0;
}
@Override
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT;

View file

@ -43,15 +43,13 @@ import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.World;
import reborncore.api.power.ItemPowerManager;
import reborncore.common.powerSystem.ExternalPowerSystems;
import reborncore.common.util.WorldUtils;
import team.reborn.energy.Energy;
import techreborn.events.TRRecipeHandler;
import techreborn.init.ModSounds;
import techreborn.init.TRContent;
import techreborn.items.tool.ItemTreeTap;
import techreborn.items.tool.basic.ItemElectricTreetap;
import java.util.Random;
/**
@ -121,22 +119,16 @@ public class BlockRubberLog extends LogBlock {
if (stack.isEmpty()) {
return false;
}
//TODO: Should it be here??
ItemPowerManager capEnergy = null;
if (stack.getItem() instanceof ItemElectricTreetap) {
capEnergy = new ItemPowerManager(stack);
}
if ((capEnergy != null && capEnergy.getEnergyStored() > 20) || stack.getItem() instanceof ItemTreeTap) {
if ((Energy.valid(stack) && Energy.of(stack).getEnergy() > 20) || stack.getItem() instanceof ItemTreeTap) {
if (state.get(HAS_SAP) && state.get(SAP_SIDE) == hitResult.getSide()) {
worldIn.setBlockState(pos, state.with(HAS_SAP, false).with(SAP_SIDE, Direction.fromHorizontal(0)));
worldIn.playSound(null, pos.getX(), pos.getY(), pos.getZ(), ModSounds.SAP_EXTRACT, SoundCategory.BLOCKS,
0.6F, 1F);
if (!worldIn.isClient) {
if (capEnergy != null) {
capEnergy.useEnergy(20, false);
ExternalPowerSystems.requestEnergyFromArmor(capEnergy, playerIn);
if (Energy.valid(stack)) {
Energy.of(stack).use(20);
ExternalPowerSystems.requestEnergyFromArmor(stack, playerIn);
} else {
playerIn.getStackInHand(Hand.MAIN_HAND).damage(1, playerIn, playerEntity -> {});
}
@ -152,14 +144,4 @@ public class BlockRubberLog extends LogBlock {
}
return false;
}
// @Override
// public void getDrops(BlockState state, DefaultedList<ItemStack> drops, World world, BlockPos pos, int fortune) {
// drops.add(new ItemStack(this));
// if (state.get(HAS_SAP)) {
// if (new Random().nextInt(4) == 0) {
// drops.add(TRContent.Parts.SAP.getStack());
// }
// }
// }
}