[Bug]: How are you supposed to make custom planet rings?
DRD2k8 opened this issue ยท 5 comments
Bug Description
In v1.15.5, you can create custom planet rings with resourcepacks. But in v1.15.7 and up, you can't do that with resourcepacks. How are you supposed to do it now?
Version
1.15.18
Mod Loader Version
1.20.1 - 47.2.17
Mod Loader
Forge
Code of Conduct
- I have searched the issue tracker and confirmed that the issue has not been reported
- I have checked the FAQ (if one is present) and my issue is not listed
- I have verified that I am using the latest version of the mod
- I have verified that I have installed all the required dependencies for the mod
- I have verified that I do not have Optifine installed. We will close issues if we detect Optifine is in your pack. We cannot fix Optifine issues. Please do not report issues with Optifine present.
You haven't been able to really since 1.19.3 when you could easily add them. I wen back and looked and at 1.19.3 and got it to work on my source. I may fork it and show you how I did it.
Well, since version 1.15.7 in Minecraft 1.20.1, the JSON APIs for adding custom planets into the screen when choosing planets & moons was removed. How are you supposed to do it now?
I found out! You have to make a mixin to the PlanetsScreen
class and inject the renderSolarSystem
method! Although it's a bit complicated.
Here's how I made the custom planet screens.
The mixin class:
@Mixin(PlanetsScreen.class)
public class PlanetsScreenMixin extends Screen {
@Shadow
private @Nullable ResourceLocation selectedSolarSystem;
protected PlanetsScreenMixin(Component p_96550_) {
super(p_96550_);
}
@Inject(method = "renderSolarSystem", at = @At("TAIL"), remap = false)
public void renderSolarSystem(GuiGraphics graphics, CallbackInfo ci) {
float jupiterYRot = (float) Util.getMillis() / 500.0F;
float saturnYRot = (float) Util.getMillis() / 600.0F;
float uranusYRot = (float) Util.getMillis() / 700.0F;
float neptuneYRot = (float) Util.getMillis() / 800.0F;
// Jupiter
graphics.pose().pushPose();
graphics.pose().translate((float)this.width / 2.0F, (float)this.height / 2.0F, 0.0F);
graphics.pose().mulPose(Axis.ZP.rotationDegrees(jupiterYRot));
graphics.pose().translate(145.0F, 0.0F, 0.0F);
graphics.blit(DimensionRenderingUtils.JUPITER, 0, 0, 0.0F, 0.0F, 12, 12, 12, 12);
graphics.pose().popPose();
// Saturn
graphics.pose().pushPose();
graphics.pose().translate((float)this.width / 2.0F, (float)this.height / 2.0F, 0.0F);
graphics.pose().mulPose(Axis.ZP.rotationDegrees(saturnYRot));
graphics.pose().translate(172.0F, 0.0F, 0.0F);
graphics.blit(DimensionRenderingUtils.SATURN, 0, 0, 0.0F, 0.0F, (int) 22.5, (int) 22.5, (int) 22.5, (int) 22.5);
graphics.pose().popPose();
// Uranus
graphics.pose().pushPose();
graphics.pose().translate((float)this.width / 2.0F, (float)this.height / 2.0F, 0.0F);
graphics.pose().mulPose(Axis.ZP.rotationDegrees(uranusYRot));
graphics.pose().translate(205.0F, 0.0F, 0.0F);
graphics.blit(DimensionRenderingUtils.URANUS, 0, 0, 0.0F, 0.0F, (int) 18.75, (int) 18.75, (int) 18.75, (int) 18.75);
graphics.pose().popPose();
// Neptune
graphics.pose().pushPose();
graphics.pose().translate((float)this.width / 2.0F, (float)this.height / 2.0F, 0.0F);
graphics.pose().mulPose(Axis.ZP.rotationDegrees(neptuneYRot));
graphics.pose().translate(238.0F, 0.0F, 0.0F);
graphics.blit(DimensionRenderingUtils.NEPTUNE, 0, 0, 0.0F, 0.0F, 12, 12, 12, 12);
graphics.pose().popPose();
}
@Inject(method = "drawCircles", at = @At("TAIL"), remap = false)
public void drawCircles(int start, int count, int color, BufferBuilder bufferBuilder, CallbackInfo ci) {
if (PlanetConstants.SOLAR_SYSTEM.equals(this.selectedSolarSystem)) {
PlanetsScreen.drawCircle(bufferBuilder, (double)((float)this.width / 2.0F), (double)((float)this.height / 2.0F), (double)(150), 75, color);
PlanetsScreen.drawCircle(bufferBuilder, (double)((float)this.width / 2.0F), (double)((float)this.height / 2.0F), (double)(180), 75, color);
PlanetsScreen.drawCircle(bufferBuilder, (double)((float)this.width / 2.0F), (double)((float)this.height / 2.0F), (double)(210), 75, color);
PlanetsScreen.drawCircle(bufferBuilder, (double)((float)this.width / 2.0F), (double)((float)this.height / 2.0F), (double)(240), 75, color);
}
}
}
My DimensionRenderingUtils class:
public class DimensionRenderingUtils {
public static final ResourceLocation JUPITER = new ResourceLocation(AdExtendra.MOD_ID, "textures/environment/jupiter.png");
public static final ResourceLocation SATURN = new ResourceLocation(AdExtendra.MOD_ID, "textures/environment/saturn.png");
public static final ResourceLocation URANUS = new ResourceLocation(AdExtendra.MOD_ID, "textures/environment/uranus.png");
public static final ResourceLocation NEPTUNE = new ResourceLocation(AdExtendra.MOD_ID, "textures/environment/neptune.png");
}