Skip to content

Commit

Permalink
Updated codebase to fabric 0.91.1+1.20.3
Browse files Browse the repository at this point in the history
- changes reflect those introduced in fabric 0.91.1+1.20.3
  • Loading branch information
Sephta committed Jun 21, 2024
1 parent 64cd17e commit 04bc456
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 31 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.3-SNAPSHOT'
id 'fabric-loom' version '1.4-SNAPSHOT'
id 'maven-publish'

}
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ org.gradle.parallel=true

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.20.2
yarn_mappings=1.20.2+build.4
minecraft_version=1.20.3
yarn_mappings=1.20.3+build.1
loader_version=0.15.11

# Mod Properties
Expand All @@ -15,4 +15,4 @@ archives_base_name=stal-alloys
modid=stal-alloys

# Dependencies
fabric_version=0.91.6+1.20.2
fabric_version=0.91.1+1.20.3
2 changes: 1 addition & 1 deletion 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-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
8 changes: 8 additions & 0 deletions src/main/java/net/stal/alloys/block/AlloySmelterBlock.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package net.stal.alloys.block;

import com.mojang.serialization.MapCodec;

import net.minecraft.block.*;
import net.minecraft.block.entity.*;
import net.minecraft.entity.player.PlayerEntity;
Expand Down Expand Up @@ -119,4 +121,10 @@ public <T extends BlockEntity> BlockEntityTicker<T> getTicker(World world, Block
BlockEntityType<T> type) {
return BlockWithEntity.validateTicker(type, StalAlloysBlockEntities.ALLOY_SMELTER_ENTITY, AlloySmelterEntity::tick);
}

