Skip to content

Commit

Permalink
Merge branch 'master' into miner
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/main/java/gregtech/common/metatileentities/MetaTileEntities.java
  • Loading branch information
Tictim committed Dec 21, 2023
2 parents 6de4916 + c4060fa commit 5abe237
Show file tree
Hide file tree
Showing 137 changed files with 4,951 additions and 2,093 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ ij_java_keep_first_column_comment = false
ij_java_keep_indents_on_empty_lines = false
ij_java_keep_line_breaks = true
ij_java_keep_multiple_expressions_in_one_line = false
ij_java_keep_simple_blocks_in_one_line = false
ij_java_keep_simple_blocks_in_one_line = true
ij_java_keep_simple_classes_in_one_line = true
ij_java_keep_simple_lambdas_in_one_line = true
ij_java_keep_simple_methods_in_one_line = true
Expand Down
12 changes: 9 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//version: 1701739812
//version: 1702244235
/*
* DO NOT CHANGE THIS FILE!
* Also, you may replace this file at any time if there is an update available.
Expand Down Expand Up @@ -79,6 +79,7 @@ propertyDefaultIfUnset("curseForgeRelations", "")
propertyDefaultIfUnsetWithEnvVar("releaseType", "release", "RELEASE_TYPE")
propertyDefaultIfUnset("generateDefaultChangelog", false)
propertyDefaultIfUnset("customMavenPublishUrl", "")
propertyDefaultIfUnset("mavenArtifactGroup", getDefaultArtifactGroup())
propertyDefaultIfUnset("enableModernJavaSyntax", false)
propertyDefaultIfUnset("enableSpotless", false)
propertyDefaultIfUnset("enableJUnit", false)
Expand Down Expand Up @@ -984,8 +985,8 @@ if (customMavenPublishUrl) {
}

// providers is not available here, use System for getting env vars
groupId = System.getenv('ARTIFACT_GROUP_ID') ?: project.group
artifactId = System.getenv('ARTIFACT_ID') ?: project.name
groupId = System.getenv('ARTIFACT_GROUP_ID') ?: project.mavenArtifactGroup
artifactId = System.getenv('ARTIFACT_ID') ?: project.modArchivesBaseName
version = System.getenv('RELEASE_VERSION') ?: publishedVersion
}
}
Expand Down Expand Up @@ -1130,6 +1131,11 @@ tasks.register('faq') {

// Helpers

def getDefaultArtifactGroup() {
def lastIndex = project.modGroup.lastIndexOf('.')
return lastIndex < 0 ? project.modGroup : project.modGroup.substring(0, lastIndex)
}

def getFile(String relativePath) {
return new File(projectDir, relativePath)
}
Expand Down
4 changes: 3 additions & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@ dependencies {
// the CCL deobf jar uses very old MCP mappings, making it error at runtime in runClient/runServer
// therefore we manually deobf the regular jar
implementation rfg.deobf("curse.maven:codechicken-lib-1-8-242818:2779848") // CCL 3.2.3.358
implementation("com.cleanroommc:modularui:2.4.1") { transitive = false }

// Soft Dependencies
// Can change any of these from compileOnlyApi -> implementation to test them in-game.

implementation "CraftTweaker2:CraftTweaker2-MC1120-Main:1.12-4.1.20.684"
implementation rfg.deobf("curse.maven:ctm-267602:2915363") // CTM 1.0.2.31
implementation rfg.deobf("curse.maven:groovyscript-687577:4905039") // GRS 0.7.0
implementation("com.cleanroommc:groovyscript:0.7.1") { transitive = false }
implementation rfg.deobf("curse.maven:ae2-extended-life-570458:4402048") // AE2UEL 0.55.6

compileOnlyApi rfg.deobf("curse.maven:opencomputers-223008:4526246") // OpenComputers 1.8.0+9833087
Expand All @@ -41,6 +42,7 @@ dependencies {
compileOnlyApi rfg.deobf("curse.maven:hwyla-253449:2568751") // HWYLA 1.8.26-B41
compileOnlyApi rfg.deobf("curse.maven:baubles-227083:2518667") // Baubles 1.5.2
compileOnlyApi rfg.deobf("curse.maven:forestry-59751:2684780") // Forestry 5.8.2.387
compileOnlyApi rfg.deobf("curse.maven:chisel-235279:2915375") // Chisel 1.0.2.45

// Mods with Soft compat but which have no need to be in code, such as isModLoaded() checks and getModItem() recipes.
// Uncomment any of these to test them in-game.
Expand Down
19 changes: 17 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ modGroup = gregtech

# Version of your mod.
# This field can be left empty if you want your mod's version to be determined by the latest git tag instead.
modVersion = 2.8.2-beta
modVersion = 2.8.5-beta

# Whether to use the old jar naming structure (modid-mcversion-version) instead of the new version (modid-version)
includeMCVersionJar = true
Expand Down Expand Up @@ -52,6 +52,8 @@ accessTransformersFile = gregtech_at.cfg
usesMixins = false
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
mixinsPackage =
# 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!
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
coreModClass = asm.GregTechLoadingPlugin
Expand All @@ -75,6 +77,7 @@ includeWellKnownRepositories = true
# Overrides the above setting to be always true, as these repositories are needed to fetch the mods
includeCommonDevEnvMods = true


# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated in your jar. It is your
# responsibility check the licence and request permission for distribution, if required.
usesShadowedDependencies = false
Expand Down Expand Up @@ -117,9 +120,10 @@ curseForgeProjectId =
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
# and the name is the CurseForge project slug of the other mod.
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
curseForgeRelations = requiredDependency:codechicken-lib-1-8;incompatible:gregtechce
curseForgeRelations = requiredDependency:codechicken-lib-1-8;requiredDependency:modularui;requiredDependency:mixin-booter;incompatible:gregtechce

# This project's release type on CurseForge and/or Modrinth
# Alternatively this can be set with the 'RELEASE_TYPE' environment variable.
# Allowed types: release, beta, alpha
releaseType = beta

Expand All @@ -129,6 +133,17 @@ generateDefaultChangelog = false

# Prevent the source code from being published
noPublishedSources = false
# Publish to a custom maven location. Follows a few rules:
# Group ID can be set with the 'ARTIFACT_GROUP_ID' environment variable, default to 'project.group'
# Artifact ID can be set with the 'ARTIFACT_ID' environment variable, default to 'project.name'
# Version can be set with the 'RELEASE_VERSION' environment variable, default to 'modVersion'
# For maven credentials:
# Username is set with the 'MAVEN_USER' environment variable, default to "NONE"
# Password is set with the 'MAVEN_PASSWORD' environment variable, default to "NONE"
customMavenPublishUrl=
# The group for maven artifacts. Defaults to the 'project.modGroup' until the last '.' (if any).
# So 'mymod' becomes 'mymod' and 'com.myname.mymodid' 'becomes com.myname'
mavenArtifactGroup=

# Enable spotless checks
# Enforces code formatting on your source code
Expand Down
23 changes: 0 additions & 23 deletions src/api/java/forestry/api/arboriculture/IToolGrafter.java

This file was deleted.

78 changes: 78 additions & 0 deletions src/api/java/mods/railcraft/api/items/IToolCrowbar.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*------------------------------------------------------------------------------
Copyright (c) CovertJaguar, 2011-2020
This work (the API) is licensed under the "MIT" License,
see LICENSE.md for details.
-----------------------------------------------------------------------------*/
package mods.railcraft.api.items;

