Skip to content

Commit

Permalink
Update to Minecraft 1.21.4
Browse files Browse the repository at this point in the history
  • Loading branch information
UnRealDinnerbone committed Dec 10, 2024
1 parent cf0ea73 commit 93d2452
Show file tree
Hide file tree
Showing 24 changed files with 75 additions and 60 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@ run
neo2/runs/

neo/runs/

fabric/runs/

common/src/generated/resources/.cache/
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
### 21.0.1
### 21.4.0

- Update to 1.21
- Update to 1.21.4
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
plugins {
id("dev.nanite.mlp") version("0.3.0")
id("dev.nanite.mlp") version("0.4.1")
id("java-library")
id("maven-publish")
id("me.modmuss50.mod-publish-plugin") version "0.3.0"
id("me.modmuss50.mod-publish-plugin") version "0.8.1"
id 'org.jetbrains.gradle.plugin.idea-ext' version '1.0'
}

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "jags:item/grass_seed"
}
}
2 changes: 1 addition & 1 deletion common/src/generated/resources/pack.mcmeta
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"pack": {
"description": "jags",
"pack_format": 48
"pack_format": 61
}
}
11 changes: 7 additions & 4 deletions common/src/main/java/com/unrealdinnerbone/jags/JAGSRegistry.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.unrealdinnerbone.jags;

import com.unrealdinnerbone.jags.item.GrassSeed;
import com.unrealdinnerbone.trenzalore.api.platform.services.ICreativeTabRegister;
import com.unrealdinnerbone.trenzalore.api.platform.services.IRegistry;
import com.unrealdinnerbone.trenzalore.api.registry.ItemRegistryObjects;
import com.unrealdinnerbone.trenzalore.api.registry.Regeneration;
import com.unrealdinnerbone.trenzalore.api.registry.RegistryEntry;
import com.unrealdinnerbone.trenzalore.api.registry.RegistryObjects;
Expand All @@ -11,16 +13,17 @@

import java.util.Arrays;
import java.util.List;
import java.util.function.UnaryOperator;

public class JAGSRegistry implements IRegistry {

private static final RegistryObjects<Item> ITEMS = Regeneration.create(Registries.ITEM);
private static final ItemRegistryObjects ITEMS = Regeneration.createItemRegistry(JAGS.MOD_ID);

public static final RegistryEntry<GrassSeed> GRASS_SEED = ITEMS.register("grass_seed", GrassSeed::new);
public static final RegistryEntry<GrassSeed> GRASS_SEED = ITEMS.register("grass_seed", GrassSeed::new, UnaryOperator.identity());

@Override
public void afterRegistered() {
Regeneration.addItemsToCreateTab(CreativeTabs.TOOLS_AND_UTILITIES, List.of(GRASS_SEED));
public void afterRegistered(ICreativeTabRegister register) {
register.addItemToCreativeTab(CreativeTabs.TOOLS_AND_UTILITIES, List.of(GRASS_SEED));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.unrealdinnerbone.jags.item;

import com.unrealdinnerbone.jags.JAGSRegistry;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.InteractionResult;
Expand All @@ -11,8 +10,8 @@

public class GrassSeed extends Item {

public GrassSeed() {
super(new Properties());
public GrassSeed(Item.Properties properties) {
super(properties);
}

@Override
Expand All @@ -24,11 +23,7 @@ public InteractionResult useOn(UseOnContext context) {
if (!context.getPlayer().getAbilities().instabuild) {
context.getItemInHand().shrink(1);
}
// if(context.getPlayer() instanceof ServerPlayer serverPlayer) {
// JAGSRegistry.INSTANCE.trigger(serverPlayer);
// }

return InteractionResult.sidedSuccess(context.getLevel().isClientSide());
return InteractionResult.CONSUME;
}else {
return super.useOn(context);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package com.unrealdinnerbone.jags.data;
package com.unrealdinnerbone.jags.client;

import com.unrealdinnerbone.jags.JAGS;
import com.unrealdinnerbone.jags.data.LangProvider;
import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint;
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
import net.minecraft.core.RegistrySetBuilder;
import net.minecraft.data.metadata.PackMetadataGenerator;
import net.minecraft.network.chat.Component;
import org.jetbrains.annotations.Nullable;

public class JAGSFabricData implements DataGeneratorEntrypoint {
@Override
Expand All @@ -16,14 +15,4 @@ public void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) {
pack.addProvider(LangProvider::new);
pack.addProvider((output, registriesFuture) -> PackMetadataGenerator.forFeaturePack(output, Component.literal(JAGS.MOD_ID)));
}

@Override
public @Nullable String getEffectiveModId() {
return DataGeneratorEntrypoint.super.getEffectiveModId();
}

@Override
public void buildRegistry(RegistrySetBuilder registryBuilder) {
DataGeneratorEntrypoint.super.buildRegistry(registryBuilder);
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.unrealdinnerbone.jags.data;
package com.unrealdinnerbone.jags.client;

import com.unrealdinnerbone.jags.JAGSRegistry;
import net.fabricmc.fabric.api.client.datagen.v1.provider.FabricModelProvider;
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricModelProvider;
import net.minecraft.data.models.BlockModelGenerators;
import net.minecraft.data.models.ItemModelGenerators;
import net.minecraft.data.models.model.ModelTemplates;
import net.minecraft.client.data.models.BlockModelGenerators;
import net.minecraft.client.data.models.ItemModelGenerators;
import net.minecraft.client.data.models.model.ModelTemplates;

public class JAGSModelProvider extends FabricModelProvider {

Expand All @@ -15,10 +15,13 @@ public JAGSModelProvider(FabricDataOutput output) {

@Override
public void generateBlockStateModels(BlockModelGenerators blockStateModelGenerator) {

}

@Override
public void generateItemModels(ItemModelGenerators itemModelGenerator) {
itemModelGenerator.generateFlatItem(JAGSRegistry.GRASS_SEED.get(), ModelTemplates.FLAT_ITEM);

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
public class LangProvider extends FabricLanguageProvider {


protected LangProvider(FabricDataOutput dataOutput, CompletableFuture<HolderLookup.Provider> registryLookup) {
public LangProvider(FabricDataOutput dataOutput, CompletableFuture<HolderLookup.Provider> registryLookup) {
super(dataOutput, registryLookup);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.unrealdinnerbone.jags.JAGSRegistry;
import com.unrealdinnerbone.trenzalore.lib.RLUtils;
import net.fabricmc.fabric.api.loot.v2.LootTableEvents;
import net.fabricmc.fabric.api.loot.v3.LootTableEvents;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.storage.loot.LootPool;
import net.minecraft.world.level.storage.loot.entries.LootItem;
Expand All @@ -13,10 +13,11 @@
public class LootEvents {

private static final List<ResourceLocation> GRASS_BLOCKS = List.of(
RLUtils.rl("minecraft", "blocks/grass"),
RLUtils.rl("minecraft", "blocks/short_grass"),
RLUtils.rl("minecraft", "blocks/tall_grass"));

public static void init() {
LootTableEvents.MODIFY.register((key, tableBuilder, source) -> {
LootTableEvents.MODIFY.register((key, tableBuilder, source, registries) -> {
if(GRASS_BLOCKS.contains(key.location())) {
LootPool poolBuilder = LootPool.lootPool()
.when(LootItemRandomChanceCondition.randomChance(0.1f))
Expand Down
2 changes: 1 addition & 1 deletion fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"com.unrealdinnerbone.jags.JAGSFabric"
],
"fabric-datagen": [
"com.unrealdinnerbone.jags.data.JAGSFabricData"
"com.unrealdinnerbone.jags.client.JAGSFabricData"
]
},
"depends": {
Expand Down
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Project
mod_version=21.1.0
mod_version=21.4.0
maven_group=com.unrealdinnerbone
curse_id=517003
mod_name=JAGS
Expand All @@ -8,18 +8,18 @@ mod_id=jags


# Common
minecraft_version=1.21.1
minecraft_version=1.21.4

# Forge
#forge_version=49.0.13

neo_version=21.1.50
neo_version=21.4.12-beta

fabric_version=0.104.0+1.21.1
fabric_loader_version=0.16.5
fabric_version=0.111.0+1.21.4
fabric_loader_version=0.16.9

# Other
trenzalore_version=6.1.1
trenzalore_version=21.4.2

# Gradle
org.gradle.jvmargs=-Xmx3G
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
5 changes: 4 additions & 1 deletion neo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ multiLoader.neo() {

publishing.publications.mavenJava.from components.java

sourceSets.main.resources { srcDir project(":common").file('src/generated/resources') }
sourceSets.main.resources {
srcDir project(":common").file('src/generated/resources')
srcDir project(":neo").file('src/generated/resources')
}

dependencies {
implementation("com.unrealdinnerbone:trenzalore-neo:${project.property("trenzalore_version")}+mc${project.property("minecraft_version")}")
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
{
"condition": "neoforge:loot_table_id",
"loot_table_id": "minecraft:blocks/grass"
"loot_table_id": "minecraft:blocks/short_grass"
}
],
"table": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"type": "trenzalore:add",
"conditions": [
{
"chance": 0.1,
"condition": "minecraft:random_chance"
},
{
"condition": "neoforge:loot_table_id",
"loot_table_id": "minecraft:blocks/tall_grass"
}
],
"table": {
"count": 1,
"id": "jags:grass_seed"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"entries": [
"jags:tall_grass",
"jags:grass_seed"
],
"replace": false
Expand Down
2 changes: 1 addition & 1 deletion neo/src/main/java/com/unrealdinnerbone/jags/JAGSNeo.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public JAGSNeo(IEventBus eventBus) {
eventBus.addListener(JAGSNeo::onData);
}

private static void onData(GatherDataEvent event) {
private static void onData(GatherDataEvent.Server event) {
event.getGenerator().addProvider(true, new LootModifierGenerator(event.getGenerator().getPackOutput(), event.getLookupProvider()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ public LootModifierGenerator(PackOutput packOutput, CompletableFuture<HolderLook
@Override
protected void start() {
add("grass_seed", new AddItemModifier(
createChanceCondition(0.1f, RLUtils.rl("minecraft", "blocks/grass")), new ItemStack(JAGSRegistry.GRASS_SEED.get())));
createChanceCondition(0.1f, RLUtils.rl("minecraft", "blocks/short_grass")), new ItemStack(JAGSRegistry.GRASS_SEED.get())));
add("tall_grass", new AddItemModifier(
createChanceCondition(0.1f, RLUtils.rl("minecraft", "blocks/tall_grass")), new ItemStack(JAGSRegistry.GRASS_SEED.get())));
}

public static LootItemCondition[] createChanceCondition(float chance, ResourceLocation table) {
Expand Down

0 comments on commit 93d2452

Please sign in to comment.