extremeBenchmark
This commit is contained in:
1 parent
657acc3c6e
commit
05ac5dee2c
15 files changed
+307
-25
No files matched your search
@@ -1,40 +1,23 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.CarpetServer;
|
||||
import carpet.CarpetSettings;
|
||||
import carpet.utils.RandomTools;
|
||||
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.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
@Mixin(ItemDispenserBehavior.class)
|
||||
public class ItemDispenserBehaviour_extremeBehavioursMixin
|
||||
{
|
||||
@Redirect(method = "spawnItem", at = @At(
|
||||
@Redirect(method = "spawnItem", expect = 3, at = @At(
|
||||
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,
|
||||
World world, ItemStack stack, int offset, Direction side, Position pos)
|
||||
private static double nextGauBian(Random random)
|
||||
{
|
||||
if (CarpetSettings.extremeBehaviours)
|
||||
{
|
||||
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);
|
||||
}
|
||||
return RandomTools.nextGauBian(random);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user