diff --git a/gradle.properties b/gradle.properties index 4e184925..62202819 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ org.gradle.jvmargs=-Xmx1G # check these on https://fabricmc.net/use # or better: https://modmuss50.me/fabric.html minecraft_version=21w06a - yarn_mappings=21w06a+build.1 + yarn_mappings=21w06a+build.21 loader_version=0.11.1 fabric_version=0.30.2+1.17 diff --git a/src/main/java/carpet/mixins/BiomeArray_getBiomeArrayMixin.java b/src/main/java/carpet/mixins/BiomeArray_getBiomeArrayMixin.java index f0acfa6b..3c757a7f 100644 --- a/src/main/java/carpet/mixins/BiomeArray_getBiomeArrayMixin.java +++ b/src/main/java/carpet/mixins/BiomeArray_getBiomeArrayMixin.java @@ -1,12 +1,12 @@ package carpet.mixins; import carpet.fakes.BiomeArrayInterface; -import net.minecraft.class_5742; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.source.BiomeArray; +import net.minecraft.world.biome.source.BiomeCoords; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -30,9 +30,9 @@ public class BiomeArray_getBiomeArrayMixin implements BiomeArrayInterface @Override public void setBiomeAtIndex(BlockPos pos, World world, Biome what) { - int int_4 = class_5742.method_33100(pos.getX()) & HORIZONTAL_BIT_MASK; - int int_5 = MathHelper.clamp(class_5742.method_33100(pos.getY())-field_28126, 0, field_28127); - int int_6 = class_5742.method_33100(pos.getZ()) & HORIZONTAL_BIT_MASK; + int int_4 = BiomeCoords.fromBlock(pos.getX()) & HORIZONTAL_BIT_MASK; + int int_5 = MathHelper.clamp(BiomeCoords.fromBlock(pos.getY())-field_28126, 0, field_28127); + int int_6 = BiomeCoords.fromBlock(pos.getZ()) & HORIZONTAL_BIT_MASK; data[(int_5 << (HORIZONTAL_SECTION_COUNT + HORIZONTAL_SECTION_COUNT)) | (int_6 << HORIZONTAL_SECTION_COUNT) | int_4] = what; } } diff --git a/src/main/java/carpet/mixins/ServerWorld_scarpetMixin.java b/src/main/java/carpet/mixins/ServerWorld_scarpetMixin.java index 8cad062d..7959d320 100644 --- a/src/main/java/carpet/mixins/ServerWorld_scarpetMixin.java +++ b/src/main/java/carpet/mixins/ServerWorld_scarpetMixin.java @@ -4,7 +4,7 @@ import carpet.CarpetSettings; import carpet.fakes.ServerWorldInterface; import carpet.script.CarpetEventServer; import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLike; +import net.minecraft.world.entity.EntityLike; import net.minecraft.entity.LightningEntity; import net.minecraft.server.world.ServerEntityManager; import net.minecraft.server.world.ServerWorld; @@ -43,7 +43,7 @@ public class ServerWorld_scarpetMixin implements ServerWorldInterface @Redirect(method = "addEntity", at = @At( value = "INVOKE", - target = "Lnet/minecraft/server/world/ServerEntityManager;addEntity(Lnet/minecraft/entity/EntityLike;)Z" + target = "Lnet/minecraft/server/world/ServerEntityManager;addEntity(Lnet/minecraft/world/entity/EntityLike;)Z" )) private boolean onEntityAddedToWorld(ServerEntityManager serverEntityManager, EntityLike entityLike) { diff --git a/src/main/java/carpet/script/utils/ShapesRenderer.java b/src/main/java/carpet/script/utils/ShapesRenderer.java index 03bc54aa..d3889ea1 100644 --- a/src/main/java/carpet/script/utils/ShapesRenderer.java +++ b/src/main/java/carpet/script/utils/ShapesRenderer.java @@ -10,7 +10,7 @@ import net.minecraft.client.render.Camera; import net.minecraft.client.render.Tessellator; import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.VertexFormat; -import net.minecraft.client.util.math.AffineTransformation; +import net.minecraft.util.math.AffineTransformation; import net.minecraft.client.world.ClientWorld; import net.minecraft.client.render.VertexFormats; import net.minecraft.nbt.CompoundTag; diff --git a/src/main/java/carpet/script/value/EntityValue.java b/src/main/java/carpet/script/value/EntityValue.java index 7ef07900..6460480a 100644 --- a/src/main/java/carpet/script/value/EntityValue.java +++ b/src/main/java/carpet/script/value/EntityValue.java @@ -19,7 +19,6 @@ import carpet.script.exception.InternalExpressionException; import com.google.common.collect.Sets; import com.mojang.brigadier.StringReader; import com.mojang.brigadier.exceptions.CommandSyntaxException; -import net.minecraft.class_5575; import net.minecraft.entity.SpawnGroup; import net.minecraft.entity.ai.brain.Brain; import net.minecraft.entity.ai.brain.Memory; @@ -58,6 +57,7 @@ import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.world.ServerWorld; import net.minecraft.text.LiteralText; import net.minecraft.util.Identifier; +import net.minecraft.util.TypeFilter; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.EntityHitResult; import net.minecraft.util.hit.HitResult; @@ -259,7 +259,7 @@ public class EntityValue extends Value public static class EntityClassDescriptor { - public class_5575 directType; // interface of EntityType + public TypeFilter directType; // interface of EntityType public Predicate filteringPredicate; public List> typeList; public Value listValue; @@ -271,7 +271,7 @@ public class EntityValue extends Value listValue = (types==null)?Value.NULL:ListValue.wrap(types.stream().map(et -> StringValue.of(nameFromRegistryId(Registry.ENTITY_TYPE.getId(et)))).collect(Collectors.toList())); } - EntityClassDescriptor( class_5575 type, Predicate predicate, List> types) + EntityClassDescriptor( TypeFilter type, Predicate predicate, List> types) { directType = type; filteringPredicate = predicate; @@ -284,7 +284,7 @@ public class EntityValue extends Value this(type, predicate, types.collect(Collectors.toList())); } - EntityClassDescriptor(class_5575 type, Predicate predicate, Stream> types) + EntityClassDescriptor(TypeFilter type, Predicate predicate, Stream> types) { this(type, predicate, types.collect(Collectors.toList())); } @@ -342,49 +342,49 @@ public class EntityValue extends Value ).collect(Collectors.toSet()); - put("*", new EntityClassDescriptor(class_5575.method_31795(Entity.class), e -> true, allTypes) ); - put("valid", new EntityClassDescriptor(class_5575.method_31795(Entity.class), EntityPredicates.VALID_ENTITY, allTypes)); - put("!valid", new EntityClassDescriptor(class_5575.method_31795(Entity.class), e -> !e.isAlive(), allTypes)); + put("*", new EntityClassDescriptor(TypeFilter.instanceOf(Entity.class), e -> true, allTypes) ); + put("valid", new EntityClassDescriptor(TypeFilter.instanceOf(Entity.class), EntityPredicates.VALID_ENTITY, allTypes)); + put("!valid", new EntityClassDescriptor(TypeFilter.instanceOf(Entity.class), e -> !e.isAlive(), allTypes)); - put("living", new EntityClassDescriptor(class_5575.method_31795(LivingEntity.class), EntityPredicates.VALID_ENTITY, allTypes.stream().filter(living::contains))); - put("!living", new EntityClassDescriptor(class_5575.method_31795(Entity.class), (e) -> (!(e instanceof LivingEntity) && e.isAlive()), allTypes.stream().filter(et -> !living.contains(et)))); + put("living", new EntityClassDescriptor(TypeFilter.instanceOf(LivingEntity.class), EntityPredicates.VALID_ENTITY, allTypes.stream().filter(living::contains))); + put("!living", new EntityClassDescriptor(TypeFilter.instanceOf(Entity.class), (e) -> (!(e instanceof LivingEntity) && e.isAlive()), allTypes.stream().filter(et -> !living.contains(et)))); - put("projectile", new EntityClassDescriptor(class_5575.method_31795(ProjectileEntity.class), EntityPredicates.VALID_ENTITY, allTypes.stream().filter(projectiles::contains))); - put("!projectile", new EntityClassDescriptor(class_5575.method_31795(Entity.class), (e) -> (!(e instanceof ProjectileEntity) && e.isAlive()), allTypes.stream().filter(et -> !projectiles.contains(et) && !living.contains(et)))); + put("projectile", new EntityClassDescriptor(TypeFilter.instanceOf(ProjectileEntity.class), EntityPredicates.VALID_ENTITY, allTypes.stream().filter(projectiles::contains))); + put("!projectile", new EntityClassDescriptor(TypeFilter.instanceOf(Entity.class), (e) -> (!(e instanceof ProjectileEntity) && e.isAlive()), allTypes.stream().filter(et -> !projectiles.contains(et) && !living.contains(et)))); - put("minecarts", new EntityClassDescriptor(class_5575.method_31795(AbstractMinecartEntity.class), EntityPredicates.VALID_ENTITY, allTypes.stream().filter(minecarts::contains))); - put("!minecarts", new EntityClassDescriptor(class_5575.method_31795(Entity.class), (e) -> (!(e instanceof AbstractMinecartEntity) && e.isAlive()), allTypes.stream().filter(et -> !minecarts.contains(et) && !living.contains(et)))); + put("minecarts", new EntityClassDescriptor(TypeFilter.instanceOf(AbstractMinecartEntity.class), EntityPredicates.VALID_ENTITY, allTypes.stream().filter(minecarts::contains))); + put("!minecarts", new EntityClassDescriptor(TypeFilter.instanceOf(Entity.class), (e) -> (!(e instanceof AbstractMinecartEntity) && e.isAlive()), allTypes.stream().filter(et -> !minecarts.contains(et) && !living.contains(et)))); // combat groups - put("arthropod", new EntityClassDescriptor(class_5575.method_31795(LivingEntity.class), e -> (((LivingEntity) e).getGroup() == EntityGroup.ARTHROPOD && e.isAlive()), allTypes.stream().filter(arthropods::contains))); - put("!arthropod", new EntityClassDescriptor(class_5575.method_31795(LivingEntity.class), e -> (((LivingEntity) e).getGroup() != EntityGroup.ARTHROPOD && e.isAlive()), allTypes.stream().filter(et -> !arthropods.contains(et) && living.contains(et)))); + put("arthropod", new EntityClassDescriptor(TypeFilter.instanceOf(LivingEntity.class), e -> (((LivingEntity) e).getGroup() == EntityGroup.ARTHROPOD && e.isAlive()), allTypes.stream().filter(arthropods::contains))); + put("!arthropod", new EntityClassDescriptor(TypeFilter.instanceOf(LivingEntity.class), e -> (((LivingEntity) e).getGroup() != EntityGroup.ARTHROPOD && e.isAlive()), allTypes.stream().filter(et -> !arthropods.contains(et) && living.contains(et)))); - put("undead", new EntityClassDescriptor(class_5575.method_31795(LivingEntity.class), e -> (((LivingEntity) e).getGroup() == EntityGroup.UNDEAD && e.isAlive()), allTypes.stream().filter(undeads::contains))); - put("!undead", new EntityClassDescriptor(class_5575.method_31795(LivingEntity.class), e -> (((LivingEntity) e).getGroup() != EntityGroup.UNDEAD && e.isAlive()), allTypes.stream().filter(et -> !undeads.contains(et) && living.contains(et)))); + put("undead", new EntityClassDescriptor(TypeFilter.instanceOf(LivingEntity.class), e -> (((LivingEntity) e).getGroup() == EntityGroup.UNDEAD && e.isAlive()), allTypes.stream().filter(undeads::contains))); + put("!undead", new EntityClassDescriptor(TypeFilter.instanceOf(LivingEntity.class), e -> (((LivingEntity) e).getGroup() != EntityGroup.UNDEAD && e.isAlive()), allTypes.stream().filter(et -> !undeads.contains(et) && living.contains(et)))); - put("aquatic", new EntityClassDescriptor(class_5575.method_31795(LivingEntity.class), e -> (((LivingEntity) e).getGroup() == EntityGroup.AQUATIC && e.isAlive()), allTypes.stream().filter(aquatique::contains))); - put("!aquatic", new EntityClassDescriptor(class_5575.method_31795(LivingEntity.class), e -> (((LivingEntity) e).getGroup() != EntityGroup.AQUATIC && e.isAlive()), allTypes.stream().filter(et -> !aquatique.contains(et) && living.contains(et)))); + put("aquatic", new EntityClassDescriptor(TypeFilter.instanceOf(LivingEntity.class), e -> (((LivingEntity) e).getGroup() == EntityGroup.AQUATIC && e.isAlive()), allTypes.stream().filter(aquatique::contains))); + put("!aquatic", new EntityClassDescriptor(TypeFilter.instanceOf(LivingEntity.class), e -> (((LivingEntity) e).getGroup() != EntityGroup.AQUATIC && e.isAlive()), allTypes.stream().filter(et -> !aquatique.contains(et) && living.contains(et)))); - put("illager", new EntityClassDescriptor(class_5575.method_31795(LivingEntity.class), e -> (((LivingEntity) e).getGroup() == EntityGroup.ILLAGER && e.isAlive()), allTypes.stream().filter(illagers::contains))); - put("!illager", new EntityClassDescriptor(class_5575.method_31795(LivingEntity.class), e -> (((LivingEntity) e).getGroup() != EntityGroup.ILLAGER && e.isAlive()), allTypes.stream().filter(et -> !illagers.contains(et) && living.contains(et)))); + put("illager", new EntityClassDescriptor(TypeFilter.instanceOf(LivingEntity.class), e -> (((LivingEntity) e).getGroup() == EntityGroup.ILLAGER && e.isAlive()), allTypes.stream().filter(illagers::contains))); + put("!illager", new EntityClassDescriptor(TypeFilter.instanceOf(LivingEntity.class), e -> (((LivingEntity) e).getGroup() != EntityGroup.ILLAGER && e.isAlive()), allTypes.stream().filter(et -> !illagers.contains(et) && living.contains(et)))); - put("regular", new EntityClassDescriptor(class_5575.method_31795(LivingEntity.class), e -> (((LivingEntity) e).getGroup() == EntityGroup.DEFAULT && e.isAlive()), allTypes.stream().filter(regular::contains))); - put("!regular", new EntityClassDescriptor(class_5575.method_31795(LivingEntity.class), e -> (((LivingEntity) e).getGroup() != EntityGroup.DEFAULT && e.isAlive()), allTypes.stream().filter(et -> !regular.contains(et) && living.contains(et)))); + put("regular", new EntityClassDescriptor(TypeFilter.instanceOf(LivingEntity.class), e -> (((LivingEntity) e).getGroup() == EntityGroup.DEFAULT && e.isAlive()), allTypes.stream().filter(regular::contains))); + put("!regular", new EntityClassDescriptor(TypeFilter.instanceOf(LivingEntity.class), e -> (((LivingEntity) e).getGroup() != EntityGroup.DEFAULT && e.isAlive()), allTypes.stream().filter(et -> !regular.contains(et) && living.contains(et)))); for (Identifier typeId : Registry.ENTITY_TYPE.getIds()) { EntityType type = Registry.ENTITY_TYPE.get(typeId); String mobType = ValueConversions.simplify(typeId); put( mobType, new EntityClassDescriptor(type, EntityPredicates.VALID_ENTITY, Stream.of(type))); - put("!"+mobType, new EntityClassDescriptor(class_5575.method_31795(Entity.class), (e) -> e.getType() != type && e.isAlive(), allTypes.stream().filter(et -> et != type))); + put("!"+mobType, new EntityClassDescriptor(TypeFilter.instanceOf(Entity.class), (e) -> e.getType() != type && e.isAlive(), allTypes.stream().filter(et -> et != type))); } for (SpawnGroup catId : SpawnGroup.values()) { String catStr = catId.getName(); - put( catStr, new EntityClassDescriptor(class_5575.method_31795(Entity.class), e -> ((e.getType().getSpawnGroup() == catId) && e.isAlive()), allTypes.stream().filter(et -> et.getSpawnGroup() == catId))); - put("!"+catStr, new EntityClassDescriptor(class_5575.method_31795(Entity.class), e -> ((e.getType().getSpawnGroup() != catId) && e.isAlive()), allTypes.stream().filter(et -> et.getSpawnGroup() != catId))); + put( catStr, new EntityClassDescriptor(TypeFilter.instanceOf(Entity.class), e -> ((e.getType().getSpawnGroup() == catId) && e.isAlive()), allTypes.stream().filter(et -> et.getSpawnGroup() == catId))); + put("!"+catStr, new EntityClassDescriptor(TypeFilter.instanceOf(Entity.class), e -> ((e.getType().getSpawnGroup() != catId) && e.isAlive()), allTypes.stream().filter(et -> et.getSpawnGroup() != catId))); } }}; }