Skip to content

Commit

Permalink
casting banish curse on pastel upgrade code
Browse files Browse the repository at this point in the history
  • Loading branch information
DaFuqs committed Jan 15, 2025
1 parent 20ac7bf commit f8bf8b3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEnt
player.getInventory().offerOrDrop(removed);

blockEntity.updateUpgrades();
blockEntity.markDirty();
blockEntity.updateInClientWorld();
}
}
return ActionResult.success(world.isClient());
Expand All @@ -143,12 +145,14 @@ public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEnt
return ActionResult.PASS;
} else if (stack.isOf(SpectrumItems.PAINTBRUSH)) {
return sendDebugMessage(world, player, blockEntity);
} else if (AdvancementHelper.hasAdvancement(player, SpectrumAdvancements.PASTEL_NODE_UPGRADING) && stack.isIn(SpectrumItemTags.PASTEL_NODE_UPGRADES) && blockEntity.tryInteractRings(stack, pastelNodeType)) {
if (!world.isClient()) {
} else if (AdvancementHelper.hasAdvancement(player, SpectrumAdvancements.PASTEL_NODE_UPGRADING) && stack.isIn(SpectrumItemTags.PASTEL_NODE_UPGRADES)) {
if (!world.isClient() && blockEntity.tryInteractRings(stack, pastelNodeType)) {
SpectrumAdvancementCriteria.PASTEL_NODE_UPGRADING.trigger((ServerPlayerEntity) player, stack);
if (!player.getAbilities().creativeMode)
stack.decrement(1);
blockEntity.updateUpgrades();
blockEntity.markDirty();
blockEntity.updateInClientWorld();
}

world.playSoundAtBlockCenter(pos, SpectrumSoundEvents.MEDIUM_CRYSTAL_RING, SoundCategory.BLOCKS, 0.25F, 0.9F + world.getRandom().nextFloat() * 0.2F, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,6 @@ public void updateUpgrades() {
filterItems.set(i, ItemVariant.blank());
}
}

markDirty();
}

@Override
Expand Down Expand Up @@ -354,12 +352,18 @@ public void readNbt(NbtCompound nbt) {
}
if (nbt.contains("OuterRing")) {
outerRing = Optional.ofNullable(SpectrumRegistries.PASTEL_UPGRADE.get(Identifier.tryParse(nbt.getString("OuterRing"))));
} else {
outerRing = Optional.empty();
}
if (nbt.contains("InnerRing")) {
innerRing = Optional.ofNullable(SpectrumRegistries.PASTEL_UPGRADE.get(Identifier.tryParse(nbt.getString("InnerRing"))));
} else {
innerRing = Optional.empty();
}
if (nbt.contains("RedstoneRing")) {
redstoneRing = Optional.ofNullable(SpectrumRegistries.PASTEL_UPGRADE.get(Identifier.tryParse(nbt.getString("RedstoneRing"))));
} else {
redstoneRing = Optional.empty();
}
if (this.getNodeType().usesFilters()) {
FilterConfigurable.readFilterNbt(nbt, this.filterItems);
Expand Down

0 comments on commit f8bf8b3

Please sign in to comment.