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

+2 -2
View File
@@ -4,8 +4,8 @@ org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://fabricmc.net/use
# or better: https://modmuss50.me/fabric.html
minecraft_version=20w09a
yarn_mappings=20w09a+build.8
minecraft_version=20w10a
yarn_mappings=20w10a+build.1
loader_version=0.7.8+build.186
# Mod Properties
@@ -80,7 +80,7 @@ public class DrawCommand
final int ceilRadiusY = (int) Math.ceil(radiusY);
final int ceilRadiusZ = (int) Math.ceil(radiusZ);
BlockPos.Mutable mbpos = new BlockPos.Mutable(pos);
BlockPos.Mutable mbpos = pos.method_25503();
List<BlockPos> list = Lists.newArrayList();
double nextXn = 0;
@@ -489,7 +489,7 @@ public class ScriptCommand
boolean[][][] volume = new boolean[area.getBlockCountX()][area.getBlockCountY()][area.getBlockCountZ()];
BlockPos.Mutable mbpos = new BlockPos.Mutable(origin);
BlockPos.Mutable mbpos = origin.method_25503();
ServerWorld world = source.getWorld();
for (int x = area.minX; x <= area.maxX; x++)
@@ -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,
@@ -2084,8 +2084,8 @@ public class CarpetExpression
}
else
{
Vec3d point = new Vec3d(inventoryLocator.position);
item = new ItemEntity(cc.s.getWorld(), point.x+0.5, point.y+0.5, point.z+0.5, droppedStack);
Vec3d point = Vec3d.method_24953(inventoryLocator.position); //pos+0.5v
item = new ItemEntity(cc.s.getWorld(), point.x, point.y, point.z, droppedStack);
item.setToDefaultPickupDelay();
cc.s.getWorld().spawnEntity(item);
}
@@ -2540,7 +2540,7 @@ public class CarpetExpression
return LazyValue.NULL;
} else {
if (!hasTag && entity_1 instanceof MobEntity) {
((MobEntity)entity_1).initialize(serverWorld, serverWorld.getLocalDifficulty(entity_1.getBlockPos()), SpawnType.COMMAND, null, null);
((MobEntity)entity_1).initialize(serverWorld, serverWorld.getLocalDifficulty(entity_1.getSenseCenterPos()), SpawnType.COMMAND, null, null);
}
Value res = new EntityValue(entity_1);
return (_c, _t) -> res;
@@ -83,7 +83,8 @@ public class BlockValue extends Value
Value v1 = params.get(0 + offset).evalValue(c);
if (v1 instanceof BlockValue)
{
return (new VectorLocator(new Vec3d(((BlockValue) v1).getPos()).add(0.5,0.5,0.5), 1+offset)).fromBlock();
// pos + 0.5v
return (new VectorLocator(Vec3d.method_24953(((BlockValue) v1).getPos()), 1+offset)).fromBlock();
}
if (v1 instanceof ListValue)
{
@@ -436,7 +437,7 @@ public class BlockValue extends Value
SpecificDirection dir = SpecificDirection.DIRECTION_MAP.get(direction);
if (dir == null)
throw new InternalExpressionException("unknown block placement direction: "+direction);
BlockHitResult hitres = new BlockHitResult(new Vec3d(pos).add(dir.hitOffset), dir.facing, pos, false);
BlockHitResult hitres = new BlockHitResult(Vec3d.method_24954(pos).add(dir.hitOffset), dir.facing, pos, false);
return new PlacementContext(world, dir.facing, sneakPlace, itemStack, hitres);
}
private PlacementContext(World world_1, Direction direction_1, boolean sneakPlace, ItemStack itemStack_1, BlockHitResult hitres) {
@@ -177,7 +177,7 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa
if (inv == null)
return null;
return new InventoryLocator(e, e.getBlockPos(), inv, offset + 1);
return new InventoryLocator(e, e.getSenseCenterPos(), inv, offset + 1);
}
else if (v1 instanceof BlockValue)
{
@@ -210,7 +210,7 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa
}
PlayerEntity e = (PlayerEntity)((EntityValue) v2).getEntity();
inv = e.getEnderChestInventory();
return new InventoryLocator(e, e.getBlockPos(), inv, offset + 2, true);
return new InventoryLocator(e, e.getSenseCenterPos(), inv, offset + 2, true);
}
BlockPos pos = new BlockPos(
NumericValue.asNumber(v1).getDouble(),
@@ -178,7 +178,7 @@ public class PerimeterDiagnostics
{
el.refreshPositionAndAngles((float)pos.getX() + 0.5F, (float)pos.getY(), (float)pos.getZ()+0.5F, 0.0F, 0.0F);
return el.canSpawn(worldServer) &&
SpawnRestriction.canSpawn(el.getType(),el.getEntityWorld(), SpawnType.NATURAL, el.getBlockPos(), el.getEntityWorld().random) &&
SpawnRestriction.canSpawn(el.getType(),el.getEntityWorld(), SpawnType.NATURAL, el.getSenseCenterPos(), el.getEntityWorld().random) &&
worldServer.doesNotCollide(el); // check collision rules once they stop fiddling with them after 1.14.1
}
return false;
@@ -259,7 +259,7 @@ public class SpawnReporter
if (!(entity instanceof MobEntity) || !((MobEntity)entity).isPersistent())
{
EntityType type = entity.getType();
BlockPos pos = entity.getBlockPos();
BlockPos pos = entity.getSenseCenterPos();
lst.add( Messenger.c(
"w - ",
Messenger.tp("wb",pos),
@@ -439,12 +439,12 @@ public class SpawnReporter
for (int i = 0; i < 20; ++i)
{
if (SpawnRestriction.canSpawn(mob.getType(),mob.getEntityWorld(), SpawnType.NATURAL, mob.getBlockPos(), mob.getEntityWorld().random))
if (SpawnRestriction.canSpawn(mob.getType(),mob.getEntityWorld(), SpawnType.NATURAL, mob.getSenseCenterPos(), mob.getEntityWorld().random))
{
will_spawn += 1;
}
}
mob.initialize(worldIn, worldIn.getLocalDifficulty(mob.getBlockPos()), SpawnType.NATURAL, null, null);
mob.initialize(worldIn, worldIn.getLocalDifficulty(mob.getSenseCenterPos()), SpawnType.NATURAL, null, null);
// the code invokes onInitialSpawn after getCanSpawHere
fits = fits1 && worldIn.doesNotCollide(mob);
if (fits)
+2 -2
View File
@@ -51,10 +51,10 @@ public class WoolTool
{
ServerCommandSource source = placer.getCommandSource();
if (!DistanceCalculator.hasStartingPoint(source) || placer.isSneaking()) {
DistanceCalculator.setStart(source, new Vec3d(pos));
DistanceCalculator.setStart(source, Vec3d.method_24954(pos) ); // zero padded pos
}
else {
DistanceCalculator.setEnd(source, new Vec3d(pos));
DistanceCalculator.setEnd(source, Vec3d.method_24954(pos));
}
}
break;