-
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.
[~] Big Door tweaks, Ladder variant implementation (WIP)
- Loading branch information
1 parent
af8ff98
commit e313541
Showing
131 changed files
with
495 additions
and
112 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
47 changes: 47 additions & 0 deletions
47
src/main/java/com/starfish_studios/foundation/block/FoundationLadderBlock.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 @@ | ||
package com.starfish_studios.foundation.block; | ||
|
||
import com.starfish_studios.foundation.block.properties.FoundationBlockStateProperties; | ||
import com.starfish_studios.foundation.block.properties.WoodStyle; | ||
import com.starfish_studios.foundation.registry.FoundationItems; | ||
import com.starfish_studios.foundation.registry.FoundationTags; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.core.Direction; | ||
import net.minecraft.world.InteractionHand; | ||
import net.minecraft.world.InteractionResult; | ||
import net.minecraft.world.entity.player.Player; | ||
import net.minecraft.world.level.Level; | ||
import net.minecraft.world.level.block.Block; | ||
import net.minecraft.world.level.block.Blocks; | ||
import net.minecraft.world.level.block.LadderBlock; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import net.minecraft.world.level.block.state.StateDefinition; | ||
import net.minecraft.world.level.block.state.properties.EnumProperty; | ||
import net.minecraft.world.level.block.state.properties.IntegerProperty; | ||
import net.minecraft.world.phys.BlockHitResult; | ||
|
||
public class FoundationLadderBlock extends LadderBlock { | ||
public static IntegerProperty STYLE = FoundationBlockStateProperties.STYLE; | ||
public FoundationLadderBlock(int defaultStyle, Properties properties) { | ||
super(properties); | ||
this.registerDefaultState(this.stateDefinition.any() | ||
.setValue(FACING, Direction.NORTH) | ||
.setValue(WATERLOGGED, false) | ||
.setValue(STYLE, defaultStyle)); | ||
} | ||
|
||
@Override | ||
public InteractionResult use(BlockState state, Level level, BlockPos blockPos, Player player, InteractionHand hand, BlockHitResult hitResult) { | ||
if (player.getItemInHand(hand).is(FoundationTags.FoundationItemTags.HAMMERS)) { | ||
level.setBlock(blockPos, state.cycle(STYLE), 3); | ||
level.playSound(null, blockPos, Blocks.SCAFFOLDING.getSoundType(level.getBlockState(blockPos)).getPlaceSound(), player.getSoundSource(), 1.0F, 1.0F); | ||
return InteractionResult.SUCCESS; | ||
} | ||
return InteractionResult.PASS; | ||
} | ||
|
||
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) { | ||
builder.add(FACING, WATERLOGGED, STYLE); | ||
} | ||
|
||
|
||
} |
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
31 changes: 31 additions & 0 deletions
31
src/main/java/com/starfish_studios/foundation/block/properties/WoodStyle.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,31 @@ | ||
package com.starfish_studios.foundation.block.properties; | ||
|
||
import net.minecraft.util.StringRepresentable; | ||
|
||
public enum WoodStyle implements StringRepresentable { | ||
OAK("oak"), | ||
SPRUCE("spruce"), | ||
BIRCH("birch"), | ||
JUNGLE("jungle"), | ||
ACACIA("acacia"), | ||
DARK_OAK("dark_oak"), | ||
MANGROVE("mangrove"), | ||
BAMBOO("bamboo"), | ||
CHERRY("cherry"), | ||
CRIMSON("crimson"), | ||
WARPED("warped"); | ||
|
||
private final String name; | ||
|
||
private WoodStyle(String type) { | ||
this.name = type; | ||
} | ||
|
||
public String toString() { | ||
return this.name; | ||
} | ||
|
||
public String getSerializedName() { | ||
return this.name; | ||
} | ||
} |
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.