头像

GRID




离线:10小时前


最近来访(845)
用户头像
icebreaker
用户头像
时间大道
用户头像
秘封の月列
用户头像
HfjNUlYZ
用户头像
いちじょうはるひこ
用户头像
宇宙有边
用户头像
smr666
用户头像
FrankBlue
用户头像
tsjjst
用户头像
wtcl
用户头像
n8sPxD
用户头像
恶魔崇大人
用户头像
胡尔摩斯
用户头像
朴小明
用户头像
乐乐米德
用户头像
whelve
用户头像
tuffynibbles
用户头像
root.
用户头像
克里斯保罗
用户头像
北海没有WA

活动打卡代码 AcWing 1353. 滑雪场设计

GRID
1天前
#include<bits/stdc++.h>
using namespace std;
int n,mon[1010],ans;
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>mon[i];
    }
    int ans=INT_MAX;

    for(int i=17; i<=100; i++)
    {
        int temp=0;
        for(int j=0; j<n; j++)
        {
            if(mon[j]>i)
            {
                temp+=(mon[j]-i)*(mon[j]-i);
            }else if(mon[j]<i-17)
            {
                temp+=(i-17-mon[j])*(i-17-mon[j]);
            }
        }
        ans=min(ans,temp);
    }
    cout<<ans;
    return 0;
}


活动打卡代码 AcWing 1902. 马拉松

GRID
1天前
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5+10;
int a[N],b[N],d[N],n,the=-10000,ans;
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>a[i]>>b[i];
        if(i){
            d[i-1]=abs(b[i]-b[i-1])+abs(a[i]-a[i-1]);
            ans+=d[i-1];
        }
    }
    for(int i=1;i<n-1;i++)
    {
        int d1=abs(b[i+1]-b[i-1])+abs(a[i+1]-a[i-1]);
        int d2=d[i-1]+d[i];
        if(the<d2-d1) the=d2-d1;
    }

    cout<<ans-the;

    return 0;
}


活动打卡代码 AcWing 1912. 里程表

GRID
2天前
#include<bits/stdc++.h>
using namespace std;
long long l,r;
int co;
int main()
{
    cin>>l>>r;
    for(int len=3;len<=17;len++)
    {
        for(int k=0;k<10;k++)
        {
            string temp(len,k+'0');
            for(int j=0;j<10;j++)
            {
                if(k==j) continue;
                for(int idx=0;idx<len;idx++)
                {
                    temp[idx]=j+'0';
                    long long t=0;
                    for(int i=0;i<len;i++) t=10*t+(temp[i]-'0');
                    if(temp[0]!='0' && t>=l && t<=r){
                        co++;
                    }
                    temp[idx]='0'+k;
                }
            }
        }
    }
    cout<<co;

    return 0;
}


活动打卡代码 AcWing 2032. 过度种植

GRID
3天前
#include<bits/stdc++.h>
using namespace std;
struct node{
  int x_1,y_1,x_2,y_2;  

};
int n,a,b,c,d;
long long ans;
vector<node> v;
long long cal(int l,int r)
{
    vector<pair<int,int> > h;
    for(auto x:v)
    {
        if(x.x_1<=l && x.x_2>=r)
        {
            h.push_back({x.y_1,x.y_2});
        }
    }

    sort(h.begin(),h.end());

    int tot=0,st=-9999999,ed=-9999999;
    for(int i=0;i<h.size();i++)
    {
        if(ed<h[i].first)
        {
            tot+=ed-st;
            st=h[i].first;
        }
        ed=max(ed,h[i].second);
    }
    tot+=ed-st;

    return tot*(r-l);
}
int main()
{

    vector<int> t;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>a>>b>>c>>d;
        if(c<a) swap(a,c);
        if(d<b) swap(b,d);
        v.push_back({a,b,c,d});
        t.push_back(a);
        t.push_back(c);
    }

    sort(t.begin(),t.end());

    for(int i=1;i<t.size();i++)
    {
        if(t[i-1]!=t[i])
            ans+=cal(t[i-1],t[i]);
    }

    cout<<ans;

    return 0;
}



GRID
4天前

我们本次尝试在主世界生成模组中自定义的矿石

1.由于1.19的版本出现了深板岩层的矿石,我们要在BlockInit类中声明一个矿石的两种岩层形态:

BlockInit.java

package com.joy187.re8joymod.init;

import com.joy187.re8joymod.Main;
import net.minecraft.core.BlockPos;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.DyeColor;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.StainedGlassBlock;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.level.material.MaterialColor;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;

import java.util.function.Function;
import java.util.function.Supplier;

