generated from FabricMC/fabric-example-mod
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
66038ca
commit a19f8e7
Showing
32 changed files
with
740 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,87 +1,76 @@ | ||
plugins { | ||
id 'fabric-loom' version '1.6-SNAPSHOT' | ||
id 'maven-publish' | ||
id 'fabric-loom' version '1.6-SNAPSHOT' | ||
} | ||
|
||
version = project.mod_version | ||
group = project.maven_group | ||
|
||
base { | ||
archivesName = project.archives_base_name | ||
archivesName = project.archives_base_name | ||
} | ||
|
||
repositories { | ||
// Add repositories to retrieve artifacts from in here. | ||
// You should only use this when depending on other mods because | ||
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically. | ||
// See https://docs.gradle.org/current/userguide/declaring_repositories.html | ||
// for more information about repositories. | ||
} | ||
|
||
loom { | ||
splitEnvironmentSourceSets() | ||
|
||
mods { | ||
"modid" { | ||
sourceSet sourceSets.main | ||
sourceSet sourceSets.client | ||
maven { | ||
name = 'BlameJared Maven (CrT / Bookshelf)' | ||
url = 'https://maven.blamejared.com' | ||
} | ||
exclusiveContent { | ||
forRepository { | ||
maven { | ||
name = "Modrinth" | ||
url = "https://api.modrinth.com/maven" | ||
} | ||
} | ||
filter { | ||
includeGroup "maven.modrinth" | ||
} | ||
} | ||
} | ||
|
||
loom { | ||
mods { | ||
"veil-example-mod" { | ||
sourceSet sourceSets.main | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
// To change the versions see the gradle.properties file | ||
minecraft "com.mojang:minecraft:${project.minecraft_version}" | ||
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" | ||
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" | ||
// To change the versions see the gradle.properties file | ||
minecraft "com.mojang:minecraft:${project.minecraft_version}" | ||
mappings loom.officialMojangMappings() | ||
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" | ||
|
||
// Fabric API. This is technically optional, but you probably want it anyway. | ||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" | ||
|
||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" | ||
|
||
modImplementation("foundry.veil:Veil-fabric-${project.minecraft_version}:${project.veil_version}") { transitive = false } | ||
modRuntimeOnly "maven.modrinth:modmenu:7.2.2" | ||
} | ||
|
||
processResources { | ||
inputs.property "version", project.version | ||
inputs.property "version", project.version | ||
|
||
filesMatching("fabric.mod.json") { | ||
expand "version": project.version | ||
} | ||
filesMatching("fabric.mod.json") { | ||
expand "version": project.version | ||
} | ||
} | ||
|
||
tasks.withType(JavaCompile).configureEach { | ||
it.options.release = 17 | ||
it.options.release = 17 | ||
} | ||
|
||
java { | ||
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task | ||
// if it is present. | ||
// If you remove this line, sources will not be generated. | ||
withSourcesJar() | ||
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task | ||
// if it is present. | ||
// If you remove this line, sources will not be generated. | ||
withSourcesJar() | ||
|
||
sourceCompatibility = JavaVersion.VERSION_17 | ||
targetCompatibility = JavaVersion.VERSION_17 | ||
sourceCompatibility = JavaVersion.VERSION_17 | ||
targetCompatibility = JavaVersion.VERSION_17 | ||
} | ||
|
||
jar { | ||
from("LICENSE") { | ||
rename { "${it}_${project.base.archivesName.get()}"} | ||
} | ||
from("LICENSE") { | ||
rename { "${it}_${project.base.archivesName.get()}" } | ||
} | ||
} | ||
|
||
// configure the maven publication | ||
publishing { | ||
publications { | ||
create("mavenJava", MavenPublication) { | ||
from components.java | ||
} | ||
} | ||
|
||
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. | ||
repositories { | ||
// Add repositories to publish to here. | ||
// Notice: This block does NOT have the same function as the block in the top level. | ||
// The repositories here will be used for publishing your artifact, not for | ||
// retrieving dependencies. | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 0 additions & 15 deletions
15
src/client/java/com/example/mixin/client/ExampleClientMixin.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package foundry.veil.example; | ||
|
||
import foundry.veil.example.registry.VeilExampleBlocks; | ||
import foundry.veil.example.registry.VeilExampleItems; | ||
import net.fabricmc.api.ModInitializer; | ||
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup; | ||
import net.minecraft.core.Registry; | ||
import net.minecraft.core.registries.BuiltInRegistries; | ||
import net.minecraft.core.registries.Registries; | ||
import net.minecraft.network.chat.Component; | ||
import net.minecraft.resources.ResourceKey; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.item.CreativeModeTab; | ||
import net.minecraft.world.item.ItemStack; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class VeilExampleMod implements ModInitializer { | ||
|
||
public static final String MODID = "veil-example-mod"; | ||
public static final Logger LOGGER = LoggerFactory.getLogger(MODID); | ||
|
||
private static final ResourceKey<CreativeModeTab> ITEM_GROUP = ResourceKey.create(Registries.CREATIVE_MODE_TAB, VeilExampleMod.path("items")); | ||
|
||
public static ResourceLocation path(String path) { | ||
return new ResourceLocation(MODID, path); | ||
} | ||
|
||
@Override | ||
public void onInitialize() { | ||
VeilExampleItems.bootstrap(); | ||
VeilExampleBlocks.bootstrap(); | ||
Registry.register(BuiltInRegistries.CREATIVE_MODE_TAB, ITEM_GROUP, FabricItemGroup.builder().title(Component.translatable(MODID + ".items")).icon(() -> new ItemStack(VeilExampleBlocks.MAP)).displayItems(VeilExampleItems::fillTab).build()); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/main/java/foundry/veil/example/VeilExampleModClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package foundry.veil.example; | ||
|
||
import foundry.veil.example.client.render.MapBlockEntityRenderer; | ||
import foundry.veil.example.client.render.MapBlockItemRenderer; | ||
import foundry.veil.example.editor.VeilExampleModEditor; | ||
import foundry.veil.example.registry.VeilExampleBlocks; | ||
import foundry.veil.fabric.event.FabricVeilRendererEvent; | ||
import net.fabricmc.api.ClientModInitializer; | ||
import net.fabricmc.fabric.api.client.rendering.v1.BuiltinItemRendererRegistry; | ||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderers; | ||
|
||
public class VeilExampleModClient implements ClientModInitializer { | ||
|
||
@Override | ||
public void onInitializeClient() { | ||
BuiltinItemRendererRegistry.INSTANCE.register(VeilExampleBlocks.MAP, new MapBlockItemRenderer()); | ||
BlockEntityRenderers.register(VeilExampleBlocks.MAP_BE, MapBlockEntityRenderer::new); | ||
FabricVeilRendererEvent.EVENT.register(renderer -> renderer.getEditorManager().add(new VeilExampleModEditor())); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package foundry.veil.example.block; | ||
|
||
import foundry.veil.example.blockentity.MapBlockEntity; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.world.level.BlockGetter; | ||
import net.minecraft.world.level.block.Block; | ||
import net.minecraft.world.level.block.EntityBlock; | ||
import net.minecraft.world.level.block.RenderShape; | ||
import net.minecraft.world.level.block.SimpleWaterloggedBlock; | ||
import net.minecraft.world.level.block.entity.BlockEntity; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import net.minecraft.world.level.block.state.StateDefinition; | ||
import net.minecraft.world.level.block.state.properties.BlockStateProperties; | ||
import net.minecraft.world.level.block.state.properties.BooleanProperty; | ||
import net.minecraft.world.phys.shapes.CollisionContext; | ||
import net.minecraft.world.phys.shapes.Shapes; | ||
import net.minecraft.world.phys.shapes.VoxelShape; | ||
|
||
public class MapBlock extends Block implements EntityBlock, SimpleWaterloggedBlock { | ||
|
||
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; | ||
|
||
public MapBlock(Properties properties) { | ||
super(properties); | ||
this.registerDefaultState(this.stateDefinition.any().setValue(WATERLOGGED, Boolean.FALSE)); | ||
} | ||
|
||
@Override | ||
public RenderShape getRenderShape(BlockState blockState) { | ||
return RenderShape.ENTITYBLOCK_ANIMATED; | ||
} | ||
|
||
@Override | ||
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { | ||
return new MapBlockEntity(pos, state); | ||
} | ||
|
||
@Override | ||
public VoxelShape getVisualShape(BlockState blockState, BlockGetter blockGetter, BlockPos blockPos, CollisionContext collisionContext) { | ||
return Shapes.empty(); | ||
} | ||
|
||
@Override | ||
public boolean propagatesSkylightDown(BlockState blockState, BlockGetter blockGetter, BlockPos blockPos) { | ||
return blockState.getFluidState().isEmpty(); | ||
} | ||
|
||
@Override | ||
public float getShadeBrightness(BlockState blockState, BlockGetter blockGetter, BlockPos blockPos) { | ||
return 1.0F; | ||
} | ||
|
||
@Override | ||
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) { | ||
builder.add(WATERLOGGED); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/foundry/veil/example/blockentity/MapBlockEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package foundry.veil.example.blockentity; | ||
|
||
import foundry.veil.example.registry.VeilExampleBlocks; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.world.level.block.entity.BlockEntity; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
|
||
public class MapBlockEntity extends BlockEntity { | ||
|
||
public MapBlockEntity(BlockPos blockPos, BlockState blockState) { | ||
super(VeilExampleBlocks.MAP_BE, blockPos, blockState); | ||
} | ||
|
||
// @Override | ||
// public Packet<ClientGamePacketListener> getUpdatePacket() { | ||
// return ClientboundBlockEntityDataPacket.create(this); | ||
// } | ||
} |
Oops, something went wrong.