Skip to content

Commit

Permalink
杂七杂八。
Browse files Browse the repository at this point in the history
  • Loading branch information
Glyceryl6 committed Aug 21, 2024
1 parent 443b415 commit b4d9e78
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 16 deletions.
16 changes: 6 additions & 10 deletions src/main/java/org/hiedacamellia/whispergrove/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,15 @@
import net.neoforged.fml.event.config.ModConfigEvent;
import net.neoforged.neoforge.common.ModConfigSpec;

// An example config class. This is not required, but it's a good idea to have one to keep your config organized.
// Demonstrates how to use Neo's config APIs
@EventBusSubscriber(modid = WhisperGrove.MODID, bus = EventBusSubscriber.Bus.MOD)
public class Config
{
public class Config {

private static final ModConfigSpec.Builder BUILDER = new ModConfigSpec.Builder();

private static final ModConfigSpec.BooleanValue DEBUG = BUILDER
.comment("Set to true to enable debug info")
.comment("设置为true以启用调试信息")
.define("debug", true);
.define("debug", false);

private static final ModConfigSpec.DoubleValue DISEASE_MILD = BUILDER
.comment("Get the ratio of yin and yang points of mild disease")
Expand All @@ -37,7 +35,6 @@ public class Config
.comment("设置为true以启用节气的联动")
.define("ecliptic_compact", true);


static final ModConfigSpec SPEC = BUILDER.build();

public static boolean debug;
Expand All @@ -50,19 +47,18 @@ public static void setDebug(boolean debug){
DEBUG.set(debug);
}


// private static boolean validateItemName(final Object obj)
// {
// return obj instanceof String itemName && BuiltInRegistries.ITEM.containsKey(ResourceLocation.parse(itemName));
// }

@SubscribeEvent
static void onLoad(final ModConfigEvent event)
{
static void onLoad(final ModConfigEvent event) {
debug = DEBUG.get();
diseaseMild = DISEASE_MILD.get();
diseaseModerate = DISEASE_MODERATE.get();
diseaseCritical = DISEASE_CRITICAL.get();
eclipticCompact = ECLIPTIC_COMPACT.get();
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.config.ModConfig;
import org.hiedacamellia.whispergrove.registers.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Locale;

@Mod(WhisperGrove.MODID)
public class WhisperGrove {

public static final String MODID = "whispergrove";
public static final Logger LOGGER = LoggerFactory.getLogger(WhisperGrove.MODID);

public WhisperGrove(IEventBus modEventBus, ModContainer modContainer) {
WGBlock.BLOCKS.register(modEventBus);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
@FieldsAreNonnullByDefault
package org.hiedacamellia.whispergrove.content.common.blockentities;

import net.minecraft.FieldsAreNonnullByDefault;
import net.minecraft.MethodsReturnNonnullByDefault;

import javax.annotation.ParametersAreNonnullByDefault;
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package org.hiedacamellia.whispergrove.core.codec.record;

import io.netty.buffer.ByteBuf;
import net.minecraft.network.chat.Component;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.hiedacamellia.whispergrove.WhisperGrove;
import org.hiedacamellia.whispergrove.core.data.lang.gen.DescGen;
import org.hiedacamellia.whispergrove.core.data.lang.gen.EffectGen;
import org.hiedacamellia.whispergrove.registers.WGItem;

import java.util.Map;

Expand Down Expand Up @@ -38,7 +39,7 @@ protected void addTranslations() {
add(entry.getKey(),entry.getValue());
}

add("item.whispergrove.huang_qi","黄芪");
add(WGItem.MILKVETCH.get(),"黄芪");
add("tooltip.whispergrove.huang_qi","");
add("item.whispergrove.yang_qi_shi","阳起石");
add("tooltip.whispergrove.yang_qi_shi","");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import net.neoforged.neoforge.registries.DeferredRegister;
import org.hiedacamellia.whispergrove.WhisperGrove;
import org.hiedacamellia.whispergrove.content.common.blocks.*;
import org.hiedacamellia.whispergrove.core.entry.BaseCropBlock;

import java.util.Map;
import java.util.stream.Collectors;
Expand All @@ -26,8 +25,8 @@ public class WGBlock {
public static final DeferredBlock<SpringingBlock> SPRINGING = BLOCKS.register("springing", SpringingBlock::new);
public static final DeferredBlock<RollerBlock> ROLLER = BLOCKS.register("roller", RollerBlock::new);

public static final Map<String, DeferredBlock<BaseCropBlock>> CROP_BLOCKS = Stream.of(
public static final Map<String, DeferredBlock<CropBlock>> CROP_BLOCKS = Stream.of(
"rehmannia", "licorice", "milkvetch", "gentian", "ginseng").collect(Collectors.toMap(s -> s,
s -> BLOCKS.register(s, () -> new BaseCropBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.POTATOES), s))));
s -> BLOCKS.register(s, () -> new CropBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.POTATOES)))));

}

0 comments on commit b4d9e78

Please sign in to comment.