#How to Use VS Collision (For Mod Dev)?
1 messages · Page 1 of 1 (latest)
How to Use VS Collision (For Mod Dev)?
What kind of object are the ships?
I understand their real blocks are millions of blocks away -but what is being projected that I can further implement projectile collisions onto?
it honestly depends on how the cannon projectile is setup
most vanilla-MC distance checks, raycasts, etc are already redirected to ships if needed
its only when mods use a custom distance check or raycast that things break
ah this one definitely is
anyway if a conventional raycast isn't possible to be put into the supplementary system, you can use some of the functions in VSGameUtilsKt
its kotlin right?
yes but you can use it in java
java example: ```java
// level and my_blockpos are variables from elsewhere, depends on where you run this code
Ship the_ship = VSGameUtilsKt.getShipObjectManagingPos(level, my_blockpos)
// Ship will be null if there isn't a ship at that position
if (the_ship != null) {
// do something
}
// normal behaviour
kotlin example: ```kotlin
// level and my_blockpos are variables from elsewhere, depends on where you run this code
var the_ship = level.getShipObjectManagingPos(my_blockpos)
// Ship will be null if there isn't a ship at that position
if (the_ship != null) {
// do something
}
// normal behaviour
i am trying to redirect some of those functions from RaycastUtilsKt i wonder if im in the wrong place
this looks very helpful
idk kotlin btw
😳
I've never used raycast utils myself, since vanilla raycast methods (level.clip) should find shipyard positions
me neither honestly
another question
would decompiling to java within Intellij be the right approach for kt?
it seems to have missing mappings and poor syntax highlighting so im in doubt
why are you decompiling anything
and why are you doing it
I think they mean this
ok but why
i am not comfortable with kotlin
again, just use functions
the easiest way is to type the kotlin class name, then a . like
VSGameUtilsKt. then hit ctrl+space and it will auto-suggest all the functions available in java
you have been very helpful
decompiling it will probably make you more confused 
oh and if you need to go between
Vec3 and Vector3
you can look at
VectorConversionKitMcKt or something
I forget its exact name
JOML is the format VS uses, with Vector3f, Vector3dc, etc wheras minecraft has its own Vec3, Vec3i, etc
not in 1.20.1
yes?
no?
yea?


since your still here might we discuss this example which gives me hope?
package com.example.bulletfix.mixin;
import com.mrcrayfish.guns.entity.ProjectileEntity;
import java.util.function.Predicate;
import net.minecraft.world.level.ClipContext;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.valkyrienskies.mod.common.world.RaycastUtilsKt;
@Mixin(
value = {ProjectileEntity.class},
remap = false
)
public abstract class MixinProjectileEntity<T> {
@Inject(
method = {"Lcom/mrcrayfish/guns/entity/ProjectileEntity;rayTraceBlocks(Lnet/minecraft/world/level/Level;Lnet/minecraft/world/level/ClipContext;Ljava/util/function/Predicate;)Lnet/minecraft/world/phys/BlockHitResult;"},
at = {@At("HEAD")},
cancellable = true
)
private static void injectRayTraceBlocks(Level world, ClipContext context, Predicate<BlockState> ignorePredicate, CallbackInfoReturnable<BlockHitResult> cir) {
cir.setReturnValue(RaycastUtilsKt.clipIncludeShips(world, context));
}
}
this is for 1.18 tho it looks simple
and also for a different mod that messes with projectiles
its using a mixin to intercept mr crayfishes ray trace, then calling the VS modified ray trace instead
mixins are very dependent on the mod you're changing
yes the calling vs instead seems intuitive
so I would recommend trying to find the cannons projectiles code
2 hours it works 😊
ayy
you could maybe look at fixing this aswell, if your interested
is it the aiming mode i bet

