Skip to content

Commit 7939fee

Browse files
committed
修复注册表因为错误原因
1 parent 9898c9a commit 7939fee

File tree

8 files changed

+92
-112
lines changed

8 files changed

+92
-112
lines changed

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

+69-15
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ public final class %%classname%% implements DataProvider, IModel<%%classname%%>
105105
}
106106
107107
private <T extends Block> %%classname%% cubeAll(Supplier<T> block) {
108-
. ResourceLocation key = BuiltInRegistries.BLOCK.getKey(block.get());
108+
ResourceLocation key = BuiltInRegistries.BLOCK.getKey(block.get());
109109
ResourceLocation blockKey = key.withPrefix("block/");
110-
MODELS.put(blockKry, Map.of(
110+
MODELS.put(blockKey, Map.of(
111111
"parent", "minecraft:block/cube_all",
112112
"textures", Map.of(
113113
"all", blockKey.toString()
@@ -124,28 +124,82 @@ public final class %%classname%% implements DataProvider, IModel<%%classname%%>
124124
}
125125
126126
private <T extends Block> %%classname%% stairsBlock(Supplier<T> block, String bottom, String side, String top) {
127-
ResourceLocation key = BuiltInRegistries.BLOCK.getKey(block.get()).withPrefix("block/");
128-
MODELS.put(key, Map.of(
127+
ResourceLocation key = BuiltInRegistries.BLOCK.getKey(block.get());
128+
ResourceLocation blockKey = key.withPrefix("block/");
129+
ResourceLocation inner = blockKey.withSuffix("_inner");
130+
ResourceLocation outer = blockKey.withSuffix("_outer");
131+
MODELS.put(blockKey, Map.of(
129132
"parent", "minecraft:block/stairs",
130133
"textures", Map.of(
131-
"bottom", bottom.isEmpty() ? key.toString() : bottom,
132-
"side", side.isEmpty() ? key.toString() : side,
133-
"top", top.isEmpty() ? key.toString() : top
134+
"bottom", bottom.isEmpty() ? blockKey.toString() : bottom,
135+
"side", side.isEmpty() ? blockKey.toString() : side,
136+
"top", top.isEmpty() ? blockKey.toString() : top
134137
)));
135-
MODELS.put(key.withSuffix("_inner"), Map.of(
138+
MODELS.put(inner, Map.of(
136139
"parent", "minecraft:block/inner_stairs",
137140
"textures", Map.of(
138-
"bottom", bottom.isEmpty() ? key.toString() : bottom,
139-
"side", side.isEmpty() ? key.toString() : side,
140-
"top", top.isEmpty() ? key.toString() : top
141+
"bottom", bottom.isEmpty() ? blockKey.toString() : bottom,
142+
"side", side.isEmpty() ? blockKey.toString() : side,
143+
"top", top.isEmpty() ? blockKey.toString() : top
141144
)));
142-
MODELS.put(key.withSuffix("_outer"), Map.of(
145+
MODELS.put(outer, Map.of(
143146
"parent", "minecraft:block/outer_stairs",
144147
"textures", Map.of(
145-
"bottom", bottom.isEmpty() ? key.toString() : bottom,
146-
"side", side.isEmpty() ? key.toString() : side,
147-
"top", top.isEmpty() ? key.toString() : top
148+
"bottom", bottom.isEmpty() ? blockKey.toString() : bottom,
149+
"side", side.isEmpty() ? blockKey.toString() : side,
150+
"top", top.isEmpty() ? blockKey.toString() : top
148151
)));
152+
BLOCKSTATES.put(key, Map.of(
153+
"variants", Map.of(
154+
"facing=east,half=bottom,shape=inner_left", Map.of(
155+
"model", inner.toString(),
156+
"uvlock", true,
157+
"y", 270
158+
),
159+
"facing=east,half=bottom,shape=inner_right", Map.of(
160+
"model", inner.toString()
161+
),
162+
"facing=east,half=bottom,shape=outer_left", Map.of(
163+
"model", outer.toString(),
164+
"uvlock", true,
165+
"y", 270
166+
),
167+
"facing=east,half=bottom,shape=outer_right", Map.of(
168+
"model", outer.toString()
169+
),
170+
"facing=east,half=bottom,shape=straight", Map.of(
171+
"model", blockKey.toString()
172+
),
173+
"facing=east,half= top,shape=inner_left", Map.of(
174+
"model", inner.toString(),
175+
"uvlock", true,
176+
"x", 180
177+
),
178+
"facing=east,half=top,shape=inner_right", Map.of(
179+
"model", inner.toString(),
180+
"uvlock", true,
181+
"x", 180,
182+
"y", 90
183+
),
184+
"facing=east,half=top,shape=outer_left", Map.of(
185+
"model", outer.toString(),
186+
"uvlock", true,
187+
"z", 180
188+
),
189+
"facing=east,half=top,shape=outer_right", Map.of(
190+
"model", outer.toString(),
191+
"uvlock", true,
192+
"x", 180,
193+
"y", 90
194+
195+
),
196+
"facing=east,half= top,shape=straight", Map.of(
197+
"model", blockKey.toString(),
198+
"uvlock", true,
199+
"x", 180
200+
)
201+
)
202+
));
149203
return this;
150204
}
151205

src/main/java/org/polaris2023/wild_wind/client/WildWindClientEventHandler.java

+1-17
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,17 @@
11
package org.polaris2023.wild_wind.client;
22

3-
import net.minecraft.client.color.block.BlockColor;
4-
import net.minecraft.core.BlockPos;
53
import net.minecraft.util.FastColor;
64
import net.minecraft.world.item.Items;
7-
import net.minecraft.world.item.SpawnEggItem;
8-
import net.minecraft.world.level.BlockAndTintGetter;
9-
import net.minecraft.world.level.block.entity.BlockEntity;
10-
import net.minecraft.world.level.block.state.BlockState;
115
import net.neoforged.api.distmarker.Dist;
126
import net.neoforged.bus.api.EventPriority;
137
import net.neoforged.bus.api.SubscribeEvent;
148
import net.neoforged.fml.common.EventBusSubscriber;
159
import net.neoforged.neoforge.client.event.EntityRenderersEvent;
1610
import net.neoforged.neoforge.client.event.RegisterColorHandlersEvent;
17-
import org.jetbrains.annotations.Nullable;
1811
import org.polaris2023.wild_wind.client.entity.abstracts.ModMobRenderer;
1912
import org.polaris2023.wild_wind.client.entity.firefly.FireflyModel;
2013
import org.polaris2023.wild_wind.client.entity.piranha.PiranhaModel;
2114
import org.polaris2023.wild_wind.client.entity.trout.TroutModel;
22-
import org.polaris2023.wild_wind.common.block.WoolBlock;
23-
import org.polaris2023.wild_wind.common.block.entity.WoolBlockEntity;
2415
import org.polaris2023.wild_wind.common.init.ModBlocks;
2516
import org.polaris2023.wild_wind.common.init.ModComponents;
2617
import org.polaris2023.wild_wind.common.init.ModEntities;
@@ -38,14 +29,7 @@ public static void registerSlimeColor(RegisterColorHandlersEvent.Item event) {
3829

3930
@SubscribeEvent
4031
public static void registerBlockColor(RegisterColorHandlersEvent.Block event) {
41-
event.register((state, level, pos, tinIndex) -> {
42-
if (level == null || pos == null) {
43-
return FastColor.ARGB32.opaque(0);
44-
}
45-
WoolBlockEntity woolTile = (WoolBlockEntity) level.getBlockEntity(pos);
46-
if (woolTile == null) return FastColor.ARGB32.opaque(0);
47-
return FastColor.ARGB32.opaque(woolTile.rgb);
48-
}, ModBlocks.WOOL.get());
32+
4933
}
5034

5135
@SubscribeEvent

src/main/java/org/polaris2023/wild_wind/common/block/entity/WoolBlockEntity.java

-31
This file was deleted.

src/main/java/org/polaris2023/wild_wind/common/block/item/WoolBlockItem.java

-41
This file was deleted.

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

+16-3
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,10 @@
2020

2121
import org.polaris2023.annotation.modelgen.item.BasicBlockItem;
2222
import org.polaris2023.annotation.modelgen.item.BasicItem;
23-
import org.polaris2023.wild_wind.common.block.BrittleIceBlock;
23+
import org.polaris2023.wild_wind.common.block.*;
2424

25-
import org.polaris2023.wild_wind.common.block.CookingPotBlock;
26-
import org.polaris2023.wild_wind.common.block.GlowMucusBlock;
2725
import org.polaris2023.wild_wind.common.block.entity.CookingPotBlockEntity;
26+
import org.polaris2023.wild_wind.common.block.entity.DuckweedBlockEntity;
2827

2928
import java.util.Arrays;
3029

@@ -91,6 +90,20 @@ public class ModBlocks {
9190
public static final DeferredItem<BlockItem> COOKING_POT_ITEM =
9291
register("cooking_pot", COOKING_POT);
9392

93+
@I18n(en_us = "Sculk Jaw", zh_cn = "幽匿厄口", zh_tw = "幽匿厄口")
94+
public static final DeferredBlock<SculkJawBlock> SCULK_JAW =
95+
register("sculk_jaw", SculkJawBlock::new, BlockBehaviour.Properties.of());
96+
public static final DeferredItem<BlockItem> SCULK_JAW_ITEM =
97+
register("sculk_jaw", SCULK_JAW);
98+
99+
@I18n(en_us = "Duckweed", zh_cn = "浮萍", zh_tw = "浮萍")
100+
public static final DeferredBlock<DuckweedBlock> DUCKWEED =
101+
register("duckweed", DuckweedBlock::new, BlockBehaviour.Properties.of());
102+
public static final DeferredHolder<BlockEntityType<?>, BlockEntityType<DuckweedBlockEntity>> DUCKWEED_TILE =
103+
entity("duckweed", DSL.remainderType(), DuckweedBlockEntity::new, DUCKWEED);
104+
public static final DeferredItem<BlockItem> DUCKWEED_ITEM =
105+
register("duckweed", DUCKWEED);
106+
94107
@I18n(en_us = "Brittle Ice", zh_cn = "脆冰", zh_tw = "脆冰")
95108
public static final DeferredBlock<BrittleIceBlock> BRITTLE_ICE =
96109
register("brittle_ice", BrittleIceBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.ICE)

src/main/java/org/polaris2023/wild_wind/common/init/items/foods/ModBaseFoods.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ public enum ModBaseFoods implements Supplier<Item>, ItemLike {
8686
COOKED_FROG_LEG(p -> p
8787
.component(ModComponents.MEAT_VALUE, 0.5F)
8888
.component(ModComponents.MONSTER_VALUE, 1F)),
89-
@I18n(en_us = "salt", zh_cn = "盐", zh_tw = "鹽")
90-
SALT(STACK_TO_SNOW)
89+
9190
;
9291

9392
public final DeferredItem<Item> entry;

src/main/java/org/polaris2023/wild_wind/datagen/ModRecipeProvider.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -258,10 +258,10 @@ protected void addShapelessRecipe() {
258258
.requires(ItemTags.WOOL);
259259
}));
260260
add(shapeless(RecipeCategory.MISC, ModBlocks.SALT_BLOCK_ITEM, 1, salt_block -> {
261-
unlockedBy(salt_block, ModBaseFoods.SALT);
262-
salt_block.requires(ModBaseFoods.SALT, 9);
261+
unlockedBy(salt_block, ModBaseItems.SALT);
262+
salt_block.requires(ModBaseItems.SALT, 9);
263263
}));
264-
add(shapeless(RecipeCategory.MISC, ModBaseFoods.SALT, 9, salt -> {
264+
add(shapeless(RecipeCategory.MISC, ModBaseItems.SALT, 9, salt -> {
265265
unlockedBy(salt, ModBlocks.SALT_BLOCK_ITEM);
266266
salt.requires(ModBlocks.SALT_BLOCK_ITEM);
267267
}));

src/main/java/org/polaris2023/wild_wind/datagen/loot/ModBlockLootSubProvider.java

+2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ public void generate() {
4949
this.dropSelf(ModBlocks.AZALEA_PLANKS.get());
5050
this.dropSelf(ModBlocks.AZALEA_SIGN.get());
5151
this.dropSelf(ModBlocks.AZALEA_HANGING_SIGN.get());
52+
this.dropSelf(ModBlocks.SCULK_JAW.get());
53+
this.dropSelf(ModBlocks.DUCKWEED.get());
5254
ModBlockFamilies.AZALEA_PLANKS.generateBlockLoot(this::dropSelf);
5355
}
5456
}

0 commit comments

Comments
 (0)