public class BlockInit {
    public static DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, Main.MOD_ID);
    public static final DeferredRegister<Item> ITEMS = ItemInit.ITEMS;

    //普通矿石,UniformInt.of(a,b)意思是该矿石挖掘后奖励多少经验,范围在[a,b]
    public static final RegistryObject<Block> FANTOM_ORE = registerBlock("fantom_ore",
            () -> new DropExperienceBlock(BlockBehaviour.Properties.of(Material.STONE)
                    .strength(5f).requiresCorrectToolForDrops(), UniformInt.of(3, 10)), Main.TUTORIAL_TAB);

    //深板岩矿石
    public static final RegistryObject<Block> DEEPSLATE_FANTOM_ORE = registerBlock("deepslate_fantom_ore",
            () -> new Block(BlockBehaviour.Properties.of(Material.STONE)
                    .strength(7f).requiresCorrectToolForDrops()), Main.TUTORIAL_TAB);


    private static <T extends Block> RegistryObject<T> registerBlock(final String name,
                                                                     final Supplier<? extends T> block) {
        return BLOCKS.register(name, block);
    }

    private static <T extends Block> RegistryObject<T> register(final String name, final Supplier<? extends T> block,
                                                                Function<RegistryObject<T>, Supplier<? extends Item>> item) {
        RegistryObject<T> obj = registerBlock(name, block);
        ITEMS.register(name, item.apply(obj));
        return obj;
    }

    private static <T extends Block> RegistryObject<T> registerBlock(String name, Supplier<T> block, CreativeModeTab tab) {
        RegistryObject<T> toReturn = BLOCKS.register(name, block);
        registerBlockItem(name, toReturn, tab);
        return toReturn;
    }

    private static <T extends Block> RegistryObject<Item> registerBlockItem(String name, RegistryObject<T> block,
                                                                            CreativeModeTab tab) {
        return ItemInit.ITEMS.register(name, () -> new BlockItem(block.get(),
                new Item.Properties().tab(tab)));
    }

    private static <T extends Block> RegistryObject<T> registerBlockWithoutBlockItem(String name, Supplier<T> block) {
        return BLOCKS.register(name, block);
    }

    public static Supplier<Block> createStainedGlassFromColor(DyeColor color) {
        return () -> new StainedGlassBlock(color, BlockBehaviour.Properties.of(Material.GLASS, color).strength(0.3F)
                .sound(SoundType.GLASS).noOcclusion().isValidSpawn(BlockInit::never).isRedstoneConductor(BlockInit::never).isSuffocating(BlockInit::never).isViewBlocking(BlockInit::never));
    }

    public static boolean always(BlockState state, BlockGetter reader, BlockPos pos) {
        return true;
    }

    public static boolean never(BlockState state, BlockGetter reader, BlockPos pos) {
        return false;
    }

    public static boolean always(BlockState state, BlockGetter reader, BlockPos pos, EntityType<?> entityType) {
        return true;
    }

    public static boolean never(BlockState state, BlockGetter reader, BlockPos pos, EntityType<?> entityType) {
        return false;
    }
}

之后参考Minecraft 1.19.2 Forge模组开发 02.物品栏+方块+物品将两个方块制作出来。

2.准备好了方块,下一步就是定义其生成的内容了。在Java包中新建一个world包->world包中新建一个feature包->feature包中分别新建三个类ModConfiguredFeaturesModOrePlacementModPlacedFeatures

crr.jpg

首先是我们的矿石摆放类:

ModOrePlacement.java

package com.joy187.re8joymod.world.feature;

import net.minecraft.world.level.levelgen.placement.*;

import java.util.List;

public class ModOrePlacement {
    //默认矿石摆放
    public static List<PlacementModifier> orePlacement(PlacementModifier p_195347_, PlacementModifier p_195348_) {
        return List.of(p_195347_, InSquarePlacement.spread(), p_195348_, BiomeFilter.biome());
    }

    //普通矿石摆放
    public static List<PlacementModifier> commonOrePlacement(int p_195344_, PlacementModifier p_195345_) {
        return orePlacement(CountPlacement.of(p_195344_), p_195345_);
    }

    //稀有矿石摆放
    public static List<PlacementModifier> rareOrePlacement(int p_195350_, PlacementModifier p_195351_) {
        return orePlacement(RarityFilter.onAverageOnceEvery(p_195350_), p_195351_);
    }

}

其次是我们的矿石生成定义类ModPlacedFeatures

ModPlacedFeatures.java

package com.joy187.re8joymod.world.feature;

import com.joy187.re8joymod.Main;
import net.minecraft.core.Registry;
import net.minecraft.world.level.levelgen.VerticalAnchor;
import net.minecraft.world.level.levelgen.placement.*;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.RegistryObject;

import static com.joy187.re8joymod.world.feature.ModOrePlacement.commonOrePlacement;

public class ModPlacedFeatures {
    public static final DeferredRegister<PlacedFeature> PLACED_FEATURES =
            DeferredRegister.create(Registry.PLACED_FEATURE_REGISTRY, Main.MOD_ID);

    //矿石摆放
    public static final RegistryObject<PlacedFeature> FANTOM_ORE_PLACED = PLACED_FEATURES.register("fantom_ore_placed",
            () -> new PlacedFeature(ModConfiguredFeatures.FANTOM_ORES.getHolder().get(),
                    commonOrePlacement(7, //每个区块生成多少矿石
                            HeightRangePlacement.triangle(VerticalAnchor.aboveBottom(-60), VerticalAnchor.aboveBottom(60))))); //-60,60分别指矿石生成高度范围介于[-60,60]



    public static void register(IEventBus eventBus) {
        PLACED_FEATURES.register(eventBus);
    }

}

最后是矿石生成配置类ModConfiguredFeatures

ModConfiguredFeatures.java

package com.joy187.re8joymod.world.feature;

import com.google.common.base.Suppliers;
import com.joy187.re8joymod.Main;
import com.joy187.re8joymod.init.BlockInit;
import net.minecraft.core.Registry;
import net.minecraft.data.worldgen.features.OreFeatures;
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.configurations.*;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.RegistryObject;

import java.util.List;
import java.util.function.Supplier;


public class ModConfiguredFeatures {

    public static final DeferredRegister<ConfiguredFeature<?, ?>> CONFIGURED_FEATURES =
            DeferredRegister.create(Registry.CONFIGURED_FEATURE_REGISTRY, Main.MOD_ID);

    //将我们第一步的两种矿石分别填入其中
    public static final Supplier<List<OreConfiguration.TargetBlockState>> OVERWORLD_FANTOM_ORES = Suppliers.memoize(() -> List.of(
            OreConfiguration.target(OreFeatures.STONE_ORE_REPLACEABLES, BlockInit.FANTOM_ORE.get().defaultBlockState()), //普通岩层
            OreConfiguration.target(OreFeatures.DEEPSLATE_ORE_REPLACEABLES, BlockInit.DEEPSLATE_FANTOM_ORE.get().defaultBlockState()))); //深板岩层

    //将这种矿石生成类型进行注册
    public static final RegistryObject<ConfiguredFeature<?, ?>> FANTOM_ORES = CONFIGURED_FEATURES.register("fantom_ore",
            () -> new ConfiguredFeature<>(Feature.ORE, new OreConfiguration(OVERWORLD_FANTOM_ORES.get(),7)));

    public static void register(IEventBus eventBus) {
        CONFIGURED_FEATURES.register(eventBus);
    }

}

3.在项目主类中添加我们矿石生成配置类和矿石生成定义类的注册事件:

    public Main()
    {
        IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus();
        bus.addListener(this::commonSetup);
        bus.addListener(this::setup);
        bus.addListener(this::clientSetup);
        ItemInit.ITEMS.register(bus);
        BlockInit.BLOCKS.register(bus);
        EntityInit.ENTITY_TYPES.register(bus);

        //添加这两个
        ModConfiguredFeatures.register(bus);
        ModPlacedFeatures.register(bus);

        MinecraftForge.EVENT_BUS.register(this);
    }

4.代码部分结束,之后需要在数据包中添加矿石生成的内容

crt.jpg

在数据包中新建forge包,forge包中新建biome_modifier包-> biome_modifier包中新建矿石生成文件add_fantom_ore,在features中填入我们在ModPlacedFeatures类中定义的名称:

add_fantom_ore.json

{
  "type": "forge:add_features",
  "biomes": "#minecraft:is_overworld",
  "features": "re8joymod:fantom_ore_placed",
  "step": "underground_ores"
}

5.保存所有设置,进入游戏:

我们新建一个存档,之后查看是否能找到模组中的矿石:

ore.png

成功在深板岩层发现了矿石!




GRID
5天前

我们本次实现一个具有动画效果的物品,本次演示的模型代码均在文末给出

tribody.gif
$$效果演示$$

首先,请确保你的开发包中引入了geckolib依赖,相关教程请参考:Minecraft 1.19.2 Forge模组开发 03.动画生物实体

1.首先我们要使用geckolib制作一个物品和对应的动画:

在blockbench中新建一个

cr0.jpg

之后我们找到Geckolib Model Settings并点击将模型转换为Block/Item

cr1.jpg

之后导出物品模型文件,动画文件,展示文件:

cr2.jpg

将这些文件分别放入到resources包中的如下位置:

cr3.jpg

2.在items包中新建一个我们的物品类ItemTribody:

ItemTribody.java

package com.joy187.re8joymod.items;

import com.joy187.re8joymod.Main;
import com.joy187.re8joymod.items.render.RenderTribody;
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
import net.minecraft.world.item.Item;
import net.minecraftforge.client.extensions.common.IClientItemExtensions;
import software.bernie.example.GeckoLibMod;
import software.bernie.example.client.renderer.item.PistolRender;
import software.bernie.geckolib3.core.AnimationState;
import software.bernie.geckolib3.core.IAnimatable;
import software.bernie.geckolib3.core.PlayState;
import software.bernie.geckolib3.core.builder.AnimationBuilder;
import software.bernie.geckolib3.core.builder.ILoopType;
import software.bernie.geckolib3.core.controller.AnimationController;
import software.bernie.geckolib3.core.event.predicate.AnimationEvent;
import software.bernie.geckolib3.core.manager.AnimationData;
import software.bernie.geckolib3.core.manager.AnimationFactory;
import software.bernie.geckolib3.network.GeckoLibNetwork;
import software.bernie.geckolib3.network.ISyncable;
import software.bernie.geckolib3.util.GeckoLibUtil;

import java.util.function.Consumer;


public class ItemTribody extends Item implements IAnimatable {
    public AnimationFactory factory = new AnimationFactory(this);

    public ItemTribody() {
        super(new Item.Properties().tab(Main.TUTORIAL_TAB).stacksTo(1));
    }

    @Override
    public void initializeClient(Consumer<IClientItemExtensions> consumer) {
        super.initializeClient(consumer);
        consumer.accept(new IClientItemExtensions() {
            //物品渲染类
            private final BlockEntityWithoutLevelRenderer renderer = new RenderTribody();

            @Override
            public BlockEntityWithoutLevelRenderer getCustomRenderer() {
                return renderer;
            }
        });
    }

    //动画控制器
    @Override
    public void registerControllers(AnimationData data) {
        data.addAnimationController(new AnimationController(this, "controller",
                0, this::predicate));
    }

    //动画播放设定
    private <E extends IAnimatable> PlayState predicate(AnimationEvent<E> event) {
        //这里我们默认循环播放名为"animation.tribody.run"的动画
        event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.tribody.run", true));

        return PlayState.CONTINUE;
    }

    @Override
    public AnimationFactory getFactory() {
        return this.factory;
    }
}

在ItemInit类中将我们的物品进行注册:

ItemInit.java

    public static RegistryObject<Item> DROP = register("tribody",()->
    {
        return new ItemTribody();
    });

3.在Item包中新建一个model包,model包中新建一个物品模型类ModelTribody,用于指定我们的物品模型:

ModelTribody.java

package com.joy187.re8joymod.items.model;

import com.joy187.re8joymod.Main;
import com.joy187.re8joymod.items.ItemTribody;
import net.minecraft.resources.ResourceLocation;
import software.bernie.geckolib3.model.AnimatedGeoModel;

public class ModelTribody extends AnimatedGeoModel<ItemTribody>{

    //模型文件在资源包中的路径
    @Override
    public ResourceLocation getModelResource(ItemTribody object) {
        return new ResourceLocation(Main.MOD_ID, "geo/tribody.geo.json");
    }

    //贴图文件在资源包中的路径
    @Override
    public ResourceLocation getTextureResource(ItemTribody object) {
        return new ResourceLocation(Main.MOD_ID, "textures/item/drop2.png");
    }

    //动画文件在资源包中的路径
    @Override
    public ResourceLocation getAnimationResource(ItemTribody animatable) {
        return new ResourceLocation(Main.MOD_ID, "animations/tribody.animation.json");
    }
}

4.在Item包中新建一个render包,包中新建类RenderTribody,用于指定我们的物品渲染:

RenderTribody.java

package com.joy187.re8joymod.items.render;

import com.joy187.re8joymod.items.ItemTribody;
import com.joy187.re8joymod.items.model.ModelTribody;
import software.bernie.geckolib3.renderers.geo.GeoItemRenderer;


public class RenderTribody extends GeoItemRenderer<ItemTribody> {

    public RenderTribody() {
        //里面传入上一步中的物品模型类
        super(new ModelTribody());
    }
}

5.代码部分完成,由于第一步中我们已经将各种文件放好了,所以只需要在资源包的lang文件夹中添加物品的英文、中文名称:

en_us.json

"item.re8joymod.tribody": "Drop",

中文名称

zh_cn.json

"item.re8joymod.tribody": "水滴",

6.保存所有代码文件,运行游戏:

当我们把物品拿在手上:

tri2.gif

本次演示物品的动画模型文件(参照第一步放入geo包):

tribody.geo.json

