Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Help with custom armor


skip999
 Share

Recommended Posts

Hello,

I am attempting to create some custom armor, and I have a few questions.

1. I want to modify the way the game calculates the damage dealt to the player when wearing the armor. Essentially, I want to be able to check if the damage dealt is greater than 20 (or "Lethal" if that's an option ideally). I don't know which method I need to override in order to make this possible.

2. I want to be able to craft the armor with an item and "add" that item to the armor. Essentially when the armor is crafted with the item, the item is consumed and it's count in the armor increases. Ideally, I would like this done through the chestplate. How would I go about doing this?

3. I would like to do a custom render model for the armor. I have no idea how to do this as I have never done it before (think draconic evo armor model).

 

 

I would appreciate any and all help that you can give me.

 

Thanks in advance!

Link to comment
Share on other sites

1) For this your best bet is to create a LivingAttackEvent and/or LivingDamageEvent to check the damage received, and also check if the player is wearing your armor. Both events have values for source and amount that can help you determine what to do from a "lethal" attack.

2) What you describe would most easily be enacted as a repair item for your armor, like how the phantom membrane restores elytra. Then each time the durability (or a special durability) is repaired by anvil or crafting, you can increment an NBT value to count how many times it's been repaired.

3) I would take a look at the BipedArmorLayer class for how vanilla armor is rendered. You can then specify that model in the item class with: 

@Nullable
@Override
public <A extends BipedModel<?>> A getArmorModel(LivingEntity entityLiving, ItemStack itemStack, EquipmentSlotType armorSlot, A _default) {
	return (A) new MyArmorModel();
}

and then the texture with something such as:

@Nullable
@Override
public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlotType slot, String type) {
	if(!"overlay".equals(type))
		return "mod_id:textures/models/armor/my_armor.png";
	else {
		return "mod_id:textures/models/armor/my_armor_overlay.png";
	}
}

Hope this helps

Edited by urbanxx001
Link to comment
Share on other sites

I was able to get the even working fairly easily. However, I can't seem to find how to get the amount of damage the attacking source deals. Looking around in eclipse for suggested method calls, I can't find a method that returns what I assume would be an integer representing this.

Assuming an LivingDamangeEvent name "event", I assume it looks something like event.getSource().getDamageAmount(), but that option doesn't exist according to eclipse.

What do I need to call to get this value?

Link to comment
Share on other sites

What I want to have happen is that when the player is wearing my armor and recieves a certain amount of damage in it, then the amount of damage dealt is decreased. What I am concerned about happening is that this will occur along with the vanilla process that handles damage to players in armor, undoing what I want to do. Does that make more sense?

Edited by skip999
Link to comment
Share on other sites

Well what I am trying to do is essentially implement a sort of "ceramic plate" function with the armor. If the player wearing it is in a full suit of it, has a plate in the armor, and is dealt lethal damage (i.e. greater than 20), then the plate "breaks" and the damage is reduced significantly. Otherwise, it behaves like normal armor.

Edited by skip999
Link to comment
Share on other sites

