Skip to content

Commit

Permalink
Merge pull request #18 from FTBTeam/dev/1.20.4
Browse files Browse the repository at this point in the history
Dev/1.20.4
  • Loading branch information
gigabit101 authored Aug 2, 2024
2 parents e0a36a9 + f6ac9a6 commit c663ab1
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
import net.creeperhost.polylib.inventory.items.PolyInventoryBlock;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.inventory.ContainerData;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import org.jetbrains.annotations.NotNull;

public abstract class BlockEntityRelay extends EmcBlockEntity implements PolyInventoryBlock
{
Expand Down Expand Up @@ -44,6 +46,8 @@ public int getCount()
}
};

public abstract double getTransferRate();


public BlockEntityRelay(BlockEntityType<?> blockEntityType, BlockPos blockPos, BlockState blockState, double capacity)
{
Expand Down Expand Up @@ -74,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 @@ -90,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 @@ -116,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 Expand Up @@ -144,4 +148,17 @@ public void moveItems()
}
}
}

@Override
public void saveAdditional(@NotNull CompoundTag compoundTag) {
super.saveAdditional(compoundTag);
simpleItemInventory.serialize(compoundTag);
}

@Override
public void load(@NotNull CompoundTag compoundTag) {
super.load(compoundTag);
getContainer(Direction.UP);
simpleItemInventory.deserialize(compoundTag);
}
}
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;
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx4096M
minecraft_version=1.20.4

archives_base_name=equivalentexchange
mod_version=1.0.10
mod_version=1.0.11

maven_group=net.creeperhost
curse_project_id=623122
Expand Down

0 comments on commit c663ab1

Please sign in to comment.