{
    "format_version": "1.12.0",
    "minecraft:geometry": [
        {
            "description": {
                "identifier": "geometry.tribody - Converted",
                "texture_width": 16,
                "texture_height": 16,
                "visible_bounds_width": 2,
                "visible_bounds_height": 2.5,
                "visible_bounds_offset": [0, 0.75, 0]
            },
            "bones": [
                {
                    "name": "Drop",
                    "pivot": [-1, 4, 2]
                },
                {
                    "name": "drop3",
                    "parent": "Drop",
                    "pivot": [-8, 8, 8],
                    "cubes": [
                        {
                            "origin": [-1, 4.5, -7.5],
                            "size": [0.5, 0.5, 1],
                            "uv": {
                                "north": {"uv": [8, 1], "uv_size": [-0.5, 0.5]},
                                "east": {"uv": [7.5, 15.5], "uv_size": [0.5, -14.5]},
                                "south": {"uv": [7.5, 15], "uv_size": [0.5, 0.5]},
                                "west": {"uv": [7.5, 1], "uv_size": [0.5, 14.5]},
                                "up": {"uv": [8, 15.5], "uv_size": [-0.5, -14.5]},
                                "down": {"uv": [8, 15.5], "uv_size": [-0.5, -14.5]}
                            }
                        },
                        {
                            "origin": [-1, 5, -6.5],
                            "size": [0.5, 0.5, 14],
                            "uv": {
                                "north": {"uv": [8.5, 1.5], "uv_size": [-0.5, 0.5]},
                                "east": {"uv": [8, 15.5], "uv_size": [0.5, -14]},
                                "south": {"uv": [8, 15], "uv_size": [0.5, 0.5]},
                                "west": {"uv": [8, 1.5], "uv_size": [0.5, 14]},
                                "up": {"uv": [8.5, 15.5], "uv_size": [-0.5, -14]},
                                "down": {"uv": [8.5, 15.5], "uv_size": [-0.5, -14]}
                            }
                        },
                        {
                            "origin": [-1, 4, -5.5],
                            "size": [0.5, 0.5, 13],
                            "uv": {
                                "north": {"uv": [7.5, 2.5], "uv_size": [-0.5, 0.5]},
                                "east": {"uv": [7, 15.5], "uv_size": [0.5, -13]},
                                "south": {"uv": [7, 15], "uv_size": [0.5, 0.5]},
                                "west": {"uv": [7, 2.5], "uv_size": [0.5, 13]},
                                "up": {"uv": [7.5, 15.5], "uv_size": [-0.5, -13]},
                                "down": {"uv": [7.5, 15.5], "uv_size": [-0.5, -13]}
                            }
                        },
                        {
                            "origin": [-1, 5.5, -5],
                            "size": [0.5, 0.5, 12.5],
                            "uv": {
                                "north": {"uv": [9, 3], "uv_size": [-0.5, 0.5]},
                                "east": {"uv": [8.5, 15.5], "uv_size": [0.5, -12.5]},
                                "south": {"uv": [8.5, 15], "uv_size": [0.5, 0.5]},
                                "west": {"uv": [8.5, 3], "uv_size": [0.5, 12.5]},
                                "up": {"uv": [9, 15.5], "uv_size": [-0.5, -12.5]},
                                "down": {"uv": [9, 15.5], "uv_size": [-0.5, -12.5]}
                            }
                        },
                        {
                            "origin": [-1, 3.5, -4],
                            "size": [0.5, 0.5, 11.5],
                            "uv": {
                                "north": {"uv": [7, 4], "uv_size": [-0.5, 0.5]},
                                "east": {"uv": [6.5, 15.5], "uv_size": [0.5, -11.5]},
                                "south": {"uv": [6.5, 15], "uv_size": [0.5, 0.5]},
                                "west": {"uv": [6.5, 4], "uv_size": [0.5, 11.5]},
                                "up": {"uv": [7, 15.5], "uv_size": [-0.5, -11.5]},
                                "down": {"uv": [7, 15.5], "uv_size": [-0.5, -11.5]}
                            }
                        },
                        {
                            "origin": [-1, 6, -3.5],
                            "size": [0.5, 0.5, 11],
                            "uv": {
                                "north": {"uv": [9.5, 4.5], "uv_size": [-0.5, 0.5]},
                                "east": {"uv": [9, 15.5], "uv_size": [0.5, -11]},
                                "south": {"uv": [9, 15], "uv_size": [0.5, 0.5]},
                                "west": {"uv": [9, 4.5], "uv_size": [0.5, 11]},
                                "up": {"uv": [9.5, 15.5], "uv_size": [-0.5, -11]},
                                "down": {"uv": [9.5, 15.5], "uv_size": [-0.5, -11]}
                            }
                        },
                        {
                            "origin": [-1, 3, -2.5],
                            "size": [0.5, 0.5, 9.5],
                            "uv": {
                                "north": {"uv": [6.5, 5.5], "uv_size": [-0.5, 0.5]},
                                "east": {"uv": [6, 15], "uv_size": [0.5, -9.5]},
                                "south": {"uv": [6, 14.5], "uv_size": [0.5, 0.5]},
                                "west": {"uv": [6, 5.5], "uv_size": [0.5, 9.5]},
                                "up": {"uv": [6.5, 15], "uv_size": [-0.5, -9.5]},
                                "down": {"uv": [6.5, 15], "uv_size": [-0.5, -9.5]}
                            }
                        },
                        {
                            "origin": [-1, 6.5, -2],
                            "size": [0.5, 0.5, 9],
                            "uv": {
                                "north": {"uv": [10, 6], "uv_size": [-0.5, 0.5]},
                                "east": {"uv": [9.5, 15], "uv_size": [0.5, -9]},
                                "south": {"uv": [9.5, 14.5], "uv_size": [0.5, 0.5]},
                                "west": {"uv": [9.5, 6], "uv_size": [0.5, 9]},
                                "up": {"uv": [10, 15], "uv_size": [-0.5, -9]},
                                "down": {"uv": [10, 15], "uv_size": [-0.5, -9]}
                            }
                        },
                        {
                            "origin": [-1, 2.5, -1],
                            "size": [0.5, 0.5, 7.5],
                            "uv": {
                                "north": {"uv": [6, 7], "uv_size": [-0.5, 0.5]},
                                "east": {"uv": [5.5, 14.5], "uv_size": [0.5, -7.5]},
                                "south": {"uv": [5.5, 14], "uv_size": [0.5, 0.5]},
                                "west": {"uv": [5.5, 7], "uv_size": [0.5, 7.5]},
                                "up": {"uv": [6, 14.5], "uv_size": [-0.5, -7.5]},
                                "down": {"uv": [6, 14.5], "uv_size": [-0.5, -7.5]}
                            }
                        },
                        {
                            "origin": [-1, 7, 0],
                            "size": [0.5, 0.5, 6.5],
                            "uv": {
                                "north": {"uv": [10.5, 8], "uv_size": [-0.5, 0.5]},
                                "east": {"uv": [10, 14.5], "uv_size": [0.5, -6.5]},
                                "south": {"uv": [10, 14], "uv_size": [0.5, 0.5]},
                                "west": {"uv": [10, 8], "uv_size": [0.5, 6.5]},
                                "up": {"uv": [10.5, 14.5], "uv_size": [-0.5, -6.5]},
                                "down": {"uv": [10.5, 14.5], "uv_size": [-0.5, -6.5]}
                            }
                        },
                        {
                            "origin": [-1, 2, 0.5],
                            "size": [0.5, 0.5, 5.5],
                            "uv": {
                                "north": {"uv": [5.5, 8.5], "uv_size": [-0.5, 0.5]},
                                "east": {"uv": [5, 14], "uv_size": [0.5, -5.5]},
                                "south": {"uv": [5, 13.5], "uv_size": [0.5, 0.5]},
                                "west": {"uv": [5, 8.5], "uv_size": [0.5, 5.5]},
                                "up": {"uv": [5.5, 14], "uv_size": [-0.5, -5.5]},
                                "down": {"uv": [5.5, 14], "uv_size": [-0.5, -5.5]}
                            }
                        },
                        {
                            "origin": [-1, 7.5, 1.5],
                            "size": [0.5, 0.5, 5],
                            "uv": {
                                "north": {"uv": [11, 9.5], "uv_size": [-0.5, 0.5]},
                                "east": {"uv": [10.5, 14.5], "uv_size": [0.5, -5]},
                                "south": {"uv": [10.5, 14], "uv_size": [0.5, 0.5]},
                                "west": {"uv": [10.5, 9.5], "uv_size": [0.5, 5]},
                                "up": {"uv": [11, 14.5], "uv_size": [-0.5, -5]},
                                "down": {"uv": [11, 14.5], "uv_size": [-0.5, -5]}
                            }
                        },
                        {
                            "origin": [-1, 1.5, 2],
                            "size": [0.5, 0.5, 3.5],
                            "uv": {
                                "north": {"uv": [5, 10], "uv_size": [-0.5, 0.5]},
                                "east": {"uv": [4.5, 13.5], "uv_size": [0.5, -3.5]},
                                "south": {"uv": [4.5, 13], "uv_size": [0.5, 0.5]},
                                "west": {"uv": [4.5, 10], "uv_size": [0.5, 3.5]},
                                "up": {"uv": [5, 13.5], "uv_size": [-0.5, -3.5]},
                                "down": {"uv": [5, 13.5], "uv_size": [-0.5, -3.5]}
                            }
                        },
                        {
                            "origin": [-1, 8, 3],
                            "size": [0.5, 0.5, 2.5],
                            "uv": {
                                "north": {"uv": [11.5, 11], "uv_size": [-0.5, 0.5]},
                                "east": {"uv": [11, 13.5], "uv_size": [0.5, -2.5]},
                                "south": {"uv": [11, 13], "uv_size": [0.5, 0.5]},
                                "west": {"uv": [11, 11], "uv_size": [0.5, 2.5]},
                                "up": {"uv": [11.5, 13.5], "uv_size": [-0.5, -2.5]},
                                "down": {"uv": [11.5, 13.5], "uv_size": [-0.5, -2.5]}
                            }
                        },
                        {
                            "origin": [-1, 1, 3.5],
                            "size": [0.5, 0.5, 0.5],
                            "uv": {
                                "north": {"uv": [4.5, 11.5], "uv_size": [-0.5, 0.5]},
                                "east": {"uv": [4, 12], "uv_size": [0.5, -0.5]},
                                "south": {"uv": [4, 11.5], "uv_size": [0.5, 0.5]},
                                "west": {"uv": [4, 11.5], "uv_size": [0.5, 0.5]},
                                "up": {"uv": [4.5, 12], "uv_size": [-0.5, -0.5]},
                                "down": {"uv": [4.5, 12], "uv_size": [-0.5, -0.5]}
                            }
                        }
                    ]
                },
                {
                    "name": "drop2",
                    "parent": "Drop",
                    "pivot": [-8, 8, 8],
                    "cubes": [
                        {
                            "origin": [-1.5, 3.5, -4],
                            "size": [0.5, 2.5, 11.5],
                            "uv": {
                                "north": {"uv": [8, 1], "uv_size": [-0.5, 0.5]},
                                "east": {"uv": [7.5, 1], "uv_size": [0.5, 14.5]},
                                "south": {"uv": [7.5, 15], "uv_size": [0.5, 0.5]},
                                "west": {"uv": [7.5, 1], "uv_size": [0.5, 14.5]},
                                "up": {"uv": [8, 1], "uv_size": [-0.5, 14.5]},
                                "down": {"uv": [8, 15.5], "uv_size": [-0.5, -14.5]}
                            }
                        },
                        {
                            "origin": [-1, 4.5, -6.5],
                            "size": [0.5, 0.5, 14],
                            "uv": {
                                "north": {"uv": [8.5, 1.5], "uv_size": [-0.5, 0.5]},
                                "east": {"uv": [8, 1.5], "uv_size": [0.5, 14]},
                                "south": {"uv": [8, 15], "uv_size": [0.5, 0.5]},
                                "west": {"uv": [8, 1.5], "uv_size": [0.5, 14]},
                                "up": {"uv": [8.5, 1.5], "uv_size": [-0.5, 14]},
                                "down": {"uv": [8.5, 15.5], "uv_size": [-0.5, -14]}
                            }
                        },
                        {
                            "origin": [-2, 4, -3.5],
                            "size": [0.5, 1.5, 10],
                            "uv": {
                                "north": {"uv": [7.5, 2.5], "uv_size": [-0.5, 0.5]},
                                "east": {"uv": [7, 2.5], "uv_size": [0.5, 13]},
                                "south": {"uv": [7, 15], "uv_size": [0.5, 0.5]},
                                "west": {"uv": [7, 2.5], "uv_size": [0.5, 13]},
                                "up": {"uv": [7.5, 2.5], "uv_size": [-0.5, 13]},
                                "down": {"uv": [7.5, 15.5], "uv_size": [-0.5, -13]}
                            }
                        },
                        {
                            "origin": [-0.5, 3.5, -3],
                            "size": [0.5, 2.5, 10.5],
                            "uv": {
                                "north": {"uv": [9, 3], "uv_size": [-0.5, 0.5]},
                                "east": {"uv": [8.5, 3], "uv_size": [0.5, 12.5]},
                                "south": {"uv": [8.5, 15], "uv_size": [0.5, 0.5]},
                                "west": {"uv": [8.5, 3], "uv_size": [0.5, 12.5]},
                                "up": {"uv": [9, 3], "uv_size": [-0.5, 12.5]},
                                "down": {"uv": [9, 15.5], "uv_size": [-0.5, -12.5]}
                            }
                        },
                        {
                            "origin": [-2.5, 4.5, -3],
                            "size": [0.5, 0.5, 8.5],
                            "uv": {
                                "north": {"uv": [7, 4], "uv_size": [-0.5, 0.5]},
                                "east": {"uv": [6.5, 4], "uv_size": [0.5, 11.5]},
                                "south": {"uv": [6.5, 15], "uv_size": [0.5, 0.5]},
                                "west": {"uv": [6.5, 4], "uv_size": [0.5, 11.5]},
                                "up": {"uv": [7, 4], "uv_size": [-0.5, 11.5]},
                                "down": {"uv": [7, 15.5], "uv_size": [-0.5, -11.5]}
                            }
                        },
                        {
                            "origin": [0, 4, -1.5],
                            "size": [0.5, 1.5, 8],
                            "uv": {
                                "north": {"uv": [9.5, 4.5], "uv_size": [-0.5, 0.5]},
                                "east": {"uv": [9, 4.5], "uv_size": [0.5, 11]},
                                "south": {"uv": [9, 15], "uv_size": [0.5, 0.5]},
                                "west": {"uv": [9, 4.5], "uv_size": [0.5, 11]},
                                "up": {"uv": [9.5, 4.5], "uv_size": [-0.5, 11]},
                                "down": {"uv": [9.5, 15.5], "uv_size": [-0.5, -11]}
                            }
                        },
                        {
                            "origin": [0.5, 4.5, 0.5],
                            "size": [0.5, 0.5, 5],
                            "uv": {
                                "north": {"uv": [9.5, 4.5], "uv_size": [-0.5, 0.5]},
                                "east": {"uv": [9, 4.5], "uv_size": [0.5, 11]},
                                "south": {"uv": [9, 15], "uv_size": [0.5, 0.5]},
                                "west": {"uv": [9, 4.5], "uv_size": [0.5, 11]},
                                "up": {"uv": [9.5, 4.5], "uv_size": [-0.5, 11]},
                                "down": {"uv": [9.5, 15.5], "uv_size": [-0.5, -11]}
                            }
                        }
                    ]
                }
            ]
        }
    ]
}

