<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.dragonminez.com/pt/wiki/Implementation_and_Events?action=history&amp;feed=atom</id>
	<title>Implementation and Events/pt - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.dragonminez.com/pt/wiki/Implementation_and_Events?action=history&amp;feed=atom"/>
	<link rel="alternate" type="text/html" href="https://wiki.dragonminez.com/pt/wiki/Implementation_and_Events?action=history"/>
	<updated>2026-10-25T13:03:08Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>https://wiki.dragonminez.com/pt/wiki/Implementation_and_Events?diff=37052&amp;oldid=prev</id>
		<title>Shokkoh: Translation sync from dragonminez-wiki repository</title>
		<link rel="alternate" type="text/html" href="https://wiki.dragonminez.com/pt/wiki/Implementation_and_Events?diff=37052&amp;oldid=prev"/>
		<updated>2026-10-14T07:01:28Z</updated>

		<summary type="html">&lt;p&gt;Translation sync from dragonminez-wiki repository&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Nova página&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;Implementação e eventos&amp;#039;&amp;#039;&amp;#039; descreve a superfície de hooks que o DragonMineZ oferece aos addons: seus eventos, como ler o estado do jogador, os registros de extensão e onde conectar sua própria rede e seus próprios registros. Leia quando seu addon já compilar contra o DMZ (veja [[Special:MyLanguage/Add-on Getting Started|Primeiros passos com addons]]).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Listening_to_a_DMZ_event&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Escutar um evento do DMZ ==&lt;br /&gt;
