Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/generated/resources/assets/anvilcraft/lang/en_ud.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,21 @@
"anvilcraft.configuration.giant_anvil_max_shock_radius.tooltip": "ɹoᴉʌɐɥǝq ʞɔoɥs s,ꞁᴉʌuɐ ʇuɐᴉᵷ ɟo snᴉpɐɹ ɯnɯᴉxɐW",
"anvilcraft.configuration.goggle_mode": "ǝpoW ǝꞁᵷᵷo⅁",
"anvilcraft.configuration.goggle_mode.tooltip": "oɟuᴉ ǝꞁᵷᵷoᵷ ɹǝɯɯɐɥ ꞁᴉʌuɐ ǝɥʇ ɟo ǝpoɯ ǝɥ⟘",
"anvilcraft.configuration.gravitational_lens": "suǝꞀ ꞁɐuoᴉʇɐʇᴉʌɐɹ⅁",
"anvilcraft.configuration.gravitational_lens.button": "suǝꞀ ꞁɐuoᴉʇɐʇᴉʌɐɹ⅁",
"anvilcraft.configuration.gravitational_lens.event_horizon_radius": "snᴉpɐᴚ uozᴉɹoH ʇuǝʌƎ",
"anvilcraft.configuration.gravitational_lens.event_horizon_radius.tooltip": "(ʇꞁnɐɟǝp Ɛ80˙0 'sʇᴉun Ʌ∩ uǝǝɹɔs) snᴉpɐɹ uozᴉɹoɥ ʇuǝʌƎ",
"anvilcraft.configuration.gravitational_lens.lens_direction": "uoᴉʇɔǝɹᴉᗡ suǝꞀ",
"anvilcraft.configuration.gravitational_lens.lens_direction.tooltip": "˙ɥʇᵷuǝɹʇs sǝꞁɐɔs ǝpnʇᴉuᵷɐW ˙(ʎɐʍɐ ɥsnd) ǝʌɐɔuoɔ = 0> '(ɹǝʇuǝɔ pɹɐʍoʇ ꞁꞁnd ꞁɐuoᴉʇɐʇᴉʌɐɹᵷ) xǝʌuoɔ = 0< :uoᴉʇɔǝɹᴉp suǝꞀ",
"anvilcraft.configuration.gravitational_lens.lens_perspective_scale": "ǝꞁɐɔS ǝʌᴉʇɔǝdsɹǝԀ suǝꞀ",
"anvilcraft.configuration.gravitational_lens.lens_perspective_scale.tooltip": "˙ɹǝᵷᵷᴉq = ɹǝsoꞁƆ ˙ǝzᴉs ᵷᴉɟuoɔ = ʇɔǝɟɟǝ 'ǝɔuɐʇsᴉp sᴉɥʇ ʇⱯ ˙ᵷuᴉꞁɐɔs ǝʌᴉʇɔǝdsɹǝd ɹoɟ ǝɔuɐʇsᴉp ǝɔuǝɹǝɟǝᴚ",
"anvilcraft.configuration.gravitational_lens.lens_strength": "ɥʇᵷuǝɹʇS suǝꞀ",
"anvilcraft.configuration.gravitational_lens.lens_strength.tooltip": "(ʇꞁnɐɟǝp ᘔ00˙0 'ᵷuᴉpuǝq ɹǝᵷuoɹʇs = ɹǝɥᵷᴉɥ) ɥʇᵷuǝɹʇs uoᴉʇɹoʇsᴉp suǝꞀ",
"anvilcraft.configuration.gravitational_lens.max_hole_count": "ʇunoƆ ǝꞁoH xɐW",
"anvilcraft.configuration.gravitational_lens.max_hole_count.tooltip": "˙ǝɔuɐɯɹoɟɹǝd ɹǝʇʇǝq = ɹǝʍoꞁ 'sǝꞁoɥ ǝɹoɯ = ɹǝɥᵷᴉH ˙(9ϛᘔ-ᘔ) pǝɹǝpuǝɹ sǝꞁoɥ ǝʇᴉɥʍ/ʞɔɐꞁq ɟo ɹǝqɯnu ɯnɯᴉxɐW",
"anvilcraft.configuration.gravitational_lens.render_black_hole_lensing": "ᵷuᴉsuǝꞀ ǝꞁoH ʞɔɐꞁᗺ ɹǝpuǝᴚ",
"anvilcraft.configuration.gravitational_lens.render_black_hole_lensing.tooltip": "sǝꞁoɥ ʞɔɐꞁq ɹɐǝu ʇɔǝɟɟǝ ᵷuᴉssǝɔoɹd-ʇsod ᵷuᴉsuǝꞁ ꞁɐuoᴉʇɐʇᴉʌɐɹ⅁",
"anvilcraft.configuration.gravitational_lens.tooltip": "suǝꞀ ꞁɐuoᴉʇɐʇᴉʌɐɹ⅁",
"anvilcraft.configuration.ground_heave_particle_chance": "ǝɔuɐɥƆ ǝꞁɔᴉʇɹɐԀ ǝʌɐǝH punoɹ⅁",
"anvilcraft.configuration.ground_heave_particle_chance.tooltip": "sǝꞁɔᴉʇɹɐd ǝʌɐǝɥ punoɹᵷ suʍɐds ʞɔoꞁq ɥɔɐǝ (0˙⥝-0˙0) ʎʇᴉꞁᴉqɐqoɹԀ",
"anvilcraft.configuration.ground_heave_particle_count": "ʇunoƆ ǝꞁɔᴉʇɹɐԀ ǝʌɐǝH punoɹ⅁",
Expand Down
15 changes: 15 additions & 0 deletions src/generated/resources/assets/anvilcraft/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,21 @@
"anvilcraft.configuration.giant_anvil_max_shock_radius.tooltip": "Maximum radius of giant anvil's shock behavior",
"anvilcraft.configuration.goggle_mode": "Goggle Mode",
"anvilcraft.configuration.goggle_mode.tooltip": "The mode of the anvil hammer goggle info",
"anvilcraft.configuration.gravitational_lens": "Gravitational Lens",
"anvilcraft.configuration.gravitational_lens.button": "Gravitational Lens",
"anvilcraft.configuration.gravitational_lens.event_horizon_radius": "Event Horizon Radius",
"anvilcraft.configuration.gravitational_lens.event_horizon_radius.tooltip": "Event horizon radius (screen UV units, 0.083 default)",
"anvilcraft.configuration.gravitational_lens.lens_direction": "Lens Direction",
"anvilcraft.configuration.gravitational_lens.lens_direction.tooltip": "Lens direction: >0 = convex (gravitational pull toward center), <0 = concave (push away). Magnitude scales strength.",
"anvilcraft.configuration.gravitational_lens.lens_perspective_scale": "Lens Perspective Scale",
"anvilcraft.configuration.gravitational_lens.lens_perspective_scale.tooltip": "Reference distance for perspective scaling. At this distance, effect = config size. Closer = bigger.",
"anvilcraft.configuration.gravitational_lens.lens_strength": "Lens Strength",
"anvilcraft.configuration.gravitational_lens.lens_strength.tooltip": "Lens distortion strength (higher = stronger bending, 0.002 default)",
"anvilcraft.configuration.gravitational_lens.max_hole_count": "Max Hole Count",
"anvilcraft.configuration.gravitational_lens.max_hole_count.tooltip": "Maximum number of black/white holes rendered (2-256). Higher = more holes, lower = better performance.",
"anvilcraft.configuration.gravitational_lens.render_black_hole_lensing": "Render Black Hole Lensing",
"anvilcraft.configuration.gravitational_lens.render_black_hole_lensing.tooltip": "Gravitational lensing post-processing effect near black holes",
"anvilcraft.configuration.gravitational_lens.tooltip": "Gravitational Lens",
"anvilcraft.configuration.ground_heave_particle_chance": "Ground Heave Particle Chance",
"anvilcraft.configuration.ground_heave_particle_chance.tooltip": "Probability (0.0-1.0) each block spawns ground heave particles",
"anvilcraft.configuration.ground_heave_particle_count": "Ground Heave Particle Count",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dev.dubhe.anvilcraft.block.entity;

