Skip to content

Commit f1fd50f

Browse files
committed
添加参数
1 parent 1e82669 commit f1fd50f

File tree

6 files changed

+22
-22
lines changed

6 files changed

+22
-22
lines changed

processor/annotation/src/main/java/org/polaris2023/annotation/modelgen/block/CubeAll.java

+2
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@
66
@Retention(RetentionPolicy.SOURCE)
77
public @interface CubeAll {
88
boolean item() default true;
9+
String render_type() default "";
10+
String texture() default "";
911
}

processor/src/main/java/org/polaris2023/processor/clazz/datagen/ModelProcessor.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ else if (typeBasicItem != null &&
130130
}
131131
//block model gen
132132
if (cube != null) {
133-
checkAppend(typeElement, variableElement,"cubeAll", cube.item());
133+
checkAppend(typeElement, variableElement,"cubeAll", cube.texture(), cube.render_type(), cube.item());
134134
}
135135
else if (cubeColumn != null) {
136136
checkAppend(typeElement, variableElement, "cubeColumn", cubeColumn.end(), cubeColumn.side(), cubeColumn.item(), cubeColumn.horizontal(), cubeColumn.suffix());

processor/src/main/java/org/polaris2023/utils/Codes.java

+10-9
Original file line numberDiff line numberDiff line change
@@ -240,15 +240,16 @@ public final class %%classname%% implements DataProvider, IModel<%%classname%%>
240240
return this;
241241
}
242242
243-
private <T extends Block> %%classname%% cubeAll(Supplier<T> block, boolean isItem) {
243+
private <T extends Block> %%classname%% cubeAll(Supplier<T> block, String texture, String renderType, boolean isItem) {
244244
ResourceLocation key = BuiltInRegistries.BLOCK.getKey(block.get());
245245
ResourceLocation blockKey = key.withPrefix("block/");
246-
MODELS.put(blockKey, Map.of(
247-
"parent", "minecraft:block/cube_all",
248-
"textures", Map.of(
249-
"all", blockKey.toString()
250-
)
251-
));
246+
Map<String, Object> tMap = new HashMap<>();
247+
tMap.put("parent", "minecraft:block/cube_all");
248+
tMap.put("textures", Map.of(
249+
"all", texture.isEmpty() ? blockKey.toString() : texture
250+
));
251+
if(!renderType.isEmpty()) tMap.put("render_type", renderType);
252+
MODELS.put(blockKey, tMap);
252253
BLOCKSTATES.put(key, Map.of(
253254
"variants", Map.of("", model(blockKey, null, null, null, false))
254255
));
@@ -271,9 +272,9 @@ private Map<String, Object> model(ResourceLocation key, Number x, Number y, Numb
271272
if (!key.getPath().contains("planks")) {
272273
key = planks(key);
273274
ResourceLocation finalKey = key;
274-
cubeAll(() -> BuiltInRegistries.BLOCK.get(finalKey), true);
275+
cubeAll(() -> BuiltInRegistries.BLOCK.get(finalKey), "", "", true);
275276
} else {
276-
cubeAll(block, true);
277+
cubeAll(block, "", "", true);
277278
}
278279
ResourceLocation finalKey1 = key;
279280
buttonBlock(() -> BuiltInRegistries.BLOCK.get(replace(finalKey1, "button")), "");

src/main/java/org/polaris2023/wild_wind/common/init/ModBlocks.java

+1
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ public class ModBlocks {
106106
register("duckweed", DUCKWEED);
107107

108108
@I18n(en_us = "Brittle Ice", zh_cn = "脆冰", zh_tw = "脆冰")
109+
@CubeAll(render_type = "translucent", texture = "wild_wind:block/brittle_ice_0")
109110
public static final DeferredBlock<BrittleIceBlock> BRITTLE_ICE =
110111
register("brittle_ice", BrittleIceBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.ICE)
111112
.strength(0.1F).isValidSpawn(Blocks::never).pushReaction(PushReaction.DESTROY));

src/main/java/org/polaris2023/wild_wind/common/init/ModItems.java

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package org.polaris2023.wild_wind.common.init;
22

3+
import net.minecraft.client.renderer.ItemBlockRenderTypes;
4+
import net.minecraft.client.renderer.RenderType;
35
import net.minecraft.world.item.BoatItem;
46
import net.minecraft.world.item.Item;
57
import net.neoforged.neoforge.registries.DeferredItem;
@@ -17,9 +19,10 @@
1719
import static org.polaris2023.wild_wind.common.init.ModInitializer.*;
1820

1921

20-
@BasicItem
22+
2123
public class ModItems {
2224

25+
@BasicItem
2326
@I18n(en_us = "Living Tuber", zh_cn = "活根", zh_tw = "活根")
2427
public static final DeferredItem<LivingTuberItem> LIVING_TUBER =
2528
register("living_tuber", properties -> new LivingTuberItem(properties
@@ -34,20 +37,20 @@ public class ModItems {
3437
public static final DeferredItem<MagicFluteItem> MAGIC_FLUTE =
3538
register("magic_flute", MagicFluteItem::stackTo1);
3639

37-
40+
@BasicItem
3841
@I18n(en_us = "Cheese", zh_tw = "起司", zh_cn = "奶酪")
3942
public static final DeferredItem<CheeseItem> CHEESE =
4043
register("cheese", p -> new CheeseItem(p.stacksTo(16).food(ModFoods.CHEESE.get())));
41-
44+
@BasicItem
4245
@I18n(en_us = "Russian Soup", zh_cn = "罗宋汤", zh_tw = "羅宋湯")
4346
public static final DeferredItem<Item> RUSSIAN_SOUP =
4447
simpleItem("russian_soup", p -> p.stacksTo(1));
45-
48+
@BasicItem
4649
@I18n(en_us = "Vegetable Soup", zh_cn = "蔬菜浓汤", zh_tw = "蔬菜濃湯")
4750
public static final DeferredItem<Item> VEGETABLE_SOUP =
4851
simpleItem("vegetable_soup", p -> p.stacksTo(1));
4952

50-
53+
@BasicItem
5154
@I18n(en_us = "Nether Mushroom Stew", zh_cn = "下界蘑菇煲", zh_tw = "下界蘑菇煲")
5255
public static final DeferredItem<NetherMushroomStewItem> NETHER_MUSHROOM_STEW =
5356
register("nether_mushroom_stew", properties ->

src/main/resources/assets/wild_wind/models/block/brittle_ice.json

-7
This file was deleted.

0 commit comments

Comments
 (0)