Merge remote-tracking branch 'remotes/origin/1.12' into 1.13

# Conflicts:
#	build.gradle
#	src/main/java/techreborn/Core.java
#	src/main/java/techreborn/api/fluidreplicator/FluidReplicatorRecipe.java
#	src/main/java/techreborn/api/recipe/recipes/BlastFurnaceRecipe.java
#	src/main/java/techreborn/blocks/BlockMachineCasing.java
#	src/main/java/techreborn/blocks/cable/EnumCableType.java
#	src/main/java/techreborn/blocks/generator/solarpanel/BlockSolarPanel.java
#	src/main/java/techreborn/blocks/storage/BlockEnergyStorage.java
#	src/main/java/techreborn/blocks/transformers/BlockTransformer.java
#	src/main/java/techreborn/client/gui/GuiAESU.java
#	src/main/java/techreborn/client/gui/GuiManual.java
#	src/main/java/techreborn/client/gui/GuiVacuumFreezer.java
#	src/main/java/techreborn/command/TechRebornDevCommand.java
#	src/main/java/techreborn/compat/jei/RecipeUtil.java
#	src/main/java/techreborn/compat/jei/TechRebornJeiPlugin.java
#	src/main/java/techreborn/compat/jei/fusionReactor/FusionReactorRecipeWrapper.java
#	src/main/java/techreborn/compat/jei/industrialSawmill/IndustrialSawmillRecipeWrapper.java
#	src/main/java/techreborn/config/ConfigTechReborn.java
#	src/main/java/techreborn/init/IC2Duplicates.java
#	src/main/java/techreborn/init/ModRecipes.java
#	src/main/java/techreborn/init/OreDict.java
#	src/main/java/techreborn/init/recipes/CraftingTableRecipes.java
#	src/main/java/techreborn/init/recipes/FusionReactorRecipes.java
#	src/main/java/techreborn/init/recipes/IndustrialCentrifugeRecipes.java
#	src/main/java/techreborn/init/recipes/IndustrialGrinderRecipes.java
#	src/main/java/techreborn/init/recipes/SmeltingRecipes.java
#	src/main/java/techreborn/items/ItemUpgrades.java
#	src/main/java/techreborn/items/ingredients/ItemParts.java
#	src/main/java/techreborn/items/tool/industrial/ItemIndustrialChainsaw.java
#	src/main/java/techreborn/items/tool/industrial/ItemIndustrialDrill.java
#	src/main/java/techreborn/items/tools/ItemWrench.java
#	src/main/java/techreborn/tiles/TileAlarm.java
#	src/main/java/techreborn/tiles/fusionReactor/TileFusionControlComputer.java
#	src/main/java/techreborn/tiles/generator/TileCreativeSolarPanel.java
#	src/main/java/techreborn/tiles/generator/TileLightningRod.java
#	src/main/java/techreborn/tiles/machine/iron/TileIronAlloyFurnace.java
#	src/main/java/techreborn/tiles/machine/multiblock/TileIndustrialBlastFurnace.java
#	src/main/java/techreborn/tiles/machine/multiblock/TileVacuumFreezer.java
#	src/main/java/techreborn/tiles/machine/tier1/TileAutoCraftingTable.java
#	src/main/java/techreborn/tiles/machine/tier1/TileRecycler.java
#	src/main/java/techreborn/tiles/machine/tier1/TileRollingMachine.java
#	src/main/java/techreborn/tiles/machine/tier3/TileMatterFabricator.java
#	src/main/java/techreborn/tiles/storage/TileAdjustableSU.java
#	src/main/java/techreborn/world/TechRebornRetroGen.java
#	src/main/resources/assets/techreborn/blockstates/items/materials/part.json
#	src/main/resources/assets/techreborn/blockstates/items/misc/upgrades.json
This commit is contained in:
modmuss50 2019-04-27 20:32:56 +01:00
commit 6ab23c4c64
32 changed files with 668 additions and 54 deletions

View file