import dev.dubhe.anvilcraft.client.support.GravitationalLensManager;
import dev.dubhe.anvilcraft.init.block.ModBlockEntities;
import dev.dubhe.anvilcraft.util.GravityManager;
import net.minecraft.core.BlockPos;
Expand All @@ -19,19 +20,27 @@ public static BlackHoleBlockEntity createBlockEntity(BlockEntityType<?> type, Bl
@Override
public void onLoad() {
super.onLoad();
if (this.level != null && !this.level.isClientSide) {
GravityManager.GravitySourceType type = GravityManager.GravitySourceManager.getType(this.getBlockState().getBlock());
if (type != null) {
GravityManager.GravitySourceManager.addSource(this.level, this.worldPosition, type);
if (this.level != null) {
if (this.level.isClientSide) {
GravitationalLensManager.register(this.worldPosition);
} else {
GravityManager.GravitySourceType type = GravityManager.GravitySourceManager.getType(this.getBlockState().getBlock());
if (type != null) {
GravityManager.GravitySourceManager.addSource(this.level, this.worldPosition, type);
}
}
}
}

@Override
public void setRemoved() {
super.setRemoved();
if (this.level != null && !this.level.isClientSide) {
GravityManager.GravitySourceManager.removeSource(this.level, this.worldPosition);
if (this.level != null) {
if (this.level.isClientSide) {
GravitationalLensManager.unregister(this.worldPosition);
} else {
GravityManager.GravitySourceManager.removeSource(this.level, this.worldPosition);
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dev.dubhe.anvilcraft.block.entity;

import dev.dubhe.anvilcraft.client.support.GravitationalLensManager;
import dev.dubhe.anvilcraft.init.block.ModBlockEntities;
import dev.dubhe.anvilcraft.util.GravityManager;
import net.minecraft.core.BlockPos;
Expand All @@ -19,19 +20,27 @@ public static WhiteHoleBlockEntity createBlockEntity(BlockEntityType<?> type, Bl
@Override
public void onLoad() {
super.onLoad();
if (this.level != null && !this.level.isClientSide) {
GravityManager.GravitySourceType type = GravityManager.GravitySourceManager.getType(this.getBlockState().getBlock());
if (type != null) {
GravityManager.GravitySourceManager.addSource(this.level, this.worldPosition, type);
if (this.level != null) {
if (this.level.isClientSide) {
GravitationalLensManager.registerWhiteHole(this.worldPosition);
} else {
GravityManager.GravitySourceType type = GravityManager.GravitySourceManager.getType(this.getBlockState().getBlock());
if (type != null) {
GravityManager.GravitySourceManager.addSource(this.level, this.worldPosition, type);
}
}
}
}

@Override
public void setRemoved() {
super.setRemoved();
if (this.level != null && !this.level.isClientSide) {
GravityManager.GravitySourceManager.removeSource(this.level, this.worldPosition);
if (this.level != null) {
if (this.level.isClientSide) {
GravitationalLensManager.unregisterWhiteHole(this.worldPosition);
} else {
GravityManager.GravitySourceManager.removeSource(this.level, this.worldPosition);
}
}
}
}
}
28 changes: 27 additions & 1 deletion src/main/java/dev/dubhe/anvilcraft/client/init/ModShaders.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.mojang.blaze3d.vertex.DefaultVertexFormat;
import dev.dubhe.anvilcraft.AnvilCraft;
import dev.dubhe.anvilcraft.client.support.GravitationalLensManager;
import lombok.Getter;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.PostChain;
Expand All @@ -15,9 +16,12 @@

public class ModShaders {
public static final ResourceLocation LASER_BLOOM_LOCATION = AnvilCraft.of("shaders/post/bloom.json");
public static final ResourceLocation GRAVITATIONAL_LENS_LOCATION = AnvilCraft.of("shaders/post/gravitational_lens.json");

@Getter
private static PostChain bloomChain;
@Getter
private static PostChain lensChain;
static final Minecraft MINECRAFT = Minecraft.getInstance();

@Getter
Expand All @@ -38,7 +42,8 @@ public class ModShaders {

public static void register(RegisterShadersEvent event) {
try {
event.registerShader(new ShaderInstance(
event.registerShader(
new ShaderInstance(
event.getResourceProvider(),
AnvilCraft.of("rendertype_laser"),
DefaultVertexFormat.BLOCK
Expand Down Expand Up @@ -102,6 +107,9 @@ public static void resize(int width, int height) {
if (bloomChain != null) {
bloomChain.resize(width, height);
}
if (lensChain != null) {
lensChain.resize(width, height);
}
orthoMatrix = new Matrix4f()
.setOrtho(
0f,
Expand Down Expand Up @@ -132,4 +140,22 @@ public static void loadBloomEffect(ResourceProvider resourceProvider) throws IOE
AnvilCraft.LOGGER.error("Could not load bloom effect shader.", tr);
}
}

public static void loadLensEffect(ResourceProvider resourceProvider) throws IOException {
GravitationalLensManager.resetLensUbo();
try {
lensChain = new PostChain(
MINECRAFT.getTextureManager(),
resourceProvider,
Minecraft.getInstance().getMainRenderTarget(),
GRAVITATIONAL_LENS_LOCATION
);
lensChain.resize(
Minecraft.getInstance().getWindow().getWidth(),
Minecraft.getInstance().getWindow().getHeight()
);
} catch (Throwable tr) {
AnvilCraft.LOGGER.error("Could not load gravitational lens effect shader.", tr);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,8 @@ public static boolean isBloomEffectEnabled() {
public static boolean isScanPreviewEffectEnabled() {
return AnvilCraftClient.CONFIG.renderScanPreviewEffect;
}

public static boolean isLensEffectEnabled() {
return isEnhancedRenderingAvailable() && AnvilCraftClient.CONFIG.gravitationalLens.renderBlackHoleLensing;
}
}
Loading
Loading