Skip to content

Commit

Permalink
Merge branch 'master' into sihuai
Browse files Browse the repository at this point in the history
  • Loading branch information
Sihuai2412 committed Oct 3, 2024
2 parents 8ece2d7 + 65c7331 commit 03c8a23
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 52 deletions.
29 changes: 25 additions & 4 deletions src/main/java/org/confluence/mod/client/ModClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,15 @@
import org.confluence.mod.client.renderer.AchievementToast;
import org.confluence.mod.client.renderer.block.*;
import org.confluence.mod.client.renderer.entity.*;
import org.confluence.mod.client.renderer.entity.bomb.BaseBombEntityRenderer;
import org.confluence.mod.client.renderer.entity.bomb.BouncyBombEntityRenderer;
import org.confluence.mod.client.renderer.entity.bomb.ScarabBombEntityRenderer;
import org.confluence.mod.client.renderer.entity.bomb.StickyBombEntityRenderer;
import org.confluence.mod.client.renderer.entity.bomb.*;
import org.confluence.mod.client.renderer.entity.fishing.BaseFishingHookRenderer;
import org.confluence.mod.client.renderer.entity.fishing.BloodyFishingHookRenderer;
import org.confluence.mod.client.renderer.entity.fishing.GlowingFishingHookRenderer;
import org.confluence.mod.client.renderer.entity.fishing.HotlineFishingHookRenderer;
import org.confluence.mod.client.renderer.entity.hook.*;
import org.confluence.mod.client.renderer.gui.*;
import org.confluence.mod.entity.boss.geoRenderer.EaterOfWorldRenderer;
import org.confluence.mod.entity.boss.geoRenderer.EaterOfWorld_SegmentRenderer;
import org.confluence.mod.entity.boss.geoRenderer.KingSkullHandRenderer;
import org.confluence.mod.entity.boss.geoRenderer.KingSkullRenderer;
import org.confluence.mod.fluid.ModFluids;
Expand All @@ -54,6 +53,8 @@
import org.confluence.mod.item.common.Materials;
import org.confluence.mod.item.curio.CurioItems;
import org.confluence.mod.item.fishing.FishingPoles;
import org.confluence.mod.item.potion.TerraPotions;
import org.confluence.mod.item.potion.VanillaPotionItem;
import org.confluence.mod.menu.ModMenus;
import org.confluence.mod.misc.ModArmPoses;

Expand Down Expand Up @@ -316,10 +317,15 @@ public static void registerEntityRenderers(EntityRenderersEvent.RegisterRenderer
event.registerEntityRenderer(BLACK_SLIME.get(), c -> new CustomSlimeRenderer(c, "black"));

event.registerEntityRenderer(KING_SLIME.get(), c -> new CustomSlimeRenderer(c, "king"));

event.registerEntityRenderer(EATER_OF_WORLD.get(), EaterOfWorldRenderer::new);
event.registerEntityRenderer(EATER_OF_WORLD_SEGMENT.get(), EaterOfWorld_SegmentRenderer::new);

event.registerEntityRenderer(KING_SKULL.get(), KingSkullRenderer::new);
event.registerEntityRenderer(KING_SKULL_HAND.get(), KingSkullHandRenderer::new);



event.registerEntityRenderer(DEMON_EYE.get(), DemonEyeRenderer::new);
event.registerEntityRenderer(CTHULHU_EYE.get(), CthulhuEyeRenderer::new);
event.registerEntityRenderer(TEST_WORM.get(), TestWormRenderer::new);
Expand All @@ -340,11 +346,17 @@ public static void registerEntityRenderers(EntityRenderersEvent.RegisterRenderer
event.registerEntityRenderer(ICE_BLADE_SWORD_PROJECTILE.get(), IceBladeSwordProjectileRenderer::new);
event.registerEntityRenderer(THROW_KNIVES_PROJECTILE.get(), ThrowingKnivesProjectileRenderer::new);
event.registerEntityRenderer(SHURIKEN_PROJECTILE.get(), ShurikenProjectileRenderer::new);
event.registerEntityRenderer(STAR_FURY_PROJECTILE.get(), StarFuryProjectileRenderer::new);
event.registerEntityRenderer(ARROW_PROJECTILE.get(), TerraArrowRenderer::new);


event.registerEntityRenderer(STEP_STOOL.get(), StepStoolRenderer::new);
event.registerEntityRenderer(BOMB_ENTITY.get(), BaseBombEntityRenderer::new);
event.registerEntityRenderer(BOUNCY_BOMB_ENTITY.get(), BouncyBombEntityRenderer::new);
event.registerEntityRenderer(SCARAB_BOMB_ENTITY.get(), ScarabBombEntityRenderer::new);
event.registerEntityRenderer(STICKY_BOMB_ENTITY.get(), StickyBombEntityRenderer::new);
event.registerEntityRenderer(BOMB_FISH_ENTITY.get(), BombFishEntityRenderer::new);


event.registerEntityRenderer(BASE_HOOK.get(), BaseHookRenderer::new);
event.registerEntityRenderer(WEB_SLINGER.get(), WebSlingerRenderer::new);
Expand Down Expand Up @@ -374,6 +386,9 @@ public static void registerEntityRenderers(EntityRenderersEvent.RegisterRenderer
event.registerBlockEntityRenderer(ModBlocks.BASE_CHEST_BLOCK_ENTITY.get(), BaseChestBlockRenderer::new);
event.registerBlockEntityRenderer(ModBlocks.DEATH_CHEST_BLOCK_ENTITY.get(), DeathChestBlockRenderer::new);
event.registerBlockEntityRenderer(ModBlocks.WHITE_PLASTIC_CHAIR_ENTITY.get(), WhitePlasticChairRenderer::new);
event.registerBlockEntityRenderer(ModBlocks.SKY_MILL_ENTITY.get(), SkyMillBlockRenderer::new);
event.registerBlockEntityRenderer(ModBlocks.ALCHEMY_TABLE_BLOCK_ENTITY.get(), AlchemyTableBlockRenderer::new);


event.registerEntityRenderer(FLAIL.get(), FlailRenderer::new);
event.registerEntityRenderer(CHAIR.get(), NoopRenderer::new);
Expand All @@ -394,9 +409,12 @@ public static void registerParticles(RegisterParticleProvidersEvent event) {
event.registerSpriteSet(ModParticles.FLAMEFLOWER_BLOOM.get(), FlameFlowerParticle.Provider::new);
event.registerSpriteSet(ModParticles.CURRENT_DUST.get(), CurrentColorDustParticle.Provider::new);
event.registerSpriteSet(ModParticles.BLOOD.get(), BloodParticle.Provider::new);
event.registerSpriteSet(ModParticles.BODY_PART.get(), pSprites -> new BodyPartsParticle.Provider());
event.registerSpriteSet(ModParticles.LIGHTS_BANE.get(), LightsBaneParticle.Provider::new);
event.registerSpriteSet(ModParticles.LIGHTS_BANE_DUST.get(), LightsBaneDustParticle.Provider::new);
event.registerSpriteSet(ModParticles.LIGHTS_BANE_FADE.get(), LightsBaneFadeParticle.Provider::new);
event.registerSpriteSet(ModParticles.DAMAGE_INDICATOR.get(), pSprites -> new DamageIndicatorParticle.Provider());

}

@SubscribeEvent
Expand All @@ -407,6 +425,9 @@ public static void registerBlockColors(RegisterColorHandlersEvent.Block event) {
@SubscribeEvent
public static void registerItemColors(RegisterColorHandlersEvent.Item event) {
event.register(SIMPLE, Materials.GEL.get());
event.register((pStack, pTintIndex) -> pTintIndex > 0 ? -1 :
VanillaPotionItem.getColor(pStack), TerraPotions.VANILLA_POTION.get());

}

// @SubscribeEvent
Expand Down
25 changes: 0 additions & 25 deletions src/main/java/org/confluence/mod/client/shader/RenderEvents.java
Original file line number Diff line number Diff line change
@@ -1,35 +1,10 @@
package org.confluence.mod.client.shader;

import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.*;
import com.mojang.math.Axis;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Font;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.RenderLevelStageEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import org.confluence.mod.Confluence;
import org.confluence.mod.client.KeyBindings;
import org.confluence.mod.effect.ModEffects;
import org.confluence.mod.effect.beneficial.helper.SpelunkerHelper;
import org.confluence.mod.mixin.accessor.FontAccessor;
import org.confluence.mod.util.ModUtils;
import org.joml.Matrix4f;
import org.joml.Quaternionf;
import org.joml.Vector3f;
import org.lwjgl.opengl.GL11;

import java.awt.*;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;

import static org.confluence.mod.effect.beneficial.helper.SpelunkerHelper.renderLevel;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,8 @@ protected void addTranslations() {
add("painting.confluence.uqtqu_day.author", "BiliBili__昼泽_");
add("painting.confluence.emerald_shenyi.title", "EMERALD_SHENYI");
add("painting.confluence.emerald_shenyi.author", "BiliBili_Emerald_审翼");
add("painting.confluence.black_cat.title", "BLACK_CAT");
add("painting.confluence.black_cat.author", "???");
add("painting.confluence.chromatic.title", "CHROMATIC");
add("painting.confluence.chromatic.author", "BiliBili_陌林_Chromatic");

// new
add("achievements.toast.complete", "成就达成!");
Expand Down Expand Up @@ -488,6 +488,7 @@ protected void addTranslations() {
add("title.confluence.shimmer_transmutation", "微光嬗变");
add("title.confluence.altar", "献祭");
add("title.confluence.sky_mill", "天域工艺");
add("container.confluence.sky_mill", "天域工艺");
add("condition.confluence.shimmer_transmutation", "需要的游戏阶段: %s");

add("item.confluence.aglet.info", "它可以在地表宝箱、木匣和珍珠木匣中找到。");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,8 @@ protected void addTranslations() {
add("painting.confluence.uqtqu_day.author", "BiliBili__昼泽_");
add("painting.confluence.emerald_shenyi.title", "EMERALD_SHENYI");
add("painting.confluence.emerald_shenyi.author", "BiliBili_Emerald_审翼");
add("painting.confluence.black_cat.title", "BLACK_CAT");
add("painting.confluence.black_cat.author", "???");
add("painting.confluence.chromatic.title", "CHROMATIC");
add("painting.confluence.chromatic.author", "BiliBili_陌林_Chromatic");

// new
add("achievements.toast.complete", "Achievement achieved!");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public static SpelunkerHelper getSingleton(Player player){
public Map<Block, java.util.List<BlockPos>> blockMap = new HashMap<>();
private Boolean INIT = false;
private Player player;
private Minecraft mc;

enum ShowType {SPELUNKER, DANGER}

Expand All @@ -68,6 +69,7 @@ public SpelunkerHelper(Player player) {
genBlocks();

if(!INIT){
mc = Minecraft.getInstance();
//远古残骸
putTarget(Blocks.ANCIENT_DEBRIS,Color.MAGENTA,true, ShowType.SPELUNKER);//这个还必须放这个位置
//钻石矿
Expand Down Expand Up @@ -151,6 +153,10 @@ public SpelunkerHelper(Player player) {
//example
// putTarget(Blocks.STONE, new Color(255,255,255));

/**危险感知**/
putTarget(Blocks.POLISHED_BLACKSTONE_PRESSURE_PLATE, Color.MAGENTA,true, ShowType.DANGER);
putTarget(Blocks.STONE_PRESSURE_PLATE, Color.MAGENTA,true, ShowType.DANGER);



INIT = true;
Expand All @@ -163,6 +169,7 @@ public void putTarget(Block block, Color color, Boolean always, ShowType showTyp

public record Tuple(Color color,Boolean showText,ShowType showType) { }


public void genBlocks() {

for(var n : blockMap.entrySet()){
Expand All @@ -180,7 +187,8 @@ public void genBlocks() {
if (targets.containsKey(block) /*&&//有目标且
(!centerCache.containsKey(pos) ||//未已缓存或
centerCache.containsKey(pos) && player.level().getBlockState(pos).is(Blocks.AIR))*/
//&&targets.
&& (targets.get(block).showType==ShowType.SPELUNKER && mc.player.hasEffect(ModEffects.SPELUNKER.get()) ||
targets.get(block).showType==ShowType.DANGER && mc.player.hasEffect(ModEffects.DANGER_SENSE.get()))
) {//已缓存但为空

var list = blockMap.computeIfAbsent(block, k1 -> new ArrayList<>());
Expand Down Expand Up @@ -215,7 +223,7 @@ public static void renderLevel(RenderLevelStageEvent event){
SpelunkerHelper blockGen= SpelunkerHelper.getSingleton(minecraft.player);
//效果消失,清除缓存
if(!Minecraft.getInstance().player.hasEffect(ModEffects.SPELUNKER.get())
||!Minecraft.getInstance().player.hasEffect(ModEffects.DANGER_SENSE.get())
&&!Minecraft.getInstance().player.hasEffect(ModEffects.DANGER_SENSE.get())
){
if(blockGen!=null){
blockGen.centerCache.clear();;
Expand Down Expand Up @@ -289,26 +297,31 @@ public static void renderLevel(RenderLevelStageEvent event){
}
}


//todo 可以优化
for(BlockPos centerPos : centers.get(n.getKey())){//否则查找所有的中心块
double distance = centerPos.distSqr(blockProps);
if(distance < blockGen.centerInternal){//附近有中心块,添加缓存
centerMap.put(blockProps, centerPos);
ifNear = true;
break;
if(blockGen.targets.get(n.getKey()).showType==ShowType.SPELUNKER){//矿透方块
if(!minecraft.player.hasEffect(ModEffects.SPELUNKER.get()))continue;
//todo 可以优化
for(BlockPos centerPos : centers.get(n.getKey())){//否则查找所有的中心块
double distance = centerPos.distSqr(blockProps);
if(distance < blockGen.centerInternal){//附近有中心块,添加缓存
centerMap.put(blockProps, centerPos);
ifNear = true;
break;
}
}
}


if(ifNear){
if(!KeyBindings.TAB.get().isDown())continue;//非中心块或tab按下不渲染
if(ifNear){
if(!KeyBindings.TAB.get().isDown())continue;//非中心块或tab按下不渲染

}else{
centers.get(n.getKey()).add(blockProps);//太远则自己成为中心块
shouldRenderCache.put(blockProps,n.getKey());//只渲染中心块文本
}else{
centers.get(n.getKey()).add(blockProps);//太远则自己成为中心块
shouldRenderCache.put(blockProps,n.getKey());//只渲染中心块文本
}
}else if(blockGen.targets.get(n.getKey()).showType==ShowType.DANGER){//危险方块
if(!minecraft.player.hasEffect(ModEffects.DANGER_SENSE.get()))continue;
shouldRenderCache.put(blockProps,n.getKey());//渲染所有危险方块
}


//距离越远透明度越低
a = (int) ((255- Math.min(playerPos.distanceToSqr(blockProps.getX(),blockProps.getY(),blockProps.getZ())/(blockGen.range*blockGen.range)*255,255))* blockGen.maxAlpha);
if(a<=0)continue;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/confluence/mod/misc/ModPaintings.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public final class ModPaintings {
public static final RegistryObject<PaintingVariant> KHAKI_COFFEE_BEANS = PAINTING_VARIANTS.register("khaki_coffee_beans", () -> new PaintingVariant(32, 32));
public static final RegistryObject<PaintingVariant> UQTQU_DAY = PAINTING_VARIANTS.register("uqtqu_day", () -> new PaintingVariant(32, 32));
public static final RegistryObject<PaintingVariant> EMERALD_SHENYI = PAINTING_VARIANTS.register("emerald_shenyi", () -> new PaintingVariant(32, 32));
public static final RegistryObject<PaintingVariant> BLACK_CAT = PAINTING_VARIANTS.register("black_cat", () -> new PaintingVariant(32, 32));
public static final RegistryObject<PaintingVariant> CHROMATIC = PAINTING_VARIANTS.register("chromatic", () -> new PaintingVariant(32, 32));

public static void register(IEventBus bus) {
PAINTING_VARIANTS.register(bus);
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
"confluence:khaki_coffee_beans",
"confluence:uqtqu_day",
"confluence:emerald_shenyi",
"confluence:black_cat"
"confluence:chromatic"
]
}

0 comments on commit 03c8a23

Please sign in to comment.