How to create/modify Your Gun
MWC Version 0.1
Requirements for Development:
- Have the mod files downloaded, you can obtain them through the Github link:
[Link]
- IntelliJ IDEA (Community o Ultimate Edition) any version.
- Blockbench.
- Notepad++ (It is not necessary, but you can use it for convenience).
IMPORTANT NOTE: This guide is made to provide a brief explanation of how to modify weapons in the
mod. As a developer of the art assets, my advice is to be patient because learning how to modify the
mod is a matter of trial and error, so that in the end you will be able to understand it in a simple.
Finally, I'd like to thank the mod developers, such as Paneedah, Luna Lage, and Stick, for having done a
great job in optimizing and simplifying the mod's modification.
INTRODUCTION:
To begin modifying the mod, it's necessary for you to know that it's divided into several sections. This
includes how to import the model correctly, how to configure weapons, how to configure the first-
person view position, and more. It is absolutely essential that you have the applications recommended in
'Requirements for Development.' With Blockbench, you can create your weapon models (including the
weapon's texture), and with IntelliJ, you can open the mod files downloaded from Github and you will
start making changes and testing each modification you make in the mod.
1. CRITERIA FOR CREATING OR MODIFYING YOUR WEAPON MODEL
All the weapon models in the mod are created using the “Modded Entity" type
models, with a specific size for the weapons., one recommendation is to separate
the weapon parts into groups.
In case your model has a yellow warning sign it is recommended to either
remove or remodel the problematic part.
2. EXPORTAR LOS MODELOS
To export weapon models for the mod in general, they use a specific order/parts,
but it can vary depending on the type of weapon:
IMPORTANT NOTE: THE TERMS LIKE 'AAAA' OR 'NNNN' REFER TO THE WEAPON'S NAME.
EXPORTING MODELS FOR ASSAULT RIFLES, SUBMACHINE GUNS, AND SNIPER RIFLES
WITHOUT BOLT ACTION.
(Models: AR-15(SneakyDanny), MP5(Vic4Games) and
M82(Vic4Games)).
For these semi-automatic and automatic action weapons, they are generally separated into specific
groups, let's separate them into 2 parts:
// MAIN PARTS
“AAAA” Main body of the rifle
“AAANAction” Bullet ejection port cover.
“AAAAMag” The magazine/case of the gun.
// EXTRA PARTS
“AAAAGrip” The rear grip accessory for the weapon.
“AAAAHandguard” The weapon's handguard accessory.
“AAAAStock” The gun stock accessory.
EXPORT FOR PISTOL OR REVOLVER TYPE MODELS
(Models: M9A1(Vic4Games) and Taurus Raging Hunter(Vic4Games)).
For these short-range guns, they are separated in the following order:
For pistol models it is separated into parts such as:
// MAIN PARTS
“AAAA” Gun main body.
“AAAASlide” The pistol slide.
“AAAAMag” The pistol magazine.
// EXTRA PARTS
“AAAAHammer” The hammer of the pistol.
For revolvers it is separated into parts such as:
// MAIN PARTS
“AAAA” Main body of the revolver (depends on the revolver or model if it is compatible with more
muzzle or grip accessories).
“AAAALoader” The revolver speedloader
“AAAAChamber” The revolver cylinder
“AAAABarrel” The muzzle of the revolver
// EXTRA PARTS
“AAAABullets” The revolver bullets
“AAAAGrip” The grip of the revolver
EXPORT FOR LIGHT MACHINE GUN (LMG) TYPE MODELS
(Model: M249(Vic4Games)).
In general, the Light Machine Gun model is separated into parts such as:
// MAIN PARTS
“AAAA” Machine Gun Main Body
“AAANAction” Bullet ejection port cover
“AAAAMag” Machine gun bullet magazine
“AAAABelt” Machine Gun Bullet Belt
“AAAAHatch” Hatch or Machine Gun Receiver
// EXTRA PARTS
“AAAAHandguard” The machine gun handguard accessory
“AAAAStock” The stock accessory for the Machine Gun
EXPORT FOR BOLT ACTION SNIPER TYPE MODELS
(Model: M200 Intervention(Vic4Games)).
In general, the bolt action sniper model is separated into parts such as:
// MAIN PARTS
“AAAA” Bolt Action Sniper Main Body
“AAAABoltAction” Main bolt run port
“AAAABoltActionPrime” The bolt handle
“AAAAMag” Bolt Action Sniper Magazine
EXPORT FOR PUMP-ACTION SHOTGUN TYPE MODELS
(Model: Remington870(Vic4Games)).
// MAIN PARTS
“AAAA” Main body of the shotgun
“AAAAPump” Pump/Slide Action Shotgun
// SECONDARY PARTS
“AAAAStock” The shotgun stock
“AAAABarrel” The barrel of the shotgun
Important Note : When creating the model it is
necessary to modify some terms:
In the “File Name” and “Model Identifier” sections,
enter the corresponding name of the weapon and in
“Export Version” put “Forge 1.7 – 1.13” or the version
of the mod.
In “Texture Size” the texture settings of your model should be kept.
3. EDIT IMPORTS OF GUN MODELS
After having exported your weapon model in parts in .java files, you must open the files with IntelliJ or
Notepad++ to add the mod imports.
(NOTE: Models used in images are examples, your model should not follow the same model name.)
In IntelliJ: In Notepad++:
After opening the .java file of the model, in the first lines you must place the following lines of code:
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
And replace the term “Modelbase” with the term “ModelWithAttachments”
(NOTE: the imports are from version 0.1, these imports may change during the updates step).
In the end the file, after modifying it, should look like this:
These modifications should be replicated with all other .java model files and then we move the
java files to the following file address:
\Modern-Warfare-Cubed-Rendering- Rewrite\src\main\java\com\paneedah\mwc\models\weapons
4. HOW TO ADD ATTACHMENTS, AUXILIARYATTACHMENTS, MAGAZINE AND
BULLETS
In this section we will be able to create new accessories, modifications, new chargers for the
weapons, each of these types of accessories and complements will have to be configured in
specific files related to the accessories, look for specific files, located in:
Modern-Warfare-Cubed-Rendering-Rewrite\src\main\java\com\paneedah\mwc\weapons
GENERAL CONFIGURATION:
To add any type of accessory, magazine or bullet, a specific order is followed:
First the line of code must be added:
public static ItemAttachment<Weapon> AttachmentName/BulletName/MagName;
This line of code must be placed before the code: public static void init () { , also below this line,
you are just going to start configuring the new accessories or content that you want to add:
To configure the accessories, the following lines of code must be added:
AttachmentName = new AttachmentBuilder<Weapon>()
The first line of code is related to the name of the accessory.
.withCatergory([Link])
This line of code is to add the accessory category, where NNNN = SCOPE, GRIP, SILENCER,
LASER, MAGAZINE, BULLET, SKIN, RAILING, GUARD, STOCK, BACKGRIP, RECEIVER and
FRONTSIGHT, etc..
.withModel(new ModelName(), [Link]
This line of code is used to use the model and texture, the term “ModelName” you must
change it to the model name of the accessory and where it says “[Link]” should be
replaced with the name of the model texture.
.withModernRecipe(
CraftingGroup.ATTACHMENT_MODIFICATION,
new CraftingEntry([Link], Xnumber),
new CraftingEntry([Link], Xnumber))
In the CraftingEntry lines of code it is used to add crafting compatibility, the term “MWCItems”
is the material use of the mod for crafting and those with a term like “Blocks” are for Vanilla
Minecraft block compatibility.
.withName("NameAccesories")
.build();
The last line of code is related to the name (the full name of the accessory and the correct way
how to close the configuration.
In the end it has to be in the following order:
AccessoryName = new
AttachmentBuilder<Weapon>().withCategory([Link])
.withModel(new AccessoryModelName(), "[Link]")
.withModernRecipe(
CraftingGroup.ATTACHMENT_NORMAL,
new CraftingEntry([Link], X),
new CraftingEntry([Link], X))
.withName("AccessoryName")
.build();
ATTACHMENTS:
In this section the accessories that are compatible are
SCOPE, GRIP, SILENCER, LASER, GUARD, STOCK, BACKGRIP, RECEIVER and FRONTSIGHT
Hay algunos accesorios que tienen algunos factores/líneas de código propias y necesarias para
su función
For this type of accessory in AttachmentCategory, instead of “NNNN” you must place “LASER”
and we are going to add two extra lines of code within the base code line.
The following line of code is related to the requirement to use the accessory, i.e. adding specific
accessories compatibility:
.withRequiredAttachments(AHandguardRailed, BHandguard)
And the following line of code is required for rendering the laser line:
.withPostRender(new LaserBeamRenderer((p, s) -> {
[Link](0F, 0F, 0F);
}))
.withRenderablePart()
Scopes/Acog/Specter: For this type of accessory to modify a large part of the code, the
following code order must be followed:
NameScope = new [Link]()
.withSniperReticle([Link])
.withOpticalZoom()
.withZoomRange(0F, 0F)
.withViewfinderPositioning(() -> {
[Link](0F, 0F, 0F);
[Link](0F, 0F, 0F);
})
.withCategory([Link])
.withRequiredAttachments(NNNDustCover, NNNReceiver)
.withModernRecipe(
CraftingGroup.ATTACHMENT_NORMAL,
new CraftingEntry([Link], 0),
new CraftingEntry([Link], 0))
.withCrosshair("NN")
.withRenderablePart()
.withModel(new ModelScope(), "[Link]")
.withName("NameScope")
.withRotationPoint(0F, 0F, 0F)
.build();
Explicación:
- .withSniperReticle([Link]) -> It fulfills the function of adding the type of reticle the
scope has, you can find a variety of reticles in the java file called: “[Link]”.
- .withOpticalZoom() -> Necessary factor for long range sights.
- .withZoomRange(0F, 0F) -> Factor to add the scope zoom range amount.
- .withViewfinderPositioning(()… -> Factor to modify the position and size of the scope
rendering.
- .withRenderablePart() -> Factor needed to allow scope rendering.
- .withRotationPoint(0F, 0F, 0F) -> Factor for the point of rotation. (it is secondary)
- .withNightVision() -> Factor allows for night vision in the scope.
Reflex/Kobra/Holografica: For this type of accessory, follow the following code order:
NNNSight = new [Link]()
.withHolographicReticles([Link])
.withRadialCut(0.1F)
.withReticlePositioning(() -> {
[Link](0F, 0F, 0F);
[Link](0F, 0F, 0F);
})
.withCategory([Link])
.withRenderablePart()
.withModel(new ModelSight/reflex(), "[Link]")
.withModernRecipe(
CraftingGroup.ATTACHMENT_NORMAL,
new CraftingEntry([Link], 0),
new CraftingEntry([Link], 0))
.withRequiredAttachments(NNNDustCover, NNNReceiver)
.withName("NNNSight")
.build();
Explicación:
- .withHolographicReticles([Link]) -> It fulfills the function of adding the type of reticle
the scope has, you can find a variety of reticles in the java file called: “[Link]”.
- .withRadialCut(0.1F) -> Factor needed for rendering.
- .withReticlePositioning( ()…-> Factor to modify the position and size of the reticle in sight
rendering.
- .withRenderablePart() -> Factor necessary to allow the rendering of the holographic.
Grips/Bipod: For this type of accessory, follow the following code order:
NNNgrip = new AttachmentBuilder<Weapon>()
.withCategory([Link])
.withRenderablePart()
.withModel(new ModelGrip(), "[Link]")
.withApply((a, i) -> {
[Link]([Link]().getRecoil() * 0.0F);
})
.withRenderablePart()
.withName("NNNgrip")
.build();
Explicación:
- .withApply((a, i) -> {
[Link]([Link]().getRecoil() *0.0F); -> Necessary factor that applies recoil
reduction.
AUXILIARYATTACHMENTS:
Auxiliary Attachments are accessories that are not modifiable in the game and follow the same
code order:
AccessoryName = new AttachmentBuilder<Weapon>()
.withCategory([Link])
.withModel(new ModelName(), " [Link]")
.withName("AccessoryName")
.withRotationPoint(0.0F, -0.0F, -0.0F)
.withRenderablePart()
.build();
Auxiliary attachments only support these types of accessories:
“NNNN” = EXTRA, EXTRA2, EXTRA3, EXTRA4, EXTRA5, EXTRA6, EXTRA7, EXTRA8,
EXTRA9, EXTRA10, EXTRA11, EXTRA12, MAGICMAG, ACTION
BULLETS:
To add more types of bullet caliber, just follow the following line of code:
BulletName = new [Link]()
.withName("BulletName")
.withModel(new BulletModel(), "[Link]")
.build([Link]);
MAGAZINE:
To add more weapon pouches, you must follow the following line of code:
Magazines. WeaponMagazineName = new [Link]()
.withCapacity(0)
.withCompatibleBullet([Link])
.withName("WeaponMagazineName")
.withModel(new NameModelMag(), "[Link]")
.withMaxStackSize(0)
.withCrafting([Link],
.build([Link]);
In the line of code
- .withCapacity (0) It is used to determine the capacity of the number of bullets that the
magazine can hold.
- .withCompatibleBullet ([Link]) is used to add type compatibility to bullets
- .withMaxStackSize (0) is the number of chargers you can have in your inventory.
5. CREAR Y CONFIGURAR ARCHIVO FACTORY DE TU ARMA
In this first section you must first create a .java file with a specific name order,
(GunName)[Link], some examples:
And to configure the weapons they are divided into several sections to modify:
IMPORT IN THE FACTORY FILE:
The lines of code with the term “imports” are necessary to load the mod's resources, these lines
of code are placed at the beginning of the factory file:
import [Link];
import [Link];
import [Link].*;
import [Link];
Totally necessary imports to run the necessary resources of the mod and the
compatibility of the following "imports".
import [Link];
Necessary import that allows compatibility of use of accessories and modifications
in the weapon you are configuring.
import [Link];
Necessary import that allows adding extra parts of the weapon that are not
modifiable, but that fulfill extra functions in the animation.
import [Link];
Necessary import that allows the compatibility of the magazines in the weapon
you are configuring.
import [Link];
Necessary import that allows the compatibility of use of the bullets (without
magazine), that is, it only uses the bullets as reloading.
import [Link];
Necessary import that allows the type of accessories NOT to be removed from the
weapon.
import [Link];
Necessary import that allows you to configure the rendering of the type of bullet
that is ejected after the shot, there are three variants: rifle bullets, pistols and
shotguns.
import [Link];
Allows the possibility of configuring the camera position change after the recoil of
the shot.
import [Link];
import [Link];
Totally necessary imports to run the necessary resources of the mod and the
compatibility of the following "imports”.
import [Link];
Totally necessary import that allows the compatibility of the new animation and
rendering system..
import [Link];
Import of the old animation system of the mod, it is used if in case your factory
file presents values with the term “Transition((renderContext)”.
import [Link];
Necessary import that allows the configuration of the recoil of weapons with
angles in X, Y and Z..
import [Link];
Allows compatibility with PWEM(Panda's Weapon Editor).
import [Link];
import [Link];
Import that allows you to configure the materials needed to craft the weapon in
the WorkBench.
import [Link];
import [Link].GL11;
Totally necessary import that allows modifying numerical values of the mod.
import [Link].Vec3d;
Import needed to use better vectors in game.
import [Link];
Import add-on for the mod's animation system that allows loading extra objects or
entities related to the weapon in the animation.
GENERAL WEAPON APPEARANCE SETTINGS:
The variables/factors in this section will be used to configure general/visual aspects of the
weapon.
.withName("NNN")
Factor that serves as the name of the Item “NNN” = gun name.
.withFireRate(0.0f) 0.0f solo acepta varíales 0.1f a 1.0f
Rate of fire factor based on “shots per minute”.
.withRecoil(0.0f)
Grade-Based Recoil Variety Factor.
.withZoom(0.0f)
Zoom Factor.
.withConfigGroup([Link])
Weapon group configuration factor, where “NNN” = RIFLES, DMR, SMG, LONG_RANGE_RIFLES,
HEAVY, SIDEARM, HANDGUN and SHOTGUN
.withMuzzlePosition(new Vec3d(0.0Fx, 0.0Fy, 0.0Fz))
Weapon Muzzle Flash Position Setting Factor.
.hasFlashPedals
Factor to use muzzle flash variant.
.withMaxShots(1, 3, Integer.MAX_VALUE) “1” Semi-automatic shooting, “3” burst shooting
y “Integer.MAX_VALUE” automatic shooting.
Weapon firing type configuration factor.
.withShootSound(soundname)
Factor the use of the sound of the gun firing, the SFX you can find/use in: \
Modern-Warfare-Cubed\src\main\resources\assets\mwc\sounds
.withSilencedShootSound(soundname)
Factor the use of the sound of the weapon's silenced firing, the SFX you can find/use in: \
Modern-Warfare-Cubed\src\main\resources\assets\mwc\sounds
.withReloadingTime(0)
Weapon reload time factor in Ticks.
.withFlashIntensity(0.0f)
Factor to edit flash intensity.
.withFlashScale (0.0f)
Flash scale factor.
.withFlashOffsetX(()-> (0.0f)
.withFlashOffsetY(()-> (0.0f)
Flash reduction position edit factor.
.withCreativeTab(MWC.WEAPONS_TAB)
Factor for the appearance of the weapon in the Creative Tab.
.useNewSystem()
Factor to recognize the use of the new weapon system.
.withRecoilParam(new RecoilParam(
// The weapons power
0.0,
// Muzzle climb divisor
0.0,
// "Stock Length"
0.0,
// Recovery rate from initial shot
0.0,
// Recovery rate @ "stock"
0.0,
// Recoil rotation (Y)
0.0,
The rotation system in first person
// Recoil rotation (Z) will be seen in more details later.
0.0,
// Ads similarity divisor
0.0
))
Factor for the use of the new recoil system, the rotation is based on the pie chart.
EXPLICACIÓN:
- // The weapons power -> Edit the recoil speed of the shot, that is, the more power, the
faster the recoil.
- // Muzzle climb divisor-> Lifting the muzzle during shooting.
- // "Stock Length"->
- // Recovery rate from initial shot -> Angular change in X of the weapon after the first shot
(permanent).
- // Recovery rate @ "stock" -> Rearward movement of the weapon during firing, i.e. recoil of
the weapon during firing without angular change.
- // Recoil rotation (Y) -> Y rotation per shot.
- // Recoil rotation (Z) -> Z rotation per shot.
- // Ads similarity divisor -> Similarity of the effect of the recoil of the shot during aiming.
GUN ACCESSORIES/MODIFICATIONS CONFIGURATION:
This section will show how to add accessory compatibility with the weapon, the following lines
of code must be followed:
The following line of code is used to configure what type of accessory is impossible to remove
from the weapon:
.withUnremovableAttachmentCategories([Link])
“NNNN” = SCOPE, GRIP, MUZZLE, MAGAZINE, RAILING, GUARD, STOCK, BACKGRIP and
RECEIVER
In this section they are all based on the same line of code, but complementary values will be
added to modify the translation and scale of the accessories to the gun.
.withCompatibleAttachment([Link], (model) -> {
})
The term “AAAA” can be: Attachments, AuxiliaryAttachments, Bullets and Magazines
You replace the term “NNNN” with the name of the accessory.
If you want the accessory to appear by default on the weapon, add the term “true”:
.withCompatibleAttachment([Link], true, (model) -> {
})
If in case the accessory is outside the base model of the weapon or appears out of the correct
position, the same basis of the lines of code must be followed, but adding lines of translation
and scale code:
.withCompatibleAttachment([Link], (model) -> {
[Link](0F, 0F, 0F);
[Link](0F, 0F, 0F);
})
In the event that the accessory changes its position depending on the modifications to the
weapon, the following code order must be followed:
.withCompatibleAttachment([Link], renderContext -> {
PlayerWeaponInstance instance = [Link]();
if(instance != null) {
ItemAttachment<Weapon> activeAttachment =
[Link](
[Link], instance);
if(activeAttachment == [Link]) {
[Link](0F, 0F, 0F);
[Link](0F, 0F, 0F);
} else {
[Link](0F, 0F, 0F);
[Link](0F, 0F, 0F);
}
}
},(model) -> {
if(model instanceof NNNN) {
[Link](0F, 0F, 0F);
[Link](0F, 0F, 0F);
}
}, false, false)
CONSTRUCCIÓN DEL ARMA:
In this section the base/body of the weapon, the texture, model, etc. will be built....
.withTextureNames("modeltexturename")
The factor for texture usage, the term “modeltexturename” is replaced by the name of your
model's texture.
.withRenderer(new [Link]()
.withModel(new WeaponModelName ())
The necessary factors, in which you are going to add the model of your weapon in the
.withModel code line, the term “WeaponModelName” is where the name of the model is
placed
.withActionPiece([Link])
o .withActionPiece([Link])
.withActionTransform(new Transform().withPosition(0F, 0F, 1F))
Factor for the recoil action of the gun's bullet or slide ejection action.
The following lines of code are used to edit the location/position of the Item/weapon in the
player's inventory, most of these are determined, but may vary depending on the model.
NOTA: You can use configurations from other weapons, the ones shown are an example.
.withEntityPositioning(itemStack -> {
[Link](0.35F, 0.35F, 0.35F);
[Link](0F, 0f, 0f, 4f);
})
.withInventoryPositioning(itemStack -> {
[Link](0.28F, 0.28F, 0.28F);
[Link](1, 2f, -1.2f);
[Link](-120F, -0.5f, 7f, 3f);
})
.withThirdPersonPositioning((renderContext) -> {
[Link](0.45F, 0.45F, 0.45F);
[Link](0F, 0F, 0F);
[Link](-45F, 0f, 1f, 0f);
[Link](70F, 1f, 0f, 0f);
})
SET UP FIRST PERSON POSITION AND HANDS:
To edit the camera position, you need the following line of code:
.withFirstPersonPositioning(
new Transform()
.withPosition(0.0000f, 0.0000f, 0.0000f)
.withRotation(0.000000f, 0.000000f, 0.00000f)
.withPivotPoint(0.0000f, 0.00000f, 0.00000f)
.withScale(0.0F, 0.0F, 0.0F)
)
The line of code to modify camera also has a default configuration that is free to modify:
.withFirstPersonPositioning(
new Transform()
.withPosition(-1.265000f, 4.065000f, -3.085000f)
.withRotation(0.000000f, 1.000000f, 6.300000f)
.withPivotPoint(-0.350000f, -2.900000f, -0.100000f)
.withScale(3.0F, 3.0F, 3.0F)
)
EXPLICACIÓN IMPORTANTE:
The position and rotation of the camera in first person is based on the following graphics:
Rotation: Translation:
Camera rotation in first-person gameplay (the images are very humble :v):
La rotación en X: La rotación de Y: La rotación en Z:
Position/Translation is based on the plane:
The translation in X: The translation in Y: The translation in Z:
Continuing the same code order, to configure the position of the hands the following code order
is needed:
.withFirstPersonHandPositioning(
// Left hand
new Transform()
.withPosition(0.00000f, 0.0000f, 0.00000f)
.withBBRotation(0.0F, 0.0F, 0.0F)
.withScale(0.0F, 0.0F, 0.0F)
.withPivotPoint(0, 0, 0),
// Right hand
new Transform()
.withPosition(0.00000f, 0.0000f, 0.00000f)
.withRotation(0.0F, 0.0F, 0.0F)
.withScale(0.0F, 0.0F, 0.0F)
.withPivotPoint(0, 0, 0),
NOTE: it is recommended/preferable that you use other example configurations to save time
modifying.
Explanation:
- .withBBRotation(0f, 0f, 0f) -> the rotation of the hand based on the Blockbench, that is, its
rotation is as found in the BlockBench.
CONFIGURE THE WEAPON ANIMATION SYSTEM:
To add animation to the mod you must place the following lines of code:
.setupModernAnimations("GunAnimationFileName",
[Link])
.setupModernMagazineAnimations("GunAnimationFileName",
Magazines.NN1Mag,
Magazines.NN2Mag)
The term “NNNAction” or can also be “NNNSlide” depending on what type of weapons you are
creating, accompanies the ejection action system in the animation and the term “NN1Mag” y
“NN2Mag” They will be replaced with the names of the weapons' magazines.
The following line of code is used to make the slide or bullet ejection action port of the weapon
stay back when the weapon is at 0 bullets.
.withFirstPersonCustomPositioning([Link]
(), (renderContext) -> {
if([Link]().getAmmo() == 0) {
[Link](0F, 0F, 1F);
}
})
The term “NNNN” is the name of the weapon which is replaced with “NNNSlide” and
“NNNAction”.
SETTING THE WEAPON AIMING POSITION:
To configure the position of the gun during aiming you need to add the following line of code:
.withFirstPersonPositioningZooming((renderContext) -> {
[Link](3F, 3F, 3F);
[Link](0.0f, 0.0f, 0.0f);
El glScaled() son valores determinados.
To modify the aiming position when you have activated a scope accessory, enter the following
line of code:
if([Link]([Link](),
[Link])) {
[Link](0F, 0.0f, 0.0f);
}
glTranslatef will add over the translation of the previous code.
CONFIGURE GUN POSITION DURING MODIFICATION:
The following line of code is related to the translation of the weapon during the time of
modifying or adding accessories to the weapon in the game, it depends on the type of weapon.
NOTE: The example presented does not apply to all weapons, we recommend that you look
for other examples in the factory files of the other weapons.
.withFirstPersonPositioningModifying((renderContext) -> {
new Transform()
.withPosition(-1.905000f, 4.065000f, -3.645000f)
.withRotation(0.000000f, -30.514396f, -26.062789f)
.withPivotPoint(-0.350000f, -2.900000f, -0.100000f)
.withScale(3.000000f, 3.000000f, 3.000000f)
.applyTransformations();
})
.withFirstPersonPositioningModifyingAlt((renderContext) -> {
new Transform()
.withPosition(-1.425000f, 3.545000f, -5.685000f)
.withRotation(-0.187566f, -46.164037f, -11.869230f)
.withPivotPoint(-0.350000f, -2.900000f, -0.100000f)
.withScale(3.000000f, 3.000000f, 3.000000f)
.applyTransformations();
})
.withFirstPersonHandPositioningModifying(
(renderContext) -> {
// Left Hand
new Transform()
.withPosition(1.730000f, 0.065000f, -0.980000f)
.withRotation(93.414678f, 23.699100f, 15.553163f)
.withScale(2.6F, 2.6F, 4.0F)
.withPivotPoint(0.000000f, 0.000000f, 0.000000f)
.applyTransformations();
},
// Right Hand
(renderContext) -> {
new Transform()
.withPosition(-0.2F, 0.1F, 2)
.withRotation(-5.4027F, -4.7805F, -1.6694F)
.withScale(3.5F, 3.5F, 3.5F)
.withPivotPoint(0, 0, 0)
.applyTransformations();
})
.withFirstPersonHandPositioningModifyingAlt(
(renderContext) -> {
// Left Hand
new Transform()
.withPosition(2.450000f, -0.335000f, -0.660000f)
.withRotation(93.766422f, 50.841130f, 4.679372f)
.withScale(2.600000f, 2.600000f, 4.000000f)
.withPivotPoint(0.000000f, 0.000000f, 0.000000f)
.applyTransformations();
},
// Right Hand
(renderContext) -> {
new Transform()
.withPosition(-0.600000f, 0.340000f, 1.880000f)
.withRotation(-12.193518f, -4.7805F, 1.399459f)
.withScale(3.5F, 3.5F, 3.5F)
.withPivotPoint(0.000000f, 0.000000f, 0.000000f)
.applyTransformations();
})
Explanation:
- .withFirstPersonPositioningModifying -> Used to edit the position of the weapon during
"Attachment Mode"
- .withFirstPersonPositioningModifyingAlt -> Used to edit the position of the weapon during
"Modification Mode"
- .withFirstPersonHandPositioningModifying -> Modify the position of the hands during the
modification of the weapon in "Attachment mode.
- .withFirstPersonHandPositioningModifyingAlt -> Modify the position of the hands during
the modification of the weapon in "Modification Mode"
The following line of code is what will close the configuration of the factory file:
.build())
.withSpawnEntityDamage(0f)
.withSpawnEntityGravityVelocity(0.0118f)
.build([Link]);
}
}
Explanation:
- .withSpawnEntityDamage(0f) -> Used to edit gun damage.
- .withSpawnEntityGravityVelocity(0.0f) -> It is used to add the speed of the bullet.