cleanup of scarpet dependencies

This commit is contained in:
gnembon committed 2023-02-08 21:13:14 +01:00
1 parent fd93785fec
commit 75d94b0570
71 files changed
+1623 -1014

No files matched your search

+3 -24
View File
@@ -13,6 +13,7 @@ import net.minecraft.commands.CommandSourceStack;
import net.minecraft.core.BlockPos;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.Entity;
@@ -38,10 +39,10 @@ public class MobAI
return currentTrackers.contains(type);
}
public static void clearTracking(EntityType<? extends Entity> etype)
public static void clearTracking(final MinecraftServer server, EntityType<? extends Entity> etype)
{
aiTrackers.remove(etype);
for(ServerLevel world : CarpetServer.minecraft_server.getAllLevels() )
for(ServerLevel world : server.getAllLevels() )
{
for (Entity e: world.getEntities(etype, Entity::hasCustomName))
{
@@ -86,26 +87,4 @@ public class MobAI
types = applicableTypes;
}
}
/**
* Not a replacement for living entity jump() - this barely is to allow other entities that can't jump in vanilla to 'jump'
* @param e
*/
public static void genericJump(Entity e)
{
if (!e.isOnGround() && !e.isInWaterOrBubble() && !e.isInLava()) return;
float m = e.level.getBlockState(e.blockPosition()).getBlock().getJumpFactor();
float g = e.level.getBlockState(new BlockPos(e.getX(), e.getBoundingBox().minY - 0.5000001D, e.getZ())).getBlock().getJumpFactor();
float jumpVelocityMultiplier = (double) m == 1.0D ? g : m;
float jumpStrength = (0.42F * jumpVelocityMultiplier);
Vec3 vec3d = e.getDeltaMovement();
e.setDeltaMovement(vec3d.x, jumpStrength, vec3d.z);
if (e.isSprinting())
{
float u = e.getYRot() * 0.017453292F; // yaw
e.setDeltaMovement(e.getDeltaMovement().add((-Mth.sin(g) * 0.2F), 0.0D, (Mth.cos(u) * 0.2F)));
}
e.hasImpulse = true;
}
}