-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
345 additions
and
283 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions-snapshots/gradle-7.2-20210702220150+0000-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,53 @@ | ||
package org.teacon.chromeball; | ||
|
||
import net.minecraft.network.chat.TranslatableComponent; | ||
import net.minecraft.world.scores.Objective; | ||
import net.minecraft.world.scores.criteria.ObjectiveCriteria; | ||
import net.minecraft.MethodsReturnNonnullByDefault; | ||
import net.minecraftforge.common.ForgeConfigSpec; | ||
import net.minecraftforge.eventbus.api.SubscribeEvent; | ||
import net.minecraftforge.fml.ModLoadingContext; | ||
import net.minecraftforge.fml.common.Mod; | ||
import net.minecraftforge.fml.config.ModConfig; | ||
import net.minecraftforge.fmlserverevents.FMLServerStartingEvent; | ||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; | ||
import org.teacon.chromeball.common.CBRegistry; | ||
|
||
import javax.annotation.ParametersAreNonnullByDefault; | ||
|
||
@Mod(ChromeBall.MOD_ID) | ||
@Mod.EventBusSubscriber | ||
@MethodsReturnNonnullByDefault | ||
@ParametersAreNonnullByDefault | ||
public class ChromeBall { | ||
public static final String MOD_ID = "chromeball"; | ||
public static ObjectiveCriteria O; | ||
|
||
public static Config config; | ||
private static Config modConfig; | ||
|
||
public ChromeBall() { | ||
ForgeConfigSpec.Builder configBuilder = new ForgeConfigSpec.Builder(); | ||
config = new Config(configBuilder); | ||
ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, configBuilder.build(), MOD_ID + ".toml"); | ||
var builder = new ForgeConfigSpec.Builder(); | ||
modConfig = new Config(builder); | ||
ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, builder.build(), MOD_ID + ".toml"); | ||
|
||
var eventBus = FMLJavaModLoadingContext.get().getModEventBus(); | ||
CBRegistry.ITEMS.register(eventBus); | ||
CBRegistry.ENTITIES.register(eventBus); | ||
} | ||
|
||
@SubscribeEvent | ||
public static void onFMLServerStartingEvent(FMLServerStartingEvent event) { | ||
// O = event.getServer().getScoreboard().getObjective("chrome"); | ||
// if (O == null) | ||
// O = event.getServer().getScoreboard().addObjective("chrome", CHROME, new TranslatableComponent("chromeball.tab.1"), ObjectiveCriteria.RenderType.INTEGER); | ||
// | ||
// event.getServer().getScoreboard().setObjectiveInDisplaySlot(0, O); | ||
public static Config getConfig() { | ||
return modConfig; | ||
} | ||
|
||
@MethodsReturnNonnullByDefault | ||
@ParametersAreNonnullByDefault | ||
public static class Config { | ||
public final ForgeConfigSpec.DoubleValue rate; | ||
|
||
private double rateValue = -1; | ||
|
||
public Config(ForgeConfigSpec.Builder builder) { | ||
this.rate = builder.defineInRange("recovery_rate", 0.3D, 0D, 1D); | ||
} | ||
|
||
public double getRateValue() { | ||
if (this.rateValue < 0) { | ||
this.rateValue = rate.get(); | ||
} | ||
return this.rateValue; | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
34 changes: 34 additions & 0 deletions
34
src/main/java/org/teacon/chromeball/client/ClientRenderer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package org.teacon.chromeball.client; | ||
|
||
import net.minecraft.MethodsReturnNonnullByDefault; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.renderer.entity.EntityRenderers; | ||
import net.minecraft.client.renderer.entity.ThrownItemRenderer; | ||
import net.minecraft.client.resources.sounds.SimpleSoundInstance; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraftforge.api.distmarker.Dist; | ||
import net.minecraftforge.eventbus.api.SubscribeEvent; | ||
import net.minecraftforge.fml.common.Mod; | ||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; | ||
import net.minecraftforge.registries.ForgeRegistries; | ||
import org.teacon.chromeball.common.CBRegistry; | ||
|
||
import javax.annotation.ParametersAreNonnullByDefault; | ||
|
||
@MethodsReturnNonnullByDefault | ||
@ParametersAreNonnullByDefault | ||
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT) | ||
public class ClientRenderer { | ||
@SubscribeEvent | ||
public static void registerRenderer(FMLClientSetupEvent event) { | ||
EntityRenderers.register(CBRegistry.ENTITY_TYPE.get(), ThrownItemRenderer::new); | ||
} | ||
|
||
public static void ding() { | ||
var registry = ForgeRegistries.SOUND_EVENTS; | ||
var sound = registry.getValue(new ResourceLocation("entity.experience_orb.pickup")); | ||
if (sound != null) { | ||
Minecraft.getInstance().getSoundManager().play(SimpleSoundInstance.forUI(sound, 1.0f)); | ||
} | ||
} | ||
} |
Oops, something went wrong.