Skip to content

Commit

Permalink
1.21.4
Browse files Browse the repository at this point in the history
  • Loading branch information
yurisuika committed Dec 11, 2024
1 parent 5c8b77e commit c045354
Show file tree
Hide file tree
Showing 8 changed files with 207 additions and 117 deletions.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
org.gradle.jvmargs = -Xmx3G
loom.platform = forge

minecraft_version = 1.21.3
minecraft_version = 1.21.4
parchment_version = 2024.11.10

mod_id = blossom
Expand All @@ -10,4 +10,4 @@ mod_version = 2.0.0
maven_group = dev.yurisuika.blossom
archives_base_name = blossom

forge_version = 1.21.3-53.0.25
forge_version = 1.21.4-54.0.1
32 changes: 3 additions & 29 deletions src/main/java/dev/yurisuika/blossom/Blossom.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,15 @@
import dev.yurisuika.blossom.util.config.Config;
import dev.yurisuika.blossom.world.entity.animal.BeeInterface;
import dev.yurisuika.blossom.world.level.block.BlossomBlocks;
import dev.yurisuika.blossom.world.level.block.FloweringLeavesBlock;
import dev.yurisuika.blossom.world.level.block.FruitingLeavesBlock;
import dev.yurisuika.blossom.world.level.item.BlossomItems;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BiomeColors;
import net.minecraft.client.renderer.ItemBlockRenderTypes;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.item.ItemProperties;
import net.minecraft.core.component.DataComponents;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.animal.Bee;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.CreativeModeTabs;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.component.BlockItemStateProperties;
import net.minecraft.world.level.FoliageColor;
import net.minecraft.world.level.block.Blocks;
import net.minecraftforge.api.distmarker.Dist;
Expand All @@ -40,12 +33,11 @@
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;

import java.util.Objects;

