-
Notifications
You must be signed in to change notification settings - Fork 395
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix top row of shapes on tanks and silos
- Loading branch information
Showing
4 changed files
with
53 additions
and
45 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
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
36 changes: 0 additions & 36 deletions
36
...ain/java/blusunrize/immersiveengineering/common/blocks/multiblocks/shapes/SiloShapes.java
This file was deleted.
Oops, something went wrong.
47 changes: 47 additions & 0 deletions
47
...java/blusunrize/immersiveengineering/common/blocks/multiblocks/shapes/SiloTankShapes.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,47 @@ | ||
/* | ||
* BluSunrize | ||
* Copyright (c) 2023 | ||
* | ||
* This code is licensed under "Blu's License of Common Sense" | ||
* Details can be found in the license file in the root folder of this project | ||
*/ | ||
|
||
package blusunrize.immersiveengineering.common.blocks.multiblocks.shapes; | ||
|
||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.world.phys.shapes.Shapes; | ||
import net.minecraft.world.phys.shapes.VoxelShape; | ||
|
||
import java.util.function.Function; | ||
|
||
public record SiloTankShapes(int height) implements Function<BlockPos, VoxelShape> | ||
{ | ||
@Override | ||
public VoxelShape apply(BlockPos posInMultiblock) | ||
{ | ||
boolean isCenter = posInMultiblock.getX()==1&&posInMultiblock.getZ()==1; | ||
if(!isCenter&&posInMultiblock.getY()==0) | ||
{ | ||
// Wooden supports | ||
float xMin = posInMultiblock.getX()==2?.75f: 0; | ||
float xMax = posInMultiblock.getX()==0?.25f: 1; | ||
float zMin = posInMultiblock.getZ()==2?.75f: 0; | ||
float zMax = posInMultiblock.getZ()==0?.25f: 1; | ||
return Shapes.box(xMin, 0, zMin, xMax, 1, zMax); | ||
} | ||
else if(!isCenter&&posInMultiblock.getY()==height) | ||
{ | ||
// Top level of the tank, stair-like structure | ||
float xMin = posInMultiblock.getX()==0?0.5f: 0; | ||
float xMax = posInMultiblock.getX()==2?0.5f: 1; | ||
float zMin = posInMultiblock.getZ()==0?0.5f: 0; | ||
float zMax = posInMultiblock.getZ()==2?0.5f: 1; | ||
return Shapes.or( | ||
Shapes.box(0, 0, 0, 1, 0.5, 1), | ||
Shapes.box(xMin, 0, zMin, xMax, 1, zMax) | ||
); | ||
} | ||
else | ||
return Shapes.block(); | ||
} | ||
} |