-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/starfish-studios/Foundation
- Loading branch information
Showing
124 changed files
with
7,413 additions
and
471 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
9 changes: 9 additions & 0 deletions
9
src/main/java/com/starfish_studios/foundation/FoundationClient.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
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
61 changes: 54 additions & 7 deletions
61
src/main/java/com/starfish_studios/foundation/block/IronFenceBlock.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 |
---|---|---|
@@ -1,27 +1,74 @@ | ||
package com.starfish_studios.foundation.block; | ||
|
||
import com.starfish_studios.foundation.registry.FoundationTags; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.core.Direction; | ||
import net.minecraft.tags.BlockTags; | ||
import net.minecraft.world.item.context.BlockPlaceContext; | ||
import net.minecraft.world.level.LevelAccessor; | ||
import net.minecraft.world.level.LevelReader; | ||
import net.minecraft.world.level.block.Block; | ||
import net.minecraft.world.level.block.FenceBlock; | ||
import net.minecraft.world.level.block.FenceGateBlock; | ||
import net.minecraft.world.level.block.WallBlock; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import net.minecraft.world.level.material.FluidState; | ||
import net.minecraft.world.level.material.Fluids; | ||
|
||
public class IronFenceBlock extends FenceBlock { | ||
public class IronFenceBlock extends WallBlock { | ||
public IronFenceBlock(Properties properties) { | ||
super(properties); | ||
} | ||
|
||
@Override | ||
public boolean connectsTo(BlockState blockState, boolean bl, Direction direction) { | ||
Block block = blockState.getBlock(); | ||
boolean bl2 = this.isSameFence(blockState); | ||
boolean bl3 = block instanceof FenceGateBlock && FenceGateBlock.connectsToDirection(blockState, direction); | ||
return !isExceptionForConnection(blockState) && bl || bl2 || bl3; | ||
boolean bl2 = block instanceof FenceGateBlock && FenceGateBlock.connectsToDirection(blockState, direction); | ||
return blockState.is(FoundationTags.FoundationBlockTags.METAL_FENCES) || !isExceptionForConnection(blockState) && bl || bl2; | ||
} | ||
|
||
@Override | ||
public BlockState getStateForPlacement(BlockPlaceContext blockPlaceContext) { | ||
LevelReader levelReader = blockPlaceContext.getLevel(); | ||
BlockPos blockPos = blockPlaceContext.getClickedPos(); | ||
FluidState fluidState = blockPlaceContext.getLevel().getFluidState(blockPlaceContext.getClickedPos()); | ||
BlockPos blockPos2 = blockPos.north(); | ||
BlockPos blockPos3 = blockPos.east(); | ||
BlockPos blockPos4 = blockPos.south(); | ||
BlockPos blockPos5 = blockPos.west(); | ||
BlockPos blockPos6 = blockPos.above(); | ||
BlockState blockState = levelReader.getBlockState(blockPos2); | ||
BlockState blockState2 = levelReader.getBlockState(blockPos3); | ||
BlockState blockState3 = levelReader.getBlockState(blockPos4); | ||
BlockState blockState4 = levelReader.getBlockState(blockPos5); | ||
BlockState blockState5 = levelReader.getBlockState(blockPos6); | ||
boolean bl = this.connectsTo(blockState, blockState.isFaceSturdy(levelReader, blockPos2, Direction.SOUTH), Direction.SOUTH); | ||
boolean bl2 = this.connectsTo(blockState2, blockState2.isFaceSturdy(levelReader, blockPos3, Direction.WEST), Direction.WEST); | ||
boolean bl3 = this.connectsTo(blockState3, blockState3.isFaceSturdy(levelReader, blockPos4, Direction.NORTH), Direction.NORTH); | ||
boolean bl4 = this.connectsTo(blockState4, blockState4.isFaceSturdy(levelReader, blockPos5, Direction.EAST), Direction.EAST); | ||
BlockState blockState6 = this.defaultBlockState().setValue(WATERLOGGED, fluidState.getType() == Fluids.WATER); | ||
return this.updateShape(levelReader, blockState6, blockPos6, blockState5, bl, bl2, bl3, bl4); | ||
} | ||
|
||
public BlockState updateShape(BlockState blockState, Direction direction, BlockState blockState2, LevelAccessor levelAccessor, BlockPos blockPos, BlockPos blockPos2) { | ||
if (blockState.getValue(WATERLOGGED)) { | ||
levelAccessor.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(levelAccessor)); | ||
} | ||
|
||
if (direction == Direction.DOWN) { | ||
return super.updateShape(blockState, direction, blockState2, levelAccessor, blockPos, blockPos2); | ||
} else { | ||
return direction == Direction.UP ? this.topUpdate(levelAccessor, blockState, blockPos2, blockState2) : this.sideUpdate(levelAccessor, blockPos, blockState, blockPos2, blockState2, direction); | ||
} | ||
} | ||
|
||
private boolean isSameFence(BlockState blockState) { | ||
return blockState.is(BlockTags.FENCES) && blockState.is(FoundationTags.FoundationBlockTags.METAL_FENCES) == this.defaultBlockState().is(FoundationTags.FoundationBlockTags.METAL_FENCES); | ||
private BlockState sideUpdate(LevelReader levelReader, BlockPos blockPos, BlockState blockState, BlockPos blockPos2, BlockState blockState2, Direction direction) { | ||
Direction direction2 = direction.getOpposite(); | ||
boolean bl = direction == Direction.NORTH ? this.connectsTo(blockState2, blockState2.isFaceSturdy(levelReader, blockPos2, direction2), direction2) : isConnected(blockState, NORTH_WALL); | ||
boolean bl2 = direction == Direction.EAST ? this.connectsTo(blockState2, blockState2.isFaceSturdy(levelReader, blockPos2, direction2), direction2) : isConnected(blockState, EAST_WALL); | ||
boolean bl3 = direction == Direction.SOUTH ? this.connectsTo(blockState2, blockState2.isFaceSturdy(levelReader, blockPos2, direction2), direction2) : isConnected(blockState, SOUTH_WALL); | ||
boolean bl4 = direction == Direction.WEST ? this.connectsTo(blockState2, blockState2.isFaceSturdy(levelReader, blockPos2, direction2), direction2) : isConnected(blockState, WEST_WALL); | ||
BlockPos blockPos3 = blockPos.above(); | ||
BlockState blockState3 = levelReader.getBlockState(blockPos3); | ||
return this.updateShape(levelReader, blockState, blockPos3, blockState3, bl, bl2, bl3, bl4); | ||
} | ||
} |
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
25 changes: 25 additions & 0 deletions
25
src/main/java/com/starfish_studios/foundation/block/properties/FrameStickDirection.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,25 @@ | ||
package com.starfish_studios.foundation.block.properties; | ||
|
||
import net.minecraft.util.StringRepresentable; | ||
|
||
public enum FrameStickDirection implements StringRepresentable { | ||
LEFT("left"), | ||
VERTICAL("vertical"), | ||
HORIZONTAL("horizontal"), | ||
RIGHT("right"), | ||
NONE("none"); | ||
|
||
private final String name; | ||
|
||
private FrameStickDirection(String type) { | ||
this.name = type; | ||
} | ||
|
||
public String toString() { | ||
return this.name; | ||
} | ||
|
||
public String getSerializedName() { | ||
return this.name; | ||
} | ||
} |
33 changes: 0 additions & 33 deletions
33
src/main/java/com/starfish_studios/foundation/event/FoundationBlockUseEvent.java
This file was deleted.
Oops, something went wrong.
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
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.