Tiered tank and storage blocks, GUI improvements, refactoring, cell nerf and misc organisation (#1932)

Tanks, storage blocks and variouse stuff. Thanks to Dimmerworld!!
This commit is contained in:
Justin Vitale 2020-01-03 08:24:46 +11:00 committed by drcrazy
parent 2fc9557516
commit 9328c47bed
207 changed files with 1830 additions and 928 deletions

View file

@ -55,6 +55,8 @@ public class GenericMachineBlock extends BlockMachineBase {
return blockEntityClass.get();
}
@Override
public IMachineGuiHandler getGui() {
return gui;

View file

@ -41,7 +41,7 @@ import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.util.Torus;
import techreborn.client.EGui;
import techreborn.init.TRContent;
import techreborn.blockentity.fusionReactor.FusionControlComputerBlockEntity;
import techreborn.blockentity.machine.multiblock.FusionControlComputerBlockEntity;
import techreborn.utils.damageSources.FusionDamageSource;
import java.util.List;

View file

@ -22,7 +22,7 @@
* SOFTWARE.
*/
package techreborn.blocks.tier0;
package techreborn.blocks.machine.tier0;
import java.util.Random;

View file

@ -22,7 +22,7 @@
* SOFTWARE.
*/
package techreborn.blocks.tier0;
package techreborn.blocks.machine.tier0;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;

View file

@ -22,7 +22,7 @@
* SOFTWARE.
*/
package techreborn.blocks.tier1;
package techreborn.blocks.machine.tier1;
import net.minecraft.text.LiteralText;
import net.minecraft.util.ActionResult;

View file

@ -22,7 +22,7 @@
* SOFTWARE.
*/
package techreborn.blocks;
package techreborn.blocks.misc;
import net.minecraft.block.Block;
import net.minecraft.block.BlockRenderType;
@ -53,7 +53,7 @@ import reborncore.api.ToolManager;
import reborncore.common.BaseBlockEntityProvider;
import reborncore.common.blocks.BlockWrenchEventHandler;
import reborncore.common.util.WrenchUtils;
import techreborn.blockentity.AlarmBlockEntity;
import techreborn.blockentity.machine.misc.AlarmBlockEntity;
import javax.annotation.Nullable;
import java.util.List;

View file

@ -22,7 +22,7 @@
* SOFTWARE.
*/
package techreborn.blocks;
package techreborn.blocks.misc;
import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.Block;
@ -32,7 +32,7 @@ import net.minecraft.block.entity.BlockEntity;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.world.BlockView;
import reborncore.common.multiblock.BlockMultiblockBase;
import techreborn.blockentity.MachineCasingBlockEntity;
import techreborn.blockentity.machine.multiblock.casing.MachineCasingBlockEntity;
public class BlockMachineCasing extends BlockMultiblockBase {

View file

@ -22,7 +22,7 @@
* SOFTWARE.
*/
package techreborn.blocks;
package techreborn.blocks.misc;
import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.Material;

View file

@ -22,7 +22,7 @@
* SOFTWARE.
*/
package techreborn.blocks;
package techreborn.blocks.misc;
import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.Material;

View file

@ -22,7 +22,7 @@
* SOFTWARE.
*/
package techreborn.blocks;
package techreborn.blocks.misc;
import net.minecraft.util.Formatting;
import net.minecraft.block.Material;

View file

@ -0,0 +1,16 @@
package techreborn.blocks.storage;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import techreborn.blocks.GenericMachineBlock;
import techreborn.client.EGui;
import java.util.function.Supplier;
@Deprecated
public class OldBlock extends GenericMachineBlock {
public OldBlock(EGui gui, Supplier<BlockEntity> blockEntityClass) {
super(gui, blockEntityClass);
}
}

View file

@ -22,11 +22,11 @@
* SOFTWARE.
*/
package techreborn.blocks.storage;
package techreborn.blocks.storage.energy;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import techreborn.blockentity.storage.AdjustableSUBlockEntity;
import techreborn.blockentity.storage.energy.AdjustableSUBlockEntity;
import techreborn.client.EGui;
public class AdjustableSUBlock extends EnergyStorageBlock {

View file

@ -22,7 +22,7 @@
* SOFTWARE.
*/
package techreborn.blocks.storage;
package techreborn.blocks.storage.energy;
import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.Block;

View file

@ -22,11 +22,11 @@
* SOFTWARE.
*/
package techreborn.blocks.storage;
package techreborn.blocks.storage.energy;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import techreborn.blockentity.storage.HighVoltageSUBlockEntity;
import techreborn.blockentity.storage.energy.HighVoltageSUBlockEntity;
import techreborn.client.EGui;
/**

View file

@ -22,7 +22,7 @@
* SOFTWARE.
*/
package techreborn.blocks.storage;
package techreborn.blocks.storage.energy;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
@ -32,7 +32,7 @@ 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.idsu.InterdimensionalSUBlockEntity;
import techreborn.blockentity.storage.energy.idsu.InterdimensionalSUBlockEntity;
import techreborn.client.EGui;
public class InterdimensionalSUBlock extends EnergyStorageBlock {

View file

@ -22,7 +22,7 @@
* SOFTWARE.
*/
package techreborn.blocks.storage;
package techreborn.blocks.storage.energy;
import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.BlockState;
@ -41,7 +41,7 @@ import reborncore.api.ToolManager;
import reborncore.common.BaseBlockEntityProvider;
import reborncore.common.blocks.BlockWrenchEventHandler;
import reborncore.common.util.WrenchUtils;
import techreborn.blockentity.storage.lesu.LSUStorageBlockEntity;
import techreborn.blockentity.storage.energy.lesu.LSUStorageBlockEntity;
/**
* Energy storage block for LESU

View file

@ -22,11 +22,11 @@
* SOFTWARE.
*/
package techreborn.blocks.storage;
package techreborn.blocks.storage.energy;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import techreborn.blockentity.storage.lesu.LapotronicSUBlockEntity;
import techreborn.blockentity.storage.energy.lesu.LapotronicSUBlockEntity;
import techreborn.client.EGui;
public class LapotronicSUBlock extends EnergyStorageBlock {

View file

@ -22,12 +22,12 @@
* SOFTWARE.
*/
package techreborn.blocks.storage;
package techreborn.blocks.storage.energy;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import techreborn.client.EGui;
import techreborn.blockentity.storage.LowVoltageSUBlockEntity;
import techreborn.blockentity.storage.energy.LowVoltageSUBlockEntity;
/**
* Created by modmuss50 on 14/03/2016.

View file

@ -22,11 +22,11 @@
* SOFTWARE.
*/
package techreborn.blocks.storage;
package techreborn.blocks.storage.energy;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import techreborn.blockentity.storage.MediumVoltageSUBlockEntity;
import techreborn.blockentity.storage.energy.MediumVoltageSUBlockEntity;
import techreborn.client.EGui;
/**

View file

@ -0,0 +1,29 @@
package techreborn.blocks.storage.fluid;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.blockentity.IMachineGuiHandler;
import reborncore.common.blocks.BlockMachineBase;
import techreborn.blockentity.storage.fluid.TankUnitBaseBlockEntity;
import techreborn.client.EGui;
import techreborn.init.TRContent;
public class TankUnitBlock extends BlockMachineBase {
public final TRContent.TankUnit unitType;
public TankUnitBlock(TRContent.TankUnit unitType) {
super();
this.unitType = unitType;
}
@Override
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TankUnitBaseBlockEntity(unitType);
}
@Override
public IMachineGuiHandler getGui() {
return EGui.TANK_UNIT;
}
}

View file

@ -0,0 +1,61 @@
package techreborn.blocks.storage.item;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
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;
import techreborn.blockentity.storage.item.StorageUnitBaseBlockEntity;
import techreborn.client.EGui;
import techreborn.init.TRContent;
public class StorageUnitBlock extends BlockMachineBase {
public final TRContent.StorageUnit unitType;
public StorageUnitBlock(TRContent.StorageUnit unitType) {
super();
this.unitType = unitType;
}
@Override
public BlockEntity createBlockEntity(BlockView worldIn) {
return new StorageUnitBaseBlockEntity(unitType);
}
@Override
public ActionResult onUse(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, BlockHitResult hitResult) {
if (unitType == TRContent.StorageUnit.CREATIVE) {
return super.onUse(state, worldIn, pos, playerIn, hand, hitResult);
}
final StorageUnitBaseBlockEntity storageEntity = (StorageUnitBaseBlockEntity) worldIn.getBlockEntity(pos);
ItemStack stackInHand = playerIn.getStackInHand(Hand.MAIN_HAND);
if (storageEntity != null && storageEntity.isSameType(stackInHand)) {
// Add item which is the same type (in users inventory) into storage
for (int i = 0; i < playerIn.inventory.getInvSize() && !storageEntity.isFull(); i++) {
ItemStack curStack = playerIn.inventory.getInvStack(i);
if (storageEntity.isSameType(curStack)) {
playerIn.inventory.setInvStack(i, storageEntity.processInput(curStack));
}
}
return ActionResult.SUCCESS;
}
return super.onUse(state, worldIn, pos, playerIn, hand, hitResult);
}
@Override
public IMachineGuiHandler getGui() {
return EGui.STORAGE_UNIT;
}
}

View file

@ -1,61 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2018 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.blocks.tier3;
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;
import techreborn.client.EGui;
import techreborn.blockentity.machine.tier3.CreativeQuantumChestBlockEntity;
public class BlockCreativeQuantumChest extends BlockMachineBase {
@Override
public BlockEntity createBlockEntity(BlockView worldIn) {
return new CreativeQuantumChestBlockEntity();
}
@Override
public IMachineGuiHandler getGui() {
return EGui.QUANTUM_CHEST;
}
@Override
public boolean isAdvanced() {
return true;
}
@Override
public void onBlockRemoved(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving) {
if (state.getBlock() != newState.getBlock()) {
//lets not drop max int items into the world, that sounds like a bad idea
worldIn.removeBlockEntity(pos);
}
}
}