Skip to content

Commit

Permalink
cbt: 1.16.3 support
Browse files Browse the repository at this point in the history
Co-authored-by: Perry <r3alcl0ud@gmail.com>
Co-authored-by: LambdAurora <aurora42lambda@gmail.com>
  • Loading branch information
3 people committed Sep 19, 2020
1 parent d0d7781 commit a4e5a8a
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 13 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '0.4-SNAPSHOT'
id 'fabric-loom' version '0.5-SNAPSHOT'
id 'maven-publish'
}

Expand Down
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.16.1
yarn_mappings=1.16.1+build.9
loader_version=0.8.8+build.202
minecraft_version=1.16.3
yarn_mappings=1.16.3+build.11
loader_version=0.9.3+build.207
fabric_version=0.21.0+build.407-1.16

fabric_version=0.14.0+build.371-1.16
# Mod Properties
mod_version = 0.1.2+1.16
mod_version = 0.1.3+1.16
maven_group = io.github.nuclearfarts
archives_base_name = connected-block-textures
archives_base_name = connected-block-textures
Empty file modified gradlew
100644 → 100755
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import com.google.common.base.Predicates;

import net.minecraft.client.MinecraftClient;
import net.minecraft.client.texture.Sprite;
import net.minecraft.client.util.ModelIdentifier;
import net.minecraft.client.util.SpriteIdentifier;
Expand Down Expand Up @@ -63,7 +64,9 @@ public BaseCTMConfig(Properties properties, Identifier location, ResourceManager

Predicate<Biome> biomeMatcher;
if(properties.containsKey("biomes")) {
biomeMatcher = Arrays.stream(properties.getProperty("biomes").split(" ")).map(Identifier::new).map(Registry.BIOME::get).collect(Collectors.toCollection(HashSet::new))::contains;
@SuppressWarnings("resource")
Registry<Biome> biomes = MinecraftClient.getInstance().world.getRegistryManager().get(Registry.BIOME_KEY);
biomeMatcher = Arrays.stream(properties.getProperty("biomes").split(" ")).map(Identifier::new).map(biomes::get).collect(Collectors.toCollection(HashSet::new))::contains;
} else {
biomeMatcher = null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.concurrent.Executor;

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.CallbackInfoReturnable;
Expand All @@ -20,13 +21,16 @@

@Mixin(ReloadableResourceManagerImpl.class)
public abstract class ReloadableResourceManagerImplMixin implements ReloadableResourceManager {
@Inject(method = "beginMonitoredReload", at = @At("HEAD"))
@Shadow
public abstract void addPack(ResourcePack resourcePack);

@Inject(method = "beginMonitoredReload", at = @At(value = "RETURN", shift = At.Shift.BEFORE))
private void injectCBTPack(Executor prepareExecutor, Executor applyExecutor, CompletableFuture<Unit> initialStage, List<ResourcePack> packs, CallbackInfoReturnable<ResourceReloadMonitor> cir) {
ConnectedBlockTextures.RESOURCE_PACK_PRIORITY_MAP.clear();
for(int i = 0; i < packs.size(); i++) {
ConnectedBlockTextures.RESOURCE_PACK_PRIORITY_MAP.put(packs.get(i).getName(), i);
}
packs.add(ConnectedBlockTextures.resourcePack = new CBTResourcePack(this));
this.addPack(ConnectedBlockTextures.resourcePack = new CBTResourcePack(this));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public boolean isVanillaAdapter() {

@Override
public void emitBlockQuads(BlockRenderView blockView, BlockState state, BlockPos pos, Supplier<Random> randomSupplier, RenderContext context) {
SpriteFinder spriteFinder = SpriteFinder.get(MinecraftClient.getInstance().getBakedModelManager().method_24153(SpriteAtlasTexture.BLOCK_ATLAS_TEX));
SpriteFinder spriteFinder = SpriteFinder.get(MinecraftClient.getInstance().getBakedModelManager().method_24153(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE));
context.pushTransform(quad -> {
/*if(sideMatcher.test(quad.nominalFace())) {
Sprite spr = spriteFinder.find(quad, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class BasicTileProvider implements TileProvider {

public BasicTileProvider(Tile[] tiles) {
for(Tile tile : tiles) {
ids.add(new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEX, ConnectedBlockTextures.resourcePack.dynamicallyPutTile(tile)));
ids.add(new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, ConnectedBlockTextures.resourcePack.dynamicallyPutTile(tile)));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public CompactTileProvider(Tile[] origTiles) throws IOException {
blitQuarter(1, 1, origImages[1], tile);
}

spriteIds.add(new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEX, ConnectedBlockTextures.resourcePack.dynamicallyPutImage(tile)));
spriteIds.add(new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, ConnectedBlockTextures.resourcePack.dynamicallyPutImage(tile)));
}
}

Expand Down

0 comments on commit a4e5a8a

Please sign in to comment.