物品动画文件(放入animations包):

tribody.animation.json

{
    "format_version": "1.8.0",
    "animations": {
        "animation.tribody.run": {
            "loop": true,
            "bones": {
                "Drop": {
                    "rotation": {
                        "vector": [0, "math.sin(query.anim_time*120)*5", "math.sin(query.anim_time*360)*360"]
                    },
                    "position": {
                        "vector": ["math.sin(query.anim_time*360)*10", "math.sin(query.anim_time*720)*2", "math.cos(query.anim_time*360)*10"]
                    }
                }
            }
        }
    },
    "geckolib_format_version": 2
}

手上展示模型文件(放入models/item包):

tribody.json

{
  "credit": "Made with Blockbench",
  "parent": "builtin/entity",
  "display": {
    "thirdperson_righthand": {
      "rotation": [
        -161.25,
        0,
        0
      ],
      "translation": [
        -1.75,
        7.25,
        -1.25
      ]
    },
    "thirdperson_lefthand": {
      "rotation": [
        -174.75,
        0,
        0
      ],
      "translation": [
        0.75,
        6.5,
        -3
      ]
    },
    "firstperson_righthand": {
      "rotation": [
        180,
        -11.25,
        180
      ],
      "translation": [
        0,
        -1.5,
        -2.25
      ]
    },
    "firstperson_lefthand": {
      "rotation": [
        180,
        0,
        0
      ],
      "translation": [
        0,
        9,
        0
      ]
    },
    "gui": {
      "rotation": [
        -92.23,
        -47.05,
        82.48
      ],
      "translation": [
        3.75,
        3,
        0
      ]
    },
    "head": {
      "rotation": [
        -180,
        7.5,
        -180
      ],
      "translation": [
        0,
        6.5,
        -2.5
      ]
    },
    "fixed": {
      "rotation": [
        0,
        -90,
        0
      ],
      "translation": [
        1,
        -4.5,
        -1
      ]
    }
  }
}



