Skip to content

Commit

Permalink
先把矿石注册的代码注释上
Browse files Browse the repository at this point in the history
  • Loading branch information
zlw380 authored and MegumiKasuga committed Dec 31, 2024
1 parent 62bf866 commit f942dcd
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.

This file was deleted.

4 changes: 2 additions & 2 deletions src/main/java/kasuga/lib/example_env/AllExampleElements.java
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,13 @@ public class AllExampleElements {
.tabTo(tab)
.submit(ExampleMain.testRegistry);

public static final OreReg<DropExperienceBlock> exampleOreConfig = new OreReg<DropExperienceBlock>("salt_ore")
/* public static final OreReg<DropExperienceBlock> exampleOreConfig = new OreReg<DropExperienceBlock>("salt_ore")
.setOreBlock(SALT_ORE::getBlock)
.setOreCountPerChunk(20)
.setOreQuantityPerGroup(100)
.setOreDistributionType(PlacedFeatureReg.DistributionType.TRIANGLE)
.setOreAnchorAbsolute(80, -80)
.submit(ExampleMain.testRegistry);
.submit(ExampleMain.testRegistry);*/

public static final MenuReg<GreenAppleMenu, GreenAppleScreen> apple =
new MenuReg<GreenAppleMenu, GreenAppleScreen>("green_apple_screen")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ public ConfiguredFeatureReg(String registrationKey) {
super(registrationKey);
}

public ConfiguredFeatureReg<T> addOreConfigTarget(Supplier<T> ore) {
public ConfiguredFeatureReg<T> addOreConfigTarget(T ore) {
oreConfigTargetList.add(OreConfiguration.target(
OreFeatures.STONE_ORE_REPLACEABLES,
ore.get().defaultBlockState()));
ore.defaultBlockState()));
return this;
}

Expand Down
9 changes: 6 additions & 3 deletions src/main/java/kasuga/lib/registrations/common/OreReg.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

public class OreReg<T extends Block> extends Reg {

private Supplier<T> oreBlockSupplier;

private ConfiguredFeatureReg<T> configuredFeatureObject = null;

private PlacedFeatureReg placedFeatureObject = null;
Expand All @@ -24,8 +26,8 @@ public OreReg(String registrationKey) {
this.placedFeatureObject = new PlacedFeatureReg(registrationKey + "_placed");
}

public OreReg<T> setOreBlock(Supplier<T> oreBlock) {
this.configuredFeatureObject.addOreConfigTarget(oreBlock);
public OreReg<T> setOreBlock(Supplier<T> oreBlockSupplier) {
this.oreBlockSupplier = oreBlockSupplier;
return this;
}

Expand Down Expand Up @@ -72,7 +74,8 @@ public OreReg<T> setOreCountPerChunk(int count) {
@Override
public OreReg<T> submit(SimpleRegistry registry) {
if (configuredFeatureObject == null || placedFeatureObject == null)
throw new NullPointerException("ConfiguredFeature or placedFeature is null in OreReg!");
throw new NullPointerException("Either ConfiguredFeature or PlacedFeature is null in OreReg!");
configuredFeatureObject.addOreConfigTarget(oreBlockSupplier.get());
configuredFeatureObject.submit(registry);
placedFeatureObject.setConfiguredFeatureObject(configuredFeatureObject.getRegistryObject());
placedFeatureObject.submit(registry);
Expand Down

0 comments on commit f942dcd

Please sign in to comment.