diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000..a40feaeb38 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,25 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +tab_width = 4 + +[*.gradle] +indent_style = tab + +[*.java] +indent_style = tab + +[*.json] +indent_style = space +indent_size = 2 + +[*.properties] +indent_style = space +indent_size = 2 + +[.editorconfig] +indent_style = space +indent_size = 4 diff --git a/HEADER b/HEADER index 06e5a0ab0c..d5f99faa4d 100644 --- a/HEADER +++ b/HEADER @@ -1,4 +1,4 @@ -Copyright (c) 2016, 2017, 2018 FabricMC +Copyright (c) 2016, 2017, 2018, 2019 FabricMC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/build.gradle b/build.gradle index de266f0432..cb2951599f 100644 --- a/build.gradle +++ b/build.gradle @@ -4,6 +4,7 @@ plugins { id 'idea' id 'maven-publish' id 'fabric-loom' version '0.2.2-SNAPSHOT' apply false + id 'net.minecrell.licenser' version '0.4.1' // id 'com.matthewprenger.cursegradle' version "1.1.2" } @@ -15,6 +16,7 @@ def mcVersion = "1.14" allprojects { apply plugin: 'maven-publish' apply plugin: 'fabric-loom' + apply plugin: 'net.minecrell.licenser' sourceCompatibility = 1.8 targetCompatibility = 1.8 @@ -52,6 +54,12 @@ allprojects { exclude "fabric.mod.json" } } + + license { + println(rootProject.file('HEADER')) + header rootProject.file('HEADER') + include '**/*.java' + } } task sourcesJar(type: Jar, dependsOn: classes) { @@ -119,7 +127,7 @@ publishing { def depNode = depsNode.appendNode("dependency") depNode.appendNode("groupId", it.group) depNode.appendNode("artifactId", it.name) - depNode.appendNode("version", it.version) + depNode.appendNode("version", it.version) depNode.appendNode("scope", "compile") } } @@ -139,6 +147,9 @@ publishing { } } +task licenseFormatAll +subprojects { p -> licenseFormatAll.dependsOn("${p.path}:licenseFormat") } + dependencies { afterEvaluate { subprojects.each { @@ -171,5 +182,4 @@ version = baseVersion + "+" + (ENV.BUILD_NUMBER ? ("build." + ENV.BUILD_NUMBER) // } //} -apply from: 'https://github.com/FabricMC/fabric-docs/raw/master/gradle/license.gradle' apply from: 'https://github.com/FabricMC/fabric-docs/raw/master/gradle/ideconfig.gradle' diff --git a/fabric-client-registries/src/main/java/net/fabricmc/fabric/api/client/keybinding/FabricKeyBinding.java b/fabric-client-registries/src/main/java/net/fabricmc/fabric/api/client/keybinding/FabricKeyBinding.java index 81c2a63972..eba789ee01 100644 --- a/fabric-client-registries/src/main/java/net/fabricmc/fabric/api/client/keybinding/FabricKeyBinding.java +++ b/fabric-client-registries/src/main/java/net/fabricmc/fabric/api/client/keybinding/FabricKeyBinding.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ /** * Expanded version of {@link KeyBinding} for use by Fabric mods. - * + *

* *ALL* instantiated FabricKeyBindings should be registered in * {@link KeyBindingRegistry#register(FabricKeyBinding)}! */ diff --git a/fabric-client-registries/src/main/java/net/fabricmc/fabric/api/client/keybinding/KeyBindingRegistry.java b/fabric-client-registries/src/main/java/net/fabricmc/fabric/api/client/keybinding/KeyBindingRegistry.java index aa66322e91..213fc8ee35 100644 --- a/fabric-client-registries/src/main/java/net/fabricmc/fabric/api/client/keybinding/KeyBindingRegistry.java +++ b/fabric-client-registries/src/main/java/net/fabricmc/fabric/api/client/keybinding/KeyBindingRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,6 +29,7 @@ public interface KeyBindingRegistry { /** * Add a new key binding category. + * * @param categoryName The key binding category name. * @return True if a new category was added. */ @@ -36,6 +37,7 @@ public interface KeyBindingRegistry { /** * Register a new key binding. + * * @param binding The key binding. * @return True if a new key binding was registered. */ diff --git a/fabric-client-registries/src/main/java/net/fabricmc/fabric/api/client/render/BlockEntityRendererRegistry.java b/fabric-client-registries/src/main/java/net/fabricmc/fabric/api/client/render/BlockEntityRendererRegistry.java index b37fac0b8a..463a8a7fa0 100644 --- a/fabric-client-registries/src/main/java/net/fabricmc/fabric/api/client/render/BlockEntityRendererRegistry.java +++ b/fabric-client-registries/src/main/java/net/fabricmc/fabric/api/client/render/BlockEntityRendererRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-client-registries/src/main/java/net/fabricmc/fabric/api/client/render/ColorProviderRegistry.java b/fabric-client-registries/src/main/java/net/fabricmc/fabric/api/client/render/ColorProviderRegistry.java index d77488172f..f7cf64fa37 100644 --- a/fabric-client-registries/src/main/java/net/fabricmc/fabric/api/client/render/ColorProviderRegistry.java +++ b/fabric-client-registries/src/main/java/net/fabricmc/fabric/api/client/render/ColorProviderRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,7 +37,7 @@ public interface ColorProviderRegistry { /** * Get a color provider for the given object. - * + *

* Please note that the underlying registry may not be fully populated or stable until the game has started, * as other mods may overwrite the registry. * diff --git a/fabric-client-registries/src/main/java/net/fabricmc/fabric/api/client/render/EntityRendererRegistry.java b/fabric-client-registries/src/main/java/net/fabricmc/fabric/api/client/render/EntityRendererRegistry.java index d60d525f13..1517571e5b 100644 --- a/fabric-client-registries/src/main/java/net/fabricmc/fabric/api/client/render/EntityRendererRegistry.java +++ b/fabric-client-registries/src/main/java/net/fabricmc/fabric/api/client/render/EntityRendererRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-client-registries/src/main/java/net/fabricmc/fabric/impl/client/keybinding/KeyBindingRegistryImpl.java b/fabric-client-registries/src/main/java/net/fabricmc/fabric/impl/client/keybinding/KeyBindingRegistryImpl.java index 65db6ed4f3..3f66538dc5 100644 --- a/fabric-client-registries/src/main/java/net/fabricmc/fabric/impl/client/keybinding/KeyBindingRegistryImpl.java +++ b/fabric-client-registries/src/main/java/net/fabricmc/fabric/impl/client/keybinding/KeyBindingRegistryImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-client-registries/src/main/java/net/fabricmc/fabric/impl/client/render/ColorProviderRegistryImpl.java b/fabric-client-registries/src/main/java/net/fabricmc/fabric/impl/client/render/ColorProviderRegistryImpl.java index 29c62cc395..82fff487ed 100644 --- a/fabric-client-registries/src/main/java/net/fabricmc/fabric/impl/client/render/ColorProviderRegistryImpl.java +++ b/fabric-client-registries/src/main/java/net/fabricmc/fabric/impl/client/render/ColorProviderRegistryImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-client-registries/src/main/java/net/fabricmc/fabric/mixin/client/keybinding/MixinGameOptions.java b/fabric-client-registries/src/main/java/net/fabricmc/fabric/mixin/client/keybinding/MixinGameOptions.java index 91e9222d74..5638d603eb 100644 --- a/fabric-client-registries/src/main/java/net/fabricmc/fabric/mixin/client/keybinding/MixinGameOptions.java +++ b/fabric-client-registries/src/main/java/net/fabricmc/fabric/mixin/client/keybinding/MixinGameOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-client-registries/src/main/java/net/fabricmc/fabric/mixin/client/keybinding/MixinKeyBinding.java b/fabric-client-registries/src/main/java/net/fabricmc/fabric/mixin/client/keybinding/MixinKeyBinding.java index 47dc54a3e6..eacd373541 100644 --- a/fabric-client-registries/src/main/java/net/fabricmc/fabric/mixin/client/keybinding/MixinKeyBinding.java +++ b/fabric-client-registries/src/main/java/net/fabricmc/fabric/mixin/client/keybinding/MixinKeyBinding.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-client-registries/src/main/java/net/fabricmc/fabric/mixin/client/render/MixinBlockColorMap.java b/fabric-client-registries/src/main/java/net/fabricmc/fabric/mixin/client/render/MixinBlockColorMap.java index b5b8d8b2af..17b1003bb5 100644 --- a/fabric-client-registries/src/main/java/net/fabricmc/fabric/mixin/client/render/MixinBlockColorMap.java +++ b/fabric-client-registries/src/main/java/net/fabricmc/fabric/mixin/client/render/MixinBlockColorMap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-client-registries/src/main/java/net/fabricmc/fabric/mixin/client/render/MixinBlockEntityRenderManager.java b/fabric-client-registries/src/main/java/net/fabricmc/fabric/mixin/client/render/MixinBlockEntityRenderManager.java index ebf96867ea..c1090112dd 100644 --- a/fabric-client-registries/src/main/java/net/fabricmc/fabric/mixin/client/render/MixinBlockEntityRenderManager.java +++ b/fabric-client-registries/src/main/java/net/fabricmc/fabric/mixin/client/render/MixinBlockEntityRenderManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-client-registries/src/main/java/net/fabricmc/fabric/mixin/client/render/MixinEntityRenderManager.java b/fabric-client-registries/src/main/java/net/fabricmc/fabric/mixin/client/render/MixinEntityRenderManager.java index b0dfa912e9..2d6735e0b3 100644 --- a/fabric-client-registries/src/main/java/net/fabricmc/fabric/mixin/client/render/MixinEntityRenderManager.java +++ b/fabric-client-registries/src/main/java/net/fabricmc/fabric/mixin/client/render/MixinEntityRenderManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,7 +37,7 @@ public class MixinEntityRenderManager { private Map, EntityRenderer> renderers; @Inject(method = "(Lnet/minecraft/client/texture/TextureManager;Lnet/minecraft/client/render/item/ItemRenderer;Lnet/minecraft/resource/ReloadableResourceManager;)V", at = @At("RETURN"), require = 0) - public void init(TextureManager textureManager,ItemRenderer itemRenderer, ReloadableResourceManager manager, CallbackInfo info) { + public void init(TextureManager textureManager, ItemRenderer itemRenderer, ReloadableResourceManager manager, CallbackInfo info) { EntityRendererRegistry.INSTANCE.initialize((EntityRenderDispatcher) (Object) this, textureManager, manager, itemRenderer, renderers); } } diff --git a/fabric-client-registries/src/main/java/net/fabricmc/fabric/mixin/client/render/MixinItemColorMap.java b/fabric-client-registries/src/main/java/net/fabricmc/fabric/mixin/client/render/MixinItemColorMap.java index 9e58fd33fa..fb838d2a6a 100644 --- a/fabric-client-registries/src/main/java/net/fabricmc/fabric/mixin/client/render/MixinItemColorMap.java +++ b/fabric-client-registries/src/main/java/net/fabricmc/fabric/mixin/client/render/MixinItemColorMap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-commands/src/main/java/net/fabricmc/fabric/api/registry/CommandRegistry.java b/fabric-commands/src/main/java/net/fabricmc/fabric/api/registry/CommandRegistry.java index da0c1177c0..31931f3575 100644 --- a/fabric-commands/src/main/java/net/fabricmc/fabric/api/registry/CommandRegistry.java +++ b/fabric-commands/src/main/java/net/fabricmc/fabric/api/registry/CommandRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,9 +20,6 @@ import net.fabricmc.fabric.impl.registry.CommandRegistryImpl; import net.minecraft.server.command.ServerCommandSource; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; import java.util.function.Consumer; /** @@ -33,10 +30,11 @@ public class CommandRegistry { /** * Register a command provider. + * * @param dedicated If true, the command is only registered on the dedicated server. - * @param consumer The command provider, consuming {@link CommandDispatcher}. + * @param consumer The command provider, consuming {@link CommandDispatcher}. */ - public void register(boolean dedicated, Consumer> consumer) { + public void register(boolean dedicated, Consumer> consumer) { CommandRegistryImpl.INSTANCE.register(dedicated, consumer); } } diff --git a/fabric-commands/src/main/java/net/fabricmc/fabric/impl/registry/CommandRegistryImpl.java b/fabric-commands/src/main/java/net/fabricmc/fabric/impl/registry/CommandRegistryImpl.java index c70c410206..708a930b5a 100644 --- a/fabric-commands/src/main/java/net/fabricmc/fabric/impl/registry/CommandRegistryImpl.java +++ b/fabric-commands/src/main/java/net/fabricmc/fabric/impl/registry/CommandRegistryImpl.java @@ -1,7 +1,22 @@ +/* + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.fabricmc.fabric.impl.registry; import com.mojang.brigadier.CommandDispatcher; -import net.fabricmc.fabric.api.registry.CommandRegistry; import net.minecraft.server.command.ServerCommandSource; import java.util.ArrayList; @@ -10,25 +25,25 @@ import java.util.function.Consumer; public class CommandRegistryImpl { - public static final CommandRegistryImpl INSTANCE = new CommandRegistryImpl(); - - private final List>> serverCommands; - private final List>> dedicatedServerCommands; - - public CommandRegistryImpl() { - this.serverCommands = new ArrayList<>(); - this.dedicatedServerCommands = new ArrayList<>(); - } - - public List>> entries(boolean dedicated) { - return Collections.unmodifiableList(dedicated ? dedicatedServerCommands : serverCommands); - } - - public void register(boolean dedicated, Consumer> consumer) { - if (dedicated) { - dedicatedServerCommands.add(consumer); - } else { - serverCommands.add(consumer); - } - } + public static final CommandRegistryImpl INSTANCE = new CommandRegistryImpl(); + + private final List>> serverCommands; + private final List>> dedicatedServerCommands; + + public CommandRegistryImpl() { + this.serverCommands = new ArrayList<>(); + this.dedicatedServerCommands = new ArrayList<>(); + } + + public List>> entries(boolean dedicated) { + return Collections.unmodifiableList(dedicated ? dedicatedServerCommands : serverCommands); + } + + public void register(boolean dedicated, Consumer> consumer) { + if (dedicated) { + dedicatedServerCommands.add(consumer); + } else { + serverCommands.add(consumer); + } + } } diff --git a/fabric-commands/src/main/java/net/fabricmc/fabric/mixin/registrycommands/MixinMinecraftDedicatedServer.java b/fabric-commands/src/main/java/net/fabricmc/fabric/mixin/registrycommands/MixinMinecraftDedicatedServer.java index abc8ecc75f..62c706624d 100644 --- a/fabric-commands/src/main/java/net/fabricmc/fabric/mixin/registrycommands/MixinMinecraftDedicatedServer.java +++ b/fabric-commands/src/main/java/net/fabricmc/fabric/mixin/registrycommands/MixinMinecraftDedicatedServer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,14 +19,11 @@ import com.mojang.authlib.GameProfileRepository; import com.mojang.authlib.minecraft.MinecraftSessionService; import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; -import com.mojang.brigadier.CommandDispatcher; import com.mojang.datafixers.DataFixer; -import net.fabricmc.fabric.api.registry.CommandRegistry; import net.fabricmc.fabric.impl.registry.CommandRegistryImpl; import net.minecraft.server.MinecraftServer; import net.minecraft.server.WorldGenerationProgressListenerFactory; import net.minecraft.server.command.CommandManager; -import net.minecraft.server.command.ServerCommandSource; import net.minecraft.server.dedicated.MinecraftDedicatedServer; import net.minecraft.util.UserCache; import org.spongepowered.asm.mixin.Mixin; @@ -36,7 +33,6 @@ import java.io.File; import java.net.Proxy; -import java.util.function.Consumer; @Mixin(MinecraftDedicatedServer.class) public abstract class MixinMinecraftDedicatedServer extends MinecraftServer { @@ -46,7 +42,7 @@ public MixinMinecraftDedicatedServer(File file_1, Proxy proxy_1, DataFixer dataF } @Inject(method = "setupServer", at = @At("HEAD")) - private void setupServer(CallbackInfoReturnable info){ + private void setupServer(CallbackInfoReturnable info) { CommandRegistryImpl.INSTANCE.entries(false).forEach((e) -> e.accept(getCommandManager().getDispatcher())); CommandRegistryImpl.INSTANCE.entries(true).forEach((e) -> e.accept(getCommandManager().getDispatcher())); } diff --git a/fabric-commands/src/main/java/net/fabricmc/fabric/mixin/registrycommands/MixinServerCommandManager.java b/fabric-commands/src/main/java/net/fabricmc/fabric/mixin/registrycommands/MixinServerCommandManager.java index da6c65c1a3..f2d9a1c314 100644 --- a/fabric-commands/src/main/java/net/fabricmc/fabric/mixin/registrycommands/MixinServerCommandManager.java +++ b/fabric-commands/src/main/java/net/fabricmc/fabric/mixin/registrycommands/MixinServerCommandManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,6 @@ package net.fabricmc.fabric.mixin.registrycommands; import com.mojang.brigadier.CommandDispatcher; -import net.fabricmc.fabric.api.registry.CommandRegistry; import net.fabricmc.fabric.impl.registry.CommandRegistryImpl; import net.minecraft.server.command.CommandManager; import net.minecraft.server.command.ServerCommandSource; @@ -38,7 +37,7 @@ public class MixinServerCommandManager { @Inject(method = "(Z)V", at = @At("RETURN")) public void addMethods(boolean dedicated, CallbackInfo info) { // TODO: Run before findAmbiguities - if(!dedicated){ + if (!dedicated) { CommandRegistryImpl.INSTANCE.entries(false).forEach((e) -> e.accept(dispatcher)); } } diff --git a/fabric-containers/src/main/java/net/fabricmc/fabric/api/client/screen/ContainerScreenFactory.java b/fabric-containers/src/main/java/net/fabricmc/fabric/api/client/screen/ContainerScreenFactory.java index a8983f7b70..1c89d810f7 100644 --- a/fabric-containers/src/main/java/net/fabricmc/fabric/api/client/screen/ContainerScreenFactory.java +++ b/fabric-containers/src/main/java/net/fabricmc/fabric/api/client/screen/ContainerScreenFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-containers/src/main/java/net/fabricmc/fabric/api/client/screen/ScreenProviderRegistry.java b/fabric-containers/src/main/java/net/fabricmc/fabric/api/client/screen/ScreenProviderRegistry.java index f6c6af1adb..624f92d2c5 100644 --- a/fabric-containers/src/main/java/net/fabricmc/fabric/api/client/screen/ScreenProviderRegistry.java +++ b/fabric-containers/src/main/java/net/fabricmc/fabric/api/client/screen/ScreenProviderRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,21 +28,19 @@ public interface ScreenProviderRegistry { ScreenProviderRegistry INSTANCE = ScreenProviderRegistryImpl.INSTANCE; /** - * * Register a "Container -> ContainerScreen" factory. This is used only on the client side. * - * @param identifier a shared identifier, this identifier should also be used to register a container using {@link ContainerProviderRegistry} + * @param identifier a shared identifier, this identifier should also be used to register a container using {@link ContainerProviderRegistry} * @param containerScreenFactory the supplier that should be used to create the new gui */ void registerFactory(Identifier identifier, ContainerScreenFactory containerScreenFactory); /** - * * Register a "packet -> ContainerScreen" factory. This is used only on the client side, and allows you * to override the default behaviour of re-using the existing "packet -> Container" logic. * * @param identifier a shared identifier, this identifier should also be used to register a container using {@link ContainerProviderRegistry} - * @param factory the gui factory, this should return a new {@link ContainerScreen} + * @param factory the gui factory, this should return a new {@link ContainerScreen} */ void registerFactory(Identifier identifier, ContainerFactory factory); diff --git a/fabric-containers/src/main/java/net/fabricmc/fabric/api/container/ContainerFactory.java b/fabric-containers/src/main/java/net/fabricmc/fabric/api/container/ContainerFactory.java index ccc625ae84..61562d3a00 100644 --- a/fabric-containers/src/main/java/net/fabricmc/fabric/api/container/ContainerFactory.java +++ b/fabric-containers/src/main/java/net/fabricmc/fabric/api/container/ContainerFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,13 +24,12 @@ public interface ContainerFactory { /** - * * Creates the new object. * - * @param syncId The container synchronization ID. + * @param syncId The container synchronization ID. * @param identifier the Identifier is the name that was used when registering the factory - * @param player the player that is opening the gui/container - * @param buf the buffer contains the same data that was provided with {@Link ContainerProviderRegistry.openContainer} + * @param player the player that is opening the gui/container + * @param buf the buffer contains the same data that was provided with {@Link ContainerProviderRegistry.openContainer} * @return the new gui or container */ T create(int syncId, Identifier identifier, PlayerEntity player, PacketByteBuf buf); diff --git a/fabric-containers/src/main/java/net/fabricmc/fabric/api/container/ContainerProviderRegistry.java b/fabric-containers/src/main/java/net/fabricmc/fabric/api/container/ContainerProviderRegistry.java index 4acabaf35e..ae6d05b8b7 100644 --- a/fabric-containers/src/main/java/net/fabricmc/fabric/api/container/ContainerProviderRegistry.java +++ b/fabric-containers/src/main/java/net/fabricmc/fabric/api/container/ContainerProviderRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,31 +31,28 @@ public interface ContainerProviderRegistry { ContainerProviderRegistry INSTANCE = ContainerProviderImpl.INSTANCE; /** - * * Register a "packet buffer -> container" factory. This is used both on the client and server side. * * @param identifier a shared identifier, this identifier should also be used to register a container using {@link ScreenProviderRegistry} - * @param factory the ContainerFactory that should return a new {@link Container} + * @param factory the ContainerFactory that should return a new {@link Container} */ void registerFactory(Identifier identifier, ContainerFactory factory); /** - * * Open a modded container. * * @param identifier the identifier that was used when registering the container - * @param player the player that should open the container - * @param writer a PacketByteBuf where data can be written to, this data is then accessible by the container factory when creating the container or the gui + * @param player the player that should open the container + * @param writer a PacketByteBuf where data can be written to, this data is then accessible by the container factory when creating the container or the gui */ void openContainer(Identifier identifier, ServerPlayerEntity player, Consumer writer); /** - * * Open a modded container. This should be called on the server side - it has no effect on the client side. * * @param identifier the identifier that was used when registering the container - * @param player the player that should open the container - * @param writer a PacketByteBuf where data can be written to, this data is then accessible by the container factory when creating the container or the gui + * @param player the player that should open the container + * @param writer a PacketByteBuf where data can be written to, this data is then accessible by the container factory when creating the container or the gui */ void openContainer(Identifier identifier, PlayerEntity player, Consumer writer); } diff --git a/fabric-containers/src/main/java/net/fabricmc/fabric/impl/client/gui/ScreenProviderRegistryImpl.java b/fabric-containers/src/main/java/net/fabricmc/fabric/impl/client/gui/ScreenProviderRegistryImpl.java index 672b5d957d..2f83ba7ac5 100644 --- a/fabric-containers/src/main/java/net/fabricmc/fabric/impl/client/gui/ScreenProviderRegistryImpl.java +++ b/fabric-containers/src/main/java/net/fabricmc/fabric/impl/client/gui/ScreenProviderRegistryImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -54,7 +54,7 @@ public void registerFactory(Identifier identifier, ContainerFactory void registerFactory(Identifier identifier, ContainerScreenFactory containerScreenFactory) { registerFactory(identifier, (syncId, identifier1, player, buf) -> { C container = ContainerProviderImpl.INSTANCE.createContainer(syncId, identifier1, player, buf); - if(container == null){ + if (container == null) { LOGGER.error("Could not open container for {} - a null object was created!", identifier1.toString()); return null; } diff --git a/fabric-containers/src/main/java/net/fabricmc/fabric/impl/container/ContainerProviderImpl.java b/fabric-containers/src/main/java/net/fabricmc/fabric/impl/container/ContainerProviderImpl.java index cba50aaed4..a6dd62001c 100644 --- a/fabric-containers/src/main/java/net/fabricmc/fabric/impl/container/ContainerProviderImpl.java +++ b/fabric-containers/src/main/java/net/fabricmc/fabric/impl/container/ContainerProviderImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -78,14 +78,14 @@ public void openContainer(Identifier identifier, ServerPlayerEntity player, Cons clonedBuf.readUnsignedByte(); Container container = createContainer(syncId, identifier, player, clonedBuf); - if(container == null){ + if (container == null) { return; } player.container = container; player.container.addListener(player); } - public C createContainer(int syncId, Identifier identifier, PlayerEntity player, PacketByteBuf buf){ + public C createContainer(int syncId, Identifier identifier, PlayerEntity player, PacketByteBuf buf) { ContainerFactory factory = FACTORIES.get(identifier); if (factory == null) { LOGGER.error("No container factory found for {}!", identifier.toString()); diff --git a/fabric-containers/src/main/java/net/fabricmc/fabric/impl/container/SyncIdProvider.java b/fabric-containers/src/main/java/net/fabricmc/fabric/impl/container/SyncIdProvider.java index 1d66fbcadd..d8d38f31cc 100644 --- a/fabric-containers/src/main/java/net/fabricmc/fabric/impl/container/SyncIdProvider.java +++ b/fabric-containers/src/main/java/net/fabricmc/fabric/impl/container/SyncIdProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-containers/src/main/java/net/fabricmc/fabric/mixin/container/MixinServerPlayerEntity.java b/fabric-containers/src/main/java/net/fabricmc/fabric/mixin/container/MixinServerPlayerEntity.java index c6219a2fac..600e9710c8 100644 --- a/fabric-containers/src/main/java/net/fabricmc/fabric/mixin/container/MixinServerPlayerEntity.java +++ b/fabric-containers/src/main/java/net/fabricmc/fabric/mixin/container/MixinServerPlayerEntity.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,9 +23,11 @@ @Mixin(ServerPlayerEntity.class) public abstract class MixinServerPlayerEntity implements SyncIdProvider { - @Shadow private int containerSyncId; + @Shadow + private int containerSyncId; - @Shadow protected abstract void incrementContainerSyncId(); + @Shadow + protected abstract void incrementContainerSyncId(); @Override public int fabric_incrementSyncId() { diff --git a/fabric-content-registries/src/main/java/net/fabricmc/fabric/api/registry/CompostingChanceRegistry.java b/fabric-content-registries/src/main/java/net/fabricmc/fabric/api/registry/CompostingChanceRegistry.java index 58bc8b29a1..77bf3015bf 100644 --- a/fabric-content-registries/src/main/java/net/fabricmc/fabric/api/registry/CompostingChanceRegistry.java +++ b/fabric-content-registries/src/main/java/net/fabricmc/fabric/api/registry/CompostingChanceRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-content-registries/src/main/java/net/fabricmc/fabric/api/registry/FlammableBlockRegistry.java b/fabric-content-registries/src/main/java/net/fabricmc/fabric/api/registry/FlammableBlockRegistry.java index 065fd8d9f1..2db07d132a 100644 --- a/fabric-content-registries/src/main/java/net/fabricmc/fabric/api/registry/FlammableBlockRegistry.java +++ b/fabric-content-registries/src/main/java/net/fabricmc/fabric/api/registry/FlammableBlockRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-content-registries/src/main/java/net/fabricmc/fabric/api/registry/FuelRegistry.java b/fabric-content-registries/src/main/java/net/fabricmc/fabric/api/registry/FuelRegistry.java index 8a00017b33..23861caf52 100644 --- a/fabric-content-registries/src/main/java/net/fabricmc/fabric/api/registry/FuelRegistry.java +++ b/fabric-content-registries/src/main/java/net/fabricmc/fabric/api/registry/FuelRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-content-registries/src/main/java/net/fabricmc/fabric/api/registry/LootEntryTypeRegistry.java b/fabric-content-registries/src/main/java/net/fabricmc/fabric/api/registry/LootEntryTypeRegistry.java index 315c99e914..251e2bab65 100644 --- a/fabric-content-registries/src/main/java/net/fabricmc/fabric/api/registry/LootEntryTypeRegistry.java +++ b/fabric-content-registries/src/main/java/net/fabricmc/fabric/api/registry/LootEntryTypeRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-content-registries/src/main/java/net/fabricmc/fabric/api/util/Block2ObjectMap.java b/fabric-content-registries/src/main/java/net/fabricmc/fabric/api/util/Block2ObjectMap.java index 0ae014c1e9..bb46d53714 100644 --- a/fabric-content-registries/src/main/java/net/fabricmc/fabric/api/util/Block2ObjectMap.java +++ b/fabric-content-registries/src/main/java/net/fabricmc/fabric/api/util/Block2ObjectMap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,16 +17,20 @@ package net.fabricmc.fabric.api.util; import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemProvider; import net.minecraft.tag.Tag; public interface Block2ObjectMap { V get(Block block); + void add(Block block, V value); + void add(Tag tag, V value); + void remove(Block block); + void remove(Tag tag); + void clear(Block block); + void clear(Tag tag); } diff --git a/fabric-content-registries/src/main/java/net/fabricmc/fabric/api/util/Item2ObjectMap.java b/fabric-content-registries/src/main/java/net/fabricmc/fabric/api/util/Item2ObjectMap.java index b402d94b3a..a035a3c0dd 100644 --- a/fabric-content-registries/src/main/java/net/fabricmc/fabric/api/util/Item2ObjectMap.java +++ b/fabric-content-registries/src/main/java/net/fabricmc/fabric/api/util/Item2ObjectMap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,10 +22,16 @@ public interface Item2ObjectMap { V get(ItemProvider item); + void add(ItemProvider item, V value); + void add(Tag tag, V value); + void remove(ItemProvider item); + void remove(Tag tag); + void clear(ItemProvider item); + void clear(Tag tag); } diff --git a/fabric-content-registries/src/main/java/net/fabricmc/fabric/impl/registry/CompostingChanceRegistryImpl.java b/fabric-content-registries/src/main/java/net/fabricmc/fabric/impl/registry/CompostingChanceRegistryImpl.java index 8e4ef25bf6..0ce346581d 100644 --- a/fabric-content-registries/src/main/java/net/fabricmc/fabric/impl/registry/CompostingChanceRegistryImpl.java +++ b/fabric-content-registries/src/main/java/net/fabricmc/fabric/impl/registry/CompostingChanceRegistryImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,9 +22,6 @@ import net.minecraft.item.ItemProvider; import net.minecraft.tag.Tag; -import java.util.ArrayList; -import java.util.List; - public class CompostingChanceRegistryImpl implements CompostingChanceRegistry { @Override public Float get(ItemProvider item) { diff --git a/fabric-content-registries/src/main/java/net/fabricmc/fabric/impl/registry/FireBlockHooks.java b/fabric-content-registries/src/main/java/net/fabricmc/fabric/impl/registry/FireBlockHooks.java index 8566a044cd..ed781240f5 100644 --- a/fabric-content-registries/src/main/java/net/fabricmc/fabric/impl/registry/FireBlockHooks.java +++ b/fabric-content-registries/src/main/java/net/fabricmc/fabric/impl/registry/FireBlockHooks.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,6 @@ package net.fabricmc.fabric.impl.registry; import net.fabricmc.fabric.api.registry.FlammableBlockRegistry; -import net.minecraft.block.Block; import net.minecraft.block.BlockState; public interface FireBlockHooks { diff --git a/fabric-content-registries/src/main/java/net/fabricmc/fabric/impl/registry/FlammableBlockRegistryImpl.java b/fabric-content-registries/src/main/java/net/fabricmc/fabric/impl/registry/FlammableBlockRegistryImpl.java index e3e4f1d3bd..06bcaeda2b 100644 --- a/fabric-content-registries/src/main/java/net/fabricmc/fabric/impl/registry/FlammableBlockRegistryImpl.java +++ b/fabric-content-registries/src/main/java/net/fabricmc/fabric/impl/registry/FlammableBlockRegistryImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,10 +16,7 @@ package net.fabricmc.fabric.impl.registry; -import it.unimi.dsi.fastutil.objects.Object2IntMap; -import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import net.fabricmc.fabric.api.registry.FlammableBlockRegistry; -import net.fabricmc.fabric.api.resource.IdentifiableResourceReloadListener; import net.fabricmc.fabric.api.resource.ResourceManagerHelper; import net.fabricmc.fabric.api.resource.ResourceReloadListenerKeys; import net.fabricmc.fabric.api.resource.SimpleSynchronousResourceReloadListener; @@ -28,13 +25,11 @@ import net.minecraft.resource.ResourceType; import net.minecraft.tag.Tag; import net.minecraft.util.Identifier; -import net.minecraft.util.profiler.Profiler; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.Map; -import java.util.concurrent.CompletableFuture; public class FlammableBlockRegistryImpl implements FlammableBlockRegistry, SimpleSynchronousResourceReloadListener { private static final FlammableBlockRegistry.Entry REMOVED = new FlammableBlockRegistry.Entry(0, 0); diff --git a/fabric-content-registries/src/main/java/net/fabricmc/fabric/impl/registry/FuelRegistryImpl.java b/fabric-content-registries/src/main/java/net/fabricmc/fabric/impl/registry/FuelRegistryImpl.java index c588a711d6..7908230f53 100644 --- a/fabric-content-registries/src/main/java/net/fabricmc/fabric/impl/registry/FuelRegistryImpl.java +++ b/fabric-content-registries/src/main/java/net/fabricmc/fabric/impl/registry/FuelRegistryImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-content-registries/src/main/java/net/fabricmc/fabric/impl/registry/LootEntryTypeRegistryImpl.java b/fabric-content-registries/src/main/java/net/fabricmc/fabric/impl/registry/LootEntryTypeRegistryImpl.java index fa3c0f0ce4..c07cad5c21 100644 --- a/fabric-content-registries/src/main/java/net/fabricmc/fabric/impl/registry/LootEntryTypeRegistryImpl.java +++ b/fabric-content-registries/src/main/java/net/fabricmc/fabric/impl/registry/LootEntryTypeRegistryImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,8 +20,6 @@ import net.minecraft.world.loot.entry.LootEntries; import net.minecraft.world.loot.entry.LootEntry; -import java.lang.invoke.MethodHandle; -import java.lang.invoke.MethodHandles; import java.lang.reflect.Method; import java.util.function.Consumer; @@ -50,7 +48,8 @@ public final class LootEntryTypeRegistryImpl implements LootEntryTypeRegistry { } } - private LootEntryTypeRegistryImpl() {} + private LootEntryTypeRegistryImpl() { + } @Override public void register(LootEntry.Serializer serializer) { diff --git a/fabric-content-registries/src/main/java/net/fabricmc/fabric/mixin/registryextras/MixinAbstractFurnaceBlockEntity.java b/fabric-content-registries/src/main/java/net/fabricmc/fabric/mixin/registryextras/MixinAbstractFurnaceBlockEntity.java index 7cb1587c44..e1bec9ae03 100644 --- a/fabric-content-registries/src/main/java/net/fabricmc/fabric/mixin/registryextras/MixinAbstractFurnaceBlockEntity.java +++ b/fabric-content-registries/src/main/java/net/fabricmc/fabric/mixin/registryextras/MixinAbstractFurnaceBlockEntity.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-content-registries/src/main/java/net/fabricmc/fabric/mixin/registryextras/MixinFireBlock.java b/fabric-content-registries/src/main/java/net/fabricmc/fabric/mixin/registryextras/MixinFireBlock.java index 43ee0279dc..a78d9036d1 100644 --- a/fabric-content-registries/src/main/java/net/fabricmc/fabric/mixin/registryextras/MixinFireBlock.java +++ b/fabric-content-registries/src/main/java/net/fabricmc/fabric/mixin/registryextras/MixinFireBlock.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-crash-report-info/src/main/java/net/fabricmc/fabric/mixin/crash/MixinCrashReport.java b/fabric-crash-report-info/src/main/java/net/fabricmc/fabric/mixin/crash/MixinCrashReport.java index 6f23d54e8e..98b1a2bde3 100644 --- a/fabric-crash-report-info/src/main/java/net/fabricmc/fabric/mixin/crash/MixinCrashReport.java +++ b/fabric-crash-report-info/src/main/java/net/fabricmc/fabric/mixin/crash/MixinCrashReport.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,8 +26,6 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import java.util.*; - @Mixin(CrashReport.class) public abstract class MixinCrashReport { @Shadow @@ -53,4 +51,4 @@ private void fillSystemDetails(CallbackInfo info) { return modString.toString(); }); } -} \ No newline at end of file +} diff --git a/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/block/BlockAttackInteractionAware.java b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/block/BlockAttackInteractionAware.java index 9223d1ce0b..87cba2f7de 100644 --- a/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/block/BlockAttackInteractionAware.java +++ b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/block/BlockAttackInteractionAware.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/block/BlockPickInteractionAware.java b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/block/BlockPickInteractionAware.java index 1c83a3e673..3689a1cc04 100644 --- a/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/block/BlockPickInteractionAware.java +++ b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/block/BlockPickInteractionAware.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/entity/EntityPickInteractionAware.java b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/entity/EntityPickInteractionAware.java index 31343cd598..7bf7e0c1b1 100644 --- a/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/entity/EntityPickInteractionAware.java +++ b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/entity/EntityPickInteractionAware.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/client/player/ClientPickBlockApplyCallback.java b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/client/player/ClientPickBlockApplyCallback.java index 1c1c28db07..cdfbdffb7e 100644 --- a/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/client/player/ClientPickBlockApplyCallback.java +++ b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/client/player/ClientPickBlockApplyCallback.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/client/player/ClientPickBlockCallback.java b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/client/player/ClientPickBlockCallback.java index 2be7a384c6..6f26c2d155 100644 --- a/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/client/player/ClientPickBlockCallback.java +++ b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/client/player/ClientPickBlockCallback.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/client/player/ClientPickBlockGatherCallback.java b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/client/player/ClientPickBlockGatherCallback.java index e1747c8a76..4ffc6d080a 100644 --- a/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/client/player/ClientPickBlockGatherCallback.java +++ b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/client/player/ClientPickBlockGatherCallback.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/player/AttackBlockCallback.java b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/player/AttackBlockCallback.java index 97aadfa373..1c5acefb78 100644 --- a/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/player/AttackBlockCallback.java +++ b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/player/AttackBlockCallback.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,12 +28,12 @@ /** * Callback for left-clicking ("attacking") a block. * Is hooked in before the spectator check, so make sure to check for the player's game mode as well! - * + *

* Upon return: * - SUCCESS cancels further processing and, on the client, sends a packet to the server. * - PASS falls back to further processing. * - FAIL cancels further processing and does not send a packet to the server. - * + *

* ATTACK_BLOCK does not let you control the packet sending process yet. */ public interface AttackBlockCallback { diff --git a/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/player/AttackEntityCallback.java b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/player/AttackEntityCallback.java index 17129cb6f6..76e366aacf 100644 --- a/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/player/AttackEntityCallback.java +++ b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/player/AttackEntityCallback.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,7 +28,7 @@ /** * Callback for left-clicking ("attacking") an entity. * Is hooked in before the spectator check, so make sure to check for the player's game mode as well! - * + *

* Upon return: * - SUCCESS cancels further processing and, on the client, sends a packet to the server. * - PASS falls back to further processing. diff --git a/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/player/UseBlockCallback.java b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/player/UseBlockCallback.java index a654807a22..5f4fd742da 100644 --- a/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/player/UseBlockCallback.java +++ b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/player/UseBlockCallback.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,7 @@ /** * Callback for right-clicking ("using") a block. * Is hooked in before the spectator check, so make sure to check for the player's game mode as well! - * + *

* Upon return: * - SUCCESS cancels further processing and, on the client, sends a packet to the server. * - PASS falls back to further processing. diff --git a/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/player/UseEntityCallback.java b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/player/UseEntityCallback.java index 4cde9dc5c8..94786ef1a0 100644 --- a/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/player/UseEntityCallback.java +++ b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/player/UseEntityCallback.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,7 +28,7 @@ /** * Callback for right-clicking ("using") an entity. * Is hooked in before the spectator check, so make sure to check for the player's game mode as well! - * + *

* Upon return: * - SUCCESS cancels further processing and, on the client, sends a packet to the server. * - PASS falls back to further processing. diff --git a/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/player/UseItemCallback.java b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/player/UseItemCallback.java index 10c4cfc526..38e27d5b5e 100644 --- a/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/player/UseItemCallback.java +++ b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/api/event/player/UseItemCallback.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,7 +26,7 @@ /** * Callback for right-clicking ("using") an item. * Is hooked in before the spectator check, so make sure to check for the player's game mode as well! - * + *

* Upon return: * - SUCCESS cancels further processing and, on the client, sends a packet to the server. * - PASS falls back to further processing. diff --git a/fabric-events-interaction/src/main/java/net/fabricmc/fabric/impl/event/InteractionEventsRouter.java b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/impl/event/InteractionEventsRouter.java index 9d7669a1ca..afc9fcfef6 100644 --- a/fabric-events-interaction/src/main/java/net/fabricmc/fabric/impl/event/InteractionEventsRouter.java +++ b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/impl/event/InteractionEventsRouter.java @@ -1,3 +1,19 @@ +/* + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.fabricmc.fabric.impl.event; import net.fabricmc.api.ModInitializer; @@ -7,21 +23,21 @@ import net.minecraft.util.ActionResult; public class InteractionEventsRouter implements ModInitializer { - @Override - public void onInitialize() { - AttackBlockCallback.EVENT.register((player, world, hand, pos, direction) -> { - BlockState state = world.getBlockState(pos); - if (state instanceof BlockAttackInteractionAware) { - if (((BlockAttackInteractionAware) state).onAttackInteraction(state, world, pos, player, hand, direction)) { - return ActionResult.FAIL; - } - } else if (state.getBlock() instanceof BlockAttackInteractionAware) { - if (((BlockAttackInteractionAware) state.getBlock()).onAttackInteraction(state, world, pos, player, hand, direction)) { - return ActionResult.FAIL; - } - } + @Override + public void onInitialize() { + AttackBlockCallback.EVENT.register((player, world, hand, pos, direction) -> { + BlockState state = world.getBlockState(pos); + if (state instanceof BlockAttackInteractionAware) { + if (((BlockAttackInteractionAware) state).onAttackInteraction(state, world, pos, player, hand, direction)) { + return ActionResult.FAIL; + } + } else if (state.getBlock() instanceof BlockAttackInteractionAware) { + if (((BlockAttackInteractionAware) state.getBlock()).onAttackInteraction(state, world, pos, player, hand, direction)) { + return ActionResult.FAIL; + } + } - return ActionResult.PASS; - }); - } + return ActionResult.PASS; + }); + } } diff --git a/fabric-events-interaction/src/main/java/net/fabricmc/fabric/impl/event/InteractionEventsRouterClient.java b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/impl/event/InteractionEventsRouterClient.java index 20214c2edc..c85a9e0ef7 100644 --- a/fabric-events-interaction/src/main/java/net/fabricmc/fabric/impl/event/InteractionEventsRouterClient.java +++ b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/impl/event/InteractionEventsRouterClient.java @@ -1,3 +1,19 @@ +/* + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.fabricmc.fabric.impl.event; import net.fabricmc.api.ClientModInitializer; @@ -13,26 +29,26 @@ import net.minecraft.world.BlockView; public class InteractionEventsRouterClient implements ClientModInitializer { - @Override - public void onInitializeClient() { - ClientPickBlockGatherCallback.EVENT.register(((player, result) -> { - if (result instanceof BlockHitResult) { - BlockView view = player.getEntityWorld(); - BlockPos pos = ((BlockHitResult) result).getBlockPos(); - BlockState state = view.getBlockState(pos); + @Override + public void onInitializeClient() { + ClientPickBlockGatherCallback.EVENT.register(((player, result) -> { + if (result instanceof BlockHitResult) { + BlockView view = player.getEntityWorld(); + BlockPos pos = ((BlockHitResult) result).getBlockPos(); + BlockState state = view.getBlockState(pos); - if (state.getBlock() instanceof BlockPickInteractionAware) { - return (((BlockPickInteractionAware) state.getBlock()).getPickedStack(state, view, pos, player, result)); - } - } else if (result instanceof EntityHitResult) { - Entity entity = ((EntityHitResult) result).getEntity(); + if (state.getBlock() instanceof BlockPickInteractionAware) { + return (((BlockPickInteractionAware) state.getBlock()).getPickedStack(state, view, pos, player, result)); + } + } else if (result instanceof EntityHitResult) { + Entity entity = ((EntityHitResult) result).getEntity(); - if (entity instanceof EntityPickInteractionAware) { - return ((EntityPickInteractionAware) entity).getPickedStack(player, result); - } - } + if (entity instanceof EntityPickInteractionAware) { + return ((EntityPickInteractionAware) entity).getPickedStack(player, result); + } + } - return ItemStack.EMPTY; - })); - } + return ItemStack.EMPTY; + })); + } } diff --git a/fabric-events-interaction/src/main/java/net/fabricmc/fabric/mixin/eventsinteraction/MixinClientPlayerInteractionManager.java b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/mixin/eventsinteraction/MixinClientPlayerInteractionManager.java index 04ac335b65..911f90dec6 100644 --- a/fabric-events-interaction/src/main/java/net/fabricmc/fabric/mixin/eventsinteraction/MixinClientPlayerInteractionManager.java +++ b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/mixin/eventsinteraction/MixinClientPlayerInteractionManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-events-interaction/src/main/java/net/fabricmc/fabric/mixin/eventsinteraction/MixinMinecraftClient.java b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/mixin/eventsinteraction/MixinMinecraftClient.java index 0d7bf3beb3..60125d9a5e 100644 --- a/fabric-events-interaction/src/main/java/net/fabricmc/fabric/mixin/eventsinteraction/MixinMinecraftClient.java +++ b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/mixin/eventsinteraction/MixinMinecraftClient.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,7 +32,6 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.ModifyVariable; -import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(MinecraftClient.class) @@ -96,6 +95,7 @@ private void fabric_doItemPickWrapper(CallbackInfo info) { @Shadow public abstract void doItemPick(); + @Shadow public abstract ItemStack addBlockEntityNbt(ItemStack itemStack_1, BlockEntity blockEntity_1); diff --git a/fabric-events-interaction/src/main/java/net/fabricmc/fabric/mixin/eventsinteraction/MixinServerPlayNetworkHandler.java b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/mixin/eventsinteraction/MixinServerPlayNetworkHandler.java index d29f79a5f6..322ef27b44 100644 --- a/fabric-events-interaction/src/main/java/net/fabricmc/fabric/mixin/eventsinteraction/MixinServerPlayNetworkHandler.java +++ b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/mixin/eventsinteraction/MixinServerPlayNetworkHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-events-interaction/src/main/java/net/fabricmc/fabric/mixin/eventsinteraction/MixinServerPlayerEntity.java b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/mixin/eventsinteraction/MixinServerPlayerEntity.java index e171159918..20a2c862af 100644 --- a/fabric-events-interaction/src/main/java/net/fabricmc/fabric/mixin/eventsinteraction/MixinServerPlayerEntity.java +++ b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/mixin/eventsinteraction/MixinServerPlayerEntity.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-events-interaction/src/main/java/net/fabricmc/fabric/mixin/eventsinteraction/MixinServerPlayerInteractionManager.java b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/mixin/eventsinteraction/MixinServerPlayerInteractionManager.java index 95e7fac063..b73f5721d8 100644 --- a/fabric-events-interaction/src/main/java/net/fabricmc/fabric/mixin/eventsinteraction/MixinServerPlayerInteractionManager.java +++ b/fabric-events-interaction/src/main/java/net/fabricmc/fabric/mixin/eventsinteraction/MixinServerPlayerInteractionManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/api/event/client/ClientTickCallback.java b/fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/api/event/client/ClientTickCallback.java index d31e904dcc..e2aacfa456 100644 --- a/fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/api/event/client/ClientTickCallback.java +++ b/fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/api/event/client/ClientTickCallback.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/api/event/server/ServerStartCallback.java b/fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/api/event/server/ServerStartCallback.java index 7ffe4163b6..836677d303 100644 --- a/fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/api/event/server/ServerStartCallback.java +++ b/fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/api/event/server/ServerStartCallback.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/api/event/server/ServerStopCallback.java b/fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/api/event/server/ServerStopCallback.java index 758e0f13da..fea2c82b41 100644 --- a/fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/api/event/server/ServerStopCallback.java +++ b/fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/api/event/server/ServerStopCallback.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/api/event/server/ServerTickCallback.java b/fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/api/event/server/ServerTickCallback.java index 7582548eed..de712b879e 100644 --- a/fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/api/event/server/ServerTickCallback.java +++ b/fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/api/event/server/ServerTickCallback.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/api/event/world/WorldTickCallback.java b/fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/api/event/world/WorldTickCallback.java index 9816a7ad55..7e2b21a7af 100644 --- a/fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/api/event/world/WorldTickCallback.java +++ b/fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/api/event/world/WorldTickCallback.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/mixin/eventslifecycle/MixinMinecraftClient.java b/fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/mixin/eventslifecycle/MixinMinecraftClient.java index 0a5239932a..e89201a40a 100644 --- a/fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/mixin/eventslifecycle/MixinMinecraftClient.java +++ b/fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/mixin/eventslifecycle/MixinMinecraftClient.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,12 +17,8 @@ package net.fabricmc.fabric.mixin.eventslifecycle; import net.fabricmc.fabric.api.event.client.ClientTickCallback; -import net.fabricmc.fabric.api.event.world.WorldTickCallback; import net.minecraft.client.MinecraftClient; -import net.minecraft.util.profiler.DisableableProfiler; -import net.minecraft.world.World; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; diff --git a/fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/mixin/eventslifecycle/MixinMinecraftServer.java b/fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/mixin/eventslifecycle/MixinMinecraftServer.java index 86dafe3bbc..84897d0215 100644 --- a/fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/mixin/eventslifecycle/MixinMinecraftServer.java +++ b/fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/mixin/eventslifecycle/MixinMinecraftServer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,9 +20,7 @@ import net.fabricmc.fabric.api.event.server.ServerStopCallback; import net.fabricmc.fabric.api.event.server.ServerTickCallback; import net.minecraft.server.MinecraftServer; -import net.minecraft.util.profiler.DisableableProfiler; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; diff --git a/fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/mixin/eventslifecycle/MixinWorld.java b/fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/mixin/eventslifecycle/MixinWorld.java index 70689d1785..aa21af5cd6 100644 --- a/fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/mixin/eventslifecycle/MixinWorld.java +++ b/fabric-events-lifecycle/src/main/java/net/fabricmc/fabric/mixin/eventslifecycle/MixinWorld.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,16 +17,12 @@ package net.fabricmc.fabric.mixin.eventslifecycle; import net.fabricmc.fabric.api.event.world.WorldTickCallback; -import net.minecraft.util.profiler.Profiler; import net.minecraft.world.World; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import java.util.function.BooleanSupplier; - @Mixin(World.class) public class MixinWorld { // TODO split into ClientWorld/ServerWorld ticks? mmm need more mappings diff --git a/fabric-item-groups/src/main/java/net/fabricmc/fabric/api/client/itemgroup/FabricItemGroupBuilder.java b/fabric-item-groups/src/main/java/net/fabricmc/fabric/api/client/itemgroup/FabricItemGroupBuilder.java index 20a8e6c174..95d17c28c2 100644 --- a/fabric-item-groups/src/main/java/net/fabricmc/fabric/api/client/itemgroup/FabricItemGroupBuilder.java +++ b/fabric-item-groups/src/main/java/net/fabricmc/fabric/api/client/itemgroup/FabricItemGroupBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,7 +37,6 @@ private FabricItemGroupBuilder(Identifier identifier) { } /** - * * Create a new Item Group Builder * * @param identifier the id will become the name of the ItemGroup and will be used for the translation key @@ -48,7 +47,6 @@ public static FabricItemGroupBuilder create(Identifier identifier) { } /** - * * This is used to add an icon to to the item group * * @param stackSupplier the supplier should return the item stack that you wish to show on the tab @@ -60,7 +58,6 @@ public FabricItemGroupBuilder icon(Supplier stackSupplier) { } /** - * * This allows for a custom list of items to be displayed in a tab, this enabled tabs to be created with a custom set of items * * @param appender Add ItemStack's to this list to show in the ItemGroup @@ -73,7 +70,6 @@ public FabricItemGroupBuilder stacksForDisplay(Consumer> appende } /** - * * This allows for a custom list of items to be displayed in a tab, this enabled tabs to be created with a custom set of items * * @param stacksForDisplay Add ItemStack's to this list to show in the ItemGroup @@ -85,20 +81,18 @@ public FabricItemGroupBuilder appendItems(Consumer> stacksForDis } /** - * * This is a single method that makes creating an ItemGroup with an icon one call * - * @param identifier the id will become the name of the ItemGroup and will be used for the translation key + * @param identifier the id will become the name of the ItemGroup and will be used for the translation key * @param stackSupplier the supplier should return the item stack that you wish to show on the tab * @return An instance of the built ItemGroup */ - public static ItemGroup build(Identifier identifier, Supplier stackSupplier){ + public static ItemGroup build(Identifier identifier, Supplier stackSupplier) { return new FabricItemGroupBuilder(identifier).icon(stackSupplier).build(); } /** - * - * Create an instance of the ItemGroup + * Create an instance of the ItemGroup * * @return An instance of the built ItemGroup */ @@ -112,7 +106,7 @@ public ItemStack createIcon() { @Override public void appendItems(DefaultedList stacks) { - if(stacksForDisplay != null){ + if (stacksForDisplay != null) { stacksForDisplay.accept(stacks); return; } diff --git a/fabric-item-groups/src/main/java/net/fabricmc/fabric/impl/itemgroup/CreativeGuiExtensions.java b/fabric-item-groups/src/main/java/net/fabricmc/fabric/impl/itemgroup/CreativeGuiExtensions.java index 09921b5679..25123ca6de 100644 --- a/fabric-item-groups/src/main/java/net/fabricmc/fabric/impl/itemgroup/CreativeGuiExtensions.java +++ b/fabric-item-groups/src/main/java/net/fabricmc/fabric/impl/itemgroup/CreativeGuiExtensions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-item-groups/src/main/java/net/fabricmc/fabric/impl/itemgroup/FabricCreativeGuiComponents.java b/fabric-item-groups/src/main/java/net/fabricmc/fabric/impl/itemgroup/FabricCreativeGuiComponents.java index a1ece3e694..825bc46052 100644 --- a/fabric-item-groups/src/main/java/net/fabricmc/fabric/impl/itemgroup/FabricCreativeGuiComponents.java +++ b/fabric-item-groups/src/main/java/net/fabricmc/fabric/impl/itemgroup/FabricCreativeGuiComponents.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -64,7 +64,7 @@ public void render(int mouseX, int mouseY, float float_1) { GlStateManager.color4f(1F, 1F, 1F, 1F); this.blit(this.x, this.y, (type == Type.NEXT ? 12 : 0), (active ? 0 : 12), 12, 12); - if(mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height){ + if (mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height) { gui.renderTooltip(I18n.translate("fabric.gui.creativeTabPage", extensions.fabric_currentPage() + 1, ((ItemGroup.GROUPS.length - 12) / 9) + 2), mouseX, mouseY); } } diff --git a/fabric-item-groups/src/main/java/net/fabricmc/fabric/impl/itemgroup/ItemGroupExtensions.java b/fabric-item-groups/src/main/java/net/fabricmc/fabric/impl/itemgroup/ItemGroupExtensions.java index 9ea5aa9ba5..45f2366e23 100644 --- a/fabric-item-groups/src/main/java/net/fabricmc/fabric/impl/itemgroup/ItemGroupExtensions.java +++ b/fabric-item-groups/src/main/java/net/fabricmc/fabric/impl/itemgroup/ItemGroupExtensions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-item-groups/src/main/java/net/fabricmc/fabric/mixin/itemgroup/MixinItemGroup.java b/fabric-item-groups/src/main/java/net/fabricmc/fabric/mixin/itemgroup/MixinItemGroup.java index ea9bcf6d40..d507b6d686 100644 --- a/fabric-item-groups/src/main/java/net/fabricmc/fabric/mixin/itemgroup/MixinItemGroup.java +++ b/fabric-item-groups/src/main/java/net/fabricmc/fabric/mixin/itemgroup/MixinItemGroup.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-item-groups/src/main/java/net/fabricmc/fabric/mixin/itemgroup/client/MixinCreativePlayerInventoryGui.java b/fabric-item-groups/src/main/java/net/fabricmc/fabric/mixin/itemgroup/client/MixinCreativePlayerInventoryGui.java index 6165324670..98bfe36d67 100644 --- a/fabric-item-groups/src/main/java/net/fabricmc/fabric/mixin/itemgroup/client/MixinCreativePlayerInventoryGui.java +++ b/fabric-item-groups/src/main/java/net/fabricmc/fabric/mixin/itemgroup/client/MixinCreativePlayerInventoryGui.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-item-groups/src/main/java/net/fabricmc/fabric/mixin/itemgroup/client/MixinItemGroup.java b/fabric-item-groups/src/main/java/net/fabricmc/fabric/mixin/itemgroup/client/MixinItemGroup.java index 7ca966b789..147164c503 100644 --- a/fabric-item-groups/src/main/java/net/fabricmc/fabric/mixin/itemgroup/client/MixinItemGroup.java +++ b/fabric-item-groups/src/main/java/net/fabricmc/fabric/mixin/itemgroup/client/MixinItemGroup.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,6 @@ import net.fabricmc.fabric.impl.itemgroup.FabricCreativeGuiComponents; import net.minecraft.item.ItemGroup; -import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; diff --git a/fabric-lib/src/main/java/net/fabricmc/fabric/api/event/Event.java b/fabric-lib/src/main/java/net/fabricmc/fabric/api/event/Event.java index 2f6ea663b6..4a78cb157c 100644 --- a/fabric-lib/src/main/java/net/fabricmc/fabric/api/event/Event.java +++ b/fabric-lib/src/main/java/net/fabricmc/fabric/api/event/Event.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,7 +32,7 @@ public abstract class Event { /** * Returns the invoker instance. - * + *

* An "invoker" is an object which hides multiple registered * listeners of type T under one instance of type T, executing * them and leaving early as necessary. diff --git a/fabric-lib/src/main/java/net/fabricmc/fabric/api/event/EventFactory.java b/fabric-lib/src/main/java/net/fabricmc/fabric/api/event/EventFactory.java index 5042ebe248..9213360a58 100644 --- a/fabric-lib/src/main/java/net/fabricmc/fabric/api/event/EventFactory.java +++ b/fabric-lib/src/main/java/net/fabricmc/fabric/api/event/EventFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,9 +50,9 @@ public static void invalidate() { /** * Create an "array-backed" Event instance. * - * @param type The listener class type. + * @param type The listener class type. * @param invokerFactory The invoker factory, combining multiple listeners into one instance. - * @param The listener type. + * @param The listener type. * @return The Event instance. */ public static Event createArrayBacked(Class type, Function invokerFactory) { @@ -61,15 +61,15 @@ public static Event createArrayBacked(Class type, Function inv /** * Create an "array-backed" Event instance with a custom empty invoker. - * + *

* Having a custom empty invoker (of type (...) -> {}) increases performance * relative to iterating over an empty array; however, it only really matters * if the event is executed thousands of times a second. * - * @param type The listener class type. - * @param emptyInvoker The custom empty invoker. + * @param type The listener class type. + * @param emptyInvoker The custom empty invoker. * @param invokerFactory The invoker factory, combining multiple listeners into one instance. - * @param The listener type. + * @param The listener type. * @return The Event instance. */ // TODO: Deprecate this once we have working codegen diff --git a/fabric-lib/src/main/java/net/fabricmc/fabric/api/util/NbtType.java b/fabric-lib/src/main/java/net/fabricmc/fabric/api/util/NbtType.java index 15d597162c..9311244958 100644 --- a/fabric-lib/src/main/java/net/fabricmc/fabric/api/util/NbtType.java +++ b/fabric-lib/src/main/java/net/fabricmc/fabric/api/util/NbtType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +24,7 @@ * * @see CompoundTag#containsKey(String, int) * @see Tag#idToString(int) - * + *

* For the current list of types, check with {@link Tag#TYPES}. */ public final class NbtType { diff --git a/fabric-lib/src/main/java/net/fabricmc/fabric/api/util/TriState.java b/fabric-lib/src/main/java/net/fabricmc/fabric/api/util/TriState.java index 5ed698368a..fe82544561 100644 --- a/fabric-lib/src/main/java/net/fabricmc/fabric/api/util/TriState.java +++ b/fabric-lib/src/main/java/net/fabricmc/fabric/api/util/TriState.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-lib/src/main/java/net/fabricmc/fabric/impl/event/ArrayBackedEvent.java b/fabric-lib/src/main/java/net/fabricmc/fabric/impl/event/ArrayBackedEvent.java index 8f383bf019..71b66325c6 100644 --- a/fabric-lib/src/main/java/net/fabricmc/fabric/impl/event/ArrayBackedEvent.java +++ b/fabric-lib/src/main/java/net/fabricmc/fabric/impl/event/ArrayBackedEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-lib/src/main/java/net/fabricmc/fabric/impl/event/EventFactoryImpl.java b/fabric-lib/src/main/java/net/fabricmc/fabric/impl/event/EventFactoryImpl.java index 292f07e70b..abdc53bb49 100644 --- a/fabric-lib/src/main/java/net/fabricmc/fabric/impl/event/EventFactoryImpl.java +++ b/fabric-lib/src/main/java/net/fabricmc/fabric/impl/event/EventFactoryImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,6 @@ import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType; -import java.lang.reflect.*; import java.util.ArrayList; import java.util.List; import java.util.function.Function; @@ -97,7 +96,7 @@ private static T buildEmptyInvoker(Class handlerClass, Function i final Object returnValue = defValue; //noinspection unchecked - return (T) Proxy.newProxyInstance(EventFactoryImpl.class.getClassLoader(), new Class[] { handlerClass }, + return (T) Proxy.newProxyInstance(EventFactoryImpl.class.getClassLoader(), new Class[]{handlerClass}, (proxy, method, args) -> returnValue); } } diff --git a/fabric-mining-levels/src/main/java/net/fabricmc/fabric/api/tag/FabricItemTags.java b/fabric-mining-levels/src/main/java/net/fabricmc/fabric/api/tag/FabricItemTags.java index 69e36f3a59..6c2383b77e 100644 --- a/fabric-mining-levels/src/main/java/net/fabricmc/fabric/api/tag/FabricItemTags.java +++ b/fabric-mining-levels/src/main/java/net/fabricmc/fabric/api/tag/FabricItemTags.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-mining-levels/src/main/java/net/fabricmc/fabric/api/tools/FabricToolTags.java b/fabric-mining-levels/src/main/java/net/fabricmc/fabric/api/tools/FabricToolTags.java index 47e9bfcac8..f25a74c1b1 100644 --- a/fabric-mining-levels/src/main/java/net/fabricmc/fabric/api/tools/FabricToolTags.java +++ b/fabric-mining-levels/src/main/java/net/fabricmc/fabric/api/tools/FabricToolTags.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-mining-levels/src/main/java/net/fabricmc/fabric/impl/tools/ToolManager.java b/fabric-mining-levels/src/main/java/net/fabricmc/fabric/impl/tools/ToolManager.java index b98fb29141..696aa92e83 100644 --- a/fabric-mining-levels/src/main/java/net/fabricmc/fabric/impl/tools/ToolManager.java +++ b/fabric-mining-levels/src/main/java/net/fabricmc/fabric/impl/tools/ToolManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,6 +30,7 @@ public final class ToolManager { public interface Entry { void setBreakByHand(boolean value); + void putBreakByTool(Tag tag, int miningLevel); } diff --git a/fabric-mining-levels/src/main/java/net/fabricmc/fabric/mixin/tools/MiningToolItemAccessor.java b/fabric-mining-levels/src/main/java/net/fabricmc/fabric/mixin/tools/MiningToolItemAccessor.java index 620ec9b3d9..8a3a88ab90 100644 --- a/fabric-mining-levels/src/main/java/net/fabricmc/fabric/mixin/tools/MiningToolItemAccessor.java +++ b/fabric-mining-levels/src/main/java/net/fabricmc/fabric/mixin/tools/MiningToolItemAccessor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-mining-levels/src/main/java/net/fabricmc/fabric/mixin/tools/MixinItemStack.java b/fabric-mining-levels/src/main/java/net/fabricmc/fabric/mixin/tools/MixinItemStack.java index ee959aff13..a9ed877036 100644 --- a/fabric-mining-levels/src/main/java/net/fabricmc/fabric/mixin/tools/MixinItemStack.java +++ b/fabric-mining-levels/src/main/java/net/fabricmc/fabric/mixin/tools/MixinItemStack.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,8 @@ package net.fabricmc.fabric.mixin.tools; -import net.fabricmc.fabric.impl.tools.ToolManager; import net.fabricmc.fabric.api.util.TriState; +import net.fabricmc.fabric.impl.tools.ToolManager; import net.minecraft.block.BlockState; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; diff --git a/fabric-models/src/main/java/net/fabricmc/fabric/api/client/model/ModelAppender.java b/fabric-models/src/main/java/net/fabricmc/fabric/api/client/model/ModelAppender.java index 224e4aa427..d433abd4fd 100644 --- a/fabric-models/src/main/java/net/fabricmc/fabric/api/client/model/ModelAppender.java +++ b/fabric-models/src/main/java/net/fabricmc/fabric/api/client/model/ModelAppender.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-models/src/main/java/net/fabricmc/fabric/api/client/model/ModelLoadingRegistry.java b/fabric-models/src/main/java/net/fabricmc/fabric/api/client/model/ModelLoadingRegistry.java index 81f2879285..ad15fe02f7 100644 --- a/fabric-models/src/main/java/net/fabricmc/fabric/api/client/model/ModelLoadingRegistry.java +++ b/fabric-models/src/main/java/net/fabricmc/fabric/api/client/model/ModelLoadingRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-models/src/main/java/net/fabricmc/fabric/api/client/model/ModelProviderContext.java b/fabric-models/src/main/java/net/fabricmc/fabric/api/client/model/ModelProviderContext.java index 7e9e79f813..072a334eff 100644 --- a/fabric-models/src/main/java/net/fabricmc/fabric/api/client/model/ModelProviderContext.java +++ b/fabric-models/src/main/java/net/fabricmc/fabric/api/client/model/ModelProviderContext.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,7 +26,7 @@ public interface ModelProviderContext { /** * Load a model using a {@link Identifier}, {@link ModelIdentifier}, ... - * + *

* Please note that the game engine keeps track of circular model loading calls on its own. * * @param id The model identifier. diff --git a/fabric-models/src/main/java/net/fabricmc/fabric/api/client/model/ModelProviderException.java b/fabric-models/src/main/java/net/fabricmc/fabric/api/client/model/ModelProviderException.java index b157386140..1d7899927e 100644 --- a/fabric-models/src/main/java/net/fabricmc/fabric/api/client/model/ModelProviderException.java +++ b/fabric-models/src/main/java/net/fabricmc/fabric/api/client/model/ModelProviderException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-models/src/main/java/net/fabricmc/fabric/api/client/model/ModelResourceProvider.java b/fabric-models/src/main/java/net/fabricmc/fabric/api/client/model/ModelResourceProvider.java index c2c790ce1d..e52e531a03 100644 --- a/fabric-models/src/main/java/net/fabricmc/fabric/api/client/model/ModelResourceProvider.java +++ b/fabric-models/src/main/java/net/fabricmc/fabric/api/client/model/ModelResourceProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,26 +17,25 @@ package net.fabricmc.fabric.api.client.model; import net.minecraft.client.render.model.UnbakedModel; -import net.minecraft.client.util.ModelIdentifier; import net.minecraft.util.Identifier; /** * Interface for model resource providers. - * + *

* Model resource providers hook the loading of model *files* from the resource tree; * that is, in vanilla, it handles going from "minecraft:block/stone" to a * "assets/minecraft/models/block/stone.json" file. - * + *

* This is where you want to add your own custom model formats. - * + *

* As providers are instantiated with a new provider, it is safe * (and recommended!) to cache information inside a loader. - * + *

* Keep in mind that only *one* ModelResourceProvider may respond to a given model * at any time. If you're writing, say, an OBJ loader, this means you could * easily conflict with another OBJ loader unless you take some precautions, * for example: - * + *

* a) Only load files with a mod-suffixed name, such as .architect.obj, * b) Only load files from an explicit list of namespaces, registered elsewhere. */ diff --git a/fabric-models/src/main/java/net/fabricmc/fabric/api/client/model/ModelVariantProvider.java b/fabric-models/src/main/java/net/fabricmc/fabric/api/client/model/ModelVariantProvider.java index eac625d9a5..476ad70652 100644 --- a/fabric-models/src/main/java/net/fabricmc/fabric/api/client/model/ModelVariantProvider.java +++ b/fabric-models/src/main/java/net/fabricmc/fabric/api/client/model/ModelVariantProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,22 +18,21 @@ import net.minecraft.client.render.model.UnbakedModel; import net.minecraft.client.util.ModelIdentifier; -import net.minecraft.util.Identifier; /** * Interface for model variant providers. - * + *

* Model variant providers hook the resolution of ModelIdentifiers. In vanilla, this is * the part where a "minecraft:stone#normal" identifier triggers the loading of a * "minecraft:models/stone" model ({@link ModelResourceProvider} handles the later step). - * + *

* The most common use of this is to cooperate with a {@link ModelAppender}, but it can * also allow you to add your own block- or item-state formats. To trigger the loading * of another model, use the passed {@link ModelProviderContext}. - * + *

* As every model loading is instantiated with a new provider, it is safe * (and recommended!) to cache information. - * + *

* Keep in mind that only *one* ModelVariantProvider may respond to a given model * at any time. */ diff --git a/fabric-models/src/main/java/net/fabricmc/fabric/impl/client/model/ModelLoaderHooks.java b/fabric-models/src/main/java/net/fabricmc/fabric/impl/client/model/ModelLoaderHooks.java index 333978e373..c4b7fbe4f9 100644 --- a/fabric-models/src/main/java/net/fabricmc/fabric/impl/client/model/ModelLoaderHooks.java +++ b/fabric-models/src/main/java/net/fabricmc/fabric/impl/client/model/ModelLoaderHooks.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,5 +22,6 @@ public interface ModelLoaderHooks { void fabric_addModel(ModelIdentifier id); + UnbakedModel fabric_loadModel(Identifier id); } diff --git a/fabric-models/src/main/java/net/fabricmc/fabric/impl/client/model/ModelLoadingRegistryImpl.java b/fabric-models/src/main/java/net/fabricmc/fabric/impl/client/model/ModelLoadingRegistryImpl.java index f0a85a5ef8..67cf708820 100644 --- a/fabric-models/src/main/java/net/fabricmc/fabric/impl/client/model/ModelLoadingRegistryImpl.java +++ b/fabric-models/src/main/java/net/fabricmc/fabric/impl/client/model/ModelLoadingRegistryImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,6 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import java.util.*; import java.util.function.Consumer; import java.util.function.Function; import java.util.stream.Collectors; diff --git a/fabric-models/src/main/java/net/fabricmc/fabric/mixin/client/model/MixinModelLoader.java b/fabric-models/src/main/java/net/fabricmc/fabric/mixin/client/model/MixinModelLoader.java index 78ddd60dbd..be9db76f4e 100644 --- a/fabric-models/src/main/java/net/fabricmc/fabric/mixin/client/model/MixinModelLoader.java +++ b/fabric-models/src/main/java/net/fabricmc/fabric/mixin/client/model/MixinModelLoader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,6 @@ package net.fabricmc.fabric.mixin.client.model; -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; import net.fabricmc.fabric.impl.client.model.ModelLoaderHooks; import net.fabricmc.fabric.impl.client.model.ModelLoadingRegistryImpl; import net.minecraft.client.render.model.ModelLoader; diff --git a/fabric-networking-blockentity/src/main/java/net/fabricmc/fabric/api/block/entity/BlockEntityClientSerializable.java b/fabric-networking-blockentity/src/main/java/net/fabricmc/fabric/api/block/entity/BlockEntityClientSerializable.java index 2207a03a06..f500f5b2a2 100644 --- a/fabric-networking-blockentity/src/main/java/net/fabricmc/fabric/api/block/entity/BlockEntityClientSerializable.java +++ b/fabric-networking-blockentity/src/main/java/net/fabricmc/fabric/api/block/entity/BlockEntityClientSerializable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,5 +24,6 @@ */ public interface BlockEntityClientSerializable { void fromClientTag(CompoundTag tag); + CompoundTag toClientTag(CompoundTag tag); } diff --git a/fabric-networking-blockentity/src/main/java/net/fabricmc/fabric/mixin/networkingblockentity/MixinBlockEntity.java b/fabric-networking-blockentity/src/main/java/net/fabricmc/fabric/mixin/networkingblockentity/MixinBlockEntity.java index 39a0a36dc7..756cababd4 100644 --- a/fabric-networking-blockentity/src/main/java/net/fabricmc/fabric/mixin/networkingblockentity/MixinBlockEntity.java +++ b/fabric-networking-blockentity/src/main/java/net/fabricmc/fabric/mixin/networkingblockentity/MixinBlockEntity.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-networking-blockentity/src/main/java/net/fabricmc/fabric/mixin/networkingblockentity/MixinClientPlayNetworkHandler.java b/fabric-networking-blockentity/src/main/java/net/fabricmc/fabric/mixin/networkingblockentity/MixinClientPlayNetworkHandler.java index 3fbda363e3..0fbcd906ea 100644 --- a/fabric-networking-blockentity/src/main/java/net/fabricmc/fabric/mixin/networkingblockentity/MixinClientPlayNetworkHandler.java +++ b/fabric-networking-blockentity/src/main/java/net/fabricmc/fabric/mixin/networkingblockentity/MixinClientPlayNetworkHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-networking/src/main/java/net/fabricmc/fabric/api/event/network/C2SPacketTypeCallback.java b/fabric-networking/src/main/java/net/fabricmc/fabric/api/event/network/C2SPacketTypeCallback.java index 8f4adc723a..c730c528fa 100644 --- a/fabric-networking/src/main/java/net/fabricmc/fabric/api/event/network/C2SPacketTypeCallback.java +++ b/fabric-networking/src/main/java/net/fabricmc/fabric/api/event/network/C2SPacketTypeCallback.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -51,7 +51,7 @@ public interface C2SPacketTypeCallback { * Accept a collection of types. * * @param client The player who is the source of the packet. - * @param types The provided collection of types. + * @param types The provided collection of types. */ void accept(PlayerEntity client, Collection types); } diff --git a/fabric-networking/src/main/java/net/fabricmc/fabric/api/event/network/S2CPacketTypeCallback.java b/fabric-networking/src/main/java/net/fabricmc/fabric/api/event/network/S2CPacketTypeCallback.java index a2d6169342..44f8911c69 100644 --- a/fabric-networking/src/main/java/net/fabricmc/fabric/api/event/network/S2CPacketTypeCallback.java +++ b/fabric-networking/src/main/java/net/fabricmc/fabric/api/event/network/S2CPacketTypeCallback.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-networking/src/main/java/net/fabricmc/fabric/api/network/ClientSidePacketRegistry.java b/fabric-networking/src/main/java/net/fabricmc/fabric/api/network/ClientSidePacketRegistry.java index 883854a281..902430d589 100644 --- a/fabric-networking/src/main/java/net/fabricmc/fabric/api/network/ClientSidePacketRegistry.java +++ b/fabric-networking/src/main/java/net/fabricmc/fabric/api/network/ClientSidePacketRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,9 +25,9 @@ /** * The client-side packet registry. - * + *

* It is used for: - * + *

* - registering client-side packet receivers (server -> client packets) * - sending packets to the server (client -> server packets). */ @@ -45,20 +45,20 @@ public interface ClientSidePacketRegistry extends PacketRegistry { /** * Send a packet to the server. - - * @param packet The packet to be sent. + * + * @param packet The packet to be sent. * @param completionListener Completion listener. Can be used to check for - * the success or failure of sending a given packet, among others. + * the success or failure of sending a given packet, among others. */ void sendToServer(Packet packet, GenericFutureListener> completionListener); /** * Send an identifier/buffer-based packet to the server. - - * @param id The packet identifier. - * @param buf The packet byte buffer. + * + * @param id The packet identifier. + * @param buf The packet byte buffer. * @param completionListener Completion listener. Can be used to check for - * the success or failure of sending a given packet, among others. + * the success or failure of sending a given packet, among others. */ default void sendToServer(Identifier id, PacketByteBuf buf, GenericFutureListener> completionListener) { sendToServer(toPacket(id, buf), completionListener); @@ -66,7 +66,7 @@ default void sendToServer(Identifier id, PacketByteBuf buf, GenericFutureListene /** * Send a packet to the server. - + * * @param packet The packet to be sent. */ default void sendToServer(Packet packet) { @@ -75,8 +75,8 @@ default void sendToServer(Packet packet) { /** * Send an identifier/buffer-based packet to the server. - - * @param id The packet identifier. + * + * @param id The packet identifier. * @param buf The packet byte buffer. */ default void sendToServer(Identifier id, PacketByteBuf buf) { diff --git a/fabric-networking/src/main/java/net/fabricmc/fabric/api/network/PacketConsumer.java b/fabric-networking/src/main/java/net/fabricmc/fabric/api/network/PacketConsumer.java index adc1a81d32..37c3689d9a 100644 --- a/fabric-networking/src/main/java/net/fabricmc/fabric/api/network/PacketConsumer.java +++ b/fabric-networking/src/main/java/net/fabricmc/fabric/api/network/PacketConsumer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,7 @@ public interface PacketConsumer { /** * Receive a CustomPayload-based packet. - * + *

* Please keep in mind that this CAN be called OUTSIDE of the main thread! * Most game operations are not thread-safe, so you should look into using * the thread task queue ({@link PacketContext#getTaskQueue()}) to split @@ -34,7 +34,7 @@ public interface PacketConsumer { * on the main thread). * * @param context The context (receiving player, side, etc.) - * @param buffer The byte buffer containing the received packet data. + * @param buffer The byte buffer containing the received packet data. */ void accept(PacketContext context, PacketByteBuf buffer); } diff --git a/fabric-networking/src/main/java/net/fabricmc/fabric/api/network/PacketContext.java b/fabric-networking/src/main/java/net/fabricmc/fabric/api/network/PacketContext.java index 98dffecf3c..d70ecb8f42 100644 --- a/fabric-networking/src/main/java/net/fabricmc/fabric/api/network/PacketContext.java +++ b/fabric-networking/src/main/java/net/fabricmc/fabric/api/network/PacketContext.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,13 +30,13 @@ public interface PacketContext { * Get the environment associated with the packet. * * @return EnvType.CLIENT if processing packet on the client side, - * EnvType.SERVER otherwise. + * EnvType.SERVER otherwise. */ EnvType getPacketEnvironment(); /** * Get the player associated with the packet. - * + *

* On the client side, this always returns the client-side player instance. * On the server side, it returns the player belonging to the client this * packet was sent by. @@ -47,15 +47,15 @@ public interface PacketContext { /** * Get the task queue for a given side. - * + *

* As Minecraft networking I/O is asynchronous, but a lot of its logic is * not thread-safe, it is recommended to do the following: - * + *

* - read and parse the PacketByteBuf, * - run the packet response logic through the main thread task queue via - * ThreadTaskQueue.execute(). The method will check if it's not already - * on the main thread in order to avoid unnecessary delays, so don't - * worry about that! + * ThreadTaskQueue.execute(). The method will check if it's not already + * on the main thread in order to avoid unnecessary delays, so don't + * worry about that! * * @return The thread task queue. */ diff --git a/fabric-networking/src/main/java/net/fabricmc/fabric/api/network/PacketRegistry.java b/fabric-networking/src/main/java/net/fabricmc/fabric/api/network/PacketRegistry.java index 854c51e4be..3355294617 100644 --- a/fabric-networking/src/main/java/net/fabricmc/fabric/api/network/PacketRegistry.java +++ b/fabric-networking/src/main/java/net/fabricmc/fabric/api/network/PacketRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,7 @@ public interface PacketRegistry { * Turn a (identifier, byte buffer) pair into a "custom payload" packet * suitable for sending in the PacketRegistry's sending direction. * - * @param id The identifier. + * @param id The identifier. * @param buf The byte buffer. * @return */ @@ -34,7 +34,7 @@ public interface PacketRegistry { /** * Register a packet. * - * @param id The packet Identifier. + * @param id The packet Identifier. * @param consumer The method used for handling the packet. */ void register(Identifier id, PacketConsumer consumer); diff --git a/fabric-networking/src/main/java/net/fabricmc/fabric/api/network/ServerSidePacketRegistry.java b/fabric-networking/src/main/java/net/fabricmc/fabric/api/network/ServerSidePacketRegistry.java index 6e1fbdd625..ce347477be 100644 --- a/fabric-networking/src/main/java/net/fabricmc/fabric/api/network/ServerSidePacketRegistry.java +++ b/fabric-networking/src/main/java/net/fabricmc/fabric/api/network/ServerSidePacketRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,12 +27,12 @@ /** * The server-side packet registry. - * + *

* It is used for: - * + *

* - registering server-side packet receivers (client -> server packets) * - sending packets to clients (server -> client packets). - * + *

* For iterating over clients in a server, see {@link PlayerStream}. */ public interface ServerSidePacketRegistry extends PacketRegistry { @@ -50,21 +50,21 @@ public interface ServerSidePacketRegistry extends PacketRegistry { /** * Send a packet to a given client. * - * @param player The given client. - * @param packet The packet to be sent. + * @param player The given client. + * @param packet The packet to be sent. * @param completionListener Completion listener. Can be used to check for - * the success or failure of sending a given packet, among others. + * the success or failure of sending a given packet, among others. */ void sendToPlayer(PlayerEntity player, Packet packet, GenericFutureListener> completionListener); /** * Send an identifier/buffer-based packet to a given client. * - * @param player The given client. - * @param id The packet identifier. - * @param buf The packet byte buffer. + * @param player The given client. + * @param id The packet identifier. + * @param buf The packet byte buffer. * @param completionListener Completion listener. Can be used to check for - * the success or failure of sending a given packet, among others. + * the success or failure of sending a given packet, among others. */ default void sendToPlayer(PlayerEntity player, Identifier id, PacketByteBuf buf, GenericFutureListener> completionListener) { sendToPlayer(player, toPacket(id, buf), completionListener); @@ -84,8 +84,8 @@ default void sendToPlayer(PlayerEntity player, Packet packet) { * Send an identifier/buffer-based packet to a given client. * * @param player The given client. - * @param id The packet identifier. - * @param buf The packet byte buffer. + * @param id The packet identifier. + * @param buf The packet byte buffer. */ default void sendToPlayer(PlayerEntity player, Identifier id, PacketByteBuf buf) { sendToPlayer(player, id, buf, null); diff --git a/fabric-networking/src/main/java/net/fabricmc/fabric/api/server/PlayerStream.java b/fabric-networking/src/main/java/net/fabricmc/fabric/api/server/PlayerStream.java index 0071666139..acb8b7d359 100644 --- a/fabric-networking/src/main/java/net/fabricmc/fabric/api/server/PlayerStream.java +++ b/fabric-networking/src/main/java/net/fabricmc/fabric/api/server/PlayerStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,7 +35,7 @@ /** * Helper streams for looking up players on a server. - * + *

* In general, most of these methods will only function with a {@link ServerWorld} instance. */ public final class PlayerStream { @@ -108,4 +108,4 @@ public static Stream around(World world, BlockPos pos, double radi double radiusSq = radius * radius; return world(world).filter((p) -> p.squaredDistanceTo(pos.getX(), pos.getY(), pos.getZ()) <= radiusSq); } -} \ No newline at end of file +} diff --git a/fabric-networking/src/main/java/net/fabricmc/fabric/impl/network/ClientSidePacketRegistryImpl.java b/fabric-networking/src/main/java/net/fabricmc/fabric/impl/network/ClientSidePacketRegistryImpl.java index 1118b13008..f7e3275edf 100644 --- a/fabric-networking/src/main/java/net/fabricmc/fabric/impl/network/ClientSidePacketRegistryImpl.java +++ b/fabric-networking/src/main/java/net/fabricmc/fabric/impl/network/ClientSidePacketRegistryImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-networking/src/main/java/net/fabricmc/fabric/impl/network/CustomPayloadC2SPacketAccessor.java b/fabric-networking/src/main/java/net/fabricmc/fabric/impl/network/CustomPayloadC2SPacketAccessor.java index 56782353af..bcce9eebfd 100644 --- a/fabric-networking/src/main/java/net/fabricmc/fabric/impl/network/CustomPayloadC2SPacketAccessor.java +++ b/fabric-networking/src/main/java/net/fabricmc/fabric/impl/network/CustomPayloadC2SPacketAccessor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,5 +25,6 @@ */ public interface CustomPayloadC2SPacketAccessor { Identifier getChannel(); + PacketByteBuf getData(); } diff --git a/fabric-networking/src/main/java/net/fabricmc/fabric/impl/network/PacketRegistryImpl.java b/fabric-networking/src/main/java/net/fabricmc/fabric/impl/network/PacketRegistryImpl.java index 4264107de0..ee9b34a5ec 100644 --- a/fabric-networking/src/main/java/net/fabricmc/fabric/impl/network/PacketRegistryImpl.java +++ b/fabric-networking/src/main/java/net/fabricmc/fabric/impl/network/PacketRegistryImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,6 @@ import org.apache.logging.log4j.Logger; import java.nio.charset.StandardCharsets; -import java.util.*; public abstract class PacketRegistryImpl implements PacketRegistry { protected static final Logger LOGGER = LogManager.getLogger(); @@ -63,9 +62,13 @@ public void unregister(Identifier id) { } protected abstract void onRegister(Identifier id); + protected abstract void onUnregister(Identifier id); + protected abstract Collection getIdCollectionFor(PacketContext context); + protected abstract void onReceivedRegisterPacket(PacketContext context, Collection ids); + protected abstract void onReceivedUnregisterPacket(PacketContext context, Collection ids); protected Packet createRegisterTypePacket(Identifier id, Collection ids) { @@ -122,9 +125,9 @@ private boolean acceptRegisterType(Identifier id, PacketContext context, PacketB /** * Hook for accepting packets used in Fabric mixins. * - * @param id The packet Identifier received. + * @param id The packet Identifier received. * @param context The packet context provided. - * @param buf The packet data buffer received. + * @param buf The packet data buffer received. * @return Whether or not the packet was handled by this packet registry. */ public boolean accept(Identifier id, PacketContext context, PacketByteBuf buf) { diff --git a/fabric-networking/src/main/java/net/fabricmc/fabric/impl/network/PacketTypes.java b/fabric-networking/src/main/java/net/fabricmc/fabric/impl/network/PacketTypes.java index ec384aa92a..5a2e6a4be3 100644 --- a/fabric-networking/src/main/java/net/fabricmc/fabric/impl/network/PacketTypes.java +++ b/fabric-networking/src/main/java/net/fabricmc/fabric/impl/network/PacketTypes.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-networking/src/main/java/net/fabricmc/fabric/impl/network/ServerSidePacketRegistryImpl.java b/fabric-networking/src/main/java/net/fabricmc/fabric/impl/network/ServerSidePacketRegistryImpl.java index 52215f8f99..8d3e2a50fd 100644 --- a/fabric-networking/src/main/java/net/fabricmc/fabric/impl/network/ServerSidePacketRegistryImpl.java +++ b/fabric-networking/src/main/java/net/fabricmc/fabric/impl/network/ServerSidePacketRegistryImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-networking/src/main/java/net/fabricmc/fabric/impl/server/EntityTrackerStorageAccessor.java b/fabric-networking/src/main/java/net/fabricmc/fabric/impl/server/EntityTrackerStorageAccessor.java index 35fe593af6..7c12267fcb 100644 --- a/fabric-networking/src/main/java/net/fabricmc/fabric/impl/server/EntityTrackerStorageAccessor.java +++ b/fabric-networking/src/main/java/net/fabricmc/fabric/impl/server/EntityTrackerStorageAccessor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-networking/src/main/java/net/fabricmc/fabric/impl/server/EntityTrackerStreamAccessor.java b/fabric-networking/src/main/java/net/fabricmc/fabric/impl/server/EntityTrackerStreamAccessor.java index 5c0fa102cf..a656b3366f 100644 --- a/fabric-networking/src/main/java/net/fabricmc/fabric/impl/server/EntityTrackerStreamAccessor.java +++ b/fabric-networking/src/main/java/net/fabricmc/fabric/impl/server/EntityTrackerStreamAccessor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,6 @@ package net.fabricmc.fabric.impl.server; -import net.minecraft.entity.Entity; import net.minecraft.server.network.ServerPlayerEntity; import java.util.stream.Stream; diff --git a/fabric-networking/src/main/java/net/fabricmc/fabric/mixin/network/MixinClientPlayNetworkHandler.java b/fabric-networking/src/main/java/net/fabricmc/fabric/mixin/network/MixinClientPlayNetworkHandler.java index cba82f37ae..1f78e65d37 100644 --- a/fabric-networking/src/main/java/net/fabricmc/fabric/mixin/network/MixinClientPlayNetworkHandler.java +++ b/fabric-networking/src/main/java/net/fabricmc/fabric/mixin/network/MixinClientPlayNetworkHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-networking/src/main/java/net/fabricmc/fabric/mixin/network/MixinCustomPayloadC2SPacket.java b/fabric-networking/src/main/java/net/fabricmc/fabric/mixin/network/MixinCustomPayloadC2SPacket.java index e7c67c3c54..da0cb085fd 100644 --- a/fabric-networking/src/main/java/net/fabricmc/fabric/mixin/network/MixinCustomPayloadC2SPacket.java +++ b/fabric-networking/src/main/java/net/fabricmc/fabric/mixin/network/MixinCustomPayloadC2SPacket.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-networking/src/main/java/net/fabricmc/fabric/mixin/network/MixinEntityTracker.java b/fabric-networking/src/main/java/net/fabricmc/fabric/mixin/network/MixinEntityTracker.java index ef0f7e4431..f13b6b660f 100644 --- a/fabric-networking/src/main/java/net/fabricmc/fabric/mixin/network/MixinEntityTracker.java +++ b/fabric-networking/src/main/java/net/fabricmc/fabric/mixin/network/MixinEntityTracker.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-networking/src/main/java/net/fabricmc/fabric/mixin/network/MixinServerPlayNetworkHandler.java b/fabric-networking/src/main/java/net/fabricmc/fabric/mixin/network/MixinServerPlayNetworkHandler.java index ec617ce6a4..b67b4cd90b 100644 --- a/fabric-networking/src/main/java/net/fabricmc/fabric/mixin/network/MixinServerPlayNetworkHandler.java +++ b/fabric-networking/src/main/java/net/fabricmc/fabric/mixin/network/MixinServerPlayNetworkHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-networking/src/main/java/net/fabricmc/fabric/mixin/network/MixinThreadedAnvilChunkStorage.java b/fabric-networking/src/main/java/net/fabricmc/fabric/mixin/network/MixinThreadedAnvilChunkStorage.java index 553759641d..3769f37f5d 100644 --- a/fabric-networking/src/main/java/net/fabricmc/fabric/mixin/network/MixinThreadedAnvilChunkStorage.java +++ b/fabric-networking/src/main/java/net/fabricmc/fabric/mixin/network/MixinThreadedAnvilChunkStorage.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,8 +17,8 @@ package net.fabricmc.fabric.mixin.network; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import net.fabricmc.fabric.impl.server.EntityTrackerStreamAccessor; import net.fabricmc.fabric.impl.server.EntityTrackerStorageAccessor; +import net.fabricmc.fabric.impl.server.EntityTrackerStreamAccessor; import net.minecraft.entity.Entity; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.world.ThreadedAnvilChunkStorage; diff --git a/fabric-object-builders/src/main/java/net/fabricmc/fabric/api/block/FabricBlockSettings.java b/fabric-object-builders/src/main/java/net/fabricmc/fabric/api/block/FabricBlockSettings.java index c908422707..99c54ec23f 100644 --- a/fabric-object-builders/src/main/java/net/fabricmc/fabric/api/block/FabricBlockSettings.java +++ b/fabric-object-builders/src/main/java/net/fabricmc/fabric/api/block/FabricBlockSettings.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,7 +38,7 @@ /** * Fabric's version of Block.Settings. Adds additional methods and hooks * not found in the original class. - * + *

* To use it, simply replace Block.Settings.create() with * FabricBlockSettings.create() and add .build() at the end to return the * vanilla Block.Settings instance beneath. @@ -124,7 +124,7 @@ public FabricBlockSettings breakByTool(Tag tag) { public FabricBlockSettings breakByTool(Tag tag, int miningLevel) { info.computeIfAbsent(delegate, (k) -> new Information()).miningInformation.add( - new MiningInformation(tag, miningLevel) + new MiningInformation(tag, miningLevel) ); return this; } diff --git a/fabric-object-builders/src/main/java/net/fabricmc/fabric/api/entity/EntityTrackingRegistry.java b/fabric-object-builders/src/main/java/net/fabricmc/fabric/api/entity/EntityTrackingRegistry.java index 8f486bf080..77cebdecac 100644 --- a/fabric-object-builders/src/main/java/net/fabricmc/fabric/api/entity/EntityTrackingRegistry.java +++ b/fabric-object-builders/src/main/java/net/fabricmc/fabric/api/entity/EntityTrackingRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-object-builders/src/main/java/net/fabricmc/fabric/api/entity/FabricEntityTypeBuilder.java b/fabric-object-builders/src/main/java/net/fabricmc/fabric/api/entity/FabricEntityTypeBuilder.java index a7adb0b5b4..298627de6c 100644 --- a/fabric-object-builders/src/main/java/net/fabricmc/fabric/api/entity/FabricEntityTypeBuilder.java +++ b/fabric-object-builders/src/main/java/net/fabricmc/fabric/api/entity/FabricEntityTypeBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-object-builders/src/main/java/net/fabricmc/fabric/api/event/registry/BlockConstructedCallback.java b/fabric-object-builders/src/main/java/net/fabricmc/fabric/api/event/registry/BlockConstructedCallback.java index 76d3bf801e..c8338c75fe 100644 --- a/fabric-object-builders/src/main/java/net/fabricmc/fabric/api/event/registry/BlockConstructedCallback.java +++ b/fabric-object-builders/src/main/java/net/fabricmc/fabric/api/event/registry/BlockConstructedCallback.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-object-builders/src/main/java/net/fabricmc/fabric/api/event/registry/ItemConstructedCallback.java b/fabric-object-builders/src/main/java/net/fabricmc/fabric/api/event/registry/ItemConstructedCallback.java index 311439f0b0..1abc06e7d5 100644 --- a/fabric-object-builders/src/main/java/net/fabricmc/fabric/api/event/registry/ItemConstructedCallback.java +++ b/fabric-object-builders/src/main/java/net/fabricmc/fabric/api/event/registry/ItemConstructedCallback.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-object-builders/src/main/java/net/fabricmc/fabric/impl/block/FabricBlockSettingsDelegate.java b/fabric-object-builders/src/main/java/net/fabricmc/fabric/impl/block/FabricBlockSettingsDelegate.java index 4e1e91aa2a..7ef4321177 100644 --- a/fabric-object-builders/src/main/java/net/fabricmc/fabric/impl/block/FabricBlockSettingsDelegate.java +++ b/fabric-object-builders/src/main/java/net/fabricmc/fabric/impl/block/FabricBlockSettingsDelegate.java @@ -1,3 +1,19 @@ +/* + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.fabricmc.fabric.impl.block; import net.minecraft.block.MaterialColor; @@ -5,14 +21,23 @@ import net.minecraft.util.Identifier; public interface FabricBlockSettingsDelegate { - void fabric_setMaterialColor(MaterialColor color); - void fabric_setCollidable(boolean value); - void fabric_setSoundGroup(BlockSoundGroup group); - void fabric_setLightLevel(int value); - void fabric_setHardness(float value); - void fabric_setResistance(float value); - void fabric_setRandomTicks(boolean value); - void fabric_setFriction(float value); - void fabric_setDropTable(Identifier id); - void fabric_setDynamicBounds(boolean value); + void fabric_setMaterialColor(MaterialColor color); + + void fabric_setCollidable(boolean value); + + void fabric_setSoundGroup(BlockSoundGroup group); + + void fabric_setLightLevel(int value); + + void fabric_setHardness(float value); + + void fabric_setResistance(float value); + + void fabric_setRandomTicks(boolean value); + + void fabric_setFriction(float value); + + void fabric_setDropTable(Identifier id); + + void fabric_setDynamicBounds(boolean value); } diff --git a/fabric-object-builders/src/main/java/net/fabricmc/fabric/impl/entity/FabricEntityType.java b/fabric-object-builders/src/main/java/net/fabricmc/fabric/impl/entity/FabricEntityType.java index 657d0fedfc..4b144211dc 100644 --- a/fabric-object-builders/src/main/java/net/fabricmc/fabric/impl/entity/FabricEntityType.java +++ b/fabric-object-builders/src/main/java/net/fabricmc/fabric/impl/entity/FabricEntityType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-object-builders/src/main/java/net/fabricmc/fabric/mixin/builders/MixinBlock.java b/fabric-object-builders/src/main/java/net/fabricmc/fabric/mixin/builders/MixinBlock.java index 7333dc250b..5fdd4cf9e9 100644 --- a/fabric-object-builders/src/main/java/net/fabricmc/fabric/mixin/builders/MixinBlock.java +++ b/fabric-object-builders/src/main/java/net/fabricmc/fabric/mixin/builders/MixinBlock.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-object-builders/src/main/java/net/fabricmc/fabric/mixin/builders/MixinBlockBuilder.java b/fabric-object-builders/src/main/java/net/fabricmc/fabric/mixin/builders/MixinBlockBuilder.java index a74eb22894..1121420521 100644 --- a/fabric-object-builders/src/main/java/net/fabricmc/fabric/mixin/builders/MixinBlockBuilder.java +++ b/fabric-object-builders/src/main/java/net/fabricmc/fabric/mixin/builders/MixinBlockBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-object-builders/src/main/java/net/fabricmc/fabric/mixin/builders/MixinItem.java b/fabric-object-builders/src/main/java/net/fabricmc/fabric/mixin/builders/MixinItem.java index a1e56893c0..62aab26c9d 100644 --- a/fabric-object-builders/src/main/java/net/fabricmc/fabric/mixin/builders/MixinItem.java +++ b/fabric-object-builders/src/main/java/net/fabricmc/fabric/mixin/builders/MixinItem.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/ExtendedIdList.java b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/ExtendedIdList.java index 2fc66062ea..6d19e013eb 100644 --- a/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/ExtendedIdList.java +++ b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/ExtendedIdList.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/FabricRegistryClientInit.java b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/FabricRegistryClientInit.java index 4d2e57f333..94d2cf794a 100644 --- a/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/FabricRegistryClientInit.java +++ b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/FabricRegistryClientInit.java @@ -1,3 +1,19 @@ +/* + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.fabricmc.fabric.impl.registry; import net.fabricmc.api.ClientModInitializer; @@ -9,20 +25,20 @@ import org.apache.logging.log4j.Logger; public class FabricRegistryClientInit implements ClientModInitializer { - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOGGER = LogManager.getLogger(); - @Override - public void onInitializeClient() { - ClientSidePacketRegistry.INSTANCE.register(RegistrySyncManager.ID, (ctx, buf) -> { - // if not hosting server, apply packet - RegistrySyncManager.receivePacket(ctx, buf, !MinecraftClient.getInstance().isInSingleplayer(), (e) -> { - LOGGER.error("Registry remapping failed!", e); - MinecraftClient.getInstance().execute(() -> { - ((ClientPlayerEntity) ctx.getPlayer()).networkHandler.getClientConnection().disconnect( - new StringTextComponent("Registry remapping failed: " + e.getMessage()) - ); - }); - }); - }); - } + @Override + public void onInitializeClient() { + ClientSidePacketRegistry.INSTANCE.register(RegistrySyncManager.ID, (ctx, buf) -> { + // if not hosting server, apply packet + RegistrySyncManager.receivePacket(ctx, buf, !MinecraftClient.getInstance().isInSingleplayer(), (e) -> { + LOGGER.error("Registry remapping failed!", e); + MinecraftClient.getInstance().execute(() -> { + ((ClientPlayerEntity) ctx.getPlayer()).networkHandler.getClientConnection().disconnect( + new StringTextComponent("Registry remapping failed: " + e.getMessage()) + ); + }); + }); + }); + } } diff --git a/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/IdListUpdater.java b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/IdListUpdater.java index 42c5bb0adc..066e79af78 100644 --- a/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/IdListUpdater.java +++ b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/IdListUpdater.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/ListenableRegistry.java b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/ListenableRegistry.java index 40ed214f8f..429ef27162 100644 --- a/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/ListenableRegistry.java +++ b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/ListenableRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/RegistryListener.java b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/RegistryListener.java index e996b9a988..44cd98caeb 100644 --- a/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/RegistryListener.java +++ b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/RegistryListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,12 @@ import net.minecraft.util.registry.Registry; public interface RegistryListener { - default void beforeRegistryCleared(Registry registry) {} - default void beforeRegistryRegistration(Registry registry, int id, Identifier identifier, T object, boolean isNew) {} - default void afterRegistryRegistration(Registry registry, int id, Identifier identifier, T object) {} + default void beforeRegistryCleared(Registry registry) { + } + + default void beforeRegistryRegistration(Registry registry, int id, Identifier identifier, T object, boolean isNew) { + } + + default void afterRegistryRegistration(Registry registry, int id, Identifier identifier, T object) { + } } diff --git a/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/RegistrySyncManager.java b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/RegistrySyncManager.java index ac9918e44e..75255155aa 100644 --- a/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/RegistrySyncManager.java +++ b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/RegistrySyncManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/RemapException.java b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/RemapException.java index 91a1e051bf..6deb60a618 100644 --- a/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/RemapException.java +++ b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/RemapException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/RemappableRegistry.java b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/RemappableRegistry.java index 3f93b4f68f..8264ad4128 100644 --- a/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/RemappableRegistry.java +++ b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/RemappableRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,5 +43,6 @@ enum RemapMode { } void remap(Object2IntMap remoteIndexedEntries, RemapMode mode) throws RemapException; + void unmap() throws RemapException; } diff --git a/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/vanilla/BootstrapBiomeRegistryListener.java b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/vanilla/BootstrapBiomeRegistryListener.java index 439fef9137..9eb2bf3c61 100644 --- a/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/vanilla/BootstrapBiomeRegistryListener.java +++ b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/vanilla/BootstrapBiomeRegistryListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/vanilla/BootstrapBlockRegistryListener.java b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/vanilla/BootstrapBlockRegistryListener.java index cd7d9f4131..9be7d1cdec 100644 --- a/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/vanilla/BootstrapBlockRegistryListener.java +++ b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/vanilla/BootstrapBlockRegistryListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/vanilla/BootstrapFluidRegistryListener.java b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/vanilla/BootstrapFluidRegistryListener.java index 77b4ac700f..27b870e786 100644 --- a/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/vanilla/BootstrapFluidRegistryListener.java +++ b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/vanilla/BootstrapFluidRegistryListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/vanilla/BootstrapItemRegistryListener.java b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/vanilla/BootstrapItemRegistryListener.java index d319356cba..26789289b9 100644 --- a/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/vanilla/BootstrapItemRegistryListener.java +++ b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/impl/registry/vanilla/BootstrapItemRegistryListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,8 +17,8 @@ package net.fabricmc.fabric.impl.registry.vanilla; import net.fabricmc.fabric.impl.registry.RegistryListener; -import net.minecraft.item.Item; import net.minecraft.item.BlockItem; +import net.minecraft.item.Item; import net.minecraft.util.Identifier; import net.minecraft.util.registry.Registry; diff --git a/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/MixinBootstrap.java b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/MixinBootstrap.java index fb06b99281..c846b5da9e 100644 --- a/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/MixinBootstrap.java +++ b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/MixinBootstrap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/MixinIdList.java b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/MixinIdList.java index 944b3299a2..5a269cc32b 100644 --- a/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/MixinIdList.java +++ b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/MixinIdList.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/MixinIdRegistry.java b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/MixinIdRegistry.java index df99996035..2d82cdea70 100644 --- a/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/MixinIdRegistry.java +++ b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/MixinIdRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,7 +26,6 @@ import net.fabricmc.fabric.impl.registry.RemappableRegistry; import net.minecraft.util.Identifier; import net.minecraft.util.Int2ObjectBiMap; -import net.minecraft.util.registry.DefaultedRegistry; import net.minecraft.util.registry.SimpleRegistry; import org.apache.logging.log4j.Logger; import org.spongepowered.asm.mixin.Mixin; @@ -35,8 +34,6 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import java.util.*; - @Mixin(SimpleRegistry.class) public abstract class MixinIdRegistry implements RemappableRegistry, ListenableRegistry, RegistryListener { @Shadow @@ -55,7 +52,7 @@ public abstract class MixinIdRegistry implements RemappableRegistry, Listenab @Override public void registerListener(RegistryListener listener) { if (fabric_listeners == null) { - fabric_listeners = new RegistryListener[] { listener }; + fabric_listeners = new RegistryListener[]{listener}; } else { RegistryListener[] newListeners = new RegistryListener[fabric_listeners.length + 1]; System.arraycopy(fabric_listeners, 0, newListeners, 0, fabric_listeners.length); @@ -64,7 +61,7 @@ public void registerListener(RegistryListener listener) { } } - @SuppressWarnings({ "unchecked", "ConstantConditions" }) + @SuppressWarnings({"unchecked", "ConstantConditions"}) @Inject(method = "set", at = @At("HEAD")) public void setPre(int id, Identifier identifier, Object object, CallbackInfoReturnable info) { SimpleRegistry registry = (SimpleRegistry) (Object) this; @@ -75,7 +72,7 @@ public void setPre(int id, Identifier identifier, Object object, CallbackInfoRet } } - @SuppressWarnings({ "unchecked", "ConstantConditions" }) + @SuppressWarnings({"unchecked", "ConstantConditions"}) @Inject(method = "set", at = @At("RETURN")) public void setPost(int id, Identifier identifier, Object object, CallbackInfoReturnable info) { SimpleRegistry registry = (SimpleRegistry) (Object) this; diff --git a/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/MixinPlayerManager.java b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/MixinPlayerManager.java index 5a9cfb2465..1a25d71640 100644 --- a/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/MixinPlayerManager.java +++ b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/MixinPlayerManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/MixinWorldSaveHandler.java b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/MixinWorldSaveHandler.java index 01ab57eb3b..32992b42cf 100644 --- a/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/MixinWorldSaveHandler.java +++ b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/MixinWorldSaveHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/client/MixinBlockColorMap.java b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/client/MixinBlockColorMap.java index 59e27fc4b3..04eae72e29 100644 --- a/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/client/MixinBlockColorMap.java +++ b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/client/MixinBlockColorMap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,8 @@ package net.fabricmc.fabric.mixin.registry.client; -import net.fabricmc.fabric.impl.registry.ListenableRegistry; import net.fabricmc.fabric.impl.registry.IdListUpdater; +import net.fabricmc.fabric.impl.registry.ListenableRegistry; import net.minecraft.block.Block; import net.minecraft.client.render.block.BlockColorMap; import net.minecraft.client.render.block.BlockColorMapper; diff --git a/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/client/MixinItemColorMap.java b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/client/MixinItemColorMap.java index 060a078eb6..ac2be1eb8f 100644 --- a/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/client/MixinItemColorMap.java +++ b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/client/MixinItemColorMap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,8 @@ package net.fabricmc.fabric.mixin.registry.client; -import net.fabricmc.fabric.impl.registry.ListenableRegistry; import net.fabricmc.fabric.impl.registry.IdListUpdater; +import net.fabricmc.fabric.impl.registry.ListenableRegistry; import net.minecraft.client.render.block.BlockColorMap; import net.minecraft.client.render.item.ItemColorMap; import net.minecraft.client.render.item.ItemColorMapper; diff --git a/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/client/MixinItemModelMap.java b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/client/MixinItemModelMap.java index 6ce69980a8..364111bbe0 100644 --- a/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/client/MixinItemModelMap.java +++ b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/client/MixinItemModelMap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/client/MixinMinecraftClient.java b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/client/MixinMinecraftClient.java index ed9260492c..e6dfb17dbf 100644 --- a/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/client/MixinMinecraftClient.java +++ b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/client/MixinMinecraftClient.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/client/MixinParticleManager.java b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/client/MixinParticleManager.java index cdcb2d0d9f..297b436677 100644 --- a/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/client/MixinParticleManager.java +++ b/fabric-registry-sync/src/main/java/net/fabricmc/fabric/mixin/registry/client/MixinParticleManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-resource-loader/src/main/java/net/fabricmc/fabric/api/resource/IdentifiableResourceReloadListener.java b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/api/resource/IdentifiableResourceReloadListener.java index dd435c1f3e..572f3af810 100644 --- a/fabric-resource-loader/src/main/java/net/fabricmc/fabric/api/resource/IdentifiableResourceReloadListener.java +++ b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/api/resource/IdentifiableResourceReloadListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,11 +24,11 @@ /** * Interface for "identifiable" resource reload listeners. - * + *

* "Identifiable" listeners have an unique identifier, which can be depended on, * and can provide dependencies that they would like to see executed before * themselves. - * + *

* {@link ResourceReloadListenerKeys} */ public interface IdentifiableResourceReloadListener extends ResourceReloadListener { diff --git a/fabric-resource-loader/src/main/java/net/fabricmc/fabric/api/resource/ModResourcePack.java b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/api/resource/ModResourcePack.java index c5771dbee6..a89f170d14 100644 --- a/fabric-resource-loader/src/main/java/net/fabricmc/fabric/api/resource/ModResourcePack.java +++ b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/api/resource/ModResourcePack.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,7 @@ public interface ModResourcePack extends ResourcePack { /** * @return The ModMetadata object associated with the mod providing this - * resource pack. + * resource pack. */ ModMetadata getFabricModMetadata(); } diff --git a/fabric-resource-loader/src/main/java/net/fabricmc/fabric/api/resource/ResourceManagerHelper.java b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/api/resource/ResourceManagerHelper.java index ca1c9ce21a..a3acf64427 100644 --- a/fabric-resource-loader/src/main/java/net/fabricmc/fabric/api/resource/ResourceManagerHelper.java +++ b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/api/resource/ResourceManagerHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,6 +26,7 @@ public interface ResourceManagerHelper { /** * Add a resource reload listener for a given registry. + * * @param listener The resource reload listener. * @deprecated Use {@link ResourceManagerHelper#registerReloadListener(IdentifiableResourceReloadListener)} */ @@ -36,12 +37,14 @@ default void addReloadListener(IdentifiableResourceReloadListener listener) { /** * Register a resource reload listener for a given resource manager type. + * * @param listener The resource reload listener. */ void registerReloadListener(IdentifiableResourceReloadListener listener); /** * Get the ResourceManagerHelper instance for a given resource type. + * * @param type The given resource type. * @return The ResourceManagerHelper instance. */ diff --git a/fabric-resource-loader/src/main/java/net/fabricmc/fabric/api/resource/ResourceReloadListenerKeys.java b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/api/resource/ResourceReloadListenerKeys.java index bac69bbcf3..bfd51f4fd5 100644 --- a/fabric-resource-loader/src/main/java/net/fabricmc/fabric/api/resource/ResourceReloadListenerKeys.java +++ b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/api/resource/ResourceReloadListenerKeys.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,7 @@ /** * This class contains default keys for various Minecraft resource reload listeners. - * + *

* {@link IdentifiableResourceReloadListener} */ public final class ResourceReloadListenerKeys { diff --git a/fabric-resource-loader/src/main/java/net/fabricmc/fabric/api/resource/SimpleResourceReloadListener.java b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/api/resource/SimpleResourceReloadListener.java index fa228f2b07..c435a9b590 100644 --- a/fabric-resource-loader/src/main/java/net/fabricmc/fabric/api/resource/SimpleResourceReloadListener.java +++ b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/api/resource/SimpleResourceReloadListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,16 +27,16 @@ /** * A simplified version of the "resource reload listener" interface, hiding the * peculiarities of the API. - * + *

* In essence, there are two stages: - * + *

* - load: create an instance of your data object containing all loaded and - * processed information, + * processed information, * - apply: apply the information from the data object to the game instance. - * + *

* The load stage should be self-contained as it can run on any thread! However, * the apply stage is guaranteed to run on the game thread. - * + *

* For a fully synchronous alternative, consider using * {@link SynchronousResourceReloadListener} in conjunction with * {@link IdentifiableResourceReloadListener}. @@ -55,7 +55,7 @@ default CompletableFuture reload(ResourceReloadListener.Helper helper, Res * Asynchronously process and load resource-based data. The code * must be thread-safe and not modify game state! * - * @param manager The resource manager used during reloading. + * @param manager The resource manager used during reloading. * @param profiler The profiler which may be used for this stage. * @param executor The executor which should be used for this stage. * @return A CompletableFuture representing the "data loading" stage. @@ -65,7 +65,7 @@ default CompletableFuture reload(ResourceReloadListener.Helper helper, Res /** * Synchronously apply loaded data to the game state. * - * @param manager The resource manager used during reloading. + * @param manager The resource manager used during reloading. * @param profiler The profiler which may be used for this stage. * @param executor The executor which should be used for this stage. * @return A CompletableFuture representing the "data applying" stage. diff --git a/fabric-resource-loader/src/main/java/net/fabricmc/fabric/api/resource/SimpleSynchronousResourceReloadListener.java b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/api/resource/SimpleSynchronousResourceReloadListener.java index f25a2951fc..8cc8ffca9e 100644 --- a/fabric-resource-loader/src/main/java/net/fabricmc/fabric/api/resource/SimpleSynchronousResourceReloadListener.java +++ b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/api/resource/SimpleSynchronousResourceReloadListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-resource-loader/src/main/java/net/fabricmc/fabric/impl/resources/DeferredInputStream.java b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/impl/resources/DeferredInputStream.java index 762a889ef9..244c53376e 100644 --- a/fabric-resource-loader/src/main/java/net/fabricmc/fabric/impl/resources/DeferredInputStream.java +++ b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/impl/resources/DeferredInputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,6 @@ import java.io.IOException; import java.io.InputStream; -import java.util.concurrent.*; /** * InputStream deferring to a separate I/O thread to work around diff --git a/fabric-resource-loader/src/main/java/net/fabricmc/fabric/impl/resources/DeferredNioExecutionHandler.java b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/impl/resources/DeferredNioExecutionHandler.java index 065aed8943..470d795438 100644 --- a/fabric-resource-loader/src/main/java/net/fabricmc/fabric/impl/resources/DeferredNioExecutionHandler.java +++ b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/impl/resources/DeferredNioExecutionHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,6 @@ import com.google.common.util.concurrent.ThreadFactoryBuilder; import java.io.IOException; -import java.util.concurrent.*; class DeferredNioExecutionHandler { private static final ThreadLocal DEFERRED_REQUIRED = new ThreadLocal<>(); diff --git a/fabric-resource-loader/src/main/java/net/fabricmc/fabric/impl/resources/ModNioResourcePack.java b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/impl/resources/ModNioResourcePack.java index 8f4762d17a..a953d31633 100644 --- a/fabric-resource-loader/src/main/java/net/fabricmc/fabric/impl/resources/ModNioResourcePack.java +++ b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/impl/resources/ModNioResourcePack.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,6 @@ import java.nio.file.DirectoryStream; import java.nio.file.Files; import java.nio.file.Path; -import java.util.*; import java.util.function.Predicate; import java.util.regex.Pattern; diff --git a/fabric-resource-loader/src/main/java/net/fabricmc/fabric/impl/resources/ModResourcePackCreator.java b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/impl/resources/ModResourcePackCreator.java index 1945a53f30..da0b956f65 100644 --- a/fabric-resource-loader/src/main/java/net/fabricmc/fabric/impl/resources/ModResourcePackCreator.java +++ b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/impl/resources/ModResourcePackCreator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-resource-loader/src/main/java/net/fabricmc/fabric/impl/resources/ModResourcePackUtil.java b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/impl/resources/ModResourcePackUtil.java index 02d89c6abb..8ec58dd660 100644 --- a/fabric-resource-loader/src/main/java/net/fabricmc/fabric/impl/resources/ModResourcePackUtil.java +++ b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/impl/resources/ModResourcePackUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,60 +24,55 @@ import net.minecraft.resource.ResourceType; import org.apache.commons.io.IOUtils; -import java.io.File; -import java.io.IOException; import java.io.InputStream; -import java.net.URL; -import java.nio.file.Files; import java.nio.file.Path; import java.util.List; -import java.util.Locale; /** * Internal utilities for managing resource packs. */ public final class ModResourcePackUtil { - public static final int PACK_FORMAT_VERSION = 4; + public static final int PACK_FORMAT_VERSION = 4; - private ModResourcePackUtil() { + private ModResourcePackUtil() { - } + } - public static void appendModResourcePacks(List packList, ResourceType type) { - for (ModContainer container : FabricLoader.getInstance().getAllMods()) { - Path path = container.getRootPath(); - ResourcePack pack = new ModNioResourcePack(container.getMetadata(), path, null); - if (!pack.getNamespaces(type).isEmpty()) { - packList.add(pack); - } - } - } + public static void appendModResourcePacks(List packList, ResourceType type) { + for (ModContainer container : FabricLoader.getInstance().getAllMods()) { + Path path = container.getRootPath(); + ResourcePack pack = new ModNioResourcePack(container.getMetadata(), path, null); + if (!pack.getNamespaces(type).isEmpty()) { + packList.add(pack); + } + } + } - public static boolean containsDefault(ModMetadata info, String filename) { - return "pack.mcmeta".equals(filename); - } + public static boolean containsDefault(ModMetadata info, String filename) { + return "pack.mcmeta".equals(filename); + } - public static InputStream openDefault(ModMetadata info, String filename) { - switch (filename) { - case "pack.mcmeta": - String description = info.getName(); - if (description == null) { - description = ""; - } else { - description = description.replaceAll("\"", "\\\""); - } - String pack = String.format("{\"pack\":{\"pack_format\":" + PACK_FORMAT_VERSION + ",\"description\":\"%s\"}}", description); - return IOUtils.toInputStream(pack, Charsets.UTF_8); - default: - return null; - } - } + public static InputStream openDefault(ModMetadata info, String filename) { + switch (filename) { + case "pack.mcmeta": + String description = info.getName(); + if (description == null) { + description = ""; + } else { + description = description.replaceAll("\"", "\\\""); + } + String pack = String.format("{\"pack\":{\"pack_format\":" + PACK_FORMAT_VERSION + ",\"description\":\"%s\"}}", description); + return IOUtils.toInputStream(pack, Charsets.UTF_8); + default: + return null; + } + } - public static String getName(ModMetadata info) { - if (info.getName() != null) { - return info.getName(); - } else { - return "Fabric Mod \"" + info.getId() + "\""; - } - } + public static String getName(ModMetadata info) { + if (info.getName() != null) { + return info.getName(); + } else { + return "Fabric Mod \"" + info.getId() + "\""; + } + } } diff --git a/fabric-resource-loader/src/main/java/net/fabricmc/fabric/impl/resources/ResourceManagerHelperImpl.java b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/impl/resources/ResourceManagerHelperImpl.java index 8a56d5bcd9..0f01598e7d 100644 --- a/fabric-resource-loader/src/main/java/net/fabricmc/fabric/impl/resources/ResourceManagerHelperImpl.java +++ b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/impl/resources/ResourceManagerHelperImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,8 +25,6 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import java.util.*; - public class ResourceManagerHelperImpl implements ResourceManagerHelper { private static final Map registryMap = new HashMap<>(); private static final Logger LOGGER = LogManager.getLogger(); diff --git a/fabric-resource-loader/src/main/java/net/fabricmc/fabric/mixin/resources/MixinKeyedResourceReloadListener.java b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/mixin/resources/MixinKeyedResourceReloadListener.java index 2220c1ca66..1f419ba865 100644 --- a/fabric-resource-loader/src/main/java/net/fabricmc/fabric/mixin/resources/MixinKeyedResourceReloadListener.java +++ b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/mixin/resources/MixinKeyedResourceReloadListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,7 +50,7 @@ public static abstract class Client implements IdentifiableResourceReloadListene private Identifier fabric_id; @Override - @SuppressWarnings({ "ConstantConditions", "RedundantCast" }) + @SuppressWarnings({"ConstantConditions", "RedundantCast"}) public Collection getFabricDependencies() { if (fabric_idDeps == null) { Object self = (Object) this; @@ -67,7 +67,7 @@ public Collection getFabricDependencies() { } @Override - @SuppressWarnings({ "ConstantConditions", "RedundantCast" }) + @SuppressWarnings({"ConstantConditions", "RedundantCast"}) public Identifier getFabricId() { if (fabric_id == null) { Object self = (Object) this; @@ -101,7 +101,7 @@ public static abstract class Server implements IdentifiableResourceReloadListene private Identifier fabric_id; @Override - @SuppressWarnings({ "ConstantConditions", "RedundantCast" }) + @SuppressWarnings({"ConstantConditions", "RedundantCast"}) public Collection getFabricDependencies() { if (fabric_idDeps == null) { Object self = (Object) this; @@ -117,11 +117,11 @@ public Collection getFabricDependencies() { } @Override - @SuppressWarnings({ "ConstantConditions", "RedundantCast" }) + @SuppressWarnings({"ConstantConditions", "RedundantCast"}) public Identifier getFabricId() { if (fabric_id == null) { Object self = (Object) this; -; + ; if (self instanceof RecipeManager) { fabric_id = ResourceReloadListenerKeys.RECIPES; } else if (self instanceof ServerAdvancementLoader) { diff --git a/fabric-resource-loader/src/main/java/net/fabricmc/fabric/mixin/resources/MixinMinecraftGame.java b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/mixin/resources/MixinMinecraftGame.java index 76c02774e0..eb0e50e66e 100644 --- a/fabric-resource-loader/src/main/java/net/fabricmc/fabric/mixin/resources/MixinMinecraftGame.java +++ b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/mixin/resources/MixinMinecraftGame.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,12 +16,10 @@ package net.fabricmc.fabric.mixin.resources; -import com.google.common.base.Joiner; import com.google.common.collect.Lists; import net.fabricmc.fabric.impl.resources.ModResourcePackUtil; import net.minecraft.client.MinecraftClient; import net.minecraft.client.resource.DefaultClientResourcePack; -import net.minecraft.resource.DefaultResourcePack; import net.minecraft.resource.ReloadableResourceManager; import net.minecraft.resource.ResourcePack; import net.minecraft.resource.ResourceType; @@ -29,51 +27,49 @@ import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.ModifyVariable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.LocalCapture; -import java.util.ArrayList; import java.util.List; import java.util.concurrent.CompletableFuture; @Mixin(MinecraftClient.class) public class MixinMinecraftGame { - @Shadow - private ReloadableResourceManager resourceManager; + @Shadow + private ReloadableResourceManager resourceManager; - private void fabric_modifyResourcePackList(List list) { - List oldList = Lists.newArrayList(list); - list.clear(); + private void fabric_modifyResourcePackList(List list) { + List oldList = Lists.newArrayList(list); + list.clear(); - boolean appended = false; - for (int i = 0; i < oldList.size(); i++) { - ResourcePack pack = oldList.get(i); - list.add(pack); + boolean appended = false; + for (int i = 0; i < oldList.size(); i++) { + ResourcePack pack = oldList.get(i); + list.add(pack); - if (pack instanceof DefaultClientResourcePack) { - ModResourcePackUtil.appendModResourcePacks(list, ResourceType.ASSETS); - appended = true; - } - } + if (pack instanceof DefaultClientResourcePack) { + ModResourcePackUtil.appendModResourcePacks(list, ResourceType.ASSETS); + appended = true; + } + } - if (!appended) { - StringBuilder builder = new StringBuilder("Fabric could not find resource pack injection location!"); - for (ResourcePack rp : oldList) { - builder.append("\n - ").append(rp.getName()).append(" (").append(rp.getClass().getName()).append(")"); - } - throw new RuntimeException(builder.toString()); - } - } + if (!appended) { + StringBuilder builder = new StringBuilder("Fabric could not find resource pack injection location!"); + for (ResourcePack rp : oldList) { + builder.append("\n - ").append(rp.getName()).append(" (").append(rp.getClass().getName()).append(")"); + } + throw new RuntimeException(builder.toString()); + } + } @Inject(method = "init", at = @At(value = "INVOKE", target = "Ljava/util/List;iterator()Ljava/util/Iterator;", ordinal = 0, shift = At.Shift.BY, by = -2), locals = LocalCapture.CAPTURE_FAILHARD) public void initResources(CallbackInfo info, List list) { - fabric_modifyResourcePackList(list); + fabric_modifyResourcePackList(list); } @Inject(method = "reloadResources", at = @At(value = "INVOKE", target = "Lnet/minecraft/resource/ReloadableResourceManager;beginMonitoredReload(Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;Ljava/util/concurrent/CompletableFuture;Ljava/util/List;)Lnet/minecraft/resource/ResourceReloadMonitor;", ordinal = 0), locals = LocalCapture.CAPTURE_FAILHARD) - public void reloadResources(CallbackInfoReturnable info, CompletableFuture cf, List list) { + public void reloadResources(CallbackInfoReturnable info, CompletableFuture cf, List list) { fabric_modifyResourcePackList(list); - } + } } diff --git a/fabric-resource-loader/src/main/java/net/fabricmc/fabric/mixin/resources/MixinMinecraftServer.java b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/mixin/resources/MixinMinecraftServer.java index 83cec0f469..e11270eb6b 100644 --- a/fabric-resource-loader/src/main/java/net/fabricmc/fabric/mixin/resources/MixinMinecraftServer.java +++ b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/mixin/resources/MixinMinecraftServer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,11 +32,11 @@ @Mixin(MinecraftServer.class) public class MixinMinecraftServer { - @Shadow - private ResourcePackContainerManager resourcePackContainerManager; + @Shadow + private ResourcePackContainerManager resourcePackContainerManager; - @Inject(method = "loadWorldDataPacks", at = @At(value = "INVOKE", target = "Lnet/minecraft/resource/ResourcePackContainerManager;addCreator(Lnet/minecraft/resource/ResourcePackCreator;)V", ordinal = 1)) - public void appendFabricDataPacks(File file, LevelProperties properties, CallbackInfo info) { - resourcePackContainerManager.addCreator(new ModResourcePackCreator(ResourceType.DATA)); - } + @Inject(method = "loadWorldDataPacks", at = @At(value = "INVOKE", target = "Lnet/minecraft/resource/ResourcePackContainerManager;addCreator(Lnet/minecraft/resource/ResourcePackCreator;)V", ordinal = 1)) + public void appendFabricDataPacks(File file, LevelProperties properties, CallbackInfo info) { + resourcePackContainerManager.addCreator(new ModResourcePackCreator(ResourceType.DATA)); + } } diff --git a/fabric-resource-loader/src/main/java/net/fabricmc/fabric/mixin/resources/MixinReloadableResourceManagerImpl.java b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/mixin/resources/MixinReloadableResourceManagerImpl.java index 41cde9ecfe..8011f0157b 100644 --- a/fabric-resource-loader/src/main/java/net/fabricmc/fabric/mixin/resources/MixinReloadableResourceManagerImpl.java +++ b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/mixin/resources/MixinReloadableResourceManagerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,17 +16,11 @@ package net.fabricmc.fabric.mixin.resources; -import com.google.common.collect.Lists; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; import net.fabricmc.fabric.impl.resources.ResourceManagerHelperImpl; -import net.minecraft.resource.*; -import net.minecraft.util.Void; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import java.util.List; diff --git a/fabric-resource-loader/src/main/java/net/fabricmc/fabric/mixin/resources/MixinReloadableResourceManagerImplClient.java b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/mixin/resources/MixinReloadableResourceManagerImplClient.java index 1239eae40b..57799b651b 100644 --- a/fabric-resource-loader/src/main/java/net/fabricmc/fabric/mixin/resources/MixinReloadableResourceManagerImplClient.java +++ b/fabric-resource-loader/src/main/java/net/fabricmc/fabric/mixin/resources/MixinReloadableResourceManagerImplClient.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,6 @@ package net.fabricmc.fabric.mixin.resources; import net.fabricmc.fabric.impl.resources.ResourceManagerHelperImpl; -import net.minecraft.resource.*; import net.minecraft.util.Void; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; diff --git a/fabric-tag-hooks/src/main/java/net/fabricmc/fabric/api/tag/TagRegistry.java b/fabric-tag-hooks/src/main/java/net/fabricmc/fabric/api/tag/TagRegistry.java index 69079d57e7..9f3281c38c 100644 --- a/fabric-tag-hooks/src/main/java/net/fabricmc/fabric/api/tag/TagRegistry.java +++ b/fabric-tag-hooks/src/main/java/net/fabricmc/fabric/api/tag/TagRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,6 @@ import net.minecraft.entity.EntityType; import net.minecraft.fluid.Fluid; import net.minecraft.item.Item; -import net.minecraft.tag.*; import net.minecraft.util.Identifier; import java.lang.reflect.Field; diff --git a/fabric-tag-hooks/src/main/java/net/fabricmc/fabric/impl/tag/TagDelegate.java b/fabric-tag-hooks/src/main/java/net/fabricmc/fabric/impl/tag/TagDelegate.java index d8ff6c32d6..72569fbb92 100644 --- a/fabric-tag-hooks/src/main/java/net/fabricmc/fabric/impl/tag/TagDelegate.java +++ b/fabric-tag-hooks/src/main/java/net/fabricmc/fabric/impl/tag/TagDelegate.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-testmods/java/net/fabricmc/fabric/commands/CommandMod.java b/fabric-testmods/java/net/fabricmc/fabric/commands/CommandMod.java index 27df116a1b..732453d939 100644 --- a/fabric-testmods/java/net/fabricmc/fabric/commands/CommandMod.java +++ b/fabric-testmods/java/net/fabricmc/fabric/commands/CommandMod.java @@ -17,7 +17,6 @@ package net.fabricmc.fabric.commands; import com.mojang.brigadier.Command; -import com.mojang.brigadier.builder.LiteralArgumentBuilder; import net.fabricmc.api.ModInitializer; import net.fabricmc.fabric.api.registry.CommandRegistry; import net.minecraft.server.command.CommandManager; @@ -28,10 +27,10 @@ public class CommandMod implements ModInitializer { public void onInitialize() { CommandRegistry.INSTANCE.register(false, (dispatcher) -> dispatcher.register( CommandManager.literal("fabric_test") - .executes(c -> { - c.getSource().sendFeedback(new StringTextComponent("Command works!"), false); - return Command.SINGLE_SUCCESS; - }) + .executes(c -> { + c.getSource().sendFeedback(new StringTextComponent("Command works!"), false); + return Command.SINGLE_SUCCESS; + }) )); CommandRegistry.INSTANCE.register(true, (dispatcher) -> dispatcher.register( diff --git a/fabric-testmods/java/net/fabricmc/fabric/containers/ContainerMod.java b/fabric-testmods/java/net/fabricmc/fabric/containers/ContainerMod.java index 0201ccaac8..67d93b52dd 100644 --- a/fabric-testmods/java/net/fabricmc/fabric/containers/ContainerMod.java +++ b/fabric-testmods/java/net/fabricmc/fabric/containers/ContainerMod.java @@ -87,13 +87,13 @@ public static class ExampleInventoryContainer extends Container { public ExampleInventoryContainer(int syncId, PlayerEntity playerEntity) { super(null, syncId); this.playerInventory = playerEntity.inventory; - for(int i = 0; i < 3; ++i) { - for(int j = 0; j < 9; ++j) { + for (int i = 0; i < 3; ++i) { + for (int j = 0; j < 9; ++j) { this.addSlot(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); } } - for(int j = 0; j < 9; ++j) { + for (int j = 0; j < 9; ++j) { this.addSlot(new Slot(playerInventory, j, 8 + j * 18, 142)); } } diff --git a/fabric-testmods/java/net/fabricmc/fabric/events/PickBlockEventModClient.java b/fabric-testmods/java/net/fabricmc/fabric/events/PickBlockEventModClient.java index 36464b952b..9d4a0044b5 100644 --- a/fabric-testmods/java/net/fabricmc/fabric/events/PickBlockEventModClient.java +++ b/fabric-testmods/java/net/fabricmc/fabric/events/PickBlockEventModClient.java @@ -26,7 +26,6 @@ import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.world.BlockView; -import net.minecraft.world.World; public class PickBlockEventModClient implements ClientModInitializer { @Override diff --git a/fabric-testmods/java/net/fabricmc/fabric/itemgroup/ItemGroupMod.java b/fabric-testmods/java/net/fabricmc/fabric/itemgroup/ItemGroupMod.java index e0cf7b33fc..79682e56e4 100644 --- a/fabric-testmods/java/net/fabricmc/fabric/itemgroup/ItemGroupMod.java +++ b/fabric-testmods/java/net/fabricmc/fabric/itemgroup/ItemGroupMod.java @@ -40,7 +40,7 @@ public void onInitialize() { //Creates a group with all modded items in FabricItemGroupBuilder.create(new Identifier("fabric", "modded")).appendItems(itemStacks -> Registry.ITEM.forEach(item -> { - if(!Registry.ITEM.getId(item).getNamespace().equals("minecraft")){ + if (!Registry.ITEM.getId(item).getNamespace().equals("minecraft")) { itemStacks.add(new ItemStack(item)); } })).icon(() -> new ItemStack(Blocks.TNT)).build(); diff --git a/fabric-testmods/java/net/fabricmc/fabric/loot/LootEntryMod.java b/fabric-testmods/java/net/fabricmc/fabric/loot/LootEntryMod.java index 7ec1d545fa..256df91d26 100644 --- a/fabric-testmods/java/net/fabricmc/fabric/loot/LootEntryMod.java +++ b/fabric-testmods/java/net/fabricmc/fabric/loot/LootEntryMod.java @@ -23,16 +23,12 @@ import net.fabricmc.fabric.api.registry.LootEntryTypeRegistry; import net.minecraft.util.Identifier; import net.minecraft.util.JsonHelper; -import net.minecraft.world.loot.LootChoice; import net.minecraft.world.loot.condition.LootCondition; -import net.minecraft.world.loot.context.LootContext; import net.minecraft.world.loot.entry.LootEntry; import net.minecraft.world.loot.entry.TagEntry; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import java.util.function.Consumer; - public class LootEntryMod implements ModInitializer { private static final Logger LOGGER = LogManager.getLogger(); diff --git a/fabric-testmods/java/net/fabricmc/fabric/model/ModelModClient.java b/fabric-testmods/java/net/fabricmc/fabric/model/ModelModClient.java index 2247d470d1..26cbe127ed 100644 --- a/fabric-testmods/java/net/fabricmc/fabric/model/ModelModClient.java +++ b/fabric-testmods/java/net/fabricmc/fabric/model/ModelModClient.java @@ -21,7 +21,6 @@ import net.fabricmc.fabric.api.event.client.ClientTickCallback; import net.minecraft.block.BlockState; import net.minecraft.client.MinecraftClient; -import net.minecraft.client.render.model.*; import net.minecraft.client.render.model.json.ModelItemPropertyOverrideList; import net.minecraft.client.render.model.json.ModelTransformation; import net.minecraft.client.texture.Sprite; @@ -29,7 +28,6 @@ import net.minecraft.util.Identifier; import net.minecraft.util.math.Direction; -import java.util.*; import java.util.function.Function; public class ModelModClient implements ClientModInitializer { diff --git a/fabric-testmods/java/net/fabricmc/fabric/resources/ResourceReloadModClient.java b/fabric-testmods/java/net/fabricmc/fabric/resources/ResourceReloadModClient.java index 9a6da7bbdb..b7ecc8e1f2 100644 --- a/fabric-testmods/java/net/fabricmc/fabric/resources/ResourceReloadModClient.java +++ b/fabric-testmods/java/net/fabricmc/fabric/resources/ResourceReloadModClient.java @@ -17,17 +17,14 @@ package net.fabricmc.fabric.resources; import net.fabricmc.api.ClientModInitializer; -import net.fabricmc.fabric.api.resource.IdentifiableResourceReloadListener; import net.fabricmc.fabric.api.resource.ResourceManagerHelper; import net.fabricmc.fabric.api.resource.SimpleSynchronousResourceReloadListener; import net.minecraft.resource.ResourceManager; import net.minecraft.resource.ResourceType; import net.minecraft.util.Identifier; -import net.minecraft.util.profiler.Profiler; import java.util.Collection; import java.util.Collections; -import java.util.concurrent.CompletableFuture; public class ResourceReloadModClient implements ClientModInitializer { @Override diff --git a/fabric-textures/src/main/java/net/fabricmc/fabric/api/client/texture/CustomSpriteLoader.java b/fabric-textures/src/main/java/net/fabricmc/fabric/api/client/texture/CustomSpriteLoader.java index a2826b785e..33887a4a8b 100644 --- a/fabric-textures/src/main/java/net/fabricmc/fabric/api/client/texture/CustomSpriteLoader.java +++ b/fabric-textures/src/main/java/net/fabricmc/fabric/api/client/texture/CustomSpriteLoader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,7 +28,7 @@ public interface CustomSpriteLoader { /** * Load the sprite. * - * @param manager The resource manager. + * @param manager The resource manager. * @param mipLevel The mip level for this sprite atlas. * @return true if the sprite should be added to the atlas, false otherwise * @throws IOException diff --git a/fabric-textures/src/main/java/net/fabricmc/fabric/api/client/texture/DependentSprite.java b/fabric-textures/src/main/java/net/fabricmc/fabric/api/client/texture/DependentSprite.java index 6ef7ffefa3..85f4977ffb 100644 --- a/fabric-textures/src/main/java/net/fabricmc/fabric/api/client/texture/DependentSprite.java +++ b/fabric-textures/src/main/java/net/fabricmc/fabric/api/client/texture/DependentSprite.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,7 +23,7 @@ /** * Implement this interface on a Sprite to declare additional dependencies * that should be processed prior to this sprite. - * + *

* Best used in conjunction with {@link CustomSpriteLoader}. */ public interface DependentSprite { diff --git a/fabric-textures/src/main/java/net/fabricmc/fabric/api/event/client/ClientSpriteRegistryCallback.java b/fabric-textures/src/main/java/net/fabricmc/fabric/api/event/client/ClientSpriteRegistryCallback.java index c5e807c83d..d43ba4635a 100644 --- a/fabric-textures/src/main/java/net/fabricmc/fabric/api/event/client/ClientSpriteRegistryCallback.java +++ b/fabric-textures/src/main/java/net/fabricmc/fabric/api/event/client/ClientSpriteRegistryCallback.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-textures/src/main/java/net/fabricmc/fabric/impl/client/texture/FabricSprite.java b/fabric-textures/src/main/java/net/fabricmc/fabric/impl/client/texture/FabricSprite.java index 062f3eab98..c58793b96b 100644 --- a/fabric-textures/src/main/java/net/fabricmc/fabric/impl/client/texture/FabricSprite.java +++ b/fabric-textures/src/main/java/net/fabricmc/fabric/impl/client/texture/FabricSprite.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-textures/src/main/java/net/fabricmc/fabric/mixin/client/texture/MixinSpriteAtlasTexture.java b/fabric-textures/src/main/java/net/fabricmc/fabric/mixin/client/texture/MixinSpriteAtlasTexture.java index 8766353d1d..20dad16bf7 100644 --- a/fabric-textures/src/main/java/net/fabricmc/fabric/mixin/client/texture/MixinSpriteAtlasTexture.java +++ b/fabric-textures/src/main/java/net/fabricmc/fabric/mixin/client/texture/MixinSpriteAtlasTexture.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, 2018 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,11 +32,9 @@ import org.apache.logging.log4j.Logger; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.*; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import java.io.IOException; -import java.util.*; @Mixin(SpriteAtlasTexture.class) public abstract class MixinSpriteAtlasTexture { @@ -53,9 +51,9 @@ public abstract class MixinSpriteAtlasTexture { /** * The purpose of this patch is to allow injecting sprites at the stage of Sprite instantiation, such as * Sprites with CustomSpriteLoaders. - * + *

* FabricSprite is a red herring. It's only use to go around Sprite's constructors being protected. - * + *

* method_18160 is a lambda used in runAsync. */ @SuppressWarnings("JavaDoc") diff --git a/src/main/java/net/fabricmc/fabric/impl/entity/FabricEntityType.java b/src/main/java/net/fabricmc/fabric/impl/entity/FabricEntityType.java deleted file mode 100644 index 657d0fedfc..0000000000 --- a/src/main/java/net/fabricmc/fabric/impl/entity/FabricEntityType.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2016, 2017, 2018 FabricMC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.fabricmc.fabric.impl.entity; - -import com.mojang.datafixers.types.Type; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityCategory; -import net.minecraft.entity.EntitySize; -import net.minecraft.entity.EntityType; - -public class FabricEntityType extends EntityType { - private final int maxTrackDistance, trackTickInterval; - private final Boolean alwaysUpdateVelocity; - - public FabricEntityType(EntityFactory entityType$EntityFactory_1, EntityCategory entityCategory_1, boolean boolean_1, boolean boolean_2, boolean boolean_3, Type type_1, EntitySize entitySize_1, int maxTrackDistance, int trackTickInterval, Boolean alwaysUpdateVelocity) { - super(entityType$EntityFactory_1, entityCategory_1, boolean_1, boolean_2, boolean_3, type_1, entitySize_1); - this.maxTrackDistance = maxTrackDistance; - this.trackTickInterval = trackTickInterval; - this.alwaysUpdateVelocity = alwaysUpdateVelocity; - } - - @Override - public int getMaxTrackDistance() { - if (maxTrackDistance != -1) { - return (maxTrackDistance + 15) / 16; - } - - return super.getMaxTrackDistance(); - } - - @Override - public int getTrackTickInterval() { - if (trackTickInterval != -1) { - return trackTickInterval; - } - - return super.getTrackTickInterval(); - } - - @Override - public boolean alwaysUpdateVelocity() { - if (alwaysUpdateVelocity != null) { - return alwaysUpdateVelocity; - } - - return super.alwaysUpdateVelocity(); - } -}