Skip to content

Commit

Permalink
Fix relays having the same transfer limit
Browse files Browse the repository at this point in the history
  • Loading branch information
gigabit101 committed Aug 2, 2024
1 parent f4c55fb commit c46a22d
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ public int getCount()
}
};

public abstract double getTransferRate();


public BlockEntityRelay(BlockEntityType<?> blockEntityType, BlockPos blockPos, BlockState blockState, double capacity)
{
Expand Down Expand Up @@ -76,7 +78,7 @@ public void discharge()
BlockPos blockPos = getBlockPos().relative(value);
if(level.getBlockEntity(blockPos) != null && level.getBlockEntity(blockPos) instanceof IEmcStorage iEmcStorage && iEmcStorage.canReceive())
{
double removed = iEmcStorage.receiveEmc(Math.min(getStoredEmc(), 500), false);
double removed = iEmcStorage.receiveEmc(Math.min(getStoredEmc(), getTransferRate()), false);
extractEmc(removed, false);
}
}
Expand All @@ -92,7 +94,7 @@ public void burnItem()
{
if(itemKleinStar.getKleinStarStored(stack) > 0)
{
double energyRemoved = receiveEmc(Math.min(itemKleinStar.getKleinStarStored(stack), 2500), false);
double energyRemoved = receiveEmc(Math.min(itemKleinStar.getKleinStarStored(stack), getTransferRate()), false);
itemKleinStar.extractKleinStarEmc(stack, energyRemoved, false);
}
return;
Expand All @@ -118,7 +120,7 @@ public void charge()
ItemStack stack = getContainer(Direction.UP).getItem(1);
if(iEmcItem.canReceive(stack))
{
double energyRemoved = iEmcItem.receiveEmc(stack, Math.min(getStoredEmc(), 2500), false);
double energyRemoved = iEmcItem.receiveEmc(stack, Math.min(getStoredEmc(), getTransferRate()), false);
extractEmc(energyRemoved, false);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package net.creeperhost.equivalentexchange.blockentities.relays;

import net.creeperhost.equivalentexchange.Constants;
import net.creeperhost.equivalentexchange.EquivalentExchange;
import net.creeperhost.equivalentexchange.blockentities.prefab.BlockEntityRelay;
import net.creeperhost.equivalentexchange.containers.relays.ContainerRelayMK1;
import net.creeperhost.equivalentexchange.init.ModBlocks;
Expand Down Expand Up @@ -43,4 +44,9 @@ public Container getContainer(@Nullable Direction side)
{
return simpleItemInventory == null ? this.simpleItemInventory = new BlockInventory(this, 8) : this.simpleItemInventory;
}

@Override
public double getTransferRate() {
return EquivalentExchange.CONFIG_DATA.BasicRelayTransferRate;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package net.creeperhost.equivalentexchange.blockentities.relays;

import net.creeperhost.equivalentexchange.Constants;
import net.creeperhost.equivalentexchange.EquivalentExchange;
import net.creeperhost.equivalentexchange.blockentities.prefab.BlockEntityRelay;
import net.creeperhost.equivalentexchange.containers.relays.ContainerRelayMK2;
import net.creeperhost.equivalentexchange.init.ModBlocks;
Expand Down Expand Up @@ -42,4 +43,9 @@ public AbstractContainerMenu createMenu(int i, @NotNull Inventory inventory, @No
public Container getContainer(@Nullable Direction side) {
return simpleItemInventory == null ? this.simpleItemInventory = new BlockInventory(this, 14) : this.simpleItemInventory;
}

@Override
public double getTransferRate() {
return EquivalentExchange.CONFIG_DATA.DarkMatterRelayTransferRate;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package net.creeperhost.equivalentexchange.blockentities.relays;

import net.creeperhost.equivalentexchange.Constants;
import net.creeperhost.equivalentexchange.EquivalentExchange;
import net.creeperhost.equivalentexchange.blockentities.prefab.BlockEntityRelay;
import net.creeperhost.equivalentexchange.containers.relays.ContainerRelayMK3;
import net.creeperhost.equivalentexchange.init.ModBlocks;
Expand Down Expand Up @@ -42,4 +43,9 @@ public AbstractContainerMenu createMenu(int i, @NotNull Inventory inventory, @No
public Container getContainer(@Nullable Direction side) {
return simpleItemInventory == null ? this.simpleItemInventory = new BlockInventory(this, 22) : this.simpleItemInventory;
}

@Override
public double getTransferRate() {
return EquivalentExchange.CONFIG_DATA.RedMatterRelayTransferRate;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,13 @@ public class EE3ConfigData extends ConfigData

@Comment("Evertide Pedestal cost in EMC")
public double EvertidePedestalCost = 1000;

@Comment("Basic Relay transfer rate")
public double BasicRelayTransferRate = 500;

@Comment("Dark matter Relay transfer rate")
public double DarkMatterRelayTransferRate = 2500;

@Comment("Red matter Relay transfer rate")
public double RedMatterRelayTransferRate = 5000;
}

0 comments on commit c46a22d

Please sign in to comment.