Skip to content

Commit

Permalink
Update to latest
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaxydog committed Feb 20, 2024
1 parent 9f1ad98 commit ee4a0a4
Show file tree
Hide file tree
Showing 22 changed files with 573 additions and 533 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.2-SNAPSHOT'
id 'fabric-loom' version '1.5-SNAPSHOT'
id 'maven-publish'
}

Expand Down Expand Up @@ -40,7 +40,7 @@ java {

jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}"}
rename {"${it}_${project.archivesBaseName}"}
}
}

Expand All @@ -51,4 +51,4 @@ publishing {
}
}
repositories {}
}
}
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ org.gradle.jvmargs = -Xmx1G
org.gradle.parallel = true

# Fabric Properties
minecraft_version = 1.20.2
yarn_mappings = 1.20.2+build.4
loader_version = 0.14.24
minecraft_version = 1.20.4
yarn_mappings = 1.20.4+build.3
loader_version = 0.15.7

# Mod Properties
mod_version = 1.3.0
mod_version = 1.4.0
maven_group = dev.jaxydog
archives_base_name = cheese

# Dependencies
fabric_version = 0.90.7+1.20.2
fabric_version = 0.96.3+1.20.4
12 changes: 6 additions & 6 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionBase = GRADLE_USER_HOME
distributionPath = wrapper/dists
distributionUrl = https\://services.gradle.org/distributions/gradle-8.6-bin.zip
networkTimeout = 10000
zipStoreBase = GRADLE_USER_HOME
zipStorePath = wrapper/dists
40 changes: 20 additions & 20 deletions src/main/java/dev/jaxydog/Cheese.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,24 @@

public class Cheese implements ModInitializer {

public static final String MOD_ID = "cheese";
public static final Logger LOGGER = LoggerFactory.getLogger(Cheese.MOD_ID);
public static final ItemGroup ITEM_GROUP = FabricItemGroup
.builder()
.icon(() -> CustomItems.CHEESE.getDefaultStack())
.displayName(Text.translatable(Cheese.newId("default").toTranslationKey("itemGroup")))
.build();

@Override
public void onInitialize() {
Registry.register(Registries.ITEM_GROUP, Cheese.newId("default"), Cheese.ITEM_GROUP);

AutoRegisterImpl.runMain();

Cheese.LOGGER.info("Cheese has loaded :)");
}

public static final Identifier newId(String path) {
return Identifier.of(Cheese.MOD_ID, path);
}
public static final String MOD_ID = "cheese";
public static final Logger LOGGER = LoggerFactory.getLogger(Cheese.MOD_ID);
public static final ItemGroup ITEM_GROUP = FabricItemGroup.builder()
.icon(CustomItems.CHEESE::getDefaultStack)
.displayName(Text.translatable(Cheese.newId("default").toTranslationKey("itemGroup")))
.build();

@Override
public void onInitialize() {
Registry.register(Registries.ITEM_GROUP, Cheese.newId("default"), Cheese.ITEM_GROUP);

AutoRegisterImpl.runMain();

Cheese.LOGGER.info("Cheese has loaded :)");
}

public static Identifier newId(String path) {
return Identifier.of(Cheese.MOD_ID, path);
}

}
9 changes: 5 additions & 4 deletions src/main/java/dev/jaxydog/CheeseClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@

public class CheeseClient implements ClientModInitializer {

@Override
public void onInitializeClient() {
AutoRegisterImpl.runClient();
}
@Override
public void onInitializeClient() {
AutoRegisterImpl.runClient();
}

}
29 changes: 15 additions & 14 deletions src/main/java/dev/jaxydog/content/block/CustomBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,22 @@

public class CustomBlock extends Block implements Registerable.Main {

private final String RAW_ID;
private final String RAW_ID;

public CustomBlock(String rawId, Settings settings) {
super(settings);
this.RAW_ID = rawId;
}
public CustomBlock(String rawId, Settings settings) {
super(settings);
this.RAW_ID = rawId;
}

@Override
public String getRawId() {
return this.RAW_ID;
}
@Override
public String getRawId() {
return this.RAW_ID;
}

@Override
public void registerMain() {
Main.super.registerMain();
Registry.register(Registries.BLOCK, this.getId(), this);
}

@Override
public void registerMain() {
Main.super.registerMain();
Registry.register(Registries.BLOCK, this.getId(), this);
}
}
17 changes: 10 additions & 7 deletions src/main/java/dev/jaxydog/content/block/CustomBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@
@AutoRegister
public class CustomBlocks {

public static final CustomBlock CHEESE_BLOCK = new CustomBlock(
"cheese_block",
Settings.copy(Blocks.SPONGE).mapColor(MapColor.PALE_YELLOW).hardness(1.0f).sounds(BlockSoundGroup.SLIME)
);
public static final CustomBlock CHEESE_BLOCK = new CustomBlock(
"cheese_block",
Settings.copy(Blocks.SPONGE).mapColor(MapColor.PALE_YELLOW).hardness(1.0f).sounds(BlockSoundGroup.SLIME)
);

public static final TomatoesBlock TOMATOES = new TomatoesBlock(Settings.copy(Blocks.BEETROOTS)
.breakInstantly()
.noCollision()
.sounds(BlockSoundGroup.CROP)
.ticksRandomly());

public static final TomatoesBlock TOMATOES = new TomatoesBlock(
Settings.copy(Blocks.BEETROOTS).breakInstantly().noCollision().sounds(BlockSoundGroup.CROP).ticksRandomly()
);
}
111 changes: 56 additions & 55 deletions src/main/java/dev/jaxydog/content/block/TomatoesBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,70 +23,71 @@

