Skip to content

Commit

Permalink
Adjust gradle.yml
Browse files Browse the repository at this point in the history
Add stonecutting recipes for various blocks: quartz crete, smooth quartz crete, glass.
Adjust dependencies.
  • Loading branch information
AluTheCrow committed Jan 10, 2024
1 parent bb31c48 commit 49a6a17
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 45 deletions.
37 changes: 13 additions & 24 deletions src/main/java/com/theomenden/prefabricated/ModRegistry.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package com.theomenden.prefabricated;

import com.google.common.base.Suppliers;
import com.theomenden.prefabricated.blocks.*;
import com.theomenden.prefabricated.items.*;
import com.theomenden.prefabricated.blocks.entities.LightSwitchBlockEntity;
import com.theomenden.prefabricated.blocks.entities.StructureScannerBlockEntity;
import com.theomenden.prefabricated.config.StructureScannerConfig;
import com.theomenden.prefabricated.items.*;
import com.theomenden.prefabricated.recipe.ConditionedShapedRecipe;
import com.theomenden.prefabricated.recipe.ConditionedShaplessRecipe;
import com.theomenden.prefabricated.recipe.ConditionedSmeltingRecipe;
Expand All @@ -23,7 +24,6 @@
import net.minecraft.nbt.CompoundTag;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.util.LazyLoadedValue;
import net.minecraft.world.item.*;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.item.crafting.RecipeSerializer;
Expand Down Expand Up @@ -535,31 +535,21 @@ public static boolean never(BlockState state, BlockGetter world, BlockPos pos) {

public enum CustomItemTier implements Tier {
COPPER("Copper", Tiers.STONE.getLevel(), Tiers.STONE.getUses(), Tiers.STONE.getSpeed(),
Tiers.STONE.getAttackDamageBonus(), Tiers.STONE.getEnchantmentValue(), () -> {
return Ingredient
.of(Utils.getItemStacksWithTag(new ResourceLocation("c", "copper_ingots")).stream());
}),
Tiers.STONE.getAttackDamageBonus(), Tiers.STONE.getEnchantmentValue(), () -> Ingredient
.of(Utils.getItemStacksWithTag(new ResourceLocation("c", "copper_ingots")).stream())),
OSMIUM("Osmium", Tiers.IRON.getLevel(), 500, Tiers.IRON.getSpeed(),
Tiers.IRON.getAttackDamageBonus() + .5f, Tiers.IRON.getEnchantmentValue(), () -> {
return Ingredient
.of(Utils.getItemStacksWithTag(new ResourceLocation("c", "osmium_ingots")).stream());
}),
Tiers.IRON.getAttackDamageBonus() + .5f, Tiers.IRON.getEnchantmentValue(), () -> Ingredient
.of(Utils.getItemStacksWithTag(new ResourceLocation("c", "osmium_ingots")).stream())),
BRONZE("Bronze", Tiers.IRON.getLevel(), Tiers.IRON.getUses(), Tiers.IRON.getSpeed(),
Tiers.IRON.getAttackDamageBonus(), Tiers.IRON.getEnchantmentValue(), () -> {
return Ingredient
.of(Utils.getItemStacksWithTag(new ResourceLocation("c", "bronze_ingots")).stream());
}),
Tiers.IRON.getAttackDamageBonus(), Tiers.IRON.getEnchantmentValue(), () -> Ingredient
.of(Utils.getItemStacksWithTag(new ResourceLocation("c", "bronze_ingots")).stream())),
STEEL("Steel", Tiers.DIAMOND.getLevel(), (int) (Tiers.IRON.getUses() * 1.5),
Tiers.DIAMOND.getSpeed(), Tiers.DIAMOND.getAttackDamageBonus(),
Tiers.DIAMOND.getEnchantmentValue(), () -> {
return Ingredient
.of(Utils.getItemStacksWithTag(new ResourceLocation("c", "steel_ingots")).stream());
}),
Tiers.DIAMOND.getEnchantmentValue(), () -> Ingredient
.of(Utils.getItemStacksWithTag(new ResourceLocation("c", "steel_ingots")).stream())),
OBSIDIAN("Obsidian", Tiers.DIAMOND.getLevel(), (int) (Tiers.DIAMOND.getUses() * 1.5),
Tiers.DIAMOND.getSpeed(), Tiers.DIAMOND.getAttackDamageBonus(),
Tiers.DIAMOND.getEnchantmentValue(), () -> {
return Ingredient.of(Items.OBSIDIAN);
});
Tiers.DIAMOND.getEnchantmentValue(), () -> Ingredient.of(Items.OBSIDIAN));

@Getter
private final String name;
Expand All @@ -568,8 +558,7 @@ public enum CustomItemTier implements Tier {
private final float efficiency;
private final float attackDamage;
private final int enchantability;
private final LazyLoadedValue<Ingredient> repairMaterial;

private final Supplier<Ingredient> repairMaterial;
CustomItemTier(String name, int harvestLevelIn, int maxUsesIn, float efficiencyIn, float attackDamageIn,
int enchantability, Supplier<Ingredient> repairMaterialIn) {
this.name = name;
Expand All @@ -578,7 +567,7 @@ public enum CustomItemTier implements Tier {
this.efficiency = efficiencyIn;
this.attackDamage = attackDamageIn;
this.enchantability = enchantability;
this.repairMaterial = new LazyLoadedValue<>(repairMaterialIn);
this.repairMaterial = Suppliers.memoize(repairMaterialIn::get);
}

public static CustomItemTier getByName(String name) {
Expand Down
19 changes: 2 additions & 17 deletions src/main/java/com/theomenden/prefabricated/Prefab.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
import me.shedaniel.autoconfig.AutoConfig;
import me.shedaniel.autoconfig.serializer.GsonConfigSerializer;
import net.fabricmc.api.ModInitializer;
import net.minecraft.client.resources.model.Material;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.material.MapColor;
import net.minecraft.world.level.material.PushReaction;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -19,24 +15,13 @@ public class Prefab implements ModInitializer {
* This is the ModID
*/
public static final String MODID = "prefabricated";
/**
* Simulates an air block that blocks movement and cannot be moved.
*/
public static final BlockBehaviour.Properties SeeThroughImmovable = BlockBehaviour.Properties.of()
.air()
.mapColor(MapColor.NONE)
.noParticlesOnBreak()
.noLootTable()
.forceSolidOn()
.noOcclusion()
.pushReaction(PushReaction.IGNORE);

public static final Logger logger = LoggerFactory.getLogger(Prefab.class);

/**
* This is used to determine if the mod is currently being debugged.
*/
public static boolean isDebug = true;
public static boolean isDebug = false;
/**
* Determines if structure items will scan their defined space or show the build gui. Default is false.
* Note: this should only be set to true during debug mode.
Expand All @@ -51,7 +36,7 @@ public class Prefab implements ModInitializer {

@Override
public void onInitialize() {
Prefab.logger.info("Registering Mod Components");
Prefab.logger.info("Your game is initializing Prefabricated Components");
ModRegistry.registerModComponents();

AutoConfig.register(ModConfiguration.class, GsonConfigSerializer::new);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class PrefabClient implements ClientModInitializer {

@Override
public void onInitializeClient() {
Prefab.logger.info("Registering client-side components");
Prefab.logger.info("Templating client-side components");
ClientModRegistry.registerModComponents();

GuiRegistry registry = AutoConfig.getGuiRegistry(ModConfiguration.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static class Serializer implements RecipeSerializer<ConditionedSmeltingRe
String string = GsonHelper.getAsString(jsonObject, "group", "");
String configName = GsonHelper.getAsString(jsonObject, "configName", "");
JsonElement jsonElement = GsonHelper.isArrayNode(jsonObject, "ingredient") ? GsonHelper.getAsJsonArray(jsonObject, "ingredient") : GsonHelper.getAsJsonObject(jsonObject, "ingredient");
Ingredient ingredient = Ingredient.fromJson((JsonElement)jsonElement);
Ingredient ingredient = Ingredient.fromJson(jsonElement);
String string2 = GsonHelper.getAsString(jsonObject, "result");
ResourceLocation identifier2 = new ResourceLocation(string2);
ItemStack itemStack = new ItemStack(BuiltInRegistries.ITEM.getOptional(identifier2).orElseThrow(() -> new IllegalStateException("Item: " + string2 + " does not exist")));
Expand Down
14 changes: 12 additions & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,23 @@
"name": "Prefabricated",
"description": "Prefabricated is a mod which contains multiple pre-designed building for you to place in the world",
"authors": [
"Andy (Alu)",
"WuestMan",
"Kaojinn",
"NerdySpider",
"Dqu1J"
],
"contact": {
"homepage": "https://www.curseforge.com/minecraft/mc-mods/prefab-fabric",
"sources": "https://github.com/Brian-Wuest/MC-Prefab-Fabric"
"sources": "https://github.com/theomenden/TheOmenDen.Prefabricated"
},
"custom": {
"modmenu": {
"links": {
"modmenu.discord": "https://discord.gg/GWshtCqEx4"
},
"update_checker": true
}
},
"license": "MIT",
"icon": "assets/prefabricated/prefabthumb.png",
Expand All @@ -36,7 +45,8 @@
"depends": {
"fabricloader": ">=0.15.3",
"fabric": "*",
"minecraft": "1.20.x",
"minecraft": "${minecraft_version}",
"cloth-config": ">=11.1.118",
"java": ">=17"
},
"suggests": {
Expand Down

0 comments on commit 49a6a17

Please sign in to comment.