-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add heat conduits (and temp texture)
- Loading branch information
1 parent
5e5dfa4
commit b518cfe
Showing
9 changed files
with
109 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
src/conduits/java/com/enderio/conduits/common/integrations/mekanism/HeatConduitType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.enderio.conduits.common.integrations.mekanism; | ||
Check failure on line 1 in src/conduits/java/com/enderio/conduits/common/integrations/mekanism/HeatConduitType.java GitHub Actions / runner / checkstyle
|
||
|
||
import com.enderio.api.conduit.ConduitTypes; | ||
import com.enderio.api.conduit.IConduitMenuData; | ||
import com.enderio.api.conduit.ticker.IConduitTicker; | ||
import com.enderio.api.misc.Vector2i; | ||
import com.enderio.conduits.EIOConduits; | ||
import com.enderio.conduits.common.init.EnderConduitTypes; | ||
import com.enderio.conduits.common.types.SimpleConduitType; | ||
import net.minecraft.resources.ResourceLocation; | ||
|
||
import java.util.function.Supplier; | ||
|
||
public class HeatConduitType extends SimpleConduitType<HeatExtendedData> { | ||
|
||
public static final IConduitMenuData MENU_DATA = new IConduitMenuData.Simple(false, false, false, false, false, true); | ||
|
||
public HeatConduitType(ResourceLocation texture, Vector2i iconTexturePos) { | ||
super(texture, new HeatTicker(), HeatExtendedData::new, EnderConduitTypes.ICON_TEXTURE, iconTexturePos, MENU_DATA); | ||
} | ||
|
||
} |
16 changes: 16 additions & 0 deletions
16
src/conduits/java/com/enderio/conduits/common/integrations/mekanism/HeatExtendedData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.enderio.conduits.common.integrations.mekanism; | ||
|
||
import com.enderio.api.conduit.IExtendedConduitData; | ||
import net.minecraft.nbt.CompoundTag; | ||
|
||
public class HeatExtendedData implements IExtendedConduitData<HeatExtendedData> { | ||
@Override | ||
public CompoundTag serializeNBT() { | ||
return new CompoundTag(); | ||
} | ||
|
||
@Override | ||
public void deserializeNBT(CompoundTag nbt) { | ||
|
||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
src/conduits/java/com/enderio/conduits/common/integrations/mekanism/HeatTicker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.enderio.conduits.common.integrations.mekanism; | ||
|
||
import com.enderio.api.conduit.IConduitType; | ||
import com.enderio.api.conduit.ticker.CapabilityAwareConduitTicker; | ||
import com.enderio.api.misc.ColorControl; | ||
import dev.gigaherz.graph3.Graph; | ||
import dev.gigaherz.graph3.Mergeable; | ||
import mekanism.api.heat.HeatAPI; | ||
import mekanism.api.heat.IHeatHandler; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.core.Direction; | ||
import net.minecraft.server.level.ServerLevel; | ||
import net.neoforged.neoforge.capabilities.BlockCapability; | ||
import org.apache.commons.lang3.function.TriFunction; | ||
|
||
import java.util.List; | ||
|
||
public class HeatTicker extends CapabilityAwareConduitTicker<IHeatHandler> { | ||
|
||
public HeatTicker() { | ||
} | ||
|
||
@Override | ||
protected void tickCapabilityGraph(IConduitType<?> type, List<CapabilityAwareConduitTicker<IHeatHandler>.CapabilityConnection> inserts, | ||
List<CapabilityAwareConduitTicker<IHeatHandler>.CapabilityConnection> extracts, ServerLevel level, Graph<Mergeable.Dummy> graph, | ||
TriFunction<ServerLevel, BlockPos, ColorControl, Boolean> isRedstoneActive) { | ||
for (CapabilityConnection extract : extracts) { | ||
IHeatHandler extractHandler = extract.cap; | ||
|
||
for (CapabilityConnection insert : inserts) { | ||
IHeatHandler insertHandler = insert.cap; | ||
|
||
double heatCapacity = extractHandler.getTotalHeatCapacity(); | ||
double invConduction = insertHandler.getTotalInverseConduction() + extractHandler.getTotalInverseConduction(); | ||
double tempToTransfer = (extractHandler.getTotalTemperature() - insertHandler.getTotalTemperature()) / invConduction; //TODO subtract ambient? - HeatAPI.getAmbientTemp(level, ) | ||
|
||
double heatToTransfer = tempToTransfer * heatCapacity; | ||
if (heatToTransfer > 0) { | ||
extractHandler.handleHeat(-heatToTransfer); | ||
insertHandler.handleHeat(heatToTransfer); | ||
} | ||
|
||
} | ||
} | ||
} | ||
|
||
@Override | ||
protected BlockCapability<IHeatHandler, Direction> getCapability() { | ||
return MekanismIntegration.HEAT; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+1.68 KB
src/conduits/resources/assets/enderio/textures/block/conduit/heat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+436 Bytes
(100%)
src/conduits/resources/assets/enderio/textures/gui/conduit_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+11.6 KB
src/conduits/resources/assets/enderio/textures/gui/conduit_icon_old.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
src/generated/resources/assets/enderio/models/item/heat_conduit.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"parent": "enderio:item/conduit", | ||
"textures": { | ||
"0": "enderio:block/conduit/heat" | ||
} | ||
} |