public class TomatoesBlock extends CropBlock implements Registerable.Client, Registerable.Main {

public static final int TOMATOES_MAX_AGE = 3;
public static final IntProperty AGE = Properties.AGE_3;
private static final VoxelShape[] AGE_TO_SHAPE = new VoxelShape[] {
Block.createCuboidShape(0.0, 0.0, 0.0, 16.0, 2.0, 16.0),
Block.createCuboidShape(0.0, 0.0, 0.0, 16.0, 6.0, 16.0),
Block.createCuboidShape(0.0, 0.0, 0.0, 16.0, 9.0, 16.0),
Block.createCuboidShape(0.0, 0.0, 0.0, 16.0, 11.0, 16.0),
};
public static final int TOMATOES_MAX_AGE = 3;
public static final IntProperty AGE = Properties.AGE_3;
private static final VoxelShape[] AGE_TO_SHAPE = new VoxelShape[] {
Block.createCuboidShape(0.0, 0.0, 0.0, 16.0, 2.0, 16.0),
Block.createCuboidShape(0.0, 0.0, 0.0, 16.0, 6.0, 16.0),
Block.createCuboidShape(0.0, 0.0, 0.0, 16.0, 9.0, 16.0),
Block.createCuboidShape(0.0, 0.0, 0.0, 16.0, 11.0, 16.0),
};

public TomatoesBlock(Settings settings) {
super(settings);
}
public TomatoesBlock(Settings settings) {
super(settings);
}

@Override
public IntProperty getAgeProperty() {
return TomatoesBlock.AGE;
}
@Override
public IntProperty getAgeProperty() {
return TomatoesBlock.AGE;
}

@Override
public int getMaxAge() {
return TomatoesBlock.TOMATOES_MAX_AGE;
}
@Override
public int getMaxAge() {
return TomatoesBlock.TOMATOES_MAX_AGE;
}

@Override
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
return TomatoesBlock.AGE_TO_SHAPE[this.getAge(state)];
}
@Override
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
return TomatoesBlock.AGE_TO_SHAPE[this.getAge(state)];
}

@Override
public String getRawId() {
return "tomatoes";
}
@Override
public String getRawId() {
return "tomatoes";
}

@Override
protected ItemConvertible getSeedsItem() {
return CustomItems.TOMATO;
}
@Override
protected ItemConvertible getSeedsItem() {
return CustomItems.TOMATO;
}

@Override
public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) {
if (random.nextInt(3) != 0) {
super.randomTick(state, world, pos, random);
}
}
@Override
public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) {
if (random.nextInt(3) != 0) {
super.randomTick(state, world, pos, random);
}
}

@Override
protected int getGrowthAmount(World world) {
return super.getGrowthAmount(world) / 3;
}
@Override
protected int getGrowthAmount(World world) {
return super.getGrowthAmount(world) / 3;
}

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

@Override
public void registerMain() {
Main.super.registerMain();
Registry.register(Registries.BLOCK, this.getId(), this);
}
@Override
public void registerMain() {
Main.super.registerMain();
Registry.register(Registries.BLOCK, this.getId(), this);
}

@Override
public void registerClient() {
Client.super.registerClient();
BlockRenderLayerMap.INSTANCE.putBlock(this, RenderLayer.getCutout());
}

@Override
public void registerClient() {
Client.super.registerClient();
BlockRenderLayerMap.INSTANCE.putBlock(this, RenderLayer.getCutout());
}
}
29 changes: 15 additions & 14 deletions src/main/java/dev/jaxydog/content/item/BottleItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,22 @@

public class BottleItem extends CustomItem {

public BottleItem(String rawId, Settings settings, LootModifier... lootModifiers) {
super(rawId, settings, lootModifiers);
}
public BottleItem(String rawId, Settings settings, LootModifier... lootModifiers) {
super(rawId, settings, lootModifiers);
}

@Override
public ItemStack finishUsing(ItemStack stack, World world, LivingEntity user) {
if (user instanceof PlayerEntity && !((PlayerEntity) user).getAbilities().creativeMode) {
((PlayerEntity) user).getInventory().insertStack(Items.GLASS_BOTTLE.getDefaultStack());
}
@Override
public ItemStack finishUsing(ItemStack stack, World world, LivingEntity user) {
if (user instanceof final PlayerEntity player && !player.isCreative()) {
player.giveItemStack(Items.GLASS_BOTTLE.getDefaultStack());
}

return super.finishUsing(stack, world, user);
}
return super.finishUsing(stack, world, user);
}

@Override
public UseAction getUseAction(ItemStack stack) {
return UseAction.DRINK;
}

@Override
public UseAction getUseAction(ItemStack stack) {
return UseAction.DRINK;
}
}
21 changes: 11 additions & 10 deletions src/main/java/dev/jaxydog/content/item/BowlItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,17 @@

public class BowlItem extends CustomItem {

public BowlItem(String rawId, Settings settings, LootModifier... lootModifiers) {
super(rawId, settings, lootModifiers);
}
public BowlItem(String rawId, Settings settings, LootModifier... lootModifiers) {
super(rawId, settings, lootModifiers);
}

@Override
public ItemStack finishUsing(ItemStack stack, World world, LivingEntity user) {
if (user instanceof PlayerEntity && !((PlayerEntity) user).getAbilities().creativeMode) {
((PlayerEntity) user).getInventory().insertStack(Items.BOWL.getDefaultStack());
}
@Override
public ItemStack finishUsing(ItemStack stack, World world, LivingEntity user) {
if (user instanceof final PlayerEntity player && !player.isCreative()) {
player.giveItemStack(Items.BOWL.getDefaultStack());
}

return super.finishUsing(stack, world, user);
}

return super.finishUsing(stack, world, user);
}
}
Loading

0 comments on commit ee4a0a4

Please sign in to comment.