Skip to content

Commit

Permalink
NeoForge 1.21.4
Browse files Browse the repository at this point in the history
  • Loading branch information
yurisuika committed Dec 11, 2024
1 parent efb69d0 commit e9c3317
Show file tree
Hide file tree
Showing 7 changed files with 199 additions and 113 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 = neoforge

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

neo_version = 21.3.57
neo_version = 21.4.6-beta
27 changes: 0 additions & 27 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.neoforged.api.distmarker.Dist;
Expand All @@ -40,8 +33,6 @@
import net.neoforged.neoforge.event.RegisterCommandsEvent;
import net.neoforged.neoforge.event.entity.EntityJoinLevelEvent;

import java.util.Objects;

@Mod("blossom")
public class Blossom {

Expand Down Expand Up @@ -93,30 +84,12 @@ 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) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/META-INF/neoforge.mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ config = "blossom.mixins.json"
[[dependencies.blossom]]
modId = "minecraft"
type = "required"
versionRange = "[1.21.2,1.21.3]"
versionRange = "[1.21.4,)"
ordering = "NONE"
side = "BOTH"

[[dependencies.blossom]]
modId = "neoforge"
type = "required"
versionRange = "[21.2,)"
versionRange = "[21.4,)"
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.

This file was deleted.

0 comments on commit e9c3317

Please sign in to comment.