Compare commits

...
26 Commits
Author SHA1 Message Date
Sunnyandboubou19 cdc57215e3 Fix blurriness and flickering caused by PlacedItem list caching by removing it (#112)
Co-authored-by: boubou19 <miisterunknown@gmail.com>
2026-10-25 09:11:47 +00:00
Marlo Greisser 9f42531f37 Solegnolia applies to dislocators (#114) 2026-10-04 16:00:00 +02:00
boubou19andUltraProdigy 95453b430e avoid global resource refresh when downloading the missing assets (#111)
Co-authored-by: UltraProdigy <187078471+UltraProdigy@users.noreply.github.com>
2026-08-17 05:59:32 +00:00
boubou19andgithub-actions[bot] 3635266bd5 Cache enum .values() (#109)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-08-10 21:05:47 +02:00
boubou19 fedee1ba43 Reduce render load of DE placed items (#108) 2026-08-08 23:26:18 +02:00
Jason Mitchell 6f183b615e Move the bindTexture out of the display list (#107) 2026-07-16 11:14:38 -05:00
__felix__ 15b257d120 Add NHLib dep to @Mod (#104) 2026-07-10 07:19:34 +02:00
ABKQPO 4ead9f53fb fix shield hud and bow matching rules (#102) 2026-07-06 18:28:03 +02:00
Algent 305e09ae4f Add API to get nearby ChaosIsland coordinate (#103) 2026-06-08 16:06:52 +02:00
Alexdoru 9009b1372a prevent dedicated server crash (#100) 2026-05-05 03:51:45 -04:00
8dc27474ec Update zh-CN.lang (#83)
Co-authored-by: Martin Robertz <dream-master@gmx.net>
Co-authored-by: Nana-Sakura <60061683+Nana-Sakura@users.noreply.github.com>
2026-05-01 10:59:25 +02:00
Martin Robertz 4c016707a4 update 2026-04-26 11:58:25 +02:00
Ranzu abbe4c1017 Localizaton of elements and gui adjustements (#96) 2026-04-26 11:55:15 +02:00
Alexdoru c067e59981 Properly use client / common proxies to fix memory leaks (#97) 2026-04-25 18:58:07 +02:00
Alexdoru 7f87295901 Avoid instantiating EntityItem in the render loop (#99) 2026-04-25 17:22:01 +02:00
Alexdoru e564437ed7 Add config to disable earth block (#98) 2026-04-24 13:47:53 +02:00
Martin Robertz f483529855 update+gradle+bs+deps 2026-04-03 16:14:33 +02:00
__felix__ da451de69f Add redstone + hopper automation (w/ XP jar draining) (#95) 2026-04-01 23:54:05 -04:00
UltraProdigy 8b8082cd7b Optimize Image & Workflow (#94) 2026-03-07 10:28:16 +01:00
92c2bacc74 Fix Draconic Armor offhand rendering (#88)
Co-authored-by: Martin Robertz <dream-master@gmx.net>
Co-authored-by: Ruling-0 <47913168+Ruling-0@users.noreply.github.com>
2026-02-14 08:18:50 +00:00
7620d7ff02 BrandonCore deprecation (#86)
Co-authored-by: Connor Colenso <colen@CONNORSPC>
Co-authored-by: Martin Robertz <dream-master@gmx.net>
Co-authored-by: Ruling-0 <47913168+Ruling-0@users.noreply.github.com>
2026-02-14 01:57:20 -06:00
Zifan LiandRuling-0 bd995e6d5a Sync zh-CN.lang with ParaTranz project (#91)
Co-authored-by: Ruling-0 <47913168+Ruling-0@users.noreply.github.com>
2026-02-09 08:28:38 +01:00
Zifan Li 05ebbf6936 Fix lore formatting for wyvern and draconic items (#89) 2026-02-05 04:33:54 +00:00
Ruling-0 51b047c1eb Update Buildscript (#90) 2026-02-04 22:29:31 -06:00
Yurii 245b5c7b06 Fix nullPointerException (#87) 2026-01-30 07:37:05 +01:00
SuperSouprandSuper 7ada07b5ac Add block blacklist for magnets (#80)
Co-authored-by: Super <26164930+EmperorSuper@users.noreply.github.com>
2026-01-24 20:15:24 +01:00
486 changed files with 5813 additions and 2645 deletions

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
name: Optimize images
on:
pull_request:
branches: [ master, main, release/** ]
paths:
- "**/*.png"
push:
branches: [ master, main, release/** ]
paths:
- "**/*.png"
jobs:
optimize-images:
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/optimize-images.yml@master
secrets: inherit
+13 -8
View File
@@ -1,18 +1,23 @@
// Add your dependencies here // Add your dependencies here
dependencies { dependencies {
api("com.github.GTNewHorizons:BrandonsCore:1.2.0-GTNH:dev")
api("curse.maven:cofh-lib-220333:2388748") api("curse.maven:cofh-lib-220333:2388748")
api("com.github.GTNewHorizons:GTNHLib:0.9.53:dev")
compileOnly("com.github.GTNewHorizons:ForestryMC:4.11.2:api") {transitive = false} compileOnly("com.github.GTNewHorizons:ForestryMC:4.11.14:api") {transitive = false}
compileOnly("com.github.GTNewHorizons:OpenComputers:1.12.4-GTNH:api") {transitive = false} compileOnly("com.github.GTNewHorizons:OpenComputers:1.12.38-GTNH:api") {transitive = false}
compileOnly("com.github.GTNewHorizons:NotEnoughItems:2.8.39-GTNH:dev") {transitive = false} compileOnly("com.github.GTNewHorizons:NotEnoughItems:2.8.93-GTNH:dev") {transitive = false}
compileOnly("com.github.GTNewHorizons:CodeChickenCore:1.4.8:dev") {transitive = false} compileOnly("com.github.GTNewHorizons:CodeChickenCore:1.4.12:dev") {transitive = false}
compileOnly("com.github.GTNewHorizons:inventory-tweaks:1.7.1:dev") {transitive = false} compileOnly("com.github.GTNewHorizons:inventory-tweaks:1.7.1:dev") {transitive = false}
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.2.2-GTNH:dev') {transitive = false} compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.2.11-GTNH:dev') {transitive = false}
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.52.117:dev") {transitive = false} compileOnly("com.github.GTNewHorizons:Botania:1.13.36-GTNH:dev") {transitive = false}
compileOnly("com.github.GTNewHorizons:GTNHLib:0.8.9:dev") {transitive = false} compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.52.461:dev") {transitive = false}
compileOnly("com.github.GTNewHorizons:Backhand:1.8.8:dev") {transitive = false}
compileOnly("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev") {transitive = false} compileOnly("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev") {transitive = false}
compileOnly("curse.maven:computercraft-67504:2269339") {transitive = false} compileOnly("curse.maven:computercraft-67504:2269339") {transitive = false}
compileOnly('curse.maven:automagy-222153:2285272')
compileOnly('com.github.GTNewHorizons:EnderIO:2.10.25:dev')
runtimeOnly("com.github.GTNewHorizons:NotEnoughItems:2.8.118-GTNH:dev")
} }
+35 -3
View File
@@ -39,9 +39,33 @@ remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/co
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE. # `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
developmentEnvironmentUserName = Developer developmentEnvironmentUserName = Developer
# Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8. # Enables modern Java syntax support. Valid values:
# See https://github.com/bsideup/jabel for details on how this works. # - false: No modern syntax, Java 8 only
enableModernJavaSyntax = true # - jabel: Jabel syntax-only support, compiles to J8 bytecode
# - jvmDowngrader: Full modern Java via JVM Downgrader (syntax + stdlib APIs)
# - modern: Native modern Java bytecode, no downgrading
enableModernJavaSyntax = jabel
# If set, ignores the above setting and compiles with the given toolchain. This may cause unexpected issues,
# and should *not* be used in most situations. -1 disables this.
# forceToolchainVersion = -1
# Target JVM version for JVM Downgrader bytecode downgrading.
# Only used when enableModernJavaSyntax = jvmDowngrader
# downgradeTargetVersion = 8
# Comma-separated list of Java versions for multi-release jar support (JVM Downgrader only).
# Classes will be available in META-INF/versions/N/ for each version N in this list.
# Default: "21,25" (J25+ gets native classes, J21-24 gets partial downgrade, J8-20 gets full downgrade).
# jvmDowngraderMultiReleaseVersions = 21,25
# Specifies how JVM Downgrader API stubs are provided. Options:
# - shade: Shade minimized stubs into the jar
# - gtnhlib: GTNHLib provides stubs at runtime (adds version constraint)
# - external: Another dependency provides stubs (no constraint, no warning)
# - (empty): Warning reminding you to configure stubs
# Note: 'shade' option requires you to verify license compliance, see: https://github.com/unimined/JvmDowngrader/blob/main/LICENSE.md
# jvmDowngraderStubsProvider =
# Enables injecting missing generics into the decompiled source code for a better coding experience. # Enables injecting missing generics into the decompiled source code for a better coding experience.
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types. # Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
@@ -162,6 +186,11 @@ modrinthRelations =
# Leave this empty if you don't want to publish on CurseForge. # Leave this empty if you don't want to publish on CurseForge.
curseForgeProjectId = curseForgeProjectId =
# Comma-separated supported CurseForge environments: client, server (case-insensitive).
# Use client or server for mods that only support one environment. Defaults to client,server.
# These tags describe where the mod can run, not whether installation is required on both sides.
curseForgeEnvironments = client,server
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge. # The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
# Syntax: type1:name1;type2:name2;... # Syntax: type1:name1;type2:name2;...
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible], # Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
@@ -209,3 +238,6 @@ customArchiveBaseName = Draconic-Evolution
# This is meant to be set in $HOME/.gradle/gradle.properties. # This is meant to be set in $HOME/.gradle/gradle.properties.
# ideaCheckSpotlessOnBuild = true # ideaCheckSpotlessOnBuild = true
# Non-GTNH properties
org.gradle.configuration-cache = true
org.gradle.parallel = true
+12
View File
@@ -0,0 +1,12 @@
#This file is generated by updateDaemonJvm
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/539ea72837c6244075f8ee037babc29e/redirect
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/876dbbf00bf4ef6190f7da074cee903a/redirect
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/539ea72837c6244075f8ee037babc29e/redirect
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/876dbbf00bf4ef6190f7da074cee903a/redirect
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/9064f22734b42ac03e85df04b632e167/redirect
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/4d0277c49991306ac78048580fe34bcf/redirect
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/539ea72837c6244075f8ee037babc29e/redirect
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/876dbbf00bf4ef6190f7da074cee903a/redirect
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/a9fa3b809e484a1e1ac4308a5dda661a/redirect
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/aa99913fa6d767d899ffc96082da01ca/redirect
toolchainVersion=25
Binary file not shown.
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.1-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
Vendored
+3 -6
View File
@@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# #
# Copyright © 2015-2021 the original authors. # Copyright © 2015 the original authors.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@@ -57,7 +57,7 @@
# Darwin, MinGW, and NonStop. # Darwin, MinGW, and NonStop.
# #
# (3) This script is generated from the Groovy template # (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # https://github.com/gradle/gradle/blob/b631911858264c0b6e4d6603d677ff5218766cee/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project. # within the Gradle project.
# #
# You can find Gradle at https://github.com/gradle/gradle/. # You can find Gradle at https://github.com/gradle/gradle/.
@@ -114,7 +114,6 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;; NONSTOP* ) nonstop=true ;;
esac esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM. # Determine the Java command to use to start the JVM.
@@ -172,7 +171,6 @@ fi
# For Cygwin or MSYS, switch paths to Windows format before running java # For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" ) JAVACMD=$( cygpath --unix "$JAVACMD" )
@@ -212,8 +210,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
set -- \ set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \ "-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \ -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
org.gradle.wrapper.GradleWrapperMain \
"$@" "$@"
# Stop when "xargs" is not available. # Stop when "xargs" is not available.
Vendored
+1 -2
View File
@@ -70,11 +70,10 @@ goto fail
:execute :execute
@rem Setup the command line @rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle @rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end :end
@rem End local scope for the variables with windows NT shell @rem End local scope for the variables with windows NT shell
+1 -1
View File
@@ -17,7 +17,7 @@ pluginManagement {
} }
plugins { plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.48' id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.34'
} }
@@ -3,18 +3,21 @@ package com.brandon3055.draconicevolution;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.Enchantment;
import com.brandon3055.draconicevolution.client.ClientProxy;
import com.brandon3055.draconicevolution.client.creativetab.DETab; import com.brandon3055.draconicevolution.client.creativetab.DETab;
import com.brandon3055.draconicevolution.common.CommonProxy; import com.brandon3055.draconicevolution.common.CommonProxy;
import com.brandon3055.draconicevolution.common.lib.OreDoublingRegistry; import com.brandon3055.draconicevolution.common.lib.OreDoublingRegistry;
import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.utills.LogHelper; import com.brandon3055.draconicevolution.common.utils.LogHelper;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms; import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStoppedEvent;
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
@Mod( @Mod(
@@ -25,13 +28,14 @@ import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
guiFactory = References.GUIFACTORY, guiFactory = References.GUIFACTORY,
dependencies = "after:NotEnoughItems;" + "after:ThermalExpansion;" dependencies = "after:NotEnoughItems;" + "after:ThermalExpansion;"
+ "after:ThermalFoundation;" + "after:ThermalFoundation;"
+ "required-after:BrandonsCore@[1.0.0.11,);") + "required-after:gtnhlib@[0.9.47,);")
public class DraconicEvolution { public class DraconicEvolution {
@Mod.Instance(References.MODID) @Mod.Instance(References.MODID)
public static DraconicEvolution instance; public static DraconicEvolution instance;
@SidedProxy(
@SidedProxy(clientSide = References.CLIENTPROXYLOCATION, serverSide = References.SERVERPROXYLOCATION) clientSide = "com.brandon3055.draconicevolution.client.ClientProxy",
serverSide = "com.brandon3055.draconicevolution.common.CommonProxy")
public static CommonProxy proxy; public static CommonProxy proxy;
public static CreativeTabs tabToolsWeapons = new DETab( public static CreativeTabs tabToolsWeapons = new DETab(
@@ -52,10 +56,20 @@ public class DraconicEvolution {
public static Enchantment reaperEnchant; public static Enchantment reaperEnchant;
public static final boolean isAutomagyLoaded = Loader.isModLoaded("Automagy");
public static final boolean isEioLoaded = Loader.isModLoaded("EnderIO");
public DraconicEvolution() { public DraconicEvolution() {
LogHelper.info("Hello Minecraft!!!"); LogHelper.info("Hello Minecraft!!!");
} }
public static ClientProxy clientProxy() {
if (proxy.isClient()) {
return ((ClientProxy) proxy);
}
throw new IllegalStateException("Accessed ClientProxy from dedicated server");
}
@Mod.EventHandler @Mod.EventHandler
public static void preInit(final FMLPreInitializationEvent event) { public static void preInit(final FMLPreInitializationEvent event) {
if (debug) LogHelper.info("Initialization"); if (debug) LogHelper.info("Initialization");
@@ -74,6 +88,12 @@ public class DraconicEvolution {
proxy.postInit(event); proxy.postInit(event);
} }
@Mod.EventHandler
public void onServerStopped(final FMLServerStoppedEvent event) {
if (debug) System.out.println("onServerStopped()");
proxy.onServerStopped(event);
}
@Mod.EventHandler @Mod.EventHandler
public void processMessage(FMLInterModComms.IMCEvent event) { public void processMessage(FMLInterModComms.IMCEvent event) {
for (FMLInterModComms.IMCMessage m : event.getMessages()) { for (FMLInterModComms.IMCMessage m : event.getMessages()) {
@@ -2,9 +2,13 @@ package com.brandon3055.draconicevolution.api;
import java.util.Random; import java.util.Random;
import javax.annotation.Nullable;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World; import net.minecraft.world.World;
import com.brandon3055.brandonscore.common.utills.DataUtills; import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.utils.DataUtils;
import com.brandon3055.draconicevolution.common.world.ChaosWorldGenHandler; import com.brandon3055.draconicevolution.common.world.ChaosWorldGenHandler;
import com.brandon3055.draconicevolution.common.world.DraconicWorldGenerator; import com.brandon3055.draconicevolution.common.world.DraconicWorldGenerator;
import com.brandon3055.draconicevolution.common.world.WorldGenEnderComet; import com.brandon3055.draconicevolution.common.world.WorldGenEnderComet;
@@ -43,12 +47,8 @@ public class GeneratorOverride {
*/ */
public static void generateChaosChunk(World world, int chunkX, int chunkZ, int centerX, int centerZ, public static void generateChaosChunk(World world, int chunkX, int chunkZ, int centerX, int centerZ,
Random random) { Random random) {
ChaosWorldGenHandler.generateChunk( ChaosWorldGenHandler
world, .generateChunk(world, chunkX, chunkZ, new DataUtils.XZPair<Integer, Integer>(centerX, centerZ), random);
chunkX,
chunkZ,
new DataUtills.XZPair<Integer, Integer>(centerX, centerZ),
random);
} }
/** /**
@@ -71,4 +71,25 @@ public class GeneratorOverride {
public static void setOreEnabledInEnd(boolean cometsEnabled) { public static void setOreEnabledInEnd(boolean cometsEnabled) {
DraconicWorldGenerator.oreEnabledInEnd = cometsEnabled; DraconicWorldGenerator.oreEnabledInEnd = cometsEnabled;
} }
/**
* Returns coordinates of the nearest chaos island for the given chunk, or {@code null}
* <p>
* This is for mods who need to know where chaos islands generate, for example to avoid overlapping their own world
* features.
*
* @param chunkX chunk X position
* @param chunkZ chunk Z position
* @return Chaos Island Center coordinates, or {@code null} if none generates for that cell
*/
public static @Nullable ChunkCoordinates getNearestChaosIslandCenter(int chunkX, int chunkZ) {
if (!DraconicWorldGenerator.chaosIslandsEnabled || !ConfigHandler.generateChaosIslands) return null;
DataUtils.XZPair<Integer, Integer> center = ChaosWorldGenHandler.getClosestChaosSpawn(chunkX, chunkZ);
// tHe island in (0, 0) is never generated
if (center.x == 0 && center.z == 0) return null;
return new ChunkCoordinates(center.x, 80, center.z);
}
} }
@@ -2,21 +2,30 @@ package com.brandon3055.draconicevolution.client;
import static com.brandon3055.draconicevolution.integration.nei.IMCForNEI.IMCSender; import static com.brandon3055.draconicevolution.integration.nei.IMCForNEI.IMCSender;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.ISound; import net.minecraft.client.audio.ISound;
import net.minecraft.client.particle.EntityFX; import net.minecraft.client.particle.EntityFX;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.world.WorldEvent;
import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.handler.ClientEventHandler; import com.brandon3055.draconicevolution.client.handler.ClientEventHandler;
import com.brandon3055.draconicevolution.client.handler.HudHandler; import com.brandon3055.draconicevolution.client.handler.HudHandler;
import com.brandon3055.draconicevolution.client.handler.ItemDisplayManager;
import com.brandon3055.draconicevolution.client.handler.ParticleHandler; import com.brandon3055.draconicevolution.client.handler.ParticleHandler;
import com.brandon3055.draconicevolution.client.handler.ResourceHandler; import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
import com.brandon3055.draconicevolution.client.keybinding.KeyBindings; import com.brandon3055.draconicevolution.client.handler.ShieldRenderHandler;
import com.brandon3055.draconicevolution.client.keybinding.KeyInputHandler; import com.brandon3055.draconicevolution.client.keybinding.KeyInputHandler;
import com.brandon3055.draconicevolution.client.render.IRenderTweak; import com.brandon3055.draconicevolution.client.render.IRenderTweak;
import com.brandon3055.draconicevolution.client.render.block.RenderCrystal; import com.brandon3055.draconicevolution.client.render.block.RenderCrystal;
@@ -78,6 +87,7 @@ import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.tileentities.TileChaosShard; import com.brandon3055.draconicevolution.common.tileentities.TileChaosShard;
import com.brandon3055.draconicevolution.common.tileentities.TileCustomSpawner; import com.brandon3055.draconicevolution.common.tileentities.TileCustomSpawner;
import com.brandon3055.draconicevolution.common.tileentities.TileDislocatorInhibitor;
import com.brandon3055.draconicevolution.common.tileentities.TileDissEnchanter; import com.brandon3055.draconicevolution.common.tileentities.TileDissEnchanter;
import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest; import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest;
import com.brandon3055.draconicevolution.common.tileentities.TileEnergyInfuser; import com.brandon3055.draconicevolution.common.tileentities.TileEnergyInfuser;
@@ -102,11 +112,22 @@ import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.network.FMLNetworkEvent;
public class ClientProxy extends CommonProxy { public final class ClientProxy extends CommonProxy {
private static final boolean debug = DraconicEvolution.debug; private static final boolean debug = DraconicEvolution.debug;
public static String downloadLocation;
private final Map<World, List<TileDislocatorInhibitor>> clientInhibitorsMap = new HashMap<>();
private ClientEventHandler clientHandler;
private KeyInputHandler keybindHandler;
private ItemDisplayManager itemDisplay;
private ShieldRenderHandler shieldRenderer;
public ClientProxy() {
FMLCommonHandler.instance().bus().register(this);
}
@Override @Override
public void preInit(FMLPreInitializationEvent event) { public void preInit(FMLPreInitializationEvent event) {
@@ -114,68 +135,29 @@ public class ClientProxy extends CommonProxy {
super.preInit(event); super.preInit(event);
ResourceHandler.init(event); ResourceHandler.init(event);
// downloadLocation = event.getModConfigurationDirectory().getParentFile().getAbsolutePath() +
// "/mods/derspack";
// downloadLocation = downloadLocation.replaceAll("\\\\", "/");
//
// File rescourcePack = new File(event.getModConfigurationDirectory().getParentFile(), "/mods/derspack");
//
//
// //File file = new File(downloadLocation);
// if (!rescourcePack.exists()) rescourcePack.mkdir();
//
// LogHelper.info("Downloading Images");
//
// try {
// URL url = new URL("http://i.imgur.com/oHRx1yQ.jpg");
// String fileName = url.getFile();
// //String destName = downloadLocation + fileName.substring(fileName.lastIndexOf("/"));
// File dll = new File(rescourcePack, fileName.substring(fileName.lastIndexOf("/")));
//
// InputStream is = url.openStream();
// OutputStream os = new FileOutputStream(dll);
//
// ByteStreams.copy(is, os);
//
// is.close();
// os.close();
// }catch (IOException e){
// LogHelper.info(e);
// }
//
//
// List defaultResourcePacks = Lists.newArrayList();
// Field f = ReflectionHelper.findField(Minecraft.class, "defaultResourcePacks", "field_110449_ao");
// f.setAccessible(true);
// try {
// defaultResourcePacks = (List)f.get(Minecraft.getMinecraft());
// defaultResourcePacks.add(new FolderResourcePack(rescourcePack));
// for (Object o : defaultResourcePacks){
// if (o instanceof FolderResourcePack) LogHelper.info(((FolderResourcePack) o).getPackName());
// if (o instanceof FileResourcePack) LogHelper.info(((FileResourcePack)o).getPackName());
// }
//
// f.set(Minecraft.getMinecraft(), defaultResourcePacks);
// }
// catch (IllegalAccessException e) {
// e.printStackTrace();
// }
} }
@Override @Override
public void init(FMLInitializationEvent event) { public void init(FMLInitializationEvent event) {
super.init(event); super.init(event);
FMLCommonHandler.instance().bus().register(new KeyInputHandler()); this.keybindHandler = new KeyInputHandler();
FMLCommonHandler.instance().bus().register(new ClientEventHandler()); FMLCommonHandler.instance().bus().register(this.keybindHandler);
MinecraftForge.EVENT_BUS.register(new HudHandler()); this.clientHandler = new ClientEventHandler();
MinecraftForge.EVENT_BUS.register(new ClientEventHandler()); FMLCommonHandler.instance().bus().register(this.clientHandler);
KeyBindings.init(); MinecraftForge.EVENT_BUS.register(this.clientHandler);
final HudHandler hudHandler = new HudHandler();
FMLCommonHandler.instance().bus().register(hudHandler);
MinecraftForge.EVENT_BUS.register(hudHandler);
registerRenderIDs(); registerRenderIDs();
registerRendering(); registerRendering();
ResourceHandler.instance.tick(null); ResourceHandler.instance.tick(null);
IMCSender(); IMCSender();
this.itemDisplay = new ItemDisplayManager(60);
FMLCommonHandler.instance().bus().register(this.itemDisplay);
MinecraftForge.EVENT_BUS.register(this.itemDisplay);
this.shieldRenderer = new ShieldRenderHandler();
FMLCommonHandler.instance().bus().register(this.shieldRenderer);
MinecraftForge.EVENT_BUS.register(this.shieldRenderer);
} }
@Override @Override
@@ -184,7 +166,24 @@ public class ClientProxy extends CommonProxy {
ResourceHandler.instance.tick(null); ResourceHandler.instance.tick(null);
} }
public void registerRendering() { @SubscribeEvent
public void onClientDisconnect(final FMLNetworkEvent.ClientDisconnectionFromServerEvent event) {
this.clientInhibitorsMap.clear();
this.itemDisplay.startDrawing(null);
}
@Override
@SubscribeEvent
public void onWorldUnload(WorldEvent.Unload event) {
if (event.world.isRemote) {
this.clientInhibitorsMap.remove(event.world);
} else {
super.onWorldUnload(event);
}
}
private void registerRendering() {
// spotless:off
// Item Renderers // Item Renderers
MinecraftForgeClient.registerItemRenderer(ModItems.wyvernBow, new RenderBow()); MinecraftForgeClient.registerItemRenderer(ModItems.wyvernBow, new RenderBow());
MinecraftForgeClient.registerItemRenderer(ModItems.draconicBow, new RenderBow()); MinecraftForgeClient.registerItemRenderer(ModItems.draconicBow, new RenderBow());
@@ -205,84 +204,29 @@ public class ClientProxy extends CommonProxy {
} }
if (!ConfigHandler.useOldD2DToolTextures) { if (!ConfigHandler.useOldD2DToolTextures) {
MinecraftForgeClient.registerItemRenderer( MinecraftForgeClient.registerItemRenderer(ModItems.draconicSword, new RenderTool("models/tools/DraconicSword.obj", "textures/models/tools/DraconicSword.png", (IRenderTweak) ModItems.draconicSword));
ModItems.draconicSword, MinecraftForgeClient.registerItemRenderer(ModItems.wyvernPickaxe, new RenderTool("models/tools/Pickaxe.obj", "textures/models/tools/Pickaxe.png", (IRenderTweak) ModItems.wyvernPickaxe));
new RenderTool( MinecraftForgeClient.registerItemRenderer(ModItems.draconicPickaxe, new RenderTool("models/tools/DraconicPickaxe.obj", "textures/models/tools/DraconicPickaxe.png", (IRenderTweak) ModItems.draconicPickaxe));
"models/tools/DraconicSword.obj", MinecraftForgeClient.registerItemRenderer(ModItems.draconicAxe, new RenderTool("models/tools/DraconicLumberAxe.obj", "textures/models/tools/DraconicLumberAxe.png", (IRenderTweak) ModItems.draconicAxe));
"textures/models/tools/DraconicSword.png", MinecraftForgeClient.registerItemRenderer(ModItems.wyvernShovel, new RenderTool("models/tools/Shovel.obj", "textures/models/tools/Shovel.png", (IRenderTweak) ModItems.wyvernShovel));
(IRenderTweak) ModItems.draconicSword)); MinecraftForgeClient.registerItemRenderer(ModItems.draconicShovel, new RenderTool("models/tools/DraconicShovel.obj", "textures/models/tools/DraconicShovel.png", (IRenderTweak) ModItems.draconicShovel));
MinecraftForgeClient.registerItemRenderer( MinecraftForgeClient.registerItemRenderer(ModItems.wyvernSword, new RenderTool("models/tools/Sword.obj", "textures/models/tools/Sword.png", (IRenderTweak) ModItems.wyvernSword));
ModItems.wyvernPickaxe, MinecraftForgeClient.registerItemRenderer(ModItems.draconicDestructionStaff, new RenderTool("models/tools/DraconicStaffOfPower.obj", "textures/models/tools/DraconicStaffOfPower.png", (IRenderTweak) ModItems.draconicDestructionStaff));
new RenderTool( MinecraftForgeClient.registerItemRenderer(ModItems.draconicHoe, new RenderTool("models/tools/DraconicHoe.obj", "textures/models/tools/DraconicHoe.png", (IRenderTweak) ModItems.draconicHoe));
"models/tools/Pickaxe.obj",
"textures/models/tools/Pickaxe.png",
(IRenderTweak) ModItems.wyvernPickaxe));
MinecraftForgeClient.registerItemRenderer(
ModItems.draconicPickaxe,
new RenderTool(
"models/tools/DraconicPickaxe.obj",
"textures/models/tools/DraconicPickaxe.png",
(IRenderTweak) ModItems.draconicPickaxe));
MinecraftForgeClient.registerItemRenderer(
ModItems.draconicAxe,
new RenderTool(
"models/tools/DraconicLumberAxe.obj",
"textures/models/tools/DraconicLumberAxe.png",
(IRenderTweak) ModItems.draconicAxe));
MinecraftForgeClient.registerItemRenderer(
ModItems.wyvernShovel,
new RenderTool(
"models/tools/Shovel.obj",
"textures/models/tools/Shovel.png",
(IRenderTweak) ModItems.wyvernShovel));
MinecraftForgeClient.registerItemRenderer(
ModItems.draconicShovel,
new RenderTool(
"models/tools/DraconicShovel.obj",
"textures/models/tools/DraconicShovel.png",
(IRenderTweak) ModItems.draconicShovel));
MinecraftForgeClient.registerItemRenderer(
ModItems.wyvernSword,
new RenderTool(
"models/tools/Sword.obj",
"textures/models/tools/Sword.png",
(IRenderTweak) ModItems.wyvernSword));
MinecraftForgeClient.registerItemRenderer(
ModItems.draconicDestructionStaff,
new RenderTool(
"models/tools/DraconicStaffOfPower.obj",
"textures/models/tools/DraconicStaffOfPower.png",
(IRenderTweak) ModItems.draconicDestructionStaff));
MinecraftForgeClient.registerItemRenderer(
ModItems.draconicHoe,
new RenderTool(
"models/tools/DraconicHoe.obj",
"textures/models/tools/DraconicHoe.png",
(IRenderTweak) ModItems.draconicHoe));
MinecraftForgeClient.registerItemRenderer(ModItems.draconicBow, new RenderBowModel(true)); MinecraftForgeClient.registerItemRenderer(ModItems.draconicBow, new RenderBowModel(true));
MinecraftForgeClient.registerItemRenderer(ModItems.wyvernBow, new RenderBowModel(false)); MinecraftForgeClient.registerItemRenderer(ModItems.wyvernBow, new RenderBowModel(false));
} }
MinecraftForgeClient MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.draconiumChest), new RenderDraconiumChest());
.registerItemRenderer(Item.getItemFromBlock(ModBlocks.draconiumChest), new RenderDraconiumChest()); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.particleGenerator), new RenderParticleGen());
MinecraftForgeClient MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.energyInfuser), new RenderEnergyInfuser());
.registerItemRenderer(Item.getItemFromBlock(ModBlocks.particleGenerator), new RenderParticleGen());
MinecraftForgeClient
.registerItemRenderer(Item.getItemFromBlock(ModBlocks.energyInfuser), new RenderEnergyInfuser());
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.energyCrystal), new RenderCrystal()); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.energyCrystal), new RenderCrystal());
MinecraftForgeClient.registerItemRenderer( MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.reactorStabilizer), new RenderReactorStabilizer());
Item.getItemFromBlock(ModBlocks.reactorStabilizer), MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.reactorEnergyInjector), new RenderReactorEnergyInjector());
new RenderReactorStabilizer()); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.reactorCore), new RenderReactorCore());
MinecraftForgeClient.registerItemRenderer( if (ModBlocks.earthBlock != null) MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.earthBlock), new RenderEarthItem());
Item.getItemFromBlock(ModBlocks.reactorEnergyInjector), MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.chaosCrystal), new RenderChaosShard());
new RenderReactorEnergyInjector()); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.upgradeModifier), new RenderUpgradeModifier());
MinecraftForgeClient
.registerItemRenderer(Item.getItemFromBlock(ModBlocks.reactorCore), new RenderReactorCore());
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.earthBlock), new RenderEarthItem());
MinecraftForgeClient
.registerItemRenderer(Item.getItemFromBlock(ModBlocks.chaosCrystal), new RenderChaosShard());
MinecraftForgeClient
.registerItemRenderer(Item.getItemFromBlock(ModBlocks.upgradeModifier), new RenderUpgradeModifier());
// ISimpleBlockRendering // ISimpleBlockRendering
RenderingRegistry.registerBlockHandler(new RenderTeleporterStand()); RenderingRegistry.registerBlockHandler(new RenderTeleporterStand());
@@ -294,7 +238,7 @@ public class ClientProxy extends CommonProxy {
ClientRegistry.bindTileEntitySpecialRenderer(TileCustomSpawner.class, new RenderTileCustomSpawner()); ClientRegistry.bindTileEntitySpecialRenderer(TileCustomSpawner.class, new RenderTileCustomSpawner());
// ClientRegistry.bindTileEntitySpecialRenderer(TileTestBlock.class, new RenderTileCrystal()); // ClientRegistry.bindTileEntitySpecialRenderer(TileTestBlock.class, new RenderTileCrystal());
ClientRegistry.bindTileEntitySpecialRenderer(TileEnergyStorageCore.class, new RenderTileEnergyStorageCore()); ClientRegistry.bindTileEntitySpecialRenderer(TileEnergyStorageCore.class, new RenderTileEnergyStorageCore());
ClientRegistry.bindTileEntitySpecialRenderer(TileEarth.class, new RenderTileEarth()); if (ModBlocks.earthBlock != null) ClientRegistry.bindTileEntitySpecialRenderer(TileEarth.class, new RenderTileEarth());
ClientRegistry.bindTileEntitySpecialRenderer(TileEnergyPylon.class, new RenderTileEnergyPylon()); ClientRegistry.bindTileEntitySpecialRenderer(TileEnergyPylon.class, new RenderTileEnergyPylon());
ClientRegistry.bindTileEntitySpecialRenderer(TilePlacedItem.class, new RenderTilePlacedItem()); ClientRegistry.bindTileEntitySpecialRenderer(TilePlacedItem.class, new RenderTilePlacedItem());
ClientRegistry.bindTileEntitySpecialRenderer(TileDissEnchanter.class, new RenderTileDissEnchanter()); ClientRegistry.bindTileEntitySpecialRenderer(TileDissEnchanter.class, new RenderTileDissEnchanter());
@@ -305,8 +249,7 @@ public class ClientProxy extends CommonProxy {
ClientRegistry.bindTileEntitySpecialRenderer(TileWirelessEnergyTransceiver.class, new RenderTileCrystal()); ClientRegistry.bindTileEntitySpecialRenderer(TileWirelessEnergyTransceiver.class, new RenderTileCrystal());
ClientRegistry.bindTileEntitySpecialRenderer(TileReactorCore.class, new RenderTileReactorCore()); ClientRegistry.bindTileEntitySpecialRenderer(TileReactorCore.class, new RenderTileReactorCore());
ClientRegistry.bindTileEntitySpecialRenderer(TileReactorStabilizer.class, new RenderTileReactorStabilizer()); ClientRegistry.bindTileEntitySpecialRenderer(TileReactorStabilizer.class, new RenderTileReactorStabilizer());
ClientRegistry ClientRegistry.bindTileEntitySpecialRenderer(TileReactorEnergyInjector.class, new RenderTileReactorEnergyInjector());
.bindTileEntitySpecialRenderer(TileReactorEnergyInjector.class, new RenderTileReactorEnergyInjector());
ClientRegistry.bindTileEntitySpecialRenderer(TileChaosShard.class, new RenderTileChaosShard()); ClientRegistry.bindTileEntitySpecialRenderer(TileChaosShard.class, new RenderTileChaosShard());
ClientRegistry.bindTileEntitySpecialRenderer(TileUpgradeModifier.class, new RenderTileUpgradeModifier()); ClientRegistry.bindTileEntitySpecialRenderer(TileUpgradeModifier.class, new RenderTileUpgradeModifier());
@@ -318,14 +261,14 @@ public class ClientProxy extends CommonProxy {
RenderingRegistry.registerEntityRenderingHandler(EntityChaosCrystal.class, new RenderChaosCrystal()); RenderingRegistry.registerEntityRenderingHandler(EntityChaosCrystal.class, new RenderChaosCrystal());
RenderingRegistry.registerEntityRenderingHandler(EntityChaosVortex.class, new RenderEntityChaosVortex()); RenderingRegistry.registerEntityRenderingHandler(EntityChaosVortex.class, new RenderEntityChaosVortex());
RenderingRegistry.registerEntityRenderingHandler(EntityCustomArrow.class, new RenderEntityCustomArrow()); RenderingRegistry.registerEntityRenderingHandler(EntityCustomArrow.class, new RenderEntityCustomArrow());
// spotless:on
} }
public void registerRenderIDs() { private void registerRenderIDs() {
References.idTeleporterStand = RenderingRegistry.getNextAvailableRenderId(); References.idTeleporterStand = RenderingRegistry.getNextAvailableRenderId();
References.idPortal = RenderingRegistry.getNextAvailableRenderId(); References.idPortal = RenderingRegistry.getNextAvailableRenderId();
} }
@Override
public ParticleEnergyBeam energyBeam(World worldObj, double x, double y, double z, double tx, double ty, double tz, public ParticleEnergyBeam energyBeam(World worldObj, double x, double y, double z, double tx, double ty, double tz,
int powerFlow, boolean advanced, ParticleEnergyBeam oldBeam, boolean render, int beamType) { int powerFlow, boolean advanced, ParticleEnergyBeam oldBeam, boolean render, int beamType) {
if (!worldObj.isRemote) return null; if (!worldObj.isRemote) return null;
@@ -347,7 +290,6 @@ public class ClientProxy extends CommonProxy {
return beam; return beam;
} }
@Override
public ParticleEnergyField energyField(World worldObj, double x, double y, double z, int type, boolean advanced, public ParticleEnergyField energyField(World worldObj, double x, double y, double z, int type, boolean advanced,
ParticleEnergyField oldBeam, boolean render) { ParticleEnergyField oldBeam, boolean render) {
if (!worldObj.isRemote) return null; if (!worldObj.isRemote) return null;
@@ -369,7 +311,6 @@ public class ClientProxy extends CommonProxy {
return beam; return beam;
} }
@Override
public ParticleReactorBeam reactorBeam(TileEntity tile, ParticleReactorBeam oldBeam, boolean render) { public ParticleReactorBeam reactorBeam(TileEntity tile, ParticleReactorBeam oldBeam, boolean render) {
if (!tile.getWorldObj().isRemote || !(tile instanceof IReactorPart)) return null; if (!tile.getWorldObj().isRemote || !(tile instanceof IReactorPart)) return null;
ParticleReactorBeam beam = oldBeam; ParticleReactorBeam beam = oldBeam;
@@ -390,19 +331,101 @@ public class ClientProxy extends CommonProxy {
return beam; return beam;
} }
public boolean isOp(String paramString) { public void spawnParticle(EntityFX particle, int range) {
return Minecraft.getMinecraft().theWorld.getWorldInfo().getGameType().isCreative(); if (particle.worldObj.isRemote) {
ParticleHandler.spawnCustomParticle(particle, range);
}
} }
@Override
public void spawnParticle(Object particle, int range) {
if (particle instanceof EntityFX && ((EntityFX) particle).worldObj.isRemote)
ParticleHandler.spawnCustomParticle((EntityFX) particle, range);
}
@Override
public ISound playISound(ISound sound) { public ISound playISound(ISound sound) {
FMLClientHandler.instance().getClient().getSoundHandler().playSound(sound); FMLClientHandler.instance().getClient().getSoundHandler().playSound(sound);
return sound; return sound;
} }
@Override
public boolean isDedicatedServer() {
return false;
}
@Override
public World getClientWorld() {
return Minecraft.getMinecraft().theWorld;
}
@Override
public boolean isSpaceDown() {
return Minecraft.getMinecraft().gameSettings.keyBindJump.getIsKeyPressed();
}
@Override
public boolean isShiftDown() {
return Minecraft.getMinecraft().gameSettings.keyBindSneak.getIsKeyPressed();
}
@Override
public boolean isCtrlDown() {
return Minecraft.getMinecraft().gameSettings.keyBindSprint.getIsKeyPressed();
}
@Override
public EntityPlayer getClientPlayer() {
return Minecraft.getMinecraft().thePlayer;
}
@Override
public boolean isClient() {
return true;
}
public KeyInputHandler getKeybindHandler() {
return keybindHandler;
}
public void displayItem(ItemStack stack) {
this.itemDisplay.startDrawing(stack);
}
public int getElapsedTicks() {
return this.clientHandler.getElapsedTicks();
}
public float getEnergyCrystalAlpha() {
return this.clientHandler.getEnergyCrystalAlpha();
}
@Override
public void tryRepositionPlayerOnMount(int entityId) {
this.clientHandler.tryRepositionPlayerOnMount(entityId);
}
public void renderShield(EntityPlayer player, float shieldPowerF) {
this.shieldRenderer.renderShield(player, shieldPowerF);
}
@Override
public void registerInhibitor(TileDislocatorInhibitor tile) {
if (tile.hasWorldObj() && tile.getWorldObj().isRemote) {
registerInhibitor(this.clientInhibitorsMap, tile);
} else {
super.registerInhibitor(tile);
}
}
@Override
public void unregisterInhibitor(TileDislocatorInhibitor tile) {
if (tile.hasWorldObj() && tile.getWorldObj().isRemote) {
unregisterInhibitor(this.clientInhibitorsMap, tile);
} else {
super.unregisterInhibitor(tile);
}
}
@Override
public boolean isBlockedByInhibitor(World world, EntityItem item) {
if (world.isRemote) {
return isBlockedByInhibitor(this.clientInhibitorsMap, world, item);
} else {
return super.isBlockedByInhibitor(world, item);
}
}
} }
@@ -5,9 +5,9 @@ import net.minecraft.init.Items;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.ModBlocks;
import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@@ -1,69 +0,0 @@
package com.brandon3055.draconicevolution.client.gui;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import com.brandon3055.draconicevolution.common.container.ContainerTemplate;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.tileentities.TileContainerTemplate;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class GUIContainerTemplate extends GuiContainer {
public EntityPlayer player;
private TileContainerTemplate tile;
public GUIContainerTemplate(InventoryPlayer invPlayer, TileContainerTemplate tile) {
super(new ContainerTemplate(invPlayer, tile));
xSize = 176;
ySize = 140;
this.tile = tile;
this.player = invPlayer.player;
}
private static final ResourceLocation texture = new ResourceLocation(
References.MODID.toLowerCase(),
"textures/gui/.png");
@Override
protected void drawGuiContainerBackgroundLayer(float f, int x, int y) {
GL11.glColor4f(1F, 1F, 1F, 1F);
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
}
@Override
protected void drawGuiContainerForegroundLayer(int x, int y) {
fontRendererObj.drawStringWithShadow("Energy Infuser", 49, -9, 0x00FFFF);
// bindTexture(texture);
// fontRendererObj.drawString("Charges: " + charges, 90, 25, 0x000000);
// drawCenteredString(fontRendererObj, "Charges: " + charges, 117, 25, 0x000000);
// drawCenteredString(fontRendererObj, "Weather Controller", xSize/2, -15, 0x2a4ed0);
}
@Override
public void initGui() {
super.initGui();
}
@Override
protected void actionPerformed(GuiButton button) {}
@Override
public void updateScreen() {
super.updateScreen();
}
}
@@ -66,11 +66,8 @@ public class GUIDislocatorInhibitor extends GuiContainer implements INEIGuiHandl
@Override @Override
protected void drawGuiContainerForegroundLayer(int x, int y) { protected void drawGuiContainerForegroundLayer(int x, int y) {
fontRendererObj.drawString( fontRendererObj
StatCollector.translateToLocal("tile.draconicevolution:dislocatorInhibitor.name"), .drawString(StatCollector.translateToLocal("gui.de.dislocatorInhibitor.main.title"), 7, 5, 0x222222);
7,
5,
0x222222);
drawGuiText(); drawGuiText();
drawGreyOutSlots(); drawGreyOutSlots();
drawButtonIcons(); drawButtonIcons();
@@ -200,7 +197,12 @@ public class GUIDislocatorInhibitor extends GuiContainer implements INEIGuiHandl
25, 25,
0x000000, 0x000000,
false); false);
fontRendererObj.drawString(String.valueOf(range), range < 10 ? 78 : 75, 25, 0x000000, false); fontRendererObj.drawString(
StatCollector.translateToLocalFormatted("gui.de.numbers", range),
range < 10 ? 78 : 75,
25,
0x000000,
false);
} }
private void drawButtonIcons() { private void drawButtonIcons() {
@@ -52,13 +52,18 @@ public class GUIDissEnchanter extends GuiContainer {
protected void drawGuiContainerForegroundLayer(int x, int y) { protected void drawGuiContainerForegroundLayer(int x, int y) {
drawCenteredString( drawCenteredString(
fontRendererObj, fontRendererObj,
StatCollector.translateToLocal("tile.draconicevolution:dissEnchanter.name"), StatCollector.translateToLocal("gui.de.dissEnchanter.main.title"),
88, 88,
4, 4,
0x00FFFF); 0x00FFFF);
fontRendererObj.drawString("Item", 5, 40, 0x0000ff); fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.dissEnchanter.itemDamage1"), 5, 40, 0x0000ff);
fontRendererObj.drawString("Damage: " + (40 - tile.bookPower) + "%", 5, 49, 0x0000ff); fontRendererObj.drawString(
StatCollector
.translateToLocalFormatted("gui.de.dissEnchanter.itemDamage2", (40 - tile.bookPower) + "%"),
5,
49,
0x0000ff);
} }
@Override @Override
@@ -94,6 +99,7 @@ public class GUIDissEnchanter extends GuiContainer {
if (flag && player.experienceLevel < tile.dissenchantCost && !player.capabilities.isCreativeMode) flag = false; if (flag && player.experienceLevel < tile.dissenchantCost && !player.capabilities.isCreativeMode) flag = false;
((GuiButtonAHeight) buttonList.get(0)).enabled = flag; ((GuiButtonAHeight) buttonList.get(0)).enabled = flag;
((GuiButtonAHeight) buttonList.get(0)).packedFGColour = cachRecipeValid ? 0x000000 : 0xdf0000; ((GuiButtonAHeight) buttonList.get(0)).packedFGColour = cachRecipeValid ? 0x000000 : 0xdf0000;
((GuiButtonAHeight) buttonList.get(0)).displayString = "Cost: " + tile.dissenchantCost; ((GuiButtonAHeight) buttonList.get(0)).displayString = StatCollector
.translateToLocalFormatted("gui.de.dissEnchanter.cost", tile.dissenchantCost);
} }
} }
@@ -17,9 +17,9 @@ import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import com.brandon3055.brandonscore.client.utills.GuiHelper;
import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.handler.ResourceHandler; import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
import com.brandon3055.draconicevolution.client.utils.GuiHelper;
import com.brandon3055.draconicevolution.common.container.ContainerDraconiumChest; import com.brandon3055.draconicevolution.common.container.ContainerDraconiumChest;
import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.network.ButtonPacket; import com.brandon3055.draconicevolution.common.network.ButtonPacket;
@@ -95,7 +95,7 @@ public class GUIDraconiumChest extends GuiContainer implements INEIGuiHandler {
@Override @Override
protected void drawGuiContainerForegroundLayer(int x, int y) { protected void drawGuiContainerForegroundLayer(int x, int y) {
fontRendererObj.drawString(tile.getInventoryName(), 4, 4, 0x222222); fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.draconiumChest.main.title"), 4, 4, 0x222222);
// fontRendererObj.drawStringWithShadow(StatCollector.translateToLocal("button.de.chestAutoFeed.txt"), 4, 180, // fontRendererObj.drawStringWithShadow(StatCollector.translateToLocal("button.de.chestAutoFeed.txt"), 4, 180,
// 0x00FFFF); // 0x00FFFF);
@@ -1,5 +1,7 @@
package com.brandon3055.draconicevolution.client.gui; package com.brandon3055.draconicevolution.client.gui;
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Random; import java.util.Random;
@@ -14,7 +16,7 @@ import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import com.brandon3055.brandonscore.client.utills.GuiHelper; import com.brandon3055.draconicevolution.client.utils.GuiHelper;
import com.brandon3055.draconicevolution.common.container.ContainerEnergyInfuser; import com.brandon3055.draconicevolution.common.container.ContainerEnergyInfuser;
import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.tileentities.TileEnergyInfuser; import com.brandon3055.draconicevolution.common.tileentities.TileEnergyInfuser;
@@ -81,7 +83,11 @@ public class GUIEnergyInfuser extends GuiContainer {
@Override @Override
protected void drawGuiContainerForegroundLayer(int x, int y) { protected void drawGuiContainerForegroundLayer(int x, int y) {
fontRendererObj.drawStringWithShadow("Energy Infuser", 49, -9, 0x00FFFF); fontRendererObj.drawStringWithShadow(
StatCollector.translateToLocal("gui.de.energyInfuser.main.title"),
49,
-9,
0x00FFFF);
// bindTexture(texture); // bindTexture(texture);
@@ -118,10 +124,9 @@ public class GUIEnergyInfuser extends GuiContainer {
ArrayList<String> internal = new ArrayList<String>(); ArrayList<String> internal = new ArrayList<String>();
internal.add(StatCollector.translateToLocal("gui.de.internalStorage.txt")); internal.add(StatCollector.translateToLocal("gui.de.internalStorage.txt"));
internal.add( internal.add(
"" + EnumChatFormatting.DARK_BLUE EnumChatFormatting.DARK_BLUE + formatNumber(tile.energy.getEnergyStored())
+ tile.energy.getEnergyStored()
+ "/" + "/"
+ tile.energy.getMaxEnergyStored()); + formatNumber(tile.energy.getMaxEnergyStored()));
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT); GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
drawHoveringText(internal, x + guiLeft, y + guiTop, fontRendererObj); drawHoveringText(internal, x + guiLeft, y + guiTop, fontRendererObj);
GL11.glPopAttrib(); GL11.glPopAttrib();
@@ -134,10 +139,9 @@ public class GUIEnergyInfuser extends GuiContainer {
ArrayList<String> internal = new ArrayList<String>(); ArrayList<String> internal = new ArrayList<String>();
internal.add(StatCollector.translateToLocal("gui.de.itemStorage.txt")); internal.add(StatCollector.translateToLocal("gui.de.itemStorage.txt"));
internal.add( internal.add(
"" + EnumChatFormatting.DARK_BLUE EnumChatFormatting.DARK_BLUE + formatNumber(item.getEnergyStored(tile.getStackInSlot(0)))
+ item.getEnergyStored(tile.getStackInSlot(0))
+ "/" + "/"
+ item.getMaxEnergyStored(tile.getStackInSlot(0))); + formatNumber(item.getMaxEnergyStored(tile.getStackInSlot(0))));
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT); GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
drawHoveringText(internal, x + guiLeft, y + guiTop, fontRendererObj); drawHoveringText(internal, x + guiLeft, y + guiTop, fontRendererObj);
GL11.glPopAttrib(); GL11.glPopAttrib();
@@ -1,5 +1,7 @@
package com.brandon3055.draconicevolution.client.gui; package com.brandon3055.draconicevolution.client.gui;
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -10,9 +12,8 @@ import net.minecraft.util.StatCollector;
import org.lwjgl.input.Keyboard; import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse; import org.lwjgl.input.Mouse;
import com.brandon3055.brandonscore.client.utills.GuiHelper;
import com.brandon3055.brandonscore.common.utills.Utills;
import com.brandon3055.draconicevolution.client.handler.ResourceHandler; import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
import com.brandon3055.draconicevolution.client.utils.GuiHelper;
import com.brandon3055.draconicevolution.common.tileentities.gates.TileGate; import com.brandon3055.draconicevolution.common.tileentities.gates.TileGate;
/** /**
@@ -47,7 +48,7 @@ public class GUIFlowGate extends GuiScreen {
drawDefaultBackground(); drawDefaultBackground();
ResourceHandler.bindResource("textures/gui/ToolConfig.png"); ResourceHandler.bindResource("textures/gui/ToolConfig.png");
drawTexturedModalRect(guiLeft, guiTop, 0, 0, 197, 88); drawTexturedModalRect(guiLeft, guiTop, 0, 0, 198, 89);
fontRendererObj.drawString( fontRendererObj.drawString(
StatCollector.translateToLocal("gui.de.flowGate.name"), StatCollector.translateToLocal("gui.de.flowGate.name"),
guiCrt - (fontRendererObj.getStringWidth(StatCollector.translateToLocal("gui.de.flowGate.name")) / 2), guiCrt - (fontRendererObj.getStringWidth(StatCollector.translateToLocal("gui.de.flowGate.name")) / 2),
@@ -87,7 +88,7 @@ public class GUIFlowGate extends GuiScreen {
0x00FF00); 0x00FF00);
String flow = StatCollector.translateToLocal("gui.de.flowGateCurrentFlow.name") + ": " String flow = StatCollector.translateToLocal("gui.de.flowGateCurrentFlow.name") + ": "
+ Utills.addCommas(tile.getActualFlow()); + formatNumber(tile.getActualFlow());
fontRendererObj.drawString(flow, guiCrt - (fontRendererObj.getStringWidth(flow) / 2), guiTop + 76, 0x2c2c2c); fontRendererObj.drawString(flow, guiCrt - (fontRendererObj.getStringWidth(flow) / 2), guiTop + 76, 0x2c2c2c);
if (!tile.flowOverridden) { if (!tile.flowOverridden) {
@@ -1,19 +1,21 @@
package com.brandon3055.draconicevolution.client.gui; package com.brandon3055.draconicevolution.client.gui;
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
import java.util.ArrayList; import java.util.ArrayList;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import com.brandon3055.brandonscore.client.utills.GuiHelper; import com.brandon3055.draconicevolution.client.utils.GuiHelper;
import com.brandon3055.draconicevolution.common.container.ContainerGenerator; import com.brandon3055.draconicevolution.common.container.ContainerGenerator;
import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.tileentities.TileGenerator; import com.brandon3055.draconicevolution.common.tileentities.TileGenerator;
@@ -73,46 +75,30 @@ public class GUIGenerator extends GuiContainer {
18, 18,
18 - (int) (fuel * 13)); // Power bar 18 - (int) (fuel * 13)); // Power bar
fontRendererObj.drawStringWithShadow("Generator", guiLeft + 64, guiTop + 0, 0x00FFFF); fontRendererObj.drawStringWithShadow(
StatCollector.translateToLocal("gui.de.generator.main.title"),
guiLeft + 64,
guiTop,
0x00FFFF);
int x = X - guiLeft; int x = X - guiLeft;
int y = Y - guiTop; int y = Y - guiTop;
if (GuiHelper.isInRect(83, 10, 12, 40, x, y)) { if (GuiHelper.isInRect(83, 10, 12, 40, x, y)) {
ArrayList<String> internal = new ArrayList<String>(); ArrayList<String> internal = new ArrayList<String>();
internal.add("Internal Storage"); internal.add(StatCollector.translateToLocal("gui.de.internalStorage.txt"));
internal.add( internal.add(
"" + EnumChatFormatting.DARK_BLUE EnumChatFormatting.DARK_BLUE + formatNumber(tile.getEnergyStored(ForgeDirection.UP))
+ tile.getEnergyStored(ForgeDirection.UP)
+ "/" + "/"
+ tile.getMaxEnergyStored(ForgeDirection.UP)); + formatNumber(tile.getMaxEnergyStored(ForgeDirection.UP)));
drawHoveringText(internal, x + guiLeft, y + guiTop, fontRendererObj); drawHoveringText(internal, x + guiLeft, y + guiTop, fontRendererObj);
} }
} }
@Override
protected void drawGuiContainerForegroundLayer(int X, int Y) {
int x = X - guiLeft;
int y = Y - guiTop;
/*
* if (GuiHelper.isInRect(83, 10, 95, 50, x, y)) { ArrayList<String> internal = new ArrayList<String>();
* internal.add("Internal Storage"); internal.add("" + EnumChatFormatting.DARK_BLUE +
* tile.getEnergyStored(ForgeDirection.UP) + "/" + tile.getMaxEnergyStored(ForgeDirection.UP));
* drawHoveringText(internal, x, y, fontRendererObj); }
*/
}
@Override @Override
public void initGui() { public void initGui() {
super.initGui(); super.initGui();
// ID
// buttonList.add(new GuiButton(0, guiLeft + 85, guiTop , 85, 20, text));
} }
@Override
protected void actionPerformed(GuiButton button) {}
@Override @Override
public void updateScreen() { public void updateScreen() {
guiUpdateTick++; guiUpdateTick++;
@@ -123,6 +109,4 @@ public class GUIGenerator extends GuiContainer {
super.updateScreen(); super.updateScreen();
} }
// ####Draw at############ read from size
// drawTexturedModalRect(guiLeft + 37, guiTop + 4, 0, 143, 37, 38);
} }
@@ -1,19 +1,21 @@
package com.brandon3055.draconicevolution.client.gui; package com.brandon3055.draconicevolution.client.gui;
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
import java.util.ArrayList; import java.util.ArrayList;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import com.brandon3055.brandonscore.client.utills.GuiHelper; import com.brandon3055.draconicevolution.client.utils.GuiHelper;
import com.brandon3055.draconicevolution.common.container.ContainerGrinder; import com.brandon3055.draconicevolution.common.container.ContainerGrinder;
import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.tileentities.TileGrinder; import com.brandon3055.draconicevolution.common.tileentities.TileGrinder;
@@ -69,7 +71,7 @@ public class GUIGrinder extends GuiContainer {
guiLeft + 83, guiLeft + 83,
guiTop + 11 + (int) (power * 40), guiTop + 11 + (int) (power * 40),
xSize, xSize,
0 + (int) (power * 40), (int) (power * 40),
12, 12,
40 - (int) (power * 40)); // Power bar 40 - (int) (power * 40)); // Power bar
drawTexturedModalRect( drawTexturedModalRect(
@@ -81,7 +83,11 @@ public class GUIGrinder extends GuiContainer {
18 - (int) (fuel * 13)); // Power bar 18 - (int) (fuel * 13)); // Power bar
if (tile.isExternallyPowered()) drawTexturedModalRect(guiLeft + 100, guiTop + 37, xSize, 66, 13, 13); if (tile.isExternallyPowered()) drawTexturedModalRect(guiLeft + 100, guiTop + 37, xSize, 66, 13, 13);
fontRendererObj.drawStringWithShadow("Grinder", guiLeft + 71, guiTop + 0, 0x00FFFF); fontRendererObj.drawStringWithShadow(
StatCollector.translateToLocal("gui.de.grinder.main.title"),
guiLeft + 71,
guiTop,
0x00FFFF);
int x = X - guiLeft; int x = X - guiLeft;
int y = Y - guiTop; int y = Y - guiTop;
@@ -91,39 +97,25 @@ public class GUIGrinder extends GuiContainer {
if (tile.isExternallyPowered()) { if (tile.isExternallyPowered()) {
internal.add( internal.add(
"" + EnumChatFormatting.DARK_BLUE "" + EnumChatFormatting.DARK_BLUE
+ tile.getEnergyStored(ForgeDirection.UP) + formatNumber(tile.getEnergyStored(ForgeDirection.UP))
+ "/" + "/"
+ tile.getMaxEnergyStored(ForgeDirection.UP)); + formatNumber(tile.getMaxEnergyStored(ForgeDirection.UP)));
} else { } else {
internal.add( internal.add(
"" + EnumChatFormatting.DARK_BLUE "" + EnumChatFormatting.DARK_BLUE
+ tile.getInternalBuffer().getEnergyStored() + formatNumber(tile.getInternalBuffer().getEnergyStored())
+ "/" + "/"
+ tile.getInternalBuffer().getMaxEnergyStored()); + formatNumber(tile.getInternalBuffer().getMaxEnergyStored()));
} }
drawHoveringText(internal, x + guiLeft, y + guiTop, fontRendererObj); drawHoveringText(internal, x + guiLeft, y + guiTop, fontRendererObj);
} }
} }
@Override
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
// fontRendererObj.drawString("Charges: " + charges, 90, 25, 0x000000);
// drawCenteredString(fontRendererObj, "Charges: " + charges, 117, 25, 0x000000);
// drawCenteredString(fontRendererObj, "Weather Controller", xSize/2, -15, 0x2a4ed0);
}
@Override @Override
public void initGui() { public void initGui() {
super.initGui(); super.initGui();
// ID
// buttonList.add(new GuiButton(0, guiLeft + 85, guiTop , 85, 20, text));
} }
@Override
protected void actionPerformed(GuiButton button) {}
@Override @Override
public void updateScreen() { public void updateScreen() {
guiUpdateTick++; guiUpdateTick++;
@@ -134,6 +126,4 @@ public class GUIGrinder extends GuiContainer {
super.updateScreen(); super.updateScreen();
} }
// ####Draw at############ read from size
// drawTexturedModalRect(guiLeft + 37, guiTop + 4, 0, 143, 37, 38);
} }
@@ -86,7 +86,8 @@ public class GUIParticleGenerator extends GuiScreen {
@Override @Override
public void drawLabel(FontRenderer fontRenderer, int x, int y) { public void drawLabel(FontRenderer fontRenderer, int x, int y) {
fontRenderer.drawString(label, x, y, 0x000000); fontRenderer.drawString(label, x, y, 0x000000);
fontRenderer.drawString(String.valueOf(value), x, y + 10, 0x000000); fontRenderer
.drawString(StatCollector.translateToLocalFormatted("gui.de.numbers", value), x, y + 10, 0x000000);
} }
} }
@@ -141,7 +142,11 @@ public class GUIParticleGenerator extends GuiScreen {
public void drawLabel(FontRenderer fontRenderer, int x, int y) { public void drawLabel(FontRenderer fontRenderer, int x, int y) {
float roundedValue = Math.round(value * scale) / scale; float roundedValue = Math.round(value * scale) / scale;
fontRenderer.drawString(label, x, y, 0x000000); fontRenderer.drawString(label, x, y, 0x000000);
fontRenderer.drawString(String.valueOf(roundedValue), x, y + 10, 0x000000); fontRenderer.drawString(
StatCollector.translateToLocalFormatted("gui.de.numbers", roundedValue),
x,
y + 10,
0x000000);
} }
} }
@@ -9,6 +9,7 @@ import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
@@ -75,7 +76,7 @@ public class GUIPlayerDetector extends GuiContainer {
public void drawScreen(int x, int y, float partialTicks) { public void drawScreen(int x, int y, float partialTicks) {
super.drawScreen(x, y, partialTicks); super.drawScreen(x, y, partialTicks);
ArrayList<String> lines = new ArrayList<>(); ArrayList<String> lines = new ArrayList<>();
lines.add("Camouflage"); lines.add(StatCollector.translateToLocal("gui.de.playerDetector.camouflage"));
if ((x - guiLeft > 142 && x - guiLeft < 160) && (y - guiTop > 19 && y - guiTop < 37) if ((x - guiLeft > 142 && x - guiLeft < 160) && (y - guiTop > 19 && y - guiTop < 37)
&& container.shouldShowInventory()) { && container.shouldShowInventory()) {
drawHoveringText(lines, x, y, fontRendererObj); drawHoveringText(lines, x, y, fontRendererObj);
@@ -88,15 +89,30 @@ public class GUIPlayerDetector extends GuiContainer {
super.initGui(); super.initGui();
buttonList.clear(); buttonList.clear();
if (!isInEditMode) { if (!isInEditMode) {
String mode = isInWhitelistMode ? "White List" : "Black List"; String mode = isInWhitelistMode ? StatCollector.translateToLocal("gui.de.playerDetector.whiteList")
: StatCollector.translateToLocal("gui.de.playerDetector.blackList");
int center = width / 2; int center = width / 2;
buttonList.add(new GuiButton(0, center - 20 - 20, guiTop + 20, 20, 20, "+")); buttonList.add(new GuiButton(0, center - 20 - 20, guiTop + 20, 20, 20, "+"));
buttonList.add(new GuiButton(1, center + 20, guiTop + 20, 20, 20, "-")); buttonList.add(new GuiButton(1, center + 20, guiTop + 20, 20, 20, "-"));
buttonList.add(new GuiButton(3, center - 40, guiTop + 45, 60, 20, mode)); buttonList.add(new GuiButton(3, center - 40, guiTop + 45, 60, 20, mode));
buttonList.add(new GuiButton(4, center + 20, guiTop + 45, 20, 20, "!")); buttonList.add(new GuiButton(4, center + 20, guiTop + 45, 20, 20, "!"));
buttonList.add(new GuiButton(6, center - 40, guiTop + 70, 80, 20, "Invert Output")); buttonList.add(
new GuiButton(
6,
center - 40,
guiTop + 70,
80,
20,
StatCollector.translateToLocal("gui.de.playerDetector.invertOutput")));
} else { } else {
buttonList.add(new GuiButton(5, guiLeft - 40, guiTop + ySize - 20, 40, 20, "Back")); buttonList.add(
new GuiButton(
5,
guiLeft - 40,
guiTop + ySize - 20,
40,
20,
StatCollector.translateToLocal("gui.de.playerDetector.back")));
} }
selectedNameText = new GuiTextField(fontRendererObj, 4, -12, 168, 12); selectedNameText = new GuiTextField(fontRendererObj, 4, -12, 168, 12);
@@ -186,7 +202,12 @@ public class GUIPlayerDetector extends GuiContainer {
private void drawGuiText() { private void drawGuiText() {
if (isInEditMode) { if (isInEditMode) {
if (selectedMameIndex != -1) { if (selectedMameIndex != -1) {
drawCenteredString(fontRendererObj, "Press Enter to save", xSize / 2, -22, 0xFF0000); drawCenteredString(
fontRendererObj,
StatCollector.translateToLocal("gui.de.playerDetector.pressEnter"),
xSize / 2,
-22,
0xFF0000);
} }
for (int row = 0; row < 21; row++) { for (int row = 0; row < 21; row++) {
for (int column = 0; column < 2; column++) { for (int column = 0; column < 2; column++) {
@@ -200,11 +221,31 @@ public class GUIPlayerDetector extends GuiContainer {
} }
} }
} else { } else {
drawCenteredString(fontRendererObj, "Advanced Player Detector", xSize / 2, 5, 0x00FFFF); drawCenteredString(
fontRendererObj,
StatCollector.translateToLocal("gui.de.playerDetector.main.title"),
xSize / 2,
5,
0x00FFFF);
fontRendererObj.drawString("Range:", 73, 21, 0x000000, false); fontRendererObj.drawString(
fontRendererObj.drawString("Output Inverted: " + isOutputInverted, 33, 97, 0x000000, false); StatCollector.translateToLocal("gui.de.playerDetector.range") + ":",
fontRendererObj.drawString(String.valueOf(range), range < 10 ? 85 : 82, 31, 0x000000, false); 73,
21,
0x000000,
false);
fontRendererObj.drawString(
StatCollector.translateToLocalFormatted("gui.de.playerDetector.outputInvert", isOutputInverted),
33,
97,
0x000000,
false);
fontRendererObj.drawString(
StatCollector.translateToLocalFormatted("gui.de.numbers", range),
range < 10 ? 85 : 82,
31,
0x000000,
false);
} }
selectedNameText.drawTextBox(); selectedNameText.drawTextBox();
} }
@@ -20,14 +20,14 @@ import net.minecraft.util.StatCollector;
import org.lwjgl.input.Keyboard; import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import com.brandon3055.brandonscore.client.utills.GuiHelper;
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
import com.brandon3055.brandonscore.common.utills.Teleporter.TeleportLocation;
import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.utils.GuiHelper;
import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler; import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.network.TeleporterPacket; import com.brandon3055.draconicevolution.common.network.TeleporterPacket;
import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper;
import com.brandon3055.draconicevolution.common.utils.Teleporter;
import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Loader;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
@@ -43,7 +43,7 @@ public class GUITeleporter extends GuiScreen {
References.MODID.toLowerCase(), References.MODID.toLowerCase(),
"textures/gui/TeleporterMKII.png"); "textures/gui/TeleporterMKII.png");
private ItemStack teleporterItem; private ItemStack teleporterItem;
protected List<TeleportLocation> locations = new ArrayList<TeleportLocation>(0); protected List<Teleporter.TeleportLocation> locations = new ArrayList<>(0);
private int selected = 0; private int selected = 0;
private int selectionOffset = 0; private int selectionOffset = 0;
@@ -446,7 +446,7 @@ public class GUITeleporter extends GuiScreen {
} else { } else {
if (!textBeingEdited.getText().isEmpty()) { if (!textBeingEdited.getText().isEmpty()) {
getLocationSafely(selected + selectionOffset).setName(textBeingEdited.getText()); getLocationSafely(selected + selectionOffset).setName(textBeingEdited.getText());
TeleportLocation location = new TeleportLocation(); Teleporter.TeleportLocation location = new Teleporter.TeleportLocation();
location.setName(textBeingEdited.getText()); location.setName(textBeingEdited.getText());
DraconicEvolution.network.sendToServer( DraconicEvolution.network.sendToServer(
new TeleporterPacket(location, TeleporterPacket.UPDATENAME, selected + selectionOffset)); new TeleporterPacket(location, TeleporterPacket.UPDATENAME, selected + selectionOffset));
@@ -460,7 +460,7 @@ public class GUITeleporter extends GuiScreen {
} }
if (button.id == 1) { if (button.id == 1) {
TeleportLocation location = new TeleportLocation( Teleporter.TeleportLocation location = new Teleporter.TeleportLocation(
player.posX, player.posX,
player.posY - 1.62, player.posY - 1.62,
player.posZ, player.posZ,
@@ -484,14 +484,14 @@ public class GUITeleporter extends GuiScreen {
if (button.id == 3 || button.id == 7) { if (button.id == 3 || button.id == 7) {
if (button.id == 3) { if (button.id == 3) {
if (selected > 0) { if (selected > 0) {
TeleportLocation temp = getLocationSafely(selected + selectionOffset); Teleporter.TeleportLocation temp = getLocationSafely(selected + selectionOffset);
locations.set(selected + selectionOffset, getLocationSafely(selected + selectionOffset - 1)); locations.set(selected + selectionOffset, getLocationSafely(selected + selectionOffset - 1));
locations.set(selected + selectionOffset - 1, temp); locations.set(selected + selectionOffset - 1, temp);
selected--; selected--;
} }
} else { } else {
if (selected < Math.min(11, locations.size() - 1)) { if (selected < Math.min(11, locations.size() - 1)) {
TeleportLocation temp = getLocationSafely(selected + selectionOffset); Teleporter.TeleportLocation temp = getLocationSafely(selected + selectionOffset);
locations.set(selected + selectionOffset, getLocationSafely(selected + selectionOffset + 1)); locations.set(selected + selectionOffset, getLocationSafely(selected + selectionOffset + 1));
locations.set(selected + selectionOffset + 1, temp); locations.set(selected + selectionOffset + 1, temp);
selected++; selected++;
@@ -624,7 +624,7 @@ public class GUITeleporter extends GuiScreen {
// TeleportLocation location = new TeleportLocation(tagLocation.getDouble("X"), tagLocation.getDouble("Y"), // TeleportLocation location = new TeleportLocation(tagLocation.getDouble("X"), tagLocation.getDouble("Y"),
// tagLocation.getDouble("Z"), tagLocation.getInteger("Dimension"), tagLocation.getFloat("Pitch"), // tagLocation.getDouble("Z"), tagLocation.getInteger("Dimension"), tagLocation.getFloat("Pitch"),
// tagLocation.getFloat("Yaw"), tagLocation.getString("Name")); // tagLocation.getFloat("Yaw"), tagLocation.getString("Name"));
TeleportLocation location = new TeleportLocation(); Teleporter.TeleportLocation location = new Teleporter.TeleportLocation();
location.readFromNBT(tagLocation); location.readFromNBT(tagLocation);
location.setWriteProtected(tagLocation.getBoolean("WP")); location.setWriteProtected(tagLocation.getBoolean("WP"));
locations.add(location); locations.add(location);
@@ -632,7 +632,7 @@ public class GUITeleporter extends GuiScreen {
} }
private void addCurrentLocationToList(String name) { private void addCurrentLocationToList(String name) {
TeleportLocation currentLocation = new TeleportLocation( Teleporter.TeleportLocation currentLocation = new Teleporter.TeleportLocation(
player.posX, player.posX,
player.posY - 1.62, player.posY - 1.62,
player.posZ, player.posZ,
@@ -644,8 +644,8 @@ public class GUITeleporter extends GuiScreen {
locations.add(currentLocation); locations.add(currentLocation);
} }
private TeleportLocation getLocationSafely(int index) { private Teleporter.TeleportLocation getLocationSafely(int index) {
if (index < locations.size() && index >= 0) return locations.get(index); if (index < locations.size() && index >= 0) return locations.get(index);
return new TeleportLocation(0, 0, 0, 0, 0, 0, EnumChatFormatting.DARK_RED + "[Index Error]"); return new Teleporter.TeleportLocation(0, 0, 0, 0, 0, 0, EnumChatFormatting.DARK_RED + "[Index Error]");
} }
} }
@@ -15,13 +15,13 @@ import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import com.brandon3055.brandonscore.client.utills.GuiHelper;
import com.brandon3055.draconicevolution.client.handler.ResourceHandler; import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
import com.brandon3055.draconicevolution.client.utils.GuiHelper;
import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.container.ContainerUpgradeModifier; import com.brandon3055.draconicevolution.common.container.ContainerUpgradeModifier;
import com.brandon3055.draconicevolution.common.tileentities.TileUpgradeModifier; import com.brandon3055.draconicevolution.common.tileentities.TileUpgradeModifier;
import com.brandon3055.draconicevolution.common.utills.IUpgradableItem; import com.brandon3055.draconicevolution.common.utils.IUpgradableItem;
import com.brandon3055.draconicevolution.common.utills.IUpgradableItem.EnumUpgrade; import com.brandon3055.draconicevolution.common.utils.IUpgradableItem.EnumUpgrade;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@@ -86,7 +86,12 @@ public class GUIUpgradeModifier extends GuiContainer {
@Override @Override
protected void drawGuiContainerForegroundLayer(int x, int y) { protected void drawGuiContainerForegroundLayer(int x, int y) {
drawCenteredString(fontRendererObj, tile.getBlockType().getLocalizedName(), xSize / 2, -9, 0x00FFFF); drawCenteredString(
fontRendererObj,
StatCollector.translateToLocal("gui.de.upgradeModifier.main.title"),
xSize / 2,
-9,
0x00FFFF);
} }
@Override @Override
@@ -238,13 +243,25 @@ public class GUIUpgradeModifier extends GuiContainer {
0x00ff00); 0x00ff00);
fontRendererObj fontRendererObj
.drawString(StatCollector.translateToLocal("gui.de.cap.txt"), guiLeft + 4, guiTop + 16, 0x000000); .drawString(StatCollector.translateToLocal("gui.de.cap.txt"), guiLeft + 4, guiTop + 16, 0x000000);
fontRendererObj.drawString(">" + coreSlots, guiLeft + 4, guiTop + 25, 0x000000); fontRendererObj.drawString(
StatCollector.translateToLocalFormatted("gui.de.numbers", ">" + coreSlots),
guiLeft + 4,
guiTop + 25,
0x000000);
fontRendererObj fontRendererObj
.drawString(StatCollector.translateToLocal("gui.de.installed.txt"), guiLeft + 4, guiTop + 37, 0x000000); .drawString(StatCollector.translateToLocal("gui.de.installed.txt"), guiLeft + 4, guiTop + 37, 0x000000);
fontRendererObj.drawString(">" + usedSlots, guiLeft + 4, guiTop + 46, 0x000000); fontRendererObj.drawString(
StatCollector.translateToLocalFormatted("gui.de.numbers", ">" + usedSlots),
guiLeft + 4,
guiTop + 46,
0x000000);
fontRendererObj fontRendererObj
.drawString(StatCollector.translateToLocal("gui.de.free.txt"), guiLeft + 4, guiTop + 58, 0x000000); .drawString(StatCollector.translateToLocal("gui.de.free.txt"), guiLeft + 4, guiTop + 58, 0x000000);
fontRendererObj.drawString(">" + (coreSlots - usedSlots), guiLeft + 4, guiTop + 67, 0x000000); fontRendererObj.drawString(
StatCollector.translateToLocalFormatted("gui.de.numbers", ">" + (coreSlots - usedSlots)),
guiLeft + 4,
guiTop + 67,
0x000000);
} }
@Override @Override
@@ -6,6 +6,7 @@ import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
@@ -53,23 +54,32 @@ public class GUIWeatherController extends GuiContainer {
@Override @Override
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) { protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
fontRendererObj.drawString("Charges: " + charges, 90, 25, 0x000000); fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.charges") + ": " + charges, 90, 25, 0x000000);
// drawCenteredString(fontRendererObj, "Charges: " + charges, 117, 25, 0x000000); // drawCenteredString(fontRendererObj, "Charges: " + charges, 117, 25, 0x000000);
drawCenteredString(fontRendererObj, "Weather Controller", xSize / 2, -15, 0x2a4ed0); drawCenteredString(
fontRendererObj,
StatCollector.translateToLocal("gui.de.weatherController.main.title"),
xSize / 2,
-15,
0x2a4ed0);
} }
public static final String RAIN_ON_TEXT = "Turn rain on"; public static final String RAIN_ON_TEXT = "gui.de.rain.on";
public static final String RAIN_OFF_TEXT = "Turn rain off"; public static final String RAIN_OFF_TEXT = "gui.de.rain.off";
public static final String STORM_TEXT = "Thunder Storm"; public static final String STORM_TEXT = "gui.de.rain.storm";
public static String text; public static String text;
private String getModeText(int mode) {
if (mode == 0) return StatCollector.translateToLocal(RAIN_OFF_TEXT);
else if (mode == 1) return StatCollector.translateToLocal(RAIN_ON_TEXT);
else return StatCollector.translateToLocal(STORM_TEXT);
}
@Override @Override
public void initGui() { public void initGui() {
super.initGui(); super.initGui();
buttonList.clear(); buttonList.clear();
if (tileWC.mode == 0) text = RAIN_OFF_TEXT; text = getModeText(tileWC.mode);
else if (tileWC.mode == 1) text = RAIN_ON_TEXT;
else text = STORM_TEXT;
// ID // ID
buttonList.add(new GuiButton(0, guiLeft + 85, guiTop, 85, 20, text)); buttonList.add(new GuiButton(0, guiLeft + 85, guiTop, 85, 20, text));
} }
@@ -78,9 +88,8 @@ public class GUIWeatherController extends GuiContainer {
protected void actionPerformed(GuiButton button) { protected void actionPerformed(GuiButton button) {
if (button.id == 0) { if (button.id == 0) {
DraconicEvolution.network.sendToServer(new ButtonPacket((byte) 0, true)); DraconicEvolution.network.sendToServer(new ButtonPacket((byte) 0, true));
if (button.displayString.equals(STORM_TEXT)) button.displayString = RAIN_OFF_TEXT; tileWC.mode = (tileWC.mode + 1) % 3;
else if (button.displayString.equals(RAIN_OFF_TEXT)) button.displayString = RAIN_ON_TEXT; button.displayString = getModeText(tileWC.mode);
else button.displayString = STORM_TEXT;
} }
} }
@@ -11,8 +11,8 @@ import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12; import org.lwjgl.opengl.GL12;
import com.brandon3055.brandonscore.client.gui.guicomponents.GUIBase; import com.brandon3055.draconicevolution.client.utils.GuiHelper;
import com.brandon3055.brandonscore.client.utills.GuiHelper; import com.brandon3055.draconicevolution.client.utils.guicomponents.GUIBase;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler; import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
/** /**
@@ -25,23 +25,23 @@ import org.apache.commons.io.IOUtils;
import org.lwjgl.input.Keyboard; import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentBase;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentButton;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentCollection;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentTextureButton;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentTexturedRect;
import com.brandon3055.brandonscore.client.gui.guicomponents.GUIScrollingBase;
import com.brandon3055.brandonscore.client.utills.ClientUtills;
import com.brandon3055.brandonscore.common.utills.InfoHelper;
import com.brandon3055.draconicevolution.client.gui.guicomponents.ComponentContributorsPage; import com.brandon3055.draconicevolution.client.gui.guicomponents.ComponentContributorsPage;
import com.brandon3055.draconicevolution.client.gui.guicomponents.ComponentIndexButton; import com.brandon3055.draconicevolution.client.gui.guicomponents.ComponentIndexButton;
import com.brandon3055.draconicevolution.client.gui.guicomponents.ComponentManualPage; import com.brandon3055.draconicevolution.client.gui.guicomponents.ComponentManualPage;
import com.brandon3055.draconicevolution.client.handler.ResourceHandler; import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
import com.brandon3055.draconicevolution.client.utils.ClientUtils;
import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentBase;
import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentButton;
import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentCollection;
import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentTextureButton;
import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentTexturedRect;
import com.brandon3055.draconicevolution.client.utils.guicomponents.GUIScrollingBase;
import com.brandon3055.draconicevolution.common.container.DummyContainer; import com.brandon3055.draconicevolution.common.container.DummyContainer;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler; import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.handler.ContributorHandler; import com.brandon3055.draconicevolution.common.handler.ContributorHandler;
import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.utills.LogHelper; import com.brandon3055.draconicevolution.common.utils.InfoHelper;
import com.brandon3055.draconicevolution.common.utils.LogHelper;
import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonReader;
/** /**
@@ -547,7 +547,7 @@ public class GUIManual extends GUIScrollingBase implements GuiYesNoCallback {
@Override @Override
public void confirmClicked(boolean confirmed, int id) { public void confirmClicked(boolean confirmed, int id) {
if (confirmed) ClientUtills.openLink("https://www.patreon.com/brandon3055"); if (confirmed) ClientUtils.openLink("https://www.patreon.com/brandon3055");
mc.displayGuiScreen(this); mc.displayGuiScreen(this);
} }
} }
@@ -1,5 +1,7 @@
package com.brandon3055.draconicevolution.client.gui.componentguis; package com.brandon3055.draconicevolution.client.gui.componentguis;
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -11,18 +13,18 @@ import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentButton;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentCollection;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentTextureButton;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentTexturedRect;
import com.brandon3055.brandonscore.client.gui.guicomponents.GUIBase;
import com.brandon3055.brandonscore.client.utills.GuiHelper;
import com.brandon3055.brandonscore.common.utills.Utills;
import com.brandon3055.draconicevolution.client.handler.ResourceHandler; import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
import com.brandon3055.draconicevolution.client.utils.GuiHelper;
import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentButton;
import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentCollection;
import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentTextureButton;
import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentTexturedRect;
import com.brandon3055.draconicevolution.client.utils.guicomponents.GUIBase;
import com.brandon3055.draconicevolution.common.container.ContainerReactor; import com.brandon3055.draconicevolution.common.container.ContainerReactor;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler; import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore; import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore.ReactorState; import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore.ReactorState;
import com.brandon3055.draconicevolution.common.utils.Utils;
/** /**
* Created by brandon3055 on 30/7/2015. * Created by brandon3055 on 30/7/2015.
@@ -182,24 +184,24 @@ public class GUIReactor extends GUIBase {
} else if (GuiHelper.isInRect(33, 4, 18, 114, mouseX - guiLeft, mouseY - guiTop)) { } else if (GuiHelper.isInRect(33, 4, 18, 114, mouseX - guiLeft, mouseY - guiTop)) {
text.add(StatCollector.translateToLocal("gui.de.fieldStrength.txt")); text.add(StatCollector.translateToLocal("gui.de.fieldStrength.txt"));
if (core.maxFieldCharge > 0) { if (core.maxFieldCharge > 0) {
text.add(Utills.round(core.fieldCharge / core.maxFieldCharge * 100D, 100D) + "%"); text.add(Utils.round(core.fieldCharge / core.maxFieldCharge * 100D, 100D) + "%");
} }
text.add(Utills.addCommas((int) core.fieldCharge) + " / " + Utills.addCommas((int) core.maxFieldCharge)); text.add(formatNumber((int) core.fieldCharge) + " / " + formatNumber((int) core.maxFieldCharge));
drawHoveringText(text, mouseX, mouseY, fontRendererObj); drawHoveringText(text, mouseX, mouseY, fontRendererObj);
} else if (GuiHelper.isInRect(197, 4, 18, 114, mouseX - guiLeft, mouseY - guiTop)) { } else if (GuiHelper.isInRect(197, 4, 18, 114, mouseX - guiLeft, mouseY - guiTop)) {
text.add(StatCollector.translateToLocal("gui.de.energySaturation.txt")); text.add(StatCollector.translateToLocal("gui.de.energySaturation.txt"));
if (core.maxEnergySaturation > 0) { if (core.maxEnergySaturation > 0) {
text.add( text.add(
Utills.round((double) core.energySaturation / (double) core.maxEnergySaturation * 100D, 100D) Utils.round((double) core.energySaturation / (double) core.maxEnergySaturation * 100D, 100D)
+ "%"); + "%");
} }
text.add(Utills.addCommas(core.energySaturation) + " / " + Utills.addCommas(core.maxEnergySaturation)); text.add(formatNumber(core.energySaturation) + " / " + formatNumber(core.maxEnergySaturation));
drawHoveringText(text, mouseX, mouseY, fontRendererObj); drawHoveringText(text, mouseX, mouseY, fontRendererObj);
} else if (GuiHelper.isInRect(221, 4, 18, 114, mouseX - guiLeft, mouseY - guiTop)) { } else if (GuiHelper.isInRect(221, 4, 18, 114, mouseX - guiLeft, mouseY - guiTop)) {
text.add(StatCollector.translateToLocal("gui.de.fuelConversion.txt")); text.add(StatCollector.translateToLocal("gui.de.fuelConversion.txt"));
if (core.reactorFuel + core.convertedFuel > 0) { if (core.reactorFuel + core.convertedFuel > 0) {
text.add( text.add(
Utills.round( Utils.round(
((double) core.convertedFuel + core.conversionUnit) ((double) core.convertedFuel + core.conversionUnit)
/ ((double) core.convertedFuel + (double) core.reactorFuel) / ((double) core.convertedFuel + (double) core.reactorFuel)
* 100D, * 100D,
@@ -207,7 +209,7 @@ public class GUIReactor extends GUIBase {
} }
text.add(core.convertedFuel + " / " + (core.convertedFuel + core.reactorFuel)); text.add(core.convertedFuel + " / " + (core.convertedFuel + core.reactorFuel));
text.add( text.add(
"Full: " + (Utills.round( "Full: " + (Utils.round(
(float) (core.convertedFuel + core.reactorFuel) / ConfigHandler.reactorFuelStorage * 100, (float) (core.convertedFuel + core.reactorFuel) / ConfigHandler.reactorFuelStorage * 100,
1000)) + "%"); 1000)) + "%");
drawHoveringText(text, mouseX, mouseY, fontRendererObj); drawHoveringText(text, mouseX, mouseY, fontRendererObj);
@@ -251,26 +253,23 @@ public class GUIReactor extends GUIBase {
private void drawStatistics() { private void drawStatistics() {
double inputRate = core.fieldDrain / (1D - (core.fieldCharge / core.maxFieldCharge)); double inputRate = core.fieldDrain / (1D - (core.fieldCharge / core.maxFieldCharge));
fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.tempLoad.name"), 55, 16, 0x0000FF); fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.tempLoad.name"), 55, 16, 0x0000FF);
fontRendererObj.drawString(Utills.round(core.tempDrainFactor * 100D, 1D) + "%", 60, 2 + 24, 0); fontRendererObj.drawString(Utils.round(core.tempDrainFactor * 100D, 1D) + "%", 60, 2 + 24, 0);
fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.mass.name"), 55, 16 + 24, 0x0000FF); fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.mass.name"), 55, 16 + 24, 0x0000FF);
fontRendererObj.drawString( fontRendererObj.drawString(
Utills.round((core.reactorFuel + core.convertedFuel) / 1296D, 100) + "m^3", Utils.round((core.reactorFuel + core.convertedFuel) / 1296D, 100) + "m^3",
60, 60,
2 + 2 * 24, 2 + 2 * 24,
0); 0);
fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.genRate.name"), 55, 16 + 2 * 24, 0x0000FF); fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.genRate.name"), 55, 16 + 2 * 24, 0x0000FF);
fontRendererObj.drawString(Utills.addCommas((int) core.generationRate) + "RF/t", 60, 2 + 3 * 24, 0); fontRendererObj.drawString(formatNumber((int) core.generationRate) + "RF/t", 60, 2 + 3 * 24, 0);
fontRendererObj fontRendererObj
.drawString(StatCollector.translateToLocal("gui.de.fieldInputRate.name"), 55, 16 + 3 * 24, 0x0000FF); .drawString(StatCollector.translateToLocal("gui.de.fieldInputRate.name"), 55, 16 + 3 * 24, 0x0000FF);
fontRendererObj fontRendererObj
.drawString(Utills.addCommas((int) Math.min(inputRate, Integer.MAX_VALUE)) + "RF/t", 60, 2 + 4 * 24, 0); .drawString(formatNumber((int) Math.min(inputRate, Integer.MAX_VALUE)) + "RF/t", 60, 2 + 4 * 24, 0);
fontRendererObj fontRendererObj
.drawString(StatCollector.translateToLocal("gui.de.fuelConversion.name"), 55, 16 + 4 * 24, 0x0000FF); .drawString(StatCollector.translateToLocal("gui.de.fuelConversion.name"), 55, 16 + 4 * 24, 0x0000FF);
fontRendererObj.drawString( fontRendererObj
Utills.addCommas((int) Math.round(core.fuelUseRate * 1000000D)) + "nb/t", .drawString(formatNumber((int) Math.round(core.fuelUseRate * 1000000D)) + "nb/t", 60, 2 + 5 * 24, 0);
60,
2 + 5 * 24,
0);
} }
private void drawStatus() { private void drawStatus() {
@@ -1,5 +1,7 @@
package com.brandon3055.draconicevolution.client.gui.componentguis; package com.brandon3055.draconicevolution.client.gui.componentguis;
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -11,29 +13,29 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector; import net.minecraft.util.StatCollector;
import net.minecraft.util.StringUtils; import net.minecraft.util.StringUtils;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentBase;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentButton;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentCollection;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentItemRenderer;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentTextField;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentTexturedRect;
import com.brandon3055.brandonscore.client.gui.guicomponents.GUIBase;
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
import com.brandon3055.brandonscore.common.utills.Utills;
import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.gui.GuiHudConfig; import com.brandon3055.draconicevolution.client.gui.GuiHudConfig;
import com.brandon3055.draconicevolution.client.gui.guicomponents.ComponentConfigItemButton; import com.brandon3055.draconicevolution.client.gui.guicomponents.ComponentConfigItemButton;
import com.brandon3055.draconicevolution.client.gui.guicomponents.ComponentFieldAdjuster; import com.brandon3055.draconicevolution.client.gui.guicomponents.ComponentFieldAdjuster;
import com.brandon3055.draconicevolution.client.gui.guicomponents.ComponentFieldButton; import com.brandon3055.draconicevolution.client.gui.guicomponents.ComponentFieldButton;
import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentBase;
import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentButton;
import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentCollection;
import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentItemRenderer;
import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentTextField;
import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentTexturedRect;
import com.brandon3055.draconicevolution.client.utils.guicomponents.GUIBase;
import com.brandon3055.draconicevolution.common.container.ContainerAdvTool; import com.brandon3055.draconicevolution.common.container.ContainerAdvTool;
import com.brandon3055.draconicevolution.common.handler.ContributorHandler; import com.brandon3055.draconicevolution.common.handler.ContributorHandler;
import com.brandon3055.draconicevolution.common.items.weapons.BowHandler; import com.brandon3055.draconicevolution.common.items.weapons.BowHandler;
import com.brandon3055.draconicevolution.common.items.weapons.IEnergyContainerBowItem;
import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.network.ContributorPacket; import com.brandon3055.draconicevolution.common.network.ContributorPacket;
import com.brandon3055.draconicevolution.common.network.ItemConfigPacket; import com.brandon3055.draconicevolution.common.network.ItemConfigPacket;
import com.brandon3055.draconicevolution.common.utills.IConfigurableItem; import com.brandon3055.draconicevolution.common.utils.IConfigurableItem;
import com.brandon3055.draconicevolution.common.utills.IInventoryTool; import com.brandon3055.draconicevolution.common.utils.IInventoryTool;
import com.brandon3055.draconicevolution.common.utills.ItemConfigField; import com.brandon3055.draconicevolution.common.utils.ItemConfigField;
import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper;
/** /**
* Created by Brandon on 26/12/2014. * Created by Brandon on 26/12/2014.
@@ -309,11 +311,11 @@ public class GUIToolConfig extends GUIBase {
super.drawGuiContainerForegroundLayer(mouseX, mouseY); super.drawGuiContainerForegroundLayer(mouseX, mouseY);
if (slot > -1) editingItem = player.inventory.getStackInSlot(slot); if (slot > -1) editingItem = player.inventory.getStackInSlot(slot);
if (slot > -1 && editingItem != null && editingItem.getUnlocalizedName().toLowerCase().contains("bow")) { if (slot > -1 && editingItem != null && editingItem.getItem() instanceof IEnergyContainerBowItem) {
BowHandler.BowProperties properties = new BowHandler.BowProperties(editingItem, player); BowHandler.BowProperties properties = new BowHandler.BowProperties(editingItem, player);
if (!properties.canFire() && properties.cantFireMessage != null if (!properties.canFire() && properties.cantFireMessage != null
&& !properties.cantFireMessage.equals("msg.de.outOfArrows.name")) { && !properties.cantFireMessage.equals("msg.de.outOfArrows.txt")) {
fontRendererObj.drawSplitString( fontRendererObj.drawSplitString(
StatCollector.translateToLocal(properties.cantFireMessage), StatCollector.translateToLocal(properties.cantFireMessage),
0, 0,
@@ -325,7 +327,7 @@ public class GUIToolConfig extends GUIBase {
List<String> list = new ArrayList<String>(); List<String> list = new ArrayList<String>();
list.add( list.add(
StatCollector.translateToLocal("gui.de.rfPerShot.txt") + ": " StatCollector.translateToLocal("gui.de.rfPerShot.txt") + ": "
+ Utills.addCommas(properties.calculateEnergyCost())); + formatNumber(properties.calculateEnergyCost()));
list.add( list.add(
StatCollector.translateToLocal("gui.de.maxDamage.txt") + ": " StatCollector.translateToLocal("gui.de.maxDamage.txt") + ": "
+ properties.arrowDamage * (properties.arrowSpeed * 3)); + properties.arrowDamage * (properties.arrowSpeed * 3));
@@ -6,12 +6,12 @@ import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentButton; import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentButton;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentCollection; import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentCollection;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentItemRenderer; import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentItemRenderer;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentSlotBackground; import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentSlotBackground;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentTexturedRect; import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentTexturedRect;
import com.brandon3055.brandonscore.client.gui.guicomponents.GUIBase; import com.brandon3055.draconicevolution.client.utils.guicomponents.GUIBase;
import com.brandon3055.draconicevolution.common.container.ContainerAdvTool; import com.brandon3055.draconicevolution.common.container.ContainerAdvTool;
import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.References;
@@ -4,7 +4,7 @@ import net.minecraft.util.StatCollector;
import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;
import com.brandon3055.draconicevolution.common.utills.LogHelper; import com.brandon3055.draconicevolution.common.utils.LogHelper;
/** /**
* Created by Brandon on 7/03/2015. * Created by Brandon on 7/03/2015.
@@ -9,11 +9,11 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentBase; import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentBase;
import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.utills.IConfigurableItem; import com.brandon3055.draconicevolution.common.utils.IConfigurableItem;
import com.brandon3055.draconicevolution.common.utills.IInventoryTool; import com.brandon3055.draconicevolution.common.utils.IInventoryTool;
import com.brandon3055.draconicevolution.common.utills.ItemConfigField; import com.brandon3055.draconicevolution.common.utils.ItemConfigField;
/** /**
* Created by Brandon on 29/12/2014. * Created by Brandon on 29/12/2014.
@@ -17,13 +17,13 @@ import net.minecraft.util.StringUtils;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentScrollingBase;
import com.brandon3055.brandonscore.client.gui.guicomponents.GUIScrollingBase;
import com.brandon3055.brandonscore.client.utills.ClientUtills;
import com.brandon3055.brandonscore.common.utills.InfoHelper;
import com.brandon3055.draconicevolution.client.handler.ResourceHandler; import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
import com.brandon3055.draconicevolution.client.utils.ClientUtils;
import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentScrollingBase;
import com.brandon3055.draconicevolution.client.utils.guicomponents.GUIScrollingBase;
import com.brandon3055.draconicevolution.common.handler.ContributorHandler; import com.brandon3055.draconicevolution.common.handler.ContributorHandler;
import com.brandon3055.draconicevolution.common.handler.ContributorHandler.Contributor; import com.brandon3055.draconicevolution.common.handler.ContributorHandler.Contributor;
import com.brandon3055.draconicevolution.common.utils.InfoHelper;
/** /**
* Created by brandon3055 on 5/11/2015. * Created by brandon3055 on 5/11/2015.
@@ -188,7 +188,7 @@ public class ComponentContributorsPage extends ComponentScrollingBase implements
@Override @Override
public void confirmClicked(boolean confirmed, int button) { public void confirmClicked(boolean confirmed, int button) {
mc.displayGuiScreen(this.gui); mc.displayGuiScreen(this.gui);
if (confirmed) ClientUtills.openLink(lastClickURL); if (confirmed) ClientUtils.openLink(lastClickURL);
} }
private static ModelBiped modelBiped = new ModelBiped(0.0265F); private static ModelBiped modelBiped = new ModelBiped(0.0265F);
@@ -6,13 +6,13 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector; import net.minecraft.util.StatCollector;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentBase;
import com.brandon3055.brandonscore.client.utills.GuiHelper;
import com.brandon3055.brandonscore.common.utills.DataUtills;
import com.brandon3055.draconicevolution.client.gui.componentguis.GUIToolConfig; import com.brandon3055.draconicevolution.client.gui.componentguis.GUIToolConfig;
import com.brandon3055.draconicevolution.client.utils.GuiHelper;
import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentBase;
import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.utills.IConfigurableItem; import com.brandon3055.draconicevolution.common.utils.DataUtils;
import com.brandon3055.draconicevolution.common.utills.ItemConfigField; import com.brandon3055.draconicevolution.common.utils.IConfigurableItem;
import com.brandon3055.draconicevolution.common.utils.ItemConfigField;
/** /**
* Created by Brandon on 1/01/2015. * Created by Brandon on 1/01/2015.
@@ -212,7 +212,7 @@ public class ComponentFieldAdjuster extends ComponentBase {
.playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); .playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
ItemStack stack = gui.player.inventory.getStackInSlot(field.slot); ItemStack stack = gui.player.inventory.getStackInSlot(field.slot);
if (stack != null && stack.getItem() instanceof IConfigurableItem) { if (stack != null && stack.getItem() instanceof IConfigurableItem) {
DataUtills.writeObjectToCompound( DataUtils.writeObjectToCompound(
IConfigurableItem.ProfileHelper.getProfileCompound(stack), IConfigurableItem.ProfileHelper.getProfileCompound(stack),
field.value, field.value,
field.datatype, field.datatype,
@@ -9,12 +9,12 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentBase;
import com.brandon3055.brandonscore.common.utills.DataUtills;
import com.brandon3055.draconicevolution.client.gui.componentguis.GUIToolConfig; import com.brandon3055.draconicevolution.client.gui.componentguis.GUIToolConfig;
import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentBase;
import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.utills.IConfigurableItem; import com.brandon3055.draconicevolution.common.utils.DataUtils;
import com.brandon3055.draconicevolution.common.utills.ItemConfigField; import com.brandon3055.draconicevolution.common.utils.IConfigurableItem;
import com.brandon3055.draconicevolution.common.utils.ItemConfigField;
/** /**
* Created by Brandon on 31/12/2014. * Created by Brandon on 31/12/2014.
@@ -96,7 +96,7 @@ public class ComponentFieldButton extends ComponentBase {
field.sendChanges(); field.sendChanges();
ItemStack stack = gui.player.inventory.getStackInSlot(field.slot); ItemStack stack = gui.player.inventory.getStackInSlot(field.slot);
if (stack != null && stack.getItem() instanceof IConfigurableItem) { if (stack != null && stack.getItem() instanceof IConfigurableItem) {
DataUtills.writeObjectToCompound( DataUtils.writeObjectToCompound(
IConfigurableItem.ProfileHelper.getProfileCompound(stack), IConfigurableItem.ProfileHelper.getProfileCompound(stack),
field.value, field.value,
field.datatype, field.datatype,
@@ -6,11 +6,11 @@ import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentScrollingBase;
import com.brandon3055.brandonscore.client.gui.guicomponents.GUIScrollingBase;
import com.brandon3055.brandonscore.common.utills.Utills;
import com.brandon3055.draconicevolution.client.gui.componentguis.ManualPage; import com.brandon3055.draconicevolution.client.gui.componentguis.ManualPage;
import com.brandon3055.draconicevolution.client.handler.ResourceHandler; import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentScrollingBase;
import com.brandon3055.draconicevolution.client.utils.guicomponents.GUIScrollingBase;
import com.brandon3055.draconicevolution.common.utils.Utils;
/** /**
* Created by Brandon on 7/03/2015. * Created by Brandon on 7/03/2015.
@@ -23,7 +23,7 @@ public class ComponentIndexButton extends ComponentScrollingBase {
public ComponentIndexButton(int x, int y, GUIScrollingBase gui, ManualPage page) { public ComponentIndexButton(int x, int y, GUIScrollingBase gui, ManualPage page) {
super(x, y, gui); super(x, y, gui);
this.page = page; this.page = page;
stack = Utills.getStackFromName(page.name, page.meta); stack = Utils.getStackFromName(page.name, page.meta);
} }
@Override @Override
@@ -21,14 +21,14 @@ import net.minecraftforge.oredict.ShapelessOreRecipe;
import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentScrollingBase;
import com.brandon3055.brandonscore.client.gui.guicomponents.GUIScrollingBase;
import com.brandon3055.brandonscore.client.utills.GuiHelper;
import com.brandon3055.brandonscore.common.utills.InfoHelper;
import com.brandon3055.brandonscore.common.utills.Utills;
import com.brandon3055.draconicevolution.client.gui.componentguis.ManualPage; import com.brandon3055.draconicevolution.client.gui.componentguis.ManualPage;
import com.brandon3055.draconicevolution.client.handler.ResourceHandler; import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
import com.brandon3055.draconicevolution.client.utill.CustomResourceLocation; import com.brandon3055.draconicevolution.client.utils.CustomResourceLocation;
import com.brandon3055.draconicevolution.client.utils.GuiHelper;
import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentScrollingBase;
import com.brandon3055.draconicevolution.client.utils.guicomponents.GUIScrollingBase;
import com.brandon3055.draconicevolution.common.utils.InfoHelper;
import com.brandon3055.draconicevolution.common.utils.Utils;
/** /**
* Created by Brandon on 19/03/2015. * Created by Brandon on 19/03/2015.
@@ -48,7 +48,7 @@ public class ComponentManualPage extends ComponentScrollingBase {
super(x, y, gui); super(x, y, gui);
this.page = page; this.page = page;
pageLength = 25; pageLength = 25;
stack = Utills.getStackFromName(page.name, page.meta); stack = Utils.getStackFromName(page.name, page.meta);
ContentComponent title = new ContentComponent("title." + page.getLocalizedName(), pageLength, this); ContentComponent title = new ContentComponent("title." + page.getLocalizedName(), pageLength, this);
pageLength += title.getHeight(); pageLength += title.getHeight();
contentList.add(title); contentList.add(title);
@@ -157,7 +157,7 @@ public class ComponentManualPage extends ComponentScrollingBase {
} else if (type == 2) { } else if (type == 2) {
String s = content.substring(content.indexOf("[c]") + 3); String s = content.substring(content.indexOf("[c]") + 3);
String name = s.substring(0, s.lastIndexOf(":")); String name = s.substring(0, s.lastIndexOf(":"));
ItemStack stack = Utills.getStackFromName(name, Integer.parseInt(s.substring(s.lastIndexOf(":") + 1))); ItemStack stack = Utils.getStackFromName(name, Integer.parseInt(s.substring(s.lastIndexOf(":") + 1)));
result = stack; result = stack;
if (stack != null) { if (stack != null) {
@@ -1,8 +1,5 @@
package com.brandon3055.draconicevolution.client.handler; package com.brandon3055.draconicevolution.client.handler;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Random; import java.util.Random;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@@ -10,124 +7,71 @@ import net.minecraft.client.model.ModelBiped;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.IAttributeInstance; import net.minecraft.entity.ai.attributes.IAttributeInstance;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.event.FOVUpdateEvent; import net.minecraftforge.client.event.FOVUpdateEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.RenderPlayerEvent; import net.minecraftforge.client.event.RenderPlayerEvent;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
import org.lwjgl.opengl.GL11;
import com.brandon3055.brandonscore.common.utills.DataUtills.XZPair;
import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler; import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.handler.ContributorHandler; import com.brandon3055.draconicevolution.common.handler.ContributorHandler;
import com.brandon3055.draconicevolution.common.items.armor.CustomArmorHandler; import com.brandon3055.draconicevolution.common.items.armor.ArmorSummary;
import com.brandon3055.draconicevolution.common.items.armor.DraconicArmor; import com.brandon3055.draconicevolution.common.items.armor.DraconicArmor;
import com.brandon3055.draconicevolution.common.items.armor.WyvernArmor; import com.brandon3055.draconicevolution.common.items.armor.WyvernArmor;
import com.brandon3055.draconicevolution.common.items.weapons.BowHandler; import com.brandon3055.draconicevolution.common.items.weapons.BowHandler;
import com.brandon3055.draconicevolution.common.items.weapons.DraconicBow; import com.brandon3055.draconicevolution.common.items.weapons.DraconicBow;
import com.brandon3055.draconicevolution.common.items.weapons.WyvernBow; import com.brandon3055.draconicevolution.common.items.weapons.WyvernBow;
import com.brandon3055.draconicevolution.common.network.MountUpdatePacket; import com.brandon3055.draconicevolution.common.network.MountUpdatePacket;
import com.brandon3055.draconicevolution.common.utills.LogHelper; import com.brandon3055.draconicevolution.common.utils.LogHelper;
import cpw.mods.fml.common.eventhandler.EventPriority; import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent; import cpw.mods.fml.common.gameevent.TickEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/** /**
* Created by Brandon on 28/10/2014. * Created by Brandon on 28/10/2014.
*/ */
public class ClientEventHandler { public final class ClientEventHandler {
public static Map<EntityPlayer, XZPair<Float, Integer>> playerShieldStatus = new HashMap<EntityPlayer, XZPair<Float, Integer>>(); private static final Random RANDOM = new Random();
public static int elapsedTicks; private int elapsedTicks;
private static float previousFOB = 0f; private int remountTicksRemaining = 0;
public static float previousSensitivity = 0; private int remountEntityID = 0;
public static boolean bowZoom = false; private float energyCrystalAlphaValue = 0f;
public static boolean lastTickBowZoom = false; private float energyCrystalAlphaTarget = 0f;
public static int tickSet = 0;
public static ItemDisplayManager statusDisplayManager = new ItemDisplayManager(60);
private static int remountTicksRemaining = 0;
private static int remountEntityID = 0;
public static float energyCrystalAlphaValue = 0f;
public static float energyCrystalAlphaTarget = 0f;
public static boolean playerHoldingWrench = false;
public static Minecraft mc;
private static Random rand = new Random();
private static IModelCustom shieldSphere;
public ClientEventHandler() {
shieldSphere = AdvancedModelLoader.loadModel(ResourceHandler.getResource("models/shieldSphere.obj"));
}
@SubscribeEvent @SubscribeEvent
public void tickEnd(TickEvent.ClientTickEvent event) { public void tickEnd(TickEvent.ClientTickEvent event) {
if (event.phase != TickEvent.Phase.START || event.type != TickEvent.Type.CLIENT || event.side != Side.CLIENT) if (event.phase != TickEvent.Phase.START) {
return; return;
for (Iterator<Map.Entry<EntityPlayer, XZPair<Float, Integer>>> i = playerShieldStatus.entrySet().iterator(); i
.hasNext();) {
Map.Entry<EntityPlayer, XZPair<Float, Integer>> entry = i.next();
if (elapsedTicks - entry.getValue().getValue() > 5) i.remove();
} }
if (mc == null) mc = Minecraft.getMinecraft(); final Minecraft mc = Minecraft.getMinecraft();
else if (mc.theWorld != null) { if (mc.theWorld != null) {
elapsedTicks++; elapsedTicks++;
HudHandler.clientTick();
if (bowZoom && !lastTickBowZoom) {
previousSensitivity = Minecraft.getMinecraft().gameSettings.mouseSensitivity;
Minecraft.getMinecraft().gameSettings.mouseSensitivity = previousSensitivity / 3;
} else if (!bowZoom && lastTickBowZoom) {
Minecraft.getMinecraft().gameSettings.mouseSensitivity = previousSensitivity;
}
lastTickBowZoom = bowZoom;
if (elapsedTicks - tickSet > 10) bowZoom = false;
if (energyCrystalAlphaValue < energyCrystalAlphaTarget) energyCrystalAlphaValue += 0.01f; if (energyCrystalAlphaValue < energyCrystalAlphaTarget) energyCrystalAlphaValue += 0.01f;
if (energyCrystalAlphaValue > energyCrystalAlphaTarget) energyCrystalAlphaValue -= 0.01f; if (energyCrystalAlphaValue > energyCrystalAlphaTarget) energyCrystalAlphaValue -= 0.01f;
if (Math.abs(energyCrystalAlphaTarget - energyCrystalAlphaValue) <= 0.02f) if (Math.abs(energyCrystalAlphaTarget - energyCrystalAlphaValue) <= 0.02f) {
energyCrystalAlphaTarget = rand.nextFloat(); energyCrystalAlphaTarget = RANDOM.nextFloat();
}
playerHoldingWrench = mc.thePlayer.getHeldItem() != null
&& mc.thePlayer.getHeldItem().getItem() == ModItems.wrench;
searchForPlayerMount(); searchForPlayerMount();
} }
statusDisplayManager.tick();
}
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void renderGameOverlayEvent(final RenderGameOverlayEvent.Post event) {
if (event.type == RenderGameOverlayEvent.ElementType.ALL) {
statusDisplayManager.drawItemStack(event.resolution);
}
} }
@SubscribeEvent(priority = EventPriority.LOW) @SubscribeEvent(priority = EventPriority.LOW)
public void fovUpdate(FOVUpdateEvent event) { public void fovUpdate(FOVUpdateEvent event) {
// region Bow FOV Update // region Bow FOV Update
if (event.entity.getHeldItem() != null final ItemStack heldItem = event.entity.getHeldItem();
&& (event.entity.getHeldItem().getItem() instanceof WyvernBow if (heldItem != null && (heldItem.getItem() instanceof WyvernBow || heldItem.getItem() instanceof DraconicBow)
|| event.entity.getHeldItem().getItem() instanceof DraconicBow)
&& Minecraft.getMinecraft().gameSettings.keyBindUseItem.getIsKeyPressed()) { && Minecraft.getMinecraft().gameSettings.keyBindUseItem.getIsKeyPressed()) {
BowHandler.BowProperties properties = new BowHandler.BowProperties( BowHandler.BowProperties properties = new BowHandler.BowProperties(heldItem, event.entity);
event.entity.getHeldItem(),
event.entity);
event.newfov = ((6 - properties.zoomModifier) / 6) * event.fov; event.newfov = ((6 - properties.zoomModifier) / 6) * event.fov;
@@ -142,9 +86,9 @@ public class ClientEventHandler {
// endregion // endregion
// region Armor move speed FOV effect cancellation // region Armor move speed FOV effect cancellation
CustomArmorHandler.ArmorSummery summery = new CustomArmorHandler.ArmorSummery().getSummery(event.entity); final ArmorSummary summary = ArmorSummary.get(event.entity);
if (summery != null && summery.speedModifier > 0) { if (summary != null && summary.speedModifier > 0) {
IAttributeInstance iattributeinstance = event.entity IAttributeInstance iattributeinstance = event.entity
.getEntityAttribute(SharedMonsterAttributes.movementSpeed); .getEntityAttribute(SharedMonsterAttributes.movementSpeed);
float f = (float) ((iattributeinstance.getAttributeValue() float f = (float) ((iattributeinstance.getAttributeValue()
@@ -172,7 +116,7 @@ public class ClientEventHandler {
} }
} }
public static void tryRepositionPlayerOnMount(int id) { public void tryRepositionPlayerOnMount(int id) {
if (remountTicksRemaining == 500) return; if (remountTicksRemaining == 500) return;
remountTicksRemaining = 500; remountTicksRemaining = 500;
remountEntityID = id; remountEntityID = id;
@@ -186,7 +130,7 @@ public class ClientEventHandler {
@SubscribeEvent @SubscribeEvent
public void renderArmorEvent(RenderPlayerEvent.SetArmorModel event) { public void renderArmorEvent(RenderPlayerEvent.SetArmorModel event) {
if (ConfigHandler.useOriginal3DArmorModel || ConfigHandler.useOldArmorModel || event.isCanceled()) return; if (ConfigHandler.useOriginal3DArmorModel || ConfigHandler.useOldArmorModel) return;
if (event.stack != null if (event.stack != null
&& (event.stack.getItem() instanceof DraconicArmor || event.stack.getItem() instanceof WyvernArmor)) { && (event.stack.getItem() instanceof DraconicArmor || event.stack.getItem() instanceof WyvernArmor)) {
ItemArmor itemarmor = (ItemArmor) event.stack.getItem(); ItemArmor itemarmor = (ItemArmor) event.stack.getItem();
@@ -199,52 +143,11 @@ public class ClientEventHandler {
} }
} }
@SubscribeEvent public int getElapsedTicks() {
public void renderPlayerEvent(RenderPlayerEvent.Post event) { return elapsedTicks;
if (playerShieldStatus.containsKey(event.entityPlayer)) { }
GL11.glPushMatrix();
GL11.glDepthMask(false);
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_LIGHTING);
ResourceHandler.bindResource("textures/models/shieldSphere.png");
float p = playerShieldStatus.get(event.entityPlayer).getKey(); public float getEnergyCrystalAlpha() {
return energyCrystalAlphaValue;
EntityPlayer viewingPlayer = Minecraft.getMinecraft().thePlayer;
int i = 5 - (elapsedTicks - playerShieldStatus.get(event.entityPlayer).getValue());
GL11.glColor4f(1F - p, 0F, p, i / 5F);
if (viewingPlayer != event.entityPlayer) {
double translationXLT = event.entityPlayer.prevPosX - viewingPlayer.prevPosX;
double translationYLT = event.entityPlayer.prevPosY - viewingPlayer.prevPosY;
double translationZLT = event.entityPlayer.prevPosZ - viewingPlayer.prevPosZ;
double translationX = translationXLT
+ (((event.entityPlayer.posX - viewingPlayer.posX) - translationXLT) * event.partialRenderTick);
double translationY = translationYLT
+ (((event.entityPlayer.posY - viewingPlayer.posY) - translationYLT) * event.partialRenderTick);
double translationZ = translationZLT
+ (((event.entityPlayer.posZ - viewingPlayer.posZ) - translationZLT) * event.partialRenderTick);
GL11.glTranslated(translationX, translationY + 1.1, translationZ);
} else {
GL11.glTranslated(0, -0.5, 0);
}
GL11.glScaled(1, 1.5, 1);
shieldSphere.renderAll();
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDepthMask(true);
GL11.glPopMatrix();
}
} }
} }
@@ -1,5 +1,7 @@
package com.brandon3055.draconicevolution.client.handler; package com.brandon3055.draconicevolution.client.handler;
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -14,49 +16,44 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import com.brandon3055.brandonscore.client.utills.GuiHelper;
import com.brandon3055.brandonscore.common.utills.Utills;
import com.brandon3055.draconicevolution.client.gui.GuiHudConfig; import com.brandon3055.draconicevolution.client.gui.GuiHudConfig;
import com.brandon3055.draconicevolution.client.utils.GuiHelper;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler; import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.items.armor.CustomArmorHandler; import com.brandon3055.draconicevolution.common.items.armor.ArmorSummary;
import com.brandon3055.draconicevolution.common.utills.IHudDisplayBlock; import com.brandon3055.draconicevolution.common.utils.IHudDisplayBlock;
import com.brandon3055.draconicevolution.common.utills.IHudDisplayItem; import com.brandon3055.draconicevolution.common.utils.IHudDisplayItem;
import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.common.gameevent.TickEvent;
import cpw.mods.fml.relauncher.SideOnly;
/** /**
* Created by Brandon on 26/01/2015. * Created by Brandon on 26/01/2015.
*/ */
public class HudHandler { public final class HudHandler {
private static List<String> hudList = null; private List<String> hudList = null;
private static List<String> ltHudList = null; private List<String> ltHudList = null;
private static float toolTipFadeOut = 0F; private float toolTipFadeOut = 0F;
private static float armorStatsFadeOut = 0F; private float armorStatsFadeOut = 0F;
private static boolean showShieldHud = false; private boolean showShieldHud = false;
private static int shieldPercentCharge = 0; private int shieldPercentCharge = 0;
private static float shieldPoints = 0F; private float shieldPoints = 0F;
private static float maxShieldPoints = 0F; private float maxShieldPoints = 0F;
private static float shieldEntropy = 0F; private float shieldEntropy = 0F;
private static int rfCharge = 0; private int rfCharge = 0;
private static long rfTotal = 0; private long rfTotal = 0;
int width;
int height;
@SubscribeEvent @SubscribeEvent
@SideOnly(Side.CLIENT)
public void drawHUD(RenderGameOverlayEvent.Post event) { public void drawHUD(RenderGameOverlayEvent.Post event) {
Minecraft mc = Minecraft.getMinecraft(); Minecraft mc = Minecraft.getMinecraft();
if (event.type != RenderGameOverlayEvent.ElementType.ALL || mc.gameSettings.showDebugInfo if (event.type != RenderGameOverlayEvent.ElementType.ALL || mc.gameSettings.showDebugInfo
|| mc.currentScreen instanceof GuiChat) || mc.currentScreen instanceof GuiChat) {
return; return;
}
ScaledResolution resolution = event.resolution; ScaledResolution resolution = event.resolution;
width = resolution.getScaledWidth(); final int width = resolution.getScaledWidth();
height = resolution.getScaledHeight(); final int height = resolution.getScaledHeight();
FontRenderer fontRenderer = mc.fontRenderer; FontRenderer fontRenderer = mc.fontRenderer;
if (ConfigHandler.hudSettings[10] == 1 && hudList != null && toolTipFadeOut > 0) { if (ConfigHandler.hudSettings[10] == 1 && hudList != null && toolTipFadeOut > 0) {
@@ -85,13 +82,20 @@ public class HudHandler {
} }
} }
// x, y, x, y, scale, scale, fademode, fademode, rotateArmor, armorText @SubscribeEvent
@SideOnly(Side.CLIENT) public void tickEnd(TickEvent.ClientTickEvent event) {
public static void clientTick() { if (event.phase == TickEvent.Phase.END && Minecraft.getMinecraft().theWorld != null) {
this.clientTick();
}
}
private void clientTick() {
if (ConfigHandler.hudSettings[6] > 0 && toolTipFadeOut > 1F - ((float) ConfigHandler.hudSettings[6] * 0.25F)) { if (ConfigHandler.hudSettings[6] > 0 && toolTipFadeOut > 1F - ((float) ConfigHandler.hudSettings[6] * 0.25F)) {
toolTipFadeOut -= 0.1F; toolTipFadeOut -= 0.1F;
} }
if (hudList != null && (ltHudList == null || !hudList.equals(ltHudList))) toolTipFadeOut = 5F; if (hudList != null && !hudList.equals(ltHudList)) {
toolTipFadeOut = 5F;
}
if (ConfigHandler.hudSettings[7] > 0 if (ConfigHandler.hudSettings[7] > 0
&& armorStatsFadeOut > 1F - ((float) ConfigHandler.hudSettings[7] * 0.25F)) { && armorStatsFadeOut > 1F - ((float) ConfigHandler.hudSettings[7] * 0.25F)) {
armorStatsFadeOut -= 0.1F; armorStatsFadeOut -= 0.1F;
@@ -107,7 +111,7 @@ public class HudHandler {
if (mc.currentScreen != null) { if (mc.currentScreen != null) {
if (mc.currentScreen instanceof GuiHudConfig) { if (mc.currentScreen instanceof GuiHudConfig) {
hudList = new ArrayList<String>(); hudList = new ArrayList<>();
hudList.add(StatCollector.translateToLocal("info.de.hudDisplayConfigTxt1.txt")); hudList.add(StatCollector.translateToLocal("info.de.hudDisplayConfigTxt1.txt"));
hudList.add(""); hudList.add("");
hudList.add(""); hudList.add("");
@@ -129,26 +133,41 @@ public class HudHandler {
.getDisplayData(mc.theWorld, mop.blockX, mop.blockY, mop.blockZ); .getDisplayData(mc.theWorld, mop.blockX, mop.blockY, mop.blockZ);
} }
CustomArmorHandler.ArmorSummery summery = new CustomArmorHandler.ArmorSummery().getSummery(mc.thePlayer); final ArmorSummary summary = ArmorSummary.get(mc.thePlayer);
if (summery == null) { if (summary == null) {
showShieldHud = false; showShieldHud = false;
return; return;
} }
if (!shouldDisplayArmorHud(summary)) {
showShieldHud = false;
armorStatsFadeOut = 0F;
maxShieldPoints = 0F;
shieldPoints = 0F;
shieldPercentCharge = 0;
shieldEntropy = 0F;
rfCharge = 0;
rfTotal = 0;
return;
}
showShieldHud = armorStatsFadeOut > 0F; showShieldHud = armorStatsFadeOut > 0F;
if (maxShieldPoints != summery.maxProtectionPoints || shieldPoints != summery.protectionPoints if (maxShieldPoints != summary.maxProtectionPoints || shieldPoints != summary.protectionPoints
|| shieldEntropy != summery.entropy || shieldEntropy != summary.entropy
|| rfTotal != summery.totalEnergyStored) || rfTotal != summary.totalEnergyStored)
armorStatsFadeOut = 5F; armorStatsFadeOut = 5F;
maxShieldPoints = summery.maxProtectionPoints; maxShieldPoints = summary.maxProtectionPoints;
shieldPoints = summery.protectionPoints; shieldPoints = summary.protectionPoints;
shieldPercentCharge = (int) (summery.protectionPoints / summery.maxProtectionPoints * 100D); shieldPercentCharge = (int) (summary.protectionPoints / summary.maxProtectionPoints * 100D);
shieldEntropy = summery.entropy; shieldEntropy = summary.entropy;
rfCharge = (int) ((double) summery.totalEnergyStored / Math.max((double) summery.maxTotalEnergyStorage, 1D) rfCharge = (int) ((double) summary.totalEnergyStored / Math.max((double) summary.maxTotalEnergyStorage, 1D)
* 100D); * 100D);
rfTotal = summery.totalEnergyStored; rfTotal = summary.totalEnergyStored;
}
private boolean shouldDisplayArmorHud(ArmorSummary summary) {
return summary.maxProtectionPoints > 0F || summary.maxTotalEnergyStorage > 0;
} }
private void drawArmorHUD(int x, int y, boolean rotated, double scale) { private void drawArmorHUD(int x, int y, boolean rotated, double scale) {
@@ -213,7 +232,7 @@ public class HudHandler {
GL11.glTranslated(-x, -y, 0); GL11.glTranslated(-x, -y, 0);
String shield = Math.round(shieldPoints) + "/" + (int) maxShieldPoints; String shield = Math.round(shieldPoints) + "/" + (int) maxShieldPoints;
String entropy = "EN: " + (int) shieldEntropy + "%"; String entropy = "EN: " + (int) shieldEntropy + "%";
String energy = "RF: " + Utills.formatNumber(rfTotal); String energy = "RF: " + formatNumber(rfTotal);
float fade = Math.min(armorStatsFadeOut, 1F); float fade = Math.min(armorStatsFadeOut, 1F);
if (!rotated) { if (!rotated) {
fontRenderer fontRenderer
@@ -2,54 +2,64 @@ package com.brandon3055.draconicevolution.client.handler;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12; import org.lwjgl.opengl.GL12;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
public final class ItemDisplayManager { public final class ItemDisplayManager {
private static final RenderItem renderItem = new RenderItem();
private static final FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
private static final TextureManager textureManager = Minecraft.getMinecraft().getTextureManager();
private final int ticks; private final int ticks;
private ItemStack itemStack; private ItemStack itemStack;
private int ticksCounter; private int ticksCounter;
private static final RenderItem renderItem = new RenderItem();
private static final FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
private static final TextureManager textureManager = Minecraft.getMinecraft().getTextureManager();
public ItemDisplayManager(int ticks) { public ItemDisplayManager(int ticks) {
this.ticks = ticks; this.ticks = ticks;
} }
public void startDrawing(ItemStack itemStack) { public void startDrawing(ItemStack itemStack) {
this.itemStack = itemStack; this.itemStack = itemStack == null ? null : itemStack.copy();
ticksCounter = ticks; ticksCounter = ticks;
} }
public void tick() { @SubscribeEvent
if (--ticksCounter == 0) { public void tickEnd(TickEvent.ClientTickEvent event) {
itemStack = null; if (event.phase == TickEvent.Phase.END) {
if (--ticksCounter == 0) {
itemStack = null;
}
} }
} }
public void drawItemStack(ScaledResolution resolution) { @SubscribeEvent
if (ticksCounter > 0 && itemStack != null && itemStack.getItem() != null) { public void renderGameOverlayEvent(RenderGameOverlayEvent.Post event) {
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); if (event.type == RenderGameOverlayEvent.ElementType.ALL) {
GL11.glEnable(GL12.GL_RESCALE_NORMAL); if (ticksCounter > 0 && itemStack != null && itemStack.getItem() != null) {
RenderHelper.enableGUIStandardItemLighting(); GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderHelper.enableGUIStandardItemLighting();
GL11.glPushMatrix(); GL11.glPushMatrix();
final int y = resolution.getScaledHeight(); final int y = event.resolution.getScaledHeight();
GL11.glTranslatef(7.0f, y * 0.25f, 0); GL11.glTranslatef(7.0f, y * 0.25f, 0);
renderItem.renderItemAndEffectIntoGUI(fontRenderer, textureManager, itemStack, 0, 0); renderItem.renderItemAndEffectIntoGUI(fontRenderer, textureManager, itemStack, 0, 0);
GL11.glPopMatrix(); GL11.glPopMatrix();
RenderHelper.disableStandardItemLighting(); RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_BLEND);
}
} }
} }
} }
@@ -2,7 +2,6 @@ package com.brandon3055.draconicevolution.client.handler;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityFX; import net.minecraft.client.particle.EntityFX;
import net.minecraft.world.World;
import com.brandon3055.draconicevolution.client.render.particle.ParticleDistortion; import com.brandon3055.draconicevolution.client.render.particle.ParticleDistortion;
@@ -10,16 +9,14 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public class ParticleHandler { public final class ParticleHandler {
private static Minecraft mc = Minecraft.getMinecraft();
private static World theWorld = mc.theWorld;
public static EntityFX spawnParticle(String particleName, double x, double y, double z, double motionX, public static EntityFX spawnParticle(String particleName, double x, double y, double z, double motionX,
double motionY, double motionZ, float scale) { double motionY, double motionZ, float scale) {
final Minecraft mc = Minecraft.getMinecraft();
if (mc != null && mc.renderViewEntity != null && mc.effectRenderer != null) { if (mc != null && mc.renderViewEntity != null && mc.effectRenderer != null) {
int var14 = mc.gameSettings.particleSetting; int var14 = mc.gameSettings.particleSetting;
if (var14 == 1 && theWorld.rand.nextInt(3) == 0) { if (var14 == 1 && mc.theWorld.rand.nextInt(3) == 0) {
var14 = 2; var14 = 2;
} }
double var15 = mc.renderViewEntity.posX - x; double var15 = mc.renderViewEntity.posX - x;
@@ -34,7 +31,7 @@ public class ParticleHandler {
} else { } else {
if (particleName.equals("distortionParticle")) { if (particleName.equals("distortionParticle")) {
var21 = new ParticleDistortion( var21 = new ParticleDistortion(
theWorld, mc.theWorld,
x, x,
y, y,
z, z,
@@ -56,9 +53,10 @@ public class ParticleHandler {
} }
public static EntityFX spawnCustomParticle(EntityFX particle, double vewRange) { public static EntityFX spawnCustomParticle(EntityFX particle, double vewRange) {
final Minecraft mc = Minecraft.getMinecraft();
if (mc != null && mc.renderViewEntity != null && mc.effectRenderer != null) { if (mc != null && mc.renderViewEntity != null && mc.effectRenderer != null) {
int var14 = mc.gameSettings.particleSetting; int var14 = mc.gameSettings.particleSetting;
if (var14 == 1 && theWorld.rand.nextInt(3) == 0) { if (var14 == 1 && mc.theWorld.rand.nextInt(3) == 0) {
var14 = 2; var14 = 2;
} }
if (!isInRange(particle.posX, particle.posY, particle.posZ, vewRange)) { if (!isInRange(particle.posX, particle.posY, particle.posZ, vewRange)) {
@@ -74,14 +72,12 @@ public class ParticleHandler {
} }
public static boolean isInRange(double x, double y, double z, double vewRange) { public static boolean isInRange(double x, double y, double z, double vewRange) {
final Minecraft mc = Minecraft.getMinecraft();
if (mc == null || mc.renderViewEntity == null || mc.effectRenderer == null) return false; if (mc == null || mc.renderViewEntity == null || mc.effectRenderer == null) return false;
double var15 = mc.renderViewEntity.posX - x; double var15 = mc.renderViewEntity.posX - x;
double var17 = mc.renderViewEntity.posY - y; double var17 = mc.renderViewEntity.posY - y;
double var19 = mc.renderViewEntity.posZ - z; double var19 = mc.renderViewEntity.posZ - z;
if (var15 * var15 + var17 * var17 + var19 * var19 > vewRange * vewRange) { return !(var15 * var15 + var17 * var17 + var19 * var19 > vewRange * vewRange);
return false;
}
return true;
} }
} }
@@ -15,6 +15,7 @@ import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
@@ -26,9 +27,9 @@ import net.minecraft.util.ResourceLocation;
import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;
import com.brandon3055.draconicevolution.client.gui.componentguis.GUIManual; import com.brandon3055.draconicevolution.client.gui.componentguis.GUIManual;
import com.brandon3055.draconicevolution.client.utill.CustomResourceLocation; import com.brandon3055.draconicevolution.client.utils.CustomResourceLocation;
import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.utills.LogHelper; import com.brandon3055.draconicevolution.common.utils.LogHelper;
import com.google.common.io.ByteStreams; import com.google.common.io.ByteStreams;
import com.google.gson.stream.JsonWriter; import com.google.gson.stream.JsonWriter;
@@ -48,7 +49,7 @@ public class ResourceHandler {
private static ResourceLocation particles = new ResourceLocation( private static ResourceLocation particles = new ResourceLocation(
References.RESOURCESPREFIX + "textures/particle/particles.png"); References.RESOURCESPREFIX + "textures/particle/particles.png");
private static Map<String, ResourceLocation> cachedResources = new HashMap<String, ResourceLocation>(); private static Map<String, ResourceLocation> cachedResources = new HashMap<String, ResourceLocation>();
public static Map<String, CustomResourceLocation> downloadedImages = new HashMap<String, CustomResourceLocation>(); public static Map<String, CustomResourceLocation> downloadedImages = new ConcurrentHashMap<>();
private static String savePath; private static String savePath;
private static File saveFolder; private static File saveFolder;
@@ -64,7 +65,6 @@ public class ResourceHandler {
if (downloadThread.isReloadRequired()) LogHelper.info("Image Download Finished"); if (downloadThread.isReloadRequired()) LogHelper.info("Image Download Finished");
downloadStatus = downloadThread.wasSuccessful ? 1 : 2; downloadStatus = downloadThread.wasSuccessful ? 1 : 2;
FMLCommonHandler.instance().bus().unregister(this); FMLCommonHandler.instance().bus().unregister(this);
addRSPack(event != null);
downloadThread = null; downloadThread = null;
} }
} }
@@ -74,6 +74,10 @@ public class ResourceHandler {
if (event != null) savePath = event.getModConfigurationDirectory().getParentFile().getAbsolutePath() if (event != null) savePath = event.getModConfigurationDirectory().getParentFile().getAbsolutePath()
+ "/config/draconicevolution"; + "/config/draconicevolution";
// Register the namespace before FML's final reload; folder-pack files are resolved on demand.
getImagesFolder();
addRSPack();
GUIManual.loadPages(); GUIManual.loadPages();
downloadThread = new DownloadThread(GUIManual.imageURLs); downloadThread = new DownloadThread(GUIManual.imageURLs);
@@ -83,7 +87,7 @@ public class ResourceHandler {
public static class DownloadThread extends Thread { public static class DownloadThread extends Thread {
private List<String> imageURLs; private List<String> imageURLs;
private boolean isFinished = false; private volatile boolean isFinished = false;
private boolean wasSuccessful = true; private boolean wasSuccessful = true;
private boolean reloadRequired = false; private boolean reloadRequired = false;
@@ -171,7 +175,7 @@ public class ResourceHandler {
} }
} }
private static void addRSPack(boolean refreash) { private static void addRSPack() {
File rspack = new File(getConfigFolder(), "/resources"); File rspack = new File(getConfigFolder(), "/resources");
if (!rspack.exists()) return; if (!rspack.exists()) return;
@@ -200,7 +204,6 @@ public class ResourceHandler {
f.set(Minecraft.getMinecraft(), defaultResourcePacks); f.set(Minecraft.getMinecraft(), defaultResourcePacks);
LogHelper.info("RS Added"); LogHelper.info("RS Added");
if (refreash) Minecraft.getMinecraft().refreshResources();
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
e.printStackTrace(); e.printStackTrace();
} }
@@ -0,0 +1,98 @@
package com.brandon3055.draconicevolution.client.handler;
import java.util.HashMap;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.client.event.RenderPlayerEvent;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
import net.minecraftforge.event.world.WorldEvent;
import org.lwjgl.opengl.GL11;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.utils.DataUtils;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public final class ShieldRenderHandler {
private static final IModelCustom SHIELD_SPHERE = AdvancedModelLoader
.loadModel(ResourceHandler.getResource("models/shieldSphere.obj"));
private final HashMap<EntityPlayer, DataUtils.XZPair<Float, Integer>> shieldStatus = new HashMap<>();
@SubscribeEvent
public void onWorldUnload(WorldEvent.Unload event) {
if (event.world.isRemote) {
this.shieldStatus.clear();
}
}
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void tickEnd(TickEvent.ClientTickEvent event) {
if (event.phase == TickEvent.Phase.END && !shieldStatus.isEmpty()) {
final int ticks = DraconicEvolution.clientProxy().getElapsedTicks();
shieldStatus.entrySet().removeIf(entry -> ticks - entry.getValue().getValue() > 5);
}
}
@SubscribeEvent
public void renderPlayerEvent(RenderPlayerEvent.Post event) {
final DataUtils.XZPair<Float, Integer> pair = shieldStatus.get(event.entityPlayer);
if (pair != null) {
GL11.glPushMatrix();
GL11.glDepthMask(false);
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_LIGHTING);
ResourceHandler.bindResource("textures/models/shieldSphere.png");
final float p = pair.getKey();
final EntityPlayer viewingPlayer = Minecraft.getMinecraft().thePlayer;
final int ticks = DraconicEvolution.clientProxy().getElapsedTicks();
final int i = 5 - (ticks - pair.getValue());
GL11.glColor4f(1F - p, 0F, p, i / 5F);
if (viewingPlayer != event.entityPlayer) {
double translationXLT = event.entityPlayer.prevPosX - viewingPlayer.prevPosX;
double translationYLT = event.entityPlayer.prevPosY - viewingPlayer.prevPosY;
double translationZLT = event.entityPlayer.prevPosZ - viewingPlayer.prevPosZ;
double translationX = translationXLT
+ (((event.entityPlayer.posX - viewingPlayer.posX) - translationXLT) * event.partialRenderTick);
double translationY = translationYLT
+ (((event.entityPlayer.posY - viewingPlayer.posY) - translationYLT) * event.partialRenderTick);
double translationZ = translationZLT
+ (((event.entityPlayer.posZ - viewingPlayer.posZ) - translationZLT) * event.partialRenderTick);
GL11.glTranslated(translationX, translationY + 1.1, translationZ);
} else {
GL11.glTranslated(0, -0.5, 0);
}
GL11.glScaled(1, 1.5, 1);
SHIELD_SPHERE.renderAll();
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDepthMask(true);
GL11.glPopMatrix();
}
}
public void renderShield(EntityPlayer player, float shieldPowerF) {
final int ticks = DraconicEvolution.clientProxy().getElapsedTicks();
this.shieldStatus.put(player, new DataUtils.XZPair<>(shieldPowerF, ticks));
}
}
@@ -1,49 +0,0 @@
package com.brandon3055.draconicevolution.client.keybinding;
import net.minecraft.client.settings.KeyBinding;
import org.lwjgl.input.Keyboard;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.integration.ModHelper;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Created by Brandon on 14/08/2014.
*/
@SideOnly(Side.CLIENT)
public final class KeyBindings {
public static final KeyBinding placeItem;
public static final KeyBinding toolConfig;
public static final KeyBinding toolProfileChange;
public static final KeyBinding toggleFlight;
public static final KeyBinding toggleMagnet;
public static KeyBinding toggleMagnetSelfPickup;
static {
placeItem = new KeyBinding("key.placeItem", Keyboard.KEY_V, References.MODNAME);
toolConfig = new KeyBinding("key.toolConfig", Keyboard.KEY_NONE, References.MODNAME);
toolProfileChange = new KeyBinding("key.toolProfileChange", Keyboard.KEY_NONE, References.MODNAME);
toggleFlight = new KeyBinding("key.toggleFlight", Keyboard.KEY_NONE, References.MODNAME);
toggleMagnet = new KeyBinding("key.toggleMagnet", Keyboard.KEY_NONE, References.MODNAME);
if (ModHelper.isHodgepodgeLoaded) toggleMagnetSelfPickup = new KeyBinding(
"key.toggleMagnetSelfPickup",
Keyboard.KEY_NONE,
References.MODNAME);
}
private KeyBindings() {}
public static void init() {
ClientRegistry.registerKeyBinding(placeItem);
ClientRegistry.registerKeyBinding(toolConfig);
ClientRegistry.registerKeyBinding(toolProfileChange);
ClientRegistry.registerKeyBinding(toggleFlight);
ClientRegistry.registerKeyBinding(toggleMagnet);
if (ModHelper.isHodgepodgeLoaded) ClientRegistry.registerKeyBinding(toggleMagnetSelfPickup);
}
}
@@ -8,25 +8,29 @@ import javax.annotation.Nonnull;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityClientPlayerMP; import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.MovingObjectPosition;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse; import org.lwjgl.input.Mouse;
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.items.tools.Magnet; import com.brandon3055.draconicevolution.common.items.tools.Magnet;
import com.brandon3055.draconicevolution.common.items.tools.baseclasses.ToolHandler; import com.brandon3055.draconicevolution.common.items.tools.baseclasses.ToolHandler;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.network.ButtonPacket; import com.brandon3055.draconicevolution.common.network.ButtonPacket;
import com.brandon3055.draconicevolution.common.network.MagnetTogglePacket; import com.brandon3055.draconicevolution.common.network.MagnetTogglePacket;
import com.brandon3055.draconicevolution.common.network.MagnetToggleSelfPickupPacket; import com.brandon3055.draconicevolution.common.network.MagnetToggleSelfPickupPacket;
import com.brandon3055.draconicevolution.common.network.PlacedItemPacket; import com.brandon3055.draconicevolution.common.network.PlacedItemPacket;
import com.brandon3055.draconicevolution.common.network.TeleporterPacket; import com.brandon3055.draconicevolution.common.network.TeleporterPacket;
import com.brandon3055.draconicevolution.common.utills.IConfigurableItem; import com.brandon3055.draconicevolution.common.utils.IConfigurableItem;
import com.brandon3055.draconicevolution.common.utills.InventoryUtils; import com.brandon3055.draconicevolution.common.utils.InventoryUtils;
import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper;
import com.brandon3055.draconicevolution.integration.ModHelper; import com.brandon3055.draconicevolution.integration.ModHelper;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.InputEvent; import cpw.mods.fml.common.gameevent.InputEvent;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
@@ -35,24 +39,56 @@ import cpw.mods.fml.relauncher.SideOnly;
/** /**
* Created by Brandon on 14/08/2014. * Created by Brandon on 14/08/2014.
*/ */
public class KeyInputHandler { @SideOnly(Side.CLIENT)
public final class KeyInputHandler {
private final KeyBinding placeItem;
private final KeyBinding toolConfig;
private final KeyBinding toolProfileChange;
private final KeyBinding toggleFlight;
private final KeyBinding toggleMagnet;
private final KeyBinding toggleMagnetSelfPickup;
public KeyInputHandler() {
placeItem = new KeyBinding("key.placeItem", Keyboard.KEY_V, References.MODNAME);
toolConfig = new KeyBinding("key.toolConfig", Keyboard.KEY_NONE, References.MODNAME);
toolProfileChange = new KeyBinding("key.toolProfileChange", Keyboard.KEY_NONE, References.MODNAME);
toggleFlight = new KeyBinding("key.toggleFlight", Keyboard.KEY_NONE, References.MODNAME);
toggleMagnet = new KeyBinding("key.toggleMagnet", Keyboard.KEY_NONE, References.MODNAME);
if (ModHelper.isHodgepodgeLoaded) {
toggleMagnetSelfPickup = new KeyBinding(
"key.toggleMagnetSelfPickup",
Keyboard.KEY_NONE,
References.MODNAME);
} else {
toggleMagnetSelfPickup = null;
}
ClientRegistry.registerKeyBinding(placeItem);
ClientRegistry.registerKeyBinding(toolConfig);
ClientRegistry.registerKeyBinding(toolProfileChange);
ClientRegistry.registerKeyBinding(toggleFlight);
ClientRegistry.registerKeyBinding(toggleMagnet);
if (toggleMagnetSelfPickup != null) {
ClientRegistry.registerKeyBinding(toggleMagnetSelfPickup);
}
}
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@SubscribeEvent @SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent event) { public void onKeyInput(InputEvent.KeyInputEvent event) {
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer; EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
if (KeyBindings.placeItem.isPressed()) { if (this.placeItem.isPressed()) {
handlePlaceItemKey(); handlePlaceItemKey();
} else if (KeyBindings.toolConfig.isPressed()) { } else if (this.toolConfig.isPressed()) {
handleToolConfigKey(); handleToolConfigKey();
} else if (KeyBindings.toolProfileChange.isPressed() && player != null && player.getItemInUse() == null) { } else if (this.toolProfileChange.isPressed() && player != null && player.getItemInUse() == null) {
handleToolProfileChangeKey(player); handleToolProfileChangeKey(player);
} else if (KeyBindings.toggleFlight.isPressed() && player != null) { } else if (this.toggleFlight.isPressed() && player != null) {
handleToggleFlightKey(player); handleToggleFlightKey(player);
} else if (KeyBindings.toggleMagnet.isPressed()) { } else if (this.toggleMagnet.isPressed()) {
handleToggleMagnetKey(player); handleToggleMagnetKey(player);
} else if (ModHelper.isHodgepodgeLoaded && KeyBindings.toggleMagnetSelfPickup.isPressed()) { } else if (this.toggleMagnetSelfPickup != null && this.toggleMagnetSelfPickup.isPressed()) {
handleToggleMagnetSelfPickup(player); handleToggleMagnetSelfPickup(player);
} }
} }
@@ -62,17 +98,17 @@ public class KeyInputHandler {
public void onMouseInput(InputEvent.MouseInputEvent event) { public void onMouseInput(InputEvent.MouseInputEvent event) {
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer; EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
if (KeyBindings.placeItem.isPressed()) { if (this.placeItem.isPressed()) {
handlePlaceItemKey(); handlePlaceItemKey();
} else if (KeyBindings.toolConfig.isPressed()) { } else if (this.toolConfig.isPressed()) {
handleToolConfigKey(); handleToolConfigKey();
} else if (KeyBindings.toolProfileChange.isPressed() && player != null) { } else if (this.toolProfileChange.isPressed() && player != null) {
handleToolProfileChangeKey(player); handleToolProfileChangeKey(player);
} else if (KeyBindings.toggleFlight.isPressed() && player != null) { } else if (this.toggleFlight.isPressed() && player != null) {
handleToggleFlightKey(player); handleToggleFlightKey(player);
} else if (KeyBindings.toggleMagnet.isPressed()) { } else if (this.toggleMagnet.isPressed()) {
handleToggleMagnetKey(player); handleToggleMagnetKey(player);
} else if (ModHelper.isHodgepodgeLoaded && KeyBindings.toggleMagnetSelfPickup.isPressed()) { } else if (this.toggleMagnetSelfPickup != null && this.toggleMagnetSelfPickup.isPressed()) {
handleToggleMagnetSelfPickup(player); handleToggleMagnetSelfPickup(player);
} }
@@ -160,4 +196,8 @@ public class KeyInputHandler {
if (c == 150 && i < 0) return 152; if (c == 150 && i < 0) return 152;
return c + i; return c + i;
} }
public int toolConfigKeycode() {
return this.toolConfig.getKeyCode();
}
} }
@@ -3,8 +3,12 @@ package com.brandon3055.draconicevolution.client.model;
import net.minecraft.client.model.ModelBiped; import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelRenderer; import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import com.brandon3055.draconicevolution.client.handler.ResourceHandler; import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
import com.brandon3055.draconicevolution.integration.ModHelper;
import xonin.backhand.api.core.BackhandUtils;
public class ModelDraconicArmor extends ModelBiped { public class ModelDraconicArmor extends ModelBiped {
@@ -173,7 +177,14 @@ public class ModelDraconicArmor extends ModelBiped {
bipedRightLeg.rotateAngleZ = 0F; bipedRightLeg.rotateAngleZ = 0F;
setRotationAngles(0, 0, 0, 0, 0, 0, null); setRotationAngles(0, 0, 0, 0, 0, 0, null);
} else super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); } else {
super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
if (entity instanceof EntityPlayer) {
if (ModHelper.isBackhandLoaded) {
BackhandHelper.applyFix(this, (EntityPlayer) entity);
}
}
}
this.bipedHead.render(1F / 13F); this.bipedHead.render(1F / 13F);
this.bipedRightArm.render(1F / 15F); this.bipedRightArm.render(1F / 15F);
@@ -205,4 +216,14 @@ public class ModelDraconicArmor extends ModelBiped {
this.bipedRightArm.rotateAngleZ = 0.0F; this.bipedRightArm.rotateAngleZ = 0.0F;
this.bipedLeftArm.rotateAngleZ = 0.0F; this.bipedLeftArm.rotateAngleZ = 0.0F;
} }
private static class BackhandHelper {
public static void applyFix(ModelDraconicArmor model, EntityPlayer player) {
if (BackhandUtils.getOffhandItem(player) != null) {
model.bipedLeftArm.rotateAngleX = model.bipedLeftArm.rotateAngleX * 0.5F - ((float) Math.PI / 10F);
model.bipedLeftArm.rotateAngleY = 0.0F;
}
}
}
} }
@@ -35,6 +35,7 @@ public class ModelRenderOBJ extends ModelRenderer {
this.compileDisplayList(scale); this.compileDisplayList(scale);
} }
ResourceHandler.bindTexture(texture);
GL11.glTranslatef(this.offsetX, this.offsetY, this.offsetZ); GL11.glTranslatef(this.offsetX, this.offsetY, this.offsetZ);
if (this.rotateAngleX == 0.0F && this.rotateAngleY == 0.0F && this.rotateAngleZ == 0.0F) { if (this.rotateAngleX == 0.0F && this.rotateAngleY == 0.0F && this.rotateAngleZ == 0.0F) {
@@ -84,7 +85,6 @@ public class ModelRenderOBJ extends ModelRenderer {
GL11.glNewList(this.displayList, GL11.GL_COMPILE); GL11.glNewList(this.displayList, GL11.GL_COMPILE);
GL11.glPushMatrix(); GL11.glPushMatrix();
ResourceHandler.bindTexture(texture);
// scale = 1F/15F; // scale = 1F/15F;
GL11.glScalef(scale, scale, scale); GL11.glScalef(scale, scale, scale);
GL11.glRotatef(180, -1, 0, 1); GL11.glRotatef(180, -1, 0, 1);
@@ -102,6 +102,7 @@ public class ModelRenderOBJ extends ModelRenderer {
this.compileDisplayList(scale); this.compileDisplayList(scale);
} }
ResourceHandler.bindTexture(texture);
GL11.glPushMatrix(); GL11.glPushMatrix();
GL11.glTranslatef(this.rotationPointX * scale, this.rotationPointY * scale, this.rotationPointZ * scale); GL11.glTranslatef(this.rotationPointX * scale, this.rotationPointY * scale, this.rotationPointZ * scale);
if (this.rotateAngleY != 0.0F) { if (this.rotateAngleY != 0.0F) {
@@ -6,7 +6,7 @@ import net.minecraft.entity.Entity;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import com.brandon3055.draconicevolution.client.handler.ClientEventHandler; import com.brandon3055.draconicevolution.DraconicEvolution;
/** /**
* DragonWings - brandon3055 Created using Tabula 5.0.0 * DragonWings - brandon3055 Created using Tabula 5.0.0
@@ -70,7 +70,8 @@ public class ModelContributorWings extends ModelBase {
float baseRot = 0.45906584F; float baseRot = 0.45906584F;
float outerRot = 0.61086524F; float outerRot = 0.61086524F;
float animation = (float) Math.sin(((float) ClientEventHandler.elapsedTicks + partialTick) / 20); final int ticks = DraconicEvolution.clientProxy().getElapsedTicks();
float animation = (float) Math.sin(((float) ticks + partialTick) / 20);
if (entity.isSneaking()) { if (entity.isSneaking()) {
this.leftBaseStem.rotateAngleX = 0.5F; this.leftBaseStem.rotateAngleX = 0.5F;
@@ -8,7 +8,7 @@ import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest; import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest;
import com.brandon3055.draconicevolution.common.utills.ICustomItemData; import com.brandon3055.draconicevolution.common.utils.ICustomItemData;
/** /**
* Created by Brandon on 16/11/2014. * Created by Brandon on 16/11/2014.
@@ -12,7 +12,7 @@ import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import com.brandon3055.draconicevolution.client.handler.ClientEventHandler; import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.entity.EntityDragonHeart; import com.brandon3055.draconicevolution.common.entity.EntityDragonHeart;
import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.References;
@@ -27,10 +27,11 @@ public class RenderDragonHeart extends Render {
private void doRender(EntityDragonHeart entity, double x, double y, double z, float f) { private void doRender(EntityDragonHeart entity, double x, double y, double z, float f) {
float sine = (float) Math.abs(Math.cos(ClientEventHandler.elapsedTicks / 1000D)); final int ticks = DraconicEvolution.clientProxy().getElapsedTicks();
float sine = (float) Math.abs(Math.cos(ticks / 1000D));
{ // Draw Item { // Draw Item
// GL11.glRotatef((((float) ClientEventHandler.elapsedTicks) + f) * entity.rotationSpeed, 0f, 1f, 0f); // GL11.glRotatef((((float) ticks) + f) * entity.rotationSpeed, 0f, 1f, 0f);
GL11.glRotatef(entity.rotation + f * entity.rotationInc, 0f, 1f, 0f); GL11.glRotatef(entity.rotation + f * entity.rotationInc, 0f, 1f, 0f);
EntityItem itemEntity = new EntityItem(entity.worldObj, 0, 0, 0, new ItemStack(ModItems.dragonHeart)); EntityItem itemEntity = new EntityItem(entity.worldObj, 0, 0, 0, new ItemStack(ModItems.dragonHeart));
itemEntity.hoverStart = 0.0F; itemEntity.hoverStart = 0.0F;
@@ -9,7 +9,7 @@ import org.lwjgl.opengl.GL11;
import com.brandon3055.draconicevolution.client.handler.ResourceHandler; import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler; import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.utills.LogHelper; import com.brandon3055.draconicevolution.common.utils.LogHelper;
/** /**
* Created by brandon3055 on 17/8/2015. * Created by brandon3055 on 17/8/2015.
@@ -10,11 +10,17 @@ import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper;
import com.brandon3055.draconicevolution.common.utills.LogHelper; import com.brandon3055.draconicevolution.common.utils.LogHelper;
public class RenderMobSoul implements IItemRenderer { public class RenderMobSoul implements IItemRenderer {
public static volatile boolean applyTimeRotation = true;
public static float getRotationAngle() {
return (float) (Minecraft.getSystemTime() / -10);
}
private final Minecraft mc; private final Minecraft mc;
private final String[] randomEntities = new String[] { "Pig", "Sheep", "Enderman", "Zombie", "Creeper", "Cow", private final String[] randomEntities = new String[] { "Pig", "Sheep", "Enderman", "Zombie", "Creeper", "Cow",
"Chicken", "Ozelot", "Witch", "Wolf", "MushroomCow", "Squid", "EntityHorse", "Spider", "Skeleton", "Blaze", "Chicken", "Ozelot", "Witch", "Wolf", "MushroomCow", "Squid", "EntityHorse", "Spider", "Skeleton", "Blaze",
@@ -58,7 +64,7 @@ public class RenderMobSoul implements IItemRenderer {
GL11.glScalef(13F, 13F, 13F); GL11.glScalef(13F, 13F, 13F);
GL11.glTranslated(1.2, 2.2, 0); GL11.glTranslated(1.2, 2.2, 0);
GL11.glRotatef(180F, 1F, 0F, 0F); GL11.glRotatef(180F, 1F, 0F, 0F);
GL11.glRotatef(mc.getSystemTime() / -10, 0F, 1F, 0F); if (applyTimeRotation) GL11.glRotatef(getRotationAngle(), 0F, 1F, 0F);
GL11.glRotatef(-20F, 1F, 0F, 0F); GL11.glRotatef(-20F, 1F, 0F, 0F);
RenderManager.instance.renderEntityWithPosYaw(mob, 0, 0, 0, 0F, 1F); RenderManager.instance.renderEntityWithPosYaw(mob, 0, 0, 0, 0F, 1F);
GL11.glPopMatrix(); GL11.glPopMatrix();
@@ -67,7 +73,7 @@ public class RenderMobSoul implements IItemRenderer {
GL11.glScalef(0.8F, 0.8F, 0.8F); GL11.glScalef(0.8F, 0.8F, 0.8F);
GL11.glTranslated(2, 0.5, 0); GL11.glTranslated(2, 0.5, 0);
GL11.glRotatef(20F, 0F, 0F, 1F); GL11.glRotatef(20F, 0F, 0F, 1F);
GL11.glRotatef(mc.getSystemTime() / -10, 0F, 1F, 0F); if (applyTimeRotation) GL11.glRotatef(getRotationAngle(), 0F, 1F, 0F);
GL11.glRotatef(-20F, 1F, 0F, 0F); GL11.glRotatef(-20F, 1F, 0F, 0F);
RenderManager.instance.renderEntityWithPosYaw(mob, 0, 0, 0, 0F, 1F); RenderManager.instance.renderEntityWithPosYaw(mob, 0, 0, 0, 0F, 1F);
GL11.glPopMatrix(); GL11.glPopMatrix();
@@ -76,14 +82,14 @@ public class RenderMobSoul implements IItemRenderer {
GL11.glScalef(0.8F, 0.8F, 0.8F); GL11.glScalef(0.8F, 0.8F, 0.8F);
GL11.glTranslated(1, 0.5, 0); GL11.glTranslated(1, 0.5, 0);
GL11.glRotatef(20F, 0F, 0F, 1F); GL11.glRotatef(20F, 0F, 0F, 1F);
GL11.glRotatef(mc.getSystemTime() / -10, 0F, 1F, 0F); if (applyTimeRotation) GL11.glRotatef(getRotationAngle(), 0F, 1F, 0F);
GL11.glRotatef(-20F, 1F, 0F, 0F); GL11.glRotatef(-20F, 1F, 0F, 0F);
RenderManager.instance.renderEntityWithPosYaw(mob, 0, 0, 0, 0F, 1F); RenderManager.instance.renderEntityWithPosYaw(mob, 0, 0, 0, 0F, 1F);
GL11.glPopMatrix(); GL11.glPopMatrix();
} else { } else {
GL11.glPushMatrix(); GL11.glPushMatrix();
GL11.glScalef(1.5F, 1.5F, 1.5F); GL11.glScalef(1.5F, 1.5F, 1.5F);
GL11.glRotatef(mc.getSystemTime() / -10, 0F, 1F, 0F); if (applyTimeRotation) GL11.glRotatef(getRotationAngle(), 0F, 1F, 0F);
GL11.glRotatef(-20F, 1F, 0F, 0F); GL11.glRotatef(-20F, 1F, 0F, 0F);
GL11.glEnable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
@@ -1,19 +1,21 @@
package com.brandon3055.draconicevolution.client.render.particle; package com.brandon3055.draconicevolution.client.render.particle;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.client.particle.EntityFX; import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World; import net.minecraft.world.World;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import com.brandon3055.brandonscore.common.utills.Utills;
import com.brandon3055.draconicevolution.client.handler.ClientEventHandler;
import com.brandon3055.draconicevolution.client.handler.ResourceHandler; import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.utils.Utils;
/** /**
* Created by Brandon on 8/02/2015. * Created by Brandon on 8/02/2015.
@@ -28,19 +30,19 @@ public class ParticleEnergyBeam extends EntityFX {
/** /**
* Beam Target X * Beam Target X
*/ */
private double tX = 0.0D; private double tX;
/** /**
* Beam Target Y * Beam Target Y
*/ */
private double tY = 0.0D; private double tY;
/** /**
* Beam Target Z * Beam Target Z
*/ */
private double tZ = 0.0D; private double tZ;
/** /**
* Modified Target X * Modified Target X
*/ */
private boolean advanced; private final boolean advanced;
private boolean renderParticle = true; private boolean renderParticle = true;
private float length = 0.0F; private float length = 0.0F;
@@ -52,10 +54,10 @@ public class ParticleEnergyBeam extends EntityFX {
// todo make sure not dyrectly up or down on y axis, Set dead when player goes out of range, PaRTICLE eNGINE // todo make sure not dyrectly up or down on y axis, Set dead when player goes out of range, PaRTICLE eNGINE
private static ResourceLocation beamTextureBasic = new ResourceLocation( private static final ResourceLocation beamTextureBasic = new ResourceLocation(
References.MODID.toLowerCase(), References.MODID.toLowerCase(),
"textures/models/EnergyBeamBlue.png"); "textures/models/EnergyBeamBlue.png");
private static ResourceLocation beamTextureAdvanced = new ResourceLocation( private static final ResourceLocation beamTextureAdvanced = new ResourceLocation(
References.MODID.toLowerCase(), References.MODID.toLowerCase(),
"textures/models/EnergyBeamRed.png"); "textures/models/EnergyBeamRed.png");
@@ -83,14 +85,13 @@ public class ParticleEnergyBeam extends EntityFX {
this.tZ = tZ; this.tZ = tZ;
if (offsetMode > 0) { if (offsetMode > 0) {
double dist = Utills.getDistanceAtoB(x, z, tX, tZ); double dist = Utils.getDistanceAtoB(x, z, tX, tZ);
if (dist == 0) dist = 0.1; if (dist == 0) dist = 0.1;
double xDist = x - tX; double xDist = x - tX;
double zDist = z - tZ; double zDist = z - tZ;
double xOff = xDist / dist; double xOff = xDist / dist;
double zOff = zDist / dist; double zOff = zDist / dist;
if (xOff == 0 && zOff == 0) xOff = 1; if (xOff == 0 && zOff == 0) xOff = 1;
// LogHelper.info(xOff + " " + zOff);
double offM = 0.4D; double offM = 0.4D;
if (offsetMode == 2 || offsetMode == 3) setPosition(posX - xOff * offM, posY, posZ - zOff * offM); if (offsetMode == 2 || offsetMode == 3) setPosition(posX - xOff * offM, posY, posZ - zOff * offM);
@@ -193,9 +194,9 @@ public class ParticleEnergyBeam extends EntityFX {
GL11.glRotatef(t * 90.0F, 0.0F, -1.0F, 0.0F); GL11.glRotatef(t * 90.0F, 0.0F, -1.0F, 0.0F);
} }
if (ClientEventHandler.playerHoldingWrench) { if (isPlayerHoldingWrench()) {
var44 = -0.15D * (double) 1; var44 = -0.15D;
var17 = 0.15D * (double) 1; var17 = 0.15D;
// GL11.glColor4f(1f, 1f, 1f, 1f); // GL11.glColor4f(1f, 1f, 1f, 1f);
// GL11.glTranslated(0.1, 0, 0); // GL11.glTranslated(0.1, 0, 0);
@@ -235,4 +236,13 @@ public class ParticleEnergyBeam extends EntityFX {
public void setFlow(int flow) { public void setFlow(int flow) {
this.flow = flow; this.flow = flow;
} }
private static boolean isPlayerHoldingWrench() {
final EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
if (player != null) {
final ItemStack heldItem = player.getHeldItem();
return heldItem != null && heldItem.getItem() == ModItems.wrench;
}
return false;
}
} }
@@ -11,10 +11,10 @@ import net.minecraftforge.client.model.IModelCustom;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import com.brandon3055.brandonscore.common.utills.Utills;
import com.brandon3055.draconicevolution.client.handler.ResourceHandler; import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
import com.brandon3055.draconicevolution.common.entity.EntityDragonProjectile; import com.brandon3055.draconicevolution.common.entity.EntityDragonProjectile;
import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.utils.Utils;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@@ -710,8 +710,8 @@ public class Particles {
// super.onUpdate(); // super.onUpdate();
if (particleAge >= particleMaxAge || this.getDistanceSq(targetX, targetY, targetZ) < 0.05) setDead(); if (particleAge >= particleMaxAge || this.getDistanceSq(targetX, targetY, targetZ) < 0.05) setDead();
double d1 = Utills.getDistanceAtoB(startX, startY, startZ, targetX, targetY, targetZ); double d1 = Utils.getDistanceAtoB(startX, startY, startZ, targetX, targetY, targetZ);
double d2 = Utills.getDistanceAtoB(posX, posY, posZ, targetX, targetY, targetZ); double d2 = Utils.getDistanceAtoB(posX, posY, posZ, targetX, targetY, targetZ);
particleScale = ((float) (d2 / d1)) * baseScale; particleScale = ((float) (d2 / d1)) * baseScale;
particleAge++; particleAge++;
@@ -1198,16 +1198,16 @@ public class Particles {
prevPosZ = posZ; prevPosZ = posZ;
if (mode == 0) { if (mode == 0) {
if (Utills.getDistanceAtoB(posX, posY, posZ, focalX, focalY, focalZ) < 0.2 && particleAge > 5) mode = 1; if (Utils.getDistanceAtoB(posX, posY, posZ, focalX, focalY, focalZ) < 0.2 && particleAge > 5) mode = 1;
double d = Utills.getDistanceAtoB(focalX, focalY, focalZ, shardX, shardY, shardZ); double d = Utils.getDistanceAtoB(focalX, focalY, focalZ, shardX, shardY, shardZ);
float motionMod = 0.1F; float motionMod = 0.1F;
motionX += (focalX - posX) / d * motionMod; motionX += (focalX - posX) / d * motionMod;
motionY += (focalY - posY) / d * motionMod; motionY += (focalY - posY) / d * motionMod;
motionZ += (focalZ - posZ) / d * motionMod; motionZ += (focalZ - posZ) / d * motionMod;
} }
if (mode == 1) { if (mode == 1) {
if (Utills.getDistanceAtoB(posX, posY, posZ, shardX, shardY, shardZ) < 1) setDead(); if (Utils.getDistanceAtoB(posX, posY, posZ, shardX, shardY, shardZ) < 1) setDead();
double d = Utills.getDistanceAtoB(focalX, focalY, focalZ, shardX, shardY, shardZ); double d = Utils.getDistanceAtoB(focalX, focalY, focalZ, shardX, shardY, shardZ);
particleScale = 1F - (float) d * 0.01F; particleScale = 1F - (float) d * 0.01F;
float motionMod = 1F; float motionMod = 1F;
motionX = (shardX - focalX) / d * motionMod; motionX = (shardX - focalX) / d * motionMod;
@@ -1216,8 +1216,8 @@ public class Particles {
} }
if (mode == 10) { if (mode == 10) {
if (Utills.getDistanceAtoB(posX, posY, posZ, shardX, shardY, shardZ) < 0.3) setDead(); if (Utils.getDistanceAtoB(posX, posY, posZ, shardX, shardY, shardZ) < 0.3) setDead();
double d = Utills.getDistanceAtoB(focalX, focalY, focalZ, shardX, shardY, shardZ); double d = Utils.getDistanceAtoB(focalX, focalY, focalZ, shardX, shardY, shardZ);
float motionMod = 0.4F; float motionMod = 0.4F;
motionX = (shardX - focalX) / d * motionMod; motionX = (shardX - focalX) / d * motionMod;
motionY = (shardY - focalY) / d * motionMod; motionY = (shardY - focalY) / d * motionMod;
@@ -10,7 +10,7 @@ import net.minecraftforge.client.model.IModelCustom;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import com.brandon3055.draconicevolution.client.handler.ClientEventHandler; import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.tileentities.energynet.TileEnergyRelay; import com.brandon3055.draconicevolution.common.tileentities.energynet.TileEnergyRelay;
import com.brandon3055.draconicevolution.common.tileentities.energynet.TileEnergyTransceiver; import com.brandon3055.draconicevolution.common.tileentities.energynet.TileEnergyTransceiver;
@@ -65,7 +65,8 @@ public class RenderTileCrystal extends TileEntitySpecialRenderer {
RenderHelper.disableStandardItemLighting(); RenderHelper.disableStandardItemLighting();
GL11.glEnable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_BLEND);
float innerLight = 100f; float innerLight = 100f;
float outerLight = 140f + ClientEventHandler.energyCrystalAlphaValue * 40F; final float crystalAlpha = DraconicEvolution.clientProxy().getEnergyCrystalAlpha();
float outerLight = 140f + crystalAlpha * 40F;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, innerLight, innerLight); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, innerLight, innerLight);
OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
@@ -79,7 +80,7 @@ public class RenderTileCrystal extends TileEntitySpecialRenderer {
if (tileEntity.getPowerTier() == 0) bindTexture(crystalBlueAlpha); if (tileEntity.getPowerTier() == 0) bindTexture(crystalBlueAlpha);
else bindTexture(crystalRedAlpha); else bindTexture(crystalRedAlpha);
GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glAlphaFunc(GL11.GL_GREATER, 0.5f + ClientEventHandler.energyCrystalAlphaValue * 0.5f); GL11.glAlphaFunc(GL11.GL_GREATER, 0.5f + crystalAlpha * 0.5f);
modelCrystal.renderAll(); modelCrystal.renderAll();
@@ -131,7 +132,8 @@ public class RenderTileCrystal extends TileEntitySpecialRenderer {
// RenderHelper.disableStandardItemLighting(); // RenderHelper.disableStandardItemLighting();
GL11.glEnable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_BLEND);
float innerLight = 100f; float innerLight = 100f;
float outerLight = 140f + ClientEventHandler.energyCrystalAlphaValue * 40F; final float crystalAlpha = DraconicEvolution.clientProxy().getEnergyCrystalAlpha();
float outerLight = 140f + crystalAlpha * 40F;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, innerLight, innerLight); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, innerLight, innerLight);
OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
@@ -145,7 +147,7 @@ public class RenderTileCrystal extends TileEntitySpecialRenderer {
if (tileEntity.getPowerTier() == 0) bindTexture(crystalBlueAlpha); if (tileEntity.getPowerTier() == 0) bindTexture(crystalBlueAlpha);
else bindTexture(crystalRedAlpha); else bindTexture(crystalRedAlpha);
GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glAlphaFunc(GL11.GL_GREATER, 0.5f + ClientEventHandler.energyCrystalAlphaValue * 0.5f); GL11.glAlphaFunc(GL11.GL_GREATER, 0.5f + crystalAlpha * 0.5f);
modelCrystalTransceiver.renderAll(); modelCrystalTransceiver.renderAll();
@@ -7,6 +7,7 @@ import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
import net.minecraft.init.Items;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
@@ -18,10 +19,7 @@ import com.brandon3055.draconicevolution.common.tileentities.TileDissEnchanter;
public class RenderTileDissEnchanter extends TileEntitySpecialRenderer { public class RenderTileDissEnchanter extends TileEntitySpecialRenderer {
// private final ResourceLocation texture = new ResourceLocation(References.MODID.toLowerCase(), private final EntityItem cachedEntity = new EntityItem(null, 0, 0, 0, new ItemStack(Items.apple));
// "textures/models/EnergyInfuserTextureSheet.png");
// private static float pxl = 1F / 256F;
@Override @Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) { public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) {
@@ -71,10 +69,7 @@ public class RenderTileDissEnchanter extends TileEntitySpecialRenderer {
if (tile.getStackInSlot(i) != null) { if (tile.getStackInSlot(i) != null) {
GL11.glPushMatrix(); GL11.glPushMatrix();
ItemStack stack = tile.getStackInSlot(i).copy(); ItemStack stack = tile.getStackInSlot(i);
stack.stackSize = 1;
EntityItem itemEntity = new EntityItem(tile.getWorldObj(), 0, 0, 0, stack);
itemEntity.hoverStart = 0.0F;
GL11.glTranslatef(0.5F, 0.5F, 0.5F); GL11.glTranslatef(0.5F, 0.5F, 0.5F);
GL11.glScalef(1F, 1F, 1F); GL11.glScalef(1F, 1F, 1F);
@@ -85,7 +80,18 @@ public class RenderTileDissEnchanter extends TileEntitySpecialRenderer {
} }
RenderItem.renderInFrame = true; RenderItem.renderInFrame = true;
RenderManager.instance.renderEntityWithPosYaw(itemEntity, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); final int stackSize = stack.stackSize;
try {
stack.stackSize = 1;
this.cachedEntity.setEntityItemStack(stack);
this.cachedEntity.setWorld(tile.getWorldObj());
this.cachedEntity.hoverStart = 0.0F;
RenderManager.instance.renderEntityWithPosYaw(this.cachedEntity, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
} finally {
stack.stackSize = stackSize;
this.cachedEntity.setEntityItemStack(null);
this.cachedEntity.setWorld(null);
}
RenderItem.renderInFrame = false; RenderItem.renderInFrame = false;
GL11.glPopMatrix(); GL11.glPopMatrix();
@@ -32,9 +32,8 @@ public class RenderTileEarth extends TileEntitySpecialRenderer {
@Override @Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float timeSinceLastTick) { public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float timeSinceLastTick) {
if (!(tile instanceof TileEarth)) return; if (!(tile instanceof TileEarth tileEarth)) return;
TileEarth tileEarth = (TileEarth) tile;
float scale = 0.01f * tileEarth.getSize(); float scale = 0.01f * tileEarth.getSize();
GL11.glPushMatrix(); GL11.glPushMatrix();
@@ -5,6 +5,7 @@ import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
import net.minecraft.init.Items;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
@@ -17,11 +18,11 @@ import com.brandon3055.draconicevolution.common.tileentities.TileEnergyInfuser;
public class RenderTileEnergyInfiser extends TileEntitySpecialRenderer { public class RenderTileEnergyInfiser extends TileEntitySpecialRenderer {
private static final float pxl = 1F / 256F;
private final ResourceLocation texture = new ResourceLocation( private final ResourceLocation texture = new ResourceLocation(
References.MODID.toLowerCase(), References.MODID.toLowerCase(),
"textures/models/EnergyInfuserTextureSheet.png"); "textures/models/EnergyInfuserTextureSheet.png");
private final EntityItem cachedEntity = new EntityItem(null, 0, 0, 0, new ItemStack(Items.apple));
private static float pxl = 1F / 256F;
@Override @Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) { public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) {
@@ -238,8 +239,6 @@ public class RenderTileEnergyInfiser extends TileEntitySpecialRenderer {
GL11.glPushMatrix(); GL11.glPushMatrix();
ItemStack stack = tile.getStackInSlot(0); ItemStack stack = tile.getStackInSlot(0);
EntityItem itemEntity = new EntityItem(tile.getWorldObj(), 0, 0, 0, tile.getStackInSlot(0));
itemEntity.hoverStart = 0.0F;
GL11.glTranslatef(0.5F, 0.5F, 0.5F); GL11.glTranslatef(0.5F, 0.5F, 0.5F);
GL11.glScalef(1F, 1F, 1F); GL11.glScalef(1F, 1F, 1F);
@@ -252,7 +251,15 @@ public class RenderTileEnergyInfiser extends TileEntitySpecialRenderer {
} }
RenderItem.renderInFrame = true; RenderItem.renderInFrame = true;
RenderManager.instance.renderEntityWithPosYaw(itemEntity, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); try {
this.cachedEntity.setEntityItemStack(stack);
this.cachedEntity.setWorld(tile.getWorldObj());
this.cachedEntity.hoverStart = 0.0F;
RenderManager.instance.renderEntityWithPosYaw(this.cachedEntity, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
} finally {
this.cachedEntity.setEntityItemStack(null);
this.cachedEntity.setWorld(null);
}
RenderItem.renderInFrame = false; RenderItem.renderInFrame = false;
GL11.glPopMatrix(); GL11.glPopMatrix();
@@ -1,16 +1,16 @@
package com.brandon3055.draconicevolution.client.render.tile; package com.brandon3055.draconicevolution.client.render.tile;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemBow; import net.minecraft.item.ItemBow;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
@@ -22,37 +22,38 @@ import com.brandon3055.draconicevolution.common.tileentities.TilePlacedItem;
*/ */
public class RenderTilePlacedItem extends TileEntitySpecialRenderer { public class RenderTilePlacedItem extends TileEntitySpecialRenderer {
public RenderTilePlacedItem() {} private static final float MOBSOUL_CENTER_X = 0.5F;
private static final float MOBSOUL_CENTER_Y = 0.3F;
private static final float MOBSOUL_CENTER_Z = 0.5F;
private final EntityItem cachedEntity = new EntityItem(null, 0, 0, 0, new ItemStack(Items.apple));
@Override @Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float timeSinceLastTick) { public void renderTileEntityAt(TileEntity te, double x, double y, double z, float timeSinceLastTick) {
if (te == null || !(te instanceof TilePlacedItem)) return; if (!(te instanceof TilePlacedItem tile)) return;
TilePlacedItem tile = (TilePlacedItem) te; ItemStack stack = tile.getStack();
if (tile.getStack() == null) return; // I think without this check it could have thrown a NPE if an item being displayed was removed
if (stack == null || stack.getItem() == null) return;
if (tile.getWorldObj() == null) return;
GL11.glPushMatrix(); GL11.glPushMatrix();
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
GL11.glTranslated(x, y, z); GL11.glTranslated(x, y, z);
renderItem(tile); renderItem(tile);
GL11.glPopAttrib();
GL11.glPopMatrix(); GL11.glPopMatrix();
} }
public void renderItem(TilePlacedItem tile) { public void renderItem(TilePlacedItem tile) {
ItemStack stack = tile.getStack(); ItemStack stack = tile.getStack();
World world = Minecraft.getMinecraft().theWorld; int meta = tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord);
EntityItem itemEntity = new EntityItem(tile.getWorldObj(), 0, 0, 0, stack); final Item item = stack.getItem();
int meta = world.getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord); boolean is3D = item.isFull3D();
// itemEntity.getEntityItem().stackSize = 1; boolean isBlock = item instanceof ItemBlock;
itemEntity.hoverStart = 0.0F;
boolean is3D = stack.getItem().isFull3D();
boolean isBlock = stack.getItem() instanceof ItemBlock;
if (isBlock) { if (isBlock) {
GL11.glTranslatef(0.5F, 0.25F, 0.5F); GL11.glTranslatef(0.5F, 0.25F, 0.5F);
GL11.glScalef(1.5F, 1.5F, 1.5F); GL11.glScalef(1.5F, 1.5F, 1.5F);
metaAdjustBlock(meta); metaAdjustBlock(meta);
GL11.glRotatef(tile.rotation, 0F, 1F, 0F); GL11.glRotatef(tile.rotation, 0F, 1F, 0F);
} else if (is3D || stack.getItem() instanceof ItemArmor || stack.getItem() instanceof ItemBow) { } else if (is3D || item instanceof ItemArmor || item instanceof ItemBow) {
GL11.glScalef(2F, 2F, 2F); GL11.glScalef(2F, 2F, 2F);
GL11.glRotatef(90F, -1F, 0F, 0F); GL11.glRotatef(90F, -1F, 0F, 0F);
GL11.glTranslatef(0.25F, -0.45F, 0.02F); GL11.glTranslatef(0.25F, -0.45F, 0.02F);
@@ -60,9 +61,8 @@ public class RenderTilePlacedItem extends TileEntitySpecialRenderer {
GL11.glTranslatef(0.0F, 0.21F, 0.0F); GL11.glTranslatef(0.0F, 0.21F, 0.0F);
GL11.glRotatef(tile.rotation, 0F, 0F, 1F); GL11.glRotatef(tile.rotation, 0F, 0F, 1F);
GL11.glTranslatef(0.0F, -0.21F, 0.0F); GL11.glTranslatef(0.0F, -0.21F, 0.0F);
} else if (stack.getItem() instanceof MobSoul) { } else if (item instanceof MobSoul) {
GL11.glTranslatef(MOBSOUL_CENTER_X, MOBSOUL_CENTER_Y, MOBSOUL_CENTER_Z);
GL11.glTranslatef(0.5F, 0.3F, 0.5F);
} else { } else {
GL11.glRotatef(90F, -1F, 0F, 0F); GL11.glRotatef(90F, -1F, 0F, 0F);
GL11.glTranslatef(0.5F, -0.65F, 0.02F); GL11.glTranslatef(0.5F, -0.65F, 0.02F);
@@ -72,11 +72,17 @@ public class RenderTilePlacedItem extends TileEntitySpecialRenderer {
GL11.glTranslatef(0.0F, -0.18F, 0.0F); GL11.glTranslatef(0.0F, -0.18F, 0.0F);
} }
GL11.glPushAttrib(GL11.GL_COLOR_BUFFER_BIT);
RenderItem.renderInFrame = true; RenderItem.renderInFrame = true;
RenderManager.instance.renderEntityWithPosYaw(itemEntity, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); try {
RenderItem.renderInFrame = false; this.cachedEntity.setEntityItemStack(stack);
GL11.glPopAttrib(); this.cachedEntity.setWorld(tile.getWorldObj());
this.cachedEntity.hoverStart = 0.0F;
RenderManager.instance.renderEntityWithPosYaw(this.cachedEntity, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
} finally {
this.cachedEntity.setEntityItemStack(null);
this.cachedEntity.setWorld(null);
RenderItem.renderInFrame = false;
}
} }
private void metaAdjustItemTool(int meta) { private void metaAdjustItemTool(int meta) {
@@ -1,7 +1,5 @@
package com.brandon3055.draconicevolution.client.render.tile; package com.brandon3055.draconicevolution.client.render.tile;
import java.awt.Point;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.FontRenderer;
@@ -10,6 +8,7 @@ import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagList;
@@ -20,24 +19,24 @@ import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12; import org.lwjgl.opengl.GL12;
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
import com.brandon3055.brandonscore.common.utills.Utills;
import com.brandon3055.draconicevolution.client.model.ModelTeleporterStand; import com.brandon3055.draconicevolution.client.model.ModelTeleporterStand;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler; import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.items.tools.TeleporterMKII; import com.brandon3055.draconicevolution.common.items.tools.TeleporterMKII;
import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.tileentities.TileTeleporterStand; import com.brandon3055.draconicevolution.common.tileentities.TileTeleporterStand;
import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper;
import com.brandon3055.draconicevolution.common.utils.Utils;
/** /**
* Created by Brandon on 25/10/2014. * Created by Brandon on 25/10/2014.
*/ */
public class RenderTileTeleporterStand extends TileEntitySpecialRenderer { public class RenderTileTeleporterStand extends TileEntitySpecialRenderer {
ModelTeleporterStand model = new ModelTeleporterStand(); private final ModelTeleporterStand model = new ModelTeleporterStand();
private final ResourceLocation texture = new ResourceLocation( private final ResourceLocation texture = new ResourceLocation(
References.MODID.toLowerCase(), References.MODID.toLowerCase(),
"textures/models/TeleporterStand.png"); "textures/models/TeleporterStand.png");
private final EntityItem cachedEntity = new EntityItem(null, 0, 0, 0, new ItemStack(Items.apple));
@Override @Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) { public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
@@ -69,27 +68,29 @@ public class RenderTileTeleporterStand extends TileEntitySpecialRenderer {
GL11.glPopMatrix(); GL11.glPopMatrix();
} }
public void renderItem(TileEntity tile, ItemStack item, float f) { public void renderItem(TileEntity tile, ItemStack stack, float f) {
if (item.getItem() == null) return; if (stack.getItem() == null) return;
GL11.glPushMatrix(); GL11.glPushMatrix();
EntityItem itemEntity = new EntityItem(tile.getWorldObj(), 0, 0, 0, item); if (stack.getItem() instanceof TeleporterMKII) {
itemEntity.hoverStart = 0.0F;
if (item.getItem() instanceof TeleporterMKII) {
GL11.glTranslatef(0F, 0.18F, 0.864F); GL11.glTranslatef(0F, 0.18F, 0.864F);
GL11.glRotated(180, 0, 0, 1);
GL11.glRotated(30, 1, 0, 0);
GL11.glScalef(1F, 1F, 1F);
} else { } else {
GL11.glTranslatef(0F, 0.22F, 0.84F); GL11.glTranslatef(0F, 0.22F, 0.84F);
GL11.glRotated(180, 0, 0, 1);
GL11.glRotated(30, 1, 0, 0);
GL11.glScalef(1F, 1F, 1F);
} }
GL11.glRotated(180, 0, 0, 1);
GL11.glRotated(30, 1, 0, 0);
GL11.glScalef(1F, 1F, 1F);
RenderItem.renderInFrame = true; RenderItem.renderInFrame = true;
RenderManager.instance.renderEntityWithPosYaw(itemEntity, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); try {
this.cachedEntity.setEntityItemStack(stack);
this.cachedEntity.setWorld(tile.getWorldObj());
this.cachedEntity.hoverStart = 0.0F;
RenderManager.instance.renderEntityWithPosYaw(this.cachedEntity, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
} finally {
this.cachedEntity.setEntityItemStack(null);
this.cachedEntity.setWorld(null);
}
RenderItem.renderInFrame = false; RenderItem.renderInFrame = false;
GL11.glPopMatrix(); GL11.glPopMatrix();
@@ -126,9 +127,6 @@ public class RenderTileTeleporterStand extends TileEntitySpecialRenderer {
GL11.glRotated(180, 0, 1, 0); GL11.glRotated(180, 0, 1, 0);
GL11.glTranslated(0, -40, 0); GL11.glTranslated(0, -40, 0);
Point.Double p1 = new Point.Double(tileentity.xCoord + 0.5, tileentity.zCoord + 0.5);
Point.Double p2 = new Point.Double(player.posX, player.posZ);
double xDiff = player.posX - (tileentity.xCoord + 0.5); double xDiff = player.posX - (tileentity.xCoord + 0.5);
double yDiff = player.posY - (tileentity.yCoord + 0.5); double yDiff = player.posY - (tileentity.yCoord + 0.5);
double zDiff = player.posZ - (tileentity.zCoord + 0.5); double zDiff = player.posZ - (tileentity.zCoord + 0.5);
@@ -136,7 +134,7 @@ public class RenderTileTeleporterStand extends TileEntitySpecialRenderer {
double pitchAngle = Math.toDegrees( double pitchAngle = Math.toDegrees(
Math.atan2( Math.atan2(
yDiff, yDiff,
Utills.getDistanceAtoB( Utils.getDistanceAtoB(
player.posX, player.posX,
player.posY, player.posY,
player.posZ, player.posZ,
@@ -1,72 +0,0 @@
package com.brandon3055.draconicevolution.client.render.tile;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
import org.lwjgl.opengl.GL11;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.tileentities.TileTestBlock;
import cpw.mods.fml.client.FMLClientHandler;
/**
* Created by Brandon on 24/07/2014.
*/
public class RenderTileTestBlock extends TileEntitySpecialRenderer {
private static final ResourceLocation iner_model_texture = new ResourceLocation(
References.MODID.toLowerCase(),
"textures/models/power_sphere_layer_1.png");
private static final ResourceLocation outer_model_texture = new ResourceLocation(
References.MODID.toLowerCase(),
"textures/models/power_sphere_layer_2.png");
private IModelCustom iner_model;
private IModelCustom outer_model;
public RenderTileTestBlock() {
iner_model = AdvancedModelLoader
.loadModel(new ResourceLocation(References.MODID.toLowerCase(), "models/power_sphere_layer_1.obj"));
// outer_model = AdvancedModelLoader.loadModel(new ResourceLocation(References.MODID.toLowerCase(),
// "models/power_sphere_layer_2.obj"));
}
@Override
public void renderTileEntityAt(TileEntity var1, double x, double y, double z, float var8) {
GL11.glPushMatrix();
GL11.glColor4f(1F, 1F, 1F, 1F);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) 100, (float) 100);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_CULL_FACE);
// GL11.glDepthMask(false);
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
FMLClientHandler.instance().getClient().getTextureManager().bindTexture(iner_model_texture);
GL11.glPushMatrix();
GL11.glRotatef(((TileTestBlock) var1).modelRotation, 0F, 1F, 0.5F);
// GL11.glColor4f(2F, 2F, 2F, 1F);
iner_model.renderAll();
GL11.glPopMatrix();
GL11.glScalef(1.1F, 1.1F, 1.1F);
GL11.glDepthMask(false);
FMLClientHandler.instance().getClient().getTextureManager().bindTexture(outer_model_texture);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 200F, 200F);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glEnable(GL11.GL_BLEND);
GL11.glRotatef(((TileTestBlock) var1).modelRotation * 0.5F, 0F, -1F, -0.5F);
GL11.glColor4f(0.5F, 2F, 2F, 0.7F);
outer_model.renderAll();
GL11.glDisable(GL11.GL_BLEND);
GL11.glDepthMask(true);
GL11.glPopMatrix();
}
}
@@ -5,6 +5,7 @@ import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
import net.minecraft.init.Items;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
@@ -16,7 +17,8 @@ import com.brandon3055.draconicevolution.common.tileentities.TileUpgradeModifier
public class RenderTileUpgradeModifier extends TileEntitySpecialRenderer { public class RenderTileUpgradeModifier extends TileEntitySpecialRenderer {
private static float pxl = 1F / 256F; private static final float pxl = 1F / 256F;
private final EntityItem cachedEntity = new EntityItem(null, 0, 0, 0, new ItemStack(Items.apple));
@Override @Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) { public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) {
@@ -207,8 +209,6 @@ public class RenderTileUpgradeModifier extends TileEntitySpecialRenderer {
GL11.glPushMatrix(); GL11.glPushMatrix();
ItemStack stack = tile.getStackInSlot(0); ItemStack stack = tile.getStackInSlot(0);
EntityItem itemEntity = new EntityItem(tile.getWorldObj(), 0, 0, 0, tile.getStackInSlot(0));
itemEntity.hoverStart = 0.0F;
GL11.glTranslatef(0.5F, 0.5F, 0.5F); GL11.glTranslatef(0.5F, 0.5F, 0.5F);
GL11.glScalef(1F, 1F, 1F); GL11.glScalef(1F, 1F, 1F);
@@ -220,7 +220,15 @@ public class RenderTileUpgradeModifier extends TileEntitySpecialRenderer {
} }
RenderItem.renderInFrame = true; RenderItem.renderInFrame = true;
RenderManager.instance.renderEntityWithPosYaw(itemEntity, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); try {
this.cachedEntity.setEntityItemStack(stack);
this.cachedEntity.setWorld(tile.getWorldObj());
this.cachedEntity.hoverStart = 0.0F;
RenderManager.instance.renderEntityWithPosYaw(this.cachedEntity, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
} finally {
this.cachedEntity.setEntityItemStack(null);
this.cachedEntity.setWorld(null);
}
RenderItem.renderInFrame = false; RenderItem.renderInFrame = false;
GL11.glPopMatrix(); GL11.glPopMatrix();
@@ -0,0 +1,24 @@
package com.brandon3055.draconicevolution.client.utils;
import java.net.URI;
import com.brandon3055.draconicevolution.common.utils.LogHelper;
/**
* Created by brandon3055 on 11/11/2015.
*/
@SuppressWarnings("unused")
public class ClientUtils {
public static void openLink(String url) {
try {
URI uri = new URI(url);
Class oclass = Class.forName("java.awt.Desktop");
Object object = oclass.getMethod("getDesktop", new Class[0]).invoke(null, new Object[0]);
oclass.getMethod("browse", new Class[] { URI.class }).invoke(object, new Object[] { uri });
} catch (Throwable throwable) {
LogHelper.error("Couldn\'t open link");
throwable.printStackTrace();
}
}
}
@@ -1,4 +1,4 @@
package com.brandon3055.draconicevolution.client.utill; package com.brandon3055.draconicevolution.client.utils;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
@@ -0,0 +1,140 @@
package com.brandon3055.draconicevolution.client.utils;
import java.util.Iterator;
import java.util.List;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
/**
* Created by Brandon on 28/06/2014.
*/
@SuppressWarnings("unused")
public class GuiHelper {
public static final double PXL128 = 0.0078125;
public static final double PXL256 = 0.00390625;
public static boolean isInRect(int x, int y, int xSize, int ySize, int mouseX, int mouseY) {
return ((mouseX >= x && mouseX <= x + xSize) && (mouseY >= y && mouseY <= y + ySize));
}
public static void drawTexturedRect(int x, int y, int u, int v, int width, int height) {
drawTexturedRect(x, y, width, height, u, v, width, height, 0, PXL256);
}
public static void drawTexturedRect(double x, double y, double width, double height, int u, int v, int uSize,
int vSize, double zLevel, double pxl) {
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(x, y + height, zLevel, u * pxl, (v + vSize) * pxl);
tessellator.addVertexWithUV(x + width, y + height, zLevel, (u + uSize) * pxl, (v + vSize) * pxl);
tessellator.addVertexWithUV(x + width, y, zLevel, (u + uSize) * pxl, v * pxl);
tessellator.addVertexWithUV(x, y, zLevel, u * pxl, v * pxl);
tessellator.draw();
}
public static void drawHoveringText(List list, int x, int y, FontRenderer font, float fade, double scale,
int guiWidth, int guiHeight) {
if (!list.isEmpty()) {
GL11.glPushMatrix();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glScaled(scale, scale, 1);
x = (int) (x / scale);
y = (int) (y / scale);
int k = 0;
Iterator iterator = list.iterator();
while (iterator.hasNext()) {
String s = (String) iterator.next();
int l = font.getStringWidth(s);
if (l > k) {
k = l;
}
}
int adjX = x + 12;
int adjY = y - 12;
int i1 = 8;
if (list.size() > 1) {
i1 += 2 + (list.size() - 1) * 10;
}
if (adjX + k > (int) (guiWidth / scale)) {
adjX -= 28 + k;
}
if (adjY + i1 + 6 > (int) (guiHeight / scale)) {
adjY = (int) (guiHeight / scale) - i1 - 6;
}
int j1 = -267386864;
drawGradientRect(adjX - 3, adjY - 4, adjX + k + 3, adjY - 3, j1, j1, fade, scale);
drawGradientRect(adjX - 3, adjY + i1 + 3, adjX + k + 3, adjY + i1 + 4, j1, j1, fade, scale);
drawGradientRect(adjX - 3, adjY - 3, adjX + k + 3, adjY + i1 + 3, j1, j1, fade, scale);
drawGradientRect(adjX - 4, adjY - 3, adjX - 3, adjY + i1 + 3, j1, j1, fade, scale);
drawGradientRect(adjX + k + 3, adjY - 3, adjX + k + 4, adjY + i1 + 3, j1, j1, fade, scale);
int k1 = 1347420415;
int l1 = (k1 & 16711422) >> 1 | k1 & -16777216;
drawGradientRect(adjX - 3, adjY - 3 + 1, adjX - 3 + 1, adjY + i1 + 3 - 1, k1, l1, fade, scale);
drawGradientRect(adjX + k + 2, adjY - 3 + 1, adjX + k + 3, adjY + i1 + 3 - 1, k1, l1, fade, scale);
drawGradientRect(adjX - 3, adjY - 3, adjX + k + 3, adjY - 3 + 1, k1, k1, fade, scale);
drawGradientRect(adjX - 3, adjY + i1 + 2, adjX + k + 3, adjY + i1 + 3, l1, l1, fade, scale);
for (int i2 = 0; i2 < list.size(); ++i2) {
String s1 = (String) list.get(i2);
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_ALPHA_TEST);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
font.drawStringWithShadow(s1, adjX, adjY, ((int) (fade * 240F) + 0x10 << 24) | 0x00FFFFFF);
adjY += 10;
}
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}
}
public static void drawGradientRect(int x1, int y1, int x2, int y2, int colour1, int colour2, float fade,
double scale) {
float f = ((colour1 >> 24 & 255) / 255.0F) * fade;
float f1 = (float) (colour1 >> 16 & 255) / 255.0F;
float f2 = (float) (colour1 >> 8 & 255) / 255.0F;
float f3 = (float) (colour1 & 255) / 255.0F;
float f4 = ((colour2 >> 24 & 255) / 255.0F) * fade;
float f5 = (float) (colour2 >> 16 & 255) / 255.0F;
float f6 = (float) (colour2 >> 8 & 255) / 255.0F;
float f7 = (float) (colour2 & 255) / 255.0F;
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_ALPHA_TEST);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glShadeModel(GL11.GL_SMOOTH);
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.setColorRGBA_F(f1, f2, f3, f);
tessellator.addVertex((double) x2, (double) y1, 300D);
tessellator.addVertex((double) x1, (double) y1, 300D);
tessellator.setColorRGBA_F(f5, f6, f7, f4);
tessellator.addVertex((double) x1, (double) y2, 300D);
tessellator.addVertex((double) x2, (double) y2, 300D);
tessellator.draw();
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL11.GL_TEXTURE_2D);
}
}
@@ -0,0 +1,224 @@
package com.brandon3055.draconicevolution.client.utils.guicomponents;
/**
* Created by Brandon on 25/12/2014. This gui system is based on open blocks gui system
*/
import java.util.Iterator;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
public abstract class ComponentBase extends Gui {
protected static RenderItem itemRender = new RenderItem();
protected int x;
protected int y;
protected boolean enabled = true;
public static Minecraft mc;
public FontRenderer fontRendererObj;
private String group = "";
/** The width of the screen object. */
public int width;
/** The height of the screen object. */
public int height;
public String name;
public ComponentBase(int x, int y) {
this.x = x;
this.y = y;
mc = Minecraft.getMinecraft();
fontRendererObj = mc.fontRenderer;
}
public String getGroup() {
return group;
}
public ComponentBase setGroup(String group) {
this.group = group;
return this;
}
public ComponentBase setName(String name) {
this.name = name;
return this;
}
public void setX(int x) {
this.x = x;
}
public void setY(int y) {
this.y = y;
}
public int getX() {
return x;
}
public int getY() {
return y;
}
public abstract int getWidth();
public abstract int getHeight();
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public boolean isEnabled() {
return enabled;
}
public boolean isMouseOver(int mouseX, int mouseY) {
return mouseX >= x && mouseX < x + getWidth() && mouseY >= y && mouseY < y + getHeight();
}
public abstract void renderBackground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY);
public abstract void renderForground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY);
public void renderFinal(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {}
protected void drawHoveringText(List list, int x, int y, FontRenderer font) {
if (!list.isEmpty()) {
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
// RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
int k = 0;
Iterator iterator = list.iterator();
while (iterator.hasNext()) {
String s = (String) iterator.next();
int l = font.getStringWidth(s);
if (l > k) {
k = l;
}
}
int adjX = x + 12;
int adjY = y - 12;
int i1 = 8;
if (list.size() > 1) {
i1 += 2 + (list.size() - 1) * 10;
}
if (adjX + k > width) {
adjX -= 28 + k;
}
if (adjY + i1 + 6 > height) {
adjY = height - i1 - 6;
}
this.zLevel = 300.0F;
itemRender.zLevel = 300.0F;
int j1 = -267386864;
this.drawGradientRect(adjX - 3, adjY - 4, adjX + k + 3, adjY - 3, j1, j1);
this.drawGradientRect(adjX - 3, adjY + i1 + 3, adjX + k + 3, adjY + i1 + 4, j1, j1);
this.drawGradientRect(adjX - 3, adjY - 3, adjX + k + 3, adjY + i1 + 3, j1, j1);
this.drawGradientRect(adjX - 4, adjY - 3, adjX - 3, adjY + i1 + 3, j1, j1);
this.drawGradientRect(adjX + k + 3, adjY - 3, adjX + k + 4, adjY + i1 + 3, j1, j1);
int k1 = 1347420415;
int l1 = (k1 & 16711422) >> 1 | k1 & -16777216;
this.drawGradientRect(adjX - 3, adjY - 3 + 1, adjX - 3 + 1, adjY + i1 + 3 - 1, k1, l1);
this.drawGradientRect(adjX + k + 2, adjY - 3 + 1, adjX + k + 3, adjY + i1 + 3 - 1, k1, l1);
this.drawGradientRect(adjX - 3, adjY - 3, adjX + k + 3, adjY - 3 + 1, k1, k1);
this.drawGradientRect(adjX - 3, adjY + i1 + 2, adjX + k + 3, adjY + i1 + 3, l1, l1);
for (int i2 = 0; i2 < list.size(); ++i2) {
String s1 = (String) list.get(i2);
font.drawStringWithShadow(s1, adjX, adjY, -1);
if (i2 == 0) {
adjY += 2;
}
adjY += 10;
}
this.zLevel = 0.0F;
itemRender.zLevel = 0.0F;
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
// RenderHelper.enableStandardItemLighting();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
}
}
public void drawItemStack(ItemStack stack, int x, int y, String count) {
if (stack == null) return;
GL11.glPushMatrix();
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glTranslatef(0.0F, 0.0F, 32.0F);
this.zLevel = 200.0F;
itemRender.zLevel = 200.0F;
FontRenderer font;
font = stack.getItem().getFontRenderer(stack);
if (font == null) font = fontRendererObj;
itemRender.renderItemAndEffectIntoGUI(font, mc.getTextureManager(), stack, x, y);
// itemRender.renderEffect(mc.getTextureManager(), x, y);
if (!count.equals("null"))
itemRender.renderItemOverlayIntoGUI(font, mc.getTextureManager(), stack, x, y, count);
this.zLevel = 0.0F;
itemRender.zLevel = 0.0F;
// GL11.glEnable(GL11.GL_LIGHTING);
// GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glPopAttrib();
GL11.glPopMatrix();
}
protected void renderToolTip(ItemStack stack, int x, int y) {
List list = stack.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips);
for (int k = 0; k < list.size(); ++k) {
if (k == 0) {
list.set(k, stack.getRarity().rarityColor + (String) list.get(k));
} else {
list.set(k, EnumChatFormatting.GRAY + (String) list.get(k));
}
}
FontRenderer font = stack.getItem().getFontRenderer(stack);
drawHoveringText(list, x, y, (font == null ? fontRendererObj : font));
}
public void mouseClicked(int x, int y, int button) {}
public void setWorldAndResolution(Minecraft mc, int width, int height) {
this.mc = mc;
this.fontRendererObj = mc.fontRenderer;
this.width = width;
this.height = height;
}
/** Translate To Local */
public String ttl(String unlocalizedName) {
return StatCollector.translateToLocal(unlocalizedName);
}
public void updateScreen() {}
protected void keyTyped(char par1, int par2) {}
}
@@ -0,0 +1,122 @@
package com.brandon3055.draconicevolution.client.utils.guicomponents;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StringUtils;
import org.lwjgl.opengl.GL11;
/**
* Created by Brandon on 1/01/2015.
*/
public class ComponentButton extends ComponentBase {
protected static final ResourceLocation buttonTextures = new ResourceLocation("textures/gui/widgets.png");
public int buttonId;
public GUIBase gui;
public int xSize;
public int ySize;
public int packedFGColour;
public String displayString;
public String hoverText;
public ComponentButton(int x, int y, int xSize, int ySize, int id, GUIBase gui, String displayString) {
super(x, y);
this.xSize = xSize;
this.ySize = ySize;
this.buttonId = id;
this.gui = gui;
this.displayString = displayString;
}
public ComponentButton(int x, int y, int xSize, int ySize, int id, GUIBase gui, String displayString,
String hoverText) {
this(x, y, xSize, ySize, id, gui, displayString);
this.hoverText = hoverText;
}
@Override
public int getWidth() {
return xSize;
}
@Override
public int getHeight() {
return ySize;
}
@Override
public void renderBackground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {}
@Override
public void renderForground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
GL11.glPushMatrix();
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
// FontRenderer fontrenderer = minecraft.fontRenderer;
minecraft.getTextureManager().bindTexture(buttonTextures);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
int k = isMouseOver(mouseX, mouseY) ? 2 : 1;
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
this.drawTexturedModalRect(this.x, this.y, 0, 46 + k * 20, this.xSize / 2, this.ySize);
this.drawTexturedModalRect(
this.x + this.xSize / 2,
this.y,
200 - this.xSize / 2,
46 + k * 20,
this.xSize / 2,
this.ySize);
if (this.ySize < 20) {
this.drawTexturedModalRect(x, y + 3, 0, (46 + k * 20) + 20 - ySize + 3, xSize / 2, ySize - 3);
this.drawTexturedModalRect(
x + xSize / 2,
y + 3,
200 - xSize / 2,
(46 + k * 20) + 20 - ySize + 3,
xSize / 2,
ySize - 3);
}
// this.mouseDragged(minecraft, mouseX, mouseY);
int l = 14737632;
if (packedFGColour != 0) {
l = packedFGColour;
} else if (!this.enabled) {
l = 10526880;
} else if (isMouseOver(mouseX, mouseY)) {
l = 16777120;
}
this.drawCenteredString(
fontRendererObj,
this.displayString,
this.x + this.xSize / 2,
this.y + (this.ySize - 8) / 2,
l);
GL11.glPopAttrib();
GL11.glPopMatrix();
}
@Override
public void renderFinal(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
if (isMouseOver(mouseX, mouseY) && !StringUtils.isNullOrEmpty(hoverText)) {
List<String> list = new ArrayList<String>();
list.add(hoverText);
drawHoveringText(list, mouseX + offsetX, mouseY + offsetY + 10, fontRendererObj);
}
}
@Override
public void mouseClicked(int x, int y, int button) {
Minecraft.getMinecraft().getSoundHandler()
.playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
gui.buttonClicked(buttonId, button);
}
}
@@ -0,0 +1,170 @@
package com.brandon3055.draconicevolution.client.utils.guicomponents;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.Minecraft;
/**
* Created by Brandon on 28/12/2014.
*/
public class ComponentCollection extends ComponentBase {
protected List<ComponentBase> components = new ArrayList<ComponentBase>();
protected int xSize;
protected int ySize;
protected List<String> deadGroups = new ArrayList<String>();
protected GUIBase gui;
private boolean openBoarders = false;
public ComponentCollection(int x, int y, int xSize, int ySize, GUIBase gui) {
super(x, y);
this.xSize = xSize;
this.ySize = ySize;
this.gui = gui;
}
@Override
public int getWidth() {
return xSize;
}
@Override
public int getHeight() {
return ySize;
}
public ComponentBase addComponent(ComponentBase component) {
components.add(component);
component.setWorldAndResolution(Minecraft.getMinecraft(), width, height);
return component;
}
private boolean isComponentEnabled(ComponentBase component) {
return component != null && component.isEnabled();
}
private boolean isComponentCapturingMouse(ComponentBase component, int mouseX, int mouseY) {
return isComponentEnabled(component) && component.isMouseOver(mouseX, mouseY);
}
@Override
public final void renderBackground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
for (ComponentBase component : components) if (isComponentEnabled(component)) {
component.renderBackground(minecraft, offsetX + this.x, offsetY + this.y, mouseX - this.x, mouseY - this.y);
}
}
@Override
public final void renderForground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
for (ComponentBase component : components) if (isComponentEnabled(component)) {
component.renderForground(minecraft, offsetX + this.x, offsetY + this.y, mouseX - this.x, mouseY - this.y);
}
}
@Override
public final void renderFinal(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
for (ComponentBase component : components) if (isComponentEnabled(component)) {
component.renderFinal(minecraft, offsetX + this.x, offsetY + this.y, mouseX - this.x, mouseY - this.y);
}
}
@Override
public void mouseClicked(int x, int y, int button) {
for (ComponentBase component : components) {
if (!gui.buttonPressed && component.isEnabled() && component.isMouseOver(x, y)) {
component.mouseClicked(x, y, button);
}
}
// removeScheduled();
}
@Override
public void keyTyped(char par1, int par2) {
for (ComponentBase component : components) {
if (component.isEnabled()) {
component.keyTyped(par1, par2);
}
}
}
public List<ComponentBase> getComponents() {
return components;
}
public ComponentBase getComponent(String name) {
for (ComponentBase component : components) {
if (component.name != null && component.name.equals(name)) return component;
}
return null;
}
public void setGroupEnabled(String group, boolean enabled) {
for (ComponentBase component : components) {
if (component.getGroup().equals(group)) {
component.setEnabled(enabled);
}
}
}
public void setOnlyGroupEnabled(String group) {
for (ComponentBase component : components) {
if (component.getGroup().equals(group)) {
component.setEnabled(enabled);
} else {
component.setEnabled(false);
}
}
}
public void setComponentEnabled(String name, boolean enabled) {
for (ComponentBase component : components) {
if (component.name != null && component.name.equals(name)) {
component.setEnabled(enabled);
}
}
}
public void removeGroup(String group) {
List<ComponentBase> list = new ArrayList<ComponentBase>();
for (ComponentBase component : components) {
if (component.getGroup().equals(group)) list.add(component);
}
components.removeAll(list);
}
@Override
public void setWorldAndResolution(Minecraft mc, int width, int height) {
super.setWorldAndResolution(mc, width, height);
for (ComponentBase component : components) {
component.setWorldAndResolution(mc, width, height);
}
}
public void removeScheduled() {
if (!deadGroups.isEmpty()) {
for (String s : deadGroups) removeGroup(s);
deadGroups.clear();
}
}
public void schedulRemoval(String group) {
deadGroups.add(group);
}
@Override
public void updateScreen() {
for (ComponentBase component : components) {
component.updateScreen();
}
}
public ComponentCollection setOpenBoarders() {
openBoarders = true;
return this;
}
public boolean openBoarders() {
return openBoarders;
}
}
@@ -0,0 +1,50 @@
package com.brandon3055.draconicevolution.client.utils.guicomponents;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
/**
* Created by Brandon on 31/12/2014.
*/
public class ComponentItemRenderer extends ComponentBase {
private static final ResourceLocation texture = new ResourceLocation("brandonscore:textures/gui/Widgets.png");
ItemStack stack;
public ComponentItemRenderer(int x, int y, ItemStack stack) {
super(x, y);
this.stack = stack;
}
@Override
public int getWidth() {
return 20;
}
@Override
public int getHeight() {
return 20;
}
@Override
public void renderBackground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {}
@Override
public void renderForground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
GL11.glColor4f(1f, 1f, 1f, 1f);
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
drawTexturedModalRect(x, y, 118, 0, getWidth(), getHeight());
drawItemStack(stack, x + 2, y + 2, "null");
}
@Override
public void renderFinal(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
if (isMouseOver(mouseX, mouseY)) {
renderToolTip(stack, mouseX + offsetX, mouseY + offsetY);
}
}
}
@@ -0,0 +1,21 @@
package com.brandon3055.draconicevolution.client.utils.guicomponents;
/**
* Created by Brandon on 6/03/2015.
*/
public abstract class ComponentScrollingBase extends ComponentBase {
protected GUIScrollingBase gui;
public ComponentScrollingBase(int x, int y, GUIScrollingBase gui) {
super(x, y);
this.gui = gui;
}
public abstract void handleScrollInput(int direction);
@Override
public boolean isMouseOver(int mouseX, int mouseY) {
return super.isMouseOver(mouseX, mouseY + gui.scrollOffset);
}
}
@@ -0,0 +1,48 @@
package com.brandon3055.draconicevolution.client.utils.guicomponents;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
/**
* Created by Brandon on 13/01/2015.
*/
public class ComponentSlotBackground extends ComponentBase {
private static final ResourceLocation widgets = new ResourceLocation("brandonscore:textures/gui/Widgets.png");
public ComponentSlotBackground(int x, int y) {
super(x, y);
}
@Override
public int getWidth() {
return 18;
}
@Override
public int getHeight() {
return 18;
}
@Override
public void renderBackground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
minecraft.renderEngine.bindTexture(widgets);
drawTexturedModalRect(x, y, 119, 1, getWidth(), getHeight());
}
@Override
public void renderForground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {}
public static ComponentCollection addInventorySlots(ComponentCollection c, int xOffset, int yOffset,
int lockedSlot) {
for (int x = 0; x < 9; x++) if (x != lockedSlot)
c.addComponent(new ComponentSlotBackground(xOffset + x * 18, yOffset + 58)).setGroup("INVENTORY");
for (int y = 0; y < 3; y++) {
for (int x = 0; x < 9; x++) if (x + y * 9 + 9 != lockedSlot)
c.addComponent(new ComponentSlotBackground(xOffset + x * 18, yOffset + y * 18)).setGroup("INVENTORY");
}
return c;
}
}
@@ -0,0 +1,71 @@
package com.brandon3055.draconicevolution.client.utils.guicomponents;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiTextField;
/**
* Created by brandon3055 on 16/2/2016.
*/
public class ComponentTextField extends ComponentBase {
public GuiTextField textField;
private int xSize;
private int ySize;
private GUIBase parent;
private String label = "";
private int labelColour = 0;
public ComponentTextField(GUIBase parent, int x, int y, int xSize, int ySize) {
super(x, y);
this.xSize = xSize;
this.ySize = ySize;
this.parent = parent;
textField = new GuiTextField(fontRendererObj, x, y, xSize, ySize);
}
@Override
public int getWidth() {
return xSize;
}
@Override
public int getHeight() {
return ySize;
}
@Override
public void renderBackground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {}
@Override
public void renderForground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
drawRect(x - 1, y - 1, x + xSize - textField.width + 1, y + ySize + 1, -6250336);
textField.drawTextBox();
drawRect(x, y, x + xSize - textField.width, y + ySize, -16777216);
fontRendererObj.drawString(label, x + 1, y + 2, labelColour);
}
@Override
public void mouseClicked(int x, int y, int button) {
textField.mouseClicked(x, y, button);
}
@Override
protected void keyTyped(char par1, int par2) {
textField.textboxKeyTyped(par1, par2);
if (textField.isFocused()) parent.componentCallBack(this);
}
public boolean isFocused() {
return textField.isFocused();
}
public ComponentTextField setLabel(String label, int labelColour) {
this.label = label;
this.labelColour = labelColour;
int labelLength = fontRendererObj.getStringWidth(label);
textField.xPosition = x + labelLength;
textField.width = xSize - labelLength;
textField.setTextColor(labelColour);
return this;
}
}
@@ -0,0 +1,91 @@
package com.brandon3055.draconicevolution.client.utils.guicomponents;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
/**
* Created by brandon3055 on 31/7/2015.
*/
public class ComponentTextureButton extends ComponentButton {
public int textureXPos;
public int textureYPos;
private ResourceLocation texture;
private boolean forceFullRender = false;
// public ComponentTextureButton(int id, int xPos, int yPos, int textureXPos, int textureYPos, int xSise, int ySise,
// String text) {
public ComponentTextureButton(int x, int y, int textureXPos, int textureYPos, int xSize, int ySize, int id,
GUIBase gui, String displayString, String hoverText, ResourceLocation texture) {
super(x, y, xSize, ySize, id, gui, displayString, hoverText);
this.textureXPos = textureXPos;
this.textureYPos = textureYPos;
this.texture = texture;
}
public ComponentTextureButton forceFullRender() {
forceFullRender = true;
return this;
}
@Override
public void renderForground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
GL11.glPushMatrix();
minecraft.getTextureManager().bindTexture(texture);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
if (!forceFullRender) {
int k = isMouseOver(mouseX, mouseY) ? 2 : 1;
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
this.drawTexturedModalRect(this.x, this.y, textureXPos, textureYPos + k * ySize, this.xSize, this.ySize);
int l = 14737632;
if (packedFGColour != 0) {
l = packedFGColour;
} else if (!this.enabled) {
l = 10526880;
} else if (isMouseOver(mouseX, mouseY)) {
l = 16777120;
}
this.drawCenteredString(
fontRendererObj,
this.displayString,
this.x + this.xSize / 2,
this.y + (this.ySize - 8) / 2,
l);
} else {
int xPos = this.x;
int yPos = this.y;
int xSize = this.xSize;
int ySize = this.ySize;
Tessellator tessellator = Tessellator.instance;
if (isMouseOver(mouseX, mouseY)) {
GL11.glDisable(GL11.GL_ALPHA_TEST);
tessellator.setColorRGBA_I(0x000000, 255);
tessellator.startDrawingQuads();
tessellator.addVertex((double) xPos, (double) (yPos + ySize), (double) this.zLevel);
tessellator.addVertex((double) (xPos + xSize), (double) (yPos + ySize), (double) this.zLevel);
tessellator.addVertex((double) (xPos + xSize), (double) yPos, (double) this.zLevel);
tessellator.addVertex((double) xPos, (double) yPos, (double) this.zLevel);
tessellator.draw();
GL11.glEnable(GL11.GL_ALPHA_TEST);
}
tessellator.startDrawingQuads();
tessellator.addVertexWithUV((double) xPos, (double) (yPos + ySize), (double) this.zLevel, 0, 1);
tessellator.addVertexWithUV((double) (xPos + xSize), (double) (yPos + ySize), (double) this.zLevel, 1, 1);
tessellator.addVertexWithUV((double) (xPos + xSize), (double) yPos, (double) this.zLevel, 1, 0);
tessellator.addVertexWithUV((double) xPos, (double) yPos, (double) this.zLevel, 0, 0);
tessellator.draw();
}
GL11.glPopMatrix();
}
}
@@ -0,0 +1,68 @@
package com.brandon3055.draconicevolution.client.utils.guicomponents;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
/**
* Created by Brandon on 29/12/2014.
*/
public class ComponentTexturedRect extends ComponentBase {
private int width;
private int height;
private int texX = 0;
private int texY = 0;
private final ResourceLocation texture;
private boolean transparent = false;
public ComponentTexturedRect(int x, int y, int width, int height, ResourceLocation texture) {
super(x, y);
this.width = width;
this.height = height;
this.texture = texture;
}
public ComponentTexturedRect(int x, int y, int texX, int texY, int width, int height, ResourceLocation texture,
boolean transparent) {
super(x, y);
this.width = width;
this.height = height;
this.texture = texture;
this.texX = texX;
this.texY = texY;
this.transparent = transparent;
}
@Override
public int getWidth() {
return width;
}
@Override
public int getHeight() {
return height;
}
@Override
public void renderBackground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
if (transparent) {
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
// GL11.glScalef(1f, 0.33f, 1f);
// GL11.glScalef(0.5f, 0.5f, 0.5f);
}
GL11.glColor4f(1f, 1f, 1f, 1f);
drawTexturedModalRect(x, y, texX, texY, width, height);
if (transparent) {
// GL11.glScalef(2f, 2f, 2f);
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
}
@Override
public void renderForground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {}
}
@@ -0,0 +1,142 @@
package com.brandon3055.draconicevolution.client.utils.guicomponents;
/**
* Created by Brandon on 25/12/2014. This class is copied from open blocks
*/
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.inventory.Container;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
public abstract class GUIBase extends GuiContainer {
protected ComponentCollection collection;
/** used to prevent multiple buttons being pressed wen overlapping components are changed */
protected boolean buttonPressed = false;
public GUIBase(Container container, int xSize, int ySize) {
super(container);
this.xSize = xSize;
this.ySize = ySize;
mc = Minecraft.getMinecraft();
collection = assembleComponents();
}
protected abstract ComponentCollection assembleComponents();
protected void addDependentComponents() {}
@Override
protected void mouseClicked(int x, int y, int button) {
super.mouseClicked(x, y, button);
if (collection.isMouseOver(x - this.guiLeft, y - this.guiTop) || collection.openBoarders()) {
collection.mouseClicked(x - this.guiLeft, y - this.guiTop, button);
}
}
@Override
protected void mouseMovedOrUp(int x, int y, int button) {
super.mouseMovedOrUp(x, y, button);
if (collection.isMouseOver(x - this.guiLeft, y - this.guiTop) || collection.openBoarders()) {
// if (button >= 0) collection.mouseUp(x - this.guiLeft, y - this.guiTop, button);
}
}
@Override
protected void mouseClickMove(int x, int y, int button, long time) {
super.mouseClickMove(x, y, button, time);
// if (collection.isMouseOver(x - this.guiLeft, y - this.guiTop)) collection.mouseDrag(x - this.guiLeft, y -
// this.guiTop, button, time);
}
@Override
protected void keyTyped(char par1, int par2) {
super.keyTyped(par1, par2);
collection.keyTyped(par1, par2);
}
public void preRender(float mouseX, float mouseY) {}
public void postRender(int mouseX, int mouseY) {}
@Override
protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
prepareRenderState();
preRender(mouseX, mouseY);
GL11.glPushMatrix();
GL11.glTranslated(this.guiLeft, this.guiTop, 0);
collection.renderBackground(this.mc, 0, 0, mouseX - this.guiLeft, mouseY - this.guiTop);
GL11.glPopMatrix();
postRender(mouseX, mouseY);
restoreRenderState();
}
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
// prepareRenderState();
GL11.glPushMatrix();
collection.renderForground(this.mc, 0, 0, mouseX - this.guiLeft, mouseY - this.guiTop);
GL11.glPopMatrix();
// restoreRenderState();
}
@Override
public void drawScreen(int mouseX, int mouseY, float par3) {
super.drawScreen(mouseX, mouseY, par3);
prepareRenderState();
GL11.glPushMatrix();
collection.renderFinal(this.mc, this.guiLeft, this.guiTop, mouseX - this.guiLeft, mouseY - this.guiTop);
GL11.glPopMatrix();
restoreRenderState();
}
protected void prepareRenderState() {
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
}
protected void restoreRenderState() {
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
RenderHelper.enableStandardItemLighting();
}
@Override
public void setWorldAndResolution(Minecraft mc, int width, int height) {
super.setWorldAndResolution(mc, width, height);
collection.setWorldAndResolution(mc, width, height);
}
@Override
public void updateScreen() {
super.updateScreen();
collection.removeScheduled();
collection.updateScreen();
buttonPressed = false;
}
public void buttonClicked(int id, int button) {
buttonPressed = true;
}
public int getXSize() {
return xSize;
}
public int getYSize() {
return ySize;
}
/**
* This can be used by components to contact the GUI and the gui can then do some custom operation for that
* component Added so ComponentTextField can let the gui know when it has been changed
*/
public void componentCallBack(ComponentBase component) {}
}
@@ -0,0 +1,76 @@
package com.brandon3055.draconicevolution.client.utils.guicomponents;
import net.minecraft.inventory.Container;
/**
* Created by Brandon on 6/03/2015.
*/
public abstract class GUIScrollingBase extends GUIBase {
public int scrollOffset;
public int pageLength;
public int scrollLimit;
public int barPosition;
public boolean disableScrollBar = true;
public GUIScrollingBase(Container container, int xSize, int ySize) {
super(container, xSize, ySize);
}
@Override
public void handleMouseInput() {
super.handleMouseInput();
int i = org.lwjgl.input.Mouse.getEventDWheel();
if (i != 0) {
handleScrollInput(i > 0 ? -1 : 1);
for (ComponentBase c : collection.getComponents()) {
if (c instanceof ComponentScrollingBase && c.isEnabled())
((ComponentScrollingBase) c).handleScrollInput(i > 0 ? -1 : 1);
}
}
}
public abstract void handleScrollInput(int direction);
@Override
protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
}
protected int clickedY = 0;
protected boolean scrollPressed = false;
@Override
protected void mouseClicked(int x, int y, int button) {
super.mouseClicked(x, y, button);
if (disableScrollBar) return;
clickedY = y;
if ((x - guiLeft + 17) > 0 && (x - guiLeft + 17) < 17
&& clickedY - guiTop - 20 > barPosition
&& clickedY - guiTop - 20 < barPosition + 38)
scrollPressed = true;
}
@Override
protected void mouseMovedOrUp(int x, int y, int button) {
super.mouseMovedOrUp(x, y, button);
scrollPressed = false;
}
@Override
protected void mouseClickMove(int x, int y, int button, long time) {
super.mouseClickMove(x, y, button, time);
if (!scrollPressed || disableScrollBar) return;
barPosition += y - clickedY;
if (barPosition < 0) barPosition = 0;
else if (barPosition > 247) barPosition = 247;
if (barPosition != 0 && barPosition != 247) clickedY = y;
barMoved((double) barPosition / 247D * 1D);
}
/**
* @param position New bar position between 0 (top) and 1 (bottom)
*/
public abstract void barMoved(double position);
}
@@ -1,18 +1,23 @@
package com.brandon3055.draconicevolution.common; package com.brandon3055.draconicevolution.common;
import net.minecraft.client.audio.ISound; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.server.MinecraftServer;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.ForgeChunkManager;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary;
import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.creativetab.DETab; import com.brandon3055.draconicevolution.client.creativetab.DETab;
import com.brandon3055.draconicevolution.client.gui.GuiHandler; import com.brandon3055.draconicevolution.client.gui.GuiHandler;
import com.brandon3055.draconicevolution.client.render.particle.ParticleEnergyBeam;
import com.brandon3055.draconicevolution.client.render.particle.ParticleEnergyField;
import com.brandon3055.draconicevolution.client.render.particle.ParticleReactorBeam;
import com.brandon3055.draconicevolution.common.achievements.Achievements; import com.brandon3055.draconicevolution.common.achievements.Achievements;
import com.brandon3055.draconicevolution.common.entity.EntityChaosBolt; import com.brandon3055.draconicevolution.common.entity.EntityChaosBolt;
import com.brandon3055.draconicevolution.common.entity.EntityChaosCrystal; import com.brandon3055.draconicevolution.common.entity.EntityChaosCrystal;
@@ -31,6 +36,7 @@ import com.brandon3055.draconicevolution.common.handler.ContributorHandler;
import com.brandon3055.draconicevolution.common.handler.CraftingHandler; import com.brandon3055.draconicevolution.common.handler.CraftingHandler;
import com.brandon3055.draconicevolution.common.handler.FMLEventHandler; import com.brandon3055.draconicevolution.common.handler.FMLEventHandler;
import com.brandon3055.draconicevolution.common.handler.MinecraftForgeEventHandler; import com.brandon3055.draconicevolution.common.handler.MinecraftForgeEventHandler;
import com.brandon3055.draconicevolution.common.items.armor.CustomArmorHandler;
import com.brandon3055.draconicevolution.common.lib.OreDoublingRegistry; import com.brandon3055.draconicevolution.common.lib.OreDoublingRegistry;
import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.magic.EnchantmentReaper; import com.brandon3055.draconicevolution.common.magic.EnchantmentReaper;
@@ -58,7 +64,6 @@ import com.brandon3055.draconicevolution.common.network.TileObjectPacket;
import com.brandon3055.draconicevolution.common.network.ToolModePacket; import com.brandon3055.draconicevolution.common.network.ToolModePacket;
import com.brandon3055.draconicevolution.common.tileentities.TileCKeyStone; import com.brandon3055.draconicevolution.common.tileentities.TileCKeyStone;
import com.brandon3055.draconicevolution.common.tileentities.TileChaosShard; import com.brandon3055.draconicevolution.common.tileentities.TileChaosShard;
import com.brandon3055.draconicevolution.common.tileentities.TileContainerTemplate;
import com.brandon3055.draconicevolution.common.tileentities.TileCustomSpawner; import com.brandon3055.draconicevolution.common.tileentities.TileCustomSpawner;
import com.brandon3055.draconicevolution.common.tileentities.TileDislocatorInhibitor; import com.brandon3055.draconicevolution.common.tileentities.TileDislocatorInhibitor;
import com.brandon3055.draconicevolution.common.tileentities.TileDissEnchanter; import com.brandon3055.draconicevolution.common.tileentities.TileDissEnchanter;
@@ -73,7 +78,6 @@ import com.brandon3055.draconicevolution.common.tileentities.TilePlayerDetectorA
import com.brandon3055.draconicevolution.common.tileentities.TilePotentiometer; import com.brandon3055.draconicevolution.common.tileentities.TilePotentiometer;
import com.brandon3055.draconicevolution.common.tileentities.TileSunDial; import com.brandon3055.draconicevolution.common.tileentities.TileSunDial;
import com.brandon3055.draconicevolution.common.tileentities.TileTeleporterStand; import com.brandon3055.draconicevolution.common.tileentities.TileTeleporterStand;
import com.brandon3055.draconicevolution.common.tileentities.TileTestBlock;
import com.brandon3055.draconicevolution.common.tileentities.TileUpgradeModifier; import com.brandon3055.draconicevolution.common.tileentities.TileUpgradeModifier;
import com.brandon3055.draconicevolution.common.tileentities.TileWeatherController; import com.brandon3055.draconicevolution.common.tileentities.TileWeatherController;
import com.brandon3055.draconicevolution.common.tileentities.energynet.TileEnergyRelay; import com.brandon3055.draconicevolution.common.tileentities.energynet.TileEnergyRelay;
@@ -91,8 +95,10 @@ import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.Til
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore; import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorEnergyInjector; import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorEnergyInjector;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorStabilizer; import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorStabilizer;
import com.brandon3055.draconicevolution.common.utills.DragonChunkLoader; import com.brandon3055.draconicevolution.common.utils.DragonChunkLoader;
import com.brandon3055.draconicevolution.common.utills.LogHelper; import com.brandon3055.draconicevolution.common.utils.LogHelper;
import com.brandon3055.draconicevolution.common.utils.handlers.FileHandler;
import com.brandon3055.draconicevolution.common.utils.handlers.ProcessHandler;
import com.brandon3055.draconicevolution.common.world.DraconicWorldGenerator; import com.brandon3055.draconicevolution.common.world.DraconicWorldGenerator;
import com.brandon3055.draconicevolution.integration.computers.CCOCIntegration; import com.brandon3055.draconicevolution.integration.computers.CCOCIntegration;
@@ -100,6 +106,8 @@ import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStoppedEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.EntityRegistry; import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry;
@@ -107,10 +115,28 @@ import cpw.mods.fml.relauncher.Side;
public class CommonProxy { public class CommonProxy {
private Achievements achievements;
private CustomArmorHandler armorHandler;
private DragonChunkLoader dragonChunkLoader;
private final Map<World, List<TileDislocatorInhibitor>> serverInhibitorsMap = new HashMap<>();
public CommonProxy() {
MinecraftForge.EVENT_BUS.register(this);
}
public void preInit(FMLPreInitializationEvent event) { public void preInit(FMLPreInitializationEvent event) {
FileHandler.init(event);
ProcessHandler.init();
ConfigHandler.init(event.getSuggestedConfigurationFile()); ConfigHandler.init(event.getSuggestedConfigurationFile());
BalanceConfigHandler.init(event.getModConfigurationDirectory()); BalanceConfigHandler.init(event.getModConfigurationDirectory());
registerEventListeners(event.getSide()); MinecraftForge.EVENT_BUS.register(new MinecraftForgeEventHandler());
this.achievements = new Achievements();
MinecraftForge.EVENT_BUS.register(this.achievements);
FMLCommonHandler.instance().bus().register(this.achievements);
FMLCommonHandler.instance().bus().register(new FMLEventHandler());
this.armorHandler = new CustomArmorHandler();
MinecraftForge.EVENT_BUS.register(armorHandler);
FMLCommonHandler.instance().bus().register(armorHandler);
ModBlocks.init(); ModBlocks.init();
ModItems.init(); ModItems.init();
ContributorHandler.init(); ContributorHandler.init();
@@ -119,31 +145,8 @@ public class CommonProxy {
registerOres(); registerOres();
DraconicEvolution.reaperEnchant = new EnchantmentReaper(ConfigHandler.reaperEnchantID); DraconicEvolution.reaperEnchant = new EnchantmentReaper(ConfigHandler.reaperEnchantID);
//
// Potion[] potionTypes = null;
// LogHelper.info("Expanding Potion array size to 256");
//
// for (Field f : Potion.class.getDeclaredFields()) {
// f.setAccessible(true);
//
// try {
// if (f.getName().equals("potionTypes") || f.getName().equals("field_76425_a")) {
// Field modfield = Field.class.getDeclaredField("modifiers");
// modfield.setAccessible(true);
// modfield.setInt(f, f.getModifiers() & ~Modifier.FINAL);
// potionTypes = (Potion[]) f.get(null);
// final Potion[] newPotionTypes = new Potion[256];
// System.arraycopy(potionTypes, 0, newPotionTypes, 0, potionTypes.length);
// f.set(null, newPotionTypes);
// }
// }
// catch (Exception e) {
// LogHelper.error("Severe error, please report this to the mod author:");
// e.printStackTrace();
// }
// }
Achievements.addModAchievements(); this.achievements.addModAchievements();
LogHelper.info("Finished PreInitialization"); LogHelper.info("Finished PreInitialization");
} }
@@ -155,18 +158,30 @@ public class CommonProxy {
DETab.initialize(); DETab.initialize();
PotionHandler.init(); PotionHandler.init();
CCOCIntegration.init(); CCOCIntegration.init();
DragonChunkLoader.init(); this.dragonChunkLoader = new DragonChunkLoader();
ForgeChunkManager.setForcedChunkLoadingCallback(DraconicEvolution.instance, this.dragonChunkLoader);
LogHelper.info("Finished Initialization"); LogHelper.info("Finished Initialization");
} }
public void postInit(FMLPostInitializationEvent event) { public void postInit(FMLPostInitializationEvent event) {
BalanceConfigHandler.finishLoading(); BalanceConfigHandler.finishLoading();
OreDoublingRegistry.init(); OreDoublingRegistry.init();
Achievements.registerAchievementPane(); this.achievements.registerAchievementPane();
LogHelper.info("Finished PostInitialization"); LogHelper.info("Finished PostInitialization");
} }
public void initializeNetwork() { public void onServerStopped(FMLServerStoppedEvent event) {
this.serverInhibitorsMap.clear();
this.dragonChunkLoader.onServerStopped();
this.armorHandler.onServerStopped();
}
@SubscribeEvent
public void onWorldUnload(WorldEvent.Unload event) {
this.serverInhibitorsMap.remove(event.world);
}
private void initializeNetwork() {
// spotless:off // spotless:off
DraconicEvolution.network = NetworkRegistry.INSTANCE.newSimpleChannel(DraconicEvolution.networkChannelName); DraconicEvolution.network = NetworkRegistry.INSTANCE.newSimpleChannel(DraconicEvolution.networkChannelName);
DraconicEvolution.network.registerMessage(ButtonPacket.Handler.class, ButtonPacket.class, 0, Side.SERVER); DraconicEvolution.network.registerMessage(ButtonPacket.Handler.class, ButtonPacket.class, 0, Side.SERVER);
@@ -197,7 +212,7 @@ public class CommonProxy {
// spotless:on // spotless:on
} }
public void registerTileEntities() { private void registerTileEntities() {
// spotless:off // spotless:off
GameRegistry.registerTileEntity(TileWeatherController.class, References.RESOURCESPREFIX + "TileWeatherController"); GameRegistry.registerTileEntity(TileWeatherController.class, References.RESOURCESPREFIX + "TileWeatherController");
GameRegistry.registerTileEntity(TileSunDial.class, References.RESOURCESPREFIX + "TileSunDial"); GameRegistry.registerTileEntity(TileSunDial.class, References.RESOURCESPREFIX + "TileSunDial");
@@ -210,7 +225,7 @@ public class CommonProxy {
GameRegistry.registerTileEntity(TileCustomSpawner.class, References.RESOURCESPREFIX + "TileCustomSpawner"); GameRegistry.registerTileEntity(TileCustomSpawner.class, References.RESOURCESPREFIX + "TileCustomSpawner");
GameRegistry.registerTileEntity(TileGenerator.class, References.RESOURCESPREFIX + "TileGenerator"); GameRegistry.registerTileEntity(TileGenerator.class, References.RESOURCESPREFIX + "TileGenerator");
GameRegistry.registerTileEntity(TileEnergyStorageCore.class, References.RESOURCESPREFIX + "TileEnergyStorageCore"); GameRegistry.registerTileEntity(TileEnergyStorageCore.class, References.RESOURCESPREFIX + "TileEnergyStorageCore");
GameRegistry.registerTileEntity(TileEarth.class, References.RESOURCESPREFIX + "TileEarth"); if (ModBlocks.earthBlock != null) GameRegistry.registerTileEntity(TileEarth.class, References.RESOURCESPREFIX + "TileEarth");
GameRegistry.registerTileEntity(TileInvisibleMultiblock.class, References.RESOURCESPREFIX + "TileInvisibleMultiblock"); GameRegistry.registerTileEntity(TileInvisibleMultiblock.class, References.RESOURCESPREFIX + "TileInvisibleMultiblock");
GameRegistry.registerTileEntity(TileEnergyPylon.class, References.RESOURCESPREFIX + "TileEnergyPylon"); GameRegistry.registerTileEntity(TileEnergyPylon.class, References.RESOURCESPREFIX + "TileEnergyPylon");
GameRegistry.registerTileEntity(TileEnderResurrection.class, References.RESOURCESPREFIX + "TileEnderResurrection"); GameRegistry.registerTileEntity(TileEnderResurrection.class, References.RESOURCESPREFIX + "TileEnderResurrection");
@@ -232,20 +247,9 @@ public class CommonProxy {
GameRegistry.registerTileEntity(TileChaosShard.class, References.RESOURCESPREFIX + "TileChaosShard"); GameRegistry.registerTileEntity(TileChaosShard.class, References.RESOURCESPREFIX + "TileChaosShard");
GameRegistry.registerTileEntity(TileUpgradeModifier.class, References.RESOURCESPREFIX + "TileEnhancementModifier"); GameRegistry.registerTileEntity(TileUpgradeModifier.class, References.RESOURCESPREFIX + "TileEnhancementModifier");
GameRegistry.registerTileEntity(TileDislocatorInhibitor.class, References.RESOURCESPREFIX + "TileDislocatorInhibitor"); GameRegistry.registerTileEntity(TileDislocatorInhibitor.class, References.RESOURCESPREFIX + "TileDislocatorInhibitor");
if (DraconicEvolution.debug) {
GameRegistry.registerTileEntity(TileTestBlock.class, References.RESOURCESPREFIX + "TileTestBlock");
GameRegistry.registerTileEntity(TileContainerTemplate.class, References.RESOURCESPREFIX + "TileContainerTemplate");
}
// spotless:on // spotless:on
} }
public void registerEventListeners(Side s) {
MinecraftForge.EVENT_BUS.register(new MinecraftForgeEventHandler());
MinecraftForge.EVENT_BUS.register(new Achievements());
FMLCommonHandler.instance().bus().register(new Achievements());
FMLCommonHandler.instance().bus().register(new FMLEventHandler());
}
public void registerGuiHandeler() { public void registerGuiHandeler() {
new GuiHandler(); new GuiHandler();
} }
@@ -281,7 +285,6 @@ public class CommonProxy {
EntityRegistry.registerModEntity(EntityPersistentItem.class, "Persistent Item", 1, DraconicEvolution.instance, 32, 5, true); EntityRegistry.registerModEntity(EntityPersistentItem.class, "Persistent Item", 1, DraconicEvolution.instance, 32, 5, true);
EntityRegistry.registerModEntity(EntityDraconicArrow.class, "Arrow", 2, DraconicEvolution.instance, 32, 5, true); EntityRegistry.registerModEntity(EntityDraconicArrow.class, "Arrow", 2, DraconicEvolution.instance, 32, 5, true);
EntityRegistry.registerModEntity(EntityEnderArrow.class, "Ender Arrow", 3, DraconicEvolution.instance, 32, 1, true); EntityRegistry.registerModEntity(EntityEnderArrow.class, "Ender Arrow", 3, DraconicEvolution.instance, 32, 1, true);
// EntityRegistry.registerModEntity(EntityChaosDrill.class, "Chaos Drill", 4, DraconicEvolution.instance, 10, 5, false);
EntityRegistry.registerModEntity(EntityDragonHeart.class, "Dragon Heart Item", 5, DraconicEvolution.instance, 32, 5, true); EntityRegistry.registerModEntity(EntityDragonHeart.class, "Dragon Heart Item", 5, DraconicEvolution.instance, 32, 5, true);
EntityRegistry.registerModEntity(EntityChaosGuardian.class, "ChaosGuardian", 6, DraconicEvolution.instance, 256, 1, true); EntityRegistry.registerModEntity(EntityChaosGuardian.class, "ChaosGuardian", 6, DraconicEvolution.instance, 256, 1, true);
EntityRegistry.registerModEntity(EntityDragonProjectile.class, "DragonProjectile", 7, DraconicEvolution.instance, 256, 1, true); EntityRegistry.registerModEntity(EntityDragonProjectile.class, "DragonProjectile", 7, DraconicEvolution.instance, 256, 1, true);
@@ -292,23 +295,97 @@ public class CommonProxy {
// spotless:on // spotless:on
} }
public ParticleEnergyBeam energyBeam(World worldObj, double x, double y, double z, double tx, double ty, double tz, public boolean isDedicatedServer() {
int powerFlow, boolean advanced, ParticleEnergyBeam oldBeam, boolean render, int beamType) { return true;
}
public MinecraftServer getMCServer() {
return FMLCommonHandler.instance().getMinecraftServerInstance();
}
public World getClientWorld() {
return null; return null;
} }
public ParticleEnergyField energyField(World worldObj, double x, double y, double z, int type, boolean advanced, public boolean isSpaceDown() {
ParticleEnergyField oldBeam, boolean render) { return false;
}
public boolean isCtrlDown() {
return false;
}
public boolean isShiftDown() {
return false;
}
public EntityPlayer getClientPlayer() {
return null; return null;
} }
public ParticleReactorBeam reactorBeam(TileEntity tile, ParticleReactorBeam oldBeam, boolean render) { public boolean isClient() {
return null; return false;
} }
public void spawnParticle(Object particle, int range) {} public void triggerAchievement(EntityPlayer player, String name) {
this.achievements.triggerAchievement(player, name);
}
public ISound playISound(ISound sound) { public DragonChunkLoader getDragonChunkLoader() {
return null; return dragonChunkLoader;
}
public void tryRepositionPlayerOnMount(int entityId) {}
public void registerInhibitor(TileDislocatorInhibitor tile) {
if (tile.hasWorldObj()) {
registerInhibitor(this.serverInhibitorsMap, tile);
}
}
protected static void registerInhibitor(Map<World, List<TileDislocatorInhibitor>> map,
TileDislocatorInhibitor tile) {
final List<TileDislocatorInhibitor> list = map.computeIfAbsent(tile.getWorldObj(), k -> new ArrayList<>());
if (!list.contains(tile)) {
list.add(tile);
}
}
public void unregisterInhibitor(TileDislocatorInhibitor tile) {
if (tile.hasWorldObj()) {
unregisterInhibitor(this.serverInhibitorsMap, tile);
}
}
protected static void unregisterInhibitor(Map<World, List<TileDislocatorInhibitor>> map,
TileDislocatorInhibitor tile) {
final List<TileDislocatorInhibitor> list = map.get(tile.getWorldObj());
if (list != null) {
list.remove(tile);
if (list.isEmpty()) {
map.remove(tile.getWorldObj());
}
}
}
public boolean isBlockedByInhibitor(World world, EntityItem item) {
return isBlockedByInhibitor(this.serverInhibitorsMap, world, item);
}
protected static boolean isBlockedByInhibitor(Map<World, List<TileDislocatorInhibitor>> map, World world,
EntityItem item) {
final List<TileDislocatorInhibitor> list = map.get(world);
if (list == null) {
return false;
}
// noinspection ForLoopReplaceableByForEach
for (int i = 0; i < list.size(); i++) {
final TileDislocatorInhibitor tile = list.get(i);
if (tile.shouldBeActive() && tile.isInRange(item.posX, item.posY, item.posZ)
&& tile.isBlockingItem(item.getEntityItem())) {
return true;
}
}
return false;
} }
} }
@@ -4,8 +4,6 @@ import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.blocks.BlockContainerTemplate;
import com.brandon3055.draconicevolution.common.blocks.BlockDE; import com.brandon3055.draconicevolution.common.blocks.BlockDE;
import com.brandon3055.draconicevolution.common.blocks.CKeyStone; import com.brandon3055.draconicevolution.common.blocks.CKeyStone;
import com.brandon3055.draconicevolution.common.blocks.ChaosCrystal; import com.brandon3055.draconicevolution.common.blocks.ChaosCrystal;
@@ -22,7 +20,6 @@ import com.brandon3055.draconicevolution.common.blocks.Potentiometer;
import com.brandon3055.draconicevolution.common.blocks.RainSensor; import com.brandon3055.draconicevolution.common.blocks.RainSensor;
import com.brandon3055.draconicevolution.common.blocks.SafetyFlame; import com.brandon3055.draconicevolution.common.blocks.SafetyFlame;
import com.brandon3055.draconicevolution.common.blocks.TeleporterStand; import com.brandon3055.draconicevolution.common.blocks.TeleporterStand;
import com.brandon3055.draconicevolution.common.blocks.TestBlock;
import com.brandon3055.draconicevolution.common.blocks.XRayBlock; import com.brandon3055.draconicevolution.common.blocks.XRayBlock;
import com.brandon3055.draconicevolution.common.blocks.machine.DislocatorInhibitor; import com.brandon3055.draconicevolution.common.blocks.machine.DislocatorInhibitor;
import com.brandon3055.draconicevolution.common.blocks.machine.DissEnchanter; import com.brandon3055.draconicevolution.common.blocks.machine.DissEnchanter;
@@ -58,7 +55,6 @@ public class ModBlocks {
public static BlockDE weatherController; public static BlockDE weatherController;
public static BlockDE sunDial; public static BlockDE sunDial;
public static BlockDE draconiumOre; public static BlockDE draconiumOre;
public static BlockDE testBlock;
public static BlockDE grinder; public static BlockDE grinder;
public static BlockDE potentiometer; public static BlockDE potentiometer;
public static BlockDE rainSensor; public static BlockDE rainSensor;
@@ -114,7 +110,7 @@ public class ModBlocks {
customSpawner = new CustomSpawner(); customSpawner = new CustomSpawner();
generator = new Generator(); generator = new Generator();
energyStorageCore = new EnergyStorageCore(); energyStorageCore = new EnergyStorageCore();
earthBlock = new Earth(); if (!ConfigHandler.disableEarthBlock) earthBlock = new Earth();
draconiumBlock = new DraconiumBlock(); draconiumBlock = new DraconiumBlock();
invisibleMultiblock = new InvisibleMultiblock(); invisibleMultiblock = new InvisibleMultiblock();
energyPylon = new EnergyPylon(); energyPylon = new EnergyPylon();
@@ -141,11 +137,6 @@ public class ModBlocks {
if (isEnabled(chaosShardAtmos)) GameRegistry.registerBlock(chaosShardAtmos, "chaosShardAtmos"); if (isEnabled(chaosShardAtmos)) GameRegistry.registerBlock(chaosShardAtmos, "chaosShardAtmos");
if (DraconicEvolution.debug) {
testBlock = new TestBlock();
containerTemplate = new BlockContainerTemplate();
}
resurrectionStone = new ItemStack(ModBlocks.draconiumBlock, 1, 1); resurrectionStone = new ItemStack(ModBlocks.draconiumBlock, 1, 1);
} }
@@ -9,9 +9,9 @@ import net.minecraft.util.StatCollector;
import net.minecraftforge.common.AchievementPage; import net.minecraftforge.common.AchievementPage;
import net.minecraftforge.event.entity.player.EntityItemPickupEvent; import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.ModBlocks;
import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper;
import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent; import cpw.mods.fml.common.gameevent.PlayerEvent;
@@ -21,38 +21,31 @@ import cpw.mods.fml.common.gameevent.PlayerEvent;
*/ */
public class Achievements { public class Achievements {
private static AchievementPage achievementsPage; private final HashMap<String, Achievement> achievementsList = new HashMap<>();
private static HashMap<String, Achievement> achievementsList = new HashMap<String, Achievement>(); private final HashMap<String, AchievementCondition> achievementItems = new HashMap<>();
private static HashMap<String, AchievementCondition> achievementItems = new HashMap<String, AchievementCondition>();
public static void addAchievement(String name, Achievement achievement, ItemStack stack, String triggerCondition) { private void addAchievement(String name, Achievement achievement, ItemStack stack, String triggerCondition) {
if (stack == null || stack.getItem() == null) return; if (stack == null || stack.getItem() == null) return;
achievementsList.put(name, achievement.registerStat()); achievementsList.put(name, achievement.registerStat());
achievementItems.put(stack.getUnlocalizedName(), new AchievementCondition(name, triggerCondition)); achievementItems.put(stack.getUnlocalizedName(), new AchievementCondition(name, triggerCondition));
} }
public static void addAchievement(String name, Achievement achievement, String triggerCondition) { private void addAchievement(String name, Achievement achievement, String triggerCondition) {
addAchievement(name, achievement, achievement.theItemStack, triggerCondition); addAchievement(name, achievement, achievement.theItemStack, triggerCondition);
} }
public static void addAchievement(String name, Achievement achievement) { private Achievement getAchievement(String name) {
addAchievement(name, achievement, achievement.theItemStack, "null");
}
public static Achievement getAchievement(String name) {
return achievementsList.get(name); return achievementsList.get(name);
} }
public static void triggerAchievement(EntityPlayer player, String name) { public void triggerAchievement(EntityPlayer player, String name) {
Achievement ach = getAchievement(name); Achievement ach = getAchievement(name);
if (ach != null) { if (ach != null) {
player.triggerAchievement(ach); player.triggerAchievement(ach);
} }
} }
public static void addModAchievements() { public void addModAchievements() {
int x = 5; int x = 5;
addAchievement( addAchievement(
"draconicevolution.dust", "draconicevolution.dust",
@@ -442,11 +435,11 @@ public class Achievements {
"craft"); "craft");
} }
public static void registerAchievementPane() { public void registerAchievementPane() {
Achievement[] achievements = new Achievement[achievementsList.size()]; Achievement[] achievements = new Achievement[achievementsList.size()];
achievements = achievementsList.values().toArray(achievements); achievements = achievementsList.values().toArray(achievements);
achievementsPage = new AchievementPage( AchievementPage achievementsPage = new AchievementPage(
StatCollector.translateToLocal("draconicevolution.achievementPage.name"), StatCollector.translateToLocal("draconicevolution.achievementPage.name"),
achievements); achievements);
AchievementPage.registerAchievementPage(achievementsPage); AchievementPage.registerAchievementPage(achievementsPage);
@@ -458,7 +451,7 @@ public class Achievements {
stack.stackSize = 1; stack.stackSize = 1;
if (achievementItems.containsKey(stack.getUnlocalizedName()) if (achievementItems.containsKey(stack.getUnlocalizedName())
&& achievementItems.get(stack.getUnlocalizedName()).isCorrectCondition("pickup")) { && achievementItems.get(stack.getUnlocalizedName()).isCorrectCondition("pickup")) {
triggerAchievement(event.entityPlayer, achievementItems.get(stack.getUnlocalizedName()).getName()); triggerAchievement(event.entityPlayer, achievementItems.get(stack.getUnlocalizedName()).name);
} }
} }
@@ -468,7 +461,7 @@ public class Achievements {
stack.stackSize = 1; stack.stackSize = 1;
if (achievementItems.containsKey(stack.getUnlocalizedName()) if (achievementItems.containsKey(stack.getUnlocalizedName())
&& achievementItems.get(stack.getUnlocalizedName()).isCorrectCondition("craft")) { && achievementItems.get(stack.getUnlocalizedName()).isCorrectCondition("craft")) {
triggerAchievement(event.player, achievementItems.get(stack.getUnlocalizedName()).getName()); triggerAchievement(event.player, achievementItems.get(stack.getUnlocalizedName()).name);
} }
} }
@@ -478,13 +471,13 @@ public class Achievements {
stack.stackSize = 1; stack.stackSize = 1;
if (achievementItems.containsKey(stack.getUnlocalizedName()) if (achievementItems.containsKey(stack.getUnlocalizedName())
&& achievementItems.get(stack.getUnlocalizedName()).isCorrectCondition("smelt")) { && achievementItems.get(stack.getUnlocalizedName()).isCorrectCondition("smelt")) {
triggerAchievement(event.player, achievementItems.get(stack.getUnlocalizedName()).getName()); triggerAchievement(event.player, achievementItems.get(stack.getUnlocalizedName()).name);
} }
} }
private static class AchievementCondition { private static class AchievementCondition {
private final String name; public final String name;
public final String condition; public final String condition;
public AchievementCondition(String name, String condition) { public AchievementCondition(String name, String condition) {
@@ -495,9 +488,5 @@ public class Achievements {
public boolean isCorrectCondition(String s) { public boolean isCorrectCondition(String s) {
return s.equals(condition); return s.equals(condition);
} }
public String getName() {
return name;
}
} }
} }
@@ -1,105 +0,0 @@
package com.brandon3055.draconicevolution.common.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.gui.GuiHandler;
import com.brandon3055.draconicevolution.common.ModBlocks;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import com.brandon3055.draconicevolution.common.tileentities.TileContainerTemplate;
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Created by Brandon on 27/06/2014.
*/
public class BlockContainerTemplate extends BlockContainerDE {
public BlockContainerTemplate() {
super(Material.iron);
this.setBlockName(Strings.containerTemplateName);
this.setCreativeTab(DraconicEvolution.tabBlocksItems);
this.setStepSound(soundTypeStone);
this.setHardness(1f);
this.setResistance(200.0f);
ModBlocks.register(this);
}
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
blockIcon = iconRegister.registerIcon(References.RESOURCESPREFIX + "machine_side");
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return new TileContainerTemplate();
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float prx,
float pry, float prz) {
if (!world.isRemote) {
FMLNetworkHandler
.openGui(player, DraconicEvolution.instance, GuiHandler.GUIID_CONTAINER_TEMPLATE, world, x, y, z);
}
return true;
}
@SideOnly(Side.CLIENT)
@Override
public int getRenderType() {
return super.getRenderType();
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
TileEntity te = world.getTileEntity(x, y, z);
if (te != null && te instanceof IInventory) {
IInventory inventory = (IInventory) te;
for (int i = 0; i < inventory.getSizeInventory(); i++) {
ItemStack stack = inventory.getStackInSlot(i);
if (stack != null) {
float spawnX = x + world.rand.nextFloat();
float spawnY = y + world.rand.nextFloat();
float spawnZ = z + world.rand.nextFloat();
EntityItem droppedItem = new EntityItem(world, spawnX, spawnY, spawnZ, stack);
float multiplier = 0.05F;
droppedItem.motionX = (-0.5F + world.rand.nextFloat()) * multiplier;
droppedItem.motionY = (4 + world.rand.nextFloat()) * multiplier;
droppedItem.motionZ = (-0.5F + world.rand.nextFloat()) * multiplier;
world.spawnEntityInWorld(droppedItem);
}
}
}
super.breakBlock(world, x, y, z, block, meta);
}
}
@@ -10,7 +10,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
import com.brandon3055.brandonscore.common.utills.InventoryUtils; import com.brandon3055.draconicevolution.common.utils.InventoryUtils;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
/** /**
@@ -12,7 +12,6 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.ModBlocks;
import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.ModItems;
@@ -20,6 +19,7 @@ import com.brandon3055.draconicevolution.common.blocks.itemblocks.CKeyStoneItemB
import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.draconicevolution.common.lib.Strings;
import com.brandon3055.draconicevolution.common.tileentities.TileCKeyStone; import com.brandon3055.draconicevolution.common.tileentities.TileCKeyStone;
import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@@ -23,16 +23,16 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import com.brandon3055.brandonscore.common.utills.InfoHelper;
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.ModBlocks;
import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler; import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.draconicevolution.common.lib.Strings;
import com.brandon3055.draconicevolution.common.tileentities.TileCustomSpawner; import com.brandon3055.draconicevolution.common.tileentities.TileCustomSpawner;
import com.brandon3055.draconicevolution.common.utills.IHudDisplayBlock; import com.brandon3055.draconicevolution.common.utils.IHudDisplayBlock;
import com.brandon3055.draconicevolution.common.utills.LogHelper; import com.brandon3055.draconicevolution.common.utils.InfoHelper;
import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper;
import com.brandon3055.draconicevolution.common.utils.LogHelper;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@@ -35,7 +35,7 @@ import com.brandon3055.draconicevolution.common.blocks.itemblocks.DraconiumChest
import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.draconicevolution.common.lib.Strings;
import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest; import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest;
import com.brandon3055.draconicevolution.common.utills.ICustomItemData; import com.brandon3055.draconicevolution.common.utils.ICustomItemData;
import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
@@ -14,13 +14,13 @@ import net.minecraft.util.IIcon;
import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World; import net.minecraft.world.World;
import com.brandon3055.brandonscore.common.utills.Teleporter;
import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.ModBlocks;
import com.brandon3055.draconicevolution.common.items.tools.TeleporterMKI; import com.brandon3055.draconicevolution.common.items.tools.TeleporterMKI;
import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.draconicevolution.common.lib.Strings;
import com.brandon3055.draconicevolution.common.tileentities.TileTeleporterStand; import com.brandon3055.draconicevolution.common.tileentities.TileTeleporterStand;
import com.brandon3055.draconicevolution.common.utils.Teleporter;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@@ -11,7 +11,7 @@ import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest; import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest;
import com.brandon3055.draconicevolution.common.utills.ICustomItemData; import com.brandon3055.draconicevolution.common.utils.ICustomItemData;
/** /**
* Created by Brandon on 13/11/2014. * Created by Brandon on 13/11/2014.
@@ -94,18 +94,6 @@ public class DislocatorInhibitor extends BlockDE implements ITileEntityProvider
updateRedstoneStatus(world, x, y, z); updateRedstoneStatus(world, x, y, z);
} }
@Override
public void breakBlock(World worldIn, int x, int y, int z, Block blockBroken, int meta) {
TileEntity tile = worldIn.getTileEntity(x, y, z);
if (tile != null) {
if (tile instanceof TileDislocatorInhibitor) {
((TileDislocatorInhibitor) tile).unregister();
}
}
super.breakBlock(worldIn, x, y, z, blockBroken, meta);
}
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@Override @Override
public void registerBlockIcons(IIconRegister iconRegister) { public void registerBlockIcons(IIconRegister iconRegister) {
@@ -3,6 +3,7 @@ package com.brandon3055.draconicevolution.common.blocks.machine;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@@ -98,6 +99,22 @@ public class DissEnchanter extends BlockCustomDrop {
@Override @Override
protected void getCustomTileEntityDrops(TileEntity te, List<ItemStack> droppes) {} protected void getCustomTileEntityDrops(TileEntity te, List<ItemStack> droppes) {}
@Override
public void onNeighborBlockChange(World worldIn, int x, int y, int z, Block neighbor) {
boolean powered = worldIn.isBlockIndirectlyGettingPowered(x, y, z)
|| worldIn.isBlockIndirectlyGettingPowered(x, y - 1, z);
int meta = worldIn.getBlockMetadata(x, y, z);
boolean metaUnpowered = (meta & 8) == 0;
if (powered && metaUnpowered) {
if (worldIn.getTileEntity(x, y, z) instanceof TileDissEnchanter tde) tde.buttonClick(null);
worldIn.setBlockMetadataWithNotify(x, y, z, meta | 8, 4);
return;
}
if (powered || metaUnpowered) return;
worldIn.setBlockMetadataWithNotify(x, y, z, meta & -9, 4);
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, int x, int y, int z, Random rand) { public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
@@ -1,5 +1,8 @@
package com.brandon3055.draconicevolution.common.blocks.machine; package com.brandon3055.draconicevolution.common.blocks.machine;
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumberCompact;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -17,7 +20,6 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import com.brandon3055.brandonscore.common.utills.InfoHelper;
import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.ModBlocks;
import com.brandon3055.draconicevolution.common.blocks.BlockDE; import com.brandon3055.draconicevolution.common.blocks.BlockDE;
@@ -30,7 +32,8 @@ import com.brandon3055.draconicevolution.common.tileentities.energynet.TileEnerg
import com.brandon3055.draconicevolution.common.tileentities.energynet.TileEnergyTransceiver; import com.brandon3055.draconicevolution.common.tileentities.energynet.TileEnergyTransceiver;
import com.brandon3055.draconicevolution.common.tileentities.energynet.TileRemoteEnergyBase; import com.brandon3055.draconicevolution.common.tileentities.energynet.TileRemoteEnergyBase;
import com.brandon3055.draconicevolution.common.tileentities.energynet.TileWirelessEnergyTransceiver; import com.brandon3055.draconicevolution.common.tileentities.energynet.TileWirelessEnergyTransceiver;
import com.brandon3055.draconicevolution.common.utills.IHudDisplayBlock; import com.brandon3055.draconicevolution.common.utils.IHudDisplayBlock;
import com.brandon3055.draconicevolution.common.utils.InfoHelper;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@@ -40,13 +43,6 @@ import cpw.mods.fml.relauncher.SideOnly;
*/ */
public class EnergyCrystal extends BlockDE implements IHudDisplayBlock { public class EnergyCrystal extends BlockDE implements IHudDisplayBlock {
public static final byte RELAY_TIER_1 = 0;
public static final byte RELAY_TIER_2 = 1;
public static final byte TRANSCEIVER_TIER_1 = 2;
public static final byte TRANSCEIVER_TIER_2 = 3;
public static final byte WIRELESS_TRANSCEIVER_TIER_1 = 3;
public static final byte WIRELESS_TRANSCEIVER_TIER_2 = 4;
public EnergyCrystal() { public EnergyCrystal() {
super(Material.glass); super(Material.glass);
this.setBlockName(Strings.energyCrystalName); this.setBlockName(Strings.energyCrystalName);
@@ -232,8 +228,8 @@ public class EnergyCrystal extends BlockDE implements IHudDisplayBlock {
list.add( list.add(
InfoHelper.HITC() + StatCollector InfoHelper.HITC() + StatCollector
.translateToLocal(this.getUnlocalizedName() + world.getBlockMetadata(x, y, z) + ".name")); .translateToLocal(this.getUnlocalizedName() + world.getBlockMetadata(x, y, z) + ".name"));
list.add("RF: " + tile.getEnergyStored(ForgeDirection.DOWN)); list.add("RF: " + formatNumberCompact(tile.getEnergyStored(ForgeDirection.DOWN)));
list.add("Cap: " + tile.getCapacity() + "%"); list.add("Cap: " + formatNumber(tile.getCapacity()) + "%");
if (tile instanceof TileEnergyTransceiver) { if (tile instanceof TileEnergyTransceiver) {
String x5 = ((TileEnergyTransceiver) tile).getPowerTier() > 0 String x5 = ((TileEnergyTransceiver) tile).getPowerTier() > 0
&& ((TileEnergyTransceiver) tile).transferBoost && ((TileEnergyTransceiver) tile).transferBoost
@@ -247,16 +243,16 @@ public class EnergyCrystal extends BlockDE implements IHudDisplayBlock {
if (tile instanceof TileRemoteEnergyBase) { if (tile instanceof TileRemoteEnergyBase) {
list.add( list.add(
StatCollector.translateToLocal("info.de.connections.txt") + ": " StatCollector.translateToLocal("info.de.connections.txt") + ": "
+ ((TileRemoteEnergyBase) tile).linkedDevices.size() + formatNumber(((TileRemoteEnergyBase) tile).linkedDevices.size())
+ "/" + "/"
+ tile.getMaxConnections()); + formatNumber(tile.getMaxConnections()));
} }
if (tile instanceof TileWirelessEnergyTransceiver) { if (tile instanceof TileWirelessEnergyTransceiver) {
list.add( list.add(
StatCollector.translateToLocal("info.de.wirelessConnections.txt") + ": " StatCollector.translateToLocal("info.de.wirelessConnections.txt") + ": "
+ ((TileWirelessEnergyTransceiver) tile).receiverList.size() + formatNumber(((TileWirelessEnergyTransceiver) tile).receiverList.size())
+ "/" + "/"
+ ((TileWirelessEnergyTransceiver) tile).getmaxWirelessConnections()); + formatNumber(((TileWirelessEnergyTransceiver) tile).getmaxWirelessConnections()));
} }
if (tile instanceof TileRemoteEnergyBase) { if (tile instanceof TileRemoteEnergyBase) {
@@ -17,7 +17,6 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import com.brandon3055.brandonscore.common.utills.Utills;
import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.gui.GuiHandler; import com.brandon3055.draconicevolution.client.gui.GuiHandler;
import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.ModBlocks;
@@ -28,6 +27,7 @@ import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.tileentities.gates.TileFluidGate; import com.brandon3055.draconicevolution.common.tileentities.gates.TileFluidGate;
import com.brandon3055.draconicevolution.common.tileentities.gates.TileFluxGate; import com.brandon3055.draconicevolution.common.tileentities.gates.TileFluxGate;
import com.brandon3055.draconicevolution.common.tileentities.gates.TileGate; import com.brandon3055.draconicevolution.common.tileentities.gates.TileGate;
import com.brandon3055.draconicevolution.common.utils.Utils;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@@ -174,7 +174,7 @@ public class FlowGate extends BlockDE {
((TileGate) worldObj.getTileEntity(x, y, z)).output = facing; ((TileGate) worldObj.getTileEntity(x, y, z)).output = facing;
worldObj.setBlockMetadataWithNotify(x, y, z, facing.ordinal() + (type * 6), 2); worldObj.setBlockMetadataWithNotify(x, y, z, facing.ordinal() + (type * 6), 2);
Utills.updateNeabourBlocks(worldObj, x, y, z); Utils.updateNeabourBlocks(worldObj, x, y, z);
return true; return true;
} }
@@ -26,7 +26,7 @@ import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.draconicevolution.common.lib.Strings;
import com.brandon3055.draconicevolution.common.tileentities.TileGenerator; import com.brandon3055.draconicevolution.common.tileentities.TileGenerator;
import com.brandon3055.draconicevolution.common.tileentities.TileGrinder; import com.brandon3055.draconicevolution.common.tileentities.TileGrinder;
import com.brandon3055.draconicevolution.common.utills.LogHelper; import com.brandon3055.draconicevolution.common.utils.LogHelper;
import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
@@ -23,7 +23,7 @@ import com.brandon3055.draconicevolution.common.blocks.itemblocks.LRDItemBlock;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler; import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.draconicevolution.common.lib.Strings;
import com.brandon3055.draconicevolution.common.utills.LogHelper; import com.brandon3055.draconicevolution.common.utils.LogHelper;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@@ -21,8 +21,8 @@ import com.brandon3055.draconicevolution.common.blocks.BlockDE;
import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.draconicevolution.common.lib.Strings;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyStorageCore; import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyStorageCore;
import com.brandon3055.draconicevolution.common.utills.IHudDisplayBlock; import com.brandon3055.draconicevolution.common.utils.IHudDisplayBlock;
import com.brandon3055.draconicevolution.common.utills.LogHelper; import com.brandon3055.draconicevolution.common.utils.LogHelper;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@@ -26,8 +26,8 @@ import com.brandon3055.draconicevolution.common.lib.Strings;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyPylon; import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyPylon;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyStorageCore; import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyStorageCore;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileInvisibleMultiblock; import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileInvisibleMultiblock;
import com.brandon3055.draconicevolution.common.utills.IHudDisplayBlock; import com.brandon3055.draconicevolution.common.utils.IHudDisplayBlock;
import com.brandon3055.draconicevolution.common.utills.LogHelper; import com.brandon3055.draconicevolution.common.utils.LogHelper;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@@ -12,12 +12,12 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import com.brandon3055.brandonscore.common.utills.Utills;
import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.ModBlocks;
import com.brandon3055.draconicevolution.common.blocks.BlockDE; import com.brandon3055.draconicevolution.common.blocks.BlockDE;
import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorEnergyInjector; import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorEnergyInjector;
import com.brandon3055.draconicevolution.common.utils.Utils;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@@ -83,7 +83,7 @@ public class ReactorEnergyInjector extends BlockDE implements ITileEntityProvide
@Override @Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) { public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) {
ForgeDirection facing = ForgeDirection.getOrientation(Utills.determineOrientation(x, y, z, entity)); ForgeDirection facing = ForgeDirection.getOrientation(Utils.determineOrientation(x, y, z, entity));
TileEntity tile = world.getTileEntity(x, y, z); TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileReactorEnergyInjector injector) { if (tile instanceof TileReactorEnergyInjector injector) {
injector.facing = entity.isSneaking() ? facing.getOpposite() : facing; injector.facing = entity.isSneaking() ? facing.getOpposite() : facing;
@@ -11,13 +11,13 @@ import net.minecraft.util.ChatComponentText;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import com.brandon3055.brandonscore.common.utills.Utills;
import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.ModBlocks;
import com.brandon3055.draconicevolution.common.blocks.BlockDE; import com.brandon3055.draconicevolution.common.blocks.BlockDE;
import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore; import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorStabilizer; import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorStabilizer;
import com.brandon3055.draconicevolution.common.utils.Utils;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@@ -86,7 +86,7 @@ public class ReactorStabilizer extends BlockDE implements ITileEntityProvider {
@Override @Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) { public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) {
ForgeDirection facing = ForgeDirection.getOrientation(Utills.determineOrientation(x, y, z, entity)); ForgeDirection facing = ForgeDirection.getOrientation(Utils.determineOrientation(x, y, z, entity));
TileEntity tile = world.getTileEntity(x, y, z); TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileReactorStabilizer stabilizer) { if (tile instanceof TileReactorStabilizer stabilizer) {
stabilizer.facing = entity.isSneaking() ? facing.getOpposite() : facing; stabilizer.facing = entity.isSneaking() ? facing.getOpposite() : facing;
@@ -15,7 +15,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagList;
import com.brandon3055.draconicevolution.common.inventory.InventoryTool; import com.brandon3055.draconicevolution.common.inventory.InventoryTool;
import com.brandon3055.draconicevolution.common.utills.IInventoryTool; import com.brandon3055.draconicevolution.common.utils.IInventoryTool;
/** /**
* Created by Brandon on 13/01/2015. * Created by Brandon on 13/01/2015.
@@ -9,9 +9,9 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.common.inventory.SlotOutput; import com.brandon3055.draconicevolution.common.inventory.SlotOutput;
import com.brandon3055.draconicevolution.common.tileentities.TileDissEnchanter; import com.brandon3055.draconicevolution.common.tileentities.TileDissEnchanter;
import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper;
import com.brandon3055.draconicevolution.integration.ModHelper; import com.brandon3055.draconicevolution.integration.ModHelper;
public class ContainerDissEnchanter extends Container { public class ContainerDissEnchanter extends Container {
@@ -14,7 +14,7 @@ import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.inventory.GenericInventory; import com.brandon3055.draconicevolution.common.inventory.GenericInventory;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore; import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore.ReactorState; import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore.ReactorState;
import com.brandon3055.draconicevolution.common.utills.OreDictionaryHelper; import com.brandon3055.draconicevolution.common.utils.OreDictionaryHelper;
/** /**
* Created by brandon3055 on 30/7/2015. * Created by brandon3055 on 30/7/2015.
Loaded 100 of 486 files, more files were not shown because too many files have changed in this diff. Show more