Skip to content

Commit

Permalink
[ci skip] update buildscript, spotlessApply
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchej123 committed Oct 2, 2022
1 parent ccb8e28 commit ac10bab
Show file tree
Hide file tree
Showing 62 changed files with 3,182 additions and 2,473 deletions.
44 changes: 44 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
* text eol=lf

*.[jJ][aA][rR] binary

*.[pP][nN][gG] binary
*.[jJ][pP][gG] binary
*.[jJ][pP][eE][gG] binary
*.[gG][iI][fF] binary
*.[tT][iI][fF] binary
*.[tT][iI][fF][fF] binary
*.[iI][cC][oO] binary
*.[sS][vV][gG] text
*.[eE][pP][sS] binary
*.[xX][cC][fF] binary

*.[kK][aA][rR] binary
*.[mM]4[aA] binary
*.[mM][iI][dD] binary
*.[mM][iI][dD][iI] binary
*.[mM][pP]3 binary
*.[oO][gG][gG] binary
*.[rR][aA] binary

*.7[zZ] binary
*.[gG][zZ] binary
*.[tT][aA][rR] binary
*.[tT][gG][zZ] binary
*.[zZ][iI][pP] binary

*.[tT][cC][nN] binary
*.[sS][oO] binary
*.[dD][lL][lL] binary
*.[dD][yY][lL][iI][bB] binary
*.[pP][sS][dD] binary
*.[tT][tT][fF] binary
*.[oO][tT][fF] binary

*.[pP][aA][tT][cC][hH] -text

*.[bB][aA][tT] text eol=crlf
*.[cC][mM][dD] text eol=crlf
*.[pP][sS]1 text eol=crlf

*[aA][uU][tT][oO][gG][eE][nN][eE][rR][aA][tT][eE][dD]* binary
562 changes: 455 additions & 107 deletions build.gradle

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
plugins {
id 'com.diffplug.blowdryerSetup' version '1.6.0'
}

apply plugin: 'com.diffplug.blowdryerSetup'

blowdryerSetup {
github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.1.5')
//devLocal '.' // Use this when testing config updates locally
}
38 changes: 19 additions & 19 deletions src/main/java/com/sinthoras/hydroenergy/HE.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
package com.sinthoras.hydroenergy;

import static net.minecraft.util.EnumChatFormatting.*;

import com.sinthoras.hydroenergy.blocks.HEWaterStill;
import com.sinthoras.hydroenergy.client.gui.HEGuiHandler;
import com.sinthoras.hydroenergy.config.HEConfig;
import com.sinthoras.hydroenergy.fluids.HEPressurizedWater;
import cpw.mods.fml.common.network.IGuiHandler;
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import gregtech.api.enums.GT_Values;
import net.minecraft.item.ItemStack;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;

import static net.minecraft.util.EnumChatFormatting.*;

