Skip to content

Commit

Permalink
Added tessellation example
Browse files Browse the repository at this point in the history
  • Loading branch information
Ocelot5836 committed Apr 6, 2024
1 parent 66038ca commit a19f8e7
Show file tree
Hide file tree
Showing 32 changed files with 740 additions and 135 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Fabric Example Mod
# Veil Example Mod

## Setup

For setup instructions please see the [fabric wiki page](https://fabricmc.net/wiki/tutorial:setup) that relates to the IDE that you are using.
For setup instructions, please see the [Veil wiki page](https://github.com/FoundryMC/Veil/wiki).

## License

Expand Down
99 changes: 44 additions & 55 deletions build.gradle
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.
}
}
11 changes: 6 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ org.gradle.parallel=true

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.20.4
yarn_mappings=1.20.4+build.3
minecraft_version=1.20.1
yarn_mappings=1.20.1+build.10
loader_version=0.15.9

# Mod Properties
mod_version=1.0.0
maven_group=com.example
archives_base_name=modid
maven_group=foundry
archives_base_name=veil-example-mod

# Dependencies
fabric_version=0.96.11+1.20.4
fabric_version=0.92.0+1.20.1
veil_version=1.0.0.139
15 changes: 0 additions & 15 deletions src/client/java/com/example/mixin/client/ExampleClientMixin.java

This file was deleted.

1 change: 0 additions & 1 deletion src/client/resources/modid.client.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"package": "com.example.mixin.client",
"compatibilityLevel": "JAVA_17",
"client": [
"ExampleClientMixin"
],
"injectors": {
"defaultRequire": 1
Expand Down
22 changes: 0 additions & 22 deletions src/main/java/com/example/ExampleMod.java

This file was deleted.

15 changes: 0 additions & 15 deletions src/main/java/com/example/mixin/ExampleMixin.java

This file was deleted.

35 changes: 35 additions & 0 deletions src/main/java/foundry/veil/example/VeilExampleMod.java
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 src/main/java/foundry/veil/example/VeilExampleModClient.java
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()));
}
}
57 changes: 57 additions & 0 deletions src/main/java/foundry/veil/example/block/MapBlock.java
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 src/main/java/foundry/veil/example/blockentity/MapBlockEntity.java
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);
// }
}
Loading

0 comments on commit a19f8e7

Please sign in to comment.