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
046084f0
Commit
046084f0
authored
Sep 24, 2024
by
Jonathan Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding burst of heart particles for max friendship/enemy + sound effects.
parent
c2711ecc
Pipeline
#12873
passed with stages
in 1 minute 59 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
10 deletions
+36
-10
CHANGELOG.md
CHANGELOG.md
+1
-0
BehaviorParticle.java
src/client/java/com/owlmaddie/particle/BehaviorParticle.java
+3
-2
CreatureParticleFactory.java
.../java/com/owlmaddie/particle/CreatureParticleFactory.java
+2
-2
EntityChatData.java
src/main/java/com/owlmaddie/chat/EntityChatData.java
+14
-3
ParticleEmitter.java
src/main/java/com/owlmaddie/particle/ParticleEmitter.java
+16
-3
No files found.
CHANGELOG.md
View file @
046084f0
...
...
@@ -8,6 +8,7 @@ All notable changes to **CreatureChat** are documented in this file. The format
### Added
-
New friendship particles (hearts + fire) to indicate when friendship changes
-
Added sound effects for max friendship and max enemy
### Changed
-
Entity chat data now separates messages and friendship by player
...
...
src/client/java/com/owlmaddie/particle/
Creature
Particle.java
→
src/client/java/com/owlmaddie/particle/
Behavior
Particle.java
View file @
046084f0
...
...
@@ -5,8 +5,8 @@ import net.minecraft.client.particle.SpriteBillboardParticle;
import
net.minecraft.client.world.ClientWorld
;
public
class
Creature
Particle
extends
SpriteBillboardParticle
{
protected
Creature
Particle
(
ClientWorld
world
,
double
x
,
double
y
,
double
z
,
double
velocityX
,
double
velocityY
,
double
velocityZ
)
{
public
class
Behavior
Particle
extends
SpriteBillboardParticle
{
protected
Behavior
Particle
(
ClientWorld
world
,
double
x
,
double
y
,
double
z
,
double
velocityX
,
double
velocityY
,
double
velocityZ
)
{
super
(
world
,
x
,
y
,
z
,
velocityX
,
velocityY
,
velocityZ
);
this
.
scale
(
2
f
);
this
.
setMaxAge
(
35
);
...
...
@@ -15,6 +15,7 @@ public class CreatureParticle extends SpriteBillboardParticle {
this
.
velocityY
=
0.1
;
this
.
velocityX
*=
0.1
;
this
.
velocityZ
*=
0.1
;
this
.
collidesWithWorld
=
false
;
}
@Override
...
...
src/client/java/com/owlmaddie/particle/CreatureParticleFactory.java
View file @
046084f0
...
...
@@ -13,8 +13,8 @@ public class CreatureParticleFactory implements ParticleFactory<DefaultParticleT
}
@Override
public
Creature
Particle
createParticle
(
DefaultParticleType
type
,
ClientWorld
world
,
double
x
,
double
y
,
double
z
,
double
velocityX
,
double
velocityY
,
double
velocityZ
)
{
CreatureParticle
particle
=
new
Creature
Particle
(
world
,
x
,
y
,
z
,
velocityX
,
velocityY
,
velocityZ
);
public
Behavior
Particle
createParticle
(
DefaultParticleType
type
,
ClientWorld
world
,
double
x
,
double
y
,
double
z
,
double
velocityX
,
double
velocityY
,
double
velocityZ
)
{
BehaviorParticle
particle
=
new
Behavior
Particle
(
world
,
x
,
y
,
z
,
velocityX
,
velocityY
,
velocityZ
);
particle
.
setSprite
(
this
.
spriteProvider
);
return
particle
;
}
...
...
src/main/java/com/owlmaddie/chat/EntityChatData.java
View file @
046084f0
...
...
@@ -397,13 +397,24 @@ public class EntityChatData {
}
}
//
Show
particles
//
Emit friendship
particles
if
(
playerData
.
friendship
!=
new_friendship
)
{
int
friendDiff
=
new_friendship
-
playerData
.
friendship
;
if
(
friendDiff
>
0
)
{
ParticleEmitter
.
emitCreatureParticle
((
ServerWorld
)
entity
.
getWorld
(),
entity
,
HEART_SMALL_PARTICLE
);
// Heart particles
if
(
new_friendship
==
3
)
{
ParticleEmitter
.
emitCreatureParticle
((
ServerWorld
)
entity
.
getWorld
(),
entity
,
HEART_BIG_PARTICLE
,
0.5
,
10
);
}
else
{
ParticleEmitter
.
emitCreatureParticle
((
ServerWorld
)
entity
.
getWorld
(),
entity
,
HEART_SMALL_PARTICLE
,
0.1
,
1
);
}
}
else
if
(
friendDiff
<
0
)
{
ParticleEmitter
.
emitCreatureParticle
((
ServerWorld
)
entity
.
getWorld
(),
entity
,
FIRE_SMALL_PARTICLE
);
// Fire particles
if
(
new_friendship
==
-
3
)
{
ParticleEmitter
.
emitCreatureParticle
((
ServerWorld
)
entity
.
getWorld
(),
entity
,
FIRE_BIG_PARTICLE
,
0.5
,
10
);
}
else
{
ParticleEmitter
.
emitCreatureParticle
((
ServerWorld
)
entity
.
getWorld
(),
entity
,
FIRE_SMALL_PARTICLE
,
0.1
,
1
);
}
}
}
...
...
src/main/java/com/owlmaddie/particle/ParticleEmitter.java
View file @
046084f0
package
com
.
owlmaddie
.
particle
;
import
net.minecraft.entity.Entity
;
import
net.minecraft.particle.DefaultParticleType
;
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.particle.DefaultParticleType
;
import
static
com
.
owlmaddie
.
network
.
ServerPackets
.
FIRE_BIG_PARTICLE
;
import
static
com
.
owlmaddie
.
network
.
ServerPackets
.
HEART_BIG_PARTICLE
;
public
class
ParticleEmitter
{
public
static
void
emitCreatureParticle
(
ServerWorld
world
,
Entity
entity
,
DefaultParticleType
particleType
)
{
public
static
void
emitCreatureParticle
(
ServerWorld
world
,
Entity
entity
,
DefaultParticleType
particleType
,
double
spawnSize
,
int
count
)
{
// Calculate the offset for the particle to appear above and in front of the entity
float
yaw
=
entity
.
getHeadYaw
();
double
offsetX
=
-
MathHelper
.
sin
(
yaw
*
((
float
)
Math
.
PI
/
180
F
))
*
0.9
;
...
...
@@ -20,6 +25,13 @@ public class ParticleEmitter {
double
z
=
entity
.
getZ
()
+
offsetZ
;
// Emit the custom particle on the server
world
.
spawnParticles
(
particleType
,
x
,
y
,
z
,
1
,
0
,
0
,
0
,
0
);
world
.
spawnParticles
(
particleType
,
x
,
y
,
z
,
count
,
spawnSize
,
spawnSize
,
spawnSize
,
0.1
F
);
// Play sound when lots of hearts are emitted
if
(
particleType
.
equals
(
HEART_BIG_PARTICLE
)
&&
count
>
1
)
{
world
.
playSound
(
entity
,
entity
.
getBlockPos
(),
SoundEvents
.
ENTITY_EXPERIENCE_ORB_PICKUP
,
SoundCategory
.
PLAYERS
,
0.4
F
,
1.0
F
);
}
else
if
(
particleType
.
equals
(
FIRE_BIG_PARTICLE
)
&&
count
>
1
)
{
world
.
playSound
(
entity
,
entity
.
getBlockPos
(),
SoundEvents
.
ITEM_AXE_STRIP
,
SoundCategory
.
PLAYERS
,
0.8
F
,
1.0
F
);
}
}
}
\ No newline at end of file
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