I decided to keep things simple and just do an RightClickEvent for it. As far as a custom render model is concerned, how would I go about implementing it. I know Urban mentioned BipedArmorLayer, but how would I go about ensuring my overrides are called in rendering?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Well, basically every time I open my minecraft to play, this message pops up: I miss playing my game ;-;. I've been trying to solve it for days but I don't know about it. I'll show you the complicated stuff.   Time: 18/01/2022 20:08 Description: Rendering overlay net.minecraftforge.fml.config.ConfigFileTypeHandler$ConfigLoadingException: Failed loading config file forge-common.toml of type COMMON for modid forge     at net.minecraftforge.fml.config.ConfigFileTypeHandler.lambda$reader$1(ConfigFileTypeHandler.java:61) ~[fmlcore-1.17.1-37.1.1.jar%2382!:?] {}     at net.minecraftforge.fml.config.ConfigTracker.openConfig(ConfigTracker.java:74) ~[fmlcore-1.17.1-37.1.1.jar%2382!:?] {}     at net.minecraftforge.fml.config.ConfigTracker.lambda$loadConfigs$1(ConfigTracker.java:64) ~[fmlcore-1.17.1-37.1.1.jar%2382!:?] {}     at java.lang.Iterable.forEach(Iterable.java:75) ~[?:?] {}     at java.util.Collections$SynchronizedCollection.forEach(Collections.java:2093) ~[?:?] {}     at net.minecraftforge.fml.config.ConfigTracker.loadConfigs(ConfigTracker.java:64) ~[fmlcore-1.17.1-37.1.1.jar%2382!:?] {}     at net.minecraftforge.fml.core.ModStateProvider.lambda$new$3(ModStateProvider.java:48) ~[forge-1.17.1-37.1.1-universal.jar%2385!:?] {re:classloading}     at net.minecraftforge.fml.ModLoader.lambda$dispatchAndHandleError$20(ModLoader.java:200) ~[fmlcore-1.17.1-37.1.1.jar%2382!:?] {}     at java.util.Optional.ifPresent(Optional.java:178) ~[?:?] {}     at net.minecraftforge.fml.ModLoader.dispatchAndHandleError(ModLoader.java:200) ~[fmlcore-1.17.1-37.1.1.jar%2382!:?] {}     at net.minecraftforge.fml.ModLoader.lambda$loadMods$14(ModLoader.java:184) ~[fmlcore-1.17.1-37.1.1.jar%2382!:?] {}     at java.lang.Iterable.forEach(Iterable.java:75) ~[?:?] {}     at net.minecraftforge.fml.ModLoader.loadMods(ModLoader.java:184) ~[fmlcore-1.17.1-37.1.1.jar%2382!:?] {}     at net.minecraftforge.fmlclient.ClientModLoader.lambda$startModLoading$5(ClientModLoader.java:138) ~[forge-1.17.1-37.1.1-universal.jar%2385!:?] {re:classloading,pl:runtimedistcleaner:A}     at net.minecraftforge.fmlclient.ClientModLoader.lambda$createRunnableWithCatch$4(ClientModLoader.java:129) ~[forge-1.17.1-37.1.1-universal.jar%2385!:?] {re:classloading,pl:runtimedistcleaner:A}     at net.minecraftforge.fmlclient.ClientModLoader.startModLoading(ClientModLoader.java:138) ~[forge-1.17.1-37.1.1-universal.jar%2385!:?] {re:classloading,pl:runtimedistcleaner:A}     at net.minecraftforge.fmlclient.ClientModLoader.lambda$onResourceReload$2(ClientModLoader.java:120) ~[forge-1.17.1-37.1.1-universal.jar%2385!:?] {re:classloading,pl:runtimedistcleaner:A}     at net.minecraftforge.fmlclient.ClientModLoader.lambda$createRunnableWithCatch$4(ClientModLoader.java:129) ~[forge-1.17.1-37.1.1-universal.jar%2385!:?] {re:classloading,pl:runtimedistcleaner:A}     at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1800) ~[?:?] {}     at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1792) ~[?:?] {}     at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:295) ~[?:?] {}     at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1016) ~[?:?] {}     at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1665) ~[?:?] {}     at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1598) ~[?:?] {}     at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183) ~[?:?] {} Caused by: com.electronwill.nightconfig.core.io.ParsingException: Not enough data available     at com.electronwill.nightconfig.core.io.ParsingException.notEnoughData(ParsingException.java:22) ~[core-3.6.3.jar%237!:?] {}     at com.electronwill.nightconfig.core.io.ReaderInput.directReadChar(ReaderInput.java:36) ~[core-3.6.3.jar%237!:?] {}     at com.electronwill.nightconfig.core.io.AbstractInput.readChar(AbstractInput.java:49) ~[core-3.6.3.jar%237!:?] {}     at com.electronwill.nightconfig.core.io.AbstractInput.readCharsUntil(AbstractInput.java:123) ~[core-3.6.3.jar%237!:?] {}     at com.electronwill.nightconfig.toml.TableParser.parseKey(TableParser.java:166) ~[toml-3.6.3.jar%238!:?] {}     at com.electronwill.nightconfig.toml.TableParser.parseDottedKey(TableParser.java:145) ~[toml-3.6.3.jar%238!:?] {}     at com.electronwill.nightconfig.toml.TableParser.parseNormal(TableParser.java:55) ~[toml-3.6.3.jar%238!:?] {}     at com.electronwill.nightconfig.toml.TomlParser.parse(TomlParser.java:44) ~[toml-3.6.3.jar%238!:?] {}     at com.electronwill.nightconfig.toml.TomlParser.parse(TomlParser.java:37) ~[toml-3.6.3.jar%238!:?] {}     at com.electronwill.nightconfig.core.io.ConfigParser.parse(ConfigParser.java:113) ~[core-3.6.3.jar%237!:?] {}     at com.electronwill.nightconfig.core.io.ConfigParser.parse(ConfigParser.java:219) ~[core-3.6.3.jar%237!:?] {}     at com.electronwill.nightconfig.core.io.ConfigParser.parse(ConfigParser.java:202) ~[core-3.6.3.jar%237!:?] {}     at com.electronwill.nightconfig.core.file.WriteSyncFileConfig.load(WriteSyncFileConfig.java:73) ~[core-3.6.3.jar%237!:?] {}     at com.electronwill.nightconfig.core.file.AutosaveCommentedFileConfig.load(AutosaveCommentedFileConfig.java:85) ~[core-3.6.3.jar%237!:?] {}     at net.minecraftforge.fml.config.ConfigFileTypeHandler.lambda$reader$1(ConfigFileTypeHandler.java:57) ~[fmlcore-1.17.1-37.1.1.jar%2382!:?] {}     ... 24 more A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Render thread Stacktrace:     at net.minecraftforge.fml.config.ConfigFileTypeHandler.lambda$reader$1(ConfigFileTypeHandler.java:61) ~[fmlcore-1.17.1-37.1.1.jar%2382!:?] {}     at net.minecraftforge.fml.config.ConfigTracker.openConfig(ConfigTracker.java:74) ~[fmlcore-1.17.1-37.1.1.jar%2382!:?] {}     at net.minecraftforge.fml.config.ConfigTracker.lambda$loadConfigs$1(ConfigTracker.java:64) ~[fmlcore-1.17.1-37.1.1.jar%2382!:?] {}     at java.lang.Iterable.forEach(Iterable.java:75) ~[?:?] {}     at java.util.Collections$SynchronizedCollection.forEach(Collections.java:2093) ~[?:?] {}     at net.minecraftforge.fml.config.ConfigTracker.loadConfigs(ConfigTracker.java:64) ~[fmlcore-1.17.1-37.1.1.jar%2382!:?] {}     at net.minecraftforge.fml.core.ModStateProvider.lambda$new$3(ModStateProvider.java:48) ~[forge-1.17.1-37.1.1-universal.jar%2385!:?] {re:classloading}     at net.minecraftforge.fml.ModLoader.lambda$dispatchAndHandleError$20(ModLoader.java:200) ~[fmlcore-1.17.1-37.1.1.jar%2382!:?] {} -- Overlay render details -- Details:     Overlay name: net.minecraft.client.gui.screens.LoadingOverlay Stacktrace:     at net.minecraft.client.renderer.GameRenderer.m_109093_(GameRenderer.java:877) ~[client-1.17.1-20210706.113038-srg.jar%2381!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}     at net.minecraft.client.Minecraft.m_91383_(Minecraft.java:1039) ~[client-1.17.1-20210706.113038-srg.jar%2381!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}     at net.minecraft.client.Minecraft.m_91374_(Minecraft.java:659) ~[client-1.17.1-20210706.113038-srg.jar%2381!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}     at net.minecraft.client.main.Main.main(Main.java:186) ~[client-1.17.1-20210706.113038-srg.jar%2381!:?] {re:classloading,pl:runtimedistcleaner:A}     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) ~[?:?] {}     at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}     at java.lang.reflect.Method.invoke(Method.java:567) ~[?:?] {}     at net.minecraftforge.fml.loading.targets.CommonClientLaunchHandler.lambda$launchService$0(CommonClientLaunchHandler.java:45) ~[fmlloader-1.17.1-37.1.1.jar%2323!:?] {}     at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-9.0.7.jar%235!:?] {}     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-9.0.7.jar%235!:?] {}     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-9.0.7.jar%235!:?] {}     at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-9.0.7.jar%235!:?] {}     at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-9.0.7.jar%235!:?] {}     at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-9.0.7.jar%235!:?] {}     at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-9.0.7.jar%235!:?] {}     at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:90) [bootstraplauncher-0.1.17.jar:?] {} -- Last reload -- Details:     Reload number: 1     Reload reason: initial     Finished: No     Packs: Mod Resources, Default -- System Details -- Details:     Minecraft Version: 1.17.1     Minecraft Version ID: 1.17.1     Operating System: Windows 10 (amd64) version 10.0     Java Version: 16.0.1, Microsoft     Java VM Version: OpenJDK 64-Bit Server VM (mixed mode), Microsoft     Memory: 720146952 bytes (686 MiB) / 1375731712 bytes (1312 MiB) up to 2147483648 bytes (2048 MiB)     CPUs: 4     Processor Vendor: GenuineIntel     Processor Name: Intel(R) Core(TM) i5-7300HQ CPU @ 2.50GHz     Identifier: Intel64 Family 6 Model 158 Stepping 9     Microarchitecture: Kaby Lake     Frequency (GHz): 2,50     Number of physical packages: 1     Number of physical CPUs: 4     Number of logical CPUs: 4     Graphics card #0 name: NVIDIA GeForce GTX 1050     Graphics card #0 vendor: NVIDIA (0x10de)     Graphics card #0 VRAM (MB): 4095,00     Graphics card #0 deviceId: 0x1c8d     Graphics card #0 versionInfo: DriverVersion=27.21.14.5167     Graphics card #1 name: Intel(R) HD Graphics 630     Graphics card #1 vendor: Intel Corporation (0x8086)     Graphics card #1 VRAM (MB): 1024,00     Graphics card #1 deviceId: 0x591b     Graphics card #1 versionInfo: DriverVersion=27.20.100.9664     Memory slot #0 capacity (MB): 8192,00     Memory slot #0 clockSpeed (GHz): 2,40     Memory slot #0 type: DDR4     Virtual memory max (MB): 16033,20     Virtual memory used (MB): 7939,68     Swap memory total (MB): 10240,00     Swap memory used (MB): 382,97     JVM Flags: 9 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xss1M -Xmx2G -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M     Launched Version: 1.17.1-forge-37.1.1     Backend library: LWJGL version 3.2.2 SNAPSHOT     Backend API: Intel(R) HD Graphics 630 GL version 3.2.0 - Build 27.20.100.9664, Intel     Window size: 854x480     GL Caps: Using framebuffer using OpenGL 3.2     GL debug messages:      Using VBOs: Yes     Is Modded: Definitely; Client brand changed to 'forge'     Type: Client (map_client.txt)     Graphics mode: fast     Resource Packs: vanilla     Current Language: English (US)     CPU: 4x Intel(R) Core(TM) i5-7300HQ CPU @ 2.50GHz     ModLauncher: 9.0.7+91+master.8569cdf     ModLauncher launch target: forgeclient     ModLauncher naming: srg     ModLauncher services:           mixin PLUGINSERVICE           eventbus PLUGINSERVICE           object_holder_definalize PLUGINSERVICE           runtime_enum_extender PLUGINSERVICE           capability_token_subclass PLUGINSERVICE           capability_inject_definalize PLUGINSERVICE           accesstransformer PLUGINSERVICE           runtimedistcleaner PLUGINSERVICE           mixin TRANSFORMATIONSERVICE           fml TRANSFORMATIONSERVICE      FML Language Providers:          minecraft@1.0         javafml@null     Mod List:          client-1.17.1-20210706.113038-srg.jar             |Minecraft                     |minecraft                     |1.17.1              |COMMON_SET|Manifest: a1:d4:5e:04:4f:d3:d6:e0:7b:37:97:cf:77:b0:de:ad:4a:47:ce:8c:96:49:5f:0a:cf:8c:ae:b2:6d:4b:8a:3f         Serene Seasons (Temporadas da vida real no Minecra|Serene Seasons                |sereneseasons                 |1.17.1-5.0.0.7      |COMMON_SET|Manifest: NOSIGNATURE         Lajes Duplas.jar                                  |Double Slabs                  |doubleslabs                   |4.0.0               |COMMON_SET|Manifest: NOSIGNATURE         Placa de sinalização.jar                          |Signpost                      |signpost                      |1.17.1-2.00.4       |COMMON_SET|Manifest: NOSIGNATURE         Domador de animais.jar                            |Animal Tamer                  |rabbit_tamer                  |1.0                 |COMMON_SET|Manifest: NOSIGNATURE         Cinto de ferramentas.jar                          |Tool Belt                     |toolbelt                      |1.17.3              |COMMON_SET|Manifest: NOSIGNATURE         Portas da Arara.jar                               |Macaw's Doors                 |mcwdoors                      |1.0.5               |COMMON_SET|Manifest: NOSIGNATURE         Catálogo.jar                                      |Catalogue                     |catalogue                     |1.5.0               |COMMON_SET|Manifest: NOSIGNATURE         Apenas itens suficientes (JEI).jar                |Just Enough Items             |jei                           |8.3.1.62            |COMMON_SET|Manifest: NOSIGNATURE         Encantamento floral.jar                           |Floral Enchantment            |floralench                    |1.17.1-1.3.1        |COMMON_SET|Manifest: NOSIGNATURE         Flores com sementes.jar                           |Flower Seeds                  |flowerseeds                   |1.17.1-2.0.0        |COMMON_SET|Manifest: NOSIGNATURE         janelas de arara.jar                              |Macaw's Windows               |mcwwindows                    |2.0.2               |COMMON_SET|Manifest: NOSIGNATURE         forge-1.17.1-37.1.1-universal.jar                 |Forge                         |forge                         |37.1.1              |COMMON_SET|Manifest: 22:af:21:d8:19:82:7f:93:94:fe:2b:ac:b7:e4:41:57:68:39:87:b1:a7:5c:c6:44:f9:25:74:21:14:f5:0d:90         AppleSkin.jar                                     |AppleSkin                     |appleskin                     |2.2.0               |COMMON_SET|Manifest: NOSIGNATURE         Aldeões fáceis.jar                                |Easy Villagers                |easy_villagers                |1.17.1-1.0.9        |COMMON_SET|Manifest: NOSIGNATURE         Painel no vidro.jar                               |Pane In The Glass             |pitg                          |1.17.1-2.0.1        |COMMON_SET|Manifest: NOSIGNATURE         Deterioração Rápida das Folhas.jar                |FastLeafDecay                 |fastleafdecay                 |26.2                |COMMON_SET|Manifest: NOSIGNATURE         Acorrentado.jar                                   |Leashed                       |leashed                       |1.2.2               |COMMON_SET|Manifest: NOSIGNATURE         Baús de Ferro.jar                                 |Iron Chests                   |ironchest                     |1.17.1-12.0.2       |COMMON_SET|Manifest: NOSIGNATURE         Apenas mais um mod de carne podre para couro.jar  |JRFTL                         |jrftl                         |1.3                 |COMMON_SET|Manifest: NOSIGNATURE         Sentar em lajes e escadas como cadeiras.jar       |Sit                           |sit                           |1.3.1               |COMMON_SET|Manifest: NOSIGNATURE     Crash Report UUID: aff87ccb-2016-45da-9ffc-a5768134151b     FML: 37.1     Forge: net.minecraftforge:37.1.1
    • That did not work  https://pastebin.com/zcgLR8gj that is the new report
    • Input Parameters:  java -Xmx8G -Xms2G -jar forge-1.16.5-36.2.23.jar Error output: https://pastebin.com/HNKzcptd Java Version: 1.8.0_321 Above error is received when attempting to launch forge server. Server is launched using parameters above, log file contains the same output as above so it was not included. Any assistance with this issue is greatly appreciated!
    • i dont understad i click in the lock icon but it says  connection is secure cookies  site settings  which one do i choose
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.