Merge remote-tracking branch 'remotes/origin/1.15' into 1.16
# Conflicts: # build.gradle # src/main/java/techreborn/client/GuiHandler.java
This commit is contained in:
commit
0bf6159801
30 changed files with 374 additions and 231 deletions
|
@ -45,7 +45,7 @@ repositories {
|
|||
}
|
||||
}
|
||||
|
||||
version = "3.3.5"
|
||||
version = "3.3.7"
|
||||
|
||||
configurations {
|
||||
shade
|
||||
|
@ -85,6 +85,8 @@ dependencies {
|
|||
modCompileOnly ('curse.maven:towelette:2842017') {
|
||||
transitive = false
|
||||
}
|
||||
|
||||
modApi 'teamreborn:energy:0.1.0'
|
||||
}
|
||||
|
||||
def optionalDependency(String dep) {
|
||||
|
@ -274,4 +276,4 @@ task compileRecipes {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,14 +32,13 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.util.Identifier;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import reborncore.api.power.ItemPowerHolder;
|
||||
import reborncore.common.blockentity.RedstoneConfiguration;
|
||||
import reborncore.common.config.Configuration;
|
||||
import reborncore.common.recipes.RecipeCrafter;
|
||||
import reborncore.common.util.Torus;
|
||||
import reborncore.common.world.DataAttachment;
|
||||
import techreborn.blockentity.storage.energy.idsu.IDSUManager;
|
||||
import techreborn.client.GuiHandler;
|
||||
import techreborn.client.GuiType;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.events.ModRegistry;
|
||||
import techreborn.init.FluidGeneratorRecipes;
|
||||
|
@ -70,8 +69,6 @@ public class TechReborn implements ModInitializer {
|
|||
INSTANCE = this;
|
||||
new Configuration(TechRebornConfig.class, "techreborn");
|
||||
|
||||
ItemPowerHolder.setup();
|
||||
|
||||
// Done to force the class to load
|
||||
ModRecipes.GRINDER.getName();
|
||||
|
||||
|
@ -85,10 +82,10 @@ public class TechReborn implements ModInitializer {
|
|||
}
|
||||
ModLoot.init();
|
||||
WorldGenerator.initBiomeFeatures();
|
||||
GuiHandler.register();
|
||||
FluidGeneratorRecipes.init();
|
||||
//Force loads the block entities at the right time
|
||||
TRBlockEntities.THERMAL_GEN.toString();
|
||||
GuiType.AESU.getIdentifier();
|
||||
TRDispenserBehavior.init();
|
||||
PoweredCraftingHandler.setup();
|
||||
|
||||
|
|
|
@ -24,10 +24,6 @@
|
|||
|
||||
package techreborn.blockentity.cable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
|
@ -57,6 +53,10 @@ import techreborn.blocks.cable.CableBlock;
|
|||
import techreborn.init.TRBlockEntities;
|
||||
import techreborn.init.TRContent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 19/05/2017.
|
||||
*/
|
||||
|
@ -66,7 +66,7 @@ public class CableBlockEntity extends BlockEntity
|
|||
|
||||
private double energy = 0;
|
||||
private TRContent.Cables cableType = null;
|
||||
private ArrayList<EnergySide> sendingFace = new ArrayList<>();
|
||||
private ArrayList<Direction> sendingFace = new ArrayList<>();
|
||||
private BlockState cover = null;
|
||||
|
||||
public CableBlockEntity() {
|
||||
|
@ -143,17 +143,16 @@ public class CableBlockEntity extends BlockEntity
|
|||
|
||||
ArrayList<Pair<BlockEntity, Direction>> acceptors = new ArrayList<>();
|
||||
for (Direction face : Direction.values()) {
|
||||
EnergySide side = EnergySide.fromMinecraft(face);
|
||||
BlockEntity blockEntity = world.getBlockEntity(pos.offset(face));
|
||||
|
||||
if (blockEntity != null && Energy.valid(blockEntity)) {
|
||||
if (blockEntity instanceof CableBlockEntity && energy <= Energy.of(blockEntity).side(EnergySide.fromMinecraft(face)).getEnergy()) {
|
||||
if (blockEntity instanceof CableBlockEntity && energy <= Energy.of(blockEntity).side(face).getEnergy()) {
|
||||
continue;
|
||||
}
|
||||
if(Energy.of(blockEntity).side(EnergySide.fromMinecraft(face.getOpposite())).getMaxInput() > 0){
|
||||
if(Energy.of(blockEntity).side(face.getOpposite()).getMaxInput() > 0){
|
||||
acceptors.add(Pair.of(blockEntity, face));
|
||||
if (!sendingFace.contains(side)) {
|
||||
sendingFace.add(side);
|
||||
if (!sendingFace.contains(face)) {
|
||||
sendingFace.add(face);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -166,7 +165,7 @@ public class CableBlockEntity extends BlockEntity
|
|||
|
||||
acceptors.forEach(pair -> {
|
||||
Energy.of(this)
|
||||
.into(Energy.of(pair.getLeft()).side(EnergySide.fromMinecraft(pair.getRight().getOpposite())))
|
||||
.into(Energy.of(pair.getLeft()).side(pair.getRight().getOpposite()))
|
||||
.move();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -335,7 +335,7 @@ public class FusionControlComputerBlockEntity extends PowerAcceptorBlockEntity
|
|||
if (!hasStartedCrafting) {
|
||||
return 0;
|
||||
}
|
||||
return Integer.MAX_VALUE;
|
||||
return TechRebornConfig.fusionControlComputerMaxOutput;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -39,7 +39,7 @@ import techreborn.init.TRContent;
|
|||
public class SoildCanningMachineBlockEntity extends GenericMachineBlockEntity implements BuiltScreenHandlerProvider {
|
||||
|
||||
public SoildCanningMachineBlockEntity() {
|
||||
super(TRBlockEntities.SOLID_CANNING_MACHINE, "SolidCanningMachine", TechRebornConfig.solidCanningMachineMaxInput, TechRebornConfig.solidFuelGeneratorMaxEnergy, TRContent.Machine.SOLID_CANNING_MACHINE.block, 3);
|
||||
super(TRBlockEntities.SOLID_CANNING_MACHINE, "SolidCanningMachine", TechRebornConfig.solidCanningMachineMaxInput, TechRebornConfig.solidCanningMachineMaxEnergy, TRContent.Machine.SOLID_CANNING_MACHINE.block, 3);
|
||||
final int[] inputs = new int[] { 0, 1 };
|
||||
final int[] outputs = new int[] { 2 };
|
||||
this.inventory = new RebornInventory<>(4, "SolidCanningMachineBlockEntity", 64, this);
|
||||
|
|
|
@ -26,7 +26,7 @@ package techreborn.blocks;
|
|||
|
||||
import net.minecraft.util.Identifier;
|
||||
import techreborn.blockentity.data.DataDrivenBEProvider;
|
||||
import techreborn.client.EGui;
|
||||
import techreborn.client.GuiType;
|
||||
|
||||
/**
|
||||
* @author modmuss50
|
||||
|
@ -37,7 +37,7 @@ public class DataDrivenMachineBlock extends GenericMachineBlock {
|
|||
private final DataDrivenBEProvider provider;
|
||||
|
||||
public DataDrivenMachineBlock(String ident){
|
||||
super(EGui.DATA_DRIVEN, null);
|
||||
super(GuiType.DATA_DRIVEN, null);
|
||||
provider = DataDrivenBEProvider.create(this, new Identifier(ident));
|
||||
blockEntityClass = provider;
|
||||
}
|
||||
|
|
|
@ -24,11 +24,11 @@
|
|||
|
||||
package techreborn.blocks;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
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 java.util.function.Supplier;
|
||||
|
||||
|
@ -38,15 +38,21 @@ import java.util.function.Supplier;
|
|||
*/
|
||||
public class GenericMachineBlock extends BlockMachineBase {
|
||||
|
||||
private EGui gui;
|
||||
private IMachineGuiHandler gui;
|
||||
Supplier<BlockEntity> blockEntityClass;
|
||||
|
||||
public GenericMachineBlock(EGui gui, Supplier<BlockEntity> blockEntityClass) {
|
||||
public GenericMachineBlock(IMachineGuiHandler gui, Supplier<BlockEntity> blockEntityClass) {
|
||||
super();
|
||||
this.blockEntityClass = blockEntityClass;
|
||||
this.gui = gui;
|
||||
}
|
||||
|
||||
public GenericMachineBlock(Block.Settings settings, IMachineGuiHandler gui, Supplier<BlockEntity> blockEntityClass) {
|
||||
super(settings);
|
||||
this.blockEntityClass = blockEntityClass;
|
||||
this.gui = gui;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockEntity createBlockEntity(BlockView worldIn) {
|
||||
if (blockEntityClass == null) {
|
||||
|
|
|
@ -39,9 +39,9 @@ import net.minecraft.world.World;
|
|||
import reborncore.api.blockentity.IMachineGuiHandler;
|
||||
import reborncore.common.blocks.BlockMachineBase;
|
||||
import reborncore.common.util.Torus;
|
||||
import techreborn.client.EGui;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.blockentity.machine.multiblock.FusionControlComputerBlockEntity;
|
||||
import techreborn.client.GuiType;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.utils.damageSources.FusionDamageSource;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -78,7 +78,7 @@ public class BlockFusionControlComputer extends BlockMachineBase {
|
|||
|
||||
@Override
|
||||
public IMachineGuiHandler getGui() {
|
||||
return EGui.FUSION_CONTROLLER;
|
||||
return GuiType.FUSION_CONTROLLER;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -33,7 +33,7 @@ import reborncore.api.blockentity.IMachineGuiHandler;
|
|||
import reborncore.common.blocks.BlockMachineBase;
|
||||
import reborncore.common.powerSystem.PowerAcceptorBlockEntity;
|
||||
import techreborn.blockentity.generator.SolarPanelBlockEntity;
|
||||
import techreborn.client.EGui;
|
||||
import techreborn.client.GuiType;
|
||||
import techreborn.init.TRContent.SolarPanels;
|
||||
|
||||
/**
|
||||
|
@ -58,7 +58,7 @@ public class BlockSolarPanel extends BlockMachineBase {
|
|||
if(this.panelType == SolarPanels.CREATIVE){
|
||||
return null;
|
||||
}
|
||||
return EGui.SOLAR_PANEL;
|
||||
return GuiType.SOLAR_PANEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -28,9 +28,9 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.api.blockentity.IMachineGuiHandler;
|
||||
import reborncore.common.powerSystem.PowerAcceptorBlockEntity;
|
||||
import techreborn.blocks.GenericMachineBlock;
|
||||
import techreborn.client.EGui;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
|
@ -39,7 +39,7 @@ import java.util.function.Supplier;
|
|||
* for generators, like comparator output based on energy.
|
||||
*/
|
||||
public class GenericGeneratorBlock extends GenericMachineBlock {
|
||||
public GenericGeneratorBlock(EGui gui, Supplier<BlockEntity> blockEntityClass) {
|
||||
public GenericGeneratorBlock(IMachineGuiHandler gui, Supplier<BlockEntity> blockEntityClass) {
|
||||
super(gui, blockEntityClass);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,8 +24,6 @@
|
|||
|
||||
package techreborn.blocks.machine.tier0;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.block.BlockState;
|
||||
|
@ -35,14 +33,16 @@ import net.minecraft.sound.SoundEvents;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.client.EGui;
|
||||
import techreborn.blockentity.machine.iron.IronAlloyFurnaceBlockEntity;
|
||||
import techreborn.blocks.GenericMachineBlock;
|
||||
import techreborn.client.GuiType;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class IronAlloyFurnaceBlock extends GenericMachineBlock {
|
||||
|
||||
public IronAlloyFurnaceBlock() {
|
||||
super(EGui.ALLOY_FURNACE, IronAlloyFurnaceBlockEntity::new);
|
||||
super(GuiType.ALLOY_FURNACE, IronAlloyFurnaceBlockEntity::new);
|
||||
}
|
||||
|
||||
// Block
|
||||
|
|
|
@ -33,16 +33,16 @@ import net.minecraft.sound.SoundEvents;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.client.EGui;
|
||||
import techreborn.blockentity.machine.iron.IronFurnaceBlockEntity;
|
||||
import techreborn.blocks.GenericMachineBlock;
|
||||
import techreborn.client.GuiType;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class IronFurnaceBlock extends GenericMachineBlock {
|
||||
|
||||
public IronFurnaceBlock() {
|
||||
super(EGui.IRON_FURNACE, IronFurnaceBlockEntity::new);
|
||||
super(GuiType.IRON_FURNACE, IronFurnaceBlockEntity::new);
|
||||
}
|
||||
|
||||
// Block
|
||||
|
|
|
@ -24,17 +24,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 techreborn.client.GuiType;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@Deprecated
|
||||
public class OldBlock extends GenericMachineBlock {
|
||||
|
||||
public OldBlock(EGui gui, Supplier<BlockEntity> blockEntityClass) {
|
||||
public OldBlock(GuiType gui, Supplier<BlockEntity> blockEntityClass) {
|
||||
super(gui, blockEntityClass);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,12 +27,12 @@ package techreborn.blocks.storage.energy;
|
|||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.world.BlockView;
|
||||
import techreborn.blockentity.storage.energy.AdjustableSUBlockEntity;
|
||||
import techreborn.client.EGui;
|
||||
import techreborn.client.GuiType;
|
||||
|
||||
public class AdjustableSUBlock extends EnergyStorageBlock {
|
||||
|
||||
public AdjustableSUBlock() {
|
||||
super("AESU", EGui.AESU);
|
||||
super("AESU", GuiType.AESU);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -27,7 +27,7 @@ package techreborn.blocks.storage.energy;
|
|||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.world.BlockView;
|
||||
import techreborn.blockentity.storage.energy.HighVoltageSUBlockEntity;
|
||||
import techreborn.client.EGui;
|
||||
import techreborn.client.GuiType;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 14/03/2016.
|
||||
|
@ -35,7 +35,7 @@ import techreborn.client.EGui;
|
|||
public class HighVoltageSUBlock extends EnergyStorageBlock {
|
||||
|
||||
public HighVoltageSUBlock() {
|
||||
super("high_voltage_su", EGui.HIGH_VOLTAGE_SU);
|
||||
super("high_voltage_su", GuiType.HIGH_VOLTAGE_SU);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -33,12 +33,12 @@ 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.EGui;
|
||||
import techreborn.client.GuiType;
|
||||
|
||||
public class InterdimensionalSUBlock extends EnergyStorageBlock {
|
||||
|
||||
public InterdimensionalSUBlock() {
|
||||
super("IDSU", EGui.IDSU);
|
||||
super("IDSU", GuiType.IDSU);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -27,12 +27,12 @@ package techreborn.blocks.storage.energy;
|
|||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.world.BlockView;
|
||||
import techreborn.blockentity.storage.energy.lesu.LapotronicSUBlockEntity;
|
||||
import techreborn.client.EGui;
|
||||
import techreborn.client.GuiType;
|
||||
|
||||
public class LapotronicSUBlock extends EnergyStorageBlock {
|
||||
|
||||
public LapotronicSUBlock() {
|
||||
super("LESU", EGui.LESU);
|
||||
super("LESU", GuiType.LESU);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -26,8 +26,8 @@ package techreborn.blocks.storage.energy;
|
|||
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.world.BlockView;
|
||||
import techreborn.client.EGui;
|
||||
import techreborn.blockentity.storage.energy.LowVoltageSUBlockEntity;
|
||||
import techreborn.client.GuiType;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 14/03/2016.
|
||||
|
@ -35,7 +35,7 @@ import techreborn.blockentity.storage.energy.LowVoltageSUBlockEntity;
|
|||
public class LowVoltageSUBlock extends EnergyStorageBlock {
|
||||
|
||||
public LowVoltageSUBlock() {
|
||||
super("low_voltage_su", EGui.LOW_VOLTAGE_SU);
|
||||
super("low_voltage_su", GuiType.LOW_VOLTAGE_SU);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -27,7 +27,7 @@ package techreborn.blocks.storage.energy;
|
|||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.world.BlockView;
|
||||
import techreborn.blockentity.storage.energy.MediumVoltageSUBlockEntity;
|
||||
import techreborn.client.EGui;
|
||||
import techreborn.client.GuiType;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 14/03/2016.
|
||||
|
@ -35,7 +35,7 @@ import techreborn.client.EGui;
|
|||
public class MediumVoltageSUBlock extends EnergyStorageBlock {
|
||||
|
||||
public MediumVoltageSUBlock() {
|
||||
super("medium_voltage_su", EGui.MEDIUM_VOLTAGE_SU);
|
||||
super("medium_voltage_su", GuiType.MEDIUM_VOLTAGE_SU);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -29,7 +29,7 @@ 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.client.GuiType;
|
||||
import techreborn.init.TRContent;
|
||||
|
||||
public class TankUnitBlock extends BlockMachineBase {
|
||||
|
@ -48,6 +48,6 @@ public class TankUnitBlock extends BlockMachineBase {
|
|||
|
||||
@Override
|
||||
public IMachineGuiHandler getGui() {
|
||||
return EGui.TANK_UNIT;
|
||||
return GuiType.TANK_UNIT;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ 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.client.GuiType;
|
||||
import techreborn.init.TRContent;
|
||||
|
||||
public class StorageUnitBlock extends BlockMachineBase {
|
||||
|
@ -80,6 +80,6 @@ public class StorageUnitBlock extends BlockMachineBase {
|
|||
|
||||
@Override
|
||||
public IMachineGuiHandler getGui() {
|
||||
return EGui.STORAGE_UNIT;
|
||||
return GuiType.STORAGE_UNIT;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,122 +0,0 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2020 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.client;
|
||||
|
||||
import net.fabricmc.fabric.api.container.ContainerProviderRegistry;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.api.blockentity.IMachineGuiHandler;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public enum EGui implements IMachineGuiHandler {
|
||||
|
||||
AESU,
|
||||
ALLOY_FURNACE,
|
||||
ALLOY_SMELTER,
|
||||
ASSEMBLING_MACHINE,
|
||||
AUTO_CRAFTING_TABLE,
|
||||
BLAST_FURNACE,
|
||||
CENTRIFUGE,
|
||||
CHARGEBENCH,
|
||||
CHEMICAL_REACTOR,
|
||||
CHUNK_LOADER,
|
||||
COMPRESSOR,
|
||||
DIESEL_GENERATOR,
|
||||
DISTILLATION_TOWER,
|
||||
ELECTRIC_FURNACE,
|
||||
EXTRACTOR,
|
||||
FUSION_CONTROLLER,
|
||||
GAS_TURBINE,
|
||||
GENERATOR,
|
||||
HIGH_VOLTAGE_SU,
|
||||
IDSU,
|
||||
IMPLOSION_COMPRESSOR,
|
||||
INDUSTRIAL_ELECTROLYZER,
|
||||
INDUSTRIAL_GRINDER,
|
||||
IRON_FURNACE,
|
||||
LESU,
|
||||
LOW_VOLTAGE_SU,
|
||||
MANUAL(false),
|
||||
MATTER_FABRICATOR,
|
||||
MEDIUM_VOLTAGE_SU,
|
||||
PLASMA_GENERATOR,
|
||||
STORAGE_UNIT,
|
||||
TANK_UNIT,
|
||||
RECYCLER,
|
||||
ROLLING_MACHINE,
|
||||
SAWMILL,
|
||||
SCRAPBOXINATOR,
|
||||
SOLAR_PANEL,
|
||||
SEMIFLUID_GENERATOR,
|
||||
THERMAL_GENERATOR,
|
||||
VACUUM_FREEZER,
|
||||
SOLID_CANNING_MACHINE,
|
||||
WIRE_MILL,
|
||||
GREENHOUSE_CONTROLLER,
|
||||
FLUID_REPLICATOR,
|
||||
|
||||
DATA_DRIVEN;
|
||||
|
||||
private final boolean containerBuilder;
|
||||
|
||||
EGui(final boolean containerBuilder) {
|
||||
this.containerBuilder = containerBuilder;
|
||||
}
|
||||
|
||||
EGui(){
|
||||
this(true);
|
||||
}
|
||||
|
||||
public static EGui byID(Identifier resourceLocation){
|
||||
return Arrays.stream(values())
|
||||
.filter(eGui -> eGui.name().toLowerCase(Locale.ROOT).equals(resourceLocation.getPath()))
|
||||
.findFirst()
|
||||
.orElseThrow(() -> new RuntimeException("Failed to find gui for " + resourceLocation));
|
||||
}
|
||||
|
||||
public static Stream<EGui> stream(){
|
||||
return Arrays.stream(values());
|
||||
}
|
||||
|
||||
public Identifier getID(){
|
||||
return new Identifier("techreborn", name().toLowerCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open(PlayerEntity player, BlockPos pos, World world) {
|
||||
if(!world.isClient){
|
||||
ContainerProviderRegistry.INSTANCE.openContainer(getID(), player, packetByteBuf -> packetByteBuf.writeBlockPos(pos));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean useContainerBuilder() {
|
||||
return this.containerBuilder;
|
||||
}
|
||||
}
|
219
src/main/java/techreborn/client/GuiType.java
Normal file
219
src/main/java/techreborn/client/GuiType.java
Normal file
|
@ -0,0 +1,219 @@
|
|||
package techreborn.client;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.fabric.api.client.screen.ScreenProviderRegistry;
|
||||
import net.fabricmc.fabric.api.container.ContainerFactory;
|
||||
import net.fabricmc.fabric.api.container.ContainerProviderRegistry;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.client.gui.screen.ingame.ContainerScreen;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.PacketByteBuf;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.RebornCore;
|
||||
import reborncore.api.blockentity.IMachineGuiHandler;
|
||||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import techreborn.blockentity.data.DataDrivenBEProvider;
|
||||
import techreborn.blockentity.data.DataDrivenGui;
|
||||
import techreborn.blockentity.generator.PlasmaGeneratorBlockEntity;
|
||||
import techreborn.blockentity.generator.SolarPanelBlockEntity;
|
||||
import techreborn.blockentity.generator.advanced.DieselGeneratorBlockEntity;
|
||||
import techreborn.blockentity.generator.advanced.GasTurbineBlockEntity;
|
||||
import techreborn.blockentity.generator.advanced.SemiFluidGeneratorBlockEntity;
|
||||
import techreborn.blockentity.generator.advanced.ThermalGeneratorBlockEntity;
|
||||
import techreborn.blockentity.generator.basic.SolidFuelGeneratorBlockEntity;
|
||||
import techreborn.blockentity.machine.iron.IronAlloyFurnaceBlockEntity;
|
||||
import techreborn.blockentity.machine.iron.IronFurnaceBlockEntity;
|
||||
import techreborn.blockentity.machine.misc.ChargeOMatBlockEntity;
|
||||
import techreborn.blockentity.machine.multiblock.DistillationTowerBlockEntity;
|
||||
import techreborn.blockentity.machine.multiblock.FluidReplicatorBlockEntity;
|
||||
import techreborn.blockentity.machine.multiblock.FusionControlComputerBlockEntity;
|
||||
import techreborn.blockentity.machine.multiblock.ImplosionCompressorBlockEntity;
|
||||
import techreborn.blockentity.machine.multiblock.IndustrialBlastFurnaceBlockEntity;
|
||||
import techreborn.blockentity.machine.multiblock.IndustrialGrinderBlockEntity;
|
||||
import techreborn.blockentity.machine.multiblock.IndustrialSawmillBlockEntity;
|
||||
import techreborn.blockentity.machine.multiblock.VacuumFreezerBlockEntity;
|
||||
import techreborn.blockentity.machine.tier1.AlloySmelterBlockEntity;
|
||||
import techreborn.blockentity.machine.tier1.AssemblingMachineBlockEntity;
|
||||
import techreborn.blockentity.machine.tier1.AutoCraftingTableBlockEntity;
|
||||
import techreborn.blockentity.machine.tier1.ChemicalReactorBlockEntity;
|
||||
import techreborn.blockentity.machine.tier1.CompressorBlockEntity;
|
||||
import techreborn.blockentity.machine.tier1.ElectricFurnaceBlockEntity;
|
||||
import techreborn.blockentity.machine.tier1.ExtractorBlockEntity;
|
||||
import techreborn.blockentity.machine.tier1.GreenhouseControllerBlockEntity;
|
||||
import techreborn.blockentity.machine.tier1.IndustrialElectrolyzerBlockEntity;
|
||||
import techreborn.blockentity.machine.tier1.RecyclerBlockEntity;
|
||||
import techreborn.blockentity.machine.tier1.RollingMachineBlockEntity;
|
||||
import techreborn.blockentity.machine.tier1.ScrapboxinatorBlockEntity;
|
||||
import techreborn.blockentity.machine.tier1.SoildCanningMachineBlockEntity;
|
||||
import techreborn.blockentity.machine.tier1.WireMillBlockEntity;
|
||||
import techreborn.blockentity.machine.tier3.ChunkLoaderBlockEntity;
|
||||
import techreborn.blockentity.machine.tier3.IndustrialCentrifugeBlockEntity;
|
||||
import techreborn.blockentity.machine.tier3.MatterFabricatorBlockEntity;
|
||||
import techreborn.blockentity.storage.energy.AdjustableSUBlockEntity;
|
||||
import techreborn.blockentity.storage.energy.HighVoltageSUBlockEntity;
|
||||
import techreborn.blockentity.storage.energy.LowVoltageSUBlockEntity;
|
||||
import techreborn.blockentity.storage.energy.MediumVoltageSUBlockEntity;
|
||||
import techreborn.blockentity.storage.energy.idsu.InterdimensionalSUBlockEntity;
|
||||
import techreborn.blockentity.storage.energy.lesu.LapotronicSUBlockEntity;
|
||||
import techreborn.blockentity.storage.fluid.TankUnitBaseBlockEntity;
|
||||
import techreborn.blockentity.storage.item.StorageUnitBaseBlockEntity;
|
||||
import techreborn.client.gui.GuiAESU;
|
||||
import techreborn.client.gui.GuiAlloyFurnace;
|
||||
import techreborn.client.gui.GuiAlloySmelter;
|
||||
import techreborn.client.gui.GuiAssemblingMachine;
|
||||
import techreborn.client.gui.GuiAutoCrafting;
|
||||
import techreborn.client.gui.GuiBatbox;
|
||||
import techreborn.client.gui.GuiBlastFurnace;
|
||||
import techreborn.client.gui.GuiCentrifuge;
|
||||
import techreborn.client.gui.GuiChargeBench;
|
||||
import techreborn.client.gui.GuiChemicalReactor;
|
||||
import techreborn.client.gui.GuiChunkLoader;
|
||||
import techreborn.client.gui.GuiCompressor;
|
||||
import techreborn.client.gui.GuiDieselGenerator;
|
||||
import techreborn.client.gui.GuiDistillationTower;
|
||||
import techreborn.client.gui.GuiElectricFurnace;
|
||||
import techreborn.client.gui.GuiExtractor;
|
||||
import techreborn.client.gui.GuiFluidReplicator;
|
||||
import techreborn.client.gui.GuiFusionReactor;
|
||||
import techreborn.client.gui.GuiGasTurbine;
|
||||
import techreborn.client.gui.GuiGenerator;
|
||||
import techreborn.client.gui.GuiGreenhouseController;
|
||||
import techreborn.client.gui.GuiIDSU;
|
||||
import techreborn.client.gui.GuiImplosionCompressor;
|
||||
import techreborn.client.gui.GuiIndustrialElectrolyzer;
|
||||
import techreborn.client.gui.GuiIndustrialGrinder;
|
||||
import techreborn.client.gui.GuiIndustrialSawmill;
|
||||
import techreborn.client.gui.GuiIronFurnace;
|
||||
import techreborn.client.gui.GuiLESU;
|
||||
import techreborn.client.gui.GuiMFE;
|
||||
import techreborn.client.gui.GuiMFSU;
|
||||
import techreborn.client.gui.GuiMatterFabricator;
|
||||
import techreborn.client.gui.GuiPlasmaGenerator;
|
||||
import techreborn.client.gui.GuiRecycler;
|
||||
import techreborn.client.gui.GuiRollingMachine;
|
||||
import techreborn.client.gui.GuiScrapboxinator;
|
||||
import techreborn.client.gui.GuiSemifluidGenerator;
|
||||
import techreborn.client.gui.GuiSolar;
|
||||
import techreborn.client.gui.GuiSolidCanningMachine;
|
||||
import techreborn.client.gui.GuiStorageUnit;
|
||||
import techreborn.client.gui.GuiTankUnit;
|
||||
import techreborn.client.gui.GuiThermalGenerator;
|
||||
import techreborn.client.gui.GuiVacuumFreezer;
|
||||
import techreborn.client.gui.GuiWireMill;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
//The meme is here the double suppliers dont cause the client side gui classes to load on the server
|
||||
public final class GuiType<T extends BlockEntity> implements IMachineGuiHandler {
|
||||
private static final Map<Identifier, GuiType<?>> TYPES = new HashMap<>();
|
||||
|
||||
public static final GuiType<AdjustableSUBlockEntity> AESU = register("aesu", () -> () -> GuiAESU::new);
|
||||
public static final GuiType<IronAlloyFurnaceBlockEntity> ALLOY_FURNACE = register("alloy_furnace", () -> () -> GuiAlloyFurnace::new);
|
||||
public static final GuiType<AlloySmelterBlockEntity> ALLOY_SMELTER = register("alloy_smelter", () -> () -> GuiAlloySmelter::new);
|
||||
public static final GuiType<AssemblingMachineBlockEntity> ASSEMBLING_MACHINE = register("assembling_machine", () -> () -> GuiAssemblingMachine::new);
|
||||
public static final GuiType<LowVoltageSUBlockEntity> LOW_VOLTAGE_SU = register("low_voltage_su", () -> () -> GuiBatbox::new);
|
||||
public static final GuiType<AutoCraftingTableBlockEntity> AUTO_CRAFTING_TABLE = register("auto_crafting_table", () -> () -> GuiAutoCrafting::new);
|
||||
public static final GuiType<IndustrialBlastFurnaceBlockEntity> BLAST_FURNACE = register("blast_furnace", () -> () -> GuiBlastFurnace::new);
|
||||
public static final GuiType<IndustrialCentrifugeBlockEntity> CENTRIFUGE = register("centrifuge", () -> () -> GuiCentrifuge::new);
|
||||
public static final GuiType<ChargeOMatBlockEntity> CHARGEBENCH = register("chargebench", () -> () -> GuiChargeBench::new);
|
||||
public static final GuiType<ChemicalReactorBlockEntity> CHEMICAL_REACTOR = register("chemical_reactor", () -> () -> GuiChemicalReactor::new);
|
||||
public static final GuiType<ChunkLoaderBlockEntity> CHUNK_LOADER = register("chunk_loader", () -> () -> GuiChunkLoader::new);
|
||||
public static final GuiType<CompressorBlockEntity> COMPRESSOR = register("compressor", () -> () -> GuiCompressor::new);
|
||||
public static final GuiType<DieselGeneratorBlockEntity> DIESEL_GENERATOR = register("diesel_generator", () -> () -> GuiDieselGenerator::new);
|
||||
public static final GuiType<DistillationTowerBlockEntity> DISTILLATION_TOWER = register("distillation_tower", () -> () -> GuiDistillationTower::new);
|
||||
public static final GuiType<ElectricFurnaceBlockEntity> ELECTRIC_FURNACE = register("electric_furnace", () -> () -> GuiElectricFurnace::new);
|
||||
public static final GuiType<ExtractorBlockEntity> EXTRACTOR = register("extractor", () -> () -> GuiExtractor::new);
|
||||
public static final GuiType<FusionControlComputerBlockEntity> FUSION_CONTROLLER = register("fusion_controller", () -> () -> GuiFusionReactor::new);
|
||||
public static final GuiType<GasTurbineBlockEntity> GAS_TURBINE = register("gas_turbine", () -> () -> GuiGasTurbine::new);
|
||||
public static final GuiType<SolidFuelGeneratorBlockEntity> GENERATOR = register("generator", () -> () -> GuiGenerator::new);
|
||||
public static final GuiType<HighVoltageSUBlockEntity> HIGH_VOLTAGE_SU = register("high_voltage_su", () -> () -> GuiMFSU::new);
|
||||
public static final GuiType<InterdimensionalSUBlockEntity> IDSU = register("idsu", () -> () -> GuiIDSU::new);
|
||||
public static final GuiType<ImplosionCompressorBlockEntity> IMPLOSION_COMPRESSOR = register("implosion_compressor", () -> () -> GuiImplosionCompressor::new);
|
||||
public static final GuiType<IndustrialElectrolyzerBlockEntity> INDUSTRIAL_ELECTROLYZER = register("industrial_electrolyzer", () -> () -> GuiIndustrialElectrolyzer::new);
|
||||
public static final GuiType<IndustrialGrinderBlockEntity> INDUSTRIAL_GRINDER = register("industrial_grinder", () -> () -> GuiIndustrialGrinder::new);
|
||||
public static final GuiType<LapotronicSUBlockEntity> LESU = register("lesu", () -> () -> GuiLESU::new);
|
||||
public static final GuiType<MatterFabricatorBlockEntity> MATTER_FABRICATOR = register("matter_fabricator", () -> () -> GuiMatterFabricator::new);
|
||||
public static final GuiType<MediumVoltageSUBlockEntity> MEDIUM_VOLTAGE_SU = register("medium_voltage_su", () -> () -> GuiMFE::new);
|
||||
public static final GuiType<PlasmaGeneratorBlockEntity> PLASMA_GENERATOR = register("plasma_generator", () -> () -> GuiPlasmaGenerator::new);
|
||||
public static final GuiType<IronFurnaceBlockEntity> IRON_FURNACE = register("iron_furnace", () -> () -> GuiIronFurnace::new);
|
||||
public static final GuiType<StorageUnitBaseBlockEntity> STORAGE_UNIT = register("storage_unit", () -> () -> GuiStorageUnit::new);
|
||||
public static final GuiType<TankUnitBaseBlockEntity> TANK_UNIT = register("tank_unit", () -> () -> GuiTankUnit::new);
|
||||
public static final GuiType<RecyclerBlockEntity> RECYCLER = register("recycler", () -> () -> GuiRecycler::new);
|
||||
public static final GuiType<RollingMachineBlockEntity> ROLLING_MACHINE = register("rolling_machine", () -> () -> GuiRollingMachine::new);
|
||||
public static final GuiType<IndustrialSawmillBlockEntity> SAWMILL = register("sawmill", () -> () -> GuiIndustrialSawmill::new);
|
||||
public static final GuiType<ScrapboxinatorBlockEntity> SCRAPBOXINATOR = register("scrapboxinator", () -> () -> GuiScrapboxinator::new);
|
||||
public static final GuiType<SolarPanelBlockEntity> SOLAR_PANEL = register("solar_panel", () -> () -> GuiSolar::new);
|
||||
public static final GuiType<SemiFluidGeneratorBlockEntity> SEMIFLUID_GENERATOR = register("semifluid_generator", () -> () -> GuiSemifluidGenerator::new);
|
||||
public static final GuiType<ThermalGeneratorBlockEntity> THERMAL_GENERATOR = register("thermal_generator", () -> () -> GuiThermalGenerator::new);
|
||||
public static final GuiType<VacuumFreezerBlockEntity> VACUUM_FREEZER = register("vacuum_freezer", () -> () -> GuiVacuumFreezer::new);
|
||||
public static final GuiType<SoildCanningMachineBlockEntity> SOLID_CANNING_MACHINE = register("solid_canning_machine", () -> () -> GuiSolidCanningMachine::new);
|
||||
public static final GuiType<WireMillBlockEntity> WIRE_MILL = register("wire_mill", () -> () -> GuiWireMill::new);
|
||||
public static final GuiType<GreenhouseControllerBlockEntity> GREENHOUSE_CONTROLLER = register("greenhouse_controller", () -> () -> GuiGreenhouseController::new);
|
||||
public static final GuiType<FluidReplicatorBlockEntity> FLUID_REPLICATOR = register("fluid_replicator", () -> () -> GuiFluidReplicator::new);
|
||||
|
||||
public static final GuiType<DataDrivenBEProvider.DataDrivenBlockEntity> DATA_DRIVEN = register("data_driven", () -> () -> DataDrivenGui::new);
|
||||
|
||||
private static <T extends BlockEntity> GuiType<T> register(String id, Supplier<Supplier<GuiFactory<T>>> factorySupplierMeme) {
|
||||
return register(new Identifier("techreborn", id), factorySupplierMeme);
|
||||
}
|
||||
|
||||
public static <T extends BlockEntity> GuiType<T> register(Identifier identifier, Supplier<Supplier<GuiFactory<T>>> factorySupplierMeme) {
|
||||
if (TYPES.containsKey(identifier)) {
|
||||
throw new RuntimeException("Duplicate gui type found");
|
||||
}
|
||||
GuiType<T> type = new GuiType<>(identifier, factorySupplierMeme);
|
||||
TYPES.put(identifier, type);
|
||||
return type;
|
||||
}
|
||||
|
||||
private final Identifier identifier;
|
||||
private final Supplier<Supplier<GuiFactory<T>>> factorySupplierMeme;
|
||||
|
||||
private GuiType(Identifier identifier, Supplier<Supplier<GuiFactory<T>>> factorySupplierMeme) {
|
||||
this.identifier = identifier;
|
||||
this.factorySupplierMeme = factorySupplierMeme;
|
||||
register();
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
private GuiFactory<T> getFactory() {
|
||||
return factorySupplierMeme.get().get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open(PlayerEntity player, BlockPos pos, World world) {
|
||||
if(!world.isClient){
|
||||
ContainerProviderRegistry.INSTANCE.openContainer(identifier, player, packetByteBuf -> packetByteBuf.writeBlockPos(pos));
|
||||
}
|
||||
}
|
||||
|
||||
private void register() {
|
||||
ContainerProviderRegistry.INSTANCE.registerFactory(identifier, (syncID, identifier, playerEntity, packetByteBuf) -> {
|
||||
final BlockEntity blockEntity = playerEntity.world.getBlockEntity(packetByteBuf.readBlockPos());
|
||||
return ((IContainerProvider) blockEntity).createContainer(syncID, playerEntity);
|
||||
});
|
||||
RebornCore.clientOnly(() -> () -> ScreenProviderRegistry.INSTANCE.registerFactory(identifier, getFactory()));
|
||||
}
|
||||
|
||||
public Identifier getIdentifier() {
|
||||
return identifier;
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public interface GuiFactory<T extends BlockEntity> extends ContainerFactory<ContainerScreen> {
|
||||
ContainerScreen<?> create(int syncId, PlayerEntity playerEntity, T blockEntity);
|
||||
|
||||
@Override
|
||||
default ContainerScreen create(int syncId, Identifier identifier, PlayerEntity playerEntity, PacketByteBuf packetByteBuf) {
|
||||
//noinspection unchecked
|
||||
T blockEntity = (T) playerEntity.world.getBlockEntity(packetByteBuf.readBlockPos());
|
||||
return create(syncId, playerEntity, blockEntity);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -309,12 +309,6 @@ public class TechRebornConfig {
|
|||
|
||||
|
||||
// Machines
|
||||
@Config(config = "machines", category = "grinder", key = "GrinderInput", comment = "Grinder Max Input (Value in EU)")
|
||||
public static int grinderMaxInput = 32;
|
||||
|
||||
@Config(config = "machines", category = "grinder", key = "GrinderMaxEnergy", comment = "Grinder Max Energy (Value in EU)")
|
||||
public static int grinderMaxEnergy = 1_000;
|
||||
|
||||
@Config(config = "machines", category = "lesu", key = "LesuMaxEnergyPerBlock", comment = "LESU Max Energy Per Block")
|
||||
public static int lesuStoragePerBlock = 1_000_000;
|
||||
|
||||
|
@ -640,4 +634,16 @@ public class TechRebornConfig {
|
|||
|
||||
@Config(config = "world", category = "ore", key = "enableTungstenOre", comment = "Generate Tungsten Ore in The End.")
|
||||
public static boolean enableTungstenOre = true;
|
||||
|
||||
@Config(config = "world", category = "rubber_tree", key = "RubberTreeChance", comment = "Chance to spawn rubber tree")
|
||||
public static float RubberTreeChance = 0.1F;
|
||||
|
||||
@Config(config = "world", category = "rubber_tree", key = "RubberTreeCount", comment = "Amount of trees to spawn in successful case")
|
||||
public static int RubberTreeCount = 1;
|
||||
|
||||
@Config(config = "world", category = "rubber_tree", key = "RubberTreeBaseHeight", comment = "Basic height for not-spire part of rubber tree")
|
||||
public static int RubberTreeBaseHeight = 6;
|
||||
|
||||
@Config(config = "world", category = "rubber_tree", key = "RubberTreeSpireHeight", comment = "Height of spire of rubber tree")
|
||||
public static int RubberTreeSpireHeight = 3;
|
||||
}
|
||||
|
|
|
@ -44,14 +44,37 @@ import techreborn.blockentity.storage.fluid.CreativeQuantumTankBlockEntity;
|
|||
import techreborn.blockentity.storage.fluid.QuantumTankBlockEntity;
|
||||
import techreborn.blockentity.generator.LightningRodBlockEntity;
|
||||
import techreborn.blockentity.generator.PlasmaGeneratorBlockEntity;
|
||||
import techreborn.blockentity.generator.advanced.*;
|
||||
import techreborn.blockentity.generator.advanced.DieselGeneratorBlockEntity;
|
||||
import techreborn.blockentity.generator.advanced.DragonEggSyphonBlockEntity;
|
||||
import techreborn.blockentity.generator.advanced.GasTurbineBlockEntity;
|
||||
import techreborn.blockentity.generator.advanced.SemiFluidGeneratorBlockEntity;
|
||||
import techreborn.blockentity.generator.advanced.ThermalGeneratorBlockEntity;
|
||||
import techreborn.blockentity.generator.basic.SolidFuelGeneratorBlockEntity;
|
||||
import techreborn.blockentity.generator.basic.WaterMillBlockEntity;
|
||||
import techreborn.blockentity.generator.basic.WindMillBlockEntity;
|
||||
import techreborn.blockentity.machine.misc.ChargeOMatBlockEntity;
|
||||
import techreborn.blockentity.machine.misc.DrainBlockEntity;
|
||||
import techreborn.blockentity.machine.multiblock.*;
|
||||
import techreborn.blockentity.machine.tier1.*;
|
||||
import techreborn.blockentity.machine.multiblock.DistillationTowerBlockEntity;
|
||||
import techreborn.blockentity.machine.multiblock.FluidReplicatorBlockEntity;
|
||||
import techreborn.blockentity.machine.multiblock.ImplosionCompressorBlockEntity;
|
||||
import techreborn.blockentity.machine.multiblock.IndustrialBlastFurnaceBlockEntity;
|
||||
import techreborn.blockentity.machine.multiblock.IndustrialGrinderBlockEntity;
|
||||
import techreborn.blockentity.machine.multiblock.IndustrialSawmillBlockEntity;
|
||||
import techreborn.blockentity.machine.multiblock.VacuumFreezerBlockEntity;
|
||||
import techreborn.blockentity.machine.tier1.AlloySmelterBlockEntity;
|
||||
import techreborn.blockentity.machine.tier1.AssemblingMachineBlockEntity;
|
||||
import techreborn.blockentity.machine.tier1.AutoCraftingTableBlockEntity;
|
||||
import techreborn.blockentity.machine.tier1.ChemicalReactorBlockEntity;
|
||||
import techreborn.blockentity.machine.tier1.CompressorBlockEntity;
|
||||
import techreborn.blockentity.machine.tier1.ElectricFurnaceBlockEntity;
|
||||
import techreborn.blockentity.machine.tier1.ExtractorBlockEntity;
|
||||
import techreborn.blockentity.machine.tier1.GreenhouseControllerBlockEntity;
|
||||
import techreborn.blockentity.machine.tier1.IndustrialElectrolyzerBlockEntity;
|
||||
import techreborn.blockentity.machine.tier1.RecyclerBlockEntity;
|
||||
import techreborn.blockentity.machine.tier1.RollingMachineBlockEntity;
|
||||
import techreborn.blockentity.machine.tier1.ScrapboxinatorBlockEntity;
|
||||
import techreborn.blockentity.machine.tier1.SoildCanningMachineBlockEntity;
|
||||
import techreborn.blockentity.machine.tier1.WireMillBlockEntity;
|
||||
import techreborn.blockentity.machine.tier3.ChunkLoaderBlockEntity;
|
||||
import techreborn.blockentity.machine.tier3.IndustrialCentrifugeBlockEntity;
|
||||
import techreborn.blockentity.machine.tier3.MatterFabricatorBlockEntity;
|
||||
|
@ -77,14 +100,20 @@ import techreborn.blocks.misc.BlockMachineCasing;
|
|||
import techreborn.blocks.misc.BlockMachineFrame;
|
||||
import techreborn.blocks.misc.BlockStorage;
|
||||
import techreborn.blocks.storage.OldBlock;
|
||||
import techreborn.blocks.storage.energy.*;
|
||||
import techreborn.blocks.storage.energy.AdjustableSUBlock;
|
||||
import techreborn.blocks.storage.energy.HighVoltageSUBlock;
|
||||
import techreborn.blocks.storage.energy.InterdimensionalSUBlock;
|
||||
import techreborn.blocks.storage.energy.LSUStorageBlock;
|
||||
import techreborn.blocks.storage.energy.LapotronicSUBlock;
|
||||
import techreborn.blocks.storage.energy.LowVoltageSUBlock;
|
||||
import techreborn.blocks.storage.energy.MediumVoltageSUBlock;
|
||||
import techreborn.blocks.storage.fluid.TankUnitBlock;
|
||||
import techreborn.blocks.storage.item.StorageUnitBlock;
|
||||
import techreborn.blocks.transformers.BlockEVTransformer;
|
||||
import techreborn.blocks.transformers.BlockHVTransformer;
|
||||
import techreborn.blocks.transformers.BlockLVTransformer;
|
||||
import techreborn.blocks.transformers.BlockMVTransformer;
|
||||
import techreborn.client.EGui;
|
||||
import techreborn.client.GuiType;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.entities.EntityNukePrimed;
|
||||
import techreborn.items.DynamicCellItem;
|
||||
|
@ -471,43 +500,43 @@ public class TRContent {
|
|||
|
||||
|
||||
public enum Machine implements ItemConvertible {
|
||||
ALLOY_SMELTER(new GenericMachineBlock(EGui.ALLOY_SMELTER, AlloySmelterBlockEntity::new)),
|
||||
ASSEMBLY_MACHINE(new GenericMachineBlock(EGui.ASSEMBLING_MACHINE, AssemblingMachineBlockEntity::new)),
|
||||
AUTO_CRAFTING_TABLE(new GenericMachineBlock(EGui.AUTO_CRAFTING_TABLE, AutoCraftingTableBlockEntity::new)),
|
||||
CHEMICAL_REACTOR(new GenericMachineBlock(EGui.CHEMICAL_REACTOR, ChemicalReactorBlockEntity::new)),
|
||||
COMPRESSOR(new GenericMachineBlock(EGui.COMPRESSOR, CompressorBlockEntity::new)),
|
||||
DISTILLATION_TOWER(new GenericMachineBlock(EGui.DISTILLATION_TOWER, DistillationTowerBlockEntity::new)),
|
||||
EXTRACTOR(new GenericMachineBlock(EGui.EXTRACTOR, ExtractorBlockEntity::new)),
|
||||
FLUID_REPLICATOR(new GenericMachineBlock(EGui.FLUID_REPLICATOR, FluidReplicatorBlockEntity::new)),
|
||||
ALLOY_SMELTER(new GenericMachineBlock(GuiType.ALLOY_SMELTER, AlloySmelterBlockEntity::new)),
|
||||
ASSEMBLY_MACHINE(new GenericMachineBlock(GuiType.ASSEMBLING_MACHINE, AssemblingMachineBlockEntity::new)),
|
||||
AUTO_CRAFTING_TABLE(new GenericMachineBlock(GuiType.AUTO_CRAFTING_TABLE, AutoCraftingTableBlockEntity::new)),
|
||||
CHEMICAL_REACTOR(new GenericMachineBlock(GuiType.CHEMICAL_REACTOR, ChemicalReactorBlockEntity::new)),
|
||||
COMPRESSOR(new GenericMachineBlock(GuiType.COMPRESSOR, CompressorBlockEntity::new)),
|
||||
DISTILLATION_TOWER(new GenericMachineBlock(GuiType.DISTILLATION_TOWER, DistillationTowerBlockEntity::new)),
|
||||
EXTRACTOR(new GenericMachineBlock(GuiType.EXTRACTOR, ExtractorBlockEntity::new)),
|
||||
FLUID_REPLICATOR(new GenericMachineBlock(GuiType.FLUID_REPLICATOR, FluidReplicatorBlockEntity::new)),
|
||||
GRINDER(new DataDrivenMachineBlock("techreborn:grinder")),
|
||||
ELECTRIC_FURNACE(new GenericMachineBlock(EGui.ELECTRIC_FURNACE, ElectricFurnaceBlockEntity::new)),
|
||||
IMPLOSION_COMPRESSOR(new GenericMachineBlock(EGui.IMPLOSION_COMPRESSOR, ImplosionCompressorBlockEntity::new)),
|
||||
INDUSTRIAL_BLAST_FURNACE(new GenericMachineBlock(EGui.BLAST_FURNACE, IndustrialBlastFurnaceBlockEntity::new)),
|
||||
INDUSTRIAL_CENTRIFUGE(new GenericMachineBlock(EGui.CENTRIFUGE, IndustrialCentrifugeBlockEntity::new)),
|
||||
INDUSTRIAL_ELECTROLYZER(new GenericMachineBlock(EGui.INDUSTRIAL_ELECTROLYZER, IndustrialElectrolyzerBlockEntity::new)),
|
||||
INDUSTRIAL_GRINDER(new GenericMachineBlock(EGui.INDUSTRIAL_GRINDER, IndustrialGrinderBlockEntity::new)),
|
||||
INDUSTRIAL_SAWMILL(new GenericMachineBlock(EGui.SAWMILL, IndustrialSawmillBlockEntity::new)),
|
||||
ELECTRIC_FURNACE(new GenericMachineBlock(GuiType.ELECTRIC_FURNACE, ElectricFurnaceBlockEntity::new)),
|
||||
IMPLOSION_COMPRESSOR(new GenericMachineBlock(GuiType.IMPLOSION_COMPRESSOR, ImplosionCompressorBlockEntity::new)),
|
||||
INDUSTRIAL_BLAST_FURNACE(new GenericMachineBlock(GuiType.BLAST_FURNACE, IndustrialBlastFurnaceBlockEntity::new)),
|
||||
INDUSTRIAL_CENTRIFUGE(new GenericMachineBlock(GuiType.CENTRIFUGE, IndustrialCentrifugeBlockEntity::new)),
|
||||
INDUSTRIAL_ELECTROLYZER(new GenericMachineBlock(GuiType.INDUSTRIAL_ELECTROLYZER, IndustrialElectrolyzerBlockEntity::new)),
|
||||
INDUSTRIAL_GRINDER(new GenericMachineBlock(GuiType.INDUSTRIAL_GRINDER, IndustrialGrinderBlockEntity::new)),
|
||||
INDUSTRIAL_SAWMILL(new GenericMachineBlock(GuiType.SAWMILL, IndustrialSawmillBlockEntity::new)),
|
||||
IRON_ALLOY_FURNACE(new IronAlloyFurnaceBlock()),
|
||||
IRON_FURNACE(new IronFurnaceBlock()),
|
||||
MATTER_FABRICATOR(new GenericMachineBlock(EGui.MATTER_FABRICATOR, MatterFabricatorBlockEntity::new)),
|
||||
RECYCLER(new GenericMachineBlock(EGui.RECYCLER, RecyclerBlockEntity::new)),
|
||||
ROLLING_MACHINE(new GenericMachineBlock(EGui.ROLLING_MACHINE, RollingMachineBlockEntity::new)),
|
||||
SCRAPBOXINATOR(new GenericMachineBlock(EGui.SCRAPBOXINATOR, ScrapboxinatorBlockEntity::new)),
|
||||
VACUUM_FREEZER(new GenericMachineBlock(EGui.VACUUM_FREEZER, VacuumFreezerBlockEntity::new)),
|
||||
SOLID_CANNING_MACHINE(new GenericMachineBlock(EGui.SOLID_CANNING_MACHINE, SoildCanningMachineBlockEntity::new)),
|
||||
WIRE_MILL(new GenericMachineBlock(EGui.WIRE_MILL, WireMillBlockEntity::new)),
|
||||
GREENHOUSE_CONTROLLER(new GenericMachineBlock(EGui.GREENHOUSE_CONTROLLER, GreenhouseControllerBlockEntity::new)),
|
||||
MATTER_FABRICATOR(new GenericMachineBlock(GuiType.MATTER_FABRICATOR, MatterFabricatorBlockEntity::new)),
|
||||
RECYCLER(new GenericMachineBlock(GuiType.RECYCLER, RecyclerBlockEntity::new)),
|
||||
ROLLING_MACHINE(new GenericMachineBlock(GuiType.ROLLING_MACHINE, RollingMachineBlockEntity::new)),
|
||||
SCRAPBOXINATOR(new GenericMachineBlock(GuiType.SCRAPBOXINATOR, ScrapboxinatorBlockEntity::new)),
|
||||
VACUUM_FREEZER(new GenericMachineBlock(GuiType.VACUUM_FREEZER, VacuumFreezerBlockEntity::new)),
|
||||
SOLID_CANNING_MACHINE(new GenericMachineBlock(GuiType.SOLID_CANNING_MACHINE, SoildCanningMachineBlockEntity::new)),
|
||||
WIRE_MILL(new GenericMachineBlock(GuiType.WIRE_MILL, WireMillBlockEntity::new)),
|
||||
GREENHOUSE_CONTROLLER(new GenericMachineBlock(GuiType.GREENHOUSE_CONTROLLER, GreenhouseControllerBlockEntity::new)),
|
||||
|
||||
DIESEL_GENERATOR(new GenericGeneratorBlock(EGui.DIESEL_GENERATOR, DieselGeneratorBlockEntity::new)),
|
||||
DIESEL_GENERATOR(new GenericGeneratorBlock(GuiType.DIESEL_GENERATOR, DieselGeneratorBlockEntity::new)),
|
||||
DRAGON_EGG_SYPHON(new GenericGeneratorBlock(null, DragonEggSyphonBlockEntity::new)),
|
||||
FUSION_COIL(new BlockFusionCoil()),
|
||||
FUSION_CONTROL_COMPUTER(new BlockFusionControlComputer()),
|
||||
GAS_TURBINE(new GenericGeneratorBlock(EGui.GAS_TURBINE, GasTurbineBlockEntity::new)),
|
||||
GAS_TURBINE(new GenericGeneratorBlock(GuiType.GAS_TURBINE, GasTurbineBlockEntity::new)),
|
||||
LIGHTNING_ROD(new GenericGeneratorBlock(null, LightningRodBlockEntity::new)),
|
||||
PLASMA_GENERATOR(new GenericGeneratorBlock(EGui.PLASMA_GENERATOR, PlasmaGeneratorBlockEntity::new)),
|
||||
SEMI_FLUID_GENERATOR(new GenericGeneratorBlock(EGui.SEMIFLUID_GENERATOR, SemiFluidGeneratorBlockEntity::new)),
|
||||
SOLID_FUEL_GENERATOR(new GenericGeneratorBlock(EGui.GENERATOR, SolidFuelGeneratorBlockEntity::new)),
|
||||
THERMAL_GENERATOR(new GenericGeneratorBlock(EGui.THERMAL_GENERATOR, ThermalGeneratorBlockEntity::new)),
|
||||
PLASMA_GENERATOR(new GenericGeneratorBlock(GuiType.PLASMA_GENERATOR, PlasmaGeneratorBlockEntity::new)),
|
||||
SEMI_FLUID_GENERATOR(new GenericGeneratorBlock(GuiType.SEMIFLUID_GENERATOR, SemiFluidGeneratorBlockEntity::new)),
|
||||
SOLID_FUEL_GENERATOR(new GenericGeneratorBlock(GuiType.GENERATOR, SolidFuelGeneratorBlockEntity::new)),
|
||||
THERMAL_GENERATOR(new GenericGeneratorBlock(GuiType.THERMAL_GENERATOR, ThermalGeneratorBlockEntity::new)),
|
||||
WATER_MILL(new GenericGeneratorBlock(null, WaterMillBlockEntity::new)),
|
||||
WIND_MILL(new GenericGeneratorBlock(null, WindMillBlockEntity::new)),
|
||||
|
||||
|
@ -522,7 +551,7 @@ public class TRContent {
|
|||
|
||||
|
||||
ADJUSTABLE_SU(new AdjustableSUBlock()),
|
||||
CHARGE_O_MAT(new GenericMachineBlock(EGui.CHARGEBENCH, ChargeOMatBlockEntity::new)),
|
||||
CHARGE_O_MAT(new GenericMachineBlock(GuiType.CHARGEBENCH, ChargeOMatBlockEntity::new)),
|
||||
INTERDIMENSIONAL_SU(new InterdimensionalSUBlock()),
|
||||
LAPOTRONIC_SU(new LapotronicSUBlock()),
|
||||
LSU_STORAGE(new LSUStorageBlock()),
|
||||
|
@ -535,7 +564,7 @@ public class TRContent {
|
|||
EV_TRANSFORMER(new BlockEVTransformer()),
|
||||
|
||||
ALARM(new BlockAlarm()),
|
||||
CHUNK_LOADER(new GenericMachineBlock(EGui.CHUNK_LOADER, ChunkLoaderBlockEntity::new)),
|
||||
CHUNK_LOADER(new GenericMachineBlock(GuiType.CHUNK_LOADER, ChunkLoaderBlockEntity::new)),
|
||||
LAMP_INCANDESCENT(new BlockLamp(4, 10, 8)),
|
||||
LAMP_LED(new BlockLamp(1, 1, 12)),
|
||||
PLAYER_DETECTOR(new BlockPlayerDetector());
|
||||
|
|
|
@ -43,6 +43,6 @@ public class RubberSaplingGenerator extends SaplingGenerator {
|
|||
@Nullable
|
||||
@Override
|
||||
protected ConfiguredFeature<BranchedTreeFeatureConfig, ?> createTreeFeature(Random random, boolean bl) {
|
||||
return WorldGenerator.RUBBER_TREE.configure(WorldGenerator.RUBBER_TREE_CONFIG);
|
||||
return WorldGenerator.RUBBER_TREE_FEATURE.configure(WorldGenerator.RUBBER_TREE_CONFIG);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.world.ModifiableTestableWorld;
|
||||
import net.minecraft.world.gen.feature.BranchedTreeFeatureConfig;
|
||||
import net.minecraft.world.gen.feature.OakTreeFeature;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.TRContent;
|
||||
|
||||
import java.util.Random;
|
||||
|
@ -70,7 +71,7 @@ public class RubberTreeFeature extends OakTreeFeature {
|
|||
|
||||
if(topPos == null) return;
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int i = 0; i < TechRebornConfig.RubberTreeSpireHeight; i++) {
|
||||
setBlockState(world, pos.up(i), TRContent.RUBBER_LEAVES.getDefaultState());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ import java.util.List;
|
|||
*/
|
||||
public class WorldGenerator {
|
||||
|
||||
public static Feature<BranchedTreeFeatureConfig> RUBBER_TREE;
|
||||
public static Feature<BranchedTreeFeatureConfig> RUBBER_TREE_FEATURE;
|
||||
|
||||
public static BranchedTreeFeatureConfig RUBBER_TREE_CONFIG;
|
||||
|
||||
|
@ -76,7 +76,7 @@ public class WorldGenerator {
|
|||
}
|
||||
|
||||
private static void setupTrees() {
|
||||
RUBBER_TREE = Registry.register(Registry.FEATURE, new Identifier("techreborn:rubber_tree"), new RubberTreeFeature(BranchedTreeFeatureConfig::deserialize));
|
||||
RUBBER_TREE_FEATURE = Registry.register(Registry.FEATURE, new Identifier("techreborn:rubber_tree"), new RubberTreeFeature(BranchedTreeFeatureConfig::deserialize));
|
||||
|
||||
WeightedBlockStateProvider logProvider = new WeightedBlockStateProvider();
|
||||
logProvider.addState(TRContent.RUBBER_LOG.getDefaultState(), 10);
|
||||
|
@ -93,7 +93,7 @@ public class WorldGenerator {
|
|||
logProvider,
|
||||
new SimpleBlockStateProvider(TRContent.RUBBER_LEAVES.getDefaultState()),
|
||||
new BlobFoliagePlacer(2, 0))
|
||||
.baseHeight(6)
|
||||
.baseHeight(TechRebornConfig.RubberTreeBaseHeight)
|
||||
.heightRandA(2)
|
||||
.foliageHeight(3)
|
||||
.noVines()
|
||||
|
@ -119,7 +119,7 @@ public class WorldGenerator {
|
|||
addOre(biome, OreFeatureConfig.Target.NETHERRACK, TRContent.Ores.SPHALERITE);
|
||||
}
|
||||
} else if (biome.getCategory() == Category.THEEND) {
|
||||
if (TechRebornConfig.enableSphaleriteOre){
|
||||
if (TechRebornConfig.enablePeridotOre){
|
||||
addEndOre(biome, TRContent.Ores.PERIDOT);
|
||||
}
|
||||
if (TechRebornConfig.enableSheldoniteOre){
|
||||
|
@ -135,7 +135,7 @@ public class WorldGenerator {
|
|||
if (TechRebornConfig.enableBauxiteOre){
|
||||
addOre(biome, OreFeatureConfig.Target.NATURAL_STONE, TRContent.Ores.BAUXITE);
|
||||
}
|
||||
if (TechRebornConfig.enableBauxiteOre){
|
||||
if (TechRebornConfig.enableCopperOre){
|
||||
addOre(biome, OreFeatureConfig.Target.NATURAL_STONE, TRContent.Ores.COPPER);
|
||||
}
|
||||
if (TechRebornConfig.enableGalenaOre){
|
||||
|
@ -162,9 +162,9 @@ public class WorldGenerator {
|
|||
|
||||
if (biome.getCategory() == Category.FOREST || biome.getCategory() == Category.TAIGA || biome.getCategory() == Category.SWAMP) {
|
||||
biome.addFeature(GenerationStep.Feature.VEGETAL_DECORATION,
|
||||
RUBBER_TREE.configure(RUBBER_TREE_CONFIG)
|
||||
RUBBER_TREE_FEATURE.configure(RUBBER_TREE_CONFIG)
|
||||
.createDecoratedFeature(Decorator.COUNT_EXTRA_HEIGHTMAP
|
||||
.configure(new CountExtraChanceDecoratorConfig(biome.getCategory() == Category.SWAMP ? 2 : 1, 0.1F, 1))
|
||||
.configure(new CountExtraChanceDecoratorConfig(biome.getCategory() == Category.SWAMP ? 1 : 0, TechRebornConfig.RubberTreeChance, TechRebornConfig.RubberTreeCount))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"techreborn:sodium_bucket"
|
||||
]
|
||||
}
|
|
@ -32,7 +32,8 @@
|
|||
"depends": {
|
||||
"fabricloader": ">=0.6.3",
|
||||
"fabric": "*",
|
||||
"reborncore": "*"
|
||||
"reborncore": "*",
|
||||
"team_reborn_energy": ">=0.1.0"
|
||||
},
|
||||
"authors": [
|
||||
"Team Reborn",
|
||||
|
|
Loading…
Reference in a new issue