Skip to content

Instantly share code, notes, and snippets.

@apple502j
Created November 11, 2023 17:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save apple502j/bf794b201f4e1e772dabb4170281f11a to your computer and use it in GitHub Desktop.
Save apple502j/bf794b201f4e1e772dabb4170281f11a to your computer and use it in GitHub Desktop.

23w45a: Another Codecification Update

Advancements got codecs, registries were updated, etc.

Fabric update

FAPI 0.90.8 released, no breaking change.

Minecraft update

Blocks and spawners

Some mob spawner logics have been moved to Spawner interface (to be implemented by spawner block entities). MobSpawnerLogic and related classes are now placed in block.spawner package. The existing Spawner interface used for spawning cats, "the worst mob", and the frequent homicide victims is now renamed to SpecialSpawner.

AbstractBlock#onExploded was added, allowing blocks to configure custom behavior for explosions. Breeze shoots "explosive" projectiles; the explosion does not damage blocks, instead Grianing them. If you have a custom block that you want to fire with this, use:

public void onExploded(BlockState state, World world, BlockPos pos, Explosion explosion, BiConsumer<ItemStack, BlockPos> stackMerger) {
  if (explosion.getDestructionType() == Explosion.DestructionType.TRIGGER_BLOCK && !world.isClient())
    doStuff(state, world, pos, explosion); 
  super.onExploded(state, world, pos, explosion, stackMerger);
}

BlockSetType got canOpenByWindCharge field for custom buttons/doors/trapdoors/whatever.

Datagen

RecipeProvider methods received some changes. Some JSON builders and generateCookingRecipse now require passing the constructor of recipe class, like CampfireCookingRecipe::new. Other builders, in comparison, no longer asks for the serializer.

Entities

  • Entity#isImmuneToExplosion now takes Explosion.
  • Three EntityPoses added: sliding, shooting, inhaling.
  • SpawnReason got two methods: isAnySpawner (spawner & trial spawner) and isTrialSpawner. canSpawn methods should check isAnySpawner, and make the entity exempt from biome/height requirements imposed for natural spawn.
  • VehicleEntity#shouldAlwaysKill now takes DamageSource. TntMinecartEntity got shouldDetonate, which is called in the override.
  • One of the overload for PlayerEntity#unlockRecipes now takes a list, not an array.
  • PersistentProjectileEntity#deflect to deflect the entity when it hits something.

Other

  • ItemStack got 4 more codecs: ADVANCEMENT_DISPLAY_CODEC (item and nbt (stringified)); RECIPE_RESULT_CODEC and INGREDIENT_ENTRY_CODEC (formerly in RecipeCodecs); and CUTTING_RECIPE_RESULT_CODEC.
  • World#createExplosion can now take particles, emitter particles, and sound event. ExplosionS2CPacket now contains those fields as well.
  • Advancements and net.minecraft.predicate predicates are now serialized using codecs.
  • Registries#ROOT_KEY is moved to RegistryKeys#ROOT.
  • Registry loading code got a refactor, apparently to allow "patches". I don't believe this impacts modders for now.
  • Slot#disablesDynamicDisplay to check if clock/compass dynamic display should be disabled in the slot. false by default, true in crafting slots.
  • CommandException was removed. Just use brigadier DynamicCommandExceptionType. Same goes for HerobrineEntity.
  • Text.Serialization#fromJson's overload taking StringReader can now return null. It now also calls an internal Gson staticmethod, but hey, the code already uses reflection.
  • PngMetadata#validate to validate that a file is in fact PNG.
  • Vec3d#isWithinRangeOf, which is like isInRange but with horizontal/vertical separate.
  • Codecs#createRecursive now take the name of the codec for debugging.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment