Skip to content

Commit

Permalink
移植
Browse files Browse the repository at this point in the history
  • Loading branch information
zx1316 committed Oct 3, 2024
1 parent e2aacc3 commit 9c34694
Show file tree
Hide file tree
Showing 194 changed files with 6,024 additions and 689 deletions.
1,172 changes: 663 additions & 509 deletions LICENSE.txt

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
buildscript {
dependencies {
classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT'
}
}

plugins {
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
}

apply plugin: 'org.spongepowered.mixin'

version = mod_version
group = mod_group_id

Expand All @@ -17,6 +26,7 @@ java.toolchain.languageVersion = JavaLanguageVersion.of(17)

println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"
minecraft {
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
// The mappings can be changed at any time and must be in the following format.
// Channel: Version:
// official MCVersion Official field/method names from Mojang mapping files
Expand All @@ -31,6 +41,7 @@ minecraft {
// Use non-default mappings at your own risk. They may not always work.
// Simply re-run your setup task after changing the mappings to update your workspace.
mappings channel: mapping_channel, version: mapping_version
mappings channel: 'parchment', version: '2023.06.26-1.19.4'

// When true, this property will have all Eclipse/IntelliJ IDEA run configurations run the "prepareX" task for the given run configuration before launching the game.
// In most cases, it is not necessary to enable.
Expand Down Expand Up @@ -132,6 +143,7 @@ dependencies {
// If the group id is "net.minecraft" and the artifact id is one of ["client", "server", "joined"],
// then special handling is done to allow a setup of a vanilla dependency without the use of an external repository.
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'

// Example mod dependency with JEI - using fg.deobf() ensures the dependency is remapped to your development mappings
// The JEI API is declared for compile time use, while the full JEI artifact is used at runtime
Expand Down Expand Up @@ -186,6 +198,11 @@ tasks.named('jar', Jar).configure {
finalizedBy 'reobfJar'
}

mixin {
add sourceSets.main, 'drglaserpointer.mixins.refmap.json'
config 'drglaserpointer.mixins.json'
}

// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing:
// tasks.named('publish').configure {
// dependsOn 'reobfJar'
Expand Down
14 changes: 7 additions & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,18 @@ mapping_version=1.19.4

# The unique mod identifier for the mod. Must be lowercase in English locale. Must fit the regex [a-z][a-z0-9_]{1,63}
# Must match the String constant located in the main mod class annotated with @Mod.
mod_id=examplemod
mod_id=drglaserpointer
# The human-readable display name for the mod.
mod_name=Example Mod
mod_name=DRG Laser Pointer
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=All Rights Reserved
mod_license=GNU GPLv3
# The mod version. See https://semver.org/
mod_version=1.0.0
mod_version=1.1.1
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
mod_group_id=com.example.examplemod
mod_group_id=com.linngdu664.drglaserpointer
# The authors of the mod. This is a simple text string that is used for display purposes in the mod list.
mod_authors=YourNameHere, OtherNameHere
mod_authors=linngdu664, zx1316
# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list.
mod_description=Example mod description.\nNewline characters can be used and will be replaced properly.
mod_description=Brings laser pointer in Deep Rock Galactic to Minecraft. Rock N Stone!
2 changes: 2 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ pluginManagement {
name = 'MinecraftForge'
url = 'https://maven.minecraftforge.net/'
}
maven { url = 'https://maven.parchmentmc.org' }
maven { url = 'https://repo.spongepowered.org/maven' }
}
}

Expand Down
64 changes: 0 additions & 64 deletions src/main/java/com/example/examplemod/Config.java

This file was deleted.

108 changes: 0 additions & 108 deletions src/main/java/com/example/examplemod/ExampleMod.java

This file was deleted.

30 changes: 30 additions & 0 deletions src/main/java/com/linngdu664/drglaserpointer/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.linngdu664.drglaserpointer;

import com.linngdu664.drglaserpointer.config.ClientConfig;
import com.linngdu664.drglaserpointer.config.CommonConfig;
import com.linngdu664.drglaserpointer.registry.*;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.config.ModConfig;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;

// The value here should match an entry in the META-INF/neoforge.mods.toml file
@Mod(Main.MODID)
public class Main {
public static final String MODID = "drglaserpointer";

public static ResourceLocation makeResLoc(String path) {
return new ResourceLocation(MODID, path);
}

public Main() {
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
ItemRegister.ITEMS.register(modEventBus);
EntityRegister.ENTITY_TYPES.register(modEventBus);
SoundRegister.SOUNDS.register(modEventBus);
ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, CommonConfig.SPEC);
ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, ClientConfig.SPEC);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package com.linngdu664.drglaserpointer.client.model;// Made with Blockbench 4.10.4
// Exported for Minecraft version 1.17 or later with Mojang mappings
// Paste this class into your mod and generate all required imports


import com.linngdu664.drglaserpointer.Main;
import com.linngdu664.drglaserpointer.entity.LaserPointerMarkEntity;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import net.minecraft.client.model.EntityModel;
import net.minecraft.client.model.geom.ModelLayerLocation;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.builders.*;
import net.minecraft.resources.ResourceLocation;
import org.jetbrains.annotations.NotNull;

public class LaserPointerMarkModel<T extends LaserPointerMarkEntity> extends EntityModel<T> {
// This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor
public static final ModelLayerLocation LAYER_LOCATION_BLUE = new ModelLayerLocation(ResourceLocation.tryBuild(Main.MODID, "textures/models/laser_pointer_label_blue.png"), "main");
public static final ModelLayerLocation LAYER_LOCATION_RED = new ModelLayerLocation(ResourceLocation.tryBuild(Main.MODID, "textures/models/laser_pointer_label_red.png"), "main");
public static final ModelLayerLocation LAYER_LOCATION_GREEN = new ModelLayerLocation(ResourceLocation.tryBuild(Main.MODID, "textures/models/laser_pointer_label_green.png"), "main");
public static final ModelLayerLocation LAYER_LOCATION_YELLOW = new ModelLayerLocation(ResourceLocation.tryBuild(Main.MODID, "textures/models/laser_pointer_label_yellow.png"), "main");
public static final ModelLayerLocation LAYER_LOCATION_EMPTY = new ModelLayerLocation(ResourceLocation.tryBuild(Main.MODID, "textures/models/laser_pointer_label_empty.png"), "main");
private final ModelPart bone;
public ModelPart getBody() {
return bone;
}

public LaserPointerMarkModel(ModelPart root) {
this.bone = root.getChild("bone");
}

public static LayerDefinition createBodyLayer() {
MeshDefinition meshdefinition = new MeshDefinition();
PartDefinition partdefinition = meshdefinition.getRoot();

PartDefinition bone = partdefinition.addOrReplaceChild("bone", CubeListBuilder.create().texOffs(0, 24).addBox(-5.0F, -11.0F, -5.0F, 10.0F, 10.0F, 10.0F, new CubeDeformation(0.0F))
.texOffs(0, 0).addBox(-6.0F, -12.0F, -6.0F, 12.0F, 12.0F, 12.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 5.8F, 0.0F));

return LayerDefinition.create(meshdefinition, 64, 64);
}

@Override
public void setupAnim(@NotNull T t, float v, float v1, float v2, float v3, float v4) {

}

@Override
public void renderToBuffer(PoseStack poseStack, VertexConsumer vertexConsumer, int i, int i1, float v, float v1, float v2, float v3) {
bone.render(poseStack, vertexConsumer, i, i1, v, v1, v2, v3);
}
}
Loading

0 comments on commit 9c34694

Please sign in to comment.