loggers
This commit is contained in:
1 parent
7d9418016a
commit
8b0b5412c4
9 files changed
+161
-13
No files matched your search
@@ -4,6 +4,7 @@ import carpet.CarpetSettings;
|
||||
import carpet.fakes.ExperienceOrbInterface;
|
||||
import carpet.helpers.XPcombine;
|
||||
import net.minecraft.entity.ExperienceOrbEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
@@ -39,9 +40,16 @@ public abstract class ExperienceOrbEntityMixin implements ExperienceOrbInterface
|
||||
|
||||
if (getCombineDelay() == 0)
|
||||
{
|
||||
XPcombine.searchForOtherXPNearbyCarpet((ExperienceOrbEntity) (Object) this);
|
||||
XPcombine.searchForOtherXPNearby((ExperienceOrbEntity) (Object) this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "onPlayerCollision", at = @At("HEAD"))
|
||||
void removeDelay(PlayerEntity playerEntity_1, CallbackInfo ci)
|
||||
{
|
||||
if (CarpetSettings.getBool("xpNoCooldown"))
|
||||
playerEntity_1.experiencePickUpDelay = 0;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
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.FallingBlockEntity;
|
||||
import net.minecraft.entity.projectile.ProjectileEntity;
|
||||
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(FallingBlockEntity.class)
|
||||
public abstract class FallingBlockEntityMixin extends Entity
|
||||
{
|
||||
private TrajectoryLogHelper logHelper;
|
||||
public FallingBlockEntityMixin(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.__fallingBlocks && !world_1.isClient)
|
||||
logHelper = new TrajectoryLogHelper("fallingBlocks");
|
||||
}
|
||||
|
||||
@Inject(method = "tick", at = @At("HEAD"))
|
||||
private void tickCheck(CallbackInfo ci)
|
||||
{
|
||||
if (LoggerRegistry.__fallingBlocks && logHelper != null)
|
||||
logHelper.onTick(x, y, z, getVelocity());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove()
|
||||
{
|
||||
super.remove();
|
||||
if (LoggerRegistry.__fallingBlocks && logHelper != null)
|
||||
logHelper.onFinish();
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.CarpetSettings;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.PrimedTntEntity;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
@@ -27,11 +29,13 @@ public abstract class PrimedTntEntityMixin extends Entity
|
||||
private void initTNTLogger(World world_1, double double_1, double double_2, double double_3,
|
||||
LivingEntity livingEntity_1, CallbackInfo ci)
|
||||
{
|
||||
double double_4 = world_1.random.nextDouble() * 6.2831854820251465D;
|
||||
if(CarpetSettings.getBool("tntPrimerMomentumRemoved"))
|
||||
this.setVelocity(new Vec3d(0.0, 0.20000000298023224D, 0.0));
|
||||
if (LoggerRegistry.__tnt)
|
||||
{
|
||||
logHelper = new TNTLogHelper();
|
||||
logHelper.onPrimed(double_1, double_2, double_3, (float)double_4);
|
||||
|
||||
logHelper.onPrimed(double_1, double_2, double_3, getVelocity());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
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.ProjectileEntity;
|
||||
import net.minecraft.util.hit.HitResult;
|
||||
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(ProjectileEntity.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("RETURN"))
|
||||
private void tickCheck(CallbackInfo ci)
|
||||
{
|
||||
if (LoggerRegistry.__projectiles && logHelper != null)
|
||||
logHelper.onTick(x, y, z, getVelocity());
|
||||
}
|
||||
|
||||
@Inject(method = "onHit(Lnet/minecraft/util/hit/HitResult;)V", at = @At("RETURN"))
|
||||
private void remove(HitResult hitResult_1, CallbackInfo ci)
|
||||
{
|
||||
if (LoggerRegistry.__projectiles &&
|
||||
(hitResult_1.getType() == HitResult.Type.ENTITY || hitResult_1.getType() == HitResult.Type.BLOCK)
|
||||
&& logHelper != null)
|
||||
{
|
||||
logHelper.onFinish();
|
||||
logHelper = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
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.ProjectileEntity;
|
||||
import net.minecraft.entity.thrown.ThrownEntity;
|
||||
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(ThrownEntity.class)
|
||||
public abstract class ThrownEntityMixin extends Entity
|
||||
{
|
||||
private TrajectoryLogHelper logHelper;
|
||||
public ThrownEntityMixin(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(x, y, z, getVelocity());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove()
|
||||
{
|
||||
super.remove();
|
||||
if (LoggerRegistry.__projectiles && logHelper != null)
|
||||
logHelper.onFinish();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user