mapping
This commit is contained in:
1 parent
af5aae24cb
commit
695d66da50
5 files changed
+34
-34
No files matched your search
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<Entity, ? extends Entity> directType; // interface of EntityType
|
||||
public TypeFilter<Entity, ? extends Entity> directType; // interface of EntityType
|
||||
public Predicate<? super Entity> filteringPredicate;
|
||||
public List<EntityType<? extends Entity>> 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<Entity, ?> type, Predicate<? super Entity> predicate, List<EntityType<?>> types)
|
||||
EntityClassDescriptor( TypeFilter<Entity, ?> type, Predicate<? super Entity> predicate, List<EntityType<?>> types)
|
||||
{
|
||||
directType = type;
|
||||
filteringPredicate = predicate;
|
||||
@@ -284,7 +284,7 @@ public class EntityValue extends Value
|
||||
this(type, predicate, types.collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
EntityClassDescriptor(class_5575<Entity, ?> type, Predicate<? super Entity> predicate, Stream<EntityType<?>> types)
|
||||
EntityClassDescriptor(TypeFilter<Entity, ?> type, Predicate<? super Entity> predicate, Stream<EntityType<?>> 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)));
|
||||
}
|
||||
}};
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user