Skip to content

Commit

Permalink
updated license year; etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
squid233 committed Jan 31, 2023
1 parent 0249ad5 commit 668c727
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 32 deletions.
3 changes: 2 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ indent_size = 4
indent_style = space
trim_trailing_whitespace = true
end_of_line = lf
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

[{*.yml, *.json}]
indent_size = 2
indent_size = 2
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 XenFork Union
Copyright (c) 2022-2023 XenFork Union

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
18 changes: 11 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
plugins {
id 'fabric-loom' version '1.0-SNAPSHOT'
id 'fabric-loom' version '1.1-SNAPSHOT'
id 'maven-publish'
}

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17

archivesBaseName = project.archives_base_name
version = project.mod_version
group = project.maven_group

Expand Down Expand Up @@ -36,12 +32,20 @@ processResources {
}
}

def targetJavaVersion = 17
tasks.withType(JavaCompile).configureEach {
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
it.options.release = 17
options.encoding = 'UTF-8'
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
options.release.set(targetJavaVersion)
}
}

java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion.set(JavaLanguageVersion.of(targetJavaVersion))
}
archivesBaseName = project.archives_base_name
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ org.gradle.jvmargs=-Xmx1G
# check these on https://fabricmc.net/develop
minecraft_version=1.18.2
yarn_mappings=1.18.2+build.4
loader_version=0.14.10
loader_version=0.14.13

# Mod Properties
mod_version = 0.13.0
maven_group = union.xenfork
maven_group = io.github.xenfork
archives_base_name = squidcraft

# Dependencies
fabric_version=0.66.0+1.18.2
fabric_version=0.67.0+1.18.2
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-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pluginManagement {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
maven { url 'https://maven.aliyun.com/repository/central' }
mavenCentral()
gradlePluginPortal()
}
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/union/xenfork/squidcraft/SquidCraft.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* MIT License
*
* Copyright (c) 2022 XenFork Union
* Copyright (c) 2022-2023 XenFork Union
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -40,6 +40,7 @@
import net.minecraft.predicate.entity.EntityPredicate;
import net.minecraft.util.Identifier;
import union.xenfork.squidcraft.block.ModBlocks;
import union.xenfork.squidcraft.item.ModItemGroups;
import union.xenfork.squidcraft.item.ModItems;

/**
Expand All @@ -54,6 +55,7 @@ public final class SquidCraft implements ModInitializer {
public void onInitialize() {
ModBlocks.registerAll();
ModItems.registerAll();
ModItemGroups.registerAll();

// Add items to squid
LootTableEvents.MODIFY.register((resourceManager, lootManager, id, tableBuilder, source) -> {
Expand Down
37 changes: 32 additions & 5 deletions src/main/java/union/xenfork/squidcraft/item/ModItemGroups.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* MIT License
*
* Copyright (c) 2022 XenFork Union
* Copyright (c) 2022-2023 XenFork Union
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -25,18 +25,45 @@
package union.xenfork.squidcraft.item;

import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
import net.minecraft.item.ItemConvertible;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.Identifier;
import union.xenfork.squidcraft.SquidCraft;

import java.util.List;

import static union.xenfork.squidcraft.item.ModItems.*;

/**
* @author squid233
* @since 0.13.0
*/
public final class ModItemGroups {
public static final ItemGroup MAIN = FabricItemGroupBuilder.build(
new Identifier(SquidCraft.NAMESPACE, "main"),
() -> new ItemStack(ModItems.COOKED_SQUID_SLICE)
);
public static final ItemGroup MAIN = FabricItemGroupBuilder.create(new Identifier(SquidCraft.NAMESPACE, "main"))
.icon(() -> new ItemStack(ModItems.COOKED_SQUID_SLICE))
.appendItems(stacks -> addItems(stacks,
Items.SQUID_SPAWN_EGG,
SQUID_SHRED,
SQUID_STRIP,
SQUID_SLICE,
COOKED_SQUID_SHRED,
COOKED_SQUID_STRIP,
COOKED_SQUID_SLICE,
SQUID_CAKE,
SQUID_BLOCK,
DICED_CARROT,
KNIFE
))
.build();

public static void registerAll() {
}

private static void addItems(List<ItemStack> stacks, ItemConvertible... items) {
for (ItemConvertible item : items) {
stacks.add(new ItemStack(item));
}
}
}
26 changes: 13 additions & 13 deletions src/main/java/union/xenfork/squidcraft/item/ModItems.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* MIT License
*
* Copyright (c) 2022 XenFork Union
* Copyright (c) 2022-2023 XenFork Union
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -37,16 +37,16 @@
*/
public final class ModItems {
public static final Item
SQUID_SHRED = register("squid_shred", mainGroup().food(meat(1, 0.3f, true))),
SQUID_STRIP = register("squid_strip", mainGroup().food(meat(1, 0.3f, true))),
SQUID_SLICE = register("squid_slice", mainGroup().food(meat(2, 0.3f))),
COOKED_SQUID_SHRED = register("cooked_squid_shred", mainGroup().food(meat(2, 0.6f, true))),
COOKED_SQUID_STRIP = register("cooked_squid_strip", mainGroup().food(meat(2, 0.6f, true))),
COOKED_SQUID_SLICE = register("cooked_squid_slice", mainGroup().food(meat(3, 0.6f))),
SQUID_CAKE = register("squid_cake", mainGroup().food(meat(8, 0.8f))),
SQUID_BLOCK = register("squid_block", ModBlocks.SQUID_BLOCK, mainGroup().food(meat(10, 1.0f))),
DICED_CARROT = register("diced_carrot", mainGroup().food(food(1, 0.2f, true))),
KNIFE = register("knife", new KnifeItem(ToolMaterials.IRON, 0, 0.0f, mainGroup().maxCount(1)));
SQUID_SHRED = register("squid_shred", settings().food(meat(1, 0.3f, true))),
SQUID_STRIP = register("squid_strip", settings().food(meat(1, 0.3f, true))),
SQUID_SLICE = register("squid_slice", settings().food(meat(2, 0.3f))),
COOKED_SQUID_SHRED = register("cooked_squid_shred", settings().food(meat(2, 0.6f, true))),
COOKED_SQUID_STRIP = register("cooked_squid_strip", settings().food(meat(2, 0.6f, true))),
COOKED_SQUID_SLICE = register("cooked_squid_slice", settings().food(meat(3, 0.6f))),
SQUID_CAKE = register("squid_cake", settings().food(meat(8, 0.8f))),
SQUID_BLOCK = register("squid_block", ModBlocks.SQUID_BLOCK, settings().food(meat(10, 1.0f))),
DICED_CARROT = register("diced_carrot", settings().food(food(1, 0.2f, true))),
KNIFE = register("knife", new KnifeItem(ToolMaterials.IRON, 0, 0.0f, settings()));

public static void registerAll() {
}
Expand All @@ -63,8 +63,8 @@ private static Item register(String name, Block block, Item.Settings settings) {
return register(name, new BlockItem(block, settings));
}

private static Item.Settings mainGroup() {
return new Item.Settings().group(ModItemGroups.MAIN);
private static Item.Settings settings() {
return new Item.Settings();
}

private static FoodComponent.Builder foodBuilder(int hunger, float saturationMod) {
Expand Down

0 comments on commit 668c727

Please sign in to comment.