Compare commits

...
110 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
StaffiXandgithub-actions[bot] 62e5e74f95 Update fuel usage config comment (#84)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-12-16 09:17:25 -06:00
Alexdoru 1517f9fdfb delete useless event registration (#82) 2025-12-11 06:58:18 +01:00
Alexdoru b433ac3c44 add missing enum switch case in ModHelper#getHazmatArmorConfigKey (#81) 2025-11-18 23:34:18 +00:00
0937d7b2d6 Changes for the ore refactor PR (#76)
Co-authored-by: Martin Robertz <dream-master@gmx.net>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-10-12 13:05:36 +00:00
Martin Robertz 99c3fb0b74 update 2025-10-01 19:18:44 +02:00
Martin Robertz 04c781df16 update 2025-09-20 16:11:05 +02:00
Worive 7fb5b8d3c7 fix(MiningTool): add support for silk touch enchantment (#78) 2025-09-19 06:56:52 +02:00
Martin Robertz 8fc59e271e update 2025-09-07 19:36:58 +02:00
Caedis 1ca5aff7d9 Block certain GT materials from being disenchanted (#77) 2025-09-07 14:11:33 -03:00
Martin Robertz 0e4101e4e5 update 2025-09-07 12:52:56 +02:00
Dream Master c21e389db2 update 2025-07-17 22:13:21 +07:00
Dream Master 499dca4a7b update 2025-07-17 22:12:49 +07:00
koolkrafter5 dd9d3146ec Replace CodeChickenLore dep (#75) 2025-07-16 23:35:59 +02:00
Martin Robertz 6bb77d71b9 update 2025-06-21 00:56:55 +02:00
1515ce27d1 Magnet attracts only if closest player, and toggleable self-drop pickup with Hodgepodge loaded (#70)
Co-authored-by: koolkrafter5 <creepersrgreen@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Alexdoru <57050655+Alexdoru@users.noreply.github.com>
2025-06-12 08:33:25 +02:00
Alexdoruandgithub-actions[bot] bc7929de29 Magnet improvements (#72)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-06-10 13:50:56 +02:00
Maya c8dcdce141 update 2025-05-26 09:42:16 -06:00
95a25957d4 Inhibitor improvements (#64)
Co-authored-by: Shadow1590 <>
Co-authored-by: Maya <10861407+serenibyss@users.noreply.github.com>
Co-authored-by: boubou19 <miisterunknown@gmail.com>
2025-05-26 09:41:12 -06:00
Martin Robertz d7d6c4e0c0 update 2025-05-12 09:23:53 +02:00
b0bc154516 Add more Draconic Reactor configuration, and allow fuel automation (#61)
Co-authored-by: Martin Robertz <dream-master@gmx.net>
Co-authored-by: Maya <10861407+serenibyss@users.noreply.github.com>
Co-authored-by: boubou19 <miisterunknown@gmail.com>
2025-05-11 20:14:29 +02:00
Martin Robertz 333fb4e274 update 2025-04-25 13:40:29 +02:00
__felix__and__felix__ 5e504c7c10 Fix gregtech loader checks, and change Optional hazmat decorators to check if gtnh's gt5 is loaded (#68)
Co-authored-by: __felix__ <134875831+48a3efa65c881ef567345b17f3910e06@users.noreply.github.com>
2025-04-24 19:16:11 +02:00
__felix__ b7bf08a178 Fix GT6 compat (runtime-only for now)
Actual fix for the optional compile-time interface will follow after resolving that whole discussion
2025-04-22 02:04:14 +02:00
Maya a671627f0b update 2025-04-21 03:24:16 -05:00
__felix__andMaya 40c064b8c7 add config options to weighting ore gen (#67)
Co-authored-by: Maya <10861407+serenibyss@users.noreply.github.com>
2025-04-21 08:24:07 +00:00
Maya 8e9e1e98d7 update 2025-04-09 00:26:02 -05:00
Niclas Klugmann a755869dbd Move Draconic/Wyvern armor to new GT Hazard API (#65) 2025-04-09 00:24:41 -05:00
Niclas Klugmann 0f3e15ce25 nicer German translations (#66) 2025-04-06 17:29:07 +02:00
Maya 18cda6a4ee update 2025-03-08 14:28:23 -06:00
YamiKami_Sama 565fc72d24 Fix OpenComputers component not properly loaded for Particle Generator (and probably other components) (#63) 2025-03-08 14:28:07 -06:00
Maya e039519acf update 2025-01-22 18:58:37 -06:00
Shadow1590 bf5f0bcb5b Add Dislocator Inhibitor (#60) 2025-01-22 18:56:34 -06:00
Martin Robertz 7bca3009b6 update 2025-01-17 12:10:15 +01:00
Ruling-0 f7cac98ad5 Fix Magnet pulling fake item entities (#59) 2025-01-17 00:08:37 -06:00
Dream Master 07ed88515e update 2025-01-15 12:29:22 +01:00
Kogepan229andMartin Robertz 46e5d8a785 More configurable Magnet (#57)
Co-authored-by: Martin Robertz <dream-master@gmx.net>
2025-01-13 07:08:24 +00:00
Martin Robertz 2835b7a54e update 2024-12-31 14:46:23 +01:00
glowredman 2331e33ebb Add Localizations (#58) 2024-12-30 17:42:21 -06:00
Martin Robertz 1fa9420ec2 update 2024-12-27 10:07:48 +01:00
Wilhelm SchusterandMartin Robertz ee65279d0b Broaden support for mouse button keybinds (#56)
Co-authored-by: Martin Robertz <dream-master@gmx.net>
2024-12-26 21:35:47 -06:00
Martin Robertz 8efee8630a update 2024-11-22 21:34:10 +01:00
Martin Robertz 740ceb9857 update 2024-10-25 16:06:36 +02:00
Alexdoru 041fefe81a remove bugged PlacedItem tile entities properly (#55) 2024-10-24 20:09:15 +02:00
Martin Robertz d829c2f95f update 2024-10-21 21:52:23 +02:00
Alexdoru 101a1d46a8 prevent creating a placed item tile entity if the associated item is null (#54) 2024-10-21 21:21:41 +02:00
Martin Robertz ab82b92ae2 update 2024-10-02 15:00:00 +02:00
Martin Robertz 7e69b4b728 Update dependencies.gradle 2024-10-02 06:40:34 +02:00
Alexdoru 69115e24dc Update baubles dep to the baubles extended mod (#53)
* move the Loader.ismoloaded call out of the References class to avoid class loading issues if that class is referenced too early

* update baubles dep to the new baubles mod
2024-10-01 21:34:47 +02:00
Martin Robertz 3e062858c8 update 2024-09-10 17:24:06 +02:00
Alexdoru ea03519563 rename GT reflected classes (#52) 2024-09-09 02:20:31 +02:00
Martin Robertz 9a0231257c update 2024-09-01 22:38:13 +02:00
Caedis 0b4a807bea Remove RenderHelper.disableStandardItemLighting() from RenderParticleGen (#51) 2024-09-01 16:17:02 +02:00
Dream Master 9780cd92b4 update
(cherry picked from commit 24166293d6)
2024-08-28 22:49:48 +02:00
Fabboz 8e8a3b2f64 Render Placed Item Fix (#50) 2024-08-27 18:34:40 +02:00
Dream Master 7691b37d60 update 2024-07-08 13:17:59 +07:00
meonester f0d331970f Magnet client-server desync fix. (#49)
While toggling magnet - item stack wasn't effectively updated in MagnetToggleAckPacket.Handler (only copy - i assume needed for GUI notification purpose - was synced with current state).
2024-07-06 12:57:11 +07:00
Martin Robertz 41b0e600fa update 2024-04-28 12:45:47 +02:00
Raven Szewczyk 8858c596fd Add a dimension whitelist setting for draconic ore (#48)
* Add a dimension whitelist setting for draconic ore

* Fix typo
2024-04-28 12:44:52 +02:00
Martin Robertz 6c48064031 update 2024-04-13 12:56:07 +02:00
NealDeal34 0bf760cca3 redirect the source URL to load images normally (#46) 2024-04-13 12:46:48 +02:00
Martin Robertz 76406d2d78 update 2024-03-23 12:21:47 +01:00
Quetz4l d71e388119 Item Dislocators will work from baubles slots (#47)
* Item Dislocators will work from baubles slots

* fix typo

* optional baubles
2024-03-23 10:53:14 +01:00
Martin Robertz 5252678a45 update 2024-02-18 12:57:44 +01:00
ghostflyby c4a653f187 Fix wrong encode in manual translation in manual-zh_CN.json (#45)
* Fix wrong encode in manual translation in manual-zh_CN.json
* Update manual-zh_CN.json
2024-02-18 19:43:24 +08:00
Raven Szewczyk 04cf0c0239 [ci skip] upgraded build system 2024-02-04 19:58:04 +00:00
Martin Robertz 565de0de03 update bs+deps 2024-01-28 21:40:45 +01:00
kamenskyi cac90210c3 Update manual-ru_RU.json (#44)
* Update manual-ru_RU.json

add ru manual lang file

* Update manual-ru_RU.json

fix ru mistakes
2024-01-28 21:37:22 +01:00
Martin Robertz c0a58239a5 update deps+bs 2024-01-12 00:18:23 +01:00
Raven Szewczyk a534ca2432 [ci skip] upgraded build system 2024-01-08 21:25:11 +00:00
Martin Robertz c7e5643fcd update gradle + deps + bs 2023-12-23 23:55:28 +01:00
kamenskyi 1d54fb5779 Update ru_RU.lang (#43)
* Update ru_RU.lang

add ru lang file

* Update ru_RU.lang

fix mistakes
2023-12-23 22:54:17 +01:00
Martin Robertz b2bc93ec18 update bs+deps 2023-11-11 12:13:39 +01:00
Pelotrio 2aad40ebe0 Make randomEntity a local field to prevent leaking the world also minor refactor 2023-11-10 18:12:41 -08:00
Martin Robertz 398786a179 sa+celanup wci 2023-10-24 13:03:11 +02:00
Martin Robertz 1ed0354744 update bs+deps+gradle 2023-10-24 12:43:56 +02:00
Spacebuilder2020 17c352895c Add Missing helper methods... 2023-10-23 19:52:21 -07:00
Spacebuilder2020 65490f6c83 Attempt to fix build error by copying updated gradle script from https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/master/build.gradle#L629 2023-10-23 19:52:21 -07:00
Spacebuilder2020 0da29db9be Replace all references of blockType with getBlockType to fix NPE downstream 2023-10-23 19:52:21 -07:00
miozune f54c69738e Minor cleanup (#40)
* Remove WorldGenChaosIsland

* Update dependencies to use NH variant of BrandonsCore

* Remove update checker
2023-06-15 22:46:41 +02:00
Alexander Anishin adf73c81f4 Code cleanup (#39)
* Updated build script and dependencies

* Optimized Energy Pylon

* Changed names of few variables

* Started optimizing Energy Storage Core

* Optimized Invisible Multiblock

* Fixed Energy Pylon state update logic

* Round 2 of Energy Storage Core optimization

* Finished optimization of Energy Storage Core

* Cleared method from duplicate code

* Cleaned up Particle Generator code

* Optimized Dislocator Receptacle

* Cleaned up Portal code

* Cleaned up code of PortalHelper

* Changed Reactor Part interface

* Optimized Reactor Energy Injector

* Optimized Reactor Stabilizer

* Stage 1 of Reactor Core refactoring

* Cleaned up Reactor Container code

Fixed bug that allowed to dupe awakened draconium and chaos shards

* Cleaned up Reactor GUI code

* Removed unnecessary checks in GUI Handler

* Removed unnecessary revalidation of reactor structure

* Migrate Reactor Energy Injector to Forge Direction

* Migrate Reactor Stabilizer to Forge Direction

* Introduced Comparator Mode enumeration

* Migrated Reactor Energy Injector and Stabilizer to use ComparatorMode

* Migrated Reactor Core to use ReactorState enumeration

* Clean up Particle Reactor Beam

* Remove stale todo lists

* Renamed several member for clarity

* Cleaned code of Energy Pylon render

* Cleaned up code of Player Detector

* Cleaned up code of Advanced Player Detector

* Cleaned up GUI and Container of Advanced Player Detector

* Removed unnecessary block update

* Removed unnecessary block updates from Creative Keystone and other blocks

* Changed naming style of fields of Particle Generator to camel case

* Cleaned up code of Particle Generator GUI

* Updated build script

* Implemented missing interface for Tile Entity providers

* Fixed range of property of Particle Generator

* Addressed pull request issues

* Added missing localization items for Particle Generator

* And this one too

* Updated switch statements to use new syntax
2023-06-15 19:09:42 +02:00
Martin Robertz 276b17fc9d update dep 2023-05-08 18:23:44 +02:00
Martin Robertz 7ab6b187c1 update bs+sa 2023-05-08 18:22:07 +02:00
LewisSaber e96dc8d558 Consume 64 ender pearls at once (#36)
* Consume 64 ender pearls at once

* Blue Da Ba Dee
2023-02-23 19:31:27 +01:00
Alexdoru 7286d30c26 stop registering recipes if Dreamcraft is present (#35) 2023-02-21 13:18:05 +00:00
553 changed files with 15571 additions and 11967 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
+1
View File
@@ -29,3 +29,4 @@ src/main/resources/mixins.*.json
*.bat
*.DS_Store
!gradlew.bat
layout.json
+2 -1259
View File
File diff suppressed because it is too large. Load diff
+17 -25
View File
@@ -1,31 +1,23 @@
// Add your dependencies here
dependencies {
compile("curse.maven:brandons-core-231382:2297163")
api("curse.maven:cofh-lib-220333:2388748")
api("com.github.GTNewHorizons:GTNHLib:0.9.53:dev")
compileOnly("com.github.GTNewHorizons:ForestryMC:4.4.5:api") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:OpenComputers:1.7.5.20-GTNH:api") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:NotEnoughItems:2.2.3-GTNH:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:CodeChickenLib:1.1.5.1:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:inventory-tweaks:1.5.13:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:ForestryMC:4.11.14:api") {transitive = false}
compileOnly("com.github.GTNewHorizons:OpenComputers:1.12.38-GTNH:api") {transitive = false}
compileOnly("com.github.GTNewHorizons:NotEnoughItems:2.8.93-GTNH: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:Baubles-Expanded:2.2.11-GTNH:dev') {transitive = false}
compileOnly("com.github.GTNewHorizons:Botania:1.13.36-GTNH: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("curse.maven:computercraft-67504:2269339") {
transitive = false
}
compileOnly("curse.maven:cofh-lib-220333:2388748") {
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:automagy-222153:2285272')
compileOnly('com.github.GTNewHorizons:EnderIO:2.10.25:dev')
runtimeOnly("com.github.GTNewHorizons:NotEnoughItems:2.8.118-GTNH:dev")
}
+204 -25
View File
@@ -1,64 +1,243 @@
# ExampleMod tag to use as Blowdryer (Spotless, etc.) settings version, leave empty to disable.
# LOCAL to test local config updates.
gtnh.settings.blowdryerTag = 0.2.0
# Human-readable mod name, available for mcmod.info population.
modName = Draconic Evolution
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
# Case-sensitive identifier string, available for mcmod.info population and used for automatic mixin JSON generation.
# Conventionally lowercase.
modId = DraconicEvolution
# Root package of the mod, used to find various classes in other properties,
# mcmod.info substitution, enabling assertions in run tasks, etc.
modGroup = com.brandon3055.draconicevolution
# WHY is there no version field?
# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the
# code base or your binary. Check out this tutorial: https://blog.mattclemente.com/2017/10/13/versioning-with-git-tags/
# Whether to use modGroup as the maven publishing group.
# When false, com.github.GTNewHorizons is used.
useModGroupForPublishing = false
# Will update your build.gradle automatically whenever an update is available
# Updates your build.gradle and settings.gradle automatically whenever an update is available.
autoUpdateBuildScript = false
# Version of Minecraft to target
minecraftVersion = 1.7.10
# Version of Minecraft Forge to target
forgeVersion = 10.13.4.1614
# Select a username for testing your mod with breakpoints. You may leave this empty for a random username each time you
# restart Minecraft in development. Choose this dependent on your mod:
# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name
# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty
# Specify an MCP channel for dependency deobfuscation and the deobfParams task.
channel = stable
# Specify an MCP mappings version for dependency deobfuscation and the deobfParams task.
mappingsVersion = 12
# Defines other MCP mappings for dependency deobfuscation.
remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
# Select a default username for testing your mod. You can always override this per-run by running
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
developmentEnvironmentUserName = Developer
# Define a source file of your project with:
# Enables modern Java syntax support. Valid values:
# - false: No modern syntax, Java 8 only
# - 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.
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
enableGenericInjection = false
# Generate a class with a String field for the mod version named as defined below.
# If generateGradleTokenClass is empty or not missing, no such class will be generated.
# If gradleTokenVersion is empty or missing, the field will not be present in the class.
generateGradleTokenClass = com.brandon3055.draconicevolution.DETags
# Name of the token containing the project's current version to generate/replace.
gradleTokenVersion = VERSION
# [DEPRECATED] Mod ID replacement token.
gradleTokenModId =
# [DEPRECATED] Mod name replacement token.
gradleTokenModName =
# [DEPRECATED] Mod Group replacement token.
gradleTokenGroupName =
# [DEPRECATED]
# Multiple source files can be defined here by providing a comma-separated list: Class1.java,Class2.java,Class3.java
# public static final String VERSION = "GRADLETOKEN_VERSION";
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
# version in @Mod([...], version = VERSION, [...])
# Leave these properties empty to skip individual token replacements
replaceGradleTokenInFile = VersionHandler.java
gradleTokenModId =
gradleTokenModName =
gradleTokenVersion = GRADLETOKEN_VERSION
gradleTokenGroupName =
# version in @Mod([...], version = VERSION, [...]).
# Leave these properties empty to skip individual token replacements.
replaceGradleTokenInFile =
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
# leave this property empty.
# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
# Example value: (apiPackage = api) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.api
apiPackage = api
# Specify the configuration file for Forge's access transformers here. I must be placed into /src/main/resources/META-INF/
# Example value: mymodid_at.cfg
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/
# There can be multiple files in a space-separated list.
# Example value: mymodid_at.cfg nei_at.cfg
accessTransformersFile =
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
usesMixins = false
# Set to a non-empty string to configure mixins in a separate source set under src/VALUE, instead of src/main.
# This can speed up compile times thanks to not running the mixin annotation processor on all input sources.
# Mixin classes will have access to "main" classes, but not the other way around.
separateMixinSourceSet =
# Adds some debug arguments like verbose output and class export.
usesMixinDebug = false
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
mixinPlugin =
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
# Specify the package that contains all of your Mixins. The package must exist or
# the build will fail. If you have a package property defined in your mixins.<modid>.json,
# it must match with this or the build will fail.
mixinsPackage =
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
# This parameter is for legacy compatibility only
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
# Example value: (coreModClass = asm.FMLPlugin) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.asm.FMLPlugin
coreModClass =
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
containsMixinsAndOrCoreModOnly = false
# If enabled, you may use 'shadowImplementation' for dependencies. They will be integrated in your jar. It is your
# responsibility check the licence and request permission for distribution, if required.
# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins.
forceEnableMixins = false
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated into your jar. It is your
# responsibility to check the license and request permission for distribution if required.
usesShadowedDependencies = false
# Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older
# If disabled, won't remove unused classes from shadowed dependencies. Some libraries use reflection to access
# their own classes, making the minimization unreliable.
minimizeShadowedDependencies = true
# If disabled, won't rename the shadowed classes.
relocateShadowedDependencies = true
# Adds CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
includeWellKnownRepositories = true
# A list of repositories to exclude from the includeWellKnownRepositories setting. Should be a space separated
# list of strings, with the acceptable keys being(case does not matter):
# cursemaven
# modrinth
excludeWellKnownRepositories =
# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.
# Authenticate with the MAVEN_USER and MAVEN_PASSWORD environment variables.
# If you need a more complex setup disable maven publishing here and add a publishing repository to addon.gradle.
usesMavenPublishing = true
# Maven repository to publish the mod to.
# mavenPublishUrl = https\://nexus.gtnewhorizons.com/repository/releases/
# Publishing to Modrinth requires you to set the MODRINTH_TOKEN environment variable to your current Modrinth API token.
#
# The project's ID on Modrinth. Can be either the slug or the ID.
# Leave this empty if you don't want to publish to Modrinth.
modrinthProjectId =
# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth.
# Syntax: scope1-type1:name1;scope2-type2:name2;...
# Where scope can be one of [required, optional, incompatible, embedded],
# type can be one of [project, version],
# and the name is the Modrinth project or version slug/id of the other mod.
# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
modrinthRelations =
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
#
# The project's numeric ID on CurseForge. You can find this in the About Project box.
# Leave this empty if you don't want to publish on CurseForge.
curseForgeProjectId =
# 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.
# Syntax: type1:name1;type2:name2;...
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
# and the name is the CurseForge project slug of the other mod.
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
curseForgeRelations =
# Optional parameter to customize the produced artifacts. Use this to preserve artifact naming when migrating older
# projects. New projects should not use this parameter.
customArchiveBaseName = Draconic-Evolution
# Optional parameter to customize the default working directory used by the runClient* tasks. Relative to the project directory.
# runClientWorkingDirectory = run/client
# Optional parameter to customize the default working directory used by the runServer* tasks. Relative to the project directory.
# runServerWorkingDirectory = run/server
# Optional parameter to have the build automatically fail if an illegal version is used.
# This can be useful if you e.g. only want to allow versions in the form of '1.1.xxx'.
# The check is ONLY performed if the version is a git tag.
# Note: the specified string must be escaped, so e.g. 1\\.1\\.\\d+ instead of 1\.1\.\d+
# versionPattern =
# Uncomment to prevent the source code from being published.
# noPublishedSources = true
# Uncomment this to disable Spotless checks.
# This should only be uncommented to keep it easier to sync with upstream/other forks.
# That is, if there is no other active fork/upstream, NEVER change this.
# disableSpotless = true
# Uncomment this to disable Checkstyle checks (currently wildcard import check).
# disableCheckstyle = true
# Override the IDEA build type. Valid values are: "" (leave blank, do not override), "idea" (force use native IDEA build), "gradle"
# (force use delegated build).
# This is meant to be set in $HOME/.gradle/gradle.properties.
# e.g. add "systemProp.org.gradle.project.ideaOverrideBuildType=idea" will override the build type to be native build.
# WARNING: If you do use this option, it will overwrite whatever you have in your existing projects. This might not be what you want!
# Usually there is no need to uncomment this here as other developers do not necessarily use the same build type as you.
# ideaOverrideBuildType = idea
# Whether IDEA should run spotless checks when pressing the Build button.
# This is meant to be set in $HOME/.gradle/gradle.properties.
# 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.
+2 -1
View File
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Vendored
+22 -18
View File
@@ -1,7 +1,7 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
# Copyright © 2015 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
@@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/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.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -83,10 +85,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@@ -114,7 +114,6 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
@@ -133,10 +132,13 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
@@ -144,7 +146,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
@@ -152,7 +154,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@@ -169,7 +171,6 @@ fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
@@ -197,16 +198,19 @@ if "$cygwin" || "$msys" ; then
done
fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
# Stop when "xargs" is not available.
Vendored
+13 -12
View File
@@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
@@ -57,22 +59,21 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@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
@rem End local scope for the variables with windows NT shell
-10
View File
@@ -1,14 +1,4 @@
// Add any additional repositories for your dependencies here
repositories {
maven {
name = "GTNH Maven"
url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
}
maven {
url "https://cursemaven.com"
}
maven {
url = "https://jitpack.io"
}
}
+5 -10
View File
@@ -4,10 +4,10 @@ pluginManagement {
maven {
// RetroFuturaGradle
name "GTNH Maven"
url "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
allowInsecureProtocol = true
url "https://nexus.gtnewhorizons.com/repository/public/"
mavenContent {
includeGroup("com.gtnewhorizons.retrofuturagradle")
includeGroup("com.gtnewhorizons")
includeGroupByRegex("com\\.gtnewhorizons\\..+")
}
}
gradlePluginPortal()
@@ -17,12 +17,7 @@ pluginManagement {
}
plugins {
id 'com.diffplug.blowdryerSetup' version '1.6.0'
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0' // Provides java toolchains
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.34'
}
blowdryerSetup {
repoSubfolder 'gtnhShared'
github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.2.0')
//devLocal '.' // Use this when testing config updates locally
}
@@ -3,18 +3,21 @@ package com.brandon3055.draconicevolution;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.enchantment.Enchantment;
import com.brandon3055.draconicevolution.client.ClientProxy;
import com.brandon3055.draconicevolution.client.creativetab.DETab;
import com.brandon3055.draconicevolution.common.CommonProxy;
import com.brandon3055.draconicevolution.common.lib.OreDoublingRegistry;
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.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStoppedEvent;
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
@Mod(
@@ -25,13 +28,14 @@ import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
guiFactory = References.GUIFACTORY,
dependencies = "after:NotEnoughItems;" + "after:ThermalExpansion;"
+ "after:ThermalFoundation;"
+ "required-after:BrandonsCore@[1.0.0.11,);")
+ "required-after:gtnhlib@[0.9.47,);")
public class DraconicEvolution {
@Mod.Instance(References.MODID)
public static DraconicEvolution instance;
@SidedProxy(clientSide = References.CLIENTPROXYLOCATION, serverSide = References.SERVERPROXYLOCATION)
@SidedProxy(
clientSide = "com.brandon3055.draconicevolution.client.ClientProxy",
serverSide = "com.brandon3055.draconicevolution.common.CommonProxy")
public static CommonProxy proxy;
public static CreativeTabs tabToolsWeapons = new DETab(
@@ -52,22 +56,23 @@ public class DraconicEvolution {
public static Enchantment reaperEnchant;
public static final boolean isAutomagyLoaded = Loader.isModLoaded("Automagy");
public static final boolean isEioLoaded = Loader.isModLoaded("EnderIO");
public DraconicEvolution() {
LogHelper.info("Hello Minecraft!!!");
}
public static ClientProxy clientProxy() {
if (proxy.isClient()) {
return ((ClientProxy) proxy);
}
throw new IllegalStateException("Accessed ClientProxy from dedicated server");
}
@Mod.EventHandler
public static void preInit(final FMLPreInitializationEvent event) {
if (debug) LogHelper.info("Initialization");
// event.getModMetadata().autogenerated = false;
// event.getModMetadata().credits = "";
// event.getModMetadata().description = "This is a mod originally made for the Tolkiencraft mod pack";
// event.getModMetadata().authorList = Arrays.asList("brandon3055");
// event.getModMetadata().logoFile = "banner.png";
// event.getModMetadata().url = "http://www.brandon3055.com/";
// event.getModMetadata().version = References.VERSION + "-MC1.7.10";
proxy.preInit(event);
}
@@ -75,20 +80,20 @@ public class DraconicEvolution {
public void init(final FMLInitializationEvent event) {
if (debug) System.out.println("init()");
proxy.init(event);
// ===
// ===
}
@Mod.EventHandler
public void postInit(final FMLPostInitializationEvent event) {
if (debug) System.out.println("postInit()");
proxy.postInit(event);
}
// FMLInterModComms.sendMessage("DraconicEvolution", "addChestRecipe:item.coal", new ItemStack(Items.diamond, 2));
@Mod.EventHandler
public void onServerStopped(final FMLServerStoppedEvent event) {
if (debug) System.out.println("onServerStopped()");
proxy.onServerStopped(event);
}
@Mod.EventHandler
public void processMessage(FMLInterModComms.IMCEvent event) {
for (FMLInterModComms.IMCMessage m : event.getMessages()) {
@@ -2,9 +2,13 @@ package com.brandon3055.draconicevolution.api;
import java.util.Random;
import javax.annotation.Nullable;
import net.minecraft.util.ChunkCoordinates;
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.DraconicWorldGenerator;
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,
Random random) {
ChaosWorldGenHandler.generateChunk(
world,
chunkX,
chunkZ,
new DataUtills.XZPair<Integer, Integer>(centerX, centerZ),
random);
ChaosWorldGenHandler
.generateChunk(world, chunkX, chunkZ, new DataUtils.XZPair<Integer, Integer>(centerX, centerZ), random);
}
/**
@@ -71,4 +71,25 @@ public class GeneratorOverride {
public static void setOreEnabledInEnd(boolean 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);
}
}
@@ -1,37 +1,100 @@
package com.brandon3055.draconicevolution.client;
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.audio.ISound;
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.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.world.WorldEvent;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.handler.ClientEventHandler;
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.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.render.IRenderTweak;
import com.brandon3055.draconicevolution.client.render.block.*;
import com.brandon3055.draconicevolution.client.render.entity.*;
import com.brandon3055.draconicevolution.client.render.item.*;
import com.brandon3055.draconicevolution.client.render.block.RenderCrystal;
import com.brandon3055.draconicevolution.client.render.block.RenderDraconiumChest;
import com.brandon3055.draconicevolution.client.render.block.RenderEarthItem;
import com.brandon3055.draconicevolution.client.render.block.RenderEnergyInfuser;
import com.brandon3055.draconicevolution.client.render.block.RenderParticleGen;
import com.brandon3055.draconicevolution.client.render.block.RenderPortal;
import com.brandon3055.draconicevolution.client.render.block.RenderReactorCore;
import com.brandon3055.draconicevolution.client.render.block.RenderReactorEnergyInjector;
import com.brandon3055.draconicevolution.client.render.block.RenderReactorStabilizer;
import com.brandon3055.draconicevolution.client.render.block.RenderTeleporterStand;
import com.brandon3055.draconicevolution.client.render.block.RenderUpgradeModifier;
import com.brandon3055.draconicevolution.client.render.entity.RenderChaosCrystal;
import com.brandon3055.draconicevolution.client.render.entity.RenderDragon;
import com.brandon3055.draconicevolution.client.render.entity.RenderDragonHeart;
import com.brandon3055.draconicevolution.client.render.entity.RenderDragonProjectile;
import com.brandon3055.draconicevolution.client.render.entity.RenderEntityChaosVortex;
import com.brandon3055.draconicevolution.client.render.entity.RenderEntityCustomArrow;
import com.brandon3055.draconicevolution.client.render.item.RenderArmor;
import com.brandon3055.draconicevolution.client.render.item.RenderBow;
import com.brandon3055.draconicevolution.client.render.item.RenderBowModel;
import com.brandon3055.draconicevolution.client.render.item.RenderChaosFragment;
import com.brandon3055.draconicevolution.client.render.item.RenderChaosShard;
import com.brandon3055.draconicevolution.client.render.item.RenderMobSoul;
import com.brandon3055.draconicevolution.client.render.item.RenderStabilizerPart;
import com.brandon3055.draconicevolution.client.render.item.RenderTool;
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.client.render.tile.*;
import com.brandon3055.draconicevolution.client.render.tile.RenderTileChaosShard;
import com.brandon3055.draconicevolution.client.render.tile.RenderTileCrystal;
import com.brandon3055.draconicevolution.client.render.tile.RenderTileCustomSpawner;
import com.brandon3055.draconicevolution.client.render.tile.RenderTileDissEnchanter;
import com.brandon3055.draconicevolution.client.render.tile.RenderTileDraconiumChest;
import com.brandon3055.draconicevolution.client.render.tile.RenderTileEarth;
import com.brandon3055.draconicevolution.client.render.tile.RenderTileEnergyInfiser;
import com.brandon3055.draconicevolution.client.render.tile.RenderTileEnergyPylon;
import com.brandon3055.draconicevolution.client.render.tile.RenderTileEnergyStorageCore;
import com.brandon3055.draconicevolution.client.render.tile.RenderTileParticleGen;
import com.brandon3055.draconicevolution.client.render.tile.RenderTilePlacedItem;
import com.brandon3055.draconicevolution.client.render.tile.RenderTileReactorCore;
import com.brandon3055.draconicevolution.client.render.tile.RenderTileReactorEnergyInjector;
import com.brandon3055.draconicevolution.client.render.tile.RenderTileReactorStabilizer;
import com.brandon3055.draconicevolution.client.render.tile.RenderTileTeleporterStand;
import com.brandon3055.draconicevolution.client.render.tile.RenderTileUpgradeModifier;
import com.brandon3055.draconicevolution.common.CommonProxy;
import com.brandon3055.draconicevolution.common.ModBlocks;
import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.blocks.multiblock.IReactorPart;
import com.brandon3055.draconicevolution.common.entity.*;
import com.brandon3055.draconicevolution.common.entity.EntityChaosCrystal;
import com.brandon3055.draconicevolution.common.entity.EntityChaosGuardian;
import com.brandon3055.draconicevolution.common.entity.EntityChaosVortex;
import com.brandon3055.draconicevolution.common.entity.EntityCustomArrow;
import com.brandon3055.draconicevolution.common.entity.EntityCustomDragon;
import com.brandon3055.draconicevolution.common.entity.EntityDragonHeart;
import com.brandon3055.draconicevolution.common.entity.EntityDragonProjectile;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.tileentities.*;
import com.brandon3055.draconicevolution.common.tileentities.TileChaosShard;
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.TileDraconiumChest;
import com.brandon3055.draconicevolution.common.tileentities.TileEnergyInfuser;
import com.brandon3055.draconicevolution.common.tileentities.TileParticleGenerator;
import com.brandon3055.draconicevolution.common.tileentities.TilePlacedItem;
import com.brandon3055.draconicevolution.common.tileentities.TileTeleporterStand;
import com.brandon3055.draconicevolution.common.tileentities.TileUpgradeModifier;
import com.brandon3055.draconicevolution.common.tileentities.energynet.TileEnergyRelay;
import com.brandon3055.draconicevolution.common.tileentities.energynet.TileEnergyTransceiver;
import com.brandon3055.draconicevolution.common.tileentities.energynet.TileWirelessEnergyTransceiver;
@@ -41,7 +104,6 @@ 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.TileReactorEnergyInjector;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorStabilizer;
import com.brandon3055.draconicevolution.common.utills.UpdateChecker;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.client.registry.ClientRegistry;
@@ -50,11 +112,22 @@ import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
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;
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
public void preInit(FMLPreInitializationEvent event) {
@@ -62,68 +135,29 @@ public class ClientProxy extends CommonProxy {
super.preInit(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
public void init(FMLInitializationEvent event) {
super.init(event);
FMLCommonHandler.instance().bus().register(new KeyInputHandler());
FMLCommonHandler.instance().bus().register(new ClientEventHandler());
if (ConfigHandler.enableVersionChecker) FMLCommonHandler.instance().bus().register(new UpdateChecker());
MinecraftForge.EVENT_BUS.register(new HudHandler());
MinecraftForge.EVENT_BUS.register(new ClientEventHandler());
KeyBindings.init();
this.keybindHandler = new KeyInputHandler();
FMLCommonHandler.instance().bus().register(this.keybindHandler);
this.clientHandler = new ClientEventHandler();
FMLCommonHandler.instance().bus().register(this.clientHandler);
MinecraftForge.EVENT_BUS.register(this.clientHandler);
final HudHandler hudHandler = new HudHandler();
FMLCommonHandler.instance().bus().register(hudHandler);
MinecraftForge.EVENT_BUS.register(hudHandler);
registerRenderIDs();
registerRendering();
ResourceHandler.instance.tick(null);
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
@@ -132,7 +166,24 @@ public class ClientProxy extends CommonProxy {
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
MinecraftForgeClient.registerItemRenderer(ModItems.wyvernBow, new RenderBow());
MinecraftForgeClient.registerItemRenderer(ModItems.draconicBow, new RenderBow());
@@ -153,84 +204,29 @@ public class ClientProxy extends CommonProxy {
}
if (!ConfigHandler.useOldD2DToolTextures) {
MinecraftForgeClient.registerItemRenderer(
ModItems.draconicSword,
new RenderTool(
"models/tools/DraconicSword.obj",
"textures/models/tools/DraconicSword.png",
(IRenderTweak) ModItems.draconicSword));
MinecraftForgeClient.registerItemRenderer(
ModItems.wyvernPickaxe,
new RenderTool(
"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.draconicSword, new RenderTool("models/tools/DraconicSword.obj", "textures/models/tools/DraconicSword.png", (IRenderTweak) ModItems.draconicSword));
MinecraftForgeClient.registerItemRenderer(ModItems.wyvernPickaxe, new RenderTool("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.wyvernBow, new RenderBowModel(false));
}
MinecraftForgeClient
.registerItemRenderer(Item.getItemFromBlock(ModBlocks.draconiumChest), new RenderDraconiumChest());
MinecraftForgeClient
.registerItemRenderer(Item.getItemFromBlock(ModBlocks.particleGenerator), new RenderParticleGen());
MinecraftForgeClient
.registerItemRenderer(Item.getItemFromBlock(ModBlocks.energyInfuser), new RenderEnergyInfuser());
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.draconiumChest), new RenderDraconiumChest());
MinecraftForgeClient.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.reactorStabilizer),
new RenderReactorStabilizer());
MinecraftForgeClient.registerItemRenderer(
Item.getItemFromBlock(ModBlocks.reactorEnergyInjector),
new RenderReactorEnergyInjector());
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());
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.reactorStabilizer), new RenderReactorStabilizer());
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.reactorEnergyInjector), new RenderReactorEnergyInjector());
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.reactorCore), new RenderReactorCore());
if (ModBlocks.earthBlock != null) 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
RenderingRegistry.registerBlockHandler(new RenderTeleporterStand());
@@ -242,7 +238,7 @@ public class ClientProxy extends CommonProxy {
ClientRegistry.bindTileEntitySpecialRenderer(TileCustomSpawner.class, new RenderTileCustomSpawner());
// ClientRegistry.bindTileEntitySpecialRenderer(TileTestBlock.class, new RenderTileCrystal());
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(TilePlacedItem.class, new RenderTilePlacedItem());
ClientRegistry.bindTileEntitySpecialRenderer(TileDissEnchanter.class, new RenderTileDissEnchanter());
@@ -253,8 +249,7 @@ public class ClientProxy extends CommonProxy {
ClientRegistry.bindTileEntitySpecialRenderer(TileWirelessEnergyTransceiver.class, new RenderTileCrystal());
ClientRegistry.bindTileEntitySpecialRenderer(TileReactorCore.class, new RenderTileReactorCore());
ClientRegistry.bindTileEntitySpecialRenderer(TileReactorStabilizer.class, new RenderTileReactorStabilizer());
ClientRegistry
.bindTileEntitySpecialRenderer(TileReactorEnergyInjector.class, new RenderTileReactorEnergyInjector());
ClientRegistry.bindTileEntitySpecialRenderer(TileReactorEnergyInjector.class, new RenderTileReactorEnergyInjector());
ClientRegistry.bindTileEntitySpecialRenderer(TileChaosShard.class, new RenderTileChaosShard());
ClientRegistry.bindTileEntitySpecialRenderer(TileUpgradeModifier.class, new RenderTileUpgradeModifier());
@@ -266,14 +261,14 @@ public class ClientProxy extends CommonProxy {
RenderingRegistry.registerEntityRenderingHandler(EntityChaosCrystal.class, new RenderChaosCrystal());
RenderingRegistry.registerEntityRenderingHandler(EntityChaosVortex.class, new RenderEntityChaosVortex());
RenderingRegistry.registerEntityRenderingHandler(EntityCustomArrow.class, new RenderEntityCustomArrow());
// spotless:on
}
public void registerRenderIDs() {
private void registerRenderIDs() {
References.idTeleporterStand = RenderingRegistry.getNextAvailableRenderId();
References.idPortal = RenderingRegistry.getNextAvailableRenderId();
}
@Override
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) {
if (!worldObj.isRemote) return null;
@@ -295,7 +290,6 @@ public class ClientProxy extends CommonProxy {
return beam;
}
@Override
public ParticleEnergyField energyField(World worldObj, double x, double y, double z, int type, boolean advanced,
ParticleEnergyField oldBeam, boolean render) {
if (!worldObj.isRemote) return null;
@@ -317,7 +311,6 @@ public class ClientProxy extends CommonProxy {
return beam;
}
@Override
public ParticleReactorBeam reactorBeam(TileEntity tile, ParticleReactorBeam oldBeam, boolean render) {
if (!tile.getWorldObj().isRemote || !(tile instanceof IReactorPart)) return null;
ParticleReactorBeam beam = oldBeam;
@@ -333,24 +326,106 @@ public class ClientProxy extends CommonProxy {
beam.setDead();
return null;
} else {
beam.update(render);
beam.update();
}
return beam;
}
public boolean isOp(String paramString) {
return Minecraft.getMinecraft().theWorld.getWorldInfo().getGameType().isCreative();
public void spawnParticle(EntityFX particle, int range) {
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) {
FMLClientHandler.instance().getClient().getSoundHandler().playSound(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);
}
}
}
@@ -12,52 +12,44 @@ import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.rea
*/
public class ReactorSound extends PositionedSound implements ITickableSound {
private static ResourceLocation sound = new ResourceLocation(References.RESOURCESPREFIX + "coreSound");
public boolean donePlaying = false;
private TileReactorCore tile;
private static final ResourceLocation sound = new ResourceLocation(References.RESOURCESPREFIX + "coreSound");
public boolean isDonePlaying = false;
private final TileReactorCore core;
public ReactorSound(TileReactorCore tile) {
public ReactorSound(TileReactorCore core) {
super(sound);
this.tile = tile;
this.xPosF = (float) tile.xCoord + 0.5F;
this.yPosF = (float) tile.yCoord + 0.5F;
this.zPosF = (float) tile.zCoord + 0.5F;
this.core = core;
this.xPosF = (float) core.xCoord + 0.5F;
this.yPosF = (float) core.yCoord + 0.5F;
this.zPosF = (float) core.zCoord + 0.5F;
this.repeat = true;
this.volume = 1.5F;
}
@Override
public boolean isDonePlaying() {
return donePlaying;
return isDonePlaying;
}
@Override
public void update() {
volume = (tile.renderSpeed - 0.5F) * 2F;
if (tile.reactionTemperature > 8000) {
volume += (float) ((tile.reactionTemperature - 8000D) / 1000D);
volume = (core.renderSpeed - 0.5F) * 2F;
if (core.reactionTemperature > 8000) {
volume += (float) ((core.reactionTemperature - 8000D) / 1000D);
}
if (tile.reactionTemperature > 2000 && tile.maxFieldCharge > 0
&& tile.fieldCharge < (tile.maxFieldCharge * 0.2D)) {
volume += 2D - ((tile.fieldCharge / tile.maxFieldCharge) * 10D);
if (core.reactionTemperature > 2000 && core.maxFieldCharge > 0
&& core.fieldCharge < (core.maxFieldCharge * 0.2D)) {
volume += 2D - ((core.fieldCharge / core.maxFieldCharge) * 10D);
}
if (tile.reactionTemperature > 2000 && tile.reactorFuel + tile.convertedFuel > 0
&& tile.reactorFuel < (double) (tile.reactorFuel + tile.convertedFuel) * 0.2D) {
volume += 2D - ((tile.reactorFuel / (tile.reactorFuel + tile.convertedFuel)) * 10D);
if (core.reactionTemperature > 2000 && core.reactorFuel + core.convertedFuel > 0
&& core.reactorFuel < (double) (core.reactorFuel + core.convertedFuel) * 0.2D) {
volume += 2D - ((float) core.reactorFuel / (core.reactorFuel + core.convertedFuel)) * 10D;
}
field_147663_c = 0.5F + volume / 2F;
if (tile.isInvalid() || !tile.getWorldObj().getChunkFromBlockCoords(tile.xCoord, tile.zCoord).isChunkLoaded) { // ||
// player
// ==
// null
// ||
// tile.getDistanceFrom(player.posX,
// player.posY,
// player.posZ) > 512){
donePlaying = true;
if (core.isInvalid() || !core.getWorldObj().getChunkFromBlockCoords(core.xCoord, core.zCoord).isChunkLoaded) {
isDonePlaying = true;
repeat = false;
}
}
@@ -5,9 +5,9 @@ import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.common.ModBlocks;
import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -6,6 +6,7 @@ import net.minecraftforge.common.config.Configuration;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.lib.References;
import cpw.mods.fml.client.config.GuiConfig;
/**
@@ -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();
}
}
@@ -0,0 +1,241 @@
package com.brandon3055.draconicevolution.client.gui;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.container.ContainerDislocatorInhibitor;
import com.brandon3055.draconicevolution.common.inventory.SlotFakeItem;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.network.DislocatorInhibitorButtonPacket;
import com.brandon3055.draconicevolution.common.network.SlotFakeClickPacket;
import com.brandon3055.draconicevolution.common.tileentities.TileDislocatorInhibitor;
import codechicken.nei.VisiblityData;
import codechicken.nei.api.INEIGuiHandler;
import codechicken.nei.api.TaggedInventoryArea;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
@Optional.Interface(iface = "codechicken.nei.api.INEIGuiHandler", modid = "NotEnoughItems")
public class GUIDislocatorInhibitor extends GuiContainer implements INEIGuiHandler {
private static final ResourceLocation texture = new ResourceLocation(
References.MODID.toLowerCase(),
"textures/gui/Inhibitor.png");
private int range = 5;
private TileDislocatorInhibitor.ActivityControlType activityControlType = TileDislocatorInhibitor.ActivityControlType.ALWAYS_ACTIVE;
private boolean whitelist = false;
private final ContainerDislocatorInhibitor container;
public GUIDislocatorInhibitor(InventoryPlayer playerInventory, TileDislocatorInhibitor inhibitor) {
super(inhibitor.getGuiContainer(playerInventory));
this.container = (ContainerDislocatorInhibitor) inventorySlots;
xSize = 176;
ySize = 150;
syncWithServer();
}
@Override
@SuppressWarnings("unchecked")
public void initGui() {
super.initGui();
buttonList.clear();
buttonList.add(new GuiButtonAHeight(0, guiLeft + 7, guiTop + 19, 18, 18, "-"));
buttonList.add(new GuiButtonAHeight(1, guiLeft + 97, guiTop + 19, 18, 18, "+"));
buttonList.add(new GuiButtonAHeight(2, guiLeft + 151, guiTop + 19, 18, 18, ""));
buttonList.add(new GuiButtonAHeight(3, guiLeft + 151, guiTop + 41, 18, 18, ""));
}
@Override
protected void drawGuiContainerForegroundLayer(int x, int y) {
fontRendererObj
.drawString(StatCollector.translateToLocal("gui.de.dislocatorInhibitor.main.title"), 7, 5, 0x222222);
drawGuiText();
drawGreyOutSlots();
drawButtonIcons();
}
@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
GL11.glColor4f(1, 1, 1, 1);
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
}
@Override
public void drawScreen(int x, int y, float partialTicks) {
super.drawScreen(x, y, partialTicks);
ArrayList<String> lines = new ArrayList<>();
if (isButtonHovered(x, y, 7, 19, 18, 18)) {
lines.add(StatCollector.translateToLocal("gui.de.dislocatorInhibitor.tooltip.range.decrease.txt"));
} else if (isButtonHovered(x, y, 97, 19, 18, 18)) {
lines.add(StatCollector.translateToLocal("gui.de.dislocatorInhibitor.tooltip.range.increase.txt"));
} else if (isButtonHovered(x, y, 151, 19, 18, 18)) {
switch (activityControlType) {
case ALWAYS_ACTIVE -> lines
.add(StatCollector.translateToLocal("gui.de.dislocatorInhibitor.tooltip.activity.always.txt"));
case WITH_REDSTONE -> lines
.add(StatCollector.translateToLocal("gui.de.dislocatorInhibitor.tooltip.activity.with.txt"));
case WITHOUT_REDSTONE -> lines
.add(StatCollector.translateToLocal("gui.de.dislocatorInhibitor.tooltip.activity.without.txt"));
case NEVER_ACTIVE -> lines
.add(StatCollector.translateToLocal("gui.de.dislocatorInhibitor.tooltip.activity.never.txt"));
}
lines.add(StatCollector.translateToLocal("gui.de.dislocatorInhibitor.tooltip.activity.cycle.txt"));
} else if (isButtonHovered(x, y, 151, 41, 18, 18)) {
if (whitelist) {
lines.add(StatCollector.translateToLocal("gui.de.dislocatorInhibitor.tooltip.whitelist.txt"));
} else {
lines.add(StatCollector.translateToLocal("gui.de.dislocatorInhibitor.tooltip.blacklist.txt"));
}
}
if (!lines.isEmpty()) {
drawHoveringText(lines, x, y, fontRendererObj);
}
}
private boolean isButtonHovered(int mouseX, int mouseY, int buttonX, int buttonY, int width, int height) {
return (mouseX >= buttonX + guiLeft && mouseX < buttonX + width + guiLeft)
&& (mouseY >= buttonY + guiTop && mouseY < buttonY + height + guiTop);
}
@Override
protected void handleMouseClick(Slot slotIn, int slotId, int clickedButton, int clickType) {
if (slotIn instanceof SlotFakeItem sfi) {
DraconicEvolution.network.sendToServer(
new SlotFakeClickPacket((byte) sfi.getSlotIndex(), this.mc.thePlayer.inventory.getItemStack()));
} else {
super.handleMouseClick(slotIn, slotId, clickedButton, clickType);
}
}
@Override
protected void actionPerformed(GuiButton button) {
switch (button.id) {
case 0 -> { // Range -
range = Math.max(range - 1, TileDislocatorInhibitor.MINIMUM_RANGE);
DraconicEvolution.network.sendToServer(new DislocatorInhibitorButtonPacket((byte) 0, (byte) range));
}
case 1 -> { // Range +
range = Math.min(range + 1, TileDislocatorInhibitor.MAXIMUM_RANGE);
DraconicEvolution.network.sendToServer(new DislocatorInhibitorButtonPacket((byte) 0, (byte) range));
}
case 2 -> { // Cycle Activity control
activityControlType = activityControlType.getNext();
byte controlMode = (byte) (activityControlType.ordinal());
DraconicEvolution.network.sendToServer(new DislocatorInhibitorButtonPacket((byte) 1, controlMode));
}
case 3 -> { // Toggle Whitelist/Blacklist mode
whitelist = !whitelist;
byte whitelistMode = (byte) (whitelist ? 1 : 0);
DraconicEvolution.network.sendToServer(new DislocatorInhibitorButtonPacket((byte) 2, whitelistMode));
}
}
}
@Override
public VisiblityData modifyVisiblity(GuiContainer gui, VisiblityData currentVisibility) {
return currentVisibility;
}
@Override
public Iterable<Integer> getItemSpawnSlots(GuiContainer gui, ItemStack item) {
return null;
}
@Override
public List<TaggedInventoryArea> getInventoryAreas(GuiContainer gui) {
return Collections.emptyList();
}
@Override
public boolean handleDragNDrop(GuiContainer gui, int mousex, int mousey, ItemStack draggedStack, int button) {
if (gui instanceof GUIDislocatorInhibitor) {
for (var slot : container.inventorySlots) {
if (slot instanceof SlotFakeItem sfi) {
if (sfi.isOverSlot(mousex - this.guiLeft, mousey - this.guiTop)) {
draggedStack.stackSize = 0;
DraconicEvolution.network
.sendToServer(new SlotFakeClickPacket((byte) sfi.getSlotIndex(), draggedStack));
return true;
}
}
}
}
return false;
}
@Override
public boolean hideItemPanelSlot(GuiContainer gui, int x, int y, int w, int h) {
return false;
}
private void drawGuiText() {
fontRendererObj.drawString(
StatCollector.translateToLocal("gui.de.dislocatorInhibitor.range.txt"),
40,
25,
0x000000,
false);
fontRendererObj.drawString(
StatCollector.translateToLocalFormatted("gui.de.numbers", range),
range < 10 ? 78 : 75,
25,
0x000000,
false);
}
private void drawButtonIcons() {
GL11.glColor4f(1, 1, 1, 1);
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
// activity control button
drawTexturedModalRect(151, 19, 0, 150 + (18 * activityControlType.ordinal()), 18, 18);
// whitelist button
drawTexturedModalRect(151, 41, 18, 150 + (whitelist ? 0 : 18), 18, 18);
}
private void drawGreyOutSlots() {
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glEnable(GL11.GL_BLEND);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5f);
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
for (int i = 0; i < 8; i++) {
drawTexturedModalRect(7 + i * 18, 41, 36, 150, 18, 18);
}
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glEnable(GL11.GL_LIGHTING);
}
private void syncWithServer() {
TileDislocatorInhibitor inhibitor = container.getTileEntity();
whitelist = inhibitor.isWhitelist();
range = inhibitor.getRange();
activityControlType = inhibitor.getActivityControlType();
}
}
@@ -52,13 +52,18 @@ public class GUIDissEnchanter extends GuiContainer {
protected void drawGuiContainerForegroundLayer(int x, int y) {
drawCenteredString(
fontRendererObj,
StatCollector.translateToLocal("tile.draconicevolution:dissEnchanter.name"),
StatCollector.translateToLocal("gui.de.dissEnchanter.main.title"),
88,
4,
0x00FFFF);
fontRendererObj.drawString("Item", 5, 40, 0x0000ff);
fontRendererObj.drawString("Damage: " + (40 - tile.bookPower) + "%", 5, 49, 0x0000ff);
fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.dissEnchanter.itemDamage1"), 5, 40, 0x0000ff);
fontRendererObj.drawString(
StatCollector
.translateToLocalFormatted("gui.de.dissEnchanter.itemDamage2", (40 - tile.bookPower) + "%"),
5,
49,
0x0000ff);
}
@Override
@@ -94,6 +99,7 @@ public class GUIDissEnchanter extends GuiContainer {
if (flag && player.experienceLevel < tile.dissenchantCost && !player.capabilities.isCreativeMode) flag = false;
((GuiButtonAHeight) buttonList.get(0)).enabled = flag;
((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,18 +17,17 @@ import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
import codechicken.nei.VisiblityData;
import codechicken.nei.api.INEIGuiHandler;
import codechicken.nei.api.TaggedInventoryArea;
import com.brandon3055.brandonscore.client.utills.GuiHelper;
import com.brandon3055.draconicevolution.DraconicEvolution;
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.lib.References;
import com.brandon3055.draconicevolution.common.network.ButtonPacket;
import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest;
import codechicken.nei.VisiblityData;
import codechicken.nei.api.INEIGuiHandler;
import codechicken.nei.api.TaggedInventoryArea;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -96,7 +95,7 @@ public class GUIDraconiumChest extends GuiContainer implements INEIGuiHandler {
@Override
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,
// 0x00FFFF);
@@ -1,5 +1,7 @@
package com.brandon3055.draconicevolution.client.gui;
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
import java.util.ArrayList;
import java.util.Random;
@@ -14,13 +16,12 @@ import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
import cofh.api.energy.IEnergyContainerItem;
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.lib.References;
import com.brandon3055.draconicevolution.common.tileentities.TileEnergyInfuser;
import cofh.api.energy.IEnergyContainerItem;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -82,7 +83,11 @@ public class GUIEnergyInfuser extends GuiContainer {
@Override
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);
@@ -119,10 +124,9 @@ public class GUIEnergyInfuser extends GuiContainer {
ArrayList<String> internal = new ArrayList<String>();
internal.add(StatCollector.translateToLocal("gui.de.internalStorage.txt"));
internal.add(
"" + EnumChatFormatting.DARK_BLUE
+ tile.energy.getEnergyStored()
EnumChatFormatting.DARK_BLUE + formatNumber(tile.energy.getEnergyStored())
+ "/"
+ tile.energy.getMaxEnergyStored());
+ formatNumber(tile.energy.getMaxEnergyStored()));
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
drawHoveringText(internal, x + guiLeft, y + guiTop, fontRendererObj);
GL11.glPopAttrib();
@@ -135,10 +139,9 @@ public class GUIEnergyInfuser extends GuiContainer {
ArrayList<String> internal = new ArrayList<String>();
internal.add(StatCollector.translateToLocal("gui.de.itemStorage.txt"));
internal.add(
"" + EnumChatFormatting.DARK_BLUE
+ item.getEnergyStored(tile.getStackInSlot(0))
EnumChatFormatting.DARK_BLUE + formatNumber(item.getEnergyStored(tile.getStackInSlot(0)))
+ "/"
+ item.getMaxEnergyStored(tile.getStackInSlot(0)));
+ formatNumber(item.getMaxEnergyStored(tile.getStackInSlot(0))));
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
drawHoveringText(internal, x + guiLeft, y + guiTop, fontRendererObj);
GL11.glPopAttrib();
@@ -1,5 +1,7 @@
package com.brandon3055.draconicevolution.client.gui;
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
import java.util.ArrayList;
import java.util.List;
@@ -10,9 +12,8 @@ import net.minecraft.util.StatCollector;
import org.lwjgl.input.Keyboard;
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.utils.GuiHelper;
import com.brandon3055.draconicevolution.common.tileentities.gates.TileGate;
/**
@@ -47,7 +48,7 @@ public class GUIFlowGate extends GuiScreen {
drawDefaultBackground();
ResourceHandler.bindResource("textures/gui/ToolConfig.png");
drawTexturedModalRect(guiLeft, guiTop, 0, 0, 197, 88);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, 198, 89);
fontRendererObj.drawString(
StatCollector.translateToLocal("gui.de.flowGate.name"),
guiCrt - (fontRendererObj.getStringWidth(StatCollector.translateToLocal("gui.de.flowGate.name")) / 2),
@@ -87,7 +88,7 @@ public class GUIFlowGate extends GuiScreen {
0x00FF00);
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);
if (!tile.flowOverridden) {
@@ -1,19 +1,21 @@
package com.brandon3055.draconicevolution.client.gui;
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
import java.util.ArrayList;
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.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraftforge.common.util.ForgeDirection;
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.lib.References;
import com.brandon3055.draconicevolution.common.tileentities.TileGenerator;
@@ -73,46 +75,30 @@ public class GUIGenerator extends GuiContainer {
18,
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 y = Y - guiTop;
if (GuiHelper.isInRect(83, 10, 12, 40, x, y)) {
ArrayList<String> internal = new ArrayList<String>();
internal.add("Internal Storage");
internal.add(StatCollector.translateToLocal("gui.de.internalStorage.txt"));
internal.add(
"" + EnumChatFormatting.DARK_BLUE
+ tile.getEnergyStored(ForgeDirection.UP)
EnumChatFormatting.DARK_BLUE + formatNumber(tile.getEnergyStored(ForgeDirection.UP))
+ "/"
+ tile.getMaxEnergyStored(ForgeDirection.UP));
+ formatNumber(tile.getMaxEnergyStored(ForgeDirection.UP)));
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
public void initGui() {
super.initGui();
// ID
// buttonList.add(new GuiButton(0, guiLeft + 85, guiTop , 85, 20, text));
}
@Override
protected void actionPerformed(GuiButton button) {}
@Override
public void updateScreen() {
guiUpdateTick++;
@@ -123,6 +109,4 @@ public class GUIGenerator extends GuiContainer {
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;
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
import java.util.ArrayList;
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.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraftforge.common.util.ForgeDirection;
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.lib.References;
import com.brandon3055.draconicevolution.common.tileentities.TileGrinder;
@@ -69,7 +71,7 @@ public class GUIGrinder extends GuiContainer {
guiLeft + 83,
guiTop + 11 + (int) (power * 40),
xSize,
0 + (int) (power * 40),
(int) (power * 40),
12,
40 - (int) (power * 40)); // Power bar
drawTexturedModalRect(
@@ -81,7 +83,11 @@ public class GUIGrinder extends GuiContainer {
18 - (int) (fuel * 13)); // Power bar
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 y = Y - guiTop;
@@ -91,39 +97,25 @@ public class GUIGrinder extends GuiContainer {
if (tile.isExternallyPowered()) {
internal.add(
"" + EnumChatFormatting.DARK_BLUE
+ tile.getEnergyStored(ForgeDirection.UP)
+ formatNumber(tile.getEnergyStored(ForgeDirection.UP))
+ "/"
+ tile.getMaxEnergyStored(ForgeDirection.UP));
+ formatNumber(tile.getMaxEnergyStored(ForgeDirection.UP)));
} else {
internal.add(
"" + EnumChatFormatting.DARK_BLUE
+ tile.getInternalBuffer().getEnergyStored()
+ formatNumber(tile.getInternalBuffer().getEnergyStored())
+ "/"
+ tile.getInternalBuffer().getMaxEnergyStored());
+ formatNumber(tile.getInternalBuffer().getMaxEnergyStored()));
}
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
public void initGui() {
super.initGui();
// ID
// buttonList.add(new GuiButton(0, guiLeft + 85, guiTop , 85, 20, text));
}
@Override
protected void actionPerformed(GuiButton button) {}
@Override
public void updateScreen() {
guiUpdateTick++;
@@ -134,6 +126,4 @@ public class GUIGrinder extends GuiContainer {
super.updateScreen();
}
// ####Draw at############ read from size
// drawTexturedModalRect(guiLeft + 37, guiTop + 4, 0, 143, 37, 38);
}
File diff suppressed because it is too large. Load diff
@@ -1,14 +1,15 @@
package com.brandon3055.draconicevolution.client.gui;
import java.util.ArrayList;
import java.util.Arrays;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiTextField;
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 net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
@@ -25,80 +26,93 @@ import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class GUIPlayerDetector extends GuiContainer {
public EntityPlayer player;
private TilePlayerDetectorAdvanced detector;
public boolean showInvSlots = true;
private boolean editMode = false;
private int range = 0;
private int maxRange = 20;
private boolean whitelist = false;
private boolean initScedualed = false;
private int initTick = 0;
private String[] names = new String[42];
private GuiTextField selectedNameText;
private int selected = -1;
private boolean outputInverted = false;
public GUIPlayerDetector(InventoryPlayer invPlayer, TilePlayerDetectorAdvanced detector) {
super(detector.getGuiContainer(invPlayer));
this.inventorySlots = new ContainerPlayerDetector(invPlayer, detector, this);
for (int i = 0; i < names.length; i++) names[i] = "";
xSize = 176;
ySize = 198;
this.detector = detector;
this.player = invPlayer.player;
syncWithServer();
}
private static final ResourceLocation texture = new ResourceLocation(
References.MODID.toLowerCase(),
"textures/gui/PlayerDetector.png");
private final ContainerPlayerDetector container;
private boolean isInEditMode = false;
private int range = 0;
private boolean isInWhitelistMode = false;
private boolean isOutputInverted = false;
private boolean isInitScheduled = false;
private int initTick = 0;
private final String[] names = new String[42];
private GuiTextField selectedNameText;
private int selectedMameIndex = -1;
public GUIPlayerDetector(InventoryPlayer playerInventory, TilePlayerDetectorAdvanced detector) {
super(detector.getGuiContainer(playerInventory));
container = (ContainerPlayerDetector) inventorySlots;
Arrays.fill(names, "");
xSize = 176;
ySize = 198;
syncWithServer();
}
@Override
protected void drawGuiContainerBackgroundLayer(float f, int x, int y) {
protected void drawGuiContainerBackgroundLayer(float partialTicks, int x, int y) {
GL11.glColor4f(1, 1, 1, 1);
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
if (editMode) {
if (isInEditMode) {
drawTexturedModalRect(guiLeft + 3, guiTop + ySize / 2, 3, 3, xSize - 6, (ySize / 2) - 3);
drawNameChart(x, y);
}
if (showInvSlots) drawTexturedModalRect(guiLeft + 142, guiTop + 19, xSize, 0, 23, 41);
if (container.shouldShowInventory()) {
drawTexturedModalRect(guiLeft + 142, guiTop + 19, xSize, 0, 23, 41);
}
}
@Override
protected void drawGuiContainerForegroundLayer(int x, int y) {
drawGuiText(x, y);
drawGuiText();
}
@Override
public void drawScreen(int x, int y, float p_73863_3_) {
super.drawScreen(x, y, p_73863_3_);
ArrayList<String> lines = new ArrayList<String>();
lines.add("Camouflage");
if ((x - guiLeft > 142 && x - guiLeft < 160) && (y - guiTop > 19 && y - guiTop < 37) && showInvSlots)
public void drawScreen(int x, int y, float partialTicks) {
super.drawScreen(x, y, partialTicks);
ArrayList<String> lines = new ArrayList<>();
lines.add(StatCollector.translateToLocal("gui.de.playerDetector.camouflage"));
if ((x - guiLeft > 142 && x - guiLeft < 160) && (y - guiTop > 19 && y - guiTop < 37)
&& container.shouldShowInventory()) {
drawHoveringText(lines, x, y, fontRendererObj);
}
}
@Override
@SuppressWarnings("unchecked")
public void initGui() {
super.initGui();
buttonList.clear();
if (!editMode) {
String wt = whitelist ? "White List" : "Black List";
int centre = width / 2;
buttonList.add(new GuiButton(0, centre - 20 - 20, guiTop + 20, 20, 20, "+"));
buttonList.add(new GuiButton(1, centre + 20, guiTop + 20, 20, 20, "-"));
buttonList.add(new GuiButton(3, centre - 40, guiTop + 45, 60, 20, wt));
buttonList.add(new GuiButton(4, centre + 20, guiTop + 45, 20, 20, "!"));
buttonList.add(new GuiButton(6, centre - 40, guiTop + 70, 80, 20, "Invert Output"));
if (!isInEditMode) {
String mode = isInWhitelistMode ? StatCollector.translateToLocal("gui.de.playerDetector.whiteList")
: StatCollector.translateToLocal("gui.de.playerDetector.blackList");
int center = width / 2;
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(3, center - 40, guiTop + 45, 60, 20, mode));
buttonList.add(new GuiButton(4, center + 20, guiTop + 45, 20, 20, "!"));
buttonList.add(
new GuiButton(
6,
center - 40,
guiTop + 70,
80,
20,
StatCollector.translateToLocal("gui.de.playerDetector.invertOutput")));
} 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);
@@ -106,112 +120,133 @@ public class GUIPlayerDetector extends GuiContainer {
selectedNameText.setDisabledTextColour(-1);
selectedNameText.setEnableBackgroundDrawing(true);
selectedNameText.setMaxStringLength(40);
selectedNameText.setVisible(editMode);
// ID
// buttonList.add(new GuiButton(0, guiLeft + 85, guiTop , 85, 20, "sgASGgs"));
// syncWithServer();
selectedNameText.setVisible(isInEditMode);
}
@Override
protected void actionPerformed(GuiButton button) {
switch (button.id) {
case 0: // Range +
range = (range < maxRange) ? range + 1 : maxRange;
case 0 -> { // Range +
range = Math.min(range + 1, TilePlayerDetectorAdvanced.MAXIMUM_RANGE);
DraconicEvolution.network.sendToServer(new PlayerDetectorButtonPacket((byte) 0, (byte) range));
break;
case 1: // Range -
range = (range > 1) ? range - 1 : 1;
}
case 1 -> { // Range -
range = Math.max(range - 1, TilePlayerDetectorAdvanced.MINIMUM_RANGE);
DraconicEvolution.network.sendToServer(new PlayerDetectorButtonPacket((byte) 0, (byte) range));
break;
case 3: // White List -
initScedualed = true;
editMode = true;
showInvSlots = false;
((ContainerPlayerDetector) this.inventorySlots).updateContainerSlots();
break;
case 4: // Toggle White List -
whitelist = !whitelist;
initScedualed = true;
byte val = (byte) (whitelist ? 1 : 0);
DraconicEvolution.network.sendToServer(new PlayerDetectorButtonPacket((byte) 1, val));
break;
case 5: // Back -
editMode = false;
showInvSlots = true;
((ContainerPlayerDetector) this.inventorySlots).updateContainerSlots();
initScedualed = true;
break;
case 6: // Back -
outputInverted = !outputInverted;
initScedualed = true;
byte val2 = (byte) (outputInverted ? 1 : 0);
DraconicEvolution.network.sendToServer(new PlayerDetectorButtonPacket((byte) 2, val2));
break;
}
case 3 -> { // Edit Whitelist/Blacklist
isInitScheduled = true;
isInEditMode = true;
container.setShouldShowInventory(false);
}
case 4 -> { // Toggle Whitelist/Blacklist mode
isInitScheduled = true;
isInWhitelistMode = !isInWhitelistMode;
byte whitelistMode = (byte) (isInWhitelistMode ? 1 : 0);
DraconicEvolution.network.sendToServer(new PlayerDetectorButtonPacket((byte) 1, whitelistMode));
}
case 5 -> { // Back
isInitScheduled = true;
isInEditMode = false;
container.setShouldShowInventory(true);
}
case 6 -> { // Invert Output
isInitScheduled = true;
isOutputInverted = !isOutputInverted;
byte outputMode = (byte) (isOutputInverted ? 1 : 0);
DraconicEvolution.network.sendToServer(new PlayerDetectorButtonPacket((byte) 2, outputMode));
}
}
// DraconicEvolution.channelHandler.sendToServer(new ButtonPacket((byte) 0, true));
}
@Override
protected void keyTyped(char par1, int par2) {
if (this.selectedNameText.textboxKeyTyped(par1, par2)) return;
else if (par2 == 28) {
protected void keyTyped(char typedChar, int keyCode) {
if (this.selectedNameText.textboxKeyTyped(typedChar, keyCode)) {
return;
}
if (keyCode == 28) {
if (selectedNameText.isFocused()) {
names[selected] = selectedNameText.getText();
names[selectedMameIndex] = selectedNameText.getText();
selectedNameText.setText("");
selectedNameText.setFocused(false);
DraconicEvolution.network
.sendToServer(new PlayerDetectorStringPacket((byte) selected, names[selected]));
selected = -1;
DraconicEvolution.network.sendToServer(
new PlayerDetectorStringPacket((byte) selectedMameIndex, names[selectedMameIndex]));
selectedMameIndex = -1;
}
} else super.keyTyped(par1, par2);
} else {
super.keyTyped(typedChar, keyCode);
}
}
@Override
public void updateScreen() {
if (initScedualed) initTick++;
if (isInitScheduled) {
initTick++;
}
if (initTick > 1) {
initTick = 0;
initScedualed = false;
isInitScheduled = false;
initGui();
}
super.updateScreen();
}
@Override
protected void mouseClicked(int x, int y, int par3) {
super.mouseClicked(x, y, par3);
if (editMode) selectName(x - guiLeft, y - guiTop);
// this.selectedNameText.mouseClicked(x - guiLeft, y - guiTop, par3);
protected void mouseClicked(int x, int y, int mouseButton) {
super.mouseClicked(x, y, mouseButton);
if (isInEditMode) {
selectName(x - guiLeft, y - guiTop);
}
}
private void drawGuiText(int rawX, int rawY) {
if (!editMode) {
drawCenteredString(fontRendererObj, "Advanced Player Detector", xSize / 2, 5, 0x00FFFF);
fontRendererObj.drawString("Range:", 73, 21, 0x000000, false);
fontRendererObj.drawString("Output Inverted: " + String.valueOf(outputInverted), 33, 97, 0x000000, false);
if (range < 10) fontRendererObj.drawString("" + range, 85, 31, 0x000000, false);
else fontRendererObj.drawString("" + range, 82, 31, 0x000000, false);
} else {
if (selected != -1) drawCenteredString(fontRendererObj, "Press Enter to save", xSize / 2, -22, 0xFF0000);
for (int i = 0; i < 21; i++) {
for (int j = 0; j < 2; j++) {
if (i + j * 21 != selected) {
String s = names[i + j * 21];
if (s.length() > 13) s = s.substring(0, 13) + "...";
fontRendererObj.drawString(s, 5 + j * 84, 6 + i * 9, 0x980000);
private void drawGuiText() {
if (isInEditMode) {
if (selectedMameIndex != -1) {
drawCenteredString(
fontRendererObj,
StatCollector.translateToLocal("gui.de.playerDetector.pressEnter"),
xSize / 2,
-22,
0xFF0000);
}
for (int row = 0; row < 21; row++) {
for (int column = 0; column < 2; column++) {
if (row + column * 21 != selectedMameIndex) {
String name = names[row + column * 21];
if (name.length() > 13) {
name = name.substring(0, 13) + "...";
}
fontRendererObj.drawString(name, 5 + column * 84, 6 + row * 9, 0x980000);
}
}
}
}
} else {
drawCenteredString(
fontRendererObj,
StatCollector.translateToLocal("gui.de.playerDetector.main.title"),
xSize / 2,
5,
0x00FFFF);
fontRendererObj.drawString(
StatCollector.translateToLocal("gui.de.playerDetector.range") + ":",
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();
}
@@ -219,39 +254,46 @@ public class GUIPlayerDetector extends GuiContainer {
int x = rawX - guiLeft;
int y = rawY - guiTop;
for (int i = 0; i < 21; i++) {
drawTexturedModalRect(guiLeft + 4, guiTop + 4 + i * 9, 0, ySize, 186, 10);
for (int row = 0; row < 21; row++) {
drawTexturedModalRect(guiLeft + 4, guiTop + 4 + row * 9, 0, ySize, 186, 10);
}
for (int i = 0; i < 21; i++) {
for (int j = 0; j < 2; j++) {
if ((x > 4 + j * 84 && x < (xSize / 2) - 1 + j * 82) && (y > 4 + i * 9 && y < 13 + i * 9)
|| i + j * 21 == selected)
drawTexturedModalRect(guiLeft + 5 + j * 84, guiTop + 5 + i * 9, 0, ySize + 10, 82, 8);
for (int row = 0; row < 21; row++) {
for (int column = 0; column < 2; column++) {
if ((x > 4 + column * 84 && x < (xSize / 2) - 1 + column * 82) && (y > 4 + row * 9 && y < 13 + row * 9)
|| row + column * 21 == selectedMameIndex)
drawTexturedModalRect(guiLeft + 5 + column * 84, guiTop + 5 + row * 9, 0, ySize + 10, 82, 8);
}
}
}
public void selectName(int x, int y) {
if (initScedualed) return;
if (isInitScheduled) {
return;
}
for (int i = 0; i < 21; i++) {
for (int j = 0; j < 2; j++) {
if ((x > 4 + j * 84 && x < (xSize / 2) - 1 + j * 82) && (y > 4 + i * 9 && y < 13 + i * 9)) {
selected = i + j * 21;
selectedNameText.setText(names[i + j * 21]);
for (int row = 0; row < 21; row++) {
for (int column = 0; column < 2; column++) {
if ((x > 4 + column * 84 && x < (xSize / 2) - 1 + column * 82)
&& (y > 4 + row * 9 && y < 13 + row * 9)) {
selectedMameIndex = row + column * 21;
selectedNameText.setText(names[row + column * 21]);
selectedNameText.setFocused(true);
return;
}
}
}
}
private void syncWithServer() {
this.whitelist = detector.whiteList;
TilePlayerDetectorAdvanced detector = container.getDetector();
isInWhitelistMode = detector.isInWhiteListMode;
for (int i = 0; i < detector.names.length; i++) {
if (detector.names[i] != null) names[i] = detector.names[i];
if (detector.names[i] != null) {
names[i] = detector.names[i];
}
}
range = detector.range;
outputInverted = detector.outputInverted;
isOutputInverted = detector.isOutputInverted;
}
}
@@ -20,28 +20,30 @@ import net.minecraft.util.StatCollector;
import org.lwjgl.input.Keyboard;
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.client.utils.GuiHelper;
import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.lib.References;
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.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class GUITeleporter extends GuiScreen {
private static final int PEARLS_WITH_SHIFT = Loader.isModLoaded("dreamcraft") ? 64 : 16;
private final int xSize = 182;
private final int ySize = 141;
private ResourceLocation guiTexture = new ResourceLocation(
References.MODID.toLowerCase(),
"textures/gui/TeleporterMKII.png");
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 selectionOffset = 0;
@@ -444,7 +446,7 @@ public class GUITeleporter extends GuiScreen {
} else {
if (!textBeingEdited.getText().isEmpty()) {
getLocationSafely(selected + selectionOffset).setName(textBeingEdited.getText());
TeleportLocation location = new TeleportLocation();
Teleporter.TeleportLocation location = new Teleporter.TeleportLocation();
location.setName(textBeingEdited.getText());
DraconicEvolution.network.sendToServer(
new TeleporterPacket(location, TeleporterPacket.UPDATENAME, selected + selectionOffset));
@@ -458,7 +460,7 @@ public class GUITeleporter extends GuiScreen {
}
if (button.id == 1) {
TeleportLocation location = new TeleportLocation(
Teleporter.TeleportLocation location = new Teleporter.TeleportLocation(
player.posX,
player.posY - 1.62,
player.posZ,
@@ -482,14 +484,14 @@ public class GUITeleporter extends GuiScreen {
if (button.id == 3 || button.id == 7) {
if (button.id == 3) {
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 - 1, temp);
selected--;
}
} else {
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 + 1, temp);
selected++;
@@ -533,9 +535,10 @@ public class GUITeleporter extends GuiScreen {
if ((!Keyboard.isKeyDown(42)) && (!Keyboard.isKeyDown(54))) {
DraconicEvolution.network.sendToServer(new TeleporterPacket(TeleporterPacket.ADDFUEL, 1, false));
this.fuel += ConfigHandler.teleporterUsesPerPearl;
} else if (hasPearls(16)) {
DraconicEvolution.network.sendToServer(new TeleporterPacket(TeleporterPacket.ADDFUEL, 16, false));
this.fuel += ConfigHandler.teleporterUsesPerPearl * 16;
} else if (hasPearls(PEARLS_WITH_SHIFT)) {
DraconicEvolution.network
.sendToServer(new TeleporterPacket(TeleporterPacket.ADDFUEL, PEARLS_WITH_SHIFT, false));
this.fuel += ConfigHandler.teleporterUsesPerPearl * PEARLS_WITH_SHIFT;
} else player.addChatMessage(new ChatComponentTranslation("msg.teleporterOutOfPearls.txt"));
} else player.addChatMessage(new ChatComponentTranslation("msg.teleporterOutOfPearls.txt"));
}
@@ -621,7 +624,7 @@ public class GUITeleporter extends GuiScreen {
// TeleportLocation location = new TeleportLocation(tagLocation.getDouble("X"), tagLocation.getDouble("Y"),
// tagLocation.getDouble("Z"), tagLocation.getInteger("Dimension"), tagLocation.getFloat("Pitch"),
// tagLocation.getFloat("Yaw"), tagLocation.getString("Name"));
TeleportLocation location = new TeleportLocation();
Teleporter.TeleportLocation location = new Teleporter.TeleportLocation();
location.readFromNBT(tagLocation);
location.setWriteProtected(tagLocation.getBoolean("WP"));
locations.add(location);
@@ -629,7 +632,7 @@ public class GUITeleporter extends GuiScreen {
}
private void addCurrentLocationToList(String name) {
TeleportLocation currentLocation = new TeleportLocation(
Teleporter.TeleportLocation currentLocation = new Teleporter.TeleportLocation(
player.posX,
player.posY - 1.62,
player.posZ,
@@ -641,8 +644,8 @@ public class GUITeleporter extends GuiScreen {
locations.add(currentLocation);
}
private TeleportLocation getLocationSafely(int index) {
private Teleporter.TeleportLocation getLocationSafely(int 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 com.brandon3055.brandonscore.client.utills.GuiHelper;
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.container.ContainerUpgradeModifier;
import com.brandon3055.draconicevolution.common.tileentities.TileUpgradeModifier;
import com.brandon3055.draconicevolution.common.utills.IUpgradableItem;
import com.brandon3055.draconicevolution.common.utills.IUpgradableItem.EnumUpgrade;
import com.brandon3055.draconicevolution.common.utils.IUpgradableItem;
import com.brandon3055.draconicevolution.common.utils.IUpgradableItem.EnumUpgrade;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -86,7 +86,12 @@ public class GUIUpgradeModifier extends GuiContainer {
@Override
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
@@ -238,13 +243,25 @@ public class GUIUpgradeModifier extends GuiContainer {
0x00ff00);
fontRendererObj
.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
.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
.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
@@ -6,6 +6,7 @@ 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 net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
@@ -53,23 +54,32 @@ public class GUIWeatherController extends GuiContainer {
@Override
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, "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_OFF_TEXT = "Turn rain off";
public static final String STORM_TEXT = "Thunder Storm";
public static final String RAIN_ON_TEXT = "gui.de.rain.on";
public static final String RAIN_OFF_TEXT = "gui.de.rain.off";
public static final String STORM_TEXT = "gui.de.rain.storm";
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
public void initGui() {
super.initGui();
buttonList.clear();
if (tileWC.mode == 0) text = RAIN_OFF_TEXT;
else if (tileWC.mode == 1) text = RAIN_ON_TEXT;
else text = STORM_TEXT;
text = getModeText(tileWC.mode);
// ID
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) {
if (button.id == 0) {
DraconicEvolution.network.sendToServer(new ButtonPacket((byte) 0, true));
if (button.displayString.equals(STORM_TEXT)) button.displayString = RAIN_OFF_TEXT;
else if (button.displayString.equals(RAIN_OFF_TEXT)) button.displayString = RAIN_ON_TEXT;
else button.displayString = STORM_TEXT;
tileWC.mode = (tileWC.mode + 1) % 3;
button.displayString = getModeText(tileWC.mode);
}
}
@@ -8,9 +8,30 @@ import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.gui.componentguis.GUIManual;
import com.brandon3055.draconicevolution.client.gui.componentguis.GUIReactor;
import com.brandon3055.draconicevolution.client.gui.componentguis.GUIToolConfig;
import com.brandon3055.draconicevolution.common.container.*;
import com.brandon3055.draconicevolution.common.container.ContainerAdvTool;
import com.brandon3055.draconicevolution.common.container.ContainerDislocatorInhibitor;
import com.brandon3055.draconicevolution.common.container.ContainerDissEnchanter;
import com.brandon3055.draconicevolution.common.container.ContainerDraconiumChest;
import com.brandon3055.draconicevolution.common.container.ContainerEnergyInfuser;
import com.brandon3055.draconicevolution.common.container.ContainerGenerator;
import com.brandon3055.draconicevolution.common.container.ContainerGrinder;
import com.brandon3055.draconicevolution.common.container.ContainerPlayerDetector;
import com.brandon3055.draconicevolution.common.container.ContainerReactor;
import com.brandon3055.draconicevolution.common.container.ContainerSunDial;
import com.brandon3055.draconicevolution.common.container.ContainerUpgradeModifier;
import com.brandon3055.draconicevolution.common.container.ContainerWeatherController;
import com.brandon3055.draconicevolution.common.inventory.InventoryTool;
import com.brandon3055.draconicevolution.common.tileentities.*;
import com.brandon3055.draconicevolution.common.tileentities.TileDislocatorInhibitor;
import com.brandon3055.draconicevolution.common.tileentities.TileDissEnchanter;
import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest;
import com.brandon3055.draconicevolution.common.tileentities.TileEnergyInfuser;
import com.brandon3055.draconicevolution.common.tileentities.TileGenerator;
import com.brandon3055.draconicevolution.common.tileentities.TileGrinder;
import com.brandon3055.draconicevolution.common.tileentities.TileParticleGenerator;
import com.brandon3055.draconicevolution.common.tileentities.TilePlayerDetectorAdvanced;
import com.brandon3055.draconicevolution.common.tileentities.TileSunDial;
import com.brandon3055.draconicevolution.common.tileentities.TileUpgradeModifier;
import com.brandon3055.draconicevolution.common.tileentities.TileWeatherController;
import com.brandon3055.draconicevolution.common.tileentities.gates.TileGate;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore;
@@ -34,6 +55,7 @@ public class GuiHandler implements IGuiHandler {
public static final int GUIID_FLOW_GATE = 13;
public static final int GUIID_REACTOR = 14;
public static final int GUIID_UPGRADE_MODIFIER = 15;
public static final int GUIID_DISLOCATOR_INHIBITOR = 16;
public static final int GUIID_CONTAINER_TEMPLATE = 100;
public GuiHandler() {
@@ -41,175 +63,155 @@ public class GuiHandler implements IGuiHandler {
}
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
switch (ID) {
case GUIID_WEATHER_CONTROLLER:
TileEntity te = world.getTileEntity(x, y, z);
if (te != null && te instanceof TileWeatherController) {
return new ContainerWeatherController(player.inventory, (TileWeatherController) te);
public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
TileEntity tile = world.getTileEntity(x, y, z);
switch (id) {
case GUIID_WEATHER_CONTROLLER -> {
if (tile instanceof TileWeatherController weatherController) {
return new ContainerWeatherController(player.inventory, weatherController);
}
break;
case GUIID_SUN_DIAL:
TileEntity te1 = world.getTileEntity(x, y, z);
if (te1 != null && te1 instanceof TileSunDial) {
return new ContainerSunDial(player.inventory, (TileSunDial) te1);
}
case GUIID_SUN_DIAL -> {
if (tile instanceof TileSunDial sunDial) {
return new ContainerSunDial(player.inventory, sunDial);
}
break;
case GUIID_GRINDER:
TileEntity te2 = world.getTileEntity(x, y, z);
if (te2 != null && te2 instanceof TileGrinder) {
return new ContainerGrinder(player.inventory, (TileGrinder) te2);
}
case GUIID_GRINDER -> {
if (tile instanceof TileGrinder grinder) {
return new ContainerGrinder(player.inventory, grinder);
}
break;
case GUIID_PLAYERDETECTOR:
TileEntity detector = world.getTileEntity(x, y, z);
if (detector != null && detector instanceof TilePlayerDetectorAdvanced) {
return new ContainerPlayerDetector(player.inventory, (TilePlayerDetectorAdvanced) detector);
}
case GUIID_PLAYERDETECTOR -> {
if (tile instanceof TilePlayerDetectorAdvanced detector) {
return new ContainerPlayerDetector(player.inventory, detector);
}
break;
case GUIID_ENERGY_INFUSER:
TileEntity infuser = world.getTileEntity(x, y, z);
if (infuser != null && infuser instanceof TileEnergyInfuser) {
return new ContainerEnergyInfuser(player.inventory, (TileEnergyInfuser) infuser);
}
case GUIID_ENERGY_INFUSER -> {
if (tile instanceof TileEnergyInfuser infuser) {
return new ContainerEnergyInfuser(player.inventory, infuser);
}
break;
case GUIID_GENERATOR:
TileEntity generator = world.getTileEntity(x, y, z);
if (generator != null && generator instanceof TileGenerator) {
return new ContainerGenerator(player.inventory, (TileGenerator) generator);
}
case GUIID_GENERATOR -> {
if (tile instanceof TileGenerator generator) {
return new ContainerGenerator(player.inventory, generator);
}
break;
case GUIID_DISSENCHANTER:
TileEntity dissenchanter = world.getTileEntity(x, y, z);
if (dissenchanter != null && dissenchanter instanceof TileDissEnchanter) {
return new ContainerDissEnchanter(player.inventory, (TileDissEnchanter) dissenchanter);
}
case GUIID_DISSENCHANTER -> {
if (tile instanceof TileDissEnchanter dissenchanter) {
return new ContainerDissEnchanter(player.inventory, dissenchanter);
}
break;
case GUIID_DRACONIC_CHEST:
TileEntity containerChest = world.getTileEntity(x, y, z);
if (containerChest != null && containerChest instanceof TileDraconiumChest) {
return new ContainerDraconiumChest(player.inventory, (TileDraconiumChest) containerChest);
}
case GUIID_DRACONIC_CHEST -> {
if (tile instanceof TileDraconiumChest draconiumChest) {
return new ContainerDraconiumChest(player.inventory, draconiumChest);
}
break;
case GUIID_REACTOR:
TileEntity reactor = world.getTileEntity(x, y, z);
if (reactor != null && reactor instanceof TileReactorCore) {
return new ContainerReactor(player, (TileReactorCore) reactor);
}
case GUIID_REACTOR -> {
if (tile instanceof TileReactorCore reactorCore) {
return new ContainerReactor(player, reactorCore);
}
break;
case GUIID_TOOL_CONFIG:
}
case GUIID_TOOL_CONFIG -> {
return new ContainerAdvTool(player.inventory, new InventoryTool(player, null));
case GUIID_UPGRADE_MODIFIER:
TileEntity containerTemp = world.getTileEntity(x, y, z);
if (containerTemp != null && containerTemp instanceof TileUpgradeModifier) {
return new ContainerUpgradeModifier(player.inventory, (TileUpgradeModifier) containerTemp);
}
case GUIID_UPGRADE_MODIFIER -> {
if (tile instanceof TileUpgradeModifier upgradeModifier) {
return new ContainerUpgradeModifier(player.inventory, upgradeModifier);
}
break;
// case GUIID_CONTAINER_TEMPLATE:
// TileEntity containerTemp = world.getTileEntity(x, y, z);
// if (containerTemp != null && containerTemp instanceof TileContainerTemplate) {
// return new ContainerTemplate(player.inventory, (TileContainerTemplate) containerTemp);
// }
// break;
}
case GUIID_DISLOCATOR_INHIBITOR -> {
if (tile instanceof TileDislocatorInhibitor inhibitor) {
return new ContainerDislocatorInhibitor(player.inventory, inhibitor);
}
}
}
return null;
}
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
switch (ID) {
case GUIID_WEATHER_CONTROLLER:
TileEntity te = world.getTileEntity(x, y, z);
if (te != null && te instanceof TileWeatherController) {
return new GUIWeatherController(player.inventory, (TileWeatherController) te);
public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
TileEntity tile = world.getTileEntity(x, y, z);
switch (id) {
case GUIID_WEATHER_CONTROLLER -> {
if (tile instanceof TileWeatherController weatherController) {
return new GUIWeatherController(player.inventory, weatherController);
}
break;
case GUIID_SUN_DIAL:
TileEntity te1 = world.getTileEntity(x, y, z);
if (te1 != null && te1 instanceof TileSunDial) {
return new GUISunDial(player.inventory, (TileSunDial) te1);
}
case GUIID_SUN_DIAL -> {
if (tile instanceof TileSunDial sunDial) {
return new GUISunDial(player.inventory, sunDial);
}
break;
case GUIID_TELEPORTER:
}
case GUIID_TELEPORTER -> {
return new GUITeleporter(player);
case GUIID_GRINDER:
TileEntity te2 = world.getTileEntity(x, y, z);
if (te2 != null && te2 instanceof TileGrinder) {
return new GUIGrinder(player.inventory, (TileGrinder) te2);
}
case GUIID_GRINDER -> {
if (tile instanceof TileGrinder grinder) {
return new GUIGrinder(player.inventory, grinder);
}
break;
case GUIID_PARTICLEGEN:
TileEntity gen = world.getTileEntity(x, y, z);
return (gen != null && gen instanceof TileParticleGenerator)
? new GUIParticleGenerator((TileParticleGenerator) gen, player)
: null;
case GUIID_PLAYERDETECTOR:
TileEntity detector = world.getTileEntity(x, y, z);
if (detector != null && detector instanceof TilePlayerDetectorAdvanced) {
return new GUIPlayerDetector(player.inventory, (TilePlayerDetectorAdvanced) detector);
}
case GUIID_PARTICLEGEN -> {
if (tile instanceof TileParticleGenerator particleGenerator) {
return new GUIParticleGenerator(particleGenerator);
}
break;
case GUIID_ENERGY_INFUSER:
TileEntity infuser = world.getTileEntity(x, y, z);
if (infuser != null && infuser instanceof TileEnergyInfuser) {
return new GUIEnergyInfuser(player.inventory, (TileEnergyInfuser) infuser);
}
case GUIID_PLAYERDETECTOR -> {
if (tile instanceof TilePlayerDetectorAdvanced detector) {
return new GUIPlayerDetector(player.inventory, detector);
}
break;
case GUIID_GENERATOR:
TileEntity generator = world.getTileEntity(x, y, z);
if (generator != null && generator instanceof TileGenerator) {
return new GUIGenerator(player.inventory, (TileGenerator) generator);
}
case GUIID_ENERGY_INFUSER -> {
if (tile instanceof TileEnergyInfuser infuser) {
return new GUIEnergyInfuser(player.inventory, infuser);
}
break;
case GUIID_MANUAL:
}
case GUIID_GENERATOR -> {
if (tile instanceof TileGenerator generator) {
return new GUIGenerator(player.inventory, generator);
}
}
case GUIID_MANUAL -> {
return new GUIManual();
case GUIID_DISSENCHANTER:
TileEntity dissenchanter = world.getTileEntity(x, y, z);
if (dissenchanter != null && dissenchanter instanceof TileDissEnchanter) {
return new GUIDissEnchanter(player.inventory, (TileDissEnchanter) dissenchanter);
}
case GUIID_DISSENCHANTER -> {
if (tile instanceof TileDissEnchanter dissenchanter) {
return new GUIDissEnchanter(player.inventory, dissenchanter);
}
break;
case GUIID_DRACONIC_CHEST:
TileEntity containerChest = world.getTileEntity(x, y, z);
if (containerChest != null && containerChest instanceof TileDraconiumChest) {
return new GUIDraconiumChest(player.inventory, (TileDraconiumChest) containerChest);
}
case GUIID_DRACONIC_CHEST -> {
if (tile instanceof TileDraconiumChest draconiumChest) {
return new GUIDraconiumChest(player.inventory, draconiumChest);
}
break;
case GUIID_REACTOR:
TileEntity reactor = world.getTileEntity(x, y, z);
if (reactor != null && reactor instanceof TileReactorCore) {
return new GUIReactor(
player,
(TileReactorCore) reactor,
new ContainerReactor(player, (TileReactorCore) reactor));
}
case GUIID_REACTOR -> {
if (tile instanceof TileReactorCore reactorCore) {
return new GUIReactor(reactorCore, new ContainerReactor(player, reactorCore));
}
break;
case GUIID_TOOL_CONFIG:
}
case GUIID_TOOL_CONFIG -> {
return new GUIToolConfig(
player,
new ContainerAdvTool(player.inventory, new InventoryTool(player, null)));
case GUIID_FLOW_GATE:
return world.getTileEntity(x, y, z) instanceof TileGate
? new GUIFlowGate((TileGate) world.getTileEntity(x, y, z))
: null;
case GUIID_UPGRADE_MODIFIER:
TileEntity containerTemp = world.getTileEntity(x, y, z);
if (containerTemp != null && containerTemp instanceof TileUpgradeModifier) {
}
case GUIID_FLOW_GATE -> {
if (tile instanceof TileGate gate) {
return new GUIFlowGate(gate);
}
}
case GUIID_UPGRADE_MODIFIER -> {
if (tile instanceof TileUpgradeModifier upgradeModifier) {
return new GUIUpgradeModifier(
player.inventory,
(TileUpgradeModifier) containerTemp,
new ContainerUpgradeModifier(player.inventory, (TileUpgradeModifier) containerTemp));
upgradeModifier,
new ContainerUpgradeModifier(player.inventory, upgradeModifier));
}
break;
// case GUIID_CONTAINER_TEMPLATE:
// TileEntity containerTemp = world.getTileEntity(x, y, z);
// if (containerTemp != null && containerTemp instanceof TileContainerTemplate) {
// return new GUIContainerTemplate(player.inventory, (TileContainerTemplate) containerTemp);
// }
// break;
}
case GUIID_DISLOCATOR_INHIBITOR -> {
if (tile instanceof TileDislocatorInhibitor inhibitor) {
return new GUIDislocatorInhibitor(player.inventory, inhibitor);
}
}
}
return null;
@@ -11,8 +11,8 @@ import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import com.brandon3055.brandonscore.client.gui.guicomponents.GUIBase;
import com.brandon3055.brandonscore.client.utills.GuiHelper;
import com.brandon3055.draconicevolution.client.utils.GuiHelper;
import com.brandon3055.draconicevolution.client.utils.guicomponents.GUIBase;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
/**
@@ -1,6 +1,13 @@
package com.brandon3055.draconicevolution.client.gui.componentguis;
import java.io.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
@@ -18,18 +25,23 @@ import org.apache.commons.io.IOUtils;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import com.brandon3055.brandonscore.client.gui.guicomponents.*;
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.ComponentIndexButton;
import com.brandon3055.draconicevolution.client.gui.guicomponents.ComponentManualPage;
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.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.handler.ContributorHandler;
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;
/**
@@ -535,7 +547,7 @@ public class GUIManual extends GUIScrollingBase implements GuiYesNoCallback {
@Override
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);
}
}
@@ -1,40 +1,49 @@
package com.brandon3055.draconicevolution.client.gui.componentguis;
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
import com.brandon3055.brandonscore.client.gui.guicomponents.*;
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.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.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore.ReactorState;
import com.brandon3055.draconicevolution.common.utils.Utils;
/**
* Created by brandon3055 on 30/7/2015.
*/
public class GUIReactor extends GUIBase {
private TileReactorCore reactor;
private ContainerReactor container;
private static boolean showStats = false;
private static boolean showStatistics = false;
private final TileReactorCore core;
private final ContainerReactor container;
public GUIReactor(EntityPlayer player, TileReactorCore reactor, ContainerReactor container) {
public GUIReactor(TileReactorCore core, ContainerReactor container) {
super(container, 248, 222);
this.reactor = reactor;
this.core = core;
this.container = container;
}
@Override
protected ComponentCollection assembleComponents() {
final ResourceLocation widgets = ResourceHandler.getResource("textures/gui/Widgets.png");
collection = new ComponentCollection(0, 0, 248, 222, this);
collection.addComponent(
new ComponentTexturedRect(0, 0, xSize, ySize, ResourceHandler.getResource("textures/gui/Reactor.png")));
@@ -50,7 +59,7 @@ public class GUIReactor extends GUIBase {
this,
"",
StatCollector.translateToLocal("button.de.reactorCharge.txt"),
ResourceHandler.getResource("textures/gui/Widgets.png")))
widgets))
.setName("CHARGE");
collection.addComponent(
new ComponentTextureButton(
@@ -64,7 +73,7 @@ public class GUIReactor extends GUIBase {
this,
"",
StatCollector.translateToLocal("button.de.reactorStart.txt"),
ResourceHandler.getResource("textures/gui/Widgets.png")))
widgets))
.setName("ACTIVATE");
collection.addComponent(
new ComponentTextureButton(
@@ -78,7 +87,7 @@ public class GUIReactor extends GUIBase {
this,
"",
StatCollector.translateToLocal("button.de.reactorStop.txt"),
ResourceHandler.getResource("textures/gui/Widgets.png")))
widgets))
.setName("DEACTIVATE");
collection.addComponent(
new ComponentButton(
@@ -95,10 +104,10 @@ public class GUIReactor extends GUIBase {
}
@Override
protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
super.drawGuiContainerBackgroundLayer(partialTicks, mouseX, mouseY);
// Draw I/O Slots
if (reactor.reactorState == TileReactorCore.STATE_OFFLINE) {
if (core.reactorState == ReactorState.OFFLINE) {
RenderHelper.enableGUIStandardItemLighting();
drawTexturedModalRect(guiLeft + 14, guiTop + 139, 14, ySize, 18, 18);
drawTexturedModalRect(guiLeft + 216, guiTop + 139, 32, ySize, 18, 18);
@@ -123,96 +132,90 @@ public class GUIReactor extends GUIBase {
GL11.glColor4f(1f, 1f, 1f, 1f);
// Draw Indicators
double value = Math.min(reactor.reactionTemperature, reactor.maxReactTemperature) / reactor.maxReactTemperature;
double value = Math.min(core.reactionTemperature, core.maxReactTemperature) / core.maxReactTemperature;
int pixOffset = (int) (value * 108);
drawTexturedModalRect(11, 112 - pixOffset, 0, 222, 14, 5);
value = reactor.fieldCharge / reactor.maxFieldCharge;
value = core.fieldCharge / core.maxFieldCharge;
pixOffset = (int) (value * 108);
drawTexturedModalRect(35, 112 - pixOffset, 0, 222, 14, 5);
value = (double) reactor.energySaturation / (double) reactor.maxEnergySaturation;
value = (double) core.energySaturation / (double) core.maxEnergySaturation;
pixOffset = (int) (value * 108);
drawTexturedModalRect(199, 112 - pixOffset, 0, 222, 14, 5);
value = ((double) reactor.convertedFuel) / ((double) reactor.reactorFuel + (double) reactor.convertedFuel);
value = ((double) core.convertedFuel) / ((double) core.reactorFuel + (double) core.convertedFuel);
pixOffset = (int) (value * 108);
drawTexturedModalRect(223, 112 - pixOffset, 0, 222, 14, 5);
GL11.glColor4f(1F, 1F, 1F, 1F);
if (!showStats) {
if (showStatistics) {
ResourceHandler.bindResource("textures/gui/Reactor.png");
for (int i = 1; i <= 10; i++) {
drawTexturedModalRect(63, i * 12, 0, 240, 122, 16);
}
drawStatistics();
} else {
GL11.glPushMatrix();
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
GL11.glTranslated(124, 71, 100);
double scale = 100 / (reactor.getCoreDiameter());
double scale = 100 / (core.getCoreDiameter());
GL11.glScaled(scale, scale, scale);
GL11.glColor4f(1F, 1F, 1F, 1F);
GL11.glDisable(GL11.GL_CULL_FACE);
TileEntityRendererDispatcher.instance.renderTileEntityAt(reactor, -0.5D, -0.5D, -0.5D, 0.0F);
TileEntityRendererDispatcher.instance.renderTileEntityAt(core, -0.5D, -0.5D, -0.5D, 0.0F);
GL11.glPopAttrib();
GL11.glPopMatrix();
} else {
ResourceHandler.bindResource("textures/gui/Reactor.png");
for (int i = 1; i <= 10; i++) drawTexturedModalRect(63, i * 12, 0, 240, 122, 16);
drawStats();
drawStatus();
}
String status = StatCollector.translateToLocal("gui.de.status.txt") + ": "
+ (reactor.reactorState == 0 ? EnumChatFormatting.DARK_GRAY
: reactor.reactorState == 1 ? EnumChatFormatting.RED
: reactor.reactorState == 2 ? EnumChatFormatting.DARK_GREEN : EnumChatFormatting.RED)
+ StatCollector.translateToLocal("gui.de.status" + reactor.reactorState + ".txt");
if (reactor.reactorState == 1 && reactor.canStart())
status = StatCollector.translateToLocal("gui.de.status.txt") + ": "
+ EnumChatFormatting.DARK_GREEN
+ StatCollector.translateToLocal("gui.de.status1_5.txt");
if (!showStats) fontRendererObj.drawString(status, xSize - 5 - fontRendererObj.getStringWidth(status), 125, 0);
}
@Override
public void drawScreen(int mouseX, int mouseY, float par3) {
super.drawScreen(mouseX, mouseY, par3);
List<String> text = new ArrayList<String>();
@SuppressWarnings("unchecked")
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
super.drawScreen(mouseX, mouseY, partialTicks);
List<String> text = new ArrayList<>();
if (GuiHelper.isInRect(9, 4, 18, 114, mouseX - guiLeft, mouseY - guiTop)) {
text.add(StatCollector.translateToLocal("gui.de.reactionTemp.txt"));
text.add((int) reactor.reactionTemperature + "C");
text.add((int) core.reactionTemperature + "C");
drawHoveringText(text, mouseX, mouseY, fontRendererObj);
} else if (GuiHelper.isInRect(33, 4, 18, 114, mouseX - guiLeft, mouseY - guiTop)) {
text.add(StatCollector.translateToLocal("gui.de.fieldStrength.txt"));
if (reactor.maxFieldCharge > 0)
text.add(Utills.round(reactor.fieldCharge / reactor.maxFieldCharge * 100D, 100D) + "%");
text.add(
Utills.addCommas((int) reactor.fieldCharge) + " / "
+ Utills.addCommas((int) reactor.maxFieldCharge)); // todo refine or remove
if (core.maxFieldCharge > 0) {
text.add(Utils.round(core.fieldCharge / core.maxFieldCharge * 100D, 100D) + "%");
}
text.add(formatNumber((int) core.fieldCharge) + " / " + formatNumber((int) core.maxFieldCharge));
drawHoveringText(text, mouseX, mouseY, fontRendererObj);
} else if (GuiHelper.isInRect(197, 4, 18, 114, mouseX - guiLeft, mouseY - guiTop)) {
text.add(StatCollector.translateToLocal("gui.de.energySaturation.txt"));
if (reactor.maxEnergySaturation > 0) text.add(
Utills.round((double) reactor.energySaturation / (double) reactor.maxEnergySaturation * 100D, 100D)
+ "%");
text.add(
Utills.addCommas(reactor.energySaturation) + " / " + Utills.addCommas(reactor.maxEnergySaturation)); // todo
// refine
// or
// remove
if (core.maxEnergySaturation > 0) {
text.add(
Utils.round((double) core.energySaturation / (double) core.maxEnergySaturation * 100D, 100D)
+ "%");
}
text.add(formatNumber(core.energySaturation) + " / " + formatNumber(core.maxEnergySaturation));
drawHoveringText(text, mouseX, mouseY, fontRendererObj);
} else if (GuiHelper.isInRect(221, 4, 18, 114, mouseX - guiLeft, mouseY - guiTop)) {
text.add(StatCollector.translateToLocal("gui.de.fuelConversion.txt"));
if (reactor.reactorFuel + reactor.convertedFuel > 0) text.add(
Utills.round(
((double) reactor.convertedFuel + reactor.conversionUnit)
/ ((double) reactor.convertedFuel + (double) reactor.reactorFuel)
* 100D,
100D) + "%");
text.add(reactor.convertedFuel + " / " + (reactor.convertedFuel + reactor.reactorFuel)); // todo refine or
// remove
if (core.reactorFuel + core.convertedFuel > 0) {
text.add(
Utils.round(
((double) core.convertedFuel + core.conversionUnit)
/ ((double) core.convertedFuel + (double) core.reactorFuel)
* 100D,
100D) + "%");
}
text.add(core.convertedFuel + " / " + (core.convertedFuel + core.reactorFuel));
text.add(
"Full: " + (Utils.round(
(float) (core.convertedFuel + core.reactorFuel) / ConfigHandler.reactorFuelStorage * 100,
1000)) + "%");
drawHoveringText(text, mouseX, mouseY, fontRendererObj);
}
if (showStats) {
if (showStatistics) {
if (GuiHelper.isInRect(53, 15, 140, 18, mouseX - guiLeft, mouseY - guiTop)) {
text.addAll(
fontRendererObj.listFormattedStringToWidth(
@@ -247,58 +250,61 @@ public class GUIReactor extends GUIBase {
}
}
private void drawStats() {
double inputRate = reactor.fieldDrain / (1D - (reactor.fieldCharge / reactor.maxFieldCharge));
private void drawStatistics() {
double inputRate = core.fieldDrain / (1D - (core.fieldCharge / core.maxFieldCharge));
fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.tempLoad.name"), 55, 16, 0x0000FF);
fontRendererObj.drawString(Utills.round(reactor.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(
Utills.round((reactor.reactorFuel + reactor.convertedFuel) / 1296D, 100) + "m^3",
Utils.round((core.reactorFuel + core.convertedFuel) / 1296D, 100) + "m^3",
60,
2 + 2 * 24,
0);
fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.genRate.name"), 55, 16 + 2 * 24, 0x0000FF);
fontRendererObj.drawString(Utills.addCommas((int) reactor.generationRate) + "RF/t", 60, 2 + 3 * 24, 0);
fontRendererObj.drawString(formatNumber((int) core.generationRate) + "RF/t", 60, 2 + 3 * 24, 0);
fontRendererObj
.drawString(StatCollector.translateToLocal("gui.de.fieldInputRate.name"), 55, 16 + 3 * 24, 0x0000FF);
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
.drawString(StatCollector.translateToLocal("gui.de.fuelConversion.name"), 55, 16 + 4 * 24, 0x0000FF);
fontRendererObj.drawString(
Utills.addCommas((int) Math.round(reactor.fuelUseRate * 1000000D)) + "nb/t",
60,
2 + 5 * 24,
0);
fontRendererObj
.drawString(formatNumber((int) Math.round(core.fuelUseRate * 1000000D)) + "nb/t", 60, 2 + 5 * 24, 0);
}
private void drawStatus() {
String status = StatCollector.translateToLocal("gui.de.status.txt") + ": ";
switch (core.reactorState) {
case OFFLINE -> status += EnumChatFormatting.DARK_GRAY;
case STARTING, STOPPING -> status += EnumChatFormatting.RED;
case ONLINE -> status += EnumChatFormatting.DARK_GREEN;
case INVALID -> status += EnumChatFormatting.DARK_RED;
}
status += core.reactorState.toLocalizedString(core.canStart());
fontRendererObj.drawString(status, xSize - 5 - fontRendererObj.getStringWidth(status), 125, 0);
}
@Override
public void updateScreen() {
if (reactor.reactorState == TileReactorCore.STATE_INVALID
|| reactor.reactorState == TileReactorCore.STATE_OFFLINE
|| reactor.reactorState == TileReactorCore.STATE_STOP)
collection.getComponent("DEACTIVATE").setEnabled(false);
else collection.getComponent("DEACTIVATE").setEnabled(true);
if ((reactor.reactorState == TileReactorCore.STATE_OFFLINE
|| (reactor.reactorState == TileReactorCore.STATE_STOP && !reactor.canStart())) && reactor.canCharge())
collection.getComponent("CHARGE").setEnabled(true);
else collection.getComponent("CHARGE").setEnabled(false);
if ((reactor.reactorState == TileReactorCore.STATE_START || reactor.reactorState == TileReactorCore.STATE_STOP)
&& reactor.canStart())
collection.getComponent("ACTIVATE").setEnabled(true);
else collection.getComponent("ACTIVATE").setEnabled(false);
collection.getComponent("DEACTIVATE")
.setEnabled(core.reactorState == ReactorState.STARTING || core.reactorState == ReactorState.ONLINE);
collection.getComponent("CHARGE").setEnabled(
(core.reactorState == ReactorState.OFFLINE
|| (core.reactorState == ReactorState.STOPPING && !core.canStart())) && core.canCharge());
collection.getComponent("ACTIVATE").setEnabled(
(core.reactorState == ReactorState.STARTING || core.reactorState == ReactorState.STOPPING)
&& core.canStart());
super.updateScreen();
}
@Override
public void buttonClicked(int id, int button) {
super.buttonClicked(id, button);
if (id < 3) container.sendObjectToServer(null, 20, id);
else if (id == 3) {
showStats = !showStats;
((ComponentButton) collection.getComponent("STATS")).hoverText = showStats
if (id < 3) {
container.sendObjectToServer(null, 20, id);
} else if (id == 3) {
showStatistics = !showStatistics;
((ComponentButton) collection.getComponent("STATS")).hoverText = showStatistics
? StatCollector.translateToLocal("button.de.statsHide.txt")
: StatCollector.translateToLocal("button.de.statsShow.txt");
}
@@ -1,5 +1,7 @@
package com.brandon3055.draconicevolution.client.gui.componentguis;
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
import java.util.ArrayList;
import java.util.List;
@@ -11,23 +13,29 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraft.util.StringUtils;
import com.brandon3055.brandonscore.client.gui.guicomponents.*;
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
import com.brandon3055.brandonscore.common.utills.Utills;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.gui.GuiHudConfig;
import com.brandon3055.draconicevolution.client.gui.guicomponents.ComponentConfigItemButton;
import com.brandon3055.draconicevolution.client.gui.guicomponents.ComponentFieldAdjuster;
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.handler.ContributorHandler;
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.network.ContributorPacket;
import com.brandon3055.draconicevolution.common.network.ItemConfigPacket;
import com.brandon3055.draconicevolution.common.utills.IConfigurableItem;
import com.brandon3055.draconicevolution.common.utills.IInventoryTool;
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
import com.brandon3055.draconicevolution.common.utils.IConfigurableItem;
import com.brandon3055.draconicevolution.common.utils.IInventoryTool;
import com.brandon3055.draconicevolution.common.utils.ItemConfigField;
import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper;
/**
* Created by Brandon on 26/12/2014.
@@ -303,11 +311,11 @@ public class GUIToolConfig extends GUIBase {
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
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);
if (!properties.canFire() && properties.cantFireMessage != null
&& !properties.cantFireMessage.equals("msg.de.outOfArrows.name")) {
&& !properties.cantFireMessage.equals("msg.de.outOfArrows.txt")) {
fontRendererObj.drawSplitString(
StatCollector.translateToLocal(properties.cantFireMessage),
0,
@@ -319,7 +327,7 @@ public class GUIToolConfig extends GUIBase {
List<String> list = new ArrayList<String>();
list.add(
StatCollector.translateToLocal("gui.de.rfPerShot.txt") + ": "
+ Utills.addCommas(properties.calculateEnergyCost()));
+ formatNumber(properties.calculateEnergyCost()));
list.add(
StatCollector.translateToLocal("gui.de.maxDamage.txt") + ": "
+ properties.arrowDamage * (properties.arrowSpeed * 3));
@@ -6,7 +6,12 @@ import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import com.brandon3055.brandonscore.client.gui.guicomponents.*;
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.ComponentSlotBackground;
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.lib.References;
@@ -4,7 +4,7 @@ import net.minecraft.util.StatCollector;
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.
@@ -9,11 +9,11 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
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.utills.IConfigurableItem;
import com.brandon3055.draconicevolution.common.utills.IInventoryTool;
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
import com.brandon3055.draconicevolution.common.utils.IConfigurableItem;
import com.brandon3055.draconicevolution.common.utils.IInventoryTool;
import com.brandon3055.draconicevolution.common.utils.ItemConfigField;
/**
* Created by Brandon on 29/12/2014.
@@ -17,13 +17,13 @@ import net.minecraft.util.StringUtils;
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.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.Contributor;
import com.brandon3055.draconicevolution.common.utils.InfoHelper;
/**
* Created by brandon3055 on 5/11/2015.
@@ -188,7 +188,7 @@ public class ComponentContributorsPage extends ComponentScrollingBase implements
@Override
public void confirmClicked(boolean confirmed, int button) {
mc.displayGuiScreen(this.gui);
if (confirmed) ClientUtills.openLink(lastClickURL);
if (confirmed) ClientUtils.openLink(lastClickURL);
}
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.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.utils.GuiHelper;
import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentBase;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.utills.IConfigurableItem;
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
import com.brandon3055.draconicevolution.common.utils.DataUtils;
import com.brandon3055.draconicevolution.common.utils.IConfigurableItem;
import com.brandon3055.draconicevolution.common.utils.ItemConfigField;
/**
* 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));
ItemStack stack = gui.player.inventory.getStackInSlot(field.slot);
if (stack != null && stack.getItem() instanceof IConfigurableItem) {
DataUtills.writeObjectToCompound(
DataUtils.writeObjectToCompound(
IConfigurableItem.ProfileHelper.getProfileCompound(stack),
field.value,
field.datatype,
@@ -9,12 +9,12 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
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.utils.guicomponents.ComponentBase;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.utills.IConfigurableItem;
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
import com.brandon3055.draconicevolution.common.utils.DataUtils;
import com.brandon3055.draconicevolution.common.utils.IConfigurableItem;
import com.brandon3055.draconicevolution.common.utils.ItemConfigField;
/**
* Created by Brandon on 31/12/2014.
@@ -96,7 +96,7 @@ public class ComponentFieldButton extends ComponentBase {
field.sendChanges();
ItemStack stack = gui.player.inventory.getStackInSlot(field.slot);
if (stack != null && stack.getItem() instanceof IConfigurableItem) {
DataUtills.writeObjectToCompound(
DataUtils.writeObjectToCompound(
IConfigurableItem.ProfileHelper.getProfileCompound(stack),
field.value,
field.datatype,
@@ -6,11 +6,11 @@ import net.minecraft.item.ItemStack;
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.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.
@@ -23,7 +23,7 @@ public class ComponentIndexButton extends ComponentScrollingBase {
public ComponentIndexButton(int x, int y, GUIScrollingBase gui, ManualPage page) {
super(x, y, gui);
this.page = page;
stack = Utills.getStackFromName(page.name, page.meta);
stack = Utils.getStackFromName(page.name, page.meta);
}
@Override
@@ -9,7 +9,11 @@ import java.util.Map;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.*;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.ShapedRecipes;
import net.minecraft.item.crafting.ShapelessRecipes;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
@@ -17,14 +21,14 @@ import net.minecraftforge.oredict.ShapelessOreRecipe;
import org.apache.commons.io.FilenameUtils;
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.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.
@@ -44,7 +48,7 @@ public class ComponentManualPage extends ComponentScrollingBase {
super(x, y, gui);
this.page = page;
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);
pageLength += title.getHeight();
contentList.add(title);
@@ -153,7 +157,7 @@ public class ComponentManualPage extends ComponentScrollingBase {
} else if (type == 2) {
String s = content.substring(content.indexOf("[c]") + 3);
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;
if (stack != null) {
@@ -1,8 +1,5 @@
package com.brandon3055.draconicevolution.client.handler;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Random;
import net.minecraft.client.Minecraft;
@@ -10,124 +7,71 @@ import net.minecraft.client.model.ModelBiped;
import net.minecraft.entity.Entity;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.IAttributeInstance;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.event.FOVUpdateEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
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.common.ModItems;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
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.WyvernArmor;
import com.brandon3055.draconicevolution.common.items.weapons.BowHandler;
import com.brandon3055.draconicevolution.common.items.weapons.DraconicBow;
import com.brandon3055.draconicevolution.common.items.weapons.WyvernBow;
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.SubscribeEvent;
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.
*/
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 static float previousFOB = 0f;
public static float previousSensitivity = 0;
public static boolean bowZoom = false;
public static boolean lastTickBowZoom = false;
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"));
}
private int elapsedTicks;
private int remountTicksRemaining = 0;
private int remountEntityID = 0;
private float energyCrystalAlphaValue = 0f;
private float energyCrystalAlphaTarget = 0f;
@SubscribeEvent
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;
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();
else if (mc.theWorld != null) {
final Minecraft mc = Minecraft.getMinecraft();
if (mc.theWorld != null) {
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 (Math.abs(energyCrystalAlphaTarget - energyCrystalAlphaValue) <= 0.02f)
energyCrystalAlphaTarget = rand.nextFloat();
playerHoldingWrench = mc.thePlayer.getHeldItem() != null
&& mc.thePlayer.getHeldItem().getItem() == ModItems.wrench;
if (Math.abs(energyCrystalAlphaTarget - energyCrystalAlphaValue) <= 0.02f) {
energyCrystalAlphaTarget = RANDOM.nextFloat();
}
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)
public void fovUpdate(FOVUpdateEvent event) {
// region Bow FOV Update
if (event.entity.getHeldItem() != null
&& (event.entity.getHeldItem().getItem() instanceof WyvernBow
|| event.entity.getHeldItem().getItem() instanceof DraconicBow)
final ItemStack heldItem = event.entity.getHeldItem();
if (heldItem != null && (heldItem.getItem() instanceof WyvernBow || heldItem.getItem() instanceof DraconicBow)
&& Minecraft.getMinecraft().gameSettings.keyBindUseItem.getIsKeyPressed()) {
BowHandler.BowProperties properties = new BowHandler.BowProperties(
event.entity.getHeldItem(),
event.entity);
BowHandler.BowProperties properties = new BowHandler.BowProperties(heldItem, event.entity);
event.newfov = ((6 - properties.zoomModifier) / 6) * event.fov;
@@ -142,9 +86,9 @@ public class ClientEventHandler {
// endregion
// 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
.getEntityAttribute(SharedMonsterAttributes.movementSpeed);
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;
remountTicksRemaining = 500;
remountEntityID = id;
@@ -186,7 +130,7 @@ public class ClientEventHandler {
@SubscribeEvent
public void renderArmorEvent(RenderPlayerEvent.SetArmorModel event) {
if (ConfigHandler.useOriginal3DArmorModel || ConfigHandler.useOldArmorModel || event.isCanceled()) return;
if (ConfigHandler.useOriginal3DArmorModel || ConfigHandler.useOldArmorModel) return;
if (event.stack != null
&& (event.stack.getItem() instanceof DraconicArmor || event.stack.getItem() instanceof WyvernArmor)) {
ItemArmor itemarmor = (ItemArmor) event.stack.getItem();
@@ -199,52 +143,11 @@ public class ClientEventHandler {
}
}
@SubscribeEvent
public void renderPlayerEvent(RenderPlayerEvent.Post event) {
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");
public int getElapsedTicks() {
return elapsedTicks;
}
float p = playerShieldStatus.get(event.entityPlayer).getKey();
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();
}
public float getEnergyCrystalAlpha() {
return energyCrystalAlphaValue;
}
}
@@ -1,5 +1,7 @@
package com.brandon3055.draconicevolution.client.handler;
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
import java.util.ArrayList;
import java.util.List;
@@ -14,49 +16,44 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent;
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.utils.GuiHelper;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.items.armor.CustomArmorHandler;
import com.brandon3055.draconicevolution.common.utills.IHudDisplayBlock;
import com.brandon3055.draconicevolution.common.utills.IHudDisplayItem;
import com.brandon3055.draconicevolution.common.items.armor.ArmorSummary;
import com.brandon3055.draconicevolution.common.utils.IHudDisplayBlock;
import com.brandon3055.draconicevolution.common.utils.IHudDisplayItem;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import cpw.mods.fml.common.gameevent.TickEvent;
/**
* Created by Brandon on 26/01/2015.
*/
public class HudHandler {
public final class HudHandler {
private static List<String> hudList = null;
private static List<String> ltHudList = null;
private static float toolTipFadeOut = 0F;
private static float armorStatsFadeOut = 0F;
private static boolean showShieldHud = false;
private static int shieldPercentCharge = 0;
private static float shieldPoints = 0F;
private static float maxShieldPoints = 0F;
private static float shieldEntropy = 0F;
private static int rfCharge = 0;
private static long rfTotal = 0;
int width;
int height;
private List<String> hudList = null;
private List<String> ltHudList = null;
private float toolTipFadeOut = 0F;
private float armorStatsFadeOut = 0F;
private boolean showShieldHud = false;
private int shieldPercentCharge = 0;
private float shieldPoints = 0F;
private float maxShieldPoints = 0F;
private float shieldEntropy = 0F;
private int rfCharge = 0;
private long rfTotal = 0;
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void drawHUD(RenderGameOverlayEvent.Post event) {
Minecraft mc = Minecraft.getMinecraft();
if (event.type != RenderGameOverlayEvent.ElementType.ALL || mc.gameSettings.showDebugInfo
|| mc.currentScreen instanceof GuiChat)
|| mc.currentScreen instanceof GuiChat) {
return;
}
ScaledResolution resolution = event.resolution;
width = resolution.getScaledWidth();
height = resolution.getScaledHeight();
final int width = resolution.getScaledWidth();
final int height = resolution.getScaledHeight();
FontRenderer fontRenderer = mc.fontRenderer;
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
@SideOnly(Side.CLIENT)
public static void clientTick() {
@SubscribeEvent
public void tickEnd(TickEvent.ClientTickEvent event) {
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)) {
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
&& armorStatsFadeOut > 1F - ((float) ConfigHandler.hudSettings[7] * 0.25F)) {
armorStatsFadeOut -= 0.1F;
@@ -107,7 +111,7 @@ public class HudHandler {
if (mc.currentScreen != null) {
if (mc.currentScreen instanceof GuiHudConfig) {
hudList = new ArrayList<String>();
hudList = new ArrayList<>();
hudList.add(StatCollector.translateToLocal("info.de.hudDisplayConfigTxt1.txt"));
hudList.add("");
hudList.add("");
@@ -129,26 +133,41 @@ public class HudHandler {
.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;
return;
}
if (!shouldDisplayArmorHud(summary)) {
showShieldHud = false;
armorStatsFadeOut = 0F;
maxShieldPoints = 0F;
shieldPoints = 0F;
shieldPercentCharge = 0;
shieldEntropy = 0F;
rfCharge = 0;
rfTotal = 0;
return;
}
showShieldHud = armorStatsFadeOut > 0F;
if (maxShieldPoints != summery.maxProtectionPoints || shieldPoints != summery.protectionPoints
|| shieldEntropy != summery.entropy
|| rfTotal != summery.totalEnergyStored)
if (maxShieldPoints != summary.maxProtectionPoints || shieldPoints != summary.protectionPoints
|| shieldEntropy != summary.entropy
|| rfTotal != summary.totalEnergyStored)
armorStatsFadeOut = 5F;
maxShieldPoints = summery.maxProtectionPoints;
shieldPoints = summery.protectionPoints;
shieldPercentCharge = (int) (summery.protectionPoints / summery.maxProtectionPoints * 100D);
shieldEntropy = summery.entropy;
rfCharge = (int) ((double) summery.totalEnergyStored / Math.max((double) summery.maxTotalEnergyStorage, 1D)
maxShieldPoints = summary.maxProtectionPoints;
shieldPoints = summary.protectionPoints;
shieldPercentCharge = (int) (summary.protectionPoints / summary.maxProtectionPoints * 100D);
shieldEntropy = summary.entropy;
rfCharge = (int) ((double) summary.totalEnergyStored / Math.max((double) summary.maxTotalEnergyStorage, 1D)
* 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) {
@@ -213,7 +232,7 @@ public class HudHandler {
GL11.glTranslated(-x, -y, 0);
String shield = Math.round(shieldPoints) + "/" + (int) maxShieldPoints;
String entropy = "EN: " + (int) shieldEntropy + "%";
String energy = "RF: " + Utills.formatNumber(rfTotal);
String energy = "RF: " + formatNumber(rfTotal);
float fade = Math.min(armorStatsFadeOut, 1F);
if (!rotated) {
fontRenderer
@@ -2,54 +2,64 @@ package com.brandon3055.draconicevolution.client.handler;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
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 ItemStack itemStack;
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) {
this.ticks = ticks;
}
public void startDrawing(ItemStack itemStack) {
this.itemStack = itemStack;
this.itemStack = itemStack == null ? null : itemStack.copy();
ticksCounter = ticks;
}
public void tick() {
if (--ticksCounter == 0) {
itemStack = null;
@SubscribeEvent
public void tickEnd(TickEvent.ClientTickEvent event) {
if (event.phase == TickEvent.Phase.END) {
if (--ticksCounter == 0) {
itemStack = null;
}
}
}
public void drawItemStack(ScaledResolution resolution) {
if (ticksCounter > 0 && itemStack != null && itemStack.getItem() != null) {
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderHelper.enableGUIStandardItemLighting();
@SubscribeEvent
public void renderGameOverlayEvent(RenderGameOverlayEvent.Post event) {
if (event.type == RenderGameOverlayEvent.ElementType.ALL) {
if (ticksCounter > 0 && itemStack != null && itemStack.getItem() != null) {
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderHelper.enableGUIStandardItemLighting();
GL11.glPushMatrix();
final int y = resolution.getScaledHeight();
GL11.glTranslatef(7.0f, y * 0.25f, 0);
renderItem.renderItemAndEffectIntoGUI(fontRenderer, textureManager, itemStack, 0, 0);
GL11.glPopMatrix();
GL11.glPushMatrix();
final int y = event.resolution.getScaledHeight();
GL11.glTranslatef(7.0f, y * 0.25f, 0);
renderItem.renderItemAndEffectIntoGUI(fontRenderer, textureManager, itemStack, 0, 0);
GL11.glPopMatrix();
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glDisable(GL11.GL_BLEND);
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glDisable(GL11.GL_BLEND);
}
}
}
}
@@ -2,7 +2,6 @@ package com.brandon3055.draconicevolution.client.handler;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.world.World;
import com.brandon3055.draconicevolution.client.render.particle.ParticleDistortion;
@@ -10,16 +9,14 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleHandler {
private static Minecraft mc = Minecraft.getMinecraft();
private static World theWorld = mc.theWorld;
public final class ParticleHandler {
public static EntityFX spawnParticle(String particleName, double x, double y, double z, double motionX,
double motionY, double motionZ, float scale) {
final Minecraft mc = Minecraft.getMinecraft();
if (mc != null && mc.renderViewEntity != null && mc.effectRenderer != null) {
int var14 = mc.gameSettings.particleSetting;
if (var14 == 1 && theWorld.rand.nextInt(3) == 0) {
if (var14 == 1 && mc.theWorld.rand.nextInt(3) == 0) {
var14 = 2;
}
double var15 = mc.renderViewEntity.posX - x;
@@ -34,7 +31,7 @@ public class ParticleHandler {
} else {
if (particleName.equals("distortionParticle")) {
var21 = new ParticleDistortion(
theWorld,
mc.theWorld,
x,
y,
z,
@@ -56,9 +53,10 @@ public class ParticleHandler {
}
public static EntityFX spawnCustomParticle(EntityFX particle, double vewRange) {
final Minecraft mc = Minecraft.getMinecraft();
if (mc != null && mc.renderViewEntity != null && mc.effectRenderer != null) {
int var14 = mc.gameSettings.particleSetting;
if (var14 == 1 && theWorld.rand.nextInt(3) == 0) {
if (var14 == 1 && mc.theWorld.rand.nextInt(3) == 0) {
var14 = 2;
}
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) {
final Minecraft mc = Minecraft.getMinecraft();
if (mc == null || mc.renderViewEntity == null || mc.effectRenderer == null) return false;
double var15 = mc.renderViewEntity.posX - x;
double var17 = mc.renderViewEntity.posY - y;
double var19 = mc.renderViewEntity.posZ - z;
if (var15 * var15 + var17 * var17 + var19 * var19 > vewRange * vewRange) {
return false;
}
return true;
return !(var15 * var15 + var17 * var17 + var19 * var19 > vewRange * vewRange);
}
}
@@ -1,11 +1,21 @@
package com.brandon3055.draconicevolution.client.handler;
import java.awt.image.BufferedImage;
import java.io.*;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.reflect.Field;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import javax.imageio.ImageIO;
@@ -17,9 +27,9 @@ import net.minecraft.util.ResourceLocation;
import org.apache.commons.io.FilenameUtils;
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.utills.LogHelper;
import com.brandon3055.draconicevolution.common.utils.LogHelper;
import com.google.common.io.ByteStreams;
import com.google.gson.stream.JsonWriter;
@@ -39,7 +49,7 @@ public class ResourceHandler {
private static ResourceLocation particles = new ResourceLocation(
References.RESOURCESPREFIX + "textures/particle/particles.png");
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 File saveFolder;
@@ -55,7 +65,6 @@ public class ResourceHandler {
if (downloadThread.isReloadRequired()) LogHelper.info("Image Download Finished");
downloadStatus = downloadThread.wasSuccessful ? 1 : 2;
FMLCommonHandler.instance().bus().unregister(this);
addRSPack(event != null);
downloadThread = null;
}
}
@@ -65,6 +74,10 @@ public class ResourceHandler {
if (event != null) savePath = event.getModConfigurationDirectory().getParentFile().getAbsolutePath()
+ "/config/draconicevolution";
// Register the namespace before FML's final reload; folder-pack files are resolved on demand.
getImagesFolder();
addRSPack();
GUIManual.loadPages();
downloadThread = new DownloadThread(GUIManual.imageURLs);
@@ -74,7 +87,7 @@ public class ResourceHandler {
public static class DownloadThread extends Thread {
private List<String> imageURLs;
private boolean isFinished = false;
private volatile boolean isFinished = false;
private boolean wasSuccessful = true;
private boolean reloadRequired = false;
@@ -162,7 +175,7 @@ public class ResourceHandler {
}
}
private static void addRSPack(boolean refreash) {
private static void addRSPack() {
File rspack = new File(getConfigFolder(), "/resources");
if (!rspack.exists()) return;
@@ -191,7 +204,6 @@ public class ResourceHandler {
f.set(Minecraft.getMinecraft(), defaultResourcePacks);
LogHelper.info("RS Added");
if (refreash) Minecraft.getMinecraft().refreshResources();
} catch (IllegalAccessException e) {
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,42 +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 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;
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);
}
private KeyBindings() {}
public static void init() {
ClientRegistry.registerKeyBinding(placeItem);
ClientRegistry.registerKeyBinding(toolConfig);
ClientRegistry.registerKeyBinding(toolProfileChange);
ClientRegistry.registerKeyBinding(toggleFlight);
ClientRegistry.registerKeyBinding(toggleMagnet);
}
}
@@ -1,24 +1,36 @@
package com.brandon3055.draconicevolution.client.keybinding;
import java.util.Objects;
import java.util.Optional;
import javax.annotation.Nonnull;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.items.tools.Magnet;
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.MagnetTogglePacket;
import com.brandon3055.draconicevolution.common.network.MagnetToggleSelfPickupPacket;
import com.brandon3055.draconicevolution.common.network.PlacedItemPacket;
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.utils.InventoryUtils;
import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper;
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.gameevent.InputEvent;
import cpw.mods.fml.relauncher.Side;
@@ -27,48 +39,97 @@ import cpw.mods.fml.relauncher.SideOnly;
/**
* 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)
@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent event) {
if (KeyBindings.placeItem.isPressed()) {
handlePlaceItemKey();
} else if (KeyBindings.toolConfig.isPressed()) {
DraconicEvolution.network.sendToServer(new ButtonPacket(ButtonPacket.ID_TOOLCONFIG, false));
} else if (KeyBindings.toolProfileChange.isPressed() && Minecraft.getMinecraft().thePlayer != null
&& Minecraft.getMinecraft().thePlayer.getItemInUse() == null) {
DraconicEvolution.network
.sendToServer(new ButtonPacket(ButtonPacket.ID_TOOL_PROFILE_CHANGE, false));
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
ItemStack stack = Minecraft.getMinecraft().thePlayer.getHeldItem();
if (stack != null && stack.getItem() instanceof IConfigurableItem
&& ((IConfigurableItem) stack.getItem()).hasProfiles()) {
int preset = ItemNBTHelper.getInteger(stack, "ConfigProfile", 0);
if (++preset >= 5) preset = 0;
ItemNBTHelper.setInteger(stack, "ConfigProfile", preset);
}
} else
if (KeyBindings.toggleFlight.isPressed()) {
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
if (player.capabilities.allowFlying) {
if (player.capabilities.isFlying) {
player.capabilities.isFlying = false;
} else {
player.capabilities.isFlying = true;
if (player.onGround) {
player.setPosition(player.posX, player.posY + 0.05D, player.posZ);
player.motionY = 0;
}
}
player.sendPlayerAbilities();
if (this.placeItem.isPressed()) {
handlePlaceItemKey();
} else if (this.toolConfig.isPressed()) {
handleToolConfigKey();
} else if (this.toolProfileChange.isPressed() && player != null && player.getItemInUse() == null) {
handleToolProfileChangeKey(player);
} else if (this.toggleFlight.isPressed() && player != null) {
handleToggleFlightKey(player);
} else if (this.toggleMagnet.isPressed()) {
handleToggleMagnetKey(player);
} else if (this.toggleMagnetSelfPickup != null && this.toggleMagnetSelfPickup.isPressed()) {
handleToggleMagnetSelfPickup(player);
}
}
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onMouseInput(InputEvent.MouseInputEvent event) {
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
if (this.placeItem.isPressed()) {
handlePlaceItemKey();
} else if (this.toolConfig.isPressed()) {
handleToolConfigKey();
} else if (this.toolProfileChange.isPressed() && player != null) {
handleToolProfileChangeKey(player);
} else if (this.toggleFlight.isPressed() && player != null) {
handleToggleFlightKey(player);
} else if (this.toggleMagnet.isPressed()) {
handleToggleMagnetKey(player);
} else if (this.toggleMagnetSelfPickup != null && this.toggleMagnetSelfPickup.isPressed()) {
handleToggleMagnetSelfPickup(player);
}
if (player != null) {
int change = Mouse.getEventDWheel();
if (change == 0 || !player.isSneaking()) return;
if (change > 0) {
ItemStack item = player.inventory.getStackInSlot(previousSlot(1, player.inventory.currentItem));
if (item != null && Objects.equals(item.getItem(), ModItems.teleporterMKII)) {
player.inventory.currentItem = previousSlot(1, player.inventory.currentItem);
DraconicEvolution.network.sendToServer(new TeleporterPacket(TeleporterPacket.SCROLL, -1, false));
}
} else if (KeyBindings.toggleMagnet.isPressed()) {
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
if (player.inventory.hasItem(ModItems.magnet)) {
DraconicEvolution.network.sendToServer(new MagnetTogglePacket());
} else {
ItemStack item = player.inventory.getStackInSlot(previousSlot(-1, player.inventory.currentItem));
if (item != null && Objects.equals(item.getItem(), ModItems.teleporterMKII)) {
player.inventory.currentItem = previousSlot(-1, player.inventory.currentItem);
DraconicEvolution.network.sendToServer(new TeleporterPacket(TeleporterPacket.SCROLL, 1, false));
}
}
}
}
private void handlePlaceItemKey() {
@@ -81,49 +142,62 @@ public class KeyInputHandler {
}
}
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onMouseInput(InputEvent.MouseInputEvent event) {
if (KeyBindings.placeItem.isPressed()) {
handlePlaceItemKey();
} else if (KeyBindings.toolConfig.isPressed()) {
DraconicEvolution.network.sendToServer(new ButtonPacket(ButtonPacket.ID_TOOLCONFIG, false));
} else if (KeyBindings.toolProfileChange.isPressed() && Minecraft.getMinecraft().thePlayer != null) {
DraconicEvolution.network.sendToServer(new ButtonPacket(ButtonPacket.ID_TOOL_PROFILE_CHANGE, false));
private void handleToolConfigKey() {
DraconicEvolution.network.sendToServer(new ButtonPacket(ButtonPacket.ID_TOOLCONFIG, false));
}
ItemStack stack = Minecraft.getMinecraft().thePlayer.getHeldItem();
if (stack != null && stack.getItem() instanceof IConfigurableItem
&& ((IConfigurableItem) stack.getItem()).hasProfiles()) {
int preset = ItemNBTHelper.getInteger(stack, "ConfigProfile", 0);
if (++preset >= 5) preset = 0;
ItemNBTHelper.setInteger(stack, "ConfigProfile", preset);
}
}
private void handleToolProfileChangeKey(@Nonnull EntityClientPlayerMP player) {
DraconicEvolution.network.sendToServer(new ButtonPacket(ButtonPacket.ID_TOOL_PROFILE_CHANGE, false));
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
int change = Mouse.getEventDWheel();
if (change == 0 || !player.isSneaking()) return;
if (change > 0) {
ItemStack item = player.inventory.getStackInSlot(previouseSlot(1, player.inventory.currentItem));
if (item != null && item.getItem().equals(ModItems.teleporterMKII)) {
player.inventory.currentItem = previouseSlot(1, player.inventory.currentItem);
DraconicEvolution.network.sendToServer(new TeleporterPacket(TeleporterPacket.SCROLL, -1, false));
}
} else {
ItemStack item = player.inventory.getStackInSlot(previouseSlot(-1, player.inventory.currentItem));
if (item != null && item.getItem().equals(ModItems.teleporterMKII)) {
player.inventory.currentItem = previouseSlot(-1, player.inventory.currentItem);
DraconicEvolution.network.sendToServer(new TeleporterPacket(TeleporterPacket.SCROLL, 1, false));
}
ItemStack stack = player.getHeldItem();
if (stack != null && stack.getItem() instanceof IConfigurableItem
&& ((IConfigurableItem) stack.getItem()).hasProfiles()) {
int preset = ItemNBTHelper.getInteger(stack, "ConfigProfile", 0);
if (++preset >= 5) preset = 0;
ItemNBTHelper.setInteger(stack, "ConfigProfile", preset);
}
}
private int previouseSlot(int i, int c) {
private void handleToggleFlightKey(@Nonnull EntityClientPlayerMP player) {
if (player.capabilities.allowFlying) {
if (player.capabilities.isFlying) {
player.capabilities.isFlying = false;
} else {
player.capabilities.isFlying = true;
if (player.onGround) {
player.setPosition(player.posX, player.posY + 0.05D, player.posZ);
player.motionY = 0;
}
}
player.sendPlayerAbilities();
}
}
private void handleToggleMagnetKey(EntityClientPlayerMP player) {
Optional<ItemStack> magnetOptional = InventoryUtils.getItemInAnyPlayerInventory(player, Magnet.class);
if (magnetOptional.isPresent()) {
DraconicEvolution.network.sendToServer(new MagnetTogglePacket());
}
}
private void handleToggleMagnetSelfPickup(EntityClientPlayerMP player) {
Optional<ItemStack> magnetOptional = InventoryUtils.getItemInAnyPlayerInventory(player, Magnet.class);
if (magnetOptional.isPresent()) {
DraconicEvolution.network.sendToServer(new MagnetToggleSelfPickupPacket());
}
}
private int previousSlot(int i, int c) {
if (c > 0 && c < 8) return c + i;
if (c == 0 && i < 0) return 8;
if (c == 8 && i > 0) return 0;
if (c == 150 && i < 0) return 152;
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.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
import com.brandon3055.draconicevolution.integration.ModHelper;
import xonin.backhand.api.core.BackhandUtils;
public class ModelDraconicArmor extends ModelBiped {
@@ -173,7 +177,14 @@ public class ModelDraconicArmor extends ModelBiped {
bipedRightLeg.rotateAngleZ = 0F;
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.bipedRightArm.render(1F / 15F);
@@ -205,4 +216,14 @@ public class ModelDraconicArmor extends ModelBiped {
this.bipedRightArm.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);
}
ResourceHandler.bindTexture(texture);
GL11.glTranslatef(this.offsetX, this.offsetY, this.offsetZ);
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.glPushMatrix();
ResourceHandler.bindTexture(texture);
// scale = 1F/15F;
GL11.glScalef(scale, scale, scale);
GL11.glRotatef(180, -1, 0, 1);
@@ -102,6 +102,7 @@ public class ModelRenderOBJ extends ModelRenderer {
this.compileDisplayList(scale);
}
ResourceHandler.bindTexture(texture);
GL11.glPushMatrix();
GL11.glTranslatef(this.rotationPointX * scale, this.rotationPointY * scale, this.rotationPointZ * scale);
if (this.rotateAngleY != 0.0F) {
@@ -6,7 +6,7 @@ import net.minecraft.entity.Entity;
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
@@ -70,7 +70,8 @@ public class ModelContributorWings extends ModelBase {
float baseRot = 0.45906584F;
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()) {
this.leftBaseStem.rotateAngleX = 0.5F;
@@ -8,7 +8,7 @@ import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
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.
@@ -1,6 +1,5 @@
package com.brandon3055.draconicevolution.client.render.block;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
@@ -34,7 +33,6 @@ public class RenderParticleGen implements IItemRenderer {
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
if (type == IItemRenderer.ItemRenderType.ENTITY) GL11.glTranslatef(-0.5F, 0.0F, -0.5F);
TileEntityRendererDispatcher.instance.renderTileEntityAt(tile, 0.0D, 0.0D, 0.0D, 0.0F);
RenderHelper.disableStandardItemLighting();
GL11.glPopAttrib();
GL11.glPopMatrix();
}
@@ -9,6 +9,7 @@ import net.minecraft.world.IBlockAccess;
import com.brandon3055.draconicevolution.common.ModBlocks;
import com.brandon3055.draconicevolution.common.lib.References;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
/**
@@ -9,6 +9,7 @@ import org.lwjgl.opengl.GL11;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.tileentities.TileTeleporterStand;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
/**
@@ -12,7 +12,7 @@ import net.minecraft.util.ResourceLocation;
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.entity.EntityDragonHeart;
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) {
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
// 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);
EntityItem itemEntity = new EntityItem(entity.worldObj, 0, 0, 0, new ItemStack(ModItems.dragonHeart));
itemEntity.hoverStart = 0.0F;
@@ -9,7 +9,7 @@ import org.lwjgl.opengl.GL11;
import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
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.
@@ -10,16 +10,21 @@ import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.common.utills.LogHelper;
import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper;
import com.brandon3055.draconicevolution.common.utils.LogHelper;
public class RenderMobSoul implements IItemRenderer {
private Minecraft mc;
private Entity randomEntity = null;
private String[] randomEntitys = new String[] { "Pig", "Sheep", "Enderman", "Zombie", "Creeper", "Cow", "Chicken",
"Ozelot", "Witch", "Wolf", "MushroomCow", "Squid", "EntityHorse", "Spider", "Skeleton", "Blaze", "Bat",
"Villager", "Silverfish" };
public static volatile boolean applyTimeRotation = true;
public static float getRotationAngle() {
return (float) (Minecraft.getSystemTime() / -10);
}
private final Minecraft mc;
private final String[] randomEntities = new String[] { "Pig", "Sheep", "Enderman", "Zombie", "Creeper", "Cow",
"Chicken", "Ozelot", "Witch", "Wolf", "MushroomCow", "Squid", "EntityHorse", "Spider", "Skeleton", "Blaze",
"Bat", "Villager", "Silverfish" };
public RenderMobSoul() {
this.mc = Minecraft.getMinecraft();
@@ -40,8 +45,8 @@ public class RenderMobSoul implements IItemRenderer {
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
Entity mob = EntityList.createEntityByName(ItemNBTHelper.getString(item, "Name", "Pig"), mc.theWorld);
randomEntity = EntityList
.createEntityByName(randomEntitys[(int) ((Minecraft.getSystemTime() / 1000) % 18)], mc.theWorld);
Entity randomEntity = EntityList
.createEntityByName(randomEntities[(int) ((Minecraft.getSystemTime() / 1000) % 18)], mc.theWorld);
if (ItemNBTHelper.getString(item, "Name", "Pig").equals("Any")) mob = randomEntity;
if (mob instanceof EntitySkeleton)
((EntitySkeleton) mob).setSkeletonType(ItemNBTHelper.getInteger(item, "SkeletonType", 0));
@@ -59,7 +64,7 @@ public class RenderMobSoul implements IItemRenderer {
GL11.glScalef(13F, 13F, 13F);
GL11.glTranslated(1.2, 2.2, 0);
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);
RenderManager.instance.renderEntityWithPosYaw(mob, 0, 0, 0, 0F, 1F);
GL11.glPopMatrix();
@@ -68,7 +73,7 @@ public class RenderMobSoul implements IItemRenderer {
GL11.glScalef(0.8F, 0.8F, 0.8F);
GL11.glTranslated(2, 0.5, 0);
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);
RenderManager.instance.renderEntityWithPosYaw(mob, 0, 0, 0, 0F, 1F);
GL11.glPopMatrix();
@@ -77,14 +82,14 @@ public class RenderMobSoul implements IItemRenderer {
GL11.glScalef(0.8F, 0.8F, 0.8F);
GL11.glTranslated(1, 0.5, 0);
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);
RenderManager.instance.renderEntityWithPosYaw(mob, 0, 0, 0, 0F, 1F);
GL11.glPopMatrix();
} else {
GL11.glPushMatrix();
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.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
@@ -1,19 +1,21 @@
package com.brandon3055.draconicevolution.client.render.particle;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
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.common.ModItems;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.utils.Utils;
/**
* Created by Brandon on 8/02/2015.
@@ -28,19 +30,19 @@ public class ParticleEnergyBeam extends EntityFX {
/**
* Beam Target X
*/
private double tX = 0.0D;
private double tX;
/**
* Beam Target Y
*/
private double tY = 0.0D;
private double tY;
/**
* Beam Target Z
*/
private double tZ = 0.0D;
private double tZ;
/**
* Modified Target X
*/
private boolean advanced;
private final boolean advanced;
private boolean renderParticle = true;
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
private static ResourceLocation beamTextureBasic = new ResourceLocation(
private static final ResourceLocation beamTextureBasic = new ResourceLocation(
References.MODID.toLowerCase(),
"textures/models/EnergyBeamBlue.png");
private static ResourceLocation beamTextureAdvanced = new ResourceLocation(
private static final ResourceLocation beamTextureAdvanced = new ResourceLocation(
References.MODID.toLowerCase(),
"textures/models/EnergyBeamRed.png");
@@ -83,14 +85,13 @@ public class ParticleEnergyBeam extends EntityFX {
this.tZ = tZ;
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;
double xDist = x - tX;
double zDist = z - tZ;
double xOff = xDist / dist;
double zOff = zDist / dist;
if (xOff == 0 && zOff == 0) xOff = 1;
// LogHelper.info(xOff + " " + zOff);
double offM = 0.4D;
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);
}
if (ClientEventHandler.playerHoldingWrench) {
var44 = -0.15D * (double) 1;
var17 = 0.15D * (double) 1;
if (isPlayerHoldingWrench()) {
var44 = -0.15D;
var17 = 0.15D;
// GL11.glColor4f(1f, 1f, 1f, 1f);
// GL11.glTranslated(0.1, 0, 0);
@@ -235,4 +236,13 @@ public class ParticleEnergyBeam extends EntityFX {
public void setFlow(int 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;
}
}
@@ -3,7 +3,6 @@ package com.brandon3055.draconicevolution.client.render.particle;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import org.lwjgl.opengl.GL11;
@@ -11,7 +10,6 @@ import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
import com.brandon3055.draconicevolution.common.blocks.multiblock.IReactorPart;
import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper;
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.TileReactorStabilizer;
import cpw.mods.fml.relauncher.Side;
@@ -23,16 +21,10 @@ import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleReactorBeam extends EntityFX {
/**
* Particle Type 0 = Energy Ring, 1 = single particle
*/
private boolean renderParticle = true;
private TileEntity tile;
private boolean isInjectorBeam = false;
private final TileEntity tile;
public ParticleReactorBeam(TileEntity tile) {
super(tile.getWorldObj(), tile.xCoord + 0.5, tile.yCoord + 0.5, tile.zCoord + 0.5, 0.0D, 0.0D, 0.0D);
super(tile.getWorldObj(), tile.xCoord + 0.5, tile.yCoord + 0.5, tile.zCoord + 0.5, 0.0, 0.0, 0.0);
this.tile = tile;
this.particleRed = 1F;
this.particleGreen = 1F;
@@ -43,16 +35,16 @@ public class ParticleReactorBeam extends EntityFX {
this.motionZ = 0.0D;
this.particleMaxAge = 4;
this.setSize(1F, 1F);
isInjectorBeam = tile instanceof TileReactorEnergyInjector;
}
public void update(boolean render) {
for (this.renderParticle = render; this.particleMaxAge - this.particleAge < 4; ++this.particleMaxAge) {}
public void update() {
if (this.particleMaxAge - this.particleAge < 4) {
this.particleMaxAge = this.particleAge + 4;
}
}
@Override
public void onUpdate() {
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
@@ -65,137 +57,102 @@ public class ParticleReactorBeam extends EntityFX {
@Override
public void renderParticle(Tessellator tessellator, float partialTick, float rotX, float rotXZ, float rotZ,
float rotYZ, float rotXY) {
if (!((IReactorPart) tile).isActive()) return;
if (!((IReactorPart) tile).isActive()) {
return;
}
tessellator.draw();
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glAlphaFunc(GL11.GL_GREATER, 0.0F);
float xx = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) partialTick - interpPosX);
float yy = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) partialTick - interpPosY);
float zz = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) partialTick - interpPosZ);
GL11.glTranslated((double) xx, (double) yy, (double) zz);
double shiftX = this.prevPosX + (this.posX - this.prevPosX) * partialTick - interpPosX;
double shiftY = this.prevPosY + (this.posY - this.prevPosY) * partialTick - interpPosY;
double shiftZ = this.prevPosZ + (this.posZ - this.prevPosZ) * partialTick - interpPosZ;
GL11.glTranslated(shiftX, shiftY, shiftZ);
// Common Fields
MultiblockHelper.TileLocation master = ((IReactorPart) tile).getMaster();
float offsetX = (float) (master.posX - tile.xCoord);
float offsetY = (float) ((double) master.posY - tile.yCoord);
float offsetZ = (float) (master.posZ - tile.zCoord);
float length = MathHelper.sqrt_float(offsetX * offsetX + offsetY * offsetY + offsetZ * offsetZ);
MultiblockHelper.TileLocation master = ((IReactorPart) tile).getMasterLocation();
double offsetX = master.posX - tile.xCoord;
double offsetY = master.posY - tile.yCoord;
double offsetZ = master.posZ - tile.zCoord;
double offsetLength = Math.sqrt(offsetX * offsetX + offsetY * offsetY + offsetZ * offsetZ);
double diagonalLength = Math.sqrt(offsetX * offsetX + offsetZ * offsetZ);
// Rotate beam to face target
float f7 = MathHelper.sqrt_float(offsetX * offsetX + offsetZ * offsetZ);
GL11.glRotatef(
(float) (-Math.atan2((double) offsetZ, (double) offsetX)) * 180.0F / (float) Math.PI - 90.0F,
0.0F,
1.0F,
0.0F);
GL11.glRotatef(
(float) (-Math.atan2((double) f7, (double) offsetY)) * 180.0F / (float) Math.PI - 90.0F,
1.0F,
0.0F,
0.0F);
GL11.glRotated(Math.toDegrees(-Math.atan2(offsetZ, offsetX)) - 90.0, 0.0, 1.0, 0.0);
GL11.glRotated(Math.toDegrees(-Math.atan2(diagonalLength, offsetY)) - 90.0, 1.0, 0.0, 0.0);
TileReactorCore reactor = ((IReactorPart) tile).getMaster().getTileEntity(worldObj) instanceof TileReactorCore
? (TileReactorCore) ((IReactorPart) tile).getMaster().getTileEntity(worldObj)
: null;
if (tile instanceof TileReactorStabilizer && reactor != null)
renderStabilizerEffect(tessellator, reactor, offsetX, offsetY, offsetZ, length, partialTick);
else if (reactor != null) {
TileReactorCore core = ((IReactorPart) tile).getMaster();
if (tile instanceof TileReactorStabilizer && core != null)
renderStabilizerEffect(tessellator, core, offsetLength, partialTick);
else if (core != null) {
GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glTranslated(0, 0, 0.3);
// GL11.glPushMatrix();
GL11.glRotatef(((float) particleAge + partialTick) * 20F, 0, 0, 1);
GL11.glTranslated(0.0, 0.0, 0.3);
GL11.glRotatef(((float) particleAge + partialTick) * 20F, 0F, 0F, 1F);
ResourceHandler.bindResource("textures/particle/reactorEnergyBeam.png");
// float sizeOrigin = 0.5F;
// float sizeTarget = 0.2F;
float sizeOrigin = 0.5F;
double sizeOrigin = 0.5;
int color = 0xFF2200;
int alpha = (int) (200D * reactor.renderSpeed);
int alpha = (int) (200.0 * core.renderSpeed);
float speed = 20F;
float texV2 = 0.0F + ((float) particleAge + partialTick) * 0.01F * speed;
float texV1 = MathHelper.sqrt_float(offsetX * offsetX + offsetY * offsetY + offsetZ * offsetZ)
+ ((float) particleAge + partialTick) * 0.01F * speed;
double speed = 20.0;
double texV2 = ((double) particleAge + partialTick) * 0.01 * speed;
double texV1 = offsetLength + texV2;
tessellator.startDrawing(5);
tessellator.startDrawing(GL11.GL_TRIANGLE_STRIP);
tessellator.setBrightness(200);
float sizeTarget = 0.1F;
double sizeTarget = 0.1;
byte b0 = 16;
length = 0F;
for (int i = 0; i <= b0; ++i) {
float verX = MathHelper.sin((float) (i % b0) * (float) Math.PI * 2.3F / (float) b0) * sizeTarget;
float verY = MathHelper.cos((float) (i % b0) * (float) Math.PI * 2.3F / (float) b0) * sizeTarget;
float texU = (float) (i % b0) * 1.0F / (float) b0;
tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), 0);
final int raysCount = 16;
for (int ray = 0; ray <= raysCount; ++ray) {
double texU = (double) ray / raysCount;
double verX = Math.sin(texU * Math.PI * 2.3) * sizeTarget;
double verY = Math.cos(texU * Math.PI * 2.3) * sizeTarget;
tessellator.addVertexWithUV(
(double) (verX * sizeOrigin),
(double) (verY * sizeOrigin),
-0.55D,
(double) texU,
(double) texV1);
tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), alpha);
tessellator
.addVertexWithUV((double) verX, (double) verY, (double) length, (double) texU, (double) texV2);
tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, color & 0xFF, 0);
tessellator.addVertexWithUV(verX * sizeOrigin, verY * sizeOrigin, -0.55, texU, texV1);
tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, color & 0xFF, alpha);
tessellator.addVertexWithUV(verX, verY, offsetLength, texU, texV2);
}
length = MathHelper.sqrt_float(offsetX * offsetX + offsetY * offsetY + offsetZ * offsetZ)
- (float) (reactor.getCoreDiameter() / 2D)
- 0.3F;
sizeTarget = (float) (reactor.getCoreDiameter() / 2 * 0.2D);
sizeOrigin = 0.1F / sizeTarget;
offsetLength -= core.getCoreRadius() + 0.3;
sizeTarget = core.getCoreRadius() * 0.2;
sizeOrigin = 0.1 / sizeTarget;
for (int i = 0; i <= b0; ++i) {
float verX = MathHelper.sin((float) (i % b0) * (float) Math.PI * 2.13F / (float) b0) * sizeTarget;
float verY = MathHelper.cos((float) (i % b0) * (float) Math.PI * 2.13F / (float) b0) * sizeTarget;
float texU = (float) (i % b0) * 1.0F / (float) b0;
tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), alpha);
for (int ray = 0; ray <= raysCount; ray++) {
double texU = (double) ray / raysCount;
double verX = Math.sin(texU * Math.PI * 2.13) * sizeTarget;
double verY = Math.cos(texU * Math.PI * 2.13) * sizeTarget;
tessellator.addVertexWithUV(
(double) (verX * sizeOrigin),
(double) (verY * sizeOrigin),
0.0D,
(double) texU,
(double) texV1);
tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, color & 0xFF, alpha);
tessellator.addVertexWithUV(verX * sizeOrigin, verY * sizeOrigin, 0.0, texU, texV1);
tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), 0);
tessellator
.addVertexWithUV((double) verX, (double) verY, (double) length, (double) texU, (double) texV2);
tessellator.addVertexWithUV(verX, verY, offsetLength, texU, texV2);
}
tessellator.draw();
// GL11.glPopMatrix();
GL11.glRotatef(((float) particleAge + partialTick) * -30F, 0, 0, 1);
GL11.glRotatef(((float) particleAge + partialTick) * -30F, 0F, 0F, 1F);
tessellator.startDrawing(5);
tessellator.startDrawing(GL11.GL_TRIANGLE_STRIP);
tessellator.setBrightness(200);
color = 0xFF4400;
sizeTarget = (float) (reactor.getCoreDiameter() / 2 * 0.6D);
sizeOrigin = 0.1F / sizeTarget;
length += 0.4F;
sizeTarget = core.getCoreRadius() * 0.6;
sizeOrigin = 0.1 / sizeTarget;
offsetLength += 0.4;
GL11.glTranslated(0, 0, -0.1);
for (int i = 0; i <= b0; ++i) {
float verX = MathHelper.sin((float) (i % b0) * (float) Math.PI * 2.13F / (float) b0) * sizeTarget;
float verY = MathHelper.cos((float) (i % b0) * (float) Math.PI * 2.13F / (float) b0) * sizeTarget;
float texU = (float) (i % b0) * 1.0F / (float) b0;
tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), alpha / 2);
for (int ray = 0; ray <= raysCount; ray++) {
double texU = (double) ray / raysCount;
double verX = Math.sin(texU * Math.PI * 2.13F) * sizeTarget;
double verY = Math.cos(texU * Math.PI * 2.13F) * sizeTarget;
tessellator.addVertexWithUV(
(double) (verX * sizeOrigin),
(double) (verY * sizeOrigin),
0.0D,
(double) texU,
(double) texV1);
tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), 0);
tessellator
.addVertexWithUV((double) verX, (double) verY, (double) length, (double) texU, (double) texV2);
tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, color & 0xFF, alpha / 2);
tessellator.addVertexWithUV(verX * sizeOrigin, verY * sizeOrigin, 0.0, texU, texV1);
tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, color & 0xFF, 0);
tessellator.addVertexWithUV(verX, verY, offsetLength, texU, texV2);
}
tessellator.draw();
@@ -208,44 +165,28 @@ public class ParticleReactorBeam extends EntityFX {
tessellator.startDrawingQuads();
}
private void renderStabilizerEffect(Tessellator tessellator, TileReactorCore reactor, float offsetX, float offsetY,
float offsetZ, float length, float partialTick) {
private void renderStabilizerEffect(Tessellator tessellator, TileReactorCore core, double offsetLength,
float partialTick) {
GL11.glShadeModel(GL11.GL_SMOOTH);
// Draw Beams
GL11.glPushMatrix();
GL11.glTranslated(0, 0, -0.35);
GL11.glTranslated(0.0, 0.0, -0.35);
ResourceHandler.bindResource("textures/particle/reactorBeam.png");
drawBeam(
tessellator,
reactor,
1F,
0.355F,
0.8F,
offsetX,
offsetY,
offsetZ,
particleAge,
partialTick,
true,
false,
0x00ffff);
drawBeam(tessellator, core, 1.0, 0.355, 0.8, offsetLength, partialTick, true, false, 0x00ffff);
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glTranslated(0, 0, 0.45);
float coreSize = (float) (reactor.getCoreDiameter() / 2) * 0.9F;
float s = 0.355F;
GL11.glTranslated(0.0, 0.0, 0.45);
double coreSize = core.getCoreRadius() * 0.9;
double scale = 0.355;
drawBeam(
tessellator,
reactor,
s / coreSize,
core,
scale / coreSize,
coreSize,
length - (float) (reactor.getCoreDiameter() / 2.5D),
offsetX,
offsetY,
offsetZ,
particleAge,
offsetLength - core.getCoreDiameter() / 2.5,
offsetLength,
partialTick,
false,
false,
@@ -253,37 +194,21 @@ public class ParticleReactorBeam extends EntityFX {
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glTranslated(0, 0, -0.35);
drawBeam(
tessellator,
reactor,
1F,
0.263F,
0.8F,
offsetX,
offsetY,
offsetZ,
particleAge,
partialTick,
true,
true,
0xff6600);
GL11.glTranslated(0.0, 0.0, -0.35);
drawBeam(tessellator, core, 1.0, 0.263, 0.8, offsetLength, partialTick, true, true, 0xff6600);
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glTranslated(0, 0, 0.45);
coreSize = (float) (reactor.getCoreDiameter() / 2) * 0.4F;
s = 0.263F;
GL11.glTranslated(0.0, 0.0, 0.45);
coreSize = core.getCoreRadius() * 0.4;
scale = 0.263;
drawBeam(
tessellator,
reactor,
s / coreSize,
core,
scale / coreSize,
coreSize,
length - 0.5F,
offsetX,
offsetY,
offsetZ,
particleAge,
offsetLength - 0.5,
offsetLength,
partialTick,
false,
true,
@@ -297,160 +222,36 @@ public class ParticleReactorBeam extends EntityFX {
* Size Origin is the fraction of size start Target So if size target is 10 and size origin is 0.5 origin will
* actually be 5
*/
private void drawBeam(Tessellator tessellator, TileReactorCore reactor, float sizeOrigin, float sizeTarget,
float length, float offsetX, float offsetY, float offsetZ, int tick, float partialTick,
boolean reverseTransparency, boolean reverseDirection, int color) {
float speed = 3F;
float texV2 = -0.1F + ((float) tick + partialTick) * (reverseDirection ? -0.01F : 0.01F) * speed;
float texV1 = MathHelper.sqrt_float(offsetX * offsetX + offsetY * offsetY + offsetZ * offsetZ) / 32.0F
+ ((float) tick + partialTick) * (reverseDirection ? -0.01F : 0.01F) * speed;
private void drawBeam(Tessellator tessellator, TileReactorCore core, double sizeOrigin, double sizeTarget,
double length, double offsetLength, float partialTick, boolean reverseTransparency,
boolean reverseDirection, int color) {
final double speed = 3.0;
final double tickOffset = ((double) particleAge + partialTick) * (reverseDirection ? -0.01 : 0.01) * speed;
tessellator.startDrawing(5);
double texV1 = offsetLength / 32.0 + tickOffset;
double texV2 = -0.1 + tickOffset;
tessellator.startDrawing(GL11.GL_TRIANGLE_STRIP);
tessellator.setBrightness(200);
byte b0 = 16;
for (int i = 0; i <= b0; ++i) {
float verX = MathHelper.sin((float) (i % b0) * (float) Math.PI * 2.13325F / (float) b0) * sizeTarget;
float verY = MathHelper.cos((float) (i % b0) * (float) Math.PI * 2.13325F / (float) b0) * sizeTarget;
float texU = (float) (i % b0) * 1.0F / (float) b0;
final int raysCount = 16;
for (int ray = 0; ray <= raysCount; ++ray) {
double texU = (double) ray / raysCount;
double verX = Math.sin(texU * Math.PI * 2.13325) * sizeTarget;
double verY = Math.cos(texU * Math.PI * 2.13325) * sizeTarget;
tessellator.setColorRGBA(
(color & 0xFF0000) >> 16,
(color & 0xFF00) >> 8,
(color & 0xFF),
reverseTransparency ? 0 : (int) (255D * reactor.renderSpeed));
tessellator.addVertexWithUV(
(double) (verX * sizeOrigin),
(double) (verY * sizeOrigin),
0.0D,
(double) texU,
(double) texV1);
color & 0xFF,
reverseTransparency ? 0 : (int) (255.0 * core.renderSpeed));
tessellator.addVertexWithUV(verX * sizeOrigin, verY * sizeOrigin, 0.0, texU, texV1);
tessellator.setColorRGBA(
(color & 0xFF0000) >> 16,
(color & 0xFF00) >> 8,
(color & 0xFF),
reverseTransparency ? (int) (255D * reactor.renderSpeed) : 0);
tessellator.addVertexWithUV((double) verX, (double) verY, (double) length, (double) texU, (double) texV2);
color & 0xFF,
reverseTransparency ? (int) (255.0 * core.renderSpeed) : 0);
tessellator.addVertexWithUV(verX, verY, length, texU, texV2);
}
tessellator.draw();
}
}
// @Override
// public void renderParticle(Tessellator tessellator, float partialTick, float rotX, float rotXZ, float rotZ, float
// rotYZ, float rotXY) {
// if (!((IIsSlave)tile).isActive()) return;
// tessellator.draw();
// GL11.glPushMatrix();
// GL11.glDisable(GL11.GL_CULL_FACE);
// GL11.glAlphaFunc(GL11.GL_GREATER, 0.0F);
//
// float xx = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTick - interpPosX);
// float yy = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTick - interpPosY);
// float zz = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTick - interpPosZ);
// GL11.glTranslated((double)xx, (double)yy, (double)zz);
//
// //Common Fields
// MultiblockHelper.TileLocation master = ((IIsSlave)tile).getMaster();
// float offsetX = (float)(master.posX - tile.xCoord);
// float offsetY = (float)((double)master.posY - tile.yCoord);
// float offsetZ = (float)(master.posZ - tile.zCoord);
// float length = MathHelper.sqrt_float(offsetX * offsetX + offsetY * offsetY + offsetZ * offsetZ);
//
//
// //Rotate beam to face target
// float f7 = MathHelper.sqrt_float(offsetX * offsetX + offsetZ * offsetZ);
// GL11.glRotatef((float) (-Math.atan2((double) offsetZ, (double) offsetX)) * 180.0F / (float) Math.PI - 90.0F, 0.0F,
// 1.0F, 0.0F);
// GL11.glRotatef((float)(-Math.atan2((double)f7, (double)offsetY)) * 180.0F / (float)Math.PI - 90.0F, 1.0F, 0.0F,
// 0.0F);
//
// if (tile instanceof TileReactorStabilizer) renderStabilizerEffect(tessellator, offsetX, offsetY, offsetZ, length,
// partialTick);
// else {
// GL11.glShadeModel(GL11.GL_SMOOTH);
// GL11.glTranslated(0, 0, 0.3);
// //GL11.glPushMatrix();
// GL11.glRotatef(((float)particleAge + partialTick)*20F, 0, 0, 1);
// ResourceHandler.bindResource("textures/particle/reactorEnergyBeam.png");
//// float sizeOrigin = 0.5F;
//// float sizeTarget = 0.2F;
// float sizeTarget = 0.2F;
// float sizeOrigin = 0.5F;
//
// int color = 0xFF2200;
// int alpha = 200;
// length -= 1;
//
// float speed = 20F;
// float texV2 = 0.0F + ((float)particleAge + partialTick) * 0.01F * speed;
// float texV1 = MathHelper.sqrt_float(offsetX * offsetX + offsetY * offsetY + offsetZ * offsetZ) +
// ((float)particleAge + partialTick) * 0.01F * speed;
//
// tessellator.startDrawing(5);
// tessellator.setBrightness(200);
//
// byte b0 = 16;
// for (int i = 0; i <= b0; ++i)
// {
// float verX = MathHelper.sin((float)(i % b0) * (float)Math.PI * 2.13F / (float)b0) * sizeTarget;
// float verY = MathHelper.cos((float)(i % b0) * (float)Math.PI * 2.13F / (float)b0) * sizeTarget;
// float texU = (float)(i % b0) * 1.0F / (float)b0;
// tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), alpha);
//
// tessellator.addVertexWithUV((double)(verX * sizeOrigin), (double)(verY * sizeOrigin), 0.0D, (double)texU,
// (double)texV1);
// tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), 0);
// tessellator.addVertexWithUV((double)verX, (double)verY, (double)length, (double)texU, (double)texV2);
// }
//
// sizeTarget = 0.1F;
//
// length = 0F;
// for (int i = 0; i <= b0; ++i)
// {
// float verX = MathHelper.sin((float)(i % b0) * (float)Math.PI * 2.3F / (float)b0) * sizeTarget;
// float verY = MathHelper.cos((float)(i % b0) * (float)Math.PI * 2.3F / (float)b0) * sizeTarget;
// float texU = (float)(i % b0) * 1.0F / (float)b0;
// tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), 0);
//
// tessellator.addVertexWithUV((double)(verX * sizeOrigin), (double)(verY * sizeOrigin), -0.55D, (double)texU,
// (double)texV1);
// tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), alpha);
// tessellator.addVertexWithUV((double)verX, (double)verY, (double)length, (double)texU, (double)texV2);
// }
//
// tessellator.draw();
// //GL11.glPopMatrix();
// GL11.glRotatef(((float)particleAge + partialTick)*-30F, 0, 0, 1);
//
// tessellator.startDrawing(5);
// tessellator.setBrightness(200);
// color = 0xFF4400;
// sizeOrigin = 0.15F;
// sizeTarget = 0.6F;
// length = MathHelper.sqrt_float(offsetX * offsetX + offsetY * offsetY + offsetZ * offsetZ) - 1;
// GL11.glTranslated(0, 0, -0.1);
//
// for (int i = 0; i <= b0; ++i)
// {
// float verX = MathHelper.sin((float)(i % b0) * (float)Math.PI * 2.13F / (float)b0) * sizeTarget;
// float verY = MathHelper.cos((float)(i % b0) * (float)Math.PI * 2.13F / (float)b0) * sizeTarget;
// float texU = (float)(i % b0) * 1.0F / (float)b0;
// tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), alpha/2);
//
// tessellator.addVertexWithUV((double)(verX * sizeOrigin), (double)(verY * sizeOrigin), 0.0D, (double)texU,
// (double)texV1);
// tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), 0);
// tessellator.addVertexWithUV((double)verX, (double)verY, (double)length, (double)texU, (double)texV2);
// }
//
// tessellator.draw();
// GL11.glShadeModel(GL11.GL_FLAT);
// }
//
// GL11.glPopMatrix();
// GL11.glEnable(GL11.GL_CULL_FACE);
// ResourceHandler.bindDefaultParticles();
// tessellator.startDrawingQuads();
// }
@@ -11,10 +11,10 @@ import net.minecraftforge.client.model.IModelCustom;
import org.lwjgl.opengl.GL11;
import com.brandon3055.brandonscore.common.utills.Utills;
import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
import com.brandon3055.draconicevolution.common.entity.EntityDragonProjectile;
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.SideOnly;
@@ -710,8 +710,8 @@ public class Particles {
// super.onUpdate();
if (particleAge >= particleMaxAge || this.getDistanceSq(targetX, targetY, targetZ) < 0.05) setDead();
double d1 = Utills.getDistanceAtoB(startX, startY, startZ, targetX, targetY, targetZ);
double d2 = Utills.getDistanceAtoB(posX, posY, posZ, targetX, targetY, targetZ);
double d1 = Utils.getDistanceAtoB(startX, startY, startZ, targetX, targetY, targetZ);
double d2 = Utils.getDistanceAtoB(posX, posY, posZ, targetX, targetY, targetZ);
particleScale = ((float) (d2 / d1)) * baseScale;
particleAge++;
@@ -1198,16 +1198,16 @@ public class Particles {
prevPosZ = posZ;
if (mode == 0) {
if (Utills.getDistanceAtoB(posX, posY, posZ, focalX, focalY, focalZ) < 0.2 && particleAge > 5) mode = 1;
double d = Utills.getDistanceAtoB(focalX, focalY, focalZ, shardX, shardY, shardZ);
if (Utils.getDistanceAtoB(posX, posY, posZ, focalX, focalY, focalZ) < 0.2 && particleAge > 5) mode = 1;
double d = Utils.getDistanceAtoB(focalX, focalY, focalZ, shardX, shardY, shardZ);
float motionMod = 0.1F;
motionX += (focalX - posX) / d * motionMod;
motionY += (focalY - posY) / d * motionMod;
motionZ += (focalZ - posZ) / d * motionMod;
}
if (mode == 1) {
if (Utills.getDistanceAtoB(posX, posY, posZ, shardX, shardY, shardZ) < 1) setDead();
double d = Utills.getDistanceAtoB(focalX, focalY, focalZ, shardX, shardY, shardZ);
if (Utils.getDistanceAtoB(posX, posY, posZ, shardX, shardY, shardZ) < 1) setDead();
double d = Utils.getDistanceAtoB(focalX, focalY, focalZ, shardX, shardY, shardZ);
particleScale = 1F - (float) d * 0.01F;
float motionMod = 1F;
motionX = (shardX - focalX) / d * motionMod;
@@ -1216,8 +1216,8 @@ public class Particles {
}
if (mode == 10) {
if (Utills.getDistanceAtoB(posX, posY, posZ, shardX, shardY, shardZ) < 0.3) setDead();
double d = Utills.getDistanceAtoB(focalX, focalY, focalZ, shardX, shardY, shardZ);
if (Utils.getDistanceAtoB(posX, posY, posZ, shardX, shardY, shardZ) < 0.3) setDead();
double d = Utils.getDistanceAtoB(focalX, focalY, focalZ, shardX, shardY, shardZ);
float motionMod = 0.4F;
motionX = (shardX - focalX) / d * motionMod;
motionY = (shardY - focalY) / d * motionMod;
@@ -10,7 +10,7 @@ import net.minecraftforge.client.model.IModelCustom;
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.tileentities.energynet.TileEnergyRelay;
import com.brandon3055.draconicevolution.common.tileentities.energynet.TileEnergyTransceiver;
@@ -65,7 +65,8 @@ public class RenderTileCrystal extends TileEntitySpecialRenderer {
RenderHelper.disableStandardItemLighting();
GL11.glEnable(GL11.GL_BLEND);
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.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);
else bindTexture(crystalRedAlpha);
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();
@@ -131,7 +132,8 @@ public class RenderTileCrystal extends TileEntitySpecialRenderer {
// RenderHelper.disableStandardItemLighting();
GL11.glEnable(GL11.GL_BLEND);
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.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);
else bindTexture(crystalRedAlpha);
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();
@@ -7,6 +7,7 @@ import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.init.Items;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
@@ -18,10 +19,7 @@ import com.brandon3055.draconicevolution.common.tileentities.TileDissEnchanter;
public class RenderTileDissEnchanter extends TileEntitySpecialRenderer {
// private final ResourceLocation texture = new ResourceLocation(References.MODID.toLowerCase(),
// "textures/models/EnergyInfuserTextureSheet.png");
// private static float pxl = 1F / 256F;
private final EntityItem cachedEntity = new EntityItem(null, 0, 0, 0, new ItemStack(Items.apple));
@Override
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) {
GL11.glPushMatrix();
ItemStack stack = tile.getStackInSlot(i).copy();
stack.stackSize = 1;
EntityItem itemEntity = new EntityItem(tile.getWorldObj(), 0, 0, 0, stack);
itemEntity.hoverStart = 0.0F;
ItemStack stack = tile.getStackInSlot(i);
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
GL11.glScalef(1F, 1F, 1F);
@@ -85,7 +80,18 @@ public class RenderTileDissEnchanter extends TileEntitySpecialRenderer {
}
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;
GL11.glPopMatrix();
@@ -1,6 +1,13 @@
package com.brandon3055.draconicevolution.client.render.tile;
import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.opengl.GL11.glColor4f;
import static org.lwjgl.opengl.GL11.glDisable;
import static org.lwjgl.opengl.GL11.glEnable;
import static org.lwjgl.opengl.GL11.glPopMatrix;
import static org.lwjgl.opengl.GL11.glPushMatrix;
import static org.lwjgl.opengl.GL11.glRotatef;
import static org.lwjgl.opengl.GL11.glScalef;
import static org.lwjgl.opengl.GL11.glTranslatef;
import java.util.Random;
@@ -12,6 +12,7 @@ import org.lwjgl.opengl.GL11;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEarth;
import cpw.mods.fml.client.FMLClientHandler;
/**
@@ -31,9 +32,8 @@ public class RenderTileEarth extends TileEntitySpecialRenderer {
@Override
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();
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.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.init.Items;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
@@ -17,11 +18,11 @@ import com.brandon3055.draconicevolution.common.tileentities.TileEnergyInfuser;
public class RenderTileEnergyInfiser extends TileEntitySpecialRenderer {
private static final float pxl = 1F / 256F;
private final ResourceLocation texture = new ResourceLocation(
References.MODID.toLowerCase(),
"textures/models/EnergyInfuserTextureSheet.png");
private static float pxl = 1F / 256F;
private final EntityItem cachedEntity = new EntityItem(null, 0, 0, 0, new ItemStack(Items.apple));
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) {
@@ -238,8 +239,6 @@ public class RenderTileEnergyInfiser extends TileEntitySpecialRenderer {
GL11.glPushMatrix();
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.glScalef(1F, 1F, 1F);
@@ -252,7 +251,15 @@ public class RenderTileEnergyInfiser extends TileEntitySpecialRenderer {
}
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;
GL11.glPopMatrix();
@@ -17,10 +17,10 @@ import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.Til
*/
public class RenderTileEnergyPylon extends TileEntitySpecialRenderer {
private static final ResourceLocation model_texture = new ResourceLocation(
private static final ResourceLocation modelTexture = new ResourceLocation(
References.MODID.toLowerCase(),
"textures/models/pylon_sphere_texture.png");
private IModelCustom model;
private final IModelCustom model;
public RenderTileEnergyPylon() {
model = AdvancedModelLoader
@@ -30,10 +30,13 @@ public class RenderTileEnergyPylon extends TileEntitySpecialRenderer {
@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float timeSinceLastTick) {
if (tile == null || !(tile instanceof TileEnergyPylon)) return;
TileEnergyPylon pylon = (TileEnergyPylon) tile;
if (!pylon.active) return;
float scale = pylon.modelScale + (timeSinceLastTick *= !pylon.reciveEnergy ? -0.01F : 0.01F);
if (!(tile instanceof TileEnergyPylon pylon)) {
return;
}
if (!pylon.active) {
return;
}
float scale = pylon.modelScale + (timeSinceLastTick *= !pylon.isReceivingEnergy ? -0.01F : 0.01F);
float rotation = pylon.modelRotation + (timeSinceLastTick / 2F);
GL11.glPushMatrix();
@@ -48,7 +51,7 @@ public class RenderTileEnergyPylon extends TileEntitySpecialRenderer {
GL11.glAlphaFunc(GL11.GL_GREATER, 0.0F);
bindTexture(model_texture);
bindTexture(modelTexture);
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10497.0F);
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10497.0F);
GL11.glDisable(GL11.GL_LIGHTING);
@@ -59,37 +62,10 @@ public class RenderTileEnergyPylon extends TileEntitySpecialRenderer {
GL11.glDepthMask(false);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 200F, 200F);
GL11.glPushMatrix();
float scale1 = scale % 1F;
GL11.glScalef(scale1, scale1, scale1);
GL11.glRotatef(rotation * 0.5F, 0F, -1F, -0.5F);
GL11.glColor4d(1D, 1D, 1D, 1F - (scale1));
model.renderAll();
GL11.glPopMatrix();
GL11.glPushMatrix();
float scale2 = (scale + 0.25F) % 1F;
GL11.glScalef(scale2, scale2, scale2);
GL11.glRotatef(rotation * 0.5F, 0F, -1F, -0.5F);
GL11.glColor4f(1F, 1F, 1F, 1F - (scale2));
model.renderAll();
GL11.glPopMatrix();
GL11.glPushMatrix();
float scale3 = (scale + 0.5F) % 1F;
GL11.glScalef(scale3, scale3, scale3);
GL11.glRotatef(rotation * 0.5F, 0F, -1F, -0.5F);
GL11.glColor4f(1F, 1F, 1F, 1F - (scale3));
model.renderAll();
GL11.glPopMatrix();
GL11.glPushMatrix();
float scale4 = (scale + 0.75F) % 1F;
GL11.glScalef(scale4, scale4, scale4);
GL11.glRotatef(rotation * 0.5F, 0F, -1F, -0.5F);
GL11.glColor4f(1F, 1F, 1F, 1F - (scale4));
model.renderAll();
GL11.glPopMatrix();
renderPass(scale % 1F, rotation);
renderPass((scale + 0.25F) % 1F, rotation);
renderPass((scale + 0.5F) % 1F, rotation);
renderPass((scale + 0.75F) % 1F, rotation);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_TEXTURE_2D);
@@ -100,5 +76,12 @@ public class RenderTileEnergyPylon extends TileEntitySpecialRenderer {
GL11.glPopMatrix();
}
// private void renderSphere()
private void renderPass(float scale, float rotation) {
GL11.glPushMatrix();
GL11.glScalef(scale, scale, scale);
GL11.glRotatef(rotation * 0.5F, 0F, -1F, -0.5F);
GL11.glColor4f(1F, 1F, 1F, 1F - scale);
model.renderAll();
GL11.glPopMatrix();
}
}
@@ -12,6 +12,7 @@ import org.lwjgl.opengl.GL11;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyStorageCore;
import cpw.mods.fml.client.FMLClientHandler;
/**
@@ -19,49 +20,38 @@ import cpw.mods.fml.client.FMLClientHandler;
*/
public class RenderTileEnergyStorageCore extends TileEntitySpecialRenderer {
private static final ResourceLocation iner_model_texture = new ResourceLocation(
private static final ResourceLocation InnerModelTexture = new ResourceLocation(
References.MODID.toLowerCase(),
"textures/models/power_sphere_layer_1.png");
private static final ResourceLocation outer_model_texture = new ResourceLocation(
private static final ResourceLocation OuterModelTexture = new ResourceLocation(
References.MODID.toLowerCase(),
"textures/models/power_sphere_layer_2.png");
private IModelCustom iner_model;
private final IModelCustom innerModel;
public RenderTileEnergyStorageCore() {
iner_model = AdvancedModelLoader
innerModel = AdvancedModelLoader
.loadModel(new ResourceLocation(References.MODID.toLowerCase(), "models/power_sphere_layer_1.obj"));
}
@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float timeSinceLastTick) {
if (tile == null || !(tile instanceof TileEnergyStorageCore)) return;
TileEnergyStorageCore core = (TileEnergyStorageCore) tile;
if (!core.isOnline()) return;
if (!(tile instanceof TileEnergyStorageCore core)) {
return;
}
if (!core.isOnline()) {
return;
}
float scale = 0;
float rotation = core.modelRotation + (timeSinceLastTick / 2F);
switch (core.getTier()) {
case 0:
scale = 0.7F;
break;
case 1:
scale = 1.2F;
break;
case 2:
scale = 1.7F;
break;
case 3:
scale = 2.5F;
break;
case 4:
scale = 3.5F;
break;
case 5:
scale = 4.5F;
break;
case 6:
scale = 5.5F;
break;
case 0 -> scale = 0.7F;
case 1 -> scale = 1.2F;
case 2 -> scale = 1.7F;
case 3 -> scale = 2.5F;
case 4 -> scale = 3.5F;
case 5 -> scale = 4.5F;
case 6 -> scale = 5.5F;
}
GL11.glPushMatrix();
@@ -70,44 +60,29 @@ public class RenderTileEnergyStorageCore extends TileEntitySpecialRenderer {
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
FMLClientHandler.instance().getClient().getTextureManager().bindTexture(iner_model_texture);
FMLClientHandler.instance().getClient().getTextureManager().bindTexture(InnerModelTexture);
double colour = (double) ((TileEnergyStorageCore) tile).getEnergyStored()
/ (double) ((TileEnergyStorageCore) tile).getMaxEnergyStored();
double color = (double) core.getEnergyStored() / core.getMaxEnergyStored();
float brightness = (float) Math.abs(Math.sin((float) Minecraft.getSystemTime() / 3000f) * 100f);
colour = 1f - colour;
color = 1f - color;
GL11.glScalef(scale, scale, scale);
GL11.glPushMatrix();
GL11.glRotatef(rotation, 0F, 1F, 0.5F);
GL11.glColor4d(1F, colour * 0.3f, colour * 0.7f, 1F);
GL11.glColor4d(1F, color * 0.3f, color * 0.7f, 1F);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 80f + brightness, 80f + brightness);
iner_model.renderAll();
innerModel.renderAll();
GL11.glPopMatrix();
// GL11.glPushMatrix();
// GL11.glScalef(0.8F, 0.8F, 0.8F);
// GL11.glColor4d(1F, 1f, 0.2f, 1F);
// GL11.glRotatef(rotation, 0F, 1F, 0.5F);
// //iner_model.renderAll();
// GL11.glPopMatrix();
//
// GL11.glPushMatrix();
// GL11.glScalef(0.9F, 0.9F, 0.9F);
// GL11.glColor4d(1F, 0f, 0.2f, 1F);
// GL11.glRotatef(rotation, 0F, 1F, 0.5F);
// //iner_model.renderAll();
// GL11.glPopMatrix();
GL11.glScalef(1.1F, 1.1F, 1.1F);
GL11.glDepthMask(false);
FMLClientHandler.instance().getClient().getTextureManager().bindTexture(outer_model_texture);
FMLClientHandler.instance().getClient().getTextureManager().bindTexture(OuterModelTexture);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 200F, 200F);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glRotatef(rotation * 0.5F, 0F, -1F, -0.5F);
GL11.glColor4f(0.5F, 2F, 2F, 0.7F);
iner_model.renderAll();
innerModel.renderAll();
GL11.glDisable(GL11.GL_BLEND);
GL11.glDepthMask(true);
GL11.glEnable(GL11.GL_LIGHTING);
@@ -31,9 +31,9 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer {
private static final ResourceLocation modelTexture = new ResourceLocation(
References.MODID.toLowerCase(),
"textures/models/stabilizer_sphere.png");
private IModelCustom stabilizerSphereModel;
private final IModelCustom stabilizerSphereModel;
private float pxl = 1F / 64;
private final float pixel = 1F / 64F;
public RenderTileParticleGen() {
stabilizerSphereModel = AdvancedModelLoader
@@ -54,8 +54,8 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer {
public void renderBlock(TileParticleGenerator tl, float f3) {
Tessellator tessellator = Tessellator.instance;
boolean inverted = tl.inverted;
boolean stabilizerMode = tl.stabalizerMode;
boolean inverted = tl.isInverted;
boolean stabilizerMode = tl.isInStabilizerMode;
GL11.glPushMatrix();
@@ -104,7 +104,7 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer {
drawEnergyBeam(tessellator, tl, f3);
}
if (tl.beam_enabled) preRenderBeam(tessellator, tl, f3);
if (tl.isBeamEnabled) preRenderBeam(tessellator, tl, f3);
}
private void drawEnergyBeam(Tessellator tess, TileParticleGenerator gen, float f) {
@@ -144,12 +144,12 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer {
GL11.glColor4f(0.0F, 2.0F, 0.0F, 1F);
GL11.glTranslated(0.5, 0, 0.5);
GL11.glScalef(0.4F, 0.4F, 0.4F);
if (!tile.stabalizerMode) {
float red = (float) tile.beam_red / 255F;
float green = (float) tile.beam_green / 255F;
float blue = (float) tile.beam_blue / 255F;
if (!tile.isInStabilizerMode) {
float red = (float) tile.beamRed / 255F;
float green = (float) tile.beamGreen / 255F;
float blue = (float) tile.beamBlue / 255F;
GL11.glColor4f(red, green, blue, 1F);
GL11.glScalef(tile.beam_scale, tile.beam_scale, tile.beam_scale);
GL11.glScalef(tile.beamScale, tile.beamScale, tile.beamScale);
}
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 200, 200);
@@ -166,10 +166,10 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer {
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDepthMask(false);
GL11.glColor4f(0.0F, 1.0F, 1.0F, 0.5F);
if (!tile.stabalizerMode) {
float red = (float) tile.beam_red / 255F;
float green = (float) tile.beam_green / 255F;
float blue = (float) tile.beam_blue / 255F;
if (!tile.isInStabilizerMode) {
float red = (float) tile.beamRed / 255F;
float green = (float) tile.beamGreen / 255F;
float blue = (float) tile.beamBlue / 255F;
GL11.glColor4f(red, green, blue, 0.5F);
}
GL11.glEnable(GL11.GL_BLEND);
@@ -217,10 +217,10 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer {
double d17 = 0.5D + Math.sin(rotation + 3.9269908169872414D) * scale;
double d19 = 0.5D + Math.cos(rotation + 5.497787143782138D) * scale;
double d21 = 0.5D + Math.sin(rotation + 5.497787143782138D) * scale;
double height = (double) (length);
double height = length;
double texXMin = 0.0D;
double texXMax = 1.0D;
double d28 = (double) (-1.0F + upMot);
double d28 = -1.0F + upMot;
double texHeight = (double) (length) * (0.5D / scale) + d28;
tess.addVertexWithUV(x + d7, y + height, z + d9, texXMax, texHeight);
@@ -297,10 +297,10 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer {
double d12 = 0.8D;
double d14 = 0.8D;
double d16 = 0.8D;
double d18 = (double) (length);
double d18 = length;
double d20 = 0.0D;
double d22 = 1.0D;
double d24 = (double) (-1.0F + upMot);
double d24 = -1.0F + upMot;
double d26 = (double) (length) + d24;
tess.addVertexWithUV(x + d30, y + d18, z + d4, d22, d26);
tess.addVertexWithUV(x + d30, y, z + d4, d22, d24);
@@ -333,16 +333,16 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer {
private void drawCornerCube(Tessellator tess, float x, float y, float z, float FP, boolean inverted,
boolean stabalizerMode) {
float srcXMin = inverted ? 38F * pxl : 32F * pxl;
float srcXMin = inverted ? 38F * pixel : 32F * pixel;
float srcYMin = 0F;
float srcXMax = inverted ? 44F * pxl : 38F * pxl;
float srcYMax = 6 * pxl;
float srcXMax = inverted ? 44F * pixel : 38F * pixel;
float srcYMax = 6 * pixel;
// float FP = 0.6F; //Scale
float FN = 1F - FP;
if (stabalizerMode) {
srcXMin = 44F * pxl;
srcXMax = 50F * pxl;
srcXMin = 44F * pixel;
srcXMax = 50F * pixel;
}
// X+
@@ -385,8 +385,8 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer {
private void drawBeamX(Tessellator tess, float x, float y, float z, float FP) {
float srcXMin = 0;
float srcYMin = 0F;
float srcXMax = 32F * pxl;
float srcYMax = 4 * pxl;
float srcXMax = 32F * pixel;
float srcYMax = 4 * pixel;
float FN = 1F - FP;
float XX = 0.9F;
@@ -420,8 +420,8 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer {
private void drawBeamY(Tessellator tess, float x, float y, float z, float FP) {
float srcXMin = 0;
float srcYMin = 0F;
float srcXMax = 32F * pxl;
float srcYMax = 4 * pxl;
float srcXMax = 32F * pixel;
float srcYMax = 4 * pixel;
float FN = 1F - FP;
float XX = 0.9F;
@@ -455,8 +455,8 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer {
private void drawBeamZ(Tessellator tess, float x, float y, float z, float FP) {
float srcXMin = 0;
float srcYMin = 0F;
float srcXMax = 32F * pxl;
float srcYMax = 4 * pxl;
float srcXMax = 32F * pixel;
float srcYMax = 4 * pixel;
float FN = 1F - FP;
float XX = 0.9F;
@@ -491,17 +491,17 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer {
GL11.glPushMatrix();
GL11.glTranslated(0, 0.5, 0.5);
GL11.glRotatef(90F + gen.beam_pitch, 1F, 0F, 0F);
GL11.glRotatef(90F + gen.beamPitch, 1F, 0F, 0F);
GL11.glTranslated(0, 0, -0.5);
GL11.glTranslated(0.5, 0, 0);
GL11.glRotatef(gen.beam_yaw, 0F, 0F, 1F);
GL11.glRotatef(gen.beamYaw, 0F, 0F, 1F);
GL11.glTranslated(-0.5, 0, 0);
renderBeam(tess, gen, f);
GL11.glPopMatrix();
if (gen.render_core) {
if (gen.shouldRenderCore) {
GL11.glPushMatrix();
GL11.glTranslated(0, 0.5, 0);
renderStabilizerSphere(gen);
@@ -513,10 +513,10 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer {
int x = 0;
int y = 0;
int z = 0;
double length = tile.beam_length;
float red = (float) tile.beam_red / 255F;
float green = (float) tile.beam_green / 255F;
float blue = (float) tile.beam_blue / 255F;
double length = tile.beamLength;
float red = (float) tile.beamRed / 255F;
float green = (float) tile.beamGreen / 255F;
float blue = (float) tile.beamBlue / 255F;
GL11.glPushMatrix();
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
@@ -533,14 +533,13 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer {
// float time = (float)tile.getWorldObj().getTotalWorldTime() + f;
float time = tile.rotation + f;
float upMot = -time * 0.2F - (float) MathHelper.floor_float(-time * 0.1F);
float rotValue = tile.beam_rotation * (tile.rotation + f * 0.5F);
double rotation = rotValue;
double rotation = tile.beamRotation * (tile.rotation + f * 0.5F);
tess.startDrawingQuads();
tess.setBrightness(200);
tess.setColorRGBA(tile.beam_red, tile.beam_green, tile.beam_blue, 32);
tess.setColorRGBA(tile.beamRed, tile.beamGreen, tile.beamBlue, 32);
double scale = (double) tile.beam_scale * 0.2D;
double scale = (double) tile.beamScale * 0.2D;
double d7 = 0.5D + Math.cos(rotation + 2.356194490192345D) * scale; // x point 1
double d9 = 0.5D + Math.sin(rotation + 2.356194490192345D) * scale; // z point 1
double d11 = 0.5D + Math.cos(rotation + (Math.PI / 4D)) * scale; // x point 2
@@ -549,31 +548,30 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer {
double d17 = 0.5D + Math.sin(rotation + 3.9269908169872414D) * scale;
double d19 = 0.5D + Math.cos(rotation + 5.497787143782138D) * scale;
double d21 = 0.5D + Math.sin(rotation + 5.497787143782138D) * scale;
double height = (double) (length);
double texXMin = 0.0D;
double texXMax = 1.0D;
double d28 = (double) (-1.0F + upMot);
double texHeight = (double) (length) * (0.5D / scale) + d28;
double d28 = -1.0F + upMot;
double texHeight = length * (0.5D / scale) + d28;
tess.addVertexWithUV(x + d7, y + height, z + d9, texXMax, texHeight);
tess.addVertexWithUV(x + d7, y + length, z + d9, texXMax, texHeight);
tess.addVertexWithUV(x + d7, y, z + d9, texXMax, d28);
tess.addVertexWithUV(x + d11, y, z + d13, texXMin, d28);
tess.addVertexWithUV(x + d11, y + height, z + d13, texXMin, texHeight);
tess.addVertexWithUV(x + d11, y + length, z + d13, texXMin, texHeight);
tess.addVertexWithUV(x + d19, y + height, z + d21, texXMax, texHeight);
tess.addVertexWithUV(x + d19, y + length, z + d21, texXMax, texHeight);
tess.addVertexWithUV(x + d19, y, z + d21, texXMax, d28);
tess.addVertexWithUV(x + d15, y, z + d17, texXMin, d28);
tess.addVertexWithUV(x + d15, y + height, z + d17, texXMin, texHeight);
tess.addVertexWithUV(x + d15, y + length, z + d17, texXMin, texHeight);
tess.addVertexWithUV(x + d11, y + height, z + d13, texXMax, texHeight);
tess.addVertexWithUV(x + d11, y + length, z + d13, texXMax, texHeight);
tess.addVertexWithUV(x + d11, y, z + d13, texXMax, d28);
tess.addVertexWithUV(x + d19, y, z + d21, texXMin, d28);
tess.addVertexWithUV(x + d19, y + height, z + d21, texXMin, texHeight);
tess.addVertexWithUV(x + d19, y + length, z + d21, texXMin, texHeight);
tess.addVertexWithUV(x + d15, y + height, z + d17, texXMax, texHeight);
tess.addVertexWithUV(x + d15, y + length, z + d17, texXMax, texHeight);
tess.addVertexWithUV(x + d15, y, z + d17, texXMax, d28);
tess.addVertexWithUV(x + d7, y, z + d9, texXMin, d28);
tess.addVertexWithUV(x + d7, y + height, z + d9, texXMin, texHeight);
tess.addVertexWithUV(x + d7, y + length, z + d9, texXMin, texHeight);
rotation += 0.77f;
d7 = 0.5D + Math.cos(rotation + 2.356194490192345D) * scale;
@@ -586,29 +584,29 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer {
d21 = 0.5D + Math.sin(rotation + 5.497787143782138D) * scale;
d28 = (-1F + (upMot * 1));
texHeight = (double) (length) * (0.5D / scale) + d28;
texHeight = length * (0.5D / scale) + d28;
tess.setColorRGBA_F(red, green, blue, 1f);
tess.addVertexWithUV(x + d7, y + height, z + d9, texXMax, texHeight);
tess.addVertexWithUV(x + d7, y + length, z + d9, texXMax, texHeight);
tess.addVertexWithUV(x + d7, y, z + d9, texXMax, d28);
tess.addVertexWithUV(x + d11, y, z + d13, texXMin, d28);
tess.addVertexWithUV(x + d11, y + height, z + d13, texXMin, texHeight);
tess.addVertexWithUV(x + d11, y + length, z + d13, texXMin, texHeight);
tess.addVertexWithUV(x + d19, y + height, z + d21, texXMax, texHeight);
tess.addVertexWithUV(x + d19, y + length, z + d21, texXMax, texHeight);
tess.addVertexWithUV(x + d19, y, z + d21, texXMax, d28);
tess.addVertexWithUV(x + d15, y, z + d17, texXMin, d28);
tess.addVertexWithUV(x + d15, y + height, z + d17, texXMin, texHeight);
tess.addVertexWithUV(x + d15, y + length, z + d17, texXMin, texHeight);
tess.addVertexWithUV(x + d11, y + height, z + d13, texXMax, texHeight);
tess.addVertexWithUV(x + d11, y + length, z + d13, texXMax, texHeight);
tess.addVertexWithUV(x + d11, y, z + d13, texXMax, d28);
tess.addVertexWithUV(x + d19, y, z + d21, texXMin, d28);
tess.addVertexWithUV(x + d19, y + height, z + d21, texXMin, texHeight);
tess.addVertexWithUV(x + d19, y + length, z + d21, texXMin, texHeight);
tess.addVertexWithUV(x + d15, y + height, z + d17, texXMax, texHeight);
tess.addVertexWithUV(x + d15, y + length, z + d17, texXMax, texHeight);
tess.addVertexWithUV(x + d15, y, z + d17, texXMax, d28);
tess.addVertexWithUV(x + d7, y, z + d9, texXMin, d28);
tess.addVertexWithUV(x + d7, y + height, z + d9, texXMin, texHeight);
tess.addVertexWithUV(x + d7, y + length, z + d9, texXMin, texHeight);
tess.draw();
GL11.glPushMatrix();
@@ -620,10 +618,10 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer {
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glDepthMask(false);
GL11.glTranslated(0.5, 0, 0.5);
GL11.glScalef(tile.beam_scale, 1f, tile.beam_scale);
GL11.glScalef(tile.beamScale, 1f, tile.beamScale);
GL11.glTranslated(-0.5, -0, -0.5);
tess.startDrawingQuads();
tess.setColorRGBA(tile.beam_red, tile.beam_green, tile.beam_blue, 32);
tess.setColorRGBA(tile.beamRed, tile.beamGreen, tile.beamBlue, 32);
double d30 = 0.2D;
double d4 = 0.2D;
double d6 = 0.8D;
@@ -632,27 +630,26 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer {
double d12 = 0.8D;
double d14 = 0.8D;
double d16 = 0.8D;
double d18 = (double) (length);
double d20 = 0.0D;
double d22 = 1D;
double d24 = (double) (-1.0F + upMot);
double d26 = (double) (length) + d24;
tess.addVertexWithUV(x + d30, y + d18, z + d4, d22, d26);
double d24 = -1.0F + upMot;
double d26 = length + d24;
tess.addVertexWithUV(x + d30, y + length, z + d4, d22, d26);
tess.addVertexWithUV(x + d30, y, z + d4, d22, d24);
tess.addVertexWithUV(x + d6, y, z + d8, d20, d24);
tess.addVertexWithUV(x + d6, y + d18, z + d8, d20, d26);
tess.addVertexWithUV(x + d14, y + d18, z + d16, d22, d26);
tess.addVertexWithUV(x + d6, y + length, z + d8, d20, d26);
tess.addVertexWithUV(x + d14, y + length, z + d16, d22, d26);
tess.addVertexWithUV(x + d14, y, z + d16, d22, d24);
tess.addVertexWithUV(x + d10, y, z + d12, d20, d24);
tess.addVertexWithUV(x + d10, y + d18, z + d12, d20, d26);
tess.addVertexWithUV(x + d6, y + d18, z + d8, d22, d26);
tess.addVertexWithUV(x + d10, y + length, z + d12, d20, d26);
tess.addVertexWithUV(x + d6, y + length, z + d8, d22, d26);
tess.addVertexWithUV(x + d6, y, z + d8, d22, d24);
tess.addVertexWithUV(x + d14, y, z + d16, d20, d24);
tess.addVertexWithUV(x + d14, y + d18, z + d16, d20, d26);
tess.addVertexWithUV(x + d10, y + d18, z + d12, d22, d26);
tess.addVertexWithUV(x + d14, y + length, z + d16, d20, d26);
tess.addVertexWithUV(x + d10, y + length, z + d12, d22, d26);
tess.addVertexWithUV(x + d10, y, z + d12, d22, d24);
tess.addVertexWithUV(x + d30, y, z + d4, d20, d24);
tess.addVertexWithUV(x + d30, y + d18, z + d4, d20, d26);
tess.addVertexWithUV(x + d30, y + length, z + d4, d20, d26);
tess.draw();
GL11.glPopMatrix();
@@ -1,16 +1,16 @@
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.RenderManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
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.ItemBlock;
import net.minecraft.item.ItemBow;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
@@ -22,37 +22,38 @@ import com.brandon3055.draconicevolution.common.tileentities.TilePlacedItem;
*/
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
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float timeSinceLastTick) {
if (te == null || !(te instanceof TilePlacedItem)) return;
TilePlacedItem tile = (TilePlacedItem) te;
if (tile.getStack() == null) return;
if (!(te instanceof TilePlacedItem tile)) return;
ItemStack stack = tile.getStack();
// 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.glPushAttrib(GL11.GL_ENABLE_BIT);
GL11.glTranslated(x, y, z);
renderItem(tile);
GL11.glPopAttrib();
GL11.glPopMatrix();
}
public void renderItem(TilePlacedItem tile) {
ItemStack stack = tile.getStack();
World world = Minecraft.getMinecraft().theWorld;
EntityItem itemEntity = new EntityItem(tile.getWorldObj(), 0, 0, 0, stack);
int meta = world.getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord);
// itemEntity.getEntityItem().stackSize = 1;
itemEntity.hoverStart = 0.0F;
boolean is3D = stack.getItem().isFull3D();
boolean isBlock = stack.getItem() instanceof ItemBlock;
int meta = tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord);
final Item item = stack.getItem();
boolean is3D = item.isFull3D();
boolean isBlock = item instanceof ItemBlock;
if (isBlock) {
GL11.glTranslatef(0.5F, 0.25F, 0.5F);
GL11.glScalef(1.5F, 1.5F, 1.5F);
metaAdjustBlock(meta);
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.glRotatef(90F, -1F, 0F, 0F);
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.glRotatef(tile.rotation, 0F, 0F, 1F);
GL11.glTranslatef(0.0F, -0.21F, 0.0F);
} else if (stack.getItem() instanceof MobSoul) {
GL11.glTranslatef(0.5F, 0.3F, 0.5F);
} else if (item instanceof MobSoul) {
GL11.glTranslatef(MOBSOUL_CENTER_X, MOBSOUL_CENTER_Y, MOBSOUL_CENTER_Z);
} else {
GL11.glRotatef(90F, -1F, 0F, 0F);
GL11.glTranslatef(0.5F, -0.65F, 0.02F);
@@ -72,12 +72,17 @@ public class RenderTilePlacedItem extends TileEntitySpecialRenderer {
GL11.glTranslatef(0.0F, -0.18F, 0.0F);
}
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
RenderItem.renderInFrame = true;
RenderManager.instance.renderEntityWithPosYaw(itemEntity, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
RenderItem.renderInFrame = false;
GL11.glDisable(GL11.GL_BLEND);
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;
}
}
private void metaAdjustItemTool(int meta) {
@@ -27,35 +27,23 @@ public class RenderTileReactorCore extends TileEntitySpecialRenderer {
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTick) {
TileReactorCore tile = (TileReactorCore) tileEntity;
// tile.renderList.clear();
TileReactorCore core = (TileReactorCore) tileEntity;
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
renderReactorCore(tile, partialTick);
// for (MultiblockHelper.TileOffset offset : tile.stabilizerLocations){
// if (!(offset.getTileEntity(tileEntity) instanceof TileReactorStabilizer)) continue;
// GL11.glPushMatrix();
//
// TileReactorStabilizer stabilizer = (TileReactorStabilizer)offset.getTileEntity(tileEntity);
// GL11.glTranslated(-offset.offsetX, -offset.offsetY, -offset.offsetZ);
// //RenderTileReactorStabilizer.renderCore(stabilizer, partialTick);
// //RenderTileReactorStabilizer.renderEffects(stabilizer, partialTick);
//
// GL11.glPopMatrix();
// }
renderReactorCore(core, partialTick);
GL11.glPopMatrix();
}
public void renderReactorCore(TileReactorCore tile, float partialTick) {
float rotation = (tile.renderRotation * 0.2F) + (partialTick * (tile.renderSpeed * 0.2F));
double ff = tile.maxFieldCharge > 0 ? tile.fieldCharge / tile.maxFieldCharge : 0;
double r = ff < 0.5 ? 1 - (ff * 2) : 0;
double g = ff > 0.5 ? (ff - 0.5) * 2 : 0;
double b = ff * 2;
double a = ff < 0.1 ? (ff * 10) : 1;
public void renderReactorCore(TileReactorCore core, float partialTick) {
float rotation = core.renderRotation * 0.2F + partialTick * (core.renderSpeed * 0.2F);
double fieldChargePercentage = core.maxFieldCharge > 0 ? core.fieldCharge / core.maxFieldCharge : 0;
double r = fieldChargePercentage < 0.5 ? 1 - fieldChargePercentage * 2 : 0;
double g = fieldChargePercentage > 0.5 ? (fieldChargePercentage - 0.5) * 2 : 0;
double b = fieldChargePercentage * 2;
double a = fieldChargePercentage < 0.1 ? fieldChargePercentage * 10 : 1;
// Pre Render
GL11.glPushMatrix();
@@ -65,7 +53,7 @@ public class RenderTileReactorCore extends TileEntitySpecialRenderer {
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 200F, 200F);
// Render inner
if (tile.reactorFuel + tile.convertedFuel < 144) {
if (core.reactorFuel + core.convertedFuel < 144) {
ResourceHandler.bindResource("textures/blocks/draconic_block_blank.png");
GL11.glPushMatrix();
GL11.glScaled(0.1, 0.1, 0.1);
@@ -77,8 +65,8 @@ public class RenderTileReactorCore extends TileEntitySpecialRenderer {
GL11.glColor4d(1, 1, 1, 1);
GL11.glRotatef(rotation, 0.5F, 1F, 0.5F);
GL11.glScaled(0.5, 0.5, 0.5);
double r3 = tile.getCoreDiameter();
GL11.glScaled(r3, r3, r3);
double diameter = core.getCoreDiameter();
GL11.glScaled(diameter, diameter, diameter);
reactorModel.renderAll();
// Mid Render
@@ -87,10 +75,11 @@ public class RenderTileReactorCore extends TileEntitySpecialRenderer {
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glAlphaFunc(GL11.GL_GREATER, 0F);
if (tile.reactionTemperature < 2000) {
if (core.reactionTemperature < 2000) {
ResourceHandler.bindResource("textures/blocks/draconic_block_blank.png");
if (tile.reactionTemperature > 1000)
GL11.glColor4d(1F, 1F, 1F, 1D - ((tile.reactionTemperature - 1000) / 1000D));
if (core.reactionTemperature > 1000) {
GL11.glColor4d(1F, 1F, 1F, 1D - (core.reactionTemperature - 1000) / 1000D);
}
reactorModel.renderAll();
}
@@ -2,6 +2,7 @@ package com.brandon3055.draconicevolution.client.render.tile;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
@@ -17,38 +18,40 @@ public class RenderTileReactorEnergyInjector extends TileEntitySpecialRenderer {
public static ModelReactorEnergyInjector modelReactorEnergyInjector = new ModelReactorEnergyInjector();
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTick) {
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTick) {
if (!(tile instanceof TileReactorEnergyInjector injector)) {
return;
}
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
renderCore((TileReactorEnergyInjector) tileEntity, partialTick);
renderCore(injector);
GL11.glPopMatrix();
}
public static void renderCore(TileReactorEnergyInjector tile, float partialTick) {
public static void renderCore(TileReactorEnergyInjector injector) {
GL11.glPushMatrix();
float scale = (1F / 16F);
switch (tile.facingDirection) {
case 1:
GL11.glRotated(180, -1, 0, 0);
break;
case 2:
GL11.glRotated(90, 1, 0, 0);
break;
case 3:
GL11.glRotated(90, -1, 0, 0);
break;
case 4:
GL11.glRotated(90, 0, 0, -1);
break;
case 5:
GL11.glRotated(90, 0, 0, 1);
int angle = 90;
ForgeDirection axis = injector.facing;
switch (injector.facing) {
case UP -> {
angle = 180;
axis = ForgeDirection.WEST;
}
case SOUTH -> axis = ForgeDirection.WEST;
case NORTH -> axis = ForgeDirection.EAST;
case WEST -> axis = ForgeDirection.NORTH;
case EAST -> axis = ForgeDirection.SOUTH;
}
if (injector.facing != ForgeDirection.DOWN) {
GL11.glRotated(angle, axis.offsetX, axis.offsetY, axis.offsetZ);
}
ResourceHandler.bindResource("textures/models/ModelReactorPowerInjector.png");
modelReactorEnergyInjector.render(null, tile.modelIllumination, 0F, 0F, 0F, 0F, scale);
modelReactorEnergyInjector.render(null, injector.modelIllumination, 0F, 0F, 0F, 0F, scale);
GL11.glPopMatrix();
}
@@ -2,6 +2,7 @@ package com.brandon3055.draconicevolution.client.render.tile;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
@@ -19,120 +20,49 @@ public class RenderTileReactorStabilizer extends TileEntitySpecialRenderer {
public static ModelReactorStabilizerCore modelStabilizerCore = new ModelReactorStabilizerCore();
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTick) {
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTick) {
if (!(tile instanceof TileReactorStabilizer stabilizer)) {
return;
}
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
renderCore((TileReactorStabilizer) tileEntity, partialTick);
// renderEffects((TileReactorStabilizer) tileEntity, partialTick);
renderCore(stabilizer, partialTick);
GL11.glPopMatrix();
}
public static void renderCore(TileReactorStabilizer tile, float partialTick) {
public static void renderCore(TileReactorStabilizer stabilizer, float partialTick) {
GL11.glPushMatrix();
float scale = (1F / 16F);
float coreRotation = tile.coreRotation + (partialTick * tile.coreSpeed);
float ringRotation = tile.ringRotation + (partialTick * tile.ringSpeed);
float coreRotation = stabilizer.coreRotation + (partialTick * stabilizer.coreSpeed);
float ringRotation = stabilizer.ringRotation + (partialTick * stabilizer.ringSpeed);
switch (tile.facingDirection) {
case 0:
GL11.glRotated(90, -1, 0, 0);
break;
case 1:
GL11.glRotated(90, 1, 0, 0);
break;
case 3:
GL11.glRotated(180, 1, 0, 0);
break;
case 4:
GL11.glRotated(90, 0, 1, 0);
break;
case 5:
GL11.glRotated(90, 0, -1, 0);
int angle = 90;
ForgeDirection axis = stabilizer.facing;
switch (stabilizer.facing) {
case DOWN -> axis = ForgeDirection.WEST;
case SOUTH -> {
angle = 180;
axis = ForgeDirection.EAST;
}
case UP -> axis = ForgeDirection.EAST;
case WEST -> axis = ForgeDirection.UP;
case EAST -> axis = ForgeDirection.DOWN;
}
if (stabilizer.facing != ForgeDirection.NORTH) {
GL11.glRotated(angle, axis.offsetX, axis.offsetY, axis.offsetZ);
}
ResourceHandler.bindResource("textures/models/reactorStabilizerCore.png");
modelStabilizerCore.render(null, coreRotation, tile.modelIllumination, 0F, 0F, 0F, scale);
modelStabilizerCore.render(null, coreRotation, stabilizer.modelIllumination, 0F, 0F, 0F, scale);
ResourceHandler.bindResource("textures/models/reactorStabilizerRing.png");
GL11.glRotated(90, 1, 0, 0);
GL11.glTranslated(0, -0.58, 0);
GL11.glScaled(0.95, 0.95, 0.95);
GL11.glRotatef(ringRotation, 0, 1, 0);
modelStabilizerRing.render(null, -70F, tile.modelIllumination, 0F, 0F, 0F, scale);
modelStabilizerRing.render(null, -70F, stabilizer.modelIllumination, 0F, 0F, 0F, scale);
GL11.glPopMatrix();
}
// public static void renderEffects(TileReactorStabilizer tile, float partialTick) {
// if (tile.isValid)
// {
// //Common Fields
// MultiblockHelper.TileLocation master = tile.masterLocation;
// float offsetX = (float)(master.posX - tile.xCoord);
// float offsetY = (float)((double)master.posY - tile.yCoord);
// float offsetZ = (float)(master.posZ - tile.zCoord);
// float length = MathHelper.sqrt_float(offsetX * offsetX + offsetY * offsetY + offsetZ * offsetZ);
//
// Tessellator tessellator = Tessellator.instance;
//
// //Pre Render
// GL11.glPushMatrix();
//// RenderHelper.disableStandardItemLighting();
// GL11.glDisable(GL11.GL_CULL_FACE);
// GL11.glShadeModel(GL11.GL_SMOOTH);
// GL11.glEnable(GL11.GL_BLEND);
// OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
// GL11.glAlphaFunc(GL11.GL_GREATER, 0.0F);
// GL11.glDisable(GL11.GL_LIGHTING);
// GL11.glDepthMask(false);
//
// //Rotate beam to face target
// float f7 = MathHelper.sqrt_float(offsetX * offsetX + offsetZ * offsetZ);
// GL11.glRotatef((float) (-Math.atan2((double) offsetZ, (double) offsetX)) * 180.0F / (float) Math.PI - 90.0F,
// 0.0F, 1.0F, 0.0F);
// GL11.glRotatef((float)(-Math.atan2((double)f7, (double)offsetY)) * 180.0F / (float)Math.PI - 90.0F, 1.0F, 0.0F,
// 0.0F);
//
//
// //Draw Beams
// GL11.glPushMatrix();
// GL11.glTranslated(0, 0, -0.35);
// ResourceHandler.bindTexture(new ResourceLocation("textures/entity/endercrystal/endercrystal_beam.png"));
//// drawBeam(tessellator, 1F, 0.355F, 0.8F, offsetX, offsetY, offsetZ, tile.tick, partialTick, true, false);
// GL11.glPopMatrix();
//
// GL11.glPushMatrix();
// GL11.glTranslated(0, 0, 0.4526);
// float coreSize = 1.1F;
// float s = 0.355F;
//// drawBeam(tessellator, s/coreSize, coreSize, length - 0.5F, offsetX, offsetY, offsetZ, tile.tick, partialTick,
// false, false);
// GL11.glPopMatrix();
//
//// GL11.glPushMatrix();
//// GL11.glTranslated(0, 0, -0.35);
//// ResourceHandler.bindTexture(new ResourceLocation("textures/entity/endercrystal/endercrystal_beam.png"));
//// drawBeam(tessellator, 1F, 0.26F, 0.8F, offsetX, offsetY, offsetZ, tile.tick, partialTick, true, true);
//// GL11.glPopMatrix();
////
//// GL11.glPushMatrix();
//// GL11.glTranslated(0, 0, 0.4526);
//// coreSize = 1.1F;
//// s = 0.263F;
//// drawBeam(tessellator, s/coreSize, coreSize, length - 0.5F, offsetX, offsetY, offsetZ, tile.tick, partialTick,
// false, true);
//// GL11.glPopMatrix();
//
// //Post Render
// GL11.glDepthMask(true);
// GL11.glEnable(GL11.GL_LIGHTING);
// GL11.glEnable(GL11.GL_CULL_FACE);
// GL11.glShadeModel(GL11.GL_FLAT);
//// RenderHelper.enableStandardItemLighting();
// GL11.glDisable(GL11.GL_BLEND);
// GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
// GL11.glPopMatrix();
// }
// }
}
@@ -1,7 +1,5 @@
package com.brandon3055.draconicevolution.client.render.tile;
import java.awt.*;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
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.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
@@ -20,24 +19,24 @@ import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
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.common.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.items.tools.TeleporterMKII;
import com.brandon3055.draconicevolution.common.lib.References;
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.
*/
public class RenderTileTeleporterStand extends TileEntitySpecialRenderer {
ModelTeleporterStand model = new ModelTeleporterStand();
private final ModelTeleporterStand model = new ModelTeleporterStand();
private final ResourceLocation texture = new ResourceLocation(
References.MODID.toLowerCase(),
"textures/models/TeleporterStand.png");
private final EntityItem cachedEntity = new EntityItem(null, 0, 0, 0, new ItemStack(Items.apple));
@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
@@ -69,27 +68,29 @@ public class RenderTileTeleporterStand extends TileEntitySpecialRenderer {
GL11.glPopMatrix();
}
public void renderItem(TileEntity tile, ItemStack item, float f) {
if (item.getItem() == null) return;
public void renderItem(TileEntity tile, ItemStack stack, float f) {
if (stack.getItem() == null) return;
GL11.glPushMatrix();
EntityItem itemEntity = new EntityItem(tile.getWorldObj(), 0, 0, 0, item);
itemEntity.hoverStart = 0.0F;
if (item.getItem() instanceof TeleporterMKII) {
if (stack.getItem() instanceof TeleporterMKII) {
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 {
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;
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;
GL11.glPopMatrix();
@@ -126,9 +127,6 @@ public class RenderTileTeleporterStand extends TileEntitySpecialRenderer {
GL11.glRotated(180, 0, 1, 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 yDiff = player.posY - (tileentity.yCoord + 0.5);
double zDiff = player.posZ - (tileentity.zCoord + 0.5);
@@ -136,7 +134,7 @@ public class RenderTileTeleporterStand extends TileEntitySpecialRenderer {
double pitchAngle = Math.toDegrees(
Math.atan2(
yDiff,
Utills.getDistanceAtoB(
Utils.getDistanceAtoB(
player.posX,
player.posY,
player.posZ,
@@ -1,71 +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.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.init.Items;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
@@ -16,7 +17,8 @@ import com.brandon3055.draconicevolution.common.tileentities.TileUpgradeModifier
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
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) {
@@ -207,8 +209,6 @@ public class RenderTileUpgradeModifier extends TileEntitySpecialRenderer {
GL11.glPushMatrix();
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.glScalef(1F, 1F, 1F);
@@ -220,7 +220,15 @@ public class RenderTileUpgradeModifier extends TileEntitySpecialRenderer {
}
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;
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;
@@ -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,38 +1,104 @@
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.tileentity.TileEntity;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeChunkManager;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.oredict.OreDictionary;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.creativetab.DETab;
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.entity.*;
import com.brandon3055.draconicevolution.common.handler.*;
import com.brandon3055.draconicevolution.common.entity.EntityChaosBolt;
import com.brandon3055.draconicevolution.common.entity.EntityChaosCrystal;
import com.brandon3055.draconicevolution.common.entity.EntityChaosGuardian;
import com.brandon3055.draconicevolution.common.entity.EntityChaosVortex;
import com.brandon3055.draconicevolution.common.entity.EntityCustomArrow;
import com.brandon3055.draconicevolution.common.entity.EntityCustomDragon;
import com.brandon3055.draconicevolution.common.entity.EntityDraconicArrow;
import com.brandon3055.draconicevolution.common.entity.EntityDragonHeart;
import com.brandon3055.draconicevolution.common.entity.EntityDragonProjectile;
import com.brandon3055.draconicevolution.common.entity.EntityEnderArrow;
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.handler.ContributorHandler;
import com.brandon3055.draconicevolution.common.handler.CraftingHandler;
import com.brandon3055.draconicevolution.common.handler.FMLEventHandler;
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.References;
import com.brandon3055.draconicevolution.common.magic.EnchantmentReaper;
import com.brandon3055.draconicevolution.common.magic.PotionHandler;
import com.brandon3055.draconicevolution.common.network.*;
import com.brandon3055.draconicevolution.common.tileentities.*;
import com.brandon3055.draconicevolution.common.network.BlockUpdatePacket;
import com.brandon3055.draconicevolution.common.network.ButtonPacket;
import com.brandon3055.draconicevolution.common.network.ContributorPacket;
import com.brandon3055.draconicevolution.common.network.DislocatorInhibitorButtonPacket;
import com.brandon3055.draconicevolution.common.network.GenericParticlePacket;
import com.brandon3055.draconicevolution.common.network.ItemConfigPacket;
import com.brandon3055.draconicevolution.common.network.MagnetToggleAckPacket;
import com.brandon3055.draconicevolution.common.network.MagnetTogglePacket;
import com.brandon3055.draconicevolution.common.network.MagnetToggleSelfPickupAckPacket;
import com.brandon3055.draconicevolution.common.network.MagnetToggleSelfPickupPacket;
import com.brandon3055.draconicevolution.common.network.MountUpdatePacket;
import com.brandon3055.draconicevolution.common.network.ParticleGenPacket;
import com.brandon3055.draconicevolution.common.network.PlacedItemPacket;
import com.brandon3055.draconicevolution.common.network.PlayerDetectorButtonPacket;
import com.brandon3055.draconicevolution.common.network.PlayerDetectorStringPacket;
import com.brandon3055.draconicevolution.common.network.ShieldHitPacket;
import com.brandon3055.draconicevolution.common.network.SlotFakeClickPacket;
import com.brandon3055.draconicevolution.common.network.SpeedRequestPacket;
import com.brandon3055.draconicevolution.common.network.TeleporterPacket;
import com.brandon3055.draconicevolution.common.network.TileObjectPacket;
import com.brandon3055.draconicevolution.common.network.ToolModePacket;
import com.brandon3055.draconicevolution.common.tileentities.TileCKeyStone;
import com.brandon3055.draconicevolution.common.tileentities.TileChaosShard;
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.TileDraconiumChest;
import com.brandon3055.draconicevolution.common.tileentities.TileEnergyInfuser;
import com.brandon3055.draconicevolution.common.tileentities.TileGenerator;
import com.brandon3055.draconicevolution.common.tileentities.TileGrinder;
import com.brandon3055.draconicevolution.common.tileentities.TileParticleGenerator;
import com.brandon3055.draconicevolution.common.tileentities.TilePlacedItem;
import com.brandon3055.draconicevolution.common.tileentities.TilePlayerDetector;
import com.brandon3055.draconicevolution.common.tileentities.TilePlayerDetectorAdvanced;
import com.brandon3055.draconicevolution.common.tileentities.TilePotentiometer;
import com.brandon3055.draconicevolution.common.tileentities.TileSunDial;
import com.brandon3055.draconicevolution.common.tileentities.TileTeleporterStand;
import com.brandon3055.draconicevolution.common.tileentities.TileUpgradeModifier;
import com.brandon3055.draconicevolution.common.tileentities.TileWeatherController;
import com.brandon3055.draconicevolution.common.tileentities.energynet.TileEnergyRelay;
import com.brandon3055.draconicevolution.common.tileentities.energynet.TileEnergyTransceiver;
import com.brandon3055.draconicevolution.common.tileentities.energynet.TileWirelessEnergyTransceiver;
import com.brandon3055.draconicevolution.common.tileentities.gates.TileFluidGate;
import com.brandon3055.draconicevolution.common.tileentities.gates.TileFluxGate;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.*;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileDislocatorReceptacle;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEarth;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnderResurrection;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyPylon;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyStorageCore;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileInvisibleMultiblock;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TilePortalBlock;
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.TileReactorStabilizer;
import com.brandon3055.draconicevolution.common.utills.DragonChunkLoader;
import com.brandon3055.draconicevolution.common.utills.LogHelper;
import com.brandon3055.draconicevolution.common.utils.DragonChunkLoader;
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.integration.computers.CCOCIntegration;
@@ -40,6 +106,8 @@ import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
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.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
@@ -47,10 +115,28 @@ import cpw.mods.fml.relauncher.Side;
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) {
FileHandler.init(event);
ProcessHandler.init();
ConfigHandler.init(event.getSuggestedConfigurationFile());
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();
ModItems.init();
ContributorHandler.init();
@@ -59,31 +145,8 @@ public class CommonProxy {
registerOres();
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");
}
@@ -95,131 +158,96 @@ public class CommonProxy {
DETab.initialize();
PotionHandler.init();
CCOCIntegration.init();
DragonChunkLoader.init();
this.dragonChunkLoader = new DragonChunkLoader();
ForgeChunkManager.setForcedChunkLoadingCallback(DraconicEvolution.instance, this.dragonChunkLoader);
LogHelper.info("Finished Initialization");
}
public void postInit(FMLPostInitializationEvent event) {
BalanceConfigHandler.finishLoading();
OreDoublingRegistry.init();
Achievements.registerAchievementPane();
this.achievements.registerAchievementPane();
LogHelper.info("Finished PostInitialization");
}
public void initializeNetwork() {
DraconicEvolution.network = NetworkRegistry.INSTANCE.newSimpleChannel(DraconicEvolution.networkChannelName);
DraconicEvolution.network.registerMessage(ButtonPacket.Handler.class, ButtonPacket.class, 0, Side.SERVER);
DraconicEvolution.network
.registerMessage(ParticleGenPacket.Handler.class, ParticleGenPacket.class, 1, Side.SERVER);
DraconicEvolution.network
.registerMessage(PlacedItemPacket.Handler.class, PlacedItemPacket.class, 2, Side.SERVER);
DraconicEvolution.network.registerMessage(
PlayerDetectorButtonPacket.Handler.class,
PlayerDetectorButtonPacket.class,
3,
Side.SERVER);
DraconicEvolution.network.registerMessage(
PlayerDetectorStringPacket.Handler.class,
PlayerDetectorStringPacket.class,
4,
Side.SERVER);
DraconicEvolution.network
.registerMessage(TeleporterPacket.Handler.class, TeleporterPacket.class, 5, Side.SERVER);
DraconicEvolution.network
.registerMessage(TileObjectPacket.Handler.class, TileObjectPacket.class, 6, Side.CLIENT);
DraconicEvolution.network
.registerMessage(MountUpdatePacket.Handler.class, MountUpdatePacket.class, 7, Side.CLIENT);
DraconicEvolution.network
.registerMessage(MountUpdatePacket.Handler.class, MountUpdatePacket.class, 8, Side.SERVER);
DraconicEvolution.network
.registerMessage(ItemConfigPacket.Handler.class, ItemConfigPacket.class, 9, Side.SERVER);
DraconicEvolution.network
.registerMessage(TileObjectPacket.Handler.class, TileObjectPacket.class, 10, Side.SERVER);
DraconicEvolution.network
.registerMessage(BlockUpdatePacket.Handler.class, BlockUpdatePacket.class, 11, Side.SERVER);
DraconicEvolution.network
.registerMessage(SpeedRequestPacket.Handler.class, SpeedRequestPacket.class, 12, Side.SERVER);
DraconicEvolution.network
.registerMessage(SpeedRequestPacket.Handler.class, SpeedRequestPacket.class, 13, Side.CLIENT);
DraconicEvolution.network.registerMessage(ToolModePacket.Handler.class, ToolModePacket.class, 14, Side.SERVER);
DraconicEvolution.network
.registerMessage(GenericParticlePacket.Handler.class, GenericParticlePacket.class, 15, Side.CLIENT);
DraconicEvolution.network
.registerMessage(ShieldHitPacket.Handler.class, ShieldHitPacket.class, 16, Side.CLIENT);
DraconicEvolution.network
.registerMessage(ContributorPacket.Handler.class, ContributorPacket.class, 17, Side.CLIENT);
DraconicEvolution.network
.registerMessage(ContributorPacket.Handler.class, ContributorPacket.class, 18, Side.SERVER);
DraconicEvolution.network
.registerMessage(MagnetTogglePacket.Handler.class, MagnetTogglePacket.class, 19, Side.SERVER);
DraconicEvolution.network
.registerMessage(MagnetToggleAckPacket.Handler.class, MagnetToggleAckPacket.class, 20, Side.CLIENT);
public void onServerStopped(FMLServerStoppedEvent event) {
this.serverInhibitorsMap.clear();
this.dragonChunkLoader.onServerStopped();
this.armorHandler.onServerStopped();
}
public void registerTileEntities() {
GameRegistry
.registerTileEntity(TileWeatherController.class, References.RESOURCESPREFIX + "TileWeatherController");
@SubscribeEvent
public void onWorldUnload(WorldEvent.Unload event) {
this.serverInhibitorsMap.remove(event.world);
}
private void initializeNetwork() {
// spotless:off
DraconicEvolution.network = NetworkRegistry.INSTANCE.newSimpleChannel(DraconicEvolution.networkChannelName);
DraconicEvolution.network.registerMessage(ButtonPacket.Handler.class, ButtonPacket.class, 0, Side.SERVER);
DraconicEvolution.network.registerMessage(ParticleGenPacket.Handler.class, ParticleGenPacket.class, 1, Side.SERVER);
DraconicEvolution.network.registerMessage(PlacedItemPacket.Handler.class, PlacedItemPacket.class, 2, Side.SERVER);
DraconicEvolution.network.registerMessage(PlayerDetectorButtonPacket.Handler.class, PlayerDetectorButtonPacket.class, 3, Side.SERVER);
DraconicEvolution.network.registerMessage(PlayerDetectorStringPacket.Handler.class, PlayerDetectorStringPacket.class, 4, Side.SERVER);
DraconicEvolution.network.registerMessage(TeleporterPacket.Handler.class, TeleporterPacket.class, 5, Side.SERVER);
DraconicEvolution.network.registerMessage(TileObjectPacket.Handler.class, TileObjectPacket.class, 6, Side.CLIENT);
DraconicEvolution.network.registerMessage(MountUpdatePacket.Handler.class, MountUpdatePacket.class, 7, Side.CLIENT);
DraconicEvolution.network.registerMessage(MountUpdatePacket.Handler.class, MountUpdatePacket.class, 8, Side.SERVER);
DraconicEvolution.network.registerMessage(ItemConfigPacket.Handler.class, ItemConfigPacket.class, 9, Side.SERVER);
DraconicEvolution.network.registerMessage(TileObjectPacket.Handler.class, TileObjectPacket.class, 10, Side.SERVER);
DraconicEvolution.network.registerMessage(BlockUpdatePacket.Handler.class, BlockUpdatePacket.class, 11, Side.SERVER);
DraconicEvolution.network.registerMessage(SpeedRequestPacket.Handler.class, SpeedRequestPacket.class, 12, Side.SERVER);
DraconicEvolution.network.registerMessage(SpeedRequestPacket.Handler.class, SpeedRequestPacket.class, 13, Side.CLIENT);
DraconicEvolution.network.registerMessage(ToolModePacket.Handler.class, ToolModePacket.class, 14, Side.SERVER);
DraconicEvolution.network.registerMessage(GenericParticlePacket.Handler.class, GenericParticlePacket.class, 15, Side.CLIENT);
DraconicEvolution.network.registerMessage(ShieldHitPacket.Handler.class, ShieldHitPacket.class, 16, Side.CLIENT);
DraconicEvolution.network.registerMessage(ContributorPacket.Handler.class, ContributorPacket.class, 17, Side.CLIENT);
DraconicEvolution.network.registerMessage(ContributorPacket.Handler.class, ContributorPacket.class, 18, Side.SERVER);
DraconicEvolution.network.registerMessage(MagnetTogglePacket.Handler.class, MagnetTogglePacket.class, 19, Side.SERVER);
DraconicEvolution.network.registerMessage(MagnetToggleAckPacket.Handler.class, MagnetToggleAckPacket.class, 20, Side.CLIENT);
DraconicEvolution.network.registerMessage(DislocatorInhibitorButtonPacket.Handler.class, DislocatorInhibitorButtonPacket.class, 21, Side.SERVER);
DraconicEvolution.network.registerMessage(SlotFakeClickPacket.Handler.class, SlotFakeClickPacket.class, 22, Side.SERVER);
DraconicEvolution.network.registerMessage(MagnetToggleSelfPickupPacket.Handler.class, MagnetToggleSelfPickupPacket.class, 23, Side.SERVER);
DraconicEvolution.network.registerMessage(MagnetToggleSelfPickupAckPacket.Handler.class, MagnetToggleSelfPickupAckPacket.class, 24, Side.CLIENT);
// spotless:on
}
private void registerTileEntities() {
// spotless:off
GameRegistry.registerTileEntity(TileWeatherController.class, References.RESOURCESPREFIX + "TileWeatherController");
GameRegistry.registerTileEntity(TileSunDial.class, References.RESOURCESPREFIX + "TileSunDial");
GameRegistry.registerTileEntity(TileGrinder.class, References.RESOURCESPREFIX + "TileGrinder");
GameRegistry.registerTileEntity(TilePotentiometer.class, References.RESOURCESPREFIX + "TilePotentiometer");
GameRegistry
.registerTileEntity(TileParticleGenerator.class, References.RESOURCESPREFIX + "TileParticleGenerator");
GameRegistry.registerTileEntity(TileParticleGenerator.class, References.RESOURCESPREFIX + "TileParticleGenerator");
GameRegistry.registerTileEntity(TilePlayerDetector.class, References.RESOURCESPREFIX + "TilePlayerDetector");
GameRegistry.registerTileEntity(
TilePlayerDetectorAdvanced.class,
References.RESOURCESPREFIX + "TilePlayerDetectorAdvanced");
GameRegistry.registerTileEntity(TilePlayerDetectorAdvanced.class, References.RESOURCESPREFIX + "TilePlayerDetectorAdvanced");
GameRegistry.registerTileEntity(TileEnergyInfuser.class, References.RESOURCESPREFIX + "TileEnergyInfuser");
GameRegistry.registerTileEntity(TileCustomSpawner.class, References.RESOURCESPREFIX + "TileCustomSpawner");
GameRegistry.registerTileEntity(TileGenerator.class, References.RESOURCESPREFIX + "TileGenerator");
GameRegistry
.registerTileEntity(TileEnergyStorageCore.class, References.RESOURCESPREFIX + "TileEnergyStorageCore");
GameRegistry.registerTileEntity(TileEarth.class, References.RESOURCESPREFIX + "TileEarth");
GameRegistry.registerTileEntity(
TileInvisibleMultiblock.class,
References.RESOURCESPREFIX + "TileInvisibleMultiblock");
GameRegistry.registerTileEntity(TileEnergyStorageCore.class, References.RESOURCESPREFIX + "TileEnergyStorageCore");
if (ModBlocks.earthBlock != null) GameRegistry.registerTileEntity(TileEarth.class, References.RESOURCESPREFIX + "TileEarth");
GameRegistry.registerTileEntity(TileInvisibleMultiblock.class, References.RESOURCESPREFIX + "TileInvisibleMultiblock");
GameRegistry.registerTileEntity(TileEnergyPylon.class, References.RESOURCESPREFIX + "TileEnergyPylon");
GameRegistry
.registerTileEntity(TileEnderResurrection.class, References.RESOURCESPREFIX + "TileEnderResurrection");
GameRegistry.registerTileEntity(TileEnderResurrection.class, References.RESOURCESPREFIX + "TileEnderResurrection");
GameRegistry.registerTileEntity(TilePlacedItem.class, References.RESOURCESPREFIX + "TilePlacedItem");
GameRegistry.registerTileEntity(TileCKeyStone.class, References.RESOURCESPREFIX + "TileCKeyStone");
GameRegistry.registerTileEntity(TileDissEnchanter.class, References.RESOURCESPREFIX + "TileDissEnchanter");
GameRegistry.registerTileEntity(TileTeleporterStand.class, References.RESOURCESPREFIX + "TileTeleporterStand");
GameRegistry.registerTileEntity(TileDraconiumChest.class, References.RESOURCESPREFIX + "TileDraconiumChest");
GameRegistry.registerTileEntity(TileEnergyRelay.class, References.RESOURCESPREFIX + "TileEnergyRelay");
GameRegistry
.registerTileEntity(TileEnergyTransceiver.class, References.RESOURCESPREFIX + "TileEnergyTransceiver");
GameRegistry.registerTileEntity(
TileWirelessEnergyTransceiver.class,
References.RESOURCESPREFIX + "TileWirelessEnergyTransceiver");
GameRegistry.registerTileEntity(
TileDislocatorReceptacle.class,
References.RESOURCESPREFIX + "TileDislocatorReceptacle");
GameRegistry.registerTileEntity(TileEnergyTransceiver.class, References.RESOURCESPREFIX + "TileEnergyTransceiver");
GameRegistry.registerTileEntity(TileWirelessEnergyTransceiver.class, References.RESOURCESPREFIX + "TileWirelessEnergyTransceiver");
GameRegistry.registerTileEntity(TileDislocatorReceptacle.class, References.RESOURCESPREFIX + "TileDislocatorReceptacle");
GameRegistry.registerTileEntity(TilePortalBlock.class, References.RESOURCESPREFIX + "TilePortalBlock");
GameRegistry.registerTileEntity(TileReactorCore.class, References.RESOURCESPREFIX + "TileReactorCore");
GameRegistry.registerTileEntity(TileFluxGate.class, References.RESOURCESPREFIX + "TileFluxGate");
GameRegistry.registerTileEntity(TileFluidGate.class, References.RESOURCESPREFIX + "TileFluidGate");
GameRegistry
.registerTileEntity(TileReactorStabilizer.class, References.RESOURCESPREFIX + "TileReactorStabilizer");
GameRegistry.registerTileEntity(
TileReactorEnergyInjector.class,
References.RESOURCESPREFIX + "TileReactorEnergyInjector");
GameRegistry.registerTileEntity(TileReactorStabilizer.class, References.RESOURCESPREFIX + "TileReactorStabilizer");
GameRegistry.registerTileEntity(TileReactorEnergyInjector.class, References.RESOURCESPREFIX + "TileReactorEnergyInjector");
GameRegistry.registerTileEntity(TileChaosShard.class, References.RESOURCESPREFIX + "TileChaosShard");
GameRegistry
.registerTileEntity(TileUpgradeModifier.class, References.RESOURCESPREFIX + "TileEnhancementModifier");
if (DraconicEvolution.debug) {
GameRegistry.registerTileEntity(TileTestBlock.class, References.RESOURCESPREFIX + "TileTestBlock");
GameRegistry.registerTileEntity(
TileContainerTemplate.class,
References.RESOURCESPREFIX + "TileContainerTemplate");
}
}
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());
GameRegistry.registerTileEntity(TileUpgradeModifier.class, References.RESOURCESPREFIX + "TileEnhancementModifier");
GameRegistry.registerTileEntity(TileDislocatorInhibitor.class, References.RESOURCESPREFIX + "TileDislocatorInhibitor");
// spotless:on
}
public void registerGuiHandeler() {
@@ -252,97 +280,112 @@ public class CommonProxy {
// @Callback
public void registerEntities() {
EntityRegistry.registerModEntity(
EntityCustomDragon.class,
"EnderDragon",
0,
DraconicEvolution.instance,
256,
3,
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(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(
EntityChaosGuardian.class,
"ChaosGuardian",
6,
DraconicEvolution.instance,
256,
1,
true);
EntityRegistry.registerModEntity(
EntityDragonProjectile.class,
"DragonProjectile",
7,
DraconicEvolution.instance,
256,
1,
true);
EntityRegistry.registerModEntity(
EntityChaosCrystal.class,
"ChaosCrystal",
8,
DraconicEvolution.instance,
256,
5,
false);
EntityRegistry
.registerModEntity(EntityChaosBolt.class, "ChaosBolt", 9, DraconicEvolution.instance, 32, 5, true);
EntityRegistry.registerModEntity(
EntityChaosVortex.class,
"EntityChaosEnergyVortex",
10,
DraconicEvolution.instance,
512,
5,
true);
EntityRegistry.registerModEntity(
EntityCustomArrow.class,
"CustomArrow",
11,
DraconicEvolution.instance,
128,
1,
true);
// spotless:off
EntityRegistry.registerModEntity(EntityCustomDragon.class, "EnderDragon", 0, DraconicEvolution.instance, 256, 3, 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(EntityEnderArrow.class, "Ender Arrow", 3, DraconicEvolution.instance, 32, 1, 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(EntityDragonProjectile.class, "DragonProjectile", 7, DraconicEvolution.instance, 256, 1, true);
EntityRegistry.registerModEntity(EntityChaosCrystal.class, "ChaosCrystal", 8, DraconicEvolution.instance, 256, 5, false);
EntityRegistry.registerModEntity(EntityChaosBolt.class, "ChaosBolt", 9, DraconicEvolution.instance, 32, 5, true);
EntityRegistry.registerModEntity(EntityChaosVortex.class, "EntityChaosEnergyVortex", 10, DraconicEvolution.instance, 512, 5, true);
EntityRegistry.registerModEntity(EntityCustomArrow.class, "CustomArrow", 11, DraconicEvolution.instance, 128, 1, true);
// spotless:on
}
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) {
public boolean isDedicatedServer() {
return true;
}
public MinecraftServer getMCServer() {
return FMLCommonHandler.instance().getMinecraftServerInstance();
}
public World getClientWorld() {
return null;
}
public ParticleEnergyField energyField(World worldObj, double x, double y, double z, int type, boolean advanced,
ParticleEnergyField oldBeam, boolean render) {
public boolean isSpaceDown() {
return false;
}
public boolean isCtrlDown() {
return false;
}
public boolean isShiftDown() {
return false;
}
public EntityPlayer getClientPlayer() {
return null;
}
public ParticleReactorBeam reactorBeam(TileEntity tile, ParticleReactorBeam oldBeam, boolean render) {
return null;
public boolean isClient() {
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) {
return null;
public DragonChunkLoader getDragonChunkLoader() {
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,12 +4,48 @@ import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.blocks.*;
import com.brandon3055.draconicevolution.common.blocks.machine.*;
import com.brandon3055.draconicevolution.common.blocks.multiblock.*;
import com.brandon3055.draconicevolution.common.blocks.BlockDE;
import com.brandon3055.draconicevolution.common.blocks.CKeyStone;
import com.brandon3055.draconicevolution.common.blocks.ChaosCrystal;
import com.brandon3055.draconicevolution.common.blocks.ChaosShardAtmos;
import com.brandon3055.draconicevolution.common.blocks.CustomSpawner;
import com.brandon3055.draconicevolution.common.blocks.DraconicBlock;
import com.brandon3055.draconicevolution.common.blocks.DraconiumBlock;
import com.brandon3055.draconicevolution.common.blocks.DraconiumChest;
import com.brandon3055.draconicevolution.common.blocks.DraconiumOre;
import com.brandon3055.draconicevolution.common.blocks.InfusedObsidian;
import com.brandon3055.draconicevolution.common.blocks.ParticleGenerator;
import com.brandon3055.draconicevolution.common.blocks.PlacedItem;
import com.brandon3055.draconicevolution.common.blocks.Potentiometer;
import com.brandon3055.draconicevolution.common.blocks.RainSensor;
import com.brandon3055.draconicevolution.common.blocks.SafetyFlame;
import com.brandon3055.draconicevolution.common.blocks.TeleporterStand;
import com.brandon3055.draconicevolution.common.blocks.XRayBlock;
import com.brandon3055.draconicevolution.common.blocks.machine.DislocatorInhibitor;
import com.brandon3055.draconicevolution.common.blocks.machine.DissEnchanter;
import com.brandon3055.draconicevolution.common.blocks.machine.EnergyCrystal;
import com.brandon3055.draconicevolution.common.blocks.machine.EnergyInfuser;
import com.brandon3055.draconicevolution.common.blocks.machine.FlowGate;
import com.brandon3055.draconicevolution.common.blocks.machine.Generator;
import com.brandon3055.draconicevolution.common.blocks.machine.Grinder;
import com.brandon3055.draconicevolution.common.blocks.machine.LongRangeDislocator;
import com.brandon3055.draconicevolution.common.blocks.machine.PlayerDetector;
import com.brandon3055.draconicevolution.common.blocks.machine.PlayerDetectorAdvanced;
import com.brandon3055.draconicevolution.common.blocks.machine.SunDial;
import com.brandon3055.draconicevolution.common.blocks.machine.UpgradeModifier;
import com.brandon3055.draconicevolution.common.blocks.machine.WeatherController;
import com.brandon3055.draconicevolution.common.blocks.multiblock.DislocatorReceptacle;
import com.brandon3055.draconicevolution.common.blocks.multiblock.Earth;
import com.brandon3055.draconicevolution.common.blocks.multiblock.EnergyPylon;
import com.brandon3055.draconicevolution.common.blocks.multiblock.EnergyStorageCore;
import com.brandon3055.draconicevolution.common.blocks.multiblock.InvisibleMultiblock;
import com.brandon3055.draconicevolution.common.blocks.multiblock.Portal;
import com.brandon3055.draconicevolution.common.blocks.multiblock.ReactorCore;
import com.brandon3055.draconicevolution.common.blocks.multiblock.ReactorEnergyInjector;
import com.brandon3055.draconicevolution.common.blocks.multiblock.ReactorStabilizer;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.lib.References;
import cpw.mods.fml.common.registry.GameRegistry;
@GameRegistry.ObjectHolder(References.MODID)
@@ -19,7 +55,6 @@ public class ModBlocks {
public static BlockDE weatherController;
public static BlockDE sunDial;
public static BlockDE draconiumOre;
public static BlockDE testBlock;
public static BlockDE grinder;
public static BlockDE potentiometer;
public static BlockDE rainSensor;
@@ -52,6 +87,7 @@ public class ModBlocks {
public static BlockDE reactorEnergyInjector;
public static BlockDE chaosCrystal;
public static BlockDE upgradeModifier;
public static BlockDE dislocatorInhibitor;
public static Block safetyFlame;
public static Block chaosShardAtmos = new ChaosShardAtmos()
.setBlockName(References.RESOURCESPREFIX + "chaosShardAtmos")
@@ -74,7 +110,7 @@ public class ModBlocks {
customSpawner = new CustomSpawner();
generator = new Generator();
energyStorageCore = new EnergyStorageCore();
earthBlock = new Earth();
if (!ConfigHandler.disableEarthBlock) earthBlock = new Earth();
draconiumBlock = new DraconiumBlock();
invisibleMultiblock = new InvisibleMultiblock();
energyPylon = new EnergyPylon();
@@ -95,16 +131,12 @@ public class ModBlocks {
reactorEnergyInjector = new ReactorEnergyInjector();
chaosCrystal = new ChaosCrystal();
upgradeModifier = new UpgradeModifier();
dislocatorInhibitor = new DislocatorInhibitor();
longRangeDislocator = new LongRangeDislocator();
if (isEnabled(chaosShardAtmos)) GameRegistry.registerBlock(chaosShardAtmos, "chaosShardAtmos");
if (DraconicEvolution.debug) {
testBlock = new TestBlock();
containerTemplate = new BlockContainerTemplate();
}
resurrectionStone = new ItemStack(ModBlocks.draconiumBlock, 1, 1);
}
@@ -8,16 +8,52 @@ import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.EnumHelper;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.items.*;
import com.brandon3055.draconicevolution.common.items.AwakenedCore;
import com.brandon3055.draconicevolution.common.items.ChaosFragment;
import com.brandon3055.draconicevolution.common.items.ChaosShard;
import com.brandon3055.draconicevolution.common.items.ChaoticCore;
import com.brandon3055.draconicevolution.common.items.DezilsMarshmallow;
import com.brandon3055.draconicevolution.common.items.DraconicCore;
import com.brandon3055.draconicevolution.common.items.DraconicIngot;
import com.brandon3055.draconicevolution.common.items.DraconiumBlend;
import com.brandon3055.draconicevolution.common.items.DraconiumDust;
import com.brandon3055.draconicevolution.common.items.DraconiumEnergyCore;
import com.brandon3055.draconicevolution.common.items.DraconiumIngot;
import com.brandon3055.draconicevolution.common.items.DragonHeart;
import com.brandon3055.draconicevolution.common.items.InfoTablet;
import com.brandon3055.draconicevolution.common.items.ItemDE;
import com.brandon3055.draconicevolution.common.items.Key;
import com.brandon3055.draconicevolution.common.items.MobSoul;
import com.brandon3055.draconicevolution.common.items.Nugget;
import com.brandon3055.draconicevolution.common.items.ReactorStabiliserPart;
import com.brandon3055.draconicevolution.common.items.SunFocus;
import com.brandon3055.draconicevolution.common.items.Tclogo;
import com.brandon3055.draconicevolution.common.items.WyvernCore;
import com.brandon3055.draconicevolution.common.items.armor.DraconicArmor;
import com.brandon3055.draconicevolution.common.items.armor.WyvernArmor;
import com.brandon3055.draconicevolution.common.items.tools.*;
import com.brandon3055.draconicevolution.common.items.tools.AdminSpawnEgg;
import com.brandon3055.draconicevolution.common.items.tools.CreativeStructureSpawner;
import com.brandon3055.draconicevolution.common.items.tools.DraconicAxe;
import com.brandon3055.draconicevolution.common.items.tools.DraconicDistructionStaff;
import com.brandon3055.draconicevolution.common.items.tools.DraconicHoe;
import com.brandon3055.draconicevolution.common.items.tools.DraconicPickaxe;
import com.brandon3055.draconicevolution.common.items.tools.DraconicShovel;
import com.brandon3055.draconicevolution.common.items.tools.DraconiumFluxCapacitor;
import com.brandon3055.draconicevolution.common.items.tools.EnderArrow;
import com.brandon3055.draconicevolution.common.items.tools.Magnet;
import com.brandon3055.draconicevolution.common.items.tools.SafetyMatch;
import com.brandon3055.draconicevolution.common.items.tools.TeleporterMKI;
import com.brandon3055.draconicevolution.common.items.tools.TeleporterMKII;
import com.brandon3055.draconicevolution.common.items.tools.Wrench;
import com.brandon3055.draconicevolution.common.items.tools.WyvernPickaxe;
import com.brandon3055.draconicevolution.common.items.tools.WyvernShovel;
import com.brandon3055.draconicevolution.common.items.weapons.DraconicBow;
import com.brandon3055.draconicevolution.common.items.weapons.DraconicSword;
import com.brandon3055.draconicevolution.common.items.weapons.WyvernBow;
import com.brandon3055.draconicevolution.common.items.weapons.WyvernSword;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import cpw.mods.fml.common.registry.GameRegistry;
@GameRegistry.ObjectHolder(References.MODID)
@@ -9,9 +9,9 @@ import net.minecraft.util.StatCollector;
import net.minecraftforge.common.AchievementPage;
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.ModItems;
import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent;
@@ -21,38 +21,31 @@ import cpw.mods.fml.common.gameevent.PlayerEvent;
*/
public class Achievements {
private static AchievementPage achievementsPage;
private static HashMap<String, Achievement> achievementsList = new HashMap<String, Achievement>();
private static HashMap<String, AchievementCondition> achievementItems = new HashMap<String, AchievementCondition>();
private final HashMap<String, Achievement> achievementsList = new HashMap<>();
private final HashMap<String, AchievementCondition> achievementItems = new HashMap<>();
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;
achievementsList.put(name, achievement.registerStat());
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);
}
public static void addAchievement(String name, Achievement achievement) {
addAchievement(name, achievement, achievement.theItemStack, "null");
}
public static Achievement getAchievement(String name) {
private Achievement getAchievement(String name) {
return achievementsList.get(name);
}
public static void triggerAchievement(EntityPlayer player, String name) {
public void triggerAchievement(EntityPlayer player, String name) {
Achievement ach = getAchievement(name);
if (ach != null) {
player.triggerAchievement(ach);
}
}
public static void addModAchievements() {
public void addModAchievements() {
int x = 5;
addAchievement(
"draconicevolution.dust",
@@ -442,11 +435,11 @@ public class Achievements {
"craft");
}
public static void registerAchievementPane() {
public void registerAchievementPane() {
Achievement[] achievements = new Achievement[achievementsList.size()];
achievements = achievementsList.values().toArray(achievements);
achievementsPage = new AchievementPage(
AchievementPage achievementsPage = new AchievementPage(
StatCollector.translateToLocal("draconicevolution.achievementPage.name"),
achievements);
AchievementPage.registerAchievementPage(achievementsPage);
@@ -458,7 +451,7 @@ public class Achievements {
stack.stackSize = 1;
if (achievementItems.containsKey(stack.getUnlocalizedName())
&& 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;
if (achievementItems.containsKey(stack.getUnlocalizedName())
&& 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;
if (achievementItems.containsKey(stack.getUnlocalizedName())
&& 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 final String name;
public final String name;
public final String condition;
public AchievementCondition(String name, String condition) {
@@ -495,9 +488,5 @@ public class Achievements {
public boolean isCorrectCondition(String s) {
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.world.World;
import com.brandon3055.brandonscore.common.utills.InventoryUtils;
import com.brandon3055.draconicevolution.common.utils.InventoryUtils;
import com.google.common.collect.Lists;
/**
Loaded 100 of 553 files, more files were not shown because too many files have changed in this diff. Show more