2024-12-10 17:47:35|Myriagame |source:minecraft skins
Some scripts used by writing the integrated package yourself are very simple gadgets. If you think about how much value is sent out, send a TAC -related first.
onforgeevent ("com.tac.guns.event.gunprojectilehitevent", event => {{{{{
// Use Global to globalize the function to facilitate hot updates in the game
Global.Bullethit (event)
})
//
global.Bullethit = EVENT => {
// Get the warhead entity, personal habit named Xyzraw
Let bulletraw = event.getprojectile ()
// Kubejs comes with the askjs () method, convert the front Bulletraw into the EntityJS object
Let bullet = bulletraw.askjs ()
// Get the current goal of the warhead, that is, the Raytraceresult object of MC
Let ray = event.getraytrace ()
//1.16.5 MinecraftForge's original method and part of the domain are confused, and you need to use the SRG name, FUNC_12345678; 1.18.2
Let raytype = ray.func_216346_c (). Tostring () // gettype () // {miss, block, entity}
If (// Judgment the target type is a square
Raytype == 'Block'
// The significance of this judgment is to limit the ability of the bullet to destroy the block in the first half of the effective range of the bullet. See if you need this judgment
"
// In fact, it is over here. The backing is only personalized content, which is not suitable for any integration package.
// Get the square coordinates, which is actually a plastic array
Let bpos = ray.func_216350_a () // getBlockpos ()
Let ResultBlock
Let Shooterraw Let Worldraw
Try {
// Get the player who shoots the bullet, the method provided by TAC itself
Shooterraw = bulletraw.getShooter ()
// Get the world (dimension);
// Because this incident itself cannot get the world in itself, the player obtained from the previous sentence is called;
// Of course, this will cause a small problem. If the player and the warhead are not in the same dimension, they will get the wrong block.Well, it doesn't matter (
Worldraw = Shooterraw.field_70170_P // Level
// Get the block, but here is the BlockContainerjs object provided by Kubejs instead of the original blockState
ResultBlock = Shooterraw.askjs (). World.getBlock (BPOS)
} Catch (error) {
Console.warn (Error.Message)
} Finally {
// Some data can be read directly from the NBT of the warhead entity
Let bulletnbt = bullet.fullnbt
// Kubejs register a NBT label for all the entities to mark functions, and read PersistentData for the EntityJS object to get
Let bulletkjsdata = Bullet.persisistentData // Pierce is a new feature of 0.3.14, so that the warheads can penetrate multiple entities like the original penetrating arrow branch
Let bpierce = bulletnbt.projectile.pierce
If (Shooterraw && ResultBlock
// Persistentdata's attributes are just DIY. If it is a new attribute that has not been assigned, then it must be the UNDEFINED value, so the sentence on the left below must be established on the left side.
&& (! Bulletkjsdata.blockpierced || Bulletkjsdata.blockpierCed
// I personally only plan to judge individual types of blocks and use the label function of the original MC to mark these blocks.
// When you get the block earlier, choose to get BlockContainerjs to read the block label for easy point
// Speaking of the square label, TAC provides a "TAC: Bullet_ignore" tag itself. The warhead will not logically hit the block with this label, so the script can only be used for blocks that labels without "TAC: Bullet_ingore" label.… At this time, is this a bit late?(
&& ResultBlock.hastag ('tac: bullet_may_destroy')
// There is another thing that TAC will judge and destroy the material with the material as "Glass", so the script is also meaningless for the glass block // && resultBlock.getmater (). Getid ()! = 'Glass'
) {{
// Get the original block
BlockState = Worldraw.func_180495_P (BPOS) // getBlockState (blockpos)
// The following formula is recommended to delete all my comments, adjust the format and look at it (
Let residence = math.min (math.pow (
// Get the block hardness
Blockstate.func_185887_b (worldraw, bpos) // getdestroyspeed (world, blockpos)
// The hardness of the block of the "Rock" material is low in terms of value (don't mention obsidian), so give an extra rate
*(ResultBlock.material.id == 'Rock'? 4: 2) // getMaterial, 2), 320)
// This data can indicate whether the bullet is a plural projectile, such as 霰 bomb
// You can also find some other data, such as the current speed of the warhead
Let Projamount = Bulletnbt.GinalAl.projectileamount
// The time of the warhead is in the world (server side), that is, the length of experience after the bore
Let bulletlife = bullet.ticksexisted
// Similarly, delete the note below to delete the comment and look at it
Let bdmg =
// If the warhead is in the water, the destructive power is reduced.This only affects the fixed and added part, which is essentially the 9mm bomb I used to limit the low power.
(Bullet.inwater? 1:15)+(
// Determine the number of projectiles, and give a destructive BUFF for the newbound bomb
Projamount> 2?
// The method that comes with TAC, the data read will include additional damage bonus of the firearm (usually provided by accessories), the damage sharing of the plural projectile and the damage attenuation during the bullet flight
// If you want to use the initial power of bullets as variables, there is Projectile.damage in the NBT of the warhead entity
Bulletraw.getDamage ()
*(
// Judging the time of the bore
Bulletlife> 1? (Blletlife> 4? 1: 2): 7): Bulletraw.getDamage ())
// If there are more people playing, do not consume the random number of performance here. It is meaningless. The frequency of this incident is still very high.I am a single player, so it doesn't matter.
Let rng = math.random () ()
// The final judgment, the destruction of the square is executed after the establishment
If (bdmg*bpiere*rng+4> Resistance) {
// If you want to see the scene like "one shot only the upper half of the door", the last value of this function is written 0.Do not write any great value anyway.
Worldraw.func_241212_a_ (BPOS, TRUE, Shooterraw, 2) // Destroyblock (BLOCKPOS POS, Boolean DropBlock, Entity Entity, Int Recursionlect))
// Here is the custom Persistentdata property used earlier; // So add a mark to the warhead entity here. After testing, it can effectively prevent the phenomenon of multiple blocks in the same warrior.This is what the game is (
Ifof (bulletkjsdata.blockpierced) == 'number') {{
Bulletkjsdata.blockpierced ++
} Else {bulletkjsdata.blockpierced = 1}
}
}
}
} Else if (raytype == 'Entity') {// Unrelated code
Let Shotraw = Ray.func_216348_a () // Getentity ()
Let Shot = Shotraw.askjs ()
Try {
if (Shot.type == 'Iceandfire: Fire_dragon' && Shot.Fullnbt.ageTicks> = 1800000 || Shot.type == 'Iceandfire: Dragon_multipart' && Shotraw .parent.dragontype.tostring () == 'Fire' &&S.getageinticks ()> = 1800000) {Let Projnbt = Bullet.fullnbt.projectile
Let Potion = Shot.PotionEffects
Let HiteMPFactor = Math.min (0.2*Math.min (Shot.maxhealth/Shot.health, 2.0)*Potion.isactive ('Lesraisinsadd: Deep_poison') 1.8: 1.0** Pody.isactive ('Lesraisinsadd: Virus')?1.5: 1.0+Potion.isActive ('Mowziesmobs: Frozen')? 0.25: 0, 1.0)
// Bullet.mergeFullnbt (`{Projectile: {pierce: 1, Armorignore: $ {HiteMPFactor*Projnbt.armorignore}}`)
Bullet.getProjectile.Deserializenbt (`Armorignore: $ {HitempFactor*Projnbt.armorignor}, CriticalDamage: 0.5`)
}} Catch (error) {console.warn (error.message)}}
}
}
National Service DNF Dark Ni
2025-01-28 09:19:27The new screenshot of the be
2025-01-28 09:18:57The 15th anniversary wallpap
2025-01-28 09:18:273DM Xuanyuan Sinicization Gr
2025-01-28 09:17:57French magazine is the first
2025-01-28 09:17:27The sneak game "Republic" wi
2025-01-28 09:16:57The story between humans and
2025-01-28 09:16:27Capture "Trinity 3: Artifact
2025-01-28 09:15:27Wind direction change "Myste
2025-01-28 09:14:57DICE's new project "Dream" w
2025-01-28 09:14:27Pirate Minecraft Skins
Minecraft Skins
2024-12-10 04:11:27Pirate Minecraft Skins
Minecraft Skins
2024-12-10 04:11:26Master Minecraft Skins
Minecraft Skins
2024-12-10 04:11:25King Minecraft Skins
Minecraft Skins
2024-12-10 04:11:25Guide Minecraft Skins
Minecraft Skins
2024-12-10 04:11:24Dark Knight Minecraft Skins
Minecraft Skins
2024-12-10 04:11:23Sparta Minecraft Skins
Minecraft Skins
2024-12-10 04:11:23Moncraft Skins of the War
Minecraft Skins
2024-12-10 04:11:22Red Witch Minecraft Skins
Minecraft Skins
2024-12-10 04:11:22Golden Cavaliers Minecraft S
Minecraft Skins
2024-12-10 04:11:22