Skip to content

Commit 8201125

Browse files
committed
carpet from candy recipe; candy from carpet recipe; bigeye
1 parent 3ad5ff3 commit 8201125

File tree

9 files changed

+39
-9
lines changed

9 files changed

+39
-9
lines changed

src/render/Textures.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public class Textures {
3939
public readonly BTexture2D zombie;
4040
public readonly BTexture2D eye;
4141
public readonly BTexture2D mummy;
42+
public readonly BTexture2D bigeye;
4243

4344
// texture pack management
4445
private readonly List<TexturePack> availablePacks = [];
@@ -90,6 +91,7 @@ public Textures(Silk.NET.OpenGL.Legacy.GL GL) {
9091
zombie = get("textures/entity/zombie.png");
9192
eye = get("textures/entity/eye.png");
9293
mummy = get("textures/entity/mummy.png");
94+
bigeye = get("textures/entity/bigeye.png");
9395

9496
reloadAll();
9597
}

src/render/model/BigEyeModel.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using BlockGame.main;
2+
using BlockGame.world;
3+
using BlockGame.world.entity;
4+
5+
namespace BlockGame.render.model;
6+
7+
public class BigEyeModel : EntityModel {
8+
public const int xs = 64;
9+
public const int ys = 64;
10+
11+
public readonly Cube eye = new Cube().pos(0, 0, 0).off(-8, -8, -8).ext(16, 16, 16).tex(0, 0).gen(xs, ys);
12+
public readonly Cube tail = new Cube().pos(0, 0, -16).off(-8, -8, -8).ext(16, 16, 16).tex(0, 32).dsided().gen(xs, ys);
13+
14+
15+
public override void render(MatrixStack mat, Entity e, float apos, float aspeed, float scale, double interp) {
16+
Game.graphics.tex(0, Game.textures.bigeye);
17+
18+
var ide = EntityRenderers.ide;
19+
eye.xfrender(ide, mat, scale);
20+
tail.xfrender(ide, mat, scale);
21+
}
22+
}

src/render/model/DodoModel.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,8 @@ public override void render(MatrixStack mat, Entity e, float apos, float aspeed,
5151
float lr = MathF.Sin(apos * 10) * 20f * cs * Meth.phiF;
5252
rightLeg.rotation = new Vector3(0, 0, lr);
5353
leftLeg.rotation = new Vector3(0, 0, -lr);
54-
//rightfoot.position = new Vector3(0, 0, cs);
55-
//leftfoot.position = new Vector3(0, 0, -cs);
56-
57-
54+
//rightfoot.position = new Vector3(0, 0, lr);
55+
//leftfoot.position = new Vector3(0, 0, -lr);
5856

5957
// render dodo
6058
var ide = EntityRenderers.ide;

src/render/model/EntityRenderer.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,6 @@ public static void reloadAll() {
5555
register(Entities.GRENADE, new GrenadeEntityRenderer());
5656
register(Entities.MUMMY, new MobRenderer<Mummy>(new MummyModel()));
5757
register(Entities.DODO, new MobRenderer<Dodo>(new DodoModel()));
58+
register(Entities.BIGEYE, new MobRenderer<BigEye>(new BigEyeModel()));
5859
}
5960
}

src/util/ItemSlot.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,13 +199,16 @@ public override ItemStack take(int count) {
199199

200200
// use cached recipe from updateResult() to prevent double lookup
201201
var recipe = craftingGrid.lastMatchedRecipe;
202+
Console.WriteLine($"[CraftingResultSlot.take] recipe={recipe?.GetType().Name}, result={result.getItem().name}");
202203
if (recipe != null && recipe.matches(craftingGrid)) {
204+
Console.WriteLine($"[CraftingResultSlot.take] Recipe matches, calling consumeIngredients");
203205
// recipe still valid - consume ingredients
204206
recipe.consumeIngredients(craftingGrid);
205207
craftingGrid.updateResult(); // recalculate to see if we can craft again
206208
craftingGrid.notifyChanged();
207209
}
208210
else {
211+
Console.WriteLine($"[CraftingResultSlot.take] Recipe NULL or doesn't match, clearing grid");
209212
// recipe no longer matches (grid changed or desync) - clear grid and don't give items
210213
craftingGrid.clearAll();
211214
craftingGrid.notifyChanged();

src/world/entity/BigEye.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class BigEye : Hostile {
1111
protected override bool usePathfinding => false; // handles own flight movement
1212

1313
private const double FLIGHT_SPEED = 1;
14-
private const double HOVER_HEIGHT = 18.0; // preferred height above ground
14+
private const double HOVER_HEIGHT = 8.0; // preferred height above ground
1515

1616
private Vector3D? flyTarget;
1717
private int retargetCooldown;

src/world/entity/Entities.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ public static class SpawnTypeExt {
2424
* Added this so we can officially claim to be a factory game. :D
2525
*/
2626
public class Entities {
27-
2827
public static int PLAYER;
2928
public static int ITEM_ENTITY;
3029
public static int FALLING_BLOCK;
@@ -38,6 +37,7 @@ public class Entities {
3837
public static int EYE;
3938
public static int MUMMY;
4039
public static int DODO;
40+
public static int BIGEYE;
4141

4242
/** spawn metadata for each entity type */
4343
public static XUList<SpawnType> spawnType => Registry.ENTITIES.spawnType;
@@ -60,6 +60,7 @@ public static void preLoad() {
6060
EYE = register("eye", w => new DemonEye(w));
6161
MUMMY = register("mummy", w => new Mummy(w));
6262
DODO = register("dodo", w => new Dodo(w));
63+
BIGEYE = register("BigEye", w => new BigEye(w));
6364

6465
if (!Net.mode.isDed()) {
6566
EntityRenderers.reloadAll();
@@ -72,6 +73,7 @@ public static void preLoad() {
7273
spawnType[EYE] = SpawnType.HOSTILE;
7374
spawnType[MUMMY] = SpawnType.CAVE;
7475
spawnType[DODO] = SpawnType.PASSIVE;
76+
spawnType[BIGEYE] = SpawnType.HOSTILE;
7577
}
7678

7779
/**

src/world/item/Recipe.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,10 @@ public static void preLoad() {
128128
Registry.RECIPES.register("candyblock", new CandyBlockRecipe());
129129
Registry.RECIPES.register("candydying", new CandyDyeRecipe());
130130

131-
// carpet mixing (any 2 carpets -> 1 of average colour)
132-
Registry.RECIPES.register("carpet", new CarpetRecipe());
133-
Registry.RECIPES.register("carpetdying", new CarpetDyeRecipe());
131+
// carpet recipes (order matters - check 16 carpets before 2 carpets!)
132+
Registry.RECIPES.register("candycarpet", new CandyCarpetRecipe()); // 1 candy ↔ 16 carpets
133+
Registry.RECIPES.register("carpet", new CarpetRecipe()); // 2 carpets -> 1 mixed
134+
Registry.RECIPES.register("carpetdying", new CarpetDyeRecipe()); // carpet + dye
134135

135136
//dyes crafted from flowers
136137
yellow_dye = register(new ItemStack(Item.DYE, 6, 6));

src/world/item/inventory/CraftingGridInventory.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ public void updateResult() {
122122
if (fullMatch != null) {
123123
matchStatus = CraftingMatchStatus.FULL_MATCH;
124124
result = fullMatch.getResult(this);
125+
Console.WriteLine($"[CraftingGridInventory.updateResult] Matched recipe: {fullMatch.GetType().Name}, result: {result.getItem()?.name ?? "EMPTY"}");
125126
lastMatchedRecipe = fullMatch; // for use in CraftingResultSlot.take()
126127
return;
127128
}

0 commit comments

Comments
 (0)