Skip to content

Commit

Permalink
Update to Minecraft 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
Hantonik committed Jun 15, 2024
1 parent fe3ff71 commit 1c6c846
Show file tree
Hide file tree
Showing 22 changed files with 46 additions and 56 deletions.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ body:
description: |
Older versions are **not** supported!
options:
- '1.21'
- '1.20.6'
- '1.20.4'
- '1.20.1'
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ body:
multiple: true
options:
- 'Newer'
- '1.22'
- '1.21'
- '1.20.6'
- '1.20.4'
Expand Down
4 changes: 2 additions & 2 deletions Common/src/main/java/hantonik/fbp/config/FBPConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -244,15 +244,15 @@ public void reload(JsonObject json) {
this.disabledParticles = Util.make(Lists.newArrayList(), disabled -> {
if (json.has("disabledParticles")) {
for (var entry : GsonHelper.getAsJsonArray(json, "disabledParticles"))
disabled.add(Services.REGISTRY.getBlock(new ResourceLocation(entry.getAsString())));
disabled.add(Services.REGISTRY.getBlock(ResourceLocation.tryParse(entry.getAsString())));
} else
disabled.addAll(DEFAULT_DISABLED_PARTICLES);
});

this.disabledAnimations = Util.make(Lists.newArrayList(), disabled -> {
if (json.has("disabledAnimations")) {
for (var entry : GsonHelper.getAsJsonArray(json, "disabledAnimations"))
disabled.add(Services.REGISTRY.getBlock(new ResourceLocation(entry.getAsString())));
disabled.add(Services.REGISTRY.getBlock(ResourceLocation.tryParse(entry.getAsString())));
} else
disabled.addAll(DEFAULT_DISABLED_ANIMATIONS);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.layouts.GridLayout;
import net.minecraft.client.gui.layouts.LinearLayout;
import net.minecraft.client.gui.screens.OptionsScreen;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.options.OptionsScreen;
import net.minecraft.network.chat.Component;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ private void putCube(VertexConsumer buffer, Vector3d[] cube, float u, float v, i
}

private void addVertex(VertexConsumer buffer, Vector3d pos, float u, float v, int light, float rCol, float gCol, float bCol, float alpha) {
buffer.vertex(pos.x, pos.y, pos.z).uv(u, v).color(rCol, gCol, bCol, alpha).uv2(light).endVertex();
buffer.addVertex((float) pos.x, (float) pos.y, (float) pos.z).setUv(u, v).setColor(rCol, gCol, bCol, alpha).setLight(light);
}

@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ private void putCube(VertexConsumer buffer, Vector3d[] cube, float u, float v, i
}

private void addVertex(VertexConsumer buffer, Vector3d pos, float u, float v, int light, float rCol, float gCol, float bCol, float alpha) {
buffer.vertex(pos.x, pos.y, pos.z).uv(u, v).color(rCol, gCol, bCol, alpha).uv2(light).endVertex();
buffer.addVertex((float) pos.x, (float) pos.y, (float) pos.z).setUv(u, v).setColor(rCol, gCol, bCol, alpha).setLight(light);
}

public static class Provider implements ParticleProvider<SimpleParticleType> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ private void putCube(VertexConsumer buffer, Vector3d[] cube, float u, float v, i
}

private void addVertex(VertexConsumer buffer, Vector3d pos, float u, float v, int light, float rCol, float gCol, float bCol, float alpha) {
buffer.vertex(pos.x, pos.y, pos.z).uv(u, v).color(rCol, gCol, bCol, alpha).uv2(light).endVertex();
buffer.addVertex((float) pos.x, (float) pos.y, (float) pos.z).setUv(u, v).setColor(rCol, gCol, bCol, alpha).setLight(light);
}

@RequiredArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ private void putCube(VertexConsumer buffer, Vector3d[] cube, float u, float v, i
}

private void addVertex(VertexConsumer buffer, Vector3d pos, float u, float v, int light, float rCol, float gCol, float bCol, float alpha) {
buffer.vertex(pos.x, pos.y, pos.z).uv(u, v).color(rCol, gCol, bCol, alpha).uv2(light).endVertex();
buffer.addVertex((float) pos.x, (float) pos.y, (float) pos.z).setUv(u, v).setColor(rCol, gCol, bCol, alpha).setLight(light);
}

@RequiredArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import org.lwjgl.glfw.GLFW;

public class FBPFastBlacklistScreen extends Screen {
private static final ResourceLocation WIDGETS = new ResourceLocation(FancyBlockParticles.MOD_ID, "textures/gui/widgets.png");
private static final ResourceLocation WIDGETS = ResourceLocation.tryBuild(FancyBlockParticles.MOD_ID, "textures/gui/widgets.png");

private final BlockState state;
private final ItemStack displayStack;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
import net.minecraft.resources.ResourceLocation;

public class FBPOptionsScreen extends FBPAbstractOptionsScreen {
public static final WidgetSprites LOGO_SPRITES = new WidgetSprites(new ResourceLocation(FancyBlockParticles.MOD_ID, "logo"), new ResourceLocation(FancyBlockParticles.MOD_ID, "logo_highlighted"));
public static final WidgetSprites REPORT_SPRITES = new WidgetSprites(new ResourceLocation(FancyBlockParticles.MOD_ID, "report"), new ResourceLocation(FancyBlockParticles.MOD_ID, "report_highlighted"));
public static final WidgetSprites LOGO_SPRITES = new WidgetSprites(ResourceLocation.tryBuild(FancyBlockParticles.MOD_ID, "logo"), ResourceLocation.tryBuild(FancyBlockParticles.MOD_ID, "logo_highlighted"));
public static final WidgetSprites REPORT_SPRITES = new WidgetSprites(ResourceLocation.tryBuild(FancyBlockParticles.MOD_ID, "report"), ResourceLocation.tryBuild(FancyBlockParticles.MOD_ID, "report_highlighted"));

public FBPOptionsScreen(Screen lastScreen) {
super(Component.translatable("screen.fbp.settings"), lastScreen, FancyBlockParticles.CONFIG.copy());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import net.minecraft.resources.ResourceLocation;

public class FBPBlacklistButton extends Button {
private static final ResourceLocation WIDGETS = new ResourceLocation(FancyBlockParticles.MOD_ID, "textures/gui/widgets.png");
private static final ResourceLocation WIDGETS = ResourceLocation.tryBuild(FancyBlockParticles.MOD_ID, "textures/gui/widgets.png");

private final boolean particle;
@Getter
Expand Down
34 changes: 11 additions & 23 deletions Common/src/main/java/hantonik/fbp/util/FBPConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.world.inventory.InventoryMenu;
import net.minecraft.world.level.block.Blocks;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.joml.Vector3d;

import java.nio.file.Path;
Expand Down Expand Up @@ -48,8 +48,9 @@ public final class FBPConstants {
public static final Supplier<TextureAtlasSprite> FBP_PARTICLE_SPRITE = () -> Minecraft.getInstance().getBlockRenderer().getBlockModelShaper().getParticleIcon(Blocks.WHITE_CONCRETE.defaultBlockState());

public static final ParticleRenderType FBP_PARTICLE_RENDER = new ParticleRenderType() {
@Nullable
@Override
public void begin(BufferBuilder buffer, @NotNull TextureManager manager) {
public BufferBuilder begin(Tesselator tesselator, TextureManager manager) {
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
RenderSystem.depthMask(true);
Expand All @@ -59,25 +60,19 @@ public void begin(BufferBuilder buffer, @NotNull TextureManager manager) {

RenderSystem.enableCull();

buffer.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.PARTICLE);
return tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.PARTICLE);
}

@Override
public void end(Tesselator tesselator) {
tesselator.end();

RenderSystem.disableBlend();
RenderSystem.setShaderTexture(0, InventoryMenu.BLOCK_ATLAS);
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
RenderSystem.setShader(GameRenderer::getParticleShader);

RenderSystem.disableCull();
public String toString() {
return "FBP_PARTICLE_RENDER";
}
};

public static final ParticleRenderType FBP_TERRAIN_RENDER = new ParticleRenderType() {
@Nullable
@Override
public void begin(BufferBuilder buffer, TextureManager manager) {
public BufferBuilder begin(Tesselator tesselator, TextureManager manager) {
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
RenderSystem.depthMask(true);
Expand All @@ -90,19 +85,12 @@ public void begin(BufferBuilder buffer, TextureManager manager) {
else
RenderSystem.disableCull();

buffer.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.BLOCK);
return tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.BLOCK);
}

@Override
public void end(Tesselator tesselator) {
tesselator.end();

RenderSystem.disableBlend();
RenderSystem.setShaderTexture(0, InventoryMenu.BLOCK_ATLAS);
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
RenderSystem.setShader(GameRenderer::getParticleShader);

RenderSystem.disableCull();
public String toString() {
return "FBP_TERRAIN_RENDER";
}
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public static void renderCubeShaded(VertexConsumer buffer, Vector2f[] uv, double
}

public static void addVertex(VertexConsumer buffer, Vector3d pos, float u, float v, int light, float red, float green, float blue, float alpha, Vector3d normal) {
buffer.vertex(pos.x, pos.y, pos.z).color(red, green, blue, alpha).uv(u, v).uv2(light).normal((float) normal.x, (float) normal.y, (float) normal.z).endVertex();
buffer.addVertex((float) pos.x, (float) pos.y, (float) pos.z).setColor(red, green, blue, alpha).setUv(u, v).setLight(light).setNormal((float) normal.x, (float) normal.y, (float) normal.z);
}

public static Vector3d rotate(Vector3d vector, float angleX, float angleY, float angleZ) {
Expand Down
2 changes: 1 addition & 1 deletion Common/src/main/resources/pack.mcmeta
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"description": {
"text": "${mod_name} resources"
},
"pack_format": 32
"pack_format": 34
}
}
3 changes: 2 additions & 1 deletion Fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ dependencies {

mappings loom.layered() {
officialMojangMappings()
parchment("org.parchmentmc.data:parchment-$mc_version:$mappings_version@zip")
parchment("org.parchmentmc.data:parchment-1.20.6:$mappings_version@zip")
// parchment("org.parchmentmc.data:parchment-$mc_version:$mappings_version@zip")
}

compileOnly project(':Common')
Expand Down
2 changes: 1 addition & 1 deletion Fabric/src/main/java/hantonik/fbp/FBPFabric.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void onInitializeClient() {
ResourceManagerHelper.get(PackType.CLIENT_RESOURCES).registerReloadListener(new SimpleSynchronousResourceReloadListener() {
@Override
public ResourceLocation getFabricId() {
return new ResourceLocation(FancyBlockParticles.MOD_ID, "config");
return ResourceLocation.tryBuild(FancyBlockParticles.MOD_ID, "config");
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion Forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ mixin {
println "Forge: $forge_version"

minecraft {
mappings channel: mappings_channel, version: "$mappings_version-$mc_version"
mappings channel: 'official', version: '1.21' // "$mappings_version-$mc_version"

reobf = false
copyIdeResources = true
Expand Down
6 changes: 3 additions & 3 deletions Forge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
modLoader="javafml"
loaderVersion="[50,)"
loaderVersion="[51,)"
license="GPLv3"
issueTrackerURL="https://github.com/Hantonik/FancyBlockParticles/issues"

Expand All @@ -19,13 +19,13 @@ clientSideOnly=true
[[dependencies.fbp]]
modId="forge"
mandatory=true
versionRange="[50,)"
versionRange="[51,)"
ordering="NONE"
side="CLIENT"

[[dependencies.fbp]]
modId="minecraft"
mandatory=true
versionRange="[1.20.6,1.21)"
versionRange="[1.21,1.22)"
ordering="NONE"
side="CLIENT"
2 changes: 1 addition & 1 deletion NeoForge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ minecraft.accessTransformers.file('src/main/resources/META-INF/accesstransformer

subsystems {
parchment {
minecraftVersion = mc_version
minecraftVersion = '1.20.6' // mc_version
mappingsVersion = mappings_version
}
}
Expand Down
6 changes: 3 additions & 3 deletions NeoForge/src/main/resources/META-INF/neoforge.mods.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
modLoader="javafml"
loaderVersion="[2,)"
loaderVersion="[4,)"
license="GPLv3"
issueTrackerURL="https://github.com/Hantonik/FancyBlockParticles/issues"

Expand All @@ -23,13 +23,13 @@ issueTrackerURL="https://github.com/Hantonik/FancyBlockParticles/issues"
[[dependencies.fbp]]
modId="neoforge"
type="required"
versionRange="[20.6,)"
versionRange="[21.0,)"
ordering="NONE"
side="CLIENT"

[[dependencies.fbp]]
modId="minecraft"
type="required"
versionRange="[1.20.6,1.21)"
versionRange="[1.21,1.22)"
ordering="NONE"
side="CLIENT"
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ mappings_channel = parchment
mappings_version = 2024.06.02

# Minecraft
mc_version = 1.20.6
mc_version = 1.21

forge_version = 50.1.3
neo_version = 20.6.115
forge_version = 51.0.8
neo_version = 21.0.10-beta

loader_version = 0.15.11
fabric_version = 0.100.0
fabric_version = 0.100.1

java_version = 21

# Dependencies
sereneseasons_version = 9.4.0.5
glitchcore_version = 1.1.0.10
sereneseasons_version = 10.0.0.2
glitchcore_version = 2.0.0.1

mixin_processor_version = 0.8.5
lombok_version = 1.18.+
7 changes: 3 additions & 4 deletions update.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
"homepage": "https://www.curseforge.com/minecraft/mc-mods/fbp-renewed",

"promos": {
"1.20.6-latest": "20.6.0.1-beta"
"1.21-latest": "21.0.0.0-beta"
},

"1.20.6": {
"20.6.0.1-beta": "Fixed a crash when particles were killed during the freeze effect",
"20.6.0.0-beta": "Thorough code rewrite. Port to Minecraft 1.20.6"
"1.21": {
"21.0.0.0-beta": "Update to Minecraft 1.21"
}
}

0 comments on commit 1c6c846

Please sign in to comment.