@Mod("blossom")
public class Blossom {

@Mod.EventBusSubscriber(modid = "blossom")

public static class CommonForgeEvents {

@SubscribeEvent
Expand Down Expand Up @@ -93,36 +85,18 @@ public static void registerRenderLayers(FMLClientSetupEvent event) {
ItemBlockRenderTypes.setRenderLayer(BlossomBlocks.FLOWERING_OAK_LEAVES.get(), RenderType.cutout());
}

@SubscribeEvent
public static void registerItemProperties(FMLClientSetupEvent event) {
ItemProperties.register(BlossomItems.FRUITING_OAK_LEAVES.get(), ResourceLocation.tryParse("age"), (stack, world, entity, seed) -> {
Integer integer = stack.getOrDefault(DataComponents.BLOCK_STATE, BlockItemStateProperties.EMPTY).get(FruitingLeavesBlock.AGE);
return Objects.nonNull(integer) ? integer / 8.0F : 0.0F;
});
ItemProperties.register(BlossomItems.FLOWERING_OAK_LEAVES.get(), ResourceLocation.tryParse("age"), (stack, world, entity, seed) -> {
Integer integer = stack.getOrDefault(DataComponents.BLOCK_STATE, BlockItemStateProperties.EMPTY).get(FloweringLeavesBlock.AGE);
return Objects.nonNull(integer) ? integer / 4.0F : 0.0F;
});
}

@SubscribeEvent
public static void registerBlockColors(RegisterColorHandlersEvent.Block event) {
event.getBlockColors().register((state, level, pos, tintIndex) -> level != null && pos != null ? BiomeColors.getAverageFoliageColor(level, pos) : FoliageColor.get(0.5F, 1.0F), BlossomBlocks.FRUITING_OAK_LEAVES.get());
event.getBlockColors().register((state, level, pos, tintIndex) -> level != null && pos != null ? BiomeColors.getAverageFoliageColor(level, pos) : FoliageColor.get(0.5F, 1.0F), BlossomBlocks.FLOWERING_OAK_LEAVES.get());
}

@SubscribeEvent
public static void registerItemColors(RegisterColorHandlersEvent.Item event) {
event.getItemColors().register((stack, tintIndex) -> tintIndex > 0 ? -1 : Minecraft.getInstance().getBlockColors().getColor(((BlockItem) stack.getItem()).getBlock().defaultBlockState(), null, null, tintIndex), BlossomBlocks.FRUITING_OAK_LEAVES.get());
event.getItemColors().register((stack, tintIndex) -> tintIndex > 0 ? -1 : Minecraft.getInstance().getBlockColors().getColor(((BlockItem) stack.getItem()).getBlock().defaultBlockState(), null, null, tintIndex), BlossomBlocks.FLOWERING_OAK_LEAVES.get());
}

@SubscribeEvent
public static void registerCreativeModeTabs(BuildCreativeModeTabContentsEvent event) {
if (event.getTabKey() == CreativeModeTabs.NATURAL_BLOCKS) {
event.accept(BlossomBlocks.FRUITING_OAK_LEAVES.get());
event.accept(BlossomBlocks.FRUITING_OAK_LEAVES);
event.getEntries().putAfter(Items.FLOWERING_AZALEA_LEAVES.getDefaultInstance(), BlossomItems.FRUITING_OAK_LEAVES.get().getDefaultInstance(), CreativeModeTab.TabVisibility.PARENT_AND_SEARCH_TABS);
event.accept(BlossomBlocks.FLOWERING_OAK_LEAVES.get());
event.accept(BlossomBlocks.FLOWERING_OAK_LEAVES);
event.getEntries().putAfter(Items.FLOWERING_AZALEA_LEAVES.getDefaultInstance(), BlossomItems.FLOWERING_OAK_LEAVES.get().getDefaultInstance(), CreativeModeTab.TabVisibility.PARENT_AND_SEARCH_TABS);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@
import net.minecraft.world.level.pathfinder.Path;
import net.minecraft.world.phys.Vec3;

import java.util.*;
import java.util.Arrays;
import java.util.EnumSet;
import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Predicate;

Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
modLoader = "javafml"
loaderVersion = "53,)"
loaderVersion = "54,)"
license = "GNU Lesser General Public License v3.0"

[[mods]]
Expand All @@ -18,13 +18,13 @@ Apples blossom upon leaves by the pollen from bees!
[[dependencies.blossom]]
modId = "minecraft"
mandatory = true
versionRange = "[1.21.2,1.21.3]"
versionRange = "[1.21.4,)"
ordering = "NONE"
side = "BOTH"

[[dependencies.blossom]]
modId = "forge"
mandatory = true
versionRange = "[53,)"
versionRange = "[54,)"
ordering = "NONE"
side = "BOTH"
72 changes: 72 additions & 0 deletions src/main/resources/assets/blossom/items/flowering_oak_leaves.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"model": {
"type": "minecraft:select",
"block_state_property": "age",
"cases": [
{
"model": {
"type": "minecraft:model",
"model": "blossom:block/flowering_oak_leaves_stage0",
"tints": [
{
"type": "minecraft:constant",
"value": -12012264
}
]

},
"when": "0"
},
{
"model": {
"type": "minecraft:model",
"model": "blossom:block/flowering_oak_leaves_stage1a",
"tints": [
{
"type": "minecraft:constant",
"value": -12012264
}
]
},
"when": "1"
},
{
"model": {
"type": "minecraft:model",
"model": "blossom:block/flowering_oak_leaves_stage2b",
"tints": [
{
"type": "minecraft:constant",
"value": -12012264
}
]
},
"when": "2"
},
{
"model": {
"type": "minecraft:model",
"model": "blossom:block/flowering_oak_leaves_stage3",
"tints": [
{
"type": "minecraft:constant",
"value": -12012264
}
]
},
"when": "3"
}
],
"fallback": {
"type": "minecraft:model",
"model": "blossom:block/flowering_oak_leaves_stage0",
"tints": [
{
"type": "minecraft:constant",
"value": -12012264
}
]
},
"property": "minecraft:block_state"
}
}
123 changes: 123 additions & 0 deletions src/main/resources/assets/blossom/items/fruiting_oak_leaves.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
{
"model": {
"type": "minecraft:select",
"block_state_property": "age",
"cases": [
{
"model": {
"type": "minecraft:model",
"model": "blossom:block/fruiting_oak_leaves_stage0",
"tints": [
{
"type": "minecraft:constant",
"value": -12012264
}
]
},
"when": "0"
},
{
"model": {
"type": "minecraft:model",
"model": "blossom:block/fruiting_oak_leaves_stage1",
"tints": [
{
"type": "minecraft:constant",
"value": -12012264
}
]
},
"when": "1"
},
{
"model": {
"type": "minecraft:model",
"model": "blossom:block/fruiting_oak_leaves_stage2",
"tints": [
{
"type": "minecraft:constant",
"value": -12012264
}
]
},
"when": "2"
},
{
"model": {
"type": "minecraft:model",
"model": "blossom:block/fruiting_oak_leaves_stage3",
"tints": [
{
"type": "minecraft:constant",
"value": -12012264
}
]
},
"when": "3"
},
{
"model": {
"type": "minecraft:model",
"model": "blossom:block/fruiting_oak_leaves_stage4",
"tints": [
{
"type": "minecraft:constant",
"value": -12012264
}
]
},
"when": "4"
},
{
"model": {
"type": "minecraft:model",
"model": "blossom:block/fruiting_oak_leaves_stage5",
"tints": [
{
"type": "minecraft:constant",
"value": -12012264
}
]
},
"when": "5"
},
{
"model": {
"type": "minecraft:model",
"model": "blossom:block/fruiting_oak_leaves_stage6",
"tints": [
{
"type": "minecraft:constant",
"value": -12012264
}
]
},
"when": "6"
},
{
"model": {
"type": "minecraft:model",
"model": "blossom:block/fruiting_oak_leaves_stage7",
"tints": [
{
"type": "minecraft:constant",
"value": -12012264
}
]
},
"when": "7"
}
],
"fallback": {
"type": "minecraft:model",
"model": "blossom:block/fruiting_oak_leaves_stage0",
"tints": [
{
"type": "minecraft:constant",
"value": -12012264
}
]
},
"property": "minecraft:block_state"
}
}

This file was deleted.

Loading

0 comments on commit c045354

Please sign in to comment.