Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: retain and use custom names #662

Merged
merged 1 commit into from
Aug 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading