Added some documentation

This commit is contained in:
2025-06-30 10:10:06 +02:00
parent b3e6ec189a
commit 1087941efb
6 changed files with 30 additions and 1 deletions

View File

@@ -11,6 +11,9 @@ import wtf.hak.survivalfabric.config.client.ClientConfigManager;
@Mixin(BlockEntityRenderer.class)
public interface BlockEntityRendererMixin<T extends BlockEntity> {
/**
* Manipulate Block Entity Render Distance
*/
@Inject(method = "getRenderDistance", at = @At("HEAD"), cancellable = true)
private void getRenderDistance(CallbackInfoReturnable<Integer> cir) {
if (ClientConfigManager.getConfig().manipulateBlockEntityDistance)

View File

@@ -12,6 +12,9 @@ import wtf.hak.survivalfabric.features.AngleViewer;
@Mixin(Entity.class)
public abstract class EntityMixin {
/**
* Lock Teleport Head Movement
*/
@Inject(method = "setYaw", at = @At("HEAD"), cancellable = true)
private void preventYawChange(float yaw, CallbackInfo ci) {
if ((Object) this instanceof ClientPlayerEntity player) {
@@ -21,6 +24,9 @@ public abstract class EntityMixin {
}
}
/**
* Lock Teleport Head Movement
*/
@Inject(method = "setPitch", at = @At("HEAD"), cancellable = true)
private void preventPitchChange(float pitch, CallbackInfo ci) {
if ((Object) this instanceof ClientPlayerEntity player) {

View File

@@ -14,6 +14,9 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import static wtf.hak.survivalfabric.config.client.ClientConfigManager.getConfig;
/**
* Stop fog from rendering (if configured)
*/
public class FogMixins {
@Mixin(DimensionOrBossFogModifier.class)

View File

@@ -24,6 +24,9 @@ import java.util.List;
@Mixin(Block.class)
public abstract class BlockMixin {
/**
* Handle Telekinesis & Replenish
*/
@ModifyExpressionValue(
method = "dropStacks(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/entity/BlockEntity;Lnet/minecraft/entity/Entity;Lnet/minecraft/item/ItemStack;)V",
at = @At(
@@ -47,6 +50,9 @@ public abstract class BlockMixin {
return TelekinesisHandler.handleBlock(original, state, world, pos, entity);
}
/**
* Handle Telekinesis Exp
*/
@ModifyExpressionValue(
method = "dropExperienceWhenMined",
at = @At(

View File

@@ -17,6 +17,9 @@ import java.util.function.Consumer;
@Mixin(LivingEntity.class)
public abstract class LivingEntityMixin {
/**
* Register loot for Telekinesis
*/
@Inject(method = "drop", at = @At("HEAD"))
private void drop(ServerWorld world, DamageSource damageSource, CallbackInfo ci) {
if (damageSource.getAttacker() instanceof ServerPlayerEntity) {
@@ -24,6 +27,9 @@ public abstract class LivingEntityMixin {
}
}
/**
* Telekinesis for Entity Loot
*/
@ModifyArg(
method = "dropLoot",
at = @At(
@@ -36,6 +42,10 @@ public abstract class LivingEntityMixin {
return TelekinesisHandler.handleLoot(lootConsumer, (LivingEntity) (Object) this);
}
/**
* Telekinesis for Entity Exp
*/
@ModifyArg(method = "dropExperience",
at = @At(value = "INVOKE",
target = "Lnet/minecraft/entity/ExperienceOrbEntity;spawn(Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/util/math/Vec3d;I)V"),

View File

@@ -81,7 +81,8 @@ public abstract class PlayerManagerMixin {
sb.append(result.endsWith(".0") ? result.substring(0, result.length() - 2) : result);
processedMessage = sb.toString();
} catch (Exception ignored) {}
} catch (Exception ignored) {
}
}
if (isMsgEnabled) {