Commit 2d0a321c by Jonathan Thomas

Code clean-up, import optimizing, and adding documentation to some classes which were missing it

parent 646c2131
Pipeline #13202 passed with stages
in 2 minutes 22 seconds
...@@ -4,7 +4,10 @@ import net.minecraft.client.particle.ParticleTextureSheet; ...@@ -4,7 +4,10 @@ import net.minecraft.client.particle.ParticleTextureSheet;
import net.minecraft.client.particle.SpriteBillboardParticle; import net.minecraft.client.particle.SpriteBillboardParticle;
import net.minecraft.client.world.ClientWorld; import net.minecraft.client.world.ClientWorld;
/**
* The {@code BehaviorParticle} class defines a custom CreatureChat behavior particle with an initial upward velocity
* that gradually decreases, ensuring it never moves downward.
*/
public class BehaviorParticle extends SpriteBillboardParticle { public class BehaviorParticle extends SpriteBillboardParticle {
protected BehaviorParticle(ClientWorld world, double x, double y, double z, double velocityX, double velocityY, double velocityZ) { protected BehaviorParticle(ClientWorld world, double x, double y, double z, double velocityX, double velocityY, double velocityZ) {
super(world, x, y, z, velocityX, velocityY, velocityZ); super(world, x, y, z, velocityX, velocityY, velocityZ);
......
...@@ -5,6 +5,10 @@ import net.minecraft.client.particle.SpriteProvider; ...@@ -5,6 +5,10 @@ import net.minecraft.client.particle.SpriteProvider;
import net.minecraft.client.world.ClientWorld; import net.minecraft.client.world.ClientWorld;
import net.minecraft.particle.DefaultParticleType; import net.minecraft.particle.DefaultParticleType;
/**
* The {@code CreatureParticleFactory} class is responsible for creating instances of
* {@link BehaviorParticle} with the specified parameters.
*/
public class CreatureParticleFactory implements ParticleFactory<DefaultParticleType> { public class CreatureParticleFactory implements ParticleFactory<DefaultParticleType> {
private final SpriteProvider spriteProvider; private final SpriteProvider spriteProvider;
......
...@@ -12,7 +12,6 @@ import java.io.*; ...@@ -12,7 +12,6 @@ import java.io.*;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.HashMap; import java.util.HashMap;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
/** /**
......
package com.owlmaddie.chat; package com.owlmaddie.chat;
/**
* The {@code PlayerData} class represents data associated with a player,
* specifically tracking their friendship level.
*/
public class PlayerData { public class PlayerData {
public int friendship; public int friendship;
......
package com.owlmaddie.json;
import java.util.List;
public class QuestJson {
Story story;
List<Character> characters;
public static class Story {
String background;
String clue;
}
public static class Character {
String name;
int age;
String personality;
String greeting;
String entity_type_key;
Quest quest;
String choice_question;
List<Choice> choices;
}
public static class Quest {
List<QuestItem> quest_items;
List<DropItem> drop_items;
}
public static class QuestItem {
String key;
int quantity;
}
public static class DropItem {
String key;
int quantity;
}
public static class Choice {
String choice;
String clue;
}
}
...@@ -20,6 +20,11 @@ import org.spongepowered.asm.mixin.injection.Inject; ...@@ -20,6 +20,11 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
/**
* The {@code MixinLivingEntity} class modifies the behavior of {@link LivingEntity} to integrate
* custom friendship, chat, and death message mechanics. It prevents friendly entities from targeting players,
* generates contextual chat messages on attacks, and broadcasts custom death messages for named entities.
*/
@Mixin(LivingEntity.class) @Mixin(LivingEntity.class)
public class MixinLivingEntity { public class MixinLivingEntity {
......
...@@ -6,6 +6,10 @@ import net.minecraft.village.VillagerGossips; ...@@ -6,6 +6,10 @@ import net.minecraft.village.VillagerGossips;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Shadow;
/**
* The {@code MixinVillagerEntity} class adds an accessor to expose the gossip system of {@link VillagerEntity}.
* This allows external classes to retrieve and interact with a villager's gossip data.
*/
@Mixin(VillagerEntity.class) @Mixin(VillagerEntity.class)
public abstract class MixinVillagerEntity implements VillagerEntityAccessor { public abstract class MixinVillagerEntity implements VillagerEntityAccessor {
......
...@@ -9,8 +9,12 @@ import net.minecraft.util.math.MathHelper; ...@@ -9,8 +9,12 @@ import net.minecraft.util.math.MathHelper;
import static com.owlmaddie.network.ServerPackets.*; import static com.owlmaddie.network.ServerPackets.*;
/**
* The {@code ParticleEmitter} class provides utility methods for emitting custom particles and sounds
* around entities in the game. It calculates particle positions based on entity orientation
* and triggers sound effects based on particle type and count.
*/
public class ParticleEmitter { public class ParticleEmitter {
public static void emitCreatureParticle(ServerWorld world, Entity entity, DefaultParticleType particleType, double spawnSize, int count) { 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 // Calculate the offset for the particle to appear above and in front of the entity
float yaw = entity.getHeadYaw(); float yaw = entity.getHeadYaw();
......
...@@ -2,6 +2,11 @@ package com.owlmaddie.utils; ...@@ -2,6 +2,11 @@ package com.owlmaddie.utils;
import net.minecraft.village.VillagerGossips; import net.minecraft.village.VillagerGossips;
/**
* The {@code VillagerEntityAccessor} interface provides a method to access
* the gossip system of a villager. It enables interaction with a villager's
* gossip data for custom behavior or modifications.
*/
public interface VillagerEntityAccessor { public interface VillagerEntityAccessor {
VillagerGossips getGossip(); VillagerGossips getGossip();
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment