Content Registries: javadoc and small refactor (#3347)

This commit is contained in:
apple502j 2023-10-01 20:37:07 +09:00 committed by GitHub
parent 9650955252
commit 285022b3bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 27 additions and 9 deletions

View file

@ -185,9 +185,9 @@ public final class LandPathNodeTypesRegistry {
* <p>You can specify what to return if the block state is a direct target of an entity path,
* or a neighbor block of the entity path.
*
* <p>For example, for a cactus-like block you should use {@link PathNodeType#DAMAGE_CACTUS} if the block
* <p>For example, for a cactus-like block you should use {@link PathNodeType#DAMAGE_OTHER} if the block
* is a direct target in the entity path ({@code neighbor == false}) to specify that an entity should not pass
* through or above the block because it will cause damage, and you should use{@link PathNodeType#DANGER_CACTUS}
* through or above the block because it will cause damage, and you should use {@link PathNodeType#DANGER_OTHER}
* if the block is a neighbor block in the entity path ({@code neighbor == true}) to specify that the entity
* should not get close to the block because it is dangerous.
*
@ -211,9 +211,9 @@ public final class LandPathNodeTypesRegistry {
* <p>You can specify what to return if the block state is a direct target of an entity path,
* or a neighbor block of the entity path.
*
* <p>For example, for a cactus-like block you should specify {@link PathNodeType#DAMAGE_CACTUS} if the block
* <p>For example, for a cactus-like block you should specify {@link PathNodeType#DAMAGE_OTHER} if the block
* is a direct target ({@code neighbor == false}) to specify that an entity should not pass through or above
* the block because it will cause damage, and {@link PathNodeType#DANGER_CACTUS} if the cactus will be found
* the block because it will cause damage, and {@link PathNodeType#DANGER_OTHER} if the cactus will be found
* as a neighbor block in the entity path ({@code neighbor == true}) to specify that the entity should not get
* close to the block because is dangerous.
*

View file

@ -38,7 +38,6 @@ import net.fabricmc.fabric.mixin.content.registry.GiveGiftsToHeroTaskAccessor;
/**
* Registries for modifying villager interactions that
* villagers have with the world.
* @see VillagerPlantableRegistry for registering plants that farmers can plant
*/
public final class VillagerInteractionRegistries {
private static final Logger LOGGER = LoggerFactory.getLogger(VillagerInteractionRegistries.class);
@ -58,7 +57,7 @@ public final class VillagerInteractionRegistries {
}
/**
* Registers an item to be use in a composter by farmer villagers.
* Registers an item to be used in a composter by farmer villagers.
* @param item the item to register
*/
public static void registerCompostable(ItemConvertible item) {
@ -73,7 +72,6 @@ public final class VillagerInteractionRegistries {
*/
public static void registerFood(ItemConvertible item, int foodValue) {
Objects.requireNonNull(item.asItem(), "Item cannot be null!");
Objects.requireNonNull(foodValue, "Food value cannot be null!");
Integer oldValue = getFoodRegistry().put(item.asItem(), foodValue);
if (oldValue != null) {

View file

@ -0,0 +1,20 @@
/*
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Includes methods for registering in-game logics.
*/
package net.fabricmc.fabric.api.registry;

View file

@ -40,7 +40,7 @@ public class FlammableBlockRegistryImpl implements FlammableBlockRegistry {
private FlammableBlockRegistryImpl(Block key) {
this.key = key;
// Reset computed values after tags change since they depends on tags.
// Reset computed values after tags change since they depend on tags.
CommonLifecycleEvents.TAGS_LOADED.register((registries, client) -> {
computedEntries = null;
});

View file

@ -81,7 +81,7 @@ public final class ContentRegistryTest implements ModInitializer {
// - copper ore, iron ore, gold ore, and diamond ore can be waxed into their deepslate variants and scraped back again
// - aforementioned ores can be scraped from diamond -> gold -> iron -> copper
// - villagers can now collect, consume (at the same level of bread) and compost apples
// - villagers can now collect and plant oak saplings
// - villagers can now collect oak saplings
// - assign a loot table to the nitwit villager type
// - right-clicking a 'test_event' block will emit a 'test_event' game event, which will have a sculk sensor frequency of 2
// - instant health potions can be brewed from awkward potions with any item in the 'minecraft:small_flowers' tag