Todos os eventos de servidor e comuns são classes estáticas aninhadas de &amp;lt;code&amp;gt;com.dragonminez.common.events.DMZEvent&amp;lt;/code&amp;gt;, publicadas no barramento de eventos padrão do Forge (&amp;lt;code&amp;gt;MinecraftForge.EVENT_BUS&amp;lt;/code&amp;gt;). Cada classe aninhada estende diretamente o &amp;lt;code&amp;gt;Event&amp;lt;/code&amp;gt; do Forge (o próprio &amp;lt;code&amp;gt;DMZEvent&amp;lt;/code&amp;gt; é só o contêiner), então inscreva-se na classe aninhada específica:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
@Mod.EventBusSubscriber(modid = &amp;quot;your_addon_modid&amp;quot;, bus = Mod.EventBusSubscriber.Bus.FORGE)&lt;br /&gt;
public class DmzHooks {&lt;br /&gt;
    @SubscribeEvent&lt;br /&gt;
    public static void onTpGain(DMZEvent.TPGainEvent event) {&lt;br /&gt;
        int boosted = Math.round(event.getTpGain() * 1.10f);&lt;br /&gt;
        event.setTpGain(boosted);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    @SubscribeEvent&lt;br /&gt;
    public static void onFormChange(DMZEvent.FormChangeEvent event) {&lt;br /&gt;
        if (event.isTransform()) {&lt;br /&gt;
            // player transformed into event.getNewGroup() / event.getNewForm()&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Os eventos marcados abaixo como &amp;#039;&amp;#039;&amp;#039;canceláveis&amp;#039;&amp;#039;&amp;#039; têm a anotação &amp;lt;code&amp;gt;@Cancelable&amp;lt;/code&amp;gt; do Forge: &amp;lt;code&amp;gt;event.setCanceled(true)&amp;lt;/code&amp;gt; bloqueia a ação subjacente. Os campos marcados como &amp;#039;&amp;#039;editáveis&amp;#039;&amp;#039; têm um setter (&amp;lt;code&amp;gt;setTpGain&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setAmount&amp;lt;/code&amp;gt;, ...), e o DMZ usa o valor resultante depois que todos os listeners rodam. Todos os getters seguem os nomes dos campos (&amp;lt;code&amp;gt;getPlayer()&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getOldValue()&amp;lt;/code&amp;gt;, ...); campos booleanos usam &amp;lt;code&amp;gt;is...&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;isParry()&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;isBlocked()&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Event_list&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Lista de eventos ==&lt;br /&gt;
Origem: &amp;lt;code&amp;gt;src/main/java/com/dragonminez/common/events/DMZEvent.java&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Stats,_resources_and_progression&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Estatísticas, recursos e progresso ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Evento !! Cancelável !! Disparado quando !! Campos principais&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;StatChangeEvent&amp;lt;/code&amp;gt; || Sim || Uma estatística (STR, SKP, RES, VIT, PWR ou ENE) muda por uma chamada a &amp;lt;code&amp;gt;Stats.set*()&amp;lt;/code&amp;gt;: comandos, itens, menus, e também quando as estatísticas são carregadas ou copiadas (tanto no servidor quanto no cliente). || &amp;lt;code&amp;gt;player&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;stat&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;STRENGTH&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;STRIKE_POWER&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;RESISTANCE&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;VITALITY&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;KI_POWER&amp;lt;/code&amp;gt; ou &amp;lt;code&amp;gt;ENERGY&amp;lt;/code&amp;gt;), &amp;lt;code&amp;gt;oldValue&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;newValue&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;TPGainEvent&amp;lt;/code&amp;gt; || Sim || Antes que uma quantidade positiva de pontos de treino seja adicionada (&amp;lt;code&amp;gt;Resources.addTrainingPoints&amp;lt;/code&amp;gt;). || &amp;lt;code&amp;gt;player&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;oldValue&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;tpGain&amp;lt;/code&amp;gt; (editável), &amp;lt;code&amp;gt;shareWithParty&amp;lt;/code&amp;gt; (editável); auxiliar &amp;lt;code&amp;gt;getNewTpsValue()&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;KiChargeEvent&amp;lt;/code&amp;gt; || Sim || Uma vez por segundo enquanto o jogador está carregando ki ativamente. Cancele-o para impedir o ganho de ki daquele segundo. || &amp;lt;code&amp;gt;player&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;currentEnergy&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;maxEnergy&amp;lt;/code&amp;gt;; auxiliar &amp;lt;code&amp;gt;isEnergyFull()&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;HealthRegenEvent&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;EnergyRegenEvent&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;StaminaRegenEvent&amp;lt;/code&amp;gt; || Sim || Antes de aplicar a regeneração por segundo de vida, ki ou estâmina. Eles compartilham a base &amp;lt;code&amp;gt;ResourceRegenEvent&amp;lt;/code&amp;gt;. || &amp;lt;code&amp;gt;player&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;statsData&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;amount&amp;lt;/code&amp;gt; (editável)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;FormChangeEvent&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;StackFormChangeEvent&amp;lt;/code&amp;gt; || Não || Depois que a forma de raça ou a forma acumulável do jogador muda (lado do servidor). || &amp;lt;code&amp;gt;player&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;oldGroup&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;oldForm&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;newGroup&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;newForm&amp;lt;/code&amp;gt;; auxiliares &amp;lt;code&amp;gt;isTransform()&amp;lt;/code&amp;gt; e &amp;lt;code&amp;gt;isUntransform()&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;PlayerDataSaveEvent&amp;lt;/code&amp;gt; || Não || Os dados do jogador estão prestes a ser gravados no backend de armazenamento &amp;lt;code&amp;gt;JSON&amp;lt;/code&amp;gt; ou &amp;lt;code&amp;gt;DATABASE&amp;lt;/code&amp;gt;. Você pode adicionar suas próprias chaves a &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt;. || &amp;lt;code&amp;gt;player&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;PlayerDataLoadEvent&amp;lt;/code&amp;gt; || Não || Os dados do jogador foram lidos do backend &amp;lt;code&amp;gt;JSON&amp;lt;/code&amp;gt; ou &amp;lt;code&amp;gt;DATABASE&amp;lt;/code&amp;gt;, logo antes de serem aplicados ao jogador. || &amp;lt;code&amp;gt;player&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{Note|title=StatChangeEvent e o carregamento de dados|text=&amp;lt;code&amp;gt;StatChangeEvent&amp;lt;/code&amp;gt; também é disparado enquanto o DMZ carrega os dados salvos e aplica as sincronizações do cliente. Se você cancelá-lo, verifique antes &amp;lt;code&amp;gt;event.getPlayer().level().isClientSide()&amp;lt;/code&amp;gt; e suas próprias condições, ou pode impedir que as estatísticas salvas de um jogador sejam carregadas.}}&lt;br /&gt;
&lt;br /&gt;
{{Note|title=Backends de armazenamento|text=&amp;lt;code&amp;gt;PlayerDataSaveEvent&amp;lt;/code&amp;gt; e &amp;lt;code&amp;gt;PlayerDataLoadEvent&amp;lt;/code&amp;gt; não são disparados com o backend &amp;lt;code&amp;gt;NBT&amp;lt;/code&amp;gt; padrão, em que o vanilla salva os dados do DMZ junto com o arquivo do jogador. Veja [[Special:MyLanguage/General Server Config|Configuração do servidor]] para as opções de &amp;lt;code&amp;gt;storage&amp;lt;/code&amp;gt;.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Combat&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Combate ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Evento !! Cancelável !! Disparado quando !! Campos principais&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;DamageModifyEvent&amp;lt;/code&amp;gt; || Sim || Cálculo do dano antes da mitigação, para um golpe dado por um jogador (golpes corpo a corpo e Ataques de Golpe). Cancele-o para não causar dano do DMZ. || &amp;lt;code&amp;gt;attacker&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;victim&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;amount&amp;lt;/code&amp;gt; (editável), &amp;lt;code&amp;gt;defensePenetration&amp;lt;/code&amp;gt; (editável), &amp;lt;code&amp;gt;sourceType&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;MELEE&amp;lt;/code&amp;gt; ou &amp;lt;code&amp;gt;STRIKE&amp;lt;/code&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;DamageDealtEvent&amp;lt;/code&amp;gt; || Não || Depois que o bloqueio de um golpe corpo a corpo de um jogador é resolvido (quantidade antes da mitigação). || &amp;lt;code&amp;gt;attacker&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;victim&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;amount&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;blocked&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;parried&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;sourceType&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;PlayerDamageMitigatedEvent&amp;lt;/code&amp;gt; || Não || Depois que o DMZ termina de mitigar um golpe recebido por um jogador. Somente leitura: não altere o dano aqui. || &amp;lt;code&amp;gt;victim&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;source&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;DamageSource&amp;lt;/code&amp;gt;), &amp;lt;code&amp;gt;rawDamage&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;defenseMitigated&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;blockMitigated&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;finalDamage&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;PlayerBlockEvent&amp;lt;/code&amp;gt; || Sim || O jogador bloqueia ou faz parry de um ataque com sucesso. Cancele-o e o jogador recebe o golpe inteiro. || &amp;lt;code&amp;gt;victim&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;attacker&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;originalDamage&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;finalDamage&amp;lt;/code&amp;gt; (editável), &amp;lt;code&amp;gt;isParry&amp;lt;/code&amp;gt; (editável), &amp;lt;code&amp;gt;poiseDamage&amp;lt;/code&amp;gt; (editável)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;BarrierAbsorbEvent&amp;lt;/code&amp;gt; || Não || Uma barreira de ki (a técnica de barreira ou a barreira dos Androides) absorve um golpe antes que ele chegue à entidade protegida. || &amp;lt;code&amp;gt;owner&amp;lt;/code&amp;gt; (quem criou a barreira), &amp;lt;code&amp;gt;protectedEntity&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;attacker&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;amount&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;PlayerDashEvent&amp;lt;/code&amp;gt; || Sim || Antes que uma esquiva seja executada. || &amp;lt;code&amp;gt;player&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;dashType&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;NORMAL&amp;lt;/code&amp;gt; ou &amp;lt;code&amp;gt;DOUBLE&amp;lt;/code&amp;gt;), &amp;lt;code&amp;gt;distance&amp;lt;/code&amp;gt; (editável), &amp;lt;code&amp;gt;kiCost&amp;lt;/code&amp;gt; (editável)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;PlayerEvasionEvent&amp;lt;/code&amp;gt; || Sim || Antes que uma evasão seja ativada. || &amp;lt;code&amp;gt;player&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;attacker&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;originalDamage&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;kiCost&amp;lt;/code&amp;gt; (editável)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;CritChanceEvent&amp;lt;/code&amp;gt; || Não || Enquanto a chance crítica de um jogador é calculada. || &amp;lt;code&amp;gt;player&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;chance&amp;lt;/code&amp;gt; (editável, de 0 a 1)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;KiAttackCastEvent&amp;lt;/code&amp;gt; || Não || Um jogador começa a carregar (lança) um ataque de ki. || &amp;lt;code&amp;gt;player&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;statsData&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;kiAttack&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;KiAttackFireEvent&amp;lt;/code&amp;gt; || Não || Um ataque de ki carregado é disparado. || &amp;lt;code&amp;gt;player&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;statsData&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;kiAttack&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;chargeMultiplier&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;cooldownTicks&amp;lt;/code&amp;gt; (editável, mínimo 1)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;StrikeAttackCastEvent&amp;lt;/code&amp;gt; || Não || Um jogador inicia um Ataque de Golpe. || &amp;lt;code&amp;gt;player&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;statsData&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;strike&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;StrikeAttackFireEvent&amp;lt;/code&amp;gt; || Não || Um Ataque de Golpe acerta e começa sobre um alvo. || &amp;lt;code&amp;gt;player&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;statsData&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;strike&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;target&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;DamageSourceType&amp;lt;/code&amp;gt; também contém um valor &amp;lt;code&amp;gt;KI&amp;lt;/code&amp;gt;; na v2.2, os ataques de ki não publicam &amp;lt;code&amp;gt;DamageModifyEvent&amp;lt;/code&amp;gt; nem &amp;lt;code&amp;gt;DamageDealtEvent&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Fusions_and_dragons&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Fusões e dragões ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Evento !! Cancelável !! Disparado quando !! Campos principais&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;FusionEvent&amp;lt;/code&amp;gt; || Sim || Antes de uma tentativa de fusão. O DMZ o publica para as fusões &amp;lt;code&amp;gt;METAMORU&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;POTHALA&amp;lt;/code&amp;gt; e &amp;lt;code&amp;gt;BEETLE&amp;lt;/code&amp;gt; (Besouro Medi-Bug); o enum também contém &amp;lt;code&amp;gt;ABSORPTION&amp;lt;/code&amp;gt; e &amp;lt;code&amp;gt;ASSIMILATION&amp;lt;/code&amp;gt;. || &amp;lt;code&amp;gt;initiator&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;target&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;type&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;DragonSummonedEvent&amp;lt;/code&amp;gt; || Não || Depois que um dragão é invocado com um conjunto de esferas completo. || &amp;lt;code&amp;gt;player&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;level&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;position&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;dragonDefinition&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;ballSetDefinition&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;consumedPositions&amp;lt;/code&amp;gt;; auxiliares &amp;lt;code&amp;gt;getDragonId()&amp;lt;/code&amp;gt; e &amp;lt;code&amp;gt;getBallSetId()&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Veja [[Special:MyLanguage/Fusions|Fusões]] e [[Special:MyLanguage/Dragons and Wishes|Dragões e desejos]] para a parte de jogabilidade.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Quests&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Missões ===&lt;br /&gt;
Todos os eventos de missões estendem &amp;lt;code&amp;gt;QuestLifecycleEvent&amp;lt;/code&amp;gt; e compartilham seus campos: &amp;lt;code&amp;gt;player&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;questKey&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;sagaId:questId&amp;lt;/code&amp;gt; para missões de saga, o id em texto para missões secundárias), &amp;lt;code&amp;gt;saga&amp;lt;/code&amp;gt; (null para missões secundárias), &amp;lt;code&amp;gt;quest&amp;lt;/code&amp;gt; e &amp;lt;code&amp;gt;partyMembers&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Evento !! Cancelável !! Disparado quando !! Campos extras&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;QuestStartEvent&amp;lt;/code&amp;gt; || Sim || Antes que uma missão seja aceita. || &amp;lt;code&amp;gt;difficulty&amp;lt;/code&amp;gt; (editável)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;QuestObjectiveProgressEvent&amp;lt;/code&amp;gt; || Sim || Antes que o progresso de um objetivo seja salvo. || &amp;lt;code&amp;gt;objectiveIndex&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;oldProgress&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;newProgress&amp;lt;/code&amp;gt; (editável), &amp;lt;code&amp;gt;objectiveRequired&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;QuestFailEvent&amp;lt;/code&amp;gt; || Sim || Antes que uma missão seja marcada como falha. || &amp;lt;code&amp;gt;reason&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;PLAYER_DEATH&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;FORCED_RESET&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;SCRIPT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;TIME_EXPIRED&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;ESCORT_FAILED&amp;lt;/code&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;QuestTurnInEvent&amp;lt;/code&amp;gt; || Sim || Antes que a entrega de uma missão seja aplicada. || &amp;lt;code&amp;gt;npcId&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;QuestRewardClaimEvent&amp;lt;/code&amp;gt; || Sim || Antes que uma recompensa individual seja resgatada. || &amp;lt;code&amp;gt;rewardIndex&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;QuestCompletedEvent&amp;lt;/code&amp;gt; || Não || Quando uma missão é concluída. || Só os campos compartilhados&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Client_events&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Eventos de cliente ===&lt;br /&gt;
Os eventos só de cliente ficam em &amp;lt;code&amp;gt;com.dragonminez.client.events.DMZClientEvent&amp;lt;/code&amp;gt; e são publicados no barramento do Forge do cliente físico. Registre esses listeners com &amp;lt;code&amp;gt;value = Dist.CLIENT&amp;lt;/code&amp;gt;. Nenhum deles é cancelável e eles são apenas informativos: o servidor continua decidindo o que de fato acontece.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Evento !! Disparado quando !! Campos principais&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;PlayerAttackStart&amp;lt;/code&amp;gt; || O jogador local começa a preparação do ataque. || &amp;lt;code&amp;gt;player&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;attackHand&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;PlayerAttackHit&amp;lt;/code&amp;gt; || O ataque do jogador local resolve seus alvos (zero ou mais). || &amp;lt;code&amp;gt;player&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;attackHand&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;targets&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;cursorTarget&amp;lt;/code&amp;gt; (pode ser null)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;KiAttackCast&amp;lt;/code&amp;gt; || O jogador local começa a carregar o ataque de ki de um slot. || &amp;lt;code&amp;gt;player&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;slot&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;KiAttackRelease&amp;lt;/code&amp;gt; || O jogador local dispara um ataque de ki carregado. || &amp;lt;code&amp;gt;player&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;StrikeAttack&amp;lt;/code&amp;gt; || O jogador local inicia um Ataque de Golpe. || &amp;lt;code&amp;gt;player&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;targetId&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Reading_player_state&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Ler o estado do jogador ==&lt;br /&gt;
Obtenha a capability de qualquer &amp;lt;code&amp;gt;Player&amp;lt;/code&amp;gt; (um jogador do servidor, ou o jogador local no cliente; o DMZ mantém a cópia do cliente sincronizada):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
StatsProvider.get(StatsCapability.INSTANCE, player).ifPresent(data -&amp;gt; {&lt;br /&gt;
    String race = data.getCharacter().getRaceName();&lt;br /&gt;
    String activeForm = data.getCharacter().getActiveForm();&lt;br /&gt;
    float currentKi = data.getResources().getCurrentEnergy();&lt;br /&gt;
    float maxKi = data.getMaxEnergy();&lt;br /&gt;
    int level = data.getLevel();&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;StatsProvider.get(cap, entity)&amp;lt;/code&amp;gt; é um atalho para &amp;lt;code&amp;gt;player.getCapability(StatsCapability.INSTANCE)&amp;lt;/code&amp;gt;; os dois retornam um &amp;lt;code&amp;gt;LazyOptional&amp;lt;StatsData&amp;gt;&amp;lt;/code&amp;gt;. Os getters do DMZ são gerados pelo Lombok em tempo de compilação, então você não precisa do Lombok no seu addon para chamá-los.&lt;br /&gt;
&lt;br /&gt;
Leituras úteis de &amp;lt;code&amp;gt;StatsData&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Getter !! Retorna&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getCharacter().getRaceName() / getCharacterClass() / getGender()&amp;lt;/code&amp;gt; || Raça, classe e gênero&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getCharacter().getActiveForm() / getActiveFormGroup()&amp;lt;/code&amp;gt; || Forma de raça atual (um texto vazio na forma base)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getCharacter().getActiveStackForm() / getActiveStackFormGroup()&amp;lt;/code&amp;gt; || Forma acumulável atual (por exemplo, o nível de Kaioken)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getStats().getStrength() / getStrikePower() / getResistance() / getVitality() / getKiPower() / getEnergy()&amp;lt;/code&amp;gt; || Valores base das estatísticas&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getResources().getCurrentEnergy() / getCurrentStamina() / getCurrentPoise() / getAlignment()&amp;lt;/code&amp;gt; || Reservas de recursos atuais e índole&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getMaxHealth() / getMaxEnergy() / getMaxStamina() / getMaxPoise()&amp;lt;/code&amp;gt; || Limites de recursos calculados&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getBattlePower() / getMeleeDamage() / getStrikeDamage() / getKiDamage() / getDefense()&amp;lt;/code&amp;gt; || Estatísticas de combate calculadas&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getLevel()&amp;lt;/code&amp;gt; || Nível de jogador calculado&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getPlayerQuestData()&amp;lt;/code&amp;gt; || Progresso de missões (&amp;lt;code&amp;gt;getQuestStatus(questKey)&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;isQuestAccepted(questKey)&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;isQuestCompleted(questKey)&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;isSagaLocked(sagaId)&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getTrackedQuestId()&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getDifficulty()&amp;lt;/code&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getSkills()&amp;lt;/code&amp;gt; || Níveis de habilidades (&amp;lt;code&amp;gt;hasSkill(name)&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getSkillLevel(name)&amp;lt;/code&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getStatus()&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getEffects()&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getTechniques()&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getBonusStats()&amp;lt;/code&amp;gt; || Indicadores de status, efeitos ativos, técnicas de ki e de golpe, modificadores de estatísticas extras&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Os cálculos de raça, forma e estatísticas leem a configuração ao vivo toda vez, então os valores sempre refletem a configuração atual do servidor (inclusive depois de &amp;lt;code&amp;gt;/dmzreload&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Changing_state_safely&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Alterar o estado com segurança ==&lt;br /&gt;
Os setters de estatísticas do próprio DMZ (por exemplo &amp;lt;code&amp;gt;Stats.setStrength()&amp;lt;/code&amp;gt;) publicam primeiro um evento cancelável e só aplicam a mudança se ele não for cancelado:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
DMZEvent.StatChangeEvent event = new DMZEvent.StatChangeEvent(player, StatType.STRENGTH, oldValue, newValue);&lt;br /&gt;
if (!MinecraftForge.EVENT_BUS.post(event)) {&lt;br /&gt;
    // apply the change&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No seu addon, prefira &amp;#039;&amp;#039;&amp;#039;reagir aos&amp;#039;&amp;#039;&amp;#039; eventos (alterando seus campos editáveis ou cancelando-os) a chamar diretamente os setters do DMZ. Nem todo setter valida ou publica um evento (a maioria dos setters de &amp;lt;code&amp;gt;Resources&amp;lt;/code&amp;gt;, por exemplo, só limita o valor e o aplica sem evento), então passar pelos eventos é o único ponto de integração com estabilidade garantida.&lt;br /&gt;
&lt;br /&gt;
Se você alterar dados do DMZ a partir do servidor, faça isso na thread do servidor e depois envie ao cliente uma cópia atualizada, do mesmo jeito que o DMZ faz:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
NetworkHandler.sendToTrackingEntityAndSelf(new StatsSyncS2C(serverPlayer), serverPlayer);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;StatsSyncS2C&amp;lt;/code&amp;gt; envia todos os dados do jogador; o DMZ também usa &amp;lt;code&amp;gt;ProgressionSyncS2C&amp;lt;/code&amp;gt; (estatísticas, estatísticas extras, habilidades, técnicas, dados de missões) e &amp;lt;code&amp;gt;ResourceSyncS2C&amp;lt;/code&amp;gt; (recursos e status) para atualizações menores.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Custom_quest_objectives_and_rewards&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Objetivos e recompensas de missão personalizados ==&lt;br /&gt;
{{See also|Custom Quests}}&lt;br /&gt;
Os addons podem adicionar novos &amp;#039;&amp;#039;&amp;#039;tipos&amp;#039;&amp;#039;&amp;#039; de objetivos e recompensas de missões que os arquivos JSON de missões podem usar depois, sem mexer no parser do DMZ. Registre-os durante o setup do mod (por exemplo, em &amp;lt;code&amp;gt;FMLCommonSetupEvent&amp;lt;/code&amp;gt;) nos &amp;#039;&amp;#039;&amp;#039;dois&amp;#039;&amp;#039;&amp;#039; lados: o cliente reconstrói as missões a partir do registro sincronizado com as mesmas fábricas.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
QuestObjectiveRegistry.register(&amp;quot;MEDITATE&amp;quot;,&lt;br /&gt;
    json -&amp;gt; new MeditateObjective(json.get(&amp;quot;seconds&amp;quot;).getAsInt()),                                 // parse quest JSON&lt;br /&gt;
    (objective, out) -&amp;gt; out.addProperty(&amp;quot;seconds&amp;quot;, ((MeditateObjective) objective).getSeconds()),  // client sync fields&lt;br /&gt;
    objective -&amp;gt; Component.translatable(&amp;quot;myaddon.quest.meditate.obj&amp;quot;));                            // HUD/journal text&lt;br /&gt;
&lt;br /&gt;
QuestRewardRegistry.register(&amp;quot;MY_CURRENCY&amp;quot;,&lt;br /&gt;
    json -&amp;gt; new MyCurrencyReward(json.get(&amp;quot;amount&amp;quot;).getAsInt()),&lt;br /&gt;
    (reward, out) -&amp;gt; out.addProperty(&amp;quot;amount&amp;quot;, ((MyCurrencyReward) reward).getAmount()));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
O contrato:&lt;br /&gt;
* As classes de objetivos estendem &amp;lt;code&amp;gt;QuestObjective&amp;lt;/code&amp;gt; e chamam o construtor &amp;lt;code&amp;gt;QuestObjective(String customType, int required)&amp;lt;/code&amp;gt;; as classes de recompensas estendem &amp;lt;code&amp;gt;QuestReward&amp;lt;/code&amp;gt;, chamam &amp;lt;code&amp;gt;QuestReward(String customType)&amp;lt;/code&amp;gt; e implementam &amp;lt;code&amp;gt;giveReward(ServerPlayer)&amp;lt;/code&amp;gt; e &amp;lt;code&amp;gt;getDescription()&amp;lt;/code&amp;gt;. Os objetivos também precisam implementar &amp;lt;code&amp;gt;checkProgress(Object... params)&amp;lt;/code&amp;gt;.&lt;br /&gt;
* No JSON das missões, use sua chave como &amp;lt;code&amp;gt;&amp;quot;type&amp;quot;&amp;lt;/code&amp;gt; (por exemplo &amp;lt;code&amp;gt;{&amp;quot;type&amp;quot;: &amp;quot;MEDITATE&amp;quot;, &amp;quot;seconds&amp;quot;: 60}&amp;lt;/code&amp;gt;). As chaves de tipo não diferenciam maiúsculas de minúsculas (são guardadas em maiúsculas). Trate-as como nomes de registro: não as renomeie depois que as missões passarem a usá-las.&lt;br /&gt;
* O escritor de sincronização precisa gravar todos os campos que sua fábrica lê, porque o cliente lê de novo o JSON sincronizado com a sua fábrica.&lt;br /&gt;
* Tipos desconhecidos são reportados no relatório de carregamento de JSON (veja [[Special:MyLanguage/Developer Scope and Prerequisites#Finding JSON mistakes|Encontrar erros de JSON]]) e o objetivo ou a recompensa é ignorado.&lt;br /&gt;
* O progresso é controlado pelo servidor e orientado a eventos: escute seus próprios eventos de jogo no servidor e salve o progresso com &amp;lt;code&amp;gt;PlayerQuestData.setObjectiveProgress(questKey, objectiveIndex, progress)&amp;lt;/code&amp;gt;, e depois sincronize com &amp;lt;code&amp;gt;ProgressionSyncS2C&amp;lt;/code&amp;gt;. Use &amp;lt;code&amp;gt;DMZEvent.QuestObjectiveProgressEvent&amp;lt;/code&amp;gt; e &amp;lt;code&amp;gt;QuestCompletedEvent&amp;lt;/code&amp;gt; para reagir às missões incluídas.&lt;br /&gt;
&lt;br /&gt;
Veja [[Special:MyLanguage/Custom Quests|Missões personalizadas]] para o formato JSON das missões.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Custom_text_placeholders&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Placeholders de texto personalizados ==&lt;br /&gt;
Os textos de missões, diálogos e NPCs aceitam &amp;lt;code&amp;gt;%placeholders%&amp;lt;/code&amp;gt; como &amp;lt;code&amp;gt;%player%&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;%race%&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;%class%&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;%level%&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;%alignment%&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;%deaths%&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;%form%&amp;lt;/code&amp;gt; e &amp;lt;code&amp;gt;%dimension%&amp;lt;/code&amp;gt;. Adicione os seus durante o setup do mod:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
DMZTextPlaceholders.register(&amp;quot;zeni&amp;quot;, (player, data) -&amp;gt; String.valueOf(MyAddon.getZeni(player)));&lt;br /&gt;
// &amp;quot;%zeni%&amp;quot; in quest/dialogue text now resolves to your value&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As chaves não diferenciam maiúsculas de minúsculas. O resolvedor roda no lado que renderiza o texto (geralmente o cliente) e precisa lidar com um &amp;lt;code&amp;gt;StatsData&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;null&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Utility_menu_buttons&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Botões do Menu de Utilidades ==&lt;br /&gt;
O Menu de Utilidades (radial) do cliente tem dois slots livres, à esquerda e à direita da roda, reservados para addons. Adicione um botão no setup do cliente:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
UtilityMenuScreen.addMenuSlot(new IUtilityMenuSlot() {&lt;br /&gt;
    @Override&lt;br /&gt;
    public ButtonInfo render(StatsData statsData) {&lt;br /&gt;
        return new ButtonInfo(Component.literal(&amp;quot;My Addon&amp;quot;), Component.literal(&amp;quot;Open&amp;quot;));&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    @Override&lt;br /&gt;
    public void handle(StatsData statsData, boolean rightClick) {&lt;br /&gt;
        // client side: open your screen or send your own packet to the server&lt;br /&gt;
    }&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Os slots são preenchidos na ordem de registro; registros além dos dois slots livres não são mostrados. Sobrescreva &amp;lt;code&amp;gt;hasRightClickAction&amp;lt;/code&amp;gt; para retornar &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; se o seu botão também reagir ao clique direito. &amp;lt;code&amp;gt;IUtilityMenuSlot&amp;lt;/code&amp;gt; e &amp;lt;code&amp;gt;ButtonInfo&amp;lt;/code&amp;gt; ficam em &amp;lt;code&amp;gt;com.dragonminez.client.gui.utilitymenu&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Armor_and_render_layers&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Armaduras e camadas de renderização ==&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Armaduras do seu addon:&amp;#039;&amp;#039;&amp;#039; a classe de item de armadura do DMZ, &amp;lt;code&amp;gt;DbzArmorItem&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;common/init/armor&amp;lt;/code&amp;gt;), tem um construtor &amp;lt;code&amp;gt;DbzArmorItem(material, type, properties, modId, itemId)&amp;lt;/code&amp;gt;. Passe seu próprio &amp;lt;code&amp;gt;modId&amp;lt;/code&amp;gt; e as texturas são lidas do seu próprio namespace: &amp;lt;code&amp;gt;assets/&amp;lt;modId&amp;gt;/textures/armor/&amp;lt;itemId&amp;gt;_layer1.png&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;_layer2&amp;lt;/code&amp;gt; para as calças), mais as opcionais &amp;lt;code&amp;gt;&amp;lt;itemId&amp;gt;_damaged_layer1.png&amp;lt;/code&amp;gt; e &amp;lt;code&amp;gt;_damaged_layer2.png&amp;lt;/code&amp;gt;, usadas quando o item perde mais da metade da durabilidade.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Outras armaduras:&amp;#039;&amp;#039;&amp;#039; os &amp;lt;code&amp;gt;ArmorItem&amp;lt;/code&amp;gt; comuns de outros mods são desenhados no modelo de jogador do DMZ com sua textura de armadura normal.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Camadas de renderização de terceiros:&amp;#039;&amp;#039;&amp;#039; as camadas de renderização que outros mods adicionam ao renderizador de jogador vanilla são repassadas para o modelo de jogador do DMZ. As camadas vanilla e as camadas de armaduras cosméticas são ignoradas, e nada é repassado enquanto o jogador é um Grande Macaco.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Networking&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Rede ==&lt;br /&gt;
O canal do DMZ é &amp;lt;code&amp;gt;NetworkHandler.INSTANCE&amp;lt;/code&amp;gt; (um &amp;lt;code&amp;gt;SimpleChannel&amp;lt;/code&amp;gt; do Forge em &amp;lt;code&amp;gt;dragonminez:network&amp;lt;/code&amp;gt;). Não registre seus próprios pacotes nele: o DMZ atribui os ids de pacote pela ordem de registro, então qualquer coisa que você adicionar deslocaria os ids do DMZ ou colidiria com eles. Em vez disso, registre seu próprio &amp;lt;code&amp;gt;SimpleChannel&amp;lt;/code&amp;gt; no seu addon e use o do DMZ como referência do padrão (&amp;lt;code&amp;gt;messageBuilder&amp;lt;/code&amp;gt;, codificador, decodificador e handler, com uma direção explícita).&lt;br /&gt;
&lt;br /&gt;
Você pode usar os helpers de envio do DMZ (&amp;lt;code&amp;gt;sendToPlayer&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;sendToTrackingEntityAndSelf&amp;lt;/code&amp;gt;, ...) para enviar os pacotes de sincronização do próprio DMZ, como mostrado acima.&lt;br /&gt;
&lt;br /&gt;
Também nunca confie no cliente nos seus próprios pacotes: valide no servidor tudo o que afeta estatísticas, desbloqueios, missões, desejos ou progresso.&lt;br /&gt;
&lt;br /&gt;
Não existe um evento de &amp;quot;dados sincronizados&amp;quot; no lado do cliente. No cliente, leia a capability quando precisar dela (por exemplo, durante a renderização) em vez de tentar interceptar os pacotes do DMZ.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Using_DMZ&amp;amp;#039;s_registries&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Usar os registros do DMZ ==&lt;br /&gt;
Importe diretamente os contêineres de registro &amp;lt;code&amp;gt;Main*&amp;lt;/code&amp;gt; em vez de escrever as resource locations à mão:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
import com.dragonminez.common.init.MainItems;&lt;br /&gt;
import com.dragonminez.common.init.MainAttributes;&lt;br /&gt;
&lt;br /&gt;
Item redCapsule = MainItems.RED_CAPSULE.get();&lt;br /&gt;
Attribute strength = MainAttributes.STRENGTH.get();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Disponíveis em &amp;lt;code&amp;gt;common/init/&amp;lt;/code&amp;gt;: &amp;lt;code&amp;gt;MainItems&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;MainBlocks&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;MainBlockEntities&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;MainEntities&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;MainAttributes&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;MainEffects&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;MainEnchants&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;MainPotions&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;MainSounds&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;MainParticles&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;MainFluids&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;MainMenus&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;MainRecipes&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;MainTabs&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;MainTags&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;MainVillagers&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;MainDamageTypes&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;MainGameRules&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;MainLootModifiers&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Optional_dependency_pattern&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Padrão de dependência opcional ==&lt;br /&gt;
Se o seu addon precisa funcionar com ou sem o DMZ instalado, siga o padrão que o próprio DMZ usa nas integrações opcionais (&amp;lt;code&amp;gt;common/compat/WeaponLevelingCompat.java&amp;lt;/code&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
public final class DmzCompat {&lt;br /&gt;
    private static Boolean loaded;&lt;br /&gt;
&lt;br /&gt;
    public static boolean isLoaded() {&lt;br /&gt;
        if (loaded == null) loaded = ModList.get().isLoaded(&amp;quot;dragonminez&amp;quot;);&lt;br /&gt;
        return loaded;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public static int getLevel(Player player) {&lt;br /&gt;
        if (!isLoaded()) return 0;   // safe fallback without DMZ&lt;br /&gt;
        return Impl.getLevel(player);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // Only this nested class imports DMZ classes, so it is never loaded without DMZ.&lt;br /&gt;
    private static final class Impl {&lt;br /&gt;
        static int getLevel(Player player) {&lt;br /&gt;
            return StatsProvider.get(StatsCapability.INSTANCE, player).map(StatsData::getLevel).orElse(0);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Verifique &amp;lt;code&amp;gt;ModList.get().isLoaded(&amp;quot;dragonminez&amp;quot;)&amp;lt;/code&amp;gt; uma única vez e guarde o resultado em cache.&lt;br /&gt;
# Mantenha todos os imports do DMZ dentro de classes que só são usadas depois dessa verificação (incluindo os listeners de eventos do DMZ: registre-os manualmente e só quando o DMZ estiver carregado).&lt;br /&gt;
# Proteja com essa flag toda chamada que mexa no DMZ, com um comportamento alternativo seguro ou um valor padrão quando ela for &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;.&lt;br /&gt;
# Registre no log uma mensagem clara de informação ou de aviso em qualquer caso, para que os donos de servidores vejam de relance se a integração está ativa.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Next_step&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Próximo passo ==&lt;br /&gt;
Veja [[Special:MyLanguage/Creating a DMZ Addon|Criar um addon de DMZ]] para a configuração completa do projeto Gradle e a declaração da dependência no &amp;lt;code&amp;gt;mods.toml&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{{Navbox Add-ons}}&lt;/div&gt;</summary>
		<author><name>Shokkoh</name></author>
	</entry>
</feed>