Skip to content

Commit

Permalink
Updated to 1.20.6: compiles but no testing
Browse files Browse the repository at this point in the history
No further 1.20.6 dev; straight to 1.21!
  • Loading branch information
desht committed Jun 20, 2024
1 parent bd423cc commit 1ecb364
Show file tree
Hide file tree
Showing 728 changed files with 12,567 additions and 11,762 deletions.
28 changes: 14 additions & 14 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ plugins {
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'net.neoforged.gradle.userdev' version '7.0.101'
id "me.modmuss50.mod-publish-plugin" version "0.4.5"
id 'net.neoforged.gradle.userdev' version '7.0.137'
id "me.modmuss50.mod-publish-plugin" version "0.4.5"
}

ext {
Expand Down Expand Up @@ -80,7 +80,7 @@ repositories {
}
maven {
name "FTB Maven"
url "https://maven.ftb.dev/releases/"
url "https://maven.ftb.dev/snapshots/"
content {
includeGroup "dev.ftb.mods"
}
Expand All @@ -91,7 +91,7 @@ base {
archivesName = "${archive_base_name}-${mod_version}+mc${minecraft_version}"
}

java.toolchain.languageVersion = JavaLanguageVersion.of(17)
java.toolchain.languageVersion = JavaLanguageVersion.of(21)

sourceSets {
api {
Expand Down Expand Up @@ -155,10 +155,10 @@ dependencies {
exclude group: "net.minecraftforge", module: "forge"
}

compileOnly("mezz.jei:jei-${minecraft_version}-common-api:${jei_version}")
compileOnly("mezz.jei:jei-${minecraft_version}-neoforge-api:${jei_version}")
runtimeOnly("mezz.jei:jei-${minecraft_version}-common:${jei_version}")
runtimeOnly("mezz.jei:jei-${minecraft_version}-neoforge:${jei_version}")
compileOnly("mezz.jei:jei-1.20.4-common-api:${jei_version}")
compileOnly("mezz.jei:jei-1.20.4-neoforge-api:${jei_version}")
//runtimeOnly("mezz.jei:jei-1.20.4-common:${jei_version}")
//runtimeOnly("mezz.jei:jei-1.20.4-neoforge:${jei_version}")

compileOnly("top.theillusivec4.curios:curios-neoforge:${curios_version}:api")
runtimeOnly("top.theillusivec4.curios:curios-neoforge:${curios_version}")
Expand All @@ -167,14 +167,14 @@ dependencies {
//runtimeOnly("vazkii.botania:Botania:${botania_version}")

compileOnly("vazkii.patchouli:Patchouli:${patchouli_version}:api")
runtimeOnly("vazkii.patchouli:Patchouli:${patchouli_version}")
//runtimeOnly("vazkii.patchouli:Patchouli:${patchouli_version}")

compileOnly("cc.tweaked:cc-tweaked-${minecraft_version}-forge-api:${cc_tweaked_version}")
runtimeOnly("cc.tweaked:cc-tweaked-${minecraft_version}-forge:${cc_tweaked_version}")
compileOnly("cc.tweaked:cc-tweaked-1.20.5-forge-api:${cc_tweaked_version}")
//runtimeOnly("cc.tweaked:cc-weaked-1.20.4-forge:${cc_tweaked_version}")

compileOnly("dev.ftb.mods:ftb-filter-system-neoforge:${ffs_version}") { transitive = false }

implementation("blusunrize.immersiveengineering:ImmersiveEngineering:${immersive_engineering_version}")
compileOnly("blusunrize.immersiveengineering:ImmersiveEngineering:${immersive_engineering_version}")

compileOnly("mekanism:Mekanism:${mekanism_version}:api")
runtimeOnly("mekanism:Mekanism:${mekanism_version}")
Expand All @@ -183,7 +183,7 @@ dependencies {

implementation("curse.maven:jade-324717:${jade_curse_id}")

compileOnly("com.blamejared.crafttweaker:CraftTweaker-neoforge-${minecraft_version}:${crafttweaker_version}")
compileOnly("com.blamejared.crafttweaker:CraftTweaker-neoforge-1.20.4:${crafttweaker_version}")

compileOnly("curse.maven:cofh_core-69162:${cofh_core_curse_id}")
compileOnly("curse.maven:thermal_cultivation-271835:${thermal_cultivation_curse_id}")
Expand Down Expand Up @@ -215,7 +215,7 @@ tasks.withType(ProcessResources).configureEach {
]
inputs.properties replaceProperties

filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) {
filesMatching(['META-INF/neoforge.mods.toml', 'pack.mcmeta']) {
expand replaceProperties + [project: project]
}
}
Expand Down
24 changes: 13 additions & 11 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ org.gradle.daemon=false
#########################################################
# Minecraft versions
#########################################################
minecraft_version=1.20.4
minecraft_version_range=[1.20.4,)
neo_version=20.4.233
neo_version_range=[20.4.190,)
minecraft_version=1.20.6
minecraft_version_range=[1.20.6,)
neo_version=20.6.99-beta
neo_version_range=[20.6.99-beta,)
loader_version_range=[1,)
mappings_version=1.20.4-2023.10.22
pack_format_number=18
Expand All @@ -20,7 +20,7 @@ pack_format_number=18
#########################################################
mod_id=pneumaticcraft
archive_base_name=pneumaticcraft-repressurized
mod_version=7.0.0
mod_version=7.1.0
mod_name="PneumaticCraft: Repressurized"
mod_group_id=me.desht.pneumaticcraft
mod_license=GPL3
Expand All @@ -33,17 +33,19 @@ curse_project_id=281849
# API versions
#########################################################
jei_version=17.3.0.49
curios_version=7.3.4+1.20.4
curios_version=8.0.0-beta+1.20.6
top_version=1.20.5_neo-11.1.1-2
ffs_version=2.1.0-SNAPSHOT

# TODO update deps when available
mekanism_version=1.20.4-10.5.19.40
immersive_engineering_version=1.20.4-11.1.0-172.110
top_version=1.20.4_neo-11.0.2-3
patchouli_version=1.20.4-85-NEOFORGE-SNAPSHOT
cc_tweaked_version=1.110.0
jade_curse_id = 5109393
cc_tweaked_version=1.110.3
jade_curse_id = 5366595
crafttweaker_version=17.0.9
ffs_version=2.0.1

# TODO update deps when available
# more out-of-date deps :p
botania_version=1.20.1-441-FORGE-SNAPSHOT
ctm_version=1.1.2.6
cofh_core_curse_id=4202944
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
Expand Down Expand Up @@ -54,7 +53,7 @@ public interface IBlockTrackEntry {
* @param te the block entity at this blockpos (may be null)
* @return true if this block should be tracked by this BlockTrackEntry
*/
boolean shouldTrackWithThisEntry(BlockGetter world, BlockPos pos, BlockState state, BlockEntity te);
boolean shouldTrackWithThisEntry(Level world, BlockPos pos, BlockState state, BlockEntity te);

/**
* This method controls whether to send server update requests, at 3 second intervals while the player is
Expand All @@ -79,7 +78,7 @@ public interface IBlockTrackEntry {
/**
* This method is called each client tick to retrieve the block's additional
* information. The method behaves much the same as {@link net.minecraft.world.item.Item#appendHoverText(ItemStack, Level, List, TooltipFlag)}.
* This method is only called if {@link #shouldTrackWithThisEntry(BlockGetter, BlockPos, BlockState, BlockEntity)}
* This method is only called if {@link #shouldTrackWithThisEntry(Level, BlockPos, BlockState, BlockEntity)}
* returned true, and the player is currently focused on the block.
*
* @param world the world
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
import me.desht.pneumaticcraft.api.PneumaticRegistry;
import me.desht.pneumaticcraft.api.item.IItemRegistry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack;
import net.neoforged.neoforge.fluids.FluidStack;
import net.neoforged.neoforge.fluids.capability.IFluidHandler;
import net.neoforged.neoforge.items.IItemHandler;
import net.neoforged.neoforge.items.ItemHandlerHelper;
import org.apache.commons.lang3.Validate;

import java.util.Objects;
Expand All @@ -43,10 +43,13 @@
*/
public record AmadronTradeResource(Either<ItemStack,FluidStack> resource) {
public static final Codec<AmadronTradeResource> CODEC = RecordCodecBuilder.create(inst -> inst.group(
Codec.either(ItemStack.ITEM_WITH_COUNT_CODEC, FluidStack.CODEC).fieldOf("resource").forGetter(AmadronTradeResource::resource)
Codec.either(ItemStack.CODEC, FluidStack.CODEC).fieldOf("resource").forGetter(AmadronTradeResource::resource)
).apply(inst, AmadronTradeResource::new));

private enum Type { ITEM, FLUID }
public static StreamCodec<RegistryFriendlyByteBuf, AmadronTradeResource> STREAM_CODEC = StreamCodec.composite(
ByteBufCodecs.either(ItemStack.STREAM_CODEC, FluidStack.STREAM_CODEC), AmadronTradeResource::resource,
AmadronTradeResource::new
);

public boolean isEmpty() {
return resource.map(ItemStack::isEmpty, FluidStack::isEmpty);
Expand All @@ -72,14 +75,6 @@ public static AmadronTradeResource of(FluidStack stack) {
return new AmadronTradeResource(Either.right(stack));
}

public static AmadronTradeResource fromNetwork(FriendlyByteBuf pb) {
Type type = pb.readEnum(Type.class);
return switch (type) {
case ITEM -> AmadronTradeResource.of(pb.readItem());
case FLUID -> AmadronTradeResource.of(FluidStack.loadFluidStackFromNBT(pb.readNbt()));
};
}

/**
* Get the item for this trade resource
* @return the itemstack, or ItemStack.EMPTY if the resource is a fluid
Expand Down Expand Up @@ -158,21 +153,10 @@ public AmadronTradeResource validate() {
return this;
}

public void toNetwork(FriendlyByteBuf pb) {
resource.ifLeft(pStack -> {
pb.writeEnum(Type.ITEM);
pb.writeItem(pStack);
})
.ifRight(fluidStack -> {
pb.writeEnum(Type.FLUID);
pb.writeNbt(fluidStack.writeToNBT(new CompoundTag()));
});
}

public String getName() {
return resource.map(
itemStack -> itemStack.getHoverName().getString(),
fluidStack -> fluidStack.getDisplayName().getString()
fluidStack -> fluidStack.getHoverName().getString()
);
}

Expand All @@ -193,7 +177,7 @@ public boolean equals(Object o) {
if (!(o instanceof AmadronTradeResource that)) return false;
return resource.map(
itemStack -> ItemStack.matches(itemStack, that.getItem()),
fluidStack -> fluidStack.isFluidStackIdentical(that.getFluid())
fluidStack -> FluidStack.matches(fluidStack, that.getFluid())
);
}

Expand All @@ -206,23 +190,23 @@ public int hashCode() {
public String toString() {
return resource.map(
itemStack -> itemStack.getCount() + " x " + itemStack.getHoverName().getString(),
fluidStack -> fluidStack.getAmount() + "mB " + fluidStack.getDisplayName().getString()
fluidStack -> fluidStack.getAmount() + "mB " + fluidStack.getHoverName().getString()
);
}

/**
* Get the total number of matching items in the given (lazy) item handler. "Matching" means that the stacks are
* the same item, AND if the item in the offer has any NBT, the stack's NBT must also match.
* the same item, AND if the item in the offer has any component data, the stack's components must also match.
*
* @param item the item to look for
* @param itemHandler the item handler
* @return the total number of matching items
*/
private static int countItemsInHandler(ItemStack item, IItemHandler itemHandler) {
boolean matchNBT = item.hasTag();
boolean matchComponents = !item.getComponentsPatch().isEmpty();
IItemRegistry registry = PneumaticRegistry.getInstance().getItemRegistry();
return IntStream.range(0, itemHandler.getSlots())
.filter(i -> registry.doesItemMatchFilter(item, itemHandler.getStackInSlot(i), false, matchNBT, false))
.filter(i -> registry.doesItemMatchFilter(item, itemHandler.getStackInSlot(i), false, matchComponents, false))
.map(i -> itemHandler.getStackInSlot(i).getCount())
.sum();
}
Expand All @@ -240,7 +224,7 @@ private static int findSpaceInHandler(ItemStack item, int multiplier, IItemHandl

int remaining = totalItems;
for (int i = 0; i < itemHandler.getSlots() && remaining > 0; i++) {
if (itemHandler.getStackInSlot(i).isEmpty() || ItemHandlerHelper.canItemStacksStack(itemHandler.getStackInSlot(i), item)) {
if (itemHandler.getStackInSlot(i).isEmpty() || ItemStack.isSameItemSameComponents(itemHandler.getStackInSlot(i), item)) {
remaining -= item.getMaxStackSize() - itemHandler.getStackInSlot(i).getCount();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,25 @@
import com.mojang.serialization.Codec;
import com.mojang.serialization.DataResult;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.util.ExtraCodecs;
import io.netty.buffer.ByteBuf;
import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
import org.apache.commons.lang3.Validate;

/**
* Defines a valid operating temperature range for machines which use heat. Temperatures are in Kelvin (i.e. absolute),
* so negative values are not accepted.
*/
public class TemperatureRange {
public static final Codec<TemperatureRange> CODEC = ExtraCodecs.validate(
RecordCodecBuilder.create(instance -> instance.group(
Codec.INT.optionalFieldOf("min", 0).forGetter(TemperatureRange::getMin),
Codec.INT.optionalFieldOf("max", Integer.MAX_VALUE).forGetter(TemperatureRange::getMax)
).apply(instance, TemperatureRange::of)),
r -> r.min < r.max ?
DataResult.success(r) :
DataResult.error(() -> "min must be < max", r)
public static final Codec<TemperatureRange> CODEC = RecordCodecBuilder.<TemperatureRange>create(instance -> instance.group(
Codec.INT.optionalFieldOf("min", 0).forGetter(TemperatureRange::getMin),
Codec.INT.optionalFieldOf("max", Integer.MAX_VALUE).forGetter(TemperatureRange::getMax)
).apply(instance, TemperatureRange::of)).validate(TemperatureRange::validate);

public static StreamCodec<ByteBuf, TemperatureRange> STREAM_CODEC = StreamCodec.composite(
ByteBufCodecs.INT, TemperatureRange::getMin,
ByteBufCodecs.INT, TemperatureRange::getMax,
TemperatureRange::new
);

private static final TemperatureRange INVALID = new TemperatureRange(0, 1) {
Expand All @@ -50,6 +52,7 @@ public boolean inRange(double temp) {
return false;
}
};

private static final TemperatureRange ANY = new TemperatureRange(0, Integer.MAX_VALUE);

private final int min;
Expand All @@ -62,6 +65,12 @@ private TemperatureRange(int min, int max) {
this.max = max;
}

private static DataResult<TemperatureRange> validate(TemperatureRange range) {
return range.min < range.max ?
DataResult.success(range) :
DataResult.error(() -> "min must be < max", range);
}

/**
* Get the minimum temperature for this range.
*
Expand Down Expand Up @@ -120,15 +129,6 @@ public static TemperatureRange max(int maxTemp) {
return new TemperatureRange(0, maxTemp);
}

/**
* Read a temperature range from packet buffer, as written by {@link #write(FriendlyByteBuf)}
* @param buffer the buffer
* @return a new temperature range object
*/
public static TemperatureRange read(FriendlyByteBuf buffer) {
return new TemperatureRange(buffer.readVarInt(), buffer.readVarInt());
}

/**
* Check if the given temperature is valid for this range object.
*
Expand Down Expand Up @@ -174,11 +174,6 @@ public boolean hasMax() {
return max < Integer.MAX_VALUE;
}

public void write(FriendlyByteBuf buffer) {
buffer.writeVarInt(min);
buffer.writeVarInt(max);
}

public String asString(TemperatureScale scale) {
if (isAny()) return "any";
if (this == invalid()) return "invalid";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

import java.util.function.Supplier;

/**
* Provides access to any custom ingredient types registered by the mod.
*/
public interface CustomIngredientTypes {
Supplier<IngredientType<FluidIngredient>> fluidType();

Supplier<IngredientType<StackedIngredient>> stackedItemType();
Supplier<IngredientType<FluidContainerIngredient>> fluidContainerType();
}
Loading

0 comments on commit 1ecb364

Please sign in to comment.