Skip to content

Commit

Permalink
Merge pull request #12 from ImgoodWK/master
Browse files Browse the repository at this point in the history
Added a new shape category (glow), and new graphic category registered with item IDs that are different from other shpes and come with light value. This allows for better visual effects by modifying the configuration settings based on the item ID in the presence of shader
  • Loading branch information
Dream-Master authored Feb 18, 2024
2 parents 2e9d9a0 + 3146f37 commit a14f12b
Show file tree
Hide file tree
Showing 9 changed files with 114 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/main/java/gcewing/architecture/ArchitectureCraft.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class ArchitectureCraft extends BaseMod<ArchitectureCraftClient> {

public static SawbenchBlock blockSawbench;
public static BaseBlock blockShape;

public static BaseBlock blockShapeSE;
public static Item itemSawblade;
public static Item itemLargePulley;
public static Item itemChisel;
Expand Down Expand Up @@ -75,6 +75,7 @@ protected void registerBlocks() {
blockSawbench = newBlock("sawbench", SawbenchBlock.class);
blockSawbench.setHardness(2.0F);
blockShape = newBlock("shape", ShapeBlock.class, ShapeItem.class);
blockShapeSE = newBlock("shapeSE", ShapeBlock.class, ShapeItem.class);
}

protected void registerTileEntities() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ void registerScreens() {
@Override
protected void registerBlockRenderers() {
addBlockRenderer(base.blockShape, shapeRenderDispatch);
addBlockRenderer(base.blockShapeSE, shapeRenderDispatch);
}

@Override
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/gcewing/architecture/RenderRoof.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,33 +47,43 @@ public RenderRoof(ShapeTE te, ITexture[] textures, Trans3 t, IRenderTarget targe
protected void render() {
switch (te.shape) {
case RoofTile:
case RoofTileSE:
renderSlope();
break;
case SlopeTileA1:
case SlopeTileA1SE:
renderSlopeA1();
break;
case SlopeTileA2:
case SlopeTileA2SE:
renderSlopeA2();
break;
case SlopeTileB1:
case SlopeTileB1SE:
renderSlopeB1();
break;
case SlopeTileB2:
case SlopeTileB2SE:
renderSlopeB2();
break;
case SlopeTileB3:
case SlopeTileB3SE:
renderSlopeB3();
break;
case SlopeTileC1:
case SlopeTileC1SE:
renderSlopeC1();
break;
case SlopeTileC2:
case SlopeTileC2SE:
renderSlopeC2();
break;
case SlopeTileC3:
case SlopeTileC3SE:
renderSlopeC3();
break;
case SlopeTileC4:
case SlopeTileC4SE:
renderSlopeC4();
break;
case RoofOuterCorner:
Expand Down
20 changes: 18 additions & 2 deletions src/main/java/gcewing/architecture/SawbenchTE.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,21 @@ public class SawbenchTE extends BaseTileInventory implements IRestrictedDropping
SlopeTileC1,
SlopeTileC2,
SlopeTileC3,
SlopeTileC4), };
SlopeTileC4),
new ShapePage(
"Glow",
SquareSE,
SlabSE,
RoofTileSE,
SlopeTileA1SE,
SlopeTileA2SE,
SlopeTileB1SE,
SlopeTileB2SE,
SlopeTileB3SE,
SlopeTileC1SE,
SlopeTileC2SE,
SlopeTileC3SE,
SlopeTileC4SE) };

public IInventory inventory = new InventoryBasic("Items", false, 2);
public int selectedPage = 0;
Expand Down Expand Up @@ -280,6 +294,7 @@ protected void showMaterial() {

protected ItemStack makeResultStack() {
Shape resultShape = getSelectedShape();
boolean shaderEmissive = getSelectedPageIndex() == 7;
if (resultShape != null) {
ItemStack materialStack = getStackInSlot(materialSlot);
if (materialStack != null && materialStack.stackSize >= resultShape.materialUsed) {
Expand All @@ -291,7 +306,8 @@ protected ItemStack makeResultStack() {
resultShape,
materialBlock,
materialStack.getItemDamage(),
resultShape.itemsProduced);
resultShape.itemsProduced,
shaderEmissive);
}
}
}
Expand Down
15 changes: 14 additions & 1 deletion src/main/java/gcewing/architecture/Shape.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
public enum Shape {

RoofTile(0, "Roof Tile", Roof, Bilateral, 1, 2, 0xcf),

RoofOuterCorner(1, "Roof Outer Corner", Roof, Unilateral, 1, 3, 0x4f),
RoofInnerCorner(2, "Roof Inner Corner", Roof, Unilateral, 2, 3, 0xdf),
RoofRidge(3, "Gabled Roof Ridge", Roof, Bilateral, 1, 4, 0x0f),
Expand Down Expand Up @@ -149,7 +150,19 @@ public enum Shape {
SlopeTileC1(99, "Slope C 1", Roof, Bilateral, 1, 1, 0xff),
SlopeTileC2(100, "Slope C 2", Roof, Bilateral, 1, 2, 0xcf),
SlopeTileC3(101, "Slope C 3", Roof, Bilateral, 1, 3, 0x0f),
SlopeTileC4(102, "Slope C 4", Roof, Bilateral, 1, 4, 0x0f),;
SlopeTileC4(102, "Slope C 4", Roof, Bilateral, 1, 4, 0x0f),
SlopeTileA1SE(103, "Slope A Start(Glow)", Roof, Bilateral, 1, 1, 0xcf),
SlopeTileA2SE(104, "Slope A End(Glow)", Roof, Bilateral, 1, 3, 0x0f),
SlopeTileB1SE(105, "Slope B Start(Glow)", Roof, Bilateral, 1, 1, 0xff),
SlopeTileB2SE(106, "Slope B Middle(Glow)", Roof, Bilateral, 1, 2, 0xcf),
SlopeTileB3SE(107, "Slope B End(Glow)", Roof, Bilateral, 1, 3, 0x0f),
SlopeTileC1SE(108, "Slope C 1(Glow)", Roof, Bilateral, 1, 1, 0xff),
SlopeTileC2SE(109, "Slope C 2(Glow)", Roof, Bilateral, 1, 2, 0xcf),
SlopeTileC3SE(110, "Slope C 3(Glow)", Roof, Bilateral, 1, 3, 0x0f),
SlopeTileC4SE(111, "Slope C 4(Glow)", Roof, Bilateral, 1, 4, 0x0f),
RoofTileSE(112, "Roof Tile(Glow)", Roof, Bilateral, 1, 2, 0xcf),
SquareSE(113, "Square(Glow)", Model("square"), Quadrilateral, 1, 1, 0x0),
SlabSE(114, "Slab(Glow)", Model("slab"), Quadrilateral, 1, 2, 0x0),;

public int id;
public String title;
Expand Down
23 changes: 23 additions & 0 deletions src/main/java/gcewing/architecture/ShapeKind.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,36 @@ public ItemStack newStack(Shape shape, IBlockState materialState, int stackSize)
return newStack(shape, materialState.getBlock(), getMetaFromBlockState(materialState), stackSize);
}

public ItemStack newStack(Shape shape, IBlockState materialState, int stackSize, boolean shaderEmissive) {
return newStack(
shape,
materialState.getBlock(),
getMetaFromBlockState(materialState),
stackSize,
shaderEmissive);
}

public ItemStack newStack(Shape shape, Block materialBlock, int materialMeta, int stackSize) {
ShapeTE te = new ShapeTE(shape, materialBlock, materialMeta);
int light = materialBlock.getLightValue();
ItemStack result = BaseTileEntity.blockStackWithTileEntity(ArchitectureCraft.blockShape, stackSize, light, te);
return result;
}

public ItemStack newStack(Shape shape, Block materialBlock, int materialMeta, int stackSize,
boolean shaderEmissive) {
ShapeTE te = new ShapeTE(shape, materialBlock, materialMeta);
int light = materialBlock.getLightValue();
if (shaderEmissive) {
light = 15;
ItemStack result = BaseTileEntity
.blockStackWithTileEntity(ArchitectureCraft.blockShapeSE, stackSize, light, te);
return result;
}
ItemStack result = BaseTileEntity.blockStackWithTileEntity(ArchitectureCraft.blockShape, stackSize, light, te);
return result;
}

public boolean orientOnPlacement(EntityPlayer player, ShapeTE te, BlockPos npos, IBlockState nstate, TileEntity nte,
EnumFacing otherFace, Vector3 hit) {
if (nte instanceof ShapeTE) return orientOnPlacement(player, te, (ShapeTE) nte, otherFace, hit);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Items
tile.architecturecraft:sawbench.name=Architect's Sawbench
tile.architecturecraft:shape.name=Architectural Block
tile.architecturecraft:shapeSE.name=Architectural Block(Glow)
item.architecturecraft:largePulley.name=Large Pulley
item.architecturecraft:sawblade.name=Circular Saw Blade
item.architecturecraft:chisel.name=Architect's Chisel
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
tile.architecturecraft:sawbench.name=建筑师锯台
tile.architecturecraft:shape.name=构件
tile.architecturecraft:shapeSE.name=构件(发光)
item.architecturecraft:largePulley.name=大轮
item.architecturecraft:sawblade.name=圆锯片
item.architecturecraft:chisel.name=建筑师凿
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{"bounds":[-0.5,-0.5,-0.5,0.5,0.5,0.5],
"faces":[{"texture":1,
"vertices":[[0.5,0.5,0.5,-0.0,-0.0,1.0,1.0,1.0],
[-0.5,-0.5,0.5,-0.0,-0.0,1.0,0.0,1.0],
[0.5,-0.5,0.5,-0.0,-0.0,1.0,1.0,1.0],
[-0.5,0.5,0.5,-0.0,-0.0,1.0,0.0,1.0]],
"triangles":[[0,1,2],
[1,0,3]]},
{"texture":1,
"vertices":[[-0.5,0.5,-0.5,-1.0,0.0,0.0,0.0,1.0],
[-0.5,-0.5,0.5,-1.0,0.0,0.0,1.0,1.0],
[-0.5,0.5,0.5,-1.0,0.0,0.0,1.0,1.0],
[-0.5,-0.5,-0.5,-1.0,0.0,0.0,0.0,1.0]],
"triangles":[[0,1,2],
[1,0,3]]},
{"texture":3,
"vertices":[[0.5,0.5,0.5,0.0,1.0,0.0,1.0,1.0],
[-0.5,0.5,-0.5,0.0,1.0,0.0,0.0,1.0],
[-0.5,0.5,0.5,0.0,1.0,0.0,0.0,1.0],
[0.5,0.5,-0.5,0.0,1.0,0.0,1.0,1.0]],
"triangles":[[0,1,2],
[1,0,3]]},
{"texture":1,
"vertices":[[0.5,-0.5,-0.5,1.0,0.0,0.0,1.0,1.0],
[0.5,0.5,0.5,1.0,0.0,0.0,0.0,1.0],
[0.5,-0.5,0.5,1.0,0.0,0.0,0.0,1.0],
[0.5,0.5,-0.5,1.0,0.0,0.0,1.0,1.0]],
"triangles":[[0,1,2],
[1,0,3]]},
{"texture":1,
"vertices":[[0.5,-0.5,-0.5,0.0,-1.0,0.0,0.0,1.0],
[-0.5,-0.5,0.5,0.0,-1.0,0.0,1.0,1.0],
[-0.5,-0.5,-0.5,0.0,-1.0,0.0,1.0,1.0],
[0.5,-0.5,0.5,0.0,-1.0,0.0,0.0,1.0]],
"triangles":[[0,1,2],
[1,0,3]]},
{"texture":1,
"vertices":[[-0.5,0.5,-0.5,0.0,0.0,-1.0,1.0,1.0],
[0.5,-0.5,-0.5,0.0,0.0,-1.0,0.0,1.0],
[-0.5,-0.5,-0.5,0.0,0.0,-1.0,1.0,1.0],
[0.5,0.5,-0.5,0.0,0.0,-1.0,0.0,1.0]],
"triangles":[[0,1,2],
[1,0,3]]}],
"boxes":[[-0.5,-0.5,-0.5,0.5,0.5,0.5]]}

0 comments on commit a14f12b

Please sign in to comment.