Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
CreatureChat
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
Public
CreatureChat
Commits
a5fb3933
Commit
a5fb3933
authored
Feb 20, 2025
by
Jonathan Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wandering Trader no longer despawns if it has chat data
parent
15045b4a
Pipeline
#13343
passed with stages
in 2 minutes 17 seconds
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
0 deletions
+34
-0
CHANGELOG.md
CHANGELOG.md
+1
-0
MixinWanderingTrader.java
src/main/java/com/owlmaddie/mixin/MixinWanderingTrader.java
+32
-0
creaturechat.mixins.json
src/main/resources/creaturechat.mixins.json
+1
-0
No files found.
CHANGELOG.md
View file @
a5fb3933
...
...
@@ -15,6 +15,7 @@ All notable changes to **CreatureChat** are documented in this file. The format
### Fixed
-
Bees no longer forget their chat data when entering/leaving hives (writeNbt & readNbt modified)
-
Vexes no longer take damage when chat data exists
-
Wandering Trader no longer despawns if it has chat data
## [1.3.0] - 2025-01-14
...
...
src/main/java/com/owlmaddie/mixin/MixinWanderingTrader.java
0 → 100644
View file @
a5fb3933
package
com
.
owlmaddie
.
mixin
;
import
com.owlmaddie.chat.ChatDataManager
;
import
com.owlmaddie.chat.EntityChatData
;
import
net.minecraft.entity.passive.WanderingTraderEntity
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.spongepowered.asm.mixin.Mixin
;
import
org.spongepowered.asm.mixin.injection.At
;
import
org.spongepowered.asm.mixin.injection.Inject
;
import
org.spongepowered.asm.mixin.injection.callback.CallbackInfo
;
/**
* Prevents WanderingTraderEntity from despawning if it has chat data or a character sheet.
*/
@Mixin
(
WanderingTraderEntity
.
class
)
public
abstract
class
MixinWanderingTrader
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
"creaturechat"
);
@Inject
(
method
=
"tickDespawnDelay"
,
at
=
@At
(
"HEAD"
),
cancellable
=
true
)
private
void
preventTraderDespawn
(
CallbackInfo
ci
)
{
WanderingTraderEntity
trader
=
(
WanderingTraderEntity
)
(
Object
)
this
;
// Get chat data for this trader
EntityChatData
chatData
=
ChatDataManager
.
getServerInstance
().
getOrCreateChatData
(
trader
.
getUuidAsString
());
// If the character sheet is not empty, cancel the function to prevent despawning
if
(!
chatData
.
characterSheet
.
isEmpty
())
{
ci
.
cancel
();
}
}
}
src/main/resources/creaturechat.mixins.json
View file @
a5fb3933
...
...
@@ -10,6 +10,7 @@
"MixinEntityChatData"
,
"MixinWitherEntity"
,
"MixinVexEntity"
,
"MixinWanderingTrader"
,
"MixinVillagerEntity"
,
"MixinOnChat"
],
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment