Skip to content

Commit

Permalink
changed pocket dim renderer & added soul bound enchant
Browse files Browse the repository at this point in the history
  • Loading branch information
CammiePone committed Jan 13, 2025
1 parent 8244294 commit cc8699a
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public void onInitialize() {
RegistryService registryService = RegistryService.get();
ArcanusEntityAttributes.registerAll();
ArcanusEntities.ENTITY_TYPES.accept(registryService);
ArcanusEnchantments.ENCHANTMENTS.accept(registryService);
ArcanusBlocks.BLOCKS.accept(registryService);
ArcanusItems.ITEM_GROUPS.accept(registryService);
ArcanusItems.ITEMS.accept(registryService);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public void render(PocketDimensionPortalEntity entity, float yaw, float tickDelt
StencilBuffer stencilBuffer = ((StencilBuffer) client.getMainRenderTarget());
RenderType portalLayer = ArcanusClient.getMagicPortal(PORTAL_TEXTURE);
RenderType sigilLayer = ArcanusClient.getMagicCircles(SIGIL_TEXTURE);
Color color = ArcanusHelper.getMagicColor(entity);
Color pocketDimColor = ArcanusHelper.getPocketDimensionColor(entity);
Color magicColor = ArcanusHelper.getMagicColor(entity);
float ageDelta = entity.getTrueAge() + tickDelta;
float maxScale = 0.75f;
float scale = entity.getTrueAge() <= 100 ? Math.min(maxScale, (ageDelta / 100f) * maxScale) : entity.getTrueAge() > 700 ? Math.max(0, (1 - (ageDelta - 700) / 20f) * maxScale) : maxScale;
Expand Down Expand Up @@ -84,7 +85,7 @@ public void render(PocketDimensionPortalEntity entity, float yaw, float tickDelt
matrices.translate(-0.375, 0, 0);
matrices.mulPose(Axis.ZP.rotationDegrees(90));
matrices.scale(maxScale, maxScale, maxScale);
portalModel.renderToBuffer(matrices, vertices.getBuffer(portalLayer), light, OverlayTexture.NO_OVERLAY, color.redF(), color.greenF(), color.blueF(), 1.0F);
portalModel.renderToBuffer(matrices, vertices.getBuffer(portalLayer), light, OverlayTexture.NO_OVERLAY, pocketDimColor.redF(), pocketDimColor.greenF(), pocketDimColor.blueF(), 1.0F);
matrices.popPose();

if(vertices instanceof MultiBufferSource.BufferSource immediate) {
Expand Down Expand Up @@ -118,7 +119,7 @@ public void render(PocketDimensionPortalEntity entity, float yaw, float tickDelt
matrices.mulPose(Axis.XP.rotationDegrees(180.0F));
matrices.scale(scale / maxScale, 1.0F, scale / maxScale);
sigilModel.sigil.yRot = (entity.tickCount + tickDelta) * 0.015F;
sigilModel.renderToBuffer(matrices, vertices.getBuffer(sigilLayer), light, OverlayTexture.NO_OVERLAY, color.redF(), color.greenF(), color.blueF(), 1.0F);
sigilModel.renderToBuffer(matrices, vertices.getBuffer(sigilLayer), light, OverlayTexture.NO_OVERLAY, magicColor.redF(), magicColor.greenF(), magicColor.blueF(), 1.0F);
matrices.popPose();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package dev.cammiescorner.arcanuscontinuum.common.enchantments;

import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.enchantment.Enchantment;
import net.minecraft.world.item.enchantment.EnchantmentCategory;

public class SoulBoundEnchantment extends Enchantment {
public SoulBoundEnchantment() {
super(Rarity.RARE, EnchantmentCategory.WEARABLE, EquipmentSlot.values());
}

@Override
public boolean canEnchant(ItemStack stack) {
return stack.isEnchantable();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ public StaffItem(StaffType staffType, Color defaultPrimaryColor, Color defaultSe
this.isDonorOnly = isDonorOnly;
}

@Override
public boolean isEnchantable(ItemStack stack) {
return true;
}

@Override
public void onCraftedBy(ItemStack stack, Level world, Player player) {
if(!world.isClientSide()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package dev.cammiescorner.arcanuscontinuum.common.registry;

import dev.cammiescorner.arcanuscontinuum.Arcanus;
import dev.cammiescorner.arcanuscontinuum.common.enchantments.SoulBoundEnchantment;
import dev.upcraft.sparkweave.api.registry.RegistryHandler;
import dev.upcraft.sparkweave.api.registry.RegistrySupplier;
import net.minecraft.core.registries.Registries;
import net.minecraft.world.item.enchantment.Enchantment;

public class ArcanusEnchantments {
public static final RegistryHandler<Enchantment> ENCHANTMENTS = RegistryHandler.create(Registries.ENCHANTMENT, Arcanus.MOD_ID);

public static final RegistrySupplier<Enchantment> SOUL_BOUND = ENCHANTMENTS.register("soul_bound", SoulBoundEnchantment::new);
}

0 comments on commit cc8699a

Please sign in to comment.