Skip to content

Commit

Permalink
chore: update to 24w46a
Browse files Browse the repository at this point in the history
- Creaking no longer has a transient entity type
- API types are updated
- FeatureFlag winterdrop is gone
  • Loading branch information
gabizou committed Nov 14, 2024
1 parent 34d90f9 commit 7f50cec
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import net.minecraft.core.FrontAndTop;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.CreakingHeartBlock;
import net.minecraft.world.level.block.entity.trialspawner.TrialSpawnerState;
import net.minecraft.world.level.block.entity.vault.VaultState;
import net.minecraft.world.level.block.state.BlockState;
Expand Down Expand Up @@ -63,15 +62,14 @@
import net.minecraft.world.level.block.state.properties.WallSide;
import org.tinylog.Logger;

import javax.lang.model.element.Modifier;
import java.io.IOException;
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.IdentityHashMap;
import java.util.Map;
import java.util.TreeMap;

import javax.lang.model.element.Modifier;

/**
* Generates catalog classes for {@link BlockState} properties.
*/
Expand Down Expand Up @@ -132,7 +130,6 @@ static PropertyType ofProperty(final Property<?> prop) {
vanillaEnumTypeMapping.put(StructureMode.class, BlockStatePropertiesGenerator.inDataTypePkg("StructureMode"));
vanillaEnumTypeMapping.put(PistonType.class, BlockStatePropertiesGenerator.inDataTypePkg("PistonType"));
vanillaEnumTypeMapping.put(BambooLeaves.class, BlockStatePropertiesGenerator.inDataTypePkg("BambooLeavesType"));
vanillaEnumTypeMapping.put(CreakingHeartBlock.CreakingHeartState.class, BlockStatePropertiesGenerator.inDataTypePkg("CreakingHeart"));
vanillaEnumTypeMapping.put(WallSide.class, BlockStatePropertiesGenerator.inDataTypePkg("WallConnectionState"));
vanillaEnumTypeMapping.put(RailShape.class, BlockStatePropertiesGenerator.inDataTypePkg("RailDirection"));
vanillaEnumTypeMapping.put(AttachFace.class, BlockStatePropertiesGenerator.inDataTypePkg("AttachmentSurface"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import com.squareup.javapoet.TypeVariableName;
import net.minecraft.core.Direction;
import net.minecraft.core.FrontAndTop;
import net.minecraft.world.level.block.CreakingHeartBlock;
import net.minecraft.world.level.block.entity.trialspawner.TrialSpawnerState;
import net.minecraft.world.level.block.entity.vault.VaultState;
import net.minecraft.world.level.block.state.BlockState;
Expand Down Expand Up @@ -64,15 +63,14 @@
import net.minecraft.world.level.block.state.properties.WallSide;
import org.tinylog.Logger;

import javax.lang.model.element.Modifier;
import java.io.IOException;
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
import java.util.function.Function;

import javax.lang.model.element.Modifier;

/**
* Generates catalog classes for {@link BlockState} properties.
*/
Expand Down Expand Up @@ -130,7 +128,6 @@ static BlockStatePropertyKeysGenerator.PropertyType ofProperty(final Property<?>
vanillaEnumTypeMapping.put(StructureMode.class, BlockStatePropertyKeysGenerator.inDataTypePkg("StructureMode"));
vanillaEnumTypeMapping.put(PistonType.class, BlockStatePropertyKeysGenerator.inDataTypePkg("PistonType"));
vanillaEnumTypeMapping.put(BambooLeaves.class, BlockStatePropertyKeysGenerator.inDataTypePkg("BambooLeavesType"));
vanillaEnumTypeMapping.put(CreakingHeartBlock.CreakingHeartState.class, BlockStatePropertyKeysGenerator.inDataTypePkg("CreakingHeart"));
vanillaEnumTypeMapping.put(WallSide.class, BlockStatePropertyKeysGenerator.inDataTypePkg("WallConnectionState"));
vanillaEnumTypeMapping.put(RailShape.class, BlockStatePropertyKeysGenerator.inDataTypePkg("RailDirection"));
vanillaEnumTypeMapping.put(AttachFace.class, BlockStatePropertyKeysGenerator.inDataTypePkg("AttachmentSurface"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,13 +247,6 @@ private static List<Generator> generators(final Context context) {
"getSerializedName",
"sponge"
),
new EnumEntriesValidator<>(
"data.type",
"CreakingHearts",
CreakingHeartBlock.CreakingHeartState.class,
"getSerializedName",
"sponge"
),
new RegistryEntriesGenerator<>(
"map.decoration",
"MapDecorationTypes",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,12 @@ private FieldSpec makeField(final String ownType, final TypeName fieldType, fina
if (!featureFlagSet.isSubsetOf(FeatureFlags.VANILLA_SET)) {
final var flags = FeatureFlags.REGISTRY.toNames(featureFlagSet).stream().map(rl -> rl.getNamespace().equals("minecraft") ? rl.getPath() : rl.getNamespace() + ":" + rl.getPath()).toArray();
// Use this when new feature flags are introduced
if (featureFlagSet.contains(FeatureFlags.WINTER_DROP)) {
var annotation = AnnotationSpec.builder(ClassName.get("org.spongepowered.api.util.annotation", "Experimental"))
.addMember("value", "$S", flags).build();
builder.addAnnotation(annotation).build();
builder.addAnnotation(ApiStatus.Experimental.class).build();
}
// if (featureFlagSet.contains(FeatureFlags.WINTER_DROP)) {
// var annotation = AnnotationSpec.builder(ClassName.get("org.spongepowered.api.util.annotation", "Experimental"))
// .addMember("value", "$S", flags).build();
// builder.addAnnotation(annotation).build();
// builder.addAnnotation(ApiStatus.Experimental.class).build();
// }
}


Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ mixinConfigs=mixins.sponge.accessors.json,mixins.sponge.api.json,mixins.sponge.c
mixins.sponge.tracker.json,mixins.sponge.ipforward.json,mixins.sponge.optimization.json
superClassChanges=common.superclasschange

minecraftVersion=24w45a
minecraftVersion=24w46a
recommendedVersion=0-SNAPSHOT

org.gradle.dependency.verification.console=verbose
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,13 @@
package org.spongepowered.common.accessor.world.entity.monster.creaking;

import net.minecraft.core.BlockPos;
import net.minecraft.world.entity.monster.creaking.CreakingTransient;
import net.minecraft.world.entity.monster.creaking.Creaking;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;

@Mixin(CreakingTransient.class)
public interface CreakingTransientAccessor {
@Mixin(Creaking.class)
public interface CreakingAccessor {

@Accessor("homePos") BlockPos accessor$homePos();

@Accessor("homePos") void accessor$setHomePos(BlockPos pos);

}
2 changes: 1 addition & 1 deletion src/accessors/resources/mixins.sponge.accessors.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
"world.entity.monster.VexAccessor",
"world.entity.monster.VindicatorAccessor",
"world.entity.monster.ZombifiedPiglinAccessor",
"world.entity.monster.creaking.CreakingTransientAccessor",
"world.entity.monster.creaking.CreakingAccessor",
"world.entity.npc.AbstractVillagerAccessor",
"world.entity.player.AbilitiesAccessor",
"world.entity.player.PlayerAccessor",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@
package org.spongepowered.common.data.provider.entity;

import net.minecraft.world.entity.monster.creaking.Creaking;
import net.minecraft.world.entity.monster.creaking.CreakingTransient;
import org.spongepowered.api.data.Keys;
import org.spongepowered.common.accessor.world.entity.monster.creaking.CreakingTransientAccessor;
import org.spongepowered.common.accessor.world.entity.monster.creaking.CreakingAccessor;
import org.spongepowered.common.data.provider.DataProviderRegistrator;
import org.spongepowered.common.util.VecHelper;

Expand All @@ -38,12 +37,12 @@ public static void register(final DataProviderRegistrator registrator) {
registrator
.asImmutable(Creaking.class)
.create(Keys.CREAKING_IS_LINKED)
.get(e -> e instanceof CreakingTransient);
.get(Creaking::isTransient);
registrator
.asMutable(CreakingTransient.class)
.asMutable(Creaking.class)
.create(Keys.CREAKING_HOME_POSITION)
.get(h -> VecHelper.toVector3i(((CreakingTransientAccessor) h).accessor$homePos()))
.set((h, v) -> ((CreakingTransientAccessor) h).accessor$setHomePos(VecHelper.toBlockPos(v)));
.get(h -> VecHelper.toVector3i(((CreakingAccessor) h).accessor$homePos()))
.set((h, v) -> h.setTransient(VecHelper.toBlockPos(v)));
;
}
// @formatter:on
Expand Down

0 comments on commit 7f50cec

Please sign in to comment.