Skip to content

Commit

Permalink
1.6.5 fixed id problem
Browse files Browse the repository at this point in the history
  • Loading branch information
baguchi committed Nov 19, 2023
1 parent a6f1bda commit 4f49225
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 40 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ halplibe_version=2.7.0
prismatic_version=2.1.1
terrain_api_version=1.3.1
# Mod
mod_version=1.6.4
mod_version=1.6.5
mod_group=baguchan
mod_name=better_with_aquatic
37 changes: 0 additions & 37 deletions src/main/java/baguchan/better_with_aquatic/BetterWithAquatic.java
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;
}
}
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;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package baguchan.better_with_aquatic.mixin.client;

import baguchan.better_with_aquatic.BetterWithAquatic;
import baguchan.better_with_aquatic.BetterWithAquaticPreLaunch;
import baguchan.better_with_aquatic.api.ISwiming;
import net.minecraft.client.input.KeyboardInput;
import net.minecraft.client.option.GameSettings;
Expand Down Expand Up @@ -32,7 +32,7 @@ public void tick(EntityPlayer entityplayer, CallbackInfo ci) {
if (entityplayer.isUnderLiquid(Material.water) && !entityplayer.isSneaking()) {
if (keys[0]) {
if (this.sprintTime < 9 && !this.pressedSprint) {
if (BetterWithAquatic.isEnableSwim()) {
if (BetterWithAquaticPreLaunch.isEnableSwim()) {
((ISwiming) entityplayer).setSwimming(true);
}
} else {
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
],
"terrain-api": [
"baguchan.better_with_aquatic.TerrainAPIPlugin"
],
"preLaunch": [
"baguchan.better_with_aquatic.BetterWithAquaticPreLaunch"
]
},
"mixins": [
Expand Down

0 comments on commit 4f49225

Please sign in to comment.