Merge pull request #3 from GTNewHorizons/BS+SA

Bs+sa
This commit is contained in:
Martin Robertz authored and GitHub committed 2022-10-22 13:12:44 +02:00
commit 47aa41c96c
39 files changed
+2431 -1054

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
# This is the universal Text Editor Configuration
# for all GTNewHorizons projects
# See: https://editorconfig.org/
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.{bat,ini}]
end_of_line = crlf
[*.{dtd,json,info,mcmeta,md,sh,svg,xml,xsd,xsl,yaml,yml}]
indent_size = 2
[*.lang]
trim_trailing_whitespace = false
+44
View File
@@ -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
+12
View File
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
if ! git diff --name-only HEAD HEAD~1 | grep -qF 'build.gradle'; then
new_version="$(date +%s)"
sed --in-place "s!^//version:.*!//version: $new_version!g" build.gradle
git add build.gradle
git commit -m "[ci skip] update build script version to $new_version"
git push
printf 'Updated buildscript version to %s\n' "$new_version"
else
printf 'Ignored buildscript version update: no changes detected\n'
fi
+13
View File
@@ -0,0 +1,13 @@
name: Build and test
on:
pull_request:
branches: [ master, main ]
push:
branches: [ master, main ]
jobs:
build-and-test:
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/build-and-test.yml@master
secrets: inherit
+14
View File
@@ -0,0 +1,14 @@
name: Release tagged build
on:
push:
tags: [ '*' ]
permissions:
contents: write
jobs:
release-tags:
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/release-tags.yml@master
secrets: inherit
+30 -12
View File
@@ -1,14 +1,32 @@
.gradle/
build/
out/
run/
server/
eclipse/
src/META-INF/
/*.iws
/*.ipr
/*.iml
bin/
.gradle
.settings
/.idea/
/.vscode/
/run/
/build/
/eclipse/
.classpath
.project
.settings/
/bin/
/config/
/crash-reports/
/logs/
options.txt
/saves/
usernamecache.json
banned-ips.json
banned-players.json
eula.txt
ops.json
server.properties
servers.dat
usercache.json
whitelist.json
/out/
*.iml
*.ipr
*.iws
src/main/resources/mixins.*.json
*.bat
*.DS_Store
!gradlew.bat
+3
View File
@@ -0,0 +1,3 @@
# Any Github changes require admin approval
/.github/** @GTNewHorizons/admin
+1069 -20
View File
File diff suppressed because it is too large. Load diff
+10
View File
@@ -0,0 +1,10 @@
// Add your dependencies here
dependencies {
compile ("com.github.GTNewHorizons:Avaritia:1.31:dev")
compile ("com.github.GTNewHorizons:Universal-Singularities:8.6.5:dev")
compile ("com.github.GTNewHorizons:NotEnoughItems:2.3.12-GTNH:dev")
compile ("com.github.GTNewHorizons:CraftTweaker:3.2.9:dev")
compile ("com.github.GTNewHorizons:WanionLib:1.8.3:dev")
}
+116
View File
@@ -0,0 +1,116 @@
modName = Eternal Singularity
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
modId = eternalsingularity
modGroup = singulariteam.eternalsingularity
# WHY is there no version field?
# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the
# code base or your binary. Check out this tutorial: https://blog.mattclemente.com/2017/10/13/versioning-with-git-tags/
# Will update your build.gradle automatically whenever an update is available
autoUpdateBuildScript = false
minecraftVersion = 1.7.10
forgeVersion = 10.13.4.1614
# Specify a MCP channel and mappings version for dependency deobfuscation and the deobfParams task.
channel = stable
mappingsVersion = 12
# Define other MCP mappings for dependency deobfuscation
remoteMappings = https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
# Select a username for testing your mod with breakpoints. You may leave this empty for a random username each time you
# restart Minecraft in development. Choose this dependent on your mod:
# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name
# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty
developmentEnvironmentUserName = Developer
# Define a source file of your project with:
# public static final String VERSION = "GRADLETOKEN_VERSION";
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
# version in @Mod([...], version = VERSION, [...])
# Leave these properties empty to skip individual token replacements
replaceGradleTokenInFile = Tags.java
gradleTokenModId =
gradleTokenModName =
gradleTokenVersion = GRADLETOKEN_VERSION
gradleTokenGroupName =
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
# leave this property empty.
# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
apiPackage =
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/
# Example value: mymodid_at.cfg
accessTransformersFile =
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
usesMixins = false
# Adds some debug arguments like verbose output and export
usesMixinDebug = false
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
mixinPlugin =
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
mixinsPackage =
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
# This parameter is for legacy compatibility only
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
coreModClass =
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
# that is 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
# 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
# Publishing to modrinth requires you to set the MODRINTH_TOKEN environment variable to your current modrinth API token.
# The project's ID on Modrinth. Can be either the slug or the ID.
# Leave this empty if you don't want to publish on Modrinth.
modrinthProjectId =
# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth.
# Syntax: scope1-type1:name1;scope2-type2:name2;...
# Where scope can be one of [required, optional, incompatible, embedded],
# type can be one of [project, version],
# and the name is the Modrinth project or version slug/id of the other mod.
# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech
# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true
modrinthRelations =
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
# The project's numeric ID on CurseForge. You can find this in the About Project box.
# Leave this empty if you don't want to publish on CurseForge.
curseForgeProjectId =
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
# Syntax: type1:name1;type2:name2;...
# 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
# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true
curseForgeRelations =
# Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older
# projects. New projects should not use this parameter.
# customArchiveBaseName =
# Optional parameter to prevent the source code from being published
# noPublishedSources =
# Uncomment this to disable spotless checks
# This should only be uncommented to keep it easier to sync with upstream/other forks.
# That is, if there is no other active fork/upstream, NEVER change this.
# disableSpotless = true
Binary file not shown.
+1 -2
View File
@@ -1,6 +1,5 @@
#Wed Jul 02 15:54:47 CDT 2014
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.0-bin.zip
Vendored
+77 -53
View File
@@ -1,4 +1,20 @@
#!/usr/bin/env bash
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
@@ -6,47 +22,6 @@
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
@@ -61,9 +36,49 @@ while [ -h "$PRG" ] ; do
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&-
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >&-
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
@@ -90,7 +105,7 @@ location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
@@ -110,10 +125,11 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
@@ -154,11 +170,19 @@ if $cygwin ; then
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
APP_ARGS=$(save "$@")
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"
Vendored
+20 -10
View File
@@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@@ -8,14 +24,14 @@
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
@@ -46,10 +62,9 @@ echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
@@ -60,11 +75,6 @@ set _SKIP=2
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
+2
View File
@@ -0,0 +1,2 @@
before_install:
- ./gradlew setupCIWorkspace
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+34
View File
@@ -0,0 +1,34 @@
// Add any additional repositories for your dependencies here
repositories {
maven {
name = "GTNH Maven"
url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
}
maven {
name = "ic2"
url = "https://maven.ic2.player.to/"
metadataSources {
mavenPom()
artifact()
}
}
maven {
name = "ic2"
url = "https://maven2.ic2.player.to/"
metadataSources {
mavenPom()
artifact()
}
}
maven {
name "MMD Maven"
url "https://maven.mcmoddev.com/"
}
maven {
url "https://cursemaven.com"
}
maven {
url = "https://jitpack.io"
}
}
+10
View File
@@ -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
}
+10
View File
@@ -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
}
@@ -1,5 +1,7 @@
package singulariteam.eternalsingularity;
import java.util.Iterator;
import javax.annotation.Nonnull;
import minetweaker.IUndoableAction;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
@@ -9,130 +11,107 @@ import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import wanion.lib.common.MineTweakerHelper;
import javax.annotation.Nonnull;
import java.util.Iterator;
@ZenClass("mods.eternalsingularity")
public final class EternalRecipeTweaker
{
private EternalRecipeTweaker() {}
public final class EternalRecipeTweaker {
private EternalRecipeTweaker() {}
public static void init()
{
MineTweakerAPI.registerClass(EternalRecipeTweaker.class);
}
public static void init() {
MineTweakerAPI.registerClass(EternalRecipeTweaker.class);
}
@ZenMethod
public static void add(@Nonnull final IItemStack input)
{
final ItemStack itemStack = MineTweakerHelper.toStack(input);
if (itemStack != null && itemStack.getItem() != null)
MineTweakerAPI.apply(new Add(itemStack));
}
@ZenMethod
public static void add(@Nonnull final IItemStack input) {
final ItemStack itemStack = MineTweakerHelper.toStack(input);
if (itemStack != null && itemStack.getItem() != null) MineTweakerAPI.apply(new Add(itemStack));
}
@ZenMethod
public static void remove(final IItemStack input)
{
final ItemStack itemStack = MineTweakerHelper.toStack(input);
if (itemStack != null && itemStack.getItem() != null)
MineTweakerAPI.apply(new Remove(itemStack));
}
@ZenMethod
public static void remove(final IItemStack input) {
final ItemStack itemStack = MineTweakerHelper.toStack(input);
if (itemStack != null && itemStack.getItem() != null) MineTweakerAPI.apply(new Remove(itemStack));
}
private static class Add implements IUndoableAction
{
private final ItemStack itemStack;
private static class Add implements IUndoableAction {
private final ItemStack itemStack;
public Add(@Nonnull final ItemStack itemStack)
{
this.itemStack = itemStack;
}
public Add(@Nonnull final ItemStack itemStack) {
this.itemStack = itemStack;
}
@Override
public void apply()
{
CommonProxy.getEternalSingularityRecipe().getInput().add(itemStack);
}
@Override
public void apply() {
CommonProxy.getEternalSingularityRecipe().getInput().add(itemStack);
}
@Override
public boolean canUndo()
{
return true;
}
@Override
public boolean canUndo() {
return true;
}
@Override
public void undo()
{
CommonProxy.getEternalSingularityRecipe().getInput().remove(itemStack);
}
@Override
public void undo() {
CommonProxy.getEternalSingularityRecipe().getInput().remove(itemStack);
}
@Override
public String describe()
{
return "Adding " + itemStack.getDisplayName() + " into Eternal Singularity Recipe.";
}
@Override
public String describe() {
return "Adding " + itemStack.getDisplayName() + " into Eternal Singularity Recipe.";
}
@Override
public String describeUndo()
{
return "Removing " + itemStack.getDisplayName() + " from Eternal Singularity Recipe.";
}
@Override
public String describeUndo() {
return "Removing " + itemStack.getDisplayName() + " from Eternal Singularity Recipe.";
}
@Override
public Object getOverrideKey()
{
return null;
}
}
@Override
public Object getOverrideKey() {
return null;
}
}
private static class Remove implements IUndoableAction
{
private final ItemStack itemStack;
private static class Remove implements IUndoableAction {
private final ItemStack itemStack;
private Remove(@Nonnull final ItemStack itemStackToRemove)
{
ItemStack itemStack = null;
for (final Iterator<Object> eternalSingularityRecipeIterator = CommonProxy.getEternalSingularityRecipe().getInput().iterator(); eternalSingularityRecipeIterator.hasNext() && itemStack == null; ) {
final Object input = eternalSingularityRecipeIterator.next();
if (input instanceof ItemStack && ((ItemStack) input).isItemEqual(itemStackToRemove))
itemStack = (ItemStack) input;
}
this.itemStack = itemStack;
}
private Remove(@Nonnull final ItemStack itemStackToRemove) {
ItemStack itemStack = null;
for (final Iterator<Object> eternalSingularityRecipeIterator =
CommonProxy.getEternalSingularityRecipe().getInput().iterator();
eternalSingularityRecipeIterator.hasNext() && itemStack == null; ) {
final Object input = eternalSingularityRecipeIterator.next();
if (input instanceof ItemStack && ((ItemStack) input).isItemEqual(itemStackToRemove))
itemStack = (ItemStack) input;
}
this.itemStack = itemStack;
}
@Override
public void apply()
{
CommonProxy.getEternalSingularityRecipe().getInput().remove(itemStack);
}
@Override
public void apply() {
CommonProxy.getEternalSingularityRecipe().getInput().remove(itemStack);
}
@Override
public boolean canUndo()
{
return itemStack != null;
}
@Override
public boolean canUndo() {
return itemStack != null;
}
@Override
public void undo()
{
CommonProxy.getEternalSingularityRecipe().getInput().add(itemStack);
}
@Override
public void undo() {
CommonProxy.getEternalSingularityRecipe().getInput().add(itemStack);
}
@Override
public String describe()
{
return "Removing " + itemStack.getDisplayName() + " from Eternal Singularity Recipe.";
}
@Override
public String describe() {
return "Removing " + itemStack.getDisplayName() + " from Eternal Singularity Recipe.";
}
@Override
public String describeUndo()
{
return "Adding " + itemStack.getDisplayName() + " into Eternal Singularity Recipe.";
}
@Override
public String describeUndo() {
return "Adding " + itemStack.getDisplayName() + " into Eternal Singularity Recipe.";
}
@Override
public Object getOverrideKey()
{
return null;
}
}
}
@Override
public Object getOverrideKey() {
return null;
}
}
}
@@ -1,5 +1,7 @@
package singulariteam.eternalsingularity;
import static singulariteam.eternalsingularity.Reference.*;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
@@ -13,45 +15,43 @@ import org.apache.logging.log4j.Logger;
import singulariteam.eternalsingularity.item.EternalSingularityItem;
import singulariteam.eternalsingularity.proxy.CommonProxy;
import static singulariteam.eternalsingularity.Reference.*;
@Mod(
modid = MOD_ID,
name = MOD_NAME,
version = MOD_VERSION,
acceptedMinecraftVersions = MC_VERSION,
dependencies =
"required-after:Avaritia;required-after:wanionlib@[1.7.10-1.3,);after:thermsingul;after:universalsingularities;after:aobdsingularities")
public class EternalSingularityMod {
@Mod.Instance(MOD_ID)
public static EternalSingularityMod instance;
@Mod(modid = MOD_ID, name = MOD_NAME, version = MOD_VERSION, acceptedMinecraftVersions = MC_VERSION, dependencies = "required-after:Avaritia;required-after:wanionlib@[1.7.10-1.3,);after:thermsingul;after:universalsingularities;after:aobdsingularities")
public class EternalSingularityMod
{
@Mod.Instance(MOD_ID)
public static EternalSingularityMod instance;
public static Logger logger;
public static Logger logger;
@SidedProxy(serverSide = COMMON_PROXY, clientSide = CLIENT_PROXY)
public static CommonProxy proxy;
@SidedProxy(serverSide = COMMON_PROXY, clientSide = CLIENT_PROXY)
public static CommonProxy proxy;
public static final CreativeTabs creativeTabs = new CreativeTabs(MOD_ID) {
@SideOnly(Side.CLIENT)
@Override
public Item getTabIconItem() {
return EternalSingularityItem.instance;
}
};
public static final CreativeTabs creativeTabs = new CreativeTabs(MOD_ID)
{
@SideOnly(Side.CLIENT)
@Override
public Item getTabIconItem()
{
return EternalSingularityItem.instance;
}
};
@Mod.EventHandler
public void preInit(final FMLPreInitializationEvent event) {
logger = event.getModLog();
proxy.preInit(event.getSuggestedConfigurationFile());
}
@Mod.EventHandler
public void preInit(final FMLPreInitializationEvent event)
{
logger = event.getModLog();
proxy.preInit(event.getSuggestedConfigurationFile());
}
@Mod.EventHandler
public void init(final FMLInitializationEvent event) {
proxy.init();
}
@Mod.EventHandler
public void init(final FMLInitializationEvent event)
{
proxy.init();
}
@Mod.EventHandler
public void postInit(final FMLPostInitializationEvent event)
{
proxy.postInit();
}
}
@Mod.EventHandler
public void postInit(final FMLPostInitializationEvent event) {
proxy.postInit();
}
}
@@ -1,13 +1,12 @@
package singulariteam.eternalsingularity;
public final class Reference
{
public static final String MOD_ID = "eternalsingularity";
public static final String MOD_NAME = "Eternal Singularity";
public static final String MOD_VERSION = "1.7.10-.1.0.4b";
public static final String MC_VERSION = "[1.7.10]";
static final String COMMON_PROXY = "singulariteam.eternalsingularity.proxy.CommonProxy";
static final String CLIENT_PROXY = "singulariteam.eternalsingularity.proxy.ClientProxy";
public final class Reference {
public static final String MOD_ID = "eternalsingularity";
public static final String MOD_NAME = "Eternal Singularity";
public static final String MOD_VERSION = "GRADLETOKEN_VERSION";
public static final String MC_VERSION = "[1.7.10]";
static final String COMMON_PROXY = "singulariteam.eternalsingularity.proxy.CommonProxy";
static final String CLIENT_PROXY = "singulariteam.eternalsingularity.proxy.ClientProxy";
private Reference() {}
}
private Reference() {}
}
@@ -1,14 +1,12 @@
package singulariteam.eternalsingularity.item;
import java.util.List;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import fox.spiteful.avaritia.Avaritia;
import fox.spiteful.avaritia.items.ItemResource;
import fox.spiteful.avaritia.items.LudicrousItems;
import fox.spiteful.avaritia.render.ICosmicRenderItem;
import fox.spiteful.avaritia.render.IHaloRenderItem;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
@@ -19,111 +17,98 @@ import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import singulariteam.eternalsingularity.EternalSingularityMod;
public class CompoundSingularityItem extends Item implements IHaloRenderItem, ICosmicRenderItem
{
private final int max;
public class CompoundSingularityItem extends Item implements IHaloRenderItem, ICosmicRenderItem {
private final int max;
@SideOnly(Side.CLIENT)
private IIcon cosmicMask;
@SideOnly(Side.CLIENT)
private IIcon[] foregroundIcons, backgroundIcons;
@SideOnly(Side.CLIENT)
private IIcon cosmicMask;
public CompoundSingularityItem(final int max)
{
super();
setHasSubtypes(true);
this.max = max;
setCreativeTab(EternalSingularityMod.creativeTabs);
}
@SideOnly(Side.CLIENT)
private IIcon[] foregroundIcons, backgroundIcons;
public EnumRarity getRarity(ItemStack stack)
{
return EnumRarity.uncommon;
}
public CompoundSingularityItem(final int max) {
super();
setHasSubtypes(true);
this.max = max;
setCreativeTab(EternalSingularityMod.creativeTabs);
}
@Override
public String getUnlocalizedName(final ItemStack stack)
{
return "item.combined.singularity." + MathHelper.clamp_int(getDamage(stack), 0, max);
}
public EnumRarity getRarity(ItemStack stack) {
return EnumRarity.uncommon;
}
@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tab, List list)
{
for (int j = 0; j < max; j++)
list.add(new ItemStack(item, 1, j));
}
@Override
public String getUnlocalizedName(final ItemStack stack) {
return "item.combined.singularity." + MathHelper.clamp_int(getDamage(stack), 0, max);
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getMaskTexture(ItemStack stack, EntityPlayer player)
{
return cosmicMask;
}
@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tab, List list) {
for (int j = 0; j < max; j++) list.add(new ItemStack(item, 1, j));
}
@Override
@SideOnly(Side.CLIENT)
public float getMaskMultiplier(ItemStack stack, EntityPlayer player)
{
return 1.0f;
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getMaskTexture(ItemStack stack, EntityPlayer player) {
return cosmicMask;
}
@SideOnly(Side.CLIENT)
@Override
public void registerIcons(IIconRegister ir)
{
super.registerIcons(ir);
foregroundIcons = new IIcon[max];
backgroundIcons = new IIcon[max];
@Override
@SideOnly(Side.CLIENT)
public float getMaskMultiplier(ItemStack stack, EntityPlayer player) {
return 1.0f;
}
for (int x = 0; x < max; x++) {
foregroundIcons[x] = ir.registerIcon("eternalsingularity:combined_singularity_" + x + "_overlay");
backgroundIcons[x] = ir.registerIcon("eternalsingularity:combined_singularity_" + x);
}
this.cosmicMask = ir.registerIcon("eternalsingularity:combined_singularity_mask");
}
@SideOnly(Side.CLIENT)
@Override
public void registerIcons(IIconRegister ir) {
super.registerIcons(ir);
foregroundIcons = new IIcon[max];
backgroundIcons = new IIcon[max];
@Override
public IIcon getIcon(ItemStack stack, int pass)
{
return pass == 1 ? this.foregroundIcons[stack.getItemDamage() % foregroundIcons.length] : this.backgroundIcons[stack.getItemDamage() % backgroundIcons.length];
}
for (int x = 0; x < max; x++) {
foregroundIcons[x] = ir.registerIcon("eternalsingularity:combined_singularity_" + x + "_overlay");
backgroundIcons[x] = ir.registerIcon("eternalsingularity:combined_singularity_" + x);
}
this.cosmicMask = ir.registerIcon("eternalsingularity:combined_singularity_mask");
}
@SideOnly(Side.CLIENT)
@Override
public boolean requiresMultipleRenderPasses()
{
return true;
}
@Override
public IIcon getIcon(ItemStack stack, int pass) {
return pass == 1
? this.foregroundIcons[stack.getItemDamage() % foregroundIcons.length]
: this.backgroundIcons[stack.getItemDamage() % backgroundIcons.length];
}
@SideOnly(Side.CLIENT)
public boolean drawHalo(ItemStack paramItemStack)
{
return true;
}
@SideOnly(Side.CLIENT)
@Override
public boolean requiresMultipleRenderPasses() {
return true;
}
@SideOnly(Side.CLIENT)
public IIcon getHaloTexture(ItemStack paramItemStack)
{
return ((ItemResource) LudicrousItems.resource).halo[0];
}
@SideOnly(Side.CLIENT)
public boolean drawHalo(ItemStack paramItemStack) {
return true;
}
@SideOnly(Side.CLIENT)
public int getHaloSize(ItemStack paramItemStack)
{
return 4;
}
@SideOnly(Side.CLIENT)
public IIcon getHaloTexture(ItemStack paramItemStack) {
return ((ItemResource) LudicrousItems.resource).halo[0];
}
@SideOnly(Side.CLIENT)
public boolean drawPulseEffect(ItemStack paramItemStack)
{
return false;
}
@SideOnly(Side.CLIENT)
public int getHaloSize(ItemStack paramItemStack) {
return 4;
}
@SideOnly(Side.CLIENT)
public int getHaloColour(ItemStack paramItemStack)
{
return -16777216;
}
}
@SideOnly(Side.CLIENT)
public boolean drawPulseEffect(ItemStack paramItemStack) {
return false;
}
@SideOnly(Side.CLIENT)
public int getHaloColour(ItemStack paramItemStack) {
return -16777216;
}
}
@@ -2,7 +2,6 @@ package singulariteam.eternalsingularity.item;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import fox.spiteful.avaritia.Avaritia;
import fox.spiteful.avaritia.entity.EntityImmortalItem;
import fox.spiteful.avaritia.items.ItemResource;
import fox.spiteful.avaritia.items.LudicrousItems;
@@ -18,106 +17,90 @@ import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import singulariteam.eternalsingularity.EternalSingularityMod;
public class EternalSingularityItem extends Item implements IHaloRenderItem, ICosmicRenderItem
{
public static final EternalSingularityItem instance = new EternalSingularityItem();
public class EternalSingularityItem extends Item implements IHaloRenderItem, ICosmicRenderItem {
public static final EternalSingularityItem instance = new EternalSingularityItem();
private IIcon cosmicMask;
private IIcon foregroundIcon;
private IIcon cosmicMask;
private IIcon foregroundIcon;
private EternalSingularityItem()
{
super();
setCreativeTab(EternalSingularityMod.creativeTabs);
setTextureName("eternalsingularity:eternal_singularity2");
}
private EternalSingularityItem() {
super();
setCreativeTab(EternalSingularityMod.creativeTabs);
setTextureName("eternalsingularity:eternal_singularity2");
}
public EnumRarity getRarity(ItemStack stack)
{
return LudicrousItems.cosmic;
}
public EnumRarity getRarity(ItemStack stack) {
return LudicrousItems.cosmic;
}
@Override
public String getUnlocalizedName(final ItemStack stack)
{
return "item.eternal.singularity";
}
@Override
public String getUnlocalizedName(final ItemStack stack) {
return "item.eternal.singularity";
}
@Override
public boolean hasCustomEntity(ItemStack stack)
{
return true;
}
@Override
public boolean hasCustomEntity(ItemStack stack) {
return true;
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getMaskTexture(ItemStack stack, EntityPlayer player)
{
return cosmicMask;
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getMaskTexture(ItemStack stack, EntityPlayer player) {
return cosmicMask;
}
@Override
@SideOnly(Side.CLIENT)
public float getMaskMultiplier(ItemStack stack, EntityPlayer player)
{
return 1.0f;
}
@Override
@SideOnly(Side.CLIENT)
public float getMaskMultiplier(ItemStack stack, EntityPlayer player) {
return 1.0f;
}
@SideOnly(Side.CLIENT)
@Override
public void registerIcons(IIconRegister ir)
{
super.registerIcons(ir);
this.cosmicMask = ir.registerIcon("eternalsingularity:eternal_singularity_mask");
this.foregroundIcon = ir.registerIcon("eternalsingularity:eternal_singularity");
}
@SideOnly(Side.CLIENT)
@Override
public void registerIcons(IIconRegister ir) {
super.registerIcons(ir);
this.cosmicMask = ir.registerIcon("eternalsingularity:eternal_singularity_mask");
this.foregroundIcon = ir.registerIcon("eternalsingularity:eternal_singularity");
}
@Override
public IIcon getIcon(ItemStack stack, int pass)
{
return pass == 1 ? foregroundIcon : super.getIcon(stack, pass);
}
@Override
public IIcon getIcon(ItemStack stack, int pass) {
return pass == 1 ? foregroundIcon : super.getIcon(stack, pass);
}
@SideOnly(Side.CLIENT)
@Override
public boolean requiresMultipleRenderPasses()
{
return true;
}
@SideOnly(Side.CLIENT)
@Override
public boolean requiresMultipleRenderPasses() {
return true;
}
@Override
public Entity createEntity(World world, Entity location, ItemStack itemstack)
{
return new EntityImmortalItem(world, location, itemstack);
}
@Override
public Entity createEntity(World world, Entity location, ItemStack itemstack) {
return new EntityImmortalItem(world, location, itemstack);
}
@SideOnly(Side.CLIENT)
public boolean drawHalo(ItemStack paramItemStack)
{
return true;
}
@SideOnly(Side.CLIENT)
public boolean drawHalo(ItemStack paramItemStack) {
return true;
}
@SideOnly(Side.CLIENT)
public IIcon getHaloTexture(ItemStack paramItemStack)
{
return ((ItemResource) LudicrousItems.resource).halo[0];
}
@SideOnly(Side.CLIENT)
public IIcon getHaloTexture(ItemStack paramItemStack) {
return ((ItemResource) LudicrousItems.resource).halo[0];
}
@SideOnly(Side.CLIENT)
public int getHaloSize(ItemStack paramItemStack)
{
return 4;
}
@SideOnly(Side.CLIENT)
public int getHaloSize(ItemStack paramItemStack) {
return 4;
}
@SideOnly(Side.CLIENT)
public boolean drawPulseEffect(ItemStack paramItemStack)
{
return false;
}
@SideOnly(Side.CLIENT)
public boolean drawPulseEffect(ItemStack paramItemStack) {
return false;
}
@SideOnly(Side.CLIENT)
public int getHaloColour(ItemStack paramItemStack)
{
return -16777216;
}
}
@SideOnly(Side.CLIENT)
public int getHaloColour(ItemStack paramItemStack) {
return -16777216;
}
}
@@ -5,22 +5,19 @@ import singulariteam.eternalsingularity.item.EternalSingularityItem;
import singulariteam.eternalsingularity.render.EternalItemRenderer;
import singulariteam.eternalsingularity.render.ShaderHelper;
public final class ClientProxy extends CommonProxy
{
EternalItemRenderer fancies = new EternalItemRenderer();
public final class ClientProxy extends CommonProxy {
EternalItemRenderer fancies = new EternalItemRenderer();
@Override
public void init()
{
MinecraftForgeClient.registerItemRenderer(EternalSingularityItem.instance, fancies);
ShaderHelper.initShaders();
}
@Override
public void init() {
MinecraftForgeClient.registerItemRenderer(EternalSingularityItem.instance, fancies);
ShaderHelper.initShaders();
}
@Override
public void postInit()
{
super.postInit();
if (compoundSingularityItem != null)
MinecraftForgeClient.registerItemRenderer(compoundSingularityItem, fancies);
}
@Override
public void postInit() {
super.postInit();
if (compoundSingularityItem != null)
MinecraftForgeClient.registerItemRenderer(compoundSingularityItem, fancies);
}
}
@@ -1,9 +1,14 @@
package singulariteam.eternalsingularity.proxy;
import static fox.spiteful.avaritia.Config.craftingOnly;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.registry.GameRegistry;
import fox.spiteful.avaritia.crafting.ExtremeCraftingManager;
import fox.spiteful.avaritia.crafting.Grinder;
import java.io.File;
import java.util.*;
import javax.annotation.Nonnull;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
@@ -14,99 +19,101 @@ import singulariteam.eternalsingularity.EternalSingularityMod;
import singulariteam.eternalsingularity.item.CompoundSingularityItem;
import singulariteam.eternalsingularity.item.EternalSingularityItem;
import javax.annotation.Nonnull;
import java.io.File;
import java.util.*;
public class CommonProxy {
private static ShapelessOreRecipe eternalSingularityRecipe = null;
private static final Set<Class> classSet = new HashSet<>();
protected CompoundSingularityItem compoundSingularityItem = null;
private File configFile;
import static fox.spiteful.avaritia.Config.craftingOnly;
public CommonProxy() {}
public class CommonProxy
{
private static ShapelessOreRecipe eternalSingularityRecipe = null;
private static final Set<Class> classSet = new HashSet<>();
protected CompoundSingularityItem compoundSingularityItem = null;
private File configFile;
public final void preInit(final File file) {
final Configuration config = new Configuration(configFile = file);
final String[] classNameList = config.getStringList(
"classNameList",
Configuration.CATEGORY_GENERAL,
new String[] {
"com.rcx.aobdsingularities.item.AOBDItemSingularity",
"fox.spiteful.avaritia.items.ItemSingularity",
"wanion.thermsingul.ThermalSingularityItem",
"wealthyturtle.uiesingularities.UniversalSingularityItem"
},
"here is the absolute class name of the Item Classes that must be removed from Infinity Catalyst recipe and inserted into Eternal Singularity.");
if (config.hasChanged()) config.save();
for (final String className : classNameList) {
try {
classSet.add(Class.forName(className));
} catch (ClassNotFoundException e) {
EternalSingularityMod.logger.warn("Couldn't find " + className);
}
}
GameRegistry.registerItem(EternalSingularityItem.instance, "eternal_singularity");
if (Loader.isModLoaded("MineTweaker3")) EternalRecipeTweaker.init();
}
public CommonProxy() { }
public void init() {}
public final void preInit(final File file)
{
final Configuration config = new Configuration(configFile = file);
final String[] classNameList = config.getStringList("classNameList", Configuration.CATEGORY_GENERAL, new String[]{
"com.rcx.aobdsingularities.item.AOBDItemSingularity",
"fox.spiteful.avaritia.items.ItemSingularity",
"wanion.thermsingul.ThermalSingularityItem",
"wealthyturtle.uiesingularities.UniversalSingularityItem"
}, "here is the absolute class name of the Item Classes that must be removed from Infinity Catalyst recipe and inserted into Eternal Singularity.");
if (config.hasChanged())
config.save();
for (final String className : classNameList) {
try {
classSet.add(Class.forName(className));
} catch (ClassNotFoundException e) {
EternalSingularityMod.logger.warn("Couldn't find " + className);
}
}
GameRegistry.registerItem(EternalSingularityItem.instance, "eternal_singularity");
if (Loader.isModLoaded("MineTweaker3"))
EternalRecipeTweaker.init();
}
@Nonnull
public static ShapelessOreRecipe getEternalSingularityRecipe() {
return eternalSingularityRecipe;
}
public void init() {}
@Nonnull
public static ShapelessOreRecipe getEternalSingularityRecipe()
{
return eternalSingularityRecipe;
}
@SuppressWarnings("unchecked")
public void postInit()
{
if (classSet.isEmpty() || craftingOnly)
return;
final List<ItemStack> singularities = new ArrayList<>();
for (final Iterator<Object> catalystRecipeIterator = Grinder.catalyst.getInput().iterator(); catalystRecipeIterator.hasNext(); ) {
final Object input = catalystRecipeIterator.next();
if (!(input instanceof ItemStack))
continue;
final Item item = ((ItemStack) input).getItem();
if (item != null && classSet.contains(item.getClass())) {
catalystRecipeIterator.remove();
singularities.add(((ItemStack) input).copy());
}
}
final Configuration config = new Configuration(configFile);
final int singularityCount = singularities.size();
final boolean aboveTheLimit = singularityCount > 81;
final boolean useCompoundSingularities = config.getBoolean("useCompoundSingularities", Configuration.CATEGORY_GENERAL, aboveTheLimit, "When useCompoundSingularities is Enabled, Basic Singularities will Need to be Crafted into Compound Singularities First.\n[If there are > 81 Basic Singularities, this Config Option will be Set to True Automatically]") || aboveTheLimit;
final boolean easyMode = config.getBoolean("easyMode", Configuration.CATEGORY_GENERAL, false, "If this Config Option is Enabled, for Every 9 Singularities Used in the Eternal Singularity Recipe, You will Receive an Additional Eternal Singularity for the Recipe Output.");
if (config.hasChanged())
config.save();
final int compoundMax = (int) Math.ceil((float) singularityCount / 9);
(eternalSingularityRecipe = new ShapelessOreRecipe(new ItemStack(EternalSingularityItem.instance, easyMode ? MathHelper.clamp_int(compoundMax, 1, 64) : 1))).getInput().addAll(singularities);
if (useCompoundSingularities) {
GameRegistry.registerItem(compoundSingularityItem = new CompoundSingularityItem(compoundMax), "combined_singularity");
final List<Object> eternalSingularityRecipeInputs = eternalSingularityRecipe.getInput();
for (int i = 0; i < compoundMax; i++) {
final ShapelessOreRecipe compoundRecipe = new ShapelessOreRecipe(new ItemStack(compoundSingularityItem, 1, MathHelper.clamp_int(i, 0, 64)));
for (int s = 0; s < 9; s++) {
final int pos = 9 * i + s;
if (pos > singularityCount - 1)
break;
final Object input = eternalSingularityRecipeInputs.get(pos);
if (!(input instanceof ItemStack))
continue;
compoundRecipe.getInput().add(((ItemStack) input).copy());
}
if (compoundRecipe.getInput().size() > 0)
GameRegistry.addRecipe(compoundRecipe);
}
eternalSingularityRecipeInputs.clear();
for (int i = 0; i < compoundMax; i++)
eternalSingularityRecipeInputs.add(new ItemStack(compoundSingularityItem, 1, i));
}
ExtremeCraftingManager.getInstance().getRecipeList().add(eternalSingularityRecipe);
Grinder.catalyst.getInput().add(new ItemStack(EternalSingularityItem.instance));
}
}
@SuppressWarnings("unchecked")
public void postInit() {
if (classSet.isEmpty() || craftingOnly) return;
final List<ItemStack> singularities = new ArrayList<>();
for (final Iterator<Object> catalystRecipeIterator =
Grinder.catalyst.getInput().iterator();
catalystRecipeIterator.hasNext(); ) {
final Object input = catalystRecipeIterator.next();
if (!(input instanceof ItemStack)) continue;
final Item item = ((ItemStack) input).getItem();
if (item != null && classSet.contains(item.getClass())) {
catalystRecipeIterator.remove();
singularities.add(((ItemStack) input).copy());
}
}
final Configuration config = new Configuration(configFile);
final int singularityCount = singularities.size();
final boolean aboveTheLimit = singularityCount > 81;
final boolean useCompoundSingularities = config.getBoolean(
"useCompoundSingularities",
Configuration.CATEGORY_GENERAL,
aboveTheLimit,
"When useCompoundSingularities is Enabled, Basic Singularities will Need to be Crafted into Compound Singularities First.\n[If there are > 81 Basic Singularities, this Config Option will be Set to True Automatically]")
|| aboveTheLimit;
final boolean easyMode = config.getBoolean(
"easyMode",
Configuration.CATEGORY_GENERAL,
false,
"If this Config Option is Enabled, for Every 9 Singularities Used in the Eternal Singularity Recipe, You will Receive an Additional Eternal Singularity for the Recipe Output.");
if (config.hasChanged()) config.save();
final int compoundMax = (int) Math.ceil((float) singularityCount / 9);
(eternalSingularityRecipe = new ShapelessOreRecipe(new ItemStack(
EternalSingularityItem.instance, easyMode ? MathHelper.clamp_int(compoundMax, 1, 64) : 1)))
.getInput()
.addAll(singularities);
if (useCompoundSingularities) {
GameRegistry.registerItem(
compoundSingularityItem = new CompoundSingularityItem(compoundMax), "combined_singularity");
final List<Object> eternalSingularityRecipeInputs = eternalSingularityRecipe.getInput();
for (int i = 0; i < compoundMax; i++) {
final ShapelessOreRecipe compoundRecipe = new ShapelessOreRecipe(
new ItemStack(compoundSingularityItem, 1, MathHelper.clamp_int(i, 0, 64)));
for (int s = 0; s < 9; s++) {
final int pos = 9 * i + s;
if (pos > singularityCount - 1) break;
final Object input = eternalSingularityRecipeInputs.get(pos);
if (!(input instanceof ItemStack)) continue;
compoundRecipe.getInput().add(((ItemStack) input).copy());
}
if (compoundRecipe.getInput().size() > 0) GameRegistry.addRecipe(compoundRecipe);
}
eternalSingularityRecipeInputs.clear();
for (int i = 0; i < compoundMax; i++)
eternalSingularityRecipeInputs.add(new ItemStack(compoundSingularityItem, 1, i));
}
ExtremeCraftingManager.getInstance().getRecipeList().add(eternalSingularityRecipe);
Grinder.catalyst.getInput().add(new ItemStack(EternalSingularityItem.instance));
}
}
@@ -1,116 +1,112 @@
package singulariteam.eternalsingularity.render;
import cpw.mods.fml.relauncher.ReflectionHelper;
import fox.spiteful.avaritia.render.LudicrousRenderEvents;
import java.lang.reflect.Field;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.world.World;
import org.apache.logging.log4j.Level;
import org.lwjgl.opengl.ARBShaderObjects;
import cpw.mods.fml.relauncher.ReflectionHelper;
import fox.spiteful.avaritia.render.LudicrousRenderEvents;
public class CosmicRenderStuffs {
public static final ShaderCallback shaderCallback;
public static float[] lightlevel = new float[3];
public static String[] lightmapobf = new String[] {"lightmapColors", "field_78504_Q", "U"};
public static boolean inventoryRender = false;
public static float cosmicOpacity = 1.0f;
static {
shaderCallback = new ShaderCallback() {
@Override
public void call(int shader) {
Minecraft mc = Minecraft.getMinecraft();
public static final ShaderCallback shaderCallback;
float yaw = 0;
float pitch = 0;
float scale = 1.0f;
if (!inventoryRender) {
yaw = (float)((mc.thePlayer.rotationYaw * 2 * Math.PI) / 360.0);
pitch = - (float)((mc.thePlayer.rotationPitch * 2 * Math.PI) / 360.0);
} else {
scale = 25.0f;
}
int x = ARBShaderObjects.glGetUniformLocationARB(shader, "yaw");
ARBShaderObjects.glUniform1fARB(x, yaw);
int z = ARBShaderObjects.glGetUniformLocationARB(shader, "pitch");
ARBShaderObjects.glUniform1fARB(z, pitch);
int l = ARBShaderObjects.glGetUniformLocationARB(shader, "lightlevel");
ARBShaderObjects.glUniform3fARB(l, lightlevel[0], lightlevel[1], lightlevel[2]);
int lightmix = ARBShaderObjects.glGetUniformLocationARB(shader, "lightmix");
ARBShaderObjects.glUniform1fARB(lightmix, 0.2f);
int uvs = ARBShaderObjects.glGetUniformLocationARB(shader, "cosmicuvs");
ARBShaderObjects.glUniformMatrix2ARB(uvs, false, LudicrousRenderEvents.cosmicUVs);
int s = ARBShaderObjects.glGetUniformLocationARB(shader, "externalScale");
ARBShaderObjects.glUniform1fARB(s, scale);
int o = ARBShaderObjects.glGetUniformLocationARB(shader, "opacity");
ARBShaderObjects.glUniform1fARB(o, cosmicOpacity);
}
};
}
public static void useShader() {
ShaderHelper.useShader(ShaderHelper.cosmicShader, shaderCallback);
}
public static void releaseShader() {
ShaderHelper.releaseShader();
}
private static Field mapfield = ReflectionHelper.findField(EntityRenderer.class, lightmapobf);
public static void setLightFromLocation(World world, int x, int y, int z) {
if(world == null){
public static float[] lightlevel = new float[3];
public static String[] lightmapobf = new String[] {"lightmapColors", "field_78504_Q", "U"};
public static boolean inventoryRender = false;
public static float cosmicOpacity = 1.0f;
static {
shaderCallback = new ShaderCallback() {
@Override
public void call(int shader) {
Minecraft mc = Minecraft.getMinecraft();
float yaw = 0;
float pitch = 0;
float scale = 1.0f;
if (!inventoryRender) {
yaw = (float) ((mc.thePlayer.rotationYaw * 2 * Math.PI) / 360.0);
pitch = -(float) ((mc.thePlayer.rotationPitch * 2 * Math.PI) / 360.0);
} else {
scale = 25.0f;
}
int x = ARBShaderObjects.glGetUniformLocationARB(shader, "yaw");
ARBShaderObjects.glUniform1fARB(x, yaw);
int z = ARBShaderObjects.glGetUniformLocationARB(shader, "pitch");
ARBShaderObjects.glUniform1fARB(z, pitch);
int l = ARBShaderObjects.glGetUniformLocationARB(shader, "lightlevel");
ARBShaderObjects.glUniform3fARB(l, lightlevel[0], lightlevel[1], lightlevel[2]);
int lightmix = ARBShaderObjects.glGetUniformLocationARB(shader, "lightmix");
ARBShaderObjects.glUniform1fARB(lightmix, 0.2f);
int uvs = ARBShaderObjects.glGetUniformLocationARB(shader, "cosmicuvs");
ARBShaderObjects.glUniformMatrix2ARB(uvs, false, LudicrousRenderEvents.cosmicUVs);
int s = ARBShaderObjects.glGetUniformLocationARB(shader, "externalScale");
ARBShaderObjects.glUniform1fARB(s, scale);
int o = ARBShaderObjects.glGetUniformLocationARB(shader, "opacity");
ARBShaderObjects.glUniform1fARB(o, cosmicOpacity);
}
};
}
public static void useShader() {
ShaderHelper.useShader(ShaderHelper.cosmicShader, shaderCallback);
}
public static void releaseShader() {
ShaderHelper.releaseShader();
}
private static Field mapfield = ReflectionHelper.findField(EntityRenderer.class, lightmapobf);
public static void setLightFromLocation(World world, int x, int y, int z) {
if (world == null) {
setLightLevel(1.0f);
return;
}
int coord = world.getLightBrightnessForSkyBlocks(x, y, z, 0);
int[] map = null;
try {
map = (int[]) mapfield.get(Minecraft.getMinecraft().entityRenderer);
} catch (Exception e) {}
if (map == null) {
setLightLevel(1.0f);
return;
}
int mx = (coord % 65536) / 16;
int[] map = null;
try {
map = (int[]) mapfield.get(Minecraft.getMinecraft().entityRenderer);
} catch (Exception e) {
}
if (map == null) {
setLightLevel(1.0f);
return;
}
int mx = (coord % 65536) / 16;
int my = (coord / 65536) / 16;
int lightcolour = map[my*16+mx];
setLightLevel(
1.0F,
1.0F,
1.0F
);
}
public static void setLightLevel(float level) {
setLightLevel(level, level, level);
}
public static void setLightLevel(float r, float g, float b) {
lightlevel[0] = Math.max(0.0f, Math.min(1.0f, r));
lightlevel[1] = Math.max(0.0f, Math.min(1.0f, g));
lightlevel[2] = Math.max(0.0f, Math.min(1.0f, b));
}
public static void bindItemTexture() {
Minecraft mc = Minecraft.getMinecraft();
mc.renderEngine.bindTexture(TextureMap.locationItemsTexture);
}
}
int lightcolour = map[my * 16 + mx];
setLightLevel(1.0F, 1.0F, 1.0F);
}
public static void setLightLevel(float level) {
setLightLevel(level, level, level);
}
public static void setLightLevel(float r, float g, float b) {
lightlevel[0] = Math.max(0.0f, Math.min(1.0f, r));
lightlevel[1] = Math.max(0.0f, Math.min(1.0f, g));
lightlevel[2] = Math.max(0.0f, Math.min(1.0f, b));
}
public static void bindItemTexture() {
Minecraft mc = Minecraft.getMinecraft();
mc.renderEngine.bindTexture(TextureMap.locationItemsTexture);
}
}
@@ -2,6 +2,7 @@ package singulariteam.eternalsingularity.render;
import fox.spiteful.avaritia.render.ICosmicRenderItem;
import fox.spiteful.avaritia.render.IHaloRenderItem;
import java.util.Random;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.RenderHelper;
@@ -17,286 +18,304 @@ import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import java.util.Random;
public class EternalItemRenderer implements IItemRenderer {
public class EternalItemRenderer implements IItemRenderer {
public Random rand = new Random();
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
//return type != ItemRenderType.INVENTORY;
return true;
}
public Random rand = new Random();
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
return helper == ItemRendererHelper.ENTITY_ROTATION || helper == ItemRendererHelper.ENTITY_BOBBING;
}
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
// return type != ItemRenderType.INVENTORY;
return true;
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
boolean renderHalo = false;
boolean renderPulse = false;
int spread = 0;
IIcon halo = null;
int haloColour = 0;
net.minecraft.item.Item itype = item.getItem();
if (itype instanceof IHaloRenderItem) {
IHaloRenderItem ihri = (IHaloRenderItem)itype;
spread = ihri.getHaloSize(item);
halo = ihri.getHaloTexture(item);
haloColour = ihri.getHaloColour(item);
renderHalo = ihri.drawHalo(item);
renderPulse = ihri.drawPulseEffect(item);
}
RenderItem r = RenderItem.getInstance();
Minecraft mc = Minecraft.getMinecraft();
Tessellator t = Tessellator.instance;
this.processLightLevel(type, item, data);
//ShaderHelper.useShader(ShaderHelper.testShader, this.shaderCallback);
switch(type) {
case ENTITY : {
GL11.glPushMatrix();
GL11.glTranslatef(-0.5F, 0F, 0F);
if(item.isOnItemFrame())
GL11.glTranslatef(0F, -0.3F, 0.01F);
render(item, null);
GL11.glPopMatrix();
break;
}
case EQUIPPED : {
render(item, data[1] instanceof EntityPlayer ? (EntityPlayer) data[1] : null);
break;
}
case EQUIPPED_FIRST_PERSON : {
render(item, data[1] instanceof EntityPlayer ? (EntityPlayer) data[1] : null);
break;
}
case INVENTORY: {
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
RenderHelper.enableGUIStandardItemLighting();
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glDisable(GL11.GL_DEPTH_TEST);
if (renderHalo) {
float ca = (float)(haloColour >> 24 & 255) / 255.0F;
float cr = (float)(haloColour >> 16 & 255) / 255.0F;
float cg = (float)(haloColour >> 8 & 255) / 255.0F;
float cb = (float)(haloColour & 255) / 255.0F;
GL11.glColor4f(cr, cg, cb, ca);
t.startDrawingQuads();
t.addVertexWithUV(0-spread, 0-spread, 0, halo.getMinU(), halo.getMinV());
t.addVertexWithUV(0-spread, 16+spread, 0, halo.getMinU(), halo.getMaxV());
t.addVertexWithUV(16+spread, 16+spread, 0, halo.getMaxU(), halo.getMaxV());
t.addVertexWithUV(16+spread, 0-spread, 0, halo.getMaxU(), halo.getMinV());
t.draw();
}
if (renderPulse) {
GL11.glPushMatrix();
double xs = (rand.nextGaussian() * 0.15) + 0.95;
double ox = (1-xs)/2.0;
GL11.glEnable(GL11.GL_BLEND);
GL11.glTranslated(ox*16.0, ox*16.0, 1.0);
GL11.glScaled(xs, xs, 1.0);
IIcon icon = item.getItem().getIcon(item, 0);
t.startDrawingQuads();
t.setColorRGBA_F(1.0f, 1.0f, 1.0f, 0.6f);
t.addVertexWithUV(0-ox, 0-ox, 0, icon.getMinU(), icon.getMinV());
t.addVertexWithUV(0-ox, 16+ox, 0, icon.getMinU(), icon.getMaxV());
t.addVertexWithUV(16+ox, 16+ox, 0, icon.getMaxU(), icon.getMaxV());
t.addVertexWithUV(16+ox, 0-ox, 0, icon.getMaxU(), icon.getMinV());
t.draw();
GL11.glPopMatrix();
}
r.renderItemIntoGUI(mc.fontRenderer, mc.getTextureManager(), item, 0, 0, true);
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glEnable(GL11.GL_DEPTH_TEST);
r.renderWithColor = true;
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
//middle?
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
RenderHelper.enableGUIStandardItemLighting();
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glDisable(GL11.GL_DEPTH_TEST);
r.renderItemIntoGUI(mc.fontRenderer, mc.getTextureManager(), item, 0, 0, true);
if (item.getItem() instanceof ICosmicRenderItem) {
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
RenderHelper.enableGUIStandardItemLighting();
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glDisable(GL11.GL_DEPTH_TEST);
ICosmicRenderItem icri = (ICosmicRenderItem)(item.getItem());
CosmicRenderStuffs.cosmicOpacity = icri.getMaskMultiplier(item, null);
CosmicRenderStuffs.inventoryRender = true;
CosmicRenderStuffs.useShader();
IIcon cosmicicon = icri.getMaskTexture(item, null);
GL11.glColor4d(1, 1, 1, 1);
float minu = cosmicicon.getMinU();
float maxu = cosmicicon.getMaxU();
float minv = cosmicicon.getMinV();
float maxv = cosmicicon.getMaxV();
t.startDrawingQuads();
t.addVertexWithUV(0, 0, 0, minu, minv);
t.addVertexWithUV(0, 16, 0, minu, maxv);
t.addVertexWithUV(16, 16, 0, maxu, maxv);
t.addVertexWithUV(16, 0, 0, maxu, minv);
t.draw();
CosmicRenderStuffs.releaseShader();
CosmicRenderStuffs.inventoryRender = false;
}
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glEnable(GL11.GL_DEPTH_TEST);
r.renderWithColor = true;
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
break;
}
default : break;
}
//ShaderHelper.releaseShader();
//Lumberjack.log(Level.INFO, light+"");
}
public void render(ItemStack item, EntityPlayer player) {
int passes = 1;
if (item.getItem().requiresMultipleRenderPasses())
{
passes = item.getItem().getRenderPasses(item.getItemDamage());
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
return helper == ItemRendererHelper.ENTITY_ROTATION || helper == ItemRendererHelper.ENTITY_BOBBING;
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
boolean renderHalo = false;
boolean renderPulse = false;
int spread = 0;
IIcon halo = null;
int haloColour = 0;
net.minecraft.item.Item itype = item.getItem();
if (itype instanceof IHaloRenderItem) {
IHaloRenderItem ihri = (IHaloRenderItem) itype;
spread = ihri.getHaloSize(item);
halo = ihri.getHaloTexture(item);
haloColour = ihri.getHaloColour(item);
renderHalo = ihri.drawHalo(item);
renderPulse = ihri.drawPulseEffect(item);
}
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glColor4f(1F, 1F, 1F, 1F);
//ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), scale);
float r,g,b;
IIcon icon;
float f,f1,f2,f3;
float scale = 1F / 16F;
RenderItem r = RenderItem.getInstance();
Minecraft mc = Minecraft.getMinecraft();
Tessellator t = Tessellator.instance;
this.processLightLevel(type, item, data);
// ShaderHelper.useShader(ShaderHelper.testShader, this.shaderCallback);
switch (type) {
case ENTITY: {
GL11.glPushMatrix();
GL11.glTranslatef(-0.5F, 0F, 0F);
if (item.isOnItemFrame()) GL11.glTranslatef(0F, -0.3F, 0.01F);
render(item, null);
GL11.glPopMatrix();
//Lumberjack.log(Level.INFO, "passes: "+passes);
for (int i = 0; i < passes; i++)
{
icon = this.getStackIcon(item, i, player);
//Lumberjack.log(Level.INFO, "icon "+i+": "+icon);
break;
}
case EQUIPPED: {
render(item, data[1] instanceof EntityPlayer ? (EntityPlayer) data[1] : null);
break;
}
case EQUIPPED_FIRST_PERSON: {
render(item, data[1] instanceof EntityPlayer ? (EntityPlayer) data[1] : null);
break;
}
case INVENTORY: {
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
RenderHelper.enableGUIStandardItemLighting();
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glDisable(GL11.GL_DEPTH_TEST);
if (renderHalo) {
float ca = (float) (haloColour >> 24 & 255) / 255.0F;
float cr = (float) (haloColour >> 16 & 255) / 255.0F;
float cg = (float) (haloColour >> 8 & 255) / 255.0F;
float cb = (float) (haloColour & 255) / 255.0F;
GL11.glColor4f(cr, cg, cb, ca);
t.startDrawingQuads();
t.addVertexWithUV(0 - spread, 0 - spread, 0, halo.getMinU(), halo.getMinV());
t.addVertexWithUV(0 - spread, 16 + spread, 0, halo.getMinU(), halo.getMaxV());
t.addVertexWithUV(16 + spread, 16 + spread, 0, halo.getMaxU(), halo.getMaxV());
t.addVertexWithUV(16 + spread, 0 - spread, 0, halo.getMaxU(), halo.getMinV());
t.draw();
}
if (renderPulse) {
GL11.glPushMatrix();
double xs = (rand.nextGaussian() * 0.15) + 0.95;
double ox = (1 - xs) / 2.0;
GL11.glEnable(GL11.GL_BLEND);
GL11.glTranslated(ox * 16.0, ox * 16.0, 1.0);
GL11.glScaled(xs, xs, 1.0);
IIcon icon = item.getItem().getIcon(item, 0);
t.startDrawingQuads();
t.setColorRGBA_F(1.0f, 1.0f, 1.0f, 0.6f);
t.addVertexWithUV(0 - ox, 0 - ox, 0, icon.getMinU(), icon.getMinV());
t.addVertexWithUV(0 - ox, 16 + ox, 0, icon.getMinU(), icon.getMaxV());
t.addVertexWithUV(16 + ox, 16 + ox, 0, icon.getMaxU(), icon.getMaxV());
t.addVertexWithUV(16 + ox, 0 - ox, 0, icon.getMaxU(), icon.getMinV());
t.draw();
GL11.glPopMatrix();
}
r.renderItemIntoGUI(mc.fontRenderer, mc.getTextureManager(), item, 0, 0, true);
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glEnable(GL11.GL_DEPTH_TEST);
r.renderWithColor = true;
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
// middle?
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
RenderHelper.enableGUIStandardItemLighting();
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glDisable(GL11.GL_DEPTH_TEST);
r.renderItemIntoGUI(mc.fontRenderer, mc.getTextureManager(), item, 0, 0, true);
if (item.getItem() instanceof ICosmicRenderItem) {
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
RenderHelper.enableGUIStandardItemLighting();
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glDisable(GL11.GL_DEPTH_TEST);
ICosmicRenderItem icri = (ICosmicRenderItem) (item.getItem());
CosmicRenderStuffs.cosmicOpacity = icri.getMaskMultiplier(item, null);
CosmicRenderStuffs.inventoryRender = true;
CosmicRenderStuffs.useShader();
IIcon cosmicicon = icri.getMaskTexture(item, null);
GL11.glColor4d(1, 1, 1, 1);
float minu = cosmicicon.getMinU();
float maxu = cosmicicon.getMaxU();
float minv = cosmicicon.getMinV();
float maxv = cosmicicon.getMaxV();
t.startDrawingQuads();
t.addVertexWithUV(0, 0, 0, minu, minv);
t.addVertexWithUV(0, 16, 0, minu, maxv);
t.addVertexWithUV(16, 16, 0, maxu, maxv);
t.addVertexWithUV(16, 0, 0, maxu, minv);
t.draw();
CosmicRenderStuffs.releaseShader();
CosmicRenderStuffs.inventoryRender = false;
}
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glEnable(GL11.GL_DEPTH_TEST);
r.renderWithColor = true;
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
break;
}
default:
break;
}
// ShaderHelper.releaseShader();
// Lumberjack.log(Level.INFO, light+"");
}
public void render(ItemStack item, EntityPlayer player) {
int passes = 1;
if (item.getItem().requiresMultipleRenderPasses()) {
passes = item.getItem().getRenderPasses(item.getItemDamage());
}
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glColor4f(1F, 1F, 1F, 1F);
// ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(),
// scale);
float r, g, b;
IIcon icon;
float f, f1, f2, f3;
float scale = 1F / 16F;
// Lumberjack.log(Level.INFO, "passes: "+passes);
for (int i = 0; i < passes; i++) {
icon = this.getStackIcon(item, i, player);
// Lumberjack.log(Level.INFO, "icon "+i+": "+icon);
f = icon.getMinU();
f1 = icon.getMaxU();
f2 = icon.getMinV();
f3 = icon.getMaxV();
f = icon.getMinU();
f1 = icon.getMaxU();
f2 = icon.getMinV();
f3 = icon.getMaxV();
int colour = item.getItem().getColorFromItemStack(item, i);
r = (float)(colour & 255) / 255.0F;
g = (float)(colour & 255) / 255.0F;
b = (float)(colour & 255) / 255.0F;
r = (float) (colour & 255) / 255.0F;
g = (float) (colour & 255) / 255.0F;
b = (float) (colour & 255) / 255.0F;
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), scale);
ItemRenderer.renderItemIn2D(
Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), scale);
}
if (item.getItem() instanceof ICosmicRenderItem) {
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glDepthFunc(GL11.GL_EQUAL);
ICosmicRenderItem icri = (ICosmicRenderItem)(item.getItem());
CosmicRenderStuffs.cosmicOpacity = icri.getMaskMultiplier(item, player);
CosmicRenderStuffs.useShader();
IIcon cosmicicon = icri.getMaskTexture(item, player);
float minu = cosmicicon.getMinU();
float maxu = cosmicicon.getMaxU();
float minv = cosmicicon.getMinV();
float maxv = cosmicicon.getMaxV();
ItemRenderer.renderItemIn2D(Tessellator.instance, maxu, minv, minu, maxv, cosmicicon.getIconWidth(), cosmicicon.getIconHeight(), scale);
CosmicRenderStuffs.releaseShader();
GL11.glDepthFunc(GL11.GL_LEQUAL);
GL11.glEnable(GL11.GL_ALPHA_TEST);
}
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
GL11.glColor4f(1F, 1F, 1F, 1F);
}
if (item.getItem() instanceof ICosmicRenderItem) {
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glDepthFunc(GL11.GL_EQUAL);
ICosmicRenderItem icri = (ICosmicRenderItem) (item.getItem());
CosmicRenderStuffs.cosmicOpacity = icri.getMaskMultiplier(item, player);
CosmicRenderStuffs.useShader();
public void processLightLevel(ItemRenderType type, ItemStack item, Object... data) {
switch(type) {
case ENTITY : {
EntityItem ent = (EntityItem)(data[1]);
if (ent != null) {
CosmicRenderStuffs.setLightFromLocation(ent.worldObj, MathHelper.floor_double(ent.posX), MathHelper.floor_double(ent.posY), MathHelper.floor_double(ent.posZ));
}
break;
}
case EQUIPPED : {
EntityLivingBase ent = (EntityLivingBase)(data[1]);
if (ent != null) {
CosmicRenderStuffs.setLightFromLocation(ent.worldObj, MathHelper.floor_double(ent.posX), MathHelper.floor_double(ent.posY), MathHelper.floor_double(ent.posZ));
}
break;
}
case EQUIPPED_FIRST_PERSON : {
EntityLivingBase ent = (EntityLivingBase)(data[1]);
if (ent != null) {
CosmicRenderStuffs.setLightFromLocation(ent.worldObj, MathHelper.floor_double(ent.posX), MathHelper.floor_double(ent.posY), MathHelper.floor_double(ent.posZ));
}
break;
}
case INVENTORY: {
CosmicRenderStuffs.setLightLevel(1.2f);
return;
}
default : {
CosmicRenderStuffs.setLightLevel(1.0f);
return;
}
}
}
public IIcon getStackIcon(ItemStack stack, int pass, EntityPlayer player) {
return stack.getItem().getIcon(stack, pass);
}
IIcon cosmicicon = icri.getMaskTexture(item, player);
float minu = cosmicicon.getMinU();
float maxu = cosmicicon.getMaxU();
float minv = cosmicicon.getMinV();
float maxv = cosmicicon.getMaxV();
ItemRenderer.renderItemIn2D(
Tessellator.instance,
maxu,
minv,
minu,
maxv,
cosmicicon.getIconWidth(),
cosmicicon.getIconHeight(),
scale);
CosmicRenderStuffs.releaseShader();
GL11.glDepthFunc(GL11.GL_LEQUAL);
GL11.glEnable(GL11.GL_ALPHA_TEST);
}
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
GL11.glColor4f(1F, 1F, 1F, 1F);
}
public void processLightLevel(ItemRenderType type, ItemStack item, Object... data) {
switch (type) {
case ENTITY: {
EntityItem ent = (EntityItem) (data[1]);
if (ent != null) {
CosmicRenderStuffs.setLightFromLocation(
ent.worldObj,
MathHelper.floor_double(ent.posX),
MathHelper.floor_double(ent.posY),
MathHelper.floor_double(ent.posZ));
}
break;
}
case EQUIPPED: {
EntityLivingBase ent = (EntityLivingBase) (data[1]);
if (ent != null) {
CosmicRenderStuffs.setLightFromLocation(
ent.worldObj,
MathHelper.floor_double(ent.posX),
MathHelper.floor_double(ent.posY),
MathHelper.floor_double(ent.posZ));
}
break;
}
case EQUIPPED_FIRST_PERSON: {
EntityLivingBase ent = (EntityLivingBase) (data[1]);
if (ent != null) {
CosmicRenderStuffs.setLightFromLocation(
ent.worldObj,
MathHelper.floor_double(ent.posX),
MathHelper.floor_double(ent.posY),
MathHelper.floor_double(ent.posZ));
}
break;
}
case INVENTORY: {
CosmicRenderStuffs.setLightLevel(1.2f);
return;
}
default: {
CosmicRenderStuffs.setLightLevel(1.0f);
return;
}
}
}
public IIcon getStackIcon(ItemStack stack, int pass, EntityPlayer player) {
return stack.getItem().getIcon(stack, pass);
}
}
@@ -1,6 +1,5 @@
package singulariteam.eternalsingularity.render;
public abstract class ShaderCallback
{
public abstract void call(int paramInt);
public abstract class ShaderCallback {
public abstract void call(int paramInt);
}
@@ -1,169 +1,156 @@
package singulariteam.eternalsingularity.render;
//import fox.spiteful.avaritia.Lumberjack;
// import fox.spiteful.avaritia.Lumberjack;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
import org.apache.logging.log4j.Level;
import org.lwjgl.opengl.ARBFragmentShader;
import org.lwjgl.opengl.ARBShaderObjects;
import org.lwjgl.opengl.ARBVertexShader;
import org.lwjgl.opengl.GL11;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
public final class ShaderHelper {
private static final int VERT = ARBVertexShader.GL_VERTEX_SHADER_ARB;
private static final int FRAG = ARBFragmentShader.GL_FRAGMENT_SHADER_ARB;
private static final String PREFIX = "/assets/eternalsingularity/shader/";
private static final int VERT = ARBVertexShader.GL_VERTEX_SHADER_ARB;
private static final int FRAG = ARBFragmentShader.GL_FRAGMENT_SHADER_ARB;
private static final String PREFIX = "/assets/eternalsingularity/shader/";
public static int cosmicShader = 0;
public static int cosmicShader = 0;
public static void initShaders() {
if(!useShaders())
return;
cosmicShader = createProgram("cosmic.vert", "cosmic.frag");
}
public static void initShaders() {
if (!useShaders()) return;
public static void useShader(int shader, ShaderCallback callback) {
if(!useShaders())
return;
cosmicShader = createProgram("cosmic.vert", "cosmic.frag");
}
ARBShaderObjects.glUseProgramObjectARB(shader);
public static void useShader(int shader, ShaderCallback callback) {
if (!useShaders()) return;
if(shader != 0) {
int time = ARBShaderObjects.glGetUniformLocationARB(shader, "time");
Minecraft mc = Minecraft.getMinecraft();
if (mc.thePlayer != null && mc.thePlayer.worldObj != null) {
ARBShaderObjects.glUniform1iARB(time, (int)(mc.thePlayer.worldObj.getWorldTime() % Integer.MAX_VALUE));
}
ARBShaderObjects.glUseProgramObjectARB(shader);
if(callback != null)
callback.call(shader);
}
}
if (shader != 0) {
int time = ARBShaderObjects.glGetUniformLocationARB(shader, "time");
Minecraft mc = Minecraft.getMinecraft();
if (mc.thePlayer != null && mc.thePlayer.worldObj != null) {
ARBShaderObjects.glUniform1iARB(time, (int) (mc.thePlayer.worldObj.getWorldTime() % Integer.MAX_VALUE));
}
public static void useShader(int shader) {
useShader(shader, null);
}
if (callback != null) callback.call(shader);
}
}
public static void releaseShader() {
useShader(0);
}
public static void useShader(int shader) {
useShader(shader, null);
}
public static boolean useShaders() {
return OpenGlHelper.shadersSupported;
}
public static void releaseShader() {
useShader(0);
}
// Most of the code taken from the LWJGL wiki
// http://lwjgl.org/wiki/index.php?title=GLSL_Shaders_with_LWJGL
public static boolean useShaders() {
return OpenGlHelper.shadersSupported;
}
private static int createProgram(String vert, String frag) {
int vertId = 0, fragId = 0, program = 0;
if(vert != null)
vertId = createShader(PREFIX + vert, VERT);
if(frag != null)
fragId = createShader(PREFIX + frag, FRAG);
// Most of the code taken from the LWJGL wiki
// http://lwjgl.org/wiki/index.php?title=GLSL_Shaders_with_LWJGL
program = ARBShaderObjects.glCreateProgramObjectARB();
if(program == 0)
return 0;
private static int createProgram(String vert, String frag) {
int vertId = 0, fragId = 0, program = 0;
if (vert != null) vertId = createShader(PREFIX + vert, VERT);
if (frag != null) fragId = createShader(PREFIX + frag, FRAG);
if(vert != null)
ARBShaderObjects.glAttachObjectARB(program, vertId);
if(frag != null)
ARBShaderObjects.glAttachObjectARB(program, fragId);
program = ARBShaderObjects.glCreateProgramObjectARB();
if (program == 0) return 0;
ARBShaderObjects.glLinkProgramARB(program);
if(ARBShaderObjects.glGetObjectParameteriARB(program, ARBShaderObjects.GL_OBJECT_LINK_STATUS_ARB) == GL11.GL_FALSE) {
//Lumberjack.log(Level.ERROR, getLogInfo(program));
return 0;
}
if (vert != null) ARBShaderObjects.glAttachObjectARB(program, vertId);
if (frag != null) ARBShaderObjects.glAttachObjectARB(program, fragId);
ARBShaderObjects.glValidateProgramARB(program);
if (ARBShaderObjects.glGetObjectParameteriARB(program, ARBShaderObjects.GL_OBJECT_VALIDATE_STATUS_ARB) == GL11.GL_FALSE) {
//Lumberjack.log(Level.ERROR, getLogInfo(program));
return 0;
}
ARBShaderObjects.glLinkProgramARB(program);
if (ARBShaderObjects.glGetObjectParameteriARB(program, ARBShaderObjects.GL_OBJECT_LINK_STATUS_ARB)
== GL11.GL_FALSE) {
// Lumberjack.log(Level.ERROR, getLogInfo(program));
return 0;
}
return program;
}
ARBShaderObjects.glValidateProgramARB(program);
if (ARBShaderObjects.glGetObjectParameteriARB(program, ARBShaderObjects.GL_OBJECT_VALIDATE_STATUS_ARB)
== GL11.GL_FALSE) {
// Lumberjack.log(Level.ERROR, getLogInfo(program));
return 0;
}
private static int createShader(String filename, int shaderType){
int shader = 0;
try {
shader = ARBShaderObjects.glCreateShaderObjectARB(shaderType);
return program;
}
if(shader == 0)
return 0;
private static int createShader(String filename, int shaderType) {
int shader = 0;
try {
shader = ARBShaderObjects.glCreateShaderObjectARB(shaderType);
ARBShaderObjects.glShaderSourceARB(shader, readFileAsString(filename));
ARBShaderObjects.glCompileShaderARB(shader);
if (shader == 0) return 0;
if (ARBShaderObjects.glGetObjectParameteriARB(shader, ARBShaderObjects.GL_OBJECT_COMPILE_STATUS_ARB) == GL11.GL_FALSE)
throw new RuntimeException("Error creating shader \""+filename+"\": " + getLogInfo(shader));
ARBShaderObjects.glShaderSourceARB(shader, readFileAsString(filename));
ARBShaderObjects.glCompileShaderARB(shader);
return shader;
}
catch(Exception e) {
ARBShaderObjects.glDeleteObjectARB(shader);
e.printStackTrace();
return -1;
}
}
if (ARBShaderObjects.glGetObjectParameteriARB(shader, ARBShaderObjects.GL_OBJECT_COMPILE_STATUS_ARB)
== GL11.GL_FALSE)
throw new RuntimeException("Error creating shader \"" + filename + "\": " + getLogInfo(shader));
private static String getLogInfo(int obj) {
return ARBShaderObjects.glGetInfoLogARB(obj, ARBShaderObjects.glGetObjectParameteriARB(obj, ARBShaderObjects.GL_OBJECT_INFO_LOG_LENGTH_ARB));
}
return shader;
} catch (Exception e) {
ARBShaderObjects.glDeleteObjectARB(shader);
e.printStackTrace();
return -1;
}
}
private static String readFileAsString(String filename) throws Exception {
StringBuilder source = new StringBuilder();
InputStream in = ShaderHelper.class.getResourceAsStream(filename);
Exception exception = null;
BufferedReader reader;
private static String getLogInfo(int obj) {
return ARBShaderObjects.glGetInfoLogARB(
obj, ARBShaderObjects.glGetObjectParameteriARB(obj, ARBShaderObjects.GL_OBJECT_INFO_LOG_LENGTH_ARB));
}
if(in == null)
return "";
private static String readFileAsString(String filename) throws Exception {
StringBuilder source = new StringBuilder();
InputStream in = ShaderHelper.class.getResourceAsStream(filename);
Exception exception = null;
BufferedReader reader;
try {
reader = new BufferedReader(new InputStreamReader(in, "UTF-8"));
if (in == null) return "";
Exception innerExc= null;
try {
String line;
while((line = reader.readLine()) != null)
source.append(line).append('\n');
} catch(Exception exc) {
exception = exc;
} finally {
try {
reader.close();
} catch(Exception exc) {
if(innerExc == null)
innerExc = exc;
else exc.printStackTrace();
}
}
try {
reader = new BufferedReader(new InputStreamReader(in, "UTF-8"));
if(innerExc != null)
throw innerExc;
} catch(Exception exc) {
exception = exc;
} finally {
try {
in.close();
} catch(Exception exc) {
if(exception == null)
exception = exc;
else exc.printStackTrace();
}
Exception innerExc = null;
try {
String line;
while ((line = reader.readLine()) != null) source.append(line).append('\n');
} catch (Exception exc) {
exception = exc;
} finally {
try {
reader.close();
} catch (Exception exc) {
if (innerExc == null) innerExc = exc;
else exc.printStackTrace();
}
}
if(exception != null)
throw exception;
}
if (innerExc != null) throw innerExc;
} catch (Exception exc) {
exception = exc;
} finally {
try {
in.close();
} catch (Exception exc) {
if (exception == null) exception = exc;
else exc.printStackTrace();
}
return source.toString();
}
}
if (exception != null) throw exception;
}
return source.toString();
}
}
+18 -12
View File
@@ -1,15 +1,21 @@
[
{
"modid": "eternalsingularity",
"name": "Eternal Singularity",
"description": "A Mod that Adds an Eternal Singularity! (That Works as a Singularity Binder)",
"version": "1.0.4b",
"mcversion": "1.7.10",
"url": "https://minecraft.curseforge.com/projects/eternal-singularity",
"updateUrl": "",
"authorList": ["RCXcrafter, WanionCane, Wealthyturtle"],
"logoFile": "EternalSingularityLogo.png",
"screenshots": [],
"dependencies": []
"modListVersion": 2,
"modList": [{
"modid": "${modId}",
"name": "${modName}",
"version": "${modVersion}",
"mcversion": "${minecraftVersion}",
"url": "https://github.com/SinTh0r4s/MyMod",
"updateUrl": "",
"authorList": ["SinTho0r4s"],
"credits": "",
"logoFile": "",
"screenshots": [],
"parent": "",
"requiredMods": [],
"dependencies": [],
"dependants": [],
"useDependencyInformation": true
}]
}
]
+30
View File
@@ -0,0 +1,30 @@
printf("Configuring spotless\n")
// Spotless autoformatter
// See https://github.com/diffplug/spotless/tree/main/plugin-gradle
// Can be locally toggled via spotless:off/spotless:on comments
spotless {
encoding 'UTF-8'
format 'misc', {
target '.gitignore'
trimTrailingWhitespace()
indentWithSpaces(4)
endWithNewline()
}
java {
toggleOffOn()
importOrder()
removeUnusedImports()
palantirJavaFormat('1.1.0') // last version supporting jvm 8
}
kotlin {
toggleOffOn()
ktfmt('0.39')
trimTrailingWhitespace()
indentWithSpaces(4)
endWithNewline()
}
}