import net.minecraft.entity.item.EntityMinecart;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;

/**
* @author CovertJaguar <http://www.railcraft.info>
*/
public interface IToolCrowbar {
String ORE_TAG = "toolCrowbar";

/**
* Controls non-rotational interactions with blocks. Crowbar specific stuff.
* <p/>
* Rotational interaction is handled by the Block.rotateBlock() function,
* which should be called from the Item.onUseFirst() function of your tool.
*
* @param player the player
* @param crowbar the crowbar
* @param pos the block @return true if can whack a block
*/
boolean canWhack(EntityPlayer player, EnumHand hand, ItemStack crowbar, BlockPos pos);

/**
* Callback to do damage to the item.
*
* @param player the player
* @param crowbar the crowbar
* @param pos the block
*/
void onWhack(EntityPlayer player, EnumHand hand, ItemStack crowbar, BlockPos pos);

/**
* Controls whether you can link a cart.
*
* @param player the player
* @param crowbar the crowbar
* @param cart the cart @return true if can link a cart
*/
boolean canLink(EntityPlayer player, EnumHand hand, ItemStack crowbar, EntityMinecart cart);

/**
* Callback to do damage.
*
* @param player the player
* @param crowbar the crowbar
* @param cart the cart
*/
void onLink(EntityPlayer player, EnumHand hand, ItemStack crowbar, EntityMinecart cart);

/**
* Controls whether you can boost a cart.
*
* @param player the player
* @param crowbar the crowbar
* @param cart the cart @return true if can boost a cart
*/
boolean canBoost(EntityPlayer player, EnumHand hand, ItemStack crowbar, EntityMinecart cart);

/**
* Callback to do damage, boosting a cart usually does more damage than
* normal usage.
*
* @param player the player
* @param crowbar the crowbar
* @param cart the cart
*/
void onBoost(EntityPlayer player, EnumHand hand, ItemStack crowbar, EntityMinecart cart);
}
11 changes: 11 additions & 0 deletions src/api/java/mrtjp/projectred/api/IScrewdriver.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package mrtjp.projectred.api;

