Skip to content

Commit

Permalink
partial Malum Compat except I got distracted and added 20 other thing…
Browse files Browse the repository at this point in the history
…s instead
  • Loading branch information
f-raZ0R committed Oct 14, 2024
1 parent 05e2a2d commit 459f43c
Show file tree
Hide file tree
Showing 70 changed files with 952 additions and 33 deletions.
7 changes: 7 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ repositories {
maven { url = "https://maven.jamieswhiteshirt.com/libs-release/" } // Entity Reach Attribute
maven { url = "https://api.modrinth.com/maven" } // Revelationary, Additional Entity Attributes, Fractal Lib, Colorful Hearts, idwtialsimmoedm
maven { url = "https://cfa2.cursemaven.com" }
maven { url = "https://mvn.devos.one/releases/" } // Porting Lib
maven { url = "https://repo.unascribed.com" } // Ears API
maven { url = "https://dl.cloudsmith.io/public/klikli-dev/mods/maven/" } // Modonomicon
maven { url = "https://maven.is-immensely.gay/releases" } // Matchbooks
Expand Down Expand Up @@ -93,10 +94,16 @@ dependencies {
modCompileOnly("com.unascribed:ears-api:${project.ears_version}")
modCompileOnly("maven.modrinth:create-fabric:${project.create_version}") { transitive = false }
modCompileOnly("maven.modrinth:neepmeat:${project.neepmeat_version}") { transitive = false }
modCompileOnly("maven.modrinth:malum:${project.malum_version}") { transitive = false}
// modCompileOnly("maven.modrinth:enchantment-descriptions:${project.enchantment_descriptions_version}")
modCompileOnly("maven.modrinth:travelersbackpack:${project.travelers_backpack_version}")
modCompileOnly("maven.modrinth:botania:${project.botania_version}")
modImplementation("maven.modrinth:idwtialsimmoedm:${project.idwtialsimmoedm_version}")

//Porting Lib
for (String module in port_lib_modules.split(",")) {
modCompileOnly("io.github.fabricators_of_create.Porting-Lib:$module:${project.port_lib_version}") { transitive = false }
}
}

loom {
Expand Down
4 changes: 4 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ auth_me_version=7.0.2+1.20
create_version=0.5.1-f-build.1417+mc1.20.1
# https://modrinth.com/mod/neepmeat
neepmeat_version=0.6.2-beta+1.20.1
# https://modrinth.com/mod/malum
malum_version=1.20.1-1.6.3.0b-fabric
port_lib_version = 2.3.4+1.20.1
port_lib_modules = lazy_registration
# https://modrinth.com/mod/exclusions-lib
exclusionslib_version=0.6

Expand Down
15 changes: 15 additions & 0 deletions src/main/java/de/dafuqs/spectrum/api/energy/InkPowered.java
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
package de.dafuqs.spectrum.api.energy;

import com.sammy.malum.registry.common.MobEffectRegistry;
import de.dafuqs.revelationary.api.advancements.*;
import de.dafuqs.spectrum.*;
import de.dafuqs.spectrum.api.energy.color.*;
import de.dafuqs.spectrum.compat.SpectrumIntegrationPacks;
import de.dafuqs.spectrum.helpers.*;
import de.dafuqs.spectrum.progression.*;
import de.dafuqs.spectrum.registries.SpectrumStatusEffects;
import dev.emi.trinkets.api.*;
import net.fabricmc.api.*;
import net.minecraft.client.*;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.player.*;
import net.minecraft.inventory.*;
import net.minecraft.item.*;
import net.minecraft.registry.Registries;
import net.minecraft.server.network.*;
import net.minecraft.text.*;
import net.minecraft.util.*;
import org.jetbrains.annotations.*;


import java.util.*;

public interface InkPowered {
Expand Down Expand Up @@ -135,6 +141,10 @@ static boolean tryDrainEnergy(@NotNull PlayerEntity player, @NotNull InkColor co
if (!canUse(player)) {
return false;
}
if(SpectrumIntegrationPacks.isIntegrationPackActive(SpectrumIntegrationPacks.MALUM_ID) && player.hasStatusEffect(Registries.STATUS_EFFECT.get(new Identifier("malum:silenced"))))
{
return false;
}

// hands (main hand, too, if someone uses the staff from the offhand)
for (ItemStack itemStack : player.getHandItems()) {
Expand Down Expand Up @@ -206,6 +216,11 @@ static boolean hasAvailableInk(PlayerEntity player, InkColor color, long amount)
if (!canUse(player)) {
return false;
}

if(SpectrumIntegrationPacks.isIntegrationPackActive(SpectrumIntegrationPacks.MALUM_ID) && player.hasStatusEffect(Registries.STATUS_EFFECT.get(new Identifier("malum:silenced"))))
{
return false;
}

if (player.isCreative()) {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public class FirestarterIdolBlock extends IdolBlock {
put(Blocks.RED_MUSHROOM, new Pair<>(Blocks.CRIMSON_FUNGUS.getDefaultState(), 0.2F));
put(Blocks.BROWN_MUSHROOM, new Pair<>(Blocks.WARPED_FUNGUS.getDefaultState(), 0.2F));
put(Blocks.SAND, new Pair<>(Blocks.RED_SAND.getDefaultState(), 1.0F));
put(Blocks.SNOW, new Pair<>(Blocks.AIR.getDefaultState(), 1.0F));
put(Blocks.GRASS_BLOCK, new Pair<>(Blocks.DIRT.getDefaultState(), 0.05F));
put(Blocks.CALCITE, new Pair<>(Blocks.BASALT.getDefaultState(), 0.5F));
put(Blocks.NETHERRACK, new Pair<>(Blocks.MAGMA_BLOCK.getDefaultState(), 0.25F));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import de.dafuqs.spectrum.compat.create.*;
import de.dafuqs.spectrum.compat.farmersdelight.FDCompat;
import de.dafuqs.spectrum.compat.gobber.*;
import de.dafuqs.spectrum.compat.malum.MalumCompat;
import de.dafuqs.spectrum.compat.modonomicon.*;
import de.dafuqs.spectrum.compat.neepmeat.NEEPMeatCompat;
import de.dafuqs.spectrum.compat.travelersbackpack.*;
Expand Down Expand Up @@ -42,6 +43,7 @@ protected static void registerIntegrationPack(String modId, Supplier<ModIntegrat
public static final String CREATE_ID = "create";
public static final String FARMERSDELIGHT_ID = "farmersdelight";
public static final String NEEPMEAT_ID = "neepmeat";
public static final String MALUM_ID = "malum";

@SuppressWarnings("Convert2MethodRef")
public static void register() {
Expand All @@ -53,6 +55,7 @@ public static void register() {
registerIntegrationPack(MODONOMICON_ID, () -> new ModonomiconCompat());
registerIntegrationPack(NEEPMEAT_ID, () -> new NEEPMeatCompat());
registerIntegrationPack(FARMERSDELIGHT_ID, () -> new FDCompat());
registerIntegrationPack(MALUM_ID, () -> new MalumCompat());
if (!FabricLoader.getInstance().isModLoaded("forgified-fabric-api")) {
registerIntegrationPack(CREATE_ID, () -> new CreateCompat());
}
Expand Down
38 changes: 37 additions & 1 deletion src/main/java/de/dafuqs/spectrum/compat/create/CreateCompat.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,52 @@
package de.dafuqs.spectrum.compat.create;

import com.simibubi.create.Create;
import com.simibubi.create.api.event.*;
import de.dafuqs.spectrum.blocks.crystallarieum.SpectrumClusterBlock;
import de.dafuqs.spectrum.blocks.fluid.*;
import de.dafuqs.spectrum.compat.*;
import de.dafuqs.spectrum.registries.SpectrumItems;
import net.fabricmc.api.*;
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
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.block.piston.PistonBehavior;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.fluid.*;
import net.minecraft.item.Item;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.util.DyeColor;
import net.minecraft.world.*;
import org.jetbrains.annotations.*;

import static de.dafuqs.spectrum.registries.SpectrumBlocks.registerBlockWithItem;

public class CreateCompat extends SpectrumIntegrationPacks.ModIntegrationPack {

public static Block SMALL_ZINC_BUD;
public static Block LARGE_ZINC_BUD;
public static Block ZINC_CLUSTER;
public static Block PURE_ZINC_BLOCK;
public static Item PURE_ZINC;

@Override
public void register() {
SMALL_ZINC_BUD = new SpectrumClusterBlock(FabricBlockSettings.create().pistonBehavior(PistonBehavior.DESTROY).hardness(1.0f).mapColor(Blocks.LIGHT_GRAY_CONCRETE.getDefaultMapColor()).requiresTool().nonOpaque(), SpectrumClusterBlock.GrowthStage.SMALL);
LARGE_ZINC_BUD = new SpectrumClusterBlock(FabricBlockSettings.copyOf(SMALL_ZINC_BUD), SpectrumClusterBlock.GrowthStage.LARGE);
ZINC_CLUSTER = new SpectrumClusterBlock(FabricBlockSettings.copyOf(SMALL_ZINC_BUD), SpectrumClusterBlock.GrowthStage.CLUSTER);
PURE_ZINC_BLOCK = new Block(FabricBlockSettings.copyOf(Blocks.IRON_BLOCK));
PURE_ZINC = new Item(SpectrumItems.IS.of());
FabricItemSettings settings = SpectrumItems.IS.of();
registerBlockWithItem("small_zinc_bud", SMALL_ZINC_BUD, settings, DyeColor.BROWN);
registerBlockWithItem("large_zinc_bud", LARGE_ZINC_BUD, settings, DyeColor.BROWN);
registerBlockWithItem("zinc_cluster", ZINC_CLUSTER, settings, DyeColor.BROWN);
registerBlockWithItem("pure_zinc_block", PURE_ZINC_BLOCK, settings, DyeColor.BROWN);
SpectrumItems.register("pure_zinc", PURE_ZINC, DyeColor.BROWN);




PipeCollisionEvent.FLOW.register(event -> {
final BlockState result = handleBidirectionalCollision(event.getLevel(), event.getFirstFluid(), event.getSecondFluid());
if (result != null) event.setState(result);
Expand Down Expand Up @@ -47,7 +81,9 @@ private BlockState spectrumFluidCollision(World world, FluidState state, FluidSt
@Environment(EnvType.CLIENT)
@Override
public void registerClient() {

BlockRenderLayerMap.INSTANCE.putBlock(SMALL_ZINC_BUD, RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(LARGE_ZINC_BUD, RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(ZINC_CLUSTER, RenderLayer.getCutout());
}

}
28 changes: 28 additions & 0 deletions src/main/java/de/dafuqs/spectrum/compat/malum/MalumCompat.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package de.dafuqs.spectrum.compat.malum;

import com.sammy.malum.client.screen.codex.BookEntry;
import com.sammy.malum.client.screen.codex.pages.EntryReference;
import com.sammy.malum.client.screen.codex.pages.text.HeadlineTextPage;
import com.sammy.malum.client.screen.codex.screens.ArcanaProgressionScreen;
import de.dafuqs.spectrum.compat.SpectrumIntegrationPacks;
import de.dafuqs.spectrum.registries.SpectrumBlocks;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;

public class MalumCompat extends SpectrumIntegrationPacks.ModIntegrationPack {
public void register() {

}

@Environment(EnvType.CLIENT)
@Override
public void registerClient() {
//couldn't get this to work
/* var spiritCrystalAndScytheAddendum = BookEntry.build("spirit_crystals.addendum")
.addPage(new HeadlineTextPage("spirit_crystals.addendum", "spirit_crystals.addendum.1"))
.build();
BookEntry.build("spirit_crystals")
.addReference(new EntryReference(SpectrumBlocks.PEDESTAL_ALL_BASIC.asItem(), spiritCrystalAndScytheAddendum))
.build(); */
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import de.dafuqs.spectrum.api.block.*;
import de.dafuqs.spectrum.api.energy.color.*;
import de.dafuqs.spectrum.api.interaction.*;
import de.dafuqs.spectrum.blocks.idols.FirestarterIdolBlock;
import de.dafuqs.spectrum.compat.claims.*;
import de.dafuqs.spectrum.entity.*;
import de.dafuqs.spectrum.helpers.*;
Expand All @@ -18,6 +19,7 @@
import net.minecraft.nbt.*;
import net.minecraft.network.packet.s2c.play.*;
import net.minecraft.server.network.*;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.sound.*;
import net.minecraft.util.*;
import net.minecraft.util.hit.*;
Expand Down Expand Up @@ -199,8 +201,15 @@ protected void onBlockHit(BlockHitResult blockHitResult) {
if (!coloredBlockState.isAir()) {
this.getWorld().setBlockState(blockPos, coloredBlockState);
}
if(this.getInkColor() == InkColors.ORANGE && this.getWorld().getBlockState(blockPos).getBlock() == Blocks.SNOW)
{
this.getWorld().setBlockState(blockPos, Blocks.AIR.getDefaultState());
}
}
if(this.getInkColor() == InkColors.ORANGE)
{
FirestarterIdolBlock.causeFire((ServerWorld) this.getWorld(), blockHitResult.getBlockPos(), blockHitResult.getSide());
}

affectEntitiesInRange(this.getOwner());
}

Expand All @@ -214,12 +223,21 @@ protected void onHit(LivingEntity target) {


Entity entity = target; //this.getEffectCause();

// TODO: this is a dummy effect
Vec3d vec3d = this.getVelocity().multiply(1.0D, 0.0D, 1.0D).normalize().multiply((double) 3 * 0.6D);
if (vec3d.lengthSquared() > 0.0D) {
entity.addVelocity(vec3d.x, 0.1D, vec3d.z);

if(this.getInkColor() == InkColors.ORANGE)
{
entity.setOnFireFor(2);
}
else
{
// TODO: this is a dummy effect
Vec3d vec3d = this.getVelocity().multiply(1.0D, 0.0D, 1.0D).normalize().multiply((double) 3 * 0.6D);
if (vec3d.lengthSquared() > 0.0D) {
entity.addVelocity(vec3d.x, 0.1D, vec3d.z);
}
}



affectEntitiesInRange(this.getOwner());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,15 @@ public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand han
if (!world.isClient) {
InkProjectileEntity.shoot(world, user, inkColor);
}
// cause the slightest bit of knockback
// cause the slightest bit of knockback (more if Red)
if (!user.isCreative()) {
causeKnockback(user, user.getYaw(), user.getPitch(), 0, 0.3F);
if(inkColor == InkColors.RED)
{
causeKnockback(user, user.getYaw(), user.getPitch(), 0.1F, 0.5F);
}
else{
causeKnockback(user, user.getYaw(), user.getPitch(), 0, 0.3F);
}
}
} else {
if (world.isClient) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import de.dafuqs.spectrum.blocks.mob_head.*;
import de.dafuqs.spectrum.compat.*;
import de.dafuqs.spectrum.compat.ae2.*;
import de.dafuqs.spectrum.compat.create.CreateCompat;
import de.dafuqs.spectrum.compat.gobber.*;
import de.dafuqs.spectrum.helpers.*;
import de.dafuqs.spectrum.items.food.beverages.*;
Expand Down Expand Up @@ -724,6 +725,15 @@ public static void register() {
entries.add(AE2Compat.FLUIX_CLUSTER);
entries.add(AE2Compat.PURE_FLUIX_BLOCK);
}

if (SpectrumIntegrationPacks.isIntegrationPackActive(SpectrumIntegrationPacks.CREATE_ID))
{
entries.add(CreateCompat.PURE_ZINC);
entries.add(CreateCompat.SMALL_ZINC_BUD);
entries.add(CreateCompat.LARGE_ZINC_BUD);
entries.add(CreateCompat.ZINC_CLUSTER);
entries.add(CreateCompat.PURE_ZINC_BLOCK);
}

if (SpectrumIntegrationPacks.isIntegrationPackActive(SpectrumIntegrationPacks.GOBBER_ID)) {
entries.add(GobberCompat.PURE_GLOBETTE);
Expand Down
30 changes: 30 additions & 0 deletions src/main/resources/assets/spectrum/blockstates/large_zinc_bud.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"variants": {
"facing=down": {
"model": "spectrum:block/large_zinc_bud",
"x": 180
},
"facing=east": {
"model": "spectrum:block/large_zinc_bud",
"x": 90,
"y": 90
},
"facing=north": {
"model": "spectrum:block/large_zinc_bud",
"x": 90
},
"facing=south": {
"model": "spectrum:block/large_zinc_bud",
"x": 90,
"y": 180
},
"facing=up": {
"model": "spectrum:block/large_zinc_bud"
},
"facing=west": {
"model": "spectrum:block/large_zinc_bud",
"x": 90,
"y": 270
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "spectrum:block/pure_zinc_block"
}
}
}
30 changes: 30 additions & 0 deletions src/main/resources/assets/spectrum/blockstates/small_zinc_bud.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"variants": {
"facing=down": {
"model": "spectrum:block/small_zinc_bud",
"x": 180
},
"facing=east": {
"model": "spectrum:block/small_zinc_bud",
"x": 90,
"y": 90
},
"facing=north": {
"model": "spectrum:block/small_zinc_bud",
"x": 90
},
"facing=south": {
"model": "spectrum:block/small_zinc_bud",
"x": 90,
"y": 180
},
"facing=up": {
"model": "spectrum:block/small_zinc_bud"
},
"facing=west": {
"model": "spectrum:block/small_zinc_bud",
"x": 90,
"y": 270
}
}
}
Loading

0 comments on commit 459f43c

Please sign in to comment.