-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cf3ecdf
commit 5234d41
Showing
87 changed files
with
938 additions
and
110 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,16 @@ | ||
# Sets default memory used for gradle commands. Can be overridden by user or command line properties. | ||
# This is required to provide enough memory for the Minecraft decompilation process. | ||
org.gradle.jvmargs=-Xmx3G | ||
org.gradle.daemon=false | ||
org.gradle.daemon=false | ||
|
||
# Forge props | ||
minecraft_version = 1.16.5 | ||
mappings_version = 20201028-1.16.3 | ||
mappings_channel = snapshot | ||
forge_version = net.minecraftforge:forge:1.16.5-36.0.46 | ||
eclipse_java_version = 1.8 | ||
|
||
# Additional Bars props | ||
mod_version = 1.1.0 | ||
maven_group = com.codenamerevy.horizontalpanes | ||
archive_base_name = horizontalpanes |
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
91 changes: 91 additions & 0 deletions
91
src/main/java/com/codenamerevy/horizontalpanes/content/blocks/HorizontalPaneSlab.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,91 @@ | ||
package com.codenamerevy.horizontalpanes.content.blocks; | ||
|
||
import net.minecraft.block.*; | ||
import net.minecraft.fluid.FluidState; | ||
import net.minecraft.fluid.Fluids; | ||
import net.minecraft.item.BlockItemUseContext; | ||
import net.minecraft.state.BooleanProperty; | ||
import net.minecraft.state.EnumProperty; | ||
import net.minecraft.state.properties.BlockStateProperties; | ||
import net.minecraft.state.properties.SlabType; | ||
import net.minecraft.util.Direction; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.util.math.shapes.ISelectionContext; | ||
import net.minecraft.util.math.shapes.VoxelShape; | ||
import net.minecraft.util.math.shapes.VoxelShapes; | ||
import net.minecraft.world.IBlockReader; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
public class HorizontalPaneSlab extends SlabBlock implements IWaterLoggable { | ||
|
||
public static final EnumProperty<SlabType> TYPE = BlockStateProperties.SLAB_TYPE; | ||
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; | ||
|
||
protected static final VoxelShape SHAPE_BOT = Block.makeCuboidShape(0.0F, 6.0F, 0.0F, 16.0F, 8.0F, 16.0F); //This is a bottom shape. | ||
protected static final VoxelShape SHAPE_TOP = Block.makeCuboidShape(0.0F, 6.0F + 8.0F, 0.0F, 16.0F, 8.0F + 8.0F, 16.0F); //This is a top shape. | ||
protected static final VoxelShape SHAPE_COM = VoxelShapes.or(SHAPE_BOT, SHAPE_TOP); //This is a combined shape | ||
|
||
public HorizontalPaneSlab(Properties properties) { | ||
super(properties.notSolid().hardnessAndResistance(0.3F, 0.3F).sound(SoundType.GLASS)); | ||
this.setDefaultState(this.getDefaultState().with(TYPE, SlabType.BOTTOM).with(WATERLOGGED, false)); | ||
} | ||
|
||
@Override | ||
public boolean isTransparent(BlockState state) { | ||
return true; | ||
} | ||
|
||
@Override | ||
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { | ||
SlabType slabType = state.get(TYPE); | ||
switch(slabType) { | ||
case DOUBLE: | ||
return SHAPE_COM; | ||
case TOP: | ||
return SHAPE_TOP; | ||
default: | ||
return SHAPE_BOT; | ||
} | ||
} | ||
|
||
@Override | ||
public boolean isSideInvisible(BlockState state, BlockState adjacentBlockState, Direction side) { | ||
if (adjacentBlockState.getBlock() == Blocks.GLASS) return true; | ||
if (adjacentBlockState.getBlock() == this) if (slabSideInvisible(state, adjacentBlockState, side)) return true; | ||
|
||
return super.isSideInvisible(state, adjacentBlockState, side); | ||
} | ||
private boolean slabSideInvisible(BlockState slabState, BlockState neighbourState, Direction dir) | ||
{ | ||
SlabType slabType = slabState.get(TYPE); | ||
SlabType neighbourType = neighbourState.get(TYPE); | ||
|
||
if (neighbourType == SlabType.DOUBLE) return true; | ||
|
||
switch (dir) | ||
{ | ||
case NORTH: case SOUTH: case EAST: case WEST: | ||
if(slabType == neighbourType) return true; | ||
default: | ||
break; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public BlockState getStateForPlacement(BlockItemUseContext ctx) { | ||
BlockPos blockPos = ctx.getPos(); | ||
BlockState blockState = ctx.getWorld().getBlockState(blockPos); | ||
FluidState fluidState = ctx.getWorld().getFluidState(blockPos); | ||
if (blockState.isIn(this)) { | ||
return blockState.with(TYPE, SlabType.DOUBLE).with(WATERLOGGED, fluidState.getFluid() == Fluids.WATER); | ||
} else { | ||
BlockState blockState2 = this.getDefaultState().with(TYPE, SlabType.BOTTOM).with(WATERLOGGED, fluidState.getFluid() == Fluids.WATER); | ||
Direction direction = ctx.getFace(); | ||
return direction != Direction.DOWN && (direction == Direction.UP || !(ctx.getHitVec().y - (double)blockPos.getY() > 0.5D)) ? blockState2 : blockState2.with(TYPE, SlabType.TOP); | ||
} | ||
} | ||
} |
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
8 changes: 7 additions & 1 deletion
8
src/main/resources/assets/horizontalpanes/blockstates/horizontal_glass_pane.json
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,7 +1,13 @@ | ||
{ | ||
"variants": { | ||
"": { | ||
"type=bottom": { | ||
"model": "horizontalpanes:block/horizontal_glass_pane" | ||
}, | ||
"type=double": { | ||
"model": "horizontalpanes:block/horizontal_glass_pane_combined" | ||
}, | ||
"type=top": { | ||
"model": "horizontalpanes:block/horizontal_glass_pane_top" | ||
} | ||
} | ||
} |
7 changes: 0 additions & 7 deletions
7
src/main/resources/assets/horizontalpanes/blockstates/horizontal_pane.json
This file was deleted.
Oops, something went wrong.
8 changes: 7 additions & 1 deletion
8
src/main/resources/assets/horizontalpanes/blockstates/horizontal_stained_black_pane.json
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,7 +1,13 @@ | ||
{ | ||
"variants": { | ||
"": { | ||
"type=bottom": { | ||
"model": "horizontalpanes:block/horizontal_stained_black_pane" | ||
}, | ||
"type=double": { | ||
"model": "horizontalpanes:block/horizontal_stained_black_pane_combined" | ||
}, | ||
"type=top": { | ||
"model": "horizontalpanes:block/horizontal_stained_black_pane_top" | ||
} | ||
} | ||
} |
8 changes: 7 additions & 1 deletion
8
src/main/resources/assets/horizontalpanes/blockstates/horizontal_stained_blue_pane.json
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,7 +1,13 @@ | ||
{ | ||
"variants": { | ||
"": { | ||
"type=bottom": { | ||
"model": "horizontalpanes:block/horizontal_stained_blue_pane" | ||
}, | ||
"type=double": { | ||
"model": "horizontalpanes:block/horizontal_stained_blue_pane_combined" | ||
}, | ||
"type=top": { | ||
"model": "horizontalpanes:block/horizontal_stained_blue_pane_top" | ||
} | ||
} | ||
} |
8 changes: 7 additions & 1 deletion
8
src/main/resources/assets/horizontalpanes/blockstates/horizontal_stained_brown_pane.json
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,7 +1,13 @@ | ||
{ | ||
"variants": { | ||
"": { | ||
"type=bottom": { | ||
"model": "horizontalpanes:block/horizontal_stained_brown_pane" | ||
}, | ||
"type=double": { | ||
"model": "horizontalpanes:block/horizontal_stained_brown_pane_combined" | ||
}, | ||
"type=top": { | ||
"model": "horizontalpanes:block/horizontal_stained_brown_pane_top" | ||
} | ||
} | ||
} |
8 changes: 7 additions & 1 deletion
8
src/main/resources/assets/horizontalpanes/blockstates/horizontal_stained_cyan_pane.json
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,7 +1,13 @@ | ||
{ | ||
"variants": { | ||
"": { | ||
"type=bottom": { | ||
"model": "horizontalpanes:block/horizontal_stained_cyan_pane" | ||
}, | ||
"type=double": { | ||
"model": "horizontalpanes:block/horizontal_stained_cyan_pane_combined" | ||
}, | ||
"type=top": { | ||
"model": "horizontalpanes:block/horizontal_stained_cyan_pane_top" | ||
} | ||
} | ||
} |
8 changes: 7 additions & 1 deletion
8
src/main/resources/assets/horizontalpanes/blockstates/horizontal_stained_gray_pane.json
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,7 +1,13 @@ | ||
{ | ||
"variants": { | ||
"": { | ||
"type=bottom": { | ||
"model": "horizontalpanes:block/horizontal_stained_gray_pane" | ||
}, | ||
"type=double": { | ||
"model": "horizontalpanes:block/horizontal_stained_gray_pane_combined" | ||
}, | ||
"type=top": { | ||
"model": "horizontalpanes:block/horizontal_stained_gray_pane_top" | ||
} | ||
} | ||
} |
8 changes: 7 additions & 1 deletion
8
src/main/resources/assets/horizontalpanes/blockstates/horizontal_stained_green_pane.json
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,7 +1,13 @@ | ||
{ | ||
"variants": { | ||
"": { | ||
"type=bottom": { | ||
"model": "horizontalpanes:block/horizontal_stained_green_pane" | ||
}, | ||
"type=double": { | ||
"model": "horizontalpanes:block/horizontal_stained_green_pane_combined" | ||
}, | ||
"type=top": { | ||
"model": "horizontalpanes:block/horizontal_stained_green_pane_top" | ||
} | ||
} | ||
} |
8 changes: 7 additions & 1 deletion
8
...main/resources/assets/horizontalpanes/blockstates/horizontal_stained_light_blue_pane.json
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,7 +1,13 @@ | ||
{ | ||
"variants": { | ||
"": { | ||
"type=bottom": { | ||
"model": "horizontalpanes:block/horizontal_stained_light_blue_pane" | ||
}, | ||
"type=double": { | ||
"model": "horizontalpanes:block/horizontal_stained_light_blue_pane_combined" | ||
}, | ||
"type=top": { | ||
"model": "horizontalpanes:block/horizontal_stained_light_blue_pane_top" | ||
} | ||
} | ||
} |
Oops, something went wrong.