Skip to content
This repository has been archived by the owner on Apr 5, 2021. It is now read-only.

Commit

Permalink
ModItem. GlobalItem, and ModRecipe
Browse files Browse the repository at this point in the history
  • Loading branch information
steviegt6 committed Oct 10, 2020
1 parent e07fe16 commit 28c3d30
Show file tree
Hide file tree
Showing 23 changed files with 2,352 additions and 9 deletions.
41 changes: 41 additions & 0 deletions patches/Tea/Terraria/DataStructures/PlayerDrawHeadLayers.cs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
--- src/Terraria/Terraria/DataStructures/PlayerDrawHeadLayers.cs
+++ src/Tea/Terraria/DataStructures/PlayerDrawHeadLayers.cs
@@ -5,6 +_,7 @@
using Terraria.GameContent;
using Terraria.Graphics;
using Terraria.ID;
+using Terraria.Tea;

namespace Terraria.DataStructures
{
@@ -14,7 +_,7 @@
}

public static void DrawPlayer_00_BackHelmet(ref PlayerDrawHeadSet drawinfo) {
- if (drawinfo.drawPlayer.head >= 0 && drawinfo.drawPlayer.head < 266) {
+ if (drawinfo.drawPlayer.head >= 0) {
int num = ArmorIDs.Head.Sets.FrontToBackID[drawinfo.drawPlayer.head];
if (num >= 0) {
Rectangle hairFrame = drawinfo.HairFrame;
@@ -24,7 +_,9 @@
}

public static void DrawPlayer_01_FaceSkin(ref PlayerDrawHeadSet drawinfo) {
+ ItemLoader.DrawHair(drawinfo.drawPlayer, ref drawinfo.fullHair, ref drawinfo.hatHair);
+
- if (drawinfo.drawPlayer.head != 38 && drawinfo.drawPlayer.head != 135 && !drawinfo.drawPlayer.isHatRackDoll) {
+ if (drawinfo.drawPlayer.head != 38 && drawinfo.drawPlayer.head != 135 && !drawinfo.drawPlayer.isHatRackDoll && ItemLoader.DrawHead(drawinfo.drawPlayer)) {
QuickCDD(drawinfo.DrawData, drawinfo.skinDyePacked, TextureAssets.Players[drawinfo.skinVar, 0].Value, new Vector2(drawinfo.Position.X - Main.screenPosition.X - (float)(drawinfo.bodyFrameMemory.Width / 2) + (float)(drawinfo.drawPlayer.width / 2), drawinfo.Position.Y - Main.screenPosition.Y + (float)drawinfo.drawPlayer.height - (float)drawinfo.bodyFrameMemory.Height + 4f) + drawinfo.drawPlayer.headPosition + drawinfo.headVect, drawinfo.bodyFrameMemory, drawinfo.colorHead, drawinfo.drawPlayer.headRotation, drawinfo.headVect, drawinfo.scale, drawinfo.playerEffect, 0f);
QuickCDD(drawinfo.DrawData, TextureAssets.Players[drawinfo.skinVar, 1].Value, new Vector2(drawinfo.Position.X - Main.screenPosition.X - (float)(drawinfo.bodyFrameMemory.Width / 2) + (float)(drawinfo.drawPlayer.width / 2), drawinfo.Position.Y - Main.screenPosition.Y + (float)drawinfo.drawPlayer.height - (float)drawinfo.bodyFrameMemory.Height + 4f) + drawinfo.drawPlayer.headPosition + drawinfo.headVect, drawinfo.bodyFrameMemory, drawinfo.colorEyeWhites, drawinfo.drawPlayer.headRotation, drawinfo.headVect, drawinfo.scale, drawinfo.playerEffect, 0f);
QuickCDD(drawinfo.DrawData, TextureAssets.Players[drawinfo.skinVar, 2].Value, new Vector2(drawinfo.Position.X - Main.screenPosition.X - (float)(drawinfo.bodyFrameMemory.Width / 2) + (float)(drawinfo.drawPlayer.width / 2), drawinfo.Position.Y - Main.screenPosition.Y + (float)drawinfo.drawPlayer.height - (float)drawinfo.bodyFrameMemory.Height + 4f) + drawinfo.drawPlayer.headPosition + drawinfo.headVect, drawinfo.bodyFrameMemory, drawinfo.colorEyes, drawinfo.drawPlayer.headRotation, drawinfo.headVect, drawinfo.scale, drawinfo.playerEffect, 0f);
@@ -214,7 +_,9 @@
}

public static void DrawPlayer_08_FaceAcc(ref PlayerDrawHeadSet drawinfo) {
- if (drawinfo.drawPlayer.face > 0 && drawinfo.drawPlayer.face < 16 && drawinfo.drawPlayer.face != 5) {
+ ItemLoader.DrawHair(drawinfo.drawPlayer, ref drawinfo.fullHair, ref drawinfo.hatHair);
+
+ if (drawinfo.drawPlayer.face > 0 && drawinfo.drawPlayer.face != 5) {
if (drawinfo.drawPlayer.face == 7) {
new Color(200, 200, 200, 150);
QuickCDD(drawinfo.DrawData, drawinfo.cFace, TextureAssets.AccFace[drawinfo.drawPlayer.face].Value, new Vector2((int)(drawinfo.Position.X - Main.screenPosition.X - (float)(drawinfo.bodyFrameMemory.Width / 2) + (float)(drawinfo.drawPlayer.width / 2)), drawinfo.Position.Y - Main.screenPosition.Y + (float)drawinfo.drawPlayer.height - (float)drawinfo.bodyFrameMemory.Height + 4f) + drawinfo.drawPlayer.headPosition + drawinfo.headVect, drawinfo.bodyFrameMemory, new Color(200, 200, 200, 200), drawinfo.drawPlayer.headRotation, drawinfo.headVect, drawinfo.scale, drawinfo.playerEffect, 0f);
11 changes: 11 additions & 0 deletions patches/Tea/Terraria/DataStructures/PlayerDrawHeadSet.cs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- src/Terraria/Terraria/DataStructures/PlayerDrawHeadSet.cs
+++ src/Tea/Terraria/DataStructures/PlayerDrawHeadSet.cs
@@ -100,7 +_,7 @@
helmetOffset = drawPlayer.GetHelmetDrawOffset();
drawPlayer.GetHairSettings(out fullHair, out hatHair, out hideHair, out bool _, out helmetIsOverFullHair);
helmetIsTall = (drawPlayer.head == 14 || drawPlayer.head == 56 || drawPlayer.head == 158);
- helmetIsNormal = (!helmetIsTall && !helmetIsOverFullHair && drawPlayer.head > 0 && drawPlayer.head < 266 && drawPlayer.head != 28);
+ helmetIsNormal = (!helmetIsTall && !helmetIsOverFullHair && drawPlayer.head > 0 && drawPlayer.head != 28);
}
}
}
202 changes: 202 additions & 0 deletions patches/Tea/Terraria/DataStructures/PlayerDrawLayers.cs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
--- src/Terraria/Terraria/DataStructures/PlayerDrawLayers.cs
+++ src/Tea/Terraria/DataStructures/PlayerDrawLayers.cs
@@ -7,6 +_,7 @@
using Terraria.Graphics;
using Terraria.Graphics.Shaders;
using Terraria.ID;
+using Terraria.Tea;
using Terraria.UI;

namespace Terraria.DataStructures
@@ -223,7 +_,7 @@
}

public static void DrawPlayer_01_3_BackHead(ref PlayerDrawSet drawinfo) {
- if (drawinfo.drawPlayer.head >= 0 && drawinfo.drawPlayer.head < 266) {
+ if (drawinfo.drawPlayer.head >= 0) {
int num = ArmorIDs.Head.Sets.FrontToBackID[drawinfo.drawPlayer.head];
if (num >= 0) {
Vector2 helmetOffset = drawinfo.helmetOffset;
@@ -386,7 +_,7 @@
}

public static void DrawPlayer_09_BackAc(ref PlayerDrawSet drawinfo) {
- if (drawinfo.backPack || drawinfo.drawPlayer.back <= 0 || drawinfo.drawPlayer.back >= 30 || drawinfo.drawPlayer.mount.Active)
+ if (drawinfo.backPack || drawinfo.drawPlayer.back <= 0 || drawinfo.drawPlayer.mount.Active)
return;

if (drawinfo.drawPlayer.front >= 1 && drawinfo.drawPlayer.front <= 4) {
@@ -886,7 +_,7 @@
float rotation = bodyRotation + drawinfo.compositeBackArmRotation;
bool flag = !drawinfo.drawPlayer.invis;
bool flag2 = !drawinfo.drawPlayer.invis;
- bool flag3 = drawinfo.drawPlayer.body > 0 && drawinfo.drawPlayer.body < 235;
+ bool flag3 = drawinfo.drawPlayer.body > 0;
bool flag4 = !drawinfo.hidesTopSkin;
bool flag5 = false;
DrawData drawData;
@@ -961,7 +_,7 @@
}
}

- if (drawinfo.drawPlayer.handoff > 0 && drawinfo.drawPlayer.handoff < 14) {
+ if (drawinfo.drawPlayer.handoff > 0) {
Texture2D value3 = TextureAssets.AccHandsOffComposite[drawinfo.drawPlayer.handoff].Value;
drawData = new DrawData(value3, vector2, drawinfo.compBackArmFrame, drawinfo.colorArmorBody, rotation, bodyVect, 1f, drawinfo.playerEffect, 0) {
shader = drawinfo.cHandOff
@@ -983,7 +_,7 @@
public static void DrawPlayer_13_Leggings(ref PlayerDrawSet drawinfo) {
DrawData item;
if (drawinfo.isSitting && drawinfo.drawPlayer.legs != 140 && drawinfo.drawPlayer.legs != 217) {
- if (drawinfo.drawPlayer.legs > 0 && drawinfo.drawPlayer.legs < 218 && (!ShouldOverrideLegs_CheckShoes(ref drawinfo) || drawinfo.drawPlayer.wearsRobe)) {
+ if (drawinfo.drawPlayer.legs > 0 && (!ShouldOverrideLegs_CheckShoes(ref drawinfo) || drawinfo.drawPlayer.wearsRobe)) {
if (!drawinfo.drawPlayer.invis) {
DrawSittingLegs(ref drawinfo, TextureAssets.ArmorLeg[drawinfo.drawPlayer.legs].Value, drawinfo.colorArmorLegs, drawinfo.cLegs);
if (drawinfo.legsGlowMask != -1)
@@ -1021,7 +_,7 @@
drawinfo.DrawDataCache.Add(item);
}
}
- else if (drawinfo.drawPlayer.legs > 0 && drawinfo.drawPlayer.legs < 218 && (!ShouldOverrideLegs_CheckShoes(ref drawinfo) || drawinfo.drawPlayer.wearsRobe)) {
+ else if (drawinfo.drawPlayer.legs > 0 && (!ShouldOverrideLegs_CheckShoes(ref drawinfo) || drawinfo.drawPlayer.wearsRobe)) {
if (drawinfo.drawPlayer.invis)
return;

@@ -1110,7 +_,7 @@
}

public static void DrawPlayer_14_Shoes(ref PlayerDrawSet drawinfo) {
- if (drawinfo.drawPlayer.shoe > 0 && drawinfo.drawPlayer.shoe < 25 && !ShouldOverrideLegs_CheckPants(ref drawinfo)) {
+ if (drawinfo.drawPlayer.shoe > 0 && !ShouldOverrideLegs_CheckPants(ref drawinfo)) {
if (drawinfo.isSitting) {
DrawSittingLegs(ref drawinfo, TextureAssets.AccShoes[drawinfo.drawPlayer.shoe].Value, drawinfo.colorArmorLegs, drawinfo.cShoe);
return;
@@ -1123,7 +_,7 @@
}

public static void DrawPlayer_15_SkinLongCoat(ref PlayerDrawSet drawinfo) {
- if ((drawinfo.skinVar == 3 || drawinfo.skinVar == 8 || drawinfo.skinVar == 7) && (drawinfo.drawPlayer.body <= 0 || drawinfo.drawPlayer.body >= 235) && !drawinfo.drawPlayer.invis) {
+ if ((drawinfo.skinVar == 3 || drawinfo.skinVar == 8 || drawinfo.skinVar == 7) && (drawinfo.drawPlayer.body <= 0) && !drawinfo.drawPlayer.invis) {
if (drawinfo.isSitting) {
DrawSittingLegs(ref drawinfo, TextureAssets.Players[drawinfo.skinVar, 14].Value, drawinfo.colorShirt);
return;
@@ -1212,7 +_,7 @@
if (drawinfo.usesCompositeTorso) {
DrawPlayer_17_TorsoComposite(ref drawinfo);
}
- else if (drawinfo.drawPlayer.body > 0 && drawinfo.drawPlayer.body < 235) {
+ else if (drawinfo.drawPlayer.body > 0) {
Rectangle bodyFrame = drawinfo.drawPlayer.bodyFrame;
int num = drawinfo.armorAdjust;
bodyFrame.X += num;
@@ -1272,7 +_,7 @@
_ = value2 + compositeOffset_BackArm;
bodyVect += compositeOffset_BackArm;
DrawData drawData;
- if (drawinfo.drawPlayer.body > 0 && drawinfo.drawPlayer.body < 235) {
+ if (drawinfo.drawPlayer.body > 0) {
if (!drawinfo.drawPlayer.invis || IsArmorDrawnWhenInvisible(drawinfo.drawPlayer.body)) {
Texture2D value3 = TextureAssets.ArmorBodyComposite[drawinfo.drawPlayer.body].Value;
drawData = new DrawData(value3, vector, drawinfo.compTorsoFrame, drawinfo.colorArmorBody, bodyRotation, drawinfo.bodyVect, 1f, drawinfo.playerEffect, 0) {
@@ -1300,7 +_,7 @@
}

public static void DrawPlayer_18_OffhandAcc(ref PlayerDrawSet drawinfo) {
- if (!drawinfo.usesCompositeBackHandAcc && drawinfo.drawPlayer.handoff > 0 && drawinfo.drawPlayer.handoff < 14) {
+ if (!drawinfo.usesCompositeBackHandAcc && drawinfo.drawPlayer.handoff > 0) {
DrawData item = new DrawData(TextureAssets.AccHandsOff[drawinfo.drawPlayer.handoff].Value, new Vector2((int)(drawinfo.Position.X - Main.screenPosition.X - (float)(drawinfo.drawPlayer.bodyFrame.Width / 2) + (float)(drawinfo.drawPlayer.width / 2)), (int)(drawinfo.Position.Y - Main.screenPosition.Y + (float)drawinfo.drawPlayer.height - (float)drawinfo.drawPlayer.bodyFrame.Height + 4f)) + drawinfo.drawPlayer.bodyPosition + new Vector2(drawinfo.drawPlayer.bodyFrame.Width / 2, drawinfo.drawPlayer.bodyFrame.Height / 2), drawinfo.drawPlayer.bodyFrame, drawinfo.colorArmorBody, drawinfo.drawPlayer.bodyRotation, drawinfo.bodyVect, 1f, drawinfo.playerEffect, 0);
item.shader = drawinfo.cHandOff;
drawinfo.DrawDataCache.Add(item);
@@ -1308,7 +_,7 @@
}

public static void DrawPlayer_19_WaistAcc(ref PlayerDrawSet drawinfo) {
- if (drawinfo.drawPlayer.waist > 0 && drawinfo.drawPlayer.waist < 17) {
+ if (drawinfo.drawPlayer.waist > 0) {
Rectangle value = drawinfo.drawPlayer.legFrame;
if (ArmorIDs.Waist.Sets.UsesTorsoFraming[drawinfo.drawPlayer.waist])
value = drawinfo.drawPlayer.bodyFrame;
@@ -1320,7 +_,7 @@
}

public static void DrawPlayer_20_NeckAcc(ref PlayerDrawSet drawinfo) {
- if (drawinfo.drawPlayer.neck > 0 && drawinfo.drawPlayer.neck < 11) {
+ if (drawinfo.drawPlayer.neck > 0) {
DrawData item = new DrawData(TextureAssets.AccNeck[drawinfo.drawPlayer.neck].Value, new Vector2((int)(drawinfo.Position.X - Main.screenPosition.X - (float)(drawinfo.drawPlayer.bodyFrame.Width / 2) + (float)(drawinfo.drawPlayer.width / 2)), (int)(drawinfo.Position.Y - Main.screenPosition.Y + (float)drawinfo.drawPlayer.height - (float)drawinfo.drawPlayer.bodyFrame.Height + 4f)) + drawinfo.drawPlayer.bodyPosition + new Vector2(drawinfo.drawPlayer.bodyFrame.Width / 2, drawinfo.drawPlayer.bodyFrame.Height / 2), drawinfo.drawPlayer.bodyFrame, drawinfo.colorArmorBody, drawinfo.drawPlayer.bodyRotation, drawinfo.bodyVect, 1f, drawinfo.playerEffect, 0);
item.shader = drawinfo.cNeck;
drawinfo.DrawDataCache.Add(item);
@@ -1405,7 +_,7 @@
drawinfo.DrawDataCache.Add(item);
}
}
- else if (drawinfo.drawPlayer.head > 0 && drawinfo.drawPlayer.head < 266 && !flag2) {
+ else if (drawinfo.drawPlayer.head > 0 && !flag2) {
if (!(drawinfo.drawPlayer.invis && flag3)) {
if (drawinfo.drawPlayer.head == 13) {
int num6 = 0;
@@ -1610,7 +_,10 @@

public static void DrawPlayer_22_FaceAcc(ref PlayerDrawSet drawinfo) {
DrawData item;
- if (drawinfo.drawPlayer.face > 0 && drawinfo.drawPlayer.face < 16 && drawinfo.drawPlayer.face != 5) {
+
+ ItemLoader.DrawHair(drawinfo.drawPlayer, ref drawinfo.fullHair, ref drawinfo.hatHair);
+
+ if (drawinfo.drawPlayer.face > 0 && drawinfo.drawPlayer.face != 5) {
if (drawinfo.drawPlayer.face == 7) {
item = new DrawData(TextureAssets.AccFace[drawinfo.drawPlayer.face].Value, new Vector2((int)(drawinfo.Position.X - Main.screenPosition.X - (float)(drawinfo.drawPlayer.bodyFrame.Width / 2) + (float)(drawinfo.drawPlayer.width / 2)), (int)(drawinfo.Position.Y - Main.screenPosition.Y + (float)drawinfo.drawPlayer.height - (float)drawinfo.drawPlayer.bodyFrame.Height + 4f)) + drawinfo.drawPlayer.headPosition + drawinfo.headVect, drawinfo.drawPlayer.bodyFrame, new Color(200, 200, 200, 150), drawinfo.drawPlayer.headRotation, drawinfo.headVect, 1f, drawinfo.playerEffect, 0);
item.shader = drawinfo.cFace;
@@ -1766,7 +_,7 @@
}

public static void DrawPlayer_25_Shield(ref PlayerDrawSet drawinfo) {
- if (drawinfo.drawPlayer.shield <= 0 || drawinfo.drawPlayer.shield >= 10)
+ if (drawinfo.drawPlayer.shield <= 0)
return;

Vector2 zero = Vector2.Zero;
@@ -2147,7 +_,7 @@
if (drawinfo.usesCompositeTorso) {
DrawPlayer_28_ArmOverItemComposite(ref drawinfo);
}
- else if (drawinfo.drawPlayer.body > 0 && drawinfo.drawPlayer.body < 235) {
+ else if (drawinfo.drawPlayer.body > 0) {
Rectangle bodyFrame = drawinfo.drawPlayer.bodyFrame;
int num = drawinfo.armorAdjust;
bodyFrame.X += num;
@@ -2223,7 +_,7 @@
vector += new Vector2((!drawinfo.playerEffect.HasFlag(SpriteEffects.FlipHorizontally)) ? 1 : (-1), (!drawinfo.playerEffect.HasFlag(SpriteEffects.FlipVertically)) ? 1 : (-1));

_ = drawinfo.drawPlayer.invis;
- bool num = drawinfo.drawPlayer.body > 0 && drawinfo.drawPlayer.body < 235;
+ bool num = drawinfo.drawPlayer.body > 0;
int num2 = drawinfo.compShoulderOverFrontArm ? 1 : 0;
int num3 = (!drawinfo.compShoulderOverFrontArm) ? 1 : 0;
int num4 = (!drawinfo.compShoulderOverFrontArm) ? 1 : 0;
@@ -2305,7 +_,7 @@
}
}

- if (drawinfo.drawPlayer.handon > 0 && drawinfo.drawPlayer.handon < 22) {
+ if (drawinfo.drawPlayer.handon > 0) {
Texture2D value3 = TextureAssets.AccHandsOnComposite[drawinfo.drawPlayer.handon].Value;
drawData = new DrawData(value3, vector, drawinfo.compFrontArmFrame, drawinfo.colorArmorBody, rotation, bodyVect, 1f, drawinfo.playerEffect, 0) {
shader = drawinfo.cHandOn
@@ -2316,7 +_,7 @@
}

public static void DrawPlayer_29_OnhandAcc(ref PlayerDrawSet drawinfo) {
- if (!drawinfo.usesCompositeFrontHandAcc && drawinfo.drawPlayer.handon > 0 && drawinfo.drawPlayer.handon < 22) {
+ if (!drawinfo.usesCompositeFrontHandAcc && drawinfo.drawPlayer.handon > 0) {
DrawData item = new DrawData(TextureAssets.AccHandsOn[drawinfo.drawPlayer.handon].Value, new Vector2((int)(drawinfo.Position.X - Main.screenPosition.X - (float)(drawinfo.drawPlayer.bodyFrame.Width / 2) + (float)(drawinfo.drawPlayer.width / 2)), (int)(drawinfo.Position.Y - Main.screenPosition.Y + (float)drawinfo.drawPlayer.height - (float)drawinfo.drawPlayer.bodyFrame.Height + 4f)) + drawinfo.drawPlayer.bodyPosition + new Vector2(drawinfo.drawPlayer.bodyFrame.Width / 2, drawinfo.drawPlayer.bodyFrame.Height / 2), drawinfo.drawPlayer.bodyFrame, drawinfo.colorArmorBody, drawinfo.drawPlayer.bodyRotation, drawinfo.bodyVect, 1f, drawinfo.playerEffect, 0);
item.shader = drawinfo.cHandOn;
drawinfo.DrawDataCache.Add(item);
@@ -2348,7 +_,7 @@
}

public static void DrawPlayer_32_FrontAcc(ref PlayerDrawSet drawinfo) {
- if (!drawinfo.backPack && drawinfo.drawPlayer.front > 0 && drawinfo.drawPlayer.front < 9 && !drawinfo.drawPlayer.mount.Active) {
+ if (!drawinfo.backPack && drawinfo.drawPlayer.front > 0 && !drawinfo.drawPlayer.mount.Active) {
Vector2 zero = Vector2.Zero;
DrawData item = new DrawData(TextureAssets.AccFront[drawinfo.drawPlayer.front].Value, zero + new Vector2((int)(drawinfo.Position.X - Main.screenPosition.X - (float)(drawinfo.drawPlayer.bodyFrame.Width / 2) + (float)(drawinfo.drawPlayer.width / 2)), (int)(drawinfo.Position.Y - Main.screenPosition.Y + (float)drawinfo.drawPlayer.height - (float)drawinfo.drawPlayer.bodyFrame.Height + 4f)) + drawinfo.drawPlayer.bodyPosition + new Vector2(drawinfo.drawPlayer.bodyFrame.Width / 2, drawinfo.drawPlayer.bodyFrame.Height / 2), drawinfo.drawPlayer.bodyFrame, drawinfo.colorArmorBody, drawinfo.drawPlayer.bodyRotation, drawinfo.bodyVect, 1f, drawinfo.playerEffect, 0);
item.shader = drawinfo.cFront;
35 changes: 35 additions & 0 deletions patches/Tea/Terraria/GameContent/ItemDropRules/CommonCode.cs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
--- src/Terraria/Terraria/GameContent/ItemDropRules/CommonCode.cs
+++ src/Tea/Terraria/GameContent/ItemDropRules/CommonCode.cs
@@ -1,4 +_,5 @@
using Microsoft.Xna.Framework;
+using Terraria.Tea;
using Terraria.Utilities;

namespace Terraria.GameContent.ItemDropRules
@@ -6,7 +_,7 @@
public static class CommonCode
{
public static void DropItemFromNPC(NPC npc, int itemId, int stack, bool scattered = false) {
- if (itemId > 0 && itemId < 5045) {
+ if (itemId > 0 && itemId < ItemLoader.Count) {
int x = (int)npc.position.X + npc.width / 2;
int y = (int)npc.position.Y + npc.height / 2;
if (scattered) {
@@ -20,7 +_,7 @@
}

public static void DropItemLocalPerClientAndSetNPCMoneyTo0(NPC npc, int itemId, int stack, bool interactionRequired = true) {
- if (itemId <= 0 || itemId >= 5045)
+ if (itemId <= 0 || itemId >= ItemLoader.Count)
return;

if (Main.netMode == 2) {
@@ -41,7 +_,7 @@
}

public static void DropItemForEachInteractingPlayerOnThePlayer(NPC npc, int itemId, UnifiedRandom rng, int dropsAtXOutOfY_TheX, int dropsAtXOutOfY_TheY, int stack = 1, bool interactionRequired = true) {
- if (itemId <= 0 || itemId >= 5045)
+ if (itemId <= 0 || itemId >= ItemLoader.Count)
return;

if (Main.netMode == 2) {
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--- src/Terraria/Terraria/GameContent/LootSimulation/LootSimulationItemCounter.cs
+++ src/Tea/Terraria/GameContent/LootSimulation/LootSimulationItemCounter.cs
@@ -1,13 +_,14 @@
using System.Collections.Generic;
using System.Linq;
using Terraria.ID;
+using Terraria.Tea;

namespace Terraria.GameContent.LootSimulation
{
public class LootSimulationItemCounter
{
- private long[] _itemCountsObtained = new long[5045];
+ private long[] _itemCountsObtained = new long[ItemLoader.Count];
- private long[] _itemCountsObtainedExpert = new long[5045];
+ private long[] _itemCountsObtainedExpert = new long[ItemLoader.Count];
private long _totalTimesAttempted;
private long _totalTimesAttemptedExpert;

28 changes: 28 additions & 0 deletions patches/Tea/Terraria/ID/ContentSamples.cs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
--- src/Terraria/Terraria/ID/ContentSamples.cs
+++ src/Tea/Terraria/ID/ContentSamples.cs
@@ -2,6 +_,7 @@
using System.Linq;
using Terraria.GameContent.Bestiary;
using Terraria.Graphics.Shaders;
+using Terraria.Tea;

namespace Terraria.ID
{
@@ -588,7 +_,7 @@

public static void SetCreativeMenuOrder() {
List<Item> list = new List<Item>();
- for (int i = 1; i < 5045; i++) {
+ for (int i = 1; i < ItemLoader.Count; i++) {
Item item = new Item();
item.SetDefaults(i);
list.Add(item);
@@ -699,7 +_,7 @@
}

ItemsByType.Clear();
- for (int k = 0; k < 5045; k++) {
+ for (int k = 0; k < ItemLoader.Count; k++) {
Item item = new Item();
item.SetDefaults(k);
ItemsByType[k] = item;
9 changes: 9 additions & 0 deletions patches/Tea/Terraria/Item.Tea.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using Terraria.Tea;

namespace Terraria
{
partial class Item
{
public ModItem modItem { get; internal set; }
}
}
Loading

0 comments on commit 28c3d30

Please sign in to comment.