Skip to content

Commit

Permalink
完成 1.20 #1b5e2463f97e22c2eae63241c9a3abbb85a658c8 的更新内容
Browse files Browse the repository at this point in the history
  • Loading branch information
TartaricAcid committed Oct 30, 2023
1 parent 42873e7 commit b2ec8e0
Show file tree
Hide file tree
Showing 129 changed files with 4,682 additions and 283 deletions.
22 changes: 21 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@ buildscript {
repositories {
maven { url = 'https://maven.minecraftforge.net' }
maven { url = 'https://maven.parchmentmc.org' }
maven { url = 'https://repo.spongepowered.org/repository/maven-public/' }
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
classpath 'org.parchmentmc:librarian:1.+'
classpath group: 'org.spongepowered', name: 'mixingradle', version: '0.7-SNAPSHOT'
}
}

apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'org.parchmentmc.librarian.forgegradle'
apply plugin: 'eclipse'

apply plugin: 'org.spongepowered.mixin'
apply plugin: 'java'

version = mod_version
group = 'com.github.tartaricacid'
Expand All @@ -26,6 +29,7 @@ minecraft {
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
runs {
client {
jvmArgs "-XX:+AllowEnhancedClassRedefinition"
workingDirectory project.file('run/client_a')
property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'
Expand All @@ -51,6 +55,7 @@ minecraft {
}

server {
jvmArgs "-XX:+AllowEnhancedClassRedefinition"
workingDirectory project.file('run/server')
property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'
Expand Down Expand Up @@ -82,6 +87,11 @@ minecraft {

sourceSets.main.resources { srcDir 'src/generated/resources' }

mixin {
add sourceSets.main, "touhou_little_maid.refmap.json"
config "touhou_little_maid.mixins.json"
}

repositories {
maven {
// location of the maven that hosts JEI files since January 2023
Expand All @@ -101,6 +111,9 @@ repositories {
includeGroup "curse.maven"
}
}
maven {
url "https://maven.shedaniel.me/"
}
}

dependencies {
Expand All @@ -116,6 +129,13 @@ dependencies {
runtimeOnly fg.deobf("vazkii.patchouli:Patchouli:${patchouli_version}")

implementation fg.deobf("teamtwilight:twilightforest:${twilight_forest_version}:universal")

implementation fg.deobf("curse.maven:jade-324717:${jade_id}")
implementation fg.deobf("curse.maven:the-one-probe-245211:${top_id}")

implementation fg.deobf("me.shedaniel.cloth:cloth-config-forge:${cloth_config_forge}")

annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
}

jar {
Expand Down
7 changes: 5 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
org.gradle.jvmargs=-Xmx4G
org.gradle.daemon=false
mod_version=1.1.2
mod_version=1.1.3
forge_version=1.19.2-43.2.0
mc_version=1.19.2
jei_version=11.4.0.286
patchouli_version=1.19.2-76
twilight_forest_version=4.2.1518
twilight_forest_version=4.2.1518
jade_id=4800904
top_id=3965693
cloth_config_forge=8.3.103
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.github.tartaricacid.touhoulittlemaid.advancements;

import com.github.tartaricacid.touhoulittlemaid.TouhouLittleMaid;
import com.github.tartaricacid.touhoulittlemaid.config.subconfig.MiscConfig;
import com.google.gson.JsonObject;
import net.minecraft.advancements.critereon.AbstractCriterionTriggerInstance;
import net.minecraft.advancements.critereon.DeserializationContext;
import net.minecraft.advancements.critereon.EntityPredicate;
import net.minecraft.advancements.critereon.SimpleCriterionTrigger;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer;

public class GivePatchouliBookConfigTrigger extends SimpleCriterionTrigger<GivePatchouliBookConfigTrigger.Instance> {
public static final ResourceLocation ID = new ResourceLocation(TouhouLittleMaid.MOD_ID, "give_patchouli_book_config");

@Override
protected GivePatchouliBookConfigTrigger.Instance createInstance(JsonObject json, EntityPredicate.Composite entityPredicate, DeserializationContext conditionsParser) {
return new GivePatchouliBookConfigTrigger.Instance(entityPredicate);
}

@Override
public ResourceLocation getId() {
return ID;
}


public void trigger(ServerPlayer serverPlayer) {
super.trigger(serverPlayer, instance -> MiscConfig.GIVE_PATCHOULI_BOOK.get());
}

public static class Instance extends AbstractCriterionTriggerInstance {
public Instance(EntityPredicate.Composite player) {
super(ID, player);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@

@Mod.EventBusSubscriber(value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.MOD)
public final class ReloadResourceEvent {
public static final ResourceLocation EMPTY_BAUBLE_SLOT = new ResourceLocation(TouhouLittleMaid.MOD_ID, "items/empty_bauble_slot");
public static final ResourceLocation EMPTY_MAINHAND_SLOT = new ResourceLocation(TouhouLittleMaid.MOD_ID, "items/empty_mainhand_slot");
public static final ResourceLocation EMPTY_BAUBLE_SLOT = new ResourceLocation(TouhouLittleMaid.MOD_ID, "slot/empty_bauble_slot");
public static final ResourceLocation EMPTY_MAINHAND_SLOT = new ResourceLocation(TouhouLittleMaid.MOD_ID, "slot/empty_mainhand_slot");
public static final ResourceLocation BLOCK_ATLAS_TEXTURE = new ResourceLocation("textures/atlas/blocks.png");
public static final ResourceLocation EMPTY_BACK_SHOW_SLOT = new ResourceLocation(TouhouLittleMaid.MOD_ID, "items/empty_back_show_slot");
public static final ResourceLocation EMPTY_BACK_SHOW_SLOT = new ResourceLocation(TouhouLittleMaid.MOD_ID, "slot/empty_back_show_slot");

@SubscribeEvent
public static void onTextureStitchEventPost(TextureStitchEvent.Post event) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import com.github.tartaricacid.touhoulittlemaid.network.NetworkHandler;
import com.github.tartaricacid.touhoulittlemaid.network.message.MaidConfigMessage;
import com.github.tartaricacid.touhoulittlemaid.network.message.MaidTaskMessage;
import com.github.tartaricacid.touhoulittlemaid.network.message.RequestEffectMessage;
import com.github.tartaricacid.touhoulittlemaid.network.message.SendEffectMessage;
import com.github.tartaricacid.touhoulittlemaid.util.ParseI18n;
import com.google.common.collect.Lists;
import com.mojang.blaze3d.systems.RenderSystem;
Expand All @@ -28,12 +30,12 @@
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import net.minecraft.client.gui.screens.inventory.InventoryScreen;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.client.resources.language.I18n;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.FormattedCharSequence;
import net.minecraft.util.StringUtil;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.player.Inventory;

Expand Down Expand Up @@ -66,6 +68,7 @@ public abstract class AbstractMaidContainerGui<T extends AbstractMaidContainer>
private ImageButton soundDownload;
private ScheduleButton<T> scheduleButton;
private boolean taskListOpen;
private int counterTime = 0;

public AbstractMaidContainerGui(T screenContainer, Inventory inv, Component titleIn) {
super(screenContainer, inv, titleIn);
Expand Down Expand Up @@ -104,10 +107,50 @@ public void render(PoseStack poseStack, int mouseX, int mouseY, float partialTic
return;
}
super.render(poseStack, mouseX, mouseY, partialTicks);
this.drawEffectInfo(poseStack);
this.drawCurrentTaskText(poseStack);
this.renderTooltip(poseStack, mouseX, mouseY);
}

@SuppressWarnings("all")
private void drawEffectInfo(PoseStack poseStack) {
if (taskListOpen) {
return;
}
List<SendEffectMessage.EffectData> effects = maid.getEffects();
if (!effects.isEmpty()) {
int yOffset = 5;
for (SendEffectMessage.EffectData effect : effects) {
MutableComponent text = Component.translatable(effect.descriptionId);
if (effect.amplifier >= 1 && effect.amplifier <= 9) {
MutableComponent levelText = Component.translatable("enchantment.level." + (effect.amplifier + 1));
text = text.append(" ").append(levelText);
}
String duration;
if (effect.duration == -1) {
duration = I18n.get("effect.duration.infinite");
} else {
duration = StringUtil.formatTickDuration(effect.duration);
}
text = text.append(" ").append(duration);
drawString(poseStack, font, text, leftPos - font.width(text) - 3, topPos + yOffset + 5, getPotionColor(effect.category));
yOffset += 10;
}
}
}

@SuppressWarnings("all")
private int getPotionColor(int category) {
switch (category) {
case 0:
return ChatFormatting.GREEN.getColor();
case 1:
return ChatFormatting.RED.getColor();
default:
return ChatFormatting.BLUE.getColor();
}
}

@Override
protected void renderBg(PoseStack poseStack, float partialTicks, int x, int y) {
poseStack.translate(0, 0, -100);
Expand Down Expand Up @@ -418,6 +461,14 @@ private void drawBaseInfoGui(PoseStack poseStack) {
blit(poseStack, leftPos + 6, topPos + 168, 0, 47, 67, 25);
}

@Override
protected void containerTick() {
counterTime += 1;
if (counterTime % 20 == 0 && maid != null) {
NetworkHandler.CHANNEL.sendToServer(new RequestEffectMessage(maid.getId()));
}
}

@Override
public int getGuiLeft() {
if (taskListOpen) {
Expand Down
Loading

0 comments on commit b2ec8e0

Please sign in to comment.