generated from Turnip-Labs/bta-example-mod
-
Notifications
You must be signed in to change notification settings - Fork 3
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
5 changed files
with
62 additions
and
40 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
37 changes: 0 additions & 37 deletions
37
src/main/java/baguchan/better_with_aquatic/BetterWithAquatic.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 |
---|---|---|
@@ -1,63 +1,26 @@ | ||
package baguchan.better_with_aquatic; | ||
|
||
import baguchan.better_with_aquatic.block.ModBlocks; | ||
import baguchan.better_with_aquatic.compat.SpawnEggCompat; | ||
import baguchan.better_with_aquatic.entity.EntityAnglerFish; | ||
import baguchan.better_with_aquatic.entity.EntityFish; | ||
import baguchan.better_with_aquatic.entity.render.AnglerFishModel; | ||
import baguchan.better_with_aquatic.entity.render.FishModel; | ||
import baguchan.better_with_aquatic.entity.render.RenderAnglerFish; | ||
import baguchan.better_with_aquatic.entity.render.RenderFish; | ||
import baguchan.better_with_aquatic.packet.SwimPacket; | ||
import baguchan.better_with_aquatic.util.IDUtils; | ||
import net.fabricmc.api.ModInitializer; | ||
import net.minecraft.core.block.Block; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import turniplabs.halplibe.helper.EntityHelper; | ||
import turniplabs.halplibe.helper.NetworkHelper; | ||
import turniplabs.halplibe.util.ConfigHandler; | ||
import useless.prismaticlibe.helper.ModCheckHelper; | ||
|
||
import java.util.Properties; | ||
|
||
|
||
public class BetterWithAquatic implements ModInitializer { | ||
|
||
public static final String MOD_ID = "better_with_aquatic"; | ||
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID); | ||
private static boolean enable_swim; | ||
public static final boolean spawnEggsModPresent = ModCheckHelper.checkForMod("spawneggs", ">=1.1.0"); | ||
|
||
|
||
private void handleConfig() { | ||
Properties prop = new Properties(); | ||
prop.setProperty("starting_block_id", "561"); | ||
prop.setProperty("starting_item_id", "2000"); | ||
prop.setProperty("enable_swim", "true"); | ||
ConfigHandler config = new ConfigHandler(MOD_ID, prop); | ||
IDUtils.initIds( | ||
config.getInt("starting_block_id"), | ||
config.getInt("starting_item_id")); | ||
enable_swim = config.getBoolean("enable_swim"); | ||
config.updateConfig(); | ||
} | ||
|
||
@Override | ||
public void onInitialize() { | ||
this.handleConfig(); | ||
Block.lightOpacity[Block.fluidWaterFlowing.id] = 1; | ||
Block.lightOpacity[Block.fluidWaterStill.id] = 1; | ||
ModBlocks.createBlocks(); | ||
if (spawnEggsModPresent) { | ||
SpawnEggCompat.onInitialize(); | ||
} | ||
EntityHelper.createEntity(EntityFish.class, new RenderFish(new FishModel(), 0.3F), 600, "Fish"); | ||
EntityHelper.createEntity(EntityAnglerFish.class, new RenderAnglerFish(new AnglerFishModel(), 0.4F), 601, "AnglerFish"); | ||
NetworkHelper.register(SwimPacket.class, true, false); | ||
} | ||
|
||
public static boolean isEnableSwim() { | ||
return enable_swim; | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
src/main/java/baguchan/better_with_aquatic/BetterWithAquaticPreLaunch.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,56 @@ | ||
package baguchan.better_with_aquatic; | ||
|
||
import baguchan.better_with_aquatic.block.ModBlocks; | ||
import baguchan.better_with_aquatic.compat.SpawnEggCompat; | ||
import baguchan.better_with_aquatic.util.IDUtils; | ||
import net.fabricmc.loader.api.entrypoint.PreLaunchEntrypoint; | ||
import net.minecraft.core.block.Block; | ||
import turniplabs.halplibe.util.ConfigHandler; | ||
import useless.prismaticlibe.helper.ModCheckHelper; | ||
|
||
import java.util.Properties; | ||
|
||
public class BetterWithAquaticPreLaunch implements PreLaunchEntrypoint { | ||
static { | ||
// DO NOT TOUCH THIS! It's an error prevention method. Thanks Useless! | ||
try { | ||
Class.forName("turniplabs.halplibe.HalpLibe"); | ||
Class.forName("net.minecraft.core.block.Block"); | ||
Class.forName("net.minecraft.core.item.Item"); | ||
} catch (ClassNotFoundException ignored) { | ||
} | ||
} | ||
|
||
private static boolean enable_swim; | ||
public static final boolean spawnEggsModPresent = ModCheckHelper.checkForMod("spawneggs", ">=1.1.0"); | ||
|
||
|
||
private void handleConfig() { | ||
Properties prop = new Properties(); | ||
prop.setProperty("starting_block_id", "561"); | ||
prop.setProperty("starting_item_id", "2000"); | ||
prop.setProperty("enable_swim", "true"); | ||
ConfigHandler config = new ConfigHandler(BetterWithAquatic.MOD_ID, prop); | ||
IDUtils.initIds( | ||
config.getInt("starting_block_id"), | ||
config.getInt("starting_item_id")); | ||
enable_swim = config.getBoolean("enable_swim"); | ||
config.updateConfig(); | ||
} | ||
|
||
@Override | ||
public void onPreLaunch() { | ||
this.handleConfig(); | ||
Block.lightOpacity[Block.fluidWaterFlowing.id] = 1; | ||
Block.lightOpacity[Block.fluidWaterStill.id] = 1; | ||
ModBlocks.createBlocks(); | ||
if (spawnEggsModPresent) { | ||
SpawnEggCompat.onInitialize(); | ||
} | ||
} | ||
|
||
|
||
public static boolean isEnableSwim() { | ||
return enable_swim; | ||
} | ||
} |
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