Skip to content

Commit

Permalink
Merge branch 'refs/heads/1.20.1' into yo/ui
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/main/java/com/gregtechceu/gtceu/common/data/GTItems.java
  • Loading branch information
screret committed Dec 9, 2024
2 parents df33f52 + 4a6eef5 commit 7c800a7
Show file tree
Hide file tree
Showing 16 changed files with 487 additions and 553 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.gregtechceu.gtceu.api.data.chemical;

import com.gregtechceu.gtceu.GTCEu;
import com.gregtechceu.gtceu.api.GTCEuAPI;
import com.gregtechceu.gtceu.api.data.chemical.material.Material;
import com.gregtechceu.gtceu.api.data.chemical.material.properties.FluidProperty;
Expand All @@ -19,6 +20,7 @@
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.ItemLike;
Expand All @@ -29,6 +31,7 @@

import com.mojang.datafixers.util.Pair;
import com.tterrag.registrate.util.entry.BlockEntry;
import com.tterrag.registrate.util.entry.ItemEntry;
import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand Down Expand Up @@ -68,6 +71,13 @@ public static void registerMaterialInfo(ItemLike item, ItemMaterialInfo material
}

public static ItemMaterialInfo getMaterialInfo(ItemLike item) {
if (item instanceof Block block) {
return ITEM_MATERIAL_INFO.get(block);
} else if (item instanceof BlockItem blockItem) {
return ITEM_MATERIAL_INFO.get(blockItem.getBlock());
} else if (item instanceof ItemEntry<?> entry) {
return ITEM_MATERIAL_INFO.get(entry.asItem());
}
return ITEM_MATERIAL_INFO.get(item);
}

Expand Down Expand Up @@ -158,7 +168,13 @@ public static MaterialStack getMaterial(ItemLike itemLike) {
}
}
ItemMaterialInfo info = ITEM_MATERIAL_INFO.get(itemLike);
return info == null ? null : info.getMaterial().copy();
if (info == null)
return null;
if (info.getMaterial() == null) {
GTCEu.LOGGER.error("ItemMaterialInfo for {} is empty!", itemLike);
return null;
}
return info.getMaterial().copy();
}

@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ private static void registerDuctPipeBlock(int index) {
.tag(GTToolType.WRENCH.harvestTags.get(0), BlockTags.MINEABLE_WITH_PICKAXE)
.item(BlockItem::new)
.build()
.register();;
.register();
public static final BlockEntry<Block> HIGH_POWER_CASING = createCasingBlock("high_power_casing",
GTCEu.id("block/casings/hpca/high_power_casing"));

Expand Down
139 changes: 1 addition & 138 deletions src/main/java/com/gregtechceu/gtceu/common/data/GTItems.java

Large diffs are not rendered by default.

81 changes: 0 additions & 81 deletions src/main/java/com/gregtechceu/gtceu/common/data/GTMachines.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ public class GTRecipeTypes {

public final static GTRecipeType MACERATOR_RECIPES = register("macerator", ELECTRIC).setMaxIOSize(1, 4, 0, 0)
.setEUIO(IO.IN)
.prepareBuilder(recipeBuilder -> recipeBuilder.duration(150).EUt(2))
.setSlotOverlay(false, false, GuiTextures.CRUSHED_ORE_OVERLAY)
.setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY)
.setProgressBar(GuiTextures.PROGRESS_BAR_MACERATE, LEFT_TO_RIGHT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,11 @@ public void updateStructureDimensions() {
if (hDist != 0) break;
}

if (Math.abs(lDist - rDist) > 1 || Math.abs(bDist - fDist) > 1) {
this.isFormed = false;
return;
}

if (lDist < MIN_RADIUS || rDist < MIN_RADIUS || bDist < MIN_RADIUS || fDist < MIN_RADIUS || hDist < MIN_DEPTH) {
this.isFormed = false;
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,9 @@ private TraceabilityPredicate logPredicate() {
}, null);
}

public boolean updateDimensions() {
public void updateDimensions() {
Level level = getLevel();
if (level == null) return false;
if (level == null) return;
Direction front = getFrontFacing();
Direction back = front.getOpposite();
Direction left = front.getCounterClockWise();
Expand All @@ -279,18 +279,21 @@ public boolean updateDimensions() {
if (hDist == 0 && isBlockFloor(level, hPos)) hDist = i;
}

if (Math.abs(lDist - rDist) > 1 || Math.abs(bDist - fDist) > 1) {
this.isFormed = false;
return;
}

if (lDist < MIN_RADIUS || rDist < MIN_RADIUS || fDist < MIN_RADIUS || bDist < MIN_RADIUS || hDist < MIN_DEPTH) {
onStructureInvalid();
return false;
this.isFormed = false;
return;
}

this.lDist = lDist;
this.rDist = rDist;
this.fDist = fDist;
this.bDist = bDist;
this.hDist = hDist;

return true;
}

private static boolean isBlockWall(Level level, BlockPos.MutableBlockPos pos, Direction direction) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,21 @@ public FTBOwner(Team team, UUID player) {

@Override
public void save(CompoundTag tag) {
tag.putUUID("teamUUID", team.getTeamId());
if (team != null)
tag.putUUID("teamUUID", team.getTeamId());
tag.putUUID("playerUUID", playerUUID);
}

@Override
public void load(CompoundTag tag) {
this.team = FTBTeamsAPIImpl.INSTANCE.getManager().getTeamByID(tag.getUUID("teamUUID")).orElse(null);
try {
if (tag.contains("teamUUID"))
this.team = FTBTeamsAPIImpl.INSTANCE.getManager().getTeamByID(tag.getUUID("teamUUID")).orElse(null);
else this.team = null;
} catch (NullPointerException e) {
this.team = null;
}

this.playerUUID = tag.getUUID("playerUUID");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public static void gatherData(GatherDataEvent event) {
DatapackBuiltinEntriesProvider provider = generator.addProvider(true, new DatapackBuiltinEntriesProvider(
packOutput, registries, new RegistrySetBuilder()
.add(Registries.DAMAGE_TYPE, GTDamageTypes::bootstrap)

.add(Registries.CONFIGURED_FEATURE, GTConfiguredFeatures::bootstrap)
.add(Registries.PLACED_FEATURE, GTPlacements::bootstrap)
.add(Registries.DENSITY_FUNCTION, GTWorldgen::bootstrapDensityFunctions)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,10 @@ public static void init() {
new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4)));

ChemicalHelper.registerMaterialInfo(GTBlocks.CASING_PRIMITIVE_BRICKS.get(),
new ItemMaterialInfo(new MaterialStack(GTMaterials.Fireclay, M * 4)));
ConfigHolder.INSTANCE.recipes.harderBrickRecipes ?
new ItemMaterialInfo(new MaterialStack(GTMaterials.Fireclay, M * 6),
new MaterialStack(GTMaterials.Gypsum, M * 2)) :
new ItemMaterialInfo(new MaterialStack(GTMaterials.Fireclay, M * 4)));

if (ConfigHolder.INSTANCE.recipes.hardWoodRecipes) {
ChemicalHelper.registerMaterialInfo(Items.ACACIA_DOOR, new ItemMaterialInfo(
Expand Down
Loading

0 comments on commit 7c800a7

Please sign in to comment.