Separate blocks for Tier1 machines gone

This commit is contained in:
drcrazy 2019-08-01 17:45:59 +03:00
parent 0d9ddc03de
commit 901a4c106a
10 changed files with 15 additions and 385 deletions

View file

@ -3,6 +3,8 @@
*/
package techreborn.blocks;
import java.util.function.Supplier;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.blockentity.IMachineGuiHandler;
@ -11,15 +13,14 @@ import techreborn.client.EGui;
/**
* @author drcrazy
* @param <T>
*
*/
public class GenericMachineBlock extends BlockMachineBase {
private EGui gui;
private Class<?> blockEntityClass;
private Supplier<BlockEntity> blockEntityClass;
public GenericMachineBlock(EGui gui, Class<?> blockEntityClass) {
public GenericMachineBlock(EGui gui, Supplier<BlockEntity> blockEntityClass) {
super();
this.blockEntityClass = blockEntityClass;
this.gui = gui;
@ -30,14 +31,7 @@ public class GenericMachineBlock extends BlockMachineBase {
if (blockEntityClass == null) {
return null;
}
BlockEntity blockEntity = null;
try {
blockEntity = (BlockEntity) blockEntityClass.newInstance();
} catch (InstantiationException | IllegalAccessException e) {
throw new RuntimeException("Failed to create BlockEntity blockEntity", e);
}
return blockEntity;
return blockEntityClass.get();
}
@Override

View file

@ -1,49 +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.tier1;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.blockentity.IMachineGuiHandler;
import reborncore.common.blocks.BlockMachineBase;
import techreborn.client.EGui;
import techreborn.blockentity.machine.tier1.AlloySmelterBlockEntity;
public class BlockAlloySmelter extends BlockMachineBase {
public BlockAlloySmelter() {
super();
}
@Override
public BlockEntity createBlockEntity(BlockView worldIn) {
return new AlloySmelterBlockEntity();
}
@Override
public IMachineGuiHandler getGui() {
return EGui.ALLOY_SMELTER;
}
}

View file

@ -1,45 +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.tier1;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.blockentity.IMachineGuiHandler;
import reborncore.common.blocks.BlockMachineBase;
import techreborn.client.EGui;
import techreborn.blockentity.machine.tier1.AutoCraftingTableBlockEntity;
public class BlockAutoCraftingTable extends BlockMachineBase {
@Override
public BlockEntity createBlockEntity(BlockView worldIn) {
return new AutoCraftingTableBlockEntity();
}
@Override
public IMachineGuiHandler getGui() {
return EGui.AUTO_CRAFTING_TABLE;
}
}

View file

@ -1,45 +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.tier1;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.blockentity.IMachineGuiHandler;
import reborncore.common.blocks.BlockMachineBase;
import techreborn.client.EGui;
import techreborn.blockentity.machine.tier1.CompressorBlockEntity;
public class BlockCompressor extends BlockMachineBase {
@Override
public BlockEntity createBlockEntity(BlockView worldIn) {
return new CompressorBlockEntity();
}
@Override
public IMachineGuiHandler getGui() {
return EGui.COMPRESSOR;
}
}

View file

@ -1,45 +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.tier1;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.blockentity.IMachineGuiHandler;
import reborncore.common.blocks.BlockMachineBase;
import techreborn.client.EGui;
import techreborn.blockentity.machine.tier1.ElectricFurnaceBlockEntity;
public class BlockElectricFurnace extends BlockMachineBase {
@Override
public BlockEntity createBlockEntity(BlockView worldIn) {
return new ElectricFurnaceBlockEntity();
}
@Override
public IMachineGuiHandler getGui() {
return EGui.ELECTRIC_FURNACE;
}
}

View file

@ -1,45 +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.tier1;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.blockentity.IMachineGuiHandler;
import reborncore.common.blocks.BlockMachineBase;
import techreborn.client.EGui;
import techreborn.blockentity.machine.tier1.ExtractorBlockEntity;
public class BlockExtractor extends BlockMachineBase {
@Override
public BlockEntity createBlockEntity(BlockView worldIn) {
return new ExtractorBlockEntity();
}
@Override
public IMachineGuiHandler getGui() {
return EGui.EXTRACTOR;
}
}

View file

@ -1,45 +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.tier1;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.blockentity.IMachineGuiHandler;
import reborncore.common.blocks.BlockMachineBase;
import techreborn.client.EGui;
import techreborn.blockentity.machine.tier1.RecyclerBlockEntity;
public class BlockRecycler extends BlockMachineBase {
@Override
public BlockEntity createBlockEntity(BlockView worldIn) {
return new RecyclerBlockEntity();
}
@Override
public IMachineGuiHandler getGui() {
return EGui.RECYCLER;
}
}

View file

@ -1,45 +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.tier1;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.blockentity.IMachineGuiHandler;
import reborncore.common.blocks.BlockMachineBase;
import techreborn.client.EGui;
import techreborn.blockentity.machine.tier1.RollingMachineBlockEntity;
public class BlockRollingMachine extends BlockMachineBase {
@Override
public BlockEntity createBlockEntity(BlockView worldIn) {
return new RollingMachineBlockEntity();
}
@Override
public IMachineGuiHandler getGui() {
return EGui.ROLLING_MACHINE;
}
}

View file

@ -1,45 +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.tier1;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.blockentity.IMachineGuiHandler;
import reborncore.common.blocks.BlockMachineBase;
import techreborn.client.EGui;
import techreborn.blockentity.machine.tier1.ScrapboxinatorBlockEntity;
public class BlockScrapboxinator extends BlockMachineBase {
@Override
public BlockEntity createBlockEntity(BlockView worldIn) {
return new ScrapboxinatorBlockEntity();
}
@Override
public IMachineGuiHandler getGui() {
return EGui.SCRAPBOXINATOR;
}
}

View file

@ -365,16 +365,16 @@ public class TRContent {
public enum Machine implements ItemConvertible {
ALLOY_SMELTER(new BlockAlloySmelter()),
ASSEMBLY_MACHINE(new GenericMachineBlock(EGui.ASSEMBLING_MACHINE, AssemblingMachineBlockEntity.class)),
AUTO_CRAFTING_TABLE(new BlockAutoCraftingTable()),
ALLOY_SMELTER(new GenericMachineBlock(EGui.ALLOY_SMELTER, () -> new AlloySmelterBlockEntity())),
ASSEMBLY_MACHINE(new GenericMachineBlock(EGui.ASSEMBLING_MACHINE, () -> new AssemblingMachineBlockEntity())),
AUTO_CRAFTING_TABLE(new GenericMachineBlock(EGui.AUTO_CRAFTING_TABLE, () -> new AutoCraftingTableBlockEntity())),
CHEMICAL_REACTOR(new BlockChemicalReactor()),
COMPRESSOR(new BlockCompressor()),
COMPRESSOR(new GenericMachineBlock(EGui.COMPRESSOR, () -> new CompressorBlockEntity())),
DISTILLATION_TOWER(new BlockDistillationTower()),
EXTRACTOR(new BlockExtractor()),
EXTRACTOR(new GenericMachineBlock(EGui.EXTRACTOR, () -> new ExtractorBlockEntity())),
FLUID_REPLICATOR(new BlockFluidReplicator()),
GRINDER(new GenericMachineBlock(EGui.GRINDER, GrinderBlockEntity.class)),
ELECTRIC_FURNACE(new BlockElectricFurnace()),
GRINDER(new GenericMachineBlock(EGui.GRINDER, () -> new GrinderBlockEntity())),
ELECTRIC_FURNACE(new GenericMachineBlock(EGui.ELECTRIC_FURNACE, () -> new ElectricFurnaceBlockEntity())),
IMPLOSION_COMPRESSOR(new BlockImplosionCompressor()),
INDUSTRIAL_BLAST_FURNACE(new BlockIndustrialBlastFurnace()),
INDUSTRIAL_CENTRIFUGE(new BlockIndustrialCentrifuge()),
@ -384,9 +384,9 @@ public class TRContent {
IRON_ALLOY_FURNACE(new BlockIronAlloyFurnace()),
IRON_FURNACE(new BlockIronFurnace()),
MATTER_FABRICATOR(new BlockMatterFabricator()),
RECYCLER(new BlockRecycler()),
ROLLING_MACHINE(new BlockRollingMachine()),
SCRAPBOXINATOR(new BlockScrapboxinator()),
RECYCLER(new GenericMachineBlock(EGui.RECYCLER, () -> new RecyclerBlockEntity())),
ROLLING_MACHINE(new GenericMachineBlock(EGui.ROLLING_MACHINE, () -> new RollingMachineBlockEntity())),
SCRAPBOXINATOR(new GenericMachineBlock(EGui.SCRAPBOXINATOR, () -> new ScrapboxinatorBlockEntity())),
VACUUM_FREEZER(new BlockVacuumFreezer()),
DIESEL_GENERATOR(new BlockDieselGenerator()),