* Add javadocs to many methods * Added built-in ways to generate BundledModules and documented them * Add Eclipse launch files to .gitignore and fix 11 warnings * Remove many unused imports * Remove some dead and unused code around app loading * Allow extensions to have client-side rules in their SettingsManager Also change tabs to spaces when those changed * Remove unnecessary classloader param in BundledModule * Change max tickwarp duration to Integer.MAX_VALUE * Move RulePrinter into the source so it can be managed by the IDE * Properly reset hopperCounters when changing worlds Also change tabs to spaces again and minor tweaks to javadocs * Run mergedocs even if Full.md was modified * Update src/main/java/carpet/commands/TickCommand.java Co-authored-by: gnembon <41132274+gnembon@users.noreply.github.com>
58 lines
2.1 KiB
Java
58 lines
2.1 KiB
Java
package carpet.mixins;
|
|
|
|
import carpet.logging.LoggerRegistry;
|
|
import carpet.logging.logHelpers.TrajectoryLogHelper;
|
|
import net.minecraft.entity.Entity;
|
|
import net.minecraft.entity.EntityType;
|
|
import net.minecraft.entity.projectile.PersistentProjectileEntity;
|
|
import net.minecraft.entity.projectile.ProjectileEntity;
|
|
import net.minecraft.util.hit.BlockHitResult;
|
|
import net.minecraft.util.hit.EntityHitResult;
|
|
import net.minecraft.world.World;
|
|
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;
|
|
|
|
@Mixin(PersistentProjectileEntity.class)
|
|
public abstract class ProjectileEntityMixin extends Entity
|
|
{
|
|
private TrajectoryLogHelper logHelper;
|
|
public ProjectileEntityMixin(EntityType<?> entityType_1, World world_1) { super(entityType_1, world_1); }
|
|
|
|
@Inject(method = "<init>(Lnet/minecraft/entity/EntityType;Lnet/minecraft/world/World;)V", at = @At("RETURN"))
|
|
private void addLogger(EntityType<? extends ProjectileEntity> entityType_1, World world_1, CallbackInfo ci)
|
|
{
|
|
if (LoggerRegistry.__projectiles && !world_1.isClient)
|
|
logHelper = new TrajectoryLogHelper("projectiles");
|
|
}
|
|
|
|
@Inject(method = "tick", at = @At("HEAD"))
|
|
private void tickCheck(CallbackInfo ci)
|
|
{
|
|
if (LoggerRegistry.__projectiles && logHelper != null)
|
|
logHelper.onTick(getX(), getY(), getZ(), getVelocity());
|
|
}
|
|
|
|
// todo should be moved on one place this is acceessed from
|
|
@Inject(method = "onEntityHit", at = @At("RETURN"))
|
|
private void removeOnEntity(EntityHitResult entityHitResult, CallbackInfo ci)
|
|
{
|
|
if (LoggerRegistry.__projectiles && logHelper != null)
|
|
{
|
|
logHelper.onFinish();
|
|
logHelper = null;
|
|
}
|
|
}
|
|
|
|
@Inject(method = "onBlockHit", at = @At("RETURN"))
|
|
private void removeOnBlock(BlockHitResult blockHitResult, CallbackInfo ci)
|
|
{
|
|
if (LoggerRegistry.__projectiles && logHelper != null)
|
|
{
|
|
logHelper.onFinish();
|
|
logHelper = null;
|
|
}
|
|
}
|
|
}
|