Port to 24w05a ()

Co-authored-by: Drex <nicknamedrex@gmail.com>
This commit is contained in:
modmuss 2024-01-31 20:24:57 +00:00 committed by GitHub
parent ac6e104df9
commit 03be9f1df2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
207 changed files with 269 additions and 552 deletions
fabric-object-builder-api-v1/src
main
java/net/fabricmc/fabric/api/object/builder/v1/entity
resources
testmod/java/net/fabricmc/fabric/test/object/builder

View file

@ -23,12 +23,12 @@ import com.google.common.collect.ImmutableSet;
import org.jetbrains.annotations.Nullable;
import net.minecraft.block.Block;
import net.minecraft.class_9168;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityDimensions;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.SpawnGroup;
import net.minecraft.entity.SpawnLocation;
import net.minecraft.entity.SpawnRestriction;
import net.minecraft.entity.attribute.DefaultAttributeContainer;
import net.minecraft.entity.mob.MobEntity;
@ -423,7 +423,7 @@ public class FabricEntityTypeBuilder<T extends Entity> {
* @param <T> Entity class.
*/
public static class Mob<T extends MobEntity> extends FabricEntityTypeBuilder.Living<T> {
private class_9168 spawnLocation;
private SpawnLocation spawnLocation;
private Heightmap.Type restrictionHeightmap;
private SpawnRestriction.SpawnPredicate<T> spawnPredicate;
@ -536,7 +536,7 @@ public class FabricEntityTypeBuilder<T extends Entity> {
*
* @return this builder for chaining.
*/
public FabricEntityTypeBuilder.Mob<T> spawnRestriction(class_9168 spawnLocation, Heightmap.Type heightmap, SpawnRestriction.SpawnPredicate<T> spawnPredicate) {
public FabricEntityTypeBuilder.Mob<T> spawnRestriction(SpawnLocation spawnLocation, Heightmap.Type heightmap, SpawnRestriction.SpawnPredicate<T> spawnPredicate) {
this.spawnLocation = Objects.requireNonNull(spawnLocation, "Spawn location cannot be null.");
this.restrictionHeightmap = Objects.requireNonNull(heightmap, "Heightmap type cannot be null.");
this.spawnPredicate = Objects.requireNonNull(spawnPredicate, "Spawn predicate cannot be null.");

View file

@ -8,7 +8,7 @@ accessible class net/minecraft/village/TradeOffers$TypeAwareBuyForOneEmeraldFact
mutable field net/minecraft/village/TradeOffers REBALANCED_PROFESSION_TO_LEVELED_TRADE Ljava/util/Map;
mutable field net/minecraft/village/TradeOffers REBALANCED_WANDERING_TRADER_TRADES Ljava/util/List;
accessible method net/minecraft/entity/SpawnRestriction register (Lnet/minecraft/entity/EntityType;Lnet/minecraft/class_9168;Lnet/minecraft/world/Heightmap$Type;Lnet/minecraft/entity/SpawnRestriction$SpawnPredicate;)V
accessible method net/minecraft/entity/SpawnRestriction register (Lnet/minecraft/entity/EntityType;Lnet/minecraft/entity/SpawnLocation;Lnet/minecraft/world/Heightmap$Type;Lnet/minecraft/entity/SpawnRestriction$SpawnPredicate;)V
accessible field net/minecraft/village/VillagerType BIOME_TO_TYPE Ljava/util/Map;
accessible method net/minecraft/village/VillagerType <init> (Ljava/lang/String;)V

View file

@ -19,6 +19,7 @@ package net.fabricmc.fabric.test.object.builder;
import java.util.Objects;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.registry.RegistryWrapper;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.world.PersistentState;
@ -68,12 +69,12 @@ public class PersistentStateManagerTest implements ModInitializer {
}
@Override
public NbtCompound writeNbt(NbtCompound nbt) {
public NbtCompound writeNbt(NbtCompound nbt, RegistryWrapper.WrapperLookup wrapperLookup) {
nbt.putString("value", value);
return nbt;
}
private static TestState fromTag(NbtCompound tag) {
private static TestState fromTag(NbtCompound tag, RegistryWrapper.WrapperLookup wrapperLookup) {
return new TestState(tag.getString("value"));
}
}

View file

@ -31,6 +31,6 @@ class SimpleTradeFactory implements TradeOffers.Factory {
@Override
public TradeOffer create(Entity entity, Random random) {
// ALWAYS supply a copy of the offer.
return new TradeOffer(this.offer.toNbt());
return this.offer.copy();
}
}