Skip to content

Commit

Permalink
Merge branch 'master' into zb-better-copying
Browse files Browse the repository at this point in the history
  • Loading branch information
Zorbatron authored Sep 1, 2024
2 parents 3171cbe + 518a896 commit c92a04a
Show file tree
Hide file tree
Showing 81 changed files with 528 additions and 234 deletions.
28 changes: 26 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//version: 1720106721
//version: 1723428048
/*
* DO NOT CHANGE THIS FILE!
* Also, you may replace this file at any time if there is an update available.
Expand Down Expand Up @@ -1237,6 +1237,30 @@ if (cfApiKey.isPresent() || deploymentDebug.toBoolean()) {
additionalFile.changelog = changelogRaw
}
}
doLast {
// No File IDs in Debug Mode
if (!deploymentDebug.toBoolean()) {
def list = []
for (def artifact : tasks.curseforge.getUploadArtifacts()) {
list.add(artifact)
for (def additionalArtifact : artifact.getAdditionalArtifacts()) {
list.add(additionalArtifact)
}
}
def summary = "## CurseForge Build Summary (Mod ${modName} | Project ID ${curseForgeProjectId})"
for (def artifact : list) {
def fileId = artifact.getCurseFileId()
def fileName = artifact.getArtifact().getSingleFile().name
println("Uploaded File ${fileName}, With File ID: ${fileId}")
summary = summary + "\n - File: ${fileName} | File ID: ${fileId}"
}
println(summary)
def stepSummary = providers.environmentVariable("GITHUB_STEP_SUMMARY")
if (stepSummary.isPresent()) {
file(stepSummary.get()).write(summary)
}
}
}
}
tasks.curseforge.dependsOn(build)
tasks.curseforge.dependsOn('generateChangelog')
Expand Down Expand Up @@ -1367,7 +1391,7 @@ def getChangelog() {

// Buildscript updating

def buildscriptGradleVersion = '8.5'
def buildscriptGradleVersion = '8.9'

tasks.named('wrapper', Wrapper).configure {
gradleVersion = buildscriptGradleVersion
Expand Down
21 changes: 21 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,20 @@ minecraftVersion = 1.12.2
# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty
# Alternatively this can be set with the 'DEV_USERNAME' environment variable.
developmentEnvironmentUserName = Developer
# Additional arguments applied to the JVM when launching minecraft
# Syntax: -arg1=value1;-arg2=value2;...
# Example value: -Dmixin.debug.verify=true;-XX:+UnlockExperimentalVMOptions
additionalJavaArguments=

# Enables using modern java syntax (up to version 17) via Jabel, while still targeting JVM 8.
# See https://github.com/bsideup/jabel for details on how this works.
# Using this requires that you use a Java 17 JDK for development.
enableModernJavaSyntax = true
# Enables runClient/runServer tasks for Java 17 and Java 21 using LWJGL3ify.
# This is primarily used to test if your mod is compatible with platforms running
# Minecraft 1.12.2 on modern versions of Java and LWJGL, and assist in fixing any problems with it.
# Using this requires that you use a Java 17/Java 21 JDK for development.
enableJava17RunTasks=false

# Generate a class with String fields for the mod id, name and version named with the fields below
generateGradleTokenClass = gregtech.GTInternalTags
Expand All @@ -42,6 +51,7 @@ gradleTokenVersion = VERSION
# leave this property empty.
# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
apiPackage =

# If you want to keep your API code in src/api instead of src/main
useSrcApiPath=false

Expand All @@ -54,6 +64,8 @@ accessTransformersFile = gregtech_at.cfg
usesMixins = true
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
mixinsPackage = mixins
# Location of the mixin config refmap. If left, blank, defaults to "mixins.${modId}.refmap.json". Target file must have the "json" extension.
mixinConfigRefmap=
# Automatically generates a mixin config json if enabled, with the name mixins.modid.json
generateMixinConfig = false
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
Expand All @@ -62,18 +74,27 @@ coreModClass = asm.GregTechLoadingPlugin
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod (meaning that
# there is no class annotated with @Mod) you want this to be true. When in doubt: leave it on false!
containsMixinsAndOrCoreModOnly=false

# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins.
forceEnableMixins=false

# Outputs pre-transformed and post-transformed loaded classes to run/CLASSLOADER_TEMP. Can be used in combination with
# diff to see exactly what your ASM or Mixins are changing in the target file.
# Optionally can be specified with the 'CORE_MOD_DEBUG' env var. Will output a lot of files!
enableCoreModDebug=false

# Adds CurseMaven, Modrinth Maven, BlameJared maven, and some more well-known 1.12.2 repositories
includeWellKnownRepositories=true

# Adds JEI and TheOneProbe to your development environment. Adds them as 'implementation', meaning they will
# be available at compiletime and runtime for your mod (in-game and in-code).
# Overrides the above setting to be always true, as these repositories are needed to fetch the mods
includeCommonDevEnvMods = true
# Some mods require a specific forge version to launch in. When you need to use one of those mods as a dependency,
# and cannot launch with the forge version required, enable this to strip the forge version requirements from that mod.
# This will add 'strip-latest-forge-requirements' as 'runtimeOnlyNonPublishable'.
# Requires useMixins or forceEnableMixins to be true, as the mod uses mixins to function.
stripForgeRequirements=false


# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated in your jar. It is your
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ public void breakBlock(@NotNull World worldIn, @NotNull BlockPos pos, @NotNull I
MetaTileEntity metaTileEntity = getMetaTileEntity(worldIn, pos);
if (metaTileEntity != null) {
if (!metaTileEntity.keepsInventory()) {
NonNullList<ItemStack> inventoryContents = NonNullList.create();
List<ItemStack> inventoryContents = new ArrayList<>();
metaTileEntity.clearMachineInventory(inventoryContents);
for (ItemStack itemStack : inventoryContents) {
Block.spawnAsEntity(worldIn, pos, itemStack);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.NonNullList;
import net.minecraft.world.World;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.Constants;
Expand Down Expand Up @@ -71,7 +70,7 @@ public abstract class AbstractRecipeLogic extends MTETrait implements IWorkable,
protected int maxProgressTime;
protected long recipeEUt;
protected List<FluidStack> fluidOutputs;
protected NonNullList<ItemStack> itemOutputs;
protected List<ItemStack> itemOutputs;

protected boolean isActive;
protected boolean workingEnabled = true;
Expand Down Expand Up @@ -1227,7 +1226,7 @@ public void deserializeNBT(@NotNull NBTTagCompound compound) {
this.maxProgressTime = compound.getInteger("MaxProgress");
this.recipeEUt = compound.getLong("RecipeEUt");
NBTTagList itemOutputsList = compound.getTagList("ItemOutputs", Constants.NBT.TAG_COMPOUND);
this.itemOutputs = NonNullList.create();
this.itemOutputs = new ArrayList<>(itemOutputsList.tagCount());
for (int i = 0; i < itemOutputsList.tagCount(); i++) {
this.itemOutputs.add(new ItemStack(itemOutputsList.getCompoundTagAt(i)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.PacketBuffer;
import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraft.util.NonNullList;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
Expand All @@ -30,7 +29,6 @@
import org.jetbrains.annotations.Nullable;

import java.util.Collections;
import java.util.List;

import static gregtech.api.capability.GregtechDataCodes.BOILER_HEAT;
import static gregtech.api.capability.GregtechDataCodes.BOILER_LAST_TICK_STEAM;
Expand All @@ -51,7 +49,7 @@ public class BoilerRecipeLogic extends AbstractRecipeLogic implements ICategoryO
public BoilerRecipeLogic(MetaTileEntityLargeBoiler tileEntity) {
super(tileEntity, null);
this.fluidOutputs = Collections.emptyList();
this.itemOutputs = NonNullList.create();
this.itemOutputs = Collections.emptyList();
}

@Override
Expand Down Expand Up @@ -80,15 +78,14 @@ protected void trySearchNewRecipe() {
// can optimize with an override of checkPreviousRecipe() and a check here

IMultipleTankHandler importFluids = boiler.getImportFluids();
List<ItemStack> dummyList = NonNullList.create();
boolean didStartRecipe = false;

for (IFluidTank fluidTank : importFluids.getFluidTanks()) {
FluidStack fuelStack = fluidTank.drain(Integer.MAX_VALUE, false);
if (fuelStack == null || CommonFluidFilters.BOILER_FLUID.test(fuelStack)) continue;

Recipe dieselRecipe = RecipeMaps.COMBUSTION_GENERATOR_FUELS.findRecipe(
GTValues.V[GTValues.MAX], dummyList, Collections.singletonList(fuelStack));
GTValues.V[GTValues.MAX], Collections.emptyList(), Collections.singletonList(fuelStack));
// run only if it can apply a certain amount of "parallel", this is to mitigate int division
if (dieselRecipe != null &&
fuelStack.amount >= dieselRecipe.getFluidInputs().get(0).getAmount() * FLUID_DRAIN_MULTIPLIER) {
Expand All @@ -102,7 +99,7 @@ protected void trySearchNewRecipe() {
}

Recipe denseFuelRecipe = RecipeMaps.SEMI_FLUID_GENERATOR_FUELS.findRecipe(
GTValues.V[GTValues.MAX], dummyList, Collections.singletonList(fuelStack));
GTValues.V[GTValues.MAX], Collections.emptyList(), Collections.singletonList(fuelStack));
// run only if it can apply a certain amount of "parallel", this is to mitigate int division
if (denseFuelRecipe != null &&
fuelStack.amount >= denseFuelRecipe.getFluidInputs().get(0).getAmount() * FLUID_DRAIN_MULTIPLIER) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public void performMining() {
blockState = metaTileEntity.getWorld().getBlockState(blocksToMine.getFirst());
}
// When we are here we have an ore to mine! I'm glad we aren't threaded
if (!blocksToMine.isEmpty() & GTUtility.isOre(GTUtility.toItem(blockState))) {
if (!blocksToMine.isEmpty() && GTUtility.isOre(GTUtility.toItem(blockState))) {
// get the small ore drops, if a small ore
getSmallOreBlockDrops(blockDrops, world, blocksToMine.getFirst(), blockState);
// get the block's drops.
Expand Down Expand Up @@ -280,7 +280,7 @@ protected void getRegularBlockDrops(NonNullList<ItemStack> blockDrops, WorldServ
* @param blockDrops the List of items to insert
* @param world the {@link WorldServer} the miner is in
*/
private void mineAndInsertItems(NonNullList<ItemStack> blockDrops, WorldServer world) {
private void mineAndInsertItems(List<ItemStack> blockDrops, WorldServer world) {
// If the block's drops can fit in the inventory, move the previously mined position to the block
// replace the ore block with cobblestone instead of breaking it to prevent mob spawning
// remove the ore block's position from the mining queue
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/gregtech/api/cover/CoverBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.NonNullList;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.items.IItemHandlerModifiable;
Expand All @@ -21,6 +20,9 @@
import codechicken.lib.vec.Matrix4;
import org.jetbrains.annotations.NotNull;

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

public abstract class CoverBase implements Cover {

private final CoverDefinition definition;
Expand Down Expand Up @@ -55,7 +57,7 @@ public CoverBase(@NotNull CoverDefinition definition, @NotNull CoverableView cov
* @param inventory the inventory to clear
*/
protected void dropInventoryContents(@NotNull IItemHandlerModifiable inventory) {
NonNullList<ItemStack> drops = NonNullList.create();
List<ItemStack> drops = new ArrayList<>();
MetaTileEntity.clearInventory(drops, inventory);
for (ItemStack itemStack : drops) {
Block.spawnAsEntity(getWorld(), getPos(), itemStack);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,14 @@
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.NonNullList;

import com.google.common.collect.Lists;

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

public abstract class FakeModularGuiContainer implements WidgetUIAccess {

protected final NonNullList<ItemStack> inventoryItemStacks = NonNullList.create();
public final List<Slot> inventorySlots = Lists.newArrayList();
protected final List<ItemStack> inventoryItemStacks = new ArrayList<>();
public final List<Slot> inventorySlots = new ArrayList<>();
public final ModularUI modularUI;
protected int windowId;

Expand Down
7 changes: 4 additions & 3 deletions src/main/java/gregtech/api/metatileentity/MetaTileEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,7 @@ private void updateSound() {
* @param dropsList list of meta tile entity drops
* @param harvester harvester of this meta tile entity, or null
*/
public void getDrops(NonNullList<ItemStack> dropsList, @Nullable EntityPlayer harvester) {}
public void getDrops(@NotNull List<@NotNull ItemStack> dropsList, @Nullable EntityPlayer harvester) {}

public final ItemStack getPickItem(CuboidRayTraceResult result, EntityPlayer player) {
IndexedCuboid6 hitCuboid = result.cuboid6;
Expand Down Expand Up @@ -1321,12 +1321,13 @@ public boolean isValid() {
return getHolder() != null && getHolder().isValid();
}

public void clearMachineInventory(NonNullList<ItemStack> itemBuffer) {
public void clearMachineInventory(@NotNull List<@NotNull ItemStack> itemBuffer) {
clearInventory(itemBuffer, importItems);
clearInventory(itemBuffer, exportItems);
}

public static void clearInventory(NonNullList<ItemStack> itemBuffer, IItemHandlerModifiable inventory) {
public static void clearInventory(@NotNull List<@NotNull ItemStack> itemBuffer,
@NotNull IItemHandlerModifiable inventory) {
for (int i = 0; i < inventory.getSlots(); i++) {
ItemStack stackInSlot = inventory.getStackInSlot(i);
if (!stackInSlot.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.world.World;
Expand Down Expand Up @@ -475,7 +474,7 @@ public boolean isAllowInputFromOutputSideFluids() {
}

@Override
public void clearMachineInventory(NonNullList<ItemStack> itemBuffer) {
public void clearMachineInventory(@NotNull List<@NotNull ItemStack> itemBuffer) {
super.clearMachineInventory(itemBuffer);
clearInventory(itemBuffer, chargerInventory);
}
Expand Down
Loading

0 comments on commit c92a04a

Please sign in to comment.