Skip to content

Commit

Permalink
Trails & Tails port
Browse files Browse the repository at this point in the history
  • Loading branch information
Chikorita-Lover committed Jun 7, 2023
1 parent e2eb887 commit 17efc89
Show file tree
Hide file tree
Showing 41 changed files with 267 additions and 259 deletions.
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ org.gradle.jvmargs=-Xmx1G
org.gradle.parallel=true

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.19.4
yarn_mappings=1.19.4+build.2
# check these on https://fabricmc.net/develop
minecraft_version=1.20
yarn_mappings=1.20+build.1
loader_version=0.14.21

# Mod Properties
Expand All @@ -15,5 +15,5 @@ org.gradle.parallel=true
archives_base_name = caffeinated

# Dependencies
fabric_version=0.83.0+1.19.4
fabric_version=0.83.0+1.20
farmersdelight_version=4111426
20 changes: 10 additions & 10 deletions src/main/generated/.cache/c189bb4c92920ea572e0709157481155fe15e5dc
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
// 1.19.4 2023-06-02T14:03:16.5766506 Caffeinated/Recipes
e2fead7a3c56471229a1547b8af5dacf46dad177 data\caffeinated\advancements\recipes\misc\coffee_beans_from_block.json
e6d3d01f61c3bab9af5118c077b4ffe23002eba2 data\caffeinated\advancements\recipes\misc\java_banner_pattern.json
// 1.20 2023-06-07T12:12:41.4203152 Caffeinated/Recipes
e154bc568fca23d856835d0e300a33c5e3c1fcd5 data\caffeinated\advancements\recipes\misc\coffee_beans_from_block.json
2b1061f72b3e9a1295c9aa4334d37c9dcb3dfc53 data\caffeinated\advancements\recipes\misc\java_banner_pattern.json
76a46edddf4e31119b24a67f63988b18a8aee17f data\caffeinated\recipes\ground_coffee_block.json
78a9786237bb9d4c565d8334b3b7eac772b426a0 data\caffeinated\advancements\recipes\misc\ground_coffee_from_block.json
bc82533d2cadedeb6aec668614fca49614706152 data\caffeinated\advancements\recipes\food\tiramisu.json
187961e40d0322c1b7b655376bfe28d0b99ec8bd data\caffeinated\advancements\recipes\misc\ground_coffee_from_block.json
06c7edbdec5cf1deb92d8e421279587f14aaab54 data\caffeinated\advancements\recipes\food\tiramisu.json
aff0b344beb7238820d9ef40b8eeae0b6ee96bb9 data\caffeinated\recipes\coffee_beans_from_block.json
4c85433379ef206f984248f2181f8f0d58e04302 data\caffeinated\recipes\coffee_beans_from_coffee_berries.json
58eb02ec0ffbfe7e0f4cbca4fd04e5c185e5be5a data\caffeinated\advancements\recipes\misc\coffee_beans_from_coffee_berries.json
6b9902befd959eb3bc01bca55faa32da5902eaeb data\caffeinated\recipes\tiramisu.json
195cc52740e219af6b8b65dde7d9ef8d0768d307 data\caffeinated\advancements\recipes\misc\coffee_beans_from_coffee_berries.json
d34b1b5cba65cbe93df946e3a6badee9edc69dc0 data\caffeinated\recipes\coffee_berries.json
7872d0d8329ad57778754a3bb074ae65f2fe2990 data\caffeinated\recipes\coffee_bean_block.json
743816fab7585e00cd7f2678713589c48bdc2aed data\caffeinated\recipes\ground_coffee_from_block.json
28bd293b0e0326a390dc603edd3a79891263b6bf data\caffeinated\advancements\recipes\building_blocks\ground_coffee_block.json
55a0f263de5782dd9ec9aecd1d1ae815e3760bdb data\caffeinated\advancements\recipes\building_blocks\ground_coffee_block.json
d466ced2e8e679a807bdbcee307e0eb5e6547942 data\caffeinated\recipes\java_banner_pattern.json
2284ca5a752274146a50f5db3365780de0f1602e data\caffeinated\advancements\recipes\building_blocks\coffee_bean_block.json
bb529f25b75b190a9da8518d7a0931d22cbaf194 data\caffeinated\advancements\recipes\building_blocks\coffee_bean_block.json
9d1c02e4b749346060e0aca83030e22690aed245 data\caffeinated\recipes\ground_coffee_from_coffee_beans.json
20ced6cf1d619bb41bf6e331479442b649420283 data\caffeinated\advancements\recipes\misc\ground_coffee_from_coffee_beans.json
687a2ea285584ee9d8f878bfebb8ac275be71986 data\caffeinated\advancements\recipes\food\coffee_berries.json
c25fb492ba07b4ed02e133e2329fe9f0b00a2b5e data\caffeinated\advancements\recipes\misc\ground_coffee_from_coffee_beans.json
7ac9428c1c4810e6e439997467b8c5afad1711b9 data\caffeinated\advancements\recipes\food\coffee_berries.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.19.4 2023-06-02T14:03:16.5627356 Caffeinated/Model Definitions
// 1.20 2023-06-07T12:12:41.4182846 Caffeinated/Model Definitions
da4528a3cfafc1ab21e5814b64029c10ec357178 assets\caffeinated\blockstates\ground_coffee_block.json
26f35f3a03b0d53578efd2c555721b08353d75f0 assets\caffeinated\blockstates\coffee_cauldron.json
b1a481861132973fe035c9b9ce7613e15938034c assets\caffeinated\models\block\coffee_berry_crate.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@
"recipes": [
"caffeinated:coffee_bean_block"
]
}
},
"sends_telemetry_event": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@
"recipes": [
"caffeinated:ground_coffee_block"
]
}
},
"sends_telemetry_event": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@
"recipes": [
"caffeinated:coffee_berries"
]
}
},
"sends_telemetry_event": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@
"recipes": [
"caffeinated:tiramisu"
]
}
},
"sends_telemetry_event": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@
"recipes": [
"caffeinated:coffee_beans_from_block"
]
}
},
"sends_telemetry_event": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@
"recipes": [
"caffeinated:coffee_beans_from_coffee_berries"
]
}
},
"sends_telemetry_event": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@
"recipes": [
"caffeinated:ground_coffee_from_block"
]
}
},
"sends_telemetry_event": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@
"recipes": [
"caffeinated:ground_coffee_from_coffee_beans"
]
}
},
"sends_telemetry_event": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@
"recipes": [
"caffeinated:java_banner_pattern"
]
}
},
"sends_telemetry_event": false
}
34 changes: 17 additions & 17 deletions src/main/java/com/chikoritalover/caffeinated/Caffeinated.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,28 @@ public class Caffeinated implements ModInitializer {

@Override
public void onInitialize() {
ModBannerPatterns.initAndGetDefault(Registries.BANNER_PATTERN);
ModBlocks.register();
ModCauldronBehavior.register();
ModItems.register();
ModParticleTypes.register();
ModPlacedFeatures.register();
ModSoundEvents.register();
ModStats.register();
ModStatusEffects.register();
ModTradeOffers.register();
ModBlockSoundGroup.register();
ModEntityTypeTags.register();
ModBlockTags.register();
ModItemTags.register();
ModBannerPatternTags.register();
ModBannerPatterns.register();
CaffeinatedBannerPatterns.initAndGetDefault(Registries.BANNER_PATTERN);
CaffeinatedBlocks.register();
CaffeinatedCauldronBehavior.register();
CaffeinatedItems.register();
CaffeinatedParticleTypes.register();
CaffeinatedPlacedFeatures.register();
CaffeinatedSoundEvents.register();
CaffeinatedStats.register();
CaffeinatedStatusEffects.register();
CaffeinatedTradeOffers.register();
CaffeinatedBlockSoundGroup.register();
CaffeinatedEntityTypeTags.register();
CaffeinatedBlockTags.register();
CaffeinatedItemTags.register();
CaffeinatedBannerPatternTags.register();
CaffeinatedBannerPatterns.register();

registerLootTableEvents();
}

public void registerLootTableEvents() {
addLootTablePool(1, 1, 0.5F, LootTables.JUNGLE_TEMPLE_CHEST, ModItems.COFFEE_BEANS, 1, 3);
addLootTablePool(1, 1, 0.5F, LootTables.JUNGLE_TEMPLE_CHEST, CaffeinatedItems.COFFEE_BEANS, 1, 3);
}

private void addLootTablePool(int minRolls, int maxRolls, float chance, Identifier lootTable, ItemConvertible item) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.chikoritalover.caffeinated;

import com.chikoritalover.caffeinated.registry.ModBlocks;
import com.chikoritalover.caffeinated.registry.ModParticleTypes;
import com.chikoritalover.caffeinated.registry.CaffeinatedBlocks;
import com.chikoritalover.caffeinated.registry.CaffeinatedParticleTypes;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
import net.fabricmc.fabric.api.client.particle.v1.ParticleFactoryRegistry;
Expand All @@ -11,10 +11,10 @@
public class CaffeinatedClient implements ClientModInitializer {
@Override
public void onInitializeClient() {
BlockRenderLayerMap.INSTANCE.putBlock(ModBlocks.COFFEE_SHRUB, RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(ModBlocks.FLOWERING_COFFEE_SHRUB, RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(ModBlocks.POTTED_COFFEE_SHRUB, RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(CaffeinatedBlocks.COFFEE_SHRUB, RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(CaffeinatedBlocks.FLOWERING_COFFEE_SHRUB, RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(CaffeinatedBlocks.POTTED_COFFEE_SHRUB, RenderLayer.getCutout());

ParticleFactoryRegistry.getInstance().register(ModParticleTypes.COFFEE_POP, BubblePopParticle.Factory::new);
ParticleFactoryRegistry.getInstance().register(CaffeinatedParticleTypes.COFFEE_POP, BubblePopParticle.Factory::new);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
package com.chikoritalover.caffeinated;

import com.chikoritalover.caffeinated.registry.CaffeinatedBlocks;
import com.chikoritalover.caffeinated.registry.CaffeinatedItems;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint;
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricModelProvider;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider;
import net.minecraft.block.Block;
import net.minecraft.block.LeveledCauldronBlock;
import net.minecraft.data.client.*;
import net.minecraft.data.server.recipe.RecipeJsonProvider;
import net.minecraft.data.server.recipe.ShapedRecipeJsonBuilder;
import net.minecraft.data.server.recipe.ShapelessRecipeJsonBuilder;
import net.minecraft.item.ItemConvertible;
import net.minecraft.item.Items;
import net.minecraft.recipe.book.RecipeCategory;
import net.minecraft.state.property.Properties;
import net.minecraft.state.property.Property;
import net.minecraft.util.Identifier;
import org.jetbrains.annotations.Nullable;

import java.util.function.Consumer;

public class CaffeinatedDataGenerator implements DataGeneratorEntrypoint {
@Override
public void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) {
FabricDataGenerator.Pack pack = fabricDataGenerator.createPack();
pack.addProvider(CaffeinatedModelGenerator::new);
pack.addProvider(CaffeinatedRecipeGenerator::new);
}

private static class CaffeinatedModelGenerator extends FabricModelProvider {
private CaffeinatedModelGenerator(FabricDataOutput output) {
super(output);
}

public final void registerCoffeeShrub(BlockStateModelGenerator blockStateModelGenerator, Block crop, Block pottedCrop, Property<Integer> ageProperty, int... ageTextureIndices) {
if (ageProperty.getValues().size() != ageTextureIndices.length) {
throw new IllegalArgumentException();
} else {
Int2ObjectMap<Identifier> int2ObjectMap = new Int2ObjectOpenHashMap<>();
BlockStateVariantMap blockStateVariantMap = BlockStateVariantMap.create(ageProperty).register((integer) -> {
int i = ageTextureIndices[integer];
Identifier identifier = int2ObjectMap.computeIfAbsent(i, (j) -> blockStateModelGenerator.createSubModel(crop, "_stage" + i, Models.CROSS, TextureMap::cross));
return BlockStateVariant.create().put(VariantSettings.MODEL, identifier);
});
blockStateModelGenerator.registerItemModel(crop.asItem());
blockStateModelGenerator.blockStateCollector.accept(VariantsBlockStateSupplier.create(crop).coordinate(blockStateVariantMap));
}

TextureMap textureMap = TextureMap.plant(TextureMap.getSubId(crop, "_stage1"));
Identifier identifier = BlockStateModelGenerator.TintType.NOT_TINTED.getFlowerPotCrossModel().upload(pottedCrop, textureMap, blockStateModelGenerator.modelCollector);
blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator.createSingletonBlockState(pottedCrop, identifier));
}

@Override
public void generateBlockStateModels(BlockStateModelGenerator blockStateModelGenerator) {
blockStateModelGenerator.registerSimpleCubeAll(CaffeinatedBlocks.COFFEE_BEAN_BLOCK);
blockStateModelGenerator.registerSimpleCubeAll(CaffeinatedBlocks.GROUND_COFFEE_BLOCK);
blockStateModelGenerator.registerSingleton(CaffeinatedBlocks.COFFEE_BERRY_CRATE, new TextureMap().put(TextureKey.SIDE, new Identifier(Caffeinated.MODID, "block/coffee_berry_crate_side")).put(TextureKey.TOP, new Identifier(Caffeinated.MODID, "block/coffee_berry_crate_top")).put(TextureKey.BOTTOM, new Identifier("farmersdelight", "block/crate_bottom")), Models.CUBE_BOTTOM_TOP);

blockStateModelGenerator.blockStateCollector.accept(VariantsBlockStateSupplier.create(CaffeinatedBlocks.COFFEE_CAULDRON).coordinate(BlockStateVariantMap.create(LeveledCauldronBlock.LEVEL).register(1, BlockStateVariant.create().put(VariantSettings.MODEL, Models.TEMPLATE_CAULDRON_LEVEL1.upload(CaffeinatedBlocks.COFFEE_CAULDRON, "_level1", TextureMap.cauldron(new Identifier(Caffeinated.MODID, "block/coffee")), blockStateModelGenerator.modelCollector))).register(2, BlockStateVariant.create().put(VariantSettings.MODEL, Models.TEMPLATE_CAULDRON_LEVEL2.upload(CaffeinatedBlocks.COFFEE_CAULDRON, "_level2", TextureMap.cauldron(new Identifier(Caffeinated.MODID, "block/coffee")), blockStateModelGenerator.modelCollector))).register(3, BlockStateVariant.create().put(VariantSettings.MODEL, Models.TEMPLATE_CAULDRON_FULL.upload(CaffeinatedBlocks.COFFEE_CAULDRON, "_full", TextureMap.cauldron(new Identifier(Caffeinated.MODID, "block/coffee")), blockStateModelGenerator.modelCollector)))));

blockStateModelGenerator.blockStateCollector.accept(VariantsBlockStateSupplier.create(CaffeinatedBlocks.GROUND_COFFEE_CAULDRON).coordinate(BlockStateVariantMap.create(LeveledCauldronBlock.LEVEL).register(1, BlockStateVariant.create().put(VariantSettings.MODEL, Models.TEMPLATE_CAULDRON_LEVEL1.upload(CaffeinatedBlocks.GROUND_COFFEE_CAULDRON, "_level1", TextureMap.cauldron(new Identifier(Caffeinated.MODID, "block/ground_coffee_cauldron")), blockStateModelGenerator.modelCollector))).register(2, BlockStateVariant.create().put(VariantSettings.MODEL, Models.TEMPLATE_CAULDRON_LEVEL2.upload(CaffeinatedBlocks.GROUND_COFFEE_CAULDRON, "_level2", TextureMap.cauldron(new Identifier(Caffeinated.MODID, "block/ground_coffee_cauldron")), blockStateModelGenerator.modelCollector))).register(3, BlockStateVariant.create().put(VariantSettings.MODEL, Models.TEMPLATE_CAULDRON_FULL.upload(CaffeinatedBlocks.GROUND_COFFEE_CAULDRON, "_full", TextureMap.cauldron(new Identifier(Caffeinated.MODID, "block/ground_coffee_cauldron")), blockStateModelGenerator.modelCollector)))));

registerCoffeeShrub(blockStateModelGenerator, CaffeinatedBlocks.COFFEE_SHRUB, CaffeinatedBlocks.POTTED_COFFEE_SHRUB, Properties.AGE_3, 0, 0, 1, 1);
}

@Override
public void generateItemModels(ItemModelGenerator itemModelGenerator) {
itemModelGenerator.register(CaffeinatedItems.GROUND_COFFEE, Models.GENERATED);
itemModelGenerator.register(CaffeinatedItems.JAVA_BANNER_PATTERN, Models.GENERATED);

itemModelGenerator.register(CaffeinatedItems.COFFEE_BERRIES, Models.GENERATED);
itemModelGenerator.register(CaffeinatedItems.COFFEE_BOTTLE, Models.GENERATED);
itemModelGenerator.register(CaffeinatedItems.TIRAMISU, Models.GENERATED);
}
}

private static class CaffeinatedRecipeGenerator extends FabricRecipeProvider {
private CaffeinatedRecipeGenerator(FabricDataOutput output) {
super(output);
}

public static void offerReversibleCompactingRecipes(Consumer<RecipeJsonProvider> exporter, ItemConvertible input, ItemConvertible compacted, String compactingRecipeName, @Nullable String compactingRecipeGroup, String reverseRecipeName, @Nullable String reverseRecipeGroup) {
ShapelessRecipeJsonBuilder.create(RecipeCategory.MISC, input, 9).input(compacted).group(reverseRecipeGroup).criterion(hasItem(compacted), conditionsFromItem(compacted)).offerTo(exporter, new Identifier(Caffeinated.MODID, reverseRecipeName));
ShapedRecipeJsonBuilder.create(RecipeCategory.BUILDING_BLOCKS, compacted).input('#', input).pattern("###").pattern("###").pattern("###").group(compactingRecipeGroup).criterion(hasItem(input), conditionsFromItem(input)).offerTo(exporter, new Identifier(Caffeinated.MODID, compactingRecipeName));
}

@Override
public void generate(Consumer<RecipeJsonProvider> exporter) {
offerReversibleCompactingRecipes(exporter, CaffeinatedItems.COFFEE_BEANS, CaffeinatedBlocks.COFFEE_BEAN_BLOCK, "coffee_bean_block", null, "coffee_beans_from_block", "coffee_beans");

offerReversibleCompactingRecipes(exporter, CaffeinatedItems.GROUND_COFFEE, CaffeinatedBlocks.GROUND_COFFEE_BLOCK, "ground_coffee_block", null, "ground_coffee_from_block", "ground_coffee");

ShapelessRecipeJsonBuilder.create(RecipeCategory.FOOD, CaffeinatedItems.COFFEE_BERRIES, 9).input(CaffeinatedBlocks.COFFEE_BERRY_CRATE).criterion(hasItem(CaffeinatedBlocks.COFFEE_BERRY_CRATE), conditionsFromItem(CaffeinatedBlocks.COFFEE_BERRY_CRATE)).offerTo(exporter);

ShapelessRecipeJsonBuilder.create(RecipeCategory.MISC, CaffeinatedItems.COFFEE_BEANS).input(CaffeinatedItems.COFFEE_BERRIES).group("coffee_beans").criterion(hasItem(CaffeinatedItems.COFFEE_BERRIES), conditionsFromItem(CaffeinatedItems.COFFEE_BERRIES)).offerTo(exporter, new Identifier(Caffeinated.MODID, "coffee_beans_from_coffee_berries"));

ShapedRecipeJsonBuilder.create(RecipeCategory.MISC, CaffeinatedItems.GROUND_COFFEE).input('#', CaffeinatedItems.COFFEE_BEANS).pattern("###").group("ground_coffee").criterion(hasItem(CaffeinatedItems.COFFEE_BEANS), conditionsFromItem(CaffeinatedItems.COFFEE_BEANS)).offerTo(exporter, new Identifier(Caffeinated.MODID, "ground_coffee_from_coffee_beans"));

ShapelessRecipeJsonBuilder.create(RecipeCategory.MISC, CaffeinatedItems.JAVA_BANNER_PATTERN).input(Items.PAPER).input(CaffeinatedItems.COFFEE_BOTTLE).criterion(hasItem(CaffeinatedItems.COFFEE_BOTTLE), conditionsFromItem(CaffeinatedItems.COFFEE_BOTTLE)).offerTo(exporter);

ShapedRecipeJsonBuilder.create(RecipeCategory.FOOD, CaffeinatedItems.TIRAMISU, 2).input('#', CaffeinatedItems.COFFEE_BOTTLE).input('C', Items.COCOA_BEANS).input('E', Items.EGG).input('M', Items.MILK_BUCKET).input('W', Items.WHEAT).pattern("C#C").pattern("EME").pattern("WWW").group("tiramisu").criterion(hasItem(CaffeinatedItems.COFFEE_BOTTLE), conditionsFromItem(CaffeinatedItems.COFFEE_BOTTLE)).offerTo(exporter);
}
}
}
Loading

0 comments on commit 17efc89

Please sign in to comment.