Skip to content

Commit

Permalink
Fixed Files for Release
Browse files Browse the repository at this point in the history
- Set up versioning
- Configured Javadoc to exclude Mixin
- Fixed all Javadoc comments
- Edited some comments
- Reformatted all source files
  • Loading branch information
halotroop2288 committed Aug 18, 2024
1 parent 9b6d8a4 commit d0bc750
Show file tree
Hide file tree
Showing 27 changed files with 181 additions and 73 deletions.
13 changes: 11 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ subprojects {
apply("plugin" to "xyz.wagyourtail.unimined")
apply("plugin" to "com.diffplug.spotless")

group = "net.minecraftforge"
base.archivesName = "forge"
version = "${rootProject.properties["version"]}+${project.name}"

unimined.useGlobalCache = false

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
Expand All @@ -27,13 +33,16 @@ subprojects {
targetCompatibility = "8"
}

tasks.withType(Javadoc::class.java).configureEach {
isFailOnError = false
exclude("net/minecraftforge/mixin/**.java")
}

tasks.withType(ProcessResources::class.java).configureEach {
inputs.property ("version", project.version)

filesMatching("*.mod.json") {
expand ("version" to project.version)
}
}

unimined.useGlobalCache = false
}
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Authentication does not work by default by we can still test skins
unimined.auth.enabled=false
unimined.auth.username=Halotroop2288

version=1.0.0
1 change: 1 addition & 0 deletions minecraft/beta/1.7.3/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
minecraft_version = b1.7.3
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static void beforeBlockRender(Block block, RenderBlocks renderer) {
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, -1F, 0.0F);
GL11.glBindTexture(GL_TEXTURE_2D, Minecraft.theMinecraft.renderEngine
.getTexture(((ITextureProvider) (block)).getTextureFile()));
.getTexture(((ITextureProvider) (block)).getTextureFile()));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.jetbrains.annotations.ApiStatus;