@ -24,7 +24,6 @@
package techreborn.tiles;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@ -35,6 +34,7 @@ import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting;
import reborncore.api.IToolDrop;
import reborncore.common.util.ChatUtils;
import reborncore.common.util.StringUtils;
import techreborn.blocks.BlockAlarm;
import techreborn.init.ModSounds;
import techreborn.init.TRContent;
@ -56,7 +56,8 @@ public class TileAlarm extends TileEntity
} else {
selectedSound = 1;
}
ChatUtils.sendNoSpamMessages(MessageIDs.alarmID, new TextComponentString(TextFormatting.GRAY + I18n.format("techreborn.message.alarm") + " " + "Alarm " + selectedSound));
ChatUtils.sendNoSpamMessages(MessageIDs.alarmID, new TextComponentString(
TextFormatting.GRAY + StringUtils.t("techreborn.message.alarm") + " " + "Alarm " + selectedSound));
}
}

View file

@ -75,6 +75,7 @@ public class TileFusionControlComputer extends TilePowerAcceptor
int outputStackSlot = 2;
FusionReactorRecipe currentRecipe = null;
boolean hasStartedCrafting = false;
long lastTick = -1;
public TileFusionControlComputer() {
super(TRTileEntities.FUSION_CONTROL_COMPUTER);
@ -181,7 +182,8 @@ public class TileFusionControlComputer extends TilePowerAcceptor
* @return boolean True if reactor can execute recipe provided
*/
private boolean validateReactorRecipe(FusionReactorRecipe recipe) {
return validateReactorRecipeInputs(recipe, inventory.getStackInSlot(topStackSlot), inventory.getStackInSlot(bottomStackSlot)) || validateReactorRecipeInputs(recipe, inventory.getStackInSlot(bottomStackSlot), inventory.getStackInSlot(topStackSlot));
boolean validRecipe = validateReactorRecipeInputs(recipe, inventory.getStackInSlot(topStackSlot), inventory.getStackInSlot(bottomStackSlot)) || validateReactorRecipeInputs(recipe, inventory.getStackInSlot(bottomStackSlot), inventory.getStackInSlot(topStackSlot));
return validRecipe && getSize() >= recipe.getMinSize();
}
private boolean validateReactorRecipeInputs(FusionReactorRecipe recipe, ItemStack slot1, ItemStack slot2) {
@ -207,6 +209,12 @@ public class TileFusionControlComputer extends TilePowerAcceptor
return;
}
if(lastTick == world.getGameTime()){
//Prevent tick accerators, blame obstinate for this.
return;
}
lastTick = world.getGameTime();
// Force check every second
if (world.getGameTime() % 20 == 0) {
checkCoils();

View file

@ -89,7 +89,7 @@ public class TileLightningRod extends TilePowerAcceptor implements IToolDrop {
world.addWeatherEffect(lightningBolt);
world.spawnEntity(lightningBolt);
addEnergy(baseEnergyStrike * (0.3F + weatherStrength));
((BlockMachineBase) getBlockType()).setActive(true, world, pos);
((BlockMachineBase) world.getBlockState(pos).getBlock()).setActive(true, world, pos);
onStatusHoldTicks = 400;
}
}

View file

@ -47,7 +47,7 @@ public class TileThermalGenerator extends TileBaseFluidGenerator implements ICon
@ConfigRegistry(config = "generators", category = "thermal_generator", key = "ThermalGeneratorTankCapacity", comment = "Thermal Generator Tank Capacity")
public static int tankCapacity = 10_000;
@ConfigRegistry(config = "generators", category = "thermal_generator", key = "ThermalGeneratorEnergyPerTick", comment = "Thermal Generator Energy Per Tick (Value in EU)")
public static int energyPerTick = 10;
public static int energyPerTick = 16;
public TileThermalGenerator() {
super(TRTileEntities.THERMAL_GEN, EFluidGenerator.THERMAL, "TileThermalGenerator", tankCapacity, energyPerTick);

View file

@ -58,6 +58,9 @@ public class TileImplosionCompressor extends TileGenericMachine implements ICont
}
public boolean getMutliBlock() {
if(multiblockChecker == null){
return false;
}
final boolean down = multiblockChecker.checkRectY(1, 1, MultiblockChecker.REINFORCED_CASING, MultiblockChecker.ZERO_OFFSET);
final boolean up = multiblockChecker.checkRectY(1, 1, MultiblockChecker.REINFORCED_CASING, new BlockPos(0, 2, 0));
final boolean chamber = multiblockChecker.checkRingYHollow(1, 1, MultiblockChecker.REINFORCED_CASING, new BlockPos(0, 1, 0));
@ -68,21 +71,13 @@ public class TileImplosionCompressor extends TileGenericMachine implements ICont
@Override
public void tick() {
if (multiblockChecker == null) {
final BlockPos downCenter = pos.offset(getFacing().getOpposite(), 2);
multiblockChecker = new MultiblockChecker(world, downCenter);
multiblockChecker = new MultiblockChecker(world, pos.down(3));
}
if (!world.isRemote && getMutliBlock()){
super.tick();
}
}
// TileEntity
@Override
public void validate() {
super.validate();
multiblockChecker = new MultiblockChecker(world, pos.down(3));
}
// IContainerProvider
@Override

View file

@ -105,6 +105,9 @@ public class TileIndustrialBlastFurnace extends TileGenericMachine implements IC
}
public boolean getMutliBlock() {
if(multiblockChecker == null){
return false;
}
final boolean layer0 = multiblockChecker.checkRectY(1, 1, MultiblockChecker.CASING_ANY, MultiblockChecker.ZERO_OFFSET);
final boolean layer1 = multiblockChecker.checkRingY(1, 1, MultiblockChecker.CASING_ANY, new BlockPos(0, 1, 0));
final boolean layer2 = multiblockChecker.checkRingY(1, 1, MultiblockChecker.CASING_ANY, new BlockPos(0, 2, 0));
@ -132,7 +135,7 @@ public class TileIndustrialBlastFurnace extends TileGenericMachine implements IC
multiblockChecker = new MultiblockChecker(world, downCenter);
}
if (!world.isRemote && getMutliBlock()){
if (getMutliBlock()){
super.tick();
}
}

View file

@ -167,7 +167,6 @@ public class TileElectricFurnace extends TilePowerAcceptor
}
}
} else {
progress = 0;
updateState();
}
if (burning != isBurning()) {

View file

@ -29,6 +29,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import reborncore.api.IToolDrop;
import reborncore.api.tile.IUpgrade;
import reborncore.api.tile.ItemHandlerProvider;
import reborncore.client.containerBuilder.IContainerProvider;
import reborncore.client.containerBuilder.builder.BuiltContainer;
@ -50,6 +51,8 @@ public class TileRecycler extends TilePowerAcceptor
public static int maxInput = 32;
@ConfigRegistry(config = "machines", category = "recycler", key = "RecyclerMaxEnergy", comment = "Recycler Max Energy (Value in EU)")
public static int maxEnergy = 1000;
@ConfigRegistry(config = "machines", category = "recycler", key = "produceIC2Scrap", comment = "When enabled and when ic2 is installed the recycler will make ic2 scrap")
public static boolean produceIC2Scrap = false;
private final Inventory<TileRecycler> inventory = new Inventory<>(3, "TileRecycler", 64, this).withConfiguredAccess();
private final int cost = 2;
@ -75,7 +78,7 @@ public class TileRecycler extends TilePowerAcceptor
}
public void recycleItems() {
final ItemStack itemstack = TRContent.Parts.SCRAP.getStack();
ItemStack itemstack = TRContent.Parts.SCRAP.getStack();
final int randomchance = this.world.rand.nextInt(chance);
if (randomchance == 1) {
@ -201,7 +204,7 @@ public class TileRecycler extends TilePowerAcceptor
@Override
public BuiltContainer createContainer(EntityPlayer player) {
return new ContainerBuilder("recycler").player(player.inventory).inventory().hotbar().addInventory()
.tile(this).slot(0, 55, 45).outputSlot(1, 101, 45).energySlot(2, 8, 72).syncEnergyValue()
.tile(this).slot(0, 55, 45, itemStack -> itemStack.getItem() instanceof IUpgrade).outputSlot(1, 101, 45).energySlot(2, 8, 72).syncEnergyValue()
.syncIntegerValue(this::getProgress, this::setProgress).addInventory().create(this);
}
}

View file

@ -38,6 +38,7 @@ import reborncore.api.tile.ItemHandlerProvider;
import reborncore.client.containerBuilder.IContainerProvider;
import reborncore.client.containerBuilder.builder.BuiltContainer;
import reborncore.client.containerBuilder.builder.ContainerBuilder;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.registration.RebornRegister;
import reborncore.common.registration.config.ConfigRegistry;
@ -50,8 +51,10 @@ import techreborn.init.TRTileEntities;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
//TODO add tick and power bars.
@ -121,6 +124,7 @@ public class TileRollingMachine extends TilePowerAcceptor
InventoryCrafting craftMatrix = getCraftingMatrix();
currentRecipe = RollingMachineRecipe.instance.findMatchingRecipe(craftMatrix, world);
if (currentRecipe != null) {
setIsActive(true);
if (world.getGameTime() % 2 == 0) {
Optional<InventoryCrafting> balanceResult = balanceRecipe(craftMatrix);
if (balanceResult.isPresent()) {
@ -149,6 +153,8 @@ public class TileRollingMachine extends TilePowerAcceptor
inventory.setStackInSlot(outputSlot, stack);
tickTime = 0;
hasCrafted = true;
} else {
setIsActive(false);
}
}
if (hasCrafted) {
@ -169,13 +175,27 @@ public class TileRollingMachine extends TilePowerAcceptor
&& canMake(craftMatrix)) {
useEnergy(getEuPerTick(energyPerTick));
tickTime++;
} else {
setIsActive(false);
}
}
if (currentRecipeOutput.isEmpty()) {
tickTime = 0;
currentRecipe = null;
setIsActive(canMake(getCraftingMatrix()));
}
}
public void setIsActive(boolean active) {
if (active == isRunning){
return;
}
isRunning = active;
if (this.getWorld().getBlockState(this.getPos()).getBlock() instanceof BlockMachineBase) {
BlockMachineBase blockMachineBase = (BlockMachineBase)this.getWorld().getBlockState(this.getPos()).getBlock();
blockMachineBase.setActive(active, this.getWorld(), this.getPos());
}
this.getWorld().notifyBlockUpdate(this.getPos(), this.getWorld().getBlockState(this.getPos()), this.getWorld().getBlockState(this.getPos()), 3);
}
public Optional<InventoryCrafting> balanceRecipe(InventoryCrafting craftCache) {
@ -213,6 +233,45 @@ public class TileRollingMachine extends TilePowerAcceptor
}
}
if(!possibleSlots.isEmpty()){
int totalItems = possibleSlots.stream()
.mapToInt(value -> inventory.getStackInSlot(value).getCount()).sum();
int slots = possibleSlots.size();
//This makes an array of ints with the best possible slot distribution
int[] split = new int[slots];
int remainder = totalItems % slots;
Arrays.fill(split, totalItems / slots);
while (remainder > 0){
for (int i = 0; i < split.length; i++) {
if(remainder > 0){
split[i] +=1;
remainder --;
}
}
}
List<Integer> slotDistrubution = possibleSlots.stream()
.mapToInt(value -> inventory.getStackInSlot(value).getCount())
.boxed().collect(Collectors.toList());
boolean needsBalance = false;
for (int i = 0; i < split.length; i++) {
int required = split[i];
if(slotDistrubution.contains(required)){
//We need to remove the int, not at the int, this seems to work around that
slotDistrubution.remove(new Integer(required));
} else {
needsBalance = true;
}
}
if (!needsBalance) {
return Optional.empty();
}
} else {
return Optional.empty();
}
//Slot, count
Pair<Integer, Integer> bestSlot = null;
for (Integer slot : possibleSlots) {

View file

@ -28,6 +28,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import reborncore.api.power.EnumPowerTier;
import reborncore.api.tile.IUpgrade;
import reborncore.client.containerBuilder.IContainerProvider;
import reborncore.client.containerBuilder.builder.BuiltContainer;
import reborncore.client.containerBuilder.builder.ContainerBuilder;
@ -42,9 +43,9 @@ import techreborn.init.TRTileEntities;
public class TileAdjustableSU extends TileEnergyStorage implements IContainerProvider {
@ConfigRegistry(config = "machines", category = "aesu", key = "AesuMaxInput", comment = "AESU Max Input (Value in EU)")
public static int maxInput = 8192;
public static int maxInput = 16192;
@ConfigRegistry(config = "machines", category = "aesu", key = "AesuMaxOutput", comment = "AESU Max Output (Value in EU)")
public static int maxOutput = 8192;
public static int maxOutput = 16192;
@ConfigRegistry(config = "machines", category = "aesu", key = "AesuMaxEnergy", comment = "AESU Max Energy (Value in EU)")
public static int maxEnergy = 100_000_000;
@ -54,22 +55,58 @@ public class TileAdjustableSU extends TileEnergyStorage implements IContainerPro
public TileAdjustableSU() {
super(TRTileEntities.ADJUSTABLE_SU, "ADJUSTABLE_SU", 4, TRContent.Machine.ADJUSTABLE_SU.block, EnumPowerTier.INSANE, maxInput, maxOutput, maxEnergy);
}
public void handleGuiInputFromClient(int id) {
int superconductors = 0;
@Override
public void tick() {
super.tick();
superconductors = 0;
for (int i = 0; i < getUpgradeSlotCount(); i++) {
ItemStack stack = getUpgradeInvetory().getStackInSlot(i);
if(false){ //TODO 1.13
superconductors++;
}
}
if (OUTPUT > getMaxConfigOutput()) {
OUTPUT = getMaxConfigOutput();
}
if(world.getGameTime() % 20 == 0){
checkTier();
}
}
public int getMaxConfigOutput(){
int extra = 0;
if(superconductors > 0){
extra = (int) Math.pow(2, (superconductors + 2)) * maxOutput;
}
return maxOutput + extra;
}
public void handleGuiInputFromClient(int id, boolean shift, boolean ctrl) {
if (id == 300) {
OUTPUT += 256;
OUTPUT += shift ? 4096 : 256;
if(ctrl){
//Set to max, limited to the max later
OUTPUT = Integer.MAX_VALUE;
}
}
if (id == 301) {
OUTPUT += 64;
OUTPUT += shift ? 512 : 64;
}
if (id == 302) {
OUTPUT -= 64;
OUTPUT -= shift ? 512 : 64;
}
if (id == 303) {
OUTPUT -= 256;
OUTPUT -= shift ? 4096 : 256;
if(ctrl){
OUTPUT = 1;
}
}
if (OUTPUT > maxOutput) {
OUTPUT = maxOutput;
if (OUTPUT > getMaxConfigOutput()) {
OUTPUT = getMaxConfigOutput();
}
if (OUTPUT <= -1) {
OUTPUT = 0;
@ -104,6 +141,25 @@ public class TileAdjustableSU extends TileEnergyStorage implements IContainerPro
return OUTPUT;
}
@Override
public double getMaxOutput() {
return OUTPUT;
}
@Override
public double getBaseMaxInput() {
//If we have super conductors increase the max input of the machine
if(getMaxConfigOutput() > maxOutput){
return getMaxConfigOutput();
}
return maxInput;
}
@Override
public EnumPowerTier getBaseTier() {
return null;
}
// TilePowerAcceptor
@Override
public NBTTagCompound write(NBTTagCompound tagCompound) {
@ -127,4 +183,14 @@ public class TileAdjustableSU extends TileEnergyStorage implements IContainerPro
.complete(8, 18).addArmor().addInventory().tile(this).energySlot(0, 62, 45).energySlot(1, 98, 45)
.syncEnergyValue().syncIntegerValue(this::getCurrentOutput, this::setCurentOutput).addInventory().create(this);
}
@Override
public boolean canBeUpgraded() {
return true;
}
@Override
public boolean isUpgradeValid(IUpgrade upgrade, ItemStack stack) {
return false; //TODO 1.13
}
}

View file

@ -76,6 +76,9 @@ public class TileTransformer extends TilePowerAcceptor
this.maxInput = tier.getMaxInput();
this.maxOutput = tier.getMaxOutput();
this.maxStorage = tier.getMaxInput() * 2;
// Should always be 4, except if we're tier MICRO, in which it will be 1.
super.setMaxPacketsPerTick(tier.getMaxOutput() / ouputTier.getMaxInput());
}
// TilePowerAcceptor