@Override
protected MapCodec<? extends BlockWithEntity> getCodec() {
// ! Currently unused but will need updating in the future
throw new UnsupportedOperationException("Unimplemented method 'getCodec'");
}
}
48 changes: 24 additions & 24 deletions src/main/java/net/stal/alloys/block/StalAlloysBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,36 +31,36 @@ public class StalAlloysBlocks {
public static final Block NICKEL_ORE = registerBlock(
"nickel_ore",
new ExperienceDroppingBlock(
UniformIntProvider.create(3, 8),
FabricBlockSettings
.copyOf(Blocks.STONE)
.sounds(BlockSoundGroup.STONE)
.strength(3.0F, 8.0F)
.requiresTool(),
UniformIntProvider.create(3, 8)
.requiresTool()
)
);

public static final Block DEEPSLATE_NICKEL_ORE = registerBlock(
"deepslate_nickel_ore",
new ExperienceDroppingBlock(
UniformIntProvider.create(4, 9),
FabricBlockSettings
.copyOf(Blocks.STONE)
.sounds(BlockSoundGroup.DEEPSLATE)
.strength(4.5F, 8.0F)
.requiresTool(),
UniformIntProvider.create(4, 9)
.requiresTool()
)
);

public static final Block NETHERRACK_NICKEL_ORE = registerBlock(
"netherrack_nickel_ore",
new ExperienceDroppingBlock(
UniformIntProvider.create(4, 9),
FabricBlockSettings
.copyOf(Blocks.STONE)
.sounds(BlockSoundGroup.NETHERRACK)
.strength(0.4F)
.requiresTool(),
UniformIntProvider.create(4, 9)
.requiresTool()
)
);

Expand Down Expand Up @@ -113,36 +113,36 @@ public class StalAlloysBlocks {
public static final Block CHROMIUM_ORE = registerBlock(
"chromium_ore",
new ExperienceDroppingBlock(
UniformIntProvider.create(3, 8),
FabricBlockSettings
.copyOf(Blocks.STONE)
.sounds(BlockSoundGroup.STONE)
.strength(3.0F, 8.0F)
.requiresTool(),
UniformIntProvider.create(3, 8)
.requiresTool()
)
);

public static final Block DEEPSLATE_CHROMIUM_ORE = registerBlock(
"deepslate_chromium_ore",
new ExperienceDroppingBlock(
UniformIntProvider.create(4, 9),
FabricBlockSettings
.copyOf(Blocks.STONE)
.sounds(BlockSoundGroup.DEEPSLATE)
.strength(4.5F, 8.0F)
.requiresTool(),
UniformIntProvider.create(4, 9)
.requiresTool()
)
);

public static final Block NETHERRACK_CHROMIUM_ORE = registerBlock(
"netherrack_chromium_ore",
new ExperienceDroppingBlock(
UniformIntProvider.create(4, 9),
FabricBlockSettings
.copyOf(Blocks.STONE)
.sounds(BlockSoundGroup.NETHERRACK)
.strength(0.4F)
.requiresTool(),
UniformIntProvider.create(4, 9)
.requiresTool()
)
);

Expand All @@ -161,49 +161,49 @@ public class StalAlloysBlocks {
public static final Block CARBON_ORE = registerBlock(
"carbon_ore",
new ExperienceDroppingBlock(
UniformIntProvider.create(3, 8),
FabricBlockSettings
.copyOf(Blocks.STONE)
.sounds(BlockSoundGroup.STONE)
.strength(3.0F, 8.0F)
.requiresTool(),
UniformIntProvider.create(3, 8)
.requiresTool()
)
);

public static final Block DEEPSLATE_CARBON_ORE = registerBlock(
"deepslate_carbon_ore",
new ExperienceDroppingBlock(
UniformIntProvider.create(4, 9),
FabricBlockSettings
.copyOf(Blocks.STONE)
.sounds(BlockSoundGroup.DEEPSLATE)
.strength(4.5F, 8.0F)
.requiresTool(),
UniformIntProvider.create(4, 9)
.requiresTool()
)
);

// Block: Zinc
public static final Block ZINC_ORE = registerBlock(
"zinc_ore",
new ExperienceDroppingBlock(
UniformIntProvider.create(3, 8),
FabricBlockSettings
.copyOf(Blocks.STONE)
.sounds(BlockSoundGroup.STONE)
.strength(3.0F, 8.0F)
.requiresTool(),
UniformIntProvider.create(3, 8)
.requiresTool()
)
);

public static final Block DEEPSLATE_ZINC_ORE = registerBlock(
"deepslate_zinc_ore",
new ExperienceDroppingBlock(
UniformIntProvider.create(4, 9),
FabricBlockSettings
.copyOf(Blocks.STONE)
.sounds(BlockSoundGroup.DEEPSLATE)
.strength(4.5F, 8.0F)
.requiresTool(),
UniformIntProvider.create(4, 9)
.requiresTool()
)
);

Expand All @@ -222,24 +222,24 @@ public class StalAlloysBlocks {
public static final Block TIN_ORE = registerBlock(
"tin_ore",
new ExperienceDroppingBlock(
UniformIntProvider.create(3, 8),
FabricBlockSettings
.copyOf(Blocks.STONE)
.sounds(BlockSoundGroup.STONE)
.strength(3.0F, 8.0F)
.requiresTool(),
UniformIntProvider.create(3, 8)
.requiresTool()
)
);

public static final Block DEEPSLATE_TIN_ORE = registerBlock(
"deepslate_tin_ore",
new ExperienceDroppingBlock(
UniformIntProvider.create(4, 9),
FabricBlockSettings
.copyOf(Blocks.STONE)
.sounds(BlockSoundGroup.DEEPSLATE)
.strength(4.5F, 8.0F)
.requiresTool(),
UniformIntProvider.create(4, 9)
.requiresTool()
)
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public static class Serializer implements RecipeSerializer<AlloySmelterRecipe> {
public static final String ID = "alloy_smelter"; // name given in the json file

public static final Codec<AlloySmelterRecipe> CODEC = RecordCodecBuilder.create(in -> in.group(
RecipeCodecs.CRAFTING_RESULT.fieldOf(AlloySmelterRecipeAttributes.RESULT.value).forGetter(r -> r.mOutput),
ItemStack.INGREDIENT_ENTRY_CODEC.fieldOf(AlloySmelterRecipeAttributes.RESULT.value).forGetter(r -> r.mOutput),
validateAmount(Ingredient.DISALLOW_EMPTY_CODEC, mNumberOfInputs).fieldOf(AlloySmelterRecipeAttributes.INGREDIENTS.value).forGetter(AlloySmelterRecipe::getIngredients),
Codecs.NONNEGATIVE_INT.fieldOf(AlloySmelterRecipeAttributes.COOKINGTIME.value).forGetter(AlloySmelterRecipe::getCookingTime),
Codecs.NONNEGATIVE_INT.fieldOf(AlloySmelterRecipeAttributes.EXPERIENCE.value).forGetter(AlloySmelterRecipe::getExperience)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ protected void onCrafted(ItemStack stack, int amount) {

@Override
protected void onCrafted(ItemStack stack) {
stack.onCraft(this.player.getWorld(), this.player, this.amount);
stack.onCraftByPlayer(this.player.getWorld(), this.player, this.amount);
if (this.player instanceof ServerPlayerEntity && this.inventory instanceof AlloySmelterEntity) {
((AlloySmelterEntity)this.inventory).dropExperienceForRecipesUsed((ServerPlayerEntity)this.player);
}
Expand Down

0 comments on commit 04bc456

Please sign in to comment.