1.17: TechReborn compiles and runs, big thanks to @petabyteboy
Co-authored-by: Milan Pässler <milan@petabyte.dev>
This commit is contained in:
parent
c661de5254
commit
b33f4be5f4
212 changed files with 952 additions and 2025 deletions
|
@ -25,12 +25,13 @@
|
|||
package techreborn.blocks;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import reborncore.api.blockentity.IMachineGuiHandler;
|
||||
import reborncore.common.blocks.BlockMachineBase;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
/**
|
||||
* @author drcrazy
|
||||
|
@ -38,32 +39,30 @@ import java.util.function.Supplier;
|
|||
public class GenericMachineBlock extends BlockMachineBase {
|
||||
|
||||
private final IMachineGuiHandler gui;
|
||||
Supplier<BlockEntity> blockEntityClass;
|
||||
BiFunction<BlockPos, BlockState, BlockEntity> blockEntityClass;
|
||||
|
||||
public GenericMachineBlock(IMachineGuiHandler gui, Supplier<BlockEntity> blockEntityClass) {
|
||||
public GenericMachineBlock(IMachineGuiHandler gui, BiFunction<BlockPos, BlockState, BlockEntity> blockEntityClass) {
|
||||
super();
|
||||
this.blockEntityClass = blockEntityClass;
|
||||
this.gui = gui;
|
||||
}
|
||||
|
||||
public GenericMachineBlock(Block.Settings settings, IMachineGuiHandler gui, Supplier<BlockEntity> blockEntityClass) {
|
||||
public GenericMachineBlock(Block.Settings settings, IMachineGuiHandler gui, BiFunction<BlockPos, BlockState, BlockEntity> blockEntityClass) {
|
||||
super(settings);
|
||||
this.blockEntityClass = blockEntityClass;
|
||||
this.gui = gui;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockEntity createBlockEntity(BlockView worldIn) {
|
||||
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
|
||||
if (blockEntityClass == null) {
|
||||
return null;
|
||||
}
|
||||
return blockEntityClass.get();
|
||||
return blockEntityClass.apply(pos, state);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IMachineGuiHandler getGui() {
|
||||
return gui;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -26,6 +26,8 @@ package techreborn.blocks.cable;
|
|||
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.block.entity.BlockEntityTicker;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
|
@ -148,8 +150,13 @@ public class CableBlock extends BlockWithEntity implements Waterloggable {
|
|||
|
||||
@Nullable
|
||||
@Override
|
||||
public BlockEntity createBlockEntity(BlockView worldIn) {
|
||||
return new CableBlockEntity(type);
|
||||
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
|
||||
return new CableBlockEntity(pos, state, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(World world, BlockState state, BlockEntityType<T> type) {
|
||||
return (world1, pos, state1, blockEntity) -> ((CableBlockEntity) blockEntity).tick(world1, pos, state1, (CableBlockEntity) blockEntity);
|
||||
}
|
||||
|
||||
// Block
|
||||
|
|
|
@ -62,7 +62,7 @@ public final class CableShapeUtil {
|
|||
double z = dir == Direction.NORTH ? 0 : dir == Direction.SOUTH ? 16D : size;
|
||||
double y = dir == Direction.DOWN ? 0 : dir == Direction.UP ? 16D : size;
|
||||
|
||||
VoxelShape shape = Block.createCuboidShape(x, y, z, 16.0D - size, 16.0D - size, 16.0D - size);
|
||||
VoxelShape shape = VoxelShapes.cuboidUnchecked(x, y, z, 16.0D - size, 16.0D - size, 16.0D - size);
|
||||
connections.add(shape);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,6 @@ import net.minecraft.util.ActionResult;
|
|||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.api.blockentity.IMachineGuiHandler;
|
||||
import reborncore.common.blocks.BlockMachineBase;
|
||||
|
@ -83,8 +82,8 @@ public class BlockFusionControlComputer extends BlockMachineBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onSteppedOn(final World worldIn, final BlockPos pos, final Entity entityIn) {
|
||||
super.onSteppedOn(worldIn, pos, entityIn);
|
||||
public void onSteppedOn(final World worldIn, final BlockPos pos, final BlockState state, final Entity entityIn) {
|
||||
super.onSteppedOn(worldIn, pos, state, entityIn);
|
||||
if (worldIn.getBlockEntity(pos) instanceof FusionControlComputerBlockEntity) {
|
||||
if (((FusionControlComputerBlockEntity) worldIn.getBlockEntity(pos)).craftingTickTime != 0
|
||||
&& ((FusionControlComputerBlockEntity) worldIn.getBlockEntity(pos)).isMultiblockValid()) {
|
||||
|
@ -94,8 +93,8 @@ public class BlockFusionControlComputer extends BlockMachineBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public BlockEntity createBlockEntity(BlockView worldIn) {
|
||||
return new FusionControlComputerBlockEntity();
|
||||
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
|
||||
return new FusionControlComputerBlockEntity(pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -27,7 +27,6 @@ package techreborn.blocks.generator;
|
|||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.api.blockentity.IMachineGuiHandler;
|
||||
import reborncore.common.blocks.BlockMachineBase;
|
||||
|
@ -49,8 +48,8 @@ public class BlockSolarPanel extends BlockMachineBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public BlockEntity createBlockEntity(BlockView worldIn) {
|
||||
return new SolarPanelBlockEntity(panelType);
|
||||
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
|
||||
return new SolarPanelBlockEntity(pos, state, panelType);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -32,14 +32,14 @@ import reborncore.api.blockentity.IMachineGuiHandler;
|
|||
import reborncore.common.powerSystem.PowerAcceptorBlockEntity;
|
||||
import techreborn.blocks.GenericMachineBlock;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
/**
|
||||
* An extension of {@link GenericMachineBlock} that provides utilities
|
||||
* for generators, like comparator output based on energy.
|
||||
*/
|
||||
public class GenericGeneratorBlock extends GenericMachineBlock {
|
||||
public GenericGeneratorBlock(IMachineGuiHandler gui, Supplier<BlockEntity> blockEntityClass) {
|
||||
public GenericGeneratorBlock(IMachineGuiHandler gui, BiFunction<BlockPos, BlockState, BlockEntity> blockEntityClass) {
|
||||
super(gui, blockEntityClass);
|
||||
}
|
||||
|
||||
|
|
|
@ -109,8 +109,8 @@ public class LampBlock extends BaseBlockEntityProvider {
|
|||
|
||||
// BaseTileBlock
|
||||
@Override
|
||||
public BlockEntity createBlockEntity(BlockView worldIn) {
|
||||
return new LampBlockEntity();
|
||||
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
|
||||
return new LampBlockEntity(pos, state);
|
||||
}
|
||||
|
||||
// Block
|
||||
|
|
|
@ -65,8 +65,8 @@ public class PlayerDetectorBlock extends BlockMachineBase {
|
|||
|
||||
// BlockMachineBase
|
||||
@Override
|
||||
public BlockEntity createBlockEntity(BlockView worldIn) {
|
||||
return new PlayerDectectorBlockEntity();
|
||||
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
|
||||
return new PlayerDectectorBlockEntity(pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -46,16 +46,16 @@ import reborncore.common.util.WorldUtils;
|
|||
import techreborn.init.TRContent;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
public class ResinBasinBlock extends BaseBlockEntityProvider {
|
||||
|
||||
public static final DirectionProperty FACING = Properties.HORIZONTAL_FACING;
|
||||
public static final BooleanProperty POURING = BooleanProperty.of("pouring");
|
||||
public static final BooleanProperty FULL = BooleanProperty.of("full");
|
||||
Supplier<BlockEntity> blockEntityClass;
|
||||
BiFunction<BlockPos, BlockState, BlockEntity> blockEntityClass;
|
||||
|
||||
public ResinBasinBlock(Supplier<BlockEntity> blockEntityClass) {
|
||||
public ResinBasinBlock(BiFunction<BlockPos, BlockState, BlockEntity> blockEntityClass) {
|
||||
super(Block.Settings.of(Material.WOOD).strength(2F, 2F));
|
||||
this.blockEntityClass = blockEntityClass;
|
||||
|
||||
|
@ -99,11 +99,11 @@ public class ResinBasinBlock extends BaseBlockEntityProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
public BlockEntity createBlockEntity(BlockView worldIn) {
|
||||
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
|
||||
if (blockEntityClass == null) {
|
||||
return null;
|
||||
}
|
||||
return blockEntityClass.get();
|
||||
return blockEntityClass.apply(pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -100,8 +100,8 @@ public class BlockAlarm extends BaseBlockEntityProvider {
|
|||
// BaseTileBlock
|
||||
@Nullable
|
||||
@Override
|
||||
public BlockEntity createBlockEntity(BlockView worldIn) {
|
||||
return new AlarmBlockEntity();
|
||||
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
|
||||
return new AlarmBlockEntity(pos, state);
|
||||
}
|
||||
|
||||
// Block
|
||||
|
|
|
@ -26,6 +26,7 @@ package techreborn.blocks.misc;
|
|||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.sound.SoundCategory;
|
||||
|
@ -35,6 +36,7 @@ import net.minecraft.util.Hand;
|
|||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import reborncore.api.ToolManager;
|
||||
import reborncore.api.blockentity.IMachineGuiHandler;
|
||||
import reborncore.common.blocks.BlockMachineBase;
|
||||
|
@ -71,4 +73,10 @@ public class BlockComputerCube extends BlockMachineBase {
|
|||
}
|
||||
return ActionResult.PASS;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.block.Material;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import reborncore.common.multiblock.BlockMultiblockBase;
|
||||
import techreborn.blockentity.machine.multiblock.casing.MachineCasingBlockEntity;
|
||||
|
||||
|
@ -53,8 +53,8 @@ public class BlockMachineCasing extends BlockMultiblockBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public BlockEntity createBlockEntity(BlockView worldIn) {
|
||||
return new MachineCasingBlockEntity();
|
||||
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
|
||||
return new MachineCasingBlockEntity(pos, state);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -38,7 +38,6 @@ import net.minecraft.state.property.BooleanProperty;
|
|||
import net.minecraft.state.property.DirectionProperty;
|
||||
import net.minecraft.state.property.Properties;
|
||||
import net.minecraft.tag.BlockTags;
|
||||
import net.minecraft.tag.Tag;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
|
@ -88,10 +87,10 @@ public class BlockRubberLog extends PillarBlock {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
/* FIXME @Override
|
||||
public boolean isIn(Tag<Block> tagIn) {
|
||||
return tagIn == BlockTags.LOGS;
|
||||
}
|
||||
}*/
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
|
@ -148,7 +147,7 @@ public class BlockRubberLog extends PillarBlock {
|
|||
} else {
|
||||
stack.damage(1, playerIn, player -> player.sendToolBreakStatus(hand));
|
||||
}
|
||||
if (!playerIn.inventory.insertStack(TRContent.Parts.SAP.getStack())) {
|
||||
if (!playerIn.getInventory().insertStack(TRContent.Parts.SAP.getStack())) {
|
||||
WorldUtils.dropItem(TRContent.Parts.SAP.getStack(), worldIn, pos.offset(hitResult.getSide()));
|
||||
}
|
||||
if (playerIn instanceof ServerPlayerEntity) {
|
||||
|
|
|
@ -24,8 +24,9 @@
|
|||
|
||||
package techreborn.blocks.storage.energy;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import techreborn.blockentity.storage.energy.AdjustableSUBlockEntity;
|
||||
import techreborn.client.GuiType;
|
||||
|
||||
|
@ -36,8 +37,8 @@ public class AdjustableSUBlock extends EnergyStorageBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
public BlockEntity createBlockEntity(BlockView worldIn) {
|
||||
return new AdjustableSUBlockEntity();
|
||||
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
|
||||
return new AdjustableSUBlockEntity(pos, state);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -80,9 +80,9 @@ public abstract class EnergyStorageBlock extends BaseBlockEntityProvider {
|
|||
public void onPlaced(World worldIn, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack) {
|
||||
super.onPlaced(worldIn, pos, state, placer, stack);
|
||||
Direction facing = placer.getHorizontalFacing().getOpposite();
|
||||
if (placer.pitch < -50) {
|
||||
if (placer.getPitch() < -50) {
|
||||
facing = Direction.DOWN;
|
||||
} else if (placer.pitch > 50) {
|
||||
} else if (placer.getPitch() > 50) {
|
||||
facing = Direction.UP;
|
||||
}
|
||||
setFacing(facing, worldIn, pos);
|
||||
|
|
|
@ -24,8 +24,9 @@
|
|||
|
||||
package techreborn.blocks.storage.energy;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import techreborn.blockentity.storage.energy.HighVoltageSUBlockEntity;
|
||||
import techreborn.client.GuiType;
|
||||
|
||||
|
@ -39,8 +40,8 @@ public class HighVoltageSUBlock extends EnergyStorageBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
public BlockEntity createBlockEntity(BlockView worldIn) {
|
||||
return new HighVoltageSUBlockEntity();
|
||||
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
|
||||
return new HighVoltageSUBlockEntity(pos, state);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@ import net.minecraft.entity.LivingEntity;
|
|||
import net.minecraft.item.ItemPlacementContext;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.blockentity.storage.energy.idsu.InterdimensionalSUBlockEntity;
|
||||
import techreborn.client.GuiType;
|
||||
|
@ -42,8 +41,8 @@ public class InterdimensionalSUBlock extends EnergyStorageBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
public BlockEntity createBlockEntity(BlockView worldIn) {
|
||||
return new InterdimensionalSUBlockEntity();
|
||||
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
|
||||
return new InterdimensionalSUBlockEntity(pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -35,7 +35,6 @@ import net.minecraft.util.ActionResult;
|
|||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.api.ToolManager;
|
||||
import reborncore.common.BaseBlockEntityProvider;
|
||||
|
@ -69,8 +68,8 @@ public class LSUStorageBlock extends BaseBlockEntityProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
public BlockEntity createBlockEntity(BlockView worldIn) {
|
||||
return new LSUStorageBlockEntity();
|
||||
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
|
||||
return new LSUStorageBlockEntity(pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,8 +24,9 @@
|
|||
|
||||
package techreborn.blocks.storage.energy;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import techreborn.blockentity.storage.energy.lesu.LapotronicSUBlockEntity;
|
||||
import techreborn.client.GuiType;
|
||||
|
||||
|
@ -36,8 +37,8 @@ public class LapotronicSUBlock extends EnergyStorageBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
public BlockEntity createBlockEntity(BlockView worldIn) {
|
||||
return new LapotronicSUBlockEntity();
|
||||
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
|
||||
return new LapotronicSUBlockEntity(pos, state);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,8 +24,9 @@
|
|||
|
||||
package techreborn.blocks.storage.energy;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import techreborn.blockentity.storage.energy.LowVoltageSUBlockEntity;
|
||||
import techreborn.client.GuiType;
|
||||
|
||||
|
@ -39,7 +40,7 @@ public class LowVoltageSUBlock extends EnergyStorageBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
public BlockEntity createBlockEntity(BlockView worldIn) {
|
||||
return new LowVoltageSUBlockEntity();
|
||||
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
|
||||
return new LowVoltageSUBlockEntity(pos, state);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,8 +24,9 @@
|
|||
|
||||
package techreborn.blocks.storage.energy;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import techreborn.blockentity.storage.energy.MediumVoltageSUBlockEntity;
|
||||
import techreborn.client.GuiType;
|
||||
|
||||
|
@ -39,8 +40,8 @@ public class MediumVoltageSUBlock extends EnergyStorageBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
public BlockEntity createBlockEntity(BlockView worldIn) {
|
||||
return new MediumVoltageSUBlockEntity();
|
||||
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
|
||||
return new MediumVoltageSUBlockEntity(pos, state);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -35,7 +35,6 @@ import net.minecraft.util.ActionResult;
|
|||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.api.blockentity.IMachineGuiHandler;
|
||||
import reborncore.common.blocks.BlockMachineBase;
|
||||
|
@ -59,8 +58,8 @@ public class TankUnitBlock extends BlockMachineBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public BlockEntity createBlockEntity(BlockView worldIn) {
|
||||
return new TankUnitBaseBlockEntity(unitType);
|
||||
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
|
||||
return new TankUnitBaseBlockEntity(pos, state, unitType);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -114,7 +113,7 @@ public class TankUnitBlock extends BlockMachineBase {
|
|||
selectedStack.increment(1);
|
||||
didInsert = true;
|
||||
}else {
|
||||
didInsert = playerIn.inventory.insertStack(item);
|
||||
didInsert = playerIn.getInventory().insertStack(item);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
package techreborn.blocks.storage.item;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
|
@ -36,7 +35,6 @@ import net.minecraft.util.ActionResult;
|
|||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.api.blockentity.IMachineGuiHandler;
|
||||
import reborncore.common.blocks.BlockMachineBase;
|
||||
|
@ -51,13 +49,13 @@ public class StorageUnitBlock extends BlockMachineBase {
|
|||
public final TRContent.StorageUnit unitType;
|
||||
|
||||
public StorageUnitBlock(TRContent.StorageUnit unitType) {
|
||||
super((Settings.of(unitType.name.equals("crude") ? Material.WOOD : Material.METAL).strength(2.0F, 2.0F)));
|
||||
super();
|
||||
this.unitType = unitType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockEntity createBlockEntity(BlockView worldIn) {
|
||||
return new StorageUnitBaseBlockEntity(unitType);
|
||||
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
|
||||
return new StorageUnitBaseBlockEntity(pos, state, unitType);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -74,10 +72,10 @@ public class StorageUnitBlock extends BlockMachineBase {
|
|||
(!storageEntity.isLocked() && storageEntity.isEmpty() && (!(itemInHand instanceof ToolItem))))) {
|
||||
|
||||
// Add item which is the same type (in users inventory) into storage
|
||||
for (int i = 0; i < playerIn.inventory.size() && !storageEntity.isFull(); i++) {
|
||||
ItemStack curStack = playerIn.inventory.getStack(i);
|
||||
for (int i = 0; i < playerIn.getInventory().size() && !storageEntity.isFull(); i++) {
|
||||
ItemStack curStack = playerIn.getInventory().getStack(i);
|
||||
if (curStack.getItem() == itemInHand) {
|
||||
playerIn.inventory.setStack(i, storageEntity.processInput(curStack));
|
||||
playerIn.getInventory().setStack(i, storageEntity.processInput(curStack));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,8 +24,9 @@
|
|||
|
||||
package techreborn.blocks.transformers;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import techreborn.blockentity.transformers.EVTransformerBlockEntity;
|
||||
|
||||
/**
|
||||
|
@ -38,8 +39,8 @@ public class BlockEVTransformer extends BlockTransformer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public BlockEntity createBlockEntity(BlockView worldIn) {
|
||||
return new EVTransformerBlockEntity();
|
||||
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
|
||||
return new EVTransformerBlockEntity(pos, state);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,8 +24,9 @@
|
|||
|
||||
package techreborn.blocks.transformers;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import techreborn.blockentity.transformers.HVTransformerBlockEntity;
|
||||
|
||||
/**
|
||||
|
@ -38,8 +39,8 @@ public class BlockHVTransformer extends BlockTransformer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public BlockEntity createBlockEntity(BlockView worldIn) {
|
||||
return new HVTransformerBlockEntity();
|
||||
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
|
||||
return new HVTransformerBlockEntity(pos, state);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,8 +24,9 @@
|
|||
|
||||
package techreborn.blocks.transformers;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import techreborn.blockentity.transformers.LVTransformerBlockEntity;
|
||||
|
||||
/**
|
||||
|
@ -38,7 +39,7 @@ public class BlockLVTransformer extends BlockTransformer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public BlockEntity createBlockEntity(BlockView worldIn) {
|
||||
return new LVTransformerBlockEntity();
|
||||
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
|
||||
return new LVTransformerBlockEntity(pos, state);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,8 +24,9 @@
|
|||
|
||||
package techreborn.blocks.transformers;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import techreborn.blockentity.transformers.MVTransformerBlockEntity;
|
||||
|
||||
/**
|
||||
|
@ -38,8 +39,8 @@ public class BlockMVTransformer extends BlockTransformer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public BlockEntity createBlockEntity(BlockView worldIn) {
|
||||
return new MVTransformerBlockEntity();
|
||||
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
|
||||
return new MVTransformerBlockEntity(pos, state);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -75,9 +75,9 @@ public abstract class BlockTransformer extends BaseBlockEntityProvider {
|
|||
ItemStack stack) {
|
||||
super.onPlaced(worldIn, pos, state, placer, stack);
|
||||
Direction facing = placer.getHorizontalFacing().getOpposite();
|
||||
if (placer.pitch < -50) {
|
||||
if (placer.getPitch() < -50) {
|
||||
facing = Direction.DOWN;
|
||||
} else if (placer.pitch > 50) {
|
||||
} else if (placer.getPitch() > 50) {
|
||||
facing = Direction.UP;
|
||||
}
|
||||
setFacing(facing, worldIn, pos);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue