3 using Microsoft.Xna.Framework.Graphics;
7 namespace Loot.ILEditing
12 internal class WeaponDrawEffectsPatch : ILEdit
14 public override void Apply(
bool dedServ)
17 On.Terraria.DataStructures.DrawData.Draw += DrawDataOnDraw;
20 private void DrawDataOnDraw(On.Terraria.DataStructures.DrawData.orig_Draw orig, ref DrawData
self, SpriteBatch sb)
23 if (!Main.LocalPlayer.frozen
24 && (Main.LocalPlayer.itemAnimation > 0 && Main.LocalPlayer.HeldItem.useStyle != 0 || Main.LocalPlayer.HeldItem.holdStyle > 0 && !Main.LocalPlayer.pulley)
25 && Main.LocalPlayer.HeldItem.type > 0 && !Main.LocalPlayer.dead && !Main.LocalPlayer.HeldItem.noUseGraphic && (!Main.LocalPlayer.wet || !Main.LocalPlayer.HeldItem.noWet)
26 && Main.itemTexture[Main.LocalPlayer.HeldItem.type] ==
self.texture)
29 if (!DrawShaderEntities(info,
self, sb) && !DrawGlowmaskEntities(info,
self, sb))
38 private bool DrawShaderEntities(
GraphicsGlobalItem info, DrawData
self, SpriteBatch sb)
40 var lightColor = Lighting.GetColor((
int)(Main.LocalPlayer.MountedCenter.X / 16), (
int)(Main.LocalPlayer.MountedCenter.Y / 16));
44 if (entity == null)
continue;
45 entity.Properties.SkipUpdatingDrawData =
true;
46 entity.DrawData =
self;
47 entity.DoDrawLayeredEntity(sb, lightColor,
self.color,
self.scale.LengthSquared(),
self.rotation, info.
GlowmaskEntities[i]);
52 private bool DrawGlowmaskEntities(
GraphicsGlobalItem info, DrawData
self, SpriteBatch sb)
54 var lightColor = Lighting.GetColor((
int)(Main.LocalPlayer.MountedCenter.X / 16), (
int)(Main.LocalPlayer.MountedCenter.Y / 16));
57 entity.Properties.SkipUpdatingDrawData =
true;
58 entity.DrawData =
self;
59 entity.DoDrawGlowmask(sb, lightColor,
self.color,
self.rotation,
self.scale.LengthSquared(), entity.Entity.whoAmI);
This class is responsible for handling ShaderEntity and GlowmaskEntity that come from the Modifiers o...
List< GlowmaskEntity > GlowmaskEntities
List< ShaderEntity > ShaderEntities
static GraphicsGlobalItem GetInfo(Item item)