boi, 20w10a

This commit is contained in:
gnembon committed 2020-03-04 17:43:26 -04:00
1 parent 6b36ac642b
commit f7a2b8202b
20 files changed
+76 -68

No files matched your search

@@ -36,7 +36,7 @@ public abstract class EntityNavigation_pathfindingMixin
Path path = findPathToAny(set_1, int_1, boolean_1, int_2);
long finish = System.nanoTime();
float duration = (1.0F*((finish - start)/1000))/1000;
set_1.forEach(b -> PathfindingVisualizer.slowPath(entity, new Vec3d(b), duration, path != null));
set_1.forEach(b -> PathfindingVisualizer.slowPath(entity, Vec3d.method_24955(b), duration, path != null)); // ground centered position
return path;
}
@@ -52,7 +52,7 @@ public abstract class EntityNavigation_pathfindingMixin
Path path = findPathToAny(set_1, int_1, boolean_1, int_2);
long finish = System.nanoTime();
float duration = (1.0F*((finish - start)/1000))/1000;
set_1.forEach(b -> PathfindingVisualizer.slowPath(entity, new Vec3d(b), duration, path != null));
set_1.forEach(b -> PathfindingVisualizer.slowPath(entity, Vec3d.method_24955(b), duration, path != null));
return path;
}
}
@@ -19,14 +19,4 @@ public class FireworkEntity_extremeMixin
{
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);
}
}
@@ -28,7 +28,7 @@ public abstract class GuardianEntityMixin extends HostileEntity
{
ElderGuardianEntity elderGuardian = new ElderGuardianEntity(EntityType.ELDER_GUARDIAN ,this.world);
elderGuardian.refreshPositionAndAngles(this.getX(), this.getY(), this.getZ(), this.yaw, this.pitch);
elderGuardian.initialize(this.world ,this.world.getLocalDifficulty(elderGuardian.getBlockPos()), SpawnType.CONVERSION, (EntityData)null, (CompoundTag)null);
elderGuardian.initialize(this.world ,this.world.getLocalDifficulty(elderGuardian.getSenseCenterPos()), SpawnType.CONVERSION, (EntityData)null, (CompoundTag)null);
elderGuardian.setAiDisabled(this.isAiDisabled());
if (this.hasCustomName())
@@ -11,12 +11,5 @@ 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);
}
// left intentinally blank for 1.15.2 class compat to be cleaned when promoting branch to master
}
@@ -5,6 +5,8 @@ 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.BlockHitResult;
import net.minecraft.util.hit.EntityHitResult;
import net.minecraft.util.hit.HitResult;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
@@ -32,12 +34,21 @@ public abstract class ProjectileEntityMixin extends Entity
logHelper.onTick(getX(), getY(), getZ(), getVelocity());
}
@Inject(method = "onHit(Lnet/minecraft/util/hit/HitResult;)V", at = @At("RETURN"))
private void remove(HitResult hitResult_1, CallbackInfo ci)
// 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 &&
(hitResult_1.getType() == HitResult.Type.ENTITY || hitResult_1.getType() == HitResult.Type.BLOCK)
&& logHelper != null)
if (LoggerRegistry.__projectiles && logHelper != null)
{
logHelper.onFinish();
logHelper = null;
}
}
@Inject(method = "method_24920", at = @At("RETURN")) // on block hit
private void removeOnBlock(BlockHitResult blockHitResult, CallbackInfo ci)
{
if (LoggerRegistry.__projectiles && logHelper != null)
{
logHelper.onFinish();
logHelper = null;
@@ -11,15 +11,6 @@ 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 = "applyEnchantmentEffects", expect = 1, at = @At(
value = "INVOKE",
@@ -0,0 +1,22 @@
package carpet.mixins;
import carpet.utils.RandomTools;
import net.minecraft.entity.projectile.Projectile;
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(Projectile.class)
public class Projectile_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);
}
}
@@ -48,7 +48,6 @@ public abstract class ServerChunkManagerMixin
boolean boolean_1,
boolean boolean_2,
int int_1,
BlockPos blockPos_1,
boolean boolean_3,
int int_2,
EntityCategory[] entityCategorys_1,
@@ -77,14 +76,14 @@ public abstract class ServerChunkManagerMixin
@SuppressWarnings("UnresolvedMixinReference")
@Redirect(method = "method_20801", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/SpawnHelper;spawnEntitiesInChunk(Lnet/minecraft/entity/EntityCategory;Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/world/chunk/WorldChunk;Lnet/minecraft/util/math/BlockPos;)V"
target = "Lnet/minecraft/world/SpawnHelper;spawnEntitiesInChunk(Lnet/minecraft/entity/EntityCategory;Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/world/chunk/WorldChunk;)V"
))
// inject our repeat of spawns if more spawn ticks per tick are chosen.
private void spawnMultipleTimes(EntityCategory entityCategory_1, ServerWorld world_1, WorldChunk worldChunk_1, BlockPos blockPos_1)
private void spawnMultipleTimes(EntityCategory entityCategory_1, ServerWorld world_1, WorldChunk worldChunk_1)
{
for (int i = 0; i < SpawnReporter.spawn_tries.get(entityCategory_1); i++)
{
SpawnHelper.spawnEntitiesInChunk(entityCategory_1, world_1, worldChunk_1, blockPos_1);
SpawnHelper.spawnEntitiesInChunk(entityCategory_1, world_1, worldChunk_1);
}
}
@@ -22,6 +22,7 @@ import net.minecraft.world.IWorld;
import net.minecraft.world.LocalDifficulty;
import net.minecraft.world.SpawnHelper;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.WorldChunk;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@@ -35,7 +36,7 @@ public class SpawnHelperMixin
// in World: private static Map<EntityType, Entity> precookedMobs= new HashMap<>();
@Redirect(method = "spawnEntitiesInChunk", at = @At(
@Redirect(method = "method_24934", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/server/world/ServerWorld;doesNotCollide(Lnet/minecraft/util/math/Box;)Z"
))
@@ -71,7 +72,7 @@ public class SpawnHelperMixin
return world.doesNotCollide(bb);
}
@Redirect(method = "spawnEntitiesInChunk", at = @At(
@Redirect(method = "method_24931", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/entity/EntityType;create(Lnet/minecraft/world/World;)Lnet/minecraft/entity/Entity;"
))
@@ -90,7 +91,7 @@ public class SpawnHelperMixin
return entityType.create(world_1);
}
@Redirect(method = "spawnEntitiesInChunk", at = @At(
@Redirect(method = "method_24930", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/server/world/ServerWorld;spawnEntity(Lnet/minecraft/entity/Entity;)Z"
))
@@ -106,14 +107,14 @@ public class SpawnHelperMixin
world.dimension.getType(),
(MobEntity) entity_1,
entity_1.getType().getCategory(),
entity_1.getBlockPos());
entity_1.getSenseCenterPos());
}
if (!SpawnReporter.mock_spawns)
return world.spawnEntity(entity_1);
return false;
}
@Redirect(method = "spawnEntitiesInChunk", at = @At(
@Redirect(method = "method_24930", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/entity/mob/MobEntity;initialize(Lnet/minecraft/world/IWorld;Lnet/minecraft/world/LocalDifficulty;Lnet/minecraft/entity/SpawnType;Lnet/minecraft/entity/EntityData;Lnet/minecraft/nbt/CompoundTag;)Lnet/minecraft/entity/EntityData;"
))
@@ -124,15 +125,15 @@ public class SpawnHelperMixin
return null;
}
@Redirect(method = "spawnEntitiesInChunk", at = @At(
@Redirect(method = "method_24930", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/entity/player/PlayerEntity;squaredDistanceTo(DDD)D"
))
private static double getSqDistanceTo(PlayerEntity playerEntity, double double_1, double double_2, double double_3,
EntityCategory entityCategory_1, ServerWorld world_1, WorldChunk worldChunk_1, BlockPos blockPos_1)
EntityCategory entityCategory, ServerWorld serverWorld, Chunk chunk, BlockPos blockPos)
{
double distanceTo = playerEntity.squaredDistanceTo(double_1, double_2, double_3);
if (CarpetSettings.lagFreeSpawning && distanceTo > 16384.0D && entityCategory_1 != EntityCategory.CREATURE)
if (CarpetSettings.lagFreeSpawning && distanceTo > 16384.0D && entityCategory != EntityCategory.CREATURE)
return 0.0;
return distanceTo;
}
@@ -24,6 +24,6 @@ public abstract class ThrownEnderpearlEntity_fakePlayersMixin extends ThrownItem
))
private boolean isConnectionGood(ClientConnection clientConnection)
{
return clientConnection.isOpen() || getOwner() instanceof EntityPlayerMPFake;
return clientConnection.isOpen() || method_24921() instanceof EntityPlayerMPFake; // getOwner()
}
}
@@ -128,7 +128,7 @@ public abstract class VillagerEntity_aiMixin extends AbstractTraderEntity
else
{
ParticleDisplay.drawParticleLine((ServerPlayerEntity) playerEntity_1, getPos(), new Vec3d(bedPos.getPos()).add(0.5, 0.5, 0.5), "dust 0 0 0 1", "happy_villager", 100, 0.2);
ParticleDisplay.drawParticleLine((ServerPlayerEntity) playerEntity_1, getPos(), Vec3d.method_24953(bedPos.getPos()), "dust 0 0 0 1", "happy_villager", 100, 0.2); // pos+0.5v
}
}
else if (itemStack_1.getItem() == Items.ROTTEN_FLESH)
@@ -140,11 +140,11 @@ public abstract class VillagerEntity_aiMixin extends AbstractTraderEntity
{
List<PointOfInterest> list_1 = ((ServerWorld) getEntityWorld()).getPointOfInterestStorage().getInCircle(
type -> type == PointOfInterestType.HOME,
getBlockPos(),
getSenseCenterPos(),
48, PointOfInterestStorage.OccupationStatus.ANY).collect(Collectors.toList());
for (PointOfInterest poi : list_1)
{
Vec3d pv = new Vec3d(poi.getPos()).add(0.5, 0.5, 0.5);
Vec3d pv = Vec3d.method_24953(poi.getPos());
if (!poi.hasSpace())
{
((ServerWorld) getEntityWorld()).spawnParticles(ParticleTypes.HAPPY_VILLAGER,