diff --git a/fabric-textures-v0/build.gradle b/fabric-textures-v0/build.gradle index 78a4306ca..d24de7f2f 100644 --- a/fabric-textures-v0/build.gradle +++ b/fabric-textures-v0/build.gradle @@ -1,5 +1,5 @@ archivesBaseName = "fabric-textures-v0" -version = getSubprojectVersion(project, "1.0.0") +version = getSubprojectVersion(project, "1.0.1") dependencies { compile project(path: ':fabric-api-base', configuration: 'dev') diff --git a/fabric-textures-v0/src/main/java/net/fabricmc/fabric/impl/client/texture/SpriteAtlasTextureHooks.java b/fabric-textures-v0/src/main/java/net/fabricmc/fabric/impl/client/texture/SpriteAtlasTextureHooks.java deleted file mode 100644 index 9849e643b..000000000 --- a/fabric-textures-v0/src/main/java/net/fabricmc/fabric/impl/client/texture/SpriteAtlasTextureHooks.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2016, 2017, 2018, 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.client.texture; - -import net.minecraft.util.Identifier; - -public interface SpriteAtlasTextureHooks { - void onRegisteredAs(Identifier id); -} diff --git a/fabric-textures-v0/src/main/java/net/fabricmc/fabric/mixin/client/texture/MixinSpriteAtlasTexture.java b/fabric-textures-v0/src/main/java/net/fabricmc/fabric/mixin/client/texture/MixinSpriteAtlasTexture.java index f5ec23033..acdfba622 100644 --- a/fabric-textures-v0/src/main/java/net/fabricmc/fabric/mixin/client/texture/MixinSpriteAtlasTexture.java +++ b/fabric-textures-v0/src/main/java/net/fabricmc/fabric/mixin/client/texture/MixinSpriteAtlasTexture.java @@ -44,11 +44,10 @@ import net.minecraft.util.crash.CrashReportSection; import net.fabricmc.fabric.api.client.texture.DependentSprite; import net.fabricmc.fabric.api.event.client.ClientSpriteRegistryCallback; -import net.fabricmc.fabric.impl.client.texture.SpriteAtlasTextureHooks; import net.fabricmc.fabric.impl.client.texture.SpriteRegistryCallbackHolder; @Mixin(SpriteAtlasTexture.class) -public abstract class MixinSpriteAtlasTexture implements SpriteAtlasTextureHooks { +public abstract class MixinSpriteAtlasTexture { @Unique private static Logger FABRIC_LOGGER = LogManager.getLogger(); @Shadow @@ -57,14 +56,8 @@ public abstract class MixinSpriteAtlasTexture implements SpriteAtlasTextureHooks @Shadow public abstract Sprite getSprite(Identifier id); - private final Set<Identifier> fabric_localIds = new HashSet<>(); - - // EVENT/HOOKS LOGIC - - @Override - public void onRegisteredAs(Identifier id) { - fabric_localIds.add(id); - } + @Shadow + public abstract Identifier method_24106(); // INJECTION LOGIC @@ -85,11 +78,7 @@ public abstract class MixinSpriteAtlasTexture implements SpriteAtlasTextureHooks fabric_injectedSprites = new HashMap<>(); ClientSpriteRegistryCallback.Registry registry = new ClientSpriteRegistryCallback.Registry(fabric_injectedSprites, set::add); - //noinspection ConstantConditions - for (Identifier id : fabric_localIds) { - SpriteRegistryCallbackHolder.eventLocal(id).invoker().registerSprites((SpriteAtlasTexture) (Object) this, registry); - } - + SpriteRegistryCallbackHolder.eventLocal(method_24106()).invoker().registerSprites((SpriteAtlasTexture) (Object) this, registry); SpriteRegistryCallbackHolder.EVENT_GLOBAL.invoker().registerSprites((SpriteAtlasTexture) (Object) this, registry); // TODO: Unoptimized. diff --git a/fabric-textures-v0/src/main/java/net/fabricmc/fabric/mixin/client/texture/MixinTextureManager.java b/fabric-textures-v0/src/main/java/net/fabricmc/fabric/mixin/client/texture/MixinTextureManager.java deleted file mode 100644 index 29325de44..000000000 --- a/fabric-textures-v0/src/main/java/net/fabricmc/fabric/mixin/client/texture/MixinTextureManager.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2016, 2017, 2018, 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.client.texture; - -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.client.texture.AbstractTexture; -import net.minecraft.client.texture.TextureManager; -import net.minecraft.util.Identifier; - -import net.fabricmc.fabric.impl.client.texture.SpriteAtlasTextureHooks; - -@Mixin(TextureManager.class) -public class MixinTextureManager { - @Inject(at = @At("RETURN"), method = "registerTexture") - private void afterRegisterTexture(Identifier identifier, AbstractTexture texture, CallbackInfoReturnable<Boolean> info) { - if (texture instanceof SpriteAtlasTextureHooks) { - ((SpriteAtlasTextureHooks) texture).onRegisteredAs(identifier); - } - } -} diff --git a/fabric-textures-v0/src/main/resources/fabric-textures-v0.mixins.json b/fabric-textures-v0/src/main/resources/fabric-textures-v0.mixins.json index 21468685b..e9dfaac01 100644 --- a/fabric-textures-v0/src/main/resources/fabric-textures-v0.mixins.json +++ b/fabric-textures-v0/src/main/resources/fabric-textures-v0.mixins.json @@ -3,8 +3,7 @@ "package": "net.fabricmc.fabric.mixin.client.texture", "compatibilityLevel": "JAVA_8", "client": [ - "MixinSpriteAtlasTexture", - "MixinTextureManager" + "MixinSpriteAtlasTexture" ], "injectors": { "defaultRequire": 1