Skip to content

Commit

Permalink
Merge branch 'GregTechCEu:master' into update_ja_jp/2.7.4+
Browse files Browse the repository at this point in the history
  • Loading branch information
MrKono authored Nov 26, 2023
2 parents 4b3f351 + d0c1700 commit 4873f65
Show file tree
Hide file tree
Showing 1,409 changed files with 27,007 additions and 16,604 deletions.
461 changes: 419 additions & 42 deletions .editorconfig

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions .github/workflows/pr_testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,26 @@ jobs:
jdks
notifications
wrapper
Formatting:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'

- name: Run Spotless
uses: gradle/gradle-build-action@v2
with:
arguments: 'spotlessCheck --build-cache'
gradle-home-cache-includes: |
caches
jdks
notifications
wrapper
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ noPublishedSources = false
# By default this will use the files found here: https://github.com/GregTechCEu/Buildscripts/tree/master/spotless
# to format your code. However, you can create your own version of these files and place them in your project's
# root directory to apply your own formatting options instead.
enableSpotless = false
enableSpotless = true

# Enable JUnit testing platform used for testing your code.
# Uses JUnit 5. See guide and documentation here: https://junit.org/junit5/docs/current/user-guide/
Expand Down
9 changes: 9 additions & 0 deletions spotless.importorder
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#Organize Import Order
#Sat May 27 02:13:47 CDT 2023
0=gregtech
1=net
2=codechickenlib
2=
3=java
4=javax
5=\#
24 changes: 8 additions & 16 deletions src/main/java/gregtech/GregTechMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import gregtech.common.covers.filter.oreglob.impl.OreGlobParser;
import gregtech.modules.GregTechModules;
import gregtech.modules.ModuleManager;

import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fml.common.FMLCommonHandler;
Expand All @@ -17,22 +18,13 @@
import net.minecraftforge.fml.common.event.*;

