Skip to content

Commit

Permalink
Cherrypick v1.0.20 to MC 1.19.2 (#694)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikerooni authored Jan 5, 2024
1 parent c244d07 commit f137223
Show file tree
Hide file tree
Showing 43 changed files with 3,356 additions and 2,964 deletions.
5 changes: 5 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
root = true

[*.java]
indent_style = space
indent_size = 4
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ bin/
libs/

.classpath
*/.factorypath
.project
.idea/
classes/
Expand All @@ -23,3 +24,4 @@ fabric/src/generated/resources/.cache/

*.patch
*.DS_Store

26 changes: 25 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

Version: 1.0.20

***WARNING: THIS RELEASE BREAKS MOST EXISTING TOOLS!***
The tool rework unfortunately requires some breaking changes.
You will still have your tool items and may still use some of them in crafting recipes,
but you will need to craft the ones you're actively using again to regain functionality.


**Additions:**
- port missing tooltips from 1.12
- add maintenance to large boilers
- add shape info to all machines using coils
- mark multiblock info blocks as inputs for the recipe viewer pattern preview
- add UHV+ electric motors

**Tool Rework:**
- revamps tools, bringing parity with 1.12 (except electric tools)
- adds spades, an AOE shovel
- adds functionality to most tools that were missing it previously
Expand All @@ -14,7 +28,17 @@ Version: 1.0.20
- crowbars now rotate rail blocks
- plungers made from different rubbers now have different durabilities

***WARNING: THIS BREAKS MOST EXISTING TOOLS!***
**Fixes:**
- fixed certain ore veins being too small
- fix LuV prospector recipe
- fix EMI screen loading error
- fix diodes being reset to 1A on chunk load
- fix diodes not being able to transfer more than 8A
- fix surface rocks not breaking when their supporting block is broken
- fix crash when placing pump covers on fluid pipes in certain cases
- fix voiding mode not working in quantum tanks
- fix charger not dropping contents when broken
- fix missing transfer size input in robot arms and fluid regulators, when a tag filter is used

Notes for addon devs:
- GTItems.TOOL_ITEMS is now a table<Material, Type, Tool item> instead of the old <Tier, Type, Item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ static FluidFilter loadFilter(ItemStack itemStack) {
*/
long testFluidAmount(FluidStack fluidStack);

/**
* @return Whether this filter supports querying for exact fluid amounts.
*/
default boolean supportsAmounts() {
return !isBlackList();
}

/**
* An empty fluid filter that allows all fluids.<br>
* ONLY TO BE USED FOR FLUID MATCHING! All other functionality will throw an exception.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ static ItemFilter loadFilter(ItemStack itemStack) {
*/
int testItemCount(ItemStack itemStack);

/**
* @return Whether this filter supports querying for exact item amounts.
*/
default boolean supportsAmounts() {
return !isBlackList();
}

/**
* An empty item filter that allows all items.<br>
Expand All @@ -58,5 +64,4 @@ static ItemFilter loadFilter(ItemStack itemStack) {
throw new NotImplementedException("Not available for empty item filter");
}
};

}
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,9 @@ public boolean test(FluidStack fluidStack) {
public long testFluidAmount(FluidStack fluidStack) {
return test(fluidStack) ? Long.MAX_VALUE : 0;
}

@Override
public boolean supportsAmounts() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,9 @@ public boolean test(ItemStack itemStack) {
public int testItemCount(ItemStack itemStack) {
return test(itemStack) ? Integer.MAX_VALUE : 0;
}

@Override
public boolean supportsAmounts() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import net.minecraft.core.Registry;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Item;
Expand Down Expand Up @@ -1005,7 +1004,7 @@ public MutableComponent getLocalizedName(Material material) {

public String getUnlocalizedName(Material material) {
String formattedPrefix = FormattingUtil.toLowerCaseUnderscore(this.name);
String matSpecificKey = String.format("item.%s_%s", this.invertedName ? material.getName() : formattedPrefix, this.invertedName ? formattedPrefix : material.getName());
String matSpecificKey = String.format("item.%s_%s", this.invertedName ? formattedPrefix : material.getName(), this.invertedName ? material.getName() : formattedPrefix);
if (LocalizationUtils.exist(matSpecificKey)) {
return matSpecificKey;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ private void onPosSelected(BlockPos pos, Direction facing) {
for (int i = 0; i < candidateStacks.size(); i++) {
int finalI = i;
candidates[i] = new SlotWidget(itemHandler, i, 9 + (i / maxCol) * 18, 33 + (i % maxCol) * 18, false, false)
.setIngredientIO(IngredientIO.INPUT)
.setBackgroundTexture(new ColorRectTexture(0x4fffffff))
.setOnAddedTooltips((slot, list) -> list.addAll(predicateTips.get(finalI)));
addWidget(candidates[i]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,33 @@

public class AoESymmetrical {

public final int column, row, layer;

private AoESymmetrical() {
this.column = 0;
this.row = 0;
this.layer = 0;
}

private AoESymmetrical(int column, int row, int layer) {
this.column = column;
this.row = row;
this.layer = layer;
}

private static final AoESymmetrical NONE = new AoESymmetrical();

public static AoESymmetrical none() {
return NONE;
}

public static AoESymmetrical of(int column, int row, int layer) {
Preconditions.checkArgument(column >= 0, "Height cannot be negative.");
Preconditions.checkArgument(row >= 0, "Width cannot be negative.");
Preconditions.checkArgument(layer >= 0, "Depth cannot be negative.");
return column == 0 && row == 0 && layer == 0 ? NONE : new AoESymmetrical(column, row, layer);
}

public static AoESymmetrical readMax(CompoundTag tag) {
int column = 0, row = 0, layer = 0;
if (tag.contains(ToolHelper.MAX_AOE_COLUMN_KEY, Tag.TAG_INT)) {
Expand Down Expand Up @@ -137,30 +162,4 @@ public static void decreaseLayer(CompoundTag tag, AoESymmetrical defaultDefiniti
}
}
}

public static AoESymmetrical none() {
return NONE;
}

public static AoESymmetrical of(int column, int row, int layer) {
Preconditions.checkArgument(column >= 0, "Height cannot be negative.");
Preconditions.checkArgument(row >= 0, "Width cannot be negative.");
Preconditions.checkArgument(layer >= 0, "Depth cannot be negative.");
return column == 0 && row == 0 && layer == 0 ? NONE : new AoESymmetrical(column, row, layer);
}

public final int column, row, layer;

private AoESymmetrical() {
this.column = 0;
this.row = 0;
this.layer = 0;
}

private AoESymmetrical(int column, int row, int layer) {
this.column = column;
this.row = row;
this.layer = layer;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
Expand Down Expand Up @@ -100,6 +101,15 @@ public boolean canSurvive(BlockState state, LevelReader level, BlockPos pos) {
return level.getBlockState(attachedBlock).isFaceSturdy(level, attachedBlock, facing.getOpposite());
}

@Override
public void neighborChanged(BlockState state, Level level, BlockPos pos, Block neighborBlock, BlockPos neighborPos, boolean movedByPiston) {
super.neighborChanged(state, level, pos, neighborBlock, neighborPos, movedByPiston);

if (!canSurvive(state, level, pos)) {
Block.updateOrDestroy(state, Blocks.AIR.defaultBlockState(), level, pos, Block.UPDATE_ALL);
}
}

@Nullable
@Override
public BlockState getStateForPlacement(BlockPlaceContext context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ private boolean shouldShowTransferSize() {
if (!this.filterHandler.isFilterPresent())
return true;

return this.filterHandler.getFilter().isBlackList();
return !this.filterHandler.getFilter().supportsAmounts();
}

//////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,6 @@ private boolean shouldShowStackSize() {
if (!this.filterHandler.isFilterPresent())
return true;

return this.filterHandler.getFilter().isBlackList();
return !this.filterHandler.getFilter().supportsAmounts();
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.gregtechceu.gtceu.common.data;

import com.gregtechceu.gtceu.GTCEu;
import com.gregtechceu.gtceu.api.GTValues;
import com.gregtechceu.gtceu.api.data.RotationState;
import com.gregtechceu.gtceu.api.data.chemical.ChemicalHelper;
import com.gregtechceu.gtceu.api.data.tag.TagPrefix;
Expand All @@ -12,9 +13,17 @@
import com.gregtechceu.gtceu.api.pattern.FactoryBlockPattern;
import com.gregtechceu.gtceu.api.pattern.Predicates;
import com.gregtechceu.gtceu.api.pattern.TraceabilityPredicate;
import com.gregtechceu.gtceu.api.pattern.MultiblockShapeInfo;
import com.gregtechceu.gtceu.api.pattern.util.RelativeDirection;
import com.gregtechceu.gtceu.api.recipe.OverclockingLogic;
import com.gregtechceu.gtceu.common.machine.multiblock.part.ParallelHatchPartMachine;
import net.minecraft.network.chat.Component;
import net.minecraft.core.Direction;
import net.minecraft.world.level.block.Blocks;

import java.util.List;
import java.util.ArrayList;
import java.util.Comparator;

import static com.gregtechceu.gtceu.api.GTValues.*;
import static com.gregtechceu.gtceu.api.machine.multiblock.PartAbility.*;
Expand All @@ -24,7 +33,7 @@
import static com.gregtechceu.gtceu.common.data.GCyMBlocks.*;
import static com.gregtechceu.gtceu.common.data.GCyMRecipeTypes.ALLOY_BLAST_RECIPES;
import static com.gregtechceu.gtceu.common.data.GTBlocks.*;
import static com.gregtechceu.gtceu.common.data.GTMachines.registerTieredMachines;
import static com.gregtechceu.gtceu.common.data.GTMachines.*;
import static com.gregtechceu.gtceu.common.data.GTMaterials.NaquadahAlloy;
import static com.gregtechceu.gtceu.common.data.GTRecipeTypes.*;

Expand Down Expand Up @@ -410,6 +419,29 @@ public static void init() {}
.where('A', air())
.where('#', any())
.build())
.shapeInfos(definition -> {
List<MultiblockShapeInfo> shapeInfo = new ArrayList<>();
var builder = MultiblockShapeInfo.builder()
.aisle("#XSX#", "#CCC#", "#GGG#", "#CCC#", "#XMX#")
.aisle("IXXXX", "CAAAC", "GAAAG", "CAAAC", "XXXXX")
.aisle("XXXXD", "CAAAC", "GAAAG", "CAAAC", "XXHXX")
.aisle("FXXXX", "CAAAC", "GAAAG", "CAAAC", "XXXXX")
.aisle("#EXE#", "#CCC#", "#GGG#", "#CCC#", "#XXX#")
.where('X', CASING_HIGH_TEMPERATURE_SMELTING.getDefaultState())
.where('S', definition, Direction.NORTH)
.where('G', HEAT_VENT.getDefaultState())
.where('A', Blocks.AIR.defaultBlockState())
.where('E', ENERGY_INPUT_HATCH[GTValues.LV], Direction.SOUTH)
.where('I', ITEM_IMPORT_BUS[GTValues.LV], Direction.WEST)
.where('F', FLUID_IMPORT_HATCH[GTValues.LV], Direction.WEST)
.where('D', FLUID_EXPORT_HATCH[GTValues.LV], Direction.EAST)
.where('H', MUFFLER_HATCH[GTValues.LV], Direction.UP)
.where('M', MAINTENANCE_HATCH, Direction.NORTH);
ALL_COILS.entrySet().stream()
.sorted(Comparator.comparingInt(entry -> entry.getKey().getTier()))
.forEach(coil -> shapeInfo.add(builder.shallowCopy().where('C', coil.getValue().get()).build()));
return shapeInfo;
})
.workableCasingRenderer(GTCEu.id("block/casings/gcym/high_temperature_smelting_casing"),
GTCEu.id("block/multiblock/gcym/blast_alloy_smelter"), false)
.compassSections(GTCompassSections.TIER[IV])
Expand Down Expand Up @@ -711,6 +743,43 @@ public static void init() {}
.where('#', any())
.build();
})
.shapeInfos(definition -> {
List<MultiblockShapeInfo> shapeInfo = new ArrayList<>();
var builder = MultiblockShapeInfo.builder()
.aisle("##XODXXXQLX##", "##XXXXSXXXX##", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############")
.aisle("#XXXXXXXXXXX#", "#XXXXXXXXXXX#", "###F#####F###", "###F#####F###", "###FFFFFFF###", "#############", "#############", "#############", "#############", "#############", "####FFFFF####", "#############", "#############", "#############", "#############", "#############", "#############")
.aisle("XXXXXXXXXXXXX", "XXXXVVVVVXXXX", "##F#######F##", "##F#######F##", "##FFFXXXFFF##", "##F#######F##", "##F#######F##", "##F#######F##", "##F#######F##", "##F#######F##", "##FFFXXXFFF##", "#############", "#############", "#############", "#############", "#############", "###TTTTTTT###")
.aisle("XXXXXXXXXXXXX", "XXXXXXXXXXXXX", "#F####P####F#", "#F####P####F#", "#FFXXXPXXXFF#", "######P######", "######P######", "######P######", "######P######", "######P######", "##FXXXPXXXF##", "######P######", "######P######", "######P######", "######P######", "######P######", "##TTTTPTTTT##")
.aisle("XXXXXXXXXXXXX", "XXVXXXXXXXVXX", "####BBPBB####", "####TITIT####", "#FFXXXXXXXFF#", "####BITIB####", "####CCCCC####", "####CCCCC####", "####CCCCC####", "####BITIB####", "#FFXXXXXXXFF#", "####BITIB####", "####CCCCC####", "####CCCCC####", "####CCCCC####", "####BITIB####", "##TTTTPTTTT##")
.aisle("XXXXXXXXXXXXX", "XXVXXXXXXXVXX", "####BAAAB####", "####IAAAI####", "#FXXXAAAXXXF#", "####IAAAI####", "####CAAAC####", "####CAAAC####", "####CAAAC####", "####IAAAI####", "#FXXXAAAXXXF#", "####IAAAI####", "####CAAAC####", "####CAAAC####", "####CAAAC####", "####IAAAI####", "##TTTTPTTTT##")
.aisle("XXXXXXXXXXXXX", "XXVXXXXXXXVXX", "###PPAAAPP###", "###PTAAATP###", "#FXPXAAAXPXF#", "###PTAAATP###", "###PCAAACP###", "###PCAAACP###", "###PCAAACP###", "###PTAAATP###", "#FXPXAAAXPXF#", "###PTAAATP###", "###PCAAACP###", "###PCAAACP###", "###PCAAACP###", "###PTAAATP###", "##TPPPHPPPT##")
.aisle("XXXXXXXXXXXXX", "XXVXXXXXXXVXX", "####BAAAB####", "####IAAAI####", "#FXXXAAAXXXF#", "####IAAAI####", "####CAAAC####", "####CAAAC####", "####CAAAC####", "####IAAAI####", "#FXXXAAAXXXF#", "####IAAAI####", "####CAAAC####", "####CAAAC####", "####CAAAC####", "####IAAAI####", "##TTTTPTTTT##")
.aisle("XXXXXXXXXXXXX", "XXVXXXXXXXVXX", "####BBPBB####", "####TITIT####", "#FFXXXXXXXFF#", "####BITIB####", "####CCCCC####", "####CCCCC####", "####CCCCC####", "####BITIB####", "#FFXXXXXXXFF#", "####BITIB####", "####CCCCC####", "####CCCCC####", "####CCCCC####", "####BITIB####", "##TTTTPTTTT##")
.aisle("XXXXXXXXXXXXX", "XXXXXXXXXXXXX", "#F####P####F#", "#F####P####F#", "#FFXXXPXXXFF#", "######P######", "######P######", "######P######", "######P######", "######P######", "##FXXXPXXXF##", "######P######", "######P######", "######P######", "######P######", "######P######", "##TTTTPTTTT##")
.aisle("XXXXXXXXXXXXX", "XXXXVVVVVXXXX", "##F#######F##", "##F#######F##", "##FFFXXXFFF##", "##F#######F##", "##F#######F##", "##F#######F##", "##F#######F##", "##F#######F##", "##FFFXXXFFF##", "#############", "#############", "#############", "#############", "#############", "###TTTTTTT###")
.aisle("#XXXXXXXXXXX#", "#XXXXXXXXXXX#", "###F#####F###", "###F#####F###", "###FFFFFFF###", "#############", "#############", "#############", "#############", "#############", "####FFFFF####", "#############", "#############", "#############", "#############", "#############", "#############")
.aisle("##XXXEMEXXX##", "##XXXXXXXXX##", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############")
.where('X', CASING_HIGH_TEMPERATURE_SMELTING.getDefaultState())
.where('S', definition, Direction.NORTH)
.where('A', Blocks.AIR.defaultBlockState())
.where('T', CASING_TUNGSTENSTEEL_ROBUST.getDefaultState())
.where('B', FIREBOX_TUNGSTENSTEEL.getDefaultState())
.where('P', CASING_TUNGSTENSTEEL_PIPE.getDefaultState())
.where('I', CASING_EXTREME_ENGINE_INTAKE.getDefaultState())
.where('F', ChemicalHelper.getBlock(TagPrefix.frameGt, NaquadahAlloy))
.where('V', HEAT_VENT.getDefaultState())
.where('E', ENERGY_INPUT_HATCH[GTValues.LV], Direction.SOUTH)
.where('L', ITEM_IMPORT_BUS[GTValues.LV], Direction.NORTH)
.where('O', ITEM_EXPORT_BUS[GTValues.LV], Direction.NORTH)
.where('Q', FLUID_IMPORT_HATCH[GTValues.LV], Direction.NORTH)
.where('D', FLUID_EXPORT_HATCH[GTValues.LV], Direction.NORTH)
.where('H', MUFFLER_HATCH[GTValues.LV], Direction.UP)
.where('M', MAINTENANCE_HATCH, Direction.SOUTH);
ALL_COILS.entrySet().stream()
.sorted(Comparator.comparingInt(entry -> entry.getKey().getTier()))
.forEach(coil -> shapeInfo.add(builder.shallowCopy().where('C', coil.getValue().get()).build()));
return shapeInfo;
})
.workableCasingRenderer(GTCEu.id("block/casings/gcym/high_temperature_smelting_casing"),
GTCEu.id("block/multiblock/gcym/mega_blast_furnace"), false)
.compassSections(GTCompassSections.TIER[LuV])
Expand Down
Loading

0 comments on commit f137223

Please sign in to comment.