extremeBenchmark
This commit is contained in:
1 parent
657acc3c6e
commit
05ac5dee2c
15 files changed
+307
-25
No files matched your search
@@ -511,7 +511,13 @@ public class CarpetSettings
|
|||||||
|
|
||||||
@Rule(
|
@Rule(
|
||||||
desc = "Edge cases are as frequent as common cases, for testing only!!",
|
desc = "Edge cases are as frequent as common cases, for testing only!!",
|
||||||
extra = "Dispensers and Droppers will use extreme random velocity values",
|
extra = {"Velocities of items from dispensers, blaze projectiles, fireworks ",
|
||||||
|
"Directions of fireballs, wither skulls, fishing bobbers, ",
|
||||||
|
"items dropped from blocks and inventories, llamas spit, triggered trap horses",
|
||||||
|
"Damage dealt with projectiles",
|
||||||
|
"Blaze aggro sensitivity",
|
||||||
|
"Mobs spawned follow range"
|
||||||
|
},
|
||||||
category = CREATIVE
|
category = CREATIVE
|
||||||
)
|
)
|
||||||
public static boolean extremeBehaviours = false;
|
public static boolean extremeBehaviours = false;
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package carpet.mixins;
|
||||||
|
|
||||||
|
import carpet.utils.RandomTools;
|
||||||
|
import net.minecraft.entity.mob.BlazeEntity;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
@Mixin(targets = "net.minecraft.entity.mob.BlazeEntity$ShootFireballGoal")
|
||||||
|
public class BlazeEntityShootFireballGoal_extremeMixin
|
||||||
|
{
|
||||||
|
@Redirect(method = "tick", expect = 2, at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Ljava/util/Random;nextGaussian()D"
|
||||||
|
))
|
||||||
|
private double nextGauBian(Random random)
|
||||||
|
{
|
||||||
|
return RandomTools.nextGauBian(random);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package carpet.mixins;
|
||||||
|
|
||||||
|
import carpet.utils.RandomTools;
|
||||||
|
import net.minecraft.entity.mob.BlazeEntity;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
@Mixin(BlazeEntity.class)
|
||||||
|
public class BlazeEntity_extremeMixin
|
||||||
|
{
|
||||||
|
// unused actually
|
||||||
|
@Redirect(method = "mobTick", expect = 1, at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Ljava/util/Random;nextGaussian()D"
|
||||||
|
))
|
||||||
|
private double nextGauBian(Random random)
|
||||||
|
{
|
||||||
|
return RandomTools.nextGauBian(random);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package carpet.mixins;
|
||||||
|
|
||||||
|
import carpet.utils.RandomTools;
|
||||||
|
import net.minecraft.entity.projectile.ExplosiveProjectileEntity;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
@Mixin(ExplosiveProjectileEntity.class)
|
||||||
|
public class ExplosiveProjectileEntity_extremeMixin
|
||||||
|
{
|
||||||
|
@Redirect(method = "<init>(Lnet/minecraft/entity/EntityType;Lnet/minecraft/entity/LivingEntity;DDDLnet/minecraft/world/World;)V",
|
||||||
|
expect = 3, at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Ljava/util/Random;nextGaussian()D"
|
||||||
|
))
|
||||||
|
private double nextGauBian(Random random)
|
||||||
|
{
|
||||||
|
return RandomTools.nextGauBian(random);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package carpet.mixins;
|
||||||
|
|
||||||
|
import carpet.utils.RandomTools;
|
||||||
|
import net.minecraft.entity.FireworkEntity;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
@Mixin(FireworkEntity.class)
|
||||||
|
public class FireworkEntity_extremeMixin
|
||||||
|
{
|
||||||
|
@Redirect(method = "<init>(Lnet/minecraft/world/World;DDDLnet/minecraft/item/ItemStack;)V", expect = 2, at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Ljava/util/Random;nextGaussian()D"
|
||||||
|
))
|
||||||
|
private double nextGauBian(Random random)
|
||||||
|
{
|
||||||
|
return RandomTools.nextGauBian(random);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Redirect(method = "setVelocity", expect = 3, at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Ljava/util/Random;nextGaussian()D"
|
||||||
|
))
|
||||||
|
private double nextGauBian2(Random random)
|
||||||
|
{
|
||||||
|
return RandomTools.nextGauBian(random);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package carpet.mixins;
|
||||||
|
|
||||||
|
import carpet.utils.RandomTools;
|
||||||
|
import net.minecraft.entity.projectile.FishingBobberEntity;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
@Mixin(FishingBobberEntity.class)
|
||||||
|
public class FishingBobberEntity_extremeMixin
|
||||||
|
{
|
||||||
|
@Redirect(method = "<init>(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/world/World;II)V", expect =3, at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Ljava/util/Random;nextGaussian()D"
|
||||||
|
))
|
||||||
|
private double nextGauBian(Random random)
|
||||||
|
{
|
||||||
|
return RandomTools.nextGauBian(random);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,40 +1,23 @@
|
|||||||
package carpet.mixins;
|
package carpet.mixins;
|
||||||
|
|
||||||
import carpet.CarpetServer;
|
import carpet.utils.RandomTools;
|
||||||
import carpet.CarpetSettings;
|
|
||||||
import net.minecraft.block.dispenser.ItemDispenserBehavior;
|
import net.minecraft.block.dispenser.ItemDispenserBehavior;
|
||||||
import net.minecraft.entity.ItemEntity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.math.Direction;
|
|
||||||
import net.minecraft.util.math.Position;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
@Mixin(ItemDispenserBehavior.class)
|
@Mixin(ItemDispenserBehavior.class)
|
||||||
public class ItemDispenserBehaviour_extremeBehavioursMixin
|
public class ItemDispenserBehaviour_extremeBehavioursMixin
|
||||||
{
|
{
|
||||||
@Redirect(method = "spawnItem", at = @At(
|
@Redirect(method = "spawnItem", expect = 3, at = @At(
|
||||||
value = "INVOKE",
|
value = "INVOKE",
|
||||||
target = "Lnet/minecraft/entity/ItemEntity;setVelocity(DDD)V"
|
target = "Ljava/util/Random;nextGaussian()D"
|
||||||
))
|
))
|
||||||
private static void setExtremeVelocity(ItemEntity itemEntity, double x, double y, double z,
|
private static double nextGauBian(Random random)
|
||||||
World world, ItemStack stack, int offset, Direction side, Position pos)
|
|
||||||
{
|
{
|
||||||
if (CarpetSettings.extremeBehaviours)
|
return RandomTools.nextGauBian(random);
|
||||||
{
|
|
||||||
double g = CarpetServer.rand.nextDouble() * 0.1D + 0.2D;
|
|
||||||
itemEntity.setVelocity(
|
|
||||||
(16*world.random.nextDouble()-8) * 0.007499999832361937D * (double) offset + (double) side.getOffsetX() * g,
|
|
||||||
(16*world.random.nextDouble()-8) * 0.007499999832361937D * (double) offset + 0.20000000298023224D,
|
|
||||||
(16*world.random.nextDouble()-8) * 0.007499999832361937D * (double) offset + (double) side.getOffsetZ() * g
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
itemEntity.setVelocity(x, y, z);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package carpet.mixins;
|
||||||
|
|
||||||
|
import carpet.utils.RandomTools;
|
||||||
|
import net.minecraft.util.ItemScatterer;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
@Mixin(ItemScatterer.class)
|
||||||
|
public class ItemScatterer_extremeMixin
|
||||||
|
{
|
||||||
|
@Redirect(method = "spawn(Lnet/minecraft/world/World;DDDLnet/minecraft/item/ItemStack;)V", expect = 3, at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Ljava/util/Random;nextGaussian()D"
|
||||||
|
))
|
||||||
|
private static double nextGauBian(Random random)
|
||||||
|
{
|
||||||
|
return RandomTools.nextGauBian(random);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package carpet.mixins;
|
||||||
|
|
||||||
|
import carpet.utils.RandomTools;
|
||||||
|
import net.minecraft.entity.projectile.LlamaSpitEntity;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
@Mixin(LlamaSpitEntity.class)
|
||||||
|
public class LlamaSpitEntity_extremeMixin
|
||||||
|
{
|
||||||
|
@Redirect(method = "setVelocity", expect = 3, at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Ljava/util/Random;nextGaussian()D"
|
||||||
|
))
|
||||||
|
private double nextGauBian(Random random)
|
||||||
|
{
|
||||||
|
return RandomTools.nextGauBian(random);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package carpet.mixins;
|
||||||
|
|
||||||
|
import carpet.utils.RandomTools;
|
||||||
|
import net.minecraft.entity.mob.MobEntity;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
@Mixin(MobEntity.class)
|
||||||
|
public class MobEntity_extremeMixin
|
||||||
|
{
|
||||||
|
@Redirect(method = "initialize", expect = 1, at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Ljava/util/Random;nextGaussian()D"
|
||||||
|
))
|
||||||
|
private double nextGauBian(Random random)
|
||||||
|
{
|
||||||
|
return RandomTools.nextGauBian(random);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package carpet.mixins;
|
||||||
|
|
||||||
|
import carpet.utils.RandomTools;
|
||||||
|
import net.minecraft.entity.projectile.ProjectileEntity;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
@Mixin(ProjectileEntity.class)
|
||||||
|
public class ProjectileEntity_extremeMixin
|
||||||
|
{
|
||||||
|
@Redirect(method = "setVelocity", expect = 3, at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Ljava/util/Random;nextGaussian()D"
|
||||||
|
))
|
||||||
|
private double nextGauBian(Random random)
|
||||||
|
{
|
||||||
|
return RandomTools.nextGauBian(random);
|
||||||
|
}
|
||||||
|
|
||||||
|
// calculates damage
|
||||||
|
@Redirect(method = "method_7435", expect = 1, at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Ljava/util/Random;nextGaussian()D"
|
||||||
|
))
|
||||||
|
private double nextGauBian2(Random random)
|
||||||
|
{
|
||||||
|
return RandomTools.nextGauBian(random);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package carpet.mixins;
|
||||||
|
|
||||||
|
import carpet.utils.RandomTools;
|
||||||
|
import net.minecraft.entity.ai.goal.SkeletonHorseTrapTriggerGoal;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
@Mixin(SkeletonHorseTrapTriggerGoal.class)
|
||||||
|
public class SkeletonHorseTrapTriggerGoal_extremeMixin
|
||||||
|
{
|
||||||
|
@Redirect(method = "tick", expect = 2, at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Ljava/util/Random;nextGaussian()D"
|
||||||
|
))
|
||||||
|
private double nextGauBian(Random random)
|
||||||
|
{
|
||||||
|
return RandomTools.nextGauBian(random);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package carpet.mixins;
|
||||||
|
|
||||||
|
import carpet.utils.RandomTools;
|
||||||
|
import net.minecraft.entity.thrown.ThrownEntity;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
@Mixin(ThrownEntity.class)
|
||||||
|
public class ThrownEntity_extremeMixin
|
||||||
|
{
|
||||||
|
@Redirect(method = "setVelocity", expect = 3, at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Ljava/util/Random;nextGaussian()D"
|
||||||
|
))
|
||||||
|
private double nextGauBian(Random random)
|
||||||
|
{
|
||||||
|
return RandomTools.nextGauBian(random);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package carpet.utils;
|
||||||
|
|
||||||
|
import carpet.CarpetSettings;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
public class RandomTools
|
||||||
|
{
|
||||||
|
public static double nextGauBian(Random random)
|
||||||
|
{
|
||||||
|
if (CarpetSettings.extremeBehaviours)
|
||||||
|
{
|
||||||
|
random.nextDouble();
|
||||||
|
return 16.0D * random.nextDouble() - 8.0D;
|
||||||
|
}
|
||||||
|
return random.nextGaussian();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -124,6 +124,16 @@
|
|||||||
"ShearsItem_missingToolsMixin",
|
"ShearsItem_missingToolsMixin",
|
||||||
|
|
||||||
"ItemDispenserBehaviour_extremeBehavioursMixin",
|
"ItemDispenserBehaviour_extremeBehavioursMixin",
|
||||||
|
"ItemScatterer_extremeMixin",
|
||||||
|
"FishingBobberEntity_extremeMixin",
|
||||||
|
"SkeletonHorseTrapTriggerGoal_extremeMixin",
|
||||||
|
"FireworkEntity_extremeMixin",
|
||||||
|
"BlazeEntity_extremeMixin",
|
||||||
|
"BlazeEntityShootFireballGoal_extremeMixin",
|
||||||
|
"MobEntity_extremeMixin",
|
||||||
|
"ExplosiveProjectileEntity_extremeMixin",
|
||||||
|
"LlamaSpitEntity_extremeMixin",
|
||||||
|
"ProjectileEntity_extremeMixin",
|
||||||
|
|
||||||
"ArmorStandEntity_scarpetMarkerMixin",
|
"ArmorStandEntity_scarpetMarkerMixin",
|
||||||
"Entity_scarpetEventsMixin",
|
"Entity_scarpetEventsMixin",
|
||||||
|
|||||||
Reference in new issue
Block a user