Commit Graph
54 Commits
Author SHA1 Message Date
Richard Freimer d19f1cd7eb Transporter performance improvements (#5488)
* Improve performance of predicted insert. Don't copy stacks nearly as often

* Cache what stack is in the slots and update comments

* Cleanup up pathfinder code some

* Clean up a bit more mainly TileComponentEjector

* Fix crash caused by an earlier commit

* Minor cleanup

* Minor cleanup

* Slightly clean up TileEntityBin and fix creative bin auto eject lowering item count

* Partially cleanup getpaths, and prep work for better handling of AcceptorData with mulitple TransitResponses

* Scratch previous attempted idea of combining responses

* Use EnumMap instead of HashMap for keeping track of side data for Ejector and prep for an eventual change to TransitResponse of inserting into more than one slot at a time if the stack would be best split among multiple

* Change some more HashMaps to EnumMaps

* Make it easier to read component ejector for gas and fluids

* Inline getStacksToDest so that it can bail even earlier in cases when destination is full

* Don't create a copy of the stack if it won't be inserted AND also fix having broken inserting across multiple slots

* Replace a bunch of other HashMap instances with EnumMap where possible

* Make a couple sets more generic

* Use Int2ObjectMap for int based cache & tidy clamping

* ensure EnumMap doesnt throw NPE

* FastUtil map changes
2019-05-28 09:31:33 -04:00
Richard Freimer 0d4b50908f Formatting and code readability cleanup (#5467)
* First pass reformatting code to be more readable (common still not done)

* Replace google common collect calls with Java calls where possible

* Remove a bunch of unnecessary parenthesis leaving clarifying ones

* Add some missing @Nonnull annotations

* Fix checking wrong type

* Remove unnecessary continue/return statements and simplify comparision check

* Pass exception instead of directly printing stack trace

* Work on cleaning up common, through config so far

* Work on cleaning up common, through integration so far

* Work on cleaning up common, through network so far

* Work on cleaning up common, through tier so far

* Remove empty constructors that get created by default anyways

* Work on cleaning up common, through transmitters so far

* Work on cleaning up common, through utils so far

* Finish cleaning up spacing for common
2019-05-11 14:13:24 -04:00
Richard Freimer b3663a37a9 Emitting logic overhaul (#5422)
* First pass improving performance of EnergyNetwork emitting
Only sends power once per tick per accept now. Lots of comments of design included so that I have a backup of my thought process/solutions if I run into some blocker.

* Optimized implementation slightly, still more to be done

* Cleanup some comments

* Move send energy to acceptor logic to CableUtils
Replace old emit logic in CableUtils with using the newer logic

* Inline getConnections to slightly cut down on number of operations ran

* Fix a couple bugs with targets that have multiple sides
Also improve performance reducing frequency at amountPerChanged needs to be ran

* Improve performance of CableUtils.emit by faking we have one 6 sided target as opposed to having 6 one sided targets

* Allow simulating insertion into the EnergyAcceptorWrapper for IC2

* Fix using wrong value for total acceptor count when acceptors have multiple sides

* Use an EnumMap instead of a HashMap for the Target

* First pass converting gas and fluid network emission to target system

* Improve general fluid and gas emitting using the utility method
Change a couple things to using Sets rather than lists for emitting so that we can ensure each side is only done once.

* Document and cleanup method/variable names of target classes

* Start deduplicating emitting code into a EmitUtils file
Logic for Gas and Fluid emitting fully generic now

* Partially extract how we keep track of the split to make it easier to deduplicate the common code

* Start moving shifting needed to given to the targets themselves

* Use generics to deduplicate a lot of the remaining duplication in the new emitting code

* Fix having broke energy emitting and also further cleanup some code

* Half the number of loops the HeatNetwork does onUpdate

* Fix potentially divide by zero errors

* Deprecate and remove implementations of getAcceptors as it is no longer needed

* Never round up from doubles for sending power stops energy networks going negative.

* Fix more spots where we were accidentally rounding upwards/clamping improperly for energy

* Cleanup impl to use less memory and adjust better as sending if
the possible amount changed/should be adjusted
Also removed the need for a specific IntegerTypeTarget intermediary class

* Cleanup the docs of some of the changed things

* Given tickEmit is private now we already know it is only being called serverside

* Improve documentation slightly and rename a method to be more accurate

* Remove limit on IC2 given it uses doubles as well now

* Rename amountPer to amountPerTarget
2019-04-30 10:25:23 -04:00
Aidan 934788e0e7 Transit request overhaul (#135)
* Fix a pretty glaring issue in Pos3D equality checks
* TransitRequest/TransitResponse overhaul. Items can now be pulled from multiple slots at once by Logistical Transporter and Logistical Sorter. getTopStacks() is now buildInventoryMap() and is more comprehensive of a total inventory. Note this is entirely untested and may have some issues to work out!
* Cache hash code of HashedItem
* Remove ISidedInventory/IInventory implementations
2019-03-29 08:00:18 -06:00
pupnewfster 21017efc68 Don't reference main class from API package
https://github.com/mekanism-mod/Mekanism/commit/7c50d1e7cc3dd915979304b46e77a36068ac457d
2019-03-21 10:53:28 -04:00
Dave Smith e0b7ea62a4 The Great Reformat; moving to google-java-style w/ 4 space indent and 120 column line wrap 2019-03-09 22:47:13 -07:00
Dave Smith 8d3f8df49c Updating to 14.23.5.2808; naming fixes where necessary 2019-02-24 12:21:48 -07:00
Xander Victory 2411a1be4d change ArrayList<Object> to a non null list implementation for network data 2017-11-08 15:08:51 +08:00
Tom Elfring b72d6efab3 Java 7 and 8 cleanup
Diamond operator <>
Lambdas and method references
2017-08-05 17:50:38 +02:00
Richard Carter bc3274825a Some performance-oriented refactoring of TileComponentConfig
Add new type "SideConfig" which is observable, this could come in handy
later.
Add hasSideForData method in componentConfig, which is much more
efficient than calling getSidesForData().contains.
Refactor duplicate calls to getConfig into single instances. getConfig
is a nontrivial method.
2017-07-23 20:14:34 -04:00
aidancbrady ba3c37b6c3 Updated Forge 2017-05-24 09:56:21 -07:00
aidancbrady 21c49c1643 Advanced item handing, adding inventory-searching to basic item ejection- no longer will items get jammed
Also, fixed transmitter tooltips
2017-04-28 14:54:26 -04:00
aidancbrady 808f0cdf8a More refactoring, gave Rotary Condensentrator and Electrolytic Separator sound effects. Need to fix bugs 2017-04-27 22:51:44 -04:00
aidancbrady b97b7184c1 Completely refactor inventory management to allow IItemHandler support. Likely many bugs to fix, but it's a start 2017-04-19 16:16:09 -04:00
aidancbrady c9cbb405d4 More API fixes 2017-04-13 16:15:26 -04:00
aidancbrady 4733420eee API improvements 2017-04-12 20:23:16 -04:00
aidancbrady 6eb8e59f3c Fix more ItemStack issues 2017-04-03 20:12:02 -04:00
aidancbrady 6a42eb64e3 Update to 1.11.2. Untested, still using outdated MCMP 2017-03-25 20:35:26 -04:00
aidancbrady ecba0eaa87 Merge branch 'development' into 1.9.4
* development:
  Fixed side output issue

Conflicts:
	src/main/java/mekanism/common/tile/component/TileComponentEjector.java
2016-07-15 15:13:28 -04:00
aidancbrady ca52ba521b Fixed side output issue 2016-07-15 00:06:15 -04:00
aidancbrady e6da7fdc9c Update to latest Forge, use Capability standards. Need to port to new fluid system 2016-06-23 16:34:27 -04:00
aidancbrady a5f4457677 Merge branch 'development' into 1.9.4
* development:
  Update pt_BR.lang
  Allow shift-right clicking machines with upgrades
  Fixed NBT reference losses
  Fixed Thermal Evaporation Controller computer integration
  Add config option for transmitter alloy upgrades
  Fixed transmitter crash, fixed entangloporter frequency issue, fixed PRC muffling upgrades

Conflicts:
	src/main/java/mekanism/client/render/RenderPartTransmitter.java
	src/main/java/mekanism/common/FluidNetwork.java
	src/main/java/mekanism/common/item/ItemAlloy.java
	src/main/java/mekanism/common/item/ItemUpgrade.java
	src/main/java/mekanism/common/util/PipeUtils.java
2016-06-15 20:41:32 -04:00
aidancbrady 6340bb3cdc Fixed NBT reference losses 2016-06-10 11:30:03 -04:00
aidancbrady fa24e0e780 Isolate MDK, update build script. Gonna try to get this pushing to the dev server 2016-05-28 19:14:18 -07:00
aidancbrady c9f8fd011e Polished capabilities, still need to decide if we're allowed to ship capability references in API 2016-05-27 14:02:15 -04:00
Ben Spiers 918eadde7e Make transmitters kinda sorta work properly 2016-05-07 13:41:35 +01:00
Ben Spiers 384cf174bb Get capabilities off the ground 2016-05-04 12:45:12 +01:00
Ben Spiers 0cb18773aa Merge branch 'development' into 1.8.9 2016-04-25 16:08:06 +01:00
aidancbrady 1b2aee283e Work on security framework 2016-03-19 22:03:17 -04:00
Ben Spiers 84336ec4d1 Merge branch 'development' into 1.8.9
Huge merge with 202 conflicts, hopefully not *too* broken.
2016-03-18 04:24:19 +00:00
aidancbrady 866c76bafe Redesigned Filter Cards to serve as Configuration Cards, fixed inventory interaction bug, fixed Creative Energy Cube bug, added new recipes 2016-03-05 13:17:58 -05:00
aidancbrady 668643e663 Entangloporters work perfectly! 2016-03-04 21:58:13 -05:00
aidancbrady c03b712ed2 More work. I'm gonna let the configuration component determine send/receive instead of cluttering the GUI more 2016-03-04 12:07:34 -05:00
Ben Spiers 62e7cc8f65 Merge branch 'v9' into 1.8.9 2016-01-30 00:47:54 +00:00
aidancbrady 06dc2227f2 A few ejector fixes 2016-01-28 23:45:22 -07:00
Ben Spiers a27c9b6839 tile package done, except for TEDigitalMiner 2016-01-25 04:36:00 +00:00
Ben Spiers a80f724cc2 Apply various common one-to-one replacements
More work on common too. network package now done.
2016-01-23 13:24:51 +00:00
Ben Spiers 4247ba136a Fix compile errors in API package 2016-01-16 14:35:01 +00:00
Ben Spiers f4a6fb8274 Do some things I TODOed earlier 2015-04-06 04:32:47 +01:00
Ben Spiers 7a2461540f Merge branch 'development' into networkRefactor.
Hopefully I didn't miss anything

Conflicts:
	src/main/java/mekanism/api/gas/GasNetwork.java
	src/main/java/mekanism/client/render/RenderPartTransmitter.java
	src/main/java/mekanism/common/EnergyNetwork.java
	src/main/java/mekanism/common/FluidNetwork.java
	src/main/java/mekanism/common/InventoryNetwork.java
	src/main/java/mekanism/common/content/transporter/TransporterStack.java
	src/main/java/mekanism/common/multipart/PartHeatTransmitter.java
	src/main/java/mekanism/common/multipart/PartLogisticalTransporter.java
	src/main/java/mekanism/common/multipart/PartMechanicalPipe.java
	src/main/java/mekanism/common/multipart/PartPressurizedTube.java
	src/main/java/mekanism/common/multipart/PartSidedPipe.java
	src/main/java/mekanism/common/multipart/PartUniversalCable.java
	src/main/java/mekanism/common/util/MekanismUtils.java
	src/main/java/mekanism/common/util/PipeUtils.java
2015-04-03 19:45:25 +01:00
Ben Spiers 47b4eb28b4 Start on refactor of entire network system.
It will hopefully make networks more robust and efficient, using lessons learned since last time I rewrote large parts of it.
We can hopefully avoid Concurrent Modification issues this way, and it should be more forgiving on chunk loads as well.
Transmitter stuff is working well, next acceptors and client rendering need tobe brought in.
2015-04-01 02:42:36 +01:00
Aidan C. Brady e4d624d8ab Fancy new eject algorithms, should fix issues with PRC 2015-03-30 19:27:54 -04:00
Aidan C. Brady b4c2664c5e Work a bit on a new, dynamic ejector system 2015-03-30 08:39:37 -04:00
Aidan C. Brady d88f8a4606 Fixed upgrades not maintaining machine dataa 2015-03-25 23:51:46 -04:00
Aidan C. Brady 3f41027325 Started work on the new configuration interfaces, separated the transporter configuration from general side configuration, reorganized GUI elements into their own package 2015-03-07 21:08:28 -05:00
Aidan C. Brady d4d7e88c4e Developed and implemented the foundation for Item/Gas/Energy/Fluid/Heat dynamic side configuration.
As of now, only items are supported, and the actual config GUI has not been changed. Only gameplay difference is three new configurator modes.
2015-03-07 19:09:23 -05:00
Ben Spiers fab95e8900 Re-organise imports.
I went for what seemed like a good level of organisation:

Java
__________
Mekanism
__________
Minecraft
Forge
FML
__________
Netty
LWJGL
__________
Other APIs
__________
Static Imports.
2014-09-03 19:00:03 +01:00
Aidan C. Brady 80021dd4c7 Work on path caching 2014-08-20 15:54:05 -04:00
Aidan C. Brady 275c7840cc Reorganized package structure to separate content from base code 2014-08-20 15:22:55 -04:00
Aidan Brady 1d6de974d3 A bit of package reorganization, added InventoryNetwork to transporters 2014-08-09 22:20:49 -04:00