Skip to content

Commit

Permalink
Merge branch 'GregTechCEu:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
marisathewitch authored Dec 17, 2023
2 parents 9ef63f9 + 90820e6 commit cdd1c66
Show file tree
Hide file tree
Showing 33 changed files with 533 additions and 98 deletions.
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
1 change: 1 addition & 0 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,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
17 changes: 16 additions & 1 deletion 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.3-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 @@ -120,6 +123,7 @@ curseForgeProjectId =
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
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
}
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
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 @@ -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
50 changes: 49 additions & 1 deletion src/main/java/gregtech/api/items/toolitem/IGTTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.item.EntityMinecart;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.EntityEquipmentSlot;
Expand Down Expand Up @@ -68,6 +69,8 @@
import forestry.api.arboriculture.IToolGrafter;
import it.unimi.dsi.fastutil.objects.Object2IntMap;
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
import mods.railcraft.api.items.IToolCrowbar;
import mrtjp.projectred.api.IScrewdriver;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

Expand All @@ -91,10 +94,12 @@
@Optional.Interface(modid = GTValues.MODID_COFH, iface = "cofh.api.item.IToolHammer"),
@Optional.Interface(modid = GTValues.MODID_EIO, iface = "crazypants.enderio.api.tool.ITool"),
@Optional.Interface(modid = GTValues.MODID_FR, iface = "forestry.api.arboriculture.IToolGrafter"),
@Optional.Interface(modid = GTValues.MODID_PROJRED_CORE, iface = "mrtjp.projectred.api.IScrewdriver"),
@Optional.Interface(modid = GTValues.MODID_RC, iface = "mods.railcraft.api.items.IToolCrowbar"),
@Optional.Interface(modid = GTValues.MODID_ECORE,
iface = "com.enderio.core.common.interfaces.IOverlayRenderAware") })
public interface IGTTool extends ItemUIFactory, IAEWrench, IToolWrench, IToolHammer, ITool, IToolGrafter,
IOverlayRenderAware {
IOverlayRenderAware, IScrewdriver, IToolCrowbar {

/**
* @return the modid of the tool
Expand Down Expand Up @@ -1042,4 +1047,47 @@ default float getSaplingModifier(ItemStack stack, World world, EntityPlayer play
default void renderItemOverlayIntoGUI(@NotNull ItemStack stack, int xPosition, int yPosition) {
ToolChargeBarRenderer.renderBarsTool(this, stack, xPosition, yPosition);
}

// IScrewdriver
@Override
default boolean canUse(EntityPlayer player, ItemStack stack) {
return get().getToolClasses(stack).contains(ToolClasses.SCREWDRIVER);
}

@Override
default void damageScrewdriver(EntityPlayer player, ItemStack stack) {
damageItem(stack, player);
}

// IToolCrowbar

@Override
default boolean canWhack(EntityPlayer player, EnumHand hand, ItemStack crowbar, BlockPos pos) {
return get().getToolClasses(crowbar).contains(ToolClasses.CROWBAR);
}

@Override
default void onWhack(EntityPlayer player, EnumHand hand, ItemStack crowbar, BlockPos pos) {
damageItem(crowbar, player);
}

@Override
default boolean canLink(EntityPlayer player, EnumHand hand, ItemStack crowbar, EntityMinecart cart) {
return get().getToolClasses(crowbar).contains(ToolClasses.CROWBAR);
}

@Override
default void onLink(EntityPlayer player, EnumHand hand, ItemStack crowbar, EntityMinecart cart) {
damageItem(crowbar, player);
}

@Override
default boolean canBoost(EntityPlayer player, EnumHand hand, ItemStack crowbar, EntityMinecart cart) {
return get().getToolClasses(crowbar).contains(ToolClasses.CROWBAR);
}

@Override
default void onBoost(EntityPlayer player, EnumHand hand, ItemStack crowbar, EntityMinecart cart) {
damageItem(crowbar, player);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ public boolean isMufflerFaceFree() {
}

/**
* @deprecated Use {@link gregtech.client.particle.VanillaParticleEffects#MUFFLER_SMOKE} instead.
* @deprecated Override {@link #getMufflerParticle()} instead.
*/
@ApiStatus.ScheduledForRemoval(inVersion = "2.9")
@Deprecated
Expand All @@ -284,6 +284,11 @@ public void runMufflerEffect(float xPos, float yPos, float zPos, float xSpd, flo
getWorld().spawnParticle(EnumParticleTypes.SMOKE_LARGE, xPos, yPos, zPos, xSpd, ySpd, zSpd);
}

@SideOnly(Side.CLIENT)
public @NotNull EnumParticleTypes getMufflerParticle() {
return EnumParticleTypes.SMOKE_LARGE;
}

/**
* Sets the recovery items of this multiblock
*
Expand Down
Loading

0 comments on commit cdd1c66

Please sign in to comment.