Skip to content

Commit

Permalink
Update 2.0.0 - Pretty Sweet Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Motschen committed Sep 20, 2020
1 parent cb17179 commit 4764147
Show file tree
Hide file tree
Showing 144 changed files with 3,579 additions and 1,021 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# gradle

.gradle/
build/
build/classes/
build/generated/
build/libs/
build/resources/
build/tmp/
out/
classes/

Expand Down
19 changes: 15 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ minecraft {

repositories {
maven { url "https://jitpack.io" }
maven { url "http://server.bbkr.space/artifactory/libs-release" }
maven { url 'https://maven.blamejared.com' }
}

dependencies {
Expand All @@ -23,11 +25,20 @@ dependencies {
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modCompile "net.fabricmc:fabric-loader:${project.loader_version}"

// Fabric API. This is technically optional, but you probably want it anyway.
modCompile "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

// PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs.
// You may need to force-disable transitiveness on them.

modImplementation "vazkii.patchouli:Patchouli:${patchouli_version}"

modImplementation "com.github.Draylar:maybe-data:${maybedata_version}"
include "com.github.Draylar:maybe-data:${maybedata_version}"
modImplementation "eu.midnightdust:midnight-hats:${midnighthats_version}"
include "eu.midnightdust:midnight-hats:${midnighthats_version}"

modImplementation ("me.sargunvohra.mcmods:autoconfig1u:${project.auto_config_version}")
include ("me.sargunvohra.mcmods:autoconfig1u:${project.auto_config_version}")
modImplementation ("me.shedaniel.cloth:config-2:${project.cloth_config_version}")
include ("me.shedaniel.cloth:config-2:${project.cloth_config_version}")
modImplementation ("io.github.prospector:modmenu:${project.mod_menu_version}")
}

processResources {
Expand Down
Binary file added build/loom-cache/maybe-data-1.0.0-1.16.2.jar
Binary file not shown.
Binary file added build/loom-cache/midnight-hats-1.0.2.jar
Binary file not shown.
14 changes: 12 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,20 @@ org.gradle.jvmargs=-Xmx1G
loader_version=0.9.1+build.205

# Mod Properties
mod_version = 1.0.4
mod_version = 2.0.0
maven_group = eu.midnightdust.motschen
archives_base_name = dishes

# Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
fabric_version=0.17.2+build.396-1.16
fabric_version=0.17.2+build.396-1.16
patchouli_version=1.16-40-FABRIC
maybedata_version=1.0.0-1.16.2

# Config stuff
auto_config_version = 3.2.0-unstable
cloth_config_version = 4.7.0-unstable
mod_menu_version = 1.14.6+build.31

# MidnightHats
midnighthats_version=1.0.2
Empty file added logs/latest.log
Empty file.
13 changes: 0 additions & 13 deletions src/main/java/eu/midnightdust/motschen/dishes/Crop.java

This file was deleted.

10 changes: 8 additions & 2 deletions src/main/java/eu/midnightdust/motschen/dishes/DishesClient.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
package eu.midnightdust.motschen.dishes;

import eu.midnightdust.motschen.dishes.entities.client.IceCreamTraderRenderer;
import eu.midnightdust.motschen.dishes.init.CropInit;
import eu.midnightdust.motschen.dishes.init.IceCreamTraderInit;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
import net.fabricmc.fabric.api.client.rendereregistry.v1.EntityRendererRegistry;
import net.minecraft.client.render.RenderLayer;

public class DishesClient implements ClientModInitializer {

@Override
public void onInitializeClient() {
BlockRenderLayerMap.INSTANCE.putBlocks(RenderLayer.getCutout(),DishesMain.TomatoBush);
BlockRenderLayerMap.INSTANCE.putBlocks(RenderLayer.getCutout(),DishesMain.LettuceBush);
EntityRendererRegistry.INSTANCE.register(IceCreamTraderInit.ICE_CREAM_TRADER, (dispatcher, context) -> new IceCreamTraderRenderer(dispatcher));
BlockRenderLayerMap.INSTANCE.putBlocks(RenderLayer.getCutout(),CropInit.TomatoBush);
BlockRenderLayerMap.INSTANCE.putBlocks(RenderLayer.getCutout(),CropInit.LettuceBush);
BlockRenderLayerMap.INSTANCE.putBlocks(RenderLayer.getCutout(),DishesMain.BirthdayCake);
}
}
149 changes: 105 additions & 44 deletions src/main/java/eu/midnightdust/motschen/dishes/DishesMain.java

Large diffs are not rendered by default.

31 changes: 0 additions & 31 deletions src/main/java/eu/midnightdust/motschen/dishes/LootModifier.java

This file was deleted.

62 changes: 62 additions & 0 deletions src/main/java/eu/midnightdust/motschen/dishes/block/Cake.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package eu.midnightdust.motschen.dishes.block;

import eu.midnightdust.motschen.dishes.block.blockentity.BirthdayCakeBlockEntity;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.*;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.Properties;
import net.minecraft.world.BlockView;

import java.util.function.ToIntFunction;

public class Cake extends CakeBlock implements BlockEntityProvider {

public Cake() {
super(FabricBlockSettings.copy(Blocks.CAKE).lightLevel(createLightLevelFromBlockState(15)));
this.setDefaultState(this.stateManager.getDefaultState().with(BITES, 0));
}

@Override
public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) {
return super.getPlacementState(itemPlacementContext)
.with(BITES, 0);
}

@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
builder.add(BITES);
}

@Override
public BlockEntity createBlockEntity(BlockView world) {
return new BirthdayCakeBlockEntity();
}

private static ToIntFunction<BlockState> createLightLevelFromBlockState(int litLevel) {
return (blockState) -> {
if (blockState.get(Properties.BITES) == 0) {
return 15;
}
if (blockState.get(Properties.BITES) == 1) {
return 14;
}
else if (blockState.get(Properties.BITES) == 2) {
return 13;
}
else if (blockState.get(Properties.BITES) == 3) {
return 13;
}
else if (blockState.get(Properties.BITES) == 4) {
return 12;
}
else if (blockState.get(Properties.BITES) == 5) {
return 12;
}
else {
return 11;
}
};
}
}
Original file line number Diff line number Diff line change
@@ -1,54 +1,55 @@
package eu.midnightdust.motschen.dishes;
package eu.midnightdust.motschen.dishes.block;

import eu.midnightdust.motschen.dishes.DishesMain;
import eu.midnightdust.motschen.dishes.blockstates.DishBites;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.*;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.IntProperty;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.minecraft.world.WorldView;

import static net.minecraft.state.property.Properties.BITES;

public class Dish extends HorizontalFacingBlock {

public static final IntProperty DISH_BITES = DishBites.DISH_BITES;
private static final VoxelShape NORTH_SHAPE;
private static final VoxelShape EAST_SHAPE;
private static final VoxelShape SOUTH_SHAPE;
private static final VoxelShape WEST_SHAPE;

public Dish() {
super(FabricBlockSettings.copy(Blocks.CAKE).nonOpaque().sounds(BlockSoundGroup.STONE));
this.setDefaultState(this.stateManager.getDefaultState().with(FACING, Direction.NORTH).with(BITES, 0));
super(FabricBlockSettings.copy(Blocks.STONE).nonOpaque().sounds(BlockSoundGroup.STONE));
this.setDefaultState(this.stateManager.getDefaultState().with(FACING, Direction.NORTH).with(DISH_BITES, 0));
}

public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
if (player.getHungerManager().isNotFull()) {
switch (state.get(BITES)) {
case 0: world.setBlockState(pos, state.with(BITES, 1));
player.getHungerManager().add(2, 4);
return ActionResult.SUCCESS;
case 1: world.setBlockState(pos, state.with(BITES, 2));
player.getHungerManager().add(2, 4);
return ActionResult.SUCCESS;
case 2: world.setBlockState(pos, state.with(BITES, 3));
player.getHungerManager().add(2, 4);
return ActionResult.SUCCESS;
case 3: world.setBlockState(pos, state.with(BITES, 4));
player.getHungerManager().add(2, 4);
return ActionResult.SUCCESS;
case 4: world.setBlockState(pos,DishesMain.Plate.getDefaultState());
player.getHungerManager().add(2, 1);
return ActionResult.SUCCESS;
switch (state.get(DISH_BITES)) {
case 0: world.setBlockState(pos, state.with(DISH_BITES, 1));
player.getHungerManager().add(2, 4);
return ActionResult.SUCCESS;
case 1: world.setBlockState(pos, state.with(DISH_BITES, 2));
player.getHungerManager().add(2, 4);
return ActionResult.SUCCESS;
case 2: world.setBlockState(pos, state.with(DISH_BITES, 3));
player.getHungerManager().add(2, 4);
return ActionResult.SUCCESS;
case 3: world.setBlockState(pos, state.with(DISH_BITES, 4));
player.getHungerManager().add(2, 4);
return ActionResult.SUCCESS;
case 4: world.setBlockState(pos, DishesMain.Plate.getDefaultState());
player.getHungerManager().add(2, 1);
return ActionResult.SUCCESS;
}
return ActionResult.SUCCESS;
}
Expand All @@ -61,13 +62,12 @@ public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEnt
public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) {
return super.getPlacementState(itemPlacementContext)
.with(FACING, itemPlacementContext.getPlayerFacing().getOpposite())
.with(BITES, 0);
.with(DISH_BITES, 0);
}

@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
builder.add(FACING);
builder.add(BITES);
builder.add(FACING, DISH_BITES);
}
@Override
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) {
Expand All @@ -87,18 +87,6 @@ public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos
SOUTH_SHAPE = shape;
WEST_SHAPE = shape;
}
private static VoxelShape rotate(Direction from, Direction to, VoxelShape shape) {
VoxelShape[] buffer = new VoxelShape[]{ shape, VoxelShapes.empty() };

int times = (to.getHorizontal() - from.getHorizontal() + 4) % 4;
for (int i = 0; i < times; i++) {
buffer[0].forEachBox((minX, minY, minZ, maxX, maxY, maxZ) -> buffer[1] = VoxelShapes.union(buffer[1], VoxelShapes.cuboid(1-maxZ, minY, minX, 1-minZ, maxY, maxX)));
buffer[0] = buffer[1];
buffer[1] = VoxelShapes.empty();
}

return buffer[0];
}
public boolean canPlaceAt(BlockState state, WorldView worldView, BlockPos pos) {
return !worldView.isAir(pos.down());
}
Expand Down
23 changes: 23 additions & 0 deletions src/main/java/eu/midnightdust/motschen/dishes/block/Lettuce.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package eu.midnightdust.motschen.dishes.block;

import eu.midnightdust.motschen.dishes.init.CropInit;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.Blocks;
import net.minecraft.block.CropBlock;
import net.minecraft.item.ItemConvertible;

public class Lettuce extends CropBlock {

public Lettuce() {
super(FabricBlockSettings.copy(Blocks.CARROTS));
}

@Override
@Environment(EnvType.CLIENT)
protected ItemConvertible getSeedsItem() {
return CropInit.LettuceBush;
}
}

Loading

0 comments on commit 4764147

Please sign in to comment.