Skip to content

Commit

Permalink
Add API documentation and missing license headers
Browse files Browse the repository at this point in the history
  • Loading branch information
TheCodex6824 committed Jul 20, 2024
1 parent 4ce16dd commit 976b738
Show file tree
Hide file tree
Showing 17 changed files with 377 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/main/java/thecodex6824/coremodlib/MutableMatchDetails.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
/**
* Thaumcraft Fix
* Copyright (c) 2024 TheCodex6824.
*
* This file is part of Thaumcraft Fix.
*
* Thaumcraft Fix is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Thaumcraft Fix is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Thaumcraft Fix. If not, see <https://www.gnu.org/licenses/>.
*/

package thecodex6824.coremodlib;

import org.objectweb.asm.tree.AbstractInsnNode;
Expand Down
31 changes: 31 additions & 0 deletions src/main/java/thecodex6824/coremodlib/package-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* Thaumcraft Fix
* Copyright (c) 2024 TheCodex6824.
*
* This file is part of Thaumcraft Fix.
*
* Thaumcraft Fix is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Thaumcraft Fix is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Thaumcraft Fix. If not, see <https://www.gnu.org/licenses/>.
*/

/**
* <strong>Stop.</strong>
* <p>
* This is not (currently) an external API. It may change without warning. Use this at
* your own risk - bug reports about API breakages in this package will not be accepted.
* If you want to use this package, first consider using the
* <a href="https://github.com/SpongePowered/Mixin/wiki">Mixin</href> library, and only if you really want to
* still use this, ask the maintainer to consider making this a stable API.
*/
@javax.annotation.ParametersAreNonnullByDefault
package thecodex6824.coremodlib;
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@

package thecodex6824.thaumcraftfix.api;

