-
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.
Add 22w42a (crafter) and 22w43a (copper & tuff additions) blocks (#1657)
* 22w42a (crafter) and 22w43a (copper & tuff additions) * code cleanup
- Loading branch information
1 parent
3cced1a
commit 26cad1e
Showing
9 changed files
with
493 additions
and
32 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
12 changes: 12 additions & 0 deletions
12
chunky/src/java/se/llbit/chunky/block/SolidNonOpaqueBlock.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,12 @@ | ||
package se.llbit.chunky.block; | ||
|
||
import se.llbit.chunky.resources.Texture; | ||
|
||
public class SolidNonOpaqueBlock extends Block { | ||
|
||
public SolidNonOpaqueBlock(String name, Texture texture) { | ||
super(name, texture); | ||
solid = true; | ||
opaque = false; | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
chunky/src/java/se/llbit/chunky/block/minecraft/CopperBulb.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,44 @@ | ||
/* | ||
* Copyright (c) 2023 Chunky contributors | ||
* | ||
* This file is part of Chunky. | ||
* | ||
* Chunky is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Chunky is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* You should have received a copy of the GNU General Public License | ||
* along with Chunky. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package se.llbit.chunky.block.minecraft; | ||
|
||
import se.llbit.chunky.block.MinecraftBlock; | ||
import se.llbit.chunky.resources.Texture; | ||
|
||
public class CopperBulb extends MinecraftBlock { | ||
private final boolean lit; | ||
private final boolean powered; | ||
|
||
public CopperBulb(String name, boolean lit, boolean powered, Texture lp, Texture lnp, Texture nlp, Texture nlnp) { | ||
super(name, lit ? (powered ? lp : lnp) : (powered ? nlp : nlnp)); | ||
this.lit = lit; | ||
this.powered = powered; | ||
} | ||
public boolean isLit() { | ||
return lit; | ||
} | ||
|
||
public boolean isPowered() { | ||
return powered; | ||
} | ||
|
||
@Override public String description() { | ||
return "lit=" + lit + ", powered=" + powered; | ||
} | ||
} |
100 changes: 100 additions & 0 deletions
100
chunky/src/java/se/llbit/chunky/block/minecraft/Crafter.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,100 @@ | ||
/* | ||
* Copyeast (c) 2023 Chunky contributors | ||
* | ||
* This file is part of Chunky. | ||
* | ||
* Chunky is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Chunky is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* You should have received a copy of the GNU General Public License | ||
* along with Chunky. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package se.llbit.chunky.block.minecraft; | ||
|
||
import se.llbit.chunky.block.AbstractModelBlock; | ||
import se.llbit.chunky.model.RotatableBlockModel; | ||
import se.llbit.chunky.resources.Texture; | ||
import se.llbit.math.Quad; | ||
import se.llbit.math.Vector3; | ||
import se.llbit.math.Vector4; | ||
|
||
public class Crafter extends AbstractModelBlock { | ||
|
||
private final String description; | ||
|
||
public Crafter(String name, String orientation, boolean crafting, boolean triggered, Texture north, Texture northCrafting, Texture east, Texture eastCrafting, Texture eastTriggered, | ||
Texture south, Texture southTriggered, Texture west, Texture westCrafting, Texture westTriggered, Texture top, Texture topCrafting, Texture topTriggered, Texture bottom) { | ||
super(name, north); | ||
this.description = "orientation=" + orientation + ", crafting=" + crafting + ", triggered=" + triggered; | ||
RotatableBlockModel m = new RotatableBlockModel(crafting ? northCrafting : north, | ||
crafting ? eastCrafting : (triggered ? eastTriggered : east), | ||
triggered ? southTriggered : south, | ||
crafting ? westCrafting : (triggered ? westTriggered : west), | ||
crafting ? topCrafting : (triggered ? topTriggered : top), | ||
bottom); | ||
// Fix top quad | ||
m.setFaceQuad(4, new Quad( | ||
new Vector3(1, 1, 0), | ||
new Vector3(0, 1, 0), | ||
new Vector3(1, 1, 1), | ||
new Vector4(1, 0, 0, 1))); // texture is mirrored for some reason?? | ||
switch(orientation) { | ||
case "north_up": | ||
break; | ||
case "east_up": | ||
m.rotateY(1); | ||
break; | ||
case "south_up": | ||
m.rotateY(2); | ||
break; | ||
case "west_up": | ||
m.rotateY(-1); | ||
break; | ||
case "up_south": | ||
m.rotateX(1); | ||
break; | ||
case "up_west": | ||
m.rotateX(1); | ||
m.rotateY(1); | ||
break; | ||
case "up_north": | ||
m.rotateX(1); | ||
m.rotateY(2); | ||
break; | ||
case "up_east": | ||
m.rotateX(1); | ||
m.rotateY(-1); | ||
break; | ||
case "down_north": | ||
m.rotateX(-1); | ||
break; | ||
case "down_east": | ||
m.rotateX(-1); | ||
m.rotateY(1); | ||
break; | ||
case "down_south": | ||
m.rotateX(-1); | ||
m.rotateY(2); | ||
break; | ||
case "down_west": | ||
m.rotateX(-1); | ||
m.rotateY(-1); | ||
break; | ||
} | ||
this.model = m; | ||
opaque = true; | ||
solid = true; | ||
} | ||
|
||
@Override | ||
public String description() { | ||
return description; | ||
} | ||
} |
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
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.