public class HE {

public static SimpleNetworkWrapper network;
Expand All @@ -25,29 +24,30 @@ public class HE {
public static final int chunkHeight = 16;
public static final int chunkDepth = 16;
public static final int blockPerSubChunk = chunkWidth * chunkHeight * chunkDepth;
public static final int underWaterSkylightDepth = (int)Math.ceil(16f / waterOpacity);
public static final int underWaterSkylightDepth = (int) Math.ceil(16f / waterOpacity);
public static final int controllerGuiUpdateDelay = 200;
public static final int bucketToMilliBucket = 1_000;
public static final int kiloBucketToMilliBucket = 1_000_000;

public static boolean logicalClientLoaded = false;
public static final String ERROR_serverIdsOutOfBounds = "Server uses invalid waterIds! Server message ignored. " +
"Please make sure your config \"maxControllers\" is at least as big as the server you are connecting to!";
public static final String WARN_clientConfigMissmatchDetected = "HydroEnergy: Configuration mismatch to the server " +
"found! This might crash somewhat randomly. Please talk to your server admin!";
public static final String blueprintHintTecTech = "To see the structure, use a "+ BLUE + "Tec" + DARK_BLUE + "Tech" + GRAY + " Blueprint on the Controller!";
public static final String ERROR_serverIdsOutOfBounds = "Server uses invalid waterIds! Server message ignored. "
+ "Please make sure your config \"maxControllers\" is at least as big as the server you are connecting to!";
public static final String WARN_clientConfigMissmatchDetected = "HydroEnergy: Configuration mismatch to the server "
+ "found! This might crash somewhat randomly. Please talk to your server admin!";
public static final String blueprintHintTecTech =
"To see the structure, use a " + BLUE + "Tec" + DARK_BLUE + "Tech" + GRAY + " Blueprint on the Controller!";

public static HEPressurizedWater pressurizedWater = new HEPressurizedWater();
public static final HEWaterStill[] waterBlocks = new HEWaterStill[HEConfig.maxDams];
public static final int[] waterBlockIds = new int[HEConfig.maxDams];
public static ItemStack hydroDamControllerBlock;
public static ItemStack[] hydroPumpBlocks = new ItemStack[GT_Values.VN.length - 1];
public static final HEWaterStill[] waterBlocks = new HEWaterStill[HEConfig.maxDams];
public static final int[] waterBlockIds = new int[HEConfig.maxDams];
public static ItemStack hydroDamControllerBlock;
public static ItemStack[] hydroPumpBlocks = new ItemStack[GT_Values.VN.length - 1];
public static ItemStack[] hydroTurbineBlocks = new ItemStack[GT_Values.VN.length - 1];

public static boolean DEBUGslowFill = false;
public static final IGuiHandler guiHandler = new HEGuiHandler();
public static boolean DEBUGslowFill = false;
public static final IGuiHandler guiHandler = new HEGuiHandler();

// Texture locations
// Texture locations
public static String damBackgroundLocation = "textures/gui/he_water_config.png";
public static String damLimitBackgroundLocation = "textures/gui/he_water_config_limits_popup.png";
// To silence the water missing texture error. Points to a random but valid texture
Expand Down Expand Up @@ -79,7 +79,7 @@ public enum DamMode {
SPREAD;

public int getValue() {
switch(this) {
switch (this) {
default:
case DRAIN:
return 1;
Expand All @@ -91,7 +91,7 @@ public int getValue() {
}

public static DamMode getMode(int mode) {
switch(mode) {
switch (mode) {
default:
case 1:
return DRAIN;
Expand Down
13 changes: 10 additions & 3 deletions src/main/java/com/sinthoras/hydroenergy/HEMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,25 @@
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.*;

@Mod(modid = HETags.MODID, version = HETags.VERSION, name = HETags.MODNAME, dependencies = HETags.DEPENDENCIES, acceptedMinecraftVersions = "[1.7.10]")
@Mod(
modid = HETags.MODID,
version = HETags.VERSION,
name = HETags.MODNAME,
dependencies = HETags.DEPENDENCIES,
acceptedMinecraftVersions = "[1.7.10]")
public class HEMod {

@SidedProxy(clientSide=HETags.GROUPNAME + ".hooks.HEHooksClient", serverSide=HETags.GROUPNAME + ".hooks.HEHooksShared")
@SidedProxy(
clientSide = HETags.GROUPNAME + ".hooks.HEHooksClient",
serverSide = HETags.GROUPNAME + ".hooks.HEHooksShared")
public static HEHooksShared proxy;

@Mod.EventHandler
// preInit "Run before anything else. Read your config, create blocks, items,
// etc. and register them with the GameRegistry."
public void fmlLifeCycleEvent(FMLPreInitializationEvent event) {
HE.debug("Registered sided proxy for: " + (proxy instanceof HEHooksClient ? "Client" : "Dedicated server"));
HE.debug("preInit()"+event.getModMetadata().name);
HE.debug("preInit()" + event.getModMetadata().name);
proxy.fmlLifeCycleEvent(event);
}

Expand Down
11 changes: 5 additions & 6 deletions src/main/java/com/sinthoras/hydroenergy/HETags.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
public class HETags {

// GRADLETOKEN_* will be replaced by your configuration values at build time
public static final String MODID = "GRADLETOKEN_MODID";
public static final String MODNAME = "GRADLETOKEN_MODNAME";
public static final String VERSION = "GRADLETOKEN_VERSION";
public static final String GROUPNAME = "GRADLETOKEN_GROUPNAME";
public static final String DEPENDENCIES = "required-after: gregtech;" +
"required-after: tectech@[5.0,)";
public static final String MODID = "GRADLETOKEN_MODID";
public static final String MODNAME = "GRADLETOKEN_MODNAME";
public static final String VERSION = "GRADLETOKEN_VERSION";
public static final String GROUPNAME = "GRADLETOKEN_GROUPNAME";
public static final String DEPENDENCIES = "required-after: gregtech;" + "required-after: tectech@[5.0,)";

public static final String waterLevel = "walv";
public static final String drainState = "drai";
Expand Down
108 changes: 54 additions & 54 deletions src/main/java/com/sinthoras/hydroenergy/HEUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,70 +4,70 @@

public class HEUtil {

public static int coordBlockToChunk(int blockCoord) {
return blockCoord < 0 ? -((-blockCoord - 1) >> 4) - 1 : blockCoord >> 4;
}
public static int coordBlockToChunk(int blockCoord) {
return blockCoord < 0 ? -((-blockCoord - 1) >> 4) - 1 : blockCoord >> 4;
}

public static int coordChunkToBlock(int chunkCoord) {
return chunkCoord < 0 ? -((-chunkCoord) << 4) : chunkCoord << 4;
}
public static int coordChunkToBlock(int chunkCoord) {
return chunkCoord < 0 ? -((-chunkCoord) << 4) : chunkCoord << 4;
}

public static long chunkCoordsToKey(int chunkX, int chunkZ) {
return (((long)chunkX) << 32) | (chunkZ & 0xffffffffL);
}
public static long chunkCoordsToKey(int chunkX, int chunkZ) {
return (((long) chunkX) << 32) | (chunkZ & 0xffffffffL);
}

public static int nonNegativeModulo(int value, int modulo) {
value = value % modulo;
if(value < 0) {
value += modulo;
}
return value;
}
public static int nonNegativeModulo(int value, int modulo) {
value = value % modulo;
if (value < 0) {
value += modulo;
}
return value;
}

public static float clamp(float value, float lowerLimit, float upperLimit) {
return Math.min(Math.max(value, lowerLimit), upperLimit);
}
public static float clamp(float value, float lowerLimit, float upperLimit) {
return Math.min(Math.max(value, lowerLimit), upperLimit);
}

public static int clamp(int value, int lowerLimit, int upperLimit) {
return Math.min(Math.max(value, lowerLimit), upperLimit);
}
public static int clamp(int value, int lowerLimit, int upperLimit) {
return Math.min(Math.max(value, lowerLimit), upperLimit);
}

public static long clamp(long value, long lowerLimit, long upperLimit) {
return Math.min(Math.max(value, lowerLimit), upperLimit);
}
public static long clamp(long value, long lowerLimit, long upperLimit) {
return Math.min(Math.max(value, lowerLimit), upperLimit);
}

public static short chunkYToFlag(int chunkY) {
return (short)(1 << chunkY);
}
public static short chunkYToFlag(int chunkY) {
return (short) (1 << chunkY);
}

public static int voltageNameToTierId(String voltageName) {
for(int tierId=0;tierId<GT_Values.VN.length-1;tierId++){
if(GT_Values.VN[tierId].equalsIgnoreCase(voltageName)) {
return tierId;
}
}
return -1;
}
public static int voltageNameToTierId(String voltageName) {
for (int tierId = 0; tierId < GT_Values.VN.length - 1; tierId++) {
if (GT_Values.VN[tierId].equalsIgnoreCase(voltageName)) {
return tierId;
}
}
return -1;
}

public static class AveragedRingBuffer {
private final float[] values;
private int pointer = 0;
private float average = 0.0f;
public static class AveragedRingBuffer {
private final float[] values;
private int pointer = 0;
private float average = 0.0f;

public AveragedRingBuffer(int averagedDurationInTicks) {
values = new float[averagedDurationInTicks];
}
public AveragedRingBuffer(int averagedDurationInTicks) {
values = new float[averagedDurationInTicks];
}

public void addValue(float newValue) {
float oldValue = values[pointer];
values[pointer] = newValue;
average += newValue / values.length - oldValue / values.length;
pointer++;
pointer = pointer % values.length;
}
public void addValue(float newValue) {
float oldValue = values[pointer];
values[pointer] = newValue;
average += newValue / values.length - oldValue / values.length;
pointer++;
pointer = pointer % values.length;
}

public float getAverage() {
return average;
}
}
public float getAverage() {
return average;
}
}
}
22 changes: 10 additions & 12 deletions src/main/java/com/sinthoras/hydroenergy/api/HEGetMaterialUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,27 @@ public class HEGetMaterialUtil {
private static Logger LOG = LogManager.getLogger("HE API");

public static Material getMaterialWrapper(Block block, int blockY) {
if(block instanceof IHEHasCustomMaterialCalculation) {
return ((IHEHasCustomMaterialCalculation)block).getMaterial(blockY);
}
else {
if (block instanceof IHEHasCustomMaterialCalculation) {
return ((IHEHasCustomMaterialCalculation) block).getMaterial(blockY);
} else {
return block.getMaterial();
}
}

public static Material getMaterialWrapper(Block block, double blockY) {
if(block instanceof IHEHasCustomMaterialCalculation) {
if (block instanceof IHEHasCustomMaterialCalculation) {
LOG.info("triggered");
return ((IHEHasCustomMaterialCalculation)block).getMaterial(blockY);
}
else {
return ((IHEHasCustomMaterialCalculation) block).getMaterial(blockY);
} else {
return block.getMaterial();
}
}

public static Material getMaterialWrapper(EntityViewRenderEvent.FogColors event) {
if(event.block instanceof IHEHasCustomMaterialCalculation) {
return ((IHEHasCustomMaterialCalculation)event.block).getMaterial(event.entity.posY + event.entity.getEyeHeight());
}
else {
if (event.block instanceof IHEHasCustomMaterialCalculation) {
return ((IHEHasCustomMaterialCalculation) event.block)
.getMaterial(event.entity.posY + event.entity.getEyeHeight());
} else {
return event.block.getMaterial();
}
}
Expand Down
Loading

0 comments on commit ac10bab

Please sign in to comment.