Skip to content

Commit

Permalink
Update to MC 1.12.4
Browse files Browse the repository at this point in the history
  • Loading branch information
rubensworks committed Dec 25, 2024
1 parent 95e3b67 commit 43ea84e
Show file tree
Hide file tree
Showing 244 changed files with 852 additions and 6,268 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ plugins {
id 'com.diffplug.spotless' version '6.25.0' apply false
id 'com.modrinth.minotaur' version '2.+' apply false

id 'fabric-loom' version '1.7-SNAPSHOT' apply false
id 'net.neoforged.moddev' version '0.1.110' apply false
id 'net.neoforged.gradle.userdev' version '7.0.145' apply false
id 'fabric-loom' version '1.9-SNAPSHOT' apply false
id 'net.neoforged.moddev' version '2.0.61-beta' apply false
id 'net.neoforged.gradle.userdev' version '7.0.171' apply false
// id 'net.minecraftforge.gradle' version '[6.0.24,6.2)' apply false // Don't load yet to fix DiffPatch conflict issue between FG and NG
}

1 change: 1 addition & 0 deletions buildSrc/src/main/groovy/multiloader-common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ java {
withSourcesJar()
withJavadocJar()
}
compileJava.options.compilerArgs << "-Xmaxerrs" << "9999"

repositories {
mavenLocal()
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/groovy/multiloader-loader-common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ neoForge {
// Automatically enable AccessTransformers if the file exists
def at = file('src/main/resources/META-INF/accesstransformer.cfg')
if (at.exists()) {
accessTransformers.add(at.absolutePath)
accessTransformers.from(at.absolutePath)
}
parchment {
minecraftVersion = parchment_minecraft_version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ runs {
systemProperty 'neoforge.enabledGameTestNamespaces', "cyclopscore,${mod_id}"
}

data {
clientData {
programArguments.addAll '--mod', mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
}
}
Expand Down
18 changes: 9 additions & 9 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ group=org.cyclops.cyclopscore
java_version=21

# Common
minecraft_version=1.21.1
minecraft_version=1.21.4
mod_name=Cyclops Core
mod_author=rubensworks (aka kroeser)
mod_id=cyclopscore
Expand All @@ -14,27 +14,27 @@ issue_tracker_url=https://github.com/CyclopsMC/CyclopsCore/issues
display_url=https://www.curseforge.com/minecraft/mc-mods/cyclops-core
description=Coremod for Integrated Dynamics, EvilCraft and others.
fingerprint=bd0353b3e8a2810d60dd584e256e364bc3bedd44
neo_form_version=1.21-20240613.152323
parchment_version=2024.06.23
parchment_minecraft_version=1.21
neo_form_version=1.21.4-20241203.161809
parchment_version=2024.12.07
parchment_minecraft_version=1.21.4
curseforge_project_id=232758
modrinth_project_id=Z9DM0LJ4

# Fabric
fabric_version=0.102.1+1.21.1
fabric_loader_version=0.15.11
fabric_version=0.112.2+1.21.4
fabric_loader_version=0.16.9
# Dependencies
fabric_forgeconfigapiport_version=21.1.0
fabric_forgeconfigapiport_version=21.4.1

# NeoForge
neoforge_version=21.1.2
neoforge_version=21.4.33-beta
neoforge_loader_version_range=[4,)
neoforge_update_json_url=https://raw.githubusercontent.com/CyclopsMC/Versions/master/neoforge_update/cyclops-core.json
# Dependencies
neoforge_curios_version=7.3.4+1.20.4

# Forge
forge_version=52.0.3
forge_version=54.0.7
forge_loader_version_range=[2,)
forge_update_json_url=https://raw.githubusercontent.com/CyclopsMC/Versions/master/forge_update/cyclops-core.json

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,13 @@
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.TitleScreen;
import net.minecraft.client.resources.sounds.SimpleSoundInstance;
import net.minecraft.core.RegistryAccess;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.registries.Registries;
import net.minecraft.network.chat.Component;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.world.Difficulty;
import net.minecraft.world.flag.FeatureFlags;
import net.minecraft.world.level.DataPackConfig;
import net.minecraft.world.level.GameRules;
import net.minecraft.world.level.GameType;
import net.minecraft.world.level.LevelSettings;
import net.minecraft.world.level.WorldDataConfiguration;
import net.minecraft.world.level.*;
import net.minecraft.world.level.levelgen.WorldDimensions;
import net.minecraft.world.level.levelgen.WorldOptions;
import net.minecraft.world.level.levelgen.presets.WorldPresets;
Expand Down Expand Up @@ -80,7 +76,7 @@ public static void onMainMenuInit(Minecraft minecraft, Screen screen) {
}

// Set rules
GameRules gameRules = new GameRules();
GameRules gameRules = new GameRules(FeatureFlags.DEFAULT_FLAGS);
gameRules.getRule(GameRules.RULE_DAYLIGHT).set(false, null);
gameRules.getRule(GameRules.RULE_DO_IMMEDIATE_RESPAWN).set(true, null);
gameRules.getRule(GameRules.RULE_DO_PATROL_SPAWNING).set(false, null);
Expand All @@ -90,8 +86,8 @@ public static void onMainMenuInit(Minecraft minecraft, Screen screen) {
false, Difficulty.PEACEFUL, true, gameRules, worlddataconfiguration);

// Create generator settings and world options, based on GameTestServer
Function<RegistryAccess, WorldDimensions> generatorSettings = registryAccess -> registryAccess
.registryOrThrow(Registries.WORLD_PRESET).getHolderOrThrow(WorldPresets.FLAT).value()
Function<HolderLookup.Provider, WorldDimensions> generatorSettings = registryAccess -> registryAccess
.lookupOrThrow(Registries.WORLD_PRESET).getOrThrow(WorldPresets.FLAT).value()
.createWorldDimensions();
long seed = new Random().nextLong();
WorldOptions worldOptions = new WorldOptions(seed, false, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.AbstractWidget;
import net.minecraft.client.gui.narration.NarrationElementOutput;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
Expand Down Expand Up @@ -126,6 +127,7 @@ public void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float
int scrollMinY = y;
int scrollMaxY = scrollMinY + height;
guiGraphics.blitSprite(
RenderType::guiTextured,
this.needsScrollBars() ? SCROLLER_SPRITE : SCROLLER_DISABLED_SPRITE,
scrollX,
scrollMinY + (int)((float)(scrollMaxY - scrollMinY - SCROLL_BUTTON_HEIGHT - 2) * this.currentScroll),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;

Expand Down Expand Up @@ -49,7 +50,7 @@ protected int getTextureY() { // Copy from AbstractButton

protected void drawBackground(GuiGraphics guiGraphics) {
ResourceLocation resourceLocation = SPRITES.get(this.active, this.isHoveredOrFocused());
guiGraphics.blitSprite(resourceLocation, getX(), getY(), getWidth(), getHeight());
guiGraphics.blitSprite(RenderType::guiTextured, resourceLocation, getX(), getY(), getWidth(), getHeight());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.EditBox;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.network.chat.Component;
import org.cyclops.cyclopscore.client.gui.image.Images;

Expand Down Expand Up @@ -37,10 +38,10 @@ public int getInnerWidth() {
protected void drawBackground(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) {
setX(getX() - 1);
setY(getY() - 1);
guiGraphics.blit(Images.WIDGETS, getX(), getY(), 0, 0, width / 2, height / 2);//top left
guiGraphics.blit(Images.WIDGETS, getX() + width / 2, getY(), 200 - width / 2, 0, width / 2, height / 2);//top right
guiGraphics.blit(Images.WIDGETS, getX(), getY() + height / 2, 0, 20 - height / 2, width / 2, height / 2);//bottom left
guiGraphics.blit(Images.WIDGETS, getX() + width / 2, getY() + height / 2, 200 - width / 2, 20 - height / 2, width / 2, height / 2);//bottom right
guiGraphics.blit(RenderType::guiTextured, Images.WIDGETS, getX(), getY(), 0, 0, width / 2, height / 2, 256, 256);//top left
guiGraphics.blit(RenderType::guiTextured, Images.WIDGETS, getX() + width / 2, getY(), 200 - width / 2, 0, width / 2, height / 2, 256, 256);//top right
guiGraphics.blit(RenderType::guiTextured, Images.WIDGETS, getX(), getY() + height / 2, 0, 20 - height / 2, width / 2, height / 2, 256, 256);//bottom left
guiGraphics.blit(RenderType::guiTextured, Images.WIDGETS, getX() + width / 2, getY() + height / 2, 200 - width / 2, 20 - height / 2, width / 2, height / 2, 256, 256);//bottom right
setX(getX() + 1);
setY(getY() + 1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.Inventory;
Expand Down Expand Up @@ -69,7 +70,7 @@ protected int getBaseYSize() {

@Override
protected void renderBg(GuiGraphics guiGraphics, float f, int x, int y) {
guiGraphics.blit(getGuiTexture(), leftPos + offsetX, topPos + offsetY, 0, 0, imageWidth - 2 * offsetX, imageHeight - 2 * offsetY);
guiGraphics.blit(RenderType::guiTextured, getGuiTexture(), leftPos + offsetX, topPos + offsetY, 0, 0, imageWidth - 2 * offsetX, imageHeight - 2 * offsetY, 256, 256);
}

// @Override // This is an override in Forge and NeoForge, but not in Fabric
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public int getSheetHeight() {

@Override
public void draw(GuiGraphics gui, int x, int y) {
gui.blit(resourceLocation, x, y, sheetX, sheetY, sheetWidth, sheetHeight);
gui.blit(RenderType::guiTextured, resourceLocation, x, y, sheetX, sheetY, sheetWidth, sheetHeight, 256, 256);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
package org.cyclops.cyclopscore.client.particle;

import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.BufferBuilder;
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
import com.mojang.blaze3d.vertex.Tesselator;
import com.mojang.blaze3d.vertex.VertexFormat;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import net.minecraft.client.Camera;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.particle.ParticleRenderType;
import net.minecraft.client.particle.TextureSheetParticle;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.texture.AbstractTexture;
import net.minecraft.client.renderer.texture.TextureAtlas;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.world.entity.LivingEntity;
import org.cyclops.cyclopscore.helper.IModHelpers;
import org.cyclops.cyclopscore.helper.IRenderHelpers;
import org.lwjgl.opengl.GL11;

import java.util.Objects;

/**
* A blurred static fading particle with any possible color.
* @author rubensworks
Expand All @@ -25,7 +26,6 @@
public class ParticleBlur extends TextureSheetParticle {

private static final int MAX_VIEW_DISTANCE = 30;
public static final RenderType RENDER_TYPE = new RenderType();

protected float originalScale;
protected float scaleLife;
Expand Down Expand Up @@ -72,7 +72,7 @@ private void validateDistance() {

@Override
public ParticleRenderType getRenderType() {
return RENDER_TYPE;
return ParticleRenderType.CUSTOM;
}

@Override
Expand Down Expand Up @@ -117,38 +117,31 @@ public float getQuadSize(float p_217561_1_) {
return quadSize;
}

public static class RenderType implements ParticleRenderType {

boolean lastBlur;
boolean lastMipmap;

@Override
public BufferBuilder begin(Tesselator tesselator, TextureManager textureManager) {
RenderSystem.depthMask(false);
RenderSystem.enableBlend();
RenderSystem.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
//RenderSystem.alphaFunc(GL11.GL_GREATER, 0.003921569F);
//RenderSystem.disableLighting();

IRenderHelpers renderHelpers = IModHelpers.get().getRenderHelpers();
renderHelpers.bindTexture(TextureAtlas.LOCATION_PARTICLES);
AbstractTexture texture = textureManager.getTexture(TextureAtlas.LOCATION_PARTICLES);
lastBlur = texture.blur;
lastMipmap = texture.mipmap;
texture.setFilter(true, false);

BufferBuilder builder = tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.PARTICLE);

((BufferBuilderWrapper) builder).cc$setRunnableOnBuild(this::end);

return builder;
}

public void end() {
Minecraft.getInstance().getTextureManager().getTexture(TextureAtlas.LOCATION_PARTICLES).setFilter(lastBlur, lastMipmap);
//RenderSystem.alphaFunc(GL11.GL_GREATER, 0.1F);
RenderSystem.disableBlend();
RenderSystem.depthMask(true);
}
@Override
public void renderCustom(PoseStack poseStack, MultiBufferSource bufferSource, Camera camera, float partialTick) {
RenderSystem.depthMask(false);
RenderSystem.enableBlend();
RenderSystem.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
//RenderSystem.alphaFunc(GL11.GL_GREATER, 0.003921569F);
//RenderSystem.disableLighting();

IRenderHelpers renderHelpers = IModHelpers.get().getRenderHelpers();
renderHelpers.bindTexture(TextureAtlas.LOCATION_PARTICLES);
AbstractTexture texture = Minecraft.getInstance().getTextureManager().getTexture(TextureAtlas.LOCATION_PARTICLES);
// lastBlur = texture.blur;
// lastMipmap = texture.mipmap;
texture.setFilter(true, false);

// BufferBuilder buffer = tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.PARTICLE);
VertexConsumer buffer = bufferSource.getBuffer(Objects.requireNonNull(getRenderType().renderType()));

// ((BufferBuilderWrapper) builder).cc$setRunnableOnBuild(this::end); // TODO: rm mixin?

this.render(buffer, camera, partialTick);

// Minecraft.getInstance().getTextureManager().getTexture(TextureAtlas.LOCATION_PARTICLES).setFilter(lastBlur, lastMipmap);
//RenderSystem.alphaFunc(GL11.GL_GREATER, 0.1F);
RenderSystem.disableBlend();
RenderSystem.depthMask(true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,37 @@

import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.blockentity.BlockEntityRenderDispatcher;
import net.minecraft.client.renderer.special.NoDataSpecialModelRenderer;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.entity.BlockEntity;

import javax.annotation.Nullable;
import java.util.function.Supplier;

/**
* A supplier-based {@link BlockEntityWithoutLevelRenderer} that caches the internal block entity.
* A supplier-based {@link NoDataSpecialModelRenderer} that caches the internal block entity.
* Don't use this if the block entity should be recreated at every render-tick.
* @author rubensworks
*/
public class ItemStackBlockEntityRendererBase extends BlockEntityWithoutLevelRenderer {
public class ItemStackBlockEntityRendererBase implements NoDataSpecialModelRenderer {

private final BlockEntityRenderDispatcher blockEntityRenderDispatcher;
private final Supplier<BlockEntity> blockEntitySupplier;
@Nullable
private BlockEntity blockEntity;

public ItemStackBlockEntityRendererBase(Supplier<BlockEntity> blockEntitySupplier) {
super(Minecraft.getInstance().getBlockEntityRenderDispatcher(), Minecraft.getInstance().getEntityModels());
this.blockEntityRenderDispatcher = Minecraft.getInstance().getBlockEntityRenderDispatcher();
this.blockEntitySupplier = blockEntitySupplier;
}

@Override
public void renderByItem(ItemStack itemStackIn, ItemDisplayContext itemDisplayContext, PoseStack matrixStackIn, MultiBufferSource bufferIn, int combinedLightIn, int combinedOverlayIn) {
public void render(ItemDisplayContext itemDisplayContext, PoseStack poseStack, MultiBufferSource multiBufferSource, int combinedLightIn, int combinedOverlayIn, boolean b) {
if (this.blockEntity == null) {
this.blockEntity = this.blockEntitySupplier.get();
}
this.blockEntityRenderDispatcher.renderItem(this.blockEntity, matrixStackIn, bufferIn, combinedLightIn, combinedOverlayIn);
this.blockEntityRenderDispatcher.render(this.blockEntity, 0, poseStack, multiBufferSource);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class CommandDebug implements Command<CommandSourceStack> {
public int run(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
PacketCodec packet = context.getArgument("packet", PacketCodec.class);
context.getSource().getPlayerOrException().sendSystemMessage(Component.literal(String.format("Sending %s from client to server...", packet.getClass())));
CyclopsCoreInstance.MOD.getPacketHandlerCommon().sendToPlayer(packet, context.getSource().getPlayerOrException());
CyclopsCoreInstance.MOD.getPacketHandler().sendToPlayer(packet, context.getSource().getPlayerOrException());
return 0;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class CommandReloadResources implements Command<CommandSourceStack> {

@Override
public int run(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
CyclopsCoreInstance.MOD.getPacketHandlerCommon().sendToPlayer(new ReloadResourcesPacket(), context.getSource().getPlayerOrException());
CyclopsCoreInstance.MOD.getPacketHandler().sendToPlayer(new ReloadResourcesPacket(), context.getSource().getPlayerOrException());
return 0;
}

Expand Down
Loading

0 comments on commit 43ea84e

Please sign in to comment.