diff --git a/build.gradle b/build.gradle index daf715cf9..04923a4e7 100644 --- a/build.gradle +++ b/build.gradle @@ -84,6 +84,8 @@ dependencies { compileOnly "mezz.jei:jei-${minecraft_version}-common-api:${jei_version}" compileOnly "mezz.jei:jei-${minecraft_version}-neoforge-api:${jei_version}" localRuntime "mezz.jei:jei-${minecraft_version}-neoforge:${jei_version}" + compileOnly "mekanism:Mekanism:${mekanism_version}" + //runtimeOnly "mekanism:Mekanism:${mekanism_version}" } diff --git a/gradle.properties b/gradle.properties index 374be4077..b99dfb657 100644 --- a/gradle.properties +++ b/gradle.properties @@ -24,6 +24,7 @@ loader_version_range=[4,) # Dependency parameters jei_version=19.21.0.246 +mekanism_version=1.21.1-10.7.0.55 # Parchment parameters neogradle.subsystems.parchment.minecraftVersion=1.21 diff --git a/runs/client/command_history.txt b/runs/client/command_history.txt index 45c3727c0..4ba545aa0 100644 --- a/runs/client/command_history.txt +++ b/runs/client/command_history.txt @@ -34,3 +34,10 @@ /time set da /time set day /gamerule doDaylightCycle false +/time set night +/time set mid +/time set midnight +/tps +/neoforge tps +/setblock 11 -62 -5 air +/setblock 11 -61 -5 air diff --git a/runs/client/defaultconfigs/electrodynamics.txt b/runs/client/defaultconfigs/electrodynamics.txt index 6ce00003a..cd10d363a 100644 --- a/runs/client/defaultconfigs/electrodynamics.txt +++ b/runs/client/defaultconfigs/electrodynamics.txt @@ -14,6 +14,8 @@ I:default=100 -> ELECTRICFURNACE_REQUIRED_TICKS='100' D:default=175.0 -> ELECTRICARCFURNACE_USAGE_PER_TICK='175.0' I:default=50 -> ELECTRICARCFURNACE_REQUIRED_TICKS='50' D:default=125.0 -> WIREMILL_USAGE_PER_TICK='125.0' +D:default=1000.0 -> ROTARY_UNIFIER_USAGE='1000.0' +I:default=1 -> ROTARY_UNIFIER_CONVERSION_RATE='1' I:default=200 -> WIREMILL_REQUIRED_TICKS='200' D:default=350.0 -> COMBUSTIONCHAMBER_JOULES_PER_TICK='350.0' D:default=1000.0 -> CHARGER_USAGE_PER_TICK='1000.0' diff --git a/runs/client/usercache.json b/runs/client/usercache.json index 6ecd3c10f..4e5e82172 100644 --- a/runs/client/usercache.json +++ b/runs/client/usercache.json @@ -1 +1 @@ -[{"name":"Dev","uuid":"380df991-f603-344c-a090-369bad2a924a","expiresOn":"2025-02-04 13:58:10 -0600"}] \ No newline at end of file +[{"name":"Dev","uuid":"380df991-f603-344c-a090-369bad2a924a","expiresOn":"2025-02-14 16:53:57 -0600"}] \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index d53b9a830..b8f8329d5 100644 --- a/settings.gradle +++ b/settings.gradle @@ -2,24 +2,27 @@ pluginManagement { repositories { mavenLocal() gradlePluginPortal() - maven { - url = 'https://maven.neoforged.net/releases' - } - maven { - // location of the maven that hosts JEI files since January 2023 - name = "Jared's maven" - url = "https://maven.blamejared.com/" - } - maven { - // location of a maven mirror for JEI files, as a fallback - name = "ModMaven" - url = "https://modmaven.dev" - } - maven { + maven { + url = 'https://maven.neoforged.net/releases' + } + maven { + // location of the maven that hosts JEI files since January 2023 + name = "Jared's maven" + url = "https://maven.blamejared.com/" + } + maven { + // location of a maven mirror for JEI files, as a fallback + name = "ModMaven" + url = "https://modmaven.dev" + } + maven { url "https://plugins.gradle.org/m2/" } + maven { + url "https://cursemaven.com" + } } - + } plugins { diff --git a/src/generated/resources/assets/electrodynamics/blockstates/rotaryunifier.json b/src/generated/resources/assets/electrodynamics/blockstates/rotaryunifier.json new file mode 100644 index 000000000..bce6c014d --- /dev/null +++ b/src/generated/resources/assets/electrodynamics/blockstates/rotaryunifier.json @@ -0,0 +1,19 @@ +{ + "variants": { + "facing=east": { + "model": "electrodynamics:block/rotaryunifier" + }, + "facing=north": { + "model": "electrodynamics:block/rotaryunifier", + "y": 270 + }, + "facing=south": { + "model": "electrodynamics:block/rotaryunifier", + "y": 90 + }, + "facing=west": { + "model": "electrodynamics:block/rotaryunifier", + "y": 180 + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/electrodynamics/lang/en_us.json b/src/generated/resources/assets/electrodynamics/lang/en_us.json index 0f8c61c32..b40e78138 100644 --- a/src/generated/resources/assets/electrodynamics/lang/en_us.json +++ b/src/generated/resources/assets/electrodynamics/lang/en_us.json @@ -227,6 +227,7 @@ "block.electrodynamics.resourceblocktitanium": "Block of Titanium", "block.electrodynamics.resourceblocktitaniumcarbide": "Block of Titanium Carbide", "block.electrodynamics.resourceblockvanadiumsteel": "Block of Vanadium Steel", + "block.electrodynamics.rotaryunifier": "Rotary Unifier", "block.electrodynamics.seismicmarker": "Seismic Marker", "block.electrodynamics.seismicrelay": "Seismic Relay", "block.electrodynamics.solarpanel": "Solar Panel", @@ -476,6 +477,7 @@ "container.potentiometer": "Potentiometer", "container.quarry": "Quarry", "container.reinforcedalloyer": "Reinforced Alloyer", + "container.rotaryunifier": "Rotary Unifier", "container.seismicrelay": "Seismic Relay", "container.seismicscanner": "Sonic Scanner", "container.solarpanel": "Solar Panel", @@ -1428,8 +1430,6 @@ "tooltip.electrodynamics.guidebookjeiuse": "Press 'U' for uses", "tooltip.electrodynamics.guidebookname": "AKA Guidebook", "tooltip.electrodynamics.info.broken": "NOT WORKING", - "tooltip.electrodynamics.info.capacityupgrade": "Multiplies Energy Capacity and Transfer by %sx", - "tooltip.electrodynamics.info.capacityupgradevoltage": "Will upgrade machine voltage up to %s", "tooltip.electrodynamics.info.cleardirs": "Shift+Left-Click to clear directions", "tooltip.electrodynamics.info.dirlist": "Current Directions:", "tooltip.electrodynamics.info.guidebooktemp": "Book Coming Soon", @@ -1439,8 +1439,12 @@ "tooltip.electrodynamics.info.itemoutputupgrade": "Ejects items into adjacent inventories", "tooltip.electrodynamics.info.nodirs": "Shift+Right-Click to add a direction", "tooltip.electrodynamics.info.range": "Increases raduis by 1", - "tooltip.electrodynamics.info.speedupgrade": "Multiplies Speed by %sx", "tooltip.electrodynamics.info.togglesmart": "Right-Click to toggle smart mode.", + "tooltip.electrodynamics.info.upgradecapacity": "Capacity: %s", + "tooltip.electrodynamics.info.upgradeenergytransfer": "Energy Transfer: %s", + "tooltip.electrodynamics.info.upgradeenergyusage": "Usage: %s", + "tooltip.electrodynamics.info.upgradespeed": "Speed: %s", + "tooltip.electrodynamics.info.upgradevoltage": "Voltage: %s", "tooltip.electrodynamics.info.xpstored": "Stored XP: %s", "tooltip.electrodynamics.info.xpusage": "Shift+Right-Click to dispense", "tooltip.electrodynamics.inventoryio": "Inventory I/O", @@ -1453,9 +1457,8 @@ "tooltip.electrodynamics.inventoryio.right": "Right", "tooltip.electrodynamics.inventoryio.slotmap": "Slot Map", "tooltip.electrodynamics.inventoryio.top": "Top", - "tooltip.electrodynamics.item.electric.info": "Energy Stored: %s", - "tooltip.electrodynamics.item.electric.voltage": "I/O Voltage: %s", - "tooltip.electrodynamics.itemcanister": "1000 mB", + "tooltip.electrodynamics.item.electric.info": "Stored: %s", + "tooltip.electrodynamics.item.electric.voltage": "Voltage: %s", "tooltip.electrodynamics.itemwire.info.fireproof": "Fire-proof", "tooltip.electrodynamics.itemwire.info.insulationrating": "Insulation Rating: %s", "tooltip.electrodynamics.itemwire.info.redstone": "Conducts Redstone", @@ -1485,11 +1488,15 @@ "tooltip.electrodynamics.pipematerialplastic": "Plastic", "tooltip.electrodynamics.pipematerialsteel": "Steel", "tooltip.electrodynamics.pipemaximumpressure": "Max Pressure: %s", + "tooltip.electrodynamics.pipethroughput": "Throughput: %s", "tooltip.electrodynamics.potentiometer.use": "A programmable energy void", "tooltip.electrodynamics.quarry.power": "Upgrades require power to work", "tooltip.electrodynamics.railgunmaxtemp": "Max Temp: %s", "tooltip.electrodynamics.railgunoverheat": "WARNING : OVERHEATING", "tooltip.electrodynamics.railguntemp": "Temperature %s", + "tooltip.electrodynamics.rotaryunifier.toggle": "Toggle Conversion", + "tooltip.electrodynamics.rotaryunifier.use1": "Gas must be 1 degree above", + "tooltip.electrodynamics.rotaryunifier.use2": "condensation temperature", "tooltip.electrodynamics.scannerpattern": "Sonar Pattern", "tooltip.electrodynamics.seismicmarker.redstone": "Apply redstone for guide lines", "tooltip.electrodynamics.seismicrelay.use": "Detects and stores Marker rings", @@ -1505,6 +1512,6 @@ "tooltip.electrodynamics.servolegs.step": "STEP", "tooltip.electrodynamics.tankmaxin": "In %1$s : %2$s", "tooltip.electrodynamics.tankmaxout": "Out %1$s : %2$s", - "tooltip.electrodynamics.transformer.energyloss": "Efficiency: 99.25%", + "tooltip.electrodynamics.transformer.energyloss": "Efficiency: %s", "tooltip.electrodynamics.validupgrades": "Valid Upgrades:" } \ No newline at end of file diff --git a/src/generated/resources/assets/electrodynamics/models/item/rotaryunifier.json b/src/generated/resources/assets/electrodynamics/models/item/rotaryunifier.json new file mode 100644 index 000000000..7cd35bbb9 --- /dev/null +++ b/src/generated/resources/assets/electrodynamics/models/item/rotaryunifier.json @@ -0,0 +1,3 @@ +{ + "parent": "electrodynamics:block/rotaryunifier" +} \ No newline at end of file diff --git a/src/generated/resources/data/electrodynamics/loot_table/blocks/rotaryunifier.json b/src/generated/resources/data/electrodynamics/loot_table/blocks/rotaryunifier.json new file mode 100644 index 000000000..f44bfa300 --- /dev/null +++ b/src/generated/resources/data/electrodynamics/loot_table/blocks/rotaryunifier.json @@ -0,0 +1,17 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "name": "electrodynamics:rotaryunifier" + } + ], + "name": "rotaryunifier", + "rolls": 1.0 + } + ], + "random_sequence": "electrodynamics:blocks/rotaryunifier" +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/tags/block/mineable/pickaxe.json b/src/generated/resources/data/minecraft/tags/block/mineable/pickaxe.json index bef317be5..d883f6e21 100644 --- a/src/generated/resources/data/minecraft/tags/block/mineable/pickaxe.json +++ b/src/generated/resources/data/minecraft/tags/block/mineable/pickaxe.json @@ -1,307 +1,307 @@ { "values": [ - "electrodynamics:oresylvite", + "electrodynamics:oremolybdenum", + "electrodynamics:oresalt", + "electrodynamics:oreuranium", + "electrodynamics:orevanadium", + "electrodynamics:orechromium", + "electrodynamics:oresulfur", + "electrodynamics:oreniter", "electrodynamics:orefluorite", "electrodynamics:orelead", "electrodynamics:oremonazite", - "electrodynamics:oreuranium", - "electrodynamics:oremolybdenum", - "electrodynamics:oresilver", - "electrodynamics:oresulfur", "electrodynamics:oretitanium", - "electrodynamics:oresalt", - "electrodynamics:orethorium", - "electrodynamics:orevanadium", "electrodynamics:oretin", - "electrodynamics:orechromium", - "electrodynamics:orelithium", + "electrodynamics:orethorium", "electrodynamics:orealuminum", - "electrodynamics:oreniter", - "electrodynamics:deepslateorefluorite", - "electrodynamics:deepslateoretitanium", - "electrodynamics:deepslateorelithium", - "electrodynamics:deepslateorealuminum", - "electrodynamics:deepslateoresalt", - "electrodynamics:deepslateorevanadium", + "electrodynamics:oresilver", + "electrodynamics:orelithium", + "electrodynamics:oresylvite", + "electrodynamics:deepslateoreniter", "electrodynamics:deepslateoretin", - "electrodynamics:deepslateoremonazite", - "electrodynamics:deepslateoresylvite", + "electrodynamics:deepslateoresalt", + "electrodynamics:deepslateorelead", + "electrodynamics:deepslateoresulfur", "electrodynamics:deepslateorechromium", "electrodynamics:deepslateoresilver", - "electrodynamics:deepslateoresulfur", - "electrodynamics:deepslateoreuranium", - "electrodynamics:deepslateoreniter", - "electrodynamics:deepslateorethorium", - "electrodynamics:deepslateorelead", "electrodynamics:deepslateoremolybdenum", - "electrodynamics:raworeblockchromium", + "electrodynamics:deepslateorelithium", + "electrodynamics:deepslateoremonazite", + "electrodynamics:deepslateorealuminum", + "electrodynamics:deepslateorethorium", + "electrodynamics:deepslateoresylvite", + "electrodynamics:deepslateoreuranium", + "electrodynamics:deepslateorevanadium", + "electrodynamics:deepslateoretitanium", + "electrodynamics:deepslateorefluorite", "electrodynamics:raworeblocktin", + "electrodynamics:raworeblockchromium", "electrodynamics:raworeblockuranium", - "electrodynamics:raworeblocklead", - "electrodynamics:raworeblockthorium", "electrodynamics:raworeblocksilver", + "electrodynamics:raworeblocklead", "electrodynamics:raworeblocktitanium", + "electrodynamics:raworeblockthorium", + "electrodynamics:creativepowersource", + "electrodynamics:electricarcfurnacedouble", "electrodynamics:circuitmonitor", - "electrodynamics:electricarcfurnace", - "electrodynamics:wiremilldouble", + "electrodynamics:creativefluidsource", + "electrodynamics:coalgenerator", + "electrodynamics:gastankreinforced", + "electrodynamics:circuitbreaker", + "electrodynamics:electricfurnace", + "electrodynamics:windmill", + "electrodynamics:mineralwasher", + "electrodynamics:tankhsla", + "electrodynamics:gaspipepump", "electrodynamics:mineralcrusherdouble", - "electrodynamics:electrolosischamber", - "electrodynamics:gasvalve", - "electrodynamics:energizedalloyer", - "electrodynamics:quarry", - "electrodynamics:motorcomplex", - "electrodynamics:fermentationplant", - "electrodynamics:wiremilltriple", + "electrodynamics:lithiumbatterybox", "electrodynamics:combustionchamber", - "electrodynamics:potentiometer", + "electrodynamics:gaspipefilter", + "electrodynamics:chargerhv", + "electrodynamics:quarry", + "electrodynamics:advanceddowngradetransformer", + "electrodynamics:electricpump", + "electrodynamics:chargerlv", + "electrodynamics:gastanksteel", + "electrodynamics:lathe", "electrodynamics:fluidpipefilter", + "electrodynamics:wiremilldouble", + "electrodynamics:downgradetransformer", "electrodynamics:mineralgrindertriple", - "electrodynamics:seismicrelay", - "electrodynamics:relay", - "electrodynamics:batterybox", - "electrodynamics:lithiumbatterybox", "electrodynamics:thermoelectricgenerator", - "electrodynamics:gastankhsla", + "electrodynamics:advancedupgradetransformer", + "electrodynamics:coolantresavoir", + "electrodynamics:mineralcrushertriple", + "electrodynamics:batterybox", + "electrodynamics:electrolosischamber", "electrodynamics:electricfurnacetriple", - "electrodynamics:upgradetransformer", - "electrodynamics:fluidvalve", - "electrodynamics:chargermv", - "electrodynamics:mineralgrinder", + "electrodynamics:fermentationplant", + "electrodynamics:energizedalloyer", "electrodynamics:electricarcfurnacetriple", - "electrodynamics:chemicalmixer", - "electrodynamics:gaspipefilter", + "electrodynamics:seismicrelay", + "electrodynamics:tankreinforced", + "electrodynamics:solarpanel", "electrodynamics:advancedsolarpanel", - "electrodynamics:circuitbreaker", - "electrodynamics:tanksteel", - "electrodynamics:creativegassource", - "electrodynamics:chargerhv", - "electrodynamics:mineralcrushertriple", - "electrodynamics:multimeterblock", - "electrodynamics:hydroelectricgenerator", - "electrodynamics:coolantresavoir", - "electrodynamics:electricfurnace", - "electrodynamics:creativefluidsource", - "electrodynamics:advanceddowngradetransformer", + "electrodynamics:chargermv", "electrodynamics:mineralcrusher", - "electrodynamics:windmill", - "electrodynamics:gastankreinforced", + "electrodynamics:reinforcedalloyer", "electrodynamics:carbynebatterybox", - "electrodynamics:tankreinforced", - "electrodynamics:fluidvoid", - "electrodynamics:electricfurnacedouble", - "electrodynamics:fluidpipepump", - "electrodynamics:mineralwasher", - "electrodynamics:coalgenerator", - "electrodynamics:wiremill", - "electrodynamics:creativepowersource", - "electrodynamics:downgradetransformer", - "electrodynamics:gasvent", - "electrodynamics:advancedupgradetransformer", "electrodynamics:currentregulator", - "electrodynamics:chemicalcrystallizer", - "electrodynamics:electricarcfurnacedouble", - "electrodynamics:electricpump", - "electrodynamics:reinforcedalloyer", + "electrodynamics:upgradetransformer", + "electrodynamics:tanksteel", + "electrodynamics:wiremill", + "electrodynamics:creativegassource", "electrodynamics:gascollector", + "electrodynamics:mineralgrinderdouble", + "electrodynamics:gasvalve", "electrodynamics:oxidationfurnace", - "electrodynamics:tankhsla", + "electrodynamics:fluidvalve", + "electrodynamics:fluidvoid", + "electrodynamics:gasvent", + "electrodynamics:gastankhsla", + "electrodynamics:electricarcfurnace", + "electrodynamics:relay", + "electrodynamics:chemicalcrystallizer", + "electrodynamics:multimeterblock", + "electrodynamics:mineralgrinder", + "electrodynamics:fluidpipepump", + "electrodynamics:electricfurnacedouble", + "electrodynamics:hydroelectricgenerator", + "electrodynamics:chemicalmixer", + "electrodynamics:motorcomplex", + "electrodynamics:wiremilltriple", "electrodynamics:electrolyticseparator", - "electrodynamics:gaspipepump", - "electrodynamics:gastanksteel", - "electrodynamics:mineralgrinderdouble", - "electrodynamics:solarpanel", - "electrodynamics:chargerlv", - "electrodynamics:lathe", - "electrodynamics:wireinsulatedsilverwhite", - "electrodynamics:wirehighlyinsulatedsilverblue", - "electrodynamics:wireinsulatedsuperconductiveyellow", - "electrodynamics:wirehighlyinsulatedcopperyellow", - "electrodynamics:wirelogisticstinblue", - "electrodynamics:wireinsulatedsuperconductivegreen", - "electrodynamics:wirehighlyinsulatedgoldgreen", - "electrodynamics:wireceramicinsulatedcopperwhite", - "electrodynamics:wirelogisticsgoldyellow", - "electrodynamics:wirelogisticsgoldred", - "electrodynamics:wirelogisticsirongreen", - "electrodynamics:wirehighlyinsulatedsuperconductivered", - "electrodynamics:wirehighlyinsulatedsilverwhite", - "electrodynamics:wirehighlyinsulatedsuperconductivewhite", - "electrodynamics:wireinsulatedironred", - "electrodynamics:wireinsulatedsuperconductivewhite", - "electrodynamics:wireinsulatedgoldyellow", - "electrodynamics:wirelogisticsironbrown", - "electrodynamics:wireinsulatedironblue", - "electrodynamics:wirehighlyinsulatedsuperconductivegreen", - "electrodynamics:wireceramicinsulatedtinblue", - "electrodynamics:wireinsulatedcopperred", - "electrodynamics:wireiron", - "electrodynamics:wirehighlyinsulatedgoldyellow", - "electrodynamics:wirehighlyinsulatedcopperwhite", - "electrodynamics:wireceramicinsulatedcopperblue", - "electrodynamics:wireceramicinsulatedsuperconductivebrown", + "electrodynamics:potentiometer", + "electrodynamics:wireinsulatedcopperwhite", + "electrodynamics:wireceramicinsulatedsilveryellow", + "electrodynamics:wirelogisticssilverwhite", + "electrodynamics:wireceramicinsulatedsuperconductiveblue", + "electrodynamics:wireceramicinsulatedirongreen", "electrodynamics:wireinsulatedgoldblue", + "electrodynamics:wirehighlyinsulatedironbrown", + "electrodynamics:wirehighlyinsulatedsuperconductivegreen", + "electrodynamics:wirelogisticscoppergreen", + "electrodynamics:wirelogisticssuperconductivered", + "electrodynamics:wireceramicinsulatedcopperwhite", + "electrodynamics:wirehighlyinsulatedironblue", + "electrodynamics:wireceramicinsulatedironblue", "electrodynamics:wireceramicinsulatedcopperbrown", - "electrodynamics:wirehighlyinsulatedsuperconductiveyellow", + "electrodynamics:wireinsulatedcopperbrown", + "electrodynamics:wirehighlyinsulatedgoldbrown", + "electrodynamics:wireinsulatedsuperconductiveblack", + "electrodynamics:wireceramicinsulatedgoldblue", + "electrodynamics:wireinsulatedgoldyellow", + "electrodynamics:wirehighlyinsulatedgoldblue", "electrodynamics:wirelogisticstinbrown", - "electrodynamics:wirehighlyinsulatedcopperbrown", - "electrodynamics:wireinsulatedsilveryellow", - "electrodynamics:wirehighlyinsulatedtinbrown", - "electrodynamics:wirelogisticscopperwhite", - "electrodynamics:wirehighlyinsulatedsilverred", - "electrodynamics:wirehighlyinsulatedsuperconductiveblack", "electrodynamics:wirehighlyinsulatedsuperconductivebrown", - "electrodynamics:wireceramicinsulatedcoppergreen", - "electrodynamics:wirehighlyinsulatedtinblack", - "electrodynamics:wireceramicinsulatedsuperconductivewhite", + "electrodynamics:wireceramicinsulatedsilverred", + "electrodynamics:wirelogisticssuperconductivegreen", + "electrodynamics:wirelogisticscopperblack", "electrodynamics:wireceramicinsulatedsilverblue", - "electrodynamics:wirelogisticscopperblue", - "electrodynamics:wireceramicinsulatedsuperconductivegreen", - "electrodynamics:wireceramicinsulatedtinwhite", - "electrodynamics:wireceramicinsulatedcopperyellow", - "electrodynamics:wireinsulatedcopperblack", - "electrodynamics:wireceramicinsulatedgoldyellow", - "electrodynamics:wireinsulatedsilverred", - "electrodynamics:wireceramicinsulatedsilverblack", - "electrodynamics:wirehighlyinsulatedgoldwhite", - "electrodynamics:wireinsulatedirongreen", - "electrodynamics:wirehighlyinsulatedcopperblue", - "electrodynamics:wirehighlyinsulatedirongreen", - "electrodynamics:wireceramicinsulatedtinblack", - "electrodynamics:wireceramicinsulatedironyellow", - "electrodynamics:wirelogisticsgoldbrown", - "electrodynamics:wirelogisticsgoldblue", - "electrodynamics:wireceramicinsulatedsilverwhite", - "electrodynamics:wireinsulatedironyellow", - "electrodynamics:wirelogisticssilverwhite", - "electrodynamics:wireinsulatedtinblue", - "electrodynamics:wireceramicinsulatedtinyellow", - "electrodynamics:wirelogisticsgoldwhite", - "electrodynamics:wireinsulatedsilverblack", - "electrodynamics:wireinsulatedtinblack", - "electrodynamics:wirelogisticssuperconductiveblack", - "electrodynamics:wireinsulatedironbrown", - "electrodynamics:wireceramicinsulatedtinred", - "electrodynamics:wireinsulatedironwhite", - "electrodynamics:wirelogisticsgoldblack", - "electrodynamics:wirehighlyinsulatedgoldred", - "electrodynamics:wirelogisticssilverblack", + "electrodynamics:wireinsulatedtinwhite", + "electrodynamics:wireinsulatedironblue", + "electrodynamics:wirehighlyinsulatedtinyellow", "electrodynamics:wirelogisticsironwhite", - "electrodynamics:wirelogisticscopperred", - "electrodynamics:wireceramicinsulatedsilvergreen", - "electrodynamics:wiresuperconductive", - "electrodynamics:wireinsulatedgoldred", - "electrodynamics:wireceramicinsulatedironred", - "electrodynamics:wireceramicinsulatedsilverbrown", - "electrodynamics:wireinsulatedcopperwhite", - "electrodynamics:wireceramicinsulatedtingreen", - "electrodynamics:wirehighlyinsulatedironblack", - "electrodynamics:wireceramicinsulatedgoldgreen", - "electrodynamics:wireinsulatedsuperconductiveblack", + "electrodynamics:wirehighlyinsulatedtinbrown", + "electrodynamics:wireinsulatedcoppergreen", "electrodynamics:wirelogisticssilveryellow", - "electrodynamics:wirelogisticssuperconductiveyellow", - "electrodynamics:wireinsulatedironblack", + "electrodynamics:wireinsulatedsilverblue", + "electrodynamics:wireinsulatedironbrown", + "electrodynamics:wireiron", + "electrodynamics:wireceramicinsulatedtingreen", + "electrodynamics:wirehighlyinsulatedsilverblack", "electrodynamics:wireceramicinsulatedtinbrown", + "electrodynamics:wirelogisticsgoldwhite", + "electrodynamics:wirehighlyinsulatedironblack", + "electrodynamics:wirehighlyinsulatedironwhite", + "electrodynamics:wireceramicinsulatedcopperred", "electrodynamics:wirelogisticssilverbrown", - "electrodynamics:wirehighlyinsulatedironred", - "electrodynamics:wirehighlyinsulatedgoldbrown", - "electrodynamics:wireinsulatedtinwhite", - "electrodynamics:wirehighlyinsulatedironbrown", - "electrodynamics:wireceramicinsulatedsuperconductiveyellow", - "electrodynamics:wireinsulatedcopperbrown", - "electrodynamics:wirelogisticssuperconductivegreen", - "electrodynamics:wirelogisticssilverblue", - "electrodynamics:wirelogisticssuperconductiveblue", "electrodynamics:wireceramicinsulatedcopperblack", - "electrodynamics:wirehighlyinsulatedsilveryellow", - "electrodynamics:wireinsulatedtinbrown", - "electrodynamics:wireceramicinsulatedgoldbrown", - "electrodynamics:wirelogisticscopperbrown", + "electrodynamics:wirehighlyinsulatedsuperconductiveblack", "electrodynamics:wireinsulatedgoldwhite", - "electrodynamics:wireinsulatedcoppergreen", - "electrodynamics:wirehighlyinsulatedtinwhite", - "electrodynamics:wirelogisticstinwhite", - "electrodynamics:wirelogisticsgoldgreen", + "electrodynamics:wirehighlyinsulatedsuperconductiveyellow", + "electrodynamics:wirehighlyinsulatedtingreen", "electrodynamics:wirelogisticstinyellow", - "electrodynamics:wireceramicinsulatedironblue", - "electrodynamics:wireinsulatedcopperyellow", - "electrodynamics:wirelogisticstinblack", - "electrodynamics:wirehighlyinsulatedcopperred", - "electrodynamics:wiretin", + "electrodynamics:wirehighlyinsulatedgoldyellow", + "electrodynamics:wiregold", + "electrodynamics:wirehighlyinsulatedsilverred", + "electrodynamics:wirelogisticsgoldgreen", + "electrodynamics:wirelogisticsgoldred", + "electrodynamics:wirehighlyinsulatedirongreen", + "electrodynamics:wireceramicinsulatedsuperconductiveblack", + "electrodynamics:wireinsulatedsuperconductivewhite", + "electrodynamics:wirehighlyinsulatedgoldred", + "electrodynamics:wireceramicinsulatedtinwhite", + "electrodynamics:wireceramicinsulatedsilverbrown", + "electrodynamics:wiresilver", + "electrodynamics:wirelogisticstinred", + "electrodynamics:wirelogisticsgoldblack", + "electrodynamics:wireceramicinsulatedironblack", + "electrodynamics:wireinsulatedironred", + "electrodynamics:wirelogisticssuperconductiveyellow", "electrodynamics:wireinsulatedcopperblue", - "electrodynamics:wirehighlyinsulatedtinblue", - "electrodynamics:wireceramicinsulatedironbrown", - "electrodynamics:wirelogisticscoppergreen", + "electrodynamics:wireceramicinsulatedsilverwhite", + "electrodynamics:wireceramicinsulatedgoldbrown", + "electrodynamics:wirelogisticsironblack", + "electrodynamics:wirelogisticscopperred", + "electrodynamics:wirehighlyinsulatedsilverblue", + "electrodynamics:wireinsulatedsilvergreen", + "electrodynamics:wireceramicinsulatedtinyellow", + "electrodynamics:wireinsulatedsilveryellow", + "electrodynamics:wireceramicinsulatedtinblack", + "electrodynamics:wiretin", + "electrodynamics:wirehighlyinsulatedsilverwhite", + "electrodynamics:wireceramicinsulatedcopperyellow", + "electrodynamics:wirelogisticssuperconductivebrown", + "electrodynamics:wirelogisticssilvergreen", + "electrodynamics:wireinsulatedsilverred", + "electrodynamics:wireinsulatedsuperconductivegreen", + "electrodynamics:wireinsulatedcopperblack", + "electrodynamics:wirehighlyinsulatedsuperconductivered", + "electrodynamics:wireinsulatedsilverblack", + "electrodynamics:wirelogisticssuperconductiveblue", + "electrodynamics:wireceramicinsulatedsuperconductivered", + "electrodynamics:wireinsulatedgoldred", + "electrodynamics:wirehighlyinsulatedgoldgreen", + "electrodynamics:wireceramicinsulatedironred", + "electrodynamics:wirelogisticsgoldbrown", + "electrodynamics:wireinsulatedirongreen", + "electrodynamics:wireinsulatedtinbrown", "electrodynamics:wireinsulatedsuperconductivebrown", + "electrodynamics:wireinsulatedtinred", + "electrodynamics:wireinsulatedironyellow", + "electrodynamics:wirehighlyinsulatedcoppergreen", + "electrodynamics:wireinsulatedcopperyellow", + "electrodynamics:wireceramicinsulatedironwhite", + "electrodynamics:wireinsulatedgoldbrown", + "electrodynamics:wirehighlyinsulatedsilvergreen", + "electrodynamics:wirelogisticscopperbrown", + "electrodynamics:wirehighlyinsulatedsilveryellow", + "electrodynamics:wirehighlyinsulatedcopperblack", + "electrodynamics:wireceramicinsulatedtinblue", + "electrodynamics:wirecopper", + "electrodynamics:wireceramicinsulatedgoldwhite", + "electrodynamics:wireceramicinsulatedsilvergreen", + "electrodynamics:wireceramicinsulatedsuperconductivegreen", + "electrodynamics:wirehighlyinsulatedgoldblack", "electrodynamics:wirelogisticssuperconductivewhite", - "electrodynamics:wireinsulatedsilverbrown", - "electrodynamics:wirehighlyinsulatedgoldblue", + "electrodynamics:wirelogisticssilverblue", + "electrodynamics:wirelogisticssilverred", + "electrodynamics:wirelogisticsgoldblue", "electrodynamics:wireinsulatedgoldblack", - "electrodynamics:wireceramicinsulatedsuperconductiveblack", - "electrodynamics:wirelogisticscopperblack", + "electrodynamics:wirehighlyinsulatedgoldwhite", + "electrodynamics:wireceramicinsulatedcopperblue", + "electrodynamics:wirelogisticssilverblack", + "electrodynamics:wireinsulatedgoldgreen", + "electrodynamics:wirelogisticssuperconductiveblack", + "electrodynamics:wirehighlyinsulatedtinblue", "electrodynamics:wireinsulatedsuperconductiveblue", - "electrodynamics:wireceramicinsulatedgoldwhite", - "electrodynamics:wireceramicinsulatedirongreen", - "electrodynamics:wirehighlyinsulatedgoldblack", - "electrodynamics:wiregold", - "electrodynamics:wirehighlyinsulatedsilverbrown", - "electrodynamics:wireceramicinsulatedgoldred", - "electrodynamics:wirelogisticsironyellow", - "electrodynamics:wiresilver", - "electrodynamics:wireinsulatedtinyellow", + "electrodynamics:wirelogisticsironred", + "electrodynamics:wirelogisticsgoldyellow", + "electrodynamics:wireceramicinsulatedgoldyellow", + "electrodynamics:wireceramicinsulatedsuperconductiveyellow", + "electrodynamics:wirelogisticstinblack", + "electrodynamics:wireinsulatedsilverbrown", + "electrodynamics:wireinsulatedsuperconductiveyellow", + "electrodynamics:wireinsulatedtinblack", "electrodynamics:wirehighlyinsulatedtinred", - "electrodynamics:wireceramicinsulatedcopperred", - "electrodynamics:wirecopper", - "electrodynamics:wirehighlyinsulatedcopperblack", - "electrodynamics:wireceramicinsulatedsuperconductivered", - "electrodynamics:wireceramicinsulatedsuperconductiveblue", - "electrodynamics:wireceramicinsulatedgoldblue", - "electrodynamics:wirelogisticscopperyellow", - "electrodynamics:wireinsulatedgoldgreen", - "electrodynamics:wireceramicinsulatedsilveryellow", - "electrodynamics:wirehighlyinsulatedtingreen", - "electrodynamics:wirehighlyinsulatedironyellow", - "electrodynamics:wirehighlyinsulatedsuperconductiveblue", - "electrodynamics:wirelogisticssilverred", - "electrodynamics:wireceramicinsulatedironwhite", - "electrodynamics:wirehighlyinsulatedtinyellow", - "electrodynamics:wireceramicinsulatedironblack", - "electrodynamics:wirelogisticssuperconductivered", - "electrodynamics:wireinsulatedsilverblue", - "electrodynamics:wirelogisticssuperconductivebrown", - "electrodynamics:wirelogisticssilvergreen", - "electrodynamics:wirelogisticsironblue", - "electrodynamics:wireceramicinsulatedsilverred", - "electrodynamics:wirelogisticsironblack", + "electrodynamics:wireceramicinsulatedgoldgreen", + "electrodynamics:wireceramicinsulatedtinred", + "electrodynamics:wirehighlyinsulatedcopperblue", "electrodynamics:wirelogisticstingreen", + "electrodynamics:wirelogisticsironblue", + "electrodynamics:wireceramicinsulatedgoldred", + "electrodynamics:wirehighlyinsulatedcopperbrown", + "electrodynamics:wireceramicinsulatedironyellow", + "electrodynamics:wirelogisticscopperwhite", + "electrodynamics:wireceramicinsulatedsuperconductivebrown", + "electrodynamics:wireinsulatedsilverwhite", + "electrodynamics:wirehighlyinsulatedtinblack", + "electrodynamics:wirehighlyinsulatedsilverbrown", + "electrodynamics:wirelogisticsironbrown", + "electrodynamics:wireinsulatedironblack", + "electrodynamics:wireceramicinsulatedcoppergreen", + "electrodynamics:wirehighlyinsulatedtinwhite", + "electrodynamics:wireinsulatedtingreen", + "electrodynamics:wirelogisticsirongreen", + "electrodynamics:wirelogisticscopperyellow", + "electrodynamics:wirehighlyinsulatedsuperconductivewhite", "electrodynamics:wireceramicinsulatedgoldblack", - "electrodynamics:wireinsulatedgoldbrown", - "electrodynamics:wireinsulatedtinred", - "electrodynamics:wireinsulatedsilvergreen", - "electrodynamics:wirehighlyinsulatedironwhite", - "electrodynamics:wirelogisticsironred", + "electrodynamics:wirelogisticstinblue", + "electrodynamics:wirehighlyinsulatedironyellow", + "electrodynamics:wireinsulatedironwhite", + "electrodynamics:wireinsulatedtinyellow", + "electrodynamics:wireinsulatedtinblue", "electrodynamics:wireinsulatedsuperconductivered", - "electrodynamics:wirehighlyinsulatedsilverblack", - "electrodynamics:wirehighlyinsulatedcoppergreen", - "electrodynamics:wirelogisticstinred", - "electrodynamics:wireinsulatedtingreen", - "electrodynamics:wirehighlyinsulatedironblue", - "electrodynamics:wirehighlyinsulatedsilvergreen", - "electrodynamics:pipecopper", + "electrodynamics:wireceramicinsulatedironbrown", + "electrodynamics:wireinsulatedcopperred", + "electrodynamics:wirehighlyinsulatedcopperyellow", + "electrodynamics:wirehighlyinsulatedironred", + "electrodynamics:wirehighlyinsulatedsuperconductiveblue", + "electrodynamics:wirelogisticscopperblue", + "electrodynamics:wireceramicinsulatedsuperconductivewhite", + "electrodynamics:wireceramicinsulatedsilverblack", + "electrodynamics:wiresuperconductive", + "electrodynamics:wirehighlyinsulatedcopperwhite", + "electrodynamics:wirelogisticsironyellow", + "electrodynamics:wirehighlyinsulatedcopperred", + "electrodynamics:wirelogisticstinwhite", "electrodynamics:pipesteel", - "electrodynamics:glassaluminum", + "electrodynamics:pipecopper", "electrodynamics:glassclear", + "electrodynamics:glassaluminum", + "electrodynamics:resourceblockaluminum", + "electrodynamics:resourceblocktitanium", "electrodynamics:resourceblockchromium", + "electrodynamics:resourceblocktitaniumcarbide", + "electrodynamics:resourceblocklead", "electrodynamics:resourceblockhslasteel", + "electrodynamics:resourceblockvanadiumsteel", + "electrodynamics:resourceblockstainlesssteel", + "electrodynamics:resourceblocktin", "electrodynamics:resourceblocksilver", "electrodynamics:resourceblockbronze", - "electrodynamics:resourceblocklead", - "electrodynamics:resourceblockstainlesssteel", - "electrodynamics:resourceblockvanadiumsteel", - "electrodynamics:resourceblocktitaniumcarbide", - "electrodynamics:resourceblockaluminum", "electrodynamics:resourceblocksteel", - "electrodynamics:resourceblocktin", - "electrodynamics:resourceblocktitanium", "electrodynamics:seismicmarker", "electrodynamics:logisticalmanager", "electrodynamics:logisticalmanager", @@ -317,6 +317,7 @@ "electrodynamics:advancedcompressor", "electrodynamics:advanceddecompressor", "electrodynamics:advancedthermoelectricmanipulator", - "electrodynamics:chemicalreactorextratop" + "electrodynamics:chemicalreactorextratop", + "electrodynamics:rotaryunifier" ] } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/tags/block/needs_stone_tool.json b/src/generated/resources/data/minecraft/tags/block/needs_stone_tool.json index 34991d0e3..eba00fdcf 100644 --- a/src/generated/resources/data/minecraft/tags/block/needs_stone_tool.json +++ b/src/generated/resources/data/minecraft/tags/block/needs_stone_tool.json @@ -1,78 +1,78 @@ { "values": [ + "electrodynamics:creativepowersource", + "electrodynamics:electricarcfurnacedouble", "electrodynamics:circuitmonitor", - "electrodynamics:electricarcfurnace", - "electrodynamics:wiremilldouble", + "electrodynamics:creativefluidsource", + "electrodynamics:coalgenerator", + "electrodynamics:gastankreinforced", + "electrodynamics:circuitbreaker", + "electrodynamics:electricfurnace", + "electrodynamics:windmill", + "electrodynamics:mineralwasher", + "electrodynamics:tankhsla", + "electrodynamics:gaspipepump", "electrodynamics:mineralcrusherdouble", - "electrodynamics:electrolosischamber", - "electrodynamics:gasvalve", - "electrodynamics:energizedalloyer", - "electrodynamics:quarry", - "electrodynamics:motorcomplex", - "electrodynamics:fermentationplant", - "electrodynamics:wiremilltriple", + "electrodynamics:lithiumbatterybox", "electrodynamics:combustionchamber", - "electrodynamics:potentiometer", + "electrodynamics:gaspipefilter", + "electrodynamics:chargerhv", + "electrodynamics:quarry", + "electrodynamics:advanceddowngradetransformer", + "electrodynamics:electricpump", + "electrodynamics:chargerlv", + "electrodynamics:gastanksteel", + "electrodynamics:lathe", "electrodynamics:fluidpipefilter", + "electrodynamics:wiremilldouble", + "electrodynamics:downgradetransformer", "electrodynamics:mineralgrindertriple", - "electrodynamics:seismicrelay", - "electrodynamics:relay", - "electrodynamics:batterybox", - "electrodynamics:lithiumbatterybox", "electrodynamics:thermoelectricgenerator", - "electrodynamics:gastankhsla", + "electrodynamics:advancedupgradetransformer", + "electrodynamics:coolantresavoir", + "electrodynamics:mineralcrushertriple", + "electrodynamics:batterybox", + "electrodynamics:electrolosischamber", "electrodynamics:electricfurnacetriple", - "electrodynamics:upgradetransformer", - "electrodynamics:fluidvalve", - "electrodynamics:chargermv", - "electrodynamics:mineralgrinder", + "electrodynamics:fermentationplant", + "electrodynamics:energizedalloyer", "electrodynamics:electricarcfurnacetriple", - "electrodynamics:chemicalmixer", - "electrodynamics:gaspipefilter", + "electrodynamics:seismicrelay", + "electrodynamics:tankreinforced", + "electrodynamics:solarpanel", "electrodynamics:advancedsolarpanel", - "electrodynamics:circuitbreaker", - "electrodynamics:tanksteel", - "electrodynamics:creativegassource", - "electrodynamics:chargerhv", - "electrodynamics:mineralcrushertriple", - "electrodynamics:multimeterblock", - "electrodynamics:hydroelectricgenerator", - "electrodynamics:coolantresavoir", - "electrodynamics:electricfurnace", - "electrodynamics:creativefluidsource", - "electrodynamics:advanceddowngradetransformer", + "electrodynamics:chargermv", "electrodynamics:mineralcrusher", - "electrodynamics:windmill", - "electrodynamics:gastankreinforced", + "electrodynamics:reinforcedalloyer", "electrodynamics:carbynebatterybox", - "electrodynamics:tankreinforced", - "electrodynamics:fluidvoid", - "electrodynamics:electricfurnacedouble", - "electrodynamics:fluidpipepump", - "electrodynamics:mineralwasher", - "electrodynamics:coalgenerator", - "electrodynamics:wiremill", - "electrodynamics:creativepowersource", - "electrodynamics:downgradetransformer", - "electrodynamics:gasvent", - "electrodynamics:advancedupgradetransformer", "electrodynamics:currentregulator", - "electrodynamics:chemicalcrystallizer", - "electrodynamics:electricarcfurnacedouble", - "electrodynamics:electricpump", - "electrodynamics:reinforcedalloyer", + "electrodynamics:upgradetransformer", + "electrodynamics:tanksteel", + "electrodynamics:wiremill", + "electrodynamics:creativegassource", "electrodynamics:gascollector", + "electrodynamics:mineralgrinderdouble", + "electrodynamics:gasvalve", "electrodynamics:oxidationfurnace", - "electrodynamics:tankhsla", + "electrodynamics:fluidvalve", + "electrodynamics:fluidvoid", + "electrodynamics:gasvent", + "electrodynamics:gastankhsla", + "electrodynamics:electricarcfurnace", + "electrodynamics:relay", + "electrodynamics:chemicalcrystallizer", + "electrodynamics:multimeterblock", + "electrodynamics:mineralgrinder", + "electrodynamics:fluidpipepump", + "electrodynamics:electricfurnacedouble", + "electrodynamics:hydroelectricgenerator", + "electrodynamics:chemicalmixer", + "electrodynamics:motorcomplex", + "electrodynamics:wiremilltriple", "electrodynamics:electrolyticseparator", - "electrodynamics:gaspipepump", - "electrodynamics:gastanksteel", - "electrodynamics:mineralgrinderdouble", - "electrodynamics:solarpanel", - "electrodynamics:chargerlv", - "electrodynamics:lathe", - "electrodynamics:pipecopper", + "electrodynamics:potentiometer", "electrodynamics:pipesteel", + "electrodynamics:pipecopper", "electrodynamics:orefluorite", "electrodynamics:oremolybdenum", "electrodynamics:oreniter", @@ -105,6 +105,7 @@ "electrodynamics:chemicalreactorextratop", "electrodynamics:advancedcompressor", "electrodynamics:advanceddecompressor", - "electrodynamics:advancedthermoelectricmanipulator" + "electrodynamics:advancedthermoelectricmanipulator", + "electrodynamics:rotaryunifier" ] } \ No newline at end of file diff --git a/src/generated/resources/data/neoforge/tags/block/needs_wood_tool.json b/src/generated/resources/data/neoforge/tags/block/needs_wood_tool.json index 24aab7293..d8a300d3c 100644 --- a/src/generated/resources/data/neoforge/tags/block/needs_wood_tool.json +++ b/src/generated/resources/data/neoforge/tags/block/needs_wood_tool.json @@ -1,181 +1,181 @@ { "values": [ - "electrodynamics:glassaluminum", "electrodynamics:glassclear", - "electrodynamics:wireinsulatedsilverwhite", - "electrodynamics:wirehighlyinsulatedsilverblue", - "electrodynamics:wireinsulatedsuperconductiveyellow", - "electrodynamics:wirehighlyinsulatedcopperyellow", - "electrodynamics:wirelogisticstinblue", - "electrodynamics:wireinsulatedsuperconductivegreen", - "electrodynamics:wirehighlyinsulatedgoldgreen", - "electrodynamics:wireceramicinsulatedcopperwhite", - "electrodynamics:wirelogisticsgoldyellow", - "electrodynamics:wirelogisticsgoldred", - "electrodynamics:wirelogisticsirongreen", - "electrodynamics:wirehighlyinsulatedsuperconductivered", - "electrodynamics:wirehighlyinsulatedsilverwhite", - "electrodynamics:wirehighlyinsulatedsuperconductivewhite", - "electrodynamics:wireinsulatedironred", - "electrodynamics:wireinsulatedsuperconductivewhite", - "electrodynamics:wireinsulatedgoldyellow", - "electrodynamics:wirelogisticsironbrown", - "electrodynamics:wireinsulatedironblue", - "electrodynamics:wirehighlyinsulatedsuperconductivegreen", - "electrodynamics:wireceramicinsulatedtinblue", - "electrodynamics:wireinsulatedcopperred", - "electrodynamics:wireiron", - "electrodynamics:wirehighlyinsulatedgoldyellow", - "electrodynamics:wirehighlyinsulatedcopperwhite", - "electrodynamics:wireceramicinsulatedcopperblue", - "electrodynamics:wireceramicinsulatedsuperconductivebrown", + "electrodynamics:glassaluminum", + "electrodynamics:wireinsulatedcopperwhite", + "electrodynamics:wireceramicinsulatedsilveryellow", + "electrodynamics:wirelogisticssilverwhite", + "electrodynamics:wireceramicinsulatedsuperconductiveblue", + "electrodynamics:wireceramicinsulatedirongreen", "electrodynamics:wireinsulatedgoldblue", + "electrodynamics:wirehighlyinsulatedironbrown", + "electrodynamics:wirehighlyinsulatedsuperconductivegreen", + "electrodynamics:wirelogisticscoppergreen", + "electrodynamics:wirelogisticssuperconductivered", + "electrodynamics:wireceramicinsulatedcopperwhite", + "electrodynamics:wirehighlyinsulatedironblue", + "electrodynamics:wireceramicinsulatedironblue", "electrodynamics:wireceramicinsulatedcopperbrown", - "electrodynamics:wirehighlyinsulatedsuperconductiveyellow", + "electrodynamics:wireinsulatedcopperbrown", + "electrodynamics:wirehighlyinsulatedgoldbrown", + "electrodynamics:wireinsulatedsuperconductiveblack", + "electrodynamics:wireceramicinsulatedgoldblue", + "electrodynamics:wireinsulatedgoldyellow", + "electrodynamics:wirehighlyinsulatedgoldblue", "electrodynamics:wirelogisticstinbrown", - "electrodynamics:wirehighlyinsulatedcopperbrown", - "electrodynamics:wireinsulatedsilveryellow", - "electrodynamics:wirehighlyinsulatedtinbrown", - "electrodynamics:wirelogisticscopperwhite", - "electrodynamics:wirehighlyinsulatedsilverred", - "electrodynamics:wirehighlyinsulatedsuperconductiveblack", "electrodynamics:wirehighlyinsulatedsuperconductivebrown", - "electrodynamics:wireceramicinsulatedcoppergreen", - "electrodynamics:wirehighlyinsulatedtinblack", - "electrodynamics:wireceramicinsulatedsuperconductivewhite", + "electrodynamics:wireceramicinsulatedsilverred", + "electrodynamics:wirelogisticssuperconductivegreen", + "electrodynamics:wirelogisticscopperblack", "electrodynamics:wireceramicinsulatedsilverblue", - "electrodynamics:wirelogisticscopperblue", - "electrodynamics:wireceramicinsulatedsuperconductivegreen", - "electrodynamics:wireceramicinsulatedtinwhite", - "electrodynamics:wireceramicinsulatedcopperyellow", - "electrodynamics:wireinsulatedcopperblack", - "electrodynamics:wireceramicinsulatedgoldyellow", - "electrodynamics:wireinsulatedsilverred", - "electrodynamics:wireceramicinsulatedsilverblack", - "electrodynamics:wirehighlyinsulatedgoldwhite", - "electrodynamics:wireinsulatedirongreen", - "electrodynamics:wirehighlyinsulatedcopperblue", - "electrodynamics:wirehighlyinsulatedirongreen", - "electrodynamics:wireceramicinsulatedtinblack", - "electrodynamics:wireceramicinsulatedironyellow", - "electrodynamics:wirelogisticsgoldbrown", - "electrodynamics:wirelogisticsgoldblue", - "electrodynamics:wireceramicinsulatedsilverwhite", - "electrodynamics:wireinsulatedironyellow", - "electrodynamics:wirelogisticssilverwhite", - "electrodynamics:wireinsulatedtinblue", - "electrodynamics:wireceramicinsulatedtinyellow", - "electrodynamics:wirelogisticsgoldwhite", - "electrodynamics:wireinsulatedsilverblack", - "electrodynamics:wireinsulatedtinblack", - "electrodynamics:wirelogisticssuperconductiveblack", - "electrodynamics:wireinsulatedironbrown", - "electrodynamics:wireceramicinsulatedtinred", - "electrodynamics:wireinsulatedironwhite", - "electrodynamics:wirelogisticsgoldblack", - "electrodynamics:wirehighlyinsulatedgoldred", - "electrodynamics:wirelogisticssilverblack", + "electrodynamics:wireinsulatedtinwhite", + "electrodynamics:wireinsulatedironblue", + "electrodynamics:wirehighlyinsulatedtinyellow", "electrodynamics:wirelogisticsironwhite", - "electrodynamics:wirelogisticscopperred", - "electrodynamics:wireceramicinsulatedsilvergreen", - "electrodynamics:wiresuperconductive", - "electrodynamics:wireinsulatedgoldred", - "electrodynamics:wireceramicinsulatedironred", - "electrodynamics:wireceramicinsulatedsilverbrown", - "electrodynamics:wireinsulatedcopperwhite", - "electrodynamics:wireceramicinsulatedtingreen", - "electrodynamics:wirehighlyinsulatedironblack", - "electrodynamics:wireceramicinsulatedgoldgreen", - "electrodynamics:wireinsulatedsuperconductiveblack", + "electrodynamics:wirehighlyinsulatedtinbrown", + "electrodynamics:wireinsulatedcoppergreen", "electrodynamics:wirelogisticssilveryellow", - "electrodynamics:wirelogisticssuperconductiveyellow", - "electrodynamics:wireinsulatedironblack", + "electrodynamics:wireinsulatedsilverblue", + "electrodynamics:wireinsulatedironbrown", + "electrodynamics:wireiron", + "electrodynamics:wireceramicinsulatedtingreen", + "electrodynamics:wirehighlyinsulatedsilverblack", "electrodynamics:wireceramicinsulatedtinbrown", + "electrodynamics:wirelogisticsgoldwhite", + "electrodynamics:wirehighlyinsulatedironblack", + "electrodynamics:wirehighlyinsulatedironwhite", + "electrodynamics:wireceramicinsulatedcopperred", "electrodynamics:wirelogisticssilverbrown", - "electrodynamics:wirehighlyinsulatedironred", - "electrodynamics:wirehighlyinsulatedgoldbrown", - "electrodynamics:wireinsulatedtinwhite", - "electrodynamics:wirehighlyinsulatedironbrown", - "electrodynamics:wireceramicinsulatedsuperconductiveyellow", - "electrodynamics:wireinsulatedcopperbrown", - "electrodynamics:wirelogisticssuperconductivegreen", - "electrodynamics:wirelogisticssilverblue", - "electrodynamics:wirelogisticssuperconductiveblue", "electrodynamics:wireceramicinsulatedcopperblack", - "electrodynamics:wirehighlyinsulatedsilveryellow", - "electrodynamics:wireinsulatedtinbrown", - "electrodynamics:wireceramicinsulatedgoldbrown", - "electrodynamics:wirelogisticscopperbrown", + "electrodynamics:wirehighlyinsulatedsuperconductiveblack", "electrodynamics:wireinsulatedgoldwhite", - "electrodynamics:wireinsulatedcoppergreen", - "electrodynamics:wirehighlyinsulatedtinwhite", - "electrodynamics:wirelogisticstinwhite", - "electrodynamics:wirelogisticsgoldgreen", + "electrodynamics:wirehighlyinsulatedsuperconductiveyellow", + "electrodynamics:wirehighlyinsulatedtingreen", "electrodynamics:wirelogisticstinyellow", - "electrodynamics:wireceramicinsulatedironblue", - "electrodynamics:wireinsulatedcopperyellow", - "electrodynamics:wirelogisticstinblack", - "electrodynamics:wirehighlyinsulatedcopperred", - "electrodynamics:wiretin", + "electrodynamics:wirehighlyinsulatedgoldyellow", + "electrodynamics:wiregold", + "electrodynamics:wirehighlyinsulatedsilverred", + "electrodynamics:wirelogisticsgoldgreen", + "electrodynamics:wirelogisticsgoldred", + "electrodynamics:wirehighlyinsulatedirongreen", + "electrodynamics:wireceramicinsulatedsuperconductiveblack", + "electrodynamics:wireinsulatedsuperconductivewhite", + "electrodynamics:wirehighlyinsulatedgoldred", + "electrodynamics:wireceramicinsulatedtinwhite", + "electrodynamics:wireceramicinsulatedsilverbrown", + "electrodynamics:wiresilver", + "electrodynamics:wirelogisticstinred", + "electrodynamics:wirelogisticsgoldblack", + "electrodynamics:wireceramicinsulatedironblack", + "electrodynamics:wireinsulatedironred", + "electrodynamics:wirelogisticssuperconductiveyellow", "electrodynamics:wireinsulatedcopperblue", - "electrodynamics:wirehighlyinsulatedtinblue", - "electrodynamics:wireceramicinsulatedironbrown", - "electrodynamics:wirelogisticscoppergreen", + "electrodynamics:wireceramicinsulatedsilverwhite", + "electrodynamics:wireceramicinsulatedgoldbrown", + "electrodynamics:wirelogisticsironblack", + "electrodynamics:wirelogisticscopperred", + "electrodynamics:wirehighlyinsulatedsilverblue", + "electrodynamics:wireinsulatedsilvergreen", + "electrodynamics:wireceramicinsulatedtinyellow", + "electrodynamics:wireinsulatedsilveryellow", + "electrodynamics:wireceramicinsulatedtinblack", + "electrodynamics:wiretin", + "electrodynamics:wirehighlyinsulatedsilverwhite", + "electrodynamics:wireceramicinsulatedcopperyellow", + "electrodynamics:wirelogisticssuperconductivebrown", + "electrodynamics:wirelogisticssilvergreen", + "electrodynamics:wireinsulatedsilverred", + "electrodynamics:wireinsulatedsuperconductivegreen", + "electrodynamics:wireinsulatedcopperblack", + "electrodynamics:wirehighlyinsulatedsuperconductivered", + "electrodynamics:wireinsulatedsilverblack", + "electrodynamics:wirelogisticssuperconductiveblue", + "electrodynamics:wireceramicinsulatedsuperconductivered", + "electrodynamics:wireinsulatedgoldred", + "electrodynamics:wirehighlyinsulatedgoldgreen", + "electrodynamics:wireceramicinsulatedironred", + "electrodynamics:wirelogisticsgoldbrown", + "electrodynamics:wireinsulatedirongreen", + "electrodynamics:wireinsulatedtinbrown", "electrodynamics:wireinsulatedsuperconductivebrown", + "electrodynamics:wireinsulatedtinred", + "electrodynamics:wireinsulatedironyellow", + "electrodynamics:wirehighlyinsulatedcoppergreen", + "electrodynamics:wireinsulatedcopperyellow", + "electrodynamics:wireceramicinsulatedironwhite", + "electrodynamics:wireinsulatedgoldbrown", + "electrodynamics:wirehighlyinsulatedsilvergreen", + "electrodynamics:wirelogisticscopperbrown", + "electrodynamics:wirehighlyinsulatedsilveryellow", + "electrodynamics:wirehighlyinsulatedcopperblack", + "electrodynamics:wireceramicinsulatedtinblue", + "electrodynamics:wirecopper", + "electrodynamics:wireceramicinsulatedgoldwhite", + "electrodynamics:wireceramicinsulatedsilvergreen", + "electrodynamics:wireceramicinsulatedsuperconductivegreen", + "electrodynamics:wirehighlyinsulatedgoldblack", "electrodynamics:wirelogisticssuperconductivewhite", - "electrodynamics:wireinsulatedsilverbrown", - "electrodynamics:wirehighlyinsulatedgoldblue", + "electrodynamics:wirelogisticssilverblue", + "electrodynamics:wirelogisticssilverred", + "electrodynamics:wirelogisticsgoldblue", "electrodynamics:wireinsulatedgoldblack", - "electrodynamics:wireceramicinsulatedsuperconductiveblack", - "electrodynamics:wirelogisticscopperblack", + "electrodynamics:wirehighlyinsulatedgoldwhite", + "electrodynamics:wireceramicinsulatedcopperblue", + "electrodynamics:wirelogisticssilverblack", + "electrodynamics:wireinsulatedgoldgreen", + "electrodynamics:wirelogisticssuperconductiveblack", + "electrodynamics:wirehighlyinsulatedtinblue", "electrodynamics:wireinsulatedsuperconductiveblue", - "electrodynamics:wireceramicinsulatedgoldwhite", - "electrodynamics:wireceramicinsulatedirongreen", - "electrodynamics:wirehighlyinsulatedgoldblack", - "electrodynamics:wiregold", - "electrodynamics:wirehighlyinsulatedsilverbrown", - "electrodynamics:wireceramicinsulatedgoldred", - "electrodynamics:wirelogisticsironyellow", - "electrodynamics:wiresilver", - "electrodynamics:wireinsulatedtinyellow", + "electrodynamics:wirelogisticsironred", + "electrodynamics:wirelogisticsgoldyellow", + "electrodynamics:wireceramicinsulatedgoldyellow", + "electrodynamics:wireceramicinsulatedsuperconductiveyellow", + "electrodynamics:wirelogisticstinblack", + "electrodynamics:wireinsulatedsilverbrown", + "electrodynamics:wireinsulatedsuperconductiveyellow", + "electrodynamics:wireinsulatedtinblack", "electrodynamics:wirehighlyinsulatedtinred", - "electrodynamics:wireceramicinsulatedcopperred", - "electrodynamics:wirecopper", - "electrodynamics:wirehighlyinsulatedcopperblack", - "electrodynamics:wireceramicinsulatedsuperconductivered", - "electrodynamics:wireceramicinsulatedsuperconductiveblue", - "electrodynamics:wireceramicinsulatedgoldblue", - "electrodynamics:wirelogisticscopperyellow", - "electrodynamics:wireinsulatedgoldgreen", - "electrodynamics:wireceramicinsulatedsilveryellow", - "electrodynamics:wirehighlyinsulatedtingreen", - "electrodynamics:wirehighlyinsulatedironyellow", - "electrodynamics:wirehighlyinsulatedsuperconductiveblue", - "electrodynamics:wirelogisticssilverred", - "electrodynamics:wireceramicinsulatedironwhite", - "electrodynamics:wirehighlyinsulatedtinyellow", - "electrodynamics:wireceramicinsulatedironblack", - "electrodynamics:wirelogisticssuperconductivered", - "electrodynamics:wireinsulatedsilverblue", - "electrodynamics:wirelogisticssuperconductivebrown", - "electrodynamics:wirelogisticssilvergreen", - "electrodynamics:wirelogisticsironblue", - "electrodynamics:wireceramicinsulatedsilverred", - "electrodynamics:wirelogisticsironblack", + "electrodynamics:wireceramicinsulatedgoldgreen", + "electrodynamics:wireceramicinsulatedtinred", + "electrodynamics:wirehighlyinsulatedcopperblue", "electrodynamics:wirelogisticstingreen", + "electrodynamics:wirelogisticsironblue", + "electrodynamics:wireceramicinsulatedgoldred", + "electrodynamics:wirehighlyinsulatedcopperbrown", + "electrodynamics:wireceramicinsulatedironyellow", + "electrodynamics:wirelogisticscopperwhite", + "electrodynamics:wireceramicinsulatedsuperconductivebrown", + "electrodynamics:wireinsulatedsilverwhite", + "electrodynamics:wirehighlyinsulatedtinblack", + "electrodynamics:wirehighlyinsulatedsilverbrown", + "electrodynamics:wirelogisticsironbrown", + "electrodynamics:wireinsulatedironblack", + "electrodynamics:wireceramicinsulatedcoppergreen", + "electrodynamics:wirehighlyinsulatedtinwhite", + "electrodynamics:wireinsulatedtingreen", + "electrodynamics:wirelogisticsirongreen", + "electrodynamics:wirelogisticscopperyellow", + "electrodynamics:wirehighlyinsulatedsuperconductivewhite", "electrodynamics:wireceramicinsulatedgoldblack", - "electrodynamics:wireinsulatedgoldbrown", - "electrodynamics:wireinsulatedtinred", - "electrodynamics:wireinsulatedsilvergreen", - "electrodynamics:wirehighlyinsulatedironwhite", - "electrodynamics:wirelogisticsironred", + "electrodynamics:wirelogisticstinblue", + "electrodynamics:wirehighlyinsulatedironyellow", + "electrodynamics:wireinsulatedironwhite", + "electrodynamics:wireinsulatedtinyellow", + "electrodynamics:wireinsulatedtinblue", "electrodynamics:wireinsulatedsuperconductivered", - "electrodynamics:wirehighlyinsulatedsilverblack", - "electrodynamics:wirehighlyinsulatedcoppergreen", - "electrodynamics:wirelogisticstinred", - "electrodynamics:wireinsulatedtingreen", - "electrodynamics:wirehighlyinsulatedironblue", - "electrodynamics:wirehighlyinsulatedsilvergreen", + "electrodynamics:wireceramicinsulatedironbrown", + "electrodynamics:wireinsulatedcopperred", + "electrodynamics:wirehighlyinsulatedcopperyellow", + "electrodynamics:wirehighlyinsulatedironred", + "electrodynamics:wirehighlyinsulatedsuperconductiveblue", + "electrodynamics:wirelogisticscopperblue", + "electrodynamics:wireceramicinsulatedsuperconductivewhite", + "electrodynamics:wireceramicinsulatedsilverblack", + "electrodynamics:wiresuperconductive", + "electrodynamics:wirehighlyinsulatedcopperwhite", + "electrodynamics:wirelogisticsironyellow", + "electrodynamics:wirehighlyinsulatedcopperred", + "electrodynamics:wirelogisticstinwhite", "electrodynamics:frame", "electrodynamics:framecorner" ] diff --git a/src/main/java/electrodynamics/Electrodynamics.java b/src/main/java/electrodynamics/Electrodynamics.java index 4e911972e..ec3f6202b 100644 --- a/src/main/java/electrodynamics/Electrodynamics.java +++ b/src/main/java/electrodynamics/Electrodynamics.java @@ -3,8 +3,11 @@ import java.util.Random; import java.util.function.Consumer; +import electrodynamics.api.electricity.RegisterWiresEvent; +import electrodynamics.common.block.connect.BlockWire; import electrodynamics.common.reloadlistener.GasCollectorChromoCardsRegister; import electrodynamics.prefab.properties.PropertyTypes; +import electrodynamics.registers.ElectrodynamicsBlocks; import net.neoforged.fml.common.EventBusSubscriber; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -66,6 +69,7 @@ public static void onCommonSetup(FMLCommonSetupEvent event) { CoalGeneratorFuelRegister.INSTANCE = new CoalGeneratorFuelRegister().subscribeAsSyncable(); GasCollectorChromoCardsRegister.INSTANCE = new GasCollectorChromoCardsRegister().subscribeAsSyncable(); ThermoelectricGeneratorHeatRegister.INSTANCE = new ThermoelectricGeneratorHeatRegister().subscribeAsSyncable(); + NeoForge.EVENT_BUS.addListener(getGuidebookListener()); ElectrodynamicsTags.init(); // CraftingHelper.register(ConfigCondition.Serializer.INSTANCE); // Probably wrong location after update from 1.18.2 to @@ -81,6 +85,12 @@ public static void onCommonSetup(FMLCommonSetupEvent event) { ModLoader.postEvent(properties); PropertyManager.registerProperties(properties.getRegisteredProperties()); + + RegisterWiresEvent wiresEvent = new RegisterWiresEvent(); + + ModLoader.postEvent(wiresEvent); + + wiresEvent.process(); }); } @@ -120,7 +130,7 @@ private static Consumer getGuidebookListener() { return event -> { ServerPlayer player = event.getPlayer(); - if(player == null){ + if (player == null) { PacketDistributor.sendToAllPlayers(PacketResetGuidebookPages.PACKET); } else { PacketDistributor.sendToPlayer(player, PacketResetGuidebookPages.PACKET); @@ -129,4 +139,11 @@ private static Consumer getGuidebookListener() { } + @SubscribeEvent + public static void registerWires(RegisterWiresEvent event) { + for (BlockWire wire : ElectrodynamicsBlocks.BLOCKS_WIRE.getAllValues()) { + event.registerWire(wire); + } + } + } diff --git a/src/main/java/electrodynamics/api/References.java b/src/main/java/electrodynamics/api/References.java index a2c85aca2..b988afd12 100644 --- a/src/main/java/electrodynamics/api/References.java +++ b/src/main/java/electrodynamics/api/References.java @@ -3,4 +3,6 @@ public class References { public static final String ID = "electrodynamics"; public static final String NAME = "Electrodynamics"; + + public static final String MEKANISM_ID = "mekanism"; } diff --git a/src/main/java/electrodynamics/api/electricity/RegisterWiresEvent.java b/src/main/java/electrodynamics/api/electricity/RegisterWiresEvent.java new file mode 100644 index 000000000..dcaded28d --- /dev/null +++ b/src/main/java/electrodynamics/api/electricity/RegisterWiresEvent.java @@ -0,0 +1,63 @@ +package electrodynamics.api.electricity; + +import electrodynamics.api.network.cable.type.IWire; +import electrodynamics.common.block.connect.BlockWire; +import electrodynamics.common.block.subtype.SubtypeWire; +import net.neoforged.bus.api.Event; +import net.neoforged.fml.event.IModBusEvent; + +import java.util.HashMap; +import java.util.HashSet; + +public class RegisterWiresEvent extends Event implements IModBusEvent { + + private final HashSet wires = new HashSet<>(); + + public void registerWire(BlockWire wire) { + wires.add(wire); + } + + + public void process() { + + HashMap>>> wireToColorMapping = new HashMap<>(); + + HashSet wireMaterials = new HashSet<>(); + + HashSet wireColors = new HashSet<>(); + + for(BlockWire wire : wires) { + + wireMaterials.add(wire.wire.getWireMaterial()); + + HashMap>> wTC1 = wireToColorMapping.getOrDefault(wire.wire.getWireMaterial(), new HashMap<>()); + + HashMap> wTC2 = wTC1.getOrDefault(wire.wire.getInsulation(), new HashMap<>()); + + HashMap wTC3 = wTC2.getOrDefault(wire.wire.getWireColor(), new HashMap<>()); + + wTC3.put(wire.wire.getWireColor(), wire); + + wTC2.put(wire.wire.getWireClass(), wTC3); + + wTC1.put(wire.wire.getInsulation(), wTC2); + + wireToColorMapping.put(wire.wire.getWireMaterial(), wTC1); + + wireColors.add(wire.wire.getWireColor()); + + } + + SubtypeWire.WIRE_MATERIALS.clear(); + SubtypeWire.WIRE_MATERIALS.addAll(wireMaterials); + + SubtypeWire.WIRES.clear(); + SubtypeWire.WIRES.putAll(wireToColorMapping); + + SubtypeWire.WireColor.WIRE_COLORS.clear(); + SubtypeWire.WireColor.WIRE_COLORS.addAll(wireColors); + + } + + +} diff --git a/src/main/java/electrodynamics/api/gas/Gas.java b/src/main/java/electrodynamics/api/gas/Gas.java index 3282d384b..ab7fbc545 100644 --- a/src/main/java/electrodynamics/api/gas/Gas.java +++ b/src/main/java/electrodynamics/api/gas/Gas.java @@ -65,7 +65,10 @@ public int getCondensationTemp() { return condensationTemp; } - @Nullable + public boolean noCondensedFluid() { + return condensedFluid == null || condensedFluid.value() == Fluids.EMPTY; + } + public Fluid getCondensedFluid() { return condensedFluid.value(); } diff --git a/src/main/java/electrodynamics/api/gas/GasStack.java b/src/main/java/electrodynamics/api/gas/GasStack.java index 6685f967f..4aee48f2a 100644 --- a/src/main/java/electrodynamics/api/gas/GasStack.java +++ b/src/main/java/electrodynamics/api/gas/GasStack.java @@ -3,6 +3,7 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; +import electrodynamics.registers.ElectrodynamicsBlocks; import electrodynamics.registers.ElectrodynamicsGases; import net.minecraft.core.Holder; import net.minecraft.core.HolderSet; @@ -101,7 +102,7 @@ public GasStack(@NonNull Holder gas, int amount, int temperature, int press } public Gas getGas() { - return gas; + return isEmpty() ? ElectrodynamicsGases.EMPTY.get() : gas; } public Holder getGasHolder() { @@ -166,9 +167,9 @@ public int getVolumeChangeFromHeating(int deltaTemp) { throw new UnsupportedOperationException("The temperature cannot drop below absolute zero"); } - int change = (int) ((deltaTemp + (double) temperature) / (double) temperature); + double change = (deltaTemp + (double) temperature) / (double) temperature; - return amount * change; + return (int) Math.ceil(amount * change); } @@ -179,7 +180,7 @@ public int getVolumeChangeFromPressurizing(int atm) { double change = (double) atm / (double) pressure; - return (int) (amount / change); + return (int) Math.ceil(amount / change); } public boolean isEmpty() { @@ -357,7 +358,7 @@ public static int getMaximumAcceptance(GasStack stack1, GasStack stack2, int max return stack2.getAmount(); } - return (int) (remaining / deltaT2Factor * deltaP2Factor); + return (int) Math.ceil(remaining / deltaT2Factor * deltaP2Factor); } diff --git a/src/main/java/electrodynamics/api/item/IItemElectric.java b/src/main/java/electrodynamics/api/item/IItemElectric.java index 9d2cfc4ea..fa8fb72e5 100644 --- a/src/main/java/electrodynamics/api/item/IItemElectric.java +++ b/src/main/java/electrodynamics/api/item/IItemElectric.java @@ -165,7 +165,7 @@ default void swapBatteryPackFirstItem(ItemStack tool, Player player) { static boolean overrideOtherStackedOnMe(ItemStack stack, ItemStack other, Slot slot, ClickAction action, Player player, SlotAccess access) { - if (action == null || action == ClickAction.PRIMARY) { + if (action == null || action == ClickAction.PRIMARY || other.isEmpty()) { return false; } @@ -230,7 +230,7 @@ default void setCurrentBattery(ItemStack tool, ItemStack battery) { Item getDefaultStorageBattery(); static void addBatteryTooltip(ItemStack stack, Item.TooltipContext context, List tooltip) { - tooltip.add(ElectroTextUtils.tooltip("currbattery", ((IItemElectric) stack.getItem()).getCurrentBattery(stack).getDisplayName()).withStyle(ChatFormatting.GRAY)); + tooltip.add(ElectroTextUtils.tooltip("currbattery", ((IItemElectric) stack.getItem()).getCurrentBattery(stack).getDisplayName().copy().withStyle(ChatFormatting.GRAY)).withStyle(ChatFormatting.DARK_GRAY)); } public static class ElectricItemData { @@ -269,7 +269,7 @@ public ElectricItemData(double joulesStored, double maxJoules, double voltage, d // Codec.DOUBLE.fieldOf(EXTRACT_LIMIT).forGetter(instance0 -> instance0.extractCap), // - ItemStack.CODEC.fieldOf(CURRENT_BATTERY).forGetter(instance0 -> instance0.battery) + ItemStack.OPTIONAL_CODEC.fieldOf(CURRENT_BATTERY).forGetter(instance0 -> instance0.battery) // ).apply(instance, ElectricItemData::new) @@ -283,7 +283,7 @@ public ElectricItemData(double joulesStored, double maxJoules, double voltage, d ByteBufCodecs.DOUBLE, instance0 -> instance0.voltage, ByteBufCodecs.DOUBLE, instance0 -> instance0.receiveCap, ByteBufCodecs.DOUBLE, instance0 -> instance0.extractCap, - ItemStack.STREAM_CODEC, instance0 -> instance0.battery, + ItemStack.OPTIONAL_STREAM_CODEC, instance0 -> instance0.battery, ElectricItemData::new ); diff --git a/src/main/java/electrodynamics/api/network/INetwork.java b/src/main/java/electrodynamics/api/network/INetwork.java index e8424c2a6..00fd589b8 100644 --- a/src/main/java/electrodynamics/api/network/INetwork.java +++ b/src/main/java/electrodynamics/api/network/INetwork.java @@ -1,5 +1,9 @@ package electrodynamics.api.network; +import java.util.UUID; + public interface INetwork { int getSize(); + + public UUID getId(); } diff --git a/src/main/java/electrodynamics/api/network/cable/IAbstractCable.java b/src/main/java/electrodynamics/api/network/cable/IAbstractCable.java index 0cfe755e0..9a2b7e511 100644 --- a/src/main/java/electrodynamics/api/network/cable/IAbstractCable.java +++ b/src/main/java/electrodynamics/api/network/cable/IAbstractCable.java @@ -1,19 +1,24 @@ package electrodynamics.api.network.cable; import electrodynamics.prefab.network.AbstractNetwork; +import electrodynamics.prefab.tile.types.GenericRefreshingConnectTile; import net.minecraft.world.level.block.entity.BlockEntity; -public interface IAbstractCable { +public interface IAbstractCable, ?, ?, ?>> { void removeFromNetwork(); - AbstractNetwork getAbstractNetwork(); + T getNetwork(); - void setNetwork(AbstractNetwork aValueNetwork); + void createNetworkFromThis(); - BlockEntity[] getAdjacentConnections(); + void setNetwork(T aValueNetwork); - Object getConductorType(); + BlockEntity[] getConectedRecievers(); + + BlockEntity[] getConnectedCables(); + + CONDUCTORTYPE getCableType(); double getMaxTransfer(); } diff --git a/src/main/java/electrodynamics/api/network/cable/IRefreshableCable.java b/src/main/java/electrodynamics/api/network/cable/IRefreshableCable.java index 382a5bb52..8b43c9528 100644 --- a/src/main/java/electrodynamics/api/network/cable/IRefreshableCable.java +++ b/src/main/java/electrodynamics/api/network/cable/IRefreshableCable.java @@ -1,24 +1,13 @@ package electrodynamics.api.network.cable; -import electrodynamics.api.network.INetwork; import electrodynamics.prefab.network.AbstractNetwork; +import electrodynamics.prefab.tile.types.GenericRefreshingConnectTile; +import net.minecraft.core.Direction; -public interface IRefreshableCable extends IAbstractCable { +public interface IRefreshableCable, ?, ?, ?>> extends IAbstractCable { - INetwork getNetwork(); - - INetwork getNetwork(boolean createIfNull); - - void refreshNetwork(); - - void refreshNetworkIfChange(); - - @Override - void removeFromNetwork(); + void updateNetwork(Direction...dirs); void destroyViolently(); - @Override - void setNetwork(AbstractNetwork aValueNetwork); - } diff --git a/src/main/java/electrodynamics/api/network/cable/type/IConductor.java b/src/main/java/electrodynamics/api/network/cable/type/IConductor.java deleted file mode 100644 index 29c7d7335..000000000 --- a/src/main/java/electrodynamics/api/network/cable/type/IConductor.java +++ /dev/null @@ -1,23 +0,0 @@ -package electrodynamics.api.network.cable.type; - -import electrodynamics.api.network.cable.IRefreshableCable; -import electrodynamics.common.block.subtype.SubtypeWire; -import electrodynamics.common.block.subtype.SubtypeWire.WireColor; - -public interface IConductor extends IRefreshableCable { - - SubtypeWire getWireType(); - - WireColor getWireColor(); - - @Override - default Object getConductorType() { - return getWireType(); - } - - @Override - default double getMaxTransfer() { - return getWireType().conductor.ampacity; - } - -} \ No newline at end of file diff --git a/src/main/java/electrodynamics/api/network/cable/type/IFluidPipe.java b/src/main/java/electrodynamics/api/network/cable/type/IFluidPipe.java index a646d6398..79829c3d6 100644 --- a/src/main/java/electrodynamics/api/network/cable/type/IFluidPipe.java +++ b/src/main/java/electrodynamics/api/network/cable/type/IFluidPipe.java @@ -1,20 +1,7 @@ package electrodynamics.api.network.cable.type; -import electrodynamics.api.network.cable.IRefreshableCable; -import electrodynamics.common.block.subtype.SubtypeFluidPipe; +public interface IFluidPipe { -public interface IFluidPipe extends IRefreshableCable { + long getMaxTransfer(); - SubtypeFluidPipe getPipeType(); - - @Override - default Object getConductorType() { - return getPipeType(); - } - - @Override - default double getMaxTransfer() { - return getPipeType().maxTransfer; - } - -} \ No newline at end of file +} diff --git a/src/main/java/electrodynamics/api/network/cable/type/IGasPipe.java b/src/main/java/electrodynamics/api/network/cable/type/IGasPipe.java index 7a20507e8..f10cd7a30 100644 --- a/src/main/java/electrodynamics/api/network/cable/type/IGasPipe.java +++ b/src/main/java/electrodynamics/api/network/cable/type/IGasPipe.java @@ -1,32 +1,38 @@ package electrodynamics.api.network.cable.type; -import electrodynamics.api.network.cable.IRefreshableCable; -import electrodynamics.common.block.subtype.SubtypeGasPipe; +import net.minecraft.network.chat.Component; +import net.minecraft.world.level.block.SoundType; +import net.minecraft.world.level.block.state.BlockBehaviour; -public interface IGasPipe extends IRefreshableCable { +public interface IGasPipe { - SubtypeGasPipe getPipeType(); + long getMaxTransfer(); - @Override - default Object getConductorType() { - return getPipeType(); - } + double getRadius(); - @Override - default double getMaxTransfer() { - return getPipeType().maxTransfer; - } + BlockBehaviour.Properties getProperties(); - default boolean isInsulationFlammable() { - return getPipeType().insulationMaterial.canCombust; - } + SoundType getSoundType(); - default double getEffectiveHeatLoss() { - return getPipeType().effectivePipeHeatLoss; - } + IPipeMaterial getPipeMaterial(); - default boolean canCorrodeFromAcid() { - return getPipeType().pipeMaterial.corrodedByAcid; - } + public static interface IPipeMaterial { + + /** + * units of ATM + * @return + */ + int getMaxPressuire(); + + + /** + * returns whether this pipe material can be destroyed by corrosive gasses. + * @return + */ + boolean canBeCorroded(); + + Component getName(); + + } } diff --git a/src/main/java/electrodynamics/api/network/cable/type/IWire.java b/src/main/java/electrodynamics/api/network/cable/type/IWire.java new file mode 100644 index 000000000..5561f3f8f --- /dev/null +++ b/src/main/java/electrodynamics/api/network/cable/type/IWire.java @@ -0,0 +1,108 @@ +package electrodynamics.api.network.cable.type; + +import electrodynamics.prefab.utilities.math.Color; +import net.minecraft.tags.TagKey; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.block.SoundType; +import net.minecraft.world.level.block.state.BlockBehaviour; + +import javax.annotation.Nonnegative; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** + * Defines a wire + * + * + * @author skip999 + */ +public interface IWire { + + + double getResistance(); + + long getAmpacity(); + + IWireClass getWireClass(); + + IInsulationMaterial getInsulation(); + + IWireMaterial getWireMaterial(); + + IWireColor getWireColor(); + + IWireColor getDefaultColor(); + + @Nullable + TagKey getItemTag(); + + boolean isDefaultColor(); + + + + public static interface IInsulationMaterial { + + boolean insulated(); + + boolean fireproof(); + + /** + * The maximum voltage this insulation can shield from + * + * @return + */ + int shockVoltage(); + + double wireRadius(); + + BlockBehaviour.Properties getProperties(); + + SoundType getSoundType(); + + } + + + public static interface IWireClass { + + boolean conductsRedstone(); + + } + + + public static interface IWireMaterial { + + /** + * return zero if this material has no resistance + * + * @return the resistance of this material + */ + @Nonnegative + double resistance(); + + @Nonnegative + long ampacity(); + + /** + * Returns the resistivity (inverse of conductance) of this material in units of ohm * meter + * It is assumed this value is the value at 20 degrees C + * + * @return the material's resistivity + */ + @Nonnegative + double materialResistivity(); + + } + + + public static interface IWireColor { + + @Nonnull + Color getColor(); + + @Nonnull + TagKey getDyeTag(); + + } + + +} diff --git a/src/main/java/electrodynamics/api/network/util/AbstractNetworkFinder.java b/src/main/java/electrodynamics/api/network/util/AbstractNetworkFinder.java index 07edb4dc0..7d5bf3e92 100644 --- a/src/main/java/electrodynamics/api/network/util/AbstractNetworkFinder.java +++ b/src/main/java/electrodynamics/api/network/util/AbstractNetworkFinder.java @@ -1,66 +1,65 @@ package electrodynamics.api.network.util; -import java.util.ArrayList; -import java.util.Arrays; +import java.util.HashSet; import java.util.List; -import electrodynamics.api.network.cable.IAbstractCable; import electrodynamics.prefab.network.AbstractNetwork; +import electrodynamics.prefab.tile.types.GenericRefreshingConnectTile; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; -public class AbstractNetworkFinder { - public Level worldObj; - public BlockPos start; - public AbstractNetwork net; - public List iteratedTiles = new ArrayList<>(); - public List toIgnore = new ArrayList<>(); +public class AbstractNetworkFinder, T, P> { + private final Level level; + private final BlockPos start; + private final AbstractNetwork net; + private final HashSet iteratedTiles = new HashSet<>(); + private final HashSet toIgnore = new HashSet<>(); - public AbstractNetworkFinder(Level world, BlockPos location, AbstractNetwork net, BlockPos... ignore) { - worldObj = world; - start = location; + public AbstractNetworkFinder(Level world, BlockPos start, AbstractNetwork net, BlockPos... ignore) { + level = world; + this.start = start; this.net = net; if (ignore.length > 0) { - toIgnore = Arrays.asList(ignore); + toIgnore.addAll(List.of(ignore)); } } - public void loopAll(BlockPos location) { - BlockEntity curr = worldObj.getBlockEntity(location); + private void loopAll(BlockPos location) { + BlockEntity curr = level.getBlockEntity(location); if (net.isConductor(curr, (C) curr)) { - iteratedTiles.add(curr); + iteratedTiles.add((C) curr); } for (Direction direction : Direction.values()) { - BlockPos obj = new BlockPos(location).offset(direction.getNormal()); - if (!(toIgnore.size() == 1 ? toIgnore.get(0) == obj : toIgnore.contains(obj))) { - if (worldObj.hasChunkAt(obj)) { - BlockEntity tileEntity = worldObj.getBlockEntity(obj); - if (!iteratedTiles.contains(tileEntity) && net.isConductor(tileEntity, (C) curr)) { - loopAll((IAbstractCable) tileEntity); - } - } + BlockPos relative = new BlockPos(location).relative(direction); + if(toIgnore.contains(relative) || !level.hasChunkAt(relative)) { + continue; } + BlockEntity tileEntity = level.getBlockEntity(relative); + if(iteratedTiles.contains(tileEntity) || !net.isConductor(tileEntity, (C) curr)) { + continue; + } + loopAll((C) tileEntity); } } - public void loopAll(IAbstractCable conductor) { - iteratedTiles.add((BlockEntity) conductor); - for (BlockEntity connections : conductor.getAdjacentConnections()) { - if (connections != null) { - BlockPos pos = connections.getBlockPos(); - if (!iteratedTiles.contains(connections) && !(toIgnore.size() == 1 ? toIgnore.get(0) == pos : toIgnore.contains(pos))) { - if (net.isConductor(connections, (C) conductor)) { - loopAll((IAbstractCable) connections); - } - } + private void loopAll(C cable) { + iteratedTiles.add(cable); + for (BlockEntity connection : cable.getConnectedCables()) { + if(connection == null) { + continue; + } + BlockPos pos = connection.getBlockPos(); + if (iteratedTiles.contains(connection) || toIgnore.contains(pos) || !net.isConductor(connection, cable)) { + continue; } + loopAll((C) connection); } } - public List exploreNetwork() { + public HashSet exploreNetwork() { loopAll(start); return iteratedTiles; } diff --git a/src/main/java/electrodynamics/client/ClientRegister.java b/src/main/java/electrodynamics/client/ClientRegister.java index 2913df046..701efe919 100644 --- a/src/main/java/electrodynamics/client/ClientRegister.java +++ b/src/main/java/electrodynamics/client/ClientRegister.java @@ -35,6 +35,7 @@ import electrodynamics.common.item.gear.tools.electric.ItemElectricBaton; import electrodynamics.common.item.gear.tools.electric.ItemElectricChainsaw; import electrodynamics.common.item.gear.tools.electric.ItemElectricDrill; +import electrodynamics.compatibility.mekanism.MekanismClientHandler; import electrodynamics.registers.*; import net.minecraft.client.Minecraft; import net.minecraft.client.model.HumanoidModel; @@ -52,6 +53,7 @@ import net.neoforged.api.distmarker.Dist; import net.neoforged.api.distmarker.OnlyIn; import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.ModList; import net.neoforged.fml.common.EventBusSubscriber; import net.neoforged.neoforge.client.event.*; import net.neoforged.neoforge.client.event.ModelEvent.RegisterAdditional; @@ -253,6 +255,10 @@ public static void registerMenus(RegisterMenuScreensEvent event) { event.register(ElectrodynamicsMenuTypes.CONTAINER_CHEMICALREACTOR.get(), ScreenChemicalReactor::new); event.register(ElectrodynamicsMenuTypes.CONTAINER_CREATIVEGASSOURCE.get(), ScreenCreativeGasSource::new); event.register(ElectrodynamicsMenuTypes.CONTAINER_ELECTROLOSISCHAMBER.get(), ScreenElectrolosisChamber::new); + + if(ModList.get().isLoaded(References.MEKANISM_ID)) { + MekanismClientHandler.registerMenus(event); + } } @SubscribeEvent diff --git a/src/main/java/electrodynamics/client/guidebook/chapters/ChapterFluids.java b/src/main/java/electrodynamics/client/guidebook/chapters/ChapterFluids.java index ea342a8d8..9f8df4103 100644 --- a/src/main/java/electrodynamics/client/guidebook/chapters/ChapterFluids.java +++ b/src/main/java/electrodynamics/client/guidebook/chapters/ChapterFluids.java @@ -126,8 +126,8 @@ public void onTooltip(GuiGraphics graphics, int xAxis, int yAxis, ScreenGuideboo pageData.add(new TextWrapperObject(ElectroTextUtils.guidebook("chapter.fluids.l4", ElectroTextUtils.guidebook("chapter.fluids.pipes").withStyle(ChatFormatting.BOLD))).setSeparateStart().setIndentions(1)); blankLine(); - pageData.add(new TextWrapperObject(ElectroTextUtils.guidebook("chapter.fluids.pipecapacity", ElectroTextUtils.guidebook("chapter.fluids.pipecopper"), SubtypeFluidPipe.copper.maxTransfer)).setSeparateStart().setIndentions(1)); - pageData.add(new TextWrapperObject(ElectroTextUtils.guidebook("chapter.fluids.pipecapacity", ElectroTextUtils.guidebook("chapter.fluids.pipesteel"), SubtypeFluidPipe.steel.maxTransfer)).setSeparateStart().setIndentions(1)); + pageData.add(new TextWrapperObject(ElectroTextUtils.guidebook("chapter.fluids.pipecapacity", ElectroTextUtils.guidebook("chapter.fluids.pipecopper"), SubtypeFluidPipe.copper.getMaxTransfer())).setSeparateStart().setIndentions(1)); + pageData.add(new TextWrapperObject(ElectroTextUtils.guidebook("chapter.fluids.pipecapacity", ElectroTextUtils.guidebook("chapter.fluids.pipesteel"), SubtypeFluidPipe.steel.getMaxTransfer())).setSeparateStart().setIndentions(1)); /* Fluid Tools */ diff --git a/src/main/java/electrodynamics/client/guidebook/chapters/ChapterGases.java b/src/main/java/electrodynamics/client/guidebook/chapters/ChapterGases.java index 68e3c22f4..e88f37970 100644 --- a/src/main/java/electrodynamics/client/guidebook/chapters/ChapterGases.java +++ b/src/main/java/electrodynamics/client/guidebook/chapters/ChapterGases.java @@ -138,7 +138,7 @@ public Object getJeiLookup() { // condensed gases pageData.add(new TextWrapperObject(ElectroTextUtils.guidebook("chapter.gases.l9")).setIndentions(1).setSeparateStart()); for (DeferredHolder gas : ElectrodynamicsGases.GASES.getEntries()) { - if (gas.get().isEmpty() || gas.get().getCondensedFluid().isSame(Fluids.EMPTY)) { + if (gas.get().isEmpty() || gas.get().noCondensedFluid()) { continue; } blankLine(); @@ -183,16 +183,16 @@ public void onTooltip(GuiGraphics graphics, int xAxis, int yAxis, ScreenGuideboo pageData.add(new TextWrapperObject(ElectroTextUtils.guidebook("chapter.gases.l13.1")).setIndentions(1).setSeparateStart()); blankLine(); pageData.add(new TextWrapperObject(ElectroTextUtils.guidebook("chapter.gases.pipecopper").withStyle(ChatFormatting.ITALIC)).setSeparateStart()); - pageData.add(new TextWrapperObject(ElectroTextUtils.guidebook("chapter.gases.pipecapacity", ChatFormatter.formatFluidMilibuckets(SubtypeGasPipe.UNINSULATEDCOPPER.maxTransfer))).setSeparateStart()); - pageData.add(new TextWrapperObject(ElectroTextUtils.guidebook("chapter.gases.pipepressure", ChatFormatter.getChatDisplayShort(SubtypeGasPipe.UNINSULATEDCOPPER.pipeMaterial.maxPressure, DisplayUnit.PRESSURE_ATM))).setSeparateStart()); + pageData.add(new TextWrapperObject(ElectroTextUtils.guidebook("chapter.gases.pipecapacity", ChatFormatter.formatFluidMilibuckets(SubtypeGasPipe.UNINSULATEDCOPPER.getMaxTransfer()))).setSeparateStart()); + pageData.add(new TextWrapperObject(ElectroTextUtils.guidebook("chapter.gases.pipepressure", ChatFormatter.getChatDisplayShort(SubtypeGasPipe.UNINSULATEDCOPPER.getPipeMaterial().getMaxPressuire(), DisplayUnit.PRESSURE_ATM))).setSeparateStart()); blankLine(); pageData.add(new TextWrapperObject(ElectroTextUtils.guidebook("chapter.gases.pipesteel").withStyle(ChatFormatting.ITALIC)).setSeparateStart()); - pageData.add(new TextWrapperObject(ElectroTextUtils.guidebook("chapter.gases.pipecapacity", ChatFormatter.formatFluidMilibuckets(SubtypeGasPipe.UNINSULATEDSTEEL.maxTransfer))).setSeparateStart()); - pageData.add(new TextWrapperObject(ElectroTextUtils.guidebook("chapter.gases.pipepressure", ChatFormatter.getChatDisplayShort(SubtypeGasPipe.UNINSULATEDSTEEL.pipeMaterial.maxPressure, DisplayUnit.PRESSURE_ATM))).setSeparateStart()); + pageData.add(new TextWrapperObject(ElectroTextUtils.guidebook("chapter.gases.pipecapacity", ChatFormatter.formatFluidMilibuckets(SubtypeGasPipe.UNINSULATEDSTEEL.getMaxTransfer()))).setSeparateStart()); + pageData.add(new TextWrapperObject(ElectroTextUtils.guidebook("chapter.gases.pipepressure", ChatFormatter.getChatDisplayShort(SubtypeGasPipe.UNINSULATEDSTEEL.getPipeMaterial().getMaxPressuire(), DisplayUnit.PRESSURE_ATM))).setSeparateStart()); blankLine(); pageData.add(new TextWrapperObject(ElectroTextUtils.guidebook("chapter.gases.pipeplastic").withStyle(ChatFormatting.ITALIC)).setSeparateStart()); - pageData.add(new TextWrapperObject(ElectroTextUtils.guidebook("chapter.gases.pipecapacity", ChatFormatter.formatFluidMilibuckets(SubtypeGasPipe.UNINSULATEDPLASTIC.maxTransfer))).setSeparateStart()); - pageData.add(new TextWrapperObject(ElectroTextUtils.guidebook("chapter.gases.pipepressure", ChatFormatter.getChatDisplayShort(SubtypeGasPipe.UNINSULATEDPLASTIC.pipeMaterial.maxPressure, DisplayUnit.PRESSURE_ATM))).setSeparateStart()); + pageData.add(new TextWrapperObject(ElectroTextUtils.guidebook("chapter.gases.pipecapacity", ChatFormatter.formatFluidMilibuckets(SubtypeGasPipe.UNINSULATEDPLASTIC.getMaxTransfer()))).setSeparateStart()); + pageData.add(new TextWrapperObject(ElectroTextUtils.guidebook("chapter.gases.pipepressure", ChatFormatter.getChatDisplayShort(SubtypeGasPipe.UNINSULATEDPLASTIC.getPipeMaterial().getMaxPressuire(), DisplayUnit.PRESSURE_ATM))).setSeparateStart()); blankLine(); pageData.add(new TextWrapperObject(ElectroTextUtils.guidebook("chapter.gases.l13.2")).setSeparateStart()); blankLine(); diff --git a/src/main/java/electrodynamics/common/block/chemicalreactor/BlockChemicalReactorExtra.java b/src/main/java/electrodynamics/common/block/chemicalreactor/BlockChemicalReactorExtra.java index 60a607d8c..a82eb2053 100644 --- a/src/main/java/electrodynamics/common/block/chemicalreactor/BlockChemicalReactorExtra.java +++ b/src/main/java/electrodynamics/common/block/chemicalreactor/BlockChemicalReactorExtra.java @@ -3,11 +3,17 @@ import electrodynamics.common.block.voxelshapes.VoxelShapeProvider; import electrodynamics.common.tile.machines.chemicalreactor.TileChemicalReactorDummy; import electrodynamics.prefab.block.GenericMachineBlock; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; import net.minecraft.core.Vec3i; +import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.block.RenderShape; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.storage.loot.LootParams; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.HitResult; import java.util.Collections; import java.util.List; @@ -44,4 +50,10 @@ private Location(int y){ offsetUpFromParent = new Vec3i(0, y, 0); } } + + @Override + public ItemStack getCloneItemStack(BlockState state, HitResult target, LevelReader level, BlockPos pos, Player player) { + BlockPos offset = pos.offset(loc.offsetDownToParent); + return level.getBlockState(offset).getCloneItemStack(new BlockHitResult(offset.getCenter(), Direction.DOWN, offset, false), level, offset, player); + } } diff --git a/src/main/java/electrodynamics/common/block/connect/BlockFluidPipe.java b/src/main/java/electrodynamics/common/block/connect/BlockFluidPipe.java index 47db8720e..456782c70 100644 --- a/src/main/java/electrodynamics/common/block/connect/BlockFluidPipe.java +++ b/src/main/java/electrodynamics/common/block/connect/BlockFluidPipe.java @@ -4,14 +4,13 @@ import com.mojang.serialization.MapCodec; -import electrodynamics.api.network.cable.IRefreshableCable; import electrodynamics.api.network.cable.type.IFluidPipe; import electrodynamics.common.block.connect.util.AbstractRefreshingConnectBlock; import electrodynamics.common.block.connect.util.EnumConnectType; import electrodynamics.common.block.subtype.SubtypeFluidPipe; import electrodynamics.common.network.utils.FluidUtilities; +import electrodynamics.common.tile.pipelines.fluid.GenericTileFluidPipe; import electrodynamics.common.tile.pipelines.fluid.TileFluidPipe; -import electrodynamics.prefab.tile.types.GenericConnectTile; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.level.block.BaseEntityBlock; @@ -21,13 +20,13 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; -public class BlockFluidPipe extends AbstractRefreshingConnectBlock { +public class BlockFluidPipe extends AbstractRefreshingConnectBlock { public static final HashSet PIPESET = new HashSet<>(); - public final SubtypeFluidPipe pipe; + public final IFluidPipe pipe; - public BlockFluidPipe(SubtypeFluidPipe pipe) { + public BlockFluidPipe(IFluidPipe pipe) { super(Blocks.IRON_BLOCK.properties().sound(SoundType.METAL).strength(0.15f).dynamicShape().noOcclusion(), 3); this.pipe = pipe; PIPESET.add(this); @@ -39,24 +38,19 @@ public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { } @Override - public BlockState refreshConnections(BlockState otherState, BlockEntity otherTile, BlockState state, BlockEntity thisTile, Direction dir) { - if(!(thisTile instanceof GenericConnectTile)) { - return state; - } - GenericConnectTile thisConnect = (GenericConnectTile) thisTile; + public EnumConnectType getConnection(BlockState otherState, BlockEntity otherTile, GenericTileFluidPipe thisConductor, Direction dir) { EnumConnectType connection = EnumConnectType.NONE; - if (otherTile instanceof IFluidPipe) { + if (otherTile instanceof GenericTileFluidPipe) { connection = EnumConnectType.WIRE; } else if (FluidUtilities.isFluidReceiver(otherTile, dir.getOpposite())) { connection = EnumConnectType.INVENTORY; } - thisConnect.writeConnection(dir, connection); - return state; + return connection; } @Override - public IRefreshableCable getCableIfValid(BlockEntity tile) { - if (tile instanceof IFluidPipe pipe) { + public GenericTileFluidPipe getCableIfValid(BlockEntity tile) { + if (tile instanceof GenericTileFluidPipe pipe) { return pipe; } return null; diff --git a/src/main/java/electrodynamics/common/block/connect/BlockGasPipe.java b/src/main/java/electrodynamics/common/block/connect/BlockGasPipe.java index 884bfff48..cd42ce543 100644 --- a/src/main/java/electrodynamics/common/block/connect/BlockGasPipe.java +++ b/src/main/java/electrodynamics/common/block/connect/BlockGasPipe.java @@ -5,38 +5,31 @@ import com.mojang.serialization.MapCodec; import electrodynamics.api.gas.Gas; -import electrodynamics.api.network.cable.IRefreshableCable; import electrodynamics.api.network.cable.type.IGasPipe; import electrodynamics.common.block.connect.util.AbstractRefreshingConnectBlock; import electrodynamics.common.block.connect.util.EnumConnectType; -import electrodynamics.common.block.states.ElectrodynamicsBlockStates; import electrodynamics.common.block.subtype.SubtypeGasPipe; -import electrodynamics.common.block.subtype.SubtypeGasPipe.InsulationMaterial; import electrodynamics.common.network.type.GasNetwork; import electrodynamics.common.network.utils.GasUtilities; +import electrodynamics.common.tile.pipelines.gas.GenericTileGasPipe; import electrodynamics.common.tile.pipelines.gas.TileGasPipe; -import electrodynamics.prefab.tile.types.GenericConnectTile; -import electrodynamics.prefab.utilities.Scheduler; -import electrodynamics.registers.ElectrodynamicsBlocks; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.BaseEntityBlock; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; -public class BlockGasPipe extends AbstractRefreshingConnectBlock { +public class BlockGasPipe extends AbstractRefreshingConnectBlock { public static final HashSet PIPESET = new HashSet<>(); - public final SubtypeGasPipe pipe; + public final IGasPipe pipe; - public BlockGasPipe(SubtypeGasPipe pipe) { - super(pipe.material.sound(pipe.soundType).strength(0.15f).dynamicShape().noOcclusion(), pipe.radius); + public BlockGasPipe(IGasPipe pipe) { + super(pipe.getProperties().sound(pipe.getSoundType()).strength(0.15f).dynamicShape().noOcclusion(), pipe.getRadius()); this.pipe = pipe; @@ -44,6 +37,7 @@ public BlockGasPipe(SubtypeGasPipe pipe) { } + /* @Override public boolean isFlammable(BlockState state, BlockGetter world, BlockPos pos, Direction face) { return pipe.insulationMaterial.canCombust; @@ -73,6 +67,8 @@ public void onCaughtFire(BlockState state, Level world, BlockPos pos, Direction Scheduler.schedule(5, () -> world.setBlockAndUpdate(pos, ElectrodynamicsBlocks.BLOCKS_GASPIPE.getValue(SubtypeGasPipe.getPipeForType(pipe.pipeMaterial, InsulationMaterial.NONE)).defaultBlockState())); } + */ + @Override public void entityInside(BlockState state, Level worldIn, BlockPos pos, Entity entityIn) { TileGasPipe tile = (TileGasPipe) worldIn.getBlockEntity(pos); @@ -81,7 +77,7 @@ public void entityInside(BlockState state, Level worldIn, BlockPos pos, Entity e } GasNetwork network = tile.getNetwork(); - double multipler = pipe.insulationMaterial == InsulationMaterial.NONE ? 1.0 : 1.2; + double multipler = 1.0;//pipe.insulationMaterial == InsulationMaterial.NONE ? 1.0 : 1.2; if (network.temperatureOfTransmitted >= Gas.MINIMUM_HEAT_BURN_TEMP * multipler) { @@ -96,24 +92,19 @@ public void entityInside(BlockState state, Level worldIn, BlockPos pos, Entity e } @Override - public BlockState refreshConnections(BlockState otherState, BlockEntity otherTile, BlockState state, BlockEntity thisTile, Direction dir) { - if(!(thisTile instanceof GenericConnectTile)) { - return state; - } - GenericConnectTile thisConnect = (GenericConnectTile) thisTile; + public EnumConnectType getConnection(BlockState otherState, BlockEntity otherTile, GenericTileGasPipe thisConductor, Direction dir) { EnumConnectType connection = EnumConnectType.NONE; - if (otherTile instanceof IGasPipe) { + if (otherTile instanceof GenericTileGasPipe) { connection = EnumConnectType.WIRE; } else if (GasUtilities.isGasReciever(otherTile, dir.getOpposite())) { connection = EnumConnectType.INVENTORY; } - thisConnect.writeConnection(dir, connection); - return state; + return connection; } @Override - public IRefreshableCable getCableIfValid(BlockEntity tile) { - if (tile instanceof IGasPipe pipe) { + public GenericTileGasPipe getCableIfValid(BlockEntity tile) { + if (tile instanceof GenericTileGasPipe pipe) { return pipe; } return null; diff --git a/src/main/java/electrodynamics/common/block/connect/BlockLogisticalWire.java b/src/main/java/electrodynamics/common/block/connect/BlockLogisticalWire.java index f21ea9991..adc62e7b2 100644 --- a/src/main/java/electrodynamics/common/block/connect/BlockLogisticalWire.java +++ b/src/main/java/electrodynamics/common/block/connect/BlockLogisticalWire.java @@ -63,7 +63,7 @@ private static class ColorHandler { public static void registerColoredBlocks(RegisterColorHandlersEvent.Block event) { WIRES.forEach(block -> event.register((state, level, pos, tintIndex) -> { if (tintIndex == 0) { - return ((BlockLogisticalWire) block).wire.color.color.color(); + return ((BlockLogisticalWire) block).wire.getWireColor().getColor().color(); } if (tintIndex != 1) { return 0xFFFFFFFF; diff --git a/src/main/java/electrodynamics/common/block/connect/BlockWire.java b/src/main/java/electrodynamics/common/block/connect/BlockWire.java index 608c94029..409014353 100644 --- a/src/main/java/electrodynamics/common/block/connect/BlockWire.java +++ b/src/main/java/electrodynamics/common/block/connect/BlockWire.java @@ -6,8 +6,7 @@ import electrodynamics.api.References; import electrodynamics.api.electricity.IInsulator; -import electrodynamics.api.network.cable.IRefreshableCable; -import electrodynamics.api.network.cable.type.IConductor; +import electrodynamics.api.network.cable.type.IWire; import electrodynamics.common.block.connect.util.AbstractRefreshingConnectBlock; import electrodynamics.common.block.connect.util.EnumConnectType; import electrodynamics.common.block.states.ElectrodynamicsBlockStates; @@ -21,12 +20,10 @@ import electrodynamics.common.tile.electricitygrid.TileLogisticalWire; import electrodynamics.common.tile.electricitygrid.TileWire; import electrodynamics.common.tile.electricitygrid.transformer.TileGenericTransformer; -import electrodynamics.prefab.tile.types.GenericConnectTile; import electrodynamics.prefab.utilities.ElectricityUtils; import electrodynamics.prefab.utilities.Scheduler; import electrodynamics.prefab.utilities.math.Color; import electrodynamics.prefab.utilities.object.TransferPack; -import electrodynamics.registers.ElectrodynamicsBlocks; import electrodynamics.registers.ElectrodynamicsItems; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -60,31 +57,30 @@ import net.neoforged.neoforge.client.event.RegisterColorHandlersEvent; import net.neoforged.neoforge.common.Tags; -public class BlockWire extends AbstractRefreshingConnectBlock { +public class BlockWire extends AbstractRefreshingConnectBlock { public static final HashSet WIRES = new HashSet<>(); - public final SubtypeWire wire; + public final IWire wire; - public BlockWire(SubtypeWire wire) { - super(wire.insulation.material.sound(wire.insulation.soundType).strength(0.15f).dynamicShape().noOcclusion().randomTicks(), wire.insulation.radius); + public BlockWire(IWire wire) { + super(wire.getInsulation().getProperties().sound(wire.getInsulation().getSoundType()).strength(0.15f).dynamicShape().noOcclusion().randomTicks(), wire.getInsulation().wireRadius()); this.wire = wire; - - if (wire.wireClass != WireClass.LOGISTICAL) { + if (wire.getWireClass() != WireClass.LOGISTICAL) { WIRES.add(this); } } @Override public boolean isFlammable(BlockState state, BlockGetter world, BlockPos pos, Direction face) { - return !wire.insulation.fireProof; + return !wire.getInsulation().fireproof(); } @Override public void entityInside(BlockState state, Level worldIn, BlockPos pos, Entity entityIn) { TileWire tile = (TileWire) worldIn.getBlockEntity(pos); if (tile != null && tile.getNetwork() != null && tile.getNetwork().getActiveTransmitted() > 0) { - int shockVoltage = tile.wire.insulation.shockVoltage; + int shockVoltage = tile.wire.getInsulation().shockVoltage(); if (shockVoltage == 0 || tile.getNetwork().getActiveVoltage() > shockVoltage) { ElectricityUtils.electrecuteEntity(entityIn, TransferPack.joulesVoltage(tile.getNetwork().getActiveTransmitted(), tile.getNetwork().getActiveVoltage())); } @@ -105,11 +101,17 @@ protected ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Lev if (item == Items.SHEARS) { - if (wire.insulation == InsulationMaterial.CERAMIC) { + if (wire.getInsulation() == InsulationMaterial.CERAMIC) { + + BlockWire newWire = SubtypeWire.getWire(wire.getWireMaterial(), InsulationMaterial.WOOL, wire.getWireClass(), WireColor.BLACK); + + if (newWire == null) { + return ItemInteractionResult.FAIL; + } if (isServerSide) { - Block newWire = ElectrodynamicsBlocks.BLOCKS_WIRE.getValue(SubtypeWire.getWire(wire.conductor, InsulationMaterial.WOOL, wire.wireClass, WireColor.BLACK)); + //Block newWire = ElectrodynamicsBlocks.BLOCKS_WIRE.getValue(SubtypeWire.getWire(wire.conductor, InsulationMaterial.WOOL, wire.wireClass, WireColor.BLACK)); handleDataCopyAndSet(newWire.getStateForPlacement(newCtx), level, pos, player, hand, stack, state); @@ -128,11 +130,17 @@ protected ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Lev } - if (wire.insulation == InsulationMaterial.WOOL) { + if (wire.getInsulation() == InsulationMaterial.WOOL) { + + Block newWire = SubtypeWire.getWire(wire.getWireMaterial(), InsulationMaterial.BARE, WireClass.BARE, WireColor.NONE); + + if (newWire == null) { + return ItemInteractionResult.FAIL; + } if (isServerSide) { - Block newWire = ElectrodynamicsBlocks.BLOCKS_WIRE.getValue(SubtypeWire.getWire(wire.conductor, InsulationMaterial.BARE, WireClass.BARE, WireColor.NONE)); + //Block newWire = ElectrodynamicsBlocks.BLOCKS_WIRE.getValue(SubtypeWire.getWire(wire.conductor, InsulationMaterial.BARE, WireClass.BARE, WireColor.NONE)); handleDataCopyAndSet(newWire.getStateForPlacement(newCtx), level, pos, player, hand, stack, state); @@ -140,7 +148,7 @@ protected ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Lev handlePlayerItemDrops(player, ElectrodynamicsItems.ITEM_INSULATION.get()); - if (wire.wireClass == WireClass.LOGISTICAL) { + if (wire.getWireClass() == WireClass.LOGISTICAL) { handlePlayerItemDrops(player, Items.REDSTONE); @@ -164,11 +172,17 @@ protected ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Lev if (item == ElectrodynamicsItems.ITEM_INSULATION.get()) { - if (wire.insulation == InsulationMaterial.BARE) { + if (wire.getInsulation() == InsulationMaterial.BARE) { + + Block newWire = SubtypeWire.getWire(wire.getWireMaterial(), InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BLACK); + + if (newWire == null) { + return ItemInteractionResult.FAIL; + } if (isServerSide) { - Block newWire = ElectrodynamicsBlocks.BLOCKS_WIRE.getValue(SubtypeWire.getWire(wire.conductor, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BLACK)); + //Block newWire = ElectrodynamicsBlocks.BLOCKS_WIRE.getValue(SubtypeWire.getWire(wire.conductor, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BLACK)); handleDataCopyAndSet(newWire.getStateForPlacement(newCtx), level, pos, player, hand, stack, state); @@ -191,11 +205,18 @@ protected ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Lev } - if (item == ElectrodynamicsItems.ITEM_CERAMICINSULATION.get() && wire.insulation == InsulationMaterial.WOOL && wire.wireClass == WireClass.INSULATED) { + if (item == ElectrodynamicsItems.ITEM_CERAMICINSULATION.get() && wire.getInsulation() == InsulationMaterial.WOOL && wire.getWireClass() == WireClass.INSULATED) { + + Block newWire = SubtypeWire.getWire(wire.getWireMaterial(), InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.BROWN); + + if (newWire == null) { + return ItemInteractionResult.FAIL; + } + if (isServerSide) { - Block newWire = ElectrodynamicsBlocks.BLOCKS_WIRE.getValue(SubtypeWire.getWire(wire.conductor, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.BLACK)); + //Block newWire = ElectrodynamicsBlocks.BLOCKS_WIRE.getValue(SubtypeWire.getWire(wire.conductor, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.BLACK)); handleDataCopyAndSet(newWire.getStateForPlacement(newCtx), level, pos, player, hand, stack, state); @@ -214,11 +235,17 @@ protected ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Lev } - if (item.builtInRegistryHolder().is(Tags.Items.DUSTS_REDSTONE) && wire.insulation == InsulationMaterial.WOOL && wire.wireClass == WireClass.INSULATED) { + if (stack.is(Tags.Items.DUSTS_REDSTONE) && wire.getInsulation() == InsulationMaterial.WOOL && wire.getWireClass() == WireClass.INSULATED) { + + Block newWire = SubtypeWire.getWire(wire.getWireMaterial(), InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.BLACK); + + if (newWire == null) { + return ItemInteractionResult.FAIL; + } if (isServerSide) { - Block newWire = ElectrodynamicsBlocks.BLOCKS_WIRE.getValue(SubtypeWire.getWire(wire.conductor, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.BLACK)); + //Block newWire = ElectrodynamicsBlocks.BLOCKS_WIRE.getValue(SubtypeWire.getWire(wire.conductor, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.BLACK)); handleDataCopyAndSet(newWire.getStateForPlacement(newCtx), level, pos, player, hand, stack, state); @@ -237,13 +264,19 @@ protected ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Lev } - WireColor dyeColor = WireColor.getColorFromDye(item); + IWire.IWireColor dyeColor = WireColor.getColorFromDye(stack); + + if (dyeColor != null) { - if (dyeColor != null && (wire.wireClass == WireClass.INSULATED || wire.wireClass == WireClass.THICK || wire.wireClass == WireClass.CERAMIC || wire.wireClass == WireClass.LOGISTICAL)) { + Block newWire = SubtypeWire.getWire(wire.getWireMaterial(), wire.getInsulation(), wire.getWireClass(), dyeColor); + + if (newWire == null) { + return ItemInteractionResult.FAIL; + } if (isServerSide) { - Block newWire = ElectrodynamicsBlocks.BLOCKS_WIRE.getValue(SubtypeWire.getWire(wire.conductor, wire.insulation, wire.wireClass, dyeColor)); + //Block newWire = ElectrodynamicsBlocks.BLOCKS_WIRE.getValue(SubtypeWire.getWire(wire.conductor, wire.insulation, wire.wireClass, dyeColor)); handleDataCopyAndSet(newWire.getStateForPlacement(newCtx), level, pos, player, hand, stack, state); @@ -300,7 +333,7 @@ private void handlePlayerItemDrops(Player player, Item... items) { @Override public boolean isSignalSource(BlockState state) { - return ((BlockWire) state.getBlock()).wire.wireClass.conductsRedstone; + return ((BlockWire) state.getBlock()).wire.getWireClass().conductsRedstone(); } @Override @@ -319,7 +352,7 @@ public int getSignal(BlockState blockState, BlockGetter blockAccess, BlockPos po @Override public int getFlammability(BlockState state, BlockGetter world, BlockPos pos, Direction face) { - if (wire.insulation.fireProof) { + if (wire.getInsulation().fireproof()) { return 0; } @@ -328,7 +361,7 @@ public int getFlammability(BlockState state, BlockGetter world, BlockPos pos, Di @Override public int getFireSpreadSpeed(BlockState state, BlockGetter world, BlockPos pos, Direction face) { - if (wire.insulation.fireProof) { + if (wire.getInsulation().fireproof()) { return 0; } @@ -339,11 +372,14 @@ public int getFireSpreadSpeed(BlockState state, BlockGetter world, BlockPos pos, public void onCaughtFire(BlockState state, Level world, BlockPos pos, Direction face, LivingEntity igniter) { super.onCaughtFire(state, world, pos, face, igniter); Scheduler.schedule(5, () -> { - SubtypeWire wire = SubtypeWire.getWire(this.wire.conductor, InsulationMaterial.BARE, WireClass.BARE, WireColor.NONE); + + BlockWire wire = SubtypeWire.getWire(this.wire.getWireMaterial(), InsulationMaterial.BARE, WireClass.BARE, WireColor.NONE); + + //SubtypeWire wire = SubtypeWire.getWire(this.wire.conductor, InsulationMaterial.BARE, WireClass.BARE, WireColor.NONE); if (wire == null) { world.setBlockAndUpdate(pos, Blocks.AIR.defaultBlockState()); } else { - world.setBlockAndUpdate(pos, ElectrodynamicsBlocks.BLOCKS_WIRE.getValue(wire).defaultBlockState()); + world.setBlockAndUpdate(pos, wire.defaultBlockState()); } }); @@ -355,14 +391,10 @@ public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { } @Override - public BlockState refreshConnections(BlockState otherState, BlockEntity otherTile, BlockState state, BlockEntity thisTile, Direction dir) { - if(!(thisTile instanceof GenericConnectTile)) { - return state; - } - GenericConnectTile thisConnect = (GenericConnectTile) thisTile; + public EnumConnectType getConnection(BlockState otherState, BlockEntity otherTile, GenericTileWire thisConductor, Direction dir) { EnumConnectType connection = EnumConnectType.NONE; - if (otherTile instanceof IConductor conductor) { - if(conductor.getWireType().isDefaultColor() || wire.isDefaultColor() || conductor.getWireColor() == wire.color) { + if (otherTile instanceof GenericTileWire conductor) { + if (conductor.getCableType().isDefaultColor() || wire.isDefaultColor() || conductor.getWireColor() == wire.getWireColor()) { connection = EnumConnectType.WIRE; } else { connection = EnumConnectType.NONE; @@ -370,17 +402,16 @@ public BlockState refreshConnections(BlockState otherState, BlockEntity otherTil } else if (ElectricityUtils.isElectricReceiver(otherTile, dir.getOpposite()) || checkRedstone(otherState)) { connection = EnumConnectType.INVENTORY; } - thisConnect.writeConnection(dir, connection); - return state; + return connection; } private boolean checkRedstone(BlockState otherState) { - return otherState.isSignalSource() && wire.wireClass == WireClass.LOGISTICAL; + return otherState.isSignalSource() && wire.getWireClass() == WireClass.LOGISTICAL; } @Override - public IRefreshableCable getCableIfValid(BlockEntity tile) { - if (tile instanceof IConductor conductor && (conductor.getWireType().isDefaultColor() || wire.isDefaultColor() || conductor.getWireColor() == wire.color)) { + public GenericTileWire getCableIfValid(BlockEntity tile) { + if (tile instanceof GenericTileWire conductor && (conductor.getCableType().isDefaultColor() || wire.isDefaultColor() || conductor.getWireColor() == wire.getWireColor())) { return conductor; } return null; @@ -400,13 +431,13 @@ public void randomTick(BlockState state, ServerLevel level, BlockPos pos, Random double voltage = network.getActiveVoltage(); - if (voltage <= 0 || voltage <= wire.insulation.shockVoltage || network.getActiveTransmitted() <= 0) { + if (voltage <= 0 || voltage <= wire.getInsulation().shockVoltage() || network.getActiveTransmitted() <= 0) { return; } boolean overMaxVoltage = voltage > TileGenericTransformer.MAX_VOLTAGE_CAP; - double wireShockVoltage = Math.max(wire.insulation.shockVoltage, 1); + double wireShockVoltage = Math.max(wire.getInsulation().shockVoltage(), 1); BlockPos relativePos, firePos; BlockState relative; @@ -508,7 +539,7 @@ private static class ColorHandlerInternal { public static void registerColoredBlocks(RegisterColorHandlersEvent.Block event) { WIRES.forEach(block -> event.register((state, level, pos, tintIndex) -> { if (tintIndex == 0) { - return ((BlockWire) block).wire.color.color.color(); + return ((BlockWire) block).wire.getWireColor().getColor().color(); } return Color.WHITE.color(); }, block)); diff --git a/src/main/java/electrodynamics/common/block/connect/util/AbstractRefreshingConnectBlock.java b/src/main/java/electrodynamics/common/block/connect/util/AbstractRefreshingConnectBlock.java index 1a0f62df6..7d7798a25 100644 --- a/src/main/java/electrodynamics/common/block/connect/util/AbstractRefreshingConnectBlock.java +++ b/src/main/java/electrodynamics/common/block/connect/util/AbstractRefreshingConnectBlock.java @@ -3,71 +3,75 @@ import javax.annotation.Nullable; import electrodynamics.api.network.cable.IRefreshableCable; -import electrodynamics.prefab.utilities.BlockEntityUtils; +import electrodynamics.prefab.tile.types.GenericConnectTile; +import electrodynamics.prefab.utilities.WorldUtils; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; -public abstract class AbstractRefreshingConnectBlock extends AbstractConnectBlock { - - public AbstractRefreshingConnectBlock(Properties properties, double radius) { - super(properties, radius); - } - - @Override - public void onPlace(BlockState state, Level worldIn, BlockPos pos, BlockState oldState, boolean isMoving) { - super.onPlace(state, worldIn, pos, oldState, isMoving); - if (worldIn.isClientSide()) { - return; - } - BlockEntity tile = worldIn.getBlockEntity(pos); - IRefreshableCable conductor = getCableIfValid(tile); - if (conductor == null) { - return; - } - conductor.refreshNetwork(); - BlockPos relPos; - - - for (Direction dir : Direction.values()) { - relPos = pos.relative(dir); - state = refreshConnections(worldIn.getBlockState(relPos), worldIn.getBlockEntity(relPos), state, worldIn.getBlockEntity(pos), dir); - } - - } - - @Override - public BlockState updateShape(BlockState stateIn, Direction facing, BlockState facingState, LevelAccessor worldIn, BlockPos currentPos, BlockPos facingPos) { - BlockState superState = super.updateShape(stateIn, facing, facingState, worldIn, currentPos, facingPos); - if(worldIn.isClientSide()){ - return superState; - } - return refreshConnections(facingState, worldIn.getBlockEntity(facingPos), superState, worldIn.getBlockEntity(currentPos), facing); - } - - @Override - public void onNeighborChange(BlockState state, LevelReader world, BlockPos pos, BlockPos neighbor) { - super.onNeighborChange(state, world, pos, neighbor); - if (world.isClientSide()) { - return; - } - BlockEntity tile = world.getBlockEntity(pos); - IRefreshableCable conductor = getCableIfValid(tile); - if (conductor == null) { - return; - } - - refreshConnections(world.getBlockState(neighbor), world.getBlockEntity(neighbor), world.getBlockState(pos), world.getBlockEntity(pos), BlockEntityUtils.directionFromPos(pos, neighbor)); - conductor.refreshNetworkIfChange(); - } - - public abstract BlockState refreshConnections(BlockState otherState, BlockEntity otherTile, BlockState thisState, BlockEntity thisTile, Direction dir); - - @Nullable - public abstract IRefreshableCable getCableIfValid(BlockEntity tile); +public abstract class AbstractRefreshingConnectBlock extends AbstractConnectBlock { + + public AbstractRefreshingConnectBlock(Properties properties, double radius) { + super(properties, radius); + } + + @Override + public void onPlace(BlockState state, Level worldIn, BlockPos pos, BlockState oldState, boolean isMoving) { + super.onPlace(state, worldIn, pos, oldState, isMoving); + if (worldIn.isClientSide()) { + return; + } + BlockEntity tile = worldIn.getBlockEntity(pos); + CONDUCTOR conductor = getCableIfValid(tile); + if (conductor == null || conductor.isRemoved()) { + return; + } + + BlockPos relPos; + + EnumConnectType[] connections = new EnumConnectType[6]; + + for (Direction dir : Direction.values()) { + relPos = pos.relative(dir); + connections[dir.ordinal()] = getConnection(worldIn.getBlockState(relPos), worldIn.getBlockEntity(relPos), conductor, dir); + } + + conductor.writeConnections(Direction.values(), connections); + + } + + @Override + public void onNeighborChange(BlockState state, LevelReader world, BlockPos pos, BlockPos neighbor) { + + super.onNeighborChange(state, world, pos, neighbor); + + if (world.isClientSide()) { + return; + } + BlockEntity tile = world.getBlockEntity(pos); + CONDUCTOR conductor = getCableIfValid(tile); + if (conductor == null || conductor.isRemoved()) { + return; + } + + Direction facing = WorldUtils.getDirectionFromPosDelta(pos, neighbor); + + EnumConnectType currConnection = conductor.readConnections()[facing.ordinal()]; + + EnumConnectType connection = getConnection(world.getBlockState(neighbor), world.getBlockEntity(neighbor), conductor, facing); + + if (currConnection != connection && conductor.writeConnection(facing, connection)) { + conductor.updateNetwork(facing); + } + + } + + public abstract EnumConnectType getConnection(BlockState otherState, BlockEntity otherTile, CONDUCTOR thisConductor, Direction dir); + + @Nullable + public abstract CONDUCTOR getCableIfValid(BlockEntity tile); } diff --git a/src/main/java/electrodynamics/common/block/subtype/SubtypeFluidPipe.java b/src/main/java/electrodynamics/common/block/subtype/SubtypeFluidPipe.java index 441769c2f..eae404032 100644 --- a/src/main/java/electrodynamics/common/block/subtype/SubtypeFluidPipe.java +++ b/src/main/java/electrodynamics/common/block/subtype/SubtypeFluidPipe.java @@ -1,12 +1,13 @@ package electrodynamics.common.block.subtype; import electrodynamics.api.ISubtype; +import electrodynamics.api.network.cable.type.IFluidPipe; -public enum SubtypeFluidPipe implements ISubtype { +public enum SubtypeFluidPipe implements ISubtype, IFluidPipe { copper(5000), steel(10000); - public final long maxTransfer; + private final long maxTransfer; SubtypeFluidPipe(long maxTransfer) { this.maxTransfer = maxTransfer; @@ -27,4 +28,9 @@ public String forgeTag() { public boolean isItem() { return false; } + + @Override + public long getMaxTransfer() { + return maxTransfer; + } } diff --git a/src/main/java/electrodynamics/common/block/subtype/SubtypeGasPipe.java b/src/main/java/electrodynamics/common/block/subtype/SubtypeGasPipe.java index 3b998185d..696c235c0 100644 --- a/src/main/java/electrodynamics/common/block/subtype/SubtypeGasPipe.java +++ b/src/main/java/electrodynamics/common/block/subtype/SubtypeGasPipe.java @@ -4,13 +4,14 @@ import electrodynamics.api.ISubtype; import electrodynamics.api.gas.Gas; +import electrodynamics.api.network.cable.type.IGasPipe; import electrodynamics.prefab.utilities.ElectroTextUtils; import net.minecraft.network.chat.Component; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.state.BlockBehaviour.Properties; -public enum SubtypeGasPipe implements ISubtype { +public enum SubtypeGasPipe implements ISubtype, IGasPipe { /* * UNINSULATED @@ -33,16 +34,16 @@ public enum SubtypeGasPipe implements ISubtype { // WOOLINSULATEDSTEEL(PipeMaterial.STEEL, InsulationMaterial.WOOL, 30000, 3, Material.METAL, SoundType.WOOL), // WOOLINSULATEDPLASTIC(PipeMaterial.HDPE, InsulationMaterial.WOOL, 1000, 3, Material.STONE, SoundType.WOOL); - public final PipeMaterial pipeMaterial; - public final InsulationMaterial insulationMaterial; - public final double maxTransfer; - public final double effectivePipeHeatLoss; + private final PipeMaterial pipeMaterial; + private final InsulationMaterial insulationMaterial; + private final long maxTransfer; + private final double effectivePipeHeatLoss; - public final double radius; - public final Properties material; - public final SoundType soundType; + private final double radius; + private final Properties material; + private final SoundType soundType; - private SubtypeGasPipe(PipeMaterial pipeMaterial, InsulationMaterial insulationMaterial, double maxTransfer, double radius, Properties material, SoundType soundType) { + private SubtypeGasPipe(PipeMaterial pipeMaterial, InsulationMaterial insulationMaterial, long maxTransfer, double radius, Properties material, SoundType soundType) { this.pipeMaterial = pipeMaterial; this.insulationMaterial = insulationMaterial; this.maxTransfer = maxTransfer; @@ -53,6 +54,31 @@ private SubtypeGasPipe(PipeMaterial pipeMaterial, InsulationMaterial insulationM this.soundType = soundType; } + @Override + public long getMaxTransfer() { + return maxTransfer; + } + + @Override + public double getRadius() { + return radius; + } + + @Override + public Properties getProperties() { + return material; + } + + @Override + public SoundType getSoundType() { + return soundType; + } + + @Override + public IPipeMaterial getPipeMaterial() { + return pipeMaterial; + } + @Override public String tag() { return "gaspipe" + name().toLowerCase(Locale.ROOT); @@ -122,16 +148,16 @@ public static double getEffectiveHeatLoss(SubtypeGasPipe pipe, double gasTempera * @author skip999 * */ - public static enum PipeMaterial { + public static enum PipeMaterial implements IPipeMaterial { COPPER(10, 16, true, "pipematerialcopper"), // Them Con: 383, Ten Str: 70MPa (690 ATM) STEEL(1, 128, true, "pipematerialsteel"), // Them Con: 54, Ten Str: 250MPa (2467 ATM) HDPE(0.05, 16, false, "pipematerialplastic"); // Them Con: 0.48, Ten Str: 31MPa (305 ATM) - public final double heatLoss;// degree Kelvin per Pipe - public final int maxPressure;// atm + private final double heatLoss;// degree Kelvin per Pipe + private final int maxPressure;// atm - public final boolean corrodedByAcid; + private final boolean corrodedByAcid; private final String tooltipName; @@ -144,10 +170,20 @@ private PipeMaterial(double heatLoss, int maxPressure, boolean corrodedByAcid, S } - public Component getTranslatedName() { + @Override + public Component getName() { return ElectroTextUtils.tooltip(tooltipName); } + @Override + public int getMaxPressuire() { + return maxPressure; + } + + @Override + public boolean canBeCorroded() { + return canBeCorroded(); + } } /** diff --git a/src/main/java/electrodynamics/common/block/subtype/SubtypeWire.java b/src/main/java/electrodynamics/common/block/subtype/SubtypeWire.java index 4dfd57098..e5be06562 100644 --- a/src/main/java/electrodynamics/common/block/subtype/SubtypeWire.java +++ b/src/main/java/electrodynamics/common/block/subtype/SubtypeWire.java @@ -9,282 +9,318 @@ import javax.annotation.Nullable; import electrodynamics.api.ISubtype; +import electrodynamics.api.network.cable.type.IWire; +import electrodynamics.common.block.connect.BlockWire; import electrodynamics.common.tags.ElectrodynamicsTags; import electrodynamics.prefab.utilities.math.Color; import net.minecraft.tags.TagKey; import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.state.BlockBehaviour.Properties; import net.neoforged.neoforge.common.Tags; - -// Calculated using https://www.omnicalculator.com/physics/wire-resistance -// Area is actually 0.125 = 15625mm^2 -// Length is 1 meter + 2 meters of wire - 2 * center length -> 3 - 2 * 0.125 = 2.75 meters per wire block. this is static and isnt calculated dynamically even though -// wires are rarely connected in all directions. -// Also manipulated uniformally +import org.jetbrains.annotations.NotNull; //Storing the color on the enum was the cleanest solution... -public enum SubtypeWire implements ISubtype { +public enum SubtypeWire implements ISubtype, IWire { /* UNINSULATED */ - tin(Conductor.TIN, InsulationMaterial.BARE, WireClass.BARE, WireColor.NONE, WireColor.NONE), - iron(Conductor.IRON, InsulationMaterial.BARE, WireClass.BARE, WireColor.NONE, WireColor.NONE), - copper(Conductor.COPPER, InsulationMaterial.BARE, WireClass.BARE, WireColor.NONE, WireColor.NONE), - silver(Conductor.SILVER, InsulationMaterial.BARE, WireClass.BARE, WireColor.NONE, WireColor.NONE), - gold(Conductor.GOLD, InsulationMaterial.BARE, WireClass.BARE, WireColor.NONE, WireColor.NONE), - superconductive(Conductor.SUPERCONDUCTIVE, InsulationMaterial.BARE, WireClass.BARE, WireColor.NONE, WireColor.NONE), + tin(WireMaterial.TIN, InsulationMaterial.BARE, WireClass.BARE, WireColor.NONE, WireColor.NONE), + iron(WireMaterial.IRON, InsulationMaterial.BARE, WireClass.BARE, WireColor.NONE, WireColor.NONE), + copper(WireMaterial.COPPER, InsulationMaterial.BARE, WireClass.BARE, WireColor.NONE, WireColor.NONE), + silver(WireMaterial.SILVER, InsulationMaterial.BARE, WireClass.BARE, WireColor.NONE, WireColor.NONE), + gold(WireMaterial.GOLD, InsulationMaterial.BARE, WireClass.BARE, WireColor.NONE, WireColor.NONE), + superconductive(WireMaterial.SUPERCONDUCTIVE, InsulationMaterial.BARE, WireClass.BARE, WireColor.NONE, WireColor.NONE), /* INSULATED */ // black - insulatedtinblack(Conductor.TIN, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BLACK, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_TIN_WIRES), - insulatedironblack(Conductor.IRON, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BLACK, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_IRON_WIRES), - insulatedcopperblack(Conductor.COPPER, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BLACK, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_COPPER_WIRES), - insulatedsilverblack(Conductor.SILVER, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BLACK, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_SILVER_WIRES), - insulatedgoldblack(Conductor.GOLD, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BLACK, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_GOLD_WIRES), - insulatedsuperconductiveblack(Conductor.SUPERCONDUCTIVE, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BLACK, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_SUPERCONDUCTIVE_WIRES), + insulatedtinblack(WireMaterial.TIN, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BLACK, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_TIN_WIRES), + insulatedironblack(WireMaterial.IRON, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BLACK, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_IRON_WIRES), + insulatedcopperblack(WireMaterial.COPPER, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BLACK, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_COPPER_WIRES), + insulatedsilverblack(WireMaterial.SILVER, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BLACK, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_SILVER_WIRES), + insulatedgoldblack(WireMaterial.GOLD, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BLACK, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_GOLD_WIRES), + insulatedsuperconductiveblack(WireMaterial.SUPERCONDUCTIVE, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BLACK, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_SUPERCONDUCTIVE_WIRES), // red - insulatedtinred(Conductor.TIN, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.RED, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_TIN_WIRES), - insulatedironred(Conductor.IRON, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.RED, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_IRON_WIRES), - insulatedcopperred(Conductor.COPPER, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.RED, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_COPPER_WIRES), - insulatedsilverred(Conductor.SILVER, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.RED, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_SILVER_WIRES), - insulatedgoldred(Conductor.GOLD, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.RED, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_GOLD_WIRES), - insulatedsuperconductivered(Conductor.SUPERCONDUCTIVE, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.RED, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_SUPERCONDUCTIVE_WIRES), + insulatedtinred(WireMaterial.TIN, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.RED, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_TIN_WIRES), + insulatedironred(WireMaterial.IRON, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.RED, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_IRON_WIRES), + insulatedcopperred(WireMaterial.COPPER, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.RED, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_COPPER_WIRES), + insulatedsilverred(WireMaterial.SILVER, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.RED, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_SILVER_WIRES), + insulatedgoldred(WireMaterial.GOLD, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.RED, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_GOLD_WIRES), + insulatedsuperconductivered(WireMaterial.SUPERCONDUCTIVE, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.RED, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_SUPERCONDUCTIVE_WIRES), // white - insulatedtinwhite(Conductor.TIN, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.WHITE, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_TIN_WIRES), - insulatedironwhite(Conductor.IRON, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.WHITE, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_IRON_WIRES), - insulatedcopperwhite(Conductor.COPPER, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.WHITE, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_COPPER_WIRES), - insulatedsilverwhite(Conductor.SILVER, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.WHITE, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_SILVER_WIRES), - insulatedgoldwhite(Conductor.GOLD, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.WHITE, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_GOLD_WIRES), - insulatedsuperconductivewhite(Conductor.SUPERCONDUCTIVE, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.WHITE, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_SUPERCONDUCTIVE_WIRES), + insulatedtinwhite(WireMaterial.TIN, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.WHITE, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_TIN_WIRES), + insulatedironwhite(WireMaterial.IRON, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.WHITE, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_IRON_WIRES), + insulatedcopperwhite(WireMaterial.COPPER, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.WHITE, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_COPPER_WIRES), + insulatedsilverwhite(WireMaterial.SILVER, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.WHITE, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_SILVER_WIRES), + insulatedgoldwhite(WireMaterial.GOLD, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.WHITE, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_GOLD_WIRES), + insulatedsuperconductivewhite(WireMaterial.SUPERCONDUCTIVE, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.WHITE, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_SUPERCONDUCTIVE_WIRES), // green - insulatedtingreen(Conductor.TIN, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.GREEN, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_TIN_WIRES), - insulatedirongreen(Conductor.IRON, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.GREEN, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_IRON_WIRES), - insulatedcoppergreen(Conductor.COPPER, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.GREEN, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_COPPER_WIRES), - insulatedsilvergreen(Conductor.SILVER, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.GREEN, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_SILVER_WIRES), - insulatedgoldgreen(Conductor.GOLD, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.GREEN, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_GOLD_WIRES), - insulatedsuperconductivegreen(Conductor.SUPERCONDUCTIVE, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.GREEN, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_SUPERCONDUCTIVE_WIRES), + insulatedtingreen(WireMaterial.TIN, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.GREEN, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_TIN_WIRES), + insulatedirongreen(WireMaterial.IRON, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.GREEN, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_IRON_WIRES), + insulatedcoppergreen(WireMaterial.COPPER, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.GREEN, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_COPPER_WIRES), + insulatedsilvergreen(WireMaterial.SILVER, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.GREEN, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_SILVER_WIRES), + insulatedgoldgreen(WireMaterial.GOLD, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.GREEN, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_GOLD_WIRES), + insulatedsuperconductivegreen(WireMaterial.SUPERCONDUCTIVE, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.GREEN, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_SUPERCONDUCTIVE_WIRES), // blue - insulatedtinblue(Conductor.TIN, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BLUE, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_TIN_WIRES), - insulatedironblue(Conductor.IRON, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BLUE, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_IRON_WIRES), - insulatedcopperblue(Conductor.COPPER, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BLUE, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_COPPER_WIRES), - insulatedsilverblue(Conductor.SILVER, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BLUE, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_SILVER_WIRES), - insulatedgoldblue(Conductor.GOLD, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BLUE, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_GOLD_WIRES), - insulatedsuperconductiveblue(Conductor.SUPERCONDUCTIVE, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BLUE, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_SUPERCONDUCTIVE_WIRES), + insulatedtinblue(WireMaterial.TIN, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BLUE, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_TIN_WIRES), + insulatedironblue(WireMaterial.IRON, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BLUE, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_IRON_WIRES), + insulatedcopperblue(WireMaterial.COPPER, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BLUE, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_COPPER_WIRES), + insulatedsilverblue(WireMaterial.SILVER, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BLUE, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_SILVER_WIRES), + insulatedgoldblue(WireMaterial.GOLD, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BLUE, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_GOLD_WIRES), + insulatedsuperconductiveblue(WireMaterial.SUPERCONDUCTIVE, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BLUE, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_SUPERCONDUCTIVE_WIRES), // yellow - insulatedtinyellow(Conductor.TIN, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.YELLOW, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_TIN_WIRES), - insulatedironyellow(Conductor.IRON, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.YELLOW, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_IRON_WIRES), - insulatedcopperyellow(Conductor.COPPER, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.YELLOW, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_COPPER_WIRES), - insulatedsilveryellow(Conductor.SILVER, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.YELLOW, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_SILVER_WIRES), - insulatedgoldyellow(Conductor.GOLD, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.YELLOW, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_GOLD_WIRES), - insulatedsuperconductiveyellow(Conductor.SUPERCONDUCTIVE, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.YELLOW, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_SUPERCONDUCTIVE_WIRES), + insulatedtinyellow(WireMaterial.TIN, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.YELLOW, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_TIN_WIRES), + insulatedironyellow(WireMaterial.IRON, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.YELLOW, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_IRON_WIRES), + insulatedcopperyellow(WireMaterial.COPPER, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.YELLOW, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_COPPER_WIRES), + insulatedsilveryellow(WireMaterial.SILVER, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.YELLOW, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_SILVER_WIRES), + insulatedgoldyellow(WireMaterial.GOLD, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.YELLOW, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_GOLD_WIRES), + insulatedsuperconductiveyellow(WireMaterial.SUPERCONDUCTIVE, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.YELLOW, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_SUPERCONDUCTIVE_WIRES), // brown - insulatedtinbrown(Conductor.TIN, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BROWN, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_TIN_WIRES), - insulatedironbrown(Conductor.IRON, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BROWN, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_IRON_WIRES), - insulatedcopperbrown(Conductor.COPPER, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BROWN, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_COPPER_WIRES), - insulatedsilverbrown(Conductor.SILVER, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BROWN, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_SILVER_WIRES), - insulatedgoldbrown(Conductor.GOLD, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BROWN, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_GOLD_WIRES), - insulatedsuperconductivebrown(Conductor.SUPERCONDUCTIVE, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BROWN, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_SUPERCONDUCTIVE_WIRES), + insulatedtinbrown(WireMaterial.TIN, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BROWN, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_TIN_WIRES), + insulatedironbrown(WireMaterial.IRON, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BROWN, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_IRON_WIRES), + insulatedcopperbrown(WireMaterial.COPPER, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BROWN, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_COPPER_WIRES), + insulatedsilverbrown(WireMaterial.SILVER, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BROWN, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_SILVER_WIRES), + insulatedgoldbrown(WireMaterial.GOLD, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BROWN, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_GOLD_WIRES), + insulatedsuperconductivebrown(WireMaterial.SUPERCONDUCTIVE, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BROWN, WireColor.BLACK, ElectrodynamicsTags.Items.INSULATED_SUPERCONDUCTIVE_WIRES), /* HIGHLY INSULATED */ // black - highlyinsulatedtinblack(Conductor.TIN, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.BLACK, WireColor.BLACK, 4.0, ElectrodynamicsTags.Items.THICK_TIN_WIRES), - highlyinsulatedironblack(Conductor.IRON, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.BLACK, WireColor.BLACK, 4.0, ElectrodynamicsTags.Items.THICK_IRON_WIRES), - highlyinsulatedcopperblack(Conductor.COPPER, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.BLACK, WireColor.BLACK, 4.0, ElectrodynamicsTags.Items.THICK_COPPER_WIRES), - highlyinsulatedsilverblack(Conductor.SILVER, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.BLACK, WireColor.BLACK, 4.0, ElectrodynamicsTags.Items.THICK_SILVER_WIRES), - highlyinsulatedgoldblack(Conductor.GOLD, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.BLACK, WireColor.BLACK, 4.0, ElectrodynamicsTags.Items.THICK_GOLD_WIRES), - highlyinsulatedsuperconductiveblack(Conductor.SUPERCONDUCTIVE, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.BLACK, WireColor.BLACK, 4.0, ElectrodynamicsTags.Items.THICK_SUPERCONDUCTIVE_WIRES), + highlyinsulatedtinblack(WireMaterial.TIN, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.BLACK, WireColor.BLACK, 3.0, ElectrodynamicsTags.Items.THICK_TIN_WIRES), + highlyinsulatedironblack(WireMaterial.IRON, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.BLACK, WireColor.BLACK, 3.0, ElectrodynamicsTags.Items.THICK_IRON_WIRES), + highlyinsulatedcopperblack(WireMaterial.COPPER, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.BLACK, WireColor.BLACK, 3.0, ElectrodynamicsTags.Items.THICK_COPPER_WIRES), + highlyinsulatedsilverblack(WireMaterial.SILVER, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.BLACK, WireColor.BLACK, 3.0, ElectrodynamicsTags.Items.THICK_SILVER_WIRES), + highlyinsulatedgoldblack(WireMaterial.GOLD, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.BLACK, WireColor.BLACK, 3.0, ElectrodynamicsTags.Items.THICK_GOLD_WIRES), + highlyinsulatedsuperconductiveblack(WireMaterial.SUPERCONDUCTIVE, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.BLACK, WireColor.BLACK, 3.0, ElectrodynamicsTags.Items.THICK_SUPERCONDUCTIVE_WIRES), // red - highlyinsulatedtinred(Conductor.TIN, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.RED, WireColor.BLACK, 4.0, ElectrodynamicsTags.Items.THICK_TIN_WIRES), - highlyinsulatedironred(Conductor.IRON, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.RED, WireColor.BLACK, 4.0, ElectrodynamicsTags.Items.THICK_IRON_WIRES), - highlyinsulatedcopperred(Conductor.COPPER, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.RED, WireColor.BLACK, 4.0, ElectrodynamicsTags.Items.THICK_COPPER_WIRES), - highlyinsulatedsilverred(Conductor.SILVER, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.RED, WireColor.BLACK, 4.0, ElectrodynamicsTags.Items.THICK_SILVER_WIRES), - highlyinsulatedgoldred(Conductor.GOLD, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.RED, WireColor.BLACK, 4.0, ElectrodynamicsTags.Items.THICK_GOLD_WIRES), - highlyinsulatedsuperconductivered(Conductor.SUPERCONDUCTIVE, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.RED, WireColor.BLACK, 4.0, ElectrodynamicsTags.Items.THICK_SUPERCONDUCTIVE_WIRES), + highlyinsulatedtinred(WireMaterial.TIN, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.RED, WireColor.BLACK, 3.0, ElectrodynamicsTags.Items.THICK_TIN_WIRES), + highlyinsulatedironred(WireMaterial.IRON, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.RED, WireColor.BLACK, 3.0, ElectrodynamicsTags.Items.THICK_IRON_WIRES), + highlyinsulatedcopperred(WireMaterial.COPPER, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.RED, WireColor.BLACK, 3.0, ElectrodynamicsTags.Items.THICK_COPPER_WIRES), + highlyinsulatedsilverred(WireMaterial.SILVER, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.RED, WireColor.BLACK, 3.0, ElectrodynamicsTags.Items.THICK_SILVER_WIRES), + highlyinsulatedgoldred(WireMaterial.GOLD, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.RED, WireColor.BLACK, 3.0, ElectrodynamicsTags.Items.THICK_GOLD_WIRES), + highlyinsulatedsuperconductivered(WireMaterial.SUPERCONDUCTIVE, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.RED, WireColor.BLACK, 3.0, ElectrodynamicsTags.Items.THICK_SUPERCONDUCTIVE_WIRES), // white - highlyinsulatedtinwhite(Conductor.TIN, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.WHITE, WireColor.BLACK, 4.0, ElectrodynamicsTags.Items.THICK_TIN_WIRES), - highlyinsulatedironwhite(Conductor.IRON, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.WHITE, WireColor.BLACK, 4.0, ElectrodynamicsTags.Items.THICK_IRON_WIRES), - highlyinsulatedcopperwhite(Conductor.COPPER, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.WHITE, WireColor.BLACK, 4.0, ElectrodynamicsTags.Items.THICK_COPPER_WIRES), - highlyinsulatedsilverwhite(Conductor.SILVER, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.WHITE, WireColor.BLACK, 4.0, ElectrodynamicsTags.Items.THICK_SILVER_WIRES), - highlyinsulatedgoldwhite(Conductor.GOLD, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.WHITE, WireColor.BLACK, 4.0, ElectrodynamicsTags.Items.THICK_GOLD_WIRES), - highlyinsulatedsuperconductivewhite(Conductor.SUPERCONDUCTIVE, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.WHITE, WireColor.BLACK, 4.0, ElectrodynamicsTags.Items.THICK_SUPERCONDUCTIVE_WIRES), + highlyinsulatedtinwhite(WireMaterial.TIN, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.WHITE, WireColor.BLACK, 3.0, ElectrodynamicsTags.Items.THICK_TIN_WIRES), + highlyinsulatedironwhite(WireMaterial.IRON, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.WHITE, WireColor.BLACK, 3.0, ElectrodynamicsTags.Items.THICK_IRON_WIRES), + highlyinsulatedcopperwhite(WireMaterial.COPPER, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.WHITE, WireColor.BLACK, 3.0, ElectrodynamicsTags.Items.THICK_COPPER_WIRES), + highlyinsulatedsilverwhite(WireMaterial.SILVER, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.WHITE, WireColor.BLACK, 3.0, ElectrodynamicsTags.Items.THICK_SILVER_WIRES), + highlyinsulatedgoldwhite(WireMaterial.GOLD, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.WHITE, WireColor.BLACK, 3.0, ElectrodynamicsTags.Items.THICK_GOLD_WIRES), + highlyinsulatedsuperconductivewhite(WireMaterial.SUPERCONDUCTIVE, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.WHITE, WireColor.BLACK, 3.0, ElectrodynamicsTags.Items.THICK_SUPERCONDUCTIVE_WIRES), // green - highlyinsulatedtingreen(Conductor.TIN, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.GREEN, WireColor.BLACK, 4.0, ElectrodynamicsTags.Items.THICK_TIN_WIRES), - highlyinsulatedirongreen(Conductor.IRON, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.GREEN, WireColor.BLACK, 4.0, ElectrodynamicsTags.Items.THICK_IRON_WIRES), - highlyinsulatedcoppergreen(Conductor.COPPER, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.GREEN, WireColor.BLACK, 4.0, ElectrodynamicsTags.Items.THICK_COPPER_WIRES), - highlyinsulatedsilvergreen(Conductor.SILVER, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.GREEN, WireColor.BLACK, 4.0, ElectrodynamicsTags.Items.THICK_SILVER_WIRES), - highlyinsulatedgoldgreen(Conductor.GOLD, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.GREEN, WireColor.BLACK, 4.0, ElectrodynamicsTags.Items.THICK_GOLD_WIRES), - highlyinsulatedsuperconductivegreen(Conductor.SUPERCONDUCTIVE, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.GREEN, WireColor.BLACK, 4.0, ElectrodynamicsTags.Items.THICK_SUPERCONDUCTIVE_WIRES), + highlyinsulatedtingreen(WireMaterial.TIN, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.GREEN, WireColor.BLACK, 3.0, ElectrodynamicsTags.Items.THICK_TIN_WIRES), + highlyinsulatedirongreen(WireMaterial.IRON, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.GREEN, WireColor.BLACK, 3.0, ElectrodynamicsTags.Items.THICK_IRON_WIRES), + highlyinsulatedcoppergreen(WireMaterial.COPPER, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.GREEN, WireColor.BLACK, 3.0, ElectrodynamicsTags.Items.THICK_COPPER_WIRES), + highlyinsulatedsilvergreen(WireMaterial.SILVER, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.GREEN, WireColor.BLACK, 3.0, ElectrodynamicsTags.Items.THICK_SILVER_WIRES), + highlyinsulatedgoldgreen(WireMaterial.GOLD, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.GREEN, WireColor.BLACK, 3.0, ElectrodynamicsTags.Items.THICK_GOLD_WIRES), + highlyinsulatedsuperconductivegreen(WireMaterial.SUPERCONDUCTIVE, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.GREEN, WireColor.BLACK, 3.0, ElectrodynamicsTags.Items.THICK_SUPERCONDUCTIVE_WIRES), // blue - highlyinsulatedtinblue(Conductor.TIN, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.BLUE, WireColor.BLACK, 4.0, ElectrodynamicsTags.Items.THICK_TIN_WIRES), - highlyinsulatedironblue(Conductor.IRON, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.BLUE, WireColor.BLACK, 4.0, ElectrodynamicsTags.Items.THICK_IRON_WIRES), - highlyinsulatedcopperblue(Conductor.COPPER, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.BLUE, WireColor.BLACK, 4.0, ElectrodynamicsTags.Items.THICK_COPPER_WIRES), - highlyinsulatedsilverblue(Conductor.SILVER, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.BLUE, WireColor.BLACK, 4.0, ElectrodynamicsTags.Items.THICK_SILVER_WIRES), - highlyinsulatedgoldblue(Conductor.GOLD, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.BLUE, WireColor.BLACK, 4.0, ElectrodynamicsTags.Items.THICK_GOLD_WIRES), - highlyinsulatedsuperconductiveblue(Conductor.SUPERCONDUCTIVE, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.BLUE, WireColor.BLACK, 4.0, ElectrodynamicsTags.Items.THICK_SUPERCONDUCTIVE_WIRES), + highlyinsulatedtinblue(WireMaterial.TIN, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.BLUE, WireColor.BLACK, 3.0, ElectrodynamicsTags.Items.THICK_TIN_WIRES), + highlyinsulatedironblue(WireMaterial.IRON, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.BLUE, WireColor.BLACK, 3.0, ElectrodynamicsTags.Items.THICK_IRON_WIRES), + highlyinsulatedcopperblue(WireMaterial.COPPER, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.BLUE, WireColor.BLACK, 3.0, ElectrodynamicsTags.Items.THICK_COPPER_WIRES), + highlyinsulatedsilverblue(WireMaterial.SILVER, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.BLUE, WireColor.BLACK, 3.0, ElectrodynamicsTags.Items.THICK_SILVER_WIRES), + highlyinsulatedgoldblue(WireMaterial.GOLD, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.BLUE, WireColor.BLACK, 3.0, ElectrodynamicsTags.Items.THICK_GOLD_WIRES), + highlyinsulatedsuperconductiveblue(WireMaterial.SUPERCONDUCTIVE, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.BLUE, WireColor.BLACK, 3.0, ElectrodynamicsTags.Items.THICK_SUPERCONDUCTIVE_WIRES), // yellow - highlyinsulatedtinyellow(Conductor.TIN, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.YELLOW, WireColor.BLACK, 4.0, ElectrodynamicsTags.Items.THICK_TIN_WIRES), - highlyinsulatedironyellow(Conductor.IRON, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.YELLOW, WireColor.BLACK, 4.0, ElectrodynamicsTags.Items.THICK_IRON_WIRES), - highlyinsulatedcopperyellow(Conductor.COPPER, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.YELLOW, WireColor.BLACK, 4.0, ElectrodynamicsTags.Items.THICK_COPPER_WIRES), - highlyinsulatedsilveryellow(Conductor.SILVER, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.YELLOW, WireColor.BLACK, 4.0, ElectrodynamicsTags.Items.THICK_SILVER_WIRES), - highlyinsulatedgoldyellow(Conductor.GOLD, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.YELLOW, WireColor.BLACK, 4.0, ElectrodynamicsTags.Items.THICK_GOLD_WIRES), - highlyinsulatedsuperconductiveyellow(Conductor.SUPERCONDUCTIVE, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.YELLOW, WireColor.BLACK, 4.0, ElectrodynamicsTags.Items.THICK_SUPERCONDUCTIVE_WIRES), + highlyinsulatedtinyellow(WireMaterial.TIN, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.YELLOW, WireColor.BLACK, 3.0, ElectrodynamicsTags.Items.THICK_TIN_WIRES), + highlyinsulatedironyellow(WireMaterial.IRON, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.YELLOW, WireColor.BLACK, 3.0, ElectrodynamicsTags.Items.THICK_IRON_WIRES), + highlyinsulatedcopperyellow(WireMaterial.COPPER, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.YELLOW, WireColor.BLACK, 3.0, ElectrodynamicsTags.Items.THICK_COPPER_WIRES), + highlyinsulatedsilveryellow(WireMaterial.SILVER, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.YELLOW, WireColor.BLACK, 3.0, ElectrodynamicsTags.Items.THICK_SILVER_WIRES), + highlyinsulatedgoldyellow(WireMaterial.GOLD, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.YELLOW, WireColor.BLACK, 3.0, ElectrodynamicsTags.Items.THICK_GOLD_WIRES), + highlyinsulatedsuperconductiveyellow(WireMaterial.SUPERCONDUCTIVE, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.YELLOW, WireColor.BLACK, 3.0, ElectrodynamicsTags.Items.THICK_SUPERCONDUCTIVE_WIRES), // brown - highlyinsulatedtinbrown(Conductor.TIN, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.BROWN, WireColor.BLACK, 4.0, ElectrodynamicsTags.Items.THICK_TIN_WIRES), - highlyinsulatedironbrown(Conductor.IRON, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.BROWN, WireColor.BLACK, 4.0, ElectrodynamicsTags.Items.THICK_IRON_WIRES), - highlyinsulatedcopperbrown(Conductor.COPPER, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.BROWN, WireColor.BLACK, 4.0, ElectrodynamicsTags.Items.THICK_COPPER_WIRES), - highlyinsulatedsilverbrown(Conductor.SILVER, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.BROWN, WireColor.BLACK, 4.0, ElectrodynamicsTags.Items.THICK_SILVER_WIRES), - highlyinsulatedgoldbrown(Conductor.GOLD, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.BROWN, WireColor.BLACK, 4.0, ElectrodynamicsTags.Items.THICK_GOLD_WIRES), - highlyinsulatedsuperconductivebrown(Conductor.SUPERCONDUCTIVE, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.BROWN, WireColor.BLACK, 4.0, ElectrodynamicsTags.Items.THICK_SUPERCONDUCTIVE_WIRES), + highlyinsulatedtinbrown(WireMaterial.TIN, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.BROWN, WireColor.BLACK, 3.0, ElectrodynamicsTags.Items.THICK_TIN_WIRES), + highlyinsulatedironbrown(WireMaterial.IRON, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.BROWN, WireColor.BLACK, 3.0, ElectrodynamicsTags.Items.THICK_IRON_WIRES), + highlyinsulatedcopperbrown(WireMaterial.COPPER, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.BROWN, WireColor.BLACK, 3.0, ElectrodynamicsTags.Items.THICK_COPPER_WIRES), + highlyinsulatedsilverbrown(WireMaterial.SILVER, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.BROWN, WireColor.BLACK, 3.0, ElectrodynamicsTags.Items.THICK_SILVER_WIRES), + highlyinsulatedgoldbrown(WireMaterial.GOLD, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.BROWN, WireColor.BLACK, 3.0, ElectrodynamicsTags.Items.THICK_GOLD_WIRES), + highlyinsulatedsuperconductivebrown(WireMaterial.SUPERCONDUCTIVE, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.BROWN, WireColor.BLACK, 3.0, ElectrodynamicsTags.Items.THICK_SUPERCONDUCTIVE_WIRES), /* CERAMIC INSULATED */ // black - ceramicinsulatedtinblack(Conductor.TIN, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.BLACK, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_TIN_WIRES), - ceramicinsulatedironblack(Conductor.IRON, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.BLACK, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_IRON_WIRES), - ceramicinsulatedcopperblack(Conductor.COPPER, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.BLACK, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_COPPER_WIRES), - ceramicinsulatedsilverblack(Conductor.SILVER, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.BLACK, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_SILVER_WIRES), - ceramicinsulatedgoldblack(Conductor.GOLD, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.BLACK, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_GOLD_WIRES), - ceramicinsulatedsuperconductiveblack(Conductor.SUPERCONDUCTIVE, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.BLACK, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_SUPERCONDUCTIVE_WIRES), + ceramicinsulatedtinblack(WireMaterial.TIN, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.BLACK, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_TIN_WIRES), + ceramicinsulatedironblack(WireMaterial.IRON, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.BLACK, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_IRON_WIRES), + ceramicinsulatedcopperblack(WireMaterial.COPPER, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.BLACK, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_COPPER_WIRES), + ceramicinsulatedsilverblack(WireMaterial.SILVER, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.BLACK, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_SILVER_WIRES), + ceramicinsulatedgoldblack(WireMaterial.GOLD, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.BLACK, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_GOLD_WIRES), + ceramicinsulatedsuperconductiveblack(WireMaterial.SUPERCONDUCTIVE, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.BLACK, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_SUPERCONDUCTIVE_WIRES), // red - ceramicinsulatedtinred(Conductor.TIN, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.RED, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_TIN_WIRES), - ceramicinsulatedironred(Conductor.IRON, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.RED, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_IRON_WIRES), - ceramicinsulatedcopperred(Conductor.COPPER, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.RED, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_COPPER_WIRES), - ceramicinsulatedsilverred(Conductor.SILVER, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.RED, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_SILVER_WIRES), - ceramicinsulatedgoldred(Conductor.GOLD, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.RED, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_GOLD_WIRES), - ceramicinsulatedsuperconductivered(Conductor.SUPERCONDUCTIVE, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.RED, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_SUPERCONDUCTIVE_WIRES), + ceramicinsulatedtinred(WireMaterial.TIN, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.RED, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_TIN_WIRES), + ceramicinsulatedironred(WireMaterial.IRON, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.RED, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_IRON_WIRES), + ceramicinsulatedcopperred(WireMaterial.COPPER, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.RED, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_COPPER_WIRES), + ceramicinsulatedsilverred(WireMaterial.SILVER, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.RED, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_SILVER_WIRES), + ceramicinsulatedgoldred(WireMaterial.GOLD, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.RED, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_GOLD_WIRES), + ceramicinsulatedsuperconductivered(WireMaterial.SUPERCONDUCTIVE, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.RED, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_SUPERCONDUCTIVE_WIRES), // white - ceramicinsulatedtinwhite(Conductor.TIN, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.WHITE, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_TIN_WIRES), - ceramicinsulatedironwhite(Conductor.IRON, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.WHITE, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_IRON_WIRES), - ceramicinsulatedcopperwhite(Conductor.COPPER, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.WHITE, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_COPPER_WIRES), - ceramicinsulatedsilverwhite(Conductor.SILVER, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.WHITE, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_SILVER_WIRES), - ceramicinsulatedgoldwhite(Conductor.GOLD, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.WHITE, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_GOLD_WIRES), - ceramicinsulatedsuperconductivewhite(Conductor.SUPERCONDUCTIVE, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.WHITE, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_SUPERCONDUCTIVE_WIRES), + ceramicinsulatedtinwhite(WireMaterial.TIN, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.WHITE, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_TIN_WIRES), + ceramicinsulatedironwhite(WireMaterial.IRON, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.WHITE, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_IRON_WIRES), + ceramicinsulatedcopperwhite(WireMaterial.COPPER, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.WHITE, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_COPPER_WIRES), + ceramicinsulatedsilverwhite(WireMaterial.SILVER, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.WHITE, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_SILVER_WIRES), + ceramicinsulatedgoldwhite(WireMaterial.GOLD, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.WHITE, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_GOLD_WIRES), + ceramicinsulatedsuperconductivewhite(WireMaterial.SUPERCONDUCTIVE, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.WHITE, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_SUPERCONDUCTIVE_WIRES), // green - ceramicinsulatedtingreen(Conductor.TIN, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.GREEN, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_TIN_WIRES), - ceramicinsulatedirongreen(Conductor.IRON, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.GREEN, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_IRON_WIRES), - ceramicinsulatedcoppergreen(Conductor.COPPER, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.GREEN, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_COPPER_WIRES), - ceramicinsulatedsilvergreen(Conductor.SILVER, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.GREEN, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_SILVER_WIRES), - ceramicinsulatedgoldgreen(Conductor.GOLD, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.GREEN, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_GOLD_WIRES), - ceramicinsulatedsuperconductivegreen(Conductor.SUPERCONDUCTIVE, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.GREEN, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_SUPERCONDUCTIVE_WIRES), + ceramicinsulatedtingreen(WireMaterial.TIN, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.GREEN, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_TIN_WIRES), + ceramicinsulatedirongreen(WireMaterial.IRON, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.GREEN, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_IRON_WIRES), + ceramicinsulatedcoppergreen(WireMaterial.COPPER, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.GREEN, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_COPPER_WIRES), + ceramicinsulatedsilvergreen(WireMaterial.SILVER, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.GREEN, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_SILVER_WIRES), + ceramicinsulatedgoldgreen(WireMaterial.GOLD, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.GREEN, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_GOLD_WIRES), + ceramicinsulatedsuperconductivegreen(WireMaterial.SUPERCONDUCTIVE, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.GREEN, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_SUPERCONDUCTIVE_WIRES), // blue - ceramicinsulatedtinblue(Conductor.TIN, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.BLUE, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_TIN_WIRES), - ceramicinsulatedironblue(Conductor.IRON, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.BLUE, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_IRON_WIRES), - ceramicinsulatedcopperblue(Conductor.COPPER, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.BLUE, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_COPPER_WIRES), - ceramicinsulatedsilverblue(Conductor.SILVER, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.BLUE, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_SILVER_WIRES), - ceramicinsulatedgoldblue(Conductor.GOLD, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.BLUE, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_GOLD_WIRES), - ceramicinsulatedsuperconductiveblue(Conductor.SUPERCONDUCTIVE, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.BLUE, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_SUPERCONDUCTIVE_WIRES), + ceramicinsulatedtinblue(WireMaterial.TIN, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.BLUE, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_TIN_WIRES), + ceramicinsulatedironblue(WireMaterial.IRON, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.BLUE, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_IRON_WIRES), + ceramicinsulatedcopperblue(WireMaterial.COPPER, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.BLUE, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_COPPER_WIRES), + ceramicinsulatedsilverblue(WireMaterial.SILVER, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.BLUE, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_SILVER_WIRES), + ceramicinsulatedgoldblue(WireMaterial.GOLD, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.BLUE, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_GOLD_WIRES), + ceramicinsulatedsuperconductiveblue(WireMaterial.SUPERCONDUCTIVE, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.BLUE, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_SUPERCONDUCTIVE_WIRES), // yellow - ceramicinsulatedtinyellow(Conductor.TIN, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.YELLOW, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_TIN_WIRES), - ceramicinsulatedironyellow(Conductor.IRON, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.YELLOW, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_IRON_WIRES), - ceramicinsulatedcopperyellow(Conductor.COPPER, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.YELLOW, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_COPPER_WIRES), - ceramicinsulatedsilveryellow(Conductor.SILVER, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.YELLOW, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_SILVER_WIRES), - ceramicinsulatedgoldyellow(Conductor.GOLD, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.YELLOW, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_GOLD_WIRES), - ceramicinsulatedsuperconductiveyellow(Conductor.SUPERCONDUCTIVE, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.YELLOW, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_SUPERCONDUCTIVE_WIRES), + ceramicinsulatedtinyellow(WireMaterial.TIN, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.YELLOW, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_TIN_WIRES), + ceramicinsulatedironyellow(WireMaterial.IRON, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.YELLOW, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_IRON_WIRES), + ceramicinsulatedcopperyellow(WireMaterial.COPPER, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.YELLOW, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_COPPER_WIRES), + ceramicinsulatedsilveryellow(WireMaterial.SILVER, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.YELLOW, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_SILVER_WIRES), + ceramicinsulatedgoldyellow(WireMaterial.GOLD, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.YELLOW, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_GOLD_WIRES), + ceramicinsulatedsuperconductiveyellow(WireMaterial.SUPERCONDUCTIVE, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.YELLOW, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_SUPERCONDUCTIVE_WIRES), // brown - ceramicinsulatedtinbrown(Conductor.TIN, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.BROWN, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_TIN_WIRES), - ceramicinsulatedironbrown(Conductor.IRON, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.BROWN, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_IRON_WIRES), - ceramicinsulatedcopperbrown(Conductor.COPPER, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.BROWN, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_COPPER_WIRES), - ceramicinsulatedsilverbrown(Conductor.SILVER, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.BROWN, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_SILVER_WIRES), - ceramicinsulatedgoldbrown(Conductor.GOLD, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.BROWN, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_GOLD_WIRES), - ceramicinsulatedsuperconductivebrown(Conductor.SUPERCONDUCTIVE, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.BROWN, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_SUPERCONDUCTIVE_WIRES), + ceramicinsulatedtinbrown(WireMaterial.TIN, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.BROWN, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_TIN_WIRES), + ceramicinsulatedironbrown(WireMaterial.IRON, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.BROWN, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_IRON_WIRES), + ceramicinsulatedcopperbrown(WireMaterial.COPPER, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.BROWN, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_COPPER_WIRES), + ceramicinsulatedsilverbrown(WireMaterial.SILVER, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.BROWN, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_SILVER_WIRES), + ceramicinsulatedgoldbrown(WireMaterial.GOLD, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.BROWN, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_GOLD_WIRES), + ceramicinsulatedsuperconductivebrown(WireMaterial.SUPERCONDUCTIVE, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.BROWN, WireColor.BROWN, ElectrodynamicsTags.Items.CERAMIC_SUPERCONDUCTIVE_WIRES), /* LOGISTICAL */ // black - logisticstinblack(Conductor.TIN, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.BLACK, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_TIN_WIRES), - logisticsironblack(Conductor.IRON, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.BLACK, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_IRON_WIRES), - logisticscopperblack(Conductor.COPPER, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.BLACK, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_COPPER_WIRES), - logisticssilverblack(Conductor.SILVER, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.BLACK, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_SILVER_WIRES), - logisticsgoldblack(Conductor.GOLD, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.BLACK, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_GOLD_WIRES), - logisticssuperconductiveblack(Conductor.SUPERCONDUCTIVE, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.BLACK, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_SUPERCONDUCTIVE_WIRES), + logisticstinblack(WireMaterial.TIN, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.BLACK, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_TIN_WIRES), + logisticsironblack(WireMaterial.IRON, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.BLACK, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_IRON_WIRES), + logisticscopperblack(WireMaterial.COPPER, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.BLACK, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_COPPER_WIRES), + logisticssilverblack(WireMaterial.SILVER, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.BLACK, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_SILVER_WIRES), + logisticsgoldblack(WireMaterial.GOLD, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.BLACK, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_GOLD_WIRES), + logisticssuperconductiveblack(WireMaterial.SUPERCONDUCTIVE, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.BLACK, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_SUPERCONDUCTIVE_WIRES), // red - logisticstinred(Conductor.TIN, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.RED, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_TIN_WIRES), - logisticsironred(Conductor.IRON, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.RED, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_IRON_WIRES), - logisticscopperred(Conductor.COPPER, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.RED, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_COPPER_WIRES), - logisticssilverred(Conductor.SILVER, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.RED, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_SILVER_WIRES), - logisticsgoldred(Conductor.GOLD, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.RED, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_GOLD_WIRES), - logisticssuperconductivered(Conductor.SUPERCONDUCTIVE, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.RED, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_SUPERCONDUCTIVE_WIRES), + logisticstinred(WireMaterial.TIN, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.RED, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_TIN_WIRES), + logisticsironred(WireMaterial.IRON, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.RED, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_IRON_WIRES), + logisticscopperred(WireMaterial.COPPER, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.RED, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_COPPER_WIRES), + logisticssilverred(WireMaterial.SILVER, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.RED, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_SILVER_WIRES), + logisticsgoldred(WireMaterial.GOLD, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.RED, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_GOLD_WIRES), + logisticssuperconductivered(WireMaterial.SUPERCONDUCTIVE, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.RED, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_SUPERCONDUCTIVE_WIRES), // white - logisticstinwhite(Conductor.TIN, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.WHITE, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_TIN_WIRES), - logisticsironwhite(Conductor.IRON, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.WHITE, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_IRON_WIRES), - logisticscopperwhite(Conductor.COPPER, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.WHITE, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_COPPER_WIRES), - logisticssilverwhite(Conductor.SILVER, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.WHITE, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_SILVER_WIRES), - logisticsgoldwhite(Conductor.GOLD, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.WHITE, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_GOLD_WIRES), - logisticssuperconductivewhite(Conductor.SUPERCONDUCTIVE, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.WHITE, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_SUPERCONDUCTIVE_WIRES), + logisticstinwhite(WireMaterial.TIN, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.WHITE, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_TIN_WIRES), + logisticsironwhite(WireMaterial.IRON, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.WHITE, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_IRON_WIRES), + logisticscopperwhite(WireMaterial.COPPER, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.WHITE, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_COPPER_WIRES), + logisticssilverwhite(WireMaterial.SILVER, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.WHITE, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_SILVER_WIRES), + logisticsgoldwhite(WireMaterial.GOLD, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.WHITE, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_GOLD_WIRES), + logisticssuperconductivewhite(WireMaterial.SUPERCONDUCTIVE, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.WHITE, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_SUPERCONDUCTIVE_WIRES), // green - logisticstingreen(Conductor.TIN, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.GREEN, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_TIN_WIRES), - logisticsirongreen(Conductor.IRON, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.GREEN, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_IRON_WIRES), - logisticscoppergreen(Conductor.COPPER, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.GREEN, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_COPPER_WIRES), - logisticssilvergreen(Conductor.SILVER, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.GREEN, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_SILVER_WIRES), - logisticsgoldgreen(Conductor.GOLD, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.GREEN, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_GOLD_WIRES), - logisticssuperconductivegreen(Conductor.SUPERCONDUCTIVE, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.GREEN, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_SUPERCONDUCTIVE_WIRES), + logisticstingreen(WireMaterial.TIN, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.GREEN, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_TIN_WIRES), + logisticsirongreen(WireMaterial.IRON, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.GREEN, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_IRON_WIRES), + logisticscoppergreen(WireMaterial.COPPER, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.GREEN, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_COPPER_WIRES), + logisticssilvergreen(WireMaterial.SILVER, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.GREEN, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_SILVER_WIRES), + logisticsgoldgreen(WireMaterial.GOLD, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.GREEN, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_GOLD_WIRES), + logisticssuperconductivegreen(WireMaterial.SUPERCONDUCTIVE, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.GREEN, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_SUPERCONDUCTIVE_WIRES), // blue - logisticstinblue(Conductor.TIN, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.BLUE, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_TIN_WIRES), - logisticsironblue(Conductor.IRON, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.BLUE, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_IRON_WIRES), - logisticscopperblue(Conductor.COPPER, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.BLUE, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_COPPER_WIRES), - logisticssilverblue(Conductor.SILVER, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.BLUE, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_SILVER_WIRES), - logisticsgoldblue(Conductor.GOLD, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.BLUE, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_GOLD_WIRES), - logisticssuperconductiveblue(Conductor.SUPERCONDUCTIVE, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.BLUE, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_SUPERCONDUCTIVE_WIRES), + logisticstinblue(WireMaterial.TIN, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.BLUE, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_TIN_WIRES), + logisticsironblue(WireMaterial.IRON, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.BLUE, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_IRON_WIRES), + logisticscopperblue(WireMaterial.COPPER, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.BLUE, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_COPPER_WIRES), + logisticssilverblue(WireMaterial.SILVER, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.BLUE, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_SILVER_WIRES), + logisticsgoldblue(WireMaterial.GOLD, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.BLUE, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_GOLD_WIRES), + logisticssuperconductiveblue(WireMaterial.SUPERCONDUCTIVE, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.BLUE, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_SUPERCONDUCTIVE_WIRES), // yellow - logisticstinyellow(Conductor.TIN, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.YELLOW, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_TIN_WIRES), - logisticsironyellow(Conductor.IRON, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.YELLOW, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_IRON_WIRES), - logisticscopperyellow(Conductor.COPPER, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.YELLOW, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_COPPER_WIRES), - logisticssilveryellow(Conductor.SILVER, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.YELLOW, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_SILVER_WIRES), - logisticsgoldyellow(Conductor.GOLD, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.YELLOW, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_GOLD_WIRES), - logisticssuperconductiveyellow(Conductor.SUPERCONDUCTIVE, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.YELLOW, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_SUPERCONDUCTIVE_WIRES), + logisticstinyellow(WireMaterial.TIN, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.YELLOW, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_TIN_WIRES), + logisticsironyellow(WireMaterial.IRON, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.YELLOW, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_IRON_WIRES), + logisticscopperyellow(WireMaterial.COPPER, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.YELLOW, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_COPPER_WIRES), + logisticssilveryellow(WireMaterial.SILVER, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.YELLOW, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_SILVER_WIRES), + logisticsgoldyellow(WireMaterial.GOLD, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.YELLOW, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_GOLD_WIRES), + logisticssuperconductiveyellow(WireMaterial.SUPERCONDUCTIVE, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.YELLOW, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_SUPERCONDUCTIVE_WIRES), // brown - logisticstinbrown(Conductor.TIN, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.BROWN, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_TIN_WIRES), - logisticsironbrown(Conductor.IRON, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.BROWN, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_IRON_WIRES), - logisticscopperbrown(Conductor.COPPER, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.BROWN, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_COPPER_WIRES), - logisticssilverbrown(Conductor.SILVER, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.BROWN, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_SILVER_WIRES), - logisticsgoldbrown(Conductor.GOLD, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.BROWN, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_GOLD_WIRES), - logisticssuperconductivebrown(Conductor.SUPERCONDUCTIVE, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.BROWN, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_SUPERCONDUCTIVE_WIRES); - - public static final HashMap> WIRES = new HashMap<>(); - - static { - for (SubtypeWire wire : SubtypeWire.values()) { - HashSet wireSet = WIRES.getOrDefault(wire.wireClass, new HashSet<>()); - wireSet.add(wire); - WIRES.put(wire.wireClass, wireSet); - } - } - - public final double resistance; - public final WireClass wireClass; - public final InsulationMaterial insulation; - public final Conductor conductor; - public final WireColor color; - public final WireColor defaultColor; + logisticstinbrown(WireMaterial.TIN, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.BROWN, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_TIN_WIRES), + logisticsironbrown(WireMaterial.IRON, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.BROWN, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_IRON_WIRES), + logisticscopperbrown(WireMaterial.COPPER, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.BROWN, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_COPPER_WIRES), + logisticssilverbrown(WireMaterial.SILVER, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.BROWN, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_SILVER_WIRES), + logisticsgoldbrown(WireMaterial.GOLD, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.BROWN, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_GOLD_WIRES), + logisticssuperconductivebrown(WireMaterial.SUPERCONDUCTIVE, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.BROWN, WireColor.BLACK, ElectrodynamicsTags.Items.LOGISTICAL_SUPERCONDUCTIVE_WIRES); + + public static final HashMap>>> WIRES = new HashMap<>(); + public static final HashSet WIRE_MATERIALS = new HashSet<>(); + + private final double resistance; + private final long ampacity; + private final WireClass wireClass; + private final InsulationMaterial insulation; + private final WireMaterial conductor; + private final WireColor color; + private final WireColor defaultColor; + private final boolean isDefaultColor; @Nullable - public TagKey itemTag = null; + private final TagKey itemTag; - private SubtypeWire(Conductor conductor, InsulationMaterial insulation, WireClass wireClass, WireColor color, WireColor defaultColor, double dividend, TagKey tag) { + private SubtypeWire(WireMaterial conductor, InsulationMaterial insulation, WireClass wireClass, WireColor color, WireColor defaultColor, double dividend, TagKey tag) { resistance = conductor.resistance / dividend; + this.ampacity = (long) (conductor.ampacity * dividend); this.conductor = conductor; this.insulation = insulation; this.wireClass = wireClass; this.color = color; this.defaultColor = defaultColor; + isDefaultColor = color == defaultColor; itemTag = tag; } - private SubtypeWire(Conductor conductor, InsulationMaterial insulation, WireClass wireClass, WireColor color, WireColor defaultColor, TagKey tag) { + private SubtypeWire(WireMaterial conductor, InsulationMaterial insulation, WireClass wireClass, WireColor color, WireColor defaultColor, TagKey tag) { this(conductor, insulation, wireClass, color, defaultColor, 1, tag); } - private SubtypeWire(Conductor conductor, InsulationMaterial insulation, WireClass wireClass, WireColor color, WireColor defaultColor, double dividend) { + private SubtypeWire(WireMaterial conductor, InsulationMaterial insulation, WireClass wireClass, WireColor color, WireColor defaultColor, double dividend) { this(conductor, insulation, wireClass, color, defaultColor, dividend, null); } - private SubtypeWire(Conductor conductor, InsulationMaterial insulation, WireClass wireClass, WireColor color, WireColor defaultColor) { + private SubtypeWire(WireMaterial conductor, InsulationMaterial insulation, WireClass wireClass, WireColor color, WireColor defaultColor) { this(conductor, insulation, wireClass, color, defaultColor, 1, null); } + @Override + public double getResistance() { + return resistance; + } + + @Override + public long getAmpacity() { + return ampacity; + } + + @Override + public IWireClass getWireClass() { + return wireClass; + } + + @Override + public IInsulationMaterial getInsulation() { + return insulation; + } + + @Override + public IWireMaterial getWireMaterial() { + return conductor; + } + + @Override + public IWireColor getWireColor() { + return color; + } + + @Override + public IWireColor getDefaultColor() { + return defaultColor; + } + + @org.jetbrains.annotations.Nullable + @Override + public TagKey getItemTag() { + return itemTag; + } + @Override public String tag() { return "wire" + name(); @@ -300,29 +336,24 @@ public boolean isItem() { return false; } + @Override public boolean isDefaultColor() { - return color == defaultColor; + return isDefaultColor; } @Nullable - public static SubtypeWire getWire(Conductor conductor, InsulationMaterial insulation, WireClass wireClass, WireColor color) { - - for (SubtypeWire wire : WIRES.getOrDefault(wireClass, new HashSet<>())) { - if (wire.conductor == conductor && wire.insulation == insulation && wire.wireClass == wireClass && wire.color == color) { - return wire; - } - } + public static BlockWire getWire(IWireMaterial wireMaterial, IInsulationMaterial insulation, IWireClass wireClass, IWireColor color) { - return null; + return WIRES.getOrDefault(wireMaterial, new HashMap<>()).getOrDefault(insulation, new HashMap<>()).getOrDefault(wireClass, new HashMap<>()).getOrDefault(color, null); } - public static SubtypeWire[] getWires(Conductor[] conductors, InsulationMaterial insulation, WireClass wireClass, WireColor... colors) { + public static BlockWire[] getWires(WireMaterial[] conductors, InsulationMaterial insulation, WireClass wireClass, WireColor... colors) { - List list = new ArrayList<>(); + List list = new ArrayList<>(); - SubtypeWire wire; + BlockWire wire; - for (Conductor conductor : conductors) { + for (WireMaterial conductor : conductors) { for (WireColor color : colors) { wire = SubtypeWire.getWire(conductor, insulation, wireClass, color); if (wire != null) { @@ -331,29 +362,28 @@ public static SubtypeWire[] getWires(Conductor[] conductors, InsulationMaterial } } - return list.toArray(new SubtypeWire[] {}); + return list.toArray(new BlockWire[0]); } /** * A distinction is made between this and WireClass, as there can be multiple different wires with the same insulation * but different properties like the Logistical Wire. It shares the same insulation value as the standard Insulated wire - * - * @author skip999 * + * @author skip999 */ - public static enum InsulationMaterial { + public static enum InsulationMaterial implements IInsulationMaterial { BARE(false, true, 0, 1, Blocks.IRON_BLOCK.properties(), SoundType.METAL), WOOL(true, false, 240, 2, Blocks.WHITE_WOOL.properties(), SoundType.WOOL), THICK_WOOL(true, false, 960, 3, Blocks.WHITE_WOOL.properties(), SoundType.WOOL), CERAMIC(true, true, 480, 3, Blocks.STONE.properties(), SoundType.TUFF); - public final boolean insulated; - public final boolean fireProof; - public final int shockVoltage; - public final double radius; - public final Properties material; - public final SoundType soundType; + private final boolean insulated; + private final boolean fireProof; + private final int shockVoltage; + private final double radius; + private final Properties material; + private final SoundType soundType; InsulationMaterial(boolean insulated, boolean fireProof, int shockVoltage, double radius, Properties material, SoundType sounndType) { this.insulated = insulated; @@ -363,15 +393,44 @@ public static enum InsulationMaterial { this.material = material; this.soundType = sounndType; } + + @Override + public boolean insulated() { + return insulated; + } + + @Override + public boolean fireproof() { + return fireProof; + } + + @Override + public int shockVoltage() { + return shockVoltage; + } + + @Override + public double wireRadius() { + return radius; + } + + @Override + public Properties getProperties() { + return material; + } + + @Override + public SoundType getSoundType() { + return soundType; + } } /** * This is a category enum to make distinctions between the different types of wires - * - * @author skip999 * + * @author skip999 */ - public static enum WireClass { + public static enum WireClass implements IWireClass { BARE(false), INSULATED(false), @@ -379,28 +438,42 @@ public static enum WireClass { CERAMIC(false), LOGISTICAL(true); - public final boolean conductsRedstone; + private final boolean conductsRedstone; WireClass(boolean conductsRedstone) { this.conductsRedstone = conductsRedstone; } + + @Override + public boolean conductsRedstone() { + return conductsRedstone; + } } - public static enum Conductor { + // Calculated using https://www.omnicalculator.com/physics/wire-resistance + // Area is actually 0.125 = 15625mm^2 + // Length is 1 meter + 2 meters of wire - 2 * center length -> 3 - 2 * 0.125 = 2.75 meters per wire block. this is static and isnt calculated dynamically even though + // wires are rarely connected in all directions. + // Also manipulated uniformally + public static enum WireMaterial implements IWireMaterial { + + COPPER(0.0030096, 360, 1.68E-8D), // annealed copper + GOLD(0.004294, 1000, 2.44E-8D), + IRON(0.01709, 100, 1.0E-7D), + SILVER(0.0027984, 600, 1.59E-8D), + SUPERCONDUCTIVE(0, Long.MAX_VALUE, 0D), + TIN(0.020064, 60, 1.09E-7D); // Tin has 15% the conductivity of copper. Tin resistance = copper / 0.15 - COPPER(0.0030096, 360), // annealed copper - GOLD(0.004294, 1000), - IRON(0.01709, 100), - SILVER(0.0027984, 600), - SUPERCONDUCTIVE(0, Long.MAX_VALUE), - TIN(0.020064, 60); // Tin has 15% the conductivity of copper. Tin resistance = copper / 0.15 + public static final double BASELINE_TEMP_K = 293.15D; - public final double resistance; - public final long ampacity; + private final double resistance; + private final long ampacity; + private final double resistivity; - Conductor(double resistance, long ampacity) { + WireMaterial(double resistance, long ampacity, double resistivity) { this.resistance = resistance; this.ampacity = ampacity; + this.resistivity = resistivity; } @Override @@ -408,10 +481,66 @@ public String toString() { return super.toString().toLowerCase(Locale.ROOT); } + @Override + public double resistance() { + return resistance; + } + + @Override + public long ampacity() { + return ampacity; + } + + @Override + public double materialResistivity() { + return resistivity; + } + + + /** + * All units assumed to be in units of meters and its equivalent powers + * + * @param resistivity unitless + * @param area meter^2 + * @param length meter + * @return the resistance per meter + */ + public static double calculateResistance(double resistivity, double area, double length) { + return (resistivity * length) / area; + } + + /** + * Returns the maximum permissible ampacity of a conductor based on its resistance + * + * @param maxOperatingTemp units of Kelvin + * @param resistance units of ohm / meter + * @param dialectricLoss units of watts / meter + * @param thermalResistance1 units of kelvin * meter / watts + * @param thermalResistance2 units of kelvin * meter / watts + * @param thermalResistance3 units of kelvin * meter / watts + * @param thermalResistance4 units of kelvin * meter / watts + * @param numConductors unitless + * @param ratioOfLosses1 unitless + * @param ratioOfLosses2 unitless + * @return the ampacity of this conductor as a long + */ + public static long calculateAmpacity(double maxOperatingTemp, double resistance, double dialectricLoss, double thermalResistance1, double thermalResistance2, double thermalResistance3, double thermalResistance4, double numConductors, double ratioOfLosses1, double ratioOfLosses2) { + + double deltaT = maxOperatingTemp - BASELINE_TEMP_K; + + double top = deltaT - dialectricLoss * (0.5 * thermalResistance1 + numConductors * (thermalResistance2 + thermalResistance3 + thermalResistance4)); + + double bottom = resistance * thermalResistance1 + numConductors * resistance * (1 + ratioOfLosses1) * thermalResistance2 + numConductors * resistance * (1 + ratioOfLosses1 + ratioOfLosses2) * (thermalResistance3 + thermalResistance4); + + double ampacity = Math.sqrt(top / bottom); + + return (long) ampacity; + + } } // based on NEC wire colors - public static enum WireColor { + public static enum WireColor implements IWireColor { NONE(255, 255, 255, 255, null), BLACK(40, 40, 40, 255, Tags.Items.DYES_BLACK), @@ -426,6 +555,8 @@ public static enum WireColor { @Nullable public final TagKey dyeTag; + public static final HashSet WIRE_COLORS = new HashSet<>(); + private WireColor(int r, int g, int b, int a, TagKey dyeTag) { color = new Color(r, g, b, a); this.dyeTag = dyeTag; @@ -437,14 +568,26 @@ public String toString() { } @Nullable - public static WireColor getColorFromDye(Item item) { - for (WireColor color : values()) { - if (color.dyeTag != null && item.builtInRegistryHolder().is(color.dyeTag)) { + public static IWireColor getColorFromDye(ItemStack item) { + for (IWireColor color : WIRE_COLORS) { + if (color.getDyeTag() != null && item.is(color.getDyeTag())) { return color; } } return null; } + + @NotNull + @Override + public Color getColor() { + return color; + } + + @NotNull + @Override + public TagKey getDyeTag() { + return dyeTag; + } } } diff --git a/src/main/java/electrodynamics/common/block/voxelshapes/ElectrodynamicsVoxelShapes.java b/src/main/java/electrodynamics/common/block/voxelshapes/ElectrodynamicsVoxelShapes.java index 1fe782011..6ace64494 100644 --- a/src/main/java/electrodynamics/common/block/voxelshapes/ElectrodynamicsVoxelShapes.java +++ b/src/main/java/electrodynamics/common/block/voxelshapes/ElectrodynamicsVoxelShapes.java @@ -1145,6 +1145,66 @@ public static void init() { // ); + public static final VoxelShapeProvider ROTARY_UNIFIER = VoxelShapeProvider.createDirectional( + // + Direction.EAST, + // + Stream.of( + // + Stream.of( + // + Block.box(0, 0, 0, 16, 5, 16), + // + Block.box(0, 15, 0, 16, 16, 16), + // + Block.box(1, 5, 1, 15, 15, 7), + // + Block.box(1, 5, 9, 15, 15, 15), + // + Block.box(3, 5, 7, 13, 15, 9), + // + Block.box(4, 5, 0, 12, 12, 1), + // + Block.box(4, 5, 15, 12, 12, 16), + // + Block.box(0, 13, 0, 16, 14, 1), + // + Block.box(0, 13, 15, 16, 14, 16), + // + Block.box(0, 13, 1, 1, 14, 15), + // + Block.box(15, 13, 1, 16, 14, 15) + // + ).reduce(Shapes::or).get(), + // + Stream.of( + // + Block.box(1.5, 6, 7, 2.5, 7, 9), + // + Block.box(1.5, 8, 7, 2.5, 9, 9), + // + Block.box(1.5, 10, 7, 2.5, 11, 9), + // + Block.box(1.5, 12, 7, 2.5, 13, 9) + // + ).reduce(Shapes::or).get(), + // + Stream.of( + // + Block.box(13.5, 6, 7, 14.5, 7, 9), + // + Block.box(13.5, 8, 7, 14.5, 9, 9), + // + Block.box(13.5, 10, 7, 14.5, 11, 9), + // + Block.box(13.5, 12, 7, 14.5, 13, 9) + // + ).reduce(Shapes::or).get() + // + ).reduce(Shapes::or).get() + // + ); + public static final VoxelShapeProvider SOLAR_PANEL = VoxelShapeProvider.createOmni( // Stream.of( diff --git a/src/main/java/electrodynamics/common/blockitem/types/BlockItemDescriptable.java b/src/main/java/electrodynamics/common/blockitem/types/BlockItemDescriptable.java index 4de51239c..bccf73e31 100644 --- a/src/main/java/electrodynamics/common/blockitem/types/BlockItemDescriptable.java +++ b/src/main/java/electrodynamics/common/blockitem/types/BlockItemDescriptable.java @@ -1,15 +1,13 @@ package electrodynamics.common.blockitem.types; +import java.util.ArrayList; import java.util.HashMap; -import java.util.HashSet; import java.util.List; -import java.util.function.Supplier; import electrodynamics.api.electricity.formatting.ChatFormatter; import electrodynamics.api.electricity.formatting.DisplayUnit; import electrodynamics.common.blockitem.BlockItemElectrodynamics; import electrodynamics.prefab.utilities.ElectroTextUtils; -import net.minecraft.ChatFormatting; import net.minecraft.core.Holder; import net.minecraft.core.component.DataComponents; import net.minecraft.network.chat.Component; @@ -21,8 +19,8 @@ public class BlockItemDescriptable extends BlockItemElectrodynamics { - private static final HashMap, HashSet> DESCRIPTION_MAPPINGS = new HashMap<>(); - private final static HashMap> PROCESSED_DESCRIPTION_MAPPINGS = new HashMap<>(); + private static final HashMap, ArrayList> DESCRIPTION_MAPPINGS = new HashMap<>(); + private final static HashMap> PROCESSED_DESCRIPTION_MAPPINGS = new HashMap<>(); private static boolean initialized = false; @@ -43,11 +41,9 @@ public void appendHoverText(ItemStack stack, TooltipContext context, List gotten = PROCESSED_DESCRIPTION_MAPPINGS.get(getBlock()); + ArrayList gotten = PROCESSED_DESCRIPTION_MAPPINGS.get(getBlock()); if (gotten != null) { - for (MutableComponent s : gotten) { - tooltip.add(s.withStyle(ChatFormatting.GRAY)); - } + tooltip.addAll(gotten); } if (stack.has(DataComponents.BLOCK_ENTITY_DATA)) { @@ -68,7 +64,7 @@ public int getMaxStackSize(ItemStack stack) { public static void addDescription(Holder block, MutableComponent description) { - HashSet set = DESCRIPTION_MAPPINGS.getOrDefault(block, new HashSet<>()); + ArrayList set = DESCRIPTION_MAPPINGS.getOrDefault(block, new ArrayList<>()); set.add(description); diff --git a/src/main/java/electrodynamics/common/blockitem/types/BlockItemFluidPipe.java b/src/main/java/electrodynamics/common/blockitem/types/BlockItemFluidPipe.java new file mode 100644 index 000000000..b9fca35d1 --- /dev/null +++ b/src/main/java/electrodynamics/common/blockitem/types/BlockItemFluidPipe.java @@ -0,0 +1,31 @@ +package electrodynamics.common.blockitem.types; + +import electrodynamics.api.electricity.formatting.ChatFormatter; +import electrodynamics.api.electricity.formatting.DisplayUnit; +import electrodynamics.common.block.connect.BlockFluidPipe; +import electrodynamics.common.blockitem.BlockItemElectrodynamics; +import electrodynamics.prefab.utilities.ElectroTextUtils; +import net.minecraft.ChatFormatting; +import net.minecraft.core.Holder; +import net.minecraft.network.chat.Component; +import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; + +import java.util.List; + +public class BlockItemFluidPipe extends BlockItemElectrodynamics { + + public final BlockFluidPipe pipe; + + public BlockItemFluidPipe(BlockFluidPipe block, Properties properties, Holder creativeTab) { + super(block, properties, creativeTab); + pipe = block; + } + + @Override + public void appendHoverText(ItemStack stack, TooltipContext context, List tooltips, TooltipFlag advanced) { + super.appendHoverText(stack, context, tooltips, advanced); + tooltips.add(ElectroTextUtils.tooltip("pipethroughput", ChatFormatter.getChatDisplayShort(pipe.pipe.getMaxTransfer() / 1000.0, DisplayUnit.BUCKETS).withStyle(ChatFormatting.GRAY)).withStyle(ChatFormatting.DARK_GRAY)); + } +} diff --git a/src/main/java/electrodynamics/common/blockitem/types/BlockItemGasPipe.java b/src/main/java/electrodynamics/common/blockitem/types/BlockItemGasPipe.java index 468655f28..3fc0707ea 100644 --- a/src/main/java/electrodynamics/common/blockitem/types/BlockItemGasPipe.java +++ b/src/main/java/electrodynamics/common/blockitem/types/BlockItemGasPipe.java @@ -26,9 +26,10 @@ public BlockItemGasPipe(BlockGasPipe pipe, Properties properties, Holder tooltips, TooltipFlag advanced) { super.appendHoverText(stack, context, tooltips, advanced); - tooltips.add(ElectroTextUtils.tooltip("pipematerial", pipe.pipe.pipeMaterial.getTranslatedName()).withStyle(ChatFormatting.GRAY)); + //tooltips.add(ElectroTextUtils.tooltip("pipematerial", pipe.pipe.getPipeMaterial().getName().copy().withStyle(ChatFormatting.GRAY)).withStyle(ChatFormatting.DARK_GRAY)); + tooltips.add(ElectroTextUtils.tooltip("pipethroughput", ChatFormatter.getChatDisplayShort(pipe.pipe.getMaxTransfer() / 1000.0, DisplayUnit.BUCKETS).withStyle(ChatFormatting.GRAY)).withStyle(ChatFormatting.DARK_GRAY)); // tooltips.add(TextUtils.tooltip("pipeinsulationmaterial", pipe.pipe.insulationMaterial.getTranslatedName()).withStyle(ChatFormatting.GRAY)); - tooltips.add(ElectroTextUtils.tooltip("pipemaximumpressure", ChatFormatter.getChatDisplayShort(pipe.pipe.pipeMaterial.maxPressure, DisplayUnit.PRESSURE_ATM)).withStyle(ChatFormatting.GRAY)); + tooltips.add(ElectroTextUtils.tooltip("pipemaximumpressure", ChatFormatter.getChatDisplayShort(pipe.pipe.getPipeMaterial().getMaxPressuire(), DisplayUnit.PRESSURE_ATM).withStyle(ChatFormatting.GRAY)).withStyle(ChatFormatting.DARK_GRAY)); // tooltips.add(TextUtils.tooltip("pipeheatloss", ChatFormatter.getChatDisplayShort(pipe.pipe.effectivePipeHeatLoss, DisplayUnit.TEMPERATURE_KELVIN)).withStyle(ChatFormatting.GRAY)); } diff --git a/src/main/java/electrodynamics/common/blockitem/types/BlockItemWire.java b/src/main/java/electrodynamics/common/blockitem/types/BlockItemWire.java index 3a8eea3d9..bbd2ce9a0 100644 --- a/src/main/java/electrodynamics/common/blockitem/types/BlockItemWire.java +++ b/src/main/java/electrodynamics/common/blockitem/types/BlockItemWire.java @@ -35,18 +35,18 @@ public BlockItemWire(BlockWire wire, Properties builder, Holder @Override public void appendHoverText(ItemStack stack, TooltipContext context, List tooltip, TooltipFlag flagIn) { super.appendHoverText(stack, context, tooltip, flagIn); - tooltip.add(ElectroTextUtils.tooltip("itemwire.resistance", ChatFormatter.getChatDisplayShort(wire.wire.resistance, DisplayUnit.RESISTANCE)).withStyle(ChatFormatting.GRAY)); - tooltip.add(ElectroTextUtils.tooltip("itemwire.maxamps", ChatFormatter.getChatDisplayShort(wire.wire.conductor.ampacity, DisplayUnit.AMPERE)).withStyle(ChatFormatting.GRAY)); - if (wire.wire.insulation.shockVoltage == 0) { - tooltip.add(ElectroTextUtils.tooltip("itemwire.info.uninsulated")); + tooltip.add(ElectroTextUtils.tooltip("itemwire.resistance", ChatFormatter.getChatDisplayShort(wire.wire.getResistance(), DisplayUnit.RESISTANCE).withStyle(ChatFormatting.GRAY)).withStyle(ChatFormatting.DARK_GRAY)); + tooltip.add(ElectroTextUtils.tooltip("itemwire.maxamps", ChatFormatter.getChatDisplayShort(wire.wire.getAmpacity(), DisplayUnit.AMPERE).withStyle(ChatFormatting.GRAY)).withStyle(ChatFormatting.DARK_GRAY)); + if (wire.wire.getInsulation().shockVoltage() == 0) { + tooltip.add(ElectroTextUtils.tooltip("itemwire.info.uninsulated").withStyle(ChatFormatting.GRAY)); } else { - tooltip.add(ElectroTextUtils.tooltip("itemwire.info.insulationrating", ChatFormatter.getChatDisplayShort(wire.wire.insulation.shockVoltage, DisplayUnit.VOLTAGE))); + tooltip.add(ElectroTextUtils.tooltip("itemwire.info.insulationrating", ChatFormatter.getChatDisplayShort(wire.wire.getInsulation().shockVoltage(), DisplayUnit.VOLTAGE).withStyle(ChatFormatting.GRAY)).withStyle(ChatFormatting.DARK_GRAY)); } - if (wire.wire.insulation.fireProof) { - ElectroTextUtils.tooltip("itemwire.info.fireproof"); + if (wire.wire.getInsulation().fireproof()) { + ElectroTextUtils.tooltip("itemwire.info.fireproof").withStyle(ChatFormatting.GRAY); } - if (wire.wire.wireClass.conductsRedstone) { - ElectroTextUtils.tooltip("itemwire.info.redstone"); + if (wire.wire.getWireClass().conductsRedstone()) { + ElectroTextUtils.tooltip("itemwire.info.redstone").withStyle(ChatFormatting.GRAY); } } @@ -57,7 +57,7 @@ private static class ColorHandler { public static void registerColoredBlocks(RegisterColorHandlersEvent.Item event) { WIRES.forEach(item -> event.register((stack, index) -> { if (index == 1) { - return item.wire.wire.color.color.color(); + return item.wire.wire.getWireColor().getColor().color(); } return Color.WHITE.color(); }, item)); diff --git a/src/main/java/electrodynamics/common/event/ServerEventHandler.java b/src/main/java/electrodynamics/common/event/ServerEventHandler.java index 3bbac1089..1e2111fb9 100644 --- a/src/main/java/electrodynamics/common/event/ServerEventHandler.java +++ b/src/main/java/electrodynamics/common/event/ServerEventHandler.java @@ -23,7 +23,9 @@ import electrodynamics.common.reloadlistener.CombustionFuelRegister; import electrodynamics.common.reloadlistener.GasCollectorChromoCardsRegister; import electrodynamics.common.reloadlistener.ThermoelectricGeneratorHeatRegister; +import electrodynamics.compatibility.mekanism.MekanismHandler; import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.ModList; import net.neoforged.fml.common.EventBusSubscriber; import net.neoforged.neoforge.event.AddReloadListenerEvent; import net.neoforged.neoforge.event.RegisterCommandsEvent; @@ -98,6 +100,11 @@ public static void addReloadListeners(AddReloadListenerEvent event) { event.addListener(CoalGeneratorFuelRegister.INSTANCE); event.addListener(ThermoelectricGeneratorHeatRegister.INSTANCE); event.addListener(GasCollectorChromoCardsRegister.INSTANCE); + + if(ModList.get().isLoaded(References.MEKANISM_ID)) { + MekanismHandler.addDataListener(event); + } + } @SubscribeEvent diff --git a/src/main/java/electrodynamics/common/inventory/container/tile/ContainerCircuitMonitor.java b/src/main/java/electrodynamics/common/inventory/container/tile/ContainerCircuitMonitor.java index d36d71ad0..e9e6017aa 100644 --- a/src/main/java/electrodynamics/common/inventory/container/tile/ContainerCircuitMonitor.java +++ b/src/main/java/electrodynamics/common/inventory/container/tile/ContainerCircuitMonitor.java @@ -23,4 +23,8 @@ public void addInventorySlots(Container inv, Inventory playerinv) { setPlayerInvOffset(40); } + @Override + public void addPlayerInventory(Inventory playerinv) { + + } } diff --git a/src/main/java/electrodynamics/common/inventory/container/tile/ContainerRotaryUnifier.java b/src/main/java/electrodynamics/common/inventory/container/tile/ContainerRotaryUnifier.java new file mode 100644 index 000000000..11459fe35 --- /dev/null +++ b/src/main/java/electrodynamics/common/inventory/container/tile/ContainerRotaryUnifier.java @@ -0,0 +1,34 @@ +package electrodynamics.common.inventory.container.tile; + +import electrodynamics.common.item.subtype.SubtypeItemUpgrade; +import electrodynamics.common.tile.compatibility.TileRotaryUnifier; +import electrodynamics.prefab.inventory.container.slot.item.type.SlotUpgrade; +import electrodynamics.prefab.inventory.container.types.GenericContainerBlockEntity; +import electrodynamics.registers.ElectrodynamicsMenuTypes; +import net.minecraft.world.Container; +import net.minecraft.world.SimpleContainer; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.ContainerData; +import net.minecraft.world.inventory.SimpleContainerData; + +public class ContainerRotaryUnifier extends GenericContainerBlockEntity { + + public static final SubtypeItemUpgrade[] VALID_UPGRADES = new SubtypeItemUpgrade[] { SubtypeItemUpgrade.advancedspeed, SubtypeItemUpgrade.basicspeed }; + + public ContainerRotaryUnifier(int id, Inventory playerinva) { + this(id, playerinva, new SimpleContainer(3), new SimpleContainerData(3)); + } + + public ContainerRotaryUnifier(int id, Inventory playerinv, Container inventory, ContainerData inventorydata) { + super(ElectrodynamicsMenuTypes.CONTAINER_ROTARYUNIFIER.get(), id, playerinv, inventory, inventorydata); + } + + @Override + public void addInventorySlots(Container inv, Inventory playerinv) { + + addSlot(new SlotUpgrade(inv, nextIndex(), 153, 14, VALID_UPGRADES)); + addSlot(new SlotUpgrade(inv, nextIndex(), 153, 34, VALID_UPGRADES)); + addSlot(new SlotUpgrade(inv, nextIndex(), 153, 54, VALID_UPGRADES)); + + } +} diff --git a/src/main/java/electrodynamics/common/item/ItemUpgrade.java b/src/main/java/electrodynamics/common/item/ItemUpgrade.java index fd852d9cd..7770796bd 100644 --- a/src/main/java/electrodynamics/common/item/ItemUpgrade.java +++ b/src/main/java/electrodynamics/common/item/ItemUpgrade.java @@ -39,12 +39,15 @@ public void appendHoverText(ItemStack stack, TooltipContext context, List ElectroTextUtils.tooltip("jetpack.mode").withStyle(ChatFormatting.GRAY).append(ElectroTextUtils.tooltip("jetpack.moderegular").withStyle(ChatFormatting.GREEN)); - case 1 -> ElectroTextUtils.tooltip("jetpack.mode").withStyle(ChatFormatting.GRAY).append(ElectroTextUtils.tooltip("jetpack.modehover").withStyle(ChatFormatting.AQUA)); - case 2 -> ElectroTextUtils.tooltip("jetpack.mode").withStyle(ChatFormatting.GRAY).append(ElectroTextUtils.tooltip("jetpack.modeelytra").withStyle(ChatFormatting.YELLOW)); - case 3 -> ElectroTextUtils.tooltip("jetpack.mode").withStyle(ChatFormatting.GRAY).append(ElectroTextUtils.tooltip("jetpack.modeoff").withStyle(ChatFormatting.RED)); + case 0 -> ElectroTextUtils.tooltip("jetpack.mode").withStyle(ChatFormatting.DARK_GRAY).append(ElectroTextUtils.tooltip("jetpack.moderegular").withStyle(ChatFormatting.GREEN)); + case 1 -> ElectroTextUtils.tooltip("jetpack.mode").withStyle(ChatFormatting.DARK_GRAY).append(ElectroTextUtils.tooltip("jetpack.modehover").withStyle(ChatFormatting.AQUA)); + case 2 -> ElectroTextUtils.tooltip("jetpack.mode").withStyle(ChatFormatting.DARK_GRAY).append(ElectroTextUtils.tooltip("jetpack.modeelytra").withStyle(ChatFormatting.YELLOW)); + case 3 -> ElectroTextUtils.tooltip("jetpack.mode").withStyle(ChatFormatting.DARK_GRAY).append(ElectroTextUtils.tooltip("jetpack.modeoff").withStyle(ChatFormatting.RED)); default -> Component.empty(); }; } diff --git a/src/main/java/electrodynamics/common/item/gear/armor/types/ItemNightVisionGoggles.java b/src/main/java/electrodynamics/common/item/gear/armor/types/ItemNightVisionGoggles.java index 0e7858459..d61bdc702 100644 --- a/src/main/java/electrodynamics/common/item/gear/armor/types/ItemNightVisionGoggles.java +++ b/src/main/java/electrodynamics/common/item/gear/armor/types/ItemNightVisionGoggles.java @@ -103,14 +103,14 @@ public boolean isBarVisible(ItemStack stack) { @Override public void appendHoverText(ItemStack stack, TooltipContext context, List tooltip, TooltipFlag flagIn) { super.appendHoverText(stack, context, tooltip, flagIn); - tooltip.add(ElectroTextUtils.tooltip("item.electric.info", ChatFormatter.getChatDisplayShort(getJoulesStored(stack), DisplayUnit.JOULES)).withStyle(ChatFormatting.GRAY)); - tooltip.add(ElectroTextUtils.tooltip("item.electric.voltage", ElectroTextUtils.ratio(ChatFormatter.getChatDisplayShort(properties.receive.getVoltage(), DisplayUnit.VOLTAGE), ChatFormatter.getChatDisplayShort(properties.extract.getVoltage(), DisplayUnit.VOLTAGE))).withStyle(ChatFormatting.RED)); + tooltip.add(ElectroTextUtils.tooltip("item.electric.info", ElectroTextUtils.ratio(ChatFormatter.getChatDisplayShort(getJoulesStored(stack), DisplayUnit.JOULES), ChatFormatter.getChatDisplayShort(getMaximumCapacity(stack), DisplayUnit.JOULES)).withStyle(ChatFormatting.GRAY)).withStyle(ChatFormatting.DARK_GRAY)); + tooltip.add(ElectroTextUtils.tooltip("item.electric.voltage", ChatFormatter.getChatDisplayShort(properties.receive.getVoltage(), DisplayUnit.VOLTAGE).withStyle(ChatFormatting.GRAY)).withStyle(ChatFormatting.DARK_GRAY)); + IItemElectric.addBatteryTooltip(stack, context, tooltip); if (stack.getOrDefault(ElectrodynamicsDataComponentTypes.ON, false)) { - tooltip.add(ElectroTextUtils.tooltip("nightvisiongoggles.status").withStyle(ChatFormatting.GRAY).append(ElectroTextUtils.tooltip("nightvisiongoggles.on").withStyle(ChatFormatting.GREEN))); + tooltip.add(ElectroTextUtils.tooltip("nightvisiongoggles.status").withStyle(ChatFormatting.GRAY).append(ElectroTextUtils.tooltip("nightvisiongoggles.on").withStyle(ChatFormatting.GREEN)).withStyle(ChatFormatting.DARK_GRAY)); } else { - tooltip.add(ElectroTextUtils.tooltip("nightvisiongoggles.status").withStyle(ChatFormatting.GRAY).append(ElectroTextUtils.tooltip("nightvisiongoggles.off").withStyle(ChatFormatting.RED))); + tooltip.add(ElectroTextUtils.tooltip("nightvisiongoggles.status").withStyle(ChatFormatting.GRAY).append(ElectroTextUtils.tooltip("nightvisiongoggles.off").withStyle(ChatFormatting.RED)).withStyle(ChatFormatting.DARK_GRAY)); } - IItemElectric.addBatteryTooltip(stack, context, tooltip); } @Override diff --git a/src/main/java/electrodynamics/common/item/gear/armor/types/ItemRubberArmor.java b/src/main/java/electrodynamics/common/item/gear/armor/types/ItemRubberArmor.java index de0783e35..fc929799b 100644 --- a/src/main/java/electrodynamics/common/item/gear/armor/types/ItemRubberArmor.java +++ b/src/main/java/electrodynamics/common/item/gear/armor/types/ItemRubberArmor.java @@ -2,12 +2,19 @@ import java.util.EnumMap; +import electrodynamics.api.References; import electrodynamics.common.item.gear.armor.ItemElectrodynamicsArmor; import electrodynamics.registers.ElectrodynamicsArmorMaterials; import net.minecraft.Util; import net.minecraft.core.Holder; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.item.ArmorItem; +import net.minecraft.world.item.ArmorMaterial; import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.world.item.ItemStack; +import org.jetbrains.annotations.Nullable; public class ItemRubberArmor extends ItemElectrodynamicsArmor { @@ -18,10 +25,16 @@ public class ItemRubberArmor extends ItemElectrodynamicsArmor { map.put(Type.BOOTS, 2); }); + public static final ResourceLocation ARMOR_TEXTURE_LOCATION = ResourceLocation.fromNamespaceAndPath(References.ID, "textures/model/armor/rubberarmor.png"); + public ItemRubberArmor(ArmorItem.Type type, Properties properties, Holder creativeTab) { super(ElectrodynamicsArmorMaterials.RUBBER_BOOTS, type, properties, creativeTab); } + @Override + public @Nullable ResourceLocation getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot, ArmorMaterial.Layer layer, boolean innerModel) { + return ARMOR_TEXTURE_LOCATION; + } /* public enum ArmorMaterialRubber implements ArmorMaterial { diff --git a/src/main/java/electrodynamics/common/item/gear/armor/types/ItemServoLeggings.java b/src/main/java/electrodynamics/common/item/gear/armor/types/ItemServoLeggings.java index 18469a4e8..f33b778ad 100644 --- a/src/main/java/electrodynamics/common/item/gear/armor/types/ItemServoLeggings.java +++ b/src/main/java/electrodynamics/common/item/gear/armor/types/ItemServoLeggings.java @@ -89,28 +89,28 @@ public boolean isBarVisible(ItemStack stack) { @Override public void appendHoverText(ItemStack stack, TooltipContext context, List tooltip, TooltipFlag flagIn) { super.appendHoverText(stack, context, tooltip, flagIn); - tooltip.add(ElectroTextUtils.tooltip("item.electric.info", ChatFormatter.getChatDisplayShort(getJoulesStored(stack), DisplayUnit.JOULES)).withStyle(ChatFormatting.GRAY)); - tooltip.add(ElectroTextUtils.tooltip("item.electric.voltage", ElectroTextUtils.ratio(ChatFormatter.getChatDisplayShort(properties.receive.getVoltage(), DisplayUnit.VOLTAGE), ChatFormatter.getChatDisplayShort(properties.extract.getVoltage(), DisplayUnit.VOLTAGE))).withStyle(ChatFormatting.RED)); + tooltip.add(ElectroTextUtils.tooltip("item.electric.info", ElectroTextUtils.ratio(ChatFormatter.getChatDisplayShort(getJoulesStored(stack), DisplayUnit.JOULES), ChatFormatter.getChatDisplayShort(getMaximumCapacity(stack), DisplayUnit.JOULES)).withStyle(ChatFormatting.GRAY)).withStyle(ChatFormatting.DARK_GRAY)); + tooltip.add(ElectroTextUtils.tooltip("item.electric.voltage", ChatFormatter.getChatDisplayShort(properties.receive.getVoltage(), DisplayUnit.VOLTAGE).withStyle(ChatFormatting.GRAY)).withStyle(ChatFormatting.DARK_GRAY)); staticAppendTooltips(stack, context, tooltip, flagIn); } protected static void staticAppendTooltips(ItemStack stack, TooltipContext context, List tooltip, TooltipFlag flagIn) { + IItemElectric.addBatteryTooltip(stack, context, tooltip); if (stack.getOrDefault(ElectrodynamicsDataComponentTypes.ON, false)) { - tooltip.add(ElectroTextUtils.tooltip("nightvisiongoggles.status").withStyle(ChatFormatting.GRAY).append(ElectroTextUtils.tooltip("nightvisiongoggles.on").withStyle(ChatFormatting.GREEN))); + tooltip.add(ElectroTextUtils.tooltip("nightvisiongoggles.status").withStyle(ChatFormatting.DARK_GRAY).append(ElectroTextUtils.tooltip("nightvisiongoggles.on").withStyle(ChatFormatting.GREEN))); } else { - tooltip.add(ElectroTextUtils.tooltip("nightvisiongoggles.status").withStyle(ChatFormatting.GRAY).append(ElectroTextUtils.tooltip("nightvisiongoggles.off").withStyle(ChatFormatting.RED))); + tooltip.add(ElectroTextUtils.tooltip("nightvisiongoggles.status").withStyle(ChatFormatting.DARK_GRAY).append(ElectroTextUtils.tooltip("nightvisiongoggles.off").withStyle(ChatFormatting.RED))); } tooltip.add(getModeText(stack.getOrDefault(ElectrodynamicsDataComponentTypes.MODE, 0))); - IItemElectric.addBatteryTooltip(stack, context, tooltip); } public static Component getModeText(int mode) { return switch (mode) { - case 0 -> ElectroTextUtils.tooltip("jetpack.mode").withStyle(ChatFormatting.GRAY).append(ElectroTextUtils.tooltip("servolegs.step").withStyle(ChatFormatting.GREEN)); - case 1 -> ElectroTextUtils.tooltip("jetpack.mode").withStyle(ChatFormatting.GRAY).append(ElectroTextUtils.tooltip("servolegs.both").withStyle(ChatFormatting.AQUA)); - case 2 -> ElectroTextUtils.tooltip("jetpack.mode").withStyle(ChatFormatting.GRAY).append(ElectroTextUtils.tooltip("servolegs.speed").withStyle(ChatFormatting.GREEN)); - case 3 -> ElectroTextUtils.tooltip("jetpack.mode").withStyle(ChatFormatting.GRAY).append(ElectroTextUtils.tooltip("servolegs.none").withStyle(ChatFormatting.RED)); + case 0 -> ElectroTextUtils.tooltip("jetpack.mode").withStyle(ChatFormatting.DARK_GRAY).append(ElectroTextUtils.tooltip("servolegs.step").withStyle(ChatFormatting.GREEN)); + case 1 -> ElectroTextUtils.tooltip("jetpack.mode").withStyle(ChatFormatting.DARK_GRAY).append(ElectroTextUtils.tooltip("servolegs.both").withStyle(ChatFormatting.AQUA)); + case 2 -> ElectroTextUtils.tooltip("jetpack.mode").withStyle(ChatFormatting.DARK_GRAY).append(ElectroTextUtils.tooltip("servolegs.speed").withStyle(ChatFormatting.GREEN)); + case 3 -> ElectroTextUtils.tooltip("jetpack.mode").withStyle(ChatFormatting.DARK_GRAY).append(ElectroTextUtils.tooltip("servolegs.none").withStyle(ChatFormatting.RED)); default -> Component.literal(""); }; } diff --git a/src/main/java/electrodynamics/common/item/gear/tools/ItemCanister.java b/src/main/java/electrodynamics/common/item/gear/tools/ItemCanister.java index 571dcef62..ba63a311e 100644 --- a/src/main/java/electrodynamics/common/item/gear/tools/ItemCanister.java +++ b/src/main/java/electrodynamics/common/item/gear/tools/ItemCanister.java @@ -2,7 +2,6 @@ import java.util.ArrayList; import java.util.List; -import java.util.function.Supplier; import electrodynamics.api.capability.types.fluid.RestrictedFluidHandlerItemStack; import electrodynamics.api.electricity.formatting.ChatFormatter; @@ -100,8 +99,10 @@ public void appendHoverText(ItemStack stack, TooltipContext context, List creativeTab) @Override public void appendHoverText(ItemStack stack, TooltipContext context, List tooltips, TooltipFlag flag) { - tooltips.add(ElectroTextUtils.tooltip("info.guidebookuse").withStyle(ChatFormatting.LIGHT_PURPLE)); - tooltips.add(ElectroTextUtils.tooltip("guidebookname").withStyle(ChatFormatting.GRAY)); + //tooltips.add(ElectroTextUtils.tooltip("info.guidebookuse").withStyle(ChatFormatting.LIGHT_PURPLE)); + tooltips.add(ElectroTextUtils.tooltip("guidebookname").withStyle(ChatFormatting.LIGHT_PURPLE)); super.appendHoverText(stack, context, tooltips, flag); } @Override public InteractionResultHolder use(Level world, Player player, InteractionHand handIn) { - if (world.isClientSide) { - if (player.isShiftKeyDown()) { - player.sendSystemMessage(ElectroTextUtils.chatMessage("guidebookclick").withStyle(ChatFormatting.BOLD, ChatFormatting.RED).withStyle(style -> style.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, LINK)))); - return InteractionResultHolder.pass(player.getItemInHand(handIn)); - } - } else { + if (!world.isClientSide) { player.openMenu(getMenuProvider(world, player)); } return super.use(world, player, handIn); diff --git a/src/main/java/electrodynamics/common/item/gear/tools/ItemPortableCylinder.java b/src/main/java/electrodynamics/common/item/gear/tools/ItemPortableCylinder.java index 98580d716..a7c758a81 100644 --- a/src/main/java/electrodynamics/common/item/gear/tools/ItemPortableCylinder.java +++ b/src/main/java/electrodynamics/common/item/gear/tools/ItemPortableCylinder.java @@ -88,7 +88,7 @@ public void appendHoverText(ItemStack stack, TooltipContext context, List tooltip, TooltipFlag flagIn) { super.appendHoverText(stack, context, tooltip, flagIn); - tooltip.add(ElectroTextUtils.tooltip("item.electric.info", ChatFormatter.getChatDisplayShort(getJoulesStored(stack), DisplayUnit.JOULES)).withStyle(ChatFormatting.GRAY)); - tooltip.add(ElectroTextUtils.tooltip("item.electric.voltage", ElectroTextUtils.ratio(ChatFormatter.getChatDisplayShort(properties.receive.getVoltage(), DisplayUnit.VOLTAGE), ChatFormatter.getChatDisplayShort(properties.extract.getVoltage(), DisplayUnit.VOLTAGE))).withStyle(ChatFormatting.RED)); + tooltip.add(ElectroTextUtils.tooltip("item.electric.info", ElectroTextUtils.ratio(ChatFormatter.getChatDisplayShort(getJoulesStored(stack), DisplayUnit.JOULES), ChatFormatter.getChatDisplayShort(getMaximumCapacity(stack), DisplayUnit.JOULES)).withStyle(ChatFormatting.GRAY)).withStyle(ChatFormatting.DARK_GRAY)); + tooltip.add(ElectroTextUtils.tooltip("item.electric.voltage", ChatFormatter.getChatDisplayShort(properties.receive.getVoltage(), DisplayUnit.VOLTAGE).withStyle(ChatFormatting.GRAY)).withStyle(ChatFormatting.DARK_GRAY)); IItemElectric.addBatteryTooltip(stack, context, tooltip); } diff --git a/src/main/java/electrodynamics/common/item/gear/tools/electric/ItemElectricChainsaw.java b/src/main/java/electrodynamics/common/item/gear/tools/electric/ItemElectricChainsaw.java index b19482d3c..9103bfb7f 100644 --- a/src/main/java/electrodynamics/common/item/gear/tools/electric/ItemElectricChainsaw.java +++ b/src/main/java/electrodynamics/common/item/gear/tools/electric/ItemElectricChainsaw.java @@ -89,8 +89,8 @@ public boolean isBarVisible(ItemStack stack) { @Override public void appendHoverText(ItemStack stack, TooltipContext context, List tooltip, TooltipFlag flagIn) { super.appendHoverText(stack, context, tooltip, flagIn); - tooltip.add(ElectroTextUtils.tooltip("item.electric.info", ChatFormatter.getChatDisplayShort(getJoulesStored(stack), DisplayUnit.JOULES)).withStyle(ChatFormatting.GRAY)); - tooltip.add(ElectroTextUtils.tooltip("item.electric.voltage", ElectroTextUtils.ratio(ChatFormatter.getChatDisplayShort(properties.receive.getVoltage(), DisplayUnit.VOLTAGE), ChatFormatter.getChatDisplayShort(properties.extract.getVoltage(), DisplayUnit.VOLTAGE))).withStyle(ChatFormatting.RED)); + tooltip.add(ElectroTextUtils.tooltip("item.electric.info", ElectroTextUtils.ratio(ChatFormatter.getChatDisplayShort(getJoulesStored(stack), DisplayUnit.JOULES), ChatFormatter.getChatDisplayShort(getMaximumCapacity(stack), DisplayUnit.JOULES)).withStyle(ChatFormatting.GRAY)).withStyle(ChatFormatting.DARK_GRAY)); + tooltip.add(ElectroTextUtils.tooltip("item.electric.voltage", ChatFormatter.getChatDisplayShort(properties.receive.getVoltage(), DisplayUnit.VOLTAGE).withStyle(ChatFormatting.GRAY)).withStyle(ChatFormatting.DARK_GRAY)); IItemElectric.addBatteryTooltip(stack, context, tooltip); } diff --git a/src/main/java/electrodynamics/common/item/gear/tools/electric/ItemElectricDrill.java b/src/main/java/electrodynamics/common/item/gear/tools/electric/ItemElectricDrill.java index 4fc9dbe2d..77904f3b8 100644 --- a/src/main/java/electrodynamics/common/item/gear/tools/electric/ItemElectricDrill.java +++ b/src/main/java/electrodynamics/common/item/gear/tools/electric/ItemElectricDrill.java @@ -116,13 +116,14 @@ public boolean isBarVisible(ItemStack stack) { @Override public void appendHoverText(ItemStack stack, TooltipContext context, List tooltip, TooltipFlag flagIn) { - tooltip.add(ElectroTextUtils.tooltip("item.electric.info", ChatFormatter.getChatDisplayShort(getJoulesStored(stack), DisplayUnit.JOULES)).withStyle(ChatFormatting.GRAY)); - tooltip.add(ElectroTextUtils.tooltip("item.electric.voltage", ElectroTextUtils.ratio(ChatFormatter.getChatDisplayShort(properties.receive.getVoltage(), DisplayUnit.VOLTAGE), ChatFormatter.getChatDisplayShort(properties.extract.getVoltage(), DisplayUnit.VOLTAGE))).withStyle(ChatFormatting.RED)); + tooltip.add(ElectroTextUtils.tooltip("item.electric.info", ElectroTextUtils.ratio(ChatFormatter.getChatDisplayShort(getJoulesStored(stack), DisplayUnit.JOULES), ChatFormatter.getChatDisplayShort(getMaximumCapacity(stack), DisplayUnit.JOULES)).withStyle(ChatFormatting.GRAY)).withStyle(ChatFormatting.DARK_GRAY)); + tooltip.add(ElectroTextUtils.tooltip("item.electric.voltage", ChatFormatter.getChatDisplayShort(properties.receive.getVoltage(), DisplayUnit.VOLTAGE).withStyle(ChatFormatting.GRAY)).withStyle(ChatFormatting.DARK_GRAY)); + IItemElectric.addBatteryTooltip(stack, context, tooltip); - tooltip.add(ElectroTextUtils.tooltip("electricdrill.miningspeed", ChatFormatter.getChatDisplayShort(getHead(stack).speedBoost * 100, DisplayUnit.PERCENTAGE).withStyle(ChatFormatting.WHITE)).withStyle(ChatFormatting.GRAY)); - tooltip.add(ElectroTextUtils.tooltip("electricdrill.usage", ChatFormatter.getChatDisplayShort(stack.getOrDefault(ElectrodynamicsDataComponentTypes.POWER_USAGE, POWER_USAGE), DisplayUnit.JOULES).withStyle(ChatFormatting.WHITE)).withStyle(ChatFormatting.GRAY)); + tooltip.add(ElectroTextUtils.tooltip("electricdrill.miningspeed", ChatFormatter.getChatDisplayShort(getHead(stack).speedBoost * 100, DisplayUnit.PERCENTAGE).withStyle(ChatFormatting.GRAY)).withStyle(ChatFormatting.DARK_GRAY)); + tooltip.add(ElectroTextUtils.tooltip("electricdrill.usage", ChatFormatter.getChatDisplayShort(stack.getOrDefault(ElectrodynamicsDataComponentTypes.POWER_USAGE, POWER_USAGE), DisplayUnit.JOULES).withStyle(ChatFormatting.GRAY)).withStyle(ChatFormatting.DARK_GRAY)); - tooltip.add(ElectroTextUtils.tooltip("electricdrill.overclock", ChatFormatter.getChatDisplayShort(getSpeedBoost(stack) * 100, DisplayUnit.PERCENTAGE).withStyle(ChatFormatting.GREEN)).withStyle(ChatFormatting.GRAY)); + tooltip.add(ElectroTextUtils.tooltip("electricdrill.overclock", ChatFormatter.getChatDisplayShort(getSpeedBoost(stack) * 100, DisplayUnit.PERCENTAGE).withStyle(ChatFormatting.GRAY)).withStyle(ChatFormatting.DARK_GRAY)); } @Override diff --git a/src/main/java/electrodynamics/common/item/gear/tools/electric/ItemMechanizedCrossbow.java b/src/main/java/electrodynamics/common/item/gear/tools/electric/ItemMechanizedCrossbow.java index 613644dea..484ecd37f 100644 --- a/src/main/java/electrodynamics/common/item/gear/tools/electric/ItemMechanizedCrossbow.java +++ b/src/main/java/electrodynamics/common/item/gear/tools/electric/ItemMechanizedCrossbow.java @@ -2,7 +2,6 @@ import java.util.List; import java.util.function.Predicate; -import java.util.function.Supplier; import net.minecraft.core.Holder; import org.jetbrains.annotations.Nullable; @@ -165,8 +164,8 @@ public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStac @Override public void appendHoverText(ItemStack stack, TooltipContext context, List tooltip, TooltipFlag flagIn) { super.appendHoverText(stack, context, tooltip, flagIn); - tooltip.add(ElectroTextUtils.tooltip("item.electric.info", ChatFormatter.getChatDisplayShort(getJoulesStored(stack), DisplayUnit.JOULES)).withStyle(ChatFormatting.GRAY)); - tooltip.add(ElectroTextUtils.tooltip("item.electric.voltage", ElectroTextUtils.ratio(ChatFormatter.getChatDisplayShort(properties.receive.getVoltage(), DisplayUnit.VOLTAGE), ChatFormatter.getChatDisplayShort(properties.extract.getVoltage(), DisplayUnit.VOLTAGE))).withStyle(ChatFormatting.RED)); + tooltip.add(ElectroTextUtils.tooltip("item.electric.info", ElectroTextUtils.ratio(ChatFormatter.getChatDisplayShort(getJoulesStored(stack), DisplayUnit.JOULES), ChatFormatter.getChatDisplayShort(getMaximumCapacity(stack), DisplayUnit.JOULES)).withStyle(ChatFormatting.GRAY)).withStyle(ChatFormatting.DARK_GRAY)); + tooltip.add(ElectroTextUtils.tooltip("item.electric.voltage", ChatFormatter.getChatDisplayShort(properties.receive.getVoltage(), DisplayUnit.VOLTAGE).withStyle(ChatFormatting.GRAY)).withStyle(ChatFormatting.DARK_GRAY)); IItemElectric.addBatteryTooltip(stack, context, tooltip); } diff --git a/src/main/java/electrodynamics/common/network/NetworkRegistry.java b/src/main/java/electrodynamics/common/network/NetworkRegistry.java index 81e0c8444..0095a054a 100644 --- a/src/main/java/electrodynamics/common/network/NetworkRegistry.java +++ b/src/main/java/electrodynamics/common/network/NetworkRegistry.java @@ -1,8 +1,6 @@ package electrodynamics.common.network; -import java.util.ConcurrentModificationException; -import java.util.HashSet; -import java.util.Iterator; +import java.util.*; import electrodynamics.api.References; import electrodynamics.api.network.ITickableNetwork; @@ -13,16 +11,16 @@ @EventBusSubscriber(modid = References.ID, bus = EventBusSubscriber.Bus.GAME) public class NetworkRegistry { - private static final HashSet NETWORKS = new HashSet<>(); - private static final HashSet TO_REMOVE = new HashSet<>(); + private static final HashMap NETWORKS = new HashMap<>(); + private static final HashSet TO_REMOVE = new HashSet<>(); public static void register(ITickableNetwork network) { - NETWORKS.add(network); + NETWORKS.put(network.getId(), network); } public static void deregister(ITickableNetwork network) { - if (NETWORKS.contains(network)) { - TO_REMOVE.add(network); + if (NETWORKS.containsKey(network.getId())) { + TO_REMOVE.add(network.getId()); } } @@ -30,17 +28,17 @@ public static void deregister(ITickableNetwork network) { public static void update(ServerTickEvent.Post event) { try { - NETWORKS.removeAll(TO_REMOVE); - TO_REMOVE.clear(); - Iterator it = NETWORKS.iterator(); - while (it.hasNext()) { - ITickableNetwork net = it.next(); - if (net.getSize() == 0) { - deregister(net); - } else { - net.tick(); - } + for(UUID id : TO_REMOVE) { + NETWORKS.remove(id); } + TO_REMOVE.clear(); + for (ITickableNetwork net : NETWORKS.values()) { + if (net.getSize() == 0) { + deregister(net); + } else { + net.tick(); + } + } } catch (ConcurrentModificationException exception) { exception.printStackTrace(); } diff --git a/src/main/java/electrodynamics/common/network/type/ElectricNetwork.java b/src/main/java/electrodynamics/common/network/type/ElectricNetwork.java index f8d0e99ff..6a3cbd4db 100644 --- a/src/main/java/electrodynamics/common/network/type/ElectricNetwork.java +++ b/src/main/java/electrodynamics/common/network/type/ElectricNetwork.java @@ -1,16 +1,11 @@ package electrodynamics.common.network.type; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; +import java.util.*; import electrodynamics.api.capability.types.electrodynamic.ICapabilityElectrodynamic; -import electrodynamics.api.network.cable.type.IConductor; -import electrodynamics.common.block.subtype.SubtypeWire; +import electrodynamics.api.network.cable.type.IWire; import electrodynamics.common.network.NetworkRegistry; +import electrodynamics.common.tile.electricitygrid.GenericTileWire; import electrodynamics.prefab.network.AbstractNetwork; import electrodynamics.prefab.utilities.ElectricityUtils; import electrodynamics.prefab.utilities.Scheduler; @@ -21,7 +16,7 @@ import net.neoforged.neoforge.capabilities.Capabilities; import net.neoforged.neoforge.energy.IEnergyStorage; -public class ElectricNetwork extends AbstractNetwork implements ICapabilityElectrodynamic { +public class ElectricNetwork extends AbstractNetwork implements ICapabilityElectrodynamic { public static final int MAXIMUM_OVERLOAD_PERIOD_TICKS = 20; @@ -30,14 +25,16 @@ public class ElectricNetwork extends AbstractNetwork producersToIgnore = new HashSet<>(); + private final HashSet producersToIgnore = new HashSet<>(); private double transferBuffer = 0; private double maxTransferBuffer = 0; private double minimumVoltage = -1.0D; - private HashMap> lastTransfer = new HashMap<>(); - private HashSet noUsage = new HashSet<>(); + + private final HashMap> ampacityToWireMap = new HashMap<>(); + private final HashMap> lastTransfer = new HashMap<>(); + private final HashSet noUsage = new HashSet<>(); private boolean locked = false; @@ -45,56 +42,23 @@ public class ElectricNetwork extends AbstractNetwork()); - } - - public ElectricNetwork(Collection varCables) { + public ElectricNetwork(Collection varCables) { conductorSet.addAll(varCables); NetworkRegistry.register(this); } - public ElectricNetwork(Set> networks) { - for (AbstractNetwork net : networks) { - if (net != null) { - conductorSet.addAll(net.conductorSet); - net.deregister(); - } - } - refresh(); - NetworkRegistry.register(this); - } - - public ElectricNetwork(Set networks, boolean special) { + public ElectricNetwork(Set networks) { for (ElectricNetwork net : networks) { if (net != null) { conductorSet.addAll(net.conductorSet); net.deregister(); } } - refresh(); NetworkRegistry.register(this); } @Override - public void refresh() { + public void refreshNewNetwork() { ticksOverloaded = 0; resistance = 0; energyLoss = 0; @@ -109,8 +73,9 @@ public void refresh() { lastTransfer.clear(); noUsage.clear(); + ampacityToWireMap.clear(); - super.refresh(); + super.refreshNewNetwork(); } private TransferPack sendToReceivers(TransferPack maxTransfer, ArrayList ignored, boolean debug) { @@ -134,6 +99,7 @@ private TransferPack sendToReceivers(TransferPack maxTransfer, ArrayList checkList = new HashSet<>(); - for (SubtypeWire type : SubtypeWire.values()) { - if (type.conductor.ampacity <= transmittedLastTick / voltage * 20 && type.conductor.ampacity <= transmittedThisTick / voltage * 20) { - checkList.add(type); + HashSet overloaded = new HashSet<>(); + for (Map.Entry> entry : ampacityToWireMap.entrySet()) { + if (entry.getKey() <= transmittedLastTick / voltage * 20 && entry.getKey() <= transmittedThisTick / voltage * 20) { + overloaded.addAll(entry.getValue()); } } - if (checkList.isEmpty()) { + if (overloaded.isEmpty()) { ticksOverloaded = 0; return false; @@ -200,19 +166,42 @@ private boolean checkForOverload() { return true; } - for (SubtypeWire index : checkList) { - for (IConductor conductor : conductorTypeMap.get(index)) { - Scheduler.schedule(1, conductor::destroyViolently); - } + for (GenericTileWire wire : overloaded) { + Scheduler.schedule(1, wire::destroyViolently); } return true; } @Override - public void updateConductorStatistics(IConductor cable) { - super.updateConductorStatistics(cable); - resistance += cable.getWireType().resistance; + public void updateConductorStatistics(GenericTileWire cable, boolean removed) { + super.updateConductorStatistics(cable, removed); + + if (removed) { + + long ampacity = cable.getCableType().getAmpacity(); + + if(ampacityToWireMap.containsKey(ampacity)) { + HashSet set = ampacityToWireMap.get(ampacity); + set.remove(cable); + ampacityToWireMap.put(ampacity, set); + } + + + resistance -= cable.getCableType().getResistance(); + } else { + resistance += cable.getCableType().getResistance(); + + long ampacity = cable.getCableType().getAmpacity(); + + HashSet set = ampacityToWireMap.getOrDefault(ampacity, new HashSet<>()); + + set.add(cable); + + ampacityToWireMap.put(ampacity, set); + + + } } @@ -233,9 +222,16 @@ public void updateRecieverStatistics(BlockEntity reciever, Direction dir) { } @Override - public void updateStatistics() { + public void resetReceiverStatistics() { + minimumVoltage = -1; + super.resetReceiverStatistics(); + } + + @Override + public void resetConductorStatistics() { resistance = 0; - super.updateStatistics(); + ampacityToWireMap.clear(); + super.resetConductorStatistics(); } public void addProducer(BlockEntity tile, double d, boolean isEnergyReceiver) { @@ -245,6 +241,12 @@ public void addProducer(BlockEntity tile, double d, boolean isEnergyReceiver) { voltage = Math.max(voltage, d); } + @Override + public void deregister() { + ampacityToWireMap.clear(); + super.deregister(); + } + @Override public void tick() { super.tick(); @@ -253,7 +255,7 @@ public void tick() { * Electrodynamics.LOGGER.info("ticks " + numTicks); Electrodynamics.LOGGER.info("length " + conductorSet.size()); * Electrodynamics.LOGGER.info("voltage " + voltage); Electrodynamics.LOGGER.info("trans " + transferBuffer); * Electrodynamics.LOGGER.info("max trans " + maxTransferBuffer); - * + * * } */ lastTransfer.clear(); @@ -292,21 +294,27 @@ public void tick() { maxTransferBuffer = getConnectedLoad(new LoadProfile(TransferPack.joulesVoltage(transmittedLastTick, lastVoltage), TransferPack.joulesVoltage(transmittedLastTick, lastVoltage)), Direction.UP).getJoules(); - Iterator it = conductorSet.iterator(); + /* + + Iterator it = conductorSet.iterator(); boolean broken = false; while (it.hasNext()) { - IConductor conductor = it.next(); + GenericTileWire conductor = it.next(); if (conductor instanceof BlockEntity entity && entity.isRemoved() || conductor.getNetwork() != this) { broken = true; break; } } if (broken) { - refresh(); + refreshNewNetwork(); } + + */ if (getSize() == 0) { deregister(); } + + // Electrodynamics.LOGGER.info(""); // Electrodynamics.LOGGER.info("End of tick"); // Electrodynamics.LOGGER.info("length " + conductorSet.size()); @@ -316,53 +324,22 @@ public void tick() { // Electrodynamics.LOGGER.info(""); /* * if (conductorSet.size() > 10) { Electrodynamics.LOGGER.info(""); numTicks++; - * + * * } */ } @Override - public boolean isConductor(BlockEntity tile, IConductor requesterCable) { + public boolean isConductor(BlockEntity tile, GenericTileWire requesterCable) { return ElectricityUtils.isConductor(tile, requesterCable); } @Override - public boolean isConductorClass(BlockEntity tile) { - return tile instanceof IConductor; - } - - @Override - public boolean isAcceptor(BlockEntity acceptor, Direction orientation) { - return ElectricityUtils.isElectricReceiver(acceptor, orientation.getOpposite()); - } - - @Override - public AbstractNetwork createInstance() { - return new ElectricNetwork(); - } - - @Override - public AbstractNetwork createInstanceConductor(Set conductors) { + public ElectricNetwork createInstanceConductor(Set conductors) { return new ElectricNetwork(conductors); } - @Override - public AbstractNetwork createInstance(Set> networks) { - return new ElectricNetwork(networks); - - } - - @Override - public SubtypeWire[] getConductorTypes() { - return SubtypeWire.values(); - } - - @Override - public boolean canConnect(BlockEntity acceptor, Direction orientation) { - return ElectricityUtils.isElectricReceiver(acceptor, orientation.getOpposite()); - } - @Override public double getJoulesStored() { return transferBuffer; @@ -394,6 +371,23 @@ public double getAmpacity() { return networkMaxTransfer; } + public double getLastEnergyLoss() { + return lastEnergyLoss; + } + + @Override + public double getVoltage() { + return voltage; + } + + public double getActiveVoltage() { + return lastVoltage; + } + + public double getResistance() { + return resistance; + } + @Override public TransferPack getConnectedLoad(LoadProfile loadProfile, Direction dir) { @@ -472,4 +466,8 @@ public boolean isEnergyProducer() { return true; } + @Override + public TransferPack emit(TransferPack transfer, ArrayList ignored, boolean debug) { + throw new UnsupportedOperationException("No"); + } } diff --git a/src/main/java/electrodynamics/common/network/type/FluidNetwork.java b/src/main/java/electrodynamics/common/network/type/FluidNetwork.java index 7accf1b69..c6299b351 100644 --- a/src/main/java/electrodynamics/common/network/type/FluidNetwork.java +++ b/src/main/java/electrodynamics/common/network/type/FluidNetwork.java @@ -10,298 +10,285 @@ import com.mojang.datafixers.util.Pair; import electrodynamics.api.network.cable.type.IFluidPipe; -import electrodynamics.common.block.subtype.SubtypeFluidPipe; import electrodynamics.common.network.NetworkRegistry; import electrodynamics.common.network.utils.FluidUtilities; +import electrodynamics.common.tile.pipelines.fluid.GenericTileFluidPipe; import electrodynamics.common.tile.pipelines.fluid.TileFluidPipePump; import electrodynamics.prefab.network.AbstractNetwork; import net.minecraft.core.Direction; import net.minecraft.world.level.block.entity.BlockEntity; import net.neoforged.neoforge.fluids.FluidStack; -public class FluidNetwork extends AbstractNetwork { +public class FluidNetwork extends AbstractNetwork { - public HashMap> priorityPumpMap = new HashMap<>(); + public HashMap> priorityPumpMap = new HashMap<>(); - public FluidNetwork() { - this(new HashSet()); - } + public FluidNetwork(Collection varCables) { + conductorSet.addAll(varCables); + NetworkRegistry.register(this); + } - public FluidNetwork(Collection varCables) { - conductorSet.addAll(varCables); - NetworkRegistry.register(this); - } + public FluidNetwork(Set networks) { + for (FluidNetwork net : networks) { + conductorSet.addAll(net.conductorSet); + net.deregister(); + } + NetworkRegistry.register(this); + } - public FluidNetwork(Set> networks) { - for (AbstractNetwork net : networks) { - if (net != null) { - conductorSet.addAll(net.conductorSet); - net.deregister(); - } - } - refresh(); - NetworkRegistry.register(this); - } + @Override + public void refreshNewNetwork() { + priorityPumpMap.clear(); + networkMaxTransfer = 0; + super.refreshNewNetwork(); + } - public FluidNetwork(Set networks, boolean special) { - for (FluidNetwork net : networks) { - if (net != null) { - conductorSet.addAll(net.conductorSet); - net.deregister(); - } - } - refresh(); - NetworkRegistry.register(this); - } + @Override + public FluidStack emit(FluidStack inserted, ArrayList ignored, boolean debug) { - @Override - public FluidStack emit(FluidStack transfer, ArrayList ignored, boolean debug) { + FluidStack transfer = new FluidStack(inserted.getFluid(), Math.min((int) networkMaxTransfer, inserted.getAmount())); - if (transfer.getAmount() <= 0) { - return FluidStack.EMPTY; - } + if (transfer.getAmount() <= 0) { + return FluidStack.EMPTY; + } - FluidStack initial = transfer.copy(); - FluidStack taken = new FluidStack(transfer.getFluid(), 0); + FluidStack initial = transfer.copy(); + FluidStack taken = new FluidStack(transfer.getFluid(), 0); - Pair> priorityFilled = emitToPumps(transfer, ignored); + Pair> priorityFilled = emitToPumps(transfer, ignored); - initial.shrink(priorityFilled.getFirst().getAmount()); - taken.grow(priorityFilled.getFirst().getAmount()); + initial.shrink(priorityFilled.getFirst().getAmount()); + taken.grow(priorityFilled.getFirst().getAmount()); - if (initial.isEmpty()) { + if (initial.isEmpty()) { - return taken; + return taken; - } + } - HashSet availableAcceptors = Sets.newHashSet(); + HashSet availableAcceptors = Sets.newHashSet(); - availableAcceptors.addAll(acceptorSet); + availableAcceptors.addAll(acceptorSet); - availableAcceptors.removeAll(ignored); + availableAcceptors.removeAll(ignored); - if(priorityFilled.getSecond().size() > 0) { - availableAcceptors.removeAll(priorityFilled.getSecond()); - } + if (priorityFilled.getSecond().size() > 0) { + availableAcceptors.removeAll(priorityFilled.getSecond()); + } - if (availableAcceptors.isEmpty()) { - return FluidStack.EMPTY; - } + if (availableAcceptors.isEmpty()) { + return FluidStack.EMPTY; + } - // This algorithm is not perfect, but it helps deal with tiles that do not accept the full amount allotted to them + // This algorithm is not perfect, but it helps deal with tiles that do not accept the full amount allotted to them - FluidStack perTile, prePerTile, perConnection, prePerConnection; + FluidStack perTile, prePerTile, perConnection, prePerConnection; - int size = availableAcceptors.size(); + int size = availableAcceptors.size(); - int connectionsSize, amtTaken, takenAmt; + int connectionsSize, amtTaken, takenAmt; - HashSet connections; + HashSet connections; - for (BlockEntity tile : availableAcceptors) { + for (BlockEntity tile : availableAcceptors) { - perTile = new FluidStack(initial.getFluid(), (int) ((double) initial.getAmount() / (double) size)); - prePerTile = perTile.copy(); + perTile = new FluidStack(initial.getFluid(), (int) ((double) initial.getAmount() / (double) size)); + prePerTile = perTile.copy(); - connections = acceptorInputMap.getOrDefault(tile, new HashSet<>()); + connections = acceptorInputMap.getOrDefault(tile, new HashSet<>()); - connectionsSize = connections.size(); + connectionsSize = connections.size(); - for (Direction dir : connections) { + for (Direction dir : connections) { - perConnection = new FluidStack(initial.getFluid(), (int) ((double) perTile.getAmount() / (double) connectionsSize)); - prePerConnection = perConnection.copy(); + perConnection = new FluidStack(initial.getFluid(), (int) ((double) perTile.getAmount() / (double) connectionsSize)); + prePerConnection = perConnection.copy(); - amtTaken = FluidUtilities.receiveFluid(tile, dir, perConnection, false); + amtTaken = FluidUtilities.receiveFluid(tile, dir, perConnection, false); - perConnection.shrink(amtTaken); + perConnection.shrink(amtTaken); - perTile.shrink(prePerConnection.getAmount() - perConnection.getAmount()); + perTile.shrink(prePerConnection.getAmount() - perConnection.getAmount()); - connectionsSize--; - } + connectionsSize--; + } - takenAmt = prePerTile.getAmount() - perTile.getAmount(); + takenAmt = prePerTile.getAmount() - perTile.getAmount(); - initial.shrink(takenAmt); + initial.shrink(takenAmt); - taken.grow(takenAmt); + taken.grow(takenAmt); - size--; - } + size--; + } - return taken; + return taken; - } + } - private Pair> emitToPumps(FluidStack transfer, ArrayList ignored) { + private Pair> emitToPumps(FluidStack transfer, ArrayList ignored) { - FluidStack taken = new FluidStack(transfer.getFluid(), 0); + FluidStack taken = new FluidStack(transfer.getFluid(), 0); - HashSet acceptedPumps = new HashSet<>(); + HashSet acceptedPumps = new HashSet<>(); - if (priorityPumpMap.isEmpty()) { - return Pair.of(taken, acceptedPumps); - } + if (priorityPumpMap.isEmpty()) { + return Pair.of(taken, acceptedPumps); + } - Pair> accepted; + Pair> accepted; - Set prioritySet; + Set prioritySet; - FluidStack copy = transfer.copy(); + FluidStack copy = transfer.copy(); - for (int i = 9; i >= 0; i--) { + for (int i = 9; i >= 0; i--) { - if (copy.isEmpty()) { - return Pair.of(taken, acceptedPumps); - } + if (copy.isEmpty()) { + return Pair.of(taken, acceptedPumps); + } - prioritySet = priorityPumpMap.getOrDefault(i, new HashSet<>()); + prioritySet = priorityPumpMap.getOrDefault(i, new HashSet<>()); - if (prioritySet.isEmpty()) { - continue; - } + if (prioritySet.isEmpty()) { + continue; + } - accepted = emitToPumpSet(copy, prioritySet, ignored); + accepted = emitToPumpSet(copy, prioritySet, ignored); - acceptedPumps.addAll(accepted.getSecond()); + acceptedPumps.addAll(accepted.getSecond()); - taken.grow(accepted.getFirst().getAmount()); + taken.grow(accepted.getFirst().getAmount()); - copy.shrink(accepted.getFirst().getAmount()); + copy.shrink(accepted.getFirst().getAmount()); - } + } - return Pair.of(taken, acceptedPumps); + return Pair.of(taken, acceptedPumps); - } + } - private Pair> emitToPumpSet(FluidStack transfer, Set recievingTiles, ArrayList ignored) { + private Pair> emitToPumpSet(FluidStack transfer, Set recievingTiles, ArrayList ignored) { - FluidStack initial = transfer.copy(); - FluidStack taken = new FluidStack(transfer.getFluid(), 0); + FluidStack initial = transfer.copy(); + FluidStack taken = new FluidStack(transfer.getFluid(), 0); - FluidStack perTile, prePerTile, perConnection, prePerConnection; + FluidStack perTile, prePerTile, perConnection, prePerConnection; - HashSet filledPumps = new HashSet<>(); + HashSet filledPumps = new HashSet<>(); - int size = recievingTiles.size(); + int size = recievingTiles.size(); - int connectionsSize, amtTaken, takenAmt; + int connectionsSize, amtTaken, takenAmt; - HashSet connections; + HashSet connections; - for (TileFluidPipePump tile : recievingTiles) { - if (!tile.isPowered() || ignored.contains(tile)) { - size--; - continue; - } + for (TileFluidPipePump tile : recievingTiles) { + if (!tile.isPowered() || ignored.contains(tile)) { + size--; + continue; + } - perTile = new FluidStack(initial.getFluid(), initial.getAmount() / size); - prePerTile = perTile.copy(); + perTile = new FluidStack(initial.getFluid(), initial.getAmount() / size); + prePerTile = perTile.copy(); - connections = acceptorInputMap.getOrDefault(tile, new HashSet<>()); + connections = acceptorInputMap.getOrDefault(tile, new HashSet<>()); - connectionsSize = connections.size(); + connectionsSize = connections.size(); - for (Direction dir : connections) { + for (Direction dir : connections) { - perConnection = new FluidStack(initial.getFluid(), perTile.getAmount() / connectionsSize); - prePerConnection = perConnection.copy(); + perConnection = new FluidStack(initial.getFluid(), perTile.getAmount() / connectionsSize); + prePerConnection = perConnection.copy(); - amtTaken = FluidUtilities.receiveFluid(tile, dir, perConnection, false); + amtTaken = FluidUtilities.receiveFluid(tile, dir, perConnection, false); - perConnection.shrink(amtTaken); + perConnection.shrink(amtTaken); - perTile.shrink(prePerConnection.getAmount() - perConnection.getAmount()); + perTile.shrink(prePerConnection.getAmount() - perConnection.getAmount()); - connectionsSize--; - } + connectionsSize--; + } - takenAmt = prePerTile.getAmount() - perTile.getAmount(); + takenAmt = prePerTile.getAmount() - perTile.getAmount(); - initial.shrink(takenAmt); + initial.shrink(takenAmt); - taken.grow(takenAmt); + taken.grow(takenAmt); - filledPumps.add(tile); + filledPumps.add(tile); - size--; - } + size--; + } - return Pair.of(taken, filledPumps); + return Pair.of(taken, filledPumps); - } + } - @Override - public void updateRecieverStatistics(BlockEntity reciever, Direction dir) { + @Override + public void updateRecieverStatistics(BlockEntity reciever, Direction dir) { - if (reciever instanceof TileFluidPipePump pump) { - int priority = pump.priority.get(); - HashSet set = priorityPumpMap.getOrDefault(priority, new HashSet<>()); - set.add(pump); - priorityPumpMap.put(priority, set); + if (reciever instanceof TileFluidPipePump pump) { + int priority = pump.priority.get(); + HashSet set = priorityPumpMap.getOrDefault(priority, new HashSet<>()); + set.add(pump); + priorityPumpMap.put(priority, set); - } + } - } + } - public void updateFluidPipePumpStats(TileFluidPipePump changedPump, int newPriority, int prevPriority) { - HashSet oldSet = priorityPumpMap.getOrDefault(prevPriority, new HashSet<>()); - oldSet.remove(changedPump); - priorityPumpMap.put(prevPriority, oldSet); + public void updateFluidPipePumpStats(TileFluidPipePump changedPump, int newPriority, int prevPriority) { + HashSet oldSet = priorityPumpMap.getOrDefault(prevPriority, new HashSet<>()); + oldSet.remove(changedPump); + priorityPumpMap.put(prevPriority, oldSet); - HashSet newSet = priorityPumpMap.getOrDefault(newPriority, new HashSet<>()); - newSet.add(changedPump); - priorityPumpMap.put(newPriority, newSet); - } + HashSet newSet = priorityPumpMap.getOrDefault(newPriority, new HashSet<>()); + newSet.add(changedPump); + priorityPumpMap.put(newPriority, newSet); + } - /* - * - * There is no need for this as we have no concept of fluid pressure nor temperature - * - * private boolean checkForOverload(int attemptSend) { if (attemptSend >= networkMaxTransfer) { HashSet checkList = new HashSet<>(); for (SubtypeFluidPipe type : SubtypeFluidPipe.values()) { if (type.maxTransfer <= attemptSend) { checkList.add(type); } } for (SubtypeFluidPipe index : checkList) { for (IFluidPipe conductor : conductorTypeMap.get(index)) { conductor.destroyViolently(); } } return true; } return false; } - */ + @Override + public void updateConductorStatistics(GenericTileFluidPipe cable, boolean remove) { + super.updateConductorStatistics(cable, remove); - @Override - public boolean isConductor(BlockEntity tile, IFluidPipe requsterCable) { - return tile instanceof IFluidPipe; - } + if (!remove) { - @Override - public boolean isConductorClass(BlockEntity tile) { - return tile instanceof IFluidPipe; - } + if (networkMaxTransfer == 0 || cable.getCableType().getMaxTransfer() < networkMaxTransfer) { + networkMaxTransfer = cable.getCableType().getMaxTransfer(); + } - @Override - public boolean isAcceptor(BlockEntity acceptor, Direction orientation) { - return FluidUtilities.isFluidReceiver(acceptor, orientation.getOpposite()); - } + } + } - @Override - public AbstractNetwork createInstance() { - return new FluidNetwork(); - } + @Override + public void resetConductorStatistics() { + networkMaxTransfer = 0; + super.resetConductorStatistics(); + } - @Override - public AbstractNetwork createInstanceConductor(Set conductors) { - return new FluidNetwork(conductors); - } + @Override + public void resetReceiverStatistics() { + priorityPumpMap.clear(); + super.resetReceiverStatistics(); + } - @Override - public AbstractNetwork createInstance(Set> networks) { - return new FluidNetwork(networks); + /* + * + * There is no need for this as we have no concept of fluid pressure nor temperature + * + * private boolean checkForOverload(int attemptSend) { if (attemptSend >= networkMaxTransfer) { HashSet checkList = new HashSet<>(); for (SubtypeFluidPipe type : SubtypeFluidPipe.values()) { if (type.maxTransfer <= attemptSend) { checkList.add(type); } } for (SubtypeFluidPipe index : checkList) { for (IFluidPipe conductor : conductorTypeMap.get(index)) { conductor.destroyViolently(); } } return true; } return false; } + */ - } - @Override - public SubtypeFluidPipe[] getConductorTypes() { - return SubtypeFluidPipe.values(); - } + @Override + public boolean isConductor(BlockEntity tile, GenericTileFluidPipe requsterCable) { + return tile instanceof GenericTileFluidPipe; + } + + @Override + public FluidNetwork createInstanceConductor(Set conductors) { + return new FluidNetwork(conductors); + } - @Override - public boolean canConnect(BlockEntity acceptor, Direction orientation) { - return FluidUtilities.isFluidReceiver(acceptor, orientation.getOpposite()); - } } diff --git a/src/main/java/electrodynamics/common/network/type/GasNetwork.java b/src/main/java/electrodynamics/common/network/type/GasNetwork.java index b3ec94b30..ed0031244 100644 --- a/src/main/java/electrodynamics/common/network/type/GasNetwork.java +++ b/src/main/java/electrodynamics/common/network/type/GasNetwork.java @@ -1,10 +1,6 @@ package electrodynamics.common.network.type; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; +import java.util.*; import java.util.concurrent.ConcurrentHashMap; import com.mojang.datafixers.util.Pair; @@ -12,397 +8,439 @@ import electrodynamics.api.gas.GasAction; import electrodynamics.api.gas.GasStack; import electrodynamics.api.network.cable.type.IGasPipe; -import electrodynamics.common.block.subtype.SubtypeGasPipe; import electrodynamics.common.network.NetworkRegistry; import electrodynamics.common.network.utils.GasUtilities; import electrodynamics.common.tags.ElectrodynamicsTags; +import electrodynamics.common.tile.pipelines.gas.GenericTileGasPipe; import electrodynamics.common.tile.pipelines.gas.TileGasPipePump; import electrodynamics.prefab.network.AbstractNetwork; +import electrodynamics.prefab.utilities.Scheduler; import net.minecraft.core.Direction; import net.minecraft.world.level.block.entity.BlockEntity; // NOTE to add in pipe heat loss, uncomment commented code -public class GasNetwork extends AbstractNetwork { +public class GasNetwork extends AbstractNetwork { - // public double heatLossPerBlock = 0; - public int maxPressure = 0; + // public double heatLossPerBlock = 0; + public int maxPressure = 0; - public double pressureOfTransmitted = 0; - public double temperatureOfTransmitted = 0; + public double pressureOfTransmitted = 0; + public double temperatureOfTransmitted = 0; - public ConcurrentHashMap> priorityPumpMap = new ConcurrentHashMap<>(); + public ConcurrentHashMap> priorityPumpMap = new ConcurrentHashMap<>(); + private final HashMap> pressureToGasPipeMap = new HashMap<>(); + private final HashSet destroyedByCorrosion = new HashSet<>(); - public GasNetwork() { - this(new HashSet()); - } + public GasNetwork(Collection pipes) { + conductorSet.addAll(pipes); + NetworkRegistry.register(this); + } - public GasNetwork(Collection pipes) { - conductorSet.addAll(pipes); - NetworkRegistry.register(this); - } + public GasNetwork(Set networks) { + for (GasNetwork network : networks) { + if (network != null) { + conductorSet.addAll(network.conductorSet); + network.deregister(); + } + } + NetworkRegistry.register(this); + } - public GasNetwork(Set> networks) { - for (AbstractNetwork network : networks) { - if (network != null) { - conductorSet.addAll(network.conductorSet); - network.deregister(); - } - } - refresh(); - NetworkRegistry.register(this); - } - - public GasNetwork(Set networks, boolean sep) { - for (GasNetwork network : networks) { - if (network != null) { - conductorSet.addAll(network.conductorSet); - network.deregister(); - } - } - refresh(); - NetworkRegistry.register(this); - } - - @Override - public void refresh() { - priorityPumpMap.clear(); - super.refresh(); - } - - @Override - /** - * Returns a GasStack representing how much fluid was actually emitted through the network - * - * @param transfer: The gas stack to be transfered - * @param ignored: By convention, the first tile in the ignored list will be the transmitting tile, and will be the point used to determine the heat loss - * @param debug: Whether or not this should be simulated - * - * @return Empty if the transmitted pack is empty or if there is no transmitting tile (i.e. ignored is empty). All gas will be used if the network exploded - */ - public GasStack emit(GasStack transfer, ArrayList ignored, boolean debug) { - - if (transfer.getAmount() <= 0 || ignored.isEmpty()) { - return GasStack.EMPTY; - } + @Override + public void refreshNewNetwork() { + priorityPumpMap.clear(); + maxPressure = 0; + networkMaxTransfer = 0; + pressureToGasPipeMap.clear(); + destroyedByCorrosion.clear(); + super.refreshNewNetwork(); + } - if (checkForOverloadAndHandle(transfer, !debug)) { - return transfer; - } + @Override + /** + * Returns a GasStack representing how much fluid was actually emitted through the network + * + * @param transfer: The gas stack to be transfered + * @param ignored: By convention, the first tile in the ignored list will be the transmitting tile, and will be the point used to determine the heat loss + * @param debug: Whether or not this should be simulated + * + * @return Empty if the transmitted pack is empty or if there is no transmitting tile (i.e. ignored is empty). All gas will be used if the network exploded + */ + public GasStack emit(GasStack inserted, ArrayList ignored, boolean debug) { - GasStack copy = transfer.copy(); + GasStack transfer = new GasStack(inserted.getGas(), Math.min(inserted.getAmount(), (int) networkMaxTransfer), inserted.getTemperature(), inserted.getPressure()); - // BlockPos senderPos = ignored.get(0).getBlockPos(); - GasStack taken = new GasStack(transfer.getGas(), 0, transfer.getTemperature(), transfer.getPressure()); + if (transfer.getAmount() <= 0 || ignored.isEmpty()) { + return GasStack.EMPTY; + } - Pair> priorityTaken = emitToPumps(transfer, ignored); + if (checkForOverloadAndHandle(transfer, !debug)) { + return transfer; + } - copy.shrink(priorityTaken.getFirst().getAmount()); - taken.grow(priorityTaken.getFirst().getAmount()); - if (copy.isEmpty()) { - return taken; - } + GasStack copy = transfer.copy(); - Set recievingTiles = ConcurrentHashMap.newKeySet(); + // BlockPos senderPos = ignored.get(0).getBlockPos(); + GasStack taken = new GasStack(transfer.getGas(), 0, transfer.getTemperature(), transfer.getPressure()); - recievingTiles.addAll(acceptorSet); + Pair> priorityTaken = emitToPumps(transfer, ignored); - recievingTiles.removeAll(ignored); - recievingTiles.removeAll(priorityTaken.getSecond()); + copy.shrink(priorityTaken.getFirst().getAmount()); + taken.grow(priorityTaken.getFirst().getAmount()); - if (recievingTiles.isEmpty()) { - return GasStack.EMPTY; - } + if (copy.isEmpty()) { + return taken; + } - GasStack gasPerTile, preGasPerTile, gasPerConnection, preGasPerConnection; + Set recievingTiles = ConcurrentHashMap.newKeySet(); - // double deltaT = copy.getTemperature() != Gas.ROOM_TEMPERATURE ? -Math.signum(copy.getTemperature() - Gas.ROOM_TEMPERATURE) : 0; + recievingTiles.addAll(acceptorSet); - int size = recievingTiles.size(); + recievingTiles.removeAll(ignored); + recievingTiles.removeAll(priorityTaken.getSecond()); - HashSet connections; - int /* deltaDegreesKelvin, newTemperature, */ takenAmt, amtTaken; - int connectionCount; + if (recievingTiles.isEmpty()) { + return GasStack.EMPTY; + } - // pre-defining all vars to eek out a little more performance since this method is already beefy + GasStack gasPerTile, preGasPerTile, gasPerConnection, preGasPerConnection; - // This algorithm is not perfect, but it helps deal with tiles that do not accept the full amount allotted to them + // double deltaT = copy.getTemperature() != Gas.ROOM_TEMPERATURE ? -Math.signum(copy.getTemperature() - Gas.ROOM_TEMPERATURE) : 0; - for (BlockEntity tile : recievingTiles) { - gasPerTile = new GasStack(copy.getGas(), copy.getAmount() / size, copy.getTemperature(), copy.getPressure()); - preGasPerTile = gasPerTile.copy(); + int size = recievingTiles.size(); - // deltaDegreesKelvin = ((double) (Math.abs(tile.getBlockPos().getX() - senderPos.getX()) + Math.abs(tile.getBlockPos().getY() - - // senderPos.getY()) + Math.abs(tile.getBlockPos().getZ() - senderPos.getZ()))) * heatLossPerBlock * gasPerTile.getTemperature() * - // deltaT; + HashSet connections; + int /* deltaDegreesKelvin, newTemperature, */ takenAmt, amtTaken; + int connectionCount; - // newTemperature = gasPerTile.getTemperature() + deltaDegreesKelvin; + // pre-defining all vars to eek out a little more performance since this method is already beefy - // if (deltaT < 0 && newTemperature < Gas.ROOM_TEMPERATURE) { - // newTemperature = Gas.ROOM_TEMPERATURE; - // } + // This algorithm is not perfect, but it helps deal with tiles that do not accept the full amount allotted to them - // deltaDegreesKelvin = newTemperature - gasPerTile.getTemperature(); + for (BlockEntity tile : recievingTiles) { + gasPerTile = new GasStack(copy.getGas(), copy.getAmount() / size, copy.getTemperature(), copy.getPressure()); + preGasPerTile = gasPerTile.copy(); - connections = acceptorInputMap.getOrDefault(tile, new HashSet<>()); + // deltaDegreesKelvin = ((double) (Math.abs(tile.getBlockPos().getX() - senderPos.getX()) + Math.abs(tile.getBlockPos().getY() - + // senderPos.getY()) + Math.abs(tile.getBlockPos().getZ() - senderPos.getZ()))) * heatLossPerBlock * gasPerTile.getTemperature() * + // deltaT; - connectionCount = connections.size(); + // newTemperature = gasPerTile.getTemperature() + deltaDegreesKelvin; - for (Direction dir : connections) { + // if (deltaT < 0 && newTemperature < Gas.ROOM_TEMPERATURE) { + // newTemperature = Gas.ROOM_TEMPERATURE; + // } - gasPerConnection = new GasStack(gasPerTile.getGas(), gasPerTile.getAmount() / connectionCount, gasPerTile.getTemperature(), gasPerTile.getPressure()); - preGasPerConnection = gasPerConnection.copy(); + // deltaDegreesKelvin = newTemperature - gasPerTile.getTemperature(); - // gasPerConnection.heat(deltaDegreesKelvin); + connections = acceptorInputMap.getOrDefault(tile, new HashSet<>()); - amtTaken = GasUtilities.recieveGas(tile, dir, gasPerConnection, GasAction.EXECUTE); + connectionCount = connections.size(); - gasPerConnection.shrink(amtTaken); + for (Direction dir : connections) { - // if (gasPerConnection.getAmount() > 0) { - // gasPerConnection.heat(-deltaDegreesKelvin); - // } + gasPerConnection = new GasStack(gasPerTile.getGas(), gasPerTile.getAmount() / connectionCount, gasPerTile.getTemperature(), gasPerTile.getPressure()); + preGasPerConnection = gasPerConnection.copy(); - gasPerTile.shrink(preGasPerConnection.getAmount() - gasPerConnection.getAmount()); + // gasPerConnection.heat(deltaDegreesKelvin); - connectionCount--; - } + amtTaken = GasUtilities.recieveGas(tile, dir, gasPerConnection, GasAction.EXECUTE); - takenAmt = preGasPerTile.getAmount() - gasPerTile.getAmount(); + gasPerConnection.shrink(amtTaken); - copy.shrink(takenAmt); + // if (gasPerConnection.getAmount() > 0) { + // gasPerConnection.heat(-deltaDegreesKelvin); + // } - taken.setAmount(taken.getAmount() + takenAmt); - size--; - } + gasPerTile.shrink(preGasPerConnection.getAmount() - gasPerConnection.getAmount()); - transmittedThisTick = taken.getAmount(); - temperatureOfTransmitted = taken.getTemperature(); - pressureOfTransmitted = taken.getPressure(); + connectionCount--; + } - return taken; - } + takenAmt = preGasPerTile.getAmount() - gasPerTile.getAmount(); - /** - * - * @param transfer The gas being emited - * @return how much gas was taken and the pumps that accepted gas - */ - private Pair> emitToPumps(GasStack transfer, ArrayList ignored) { + copy.shrink(takenAmt); - GasStack taken = new GasStack(transfer.getGas(), 0, transfer.getTemperature(), transfer.getPressure()); + taken.setAmount(taken.getAmount() + takenAmt); + size--; + } - Set acceptedPumps = ConcurrentHashMap.newKeySet(); + transmittedThisTick = taken.getAmount(); + temperatureOfTransmitted = taken.getTemperature(); + pressureOfTransmitted = taken.getPressure(); - if (priorityPumpMap.isEmpty()) { - return Pair.of(taken, acceptedPumps); - } + return taken; + } - Pair> accepted; + /** + * @param transfer The gas being emited + * @return how much gas was taken and the pumps that accepted gas + */ + private Pair> emitToPumps(GasStack transfer, ArrayList ignored) { - Set prioritySet; + GasStack taken = new GasStack(transfer.getGas(), 0, transfer.getTemperature(), transfer.getPressure()); - GasStack copy = transfer.copy(); + Set acceptedPumps = ConcurrentHashMap.newKeySet(); - for (int i = 9; i >= 0; i--) { + if (priorityPumpMap.isEmpty()) { + return Pair.of(taken, acceptedPumps); + } - if (copy.isEmpty()) { - return Pair.of(taken, acceptedPumps); - } + Pair> accepted; - prioritySet = priorityPumpMap.getOrDefault(i, new HashSet<>()); + Set prioritySet; - if (prioritySet.isEmpty()) { - continue; - } + GasStack copy = transfer.copy(); - accepted = emitToPumpSet(copy, prioritySet, ignored); + for (int i = 9; i >= 0; i--) { - acceptedPumps.addAll(accepted.getSecond()); + if (copy.isEmpty()) { + return Pair.of(taken, acceptedPumps); + } - taken.grow(accepted.getFirst().getAmount()); + prioritySet = priorityPumpMap.getOrDefault(i, new HashSet<>()); - copy.shrink(accepted.getFirst().getAmount()); + if (prioritySet.isEmpty()) { + continue; + } - } + accepted = emitToPumpSet(copy, prioritySet, ignored); - return Pair.of(taken, acceptedPumps); + acceptedPumps.addAll(accepted.getSecond()); - } + taken.grow(accepted.getFirst().getAmount()); - private Pair> emitToPumpSet(GasStack transfer, Set recievingTiles, ArrayList ignored) { + copy.shrink(accepted.getFirst().getAmount()); - GasStack copy = transfer.copy(); - GasStack taken = new GasStack(transfer.getGas(), 0, transfer.getTemperature(), transfer.getPressure()); + } - GasStack gasPerTile, preGasPerTile, gasPerConnection, preGasPerConnection; + return Pair.of(taken, acceptedPumps); - Set filledPumps = ConcurrentHashMap.newKeySet(); + } - // BlockPos senderPos = ignored.get(0).getBlockPos(); + private Pair> emitToPumpSet(GasStack transfer, Set recievingTiles, ArrayList ignored) { - // double deltaT = copy.getTemperature() != Gas.ROOM_TEMPERATURE ? -Math.signum(copy.getTemperature() - Gas.ROOM_TEMPERATURE) : 0; + GasStack copy = transfer.copy(); + GasStack taken = new GasStack(transfer.getGas(), 0, transfer.getTemperature(), transfer.getPressure()); - int /* deltaDegreesKelvin, newTemperature, */ amtTaken, takenAmt; + GasStack gasPerTile, preGasPerTile, gasPerConnection, preGasPerConnection; - int connectionCount; + Set filledPumps = ConcurrentHashMap.newKeySet(); - HashSet connections; + // BlockPos senderPos = ignored.get(0).getBlockPos(); - int size = recievingTiles.size(); + // double deltaT = copy.getTemperature() != Gas.ROOM_TEMPERATURE ? -Math.signum(copy.getTemperature() - Gas.ROOM_TEMPERATURE) : 0; - for (TileGasPipePump tile : recievingTiles) { + int /* deltaDegreesKelvin, newTemperature, */ amtTaken, takenAmt; - if (!tile.isPowered() || ignored.contains(tile)) { - size--; - continue; - } + int connectionCount; - gasPerTile = new GasStack(copy.getGas(), copy.getAmount() / size, copy.getTemperature(), copy.getPressure()); - preGasPerTile = gasPerTile.copy(); + HashSet connections; - // deltaDegreesKelvin = ((double) (Math.abs(tile.getBlockPos().getX() - senderPos.getX()) + Math.abs(tile.getBlockPos().getY() - - // senderPos.getY()) + Math.abs(tile.getBlockPos().getZ() - senderPos.getZ()))) * heatLossPerBlock * gasPerTile.getTemperature() * - // deltaT; + int size = recievingTiles.size(); - // newTemperature = gasPerTile.getTemperature() + deltaDegreesKelvin; + for (TileGasPipePump tile : recievingTiles) { - // if (deltaT < 0 && newTemperature < Gas.ROOM_TEMPERATURE) { - // newTemperature = Gas.ROOM_TEMPERATURE; - // } + if (!tile.isPowered() || ignored.contains(tile)) { + size--; + continue; + } - // deltaDegreesKelvin = newTemperature - gasPerTile.getTemperature(); + gasPerTile = new GasStack(copy.getGas(), copy.getAmount() / size, copy.getTemperature(), copy.getPressure()); + preGasPerTile = gasPerTile.copy(); - connections = acceptorInputMap.getOrDefault(tile, new HashSet<>()); + // deltaDegreesKelvin = ((double) (Math.abs(tile.getBlockPos().getX() - senderPos.getX()) + Math.abs(tile.getBlockPos().getY() - + // senderPos.getY()) + Math.abs(tile.getBlockPos().getZ() - senderPos.getZ()))) * heatLossPerBlock * gasPerTile.getTemperature() * + // deltaT; - connectionCount = connections.size(); + // newTemperature = gasPerTile.getTemperature() + deltaDegreesKelvin; - for (Direction dir : connections) { + // if (deltaT < 0 && newTemperature < Gas.ROOM_TEMPERATURE) { + // newTemperature = Gas.ROOM_TEMPERATURE; + // } - gasPerConnection = new GasStack(gasPerTile.getGas(), gasPerTile.getAmount() / connectionCount, gasPerTile.getTemperature(), gasPerTile.getPressure()); - preGasPerConnection = gasPerConnection.copy(); + // deltaDegreesKelvin = newTemperature - gasPerTile.getTemperature(); - // gasPerConnection.heat(deltaDegreesKelvin); + connections = acceptorInputMap.getOrDefault(tile, new HashSet<>()); - amtTaken = GasUtilities.recieveGas(tile, dir, gasPerConnection, GasAction.EXECUTE); + connectionCount = connections.size(); - gasPerConnection.shrink(amtTaken); + for (Direction dir : connections) { - // if (gasPerConnection.getAmount() > 0) { - // gasPerConnection.heat(-deltaDegreesKelvin); - // } + gasPerConnection = new GasStack(gasPerTile.getGas(), gasPerTile.getAmount() / connectionCount, gasPerTile.getTemperature(), gasPerTile.getPressure()); + preGasPerConnection = gasPerConnection.copy(); - gasPerTile.shrink(preGasPerConnection.getAmount() - gasPerConnection.getAmount()); + // gasPerConnection.heat(deltaDegreesKelvin); - connectionCount--; - } + amtTaken = GasUtilities.recieveGas(tile, dir, gasPerConnection, GasAction.EXECUTE); - takenAmt = preGasPerTile.getAmount() - gasPerTile.getAmount(); + gasPerConnection.shrink(amtTaken); - copy.shrink(takenAmt); + // if (gasPerConnection.getAmount() > 0) { + // gasPerConnection.heat(-deltaDegreesKelvin); + // } - taken.setAmount(taken.getAmount() + takenAmt); + gasPerTile.shrink(preGasPerConnection.getAmount() - gasPerConnection.getAmount()); - if (takenAmt > 0) { - filledPumps.add(tile); - } + connectionCount--; + } - filledPumps.add(tile); + takenAmt = preGasPerTile.getAmount() - gasPerTile.getAmount(); - size--; - } + copy.shrink(takenAmt); - transmittedThisTick = taken.getAmount(); - temperatureOfTransmitted = taken.getTemperature(); - pressureOfTransmitted = taken.getPressure(); + taken.setAmount(taken.getAmount() + takenAmt); - return Pair.of(taken, filledPumps); - } + if (takenAmt > 0) { + filledPumps.add(tile); + } - private boolean checkForOverloadAndHandle(GasStack stack, boolean live) { + filledPumps.add(tile); - boolean isCorrosive = stack.is(ElectrodynamicsTags.Gases.IS_CORROSIVE); + size--; + } - if (stack.getPressure() <= maxPressure && !isCorrosive) { - return false; - } + transmittedThisTick = taken.getAmount(); + temperatureOfTransmitted = taken.getTemperature(); + pressureOfTransmitted = taken.getPressure(); - boolean exploded = false; - HashSet overloadedPipes = new HashSet<>(); + return Pair.of(taken, filledPumps); + } - for (SubtypeGasPipe pipe : SubtypeGasPipe.values()) { + private boolean checkForOverloadAndHandle(GasStack stack, boolean live) { - if (pipe.pipeMaterial.maxPressure < stack.getPressure() || (pipe.pipeMaterial.corrodedByAcid && isCorrosive)) { + boolean isCorrosive = stack.is(ElectrodynamicsTags.Gases.IS_CORROSIVE); - overloadedPipes.add(pipe); + if (stack.getPressure() <= maxPressure && !isCorrosive) { + return false; + } - } + HashSet overloadedPipes = new HashSet<>(); - } - for (SubtypeGasPipe pipe : overloadedPipes) { - for (IGasPipe gasPipe : conductorTypeMap.getOrDefault(pipe, new HashSet<>())) { - if (live) { - gasPipe.destroyViolently(); - } - exploded = true; - } - } + for (Map.Entry> entry : pressureToGasPipeMap.entrySet()) { - return exploded; + if (entry.getKey() < stack.getPressure()) { - } + overloadedPipes.addAll(entry.getValue()); - @Override - public void updateConductorStatistics(IGasPipe cable) { + } - SubtypeGasPipe pipe = cable.getPipeType(); + } - // if (heatLossPerBlock == 0) { - // heatLossPerBlock = pipe.effectivePipeHeatLoss; - // } + if(isCorrosive) { + overloadedPipes.addAll(destroyedByCorrosion); + } - // heatLossPerBlock = (heatLossPerBlock + pipe.effectivePipeHeatLoss) / 2.0; + if(overloadedPipes.isEmpty()) { + return false; + } - if (maxPressure == 0) { - maxPressure = pipe.pipeMaterial.maxPressure; - } + if(!live) { + return true; + } - if (pipe.pipeMaterial.maxPressure < maxPressure) { - maxPressure = pipe.pipeMaterial.maxPressure; - } + for(GenericTileGasPipe pipe : overloadedPipes) { + Scheduler.schedule(1, pipe::destroyViolently); + } - } + return true; - @Override - public void updateRecieverStatistics(BlockEntity reciever, Direction dir) { + } - if (reciever instanceof TileGasPipePump pump) { - int priority = pump.priority.get(); - HashSet set = priorityPumpMap.getOrDefault(priority, new HashSet<>()); - set.add(pump); - priorityPumpMap.put(priority, set); + @Override + public void updateConductorStatistics(GenericTileGasPipe cable, boolean remove) { - } + super.updateConductorStatistics(cable, remove); - } + if (remove) { - public void updateGasPipePumpStats(TileGasPipePump changedPump, int newPriority, int prevPriority) { - HashSet oldSet = priorityPumpMap.getOrDefault(prevPriority, new HashSet<>()); - oldSet.remove(changedPump); - priorityPumpMap.put(prevPriority, oldSet); + int pressure = cable.getCableType().getPipeMaterial().getMaxPressuire(); - HashSet newSet = priorityPumpMap.getOrDefault(newPriority, new HashSet<>()); - newSet.add(changedPump); - priorityPumpMap.put(newPriority, newSet); - } + if(pressureToGasPipeMap.containsKey(pressure)) { + HashSet set = pressureToGasPipeMap.get(pressure); + set.remove(cable); + pressureToGasPipeMap.put(pressure, set); + } - @Override - public void tick() { - super.tick(); - pressureOfTransmitted = 0; - temperatureOfTransmitted = 0; + destroyedByCorrosion.remove(cable); - Iterator it = conductorSet.iterator(); + } else { + IGasPipe pipe = cable.getCableType(); + + // if (heatLossPerBlock == 0) { + // heatLossPerBlock = pipe.effectivePipeHeatLoss; + // } + + // heatLossPerBlock = (heatLossPerBlock + pipe.effectivePipeHeatLoss) / 2.0; + + if (networkMaxTransfer == 0 || networkMaxTransfer < pipe.getMaxTransfer()) { + networkMaxTransfer = pipe.getMaxTransfer(); + } + + if (maxPressure == 0 || pipe.getPipeMaterial().getMaxPressuire() < maxPressure) { + maxPressure = pipe.getPipeMaterial().getMaxPressuire(); + } + + int pressure = pipe.getPipeMaterial().getMaxPressuire(); + + HashSet set = pressureToGasPipeMap.getOrDefault(pressure, new HashSet<>()); + + set.add(cable); + + pressureToGasPipeMap.put(pressure, set); + + + } + } + + @Override + public void updateRecieverStatistics(BlockEntity reciever, Direction dir) { + + if (reciever instanceof TileGasPipePump pump) { + int priority = pump.priority.get(); + HashSet set = priorityPumpMap.getOrDefault(priority, new HashSet<>()); + set.add(pump); + priorityPumpMap.put(priority, set); + + } + + } + + @Override + public void resetConductorStatistics() { + networkMaxTransfer = 0; + maxPressure = 0; + pressureToGasPipeMap.clear(); + destroyedByCorrosion.clear(); + super.resetConductorStatistics(); + } + + @Override + public void resetReceiverStatistics() { + priorityPumpMap.clear(); + super.resetReceiverStatistics(); + } + + public void updateGasPipePumpStats(TileGasPipePump changedPump, int newPriority, int prevPriority) { + HashSet oldSet = priorityPumpMap.getOrDefault(prevPriority, new HashSet<>()); + oldSet.remove(changedPump); + priorityPumpMap.put(prevPriority, oldSet); + + HashSet newSet = priorityPumpMap.getOrDefault(newPriority, new HashSet<>()); + newSet.add(changedPump); + priorityPumpMap.put(newPriority, newSet); + } + + @Override + public void tick() { + super.tick(); + pressureOfTransmitted = 0; + temperatureOfTransmitted = 0; + + /* + + Iterator it = conductorSet.iterator(); boolean broken = false; while (it.hasNext()) { IGasPipe conductor = it.next(); @@ -414,50 +452,28 @@ public void tick() { if (broken) { refresh(); } - if (getSize() == 0) { - deregister(); - } - } - - @Override - public boolean isConductor(BlockEntity tile, IGasPipe requesterCable) { - return tile instanceof IGasPipe; - } - - @Override - public boolean isConductorClass(BlockEntity tile) { - return tile instanceof IGasPipe; - } - - @Override - public boolean isAcceptor(BlockEntity acceptor, Direction orientation) { - return GasUtilities.isGasReciever(acceptor, orientation.getOpposite()); - } - - @Override - public boolean canConnect(BlockEntity acceptor, Direction orientation) { - return GasUtilities.isGasReciever(acceptor, orientation.getOpposite()); - } - - @Override - public AbstractNetwork createInstance() { - return new GasNetwork(); - } - - @Override - public AbstractNetwork createInstanceConductor(Set conductors) { - return new GasNetwork(conductors); - } - - @Override - public AbstractNetwork createInstance(Set> networks) { - return new GasNetwork(networks); - } - - @Override - public SubtypeGasPipe[] getConductorTypes() { - return SubtypeGasPipe.values(); - } + */ + if (getSize() == 0) { + deregister(); + } + + } + + @Override + public void deregister() { + pressureToGasPipeMap.clear(); + super.deregister(); + } + + @Override + public boolean isConductor(BlockEntity tile, GenericTileGasPipe requesterCable) { + return tile instanceof GenericTileGasPipe; + } + + @Override + public GasNetwork createInstanceConductor(Set conductors) { + return new GasNetwork(conductors); + } } diff --git a/src/main/java/electrodynamics/common/network/utils/FluidUtilities.java b/src/main/java/electrodynamics/common/network/utils/FluidUtilities.java index a03acedef..b6033bb05 100644 --- a/src/main/java/electrodynamics/common/network/utils/FluidUtilities.java +++ b/src/main/java/electrodynamics/common/network/utils/FluidUtilities.java @@ -1,6 +1,6 @@ package electrodynamics.common.network.utils; -import electrodynamics.api.network.cable.type.IFluidPipe; +import electrodynamics.common.tile.pipelines.gas.GenericTileGasPipe; import electrodynamics.prefab.tile.GenericTile; import electrodynamics.prefab.tile.components.IComponentType; import electrodynamics.prefab.tile.components.type.ComponentInventory; @@ -24,7 +24,7 @@ public static boolean isFluidReceiver(BlockEntity acceptor, Direction dir) { } public static boolean isConductor(BlockEntity acceptor) { - return acceptor instanceof IFluidPipe; + return acceptor instanceof GenericTileGasPipe; } public static int receiveFluid(BlockEntity acceptor, Direction direction, FluidStack perReceiver, boolean debug) { diff --git a/src/main/java/electrodynamics/common/network/utils/GasUtilities.java b/src/main/java/electrodynamics/common/network/utils/GasUtilities.java index 9e4997535..10d8317de 100644 --- a/src/main/java/electrodynamics/common/network/utils/GasUtilities.java +++ b/src/main/java/electrodynamics/common/network/utils/GasUtilities.java @@ -69,6 +69,10 @@ public static void outputToPipe(GenericTile tile, GasTank[] tanks, Direction... for (GasTank gasTank : tanks) { + if(gasTank.isEmpty()) { + + } + for (int i = 0; i < handler.getTanks(); i++) { GasStack tankGas = gasTank.getGas().copy(); diff --git a/src/main/java/electrodynamics/common/recipe/recipeutils/FluidIngredient.java b/src/main/java/electrodynamics/common/recipe/recipeutils/FluidIngredient.java index 52d51fe7f..464764bc1 100644 --- a/src/main/java/electrodynamics/common/recipe/recipeutils/FluidIngredient.java +++ b/src/main/java/electrodynamics/common/recipe/recipeutils/FluidIngredient.java @@ -177,7 +177,7 @@ public IngredientType getType() { @Override public boolean test(@Nullable FluidStack t) { - if(t == null){ + if(t == null || t.isEmpty()){ return false; } diff --git a/src/main/java/electrodynamics/common/recipe/recipeutils/GasIngredient.java b/src/main/java/electrodynamics/common/recipe/recipeutils/GasIngredient.java index 789cf345a..2bd6b0f7e 100644 --- a/src/main/java/electrodynamics/common/recipe/recipeutils/GasIngredient.java +++ b/src/main/java/electrodynamics/common/recipe/recipeutils/GasIngredient.java @@ -188,7 +188,7 @@ public IngredientType getType() { } public boolean testGas(@Nullable GasStack gas, boolean checkTemperature, boolean checkPressure) { - if (gas == null) { + if (gas == null || gas.isEmpty()) { return false; } for (GasStack g : getMatchingGases()) { diff --git a/src/main/java/electrodynamics/common/settings/Constants.java b/src/main/java/electrodynamics/common/settings/Constants.java index 2a5d29dff..12db54503 100644 --- a/src/main/java/electrodynamics/common/settings/Constants.java +++ b/src/main/java/electrodynamics/common/settings/Constants.java @@ -41,6 +41,10 @@ public class Constants { public static int ELECTRICARCFURNACE_REQUIRED_TICKS = 50; @DoubleValue(def = 125.0) public static double WIREMILL_USAGE_PER_TICK = 125.0; + @DoubleValue(def = 1000) + public static double ROTARY_UNIFIER_USAGE = 1000; + @IntValue(def = 1) + public static int ROTARY_UNIFIER_CONVERSION_RATE = 1; @IntValue(def = 200) public static int WIREMILL_REQUIRED_TICKS = 200; @DoubleValue(def = 350.0) diff --git a/src/main/java/electrodynamics/common/tile/compatibility/TileRotaryUnifier.java b/src/main/java/electrodynamics/common/tile/compatibility/TileRotaryUnifier.java new file mode 100644 index 000000000..cbd84ccc1 --- /dev/null +++ b/src/main/java/electrodynamics/common/tile/compatibility/TileRotaryUnifier.java @@ -0,0 +1,223 @@ +package electrodynamics.common.tile.compatibility; + +import electrodynamics.Electrodynamics; +import electrodynamics.api.References; +import electrodynamics.api.capability.types.gas.IGasHandler; +import electrodynamics.api.gas.GasAction; +import electrodynamics.api.gas.GasStack; +import electrodynamics.api.gas.PropertyGasTank; +import electrodynamics.common.block.states.ElectrodynamicsBlockStates; +import electrodynamics.common.inventory.container.tile.ContainerRotaryUnifier; +import electrodynamics.common.settings.Constants; +import electrodynamics.compatibility.mekanism.MekanismHandler; +import electrodynamics.prefab.properties.Property; +import electrodynamics.prefab.properties.PropertyTypes; +import electrodynamics.prefab.sound.SoundBarrierMethods; +import electrodynamics.prefab.sound.utils.ITickableSound; +import electrodynamics.prefab.tile.components.IComponentType; +import electrodynamics.prefab.tile.components.type.*; +import electrodynamics.prefab.tile.types.GenericGasTile; +import electrodynamics.prefab.utilities.BlockEntityUtils; +import electrodynamics.registers.ElectrodynamicsCapabilities; +import electrodynamics.registers.ElectrodynamicsSounds; +import electrodynamics.registers.ElectrodynamicsTiles; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.BlockHitResult; +import net.neoforged.fml.ModList; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public class TileRotaryUnifier extends GenericGasTile implements ITickableSound { + + public static final int MAX_GAS_AMOUNT = 1000; + public static final int MAX_CHEM_AMOUNT = 1000; + + private final boolean mekIsLoaded; + public final int chemStackIndex; + public final Property conversionIsFlipped = property(new Property<>(PropertyTypes.BOOLEAN, "conversionisflipped", false)); + public final PropertyGasTank gasTank = new PropertyGasTank(this, "gastank", MAX_GAS_AMOUNT, 1000, 1000); + + public Direction gasIO; + public Direction chemicalIO; + + private boolean playing = false; + + public TileRotaryUnifier(BlockPos worldPos, BlockState blockState) { + super(ElectrodynamicsTiles.TILE_ROTARYUNIFIER.get(), worldPos, blockState); + addComponent(new ComponentTickable(this).tickClient(this::tickClient)); + addComponent(new ComponentElectrodynamic(this, false, true).maxJoules(Constants.ROTARY_UNIFIER_USAGE * 20).voltage(ElectrodynamicsCapabilities.DEFAULT_VOLTAGE * 4).setInputDirections(BlockEntityUtils.MachineDirection.BOTTOM)); + addComponent(new ComponentInventory(this, ComponentInventory.InventoryBuilder.newInv().upgrades(3)).validUpgrades(ContainerRotaryUnifier.VALID_UPGRADES).valid(machineValidator())); + addComponent(new ComponentProcessor(this).usage(Constants.ROTARY_UNIFIER_USAGE).canProcess(this::canProcess).process(this::process)); + addComponent(new ComponentContainerProvider("container.rotaryunifier", this).createMenu((id, player) -> new ContainerRotaryUnifier(id, player, getComponent(IComponentType.Inventory), getCoordsArray()))); + gasIO = BlockEntityUtils.getRelativeSide(getFacing(), BlockEntityUtils.MachineDirection.RIGHT.mappedDir); + chemicalIO = BlockEntityUtils.getRelativeSide(getFacing(), BlockEntityUtils.MachineDirection.LEFT.mappedDir); + mekIsLoaded = ModList.get().isLoaded(References.MEKANISM_ID); + if(mekIsLoaded) { + chemStackIndex = MekanismHandler.addProperty(this); + gasTank.setValidator(MekanismHandler.getTankPredicate()); + } else { + chemStackIndex = 0; + gasTank.setValidator(stack -> false); + } + } + + private void tickClient(ComponentTickable tickable) { + + ComponentProcessor proc = getComponent(IComponentType.Processor); + + if(!proc.isActive()) { + return; + } + + if (!playing) { + playing = true; + SoundBarrierMethods.playTileSound(ElectrodynamicsSounds.SOUND_COMPRESSORRUNNING.get(), this, true); + } + + Direction direction = getFacing(); + double axisShift = 0; + double yShift = 0; + + axisShift = Electrodynamics.RANDOM.nextDouble(0.64) + 0.18; + yShift = Electrodynamics.RANDOM.nextDouble(0.57) + 0.25; + + double xShift = direction.getAxis() == Direction.Axis.X ? direction.getStepX() * (direction.getStepX() == -1 ? -1 : 0) : axisShift; + double zShift = direction.getAxis() == Direction.Axis.Z ? direction.getStepZ() * (direction.getStepZ() == -1 ? -1 : 0) : axisShift; + + level.addParticle(ParticleTypes.SMOKE, worldPosition.getX() + xShift, worldPosition.getY() + yShift, worldPosition.getZ() + zShift, 0.0D, 0.0D, 0.0D); + + xShift = direction.getAxis() == Direction.Axis.X ? direction.getStepX() * (direction.getStepX() == -1 ? 0 : 1) : axisShift; + zShift = direction.getAxis() == Direction.Axis.Z ? direction.getStepZ() * (direction.getStepZ() == -1 ? 0 : 1) : axisShift; + + level.addParticle(ParticleTypes.SMOKE, worldPosition.getX() + xShift, worldPosition.getY() + yShift, worldPosition.getZ() + zShift, 0.0D, 0.0D, 0.0D); + } + + private void process(ComponentProcessor componentProcessor) { + if(mekIsLoaded) { + MekanismHandler.process(this, componentProcessor); + } + + } + + private boolean canProcess(ComponentProcessor componentProcessor) { + boolean update = false; + if(mekIsLoaded) { + update = MekanismHandler.canProcess(this, componentProcessor); + } + if (BlockEntityUtils.isLit(this) ^ update) { + BlockEntityUtils.updateLit(this, update); + } + return update; + } + + @Override + public @Nullable IGasHandler getGasHandlerCapability(@Nullable Direction side) { + if(side == null || side != gasIO) { + return null; + } + return new IGasHandler() { + @Override + public int getTanks() { + return 1; + } + + @Override + public GasStack getGasInTank(int tank) { + return gasTank.getGasInTank(0); + } + + @Override + public int getTankCapacity(int tank) { + return gasTank.getTankCapacity(0); + } + + @Override + public int getTankMaxTemperature(int tank) { + return gasTank.getTankMaxTemperature(0); + } + + @Override + public int getTankMaxPressure(int tank) { + return gasTank.getTankMaxPressure(0); + } + + @Override + public boolean isGasValid(int tank, @NotNull GasStack gas) { + return gasTank.isGasValid(gas); + } + + @Override + public int fill(GasStack gas, GasAction action) { + return conversionIsFlipped.get() ? 0 : gasTank.fill(gas, action); + } + + @Override + public GasStack drain(GasStack gas, GasAction action) { + return conversionIsFlipped.get() ? gasTank.drain(gas, action) : GasStack.EMPTY; + } + + @Override + public GasStack drain(int maxFill, GasAction action) { + return conversionIsFlipped.get() ? gasTank.drain(maxFill, action) : GasStack.EMPTY; + } + + @Override + public int heat(int tank, int deltaTemperature, GasAction action) { + return gasTank.heat(tank, deltaTemperature, action); + } + + @Override + public int bringPressureTo(int tank, int atm, GasAction action) { + return gasTank.bringPressureTo(tank, atm, action); + } + }; + } + + @Override + public void onBlockStateUpdate(BlockState oldState, BlockState newState) { + super.onBlockStateUpdate(oldState, newState); + if (!level.isClientSide() && oldState.hasProperty(ElectrodynamicsBlockStates.FACING) && newState.hasProperty(ElectrodynamicsBlockStates.FACING) && oldState.getValue(ElectrodynamicsBlockStates.FACING) != newState.getValue(ElectrodynamicsBlockStates.FACING)) { + gasIO = BlockEntityUtils.getRelativeSide(getFacing(), BlockEntityUtils.MachineDirection.RIGHT.mappedDir); + chemicalIO = BlockEntityUtils.getRelativeSide(getFacing(), BlockEntityUtils.MachineDirection.RIGHT.mappedDir); + } + } + + @Override + protected void saveAdditional(CompoundTag compound, HolderLookup.Provider registries) { + super.saveAdditional(compound, registries); + compound.putInt("gasio", gasIO.ordinal()); + compound.putInt("chemicalio", chemicalIO.ordinal()); + } + + @Override + protected void loadAdditional(CompoundTag compound, HolderLookup.Provider registries) { + super.loadAdditional(compound, registries); + gasIO = Direction.values()[compound.getInt("gasio")]; + chemicalIO = Direction.values()[compound.getInt("chemicalio")]; + } + + @Override + public InteractionResult useWithoutItem(Player player, BlockHitResult hit) { + if(mekIsLoaded) { + return super.useWithoutItem(player, hit); + } + return InteractionResult.PASS; + } + + @Override + public void setNotPlaying() { + playing = false; + } + + @Override + public boolean shouldPlaySound() { + return this.getComponent(IComponentType.Processor).isActive(); + } +} diff --git a/src/main/java/electrodynamics/common/tile/electricitygrid/GenericTileWire.java b/src/main/java/electrodynamics/common/tile/electricitygrid/GenericTileWire.java index d6a49fa0d..224db9ce2 100644 --- a/src/main/java/electrodynamics/common/tile/electricitygrid/GenericTileWire.java +++ b/src/main/java/electrodynamics/common/tile/electricitygrid/GenericTileWire.java @@ -1,17 +1,12 @@ package electrodynamics.common.tile.electricitygrid; import java.util.ArrayList; -import java.util.HashSet; - -import com.google.common.collect.Sets; +import java.util.Set; import electrodynamics.api.capability.types.electrodynamic.ICapabilityElectrodynamic; -import electrodynamics.api.network.cable.type.IConductor; +import electrodynamics.api.network.cable.type.IWire; import electrodynamics.common.network.type.ElectricNetwork; -import electrodynamics.prefab.network.AbstractNetwork; -import electrodynamics.prefab.tile.types.GenericConnectTile; -import electrodynamics.prefab.utilities.ElectricityUtils; -import electrodynamics.prefab.utilities.Scheduler; +import electrodynamics.prefab.tile.types.GenericRefreshingConnectTile; import electrodynamics.prefab.utilities.object.TransferPack; import electrodynamics.registers.ElectrodynamicsCapabilities; import net.minecraft.core.BlockPos; @@ -21,17 +16,10 @@ import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; -public abstract class GenericTileWire extends GenericConnectTile implements IConductor { - - public ElectricNetwork electricNetwork; - - private boolean[] connections = new boolean[6]; - private BlockEntity[] tileConnections = new BlockEntity[6]; +public abstract class GenericTileWire extends GenericRefreshingConnectTile { private final ICapabilityElectrodynamic[] handler = new ICapabilityElectrodynamic[6]; - private boolean isQueued = false; - protected GenericTileWire(BlockEntityType tileEntityTypeIn, BlockPos pos, BlockState state) { super(tileEntityTypeIn, pos, state); for (Direction dir : Direction.values()) { @@ -67,9 +55,6 @@ public TransferPack receivePower(TransferPack transfer, boolean debug) { ICapabilityElectrodynamic electro = level.getCapability(ElectrodynamicsCapabilities.CAPABILITY_ELECTRODYNAMIC_BLOCK, entity.getBlockPos(), entity.getBlockState(), entity, dir.getOpposite()); boolean isReciever = electro != null && electro.isEnergyReceiver(); - - // boolean isReceiver = entity.getCapability(ElectrodynamicsCapabilities.ELECTRODYNAMIC, - // dir.getOpposite()).map(ICapabilityElectrodynamic::isEnergyReceiver).orElse(false); ignored.add(entity); if (!debug) { getNetwork().addProducer(ignored.get(0), transfer.getVoltage(), isReciever); @@ -124,156 +109,26 @@ public void setJoulesStored(double joules) { return handler[side.ordinal()]; } - @Override - public ElectricNetwork getNetwork() { - return getNetwork(true); - } - - private HashSet getConnectedConductors() { - HashSet set = new HashSet<>(); - - for (Direction dir : Direction.values()) { - BlockEntity facing = level.getBlockEntity(worldPosition.relative(dir)); - if (facing instanceof IConductor conductor && checkColor(conductor)) { - set.add(conductor); - } - } - return set; - } - - @Override - public ElectricNetwork getNetwork(boolean createIfNull) { - if (electricNetwork == null && createIfNull) { - HashSet adjacentCables = getConnectedConductors(); - HashSet connectedNets = new HashSet<>(); - for (IConductor wire : adjacentCables) { - if (wire.getNetwork(false) != null && wire.getNetwork() instanceof ElectricNetwork el) { - connectedNets.add(el); - } - } - if (connectedNets.isEmpty()) { - electricNetwork = new ElectricNetwork(Sets.newHashSet(this)); - } else { - if (connectedNets.size() == 1) { - electricNetwork = (ElectricNetwork) connectedNets.toArray()[0]; - } else { - electricNetwork = new ElectricNetwork(connectedNets, false); - } - electricNetwork.conductorSet.add(this); - } - } - return electricNetwork; - } - - @Override - public void setNetwork(AbstractNetwork network) { - if (electricNetwork != network && network instanceof ElectricNetwork el) { - removeFromNetwork(); - electricNetwork = el; - } - } - - @Override - public void refreshNetwork() { - if (level != null) { - isQueued = false; - if (!level.isClientSide) { - updateAdjacent(); - ArrayList foundNetworks = new ArrayList<>(); - for (Direction dir : Direction.values()) { - BlockEntity facing = level.getBlockEntity(worldPosition.relative(dir)); - if (facing instanceof IConductor conductor && checkColor(conductor) && conductor.getNetwork() instanceof ElectricNetwork network) { - foundNetworks.add(network); - } - } - if (!foundNetworks.isEmpty() && getNetwork(false) == null) { - if (foundNetworks.size() > 1) { - foundNetworks.get(0).conductorSet.add(this); - electricNetwork = foundNetworks.get(0); - foundNetworks.remove(0); - for (ElectricNetwork network : foundNetworks) { - electricNetwork.merge(network); - } - } - } - getNetwork().refresh(); - } - } else if (!isQueued) { - // For some reason the world was null? - isQueued = true; - Scheduler.schedule(20, this::refreshNetwork); - } - } - - public boolean updateAdjacent() { - boolean flag = false; - for (Direction dir : Direction.values()) { - BlockEntity tile = level.getBlockEntity(worldPosition.relative(dir)); - boolean isElectricityReciever = ElectricityUtils.isElectricReceiver(tile, dir.getOpposite()); - boolean is = (ElectricityUtils.isConductor(tile, this) && isElectricityReciever) || (!(tile instanceof IConductor) && isElectricityReciever); - if (connections[dir.ordinal()] != is) { - connections[dir.ordinal()] = is; - tileConnections[dir.ordinal()] = tile; - flag = true; - } - - } - return flag; - } - - @Override - public BlockEntity[] getAdjacentConnections() { - return tileConnections; - } - - @Override - public void refreshNetworkIfChange() { - if (updateAdjacent()) { - refreshNetwork(); - } - } - - @Override - public void removeFromNetwork() { - if (electricNetwork != null) { - electricNetwork.removeFromNetwork(this); - } - } - - @Override - public AbstractNetwork getAbstractNetwork() { - return electricNetwork; - } - @Override public void destroyViolently() { level.setBlockAndUpdate(worldPosition, Blocks.FIRE.defaultBlockState()); } @Override - public void setRemoved() { - if (!level.isClientSide && electricNetwork != null) { - getNetwork().split(this); - } - super.setRemoved(); - + public double getMaxTransfer() { + return getCableType().getAmpacity(); } @Override - public void onChunkUnloaded() { - if (!level.isClientSide && electricNetwork != null) { - getNetwork().split(this); - } - super.onChunkUnloaded(); + public ElectricNetwork createInstance(Set electricNetworks) { + return new ElectricNetwork(electricNetworks); } @Override - public void onLoad() { - super.onLoad(); - Scheduler.schedule(1, this::refreshNetwork); + public ElectricNetwork createInstanceConductor(Set genericTileWires) { + return new ElectricNetwork(genericTileWires); } - private boolean checkColor(IConductor conductor) { - return conductor.getWireType().isDefaultColor() || getWireType().isDefaultColor() || conductor.getWireColor() == getWireColor(); - } + public abstract IWire.IWireColor getWireColor(); + } diff --git a/src/main/java/electrodynamics/common/tile/electricitygrid/TileCircuitMonitor.java b/src/main/java/electrodynamics/common/tile/electricitygrid/TileCircuitMonitor.java index 4a6c11e6a..17fc3e0f2 100644 --- a/src/main/java/electrodynamics/common/tile/electricitygrid/TileCircuitMonitor.java +++ b/src/main/java/electrodynamics/common/tile/electricitygrid/TileCircuitMonitor.java @@ -40,7 +40,7 @@ public TileCircuitMonitor(BlockPos worldPos, BlockState blockState) { super(ElectrodynamicsTiles.TILE_CIRCUITMONITOR.get(), worldPos, blockState); addComponent(new ComponentPacketHandler(this)); addComponent(new ComponentTickable(this).tickServer(this::tickServer)); - addComponent(new ComponentElectrodynamic(this, false, false).voltage(-1).receivePower((transfer, debug) -> TransferPack.EMPTY).getConnectedLoad((profile, dir) -> TransferPack.EMPTY).setInputDirections(BlockEntityUtils.MachineDirection.BACK)); + addComponent(new ComponentElectrodynamic(this, false, false).voltage(-1).receivePower((transfer, debug) -> TransferPack.EMPTY).getConnectedLoad((profile, dir) -> TransferPack.EMPTY).setInputDirections(BlockEntityUtils.MachineDirection.FRONT)); addComponent(new ComponentContainerProvider(SubtypeMachine.circuitmonitor, this).createMenu((id, inv) -> new ContainerCircuitMonitor(id, inv, getCoordsArray()))); } diff --git a/src/main/java/electrodynamics/common/tile/electricitygrid/TileMultimeterBlock.java b/src/main/java/electrodynamics/common/tile/electricitygrid/TileMultimeterBlock.java index 9eb9b68af..859f0f71d 100644 --- a/src/main/java/electrodynamics/common/tile/electricitygrid/TileMultimeterBlock.java +++ b/src/main/java/electrodynamics/common/tile/electricitygrid/TileMultimeterBlock.java @@ -1,7 +1,6 @@ package electrodynamics.common.tile.electricitygrid; import electrodynamics.api.capability.types.electrodynamic.ICapabilityElectrodynamic.LoadProfile; -import electrodynamics.api.network.cable.type.IConductor; import electrodynamics.common.network.type.ElectricNetwork; import electrodynamics.prefab.properties.Property; import electrodynamics.prefab.properties.PropertyTypes; @@ -21,11 +20,11 @@ public class TileMultimeterBlock extends GenericTile { //TODO Flip it so it places facing towards the player - public Property voltage = property(new Property<>(PropertyTypes.DOUBLE, "voltageNew", 0.0).setNoSave()); - public Property minVoltage = property(new Property<>(PropertyTypes.DOUBLE, "minvoltage", 0.0).setNoSave()); - public Property joules = property(new Property<>(PropertyTypes.DOUBLE, "joulesNew", 0.0).setNoSave()); - public Property resistance = property(new Property<>(PropertyTypes.DOUBLE, "resistanceNew", 0.0).setNoSave()); - public Property loss = property(new Property<>(PropertyTypes.DOUBLE, "lossNew", 0.0).setNoSave()); + public Property voltage = property(new Property<>(PropertyTypes.DOUBLE, "voltageNew", 0.0)); + public Property minVoltage = property(new Property<>(PropertyTypes.DOUBLE, "minvoltage", 0.0)); + public Property joules = property(new Property<>(PropertyTypes.DOUBLE, "joulesNew", 0.0)); + public Property resistance = property(new Property<>(PropertyTypes.DOUBLE, "resistanceNew", 0.0)); + public Property loss = property(new Property<>(PropertyTypes.DOUBLE, "lossNew", 0.0)); public CachedTileOutput input; @@ -43,15 +42,13 @@ public void tickServer(ComponentTickable tickable) { if (input == null) { input = new CachedTileOutput(level, worldPosition.relative(facing)); } - if (input.getSafe() instanceof IConductor) { - IConductor cond = input.getSafe(); - if (cond.getAbstractNetwork() instanceof ElectricNetwork net) { - joules.set(net.getActiveTransmitted()); - voltage.set(net.getActiveVoltage()); - minVoltage.set(net.getMinimumVoltage()); - resistance.set(net.getResistance()); - loss.set(net.getLastEnergyLoss()); - } + if (input.getSafe() instanceof GenericTileWire cond) { + ElectricNetwork network = cond.getNetwork(); + joules.set(network.getActiveTransmitted()); + voltage.set(network.getActiveVoltage()); + minVoltage.set(network.getMinimumVoltage()); + resistance.set(network.getResistance()); + loss.set(network.getLastEnergyLoss()); } else { joules.set(0.0); voltage.set(0.0); diff --git a/src/main/java/electrodynamics/common/tile/electricitygrid/TileWire.java b/src/main/java/electrodynamics/common/tile/electricitygrid/TileWire.java index 62a077c14..8a7d78778 100644 --- a/src/main/java/electrodynamics/common/tile/electricitygrid/TileWire.java +++ b/src/main/java/electrodynamics/common/tile/electricitygrid/TileWire.java @@ -1,15 +1,12 @@ package electrodynamics.common.tile.electricitygrid; +import electrodynamics.api.network.cable.type.IWire; import electrodynamics.prefab.properties.PropertyTypes; -import net.minecraft.core.HolderLookup; import electrodynamics.common.block.connect.BlockWire; -import electrodynamics.common.block.subtype.SubtypeWire; -import electrodynamics.common.block.subtype.SubtypeWire.WireColor; import electrodynamics.prefab.properties.Property; import electrodynamics.registers.ElectrodynamicsTiles; import net.minecraft.core.BlockPos; -import net.minecraft.nbt.CompoundTag; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; @@ -17,8 +14,8 @@ public class TileWire extends GenericTileWire { public Property transmit = property(new Property<>(PropertyTypes.DOUBLE, "transmit", 0.0)); - public SubtypeWire wire = null; - public WireColor color = null; + public IWire wire = null; + public IWire.IWireColor color = null; public TileWire(BlockPos pos, BlockState state) { super(ElectrodynamicsTiles.TILE_WIRE.get(), pos, state); @@ -29,7 +26,7 @@ public TileWire(BlockEntityType tileEntityType, BlockPos pos } @Override - public SubtypeWire getWireType() { + public IWire getCableType() { if (wire == null) { wire = ((BlockWire) getBlockState().getBlock()).wire; } @@ -37,25 +34,11 @@ public SubtypeWire getWireType() { } @Override - public WireColor getWireColor() { + public IWire.IWireColor getWireColor() { if (color == null) { - color = ((BlockWire) getBlockState().getBlock()).wire.color; + color = ((BlockWire) getBlockState().getBlock()).wire.getWireColor(); } return color; } - @Override - protected void saveAdditional(CompoundTag compound, HolderLookup.Provider registries) { - compound.putInt("ord", getWireType().ordinal()); - compound.putInt("color", getWireColor().ordinal()); - super.saveAdditional(compound, registries); - } - - @Override - protected void loadAdditional(CompoundTag compound, HolderLookup.Provider registries) { - super.loadAdditional(compound, registries); - wire = SubtypeWire.values()[compound.getInt("ord")]; - color = WireColor.values()[compound.getInt("color")]; - } - } diff --git a/src/main/java/electrodynamics/common/tile/electricitygrid/transformer/TileGenericTransformer.java b/src/main/java/electrodynamics/common/tile/electricitygrid/transformer/TileGenericTransformer.java index 6d75ecc61..762b08457 100644 --- a/src/main/java/electrodynamics/common/tile/electricitygrid/transformer/TileGenericTransformer.java +++ b/src/main/java/electrodynamics/common/tile/electricitygrid/transformer/TileGenericTransformer.java @@ -61,7 +61,7 @@ public TileGenericTransformer(BlockEntityType type, BlockPos worldPosition, B } public void tickClient(ComponentTickable tickable) { - if (level.getGameTime() - lastTransferTime.get() > 20) { + if (level.getGameTime() - lastTransferTime.get() > 20L) { lastTransfer.set(TransferPack.EMPTY); } if (!isPlayingSound && shouldPlaySound()) { @@ -123,7 +123,7 @@ public TransferPack getConnectedLoad(LoadProfile lastEnergy, Direction dir) { TransferPack returner = TransferPack.EMPTY; if (electro != null) { - electro.getConnectedLoad(transformed, dir); + returner = electro.getConnectedLoad(transformed, dir); } // TransferPack returner = ((BlockEntity) output.getSafe()).getCapability(ElectrodynamicsCapabilities.ELECTRODYNAMIC, @@ -192,12 +192,12 @@ public double getAmpacity() { @Override public void onEntityInside(BlockState state, Level level, BlockPos pos, Entity entity) { - if (level.isClientSide || lastTransfer.get().getJoules() <= 0 || level.getGameTime() - lastTransferTime.get() > 20) { + if (level.isClientSide || lastTransfer.get().getJoules() <= 0 || level.getGameTime() - lastTransferTime.get() > 20L) { return; } ElectricityUtils.electrecuteEntity(entity, lastTransfer.get()); lastTransfer.set(TransferPack.EMPTY); - lastTransferTime.set(0); + lastTransferTime.set(0L); } @Override diff --git a/src/main/java/electrodynamics/common/tile/pipelines/fluid/GenericTileFluidPipe.java b/src/main/java/electrodynamics/common/tile/pipelines/fluid/GenericTileFluidPipe.java index c3035d038..2d1c93391 100644 --- a/src/main/java/electrodynamics/common/tile/pipelines/fluid/GenericTileFluidPipe.java +++ b/src/main/java/electrodynamics/common/tile/pipelines/fluid/GenericTileFluidPipe.java @@ -1,36 +1,22 @@ package electrodynamics.common.tile.pipelines.fluid; -import java.util.ArrayList; -import java.util.HashSet; - import com.google.common.collect.Lists; -import com.google.common.collect.Sets; - import electrodynamics.api.network.cable.type.IFluidPipe; import electrodynamics.common.network.type.FluidNetwork; -import electrodynamics.common.network.utils.FluidUtilities; -import electrodynamics.prefab.network.AbstractNetwork; -import electrodynamics.prefab.tile.types.GenericConnectTile; -import electrodynamics.prefab.utilities.Scheduler; +import electrodynamics.prefab.tile.types.GenericRefreshingConnectTile; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; -import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.Fluids; import net.neoforged.neoforge.fluids.FluidStack; import net.neoforged.neoforge.fluids.capability.IFluidHandler; -public abstract class GenericTileFluidPipe extends GenericConnectTile implements IFluidPipe { - - public FluidNetwork fluidNetwork; +import java.util.Set; - private IFluidHandler[] handler = new IFluidHandler[6]; +public abstract class GenericTileFluidPipe extends GenericRefreshingConnectTile { - @Override - public AbstractNetwork getAbstractNetwork() { - return fluidNetwork; - } + private final IFluidHandler[] handler = new IFluidHandler[6]; @Override public @org.jetbrains.annotations.Nullable IFluidHandler getFluidHandlerCapability(@org.jetbrains.annotations.Nullable Direction side) { @@ -70,7 +56,7 @@ public int fill(FluidStack resource, FluidAction action) { if (action == FluidAction.SIMULATE || getNetwork() == null || resource.isEmpty()) { return 0; } - return fluidNetwork.emit(resource, Lists.newArrayList(level.getBlockEntity(new BlockPos(worldPosition).relative(dir))), false).getAmount(); + return getNetwork().emit(resource, Lists.newArrayList(level.getBlockEntity(new BlockPos(worldPosition).relative(dir))), false).getAmount(); } @Override @@ -86,138 +72,23 @@ public FluidStack drain(int maxDrain, FluidAction action) { } } - private HashSet getConnectedConductors() { - HashSet set = new HashSet<>(); - for (Direction dir : Direction.values()) { - BlockEntity facing = level.getBlockEntity(new BlockPos(worldPosition).relative(dir)); - if (facing instanceof IFluidPipe p) { - set.add(p); - } - } - return set; - } - - @Override - public FluidNetwork getNetwork() { - return getNetwork(true); - } - @Override - public FluidNetwork getNetwork(boolean createIfNull) { - if (fluidNetwork == null && createIfNull) { - HashSet adjacentCables = getConnectedConductors(); - HashSet connectedNets = new HashSet<>(); - for (IFluidPipe wire : adjacentCables) { - if (wire.getNetwork(false) != null && wire.getNetwork() instanceof FluidNetwork f) { - connectedNets.add(f); - } - } - if (connectedNets.isEmpty()) { - fluidNetwork = new FluidNetwork(Sets.newHashSet(this)); - } else { - if (connectedNets.size() == 1) { - fluidNetwork = (FluidNetwork) connectedNets.toArray()[0]; - } else { - fluidNetwork = new FluidNetwork(connectedNets, false); - } - fluidNetwork.conductorSet.add(this); - } - } - return fluidNetwork; + public FluidNetwork createInstance(Set fluidNetworks) { + return new FluidNetwork(fluidNetworks); } @Override - public void setNetwork(AbstractNetwork network) { - if (fluidNetwork != network && network instanceof FluidNetwork f) { - removeFromNetwork(); - fluidNetwork = f; - } + public FluidNetwork createInstanceConductor(Set genericTileFluidPipes) { + return new FluidNetwork(genericTileFluidPipes); } @Override - public void refreshNetwork() { - if (!level.isClientSide) { - updateAdjacent(); - ArrayList foundNetworks = new ArrayList<>(); - for (Direction dir : Direction.values()) { - BlockEntity facing = level.getBlockEntity(new BlockPos(worldPosition).relative(dir)); - if (facing instanceof IFluidPipe p && p.getNetwork() instanceof FluidNetwork n) { - foundNetworks.add(n); - } - } - if (!foundNetworks.isEmpty()) { - foundNetworks.get(0).conductorSet.add(this); - fluidNetwork = foundNetworks.get(0); - if (foundNetworks.size() > 1) { - foundNetworks.remove(0); - for (FluidNetwork network : foundNetworks) { - getNetwork().merge(network); - } - } - } - getNetwork().refresh(); - } - } - - @Override - public void removeFromNetwork() { - if (fluidNetwork != null) { - fluidNetwork.removeFromNetwork(this); - } - } - - private boolean[] connections = new boolean[6]; - private BlockEntity[] tileConnections = new BlockEntity[6]; - - public boolean updateAdjacent() { - boolean flag = false; - for (Direction dir : Direction.values()) { - BlockEntity tile = level.getBlockEntity(worldPosition.relative(dir)); - boolean is = FluidUtilities.isFluidReceiver(tile, dir.getOpposite()); - if (connections[dir.ordinal()] != is) { - connections[dir.ordinal()] = is; - tileConnections[dir.ordinal()] = tile; - flag = true; - } - - } - return flag; - } - - @Override - public BlockEntity[] getAdjacentConnections() { - return tileConnections; - } - - @Override - public void refreshNetworkIfChange() { - if (updateAdjacent()) { - refreshNetwork(); - } + public double getMaxTransfer() { + return getCableType().getMaxTransfer(); } @Override public void destroyViolently() { - } - - @Override - public void setRemoved() { - if (!level.isClientSide && fluidNetwork != null) { - getNetwork().split(this); - } - super.setRemoved(); - } - @Override - public void onChunkUnloaded() { - if (!level.isClientSide && fluidNetwork != null) { - getNetwork().split(this); - } - } - - @Override - public void onLoad() { - super.onLoad(); - Scheduler.schedule(1, this::refreshNetwork); } } diff --git a/src/main/java/electrodynamics/common/tile/pipelines/fluid/TileFluidPipe.java b/src/main/java/electrodynamics/common/tile/pipelines/fluid/TileFluidPipe.java index 94491abc5..6f8be4004 100644 --- a/src/main/java/electrodynamics/common/tile/pipelines/fluid/TileFluidPipe.java +++ b/src/main/java/electrodynamics/common/tile/pipelines/fluid/TileFluidPipe.java @@ -1,14 +1,12 @@ package electrodynamics.common.tile.pipelines.fluid; +import electrodynamics.api.network.cable.type.IFluidPipe; import electrodynamics.prefab.properties.PropertyTypes; -import net.minecraft.core.HolderLookup; import electrodynamics.common.block.connect.BlockFluidPipe; -import electrodynamics.common.block.subtype.SubtypeFluidPipe; import electrodynamics.prefab.properties.Property; import electrodynamics.registers.ElectrodynamicsTiles; import net.minecraft.core.BlockPos; -import net.minecraft.nbt.CompoundTag; import net.minecraft.world.level.block.state.BlockState; public class TileFluidPipe extends GenericTileFluidPipe { @@ -18,26 +16,14 @@ public TileFluidPipe(BlockPos pos, BlockState state) { super(ElectrodynamicsTiles.TILE_PIPE.get(), pos, state); } - public SubtypeFluidPipe pipe = null; + public IFluidPipe pipe = null; @Override - public SubtypeFluidPipe getPipeType() { + public IFluidPipe getCableType() { if (pipe == null) { pipe = ((BlockFluidPipe) getBlockState().getBlock()).pipe; } return pipe; } - @Override - protected void saveAdditional(CompoundTag compound, HolderLookup.Provider registries) { - compound.putInt("ord", getPipeType().ordinal()); - super.saveAdditional(compound, registries); - } - - @Override - protected void loadAdditional(CompoundTag compound, HolderLookup.Provider registries) { - super.loadAdditional(compound, registries); - pipe = SubtypeFluidPipe.values()[compound.getInt("ord")]; - } - } diff --git a/src/main/java/electrodynamics/common/tile/pipelines/gas/GenericTileGasPipe.java b/src/main/java/electrodynamics/common/tile/pipelines/gas/GenericTileGasPipe.java index fba559461..8824c3d79 100644 --- a/src/main/java/electrodynamics/common/tile/pipelines/gas/GenericTileGasPipe.java +++ b/src/main/java/electrodynamics/common/tile/pipelines/gas/GenericTileGasPipe.java @@ -1,244 +1,124 @@ package electrodynamics.common.tile.pipelines.gas; -import java.util.ArrayList; -import java.util.HashSet; - +import electrodynamics.api.network.cable.type.IGasPipe; +import electrodynamics.common.block.subtype.SubtypeGasPipe; +import electrodynamics.common.network.type.GasNetwork; +import electrodynamics.prefab.tile.types.GenericRefreshingConnectTile; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; import org.jetbrains.annotations.Nullable; import com.google.common.collect.Lists; -import com.google.common.collect.Sets; import electrodynamics.api.capability.types.gas.IGasHandler; import electrodynamics.api.gas.GasAction; import electrodynamics.api.gas.GasStack; -import electrodynamics.api.network.cable.type.IFluidPipe; -import electrodynamics.api.network.cable.type.IGasPipe; -import electrodynamics.common.network.type.GasNetwork; -import electrodynamics.common.network.utils.GasUtilities; -import electrodynamics.prefab.network.AbstractNetwork; -import electrodynamics.prefab.tile.types.GenericConnectTile; -import electrodynamics.prefab.utilities.Scheduler; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; -import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; -public abstract class GenericTileGasPipe extends GenericConnectTile implements IGasPipe { - - public GasNetwork gasNetwork; - private final IGasHandler[] capability = new IGasHandler[6]; - private boolean[] connections = new boolean[6]; - private BlockEntity[] tileConnections = new BlockEntity[6]; - - public GenericTileGasPipe(BlockEntityType tileEntityTypeIn, BlockPos worldPos, BlockState blockState) { - super(tileEntityTypeIn, worldPos, blockState); - for (Direction dir : Direction.values()) { - capability[dir.ordinal()] = new IGasHandler() { - - @Override - public boolean isGasValid(int tank, GasStack gas) { - return gas != null; - } - - @Override - public int heat(int tank, int deltaTemperature, GasAction action) { - return -1; - } - - @Override - public int getTanks() { - return 1; - } - - @Override - public int getTankMaxTemperature(int tank) { - return -1; - } - - @Override - public int getTankMaxPressure(int tank) { - return getNetwork() == null ? 0 : getNetwork().maxPressure; - } - - @Override - public int getTankCapacity(int tank) { - return 0; - } - - @Override - public GasStack getGasInTank(int tank) { - return GasStack.EMPTY; - } - - @Override - public int fill(GasStack gas, GasAction action) { - if (action == GasAction.SIMULATE || getNetwork() == null || gas.isEmpty()) { - return 0; - } - return gasNetwork.emit(gas, Lists.newArrayList(level.getBlockEntity(worldPos.relative(dir))), action == GasAction.SIMULATE).getAmount(); - } - - @Override - public GasStack drain(int maxFill, GasAction action) { - return GasStack.EMPTY; - } - - @Override - public GasStack drain(GasStack gas, GasAction action) { - return GasStack.EMPTY; - } - - @Override - public int bringPressureTo(int tank, int atm, GasAction action) { - return -1; - } - }; - } - } - - @Override - public GasNetwork getNetwork() { - return getNetwork(true); - } - - @Override - public @Nullable IGasHandler getGasHandlerCapability(@Nullable Direction side) { - if(side == null) { - return null; - } - return capability[side.ordinal()]; - } - - @Override - public GasNetwork getNetwork(boolean createIfNull) { - if (gasNetwork == null && createIfNull) { - HashSet adjacentPipes = getConnectedPipes(); - HashSet connectedNets = new HashSet<>(); - for (IGasPipe wire : adjacentPipes) { - if (wire.getNetwork(false) != null && wire.getNetwork() instanceof GasNetwork net) { - connectedNets.add(net); - } - } - if (connectedNets.isEmpty()) { - gasNetwork = new GasNetwork(Sets.newHashSet(this)); - } else { - if (connectedNets.size() == 1) { - gasNetwork = (GasNetwork) connectedNets.toArray()[0]; - } else { - gasNetwork = new GasNetwork(connectedNets, false); - } - gasNetwork.conductorSet.add(this); - } - } - return gasNetwork; - } - - private HashSet getConnectedPipes() { - HashSet set = new HashSet<>(); - for (Direction dir : Direction.values()) { - BlockEntity facing = level.getBlockEntity(new BlockPos(worldPosition).relative(dir)); - if (facing instanceof IGasPipe p) { - set.add(p); - } - } - return set; - } - - @Override - public void refreshNetwork() { - if (level.isClientSide) { - return; - } - updateAdjacent(); - ArrayList foundNetworks = new ArrayList<>(); - for (Direction dir : Direction.values()) { - BlockEntity facing = level.getBlockEntity(new BlockPos(worldPosition).relative(dir)); - if (facing instanceof IFluidPipe p && p.getNetwork() instanceof GasNetwork n) { - foundNetworks.add(n); - } - } - if (!foundNetworks.isEmpty()) { - foundNetworks.get(0).conductorSet.add(this); - gasNetwork = foundNetworks.get(0); - if (foundNetworks.size() > 1) { - foundNetworks.remove(0); - for (GasNetwork network : foundNetworks) { - getNetwork().merge(network); - } - } - } - getNetwork().refresh(); - } - - @Override - public void refreshNetworkIfChange() { - if (updateAdjacent()) { - refreshNetwork(); - } - } - - public boolean updateAdjacent() { - boolean flag = false; - for (Direction dir : Direction.values()) { - BlockEntity tile = level.getBlockEntity(worldPosition.relative(dir)); - boolean is = GasUtilities.isGasReciever(tile, dir.getOpposite()); - if (connections[dir.ordinal()] != is) { - connections[dir.ordinal()] = is; - tileConnections[dir.ordinal()] = tile; - flag = true; - } - - } - return flag; - } - - @Override - public void removeFromNetwork() { - if (gasNetwork != null) { - gasNetwork.removeFromNetwork(this); - } - - } - - @Override - public void setNetwork(AbstractNetwork network) { - if (gasNetwork != network && network instanceof GasNetwork g) { - removeFromNetwork(); - gasNetwork = g; - } - } - - @Override - public AbstractNetwork getAbstractNetwork() { - return gasNetwork; - } - - @Override - public BlockEntity[] getAdjacentConnections() { - return tileConnections; - } - - @Override - public void setRemoved() { - if (!level.isClientSide && gasNetwork != null) { - gasNetwork.split(this); - } - super.setRemoved(); - } - - @Override - public void onChunkUnloaded() { - super.onChunkUnloaded(); - if (!level.isClientSide && gasNetwork != null) { - gasNetwork.split(this); - } - } - - @Override - public void onLoad() { - super.onLoad(); - Scheduler.schedule(1, this::refreshNetwork); - } - +import java.util.Set; + +public abstract class GenericTileGasPipe extends GenericRefreshingConnectTile { + private final IGasHandler[] capability = new IGasHandler[6]; + + public GenericTileGasPipe(BlockEntityType tileEntityTypeIn, BlockPos worldPos, BlockState blockState) { + super(tileEntityTypeIn, worldPos, blockState); + for (Direction dir : Direction.values()) { + capability[dir.ordinal()] = new IGasHandler() { + + @Override + public boolean isGasValid(int tank, GasStack gas) { + return gas != null; + } + + @Override + public int heat(int tank, int deltaTemperature, GasAction action) { + return -1; + } + + @Override + public int getTanks() { + return 1; + } + + @Override + public int getTankMaxTemperature(int tank) { + return -1; + } + + @Override + public int getTankMaxPressure(int tank) { + return getNetwork() == null ? 0 : getNetwork().maxPressure; + } + + @Override + public int getTankCapacity(int tank) { + return 0; + } + + @Override + public GasStack getGasInTank(int tank) { + return GasStack.EMPTY; + } + + @Override + public int fill(GasStack gas, GasAction action) { + if (action == GasAction.SIMULATE || getNetwork() == null || gas.isEmpty()) { + return 0; + } + return getNetwork().emit(gas, Lists.newArrayList(level.getBlockEntity(worldPos.relative(dir))), action == GasAction.SIMULATE).getAmount(); + } + + @Override + public GasStack drain(int maxFill, GasAction action) { + return GasStack.EMPTY; + } + + @Override + public GasStack drain(GasStack gas, GasAction action) { + return GasStack.EMPTY; + } + + @Override + public int bringPressureTo(int tank, int atm, GasAction action) { + return -1; + } + }; + } + } + + @Override + public @Nullable IGasHandler getGasHandlerCapability(@Nullable Direction side) { + if (side == null) { + return null; + } + return capability[side.ordinal()]; + + } + + @Override + public double getMaxTransfer() { + return getCableType().getMaxTransfer(); + } + + @Override + public GasNetwork createInstance(Set gasNetworks) { + return new GasNetwork(gasNetworks); + } + + @Override + public GasNetwork createInstanceConductor(Set genericTileGasPipes) { + return new GasNetwork(genericTileGasPipes); + } + + @Override + public void destroyViolently() { + if (level.isClientSide) { + return; + } + level.playSound(null, getBlockPos(), SoundEvents.GENERIC_EXPLODE.value(), SoundSource.BLOCKS, 1.0F, 1.0F); + level.destroyBlock(getBlockPos(), false); + } } diff --git a/src/main/java/electrodynamics/common/tile/pipelines/gas/TileGasPipe.java b/src/main/java/electrodynamics/common/tile/pipelines/gas/TileGasPipe.java index b481ebd69..27a4321c1 100644 --- a/src/main/java/electrodynamics/common/tile/pipelines/gas/TileGasPipe.java +++ b/src/main/java/electrodynamics/common/tile/pipelines/gas/TileGasPipe.java @@ -1,51 +1,26 @@ package electrodynamics.common.tile.pipelines.gas; -import net.minecraft.core.HolderLookup; +import electrodynamics.api.network.cable.type.IGasPipe; import electrodynamics.common.block.connect.BlockGasPipe; -import electrodynamics.common.block.subtype.SubtypeGasPipe; import electrodynamics.registers.ElectrodynamicsTiles; import net.minecraft.core.BlockPos; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.sounds.SoundEvents; -import net.minecraft.sounds.SoundSource; import net.minecraft.world.level.block.state.BlockState; public class TileGasPipe extends GenericTileGasPipe { - public SubtypeGasPipe pipe = null; + public IGasPipe pipe = null; public TileGasPipe(BlockPos worldPos, BlockState blockState) { super(ElectrodynamicsTiles.TILE_GAS_PIPE.get(), worldPos, blockState); } @Override - public SubtypeGasPipe getPipeType() { + public IGasPipe getCableType() { if (pipe == null) { pipe = ((BlockGasPipe) getBlockState().getBlock()).pipe; } return pipe; } - @Override - public void destroyViolently() { - if (level.isClientSide) { - return; - } - level.playSound(null, getBlockPos(), SoundEvents.GENERIC_EXPLODE.value(), SoundSource.BLOCKS, 1.0F, 1.0F); - level.destroyBlock(getBlockPos(), false); - } - - @Override - protected void saveAdditional(CompoundTag compound, HolderLookup.Provider registries) { - super.saveAdditional(compound, registries); - compound.putInt("ord", getPipeType().ordinal()); - } - - @Override - protected void loadAdditional(CompoundTag compound, HolderLookup.Provider registries) { - super.loadAdditional(compound, registries); - pipe = SubtypeGasPipe.values()[compound.getInt("ord")]; - } - } diff --git a/src/main/java/electrodynamics/common/tile/pipelines/gas/gastransformer/thermoelectricmanipulator/GenericTileThermoelectricManipulator.java b/src/main/java/electrodynamics/common/tile/pipelines/gas/gastransformer/thermoelectricmanipulator/GenericTileThermoelectricManipulator.java index f9e95db86..3e4ca7d1c 100644 --- a/src/main/java/electrodynamics/common/tile/pipelines/gas/gastransformer/thermoelectricmanipulator/GenericTileThermoelectricManipulator.java +++ b/src/main/java/electrodynamics/common/tile/pipelines/gas/gastransformer/thermoelectricmanipulator/GenericTileThermoelectricManipulator.java @@ -18,6 +18,7 @@ import electrodynamics.registers.ElectrodynamicsGases; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.Fluid; @@ -68,14 +69,13 @@ public boolean canProcess(ComponentProcessor processor) { if (result.canProcess()) { isFluid = false; - changeState = result.changeState(); } else { result = checkFluidConditions(processor); isFluid = result.canProcess(); - changeState = result.changeState(); } + changeState = result.changeState(); boolean isHeating = result.status() == ElectrodynamicsBlockStates.ManipulatorHeatingStatus.HEAT && result.canProcess(); @@ -121,12 +121,12 @@ private ManipulatorStatusCheckWrapper checkGasConditions(ComponentProcessor proc return new ManipulatorStatusCheckWrapper(false, ElectrodynamicsBlockStates.ManipulatorHeatingStatus.OFF, false); } - Fluid condensedFluid = inputTank.getGas().getGas().getCondensedFluid(); - - if (condensedFluid == null) { + if (inputTank.getGas().getGas().noCondensedFluid()) { return new ManipulatorStatusCheckWrapper(false, ElectrodynamicsBlockStates.ManipulatorHeatingStatus.OFF, false); } + Fluid condensedFluid = inputTank.getGas().getGas().getCondensedFluid(); + if (!outputTank.isEmpty() && !outputTank.getFluid().getFluid().isSame(condensedFluid)) { return new ManipulatorStatusCheckWrapper(false, ElectrodynamicsBlockStates.ManipulatorHeatingStatus.OFF, false); } @@ -195,7 +195,7 @@ private ManipulatorStatusCheckWrapper checkFluidConditions(ComponentProcessor pr return new ManipulatorStatusCheckWrapper(false, ElectrodynamicsBlockStates.ManipulatorHeatingStatus.OFF, false); } - evaporatedGas = ElectrodynamicsGases.MAPPED_GASSES.getOrDefault(inputTank.getFluid().getFluid(), ElectrodynamicsGases.EMPTY.value()); + evaporatedGas = ElectrodynamicsGases.MAPPED_GASSES.getOrDefault(BuiltInRegistries.FLUID.wrapAsHolder(inputTank.getFluid().getFluid()), ElectrodynamicsGases.EMPTY.value()); if (evaporatedGas.isEmpty()) { return new ManipulatorStatusCheckWrapper(false, ElectrodynamicsBlockStates.ManipulatorHeatingStatus.OFF, false); @@ -249,7 +249,7 @@ public void process(ComponentProcessor processor) { evaporatedPotential.heat(-deltaT); - inputTank.drain((int) Math.ceil(evaporatedPotential.getAmount()), IFluidHandler.FluidAction.EXECUTE); + inputTank.drain(evaporatedPotential.getAmount(), IFluidHandler.FluidAction.EXECUTE); // gas to fluid } else if (changeState) { @@ -273,7 +273,7 @@ public void process(ComponentProcessor processor) { condensedPotential.heat(deltaT); - int fluidAmount = (int) Math.floor(Math.min(conversionRate, condensedPotential.getAmount())); + int fluidAmount = Math.min(conversionRate, condensedPotential.getAmount()); if (fluidAmount == 0) { return; diff --git a/src/main/java/electrodynamics/compatibility/jei/recipecategories/fluid2fluid/specificmachines/ElectrolosisChamberRecipeCategory.java b/src/main/java/electrodynamics/compatibility/jei/recipecategories/fluid2fluid/specificmachines/ElectrolosisChamberRecipeCategory.java index 7f3126005..2eaea5651 100644 --- a/src/main/java/electrodynamics/compatibility/jei/recipecategories/fluid2fluid/specificmachines/ElectrolosisChamberRecipeCategory.java +++ b/src/main/java/electrodynamics/compatibility/jei/recipecategories/fluid2fluid/specificmachines/ElectrolosisChamberRecipeCategory.java @@ -28,8 +28,8 @@ public class ElectrolosisChamberRecipeCategory extends Fluid2FluidRecipeCategory public static final ArrowAnimatedObject ANIM_RIGHT_ARROW = new ArrowAnimatedObject(ScreenComponentProgress.ProgressBars.PROGRESS_ARROW_RIGHT_BIG, 34, 17, IDrawableAnimated.StartDirection.LEFT); - public static final FluidGaugeObject IN_GAUGE = new FluidGaugeObject(10, 5, 1); - public static final FluidGaugeObject OUT_GAUGE = new FluidGaugeObject(108, 5, 1); + public static final FluidGaugeObject IN_GAUGE = new FluidGaugeObject(10, 5); + public static final FluidGaugeObject OUT_GAUGE = new FluidGaugeObject(108, 5); public static final PowerLabelWrapperConstant POWER_LABEL = new PowerLabelWrapperConstant(2, 55, Constants.ELECTROLOSIS_CHAMBER_TARGET_JOULES, 1920); diff --git a/src/main/java/electrodynamics/compatibility/jei/recipecategories/fluid2gas/specificmachines/ElectrolyticSeparatorRecipeCategory.java b/src/main/java/electrodynamics/compatibility/jei/recipecategories/fluid2gas/specificmachines/ElectrolyticSeparatorRecipeCategory.java index bb31d3438..858baa2a7 100644 --- a/src/main/java/electrodynamics/compatibility/jei/recipecategories/fluid2gas/specificmachines/ElectrolyticSeparatorRecipeCategory.java +++ b/src/main/java/electrodynamics/compatibility/jei/recipecategories/fluid2gas/specificmachines/ElectrolyticSeparatorRecipeCategory.java @@ -33,9 +33,9 @@ public class ElectrolyticSeparatorRecipeCategory extends Fluid2GasRecipeCategory public static final ArrowAnimatedObject ANIM_RIGHT_ARROW_1 = new ArrowAnimatedObject(ProgressBars.PROGRESS_ARROW_RIGHT, 24, 17, StartDirection.LEFT); public static final ArrowAnimatedObject ANIM_RIGHT_ARROW_2 = new ArrowAnimatedObject(ProgressBars.PROGRESS_ARROW_RIGHT, 64, 17, StartDirection.LEFT); - public static final FluidGaugeObject IN_GAUGE = new FluidGaugeObject(8, 5, 5000); - public static final GasGaugeObject OUT_GAUGE = new GasGaugeObject(48, 5, 5000); - public static final GasGaugeObject BIPRODUCT_GAUGE = new GasGaugeObject(88, 5, 5000); + public static final FluidGaugeObject IN_GAUGE = new FluidGaugeObject(8, 5); + public static final GasGaugeObject OUT_GAUGE = new GasGaugeObject(48, 5); + public static final GasGaugeObject BIPRODUCT_GAUGE = new GasGaugeObject(88, 5); public static final PowerLabelWrapperElectroRecipe POWER_LABEL = new PowerLabelWrapperElectroRecipe(2, 55, 240); public static final TimeLabelWrapperElectroRecipe TIME_LABEL = new TimeLabelWrapperElectroRecipe(130, 55); diff --git a/src/main/java/electrodynamics/compatibility/jei/recipecategories/fluid2item/specificmachines/ChemicalCrystallizerRecipeCategory.java b/src/main/java/electrodynamics/compatibility/jei/recipecategories/fluid2item/specificmachines/ChemicalCrystallizerRecipeCategory.java index b8a597497..ff20412e0 100644 --- a/src/main/java/electrodynamics/compatibility/jei/recipecategories/fluid2item/specificmachines/ChemicalCrystallizerRecipeCategory.java +++ b/src/main/java/electrodynamics/compatibility/jei/recipecategories/fluid2item/specificmachines/ChemicalCrystallizerRecipeCategory.java @@ -31,7 +31,7 @@ public class ChemicalCrystallizerRecipeCategory extends Fluid2ItemRecipeCategory public static final ArrowAnimatedObject ANIM_RIGHT_ARROW = new ArrowAnimatedObject(ProgressBars.PROGRESS_ARROW_RIGHT_BIG, 32, 17, StartDirection.LEFT); - public static final FluidGaugeObject IN_GAUGE = new FluidGaugeObject(14, 5, 5000); + public static final FluidGaugeObject IN_GAUGE = new FluidGaugeObject(14, 5); public static final PowerLabelWrapperElectroRecipe POWER_LABEL = new PowerLabelWrapperElectroRecipe(2, 55, 240); public static final TimeLabelWrapperElectroRecipe TIME_LABEL = new TimeLabelWrapperElectroRecipe(130, 55); diff --git a/src/main/java/electrodynamics/compatibility/jei/recipecategories/fluiditem2fluid/specificmachines/ChemicalMixerRecipeCategory.java b/src/main/java/electrodynamics/compatibility/jei/recipecategories/fluiditem2fluid/specificmachines/ChemicalMixerRecipeCategory.java index d924bfee8..26a64b7a1 100644 --- a/src/main/java/electrodynamics/compatibility/jei/recipecategories/fluiditem2fluid/specificmachines/ChemicalMixerRecipeCategory.java +++ b/src/main/java/electrodynamics/compatibility/jei/recipecategories/fluiditem2fluid/specificmachines/ChemicalMixerRecipeCategory.java @@ -32,8 +32,8 @@ public class ChemicalMixerRecipeCategory extends FluidItem2FluidRecipeCategory> inputs, IRecipeLayoutBuilder b AbstractFluidGaugeObject wrapper; RecipeIngredientRole role = RecipeIngredientRole.INPUT; FluidStack stack; + + int maxGaugeCap = 0; + + for (List stacks : inputs) { + + if(stacks.isEmpty()) { + continue; + } + + stack = stacks.get(0); + int gaugeCap = (int) Math.pow(10, MathUtils.nearestPowerOf10(stack.getAmount(), true)); + if (gaugeCap > maxGaugeCap) { + maxGaugeCap = gaugeCap; + } + } + for (int i = 0; i < fluidInputWrappers.length; i++) { wrapper = fluidInputWrappers[i]; @@ -243,15 +258,9 @@ public void setFluidInputs(List> inputs, IRecipeLayoutBuilder b int amt = stack.getAmount(); - int gaugeCap = wrapper.getAmount(); - - if (amt > gaugeCap) { - - gaugeCap = (amt / IComponentFluidHandler.TANK_MULTIPLER) * IComponentFluidHandler.TANK_MULTIPLER + IComponentFluidHandler.TANK_MULTIPLER; + //int gaugeCap = (int) Math.pow(10, MathUtils.nearestPowerOf10(amt, true)); - } - - int height = (int) Math.ceil((float) amt / (float) gaugeCap * wrapper.getFluidTextHeight()); + int height = (int) Math.ceil((float) amt / (float) maxGaugeCap * wrapper.getFluidTextHeight()); builder.addSlot(role, wrapper.getFluidXPos(), wrapper.getFluidYPos() - height).setFluidRenderer(stack.getAmount(), false, wrapper.getFluidTextWidth(), height).addIngredients(NeoForgeTypes.FLUID_STACK, inputs.get(i)); } @@ -261,6 +270,16 @@ public void setFluidOutputs(List outputs, IRecipeLayoutBuilder build AbstractFluidGaugeObject wrapper; RecipeIngredientRole role = RecipeIngredientRole.OUTPUT; FluidStack stack; + + int maxGaugeCap = 0; + + for (FluidStack s : outputs) { + int gaugeCap = (int) Math.pow(10, MathUtils.nearestPowerOf10(s.getAmount(), true)); + if (gaugeCap > maxGaugeCap) { + maxGaugeCap = gaugeCap; + } + } + for (int i = 0; i < fluidOutputWrappers.length; i++) { wrapper = fluidOutputWrappers[i]; stack = outputs.get(i); @@ -271,15 +290,9 @@ public void setFluidOutputs(List outputs, IRecipeLayoutBuilder build int amt = stack.getAmount(); - int gaugeCap = wrapper.getAmount(); - - if (amt > gaugeCap) { - - gaugeCap = (amt / IComponentFluidHandler.TANK_MULTIPLER) * IComponentFluidHandler.TANK_MULTIPLER + IComponentFluidHandler.TANK_MULTIPLER; + //int gaugeCap = (int) Math.pow(10, MathUtils.nearestPowerOf10(amt, true)); - } - - int height = (int) Math.ceil((float) amt / (float) gaugeCap * wrapper.getFluidTextHeight()); + int height = (int) Math.ceil((float) amt / (float) maxGaugeCap * wrapper.getFluidTextHeight()); builder.addSlot(role, wrapper.getFluidXPos(), wrapper.getFluidYPos() - height).setFluidRenderer(stack.getAmount(), false, wrapper.getFluidTextWidth(), height).addIngredient(NeoForgeTypes.FLUID_STACK, stack); } } @@ -289,6 +302,22 @@ public void setGasInputs(List> inputs, IRecipeLayoutBuilder build AbstractGasGaugeObject wrapper; RecipeIngredientRole role = RecipeIngredientRole.INPUT; List stacks; + + int maxGaugeCap = 0; + + for (List stackz : inputs) { + + if(stackz.isEmpty()) { + continue; + } + + GasStack stack = stackz.get(0); + int gaugeCap = (int) Math.pow(10, MathUtils.nearestPowerOf10(stack.getAmount(), true)); + if (gaugeCap > maxGaugeCap) { + maxGaugeCap = gaugeCap; + } + } + for (int i = 0; i < gasInputWrappers.length; i++) { wrapper = gasInputWrappers[i]; @@ -300,30 +329,13 @@ public void setGasInputs(List> inputs, IRecipeLayoutBuilder build double amt = stacks.get(0).getAmount(); - double gaugeCap = wrapper.getAmount(); - - if (amt < gaugeCap / 50) { - double amtPowTen = Math.pow(10, Math.round(Math.log10(amt) - Math.log10(5.5) + 0.5)); - if (amtPowTen == 0) { - amtPowTen = 1; - } - double gaugePowTen = Math.log10(Math.pow(10, Math.round(Math.log10(gaugeCap) - Math.log10(5.5) + 0.5))); - double logAmtPowTen = Math.log10(amtPowTen); - - double delta = gaugePowTen - logAmtPowTen; - - amt *= Math.pow(10, delta); - } - - if (amt > gaugeCap) { - gaugeCap = (((int) Math.ceil(amt)) * IComponentGasHandler.TANK_MULTIPLIER) * IComponentGasHandler.TANK_MULTIPLIER + IComponentGasHandler.TANK_MULTIPLIER; - } + //double gaugeCap = Math.pow(10, MathUtils.nearestPowerOf10(amt, true)); - int height = (int) (Math.ceil(amt / gaugeCap * (wrapper.getHeight() - 2))); + int height = (int) (Math.ceil(amt / maxGaugeCap * (wrapper.getHeight() - 2))); int oneMinusHeight = wrapper.getHeight() - height; - builder.addSlot(role, wrapper.getX() + 1, wrapper.getY() + wrapper.getHeight() - height).addIngredients(ElectrodynamicsJeiTypes.GAS_STACK, stacks).setCustomRenderer(ElectrodynamicsJeiTypes.GAS_STACK, new IngredientRendererGasStack((int) gaugeCap, -oneMinusHeight + 1, height, wrapper.getBarsTexture())); + builder.addSlot(role, wrapper.getX() + 1, wrapper.getY() + wrapper.getHeight() - height).addIngredients(ElectrodynamicsJeiTypes.GAS_STACK, stacks).setCustomRenderer(ElectrodynamicsJeiTypes.GAS_STACK, new IngredientRendererGasStack((int) maxGaugeCap, -oneMinusHeight + 1, height, wrapper.getBarsTexture())); } } @@ -333,6 +345,16 @@ public void setGasOutputs(List outputs, IRecipeLayoutBuilder builder) AbstractGasGaugeObject wrapper; RecipeIngredientRole role = RecipeIngredientRole.OUTPUT; GasStack stack; + + int maxGaugeCap = 0; + + for (GasStack s : outputs) { + int gaugeCap = (int) Math.pow(10, MathUtils.nearestPowerOf10(s.getAmount(), true)); + if (gaugeCap > maxGaugeCap) { + maxGaugeCap = gaugeCap; + } + } + for (int i = 0; i < gasOutputWrappers.length; i++) { wrapper = gasOutputWrappers[i]; @@ -344,30 +366,13 @@ public void setGasOutputs(List outputs, IRecipeLayoutBuilder builder) double amt = stack.getAmount(); - double gaugeCap = wrapper.getAmount(); - - if (amt < gaugeCap / 50) { - double amtPowTen = Math.pow(10, Math.round(Math.log10(amt) - Math.log10(5.5) + 0.5)); - if (amtPowTen == 0) { - amtPowTen = 1; - } - double gaugePowTen = Math.log10(Math.pow(10, Math.round(Math.log10(gaugeCap) - Math.log10(5.5) + 0.5))); - double logAmtPowTen = Math.log10(amtPowTen); - - double delta = gaugePowTen - logAmtPowTen; - - amt *= Math.pow(10, delta); - } - - if (amt > gaugeCap) { - gaugeCap = (((int) Math.ceil(amt)) * IComponentGasHandler.TANK_MULTIPLIER) * IComponentGasHandler.TANK_MULTIPLIER + IComponentGasHandler.TANK_MULTIPLIER; - } + //double gaugeCap = Math.pow(10, MathUtils.nearestPowerOf10(amt, true)); - int height = (int) (Math.ceil(amt / gaugeCap * (wrapper.getHeight() - 2))); + int height = (int) (Math.ceil(amt / maxGaugeCap * (wrapper.getHeight() - 2))); int oneMinusHeight = wrapper.getHeight() - height; - builder.addSlot(role, wrapper.getX() + 1, wrapper.getY() + wrapper.getHeight() - height).addIngredient(ElectrodynamicsJeiTypes.GAS_STACK, stack).setCustomRenderer(ElectrodynamicsJeiTypes.GAS_STACK, new IngredientRendererGasStack((int) gaugeCap, -oneMinusHeight + 1, height, wrapper.getBarsTexture())); + builder.addSlot(role, wrapper.getX() + 1, wrapper.getY() + wrapper.getHeight() - height).addIngredient(ElectrodynamicsJeiTypes.GAS_STACK, stack).setCustomRenderer(ElectrodynamicsJeiTypes.GAS_STACK, new IngredientRendererGasStack((int) maxGaugeCap, -oneMinusHeight + 1, height, wrapper.getBarsTexture())); } } } diff --git a/src/main/java/electrodynamics/compatibility/jei/recipecategories/misc/GasCollectorRecipeCategory.java b/src/main/java/electrodynamics/compatibility/jei/recipecategories/misc/GasCollectorRecipeCategory.java index b8cb84b73..77b70f1bb 100644 --- a/src/main/java/electrodynamics/compatibility/jei/recipecategories/misc/GasCollectorRecipeCategory.java +++ b/src/main/java/electrodynamics/compatibility/jei/recipecategories/misc/GasCollectorRecipeCategory.java @@ -32,7 +32,7 @@ public class GasCollectorRecipeCategory extends AbstractRecipeCategory> inputs, IRecipeLayoutBuilder b AbstractFluidGaugeObject wrapper; RecipeIngredientRole role = RecipeIngredientRole.INPUT; FluidStack stack; + + int maxGaugeCap = 0; + + for (List stacks : inputs) { + stack = stacks.get(0); + int gaugeCap = (int) Math.pow(10, MathUtils.nearestPowerOf10(stack.getAmount(), true)); + if (gaugeCap > maxGaugeCap) { + maxGaugeCap = gaugeCap; + } + } + + for (int i = 0; i < fluidInputWrappers.length; i++) { wrapper = fluidInputWrappers[i]; stack = inputs.get(i).get(0); int amt = stack.getAmount(); - int gaugeCap = wrapper.getAmount(); + //int gaugeCap = (int) Math.pow(10, MathUtils.nearestPowerOf10(amt, true)); - if (amt > gaugeCap) { - - gaugeCap = (amt / IComponentFluidHandler.TANK_MULTIPLER) * IComponentFluidHandler.TANK_MULTIPLER + IComponentFluidHandler.TANK_MULTIPLER; - - } - - int height = (int) Math.ceil((float) amt / (float) gaugeCap * wrapper.getFluidTextHeight()); + int height = (int) Math.ceil((float) amt / (float) maxGaugeCap * wrapper.getFluidTextHeight()); builder.addSlot(role, wrapper.getFluidXPos(), wrapper.getFluidYPos() - height).setFluidRenderer(stack.getAmount(), false, wrapper.getFluidTextWidth(), height).addIngredients(NeoForgeTypes.FLUID_STACK, inputs.get(i)); } @@ -272,21 +277,25 @@ public void setFluidOutputs(List outputs, IRecipeLayoutBuilder build AbstractFluidGaugeObject wrapper; RecipeIngredientRole role = RecipeIngredientRole.OUTPUT; FluidStack stack; + + int maxGaugeCap = 0; + + for (FluidStack s : outputs) { + int gaugeCap = (int) Math.pow(10, MathUtils.nearestPowerOf10(s.getAmount(), true)); + if (gaugeCap > maxGaugeCap) { + maxGaugeCap = gaugeCap; + } + } + for (int i = 0; i < fluidOutputWrappers.length; i++) { wrapper = fluidOutputWrappers[i]; stack = outputs.get(i); int amt = stack.getAmount(); - int gaugeCap = wrapper.getAmount(); - - if (amt > gaugeCap) { + //int gaugeCap = (int) Math.pow(10, MathUtils.nearestPowerOf10(amt, true)); - gaugeCap = (amt / IComponentFluidHandler.TANK_MULTIPLER) * IComponentFluidHandler.TANK_MULTIPLER + IComponentFluidHandler.TANK_MULTIPLER; - - } - - int height = (int) Math.ceil((float) amt / (float) gaugeCap * wrapper.getFluidTextHeight()); + int height = (int) Math.ceil((float) amt / (float) maxGaugeCap * wrapper.getFluidTextHeight()); builder.addSlot(role, wrapper.getFluidXPos(), wrapper.getFluidYPos() - height).setFluidRenderer(stack.getAmount(), false, wrapper.getFluidTextWidth(), height).addIngredient(NeoForgeTypes.FLUID_STACK, stack); } } @@ -296,6 +305,17 @@ public void setGasInputs(List> inputs, IRecipeLayoutBuilder build AbstractGasGaugeObject wrapper; RecipeIngredientRole role = RecipeIngredientRole.INPUT; List stacks; + + int maxGaugeCap = 0; + + for (List stackz : inputs) { + GasStack stack = stackz.get(0); + int gaugeCap = (int) Math.pow(10, MathUtils.nearestPowerOf10(stack.getAmount(), true)); + if (gaugeCap > maxGaugeCap) { + maxGaugeCap = gaugeCap; + } + } + for (int i = 0; i < gasInputWrappers.length; i++) { wrapper = gasInputWrappers[i]; @@ -303,30 +323,13 @@ public void setGasInputs(List> inputs, IRecipeLayoutBuilder build double amt = stacks.get(0).getAmount(); - double gaugeCap = wrapper.getAmount(); - - if (amt < gaugeCap / 50) { - double amtPowTen = Math.pow(10, Math.round(Math.log10(amt) - Math.log10(5.5) + 0.5)); - if (amtPowTen == 0) { - amtPowTen = 1; - } - double gaugePowTen = Math.log10(Math.pow(10, Math.round(Math.log10(gaugeCap) - Math.log10(5.5) + 0.5))); - double logAmtPowTen = Math.log10(amtPowTen); - - double delta = gaugePowTen - logAmtPowTen; + //double gaugeCap = Math.pow(10, MathUtils.nearestPowerOf10(amt, true)); - amt *= Math.pow(10, delta); - } - - if (amt > gaugeCap) { - gaugeCap = (((int) Math.ceil(amt)) * IComponentGasHandler.TANK_MULTIPLIER) * IComponentGasHandler.TANK_MULTIPLIER + IComponentGasHandler.TANK_MULTIPLIER; - } - - int height = (int) (Math.ceil(amt / gaugeCap * (wrapper.getHeight() - 2))); + int height = (int) (Math.ceil(amt / maxGaugeCap * (wrapper.getHeight() - 2))); int oneMinusHeight = wrapper.getHeight() - height; - builder.addSlot(role, wrapper.getX() + 1, wrapper.getY() + wrapper.getHeight() - height).addIngredients(ElectrodynamicsJeiTypes.GAS_STACK, stacks).setCustomRenderer(ElectrodynamicsJeiTypes.GAS_STACK, new IngredientRendererGasStack((int) gaugeCap, -oneMinusHeight + 1, height, wrapper.getBarsTexture())); + builder.addSlot(role, wrapper.getX() + 1, wrapper.getY() + wrapper.getHeight() - height).addIngredients(ElectrodynamicsJeiTypes.GAS_STACK, stacks).setCustomRenderer(ElectrodynamicsJeiTypes.GAS_STACK, new IngredientRendererGasStack((int) maxGaugeCap, -oneMinusHeight + 1, height, wrapper.getBarsTexture())); } } @@ -336,6 +339,16 @@ public void setGasOutputs(List outputs, IRecipeLayoutBuilder builder) AbstractGasGaugeObject wrapper; RecipeIngredientRole role = RecipeIngredientRole.OUTPUT; GasStack stack; + + int maxGaugeCap = 0; + + for (GasStack s : outputs) { + int gaugeCap = (int) Math.pow(10, MathUtils.nearestPowerOf10(s.getAmount(), true)); + if (gaugeCap > maxGaugeCap) { + maxGaugeCap = gaugeCap; + } + } + for (int i = 0; i < gasOutputWrappers.length; i++) { wrapper = gasOutputWrappers[i]; @@ -343,30 +356,13 @@ public void setGasOutputs(List outputs, IRecipeLayoutBuilder builder) double amt = stack.getAmount(); - double gaugeCap = wrapper.getAmount(); - - if (amt < gaugeCap / 50) { - double amtPowTen = Math.pow(10, Math.round(Math.log10(amt) - Math.log10(5.5) + 0.5)); - if (amtPowTen == 0) { - amtPowTen = 1; - } - double gaugePowTen = Math.log10(Math.pow(10, Math.round(Math.log10(gaugeCap) - Math.log10(5.5) + 0.5))); - double logAmtPowTen = Math.log10(amtPowTen); - - double delta = gaugePowTen - logAmtPowTen; - - amt *= Math.pow(10, delta); - } - - if (amt > gaugeCap) { - gaugeCap = (((int) Math.ceil(amt)) * IComponentGasHandler.TANK_MULTIPLIER) * IComponentGasHandler.TANK_MULTIPLIER + IComponentGasHandler.TANK_MULTIPLIER; - } + //double gaugeCap = Math.pow(10, MathUtils.nearestPowerOf10(amt, true)); - int height = (int) (Math.ceil(amt / gaugeCap * (wrapper.getHeight() - 2))); + int height = (int) (Math.ceil(amt / maxGaugeCap * (wrapper.getHeight() - 2))); int oneMinusHeight = wrapper.getHeight() - height; - builder.addSlot(role, wrapper.getX() + 1, wrapper.getY() + wrapper.getHeight() - height).addIngredient(ElectrodynamicsJeiTypes.GAS_STACK, stack).setCustomRenderer(ElectrodynamicsJeiTypes.GAS_STACK, new IngredientRendererGasStack((int) gaugeCap, -oneMinusHeight + 1, height, wrapper.getBarsTexture())); + builder.addSlot(role, wrapper.getX() + 1, wrapper.getY() + wrapper.getHeight() - height).addIngredient(ElectrodynamicsJeiTypes.GAS_STACK, stack).setCustomRenderer(ElectrodynamicsJeiTypes.GAS_STACK, new IngredientRendererGasStack((int) maxGaugeCap, -oneMinusHeight + 1, height, wrapper.getBarsTexture())); } } diff --git a/src/main/java/electrodynamics/compatibility/jei/utils/gui/types/fluidgauge/AbstractFluidGaugeObject.java b/src/main/java/electrodynamics/compatibility/jei/utils/gui/types/fluidgauge/AbstractFluidGaugeObject.java index 7426a0e72..397365969 100644 --- a/src/main/java/electrodynamics/compatibility/jei/utils/gui/types/fluidgauge/AbstractFluidGaugeObject.java +++ b/src/main/java/electrodynamics/compatibility/jei/utils/gui/types/fluidgauge/AbstractFluidGaugeObject.java @@ -5,15 +5,8 @@ public abstract class AbstractFluidGaugeObject extends ScreenObject { - private int amount; - - public AbstractFluidGaugeObject(ITexture texture, int amount, int x, int y) { + public AbstractFluidGaugeObject(ITexture texture, int x, int y) { super(texture, x, y); - this.amount = amount; - } - - public int getAmount() { - return amount; } public abstract int getFluidTextWidth(); diff --git a/src/main/java/electrodynamics/compatibility/jei/utils/gui/types/fluidgauge/FluidGaugeObject.java b/src/main/java/electrodynamics/compatibility/jei/utils/gui/types/fluidgauge/FluidGaugeObject.java index a13ad3f28..2cc92a415 100644 --- a/src/main/java/electrodynamics/compatibility/jei/utils/gui/types/fluidgauge/FluidGaugeObject.java +++ b/src/main/java/electrodynamics/compatibility/jei/utils/gui/types/fluidgauge/FluidGaugeObject.java @@ -4,8 +4,8 @@ public class FluidGaugeObject extends AbstractFluidGaugeObject { - public FluidGaugeObject(int x, int y, int amount) { - super(JeiTextures.FLUID_GAUGE_DEFAULT, amount, x, y); + public FluidGaugeObject(int x, int y) { + super(JeiTextures.FLUID_GAUGE_DEFAULT, x, y); } @Override diff --git a/src/main/java/electrodynamics/compatibility/jei/utils/gui/types/gasgauge/AbstractGasGaugeObject.java b/src/main/java/electrodynamics/compatibility/jei/utils/gui/types/gasgauge/AbstractGasGaugeObject.java index 23f6896da..84f4910d4 100644 --- a/src/main/java/electrodynamics/compatibility/jei/utils/gui/types/gasgauge/AbstractGasGaugeObject.java +++ b/src/main/java/electrodynamics/compatibility/jei/utils/gui/types/gasgauge/AbstractGasGaugeObject.java @@ -4,20 +4,12 @@ public abstract class AbstractGasGaugeObject extends ScreenObject { - private IGasGaugeTexture bars; + private final IGasGaugeTexture bars; - private double amount; - - public AbstractGasGaugeObject(IGasGaugeTexture base, IGasGaugeTexture bars, int x, int y, double amount) { + public AbstractGasGaugeObject(IGasGaugeTexture base, IGasGaugeTexture bars, int x, int y) { super(base, x, y); this.bars = bars; - this.amount = amount; - } - - public double getAmount() { - return amount; } - public IGasGaugeTexture getBarsTexture() { return bars; } diff --git a/src/main/java/electrodynamics/compatibility/jei/utils/gui/types/gasgauge/GasGaugeObject.java b/src/main/java/electrodynamics/compatibility/jei/utils/gui/types/gasgauge/GasGaugeObject.java index db8397c38..b3d3ac1ae 100644 --- a/src/main/java/electrodynamics/compatibility/jei/utils/gui/types/gasgauge/GasGaugeObject.java +++ b/src/main/java/electrodynamics/compatibility/jei/utils/gui/types/gasgauge/GasGaugeObject.java @@ -2,8 +2,8 @@ public class GasGaugeObject extends AbstractGasGaugeObject { - public GasGaugeObject(int x, int y, double amount) { - super(JeiGasGaugeTextures.BACKGROUND_DEFAULT, JeiGasGaugeTextures.LEVEL_DEFAULT, x, y, amount); + public GasGaugeObject(int x, int y) { + super(JeiGasGaugeTextures.BACKGROUND_DEFAULT, JeiGasGaugeTextures.LEVEL_DEFAULT, x, y); } } diff --git a/src/main/java/electrodynamics/compatibility/mekanism/ChemicalStackSupplier.java b/src/main/java/electrodynamics/compatibility/mekanism/ChemicalStackSupplier.java new file mode 100644 index 000000000..2d9033114 --- /dev/null +++ b/src/main/java/electrodynamics/compatibility/mekanism/ChemicalStackSupplier.java @@ -0,0 +1,13 @@ +package electrodynamics.compatibility.mekanism; + +import mekanism.api.chemical.ChemicalStack; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.api.distmarker.OnlyIn; + +@OnlyIn(Dist.CLIENT) +@FunctionalInterface +public interface ChemicalStackSupplier { + + public ChemicalStack getChemical(); + +} diff --git a/src/main/java/electrodynamics/compatibility/mekanism/GasMapReloadListener.java b/src/main/java/electrodynamics/compatibility/mekanism/GasMapReloadListener.java new file mode 100644 index 000000000..878b56a9d --- /dev/null +++ b/src/main/java/electrodynamics/compatibility/mekanism/GasMapReloadListener.java @@ -0,0 +1,99 @@ +package electrodynamics.compatibility.mekanism; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import electrodynamics.Electrodynamics; +import electrodynamics.api.gas.Gas; +import electrodynamics.registers.ElectrodynamicsGases; +import mekanism.api.MekanismAPI; +import mekanism.api.chemical.Chemical; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.packs.resources.Resource; +import net.minecraft.server.packs.resources.ResourceManager; +import net.minecraft.server.packs.resources.SimplePreparableReloadListener; +import net.minecraft.util.GsonHelper; +import net.minecraft.util.profiling.ProfilerFiller; +import org.apache.logging.log4j.Logger; + +import java.io.*; +import java.nio.charset.StandardCharsets; +import java.util.*; + +public class GasMapReloadListener extends SimplePreparableReloadListener { + + public static final GasMapReloadListener INSTANCE = new GasMapReloadListener(); + + public static final String FOLDER = "machines"; + public static final String FILE_NAME = "rotary_unifier_mappings"; + protected static final String JSON_EXTENSION = ".json"; + protected static final int JSON_EXTENSION_LENGTH = JSON_EXTENSION.length(); + + private static final Gson GSON = new Gson(); + + public final HashMap gasToChemicalMap = new HashMap<>(); + public final HashMap chemicalToGasMap = new HashMap<>(); + + private final Logger logger = Electrodynamics.LOGGER; + + @Override + protected JsonObject prepare(ResourceManager manager, ProfilerFiller profiler) { + JsonObject combined = new JsonObject(); + + List> resources = new ArrayList<>(manager.listResources(FOLDER, GasMapReloadListener::isJson).entrySet()); + Collections.reverse(resources); + + for (Map.Entry entry : resources) { + ResourceLocation loc = entry.getKey(); + final String namespace = loc.getNamespace(); + final String filePath = loc.getPath(); + final String dataPath = filePath.substring(FOLDER.length() + 1, filePath.length() - JSON_EXTENSION_LENGTH); + + final ResourceLocation jsonFile = ResourceLocation.fromNamespaceAndPath(namespace, dataPath); + + Resource resource = entry.getValue(); + try (final InputStream inputStream = resource.open(); final Reader reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8));) { + final JsonObject json = (JsonObject) GsonHelper.fromJson(GSON, reader, JsonElement.class); + + json.entrySet().forEach(set -> { + + if (combined.has(set.getKey())) { + combined.remove(set.getKey()); + } + + combined.add(set.getKey(), set.getValue()); + }); + + } catch (RuntimeException | IOException exception) { + logger.error("Data loader for {} could not read data {} from file {} in data pack {}", FOLDER, jsonFile, loc, resource.sourcePackId(), exception); + } + + } + return combined; + } + + @Override + protected void apply(JsonObject json, ResourceManager manager, ProfilerFiller profiler) { + gasToChemicalMap.clear(); + chemicalToGasMap.clear(); + + json.entrySet().forEach(set -> { + + ResourceLocation gasKey = ResourceLocation.parse(set.getKey()); + ResourceLocation chemicalKey = ResourceLocation.parse(set.getValue().getAsString()); + + Gas gas = ElectrodynamicsGases.GAS_REGISTRY.get(gasKey); + Chemical chemical = MekanismAPI.CHEMICAL_REGISTRY.get(chemicalKey); + + gasToChemicalMap.put(gas, chemical); + chemicalToGasMap.put(chemical, gas); + + }); + + } + + private static boolean isJson(final ResourceLocation filename) { + return filename.getPath().contains(FILE_NAME + JSON_EXTENSION); + } + +} diff --git a/src/main/java/electrodynamics/compatibility/mekanism/MekanismClientHandler.java b/src/main/java/electrodynamics/compatibility/mekanism/MekanismClientHandler.java new file mode 100644 index 000000000..34ce4de90 --- /dev/null +++ b/src/main/java/electrodynamics/compatibility/mekanism/MekanismClientHandler.java @@ -0,0 +1,12 @@ +package electrodynamics.compatibility.mekanism; + +import electrodynamics.registers.ElectrodynamicsMenuTypes; +import net.neoforged.neoforge.client.event.RegisterMenuScreensEvent; + +public class MekanismClientHandler { + + public static void registerMenus(RegisterMenuScreensEvent event) { + event.register(ElectrodynamicsMenuTypes.CONTAINER_ROTARYUNIFIER.get(), ScreenRotaryUnifier::new); + } + +} diff --git a/src/main/java/electrodynamics/compatibility/mekanism/MekanismHandler.java b/src/main/java/electrodynamics/compatibility/mekanism/MekanismHandler.java new file mode 100644 index 000000000..e67b149cc --- /dev/null +++ b/src/main/java/electrodynamics/compatibility/mekanism/MekanismHandler.java @@ -0,0 +1,284 @@ +package electrodynamics.compatibility.mekanism; + +import electrodynamics.api.References; +import electrodynamics.api.gas.*; +import electrodynamics.common.network.utils.GasUtilities; +import electrodynamics.common.settings.Constants; +import electrodynamics.common.tile.compatibility.TileRotaryUnifier; +import electrodynamics.prefab.properties.Property; +import electrodynamics.prefab.properties.PropertyType; +import electrodynamics.prefab.tile.components.IComponentType; +import electrodynamics.prefab.tile.components.type.ComponentElectrodynamic; +import electrodynamics.prefab.tile.components.type.ComponentProcessor; +import electrodynamics.prefab.utilities.BlockEntityUtils; +import electrodynamics.registers.ElectrodynamicsTiles; +import mekanism.api.Action; +import mekanism.api.chemical.Chemical; +import mekanism.api.chemical.ChemicalStack; +import mekanism.api.chemical.IChemicalHandler; +import mekanism.common.capabilities.Capabilities; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.NbtOps; +import net.minecraft.nbt.Tag; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.neoforged.neoforge.capabilities.RegisterCapabilitiesEvent; +import net.neoforged.neoforge.event.AddReloadListenerEvent; + +import java.util.function.Predicate; + +public class MekanismHandler { + + public static final PropertyType CHEMICAL_STACK = new PropertyType<>( + // + ResourceLocation.fromNamespaceAndPath(References.ID, "chemicalstack"), + // + null, + // + ChemicalStack.OPTIONAL_STREAM_CODEC, + // + writer -> { + Tag fluidTag = new CompoundTag(); + fluidTag = ChemicalStack.OPTIONAL_CODEC.encode(writer.prop().get(), NbtOps.INSTANCE, fluidTag).getOrThrow(); + writer.tag().put(writer.prop().getName(), fluidTag); + int i = 0; + }, + // + reader -> ChemicalStack.OPTIONAL_CODEC.decode(NbtOps.INSTANCE, reader.tag().getCompound(reader.prop().getName())).getOrThrow().getFirst() + // + ); + + public static void addDataListener(AddReloadListenerEvent event) { + event.addListener(GasMapReloadListener.INSTANCE); + } + + public static void registerCapabilities(RegisterCapabilitiesEvent event) { + event.registerBlockEntity(Capabilities.CHEMICAL.block(), ElectrodynamicsTiles.TILE_ROTARYUNIFIER.get(), (tile, context) -> { + if (context == null || context != tile.chemicalIO) { + return null; + } + Property prop = getProp(tile); + return new IChemicalHandler() { + @Override + public int getChemicalTanks() { + return 1; + } + + @Override + public ChemicalStack getChemicalInTank(int tank) { + return prop.get(); + } + + @Override + public void setChemicalInTank(int tank, ChemicalStack stack) { + prop.set(stack); + } + + @Override + public long getChemicalTankCapacity(int tank) { + return TileRotaryUnifier.MAX_CHEM_AMOUNT; + } + + @Override + public boolean isValid(int tank, ChemicalStack stack) { + return GasMapReloadListener.INSTANCE.chemicalToGasMap.containsKey(stack.getChemical()) && (prop.get().is(stack.getChemical()) || prop.get().isEmpty()); + } + + @Override + public ChemicalStack insertChemical(int tank, ChemicalStack stack, Action action) { + + ChemicalStack returner = stack.copy(); + + + if (!tile.conversionIsFlipped.get()) { + return returner; + } + if (stack.isEmpty() || !isValid(tank, stack)) { + return returner; + } + if (action.simulate()) { + if (prop.get().isEmpty()) { + returner.shrink(Math.min(TileRotaryUnifier.MAX_CHEM_AMOUNT, stack.getAmount())); + return returner; + } + if (!ChemicalStack.isSameChemical(prop.get(), stack)) { + return stack; + } + returner.shrink(Math.min(TileRotaryUnifier.MAX_CHEM_AMOUNT - prop.get().getAmount(), stack.getAmount())); + return returner; + } + if (prop.get().isEmpty()) { + long accepted = Math.min(TileRotaryUnifier.MAX_CHEM_AMOUNT, stack.getAmount()); + returner.shrink(accepted); + prop.set(stack.copyWithAmount(accepted)); + return returner; + } + if (!ChemicalStack.isSameChemical(prop.get(), stack)) { + return stack; + } + long filled = TileRotaryUnifier.MAX_CHEM_AMOUNT - prop.get().getAmount(); + + ChemicalStack chem = prop.get().copy(); + + if (stack.getAmount() < filled) { + chem.grow(stack.getAmount()); + prop.set(chem); + filled = stack.getAmount(); + } else { + chem.setAmount(TileRotaryUnifier.MAX_CHEM_AMOUNT); + prop.set(chem); + } + returner.shrink(filled); + return returner; + } + + @Override + public ChemicalStack extractChemical(int tank, long amount, Action action) { + if (tile.conversionIsFlipped.get()) { + return ChemicalStack.EMPTY; + } + long drained = TileRotaryUnifier.MAX_CHEM_AMOUNT; + if (prop.get().getAmount() < drained) { + drained = prop.get().getAmount(); + } + ChemicalStack stack = prop.get().copyWithAmount(drained); + if (action.execute() && drained > 0) { + ChemicalStack chem = prop.get().copy(); + chem.shrink(drained); + prop.set(chem); + } + return stack; + } + }; + }); + + } + + public static int addProperty(TileRotaryUnifier tile) { + return tile.property(new Property<>(CHEMICAL_STACK, "chemicalstackprop", ChemicalStack.EMPTY)).getIndex(); + } + + public static Predicate getTankPredicate() { + return stack -> GasMapReloadListener.INSTANCE.gasToChemicalMap.containsKey(stack.getGas()); + } + + public static Property getProp(TileRotaryUnifier tile) { + return (Property) tile.getPropertyManager().getProperties().get(tile.chemStackIndex); + } + + public static boolean canProcess(TileRotaryUnifier tile, ComponentProcessor proc) { + + Property prop = getProp(tile); + ; + PropertyGasTank tank = tile.gasTank; + int rate = (int) (Constants.ROTARY_UNIFIER_CONVERSION_RATE * proc.operatingSpeed.get()); + ComponentElectrodynamic electro = tile.getComponent(IComponentType.Electrodynamic); + + if (tile.conversionIsFlipped.get()) { + + GasUtilities.outputToPipe(tile, tank.asArray(), BlockEntityUtils.MachineDirection.RIGHT.mappedDir); + + if (electro.getJoulesStored() < proc.getUsage() || prop.get().isEmpty()) { + return false; + } + + Gas gas = GasMapReloadListener.INSTANCE.chemicalToGasMap.get(prop.get().getChemical()); + + if (gas == null) { + return false; + } + + GasStack proposed = new GasStack(gas, rate, gas.getCondensationTemp() + 1, Gas.PRESSURE_AT_SEA_LEVEL); + + if (!tank.isGasValid(proposed)) { + return false; + } + + int accepted = tank.fill(proposed, GasAction.SIMULATE); + + return accepted > 0; + + } else { + + BlockEntity faceTile = tile.getLevel().getBlockEntity(tile.getBlockPos().relative(tile.chemicalIO)); + + if (faceTile != null && !prop.get().isEmpty()) { + IChemicalHandler handler = faceTile.getLevel().getCapability(Capabilities.CHEMICAL.block(), faceTile.getBlockPos(), faceTile.getBlockState(), faceTile, tile.chemicalIO.getOpposite()); + + if (handler != null) { + for (int i = 0; i < handler.getChemicalTanks(); i++) { + + ChemicalStack storedChem = prop.get().copy(); + + ChemicalStack accepted = handler.insertChemical(storedChem, Action.EXECUTE); + + storedChem.shrink(accepted.getAmount()); + + prop.set(storedChem); + } + } + + + } + + if (electro.getJoulesStored() < proc.getUsage()) { + return false; + } + + GasStack gas = tank.getGas(); + + if (gas.isEmpty()) { + return false; + } + + Chemical chemical = GasMapReloadListener.INSTANCE.gasToChemicalMap.get(gas.getGas()); + + if (chemical == null || (!prop.get().isEmpty() && !prop.get().is(chemical)) || gas.getTemperature() > gas.getGas().getCondensationTemp() + 1) { + return false; + } + + return (Math.max(0, TileRotaryUnifier.MAX_CHEM_AMOUNT - prop.get().getAmount())) > 0; + + } + + } + + public static void process(TileRotaryUnifier tile, ComponentProcessor proc) { + + Property prop = getProp(tile); + ; + PropertyGasTank tank = tile.gasTank; + int rate = (int) (Constants.ROTARY_UNIFIER_CONVERSION_RATE * proc.operatingSpeed.get()); + + if (tile.conversionIsFlipped.get()) { + + Gas gas = GasMapReloadListener.INSTANCE.chemicalToGasMap.get(prop.get().getChemical()); + GasStack proposed = new GasStack(gas, rate, gas.getCondensationTemp() + 1, Gas.PRESSURE_AT_SEA_LEVEL); + int accepted = tank.fill(proposed, GasAction.EXECUTE); + + ChemicalStack chemicalStack = prop.get().copy(); + chemicalStack.shrink(accepted); + prop.set(chemicalStack); + + + } else { + + GasStack gas = tank.getGas(); + Chemical chemical = GasMapReloadListener.INSTANCE.gasToChemicalMap.get(gas.getGas()); + int accepted = (int) Math.min(rate, Math.max(gas.getAmount(), TileRotaryUnifier.MAX_CHEM_AMOUNT - prop.get().getAmount())); + + if (prop.get().isEmpty()) { + prop.set(new ChemicalStack(chemical, accepted)); + } else { + ChemicalStack stack = prop.get().copy(); + stack.grow(accepted); + prop.set(stack); + } + tank.drain(accepted, GasAction.EXECUTE); + + } + + } + +} diff --git a/src/main/java/electrodynamics/compatibility/mekanism/ScreenComponentChemicalGauge.java b/src/main/java/electrodynamics/compatibility/mekanism/ScreenComponentChemicalGauge.java new file mode 100644 index 000000000..527e6d6f6 --- /dev/null +++ b/src/main/java/electrodynamics/compatibility/mekanism/ScreenComponentChemicalGauge.java @@ -0,0 +1,81 @@ +package electrodynamics.compatibility.mekanism; + +import com.mojang.blaze3d.systems.RenderSystem; +import electrodynamics.api.electricity.formatting.ChatFormatter; +import electrodynamics.common.tile.compatibility.TileRotaryUnifier; +import electrodynamics.prefab.screen.component.ScreenComponentGeneric; +import electrodynamics.prefab.screen.component.types.gauges.AbstractScreenComponentGauge; +import electrodynamics.prefab.utilities.ElectroTextUtils; +import electrodynamics.prefab.utilities.RenderingUtils; +import mekanism.api.chemical.Chemical; +import mekanism.api.chemical.ChemicalStack; +import mekanism.client.render.MekanismRenderer; +import net.minecraft.ChatFormatting; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.network.chat.Component; +import net.minecraft.util.FormattedCharSequence; + +import java.util.ArrayList; +import java.util.List; + +public class ScreenComponentChemicalGauge extends ScreenComponentGeneric { + + private final ChemicalStackSupplier chemicalStackSupplier; + + public ScreenComponentChemicalGauge(int x, int y, ChemicalStackSupplier chemicalStackSupplier) { + super(AbstractScreenComponentGauge.GaugeTextures.BACKGROUND_DEFAULT, x, y); + + this.chemicalStackSupplier = chemicalStackSupplier; + + onTooltip((graphics, component, xAxis, yAxis) -> { + List tooltips = new ArrayList<>(); + ChemicalStack stack = chemicalStackSupplier.getChemical(); + if (stack != null) { + Chemical chemical = stack.getChemical(); + if (stack.getAmount() > 0) { + tooltips.add(Component.translatable(chemical.getTranslationKey()).getVisualOrderText()); + tooltips.add(ElectroTextUtils.ratio(ChatFormatter.formatFluidMilibuckets(stack.getAmount()), ChatFormatter.formatFluidMilibuckets(TileRotaryUnifier.MAX_CHEM_AMOUNT)).withStyle(ChatFormatting.GRAY).getVisualOrderText()); + } else { + tooltips.add(ElectroTextUtils.ratio(Component.literal("0"), ChatFormatter.formatFluidMilibuckets(TileRotaryUnifier.MAX_CHEM_AMOUNT)).withStyle(ChatFormatting.GRAY).getVisualOrderText()); + } + } + if (!tooltips.isEmpty()) { + graphics.renderTooltip(gui.getFontRenderer(), tooltips, xAxis, yAxis); + } + }); + } + + @Override + public void renderBackground(GuiGraphics graphics, int xAxis, int yAxis, int guiWidth, int guiHeight) { + super.renderBackground(graphics, xAxis, yAxis, guiWidth, guiHeight); + + ChemicalStack stack = chemicalStackSupplier.getChemical(); + + if (!stack.isEmpty()) { + int scale = (int) (stack.getAmount() * (AbstractScreenComponentGauge.GaugeTextures.BACKGROUND_DEFAULT.textureHeight() - 2) / TileRotaryUnifier.MAX_CHEM_AMOUNT); + + TextureAtlasSprite sprite = MekanismRenderer.getChemicalTexture(stack.getChemical()); + RenderingUtils.bindTexture(sprite.atlasLocation()); + + MekanismRenderer.color(graphics, stack.getChemical()); + + for (int i = 0; i < 16; i += 16) { + for (int j = 0; j < scale; j += 16) { + int drawWidth = Math.min(super.texture.textureWidth() - 2 - i, 16); + int drawHeight = Math.min(scale - j, 16); + + int drawX = guiWidth + xLocation + 1; + int drawY = guiHeight + yLocation - 1 + super.texture.textureHeight() - Math.min(scale - j, super.texture.textureHeight()); + + graphics.blit(drawX, drawY, 0, drawWidth, drawHeight, sprite); + + } + } + RenderSystem.setShaderColor(1, 1, 1, 1); + } + + + graphics.blit(super.texture.getLocation(), guiWidth + xLocation, guiHeight + yLocation, AbstractScreenComponentGauge.GaugeTextures.LEVEL_DEFAULT.textureU(), 0, AbstractScreenComponentGauge.GaugeTextures.LEVEL_DEFAULT.textureWidth(), AbstractScreenComponentGauge.GaugeTextures.LEVEL_DEFAULT.textureHeight(), AbstractScreenComponentGauge.GaugeTextures.LEVEL_DEFAULT.imageWidth(), AbstractScreenComponentGauge.GaugeTextures.LEVEL_DEFAULT.imageHeight()); + } +} diff --git a/src/main/java/electrodynamics/compatibility/mekanism/ScreenRotaryUnifier.java b/src/main/java/electrodynamics/compatibility/mekanism/ScreenRotaryUnifier.java new file mode 100644 index 000000000..8e8de0f4b --- /dev/null +++ b/src/main/java/electrodynamics/compatibility/mekanism/ScreenRotaryUnifier.java @@ -0,0 +1,89 @@ +package electrodynamics.compatibility.mekanism; + +import electrodynamics.api.screen.ITexture; +import electrodynamics.common.inventory.container.tile.ContainerRotaryUnifier; +import electrodynamics.common.tile.compatibility.TileRotaryUnifier; +import electrodynamics.prefab.screen.component.button.ScreenComponentButton; +import electrodynamics.prefab.screen.component.types.ScreenComponentProgress; +import electrodynamics.prefab.screen.component.types.gauges.ScreenComponentGasGauge; +import electrodynamics.prefab.screen.component.types.guitab.ScreenComponentElectricInfo; +import electrodynamics.prefab.screen.component.utils.AbstractScreenComponentInfo; +import electrodynamics.prefab.screen.types.GenericMaterialScreen; +import electrodynamics.prefab.tile.components.IComponentType; +import electrodynamics.prefab.tile.components.type.ComponentProcessor; +import electrodynamics.prefab.utilities.ElectroTextUtils; +import mekanism.api.chemical.ChemicalStack; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.network.chat.Component; +import net.minecraft.world.entity.player.Inventory; + +public class ScreenRotaryUnifier extends GenericMaterialScreen { + public ScreenRotaryUnifier(ContainerRotaryUnifier container, Inventory inv, Component titleIn) { + super(container, inv, titleIn); + + addComponent(new ScreenComponentButton<>(ScreenComponentProgress.ProgressTextures.ARROW_RIGHT_OFF, 65, 31) { + @Override + public void renderBackground(GuiGraphics graphics, int xAxis, int yAxis, int guiWidth, int guiHeight) { + TileRotaryUnifier unifier = menu.getSafeHost(); + if(unifier == null) { + super.renderBackground(graphics, xAxis, yAxis, guiWidth, guiHeight); + return; + } + ComponentProcessor proc = unifier.getComponent(IComponentType.Processor); + + ITexture texture; + + if(proc.isActive() && unifier.conversionIsFlipped.get()) { + + texture = ScreenComponentProgress.ProgressTextures.ARROW_LEFT_ON; + + } else if (proc.isActive() && !unifier.conversionIsFlipped.get()) { + + texture = ScreenComponentProgress.ProgressTextures.ARROW_RIGHT_ON; + + } else if (!unifier.conversionIsFlipped.get()) { + + texture = ScreenComponentProgress.ProgressTextures.ARROW_RIGHT_OFF; + + } else { + + texture = ScreenComponentProgress.ProgressTextures.ARROW_LEFT_OFF; + + } + + graphics.blit(texture.getLocation(), guiWidth + xLocation, guiHeight + yLocation, texture.textureU(), texture.textureV(), texture.textureWidth(), texture.textureHeight(), texture.imageWidth(), texture.imageHeight()); + + } + }.setOnPress(button -> { + TileRotaryUnifier unifier = menu.getSafeHost(); + if(unifier == null) { + return; + } + unifier.conversionIsFlipped.set(!unifier.conversionIsFlipped.get()); + }).onTooltip((graphics, component, xAxis, yAxis) -> { + TileRotaryUnifier unifier = menu.getSafeHost(); + if(unifier == null) { + return; + } + graphics.renderTooltip(getFontRenderer(), ElectroTextUtils.tooltip("rotaryunifier.toggle"), xAxis, yAxis); + })); + addComponent(new ScreenComponentGasGauge(() -> { + TileRotaryUnifier boiler = container.getSafeHost(); + if (boiler != null) { + return boiler.gasTank; + } + return null; + }, 30, 18)); + + + addComponent(new ScreenComponentChemicalGauge(108, 21, () -> { + TileRotaryUnifier unifier = menu.getSafeHost(); + if(unifier == null) { + return ChemicalStack.EMPTY; + } + return MekanismHandler.getProp(unifier).get(); + })); + + addComponent(new ScreenComponentElectricInfo(-AbstractScreenComponentInfo.SIZE + 1, 2)); + } +} diff --git a/src/main/java/electrodynamics/datagen/DataGenerators.java b/src/main/java/electrodynamics/datagen/DataGenerators.java index 677471a64..6616461b2 100644 --- a/src/main/java/electrodynamics/datagen/DataGenerators.java +++ b/src/main/java/electrodynamics/datagen/DataGenerators.java @@ -1,11 +1,11 @@ package electrodynamics.datagen; -import java.util.Collections; -import java.util.List; -import java.util.Set; +import java.util.*; import java.util.concurrent.CompletableFuture; import electrodynamics.api.References; +import electrodynamics.api.network.cable.type.IWire; +import electrodynamics.common.block.subtype.SubtypeWire; import electrodynamics.datagen.client.ElectrodynamicsBlockModelsProvider; import electrodynamics.datagen.client.ElectrodynamicsBlockStateProvider; import electrodynamics.datagen.client.ElectrodynamicsItemModelsProvider; @@ -33,54 +33,95 @@ import net.neoforged.neoforge.data.event.GatherDataEvent; import net.neoforged.neoforge.registries.NeoForgeRegistries; +import javax.annotation.Nullable; + @EventBusSubscriber(modid = References.ID, bus = EventBusSubscriber.Bus.MOD) public class DataGenerators { - @SubscribeEvent - public static void gatherData(GatherDataEvent event) { - - DataGenerator generator = event.getGenerator(); - - PackOutput output = generator.getPackOutput(); - - ExistingFileHelper helper = event.getExistingFileHelper(); - - CompletableFuture lookupProvider = event.getLookupProvider(); - - - if (event.includeServer()) { - generator.addProvider(true, new LootTableProvider(output, Collections.emptySet(), List.of(new LootTableProvider.SubProviderEntry(ElectrodynamicsLootTablesProvider::new, LootContextParamSets.BLOCK)), lookupProvider)); - - generator.addProvider(true, new CombustionChamberFuelSourceProvider(output)); - generator.addProvider(true, new CoalGeneratorFuelSourceProvider(output)); - generator.addProvider(true, new ThermoelectricGenHeatSourceProvider(output)); - generator.addProvider(true, new GasCollectorChromoCardsProvider(output)); - - DatapackBuiltinEntriesProvider datapacks = new DatapackBuiltinEntriesProvider(output, lookupProvider, new RegistrySetBuilder() - // - .add(Registries.DAMAGE_TYPE, ElectrodynamicsDamageTypes::registerTypes) - // - .add(Registries.CONFIGURED_FEATURE, context -> ElectrodynamicsFeatures.registerConfigured(context)) - // - .add(Registries.PLACED_FEATURE, ElectrodynamicsFeatures::registerPlaced) - // - .add(NeoForgeRegistries.Keys.BIOME_MODIFIERS, ElectrodynamicsFeatures::registerModifiers) - // - , Set.of(References.ID)); - - generator.addProvider(true, datapacks); - ElectrodynamicsTagsProvider.addTagProviders(generator, output, datapacks.getRegistryProvider(), helper); - generator.addProvider(true, new ElectrodynamicsRecipeProvider(output, lookupProvider)); - generator.addProvider(true, new ElectrodynamicsAdvancementProvider(output, datapacks.getRegistryProvider())); - generator.addProvider(true, new ElectrodynamicsMultiblockProvider(output, datapacks.getRegistryProvider(), helper)); - } - if (event.includeClient()) { - generator.addProvider(true, new ElectrodynamicsBlockStateProvider(output, helper)); - generator.addProvider(true, new ElectrodynamicsBlockModelsProvider(output, helper)); - generator.addProvider(true, new ElectrodynamicsItemModelsProvider(output, helper)); - generator.addProvider(true, new ElectrodynamicsLangKeyProvider(output, Locale.EN_US)); - generator.addProvider(true, new ElectrodynamicsSoundProvider(output, helper)); - } - } + public static final HashMap> WIRES = new HashMap<>(); + + static { + for (SubtypeWire wire : SubtypeWire.values()) { + HashSet wireSet = WIRES.getOrDefault(wire.getWireClass(), new HashSet<>()); + wireSet.add(wire); + WIRES.put(wire.getWireClass(), wireSet); + } + } + + @Nullable + public static SubtypeWire getWire(IWire.IWireMaterial conductor, SubtypeWire.InsulationMaterial insulation, SubtypeWire.WireClass wireClass, SubtypeWire.WireColor color) { + + for (SubtypeWire wire : WIRES.getOrDefault(wireClass, new HashSet<>())) { + if (wire.getWireMaterial() == conductor && wire.getInsulation() == insulation && wire.getWireClass() == wireClass && wire.getWireColor() == color) { + return wire; + } + } + return null; + } + + public static SubtypeWire[] getWires(IWire.IWireMaterial[] conductors, SubtypeWire.InsulationMaterial insulation, SubtypeWire.WireClass wireClass, SubtypeWire.WireColor... colors) { + + List list = new ArrayList<>(); + + SubtypeWire wire; + for (IWire.IWireMaterial conductor : conductors) { + for (SubtypeWire.WireColor color : colors) { + wire = getWire(conductor, insulation, wireClass, color); + if (wire != null) { + list.add(wire); + } + } + } + + return list.toArray(new SubtypeWire[0]); + } + + + @SubscribeEvent + public static void gatherData(GatherDataEvent event) { + + DataGenerator generator = event.getGenerator(); + + PackOutput output = generator.getPackOutput(); + + ExistingFileHelper helper = event.getExistingFileHelper(); + + CompletableFuture lookupProvider = event.getLookupProvider(); + + + if (event.includeServer()) { + generator.addProvider(true, new LootTableProvider(output, Collections.emptySet(), List.of(new LootTableProvider.SubProviderEntry(ElectrodynamicsLootTablesProvider::new, LootContextParamSets.BLOCK)), lookupProvider)); + + generator.addProvider(true, new CombustionChamberFuelSourceProvider(output)); + generator.addProvider(true, new CoalGeneratorFuelSourceProvider(output)); + generator.addProvider(true, new ThermoelectricGenHeatSourceProvider(output)); + generator.addProvider(true, new GasCollectorChromoCardsProvider(output)); + + DatapackBuiltinEntriesProvider datapacks = new DatapackBuiltinEntriesProvider(output, lookupProvider, new RegistrySetBuilder() + // + .add(Registries.DAMAGE_TYPE, ElectrodynamicsDamageTypes::registerTypes) + // + .add(Registries.CONFIGURED_FEATURE, context -> ElectrodynamicsFeatures.registerConfigured(context)) + // + .add(Registries.PLACED_FEATURE, ElectrodynamicsFeatures::registerPlaced) + // + .add(NeoForgeRegistries.Keys.BIOME_MODIFIERS, ElectrodynamicsFeatures::registerModifiers) + // + , Set.of(References.ID)); + + generator.addProvider(true, datapacks); + ElectrodynamicsTagsProvider.addTagProviders(generator, output, datapacks.getRegistryProvider(), helper); + generator.addProvider(true, new ElectrodynamicsRecipeProvider(output, lookupProvider)); + generator.addProvider(true, new ElectrodynamicsAdvancementProvider(output, datapacks.getRegistryProvider())); + generator.addProvider(true, new ElectrodynamicsMultiblockProvider(output, datapacks.getRegistryProvider(), helper)); + } + if (event.includeClient()) { + generator.addProvider(true, new ElectrodynamicsBlockStateProvider(output, helper)); + generator.addProvider(true, new ElectrodynamicsBlockModelsProvider(output, helper)); + generator.addProvider(true, new ElectrodynamicsItemModelsProvider(output, helper)); + generator.addProvider(true, new ElectrodynamicsLangKeyProvider(output, Locale.EN_US)); + generator.addProvider(true, new ElectrodynamicsSoundProvider(output, helper)); + } + } } diff --git a/src/main/java/electrodynamics/datagen/client/ElectrodynamicsBlockStateProvider.java b/src/main/java/electrodynamics/datagen/client/ElectrodynamicsBlockStateProvider.java index 7f02bed3b..4c78991fe 100644 --- a/src/main/java/electrodynamics/datagen/client/ElectrodynamicsBlockStateProvider.java +++ b/src/main/java/electrodynamics/datagen/client/ElectrodynamicsBlockStateProvider.java @@ -15,10 +15,11 @@ import electrodynamics.common.block.subtype.SubtypeRawOreBlock; import electrodynamics.common.block.subtype.SubtypeResourceBlock; import electrodynamics.common.block.subtype.SubtypeWire; -import electrodynamics.common.block.subtype.SubtypeWire.Conductor; +import electrodynamics.common.block.subtype.SubtypeWire.WireMaterial; import electrodynamics.common.block.subtype.SubtypeWire.InsulationMaterial; import electrodynamics.common.block.subtype.SubtypeWire.WireClass; import electrodynamics.common.block.subtype.SubtypeWire.WireColor; +import electrodynamics.datagen.DataGenerators; import electrodynamics.datagen.utils.model.SlaveNodeModelBuilder; import electrodynamics.datagen.utils.model.WireModelBuilder; import electrodynamics.registers.ElectrodynamicsBlocks; @@ -307,6 +308,8 @@ protected void registerStatesAndModels() { // 90, 0, true); + horrRotatedBlock(ElectrodynamicsBlocks.BLOCK_ROTARYUNIFIER, existingBlock(ElectrodynamicsBlocks.BLOCK_ROTARYUNIFIER), true); + genWires(); genFluidPipes(); @@ -321,41 +324,41 @@ private void genWires() { String texture = "wire/"; // bare - for (SubtypeWire wire : SubtypeWire.getWires(Conductor.values(), InsulationMaterial.BARE, WireClass.BARE, WireColor.NONE)) { + for (SubtypeWire wire : DataGenerators.getWires(WireMaterial.values(), InsulationMaterial.BARE, WireClass.BARE, WireColor.NONE)) { wire(ElectrodynamicsBlocks.BLOCKS_WIRE.getValue(wire), // - models().withExistingParent(name + wire.tag() + "_none", modLoc(parent + "wire_none")).texture("conductor", blockLoc(texture + wire.conductor.toString())).texture("particle", "#conductor").renderType("cutout"), // - models().withExistingParent(name + wire.tag() + "_side", modLoc(parent + "wire_side")).texture("conductor", blockLoc(texture + wire.conductor.toString())).texture("particle", "#conductor").renderType("cutout"), // + models().withExistingParent(name + wire.tag() + "_none", modLoc(parent + "wire_none")).texture("conductor", blockLoc(texture + wire.getWireMaterial().toString())).texture("particle", "#conductor").renderType("cutout"), // + models().withExistingParent(name + wire.tag() + "_side", modLoc(parent + "wire_side")).texture("conductor", blockLoc(texture + wire.getWireMaterial().toString())).texture("particle", "#conductor").renderType("cutout"), // false); } // insulated - for (SubtypeWire wire : SubtypeWire.getWires(Conductor.values(), InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.values())) { + for (SubtypeWire wire : DataGenerators.getWires(WireMaterial.values(), InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.values())) { wire(ElectrodynamicsBlocks.BLOCKS_WIRE.getValue(wire), // - models().withExistingParent(name + wire.tag() + "_none", modLoc(parent + "insulatedwire_none")).texture("conductor", blockLoc(texture + wire.conductor.toString() + "_center")).texture("insulation", blockLoc(texture + "insulationwool_center")).texture("particle", "#insulation").renderType("cutout"), // + models().withExistingParent(name + wire.tag() + "_none", modLoc(parent + "insulatedwire_none")).texture("conductor", blockLoc(texture + wire.getWireMaterial().toString() + "_center")).texture("insulation", blockLoc(texture + "insulationwool_center")).texture("particle", "#insulation").renderType("cutout"), // models().withExistingParent(name + wire.tag() + "_side", modLoc(parent + "insulatedwire_side")).texture("insulation", blockLoc(texture + "insulationwool")).texture("particle", "#insulation").renderType("cutout"), // false); } // logistical - for (SubtypeWire wire : SubtypeWire.getWires(Conductor.values(), InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.values())) { + for (SubtypeWire wire : DataGenerators.getWires(WireMaterial.values(), InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.values())) { wire(ElectrodynamicsBlocks.BLOCKS_WIRE.getValue(wire), // - models().withExistingParent(name + wire.tag() + "_none", modLoc(parent + "logisticswire_none")).texture("conductor", blockLoc(texture + "logisticswire" + wire.conductor.toString())).texture("insulation", blockLoc(texture + "logisticswireinsulation_center")).texture("particle", "#insulation").texture("redstone", blockLoc(texture + "logisticswireredstone_center")).renderType("cutout"), // + models().withExistingParent(name + wire.tag() + "_none", modLoc(parent + "logisticswire_none")).texture("conductor", blockLoc(texture + "logisticswire" + wire.getWireMaterial().toString())).texture("insulation", blockLoc(texture + "logisticswireinsulation_center")).texture("particle", "#insulation").texture("redstone", blockLoc(texture + "logisticswireredstone_center")).renderType("cutout"), // models().withExistingParent(name + wire.tag() + "_side", modLoc(parent + "logisticswire_side")).texture("insulation", blockLoc(texture + "logisticswireinsulation_side")).texture("particle", "#insulation").texture("redstone", blockLoc(texture + "logisticswireredstone_side")).renderType("cutout"), // false); } // ceramic - for (SubtypeWire wire : SubtypeWire.getWires(Conductor.values(), InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.values())) { + for (SubtypeWire wire : DataGenerators.getWires(WireMaterial.values(), InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.values())) { wire(ElectrodynamicsBlocks.BLOCKS_WIRE.getValue(wire), // - models().withExistingParent(name + wire.tag() + "_none", modLoc(parent + "ceramicinsulatedwire_none")).texture("conductor", blockLoc(texture + wire.conductor.toString() + "_center")).texture("insulation", blockLoc(texture + "insulationceramic_center_base")).texture("particle", "#insulation").renderType("cutout"), // + models().withExistingParent(name + wire.tag() + "_none", modLoc(parent + "ceramicinsulatedwire_none")).texture("conductor", blockLoc(texture + wire.getWireMaterial().toString() + "_center")).texture("insulation", blockLoc(texture + "insulationceramic_center_base")).texture("particle", "#insulation").renderType("cutout"), // models().withExistingParent(name + wire.tag() + "_side", modLoc(parent + "ceramicinsulatedwire_side")).texture("insulationbase", blockLoc(texture + "insulationceramic_base")).texture("insulationcolor", blockLoc(texture + "insulationceramic")).texture("particle", "#insulationcolor").renderType("cutout"), // false); } // highly insulated - for (SubtypeWire wire : SubtypeWire.getWires(Conductor.values(), InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.values())) { + for (SubtypeWire wire : DataGenerators.getWires(WireMaterial.values(), InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.values())) { wire(ElectrodynamicsBlocks.BLOCKS_WIRE.getValue(wire), // - models().withExistingParent(name + wire.tag() + "_none", modLoc(parent + "highlyinsulatedwire_none")).texture("conductor", blockLoc(texture + wire.conductor.toString() + "_center")).texture("insulation", blockLoc(texture + "insulationwool_center")).texture("particle", "#insulation").renderType("cutout"), // + models().withExistingParent(name + wire.tag() + "_none", modLoc(parent + "highlyinsulatedwire_none")).texture("conductor", blockLoc(texture + wire.getWireMaterial().toString() + "_center")).texture("insulation", blockLoc(texture + "insulationwool_center")).texture("particle", "#insulation").renderType("cutout"), // models().withExistingParent(name + wire.tag() + "_side", modLoc(parent + "highlyinsulatedwire_side")).texture("insulation", blockLoc(texture + "insulationwool")).texture("particle", "#insulation").renderType("cutout"), // false); } diff --git a/src/main/java/electrodynamics/datagen/client/ElectrodynamicsItemModelsProvider.java b/src/main/java/electrodynamics/datagen/client/ElectrodynamicsItemModelsProvider.java index 0fa642dd4..8134a0070 100644 --- a/src/main/java/electrodynamics/datagen/client/ElectrodynamicsItemModelsProvider.java +++ b/src/main/java/electrodynamics/datagen/client/ElectrodynamicsItemModelsProvider.java @@ -10,11 +10,12 @@ import electrodynamics.common.block.subtype.SubtypeGasPipe; import electrodynamics.common.block.subtype.SubtypeMachine; import electrodynamics.common.block.subtype.SubtypeWire; -import electrodynamics.common.block.subtype.SubtypeWire.Conductor; +import electrodynamics.common.block.subtype.SubtypeWire.WireMaterial; import electrodynamics.common.block.subtype.SubtypeWire.InsulationMaterial; import electrodynamics.common.block.subtype.SubtypeWire.WireClass; import electrodynamics.common.block.subtype.SubtypeWire.WireColor; import electrodynamics.common.item.subtype.*; +import electrodynamics.datagen.DataGenerators; import electrodynamics.registers.ElectrodynamicsBlocks; import electrodynamics.registers.ElectrodynamicsItems; import net.minecraft.core.registries.BuiltInRegistries; @@ -154,28 +155,28 @@ protected void registerModels() { } // bare - for (SubtypeWire wire : SubtypeWire.getWires(Conductor.values(), InsulationMaterial.BARE, WireClass.BARE, WireColor.NONE)) { + for (SubtypeWire wire : DataGenerators.getWires(WireMaterial.values(), InsulationMaterial.BARE, WireClass.BARE, WireColor.NONE)) { layeredBuilder(name(ElectrodynamicsItems.ITEMS_WIRE.getValue(wire)), Parent.GENERATED, itemLoc("wire/" + wire.tag())).transforms().transform(ItemDisplayContext.GUI).scale(0.7F).end(); } // insulated - for (SubtypeWire wire : SubtypeWire.getWires(Conductor.values(), InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.values())) { - layeredItem(ElectrodynamicsItems.ITEMS_WIRE.getValue(wire), Parent.GENERATED, itemLoc("wire/wireinsulated" + wire.conductor.toString()), itemLoc("wire/wireinsulatedcoil")); + for (SubtypeWire wire : DataGenerators.getWires(WireMaterial.values(), InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.values())) { + layeredItem(ElectrodynamicsItems.ITEMS_WIRE.getValue(wire), Parent.GENERATED, itemLoc("wire/wireinsulated" + wire.getWireMaterial().toString()), itemLoc("wire/wireinsulatedcoil")); } // logistical - for (SubtypeWire wire : SubtypeWire.getWires(Conductor.values(), InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.values())) { - layeredItem(ElectrodynamicsItems.ITEMS_WIRE.getValue(wire), Parent.GENERATED, itemLoc("wire/wirelogistics" + wire.conductor.toString()), itemLoc("wire/wirelogisticscoil"), itemLoc("wire/wirelogisticsredstone")); + for (SubtypeWire wire : DataGenerators.getWires(WireMaterial.values(), InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.values())) { + layeredItem(ElectrodynamicsItems.ITEMS_WIRE.getValue(wire), Parent.GENERATED, itemLoc("wire/wirelogistics" + wire.getWireMaterial().toString()), itemLoc("wire/wirelogisticscoil"), itemLoc("wire/wirelogisticsredstone")); } // ceramic - for (SubtypeWire wire : SubtypeWire.getWires(Conductor.values(), InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.values())) { - layeredItem(ElectrodynamicsItems.ITEMS_WIRE.getValue(wire), Parent.GENERATED, itemLoc("wire/wireceramicinsulated" + wire.conductor.toString()), itemLoc("wire/wireceramicinsulatedcolortips"), itemLoc("wire/wireceramicinsulatedcoil")); + for (SubtypeWire wire : DataGenerators.getWires(WireMaterial.values(), InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.values())) { + layeredItem(ElectrodynamicsItems.ITEMS_WIRE.getValue(wire), Parent.GENERATED, itemLoc("wire/wireceramicinsulated" + wire.getWireMaterial().toString()), itemLoc("wire/wireceramicinsulatedcolortips"), itemLoc("wire/wireceramicinsulatedcoil")); } // highly insulated - for (SubtypeWire wire : SubtypeWire.getWires(Conductor.values(), InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.values())) { - layeredItem(ElectrodynamicsItems.ITEMS_WIRE.getValue(wire), Parent.GENERATED, itemLoc("wire/wirehighlyinsulated" + wire.conductor.toString()), itemLoc("wire/wirehighlyinsulatedcoil")); + for (SubtypeWire wire : DataGenerators.getWires(WireMaterial.values(), InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.values())) { + layeredItem(ElectrodynamicsItems.ITEMS_WIRE.getValue(wire), Parent.GENERATED, itemLoc("wire/wirehighlyinsulated" + wire.getWireMaterial().toString()), itemLoc("wire/wirehighlyinsulatedcoil")); } for (SubtypeFluidPipe pipe : SubtypeFluidPipe.values()) { diff --git a/src/main/java/electrodynamics/datagen/client/ElectrodynamicsLangKeyProvider.java b/src/main/java/electrodynamics/datagen/client/ElectrodynamicsLangKeyProvider.java index 7904b10aa..ae69ff548 100644 --- a/src/main/java/electrodynamics/datagen/client/ElectrodynamicsLangKeyProvider.java +++ b/src/main/java/electrodynamics/datagen/client/ElectrodynamicsLangKeyProvider.java @@ -357,6 +357,8 @@ protected void addTranslations() { addBlock(ElectrodynamicsBlocks.BLOCK_THERMOELECTRICMANIPULATOR, "GTL Chamber"); addBlock(ElectrodynamicsBlocks.BLOCK_ADVANCED_THERMOELECTRICMANIPULATOR, "GTL Chamber MK2"); + addBlock(ElectrodynamicsBlocks.BLOCK_ROTARYUNIFIER, "Rotary Unifier"); + addBlock(ElectrodynamicsBlocks.BLOCKS_MACHINE.getValue(SubtypeMachine.gasvalve), "Gas Valve"); addBlock(ElectrodynamicsBlocks.BLOCKS_MACHINE.getValue(SubtypeMachine.fluidvalve), "Fluid Valve"); addBlock(ElectrodynamicsBlocks.BLOCKS_MACHINE.getValue(SubtypeMachine.gaspipepump), "Gas Pipe Pump"); @@ -807,6 +809,7 @@ protected void addTranslations() { addContainer(SubtypeMachine.advanceddowngradetransformer, "Downgrade Transformer Mk 2"); addContainer(SubtypeMachine.advancedupgradetransformer, "Upgrade Transformer Mk 2"); addContainer(SubtypeMachine.circuitmonitor, "Circuit Monitor"); + addContainer("rotaryunifier", "Rotary Unifier"); addTooltip("itemwire.resistance", "Resistance: %s"); addTooltip("itemwire.maxamps", "Ampacity: %s"); @@ -814,9 +817,11 @@ protected void addTranslations() { addTooltip("itemwire.info.uninsulated", "Uninsulated!"); addTooltip("itemwire.info.fireproof", "Fire-proof"); addTooltip("itemwire.info.redstone", "Conducts Redstone"); - addTooltip("info.capacityupgrade", "Multiplies Energy Capacity and Transfer by %sx"); - addTooltip("info.capacityupgradevoltage", "Will upgrade machine voltage up to %s"); - addTooltip("info.speedupgrade", "Multiplies Speed by %sx"); + addTooltip("info.upgradecapacity", "Capacity: %s"); + addTooltip("info.upgradeenergytransfer", "Energy Transfer: %s"); + addTooltip("info.upgradevoltage", "Voltage: %s"); + addTooltip("info.upgradespeed", "Speed: %s"); + addTooltip("info.upgradeenergyusage", "Usage: %s"); addTooltip("info.itemoutputupgrade", "Ejects items into adjacent inventories"); addTooltip("info.iteminputupgrade", "Injects items from adjacent inventories"); addTooltip("info.dirlist", "Current Directions:"); @@ -830,11 +835,10 @@ protected void addTranslations() { addTooltip("info.xpusage", "Shift+Right-Click to dispense"); addTooltip("info.range", "Increases raduis by 1"); addTooltip("info.broken", "NOT WORKING"); - addTooltip("transformer.energyloss", "Efficiency: 99.25%"); + addTooltip("transformer.energyloss", "Efficiency: %s"); addTooltip("machine.voltage", "Voltage: %s"); - addTooltip("item.electric.info", "Energy Stored: %s"); - addTooltip("item.electric.voltage", "I/O Voltage: %s"); - addTooltip("itemcanister", "1000 mB"); + addTooltip("item.electric.info", "Stored: %s"); + addTooltip("item.electric.voltage", "Voltage: %s"); addTooltip("railguntemp", "Temperature %s"); addTooltip("railgunmaxtemp", "Max Temp: %s"); addTooltip("railgunoverheat", "WARNING : OVERHEATING"); @@ -884,6 +888,8 @@ protected void addTranslations() { addTooltip("pipematerialsteel", "Steel"); addTooltip("pipematerialplastic", "Plastic"); + addTooltip("pipethroughput", "Throughput: %s"); + addTooltip("pipeinsulationnone", "None"); addTooltip("pipeinsulationwool", "Wool"); addTooltip("pipeinsulationceramic", "Ceramic"); @@ -931,6 +937,10 @@ protected void addTranslations() { addTooltip("electrolosischamber.satisfaction", "Satisfaction: %s"); addTooltip("electrolosischamber.procamount", "Processing Amount: %s"); + addTooltip("rotaryunifier.toggle", "Toggle Conversion"); + addTooltip("rotaryunifier.use1", "Gas must be 1 degree above"); + addTooltip("rotaryunifier.use2", "condensation temperature"); + addGuiLabel("creativepowersource.voltage", "Voltage: "); addGuiLabel("creativepowersource.power", "Power: "); addGuiLabel("creativefluidsource.setfluid", "Set Fluid"); diff --git a/src/main/java/electrodynamics/datagen/server/ElectrodynamicsLootTablesProvider.java b/src/main/java/electrodynamics/datagen/server/ElectrodynamicsLootTablesProvider.java index 0f60066e1..19585fd78 100644 --- a/src/main/java/electrodynamics/datagen/server/ElectrodynamicsLootTablesProvider.java +++ b/src/main/java/electrodynamics/datagen/server/ElectrodynamicsLootTablesProvider.java @@ -189,6 +189,8 @@ protected void generate() { addSimpleBlock(ElectrodynamicsBlocks.BLOCKS_MACHINE.getValue(SubtypeMachine.electrolosischamber)); + addSimpleBlock(ElectrodynamicsBlocks.BLOCK_ROTARYUNIFIER); + } public void addMachineTable(Block block, DeferredHolder, BlockEntityType> tilereg, boolean items, boolean fluids, boolean gases, boolean energy, boolean additional) { diff --git a/src/main/java/electrodynamics/datagen/server/recipe/types/vanilla/ElectrodynamicsCraftingTableRecipes.java b/src/main/java/electrodynamics/datagen/server/recipe/types/vanilla/ElectrodynamicsCraftingTableRecipes.java index 99b1c2e22..b0e3b56bf 100644 --- a/src/main/java/electrodynamics/datagen/server/recipe/types/vanilla/ElectrodynamicsCraftingTableRecipes.java +++ b/src/main/java/electrodynamics/datagen/server/recipe/types/vanilla/ElectrodynamicsCraftingTableRecipes.java @@ -9,13 +9,14 @@ import electrodynamics.common.block.subtype.SubtypeRawOreBlock; import electrodynamics.common.block.subtype.SubtypeResourceBlock; import electrodynamics.common.block.subtype.SubtypeWire; -import electrodynamics.common.block.subtype.SubtypeWire.Conductor; +import electrodynamics.common.block.subtype.SubtypeWire.WireMaterial; import electrodynamics.common.block.subtype.SubtypeWire.InsulationMaterial; import electrodynamics.common.block.subtype.SubtypeWire.WireClass; import electrodynamics.common.block.subtype.SubtypeWire.WireColor; import electrodynamics.common.item.subtype.*; import electrodynamics.common.recipe.recipeutils.EnchantmentIngredient; import electrodynamics.common.tags.ElectrodynamicsTags; +import electrodynamics.datagen.DataGenerators; import electrodynamics.datagen.utils.recipe.AbstractRecipeGenerator; import electrodynamics.datagen.utils.recipe.ShapedCraftingRecipeBuilder; import electrodynamics.datagen.utils.recipe.ShapelessCraftingRecipeBuilder; @@ -2935,9 +2936,9 @@ private void addGear(RecipeOutput output) { private void addWires(RecipeOutput output) { // Insulated Wires - for (SubtypeWire wire : SubtypeWire.getWires(Conductor.values(), InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BLACK)) { + for (SubtypeWire wire : DataGenerators.getWires(WireMaterial.values(), InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BLACK)) { - SubtypeWire uninsulated = SubtypeWire.getWire(wire.conductor, InsulationMaterial.BARE, WireClass.BARE, WireColor.NONE); + SubtypeWire uninsulated = DataGenerators.getWire(wire.getWireMaterial(), InsulationMaterial.BARE, WireClass.BARE, WireColor.NONE); ShapelessCraftingRecipeBuilder.start(ElectrodynamicsItems.ITEMS_WIRE.getValue(wire), 1) // @@ -2950,13 +2951,13 @@ private void addWires(RecipeOutput output) { } // Logistics Wires - for (SubtypeWire wire : SubtypeWire.getWires(Conductor.values(), InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.BLACK)) { + for (SubtypeWire wire : DataGenerators.getWires(WireMaterial.values(), InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.BLACK)) { - SubtypeWire insulated = SubtypeWire.getWire(wire.conductor, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BLACK); + SubtypeWire insulated = DataGenerators.getWire(wire.getWireMaterial(), InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BLACK); ShapelessCraftingRecipeBuilder.start(ElectrodynamicsItems.ITEMS_WIRE.getValue(wire), 1) // - .addIngredient(insulated.itemTag) + .addIngredient(insulated.getItemTag()) // .addIngredient(Tags.Items.DUSTS_REDSTONE) // @@ -2965,13 +2966,13 @@ private void addWires(RecipeOutput output) { } // Ceramic Insulated - for (SubtypeWire wire : SubtypeWire.getWires(Conductor.values(), InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.BROWN)) { + for (SubtypeWire wire : DataGenerators.getWires(WireMaterial.values(), InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.BROWN)) { - SubtypeWire insulated = SubtypeWire.getWire(wire.conductor, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BLACK); + SubtypeWire insulated = DataGenerators.getWire(wire.getWireMaterial(), InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BLACK); ShapelessCraftingRecipeBuilder.start(ElectrodynamicsItems.ITEMS_WIRE.getValue(wire), 1) // - .addIngredient(insulated.itemTag) + .addIngredient(insulated.getItemTag()) // .addIngredient(ElectrodynamicsItems.ITEM_CERAMICINSULATION.get()) // @@ -2980,17 +2981,17 @@ private void addWires(RecipeOutput output) { } // Highly Insulated - for (SubtypeWire wire : SubtypeWire.getWires(Conductor.values(), InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.BLACK)) { + for (SubtypeWire wire : DataGenerators.getWires(WireMaterial.values(), InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.BLACK)) { - SubtypeWire insulated = SubtypeWire.getWire(wire.conductor, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BLACK); + SubtypeWire insulated = DataGenerators.getWire(wire.getWireMaterial(), InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.BLACK); ShapelessCraftingRecipeBuilder.start(ElectrodynamicsItems.ITEMS_WIRE.getValue(wire), 2) // - .addIngredient(insulated.itemTag) + .addIngredient(insulated.getItemTag()) // - .addIngredient(insulated.itemTag) + .addIngredient(insulated.getItemTag()) // - .addIngredient(insulated.itemTag) + .addIngredient(insulated.getItemTag()) // .addIngredient(ElectrodynamicsItems.ITEM_INSULATION.get()) // @@ -3003,8 +3004,8 @@ private void addWires(RecipeOutput output) { } // Insulated Wires - for (SubtypeWire wire : SubtypeWire.getWires(Conductor.values(), InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.values())) { - if (wire.color.dyeTag == null) { + for (SubtypeWire wire : DataGenerators.getWires(WireMaterial.values(), InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.values())) { + if (wire.getWireColor().getDyeTag() == null) { continue; } ShapedCraftingRecipeBuilder.start(ElectrodynamicsItems.ITEMS_WIRE.getValue(wire), 8) @@ -3015,24 +3016,24 @@ private void addWires(RecipeOutput output) { // .addPattern("WWW") // - .addKey('W', wire.itemTag) + .addKey('W', wire.getItemTag()) // - .addKey('D', wire.color.dyeTag) + .addKey('D', wire.getWireColor().getDyeTag()) // .complete(References.ID, "wire_" + wire.name() + "_multi", output); ShapelessCraftingRecipeBuilder.start(ElectrodynamicsItems.ITEMS_WIRE.getValue(wire), 1) // - .addIngredient(wire.itemTag) + .addIngredient(wire.getItemTag()) // - .addIngredient(wire.color.dyeTag) + .addIngredient(wire.getWireColor().getDyeTag()) // .complete(References.ID, "wire_" + wire.name() + "_single", output); } // Highly Insulated Wires - for (SubtypeWire wire : SubtypeWire.getWires(Conductor.values(), InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.values())) { - if (wire.color.dyeTag == null) { + for (SubtypeWire wire : DataGenerators.getWires(WireMaterial.values(), InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.values())) { + if (wire.getWireColor().getDyeTag() == null) { continue; } ShapedCraftingRecipeBuilder.start(ElectrodynamicsItems.ITEMS_WIRE.getValue(wire), 8) @@ -3043,24 +3044,24 @@ private void addWires(RecipeOutput output) { // .addPattern("WWW") // - .addKey('W', wire.itemTag) + .addKey('W', wire.getItemTag()) // - .addKey('D', wire.color.dyeTag) + .addKey('D', wire.getWireColor().getDyeTag()) // .complete(References.ID, "wire_" + wire.name() + "_multi", output); ShapelessCraftingRecipeBuilder.start(ElectrodynamicsItems.ITEMS_WIRE.getValue(wire), 1) // - .addIngredient(wire.itemTag) + .addIngredient(wire.getItemTag()) // - .addIngredient(wire.color.dyeTag) + .addIngredient(wire.getWireColor().getDyeTag()) // .complete(References.ID, "wire_" + wire.name() + "_single", output); } // Ceramic Insulated Wires - for (SubtypeWire wire : SubtypeWire.getWires(Conductor.values(), InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.values())) { - if (wire.color.dyeTag == null) { + for (SubtypeWire wire : DataGenerators.getWires(WireMaterial.values(), InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.values())) { + if (wire.getWireColor().getDyeTag() == null) { continue; } ShapedCraftingRecipeBuilder.start(ElectrodynamicsItems.ITEMS_WIRE.getValue(wire), 8) @@ -3071,24 +3072,24 @@ private void addWires(RecipeOutput output) { // .addPattern("WWW") // - .addKey('W', wire.itemTag) + .addKey('W', wire.getItemTag()) // - .addKey('D', wire.color.dyeTag) + .addKey('D', wire.getWireColor().getDyeTag()) // .complete(References.ID, "wire_" + wire.name() + "_multi", output); ShapelessCraftingRecipeBuilder.start(ElectrodynamicsItems.ITEMS_WIRE.getValue(wire), 1) // - .addIngredient(wire.itemTag) + .addIngredient(wire.getItemTag()) // - .addIngredient(wire.color.dyeTag) + .addIngredient(wire.getWireColor().getDyeTag()) // .complete(References.ID, "wire_" + wire.name() + "_single", output); } // Ceramic Insulated Wires - for (SubtypeWire wire : SubtypeWire.getWires(Conductor.values(), InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.values())) { - if (wire.color.dyeTag == null) { + for (SubtypeWire wire : DataGenerators.getWires(WireMaterial.values(), InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.values())) { + if (wire.getWireColor().getDyeTag() == null) { continue; } ShapedCraftingRecipeBuilder.start(ElectrodynamicsItems.ITEMS_WIRE.getValue(wire), 8) @@ -3099,17 +3100,17 @@ private void addWires(RecipeOutput output) { // .addPattern("WWW") // - .addKey('W', wire.itemTag) + .addKey('W', wire.getItemTag()) // - .addKey('D', wire.color.dyeTag) + .addKey('D', wire.getWireColor().getDyeTag()) // .complete(References.ID, "wire_" + wire.name() + "_multi", output); ShapelessCraftingRecipeBuilder.start(ElectrodynamicsItems.ITEMS_WIRE.getValue(wire), 1) // - .addIngredient(wire.itemTag) + .addIngredient(wire.getItemTag()) // - .addIngredient(wire.color.dyeTag) + .addIngredient(wire.getWireColor().getDyeTag()) // .complete(References.ID, "wire_" + wire.name() + "_single", output); } diff --git a/src/main/java/electrodynamics/datagen/server/tags/types/ElectrodynamicsBlockTagsProvider.java b/src/main/java/electrodynamics/datagen/server/tags/types/ElectrodynamicsBlockTagsProvider.java index bacf1eed1..be62d6165 100644 --- a/src/main/java/electrodynamics/datagen/server/tags/types/ElectrodynamicsBlockTagsProvider.java +++ b/src/main/java/electrodynamics/datagen/server/tags/types/ElectrodynamicsBlockTagsProvider.java @@ -79,7 +79,9 @@ protected void addTags(Provider provider) { // .add(ElectrodynamicsBlocks.BLOCK_ADVANCED_THERMOELECTRICMANIPULATOR.get()) // - .add(ElectrodynamicsBlocks.BLOCK_CHEMICALREACTOREXTRA_TOP.get()); + .add(ElectrodynamicsBlocks.BLOCK_CHEMICALREACTOREXTRA_TOP.get()) + // + .add(ElectrodynamicsBlocks.BLOCK_ROTARYUNIFIER.get()); tag(BlockTags.MINEABLE_WITH_HOE) // @@ -149,7 +151,9 @@ protected void addTags(Provider provider) { // .add(ElectrodynamicsBlocks.BLOCK_ADVANCEDDECOMPRESSOR.get()) // - .add(ElectrodynamicsBlocks.BLOCK_ADVANCED_THERMOELECTRICMANIPULATOR.get()); + .add(ElectrodynamicsBlocks.BLOCK_ADVANCED_THERMOELECTRICMANIPULATOR.get()) + // + .add(ElectrodynamicsBlocks.BLOCK_ROTARYUNIFIER.get()); tag(BlockTags.NEEDS_IRON_TOOL) // diff --git a/src/main/java/electrodynamics/datagen/server/tags/types/ElectrodynamicsItemTagsProvider.java b/src/main/java/electrodynamics/datagen/server/tags/types/ElectrodynamicsItemTagsProvider.java index 25b4cee26..67718c7c5 100644 --- a/src/main/java/electrodynamics/datagen/server/tags/types/ElectrodynamicsItemTagsProvider.java +++ b/src/main/java/electrodynamics/datagen/server/tags/types/ElectrodynamicsItemTagsProvider.java @@ -7,8 +7,7 @@ import electrodynamics.common.block.subtype.SubtypeOreDeepslate; import electrodynamics.common.block.subtype.SubtypeRawOreBlock; import electrodynamics.common.block.subtype.SubtypeResourceBlock; -import electrodynamics.common.block.subtype.SubtypeWire; -import electrodynamics.common.block.subtype.SubtypeWire.Conductor; +import electrodynamics.common.block.subtype.SubtypeWire.WireMaterial; import electrodynamics.common.block.subtype.SubtypeWire.InsulationMaterial; import electrodynamics.common.block.subtype.SubtypeWire.WireClass; import electrodynamics.common.block.subtype.SubtypeWire.WireColor; @@ -24,6 +23,7 @@ import electrodynamics.common.item.subtype.SubtypeRawOre; import electrodynamics.common.item.subtype.SubtypeRod; import electrodynamics.common.tags.ElectrodynamicsTags; +import electrodynamics.datagen.DataGenerators; import electrodynamics.registers.ElectrodynamicsItems; import net.minecraft.core.HolderLookup; import net.minecraft.core.HolderLookup.Provider; @@ -124,53 +124,53 @@ protected void addTags(Provider pProvider) { tag(ElectrodynamicsTags.Items.INSULATES_PLAYER_FEET).add(ElectrodynamicsItems.ITEM_RUBBERBOOTS.get(), ElectrodynamicsItems.ITEM_COMPOSITEBOOTS.get(), ElectrodynamicsItems.ITEM_COMBATBOOTS.get()); - tag(ElectrodynamicsTags.Items.INSULATED_TIN_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], SubtypeWire.getWires(new Conductor[] { Conductor.TIN }, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.values()))); + tag(ElectrodynamicsTags.Items.INSULATED_TIN_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], DataGenerators.getWires(new WireMaterial[] { WireMaterial.TIN }, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.values()))); - tag(ElectrodynamicsTags.Items.INSULATED_SILVER_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], SubtypeWire.getWires(new Conductor[] { Conductor.SILVER }, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.values()))); + tag(ElectrodynamicsTags.Items.INSULATED_SILVER_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], DataGenerators.getWires(new WireMaterial[] { WireMaterial.SILVER }, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.values()))); - tag(ElectrodynamicsTags.Items.INSULATED_COPPER_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], SubtypeWire.getWires(new Conductor[] { Conductor.COPPER }, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.values()))); + tag(ElectrodynamicsTags.Items.INSULATED_COPPER_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], DataGenerators.getWires(new WireMaterial[] { WireMaterial.COPPER }, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.values()))); - tag(ElectrodynamicsTags.Items.INSULATED_GOLD_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], SubtypeWire.getWires(new Conductor[] { Conductor.GOLD }, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.values()))); + tag(ElectrodynamicsTags.Items.INSULATED_GOLD_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], DataGenerators.getWires(new WireMaterial[] { WireMaterial.GOLD }, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.values()))); - tag(ElectrodynamicsTags.Items.INSULATED_IRON_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], SubtypeWire.getWires(new Conductor[] { Conductor.IRON }, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.values()))); + tag(ElectrodynamicsTags.Items.INSULATED_IRON_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], DataGenerators.getWires(new WireMaterial[] { WireMaterial.IRON }, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.values()))); - tag(ElectrodynamicsTags.Items.INSULATED_SUPERCONDUCTIVE_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], SubtypeWire.getWires(new Conductor[] { Conductor.SUPERCONDUCTIVE }, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.values()))); + tag(ElectrodynamicsTags.Items.INSULATED_SUPERCONDUCTIVE_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], DataGenerators.getWires(new WireMaterial[] { WireMaterial.SUPERCONDUCTIVE }, InsulationMaterial.WOOL, WireClass.INSULATED, WireColor.values()))); - tag(ElectrodynamicsTags.Items.THICK_TIN_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], SubtypeWire.getWires(new Conductor[] { Conductor.TIN }, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.values()))); + tag(ElectrodynamicsTags.Items.THICK_TIN_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], DataGenerators.getWires(new WireMaterial[] { WireMaterial.TIN }, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.values()))); - tag(ElectrodynamicsTags.Items.THICK_SILVER_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], SubtypeWire.getWires(new Conductor[] { Conductor.SILVER }, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.values()))); + tag(ElectrodynamicsTags.Items.THICK_SILVER_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], DataGenerators.getWires(new WireMaterial[] { WireMaterial.SILVER }, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.values()))); - tag(ElectrodynamicsTags.Items.THICK_COPPER_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], SubtypeWire.getWires(new Conductor[] { Conductor.COPPER }, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.values()))); + tag(ElectrodynamicsTags.Items.THICK_COPPER_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], DataGenerators.getWires(new WireMaterial[] { WireMaterial.COPPER }, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.values()))); - tag(ElectrodynamicsTags.Items.THICK_GOLD_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], SubtypeWire.getWires(new Conductor[] { Conductor.GOLD }, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.values()))); + tag(ElectrodynamicsTags.Items.THICK_GOLD_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], DataGenerators.getWires(new WireMaterial[] { WireMaterial.GOLD }, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.values()))); - tag(ElectrodynamicsTags.Items.THICK_IRON_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], SubtypeWire.getWires(new Conductor[] { Conductor.IRON }, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.values()))); + tag(ElectrodynamicsTags.Items.THICK_IRON_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], DataGenerators.getWires(new WireMaterial[] { WireMaterial.IRON }, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.values()))); - tag(ElectrodynamicsTags.Items.THICK_SUPERCONDUCTIVE_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], SubtypeWire.getWires(new Conductor[] { Conductor.SUPERCONDUCTIVE }, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.values()))); + tag(ElectrodynamicsTags.Items.THICK_SUPERCONDUCTIVE_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], DataGenerators.getWires(new WireMaterial[] { WireMaterial.SUPERCONDUCTIVE }, InsulationMaterial.THICK_WOOL, WireClass.THICK, WireColor.values()))); - tag(ElectrodynamicsTags.Items.CERAMIC_TIN_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], SubtypeWire.getWires(new Conductor[] { Conductor.TIN }, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.values()))); + tag(ElectrodynamicsTags.Items.CERAMIC_TIN_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], DataGenerators.getWires(new WireMaterial[] { WireMaterial.TIN }, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.values()))); - tag(ElectrodynamicsTags.Items.CERAMIC_SILVER_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], SubtypeWire.getWires(new Conductor[] { Conductor.SILVER }, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.values()))); + tag(ElectrodynamicsTags.Items.CERAMIC_SILVER_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], DataGenerators.getWires(new WireMaterial[] { WireMaterial.SILVER }, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.values()))); - tag(ElectrodynamicsTags.Items.CERAMIC_COPPER_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], SubtypeWire.getWires(new Conductor[] { Conductor.COPPER }, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.values()))); + tag(ElectrodynamicsTags.Items.CERAMIC_COPPER_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], DataGenerators.getWires(new WireMaterial[] { WireMaterial.COPPER }, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.values()))); - tag(ElectrodynamicsTags.Items.CERAMIC_GOLD_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], SubtypeWire.getWires(new Conductor[] { Conductor.GOLD }, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.values()))); + tag(ElectrodynamicsTags.Items.CERAMIC_GOLD_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], DataGenerators.getWires(new WireMaterial[] { WireMaterial.GOLD }, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.values()))); - tag(ElectrodynamicsTags.Items.CERAMIC_IRON_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], SubtypeWire.getWires(new Conductor[] { Conductor.IRON }, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.values()))); + tag(ElectrodynamicsTags.Items.CERAMIC_IRON_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], DataGenerators.getWires(new WireMaterial[] { WireMaterial.IRON }, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.values()))); - tag(ElectrodynamicsTags.Items.CERAMIC_SUPERCONDUCTIVE_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], SubtypeWire.getWires(new Conductor[] { Conductor.SUPERCONDUCTIVE }, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.values()))); + tag(ElectrodynamicsTags.Items.CERAMIC_SUPERCONDUCTIVE_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], DataGenerators.getWires(new WireMaterial[] { WireMaterial.SUPERCONDUCTIVE }, InsulationMaterial.CERAMIC, WireClass.CERAMIC, WireColor.values()))); - tag(ElectrodynamicsTags.Items.LOGISTICAL_TIN_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], SubtypeWire.getWires(new Conductor[] { Conductor.TIN }, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.values()))); + tag(ElectrodynamicsTags.Items.LOGISTICAL_TIN_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], DataGenerators.getWires(new WireMaterial[] { WireMaterial.TIN }, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.values()))); - tag(ElectrodynamicsTags.Items.LOGISTICAL_SILVER_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], SubtypeWire.getWires(new Conductor[] { Conductor.SILVER }, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.values()))); + tag(ElectrodynamicsTags.Items.LOGISTICAL_SILVER_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], DataGenerators.getWires(new WireMaterial[] { WireMaterial.SILVER }, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.values()))); - tag(ElectrodynamicsTags.Items.LOGISTICAL_COPPER_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], SubtypeWire.getWires(new Conductor[] { Conductor.COPPER }, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.values()))); + tag(ElectrodynamicsTags.Items.LOGISTICAL_COPPER_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], DataGenerators.getWires(new WireMaterial[] { WireMaterial.COPPER }, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.values()))); - tag(ElectrodynamicsTags.Items.LOGISTICAL_GOLD_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], SubtypeWire.getWires(new Conductor[] { Conductor.GOLD }, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.values()))); + tag(ElectrodynamicsTags.Items.LOGISTICAL_GOLD_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], DataGenerators.getWires(new WireMaterial[] { WireMaterial.GOLD }, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.values()))); - tag(ElectrodynamicsTags.Items.LOGISTICAL_IRON_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], SubtypeWire.getWires(new Conductor[] { Conductor.IRON }, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.values()))); + tag(ElectrodynamicsTags.Items.LOGISTICAL_IRON_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], DataGenerators.getWires(new WireMaterial[] { WireMaterial.IRON }, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.values()))); - tag(ElectrodynamicsTags.Items.LOGISTICAL_SUPERCONDUCTIVE_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], SubtypeWire.getWires(new Conductor[] { Conductor.SUPERCONDUCTIVE }, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.values()))); + tag(ElectrodynamicsTags.Items.LOGISTICAL_SUPERCONDUCTIVE_WIRES).add(ElectrodynamicsItems.ITEMS_WIRE.getSpecificValuesArray(new BlockItemWire[0], DataGenerators.getWires(new WireMaterial[] { WireMaterial.SUPERCONDUCTIVE }, InsulationMaterial.WOOL, WireClass.LOGISTICAL, WireColor.values()))); } diff --git a/src/main/java/electrodynamics/prefab/item/ItemElectric.java b/src/main/java/electrodynamics/prefab/item/ItemElectric.java index c73e942f5..7edc294b9 100644 --- a/src/main/java/electrodynamics/prefab/item/ItemElectric.java +++ b/src/main/java/electrodynamics/prefab/item/ItemElectric.java @@ -2,7 +2,6 @@ import java.util.List; import java.util.function.Function; -import java.util.function.Supplier; import electrodynamics.api.electricity.formatting.ChatFormatter; import electrodynamics.api.electricity.formatting.DisplayUnit; @@ -21,7 +20,6 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.item.TooltipFlag; -import net.minecraft.world.level.Level; public class ItemElectric extends ItemElectrodynamics implements IItemElectric { @@ -38,7 +36,7 @@ public ItemElectric(ElectricItemProperties properties, Holder c public void addCreativeModeItems(CreativeModeTab group, List items) { ItemStack empty = new ItemStack(this); - IItemElectric.setEnergyStored(empty, 0); + //IItemElectric.setEnergyStored(empty, 0); items.add(empty); ItemStack charged = new ItemStack(this); IItemElectric.setEnergyStored(charged, getMaximumCapacity(charged)); @@ -59,8 +57,8 @@ public boolean isBarVisible(ItemStack stack) { @Override public void appendHoverText(ItemStack stack, TooltipContext context, List tooltip, TooltipFlag flagIn) { super.appendHoverText(stack, context, tooltip, flagIn); - tooltip.add(ElectroTextUtils.tooltip("item.electric.info", ChatFormatter.getChatDisplayShort(getJoulesStored(stack), DisplayUnit.JOULES)).withStyle(ChatFormatting.GRAY)); - tooltip.add(ElectroTextUtils.tooltip("item.electric.voltage", ElectroTextUtils.ratio(ChatFormatter.getChatDisplayShort(properties.receive.getVoltage(), DisplayUnit.VOLTAGE), ChatFormatter.getChatDisplayShort(properties.extract.getVoltage(), DisplayUnit.VOLTAGE))).withStyle(ChatFormatting.RED)); + tooltip.add(ElectroTextUtils.tooltip("item.electric.info", ElectroTextUtils.ratio(ChatFormatter.getChatDisplayShort(getJoulesStored(stack), DisplayUnit.JOULES), ChatFormatter.getChatDisplayShort(getMaximumCapacity(stack), DisplayUnit.JOULES)).withStyle(ChatFormatting.GRAY)).withStyle(ChatFormatting.DARK_GRAY)); + tooltip.add(ElectroTextUtils.tooltip("item.electric.voltage", ChatFormatter.getChatDisplayShort(properties.receive.getVoltage(), DisplayUnit.VOLTAGE).withStyle(ChatFormatting.GRAY)).withStyle(ChatFormatting.DARK_GRAY)); if (getDefaultStorageBattery() != Items.AIR) { IItemElectric.addBatteryTooltip(stack, context, tooltip); } diff --git a/src/main/java/electrodynamics/prefab/network/AbstractNetwork.java b/src/main/java/electrodynamics/prefab/network/AbstractNetwork.java index 83c5d23ed..ccbcbb630 100644 --- a/src/main/java/electrodynamics/prefab/network/AbstractNetwork.java +++ b/src/main/java/electrodynamics/prefab/network/AbstractNetwork.java @@ -1,201 +1,468 @@ package electrodynamics.prefab.network; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; +import java.util.*; import javax.annotation.Nonnull; import electrodynamics.api.network.ITickableNetwork; -import electrodynamics.api.network.cable.IAbstractCable; import electrodynamics.api.network.util.AbstractNetworkFinder; import electrodynamics.common.network.NetworkRegistry; +import electrodynamics.prefab.tile.types.GenericRefreshingConnectTile; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; -public abstract class AbstractNetwork implements ITickableNetwork { - - public HashSet conductorSet = new HashSet<>(); - public HashSet acceptorSet = new HashSet<>(); - public HashMap> acceptorInputMap = new HashMap<>(); - public HashMap> conductorTypeMap = new HashMap<>(); - public double networkMaxTransfer; - public double transmittedLastTick; - public double transmittedThisTick; - public boolean fixed; - - public void refresh() { - Iterator it = conductorSet.iterator(); - acceptorSet.clear(); - acceptorInputMap.clear(); - while (it.hasNext()) { - C conductor = it.next(); - if (conductor == null || ((BlockEntity) conductor).isRemoved()) { - it.remove(); - } else { - conductor.setNetwork(this); - } - } - for (C conductor : conductorSet) { - BlockEntity tileEntity = (BlockEntity) conductor; - for (Direction direction : Direction.values()) { - BlockEntity acceptor = tileEntity.getLevel().getBlockEntity(new BlockPos(tileEntity.getBlockPos()).offset(direction.getNormal())); - if (acceptor != null && !isConductorClass(acceptor) && isAcceptor(acceptor, direction) && canConnect(acceptor, direction)) { - acceptorSet.add((A) acceptor); - updateRecieverStatistics((A) acceptor, direction); - HashSet directions = acceptorInputMap.containsKey(acceptor) ? acceptorInputMap.get(acceptor) : new HashSet<>(); - directions.add(direction.getOpposite()); - acceptorInputMap.put((A) acceptor, directions); - - } - } - } - updateStatistics(); - } - - public double getActiveTransmitted() { - return transmittedLastTick; - } - - public void updateStatistics() { - conductorTypeMap.clear(); - for (T type : getConductorTypes()) { - conductorTypeMap.put(type, new HashSet<>()); - } - for (C wire : conductorSet) { - conductorTypeMap.get(wire.getConductorType()).add(wire); - networkMaxTransfer = networkMaxTransfer == 0 ? wire.getMaxTransfer() : Math.min(networkMaxTransfer, wire.getMaxTransfer()); - updateConductorStatistics(wire); - } - for (A reciever : acceptorSet) { - for (Direction dir : acceptorInputMap.getOrDefault(reciever, new HashSet<>())) { - updateRecieverStatistics(reciever, dir); - } - } - } - - /** - * Override method to define statistics per-cable - * - * @param cable - */ - public void updateConductorStatistics(C cable) { - // Just a default method - } - - /** - * Override method to define statistics per-receiver - * - * @param reciever - */ - public void updateRecieverStatistics(A reciever, Direction dir) { - - } - - public void split(@Nonnull C splitPoint) { - if (splitPoint instanceof BlockEntity blockentity) { - removeFromNetwork(splitPoint); - BlockEntity[] connectedTiles = new BlockEntity[6]; - boolean[] dealtWith = { false, false, false, false, false, false }; - for (Direction direction : Direction.values()) { - BlockPos ex = blockentity.getBlockPos().offset(direction.getNormal()); - if (blockentity.getLevel().hasChunkAt(ex)) { - BlockEntity sideTile = blockentity.getLevel().getBlockEntity(ex); - if (sideTile != null) { - connectedTiles[Arrays.asList(Direction.values()).indexOf(direction)] = sideTile; - } - } - } - for (int countOne = 0; countOne < connectedTiles.length; countOne++) { - BlockEntity connectedBlockA = connectedTiles[countOne]; - if (connectedBlockA != null) { - if (isConductor(connectedBlockA, splitPoint) && !dealtWith[countOne]) { - AbstractNetworkFinder finder = new AbstractNetworkFinder<>(blockentity.getLevel(), connectedBlockA.getBlockPos(), this, blockentity.getBlockPos()); - List partNetwork = finder.exploreNetwork(); - for (int countTwo = countOne + 1; countTwo < connectedTiles.length; countTwo++) { - BlockEntity connectedBlockB = connectedTiles[countTwo]; - if (isConductor(connectedBlockB, (C) connectedBlockA) && !dealtWith[countTwo] && partNetwork.contains(connectedBlockB)) { - dealtWith[countTwo] = true; - } - } - AbstractNetwork newNetwork = createInstance(); - - for (BlockEntity tile : finder.iteratedTiles) { - if (tile != splitPoint) { - newNetwork.conductorSet.add((C) tile); - } - } - newNetwork.refresh(); - } - } - } - deregister(); - } - } - - public void merge(AbstractNetwork network) { - if (network != null && network != this) { - Set> networks = new HashSet<>(); - networks.add(this); - networks.add(network); - AbstractNetwork newNetwork = createInstance(networks); - newNetwork.refresh(); - } - } - - public void removeFromNetwork(C conductor) { - conductorSet.remove(conductor); - if (conductorSet.isEmpty()) { - deregister(); - } - } - - public void deregister() { - conductorSet.clear(); - acceptorSet.clear(); - acceptorInputMap.clear(); - conductorTypeMap.clear(); - NetworkRegistry.deregister(this); - } - - @Override - public int getSize() { - return conductorSet.size(); - } - - @Override - public void tick() { - transmittedLastTick = transmittedThisTick; - transmittedThisTick = 0; - } - - public double getNetworkMaxTransfer() { - return networkMaxTransfer; - } - - public P emit(P transfer, ArrayList ignored, boolean debug) { - return null; - } - - public abstract boolean isConductor(BlockEntity tile, C requestingCable); - - public abstract boolean isConductorClass(BlockEntity tile); - - public abstract boolean isAcceptor(BlockEntity acceptor, Direction orientation); - - public abstract boolean canConnect(BlockEntity acceptor, Direction orientation); - - public abstract AbstractNetwork createInstance(); - - public abstract AbstractNetwork createInstanceConductor(Set conductors); - - public abstract AbstractNetwork createInstance(Set> networks); - - public abstract T[] getConductorTypes(); +/** + * + * A graph network representing a type of cable that will update when something changes + * + * @param The type of the cable + * @param The type of the cable categories + * @param

The value this network will transport + * @param The type of this network + * + * @author aurilisdev + * @author skip999 + */ +public abstract class AbstractNetwork, T, P, TYPE extends AbstractNetwork> implements ITickableNetwork { + private final UUID id = UUID.randomUUID(); + + public final HashSet conductorSet = new HashSet<>(); + public final HashSet acceptorSet = new HashSet<>(); + public final HashMap> acceptorInputMap = new HashMap<>(); + public double networkMaxTransfer; + public double transmittedLastTick; + public double transmittedThisTick; + + + /** + * Updates this network with the passed in receivers + * + * @param receivers the receivers that have changed + */ + public void updateRecievers(List receivers) { + + boolean updateRecieverStatistics = false; + + for (GenericRefreshingConnectTile.UpdatedReceiver receiver : receivers) { + + if (receiver.reciever() == null) { + continue; + } + + updateRecieverStatistics = updateReceiver(receiver.reciever(), receiver.removed(), receiver.dir()); + } + + // check if we need to recheck the overall statistics + if(updateRecieverStatistics) { + + resetReceiverStatistics(); + + for(BlockEntity entity : acceptorSet) { + + for(Direction dir : acceptorInputMap.getOrDefault(entity, new HashSet<>())) { + updateRecieverStatistics(entity, dir); + } + + } + + } + + } + + /** + * Updates this network with the passed in receiver + * + * @param entity the receiver + * @param remove whether the receiver was removed + * @param dir the direction this network is connected to the receiver on + * @return whether the overall receiver statistics need to be updated + */ + private boolean updateReceiver(BlockEntity entity, boolean remove, Direction dir) { + + HashSet dirs; + + if(remove) { + + if (!entity.isRemoved() && acceptorInputMap.containsKey(entity)) { + + dirs = acceptorInputMap.get(entity); + dirs.remove(dir.getOpposite()); + acceptorInputMap.put(entity, dirs); + + } else if (entity.isRemoved()) { + + acceptorSet.remove(entity); + acceptorInputMap.remove(entity); + return true; + + } + + } else { + + acceptorSet.add(entity); + dirs = acceptorInputMap.getOrDefault(entity, new HashSet<>()); + dirs.add(dir.getOpposite()); + acceptorInputMap.put(entity, dirs); + updateRecieverStatistics(entity, dir); + + } + + return false; + + } + + /** + * Updates this network with the passed in cables + * + * @param conductors the cables that have changed + */ + public void updateConductors(List> conductors) { + + boolean updateConductorStatistics = false; + + for(GenericRefreshingConnectTile.UpdatedConductor conductor : conductors) { + if(conductor.conductor() == null) { + continue; + } + + updateConductorStatistics = updateConductor(conductor.conductor(), conductor.removed()); + + } + + if(updateConductorStatistics) { + + resetConductorStatistics(); + + for(C conductor : conductorSet) { + + updateConductorStatistics(conductor, false); + + } + + } + + } + + /** + * Updates this network with the passed in cable + * + * @param conductor the cable + * @param remove whether the cable was removed + * @return whether the overall cable statistics need to be updated + */ + public boolean updateConductor(C conductor, boolean remove) { + + boolean updateConductorStatistics = false; + + if(remove) { + + updateConductorStatistics = true; + + } else { + + conductorSet.add(conductor); + + conductor.setNetwork((TYPE) this); + + updateConductorStatistics(conductor, false); + + } + + + + int index = 0; + + List receivers = new ArrayList<>(); + + for(BlockEntity entity : conductor.getConectedRecievers()) { + + if(entity == null) { + index++; + continue; + } + + receivers.add(new GenericRefreshingConnectTile.UpdatedReceiver(entity, remove, Direction.values()[index])); + + index++; + + } + + updateRecievers(receivers); + + return updateConductorStatistics; + + } + + /** + * This method will refresh the entire network, so use it if you know what you're doing + */ + public void refreshNewNetwork() { + Iterator it = conductorSet.iterator(); + acceptorSet.clear(); + acceptorInputMap.clear(); + while (it.hasNext()) { + C conductor = it.next(); + if (conductor == null || conductor.isRemoved()) { + it.remove(); + } else { + conductor.setNetwork((TYPE) this); + + int i = 0; + Direction dir; + + for (BlockEntity acceptor : conductor.getConectedRecievers()) { + + if (acceptor == null) { + i++; + continue; + } + + dir = Direction.values()[i]; + + acceptorSet.add(acceptor); + + updateRecieverStatistics(acceptor, dir); + + HashSet directions = acceptorInputMap.getOrDefault(acceptor, new HashSet<>()); + + directions.add(dir.getOpposite()); + + acceptorInputMap.put(acceptor, directions); + + i++; + + } + + + } + } + updateNewNetworkStatistics(); + } + + /** + * Updates the statics of the entire network + */ + public void updateNewNetworkStatistics() { + for (C wire : conductorSet) { + networkMaxTransfer = networkMaxTransfer == 0 ? wire.getMaxTransfer() : Math.min(networkMaxTransfer, wire.getMaxTransfer()); + updateConductorStatistics(wire, false); + } + for (BlockEntity reciever : acceptorSet) { + for (Direction dir : acceptorInputMap.getOrDefault(reciever, new HashSet<>())) { + updateRecieverStatistics(reciever, dir); + } + } + } + + /** + * Override method to define statistics per-cable + * + * @param cable + */ + public void updateConductorStatistics(C cable, boolean remove) { + + } + + /** + * Override to reset specific receiver parameters when #updateReceiver returns true + */ + public void resetReceiverStatistics() { + + } + + /** + * Override to reset specific conductor parameters when #updateConductor returns true + */ + public void resetConductorStatistics() { + + } + + /** + * Override method to define statistics per-receiver + * + * @param reciever + */ + public void updateRecieverStatistics(BlockEntity reciever, Direction dir) { + + } + + /** + * Splits this network at the specified cable + * + * @param splitPoint the cable this network is being split at + */ + public void split(@Nonnull C splitPoint) { + + removeFromNetwork(splitPoint); + + BlockEntity[] connectedTiles = new BlockEntity[6]; + + boolean[] dealtWith = {false, false, false, false, false, false}; + + BlockPos relative; + BlockEntity sideTile; + Level world = splitPoint.getLevel(); + int ordinal; + + for (Direction direction : Direction.values()) { + + ordinal = direction.ordinal(); + + relative = splitPoint.getBlockPos().relative(direction); + + if (!world.hasChunkAt(relative)) { + continue; + } + + sideTile = world.getBlockEntity(relative); + + if (sideTile == null) { + continue; + } + + connectedTiles[ordinal] = sideTile; + } + + for(int index = 0; index < 6; index++) { + + BlockEntity tile = connectedTiles[index]; + + if (tile == null || !isConductor(tile, splitPoint) || dealtWith[index]) { + continue; + } + + Set explored = new AbstractNetworkFinder<>(world, tile.getBlockPos(), this, splitPoint.getBlockPos()).exploreNetwork(); + + for (int i = index + 1; i < 6; i++) { + + BlockEntity connection = connectedTiles[i]; + + if (isConductor(connection, (C) tile) && !dealtWith[i] && explored.contains(connection)) { + + dealtWith[i] = true; + + } + } + + explored.remove(splitPoint); + + TYPE newNetwork = createInstanceConductor(explored); + + newNetwork.refreshNewNetwork(); + + } + + deregister(); + } + + /** + * removes the specified cable from the network + * + * @param conductor the cable to be removed + */ + public void removeFromNetwork(C conductor) { + conductorSet.remove(conductor); + updateConductorStatistics(conductor, true); + if (conductorSet.isEmpty()) { + deregister(); + } + } + + /** + * Removes this network from the registry + */ + public void deregister() { + conductorSet.clear(); + acceptorSet.clear(); + acceptorInputMap.clear(); + NetworkRegistry.deregister(this); + } + + /** + * returns the size of this network + * + * @return the size of this network + */ + @Override + public int getSize() { + return conductorSet.size(); + } + + /** + * This fires every tick on the server + */ + @Override + public void tick() { + transmittedLastTick = transmittedThisTick; + transmittedThisTick = 0; + } + + /** + * returns the amount of the specified value that is currently being transmitted over this network + * + * @return the amount currently being transmitted + */ + public double getActiveTransmitted() { + return transmittedLastTick; + } + + /** + * returns the maximum amount this network can transport per tick + * + * @return the maximum amount this network can transport per tick + */ + public double getNetworkMaxTransfer() { + return networkMaxTransfer; + } + + /** + * takes the input value and emits it to valid receivers on the network + * + * @param transfer the value to be emitted + * @param ignored the receivers to be ignored + * @param debug whether this should be simulated or not + * + * @return the amount that was accepted + */ + public abstract P emit(P transfer, ArrayList ignored, boolean debug); + + /** + * Checks if the tile is a cable or not + * + * @param tile the tile to check + * @param requestingCable the cable in this network requesting the check + * + * @return whether the tile is a cable or not + */ + public abstract boolean isConductor(BlockEntity tile, C requestingCable); + + /** + * Creates a new instance of this network from the input set of cables + * + * @param conductors the set of cables + * + * @return a new instance of this network + */ + public abstract TYPE createInstanceConductor(Set conductors); + + @Override + public boolean equals(Object obj) { + if(obj instanceof AbstractNetwork network) { + return network.id.equals(id); + } + return false; + } + + /** + * returns the ID of this network + * + * @return this network's ID + */ + @Override + public UUID getId() { + return id; + } } \ No newline at end of file diff --git a/src/main/java/electrodynamics/prefab/properties/PropertyTypes.java b/src/main/java/electrodynamics/prefab/properties/PropertyTypes.java index 3f38d2787..f628ffb9c 100644 --- a/src/main/java/electrodynamics/prefab/properties/PropertyTypes.java +++ b/src/main/java/electrodynamics/prefab/properties/PropertyTypes.java @@ -278,9 +278,13 @@ public class PropertyTypes { // Location.STREAM_CODEC, // - writer -> writer.prop().get().writeToNBT(writer.tag(), writer.prop().getName()), + writer -> { + CompoundTag tag = new CompoundTag(); + writer.prop().get().writeToNBT(tag, ""); + writer.tag().put(writer.prop().getName(), tag); + }, // - reader -> Location.readFromNBT(reader.tag(), reader.prop().getName()) + reader -> Location.readFromNBT(reader.tag().getCompound(reader.prop().getName()), "") // ); diff --git a/src/main/java/electrodynamics/prefab/tile/components/type/ComponentFluidHandlerMulti.java b/src/main/java/electrodynamics/prefab/tile/components/type/ComponentFluidHandlerMulti.java index bb51776e6..9fd94a76e 100644 --- a/src/main/java/electrodynamics/prefab/tile/components/type/ComponentFluidHandlerMulti.java +++ b/src/main/java/electrodynamics/prefab/tile/components/type/ComponentFluidHandlerMulti.java @@ -455,7 +455,7 @@ public boolean isFluidValid(int tank, @NotNull FluidStack stack) { @Override public int fill(FluidStack resource, FluidAction action) { for (PropertyFluidTank tank : tanks) { - if (tank.getFluid().getFluid().isSame(resource.getFluid())) { + if (tank.getFluid().is(resource.getFluid())) { return tank.fill(resource, action); } } @@ -521,7 +521,7 @@ public int fill(FluidStack resource, FluidAction action) { @Override public @NotNull FluidStack drain(FluidStack resource, FluidAction action) { for (PropertyFluidTank tank : tanks) { - if (tank.getFluid().getFluid().isSame(resource.getFluid())) { + if (tank.getFluid().is(resource.getFluid())) { return tank.drain(resource, action); } } diff --git a/src/main/java/electrodynamics/prefab/tile/components/type/ComponentGasHandlerMulti.java b/src/main/java/electrodynamics/prefab/tile/components/type/ComponentGasHandlerMulti.java index b0318379d..75ea82c5d 100644 --- a/src/main/java/electrodynamics/prefab/tile/components/type/ComponentGasHandlerMulti.java +++ b/src/main/java/electrodynamics/prefab/tile/components/type/ComponentGasHandlerMulti.java @@ -562,7 +562,7 @@ public boolean isGasValid(int tank, GasStack gas) { @Override public int fill(GasStack gas, GasAction action) { for(PropertyGasTank tank : tanks){ - if(tank.getGas().getGas().equals(gas.getGas())){ + if(tank.getGas().is(gas.getGas())){ return tank.fill(gas, action); } } @@ -642,7 +642,7 @@ public int fill(GasStack gas, GasAction action) { @Override public GasStack drain(GasStack gas, GasAction action) { for(PropertyGasTank tank : tanks) { - if(tank.getGas().getGas().equals(gas.getGas())){ + if(tank.getGas().is(gas.getGas())){ return tank.drain(gas, action); } } diff --git a/src/main/java/electrodynamics/prefab/tile/types/GenericConnectTile.java b/src/main/java/electrodynamics/prefab/tile/types/GenericConnectTile.java index 1a713b0cd..96296391b 100644 --- a/src/main/java/electrodynamics/prefab/tile/types/GenericConnectTile.java +++ b/src/main/java/electrodynamics/prefab/tile/types/GenericConnectTile.java @@ -25,13 +25,27 @@ public abstract class GenericConnectTile extends GenericTile implements IConnect public static final int WEST_MASK = 0b00000000000011110000000000000000; public static final int EAST_MASK = 0b00000000111100000000000000000000; + protected EnumConnectType[] connectionsArr = { + EnumConnectType.NONE, + EnumConnectType.NONE, + EnumConnectType.NONE, + EnumConnectType.NONE, + EnumConnectType.NONE, + EnumConnectType.NONE + }; + public final Property connections = property(new Property<>(PropertyTypes.INTEGER, "connections", 0).setShouldUpdateOnChange().onChange((property, old) -> { requestModelDataUpdate(); - if(level != null && level.isClientSide()){ + if (level != null && level.isClientSide()) { level.sendBlockUpdated(getBlockPos(), getBlockState(), getBlockState(), 8); // } - }).onTileLoaded(property -> requestModelDataUpdate())); + connectionsArr = readConnectionsInternal(property.get()); + + }).onTileLoaded(property -> { + requestModelDataUpdate(); + connectionsArr = readConnectionsInternal(property.get()); + }).setNoUpdateServer()); public final Property camoflaugedBlock = property(new Property<>(PropertyTypes.BLOCK_STATE, "camoflaugedblock", Blocks.AIR.defaultBlockState())).setShouldUpdateOnChange().onChange((property, block) -> { if (level == null) { @@ -82,34 +96,31 @@ public boolean isScaffoldAir() { return getScaffoldBlock().isAir(); } - public EnumConnectType readConnection(Direction dir) { - + public EnumConnectType readConnection(Direction dir, int connections) { - int connectionData = connections.get(); - - if (connectionData == 0) { + if (connections == 0) { return EnumConnectType.NONE; } int extracted = 0; switch (dir) { case DOWN: - extracted = connectionData & DOWN_MASK; + extracted = connections & DOWN_MASK; break; case UP: - extracted = connectionData & UP_MASK; + extracted = connections & UP_MASK; break; case NORTH: - extracted = connectionData & NORTH_MASK; + extracted = connections & NORTH_MASK; break; case SOUTH: - extracted = connectionData & SOUTH_MASK; + extracted = connections & SOUTH_MASK; break; case WEST: - extracted = connectionData & WEST_MASK; + extracted = connections & WEST_MASK; break; case EAST: - extracted = connectionData & EAST_MASK; + extracted = connections & EAST_MASK; break; default: break; @@ -121,11 +132,49 @@ public EnumConnectType readConnection(Direction dir) { } - public void writeConnection(Direction dir, EnumConnectType connection) { + public boolean writeConnections(Direction[] dirs, EnumConnectType[] connections) { + + int connectionData = this.connections.get(); + int masked; + + for (Direction dir : dirs) { + switch (dir) { + case DOWN: + masked = connectionData & ~DOWN_MASK; + break; + case UP: + masked = connectionData & ~UP_MASK; + break; + case NORTH: + masked = connectionData & ~NORTH_MASK; + break; + case SOUTH: + masked = connectionData & ~SOUTH_MASK; + break; + case WEST: + masked = connectionData & ~WEST_MASK; + break; + case EAST: + masked = connectionData & ~EAST_MASK; + break; + default: + masked = 0; + break; + } + connectionData = masked | (connections[dir.ordinal()].ordinal() << (dir.ordinal() * 4)); + } + + this.connections.set(connectionData); + + return this.connections.isDirty(); + + } + public boolean writeConnection(Direction dir, EnumConnectType connection) { int connectionData = this.connections.get(); int masked; + switch (dir) { case DOWN: masked = connectionData & ~DOWN_MASK; @@ -149,17 +198,24 @@ public void writeConnection(Direction dir, EnumConnectType connection) { masked = 0; break; } + connectionData = masked | (connection.ordinal() << (dir.ordinal() * 4)); + - connections.set(masked | (connection.ordinal() << (dir.ordinal() * 4))); + this.connections.set(connectionData); + return this.connections.isDirty(); } public EnumConnectType[] readConnections() { - EnumConnectType[] connections = new EnumConnectType[6]; + return connectionsArr; + } + + private EnumConnectType[] readConnectionsInternal(int connections) { + EnumConnectType[] arr = new EnumConnectType[6]; for (Direction dir : Direction.values()) { - connections[dir.ordinal()] = readConnection(dir); + arr[dir.ordinal()] = readConnection(dir, connections); } - return connections; + return arr; } @Override @@ -167,4 +223,5 @@ public EnumConnectType[] readConnections() { return ModelData.builder().with(ModelPropertyConnections.INSTANCE, () -> readConnections()).build(); } + } diff --git a/src/main/java/electrodynamics/prefab/tile/types/GenericRefreshingConnectTile.java b/src/main/java/electrodynamics/prefab/tile/types/GenericRefreshingConnectTile.java new file mode 100644 index 000000000..e4f3ea4ea --- /dev/null +++ b/src/main/java/electrodynamics/prefab/tile/types/GenericRefreshingConnectTile.java @@ -0,0 +1,272 @@ +package electrodynamics.prefab.tile.types; + +import com.google.common.collect.Sets; +import com.mojang.datafixers.util.Pair; +import electrodynamics.api.network.cable.IRefreshableCable; +import electrodynamics.common.block.connect.util.EnumConnectType; +import electrodynamics.prefab.network.AbstractNetwork; +import electrodynamics.prefab.utilities.Scheduler; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +public abstract class GenericRefreshingConnectTile, NETWORK extends AbstractNetwork> extends GenericConnectTile implements IRefreshableCable { + + private final EnumConnectType[] previousConnections = {EnumConnectType.NONE, EnumConnectType.NONE, EnumConnectType.NONE, EnumConnectType.NONE, EnumConnectType.NONE, EnumConnectType.NONE}; + protected final BlockEntity[] recieverConnections = new BlockEntity[6]; + protected final BlockEntity[] prevRecieverConnections = new BlockEntity[6]; + protected final BlockEntity[] cableConnections = new BlockEntity[6]; + protected final BlockEntity[] prevCableConnections = new BlockEntity[6]; + protected final HashSet connectionSet = new HashSet<>(); + + private NETWORK network; + + public boolean isQueued = false; + + public GenericRefreshingConnectTile(BlockEntityType tile, BlockPos pos, BlockState state) { + super(tile, pos, state); + } + + public Pair, List>> updateAdjacent(Direction[] dirs) { + + boolean flag = false; + int ordinal; + EnumConnectType prevConnection, connection; + + List updatedRecievers = new ArrayList<>(); + List> updatedConductors = new ArrayList<>(); + + for (Direction dir : dirs) { + + ordinal = dir.ordinal(); + connection = connectionsArr[ordinal]; + prevConnection = previousConnections[ordinal]; + + BlockEntity entity = level.getBlockEntity(worldPosition.relative(dir)); + + if (prevConnection == connection) { + continue; + } + + if (connection == EnumConnectType.NONE && prevConnection == EnumConnectType.WIRE) { + updatedConductors.add(new UpdatedConductor<>((CONDUCTOR) prevCableConnections[ordinal], true)); + } else if (connection == EnumConnectType.WIRE && prevConnection == EnumConnectType.NONE) { + updatedConductors.add(new UpdatedConductor<>((CONDUCTOR) entity, false)); + } else if (connection == EnumConnectType.NONE && prevConnection == EnumConnectType.INVENTORY) { + updatedRecievers.add(new UpdatedReceiver(prevRecieverConnections[ordinal], true, dir)); + } else if (connection == EnumConnectType.INVENTORY && prevConnection == EnumConnectType.NONE) { + updatedRecievers.add(new UpdatedReceiver(entity, false, dir)); + } + + prevCableConnections[ordinal] = cableConnections[ordinal]; + prevRecieverConnections[ordinal] = recieverConnections[ordinal]; + recieverConnections[ordinal] = null; + cableConnections[ordinal] = null; + + if (connection == EnumConnectType.WIRE) { + cableConnections[ordinal] = entity; + } else if (connection == EnumConnectType.INVENTORY) { + recieverConnections[ordinal] = entity; + } + previousConnections[ordinal] = connection; + flag = true; + + } + + if (flag) { + connectionSet.clear(); + for (BlockEntity entity : cableConnections) { + if (entity == null) { + continue; + } + connectionSet.add((CONDUCTOR) entity); + } + } + + return Pair.of(updatedRecievers, updatedConductors); + } + + @Override + public NETWORK getNetwork() { + return network; + } + + @Override + public void createNetworkFromThis() { + network = createInstanceConductor(Sets.newHashSet((CONDUCTOR) this)); + network.refreshNewNetwork(); + } + + @Override + public void setNetwork(NETWORK network) { + if (this.network == null) { + this.network = network; + } else if (!this.network.equals(network)) { + removeFromNetwork(); + this.network = network; + } + } + + @Override + public void updateNetwork(Direction[] dirs) { + if (isRemoved()) { + return; + } + if (level == null) { + if (!isQueued) { + isQueued = true; + Scheduler.schedule(1, () -> updateNetwork(dirs)); + } + } + + isQueued = false; + + if(level.isClientSide) { + return; + } + + Pair, List>> changed = updateAdjacent(dirs); + + if (changed.getSecond().isEmpty()) { + + if (network == null) { + createNetworkFromThis(); + } + + if (!changed.getFirst().isEmpty()) { + + network.updateRecievers(changed.getFirst()); + + } + + } else { + + HashSet adjacentNetworks = new HashSet<>(); + + for (UpdatedConductor wire : changed.getSecond()) { + + if (wire.conductor() == null || wire.conductor().isRemoved() || wire.conductor().getNetwork() == null) { + continue; + } + + adjacentNetworks.add((NETWORK) wire.conductor().getNetwork()); + + } + + if (adjacentNetworks.isEmpty()) { + + if (network == null) { + createNetworkFromThis(); + } + + network.updateConductors(changed.getSecond()); + + } else { + + List networks = new ArrayList<>(adjacentNetworks); + + if (networks.size() > 1) { + + if (network == null) { + + createNetworkFromThis(); + + } + + adjacentNetworks.add(network); + + NETWORK newNetwork = createInstance(adjacentNetworks); + + network = newNetwork; + + newNetwork.refreshNewNetwork(); + + + } else { + + if (network == null) { + + network = networks.get(0); + + network.updateConductor((CONDUCTOR) this, false); + + } else { + + adjacentNetworks.add(network); + + NETWORK newNetwork = createInstance(adjacentNetworks); + + network = newNetwork; + + newNetwork.refreshNewNetwork(); + + } + + } + + } + + } + } + + @Override + public void removeFromNetwork() { + if (network != null) { + network.removeFromNetwork((CONDUCTOR) this); + } + } + + @Override + public BlockEntity[] getConectedRecievers() { + return recieverConnections; + } + + @Override + public BlockEntity[] getConnectedCables() { + return cableConnections; + } + + @Override + public void setRemoved() { + super.setRemoved(); + if (!level.isClientSide && network != null) { + getNetwork().split((CONDUCTOR) this); + } + + } + + @Override + public void onChunkUnloaded() { + if (!level.isClientSide && network != null) { + getNetwork().split((CONDUCTOR) this); + } + super.onChunkUnloaded(); + } + + public abstract NETWORK createInstanceConductor(Set conductors); + + public abstract NETWORK createInstance(Set networks); + + + @Override + public void onLoad() { + super.onLoad(); + updateNetwork(Direction.values()); + } + + public static record UpdatedReceiver(BlockEntity reciever, boolean removed, Direction dir) { + + } + + public static record UpdatedConductor(CONDUCTOR conductor, boolean removed) { + + } + +} diff --git a/src/main/java/electrodynamics/prefab/utilities/ElectricityUtils.java b/src/main/java/electrodynamics/prefab/utilities/ElectricityUtils.java index fc2ac74d5..e32315503 100644 --- a/src/main/java/electrodynamics/prefab/utilities/ElectricityUtils.java +++ b/src/main/java/electrodynamics/prefab/utilities/ElectricityUtils.java @@ -1,8 +1,8 @@ package electrodynamics.prefab.utilities; import electrodynamics.api.capability.types.electrodynamic.ICapabilityElectrodynamic; -import electrodynamics.api.network.cable.type.IConductor; import electrodynamics.common.tags.ElectrodynamicsTags; +import electrodynamics.common.tile.electricitygrid.GenericTileWire; import electrodynamics.prefab.utilities.object.TransferPack; import electrodynamics.registers.ElectrodynamicsCapabilities; import electrodynamics.registers.ElectrodynamicsDamageTypes; @@ -44,9 +44,9 @@ public static boolean isElectricReceiver(BlockEntity tile, Direction dir) { return tile != null && (tile.getLevel().getCapability(ElectrodynamicsCapabilities.CAPABILITY_ELECTRODYNAMIC_BLOCK, tile.getBlockPos(), tile.getBlockState(), tile, dir) != null || tile.getLevel().getCapability(Capabilities.EnergyStorage.BLOCK, tile.getBlockPos(), tile.getBlockState(), tile, dir) != null); } - public static boolean isConductor(BlockEntity acceptor, IConductor requesterWire) { - if (acceptor instanceof IConductor conductor) { - return conductor.getWireType().isDefaultColor() || requesterWire.getWireType().isDefaultColor() || conductor.getWireColor() == requesterWire.getWireColor(); + public static boolean isConductor(BlockEntity acceptor, GenericTileWire requesterWire) { + if (acceptor instanceof GenericTileWire conductor) { + return conductor.getCableType().isDefaultColor() || requesterWire.getCableType().isDefaultColor() || conductor.getWireColor() == requesterWire.getWireColor(); } return false; } diff --git a/src/main/java/electrodynamics/prefab/utilities/ElectroTextUtils.java b/src/main/java/electrodynamics/prefab/utilities/ElectroTextUtils.java index 0ec200a3b..fa7f1b001 100644 --- a/src/main/java/electrodynamics/prefab/utilities/ElectroTextUtils.java +++ b/src/main/java/electrodynamics/prefab/utilities/ElectroTextUtils.java @@ -3,6 +3,7 @@ import electrodynamics.api.References; import electrodynamics.api.electricity.formatting.ChatFormatter; import electrodynamics.api.electricity.formatting.DisplayUnit; +import net.minecraft.ChatFormatting; import net.minecraft.client.resources.language.I18n; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; @@ -101,7 +102,7 @@ public static boolean translationExists(String base, String key) { } public static MutableComponent voltageTooltip(int voltage) { - return tooltip("machine.voltage", ChatFormatter.getChatDisplayShort(voltage, DisplayUnit.VOLTAGE)); + return tooltip("machine.voltage", ChatFormatter.getChatDisplayShort(voltage, DisplayUnit.VOLTAGE).withStyle(ChatFormatting.GRAY)).withStyle(ChatFormatting.DARK_GRAY); } public static MutableComponent ratio(Component numerator, Component denominator) { diff --git a/src/main/java/electrodynamics/prefab/utilities/math/MathUtils.java b/src/main/java/electrodynamics/prefab/utilities/math/MathUtils.java index 553957733..a7d4519b5 100644 --- a/src/main/java/electrodynamics/prefab/utilities/math/MathUtils.java +++ b/src/main/java/electrodynamics/prefab/utilities/math/MathUtils.java @@ -1,5 +1,10 @@ package electrodynamics.prefab.utilities.math; +import net.minecraft.core.BlockPos; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.EntityCollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import org.joml.Quaternionf; import org.joml.Vector3f; @@ -23,6 +28,13 @@ public class MathUtils { public static final Vector3f ZERO = new Vector3f(0.0F, 0.0F, 0.0F); public static final Vector3f ONE = new Vector3f(1.0F, 1.0F, 1.0F); + public static final CollisionContext EMPTY = new EntityCollisionContext(false, -Double.MAX_VALUE, ItemStack.EMPTY, fluidState -> false, null) { + @Override + public boolean isAbove(VoxelShape shape, BlockPos pos, boolean canAscend) { + return canAscend; + } + }; + public static Location getRaytracedBlock(Entity entity) { return getRaytracedBlock(entity, 100); } @@ -37,7 +49,7 @@ public static Location getRaytracedBlock(Level world, Vec3 direction, Vec3 from, // consideration for more math. Vec3 rayPath = direction.normalize().scale(rayLength); Vec3 to = from.add(rayPath); - ClipContext rayContext = new ClipContext(from, to, ClipContext.Block.OUTLINE, ClipContext.Fluid.ANY, (Entity) null); + ClipContext rayContext = new ClipContext(from, to, ClipContext.Block.OUTLINE, ClipContext.Fluid.ANY, EMPTY); BlockHitResult rayHit = world.clip(rayContext); return rayHit.getType() != Type.BLOCK ? null : new Location(rayHit.getBlockPos()); @@ -47,6 +59,15 @@ public static int logBase2(int value) { return (int) (Math.log(value) / Math.log(2) + 1e-10); } + public static int nearestPowerOf10(double value, boolean roundUp) { + double power = Math.log10(value); + if(roundUp) { + return (int) Math.ceil(power); + } else { + return (int) Math.floor(power); + } + } + /** * Performs the same function the vanilla class contructor had * diff --git a/src/main/java/electrodynamics/registers/ElectrodynamicsArmorMaterials.java b/src/main/java/electrodynamics/registers/ElectrodynamicsArmorMaterials.java index 75708de09..160775635 100644 --- a/src/main/java/electrodynamics/registers/ElectrodynamicsArmorMaterials.java +++ b/src/main/java/electrodynamics/registers/ElectrodynamicsArmorMaterials.java @@ -32,7 +32,7 @@ public class ElectrodynamicsArmorMaterials { public static final DeferredHolder HYDRAULIC_BOOTS = register("hydraulic_boots", ItemHydraulicBoots.DEFENSE_MAP, 0, 0, 0, SoundEvents.ARMOR_EQUIP_IRON, () -> Ingredient.EMPTY, ResourceLocation.parse(References.ID + ":textures/model/armor/hydraulicboots.png")); - public static final DeferredHolder RUBBER_BOOTS = register("rubber_boots", ItemRubberArmor.DEFENSE_MAP, 0, 0, 0, SoundEvents.ARMOR_EQUIP_LEATHER, () -> Ingredient.of(ElectrodynamicsItems.ITEM_INSULATION.get()), ResourceLocation.parse(References.ID + ":textures/model/armor/rubberarmor.png")); + public static final DeferredHolder RUBBER_BOOTS = register("rubber_boots", ItemRubberArmor.DEFENSE_MAP, 0, 0, 0, SoundEvents.ARMOR_EQUIP_LEATHER, () -> Ingredient.of(ElectrodynamicsItems.ITEM_INSULATION.get()), ResourceLocation.parse(References.ID + ":rubberarmor")); private static DeferredHolder register(String name, Map slotMap, int enchantValue, float toughness, float knockbackResistance, Holder sound, Supplier repairIngredient, ResourceLocation texture) { return ARMOR_MATERIALS.register(name, () -> new ArmorMaterial(slotMap, enchantValue, sound, repairIngredient, List.of(new ArmorMaterial.Layer(texture)), toughness, knockbackResistance)); diff --git a/src/main/java/electrodynamics/registers/ElectrodynamicsBlocks.java b/src/main/java/electrodynamics/registers/ElectrodynamicsBlocks.java index 5f5c3632f..fff1426c7 100644 --- a/src/main/java/electrodynamics/registers/ElectrodynamicsBlocks.java +++ b/src/main/java/electrodynamics/registers/ElectrodynamicsBlocks.java @@ -2,6 +2,7 @@ import electrodynamics.api.References; import electrodynamics.api.registration.BulkDeferredHolder; +import electrodynamics.api.tile.IMachine; import electrodynamics.common.block.*; import electrodynamics.common.block.chemicalreactor.BlockChemicalReactor; import electrodynamics.common.block.chemicalreactor.BlockChemicalReactorExtra; @@ -26,10 +27,17 @@ import electrodynamics.common.block.subtype.SubtypeResourceBlock; import electrodynamics.common.block.subtype.SubtypeWire; import electrodynamics.common.block.subtype.SubtypeWire.WireClass; +import electrodynamics.common.block.voxelshapes.ElectrodynamicsVoxelShapes; +import electrodynamics.common.block.voxelshapes.VoxelShapeProvider; +import electrodynamics.common.tile.compatibility.TileRotaryUnifier; +import electrodynamics.prefab.block.GenericMachineBlock; import net.minecraft.core.registries.Registries; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.RenderShape; import net.minecraft.world.level.block.SoundType; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; import net.neoforged.neoforge.registries.DeferredHolder; import net.neoforged.neoforge.registries.DeferredRegister; @@ -42,8 +50,49 @@ public class ElectrodynamicsBlocks { public static final BulkDeferredHolder BLOCKS_RAWORE = new BulkDeferredHolder<>(SubtypeRawOreBlock.values(), subtype -> BLOCKS.register(subtype.tag(), () -> new Block(Blocks.STONE.properties().requiresCorrectToolForDrops().strength(5.0F, 6.0F)))); public static final BulkDeferredHolder BLOCKS_MACHINE = new BulkDeferredHolder<>(SubtypeMachine.values(), subtype -> BLOCKS.register(subtype.tag(), () -> new BlockMachine(subtype))); public static final DeferredHolder BLOCK_CHEMICALREACTOR = BLOCKS.register("chemicalreactor", BlockChemicalReactor::new); + public static final DeferredHolder BLOCK_ROTARYUNIFIER = BLOCKS.register("rotaryunifier", () -> new BlockMachine(new IMachine() { + @Override + public BlockEntityType.BlockEntitySupplier getBlockEntitySupplier() { + return TileRotaryUnifier::new; + } + + @Override + public int getLitBrightness() { + return 15; + } + + @Override + public RenderShape getRenderShape() { + return RenderShape.MODEL; + } + + @Override + public boolean isMultiblock() { + return false; + } + + @Override + public boolean propegatesLightDown() { + return false; + } + + @Override + public boolean isPlayerStorable() { + return false; + } + + @Override + public VoxelShapeProvider getVoxelShapeProvider() { + return ElectrodynamicsVoxelShapes.ROTARY_UNIFIER; + } + + @Override + public boolean usesLit() { + return true; + } + })); public static final BulkDeferredHolder BLOCKS_WIRE = new BulkDeferredHolder<>(SubtypeWire.values(), subtype -> { - if(subtype.wireClass == WireClass.LOGISTICAL) { + if(subtype.getWireClass() == WireClass.LOGISTICAL) { return BLOCKS.register(subtype.tag(), () -> new BlockLogisticalWire(subtype)); } else { return BLOCKS.register(subtype.tag(), () -> new BlockWire(subtype)); diff --git a/src/main/java/electrodynamics/registers/ElectrodynamicsCapabilities.java b/src/main/java/electrodynamics/registers/ElectrodynamicsCapabilities.java index bf76cfd11..002494404 100644 --- a/src/main/java/electrodynamics/registers/ElectrodynamicsCapabilities.java +++ b/src/main/java/electrodynamics/registers/ElectrodynamicsCapabilities.java @@ -2,12 +2,14 @@ import electrodynamics.common.item.gear.armor.types.ItemCombatArmor; import electrodynamics.common.item.gear.tools.electric.utils.ItemRailgun; +import electrodynamics.compatibility.mekanism.MekanismHandler; import net.minecraft.core.Holder; import net.minecraft.core.registries.Registries; import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraft.world.item.enchantment.Enchantments; import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.ModList; import net.neoforged.fml.common.EventBusSubscriber; import org.jetbrains.annotations.Nullable; @@ -201,6 +203,10 @@ public static void register(RegisterCapabilitiesEvent event) { event.registerBlockEntity(Capabilities.EnergyStorage.BLOCK, ElectrodynamicsTiles.TILE_BATTERYBOX.get(), (tile, context) -> tile.getFECapability(context)); + if(ModList.get().isLoaded(References.MEKANISM_ID)) { + MekanismHandler.registerCapabilities(event); + } + } private static final ResourceLocation id(String name) { diff --git a/src/main/java/electrodynamics/registers/ElectrodynamicsGases.java b/src/main/java/electrodynamics/registers/ElectrodynamicsGases.java index 7920ccd9b..244feb075 100644 --- a/src/main/java/electrodynamics/registers/ElectrodynamicsGases.java +++ b/src/main/java/electrodynamics/registers/ElectrodynamicsGases.java @@ -7,6 +7,7 @@ import electrodynamics.prefab.utilities.ElectroTextUtils; import net.minecraft.core.Holder; import net.minecraft.core.Registry; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Items; @@ -27,7 +28,7 @@ public class ElectrodynamicsGases { public static final DeferredHolder EMPTY = GASES.register("empty", () -> new Gas(new Holder.Direct<>(Items.AIR), ElectroTextUtils.gas("empty"))); public static final DeferredHolder HYDROGEN = GASES.register("hydrogen", () -> new Gas(ElectrodynamicsItems.ITEM_PORTABLECYLINDER, ElectroTextUtils.gas("hydrogen"), 33, ElectrodynamicsFluids.FLUID_HYDROGEN)); public static final DeferredHolder OXYGEN = GASES.register("oxygen", () -> new Gas(ElectrodynamicsItems.ITEM_PORTABLECYLINDER, ElectroTextUtils.gas("oxygen"), 90, ElectrodynamicsFluids.FLUID_OXYGEN)); - public static final DeferredHolder STEAM = GASES.register("steam", () -> new Gas(ElectrodynamicsItems.ITEM_PORTABLECYLINDER, ElectroTextUtils.gas("steam"), 373, new Holder.Direct<>(Fluids.WATER))); + public static final DeferredHolder STEAM = GASES.register("steam", () -> new Gas(ElectrodynamicsItems.ITEM_PORTABLECYLINDER, ElectroTextUtils.gas("steam"), 373, BuiltInRegistries.FLUID.wrapAsHolder(Fluids.WATER))); public static final DeferredHolder NITROGEN = GASES.register("nitrogen", () -> new Gas(ElectrodynamicsItems.ITEM_PORTABLECYLINDER, ElectroTextUtils.gas("nitrogen"))); public static final DeferredHolder CARBON_DIOXIDE = GASES.register("carbondioxide", () -> new Gas(ElectrodynamicsItems.ITEM_PORTABLECYLINDER, ElectroTextUtils.gas("carbondioxide"))); public static final DeferredHolder ARGON = GASES.register("argon", () -> new Gas(ElectrodynamicsItems.ITEM_PORTABLECYLINDER, ElectroTextUtils.gas("argon"))); diff --git a/src/main/java/electrodynamics/registers/ElectrodynamicsItems.java b/src/main/java/electrodynamics/registers/ElectrodynamicsItems.java index bbbf149ab..ae1cd1520 100644 --- a/src/main/java/electrodynamics/registers/ElectrodynamicsItems.java +++ b/src/main/java/electrodynamics/registers/ElectrodynamicsItems.java @@ -16,6 +16,7 @@ import electrodynamics.common.block.subtype.SubtypeResourceBlock; import electrodynamics.common.block.subtype.SubtypeWire; import electrodynamics.common.blockitem.types.BlockItemDescriptable; +import electrodynamics.common.blockitem.types.BlockItemFluidPipe; import electrodynamics.common.blockitem.types.BlockItemGasPipe; import electrodynamics.common.blockitem.types.BlockItemWire; import electrodynamics.common.item.ItemBoneMeal; @@ -48,11 +49,13 @@ import electrodynamics.prefab.utilities.object.TransferPack; import net.minecraft.core.registries.Registries; import net.minecraft.world.item.ArmorItem.Type; +import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.neoforged.api.distmarker.Dist; import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.ModList; import net.neoforged.fml.common.EventBusSubscriber; import net.neoforged.neoforge.event.BuildCreativeModeTabContentsEvent; import net.neoforged.neoforge.registries.DeferredHolder; @@ -77,6 +80,15 @@ public class ElectrodynamicsItems { }); public static final DeferredHolder ITEM_CHEMICALREACTOR = ITEMS.register("chemicalreactor", () -> new BlockItemDescriptable(ElectrodynamicsBlocks.BLOCK_CHEMICALREACTOR.get(), new Item.Properties().stacksTo(64), ElectrodynamicsCreativeTabs.MAIN)); + public static final DeferredHolder ITEM_ROTARYUNIFIER = ITEMS.register("rotaryunifier", () -> new BlockItemDescriptable(ElectrodynamicsBlocks.BLOCK_ROTARYUNIFIER.get(), new Item.Properties(), ElectrodynamicsCreativeTabs.MAIN) { + @Override + public boolean isAllowedInCreativeTab(CreativeModeTab tab) { + if(ModList.get().isLoaded(References.MEKANISM_ID)) { + return super.isAllowedInCreativeTab(tab); + } + return false; + } + }); public static final DeferredHolder ITEM_STEELSCAFFOLD = ITEMS.register("steelscaffold", () -> new BlockItemDescriptable(ElectrodynamicsBlocks.BLOCK_STEELSCAFFOLDING.get(), new Item.Properties().stacksTo(64), ElectrodynamicsCreativeTabs.MAIN)); public static final DeferredHolder ITEM_FRAME = ITEMS.register("frame", () -> new BlockItemDescriptable(ElectrodynamicsBlocks.BLOCK_FRAME.get(), new Item.Properties().stacksTo(64), null)); public static final DeferredHolder ITEM_FRAMECORNER = ITEMS.register("framecorner", () -> new BlockItemDescriptable(ElectrodynamicsBlocks.BLOCK_FRAME_CORNER.get(), new Item.Properties().stacksTo(64), null)); @@ -90,7 +102,7 @@ public class ElectrodynamicsItems { public static final DeferredHolder ITEM_ADVANCED_THERMOELECTRIC_MANIPULATOR = ITEMS.register("advancedthermoelectricmanipulator", () -> new BlockItemDescriptable(ElectrodynamicsBlocks.BLOCK_ADVANCED_THERMOELECTRICMANIPULATOR.get(), new Item.Properties(), ElectrodynamicsCreativeTabs.MAIN)); public static final DeferredHolder ITEM_COMPRESSOR_ADDONTANK = ITEMS.register("compressoraddontank", () -> new BlockItemDescriptable(ElectrodynamicsBlocks.BLOCK_COMPRESSOR_ADDONTANK.get(), new Item.Properties(), ElectrodynamicsCreativeTabs.MAIN)); public static final BulkDeferredHolder ITEMS_WIRE = new BulkDeferredHolder<>(SubtypeWire.values(), subtype -> ITEMS.register(subtype.tag(), () -> new BlockItemWire(ElectrodynamicsBlocks.BLOCKS_WIRE.getValue(subtype), new Item.Properties(), ElectrodynamicsCreativeTabs.GRID))); - public static final BulkDeferredHolder ITEMS_PIPE = new BulkDeferredHolder<>(SubtypeFluidPipe.values(), subtype -> ITEMS.register(subtype.tag(), () -> new BlockItemDescriptable(ElectrodynamicsBlocks.BLOCKS_FLUIDPIPE.getValue(subtype), new Item.Properties(), ElectrodynamicsCreativeTabs.MAIN))); + public static final BulkDeferredHolder ITEMS_PIPE = new BulkDeferredHolder<>(SubtypeFluidPipe.values(), subtype -> ITEMS.register(subtype.tag(), () -> new BlockItemFluidPipe(ElectrodynamicsBlocks.BLOCKS_FLUIDPIPE.getValue(subtype), new Item.Properties(), ElectrodynamicsCreativeTabs.MAIN))); public static final BulkDeferredHolder ITEMS_GASPIPE = new BulkDeferredHolder<>(SubtypeGasPipe.values(), subtype -> ITEMS.register(subtype.tag(), () -> new BlockItemGasPipe(ElectrodynamicsBlocks.BLOCKS_GASPIPE.getValue(subtype), new Item.Properties(), ElectrodynamicsCreativeTabs.MAIN))); @@ -134,10 +146,8 @@ public class ElectrodynamicsItems { public static final DeferredHolder ITEM_LITHIUMBATTERY = ITEMS.register("lithiumbattery", () -> new ItemElectric((ElectricItemProperties) new ElectricItemProperties().capacity(4 * 1666666.66667).extract(TransferPack.joulesVoltage(4 * 1666666.66667 / (120.0 * 20.0), 240)).receive(TransferPack.joulesVoltage(4 * 1666666.66667 / (120.0 * 20.0), 240)).setIsEnergyStorageOnly().stacksTo(1), ElectrodynamicsCreativeTabs.MAIN, item -> Items.AIR)); public static final DeferredHolder ITEM_CARBYNEBATTERY = ITEMS.register("carbynebattery", () -> new ItemElectric((ElectricItemProperties) new ElectricItemProperties().capacity(8 * 1666666.66667).extract(TransferPack.joulesVoltage(8 * 1666666.66667 / (120.0 * 20.0), 480)).receive(TransferPack.joulesVoltage(8 * 1666666.66667 / (120.0 * 20.0), 480)).setIsEnergyStorageOnly().stacksTo(1), ElectrodynamicsCreativeTabs.MAIN, item -> Items.AIR)); - public static final DeferredHolder ITEM_WRENCH = ITEMS.register("wrench", () -> new ItemWrench(new Item.Properties(), ElectrodynamicsCreativeTabs.MAIN)); + public static final DeferredHolder ITEM_WRENCH = ITEMS.register("wrench", () -> new ItemWrench(new Item.Properties().stacksTo(1), ElectrodynamicsCreativeTabs.MAIN)); public static final DeferredHolder ITEM_MULTIMETER = ITEMS.register("multimeter", () -> new ItemMultimeter(new Item.Properties().stacksTo(1), ElectrodynamicsCreativeTabs.MAIN)); - public static final DeferredHolder ITEM_CANISTERREINFORCED = ITEMS.register("canisterreinforced", () -> new ItemCanister(new Item.Properties().stacksTo(1), ElectrodynamicsCreativeTabs.MAIN)); - public static final DeferredHolder ITEM_PORTABLECYLINDER = ITEMS.register("portablecylinder", () -> new ItemPortableCylinder(new Item.Properties().stacksTo(1), ElectrodynamicsCreativeTabs.MAIN)); public static final DeferredHolder GUIDEBOOK = ITEMS.register("guidebook", () -> new ItemGuidebook(new Item.Properties(), ElectrodynamicsCreativeTabs.MAIN)); @@ -166,6 +176,9 @@ public class ElectrodynamicsItems { public static final DeferredHolder ITEM_COMBATLEGGINGS = ITEMS.register("combatarmorleggings", () -> new ItemCombatArmor(new ElectricItemProperties().capacity(1666666.66667).extract(TransferPack.joulesVoltage(1666666.66667 / (120.0 * 20.0), 120)).receive(TransferPack.joulesVoltage(1666666.66667 / (120.0 * 20.0), 120)).stacksTo(1).fireResistant(), Type.LEGGINGS, ElectrodynamicsCreativeTabs.MAIN)); public static final DeferredHolder ITEM_COMBATBOOTS = ITEMS.register("combatarmorboots", () -> new ItemCombatArmor(new Item.Properties().stacksTo(1), Type.BOOTS, ElectrodynamicsCreativeTabs.MAIN)); + public static final DeferredHolder ITEM_CANISTERREINFORCED = ITEMS.register("canisterreinforced", () -> new ItemCanister(new Item.Properties().stacksTo(1), ElectrodynamicsCreativeTabs.MAIN)); + public static final DeferredHolder ITEM_PORTABLECYLINDER = ITEMS.register("portablecylinder", () -> new ItemPortableCylinder(new Item.Properties().stacksTo(1), ElectrodynamicsCreativeTabs.MAIN)); + @EventBusSubscriber(value = Dist.CLIENT, modid = References.ID, bus = EventBusSubscriber.Bus.MOD) private static class ElectroCreativeRegistry { diff --git a/src/main/java/electrodynamics/registers/ElectrodynamicsMenuTypes.java b/src/main/java/electrodynamics/registers/ElectrodynamicsMenuTypes.java index 024ea6d1d..b9b1305c0 100644 --- a/src/main/java/electrodynamics/registers/ElectrodynamicsMenuTypes.java +++ b/src/main/java/electrodynamics/registers/ElectrodynamicsMenuTypes.java @@ -70,6 +70,7 @@ public class ElectrodynamicsMenuTypes { public static final DeferredHolder, MenuType> CONTAINER_CHEMICALREACTOR = register("chemicalreactor", ContainerChemicalReactor::new); public static final DeferredHolder, MenuType> CONTAINER_CREATIVEGASSOURCE = register("creativegassource", ContainerCreativeGasSource::new); public static final DeferredHolder, MenuType> CONTAINER_ELECTROLOSISCHAMBER = register("electrolosischamber", ContainerElectrolosisChamber::new); + public static final DeferredHolder, MenuType> CONTAINER_ROTARYUNIFIER = register("rotaryunifier", ContainerRotaryUnifier::new); private static DeferredHolder,MenuType> register(String id, MenuSupplier supplier) { return MENU_TYPES.register(id, () -> new MenuType<>(supplier, FeatureFlags.DEFAULT_FLAGS)); diff --git a/src/main/java/electrodynamics/registers/ElectrodynamicsTiles.java b/src/main/java/electrodynamics/registers/ElectrodynamicsTiles.java index 37f559004..6c1a5296b 100644 --- a/src/main/java/electrodynamics/registers/ElectrodynamicsTiles.java +++ b/src/main/java/electrodynamics/registers/ElectrodynamicsTiles.java @@ -10,6 +10,7 @@ import electrodynamics.common.block.connect.BlockWire; import electrodynamics.common.block.subtype.SubtypeMachine; import electrodynamics.common.tile.TileMultiSubnode; +import electrodynamics.common.tile.compatibility.TileRotaryUnifier; import electrodynamics.common.tile.electricitygrid.TileCircuitBreaker; import electrodynamics.common.tile.electricitygrid.TileCircuitMonitor; import electrodynamics.common.tile.electricitygrid.TileCurrentRegulator; @@ -196,4 +197,5 @@ public class ElectrodynamicsTiles { public static final DeferredHolder, BlockEntityType> TILE_MULTIBLOCK_SLAVE = BLOCK_ENTITY_TYPES.register("multiblockslave", () -> new BlockEntityType<>(TileMultiblockSlave::new, Sets.newHashSet(ElectrodynamicsBlocks.BLOCK_MULTIBLOCK_SLAVE.get()), null)); public static final DeferredHolder, BlockEntityType> TILE_ELECTROLOSISCHAMBER = BLOCK_ENTITY_TYPES.register(SubtypeMachine.electrolosischamber.tag(), () -> new BlockEntityType<>(TileElectrolosisChamber::new, Sets.newHashSet(ElectrodynamicsBlocks.BLOCKS_MACHINE.getValue(SubtypeMachine.electrolosischamber)), null)); + public static final DeferredHolder, BlockEntityType> TILE_ROTARYUNIFIER = BLOCK_ENTITY_TYPES.register("rotaryunifier", () -> new BlockEntityType<>(TileRotaryUnifier::new, Sets.newHashSet(ElectrodynamicsBlocks.BLOCK_ROTARYUNIFIER.get()), null)); } diff --git a/src/main/java/electrodynamics/registers/UnifiedElectrodynamicsRegister.java b/src/main/java/electrodynamics/registers/UnifiedElectrodynamicsRegister.java index e162b79a0..3df4ba9fa 100644 --- a/src/main/java/electrodynamics/registers/UnifiedElectrodynamicsRegister.java +++ b/src/main/java/electrodynamics/registers/UnifiedElectrodynamicsRegister.java @@ -7,6 +7,7 @@ import electrodynamics.common.recipe.ElectrodynamicsRecipeInit; import electrodynamics.common.settings.Constants; import electrodynamics.prefab.utilities.ElectroTextUtils; +import net.minecraft.ChatFormatting; import net.neoforged.bus.api.IEventBus; public class UnifiedElectrodynamicsRegister { @@ -68,15 +69,17 @@ public static void register(IEventBus bus) { BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCK_DECOMPRESSOR, ElectroTextUtils.voltageTooltip(120)); BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCK_ADVANCEDCOMPRESSOR, ElectroTextUtils.voltageTooltip(120)); BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCK_ADVANCEDDECOMPRESSOR, ElectroTextUtils.voltageTooltip(120)); - BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCK_COMPRESSOR_ADDONTANK, ElectroTextUtils.tooltip("addontankcap", ChatFormatter.formatFluidMilibuckets(Constants.GAS_TRANSFORMER_ADDON_TANK_CAPCITY))); + BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCK_COMPRESSOR_ADDONTANK, ElectroTextUtils.tooltip("addontankcap", ChatFormatter.formatFluidMilibuckets(Constants.GAS_TRANSFORMER_ADDON_TANK_CAPCITY).withStyle(ChatFormatting.GRAY)).withStyle(ChatFormatting.DARK_GRAY)); BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCK_THERMOELECTRICMANIPULATOR, ElectroTextUtils.voltageTooltip(120)); BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCK_ADVANCED_THERMOELECTRICMANIPULATOR, ElectroTextUtils.voltageTooltip(120)); BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.gaspipepump), ElectroTextUtils.voltageTooltip(120)); BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.fluidpipepump), ElectroTextUtils.voltageTooltip(120)); - BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.gastanksteel), ElectroTextUtils.tooltip("gastank.capacity", ChatFormatter.getChatDisplayShort(8, DisplayUnit.BUCKETS))); - BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.gastankreinforced), ElectroTextUtils.tooltip("gastank.capacity", ChatFormatter.getChatDisplayShort(32, DisplayUnit.BUCKETS))); - BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.gastankhsla), ElectroTextUtils.tooltip("gastank.capacity", ChatFormatter.getChatDisplayShort(128, DisplayUnit.BUCKETS))); + BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.gastanksteel), ElectroTextUtils.tooltip("gastank.capacity", ChatFormatter.getChatDisplayShort(8, DisplayUnit.BUCKETS).withStyle(ChatFormatting.GRAY)).withStyle(ChatFormatting.DARK_GRAY)); + BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.gastankreinforced), ElectroTextUtils.tooltip("gastank.capacity", ChatFormatter.getChatDisplayShort(32, DisplayUnit.BUCKETS).withStyle(ChatFormatting.GRAY)).withStyle(ChatFormatting.DARK_GRAY)); + BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.gastankhsla), ElectroTextUtils.tooltip("gastank.capacity", ChatFormatter.getChatDisplayShort(128, DisplayUnit.BUCKETS).withStyle(ChatFormatting.GRAY)).withStyle(ChatFormatting.DARK_GRAY)); + BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCK_ROTARYUNIFIER, ElectroTextUtils.tooltip("rotaryunifier.use1").withStyle(ChatFormatting.DARK_GRAY)); + BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCK_ROTARYUNIFIER, ElectroTextUtils.tooltip("rotaryunifier.use2").withStyle(ChatFormatting.DARK_GRAY)); // generators BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.solarpanel), ElectroTextUtils.voltageTooltip(120)); @@ -88,32 +91,37 @@ public static void register(IEventBus bus) { BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.coalgenerator), ElectroTextUtils.voltageTooltip(120)); // misc - BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.downgradetransformer), ElectroTextUtils.tooltip("transformer.energyloss")); - BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.upgradetransformer), ElectroTextUtils.tooltip("transformer.energyloss")); + BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.downgradetransformer), ElectroTextUtils.tooltip("transformer.energyloss", ChatFormatter.getChatDisplayShort(Constants.TRANSFORMER_EFFICIENCY * 100, DisplayUnit.PERCENTAGE).withStyle(ChatFormatting.GRAY)).withStyle(ChatFormatting.DARK_GRAY)); + BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.upgradetransformer), ElectroTextUtils.tooltip("transformer.energyloss", ChatFormatter.getChatDisplayShort(Constants.TRANSFORMER_EFFICIENCY * 100, DisplayUnit.PERCENTAGE).withStyle(ChatFormatting.GRAY)).withStyle(ChatFormatting.DARK_GRAY)); + BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.advanceddowngradetransformer), ElectroTextUtils.tooltip("transformer.energyloss", ChatFormatter.getChatDisplayShort(Constants.TRANSFORMER_EFFICIENCY * 100, DisplayUnit.PERCENTAGE).withStyle(ChatFormatting.GRAY)).withStyle(ChatFormatting.DARK_GRAY)); + BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.advancedupgradetransformer), ElectroTextUtils.tooltip("transformer.energyloss", ChatFormatter.getChatDisplayShort(Constants.TRANSFORMER_EFFICIENCY * 100, DisplayUnit.PERCENTAGE).withStyle(ChatFormatting.GRAY)).withStyle(ChatFormatting.DARK_GRAY)); + BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.circuitbreaker), ElectroTextUtils.tooltip("transformer.energyloss", ChatFormatter.getChatDisplayShort(Constants.CIRCUITBREAKER_EFFICIENCY * 100, DisplayUnit.PERCENTAGE).withStyle(ChatFormatting.GRAY)).withStyle(ChatFormatting.DARK_GRAY)); + BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.relay), ElectroTextUtils.tooltip("transformer.energyloss", ChatFormatter.getChatDisplayShort(Constants.RELAY_EFFICIENCY * 100, DisplayUnit.PERCENTAGE).withStyle(ChatFormatting.GRAY)).withStyle(ChatFormatting.DARK_GRAY)); + BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.currentregulator), ElectroTextUtils.tooltip("transformer.energyloss", ChatFormatter.getChatDisplayShort(Constants.CURRENTREGULATOR_EFFICIENCY * 100, DisplayUnit.PERCENTAGE).withStyle(ChatFormatting.GRAY)).withStyle(ChatFormatting.DARK_GRAY)); BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.batterybox), ElectroTextUtils.voltageTooltip(120)); BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.lithiumbatterybox), ElectroTextUtils.voltageTooltip(240)); BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.carbynebatterybox), ElectroTextUtils.voltageTooltip(480)); - BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.creativepowersource), ElectroTextUtils.tooltip("creativepowersource.joke")); - BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.creativefluidsource), ElectroTextUtils.tooltip("creativefluidsource.joke")); - BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.creativegassource), ElectroTextUtils.tooltip("creativegassource.joke")); - BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.fluidvoid), ElectroTextUtils.tooltip("fluidvoid")); - BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.tanksteel), ElectroTextUtils.tooltip("fluidtank.capacity", ChatFormatter.getChatDisplayShort(8, DisplayUnit.BUCKETS))); - BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.tankreinforced), ElectroTextUtils.tooltip("fluidtank.capacity", ChatFormatter.getChatDisplayShort(32, DisplayUnit.BUCKETS))); - BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.tankhsla), ElectroTextUtils.tooltip("fluidtank.capacity", ChatFormatter.getChatDisplayShort(128, DisplayUnit.BUCKETS))); - BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCK_SEISMICMARKER, ElectroTextUtils.tooltip("seismicmarker.redstone")); - BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.seismicrelay), ElectroTextUtils.tooltip("seismicrelay.use")); - BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.coolantresavoir), ElectroTextUtils.tooltip("coolantresavoir.place")); - BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.motorcomplex), ElectroTextUtils.tooltip("motorcomplex.use")); - BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCK_FRAME, ElectroTextUtils.tooltip("blockframe.joke")); - BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCK_FRAME_CORNER, ElectroTextUtils.tooltip("blockframe.joke")); - BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.quarry), ElectroTextUtils.tooltip("quarry.power")); - BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCK_LOGISTICALMANAGER, ElectroTextUtils.tooltip("logisticalmanager.use")); + BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.creativepowersource), ElectroTextUtils.tooltip("creativepowersource.joke").withStyle(ChatFormatting.DARK_GRAY)); + BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.creativefluidsource), ElectroTextUtils.tooltip("creativefluidsource.joke").withStyle(ChatFormatting.DARK_GRAY)); + BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.creativegassource), ElectroTextUtils.tooltip("creativegassource.joke").withStyle(ChatFormatting.DARK_GRAY)); + BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.fluidvoid), ElectroTextUtils.tooltip("fluidvoid").withStyle(ChatFormatting.DARK_GRAY)); + BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.tanksteel), ElectroTextUtils.tooltip("fluidtank.capacity", ChatFormatter.getChatDisplayShort(8, DisplayUnit.BUCKETS).withStyle(ChatFormatting.GRAY)).withStyle(ChatFormatting.DARK_GRAY)); + BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.tankreinforced), ElectroTextUtils.tooltip("fluidtank.capacity", ChatFormatter.getChatDisplayShort(32, DisplayUnit.BUCKETS).withStyle(ChatFormatting.GRAY)).withStyle(ChatFormatting.DARK_GRAY)); + BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.tankhsla), ElectroTextUtils.tooltip("fluidtank.capacity", ChatFormatter.getChatDisplayShort(128, DisplayUnit.BUCKETS).withStyle(ChatFormatting.GRAY)).withStyle(ChatFormatting.DARK_GRAY)); + BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCK_SEISMICMARKER, ElectroTextUtils.tooltip("seismicmarker.redstone").withStyle(ChatFormatting.DARK_GRAY)); + BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.seismicrelay), ElectroTextUtils.tooltip("seismicrelay.use").withStyle(ChatFormatting.DARK_GRAY)); + BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.coolantresavoir), ElectroTextUtils.tooltip("coolantresavoir.place").withStyle(ChatFormatting.DARK_GRAY)); + BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.motorcomplex), ElectroTextUtils.tooltip("motorcomplex.use").withStyle(ChatFormatting.DARK_GRAY)); + BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCK_FRAME, ElectroTextUtils.tooltip("blockframe.joke").withStyle(ChatFormatting.DARK_GRAY)); + BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCK_FRAME_CORNER, ElectroTextUtils.tooltip("blockframe.joke").withStyle(ChatFormatting.DARK_GRAY)); + BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.quarry), ElectroTextUtils.tooltip("quarry.power").withStyle(ChatFormatting.DARK_GRAY)); + BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCK_LOGISTICALMANAGER, ElectroTextUtils.tooltip("logisticalmanager.use").withStyle(ChatFormatting.DARK_GRAY)); - BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.gasvent), ElectroTextUtils.tooltip("gasvent")); + BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.gasvent), ElectroTextUtils.tooltip("gasvent").withStyle(ChatFormatting.DARK_GRAY)); BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.gascollector), ElectroTextUtils.voltageTooltip(240)); - BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.gasvalve), ElectroTextUtils.tooltip("gasvalve")); - BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.fluidvalve), ElectroTextUtils.tooltip("fluidvalve")); - BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.potentiometer), ElectroTextUtils.tooltip("potentiometer.use")); + //BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.gasvalve), ElectroTextUtils.tooltip("gasvalve").withStyle(ChatFormatting.DARK_GRAY)); + //BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.fluidvalve), ElectroTextUtils.tooltip("fluidvalve")); + BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCKS_MACHINE.getHolder(SubtypeMachine.potentiometer), ElectroTextUtils.tooltip("potentiometer.use").withStyle(ChatFormatting.DARK_GRAY)); BlockItemDescriptable.addDescription(ElectrodynamicsBlocks.BLOCK_CHEMICALREACTOR, ElectroTextUtils.voltageTooltip(480)); } diff --git a/src/main/resources/assets/electrodynamics/models/block/rotaryunifier.json b/src/main/resources/assets/electrodynamics/models/block/rotaryunifier.json new file mode 100644 index 000000000..78b43b10a --- /dev/null +++ b/src/main/resources/assets/electrodynamics/models/block/rotaryunifier.json @@ -0,0 +1,1533 @@ +{ + "credit": "skip999", + "parent": "block/cube_all", + "texture_size": [ + 64, + 64 + ], + "textures": { + "0": "electrodynamics:block/model/rotaryunifier", + "particle": "electrodynamics:block/steelcasing" + }, + "elements": [ + { + "from": [ + 0, + 0, + 0 + ], + "to": [ + 16, + 5, + 16 + ], + "faces": { + "north": { + "uv": [ + 8, + 0, + 4, + 1.25 + ], + "texture": "#0" + }, + "east": { + "uv": [ + 8, + 0, + 4, + 1.25 + ], + "texture": "#0" + }, + "south": { + "uv": [ + 8, + 0, + 4, + 1.25 + ], + "texture": "#0" + }, + "west": { + "uv": [ + 8, + 0, + 4, + 1.25 + ], + "texture": "#0" + }, + "up": { + "uv": [ + 0, + 4, + 4, + 0 + ], + "texture": "#0" + }, + "down": { + "uv": [ + 0, + 4, + 4, + 8 + ], + "texture": "#0" + } + } + }, + { + "from": [ + 0, + 15, + 0 + ], + "to": [ + 16, + 16, + 16 + ], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [ + 0, + 15, + 0 + ] + }, + "faces": { + "north": { + "uv": [ + 4, + 0, + 0, + 0.25 + ], + "texture": "#0" + }, + "east": { + "uv": [ + 4, + 0, + 0, + 0.25 + ], + "texture": "#0" + }, + "south": { + "uv": [ + 4, + 0, + 0, + 0.25 + ], + "texture": "#0" + }, + "west": { + "uv": [ + 4, + 0, + 0, + 0.25 + ], + "texture": "#0" + }, + "up": { + "uv": [ + 0, + 4, + 4, + 0 + ], + "texture": "#0" + }, + "down": { + "uv": [ + 0, + 0, + 4, + 4 + ], + "texture": "#0" + } + } + }, + { + "from": [ + 1, + 5, + 1 + ], + "to": [ + 15, + 15, + 7 + ], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [ + 1, + 5, + 1 + ] + }, + "faces": { + "north": { + "uv": [ + 0.25, + 0.75, + 3.75, + 3.25 + ], + "texture": "#0" + }, + "east": { + "uv": [ + 8, + 0.5, + 9.5, + 3 + ], + "texture": "#0" + }, + "south": { + "uv": [ + 0.25, + 0.75, + 3.75, + 3.25 + ], + "texture": "#0" + }, + "west": { + "uv": [ + 8, + 0.5, + 9.5, + 3 + ], + "texture": "#0" + }, + "up": { + "uv": [ + 1, + 0.5, + -2.5, + -1 + ], + "texture": "#0" + }, + "down": { + "uv": [ + 4.5, + -1, + 1, + 0.5 + ], + "texture": "#0" + } + } + }, + { + "from": [ + 1, + 5, + 9 + ], + "to": [ + 15, + 15, + 15 + ], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [ + 1, + 5, + 9 + ] + }, + "faces": { + "north": { + "uv": [ + 0.25, + 0.75, + 3.75, + 3.25 + ], + "texture": "#0" + }, + "east": { + "uv": [ + 8, + 0.5, + 9.5, + 3 + ], + "texture": "#0" + }, + "south": { + "uv": [ + 0.25, + 0.75, + 3.75, + 3.25 + ], + "texture": "#0" + }, + "west": { + "uv": [ + 8, + 0.5, + 9.5, + 3 + ], + "texture": "#0" + }, + "up": { + "uv": [ + 1, + 0.5, + -2.5, + -1 + ], + "texture": "#0" + }, + "down": { + "uv": [ + 4.5, + -1, + 1, + 0.5 + ], + "texture": "#0" + } + } + }, + { + "from": [ + 3, + 5, + 7 + ], + "to": [ + 13, + 15, + 9 + ], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [ + 3, + 5, + 7 + ] + }, + "faces": { + "north": { + "uv": [ + -1.5, + 0.5, + 1, + 3 + ], + "texture": "#0" + }, + "east": { + "uv": [ + -2, + 0.5, + -1.5, + 3 + ], + "texture": "#0" + }, + "south": { + "uv": [ + 1.5, + 0.5, + 4, + 3 + ], + "texture": "#0" + }, + "west": { + "uv": [ + 1, + 0.5, + 1.5, + 3 + ], + "texture": "#0" + }, + "up": { + "uv": [ + 1, + 0.5, + -1.5, + 0 + ], + "texture": "#0" + }, + "down": { + "uv": [ + 3.5, + 0, + 1, + 0.5 + ], + "texture": "#0" + } + } + }, + { + "from": [ + 4, + 5, + 0 + ], + "to": [ + 12, + 12, + 1 + ], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [ + 4, + 5, + 0 + ] + }, + "faces": { + "north": { + "uv": [ + 4, + 4.25, + 8, + 7.75 + ], + "texture": "#0" + }, + "east": { + "uv": [ + 4, + 4.5, + 4.25, + 6.25 + ], + "texture": "#0" + }, + "south": { + "uv": [ + 1.25, + 0.5, + 3.25, + 2.25 + ], + "texture": "#0" + }, + "west": { + "uv": [ + 4.25, + 5, + 4.5, + 6.75 + ], + "texture": "#0" + }, + "up": { + "uv": [ + 6.25, + 4.5, + 4.25, + 4.25 + ], + "texture": "#0" + }, + "down": { + "uv": [ + 3, + 0.25, + 1, + 0.5 + ], + "texture": "#0" + } + } + }, + { + "from": [ + 4, + 5, + 15 + ], + "to": [ + 12, + 12, + 16 + ], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [ + 4, + 5, + 15 + ] + }, + "faces": { + "north": { + "uv": [ + -1, + 0.5, + 1, + 2.25 + ], + "texture": "#0" + }, + "east": { + "uv": [ + 0, + 0.5, + 0.25, + 2.25 + ], + "texture": "#0" + }, + "south": { + "uv": [ + 4, + 2.25, + 6, + 4 + ], + "texture": "#0" + }, + "west": { + "uv": [ + 0, + 0, + 0.25, + 1.75 + ], + "texture": "#0" + }, + "up": { + "uv": [ + 2.5, + 0.25, + 0.5, + 0 + ], + "texture": "#0" + }, + "down": { + "uv": [ + 3, + 0.25, + 1, + 0.5 + ], + "texture": "#0" + } + } + }, + { + "from": [ + 0, + 13, + 0 + ], + "to": [ + 16, + 14, + 1 + ], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [ + 0, + 13, + 0 + ] + }, + "faces": { + "north": { + "uv": [ + 0, + 0, + 4, + 0.25 + ], + "texture": "#0" + }, + "east": { + "uv": [ + 0, + 0.5, + 0.25, + 0.75 + ], + "texture": "#0" + }, + "south": { + "uv": [ + 1.25, + 0.5, + 5.25, + 0.75 + ], + "texture": "#0" + }, + "west": { + "uv": [ + 0, + 0, + 0.25, + 0.25 + ], + "texture": "#0" + }, + "up": { + "uv": [ + 4, + 0.25, + 0, + 0 + ], + "texture": "#0" + }, + "down": { + "uv": [ + 4, + 0, + 0, + 0.25 + ], + "texture": "#0" + } + } + }, + { + "from": [ + 0, + 13, + 15 + ], + "to": [ + 16, + 14, + 16 + ], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [ + 0, + 13, + 15 + ] + }, + "faces": { + "north": { + "uv": [ + -3, + 0.5, + 1, + 0.75 + ], + "texture": "#0" + }, + "east": { + "uv": [ + 0, + 0.5, + 0.25, + 0.75 + ], + "texture": "#0" + }, + "south": { + "uv": [ + 0, + 0, + 4, + 0.25 + ], + "texture": "#0" + }, + "west": { + "uv": [ + 0, + 0, + 0.25, + 0.25 + ], + "texture": "#0" + }, + "up": { + "uv": [ + 4, + 4, + 0, + 3.75 + ], + "texture": "#0" + }, + "down": { + "uv": [ + 4, + 3.75, + 0, + 4 + ], + "texture": "#0" + } + } + }, + { + "from": [ + 0, + 13, + 1 + ], + "to": [ + 1, + 14, + 15 + ], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [ + 0, + 13, + 1 + ] + }, + "faces": { + "north": { + "uv": [ + 0.75, + 0.5, + 1, + 0.75 + ], + "texture": "#0" + }, + "east": { + "uv": [ + -2.75, + 0.5, + 0.75, + 0.75 + ], + "texture": "#0" + }, + "south": { + "uv": [ + 4.5, + 0.5, + 4.75, + 0.75 + ], + "texture": "#0" + }, + "west": { + "uv": [ + 0.25, + 0, + 3.75, + 0.25 + ], + "texture": "#0" + }, + "up": { + "uv": [ + 0.25, + 3.75, + 0, + 0.25 + ], + "texture": "#0" + }, + "down": { + "uv": [ + 4, + 0.25, + 3.75, + 3.75 + ], + "texture": "#0" + } + } + }, + { + "from": [ + 15, + 13, + 1 + ], + "to": [ + 16, + 14, + 15 + ], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [ + 15, + 13, + 1 + ] + }, + "faces": { + "north": { + "uv": [ + 0.75, + 0.5, + 1, + 0.75 + ], + "texture": "#0" + }, + "east": { + "uv": [ + 0, + 0, + 3.5, + 0.25 + ], + "texture": "#0" + }, + "south": { + "uv": [ + 4.5, + 0.5, + 4.75, + 0.75 + ], + "texture": "#0" + }, + "west": { + "uv": [ + 1, + 0.5, + 4.5, + 0.75 + ], + "texture": "#0" + }, + "up": { + "uv": [ + 0.25, + 3.5, + 0, + 0 + ], + "texture": "#0" + }, + "down": { + "uv": [ + 4, + 0, + 3.75, + 3.5 + ], + "texture": "#0" + } + } + }, + { + "from": [ + 1.5, + 6, + 7 + ], + "to": [ + 2.5, + 7, + 9 + ], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [ + 1, + 6, + 7 + ] + }, + "faces": { + "north": { + "uv": [ + 4.5, + 1.75, + 4.75, + 2 + ], + "texture": "#0" + }, + "east": { + "uv": [ + 4.25, + 1.5, + 4.75, + 1.75 + ], + "texture": "#0" + }, + "south": { + "uv": [ + 4.25, + 1.5, + 4.5, + 1.75 + ], + "texture": "#0" + }, + "west": { + "uv": [ + 4.25, + 1.75, + 4.75, + 2 + ], + "texture": "#0" + }, + "up": { + "uv": [ + 4.5, + 2, + 4.25, + 1.5 + ], + "texture": "#0" + }, + "down": { + "uv": [ + 4.5, + 1.5, + 4.25, + 2 + ], + "texture": "#0" + } + } + }, + { + "from": [ + 1.5, + 8, + 7 + ], + "to": [ + 2.5, + 9, + 9 + ], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [ + 1, + 8, + 7 + ] + }, + "faces": { + "north": { + "uv": [ + 4.5, + 1.75, + 4.75, + 2 + ], + "texture": "#0" + }, + "east": { + "uv": [ + 4.25, + 1.5, + 4.75, + 1.75 + ], + "texture": "#0" + }, + "south": { + "uv": [ + 4.25, + 1.5, + 4.5, + 1.75 + ], + "texture": "#0" + }, + "west": { + "uv": [ + 4.25, + 1.75, + 4.75, + 2 + ], + "texture": "#0" + }, + "up": { + "uv": [ + 4.5, + 2, + 4.25, + 1.5 + ], + "texture": "#0" + }, + "down": { + "uv": [ + 4.5, + 1.5, + 4.25, + 2 + ], + "texture": "#0" + } + } + }, + { + "from": [ + 1.5, + 10, + 7 + ], + "to": [ + 2.5, + 11, + 9 + ], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [ + 1, + 10, + 7 + ] + }, + "faces": { + "north": { + "uv": [ + 4.5, + 1.75, + 4.75, + 2 + ], + "texture": "#0" + }, + "east": { + "uv": [ + 4.25, + 1.5, + 4.75, + 1.75 + ], + "texture": "#0" + }, + "south": { + "uv": [ + 4.25, + 1.5, + 4.5, + 1.75 + ], + "texture": "#0" + }, + "west": { + "uv": [ + 4.25, + 1.75, + 4.75, + 2 + ], + "texture": "#0" + }, + "up": { + "uv": [ + 4.5, + 2, + 4.25, + 1.5 + ], + "texture": "#0" + }, + "down": { + "uv": [ + 4.5, + 1.5, + 4.25, + 2 + ], + "texture": "#0" + } + } + }, + { + "from": [ + 1.5, + 12, + 7 + ], + "to": [ + 2.5, + 13, + 9 + ], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [ + 1, + 12, + 7 + ] + }, + "faces": { + "north": { + "uv": [ + 4.5, + 1.75, + 4.75, + 2 + ], + "texture": "#0" + }, + "east": { + "uv": [ + 4.25, + 1.5, + 4.75, + 1.75 + ], + "texture": "#0" + }, + "south": { + "uv": [ + 4.25, + 1.5, + 4.5, + 1.75 + ], + "texture": "#0" + }, + "west": { + "uv": [ + 4.25, + 1.75, + 4.75, + 2 + ], + "texture": "#0" + }, + "up": { + "uv": [ + 4.5, + 2, + 4.25, + 1.5 + ], + "texture": "#0" + }, + "down": { + "uv": [ + 4.5, + 1.5, + 4.25, + 2 + ], + "texture": "#0" + } + } + }, + { + "from": [ + 13.5, + 6, + 7 + ], + "to": [ + 14.5, + 7, + 9 + ], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [ + 13, + 6, + 7 + ] + }, + "faces": { + "north": { + "uv": [ + 4.5, + 1.75, + 4.75, + 2 + ], + "texture": "#0" + }, + "east": { + "uv": [ + 4.25, + 1.5, + 4.75, + 1.75 + ], + "texture": "#0" + }, + "south": { + "uv": [ + 4.25, + 1.5, + 4.5, + 1.75 + ], + "texture": "#0" + }, + "west": { + "uv": [ + 4.25, + 1.75, + 4.75, + 2 + ], + "texture": "#0" + }, + "up": { + "uv": [ + 4.5, + 2, + 4.25, + 1.5 + ], + "texture": "#0" + }, + "down": { + "uv": [ + 4.5, + 1.5, + 4.25, + 2 + ], + "texture": "#0" + } + } + }, + { + "from": [ + 13.5, + 8, + 7 + ], + "to": [ + 14.5, + 9, + 9 + ], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [ + 13, + 8, + 7 + ] + }, + "faces": { + "north": { + "uv": [ + 4.5, + 1.75, + 4.75, + 2 + ], + "texture": "#0" + }, + "east": { + "uv": [ + 4.25, + 1.5, + 4.75, + 1.75 + ], + "texture": "#0" + }, + "south": { + "uv": [ + 4.25, + 1.5, + 4.5, + 1.75 + ], + "texture": "#0" + }, + "west": { + "uv": [ + 4.25, + 1.75, + 4.75, + 2 + ], + "texture": "#0" + }, + "up": { + "uv": [ + 4.5, + 2, + 4.25, + 1.5 + ], + "texture": "#0" + }, + "down": { + "uv": [ + 4.5, + 1.5, + 4.25, + 2 + ], + "texture": "#0" + } + } + }, + { + "from": [ + 13.5, + 10, + 7 + ], + "to": [ + 14.5, + 11, + 9 + ], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [ + 13, + 10, + 7 + ] + }, + "faces": { + "north": { + "uv": [ + 4.5, + 1.75, + 4.75, + 2 + ], + "texture": "#0" + }, + "east": { + "uv": [ + 4.25, + 1.5, + 4.75, + 1.75 + ], + "texture": "#0" + }, + "south": { + "uv": [ + 4.25, + 1.5, + 4.5, + 1.75 + ], + "texture": "#0" + }, + "west": { + "uv": [ + 4.25, + 1.75, + 4.75, + 2 + ], + "texture": "#0" + }, + "up": { + "uv": [ + 4.5, + 2, + 4.25, + 1.5 + ], + "texture": "#0" + }, + "down": { + "uv": [ + 4.5, + 1.5, + 4.25, + 2 + ], + "texture": "#0" + } + } + }, + { + "from": [ + 13.5, + 12, + 7 + ], + "to": [ + 14.5, + 13, + 9 + ], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [ + 13, + 12, + 7 + ] + }, + "faces": { + "north": { + "uv": [ + 4.5, + 1.75, + 4.75, + 2 + ], + "texture": "#0" + }, + "east": { + "uv": [ + 4.25, + 1.5, + 4.75, + 1.75 + ], + "texture": "#0" + }, + "south": { + "uv": [ + 4.25, + 1.5, + 4.5, + 1.75 + ], + "texture": "#0" + }, + "west": { + "uv": [ + 4.25, + 1.75, + 4.75, + 2 + ], + "texture": "#0" + }, + "up": { + "uv": [ + 4.5, + 2, + 4.25, + 1.5 + ], + "texture": "#0" + }, + "down": { + "uv": [ + 4.5, + 1.5, + 4.25, + 2 + ], + "texture": "#0" + } + } + } + ], + "groups": [ + { + "name": "rotaryunifier", + "origin": [ + 8, + 8, + 8 + ], + "color": 0, + "children": [ + { + "name": "frame", + "origin": [ + 0, + 0, + 0 + ], + "color": 0, + "children": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ] + }, + { + "name": "tubes", + "origin": [ + 8, + 8, + 8 + ], + "color": 0, + "children": [ + 11, + 12, + 13, + 14 + ] + }, + { + "name": "tubes", + "origin": [ + 8, + 8, + 8 + ], + "color": 0, + "children": [ + 15, + 16, + 17, + 18 + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/electrodynamics/textures/block/model/rotaryunifier.png b/src/main/resources/assets/electrodynamics/textures/block/model/rotaryunifier.png new file mode 100644 index 000000000..14cd9afd5 Binary files /dev/null and b/src/main/resources/assets/electrodynamics/textures/block/model/rotaryunifier.png differ diff --git a/src/main/resources/data/electrodynamics/machines/rotary_unifier_mappings.json b/src/main/resources/data/electrodynamics/machines/rotary_unifier_mappings.json new file mode 100644 index 000000000..06b566052 --- /dev/null +++ b/src/main/resources/data/electrodynamics/machines/rotary_unifier_mappings.json @@ -0,0 +1,6 @@ +{ + "electrodynamics:hydrogen": "mekanism:hydrogen", + "electrodynamics:oxygen": "mekanism:oxygen", + "electrodynamics:steam": "mekanism:steam", + "electrodynamics:sulfurdioxide": "mekanism:sulfur_dioxide" +} \ No newline at end of file