/**
* Adds public methods to {@link EffectRenderer} via Fabric Interface Injectors
* Adds public methods to {@link EffectRenderer} via Fabric Interface Injectors.
*
* @author halotroop2288
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public abstract class ItemRendererMixin {
* @reason implement {@link MinecraftForgeClient#overrideTexture(Object)}
*/
@Inject(method = "renderItem", at = @At(
value = "INVOKE", shift = At.Shift.AFTER,
target = "Lorg/lwjgl/opengl/GL11;glBindTexture(II)V"))
value = "INVOKE", shift = At.Shift.AFTER,
target = "Lorg/lwjgl/opengl/GL11;glBindTexture(II)V"))
private void forge$overrideTexture(EntityLiving entity, ItemStack stack, CallbackInfo ci) {
Item item = stack.getItem();
if (item instanceof ItemBlock) MinecraftForgeClient.overrideTexture(Block.blocksList[stack.itemID]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public abstract class MinecraftMixin {
* @reason implement {@link MinecraftForgeClient#onGameStart()}
*/
@Inject(method = "startGame", at = @At(value = "NEW",
target = "(Ljava/io/File;Lnet/minecraft/client/Minecraft;)Lnet/minecraft/src/ThreadDownloadResources;"))
target = "(Ljava/io/File;Lnet/minecraft/client/Minecraft;)Lnet/minecraft/src/ThreadDownloadResources;"))
private void forge$startGame_ThreadDownloadResources(CallbackInfo ci) {
MinecraftForgeClient.onGameStart();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public abstract class RenderItemMixin {
* @reason implement {@link MinecraftForgeClient#overrideTexture(Object)}
*/
@Inject(method = "doRenderItem", require = 2,
at = @At(value = "CONSTANT", shift = At.Shift.AFTER, args = "stringValue=/terrain.png"))
at = @At(value = "CONSTANT", shift = At.Shift.AFTER, args = "stringValue=/terrain.png"))
private void forge$overrideTerrainTexture(EntityItem itemEntity, double x, double y, double z,
float a, float b, CallbackInfo ci) {
MinecraftForgeClient.overrideTexture(Block.blocksList[itemEntity.item.itemID]);
Expand All @@ -36,7 +36,7 @@ public abstract class RenderItemMixin {
* @reason implement {@link MinecraftForgeClient#overrideTexture(Object)}
*/
@Inject(method = "doRenderItem", require = 1,
at = @At(value = "CONSTANT", shift = At.Shift.AFTER, args = "stringValue=/gui/items.png"))
at = @At(value = "CONSTANT", shift = At.Shift.AFTER, args = "stringValue=/gui/items.png"))
private void forge$overrideItemsTexture(EntityItem itemEntity, double x, double y, double z,
float a, float b, CallbackInfo ci) {
MinecraftForgeClient.overrideTexture(itemEntity.item.getItem());
Expand All @@ -49,8 +49,8 @@ public abstract class RenderItemMixin {
* @reason implement {@link MinecraftForgeClient#overrideTexture(Object)}
*/
@Inject(method = "drawItemIntoGui", require = 3, at = @At(
value = "INVOKE", shift = At.Shift.AFTER,
target = "Lnet/minecraft/src/RenderEngine;bindTexture(I)V"))
value = "INVOKE", shift = At.Shift.AFTER,
target = "Lnet/minecraft/src/RenderEngine;bindTexture(I)V"))
private void forge$overrideTerrainTexture(FontRenderer font, RenderEngine engine, int itemID, int a, int b,
int c, int d, CallbackInfo ci) {
if (itemID < 256) MinecraftForgeClient.overrideTexture(Block.blocksList[itemID]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
@Mixin(WorldRenderer.class)
public abstract class WorldRendererMixin {
@Inject(method = "updateRenderer", at = @At(value = "INVOKE", shift = At.Shift.AFTER,
target = "Lnet/minecraft/src/Block;getRenderBlockPass()I"))
target = "Lnet/minecraft/src/Block;getRenderBlockPass()I"))
private void forge$updateRenderer_getRenderBlockPass_after(CallbackInfo ci,
@Local(ordinal = 0) LocalBooleanRef flag,
@Local(ordinal = 6) LocalIntRef j3,
Expand All @@ -37,7 +37,7 @@ public abstract class WorldRendererMixin {
* @reason implement {@link ITextureProvider}
*/
@Inject(method = "updateRenderer", at = @At(value = "INVOKE",
target = "Lnet/minecraft/src/RenderBlocks;renderBlockByRenderType(Lnet/minecraft/src/Block;III)Z"))
target = "Lnet/minecraft/src/RenderBlocks;renderBlockByRenderType(Lnet/minecraft/src/Block;III)Z"))
private void forge$updateRenderer_renderBlockByRenderType(CallbackInfo ci,
@Local Block block,
@Local RenderBlocks renderer) {
Expand All @@ -52,7 +52,7 @@ public abstract class WorldRendererMixin {
* @reason prevent bugs caused by implementing {@link ITextureProvider}
*/
@Inject(method = "updateRenderer", at = @At(value = "INVOKE", shift = At.Shift.AFTER,
target = "Lnet/minecraft/src/RenderBlocks;renderBlockByRenderType(Lnet/minecraft/src/Block;III)Z"))
target = "Lnet/minecraft/src/RenderBlocks;renderBlockByRenderType(Lnet/minecraft/src/Block;III)Z"))
private void forge$updateRenderer_renderBlockByRenderType_after(CallbackInfo ci,
@Local Block block,
@Local RenderBlocks renderer) {
Expand Down
6 changes: 4 additions & 2 deletions minecraft/beta/1.7.3/src/client/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
],
"custom": {
"loom:injected_interfaces": {
"net/minecraft/src/EffectRenderer": ["net/minecraftforge/injection/ForgeEffectRenderer"]
"net/minecraft/src/EffectRenderer": [
"net/minecraftforge/injection/ForgeEffectRenderer"
]
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,23 @@ public class Configuration {

private final @NotNull File file;

/**
* Properties with no specific category.
*/
public TreeMap<String, Property> generalProperties = new TreeMap<>();
/**
* Properties in the Block category.
*/
public TreeMap<String, Property> blockProperties = new TreeMap<>();
/**
* Properties in the Item category.
*/
public TreeMap<String, Property> itemProperties = new TreeMap<>();
public TreeMap<String, Property> generalProperties = new TreeMap<>();

/**
* Create a configuration for the file given.
* Creates a configuration for the file given.
*
* @param file the location to store the configuration
* @author Space Toad
* @since 1.0.0
*/
Expand All @@ -40,14 +50,14 @@ public Configuration(@NotNull File file) {
}

/**
* Gets or create a block id property.<br>
* Gets or creates a block id property.<br>
* If the block id property key is already in the configuration, then it will be used.
* Otherwise, {@code defaultID} will be used, except if already taken,
* in which case this will try to determine a free default id.
*
* @param key the key to get or create a property for
* @param key the key for which to get or create a property
* @param defaultID the id to try to use if the property doesn't already exist
*
* @return the property associated with the given key, or null if the property couldn't be created.
* @author Space Toad
* @since 1.0.0
*/
Expand Down Expand Up @@ -87,6 +97,13 @@ public Configuration(@NotNull File file) {
}

/**
* The same as {@link #getOrCreateProperty(String, PropertyKind, String)}
* but for {@link Integer#TYPE int} properties rather than {@link String} properties.
*
* @param key the key for which to get or create a property
* @param kind the category to look for the property in
* @param defaultValue the value to use if the property doesn't already exist
* @return the property associated with the given key, or null if the property couldn't be created.
* @author Space Toad
* @since 1.0.0
*/
Expand All @@ -105,6 +122,13 @@ public Configuration(@NotNull File file) {
}

/**
* The same as {@link #getOrCreateProperty(String, PropertyKind, String)}
* but for {@link Boolean#TYPE boolean} properties rather than {@link String} properties.
*
* @param key the key for which to get or create a property
* @param kind the category to look for the property in
* @param defaultValue the value to use if the property doesn't already exist
* @return the property associated with the given key, or null if the property couldn't be created.
* @author Space Toad
* @since 1.0.0
*/
Expand All @@ -120,6 +144,14 @@ public Configuration(@NotNull File file) {
}

/**
* Gets or creates a property.<br>
* If the property key is already in the configuration, then it will be used.
* Otherwise, {@code defaultValue} will be used.
*
* @param key the key for which to get or create a property
* @param kind the category to look for the property in
* @param defaultValue the value to use if the property doesn't already exist
* @return the property associated with the given key, or null if the property couldn't be created.
* @author Space Toad
* @since 1.0.0
*/
Expand Down Expand Up @@ -154,6 +186,8 @@ public Configuration(@NotNull File file) {
}

/**
* Loads the configuration file from disk.
*
* @author Space Toad
* @since 1.0.0
*/
Expand Down Expand Up @@ -240,6 +274,8 @@ public void load() {
}

/**
* Saves the configuration file to disk.
*
* @author Space Toad
* @since 1.0.0
*/
Expand Down Expand Up @@ -289,10 +325,6 @@ public void save() {
}
}

/**
* @author Space Toad
* @since 1.0.0
*/
private void writeProperties(BufferedWriter buffer, Collection<Property> props) throws IOException {
for (Property property : props) {
if (property.comment != null) {
Expand All @@ -305,20 +337,50 @@ private void writeProperties(BufferedWriter buffer, Collection<Property> props)
}

/**
* Holds data for each configuration entry.
*
* @author Space Toad
* @since 1.0.0
*/
public static class Property {
/**
* The name of the configuration property.
*/
public String name;
/**
* The value associated with the configuration property.
*/
public String value;
/**
* The comment that describes the configuration property to the user.
*/
public String comment;

/**
* Default constructor.
*/
public Property() {
}
}

/**
* Valid types of configuration properties.
*
* @author Space Toad
* @since 1.0.0
*/
public enum PropertyKind {
GENERAL, BLOCK, ITEM
/**
* No specific category.
*/
GENERAL,
/**
* Property in the Block category.
*/
BLOCK,
/**
* Property in the Item category.
*/
ITEM,
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@

/**
* This interface is to be implemented by {@link Block} classes.
* It will override standard algorithms controlling connection between two blocks by redstone
* It will override standard algorithms controlling connection between two blocks by redstone.
*
* @author Eloraam
* @since 1.0.0
*/
@FunctionalInterface
public interface IConnectRedstone {
/**
* Checks if a redstone connection can be made in the given direction from this block.
*
* @param world the world to act on
* @param x the x position of this block
* @param y the y position of this block
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
*/
public interface IMultipassRender {
/**
* Checks whether the block can be rendered during the given rendering pass.
*
* @param pass the current render pass
* @return whether the block should be rendered during this pass
* @author Eloraam
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*/
public interface IOverrideReplace {
/**
* Checks if the given block can be replaced in the given context.
*
* @param world the world to act on
* @param x the x position of the block to replace
* @param y the y position of the block to replace
Expand All @@ -27,7 +29,9 @@ public interface IOverrideReplace {
boolean canReplaceBlock(@NotNull World world, int x, int y, int z, int blockID);

/**
* @return whether the block was successfully replaced
* Checks whether the block was successfully replaced.
*
* @return {@code true} if the operation was a success
* @author Eloraam
* @since 1.0.0
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package net.minecraft.src.forge;

import net.minecraft.src.ItemArmor;
import org.jetbrains.annotations.ApiStatus;

/**
* This interface is to be implemented by {@link ItemArmor} classes.
Expand All @@ -16,17 +17,24 @@
*/
public interface ISpecialArmor {
/**
* Adjusts the amount of damage received by the entity.
* Called before vanilla damage computation.<br>
* Adjusts the amount of damage received by the wearer.
*
* @param damage the damage value before the armor is applied
* @return the new damage value after this armor is applied
* @author Space Toad
* @since 1.0.0
*/
@ApiStatus.OverrideOnly
int adjustArmorDamage(int damage);

/**
* @return true if the vanilla armor computation should be cancelled.
* Allows you to cancel the vanilla armor calculation.
*
* @return false if the vanilla armor calculation should be cancelled.
* @author Space Toad
* @since 1.0.0
*/
@ApiStatus.OverrideOnly
boolean allowRegularComputation();
}
Loading

0 comments on commit d0bc750

Please sign in to comment.