Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
buildscript {
repositories {
maven { url = 'https://files.minecraftforge.net/maven' }
jcenter()
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
}
}
apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'

version = "1.1.1-${mc_version}"
version = "1.1.1-1.17.1"
group = 'com.mrcrayfish'
archivesBaseName = 'glasscutter'

sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
java.toolchain.languageVersion = JavaLanguageVersion.of(16)

minecraft {
mappings channel: 'snapshot', version: '20201028-1.16.3'
mappings channel: 'official', version: '1.17.1'
runs {
client {
workingDirectory project.file('run')
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
mods {
modid {
glasscutter {
source sourceSets.main
}
}
Expand All @@ -36,7 +34,7 @@ minecraft {
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
mods {
modid {
glasscutter {
source sourceSets.main
}
}
Expand All @@ -48,7 +46,7 @@ minecraft {
property 'forge.logging.console.level', 'debug'
args '--mod', 'glasscutter', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
mods {
modid {
glasscutter {
source sourceSets.main
}
}
Expand All @@ -75,10 +73,10 @@ repositories {
}

dependencies {
minecraft "net.minecraftforge:forge:${mc_version}-${forge_version}"
compile fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}")
compile fg.deobf('curse.maven:configured-457570:3334897')
compile fg.deobf('curse.maven:catalogue-459701:3334740')
minecraft "net.minecraftforge:forge:1.17.1-37.0.97"
implementation fg.deobf("mezz.jei:jei-1.17.1:8.1.0.26")
runtimeOnly fg.deobf('curse.maven:configured-457570:3434072')
runtimeOnly fg.deobf('curse.maven:catalogue-459701:3399552')
}

jar {
Expand All @@ -88,7 +86,7 @@ jar {
"Specification-Vendor": "MrCrayfish",
"Specification-Version": "1", // We are version 1 of ourselves
"Implementation-Title": project.name,
"Implementation-Version": "${version}",
"Implementation-Version": project.jar.archiveVersion,
"Implementation-Vendor" : "MrCrayfish",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
Expand Down
4 changes: 0 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false

mc_version=1.16.5
jei_version=7.6.4.90
forge_version=36.1.10
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.mrcrayfish.glasscutter.block;

import net.minecraft.block.BlockState;
import net.minecraft.block.SlabBlock;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.SlabBlock;
import net.minecraft.core.Direction;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.BlockGetter;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;

Expand All @@ -24,35 +24,33 @@ public AbstractGlassSlabBlock(Supplier<BlockState> state, Properties properties)
}

@Override
public boolean isTransparent(BlockState state)
public boolean useShapeForLightOcclusion(BlockState state)
{
return true;
}

// Help, what should I use instead???!
@Override
@OnlyIn(Dist.CLIENT)
public boolean isSideInvisible(BlockState state, BlockState adjacentState, Direction side)
public boolean skipRendering(BlockState state, BlockState adjacentState, Direction side)
{
return (adjacentState.getBlock() == this && adjacentState.get(TYPE) == state.get(TYPE)) || adjacentState.getBlock() == this.state.get().getBlock() || super.isSideInvisible(state, adjacentState, side);
return (adjacentState.getBlock() == this && adjacentState.getValue(TYPE) == state.getValue(TYPE)) || adjacentState.getBlock() == this.state.get().getBlock() || super.skipRendering(state, adjacentState, side);
}

// Help, what should I use instead???!
@Override
@OnlyIn(Dist.CLIENT)
public float getAmbientOcclusionLightValue(BlockState state, IBlockReader worldIn, BlockPos pos)
public float getShadeBrightness(BlockState state, BlockGetter worldIn, BlockPos pos)
{
return 1.0F;
}

@Override
public boolean propagatesSkylightDown(BlockState state, IBlockReader reader, BlockPos pos)
public boolean propagatesSkylightDown(BlockState state, BlockGetter reader, BlockPos pos)
{
return true;
}

@Override
public boolean canSpawnInBlock() {
public boolean isPossibleToRespawnInThis() {
return false;
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.mrcrayfish.glasscutter.block;

import net.minecraft.block.BlockState;
import net.minecraft.block.StairsBlock;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.StairBlock;
import net.minecraft.core.Direction;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.BlockGetter;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;

Expand All @@ -13,7 +13,7 @@
/**
* Author: MrCrayfish
*/
public class AbstractGlassStairsBlock extends StairsBlock
public class AbstractGlassStairsBlock extends StairBlock
{
private final Supplier<BlockState> state;

Expand All @@ -24,19 +24,18 @@ public AbstractGlassStairsBlock(Supplier<BlockState> state, Properties propertie
}

@Override
public boolean isTransparent(BlockState state)
public boolean useShapeForLightOcclusion(BlockState state)
{
return true;
}

// Help, what should I use instead???!
@Override
@OnlyIn(Dist.CLIENT)
public boolean isSideInvisible(BlockState state, BlockState adjacentState, Direction side)
public boolean skipRendering(BlockState state, BlockState adjacentState, Direction side)
{
if(adjacentState.getBlock() == this && adjacentState.get(HALF) == state.get(HALF))
if(adjacentState.getBlock() == this && adjacentState.getValue(HALF) == state.getValue(HALF))
{
if(adjacentState.get(FACING) != state.get(FACING).getOpposite())
if(adjacentState.getValue(FACING) != state.getValue(FACING).getOpposite())
{
return true;
}
Expand All @@ -45,25 +44,24 @@ public boolean isSideInvisible(BlockState state, BlockState adjacentState, Direc
{
return true;
}
return super.isSideInvisible(state, adjacentState, side);
return super.skipRendering(state, adjacentState, side);
}

// Help, what should I use instead???!
@Override
@OnlyIn(Dist.CLIENT)
public float getAmbientOcclusionLightValue(BlockState state, IBlockReader worldIn, BlockPos pos)
public float getShadeBrightness(BlockState state, BlockGetter worldIn, BlockPos pos)
{
return 1.0F;
}

@Override
public boolean propagatesSkylightDown(BlockState state, IBlockReader reader, BlockPos pos)
public boolean propagatesSkylightDown(BlockState state, BlockGetter reader, BlockPos pos)
{
return true;
}

@Override
public boolean canSpawnInBlock() {
public boolean isPossibleToRespawnInThis() {
return false;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.mrcrayfish.glasscutter.block;

import net.minecraft.block.Blocks;
import net.minecraft.world.level.block.Blocks;

/**
* Author: MrCrayfish
Expand All @@ -9,6 +9,6 @@ public class GlassSlabBlock extends AbstractGlassSlabBlock
{
public GlassSlabBlock(Properties properties)
{
super(Blocks.GLASS::getDefaultState, properties);
super(Blocks.GLASS::defaultBlockState, properties);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.mrcrayfish.glasscutter.block;

import net.minecraft.block.BlockState;
import net.minecraft.world.level.block.state.BlockState;

import java.util.function.Supplier;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
package com.mrcrayfish.glasscutter.block;

import com.mrcrayfish.glasscutter.inventory.container.GlasscutterContainer;
import net.minecraft.block.Block;
import net.minecraft.block.BlockRenderType;
import net.minecraft.block.BlockState;
import net.minecraft.block.HorizontalBlock;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.container.INamedContainerProvider;
import net.minecraft.inventory.container.SimpleNamedContainerProvider;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.pathfinding.PathType;
import net.minecraft.state.DirectionProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.MenuProvider;
import net.minecraft.world.SimpleMenuProvider;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.ContainerLevelAccess;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.*;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.level.pathfinder.PathComputationType;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;

import javax.annotation.Nullable;

Expand All @@ -28,79 +29,79 @@
*/
public class GlasscutterBlock extends Block
{
private static final TranslationTextComponent CONTAINER_TITLE = new TranslationTextComponent("container.glasscutter.glasscutter");
public static final DirectionProperty DIRECTION = HorizontalBlock.HORIZONTAL_FACING;
protected static final VoxelShape SHAPE = Block.makeCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 9.0D, 16.0D);
private static final TranslatableComponent CONTAINER_TITLE = new TranslatableComponent("container.glasscutter.glasscutter");
public static final DirectionProperty DIRECTION = HorizontalDirectionalBlock.FACING;
protected static final VoxelShape SHAPE = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 9.0D, 16.0D);

public GlasscutterBlock(Properties properties)
{
super(properties);
this.setDefaultState(this.stateContainer.getBaseState().with(DIRECTION, Direction.NORTH));
this.registerDefaultState(this.stateDefinition.any().setValue(DIRECTION, Direction.NORTH));
}

@Override
public BlockState getStateForPlacement(BlockItemUseContext context)
public BlockState getStateForPlacement(BlockPlaceContext context)
{
return this.getDefaultState().with(DIRECTION, context.getPlacementHorizontalFacing().getOpposite());
return this.defaultBlockState().setValue(DIRECTION, context.getHorizontalDirection().getOpposite());
}

@Override
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity playerEntity, Hand hand, BlockRayTraceResult result)
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player playerEntity, InteractionHand hand, BlockHitResult result)
{
if(!world.isRemote)
if(!world.isClientSide)
{
playerEntity.openContainer(state.getContainer(world, pos));
playerEntity.openMenu(state.getMenuProvider(world, pos));
}
return ActionResultType.SUCCESS;
return InteractionResult.SUCCESS;
}

@Nullable
@Override
public INamedContainerProvider getContainer(BlockState state, World world, BlockPos pos)
public MenuProvider getMenuProvider(BlockState state, Level world, BlockPos pos)
{
return new SimpleNamedContainerProvider((windowId, playerInventory, playerEntity) -> {
return new GlasscutterContainer(windowId, playerInventory, IWorldPosCallable.of(world, pos));
return new SimpleMenuProvider((windowId, playerInventory, playerEntity) -> {
return new GlasscutterContainer(windowId, playerInventory, ContainerLevelAccess.create(world, pos));
}, CONTAINER_TITLE);
}

@Override
public VoxelShape getShape(BlockState state, IBlockReader reader, BlockPos pos, ISelectionContext context)
public VoxelShape getShape(BlockState state, BlockGetter reader, BlockPos pos, CollisionContext context)
{
return SHAPE;
}

@Override
public boolean isTransparent(BlockState state)
public boolean useShapeForLightOcclusion(BlockState state)
{
return true;
}

@Override
public BlockRenderType getRenderType(BlockState state)
public RenderShape getRenderShape(BlockState state)
{
return BlockRenderType.MODEL;
return RenderShape.MODEL;
}

@Override
public BlockState rotate(BlockState state, Rotation rotation)
{
return state.with(DIRECTION, rotation.rotate(state.get(DIRECTION)));
return state.setValue(DIRECTION, rotation.rotate(state.getValue(DIRECTION)));
}

@Override
public BlockState mirror(BlockState state, Mirror mirror)
{
return state.rotate(mirror.toRotation(state.get(DIRECTION)));
return state.rotate(mirror.getRotation(state.getValue(DIRECTION)));
}

@Override
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder)
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder)
{
builder.add(DIRECTION);
}

@Override
public boolean allowsMovement(BlockState state, IBlockReader reader, BlockPos pos, PathType pathType)
public boolean isPathfindable(BlockState state, BlockGetter reader, BlockPos pos, PathComputationType pathType)
{
return false;
}
Expand Down
Loading