@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.6.0,);"
+ "after:theoneprobe;"
+ "after:hwyla;")
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.6.0,);" + "after:theoneprobe;" + "after:hwyla;")
public class GregTechMod {

// Hold this so that we can reference non-interface methods without
Expand Down
32 changes: 21 additions & 11 deletions src/main/java/gregtech/api/GTValues.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import gregtech.api.util.XSTR;
import gregtech.common.ConfigHolder;

import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.relauncher.FMLLaunchHandler;
import net.minecraftforge.oredict.OreDictionary;
Expand Down Expand Up @@ -50,22 +51,26 @@ public class GTValues {
/**
* The Voltage Tiers. Use this Array instead of the old named Voltage Variables
*/
public static final long[] V = {8, 32, 128, 512, 2048, 8192, 32768, 131072, 524288, 2097152, 8388608, 33554432, 134217728, 536870912, Integer.MAX_VALUE};
public static final long[] V = { 8, 32, 128, 512, 2048, 8192, 32768, 131072, 524288, 2097152, 8388608, 33554432,
134217728, 536870912, Integer.MAX_VALUE };

/**
* The Voltage Tiers divided by 2.
*/
public static final int[] VH = {4, 16, 64, 256, 1024, 4096, 16384, 65536, 262144, 1048576, 4194304, 16777216, 67108864, 268435456, 1073741824};
public static final int[] VH = { 4, 16, 64, 256, 1024, 4096, 16384, 65536, 262144, 1048576, 4194304, 16777216,
67108864, 268435456, 1073741824 };

/**
* The Voltage Tiers adjusted for cable loss. Use this for recipe EU/t to avoid full-amp recipes
*/
public static final int[] VA = {7, 30, 120, 480, 1920, 7680, 30720, 122880, 491520, 1966080, 7864320, 31457280, 125829120, 503316480, 2013265920};
public static final int[] VA = { 7, 30, 120, 480, 1920, 7680, 30720, 122880, 491520, 1966080, 7864320, 31457280,
125829120, 503316480, 2013265920 };

/**
* The Voltage Tiers adjusted for cable loss, divided by 2.
*/
public static final int[] VHA = {7, 16, 60, 240, 960, 3840, 15360, 61440, 245760, 983040, 3932160, 15728640, 62914560, 251658240, 1006632960};
public static final int[] VHA = { 7, 16, 60, 240, 960, 3840, 15360, 61440, 245760, 983040, 3932160, 15728640,
62914560, 251658240, 1006632960 };

public static final int ULV = 0;
public static final int LV = 1;
Expand All @@ -87,28 +92,32 @@ public class GTValues {
/**
* The short names for the voltages, used for registration primarily
*/
public static final String[] VN = new String[]{"ULV", "LV", "MV", "HV", "EV", "IV", "LuV", "ZPM", "UV", "UHV", "UEV", "UIV", "UXV", "OpV", "MAX"};
public static final String[] VN = new String[] { "ULV", "LV", "MV", "HV", "EV", "IV", "LuV", "ZPM", "UV", "UHV",
"UEV", "UIV", "UXV", "OpV", "MAX" };

/**
* The short names for the voltages, formatted for text
*/
public static final String[] VNF = new String[]{
public static final String[] VNF = new String[] {
DARK_GRAY + "ULV", GRAY + "LV", AQUA + "MV",
GOLD + "HV", DARK_PURPLE + "EV", DARK_BLUE + "IV",
LIGHT_PURPLE + "LuV", RED + "ZPM", DARK_AQUA + "UV",
DARK_RED + "UHV", GREEN + "UEV", DARK_GREEN + "UIV",
YELLOW + "UXV", BLUE + "OpV", RED.toString() + BOLD + "MAX"};
YELLOW + "UXV", BLUE + "OpV", RED.toString() + BOLD + "MAX" };

/**
* Color values for the voltages
*/
public static final int[] VC = new int[]{0xC80000, 0xDCDCDC, 0xFF6400, 0xFFFF1E, 0x808080, 0xF0F0F5, 0xE99797, 0x7EC3C4, 0x7EB07E, 0xBF74C0, 0x0B5CFE, 0x914E91, 0x488748, 0x8C0000, 0x2828F5};
public static final int[] VC = new int[] { 0xC80000, 0xDCDCDC, 0xFF6400, 0xFFFF1E, 0x808080, 0xF0F0F5, 0xE99797,
0x7EC3C4, 0x7EB07E, 0xBF74C0, 0x0B5CFE, 0x914E91, 0x488748, 0x8C0000, 0x2828F5 };

/**
* The long names for the voltages
*/
public static final String[] VOLTAGE_NAMES = new String[]{"Ultra Low Voltage", "Low Voltage", "Medium Voltage", "High Voltage", "Extreme Voltage", "Insane Voltage", "Ludicrous Voltage", "ZPM Voltage", "Ultimate Voltage",
"Ultra High Voltage", "Ultra Excessive Voltage", "Ultra Immense Voltage", "Ultra Extreme Voltage", "Overpowered Voltage", "Maximum Voltage"};
public static final String[] VOLTAGE_NAMES = new String[] { "Ultra Low Voltage", "Low Voltage", "Medium Voltage",
"High Voltage", "Extreme Voltage", "Insane Voltage", "Ludicrous Voltage", "ZPM Voltage", "Ultimate Voltage",
"Ultra High Voltage", "Ultra Excessive Voltage", "Ultra Immense Voltage", "Ultra Extreme Voltage",
"Overpowered Voltage", "Maximum Voltage" };

/**
* ModID strings, since they are quite common parameters
Expand Down Expand Up @@ -175,6 +184,7 @@ public static boolean isDeobfEnvironment() {

public static Supplier<Boolean> XMAS = () -> {
String[] yearMonthDay = LocalDate.now().toString().split("-");
return ConfigHolder.misc.specialEvents && yearMonthDay[1].equals("12") && (yearMonthDay[2].equals("24") || yearMonthDay[2].equals("25"));
return ConfigHolder.misc.specialEvents && yearMonthDay[1].equals("12") &&
(yearMonthDay[2].equals("24") || yearMonthDay[2].equals("25"));
};
}
51 changes: 28 additions & 23 deletions src/main/java/gregtech/api/GregTechAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,16 @@
import gregtech.common.items.MetaItems;
import gregtech.common.items.ToolItems;
import gregtech.common.metatileentities.MetaTileEntities;
import it.unimi.dsi.fastutil.objects.Object2ObjectMap;
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;

import net.minecraft.block.state.IBlockState;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.eventhandler.GenericEvent;

import it.unimi.dsi.fastutil.objects.Object2ObjectMap;
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;

import java.util.HashMap;
import java.util.Map;

Expand All @@ -63,31 +65,34 @@ public class GregTechAPI {
private static boolean highTier;
private static boolean highTierInitialized;

public static final GTControlledRegistry<ResourceLocation, MetaTileEntity> MTE_REGISTRY = new GTControlledRegistry<>(Short.MAX_VALUE);
public static final GTControlledRegistry<ResourceLocation, UIFactory> UI_FACTORY_REGISTRY = new GTControlledRegistry<>(Short.MAX_VALUE);
public static final GTControlledRegistry<ResourceLocation, CoverDefinition> COVER_REGISTRY = new GTControlledRegistry<>(Integer.MAX_VALUE);
public static final GTControlledRegistry<ResourceLocation, MetaTileEntity> MTE_REGISTRY = new GTControlledRegistry<>(
Short.MAX_VALUE);
public static final GTControlledRegistry<ResourceLocation, UIFactory> UI_FACTORY_REGISTRY = new GTControlledRegistry<>(
Short.MAX_VALUE);
public static final GTControlledRegistry<ResourceLocation, CoverDefinition> COVER_REGISTRY = new GTControlledRegistry<>(
Integer.MAX_VALUE);

public static BlockMachine MACHINE;
public static final Map<Material, Map<StoneType, IBlockOre>> oreBlockTable = new HashMap<>();
public static final Object2ObjectMap<IBlockState, IHeatingCoilBlockStats> HEATING_COILS = new Object2ObjectOpenHashMap<>();
public static final Object2ObjectMap<IBlockState, IBatteryData> PSS_BATTERIES = new Object2ObjectOpenHashMap<>();

public static final BaseCreativeTab TAB_GREGTECH =
new BaseCreativeTab(GTValues.MODID + ".main", () -> MetaItems.LOGO.getStackForm(), true);
public static final BaseCreativeTab TAB_GREGTECH_MACHINES =
new BaseCreativeTab(GTValues.MODID + ".machines", () -> MetaTileEntities.ELECTRIC_BLAST_FURNACE.getStackForm(), true);
public static final BaseCreativeTab TAB_GREGTECH_CABLES =
new BaseCreativeTab(GTValues.MODID + ".cables", () -> OreDictUnifier.get(OrePrefix.cableGtDouble, Materials.Aluminium), true);
public static final BaseCreativeTab TAB_GREGTECH_PIPES =
new BaseCreativeTab(GTValues.MODID + ".pipes", () -> OreDictUnifier.get(OrePrefix.pipeNormalFluid, Materials.Aluminium), true);
public static final BaseCreativeTab TAB_GREGTECH_TOOLS =
new BaseCreativeTab(GTValues.MODID + ".tools", () -> ToolItems.HARD_HAMMER.get(Materials.Aluminium), true);
public static final BaseCreativeTab TAB_GREGTECH_MATERIALS =
new BaseCreativeTab(GTValues.MODID + ".materials", () -> OreDictUnifier.get(OrePrefix.ingot, Materials.Aluminium), true);
public static final BaseCreativeTab TAB_GREGTECH_ORES =
new BaseCreativeTab(GTValues.MODID + ".ores", () -> OreDictUnifier.get(OrePrefix.ore, Materials.Aluminium), true);
public static final BaseCreativeTab TAB_GREGTECH_DECORATIONS =
new BaseCreativeTab(GTValues.MODID + ".decorations", () -> MetaBlocks.WARNING_SIGN.getItemVariant(BlockWarningSign.SignType.YELLOW_STRIPES), true);
public static final BaseCreativeTab TAB_GREGTECH = new BaseCreativeTab(GTValues.MODID + ".main",
() -> MetaItems.LOGO.getStackForm(), true);
public static final BaseCreativeTab TAB_GREGTECH_MACHINES = new BaseCreativeTab(GTValues.MODID + ".machines",
() -> MetaTileEntities.ELECTRIC_BLAST_FURNACE.getStackForm(), true);
public static final BaseCreativeTab TAB_GREGTECH_CABLES = new BaseCreativeTab(GTValues.MODID + ".cables",
() -> OreDictUnifier.get(OrePrefix.cableGtDouble, Materials.Aluminium), true);
public static final BaseCreativeTab TAB_GREGTECH_PIPES = new BaseCreativeTab(GTValues.MODID + ".pipes",
() -> OreDictUnifier.get(OrePrefix.pipeNormalFluid, Materials.Aluminium), true);
public static final BaseCreativeTab TAB_GREGTECH_TOOLS = new BaseCreativeTab(GTValues.MODID + ".tools",
() -> ToolItems.HARD_HAMMER.get(Materials.Aluminium), true);
public static final BaseCreativeTab TAB_GREGTECH_MATERIALS = new BaseCreativeTab(GTValues.MODID + ".materials",
() -> OreDictUnifier.get(OrePrefix.ingot, Materials.Aluminium), true);
public static final BaseCreativeTab TAB_GREGTECH_ORES = new BaseCreativeTab(GTValues.MODID + ".ores",
() -> OreDictUnifier.get(OrePrefix.ore, Materials.Aluminium), true);
public static final BaseCreativeTab TAB_GREGTECH_DECORATIONS = new BaseCreativeTab(GTValues.MODID + ".decorations",
() -> MetaBlocks.WARNING_SIGN.getItemVariant(BlockWarningSign.SignType.YELLOW_STRIPES), true);

/** Will be available at the Pre-Initialization stage */
public static boolean isHighTier() {
Expand Down Expand Up @@ -123,8 +128,8 @@ public void register(int id, ResourceLocation key, V value) {
}

public void register(int id, String key, V value) {
if (registry != null) registry.register(id, new ResourceLocation(Loader.instance().activeModContainer().getModId(), key), value);
if (registry != null) registry.register(id,
new ResourceLocation(Loader.instance().activeModContainer().getModId(), key), value);
}
}

}
1 change: 1 addition & 0 deletions src/main/java/gregtech/api/GregTechAPIInternal.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

/**
* If you're an addon looking in here, you're probably in the wrong place.
*
* @see GregTechAPI
*/
public final class GregTechAPIInternal {
Expand Down
32 changes: 21 additions & 11 deletions src/main/java/gregtech/api/block/BlockCustomParticle.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package gregtech.api.block;

import codechicken.lib.vec.Vector3;
import gregtech.api.GregTechAPI;
import gregtech.api.util.ParticleHandlerUtil;
import gregtech.core.network.NetworkUtils;
import gregtech.core.network.packets.PacketBlockParticle;
import gregtech.api.util.ParticleHandlerUtil;

import net.minecraft.block.Block;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
Expand All @@ -19,6 +19,8 @@
import net.minecraft.world.WorldServer;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import codechicken.lib.vec.Vector3;
import org.apache.commons.lang3.tuple.Pair;

import javax.annotation.Nonnull;
Expand All @@ -38,29 +40,35 @@ public BlockCustomParticle(Material materialIn) {

@Override
@SideOnly(Side.CLIENT)
public boolean addHitEffects(@Nonnull IBlockState state, @Nonnull World worldObj, RayTraceResult target, @Nonnull ParticleManager manager) {
public boolean addHitEffects(@Nonnull IBlockState state, @Nonnull World worldObj, RayTraceResult target,
@Nonnull ParticleManager manager) {
Pair<TextureAtlasSprite, Integer> atlasSprite = getParticleTexture(worldObj, target.getBlockPos());
ParticleHandlerUtil.addHitEffects(state, worldObj, target, atlasSprite.getLeft(), atlasSprite.getRight(), manager);
ParticleHandlerUtil.addHitEffects(state, worldObj, target, atlasSprite.getLeft(), atlasSprite.getRight(),
manager);
return true;
}

@Override
@SideOnly(Side.CLIENT)
public boolean addDestroyEffects(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull ParticleManager manager) {
Pair<TextureAtlasSprite, Integer> atlasSprite = getParticleTexture(world, pos);
ParticleHandlerUtil.addBlockDestroyEffects(world.getBlockState(pos), world, pos, atlasSprite.getLeft(), atlasSprite.getRight(), manager);
ParticleHandlerUtil.addBlockDestroyEffects(world.getBlockState(pos), world, pos, atlasSprite.getLeft(),
atlasSprite.getRight(), manager);
return true;
}

@Override
@SideOnly(Side.CLIENT)
public void handleCustomParticle(World worldObj, BlockPos blockPos, ParticleManager particleManager, Vector3 entityPos, int numberOfParticles) {
public void handleCustomParticle(World worldObj, BlockPos blockPos, ParticleManager particleManager,
Vector3 entityPos, int numberOfParticles) {
Pair<TextureAtlasSprite, Integer> atlasSprite = getParticleTexture(worldObj, blockPos);
ParticleHandlerUtil.addBlockLandingEffects(worldObj, entityPos, atlasSprite.getLeft(), atlasSprite.getRight(), particleManager, numberOfParticles);
ParticleHandlerUtil.addBlockLandingEffects(worldObj, entityPos, atlasSprite.getLeft(), atlasSprite.getRight(),
particleManager, numberOfParticles);
}

@Override
public boolean addRunningEffects(@Nonnull IBlockState state, World world, @Nonnull BlockPos pos, @Nonnull Entity entity) {
public boolean addRunningEffects(@Nonnull IBlockState state, World world, @Nonnull BlockPos pos,
@Nonnull Entity entity) {
if (world.isRemote) {
Pair<TextureAtlasSprite, Integer> atlasSprite = getParticleTexture(world, pos);
ParticleHandlerUtil.addBlockRunningEffects(world, entity, atlasSprite.getLeft(), atlasSprite.getRight());
Expand All @@ -69,9 +77,11 @@ public boolean addRunningEffects(@Nonnull IBlockState state, World world, @Nonnu
}

@Override
public boolean addLandingEffects(@Nonnull IBlockState state, @Nonnull WorldServer worldObj, @Nonnull BlockPos blockPosition, @Nonnull IBlockState iblockstate, EntityLivingBase entity, int numberOfParticles) {
PacketBlockParticle
packet = new PacketBlockParticle(blockPosition, new Vector3(entity.posX, entity.posY, entity.posZ), numberOfParticles);
public boolean addLandingEffects(@Nonnull IBlockState state, @Nonnull WorldServer worldObj,
@Nonnull BlockPos blockPosition, @Nonnull IBlockState iblockstate,
EntityLivingBase entity, int numberOfParticles) {
PacketBlockParticle packet = new PacketBlockParticle(blockPosition,
new Vector3(entity.posX, entity.posY, entity.posZ), numberOfParticles);
GregTechAPI.networkHandler.sendToAllTracking(packet, NetworkUtils.blockPoint(worldObj, blockPosition));
return true;
}
Expand Down
1 change: 0 additions & 1 deletion src/main/java/gregtech/api/block/BlockStateTileEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ public class BlockStateTileEntity extends TileEntity {
public IBlockState getBlockState() {
return getBlockType().getStateFromMeta(getBlockMetadata());
}

}
1 change: 0 additions & 1 deletion src/main/java/gregtech/api/block/BuiltInRenderBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,4 @@ public boolean isOpaqueCube(@Nonnull IBlockState state) {
public boolean isFullCube(@Nonnull IBlockState state) {
return false;
}

}
6 changes: 4 additions & 2 deletions src/main/java/gregtech/api/block/ICustomParticleBlock.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package gregtech.api.block;

import codechicken.lib.vec.Vector3;
import net.minecraft.client.particle.ParticleManager;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

import codechicken.lib.vec.Vector3;

public interface ICustomParticleBlock {

void handleCustomParticle(World worldObj, BlockPos blockPos, ParticleManager particleManager, Vector3 entityPos, int numberOfParticles);
void handleCustomParticle(World worldObj, BlockPos blockPos, ParticleManager particleManager, Vector3 entityPos,
int numberOfParticles);
}
1 change: 1 addition & 0 deletions src/main/java/gregtech/api/block/IStateHarvestLevel.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package gregtech.api.block;

import gregtech.api.items.toolitem.ToolClasses;

import net.minecraft.block.state.IBlockState;

public interface IStateHarvestLevel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import javax.annotation.Nonnull;

public class UnlistedBooleanProperty implements IUnlistedProperty<Boolean> {

private final String name;

public UnlistedBooleanProperty(@Nonnull String name) {
Expand Down
Loading

0 comments on commit 4873f65

Please sign in to comment.