GRID
13天前

本次我将RGB名称与光束颜色进行了联合,同时支持了光影对光束的渲染。

1.参考掉落物光束等模组光束类型制作了新的光束:

cr0.jpg

2.如果你的物品名称没有使用RGB规则,那么会按照配置文件中的默认光束颜色渲染。

如果你的物品名称是RGB+文字的格式,则会按照RGB的光束颜色渲染

示例:

渐变效果名称在光束类型为2时的渲染

#FF69B4-BBAACC-B0E0E6Diamond Pickaxe

xuan.gif

3.同时本次所有的光束效果均已支持光影水反:

cr1.jpg
测试光影:SEUS v10.1 Standard

所有的设置均可在模组配置文件中进行修改

crr.jpg

mc百科




GRID
15天前

本次我加入了四种光束类型,玩家可以在配置文件中进行自行选择

beamtype.jpg

光束类型:

  1. 信标光束
  2. 魔爪光束
  3. 射线光束
  4. 闪电光束
    crr.jpg

mc百科下载




GRID
19天前

本次我增加了掉落物光束的效果,并支持RGB对光束颜色的修改。

1.掉落物光束

2022-11-19_17.03.31.png

你可以对掉落物光束的相关设定进行修改:

crt.jpg

从上到下依次为:

beamColor 光束颜色
beamHeight 光束高度
canFloat 是否可飘在水上
haloRadius 光晕半径
oldItems 是否像之前的物品一样渲染
radius 光束半径
shouldRender 是否渲染光束
shouldRenderHalo 是否渲染光晕

mc百科下载




GRID
21天前

本次我修改了原有的彩色字体输入格式,并增加了多重渐变的字体效果。

现在只需要传入6位RGB就可以,顺序为R(red)G(green)B(blue):

1.单一色彩字体

输入格式

#RGB文字

实例演示

#B0E0E6ABCDEFG一闪一闪小星星

bluew.png

2.渐变色彩字体

输入格式(由颜色A渐变到颜色B,后跟文字)

#RGB-RGB文字

实例演示

#FF69B4-FFF0B4你好世界! Hello World!

wore.png

新加入多重渐变效果:

输入格式(多个颜色,后跟文字)

#RGB-RGB-...-RGB文字

实例演示

#FF69B4-BBAACC-B0E0E6-45FF9AI need to be the one

ned.jpg

当然,你可以组合这些用法:
#11320004-FF32FF04ABCDEFGHILJK#FF32FF04-11320004LMNOPRSTVUWXYZ

colormix.jpg

0.2版本下载:

百度网盘
密码:fidd

对源码感兴趣的同学可以访问github