generated from QuiltMC/quilt-template-mod
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update to 1.20.1 except this isn't publish-ready
- Loading branch information
1 parent
f1454a1
commit 50fa57e
Showing
12 changed files
with
228 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,17 @@ | ||
[versions] | ||
# The latest versions are available at https://lambdaurora.dev/tools/import_quilt.html | ||
minecraft = "1.19" | ||
quilt_mappings = "1.19+build.1" | ||
quilt_loader = "0.17.1-beta.1" | ||
|
||
quilted_fabric_api = "2.0.0-alpha.3+0.55.3-1.19" | ||
minecraft = "1.20.1" | ||
quilt_mappings = "1.20.1+build.23" | ||
quilt_loader = "0.20.1" | ||
quilted_fabric_api = "7.1.2+0.87.0-1.20.1" | ||
|
||
[libraries] | ||
minecraft = { module = "com.mojang:minecraft", version.ref = "minecraft" } | ||
quilt_mappings = { module = "org.quiltmc:quilt-mappings", version.ref = "quilt_mappings" } | ||
quilt_loader = { module = "org.quiltmc:quilt-loader", version.ref = "quilt_loader" } | ||
|
||
quilted_fabric_api = { module = "org.quiltmc.quilted-fabric-api:quilted-fabric-api", version.ref = "quilted_fabric_api" } | ||
quilted_fabric_api_deprecated = { module = "org.quiltmc.quilted-fabric-api:quilted-fabric-api-deprecated", version.ref = "quilted_fabric_api" } | ||
|
||
# If you have multiple similar dependencies, you can declare a dependency bundle and reference it on the build script with "libs.bundles.example". | ||
[bundles] | ||
quilted_fabric_api = ["quilted_fabric_api", "quilted_fabric_api_deprecated"] | ||
|
||
[plugins] | ||
quilt_loom = { id = "org.quiltmc.loom", version = "0.12.+" } | ||
quilt_loom = { id = "org.quiltmc.loom", version = "1.0.+" } | ||
minotaur = { id = "com.modrinth.minotaur", version = "2.+" } |
111 changes: 69 additions & 42 deletions
111
src/main/java/io/github/woodiertexas/chocolate_bar/ChocolateBar.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,98 @@ | ||
package io.github.woodiertexas.chocolate_bar; | ||
|
||
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; | ||
import net.minecraft.block.Block; | ||
import net.minecraft.block.Blocks; | ||
import net.minecraft.block.FluidBlock; | ||
import net.minecraft.entity.effect.StatusEffectInstance; | ||
import net.minecraft.entity.effect.StatusEffects; | ||
import net.minecraft.fluid.FlowableFluid; | ||
import net.minecraft.item.BucketItem; | ||
import net.minecraft.item.FoodComponent; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.item.ItemGroup; | ||
import net.minecraft.item.ItemGroups; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.item.Items; | ||
import net.minecraft.registry.Registries; | ||
import net.minecraft.registry.Registry; | ||
import net.minecraft.util.Identifier; | ||
import net.minecraft.util.Rarity; | ||
import net.minecraft.util.registry.Registry; | ||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
import org.quiltmc.loader.api.ModContainer; | ||
import org.quiltmc.loader.api.QuiltLoader; | ||
import org.quiltmc.qsl.base.api.entrypoint.ModInitializer; | ||
import org.quiltmc.qsl.block.extensions.api.QuiltBlockSettings; | ||
import org.quiltmc.qsl.item.setting.api.QuiltItemSettings; | ||
import org.quiltmc.qsl.resource.loader.api.ResourceLoader; | ||
import org.quiltmc.qsl.recipe.api.RecipeManagerHelper; | ||
import org.quiltmc.qsl.recipe.api.builder.VanillaRecipeBuilders; | ||
|
||
public class ChocolateBar implements ModInitializer { | ||
//Making a logger | ||
public static final Logger LOGGER = LogManager.getLogger("ExampleMod"); | ||
public static final Logger LOGGER = LogManager.getLogger("Chocolate Bar"); | ||
public static final String MODID = "chocolate_bar"; | ||
|
||
/* | ||
Creating items/blocks/etc and defining their properties | ||
*/ | ||
public static final Item QUILTY_WRAPPING_PAPER = new Item(new QuiltItemSettings().group(ItemGroup.MISC).rarity(Rarity.UNCOMMON)); | ||
public static final Item TOOLCHAIN_WRAPPING_PAPER = new Item(new QuiltItemSettings().group(ItemGroup.MISC).rarity(Rarity.UNCOMMON)); | ||
public static Block CHOCOLATE; | ||
public static FlowableFluid STILL_CHOCOLATE; | ||
public static FlowableFluid FLOWING_CHOCOLATE; | ||
public static Item CHOCOLATE_BUCKET; | ||
|
||
//This code for a food item is so big it had to be put on multiple lines. | ||
public static final ChocolateBarItem CHOCOLATE_BAR = new ChocolateBarItem( | ||
new QuiltItemSettings() | ||
.group(ItemGroup.FOOD).food( | ||
new FoodComponent.Builder() | ||
.hunger(1) | ||
.saturationModifier(0) | ||
.alwaysEdible() | ||
.snack() | ||
.statusEffect( | ||
new StatusEffectInstance(StatusEffects.JUMP_BOOST, 600), 0.15f).build() | ||
) | ||
); | ||
// Creating items/blocks/etc and defining their properties | ||
public static final ChocolateBarItem CHOCOLATE_BAR = new ChocolateBarItem( | ||
new QuiltItemSettings().food( | ||
new FoodComponent.Builder() | ||
.hunger(1) | ||
.saturationModifier(0) | ||
.alwaysEdible() | ||
.snack() | ||
.statusEffect( | ||
new StatusEffectInstance(StatusEffects.JUMP_BOOST, 600, 1), 0.15f).build() | ||
) | ||
); | ||
|
||
public static final ChocolateBarItem CHOCOLATE_BAR_ZOOMIES = new ChocolateBarItem( | ||
new QuiltItemSettings().food( | ||
new FoodComponent.Builder() | ||
.hunger(1) | ||
.saturationModifier(0) | ||
.alwaysEdible() | ||
.snack() | ||
.statusEffect( | ||
new StatusEffectInstance(StatusEffects.SPEED, 600, 4), 0.15f).build() | ||
) | ||
); | ||
|
||
@Override | ||
public void onInitialize(ModContainer mod) { | ||
LOGGER.info( "Chocolate Bar is ready to go on v{}!", mod.metadata().version().raw() ); | ||
|
||
/* | ||
Every block, item, entity, and biome must sign their registration papers. | ||
All registration papers must be turned into the ModInitializer in the @Override Building | ||
In all seriousness, the following code registers any item, block, entity, or biome added by the mod. | ||
*/ | ||
//Registry.register(Registries.ITEM, new Identifier("chocolate_bar", "quilty_wrapping_paper"), QUILTY_WRAPPING_PAPER); | ||
//Registry.register(Registries.ITEM, new Identifier("chocolate_bar", "toolchain_wrapping_paper"), TOOLCHAIN_WRAPPING_PAPER); | ||
|
||
Registry.register(Registry.ITEM, new Identifier("chocolate_bar", "chocolate_bar"), CHOCOLATE_BAR); | ||
Registry.register(Registry.ITEM, new Identifier("chocolate_bar", "quilty_wrapping_paper"), QUILTY_WRAPPING_PAPER); | ||
Registry.register(Registry.ITEM, new Identifier("chocolate_bar", "toolchain_wrapping_paper"), TOOLCHAIN_WRAPPING_PAPER); | ||
Registry.register(Registries.ITEM, new Identifier(MODID, "chocolate_bar"), CHOCOLATE_BAR); | ||
Registry.register(Registries.ITEM, new Identifier(MODID, "chocolate_bar_zoomies"), CHOCOLATE_BAR_ZOOMIES); | ||
|
||
/* | ||
This automatically loads up a datapack. | ||
In this case it's a modified chocolate bar recipe if Create is present. | ||
*/ | ||
STILL_CHOCOLATE = Registry.register(Registries.FLUID, new Identifier(MODID, "still_chocolate"), new ChocolateFluid.Still()); | ||
FLOWING_CHOCOLATE = Registry.register(Registries.FLUID, new Identifier(MODID, "flowing_chocolate"), new ChocolateFluid.Flowing()); | ||
CHOCOLATE_BUCKET = Registry.register(Registries.ITEM, new Identifier(MODID, "chocolate_bucket"), | ||
new BucketItem(STILL_CHOCOLATE, new Item.Settings().recipeRemainder(Items.BUCKET).maxCount(1))); | ||
|
||
CHOCOLATE = Registry.register(Registries.BLOCK, new Identifier(MODID, "chocolate"), new FluidBlock(STILL_CHOCOLATE, QuiltBlockSettings.copy(Blocks.WATER)){}); | ||
|
||
ItemGroupEvents.modifyEntriesEvent(ItemGroups.FOOD_AND_DRINKS).register(entries -> entries.addItem(CHOCOLATE_BAR)); | ||
ItemGroupEvents.modifyEntriesEvent(ItemGroups.FOOD_AND_DRINKS).register(entries -> entries.addItem(CHOCOLATE_BAR_ZOOMIES)); | ||
ItemGroupEvents.modifyEntriesEvent(ItemGroups.FOOD_AND_DRINKS).register(entries -> entries.addItem(CHOCOLATE_BUCKET)); | ||
|
||
if (QuiltLoader.isModLoaded("create")); { | ||
ResourceLoader.registerBuiltinResourcePack( | ||
new Identifier("chocolate_bar", "create_compat"), | ||
QuiltLoader.getModContainer("chocolate_bar").get(), | ||
org.quiltmc.qsl.resource.loader.api.ResourcePackActivationType.DEFAULT_ENABLED | ||
); | ||
} | ||
// Registers the recipe for Chocolate Bar | ||
RecipeManagerHelper.registerStaticRecipe( | ||
VanillaRecipeBuilders.shapedRecipe("CMS") | ||
.output(new ItemStack(CHOCOLATE_BAR)) | ||
.ingredient('C', Items.COCOA_BEANS) | ||
.ingredient('M', Items.MILK_BUCKET) | ||
.ingredient('S', Items.SUGAR) | ||
.build(new Identifier(MODID, "chocolate_bar"), "") | ||
); | ||
LOGGER.info("Recipes are done generating. Have fun with Chocolate Bar! :)"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
114 changes: 114 additions & 0 deletions
114
src/main/java/io/github/woodiertexas/chocolate_bar/ChocolateFluid.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
package io.github.woodiertexas.chocolate_bar; | ||
|
||
import net.minecraft.block.Block; | ||
import net.minecraft.block.BlockState; | ||
import net.minecraft.block.entity.BlockEntity; | ||
import net.minecraft.fluid.FlowableFluid; | ||
import net.minecraft.fluid.Fluid; | ||
import net.minecraft.fluid.FluidState; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.state.StateManager; | ||
import net.minecraft.state.property.Properties; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.util.math.Direction; | ||
import net.minecraft.world.BlockView; | ||
import net.minecraft.world.World; | ||
import net.minecraft.world.WorldAccess; | ||
import net.minecraft.world.WorldView; | ||
|
||
import static io.github.woodiertexas.chocolate_bar.ChocolateBar.CHOCOLATE; | ||
|
||
public abstract class ChocolateFluid extends FlowableFluid { | ||
@Override | ||
public Fluid getFlowing() { | ||
return ChocolateBar.FLOWING_CHOCOLATE; | ||
} | ||
|
||
@Override | ||
public Fluid getStill() { | ||
return ChocolateBar.STILL_CHOCOLATE; | ||
} | ||
|
||
@Override | ||
public Item getBucketItem() { | ||
return ChocolateBar.CHOCOLATE_BUCKET; | ||
} | ||
|
||
@Override | ||
protected boolean isInfinite(World world) { | ||
return false; | ||
} | ||
|
||
@Override | ||
protected void beforeBreakingBlock(WorldAccess world, BlockPos pos, BlockState state) { | ||
final BlockEntity blockEntity = state.hasBlockEntity() ? world.getBlockEntity(pos) : null; | ||
Block.dropStacks(state, world, pos, blockEntity); | ||
} | ||
|
||
@Override | ||
protected int getFlowSpeed(WorldView world) { | ||
return 3; | ||
} | ||
|
||
@Override | ||
protected int getLevelDecreasePerBlock(WorldView world) { | ||
return 2; | ||
} | ||
|
||
@Override | ||
protected boolean canBeReplacedWith(FluidState state, BlockView world, BlockPos pos, Fluid fluid, Direction direction) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public int getTickRate(WorldView world) { | ||
return 5; | ||
} | ||
|
||
@Override | ||
protected float getBlastResistance() { | ||
return 100f; | ||
} | ||
|
||
@Override | ||
public boolean isSource(FluidState state) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public int getLevel(FluidState state) { | ||
return 8; | ||
} | ||
|
||
public BlockState toBlockState(FluidState state) { | ||
return CHOCOLATE.getDefaultState().with(Properties.LEVEL_15, getBlockStateLevel(state)); | ||
} | ||
|
||
public static class Flowing extends ChocolateFluid { | ||
@Override | ||
protected void appendProperties(StateManager.Builder<Fluid, FluidState> builder) { | ||
super.appendProperties(builder); | ||
builder.add(LEVEL); | ||
} | ||
|
||
@Override | ||
public int getLevel(FluidState fluidState) { | ||
return fluidState.get(LEVEL); | ||
} | ||
|
||
public boolean isStill(FluidState fluidState) { | ||
return false; | ||
} | ||
} | ||
|
||
public static class Still extends ChocolateFluid { | ||
@Override | ||
public int getLevel(FluidState fluidState) { | ||
return 8; | ||
} | ||
|
||
public boolean isStill(FluidState fluidState) { | ||
return true; | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/resources/assets/chocolate_bar/blockstates/chocolate.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"variants": { | ||
"": { | ||
"model": "chocolate_bar:block/chocolate" | ||
} | ||
} | ||
} |
19 changes: 0 additions & 19 deletions
19
src/main/resources/data/chocolate_bar/recipes/chocolate_bar.json
This file was deleted.
Oops, something went wrong.
22 changes: 0 additions & 22 deletions
22
src/main/resources/data/chocolate_bar/recipes/quilty_wrapping_paper.json
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.