-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update hanging sign models, add wall hanging sign.
- Loading branch information
Showing
7 changed files
with
568 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
chunky/src/java/se/llbit/chunky/block/WallHangingSign.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package se.llbit.chunky.block; | ||
|
||
import se.llbit.chunky.entity.Entity; | ||
import se.llbit.chunky.entity.SignEntity; | ||
import se.llbit.chunky.entity.WallHangingSignEntity; | ||
import se.llbit.chunky.renderer.scene.Scene; | ||
import se.llbit.math.Ray; | ||
import se.llbit.math.Vector3; | ||
import se.llbit.nbt.CompoundTag; | ||
|
||
public class WallHangingSign extends MinecraftBlockTranslucent { | ||
private final String material; | ||
private final Facing facing; | ||
|
||
public WallHangingSign(String name, String material, String facing) { | ||
super(name, SignEntity.textureFromMaterial(material)); | ||
this.material = material; | ||
this.facing = Facing.fromString(facing); | ||
invisible = true; | ||
solid = false; | ||
localIntersect = true; | ||
} | ||
|
||
@Override | ||
public boolean intersect(Ray ray, Scene scene) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean isBlockEntity() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public Entity toBlockEntity(Vector3 position, CompoundTag entityTag) { | ||
return new WallHangingSignEntity(position, entityTag, facing, material); | ||
} | ||
|
||
public enum Facing { | ||
NORTH, EAST, SOUTH, WEST; | ||
|
||
public static Facing fromString(String facing) { | ||
switch (facing) { | ||
case "east": | ||
return EAST; | ||
case "south": | ||
return SOUTH; | ||
case "west": | ||
return WEST; | ||
case "north": | ||
default: | ||
return NORTH; | ||
} | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
switch (this) { | ||
case EAST: | ||
return "east"; | ||
case SOUTH: | ||
return "south"; | ||
case WEST: | ||
return "west"; | ||
case NORTH: | ||
default: | ||
return "north"; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.