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
7717d5ac
Commit
7717d5ac
authored
Oct 13, 2024
by
Jonathan Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New sounds and particles when max friendship with EnderDragon (plus XP drop)
parent
881437f9
Pipeline
#12983
passed with stages
in 2 minutes 6 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
0 deletions
+31
-0
CHANGELOG.md
CHANGELOG.md
+1
-0
EntityChatData.java
src/main/java/com/owlmaddie/chat/EntityChatData.java
+30
-0
No files found.
CHANGELOG.md
View file @
7717d5ac
...
...
@@ -12,6 +12,7 @@ All notable changes to **CreatureChat** are documented in this file. The format
-
New follow, flee, attack, and protect particles & sound effects
-
New animated lead particle (arrows pointing where they are going)
-
New animated attack particles (with random # of particles)
-
New sounds and particles when max friendship with EnderDragon (plus XP drop)
### Changed
-
Entity chat data now separates messages and friendship by player and includes timestamps
...
...
src/main/java/com/owlmaddie/chat/EntityChatData.java
View file @
7717d5ac
...
...
@@ -13,6 +13,7 @@ import com.owlmaddie.particle.ParticleEmitter;
import
com.owlmaddie.utils.Randomizer
;
import
com.owlmaddie.utils.ServerEntityFinder
;
import
com.owlmaddie.utils.VillagerEntityAccessor
;
import
net.minecraft.entity.ExperienceOrbEntity
;
import
net.minecraft.entity.boss.dragon.EnderDragonEntity
;
import
net.minecraft.entity.mob.MobEntity
;
import
net.minecraft.entity.passive.TameableEntity
;
...
...
@@ -20,8 +21,11 @@ import net.minecraft.entity.passive.VillagerEntity;
import
net.minecraft.item.ItemStack
;
import
net.minecraft.server.network.ServerPlayerEntity
;
import
net.minecraft.server.world.ServerWorld
;
import
net.minecraft.sound.SoundCategory
;
import
net.minecraft.sound.SoundEvents
;
import
net.minecraft.util.math.MathHelper
;
import
net.minecraft.village.VillageGossipType
;
import
net.minecraft.world.GameRules
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -365,6 +369,32 @@ public class EntityChatData {
if
(
entity
instanceof
EnderDragonEntity
&&
new_friendship
==
3
)
{
// Trigger end of game (friendship always wins!)
EnderDragonEntity
dragon
=
(
EnderDragonEntity
)
entity
;
// Emit particles & sound
ParticleEmitter
.
emitCreatureParticle
((
ServerWorld
)
entity
.
getWorld
(),
entity
,
HEART_BIG_PARTICLE
,
3
,
200
);
entity
.
getWorld
().
playSound
(
entity
,
entity
.
getBlockPos
(),
SoundEvents
.
ENTITY_ENDER_DRAGON_DEATH
,
SoundCategory
.
PLAYERS
,
0.3
F
,
1.0
F
);
entity
.
getWorld
().
playSound
(
entity
,
entity
.
getBlockPos
(),
SoundEvents
.
UI_TOAST_CHALLENGE_COMPLETE
,
SoundCategory
.
PLAYERS
,
0.5
F
,
1.0
F
);
// Check if the game rule for mob loot is enabled
boolean
doMobLoot
=
entity
.
getWorld
().
getGameRules
().
getBoolean
(
GameRules
.
DO_MOB_LOOT
);
// If this is the first time the dragon is 'befriended', adjust the XP
int
baseXP
=
500
;
if
(
dragon
.
getFight
()
!=
null
&&
!
dragon
.
getFight
().
hasPreviouslyKilled
())
{
baseXP
=
12000
;
}
// If the world is a server world and mob loot is enabled, spawn XP orbs
if
(
entity
.
getWorld
()
instanceof
ServerWorld
&&
doMobLoot
)
{
// Loop to spawn XP orbs
for
(
int
j
=
1
;
j
<=
11
;
j
++)
{
float
xpFraction
=
(
j
==
11
)
?
0.2
F
:
0.08
F
;
int
xpAmount
=
MathHelper
.
floor
((
float
)
baseXP
*
xpFraction
);
ExperienceOrbEntity
.
spawn
((
ServerWorld
)
entity
.
getWorld
(),
entity
.
getPos
(),
xpAmount
);
}
}
// Mark fight as over
dragon
.
getFight
().
dragonKilled
(
dragon
);
}
}
...
...
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