import net.minecraft.item.ItemStack;
import net.minecraft.entity.player.EntityPlayer;

public interface IScrewdriver {

boolean canUse(EntityPlayer player, ItemStack stack);

void damageScrewdriver(EntityPlayer player, ItemStack stack); // Damage the item on usage
}
22 changes: 15 additions & 7 deletions src/main/java/gregtech/GregTechMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
import gregtech.api.GTValues;
import gregtech.api.GregTechAPI;
import gregtech.api.modules.ModuleContainerRegistryEvent;
import gregtech.api.util.oreglob.OreGlob;
import gregtech.client.utils.BloomEffectUtil;
import gregtech.common.covers.filter.oreglob.impl.OreGlobParser;
import gregtech.modules.GregTechModules;
import gregtech.modules.ModuleManager;

Expand All @@ -15,16 +13,27 @@
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.event.*;
import net.minecraftforge.fml.common.event.FMLConstructionEvent;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLInterModComms;
import net.minecraftforge.fml.common.event.FMLLoadCompleteEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLServerAboutToStartEvent;
import net.minecraftforge.fml.common.event.FMLServerStartedEvent;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import net.minecraftforge.fml.common.event.FMLServerStoppedEvent;
import net.minecraftforge.fml.common.event.FMLServerStoppingEvent;

