Skip to content

Commit

Permalink
update license header, add .editorconfig, run formatter - close Fabri…
Browse files Browse the repository at this point in the history
  • Loading branch information
asiekierka committed Apr 26, 2019
1 parent 99acb06 commit ab8198e
Show file tree
Hide file tree
Showing 182 changed files with 613 additions and 609 deletions.
25 changes: 25 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion HEADER
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
14 changes: 12 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

Expand All @@ -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
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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")
}
}
Expand All @@ -139,6 +147,9 @@ publishing {
}
}

task licenseFormatAll
subprojects { p -> licenseFormatAll.dependsOn("${p.path}:licenseFormat") }

dependencies {
afterEvaluate {
subprojects.each {
Expand Down Expand Up @@ -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'
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -22,7 +22,7 @@

/**
* Expanded version of {@link KeyBinding} for use by Fabric mods.
*
* <p>
* *ALL* instantiated FabricKeyBindings should be registered in
* {@link KeyBindingRegistry#register(FabricKeyBinding)}!
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -29,13 +29,15 @@ public interface KeyBindingRegistry {

/**
* Add a new key binding category.
*
* @param categoryName The key binding category name.
* @return True if a new category was added.
*/
boolean addCategory(String categoryName);

/**
* Register a new key binding.
*
* @param binding The key binding.
* @return True if a new key binding was registered.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -37,7 +37,7 @@ public interface ColorProviderRegistry<T, Provider> {

/**
* Get a color provider for the given object.
*
* <p>
* 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.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -37,7 +37,7 @@ public class MixinEntityRenderManager {
private Map<Class<? extends Entity>, EntityRenderer<? extends Entity>> renderers;

@Inject(method = "<init>(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);
}
}
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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;

/**
Expand All @@ -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<CommandDispatcher<ServerCommandSource>> consumer) {
public void register(boolean dedicated, Consumer<CommandDispatcher<ServerCommandSource>> consumer) {
CommandRegistryImpl.INSTANCE.register(dedicated, consumer);
}
}
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -10,25 +25,25 @@
import java.util.function.Consumer;

public class CommandRegistryImpl {
public static final CommandRegistryImpl INSTANCE = new CommandRegistryImpl();

private final List<Consumer<CommandDispatcher<ServerCommandSource>>> serverCommands;
private final List<Consumer<CommandDispatcher<ServerCommandSource>>> dedicatedServerCommands;

public CommandRegistryImpl() {
this.serverCommands = new ArrayList<>();
this.dedicatedServerCommands = new ArrayList<>();
}

public List<Consumer<CommandDispatcher<ServerCommandSource>>> entries(boolean dedicated) {
return Collections.unmodifiableList(dedicated ? dedicatedServerCommands : serverCommands);
}

public void register(boolean dedicated, Consumer<CommandDispatcher<ServerCommandSource>> consumer) {
if (dedicated) {
dedicatedServerCommands.add(consumer);
} else {
serverCommands.add(consumer);
}
}
public static final CommandRegistryImpl INSTANCE = new CommandRegistryImpl();

private final List<Consumer<CommandDispatcher<ServerCommandSource>>> serverCommands;
private final List<Consumer<CommandDispatcher<ServerCommandSource>>> dedicatedServerCommands;

public CommandRegistryImpl() {
this.serverCommands = new ArrayList<>();
this.dedicatedServerCommands = new ArrayList<>();
}

public List<Consumer<CommandDispatcher<ServerCommandSource>>> entries(boolean dedicated) {
return Collections.unmodifiableList(dedicated ? dedicatedServerCommands : serverCommands);
}

public void register(boolean dedicated, Consumer<CommandDispatcher<ServerCommandSource>> consumer) {
if (dedicated) {
dedicatedServerCommands.add(consumer);
} else {
serverCommands.add(consumer);
}
}
}
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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;
Expand All @@ -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 {
Expand All @@ -46,7 +42,7 @@ public MixinMinecraftDedicatedServer(File file_1, Proxy proxy_1, DataFixer dataF
}

@Inject(method = "setupServer", at = @At("HEAD"))
private void setupServer(CallbackInfoReturnable<Boolean> info){
private void setupServer(CallbackInfoReturnable<Boolean> info) {
CommandRegistryImpl.INSTANCE.entries(false).forEach((e) -> e.accept(getCommandManager().getDispatcher()));
CommandRegistryImpl.INSTANCE.entries(true).forEach((e) -> e.accept(getCommandManager().getDispatcher()));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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;
Expand All @@ -38,7 +37,7 @@ public class MixinServerCommandManager {
@Inject(method = "<init>(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));
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Loading

0 comments on commit ab8198e

Please sign in to comment.