update to 1.21.4
This commit is contained in:
parent
a4ce4504c6
commit
57fa9c4263
|
@ -1,6 +1,6 @@
|
|||
plugins {
|
||||
id "com.modrinth.minotaur" version "2.+"
|
||||
id 'fabric-loom' version '1.7-SNAPSHOT'
|
||||
id 'fabric-loom' version '1.9-SNAPSHOT'
|
||||
id 'maven-publish'
|
||||
}
|
||||
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
org.gradle.jvmargs = -Xmx1G
|
||||
|
||||
#Fabric properties
|
||||
minecraft_version=1.21.1
|
||||
yarn_mappings=1.21.1+build.3
|
||||
loader_version=0.16.7
|
||||
minecraft_version=1.21.4
|
||||
yarn_mappings=1.21.4+build.7
|
||||
loader_version=0.16.9
|
||||
|
||||
# Fabric API
|
||||
fabric_version=0.105.0+1.21.1
|
||||
fabric_version=0.114.0+1.21.4
|
||||
|
||||
#Mod properties
|
||||
mod_version = 0.10.2
|
||||
mod_version = 0.10.3
|
||||
maven_group = quimufu.simple_creator
|
||||
archives_base_name = simple_creator
|
||||
|
||||
midnightlib_version=1.6.3-fabric
|
||||
midnightlib_version=1.6.6-fabric
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,6 +1,6 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
|
5
gradlew
vendored
5
gradlew
vendored
|
@ -15,6 +15,8 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
|
@ -84,7 +86,8 @@ done
|
|||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
|
||||
' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
|
2
gradlew.bat
vendored
2
gradlew.bat
vendored
|
@ -13,6 +13,8 @@
|
|||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
|
|
|
@ -5,7 +5,6 @@ import com.google.gson.Gson;
|
|||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonObject;
|
||||
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.fabricmc.fabric.api.registry.FlammableBlockRegistry;
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -17,6 +16,7 @@ import net.minecraft.entity.EntityType;
|
|||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.loot.LootTable;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.Registry;
|
||||
|
@ -28,8 +28,10 @@ import net.minecraft.util.Pair;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.BlockView;
|
||||
import org.apache.logging.log4j.Level;
|
||||
import quimufu.simple_creator.mixin.BlockSettingsAccessor;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import static quimufu.simple_creator.SimpleCreatorMod.log;
|
||||
|
||||
|
@ -70,9 +72,17 @@ public class BlockResourceLoader extends GenericManualResourceLoader<Pair<Block,
|
|||
// parse item group
|
||||
String group = bspj.itemGroup;
|
||||
RegistryKey<ItemGroup> g = ItemResourceLoader.findGroup(group);
|
||||
|
||||
bs.registryKey(RegistryKey.of(Registries.BLOCK.getKey(), e.getLeft()));
|
||||
|
||||
//create block and corresponding item
|
||||
Block resB = new Block(bs);
|
||||
Item resI = new BlockItem(resB, new Item.Settings());
|
||||
|
||||
Item.Settings is = new Item.Settings();
|
||||
is.useBlockPrefixedTranslationKey();
|
||||
is.registryKey(RegistryKey.of(Registries.ITEM.getKey(), e.getLeft()));
|
||||
Item resI = new BlockItem(resB, is);
|
||||
|
||||
ItemGroupEvents.modifyEntriesEvent(g).register(content -> content.add(resI));
|
||||
|
||||
int burnChance = bspj.burnChance;
|
||||
|
@ -86,15 +96,14 @@ public class BlockResourceLoader extends GenericManualResourceLoader<Pair<Block,
|
|||
}
|
||||
|
||||
private Block.Settings getSettings(BlockSettingsPojo bspj) {
|
||||
FabricBlockSettings fabricBlockSettings = FabricBlockSettings.create();
|
||||
AbstractBlock.Settings blockSettings = AbstractBlock.Settings.create();
|
||||
|
||||
fabricBlockSettings
|
||||
.collidable(bspj.collidable)
|
||||
blockSettings
|
||||
.slipperiness(bspj.slipperiness)
|
||||
.velocityMultiplier(bspj.movementVelocityMultiplier)
|
||||
.jumpVelocityMultiplier(bspj.jumpVelocityMultiplier)
|
||||
.sounds(getSoundGroup(bspj.soundGroup))
|
||||
.drops(getDropTableId(bspj.dropTableId))
|
||||
.lootTable(Optional.ofNullable(getDropTableId(bspj.dropTableId)))
|
||||
.mapColor(getMapColor(bspj.mapColor))
|
||||
.allowsSpawning(bspj.allowsSpawning ? BlockResourceLoader::always : BlockResourceLoader::never)
|
||||
.solidBlock(bspj.solidBlock ? BlockResourceLoader::always : BlockResourceLoader::never)
|
||||
|
@ -107,39 +116,43 @@ public class BlockResourceLoader extends GenericManualResourceLoader<Pair<Block,
|
|||
.offset(getOffset(bspj.modelOffset))
|
||||
.pistonBehavior(getPistonBehavior(bspj.pistonBehavior))
|
||||
.instrument(getInstrument(bspj.instrument))
|
||||
.luminance(bspj.lightLevel);
|
||||
.luminance((blockState) -> bspj.lightLevel);
|
||||
|
||||
((BlockSettingsAccessor) blockSettings)
|
||||
.setCollidable(bspj.collidable);
|
||||
|
||||
if (bspj.burnable) {
|
||||
fabricBlockSettings.burnable();
|
||||
blockSettings.burnable();
|
||||
}
|
||||
//not supported for now
|
||||
//fabricBlockSettings.liquid()
|
||||
//blockSettings.liquid()
|
||||
if (bspj.solidBlock) {
|
||||
fabricBlockSettings.solid();
|
||||
blockSettings.solid();
|
||||
} else {
|
||||
fabricBlockSettings.notSolid();
|
||||
blockSettings.notSolid();
|
||||
}
|
||||
if (bspj.replaceable) {
|
||||
fabricBlockSettings.replaceable();
|
||||
blockSettings.replaceable();
|
||||
}
|
||||
//not supported for now
|
||||
//fabricBlockSettings.air()
|
||||
//blockSettings.air()
|
||||
|
||||
if (bspj.noBlockBreakParticles) {
|
||||
fabricBlockSettings.noBlockBreakParticles();
|
||||
blockSettings.noBlockBreakParticles();
|
||||
}
|
||||
if (bspj.requiresTool) {
|
||||
fabricBlockSettings.requiresTool();
|
||||
blockSettings.requiresTool();
|
||||
|
||||
}
|
||||
if (bspj.breaksInstantly) {
|
||||
fabricBlockSettings.breakInstantly();
|
||||
blockSettings.breakInstantly();
|
||||
}
|
||||
|
||||
if (!bspj.opaque) {
|
||||
fabricBlockSettings.nonOpaque();
|
||||
blockSettings.nonOpaque();
|
||||
}
|
||||
|
||||
return fabricBlockSettings;
|
||||
return blockSettings;
|
||||
}
|
||||
|
||||
private NoteBlockInstrument getInstrument(String instrument) {
|
||||
|
|
|
@ -3,12 +3,16 @@ package quimufu.simple_creator;
|
|||
import com.google.common.collect.Maps;
|
||||
import com.google.gson.*;
|
||||
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
|
||||
import net.minecraft.component.type.ConsumableComponent;
|
||||
import net.minecraft.component.type.ConsumableComponents;
|
||||
import net.minecraft.component.type.FoodComponent;
|
||||
import net.minecraft.entity.effect.StatusEffect;
|
||||
import net.minecraft.entity.effect.StatusEffectInstance;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemGroups;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.consume.ApplyEffectsConsumeEffect;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.registry.RegistryKey;
|
||||
|
@ -58,7 +62,7 @@ public class ItemResourceLoader extends GenericManualResourceLoader<Item> {
|
|||
}
|
||||
settings.maxCount(stackSize);
|
||||
JsonObject jsonFoodObject = JsonHelper.getObject(jo, "food");
|
||||
settings.food(deserializeFoodComponent(jsonFoodObject));
|
||||
settings.food(deserializeFoodComponent(jsonFoodObject), deserializeEffectComponent(jsonFoodObject));
|
||||
} else if (durability != 0 && stackSize != 1) {
|
||||
log(Level.WARN, "durability and stackSize do not work together");
|
||||
log(Level.WARN, "ignoring stackSize");
|
||||
|
@ -71,6 +75,7 @@ public class ItemResourceLoader extends GenericManualResourceLoader<Item> {
|
|||
}
|
||||
}
|
||||
settings.rarity(findRarity(rarity));
|
||||
settings.registryKey(RegistryKey.of(Registries.ITEM.getKey(), e.getLeft()));
|
||||
|
||||
|
||||
Item item = new Item(settings);
|
||||
|
@ -79,6 +84,17 @@ public class ItemResourceLoader extends GenericManualResourceLoader<Item> {
|
|||
return item;
|
||||
}
|
||||
|
||||
private ConsumableComponent deserializeEffectComponent(JsonObject jo) {
|
||||
ConsumableComponent.Builder ccb = ConsumableComponents.food();
|
||||
if (JsonHelper.getBoolean(jo, "isFast", false))
|
||||
ccb.consumeSeconds(0.8f);
|
||||
if (JsonHelper.hasArray(jo, "effects")) {
|
||||
JsonArray jsonEffectsArray = JsonHelper.getArray(jo, "effects");
|
||||
deserializeEffects(ccb, jsonEffectsArray);
|
||||
}
|
||||
return ccb.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void save(Identifier id, Item item) {
|
||||
items.put(id, item);
|
||||
|
@ -91,17 +107,11 @@ public class ItemResourceLoader extends GenericManualResourceLoader<Item> {
|
|||
fcb.saturationModifier(JsonHelper.getFloat(jo, "saturationModifier", 0.3F));
|
||||
if (JsonHelper.getBoolean(jo, "isAlwaysEdible", false))
|
||||
fcb.alwaysEdible();
|
||||
if (JsonHelper.getBoolean(jo, "isFast", false))
|
||||
fcb.snack();
|
||||
if (JsonHelper.hasArray(jo, "effects")) {
|
||||
JsonArray jsonEffectsArray = JsonHelper.getArray(jo, "effects");
|
||||
deserializeEffects(fcb, jsonEffectsArray);
|
||||
}
|
||||
fc = fcb.build();
|
||||
return fc;
|
||||
}
|
||||
|
||||
private static void deserializeEffects(FoodComponent.Builder fcb, JsonArray ja) {
|
||||
private static void deserializeEffects(ConsumableComponent.Builder ccb, JsonArray ja) {
|
||||
for (JsonElement e : ja) {
|
||||
RegistryEntry<StatusEffect> type;
|
||||
int duration = 0;
|
||||
|
@ -129,7 +139,7 @@ public class ItemResourceLoader extends GenericManualResourceLoader<Item> {
|
|||
ambient = JsonHelper.getBoolean(jo, "ambient", ambient);
|
||||
visible = JsonHelper.getBoolean(jo, "visible", visible);
|
||||
chance = JsonHelper.getFloat(jo, "chance", chance);
|
||||
fcb.statusEffect(new StatusEffectInstance(type, duration, amplifier, ambient, visible), chance);
|
||||
ccb.consumeEffect(new ApplyEffectsConsumeEffect(new StatusEffectInstance(type, duration, amplifier, ambient, visible), chance));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@ public class SimpleCreatorModClient implements ClientModInitializer {
|
|||
case "GLINT_TRANSLUCENT" -> RenderLayer.getGlintTranslucent();
|
||||
case "GLINT" -> RenderLayer.getGlint();
|
||||
case "ENTITY_GLINT" -> RenderLayer.getEntityGlint();
|
||||
case "DIRECT_ENTITY_GLINT" -> RenderLayer.getDirectEntityGlint();
|
||||
case "TEXT_BACKGROUND" -> RenderLayer.getTextBackground();
|
||||
case "TEXT_BACKGROUND_SEE_THROUGH" -> RenderLayer.getTextBackgroundSeeThrough();
|
||||
case "LIGHTNING" -> RenderLayer.getLightning();
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
package quimufu.simple_creator.mixin;
|
||||
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
@Mixin(AbstractBlock.Settings.class)
|
||||
public interface BlockSettingsAccessor {
|
||||
@Accessor
|
||||
void setCollidable(boolean collidable);
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"model": {
|
||||
"type": "minecraft:model",
|
||||
"model": "simple_creator:item/test_block"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"model": {
|
||||
"type": "minecraft:model",
|
||||
"model": "simple_creator:item/test_item"
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"simple_creator.midnightconfig.title": "Simple Item/Block Creator Settings",
|
||||
"simple_creator.midnightconfig.explanation": "Simple Item/Block Creator Settings",
|
||||
"simple_creator.midnightconfig.enableTestThings": "Enable a test item and block",
|
||||
"item.simple_creator.test_item": "Forbidden Fruit",
|
||||
"block.simple_creator.test_block": "Fast jumpy wooly diamond-dropping block of Eternal Fire"
|
||||
|
|
|
@ -23,7 +23,9 @@
|
|||
"quimufu.simple_creator.SimpleCreatorConfig"
|
||||
]
|
||||
},
|
||||
"mixins": [],
|
||||
"mixins": [
|
||||
"simple_creator.mixins.json"
|
||||
],
|
||||
"depends": {
|
||||
"fabricloader": ">=0.14.21",
|
||||
"fabric": "*"
|
||||
|
|
14
src/main/resources/simple_creator.mixins.json
Normal file
14
src/main/resources/simple_creator.mixins.json
Normal file
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"required": true,
|
||||
"minVersion": "0.8",
|
||||
"package": "quimufu.simple_creator.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [
|
||||
"BlockSettingsAccessor"
|
||||
],
|
||||
"client": [],
|
||||
"server": [],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user