From 36a5aea8aa4170bbc656e748337011b89e361e28 Mon Sep 17 00:00:00 2001 From: shedaniel Date: Sat, 12 Mar 2022 00:01:49 +0800 Subject: [PATCH] Big clean up, more details in the PR (#216) * Big clean up, more details in the PR * Fix build * Deprecate BlockProperties, generate AWs for Item constructors, Block constructors and RenderStateShard fields * Add a few more RenderType AWs * Deprecate BlockPropertiesExtension * Set defaultType on resolving the entity type in SpawnEggItem * Used the wrong object * Add license information for generating AWs * Add link to original PR * Properly add support for forge vanilla registries * Bump to 4.1 --- common/build.gradle | 126 ++++++- .../core/item/ArchitecturySpawnEggItem.java | 87 +++++ .../dev/architectury/event/EventFactory.java | 11 +- .../dev/architectury/platform/Platform.java | 1 - .../registry/block/BlockProperties.java | 3 + .../block/BlockPropertiesExtension.java | 4 + .../registry/level/GameRuleFactory.java | 26 +- .../registry/level/GameRuleRegistry.java | 8 +- .../advancement/CriteriaTriggersRegistry.java | 9 +- .../level/entity/EntityAttributeRegistry.java | 2 +- .../registry/registries/DeferredRegister.java | 24 +- .../registry/registries/Registrar.java | 39 +++ .../registry/registries/RegistrySupplier.java | 25 ++ .../architectury-common.accessWidener | 53 --- .../main/resources/architectury.accessWidener | 326 ++++++++++++++++++ .../main/resources/architectury.common.json | 2 +- fabric/build.gradle | 3 +- .../fluid/fabric/FluidStackHooksImpl.java | 19 +- .../platform/fabric/PlatformImpl.java | 21 +- .../block/fabric/BlockPropertiesImpl.java | 3 + .../fabric/ItemPropertiesRegistryImpl.java | 7 +- .../fabric/CriteriaTriggersRegistryImpl.java | 29 -- .../biome/fabric/BiomeModificationsImpl.java | 30 +- .../fabric/EntityAttributeRegistryImpl.java | 2 +- .../level/fabric/GameRuleFactoryImpl.java | 44 --- .../level/fabric/GameRuleRegistryImpl.java | 29 -- .../registries/fabric/RegistriesImpl.java | 115 ++++-- .../main/resources/architectury.accessWidener | 110 ------ fabric/src/main/resources/fabric.mod.json | 1 - forge/build.gradle | 5 + .../fluid/forge/FluidStackHooksImpl.java | 19 +- .../platform/forge/PlatformImpl.java | 13 +- .../block/forge/BlockPropertiesImpl.java | 3 + .../forge/CriteriaTriggersRegistryImpl.java | 29 -- .../biome/forge/BiomeModificationsImpl.java | 35 +- .../forge/EntityAttributeRegistryImpl.java | 6 +- .../level/forge/GameRuleFactoryImpl.java | 46 --- .../level/forge/GameRuleRegistryImpl.java | 28 -- .../registries/forge/RegistriesImpl.java | 288 ++++++++++++++-- .../resources/META-INF/accesstransformer.cfg | 50 --- gradle.properties | 2 +- .../java/dev/architectury/test/TestMod.java | 6 +- .../architectury/test/entity/TestEntity.java | 11 +- .../architectury/test/events/DebugEvents.java | 4 +- .../test/registry/TestRegistries.java | 26 ++ .../models/item/test_spawn_egg.json | 3 + testmod-fabric/build.gradle | 2 + testmod-forge/build.gradle | 2 + 48 files changed, 1126 insertions(+), 611 deletions(-) create mode 100644 common/src/main/java/dev/architectury/core/item/ArchitecturySpawnEggItem.java delete mode 100644 common/src/main/resources/architectury-common.accessWidener create mode 100644 common/src/main/resources/architectury.accessWidener delete mode 100644 fabric/src/main/java/dev/architectury/registry/level/advancement/fabric/CriteriaTriggersRegistryImpl.java delete mode 100644 fabric/src/main/java/dev/architectury/registry/level/fabric/GameRuleFactoryImpl.java delete mode 100644 fabric/src/main/java/dev/architectury/registry/level/fabric/GameRuleRegistryImpl.java delete mode 100644 fabric/src/main/resources/architectury.accessWidener delete mode 100644 forge/src/main/java/dev/architectury/registry/level/advancement/forge/CriteriaTriggersRegistryImpl.java delete mode 100644 forge/src/main/java/dev/architectury/registry/level/forge/GameRuleFactoryImpl.java delete mode 100644 forge/src/main/java/dev/architectury/registry/level/forge/GameRuleRegistryImpl.java delete mode 100644 forge/src/main/resources/META-INF/accesstransformer.cfg create mode 100644 testmod-common/src/main/resources/assets/architectury_test/models/item/test_spawn_egg.json diff --git a/common/build.gradle b/common/build.gradle index 935e7ae0..71551a13 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -1,5 +1,5 @@ loom { - accessWidenerPath = file("src/main/resources/architectury-common.accessWidener") + accessWidenerPath = file("src/main/resources/architectury.accessWidener") } dependencies { @@ -12,6 +12,130 @@ architectury { common(rootProject.forgeEnabled.toBoolean()) } +/** + * The following code to generate the access widener is based on the following pull request by Juuxel; + * https://github.com/Juuxel/ + * https://github.com/FabricMC/fabric/pull/2044/ + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC and Juuxel + * + * 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. + */ + +import org.objectweb.asm.ClassReader +import org.objectweb.asm.Opcodes +import org.objectweb.asm.Type +import org.objectweb.asm.tree.ClassNode + +import java.nio.file.FileSystem +import java.nio.file.FileSystems +import java.nio.file.Files +import java.nio.file.Path + +task generateAccessWidener { + doLast { + List lines = ["", "##############################", "# This section is generated automatically with Gradle task generateAccessWidener!!!", "##############################", ""] + Path inputJar = loom.namedMinecraftProvider.parentMinecraftProvider.mergedJar + + try (def fs = FileSystems.newFileSystem(URI.create("jar:${inputJar.toUri()}"), [create: false])) { + generateItemConstructors(lines, fs) + lines.add("") + generateBlockConstructors(lines, fs) + lines.add("") + generateRenderTypeRelated(lines, fs) + } + + file('.gradle/generated.accesswidener').text = String.join('\n', lines) + '\n' + } +} + +static def generateBlockConstructors(List lines, FileSystem fs) { + lines.add("# Constructors of non-abstract block classes") + Files.list(fs.getPath("net/minecraft/world/level/block")) + .filter { Files.isRegularFile(it) && it.toString().endsWith(".class") } + .map { loadClass(it) } + .sorted(Comparator.comparing { it.name }) + .filter { (it.access & Opcodes.ACC_ABSTRACT) == 0 } + .forEach { node -> + for (def method : node.methods) { + // Checklist for finding block constructors as of 1.18.2: + // - class directly in net.minecraft.world.level.block (excluding subpackages) + // - method name == (by definition) + // - contains an BlockBehaviour$Properties parameter + // - only taking into account non-abstract classes and non-public constructors + + // Block constructor... + if (method.name == "" && Type.getArgumentTypes(method.desc).any { it.internalName == 'net/minecraft/world/level/block/state/BlockBehaviour$Properties' }) { + // ...and non-public + if ((method.access & Opcodes.ACC_PUBLIC) == 0) { + lines.add("transitive-accessible method $node.name $method.desc") + } + } + } + } +} + +static def generateItemConstructors(List lines, FileSystem fs) { + lines.add("# Constructors of non-abstract item classes") + Files.list(fs.getPath("net/minecraft/world/item")) + .filter { Files.isRegularFile(it) && it.toString().endsWith(".class") } + .map { loadClass(it) } + .sorted(Comparator.comparing { it.name }) + .filter { (it.access & Opcodes.ACC_ABSTRACT) == 0 } + .forEach { node -> + for (def method : node.methods) { + // Checklist for finding block constructors as of 1.18.2: + // - class directly in net.minecraft.world.item (excluding subpackages) + // - method name == (by definition) + // - contains an Item$Properties parameter + // - only taking into account non-abstract classes and non-public constructors + + // Item constructor... + if (method.name == "" && Type.getArgumentTypes(method.desc).any { it.internalName == 'net/minecraft/world/item/Item$Properties' }) { + // ...and non-public + if ((method.access & Opcodes.ACC_PUBLIC) == 0) { + lines.add("transitive-accessible method $node.name $method.desc") + } + } + } + } +} + +static def generateRenderTypeRelated(List lines, FileSystem fs) { + lines.add("# RenderStateShard fields") + def node = loadClass(fs.getPath("net/minecraft/client/renderer/RenderStateShard.class")) + for (def field : node.fields) { + if ((field.access & Opcodes.ACC_STATIC) != 0 && (field.access & Opcodes.ACC_FINAL) != 0) { + if ((field.access & Opcodes.ACC_PUBLIC) == 0) { + lines.add("transitive-accessible field $node.name $field.name $field.desc") + } + } + } +} + +static ClassNode loadClass(Path path) { + def node = new ClassNode() + + try (def is = Files.newInputStream(path)) { + new ClassReader(is).accept(node, ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES) + } + + return node +} + +/** + * End of access widener code. + */ + publishing { publications { mavenCommon(MavenPublication) { diff --git a/common/src/main/java/dev/architectury/core/item/ArchitecturySpawnEggItem.java b/common/src/main/java/dev/architectury/core/item/ArchitecturySpawnEggItem.java new file mode 100644 index 00000000..a1ccf83f --- /dev/null +++ b/common/src/main/java/dev/architectury/core/item/ArchitecturySpawnEggItem.java @@ -0,0 +1,87 @@ +/* + * This file is part of architectury. + * Copyright (C) 2020, 2021, 2022 architectury + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package dev.architectury.core.item; + +import dev.architectury.registry.registries.RegistrySupplier; +import net.minecraft.core.BlockSource; +import net.minecraft.core.Direction; +import net.minecraft.core.dispenser.DefaultDispenseItemBehavior; +import net.minecraft.core.dispenser.DispenseItemBehavior; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.MobSpawnType; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.SpawnEggItem; +import net.minecraft.world.level.block.DispenserBlock; +import net.minecraft.world.level.gameevent.GameEvent; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.jetbrains.annotations.Nullable; + +import java.util.Objects; + +public class ArchitecturySpawnEggItem extends SpawnEggItem { + private static final Logger LOGGER = LogManager.getLogger(ArchitecturySpawnEggItem.class); + + private final RegistrySupplier> entityType; + + protected static DispenseItemBehavior createDispenseItemBehavior() { + return new DefaultDispenseItemBehavior() { + @Override + public ItemStack execute(BlockSource source, ItemStack stack) { + Direction direction = source.getBlockState().getValue(DispenserBlock.FACING); + EntityType entityType = ((SpawnEggItem) stack.getItem()).getType(stack.getTag()); + + try { + entityType.spawn(source.getLevel(), stack, null, source.getPos().relative(direction), MobSpawnType.DISPENSER, direction != Direction.UP, false); + } catch (Exception var6) { + LOGGER.error("Error while dispensing spawn egg from dispenser at {}", source.getPos(), var6); + return ItemStack.EMPTY; + } + + stack.shrink(1); + source.getLevel().gameEvent(GameEvent.ENTITY_PLACE, source.getPos()); + return stack; + } + }; + } + + public ArchitecturySpawnEggItem(RegistrySupplier> entityType, int backgroundColor, int highlightColor, Properties properties) { + this(entityType, backgroundColor, highlightColor, properties, createDispenseItemBehavior()); + } + + public ArchitecturySpawnEggItem(RegistrySupplier> entityType, int backgroundColor, int highlightColor, Properties properties, + @Nullable DispenseItemBehavior dispenseItemBehavior) { + super(null, backgroundColor, highlightColor, properties); + this.entityType = Objects.requireNonNull(entityType, "entityType"); + SpawnEggItem.BY_ID.remove(null); + entityType.listen(type -> { + SpawnEggItem.BY_ID.put(type, this); + this.defaultType = type; + }); + } + + @Override + public EntityType getType(@Nullable CompoundTag compoundTag) { + EntityType type = super.getType(compoundTag); + return type == null ? entityType.get() : type; + } +} diff --git a/common/src/main/java/dev/architectury/event/EventFactory.java b/common/src/main/java/dev/architectury/event/EventFactory.java index fa444c6f..37270fa5 100644 --- a/common/src/main/java/dev/architectury/event/EventFactory.java +++ b/common/src/main/java/dev/architectury/event/EventFactory.java @@ -24,7 +24,6 @@ import dev.architectury.annotations.ForgeEvent; import dev.architectury.annotations.ForgeEventCancellable; import dev.architectury.injectables.annotations.ExpectPlatform; import org.jetbrains.annotations.ApiStatus; -import org.jetbrains.annotations.NotNull; import java.lang.invoke.MethodHandles; import java.lang.reflect.Method; @@ -58,7 +57,7 @@ public final class EventFactory { public static Event createLoop(Class clazz) { return of(listeners -> (T) Proxy.newProxyInstance(EventFactory.class.getClassLoader(), new Class[]{clazz}, new AbstractInvocationHandler() { @Override - protected Object handleInvocation(@NotNull Object proxy, @NotNull Method method, Object @NotNull [] args) throws Throwable { + protected Object handleInvocation(Object proxy, Method method, Object[] args) throws Throwable { for (var listener : listeners) { invokeMethod(listener, method, args); } @@ -77,7 +76,7 @@ public final class EventFactory { public static Event createEventResult(Class clazz) { return of(listeners -> (T) Proxy.newProxyInstance(EventFactory.class.getClassLoader(), new Class[]{clazz}, new AbstractInvocationHandler() { @Override - protected Object handleInvocation(@NotNull Object proxy, @NotNull Method method, Object @NotNull [] args) throws Throwable { + protected Object handleInvocation(Object proxy, Method method, Object[] args) throws Throwable { for (var listener : listeners) { var result = (EventResult) Objects.requireNonNull(invokeMethod(listener, method, args)); if (result.interruptsFurtherEvaluation()) { @@ -99,7 +98,7 @@ public final class EventFactory { public static Event createCompoundEventResult(Class clazz) { return of(listeners -> (T) Proxy.newProxyInstance(EventFactory.class.getClassLoader(), new Class[]{clazz}, new AbstractInvocationHandler() { @Override - protected Object handleInvocation(@NotNull Object proxy, @NotNull Method method, Object @NotNull [] args) throws Throwable { + protected Object handleInvocation(Object proxy, Method method, Object[] args) throws Throwable { for (var listener : listeners) { var result = (CompoundEventResult) Objects.requireNonNull(invokeMethod(listener, method, args)); if (result.interruptsFurtherEvaluation()) { @@ -121,7 +120,7 @@ public final class EventFactory { public static Event> createConsumerLoop(Class clazz) { Event> event = of(listeners -> (Consumer) Proxy.newProxyInstance(EventFactory.class.getClassLoader(), new Class[]{Consumer.class}, new AbstractInvocationHandler() { @Override - protected Object handleInvocation(@NotNull Object proxy, @NotNull Method method, Object @NotNull [] args) throws Throwable { + protected Object handleInvocation(Object proxy, Method method, Object[] args) throws Throwable { for (var listener : listeners) { invokeMethod(listener, method, args); } @@ -148,7 +147,7 @@ public final class EventFactory { public static Event> createEventActorLoop(Class clazz) { Event> event = of(listeners -> (EventActor) Proxy.newProxyInstance(EventFactory.class.getClassLoader(), new Class[]{EventActor.class}, new AbstractInvocationHandler() { @Override - protected Object handleInvocation(@NotNull Object proxy, @NotNull Method method, Object @NotNull [] args) throws Throwable { + protected Object handleInvocation(Object proxy, Method method, Object[] args) throws Throwable { for (var listener : listeners) { var result = (EventResult) invokeMethod(listener, method, args); if (result.interruptsFurtherEvaluation()) { diff --git a/common/src/main/java/dev/architectury/platform/Platform.java b/common/src/main/java/dev/architectury/platform/Platform.java index b1e00e97..ae864ec4 100644 --- a/common/src/main/java/dev/architectury/platform/Platform.java +++ b/common/src/main/java/dev/architectury/platform/Platform.java @@ -24,7 +24,6 @@ import dev.architectury.injectables.targets.ArchitecturyTarget; import dev.architectury.utils.Env; import net.fabricmc.api.EnvType; import net.minecraft.SharedConstants; -import org.jetbrains.annotations.NotNull; import java.nio.file.Path; import java.util.Collection; diff --git a/common/src/main/java/dev/architectury/registry/block/BlockProperties.java b/common/src/main/java/dev/architectury/registry/block/BlockProperties.java index 63bb15a2..c42d11a2 100644 --- a/common/src/main/java/dev/architectury/registry/block/BlockProperties.java +++ b/common/src/main/java/dev/architectury/registry/block/BlockProperties.java @@ -25,9 +25,12 @@ import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.Material; import net.minecraft.world.level.material.MaterialColor; +import org.jetbrains.annotations.ApiStatus; import java.util.function.Function; +@Deprecated +@ApiStatus.ScheduledForRemoval public abstract class BlockProperties extends BlockBehaviour.Properties implements BlockPropertiesExtension { public BlockProperties(Material material, Function function) { super(material, function); diff --git a/common/src/main/java/dev/architectury/registry/block/BlockPropertiesExtension.java b/common/src/main/java/dev/architectury/registry/block/BlockPropertiesExtension.java index 83cf5537..407f523e 100644 --- a/common/src/main/java/dev/architectury/registry/block/BlockPropertiesExtension.java +++ b/common/src/main/java/dev/architectury/registry/block/BlockPropertiesExtension.java @@ -19,5 +19,9 @@ package dev.architectury.registry.block; +import org.jetbrains.annotations.ApiStatus; + +@Deprecated +@ApiStatus.ScheduledForRemoval public interface BlockPropertiesExtension { } \ No newline at end of file diff --git a/common/src/main/java/dev/architectury/registry/level/GameRuleFactory.java b/common/src/main/java/dev/architectury/registry/level/GameRuleFactory.java index 02163bbd..0ced127f 100644 --- a/common/src/main/java/dev/architectury/registry/level/GameRuleFactory.java +++ b/common/src/main/java/dev/architectury/registry/level/GameRuleFactory.java @@ -19,9 +19,9 @@ package dev.architectury.registry.level; -import dev.architectury.injectables.annotations.ExpectPlatform; import net.minecraft.server.MinecraftServer; import net.minecraft.world.level.GameRules; +import org.jetbrains.annotations.ApiStatus; import java.util.function.BiConsumer; @@ -37,10 +37,12 @@ public final class GameRuleFactory { * * @param defaultValue the rule's default value * @return the created type + * @deprecated Use the method directly. */ - @ExpectPlatform + @Deprecated + @ApiStatus.ScheduledForRemoval public static GameRules.Type createBooleanRule(boolean defaultValue) { - throw new AssertionError(); + return GameRules.BooleanValue.create(defaultValue); } /** @@ -49,10 +51,12 @@ public final class GameRuleFactory { * @param defaultValue the rule's default value * @param changedCallback a callback that is called when the rule's value is changed * @return the created type + * @deprecated Use the method directly. */ - @ExpectPlatform + @Deprecated + @ApiStatus.ScheduledForRemoval public static GameRules.Type createBooleanRule(boolean defaultValue, BiConsumer changedCallback) { - throw new AssertionError(); + return GameRules.BooleanValue.create(defaultValue, changedCallback); } /** @@ -60,10 +64,12 @@ public final class GameRuleFactory { * * @param defaultValue the rule's default value * @return the created type + * @deprecated Use the method directly. */ - @ExpectPlatform + @Deprecated + @ApiStatus.ScheduledForRemoval public static GameRules.Type createIntRule(int defaultValue) { - throw new AssertionError(); + return GameRules.IntegerValue.create(defaultValue); } /** @@ -72,9 +78,11 @@ public final class GameRuleFactory { * @param defaultValue the rule's default value * @param changedCallback a callback that is called when the rule's value is changed * @return the created type + * @deprecated Use the method directly. */ - @ExpectPlatform + @Deprecated + @ApiStatus.ScheduledForRemoval public static GameRules.Type createIntRule(int defaultValue, BiConsumer changedCallback) { - throw new AssertionError(); + return GameRules.IntegerValue.create(defaultValue, changedCallback); } } diff --git a/common/src/main/java/dev/architectury/registry/level/GameRuleRegistry.java b/common/src/main/java/dev/architectury/registry/level/GameRuleRegistry.java index 8bac52c7..49d94e3f 100644 --- a/common/src/main/java/dev/architectury/registry/level/GameRuleRegistry.java +++ b/common/src/main/java/dev/architectury/registry/level/GameRuleRegistry.java @@ -19,8 +19,8 @@ package dev.architectury.registry.level; -import dev.architectury.injectables.annotations.ExpectPlatform; import net.minecraft.world.level.GameRules; +import org.jetbrains.annotations.ApiStatus; /** * A registry for registering game rules. @@ -37,9 +37,11 @@ public final class GameRuleRegistry { * @param type the type of the rule * @param the type of the rule value * @return a key for the registered rule + * @deprecated Use the method directly. */ - @ExpectPlatform + @Deprecated + @ApiStatus.ScheduledForRemoval public static > GameRules.Key register(String name, GameRules.Category category, GameRules.Type type) { - throw new AssertionError(); + return GameRules.register(name, category, type); } } diff --git a/common/src/main/java/dev/architectury/registry/level/advancement/CriteriaTriggersRegistry.java b/common/src/main/java/dev/architectury/registry/level/advancement/CriteriaTriggersRegistry.java index 65b5e1e9..a4a95306 100644 --- a/common/src/main/java/dev/architectury/registry/level/advancement/CriteriaTriggersRegistry.java +++ b/common/src/main/java/dev/architectury/registry/level/advancement/CriteriaTriggersRegistry.java @@ -19,8 +19,9 @@ package dev.architectury.registry.level.advancement; -import dev.architectury.injectables.annotations.ExpectPlatform; +import net.minecraft.advancements.CriteriaTriggers; import net.minecraft.advancements.CriterionTrigger; +import org.jetbrains.annotations.ApiStatus; public final class CriteriaTriggersRegistry { private CriteriaTriggersRegistry() { @@ -32,9 +33,11 @@ public final class CriteriaTriggersRegistry { * @param trigger The trigger to register * @param The type of trigger * @return The trigger registered + * @deprecated Use the method directly. */ - @ExpectPlatform + @Deprecated + @ApiStatus.ScheduledForRemoval public static > T register(T trigger) { - throw new AssertionError(); + return CriteriaTriggers.register(trigger); } } diff --git a/common/src/main/java/dev/architectury/registry/level/entity/EntityAttributeRegistry.java b/common/src/main/java/dev/architectury/registry/level/entity/EntityAttributeRegistry.java index c798a52f..a7c7e5bf 100644 --- a/common/src/main/java/dev/architectury/registry/level/entity/EntityAttributeRegistry.java +++ b/common/src/main/java/dev/architectury/registry/level/entity/EntityAttributeRegistry.java @@ -38,7 +38,7 @@ public final class EntityAttributeRegistry { * @see net.minecraft.world.entity.ai.attributes.DefaultAttributes */ @ExpectPlatform - public static void register(Supplier> type, Supplier attribute) { + public static void register(Supplier> type, Supplier attribute) { throw new AssertionError(); } } diff --git a/common/src/main/java/dev/architectury/registry/registries/DeferredRegister.java b/common/src/main/java/dev/architectury/registry/registries/DeferredRegister.java index d8f1c576..7573ae7f 100644 --- a/common/src/main/java/dev/architectury/registry/registries/DeferredRegister.java +++ b/common/src/main/java/dev/architectury/registry/registries/DeferredRegister.java @@ -23,7 +23,6 @@ import com.google.common.base.Suppliers; import net.minecraft.core.Registry; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; -import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.*; @@ -61,7 +60,7 @@ public class DeferredRegister implements Iterable> { var entry = new Entry(id, (Supplier) supplier); this.entries.add(entry); if (registered) { - var registrar = registriesSupplier.get().get(key); + var registrar = getRegistrar(); entry.value = registrar.register(entry.id, entry.supplier); } return (RegistrySupplier) entry; @@ -72,18 +71,25 @@ public class DeferredRegister implements Iterable> { throw new IllegalStateException("Cannot register a deferred register twice!"); } registered = true; - var registrar = registriesSupplier.get().get(key); + var registrar = getRegistrar(); for (var entry : entries) { entry.value = registrar.register(entry.id, entry.supplier); } } - @NotNull @Override public Iterator> iterator() { return entryView.iterator(); } + public Registries getRegistries() { + return registriesSupplier.get(); + } + + public Registrar getRegistrar() { + return registriesSupplier.get().get(key); + } + private class Entry implements RegistrySupplier { private final ResourceLocation id; private final Supplier supplier; @@ -94,6 +100,16 @@ public class DeferredRegister implements Iterable> { this.supplier = supplier; } + @Override + public Registries getRegistries() { + return DeferredRegister.this.getRegistries(); + } + + @Override + public Registrar getRegistrar() { + return (Registrar) DeferredRegister.this.getRegistrar(); + } + @Override public ResourceLocation getRegistryId() { return key.location(); diff --git a/common/src/main/java/dev/architectury/registry/registries/Registrar.java b/common/src/main/java/dev/architectury/registry/registries/Registrar.java index 9501e35b..775c7e29 100644 --- a/common/src/main/java/dev/architectury/registry/registries/Registrar.java +++ b/common/src/main/java/dev/architectury/registry/registries/Registrar.java @@ -27,11 +27,22 @@ import org.jetbrains.annotations.Nullable; import java.util.Map; import java.util.Optional; import java.util.Set; +import java.util.function.Consumer; import java.util.function.Supplier; public interface Registrar extends Iterable { RegistrySupplier delegate(ResourceLocation id); + default RegistrySupplier wrap(R obj) { + ResourceLocation id = getId(obj); + + if (id == null) { + throw new IllegalArgumentException("Cannot wrap an object without an id: " + obj); + } else { + return (RegistrySupplier) delegate(id); + } + } + RegistrySupplier register(ResourceLocation id, Supplier supplier); @Nullable @@ -56,4 +67,32 @@ public interface Registrar extends Iterable { Set, T>> entrySet(); ResourceKey> key(); + + /** + * Listens to when the registry entry is registered, and calls the given action. + * Evaluates immediately if the entry is already registered. + *

+ * Whenever the callback is called is dependent on the registry implementation. + * On fabric, this will be called when the registry entry is registered. + * On forge, this will be called when the registry entry is registered or when Minecraft has started. + * + * @param supplier the entry to listen to + * @param callback the action to call when the registry entry is registered + */ + default void listen(RegistrySupplier supplier, Consumer callback) { + listen(supplier.getId(), obj -> callback.accept((R) obj)); + } + + /** + * Listens to when the registry entry is registered, and calls the given action. + * Evaluates immediately if the entry is already registered. + *

+ * Whenever the callback is called is dependent on the registry implementation. + * On fabric, this will be called when the registry entry is registered. + * On forge, this will be called when the registry entry is registered or when Minecraft has started. + * + * @param id the entry to listen to + * @param callback the action to call when the registry entry is registered + */ + void listen(ResourceLocation id, Consumer callback); } diff --git a/common/src/main/java/dev/architectury/registry/registries/RegistrySupplier.java b/common/src/main/java/dev/architectury/registry/registries/RegistrySupplier.java index 86f4e3c2..86ec0194 100644 --- a/common/src/main/java/dev/architectury/registry/registries/RegistrySupplier.java +++ b/common/src/main/java/dev/architectury/registry/registries/RegistrySupplier.java @@ -19,7 +19,10 @@ package dev.architectury.registry.registries; +import net.minecraft.core.Registry; +import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; +import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; import java.util.Optional; @@ -27,12 +30,24 @@ import java.util.function.Consumer; import java.util.function.Supplier; import java.util.stream.Stream; +@ApiStatus.NonExtendable public interface RegistrySupplier extends Supplier { + Registries getRegistries(); + + Registrar getRegistrar(); + /** * @return the identifier of the registry */ ResourceLocation getRegistryId(); + /** + * @return the identifier of the registry + */ + default ResourceKey> getRegistryKey() { + return ResourceKey.createRegistryKey(getRegistryId()); + } + /** * @return the identifier of the entry */ @@ -84,4 +99,14 @@ public interface RegistrySupplier extends Supplier { default T orElseGet(Supplier supplier) { return isPresent() ? get() : supplier.get(); } + + /** + * Listens to when the registry entry is registered, and calls the given action. + * Evaluates immediately if the entry is already registered. + * + * @param callback the action to call when the registry entry is registered + */ + default void listen(Consumer callback) { + getRegistrar().listen(this, callback); + } } diff --git a/common/src/main/resources/architectury-common.accessWidener b/common/src/main/resources/architectury-common.accessWidener deleted file mode 100644 index 9f12899b..00000000 --- a/common/src/main/resources/architectury-common.accessWidener +++ /dev/null @@ -1,53 +0,0 @@ -accessWidener v2 named -accessible method net/minecraft/world/level/block/state/BlockBehaviour$Properties (Lnet/minecraft/world/level/material/Material;Ljava/util/function/Function;)V -accessible field net/minecraft/world/level/biome/Biome climateSettings Lnet/minecraft/world/level/biome/Biome$ClimateSettings; -accessible field net/minecraft/world/level/biome/Biome biomeCategory Lnet/minecraft/world/level/biome/Biome$BiomeCategory; -mutable field net/minecraft/world/level/biome/Biome biomeCategory Lnet/minecraft/world/level/biome/Biome$BiomeCategory; -accessible field net/minecraft/world/level/biome/Biome$ClimateSettings precipitation Lnet/minecraft/world/level/biome/Biome$Precipitation; -mutable field net/minecraft/world/level/biome/Biome$ClimateSettings precipitation Lnet/minecraft/world/level/biome/Biome$Precipitation; -accessible field net/minecraft/world/level/biome/Biome$ClimateSettings temperature F -mutable field net/minecraft/world/level/biome/Biome$ClimateSettings temperature F -accessible field net/minecraft/world/level/biome/Biome$ClimateSettings temperatureModifier Lnet/minecraft/world/level/biome/Biome$TemperatureModifier; -mutable field net/minecraft/world/level/biome/Biome$ClimateSettings temperatureModifier Lnet/minecraft/world/level/biome/Biome$TemperatureModifier; -accessible field net/minecraft/world/level/biome/Biome$ClimateSettings downfall F -mutable field net/minecraft/world/level/biome/Biome$ClimateSettings downfall F -accessible field net/minecraft/world/level/biome/BiomeSpecialEffects fogColor I -mutable field net/minecraft/world/level/biome/BiomeSpecialEffects fogColor I -accessible field net/minecraft/world/level/biome/BiomeSpecialEffects waterColor I -mutable field net/minecraft/world/level/biome/BiomeSpecialEffects waterColor I -accessible field net/minecraft/world/level/biome/BiomeSpecialEffects waterFogColor I -mutable field net/minecraft/world/level/biome/BiomeSpecialEffects waterFogColor I -accessible field net/minecraft/world/level/biome/BiomeSpecialEffects skyColor I -mutable field net/minecraft/world/level/biome/BiomeSpecialEffects skyColor I -accessible field net/minecraft/world/level/biome/BiomeSpecialEffects foliageColorOverride Ljava/util/Optional; -mutable field net/minecraft/world/level/biome/BiomeSpecialEffects foliageColorOverride Ljava/util/Optional; -accessible field net/minecraft/world/level/biome/BiomeSpecialEffects grassColorOverride Ljava/util/Optional; -mutable field net/minecraft/world/level/biome/BiomeSpecialEffects grassColorOverride Ljava/util/Optional; -accessible field net/minecraft/world/level/biome/BiomeSpecialEffects grassColorModifier Lnet/minecraft/world/level/biome/BiomeSpecialEffects$GrassColorModifier; -mutable field net/minecraft/world/level/biome/BiomeSpecialEffects grassColorModifier Lnet/minecraft/world/level/biome/BiomeSpecialEffects$GrassColorModifier; -accessible field net/minecraft/world/level/biome/BiomeSpecialEffects ambientParticleSettings Ljava/util/Optional; -mutable field net/minecraft/world/level/biome/BiomeSpecialEffects ambientParticleSettings Ljava/util/Optional; -accessible field net/minecraft/world/level/biome/BiomeSpecialEffects ambientLoopSoundEvent Ljava/util/Optional; -mutable field net/minecraft/world/level/biome/BiomeSpecialEffects ambientLoopSoundEvent Ljava/util/Optional; -accessible field net/minecraft/world/level/biome/BiomeSpecialEffects ambientMoodSettings Ljava/util/Optional; -mutable field net/minecraft/world/level/biome/BiomeSpecialEffects ambientMoodSettings Ljava/util/Optional; -accessible field net/minecraft/world/level/biome/BiomeSpecialEffects ambientAdditionsSettings Ljava/util/Optional; -mutable field net/minecraft/world/level/biome/BiomeSpecialEffects ambientAdditionsSettings Ljava/util/Optional; -accessible field net/minecraft/world/level/biome/BiomeSpecialEffects backgroundMusic Ljava/util/Optional; -mutable field net/minecraft/world/level/biome/BiomeSpecialEffects backgroundMusic Ljava/util/Optional; -transitive-accessible method net/minecraft/world/entity/Entity getEncodeId ()Ljava/lang/String; -transitive-accessible method net/minecraft/world/level/storage/LevelResource (Ljava/lang/String;)V -transitive-accessible class net/minecraft/world/level/block/entity/BlockEntityType$BlockEntitySupplier -accessible field net/minecraft/world/item/AxeItem STRIPPABLES Ljava/util/Map; -mutable field net/minecraft/world/item/AxeItem STRIPPABLES Ljava/util/Map; -accessible field net/minecraft/world/item/ShovelItem FLATTENABLES Ljava/util/Map; -mutable field net/minecraft/world/item/ShovelItem FLATTENABLES Ljava/util/Map; -accessible field net/minecraft/world/item/HoeItem TILLABLES Ljava/util/Map; -mutable field net/minecraft/world/item/HoeItem TILLABLES Ljava/util/Map; -transitive-accessible field net/minecraft/world/level/Explosion source Lnet/minecraft/world/entity/Entity; -transitive-mutable field net/minecraft/world/level/Explosion source Lnet/minecraft/world/entity/Entity; -transitive-accessible field net/minecraft/world/level/Explosion radius F -transitive-mutable field net/minecraft/world/level/Explosion radius F -transitive-accessible method net/minecraft/world/entity/player/Player closeContainer ()V -transitive-accessible method net/minecraft/client/renderer/RenderType create (Ljava/lang/String;Lcom/mojang/blaze3d/vertex/VertexFormat;Lcom/mojang/blaze3d/vertex/VertexFormat$Mode;IZZLnet/minecraft/client/renderer/RenderType$CompositeState;)Lnet/minecraft/client/renderer/RenderType$CompositeRenderType; -transitive-accessible class net/minecraft/client/renderer/RenderType$CompositeState diff --git a/common/src/main/resources/architectury.accessWidener b/common/src/main/resources/architectury.accessWidener new file mode 100644 index 00000000..8a469517 --- /dev/null +++ b/common/src/main/resources/architectury.accessWidener @@ -0,0 +1,326 @@ +accessWidener v2 named +accessible method net/minecraft/client/gui/screens/Screen addRenderableWidget (Lnet/minecraft/client/gui/components/events/GuiEventListener;)Lnet/minecraft/client/gui/components/events/GuiEventListener; +accessible method net/minecraft/client/gui/screens/Screen addRenderableOnly (Lnet/minecraft/client/gui/components/Widget;)Lnet/minecraft/client/gui/components/Widget; +accessible method net/minecraft/client/gui/screens/Screen addWidget (Lnet/minecraft/client/gui/components/events/GuiEventListener;)Lnet/minecraft/client/gui/components/events/GuiEventListener; +accessible field net/minecraft/client/gui/screens/Screen narratables Ljava/util/List; +accessible field net/minecraft/client/gui/screens/Screen renderables Ljava/util/List; +accessible field net/minecraft/world/level/block/state/BlockBehaviour properties Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties; +accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties material Lnet/minecraft/world/level/material/Material; +mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties material Lnet/minecraft/world/level/material/Material; +accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties materialColor Ljava/util/function/Function; +mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties materialColor Ljava/util/function/Function; +accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties hasCollision Z +mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties hasCollision Z +accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties soundType Lnet/minecraft/world/level/block/SoundType; +mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties soundType Lnet/minecraft/world/level/block/SoundType; +accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties lightEmission Ljava/util/function/ToIntFunction; +mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties lightEmission Ljava/util/function/ToIntFunction; +accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties explosionResistance F +mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties explosionResistance F +accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties destroyTime F +mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties destroyTime F +accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties requiresCorrectToolForDrops Z +mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties requiresCorrectToolForDrops Z +accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties isRandomlyTicking Z +mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties isRandomlyTicking Z +accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties friction F +mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties friction F +accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties speedFactor F +mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties speedFactor F +accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties jumpFactor F +mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties jumpFactor F +accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties drops Lnet/minecraft/resources/ResourceLocation; +mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties drops Lnet/minecraft/resources/ResourceLocation; +accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties canOcclude Z +mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties canOcclude Z +accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties isAir Z +mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties isAir Z +accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties isValidSpawn Lnet/minecraft/world/level/block/state/BlockBehaviour$StateArgumentPredicate; +mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties isValidSpawn Lnet/minecraft/world/level/block/state/BlockBehaviour$StateArgumentPredicate; +accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties isRedstoneConductor Lnet/minecraft/world/level/block/state/BlockBehaviour$StatePredicate; +mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties isRedstoneConductor Lnet/minecraft/world/level/block/state/BlockBehaviour$StatePredicate; +accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties isSuffocating Lnet/minecraft/world/level/block/state/BlockBehaviour$StatePredicate; +mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties isSuffocating Lnet/minecraft/world/level/block/state/BlockBehaviour$StatePredicate; +accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties isViewBlocking Lnet/minecraft/world/level/block/state/BlockBehaviour$StatePredicate; +mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties isViewBlocking Lnet/minecraft/world/level/block/state/BlockBehaviour$StatePredicate; +accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties hasPostProcess Lnet/minecraft/world/level/block/state/BlockBehaviour$StatePredicate; +mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties hasPostProcess Lnet/minecraft/world/level/block/state/BlockBehaviour$StatePredicate; +accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties emissiveRendering Lnet/minecraft/world/level/block/state/BlockBehaviour$StatePredicate; +mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties emissiveRendering Lnet/minecraft/world/level/block/state/BlockBehaviour$StatePredicate; +accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties dynamicShape Z +mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties dynamicShape Z +accessible method net/minecraft/world/level/block/state/BlockBehaviour$Properties (Lnet/minecraft/world/level/material/Material;Ljava/util/function/Function;)V +transitive-accessible method net/minecraft/world/entity/player/Player closeContainer ()V +transitive-accessible method net/minecraft/advancements/CriteriaTriggers register (Lnet/minecraft/advancements/CriterionTrigger;)Lnet/minecraft/advancements/CriterionTrigger; +accessible method net/minecraft/world/inventory/MenuType (Lnet/minecraft/world/inventory/MenuType$MenuSupplier;)V +accessible class net/minecraft/world/inventory/MenuType$MenuSupplier +accessible method net/minecraft/world/entity/Entity getEncodeId ()Ljava/lang/String; +accessible field net/minecraft/server/packs/repository/PackRepository sources Ljava/util/Set; +mutable field net/minecraft/server/packs/repository/PackRepository sources Ljava/util/Set; +accessible field net/minecraft/world/level/biome/Biome climateSettings Lnet/minecraft/world/level/biome/Biome$ClimateSettings; +accessible field net/minecraft/world/level/biome/Biome biomeCategory Lnet/minecraft/world/level/biome/Biome$BiomeCategory; +mutable field net/minecraft/world/level/biome/Biome biomeCategory Lnet/minecraft/world/level/biome/Biome$BiomeCategory; +accessible field net/minecraft/world/level/biome/Biome$ClimateSettings precipitation Lnet/minecraft/world/level/biome/Biome$Precipitation; +mutable field net/minecraft/world/level/biome/Biome$ClimateSettings precipitation Lnet/minecraft/world/level/biome/Biome$Precipitation; +accessible field net/minecraft/world/level/biome/Biome$ClimateSettings temperature F +mutable field net/minecraft/world/level/biome/Biome$ClimateSettings temperature F +accessible field net/minecraft/world/level/biome/Biome$ClimateSettings temperatureModifier Lnet/minecraft/world/level/biome/Biome$TemperatureModifier; +mutable field net/minecraft/world/level/biome/Biome$ClimateSettings temperatureModifier Lnet/minecraft/world/level/biome/Biome$TemperatureModifier; +accessible field net/minecraft/world/level/biome/Biome$ClimateSettings downfall F +mutable field net/minecraft/world/level/biome/Biome$ClimateSettings downfall F +accessible field net/minecraft/world/level/biome/BiomeSpecialEffects fogColor I +mutable field net/minecraft/world/level/biome/BiomeSpecialEffects fogColor I +accessible field net/minecraft/world/level/biome/BiomeSpecialEffects waterColor I +mutable field net/minecraft/world/level/biome/BiomeSpecialEffects waterColor I +accessible field net/minecraft/world/level/biome/BiomeSpecialEffects waterFogColor I +mutable field net/minecraft/world/level/biome/BiomeSpecialEffects waterFogColor I +accessible field net/minecraft/world/level/biome/BiomeSpecialEffects skyColor I +mutable field net/minecraft/world/level/biome/BiomeSpecialEffects skyColor I +accessible field net/minecraft/world/level/biome/BiomeSpecialEffects foliageColorOverride Ljava/util/Optional; +mutable field net/minecraft/world/level/biome/BiomeSpecialEffects foliageColorOverride Ljava/util/Optional; +accessible field net/minecraft/world/level/biome/BiomeSpecialEffects grassColorOverride Ljava/util/Optional; +mutable field net/minecraft/world/level/biome/BiomeSpecialEffects grassColorOverride Ljava/util/Optional; +accessible field net/minecraft/world/level/biome/BiomeSpecialEffects grassColorModifier Lnet/minecraft/world/level/biome/BiomeSpecialEffects$GrassColorModifier; +mutable field net/minecraft/world/level/biome/BiomeSpecialEffects grassColorModifier Lnet/minecraft/world/level/biome/BiomeSpecialEffects$GrassColorModifier; +accessible field net/minecraft/world/level/biome/BiomeSpecialEffects ambientParticleSettings Ljava/util/Optional; +mutable field net/minecraft/world/level/biome/BiomeSpecialEffects ambientParticleSettings Ljava/util/Optional; +accessible field net/minecraft/world/level/biome/BiomeSpecialEffects ambientLoopSoundEvent Ljava/util/Optional; +mutable field net/minecraft/world/level/biome/BiomeSpecialEffects ambientLoopSoundEvent Ljava/util/Optional; +accessible field net/minecraft/world/level/biome/BiomeSpecialEffects ambientMoodSettings Ljava/util/Optional; +mutable field net/minecraft/world/level/biome/BiomeSpecialEffects ambientMoodSettings Ljava/util/Optional; +accessible field net/minecraft/world/level/biome/BiomeSpecialEffects ambientAdditionsSettings Ljava/util/Optional; +mutable field net/minecraft/world/level/biome/BiomeSpecialEffects ambientAdditionsSettings Ljava/util/Optional; +accessible field net/minecraft/world/level/biome/BiomeSpecialEffects backgroundMusic Ljava/util/Optional; +mutable field net/minecraft/world/level/biome/BiomeSpecialEffects backgroundMusic Ljava/util/Optional; +accessible field net/minecraft/world/level/biome/BiomeGenerationSettings$Builder features Ljava/util/List; +accessible field net/minecraft/world/level/biome/MobSpawnSettings$Builder spawners Ljava/util/Map; +accessible field net/minecraft/world/level/biome/MobSpawnSettings$Builder mobSpawnCosts Ljava/util/Map; +accessible field net/minecraft/world/level/biome/MobSpawnSettings$Builder creatureGenerationProbability F +transitive-accessible method net/minecraft/world/level/GameRules register (Ljava/lang/String;Lnet/minecraft/world/level/GameRules$Category;Lnet/minecraft/world/level/GameRules$Type;)Lnet/minecraft/world/level/GameRules$Key; +transitive-accessible method net/minecraft/world/level/GameRules$BooleanValue create (ZLjava/util/function/BiConsumer;)Lnet/minecraft/world/level/GameRules$Type; +transitive-accessible method net/minecraft/world/level/GameRules$BooleanValue create (Z)Lnet/minecraft/world/level/GameRules$Type; +transitive-accessible method net/minecraft/world/level/GameRules$IntegerValue create (ILjava/util/function/BiConsumer;)Lnet/minecraft/world/level/GameRules$Type; +transitive-accessible method net/minecraft/world/level/GameRules$IntegerValue create (I)Lnet/minecraft/world/level/GameRules$Type; +transitive-accessible method net/minecraft/world/level/storage/LevelResource (Ljava/lang/String;)V +transitive-accessible class net/minecraft/world/level/block/entity/BlockEntityType$BlockEntitySupplier +accessible field net/minecraft/world/item/AxeItem STRIPPABLES Ljava/util/Map; +mutable field net/minecraft/world/item/AxeItem STRIPPABLES Ljava/util/Map; +accessible field net/minecraft/world/item/ShovelItem FLATTENABLES Ljava/util/Map; +mutable field net/minecraft/world/item/ShovelItem FLATTENABLES Ljava/util/Map; +accessible field net/minecraft/world/item/HoeItem TILLABLES Ljava/util/Map; +mutable field net/minecraft/world/item/HoeItem TILLABLES Ljava/util/Map; +transitive-accessible field net/minecraft/world/level/Explosion source Lnet/minecraft/world/entity/Entity; +transitive-mutable field net/minecraft/world/level/Explosion source Lnet/minecraft/world/entity/Entity; +transitive-accessible field net/minecraft/world/level/Explosion radius F +transitive-mutable field net/minecraft/world/level/Explosion radius F +transitive-accessible method net/minecraft/world/entity/player/Player closeContainer ()V +transitive-accessible method net/minecraft/client/renderer/RenderType create (Ljava/lang/String;Lcom/mojang/blaze3d/vertex/VertexFormat;Lcom/mojang/blaze3d/vertex/VertexFormat$Mode;ILnet/minecraft/client/renderer/RenderType$CompositeState;)Lnet/minecraft/client/renderer/RenderType$CompositeRenderType; +transitive-accessible method net/minecraft/client/renderer/RenderType create (Ljava/lang/String;Lcom/mojang/blaze3d/vertex/VertexFormat;Lcom/mojang/blaze3d/vertex/VertexFormat$Mode;IZZLnet/minecraft/client/renderer/RenderType$CompositeState;)Lnet/minecraft/client/renderer/RenderType$CompositeRenderType; +transitive-accessible class net/minecraft/client/renderer/RenderType$CompositeState +transitive-accessible class net/minecraft/client/renderer/RenderType$CompositeRenderType +transitive-accessible class net/minecraft/client/renderer/RenderType$OutlineProperty +accessible field net/minecraft/world/item/SpawnEggItem BY_ID Ljava/util/Map; +accessible field net/minecraft/world/item/SpawnEggItem defaultType Lnet/minecraft/world/entity/EntityType; +mutable field net/minecraft/world/item/SpawnEggItem defaultType Lnet/minecraft/world/entity/EntityType; +accessible field net/minecraft/client/particle/ParticleEngine textureAtlas Lnet/minecraft/client/renderer/texture/TextureAtlas; +accessible class net/minecraft/client/particle/ParticleEngine$MutableSpriteSet +accessible field net/minecraft/client/particle/ParticleEngine$MutableSpriteSet sprites Ljava/util/List; + +############################## +# This section is generated automatically with Gradle task generateAccessWidener!!! +############################## + +# Constructors of non-abstract item classes +transitive-accessible method net/minecraft/world/item/AxeItem (Lnet/minecraft/world/item/Tier;FFLnet/minecraft/world/item/Item$Properties;)V +transitive-accessible method net/minecraft/world/item/DiggerItem (FFLnet/minecraft/world/item/Tier;Lnet/minecraft/tags/TagKey;Lnet/minecraft/world/item/Item$Properties;)V +transitive-accessible method net/minecraft/world/item/HoeItem (Lnet/minecraft/world/item/Tier;IFLnet/minecraft/world/item/Item$Properties;)V +transitive-accessible method net/minecraft/world/item/PickaxeItem (Lnet/minecraft/world/item/Tier;IFLnet/minecraft/world/item/Item$Properties;)V +transitive-accessible method net/minecraft/world/item/RecordItem (ILnet/minecraft/sounds/SoundEvent;Lnet/minecraft/world/item/Item$Properties;)V + +# Constructors of non-abstract block classes +transitive-accessible method net/minecraft/world/level/block/AirBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/AttachedStemBlock (Lnet/minecraft/world/level/block/StemGrownBlock;Ljava/util/function/Supplier;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/AzaleaBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/BarrierBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/BaseCoralFanBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/BaseCoralPlantBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/BaseCoralPlantTypeBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/BaseCoralWallFanBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/BigDripleafBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/BigDripleafStemBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/BlastFurnaceBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/BushBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/CactusBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/CakeBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/CandleCakeBlock (Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/CartographyTableBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/CarvedPumpkinBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/ChestBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;Ljava/util/function/Supplier;)V +transitive-accessible method net/minecraft/world/level/block/ChorusFlowerBlock (Lnet/minecraft/world/level/block/ChorusPlantBlock;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/ChorusPlantBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/CoralFanBlock (Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/CoralPlantBlock (Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/CoralWallFanBlock (Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/CraftingTableBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/CropBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/CrossCollisionBlock (FFFFFLnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/DeadBushBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/DirtPathBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/DispenserBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/DoorBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/EnchantmentTableBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/EndGatewayBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/EndPortalBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/EndRodBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/EnderChestBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/FaceAttachedHorizontalDirectionalBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/FarmBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/FletchingTableBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/FungusBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;Ljava/util/function/Supplier;)V +transitive-accessible method net/minecraft/world/level/block/FurnaceBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/GrindstoneBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/HalfTransparentBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/HangingRootsBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/IronBarsBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/JigsawBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/JukeboxBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/KelpBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/KelpPlantBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/LadderBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/LecternBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/LeverBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/LiquidBlock (Lnet/minecraft/world/level/material/FlowingFluid;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/LoomBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/MelonBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/NetherWartBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/NyliumBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/PipeBlock (FLnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/PlayerHeadBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/PlayerWallHeadBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/PoweredRailBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/PressurePlateBlock (Lnet/minecraft/world/level/block/PressurePlateBlock$Sensitivity;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/PumpkinBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/RailBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/RedstoneTorchBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/RedstoneWallTorchBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/RepeaterBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/RodBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/RootsBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/SaplingBlock (Lnet/minecraft/world/level/block/grower/AbstractTreeGrower;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/ScaffoldingBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/SeaPickleBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/SeagrassBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/SkullBlock (Lnet/minecraft/world/level/block/SkullBlock$Type;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/SmithingTableBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/SmokerBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/SnowLayerBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/SnowyDirtBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/SpawnerBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/SpongeBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/StairBlock (Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/StemBlock (Lnet/minecraft/world/level/block/StemGrownBlock;Ljava/util/function/Supplier;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/StoneButtonBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/StructureBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/StructureVoidBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/SugarCaneBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/TallGrassBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/TorchBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;Lnet/minecraft/core/particles/ParticleOptions;)V +transitive-accessible method net/minecraft/world/level/block/TrapDoorBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/WallSkullBlock (Lnet/minecraft/world/level/block/SkullBlock$Type;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/WallTorchBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;Lnet/minecraft/core/particles/ParticleOptions;)V +transitive-accessible method net/minecraft/world/level/block/WaterlilyBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/WeightedPressurePlateBlock (ILnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/WetSpongeBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/WitherSkullBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/WitherWallSkullBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/WoodButtonBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V +transitive-accessible method net/minecraft/world/level/block/WoolCarpetBlock (Lnet/minecraft/world/item/DyeColor;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V + +# RenderStateShard fields +transitive-accessible field net/minecraft/client/renderer/RenderStateShard VIEW_SCALE_Z_EPSILON F +transitive-accessible field net/minecraft/client/renderer/RenderStateShard NO_TRANSPARENCY Lnet/minecraft/client/renderer/RenderStateShard$TransparencyStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard ADDITIVE_TRANSPARENCY Lnet/minecraft/client/renderer/RenderStateShard$TransparencyStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard LIGHTNING_TRANSPARENCY Lnet/minecraft/client/renderer/RenderStateShard$TransparencyStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard GLINT_TRANSPARENCY Lnet/minecraft/client/renderer/RenderStateShard$TransparencyStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard CRUMBLING_TRANSPARENCY Lnet/minecraft/client/renderer/RenderStateShard$TransparencyStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard TRANSLUCENT_TRANSPARENCY Lnet/minecraft/client/renderer/RenderStateShard$TransparencyStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard NO_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard BLOCK_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard NEW_ENTITY_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard POSITION_COLOR_LIGHTMAP_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard POSITION_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard POSITION_COLOR_TEX_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard POSITION_TEX_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard POSITION_COLOR_TEX_LIGHTMAP_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard POSITION_COLOR_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_SOLID_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_CUTOUT_MIPPED_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_CUTOUT_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_TRANSLUCENT_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_TRANSLUCENT_MOVING_BLOCK_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_TRANSLUCENT_NO_CRUMBLING_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_ARMOR_CUTOUT_NO_CULL_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_ENTITY_SOLID_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_ENTITY_CUTOUT_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_ENTITY_CUTOUT_NO_CULL_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_ENTITY_CUTOUT_NO_CULL_Z_OFFSET_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_ITEM_ENTITY_TRANSLUCENT_CULL_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_ENTITY_TRANSLUCENT_CULL_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_ENTITY_TRANSLUCENT_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_ENTITY_SMOOTH_CUTOUT_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_BEACON_BEAM_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_ENTITY_DECAL_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_ENTITY_NO_OUTLINE_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_ENTITY_SHADOW_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_ENTITY_ALPHA_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_EYES_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_ENERGY_SWIRL_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_LEASH_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_WATER_MASK_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_OUTLINE_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_ARMOR_GLINT_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_ARMOR_ENTITY_GLINT_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_GLINT_TRANSLUCENT_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_GLINT_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_GLINT_DIRECT_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_ENTITY_GLINT_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_ENTITY_GLINT_DIRECT_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_CRUMBLING_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_TEXT_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_TEXT_INTENSITY_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_TEXT_SEE_THROUGH_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_TEXT_INTENSITY_SEE_THROUGH_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_LIGHTNING_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_TRIPWIRE_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_END_PORTAL_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_END_GATEWAY_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard RENDERTYPE_LINES_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard BLOCK_SHEET_MIPPED Lnet/minecraft/client/renderer/RenderStateShard$TextureStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard BLOCK_SHEET Lnet/minecraft/client/renderer/RenderStateShard$TextureStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard NO_TEXTURE Lnet/minecraft/client/renderer/RenderStateShard$EmptyTextureStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard DEFAULT_TEXTURING Lnet/minecraft/client/renderer/RenderStateShard$TexturingStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard GLINT_TEXTURING Lnet/minecraft/client/renderer/RenderStateShard$TexturingStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard ENTITY_GLINT_TEXTURING Lnet/minecraft/client/renderer/RenderStateShard$TexturingStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard LIGHTMAP Lnet/minecraft/client/renderer/RenderStateShard$LightmapStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard NO_LIGHTMAP Lnet/minecraft/client/renderer/RenderStateShard$LightmapStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard OVERLAY Lnet/minecraft/client/renderer/RenderStateShard$OverlayStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard NO_OVERLAY Lnet/minecraft/client/renderer/RenderStateShard$OverlayStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard CULL Lnet/minecraft/client/renderer/RenderStateShard$CullStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard NO_CULL Lnet/minecraft/client/renderer/RenderStateShard$CullStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard NO_DEPTH_TEST Lnet/minecraft/client/renderer/RenderStateShard$DepthTestStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard EQUAL_DEPTH_TEST Lnet/minecraft/client/renderer/RenderStateShard$DepthTestStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard LEQUAL_DEPTH_TEST Lnet/minecraft/client/renderer/RenderStateShard$DepthTestStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard COLOR_DEPTH_WRITE Lnet/minecraft/client/renderer/RenderStateShard$WriteMaskStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard COLOR_WRITE Lnet/minecraft/client/renderer/RenderStateShard$WriteMaskStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard DEPTH_WRITE Lnet/minecraft/client/renderer/RenderStateShard$WriteMaskStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard NO_LAYERING Lnet/minecraft/client/renderer/RenderStateShard$LayeringStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard POLYGON_OFFSET_LAYERING Lnet/minecraft/client/renderer/RenderStateShard$LayeringStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard VIEW_OFFSET_Z_LAYERING Lnet/minecraft/client/renderer/RenderStateShard$LayeringStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard MAIN_TARGET Lnet/minecraft/client/renderer/RenderStateShard$OutputStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard OUTLINE_TARGET Lnet/minecraft/client/renderer/RenderStateShard$OutputStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard TRANSLUCENT_TARGET Lnet/minecraft/client/renderer/RenderStateShard$OutputStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard PARTICLES_TARGET Lnet/minecraft/client/renderer/RenderStateShard$OutputStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard WEATHER_TARGET Lnet/minecraft/client/renderer/RenderStateShard$OutputStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard CLOUDS_TARGET Lnet/minecraft/client/renderer/RenderStateShard$OutputStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard ITEM_ENTITY_TARGET Lnet/minecraft/client/renderer/RenderStateShard$OutputStateShard; +transitive-accessible field net/minecraft/client/renderer/RenderStateShard DEFAULT_LINE Lnet/minecraft/client/renderer/RenderStateShard$LineStateShard; diff --git a/common/src/main/resources/architectury.common.json b/common/src/main/resources/architectury.common.json index ec48b539..30ff27f0 100644 --- a/common/src/main/resources/architectury.common.json +++ b/common/src/main/resources/architectury.common.json @@ -1,3 +1,3 @@ { - "accessWidener": "architectury-common.accessWidener" + "accessWidener": "architectury.accessWidener" } \ No newline at end of file diff --git a/fabric/build.gradle b/fabric/build.gradle index 4224b1c9..55be8e87 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -4,7 +4,7 @@ plugins { } loom { - accessWidenerPath = file("src/main/resources/architectury.accessWidener") + accessWidenerPath = project(":common").loom.accessWidenerPath } architectury { @@ -49,6 +49,7 @@ shadowJar { } remapJar { + injectAccessWidener = true input.set shadowJar.archiveFile dependsOn shadowJar classifier null diff --git a/fabric/src/main/java/dev/architectury/hooks/fluid/fabric/FluidStackHooksImpl.java b/fabric/src/main/java/dev/architectury/hooks/fluid/fabric/FluidStackHooksImpl.java index 26b5a05d..2d4d598f 100644 --- a/fabric/src/main/java/dev/architectury/hooks/fluid/fabric/FluidStackHooksImpl.java +++ b/fabric/src/main/java/dev/architectury/hooks/fluid/fabric/FluidStackHooksImpl.java @@ -38,7 +38,6 @@ import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.Fluids; -import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.Objects; @@ -109,7 +108,7 @@ public class FluidStackHooksImpl { @Environment(EnvType.CLIENT) @Nullable - public static TextureAtlasSprite getStillTexture(@Nullable BlockAndTintGetter level, @Nullable BlockPos pos, @NotNull FluidState state) { + public static TextureAtlasSprite getStillTexture(@Nullable BlockAndTintGetter level, @Nullable BlockPos pos, FluidState state) { if (state.getType() == Fluids.EMPTY) return null; var handler = FluidRenderHandlerRegistry.INSTANCE.get(state.getType()); if (handler == null) return null; @@ -120,7 +119,7 @@ public class FluidStackHooksImpl { @Environment(EnvType.CLIENT) @Nullable - public static TextureAtlasSprite getStillTexture(@NotNull FluidStack stack) { + public static TextureAtlasSprite getStillTexture(FluidStack stack) { if (stack.getFluid() == Fluids.EMPTY) return null; var handler = FluidRenderHandlerRegistry.INSTANCE.get(stack.getFluid()); if (handler == null) return null; @@ -131,7 +130,7 @@ public class FluidStackHooksImpl { @Environment(EnvType.CLIENT) @Nullable - public static TextureAtlasSprite getStillTexture(@NotNull Fluid fluid) { + public static TextureAtlasSprite getStillTexture(Fluid fluid) { if (fluid == Fluids.EMPTY) return null; var handler = FluidRenderHandlerRegistry.INSTANCE.get(fluid); if (handler == null) return null; @@ -142,7 +141,7 @@ public class FluidStackHooksImpl { @Environment(EnvType.CLIENT) @Nullable - public static TextureAtlasSprite getFlowingTexture(@Nullable BlockAndTintGetter level, @Nullable BlockPos pos, @NotNull FluidState state) { + public static TextureAtlasSprite getFlowingTexture(@Nullable BlockAndTintGetter level, @Nullable BlockPos pos, FluidState state) { if (state.getType() == Fluids.EMPTY) return null; var handler = FluidRenderHandlerRegistry.INSTANCE.get(state.getType()); if (handler == null) return null; @@ -153,7 +152,7 @@ public class FluidStackHooksImpl { @Environment(EnvType.CLIENT) @Nullable - public static TextureAtlasSprite getFlowingTexture(@NotNull FluidStack stack) { + public static TextureAtlasSprite getFlowingTexture(FluidStack stack) { if (stack.getFluid() == Fluids.EMPTY) return null; var handler = FluidRenderHandlerRegistry.INSTANCE.get(stack.getFluid()); if (handler == null) return null; @@ -164,7 +163,7 @@ public class FluidStackHooksImpl { @Environment(EnvType.CLIENT) @Nullable - public static TextureAtlasSprite getFlowingTexture(@NotNull Fluid fluid) { + public static TextureAtlasSprite getFlowingTexture(Fluid fluid) { if (fluid == Fluids.EMPTY) return null; var handler = FluidRenderHandlerRegistry.INSTANCE.get(fluid); if (handler == null) return null; @@ -174,7 +173,7 @@ public class FluidStackHooksImpl { } @Environment(EnvType.CLIENT) - public static int getColor(@Nullable BlockAndTintGetter level, @Nullable BlockPos pos, @NotNull FluidState state) { + public static int getColor(@Nullable BlockAndTintGetter level, @Nullable BlockPos pos, FluidState state) { if (state.getType() == Fluids.EMPTY) return -1; var handler = FluidRenderHandlerRegistry.INSTANCE.get(state.getType()); if (handler == null) return -1; @@ -182,7 +181,7 @@ public class FluidStackHooksImpl { } @Environment(EnvType.CLIENT) - public static int getColor(@NotNull FluidStack stack) { + public static int getColor(FluidStack stack) { if (stack.getFluid() == Fluids.EMPTY) return -1; var handler = FluidRenderHandlerRegistry.INSTANCE.get(stack.getFluid()); if (handler == null) return -1; @@ -190,7 +189,7 @@ public class FluidStackHooksImpl { } @Environment(EnvType.CLIENT) - public static int getColor(@NotNull Fluid fluid) { + public static int getColor(Fluid fluid) { if (fluid == Fluids.EMPTY) return -1; var handler = FluidRenderHandlerRegistry.INSTANCE.get(fluid); if (handler == null) return -1; diff --git a/fabric/src/main/java/dev/architectury/platform/fabric/PlatformImpl.java b/fabric/src/main/java/dev/architectury/platform/fabric/PlatformImpl.java index 0036ae73..8dadf8a9 100644 --- a/fabric/src/main/java/dev/architectury/platform/fabric/PlatformImpl.java +++ b/fabric/src/main/java/dev/architectury/platform/fabric/PlatformImpl.java @@ -26,7 +26,6 @@ import net.fabricmc.loader.api.FabricLoader; import net.fabricmc.loader.api.ModContainer; import net.fabricmc.loader.api.metadata.ModMetadata; import net.fabricmc.loader.api.metadata.Person; -import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.nio.file.Path; @@ -99,37 +98,37 @@ public class PlatformImpl { } @Override - public @NotNull String getModId() { + public String getModId() { return metadata.getId(); } @Override - public @NotNull String getVersion() { + public String getVersion() { return metadata.getVersion().getFriendlyString(); } @Override - public @NotNull String getName() { + public String getName() { return metadata.getName(); } @Override - public @NotNull String getDescription() { + public String getDescription() { return metadata.getDescription(); } @Override - public @NotNull Optional getLogoFile(int preferredSize) { + public Optional getLogoFile(int preferredSize) { return metadata.getIconPath(preferredSize); } @Override - public @NotNull Path getFilePath() { + public Path getFilePath() { return container.getRootPath(); } @Override - public @NotNull Collection getAuthors() { + public Collection getAuthors() { return metadata.getAuthors().stream() .map(Person::getName) .collect(Collectors.toList()); @@ -141,17 +140,17 @@ public class PlatformImpl { } @Override - public @NotNull Optional getHomepage() { + public Optional getHomepage() { return metadata.getContact().get("homepage"); } @Override - public @NotNull Optional getSources() { + public Optional getSources() { return metadata.getContact().get("issues"); } @Override - public @NotNull Optional getIssueTracker() { + public Optional getIssueTracker() { return metadata.getContact().get("sources"); } diff --git a/fabric/src/main/java/dev/architectury/registry/block/fabric/BlockPropertiesImpl.java b/fabric/src/main/java/dev/architectury/registry/block/fabric/BlockPropertiesImpl.java index 0ee81346..4342bd99 100644 --- a/fabric/src/main/java/dev/architectury/registry/block/fabric/BlockPropertiesImpl.java +++ b/fabric/src/main/java/dev/architectury/registry/block/fabric/BlockPropertiesImpl.java @@ -24,9 +24,12 @@ import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.Material; import net.minecraft.world.level.material.MaterialColor; +import org.jetbrains.annotations.ApiStatus; import java.util.function.Function; +@Deprecated +@ApiStatus.ScheduledForRemoval public class BlockPropertiesImpl { public static BlockProperties of(Material material, MaterialColor color) { return new Impl(material, (state) -> color); diff --git a/fabric/src/main/java/dev/architectury/registry/item/fabric/ItemPropertiesRegistryImpl.java b/fabric/src/main/java/dev/architectury/registry/item/fabric/ItemPropertiesRegistryImpl.java index f8849023..f6da4672 100644 --- a/fabric/src/main/java/dev/architectury/registry/item/fabric/ItemPropertiesRegistryImpl.java +++ b/fabric/src/main/java/dev/architectury/registry/item/fabric/ItemPropertiesRegistryImpl.java @@ -19,18 +19,19 @@ package dev.architectury.registry.item.fabric; +import net.fabricmc.fabric.api.object.builder.v1.client.model.FabricModelPredicateProviderRegistry; import net.minecraft.client.renderer.item.ClampedItemPropertyFunction; -import net.minecraft.client.renderer.item.ItemProperties; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.ItemLike; public class ItemPropertiesRegistryImpl { public static ClampedItemPropertyFunction registerGeneric(ResourceLocation propertyId, ClampedItemPropertyFunction function) { - return ItemProperties.registerGeneric(propertyId, function); + FabricModelPredicateProviderRegistry.register(propertyId, function); + return function; } public static ClampedItemPropertyFunction register(ItemLike item, ResourceLocation propertyId, ClampedItemPropertyFunction function) { - ItemProperties.register(item.asItem(), propertyId, function); + FabricModelPredicateProviderRegistry.register(item.asItem(), propertyId, function); return function; } } diff --git a/fabric/src/main/java/dev/architectury/registry/level/advancement/fabric/CriteriaTriggersRegistryImpl.java b/fabric/src/main/java/dev/architectury/registry/level/advancement/fabric/CriteriaTriggersRegistryImpl.java deleted file mode 100644 index dc3158f1..00000000 --- a/fabric/src/main/java/dev/architectury/registry/level/advancement/fabric/CriteriaTriggersRegistryImpl.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * This file is part of architectury. - * Copyright (C) 2020, 2021, 2022 architectury - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package dev.architectury.registry.level.advancement.fabric; - -import net.minecraft.advancements.CriteriaTriggers; -import net.minecraft.advancements.CriterionTrigger; - -public class CriteriaTriggersRegistryImpl { - public static > T register(T trigger) { - return CriteriaTriggers.register(trigger); - } -} diff --git a/fabric/src/main/java/dev/architectury/registry/level/biome/fabric/BiomeModificationsImpl.java b/fabric/src/main/java/dev/architectury/registry/level/biome/fabric/BiomeModificationsImpl.java index b44a1249..a95b0989 100644 --- a/fabric/src/main/java/dev/architectury/registry/level/biome/fabric/BiomeModificationsImpl.java +++ b/fabric/src/main/java/dev/architectury/registry/level/biome/fabric/BiomeModificationsImpl.java @@ -44,7 +44,6 @@ import net.minecraft.world.level.levelgen.GenerationStep; import net.minecraft.world.level.levelgen.carver.ConfiguredWorldCarver; import net.minecraft.world.level.levelgen.placement.PlacedFeature; import org.apache.commons.lang3.tuple.Pair; -import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.List; @@ -103,13 +102,11 @@ public class BiomeModificationsImpl { BiomeProperties properties = BiomeHooks.getBiomeProperties(context.getBiome()); @Override - @NotNull public ResourceLocation getKey() { return context.getBiomeKey().location(); } @Override - @NotNull public BiomeProperties getProperties() { return properties; } @@ -125,8 +122,7 @@ public class BiomeModificationsImpl { new MutableSpawnProperties(biome, context.getSpawnSettings()) ) { @Override - @NotNull - public BiomeProperties.Mutable setCategory(@NotNull BiomeCategory category) { + public BiomeProperties.Mutable setCategory(BiomeCategory category) { context.setCategory(category); return this; } @@ -185,7 +181,7 @@ public class BiomeModificationsImpl { } @Override - public @NotNull Mutable setCreatureProbability(float probability) { + public Mutable setCreatureProbability(float probability) { context.setCreatureSpawnProbability(probability); return this; } @@ -223,28 +219,24 @@ public class BiomeModificationsImpl { private static ClimateProperties.Mutable wrapWeather(Biome biome, WeatherContext context) { return new BiomeHooks.ClimateWrapped(biome) { @Override - @NotNull - public ClimateProperties.Mutable setPrecipitation(@NotNull Precipitation precipitation) { + public ClimateProperties.Mutable setPrecipitation(Precipitation precipitation) { context.setPrecipitation(precipitation); return this; } @Override - @NotNull public ClimateProperties.Mutable setTemperature(float temperature) { context.setTemperature(temperature); return this; } @Override - @NotNull - public ClimateProperties.Mutable setTemperatureModifier(@NotNull TemperatureModifier temperatureModifier) { + public ClimateProperties.Mutable setTemperatureModifier(TemperatureModifier temperatureModifier) { context.setTemperatureModifier(temperatureModifier); return this; } @Override - @NotNull public ClimateProperties.Mutable setDownfall(float downfall) { context.setDownfall(downfall); return this; @@ -255,84 +247,72 @@ public class BiomeModificationsImpl { private static EffectsProperties.Mutable wrapEffects(Biome biome, EffectsContext context) { return new BiomeHooks.EffectsWrapped(biome) { @Override - @NotNull public EffectsProperties.Mutable setFogColor(int color) { context.setFogColor(color); return this; } @Override - @NotNull public EffectsProperties.Mutable setWaterColor(int color) { context.setWaterColor(color); return this; } @Override - @NotNull public EffectsProperties.Mutable setWaterFogColor(int color) { context.setWaterFogColor(color); return this; } @Override - @NotNull public EffectsProperties.Mutable setSkyColor(int color) { context.setSkyColor(color); return this; } @Override - @NotNull public EffectsProperties.Mutable setFoliageColorOverride(@Nullable Integer colorOverride) { context.setFoliageColor(Optional.ofNullable(colorOverride)); return this; } @Override - @NotNull public EffectsProperties.Mutable setGrassColorOverride(@Nullable Integer colorOverride) { context.setGrassColor(Optional.ofNullable(colorOverride)); return this; } @Override - @NotNull - public EffectsProperties.Mutable setGrassColorModifier(@NotNull GrassColorModifier modifier) { + public EffectsProperties.Mutable setGrassColorModifier(GrassColorModifier modifier) { context.setGrassColorModifier(modifier); return this; } @Override - @NotNull public EffectsProperties.Mutable setAmbientParticle(@Nullable AmbientParticleSettings settings) { context.setParticleConfig(Optional.ofNullable(settings)); return this; } @Override - @NotNull public EffectsProperties.Mutable setAmbientLoopSound(@Nullable SoundEvent sound) { context.setAmbientSound(Optional.ofNullable(sound)); return this; } @Override - @NotNull public EffectsProperties.Mutable setAmbientMoodSound(@Nullable AmbientMoodSettings settings) { context.setMoodSound(Optional.ofNullable(settings)); return this; } @Override - @NotNull public EffectsProperties.Mutable setAmbientAdditionsSound(@Nullable AmbientAdditionsSettings settings) { context.setAdditionsSound(Optional.ofNullable(settings)); return this; } @Override - @NotNull public EffectsProperties.Mutable setBackgroundMusic(@Nullable Music music) { context.setMusic(Optional.ofNullable(music)); return this; diff --git a/fabric/src/main/java/dev/architectury/registry/level/entity/fabric/EntityAttributeRegistryImpl.java b/fabric/src/main/java/dev/architectury/registry/level/entity/fabric/EntityAttributeRegistryImpl.java index d0ae0d65..ba28981c 100644 --- a/fabric/src/main/java/dev/architectury/registry/level/entity/fabric/EntityAttributeRegistryImpl.java +++ b/fabric/src/main/java/dev/architectury/registry/level/entity/fabric/EntityAttributeRegistryImpl.java @@ -27,7 +27,7 @@ import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import java.util.function.Supplier; public class EntityAttributeRegistryImpl { - public static void register(Supplier> type, Supplier attribute) { + public static void register(Supplier> type, Supplier attribute) { FabricDefaultAttributeRegistry.register(type.get(), attribute.get()); } } diff --git a/fabric/src/main/java/dev/architectury/registry/level/fabric/GameRuleFactoryImpl.java b/fabric/src/main/java/dev/architectury/registry/level/fabric/GameRuleFactoryImpl.java deleted file mode 100644 index b9cf70ac..00000000 --- a/fabric/src/main/java/dev/architectury/registry/level/fabric/GameRuleFactoryImpl.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * This file is part of architectury. - * Copyright (C) 2020, 2021, 2022 architectury - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package dev.architectury.registry.level.fabric; - -import net.fabricmc.fabric.api.gamerule.v1.GameRuleFactory; -import net.minecraft.server.MinecraftServer; -import net.minecraft.world.level.GameRules; - -import java.util.function.BiConsumer; - -public class GameRuleFactoryImpl { - public static GameRules.Type createBooleanRule(boolean defaultValue) { - return GameRuleFactory.createBooleanRule(defaultValue); - } - - public static GameRules.Type createBooleanRule(boolean defaultValue, BiConsumer changedCallback) { - return GameRuleFactory.createBooleanRule(defaultValue, changedCallback); - } - - public static GameRules.Type createIntRule(int defaultValue) { - return GameRuleFactory.createIntRule(defaultValue); - } - - public static GameRules.Type createIntRule(int defaultValue, BiConsumer changedCallback) { - return GameRuleFactory.createIntRule(defaultValue, changedCallback); - } -} diff --git a/fabric/src/main/java/dev/architectury/registry/level/fabric/GameRuleRegistryImpl.java b/fabric/src/main/java/dev/architectury/registry/level/fabric/GameRuleRegistryImpl.java deleted file mode 100644 index 6d823715..00000000 --- a/fabric/src/main/java/dev/architectury/registry/level/fabric/GameRuleRegistryImpl.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * This file is part of architectury. - * Copyright (C) 2020, 2021, 2022 architectury - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package dev.architectury.registry.level.fabric; - -import net.fabricmc.fabric.api.gamerule.v1.GameRuleRegistry; -import net.minecraft.world.level.GameRules; - -public class GameRuleRegistryImpl { - public static > GameRules.Key register(String name, GameRules.Category category, GameRules.Type type) { - return GameRuleRegistry.register(name, category, type); - } -} diff --git a/fabric/src/main/java/dev/architectury/registry/registries/fabric/RegistriesImpl.java b/fabric/src/main/java/dev/architectury/registry/registries/fabric/RegistriesImpl.java index dca3ebbc..ae7e608f 100644 --- a/fabric/src/main/java/dev/architectury/registry/registries/fabric/RegistriesImpl.java +++ b/fabric/src/main/java/dev/architectury/registry/registries/fabric/RegistriesImpl.java @@ -21,6 +21,8 @@ package dev.architectury.registry.registries.fabric; import com.google.common.base.Objects; import com.google.common.base.Suppliers; +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Multimap; import dev.architectury.registry.registries.Registrar; import dev.architectury.registry.registries.RegistrarBuilder; import dev.architectury.registry.registries.Registries; @@ -29,48 +31,66 @@ import dev.architectury.registry.registries.options.RegistrarOption; import dev.architectury.registry.registries.options.StandardRegistrarOption; import net.fabricmc.fabric.api.event.registry.FabricRegistryBuilder; import net.fabricmc.fabric.api.event.registry.RegistryAttribute; +import net.fabricmc.fabric.api.event.registry.RegistryEntryAddedCallback; import net.minecraft.core.MappedRegistry; import net.minecraft.core.Registry; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; -import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.Iterator; -import java.util.Map; -import java.util.Optional; -import java.util.Set; +import java.util.*; import java.util.function.Consumer; import java.util.function.Supplier; public class RegistriesImpl { + private static final Multimap, Consumer> LISTENERS = HashMultimap.create(); + private static final Set> LISTENED_REGISTRIES = new HashSet<>(); + + private static void listen(ResourceKey resourceKey, ResourceLocation id, Consumer listener) { + if (LISTENED_REGISTRIES.add(resourceKey)) { + RegistryEntryAddedCallback.event(Registry.REGISTRY.get(resourceKey.location())).register((rawId, entryId, object) -> { + RegistryEntryId registryEntryId = new RegistryEntryId<>(resourceKey, entryId); + for (Consumer consumer : LISTENERS.get(registryEntryId)) { + ((Consumer) consumer).accept(object); + } + LISTENERS.removeAll(registryEntryId); + }); + } + + LISTENERS.put(new RegistryEntryId<>(resourceKey, id), listener); + } + public static Registries.RegistryProvider _get(String modId) { - return RegistryProviderImpl.INSTANCE; + return new RegistryProviderImpl(modId); } public static ResourceLocation getId(T object, ResourceKey> fallback) { if (fallback == null) return null; - return RegistryProviderImpl.INSTANCE.get(fallback).getId(object); + return getId(object, (Registry) Registry.REGISTRY.get(fallback.location())); } public static ResourceLocation getId(T object, Registry fallback) { if (fallback == null) return null; - return RegistryProviderImpl.INSTANCE.get(fallback).getId(object); + return fallback.getKey(object); } - public enum RegistryProviderImpl implements Registries.RegistryProvider { - INSTANCE; + public static class RegistryProviderImpl implements Registries.RegistryProvider { + private final String modId; + + public RegistryProviderImpl(String modId) { + this.modId = modId; + } @Override public Registrar get(ResourceKey> key) { - return new RegistrarImpl<>((Registry) Registry.REGISTRY.get(key.location())); + return new RegistrarImpl<>(modId, (Registry) Registry.REGISTRY.get(key.location())); } @Override public Registrar get(Registry registry) { - return new RegistrarImpl<>(registry); + return new RegistrarImpl<>(modId, registry); } @Override @@ -79,27 +99,50 @@ public class RegistriesImpl { } @Override - @NotNull public RegistrarBuilder builder(Class type, ResourceLocation registryId) { - return new RegistrarBuilderWrapper<>(FabricRegistryBuilder.createSimple(type, registryId)); + return new RegistrarBuilderWrapper<>(modId, FabricRegistryBuilder.createSimple(type, registryId)); + } + } + + public static class RegistryEntryId { + private final ResourceKey registryKey; + private final ResourceLocation id; + + public RegistryEntryId(ResourceKey registryKey, ResourceLocation id) { + this.registryKey = registryKey; + this.id = id; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof RegistryEntryId)) return false; + RegistryEntryId that = (RegistryEntryId) o; + return java.util.Objects.equals(registryKey, that.registryKey) && java.util.Objects.equals(id, that.id); + } + + @Override + public int hashCode() { + return java.util.Objects.hash(registryKey, id); } } public static class RegistrarBuilderWrapper implements RegistrarBuilder { - @NotNull + private final String modId; private FabricRegistryBuilder> builder; - public RegistrarBuilderWrapper(@NotNull FabricRegistryBuilder> builder) { + public RegistrarBuilderWrapper(String modId, FabricRegistryBuilder> builder) { + this.modId = modId; this.builder = builder; } @Override - public @NotNull Registrar build() { - return RegistryProviderImpl.INSTANCE.get(builder.buildAndRegister()); + public Registrar build() { + return Registries.get(modId).get(builder.buildAndRegister()); } @Override - public @NotNull RegistrarBuilder option(@NotNull RegistrarOption option) { + public RegistrarBuilder option(RegistrarOption option) { if (option == StandardRegistrarOption.SAVE_TO_DISC) { this.builder.attribute(RegistryAttribute.PERSISTED); } else if (option == StandardRegistrarOption.SYNC_TO_CLIENTS) { @@ -110,23 +153,36 @@ public class RegistriesImpl { } public static class RegistrarImpl implements Registrar { + private final String modId; private Registry delegate; - public RegistrarImpl(Registry delegate) { + public RegistrarImpl(String modId, Registry delegate) { + this.modId = modId; this.delegate = delegate; } @Override - public @NotNull RegistrySupplier delegate(ResourceLocation id) { + public RegistrySupplier delegate(ResourceLocation id) { Supplier value = Suppliers.memoize(() -> get(id)); + RegistrarImpl registrar = this; return new RegistrySupplier<>() { @Override - public @NotNull ResourceLocation getRegistryId() { + public Registries getRegistries() { + return Registries.get(modId); + } + + @Override + public Registrar getRegistrar() { + return registrar; + } + + @Override + public ResourceLocation getRegistryId() { return delegate.key().location(); } @Override - public @NotNull ResourceLocation getId() { + public ResourceLocation getId() { return id; } @@ -160,7 +216,7 @@ public class RegistriesImpl { } @Override - public @NotNull RegistrySupplier register(ResourceLocation id, Supplier supplier) { + public RegistrySupplier register(ResourceLocation id, Supplier supplier) { Registry.register(delegate, id, supplier.get()); return (RegistrySupplier) delegate(id); } @@ -215,10 +271,19 @@ public class RegistriesImpl { return delegate.key(); } - @NotNull @Override public Iterator iterator() { return delegate.iterator(); } + + @Override + public void listen(ResourceLocation id, Consumer callback) { + T value = get(id); + if (value != null) { + callback.accept(value); + } else { + RegistriesImpl.listen(key(), id, callback); + } + } } } diff --git a/fabric/src/main/resources/architectury.accessWidener b/fabric/src/main/resources/architectury.accessWidener deleted file mode 100644 index ee786694..00000000 --- a/fabric/src/main/resources/architectury.accessWidener +++ /dev/null @@ -1,110 +0,0 @@ -accessWidener v2 named -accessible method net/minecraft/client/gui/screens/Screen addRenderableWidget (Lnet/minecraft/client/gui/components/events/GuiEventListener;)Lnet/minecraft/client/gui/components/events/GuiEventListener; -accessible method net/minecraft/client/gui/screens/Screen addRenderableOnly (Lnet/minecraft/client/gui/components/Widget;)Lnet/minecraft/client/gui/components/Widget; -accessible method net/minecraft/client/gui/screens/Screen addWidget (Lnet/minecraft/client/gui/components/events/GuiEventListener;)Lnet/minecraft/client/gui/components/events/GuiEventListener; -accessible field net/minecraft/client/gui/screens/Screen narratables Ljava/util/List; -accessible field net/minecraft/client/gui/screens/Screen renderables Ljava/util/List; -accessible field net/minecraft/world/level/block/state/BlockBehaviour properties Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties; -accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties material Lnet/minecraft/world/level/material/Material; -mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties material Lnet/minecraft/world/level/material/Material; -accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties materialColor Ljava/util/function/Function; -mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties materialColor Ljava/util/function/Function; -accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties hasCollision Z -mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties hasCollision Z -accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties soundType Lnet/minecraft/world/level/block/SoundType; -mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties soundType Lnet/minecraft/world/level/block/SoundType; -accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties lightEmission Ljava/util/function/ToIntFunction; -mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties lightEmission Ljava/util/function/ToIntFunction; -accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties explosionResistance F -mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties explosionResistance F -accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties destroyTime F -mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties destroyTime F -accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties requiresCorrectToolForDrops Z -mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties requiresCorrectToolForDrops Z -accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties isRandomlyTicking Z -mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties isRandomlyTicking Z -accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties friction F -mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties friction F -accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties speedFactor F -mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties speedFactor F -accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties jumpFactor F -mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties jumpFactor F -accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties drops Lnet/minecraft/resources/ResourceLocation; -mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties drops Lnet/minecraft/resources/ResourceLocation; -accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties canOcclude Z -mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties canOcclude Z -accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties isAir Z -mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties isAir Z -accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties isValidSpawn Lnet/minecraft/world/level/block/state/BlockBehaviour$StateArgumentPredicate; -mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties isValidSpawn Lnet/minecraft/world/level/block/state/BlockBehaviour$StateArgumentPredicate; -accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties isRedstoneConductor Lnet/minecraft/world/level/block/state/BlockBehaviour$StatePredicate; -mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties isRedstoneConductor Lnet/minecraft/world/level/block/state/BlockBehaviour$StatePredicate; -accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties isSuffocating Lnet/minecraft/world/level/block/state/BlockBehaviour$StatePredicate; -mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties isSuffocating Lnet/minecraft/world/level/block/state/BlockBehaviour$StatePredicate; -accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties isViewBlocking Lnet/minecraft/world/level/block/state/BlockBehaviour$StatePredicate; -mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties isViewBlocking Lnet/minecraft/world/level/block/state/BlockBehaviour$StatePredicate; -accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties hasPostProcess Lnet/minecraft/world/level/block/state/BlockBehaviour$StatePredicate; -mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties hasPostProcess Lnet/minecraft/world/level/block/state/BlockBehaviour$StatePredicate; -accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties emissiveRendering Lnet/minecraft/world/level/block/state/BlockBehaviour$StatePredicate; -mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties emissiveRendering Lnet/minecraft/world/level/block/state/BlockBehaviour$StatePredicate; -accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties dynamicShape Z -mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties dynamicShape Z -accessible method net/minecraft/world/entity/Entity getEncodeId ()Ljava/lang/String; -accessible field net/minecraft/server/packs/repository/PackRepository sources Ljava/util/Set; -mutable field net/minecraft/server/packs/repository/PackRepository sources Ljava/util/Set; -accessible method net/minecraft/world/entity/player/Player closeContainer ()V -accessible method net/minecraft/advancements/CriteriaTriggers register (Lnet/minecraft/advancements/CriterionTrigger;)Lnet/minecraft/advancements/CriterionTrigger; -accessible method net/minecraft/world/inventory/MenuType (Lnet/minecraft/world/inventory/MenuType$MenuSupplier;)V -accessible class net/minecraft/world/inventory/MenuType$MenuSupplier -accessible method net/minecraft/world/level/block/state/BlockBehaviour$Properties (Lnet/minecraft/world/level/material/Material;Ljava/util/function/Function;)V -accessible field net/minecraft/world/level/biome/Biome climateSettings Lnet/minecraft/world/level/biome/Biome$ClimateSettings; -accessible field net/minecraft/world/level/biome/Biome biomeCategory Lnet/minecraft/world/level/biome/Biome$BiomeCategory; -mutable field net/minecraft/world/level/biome/Biome biomeCategory Lnet/minecraft/world/level/biome/Biome$BiomeCategory; -accessible field net/minecraft/world/level/biome/Biome$ClimateSettings precipitation Lnet/minecraft/world/level/biome/Biome$Precipitation; -mutable field net/minecraft/world/level/biome/Biome$ClimateSettings precipitation Lnet/minecraft/world/level/biome/Biome$Precipitation; -accessible field net/minecraft/world/level/biome/Biome$ClimateSettings temperature F -mutable field net/minecraft/world/level/biome/Biome$ClimateSettings temperature F -accessible field net/minecraft/world/level/biome/Biome$ClimateSettings temperatureModifier Lnet/minecraft/world/level/biome/Biome$TemperatureModifier; -mutable field net/minecraft/world/level/biome/Biome$ClimateSettings temperatureModifier Lnet/minecraft/world/level/biome/Biome$TemperatureModifier; -accessible field net/minecraft/world/level/biome/Biome$ClimateSettings downfall F -mutable field net/minecraft/world/level/biome/Biome$ClimateSettings downfall F -accessible field net/minecraft/world/level/biome/BiomeSpecialEffects fogColor I -mutable field net/minecraft/world/level/biome/BiomeSpecialEffects fogColor I -accessible field net/minecraft/world/level/biome/BiomeSpecialEffects waterColor I -mutable field net/minecraft/world/level/biome/BiomeSpecialEffects waterColor I -accessible field net/minecraft/world/level/biome/BiomeSpecialEffects waterFogColor I -mutable field net/minecraft/world/level/biome/BiomeSpecialEffects waterFogColor I -accessible field net/minecraft/world/level/biome/BiomeSpecialEffects skyColor I -mutable field net/minecraft/world/level/biome/BiomeSpecialEffects skyColor I -accessible field net/minecraft/world/level/biome/BiomeSpecialEffects foliageColorOverride Ljava/util/Optional; -mutable field net/minecraft/world/level/biome/BiomeSpecialEffects foliageColorOverride Ljava/util/Optional; -accessible field net/minecraft/world/level/biome/BiomeSpecialEffects grassColorOverride Ljava/util/Optional; -mutable field net/minecraft/world/level/biome/BiomeSpecialEffects grassColorOverride Ljava/util/Optional; -accessible field net/minecraft/world/level/biome/BiomeSpecialEffects grassColorModifier Lnet/minecraft/world/level/biome/BiomeSpecialEffects$GrassColorModifier; -mutable field net/minecraft/world/level/biome/BiomeSpecialEffects grassColorModifier Lnet/minecraft/world/level/biome/BiomeSpecialEffects$GrassColorModifier; -accessible field net/minecraft/world/level/biome/BiomeSpecialEffects ambientParticleSettings Ljava/util/Optional; -mutable field net/minecraft/world/level/biome/BiomeSpecialEffects ambientParticleSettings Ljava/util/Optional; -accessible field net/minecraft/world/level/biome/BiomeSpecialEffects ambientLoopSoundEvent Ljava/util/Optional; -mutable field net/minecraft/world/level/biome/BiomeSpecialEffects ambientLoopSoundEvent Ljava/util/Optional; -accessible field net/minecraft/world/level/biome/BiomeSpecialEffects ambientMoodSettings Ljava/util/Optional; -mutable field net/minecraft/world/level/biome/BiomeSpecialEffects ambientMoodSettings Ljava/util/Optional; -accessible field net/minecraft/world/level/biome/BiomeSpecialEffects ambientAdditionsSettings Ljava/util/Optional; -mutable field net/minecraft/world/level/biome/BiomeSpecialEffects ambientAdditionsSettings Ljava/util/Optional; -accessible field net/minecraft/world/level/biome/BiomeSpecialEffects backgroundMusic Ljava/util/Optional; -mutable field net/minecraft/world/level/biome/BiomeSpecialEffects backgroundMusic Ljava/util/Optional; -accessible method net/minecraft/world/level/storage/LevelResource (Ljava/lang/String;)V -accessible class net/minecraft/world/level/block/entity/BlockEntityType$BlockEntitySupplier -accessible field net/minecraft/world/item/AxeItem STRIPPABLES Ljava/util/Map; -mutable field net/minecraft/world/item/AxeItem STRIPPABLES Ljava/util/Map; -accessible field net/minecraft/world/item/ShovelItem FLATTENABLES Ljava/util/Map; -mutable field net/minecraft/world/item/ShovelItem FLATTENABLES Ljava/util/Map; -accessible field net/minecraft/world/item/HoeItem TILLABLES Ljava/util/Map; -mutable field net/minecraft/world/item/HoeItem TILLABLES Ljava/util/Map; -accessible method net/minecraft/client/renderer/item/ItemProperties registerGeneric (Lnet/minecraft/resources/ResourceLocation;Lnet/minecraft/client/renderer/item/ClampedItemPropertyFunction;)Lnet/minecraft/client/renderer/item/ClampedItemPropertyFunction; -accessible method net/minecraft/client/renderer/item/ItemProperties register (Lnet/minecraft/world/item/Item;Lnet/minecraft/resources/ResourceLocation;Lnet/minecraft/client/renderer/item/ClampedItemPropertyFunction;)V -accessible field net/minecraft/world/level/Explosion source Lnet/minecraft/world/entity/Entity; -mutable field net/minecraft/world/level/Explosion source Lnet/minecraft/world/entity/Entity; -accessible field net/minecraft/world/level/Explosion radius F -mutable field net/minecraft/world/level/Explosion radius F -accessible method net/minecraft/client/renderer/RenderType create (Ljava/lang/String;Lcom/mojang/blaze3d/vertex/VertexFormat;Lcom/mojang/blaze3d/vertex/VertexFormat$Mode;IZZLnet/minecraft/client/renderer/RenderType$CompositeState;)Lnet/minecraft/client/renderer/RenderType$CompositeRenderType; -accessible class net/minecraft/client/renderer/RenderType$CompositeState diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index fb8e81bf..f5e0a9e3 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -32,7 +32,6 @@ "dev.architectury.compat.fabric.ModMenuCompatibility" ] }, - "accessWidener": "architectury.accessWidener", "icon": "icon.png", "depends": { "minecraft": "~1.18-", diff --git a/forge/build.gradle b/forge/build.gradle index 78c5dbc3..bb7005a6 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -4,9 +4,14 @@ plugins { } loom { + accessWidenerPath = project(":common").loom.accessWidenerPath + forge { mixinConfig "architectury.mixins.json" mixinConfig "architectury-common.mixins.json" + + convertAccessWideners = true + extraAccessWideners.add loom.accessWidenerPath.get().asFile.name } } diff --git a/forge/src/main/java/dev/architectury/hooks/fluid/forge/FluidStackHooksImpl.java b/forge/src/main/java/dev/architectury/hooks/fluid/forge/FluidStackHooksImpl.java index 8ce0863f..d862ed57 100644 --- a/forge/src/main/java/dev/architectury/hooks/fluid/forge/FluidStackHooksImpl.java +++ b/forge/src/main/java/dev/architectury/hooks/fluid/forge/FluidStackHooksImpl.java @@ -34,7 +34,6 @@ import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.Fluids; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class FluidStackHooksImpl { @@ -68,7 +67,7 @@ public class FluidStackHooksImpl { @OnlyIn(Dist.CLIENT) @Nullable - public static TextureAtlasSprite getStillTexture(@Nullable BlockAndTintGetter level, @Nullable BlockPos pos, @NotNull FluidState state) { + public static TextureAtlasSprite getStillTexture(@Nullable BlockAndTintGetter level, @Nullable BlockPos pos, FluidState state) { if (state.getType() == Fluids.EMPTY) return null; ResourceLocation texture = state.getType().getAttributes().getStillTexture(level, pos); return Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(texture); @@ -76,7 +75,7 @@ public class FluidStackHooksImpl { @OnlyIn(Dist.CLIENT) @Nullable - public static TextureAtlasSprite getStillTexture(@NotNull FluidStack stack) { + public static TextureAtlasSprite getStillTexture(FluidStack stack) { if (stack.getFluid() == Fluids.EMPTY) return null; ResourceLocation texture = stack.getFluid().getAttributes().getStillTexture(FluidStackHooksForge.toForge(stack)); return Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(texture); @@ -84,7 +83,7 @@ public class FluidStackHooksImpl { @OnlyIn(Dist.CLIENT) @Nullable - public static TextureAtlasSprite getStillTexture(@NotNull Fluid fluid) { + public static TextureAtlasSprite getStillTexture(Fluid fluid) { if (fluid == Fluids.EMPTY) return null; ResourceLocation texture = fluid.getAttributes().getStillTexture(); return Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(texture); @@ -92,7 +91,7 @@ public class FluidStackHooksImpl { @OnlyIn(Dist.CLIENT) @Nullable - public static TextureAtlasSprite getFlowingTexture(@Nullable BlockAndTintGetter level, @Nullable BlockPos pos, @NotNull FluidState state) { + public static TextureAtlasSprite getFlowingTexture(@Nullable BlockAndTintGetter level, @Nullable BlockPos pos, FluidState state) { if (state.getType() == Fluids.EMPTY) return null; ResourceLocation texture = state.getType().getAttributes().getFlowingTexture(level, pos); return Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(texture); @@ -100,7 +99,7 @@ public class FluidStackHooksImpl { @OnlyIn(Dist.CLIENT) @Nullable - public static TextureAtlasSprite getFlowingTexture(@NotNull FluidStack stack) { + public static TextureAtlasSprite getFlowingTexture(FluidStack stack) { if (stack.getFluid() == Fluids.EMPTY) return null; ResourceLocation texture = stack.getFluid().getAttributes().getFlowingTexture(FluidStackHooksForge.toForge(stack)); return Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(texture); @@ -108,26 +107,26 @@ public class FluidStackHooksImpl { @OnlyIn(Dist.CLIENT) @Nullable - public static TextureAtlasSprite getFlowingTexture(@NotNull Fluid fluid) { + public static TextureAtlasSprite getFlowingTexture(Fluid fluid) { if (fluid == Fluids.EMPTY) return null; ResourceLocation texture = fluid.getAttributes().getFlowingTexture(); return Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(texture); } @OnlyIn(Dist.CLIENT) - public static int getColor(@Nullable BlockAndTintGetter level, @Nullable BlockPos pos, @NotNull FluidState state) { + public static int getColor(@Nullable BlockAndTintGetter level, @Nullable BlockPos pos, FluidState state) { if (state.getType() == Fluids.EMPTY) return -1; return state.getType().getAttributes().getColor(level, pos); } @OnlyIn(Dist.CLIENT) - public static int getColor(@NotNull FluidStack stack) { + public static int getColor(FluidStack stack) { if (stack.getFluid() == Fluids.EMPTY) return -1; return stack.getFluid().getAttributes().getColor(FluidStackHooksForge.toForge(stack)); } @OnlyIn(Dist.CLIENT) - public static int getColor(@NotNull Fluid fluid) { + public static int getColor(Fluid fluid) { if (fluid == Fluids.EMPTY) return -1; return fluid.getAttributes().getColor(); } diff --git a/forge/src/main/java/dev/architectury/platform/forge/PlatformImpl.java b/forge/src/main/java/dev/architectury/platform/forge/PlatformImpl.java index a281e39f..19a9ece3 100644 --- a/forge/src/main/java/dev/architectury/platform/forge/PlatformImpl.java +++ b/forge/src/main/java/dev/architectury/platform/forge/PlatformImpl.java @@ -31,7 +31,6 @@ import net.minecraftforge.fml.loading.FMLPaths; import net.minecraftforge.fml.loading.moddiscovery.ModFileInfo; import net.minecraftforge.forgespi.language.IModFileInfo; import net.minecraftforge.forgespi.language.IModInfo; -import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.annotation.Nonnull; @@ -124,17 +123,17 @@ public class PlatformImpl { } @Override - public @NotNull Optional getLogoFile(int i) { + public Optional getLogoFile(int i) { return this.info.getLogoFile(); } @Override - public @NotNull Path getFilePath() { + public Path getFilePath() { return this.info.getOwningFile().getFile().getFilePath(); } @Override - public @NotNull Collection getAuthors() { + public Collection getAuthors() { Optional optional = this.info.getConfig().getConfigElement("authors") .map(String::valueOf); return optional.isPresent() ? Collections.singleton(optional.get()) : Collections.emptyList(); @@ -146,18 +145,18 @@ public class PlatformImpl { } @Override - public @NotNull Optional getHomepage() { + public Optional getHomepage() { return this.info.getConfig().getConfigElement("displayURL") .map(String::valueOf); } @Override - public @NotNull Optional getSources() { + public Optional getSources() { return Optional.empty(); } @Override - public @NotNull Optional getIssueTracker() { + public Optional getIssueTracker() { IModFileInfo owningFile = this.info.getOwningFile(); if (owningFile instanceof ModFileInfo info) { return Optional.ofNullable(info.getIssueURL()) diff --git a/forge/src/main/java/dev/architectury/registry/block/forge/BlockPropertiesImpl.java b/forge/src/main/java/dev/architectury/registry/block/forge/BlockPropertiesImpl.java index cf5fa146..552cc3cf 100644 --- a/forge/src/main/java/dev/architectury/registry/block/forge/BlockPropertiesImpl.java +++ b/forge/src/main/java/dev/architectury/registry/block/forge/BlockPropertiesImpl.java @@ -24,9 +24,12 @@ import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.Material; import net.minecraft.world.level.material.MaterialColor; +import org.jetbrains.annotations.ApiStatus; import java.util.function.Function; +@Deprecated +@ApiStatus.ScheduledForRemoval public class BlockPropertiesImpl { public static BlockProperties of(Material material, MaterialColor materialColor) { return new Impl(material, (state) -> materialColor); diff --git a/forge/src/main/java/dev/architectury/registry/level/advancement/forge/CriteriaTriggersRegistryImpl.java b/forge/src/main/java/dev/architectury/registry/level/advancement/forge/CriteriaTriggersRegistryImpl.java deleted file mode 100644 index ea0cbc68..00000000 --- a/forge/src/main/java/dev/architectury/registry/level/advancement/forge/CriteriaTriggersRegistryImpl.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * This file is part of architectury. - * Copyright (C) 2020, 2021, 2022 architectury - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package dev.architectury.registry.level.advancement.forge; - -import net.minecraft.advancements.CriteriaTriggers; -import net.minecraft.advancements.CriterionTrigger; - -public class CriteriaTriggersRegistryImpl { - public static > T register(T trigger) { - return CriteriaTriggers.register(trigger); - } -} diff --git a/forge/src/main/java/dev/architectury/registry/level/biome/forge/BiomeModificationsImpl.java b/forge/src/main/java/dev/architectury/registry/level/biome/forge/BiomeModificationsImpl.java index eecb1533..498931a9 100644 --- a/forge/src/main/java/dev/architectury/registry/level/biome/forge/BiomeModificationsImpl.java +++ b/forge/src/main/java/dev/architectury/registry/level/biome/forge/BiomeModificationsImpl.java @@ -40,7 +40,6 @@ import net.minecraftforge.eventbus.api.EventPriority; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import org.apache.commons.lang3.tuple.Pair; -import org.jetbrains.annotations.NotNull; import java.util.List; import java.util.Map; @@ -76,13 +75,11 @@ public class BiomeModificationsImpl { BiomeProperties properties = new BiomeWrapped(event); @Override - @NotNull public ResourceLocation getKey() { return event.getName(); } @Override - @NotNull public BiomeProperties getProperties() { return properties; } @@ -113,32 +110,28 @@ public class BiomeModificationsImpl { this.spawnProperties = spawnProperties; } - @NotNull @Override public ClimateProperties getClimateProperties() { return climateProperties; } - @NotNull @Override public EffectsProperties getEffectsProperties() { return effectsProperties; } - @NotNull @Override public GenerationProperties getGenerationProperties() { return generationProperties; } - @NotNull @Override public SpawnProperties getSpawnProperties() { return spawnProperties; } @Override - public Biome.@NotNull BiomeCategory getCategory() { + public Biome.BiomeCategory getCategory() { return event.getCategory(); } } @@ -179,12 +172,12 @@ public class BiomeModificationsImpl { } @Override - public @NotNull Map> getSpawners() { + public Map> getSpawners() { return builder.spawners; } @Override - public @NotNull Map, MobSpawnSettings.MobSpawnCost> getMobSpawnCosts() { + public Map, MobSpawnSettings.MobSpawnCost> getMobSpawnCosts() { return builder.mobSpawnCosts; } } @@ -200,27 +193,27 @@ public class BiomeModificationsImpl { } @Override - public @NotNull ClimateProperties.Mutable getClimateProperties() { + public ClimateProperties.Mutable getClimateProperties() { return (ClimateProperties.Mutable) super.getClimateProperties(); } @Override - public @NotNull EffectsProperties.Mutable getEffectsProperties() { + public EffectsProperties.Mutable getEffectsProperties() { return (EffectsProperties.Mutable) super.getEffectsProperties(); } @Override - public @NotNull GenerationProperties.Mutable getGenerationProperties() { + public GenerationProperties.Mutable getGenerationProperties() { return (GenerationProperties.Mutable) super.getGenerationProperties(); } @Override - public @NotNull SpawnProperties.Mutable getSpawnProperties() { + public SpawnProperties.Mutable getSpawnProperties() { return (SpawnProperties.Mutable) super.getSpawnProperties(); } @Override - public @NotNull Mutable setCategory(Biome.@NotNull BiomeCategory category) { + public Mutable setCategory(Biome.BiomeCategory category) { event.setCategory(category); return this; } @@ -248,7 +241,6 @@ public class BiomeModificationsImpl { this.downfall = downfall; } - @NotNull @Override public Biome.Precipitation getPrecipitation() { return precipitation; @@ -259,7 +251,6 @@ public class BiomeModificationsImpl { return temperature; } - @NotNull @Override public Biome.TemperatureModifier getTemperatureModifier() { return temperatureModifier; @@ -271,28 +262,28 @@ public class BiomeModificationsImpl { } @Override - public @NotNull Mutable setPrecipitation(Biome.@NotNull Precipitation precipitation) { + public Mutable setPrecipitation(Biome.Precipitation precipitation) { this.precipitation = precipitation; this.dirty = true; return this; } @Override - public @NotNull Mutable setTemperature(float temperature) { + public Mutable setTemperature(float temperature) { this.temperature = temperature; this.dirty = true; return this; } @Override - public @NotNull Mutable setTemperatureModifier(Biome.@NotNull TemperatureModifier temperatureModifier) { + public Mutable setTemperatureModifier(Biome.TemperatureModifier temperatureModifier) { this.temperatureModifier = temperatureModifier; this.dirty = true; return this; } @Override - public @NotNull Mutable setDownfall(float downfall) { + public Mutable setDownfall(float downfall) { this.downfall = downfall; this.dirty = true; return this; @@ -336,7 +327,7 @@ public class BiomeModificationsImpl { } @Override - public @NotNull Mutable setCreatureProbability(float probability) { + public Mutable setCreatureProbability(float probability) { builder.creatureGenerationProbability(probability); return this; } diff --git a/forge/src/main/java/dev/architectury/registry/level/entity/forge/EntityAttributeRegistryImpl.java b/forge/src/main/java/dev/architectury/registry/level/entity/forge/EntityAttributeRegistryImpl.java index 24de3936..cad28083 100644 --- a/forge/src/main/java/dev/architectury/registry/level/entity/forge/EntityAttributeRegistryImpl.java +++ b/forge/src/main/java/dev/architectury/registry/level/entity/forge/EntityAttributeRegistryImpl.java @@ -32,9 +32,9 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.function.Supplier; public class EntityAttributeRegistryImpl { - private static final Map>, Supplier> ATTRIBUTES = new ConcurrentHashMap<>(); + private static final Map>, Supplier> ATTRIBUTES = new ConcurrentHashMap<>(); - public static void register(Supplier> type, Supplier attribute) { + public static void register(Supplier> type, Supplier attribute) { ATTRIBUTES.put(type, attribute); } @@ -46,7 +46,7 @@ public class EntityAttributeRegistryImpl { @SubscribeEvent public static void event(EntityAttributeCreationEvent event) { - for (Map.Entry>, Supplier> entry : ATTRIBUTES.entrySet()) { + for (Map.Entry>, Supplier> entry : ATTRIBUTES.entrySet()) { event.put(entry.getKey().get(), entry.getValue().get().build()); } } diff --git a/forge/src/main/java/dev/architectury/registry/level/forge/GameRuleFactoryImpl.java b/forge/src/main/java/dev/architectury/registry/level/forge/GameRuleFactoryImpl.java deleted file mode 100644 index 7445e1cc..00000000 --- a/forge/src/main/java/dev/architectury/registry/level/forge/GameRuleFactoryImpl.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * This file is part of architectury. - * Copyright (C) 2020, 2021, 2022 architectury - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package dev.architectury.registry.level.forge; - -import net.minecraft.server.MinecraftServer; -import net.minecraft.world.level.GameRules; - -import java.util.function.BiConsumer; - -public class GameRuleFactoryImpl { - private GameRuleFactoryImpl() { - } - - public static GameRules.Type createBooleanRule(boolean defaultValue) { - return GameRules.BooleanValue.create(defaultValue); - } - - public static GameRules.Type createBooleanRule(boolean defaultValue, BiConsumer changedCallback) { - return GameRules.BooleanValue.create(defaultValue, changedCallback); - } - - public static GameRules.Type createIntRule(int defaultValue) { - return GameRules.IntegerValue.create(defaultValue); - } - - public static GameRules.Type createIntRule(int defaultValue, BiConsumer changedCallback) { - return GameRules.IntegerValue.create(defaultValue, changedCallback); - } -} diff --git a/forge/src/main/java/dev/architectury/registry/level/forge/GameRuleRegistryImpl.java b/forge/src/main/java/dev/architectury/registry/level/forge/GameRuleRegistryImpl.java deleted file mode 100644 index 1af79cd7..00000000 --- a/forge/src/main/java/dev/architectury/registry/level/forge/GameRuleRegistryImpl.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * This file is part of architectury. - * Copyright (C) 2020, 2021, 2022 architectury - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package dev.architectury.registry.level.forge; - -import net.minecraft.world.level.GameRules; - -public class GameRuleRegistryImpl { - public static > GameRules.Key register(String name, GameRules.Category category, GameRules.Type type) { - return GameRules.register(name, category, type); - } -} diff --git a/forge/src/main/java/dev/architectury/registry/registries/forge/RegistriesImpl.java b/forge/src/main/java/dev/architectury/registry/registries/forge/RegistriesImpl.java index 68c8a9bb..5be19f36 100644 --- a/forge/src/main/java/dev/architectury/registry/registries/forge/RegistriesImpl.java +++ b/forge/src/main/java/dev/architectury/registry/registries/forge/RegistriesImpl.java @@ -33,19 +33,29 @@ import dev.architectury.registry.registries.options.StandardRegistrarOption; import net.minecraft.core.Registry; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.block.Block; +import net.minecraftforge.common.world.ForgeWorldPreset; import net.minecraftforge.event.RegistryEvent; +import net.minecraftforge.eventbus.api.EventPriority; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.registries.*; -import org.jetbrains.annotations.NotNull; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import javax.annotation.Nullable; -import java.lang.reflect.Type; import java.util.*; import java.util.function.Consumer; import java.util.function.Supplier; public class RegistriesImpl { + private static final Logger LOGGER = LogManager.getLogger(RegistriesImpl.class); + private static final Multimap, Consumer> LISTENERS = HashMultimap.create(); + + private static void listen(ResourceKey resourceKey, ResourceLocation id, Consumer listener, boolean vanilla) { + LISTENERS.put(new RegistryEntryId<>(resourceKey, id), listener); + } + public static Registries.RegistryProvider _get(String modId) { return new RegistryProviderImpl(modId); } @@ -65,21 +75,68 @@ public class RegistriesImpl { public static class Data { private boolean collected = false; private final Map, Supplier>> objects = new LinkedHashMap<>(); + private final Map> vanillaObjects = new LinkedHashMap<>(); public void register(IForgeRegistry registry, RegistryObject object, Supplier> reference) { if (!collected) { objects.put(object, reference); } else { - registry.register(reference.get()); + ResourceKey> resourceKey = ResourceKey.createRegistryKey(registry.getRegistryName()); + IForgeRegistryEntry value = reference.get(); + registry.register(value); object.updateReference(registry); + + RegistryEntryId registryEntryId = new RegistryEntryId<>(resourceKey, object.getId()); + for (Consumer consumer : LISTENERS.get(registryEntryId)) { + ((Consumer) consumer).accept(value); + } + LISTENERS.removeAll(registryEntryId); } } + + public void register(Registry registry, ResourceLocation id, Supplier reference) { + if (!collected) { + vanillaObjects.put(id, reference); + } else { + T value = reference.get(); + Registry.register(registry, id, value); + + RegistryEntryId registryEntryId = new RegistryEntryId<>(registry.key(), id); + for (Consumer consumer : LISTENERS.get(registryEntryId)) { + ((Consumer) consumer).accept(value); + } + LISTENERS.removeAll(registryEntryId); + } + } + } + + public static class RegistryEntryId { + private final ResourceKey registryKey; + private final ResourceLocation id; + + public RegistryEntryId(ResourceKey registryKey, ResourceLocation id) { + this.registryKey = registryKey; + this.id = id; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof RegistryEntryId)) return false; + RegistryEntryId that = (RegistryEntryId) o; + return java.util.Objects.equals(registryKey, that.registryKey) && java.util.Objects.equals(id, that.id); + } + + @Override + public int hashCode() { + return java.util.Objects.hash(registryKey, id); + } } public static class RegistryProviderImpl implements Registries.RegistryProvider { private final String modId; private final Supplier eventBus; - private final Map registry = new HashMap<>(); + private final Map>, Data> registry = new HashMap<>(); private final Multimap>, Consumer>> listeners = HashMultimap.create(); public RegistryProviderImpl(String modId) { @@ -101,18 +158,27 @@ public class RegistriesImpl { @Override public Registrar get(ResourceKey> registryKey) { updateEventBus(); - return get(RegistryManager.ACTIVE.getRegistry(registryKey.location())); + ForgeRegistry registry = RegistryManager.ACTIVE.getRegistry(registryKey.location()); + if (registry == null) { + Registry ts = (Registry) Registry.REGISTRY.get(registryKey.location()); + if (ts == null) { + throw new IllegalArgumentException("Registry " + registryKey + " does not exist!"); + } else { + return get(ts); + } + } + return get(registry); } public Registrar get(IForgeRegistry registry) { updateEventBus(); - return new ForgeBackedRegistryImpl<>(this.registry, registry); + return new ForgeBackedRegistryImpl<>(modId, this.registry, registry); } @Override public Registrar get(net.minecraft.core.Registry registry) { updateEventBus(); - return new VanillaBackedRegistryImpl<>(registry); + return new VanillaBackedRegistryImpl<>(modId, this.registry, registry); } @Override @@ -129,20 +195,96 @@ public class RegistriesImpl { } public class EventListener { + public void handleVanillaRegistries() { + for (Registry vanillaRegistry : Registry.REGISTRY) { + if (RegistryManager.ACTIVE.getRegistry(vanillaRegistry.key().location()) == null) { + // Must be vanilla + Registrar archRegistry = get(vanillaRegistry); + + for (Map.Entry>, Data> typeDataEntry : RegistryProviderImpl.this.registry.entrySet()) { + ResourceKey> resourceKey = archRegistry.key(); + if (typeDataEntry.getKey().equals(resourceKey)) { + Data data = typeDataEntry.getValue(); + data.collected = true; + + for (Map.Entry> entry : data.vanillaObjects.entrySet()) { + Object value = entry.getValue().get(); + Registry.register((Registry) vanillaRegistry, entry.getKey(), value); + + RegistryEntryId registryEntryId = new RegistryEntryId<>(resourceKey, entry.getKey()); + for (Consumer consumer : LISTENERS.get(registryEntryId)) { + ((Consumer) consumer).accept(value); + } + LISTENERS.removeAll(registryEntryId); + } + + data.objects.clear(); + } + } + + for (Map.Entry>, Consumer>> entry : listeners.entries()) { + if (entry.getKey().equals(vanillaRegistry.key())) { + entry.getValue().accept(archRegistry); + } + } + } + } + } + + public void handleVanillaRegistriesPost() { + for (Registry vanillaRegistry : Registry.REGISTRY) { + if (RegistryManager.ACTIVE.getRegistry(vanillaRegistry.key().location()) == null) { + // Must be vanilla + Registrar archRegistry = get(vanillaRegistry); + + List> toRemove = new ArrayList<>(); + for (Map.Entry, Collection>> entry : LISTENERS.asMap().entrySet()) { + if (entry.getKey().registryKey.equals(archRegistry.key())) { + if (vanillaRegistry.containsKey(entry.getKey().id)) { + Object value = vanillaRegistry.get(entry.getKey().id); + for (Consumer consumer : entry.getValue()) { + ((Consumer) consumer).accept(value); + } + toRemove.add(entry.getKey()); + } else { + LOGGER.warn("Registry entry listened {} was not realized!", entry.getKey()); + } + } + } + + for (RegistryEntryId entryId : toRemove) { + LISTENERS.removeAll(entryId); + } + } + } + } + @SubscribeEvent public void handleEvent(RegistryEvent.Register event) { + if (event.getGenericType() == Block.class) { + handleVanillaRegistries(); + } + IForgeRegistry registry = event.getRegistry(); Registrar archRegistry = get(registry); - for (Map.Entry typeDataEntry : RegistryProviderImpl.this.registry.entrySet()) { - if (typeDataEntry.getKey() == registry.getRegistrySuperType()) { + for (Map.Entry>, Data> typeDataEntry : RegistryProviderImpl.this.registry.entrySet()) { + ResourceKey> resourceKey = archRegistry.key(); + if (typeDataEntry.getKey().equals(resourceKey)) { Data data = typeDataEntry.getValue(); data.collected = true; for (Map.Entry, Supplier>> entry : data.objects.entrySet()) { - registry.register(entry.getValue().get()); + IForgeRegistryEntry value = entry.getValue().get(); + registry.register(value); entry.getKey().updateReference(registry); + + RegistryEntryId registryEntryId = new RegistryEntryId<>(resourceKey, entry.getKey().getId()); + for (Consumer consumer : LISTENERS.get(registryEntryId)) { + ((Consumer) consumer).accept(value); + } + LISTENERS.removeAll(registryEntryId); } data.objects.clear(); @@ -155,31 +297,57 @@ public class RegistriesImpl { } } } + + @SubscribeEvent(priority = EventPriority.LOWEST) + public void handleEventPost(RegistryEvent.Register event) { + if (event.getGenericType() == ForgeWorldPreset.class) { + handleVanillaRegistriesPost(); + } + + IForgeRegistry registry = event.getRegistry(); + Registrar archRegistry = get(registry); + ResourceKey> resourceKey = archRegistry.key(); + List> toRemove = new ArrayList<>(); + for (Map.Entry, Collection>> entry : LISTENERS.asMap().entrySet()) { + if (entry.getKey().registryKey.equals(resourceKey)) { + if (registry.containsKey(entry.getKey().id)) { + IForgeRegistryEntry value = registry.getValue(entry.getKey().id); + for (Consumer consumer : entry.getValue()) { + ((Consumer) consumer).accept(value); + } + toRemove.add(entry.getKey()); + } else { + LOGGER.warn("Registry entry listened {} was not realized!", entry.getKey()); + } + } + } + for (RegistryEntryId id : toRemove) { + LISTENERS.removeAll(id); + } + } } } public static class RegistryBuilderWrapper implements RegistrarBuilder { - @NotNull private final RegistryProviderImpl provider; - @NotNull private final net.minecraftforge.registries.RegistryBuilder builder; private boolean saveToDisk = false; private boolean syncToClients = false; - public RegistryBuilderWrapper(@NotNull RegistryProviderImpl provider, @NotNull net.minecraftforge.registries.RegistryBuilder builder) { + public RegistryBuilderWrapper(RegistryProviderImpl provider, net.minecraftforge.registries.RegistryBuilder builder) { this.provider = provider; this.builder = builder; } @Override - public @NotNull Registrar build() { + public Registrar build() { if (!syncToClients) builder.disableSync(); if (!saveToDisk) builder.disableSaving(); return provider.get(builder.create()); } @Override - public @NotNull RegistrarBuilder option(@NotNull RegistrarOption option) { + public RegistrarBuilder option(RegistrarOption option) { if (option == StandardRegistrarOption.SAVE_TO_DISC) { this.saveToDisk = true; } else if (option == StandardRegistrarOption.SYNC_TO_CLIENTS) { @@ -190,23 +358,38 @@ public class RegistriesImpl { } public static class VanillaBackedRegistryImpl implements Registrar { + private final String modId; private net.minecraft.core.Registry delegate; + private Map>, Data> registry; - public VanillaBackedRegistryImpl(net.minecraft.core.Registry delegate) { + public VanillaBackedRegistryImpl(String modId, Map>, Data> registry, net.minecraft.core.Registry delegate) { + this.modId = modId; + this.registry = registry; this.delegate = delegate; } @Override - public @NotNull RegistrySupplier delegate(ResourceLocation id) { + public RegistrySupplier delegate(ResourceLocation id) { Supplier value = Suppliers.memoize(() -> get(id)); + Registrar registrar = this; return new RegistrySupplier() { @Override - public @NotNull ResourceLocation getRegistryId() { + public Registries getRegistries() { + return Registries.get(modId); + } + + @Override + public Registrar getRegistrar() { + return registrar; + } + + @Override + public ResourceLocation getRegistryId() { return delegate.key().location(); } @Override - public @NotNull ResourceLocation getId() { + public ResourceLocation getId() { return id; } @@ -241,8 +424,9 @@ public class RegistriesImpl { } @Override - public @NotNull RegistrySupplier register(ResourceLocation id, Supplier supplier) { - net.minecraft.core.Registry.register(delegate, id, supplier.get()); + public RegistrySupplier register(ResourceLocation id, Supplier supplier) { + registry.computeIfAbsent(key(), type -> new Data()) + .register(delegate, id, supplier); return (RegistrySupplier) delegate(id); } @@ -302,28 +486,51 @@ public class RegistriesImpl { public Iterator iterator() { return delegate.iterator(); } + + @Override + public void listen(ResourceLocation id, Consumer callback) { + T value = get(id); + if (value != null) { + callback.accept(value); + } else { + RegistriesImpl.listen(key(), id, callback, true); + } + } } public static class ForgeBackedRegistryImpl> implements Registrar { + private final String modId; private IForgeRegistry delegate; - private Map registry; + private Map>, Data> registry; - public ForgeBackedRegistryImpl(Map registry, IForgeRegistry delegate) { + public ForgeBackedRegistryImpl(String modId, Map>, Data> registry, IForgeRegistry delegate) { + this.modId = modId; this.registry = registry; this.delegate = delegate; } @Override - public @NotNull RegistrySupplier delegate(ResourceLocation id) { + public RegistrySupplier delegate(ResourceLocation id) { Supplier value = Suppliers.memoize(() -> get(id)); + Registrar registrar = this; return new RegistrySupplier() { @Override - public @NotNull ResourceLocation getRegistryId() { + public Registries getRegistries() { + return Registries.get(modId); + } + + @Override + public Registrar getRegistrar() { + return registrar; + } + + @Override + public ResourceLocation getRegistryId() { return delegate.getRegistryName(); } @Override - public @NotNull ResourceLocation getId() { + public ResourceLocation getId() { return id; } @@ -358,18 +565,29 @@ public class RegistriesImpl { } @Override - public @NotNull RegistrySupplier register(ResourceLocation id, Supplier supplier) { + public RegistrySupplier register(ResourceLocation id, Supplier supplier) { RegistryObject registryObject = RegistryObject.of(id, delegate); - registry.computeIfAbsent(delegate.getRegistrySuperType(), type -> new Data()) + registry.computeIfAbsent(key(), type -> new Data()) .register(delegate, registryObject, () -> supplier.get().setRegistryName(id)); + Registrar registrar = this; return new RegistrySupplier() { @Override - public @NotNull ResourceLocation getRegistryId() { + public Registries getRegistries() { + return Registries.get(modId); + } + + @Override + public Registrar getRegistrar() { + return (Registrar) registrar; + } + + @Override + public ResourceLocation getRegistryId() { return delegate.getRegistryName(); } @Override - public @NotNull ResourceLocation getId() { + public ResourceLocation getId() { return registryObject.getId(); } @@ -459,5 +677,15 @@ public class RegistriesImpl { public Iterator iterator() { return delegate.iterator(); } + + @Override + public void listen(ResourceLocation id, Consumer callback) { + T value = get(id); + if (value != null) { + callback.accept(value); + } else { + RegistriesImpl.listen(key(), id, callback, false); + } + } } } diff --git a/forge/src/main/resources/META-INF/accesstransformer.cfg b/forge/src/main/resources/META-INF/accesstransformer.cfg deleted file mode 100644 index a18e70b5..00000000 --- a/forge/src/main/resources/META-INF/accesstransformer.cfg +++ /dev/null @@ -1,50 +0,0 @@ -public net.minecraft.world.level.block.state.BlockBehaviour f_60439_ #properties -public net.minecraft.world.level.block.state.BlockBehaviour$Properties (Lnet/minecraft/world/level/material/Material;Ljava/util/function/Function;)V -public net.minecraft.world.level.block.state.BlockBehaviour$Properties f_60882_ #material -public net.minecraft.world.level.block.state.BlockBehaviour$Properties f_60888_ #destroyTime -public net.minecraft.world.level.block.state.BlockBehaviour$Properties f_60887_ #explosionResistance -public net.minecraft.world.level.block.state.BlockBehaviour$Properties f_60884_ #hasCollision -public net.minecraft.world.level.block.state.BlockBehaviour$Properties f_60890_ #isRandomlyTicking -public net.minecraft.world.level.block.state.BlockBehaviour$Properties f_60886_ #lightEmission -public net.minecraft.world.level.block.state.BlockBehaviour$Properties f_60883_ #materialColor -public net.minecraft.world.level.block.state.BlockBehaviour$Properties f_60885_ #soundType -public net.minecraft.world.level.block.state.BlockBehaviour$Properties f_60891_ #friction -public net.minecraft.world.level.block.state.BlockBehaviour$Properties f_60892_ #speedFactor -public net.minecraft.world.level.block.state.BlockBehaviour$Properties f_60903_ #dynamicShape -public net.minecraft.world.level.block.state.BlockBehaviour$Properties f_60895_ #canOcclude -public net.minecraft.world.level.block.state.BlockBehaviour$Properties f_60896_ #isAir -public net.minecraft.world.level.block.state.BlockBehaviour$Properties f_60889_ #requiresCorrectToolForDrops -public-f net.minecraft.world.level.Explosion f_46017_ #radius -public net.minecraft.client.gui.screens.Screen f_169368_ #narratables -public net.minecraft.client.gui.screens.Screen f_169369_ #renderables -public-f net.minecraft.world.level.biome.Biome$ClimateSettings field_242460_b # precipitation -public-f net.minecraft.world.level.biome.Biome$ClimateSettings field_242461_c # temperature -public-f net.minecraft.world.level.biome.Biome$ClimateSettings field_242462_d # temperatureModifier -public-f net.minecraft.world.level.biome.Biome$ClimateSettings field_242463_e # downfall -public-f net.minecraft.world.level.biome.BiomeSpecialEffects f_47927_ # fogColor -public-f net.minecraft.world.level.biome.BiomeSpecialEffects f_47928_ # waterColor -public-f net.minecraft.world.level.biome.BiomeSpecialEffects f_47929_ # waterFogColor -public-f net.minecraft.world.level.biome.BiomeSpecialEffects f_47934_ # ambientParticleSettings -public-f net.minecraft.world.level.biome.BiomeSpecialEffects f_47935_ # ambientLoopSoundEvent -public-f net.minecraft.world.level.biome.BiomeSpecialEffects f_47936_ # ambientMoodSettings -public-f net.minecraft.world.level.biome.BiomeSpecialEffects f_47937_ # ambientAdditionsSettings -public-f net.minecraft.world.level.biome.BiomeSpecialEffects f_47938_ # backgroundMusic -public-f net.minecraft.world.level.biome.BiomeSpecialEffects f_47930_ # skyColor -public-f net.minecraft.world.level.biome.BiomeSpecialEffects f_47931_ # foliageColorOverride -public-f net.minecraft.world.level.biome.BiomeSpecialEffects f_47932_ # grassColorOverride -public-f net.minecraft.world.level.biome.BiomeSpecialEffects f_47933_ # grassColorModifier -public net.minecraft.world.level.storage.LevelResource (Ljava/lang/String;)V -public net.minecraft.world.level.biome.BiomeGenerationSettings$Builder f_47828_ # features -public net.minecraft.world.level.biome.MobSpawnSettings$Builder f_48362_ # spawners -public net.minecraft.world.level.biome.MobSpawnSettings$Builder f_48363_ # mobSpawnCosts -public net.minecraft.world.level.biome.MobSpawnSettings$Builder f_48365_ # playerCanSpawn -public net.minecraft.world.level.GameRules$BooleanValue m_46250_(Z)Lnet/minecraft/world/level/GameRules$Type; # create -public net.minecraft.world.level.GameRules$BooleanValue m_46252_(ZLjava/util/function/BiConsumer;)Lnet/minecraft/world/level/GameRules$Type; # create -public net.minecraft.world.level.GameRules$IntegerValue m_46312_(I)Lnet/minecraft/world/level/GameRules$Type; # create -public net.minecraft.world.level.GameRules$IntegerValue m_46294_(ILjava/util/function/BiConsumer;)Lnet/minecraft/world/level/GameRules$Type; # create -public net.minecraft.client.particle.ParticleEngine f_107296_ # textureAtlas -public net.minecraft.client.particle.ParticleEngine$MutableSpriteSet -public net.minecraft.client.particle.ParticleEngine$MutableSpriteSet f_107406_ # sprites -public-f net.minecraft.world.item.AxeItem f_150683_ # STRIPPABLES -public-f net.minecraft.world.item.ShovelItem f_43110_ # FLATTENABLES -public-f net.minecraft.world.item.HoeItem f_41332_ # TILLABLES diff --git a/gradle.properties b/gradle.properties index 8fba6c56..6e706ede 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,7 +10,7 @@ cf_type=release archives_base_name=architectury archives_base_name_snapshot=architectury-snapshot -base_version=4.0 +base_version=4.1 maven_group=dev.architectury fabric_loader_version=0.13.2 diff --git a/testmod-common/src/main/java/dev/architectury/test/TestMod.java b/testmod-common/src/main/java/dev/architectury/test/TestMod.java index b18c93be..2d0d31a4 100644 --- a/testmod-common/src/main/java/dev/architectury/test/TestMod.java +++ b/testmod-common/src/main/java/dev/architectury/test/TestMod.java @@ -38,8 +38,7 @@ import dev.architectury.utils.Env; import dev.architectury.utils.EnvExecutor; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.model.geom.ModelLayers; -import net.minecraft.client.renderer.entity.MinecartRenderer; +import net.minecraft.client.renderer.entity.PigRenderer; public class TestMod { public static final MessageSink SINK = EnvExecutor.getEnvSpecific(() -> ClientOverlayMessageSink::new, () -> ConsoleMessageSink::new); @@ -65,8 +64,7 @@ public class TestMod { ClientLifecycleEvent.CLIENT_STOPPING.register((client) -> SINK.accept("Client stopping!")); TestKeybinds.initialize(); TestModNet.initializeClient(); - EntityRendererRegistry.register(() -> TestEntity.TYPE, context -> - new MinecartRenderer<>(context, ModelLayers.MINECART)); + EntityRendererRegistry.register(() -> TestEntity.TYPE, PigRenderer::new); } } } diff --git a/testmod-common/src/main/java/dev/architectury/test/entity/TestEntity.java b/testmod-common/src/main/java/dev/architectury/test/entity/TestEntity.java index 9d4d9247..f65a7eca 100644 --- a/testmod-common/src/main/java/dev/architectury/test/entity/TestEntity.java +++ b/testmod-common/src/main/java/dev/architectury/test/entity/TestEntity.java @@ -23,21 +23,16 @@ import dev.architectury.networking.NetworkManager; import net.minecraft.network.protocol.Packet; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.MobCategory; -import net.minecraft.world.entity.vehicle.AbstractMinecart; +import net.minecraft.world.entity.animal.Pig; import net.minecraft.world.level.Level; -public class TestEntity extends AbstractMinecart { +public class TestEntity extends Pig { public static final EntityType TYPE = EntityType.Builder.of(TestEntity::new, MobCategory.MISC).sized(0.98F, 0.7F).clientTrackingRange(8).build("test_entity"); - public TestEntity(EntityType entityType, Level level) { + public TestEntity(EntityType entityType, Level level) { super(entityType, level); } - @Override - public Type getMinecartType() { - return Type.RIDEABLE; - } - @Override public Packet getAddEntityPacket() { return NetworkManager.createAddEntityPacket(this); diff --git a/testmod-common/src/main/java/dev/architectury/test/events/DebugEvents.java b/testmod-common/src/main/java/dev/architectury/test/events/DebugEvents.java index 7fa40c44..c4429b52 100644 --- a/testmod-common/src/main/java/dev/architectury/test/events/DebugEvents.java +++ b/testmod-common/src/main/java/dev/architectury/test/events/DebugEvents.java @@ -218,10 +218,10 @@ public class DebugEvents { TestMod.SINK.accept(bolt.getScoreboardName() + " struck at " + toShortString(pos) + logSide(level)); }); ChunkEvent.LOAD_DATA.register((chunk, level, nbt) -> { - TestMod.SINK.accept("Chunk loaded at x=" + chunk.getPos().x + ", z=" + chunk.getPos().z + " in dimension '" + level.dimension().location() + "'"); +// TestMod.SINK.accept("Chunk loaded at x=" + chunk.getPos().x + ", z=" + chunk.getPos().z + " in dimension '" + level.dimension().location() + "'"); }); ChunkEvent.SAVE_DATA.register((chunk, level, nbt) -> { - TestMod.SINK.accept("Chunk saved at x=" + chunk.getPos().x + ", z=" + chunk.getPos().z + " in dimension '" + level.dimension().location() + "'"); +// TestMod.SINK.accept("Chunk saved at x=" + chunk.getPos().x + ", z=" + chunk.getPos().z + " in dimension '" + level.dimension().location() + "'"); }); } diff --git a/testmod-common/src/main/java/dev/architectury/test/registry/TestRegistries.java b/testmod-common/src/main/java/dev/architectury/test/registry/TestRegistries.java index 7fbeed2b..facd3999 100644 --- a/testmod-common/src/main/java/dev/architectury/test/registry/TestRegistries.java +++ b/testmod-common/src/main/java/dev/architectury/test/registry/TestRegistries.java @@ -19,9 +19,11 @@ package dev.architectury.test.registry; +import dev.architectury.core.item.ArchitecturySpawnEggItem; import dev.architectury.hooks.item.food.FoodPropertiesHooks; import dev.architectury.hooks.level.entity.EntityHooks; import dev.architectury.registry.block.BlockProperties; +import dev.architectury.registry.level.entity.EntityAttributeRegistry; import dev.architectury.registry.registries.DeferredRegister; import dev.architectury.registry.registries.RegistrySupplier; import dev.architectury.test.TestMod; @@ -35,11 +37,13 @@ import net.minecraft.world.effect.MobEffect; import net.minecraft.world.effect.MobEffectCategory; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.animal.Pig; import net.minecraft.world.food.FoodProperties; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; import net.minecraft.world.item.crafting.CustomRecipe; import net.minecraft.world.item.crafting.RecipeSerializer; +import net.minecraft.world.item.crafting.RecipeType; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; @@ -55,6 +59,7 @@ public class TestRegistries { public static final DeferredRegister> ENTITY_TYPES = DeferredRegister.create(TestMod.MOD_ID, Registry.ENTITY_TYPE_REGISTRY); public static final DeferredRegister MOB_EFFECTS = DeferredRegister.create(TestMod.MOD_ID, Registry.MOB_EFFECT_REGISTRY); public static final DeferredRegister> RECIPE_SERIALIZERS = DeferredRegister.create(TestMod.MOD_ID, Registry.RECIPE_SERIALIZER_REGISTRY); + public static final DeferredRegister> RECIPE_TYPES = DeferredRegister.create(TestMod.MOD_ID, Registry.RECIPE_TYPE_REGISTRY); public static final RegistrySupplier TEST_EFFECT = MOB_EFFECTS.register("test_effect", () -> new MobEffect(MobEffectCategory.NEUTRAL, 0x123456) { @@ -69,6 +74,9 @@ public class TestRegistries { FoodPropertiesHooks.effect(fpBuilder, () -> new MobEffectInstance(TEST_EFFECT.get(), 100), 1); return new Item(new Item.Properties().tab(TestCreativeTabs.TEST_TAB).food(fpBuilder.build())); }); + public static final RegistrySupplier TEST_SPAWN_EGG = ITEMS.register("test_spawn_egg", () -> + new ArchitecturySpawnEggItem(TestRegistries.TEST_ENTITY, 0xFF000000, 0xFFFFFFFF, + new Item.Properties().tab(TestCreativeTabs.TEST_TAB))); public static final RegistrySupplier TEST_BLOCK = BLOCKS.register("test_block", () -> new Block(BlockProperties.copy(Blocks.STONE))); @@ -90,11 +98,29 @@ public class TestRegistries { public static final RegistrySupplier> TEST_SERIALIZER = RECIPE_SERIALIZERS.register("test_serializer", TestRecipeSerializer::new); + public static final RegistrySupplier> TEST_RECIPE_TYPE = RECIPE_TYPES.register("test_recipe_type", () -> new RecipeType() { + @Override + public String toString() { + return TestMod.MOD_ID + ":test_recipe_type"; + } + }); + public static void initialize() { MOB_EFFECTS.register(); BLOCKS.register(); ITEMS.register(); ENTITY_TYPES.register(); + RECIPE_TYPES.register(); RECIPE_SERIALIZERS.register(); + EntityAttributeRegistry.register(TEST_ENTITY, Pig::createAttributes); + TEST_BLOCK_ITEM.listen(item -> { + System.out.println("Registered item!"); + }); + TEST_SERIALIZER.listen(type -> { + System.out.println("Registered recipe serializer!"); + }); + TEST_RECIPE_TYPE.listen(type -> { + System.out.println("Registered recipe type!"); + }); } } diff --git a/testmod-common/src/main/resources/assets/architectury_test/models/item/test_spawn_egg.json b/testmod-common/src/main/resources/assets/architectury_test/models/item/test_spawn_egg.json new file mode 100644 index 00000000..d1aaa9d6 --- /dev/null +++ b/testmod-common/src/main/resources/assets/architectury_test/models/item/test_spawn_egg.json @@ -0,0 +1,3 @@ +{ + "parent": "minecraft:item/template_spawn_egg" +} \ No newline at end of file diff --git a/testmod-fabric/build.gradle b/testmod-fabric/build.gradle index af36ec69..a298fd9d 100644 --- a/testmod-fabric/build.gradle +++ b/testmod-fabric/build.gradle @@ -4,6 +4,8 @@ plugins { } loom { + accessWidenerPath = project(":common").loom.accessWidenerPath + mixin { useLegacyMixinAp = true } } diff --git a/testmod-forge/build.gradle b/testmod-forge/build.gradle index b5fcb979..86818c40 100644 --- a/testmod-forge/build.gradle +++ b/testmod-forge/build.gradle @@ -4,6 +4,8 @@ plugins { } loom { + accessWidenerPath = project(":common").loom.accessWidenerPath + forge { mixinConfig "architectury.mixins.json"