@Mod(modid = GTValues.MODID,
name = "GregTech",
acceptedMinecraftVersions = "[1.12.2,1.13)",
version = GTInternalTags.VERSION,
dependencies = "required:forge@[14.23.5.2847,);" + "required-after:codechickenlib@[3.2.3,);" +
"after:appliedenergistics2;" + "after:forestry;" + "after:extrabees;" + "after:extratrees;" +
"after:genetics;" + "after:magicbees;" + "after:jei@[4.15.0,);" + "after:crafttweaker@[4.1.20,);" +
"after:groovyscript@[0.7.0,);" + "after:theoneprobe;" + "after:hwyla;")
"required-after:modularui@[2.3,);" + "required-after:mixinbooter@[8.0,);" + "after:appliedenergistics2;" +
"after:forestry;" + "after:extrabees;" + "after:extratrees;" + "after:genetics;" + "after:magicbees;" +
"after:jei@[4.15.0,);" + "after:crafttweaker@[4.1.20,);" + "after:groovyscript@[0.7.0,);" +
"after:theoneprobe;" + "after:hwyla;")
public class GregTechMod {

// Hold this so that we can reference non-interface methods without
Expand All @@ -43,7 +52,6 @@ public GregTechMod() {
public void onConstruction(FMLConstructionEvent event) {
moduleManager = ModuleManager.getInstance();
GregTechAPI.moduleManager = moduleManager;
OreGlob.setCompiler(input -> new OreGlobParser(input).compile());
moduleManager.registerContainer(new GregTechModules());
MinecraftForge.EVENT_BUS.post(new ModuleContainerRegistryEvent());
moduleManager.setup(event.getASMHarvestedData(), Loader.instance().getConfigDir());
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/gregtech/api/GTValues.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,10 @@ public class GTValues {
MODID_ET = "extratrees",
MODID_GENETICS = "genetics",
MODID_BOP = "biomesoplenty",
MODID_TCON = "tconstruct";
MODID_TCON = "tconstruct",
MODID_PROJRED_CORE = "projectred-core",
MODID_RC = "railcraft",
MODID_CHISEL = "chisel";

private static Boolean isClient;

Expand Down
1 change: 1 addition & 0 deletions src/main/java/gregtech/api/GregTechAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public class GregTechAPI {

public static final GTControlledRegistry<ResourceLocation, MetaTileEntity> MTE_REGISTRY = new GTControlledRegistry<>(
Short.MAX_VALUE);
@Deprecated
public static final GTControlledRegistry<ResourceLocation, UIFactory> UI_FACTORY_REGISTRY = new GTControlledRegistry<>(
Short.MAX_VALUE);
public static final GTControlledRegistry<ResourceLocation, CoverDefinition> COVER_REGISTRY = new GTControlledRegistry<>(
Expand Down
4 changes: 0 additions & 4 deletions src/main/java/gregtech/api/capability/GregtechDataCodes.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ public static int assignId() {
// Drum
public static final int UPDATE_AUTO_OUTPUT = assignId();

// Safe
public static final int UPDATE_LOCKED_STATE = assignId();
public static final int UPDATE_CONTENTS_SEED = assignId();

// Steam Machines
public static final int NEEDS_VENTING = assignId();
public static final int VENTING_SIDE = assignId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -651,8 +651,7 @@ protected int[] calculateOverclock(@NotNull Recipe recipe) {
* @param recipe the recipe to overclock
* @return an int array of {OverclockedEUt, OverclockedDuration}
*/
@NotNull
protected int[] performOverclocking(@NotNull Recipe recipe) {
protected int @NotNull [] performOverclocking(@NotNull Recipe recipe) {
int[] values = { recipe.getEUt(), recipe.getDuration(), getNumberOfOCs(recipe.getEUt()) };
modifyOverclockPre(values, recipe.getRecipePropertyStorage());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,16 +157,16 @@ private boolean handleElectricItem(IElectricItem electricItem) {
// Check if the item is a battery (or similar), and if we can receive some amount of energy
if (electricItem.canProvideChargeExternally() && getEnergyCanBeInserted() > 0) {

// Drain from the battery if we are below half energy capacity, and if the tier matches
if (chargePercent <= 0.5 && chargeTier == machineTier) {
// Drain from the battery if we are below 1/3rd energy capacity, and if the tier matches
if (chargePercent <= 0.33 && chargeTier == machineTier) {
long dischargedBy = electricItem.discharge(getEnergyCanBeInserted(), machineTier, false, true, false);
addEnergy(dischargedBy);
return dischargedBy > 0L;
}
}

// Else, check if we have above 50% power
if (chargePercent > 0.5) {
// Else, check if we have above 2/3rds charge
if (chargePercent > 0.66) {
long chargedBy = electricItem.charge(getEnergyStored(), chargeTier, false, false);
removeEnergy(chargedBy);
return chargedBy > 0;
Expand All @@ -178,7 +178,7 @@ private boolean handleForgeEnergyItem(IEnergyStorage energyStorage) {
int machineTier = GTUtility.getTierByVoltage(Math.max(getInputVoltage(), getOutputVoltage()));
double chargePercent = getEnergyStored() / (getEnergyCapacity() * 1.0);

if (chargePercent > 0.5) {
if (chargePercent > 0.66) { // 2/3rds full
long chargedBy = FeCompat.insertEu(energyStorage, GTValues.V[machineTier]);
removeEnergy(chargedBy);
return chargedBy > 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
import net.minecraftforge.fluids.capability.IFluidHandler;
import net.minecraftforge.fluids.capability.IFluidTankProperties;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public class FluidHandlerDelegate implements IFluidHandler {

public final IFluidHandler delegate;

public FluidHandlerDelegate(IFluidHandler delegate) {
public FluidHandlerDelegate(@NotNull IFluidHandler delegate) {
this.delegate = delegate;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ protected boolean prepareRecipeDistinct(Recipe recipe) {
}

@Override
protected void modifyOverclockPre(@NotNull int[] values, @NotNull IRecipePropertyStorage storage) {
protected void modifyOverclockPre(int @NotNull [] values, @NotNull IRecipePropertyStorage storage) {
super.modifyOverclockPre(values, storage);

// apply maintenance bonuses
Expand Down
1 change: 1 addition & 0 deletions src/main/java/gregtech/api/cover/CoverUIFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;

@Deprecated
public final class CoverUIFactory extends UIFactory<CoverWithUI> {

public static final CoverUIFactory INSTANCE = new CoverUIFactory();
Expand Down
Loading

0 comments on commit 5abe237

Please sign in to comment.