Skip to content

Commit

Permalink
feat: ✨ Updated upgrade code to keep it compatible with the latest ve…
Browse files Browse the repository at this point in the history
…rsion of core
  • Loading branch information
P3pp3rF1y committed Dec 31, 2024
1 parent a8d8157 commit ce53eca
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 8 deletions.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ org.gradle.daemon=false

mod_id=sophisticatedbackpacks
mod_group_id=sophisticatedbackpacks
mod_version=3.21.1
mod_version=3.21.2
sonar_project_key=sophisticatedbackpacks:SophisticatedBackpacks
github_package_url=https://maven.pkg.github.com/P3pp3rF1y/SophisticatedBackpacks

Expand Down Expand Up @@ -31,5 +31,5 @@ crafting_tweaks_cf_file_id=4596466
chipped_cf_file_id=5077656
resourcefullib_cf_file_id=5070629
athena_cf_file_id=4764357
sc_version=[1.20.1-1.0.4,1.20.4)
sc_version=[1.20.1-1.0.5,1.20.4)
parchment_version=2023.09.03-1.20.1
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public BackpackBlockEntity(BlockPos pos, BlockState state) {

public void setBackpack(ItemStack backpack) {
backpackWrapper = backpack.getCapability(CapabilityBackpackWrapper.getCapabilityInstance()).orElse(IBackpackWrapper.Noop.INSTANCE);
backpackWrapper.setSaveHandler(() -> {
backpackWrapper.setContentsChangeHandler(() -> {
setChanged();
updateBlockRender = false;
WorldHelper.notifyBlockUpdate(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public BackpackWrapper(ItemStack backpack) {
}

@Override
public void setSaveHandler(Runnable saveHandler) {
public void setContentsChangeHandler(Runnable saveHandler) {
backpackSaveHandler = saveHandler;
refreshInventoryForUpgradeProcessing();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import net.minecraft.network.chat.Component;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.SimpleMenuProvider;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.Slot;
Expand Down Expand Up @@ -57,6 +58,11 @@ public Optional<BlockPos> getBlockPosition() {
return Optional.empty();
}

@Override
public Optional<Entity> getEntity() {
return Optional.of(player);
}

@Override
protected void sendStorageSettingsToClient() {
if (player.level().isClientSide) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
public class SBPPacketHandler extends PacketHandler {
public static final SBPPacketHandler INSTANCE = new SBPPacketHandler(SophisticatedBackpacks.MOD_ID);

public SBPPacketHandler(String modId) {
private SBPPacketHandler(String modId) {
super(modId);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import net.minecraft.network.chat.Component;
import net.minecraft.util.StringRepresentable;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
Expand Down Expand Up @@ -86,7 +86,7 @@ public FilterLogic getFilterLogic() {
}

@Override
public void tick(@Nullable LivingEntity entity, Level world, BlockPos pos) {
public void tick(@Nullable Entity entity, Level world, BlockPos pos) {
if (entity == null /*not supported in block form*/ || isInCooldown(world)) {
return;
}
Expand All @@ -99,7 +99,7 @@ public void tick(@Nullable LivingEntity entity, Level world, BlockPos pos) {
setCooldown(world, COOLDOWN);
}

private void tryRefillFilter(@Nonnull LivingEntity entity, IItemHandler playerInvHandler, ItemStack filter, TargetSlot targetSlot) {
private void tryRefillFilter(@Nonnull Entity entity, IItemHandler playerInvHandler, ItemStack filter, TargetSlot targetSlot) {
if (!(entity instanceof Player player)) {
return;
}
Expand Down

0 comments on commit ce53eca

Please sign in to comment.