mirror of
https://github.com/FabricMC/fabric.git
synced 2025-03-21 20:50:28 -04:00
20w22a
This commit is contained in:
parent
4a08d6b285
commit
da175ad6ad
33 changed files with 173 additions and 140 deletions
build.gradle
fabric-command-api-v1
build.gradle
src
main/java/net/fabricmc/fabric/mixin/command
testmod/java/net/fabricmc/fabric/test/command
fabric-content-registries-v0
build.gradle
src/main/java/net/fabricmc/fabric
api/registry
impl/content/registry
mixin/content/registry
fabric-loot-tables-v1
fabric-object-builder-api-v1
build.gradle
src/main/java/net/fabricmc/fabric/api/object/builder/v1/block
fabric-object-builders-v0
fabric-registry-sync-v0
build.gradle
src/main/java/net/fabricmc/fabric/mixin/registry/sync
fabric-renderer-indigo
build.gradle
src/main/java/net/fabricmc/fabric/impl/client/indigo/renderer/render
fabric-resource-loader-v0
fabric-tool-attribute-api-v1
|
@ -12,9 +12,9 @@ plugins {
|
|||
def ENV = System.getenv()
|
||||
|
||||
class Globals {
|
||||
static def baseVersion = "0.10.10"
|
||||
static def mcVersion = "20w21a"
|
||||
static def yarnVersion = "+build.2"
|
||||
static def baseVersion = "0.10.11"
|
||||
static def mcVersion = "20w22a"
|
||||
static def yarnVersion = "+build.1"
|
||||
}
|
||||
|
||||
version = Globals.baseVersion + "+" + (ENV.BUILD_NUMBER ? ("build." + ENV.BUILD_NUMBER) : "local") + "-" + getBranch()
|
||||
|
@ -67,7 +67,7 @@ allprojects {
|
|||
dependencies {
|
||||
minecraft "com.mojang:minecraft:$Globals.mcVersion"
|
||||
mappings "net.fabricmc:yarn:${Globals.mcVersion}${Globals.yarnVersion}:v2"
|
||||
modCompile "net.fabricmc:fabric-loader:0.8.2+build.194"
|
||||
modCompile "net.fabricmc:fabric-loader:0.8.4+build.198"
|
||||
}
|
||||
|
||||
configurations {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
archivesBaseName = "fabric-command-api-v1"
|
||||
version = getSubprojectVersion(project, "1.0.2")
|
||||
version = getSubprojectVersion(project, "1.0.3")
|
||||
|
||||
dependencies {
|
||||
compile project(path: ':fabric-api-base', configuration: 'dev')
|
||||
|
|
|
@ -28,18 +28,20 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|||
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.WorldGenerationProgressListenerFactory;
|
||||
import net.minecraft.server.command.CommandManager;
|
||||
import net.minecraft.server.dedicated.MinecraftDedicatedServer;
|
||||
import net.minecraft.class_5350;
|
||||
import net.minecraft.resource.ResourcePackManager;
|
||||
import net.minecraft.resource.ResourcePackProfile;
|
||||
import net.minecraft.util.UserCache;
|
||||
import net.minecraft.class_5219;
|
||||
import net.minecraft.world.SaveProperties;
|
||||
import net.minecraft.world.level.storage.LevelStorage;
|
||||
|
||||
import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback;
|
||||
|
||||
@Mixin(MinecraftDedicatedServer.class)
|
||||
public abstract class MixinMinecraftDedicatedServer extends MinecraftServer {
|
||||
public MixinMinecraftDedicatedServer(LevelStorage.Session session, class_5219 arg, Proxy proxy, DataFixer dataFixer, CommandManager commandManager, MinecraftSessionService minecraftSessionService, GameProfileRepository gameProfileRepository, UserCache userCache, WorldGenerationProgressListenerFactory worldGenerationProgressListenerFactory) {
|
||||
super(session, arg, proxy, dataFixer, commandManager, minecraftSessionService, gameProfileRepository, userCache, worldGenerationProgressListenerFactory);
|
||||
public MixinMinecraftDedicatedServer(LevelStorage.Session session, SaveProperties saveProperties, ResourcePackManager<ResourcePackProfile> resourcePackManager, Proxy proxy, DataFixer dataFixer, class_5350 arg, MinecraftSessionService minecraftSessionService, GameProfileRepository gameProfileRepository, UserCache userCache, WorldGenerationProgressListenerFactory worldGenerationProgressListenerFactory) {
|
||||
super(session, saveProperties, resourcePackManager, proxy, dataFixer, arg, minecraftSessionService, gameProfileRepository, userCache, worldGenerationProgressListenerFactory);
|
||||
}
|
||||
|
||||
@Inject(method = "setupServer", at = @At("HEAD"))
|
||||
|
|
|
@ -63,6 +63,11 @@ public class CommandTest implements ModInitializer {
|
|||
}
|
||||
});
|
||||
|
||||
// Disabling the test mod for now, as https://bugs.mojang.com/browse/MC-186109 breaks it
|
||||
if (true) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Use the ServerTickCallback to verify the commands actually exist in the command dispatcher.
|
||||
ServerTickCallback.EVENT.register(server -> {
|
||||
// Don't run the test more than once
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
archivesBaseName = "fabric-content-registries-v0"
|
||||
version = getSubprojectVersion(project, "0.1.6")
|
||||
version = getSubprojectVersion(project, "0.1.7")
|
||||
|
||||
dependencies {
|
||||
compile project(path: ':fabric-api-base', configuration: 'dev')
|
||||
|
|
|
@ -29,5 +29,5 @@ public interface LootEntryTypeRegistry {
|
|||
LootEntryTypeRegistry INSTANCE = LootEntryTypeRegistryImpl.INSTANCE;
|
||||
|
||||
@Deprecated
|
||||
void register(LootEntry.Serializer<?> serializer);
|
||||
void register(LootEntry.class_5337<?> serializer);
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public final class LootEntryTypeRegistryImpl implements LootEntryTypeRegistry {
|
|||
Method target = null;
|
||||
|
||||
for (Method m : LootEntries.class.getDeclaredMethods()) {
|
||||
if (m.getParameterCount() == 1 && m.getParameterTypes()[0] == LootEntry.Serializer.class) {
|
||||
if (m.getParameterCount() == 1 && m.getParameterTypes()[0] == LootEntry.class_5337.class) {
|
||||
if (target != null) {
|
||||
throw new RuntimeException("More than one register-like method found in LootEntries!");
|
||||
} else {
|
||||
|
@ -52,7 +52,7 @@ public final class LootEntryTypeRegistryImpl implements LootEntryTypeRegistry {
|
|||
private LootEntryTypeRegistryImpl() { }
|
||||
|
||||
@Override
|
||||
public void register(LootEntry.Serializer<?> serializer) {
|
||||
public void register(LootEntry.class_5337<?> serializer) {
|
||||
try {
|
||||
REGISTER_METHOD.invoke(null, serializer);
|
||||
} catch (Throwable t) {
|
||||
|
|
|
@ -57,7 +57,7 @@ public class MixinFireBlock implements FireBlockHooks {
|
|||
|
||||
if (entry != null) {
|
||||
// TODO: use a (BlockState -> int) with this as the default impl
|
||||
if (block.method_28498(Properties.WATERLOGGED) && block.get(Properties.WATERLOGGED)) {
|
||||
if (block.contains(Properties.WATERLOGGED) && block.get(Properties.WATERLOGGED)) {
|
||||
info.setReturnValue(0);
|
||||
} else {
|
||||
info.setReturnValue(entry.getBurnChance());
|
||||
|
@ -71,7 +71,7 @@ public class MixinFireBlock implements FireBlockHooks {
|
|||
|
||||
if (entry != null) {
|
||||
// TODO: use a (BlockState -> int) with this as the default impl
|
||||
if (block.method_28498(Properties.WATERLOGGED) && block.get(Properties.WATERLOGGED)) {
|
||||
if (block.contains(Properties.WATERLOGGED) && block.get(Properties.WATERLOGGED)) {
|
||||
info.setReturnValue(0);
|
||||
} else {
|
||||
info.setReturnValue(entry.getSpreadChance());
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
archivesBaseName = "fabric-loot-tables-v1"
|
||||
version = getSubprojectVersion(project, "0.1.7")
|
||||
version = getSubprojectVersion(project, "0.1.8")
|
||||
|
||||
dependencies {
|
||||
compile project(path: ':fabric-api-base', configuration: 'dev')
|
||||
|
|
|
@ -20,7 +20,7 @@ import java.util.List;
|
|||
|
||||
import net.minecraft.loot.LootPool;
|
||||
import net.minecraft.loot.LootTableRange;
|
||||
import net.minecraft.loot.condition.LootCondition;
|
||||
import net.minecraft.class_5341;
|
||||
import net.minecraft.loot.entry.LootEntry;
|
||||
import net.minecraft.loot.function.LootFunction;
|
||||
|
||||
|
@ -34,7 +34,7 @@ public interface FabricLootPool {
|
|||
}
|
||||
|
||||
List<LootEntry> getEntries();
|
||||
List<LootCondition> getConditions();
|
||||
List<class_5341> getConditions();
|
||||
List<LootFunction> getFunctions();
|
||||
LootTableRange getRolls();
|
||||
}
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
|
||||
package net.fabricmc.fabric.api.loot.v1;
|
||||
|
||||
import net.minecraft.class_5341;
|
||||
import net.minecraft.loot.LootPool;
|
||||
import net.minecraft.loot.LootTableRange;
|
||||
import net.minecraft.loot.condition.LootCondition;
|
||||
import net.minecraft.loot.entry.LootEntry;
|
||||
import net.minecraft.loot.function.LootFunction;
|
||||
|
||||
|
@ -46,7 +46,7 @@ public class FabricLootPoolBuilder extends LootPool.Builder {
|
|||
}
|
||||
|
||||
@Override
|
||||
public FabricLootPoolBuilder conditionally(LootCondition.Builder condition) {
|
||||
public FabricLootPoolBuilder conditionally(class_5341.Builder condition) {
|
||||
super.conditionally(condition);
|
||||
return this;
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ public class FabricLootPoolBuilder extends LootPool.Builder {
|
|||
return this;
|
||||
}
|
||||
|
||||
public FabricLootPoolBuilder withCondition(LootCondition condition) {
|
||||
public FabricLootPoolBuilder withCondition(class_5341 condition) {
|
||||
extended.getConditions().add(condition);
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -34,5 +34,5 @@ public interface LootEntryTypeRegistry {
|
|||
*
|
||||
* @param serializer the loot entry serializer
|
||||
*/
|
||||
void register(LootEntry.Serializer<?> serializer);
|
||||
void register(LootEntry.class_5337<?> serializer);
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ public final class LootEntryTypeRegistryImpl implements net.fabricmc.fabric.api.
|
|||
Method target = null;
|
||||
|
||||
for (Method m : LootEntries.class.getDeclaredMethods()) {
|
||||
if (m.getParameterCount() == 1 && m.getParameterTypes()[0] == LootEntry.Serializer.class) {
|
||||
if (m.getParameterCount() == 1 && m.getParameterTypes()[0] == LootEntry.class_5337.class) {
|
||||
if (target != null) {
|
||||
throw new RuntimeException("More than one register-like method found in LootEntries!");
|
||||
} else {
|
||||
|
@ -49,7 +49,7 @@ public final class LootEntryTypeRegistryImpl implements net.fabricmc.fabric.api.
|
|||
private LootEntryTypeRegistryImpl() { }
|
||||
|
||||
@Override
|
||||
public void register(LootEntry.Serializer<?> serializer) {
|
||||
public void register(LootEntry.class_5337<?> serializer) {
|
||||
try {
|
||||
REGISTER_METHOD.invoke(null, serializer);
|
||||
} catch (Throwable t) {
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.spongepowered.asm.mixin.Mixin;
|
|||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
import net.minecraft.loot.LootPool;
|
||||
import net.minecraft.loot.condition.LootCondition;
|
||||
import net.minecraft.class_5341;
|
||||
import net.minecraft.loot.entry.LootEntry;
|
||||
import net.minecraft.loot.function.LootFunction;
|
||||
|
||||
|
@ -31,7 +31,7 @@ public interface LootPoolBuilderHooks {
|
|||
@Accessor
|
||||
List<LootEntry> getEntries();
|
||||
@Accessor
|
||||
List<LootCondition> getConditions();
|
||||
List<class_5341> getConditions();
|
||||
@Accessor
|
||||
List<LootFunction> getFunctions();
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.spongepowered.asm.mixin.gen.Accessor;
|
|||
|
||||
import net.minecraft.loot.LootPool;
|
||||
import net.minecraft.loot.LootTableRange;
|
||||
import net.minecraft.loot.condition.LootCondition;
|
||||
import net.minecraft.class_5341;
|
||||
import net.minecraft.loot.entry.LootEntry;
|
||||
import net.minecraft.loot.function.LootFunction;
|
||||
|
||||
|
@ -40,7 +40,7 @@ public abstract class MixinLootPool implements FabricLootPool {
|
|||
|
||||
@Shadow
|
||||
@Final
|
||||
private LootCondition[] conditions;
|
||||
private class_5341[] conditions;
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
|
@ -52,7 +52,7 @@ public abstract class MixinLootPool implements FabricLootPool {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<LootCondition> getConditions() {
|
||||
public List<class_5341> getConditions() {
|
||||
return Arrays.asList(conditions);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
archivesBaseName = "fabric-object-builder-api-v1"
|
||||
version = getSubprojectVersion(project, "1.3.1")
|
||||
version = getSubprojectVersion(project, "1.4.0")
|
||||
|
||||
dependencies {
|
||||
compile project(path: ':fabric-api-base', configuration: 'dev')
|
||||
|
|
|
@ -285,4 +285,13 @@ public class FabricBlockSettings extends AbstractBlock.Settings {
|
|||
public FabricBlockSettings breakByTool(Tag<Item> tag) {
|
||||
return this.breakByTool(tag, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make the material require tool to drop and slows down mining speed if the incorrect tool is used.
|
||||
*/
|
||||
@Override
|
||||
public FabricBlockSettings method_29292() {
|
||||
super.method_29292();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,13 +83,4 @@ public class FabricMaterialBuilder extends Material.Builder {
|
|||
super.replaceable();
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make the material require tool to drop and slows down mining speed if the incorrect tool is used.
|
||||
*/
|
||||
@Override
|
||||
public FabricMaterialBuilder requiresTool() {
|
||||
super.requiresTool();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
archivesBaseName = "fabric-object-builders"
|
||||
version = getSubprojectVersion(project, "0.5.2")
|
||||
version = getSubprojectVersion(project, "0.6.0")
|
||||
|
||||
dependencies {
|
||||
compile project(path: ':fabric-api-base', configuration: 'dev')
|
||||
|
|
|
@ -89,12 +89,6 @@ public class FabricMaterialBuilder extends Material.Builder {
|
|||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FabricMaterialBuilder requiresTool() {
|
||||
this.delegate.requiresTool();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Material build() {
|
||||
return this.delegate.build();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
archivesBaseName = "fabric-registry-sync-v0"
|
||||
version = getSubprojectVersion(project, "0.3.3")
|
||||
version = getSubprojectVersion(project, "0.3.4")
|
||||
|
||||
dependencies {
|
||||
compile project(path: ':fabric-api-base', configuration: 'dev')
|
||||
|
|
|
@ -20,6 +20,7 @@ import java.util.ArrayList;
|
|||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.collect.BiMap;
|
||||
|
@ -41,8 +42,9 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|||
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.collection.Int2ObjectBiMap;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.registry.SimpleRegistry;
|
||||
import net.minecraft.class_5321;
|
||||
import net.minecraft.util.registry.RegistryKey;
|
||||
|
||||
import net.fabricmc.fabric.api.event.Event;
|
||||
import net.fabricmc.fabric.api.event.EventFactory;
|
||||
|
@ -59,7 +61,9 @@ public abstract class MixinIdRegistry<T> implements RemappableRegistry, Listenab
|
|||
@Shadow
|
||||
protected Int2ObjectBiMap<T> indexedEntries;
|
||||
@Shadow
|
||||
protected BiMap<Identifier, T> entries;
|
||||
protected BiMap<Identifier, T> entriesById;
|
||||
@Shadow
|
||||
protected BiMap<RegistryKey<T>, T> entriesByKey;
|
||||
@Shadow
|
||||
private int nextId;
|
||||
@Unique
|
||||
|
@ -124,17 +128,17 @@ public abstract class MixinIdRegistry<T> implements RemappableRegistry, Listenab
|
|||
|
||||
@SuppressWarnings({"unchecked", "ConstantConditions"})
|
||||
@Inject(method = "set", at = @At("HEAD"))
|
||||
public void setPre(int id, class_5321<T> registryId, Object object, CallbackInfoReturnable info) {
|
||||
public void setPre(int id, RegistryKey<T> registryId, Object object, CallbackInfoReturnable info) {
|
||||
int indexedEntriesId = indexedEntries.getId((T) object);
|
||||
|
||||
if (indexedEntriesId >= 0) {
|
||||
throw new RuntimeException("Attempted to register object " + object + " twice! (at raw IDs " + indexedEntriesId + " and " + id + " )");
|
||||
}
|
||||
|
||||
if (!entries.containsKey(registryId.method_29177())) {
|
||||
if (!entriesById.containsKey(registryId.getValue())) {
|
||||
fabric_isObjectNew = true;
|
||||
} else {
|
||||
T oldObject = entries.get(registryId.method_29177());
|
||||
T oldObject = entriesById.get(registryId.getValue());
|
||||
|
||||
if (oldObject != null && oldObject != object) {
|
||||
int oldId = indexedEntries.getId(oldObject);
|
||||
|
@ -143,7 +147,7 @@ public abstract class MixinIdRegistry<T> implements RemappableRegistry, Listenab
|
|||
throw new RuntimeException("Attempted to register ID " + registryId + " at different raw IDs (" + oldId + ", " + id + ")! If you're trying to override an item, use .set(), not .register()!");
|
||||
}
|
||||
|
||||
fabric_removeObjectEvent.invoker().onEntryRemoved(oldId, registryId.method_29177(), oldObject);
|
||||
fabric_removeObjectEvent.invoker().onEntryRemoved(oldId, registryId.getValue(), oldObject);
|
||||
fabric_isObjectNew = true;
|
||||
} else {
|
||||
fabric_isObjectNew = false;
|
||||
|
@ -153,9 +157,9 @@ public abstract class MixinIdRegistry<T> implements RemappableRegistry, Listenab
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Inject(method = "set", at = @At("RETURN"))
|
||||
public void setPost(int id, class_5321<T> registryId, Object object, CallbackInfoReturnable info) {
|
||||
public void setPost(int id, RegistryKey<T> registryId, Object object, CallbackInfoReturnable info) {
|
||||
if (fabric_isObjectNew) {
|
||||
fabric_addObjectEvent.invoker().onEntryAdded(id, registryId.method_29177(), object);
|
||||
fabric_addObjectEvent.invoker().onEntryAdded(id, registryId.getValue(), object);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -172,7 +176,7 @@ public abstract class MixinIdRegistry<T> implements RemappableRegistry, Listenab
|
|||
List<String> strings = null;
|
||||
|
||||
for (Identifier remoteId : remoteIndexedEntries.keySet()) {
|
||||
if (!entries.keySet().contains(remoteId)) {
|
||||
if (!entriesById.keySet().contains(remoteId)) {
|
||||
if (strings == null) {
|
||||
strings = new ArrayList<>();
|
||||
}
|
||||
|
@ -194,11 +198,11 @@ public abstract class MixinIdRegistry<T> implements RemappableRegistry, Listenab
|
|||
break;
|
||||
}
|
||||
case EXACT: {
|
||||
if (!entries.keySet().equals(remoteIndexedEntries.keySet())) {
|
||||
if (!entriesById.keySet().equals(remoteIndexedEntries.keySet())) {
|
||||
List<String> strings = new ArrayList<>();
|
||||
|
||||
for (Identifier remoteId : remoteIndexedEntries.keySet()) {
|
||||
if (!entries.keySet().contains(remoteId)) {
|
||||
if (!entriesById.keySet().contains(remoteId)) {
|
||||
strings.add(" - " + remoteId + " (missing on local)");
|
||||
}
|
||||
}
|
||||
|
@ -230,7 +234,7 @@ public abstract class MixinIdRegistry<T> implements RemappableRegistry, Listenab
|
|||
// compatibility.
|
||||
if (fabric_prevIndexedEntries == null) {
|
||||
fabric_prevIndexedEntries = new Object2IntOpenHashMap<>();
|
||||
fabric_prevEntries = HashBiMap.create(entries);
|
||||
fabric_prevEntries = HashBiMap.create(entriesById);
|
||||
|
||||
for (Object o : registry) {
|
||||
fabric_prevIndexedEntries.put(registry.getId(o), registry.getRawId(o));
|
||||
|
@ -285,7 +289,8 @@ public abstract class MixinIdRegistry<T> implements RemappableRegistry, Listenab
|
|||
}
|
||||
|
||||
// note: indexedEntries cannot be safely remove()d from
|
||||
entries.keySet().removeAll(droppedIds);
|
||||
entriesById.keySet().removeAll(droppedIds);
|
||||
entriesByKey.keySet().removeIf(registryKey -> droppedIds.contains(registryKey.getValue()));
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -312,7 +317,7 @@ public abstract class MixinIdRegistry<T> implements RemappableRegistry, Listenab
|
|||
|
||||
for (Identifier identifier : orderedRemoteEntries) {
|
||||
int id = remoteIndexedEntries.getInt(identifier);
|
||||
T object = entries.get(identifier);
|
||||
T object = entriesById.get(identifier);
|
||||
|
||||
// Warn if an object is missing from the local registry.
|
||||
// This should only happen in AUTHORITATIVE mode, and as such we
|
||||
|
@ -346,19 +351,26 @@ public abstract class MixinIdRegistry<T> implements RemappableRegistry, Listenab
|
|||
|
||||
// Emit AddObject events for previously culled objects.
|
||||
for (Identifier id : fabric_prevEntries.keySet()) {
|
||||
if (!entries.containsKey(id)) {
|
||||
if (!entriesById.containsKey(id)) {
|
||||
assert fabric_prevIndexedEntries.containsKey(id);
|
||||
addedIds.add(id);
|
||||
}
|
||||
}
|
||||
|
||||
entries.clear();
|
||||
entries.putAll(fabric_prevEntries);
|
||||
entriesById.clear();
|
||||
entriesByKey.clear();
|
||||
|
||||
entriesById.putAll(fabric_prevEntries);
|
||||
|
||||
for (Map.Entry<Identifier, T> entry : fabric_prevEntries.entrySet()) {
|
||||
//noinspection unchecked
|
||||
entriesByKey.put(RegistryKey.of(RegistryKey.ofRegistry(((Registry) Registry.REGISTRIES).getId(this)), entry.getKey()), entry.getValue());
|
||||
}
|
||||
|
||||
remap(name, fabric_prevIndexedEntries, RemapMode.AUTHORITATIVE);
|
||||
|
||||
for (Identifier id : addedIds) {
|
||||
fabric_getAddObjectEvent().invoker().onEntryAdded(indexedEntries.getId(entries.get(id)), id, entries.get(id));
|
||||
fabric_getAddObjectEvent().invoker().onEntryAdded(indexedEntries.getId(entriesById.get(id)), id, entriesById.get(id));
|
||||
}
|
||||
|
||||
fabric_prevIndexedEntries = null;
|
||||
|
|
|
@ -37,7 +37,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|||
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtIo;
|
||||
import net.minecraft.class_5219;
|
||||
import net.minecraft.world.SaveProperties;
|
||||
import net.minecraft.world.level.storage.LevelStorage;
|
||||
|
||||
import net.fabricmc.fabric.impl.registry.sync.RegistrySyncManager;
|
||||
|
@ -121,7 +121,7 @@ public class MixinLevelStorageSession {
|
|||
}
|
||||
|
||||
@Inject(method = "method_27426", at = @At("HEAD"))
|
||||
public void saveWorld(class_5219 levelProperties, CompoundTag compoundTag, CallbackInfo info) {
|
||||
public void saveWorld(SaveProperties saveProperties, CompoundTag compoundTag, CallbackInfo info) {
|
||||
if (!Files.exists(directory)) {
|
||||
return;
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ public class MixinLevelStorageSession {
|
|||
|
||||
// TODO: stop double save on client?
|
||||
@Inject(method = "readLevelProperties", at = @At("HEAD"))
|
||||
public void readWorldProperties(CallbackInfoReturnable<class_5219> callbackInfo) {
|
||||
public void readWorldProperties(CallbackInfoReturnable<SaveProperties> callbackInfo) {
|
||||
// Load
|
||||
for (int i = 0; i < FABRIC_ID_REGISTRY_BACKUPS; i++) {
|
||||
FABRIC_LOGGER.trace("[fabric-registry-sync] Loading Fabric registry [file " + (i + 1) + "/" + (FABRIC_ID_REGISTRY_BACKUPS + 1) + "]");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
archivesBaseName = "fabric-renderer-indigo"
|
||||
version = getSubprojectVersion(project, "0.2.29")
|
||||
version = getSubprojectVersion(project, "0.2.30")
|
||||
|
||||
dependencies {
|
||||
compile project(path: ':fabric-api-base', configuration: 'dev')
|
||||
|
|
|
@ -106,7 +106,7 @@ public class ItemRenderContext extends AbstractRenderContext implements RenderCo
|
|||
this.transformMode = transformMode;
|
||||
this.vanillaHandler = vanillaHandler;
|
||||
quadBlendMode = BlendMode.DEFAULT;
|
||||
modelVertexConsumer = selectVertexConsumer(RenderLayers.getItemLayer(itemStack));
|
||||
modelVertexConsumer = selectVertexConsumer(RenderLayers.getItemLayer(itemStack, transformMode != ModelTransformation.Mode.GROUND));
|
||||
|
||||
matrixStack.push();
|
||||
((BakedModel) model).getTransformation().getTransformation(transformMode).apply(invert, matrixStack);
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
archivesBaseName = "fabric-resource-loader-v0"
|
||||
version = getSubprojectVersion(project, "0.1.14")
|
||||
version = getSubprojectVersion(project, "0.2.0")
|
||||
|
|
|
@ -21,12 +21,16 @@ import java.nio.file.Path;
|
|||
import java.util.List;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import net.minecraft.SharedConstants;
|
||||
import net.minecraft.client.resource.Format4ResourcePack;
|
||||
import net.minecraft.resource.ResourcePack;
|
||||
import net.minecraft.resource.ResourceType;
|
||||
import net.minecraft.resource.DefaultResourcePack;
|
||||
|
||||
import net.fabricmc.fabric.mixin.resource.loader.MixinFormat4ResourcePack;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.fabricmc.loader.api.ModContainer;
|
||||
import net.fabricmc.loader.api.metadata.ModMetadata;
|
||||
|
@ -83,4 +87,38 @@ public final class ModResourcePackUtil {
|
|||
return "Fabric Mod \"" + info.getId() + "\"";
|
||||
}
|
||||
}
|
||||
|
||||
public static void modifyResourcePackList(List<ResourcePack> list) {
|
||||
List<ResourcePack> 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 isDefaultResources = pack instanceof DefaultResourcePack;
|
||||
|
||||
if (!isDefaultResources && pack instanceof Format4ResourcePack) {
|
||||
MixinFormat4ResourcePack fixer = (MixinFormat4ResourcePack) pack;
|
||||
isDefaultResources = fixer.getParent() instanceof DefaultResourcePack;
|
||||
}
|
||||
|
||||
if (isDefaultResources) {
|
||||
ModResourcePackUtil.appendModResourcePacks(list, ResourceType.CLIENT_RESOURCES);
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,77 +18,22 @@ package net.fabricmc.fabric.mixin.resource.loader;
|
|||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.stream.Collector;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
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.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||
|
||||
import net.minecraft.client.resource.Format4ResourcePack;
|
||||
import net.minecraft.resource.DefaultResourcePack;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.resource.ReloadableResourceManager;
|
||||
import net.minecraft.resource.ResourcePack;
|
||||
import net.minecraft.resource.ResourceType;
|
||||
|
||||
import net.fabricmc.fabric.impl.resource.loader.ModResourcePackUtil;
|
||||
|
||||
@Mixin(MinecraftClient.class)
|
||||
public class MixinMinecraftGame {
|
||||
@Shadow
|
||||
private ReloadableResourceManager resourceManager;
|
||||
|
||||
private void fabric_modifyResourcePackList(List<ResourcePack> list) {
|
||||
List<ResourcePack> 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 isDefaultResources = pack instanceof DefaultResourcePack;
|
||||
|
||||
if (!isDefaultResources && pack instanceof Format4ResourcePack) {
|
||||
MixinFormat4ResourcePack fixer = (MixinFormat4ResourcePack) pack;
|
||||
isDefaultResources = fixer.getParent() instanceof DefaultResourcePack;
|
||||
}
|
||||
|
||||
if (isDefaultResources) {
|
||||
ModResourcePackUtil.appendModResourcePacks(list, ResourceType.CLIENT_RESOURCES);
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "<init>", at = @At(value = "INVOKE", target = "Ljava/util/stream/Stream;collect(Ljava/util/stream/Collector;)Ljava/lang/Object;"))
|
||||
public Object initResources(Stream<ResourcePack> stream, Collector collector) {
|
||||
List<ResourcePack> fabricResourcePacks = stream.collect(Collectors.toList());
|
||||
fabric_modifyResourcePackList(fabricResourcePacks);
|
||||
//noinspection unchecked
|
||||
return fabricResourcePacks.stream().collect(collector);
|
||||
}
|
||||
|
||||
@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<CompletableFuture> info, CompletableFuture<java.lang.Void> cf, List<ResourcePack> list) {
|
||||
fabric_modifyResourcePackList(list);
|
||||
ModResourcePackUtil.modifyResourcePackList(list);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,26 +16,21 @@
|
|||
|
||||
package net.fabricmc.fabric.mixin.resource.loader;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
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.ModifyArg;
|
||||
|
||||
import net.minecraft.resource.ResourcePackManager;
|
||||
import net.minecraft.resource.ResourcePackProfile;
|
||||
import net.minecraft.resource.ResourceType;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.resource.ResourcePackProvider;
|
||||
|
||||
import net.fabricmc.fabric.impl.resource.loader.ModResourcePackCreator;
|
||||
|
||||
@Mixin(MinecraftServer.class)
|
||||
public class MixinMinecraftServer {
|
||||
@Shadow
|
||||
private ResourcePackManager<ResourcePackProfile> dataPackManager;
|
||||
|
||||
@Inject(method = "loadWorldDataPacks", at = @At(value = "INVOKE", target = "Lnet/minecraft/resource/ResourcePackManager;registerProvider(Lnet/minecraft/resource/ResourcePackProvider;)V", ordinal = 1))
|
||||
public void appendFabricDataPacks(CallbackInfo info) {
|
||||
dataPackManager.registerProvider(new ModResourcePackCreator(ResourceType.SERVER_DATA));
|
||||
@ModifyArg(method = "method_29438", at = @At(value = "INVOKE", target = "Lnet/minecraft/resource/ResourcePackManager;<init>(Lnet/minecraft/resource/ResourcePackProfile$Factory;[Lnet/minecraft/resource/ResourcePackProvider;)V"))
|
||||
private static ResourcePackProvider[] appendFabricDataPacks(ResourcePackProvider[] packProviders) {
|
||||
return ArrayUtils.add(packProviders, new ModResourcePackCreator(ResourceType.SERVER_DATA));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2017, 2018, 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.mixin.resource.loader;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import net.minecraft.resource.ResourcePack;
|
||||
import net.minecraft.resource.ResourcePackManager;
|
||||
|
||||
import net.fabricmc.fabric.impl.resource.loader.ModResourcePackUtil;
|
||||
|
||||
@Mixin(ResourcePackManager.class)
|
||||
public class MixinResourcePackManager {
|
||||
@Inject(method = "method_29211", at = @At("RETURN"), cancellable = true)
|
||||
public void method_29211(CallbackInfoReturnable<List<ResourcePack>> infoReturnable) {
|
||||
List<ResourcePack> list = new ArrayList<>(infoReturnable.getReturnValue());
|
||||
ModResourcePackUtil.modifyResourcePackList(list);
|
||||
infoReturnable.setReturnValue(list);
|
||||
}
|
||||
}
|
|
@ -11,6 +11,7 @@
|
|||
"client": [
|
||||
"MixinFormat4ResourcePack",
|
||||
"MixinKeyedResourceReloadListener$Client",
|
||||
"MixinResourcePackManager",
|
||||
"MixinMinecraftGame"
|
||||
],
|
||||
"injectors": {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
archivesBaseName = "fabric-tool-attribute-api-v1"
|
||||
version = getSubprojectVersion(project, "1.1.0")
|
||||
version = getSubprojectVersion(project, "1.1.1")
|
||||
|
||||
dependencies {
|
||||
compile project(path: ':fabric-api-base', configuration: 'dev')
|
||||
|
|
|
@ -41,8 +41,9 @@ public class ToolAttributeTest implements ModInitializer {
|
|||
Registry.register(Registry.ITEM, new Identifier("fabric-tool-attribute-api-v1-testmod", "test_shovel"), new TestShovel(new Item.Settings()));
|
||||
// Register a block that requires a shovel that is as strong or stronger than an iron one.
|
||||
Block block = Registry.register(Registry.BLOCK, new Identifier("fabric-tool-attribute-api-v1-testmod", "hardened_block"),
|
||||
new Block(FabricBlockSettings.of(new FabricMaterialBuilder(MaterialColor.SAND).requiresTool().build(), MaterialColor.STONE)
|
||||
new Block(FabricBlockSettings.of(new FabricMaterialBuilder(MaterialColor.SAND).build(), MaterialColor.STONE)
|
||||
.breakByTool(FabricToolTags.SHOVELS, 2)
|
||||
.method_29292()
|
||||
.strength(0.6F)
|
||||
.sounds(BlockSoundGroup.GRAVEL)));
|
||||
Registry.register(Registry.ITEM, new Identifier("fabric-tool-attribute-api-v1-testmod", "hardened_block"), new BlockItem(block, new Item.Settings()));
|
||||
|
|
Loading…
Reference in a new issue