i’m trying to fit my mod(laser turret) with vs mod, here’s a problem which the laser turret cannot aim enemies but always facing one specific direction. I thought it was because vs mod copies all block(entities) to shipyard so the turret got wrong pos from where it was on ship. Anyone has idea to get the correct pos on ship? I’ll be so appreciated!
I couldn’t access the vs-core repo though, if there is a way to go i could be able to find solution myself :<
The magic stuff your looking for in other addons is gonna look something like
ship.transform.shiptoworld.transformpositiom(…)
https://github.com/ValkyrienSkies/Valkyrien-Skies-2/blob/1.18.x/main/common/src/main/java/org/valkyrienskies/mod/mixin/mod_compat/create/cannons/MixinCannonMount.java
and
https://github.com/ValkyrienSkies/Valkyrien-Skies-2/blob/1.18.x/main/common/src/main/java/org/valkyrienskies/mod/mixin/mod_compat/create_big_cannons/MixinPitchOrientedContraptionEntity.java
may be useful
seems there’s lots of dependency/repo error here while i was importing the 1.20.1 mod package, is there a solution?
and found some confusing problem like this pic (also tried use level()), idea told me cannot resolve the method
image.png
As to this, where are you running this code? In a block entity? Or somewhere else? depending on where it is, you’ll need to get your level object from somewhere different
it’s from my blockentity, i’ve tried to get it from the entity which the turret is aiming( using entity.level()) and also the blockentity
here’s my gradle files if whoever need it (really a mess), thanks a lot if there someone giving some suggestions
My recommendation is to completely copy the build.gradle and gradle.properties of kontraption (since it’s not architectury api iirc so it’s less confusing). Then over time, you can slowly remove the things you don’t need
private static Vec3 getShootLocation(LivingEntity entity, List<Vec3> preV, Level lv,BlockPos pos) {
Vec3 averageVelocity = Vec3.ZERO;
for (Vec3 prevVelo : preV){
averageVelocity = averageVelocity.add(prevVelo);
}
averageVelocity = averageVelocity.scale(1.0 / preV.size());// calculate averageVelocity
Vec3 targetPos = new Vec3(entity.getX(), entity.getY(), entity.getZ());
if(VSGameUtilsKt.getShipObjectManagingPos(lv,pos) != null){
;
}
double laserSpeed = 3F; //Laser speed is constant
for (int i = 1; i < 21; i++) { //Tries to predict the path of the entity one second into the future
Vec3 deltaMovement = averageVelocity.multiply(0.4, 0, 0.4);
Vec3 nextPos = targetPos.add(deltaMovement.scale(i-1));
if(nextPos.length() <= laserSpeed*i || i == 20) {
return new Vec3(nextPos.x, nextPos.y+(entity.getBbHeight()*0.75), nextPos.z-0.07);
}
}
return targetPos;
}
here’s the pic and i have no idea how to fix these glitchy word tho…
I use vscode for daily development (python, cpp, c#) so sorry for all the stupid questions
C:\Users\roots\IdeaProjects\MekanismTurrets\src\main\java\com\github\x3r\mekanism_turrets\common\block_entity\LaserTurretBlockEntity.java:199: ����: ������class_3218
if(VSGameUtilsKt.getShipObjectManagingPos(lv,pos) != null){
^
�Ҳ���net.minecraft.class_3218�����ļ�
image.png
This conversation is on Discord · Reply there
image.png
image.png
image.png
image.png