forked from FabricMC/fabric
update license header, add .editorconfig, run formatter - close #28
This commit is contained in:
parent
99acb0615e
commit
ab8198ed5f
182 changed files with 609 additions and 605 deletions
25
.editorconfig
Normal file
25
.editorconfig
Normal file
|
@ -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
HEADER
2
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.
|
||||
|
|
14
build.gradle
14
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'
|
||||
|
|
|
@ -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 @@ import net.minecraft.util.Identifier;
|
|||
|
||||
/**
|
||||
* Expanded version of {@link KeyBinding} for use by Fabric mods.
|
||||
*
|
||||
* <p>
|
||||
* *ALL* instantiated FabricKeyBindings should be registered in
|
||||
* {@link KeyBindingRegistry#register(FabricKeyBinding)}!
|
||||
*/
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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<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.
|
||||
*
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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<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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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 com.mojang.brigadier.CommandDispatcher;
|
|||
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<CommandDispatcher<ServerCommandSource>> consumer) {
|
||||
public void register(boolean dedicated, Consumer<CommandDispatcher<ServerCommandSource>> consumer) {
|
||||
CommandRegistryImpl.INSTANCE.register(dedicated, consumer);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.List;
|
|||
import java.util.function.Consumer;
|
||||
|
||||
public class CommandRegistryImpl {
|
||||
public static final CommandRegistryImpl INSTANCE = new CommandRegistryImpl();
|
||||
public static final CommandRegistryImpl INSTANCE = new CommandRegistryImpl();
|
||||
|
||||
private final List<Consumer<CommandDispatcher<ServerCommandSource>>> serverCommands;
|
||||
private final List<Consumer<CommandDispatcher<ServerCommandSource>>> dedicatedServerCommands;
|
||||
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 CommandRegistryImpl() {
|
||||
this.serverCommands = new ArrayList<>();
|
||||
this.dedicatedServerCommands = new ArrayList<>();
|
||||
}
|
||||
|
||||
public List<Consumer<CommandDispatcher<ServerCommandSource>>> entries(boolean dedicated) {
|
||||
return Collections.unmodifiableList(dedicated ? dedicatedServerCommands : serverCommands);
|
||||
}
|
||||
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 void register(boolean dedicated, Consumer<CommandDispatcher<ServerCommandSource>> consumer) {
|
||||
if (dedicated) {
|
||||
dedicatedServerCommands.add(consumer);
|
||||
} else {
|
||||
serverCommands.add(consumer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 @@ package net.fabricmc.fabric.mixin.registrycommands;
|
|||
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 org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|||
|
||||
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 abstract class MixinMinecraftDedicatedServer extends MinecraftServer {
|
|||
}
|
||||
|
||||
@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()));
|
||||
}
|
||||
|
|
|
@ -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 = "<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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
<C extends Container> void registerFactory(Identifier identifier, ContainerScreenFactory<C> 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<ContainerScreen> factory);
|
||||
|
||||
|
|
|
@ -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 @@ import net.minecraft.util.PacketByteBuf;
|
|||
public interface ContainerFactory<T> {
|
||||
|
||||
/**
|
||||
*
|
||||
* 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);
|
||||
|
|
|
@ -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<Container> 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<PacketByteBuf> 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<PacketByteBuf> writer);
|
||||
}
|
||||
|
|
|
@ -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 class ScreenProviderRegistryImpl implements ScreenProviderRegistry {
|
|||
public <C extends Container> void registerFactory(Identifier identifier, ContainerScreenFactory<C> 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;
|
||||
}
|
||||
|
|
|
@ -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 class ContainerProviderImpl implements ContainerProviderRegistry {
|
|||
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 extends Container> C createContainer(int syncId, Identifier identifier, PlayerEntity player, PacketByteBuf buf){
|
||||
public <C extends Container> C createContainer(int syncId, Identifier identifier, PlayerEntity player, PacketByteBuf buf) {
|
||||
ContainerFactory<Container> factory = FACTORIES.get(identifier);
|
||||
if (factory == null) {
|
||||
LOGGER.error("No container factory found for {}!", identifier.toString());
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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 @@ import org.spongepowered.asm.mixin.Shadow;
|
|||
|
||||
@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() {
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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> {
|
||||
V get(Block block);
|
||||
|
||||
void add(Block block, V value);
|
||||
|
||||
void add(Tag<Block> tag, V value);
|
||||
|
||||
void remove(Block block);
|
||||
|
||||
void remove(Tag<Block> tag);
|
||||
|
||||
void clear(Block block);
|
||||
|
||||
void clear(Tag<Block> tag);
|
||||
}
|
||||
|
|
|
@ -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 @@ import net.minecraft.tag.Tag;
|
|||
|
||||
public interface Item2ObjectMap<V> {
|
||||
V get(ItemProvider item);
|
||||
|
||||
void add(ItemProvider item, V value);
|
||||
|
||||
void add(Tag<Item> tag, V value);
|
||||
|
||||
void remove(ItemProvider item);
|
||||
|
||||
void remove(Tag<Item> tag);
|
||||
|
||||
void clear(ItemProvider item);
|
||||
|
||||
void clear(Tag<Item> tag);
|
||||
}
|
||||
|
|
|
@ -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.Item;
|
|||
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) {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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.ResourceManager;
|
|||
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);
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.fabricmc.fabric.api.registry.LootEntryTypeRegistry;
|
|||
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) {
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.At;
|
|||
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 @@ public abstract class MixinCrashReport {
|
|||
return modString.toString();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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 @@ import net.minecraft.world.World;
|
|||
/**
|
||||
* 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!
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* ATTACK_BLOCK does not let you control the packet sending process yet.
|
||||
*/
|
||||
public interface AttackBlockCallback {
|
||||
|
|
|
@ -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 @@ import net.minecraft.world.World;
|
|||
/**
|
||||
* 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!
|
||||
*
|
||||
* <p>
|
||||
* Upon return:
|
||||
* - SUCCESS cancels further processing and, on the client, sends a packet to the server.
|
||||
* - PASS falls back to further processing.
|
||||
|
|
|
@ -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 @@ import net.minecraft.world.World;
|
|||
/**
|
||||
* 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!
|
||||
*
|
||||
* <p>
|
||||
* Upon return:
|
||||
* - SUCCESS cancels further processing and, on the client, sends a packet to the server.
|
||||
* - PASS falls back to further processing.
|
||||
|
|
|
@ -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 @@ import net.minecraft.world.World;
|
|||
/**
|
||||
* 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!
|
||||
*
|
||||
* <p>
|
||||
* Upon return:
|
||||
* - SUCCESS cancels further processing and, on the client, sends a packet to the server.
|
||||
* - PASS falls back to further processing.
|
||||
|
|
|
@ -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 @@ import net.minecraft.world.World;
|
|||
/**
|
||||
* 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!
|
||||
*
|
||||
* <p>
|
||||
* Upon return:
|
||||
* - SUCCESS cancels further processing and, on the client, sends a packet to the server.
|
||||
* - PASS falls back to further processing.
|
||||
|
|
|
@ -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.block.BlockState;
|
|||
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;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.util.math.BlockPos;
|
|||
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;
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.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.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(MinecraftClient.class)
|
||||
|
@ -96,6 +95,7 @@ public abstract class MixinMinecraftClient {
|
|||
|
||||
@Shadow
|
||||
public abstract void doItemPick();
|
||||
|
||||
@Shadow
|
||||
public abstract ItemStack addBlockEntityNbt(ItemStack itemStack_1, BlockEntity blockEntity_1);
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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.ServerStartCallback;
|
|||
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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 @@ public final class FabricItemGroupBuilder {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 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 final class FabricItemGroupBuilder {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 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 final class FabricItemGroupBuilder {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 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 final class FabricItemGroupBuilder {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 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 final class FabricItemGroupBuilder {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 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<ItemStack> stackSupplier){
|
||||
public static ItemGroup build(Identifier identifier, Supplier<ItemStack> 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 final class FabricItemGroupBuilder {
|
|||
|
||||
@Override
|
||||
public void appendItems(DefaultedList<ItemStack> stacks) {
|
||||
if(stacksForDisplay != null){
|
||||
if (stacksForDisplay != null) {
|
||||
stacksForDisplay.accept(stacks);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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 class FabricCreativeGuiComponents {
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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 @@ package net.fabricmc.fabric.mixin.itemgroup.client;
|
|||
|
||||
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;
|
||||
|
|
|
@ -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<T> {
|
|||
|
||||
/**
|
||||
* Returns the invoker instance.
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
|
|
|
@ -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 final class EventFactory {
|
|||
/**
|
||||
* 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 <T> The listener type.
|
||||
* @param <T> The listener type.
|
||||
* @return The Event instance.
|
||||
*/
|
||||
public static <T> Event<T> createArrayBacked(Class<T> type, Function<T[], T> invokerFactory) {
|
||||
|
@ -61,15 +61,15 @@ public final class EventFactory {
|
|||
|
||||
/**
|
||||
* Create an "array-backed" Event instance with a custom empty invoker.
|
||||
*
|
||||
* <p>
|
||||
* 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 <T> The listener type.
|
||||
* @param <T> The listener type.
|
||||
* @return The Event instance.
|
||||
*/
|
||||
// TODO: Deprecate this once we have working codegen
|
||||
|
|
|
@ -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 @@ import net.minecraft.nbt.Tag;
|
|||
*
|
||||
* @see CompoundTag#containsKey(String, int)
|
||||
* @see Tag#idToString(int)
|
||||
*
|
||||
* <p>
|
||||
* For the current list of types, check with {@link Tag#TYPES}.
|
||||
*/
|
||||
public final class NbtType {
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.fabricmc.fabric.api.event.Event;
|
|||
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 @@ public final class EventFactoryImpl {
|
|||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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 @@ import java.util.Map;
|
|||
public final class ToolManager {
|
||||
public interface Entry {
|
||||
void setBreakByHand(boolean value);
|
||||
|
||||
void putBreakByTool(Tag<Item> tag, int miningLevel);
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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 @@ import net.minecraft.util.Identifier;
|
|||
public interface ModelProviderContext {
|
||||
/**
|
||||
* Load a model using a {@link Identifier}, {@link ModelIdentifier}, ...
|
||||
*
|
||||
* <p>
|
||||
* Please note that the game engine keeps track of circular model loading calls on its own.
|
||||
*
|
||||
* @param id The model identifier.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* This is where you want to add your own custom model formats.
|
||||
*
|
||||
* <p>
|
||||
* As providers are instantiated with a new provider, it is safe
|
||||
* (and recommended!) to cache information inside a loader.
|
||||
*
|
||||
* <p>
|
||||
* 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:
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*/
|
||||
|
|
|
@ -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 @@ 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 variant providers.
|
||||
*
|
||||
* <p>
|
||||
* 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).
|
||||
*
|
||||
* <p>
|
||||
* 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}.
|
||||
*
|
||||
* <p>
|
||||
* As every model loading is instantiated with a new provider, it is safe
|
||||
* (and recommended!) to cache information.
|
||||
*
|
||||
* <p>
|
||||
* Keep in mind that only *one* ModelVariantProvider may respond to a given model
|
||||
* at any time.
|
||||
*/
|
||||
|
|
|
@ -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 @@ import net.minecraft.util.Identifier;
|
|||
|
||||
public interface ModelLoaderHooks {
|
||||
void fabric_addModel(ModelIdentifier id);
|
||||
|
||||
UnbakedModel fabric_loadModel(Identifier id);
|
||||
}
|
||||
|
|
|
@ -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 net.minecraft.util.Identifier;
|
|||
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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 @@ import net.minecraft.nbt.CompoundTag;
|
|||
*/
|
||||
public interface BlockEntityClientSerializable {
|
||||
void fromClientTag(CompoundTag tag);
|
||||
|
||||
CompoundTag toClientTag(CompoundTag tag);
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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<Identifier> types);
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue