Skip to content

Commit

Permalink
Merge pull request #662 from refinedmods/fix/GH-660/custom-name
Browse files Browse the repository at this point in the history
fix: retain and use custom names
  • Loading branch information
raoulvdberge authored Aug 11, 2024
2 parents 68798f4 + 4b18690 commit 1e92b54
Show file tree
Hide file tree
Showing 293 changed files with 2,508 additions and 99 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
- External Storage screen unnecessarily showing upgrade slots.
- Grid setting changes not persisting after restarting Minecraft.
- Fixed not being able to extract fluids from the Grid with an empty bucket or other empty fluid container.
- All blocks and items now correctly retain their custom name.

## [2.0.0-milestone.4.6] - 2024-08-08

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@

import java.util.List;
import java.util.Optional;
import javax.annotation.Nullable;

import net.minecraft.core.component.DataComponents;
import net.minecraft.network.chat.Component;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.InteractionHand;
Expand Down Expand Up @@ -69,10 +71,13 @@ public void use(final ServerPlayer player, final ItemStack stack, final SlotRefe
player,
slotReference
);
use(player, slotReference, context);
use(stack.get(DataComponents.CUSTOM_NAME), player, slotReference, context);
}

protected abstract void use(ServerPlayer player, SlotReference slotReference, NetworkItemContext context);
protected abstract void use(@Nullable Component name,
ServerPlayer player,
SlotReference slotReference,
NetworkItemContext context);

public boolean isBound(final ItemStack stack) {
return networkItemHelper.isBound(stack);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
{
"type": "minecraft:block",
"functions": [
{
"function": "minecraft:copy_components",
"include": [
"minecraft:custom_name"
],
"source": "block_entity"
}
],
"pools": [
{
"bonus_rolls": 0.0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
{
"type": "minecraft:block",
"functions": [
{
"function": "minecraft:copy_components",
"include": [
"minecraft:custom_name"
],
"source": "block_entity"
}
],
"pools": [
{
"bonus_rolls": 0.0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
"functions": [
{
"function": "refinedstorage:energy"
},
{
"function": "minecraft:copy_components",
"include": [
"minecraft:custom_name"
],
"source": "block_entity"
}
],
"pools": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
{
"type": "minecraft:block",
"functions": [
{
"function": "minecraft:copy_components",
"include": [
"minecraft:custom_name"
],
"source": "block_entity"
}
],
"pools": [
{
"bonus_rolls": 0.0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
{
"type": "minecraft:block",
"functions": [
{
"function": "minecraft:copy_components",
"include": [
"minecraft:custom_name"
],
"source": "block_entity"
}
],
"pools": [
{
"bonus_rolls": 0.0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
{
"type": "minecraft:block",
"functions": [
{
"function": "minecraft:copy_components",
"include": [
"minecraft:custom_name"
],
"source": "block_entity"
}
],
"pools": [
{
"bonus_rolls": 0.0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
{
"type": "minecraft:block",
"functions": [
{
"function": "minecraft:copy_components",
"include": [
"minecraft:custom_name"
],
"source": "block_entity"
}
],
"pools": [
{
"bonus_rolls": 0.0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
{
"type": "minecraft:block",
"functions": [
{
"function": "minecraft:copy_components",
"include": [
"minecraft:custom_name"
],
"source": "block_entity"
}
],
"pools": [
{
"bonus_rolls": 0.0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
{
"type": "minecraft:block",
"functions": [
{
"function": "minecraft:copy_components",
"include": [
"minecraft:custom_name"
],
"source": "block_entity"
}
],
"pools": [
{
"bonus_rolls": 0.0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
{
"type": "minecraft:block",
"functions": [
{
"function": "minecraft:copy_components",
"include": [
"minecraft:custom_name"
],
"source": "block_entity"
}
],
"pools": [
{
"bonus_rolls": 0.0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
{
"type": "minecraft:block",
"functions": [
{
"function": "minecraft:copy_components",
"include": [
"minecraft:custom_name"
],
"source": "block_entity"
}
],
"pools": [
{
"bonus_rolls": 0.0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
{
"type": "minecraft:block",
"functions": [
{
"function": "minecraft:copy_components",
"include": [
"minecraft:custom_name"
],
"source": "block_entity"
}
],
"pools": [
{
"bonus_rolls": 0.0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
{
"type": "minecraft:block",
"functions": [
{
"function": "minecraft:copy_components",
"include": [
"minecraft:custom_name"
],
"source": "block_entity"
}
],
"pools": [
{
"bonus_rolls": 0.0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
{
"type": "minecraft:block",
"functions": [
{
"function": "minecraft:copy_components",
"include": [
"minecraft:custom_name"
],
"source": "block_entity"
}
],
"pools": [
{
"bonus_rolls": 0.0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
{
"type": "minecraft:block",
"functions": [
{
"function": "minecraft:copy_components",
"include": [
"minecraft:custom_name"
],
"source": "block_entity"
}
],
"pools": [
{
"bonus_rolls": 0.0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
{
"type": "minecraft:block",
"functions": [
{
"function": "minecraft:copy_components",
"include": [
"minecraft:custom_name"
],
"source": "block_entity"
}
],
"pools": [
{
"bonus_rolls": 0.0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
{
"type": "minecraft:block",
"functions": [
{
"function": "minecraft:copy_components",
"include": [
"minecraft:custom_name"
],
"source": "block_entity"
}
],
"pools": [
{
"bonus_rolls": 0.0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
"functions": [
{
"function": "refinedstorage:energy"
},
{
"function": "minecraft:copy_components",
"include": [
"minecraft:custom_name"
],
"source": "block_entity"
}
],
"pools": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
{
"type": "minecraft:block",
"functions": [
{
"function": "minecraft:copy_components",
"include": [
"minecraft:custom_name"
],
"source": "block_entity"
}
],
"pools": [
{
"bonus_rolls": 0.0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
{
"type": "minecraft:block",
"functions": [
{
"function": "minecraft:copy_components",
"include": [
"minecraft:custom_name"
],
"source": "block_entity"
}
],
"pools": [
{
"bonus_rolls": 0.0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
{
"type": "minecraft:block",
"functions": [
{
"function": "minecraft:copy_components",
"include": [
"minecraft:custom_name"
],
"source": "block_entity"
}
],
"pools": [
{
"bonus_rolls": 0.0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
{
"type": "minecraft:block",
"functions": [
{
"function": "minecraft:copy_components",
"include": [
"minecraft:custom_name"
],
"source": "block_entity"
}
],
"pools": [
{
"bonus_rolls": 0.0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
{
"type": "minecraft:block",
"functions": [
{
"function": "minecraft:copy_components",
"include": [
"minecraft:custom_name"
],
"source": "block_entity"
}
],
"pools": [
{
"bonus_rolls": 0.0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
{
"type": "minecraft:block",
"functions": [
{
"function": "minecraft:copy_components",
"include": [
"minecraft:custom_name"
],
"source": "block_entity"
}
],
"pools": [
{
"bonus_rolls": 0.0,
Expand Down
Loading

0 comments on commit 1e92b54

Please sign in to comment.