Skip to content

Commit

Permalink
Updated codebase to fabric 0.97.8+1.20.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Sephta committed Jun 22, 2024
1 parent a4c3d52 commit 5883588
Show file tree
Hide file tree
Showing 145 changed files with 799 additions and 824 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ processResources {
}

tasks.withType(JavaCompile).configureEach {
it.options.release = 17
it.options.release = 21
}

java {
Expand All @@ -78,8 +78,8 @@ java {
// If you remove this line, sources will not be generated.
withSourcesJar()

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

jar {
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.4
yarn_mappings=1.20.4+build.3
minecraft_version=1.20.5
yarn_mappings=1.20.5+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.97.1+1.20.4
fabric_version=0.97.8+1.20.5
9 changes: 3 additions & 6 deletions src/main/java/net/stal/alloys/StalAlloys.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package net.stal.alloys;

import net.fabricmc.api.ModInitializer;
import net.stal.alloys.item.StalAlloysArmorMaterials;
import net.stal.alloys.item.StalAlloysItemGroup;
// import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
import net.stal.alloys.item.StalAlloysItems;
import net.stal.alloys.recipe.StalAlloysRecipes;
import net.stal.alloys.screen.StalAlloysScreenHandlers;
import net.stal.alloys.world.StalAlloysConfiguredFeatures;
import net.stal.alloys.world.gen.StalAlloysOreGeneration;
import net.stal.alloys.block.StalAlloysBlocks;
import net.stal.alloys.block.entity.StalAlloysBlockEntities;
// import net.stal.alloys.event.PlayerTickHandler;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -30,6 +29,8 @@ public void onInitialize() {

StalAlloysItemGroup.registerItemGroups();

StalAlloysArmorMaterials.registerModArmorMaterials();

StalAlloysItems.registerModItems();

StalAlloysBlocks.registerModBlocks();
Expand All @@ -41,9 +42,5 @@ public void onInitialize() {
StalAlloysScreenHandlers.registerModScreenHandlers();

StalAlloysRecipes.registerRecipes();

// Other stuff...

// ServerTickEvents.START_SERVER_TICK.register(new PlayerTickHandler());
}
}
4 changes: 1 addition & 3 deletions src/main/java/net/stal/alloys/block/AlloySmelterBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import net.minecraft.util.ActionResult;
import net.minecraft.util.BlockMirror;
import net.minecraft.util.BlockRotation;
import net.minecraft.util.Hand;
import net.minecraft.util.ItemScatterer;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
Expand Down Expand Up @@ -82,7 +81,6 @@ public BlockRenderType getRenderType(BlockState state) {
return BlockRenderType.MODEL;
}

@SuppressWarnings("deprecation")
@Override
public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState newState, boolean moved) {
if (state.getBlock() != newState.getBlock()) {
Expand All @@ -97,7 +95,7 @@ public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockSt
}

@Override
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand,
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player,
BlockHitResult hit) {

if (!world.isClient()) {
Expand Down
84 changes: 41 additions & 43 deletions src/main/java/net/stal/alloys/block/StalAlloysBlocks.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package net.stal.alloys.block;

import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.*;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
Expand All @@ -19,8 +17,8 @@ public class StalAlloysBlocks {
public static final Block STEEL_BLOCK = registerBlock(
"steel_block",
new Block(
FabricBlockSettings
.copyOf(Blocks.IRON_BLOCK)
AbstractBlock.Settings
.copy(Blocks.IRON_BLOCK)
.sounds(BlockSoundGroup.METAL)
.strength(5.0F, 8.0F)
.requiresTool()
Expand All @@ -32,8 +30,8 @@ public class StalAlloysBlocks {
"nickel_ore",
new ExperienceDroppingBlock(
UniformIntProvider.create(3, 8),
FabricBlockSettings
.copyOf(Blocks.STONE)
AbstractBlock.Settings
.copy(Blocks.STONE)
.sounds(BlockSoundGroup.STONE)
.strength(3.0F, 8.0F)
.requiresTool()
Expand All @@ -44,8 +42,8 @@ public class StalAlloysBlocks {
"deepslate_nickel_ore",
new ExperienceDroppingBlock(
UniformIntProvider.create(4, 9),
FabricBlockSettings
.copyOf(Blocks.STONE)
AbstractBlock.Settings
.copy(Blocks.STONE)
.sounds(BlockSoundGroup.DEEPSLATE)
.strength(4.5F, 8.0F)
.requiresTool()
Expand All @@ -56,8 +54,8 @@ public class StalAlloysBlocks {
"netherrack_nickel_ore",
new ExperienceDroppingBlock(
UniformIntProvider.create(4, 9),
FabricBlockSettings
.copyOf(Blocks.STONE)
AbstractBlock.Settings
.copy(Blocks.STONE)
.sounds(BlockSoundGroup.NETHERRACK)
.strength(0.4F)
.requiresTool()
Expand All @@ -67,8 +65,8 @@ public class StalAlloysBlocks {
public static final Block NICKEL_BLOCK = registerBlock(
"nickel_block",
new Block(
FabricBlockSettings
.copyOf(Blocks.IRON_BLOCK)
AbstractBlock.Settings
.copy(Blocks.IRON_BLOCK)
.sounds(BlockSoundGroup.COPPER)
.strength(5.0F, 8.0F)
.requiresTool()
Expand All @@ -78,8 +76,8 @@ public class StalAlloysBlocks {
public static final Block CUT_NICKEL = registerBlock(
"cut_nickel",
new Block(
FabricBlockSettings
.copyOf(Blocks.IRON_BLOCK)
AbstractBlock.Settings
.copy(Blocks.IRON_BLOCK)
.sounds(BlockSoundGroup.COPPER)
.strength(5.0F, 8.0F)
.requiresTool()
Expand All @@ -89,8 +87,8 @@ public class StalAlloysBlocks {
public static final Block CUT_NICKEL_SLAB = registerBlock(
"cut_nickel_slab",
new SlabBlock(
FabricBlockSettings
.copyOf(Blocks.IRON_BLOCK)
AbstractBlock.Settings
.copy(Blocks.IRON_BLOCK)
.sounds(BlockSoundGroup.COPPER)
.strength(5.0F, 8.0F)
.requiresTool()
Expand All @@ -101,8 +99,8 @@ public class StalAlloysBlocks {
"cut_nickel_stairs",
new StairsBlock(
CUT_NICKEL.getDefaultState(),
FabricBlockSettings
.copyOf(Blocks.IRON_BLOCK)
AbstractBlock.Settings
.copy(Blocks.IRON_BLOCK)
.sounds(BlockSoundGroup.COPPER)
.strength(5.0F, 8.0F)
.requiresTool()
Expand All @@ -114,8 +112,8 @@ public class StalAlloysBlocks {
"chromium_ore",
new ExperienceDroppingBlock(
UniformIntProvider.create(3, 8),
FabricBlockSettings
.copyOf(Blocks.STONE)
AbstractBlock.Settings
.copy(Blocks.STONE)
.sounds(BlockSoundGroup.STONE)
.strength(3.0F, 8.0F)
.requiresTool()
Expand All @@ -126,8 +124,8 @@ public class StalAlloysBlocks {
"deepslate_chromium_ore",
new ExperienceDroppingBlock(
UniformIntProvider.create(4, 9),
FabricBlockSettings
.copyOf(Blocks.STONE)
AbstractBlock.Settings
.copy(Blocks.STONE)
.sounds(BlockSoundGroup.DEEPSLATE)
.strength(4.5F, 8.0F)
.requiresTool()
Expand All @@ -138,8 +136,8 @@ public class StalAlloysBlocks {
"netherrack_chromium_ore",
new ExperienceDroppingBlock(
UniformIntProvider.create(4, 9),
FabricBlockSettings
.copyOf(Blocks.STONE)
AbstractBlock.Settings
.copy(Blocks.STONE)
.sounds(BlockSoundGroup.NETHERRACK)
.strength(0.4F)
.requiresTool()
Expand All @@ -149,8 +147,8 @@ public class StalAlloysBlocks {
public static final Block CHROMIUM_BLOCK = registerBlock(
"chromium_block",
new Block(
FabricBlockSettings
.copyOf(Blocks.IRON_BLOCK)
AbstractBlock.Settings
.copy(Blocks.IRON_BLOCK)
.sounds(BlockSoundGroup.METAL)
.strength(5.0F, 8.0F)
.requiresTool()
Expand All @@ -162,8 +160,8 @@ public class StalAlloysBlocks {
"carbon_ore",
new ExperienceDroppingBlock(
UniformIntProvider.create(3, 8),
FabricBlockSettings
.copyOf(Blocks.STONE)
AbstractBlock.Settings
.copy(Blocks.STONE)
.sounds(BlockSoundGroup.STONE)
.strength(3.0F, 8.0F)
.requiresTool()
Expand All @@ -174,8 +172,8 @@ public class StalAlloysBlocks {
"deepslate_carbon_ore",
new ExperienceDroppingBlock(
UniformIntProvider.create(4, 9),
FabricBlockSettings
.copyOf(Blocks.STONE)
AbstractBlock.Settings
.copy(Blocks.STONE)
.sounds(BlockSoundGroup.DEEPSLATE)
.strength(4.5F, 8.0F)
.requiresTool()
Expand All @@ -187,8 +185,8 @@ public class StalAlloysBlocks {
"zinc_ore",
new ExperienceDroppingBlock(
UniformIntProvider.create(3, 8),
FabricBlockSettings
.copyOf(Blocks.STONE)
AbstractBlock.Settings
.copy(Blocks.STONE)
.sounds(BlockSoundGroup.STONE)
.strength(3.0F, 8.0F)
.requiresTool()
Expand All @@ -199,8 +197,8 @@ public class StalAlloysBlocks {
"deepslate_zinc_ore",
new ExperienceDroppingBlock(
UniformIntProvider.create(4, 9),
FabricBlockSettings
.copyOf(Blocks.STONE)
AbstractBlock.Settings
.copy(Blocks.STONE)
.sounds(BlockSoundGroup.DEEPSLATE)
.strength(4.5F, 8.0F)
.requiresTool()
Expand All @@ -210,8 +208,8 @@ public class StalAlloysBlocks {
public static final Block ZINC_BLOCK = registerBlock(
"zinc_block",
new Block(
FabricBlockSettings
.copyOf(Blocks.IRON_BLOCK)
AbstractBlock.Settings
.copy(Blocks.IRON_BLOCK)
.sounds(BlockSoundGroup.METAL)
.strength(5.0F, 8.0F)
.requiresTool()
Expand All @@ -223,8 +221,8 @@ public class StalAlloysBlocks {
"tin_ore",
new ExperienceDroppingBlock(
UniformIntProvider.create(3, 8),
FabricBlockSettings
.copyOf(Blocks.STONE)
AbstractBlock.Settings
.copy(Blocks.STONE)
.sounds(BlockSoundGroup.STONE)
.strength(3.0F, 8.0F)
.requiresTool()
Expand All @@ -235,8 +233,8 @@ public class StalAlloysBlocks {
"deepslate_tin_ore",
new ExperienceDroppingBlock(
UniformIntProvider.create(4, 9),
FabricBlockSettings
.copyOf(Blocks.STONE)
AbstractBlock.Settings
.copy(Blocks.STONE)
.sounds(BlockSoundGroup.DEEPSLATE)
.strength(4.5F, 8.0F)
.requiresTool()
Expand All @@ -247,8 +245,8 @@ public class StalAlloysBlocks {
public static final Block ALLOY_SMELTER = registerBlock(
"alloy_smelter",
new AlloySmelterBlock(
FabricBlockSettings
.copyOf(Blocks.STONE)
AbstractBlock.Settings
.copy(Blocks.STONE)
.sounds(BlockSoundGroup.DEEPSLATE)
.strength(4.5F, 8.0F)
.requiresTool()
Expand All @@ -263,7 +261,7 @@ private static Block registerBlock(String name, Block block) {
}

private static Item registerBlockItem(String name, Block block) {
Item item = Registry.register(Registries.ITEM, new Identifier(StalAlloys.MOD_ID, name), new BlockItem(block, new FabricItemSettings()));
Item item = Registry.register(Registries.ITEM, new Identifier(StalAlloys.MOD_ID, name), new BlockItem(block, new Item.Settings()));

return item;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import net.minecraft.item.Items;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.recipe.RecipeEntry;
import net.minecraft.registry.RegistryWrapper.WrapperLookup;
import net.minecraft.screen.NamedScreenHandlerFactory;
import net.minecraft.screen.PropertyDelegate;
import net.minecraft.screen.ScreenHandler;
Expand Down Expand Up @@ -124,23 +125,23 @@ public ScreenHandler createMenu(int syncId, PlayerInventory playerInventory, Pla
}

@Override
protected void writeNbt(NbtCompound nbt) {
super.writeNbt(nbt);
protected void writeNbt(NbtCompound nbt, WrapperLookup registryLookup) {
super.writeNbt(nbt, registryLookup);

nbt.putInt(mProgressPropertyNBTKey, mProgress);
nbt.putInt(mFuelPropertyNBTKey, mFuel);
Inventories.writeNbt(nbt, mInventory);
Inventories.writeNbt(nbt, mInventory, registryLookup);

NbtCompound nbtCompound = new NbtCompound();
this.recipesUsed.forEach((identifier, count) -> nbtCompound.putInt(identifier.toString(), (int)count));
nbt.put(mRecipesUsedNBTKey, nbtCompound);
}

@Override
public void readNbt(NbtCompound nbt) {
super.readNbt(nbt);
public void readNbt(NbtCompound nbt, WrapperLookup registryLookup) {
super.readNbt(nbt, registryLookup);

Inventories.readNbt(nbt, mInventory);
Inventories.readNbt(nbt, mInventory, registryLookup);

mProgress = nbt.getInt(mProgressPropertyNBTKey);
mFuel = nbt.getInt(mFuelPropertyNBTKey);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
package net.stal.alloys.datagen;

import java.util.concurrent.CompletableFuture;

import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricBlockLootTableProvider;
import net.minecraft.loot.provider.number.UniformLootNumberProvider;
import net.minecraft.registry.RegistryWrapper;
import net.stal.alloys.block.StalAlloysBlocks;
import net.stal.alloys.item.StalAlloysItems;

public class StalAlloysLootTableGenerator extends FabricBlockLootTableProvider {

public StalAlloysLootTableGenerator(FabricDataOutput dataOutput) {
super(dataOutput);
public StalAlloysLootTableGenerator(FabricDataOutput dataOutput, CompletableFuture<RegistryWrapper.WrapperLookup> registryLookup) {
super(dataOutput, registryLookup);
}

@Override
Expand Down
Loading

0 comments on commit 5883588

Please sign in to comment.