Skip to content

Commit

Permalink
Add trial spawner and ominous vault. (#1727)
Browse files Browse the repository at this point in the history
* Add ominous vault.

* Add trial spawner.
  • Loading branch information
leMaik authored May 13, 2024
1 parent d6c2fad commit a33fbb2
Show file tree
Hide file tree
Showing 6 changed files with 210 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1118,8 +1118,9 @@ private static void addBlocks(Texture texture, String... names) {
Texture.crafterNorth, Texture.crafterNorthCrafting, Texture.crafterEast, Texture.crafterEastCrafting, Texture.crafterEastTriggered,
Texture.crafterSouth, Texture.crafterSouthTriggered, Texture.crafterWest, Texture.crafterWestCrafting, Texture.crafterWestTriggered,
Texture.crafterTop, Texture.crafterTopCrafting, Texture.crafterTopTriggered, Texture.crafterBottom));
addBlock("vault", (name, tag) -> new Vault(tag.get("Properties").get("facing").stringValue("north"), tag.get("Properties").get("vault_state").stringValue("active")));
addBlock("vault", (name, tag) -> new Vault(tag.get("Properties").get("facing").stringValue("north"), tag.get("Properties").get("ominous").stringValue().equals("true"), tag.get("Properties").get("vault_state").stringValue("active")));
addBlock("heavy_core", (name, tag) -> new HeavyCore());
addBlock("trial_spawner", (name, tag) -> new TrialSpawner(tag.get("Properties").get("ominous").stringValue().equals("true"), tag.get("Properties").get("trial_spawner_state").stringValue("active")));
}

@Override
Expand Down
19 changes: 19 additions & 0 deletions chunky/src/java/se/llbit/chunky/block/minecraft/TrialSpawner.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package se.llbit.chunky.block.minecraft;

import se.llbit.chunky.block.AbstractModelBlock;
import se.llbit.chunky.model.minecraft.TrialSpawnerModel;

public class TrialSpawner extends AbstractModelBlock {
private final String description;

public TrialSpawner(boolean ominous, String trialSpawnerState) {
super("trial_spawner", TrialSpawnerModel.getTopTexture(ominous, trialSpawnerState));
this.description = "ominous=" + ominous + ", trial_spawner_state=" + trialSpawnerState;
this.model = new TrialSpawnerModel(ominous, trialSpawnerState);
}

@Override
public String description() {
return description;
}
}
8 changes: 4 additions & 4 deletions chunky/src/java/se/llbit/chunky/block/minecraft/Vault.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
public class Vault extends AbstractModelBlock {
private final String description;

public Vault(String facing, String vaultState) {
super("vault", VaultModel.getTopTexture(vaultState));
this.description = "facing=" + facing + ", vault_state=" + vaultState;
this.model = new VaultModel(facing, vaultState);
public Vault(String facing, boolean ominous, String vaultState) {
super("vault", VaultModel.getTopTexture(ominous, vaultState));
this.description = "facing=" + facing + ", ominous=" + ominous + ", vault_state=" + vaultState;
this.model = new VaultModel(facing, ominous, vaultState);
}

@Override
Expand Down
135 changes: 135 additions & 0 deletions chunky/src/java/se/llbit/chunky/model/minecraft/TrialSpawnerModel.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
package se.llbit.chunky.model.minecraft;

import se.llbit.chunky.model.QuadModel;
import se.llbit.chunky.resources.Texture;
import se.llbit.math.Quad;
import se.llbit.math.Vector3;
import se.llbit.math.Vector4;

public class TrialSpawnerModel extends QuadModel {
private static final Quad[] quads = new Quad[]{
new Quad(
new Vector3(0 / 16.0, 16 / 16.0, 16 / 16.0),
new Vector3(16 / 16.0, 16 / 16.0, 16 / 16.0),
new Vector3(0 / 16.0, 16 / 16.0, 0 / 16.0),
new Vector4(0 / 16.0, 16 / 16.0, 0 / 16.0, 16 / 16.0)
),
new Quad(
new Vector3(0 / 16.0, 0 / 16.0, 0 / 16.0),
new Vector3(16 / 16.0, 0 / 16.0, 0 / 16.0),
new Vector3(0 / 16.0, 0 / 16.0, 16 / 16.0),
new Vector4(0 / 16.0, 16 / 16.0, 0 / 16.0, 16 / 16.0)
),
new Quad(
new Vector3(0 / 16.0, 16 / 16.0, 16 / 16.0),
new Vector3(0 / 16.0, 16 / 16.0, 0 / 16.0),
new Vector3(0 / 16.0, 0 / 16.0, 16 / 16.0),
new Vector4(16 / 16.0, 0 / 16.0, 16 / 16.0, 0 / 16.0)
),
new Quad(
new Vector3(16 / 16.0, 16 / 16.0, 0 / 16.0),
new Vector3(16 / 16.0, 16 / 16.0, 16 / 16.0),
new Vector3(16 / 16.0, 0 / 16.0, 0 / 16.0),
new Vector4(16 / 16.0, 0 / 16.0, 16 / 16.0, 0 / 16.0)
),
new Quad(
new Vector3(0 / 16.0, 16 / 16.0, 0 / 16.0),
new Vector3(16 / 16.0, 16 / 16.0, 0 / 16.0),
new Vector3(0 / 16.0, 0 / 16.0, 0 / 16.0),
new Vector4(16 / 16.0, 0 / 16.0, 16 / 16.0, 0 / 16.0)
),
new Quad(
new Vector3(16 / 16.0, 16 / 16.0, 16 / 16.0),
new Vector3(0 / 16.0, 16 / 16.0, 16 / 16.0),
new Vector3(16 / 16.0, 0 / 16.0, 16 / 16.0),
new Vector4(16 / 16.0, 0 / 16.0, 16 / 16.0, 0 / 16.0)
),
new Quad(
new Vector3(15.998 / 16.0, 15.998 / 16.0, 15.998 / 16.0),
new Vector3(0.002 / 16.0, 15.998 / 16.0, 15.998 / 16.0),
new Vector3(15.998 / 16.0, 15.998 / 16.0, 0.002 / 16.0),
new Vector4(16 / 16.0, 0 / 16.0, 0 / 16.0, 16 / 16.0)
),
new Quad(
new Vector3(15.998 / 16.0, 0.002 / 16.0, 0.002 / 16.0),
new Vector3(0.002 / 16.0, 0.002 / 16.0, 0.002 / 16.0),
new Vector3(15.998 / 16.0, 0.002 / 16.0, 15.998 / 16.0),
new Vector4(16 / 16.0, 0 / 16.0, 0 / 16.0, 16 / 16.0)
),
new Quad(
new Vector3(15.998 / 16.0, 15.998 / 16.0, 15.998 / 16.0),
new Vector3(15.998 / 16.0, 15.998 / 16.0, 0.002 / 16.0),
new Vector3(15.998 / 16.0, 0.002 / 16.0, 15.998 / 16.0),
new Vector4(0 / 16.0, 16 / 16.0, 16 / 16.0, 0 / 16.0)
),
new Quad(
new Vector3(0.002 / 16.0, 15.998 / 16.0, 0.002 / 16.0),
new Vector3(0.002 / 16.0, 15.998 / 16.0, 15.998 / 16.0),
new Vector3(0.002 / 16.0, 0.002 / 16.0, 0.002 / 16.0),
new Vector4(0 / 16.0, 16 / 16.0, 16 / 16.0, 0 / 16.0)
),
new Quad(
new Vector3(15.998 / 16.0, 15.998 / 16.0, 0.002 / 16.0),
new Vector3(0.002 / 16.0, 15.998 / 16.0, 0.002 / 16.0),
new Vector3(15.998 / 16.0, 0.002 / 16.0, 0.002 / 16.0),
new Vector4(0 / 16.0, 16 / 16.0, 16 / 16.0, 0 / 16.0)
),
new Quad(
new Vector3(0.002 / 16.0, 15.998 / 16.0, 15.998 / 16.0),
new Vector3(15.998 / 16.0, 15.998 / 16.0, 15.998 / 16.0),
new Vector3(0.002 / 16.0, 0.002 / 16.0, 15.998 / 16.0),
new Vector4(0 / 16.0, 16 / 16.0, 16 / 16.0, 0 / 16.0)
)
};

private final Texture[] textures;

public TrialSpawnerModel(
boolean ominous, String trialSpawnerState
) {
Texture top = getTopTexture(ominous, trialSpawnerState);
Texture bottom = Texture.trialSpawnerBottom;
Texture side;
switch (trialSpawnerState) {
case "active":
case "waiting_for_players":
case "waiting_for_reward_ejection":
case "ejecting_reward":
side = ominous ? Texture.trialSpawnerSideActiveOminous : Texture.trialSpawnerSideActive;
break;
case "inactive":
case "cooldown":
default:
side = ominous ? Texture.trialSpawnerSideInactiveOminous : Texture.trialSpawnerSideInactive;
break;
}
textures = new Texture[]{
top, bottom, side, side, side, side, top, bottom, side, side, side, side
};
}

public static Texture getTopTexture(boolean ominous, String trialSpawnerState) {
switch (trialSpawnerState) {
case "active":
case "waiting_for_players":
case "waiting_for_reward_ejection":
return ominous ? Texture.trialSpawnerTopActiveOminous : Texture.trialSpawnerTopActive;
case "ejecting_reward":
return ominous ? Texture.trialSpawnerTopEjectingRewardOminous : Texture.trialSpawnerTopEjectingReward;
case "inactive":
case "cooldown":
default:
return ominous ? Texture.trialSpawnerTopInactiveOminous : Texture.trialSpawnerTopInactive;
}
}

@Override
public Quad[] getQuads() {
return quads;
}

@Override
public Texture[] getTextures() {
return textures;
}
}
24 changes: 12 additions & 12 deletions chunky/src/java/se/llbit/chunky/model/minecraft/VaultModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,42 +95,42 @@ public class VaultModel extends QuadModel {
private final Texture[] textures;

public VaultModel(
String facing, String vaultState
String facing, boolean ominous, String vaultState
) {
quads = orientedQuads[getOrientationIndex(facing)];
Texture top = getTopTexture(vaultState);
Texture bottom = Texture.vaultBottom;
Texture top = getTopTexture(ominous, vaultState);
Texture bottom = ominous ? Texture.vaultBottomOminous : Texture.vaultBottom;
Texture front, side;
switch (vaultState) {
case "ejecting":
case "unlocking":
front = Texture.vaultFrontEjecting;
side = Texture.vaultSideOn;
front = ominous ? Texture.vaultFrontEjectingOminous : Texture.vaultFrontEjecting;
side = ominous ? Texture.vaultSideOnOminous : Texture.vaultSideOn;
break;
case "inactive":
front = Texture.vaultFrontOff;
side = Texture.vaultSideOff;
front = ominous ? Texture.vaultFrontOffOminous : Texture.vaultFrontOff;
side = ominous ? Texture.vaultSideOffOminous : Texture.vaultSideOff;
break;
case "active":
default:
front = Texture.vaultFrontOn;
side = Texture.vaultSideOn;
front = ominous ? Texture.vaultFrontOnOminous : Texture.vaultFrontOn;
side = ominous ? Texture.vaultSideOnOminous : Texture.vaultSideOn;
break;
}
textures = new Texture[]{
top, bottom, side, side, front, side, top, bottom, side, side, front, side
};
}

public static Texture getTopTexture(String vaultState) {
public static Texture getTopTexture(boolean ominous, String vaultState) {
switch (vaultState) {
case "ejecting":
return Texture.vaultTopEjecting;
return ominous ? Texture.vaultTopEjectingOminous : Texture.vaultTopEjecting;
case "inactive":
case "active":
case "unlocking":
default:
return Texture.vaultTop;
return ominous ? Texture.vaultTopOminous : Texture.vaultTop;
}
}

Expand Down
38 changes: 38 additions & 0 deletions chunky/src/java/se/llbit/chunky/resources/Texture.java
Original file line number Diff line number Diff line change
Expand Up @@ -1473,6 +1473,44 @@ public class Texture {
public static final Texture decoratedPotPatternScrape = new Texture();
@TexturePath("assets/minecraft/textures/block/heavy_core")
public static final Texture heavyCore = new Texture();
@TexturePath("assets/minecraft/textures/block/vault_bottom_ominous")
public static final Texture vaultBottomOminous = new Texture();
@TexturePath("assets/minecraft/textures/block/vault_front_off_ominous")
public static final Texture vaultFrontOffOminous = new Texture();
@TexturePath("assets/minecraft/textures/block/vault_side_off_ominous")
public static final Texture vaultSideOffOminous = new Texture();
@TexturePath("assets/minecraft/textures/block/vault_top_ominous")
public static final Texture vaultTopOminous = new Texture();
@TexturePath("assets/minecraft/textures/block/vault_side_on_ominous")
public static final Texture vaultSideOnOminous = new Texture();
@TexturePath("assets/minecraft/textures/block/vault_front_on_ominous")
public static final Texture vaultFrontOnOminous = new Texture();
@TexturePath("assets/minecraft/textures/block/vault_top_ejecting_ominous")
public static final Texture vaultTopEjectingOminous = new Texture();
@TexturePath("assets/minecraft/textures/block/vault_front_ejecting_ominous")
public static final Texture vaultFrontEjectingOminous = new Texture();
@TexturePath("assets/minecraft/textures/block/trial_spawner_bottom")
public static final Texture trialSpawnerBottom = new Texture();
@TexturePath("assets/minecraft/textures/block/trial_spawner_side_inactive")
public static final Texture trialSpawnerSideInactive = new Texture();
@TexturePath("assets/minecraft/textures/block/trial_spawner_side_inactive_ominous")
public static final Texture trialSpawnerSideInactiveOminous = new Texture();
@TexturePath("assets/minecraft/textures/block/trial_spawner_top_inactive")
public static final Texture trialSpawnerTopInactive = new Texture();
@TexturePath("assets/minecraft/textures/block/trial_spawner_top_inactive_ominous")
public static final Texture trialSpawnerTopInactiveOminous = new Texture();
@TexturePath("assets/minecraft/textures/block/trial_spawner_side_active")
public static final Texture trialSpawnerSideActive = new Texture();
@TexturePath("assets/minecraft/textures/block/trial_spawner_side_active_ominous")
public static final Texture trialSpawnerSideActiveOminous = new Texture();
@TexturePath("assets/minecraft/textures/block/trial_spawner_top_active")
public static final Texture trialSpawnerTopActive = new Texture();
@TexturePath("assets/minecraft/textures/block/trial_spawner_top_active_ominous")
public static final Texture trialSpawnerTopActiveOminous = new Texture();
@TexturePath("assets/minecraft/textures/block/trial_spawner_top_ejecting_reward")
public static final Texture trialSpawnerTopEjectingReward = new Texture();
@TexturePath("assets/minecraft/textures/block/trial_spawner_top_ejecting_reward_ominous")
public static final Texture trialSpawnerTopEjectingRewardOminous = new Texture();

/** Banner base texture. */
public static final Texture bannerBase = new Texture();
Expand Down

0 comments on commit a33fbb2

Please sign in to comment.