Compare commits

..
62 Commits
Author SHA1 Message Date
Dream Master ea63f8f9a6 Merge branch 'master' into dev 2024-07-08 13:28:57 +07:00
Dream Master 1903589e29 update 2024-07-08 13:26:52 +07:00
Ethryan 46971bbe0e Rename Dark Iron Bars to Dark Steel (#167) 2024-07-05 13:20:31 +07:00
Martin Robertz 01819949e2 Merge remote-tracking branch 'TheUnderTaker11/git-please' into dev 2024-07-02 23:52:07 +02:00
Martin Robertz 4ccecf7bc0 update 2024-07-02 23:50:19 +02:00
Jason Mitchell 92fb58f0c6 Work around CME
* Not entirely sure why it's being concurrently modified.. so let's just make it safe for now
2024-06-30 14:15:24 -07:00
Martin Robertz 54c6db0afc update 2024-06-05 22:49:08 +02:00
OvermindDL1 84d9dcaf00 Fix another thread data race issue introduced in #164. 2024-06-04 21:53:01 -07:00
Jason Mitchell af923d1977 Probably less thread unsafe. (#164) 2024-06-04 18:53:14 -07:00
Martin Robertz efb918fc6d update 2024-06-02 23:05:27 +02:00
6447ffb4d5 Tweaks to EnderIO travel + teleportation (#158)
* Tweak teleport staff controls

* Fix comment

* Fix logic

* spotlessApply (#159)

Co-authored-by: GitHub GTNH Actions <>

* Add configs for teleport staff actions

* Various TP fixes

* Allow TP to unloaded anchor
* Improve TP through wall by checking every 0.5 instead of 2 distance
* Fix blink placing player one block too high
* Fix anchor being incorrectly selected sometimes by constraining to visual angle

* Add server-side handling for two-in-one teleport action

* Clear stored anchors on world load

* Check for obstructed anchor on long-distance teleport

* Check anchor accessibility and require `player != null`

* Handle server-side `travelToLocation`

* Limit backwards teleport check

* 2-in-1 TP: find destination client-side

* spotlessApply (#161)

Co-authored-by: GitHub GTNH Actions <>

* Don't conserve momentum

* Address review comments

* Refactor packet instantiation

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-06-02 17:20:23 +02:00
CreditScore 77f3e6974f Travel Staff Blink Keybind fixes.
Fixes 2 separate bugs with the SoT keybind.
1. Staff of Teleportation in GTNH pack specifically didn't work due to reporting as having 0 power through the RF API. Fixed this by having it always report that it's full of power since it has infinite.
2. BlackSteelSword and EndSteelSword (The Ender and MKII) both were quite funky with keybind, causing no teleports to happen when they really should have.
Fixed this through tweaks to how this is handled in a number of places to allow for proper handling while not changing the default held/shift held behavior.

Tested in SP, Anchor behavior while holding staffs and Swords with travel thing on them work as expected. Keybind now works and is able to use swords with travel thing on them.
One quirk is that if you are holding a sword with travel upgrade, but NOT shifting, the sword itself stops counting as a valid travel item. So if ONLY using sword no separate SoT the keybind will not work unless you hold shift. If you have another SoT in your inventory it will identify and use that and still blink you upon hitting keybind.
This quirk doesn't really matter in most cases, just something worth noting I guess.
2024-05-19 15:13:50 -05:00
Martin Robertz fb4c9bde59 update 2024-05-09 10:02:46 +02:00
Oleg Ivanov bd47a39c83 Add config entries for Farming Station particles (#162)
* Decrease number of Farming Station particles

* Set default values for range & number of particles to original
2024-05-08 20:48:35 +02:00
Martin Robertz 43d74c9a7a update 2024-04-24 21:47:04 +02:00
PT400C Jomcraft 6d3a631bb0 Improve FarmingStation portal texture rendering (#157) 2024-04-24 21:26:51 +02:00
Martin Robertz ccdef03296 update 2024-04-18 20:42:39 +02:00
Drathonix 56e163c234 Conduit Replacement Retains Connection Data (#160)
* Replacing Conduits Now maintains all Connection Settings

* Only write/read connection nbt.

* Use Correct Connectionset
2024-04-18 10:24:59 +02:00
Martin Robertz 8ecec5b096 update 2024-02-28 20:07:25 +01:00
boubou19GitHub GTNH Actionsgithub-actions[bot]
4e3fbc7667 Reduce allocation spam in capacitor banks (#155)
* reduce memory allocation

* update dep

* use public

* wrong dep

* spotlessApply (#156)

Co-authored-by: GitHub GTNH Actions <>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-02-25 23:26:17 +01:00
Jason Mitchell 845f277497 Actually optional (#154)
* Actually optional

* Tags
2024-02-22 21:21:37 +01:00
Jason Mitchell 94fb952cb0 Angelica compat (#153)
* Angelica Compat - Thread Saftey
* Depends on EnderCore updates for instanced CubeRenderer
* Switches relevant renderers to ThreadLocals, and adds a getRenderer() to Conduits
* Makes ConduitBundleRenderer threadsafe
* Misc reduction in allocations
2024-02-22 07:54:55 -08:00
Martin Robertz 29554c6a40 update 2024-02-22 13:27:10 +01:00
connor135246 fc5cba342c Fix Dark Steel Anvils in WAILA (#152)
Dark Steel Anvils wouldn't show the correct block in WAILA if the "Sneaky Facades" option was on.
2024-02-22 11:33:13 +01:00
Jason Mitchell 05d31b2e70 Some null checks to avoid outright crashing with Angelica, future thread saftey to come (#150) 2024-02-22 11:32:53 +01:00
Martin Robertz 5265340e3c update 2024-02-17 11:13:20 +01:00
Raven Szewczyk 37e239ae81 [ci skip] upgraded build system 2024-02-04 19:58:13 +00:00
Martin Robertz a725ebf120 update bs+deps 2024-01-31 22:47:55 +01:00
Pascal 6affe75674 fix protection mode of travel anchor (#149) 2024-01-31 07:53:01 +01:00
Martin Robertz 19f19d348b update bs+deps 2024-01-24 18:19:30 +01:00
Under 3154d03b4f Fix Anchor always rendering bug (#148)
* Fix Anchor always rendering bug

Also stop inventory scanning from happening every client tick, whoops.
Tested by placing a debug point on line 768 of TravelController (in getRequiredPower) and a debug point at line 656 of TravelController (in findTravelItemInInventoryOrBaubles). Debug points were used to verify that the code was ONLY hit when actual teleport happens, and not happening every tick like what was accidentally happening before.

* Run spotlessApply

Forgot that was a thing I do for GTNH stuff.
2024-01-24 10:58:27 -06:00
Martin Robertz 9e84167012 update bs+deps 2024-01-10 00:42:52 +01:00
bombcar d1a1bf1ed5 add required hard dependency on cofhlib (#146)
* add required hard dependency on cofhlib

* update bs, dependencies, and settings.gradle
2024-01-10 00:41:51 +01:00
Raven Szewczyk c1309fa37d [ci skip] upgraded build system 2024-01-08 21:25:19 +00:00
Martin Robertz 6a0785e1da exchange existing Item filter from newer Ender io version (#145) 2023-12-30 12:09:44 +01:00
Martin Robertz 6a4d655c71 update deps 2023-12-24 20:21:36 +01:00
Under 3639ade571 Staff Of Traveling Keybind Feature (#144)
* Staff Of Traveling Keybind Update

Two main things
1. Added a keybind for Staff of Traveling blink ability
2. Due to the new keybind, also added Baubles support for Staff of Traveling.

By extension, both features 1 and 2 also apply to the Staff of Teleportation.

* Update en_US.lang

* Add config to disable Travel Staff Keybind

Change as per request by @Caedis .
New config option is synced in the PacketConfigSync class.
A helpful info message is displayed when players attempt to use the keybind but it is disabled so it's immediately apparent why it's not working.

* Typo/formatting

Fix type, remove unnecessary null check.

* Annotations and UNIVERSAL bauble type

Added annotations missing from ItemMagnet and ItemTravelStaff for Baubles.
Added option 'UNIVERSAL' to description of magnet and travel staff Bauble type configs.
Changed default of staff to be 'UNIVERSAL', because bauble slots are limited enough as-is.
2023-12-24 20:18:57 +01:00
Martin Robertz 95daa9b035 update deps 2023-12-20 20:21:36 +01:00
Under f249fd2973 Add Config to allow servers to re-enable support for client-side 'hacks' like Staff Of Traveling Keybind mod. (#142)
* Update Config.java

Adding config to allow not validating travel staff packets.

* Update TravelController.java

Disable validation if server config deems it so.

* spotlessApply fix

* Wrong ordering and spotlessApply
2023-12-20 20:06:38 +01:00
9f3f8243f9 Limited Item Filter (#143)
* Limited Item Filter

* simplify inverted limit

Co-authored-by: Alexander Anishin <[email protected]>

* Update src/main/java/crazypants/enderio/conduit/item/filter/ItemFilterLimited.java

Co-authored-by: Alexander Anishin <[email protected]>

* Update src/main/java/crazypants/enderio/conduit/item/filter/ItemFilterLimited.java

Co-authored-by: Alexander Anishin <[email protected]>

* Update ItemFilterLimited.java

---------

Co-authored-by: Alexander Anishin <[email protected]>
Co-authored-by: Martin Robertz <[email protected]>
2023-12-20 19:50:55 +01:00
Martin Robertz 23a5484ee8 update deps 2023-12-13 15:38:04 +01:00
Bears Dot Zone 4b5837cac2 Fix an edge case pertaining to freshly crafted tanks (#141)
* Update dependencies

* Replace faulty dummy object logic with object creation

* Remove logic that is exiting a function erroneously
2023-12-13 15:32:56 +01:00
Spacebuilder2020andMartin Robertz 1251427388 Fix NBT Match where tag is empty but exists (#138)
* Fix NBT Match where tag is empty but exists

* Apply Splotless

* update deps

* update gradle + bs

---------

Co-authored-by: Martin Robertz <[email protected]>
2023-12-13 09:40:48 +01:00
ghostflyby 3e7d69f460 Open conduit connection GUI with more wrenches (#139) 2023-11-25 16:02:12 +08:00
Martin Robertz 88725a144d update deps 2023-11-16 13:59:12 +01:00
Pelotrio 123f22f20e Add unload event handling to ClientNetworkManager (#137)
Added a new method `onWorldUnload` to `ClientNetworkManager` to destroy and clear any network instances when the world event `Unload` is triggered. The addition of this event handler was necessary to prevent the possibility of any network instances persisting on the client side beyond the World lifetime, thus potentially causing memory leaks.
2023-11-16 15:42:32 +03:00
Martin Robertz 0b0f7a4f1a update deps 2023-11-11 12:13:03 +01:00
Martin Robertz b00c5996f7 update bs+deps 2023-11-11 12:12:45 +01:00
Pelotrio 83f52d15c7 Removed the redundant static IWailaDataAccessor _accessor to not leak the world object 2023-11-10 18:34:39 -08:00
Pelotrio 287c4498d2 Use null for the Item to render to not leak the world 2023-11-10 18:34:39 -08:00
Martin Robertz 2470e81f0e update bs+de+wci 2023-10-15 17:43:47 +02:00
Alexdoru 1af6fcae0b set fluid conduit default to output only 2023-10-15 13:34:45 +02:00
Alexdoru f44111da96 revert changes to conduit default connection modes 2023-10-15 13:34:45 +02:00
Dream-MasterXXL 4ae9ff2d77 update bs+deps 2023-10-05 00:42:17 +02:00
Martin Robertz 71f79536a7 update deps 2023-09-28 20:54:35 +02:00
Alexdoru 0920bf28d6 Change default connection mode of fluid conduits (#134)
* update bs

* change default connection mode of fluid conduits

* fix imports
2023-09-28 20:45:53 +02:00
Martin Robertz 8e4107d11e update bs+deps 2023-09-22 19:09:29 +02:00
Glease 349bcc0926 allow small overshoot of power use for traveling (#133) 2023-09-22 20:04:04 +03:00
Glease 070660efe4 fix travel upgrade items using wrong way to determine power stored (#131)
Signed-off-by: Glease <[email protected]>
2023-07-24 01:45:41 +08:00
Martin RobertzandRaven Szewczyk 0dd56b62ab update bs+sa+deps (#130)
* update bs+sa+deps

* Switch immibis microblocks to modrinth maven

* Remove modrinth from repositories as it's now in the buildscript

---------

Co-authored-by: Raven Szewczyk <[email protected]>
2023-07-23 11:36:28 +02:00
Glease 54d61f5251 valiate tp packets (#128)
* validate tp packets

Signed-off-by: Glease <[email protected]>

* spotless

Signed-off-by: Glease <[email protected]>

---------

Signed-off-by: Glease <[email protected]>
2023-07-23 08:04:14 +02:00
初夏同学 ebcbef851a Fix a bug in NBT usage (#127) 2023-07-05 17:57:26 +02:00
135 changed files with 2787 additions and 2610 deletions

No files matched your search

+2 -1509
View File
File diff suppressed because it is too large. Load diff
+18 -16
View File
@@ -1,26 +1,28 @@
// Add your dependencies here
dependencies {
api('com.github.GTNewHorizons:EnderCore:0.2.14:dev')
implementation('com.github.GTNewHorizons:ForestryMC:4.6.7:dev')
implementation('com.github.GTNewHorizons:NotEnoughItems:2.3.53-GTNH:dev')
implementation("com.github.GTNewHorizons:GTNHLib:0.0.13:dev")
api('com.github.GTNewHorizons:BuildCraft:7.1.33:dev')
api('com.github.GTNewHorizons:EnderCore:0.4.6:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:ForestryMC:4.9.7:dev')
compileOnly('com.github.GTNewHorizons:NotEnoughItems:2.6.14-GTNH:dev')
compileOnly("com.github.GTNewHorizons:GTNHLib:0.3.2:dev")
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.39:dev')
api('curse.maven:cofh-lib-220333:2388748') // https://www.curseforge.com/minecraft/mc-mods/cofh-lib/files/2388748
shadowImplementation('cglib:cglib-nodep:3.3.0')
compileOnly('com.github.GTNewHorizons:waila:1.6.0:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-215-GTNH:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:Baubles:1.0.1.16:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.43.46:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:Railcraft:9.14.1:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:StorageDrawers:1.2.0-GTNH:api') {transitive = false}
implementation('com.github.GTNewHorizons:Chisel:2.11.0-GTNH:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:OpenComputers:1.9.5-GTNH:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:waila:1.8.1:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-405-GTNH:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:Baubles:1.0.4:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.48.68:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:Railcraft:9.15.8:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:StorageDrawers:1.13.5-GTNH:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:Chisel:2.15.1-GTNH:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:OpenComputers:1.10.11-GTNH:api') {transitive = false}
compileOnly('curse.maven:minefactory-reloaded-66672:2366150') // https://www.curseforge.com/minecraft/mc-mods/minefactory-reloaded/files/2366150
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
compileOnly('curse.maven:ee3-65509:2305023') // https://www.curseforge.com/minecraft/mc-mods/ee3/files/2305023
compileOnly(deobf('https://media.forgecdn.net/files/2269/339/ComputerCraft1.75.jar')) // https://www.curseforge.com/minecraft/mc-mods/computercraft/files/2269339
compileOnly(deobf('https://media.forgecdn.net/files/2426/270/Mekanism-1.7.10-9.1.0.281.jar')) // https://aidancbrady.com/mekanism/download/
compileOnly(deobf('https://immibis.com/mcmoddl/files/immibis-microblocks-59.1.2.jar'))
compileOnly(rfg.deobf('curse.maven:computercraft-67504:2269339')) // https://www.curseforge.com/minecraft/mc-mods/computercraft/files/2269339
compileOnly(rfg.deobf('curse.maven:mekanism-268560:2475797')) // https://www.curseforge.com/minecraft/mc-mods/mekanism/files/2475797
compileOnly(rfg.deobf('maven.modrinth:immibis-microblocks:59.1.2')) // https://modrinth.com/mod/immibis-microblocks/version/59.1.2
compileOnlyApi('com.github.GTNewHorizons:Angelica:1.0.0-alpha52:api') {transitive = false}
}
+149 -27
View File
@@ -1,63 +1,104 @@
# 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 = Ender IO
# 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 = EnderIO
# Root package of the mod, used to find various classes in other properties,
# mcmod.info substitution, enabling assertions in run tasks, etc.
modGroup = crazypants.enderio
# 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.
# Due to a history of using JitPack, the default is com.github.GTNewHorizons for all mods.
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
# Specify a MCP channel and mappings version for dependency deobfuscation and the deobfParams task.
# 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
# Define other MCP mappings for dependency deobfuscation
remoteMappings = https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
# Defines other MCP mappings for dependency deobfuscation.
remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
# Select a username for testing your mod with breakpoints. You may leave this empty for a random user name 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
# 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:
# public static final String VERSION = "GRADLETOKEN_VERSION";
# The string's content will be replaced with your mods 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 = EnderIO.java
# Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8.
# See https://github.com/bsideup/jabel for details on how this works.
enableModernJavaSyntax = false
# 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 = crazypants.enderio.Tags
# 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 =
gradleTokenVersion = GRADLETOKEN_VERSION
# [DEPRECATED] Mod Group replacement token.
gradleTokenGroupName =
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise you can
# [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 =
# 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
# 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!
mixinsPackage =
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
# This parameter is for legacy compatability only
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
# This parameter is for legacy compatibility only
# Example value: (coreModClass = asm.FMLPlugin) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.asm.FMLPlugin
coreModClass =
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
containsMixinsAndOrCoreModOnly = false
@@ -65,6 +106,87 @@ containsMixinsAndOrCoreModOnly = false
# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins.
forceEnableMixins = false
# If enabled, you may use 'shadowImplementation' for dependencies. They will be integrated in your jar. It is your
# responsibility check the licence and request permission for distribution, if required.
# 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 = true
# 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 the GTNH maven, CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
includeWellKnownRepositories = true
# 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: GTNH Mixins is automatically set as a required dependency if usesMixins = true
modrinthRelations =
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
#
# The project's numeric ID on CurseForge. You can find this in the About Project box.
# Leave this empty if you don't want to publish on CurseForge.
curseForgeProjectId =
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
# Syntax: type1:name1;type2:name2;...
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
# and the name is the CurseForge project slug of the other mod.
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
# Note: 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 =
# 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
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-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Vendored
+18 -13
View File
@@ -55,7 +55,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/HEAD/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 +83,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 "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@@ -133,10 +131,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 +145,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 +153,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
@@ -197,11 +198,15 @@ 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, 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" \
Vendored
+10 -10
View File
@@ -43,11 +43,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,11 +57,11 @@ 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
+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 '1.0.23'
}
blowdryerSetup {
repoSubfolder 'gtnhShared'
github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.2.0')
//devLocal '.' // Use this when testing config updates locally
}
@@ -1,8 +1,5 @@
package crazypants.enderio;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
@@ -33,36 +30,27 @@ import crazypants.enderio.conduit.IConduit;
import crazypants.enderio.conduit.TileConduitBundle;
import crazypants.enderio.conduit.facade.FacadeRenderer;
import crazypants.enderio.conduit.gas.GasConduit;
import crazypants.enderio.conduit.gas.GasConduitRenderer;
import crazypants.enderio.conduit.gas.GasUtil;
import crazypants.enderio.conduit.item.ItemConduit;
import crazypants.enderio.conduit.liquid.AbstractEnderLiquidConduit;
import crazypants.enderio.conduit.liquid.AdvancedLiquidConduit;
import crazypants.enderio.conduit.liquid.AdvancedLiquidConduitRenderer;
import crazypants.enderio.conduit.liquid.CrystallineEnderLiquidConduit;
import crazypants.enderio.conduit.liquid.CrystallinePinkSlimeEnderLiquidConduit;
import crazypants.enderio.conduit.liquid.EnderLiquidConduit;
import crazypants.enderio.conduit.liquid.EnderLiquidConduitRenderer;
import crazypants.enderio.conduit.liquid.LiquidConduit;
import crazypants.enderio.conduit.liquid.LiquidConduitRenderer;
import crazypants.enderio.conduit.liquid.MelodicEnderLiquidConduit;
import crazypants.enderio.conduit.liquid.StellarEnderLiquidConduit;
import crazypants.enderio.conduit.me.MEConduit;
import crazypants.enderio.conduit.me.MEUtil;
import crazypants.enderio.conduit.oc.OCConduit;
import crazypants.enderio.conduit.oc.OCConduitRenderer;
import crazypants.enderio.conduit.oc.OCUtil;
import crazypants.enderio.conduit.power.PowerConduit;
import crazypants.enderio.conduit.power.PowerConduitRenderer;
import crazypants.enderio.conduit.power.endergy.PowerConduitEndergy;
import crazypants.enderio.conduit.redstone.InsulatedRedstoneConduit;
import crazypants.enderio.conduit.redstone.InsulatedRedstoneConduitRenderer;
import crazypants.enderio.conduit.redstone.RedstoneConduit;
import crazypants.enderio.conduit.redstone.RedstoneSwitch;
import crazypants.enderio.conduit.redstone.RedstoneSwitchRenderer;
import crazypants.enderio.conduit.render.ConduitBundleRenderer;
import crazypants.enderio.conduit.render.ConduitRenderer;
import crazypants.enderio.conduit.render.DefaultConduitRenderer;
import crazypants.enderio.conduit.render.ItemConduitRenderer;
import crazypants.enderio.config.Config;
import crazypants.enderio.enderface.EnderIoRenderer;
@@ -166,10 +154,6 @@ public class ClientProxy extends CommonProxy {
};
// @formatter:on
private final List<ConduitRenderer> conduitRenderers = new ArrayList<ConduitRenderer>();
private final DefaultConduitRenderer dcr = new DefaultConduitRenderer();
private ConduitBundleRenderer cbr;
private boolean checkedNei = false;
@@ -403,20 +387,6 @@ public class ClientProxy extends CommonProxy {
RenderingRegistry.registerBlockHandler(esk);
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockEndermanSkull), esk);
conduitRenderers.add(RedstoneSwitchRenderer.getInstance());
conduitRenderers.add(new AdvancedLiquidConduitRenderer());
conduitRenderers.add(LiquidConduitRenderer.create());
conduitRenderers.add(new PowerConduitRenderer());
conduitRenderers.add(new InsulatedRedstoneConduitRenderer());
conduitRenderers.add(new EnderLiquidConduitRenderer());
conduitRenderers.add(new crazypants.enderio.conduit.item.ItemConduitRenderer());
if (GasUtil.isGasConduitEnabled()) {
conduitRenderers.add(new GasConduitRenderer());
}
if (OCUtil.isOCEnabled()) {
conduitRenderers.add(new OCConduitRenderer());
}
EnderIoRenderer eior = new EnderIoRenderer();
ClientRegistry.bindTileEntitySpecialRenderer(TileEnderIO.class, eior);
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockEnderIo), eior);
@@ -480,12 +450,7 @@ public class ClientProxy extends CommonProxy {
@Override
public ConduitRenderer getRendererForConduit(IConduit conduit) {
for (ConduitRenderer renderer : conduitRenderers) {
if (renderer.isRendererForConduit(conduit)) {
return renderer;
}
}
return dcr;
return conduit.getRenderer();
}
@Override
@@ -34,6 +34,7 @@ public class CommonProxy {
return null;
}
@Deprecated
public ConduitRenderer getRendererForConduit(IConduit conduit) {
return null;
}
@@ -62,6 +62,7 @@ import crazypants.enderio.conduit.item.ItemItemConduit;
import crazypants.enderio.conduit.item.filter.ItemBasicItemFilter;
import crazypants.enderio.conduit.item.filter.ItemBigItemFilter;
import crazypants.enderio.conduit.item.filter.ItemExistingItemFilter;
import crazypants.enderio.conduit.item.filter.ItemLimitedItemFilter;
import crazypants.enderio.conduit.item.filter.ItemModItemFilter;
import crazypants.enderio.conduit.item.filter.ItemPowerItemFilter;
import crazypants.enderio.conduit.liquid.ItemLiquidConduit;
@@ -185,14 +186,14 @@ import crazypants.util.EE3Util;
modid = MODID,
name = MOD_NAME,
version = VERSION,
dependencies = "after:endercore;after:MineFactoryReloaded;after:Forestry;after:Waila@[1.5.8,);after:Thaumcraft;after:appliedenergistics2@[rv2-beta-8,);after:chisel",
dependencies = "required-after:CoFHLib@(1.0.3B3,);after:endercore;after:MineFactoryReloaded;after:Forestry;after:Waila@[1.5.8,);after:Thaumcraft;after:appliedenergistics2@[rv2-beta-8,);after:chisel",
guiFactory = "crazypants.enderio.config.ConfigFactoryEIO")
public class EnderIO {
public static final String MODID = "EnderIO";
public static final String DOMAIN = MODID.toLowerCase(Locale.US);
public static final String MOD_NAME = "Ender IO";
public static final String VERSION = "GRADLETOKEN_VERSION";
public static final String VERSION = Tags.VERSION;
@Instance(MODID)
public static EnderIO instance;
@@ -264,6 +265,7 @@ public class EnderIO {
public static ItemBasicItemFilter itemBasicFilterUpgrade;
public static ItemBigItemFilter itemBigFilterUpgrade;
public static ItemExistingItemFilter itemExistingItemFilter;
public static ItemLimitedItemFilter itemLimitedItemFilter;
public static ItemModItemFilter itemModItemFilter;
public static ItemPowerItemFilter itemPowerItemFilter;
public static ItemExtractSpeedUpgrade itemExtractSpeedUpgrade;
@@ -469,6 +471,7 @@ public class EnderIO {
itemBasicFilterUpgrade = ItemBasicItemFilter.create();
itemBigFilterUpgrade = ItemBigItemFilter.create();
itemExistingItemFilter = ItemExistingItemFilter.create();
itemLimitedItemFilter = ItemLimitedItemFilter.create();
itemModItemFilter = ItemModItemFilter.create();
itemPowerItemFilter = ItemPowerItemFilter.create();
itemExtractSpeedUpgrade = ItemExtractSpeedUpgrade.create();
@@ -788,7 +791,7 @@ public class EnderIO {
@EventHandler
public void loadComplete(FMLLoadCompleteEvent event) {
processImc(FMLInterModComms.fetchRuntimeMessages(this)); // Some mods send IMCs during PostInit, so we catch
// them here.
// them here.
}
private static String getXPJuiceName() {
@@ -18,6 +18,7 @@ public enum ModObject {
itemBasicFilterUpgrade,
itemBigFilterUpgrade,
itemExistingItemFilter,
itemLimitedItemFilter,
itemModItemFilter,
itemPowerItemFilter,
itemExtractSpeedUpgrade,
@@ -4,10 +4,20 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import cofh.api.energy.IEnergyContainerItem;
import crazypants.enderio.config.Config;
public interface IItemOfTravel extends IEnergyContainerItem {
boolean isActive(EntityPlayer ep, ItemStack equipped);
void extractInternal(ItemStack equipped, int power);
/**
* @param equipped player who is currently holding this item. caller will ensure the item held has your Item as item
* type
* @return -1 if method not supported, or max(can extract, power), e.g. 0 if item is empty.
*/
default int canExtractInternal(ItemStack equipped, int power) {
return Config.strictTPItemChecking ? 0 : -1;
}
}
@@ -94,11 +94,10 @@ public interface ITelePad extends ITravelAccessable {
/**
* Util method to set all coords using a {@link BlockCoord} object.
*
* @param coords The coords to set this telepad to.
* @see #setX(int)
* @see #setY(int)
* @see #setZ(int)
*
* @param coords The coords to set this telepad to.
*/
void setCoords(BlockCoord coords);
@@ -14,9 +14,8 @@ import cpw.mods.fml.common.eventhandler.Cancelable;
* <li>Staff of travelling</li>
* <li>Telepad</li>
* </ul>
*
* <p>
* As well as any externally added teleports, assuming they fire this event manually.
*
*/
@Cancelable
public class TeleportEntityEvent extends EntityEvent {
@@ -81,7 +81,7 @@ public enum TravelSource {
return 0;
}
TravelSource source = TravelController.instance.getTravelItemTravelSource(player);
TravelSource source = TravelController.instance.getTravelItemTravelSource(player, false);
if (source == null) {
return TravelSource.BLOCK.getMaxDistanceTravelledSq();
} else {
@@ -88,7 +88,7 @@ public abstract class AbstractConduit implements IConduit {
* If this is true, it will trigger a reconnection on the next Tick.
* <p>
* Use the method needUpdateConnections() instead of setting this to true.
*
*
* @see needUpdateConnections()
*/
private boolean needUpdateConnections = false;
@@ -67,7 +67,6 @@ public abstract class AbstractItemConduit extends Item implements IConduitItem {
if (MicroblocksUtil.supportMicroblocks() && tryAddToMicroblocks(stack, player, world, x, y, z, side)) {
return true;
}
BlockCoord placeAt = Util.canPlaceItem(stack, EnderIO.blockConduitBundle, player, world, x, y, z, side);
if (placeAt != null) {
if (!world.isRemote) {
@@ -84,9 +83,7 @@ public abstract class AbstractItemConduit extends Item implements IConduitItem {
stack.stackSize--;
}
return true;
} else {
ForgeDirection dir = ForgeDirection.values()[side];
int placeX = x + dir.offsetX;
int placeY = y + dir.offsetY;
@@ -116,7 +113,6 @@ public abstract class AbstractItemConduit extends Item implements IConduitItem {
}
}
}
return false;
}
@@ -162,8 +158,7 @@ public abstract class AbstractItemConduit extends Item implements IConduitItem {
System.out.println("AbstractItemConduit.onItemUse: Conduit null.");
return false;
}
bundle.removeConduit(existingConduit);
bundle.addConduit(newConduit);
bundle.replaceConduit(existingConduit, newConduit);
if (!player.capabilities.isCreativeMode) {
stack.stackSize--;
for (ItemStack drop : existingConduit.getDrops()) {
@@ -47,7 +47,13 @@ import crazypants.enderio.api.tool.ITool;
import crazypants.enderio.conduit.facade.ItemConduitFacade.FacadeType;
import crazypants.enderio.conduit.geom.CollidableComponent;
import crazypants.enderio.conduit.geom.ConduitConnectorType;
import crazypants.enderio.conduit.gui.*;
import crazypants.enderio.conduit.gui.ExternalConnectionContainer;
import crazypants.enderio.conduit.gui.GuiExternalConnection;
import crazypants.enderio.conduit.gui.GuiExternalConnectionSelector;
import crazypants.enderio.conduit.gui.PacketFluidChannel;
import crazypants.enderio.conduit.gui.PacketFluidFilter;
import crazypants.enderio.conduit.gui.PacketOpenConduitUI;
import crazypants.enderio.conduit.gui.PacketSlotVisibility;
import crazypants.enderio.conduit.gui.item.PacketExistingItemFilterSnapshot;
import crazypants.enderio.conduit.gui.item.PacketModItemFilter;
import crazypants.enderio.conduit.liquid.PacketFluidLevel;
@@ -635,8 +641,8 @@ public class BlockConduitBundle extends BlockEio
@Override
public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player) {
ItemStack equipped = player.getCurrentEquippedItem();
if (!player.isSneaking() || equipped == null || equipped.getItem() != EnderIO.itemYetaWench) {
ITool tool = ToolUtil.getEquippedTool(player);
if (!player.isSneaking() || tool == null || !tool.canUse(player.getCurrentEquippedItem(), player, x, y, z)) {
return;
}
ConduitUtil.openConduitGui(world, x, y, z, player);
@@ -1,6 +1,15 @@
package crazypants.enderio.conduit;
import static crazypants.enderio.gui.IconEIO.*;
import static crazypants.enderio.gui.IconEIO.CROSS;
import static crazypants.enderio.gui.IconEIO.TICK;
import static crazypants.enderio.gui.IconEIO.WRENCH_OVERLAY_FLUID;
import static crazypants.enderio.gui.IconEIO.WRENCH_OVERLAY_FLUID_OFF;
import static crazypants.enderio.gui.IconEIO.WRENCH_OVERLAY_ITEM;
import static crazypants.enderio.gui.IconEIO.WRENCH_OVERLAY_ITEM_OFF;
import static crazypants.enderio.gui.IconEIO.WRENCH_OVERLAY_POWER;
import static crazypants.enderio.gui.IconEIO.WRENCH_OVERLAY_POWER_OFF;
import static crazypants.enderio.gui.IconEIO.WRENCH_OVERLAY_REDSTONE;
import static crazypants.enderio.gui.IconEIO.WRENCH_OVERLAY_REDSTONE_OFF;
import java.util.List;
@@ -55,11 +64,10 @@ public class ConduitDisplayMode {
* Use this constructor if you have custom display logic, it will use {@code IConduit.class} as the conduitType, and
* the passed name as the override name.
*
* @see #ConduitDisplayMode(Class, IWidgetIcon, IWidgetIcon)
*
* @param name The override name.
* @param widgetSelected The widget to render when this type is selected.
* @param widgetUnselected The widget to render when this type is unselected.
* @see #ConduitDisplayMode(Class, IWidgetIcon, IWidgetIcon)
*/
public ConduitDisplayMode(String name, IWidgetIcon widgetSelected, IWidgetIcon widgetUnselected) {
this(IConduit.class, widgetSelected, widgetUnselected);
@@ -1,9 +1,20 @@
package crazypants.enderio.conduit;
import static crazypants.enderio.ModObject.blockPainter;
import static crazypants.enderio.material.Alloy.*;
import static crazypants.enderio.material.Material.*;
import static crazypants.enderio.material.endergy.AlloyEndergy.*;
import static crazypants.enderio.material.Alloy.CONDUCTIVE_IRON;
import static crazypants.enderio.material.Alloy.ELECTRICAL_STEEL;
import static crazypants.enderio.material.Alloy.END_STEEL;
import static crazypants.enderio.material.Alloy.ENERGETIC_ALLOY;
import static crazypants.enderio.material.Alloy.PHASED_GOLD;
import static crazypants.enderio.material.Alloy.REDSTONE_ALLOY;
import static crazypants.enderio.material.Material.CONDUIT_BINDER;
import static crazypants.enderio.material.Material.PHASED_IRON_NUGGET;
import static crazypants.enderio.material.endergy.AlloyEndergy.CRUDE_STEEL;
import static crazypants.enderio.material.endergy.AlloyEndergy.CRYSTALLINE_ALLOY;
import static crazypants.enderio.material.endergy.AlloyEndergy.CRYSTALLINE_PINK_SLIME;
import static crazypants.enderio.material.endergy.AlloyEndergy.ENERGETIC_SILVER;
import static crazypants.enderio.material.endergy.AlloyEndergy.MELODIC_ALLOY;
import static crazypants.enderio.material.endergy.AlloyEndergy.STELLAR_ALLOY;
import static crazypants.util.RecipeUtil.addShaped;
import net.minecraft.init.Blocks;
@@ -590,6 +601,9 @@ public class ConduitRecipes {
'f',
advFilter);
ItemStack limitedFilter = new ItemStack(EnderIO.itemLimitedItemFilter, 1, 0);
addShaped(limitedFilter, " ", "cfc", " ", 'c', new ItemStack(Items.comparator, 1, 0), 'f', advFilter);
ItemStack powerFilt = new ItemStack(EnderIO.itemPowerItemFilter);
addShaped(powerFilt, " p ", "pcp", " p ", 'p', Items.paper, 'c', EnderIO.itemConduitProbe);
@@ -92,7 +92,7 @@ public class ConduitUtil {
}
}
if (con.getNetwork() != null) { // this should have been destroyed when destroying the neighbours network but
// lets just make
// lets just make
// sure
con.getNetwork().destroyNetwork();
}
@@ -158,7 +158,7 @@ public class ConduitUtil {
}
public static boolean isFacadeHidden(IConduitBundle bundle, EntityPlayer player) {
return bundle.getFacadeId() != null && shouldHeldItemHideFacades(player);
return bundle != null && bundle.getFacadeId() != null && shouldHeldItemHideFacades(player);
}
public static ConduitDisplayMode getDisplayMode(EntityPlayer player) {
@@ -17,6 +17,7 @@ import com.enderio.core.common.util.BlockCoord;
import crazypants.enderio.conduit.geom.CollidableCache.CacheKey;
import crazypants.enderio.conduit.geom.CollidableComponent;
import crazypants.enderio.conduit.render.ConduitRenderer;
public interface IConduit {
@@ -141,4 +142,6 @@ public interface IConduit {
* Should the texture of the conduit connectors be mirrored around the conduit node?
*/
boolean shouldMirrorTexture();
ConduitRenderer getRenderer();
}
@@ -49,6 +49,8 @@ public interface IConduitBundle extends IInternalPowerHandler, IFluidHandler, II
void addConduit(IConduit conduit);
void replaceConduit(IConduit original, IConduit replacement);
void removeConduit(IConduit conduit);
Collection<IConduit> getConduits();
@@ -2,6 +2,7 @@ package crazypants.enderio.conduit;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.List;
@@ -50,7 +51,6 @@ import crazypants.enderio.conduit.power.IPowerConduit;
import crazypants.enderio.conduit.redstone.IRedstoneConduit;
import crazypants.enderio.conduit.redstone.InsulatedRedstoneConduit;
import crazypants.enderio.config.Config;
import li.cil.oc.api.network.*;
import li.cil.oc.api.network.Message;
import li.cil.oc.api.network.Node;
import mekanism.api.gas.Gas;
@@ -67,7 +67,7 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
public static final short NBT_VERSION = 1;
private final List<IConduit> conduits = new ArrayList<IConduit>();
private final List<IConduit> conduits = Collections.synchronizedList(new ArrayList<>());
private Block facadeId = null;
private int facadeMeta = 0;
@@ -75,9 +75,9 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
private boolean facadeChanged;
private final List<CollidableComponent> cachedCollidables = new ArrayList<CollidableComponent>();
private final List<CollidableComponent> cachedCollidables = new ArrayList<>();
private final List<CollidableComponent> cachedConnectors = new ArrayList<CollidableComponent>();
private final List<CollidableComponent> cachedConnectors = new ArrayList<>();
private boolean conduitsDirty = true;
private boolean collidablesDirty = true;
@@ -405,6 +405,29 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
dirty();
}
@Override
public void replaceConduit(IConduit original, IConduit replacement) {
if (worldObj.isRemote) {
return;
}
// If you're wondering why I am not using conduit.writeToNBT, it is because there is some data that should not
// persist, some of which causes crashes with energy conduits.
NBTTagCompound[] originalData = new NBTTagCompound[ForgeDirection.values().length];
for (ForgeDirection conduitConnection : original.getExternalConnections()) {
NBTTagCompound tag = new NBTTagCompound();
original.writeConnectionSettingsToNBT(conduitConnection, tag);
originalData[conduitConnection.ordinal()] = tag;
}
removeConduit(original);
addConduit(replacement);
for (int i = 0; i < originalData.length; i++) {
NBTTagCompound nbt = originalData[i];
if (nbt != null) {
replacement.readConduitSettingsFromNBT(ForgeDirection.values()[i], nbt);
}
}
}
@Override
public void removeConduit(IConduit conduit) {
if (conduit != null) {
@@ -429,7 +452,7 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
if (worldObj.isRemote) {
return;
}
List<IConduit> copy = new ArrayList<IConduit>(conduits);
List<IConduit> copy = new ArrayList<>(conduits);
for (IConduit con : copy) {
removeConduit(con, false);
}
@@ -514,7 +537,7 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
@Override
public List<CollidableComponent> getConnectors() {
List<CollidableComponent> result = new ArrayList<CollidableComponent>();
List<CollidableComponent> result = new ArrayList<>();
addConnectors(result);
return result;
}
@@ -16,7 +16,7 @@ import crazypants.enderio.ModObject;
import crazypants.enderio.conduit.IConduitBundle;
import crazypants.enderio.machine.painter.IPaintedBlock;
public class BlockConduitFacade extends BlockEio implements IPaintedBlock {
public class BlockConduitFacade extends BlockEio implements IPaintedBlock, Cloneable {
public static BlockConduitFacade create() {
BlockConduitFacade result = new BlockConduitFacade();
@@ -24,6 +24,10 @@ public class BlockConduitFacade extends BlockEio implements IPaintedBlock {
return result;
}
public BlockConduitFacade clone() throws CloneNotSupportedException {
return (BlockConduitFacade) super.clone();
}
private Block blockOverride;
private BlockConduitFacade() {
@@ -20,6 +20,7 @@ import crazypants.enderio.conduit.AbstractConduitNetwork;
import crazypants.enderio.conduit.ConnectionMode;
import crazypants.enderio.conduit.IConduit;
import crazypants.enderio.conduit.geom.CollidableComponent;
import crazypants.enderio.conduit.render.ConduitRenderer;
import crazypants.enderio.config.Config;
import mekanism.api.gas.Gas;
import mekanism.api.gas.GasStack;
@@ -34,7 +35,12 @@ public class GasConduit extends AbstractGasTankConduit {
public static final String ICON_INSERT_KEY = "enderio:gasConduitOutput";
public static final String ICON_EMPTY_EDGE = "enderio:gasConduitEdge";
static final Map<String, IIcon> ICONS = new HashMap<String, IIcon>();
static final Map<String, IIcon> ICONS = new HashMap<>();
@Override
public ConduitRenderer getRenderer() {
return GasConduitRenderer.instance.get();
}
@SideOnly(Side.CLIENT)
public static void initIcons() {
@@ -1,15 +1,13 @@
package crazypants.enderio.conduit.gas;
import static com.enderio.core.client.render.CubeRenderer.addVecWithUV;
import java.util.List;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.IIcon;
import net.minecraftforge.common.util.ForgeDirection;
import com.enderio.core.client.render.BoundingBox;
import com.enderio.core.client.render.CubeRenderer;
import com.enderio.core.client.render.RenderUtil;
import com.enderio.core.common.vecmath.Vector3d;
import com.enderio.core.common.vecmath.Vertex;
@@ -22,15 +20,13 @@ import crazypants.enderio.conduit.geom.CollidableComponent;
import crazypants.enderio.conduit.geom.ConnectionModeGeometry;
import crazypants.enderio.conduit.geom.Offset;
import crazypants.enderio.conduit.render.ConduitBundleRenderer;
import crazypants.enderio.conduit.render.ConduitRenderer;
import crazypants.enderio.conduit.render.DefaultConduitRenderer;
import mekanism.api.gas.GasStack;
public class GasConduitRenderer extends DefaultConduitRenderer {
@Override
public boolean isRendererForConduit(IConduit conduit) {
return conduit instanceof GasConduit;
}
public static final ThreadLocal<ConduitRenderer> instance = ThreadLocal.withInitial(GasConduitRenderer::new);
@Override
public void renderEntity(ConduitBundleRenderer conduitBundleRenderer, IConduitBundle te, IConduit conduit, double x,
@@ -58,6 +54,8 @@ public class GasConduitRenderer extends DefaultConduitRenderer {
@Override
protected void renderConduit(IIcon tex, IConduit conduit, CollidableComponent component, float brightness) {
super.renderConduit(tex, conduit, component, brightness);
final CubeRenderer cr = CubeRenderer.get();
int i;
if (isNSEWUD(component.dir)) {
GasConduit lc = (GasConduit) conduit;
@@ -103,15 +101,17 @@ public class GasConduitRenderer extends DefaultConduitRenderer {
List<Vertex> corners = bb.getCornersWithUvForFace(d, minU, maxU, minV, maxV);
moveEdgeCorners(corners, vDir, width);
moveEdgeCorners(corners, component.dir.getOpposite(), sideScale);
for (Vertex c : corners) {
addVecWithUV(c.xyz, c.uv.x, c.uv.y);
for (i = 0; i < corners.size(); i++) {
final Vertex c = corners.get(i);
cr.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
}
corners = bb.getCornersWithUvForFace(d, minU, maxU, minV, maxV);
moveEdgeCorners(corners, vDir.getOpposite(), width);
moveEdgeCorners(corners, component.dir.getOpposite(), sideScale);
for (Vertex c : corners) {
addVecWithUV(c.xyz, c.uv.x, c.uv.y);
for (i = 0; i < corners.size(); i++) {
final Vertex c = corners.get(i);
cr.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
}
}
}
@@ -124,14 +124,15 @@ public class GasConduitRenderer extends DefaultConduitRenderer {
tex.getMaxU(),
tex.getMinV(),
tex.getMaxV());
Tessellator tessellator = Tessellator.instance;
for (Vertex c : corners) {
addVecWithUV(c.xyz, c.uv.x, c.uv.y);
for (i = 0; i < corners.size(); i++) {
final Vertex c = corners.get(i);
cr.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
}
// back face
for (int i = corners.size() - 1; i >= 0; i--) {
Vertex c = corners.get(i);
addVecWithUV(c.xyz, c.uv.x, c.uv.y);
for (i = corners.size() - 1; i >= 0; i--) {
final Vertex c = corners.get(i);
cr.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
}
}
}
@@ -1,6 +1,7 @@
package crazypants.enderio.conduit.gui;
import java.awt.*;
import java.awt.Color;
import java.awt.Rectangle;
import java.util.ArrayList;
import javax.annotation.Nonnull;
@@ -1,6 +1,6 @@
package crazypants.enderio.conduit.gui.item;
import java.awt.*;
import java.awt.Color;
import javax.annotation.Nonnull;
@@ -0,0 +1,202 @@
package crazypants.enderio.conduit.gui.item;
import net.minecraft.client.gui.GuiButton;
import org.lwjgl.opengl.GL11;
import com.enderio.core.client.gui.button.CycleButton;
import com.enderio.core.client.gui.button.IconButton;
import com.enderio.core.client.gui.button.ToggleButton;
import crazypants.enderio.EnderIO;
import crazypants.enderio.conduit.gui.GuiExternalConnection;
import crazypants.enderio.conduit.item.filter.FuzzyMode;
import crazypants.enderio.conduit.item.filter.ItemFilter;
import crazypants.enderio.gui.GuiContainerBaseEIO;
import crazypants.enderio.gui.IconEIO;
public class LimitedItemFilterGui implements IItemFilterGui {
private static final int ID_WHITELIST = GuiExternalConnection.nextButtonId();
private static final int ID_NBT = GuiExternalConnection.nextButtonId();
private static final int ID_META = GuiExternalConnection.nextButtonId();
private static final int ID_ORE_DICT = GuiExternalConnection.nextButtonId();
private static final int ID_STICKY = GuiExternalConnection.nextButtonId();
private static final int ID_FUZZY = GuiExternalConnection.nextButtonId();
private final GuiContainerBaseEIO gui;
private final ToggleButton useMetaB;
private final ToggleButton useNbtB;
private final IconButton whiteListB;
private final ToggleButton useOreDictB;
private final ToggleButton stickyB;
private final CycleButton<FuzzyMode> fuzzyB;
private final IItemFilterContainer filterContainer;
private final ItemFilter filter;
private int buttonIdOffset;
private int xOffset;
private int yOffset;
final boolean isStickyModeAvailable;
private boolean isInput;
public LimitedItemFilterGui(GuiContainerBaseEIO gui, IItemFilterContainer filterContainer,
boolean isStickyModeAvailable, boolean isInput) {
this(gui, filterContainer, isStickyModeAvailable, isInput, isInput ? 104 : 6, 96, isInput ? 0 : 256);
}
public LimitedItemFilterGui(GuiContainerBaseEIO gui, IItemFilterContainer filterContainer,
boolean isStickyModeAvailable, boolean isInput, int xOffset, int yOffset, int buttonIdOffset) {
this.gui = gui;
this.isStickyModeAvailable = isStickyModeAvailable;
this.filterContainer = filterContainer;
this.xOffset = xOffset;
this.yOffset = yOffset;
this.buttonIdOffset = buttonIdOffset;
this.isInput = isInput;
filter = filterContainer.getItemFilter();
int butLeft = xOffset;
int x = butLeft;
int y = yOffset + 40;
whiteListB = new IconButton(gui, ID_WHITELIST + buttonIdOffset, x, y, IconEIO.FILTER_WHITELIST);
whiteListB.setToolTip(getWhitelistTooltips(false));
x += 16;
useMetaB = new ToggleButton(gui, ID_META + buttonIdOffset, x, y, IconEIO.FILTER_META_OFF, IconEIO.FILTER_META);
useMetaB.setSelectedToolTip(EnderIO.lang.localize("gui.conduit.item.matchMetaData"));
useMetaB.setUnselectedToolTip(EnderIO.lang.localize("gui.conduit.item.ignoreMetaData"));
useMetaB.setPaintSelectedBorder(false);
x += 16;
stickyB = new ToggleButton(
gui,
ID_STICKY + buttonIdOffset,
x,
y,
IconEIO.FILTER_STICKY_OFF,
IconEIO.FILTER_STICKY);
stickyB.setSelectedToolTip(EnderIO.lang.localizeList("gui.conduit.item.stickyEnabled"));
stickyB.setUnselectedToolTip(EnderIO.lang.localize("gui.conduit.item.stickyDisbaled"));
stickyB.setPaintSelectedBorder(false);
if (isStickyModeAvailable) x += 16;
useOreDictB = new ToggleButton(
gui,
ID_ORE_DICT + buttonIdOffset,
x,
y,
IconEIO.FILTER_ORE_DICT_OFF,
IconEIO.FILTER_ORE_DICT);
useOreDictB.setSelectedToolTip(EnderIO.lang.localize("gui.conduit.item.oreDicEnabled"));
useOreDictB.setUnselectedToolTip(EnderIO.lang.localize("gui.conduit.item.oreDicDisabled"));
useOreDictB.setPaintSelectedBorder(false);
x += 16;
useNbtB = new ToggleButton(gui, ID_NBT + buttonIdOffset, x, y, IconEIO.FILTER_NBT_OFF, IconEIO.FILTER_NBT);
useNbtB.setSelectedToolTip(EnderIO.lang.localize("gui.conduit.item.matchNBT"));
useNbtB.setUnselectedToolTip(EnderIO.lang.localize("gui.conduit.item.ignoreNBT"));
useNbtB.setPaintSelectedBorder(false);
x += 16;
fuzzyB = new CycleButton(gui, ID_FUZZY + buttonIdOffset, x, y, FuzzyMode.class);
}
public void createFilterSlots() {
filter.createGhostSlots(gui.getGhostSlots(), xOffset + 1, yOffset + 1, new Runnable() {
@Override
public void run() {
sendFilterChange();
}
});
}
@Override
public void mouseClicked(int x, int y, int par3) {}
@Override
public void updateButtons() {
ItemFilter activeFilter = filter;
useNbtB.onGuiInit();
useNbtB.setSelected(activeFilter.isMatchNBT());
useOreDictB.onGuiInit();
useOreDictB.setSelected(activeFilter.isUseOreDict());
if (isStickyModeAvailable) {
stickyB.onGuiInit();
stickyB.setSelected(activeFilter.isSticky());
}
fuzzyB.onGuiInit();
fuzzyB.setMode(activeFilter.getFuzzyMode());
useMetaB.onGuiInit();
useMetaB.setSelected(activeFilter.isMatchMeta());
}
@Override
public void actionPerformed(GuiButton guiButton) {
if (guiButton.id == ID_META + buttonIdOffset) {
filter.setMatchMeta(useMetaB.isSelected());
sendFilterChange();
} else if (guiButton.id == ID_NBT + buttonIdOffset) {
filter.setMatchNBT(useNbtB.isSelected());
sendFilterChange();
} else if (guiButton.id == ID_STICKY + buttonIdOffset) {
filter.setSticky(stickyB.isSelected());
sendFilterChange();
} else if (guiButton.id == ID_ORE_DICT + buttonIdOffset) {
filter.setUseOreDict(useOreDictB.isSelected());
sendFilterChange();
} else if (guiButton.id == ID_FUZZY + buttonIdOffset) {
filter.setFuzzyMode(fuzzyB.getMode());
sendFilterChange();
} else if (guiButton.id == ID_WHITELIST + buttonIdOffset) {
filter.setBlacklist(!filter.isBlacklist());
sendFilterChange();
}
}
private void sendFilterChange() {
updateButtons();
filterContainer.onFilterChanged();
}
@Override
public void deactivate() {
useNbtB.detach();
useMetaB.detach();
useOreDictB.detach();
whiteListB.detach();
stickyB.detach();
fuzzyB.detach();
}
@Override
public void renderCustomOptions(int top, float par1, int par2, int par3) {
GL11.glColor3f(1, 1, 1);
gui.bindGuiTexture(1);
gui.drawTexturedModalRect(gui.getGuiLeft() + xOffset, gui.getGuiTop() + yOffset, 0, 238, 18 * 5, 18);
gui.drawTexturedModalRect(gui.getGuiLeft() + xOffset, gui.getGuiTop() + yOffset + 20, 0, 238, 18 * 5, 18);
}
private String[] getWhitelistTooltips(boolean isBlacklist) {
if (isBlacklist) {
return new String[] { EnderIO.lang.localize("gui.conduit.item.blacklist"),
EnderIO.lang.localize("gui.conduit.item.blacklist.tooltip.0"),
EnderIO.lang.localize("gui.conduit.item.blacklist.tooltip.1") };
} else {
return new String[] { EnderIO.lang.localize("gui.conduit.item.whitelist"),
EnderIO.lang.localize("gui.conduit.item.whitelist.tooltip.0"),
EnderIO.lang.localize("gui.conduit.item.whitelist.tooltip.1") };
}
}
}
@@ -11,9 +11,15 @@ import cofh.api.transport.IItemDuct;
import crazypants.enderio.conduit.IConduit;
import crazypants.enderio.conduit.IExtractor;
import crazypants.enderio.conduit.item.filter.IItemFilter;
import crazypants.enderio.conduit.render.ConduitRenderer;
public interface IItemConduit extends IConduit, IItemDuct, IExtractor {
@Override
default ConduitRenderer getRenderer() {
return ItemConduitRenderer.instance.get();
}
IIcon getTextureForInputMode();
IIcon getTextureForOutputMode();
@@ -612,8 +612,7 @@ public class ItemConduit extends AbstractConduit implements IItemConduit {
@Override
public ItemStack createItem() {
ItemStack result = new ItemStack(EnderIO.itemItemConduit, 1, metaData);
return result;
return new ItemStack(EnderIO.itemItemConduit, 1, metaData);
}
@Override
@@ -13,17 +13,12 @@ import crazypants.enderio.conduit.IConduitBundle;
import crazypants.enderio.conduit.geom.ConnectionModeGeometry;
import crazypants.enderio.conduit.geom.Offset;
import crazypants.enderio.conduit.render.ConduitBundleRenderer;
import crazypants.enderio.conduit.render.ConduitRenderer;
import crazypants.enderio.conduit.render.DefaultConduitRenderer;
public class ItemConduitRenderer extends DefaultConduitRenderer {
@Override
public boolean isRendererForConduit(IConduit conduit) {
if (conduit instanceof IItemConduit) {
return true;
}
return false;
}
public static final ThreadLocal<ConduitRenderer> instance = ThreadLocal.withInitial(ItemConduitRenderer::new);
@Override
public void renderEntity(ConduitBundleRenderer conduitBundleRenderer, IConduitBundle te, IConduit conduit, double x,
@@ -22,6 +22,7 @@ import com.enderio.core.common.util.RoundRobinIterator;
import crazypants.enderio.conduit.ConnectionMode;
import crazypants.enderio.conduit.item.filter.IItemFilter;
import crazypants.enderio.conduit.item.filter.ItemFilterLimited;
import crazypants.enderio.config.Config;
import crazypants.enderio.machine.invpanel.TileInventoryPanel;
@@ -155,6 +156,7 @@ public class NetworkedInventory {
int numSlots = slotIndices.length;
ItemStack extractItem = null;
int maxExtracted = con.getMaximumExtracted(conDir);
final IItemFilter filter = con.getInputFilter(conDir);
int slot = -1;
int slotChecksPerTick = Math.min(numSlots, ItemConduitNetwork.MAX_SLOT_CHECK_PER_TICK);
@@ -162,12 +164,23 @@ public class NetworkedInventory {
int index = nextSlot(numSlots);
slot = slotIndices[index];
ItemStack item = getInventory().getStackInSlot(slot);
if (canExtractItem(item)) {
extractItem = item.copy();
if (getInventory().canExtractItem(slot, extractItem, inventorySide)) {
if (doTransfer(extractItem, slot, maxExtracted)) {
setNextStartingSlot(slot);
return true;
if (item != null) {
if (filter != null && filter.isLimited()) {
final int count = ((ItemFilterLimited) filter).getInsertLimitInv(getInventory(), item);
if (count <= 0) {
continue;
} else if (count < item.stackSize) {
item = item.copy();
item.stackSize = count;
}
}
if (canExtractItem(item)) {
extractItem = item.copy();
if (getInventory().canExtractItem(slot, extractItem, inventorySide)) {
if (doTransfer(extractItem, slot, maxExtracted)) {
setNextStartingSlot(slot);
return true;
}
}
}
}
@@ -183,7 +196,11 @@ public class NetworkedInventory {
if (filter == null) {
return true;
}
return filter.doesItemPassFilter(this, itemStack);
if (filter.isLimited()) {
return filter.isValid() && ((ItemFilterLimited) filter).doesItemPassFilterInv(this, itemStack);
} else {
return filter.doesItemPassFilter(this, itemStack);
}
}
private boolean doTransfer(ItemStack extractedItem, int slot, int maxExtract) {
@@ -278,7 +295,20 @@ public class NetworkedInventory {
}
IItemFilter filter = con.getOutputFilter(conDir);
if (filter != null) {
if (!filter.doesItemPassFilter(this, item)) {
if (filter.isLimited()) {
final int count = filter.getMaxCountThatCanPassFilter(item);
if (count <= 0) {
return 0;
} else {
final int maxInsert = ((ItemFilterLimited) filter).getInsertLimit(getInventory(), item);
if (maxInsert <= 0) {
return 0;
} else if (maxInsert < item.stackSize) {
item = item.copy();
item.stackSize = maxInsert;
}
}
} else if (!filter.doesItemPassFilter(this, item)) {
return 0;
}
}
@@ -30,7 +30,7 @@ public interface IItemFilter {
/**
* Checks if the given item passes the filter or not.
*
*
* @param inv the attached inventory - or null when used without an inventory (eg for a GUI)
* @param item the item to check
* @return true if the item is allowed to pass
@@ -41,10 +41,18 @@ public interface IItemFilter {
boolean isValid();
default boolean isLimited() {
return false;
}
boolean isSticky();
void createGhostSlots(List<GhostSlot> slots, int xOffset, int yOffset, Runnable cb);
default int getMaxCountThatCanPassFilter(ItemStack item) {
return 1;
}
int getSlotCount();
default String getUnlocalizedName() {
@@ -98,7 +98,7 @@ public class ItemFilter implements IInventory, IItemFilter {
return isBlacklist ? !allow : allow;
}
private boolean itemMatched(ItemStack item) {
protected boolean itemMatched(ItemStack item) {
if (item == null) {
return false;
}
@@ -145,7 +145,7 @@ public class ItemFilter implements IInventory, IItemFilter {
return matched;
}
private boolean isOreDicMatch(int filterItemIndex, ItemStack item) {
protected boolean isOreDicMatch(int filterItemIndex, ItemStack item) {
int[] ids1 = getCachedIds(filterItemIndex);
if (ids1 == null || ids1.length == 0) {
return false;
@@ -164,8 +164,9 @@ public class ItemFilter implements IInventory, IItemFilter {
return false;
}
private boolean isNBTMatch(ItemStack filter, ItemStack item) {
if (filter.stackTagCompound == null && item.stackTagCompound == null) return true;
protected boolean isNBTMatch(ItemStack filter, ItemStack item) {
if (filter.stackTagCompound == null && (item.stackTagCompound == null || item.stackTagCompound.hasNoTags()))
return true;
if (filter.stackTagCompound == null || item.stackTagCompound == null) return false;
if (!filter.getTagCompound().hasKey("GEN")) return filter.stackTagCompound.equals(item.stackTagCompound);
NBTTagCompound filterTag = (NBTTagCompound) filter.getTagCompound().copy();
@@ -202,7 +203,7 @@ public class ItemFilter implements IInventory, IItemFilter {
return !isItemListEmpty();
}
private boolean isItemListEmpty() {
protected boolean isItemListEmpty() {
for (ItemStack item : items) {
if (item != null) {
return false;
@@ -0,0 +1,242 @@
package crazypants.enderio.conduit.item.filter;
import java.util.List;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import com.enderio.core.client.gui.widget.GhostSlot;
import cofh.lib.util.helpers.MathHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import crazypants.enderio.conduit.gui.GuiExternalConnection;
import crazypants.enderio.conduit.gui.item.IItemFilterGui;
import crazypants.enderio.conduit.gui.item.ItemConduitFilterContainer;
import crazypants.enderio.conduit.gui.item.LimitedItemFilterGui;
import crazypants.enderio.conduit.item.IItemConduit;
import crazypants.enderio.conduit.item.NetworkedInventory;
public class ItemFilterLimited extends ItemFilter {
public ItemFilterLimited() {
this(10, true);
}
public ItemFilterLimited(int numItems, boolean isAdvanced) {
super(numItems, isAdvanced);
}
@Override
public String getInventoryName() {
return "Limited Item Filter";
}
@Override
@SideOnly(Side.CLIENT)
public IItemFilterGui getGui(GuiExternalConnection gui, IItemConduit itemConduit, boolean isInput) {
ItemConduitFilterContainer cont = new ItemConduitFilterContainer(itemConduit, gui.getDir(), isInput);
LimitedItemFilterGui limitedItemFilterGui = new LimitedItemFilterGui(gui, cont, !isInput, isInput);
limitedItemFilterGui.createFilterSlots();
return limitedItemFilterGui;
}
@Override
public void createGhostSlots(List<GhostSlot> slots, int xOffset, int yOffset, Runnable cb) {
int index = 0;
int numRows = (int) (double) (items.length / 5);
for (int row = 0; row < numRows; ++row) {
for (int col = 0; col < 5; ++col) {
int x = xOffset + col * 18;
int y = yOffset + row * 20;
slots.add(new ItemFilterGhostSlot(index, x, y, cb));
index++;
}
}
}
@Override
public int getMaxCountThatCanPassFilter(ItemStack item) {
if (item == null || item.getItem() == null) {
return 0;
}
int count = 0;
for (int i = 0; i < items.length; i++) {
ItemStack invStack = items[i];
if (invStack != null && itemStackMatched(invStack, item, i)) {
count += invStack.stackSize;
}
}
return count;
}
@Override
public boolean isLimited() {
return true;
}
public int getInsertLimit(ISidedInventory inv, ItemStack item) {
if (item == null || item.getItem() == null) {
return 0;
}
int count = 0;
for (int i = 0; i < inv.getSizeInventory(); i++) {
ItemStack invStack = inv.getStackInSlot(i);
if (invStack != null && itemStackMatched(invStack, item, i)) {
count += invStack.stackSize;
}
}
return getMaxCountThatCanPassFilter(item) - count;
}
public int getInsertLimitInv(ISidedInventory inv, ItemStack item) {
return -getInsertLimit(inv, item);
}
public boolean doesCountPassFilter(int maxCount) {
return maxCount > 0;
}
@Override
public boolean doesItemPassFilter(NetworkedInventory inv, ItemStack item) {
return isValid() && itemMatched(item) && doesCountPassFilter(getInsertLimit(inv.getInventory(), item));
}
// Filter in extract slot
public boolean doesItemPassFilterInv(NetworkedInventory inv, ItemStack item) {
return isValid() && itemMatched(item) && doesCountPassFilter(getInsertLimitInv(inv.getInventory(), item));
}
protected boolean itemStackMatched(ItemStack item, ItemStack filter, int slot) {
if (item == null) {
return false;
}
boolean checkDamage = fuzzyMode != FuzzyMode.DISABLED;
boolean damageMatched = false;
if (checkDamage && item.getItem().isDamageable()) {
damageMatched = fuzzyMode.compare(item);
}
if (isItemListEmpty()) {
if (checkDamage) {
return damageMatched;
} else {
return false;
}
}
boolean matched = false;
if (filter != null && item.getItem() == filter.getItem()) {
matched = true;
if (checkDamage && !damageMatched) {
matched = false;
} else if (matchMeta && item.getItemDamage() != filter.getItemDamage()) {
matched = false;
} else if (matchNBT && !isNBTMatch(item, filter)) {
matched = false;
}
}
if (!matched && useOreDict && isOreDicMatch(filter, item)) {
matched = true;
}
return matched;
}
public boolean isOreDicMatch(ItemStack filter, ItemStack item) {
int[] id_filter = OreDictionary.getOreIDs(filter);
if (id_filter.length == 0) {
return false;
}
int[] id_item = OreDictionary.getOreIDs(item);
if (id_item.length == 0) {
return false;
}
for (int id1 : id_filter) {
for (int id2 : id_item) {
if (id1 == id2) {
return true;
}
}
}
return false;
}
@Override
public ItemStack decrStackSize(int fromSlot, int amount) {
if ((fromSlot < 0) || (fromSlot >= items.length)) {
return null;
}
oreIds.set(fromSlot, null);
ItemStack item = items[fromSlot];
items[fromSlot] = null;
return item.splitStack(amount);
}
@Override
public String toString() {
return "Limited" + super.toString();
}
@Override
public String getUnlocalizedName() {
return "gui.limited_item_filter";
}
class ItemFilterGhostSlot extends GhostSlot {
private final int slot;
private final Runnable cb;
private final int adjustOnShift;
ItemFilterGhostSlot(int slot, int x, int y, Runnable cb) {
this.x = x;
this.y = y;
this.slot = slot;
this.cb = cb;
this.displayStdOverlay = true;
this.stackSizeLimit = 64;
this.adjustOnShift = 10;
}
@Override
public void putStack(ItemStack stack) {
if (stack != null) {
stack = stack.copy();
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
if (Mouse.isButtonDown(0) || Mouse.getEventDWheel() > 0) {
if (stack.stackSize - 1 == 1) {
stack.stackSize += adjustOnShift - 2;
} else {
stack.stackSize = MathHelper
.clamp(stack.stackSize + adjustOnShift - 1, 1, stack.getMaxStackSize());
}
} else if (Mouse.isButtonDown(1) || Mouse.getEventDWheel() < 0) {
if (stack.stackSize + 1 == 1) {
stack.stackSize++;
} else {
stack.stackSize = MathHelper
.clamp(stack.stackSize - adjustOnShift + 1, 1, stack.getMaxStackSize());
}
}
}
}
items[slot] = stack;
cb.run();
}
@Override
public ItemStack getStack() {
return items[slot];
}
}
}
@@ -0,0 +1,73 @@
package crazypants.enderio.conduit.item.filter;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import com.enderio.core.api.client.gui.IResourceTooltipProvider;
import com.enderio.core.client.handlers.SpecialTooltipHandler;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import crazypants.enderio.EnderIO;
import crazypants.enderio.EnderIOTab;
import crazypants.enderio.ModObject;
import crazypants.enderio.conduit.item.FilterRegister;
public class ItemLimitedItemFilter extends Item implements IItemFilterUpgrade, IResourceTooltipProvider {
public static ItemLimitedItemFilter create() {
ItemLimitedItemFilter result = new ItemLimitedItemFilter();
result.init();
return result;
}
protected ItemLimitedItemFilter() {
setCreativeTab(EnderIOTab.tabEnderIO);
setUnlocalizedName(ModObject.itemLimitedItemFilter.unlocalisedName);
setMaxDamage(0);
setMaxStackSize(64);
}
protected void init() {
GameRegistry.registerItem(this, ModObject.itemLimitedItemFilter.unlocalisedName);
}
@Override
public IItemFilter createFilterFromStack(ItemStack stack) {
IItemFilter filter = new ItemFilterLimited();
if (stack.stackTagCompound != null && stack.stackTagCompound.hasKey("filter")) {
filter.readFromNBT(stack.stackTagCompound.getCompoundTag("filter"));
}
return filter;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister IIconRegister) {
itemIcon = IIconRegister.registerIcon("enderio:limitedItemFilter");
}
@Override
public String getUnlocalizedNameForTooltip(ItemStack stack) {
return getUnlocalizedName();
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
if (FilterRegister.isFilterSet(par1ItemStack)) {
if (SpecialTooltipHandler.showAdvancedTooltips()) {
par3List.add(EnumChatFormatting.ITALIC + EnderIO.lang.localize("itemConduitFilterUpgrade.configured"));
par3List.add(
EnumChatFormatting.ITALIC
+ EnderIO.lang.localize("itemConduitFilterUpgrade.clearConfigMethod"));
}
}
}
}
@@ -13,7 +13,6 @@ import crazypants.enderio.EnderIOTab;
import crazypants.enderio.ModObject;
/**
*
* @author matthias
*/
public class ItemPowerItemFilter extends Item implements IItemFilterUpgrade, IResourceTooltipProvider {
@@ -19,7 +19,6 @@ import crazypants.enderio.conduit.item.NetworkedInventory;
import io.netty.buffer.ByteBuf;
/**
*
* @author matthias
*/
public class PowerItemFilter implements IItemFilter {
@@ -34,6 +34,7 @@ import crazypants.enderio.conduit.IConduit;
import crazypants.enderio.conduit.RaytraceResult;
import crazypants.enderio.conduit.geom.CollidableComponent;
import crazypants.enderio.conduit.item.ItemConduit;
import crazypants.enderio.conduit.render.ConduitRenderer;
import crazypants.enderio.config.Config;
import crazypants.enderio.machine.RedstoneControlMode;
import crazypants.enderio.tool.ToolUtil;
@@ -46,9 +47,14 @@ public abstract class AbstractEnderLiquidConduit extends AbstractLiquidConduit {
public static final String ICON_KEY_IN_OUT_OUT = ItemConduit.ICON_KEY_IN_OUT_OUT;
public static final String ICON_KEY_IN_OUT_IN = ItemConduit.ICON_KEY_IN_OUT_IN;
static final Map<String, IIcon> ICONS = new HashMap<String, IIcon>();
static final Map<String, IIcon> ICONS = new HashMap<>();
private final Set<BlockCoord> filledFromThisTick = new HashSet<>();
@Override
public ConduitRenderer getRenderer() {
return EnderLiquidConduitRenderer.instance.get();
}
@SideOnly(Side.CLIENT)
public static void initIcons() {
IconUtil.addIconProvider(new IconUtil.IIconProvider() {
@@ -157,11 +157,11 @@ public abstract class AbstractLiquidConduit extends AbstractConduit implements I
boolean res;
if (mode == RedstoneControlMode.OFF) {
// if checking for no signal, must be no signal from both
res = mode.isConditionMet(mode, signal)
res = RedstoneControlMode.isConditionMet(mode, signal)
&& (col != DyeColor.RED || isConditionMetByExternalSignal(dir, mode, col));
} else {
// if checking for a signal, either is fine
res = mode.isConditionMet(mode, signal)
res = RedstoneControlMode.isConditionMet(mode, signal)
|| (col == DyeColor.RED && isConditionMetByExternalSignal(dir, mode, col));
}
return res;
@@ -180,7 +180,12 @@ public abstract class AbstractLiquidConduit extends AbstractConduit implements I
}
}
return mode.isConditionMet(mode, externalSignal);
return RedstoneControlMode.isConditionMet(mode, externalSignal);
}
@Override
protected ConnectionMode getDefaultConnectionMode() {
return ConnectionMode.INPUT;
}
@Override
@@ -23,6 +23,7 @@ import crazypants.enderio.conduit.AbstractConduitNetwork;
import crazypants.enderio.conduit.ConnectionMode;
import crazypants.enderio.conduit.IConduit;
import crazypants.enderio.conduit.geom.CollidableComponent;
import crazypants.enderio.conduit.render.ConduitRenderer;
import crazypants.enderio.config.Config;
import crazypants.enderio.machine.RedstoneControlMode;
@@ -37,7 +38,12 @@ public class AdvancedLiquidConduit extends AbstractTankConduit {
public static final String ICON_INSERT_KEY = "enderio:liquidConduitAdvancedOutput";
public static final String ICON_EMPTY_EDGE = "enderio:liquidConduitAdvancedEdge";
static final Map<String, IIcon> ICONS = new HashMap<String, IIcon>();
static final Map<String, IIcon> ICONS = new HashMap<>();
@Override
public ConduitRenderer getRenderer() {
return AdvancedLiquidConduitRenderer.instance.get();
}
@SideOnly(Side.CLIENT)
public static void initIcons() {
@@ -1,16 +1,14 @@
package crazypants.enderio.conduit.liquid;
import static com.enderio.core.client.render.CubeRenderer.addVecWithUV;
import java.util.List;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.IIcon;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
import com.enderio.core.client.render.BoundingBox;
import com.enderio.core.client.render.CubeRenderer;
import com.enderio.core.client.render.RenderUtil;
import com.enderio.core.common.vecmath.Vector3d;
import com.enderio.core.common.vecmath.Vertex;
@@ -23,14 +21,13 @@ import crazypants.enderio.conduit.geom.CollidableComponent;
import crazypants.enderio.conduit.geom.ConnectionModeGeometry;
import crazypants.enderio.conduit.geom.Offset;
import crazypants.enderio.conduit.render.ConduitBundleRenderer;
import crazypants.enderio.conduit.render.ConduitRenderer;
import crazypants.enderio.conduit.render.DefaultConduitRenderer;
public class AdvancedLiquidConduitRenderer extends DefaultConduitRenderer {
@Override
public boolean isRendererForConduit(IConduit conduit) {
return conduit instanceof AdvancedLiquidConduit;
}
public static final ThreadLocal<ConduitRenderer> instance = ThreadLocal
.withInitial(AdvancedLiquidConduitRenderer::new);
@Override
public void renderEntity(ConduitBundleRenderer conduitBundleRenderer, IConduitBundle te, IConduit conduit, double x,
@@ -58,6 +55,8 @@ public class AdvancedLiquidConduitRenderer extends DefaultConduitRenderer {
@Override
protected void renderConduit(IIcon tex, IConduit conduit, CollidableComponent component, float brightness) {
super.renderConduit(tex, conduit, component, brightness);
final CubeRenderer cr = CubeRenderer.get();
int i;
if (isNSEWUD(component.dir)) {
AdvancedLiquidConduit lc = (AdvancedLiquidConduit) conduit;
@@ -106,15 +105,17 @@ public class AdvancedLiquidConduitRenderer extends DefaultConduitRenderer {
List<Vertex> corners = bb.getCornersWithUvForFace(d, minU, maxU, minV, maxV);
moveEdgeCorners(corners, vDir, width);
moveEdgeCorners(corners, component.dir.getOpposite(), sideScale);
for (Vertex c : corners) {
addVecWithUV(c.xyz, c.uv.x, c.uv.y);
for (i = 0; i < corners.size(); i++) {
final Vertex c = corners.get(i);
cr.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
}
corners = bb.getCornersWithUvForFace(d, minU, maxU, minV, maxV);
moveEdgeCorners(corners, vDir.getOpposite(), width);
moveEdgeCorners(corners, component.dir.getOpposite(), sideScale);
for (Vertex c : corners) {
addVecWithUV(c.xyz, c.uv.x, c.uv.y);
for (i = 0; i < corners.size(); i++) {
final Vertex c = corners.get(i);
cr.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
}
}
}
@@ -127,14 +128,14 @@ public class AdvancedLiquidConduitRenderer extends DefaultConduitRenderer {
tex.getMaxU(),
tex.getMinV(),
tex.getMaxV());
Tessellator tessellator = Tessellator.instance;
for (Vertex c : corners) {
addVecWithUV(c.xyz, c.uv.x, c.uv.y);
for (i = 0; i < corners.size(); i++) {
final Vertex c = corners.get(i);
cr.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
}
// back face
for (int i = corners.size() - 1; i >= 0; i--) {
for (i = corners.size() - 1; i >= 0; i--) {
Vertex c = corners.get(i);
addVecWithUV(c.xyz, c.uv.x, c.uv.y);
cr.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
}
}
}
@@ -1,6 +1,10 @@
package crazypants.enderio.conduit.liquid;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
@@ -13,17 +13,13 @@ import crazypants.enderio.conduit.IConduitBundle;
import crazypants.enderio.conduit.geom.ConnectionModeGeometry;
import crazypants.enderio.conduit.geom.Offset;
import crazypants.enderio.conduit.render.ConduitBundleRenderer;
import crazypants.enderio.conduit.render.ConduitRenderer;
import crazypants.enderio.conduit.render.DefaultConduitRenderer;
public class EnderLiquidConduitRenderer extends DefaultConduitRenderer {
@Override
public boolean isRendererForConduit(IConduit conduit) {
if (conduit instanceof AbstractEnderLiquidConduit) {
return true;
}
return false;
}
public static final ThreadLocal<ConduitRenderer> instance = ThreadLocal
.withInitial(EnderLiquidConduitRenderer::new);
@Override
public void renderEntity(ConduitBundleRenderer conduitBundleRenderer, IConduitBundle te, IConduit conduit, double x,
@@ -27,6 +27,7 @@ import crazypants.enderio.conduit.ConduitUtil;
import crazypants.enderio.conduit.ConnectionMode;
import crazypants.enderio.conduit.IConduit;
import crazypants.enderio.conduit.geom.CollidableComponent;
import crazypants.enderio.conduit.render.ConduitRenderer;
import crazypants.enderio.config.Config;
import crazypants.enderio.network.PacketHandler;
@@ -42,7 +43,12 @@ public class LiquidConduit extends AbstractTankConduit {
public static final String ICON_INSERT_KEY = "enderio:liquidConduitInsert";
public static final String ICON_EMPTY_INSERT_KEY = "enderio:emptyLiquidConduitInsert";
static final Map<String, IIcon> ICONS = new HashMap<String, IIcon>();
static final Map<String, IIcon> ICONS = new HashMap<>();
@Override
public ConduitRenderer getRenderer() {
return LiquidConduitRenderer.instance.get();
}
@SideOnly(Side.CLIENT)
public static void initIcons() {
@@ -1,13 +1,12 @@
package crazypants.enderio.conduit.liquid;
import static com.enderio.core.client.render.CubeRenderer.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.WeakHashMap;
import java.util.concurrent.ConcurrentHashMap;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
@@ -19,6 +18,7 @@ import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import com.enderio.core.client.render.BoundingBox;
import com.enderio.core.client.render.CubeRenderer;
import com.enderio.core.client.render.RenderUtil;
import com.enderio.core.common.util.ForgeDirectionOffsets;
import com.enderio.core.common.vecmath.Vector2f;
@@ -32,32 +32,22 @@ import crazypants.enderio.conduit.IConduit;
import crazypants.enderio.conduit.IConduitBundle;
import crazypants.enderio.conduit.geom.CollidableComponent;
import crazypants.enderio.conduit.render.ConduitBundleRenderer;
import crazypants.enderio.conduit.render.ConduitRenderer;
import crazypants.enderio.conduit.render.DefaultConduitRenderer;
public class LiquidConduitRenderer extends DefaultConduitRenderer implements IResourceManagerReloadListener {
public static final ThreadLocal<ConduitRenderer> instance = ThreadLocal.withInitial(LiquidConduitRenderer::new);
private float downRatio;
private float flatRatio;
private float upRatio;
private LiquidConduitRenderer() {
public LiquidConduitRenderer() {
super();
}
public static LiquidConduitRenderer create() {
LiquidConduitRenderer result = new LiquidConduitRenderer();
RenderUtil.registerReloadListener(result);
return result;
}
@Override
public boolean isRendererForConduit(IConduit conduit) {
if (conduit instanceof LiquidConduit) {
return true;
}
return false;
RenderUtil.registerReloadListener(this);
}
@Override
@@ -92,16 +82,19 @@ public class LiquidConduitRenderer extends DefaultConduitRenderer implements IRe
}
if (conduit.getConnectionMode(component.dir) == ConnectionMode.DISABLED) {
final CubeRenderer cr = CubeRenderer.get();
int i;
tex = EnderIO.blockConduitBundle.getConnectorIcon(component.data);
List<Vertex> corners = component.bound
.getCornersWithUvForFace(component.dir, tex.getMinU(), tex.getMaxU(), tex.getMinV(), tex.getMaxV());
for (Vertex c : corners) {
addVecWithUV(c.xyz, c.uv.x, c.uv.y);
for (i = corners.size() - 1; i >= 0; i--) {
Vertex c = corners.get(i);
cr.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
}
// back face
for (int i = corners.size() - 1; i >= 0; i--) {
for (i = corners.size() - 1; i >= 0; i--) {
Vertex c = corners.get(i);
addVecWithUV(c.xyz, c.uv.x, c.uv.y);
cr.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
}
}
}
@@ -121,27 +114,29 @@ public class LiquidConduitRenderer extends DefaultConduitRenderer implements IRe
}
}
private static Map<CollidableComponent, Map<Fluid, List<CachableRenderStatement>>> cache = new WeakHashMap<CollidableComponent, Map<Fluid, List<CachableRenderStatement>>>();
private static final Map<CollidableComponent, Map<Fluid, List<CachableRenderStatement>>> cache = Collections
.synchronizedMap(new WeakHashMap<>());
public static List<CachableRenderStatement> computeFluidOutlineToCache(CollidableComponent component, Fluid fluid,
double scaleFactor, float outlineWidth) {
Map<Fluid, List<CachableRenderStatement>> cache0 = cache.get(component);
if (cache0 == null) {
cache0 = new HashMap<Fluid, List<CachableRenderStatement>>();
cache.put(component, cache0);
}
// Only init once per component across all threads so the cache stays accurate.
Map<Fluid, List<CachableRenderStatement>> cache0 = cache
.computeIfAbsent(component, _k -> new ConcurrentHashMap<>());
// The rest of this function 'should' be in a `computeIfAbsent` as well for:
// `cache0.computeIfAbsent(fluid, _k -> ...)` but that won't cause a bug in this case,
// just a bit more garbage.
List<CachableRenderStatement> data = cache0.get(fluid);
if (data != null) {
return data;
}
data = new ArrayList<CachableRenderStatement>();
cache0.put(fluid, data);
data = new ArrayList<>();
IIcon texture = fluid.getStillIcon();
if (texture == null) {
texture = fluid.getIcon();
if (texture == null) {
cache0.put(fluid, data);
return data;
}
}
@@ -200,6 +195,7 @@ public class LiquidConduitRenderer extends DefaultConduitRenderer implements IRe
}
}
}
cache0.put(fluid, data);
return data;
}
@@ -304,7 +300,7 @@ public class LiquidConduitRenderer extends DefaultConduitRenderer implements IRe
float transY = (bound.sizeY() - sizeY) / 2;
Vector3d translation = new Vector3d(0, transY, 0);
setupVertices(bound.translate(translation));
CubeRenderer.get().setupVertices(bound.translate(translation));
}
private void calculateRatios(LiquidConduit conduit) {
@@ -33,10 +33,17 @@ import crazypants.enderio.conduit.IConduitBundle;
import crazypants.enderio.conduit.RaytraceResult;
import crazypants.enderio.conduit.TileConduitBundle;
import crazypants.enderio.conduit.geom.CollidableComponent;
import crazypants.enderio.conduit.render.ConduitRenderer;
import crazypants.enderio.conduit.render.DefaultConduitRenderer;
import crazypants.enderio.tool.ToolUtil;
public class MEConduit extends AbstractConduit implements IMEConduit {
@Override
public ConduitRenderer getRenderer() {
return DefaultConduitRenderer.instance.get();
}
protected MEConduitNetwork network;
protected MEConduitGrid grid;
@@ -7,6 +7,7 @@ import com.enderio.core.common.util.DyeColor;
import cpw.mods.fml.common.Optional.Interface;
import cpw.mods.fml.common.Optional.InterfaceList;
import crazypants.enderio.conduit.IConduit;
import crazypants.enderio.conduit.render.ConduitRenderer;
import li.cil.oc.api.network.Environment;
import li.cil.oc.api.network.SidedEnvironment;
@@ -14,11 +15,16 @@ import li.cil.oc.api.network.SidedEnvironment;
@Interface(iface = "li.cil.oc.api.network.SidedEnvironment", modid = "OpenComputersAPI|Network") })
public interface IOCConduit extends IConduit, Environment, SidedEnvironment {
public static final String COLOR_CONTROLLER_ID = "ColorController";
String COLOR_CONTROLLER_ID = "ColorController";
@Override
default ConduitRenderer getRenderer() {
return OCConduitRenderer.instance.get();
}
void invalidate();
public abstract void setSignalColor(ForgeDirection dir, DyeColor col);
void setSignalColor(ForgeDirection dir, DyeColor col);
public abstract DyeColor getSignalColor(ForgeDirection dir);
DyeColor getSignalColor(ForgeDirection dir);
}
@@ -7,14 +7,12 @@ import com.enderio.core.client.render.CubeRenderer;
import crazypants.enderio.conduit.IConduit;
import crazypants.enderio.conduit.geom.CollidableComponent;
import crazypants.enderio.conduit.render.ConduitRenderer;
import crazypants.enderio.conduit.render.DefaultConduitRenderer;
public class OCConduitRenderer extends DefaultConduitRenderer {
@Override
public boolean isRendererForConduit(IConduit conduit) {
return conduit instanceof IOCConduit;
}
public static final ThreadLocal<ConduitRenderer> instance = ThreadLocal.withInitial(OCConduitRenderer::new);
@Override
protected void renderConduit(IIcon tex, IConduit conduit, CollidableComponent component, float selfIllum) {
@@ -23,7 +21,7 @@ public class OCConduitRenderer extends DefaultConduitRenderer {
int c = ((IOCConduit) conduit).getSignalColor(component.dir).getColor();
Tessellator tessellator = Tessellator.instance;
tessellator.setColorOpaque_I(c);
CubeRenderer.render(component.bound, tex);
CubeRenderer.get().render(component.bound, tex);
tessellator.setColorOpaque(255, 255, 255);
}
} else {
@@ -5,19 +5,25 @@ import net.minecraftforge.common.util.ForgeDirection;
import crazypants.enderio.conduit.IConduit;
import crazypants.enderio.conduit.IExtractor;
import crazypants.enderio.conduit.render.ConduitRenderer;
import crazypants.enderio.power.ICapacitor;
import crazypants.enderio.power.IInternalPowerHandler;
import crazypants.enderio.power.IPowerInterface;
public interface IPowerConduit extends IConduit, IInternalPowerHandler, IExtractor {
public static final String ICON_KEY = "enderio:powerConduit";
public static final String ICON_KEY_INPUT = "enderio:powerConduitInput";
public static final String ICON_KEY_OUTPUT = "enderio:powerConduitOutput";
public static final String ICON_CORE_KEY = "enderio:powerConduitCore";
public static final String ICON_TRANSMISSION_KEY = "enderio:powerConduitTransmission";
String ICON_KEY = "enderio:powerConduit";
String ICON_KEY_INPUT = "enderio:powerConduitInput";
String ICON_KEY_OUTPUT = "enderio:powerConduitOutput";
String ICON_CORE_KEY = "enderio:powerConduitCore";
String ICON_TRANSMISSION_KEY = "enderio:powerConduitTransmission";
public static final String COLOR_CONTROLLER_ID = "ColorController";
String COLOR_CONTROLLER_ID = "ColorController";
@Override
default ConduitRenderer getRenderer() {
return PowerConduitRenderer.instance.get();
}
IPowerInterface getExternalPowerReceptor(ForgeDirection direction);
@@ -17,15 +17,13 @@ import crazypants.enderio.conduit.geom.CollidableComponent;
import crazypants.enderio.conduit.geom.ConnectionModeGeometry;
import crazypants.enderio.conduit.geom.Offset;
import crazypants.enderio.conduit.render.ConduitBundleRenderer;
import crazypants.enderio.conduit.render.ConduitRenderer;
import crazypants.enderio.conduit.render.DefaultConduitRenderer;
import crazypants.enderio.machine.RedstoneControlMode;
public class PowerConduitRenderer extends DefaultConduitRenderer {
@Override
public boolean isRendererForConduit(IConduit conduit) {
return conduit instanceof IPowerConduit;
}
public static final ThreadLocal<ConduitRenderer> instance = ThreadLocal.withInitial(PowerConduitRenderer::new);
@Override
public void renderEntity(ConduitBundleRenderer conduitBundleRenderer, IConduitBundle te, IConduit conduit, double x,
@@ -68,7 +66,7 @@ public class PowerConduitRenderer extends DefaultConduitRenderer {
Vector3d trans = ForgeDirectionOffsets.offsetScaled(component.dir, -0.075);
bound = bound.translate(trans);
}
CubeRenderer.render(bound, tex);
CubeRenderer.get().render(bound, tex);
tessellator.setColorOpaque(255, 255, 255);
}
} else {
@@ -5,14 +5,20 @@ import net.minecraftforge.common.util.ForgeDirection;
import com.enderio.core.common.util.DyeColor;
import crazypants.enderio.conduit.ConnectionMode;
import crazypants.enderio.conduit.render.ConduitRenderer;
public interface IInsulatedRedstoneConduit extends IRedstoneConduit {
static final String KEY_INS_CONDUIT_ICON = "enderio:redstoneInsulatedConduit";
static final String KEY_INS_CORE_OFF_ICON = "enderio:redstoneInsulatedConduitCoreOff";
static final String KEY_INS_CORE_ON_ICON = "enderio:redstoneInsulatedConduitCoreOn";
String KEY_INS_CONDUIT_ICON = "enderio:redstoneInsulatedConduit";
String KEY_INS_CORE_OFF_ICON = "enderio:redstoneInsulatedConduitCoreOff";
String KEY_INS_CORE_ON_ICON = "enderio:redstoneInsulatedConduitCoreOn";
public static final String COLOR_CONTROLLER_ID = "ColorController";
String COLOR_CONTROLLER_ID = "ColorController";
@Override
default ConduitRenderer getRenderer() {
return InsulatedRedstoneConduitRenderer.instance.get();
}
void onInputsChanged(ForgeDirection side, int[] inputValues);
@@ -7,14 +7,13 @@ import com.enderio.core.client.render.CubeRenderer;
import crazypants.enderio.conduit.IConduit;
import crazypants.enderio.conduit.geom.CollidableComponent;
import crazypants.enderio.conduit.render.ConduitRenderer;
import crazypants.enderio.conduit.render.DefaultConduitRenderer;
public class InsulatedRedstoneConduitRenderer extends DefaultConduitRenderer {
@Override
public boolean isRendererForConduit(IConduit conduit) {
return conduit instanceof IInsulatedRedstoneConduit;
}
public static final ThreadLocal<ConduitRenderer> instance = ThreadLocal
.withInitial(InsulatedRedstoneConduitRenderer::new);
@Override
protected void renderConduit(IIcon tex, IConduit conduit, CollidableComponent component, float selfIllum) {
@@ -24,7 +23,7 @@ public class InsulatedRedstoneConduitRenderer extends DefaultConduitRenderer {
int c = ((IInsulatedRedstoneConduit) conduit).getSignalColor(component.dir).getColor();
Tessellator tessellator = Tessellator.instance;
tessellator.setColorOpaque_I(c);
CubeRenderer.render(component.bound, tex);
CubeRenderer.get().render(component.bound, tex);
tessellator.setColorOpaque(255, 255, 255);
}
} else {
@@ -33,12 +33,19 @@ import crazypants.enderio.conduit.AbstractConduitNetwork;
import crazypants.enderio.conduit.ConduitUtil;
import crazypants.enderio.conduit.IConduit;
import crazypants.enderio.conduit.geom.CollidableComponent;
import crazypants.enderio.conduit.render.ConduitRenderer;
import crazypants.enderio.conduit.render.DefaultConduitRenderer;
import dan200.computercraft.api.ComputerCraftAPI;
import powercrystals.minefactoryreloaded.api.rednet.IRedNetOutputNode;
public class RedstoneConduit extends AbstractConduit implements IRedstoneConduit {
static final Map<String, IIcon> ICONS = new HashMap<String, IIcon>();
static final Map<String, IIcon> ICONS = new HashMap<>();
@Override
public ConduitRenderer getRenderer() {
return DefaultConduitRenderer.instance.get();
}
@SideOnly(Side.CLIENT)
public static void initIcons() {
@@ -24,6 +24,7 @@ import crazypants.enderio.conduit.RaytraceResult;
import crazypants.enderio.conduit.geom.CollidableComponent;
import crazypants.enderio.conduit.geom.ConduitGeometryUtil;
import crazypants.enderio.conduit.geom.Offset;
import crazypants.enderio.conduit.render.ConduitRenderer;
public class RedstoneSwitch extends RedstoneConduit {
@@ -33,6 +34,11 @@ public class RedstoneSwitch extends RedstoneConduit {
private boolean isOn;
@Override
public ConduitRenderer getRenderer() {
return RedstoneSwitchRenderer.instance.get();
}
@SideOnly(Side.CLIENT)
public static void initIcons() {
IconUtil.addIconProvider(new IconUtil.IIconProvider() {
@@ -97,7 +103,7 @@ public class RedstoneSwitch extends RedstoneConduit {
Vector3d trans = ConduitGeometryUtil.instance.getTranslation(ForgeDirection.UNKNOWN, o);
List<CollidableComponent> result = super.getCollidableComponents();
BoundingBox[] aabb = RedstoneSwitchBounds.getInstance().getAABB();
BoundingBox[] aabb = RedstoneSwitchBounds.get().getAABB();
for (BoundingBox bb : aabb) {
result.add(
@@ -9,13 +9,11 @@ import crazypants.enderio.config.Config;
public class RedstoneSwitchBounds {
private static RedstoneSwitchBounds instance;
private static final ThreadLocal<RedstoneSwitchBounds> instance = ThreadLocal
.withInitial(RedstoneSwitchBounds::new);
public static final RedstoneSwitchBounds getInstance() {
if (instance == null) {
instance = new RedstoneSwitchBounds();
}
return instance;
public static RedstoneSwitchBounds get() {
return RedstoneSwitchBounds.instance.get();
}
final VertexTransform[] xForms;
@@ -17,29 +17,21 @@ import crazypants.enderio.conduit.geom.CollidableComponent;
import crazypants.enderio.conduit.geom.ConduitConnectorType;
import crazypants.enderio.conduit.geom.ConduitGeometryUtil;
import crazypants.enderio.conduit.render.ConduitBundleRenderer;
import crazypants.enderio.conduit.render.ConduitRenderer;
import crazypants.enderio.conduit.render.DefaultConduitRenderer;
public class RedstoneSwitchRenderer extends DefaultConduitRenderer {
private static final RedstoneSwitchRenderer instance = new RedstoneSwitchRenderer();
public static RedstoneSwitchRenderer getInstance() {
return instance;
}
public static final ThreadLocal<ConduitRenderer> instance = ThreadLocal.withInitial(RedstoneSwitchRenderer::new);
private final VertexTransform[] xForms;
private final BoundingBox switchBounds;
private final BoundingBox connectorBounds;
private RedstoneSwitchRenderer() {
xForms = RedstoneSwitchBounds.getInstance().xForms;
switchBounds = RedstoneSwitchBounds.getInstance().switchBounds;
connectorBounds = RedstoneSwitchBounds.getInstance().connectorBounds;
}
@Override
public boolean isRendererForConduit(IConduit conduit) {
return conduit.getClass() == RedstoneSwitch.class;
public RedstoneSwitchRenderer() {
xForms = RedstoneSwitchBounds.get().xForms;
switchBounds = RedstoneSwitchBounds.get().switchBounds;
connectorBounds = RedstoneSwitchBounds.get().connectorBounds;
}
@Override
@@ -49,13 +41,15 @@ public class RedstoneSwitchRenderer extends DefaultConduitRenderer {
super.renderEntity(conduitBundleRenderer, bundle, conduit, x, y, z, partialTick, worldLight, rb);
RedstoneSwitch sw = (RedstoneSwitch) conduit;
int i;
Tessellator tessellator = Tessellator.instance;
final Tessellator tessellator = Tessellator.instance;
final CubeRenderer cr = CubeRenderer.get();
float selfIllum = Math.max(worldLight, conduit.getSelfIlluminationForState(null));
tessellator.setColorOpaque_F(selfIllum, selfIllum, selfIllum);
IIcon[] icons = new IIcon[6];
for (int i = 0; i < icons.length; i++) {
for (i = 0; i < icons.length; i++) {
icons[i] = EnderIO.blockConduitBundle.getConnectorIcon(ConduitConnectorType.INTERNAL);
}
icons[3] = sw.getSwitchIcon();
@@ -65,12 +59,12 @@ public class RedstoneSwitchRenderer extends DefaultConduitRenderer {
bundle.getOffset(IRedstoneConduit.class, ForgeDirection.UNKNOWN));
BoundingBox bb = switchBounds.translate(trans);
for (VertexTransform tf : xForms) {
CubeRenderer.render(bb, icons, tf, null);
for (i = 0; i < xForms.length; i++) {
cr.render(bb, icons, xForms[i], null);
}
bb = connectorBounds.translate(trans);
for (VertexTransform tf : xForms) {
CubeRenderer.render(bb, icons[0], tf);
for (i = 0; i < xForms.length; i++) {
cr.render(bb, icons[0], xForms[i]);
}
}
@@ -29,6 +29,7 @@ import com.enderio.core.client.render.RenderUtil;
import com.enderio.core.common.util.BlockCoord;
import com.enderio.core.common.util.IBlockAccessWrapper;
import com.google.common.collect.Lists;
import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.relauncher.Side;
@@ -51,22 +52,27 @@ import crazypants.enderio.config.Config;
import crazypants.util.RenderPassHelper;
@SideOnly(Side.CLIENT)
@ThreadSafeISBRH(perThread = false)
public class ConduitBundleRenderer extends TileEntitySpecialRenderer implements ISimpleBlockRenderingHandler {
public ConduitBundleRenderer(float conduitScale) {}
public ConduitBundleRenderer() {}
@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float partialTick) {
IConduitBundle bundle = (IConduitBundle) te;
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
if (bundle.hasFacade() && bundle.getFacadeId().isOpaqueCube() && !ConduitUtil.isFacadeHidden(bundle, player)) {
if (bundle == null || (bundle.hasFacade() && bundle.getFacadeId().isOpaqueCube()
&& !ConduitUtil.isFacadeHidden(bundle, player))) {
return;
}
final Tessellator tessellator = Tessellator.instance;
float brightness = -1;
for (IConduit con : bundle.getConduits()) {
if (ConduitUtil.renderConduit(player, con)) {
ConduitRenderer renderer = EnderIO.proxy.getRendererForConduit(con);
final ConduitRenderer renderer = con.getRenderer();
if (renderer.isDynamic()) {
if (brightness == -1) {
BlockCoord loc = bundle.getLocation();
@@ -84,7 +90,7 @@ public class ConduitBundleRenderer extends TileEntitySpecialRenderer implements
GL11.glPushMatrix();
GL11.glTranslated(x, y, z);
Tessellator.instance.startDrawingQuads();
tessellator.startDrawingQuads();
}
renderer.renderDynamicEntity(this, bundle, con, x, y, z, partialTick, brightness);
}
@@ -92,7 +98,7 @@ public class ConduitBundleRenderer extends TileEntitySpecialRenderer implements
}
if (brightness != -1) {
Tessellator.instance.draw();
tessellator.draw();
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glPopMatrix();
@@ -104,6 +110,7 @@ public class ConduitBundleRenderer extends TileEntitySpecialRenderer implements
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId,
RenderBlocks rb) {
final Tessellator tessellator = Tessellator.instance;
int pass = RenderPassHelper.getBlockRenderPass();
if (pass == 1) {
// If the MC renderer is told that an alpha pass is required ( see
@@ -113,10 +120,10 @@ public class ConduitBundleRenderer extends TileEntitySpecialRenderer implements
// around is to ensure we always render something in this pass. Throwing
// in a polygon with a 0 area does the job
// See: https://github.com/MinecraftForge/MinecraftForge/issues/981
Tessellator.instance.addVertexWithUV(x, y, z, 0, 0);
Tessellator.instance.addVertexWithUV(x, y, z, 0, 0);
Tessellator.instance.addVertexWithUV(x, y, z, 0, 0);
Tessellator.instance.addVertexWithUV(x, y, z, 0, 0);
tessellator.addVertexWithUV(x, y, z, 0, 0);
tessellator.addVertexWithUV(x, y, z, 0, 0);
tessellator.addVertexWithUV(x, y, z, 0, 0);
tessellator.addVertexWithUV(x, y, z, 0, 0);
}
IConduitBundle bundle = (IConduitBundle) world.getTileEntity(x, y, z);
@@ -125,7 +132,7 @@ public class ConduitBundleRenderer extends TileEntitySpecialRenderer implements
boolean renderedFacade = renderFacade(x, y, z, pass, rb, bundle, player);
boolean renderConduit = !renderedFacade || ConduitUtil.isFacadeHidden(bundle, player);
if (renderConduit && (pass == 0 || rb.overrideBlockTexture != null)) {
if (bundle != null && renderConduit && (pass == 0 || rb.overrideBlockTexture != null)) {
BlockCoord loc = bundle.getLocation();
float brightness;
if (!Config.updateLightingWhenHidingFacades && bundle.hasFacade()
@@ -138,21 +145,34 @@ public class ConduitBundleRenderer extends TileEntitySpecialRenderer implements
return true;
}
return renderedFacade || (bundle.hasFacade() && !bundle.getFacadeId().isOpaqueCube());
return renderedFacade || (bundle != null && bundle.hasFacade() && !bundle.getFacadeId().isOpaqueCube());
}
private static final ThreadLocal<BlockConduitFacade> facade = ThreadLocal.withInitial(() -> {
try {
return EnderIO.blockConduitFacade.clone();
} catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
}
});
private boolean renderFacade(int x, int y, int z, int pass, RenderBlocks rb, IConduitBundle bundle,
EntityClientPlayerMP player) {
boolean res = false;
if (bundle == null) {
return false;
}
final Tessellator tessellator = Tessellator.instance;
if (bundle.hasFacade()) {
res = true;
Block facadeId = bundle.getFacadeId();
if (ConduitUtil.isFacadeHidden(bundle, player)) {
Tessellator.instance.setColorOpaque_F(1, 1, 1);
tessellator.setColorOpaque_F(1, 1, 1);
bundle.setFacadeId(null, false);
bundle.setFacadeRenderAs(FacadeRenderState.WIRE_FRAME);
BlockConduitFacade facb = EnderIO.blockConduitFacade;
BlockConduitFacade facb = facade.get();
facb.setBlockOverride(bundle);
facb.setBlockBounds(0, 0, 0, 1, 1, 1);
if (!rb.hasOverrideBlockTexture()) {
@@ -192,20 +212,23 @@ public class ConduitBundleRenderer extends TileEntitySpecialRenderer implements
public void renderConduits(IConduitBundle bundle, double x, double y, double z, float partialTick, float brightness,
RenderBlocks rb) {
Tessellator tessellator = Tessellator.instance;
if (bundle == null) return;
final Tessellator tessellator = Tessellator.instance;
final CubeRenderer cr = CubeRenderer.get();
tessellator.setColorOpaque_F(1, 1, 1);
tessellator.addTranslation((float) x, (float) y, (float) z);
// Conduits
Set<ForgeDirection> externals = new HashSet<ForgeDirection>();
Set<ForgeDirection> externals = new HashSet<>();
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
List<BoundingBox> wireBounds = new ArrayList<BoundingBox>();
List<BoundingBox> wireBounds = new ArrayList<>();
for (IConduit con : bundle.getConduits()) {
if (ConduitUtil.renderConduit(player, con)) {
ConduitRenderer renderer = EnderIO.proxy.getRendererForConduit(con);
final ConduitRenderer renderer = con.getRenderer();
renderer.renderEntity(this, bundle, con, x, y, z, partialTick, brightness, rb);
Set<ForgeDirection> extCons = con.getExternalConnections();
for (ForgeDirection dir : extCons) {
@@ -225,7 +248,8 @@ public class ConduitBundleRenderer extends TileEntitySpecialRenderer implements
// Internal conectors between conduits
List<CollidableComponent> connectors = bundle.getConnectors();
List<CollidableComponent> rendered = Lists.newArrayList();
for (CollidableComponent component : connectors) {
for (int i = 0; i < connectors.size(); i++) {
final CollidableComponent component = connectors.get(i);
if (component.conduitType != null) {
IConduit conduit = bundle.getConduit(component.conduitType);
if (conduit != null) {
@@ -243,12 +267,12 @@ public class ConduitBundleRenderer extends TileEntitySpecialRenderer implements
if (r.component.conduitType == component.conduitType
&& !rendered.contains(r.component)) {
rendered.add(r.component);
CubeRenderer.render(component.bound, rb.overrideBlockTexture, true);
cr.render(component.bound, rb.overrideBlockTexture, true);
}
}
} else {
tessellator.setBrightness((int) (brightness));
CubeRenderer.render(component.bound, conduit.getTextureForState(component), true);
cr.render(component.bound, conduit.getTextureForState(component), true);
}
} else {
wireBounds.add(component.bound);
@@ -257,16 +281,18 @@ public class ConduitBundleRenderer extends TileEntitySpecialRenderer implements
} else if (ConduitUtil.getDisplayMode(player) == ConduitDisplayMode.ALL && !rb.hasOverrideBlockTexture()) {
IIcon tex = EnderIO.blockConduitBundle.getConnectorIcon(component.data);
CubeRenderer.render(component.bound, tex);
cr.render(component.bound, tex);
}
}
// render these after the 'normal' conduits so help with proper blending
for (BoundingBox wireBound : wireBounds) {
Tessellator.instance.setColorRGBA_F(1, 1, 1, 0.25f);
CubeRenderer.render(wireBound, EnderIO.blockConduitFacade.getIcon(0, 0));
BlockConduitFacade facb = facade.get();
for (int i = 0; i < wireBounds.size(); i++) {
final BoundingBox wireBound = wireBounds.get(i);
tessellator.setColorRGBA_F(1, 1, 1, 0.25f);
cr.render(wireBound, facb.getIcon(0, 0));
}
Tessellator.instance.setColorRGBA_F(1, 1, 1, 1f);
tessellator.setColorRGBA_F(1, 1, 1, 1f);
// External connection terminations
if (rb.overrideBlockTexture == null) {
for (ForgeDirection dir : externals) {
@@ -279,8 +305,10 @@ public class ConduitBundleRenderer extends TileEntitySpecialRenderer implements
private void renderExternalConnection(ForgeDirection dir) {
IIcon tex = EnderIO.blockConduitBundle.getConnectorIcon(ConduitConnectorType.EXTERNAL);
BoundingBox[] bbs = ConduitGeometryUtil.instance.getExternalConnectorBoundingBoxes(dir);
for (BoundingBox bb : bbs) {
CubeRenderer.render(bb, tex, true);
final CubeRenderer cr = CubeRenderer.get();
for (int i = 0; i < bbs.length; i++) {
final BoundingBox bb = bbs[i];
cr.render(bb, tex, true);
}
}
@@ -7,8 +7,6 @@ import crazypants.enderio.conduit.IConduitBundle;
public interface ConduitRenderer {
boolean isRendererForConduit(IConduit conduit);
void renderEntity(ConduitBundleRenderer conduitBundleRenderer, IConduitBundle te, IConduit con, double x, double y,
double z, float partialTick, float worldLight, RenderBlocks rb);
@@ -1,7 +1,11 @@
package crazypants.enderio.conduit.render;
import static com.enderio.core.client.render.CubeRenderer.*;
import static net.minecraftforge.common.util.ForgeDirection.*;
import static net.minecraftforge.common.util.ForgeDirection.DOWN;
import static net.minecraftforge.common.util.ForgeDirection.EAST;
import static net.minecraftforge.common.util.ForgeDirection.NORTH;
import static net.minecraftforge.common.util.ForgeDirection.SOUTH;
import static net.minecraftforge.common.util.ForgeDirection.UP;
import static net.minecraftforge.common.util.ForgeDirection.WEST;
import java.util.Collection;
import java.util.List;
@@ -12,6 +16,7 @@ import net.minecraft.util.IIcon;
import net.minecraftforge.common.util.ForgeDirection;
import com.enderio.core.client.render.BoundingBox;
import com.enderio.core.client.render.CubeRenderer;
import com.enderio.core.client.render.RenderUtil;
import com.enderio.core.common.vecmath.Vertex;
@@ -23,12 +28,9 @@ import crazypants.enderio.conduit.geom.CollidableComponent;
public class DefaultConduitRenderer implements ConduitRenderer {
protected float transmissionScaleFactor;
public static final ThreadLocal<ConduitRenderer> instance = ThreadLocal.withInitial(DefaultConduitRenderer::new);
@Override
public boolean isRendererForConduit(IConduit conduit) {
return true;
}
protected float transmissionScaleFactor;
@Override
public void renderEntity(ConduitBundleRenderer conduitBundleRenderer, IConduitBundle te, IConduit conduit, double x,
@@ -66,6 +68,7 @@ public class DefaultConduitRenderer implements ConduitRenderer {
double x, double y, double z, float partialTick, float worldLight) {}
protected void renderConduit(IIcon tex, IConduit conduit, CollidableComponent component, float brightness) {
final CubeRenderer cr = CubeRenderer.get();
if (isNSEWUD(component.dir)) {
@@ -96,7 +99,7 @@ public class DefaultConduitRenderer implements ConduitRenderer {
tex.getMaxV());
Tessellator tessellator = Tessellator.instance;
for (Vertex c : corners) {
addVecWithUV(c.xyz, c.uv.x, c.uv.y);
cr.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
}
}
@@ -143,12 +146,13 @@ public class DefaultConduitRenderer implements ConduitRenderer {
protected void drawSection(BoundingBox bound, float minU, float maxU, float minV, float maxV, ForgeDirection dir,
boolean isTransmission, boolean mirrorTexture) {
Tessellator tessellator = Tessellator.instance;
final Tessellator tessellator = Tessellator.instance;
final CubeRenderer cr = CubeRenderer.get();
if (isTransmission) {
setVerticesForTransmission(bound, dir);
} else {
setupVertices(bound);
cr.setupVertices(bound);
}
if (mirrorTexture && (dir == NORTH || dir == UP || dir == EAST)) {
@@ -168,15 +172,15 @@ public class DefaultConduitRenderer implements ConduitRenderer {
tessellator.setColorOpaque_F(cm, cm, cm);
}
if (rotateSides) {
addVecWithUV(verts[1], maxU, maxV);
addVecWithUV(verts[0], maxU, minV);
addVecWithUV(verts[3], minU, minV);
addVecWithUV(verts[2], minU, maxV);
cr.addVecWithUV(cr.verts[1], maxU, maxV);
cr.addVecWithUV(cr.verts[0], maxU, minV);
cr.addVecWithUV(cr.verts[3], minU, minV);
cr.addVecWithUV(cr.verts[2], minU, maxV);
} else {
addVecWithUV(verts[1], minU, minV);
addVecWithUV(verts[0], maxU, minV);
addVecWithUV(verts[3], maxU, maxV);
addVecWithUV(verts[2], minU, maxV);
cr.addVecWithUV(cr.verts[1], minU, minV);
cr.addVecWithUV(cr.verts[0], maxU, minV);
cr.addVecWithUV(cr.verts[3], maxU, maxV);
cr.addVecWithUV(cr.verts[2], minU, maxV);
}
if (dir == WEST || dir == EAST) {
float tmp = minU;
@@ -189,15 +193,15 @@ public class DefaultConduitRenderer implements ConduitRenderer {
tessellator.setColorOpaque_F(cm, cm, cm);
}
if (rotateSides) {
addVecWithUV(verts[4], maxU, maxV);
addVecWithUV(verts[5], maxU, minV);
addVecWithUV(verts[6], minU, minV);
addVecWithUV(verts[7], minU, maxV);
cr.addVecWithUV(cr.verts[4], maxU, maxV);
cr.addVecWithUV(cr.verts[5], maxU, minV);
cr.addVecWithUV(cr.verts[6], minU, minV);
cr.addVecWithUV(cr.verts[7], minU, maxV);
} else {
addVecWithUV(verts[4], minU, minV);
addVecWithUV(verts[5], maxU, minV);
addVecWithUV(verts[6], maxU, maxV);
addVecWithUV(verts[7], minU, maxV);
cr.addVecWithUV(cr.verts[4], minU, minV);
cr.addVecWithUV(cr.verts[5], maxU, minV);
cr.addVecWithUV(cr.verts[6], maxU, maxV);
cr.addVecWithUV(cr.verts[7], minU, maxV);
}
if (dir == WEST || dir == EAST) {
float tmp = minU;
@@ -214,15 +218,15 @@ public class DefaultConduitRenderer implements ConduitRenderer {
tessellator.setColorOpaque_F(cm, cm, cm);
}
if (rotateTopBottom) {
addVecWithUV(verts[6], maxU, maxV);
addVecWithUV(verts[2], minU, maxV);
addVecWithUV(verts[3], minU, minV);
addVecWithUV(verts[7], maxU, minV);
cr.addVecWithUV(cr.verts[6], maxU, maxV);
cr.addVecWithUV(cr.verts[2], minU, maxV);
cr.addVecWithUV(cr.verts[3], minU, minV);
cr.addVecWithUV(cr.verts[7], maxU, minV);
} else {
addVecWithUV(verts[6], minU, minV);
addVecWithUV(verts[2], minU, maxV);
addVecWithUV(verts[3], maxU, maxV);
addVecWithUV(verts[7], maxU, minV);
cr.addVecWithUV(cr.verts[6], minU, minV);
cr.addVecWithUV(cr.verts[2], minU, maxV);
cr.addVecWithUV(cr.verts[3], maxU, maxV);
cr.addVecWithUV(cr.verts[7], maxU, minV);
}
tessellator.setNormal(0, -1, 0);
@@ -231,15 +235,15 @@ public class DefaultConduitRenderer implements ConduitRenderer {
tessellator.setColorOpaque_F(cm, cm, cm);
}
if (rotateTopBottom) {
addVecWithUV(verts[0], minU, minV);
addVecWithUV(verts[1], minU, maxV);
addVecWithUV(verts[5], maxU, maxV);
addVecWithUV(verts[4], maxU, minV);
cr.addVecWithUV(cr.verts[0], minU, minV);
cr.addVecWithUV(cr.verts[1], minU, maxV);
cr.addVecWithUV(cr.verts[5], maxU, maxV);
cr.addVecWithUV(cr.verts[4], maxU, minV);
} else {
addVecWithUV(verts[0], maxU, maxV);
addVecWithUV(verts[1], minU, maxV);
addVecWithUV(verts[5], minU, minV);
addVecWithUV(verts[4], maxU, minV);
cr.addVecWithUV(cr.verts[0], maxU, maxV);
cr.addVecWithUV(cr.verts[1], minU, maxV);
cr.addVecWithUV(cr.verts[5], minU, minV);
cr.addVecWithUV(cr.verts[4], maxU, minV);
}
}
@@ -251,15 +255,15 @@ public class DefaultConduitRenderer implements ConduitRenderer {
tessellator.setColorOpaque_F(cm, cm, cm);
}
if (rotateSides) {
addVecWithUV(verts[2], minU, maxV);
addVecWithUV(verts[6], minU, minV);
addVecWithUV(verts[5], maxU, minV);
addVecWithUV(verts[1], maxU, maxV);
cr.addVecWithUV(cr.verts[2], minU, maxV);
cr.addVecWithUV(cr.verts[6], minU, minV);
cr.addVecWithUV(cr.verts[5], maxU, minV);
cr.addVecWithUV(cr.verts[1], maxU, maxV);
} else {
addVecWithUV(verts[2], minU, maxV);
addVecWithUV(verts[6], maxU, maxV);
addVecWithUV(verts[5], maxU, minV);
addVecWithUV(verts[1], minU, minV);
cr.addVecWithUV(cr.verts[2], minU, maxV);
cr.addVecWithUV(cr.verts[6], maxU, maxV);
cr.addVecWithUV(cr.verts[5], maxU, minV);
cr.addVecWithUV(cr.verts[1], minU, minV);
}
tessellator.setNormal(-1, 0, 0);
@@ -268,15 +272,15 @@ public class DefaultConduitRenderer implements ConduitRenderer {
tessellator.setColorOpaque_F(cm, cm, cm);
}
if (rotateSides) {
addVecWithUV(verts[0], maxU, maxV);
addVecWithUV(verts[4], maxU, minV);
addVecWithUV(verts[7], minU, minV);
addVecWithUV(verts[3], minU, maxV);
cr.addVecWithUV(cr.verts[0], maxU, maxV);
cr.addVecWithUV(cr.verts[4], maxU, minV);
cr.addVecWithUV(cr.verts[7], minU, minV);
cr.addVecWithUV(cr.verts[3], minU, maxV);
} else {
addVecWithUV(verts[0], minU, minV);
addVecWithUV(verts[4], maxU, minV);
addVecWithUV(verts[7], maxU, maxV);
addVecWithUV(verts[3], minU, maxV);
cr.addVecWithUV(cr.verts[0], minU, minV);
cr.addVecWithUV(cr.verts[4], maxU, minV);
cr.addVecWithUV(cr.verts[7], maxU, maxV);
cr.addVecWithUV(cr.verts[3], minU, maxV);
}
}
tessellator.setColorOpaque_F(1, 1, 1);
@@ -286,7 +290,7 @@ public class DefaultConduitRenderer implements ConduitRenderer {
float xs = dir.offsetX == 0 ? transmissionScaleFactor : 1;
float ys = dir.offsetY == 0 ? transmissionScaleFactor : 1;
float zs = dir.offsetZ == 0 ? transmissionScaleFactor : 1;
setupVertices(bound.scale(xs, ys, zs));
CubeRenderer.get().setupVertices(bound.scale(xs, ys, zs));
}
// TODO: This is a really hacky, imprecise and slow way to do this
@@ -62,8 +62,9 @@ public class ItemConduitRenderer implements IItemRenderer {
}
private void renderToInventory(ItemStack item, RenderBlocks renderBlocks) {
Tessellator.instance.startDrawingQuads();
CubeRenderer.render(bb, item.getItem().getIconFromDamage(item.getItemDamage()));
Tessellator.instance.draw();
final Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
CubeRenderer.get().render(bb, item.getItem().getIconFromDamage(item.getItemDamage()));
tessellator.draw();
}
}
@@ -154,13 +154,17 @@ public final class Config {
public static int travelStaffBlinkPauseTicks = 10;
public static boolean travelStaffEnabled = true;
public static boolean travelStaffAllowInBaublesSlot = true;
public static boolean travelStaffKeybindEnabled = true;
public static boolean travelStaffBlinkEnabled = true;
public static boolean travelStaffBlinkThroughSolidBlocksEnabled = true;
public static boolean travelStaffBlinkThroughClearBlocksEnabled = true;
public static boolean travelStaffBlinkThroughUnbreakableBlocksEnabled = false;
public static String[] travelStaffBlinkBlackList = new String[] { "minecraft:bedrock", "Thaumcraft:blockWarded" };
public static String travelStaffBaublesType = "UNIVERSAL";
public static float travelAnchorZoomScale = 0.2f;
public static boolean travelStaffSearchOptimize = true;
public static boolean validateTravelEventServerside = true;
/** The max distance for travelling to a Travel Anchor. */
public static int teleportStaffMaxDistance = 2048;
@@ -171,6 +175,34 @@ public final class Config {
*/
public static int teleportStaffFailedBlinkDistance = 64;
/**
* Sets the teleport staff right-click action.
*
* <p>
* Values:
* <ul>
* <li><b>0:</b> Do nothing
* <li><b>1:</b> Teleport to look
* <li><b>2:</b> Teleport to anchor
* <li><b>3:</b> Teleport to anchor, or to look if no anchor <em>(default)</em>
* </ul>
*/
public static int teleportStaffAction = 3;
/**
* Sets the teleport staff sneak right-click action.
*
* <p>
* Values:
* <ul>
* <li><b>0:</b> Do nothing
* <li><b>1:</b> Teleport to look <em>(default)</em>
* <li><b>2:</b> Teleport to anchor
* <li><b>3:</b> Teleport to anchor, or to look if no anchor
* </ul>
*/
public static int teleportStaffSneakAction = 1;
public static int enderIoRange = 8;
public static boolean enderIoMeAccessEnabled = true;
@@ -357,6 +389,8 @@ public final class Config {
"TwilightForest:item.steeleafHoe", "TwilightForest:item.ironwoodHoe", "IC2:itemToolBronzeHoe" };
public static List<ItemStack> farmHoes = new ArrayList<ItemStack>();
public static int farmSaplingReserveAmount = 8;
public static double farmParticlesMaxRange = 64;
public static int farmParticlesCount = 15;
public static int magnetPowerUsePerSecondRF = 1;
public static int magnetPowerCapacityRF = 100000;
@@ -563,6 +597,8 @@ public final class Config {
public static float inventoryPanelExtractCostPerItem = 12.0f;
public static float inventoryPanelExtractCostPerOperation = 32.0f;
public static boolean strictTPItemChecking = true;
public static void load(FMLPreInitializationEvent event) {
PacketHandler.INSTANCE
.registerMessage(PacketConfigSync.class, PacketConfigSync.class, PacketHandler.nextID(), Side.CLIENT);
@@ -1163,6 +1199,19 @@ public final class Config {
"travelStaffEnabled",
travelAnchorEnabled,
"If set to false: the travel staff will not be craftable.").getBoolean(travelStaffEnabled);
travelStaffAllowInBaublesSlot = config
.get(
sectionStaff.name,
"travelStaffAllowInBaublesSlot",
travelStaffAllowInBaublesSlot,
"If true the travel staff can be put into Baubles slots (requires Baubles to be installed)")
.getBoolean(travelStaffAllowInBaublesSlot);
travelStaffKeybindEnabled = config.get(
sectionStaff.name,
"travelStaffKeybindEnabled",
travelStaffKeybindEnabled,
"If set to false: the Travel Staff Blink keybind will not be useable. (keybind allows when staff is anywhere in inventory, might not be wanted)")
.getBoolean(travelStaffKeybindEnabled);
travelStaffBlinkEnabled = config
.get(
sectionStaff.name,
@@ -1196,6 +1245,13 @@ public final class Config {
sectionStaff.name,
travelStaffBlinkBlackList,
"Lists the blocks that cannot be teleported through in the form 'modID:blockName'");
travelStaffBaublesType = config.get(
sectionStaff.name,
"travelStaffBaublesType",
travelStaffBaublesType,
"The BaublesType the Travel Staff should be, 'AMULET', 'RING', 'BELT', or 'UNIVERSAL' (requires Baubles to be installed and travelStaffAllowInBaublesSlot to be on)")
.getString();
travelAnchorZoomScale = config.getFloat(
"travelAnchorZoomScale",
sectionStaff.name,
@@ -1212,6 +1268,13 @@ public final class Config {
+ "This config is experimental, so if you encounter any strange behavior, please report to GTNH developer.")
.getBoolean(travelStaffSearchOptimize);
validateTravelEventServerside = config.get(
sectionStaff.name,
"validateTravelEventServerside",
validateTravelEventServerside,
"If set to true: Server will validate if player actually can teleport. False will allow hacking, but also allows Staff of Traveling Keybind mod to work.")
.getBoolean(validateTravelEventServerside);
teleportStaffMaxDistance = config
.get(
sectionStaff.name,
@@ -1236,6 +1299,27 @@ public final class Config {
"Number of blocks teleported when no block is being looked at.")
.getInt(teleportStaffFailedBlinkDistance);
teleportStaffAction = config.get(
sectionStaff.name,
"teleportStaffAction",
teleportStaffAction,
"Sets the action for right-click with the staff of teleportation. Values:\n" + " 0: Do nothing\n"
+ " 1: Teleport to look\n"
+ " 2: Teleport to anchor\n"
+ " 3: Teleport to anchor, or look if no anchor (default)")
.getInt(teleportStaffAction);
teleportStaffSneakAction = config.get(
sectionStaff.name,
"teleportStaffSneakAction",
teleportStaffSneakAction,
"Sets the action for sneak right-click with the staff of teleportation. Values:\n"
+ " 0: Do nothing\n"
+ " 1: Teleport to look (default)\n"
+ " 2: Teleport to anchor\n"
+ " 3: Teleport to anchor, or look if no anchor")
.getInt(teleportStaffSneakAction);
enderIoRange = config.get(
sectionEfficiency.name,
"enderIoRange",
@@ -2027,6 +2111,18 @@ public final class Config {
+ "always shear all leaves.")
.getInt(farmSaplingReserveAmount);
farmParticlesMaxRange = config.get(
sectionFarm.name,
"farmParticlesMaxRange",
farmParticlesMaxRange,
"The max range of the farm action particles.").getDouble(farmParticlesMaxRange);
farmParticlesCount = config.get(
sectionFarm.name,
"farmParticlesCount",
farmParticlesCount,
"The number of particles produces by farm action.").getInt(farmParticlesCount);
combustionGeneratorUseOpaqueModel = config
.get(
sectionAesthetic.name,
@@ -2081,7 +2177,7 @@ public final class Config {
sectionMagnet.name,
"magnetAllowDeactivatedInBaublesSlot",
magnetAllowDeactivatedInBaublesSlot,
"If true the magnet can be put into the 'amulet' Baubles slot even if switched off (requires Baubles to be installed and magnetAllowInBaublesSlot to be on)")
"If true the magnet can be put into a Baubles slot even if switched off (requires Baubles to be installed and magnetAllowInBaublesSlot to be on)")
.getBoolean(magnetAllowDeactivatedInBaublesSlot);
magnetAllowPowerExtraction = config.get(
@@ -2094,7 +2190,7 @@ public final class Config {
sectionMagnet.name,
"magnetBaublesType",
magnetBaublesType,
"The BaublesType the magnet should be, 'AMULET', 'RING' or 'BELT' (requires Baubles to be installed and magnetAllowInBaublesSlot to be on)")
"The BaublesType the magnet should be, 'AMULET', 'RING', 'BELT', or UNIVERSAL (requires Baubles to be installed and magnetAllowInBaublesSlot to be on)")
.getString();
useCombustionGenModel = config
@@ -2884,6 +2980,12 @@ public final class Config {
0.0f,
10000.0f,
"Internal power used per extract operation (independent of stack size)");
strictTPItemChecking = config.get(
sectionMisc.name,
"strictTPItemChecking",
strictTPItemChecking,
"If true, turn on strict checking of item energy checking. This might cause traveling tools from third party mods to fire fake security warnings on server side and not function correctly.")
.getBoolean(strictTPItemChecking);
}
public static void checkYetaAccess() {
@@ -27,6 +27,7 @@ public class PacketConfigSync implements IMessage, IMessageHandler<PacketConfigS
buf.writeInt(Config.teleportStaffFailedBlinkDistance);
buf.writeBoolean(Config.telepadLockCoords);
buf.writeBoolean(Config.telepadLockDimension);
buf.writeBoolean(Config.travelStaffKeybindEnabled);
}
@Override
@@ -46,6 +47,7 @@ public class PacketConfigSync implements IMessage, IMessageHandler<PacketConfigS
Config.teleportStaffFailedBlinkDistance = data.readInt();
Config.telepadLockCoords = data.readBoolean();
Config.telepadLockDimension = data.readBoolean();
Config.travelStaffKeybindEnabled = data.readBoolean();
}
@Override
@@ -55,7 +55,7 @@ public class EnderIoRenderer extends TileEntitySpecialRenderer implements IItemR
}
public void render(double x, double y, double z, Matrix4d lookMat, int brightness) {
final Tessellator tessellator = Tessellator.instance;
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
@@ -111,8 +111,8 @@ public class EnderIoRenderer extends TileEntitySpecialRenderer implements IItemR
GL11.glTranslated(x, y, z);
RenderUtil.bindBlockTexture();
Tessellator.instance.startDrawingQuads();
Tessellator.instance.setBrightness(brightness);
tessellator.startDrawingQuads();
tessellator.setBrightness(brightness);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
@@ -120,8 +120,8 @@ public class EnderIoRenderer extends TileEntitySpecialRenderer implements IItemR
GL11.glEnable(GL11.GL_POLYGON_OFFSET_FILL);
GL11.glPolygonOffset(-1.0f, -1.0f);
CubeRenderer.render(BoundingBox.UNIT_CUBE, EnderIO.blockEnderIo.frameIcon);
Tessellator.instance.draw();
CubeRenderer.get().render(BoundingBox.UNIT_CUBE, EnderIO.blockEnderIo.frameIcon);
tessellator.draw();
GL11.glPopMatrix();
GL11.glDisable(GL11.GL_POLYGON_OFFSET_FILL);
@@ -206,6 +206,7 @@ public class ItemMagnet extends ItemEnergyContainer implements IResourceTooltipP
}
@Override
@Method(modid = "Baubles|API")
public void onWornTick(ItemStack itemstack, EntityLivingBase player) {
if (player instanceof EntityPlayer && isActive(itemstack)
&& hasPower(itemstack)
@@ -222,17 +223,21 @@ public class ItemMagnet extends ItemEnergyContainer implements IResourceTooltipP
}
@Override
@Method(modid = "Baubles|API")
public void onEquipped(ItemStack itemstack, EntityLivingBase player) {}
@Override
@Method(modid = "Baubles|API")
public void onUnequipped(ItemStack itemstack, EntityLivingBase player) {}
@Override
@Method(modid = "Baubles|API")
public boolean canEquip(ItemStack itemstack, EntityLivingBase player) {
return Config.magnetAllowInBaublesSlot && (Config.magnetAllowDeactivatedInBaublesSlot || isActive(itemstack));
}
@Override
@Method(modid = "Baubles|API")
public boolean canUnequip(ItemStack itemstack, EntityLivingBase player) {
return true;
}
@@ -1,8 +1,13 @@
package crazypants.enderio.item;
import static crazypants.enderio.material.Alloy.*;
import static crazypants.enderio.material.Alloy.CONDUCTIVE_IRON;
import static crazypants.enderio.material.Alloy.DARK_STEEL;
import static crazypants.enderio.material.Alloy.ELECTRICAL_STEEL;
import static crazypants.enderio.material.Alloy.END_STEEL;
import static crazypants.enderio.material.Alloy.ENERGETIC_ALLOY;
import static crazypants.enderio.material.Alloy.SOULARIUM;
import static crazypants.enderio.material.Material.VIBRANT_CYSTAL;
import static crazypants.enderio.material.endergy.AlloyEndergy.*;
import static crazypants.enderio.material.endergy.AlloyEndergy.STELLAR_ALLOY;
import static crazypants.util.RecipeUtil.addShaped;
import net.minecraft.init.Blocks;
@@ -8,6 +8,7 @@ import net.minecraft.client.settings.KeyBinding;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ChatComponentTranslation;
import org.lwjgl.input.Keyboard;
@@ -17,6 +18,7 @@ import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.InputEvent.KeyInputEvent;
import crazypants.enderio.EnderIO;
import crazypants.enderio.api.teleport.IItemOfTravel;
import crazypants.enderio.api.tool.IConduitControl;
import crazypants.enderio.conduit.ConduitDisplayMode;
import crazypants.enderio.config.Config;
@@ -30,6 +32,7 @@ import crazypants.enderio.item.darksteel.upgrade.JumpUpgrade;
import crazypants.enderio.item.darksteel.upgrade.SoundDetectorUpgrade;
import crazypants.enderio.item.darksteel.upgrade.SpeedUpgrade;
import crazypants.enderio.network.PacketHandler;
import crazypants.enderio.teleport.TravelController;
import crazypants.enderio.thaumcraft.GogglesOfRevealingUpgrade;
import crazypants.util.BaublesUtil;
@@ -55,6 +58,10 @@ public class KeyTracker {
private final KeyBinding magnetKey;
private final KeyBinding staffOfTravelingTPKey;
private static long lastBlinkTick = -1;
public KeyTracker() {
glideKey = new KeyBinding(
EnderIO.lang.localize("keybind.glidertoggle"),
@@ -106,6 +113,12 @@ public class KeyTracker {
Keyboard.KEY_NONE,
EnderIO.lang.localize("category.tools"));
ClientRegistry.registerKeyBinding(magnetKey);
staffOfTravelingTPKey = new KeyBinding(
EnderIO.lang.localize("keybind.staffoftravelingtp"),
Keyboard.KEY_NONE,
EnderIO.lang.localize("category.tools"));
ClientRegistry.registerKeyBinding(staffOfTravelingTPKey);
}
@SubscribeEvent
@@ -119,6 +132,7 @@ public class KeyTracker {
handleSpeed();
handleJump();
handleMagnet();
handleStaffOfTravelingTP();
}
private void sendEnabledChatMessage(String messageBase, boolean isActive) {
@@ -133,6 +147,38 @@ public class KeyTracker {
PacketHandler.INSTANCE.sendToServer(new PacketUpgradeState(type, isActive));
}
private void handleStaffOfTravelingTP() {
if (staffOfTravelingTPKey.isPressed()) {
if (Config.travelStaffKeybindEnabled) {
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
if (player != null) {
ItemStack travelItem = player.getHeldItem();
if (travelItem == null || travelItem.getItem() == null
|| !(travelItem.getItem() instanceof IItemOfTravel)
|| !((IItemOfTravel) travelItem.getItem()).isActive(player, travelItem)) {
travelItem = TravelController.instance.findTravelItemInInventoryOrBaubles(player);
}
if (travelItem != null && travelItem.getItem() != null) {
long ticksSinceBlink = EnderIO.proxy.getTickCount() - lastBlinkTick;
if (ticksSinceBlink < 0) {
lastBlinkTick = -1;
}
if (ticksSinceBlink >= Config.travelStaffBlinkPauseTicks) {
if (TravelController.instance.doBlink(travelItem, player)) {
lastBlinkTick = EnderIO.proxy.getTickCount();
}
}
}
}
} else {
TravelController.showMessage(
Minecraft.getMinecraft().thePlayer,
new ChatComponentTranslation("enderio.travelStaffKeybind.isDisabled"));
}
}
}
private void handleMagnet() {
if (magnetKey.isPressed()) {
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
@@ -331,6 +331,11 @@ public class ItemDarkSteelPickaxe extends ItemPickaxe
extractEnergy(equipped, power, false);
}
@Override
public int canExtractInternal(ItemStack equipped, int power) {
return Math.min(getEnergyStored(equipped), power);
}
private boolean isTravelUpgradeActive(EntityPlayer ep, ItemStack equipped) {
return isEquipped(ep) && ep.isSneaking() && TravelUpgrade.loadFromItem(equipped) != null;
}
@@ -386,7 +386,15 @@ public class ItemDarkSteelSword extends ItemSword
@Override
public boolean isActive(EntityPlayer ep, ItemStack equipped) {
return isTravelUpgradeActive(ep, equipped);
if (ep != null && equipped != null && isTravelUpgradeActive(ep, equipped)) {
// Only "active" if held while sneaking. But still "active" for the purposes of travel keybind if not held
if (isEquipped(ep)) {
return ep.isSneaking();
} else {
return true;
}
}
return false;
}
@Override
@@ -394,13 +402,18 @@ public class ItemDarkSteelSword extends ItemSword
extractEnergy(equipped, power, false);
}
@Override
public int canExtractInternal(ItemStack equipped, int power) {
return Math.min(getEnergyStored(equipped), power);
}
private boolean isTravelUpgradeActive(EntityPlayer ep, ItemStack equipped) {
return isEquipped(ep) && ep.isSneaking() && TravelUpgrade.loadFromItem(equipped) != null;
return ep != null && equipped != null && TravelUpgrade.loadFromItem(equipped) != null;
}
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
if (isTravelUpgradeActive(player, stack)) {
if (isActive(player, stack)) {
if (world.isRemote) {
if (TravelController.instance.activateTravelAccessable(stack, world, player, TravelSource.STAFF)) {
player.swingItem();
@@ -17,10 +17,12 @@ import com.enderio.core.client.render.CubeRenderer;
import com.enderio.core.client.render.RenderUtil;
import com.enderio.core.client.render.VertexRotation;
import com.enderio.core.common.vecmath.Vector3d;
import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import crazypants.enderio.EnderIO;
@ThreadSafeISBRH(perThread = false)
public class EndermanSkullRenderer implements ISimpleBlockRenderingHandler, IItemRenderer {
public EndermanSkullRenderer() {}
@@ -75,9 +77,9 @@ public class EndermanSkullRenderer implements ISimpleBlockRenderingHandler, IIte
float height = 0.5f;
BoundingBox bb = new BoundingBox(size, 0, size, 1 - size, height, 1 - size);
if (renderer.hasOverrideBlockTexture()) {
CubeRenderer.render(bb, renderer.overrideBlockTexture, rot);
CubeRenderer.get().render(bb, renderer.overrideBlockTexture, rot);
} else {
CubeRenderer.render(bb, icons, rot, true);
CubeRenderer.get().render(bb, icons, rot, true);
if (meta > 1) {
renderBolts(rot, size);
@@ -94,27 +96,28 @@ public class EndermanSkullRenderer implements ISimpleBlockRenderingHandler, IIte
float boltSize = size / 3;
BoundingBox baseBolt = BoundingBox.UNIT_CUBE.scale(boltSize, boltSize, boltSize);
IIcon icon = EnderIO.blockSoulFuser.getIcon(ForgeDirection.EAST.ordinal(), 0);
final CubeRenderer cr = CubeRenderer.get();
float offset = 0.15f;
bb = baseBolt.translate(size + boltSize / 2, -0.15f, offset);
CubeRenderer.render(bb, icon, rot, true);
cr.render(bb, icon, rot, true);
bb = baseBolt.translate(size + boltSize / 2, -0.15f, -offset);
CubeRenderer.render(bb, icon, rot, true);
cr.render(bb, icon, rot, true);
bb = baseBolt.translate(-(size + boltSize / 2), -0.15f, offset);
CubeRenderer.render(bb, icon, rot, true);
cr.render(bb, icon, rot, true);
bb = baseBolt.translate(-(size + boltSize / 2), -0.15f, -offset);
CubeRenderer.render(bb, icon, rot, true);
cr.render(bb, icon, rot, true);
bb = baseBolt.translate(-offset, -0.15f, -(size + boltSize / 2));
CubeRenderer.render(bb, icon, rot, true);
cr.render(bb, icon, rot, true);
bb = baseBolt.translate(offset, -0.15f, -(size + boltSize / 2));
CubeRenderer.render(bb, icon, rot, true);
cr.render(bb, icon, rot, true);
bb = baseBolt.translate(offset, -0.15f, (size + boltSize / 2));
CubeRenderer.render(bb, icon, rot, true);
cr.render(bb, icon, rot, true);
bb = baseBolt.translate(-offset, -0.15f, (size + boltSize / 2));
CubeRenderer.render(bb, icon, rot, true);
cr.render(bb, icon, rot, true);
}
@Override
@@ -489,11 +489,7 @@ public abstract class AbstractMachineEntity extends TileEntityEio
if (stack == null || stack.stackTagCompound == null) {
return;
}
NBTTagCompound root = stack.stackTagCompound;
if (!root.hasKey("eio.abstractMachine")) {
return;
}
readCommon(root);
readCommon(stack.stackTagCompound);
}
@Override
@@ -19,12 +19,14 @@ import com.enderio.core.client.render.CustomRenderBlocks;
import com.enderio.core.client.render.IconUtil;
import com.enderio.core.client.render.RenderUtil;
import com.enderio.core.common.vecmath.Vertex;
import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import crazypants.enderio.machine.painter.IPaintableTileEntity;
import crazypants.enderio.machine.painter.PaintedBlockRenderer;
import crazypants.enderio.machine.painter.PainterUtil;
@ThreadSafeISBRH(perThread = true)
public class AbstractMachineRenderer implements ISimpleBlockRenderingHandler, IItemRenderer {
private OverlayRenderer overlayRenderer = new OverlayRenderer() {
@@ -40,10 +42,10 @@ public class AbstractMachineRenderer implements ISimpleBlockRenderingHandler, II
private CustomCubeRenderer ccr = new CustomCubeRenderer();
private PaintedBlockRenderer paintedRenderer = new PaintedBlockRenderer(this.getRenderId(), null); // passthrough
// renderer for
// paintable
// machines
private final PaintedBlockRenderer paintedRenderer = new PaintedBlockRenderer(this.getRenderId(), null);
// renderer for
// paintable
// machines
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
@@ -75,8 +77,9 @@ public class AbstractMachineRenderer implements ISimpleBlockRenderingHandler, II
BoundingBox bb = BoundingBox.UNIT_CUBE;
bb = bb.translate(0, -0.1f, 0);
final Tessellator tessellator = Tessellator.instance;
Tessellator.instance.startDrawingQuads();
tessellator.startDrawingQuads();
IIcon[] textures = RenderUtil.getBlockTextures(block, metadata);
@@ -84,8 +87,8 @@ public class AbstractMachineRenderer implements ISimpleBlockRenderingHandler, II
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
brightnessPerSide[dir.ordinal()] = Math.max(RenderUtil.getColorMultiplierForFace(dir) + 0.1f, 1f);
}
CubeRenderer.render(bb, textures, null, brightnessPerSide);
Tessellator.instance.draw();
CubeRenderer.get().render(bb, textures, null, brightnessPerSide);
tessellator.draw();
}
@Override
@@ -9,7 +9,10 @@ import com.enderio.core.common.vecmath.VecmathUtil;
import crazypants.enderio.EnderIO;
import crazypants.enderio.network.PacketHandler;
import crazypants.enderio.power.*;
import crazypants.enderio.power.Capacitors;
import crazypants.enderio.power.ICapacitor;
import crazypants.enderio.power.IInternalPoweredTile;
import crazypants.enderio.power.PowerHandlerUtil;
public abstract class AbstractPoweredMachineEntity extends AbstractMachineEntity implements IInternalPoweredTile {
@@ -12,7 +12,6 @@ import crazypants.enderio.machine.recipe.RecipeBonusType;
* progress' recipe for a machine is stored to and retrieved from a machines TileEntity soley based on its UID.
*
* @author cp
*
*/
public interface IMachineRecipe {
@@ -50,7 +49,7 @@ public interface IMachineRecipe {
/**
* Returns the output from a single 'cycle' of the recipe (even if the inputs would allow the recipe to be crafted
* several times).
*
* <p>
* This method must not return null. If no output is generated an empty array should be returned.
*
* @param randomChance a random number to be used as a seed for determining whether '% chance' outputs are returned.
@@ -1,9 +1,19 @@
package crazypants.enderio.machine;
import static crazypants.enderio.EnderIO.itemBasicCapacitor;
import static crazypants.enderio.material.Alloy.*;
import static crazypants.enderio.material.Material.*;
import static crazypants.util.RecipeUtil.*;
import static crazypants.enderio.material.Alloy.DARK_STEEL;
import static crazypants.enderio.material.Alloy.ELECTRICAL_STEEL;
import static crazypants.enderio.material.Alloy.END_STEEL;
import static crazypants.enderio.material.Alloy.ENERGETIC_ALLOY;
import static crazypants.enderio.material.Alloy.PHASED_GOLD;
import static crazypants.enderio.material.Alloy.PHASED_IRON;
import static crazypants.enderio.material.Alloy.REDSTONE_ALLOY;
import static crazypants.enderio.material.Alloy.SOULARIUM;
import static crazypants.enderio.material.Material.CONDUIT_BINDER;
import static crazypants.enderio.material.Material.ENDER_CRYSTAL;
import static crazypants.enderio.material.Material.PULSATING_CYSTAL;
import static crazypants.enderio.material.Material.SILICON;
import static crazypants.enderio.material.Material.VIBRANT_CYSTAL;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
@@ -24,6 +34,7 @@ import crazypants.enderio.material.FrankenSkull;
import crazypants.enderio.material.MachinePart;
import crazypants.enderio.material.Material;
import crazypants.enderio.power.Capacitors;
import crazypants.util.RecipeUtil;
public class MachineRecipes {
@@ -62,13 +73,24 @@ public class MachineRecipes {
String silicon = SILICON.oreDict;
if (Config.addPeacefulRecipes) {
addShaped(frankenZombie, "gdg", "dzd", "gdg", 'g', "ingotGold", 'd', "gemDiamond", 'z', zombieController);
addShaped(sentientEnder, "ddd", "ded", "dgd", 'g', "blockGold", 'd', "gemDiamond", 'e', enderRes);
RecipeUtil.addShaped(
frankenZombie,
"gdg",
"dzd",
"gdg",
'g',
"ingotGold",
'd',
"gemDiamond",
'z',
zombieController);
RecipeUtil
.addShaped(sentientEnder, "ddd", "ded", "dgd", 'g', "blockGold", 'd', "gemDiamond", 'e', enderRes);
}
// stirling gen
ItemStack stirlingGen = new ItemStack(EnderIO.blockStirlingGenerator, 1, 0);
addShaped(
RecipeUtil.addShaped(
stirlingGen,
"bbb",
"bfb",
@@ -85,7 +107,7 @@ public class MachineRecipes {
// Combustion Gen
ItemStack res = new ItemStack(EnderIO.blockTank, 1, 0);
ItemStack comGen = new ItemStack(EnderIO.blockCombustionGenerator, 1, 0);
addShaped(
RecipeUtil.addShaped(
comGen,
"eee",
"rmr",
@@ -103,7 +125,7 @@ public class MachineRecipes {
// ZombieGen
ItemStack zg = new ItemStack(EnderIO.blockZombieGenerator, 1, 0);
addShaped(
RecipeUtil.addShaped(
zg,
"eee",
"qzq",
@@ -117,7 +139,7 @@ public class MachineRecipes {
// FrankenzombieGen
ItemStack fg = new ItemStack(EnderIO.blockFrankenZombieGenerator, 1, 0);
addShaped(
RecipeUtil.addShaped(
fg,
"eee",
"qzq",
@@ -131,7 +153,7 @@ public class MachineRecipes {
// EnderGen
ItemStack eg = new ItemStack(EnderIO.blockEnderGenerator, 1, 0);
addShaped(
RecipeUtil.addShaped(
eg,
"eee",
"qzq",
@@ -145,17 +167,18 @@ public class MachineRecipes {
// KillerJoe
ItemStack kj = new ItemStack(EnderIO.blockKillerJoe, 1, 0);
addShaped(kj, "sss", "qzq", "qqq", 's', darkSteel, 'q', fusedQuartz, 'z', frankenZombie);
RecipeUtil.addShaped(kj, "sss", "qzq", "qqq", 's', darkSteel, 'q', fusedQuartz, 'z', frankenZombie);
// Wireless charger
ItemStack wirelessCharger = new ItemStack(EnderIO.blockWirelessCharger);
// addShaped(wirelessCharger, "svs", "imi", "scs", 's', electricSteel, 'i', silicon, 'm', machineChassi, 'c',
// capacitor3, 'v', vibCry);
addShaped(wirelessCharger, "sss", "ses", "scs", 's', electricalSteel, 'c', capacitor3, 'e', enderRes);
RecipeUtil
.addShaped(wirelessCharger, "sss", "ses", "scs", 's', electricalSteel, 'c', capacitor3, 'e', enderRes);
// Crafter
ItemStack crafter = new ItemStack(EnderIO.blockCrafter, 1, 0);
addShaped(
RecipeUtil.addShaped(
crafter,
"iti",
"imi",
@@ -177,7 +200,7 @@ public class MachineRecipes {
} else {
zombieBit = zombieController;
}
addShaped(
RecipeUtil.addShaped(
poweredSpawner,
"ese",
"eme",
@@ -202,15 +225,16 @@ public class MachineRecipes {
} else {
glassSides = "glass";
}
addShaped(reservoir, "gfg", "gcg", "gfg", 'g', glassSides, 'c', Items.cauldron, 'f', fusedQuartz);
RecipeUtil
.addShaped(reservoir, "gfg", "gcg", "gfg", 'g', glassSides, 'c', Items.cauldron, 'f', fusedQuartz);
}
// Tanks
ItemStack basicTank = new ItemStack(EnderIO.blockTank, 1, 0);
addShaped(basicTank, "ibi", "bgb", "ibi", 'g', "glass", 'i', "ingotIron", 'b', Blocks.iron_bars);
RecipeUtil.addShaped(basicTank, "ibi", "bgb", "ibi", 'g', "glass", 'i', "ingotIron", 'b', Blocks.iron_bars);
ItemStack advTank = new ItemStack(EnderIO.blockTank, 1, 1);
addShaped(
RecipeUtil.addShaped(
advTank,
"ibi",
"bgb",
@@ -225,7 +249,7 @@ public class MachineRecipes {
// mill
ItemStack crusher = new ItemStack(EnderIO.blockCrusher, 1, 0);
if (Config.useHardRecipes) {
addShaped(
RecipeUtil.addShaped(
crusher,
"ooo",
"fmf",
@@ -241,7 +265,7 @@ public class MachineRecipes {
'o',
Blocks.obsidian);
} else {
addShaped(
RecipeUtil.addShaped(
crusher,
"fff",
"imi",
@@ -259,7 +283,7 @@ public class MachineRecipes {
// alloy smelter
ItemStack alloySmelter = new ItemStack(EnderIO.blockAlloySmelter, 1, 0);
if (Config.useHardRecipes) {
addShaped(
RecipeUtil.addShaped(
alloySmelter,
"bfb",
"fmf",
@@ -273,7 +297,7 @@ public class MachineRecipes {
'f',
Blocks.furnace);
} else {
addShaped(
RecipeUtil.addShaped(
alloySmelter,
"bfb",
"fmf",
@@ -290,7 +314,7 @@ public class MachineRecipes {
// Vat
ItemStack still = new ItemStack(EnderIO.blockVat, 1, 0);
addShaped(
RecipeUtil.addShaped(
still,
"eve",
"tmt",
@@ -310,13 +334,14 @@ public class MachineRecipes {
ItemStack capBank1 = BlockItemCapBank
.createItemStackWithPower(CapBankType.getMetaFromType(CapBankType.SIMPLE), 0);
addShaped(capBank1, "bcb", "cmc", "bcb", 'b', "ingotIron", 'c', capacitor, 'm', "blockRedstone");
RecipeUtil.addShaped(capBank1, "bcb", "cmc", "bcb", 'b', "ingotIron", 'c', capacitor, 'm', "blockRedstone");
ItemStack capBank2 = BlockItemCapBank
.createItemStackWithPower(CapBankType.getMetaFromType(CapBankType.ACTIVATED), 0);
addShaped(capBank2, "bcb", "cmc", "bcb", 'b', electricalSteel, 'c', capacitor2, 'm', "blockRedstone");
RecipeUtil
.addShaped(capBank2, "bcb", "cmc", "bcb", 'b', electricalSteel, 'c', capacitor2, 'm', "blockRedstone");
ItemStack capBank3 = BlockItemCapBank
.createItemStackWithPower(CapBankType.getMetaFromType(CapBankType.VIBRANT), 0);
addShaped(capBank3, "bcb", "cmc", "bcb", 'b', electricalSteel, 'c', capacitor3, 'm', vibCry);
RecipeUtil.addShaped(capBank3, "bcb", "cmc", "bcb", 'b', electricalSteel, 'c', capacitor3, 'm', vibCry);
ConvertOldRecipe convertRecipe = new ConvertOldRecipe();
GameRegistry.addRecipe(convertRecipe);
@@ -351,7 +376,7 @@ public class MachineRecipes {
// painter
ItemStack painter = new ItemStack(EnderIO.blockPainter, 1, 0);
if (Config.useHardRecipes) {
addShaped(
RecipeUtil.addShaped(
painter,
"qqq",
"mdm",
@@ -367,7 +392,7 @@ public class MachineRecipes {
'd',
"gemDiamond");
} else {
addShaped(
RecipeUtil.addShaped(
painter,
"qdq",
"mMm",
@@ -391,7 +416,7 @@ public class MachineRecipes {
} else {
zombieBit = zombieController;
}
addShaped(
RecipeUtil.addShaped(
farm,
"ehe",
"eme",
@@ -411,7 +436,7 @@ public class MachineRecipes {
// transceiver
ItemStack transceiver = new ItemStack(EnderIO.blockTransceiver, 1, 0);
if (Config.transceiverUseEasyRecipe) {
addShaped(
RecipeUtil.addShaped(
transceiver,
"oeo",
"pdp",
@@ -427,7 +452,7 @@ public class MachineRecipes {
'd',
Items.diamond);
} else {
addShaped(
RecipeUtil.addShaped(
transceiver,
"oeo",
"pdp",
@@ -442,7 +467,7 @@ public class MachineRecipes {
fusedQuartz,
'd',
endCry);
addShapeless(transceiver, new ItemStack(EnderIO.blockHyperCube, 1, 0));
RecipeUtil.addShapeless(transceiver, new ItemStack(EnderIO.blockHyperCube, 1, 0));
}
}
@@ -454,7 +479,7 @@ public class MachineRecipes {
ItemStack vibSolarPanel = new ItemStack(EnderIO.blockSolarPanel, 1, 2);
if (Config.useHardRecipes) {
addShaped(
RecipeUtil.addShaped(
solarPanel,
"efe",
"pfp",
@@ -469,7 +494,7 @@ public class MachineRecipes {
energeticAlloy,
'p',
phasedGold);
addShaped(
RecipeUtil.addShaped(
advSolarPanel,
"efe",
"pfp",
@@ -484,7 +509,7 @@ public class MachineRecipes {
phasedIron,
'p',
phasedGold);
addShaped(
RecipeUtil.addShaped(
vibSolarPanel,
"efe",
"pfp",
@@ -500,7 +525,7 @@ public class MachineRecipes {
'p',
phasedGold);
} else {
addShaped(
RecipeUtil.addShaped(
solarPanel,
"efe",
"pfp",
@@ -515,7 +540,7 @@ public class MachineRecipes {
energeticAlloy,
'c',
redstoneAlloy);
addShaped(
RecipeUtil.addShaped(
advSolarPanel,
"efe",
"pfp",
@@ -530,7 +555,7 @@ public class MachineRecipes {
phasedIron,
'c',
electricalSteel);
addShaped(
RecipeUtil.addShaped(
vibSolarPanel,
"efe",
"pfp",
@@ -553,7 +578,7 @@ public class MachineRecipes {
ItemStack powerConduit = new ItemStack(EnderIO.itemPowerConduit, 1, 0);
ItemStack redstoneConduit = new ItemStack(EnderIO.itemRedstoneConduit, 1, 2);
ItemStack mJMonitor = new ItemStack(EnderIO.blockPowerMonitor, 1, 0);
addShaped(
RecipeUtil.addShaped(
mJMonitor,
"sms",
"sMs",
@@ -571,11 +596,11 @@ public class MachineRecipes {
// Enchanter
ItemStack enchanter = new ItemStack(EnderIO.blockEnchanter);
addShaped(enchanter, "dbd", "sss", " s ", 'd', "gemDiamond", 'b', Items.book, 's', darkSteel);
RecipeUtil.addShaped(enchanter, "dbd", "sss", " s ", 'd', "gemDiamond", 'b', Items.book, 's', darkSteel);
// Vacuum Chest
ItemStack vacuumChest = new ItemStack(EnderIO.blockVacuumChest);
addShaped(vacuumChest, "iii", "ici", "ipi", 'i', "ingotIron", 'c', "chestWood", 'p', pulCry);
RecipeUtil.addShaped(vacuumChest, "iii", "ici", "ipi", 'i', "ingotIron", 'c', "chestWood", 'p', pulCry);
// Soul Binder
Object enderBit;
@@ -588,7 +613,7 @@ public class MachineRecipes {
ItemStack zombieSkull = new ItemStack(Items.skull, 1, 4);
ItemStack skeletonSkull = new ItemStack(Items.skull, 1, 0);
ItemStack soulBinder = new ItemStack(EnderIO.blockSoulFuser);
addShaped(
RecipeUtil.addShaped(
soulBinder,
"ses",
"zmc",
@@ -609,7 +634,7 @@ public class MachineRecipes {
// Attractor
ItemStack attractor = new ItemStack(EnderIO.blockAttractor);
ItemStack attractorCrystal = new ItemStack(EnderIO.itemMaterial, 1, Material.ATTRACTOR_CRYSTAL.ordinal());
addShaped(
RecipeUtil.addShaped(
attractor,
" c ",
"ese",
@@ -629,7 +654,7 @@ public class MachineRecipes {
EnderIO.blockEndermanSkull,
1,
BlockEndermanSkull.SkullType.TORMENTED.ordinal());
addShaped(
RecipeUtil.addShaped(
aversion,
" c ",
"ese",
@@ -646,12 +671,12 @@ public class MachineRecipes {
// Experience
ItemStack xp = new ItemStack(EnderIO.blockExperianceOblisk);
ItemStack xpItem = new ItemStack(EnderIO.itemXpTransfer);
addShaped(xp, " x ", " s ", "sms", 's', soularium, 'm', machineChassi, 'x', xpItem);
RecipeUtil.addShaped(xp, " x ", " s ", "sms", 's', soularium, 'm', machineChassi, 'x', xpItem);
// Weather
ItemStack weather = new ItemStack(EnderIO.blockWeatherObelisk);
ItemStack weatherItem = new ItemStack(EnderIO.itemMaterial, 1, Material.WEATHER_CRYSTAL.ordinal());
addShaped(
RecipeUtil.addShaped(
weather,
" x ",
"ese",
@@ -686,14 +711,14 @@ public class MachineRecipes {
EnderIO.blockElectricLight,
1,
BlockItemElectricLight.Type.WIRELESS_INV.ordinal());
addShapeless(wirelessLamp, poweredLamp, enderRes);
addShapeless(wirelessLamp, wirelessLampInv, Blocks.redstone_torch);
addShapeless(wirelessLampInv, poweredLampInv, enderRes);
addShapeless(wirelessLampInv, wirelessLamp, Blocks.redstone_torch);
RecipeUtil.addShapeless(wirelessLamp, poweredLamp, enderRes);
RecipeUtil.addShapeless(wirelessLamp, wirelessLampInv, Blocks.redstone_torch);
RecipeUtil.addShapeless(wirelessLampInv, poweredLampInv, enderRes);
RecipeUtil.addShapeless(wirelessLampInv, wirelessLamp, Blocks.redstone_torch);
// inventory panel
ItemStack awareness = new ItemStack(EnderIO.itemFunctionUpgrade, 1, FunctionUpgrade.INVENTORY_PANEL.ordinal());
addShaped(
RecipeUtil.addShaped(
awareness,
"bsb",
"ses",
@@ -707,7 +732,7 @@ public class MachineRecipes {
'i',
electricalSteel);
ItemStack invPanel = new ItemStack(EnderIO.blockInventoryPanel);
addShaped(
RecipeUtil.addShaped(
invPanel,
"dad",
"psp",
@@ -727,7 +752,7 @@ public class MachineRecipes {
// powered light
if (Config.useHardRecipes) {
addShaped(
RecipeUtil.addShaped(
poweredLamp,
"ggg",
"sds",
@@ -741,7 +766,7 @@ public class MachineRecipes {
'c',
capacitor);
} else {
addShaped(
RecipeUtil.addShaped(
poweredLamp,
"ggg",
"sds",
@@ -756,19 +781,19 @@ public class MachineRecipes {
capacitor);
}
ItemStack invPoweredLamp = new ItemStack(EnderIO.blockElectricLight, 1, 1);
addShapeless(invPoweredLamp, poweredLamp, Blocks.redstone_torch);
addShapeless(poweredLamp, invPoweredLamp, Blocks.redstone_torch);
RecipeUtil.addShapeless(invPoweredLamp, poweredLamp, Blocks.redstone_torch);
RecipeUtil.addShapeless(poweredLamp, invPoweredLamp, Blocks.redstone_torch);
// light
ItemStack lamp = new ItemStack(EnderIO.blockElectricLight, 1, 2);
addShaped(lamp, " ", "ggg", "isi", 'g', "glass", 's', "glowstone", 'i', "ingotIron");
RecipeUtil.addShaped(lamp, " ", "ggg", "isi", 'g', "glass", 's', "glowstone", 'i', "ingotIron");
ItemStack invLamp = new ItemStack(EnderIO.blockElectricLight, 1, 3);
addShapeless(invLamp, lamp, Blocks.redstone_torch);
addShapeless(lamp, invLamp, Blocks.redstone_torch);
RecipeUtil.addShapeless(invLamp, lamp, Blocks.redstone_torch);
RecipeUtil.addShapeless(lamp, invLamp, Blocks.redstone_torch);
// MJ Reader
addShaped(
RecipeUtil.addShaped(
mJReader,
"epe",
"gcg",
@@ -788,7 +813,7 @@ public class MachineRecipes {
// Slice'N'Splice
ItemStack sns = new ItemStack(EnderIO.blockSliceAndSplice);
addShaped(
RecipeUtil.addShaped(
sns,
"iki",
"ams",
@@ -808,8 +833,28 @@ public class MachineRecipes {
ItemStack itemBuffer = Type.getStack(Type.ITEM);
ItemStack powerBuffer = Type.getStack(Type.POWER);
ItemStack omniBuffer = Type.getStack(Type.OMNI);
addShaped(itemBuffer, "isi", "scs", "isi", 'i', "ingotIron", 's', "ingotElectricalSteel", 'c', "chestWood");
addShaped(powerBuffer, "isi", "sfs", "isi", 'i', "ingotIron", 's', "ingotElectricalSteel", 'f', machineChassis);
addShapeless(omniBuffer, itemBuffer, powerBuffer);
RecipeUtil.addShaped(
itemBuffer,
"isi",
"scs",
"isi",
'i',
"ingotIron",
's',
"ingotElectricalSteel",
'c',
"chestWood");
RecipeUtil.addShaped(
powerBuffer,
"isi",
"sfs",
"isi",
'i',
"ingotIron",
's',
"ingotElectricalSteel",
'f',
machineChassis);
RecipeUtil.addShapeless(omniBuffer, itemBuffer, powerBuffer);
}
}
@@ -19,7 +19,6 @@ import com.enderio.core.common.vecmath.Vertex;
public class OverlayRenderer implements IRenderFace {
private static final CustomCubeRenderer ccr = CustomCubeRenderer.instance;
private AbstractMachineEntity te;
public void setTile(AbstractMachineEntity te) {
@@ -30,6 +29,7 @@ public class OverlayRenderer implements IRenderFace {
@Override
public void renderFace(CustomRenderBlocks rb, ForgeDirection face, Block par1Block, double x, double y, double z,
IIcon texture, List<Vertex> refVertices, boolean translateToXyz) {
CustomCubeRenderer ccr = CustomCubeRenderer.get();
if (te != null && par1Block instanceof AbstractMachineBlock) {
BlockCoord bc = new BlockCoord(x, y, z);
@@ -4,13 +4,20 @@ import java.util.HashMap;
import java.util.Map;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.world.WorldEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import crazypants.enderio.machine.capbank.TileCapBank;
public class ClientNetworkManager {
private static final ClientNetworkManager instance = new ClientNetworkManager();
static {
MinecraftForge.EVENT_BUS.register(instance);
}
public static ClientNetworkManager getInstance() {
return instance;
}
@@ -53,4 +60,12 @@ public class ClientNetworkManager {
CapBankClientNetwork network = getOrCreateNetwork(id);
network.addMember(tileCapBank);
}
@SubscribeEvent
public void onWorldUnload(WorldEvent.Unload event) {
if (event.world.isRemote) {
networks.forEach((id, network) -> network.destroyNetwork());
networks.clear();
}
}
}
@@ -21,6 +21,7 @@ import com.enderio.core.client.render.ConnectedTextureRenderer;
import com.enderio.core.client.render.CubeRenderer;
import com.enderio.core.client.render.CustomCubeRenderer;
import com.enderio.core.client.render.RenderUtil;
import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.relauncher.Side;
@@ -36,6 +37,7 @@ import crazypants.enderio.machine.capbank.render.FillGauge.GaugeKey;
import crazypants.enderio.power.PowerHandlerUtil;
@SideOnly(Side.CLIENT)
@ThreadSafeISBRH(perThread = true)
public class CapBankRenderer extends TileEntitySpecialRenderer implements ISimpleBlockRenderingHandler, IItemRenderer {
private ConnectedTextureRenderer connectedTexRenderer;
@@ -47,7 +49,7 @@ public class CapBankRenderer extends TileEntitySpecialRenderer implements ISimpl
connectedTexRenderer = new ConnectedTextureRenderer();
connectedTexRenderer.setMatchMeta(true);
fillGaugeRenderer = new FillGauge();
infoRenderers = new HashMap<InfoDisplayType, IInfoRenderer>();
infoRenderers = new HashMap<>();
infoRenderers.put(InfoDisplayType.LEVEL_BAR, fillGaugeRenderer);
infoRenderers.put(InfoDisplayType.IO, new IoDisplay());
}
@@ -60,6 +62,7 @@ public class CapBankRenderer extends TileEntitySpecialRenderer implements ISimpl
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId,
RenderBlocks renderer) {
CustomCubeRenderer ccr = CustomCubeRenderer.get();
int meta = world.getBlockMetadata(x, y, z);
meta = MathHelper.clamp_int(meta, 0, CapBankType.types().size() - 1);
@@ -70,13 +73,13 @@ public class CapBankRenderer extends TileEntitySpecialRenderer implements ISimpl
connectedTexRenderer.setForceAllEdges(false);
}
connectedTexRenderer.setEdgeTexture(EnderIO.blockCapBank.getBorderIcon(0, meta));
CustomCubeRenderer.instance.setOverrideTexture(renderer.overrideBlockTexture);
ccr.setOverrideTexture(renderer.overrideBlockTexture);
if (renderer.overrideBlockTexture == null) {
CustomCubeRenderer.instance.renderBlock(world, block, x, y, z, connectedTexRenderer);
ccr.renderBlock(world, block, x, y, z, connectedTexRenderer);
} else {
CustomCubeRenderer.instance.renderBlock(world, block, x, y, z);
ccr.renderBlock(world, block, x, y, z);
}
CustomCubeRenderer.instance.setOverrideTexture(null);
ccr.setOverrideTexture(null);
return true;
}
@@ -108,7 +111,7 @@ public class CapBankRenderer extends TileEntitySpecialRenderer implements ISimpl
Tessellator tes = Tessellator.instance;
tes.startDrawingQuads();
CubeRenderer.render(EnderIO.blockCapBank, item.getItemDamage());
CubeRenderer.get().render(EnderIO.blockCapBank, item.getItemDamage());
tes.draw();
GL11.glEnable(GL11.GL_POLYGON_OFFSET_FILL);
@@ -126,7 +129,7 @@ public class CapBankRenderer extends TileEntitySpecialRenderer implements ISimpl
nw.setMaxEnergyStoredL(CapBankType.getTypeFromMeta(item.getItemDamage()).getMaxEnergyStored());
nw.setEnergyStored(PowerHandlerUtil.getStoredEnergyForItem(item));
GaugeInfo gi = new GaugeInfo(1, 0);
GaugeInfo gi = GaugeInfo.DEFAULT;
GaugeKey key = new GaugeKey(ForgeDirection.SOUTH, FillGauge.Type.SINGLE);
fillGaugeRenderer.doRender(nw, RenderUtil.BRIGHTNESS_MAX, gi, key);
// key = new GaugeKey(ForgeDirection.EAST, FillGauge.Type.SINGLE);
@@ -1,6 +1,5 @@
package crazypants.enderio.machine.capbank.render;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -32,6 +31,7 @@ public class FillGauge implements IInfoRenderer, IResourceManagerReloadListener
private static final double HEIGHT = 0.75;
private static final double VERT_BORDER = (1 - HEIGHT) / 2;
private static final double WIDTH = 0.25;
private final Vertex[] newVerts = new Vertex[] { new Vertex(), new Vertex(), new Vertex(), new Vertex() };
enum Type {
SINGLE,
@@ -95,8 +95,8 @@ public class FillGauge implements IInfoRenderer, IResourceManagerReloadListener
if (ratio <= 0) {
return;
}
double maxY = ratio * info.height;
if (maxY <= info.yPosition) {
double maxY = ratio * info.getHeight();
if (maxY <= info.getyPosition()) {
// empty
return;
}
@@ -105,26 +105,24 @@ public class FillGauge implements IInfoRenderer, IResourceManagerReloadListener
Tessellator.instance.addTranslation((float) offset.x, (float) offset.y, (float) offset.z);
List<Vertex> verts = levelVertexCache.get(key);
if (maxY >= info.yPosition + 1) {
if (maxY >= info.getyPosition() + 1) {
// full bar
RenderUtil.addVerticesToTessellator(verts, Tessellator.instance);
} else {
// need to render partial bar
double myMaxY = maxY - info.yPosition;
double myMaxY = maxY - info.getyPosition();
if (info.type == Type.BOTTOM || info.type == Type.SINGLE) {
// If we have some power and we are the bottom bit of the display,
// always show at least a little bit in the bar
myMaxY = Math.max(0.2, myMaxY);
}
List<Vertex> newVerts = new ArrayList<Vertex>();
for (Vertex v : verts) {
v = new Vertex(v);
newVerts.add(v);
if (v.y() > myMaxY) {
v.setXYZ(v.x(), myMaxY, v.z());
v.setUV(v.u(), barMinV + (float) (myMaxY * barHeightV));
for (int i = 0; i < verts.size(); i++) {
newVerts[i].set(verts.get(i));
if (newVerts[i].y() > myMaxY) {
newVerts[i].setXYZ(newVerts[i].x(), myMaxY, newVerts[i].z());
newVerts[i].setUV(newVerts[i].u(), barMinV + (float) (myMaxY * barHeightV));
}
}
RenderUtil.addVerticesToTessellator(newVerts, Tessellator.instance);
@@ -136,7 +134,7 @@ public class FillGauge implements IInfoRenderer, IResourceManagerReloadListener
private GaugeInfo getGaugeInfo(TileCapBank cb, ForgeDirection dir) {
if (!cb.getType().isMultiblock()) {
return new GaugeInfo(1, 0);
return GaugeInfo.DEFAULT;
}
int height = 1;
@@ -240,8 +238,10 @@ public class FillGauge implements IInfoRenderer, IResourceManagerReloadListener
static class GaugeInfo {
int height;
int yPosition;
public static final GaugeInfo DEFAULT = new GaugeInfo(1, 0);
private int height;
private int yPosition;
Type type;
GaugeInfo(int height, int position) {
@@ -262,6 +262,14 @@ public class FillGauge implements IInfoRenderer, IResourceManagerReloadListener
}
return Type.MIDDLE;
}
public int getHeight() {
return height;
}
public int getyPosition() {
return yPosition;
}
}
static class GaugeKey {
@@ -21,6 +21,14 @@ import crazypants.enderio.machine.power.PowerDisplayUtil;
public class IoDisplay implements IInfoRenderer {
private float previousAverageInput;
private float previousAverageOutput;
String averageInputText = "0";
String averageOutputText = "0";
HeadingText heading1;
HeadingText heading2;
@Override
public void render(TileCapBank cb, ForgeDirection dir, double x, double y, double z, float partialTick) {
if (dir.offsetY != 0) {
@@ -137,10 +145,8 @@ public class IoDisplay implements IInfoRenderer {
nw.requestPowerUpdate(cb, 20);
HeadingText heading1 = HeadingText.STABLE;
HeadingText heading2 = null;
String text1;
String text2 = "";
heading1 = HeadingText.STABLE;
heading2 = null;
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
float size = 0.15f * Math.min(info.width, info.height);
@@ -150,8 +156,14 @@ public class IoDisplay implements IInfoRenderer {
if (info.height * 3 >= info.width * 4) {
heading1 = HeadingText.INPUT;
heading2 = HeadingText.OUTPUT;
text1 = getChangeText(nw.getAverageInputPerTick(), fr);
text2 = getChangeText(nw.getAverageOutputPerTick(), fr);
if (previousAverageInput != nw.getAverageInputPerTick()) {
averageInputText = getChangeText(nw.getAverageInputPerTick(), fr);
previousAverageInput = nw.getAverageInputPerTick();
}
if (previousAverageOutput != nw.getAverageOutputPerTick()) {
averageOutputText = getChangeText(nw.getAverageOutputPerTick(), fr);
previousAverageOutput = nw.getAverageOutputPerTick();
}
offset = -size * 2.5f;
} else {
int change = Math.round(nw.getAverageChangePerTick());
@@ -160,7 +172,10 @@ public class IoDisplay implements IInfoRenderer {
} else if (change < 0) {
heading1 = HeadingText.LOSS;
}
text1 = getChangeText(change, fr);
if (change != previousAverageInput) {
averageInputText = getChangeText(change, fr);
previousAverageInput = change;
}
offset = -size;
}
@@ -184,9 +199,9 @@ public class IoDisplay implements IInfoRenderer {
GL11.glDisable(GL11.GL_LIGHTING);
OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
offset = drawText(heading1, text1, offset, scale, size, fr);
offset = drawText(heading1, averageInputText, offset, scale, size, fr);
if (heading2 != null) {
drawText(heading2, text2, offset, scale, size, fr);
drawText(heading2, averageOutputText, offset, scale, size, fr);
}
GL11.glEnable(GL11.GL_LIGHTING);
@@ -20,7 +20,6 @@ import crazypants.enderio.Log;
/**
* This is not in the FakePlayer hierarchy for reasons.
*
*/
public class FakeFarmPlayer extends EntityPlayerMP {
@@ -28,13 +28,19 @@ public class FarmingStationRenderer extends TechneMachineRenderer<TileFarmStatio
if (world != null) {
TileEntity te = world.getTileEntity(x, y, z);
if (te instanceof TileFarmStation && ((TileFarmStation) te).isActive()) {
final Tessellator tessellator = Tessellator.instance;
BoundingBox bb = BoundingBox.UNIT_CUBE.scale(10D / 16D, 0.25, 10D / 16D);
bb = bb.scale(1.01, 1, 1.01);
bb = bb.translate(0, 5f / 16f, 0);
bb = bb.translate(x, y, z);
Tessellator.instance.setColorOpaque_F(1, 1, 1);
Tessellator.instance.setBrightness(0xF000F0);
CubeRenderer.render(bb, override != null ? override : Blocks.portal.getBlockTextureFromSide(1));
tessellator.setColorOpaque_F(1, 1, 1);
tessellator.setBrightness(0xF000F0);
IIcon ico = override != null ? override : Blocks.portal.getBlockTextureFromSide(1);
float x1 = ico.getInterpolatedU(3);
float x2 = ico.getInterpolatedU(13);
float y1 = ico.getInterpolatedV(6);
float y2 = ico.getInterpolatedV(10);
CubeRenderer.get().render(bb, x1, x2, y1, y2);
}
}
@@ -1,6 +1,8 @@
package crazypants.enderio.machine.farm;
import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.opengl.GL11.GL_LIGHTING;
import static org.lwjgl.opengl.GL11.glDisable;
import static org.lwjgl.opengl.GL11.glEnable;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
@@ -120,7 +120,6 @@ public enum Fertilizer {
/**
* Returns the singleton instance for the fertilizer that was given as parameter. If the given item is no
* fertilizer, it will return an instance of Fertilizer.None.
*
*/
public static Fertilizer getInstance(ItemStack stack) {
for (Fertilizer fertilizer : validFertilizers) {
@@ -144,7 +143,7 @@ public enum Fertilizer {
/**
* Tries to apply the given item on the given block using the type-specific method. SFX is played on success.
*
* <p>
* If the item was successfully applied, the stacksize will be decreased if appropriate. The caller will need to
* check for stacksize 0 and null the inventory slot if needed.
*
@@ -9,6 +9,7 @@ import com.enderio.core.common.util.BlockCoord;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import crazypants.enderio.config.Config;
import crazypants.util.ClientUtil;
import io.netty.buffer.ByteBuf;
@@ -51,11 +52,7 @@ public class PacketFarmAction implements IMessage, IMessageHandler<PacketFarmAct
@Override
public IMessage onMessage(PacketFarmAction message, MessageContext ctx) {
for (BlockCoord bc : message.coords) {
for (int i = 0; i < 15; i++) {
ClientUtil.spawnFarmParcticles(rand, bc);
}
}
ClientUtil.spawnFarmParticles(rand, message.coords, Config.farmParticlesCount);
return null;
}
}
@@ -458,8 +458,9 @@ public class TileFarmStation extends AbstractPoweredTaskEntity {
IHarvestResult harvest = FarmersCommune.instance.harvestBlock(this, bc, block, meta);
if (harvest != null && harvest.getDrops() != null) {
PacketFarmAction pkt = new PacketFarmAction(harvest.getHarvestedBlocks());
PacketHandler.INSTANCE
.sendToAllAround(pkt, new TargetPoint(worldObj.provider.dimensionId, bc.x, bc.y, bc.z, 64));
PacketHandler.INSTANCE.sendToAllAround(
pkt,
new TargetPoint(worldObj.provider.dimensionId, bc.x, bc.y, bc.z, Config.farmParticlesMaxRange));
for (EntityItem ei : harvest.getDrops()) {
if (ei != null) {
insertHarvestDrop(ei, bc);
@@ -487,7 +488,12 @@ public class TileFarmStation extends AbstractPoweredTaskEntity {
inventory[minFirtSlot] = farmerJoe.inventory.mainInventory[0];
PacketHandler.INSTANCE.sendToAllAround(
new PacketFarmAction(bc),
new TargetPoint(worldObj.provider.dimensionId, bc.x, bc.y, bc.z, 64));
new TargetPoint(
worldObj.provider.dimensionId,
bc.x,
bc.y,
bc.z,
Config.farmParticlesMaxRange));
if (inventory[minFirtSlot] != null && inventory[minFirtSlot].stackSize == 0) {
inventory[minFirtSlot] = null;
}
@@ -37,7 +37,7 @@ public class NaturaBerryFarmer extends PickableFarmer {
block = farm.getBlock(checkBlock);
if (super.canHarvest(farm, bc, block, meta)) { // redundant check because our canHarvest checks all 5 blocks
// so a bush may be invalid in
// so a bush may be invalid in
// the stack of 5
IHarvestResult blockRes = super.harvestBlock(farm, checkBlock, block, meta);
@@ -89,7 +89,7 @@ public class ZombieGeneratorRenderer extends TileEntitySpecialRenderer implement
}
tes.setBrightness(brightness);
CubeRenderer.render(bb, icon);
CubeRenderer.get().render(bb, icon);
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
GL11.glEnable(GL11.GL_BLEND);
@@ -111,7 +111,7 @@ public class HyperCubeRenderer extends TileEntitySpecialRenderer implements IIte
} else {
GL11.glColor4f(1, 1, 1, 1f);
}
CubeRenderer.render(bb, icon);
CubeRenderer.get().render(bb, icon);
tessellator.draw();
GL11.glPopMatrix();
@@ -301,7 +301,7 @@ public class TileInventoryPanel extends AbstractMachineEntity implements IFluidH
/**
* This is called by PacketUpdateExtractionDisabled on the client side
*
*
* @param extractionDisabled if extraction is disabled
*/
void updateExtractionDisabled(boolean extractionDisabled) {
@@ -142,7 +142,7 @@ public class KillerJoeRenderer extends TileEntitySpecialRenderer implements IIte
tes.setBrightness(brightness);
tes.setColorOpaque_F(1, 1, 1);
CubeRenderer.render(bb, icon);
CubeRenderer.get().render(bb, icon);
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
GL11.glEnable(GL11.GL_BLEND);
@@ -9,9 +9,11 @@ import net.minecraft.world.IBlockAccess;
import com.enderio.core.client.render.BoundingBox;
import com.enderio.core.client.render.CubeRenderer;
import com.enderio.core.client.render.RenderUtil;
import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
@ThreadSafeISBRH(perThread = false)
public class ElectricLightRenderer implements ISimpleBlockRenderingHandler {
@Override
@@ -19,13 +21,13 @@ public class ElectricLightRenderer implements ISimpleBlockRenderingHandler {
BoundingBox bb = new BoundingBox(0, 0, 0, 1, 0.2, 1);
boolean doDraw = false;
Tessellator.instance.startDrawingQuads();
final Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
IIcon[] textures = RenderUtil.getBlockTextures(block, metadata);
CubeRenderer.render(bb, textures, null, null);
CubeRenderer.get().render(bb, textures, null, null);
Tessellator.instance.draw();
tessellator.draw();
}
@Override
@@ -45,9 +47,9 @@ public class ElectricLightRenderer implements ISimpleBlockRenderingHandler {
IIcon[] textures = RenderUtil.getBlockTextures(world, x, y, z);
if (renderer.hasOverrideBlockTexture()) {
CubeRenderer.render(bb, renderer.overrideBlockTexture);
CubeRenderer.get().render(bb, renderer.overrideBlockTexture);
} else {
CubeRenderer.render(bb, textures, null, null);
CubeRenderer.get().render(bb, textures, null, null);
}
return true;
@@ -17,13 +17,15 @@ import com.enderio.core.client.render.RenderUtil;
import com.enderio.core.common.vecmath.Vector3d;
import com.enderio.core.common.vecmath.Vector3f;
import com.enderio.core.common.vecmath.Vertex;
import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
@ThreadSafeISBRH(perThread = true)
public class ObeliskRenderer implements ISimpleBlockRenderingHandler {
private static final VertXForm2 xform2 = new VertXForm2();
private static final VertXForm3 xform3 = new VertXForm3();
private final VertXForm2 xform2 = new VertXForm2();
private final VertXForm3 xform3 = new VertXForm3();
private static final float WIDE_PINCH = 0.9f;
private static final float WIDTH = 18f / 32f * WIDE_PINCH;
@@ -39,11 +41,12 @@ public class ObeliskRenderer implements ISimpleBlockRenderingHandler {
@Override
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
final Tessellator tessellator = Tessellator.instance;
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_ALPHA_TEST);
Tessellator.instance.startDrawingQuads();
tessellator.startDrawingQuads();
renderWorldBlock(null, 0, 0, 0, block, 0, renderer);
Tessellator.instance.draw();
tessellator.draw();
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL11.GL_LIGHTING);
}
@@ -66,6 +69,8 @@ public class ObeliskRenderer implements ISimpleBlockRenderingHandler {
} else { // item
icons = RenderUtil.getBlockTextures(block, 0);
}
final Tessellator tessellator = Tessellator.instance;
final CubeRenderer cr = CubeRenderer.get();
// bottom texture goes into its own BB
IIcon[] bottomIcons = new IIcon[6];
@@ -75,18 +80,18 @@ public class ObeliskRenderer implements ISimpleBlockRenderingHandler {
bottomIcons[BOTTOM] = icons[BOTTOM];
icons[BOTTOM] = IconUtil.blankTexture;
Tessellator.instance.addTranslation(x, y, z);
tessellator.addTranslation(x, y, z);
xform2.isX = false;
CubeRenderer.render(bb1, icons, xform2, true);
cr.render(bb1, icons, xform2, true);
xform2.isX = true;
icons[TOP] = IconUtil.blankTexture;
CubeRenderer.render(bb2, icons, xform2, true);
cr.render(bb2, icons, xform2, true);
CubeRenderer.render(BoundingBox.UNIT_CUBE, bottomIcons, xform3, true);
cr.render(BoundingBox.UNIT_CUBE, bottomIcons, xform3, true);
Tessellator.instance.addTranslation(-x, -y, -z);
tessellator.addTranslation(-x, -y, -z);
return true;
}
@@ -1,6 +1,14 @@
package crazypants.enderio.machine.obelisk;
import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.opengl.GL11.GL_ALL_ATTRIB_BITS;
import static org.lwjgl.opengl.GL11.glDepthMask;
import static org.lwjgl.opengl.GL11.glPopAttrib;
import static org.lwjgl.opengl.GL11.glPopMatrix;
import static org.lwjgl.opengl.GL11.glPushAttrib;
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.glTranslated;
import java.util.Random;
@@ -106,7 +114,7 @@ public class ObeliskSpecialRenderer<T extends TileEntity> extends TileEntitySpec
protected void renderItemStack(T te, World world, double x, double y, double z, float tick) {
if (ei == null) {
ei = new EntityItem(world, 0, 0, 0, getFloatingItem(te));
ei = new EntityItem(null, 0, 0, 0, getFloatingItem(te));
}
ei.setEntityItemStack(getFloatingItem(te));
@@ -7,9 +7,12 @@ import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.init.Blocks;
import net.minecraft.world.IBlockAccess;
import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import crazypants.enderio.EnderIO;
@ThreadSafeISBRH(perThread = false)
public class BlockPaintedFenceGateRenderer implements ISimpleBlockRenderingHandler {
@Override
@@ -11,10 +11,13 @@ import net.minecraftforge.common.util.ForgeDirection;
import com.enderio.core.client.render.CubeRenderer;
import com.enderio.core.client.render.IconUtil;
import com.enderio.core.common.util.BlockCoord;
import com.gtnewhorizons.angelica.api.ThreadSafeISBRHFactory;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.common.Optional;
public class PaintedBlockRenderer implements ISimpleBlockRenderingHandler {
@Optional.Interface(modid = "angelica", iface = "com.gtnewhorizons.angelica.api.ThreadSafeISBRHFactory")
public class PaintedBlockRenderer implements ISimpleBlockRenderingHandler, ThreadSafeISBRHFactory {
private int renderId;
private Block defaultBlock;
@@ -22,6 +25,13 @@ public class PaintedBlockRenderer implements ISimpleBlockRenderingHandler {
public PaintedBlockRenderer(int renderId, Block defaultBlock) {
this.renderId = renderId;
this.defaultBlock = defaultBlock;
}
@Override
@Optional.Method(modid = "angelica")
public ThreadSafeISBRHFactory newInstance() {
return new PaintedBlockRenderer(renderId, defaultBlock);
}
@Override
@@ -31,9 +41,10 @@ public class PaintedBlockRenderer implements ISimpleBlockRenderingHandler {
@Override
public void renderInventoryBlock(Block blk, int meta, int modelId, RenderBlocks arg3) {
Tessellator.instance.startDrawingQuads();
CubeRenderer.render(blk, meta);
Tessellator.instance.draw();
final Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
CubeRenderer.get().render(blk, meta);
tessellator.draw();
}
@Override
@@ -96,9 +96,10 @@ public class TileEntityPainter extends AbstractPoweredTaskEntity implements ISid
// next result is a different item type
return 0;
} else if (result.hasTagCompound() && inventory[2].hasTagCompound()) {
int cookedId = result.getTagCompound().getInteger(BlockPainter.KEY_SOURCE_BLOCK_ID);
int invId = inventory[2].getTagCompound().getInteger(BlockPainter.KEY_SOURCE_BLOCK_ID);
if (cookedId != invId) {
if (inventory[2].getTagCompound().hasKey("Items")) return 0; // presence of internal items
String cookedId = result.getTagCompound().getString(BlockPainter.KEY_SOURCE_BLOCK_ID);
String invId = inventory[2].getTagCompound().getString(BlockPainter.KEY_SOURCE_BLOCK_ID);
if (!cookedId.equals(invId)) {
// next result has a different source item than the current one
return 0;
}
Loaded 100 of 135 files, more files were not shown because too many files have changed in this diff. Show more