Skip to content

Commit

Permalink
v1.8 - Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
DakotaPride committed May 6, 2024
1 parent b66b2c0 commit ee27203
Show file tree
Hide file tree
Showing 595 changed files with 10,277 additions and 728 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx2G
# Mod Info
maven_group = net.dakotapride
archives_base_name = garnished
mod_version = 1.7.5
mod_version = 1.8

minecraft_version = 1.20.1

Expand Down
9 changes: 9 additions & 0 deletions src/main/java/net/dakotapride/garnished/CreateGarnished.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import net.dakotapride.garnished.modifier.LootTableModifiers;

import net.dakotapride.garnished.recipe.GarnishedFanProcessing;
import net.dakotapride.garnished.registry.GarnishedAdvancementUtils;
import net.dakotapride.garnished.registry.GarnishedBlockEntities;
import net.dakotapride.garnished.registry.GarnishedPonderIndex;
import net.dakotapride.garnished.registry.GarnishedRecipeTypes;
import net.minecraft.resources.ResourceLocation;
Expand Down Expand Up @@ -51,6 +53,7 @@ public static ResourceLocation asResource(String path) {
@Override
public void onInitialize() {

GarnishedBlockEntities.setRegister();
GarnishedItems.setRegister();
GarnishedBlocks.setRegister();
GarnishedTabs.setRegister();
Expand Down Expand Up @@ -86,6 +89,8 @@ public void onInitialize() {
() -> () -> "{} is accessing Porting Lib from the server!"
), NAME);

GarnishedAdvancementUtils.register();

PotionBrewing.addMix(Potions.AWKWARD, GarnishedItems.BRITTLE_DUST.get(), GarnishedEffects.AVERSION_POTION);
PotionBrewing.addMix(GarnishedEffects.AVERSION_POTION, Items.REDSTONE, GarnishedEffects.LONG_AVERSION_POTION);
PotionBrewing.addMix(Potions.AWKWARD, GarnishedItems.ENDER_JELLY_BLOB.get(), GarnishedEffects.FLAGRANT_POTION);
Expand All @@ -99,6 +104,10 @@ public void onInitialize() {

PotionBrewing.addMix(Potions.MUNDANE, GarnishedItems.SOLEMN_DUST.get(), GarnishedEffects.MUMMIFICATION_POTION);

PotionBrewing.addMix(Potions.THICK, GarnishedItems.FROST.get(), GarnishedEffects.FREEZING_POTION);
PotionBrewing.addMix(GarnishedEffects.FREEZING_POTION, Items.REDSTONE, GarnishedEffects.LONG_FREEZING_POTION);


StrippableBlockRegistry.register(GarnishedBlocks.SEPIA_STEM.get(), GarnishedBlocks.STRIPPED_SEPIA_STEM.get());
StrippableBlockRegistry.register(GarnishedBlocks.SEPIA_HYPHAE.get(), GarnishedBlocks.STRIPPED_SEPIA_HYPHAE.get());
StrippableBlockRegistry.register(GarnishedBlocks.NUT_LOG.get(), GarnishedBlocks.STRIPPED_NUT_LOG.get());
Expand Down
185 changes: 183 additions & 2 deletions src/main/java/net/dakotapride/garnished/CreateGarnishedClient.java
Original file line number Diff line number Diff line change
@@ -1,25 +1,39 @@
package net.dakotapride.garnished;

import com.mojang.blaze3d.shaders.FogShape;
import com.simibubi.create.infrastructure.config.AllConfigs;
import com.terraformersmc.terraform.sign.SpriteIdentifierRegistry;

import io.github.fabricators_of_create.porting_lib.event.client.FogEvents;
import net.dakotapride.garnished.block.cake.AnniversaryCakeBlockRenderer;
import net.dakotapride.garnished.registry.GarnishedBlockEntities;
import net.dakotapride.garnished.registry.GarnishedBlocks;
import net.dakotapride.garnished.registry.GarnishedFluids;
import net.dakotapride.garnished.registry.GarnishedPonderIndex;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandlerRegistry;
import net.fabricmc.fabric.mixin.client.rendering.BlockEntityRendererFactoriesMixin;
import net.minecraft.client.Camera;
import net.minecraft.client.Minecraft;
import net.minecraft.client.color.block.BlockColors;
import net.minecraft.client.color.item.ItemColor;
import net.minecraft.client.color.item.ItemColors;
import net.minecraft.client.renderer.BiomeColors;
import net.minecraft.client.renderer.ItemBlockRenderTypes;
import net.minecraft.client.renderer.FogRenderer;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.Sheets;
import net.minecraft.client.renderer.blockentity.BlockEntityRenderers;
import net.minecraft.client.resources.model.Material;
import net.minecraft.core.BlockPos;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.level.FoliageColor;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Fluid;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.material.FogType;

public class CreateGarnishedClient implements ClientModInitializer {

Expand Down Expand Up @@ -116,6 +130,15 @@ public void onInitializeClient() {
GarnishedFluids.BLUE_MASTIC_RESIN.get().getFlowing(), FluidRenderHandlerRegistry.INSTANCE.get(GarnishedFluids.BLUE_MASTIC_RESIN.get()));
FluidRenderHandlerRegistry.INSTANCE.register(GarnishedFluids.PURPLE_MASTIC_RESIN.get().getSource(),
GarnishedFluids.PURPLE_MASTIC_RESIN.get().getFlowing(), FluidRenderHandlerRegistry.INSTANCE.get(GarnishedFluids.PURPLE_MASTIC_RESIN.get()));
FluidRenderHandlerRegistry.INSTANCE.register(GarnishedFluids.DRAGON_BREATH.get().getSource(),
GarnishedFluids.DRAGON_BREATH.get().getFlowing(), FluidRenderHandlerRegistry.INSTANCE.get(GarnishedFluids.DRAGON_BREATH.get()));
FluidRenderHandlerRegistry.INSTANCE.register(GarnishedFluids.SWEET_TEA.get().getSource(),
GarnishedFluids.SWEET_TEA.get().getFlowing(), FluidRenderHandlerRegistry.INSTANCE.get(GarnishedFluids.SWEET_TEA.get()));

FogEvents.RENDER_FOG.register(CreateGarnishedClient::getGarnishedFogDensity);
FogEvents.SET_COLOR.register(CreateGarnishedClient::getGarnishedFogColour);

BlockEntityRenderers.register(GarnishedBlockEntities.CAKE.get(), AnniversaryCakeBlockRenderer::new);
}

public static synchronized void blockColourProvider(BlockColors colors) {
Expand All @@ -138,4 +161,162 @@ public static synchronized void itemColourProvider(BlockColors colors, ItemColor
GarnishedBlocks.PECAN_LEAVES.get(), GarnishedBlocks.BUHG_LEAVES.get(), GarnishedBlocks.PISTACHIO_LEAVES.get(),
GarnishedBlocks.MACADAMIA_LEAVES.get(), GarnishedBlocks.HAZELNUT_LEAVES.get(), GarnishedBlocks.CHESTNUT_LEAVES.get());
}

public static boolean getGarnishedFogDensity(FogRenderer.FogMode mode, FogType type, Camera camera, float partialTick, float renderDistance, float nearDistance, float farDistance, FogShape shape, FogEvents.FogData fogData) {
Level level = Minecraft.getInstance().level;
BlockPos blockPos = camera.getBlockPosition();
FluidState fluidState = level.getFluidState(blockPos);
if (camera.getPosition().y >= blockPos.getY() + fluidState.getHeight(level, blockPos))
return false;
Fluid fluid = fluidState.getType();
Entity entity = camera.getEntity();

if (GarnishedFluids.GARNISH.get().isSame(fluid)) {
fogData.scaleFarPlaneDistance(1f / 8f * AllConfigs.client().honeyTransparencyMultiplier.getF());
return true;
}
if (GarnishedFluids.APPLE_CIDER.get().isSame(fluid)) {
fogData.scaleFarPlaneDistance(1f / 8f * AllConfigs.client().honeyTransparencyMultiplier.getF());
return true;
}
if (GarnishedFluids.PEANUT_OIL.get().isSame(fluid)) {
fogData.scaleFarPlaneDistance(1f / 8f * AllConfigs.client().honeyTransparencyMultiplier.getF());
return true;
}
if (GarnishedFluids.CASHEW_MIXTURE.get().isSame(fluid)) {
fogData.scaleFarPlaneDistance(1f / 8f * AllConfigs.client().honeyTransparencyMultiplier.getF());
return true;
}
if (GarnishedFluids.MASTIC_RESIN.get().isSame(fluid)) {
fogData.scaleFarPlaneDistance(1f / 8f * AllConfigs.client().honeyTransparencyMultiplier.getF());
return true;
}
if (GarnishedFluids.RED_MASTIC_RESIN.get().isSame(fluid)) {
fogData.scaleFarPlaneDistance(1f / 8f * AllConfigs.client().honeyTransparencyMultiplier.getF());
return true;
}
if (GarnishedFluids.ORANGE_MASTIC_RESIN.get().isSame(fluid)) {
fogData.scaleFarPlaneDistance(1f / 8f * AllConfigs.client().honeyTransparencyMultiplier.getF());
return true;
}
if (GarnishedFluids.YELLOW_MASTIC_RESIN.get().isSame(fluid)) {
fogData.scaleFarPlaneDistance(1f / 8f * AllConfigs.client().honeyTransparencyMultiplier.getF());
return true;
}
if (GarnishedFluids.GREEN_MASTIC_RESIN.get().isSame(fluid)) {
fogData.scaleFarPlaneDistance(1f / 8f * AllConfigs.client().honeyTransparencyMultiplier.getF());
return true;
}
if (GarnishedFluids.BLUE_MASTIC_RESIN.get().isSame(fluid)) {
fogData.scaleFarPlaneDistance(1f / 8f * AllConfigs.client().honeyTransparencyMultiplier.getF());
return true;
}
if (GarnishedFluids.PURPLE_MASTIC_RESIN.get().isSame(fluid)) {
fogData.scaleFarPlaneDistance(1f / 8f * AllConfigs.client().honeyTransparencyMultiplier.getF());
return true;
}
if (GarnishedFluids.DRAGON_BREATH.get().isSame(fluid)) {
fogData.scaleFarPlaneDistance(1f / 8f * AllConfigs.client().honeyTransparencyMultiplier.getF());
return true;
}
if (GarnishedFluids.SWEET_TEA.get().isSame(fluid)) {
fogData.scaleFarPlaneDistance(1f / 8f * AllConfigs.client().honeyTransparencyMultiplier.getF());
return true;
}

if (entity.isSpectator())
return false;

return false;
}

public static void getGarnishedFogColour(FogEvents.ColorData event, float partialTicks) {
Camera info = event.getCamera();
Level level = Minecraft.getInstance().level;
BlockPos blockPos = info.getBlockPosition();
FluidState fluidState = level.getFluidState(blockPos);
if (info.getPosition().y > blockPos.getY() + fluidState.getHeight(level, blockPos))
return;

Fluid fluid = fluidState.getType();

if (GarnishedFluids.GARNISH.get().isSame(fluid)) {
event.setRed(239 / 255f);
event.setGreen(233 / 255f);
event.setBlue(227 / 255f);
return;
}
if (GarnishedFluids.APPLE_CIDER.get().isSame(fluid)) {
event.setRed(239 / 255f);
event.setGreen(179 / 255f);
event.setBlue(119 / 255f);
return;
}
if (GarnishedFluids.PEANUT_OIL.get().isSame(fluid)) {
event.setRed(202 / 255f);
event.setGreen(196 / 255f);
event.setBlue(159 / 255f);
return;
}
if (GarnishedFluids.CASHEW_MIXTURE.get().isSame(fluid)) {
event.setRed(252 / 255f);
event.setGreen(239 / 255f);
event.setBlue(207 / 255f);
return;
}
if (GarnishedFluids.MASTIC_RESIN.get().isSame(fluid)) {
event.setRed(82 / 255f);
event.setGreen(107 / 255f);
event.setBlue(76 / 255f);
return;
}
if (GarnishedFluids.RED_MASTIC_RESIN.get().isSame(fluid)) {
event.setRed(142 / 255f);
event.setGreen(25 / 255f);
event.setBlue(25 / 255f);
return;
}
if (GarnishedFluids.ORANGE_MASTIC_RESIN.get().isSame(fluid)) {
event.setRed(165 / 255f);
event.setGreen(86 / 255f);
event.setBlue(46 / 255f);
return;
}
if (GarnishedFluids.YELLOW_MASTIC_RESIN.get().isSame(fluid)) {
event.setRed(178 / 255f);
event.setGreen(136 / 255f);
event.setBlue(53 / 255f);
return;
}
if (GarnishedFluids.GREEN_MASTIC_RESIN.get().isSame(fluid)) {
event.setRed(67 / 255f);
event.setGreen(142 / 255f);
event.setBlue(41 / 255f);
return;
}
if (GarnishedFluids.BLUE_MASTIC_RESIN.get().isSame(fluid)) {
event.setRed(57 / 255f);
event.setGreen(122 / 255f);
event.setBlue(126 / 255f);
return;
}
if (GarnishedFluids.PURPLE_MASTIC_RESIN.get().isSame(fluid)) {
event.setRed(87 / 255f);
event.setGreen(36 / 255f);
event.setBlue(153 / 255f);
return;
}
if (GarnishedFluids.DRAGON_BREATH.get().isSame(fluid)) {
event.setRed(197 / 255f);
event.setGreen(72 / 255f);
event.setBlue(131 / 255f);
return;
}
if (GarnishedFluids.SWEET_TEA.get().isSame(fluid)) {
event.setRed(227 / 255f);
event.setGreen(141 / 255f);
event.setBlue(82 / 255f);
return;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package net.dakotapride.garnished.advancements;

import org.jetbrains.annotations.NotNull;

import com.google.gson.JsonObject;

import net.dakotapride.garnished.CreateGarnished;
import net.minecraft.advancements.critereon.AbstractCriterionTriggerInstance;
import net.minecraft.advancements.critereon.ContextAwarePredicate;
import net.minecraft.advancements.critereon.DeserializationContext;
import net.minecraft.advancements.critereon.SimpleCriterionTrigger;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer;

public class AnniversaryCakeTrigger extends SimpleCriterionTrigger<AnniversaryCakeTrigger.TriggerInstance> {
private static final ResourceLocation ID = new ResourceLocation(CreateGarnished.ID, "consume_anniversary_cake_slice");

@Override
public @NotNull ResourceLocation getId() {
return ID;
}

public void trigger(@NotNull ServerPlayer player) {
this.trigger(player, TriggerInstance::test);
}

@Override
protected @NotNull TriggerInstance createInstance(@NotNull JsonObject json, @NotNull ContextAwarePredicate player, @NotNull DeserializationContext conditionsParser) {
return new TriggerInstance(player);
}

public static class TriggerInstance extends AbstractCriterionTriggerInstance {
public TriggerInstance(ContextAwarePredicate player) {
super(AnniversaryCakeTrigger.ID, player);
}

public static TriggerInstance simple() {
return new TriggerInstance(ContextAwarePredicate.ANY);
}

public boolean test() {
return true;
}
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package net.dakotapride.garnished.advancements;

import org.jetbrains.annotations.NotNull;

import com.google.gson.JsonObject;

import net.dakotapride.garnished.CreateGarnished;
import net.minecraft.advancements.critereon.AbstractCriterionTriggerInstance;
import net.minecraft.advancements.critereon.ContextAwarePredicate;
import net.minecraft.advancements.critereon.DeserializationContext;
import net.minecraft.advancements.critereon.SimpleCriterionTrigger;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer;

public class DejojoTheAwsomeTrigger extends SimpleCriterionTrigger<DejojoTheAwsomeTrigger.TriggerInstance> {
private static final ResourceLocation ID = new ResourceLocation(CreateGarnished.ID, "the_one_who_started_it_all");

@Override
public @NotNull ResourceLocation getId() {
return ID;
}

public void trigger(@NotNull ServerPlayer player) {
this.trigger(player, TriggerInstance::test);
}

@Override
protected @NotNull TriggerInstance createInstance(@NotNull JsonObject json, @NotNull ContextAwarePredicate player, @NotNull DeserializationContext conditionsParser) {
return new TriggerInstance(player);
}

public static class TriggerInstance extends AbstractCriterionTriggerInstance {
public TriggerInstance(ContextAwarePredicate player) {
super(DejojoTheAwsomeTrigger.ID, player);
}

public static TriggerInstance simple() {
return new TriggerInstance(ContextAwarePredicate.ANY);
}

public boolean test() {
return true;
}
}
}

Loading

0 comments on commit ee27203

Please sign in to comment.