Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def allIntegrationSourceSets = [
"twilightdelight",
"tide",
"starcatcher",
"hybridaquatic",
"confluence",
"vanillabackport",
]
Expand Down Expand Up @@ -388,6 +389,14 @@ dependencies {
starcatcherLocalImplementation("curse.maven:starcatcher-1357603:${starcatcher_version}")
}

if (hasIntegration("hybridaquatic")) {
hybridaquaticLocalImplementation("maven.modrinth:hybrid-api:${hybrid_api_version}")
hybridaquaticLocalImplementation("maven.modrinth:hybrid-aquatic:${hybrid_aquatic_version}")
hybridaquaticLocalImplementation("maven.modrinth:geckolib:${geckolib_version}")
hybridaquaticLocalImplementation("maven.modrinth:lithostitched:${lithostitched_version}")
hybridaquaticLocalImplementation("maven.modrinth:kotlin-for-forge:${kotlin_for_forge_version}")
}

if (hasIntegration("confluence")) {
confluenceLocalImplementation("maven.modrinth:geckolib:${geckolib_version}")
confluenceLocalImplementation("curse.maven:confluence-1209464:${confluence_version}")
Expand Down Expand Up @@ -466,6 +475,8 @@ var generateModMetadata = tasks.register("generateModMetadata", ProcessResources
nether_depths_upgrade_version_range : nether_depths_upgrade_version_range,
tide_version_range : tide_version_range,
starcatcher_version_range : starcatcher_version_range,
hybrid_api_version_range : hybrid_api_version_range,
hybrid_aquatic_version_range : hybrid_aquatic_version_range,
confluence_version_range : confluence_version_range,
vanilla_backport_version_range : vanilla_backport_version_range,
integration_mixin_blocks : integrationMixinBlocks
Expand Down
11 changes: 9 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,15 @@ nether_depths_upgrade_version_range = [3.2,)
tide_version = 1ki6UyqV
tide_version_range = [2.1.1,3)
cloth_config_version = 15.0.140
starcatcher_version = 8431589
starcatcher_version_range = [3.0.6,4)
starcatcher_version = 9204486
starcatcher_version_range = [3.2,4,4)
hybrid_api_version = mc1.21.1-1.1.3-neoforge
hybrid_api_version_range = [1.1.3,)
hybrid_aquatic_version = mc1.21.1-1.7.4-neoforge
hybrid_aquatic_version_range = [1.7.4,2)
lithostitched_version = 1.8.1-neoforge-21.1
kotlin_for_forge_version = 5.13.0
### v1.2.9
confluence_version = 9146510
confluence_version_range = [1.2.9,2)
### v1.1.7.10
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright (C) 2025 DragonsPlus
* SPDX-License-Identifier: LGPL-3.0-or-later
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package plus.dragons.createintegratedfarming.integration.hybridaquatic;

import dev.hybridlabs.hapi.entity.base.aquatic.BaseWaterAnimal;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.event.lifecycle.FMLConstructModEvent;
import plus.dragons.createintegratedfarming.common.CIFCommon;
import plus.dragons.createintegratedfarming.common.fishing.net.FishingNetEntityCaptures;
import plus.dragons.createintegratedfarming.integration.ModIntegration;

@Mod(CIFCommon.ID)
public class HybridAquaticIntegration {
public HybridAquaticIntegration(IEventBus modBus) {
if (ModIntegration.HYBRID_AQUATIC.enabled())
modBus.register(new Common());
}

public static class Common {
@SubscribeEvent
public void construct(final FMLConstructModEvent event) {
FishingNetEntityCaptures.register(BaseWaterAnimal.class::isInstance);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public List<ItemStack> getCatch(FishingNetCatchContext context) {
if (selected == null)
return List.of();
ItemStack stack = FishApi.makeItemStackNonBucket(
selected, context.random().nextFloat() * 100.0F, false, context.player(), false);
bob, selected, context.random().nextFloat() * 100.0F, false, context.player(), false);
return stack.isEmpty() ? List.of() : List.of(stack);
} finally {
bob.discard();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@
import java.util.ArrayList;
import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.enchantment.EnchantmentEffectComponents;
import net.minecraft.world.item.enchantment.EnchantmentHelper;
import net.minecraft.world.level.GameRules;
import net.minecraft.world.level.entity.EntityTypeTest;
import net.minecraft.world.phys.AABB;
Expand All @@ -51,6 +55,14 @@ protected void onCaptureEntity(MovementContext context, ServerLevel level, T fis
var lootTable = level.getServer().reloadableRegistries().getLootTable(entity.getLootTable());
var lootParams = fishing.buildCaptureLootContext(context, level, entity);
lootTable.getRandomItems(lootParams, entity.getLootTableSeed(), item -> collectOrDropItem(context, item));
if (entity instanceof Mob mob) {
for (var slot : EquipmentSlot.values()) {
var stack = mob.getItemBySlot(slot);
if (!stack.isEmpty() && !EnchantmentHelper.has(stack, EnchantmentEffectComponents.PREVENT_EQUIPMENT_DROP)
&& mob.getEquipmentDropChance(slot) > 1.0F)
collectOrDropItem(context, stack);
}
}
if (CIFConfig.server().fishingNetCapturedCreatureDropExpNugget.get()) {
int experience = EventHooks.getExperienceDrop(entity, fishing.player, entity.getExperienceReward(level, entity));
collectOrDropItem(context, new ItemStack(AllItems.EXP_NUGGET.get(), Math.ceilDiv(experience, 3)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ public static boolean canCapture(LivingEntity entity) {
return false;
var dimensions = entity.getDimensions(Pose.SWIMMING);
float maxSize = CIFConfig.server().fishingNetCapturedCreatureMaxSize.getF();
return dimensions.height() < maxSize && dimensions.width() < maxSize;
return dimensions.height() <= maxSize && dimensions.width() <= maxSize;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ static class Comments {
"\"Process\" means captured entity will be discard and all drops will be collected."
};
static final String[] fishingNetCapturedCreatureMaxSize = {
"The maximum size (width and height) of creatures that can be caught by the Fishing Net."
"The maximum size (width and height) of creatures that can be caught by the Fishing Net.",
"Creatures of exactly this size are also captured."
};
static final String[] fishingNetCapturedCreatureDropExpNugget = {
"If creatures captured by Fishing Net should drop Nugget of Experience."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public enum ModIntegration {
SABLE(Mods.SABLE),
TIDE(Mods.TIDE),
STARCATCHER(Mods.STARCATCHER),
HYBRID_AQUATIC(Mods.HYBRID_AQUATIC),
CONFLUENCE(Mods.CONFLUENCE),
VANILLA_BACKPORT(Mods.VANILLA_BACKPORT),
TWILIGHT_FOREST(Mods.TWILIGHT_FOREST),
Expand Down Expand Up @@ -108,6 +109,7 @@ public static class Mods {
public static final String SABLE = "sable";
public static final String TIDE = "tide";
public static final String STARCATCHER = "starcatcher";
public static final String HYBRID_AQUATIC = "hybrid_aquatic";
public static final String CONFLUENCE = "confluence";
public static final String VANILLA_BACKPORT = "vanillabackport";
public static final String SIMULATED = "simulated";
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/META-INF/accesstransformer.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ public net.minecraft.world.entity.projectile.FishingHook getOpenWaterTypeForBloc
public net.minecraft.world.entity.projectile.FishingHook getOpenWaterTypeForArea(Lnet/minecraft/core/BlockPos;Lnet/minecraft/core/BlockPos;)Lnet/minecraft/world/entity/projectile/FishingHook$OpenWaterType; # getOpenWaterTypeForArea
public net.minecraft.world.entity.projectile.FishingHook openWater # openWater
public net.minecraft.world.entity.animal.sheep.Sheep eatBlockGoal # eatBlockGoal
public net.minecraft.world.entity.Mob getEquipmentDropChance(Lnet/minecraft/world/entity/EquipmentSlot;)F # getEquipmentDropChance
public net.minecraft.world.level.BaseSpawner spawnPotentials
public net.minecraft.world.level.BaseSpawner nextSpawnData
public-f net.minecraft.data.recipes.RecipeProvider getName()Ljava/lang/String;
14 changes: 14 additions & 0 deletions src/main/templates/META-INF/neoforge.mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,20 @@ ${integration_mixin_blocks}
ordering="AFTER"
side="BOTH"

[[dependencies.${mod_id}]]
modId="hapi"
type="optional"
versionRange="${hybrid_api_version_range}"
ordering="AFTER"
side="BOTH"

[[dependencies.${mod_id}]]
modId="hybrid_aquatic"
type="optional"
versionRange="${hybrid_aquatic_version_range}"
ordering="AFTER"
side="BOTH"

[[dependencies.${mod_id}]]
modId="confluence"
type="optional"
Expand Down