Skip to content

Commit

Permalink
🐛 Fix Flower Blockstates
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsMaddieNow committed Nov 13, 2023
1 parent 304029c commit 868eec3
Showing 1 changed file with 33 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,29 +36,40 @@ public static void markFlower(Identifier id){
public static void ProvidePacks(Consumer<ResourcePackProfile> profileAdder, ResourceType type) {

Instant instant = Instant.now();
InMemoryResourcePack baseResources = new InMemoryResourcePack.Named("building_tweaks_base"){
@Override
public @NotNull ResourcePackActivationType getActivationType(){
return ResourcePackActivationType.ALWAYS_ENABLED;
try (
InMemoryResourcePack baseResources = new InMemoryResourcePack.Named("building_tweaks_base") {
@Override
public @NotNull ResourcePackActivationType getActivationType() {
return ResourcePackActivationType.ALWAYS_ENABLED;
}
};
InMemoryResourcePack classicResources = new InMemoryResourcePack.Named("building_tweaks_classic")
)
{
baseResources.putTextAsync("pack.mcmeta", (identifier) -> String.format("""
{"pack":{"pack_format":%d,"description":"Maddie's Building Tweaks."}}
""", SharedConstants.getGameVersion().getResourceVersion(type)
));
addIconToPack(baseResources, "/assets/maddies_building_tweaks/base-pack.png");
addIconToPack(classicResources, "/assets/maddies_building_tweaks/classic-pack.png");
for (Identifier flower : Flowers) {
baseResources.putTextAsync(ResourceType.CLIENT_RESOURCES, new Identifier(flower.getNamespace(), String.format("blockstates/%1$s.json", flower.getPath())), (identifier) -> createFlowerBlockstate(flower));
baseResources.putTextAsync(ResourceType.CLIENT_RESOURCES, new Identifier(flower.getNamespace(), String.format("models/block/%1$sx%2$d.json", flower.getPath(), 1)), (identifier) -> createFlowerQuantityModel(flower, 1));
baseResources.putTextAsync(ResourceType.CLIENT_RESOURCES, new Identifier(flower.getNamespace(), String.format("models/block/%1$sx%2$d.json", flower.getPath(), 2)), (identifier) -> createFlowerQuantityModel(flower, 2));
baseResources.putTextAsync(ResourceType.CLIENT_RESOURCES, new Identifier(flower.getNamespace(), String.format("models/block/%1$sx%2$d.json", flower.getPath(), 3)), (identifier) -> createFlowerQuantityModel(flower, 3));
baseResources.putTextAsync(ResourceType.CLIENT_RESOURCES, new Identifier(flower.getNamespace(), String.format("models/block/%1$sx%2$d.json", flower.getPath(), 4)), (identifier) -> createFlowerQuantityModel(flower, 4));
baseResources.putTextAsync(ResourceType.CLIENT_RESOURCES, new Identifier(flower.getNamespace(), String.format("models/block/%1$s_base.json", flower.getPath())), (identifier) -> createFlowerBaseModel(flower));
baseResources.putTextAsync(ResourceType.SERVER_DATA, new Identifier(flower.getNamespace(), String.format("loot_tables/blocks/%1$s.json", flower.getPath())), (identifier) -> createFlowerLootTable(flower));
}
};
baseResources.putTextAsync("pack.mcmeta", (identifier) -> String.format("""
{"pack":{"pack_format":%d,"description":"Maddie's Building Tweaks."}}
""", SharedConstants.getGameVersion().getResourceVersion(type)
));
addIconToPack(baseResources, "/assets/maddies_building_tweaks/base-pack.png");
for(Identifier flower : Flowers){
baseResources.putTextAsync(ResourceType.CLIENT_RESOURCES, new Identifier(flower.getNamespace(), String.format("blockstates/%1$s.json", flower.getPath())), (identifier) -> createFlowerBlockstate(flower));
baseResources.putTextAsync(ResourceType.CLIENT_RESOURCES, new Identifier(flower.getNamespace(), String.format("models/block/%1$sx%2$d.json", flower.getPath(), 1)), (identifier) -> createFlowerQuantityModel(flower, 1));
baseResources.putTextAsync(ResourceType.CLIENT_RESOURCES, new Identifier(flower.getNamespace(), String.format("models/block/%1$sx%2$d.json", flower.getPath(), 2)), (identifier) -> createFlowerQuantityModel(flower, 2));
baseResources.putTextAsync(ResourceType.CLIENT_RESOURCES, new Identifier(flower.getNamespace(), String.format("models/block/%1$sx%2$d.json", flower.getPath(), 3)), (identifier) -> createFlowerQuantityModel(flower, 3));
baseResources.putTextAsync(ResourceType.CLIENT_RESOURCES, new Identifier(flower.getNamespace(), String.format("models/block/%1$sx%2$d.json", flower.getPath(), 4)), (identifier) -> createFlowerQuantityModel(flower, 4));
baseResources.putTextAsync(ResourceType.CLIENT_RESOURCES, new Identifier(flower.getNamespace(), String.format("models/block/%1$s_base.json", flower.getPath())), (identifier) -> createFlowerBaseModel(flower));
baseResources.putTextAsync(ResourceType.SERVER_DATA, new Identifier(flower.getNamespace(), String.format("loot_tables/blocks/%1$s.json", flower.getPath())), (identifier) -> createFlowerLootTable(flower));
profileAdder.accept(ResourcePackProfile.of("building_tweaks_base", Text.literal("Maddies Building Tweaks"), true, name -> baseResources, type, ResourcePackProfile.InsertionPosition.TOP, ResourcePackSource.PACK_SOURCE_BUILTIN));
classicResources.putTextAsync("pack.mcmeta", (identifier) -> String.format("""
{"pack":{"pack_format":%d,"description":"Maddie's Building Tweaks Classic Models"}}
""", SharedConstants.getGameVersion().getResourceVersion(type)
));
profileAdder.accept(ResourcePackProfile.of("building_tweaks_classic", Text.literal("Classic Models"), false, name -> classicResources, type, ResourcePackProfile.InsertionPosition.TOP, ResourcePackSource.PACK_SOURCE_BUILTIN));
}
profileAdder.accept(ResourcePackProfile.of("building_tweaks_base", Text.literal("Maddies Building Tweaks"), true, name -> baseResources, type, ResourcePackProfile.InsertionPosition.TOP, ResourcePackSource.PACK_SOURCE_BUILTIN));
long RegistrationTime = Duration.between(instant, Instant.now()).toMillis();
BuildingTweaks.LOGGER.info("Completed in %d".formatted(RegistrationTime));
BuildingTweaks.LOGGER.info("Completed Constructing Resource Packs in %dms".formatted(RegistrationTime));
}

static void addIconToPack(MutableResourcePack pack, String resourcePath){
Expand Down Expand Up @@ -88,7 +99,7 @@ static String createFlowerBlockstate(Identifier flower){
"y": 0
},
"when": {
"flowers": "2|3|4",
"flowers": "1",
"facing": "north"
}
},
Expand All @@ -98,7 +109,7 @@ static String createFlowerBlockstate(Identifier flower){
"y": 90
},
"when": {
"flowers": "2|3|4",
"flowers": "1",
"facing": "east"
}
},
Expand Down

0 comments on commit 868eec3

Please sign in to comment.