/**
* Contains basic constants identifying the mod.
*/
public final class ThaumcraftFixApi {

private ThaumcraftFixApi() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,25 @@

import thaumcraft.api.casters.FocusPackage;

/**
* Interface for focus nodes that contain other independent collection(s) of focus nodes.
* These nodes contain their own entire node tree called a {@link thaumcraft.api.casters.FocusPackage FocusPackage}.
* In Thaumcraft itself, only {@link thaumcraft.api.casters.FocusModSplit FocusModSplit} fits this criteria.
* In order to have any fixes for the behavior of these kind of nodes apply to nodes from other mods,
* they must implement this interface to tell TC Fix that it contains <code>FocusPackage</code>s.
*
* @see thaumcraft.api.casters.FocusPackage FocusPackage
* @see thaumcraft.api.casters.FocusModSplit FocusModSplit
*/
public interface IContainsFocusPackageNode {

/**
* Returns a collection of {@link thaumcraft.api.casters.FocusPackage FocusPackage}s that are contained
* in this node.
* The contained packages may be modified by the caller.
* @return A collection of the {@link thaumcraft.api.casters.FocusPackage FocusPackage}s
* that are a part of this focus node
*/
public Collection<FocusPackage> getEmbeddedPackages();

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,29 @@
import net.minecraftforge.event.entity.EntityEvent;
import net.minecraftforge.fml.common.eventhandler.Event.HasResult;

/**
* This event is fired whenever an {@link net.minecraft.entity.Entity Entity} is trying to determine
* if it is in the Outer Lands. As the Outer Lands do not exist in TC6, normally this check would only pass
* if the entity is in a dimension that happens to share an ID with what Thaumcraft would have assigned
* to the Outer Lands. This event allows overriding that check to control entity behavior.
* <p>
* A {@link net.minecraftforge.fml.common.eventhandler.Event.Result Result} of <code>DENY</code> will have
* the entity believe it is not in the Outer Lands, regardless of the normal Thaumcraft behavior.
* <p>
* A <code>Result</code> of <code>ALLOW</code> will similarly have the entity believe it is in the Outer Lands.
* <p>
* A <code>Result</code> of <code>DEFAULT</code> will use the default Thaumcraft behavior described above.
* <p>
* This event is not cancelable.
*/
@HasResult
public class EntityInOuterLandsEvent extends EntityEvent {

/**
* Creates a new <code>EntityInOuterLandsEvent</code>.
* @param entity The {@link net.minecraft.entity.Entity Entity} that is checking if it is
* currently located in the Outer Lands
*/
public EntityInOuterLandsEvent(Entity entity) {
super(entity);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,52 @@
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import thaumcraft.common.entities.EntityFluxRift;

/**
* This event is fired whenever a {@link thaumcraft.common.entities.EntityFluxRift EntityFluxRift} attempts
* to destroy a block contained in its bounding box.
* <p>
* Canceling this event will result in the block not being destroyed.
*/
@Cancelable
public class FluxRiftDestroyBlockEvent extends EntityEvent {

protected final BlockPos pos;
protected final IBlockState state;

/**
* Creates a new <code>FluxRiftDestroyBlockEvent</code>.
* @param rift The {@link thaumcraft.common.entities.EntityFluxRift EntityFluxRift} attempting to destroy a block
* @param position The {@link net.minecraft.util.math.BlockPos BlockPos} of the block
* @param destroyedState The {@link net.minecraft.block.state.IBlockState IBlockState} of the block
*/
public FluxRiftDestroyBlockEvent(EntityFluxRift rift, BlockPos position, IBlockState destroyedState) {
super(rift);
pos = position;
state = destroyedState;
}

/**
* Returns the {@link thaumcraft.common.entities.EntityFluxRift EntityFluxRift} that is attempting
* to break a block.
* @return The rift attempting to break the block
*/
public EntityFluxRift getRift() {
return (EntityFluxRift) getEntity();
}

/**
* Returns the {@link net.minecraft.util.math.BlockPos BlockPos} of the block the rift is attempting to break.
* @return The position of the block the rift is attempting to break
*/
public BlockPos getPosition() {
return pos;
}

/**
* Returns the {@link net.minecraft.block.state.IBlockState IBlockState} of the block
* the rift is attempting to destroy.
* @return The state of the block the rift is attempting to break
*/
public IBlockState getDestroyedBlock() {
return state;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
/**
* Thaumcraft Fix
* Copyright (c) 2024 TheCodex6824.
*
* This file is part of Thaumcraft Fix.
*
* Thaumcraft Fix is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Thaumcraft Fix is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Thaumcraft Fix. If not, see <https://www.gnu.org/licenses/>.
*/

package thecodex6824.thaumcraftfix.api.event;

import javax.annotation.Nullable;
Expand All @@ -11,13 +31,30 @@
import thaumcraft.api.research.ResearchEvent;
import thecodex6824.thaumcraftfix.api.ThaumcraftFixApi;

/**
* This event is fired on the <strong>client side only</strong> when a player gains knowledge points
* (in the form of observations or theorycraft / research points).
* <p>
* Unlike {@link thaumcraft.api.research.ResearchEvent.Knowledge ResearchEvent.Knowledge}, this event
* will always fire on the client, even outside of singleplayer. Note that because this event inherits
* <code>ResearchEvent.Knowledge</code>, event handlers listening for that event will also receive this one.
*/
public class PlayerGainKnowledgeEventClient extends ResearchEvent.Knowledge {

private static final String CANCEL_LOG_TEXT =
"Something tried to cancel a client-side knowledge event (added by ThaumcraftFix)." + System.lineSeparator()
+ "This is unsupported, but will only be a no-op instead of crashing the game." + System.lineSeparator()
+ "To silence this warning, make sure that the event trying to be canceled is a server-side event, where canceling actually does things.";

/**
* Creates a new <code>PlayerGainKnowledgeEventClient</code>.
* @param player The {@link net.minecraft.entity.player.EntityPlayer EntityPlayer} receiving the knowledge.
* Since this is the client event, this will always be the local player.
* @param type The {@link thaumcraft.api.capabilities.IPlayerKnowledge.EnumKnowledgeType EnumKnowledgeType} to give
* @param category The {@link thaumcraft.api.research.ResearchCategory ResearchCategory} of knowledge to give.
* This <strong>is allowed</strong> to be null.
* @param amount The amount of knowledge to grant
*/
public PlayerGainKnowledgeEventClient(EntityPlayer player, EnumKnowledgeType type, @Nullable ResearchCategory category, int amount) {
super(player, type, category, amount);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
/**
* Thaumcraft Fix
* Copyright (c) 2024 TheCodex6824.
*
* This file is part of Thaumcraft Fix.
*
* Thaumcraft Fix is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Thaumcraft Fix is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Thaumcraft Fix. If not, see <https://www.gnu.org/licenses/>.
*/

package thecodex6824.thaumcraftfix.api.event;

import org.apache.logging.log4j.LogManager;
Expand All @@ -7,13 +27,26 @@
import thaumcraft.api.research.ResearchEvent;
import thecodex6824.thaumcraftfix.api.ThaumcraftFixApi;

/**
* This event is fired on the <strong>client side only</strong> when a player completes a research stage.
* <p>
* Unlike {@link thaumcraft.api.research.ResearchEvent.Research ResearchEvent.Research}, this event
* will always fire on the client, even outside of singleplayer. Note that because this event inherits
* <code>ResearchEvent.Research</code>, event handlers listening for that event will also receive this one.
*/
public class PlayerGainResearchEventClient extends ResearchEvent.Research {

private static final String CANCEL_LOG_TEXT =
"Something tried to cancel a client-side research event (added by ThaumcraftFix)." + System.lineSeparator()
+ "This is unsupported, but will only be a no-op instead of crashing the game." + System.lineSeparator()
+ "To silence this warning, make sure that the event trying to be canceled is a server-side event, where canceling actually does things.";

/**
* Creates a new <code>PlayerGainResearchEventClient</code>.
* @param player The {@link net.minecraft.entity.player.EntityPlayer EntityPlayer} receiving the research.
* Since this is the client event, this will always be the local player.
* @param researchKey The key of the research awarded
*/
public PlayerGainResearchEventClient(EntityPlayer player, String researchKey) {
super(player, researchKey);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
/**
* Thaumcraft Fix
* Copyright (c) 2024 TheCodex6824.
*
* This file is part of Thaumcraft Fix.
*
* Thaumcraft Fix is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Thaumcraft Fix is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Thaumcraft Fix. If not, see <https://www.gnu.org/licenses/>.
*/

package thecodex6824.thaumcraftfix.api.internal;

import java.util.Set;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,42 @@
/**
* Thaumcraft Fix
* Copyright (c) 2024 TheCodex6824.
*
* This file is part of Thaumcraft Fix.
*
* Thaumcraft Fix is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Thaumcraft Fix is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Thaumcraft Fix. If not, see <https://www.gnu.org/licenses/>.
*/

package thecodex6824.thaumcraftfix.api.research;

import java.util.Set;

import thaumcraft.api.research.ResearchCategory;
import thecodex6824.thaumcraftfix.api.internal.ThaumcraftFixApiBridge;

/**
* Public API for the research category filter in the research table.
* This filter, by default, will make it impossible for research cards from
* Thaumcraft and other compliant mods to give knowledge points in research categories.
*/
public class ResearchCategoryTheorycraftFilter {

/**
* Returns the {@link java.util.Set Set} of categories that <strong>will</strong> be permitted to appear in
* theorycrafting cards. The returned <code>Set</code> is not required to be modifiable.
* @return The <code>Set</code> of allowed research categories
*/
public static Set<ResearchCategory> getAllowedTheorycraftCategories() {
return ThaumcraftFixApiBridge.implementation().getAllowedTheorycraftCategories();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
/**
* Thaumcraft Fix
* Copyright (c) 2024 TheCodex6824.
*
* This file is part of Thaumcraft Fix.
*
* Thaumcraft Fix is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Thaumcraft Fix is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Thaumcraft Fix. If not, see <https://www.gnu.org/licenses/>.
*/

package thecodex6824.thaumcraftfix.client;

import java.util.Random;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
/**
* Thaumcraft Fix
* Copyright (c) 2024 TheCodex6824.
*
* This file is part of Thaumcraft Fix.
*
* Thaumcraft Fix is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Thaumcraft Fix is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Thaumcraft Fix. If not, see <https://www.gnu.org/licenses/>.
*/

package thecodex6824.thaumcraftfix.common.internal;

import java.util.Set;
Expand Down
Loading

0 comments on commit 976b738

Please sign in to comment.