Fix spelling, grammar, javadocs, and similar issues (#2784)

* fix naming in ModelSantaHat.java

* Fix grammar, spelling, and javadocs in RebornCore

* Fix spelling error in datagen

* fix missed variable name

* fix grammar, spelling, and javadoc errors

* fix grammar and spelling errors in project files

* specify indent_size in .editorconfig
This commit is contained in:
Foo 2022-02-06 05:14:56 -08:00 committed by GitHub
parent bd971c12bd
commit 43c0fa9e89
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
138 changed files with 1007 additions and 924 deletions

View file

@ -3,6 +3,7 @@ root = true
[*] [*]
charset = utf-8 charset = utf-8
tab_width = 4 tab_width = 4
indent_size = 4
[*.java] [*.java]
indent_style = tab indent_style = tab

View file

@ -1,8 +1,8 @@
First of all, thank you for you efforts in contributing to TechReborn project First of all, thank you for your efforts in contributing to TechReborn project
In order to ease code review of your pull request, please, go through this checklist. In order to ease code review of your pull request, please, go through this checklist.
* The code compiles )). * The code compiles.
* The code has been developer-tested. * The code has been developer-tested.
* The code includes javadoc where appropriate. * The code includes javadoc where appropriate.
* The code is tidy (indentation, line length, no commented-out code, no spelling mistakes, etc). * The code is tidy (indentation, line length, no commented-out code, no spelling mistakes, etc).
@ -15,5 +15,3 @@ In order to ease code review of your pull request, please, go through this check
* Are there any hardcoded, development only things still in the code? * Are there any hardcoded, development only things still in the code?
* Was performance considered? * Was performance considered?
* Corner cases well documented or any workarounds for a known limitation of the MC, Fabric, RC, etc used. * Corner cases well documented or any workarounds for a known limitation of the MC, Fabric, RC, etc used.

View file

@ -21,7 +21,7 @@ To report an issue or make a suggestion, please head up to the `Issues` tab up a
# Translation # Translation
Techreborn is available in a range of diffrent languages, if you want to help out translate the mod please see our crowdin project at [https://translate.techreborn.ovh/](https://translate.techreborn.ovh/) The translations are automaticly included in the jar files at build time. Techreborn is available in a range of different languages, if you want to help out translate the mod please see our crowdin project at [https://translate.techreborn.ovh/](https://translate.techreborn.ovh/) The translations are automatically included in the jar files at build time.
# Screenshots # Screenshots

View file

@ -25,11 +25,12 @@
package io.github.cottonmc.libcd.api; package io.github.cottonmc.libcd.api;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.recipe.Recipe;
import java.util.Collection; import java.util.Collection;
/** /**
* A recipe that has output behavior that cannot be described by just the Recipe#getOutput() method. * A recipe that has output behavior that cannot be described by just the {@link Recipe#getOutput()} method.
* Used for RecipeTweaker remove-by-output code. * Used for RecipeTweaker remove-by-output code.
*/ */
public interface CustomOutputRecipe { public interface CustomOutputRecipe {

View file

@ -33,8 +33,8 @@ import net.fabricmc.fabric.api.event.world.WorldTickCallback;
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidStorage; import net.fabricmc.fabric.api.transfer.v1.fluid.FluidStorage;
import net.fabricmc.loader.api.FabricLoader; import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import reborncore.api.ToolManager; import reborncore.api.ToolManager;
import reborncore.api.blockentity.UnloadHandler; import reborncore.api.blockentity.UnloadHandler;
import reborncore.common.RebornCoreCommands; import reborncore.common.RebornCoreCommands;
@ -77,7 +77,7 @@ public class RebornCore implements ModInitializer {
public void onInitialize() { public void onInitialize() {
new Configuration(RebornCoreConfig.class, MOD_ID); new Configuration(RebornCoreConfig.class, MOD_ID);
PowerSystem.init(); PowerSystem.init();
CalenderUtils.loadCalender(); //Done early as some features need this CalenderUtils.loadCalender(); // Done early as some features need this
ToolManager.INSTANCE.customToolHandlerList.add(new GenericWrenchHelper(new Identifier("ic2:wrench"), true)); ToolManager.INSTANCE.customToolHandlerList.add(new GenericWrenchHelper(new Identifier("ic2:wrench"), true));
ToolManager.INSTANCE.customToolHandlerList.add(new GenericWrenchHelper(new Identifier("forestry:wrench"), false)); ToolManager.INSTANCE.customToolHandlerList.add(new GenericWrenchHelper(new Identifier("forestry:wrench"), false));

View file

@ -44,11 +44,11 @@ public class RebornRegistry {
private static final HashMap<Object, Identifier> objIdentMap = new HashMap<>(); private static final HashMap<Object, Identifier> objIdentMap = new HashMap<>();
/** /**
* Registers Block and BlockItem in vanilla registries * Registers {@link Block} and {@link BlockItem} in vanilla registries
* *
* @param block Block Block to register * @param block {@link Block} Block to register
* @param builder Item.Settings Settings builder for BlockItem * @param builder {@link Item.Settings} Settings builder for {@link BlockItem}
* @param name Identifier Registry name for block and item * @param name {@link Identifier} Registry name for block and item
*/ */
public static void registerBlock(Block block, Item.Settings builder, Identifier name) { public static void registerBlock(Block block, Item.Settings builder, Identifier name) {
Registry.register(Registry.BLOCK, name, block); Registry.register(Registry.BLOCK, name, block);
@ -63,11 +63,11 @@ public class RebornRegistry {
} }
/** /**
* Registers Block and BlockItem in vanilla registries. * Registers Block and BlockItem in vanilla registries.
* Block should have registered identifier in RebornRegistry via {@link #registerIdent registerIdent} method * Block should have registered identifier in RebornRegistry via {@link #registerIdent registerIdent} method
* *
* @param block Block Block to register * @param block {@link Block} Block to register
* @param itemGroup Item.Settings Settings builder for BlockItem * @param itemGroup {@link Item.Settings} Settings builder for {@link BlockItem}
*/ */
public static void registerBlock(Block block, Item.Settings itemGroup) { public static void registerBlock(Block block, Item.Settings itemGroup) {
Validate.isTrue(objIdentMap.containsKey(block)); Validate.isTrue(objIdentMap.containsKey(block));
@ -80,9 +80,11 @@ public class RebornRegistry {
} }
/** /**
* Register only Block, without BlockItem in vanilla registries * Register only {@link Block}, without {@link BlockItem} in vanilla registries
* Block should have registered identifier in RebornRegistry via {@link #registerIdent registerIdent} method * Block should have registered identifier in {@link RebornRegistry} via
* @param block Block Block to register * {@link #registerIdent registerIdent} method
*
* @param block {@link Block} Block to register
*/ */
public static void registerBlockNoItem(Block block) { public static void registerBlockNoItem(Block block) {
Validate.isTrue(objIdentMap.containsKey(block)); Validate.isTrue(objIdentMap.containsKey(block));
@ -91,20 +93,23 @@ public class RebornRegistry {
/** /**
* Register Item in vanilla registries * Register {@link Item} in vanilla registries
* *
* @param item Item Item to register * @param item {@link Item} Item to register
* @param name Identifier Registry name for item * @param name {@link Identifier} Registry name for item
*/ */
public static void registerItem(Item item, Identifier name) { public static void registerItem(Item item, Identifier name) {
Registry.register(Registry.ITEM, name, item); Registry.register(Registry.ITEM, name, item);
} }
/** /**
* Register Item in vanilla registries * <p>Register {@link Item} in vanilla registries</p>
* Item should have registered identifier in RebornRegistry via {@link #registerIdent registerIdent} method * <p>
* {@link Item} should have registered identifier in {@link RebornRegistry}
* via {@link #registerIdent registerIdent} method
* </p>
* *
* @param item Item Item to register * @param item {@link Item} Item to register
*/ */
public static void registerItem(Item item){ public static void registerItem(Item item){
Validate.isTrue(objIdentMap.containsKey(item)); Validate.isTrue(objIdentMap.containsKey(item));
@ -112,10 +117,10 @@ public class RebornRegistry {
} }
/** /**
* Registers Identifier in internal RebornCore map * Registers {@link Identifier} in internal RebornCore map
* *
* @param object Object Item, Block or whatever to be put into map * @param object {@link Object}, {@link Item}, {@link Block} or whatever to be put into map
* @param identifier Identifier Registry name for object * @param identifier {@link Identifier} Registry name for object
*/ */
public static void registerIdent(Object object, Identifier identifier){ public static void registerIdent(Object object, Identifier identifier){
objIdentMap.put(object, identifier); objIdentMap.put(object, identifier);

View file

@ -36,15 +36,16 @@ import net.minecraft.world.World;
public interface IToolHandler { public interface IToolHandler {
/** /**
* Called when a machine is actived with the item that has IToolHandler on it * Called when a machine is activated with the item that has {@link IToolHandler} on it
* *
* @param stack the held itemstack * @param stack {@link ItemStack} The held itemstack
* @param pos the pos of the block * @param pos {@link BlockPos} The pos of the block
* @param world the world of the block * @param world {@link World} The world of the block
* @param player the player that actived the block * @param player {@link PlayerEntity} The player that activated the block
* @param side the side that the player actived * @param side {@link Direction} The side that the player activated
* @param damage if the tool should be damged, or power taken * @param damage {@code boolean} If the tool should be damaged, or power taken
* @return If the tool can handle being actived on the block, return false when the tool is broken or out of power for example. * @return {@code boolean} If the tool can handle being activated on the block,
* return false when the tool is broken or out of power for example.
*/ */
boolean handleTool(ItemStack stack, BlockPos pos, World world, PlayerEntity player, Direction side, boolean damage); boolean handleTool(ItemStack stack, BlockPos pos, World world, PlayerEntity player, Direction side, boolean damage);

View file

@ -33,7 +33,7 @@ public interface IUpgradeable {
return true; return true;
} }
Inventory getUpgradeInvetory(); Inventory getUpgradeInventory();
int getUpgradeSlotCount(); int getUpgradeSlotCount();

View file

@ -41,13 +41,15 @@ public interface ApplyArmorToDamageCallback {
}); });
/** /**
* Apply armor to amount of damage inflicted. Decreases it in most cases unless armor should increase damage inflicted. * <p>Apply armor to amount of damage inflicted.</p>
* Event is called after damage is being reduced by armor already and before damage reduction from enchants. * Decreases it in most cases unless armor should increase damage inflicted.
* *
* @param player PlayerEntity Player being damaged * <p>Event is called after damage is being reduced by armor already and before damage reduction from enchants.</p>
* @param source DamageSource Type of damage *
* @param amount float Current amount of damage * @param player {@link PlayerEntity} Player being damaged
* @return float Amount of damage after reduction * @param source {@link DamageSource} Type of damage
* @param amount {@code float} Current amount of damage
* @return {@code float} Amount of damage after reduction
*/ */
float applyArmorToDamage(PlayerEntity player, DamageSource source, float amount); float applyArmorToDamage(PlayerEntity player, DamageSource source, float amount);
} }

View file

@ -94,7 +94,7 @@ public abstract class InventoryBase implements Inventory {
@Override @Override
public void markDirty() { public void markDirty() {
//Stuff happens in the super methods // Stuff happens in the super methods
} }
@Override @Override

View file

@ -50,7 +50,7 @@ public class ClientChunkManager {
public static void toggleLoadedChunks(BlockPos chunkLoader) { public static void toggleLoadedChunks(BlockPos chunkLoader) {
if (loadedChunks.size() == 0) { if (loadedChunks.size() == 0) {
NetworkManager.sendToServer(ServerBoundPackets.requestChunkloaderChunks(chunkLoader)); NetworkManager.sendToServer(ServerBoundPackets.requestChunkLoaderChunks(chunkLoader));
} else { } else {
loadedChunks.clear(); loadedChunks.clear();
} }

View file

@ -44,7 +44,8 @@ import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
/** /**
* Initially take from https://github.com/JamiesWhiteShirt/developer-mode/tree/experimental-item-render and then ported to 1.15 * Initially taken from https://github.com/JamiesWhiteShirt/developer-mode/tree/experimental-item-render
* and then ported to 1.15
* Thanks 2xsaiko for fixing the lighting + odd issues above * Thanks 2xsaiko for fixing the lighting + odd issues above
*/ */
public class ItemStackRenderer implements HudRenderCallback { public class ItemStackRenderer implements HudRenderCallback {

View file

@ -40,151 +40,151 @@ import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
public class ModelSantaHat extends EntityModel<AbstractClientPlayerEntity> { public class ModelSantaHat extends EntityModel<AbstractClientPlayerEntity> {
private final ModelPart hatband1; private final ModelPart hatBand1;
private final ModelPart hatband2; private final ModelPart hatBand2;
private final ModelPart hatband3; private final ModelPart hatBand3;
private final ModelPart hatband4; private final ModelPart hatBand4;
private final ModelPart hatbase1; private final ModelPart hatBase1;
private final ModelPart hatband5; private final ModelPart hatBand5;
private final ModelPart hatband6; private final ModelPart hatBand6;
private final ModelPart hatbase2; private final ModelPart hatBase2;
private final ModelPart hatextension1; private final ModelPart hatExtension1;
private final ModelPart hatextension2; private final ModelPart hatExtension2;
private final ModelPart hatextension3; private final ModelPart hatExtension3;
private final ModelPart hatextension4; private final ModelPart hatExtension4;
private final ModelPart hatball1; private final ModelPart hatBall1;
private final ModelPart hatball2; private final ModelPart hatBall2;
private final ModelPart hatball3; private final ModelPart hatBall3;
private final ModelPart hatball4; private final ModelPart hatBall4;
private final ModelPart hatball5; private final ModelPart hatBall5;
private final ModelPart hatball6; private final ModelPart hatBall6;
public ModelSantaHat() { public ModelSantaHat() {
ModelPart.Cuboid[] hatband1Cuboids = { ModelPart.Cuboid[] hatBand1Cuboids = {
new ModelPart.Cuboid(0, 32, -4F, -8F, -5F, 8F, 1F, 1F, 0F, 0F, 0F, true, 64F, 64F) new ModelPart.Cuboid(0, 32, -4F, -8F, -5F, 8F, 1F, 1F, 0F, 0F, 0F, true, 64F, 64F)
}; };
hatband1 = new ModelPart(Arrays.asList(hatband1Cuboids), Collections.emptyMap()); hatBand1 = new ModelPart(Arrays.asList(hatBand1Cuboids), Collections.emptyMap());
hatband1.setPivot(0F, 0F, 0F); hatBand1.setPivot(0F, 0F, 0F);
setRotation(hatband1, 0F, 0F, 0F); setRotation(hatBand1, 0F, 0F, 0F);
ModelPart.Cuboid[] hatband2Cuboids = { ModelPart.Cuboid[] hatBand2Cuboids = {
new ModelPart.Cuboid(0, 32, -4F, -8F, 4F, 8F, 1F, 1F, 0F, 0F, 0F, true, 64F, 64F) new ModelPart.Cuboid(0, 32, -4F, -8F, 4F, 8F, 1F, 1F, 0F, 0F, 0F, true, 64F, 64F)
}; };
hatband2 = new ModelPart(Arrays.asList(hatband2Cuboids), Collections.emptyMap()); hatBand2 = new ModelPart(Arrays.asList(hatBand2Cuboids), Collections.emptyMap());
hatband2.setPivot(0F, 0F, 0F); hatBand2.setPivot(0F, 0F, 0F);
setRotation(hatband2, 0F, 0F, 0F); setRotation(hatBand2, 0F, 0F, 0F);
ModelPart.Cuboid[] hatband3Cuboids = { ModelPart.Cuboid[] hatBand3Cuboids = {
new ModelPart.Cuboid(0, 34, -5F, -8F, -4F, 1F, 1F, 8F, 0F, 0F, 0F, true, 64F, 64F) new ModelPart.Cuboid(0, 34, -5F, -8F, -4F, 1F, 1F, 8F, 0F, 0F, 0F, true, 64F, 64F)
}; };
hatband3 = new ModelPart(Arrays.asList(hatband3Cuboids), Collections.emptyMap()); hatBand3 = new ModelPart(Arrays.asList(hatBand3Cuboids), Collections.emptyMap());
hatband3.setPivot(0F, 0F, 0F); hatBand3.setPivot(0F, 0F, 0F);
setRotation(hatband3, 0F, 0F, 0F); setRotation(hatBand3, 0F, 0F, 0F);
ModelPart.Cuboid[] hatband4Cuboids = { ModelPart.Cuboid[] hatBand4Cuboids = {
new ModelPart.Cuboid(0, 34, 4F, -8F, -4F, 1F, 1F, 8F, 0F, 0F, 0F, true, 64F, 64F) new ModelPart.Cuboid(0, 34, 4F, -8F, -4F, 1F, 1F, 8F, 0F, 0F, 0F, true, 64F, 64F)
}; };
hatband4 = new ModelPart(Arrays.asList(hatband4Cuboids), Collections.emptyMap()); hatBand4 = new ModelPart(Arrays.asList(hatBand4Cuboids), Collections.emptyMap());
hatband4.setPivot(0F, 0F, 0F); hatBand4.setPivot(0F, 0F, 0F);
setRotation(hatband4, 0F, 0F, 0F); setRotation(hatBand4, 0F, 0F, 0F);
ModelPart.Cuboid[] hatbase1Cuboids = { ModelPart.Cuboid[] hatBase1Cuboids = {
new ModelPart.Cuboid(0, 43, -4F, -9F, -4F, 8F, 1F, 8F, 0F, 0F, 0F, true, 64F, 64F) new ModelPart.Cuboid(0, 43, -4F, -9F, -4F, 8F, 1F, 8F, 0F, 0F, 0F, true, 64F, 64F)
}; };
hatbase1 = new ModelPart(Arrays.asList(hatbase1Cuboids), Collections.emptyMap()); hatBase1 = new ModelPart(Arrays.asList(hatBase1Cuboids), Collections.emptyMap());
hatbase1.setPivot(0F, 0F, 0F); hatBase1.setPivot(0F, 0F, 0F);
setRotation(hatbase1, 0F, 0F, 0F); setRotation(hatBase1, 0F, 0F, 0F);
ModelPart.Cuboid[] hatband5Cuboids = { ModelPart.Cuboid[] hatBand5Cuboids = {
new ModelPart.Cuboid(18, 41, 0F, -7F, -5F, 4F, 1F, 1F, 0F, 0F, 0F, true, 64F, 64F) new ModelPart.Cuboid(18, 41, 0F, -7F, -5F, 4F, 1F, 1F, 0F, 0F, 0F, true, 64F, 64F)
}; };
hatband5 = new ModelPart(Arrays.asList(hatband5Cuboids), Collections.emptyMap()); hatBand5 = new ModelPart(Arrays.asList(hatBand5Cuboids), Collections.emptyMap());
hatband5.setPivot(0F, 0F, 0F); hatBand5.setPivot(0F, 0F, 0F);
setRotation(hatband5, 0F, 0F, 0F); setRotation(hatBand5, 0F, 0F, 0F);
ModelPart.Cuboid[] hatband6Cuboids = { ModelPart.Cuboid[] hatBand6Cuboids = {
new ModelPart.Cuboid(18, 41, -4F, -7F, 0F, 4F, 1F, 1F, 0F, 0F, 0F, true, 64F, 64F) new ModelPart.Cuboid(18, 41, -4F, -7F, 0F, 4F, 1F, 1F, 0F, 0F, 0F, true, 64F, 64F)
}; };
hatband6 = new ModelPart(Arrays.asList(hatband6Cuboids), Collections.emptyMap()); hatBand6 = new ModelPart(Arrays.asList(hatBand6Cuboids), Collections.emptyMap());
hatband6.setPivot(0F, 0F, 4F); hatBand6.setPivot(0F, 0F, 4F);
setRotation(hatband6, 0F, 0F, 0F); setRotation(hatBand6, 0F, 0F, 0F);
ModelPart.Cuboid[] hatbase2Cuboids = { ModelPart.Cuboid[] hatBase2Cuboids = {
new ModelPart.Cuboid(18, 34, -3F, -10F, -3F, 6F, 1F, 6F, 0F, 0F, 0F, true, 64F, 64F) new ModelPart.Cuboid(18, 34, -3F, -10F, -3F, 6F, 1F, 6F, 0F, 0F, 0F, true, 64F, 64F)
}; };
hatbase2 = new ModelPart(Arrays.asList(hatbase2Cuboids), Collections.emptyMap()); hatBase2 = new ModelPart(Arrays.asList(hatBase2Cuboids), Collections.emptyMap());
hatbase2.setPivot(0F, 0F, 0F); hatBase2.setPivot(0F, 0F, 0F);
setRotation(hatbase2, 0F, 0.1115358F, 0F); setRotation(hatBase2, 0F, 0.1115358F, 0F);
ModelPart.Cuboid[] hatextension1Cuboids = { ModelPart.Cuboid[] hatExtension1Cuboids = {
new ModelPart.Cuboid(0, 52, -3F, -11F, -2F, 4F, 2F, 4F, 0F, 0F, 0F, true, 64F, 64F) new ModelPart.Cuboid(0, 52, -3F, -11F, -2F, 4F, 2F, 4F, 0F, 0F, 0F, true, 64F, 64F)
}; };
hatextension1 = new ModelPart(Arrays.asList(hatextension1Cuboids), Collections.emptyMap()); hatExtension1 = new ModelPart(Arrays.asList(hatExtension1Cuboids), Collections.emptyMap());
hatextension1.setPivot(0F, 0F, 0F); hatExtension1.setPivot(0F, 0F, 0F);
setRotation(hatextension1, 0F, -0.0371786F, 0.0743572F); setRotation(hatExtension1, 0F, -0.0371786F, 0.0743572F);
ModelPart.Cuboid[] hatextension2Cuboids = { ModelPart.Cuboid[] hatExtension2Cuboids = {
new ModelPart.Cuboid(16, 52, -2.4F, -12F, -1.5F, 3F, 2F, 3F, 0F, 0F, 0F, true, 64F, 64F) new ModelPart.Cuboid(16, 52, -2.4F, -12F, -1.5F, 3F, 2F, 3F, 0F, 0F, 0F, true, 64F, 64F)
}; };
hatextension2 = new ModelPart(Arrays.asList(hatextension2Cuboids), Collections.emptyMap()); hatExtension2 = new ModelPart(Arrays.asList(hatExtension2Cuboids), Collections.emptyMap());
hatextension2.setPivot(0F, 0F, 0F); hatExtension2.setPivot(0F, 0F, 0F);
setRotation(hatextension2, 0F, 0.0743572F, 0.0743572F); setRotation(hatExtension2, 0F, 0.0743572F, 0.0743572F);
ModelPart.Cuboid[] hatextension3Cuboids = { ModelPart.Cuboid[] hatExtension3Cuboids = {
new ModelPart.Cuboid(28, 52, -3.5F, -13F, -1F, 2F, 2F, 2F, 0F, 0F, 0F, true, 64F, 64F) new ModelPart.Cuboid(28, 52, -3.5F, -13F, -1F, 2F, 2F, 2F, 0F, 0F, 0F, true, 64F, 64F)
}; };
hatextension3 = new ModelPart(Arrays.asList(hatextension3Cuboids), Collections.emptyMap()); hatExtension3 = new ModelPart(Arrays.asList(hatExtension3Cuboids), Collections.emptyMap());
hatextension3.setPivot(0F, 0F, 0F); hatExtension3.setPivot(0F, 0F, 0F);
setRotation(hatextension3, 0F, 0F, 0.2230717F); setRotation(hatExtension3, 0F, 0F, 0.2230717F);
ModelPart.Cuboid[] hatextension4Cuboids = { ModelPart.Cuboid[] hatExtension4Cuboids = {
new ModelPart.Cuboid(0, 58, -13F, -6.6F, -1F, 2F, 3F, 2F, 0F, 0F, 0F, true, 64F, 64F) new ModelPart.Cuboid(0, 58, -13F, -6.6F, -1F, 2F, 3F, 2F, 0F, 0F, 0F, true, 64F, 64F)
}; };
hatextension4 = new ModelPart(Arrays.asList(hatextension4Cuboids), Collections.emptyMap()); hatExtension4 = new ModelPart(Arrays.asList(hatExtension4Cuboids), Collections.emptyMap());
hatextension4.setPivot(0F, 0F, 0F); hatExtension4.setPivot(0F, 0F, 0F);
setRotation(hatextension4, 0F, 0F, 1.264073F); setRotation(hatExtension4, 0F, 0F, 1.264073F);
ModelPart.Cuboid[] hatball1Cuboids = { ModelPart.Cuboid[] hatBall1Cuboids = {
new ModelPart.Cuboid(8, 58, 2F, -14.4F, -1.001F, 2F, 2F, 2F, 0F, 0F, 0F, true, 64F, 64F) new ModelPart.Cuboid(8, 58, 2F, -14.4F, -1.001F, 2F, 2F, 2F, 0F, 0F, 0F, true, 64F, 64F)
}; };
hatball1 = new ModelPart(Arrays.asList(hatball1Cuboids), Collections.emptyMap()); hatBall1 = new ModelPart(Arrays.asList(hatBall1Cuboids), Collections.emptyMap());
hatball1.setPivot(0F, 0F, 0F); hatBall1.setPivot(0F, 0F, 0F);
setRotation(hatball1, 0F, 0F, 0F); setRotation(hatBall1, 0F, 0F, 0F);
ModelPart.Cuboid[] hatball2Cuboids = { ModelPart.Cuboid[] hatBall2Cuboids = {
new ModelPart.Cuboid(16, 57, 2.5F, -14.8F, -0.5F, 1F, 1F, 1F, 0F, 0F, 0F, true, 64F, 64F) new ModelPart.Cuboid(16, 57, 2.5F, -14.8F, -0.5F, 1F, 1F, 1F, 0F, 0F, 0F, true, 64F, 64F)
}; };
hatball2 = new ModelPart(Arrays.asList(hatball2Cuboids), Collections.emptyMap()); hatBall2 = new ModelPart(Arrays.asList(hatBall2Cuboids), Collections.emptyMap());
hatball2.setPivot(0F, 0F, 0F); hatBall2.setPivot(0F, 0F, 0F);
setRotation(hatball2, 0F, 0F, 0F); setRotation(hatBall2, 0F, 0F, 0F);
ModelPart.Cuboid[] hatball3Cuboids = { ModelPart.Cuboid[] hatBall3Cuboids = {
new ModelPart.Cuboid(16, 57, 2.5F, -13F, -0.5F, 1F, 1F, 1F, 0F, 0F, 0F, true, 64F, 64F) new ModelPart.Cuboid(16, 57, 2.5F, -13F, -0.5F, 1F, 1F, 1F, 0F, 0F, 0F, true, 64F, 64F)
}; };
hatball3 = new ModelPart(Arrays.asList(hatball3Cuboids), Collections.emptyMap()); hatBall3 = new ModelPart(Arrays.asList(hatBall3Cuboids), Collections.emptyMap());
hatball3.setPivot(0F, 0F, 0F); hatBall3.setPivot(0F, 0F, 0F);
setRotation(hatball3, 0F, 0F, 0F); setRotation(hatBall3, 0F, 0F, 0F);
ModelPart.Cuboid[] hatball4Cuboids = { ModelPart.Cuboid[] hatBall4Cuboids = {
new ModelPart.Cuboid(16, 57, 3.4F, -14F, -0.5F, 1F, 1F, 1F, 0F, 0F, 0F, true, 64F, 64F) new ModelPart.Cuboid(16, 57, 3.4F, -14F, -0.5F, 1F, 1F, 1F, 0F, 0F, 0F, true, 64F, 64F)
}; };
hatball4 = new ModelPart(Arrays.asList(hatball4Cuboids), Collections.emptyMap()); hatBall4 = new ModelPart(Arrays.asList(hatBall4Cuboids), Collections.emptyMap());
hatball4.setPivot(0F, 0F, 0F); hatBall4.setPivot(0F, 0F, 0F);
setRotation(hatball4, 0F, 0F, 0F); setRotation(hatBall4, 0F, 0F, 0F);
ModelPart.Cuboid[] hatball5Cuboids = { ModelPart.Cuboid[] hatBall5Cuboids = {
new ModelPart.Cuboid(16, 57, 2.5F, -14F, 0.4F, 1F, 1F, 1F, 0F, 0F, 0F, true, 64F, 64F) new ModelPart.Cuboid(16, 57, 2.5F, -14F, 0.4F, 1F, 1F, 1F, 0F, 0F, 0F, true, 64F, 64F)
}; };
hatball5 = new ModelPart(Arrays.asList(hatball5Cuboids), Collections.emptyMap()); hatBall5 = new ModelPart(Arrays.asList(hatBall5Cuboids), Collections.emptyMap());
hatball5.setPivot(0F, 0F, 0F); hatBall5.setPivot(0F, 0F, 0F);
setRotation(hatball5, 0F, 0F, 0F); setRotation(hatBall5, 0F, 0F, 0F);
ModelPart.Cuboid[] hatball6Cuboids = { ModelPart.Cuboid[] hatBall6Cuboids = {
new ModelPart.Cuboid(16, 57, 2.5F, -14F, -1.4F, 1F, 1F, 1F, 0F, 0F, 0F, true, 64F, 64F) new ModelPart.Cuboid(16, 57, 2.5F, -14F, -1.4F, 1F, 1F, 1F, 0F, 0F, 0F, true, 64F, 64F)
}; };
hatball6 = new ModelPart(Arrays.asList(hatball6Cuboids), Collections.emptyMap()); hatBall6 = new ModelPart(Arrays.asList(hatBall6Cuboids), Collections.emptyMap());
hatball6.setPivot(0F, 0F, 0F); hatBall6.setPivot(0F, 0F, 0F);
setRotation(hatball6, 0F, 0F, 0F); setRotation(hatBall6, 0F, 0F, 0F);
} }
@Override @Override
@ -194,24 +194,24 @@ public class ModelSantaHat extends EntityModel<AbstractClientPlayerEntity> {
@Override @Override
public void render(MatrixStack matrixStack, VertexConsumer vertexConsumer, int light, int overlay, float r, float g, float b, float f) { public void render(MatrixStack matrixStack, VertexConsumer vertexConsumer, int light, int overlay, float r, float g, float b, float f) {
hatband1.render(matrixStack, vertexConsumer, light, overlay); hatBand1.render(matrixStack, vertexConsumer, light, overlay);
hatband2.render(matrixStack, vertexConsumer, light, overlay); hatBand2.render(matrixStack, vertexConsumer, light, overlay);
hatband3.render(matrixStack, vertexConsumer, light, overlay); hatBand3.render(matrixStack, vertexConsumer, light, overlay);
hatband4.render(matrixStack, vertexConsumer, light, overlay); hatBand4.render(matrixStack, vertexConsumer, light, overlay);
hatbase1.render(matrixStack, vertexConsumer, light, overlay); hatBase1.render(matrixStack, vertexConsumer, light, overlay);
hatband5.render(matrixStack, vertexConsumer, light, overlay); hatBand5.render(matrixStack, vertexConsumer, light, overlay);
hatband6.render(matrixStack, vertexConsumer, light, overlay); hatBand6.render(matrixStack, vertexConsumer, light, overlay);
hatbase2.render(matrixStack, vertexConsumer, light, overlay); hatBase2.render(matrixStack, vertexConsumer, light, overlay);
hatextension1.render(matrixStack, vertexConsumer, light, overlay); hatExtension1.render(matrixStack, vertexConsumer, light, overlay);
hatextension2.render(matrixStack, vertexConsumer, light, overlay); hatExtension2.render(matrixStack, vertexConsumer, light, overlay);
hatextension3.render(matrixStack, vertexConsumer, light, overlay); hatExtension3.render(matrixStack, vertexConsumer, light, overlay);
hatextension4.render(matrixStack, vertexConsumer, light, overlay); hatExtension4.render(matrixStack, vertexConsumer, light, overlay);
hatball1.render(matrixStack, vertexConsumer, light, overlay); hatBall1.render(matrixStack, vertexConsumer, light, overlay);
hatball2.render(matrixStack, vertexConsumer, light, overlay); hatBall2.render(matrixStack, vertexConsumer, light, overlay);
hatball3.render(matrixStack, vertexConsumer, light, overlay); hatBall3.render(matrixStack, vertexConsumer, light, overlay);
hatball4.render(matrixStack, vertexConsumer, light, overlay); hatBall4.render(matrixStack, vertexConsumer, light, overlay);
hatball5.render(matrixStack, vertexConsumer, light, overlay); hatBall5.render(matrixStack, vertexConsumer, light, overlay);
hatball6.render(matrixStack, vertexConsumer, light, overlay); hatBall6.render(matrixStack, vertexConsumer, light, overlay);
} }
private void setRotation(ModelPart model, float x, float y, float z) { private void setRotation(ModelPart model, float x, float y, float z) {

View file

@ -37,10 +37,10 @@ import reborncore.common.util.Color;
public class GuiButtonCustomTexture extends ButtonWidget { public class GuiButtonCustomTexture extends ButtonWidget {
public int textureU; public int textureU;
public int textureV; public int textureV;
public String texturename; public String textureName;
public String linkedPage; public String linkedPage;
public Text name; public Text name;
public String imageprefix = "techreborn:textures/manual/elements/"; public String imagePrefix = "techreborn:textures/manual/elements/";
public int buttonHeight; public int buttonHeight;
public int buttonWidth; public int buttonWidth;
public int buttonU; public int buttonU;
@ -49,11 +49,11 @@ public class GuiButtonCustomTexture extends ButtonWidget {
public int textureW; public int textureW;
public GuiButtonCustomTexture(int xPos, int yPos, int u, int v, int buttonWidth, int buttonHeight, public GuiButtonCustomTexture(int xPos, int yPos, int u, int v, int buttonWidth, int buttonHeight,
String texturename, String linkedPage, Text name, int buttonU, int buttonV, int textureH, int textureW, ButtonWidget.PressAction pressAction) { String textureName, String linkedPage, Text name, int buttonU, int buttonV, int textureH, int textureW, ButtonWidget.PressAction pressAction) {
super(xPos, yPos, buttonWidth, buttonHeight, LiteralText.EMPTY, pressAction); super(xPos, yPos, buttonWidth, buttonHeight, LiteralText.EMPTY, pressAction);
this.textureU = u; this.textureU = u;
this.textureV = v; this.textureV = v;
this.texturename = texturename; this.textureName = textureName;
this.name = name; this.name = name;
this.linkedPage = linkedPage; this.linkedPage = linkedPage;
this.buttonHeight = height; this.buttonHeight = height;
@ -87,7 +87,7 @@ public class GuiButtonCustomTexture extends ButtonWidget {
} }
public void renderImage(MatrixStack matrixStack, int offsetX, int offsetY) { public void renderImage(MatrixStack matrixStack, int offsetX, int offsetY) {
RenderSystem.setShaderTexture(0, new Identifier(imageprefix + this.texturename + ".png")); RenderSystem.setShaderTexture(0, new Identifier(imagePrefix + this.textureName + ".png"));
RenderSystem.enableBlend(); RenderSystem.enableBlend();
RenderSystem.blendFunc(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA); RenderSystem.blendFunc(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA);

View file

@ -389,13 +389,13 @@ public class GuiBase<T extends ScreenHandler> extends HandledScreen<T> {
} }
/** /**
* @param rectX int Top left corner of region * @param rectX {@code int} Top left corner of region
* @param rectY int Top left corner of region * @param rectY {@code int} Top left corner of region
* @param rectWidth int Width of region * @param rectWidth {@code int} Width of region
* @param rectHeight int Height of region * @param rectHeight {@code int} Height of region
* @param pointX int Mouse pointer * @param pointX {@code int} Mouse pointer
* @param pointY int Mouse pointer * @param pointY {@code int} Mouse pointer
* @return boolean Returns true if mouse pointer is in region specified * @return {@code boolean} Returns true if mouse pointer is in region specified
*/ */
public boolean isPointInRect(int rectX, int rectY, int rectWidth, int rectHeight, double pointX, double pointY) { public boolean isPointInRect(int rectX, int rectY, int rectWidth, int rectHeight, double pointX, double pointY) {
return super.isPointWithinBounds(rectX, rectY, rectWidth, rectHeight, pointX, pointY); return super.isPointWithinBounds(rectX, rectY, rectWidth, rectHeight, pointX, pointY);
@ -422,7 +422,7 @@ public class GuiBase<T extends ScreenHandler> extends HandledScreen<T> {
} }
public MinecraftClient getMinecraft() { public MinecraftClient getMinecraft() {
// Just to stop complains from IDEA // Just to stop complaints from IDEA
if (client == null) { if (client == null) {
throw new NullPointerException("Minecraft client is null."); throw new NullPointerException("Minecraft client is null.");
} }
@ -454,7 +454,7 @@ public class GuiBase<T extends ScreenHandler> extends HandledScreen<T> {
@Override @Override
protected boolean isClickOutsideBounds(double mouseX, double mouseY, int left, int top, int mouseButton) { protected boolean isClickOutsideBounds(double mouseX, double mouseY, int left, int top, int mouseButton) {
// Upgrades are normally outside of the bounds, so let's pretend we are within the bounds if there is a slot here. // Upgrades are normally outside the bounds, so let's pretend we are within the bounds if there is a slot here.
return getSlotAt(mouseX, mouseY) == null && super.isClickOutsideBounds(mouseX, mouseY, left, top, mouseButton); return getSlotAt(mouseX, mouseY) == null && super.isClickOutsideBounds(mouseX, mouseY, left, top, mouseButton);
} }

View file

@ -109,7 +109,7 @@ public class SlotConfigGui {
} }
String json = machine.getSlotConfiguration().toJson(machine.getClass().getCanonicalName()); String json = machine.getSlotConfiguration().toJson(machine.getClass().getCanonicalName());
MinecraftClient.getInstance().keyboard.setClipboard(json); MinecraftClient.getInstance().keyboard.setClipboard(json);
MinecraftClient.getInstance().player.sendSystemMessage(new LiteralText("Slot configuration copyied to clipboard"), Util.NIL_UUID); MinecraftClient.getInstance().player.sendSystemMessage(new LiteralText("Slot configuration copied to clipboard"), Util.NIL_UUID);
} }
public static void pasteFromClipboard() { public static void pasteFromClipboard() {

View file

@ -55,7 +55,7 @@ public class FluidConfigPopupElement extends ElementBase {
public boolean filter = false; public boolean filter = false;
ConfigFluidElement fluidElement; ConfigFluidElement fluidElement;
double lastMousex, lastMousey; double lastMouseX, lastMouseY;
public FluidConfigPopupElement(int x, int y, ConfigFluidElement fluidElement) { public FluidConfigPopupElement(int x, int y, ConfigFluidElement fluidElement) {
super(x, y, Sprite.SLOT_CONFIG_POPUP); super(x, y, Sprite.SLOT_CONFIG_POPUP);
@ -93,24 +93,24 @@ public class FluidConfigPopupElement extends ElementBase {
@Override @Override
public boolean onRelease(MachineBaseBlockEntity provider, GuiBase<?> gui, double mouseX, double mouseY) { public boolean onRelease(MachineBaseBlockEntity provider, GuiBase<?> gui, double mouseX, double mouseY) {
if (isInBox(23, 4, 16, 16, mouseX, mouseY, gui)) { if (isInBox(23, 4, 16, 16, mouseX, mouseY, gui)) {
cyleConfig(MachineFacing.UP.getFacing(provider), gui); cycleConfig(MachineFacing.UP.getFacing(provider), gui);
} else if (isInBox(23, 23, 16, 16, mouseX, mouseY, gui)) { } else if (isInBox(23, 23, 16, 16, mouseX, mouseY, gui)) {
cyleConfig(MachineFacing.FRONT.getFacing(provider), gui); cycleConfig(MachineFacing.FRONT.getFacing(provider), gui);
} else if (isInBox(42, 23, 16, 16, mouseX, mouseY, gui)) { } else if (isInBox(42, 23, 16, 16, mouseX, mouseY, gui)) {
cyleConfig(MachineFacing.RIGHT.getFacing(provider), gui); cycleConfig(MachineFacing.RIGHT.getFacing(provider), gui);
} else if (isInBox(4, 23, 16, 16, mouseX, mouseY, gui)) { } else if (isInBox(4, 23, 16, 16, mouseX, mouseY, gui)) {
cyleConfig(MachineFacing.LEFT.getFacing(provider), gui); cycleConfig(MachineFacing.LEFT.getFacing(provider), gui);
} else if (isInBox(23, 42, 16, 16, mouseX, mouseY, gui)) { } else if (isInBox(23, 42, 16, 16, mouseX, mouseY, gui)) {
cyleConfig(MachineFacing.DOWN.getFacing(provider), gui); cycleConfig(MachineFacing.DOWN.getFacing(provider), gui);
} else if (isInBox(42, 42, 16, 16, mouseX, mouseY, gui)) { } else if (isInBox(42, 42, 16, 16, mouseX, mouseY, gui)) {
cyleConfig(MachineFacing.BACK.getFacing(provider), gui); cycleConfig(MachineFacing.BACK.getFacing(provider), gui);
} else { } else {
return false; return false;
} }
return true; return true;
} }
public void cyleConfig(Direction side, GuiBase<?> guiBase) { public void cycleConfig(Direction side, GuiBase<?> guiBase) {
FluidConfiguration.FluidConfig config = guiBase.getMachine().fluidConfiguration.getSideDetail(side); FluidConfiguration.FluidConfig config = guiBase.getMachine().fluidConfiguration.getSideDetail(side);
FluidConfiguration.ExtractConfig fluidIO = config.getIoConfig().getNext(); FluidConfiguration.ExtractConfig fluidIO = config.getIoConfig().getNext();
@ -137,8 +137,8 @@ public class FluidConfigPopupElement extends ElementBase {
@Override @Override
public boolean onHover(MachineBaseBlockEntity provider, GuiBase<?> gui, double mouseX, double mouseY) { public boolean onHover(MachineBaseBlockEntity provider, GuiBase<?> gui, double mouseX, double mouseY) {
lastMousex = mouseX; lastMouseX = mouseX;
lastMousey = mouseY; lastMouseY = mouseY;
return super.onHover(provider, gui, mouseX, mouseY); return super.onHover(provider, gui, mouseX, mouseY);
} }
@ -148,7 +148,7 @@ public class FluidConfigPopupElement extends ElementBase {
int sy = iny + getY() + gui.getGuiTop(); int sy = iny + getY() + gui.getGuiTop();
FluidConfiguration fluidConfiguration = machineBase.fluidConfiguration; FluidConfiguration fluidConfiguration = machineBase.fluidConfiguration;
if (fluidConfiguration == null) { if (fluidConfiguration == null) {
RebornCore.LOGGER.debug("Humm, this isnt suppoed to happen"); RebornCore.LOGGER.debug("Hmm, this isn't supposed to happen");
return; return;
} }
FluidConfiguration.FluidConfig fluidConfig = fluidConfiguration.getSideDetail(side); FluidConfiguration.FluidConfig fluidConfig = fluidConfiguration.getSideDetail(side);
@ -197,4 +197,4 @@ public class FluidConfigPopupElement extends ElementBase {
matrixStack.pop(); matrixStack.pop();
} }
} }

View file

@ -97,27 +97,27 @@ public class SlotConfigPopupElement extends ElementBase {
@Override @Override
public boolean onRelease(MachineBaseBlockEntity provider, GuiBase<?> gui, double mouseX, double mouseY) { public boolean onRelease(MachineBaseBlockEntity provider, GuiBase<?> gui, double mouseX, double mouseY) {
if (isInBox(23, 4, 16, 16, mouseX, mouseY, gui)) { if (isInBox(23, 4, 16, 16, mouseX, mouseY, gui)) {
cyleSlotConfig(MachineFacing.UP.getFacing(provider), gui); cycleSlotConfig(MachineFacing.UP.getFacing(provider), gui);
} else if (isInBox(23, 23, 16, 16, mouseX, mouseY, gui)) { } else if (isInBox(23, 23, 16, 16, mouseX, mouseY, gui)) {
cyleSlotConfig(MachineFacing.FRONT.getFacing(provider), gui); cycleSlotConfig(MachineFacing.FRONT.getFacing(provider), gui);
} else if (isInBox(42, 23, 16, 16, mouseX, mouseY, gui)) { } else if (isInBox(42, 23, 16, 16, mouseX, mouseY, gui)) {
cyleSlotConfig(MachineFacing.RIGHT.getFacing(provider), gui); cycleSlotConfig(MachineFacing.RIGHT.getFacing(provider), gui);
} else if (isInBox(4, 23, 16, 16, mouseX, mouseY, gui)) { } else if (isInBox(4, 23, 16, 16, mouseX, mouseY, gui)) {
cyleSlotConfig(MachineFacing.LEFT.getFacing(provider), gui); cycleSlotConfig(MachineFacing.LEFT.getFacing(provider), gui);
} else if (isInBox(23, 42, 16, 16, mouseX, mouseY, gui)) { } else if (isInBox(23, 42, 16, 16, mouseX, mouseY, gui)) {
cyleSlotConfig(MachineFacing.DOWN.getFacing(provider), gui); cycleSlotConfig(MachineFacing.DOWN.getFacing(provider), gui);
} else if (isInBox(42, 42, 16, 16, mouseX, mouseY, gui)) { } else if (isInBox(42, 42, 16, 16, mouseX, mouseY, gui)) {
cyleSlotConfig(MachineFacing.BACK.getFacing(provider), gui); cycleSlotConfig(MachineFacing.BACK.getFacing(provider), gui);
} else { } else {
return false; return false;
} }
return true; return true;
} }
public void cyleSlotConfig(Direction side, GuiBase<?> guiBase) { public void cycleSlotConfig(Direction side, GuiBase<?> guiBase) {
SlotConfiguration.SlotConfig currentSlot = guiBase.getMachine().getSlotConfiguration().getSlotDetails(id).getSideDetail(side); SlotConfiguration.SlotConfig currentSlot = guiBase.getMachine().getSlotConfiguration().getSlotDetails(id).getSideDetail(side);
//Bit of a mess, in the future have a way to remove config options from this list // A bit of a mess, in the future have a way to remove config options from this list
SlotConfiguration.ExtractConfig nextConfig = currentSlot.getSlotIO().getIoConfig().getNext(); SlotConfiguration.ExtractConfig nextConfig = currentSlot.getSlotIO().getIoConfig().getNext();
if (!allowInput && nextConfig == SlotConfiguration.ExtractConfig.INPUT) { if (!allowInput && nextConfig == SlotConfiguration.ExtractConfig.INPUT) {
nextConfig = SlotConfiguration.ExtractConfig.OUTPUT; nextConfig = SlotConfiguration.ExtractConfig.OUTPUT;
@ -154,7 +154,7 @@ public class SlotConfigPopupElement extends ElementBase {
int sy = iny + getY() + gui.getGuiTop(); int sy = iny + getY() + gui.getGuiTop();
SlotConfiguration.SlotConfigHolder slotConfigHolder = machineBase.getSlotConfiguration().getSlotDetails(slotID); SlotConfiguration.SlotConfigHolder slotConfigHolder = machineBase.getSlotConfiguration().getSlotDetails(slotID);
if (slotConfigHolder == null) { if (slotConfigHolder == null) {
RebornCore.LOGGER.debug("Humm, this isnt suppoed to happen"); RebornCore.LOGGER.debug("Hmm, this isn't supposed to happen");
return; return;
} }
SlotConfiguration.SlotConfig slotConfig = slotConfigHolder.getSideDetail(side); SlotConfiguration.SlotConfig slotConfig = slotConfigHolder.getSideDetail(side);
@ -206,4 +206,4 @@ public class SlotConfigPopupElement extends ElementBase {
public void drawState(GuiBase<?> gui, World world, BakedModel model, BlockState actualState, BlockPos pos, BlockRenderManager dispatcher, int x, int y) { public void drawState(GuiBase<?> gui, World world, BakedModel model, BlockState actualState, BlockPos pos, BlockRenderManager dispatcher, int x, int y) {
drawState(gui, world, model, actualState, pos, dispatcher, x, y, null); drawState(gui, world, model, actualState, pos, dispatcher, x, y, null);
} }
} }

View file

@ -47,7 +47,7 @@ public class GuiHiddenButton extends ButtonWidget {
@Override @Override
public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
if (this.visible) { if (this.visible) {
TextRenderer fontrenderer = MinecraftClient.getInstance().textRenderer; TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
RenderSystem.setShaderTexture(0, WIDGETS_TEXTURE); RenderSystem.setShaderTexture(0, WIDGETS_TEXTURE);
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
this.hovered = mouseX >= this.x && mouseY >= this.y this.hovered = mouseX >= this.x && mouseY >= this.y
@ -63,7 +63,7 @@ public class GuiHiddenButton extends ButtonWidget {
l = 16777120; l = 16777120;
} }
this.drawTextWithShadow(matrixStack, fontrenderer, this.getMessage(), this.x + this.width / 2, this.drawTextWithShadow(matrixStack, textRenderer, this.getMessage(), this.x + this.width / 2,
this.y + (this.height - 8) / 2, l); this.y + (this.height - 8) / 2, l);
} }
} }

View file

@ -136,10 +136,10 @@ public class GuiBuilder {
/** /**
* Draws button with JEI icon in the given coords. * Draws button with JEI icon in the given coords.
* *
* @param gui GuiBase GUI to draw on * @param gui {@link GuiBase} The GUI to draw on
* @param x int Top left corner where to place button * @param x {@code int} Top left corner where to place button
* @param y int Top left corner where to place button * @param y {@code int} Top left corner where to place button
* @param layer Layer Layer to draw on * @param layer {@link GuiBase.Layer} The layer to draw on
*/ */
public void drawJEIButton(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, GuiBase.Layer layer) { public void drawJEIButton(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, GuiBase.Layer layer) {
if (gui.hideGuiElements()) return; if (gui.hideGuiElements()) return;
@ -156,13 +156,13 @@ public class GuiBuilder {
/** /**
* Draws lock button in either locked or unlocked state * Draws lock button in either locked or unlocked state
* *
* @param gui GuiBase GUI to draw on * @param gui {@link GuiBase} The GUI to draw on
* @param x int Top left corner where to place button * @param x {@code int} Top left corner where to place button
* @param y int Top left corner where to place button * @param y {@code int} Top left corner where to place button
* @param mouseX int Mouse cursor position to check for tooltip * @param mouseX {@code int} Mouse cursor position to check for tooltip
* @param mouseY int Mouse cursor position to check for tooltip * @param mouseY {@code int} Mouse cursor position to check for tooltip
* @param layer Layer Layer to draw on * @param layer {@link GuiBase.Layer} The layer to draw on
* @param locked boolean Set to true if it is in locked state * @param locked {@code boolean} Set to true if it is in locked state
*/ */
public void drawLockButton(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, int mouseX, int mouseY, GuiBase.Layer layer, boolean locked) { public void drawLockButton(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, int mouseX, int mouseY, GuiBase.Layer layer, boolean locked) {
if (gui.hideGuiElements()) return; if (gui.hideGuiElements()) return;
@ -188,12 +188,12 @@ public class GuiBuilder {
/** /**
* Draws hologram toggle button * Draws hologram toggle button
* *
* @param gui GuiBase GUI to draw on * @param gui {@link GuiBase} The GUI to draw on
* @param x int Top left corner where to place button * @param x {@code int} Top left corner where to place button
* @param y int Top left corner where to place button * @param y {@code int} Top left corner where to place button
* @param mouseX int Mouse cursor position to check for tooltip * @param mouseX {@code int} Mouse cursor position to check for tooltip
* @param mouseY int Mouse cursor position to check for tooltip * @param mouseY {@code int} Mouse cursor position to check for tooltip
* @param layer Layer Layer to draw on * @param layer {@link GuiBase.Layer} The layer to draw on
*/ */
public void drawHologramButton(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, int mouseX, int mouseY, GuiBase.Layer layer) { public void drawHologramButton(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, int mouseX, int mouseY, GuiBase.Layer layer) {
if (gui.isTabOpen()) return; if (gui.isTabOpen()) return;
@ -223,12 +223,12 @@ public class GuiBuilder {
/** /**
* Draws big horizontal bar for heat value * Draws big horizontal bar for heat value
* *
* @param gui GuiBase GUI to draw on * @param gui {@link GuiBase} The GUI to draw on
* @param x int Top left corner where to place bar * @param x {@code int} Top left corner where to place bar
* @param y int Top left corner where to place bar * @param y {@code int} Top left corner where to place bar
* @param value int Current heat value * @param value {@code int} Current heat value
* @param max int Maximum heat value * @param max {@code int} Maximum heat value
* @param layer Layer Layer to draw on * @param layer {@link GuiBase.Layer} The layer to draw on
*/ */
public void drawBigHeatBar(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, int value, int max, GuiBase.Layer layer) { public void drawBigHeatBar(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, int value, int max, GuiBase.Layer layer) {
if (gui.hideGuiElements()) return; if (gui.hideGuiElements()) return;
@ -255,17 +255,17 @@ public class GuiBuilder {
/** /**
* Draws big horizontal blue bar * Draws big horizontal blue bar
* *
* @param gui GuiBase GUI to draw on * @param gui {@link GuiBase} The GUI to draw on
* @param x int Top left corner where to place bar * @param x {@code int} Top left corner where to place bar
* @param y int Top left corner where to place bar * @param y {@code int} Top left corner where to place bar
* @param value int Current value * @param value {@code int} Current value
* @param max int Maximum value * @param max {@code int} Maximum value
* @param mouseX int Mouse cursor position to check for tooltip * @param mouseX {@code int} Mouse cursor position to check for tooltip
* @param mouseY int Mouse cursor position to check for tooltip * @param mouseY {@code int} Mouse cursor position to check for tooltip
* @param suffix String String to put on the bar and tooltip after percentage value * @param suffix {@link String} String to put on the bar and tooltip after percentage value
* @param line2 String String to put into tooltip as a second line * @param line2 {@link String} String to put into tooltip as a second line
* @param format String Formatted value to put on the bar * @param format {@link String} Formatted value to put on the bar
* @param layer Layer Layer to draw on * @param layer {@link GuiBase.Layer} The layer to draw on
*/ */
public void drawBigBlueBar(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, int value, int max, int mouseX, int mouseY, String suffix, Text line2, String format, GuiBase.Layer layer) { public void drawBigBlueBar(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, int value, int max, int mouseX, int mouseY, String suffix, Text line2, String format, GuiBase.Layer layer) {
if (gui.hideGuiElements()) return; if (gui.hideGuiElements()) return;
@ -343,8 +343,8 @@ public class GuiBuilder {
/** /**
* Shades GUI and draw gray bar on top of GUI * Shades GUI and draw gray bar on top of GUI
* *
* @param gui GuiBase GUI to draw on * @param gui {@link GuiBase} The GUI to draw on
* @param layer Layer Layer to draw on * @param layer {@link GuiBase.Layer} The layer to draw on
*/ */
public void drawMultiblockMissingBar(MatrixStack matrixStack, GuiBase<?> gui, GuiBase.Layer layer) { public void drawMultiblockMissingBar(MatrixStack matrixStack, GuiBase<?> gui, GuiBase.Layer layer) {
if (gui.hideGuiElements()) return; if (gui.hideGuiElements()) return;
@ -369,9 +369,9 @@ public class GuiBuilder {
* Draws upgrade slots on the left side of machine GUI. Draws on the background * Draws upgrade slots on the left side of machine GUI. Draws on the background
* level. * level.
* *
* @param gui GuiBase GUI to draw on * @param gui {@link GuiBase} The GUI to draw on
* @param x int Top left corner where to place slots * @param x {@code int} Top left corner where to place slots
* @param y int Top left corner where to place slots * @param y {@code int} Top left corner where to place slots
*/ */
public void drawUpgrades(MatrixStack matrixStack, GuiBase<?> gui, int x, int y) { public void drawUpgrades(MatrixStack matrixStack, GuiBase<?> gui, int x, int y) {
RenderSystem.setShaderTexture(0, resourceLocation); RenderSystem.setShaderTexture(0, resourceLocation);
@ -381,10 +381,10 @@ public class GuiBuilder {
/** /**
* Draws tab on the left side of machine GUI. Draws on the background level. * Draws tab on the left side of machine GUI. Draws on the background level.
* *
* @param gui GuiBase GUI to draw on * @param gui {@link GuiBase} The GUI to draw on
* @param x int Top left corner where to place tab * @param x {@code int} Top left corner where to place tab
* @param y int Top left corner where to place tab * @param y {@code int} Top left corner where to place tab
* @param stack ItemStack Item to show as tab icon * @param stack {@link ItemStack} Item to show as tab icon
*/ */
public void drawSlotTab(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, ItemStack stack) { public void drawSlotTab(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, ItemStack stack) {
RenderSystem.setShaderTexture(0, resourceLocation); RenderSystem.setShaderTexture(0, resourceLocation);
@ -396,11 +396,11 @@ public class GuiBuilder {
/** /**
* Draws Slot Configuration tips instead of player inventory * Draws Slot Configuration tips instead of player inventory
* *
* @param gui GuiBase GUI to draw on * @param gui {@link GuiBase} The GUI to draw on
* @param x int Top left corner where to place tips list * @param x {@code int} Top left corner where to place tips list
* @param y int Top left corner where to place tips list * @param y {@code int} Top left corner where to place tips list
* @param mouseX int Mouse cursor position * @param mouseX {@code int} Mouse cursor position
* @param mouseY int Mouse cursor position * @param mouseY {@code int} Mouse cursor position
*/ */
public void drawSlotConfigTips(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, int mouseX, int mouseY, GuiTab guiTab) { public void drawSlotConfigTips(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, int mouseX, int mouseY, GuiTab guiTab) {
List<Text> tips = guiTab.getTips().stream() List<Text> tips = guiTab.getTips().stream()
@ -468,15 +468,16 @@ public class GuiBuilder {
} }
} }
//TODO: change to double // TODO: change to double
/** /**
* Draws energy output value and icon * Draws energy output value and icon
* *
* @param gui GuiBase GUI to draw on * @param gui {@link GuiBase} The GUI to draw on
* @param x int Top left corner where to place energy output * @param x {@code int} Top left corner where to place energy output
* @param y int Top left corner where to place energy output * @param y {@code int} Top left corner where to place energy output
* @param maxOutput int Energy output value * @param maxOutput {@code int} Energy output value
* @param layer Layer Layer to draw on * @param layer {@link GuiBase.Layer} The layer to draw on
*/ */
public void drawEnergyOutput(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, int maxOutput, GuiBase.Layer layer) { public void drawEnergyOutput(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, int maxOutput, GuiBase.Layer layer) {
if (gui.hideGuiElements()) return; if (gui.hideGuiElements()) return;
@ -498,15 +499,15 @@ public class GuiBuilder {
/** /**
* Draws progress arrow in direction specified. * Draws progress arrow in direction specified.
* *
* @param gui GuiBase GUI to draw on * @param gui {@link GuiBase} The GUI to draw on
* @param progress int Current progress * @param progress {@code int} Current progress
* @param maxProgress int Maximum progress * @param maxProgress {@code int} Maximum progress
* @param x int Top left corner where to place progress arrow * @param x {@code int} Top left corner where to place progress arrow
* @param y int Top left corner where to place progress arrow * @param y {@code int} Top left corner where to place progress arrow
* @param mouseX int Mouse cursor position to check for tooltip * @param mouseX {@code int} Mouse cursor position to check for tooltip
* @param mouseY int Mouse cursor position to check for tooltip * @param mouseY {@code int} Mouse cursor position to check for tooltip
* @param direction ProgressDirection Direction of progress arrow * @param direction {@link ProgressDirection} Direction of the progress arrow
* @param layer Layer Layer to draw on * @param layer {@link GuiBase.Layer} The layer to draw on
*/ */
public void drawProgressBar(MatrixStack matrixStack, GuiBase<?> gui, int progress, int maxProgress, int x, int y, int mouseX, int mouseY, ProgressDirection direction, GuiBase.Layer layer) { public void drawProgressBar(MatrixStack matrixStack, GuiBase<?> gui, int progress, int maxProgress, int x, int y, int mouseX, int mouseY, ProgressDirection direction, GuiBase.Layer layer) {
if (gui.hideGuiElements()) return; if (gui.hideGuiElements()) return;
@ -560,15 +561,15 @@ public class GuiBuilder {
/** /**
* Draws multi-energy bar * Draws multi-energy bar
* *
* @param gui GuiBase GUI to draw on * @param gui {@link GuiBase} The GUI to draw on
* @param x int Top left corner where to place energy bar * @param x {@code int} Top left corner where to place energy bar
* @param y int Top left corner where to place energy bar * @param y {@code int} Top left corner where to place energy bar
* @param energyStored int Current amount of energy * @param energyStored {@code int} Current amount of energy
* @param maxEnergyStored int Maximum amount of energy * @param maxEnergyStored {@code int} Maximum amount of energy
* @param mouseX int Mouse cursor position to check for tooltip * @param mouseX {@code int} Mouse cursor position to check for tooltip
* @param mouseY int Mouse cursor position to check for tooltip * @param mouseY {@code int} Mouse cursor position to check for tooltip
* @param buttonID int Button ID used to switch energy systems * @param buttonID {@code int} Button ID used to switch energy systems
* @param layer Layer Layer to draw on * @param layer {@link GuiBase.Layer} The layer to draw on
*/ */
public void drawMultiEnergyBar(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, int energyStored, int maxEnergyStored, int mouseX, public void drawMultiEnergyBar(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, int energyStored, int maxEnergyStored, int mouseX,
int mouseY, int buttonID, GuiBase.Layer layer) { int mouseY, int buttonID, GuiBase.Layer layer) {
@ -641,15 +642,15 @@ public class GuiBuilder {
/** /**
* Draws tank and fluid inside it * Draws tank and fluid inside it
* *
* @param gui GuiBase GUI to draw on * @param gui {@link GuiBase} The GUI to draw on
* @param x int Top left corner of tank * @param x {@code int} Top left corner of tank
* @param y int Top left corner of tank * @param y {@code int} Top left corner of tank
* @param mouseX int Mouse cursor position to check for tooltip * @param mouseX {@code int} Mouse cursor position to check for tooltip
* @param mouseY int Mouse cursor position to check for tooltip * @param mouseY {@code int} Mouse cursor position to check for tooltip
* @param fluid FluidStack Fluid to draw in tank * @param fluid {@link FluidInstance} to draw in tank
* @param maxCapacity int Maximum tank capacity * @param maxCapacity {@code int} Maximum tank capacity
* @param isTankEmpty boolean True if tank is empty * @param isTankEmpty {@code boolean} True if tank is empty
* @param layer Layer Layer to draw on * @param layer {@link GuiBase.Layer} The layer to draw on
*/ */
public void drawTank(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, int mouseX, int mouseY, FluidInstance fluid, FluidValue maxCapacity, boolean isTankEmpty, GuiBase.Layer layer) { public void drawTank(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, int mouseX, int mouseY, FluidInstance fluid, FluidValue maxCapacity, boolean isTankEmpty, GuiBase.Layer layer) {
if (gui.hideGuiElements()) return; if (gui.hideGuiElements()) return;
@ -704,13 +705,13 @@ public class GuiBuilder {
/** /**
* Draws fluid in tank * Draws fluid in tank
* *
* @param gui GuiBase GUI to draw on * @param gui {@link GuiBase} The GUI to draw on
* @param fluid FluidStack Fluid to draw * @param fluid {@link FluidInstance} Fluid to draw
* @param x int Top left corner of fluid * @param x {@code int} Top left corner of fluid
* @param y int Top left corner of fluid * @param y {@code int} Top left corner of fluid
* @param width int Width of fluid to draw * @param width {@code int} Width of fluid to draw
* @param height int Height of fluid to draw * @param height {@code int} Height of fluid to draw
* @param maxCapacity int Maximum capacity of tank * @param maxCapacity {@code int} Maximum capacity of tank
*/ */
public void drawFluid(MatrixStack matrixStack, GuiBase<?> gui, FluidInstance fluid, int x, int y, int width, int height, long maxCapacity) { public void drawFluid(MatrixStack matrixStack, GuiBase<?> gui, FluidInstance fluid, int x, int y, int width, int height, long maxCapacity) {
if (fluid.getFluid() == Fluids.EMPTY) { if (fluid.getFluid() == Fluids.EMPTY) {
@ -746,14 +747,14 @@ public class GuiBuilder {
/** /**
* Draws burning progress, similar to vanilla furnace * Draws burning progress, similar to vanilla furnace
* *
* @param gui GuiBase GUI to draw on * @param gui {@link GuiBase} The GUI to draw on
* @param progress int Current progress * @param progress {@code int} Current progress
* @param maxProgress int Maximum progress * @param maxProgress {@code int} Maximum progress
* @param x int Top left corner where to place burn bar * @param x {@code int} Top left corner where to place burn bar
* @param y int Top left corner where to place burn bar * @param y {@code int} Top left corner where to place burn bar
* @param mouseX int Mouse cursor position to check for tooltip * @param mouseX {@code int} Mouse cursor position to check for tooltip
* @param mouseY int Mouse cursor position to check for tooltip * @param mouseY {@code int} Mouse cursor position to check for tooltip
* @param layer Layer Layer to draw on * @param layer {@link GuiBase.Layer} The layer to draw on
*/ */
public void drawBurnBar(MatrixStack matrixStack, GuiBase<?> gui, int progress, int maxProgress, int x, int y, int mouseX, int mouseY, GuiBase.Layer layer) { public void drawBurnBar(MatrixStack matrixStack, GuiBase<?> gui, int progress, int maxProgress, int x, int y, int mouseX, int mouseY, GuiBase.Layer layer) {
if (gui.hideGuiElements()) return; if (gui.hideGuiElements()) return;
@ -785,10 +786,10 @@ public class GuiBuilder {
/** /**
* Draws bar containing output slots * Draws bar containing output slots
* *
* @param gui GuiBase GUI to draw on * @param gui {@link GuiBase} The GUI to draw on
* @param x int Top left corner where to place slots bar * @param x {@code int} Top left corner where to place slots bar
* @param y int Top left corner where to place slots bar * @param y {@code int} Top left corner where to place slots bar
* @param count int Number of output slots * @param count {@code int} Number of output slots
*/ */
public void drawOutputSlotBar(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, int count) { public void drawOutputSlotBar(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, int count) {
RenderSystem.setShaderTexture(0, resourceLocation); RenderSystem.setShaderTexture(0, resourceLocation);

View file

@ -31,14 +31,14 @@ public class SlotFake extends BaseSlot {
public boolean mCanInsertItem; public boolean mCanInsertItem;
public boolean mCanStackItem; public boolean mCanStackItem;
public int mMaxStacksize = 127; public int mMaxStackSize = 127;
public SlotFake(Inventory itemHandler, int par2, int par3, int par4, boolean aCanInsertItem, public SlotFake(Inventory itemHandler, int par2, int par3, int par4, boolean aCanInsertItem,
boolean aCanStackItem, int aMaxStacksize) { boolean aCanStackItem, int aMaxStackSize) {
super(itemHandler, par2, par3, par4); super(itemHandler, par2, par3, par4);
this.mCanInsertItem = aCanInsertItem; this.mCanInsertItem = aCanInsertItem;
this.mCanStackItem = aCanStackItem; this.mCanStackItem = aCanStackItem;
this.mMaxStacksize = aMaxStacksize; this.mMaxStackSize = aMaxStackSize;
} }
@Override @Override
@ -48,7 +48,7 @@ public class SlotFake extends BaseSlot {
@Override @Override
public int getMaxItemCount() { public int getMaxItemCount() {
return this.mMaxStacksize; return this.mMaxStackSize;
} }
@Override @Override

View file

@ -22,9 +22,9 @@
* SOFTWARE. * SOFTWARE.
*/ */
/** /*
* This class was created by <Vazkii>. It's distributed as * This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github: * part of the Botania Mod. Get the Source Code in GitHub:
* https://github.com/Vazkii/Botania * https://github.com/Vazkii/Botania
* <p> * <p>
* Botania is Open Source and distributed under the * Botania is Open Source and distributed under the

View file

@ -130,17 +130,18 @@ public class BlockEntityScreenHandlerBuilder {
private BlockEntityScreenHandlerBuilder upgradeSlots(IUpgradeable upgradeable) { private BlockEntityScreenHandlerBuilder upgradeSlots(IUpgradeable upgradeable) {
if (upgradeable.canBeUpgraded()) { if (upgradeable.canBeUpgraded()) {
for (int i = 0; i < upgradeable.getUpgradeSlotCount(); i++) { for (int i = 0; i < upgradeable.getUpgradeSlotCount(); i++) {
this.parent.slots.add(new UpgradeSlot(upgradeable.getUpgradeInvetory(), i, -18, i * 18 + 12)); this.parent.slots.add(new UpgradeSlot(upgradeable.getUpgradeInventory(), i, -18, i * 18 + 12));
} }
} }
return this; return this;
} }
/** /**
* @param supplier The supplier it can supply a variable holding in an Object it * @param <T> The type of the block entity
* will be synced with a custom packet * @param supplier {@link Supplier<T>} The supplier it can supply a variable holding in an Object.
* @param setter The setter to call when the variable has been updated. * it will be synced with a custom packet
* @return ContainerTileInventoryBuilder Inventory which will do the sync * @param setter {@link Consumer<T>} The setter to call when the variable has been updated.
* @return {@link BlockEntityScreenHandlerBuilder} Inventory which will do the sync
*/ */
public <T> BlockEntityScreenHandlerBuilder sync(final Supplier<T> supplier, final Consumer<T> setter) { public <T> BlockEntityScreenHandlerBuilder sync(final Supplier<T> supplier, final Consumer<T> setter) {
this.parent.objectValues.add(Pair.of(supplier, setter)); this.parent.objectValues.add(Pair.of(supplier, setter));

View file

@ -37,8 +37,8 @@ import net.minecraft.screen.slot.Slot;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import org.apache.commons.lang3.Range; import org.apache.commons.lang3.Range;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import reborncore.common.blockentity.MachineBaseBlockEntity; import reborncore.common.blockentity.MachineBaseBlockEntity;
import reborncore.common.network.ClientBoundPackets; import reborncore.common.network.ClientBoundPackets;
import reborncore.common.network.NetworkManager; import reborncore.common.network.NetworkManager;
@ -62,7 +62,7 @@ public class BuiltScreenHandler extends ScreenHandler {
private final List<Range<Integer>> playerSlotRanges; private final List<Range<Integer>> playerSlotRanges;
private final List<Range<Integer>> blockEntitySlotRanges; private final List<Range<Integer>> blockEntitySlotRanges;
// Holds the syncpair along with the last value // Holds the SyncPair along with the last value
private final Map<SyncPair, Object> syncPairCache = new HashMap<>(); private final Map<SyncPair, Object> syncPairCache = new HashMap<>();
private final Int2ObjectMap<SyncPair> syncPairIdLookup = new Int2ObjectOpenHashMap<>(); private final Int2ObjectMap<SyncPair> syncPairIdLookup = new Int2ObjectOpenHashMap<>();
@ -257,7 +257,7 @@ public class BuiltScreenHandler extends ScreenHandler {
} }
} }
//If we moved some, but still have more left over lets try again // If we moved some, but still have more left over lets try again
if (!stackToShift.isEmpty() && stackToShift.getCount() != inCount) { if (!stackToShift.isEmpty() && stackToShift.getCount() != inCount) {
shiftItemStack(stackToShift, start, end); shiftItemStack(stackToShift, start, end);
} }

View file

@ -86,7 +86,7 @@ public final class PlayerScreenHandlerBuilder {
this.parent.addPlayerInventoryRange(this.main); this.parent.addPlayerInventoryRange(this.main);
} }
if (this.armor != null) { if (this.armor != null) {
this.parent.addBlockEnityInventoryRange(this.armor); this.parent.addBlockEntityInventoryRange(this.armor);
} }
return this.parent; return this.parent;
@ -139,4 +139,4 @@ public final class PlayerScreenHandlerBuilder {
return this.parent; return this.parent;
} }
} }
} }

View file

@ -76,7 +76,7 @@ public class ScreenHandlerBuilder {
this.playerInventoryRanges.add(range); this.playerInventoryRanges.add(range);
} }
void addBlockEnityInventoryRange(final Range<Integer> range) { void addBlockEntityInventoryRange(final Range<Integer> range) {
this.blockEntityInventoryRanges.add(range); this.blockEntityInventoryRanges.add(range);
} }

View file

@ -28,7 +28,6 @@ import net.minecraft.inventory.Inventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import reborncore.client.gui.slots.BaseSlot; import reborncore.client.gui.slots.BaseSlot;
import java.util.function.BiPredicate;
import java.util.function.Predicate; import java.util.function.Predicate;
public class FilteredSlot extends BaseSlot { public class FilteredSlot extends BaseSlot {

View file

@ -35,12 +35,12 @@ import org.jetbrains.annotations.Nullable;
public class SpriteSlot extends FilteredSlot { public class SpriteSlot extends FilteredSlot {
private final Identifier spriteName; private final Identifier spriteName;
int stacksize; int stackSize;
public SpriteSlot(final Inventory inventory, final int index, final int xPosition, final int yPosition, final Identifier sprite, final int stacksize) { public SpriteSlot(final Inventory inventory, final int index, final int xPosition, final int yPosition, final Identifier sprite, final int stackSize) {
super(inventory, index, xPosition, yPosition); super(inventory, index, xPosition, yPosition);
this.spriteName = sprite; this.spriteName = sprite;
this.stacksize = stacksize; this.stackSize = stackSize;
} }
public SpriteSlot(final Inventory inventory, final int index, final int xPosition, final int yPosition, final Identifier sprite) { public SpriteSlot(final Inventory inventory, final int index, final int xPosition, final int yPosition, final Identifier sprite) {
@ -49,7 +49,7 @@ public class SpriteSlot extends FilteredSlot {
@Override @Override
public int getMaxItemCount() { public int getMaxItemCount() {
return this.stacksize; return this.stackSize;
} }
@Override @Override

View file

@ -89,7 +89,7 @@ public class FluidConfiguration implements NBTSerializable {
if (autoInput() && fluidConfig.getIoConfig().isInsert()) { if (autoInput() && fluidConfig.getIoConfig().isInsert()) {
StorageUtil.move(tank, machineBase.getTank(), fv -> true, machineBase.fluidTransferAmount().getRawValue(), null); StorageUtil.move(tank, machineBase.getTank(), fv -> true, machineBase.fluidTransferAmount().getRawValue(), null);
} }
if (autoOutput() && fluidConfig.getIoConfig().isExtact()) { if (autoOutput() && fluidConfig.getIoConfig().isExtract()) {
StorageUtil.move(machineBase.getTank(), tank, fv -> true, machineBase.fluidTransferAmount().getRawValue(), null); StorageUtil.move(machineBase.getTank(), tank, fv -> true, machineBase.fluidTransferAmount().getRawValue(), null);
} }
} }
@ -187,16 +187,16 @@ public class FluidConfiguration implements NBTSerializable {
OUTPUT(true, false), OUTPUT(true, false),
ALL(true, true); ALL(true, true);
boolean extact; boolean extract;
boolean insert; boolean insert;
ExtractConfig(boolean extact, boolean insert) { ExtractConfig(boolean extract, boolean insert) {
this.extact = extact; this.extract = extract;
this.insert = insert; this.insert = insert;
} }
public boolean isExtact() { public boolean isExtract() {
return extact; return extract;
} }
public boolean isInsert() { public boolean isInsert() {
@ -204,7 +204,7 @@ public class FluidConfiguration implements NBTSerializable {
} }
public boolean isEnabled() { public boolean isEnabled() {
return extact || insert; return extract || insert;
} }
public FluidConfiguration.ExtractConfig getNext() { public FluidConfiguration.ExtractConfig getNext() {

View file

@ -75,19 +75,31 @@ public class MachineBaseBlockEntity extends BlockEntity implements BlockEntityTi
public boolean renderMultiblock = false; public boolean renderMultiblock = false;
private int ticktime = 0; private int tickTime = 0;
/** /**
* This is used to change the speed of the crafting operation. * <p>
* This is used to change the speed of the crafting operation.
* <p/> * <p/>
* 0 = none; 0.2 = 20% speed increase 0.75 = 75% increase *
* <ul>
* <li>0 = Normal speed</li>
* <li>0.2 = 20% increase</li>
* <li>0.75 = 75% increase</li>
* </ul>
*/ */
double speedMultiplier = 0; double speedMultiplier = 0;
/** /**
* This is used to change the power of the crafting operation. * <p>
* This is used to change the power of the crafting operation.
* <p/> * <p/>
* 1 = none; 1.2 = 20% speed increase 1.75 = 75% increase 5 = uses 5 times *
* more power * <ul>
* <li>1 = Normal power</li>
* <li>1.2 = 20% increase</li>
* <li>1.75 = 75% increase</li>
* <li>5 = 500% increase</li>
* </ul>
*/ */
double powerMultiplier = 1; double powerMultiplier = 1;
@ -139,10 +151,10 @@ public class MachineBaseBlockEntity extends BlockEntity implements BlockEntityTi
@Override @Override
public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) { public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) {
if (ticktime == 0) { if (tickTime == 0) {
onLoad(); onLoad();
} }
ticktime++; tickTime++;
@Nullable @Nullable
RecipeCrafter crafter = null; RecipeCrafter crafter = null;
if (getOptionalCrafter().isPresent()) { if (getOptionalCrafter().isPresent()) {
@ -151,7 +163,7 @@ public class MachineBaseBlockEntity extends BlockEntity implements BlockEntityTi
if (canBeUpgraded()) { if (canBeUpgraded()) {
resetUpgrades(); resetUpgrades();
for (int i = 0; i < getUpgradeSlotCount(); i++) { for (int i = 0; i < getUpgradeSlotCount(); i++) {
ItemStack stack = getUpgradeInvetory().getStack(i); ItemStack stack = getUpgradeInventory().getStack(i);
if (!stack.isEmpty() && stack.getItem() instanceof IUpgrade) { if (!stack.isEmpty() && stack.getItem() instanceof IUpgrade) {
((IUpgrade) stack.getItem()).process(this, this, stack); ((IUpgrade) stack.getItem()).process(this, this, stack);
} }
@ -173,8 +185,8 @@ public class MachineBaseBlockEntity extends BlockEntity implements BlockEntityTi
} }
public void resetUpgrades() { public void resetUpgrades() {
resetPowerMulti(); resetPowerMultiplier();
resetSpeedMulti(); resetSpeedMultiplier();
} }
protected void afterUpgradesApplication() { protected void afterUpgradesApplication() {
@ -289,10 +301,10 @@ public class MachineBaseBlockEntity extends BlockEntity implements BlockEntityTi
} }
return true; return true;
} }
//Inventory end // Inventory end
@Override @Override
public Inventory getUpgradeInvetory() { public Inventory getUpgradeInventory() {
return upgradeInventory; return upgradeInventory;
} }
@ -306,7 +318,7 @@ public class MachineBaseBlockEntity extends BlockEntity implements BlockEntityTi
} }
@Override @Override
public void resetSpeedMulti() { public void resetSpeedMultiplier() {
speedMultiplier = 0; speedMultiplier = 0;
} }
@ -316,12 +328,12 @@ public class MachineBaseBlockEntity extends BlockEntity implements BlockEntityTi
} }
@Override @Override
public void addPowerMulti(double amount) { public void addPowerMultiplier(double amount) {
powerMultiplier = powerMultiplier * (1f + amount); powerMultiplier = powerMultiplier * (1f + amount);
} }
@Override @Override
public void resetPowerMulti() { public void resetPowerMultiplier() {
powerMultiplier = 1; powerMultiplier = 1;
} }
@ -336,7 +348,7 @@ public class MachineBaseBlockEntity extends BlockEntity implements BlockEntityTi
} }
@Override @Override
public void addSpeedMulti(double amount) { public void addSpeedMultiplier(double amount) {
if (speedMultiplier + amount <= 0.99) { if (speedMultiplier + amount <= 0.99) {
speedMultiplier += amount; speedMultiplier += amount;
} else { } else {
@ -357,12 +369,12 @@ public class MachineBaseBlockEntity extends BlockEntity implements BlockEntityTi
return getTank() != null; return getTank() != null;
} }
//The amount of ticks between a slot tranfer atempt, less is faster //The amount of ticks between a slot transfer attempt, less is faster
public int slotTransferSpeed() { public int slotTransferSpeed() {
return 4; return 4;
} }
//The amount of fluid transfured each tick buy the fluid config //The amount of fluid transferred each tick buy the fluid config
public FluidValue fluidTransferAmount() { public FluidValue fluidTransferAmount() {
return FluidValue.BUCKET_QUARTER; return FluidValue.BUCKET_QUARTER;
} }
@ -459,7 +471,7 @@ public class MachineBaseBlockEntity extends BlockEntity implements BlockEntityTi
@Override @Override
public int[] getAvailableSlots(Direction side) { public int[] getAvailableSlots(Direction side) {
if(slotConfiguration == null){ if(slotConfiguration == null){
return new int[]{}; //I think should be ok, if needed this can return all the slots return new int[]{}; // I think should be ok, if needed this can return all the slots
} }
return slotConfiguration.getSlotsForSide(side).stream() return slotConfiguration.getSlotsForSide(side).stream()
.filter(Objects::nonNull) .filter(Objects::nonNull)
@ -491,7 +503,7 @@ public class MachineBaseBlockEntity extends BlockEntity implements BlockEntityTi
} }
SlotConfiguration.SlotConfigHolder slotConfigHolder = slotConfiguration.getSlotDetails(index); SlotConfiguration.SlotConfigHolder slotConfigHolder = slotConfiguration.getSlotDetails(index);
SlotConfiguration.SlotConfig slotConfig = slotConfigHolder.getSideDetail(direction); SlotConfiguration.SlotConfig slotConfig = slotConfigHolder.getSideDetail(direction);
return slotConfig.getSlotIO().ioConfig.isExtact(); return slotConfig.getSlotIO().ioConfig.isExtract();
} }
public void onBreak(World world, PlayerEntity playerEntity, BlockPos blockPos, BlockState blockState){ public void onBreak(World world, PlayerEntity playerEntity, BlockPos blockPos, BlockState blockState){

View file

@ -50,36 +50,36 @@ import java.util.function.BiPredicate;
/** /**
* Writes a multiblock for either verification or hologram rendering * Writes a multiblock for either verification or hologram rendering
* *
* @author ramidzkh
* @see MultiblockVerifier * @see MultiblockVerifier
* @see HologramRenderer * @see HologramRenderer
* @author ramidzkh
*/ */
public interface MultiblockWriter { public interface MultiblockWriter {
/** /**
* Adds a block to the multiblock * Adds a block to the multiblock
* *
* @param x X * @param x {@code int} X
* @param y Y * @param y {@code int} Y
* @param z Z * @param z {@code int} Z
* @param predicate Predicate of the position * @param predicate {@link BiPredicate} Predicate of the position
* @param state The state for the hologram * @param state {@link BlockState} The state for the hologram
* @return This. Useful for chaining * @return {@link MultiblockWriter} This. Useful for chaining
*/ */
MultiblockWriter add(int x, int y, int z, BiPredicate<BlockView, BlockPos> predicate, BlockState state); MultiblockWriter add(int x, int y, int z, BiPredicate<BlockView, BlockPos> predicate, BlockState state);
/** /**
* Fills a section between (ax, ay, az) to (bx, by, bz) * Fills a section between (ax, ay, az) to (bx, by, bz)
* *
* @param ax X of the first point * @param ax {@code int} X of the first point
* @param ay Y of the first point * @param ay {@code int} Y of the first point
* @param az Z of the first point * @param az {@code int} Z of the first point
* @param bx X of the second point * @param bx {@code int} X of the second point
* @param by X of the second point * @param by {@code int} X of the second point
* @param bz Z of the second point * @param bz {@code int} Z of the second point
* @param predicate Predicate of the position * @param predicate {@link BiPredicate} Predicate of the position
* @param state The state for the hologram * @param state {@link BlockState} The state for the hologram
* @return This. Useful for chaining * @return {@link MultiblockWriter} This. Useful for chaining
*/ */
default MultiblockWriter fill(int ax, int ay, int az, int bx, int by, int bz, BiPredicate<BlockView, BlockPos> predicate, BlockState state) { default MultiblockWriter fill(int ax, int ay, int az, int bx, int by, int bz, BiPredicate<BlockView, BlockPos> predicate, BlockState state) {
for (int x = ax; x < bx; x++) { for (int x = ax; x < bx; x++) {
@ -97,15 +97,15 @@ public interface MultiblockWriter {
* Fills the outer ring of (0, 0, 0) to (pX, pY, pZ) through the axis, using the <code>predicate</code> and * Fills the outer ring of (0, 0, 0) to (pX, pY, pZ) through the axis, using the <code>predicate</code> and
* <code>state</code>. The inside of the ring uses <code>holePredicate</code> and <code>holeHologramState</code> * <code>state</code>. The inside of the ring uses <code>holePredicate</code> and <code>holeHologramState</code>
* *
* @param through The axis to go through * @param through {@link Direction.Axis} The axis to go through
* @param pX Size on the X axis * @param pX {@code int} Size on the X axis
* @param pY Size on the Y axis * @param pY {@code int} Size on the Y axis
* @param pZ Size on the Z axis * @param pZ {@code int} Size on the Z axis
* @param predicate Predicate for the ring * @param predicate {@link BiPredicate} Predicate for the ring
* @param state The ring state for the hologram * @param state {@link BlockState} The state for the hologram
* @param holePredicate Predicate for the hole * @param holePredicate {@link BiPredicate} Predicate for the hole
* @param holeHologramState The hole state for the hologram * @param holeHologramState {@link BlockState} The hole state for the hologram
* @return This. Useful for chaining * @return {@link MultiblockWriter} This. Useful for chaining
*/ */
default MultiblockWriter ring(Direction.Axis through, int pX, int pY, int pZ, BiPredicate<BlockView, BlockPos> predicate, BlockState state, BiPredicate<BlockView, BlockPos> holePredicate, BlockState holeHologramState) { default MultiblockWriter ring(Direction.Axis through, int pX, int pY, int pZ, BiPredicate<BlockView, BlockPos> predicate, BlockState state, BiPredicate<BlockView, BlockPos> holePredicate, BlockState holeHologramState) {
if (holePredicate == null) { if (holePredicate == null) {

View file

@ -47,7 +47,7 @@ import java.util.stream.Collectors;
public class RedstoneConfiguration implements NBTSerializable, Syncable { public class RedstoneConfiguration implements NBTSerializable, Syncable {
//Set in TR to be a better item such as a battery or a cell // Set in TR to be a better item such as a battery or a cell
public static ItemStack powerStack = new ItemStack(Items.CARROT_ON_A_STICK); public static ItemStack powerStack = new ItemStack(Items.CARROT_ON_A_STICK);
public static ItemStack fluidStack = new ItemStack(Items.BUCKET); public static ItemStack fluidStack = new ItemStack(Items.BUCKET);
@ -168,7 +168,7 @@ public class RedstoneConfiguration implements NBTSerializable, Syncable {
stateMap.put(element, state); stateMap.put(element, state);
} }
//Ensure all active states are in the map, will happen if a new state is added when the world is upgraded // Ensure all active states are in the map, will happen if a new state is added when the world is upgraded
for (Element element : getElements()) { for (Element element : getElements()) {
if (!stateMap.containsKey(element)) { if (!stateMap.containsKey(element)) {
stateMap.put(element, State.IGNORED); stateMap.put(element, State.IGNORED);
@ -185,7 +185,7 @@ public class RedstoneConfiguration implements NBTSerializable, Syncable {
return ELEMENT_MAP.get(name); return ELEMENT_MAP.get(name);
} }
//Could be power input/output, item/fluid io, machine processing // Could be power input/output, item/fluid io, machine processing
public static class Element { public static class Element {
private final String name; private final String name;
private final BooleanFunction<MachineBaseBlockEntity> isApplicable; private final BooleanFunction<MachineBaseBlockEntity> isApplicable;

View file

@ -67,7 +67,7 @@ public class SlotConfiguration implements NBTSerializable {
SlotConfigHolder holder = getSlotDetails(i); SlotConfigHolder holder = getSlotDetails(i);
if (holder == null) { if (holder == null) {
RebornCore.LOGGER.debug("Fixed slot " + i + " in " + machineBase); RebornCore.LOGGER.debug("Fixed slot " + i + " in " + machineBase);
//humm somthing has gone wrong // hmm, something has gone wrong
updateSlotDetails(new SlotConfigHolder(i)); updateSlotDetails(new SlotConfigHolder(i));
} }
} }
@ -88,8 +88,8 @@ public class SlotConfiguration implements NBTSerializable {
/** /**
* Replaces or adds a slot detail for the slot id * Replaces or adds a slot detail for the slot id
* *
* @param slotConfigHolder * @param slotConfigHolder {@link SlotConfigHolder}
* @return SlotConfigHolder * @return {@link SlotConfigHolder} Updated SlotConfigHolder
*/ */
public SlotConfigHolder updateSlotDetails(SlotConfigHolder slotConfigHolder) { public SlotConfigHolder updateSlotDetails(SlotConfigHolder slotConfigHolder) {
SlotConfigHolder lookup = getSlotDetails(slotConfigHolder.slotID); SlotConfigHolder lookup = getSlotDetails(slotConfigHolder.slotID);
@ -209,7 +209,7 @@ public class SlotConfiguration implements NBTSerializable {
this.output = output; this.output = output;
} }
public void setfilter(boolean filter) { public void setFilter(boolean filter) {
this.filter = filter; this.filter = filter;
} }
@ -236,7 +236,7 @@ public class SlotConfiguration implements NBTSerializable {
}); });
input = nbt.getBoolean("input"); input = nbt.getBoolean("input");
output = nbt.getBoolean("output"); output = nbt.getBoolean("output");
if (nbt.contains("filter")) { //Was added later, this allows old saves to be upgraded if (nbt.contains("filter")) { // Was added later, this allows old saves to be upgraded
filter = nbt.getBoolean("filter"); filter = nbt.getBoolean("filter");
} }
} }
@ -367,16 +367,16 @@ public class SlotConfiguration implements NBTSerializable {
INPUT(false, true), INPUT(false, true),
OUTPUT(true, false); OUTPUT(true, false);
boolean extact; boolean extract;
boolean insert; boolean insert;
ExtractConfig(boolean extact, boolean insert) { ExtractConfig(boolean extract, boolean insert) {
this.extact = extact; this.extract = extract;
this.insert = insert; this.insert = insert;
} }
public boolean isExtact() { public boolean isExtract() {
return extact; return extract;
} }
public boolean isInsert() { public boolean isInsert() {
@ -404,7 +404,7 @@ public class SlotConfiguration implements NBTSerializable {
try { try {
compound = StringNbtReader.parse(json); compound = StringNbtReader.parse(json);
} catch (CommandSyntaxException e) { } catch (CommandSyntaxException e) {
throw new UnsupportedOperationException("Clipboard conetents isnt a valid slot configuation"); throw new UnsupportedOperationException("Clipboard contents isn't a valid slot configuration");
} }
if (!compound.contains("machine") || !compound.getString("machine").equals(machineIdent)) { if (!compound.contains("machine") || !compound.getString("machine").equals(machineIdent)) {
throw new UnsupportedOperationException("Machine config is not for this machine."); throw new UnsupportedOperationException("Machine config is not for this machine.");
@ -412,7 +412,7 @@ public class SlotConfiguration implements NBTSerializable {
read(compound.getCompound("data")); read(compound.getCompound("data"));
} }
//DO NOT CALL THIS, use the inventory access on the inventory // DO NOT CALL THIS, use the inventory access on the inventory
public static boolean canInsertItem(int index, ItemStack itemStackIn, Direction direction, MachineBaseBlockEntity blockEntity) { public static boolean canInsertItem(int index, ItemStack itemStackIn, Direction direction, MachineBaseBlockEntity blockEntity) {
if(itemStackIn.isEmpty()){ if(itemStackIn.isEmpty()){
return false; return false;
@ -430,11 +430,11 @@ public class SlotConfiguration implements NBTSerializable {
return false; return false;
} }
//DO NOT CALL THIS, use the inventory access on the inventory // DO NOT CALL THIS, use the inventory access on the inventory
public static boolean canExtractItem(int index, ItemStack stack, Direction direction, MachineBaseBlockEntity blockEntity) { public static boolean canExtractItem(int index, ItemStack stack, Direction direction, MachineBaseBlockEntity blockEntity) {
SlotConfiguration.SlotConfigHolder slotConfigHolder = blockEntity.getSlotConfiguration().getSlotDetails(index); SlotConfiguration.SlotConfigHolder slotConfigHolder = blockEntity.getSlotConfiguration().getSlotDetails(index);
SlotConfiguration.SlotConfig slotConfig = slotConfigHolder.getSideDetail(direction); SlotConfiguration.SlotConfig slotConfig = slotConfigHolder.getSideDetail(direction);
if (slotConfig.getSlotIO().getIoConfig().isExtact()) { if (slotConfig.getSlotIO().getIoConfig().isExtract()) {
return true; return true;
} }
return false; return false;

View file

@ -83,7 +83,7 @@ public abstract class BlockMachineBase extends BaseBlockEntityProvider implement
this.setDefaultState( this.setDefaultState(
this.getStateManager().getDefaultState().with(FACING, Direction.NORTH).with(ACTIVE, false)); this.getStateManager().getDefaultState().with(FACING, Direction.NORTH).with(ACTIVE, false));
} }
BlockWrenchEventHandler.wrenableBlocks.add(this); BlockWrenchEventHandler.wrenchableBlocks.add(this);
} }
public void setFacing(Direction facing, World world, BlockPos pos) { public void setFacing(Direction facing, World world, BlockPos pos) {
@ -180,7 +180,7 @@ public abstract class BlockMachineBase extends BaseBlockEntityProvider implement
ItemStack stack = playerIn.getStackInHand(hand); ItemStack stack = playerIn.getStackInHand(hand);
BlockEntity blockEntity = worldIn.getBlockEntity(pos); BlockEntity blockEntity = worldIn.getBlockEntity(pos);
// We extended BlockTileBase. Thus we should always have blockEntity entity. I hope. // We extended BlockTileBase. Thus, we should always have blockEntity entity. I hope.
if (blockEntity == null) { if (blockEntity == null) {
return ActionResult.PASS; return ActionResult.PASS;
} }
@ -200,7 +200,7 @@ public abstract class BlockMachineBase extends BaseBlockEntityProvider implement
} else if (stack.getItem() instanceof IUpgrade && blockEntity instanceof IUpgradeable upgradeableEntity) { } else if (stack.getItem() instanceof IUpgrade && blockEntity instanceof IUpgradeable upgradeableEntity) {
if (upgradeableEntity.canBeUpgraded()) { if (upgradeableEntity.canBeUpgraded()) {
int inserted = (int) insertItemStacked( int inserted = (int) insertItemStacked(
InventoryStorage.of(upgradeableEntity.getUpgradeInvetory(), null), InventoryStorage.of(upgradeableEntity.getUpgradeInventory(), null),
ItemVariant.of(stack), ItemVariant.of(stack),
stack.getCount() stack.getCount()
); );

View file

@ -36,7 +36,7 @@ import java.util.List;
public class BlockWrenchEventHandler { public class BlockWrenchEventHandler {
public static List<Block> wrenableBlocks = new ArrayList<>(); public static List<Block> wrenchableBlocks = new ArrayList<>();
public static void setup() { public static void setup() {
@ -47,7 +47,7 @@ public class BlockWrenchEventHandler {
} }
if (ToolManager.INSTANCE.canHandleTool(playerEntity.getStackInHand(Hand.MAIN_HAND))) { if (ToolManager.INSTANCE.canHandleTool(playerEntity.getStackInHand(Hand.MAIN_HAND))) {
BlockState state = world.getBlockState(blockHitResult.getBlockPos()); BlockState state = world.getBlockState(blockHitResult.getBlockPos());
if (wrenableBlocks.contains(state.getBlock())) { if (wrenchableBlocks.contains(state.getBlock())) {
Block block = state.getBlock(); Block block = state.getBlock();
block.onUse(state, world, blockHitResult.getBlockPos(), playerEntity, hand, blockHitResult); block.onUse(state, world, blockHitResult.getBlockPos(), playerEntity, hand, blockHitResult);
return ActionResult.SUCCESS; return ActionResult.SUCCESS;
@ -57,5 +57,4 @@ public class BlockWrenchEventHandler {
}); });
} }
} }

View file

@ -47,7 +47,7 @@ import reborncore.common.network.NetworkManager;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
//This does not do the actual chunk loading, just keeps track of what chunks the chunk loader has loaded // This does not do the actual chunk loading, just keeps track of what chunks the chunk loader has loaded
public class ChunkLoaderManager extends PersistentState { public class ChunkLoaderManager extends PersistentState {
public static Codec<List<LoadedChunk>> CODEC = Codec.list(LoadedChunk.CODEC); public static Codec<List<LoadedChunk>> CODEC = Codec.list(LoadedChunk.CODEC);
@ -103,10 +103,10 @@ public class ChunkLoaderManager extends PersistentState {
.findFirst(); .findFirst();
} }
public List<LoadedChunk> getLoadedChunks(World world, BlockPos chunkloader){ public List<LoadedChunk> getLoadedChunks(World world, BlockPos chunkLoader){
return loadedChunks.stream() return loadedChunks.stream()
.filter(loadedChunk -> loadedChunk.getWorld().equals(getWorldName(world))) .filter(loadedChunk -> loadedChunk.getWorld().equals(getWorldName(world)))
.filter(loadedChunk -> loadedChunk.getChunkLoader().equals(chunkloader)) .filter(loadedChunk -> loadedChunk.getChunkLoader().equals(chunkLoader))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }

View file

@ -36,28 +36,29 @@ public @interface Config {
/** /**
* This the category of the config * This the category of the config
* *
* @return * @return {@link String}
*/ */
String category() default "config"; String category() default "config";
/** /**
* This is the key for the config, the default is the field name. * This is the key for the config, the default is the field name.
* *
* @return * @return {@link String}
*/ */
String key() default ""; String key() default "";
/** /**
* This is a comment that will be supplied along with the config, use this to explain what the config does * This is a comment that will be supplied along with the config, use this to explain what the config does
* *
* @return * @return {@link String}
*/ */
String comment() default ""; String comment() default "";
/** /**
* this is the config file name, the default is just config.cgf, use this is you whish to split the config into more than one file. * This is the config file name, the default is {@code config.cgf},
* use this if you wish to split the config into more than one file.
* *
* @return * @return {@link String}
*/ */
String config() default "config"; String config() default "config";

View file

@ -76,7 +76,7 @@ public class Configuration {
readFromJson(configs); readFromJson(configs);
} }
//Save the configs // Save the configs
for (Map.Entry<String, JsonObject> entry : toJson().entrySet()) { for (Map.Entry<String, JsonObject> entry : toJson().entrySet()) {
final File configFile = new File(configDir, entry.getKey() + ".json"); final File configFile = new File(configDir, entry.getKey() + ".json");
final String jsonStr = GSON.toJson(entry.getValue()); final String jsonStr = GSON.toJson(entry.getValue());
@ -123,7 +123,7 @@ public class Configuration {
String key = annotation.key().isEmpty() ? field.getName() : annotation.key(); String key = annotation.key().isEmpty() ? field.getName() : annotation.key();
if (categoryObject.has(key)) { if (categoryObject.has(key)) {
throw new UnsupportedOperationException("Some bad happened, duplicate key found: " + key); throw new UnsupportedOperationException("Something bad happened, duplicate key found: " + key);
} }
JsonObject fieldObject = new JsonObject(); JsonObject fieldObject = new JsonObject();
@ -155,7 +155,7 @@ public class Configuration {
final JsonObject config = configs.get(annotation.config()); final JsonObject config = configs.get(annotation.config());
if (config == null) { if (config == null) {
continue; //Could be possible if a new config is added continue; // Could be possible if a new config is added
} }
JsonObject categoryObject = config.getAsJsonObject(annotation.category()); JsonObject categoryObject = config.getAsJsonObject(annotation.category());

View file

@ -81,7 +81,9 @@ public class RebornRecipe implements Recipe<Inventory>, CustomOutputRecipe {
return type; return type;
} }
// use the RebornIngredient version to ensure stack sizes are checked /**
* use the {@link RebornIngredient} version to ensure stack sizes are checked
*/
@Deprecated @Deprecated
@Override @Override
public DefaultedList<Ingredient> getIngredients() { public DefaultedList<Ingredient> getIngredients() {
@ -105,8 +107,8 @@ public class RebornRecipe implements Recipe<Inventory>, CustomOutputRecipe {
} }
/** /**
* @param blockEntity the blockEntity that is doing the crafting * @param blockEntity {@link BlockEntity} The blockEntity that is doing the crafting
* @return if true the recipe will craft, if false it will not * @return {@code boolean} If true, the recipe will craft, if false it will not
*/ */
public boolean canCraft(BlockEntity blockEntity) { public boolean canCraft(BlockEntity blockEntity) {
if (blockEntity instanceof IRecipeCrafterProvider) { if (blockEntity instanceof IRecipeCrafterProvider) {
@ -116,14 +118,14 @@ public class RebornRecipe implements Recipe<Inventory>, CustomOutputRecipe {
} }
/** /**
* @param blockEntity the blockEntity that is doing the crafting * @param blockEntity {@link BlockEntity} The blockEntity that is doing the crafting
* @return return true if fluid was taken and should craft * @return {@code boolean} Returns true if fluid was taken and should craft
*/ */
public boolean onCraft(BlockEntity blockEntity) { public boolean onCraft(BlockEntity blockEntity) {
return true; return true;
} }
//Done as our recipes do not support these functions, hopefully nothing blidly calls them // Done as our recipes do not support these functions, hopefully nothing blindly calls them
@Deprecated @Deprecated
@Override @Override
@ -143,7 +145,10 @@ public class RebornRecipe implements Recipe<Inventory>, CustomOutputRecipe {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
// Do not call directly, this is implemented only as a fallback. getOutputs() will return all of the outputs /**
* Do not call directly, this is implemented only as a fallback.
* {@link RebornRecipe#getOutputs()} will return all the outputs
*/
@Deprecated @Deprecated
@Override @Override
public ItemStack getOutput() { public ItemStack getOutput() {
@ -158,7 +163,7 @@ public class RebornRecipe implements Recipe<Inventory>, CustomOutputRecipe {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
//Done to try and stop the table from loading it // Done to try and stop the table from loading it
@Override @Override
public boolean isIgnoredInRecipeBook() { public boolean isIgnoredInRecipeBook() {
return true; return true;

View file

@ -107,8 +107,8 @@ public class StackIngredient extends RebornIngredient {
return false; return false;
} }
//Bit of a meme here, as DataFixer likes to use the most basic primative type over using an int. // A bit of a meme here, as DataFixer likes to use the most basic primitive type over using an int.
//So we have to go to json and back on the incoming stack to be sure its using types that match our input. // So we have to go to json and back on the incoming stack to be sure it's using types that match our input.
NbtCompound compoundTag = itemStack.getNbt(); NbtCompound compoundTag = itemStack.getNbt();
JsonElement jsonElement = Dynamic.convert(NbtOps.INSTANCE, JsonOps.INSTANCE, compoundTag); JsonElement jsonElement = Dynamic.convert(NbtOps.INSTANCE, JsonOps.INSTANCE, compoundTag);

View file

@ -114,7 +114,7 @@ public class TagIngredient extends RebornIngredient {
} }
private JsonObject toItemJsonObject() { private JsonObject toItemJsonObject() {
//Tags are not synced across the server so we sync all the items // Tags are not synced across the server, so we sync all the items
JsonObject jsonObject = new JsonObject(); JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("tag_server_sync", true); jsonObject.addProperty("tag_server_sync", true);

View file

@ -33,7 +33,7 @@ public class RecipeSerdeException extends RuntimeException {
public RecipeSerdeException(Identifier identifier, Throwable cause) { public RecipeSerdeException(Identifier identifier, Throwable cause) {
super("Failed to ser/de " + identifier, cause); super("Failed to ser/de " + identifier, cause);
// Dont trust minecraft to log this. // Don't trust minecraft to log this.
LOGGER.error(getMessage(), this); LOGGER.error(getMessage(), this);
} }
} }

View file

@ -129,7 +129,7 @@ public final class FluidValue {
return fromRaw(droplets); return fromRaw(droplets);
} }
} else if (jsonElement.isJsonPrimitive() && jsonElement.getAsJsonPrimitive().isNumber()) { } else if (jsonElement.isJsonPrimitive() && jsonElement.getAsJsonPrimitive().isNumber()) {
//TODO add a warning here // TODO add a warning here
return fromMillibuckets(jsonElement.getAsJsonPrimitive().getAsInt()); return fromMillibuckets(jsonElement.getAsJsonPrimitive().getAsInt());
} }
throw new JsonSyntaxException("Could not parse fluid value"); throw new JsonSyntaxException("Could not parse fluid value");

View file

@ -56,7 +56,8 @@ public class RebornFluidRenderManager implements ClientSpriteRegistryCallback, S
} }
private static void setupFluidRenderer(RebornFluid fluid) { private static void setupFluidRenderer(RebornFluid fluid) {
//Done lazy as we want to ensure we get the sprite at the correct time, but also dont want to be making these calls every time its required. // Done lazy as we want to ensure we get the sprite at the correct time,
// but also don't want to be making these calls every time its required.
TemporaryLazy<Sprite[]> sprites = new TemporaryLazy<>(() -> { TemporaryLazy<Sprite[]> sprites = new TemporaryLazy<>(() -> {
FluidSettings fluidSettings = fluid.getFluidSettings(); FluidSettings fluidSettings = fluid.getFluidSettings();
return new Sprite[]{RenderUtil.getSprite(fluidSettings.getStillTexture()), RenderUtil.getSprite(fluidSettings.getFlowingTexture())}; return new Sprite[]{RenderUtil.getSprite(fluidSettings.getStillTexture()), RenderUtil.getSprite(fluidSettings.getFlowingTexture())};
@ -81,7 +82,7 @@ public class RebornFluidRenderManager implements ClientSpriteRegistryCallback, S
@Override @Override
public void reload(ResourceManager manager) { public void reload(ResourceManager manager) {
//Reset the cached fluid sprites // Reset the cached fluid sprites
spriteMap.forEach((key, value) -> value.reset()); spriteMap.forEach((key, value) -> value.reset());
} }

View file

@ -31,7 +31,6 @@ import net.minecraft.util.registry.Registry;
/** /**
* @author drcrazy * @author drcrazy
*/ */
public class ModSounds { public class ModSounds {
public static SoundEvent BLOCK_DISMANTLE; public static SoundEvent BLOCK_DISMANTLE;

View file

@ -24,17 +24,21 @@
package reborncore.common.misc; package reborncore.common.misc;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.tag.Tag; import net.minecraft.tag.Tag;
/** /**
* Tells if an item, block etc. has a tag solely for compatibility with other mods. * Tells if an item, block etc. has a tag solely for compatibility with other mods.
* For example, several mods have bronze ingots, so TechReborn will tag its bronze ingot with a common tag. * For example, several mods have bronze ingots, so TechReborn will tag its bronze ingot with a common tag.
* @param <T> The type of the object, like {@link net.minecraft.item.Item} or {@link net.minecraft.block.Block}. *
* @param <T> The type of the object, like {@link Item} or {@link Block}.
*/ */
public interface TagConvertible<T> { public interface TagConvertible<T> {
/** /**
* Returns the common tag of this object. * Returns the common tag of this object.
*
* @return the common tag of this object * @return the common tag of this object
*/ */
Tag.Identified<T> asTag(); Tag.Identified<T> asTag();

View file

@ -34,11 +34,11 @@ import java.util.Set;
/** /**
* Basic interface for a multiblock machine part. This is defined as an abstract * Basic interface for a multiblock machine part. This is defined as an abstract
* class as we need the basic functionality of a BlockEntity as well. Preferably, * class as we need the basic functionality of a {@link BlockEntity} as well. Preferably,
* you should derive from MultiblockBlockEntityBase, which does all the hard work * you should derive from {@link MultiblockBlockEntityBase}, which does all the hard work
* for you. * for you.
* <p> *
* {@link MultiblockBlockEntityBase} * <p>{@link MultiblockBlockEntityBase}</p>
*/ */
public abstract class IMultiblockPart extends BlockEntity { public abstract class IMultiblockPart extends BlockEntity {
public static final int INVALID_DISTANCE = Integer.MAX_VALUE; public static final int INVALID_DISTANCE = Integer.MAX_VALUE;
@ -48,22 +48,22 @@ public abstract class IMultiblockPart extends BlockEntity {
} }
/** /**
* @return True if this block is connected to a multiblock controller. False * @return {@code boolean} True if this block is connected to a multiblock controller. False
* otherwise. * otherwise.
*/ */
public abstract boolean isConnected(); public abstract boolean isConnected();
/** /**
* @return The attached multiblock controller for this blockEntity entity. * @return {@link MultiblockControllerBase} The attached multiblock controller for this {@link BlockEntity} entity.
*/ */
public abstract MultiblockControllerBase getMultiblockController(); public abstract MultiblockControllerBase getMultiblockController();
/** /**
* Returns the location of this blockEntity entity in the world, in BlockPos * Returns the location of this {@link BlockEntity} entity in the world, in {@link BlockPos}
* form. * form.
* *
* @return A BlockPos with its x,y,z members set to the location of this * @return A {@link BlockPos} with its x,y,z members set to the location of this
* blockEntity entity in the world. * {@link BlockEntity} entity in the world.
*/ */
public abstract BlockPos getWorldLocation(); public abstract BlockPos getWorldLocation();
@ -72,16 +72,16 @@ public abstract class IMultiblockPart extends BlockEntity {
/** /**
* Called after this block has been attached to a new multiblock controller. * Called after this block has been attached to a new multiblock controller.
* *
* @param newController The new multiblock controller to which this blockEntity entity is * @param newController {@link MultiblockControllerBase} The new multiblock controller to which this
* attached. * {@link BlockEntity} entity is attached.
*/ */
public abstract void onAttached(MultiblockControllerBase newController); public abstract void onAttached(MultiblockControllerBase newController);
/** /**
* Called after this block has been detached from a multiblock controller. * Called after this block has been detached from a multiblock controller.
* *
* @param multiblockController The multiblock controller that no longer controls this blockEntity * @param multiblockController {@link MultiblockControllerBase} The multiblock controller that no longer
* entity. * controls this blockEntity entity.
*/ */
public abstract void onDetached(MultiblockControllerBase multiblockController); public abstract void onDetached(MultiblockControllerBase multiblockController);
@ -91,11 +91,11 @@ public abstract class IMultiblockPart extends BlockEntity {
* NOT mark the part as disconnected. onDetached will be called immediately * NOT mark the part as disconnected. onDetached will be called immediately
* afterwards. * afterwards.
* *
* @param oldController The controller which is orphaning this block. * @param oldController {@link MultiblockControllerBase} The controller which is orphaning this block.
* @param oldControllerSize The number of connected blocks in the controller prior to * @param oldControllerSize {@code int} The number of connected blocks in the controller prior to
* shedding orphans. * shedding orphans.
* @param newControllerSize The number of connected blocks in the controller after * @param newControllerSize {@code int} The number of connected blocks in the controller after
* shedding orphans. * shedding orphans.
* @see #onDetached(MultiblockControllerBase) * @see #onDetached(MultiblockControllerBase)
*/ */
public abstract void onOrphaned(MultiblockControllerBase oldController, int oldControllerSize, public abstract void onOrphaned(MultiblockControllerBase oldController, int oldControllerSize,
@ -108,7 +108,7 @@ public abstract class IMultiblockPart extends BlockEntity {
* not attach this blockEntity entity to it. Override this in your game code! * not attach this blockEntity entity to it. Override this in your game code!
* *
* @return A new Multiblock Controller, derived from * @return A new Multiblock Controller, derived from
* MultiblockControllerBase. * {@link MultiblockControllerBase}.
*/ */
public abstract MultiblockControllerBase createNewMultiblock(); public abstract MultiblockControllerBase createNewMultiblock();
@ -116,7 +116,7 @@ public abstract class IMultiblockPart extends BlockEntity {
* Retrieve the type of multiblock controller which governs this part. Used * Retrieve the type of multiblock controller which governs this part. Used
* to ensure that incompatible multiblocks are not merged. * to ensure that incompatible multiblocks are not merged.
* *
* @return The class/type of the multiblock controller which governs this * @return {@link Class} The class/type of the multiblock controller which governs this
* type of part. * type of part.
*/ */
public abstract Class<? extends MultiblockControllerBase> getMultiblockControllerType(); public abstract Class<? extends MultiblockControllerBase> getMultiblockControllerType();
@ -126,8 +126,8 @@ public abstract class IMultiblockPart extends BlockEntity {
* controller. A special case of attach/detach, done here for efficiency to * controller. A special case of attach/detach, done here for efficiency to
* avoid triggering lots of recalculation logic. * avoid triggering lots of recalculation logic.
* *
* @param newController The new controller into which this blockEntity entity is being * @param newController {@link MultiblockControllerBase} The new controller into which this
* merged. * {@link BlockEntity} entity is being merged.
*/ */
public abstract void onAssimilated(MultiblockControllerBase newController); public abstract void onAssimilated(MultiblockControllerBase newController);
@ -146,7 +146,7 @@ public abstract class IMultiblockPart extends BlockEntity {
public abstract void setUnvisited(); public abstract void setUnvisited();
/** /**
* @return True if this block has been visited by your validation algorithms * @return {@code boolean} True if this block has been visited by your validation algorithms
* since the last reset. * since the last reset.
*/ */
public abstract boolean isVisited(); public abstract boolean isVisited();
@ -166,22 +166,22 @@ public abstract class IMultiblockPart extends BlockEntity {
/** /**
* Is this block the designated save/load & network delegate? * Is this block the designated save/load & network delegate?
* *
* @return Boolean * @return {@code boolean}
*/ */
public abstract boolean isMultiblockSaveDelegate(); public abstract boolean isMultiblockSaveDelegate();
/** /**
* Returns an array containing references to neighboring IMultiblockPart * Returns an array containing references to neighboring {@link IMultiblockPart}
* blockEntity entities. Primarily a utility method. Only works after blockentity * {@link BlockEntity} entities. Primarily a utility method. Only works after {@link BlockEntity}
* construction, so it cannot be used in * construction, so it cannot be used in
* MultiblockControllerBase::attachBlock. * {@link MultiblockControllerBase#attachBlock}.
* <p> * <p>
* This method is chunk-safe on the server; it will not query for parts in * This method is chunk-safe on the server; it will not query for parts in
* chunks that are unloaded. Note that no method is chunk-safe on the * chunks that are unloaded. Note that no method is chunk-safe on the
* client, because ChunkProviderClient is stupid. * client, because ChunkProviderClient is stupid.
* </p>
* *
* @return An array of references to neighboring IMultiblockPart blockEntity * @return An array of references to neighboring {@link IMultiblockPart} {@link BlockEntity} entities.
* entities.
*/ */
public abstract IMultiblockPart[] getNeighboringParts(); public abstract IMultiblockPart[] getNeighboringParts();
@ -194,7 +194,8 @@ public abstract class IMultiblockPart extends BlockEntity {
* actually be part of the machine! They form an outer bounding box for the * actually be part of the machine! They form an outer bounding box for the
* whole machine itself. * whole machine itself.
* *
* @param multiblockControllerBase The controller to which this part is being assembled. * @param multiblockControllerBase {@link MultiblockControllerBase} The controller to
* which this part is being assembled.
*/ */
public abstract void onMachineAssembled(MultiblockControllerBase multiblockControllerBase); public abstract void onMachineAssembled(MultiblockControllerBase multiblockControllerBase);
@ -221,12 +222,12 @@ public abstract class IMultiblockPart extends BlockEntity {
/** /**
* Called when this part should check its neighbors. This method MUST NOT * Called when this part should check its neighbors. This method MUST NOT
* cause additional chunks to load. ALWAYS check to see if a chunk is loaded * cause additional chunks to load. ALWAYS check to see if a chunk is loaded
* before querying for its blockEntity entity This part should inform the * before querying for its {@link BlockEntity} entity This part should inform the
* controller that it is attaching at this time. * controller that it is attaching at this time.
* *
* @return A Set of multiblock controllers to which this object would like * @return A Set of {@link MultiblockControllerBase} to which this object would like
* to attach. It should have attached to one of the controllers in * to attach. It should have attached to one of the controllers in
* this list. Return null if there are no compatible controllers * this list. Return {@code null} if there are no compatible controllers
* nearby. * nearby.
*/ */
public abstract Set<MultiblockControllerBase> attachToNeighbors(); public abstract Set<MultiblockControllerBase> attachToNeighbors();
@ -238,12 +239,12 @@ public abstract class IMultiblockPart extends BlockEntity {
public abstract void assertDetached(); public abstract void assertDetached();
/** /**
* @return True if a part has multiblock game-data saved inside it. * @return {@code boolean} True if a part has multiblock game-data saved inside it.
*/ */
public abstract boolean hasMultiblockSaveData(); public abstract boolean hasMultiblockSaveData();
/** /**
* @return The part's saved multiblock game-data in NBT format, or null if * @return {@link NbtCompound} The part's saved multiblock game-data in NBT format, or null if
* there isn't any. * there isn't any.
*/ */
public abstract NbtCompound getMultiblockSaveData(); public abstract NbtCompound getMultiblockSaveData();

View file

@ -41,7 +41,7 @@ import java.util.List;
import java.util.Set; import java.util.Set;
/** /**
* Base logic class for Multiblock-connected blockEntity entities. Most multiblock * Base logic class for Multiblock-connected {@link BlockEntity} entities. Most multiblock
* machines should derive from this and implement their game logic in certain * machines should derive from this and implement their game logic in certain
* abstract methods. * abstract methods.
*/ */
@ -117,7 +117,7 @@ public abstract class MultiblockBlockEntityBase extends IMultiblockPart implemen
// We can't directly initialize a multiblock controller yet, so we cache // We can't directly initialize a multiblock controller yet, so we cache
// the data here until // the data here until
// we receive a validate() call, which creates the controller and hands // we receive a "validate()" call, which creates the controller and hands
// off the cached data. // off the cached data.
if (data.contains("multiblockData")) { if (data.contains("multiblockData")) {
this.cachedMultiblockData = data.getCompound("multiblockData"); this.cachedMultiblockData = data.getCompound("multiblockData");
@ -142,10 +142,9 @@ public abstract class MultiblockBlockEntityBase extends IMultiblockPart implemen
} }
/** /**
* Called from Minecraft's blockEntity entity loop, after all blockEntity entities have * Called from Minecraft's {@link BlockEntity} entity loop, after all {@link BlockEntity} entities have
* been ticked, as the chunk in which this blockEntity entity is contained is * been ticked, as the chunk in which this {@link BlockEntity} entity is contained is
* unloading. * unloading.
*
*/ */
@Override @Override
public void onUnload() { public void onUnload() {
@ -153,15 +152,20 @@ public abstract class MultiblockBlockEntityBase extends IMultiblockPart implemen
} }
/** /**
* This is called when a block is being marked as valid by the chunk, but
* has not yet fully been placed into the world's BlockEntity cache.
* this.worldObj, xCoord, yCoord and zCoord have been initialized, but any
* attempts to read data about the world can cause infinite loops - if you
* call getBlockEntity on this BlockEntity's coordinate from within
* validate(), you will blow your call stack.
* <p> * <p>
* TL;DR: Here there be dragons. * This is called when a block is being marked as valid by the chunk, but
* has not yet fully been placed into the world's {@link BlockEntity} cache.
* </p>
* *
* <p>
* {@code this.worldObj}, {@code xCoord}, {@code yCoord} and {@code zCoord}
* have been initialized, but any attempts to read data about the world can
* cause infinite loops - if you call {@code getBlockEntity} on this
* {@link BlockEntity}'s coordinate from within {@code validate()}, you will
* blow your call stack.
* </p>
*
* <p>TL;DR: Here there be dragons.</p>
*/ */
@Override @Override
public void cancelRemoval() { public void cancelRemoval() {
@ -182,10 +186,10 @@ public abstract class MultiblockBlockEntityBase extends IMultiblockPart implemen
/** /**
* Override this to easily modify the description packet's data without * Override this to easily modify the description packet's data without
* having to worry about sending the packet itself. Decode this data in * having to worry about sending the packet itself. Decode this data in
* decodeDescriptionPacket. * {@link #decodeDescriptionPacket}.
* *
* @param packetData An NBT compound tag into which you should write your custom * @param packetData {@link NbtCompound} An NBT compound tag into which
* description data. * you should write your custom description data.
*/ */
protected void encodeDescriptionPacket(NbtCompound packetData) { protected void encodeDescriptionPacket(NbtCompound packetData) {
if (this.isMultiblockSaveDelegate() && isConnected()) { if (this.isMultiblockSaveDelegate() && isConnected()) {
@ -196,10 +200,11 @@ public abstract class MultiblockBlockEntityBase extends IMultiblockPart implemen
} }
/** /**
* Override this to easily read in data from a BlockEntity's description * Override this to easily read in data from a {@link BlockEntity}'s description
* packet. Encoded in encodeDescriptionPacket. * packet. Encoded in {@link #encodeDescriptionPacket}.
* *
* @param packetData The NBT data from the blockEntity entity's description packet. * @param packetData {@link NbtCompound} The NBT data from the {@link BlockEntity}
* entity's description packet.
*/ */
protected void decodeDescriptionPacket(NbtCompound packetData) { protected void decodeDescriptionPacket(NbtCompound packetData) {
if (packetData.contains("multiblockData")) { if (packetData.contains("multiblockData")) {
@ -334,7 +339,7 @@ public abstract class MultiblockBlockEntityBase extends IMultiblockPart implemen
getWorld().markDirty(getPos()); getWorld().markDirty(getPos());
} }
// // Helper functions for notifying neighboring blocks // /// Helper functions for notifying neighboring blocks
protected void notifyNeighborsOfBlockChange() { protected void notifyNeighborsOfBlockChange() {
world.updateNeighborsAlways(getPos(), getCachedState().getBlock()); world.updateNeighborsAlways(getPos(), getCachedState().getBlock());
} }
@ -344,9 +349,10 @@ public abstract class MultiblockBlockEntityBase extends IMultiblockPart implemen
} }
// /// Private/Protected Logic Helpers // /// Private/Protected Logic Helpers
/*
* Detaches this block from its controller. Calls detachBlock() and clears /**
* the controller member. * Detaches this block from its controller. Calls {@link MultiblockControllerBase#detachBlock}
* and clears the controller member.
*/ */
protected void detachSelf(boolean chunkUnloading) { protected void detachSelf(boolean chunkUnloading) {
if (this.controller != null) { if (this.controller != null) {

View file

@ -41,8 +41,9 @@ import java.util.Set;
* Conceptually, they are meta-TileEntities. They govern the logic for an * Conceptually, they are meta-TileEntities. They govern the logic for an
* associated group of TileEntities. * associated group of TileEntities.
* <p> * <p>
* Subordinate TileEntities implement the IMultiblockPart class and, generally, * Subordinate TileEntities implement the {@link IMultiblockPart} class and, generally,
* should not have an update() loop. * should not have an update() loop.
* </p>
*/ */
public abstract class MultiblockControllerBase { public abstract class MultiblockControllerBase {
public static final short DIMENSION_UNBOUNDED = -1; public static final short DIMENSION_UNBOUNDED = -1;
@ -124,16 +125,16 @@ public abstract class MultiblockControllerBase {
* multiblock. The part will be notified that the data has been used after * multiblock. The part will be notified that the data has been used after
* this call completes. * this call completes.
* *
* @param part Attached part * @param part {@link IMultiblockPart} Attached part
* @param data The NBT tag containing this controller's data. * @param data {@link NbtCompound} The NBT tag containing this controller's data.
*/ */
public abstract void onAttachedPartWithMultiblockData(IMultiblockPart part, NbtCompound data); public abstract void onAttachedPartWithMultiblockData(IMultiblockPart part, NbtCompound data);
/** /**
* Check if a block is being tracked by this machine. * Check if a block is being tracked by this machine.
* *
* @param blockCoord Coordinate to check. * @param blockCoord {@link BlockPos} Coordinate to check.
* @return True if the blockEntity entity at blockCoord is being tracked by this * @return {@code boolean} True if the blockEntity entity at blockCoord is being tracked by this
* machine, false otherwise. * machine, false otherwise.
*/ */
public boolean hasBlock(BlockPos blockCoord) { public boolean hasBlock(BlockPos blockCoord) {
@ -143,7 +144,7 @@ public abstract class MultiblockControllerBase {
/** /**
* Attach a new part to this machine. * Attach a new part to this machine.
* *
* @param part The part to add. * @param part {@link IMultiblockPart} The part to add.
*/ */
public void attachBlock(IMultiblockPart part) { public void attachBlock(IMultiblockPart part) {
//IMultiblockPart candidate; //IMultiblockPart candidate;
@ -218,7 +219,7 @@ public abstract class MultiblockControllerBase {
* Called when a new part is added to the machine. Good time to register * Called when a new part is added to the machine. Good time to register
* things into lists. * things into lists.
* *
* @param newPart The part being added. * @param newPart {@link IMultiblockPart} The part being added.
*/ */
protected abstract void onBlockAdded(IMultiblockPart newPart); protected abstract void onBlockAdded(IMultiblockPart newPart);
@ -226,7 +227,7 @@ public abstract class MultiblockControllerBase {
* Called when a part is removed from the machine. Good time to clean up * Called when a part is removed from the machine. Good time to clean up
* lists. * lists.
* *
* @param oldPart The part being removed. * @param oldPart {@link IMultiblockPart} The part being removed.
*/ */
protected abstract void onBlockRemoved(IMultiblockPart oldPart); protected abstract void onBlockRemoved(IMultiblockPart oldPart);
@ -257,7 +258,7 @@ public abstract class MultiblockControllerBase {
* Callback whenever a part is removed (or will very shortly be removed) * Callback whenever a part is removed (or will very shortly be removed)
* from a controller. Do housekeeping/callbacks, also nulls min/max coords. * from a controller. Do housekeeping/callbacks, also nulls min/max coords.
* *
* @param part The part being removed. * @param part {@link IMultiblockPart} The part being removed.
*/ */
private void onDetachBlock(IMultiblockPart part) { private void onDetachBlock(IMultiblockPart part) {
// Strip out this part // Strip out this part
@ -276,11 +277,11 @@ public abstract class MultiblockControllerBase {
/** /**
* Call to detach a block from this machine. Generally, this should be * Call to detach a block from this machine. Generally, this should be
* called when the blockEntity entity is being released, e.g. on block destruction. * called when the {@link BlockEntity} entity is being released, e.g. on block destruction.
* *
* @param part The part to detach from this machine. * @param part {@link IMultiblockPart} The part to detach from this machine.
* @param chunkUnloading Is this entity detaching due to the chunk unloading? If true, * @param chunkUnloading {@code boolean} Is this entity detaching due to the chunk unloading? If true,
* the multiblock will be paused instead of broken. * the multiblock will be paused instead of broken.
*/ */
public void detachBlock(IMultiblockPart part, boolean chunkUnloading) { public void detachBlock(IMultiblockPart part, boolean chunkUnloading) {
if (chunkUnloading && this.assemblyState == AssemblyState.Assembled) { if (chunkUnloading && this.assemblyState == AssemblyState.Assembled) {
@ -316,7 +317,7 @@ public abstract class MultiblockControllerBase {
* blocks to actually assemble it. This isn't as simple as xmax*ymax*zmax * blocks to actually assemble it. This isn't as simple as xmax*ymax*zmax
* for non-cubic machines or for machines with hollow/complex interiors. * for non-cubic machines or for machines with hollow/complex interiors.
* *
* @return The minimum number of blocks connected to the machine for it to * @return {@code int} The minimum number of blocks connected to the machine for it to
* be assembled. * be assembled.
*/ */
protected abstract int getMinimumNumberOfBlocksForAssembledMachine(); protected abstract int getMinimumNumberOfBlocksForAssembledMachine();
@ -326,7 +327,7 @@ public abstract class MultiblockControllerBase {
* (DIMENSION_UNBOUNDED) to disable dimension checking in X. (This is not * (DIMENSION_UNBOUNDED) to disable dimension checking in X. (This is not
* recommended.) * recommended.)
* *
* @return The maximum X dimension size of the machine, or -1 * @return {@code int} The maximum X dimension size of the machine, or -1
*/ */
protected abstract int getMaximumXSize(); protected abstract int getMaximumXSize();
@ -335,7 +336,7 @@ public abstract class MultiblockControllerBase {
* (DIMENSION_UNBOUNDED) to disable dimension checking in X. (This is not * (DIMENSION_UNBOUNDED) to disable dimension checking in X. (This is not
* recommended.) * recommended.)
* *
* @return The maximum Z dimension size of the machine, or -1 * @return {@code int} The maximum Z dimension size of the machine, or -1
*/ */
protected abstract int getMaximumZSize(); protected abstract int getMaximumZSize();
@ -344,7 +345,7 @@ public abstract class MultiblockControllerBase {
* (DIMENSION_UNBOUNDED) to disable dimension checking in X. (This is not * (DIMENSION_UNBOUNDED) to disable dimension checking in X. (This is not
* recommended.) * recommended.)
* *
* @return The maximum Y dimension size of the machine, or -1 * @return {@code int} The maximum Y dimension size of the machine, or -1
*/ */
protected abstract int getMaximumYSize(); protected abstract int getMaximumYSize();
@ -352,7 +353,7 @@ public abstract class MultiblockControllerBase {
* Returns the minimum X dimension size of the machine. Must be at least 1, * Returns the minimum X dimension size of the machine. Must be at least 1,
* because nothing else makes sense. * because nothing else makes sense.
* *
* @return The minimum X dimension size of the machine * @return {@code int} The minimum X dimension size of the machine
*/ */
protected int getMinimumXSize() { protected int getMinimumXSize() {
return 1; return 1;
@ -362,7 +363,7 @@ public abstract class MultiblockControllerBase {
* Returns the minimum Y dimension size of the machine. Must be at least 1, * Returns the minimum Y dimension size of the machine. Must be at least 1,
* because nothing else makes sense. * because nothing else makes sense.
* *
* @return The minimum Y dimension size of the machine * @return {@code int} The minimum Y dimension size of the machine
*/ */
protected int getMinimumYSize() { protected int getMinimumYSize() {
return 1; return 1;
@ -372,15 +373,15 @@ public abstract class MultiblockControllerBase {
* Returns the minimum Z dimension size of the machine. Must be at least 1, * Returns the minimum Z dimension size of the machine. Must be at least 1,
* because nothing else makes sense. * because nothing else makes sense.
* *
* @return The minimum Z dimension size of the machine * @return {@code int} The minimum Z dimension size of the machine
*/ */
protected int getMinimumZSize() { protected int getMinimumZSize() {
return 1; return 1;
} }
/** /**
* @return An exception representing the last error encountered when trying * @return {@link MultiblockValidationException} An exception representing the last error encountered when trying
* to assemble this multiblock, or null if there is no error. * to assemble this multiblock, or {@code null} if there is no error.
*/ */
public MultiblockValidationException getLastValidationException() { public MultiblockValidationException getLastValidationException() {
return lastValidationException; return lastValidationException;
@ -389,6 +390,8 @@ public abstract class MultiblockControllerBase {
/** /**
* Checks if a machine is whole. If not, throws an exception with the reason * Checks if a machine is whole. If not, throws an exception with the reason
* why. * why.
*
* @throws MultiblockValidationException if the machine is not whole.
*/ */
protected abstract void isMachineWhole() throws MultiblockValidationException; protected abstract void isMachineWhole() throws MultiblockValidationException;
@ -396,7 +399,6 @@ public abstract class MultiblockControllerBase {
* Check if the machine is whole or not. If the machine was not whole, but * Check if the machine is whole or not. If the machine was not whole, but
* now is, assemble the machine. If the machine was whole, but no longer is, * now is, assemble the machine. If the machine was whole, but no longer is,
* disassemble the machine. * disassemble the machine.
*
*/ */
public void checkIfMachineIsWhole() { public void checkIfMachineIsWhole() {
AssemblyState oldState = this.assemblyState; AssemblyState oldState = this.assemblyState;
@ -422,8 +424,10 @@ public abstract class MultiblockControllerBase {
/** /**
* Called when a machine becomes "whole" and should begin functioning as a * Called when a machine becomes "whole" and should begin functioning as a
* game-logically finished machine. Calls onMachineAssembled on all attached * game-logically finished machine. Calls {@link #onMachineAssembled} on all attached
* parts. * parts.
*
* @param oldState {@link AssemblyState} The previous state of the machine.
*/ */
private void assembleMachine(AssemblyState oldState) { private void assembleMachine(AssemblyState oldState) {
for (IMultiblockPart part : connectedParts) { for (IMultiblockPart part : connectedParts) {
@ -441,7 +445,7 @@ public abstract class MultiblockControllerBase {
/** /**
* Called when the machine needs to be disassembled. It is not longer * Called when the machine needs to be disassembled. It is not longer
* "whole" and should not be functional, usually as a result of a block * "whole" and should not be functional, usually as a result of a block
* being removed. Calls onMachineBroken on all attached parts. * being removed. Calls {@link IMultiblockPart#onMachineBroken} on all attached parts.
*/ */
private void disassembleMachine() { private void disassembleMachine() {
for (IMultiblockPart part : connectedParts) { for (IMultiblockPart part : connectedParts) {
@ -453,10 +457,12 @@ public abstract class MultiblockControllerBase {
} }
/** /**
* Assimilate another controller into this controller. Acquire all of the * Assimilate another controller into this controller. Acquire all the
* other controller's blocks and attach them to this one. * other controller's blocks and attach them to this one.
* *
* @param other The controller to merge into this one. * @param other {@link MultiblockControllerBase} The controller to merge into this one.
* @throws IllegalArgumentException if the controller with the lowest minimum-coord value does not consume
* the one with the higher value.
*/ */
public void assimilate(MultiblockControllerBase other) { public void assimilate(MultiblockControllerBase other) {
BlockPos otherReferenceCoord = other.getReferenceCoord(); BlockPos otherReferenceCoord = other.getReferenceCoord();
@ -467,7 +473,7 @@ public abstract class MultiblockControllerBase {
Set<IMultiblockPart> partsToAcquire = new HashSet<>(other.connectedParts); Set<IMultiblockPart> partsToAcquire = new HashSet<>(other.connectedParts);
// releases all blocks and references gently so they can be incorporated into another multiblock // releases all blocks and references gently, so they can be incorporated into another multiblock
other._onAssimilated(this); other._onAssimilated(this);
for (IMultiblockPart acquiredPart : partsToAcquire) { for (IMultiblockPart acquiredPart : partsToAcquire) {
@ -489,7 +495,7 @@ public abstract class MultiblockControllerBase {
* Called when this machine is consumed by another controller. Essentially, * Called when this machine is consumed by another controller. Essentially,
* forcibly tear down this object. * forcibly tear down this object.
* *
* @param otherController The controller consuming this controller. * @param otherController {@link MultiblockControllerBase} The controller consuming this controller.
*/ */
private void _onAssimilated(MultiblockControllerBase otherController) { private void _onAssimilated(MultiblockControllerBase otherController) {
if (referenceCoord == null) { return; } if (referenceCoord == null) { return; }
@ -509,7 +515,7 @@ public abstract class MultiblockControllerBase {
* Callback. Called after this controller assimilates all the blocks from * Callback. Called after this controller assimilates all the blocks from
* another controller. Use this to absorb that controller's game data. * another controller. Use this to absorb that controller's game data.
* *
* @param assimilated The controller whose uniqueness was added to our own. * @param assimilated {@link MultiblockControllerBase} The controller whose uniqueness was added to our own.
*/ */
protected abstract void onAssimilate(MultiblockControllerBase assimilated); protected abstract void onAssimilate(MultiblockControllerBase assimilated);
@ -518,7 +524,7 @@ public abstract class MultiblockControllerBase {
* controller. All blocks have been stripped out of this object and handed * controller. All blocks have been stripped out of this object and handed
* over to the other controller. This is intended primarily for cleanup. * over to the other controller. This is intended primarily for cleanup.
* *
* @param assimilator The controller which has assimilated this controller. * @param assimilator {@link MultiblockControllerBase} The controller which has assimilated this controller.
*/ */
protected abstract void onAssimilated(MultiblockControllerBase assimilator); protected abstract void onAssimilated(MultiblockControllerBase assimilator);
@ -553,7 +559,7 @@ public abstract class MultiblockControllerBase {
for (int x = minChunkX; x <= maxChunkX; x++) { for (int x = minChunkX; x <= maxChunkX; x++) {
for (int z = minChunkZ; z <= maxChunkZ; z++) { for (int z = minChunkZ; z <= maxChunkZ; z++) {
// Ensure that we save our data, even if the our save // Ensure that we save our data, even if our save
// delegate is in has no TEs. // delegate is in has no TEs.
WorldChunk chunkToSave = this.worldObj.getChunk(x, z); WorldChunk chunkToSave = this.worldObj.getChunk(x, z);
chunkToSave.needsSaving(); chunkToSave.needsSaving();
@ -565,12 +571,12 @@ public abstract class MultiblockControllerBase {
} }
/** /**
* The server-side update loop! Use this similarly to a BlockEntity's update * The server-side update loop! Use this similarly to a {@link BlockEntity}'s update
* loop. You do not need to call your superclass' update() if you're * loop. You do not need to call your superclass' {@code update()} if you're
* directly derived from MultiblockControllerBase. This is a callback. Note * directly derived from {@link MultiblockControllerBase}. This is a callback. Note
* that this will only be called when the machine is assembled. * that this will only be called when the machine is assembled.
* *
* @return True if the multiblock should save data, i.e. its internal game * @return {@code boolean} True if the multiblock should save data, i.e. its internal game
* state has changed. False otherwise. * state has changed. False otherwise.
*/ */
protected abstract boolean updateServer(); protected abstract boolean updateServer();
@ -586,11 +592,11 @@ public abstract class MultiblockControllerBase {
/** /**
* The "frame" consists of the outer edges of the machine, plus the corners. * The "frame" consists of the outer edges of the machine, plus the corners.
* *
* @param world World object for the world in which this controller is * @param world {@link World} The object for the world in which this controller is
* located. * located.
* @param x X coordinate of the block being tested * @param x {@code int} X coordinate of the block being tested
* @param y Y coordinate of the block being tested * @param y {@code int} Y coordinate of the block being tested
* @param z Z coordinate of the block being tested * @param z {@code int} Z coordinate of the block being tested
* @throws MultiblockValidationException if the tested block is not allowed on the machine's frame * @throws MultiblockValidationException if the tested block is not allowed on the machine's frame
*/ */
protected void isBlockGoodForFrame(World world, int x, int y, int z) throws MultiblockValidationException { protected void isBlockGoodForFrame(World world, int x, int y, int z) throws MultiblockValidationException {
@ -601,11 +607,11 @@ public abstract class MultiblockControllerBase {
/** /**
* The top consists of the top face, minus the edges. * The top consists of the top face, minus the edges.
* *
* @param world World object for the world in which this controller is * @param world {@link World} The object for the world in which this controller is
* located. * located.
* @param x X coordinate of the block being tested * @param x {@code int} X coordinate of the block being tested
* @param y Y coordinate of the block being tested * @param y {@code int} Y coordinate of the block being tested
* @param z Z coordinate of the block being tested * @param z {@code int} Z coordinate of the block being tested
* @throws MultiblockValidationException if the tested block is not allowed on the machine's top face * @throws MultiblockValidationException if the tested block is not allowed on the machine's top face
*/ */
protected void isBlockGoodForTop(World world, int x, int y, int z) throws MultiblockValidationException { protected void isBlockGoodForTop(World world, int x, int y, int z) throws MultiblockValidationException {
@ -616,13 +622,13 @@ public abstract class MultiblockControllerBase {
/** /**
* The bottom consists of the bottom face, minus the edges. * The bottom consists of the bottom face, minus the edges.
* *
* @param world World object for the world in which this controller is * @param world {@link World} The object for the world in which this controller is
* located. * located.
* @param x X coordinate of the block being tested * @param x {@code int} X coordinate of the block being tested
* @param y Y coordinate of the block being tested * @param y {@code int} Y coordinate of the block being tested
* @param z Z coordinate of the block being tested * @param z {@code int} Z coordinate of the block being tested
* @throws MultiblockValidationException if the tested block is not allowed on the machine's bottom * @throws MultiblockValidationException if the tested block is not allowed on the machine's bottom
* face * face
*/ */
protected void isBlockGoodForBottom(World world, int x, int y, int z) throws MultiblockValidationException { protected void isBlockGoodForBottom(World world, int x, int y, int z) throws MultiblockValidationException {
throw new MultiblockValidationException( throw new MultiblockValidationException(
@ -630,15 +636,15 @@ public abstract class MultiblockControllerBase {
} }
/** /**
* The sides consists of the N/E/S/W-facing faces, minus the edges. * The sides consist of the N/E/S/W-facing faces, minus the edges.
* *
* @param world World object for the world in which this controller is * @param world {@link World} The object for the world in which this controller is
* located. * located.
* @param x X coordinate of the block being tested * @param x {@code int} X coordinate of the block being tested
* @param y Y coordinate of the block being tested * @param y {@code int} Y coordinate of the block being tested
* @param z Z coordinate of the block being tested * @param z {@code int} Z coordinate of the block being tested
* @throws MultiblockValidationException if the tested block is not allowed on the machine's side * @throws MultiblockValidationException if the tested block is not allowed on the machine's side
* faces * faces
*/ */
protected void isBlockGoodForSides(World world, int x, int y, int z) throws MultiblockValidationException { protected void isBlockGoodForSides(World world, int x, int y, int z) throws MultiblockValidationException {
throw new MultiblockValidationException( throw new MultiblockValidationException(
@ -648,11 +654,11 @@ public abstract class MultiblockControllerBase {
/** /**
* The interior is any block that does not touch blocks outside the machine. * The interior is any block that does not touch blocks outside the machine.
* *
* @param world World object for the world in which this controller is * @param world {@link World} The object for the world in which this controller is
* located. * located.
* @param x X coordinate of the block being tested * @param x {@code int} X coordinate of the block being tested
* @param y Y coordinate of the block being tested * @param y {@code int} Y coordinate of the block being tested
* @param z Z coordinate of the block being tested * @param z {@code int} Z coordinate of the block being tested
* @throws MultiblockValidationException if the tested block is not allowed in the machine's interior * @throws MultiblockValidationException if the tested block is not allowed in the machine's interior
*/ */
protected void isBlockGoodForInterior(World world, int x, int y, int z) throws MultiblockValidationException { protected void isBlockGoodForInterior(World world, int x, int y, int z) throws MultiblockValidationException {
@ -661,7 +667,7 @@ public abstract class MultiblockControllerBase {
} }
/** /**
* @return The reference coordinate, the block with the lowest x, y, z * @return {@link BlockPos} The reference coordinate, the block with the lowest x, y, z
* coordinates, evaluated in that order. * coordinates, evaluated in that order.
*/ */
public BlockPos getReferenceCoord() { public BlockPos getReferenceCoord() {
@ -672,7 +678,7 @@ public abstract class MultiblockControllerBase {
} }
/** /**
* @return The number of blocks connected to this controller. * @return {@code int} The number of blocks connected to this controller.
*/ */
public int getNumConnectedBlocks() { public int getNumConnectedBlocks() {
return connectedParts.size(); return connectedParts.size();
@ -718,7 +724,7 @@ public abstract class MultiblockControllerBase {
} }
/** /**
* @return The minimum bounding-box coordinate containing this machine's * @return {@link BlockPos} The minimum bounding-box coordinate containing this machine's
* blocks. * blocks.
*/ */
public BlockPos getMinimumCoord() { public BlockPos getMinimumCoord() {
@ -729,7 +735,7 @@ public abstract class MultiblockControllerBase {
} }
/** /**
* @return The maximum bounding-box coordinate containing this machine's * @return {@link BlockPos} The maximum bounding-box coordinate containing this machine's
* blocks. * blocks.
*/ */
public BlockPos getMaximumCoord() { public BlockPos getMaximumCoord() {
@ -740,23 +746,23 @@ public abstract class MultiblockControllerBase {
} }
/** /**
* Called when the save delegate's blockEntity entity is being asked for its * Called when the save delegate's {@link BlockEntity} entity is being asked for its
* description packet * description packet
* *
* @param data A fresh compound tag to write your multiblock data into * @param data {@link NbtCompound} A fresh compound tag to write your multiblock data into
*/ */
public abstract void formatDescriptionPacket(NbtCompound data); public abstract void formatDescriptionPacket(NbtCompound data);
/** /**
* Called when the save delegate's blockEntity entity receiving a description * Called when the save delegate's {@link BlockEntity} entity receiving a description
* packet * packet
* *
* @param data A compound tag containing multiblock data to import * @param data {@link NbtCompound} A compound tag containing multiblock data to import
*/ */
public abstract void decodeDescriptionPacket(NbtCompound data); public abstract void decodeDescriptionPacket(NbtCompound data);
/** /**
* @return True if this controller has no associated blocks, false otherwise * @return {@code boolean} True if this controller has no associated blocks, false otherwise
*/ */
public boolean isEmpty() { public boolean isEmpty() {
return connectedParts.isEmpty(); return connectedParts.isEmpty();
@ -767,9 +773,12 @@ public abstract class MultiblockControllerBase {
* become the new multiblock master when the two multiblocks are adjacent. * become the new multiblock master when the two multiblocks are adjacent.
* Assumes both multiblocks are the same type. * Assumes both multiblocks are the same type.
* *
* @param otherController The other multiblock controller. * @param otherController {@link MultiblockControllerBase} The other multiblock controller.
* @return True if this multiblock should consume the other, false * @return {@code boolean} True if this multiblock should consume the other, false
* otherwise. * otherwise.
* @throws IllegalArgumentException The two multiblocks have different master classes
* @throws IllegalArgumentException The two controllers with the same reference coord both
* have valid parts
*/ */
public boolean shouldConsume(MultiblockControllerBase otherController) { public boolean shouldConsume(MultiblockControllerBase otherController) {
if (!otherController.getClass().equals(getClass())) { if (!otherController.getClass().equals(getClass())) {
@ -840,7 +849,7 @@ public abstract class MultiblockControllerBase {
} }
/** /**
* Checks all of the parts in the controller. If any are dead or do not * Checks all the parts in the controller. If any are dead or do not
* exist in the world, they are removed. * exist in the world, they are removed.
*/ */
private void auditParts() { private void auditParts() {
@ -861,7 +870,7 @@ public abstract class MultiblockControllerBase {
* Called when this machine may need to check for blocks that are no longer * Called when this machine may need to check for blocks that are no longer
* physically connected to the reference coordinate. * physically connected to the reference coordinate.
* *
* @return Set with removed parts * @return {@link Set} Set with removed {@link IMultiblockPart}s.
*/ */
public Set<IMultiblockPart> checkForDisconnections() { public Set<IMultiblockPart> checkForDisconnections() {
if (!this.shouldCheckForDisconnections) { if (!this.shouldCheckForDisconnections) {
@ -980,10 +989,10 @@ public abstract class MultiblockControllerBase {
} }
/** /**
* Detach all parts. Return a set of all parts which still have a valid blockEntity * Detach all parts. Return a set of all parts which still have a valid {@link BlockEntity}
* entity. Chunk-safe. * entity. Chunk-safe.
* *
* @return A set of all parts which still have a valid blockEntity entity. * @return {@link Set} A set of all {@link IMultiblockPart}s which still have a valid {@link BlockEntity} entity.
*/ */
public Set<IMultiblockPart> detachAllBlocks() { public Set<IMultiblockPart> detachAllBlocks() {
if (worldObj == null) { if (worldObj == null) {
@ -1002,7 +1011,7 @@ public abstract class MultiblockControllerBase {
} }
/** /**
* @return True if this multiblock machine is considered assembled and ready * @return {@code boolean} True if this multiblock machine is considered assembled and ready
* to go. * to go.
*/ */
public boolean isAssembled() { public boolean isAssembled() {
@ -1035,12 +1044,12 @@ public abstract class MultiblockControllerBase {
/** /**
* Marks the reference coord dirty & updateable. * Marks the reference coord dirty & updateable.
* <p> * <p>
* On the server, this will mark the for a data-update, so that nearby * On the server, this will mark the for a data-update, so that nearby
* clients will receive an updated description packet from the server after * clients will receive an updated description packet from the server after
* a short time. The block's chunk will also be marked dirty and the block's * a short time. The block's chunk will also be marked dirty and the block's
* chunk will be saved to disk the next time chunks are saved. * chunk will be saved to disk the next time chunks are saved.
* <p> * </p>
* On the client, this will mark the block for a rendering update. * <p>On the client, this will mark the block for a rendering update.</p>
*/ */
protected void markReferenceCoordForUpdate() { protected void markReferenceCoordForUpdate() {
BlockPos rc = getReferenceCoord(); BlockPos rc = getReferenceCoord();
@ -1053,11 +1062,11 @@ public abstract class MultiblockControllerBase {
/** /**
* Marks the reference coord dirty. * Marks the reference coord dirty.
* <p> * <p>
* On the server, this marks the reference coord's chunk as dirty; the block * On the server, this marks the reference coord's chunk as dirty; the block
* (and chunk) will be saved to disk the next time chunks are saved. This * (and chunk) will be saved to disk the next time chunks are saved. This
* does NOT mark it dirty for a description-packet update. * does NOT mark it dirty for a description-packet update.
* <p> * </p>
* On the client, does nothing. * <p>On the client, does nothing.</p>
* *
* @see MultiblockControllerBase#markReferenceCoordForUpdate() * @see MultiblockControllerBase#markReferenceCoordForUpdate()
*/ */

View file

@ -25,7 +25,7 @@
package reborncore.common.multiblock; package reborncore.common.multiblock;
/** /**
* In your mod, subscribe this on both the client and server sides side to * In your mod, subscribe this on both the client and server sides to
* handle chunk load events for your multiblock machines. Chunks can load * handle chunk load events for your multiblock machines. Chunks can load
* asynchronously in environments like MCPC+, so we cannot behavior any blocks * asynchronously in environments like MCPC+, so we cannot behavior any blocks
* that are in chunks which are still loading. * that are in chunks which are still loading.

View file

@ -44,7 +44,7 @@ public class MultiblockRegistry {
/** /**
* Called before Tile Entities are ticked in the world. Do bookkeeping here. * Called before Tile Entities are ticked in the world. Do bookkeeping here.
* *
* @param world The world being ticked * @param world {@link World} The world being ticked
*/ */
public static void tickStart(World world) { public static void tickStart(World world) {
if (registries.containsKey(world)) { if (registries.containsKey(world)) {
@ -57,8 +57,8 @@ public class MultiblockRegistry {
/** /**
* Called when the world has finished loading a chunk. * Called when the world has finished loading a chunk.
* *
* @param world The world which has finished loading a chunk * @param world {@link World} The world which has finished loading a chunk
* @param chunk Loaded chunk * @param chunk {@link Chunk} Loaded chunk
*/ */
public static void onChunkLoaded(World world, Chunk chunk) { public static void onChunkLoaded(World world, Chunk chunk) {
if (registries.containsKey(world)) { if (registries.containsKey(world)) {
@ -70,8 +70,8 @@ public class MultiblockRegistry {
* Register a new part in the system. The part has been created either * Register a new part in the system. The part has been created either
* through user action or via a chunk loading. * through user action or via a chunk loading.
* *
* @param world The world into which this part is loading. * @param world {@link World} The world into which this part is loading.
* @param part The part being loaded. * @param part {@link IMultiblockPart} The part being loaded.
*/ */
public static void onPartAdded(World world, IMultiblockPart part) { public static void onPartAdded(World world, IMultiblockPart part) {
MultiblockWorldRegistry registry = getOrCreateRegistry(world); MultiblockWorldRegistry registry = getOrCreateRegistry(world);
@ -81,8 +81,8 @@ public class MultiblockRegistry {
/** /**
* Call to remove a part from world lists. * Call to remove a part from world lists.
* *
* @param world The world from which a multiblock part is being removed. * @param world {@link World} The world from which a multiblock part is being removed.
* @param part The part being removed. * @param part {@link IMultiblockPart} The part being removed.
*/ */
public static void onPartRemovedFromWorld(World world, IMultiblockPart part) { public static void onPartRemovedFromWorld(World world, IMultiblockPart part) {
if (registries.containsKey(world)) { if (registries.containsKey(world)) {
@ -95,7 +95,7 @@ public class MultiblockRegistry {
* Called whenever a world is unloaded. Unload the relevant registry, if we * Called whenever a world is unloaded. Unload the relevant registry, if we
* have one. * have one.
* *
* @param world The world being unloaded. * @param world {@link World} The world being unloaded.
*/ */
public static void onWorldUnloaded(World world) { public static void onWorldUnloaded(World world) {
if (registries.containsKey(world)) { if (registries.containsKey(world)) {
@ -108,14 +108,14 @@ public class MultiblockRegistry {
* Call to mark a controller as dirty. Dirty means that parts have been * Call to mark a controller as dirty. Dirty means that parts have been
* added or removed this tick. * added or removed this tick.
* *
* @param world The world containing the multiblock * @param world {@link World} The world containing the multiblock
* @param controller The dirty controller * @param controller {@link MultiblockControllerBase} The dirty controller
*/ */
public static void addDirtyController(World world, MultiblockControllerBase controller) { public static void addDirtyController(World world, MultiblockControllerBase controller) {
if (registries.containsKey(world)) { if (registries.containsKey(world)) {
registries.get(world).addDirtyController(controller); registries.get(world).addDirtyController(controller);
} else { } else {
RebornCore.LOGGER.error("Adding a dirty controller to a world that has no registered controllers! This is most likey not an issue with reborn core, please check the full log file for more infomation!"); RebornCore.LOGGER.error("Adding a dirty controller to a world that has no registered controllers! This is most likely not an issue with reborn core, please check the full log file for more information!");
} }
} }
@ -123,8 +123,8 @@ public class MultiblockRegistry {
* Call to mark a controller as dead. It should only be marked as dead when * Call to mark a controller as dead. It should only be marked as dead when
* it has no connected parts. It will be removed after the next world tick. * it has no connected parts. It will be removed after the next world tick.
* *
* @param world The world formerly containing the multiblock * @param world {@link World} The world formerly containing the multiblock
* @param controller The dead controller * @param controller {@link MultiblockControllerBase} The dead controller
*/ */
public static void addDeadController(World world, MultiblockControllerBase controller) { public static void addDeadController(World world, MultiblockControllerBase controller) {
if (registries.containsKey(world)) { if (registries.containsKey(world)) {
@ -137,9 +137,9 @@ public class MultiblockRegistry {
} }
/** /**
* @param world The world whose controllers you wish to retrieve. * @param world {@link World} The world whose controllers you wish to retrieve.
* @return An unmodifiable set of controllers active in the given world, or * @return {@link Set} An unmodifiable set of {@link MultiblockControllerBase}
* null if there are none. * controllers active in the given world, or null if there are none.
*/ */
public static Set<MultiblockControllerBase> getControllersFromWorld(World world) { public static Set<MultiblockControllerBase> getControllersFromWorld(World world) {
if (registries.containsKey(world)) { if (registries.containsKey(world)) {

View file

@ -311,7 +311,7 @@ public class MultiblockWorldRegistry {
* during the next tick. If the chunk is not loaded, it will be added to a * during the next tick. If the chunk is not loaded, it will be added to a
* list of objects waiting for a chunkload. * list of objects waiting for a chunkload.
* *
* @param part The part which is being added to this world. * @param part {@link IMultiblockPart} The part which is being added to this world.
*/ */
public void onPartAdded(IMultiblockPart part) { public void onPartAdded(IMultiblockPart part) {
BlockPos pos = part.getWorldLocation(); BlockPos pos = part.getWorldLocation();
@ -342,7 +342,7 @@ public class MultiblockWorldRegistry {
* chunk unloads. This part is removed from any lists in which it may be, * chunk unloads. This part is removed from any lists in which it may be,
* and its machine is marked for recalculation. * and its machine is marked for recalculation.
* *
* @param part The part which is being removed. * @param part {@link IMultiblockPart} The part which is being removed.
*/ */
public void onPartRemovedFromWorld(IMultiblockPart part) { public void onPartRemovedFromWorld(IMultiblockPart part) {
BlockPos pos = part.getWorldLocation(); BlockPos pos = part.getWorldLocation();
@ -394,12 +394,11 @@ public class MultiblockWorldRegistry {
} }
/** /**
* Called when a chunk has finished loading. Adds all of the parts which are * Called when a chunk has finished loading. Adds all the parts which are
* awaiting load to the list of parts which are orphans and therefore will * awaiting load to the list of parts which are orphans and therefore will
* be added to machines after the next world tick. * be added to the machines after the next world tick.
* *
* @param chunk Chunk that was * @param chunk {@link Chunk} Chunk that was loaded
* loaded
*/ */
public void onChunkLoaded(Chunk chunk) { public void onChunkLoaded(Chunk chunk) {
int chunkHash = chunk.getPos().hashCode(); int chunkHash = chunk.getPos().hashCode();
@ -418,7 +417,7 @@ public class MultiblockWorldRegistry {
* next world tick. Note that a controller must shed all of its blocks * next world tick. Note that a controller must shed all of its blocks
* before being marked as dead, or the system will complain at you. * before being marked as dead, or the system will complain at you.
* *
* @param deadController The controller which is dead. * @param deadController {@link MultiblockControllerBase} The controller which is dead.
*/ */
public void addDeadController(MultiblockControllerBase deadController) { public void addDeadController(MultiblockControllerBase deadController) {
this.deadControllers.add(deadController); this.deadControllers.add(deadController);
@ -429,7 +428,7 @@ public class MultiblockWorldRegistry {
* changed, and it must be re-checked for assembly and, possibly, for * changed, and it must be re-checked for assembly and, possibly, for
* orphans. * orphans.
* *
* @param dirtyController The dirty controller. * @param dirtyController {@link MultiblockControllerBase} The dirty controller.
*/ */
public void addDirtyController(MultiblockControllerBase dirtyController) { public void addDirtyController(MultiblockControllerBase dirtyController) {
this.dirtyControllers.add(dirtyController); this.dirtyControllers.add(dirtyController);
@ -439,8 +438,8 @@ public class MultiblockWorldRegistry {
* Use this only if you know what you're doing. You should rarely need to * Use this only if you know what you're doing. You should rarely need to
* iterate over all controllers in a world! * iterate over all controllers in a world!
* *
* @return An (unmodifiable) set of controllers which are active in this * @return {@link Set} An (unmodifiable) set of {@link MultiblockControllerBase}
* world. * controllers which are active in this world.
*/ */
public Set<MultiblockControllerBase> getControllers() { public Set<MultiblockControllerBase> getControllers() {
return Collections.unmodifiableSet(controllers); return Collections.unmodifiableSet(controllers);

View file

@ -121,7 +121,7 @@ public abstract class RectangularMultiblockBlockEntityBase extends MultiblockBlo
} }
} }
// /// Validation Helpers (IMultiblockPart) // Validation Helpers (IMultiblockPart)
public abstract void isGoodForFrame() throws MultiblockValidationException; public abstract void isGoodForFrame() throws MultiblockValidationException;
public abstract void isGoodForSides() throws MultiblockValidationException; public abstract void isGoodForSides() throws MultiblockValidationException;

View file

@ -37,8 +37,8 @@ public abstract class RectangularMultiblockControllerBase extends MultiblockCont
} }
/** /**
* @return True if the machine is "whole" and should be assembled. False * @throws MultiblockValidationException If the machine is not "whole" and
* otherwise. * should not be assembled.
*/ */
@Override @Override
protected void isMachineWhole() throws MultiblockValidationException { protected void isMachineWhole() throws MultiblockValidationException {

View file

@ -52,7 +52,7 @@ public class ExtendedPacketBuffer extends PacketByteBuf {
return ObjectBufferUtils.readObject(this); return ObjectBufferUtils.readObject(this);
} }
// Supports reading and writing list codec's // Supports reading and writing list codecs
public <T> void writeCodec(Codec<T> codec, T object) { public <T> void writeCodec(Codec<T> codec, T object) {
DataResult<NbtElement> dataResult = codec.encodeStart(NbtOps.INSTANCE, object); DataResult<NbtElement> dataResult = codec.encodeStart(NbtOps.INSTANCE, object);
if (dataResult.error().isPresent()) { if (dataResult.error().isPresent()) {

View file

@ -54,7 +54,8 @@ public class ServerBoundPackets {
IdentifiedPacket packetFluidConfigSync = ClientBoundPackets.createPacketFluidConfigSync(pos, legacyMachineBase.fluidConfiguration); IdentifiedPacket packetFluidConfigSync = ClientBoundPackets.createPacketFluidConfigSync(pos, legacyMachineBase.fluidConfiguration);
NetworkManager.sendToTracking(packetFluidConfigSync, legacyMachineBase); NetworkManager.sendToTracking(packetFluidConfigSync, legacyMachineBase);
//We update the block to allow pipes that are connecting to detctect the update and change their connection status if needed // We update the block to allow pipes that are connecting to detect the update and change their
// connection status if needed
World world = legacyMachineBase.getWorld(); World world = legacyMachineBase.getWorld();
BlockState blockState = world.getBlockState(legacyMachineBase.getPos()); BlockState blockState = world.getBlockState(legacyMachineBase.getPos());
world.updateNeighborsAlways(legacyMachineBase.getPos(), blockState.getBlock()); world.updateNeighborsAlways(legacyMachineBase.getPos(), blockState.getBlock());
@ -89,7 +90,7 @@ public class ServerBoundPackets {
config.setInput(input); config.setInput(input);
config.setOutput(output); config.setOutput(output);
//Syncs back to the client // Syncs back to the client
IdentifiedPacket packetFluidConfigSync = ClientBoundPackets.createPacketFluidConfigSync(pos, legacyMachineBase.fluidConfiguration); IdentifiedPacket packetFluidConfigSync = ClientBoundPackets.createPacketFluidConfigSync(pos, legacyMachineBase.fluidConfiguration);
NetworkManager.sendToTracking(packetFluidConfigSync, legacyMachineBase); NetworkManager.sendToTracking(packetFluidConfigSync, legacyMachineBase);
}); });
@ -112,7 +113,7 @@ public class ServerBoundPackets {
holder.setInput(input); holder.setInput(input);
holder.setOutput(output); holder.setOutput(output);
holder.setfilter(filter); holder.setFilter(filter);
//Syncs back to the client //Syncs back to the client
IdentifiedPacket packetSlotSync = ClientBoundPackets.createPacketSlotSync(pos, machineBase.getSlotConfiguration()); IdentifiedPacket packetSlotSync = ClientBoundPackets.createPacketSlotSync(pos, machineBase.getSlotConfiguration());
@ -204,7 +205,7 @@ public class ServerBoundPackets {
}); });
} }
public static IdentifiedPacket requestChunkloaderChunks(BlockPos pos) { public static IdentifiedPacket requestChunkLoaderChunks(BlockPos pos) {
return NetworkManager.createServerBoundPacket(new Identifier("reborncore", "chunk_loader_request"), packetBuffer -> { return NetworkManager.createServerBoundPacket(new Identifier("reborncore", "chunk_loader_request"), packetBuffer -> {
packetBuffer.writeBlockPos(pos); packetBuffer.writeBlockPos(pos);
}); });

View file

@ -26,13 +26,10 @@ package reborncore.common.powerSystem;
import net.fabricmc.fabric.api.transfer.v1.context.ContainerItemContext; import net.fabricmc.fabric.api.transfer.v1.context.ContainerItemContext;
import net.fabricmc.fabric.api.transfer.v1.item.InventoryStorage; import net.fabricmc.fabric.api.transfer.v1.item.InventoryStorage;
import net.fabricmc.fabric.api.transfer.v1.item.ItemVariant;
import net.fabricmc.fabric.api.transfer.v1.storage.base.SingleSlotStorage;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityType; import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.inventory.Inventory; import net.minecraft.inventory.Inventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtCompound;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText; import net.minecraft.text.TranslatableText;
@ -43,6 +40,7 @@ import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World; import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import reborncore.api.IListInfoProvider; import reborncore.api.IListInfoProvider;
import reborncore.client.screen.builder.BlockEntityScreenHandlerBuilder;
import reborncore.common.blockentity.MachineBaseBlockEntity; import reborncore.common.blockentity.MachineBaseBlockEntity;
import reborncore.common.blockentity.RedstoneConfiguration; import reborncore.common.blockentity.RedstoneConfiguration;
import reborncore.common.util.StringUtils; import reborncore.common.util.StringUtils;
@ -77,7 +75,7 @@ public abstract class PowerAcceptorBlockEntity extends MachineBaseBlockEntity im
public int extraTier; public int extraTier;
public long powerChange; public long powerChange;
public long powerLastTick; public long powerLastTick;
public boolean checkOverfill = true; // Set to false to disable the overfill check. public boolean checkOverfill = true; // Set false to disable overfill check.
public PowerAcceptorBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) { public PowerAcceptorBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
super(type, pos, state); super(type, pos, state);
@ -99,7 +97,7 @@ public abstract class PowerAcceptorBlockEntity extends MachineBaseBlockEntity im
/** /**
* Get amount of missing energy * Get amount of missing energy
* *
* @return double Free space for energy in internal buffer * @return {@code long} Free space for energy in internal buffer
*/ */
public long getFreeSpace() { public long getFreeSpace() {
return getMaxStoredPower() - getStored(); return getMaxStoredPower() - getStored();
@ -108,7 +106,7 @@ public abstract class PowerAcceptorBlockEntity extends MachineBaseBlockEntity im
/** /**
* Adds energy to block entity * Adds energy to block entity
* *
* @param amount double Amount to add * @param amount {@code long} Amount to add
*/ */
public void addEnergy(long amount){ public void addEnergy(long amount){
setStored(getEnergy() + amount); setStored(getEnergy() + amount);
@ -127,7 +125,7 @@ public abstract class PowerAcceptorBlockEntity extends MachineBaseBlockEntity im
/** /**
* Use energy from block entity * Use energy from block entity
* *
* @param amount double Amount of energy to use * @param amount {@code long} Amount of energy to use
*/ */
public void useEnergy(long amount){ public void useEnergy(long amount){
if (getEnergy() > amount) { if (getEnergy() > amount) {
@ -140,7 +138,7 @@ public abstract class PowerAcceptorBlockEntity extends MachineBaseBlockEntity im
/** /**
* Charge machine from battery placed inside inventory slot * Charge machine from battery placed inside inventory slot
* *
* @param slot int Slot ID for battery slot * @param slot {@code int} Slot ID for battery slot
*/ */
public void charge(int slot) { public void charge(int slot) {
if (world == null) { if (world == null) {
@ -170,7 +168,7 @@ public abstract class PowerAcceptorBlockEntity extends MachineBaseBlockEntity im
/** /**
* Charge battery placed inside inventory slot from machine * Charge battery placed inside inventory slot from machine
* *
* @param slot int Slot ID for battery slot * @param slot {@code int} Slot ID for battery slot
*/ */
public void discharge(int slot) { public void discharge(int slot) {
if (world == null) { if (world == null) {
@ -197,10 +195,13 @@ public abstract class PowerAcceptorBlockEntity extends MachineBaseBlockEntity im
/** /**
* Calculates the comparator output of a powered BE with the formula * Calculates the comparator output of a powered BE with the formula
* {@code ceil(blockEntity.getStored() * 15.0 / storage.getMaxPower())}. * <pre>
* ceil(blockEntity.getStored() * 15.0 / storage.getMaxPower())
* </pre>
* *
* @param blockEntity the powered BE * @param blockEntity {@link BlockEntity} the powered BE
* @return the calculated comparator output or 0 if {@code blockEntity} is not a {@code PowerAcceptorBlockEntity} * @return {@code int} the calculated comparator output or 0 if {@link BlockEntity}
* is not a {@link PowerAcceptorBlockEntity}
*/ */
public static int calculateComparatorOutputFromEnergy(@Nullable BlockEntity blockEntity) { public static int calculateComparatorOutputFromEnergy(@Nullable BlockEntity blockEntity) {
if (blockEntity instanceof PowerAcceptorBlockEntity storage) { if (blockEntity instanceof PowerAcceptorBlockEntity storage) {
@ -213,7 +214,7 @@ public abstract class PowerAcceptorBlockEntity extends MachineBaseBlockEntity im
/** /**
* Check if machine should load energy data from NBT * Check if machine should load energy data from NBT
* *
* @return boolean Returns true if machine should load energy data from NBT * @return {@code boolean} Returns true if machine should load energy data from NBT
*/ */
protected boolean shouldHandleEnergyNBT() { protected boolean shouldHandleEnergyNBT() {
return true; return true;
@ -222,8 +223,8 @@ public abstract class PowerAcceptorBlockEntity extends MachineBaseBlockEntity im
/** /**
* Check if block entity can accept energy from a particular side * Check if block entity can accept energy from a particular side
* *
* @param side EnergySide Machine side * @param side {@link Direction} Machine side
* @return boolean Returns true if machine can accept energy from side provided * @return {@code boolean} Returns true if machine can accept energy from side provided
*/ */
protected boolean canAcceptEnergy(@Nullable Direction side){ protected boolean canAcceptEnergy(@Nullable Direction side){
return true; return true;
@ -232,62 +233,68 @@ public abstract class PowerAcceptorBlockEntity extends MachineBaseBlockEntity im
/** /**
* Check if block entity can provide energy via a particular side * Check if block entity can provide energy via a particular side
* *
* @param side EnergySide Machine side * @param side {@link Direction} Machine side
* @return boolean Returns true if machine can provide energy via particular side * @return {@code boolean} Returns true if machine can provide energy via particular side
*/ */
protected boolean canProvideEnergy(@Nullable Direction side){ protected boolean canProvideEnergy(@Nullable Direction side){
return true; return true;
} }
/** /**
* Wrapper method used to sync additional energy storage values with client via BlockEntityScreenHandlerBuilder * Wrapper method used to sync additional energy storage values with client via
* {@link BlockEntityScreenHandlerBuilder}
* *
* @return double Size of additional energy buffer * @return {@code long} Size of additional energy buffer
*/ */
public long getExtraPowerStorage(){ public long getExtraPowerStorage(){
return extraPowerStorage; return extraPowerStorage;
} }
/** /**
* Wrapper method used to sync additional energy storage values with client via BlockEntityScreenHandlerBuilder * Wrapper method used to sync additional energy storage values with client via
* {@link BlockEntityScreenHandlerBuilder}
* *
* @param extraPowerStorage double Size of additional energy buffer * @param extraPowerStorage {@code long} Size of additional energy buffer
*/ */
public void setExtraPowerStorage(long extraPowerStorage) { public void setExtraPowerStorage(long extraPowerStorage) {
this.extraPowerStorage = extraPowerStorage; this.extraPowerStorage = extraPowerStorage;
} }
/** /**
* Wrapper method used to sync energy change values with client via BlockEntityScreenHandlerBuilder * Wrapper method used to sync energy change values with client via
* {@link BlockEntityScreenHandlerBuilder}
* *
* @return double Energy change per tick * @return {@code long} Energy change per tick
*/ */
public long getPowerChange() { public long getPowerChange() {
return powerChange; return powerChange;
} }
/** /**
* Wrapper method used to sync energy change values with client via BlockEntityScreenHandlerBuilder * Wrapper method used to sync energy change values with client via
* {@link BlockEntityScreenHandlerBuilder}
* *
* @param powerChange double Energy change per tick * @param powerChange {@code long} Energy change per tick
*/ */
public void setPowerChange(long powerChange) { public void setPowerChange(long powerChange) {
this.powerChange = powerChange; this.powerChange = powerChange;
} }
/** /**
* Wrapper method used to sync energy values with client via BlockEntityScreenHandlerBuilder * Wrapper method used to sync energy values with client via
* {@link BlockEntityScreenHandlerBuilder}
* *
* @return double Energy stored in block entity * @return {@code long} Energy stored in block entity
*/ */
public long getEnergy() { public long getEnergy() {
return getStored(); return getStored();
} }
/** /**
* Wrapper method used to sync energy values with client via BlockEntityScreenHandlerBuilder * Wrapper method used to sync energy values with client via
* @param energy double Energy stored in block entity * {@link BlockEntityScreenHandlerBuilder}
*
* @param energy {@code long} Energy stored in block entity
*/ */
public void setEnergy(long energy) { public void setEnergy(long energy) {
setStored(energy); setStored(energy);
@ -296,21 +303,21 @@ public abstract class PowerAcceptorBlockEntity extends MachineBaseBlockEntity im
/** /**
* Returns base size of internal Energy buffer of a particular machine before any upgrades applied * Returns base size of internal Energy buffer of a particular machine before any upgrades applied
* *
* @return double Size of internal Energy buffer * @return {@code long} Size of internal Energy buffer
*/ */
public abstract long getBaseMaxPower(); public abstract long getBaseMaxPower();
/** /**
* Returns base output rate or zero if machine doesn't output energy * Returns base output rate or zero if machine doesn't output energy
* *
* @return double Output rate, E\t * @return {@code long} Output rate, E\t
*/ */
public abstract long getBaseMaxOutput(); public abstract long getBaseMaxOutput();
/** /**
* Returns base input rate or zero if machine doesn't accept energy * Returns base input rate or zero if machine doesn't accept energy
* *
* @return double Input rate, E\t * @return {@code long} Input rate, E\t
*/ */
public abstract long getBaseMaxInput(); public abstract long getBaseMaxInput();
@ -346,7 +353,7 @@ public abstract class PowerAcceptorBlockEntity extends MachineBaseBlockEntity im
super.readNbt(tag); super.readNbt(tag);
NbtCompound data = tag.getCompound("PowerAcceptor"); NbtCompound data = tag.getCompound("PowerAcceptor");
if (shouldHandleEnergyNBT()) { if (shouldHandleEnergyNBT()) {
// Bypass the overfill check in setStored() because upgrades have not yet been applied. // Bypass overfill check in setStored() because upgrades have not yet been applied.
this.energyContainer.amount = data.getLong("energy"); this.energyContainer.amount = data.getLong("energy");
} }
} }

View file

@ -5,13 +5,16 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import reborncore.common.util.ItemUtils; import reborncore.common.util.ItemUtils;
import team.reborn.energy.api.EnergyStorage;
import team.reborn.energy.api.base.SimpleBatteryItem; import team.reborn.energy.api.base.SimpleBatteryItem;
/** /**
* Implement on simple energy-containing items and (on top of what SimpleBatteryItem does): * Implement on simple energy-containing items and (on top of what {@link SimpleBatteryItem} does):
* <ul> * <ul>
* <li>A tooltip will be added for the item, indicating the stored power, the max power and the extraction rates.</li> * <li>A tooltip will be added for the item, indicating the stored power,
* <li>Any RcEnergyItem input in a crafting recipe input will automatically give its energy to the output if the output implements RcEnergyItem.</li> * the max power and the extraction rates.</li>
* <li>Any {@link RcEnergyItem} input in a crafting recipe input will automatically
* give its energy to the output if the output implements {@link RcEnergyItem}.</li>
* </ul> * </ul>
* TODO: consider moving this functionality to the energy API? * TODO: consider moving this functionality to the energy API?
*/ */
@ -19,7 +22,7 @@ public interface RcEnergyItem extends SimpleBatteryItem, FabricItem {
long getEnergyCapacity(); long getEnergyCapacity();
/** /**
* @return the tier of this EnergyStorage, used to have standard I/O rates. * @return {@link RcEnergyTier} the tier of this {@link EnergyStorage}, used to have standard I/O rates.
*/ */
RcEnergyTier getTier(); RcEnergyTier getTier();

View file

@ -29,7 +29,7 @@ import net.minecraft.block.entity.BlockEntity;
/** /**
* Created by Mark on 01/07/2017. * Created by Mark on 01/07/2017.
*/ */
public interface ICrafterSoundHanlder { public interface ICrafterSoundHandler {
void playSound(boolean firstRun, BlockEntity blockEntity); void playSound(boolean firstRun, BlockEntity blockEntity);

View file

@ -25,22 +25,22 @@
package reborncore.common.recipes; package reborncore.common.recipes;
/** /**
* This class isnt designed to be used by other mods, if you want to have upgrades have your * This class isn't designed to be used by other mods, if you want to have upgrades have your
*/ */
public interface IUpgradeHandler { public interface IUpgradeHandler {
void resetSpeedMulti(); void resetSpeedMultiplier();
double getSpeedMultiplier(); double getSpeedMultiplier();
void addPowerMulti(double amount); void addPowerMultiplier(double amount);
void resetPowerMulti(); void resetPowerMultiplier();
double getPowerMultiplier(); double getPowerMultiplier();
long getEuPerTick(long baseEu); long getEuPerTick(long baseEu);
void addSpeedMulti(double amount); void addSpeedMultiplier(double amount);
} }

View file

@ -98,7 +98,7 @@ public class RecipeCrafter implements IUpgradeHandler {
int ticksSinceLastChange; int ticksSinceLastChange;
@Nullable @Nullable
public static ICrafterSoundHanlder soundHanlder = (firstRun, blockEntity) -> { public static ICrafterSoundHandler soundHandler = (firstRun, blockEntity) -> {
}; };
public RecipeCrafter(RebornRecipeType<?> recipeType, BlockEntity blockEntity, int inputs, int outputs, RebornInventory<?> inventory, public RecipeCrafter(RebornRecipeType<?> recipeType, BlockEntity blockEntity, int inputs, int outputs, RebornInventory<?> inventory,
@ -172,7 +172,7 @@ public class RecipeCrafter implements IUpgradeHandler {
currentRecipe = null; currentRecipe = null;
currentTickTime = 0; currentTickTime = 0;
updateCurrentRecipe(); updateCurrentRecipe();
//Update active sate if the blockEntity isnt going to start crafting again // Update active state if the blockEntity isn't going to start crafting again
if (currentRecipe == null) { if (currentRecipe == null) {
setIsActive(); setIsActive();
} }
@ -181,8 +181,8 @@ public class RecipeCrafter implements IUpgradeHandler {
long useRequirement = getEuPerTick(currentRecipe.getPower()); long useRequirement = getEuPerTick(currentRecipe.getPower());
if (energy.tryUseExact(useRequirement)) { if (energy.tryUseExact(useRequirement)) {
currentTickTime++; currentTickTime++;
if ((currentTickTime == 1 || currentTickTime % 20 == 0) && soundHanlder != null) { if ((currentTickTime == 1 || currentTickTime % 20 == 0) && soundHandler != null) {
soundHanlder.playSound(false, blockEntity); soundHandler.playSound(false, blockEntity);
} }
} }
} }
@ -196,11 +196,11 @@ public class RecipeCrafter implements IUpgradeHandler {
public void updateCurrentRecipe() { public void updateCurrentRecipe() {
currentTickTime = 0; currentTickTime = 0;
for (RebornRecipe recipe : recipeType.getRecipes(blockEntity.getWorld())) { for (RebornRecipe recipe : recipeType.getRecipes(blockEntity.getWorld())) {
// This checks to see if it has all of the inputs // This checks to see if it has all the inputs
if (!hasAllInputs(recipe)) continue; if (!hasAllInputs(recipe)) continue;
if (!recipe.canCraft(blockEntity)) continue; if (!recipe.canCraft(blockEntity)) continue;
// This checks to see if it can fit all of the outputs // This checks to see if it can fit all the outputs
boolean hasOutputSpace = true; boolean hasOutputSpace = true;
for (int i = 0; i < recipe.getOutputs().size(); i++) { for (int i = 0; i < recipe.getOutputs().size(); i++) {
if (!canFitOutput(recipe.getOutputs().get(i), outputSlots[i])) { if (!canFitOutput(recipe.getOutputs().get(i), outputSlots[i])) {
@ -246,7 +246,7 @@ public class RecipeCrafter implements IUpgradeHandler {
return; return;
} }
for (RebornIngredient ingredient : currentRecipe.getRebornIngredients()) { for (RebornIngredient ingredient : currentRecipe.getRebornIngredients()) {
for (int inputSlot : inputSlots) {// Uses all of the inputs for (int inputSlot : inputSlots) {// Uses all the inputs
if (ingredient.test(inventory.getStack(inputSlot))) { if (ingredient.test(inventory.getStack(inputSlot))) {
inventory.shrinkSlot(inputSlot, ingredient.getCount()); inventory.shrinkSlot(inputSlot, ingredient.getCount());
break; break;
@ -354,8 +354,8 @@ public class RecipeCrafter implements IUpgradeHandler {
return inventory.hasChanged(); return inventory.hasChanged();
} }
public void setInvDirty(boolean isDiry) { public void setInvDirty(boolean isDirty) {
inventory.setHashChanged(isDiry); inventory.setHashChanged(isDirty);
} }
public boolean isStackValidInput(ItemStack stack) { public boolean isStackValidInput(ItemStack stack) {
@ -363,7 +363,8 @@ public class RecipeCrafter implements IUpgradeHandler {
return false; return false;
} }
//Test with a stack with the max stack size as some independents will check the stacksize. Bit of a hack but should work. // Test with a stack with the max stack size as some independents will check the stack size.
// A bit of a hack but should work.
ItemStack largeStack = stack.copy(); ItemStack largeStack = stack.copy();
largeStack.setCount(largeStack.getMaxCount()); largeStack.setCount(largeStack.getMaxCount());
for (RebornRecipe recipe : recipeType.getRecipes(blockEntity.getWorld())) { for (RebornRecipe recipe : recipeType.getRecipes(blockEntity.getWorld())) {
@ -377,8 +378,8 @@ public class RecipeCrafter implements IUpgradeHandler {
} }
@Override @Override
public void resetSpeedMulti() { public void resetSpeedMultiplier() {
parentUpgradeHandler.ifPresent(IUpgradeHandler::resetSpeedMulti); parentUpgradeHandler.ifPresent(IUpgradeHandler::resetSpeedMultiplier);
} }
@Override @Override
@ -387,13 +388,13 @@ public class RecipeCrafter implements IUpgradeHandler {
} }
@Override @Override
public void addPowerMulti(double amount) { public void addPowerMultiplier(double amount) {
parentUpgradeHandler.ifPresent(iUpgradeHandler -> iUpgradeHandler.addPowerMulti(amount)); parentUpgradeHandler.ifPresent(iUpgradeHandler -> iUpgradeHandler.addPowerMultiplier(amount));
} }
@Override @Override
public void resetPowerMulti() { public void resetPowerMultiplier() {
parentUpgradeHandler.ifPresent(IUpgradeHandler::resetPowerMulti); parentUpgradeHandler.ifPresent(IUpgradeHandler::resetPowerMultiplier);
} }
@Override @Override
@ -408,7 +409,7 @@ public class RecipeCrafter implements IUpgradeHandler {
} }
@Override @Override
public void addSpeedMulti(double amount) { public void addSpeedMultiplier(double amount) {
parentUpgradeHandler.ifPresent(iUpgradeHandler -> iUpgradeHandler.addSpeedMulti(amount)); parentUpgradeHandler.ifPresent(iUpgradeHandler -> iUpgradeHandler.addSpeedMultiplier(amount));
} }
} }

View file

@ -40,7 +40,7 @@ public class CalenderUtils {
calendar.setTimeInMillis(System.currentTimeMillis()); calendar.setTimeInMillis(System.currentTimeMillis());
int day = calendar.get(Calendar.DAY_OF_MONTH); int day = calendar.get(Calendar.DAY_OF_MONTH);
int month = calendar.get(Calendar.MONTH) + 1; //Java months start at 0 int month = calendar.get(Calendar.MONTH) + 1; // Java months start at 0
if (month == 12) { if (month == 12) {
if (day >= 24 && day <= 26) { if (day >= 24 && day <= 26) {
christmas = true; christmas = true;

View file

@ -36,12 +36,13 @@ import reborncore.mixin.client.AccessorChatHud;
* Class stolen from SteamAgeRevolution, which I stole from BloodMagic, which was stolen from EnderCore, which stole the * Class stolen from SteamAgeRevolution, which I stole from BloodMagic, which was stolen from EnderCore, which stole the
* idea from ExtraUtilities, who stole it from vanilla. * idea from ExtraUtilities, who stole it from vanilla.
* <p> * <p>
* Original class link: * Original class link:
* https://github.com/SleepyTrousers/EnderCore/blob/master/src/main/java/com/enderio/core/common/util/ChatUtil.java * https://github.com/SleepyTrousers/EnderCore/blob/master/src/main/java/com/enderio/core/common/util/ChatUtil.java
* </p>
*/ */
public class ChatUtils { public class ChatUtils {
private static final int DELETION_ID = 1337; //MAKE THIS UNIQUE PER MOD THAT USES THIS private static final int DELETION_ID = 1337; // MAKE THIS UNIQUE PER MOD THAT USES THIS
public static void sendNoSpamMessages(int messageID, Text message) { public static void sendNoSpamMessages(int messageID, Text message) {
if (FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT) { if (FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT) {

View file

@ -24,7 +24,7 @@
package reborncore.common.util; package reborncore.common.util;
//A basic color class that is used in place of the AWT color class as it cannot be used with lwjgl 3 // A basic color class that is used in place of the AWT color class as it cannot be used with lwjgl 3
public class Color { public class Color {
public final static Color WHITE = new Color(255, 255, 255); public final static Color WHITE = new Color(255, 255, 255);

View file

@ -35,7 +35,11 @@ import java.util.function.Function;
import java.util.function.Supplier; import java.util.function.Supplier;
import java.util.stream.Collector; import java.util.stream.Collector;
//Taken from https://github.com/The-Acronym-Coders/BASE/blob/develop/1.12.0/src/main/java/com/teamacronymcoders/base/util/collections/NonnullListCollector.java, thanks for this ;) /**
* Taken from
* <a href=https://github.com/The-Acronym-Coders/BASE/blob/develop/1.12.0/src/main/java/com/teamacronymcoders/base/util/collections/NonnullListCollector.java>here</a>,
* thanks for this ;)
*/
public class DefaultedListCollector<T> implements Collector<T, DefaultedList<T>, DefaultedList<T>> { public class DefaultedListCollector<T> implements Collector<T, DefaultedList<T>, DefaultedList<T>> {
private final Set<Characteristics> CH_ID = Collections.unmodifiableSet(EnumSet.of(Characteristics.IDENTITY_FINISH)); private final Set<Characteristics> CH_ID = Collections.unmodifiableSet(EnumSet.of(Characteristics.IDENTITY_FINISH));
@ -71,4 +75,4 @@ public class DefaultedListCollector<T> implements Collector<T, DefaultedList<T>,
public Set<Characteristics> characteristics() { public Set<Characteristics> characteristics() {
return CH_ID; return CH_ID;
} }
} }

View file

@ -13,6 +13,12 @@ public class FluidTextHelper {
/** /**
* Return a unicode string representing a fraction, like ¹. * Return a unicode string representing a fraction, like ¹.
*
* @param numerator {@code long} The numerator of the fraction.
* @param denominator {@code long} The denominator of the fraction.
* @param simplify {@code boolean} Whether to simplify the fraction.
* @return {@link String} representing the fraction.
* @throws IllegalArgumentException if numerator or denominator is negative.
*/ */
public static String getUnicodeFraction(long numerator, long denominator, boolean simplify) { public static String getUnicodeFraction(long numerator, long denominator, boolean simplify) {
if (numerator < 0 || denominator < 0) if (numerator < 0 || denominator < 0)
@ -42,15 +48,13 @@ public class FluidTextHelper {
} }
/** /**
* Convert a non negative fluid amount in droplets to a unicode string * Convert a non-negative fluid amount in droplets to a unicode string
* representing the amount in millibuckets. For example, passing 163 will result * representing the amount in millibuckets. For example, passing 163 will result
* in * in
* *
* <pre> * <pre>
* 2 ¹ * 2 ¹
* </pre> * </pre>
*
* .
*/ */
public static String getUnicodeMillibuckets(long droplets, boolean simplify) { public static String getUnicodeMillibuckets(long droplets, boolean simplify) {
String result = "" + droplets / 81; String result = "" + droplets / 81;

View file

@ -50,7 +50,7 @@ public class InventoryItem extends InventoryBase {
this.stack = stack; this.stack = stack;
} }
public static InventoryItem getItemInvetory(ItemStack stack, int size) { public static InventoryItem getItemInventory(ItemStack stack, int size) {
return new InventoryItem(stack, size); return new InventoryItem(stack, size);
} }

View file

@ -45,7 +45,7 @@ public class ItemHandlerUtils {
dropItemHandler(world, pos, inventory); dropItemHandler(world, pos, inventory);
} }
if (blockEntity instanceof IUpgradeable) { if (blockEntity instanceof IUpgradeable) {
dropItemHandler(world, pos, ((IUpgradeable) blockEntity).getUpgradeInvetory()); dropItemHandler(world, pos, ((IUpgradeable) blockEntity).getUpgradeInventory());
} }
} }

View file

@ -31,15 +31,15 @@ import net.minecraft.nbt.NbtList;
public class ItemNBTHelper { public class ItemNBTHelper {
/** /**
* Checks if an ItemStack has a Tag Compound * Checks if an {@link ItemStack} has an {@link NbtCompound}
**/ **/
public static boolean detectNBT(ItemStack stack) { public static boolean detectNBT(ItemStack stack) {
return stack.hasNbt(); return stack.hasNbt();
} }
/** /**
* Tries to initialize an NBT Tag Compound in an ItemStack, this will not do * Tries to initialize an {@link NbtCompound} in an {@link ItemStack}, this will not do
* anything if the stack already has a tag compound * anything if the stack already has an {@link NbtCompound}
**/ **/
public static void initNBT(ItemStack stack) { public static void initNBT(ItemStack stack) {
if (!detectNBT(stack)) { if (!detectNBT(stack)) {
@ -48,7 +48,7 @@ public class ItemNBTHelper {
} }
/** /**
* Injects an NBT Tag Compound to an ItemStack, no checks are made * Injects an {@link NbtCompound} to an {@link ItemStack}, no checks are made
* previously * previously
**/ **/
public static void injectNBT(ItemStack stack, NbtCompound nbt) { public static void injectNBT(ItemStack stack, NbtCompound nbt) {
@ -56,7 +56,7 @@ public class ItemNBTHelper {
} }
/** /**
* Gets the NBTTagCompound in an ItemStack. Tries to init it previously in * Gets the {@link NbtCompound} in an {@link ItemStack}. Tries to init it previously in
* case there isn't one present * case there isn't one present
**/ **/
public static NbtCompound getNBT(ItemStack stack) { public static NbtCompound getNBT(ItemStack stack) {
@ -113,53 +113,53 @@ public class ItemNBTHelper {
// GETTERS // GETTERS
// /////////////////////////////////////////////////////////////////// // ///////////////////////////////////////////////////////////////////
public static boolean verifyExistance(ItemStack stack, String tag) { public static boolean verifyExistence(ItemStack stack, String tag) {
return !stack.isEmpty() && getNBT(stack).contains(tag); return !stack.isEmpty() && getNBT(stack).contains(tag);
} }
public static boolean getBoolean(ItemStack stack, String tag, boolean defaultExpected) { public static boolean getBoolean(ItemStack stack, String tag, boolean defaultExpected) {
return verifyExistance(stack, tag) ? getNBT(stack).getBoolean(tag) : defaultExpected; return verifyExistence(stack, tag) ? getNBT(stack).getBoolean(tag) : defaultExpected;
} }
public static byte getByte(ItemStack stack, String tag, byte defaultExpected) { public static byte getByte(ItemStack stack, String tag, byte defaultExpected) {
return verifyExistance(stack, tag) ? getNBT(stack).getByte(tag) : defaultExpected; return verifyExistence(stack, tag) ? getNBT(stack).getByte(tag) : defaultExpected;
} }
public static short getShort(ItemStack stack, String tag, short defaultExpected) { public static short getShort(ItemStack stack, String tag, short defaultExpected) {
return verifyExistance(stack, tag) ? getNBT(stack).getShort(tag) : defaultExpected; return verifyExistence(stack, tag) ? getNBT(stack).getShort(tag) : defaultExpected;
} }
public static int getInt(ItemStack stack, String tag, int defaultExpected) { public static int getInt(ItemStack stack, String tag, int defaultExpected) {
return verifyExistance(stack, tag) ? getNBT(stack).getInt(tag) : defaultExpected; return verifyExistence(stack, tag) ? getNBT(stack).getInt(tag) : defaultExpected;
} }
public static long getLong(ItemStack stack, String tag, long defaultExpected) { public static long getLong(ItemStack stack, String tag, long defaultExpected) {
return verifyExistance(stack, tag) ? getNBT(stack).getLong(tag) : defaultExpected; return verifyExistence(stack, tag) ? getNBT(stack).getLong(tag) : defaultExpected;
} }
public static float getFloat(ItemStack stack, String tag, float defaultExpected) { public static float getFloat(ItemStack stack, String tag, float defaultExpected) {
return verifyExistance(stack, tag) ? getNBT(stack).getFloat(tag) : defaultExpected; return verifyExistence(stack, tag) ? getNBT(stack).getFloat(tag) : defaultExpected;
} }
public static double getDouble(ItemStack stack, String tag, double defaultExpected) { public static double getDouble(ItemStack stack, String tag, double defaultExpected) {
return verifyExistance(stack, tag) ? getNBT(stack).getDouble(tag) : defaultExpected; return verifyExistence(stack, tag) ? getNBT(stack).getDouble(tag) : defaultExpected;
} }
/** /**
* If nullifyOnFail is true it'll return null if it doesn't find any * If {@code nullifyOnFail} is true it'll return null if it doesn't find any
* compounds, otherwise it'll return a new one. * compounds, otherwise it'll return a new one.
**/ **/
public static NbtCompound getCompound(ItemStack stack, String tag, boolean nullifyOnFail) { public static NbtCompound getCompound(ItemStack stack, String tag, boolean nullifyOnFail) {
return verifyExistance(stack, tag) ? getNBT(stack).getCompound(tag) return verifyExistence(stack, tag) ? getNBT(stack).getCompound(tag)
: nullifyOnFail ? null : new NbtCompound(); : nullifyOnFail ? null : new NbtCompound();
} }
public static String getString(ItemStack stack, String tag, String defaultExpected) { public static String getString(ItemStack stack, String tag, String defaultExpected) {
return verifyExistance(stack, tag) ? getNBT(stack).getString(tag) : defaultExpected; return verifyExistence(stack, tag) ? getNBT(stack).getString(tag) : defaultExpected;
} }
public static NbtList getList(ItemStack stack, String tag, int objtype, boolean nullifyOnFail) { public static NbtList getList(ItemStack stack, String tag, int objType, boolean nullifyOnFail) {
return verifyExistance(stack, tag) ? getNBT(stack).getList(tag, objtype) return verifyExistence(stack, tag) ? getNBT(stack).getList(tag, objType)
: nullifyOnFail ? null : new NbtList(); : nullifyOnFail ? null : new NbtList();
} }
} }

View file

@ -147,8 +147,8 @@ public class ItemUtils {
/** /**
* Checks if powered item is active * Checks if powered item is active
* *
* @param stack ItemStack ItemStack to check * @param stack {@link ItemStack} Stack to check
* @return True if powered item is active * @return {@code boolean} True if powered item is active
*/ */
public static boolean isActive(ItemStack stack) { public static boolean isActive(ItemStack stack) {
return !stack.isEmpty() && stack.getNbt() != null && stack.getNbt().getBoolean("isActive"); return !stack.isEmpty() && stack.getNbt() != null && stack.getNbt().getBoolean("isActive");
@ -157,10 +157,10 @@ public class ItemUtils {
/** /**
* Check if powered item has enough energy to continue being in active state * Check if powered item has enough energy to continue being in active state
* *
* @param stack ItemStack ItemStack to check * @param stack {@link ItemStack} Stack to check
* @param cost int Cost of operation performed by tool * @param cost {@link int} Cost of operation performed by tool
* @param isClient boolean Client side * @param isClient {@link boolean} Client side
* @param messageId int MessageID for sending no spam message * @param messageId {@link int} MessageID for sending no spam message
*/ */
public static void checkActive(ItemStack stack, int cost, boolean isClient, int messageId) { public static void checkActive(ItemStack stack, int cost, boolean isClient, int messageId) {
if (!ItemUtils.isActive(stack)) { if (!ItemUtils.isActive(stack)) {
@ -185,10 +185,10 @@ public class ItemUtils {
/** /**
* Switch active\inactive state for powered item * Switch active\inactive state for powered item
* *
* @param stack ItemStack ItemStack to work on * @param stack {@link ItemStack} Stack to switch state
* @param cost int Cost of operation performed by tool * @param cost {@code int} Cost of operation performed by tool
* @param isClient boolean Are we on client side * @param isClient {@code boolean} Are we on client side
* @param messageId MessageID for sending no spam message * @param messageId {@code int} MessageID for sending no spam message
*/ */
public static void switchActive(ItemStack stack, int cost, boolean isClient, int messageId) { public static void switchActive(ItemStack stack, int cost, boolean isClient, int messageId) {
ItemUtils.checkActive(stack, cost, isClient, messageId); ItemUtils.checkActive(stack, cost, isClient, messageId);
@ -225,8 +225,8 @@ public class ItemUtils {
/** /**
* Adds active\inactive state to powered item tooltip * Adds active\inactive state to powered item tooltip
* *
* @param stack ItemStack ItemStack to check * @param stack {@link ItemStack} Stack to check
* @param tooltip List Tooltip strings * @param tooltip {@link List} List of {@link Text} tooltip strings
*/ */
public static void buildActiveTooltip(ItemStack stack, List<Text> tooltip) { public static void buildActiveTooltip(ItemStack stack, List<Text> tooltip) {
if (!ItemUtils.isActive(stack)) { if (!ItemUtils.isActive(stack)) {
@ -237,16 +237,25 @@ public class ItemUtils {
} }
/** /**
* Output energy from item to other items in inventory * Output energy from item to other items in inventory
* *
* @param player PlayerEntity having powered item * @param player {@link PlayerEntity} Player having powered item
* @param itemStack ItemStack Powered item * @param itemStack {@link ItemStack} Powered item
* @param maxOutput int Maximum output rate of powered item * @param maxOutput {@code int} Maximum output rate of powered item
*/ */
public static void distributePowerToInventory(PlayerEntity player, ItemStack itemStack, long maxOutput) { public static void distributePowerToInventory(PlayerEntity player, ItemStack itemStack, long maxOutput) {
distributePowerToInventory(player, itemStack, maxOutput, (stack) -> true); distributePowerToInventory(player, itemStack, maxOutput, (stack) -> true);
} }
/**
* Output energy from item to other items in inventory
*
* @param player {@link PlayerEntity} Player having powered item
* @param itemStack {@link ItemStack} Powered item
* @param maxOutput {@code int} Maximum output rate of powered item
* @param filter {@link Predicate} Filter for items to output to
* @throws IllegalArgumentException If failed to locate stack in players inventory
*/
public static void distributePowerToInventory(PlayerEntity player, ItemStack itemStack, long maxOutput, Predicate<ItemStack> filter) { public static void distributePowerToInventory(PlayerEntity player, ItemStack itemStack, long maxOutput, Predicate<ItemStack> filter) {
// Locate the current stack in the player inventory. // Locate the current stack in the player inventory.
PlayerInventoryStorage playerInv = PlayerInventoryStorage.of(player); PlayerInventoryStorage playerInv = PlayerInventoryStorage.of(player);

View file

@ -43,7 +43,7 @@ public enum MachineFacing {
return machineBase.getFacing().getOpposite(); return machineBase.getFacing().getOpposite();
} }
if (this == RIGHT) { if (this == RIGHT) {
//North -> West // North -> West
int i = machineBase.getFacing().getOpposite().getHorizontal() + 1; int i = machineBase.getFacing().getOpposite().getHorizontal() + 1;
if (i > 3) { if (i > 3) {
i = 0; i = 0;
@ -54,7 +54,7 @@ public enum MachineFacing {
return Direction.fromHorizontal(i); return Direction.fromHorizontal(i);
} }
if (this == LEFT) { if (this == LEFT) {
//North -> East // North -> East
int i = machineBase.getFacing().getOpposite().getHorizontal() - 1; int i = machineBase.getFacing().getOpposite().getHorizontal() - 1;
if (i > 3) { if (i > 3) {
i = 0; i = 0;

View file

@ -43,12 +43,12 @@ public class RebornInventory<T extends MachineBaseBlockEntity> extends Inventory
public RebornInventory(int size, String invName, int invStackLimit, T blockEntity, IInventoryAccess<T> access) { public RebornInventory(int size, String invName, int invStackLimit, T blockEntity, IInventoryAccess<T> access) {
super(size); super(size);
name = invName; name = invName;
stackLimit = (invStackLimit == 64 ? Items.AIR.getMaxCount() : invStackLimit); //Blame asie for this stackLimit = (invStackLimit == 64 ? Items.AIR.getMaxCount() : invStackLimit); // Blame asie for this
this.blockEntity = blockEntity; this.blockEntity = blockEntity;
this.inventoryAccess = access; this.inventoryAccess = access;
} }
//If you are using this with a machine, dont forget to set .withConfiguredAccess() // If you are using this with a machine, don't forget to set .withConfiguredAccess()
public RebornInventory(int size, String invName, int invStackLimit, T blockEntity) { public RebornInventory(int size, String invName, int invStackLimit, T blockEntity) {
this(size, invName, invStackLimit, blockEntity, (slotID, stack, facing, direction, be) -> { this(size, invName, invStackLimit, blockEntity, (slotID, stack, facing, direction, be) -> {
if (facing == null) { if (facing == null) {
@ -99,8 +99,8 @@ public class RebornInventory<T extends MachineBaseBlockEntity> extends Inventory
} }
public void read(NbtCompound data, String tag) { public void read(NbtCompound data, String tag) {
NbtCompound nbttaglist = data.getCompound(tag); NbtCompound nbtTagList = data.getCompound(tag);
deserializeNBT(nbttaglist); deserializeNBT(nbtTagList);
hasChanged = true; hasChanged = true;
} }

View file

@ -54,8 +54,8 @@ public class StringUtils {
/** /**
* Returns red-yellow-green text formatting depending on percentage * Returns red-yellow-green text formatting depending on percentage
* *
* @param percentage int percentage amount * @param percentage {@code int} percentage amount
* @return TextFormatting Red or Yellow or Green * @return {@link Formatting} Red or Yellow or Green
*/ */
public static Formatting getPercentageColour(int percentage) { public static Formatting getPercentageColour(int percentage) {
if (percentage <= 10) { if (percentage <= 10) {

View file

@ -107,7 +107,7 @@ public class Tank extends SnapshotParticipant<FluidInstance> implements Syncable
public final Tank read(NbtCompound nbt) { public final Tank read(NbtCompound nbt) {
if (nbt.contains(name)) { if (nbt.contains(name)) {
// allow to read empty tanks // allow reading empty tanks
setFluid(Fluids.EMPTY); setFluid(Fluids.EMPTY);
NbtCompound tankData = nbt.getCompound(name); NbtCompound tankData = nbt.getCompound(name);

View file

@ -38,13 +38,13 @@ public class Torus {
private static final ExecutorService GEN_EXECUTOR = Executors.newSingleThreadExecutor(); private static final ExecutorService GEN_EXECUTOR = Executors.newSingleThreadExecutor();
private static Int2IntMap torusSizeCache; private static Int2IntMap torusSizeCache;
public static List<BlockPos> generate(BlockPos orgin, int radius) { public static List<BlockPos> generate(BlockPos origin, int radius) {
List<BlockPos> posLists = new ArrayList<>(); List<BlockPos> posLists = new ArrayList<>();
for (int x = -radius; x < radius; x++) { for (int x = -radius; x < radius; x++) {
for (int y = -radius; y < radius; y++) { for (int y = -radius; y < radius; y++) {
for (int z = -radius; z < radius; z++) { for (int z = -radius; z < radius; z++) {
if (Math.pow(radius / 2 - Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)), 2) + Math.pow(z, 2) < Math.pow(radius * 0.05, 2)) { if (Math.pow(radius / 2 - Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)), 2) + Math.pow(z, 2) < Math.pow(radius * 0.05, 2)) {
posLists.add(orgin.add(x, z, y)); posLists.add(origin.add(x, z, y));
} }
} }
} }
@ -54,10 +54,10 @@ public class Torus {
public static void genSizeMap(int maxRadius) { public static void genSizeMap(int maxRadius) {
if (torusSizeCache != null) { if (torusSizeCache != null) {
//Lets not do this again // Let's not do this again
return; return;
} }
//10 is added as the control computer has a base of around 6 less // 10 is added as the control computer has a base of around 6 less
final int sizeToCompute = maxRadius + 10; final int sizeToCompute = maxRadius + 10;
torusSizeCache = new Int2IntOpenHashMap(sizeToCompute); torusSizeCache = new Int2IntOpenHashMap(sizeToCompute);
@ -83,6 +83,10 @@ public class Torus {
GEN_EXECUTOR.shutdown(); GEN_EXECUTOR.shutdown();
} }
/**
* @return {@link Int2IntMap}
* @throws RuntimeException If failed to initialize the map
*/
public static Int2IntMap getTorusSizeCache() { public static Int2IntMap getTorusSizeCache() {
if (!GEN_EXECUTOR.isShutdown()) { if (!GEN_EXECUTOR.isShutdown()) {
try { try {

View file

@ -35,10 +35,10 @@ import java.nio.file.Paths;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
//Quick too to migrate to the new lang format, and to try and keep as many lang entrys as possible // Quick too to migrate to the new lang format, and to try and keep as many lang entries as possible
public class TranslationTools { public class TranslationTools {
//Scanner used for manual matching // Scanner used for manual matching
private static final Scanner SCANNER = new Scanner(System.in); private static final Scanner SCANNER = new Scanner(System.in);
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
@ -68,7 +68,7 @@ public class TranslationTools {
key = keyMap.get(key); key = keyMap.get(key);
} }
if (!newLang.containsKey(key)) { if (!newLang.containsKey(key)) {
//Lost key, no point copying them over // Lost key, no point copying them over
continue; continue;
} }
output.put(key, value); output.put(key, value);

View file

@ -49,9 +49,9 @@ public class WorldUtils {
/** /**
* Checks if chunk is loaded using proper chunk manager * Checks if chunk is loaded using proper chunk manager
* *
* @param world World object * @param world {@link World} World object
* @param pos BlockPos X and Z coordinates to check * @param pos {@link BlockPos} X and Z coordinates to check
* @return boolean True if chunk is loaded * @return {@code boolean} True if chunk is loaded
*/ */
public static boolean isChunkLoaded(World world, BlockPos pos){ public static boolean isChunkLoaded(World world, BlockPos pos){
return world.getChunkManager().isChunkLoaded(ChunkSectionPos.getSectionCoord(pos.getX()), ChunkSectionPos.getSectionCoord(pos.getZ())); return world.getChunkManager().isChunkLoaded(ChunkSectionPos.getSectionCoord(pos.getX()), ChunkSectionPos.getSectionCoord(pos.getZ()));

View file

@ -34,7 +34,7 @@ import net.minecraft.util.registry.Registry;
import java.lang.reflect.Type; import java.lang.reflect.Type;
//Based from ee3's code // Based from ee3's code
public class ItemStackSerializer implements JsonSerializer<ItemStack>, JsonDeserializer<ItemStack> { public class ItemStackSerializer implements JsonSerializer<ItemStack>, JsonDeserializer<ItemStack> {
private static final String NAME = "name"; private static final String NAME = "name";

View file

@ -42,7 +42,7 @@ public class SerializationUtil {
.registerTypeAdapter(ItemStack.class, new ItemStackSerializer()) .registerTypeAdapter(ItemStack.class, new ItemStackSerializer())
.create(); .create();
//Same as above, just without pretty printing // Same as above, just without pretty printing
public static final Gson GSON_FLAT = new GsonBuilder() public static final Gson GSON_FLAT = new GsonBuilder()
.enableComplexMapKeySerialization() .enableComplexMapKeySerialization()
.registerTypeAdapter(ItemStack.class, new ItemStackSerializer()) .registerTypeAdapter(ItemStack.class, new ItemStackSerializer())

View file

@ -251,7 +251,7 @@ loom {
test.dependsOn runGametest test.dependsOn runGametest
runDatagen { runDatagen {
// Doesnt re-run the task when its up-to date // Doesn't re-run the task when its up-to date
outputs.dir('src/main/generated') outputs.dir('src/main/generated')
} }
@ -400,4 +400,4 @@ task checkVersion {
github.mustRunAfter checkVersion github.mustRunAfter checkVersion
publish.mustRunAfter checkVersion publish.mustRunAfter checkVersion
project.tasks.curseforge.mustRunAfter checkVersion project.tasks.curseforge.mustRunAfter checkVersion

View file

@ -133,7 +133,7 @@ class MachineRecipeJsonFactory<R extends RebornRecipe> {
protected void validate() { protected void validate() {
if (ingredients.isEmpty()) { if (ingredients.isEmpty()) {
throw new IllegalStateException("recipe has no ingrendients") throw new IllegalStateException("recipe has no ingredients")
} }
if (outputs.isEmpty()) { if (outputs.isEmpty()) {

View file

@ -81,7 +81,7 @@ public class TechReborn implements ModInitializer {
if (TechRebornConfig.machineSoundVolume > 0) { if (TechRebornConfig.machineSoundVolume > 0) {
if (TechRebornConfig.machineSoundVolume > 1) TechRebornConfig.machineSoundVolume = 1F; if (TechRebornConfig.machineSoundVolume > 1) TechRebornConfig.machineSoundVolume = 1F;
RecipeCrafter.soundHanlder = new ModSounds.SoundHandler(); RecipeCrafter.soundHandler = new ModSounds.SoundHandler();
} }
ModLoot.init(); ModLoot.init();
WorldGenerator.initWorldGen(); WorldGenerator.initWorldGen();

View file

@ -47,7 +47,7 @@ public interface CableElectrocutionEvent {
/** /**
* Fired before an entity is electrocuted * Fired before an entity is electrocuted
* *
* @return true to electrocute the entity (if not other listeners return false), false to do nothing * @return {@code boolean} true to electrocute the entity (if not other listeners return false), false to do nothing
*/ */
boolean electrocute(LivingEntity livingEntity, TRContent.Cables cableType, BlockPos blockPos, World world, CableBlockEntity cableBlockEntity); boolean electrocute(LivingEntity livingEntity, TRContent.Cables cableType, BlockPos blockPos, World world, CableBlockEntity cableBlockEntity);
} }

View file

@ -33,22 +33,24 @@ import java.util.Optional;
public class GeneratorRecipeHelper { public class GeneratorRecipeHelper {
/** /**
* This EnumMap store all the energy recipes for the fluid generators. Each * This {@link EnumMap} store all the energy recipes for the fluid generators. Each
* value of the EFluidGenerator enum is linked to an object holding a set of * value of the {@link EFluidGenerator} enum is linked to an object holding a set of
* FluidGeneratorRecipe. * {@link FluidGeneratorRecipe}.
*/ */
public static EnumMap<EFluidGenerator, FluidGeneratorRecipeList> fluidRecipes = new EnumMap<>( public static EnumMap<EFluidGenerator, FluidGeneratorRecipeList> fluidRecipes = new EnumMap<>(
EFluidGenerator.class); EFluidGenerator.class);
/** /**
* Register a Fluid energy recipe. * Register a {@link Fluid} energy recipe.
* *
* @param generatorType A value of the EFluidGenerator type in which the fluid is * @param generatorType {@link EFluidGenerator} A value of the {@link EFluidGenerator} type in
* allowed to be consumed. * which the fluid is allowed to be consumed.
* @param fluidType * @param fluidType {@link Fluid} The fluid type that will be registered.
* @param energyPerMb Represent the energy / MILLI_BUCKET the fluid will produce. * @param energyPerMb {@code int} Represent the energy / MILLI_BUCKET the fluid will produce.
* Some generators use this value to alter their fluid decay * <p>
* speed to match their maximum energy output. * Some generators use this value to alter their fluid decay
* speed to match their maximum energy output.
* </p>
*/ */
public static void registerFluidRecipe(EFluidGenerator generatorType, Fluid fluidType, int energyPerMb) { public static void registerFluidRecipe(EFluidGenerator generatorType, Fluid fluidType, int energyPerMb) {
fluidRecipes.putIfAbsent(generatorType, new FluidGeneratorRecipeList()); fluidRecipes.putIfAbsent(generatorType, new FluidGeneratorRecipeList());
@ -56,10 +58,10 @@ public class GeneratorRecipeHelper {
} }
/** /**
* @param generatorType A value of the EFluidGenerator type in which the fluid is * @param generatorType {@link EFluidGenerator} A value of the {@link EFluidGenerator} type in
* allowed to be consumed. * which the fluid is allowed to be consumed.
* @return An object holding a set of availables recipes for this type of * @return {@link FluidGeneratorRecipeList} An object holding a set of available recipes
* FluidGenerator. * for this type of {@link EFluidGenerator}.
*/ */
public static FluidGeneratorRecipeList getFluidRecipesForGenerator(EFluidGenerator generatorType) { public static FluidGeneratorRecipeList getFluidRecipesForGenerator(EFluidGenerator generatorType) {
return fluidRecipes.get(generatorType); return fluidRecipes.get(generatorType);
@ -68,8 +70,9 @@ public class GeneratorRecipeHelper {
/** /**
* Removes recipe * Removes recipe
* *
* @param generatorType A value of the EFluidGenerator type for which we should remove recipe * @param generatorType {@link EFluidGenerator} A value of the {@link EFluidGenerator} type for
* @param fluidType Fluid to remove from generator recipes * which we should remove recipe
* @param fluidType {@link Fluid} Fluid to remove from generator recipes
*/ */
public static void removeFluidRecipe(EFluidGenerator generatorType, Fluid fluidType) { public static void removeFluidRecipe(EFluidGenerator generatorType, Fluid fluidType) {
FluidGeneratorRecipeList recipeList = getFluidRecipesForGenerator(generatorType); FluidGeneratorRecipeList recipeList = getFluidRecipesForGenerator(generatorType);

View file

@ -38,10 +38,10 @@ import java.util.List;
public class ScrapboxRecipeCrafter extends RecipeCrafter { public class ScrapboxRecipeCrafter extends RecipeCrafter {
/** /**
* @param parent Tile having this crafter * @param parent {@link BlockEntity} Tile having this crafter
* @param inventory Inventory from parent blockEntity * @param inventory {@link RebornInventory} Inventory from parent blockEntity
* @param inputSlots Slot IDs for input * @param inputSlots {@code int[]} Slot IDs for input
* @param outputSlots Slot IDs for output * @param outputSlots {@code int[]} Slot IDs for output
*/ */
public ScrapboxRecipeCrafter(BlockEntity parent, RebornInventory<?> inventory, int[] inputSlots, int[] outputSlots) { public ScrapboxRecipeCrafter(BlockEntity parent, RebornInventory<?> inventory, int[] inputSlots, int[] outputSlots) {
super(ModRecipes.SCRAPBOX, parent, 1, 1, inventory, inputSlots, outputSlots); super(ModRecipes.SCRAPBOX, parent, 1, 1, inventory, inputSlots, outputSlots);

View file

@ -89,8 +89,9 @@ public class CableBlockEntity extends BlockEntity
* This prevents double transfer rates, and back and forth between two cables. * This prevents double transfer rates, and back and forth between two cables.
*/ */
int blockedSides = 0; int blockedSides = 0;
/** /**
* This is only used during the cable tick, whereas blockedOperations is used between ticks. * This is only used during the cable tick, whereas {@link #blockedSides} is used between ticks.
*/ */
boolean ioBlocked = false; boolean ioBlocked = false;

View file

@ -28,7 +28,7 @@ import net.minecraft.util.math.Direction;
import team.reborn.energy.api.EnergyStorage; import team.reborn.energy.api.EnergyStorage;
/** /**
* EnergyStorage adjacent to an energy cable, with some additional info. * {@link EnergyStorage} adjacent to an energy cable, with some additional info.
*/ */
class OfferedEnergyStorage { class OfferedEnergyStorage {
final CableBlockEntity sourceCable; final CableBlockEntity sourceCable;

View file

@ -86,7 +86,8 @@ public class DataDrivenBEProvider extends BlockEntityType<DataDrivenBEProvider.D
this.energy = JsonHelper.getInt(jsonObject, "energy"); this.energy = JsonHelper.getInt(jsonObject, "energy");
this.maxInput = JsonHelper.getInt(jsonObject, "maxInput"); this.maxInput = JsonHelper.getInt(jsonObject, "maxInput");
this.slots = DataDrivenSlot.read(JsonHelper.getArray(jsonObject, "slots")); this.slots = DataDrivenSlot.read(JsonHelper.getArray(jsonObject, "slots"));
Validate.isTrue(getEnergySlot() > 0); //Ensure there is an energy slot, doing it here so it crashes on game load // Ensure there is an energy slot, doing it here ensures it crashes on game load
Validate.isTrue(getEnergySlot() > 0);
} }
@Nullable @Nullable

View file

@ -55,7 +55,7 @@ public record DataDrivenSlot(int id, int x, int y, @NotNull SlotType type) {
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public void draw(MatrixStack matrixStack, GuiBase<?> guiBase, GuiBase.Layer layer) { public void draw(MatrixStack matrixStack, GuiBase<?> guiBase, GuiBase.Layer layer) {
//TODO find a better way to do this // TODO find a better way to do this
if (type() == SlotType.OUTPUT) { if (type() == SlotType.OUTPUT) {
guiBase.drawOutputSlot(matrixStack, x(), y(), layer); guiBase.drawOutputSlot(matrixStack, x(), y(), layer);
} else { } else {

View file

@ -30,7 +30,7 @@ import java.util.Arrays;
import java.util.function.BiConsumer; import java.util.function.BiConsumer;
public enum SlotType { public enum SlotType {
//Im really not a fan of the way I add the slots to the builder here // I'm really not a fan of the way I add the slots to the builder here
INPUT((builder, slot) -> { INPUT((builder, slot) -> {
builder.slot(slot.id(), slot.x(), slot.y()); builder.slot(slot.id(), slot.x(), slot.y());
}), }),

View file

@ -37,6 +37,7 @@ import reborncore.api.IToolDrop;
import reborncore.api.blockentity.InventoryProvider; import reborncore.api.blockentity.InventoryProvider;
import reborncore.common.blockentity.MachineBaseBlockEntity; import reborncore.common.blockentity.MachineBaseBlockEntity;
import reborncore.common.blocks.BlockMachineBase; import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.fluid.FluidUtils;
import reborncore.common.fluid.FluidValue; import reborncore.common.fluid.FluidValue;
import reborncore.common.powerSystem.PowerAcceptorBlockEntity; import reborncore.common.powerSystem.PowerAcceptorBlockEntity;
import reborncore.common.util.RebornInventory; import reborncore.common.util.RebornInventory;
@ -45,7 +46,6 @@ import techreborn.api.generator.EFluidGenerator;
import techreborn.api.generator.FluidGeneratorRecipe; import techreborn.api.generator.FluidGeneratorRecipe;
import techreborn.api.generator.FluidGeneratorRecipeList; import techreborn.api.generator.FluidGeneratorRecipeList;
import techreborn.api.generator.GeneratorRecipeHelper; import techreborn.api.generator.GeneratorRecipeHelper;
import reborncore.common.fluid.FluidUtils;
public abstract class BaseFluidGeneratorBlockEntity extends PowerAcceptorBlockEntity implements IToolDrop, InventoryProvider { public abstract class BaseFluidGeneratorBlockEntity extends PowerAcceptorBlockEntity implements IToolDrop, InventoryProvider {

View file

@ -127,7 +127,7 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I
return getPanel().generationRateN; return getPanel().generationRateN;
} }
// At this point, we know a light source is present and it's clear weather. We need to determine // At this point, we know a light source is present, and it's clear weather. We need to determine
// the level of generation based on % of time through the day, with peak production at noon and // the level of generation based on % of time through the day, with peak production at noon and
// a smooth transition to night production as sun rises/sets // a smooth transition to night production as sun rises/sets
float multiplier; float multiplier;

View file

@ -63,7 +63,7 @@ public class SolidFuelGeneratorBlockEntity extends PowerAcceptorBlockEntity impl
ItemStack burnItem; ItemStack burnItem;
public SolidFuelGeneratorBlockEntity(BlockPos pos, BlockState state) { public SolidFuelGeneratorBlockEntity(BlockPos pos, BlockState state) {
super(TRBlockEntities.SOLID_FUEL_GENEREATOR, pos, state); super(TRBlockEntities.SOLID_FUEL_GENERATOR, pos, state);
} }
public static int getItemBurnTime(@NotNull ItemStack stack) { public static int getItemBurnTime(@NotNull ItemStack stack) {

View file

@ -46,7 +46,7 @@ import techreborn.init.TRContent;
*/ */
public class WaterMillBlockEntity extends PowerAcceptorBlockEntity implements IToolDrop { public class WaterMillBlockEntity extends PowerAcceptorBlockEntity implements IToolDrop {
int waterblocks = 0; int waterBlocks = 0;
public WaterMillBlockEntity(BlockPos pos, BlockState state) { public WaterMillBlockEntity(BlockPos pos, BlockState state) {
super(TRBlockEntities.WATER_MILL, pos, state); super(TRBlockEntities.WATER_MILL, pos, state);
@ -62,8 +62,8 @@ public class WaterMillBlockEntity extends PowerAcceptorBlockEntity implements IT
if (world.getTime() % 20 == 0) { if (world.getTime() % 20 == 0) {
checkForWater(); checkForWater();
} }
if (waterblocks > 0) { if (waterBlocks > 0) {
addEnergyProbabilistic(waterblocks * TechRebornConfig.waterMillEnergyMultiplier); addEnergyProbabilistic(waterBlocks * TechRebornConfig.waterMillEnergyMultiplier);
world.setBlockState(pos, world.getBlockState(pos).with(BlockMachineBase.ACTIVE, true)); world.setBlockState(pos, world.getBlockState(pos).with(BlockMachineBase.ACTIVE, true));
} else { } else {
world.setBlockState(pos, world.getBlockState(pos).with(BlockMachineBase.ACTIVE, false)); world.setBlockState(pos, world.getBlockState(pos).with(BlockMachineBase.ACTIVE, false));
@ -71,10 +71,10 @@ public class WaterMillBlockEntity extends PowerAcceptorBlockEntity implements IT
} }
public void checkForWater() { public void checkForWater() {
waterblocks = 0; waterBlocks = 0;
for (Direction facing : Direction.values()) { for (Direction facing : Direction.values()) {
if (facing.getAxis().isHorizontal() && world.getBlockState(pos.offset(facing)).getBlock() == Blocks.WATER) { if (facing.getAxis().isHorizontal() && world.getBlockState(pos.offset(facing)).getBlock() == Blocks.WATER) {
waterblocks++; waterBlocks++;
} }
} }
} }

View file

@ -95,7 +95,7 @@ public class LampBlockEntity extends PowerAcceptorBlockEntity implements IToolDr
return 32; return 32;
} }
//MachineBaseBlockEntity // MachineBaseBlockEntity
@Override @Override
public Direction getFacing(){ public Direction getFacing(){
if (world == null){ if (world == null){

View file

@ -26,6 +26,7 @@ package techreborn.blockentity.machine;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityType; import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -57,11 +58,11 @@ public abstract class GenericMachineBlockEntity extends PowerAcceptorBlockEntity
public RecipeCrafter crafter; public RecipeCrafter crafter;
/** /**
* @param name String Name for a blockEntity. Do we need it at all? * @param name {@link String} Name for a {@link BlockEntity}. Do we need it at all?
* @param maxInput int Maximum energy input, value in EU * @param maxInput {@code int} Maximum energy input, value in EU
* @param maxEnergy int Maximum energy buffer, value in EU * @param maxEnergy {@code int} Maximum energy buffer, value in EU
* @param toolDrop Block Block to drop with wrench * @param toolDrop {@link Block} Block to drop with wrench
* @param energySlot int Energy slot to use to charge machine from battery * @param energySlot {@code int} Energy slot to use to charge machine from battery
*/ */
public GenericMachineBlockEntity(BlockEntityType<?> blockEntityType, BlockPos pos, BlockState state, String name, int maxInput, int maxEnergy, Block toolDrop, int energySlot) { public GenericMachineBlockEntity(BlockEntityType<?> blockEntityType, BlockPos pos, BlockState state, String name, int maxInput, int maxEnergy, Block toolDrop, int energySlot) {
super(blockEntityType, pos, state); super(blockEntityType, pos, state);
@ -76,8 +77,8 @@ public abstract class GenericMachineBlockEntity extends PowerAcceptorBlockEntity
/** /**
* Returns progress scaled to input value * Returns progress scaled to input value
* *
* @param scale int Maximum value for progress * @param scale {@code int} Maximum value for progress
* @return int Scale of progress * @return {@code int} Scale of progress
*/ */
public int getProgressScaled(int scale) { public int getProgressScaled(int scale) {
if (crafter != null && crafter.currentTickTime != 0 && crafter.currentNeededTicks != 0) { if (crafter != null && crafter.currentTickTime != 0 && crafter.currentNeededTicks != 0) {

View file

@ -75,8 +75,8 @@ public abstract class AbstractIronMachineBlockEntity extends MachineBaseBlockEnt
* Returns the number of ticks that the supplied fuel item will keep the * Returns the number of ticks that the supplied fuel item will keep the
* furnace burning, or 0 if the item isn't fuel * furnace burning, or 0 if the item isn't fuel
* *
* @param stack Itemstack of fuel * @param stack {@link ItemStack} stack of fuel
* @return Integer Number of ticks * @return {@code int} Number of ticks
*/ */
private int getItemBurnTime(ItemStack stack) { private int getItemBurnTime(ItemStack stack) {
if (stack.isEmpty()) { if (stack.isEmpty()) {
@ -88,8 +88,8 @@ public abstract class AbstractIronMachineBlockEntity extends MachineBaseBlockEnt
/** /**
* Returns remaining fraction of fuel burn time * Returns remaining fraction of fuel burn time
* *
* @param scale Scale to use for burn time * @param scale {@code int} Scale to use for burn time
* @return int scaled remaining fuel burn time * @return {@code int} scaled remaining fuel burn time
*/ */
public int getBurnTimeRemainingScaled(int scale) { public int getBurnTimeRemainingScaled(int scale) {
if (totalBurnTime == 0) { if (totalBurnTime == 0) {
@ -102,8 +102,8 @@ public abstract class AbstractIronMachineBlockEntity extends MachineBaseBlockEnt
/** /**
* Returns crafting progress * Returns crafting progress
* *
* @param scale Scale to use for crafting progress * @param scale {@code int} Scale to use for crafting progress
* @return int Scaled crafting progress * @return {@code int} Scaled crafting progress
*/ */
public int getProgressScaled(int scale) { public int getProgressScaled(int scale) {
if (totalCookingTime > 0) { if (totalCookingTime > 0) {
@ -115,7 +115,7 @@ public abstract class AbstractIronMachineBlockEntity extends MachineBaseBlockEnt
/** /**
* Returns true if Iron Machine is burning fuel thus can do work * Returns true if Iron Machine is burning fuel thus can do work
* *
* @return Boolean True if machine is burning * @return {@code boolean} True if machine is burning
*/ */
public boolean isBurning() { public boolean isBurning() {
return burnTime > 0; return burnTime > 0;
@ -233,4 +233,4 @@ public abstract class AbstractIronMachineBlockEntity extends MachineBaseBlockEnt
} }
} }

View file

@ -57,8 +57,8 @@ public class IronAlloyFurnaceBlockEntity extends AbstractIronMachineBlockEntity
} }
for (RebornIngredient ingredient : recipeType.getRebornIngredients()) { for (RebornIngredient ingredient : recipeType.getRebornIngredients()) {
boolean hasItem = false; boolean hasItem = false;
for (int inputslot = 0; inputslot < 2; inputslot++) { for (int inputSlot = 0; inputSlot < 2; inputSlot++) {
if (ingredient.test(inventory.getStack(inputslot))) { if (ingredient.test(inventory.getStack(inputSlot))) {
hasItem = true; hasItem = true;
} }
} }

View file

@ -25,6 +25,7 @@
package techreborn.blockentity.machine.multiblock; package techreborn.blockentity.machine.multiblock;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtCompound;
@ -107,7 +108,7 @@ public class FusionControlComputerBlockEntity extends GenericMachineBlockEntity
/** /**
* Changes size of fusion reactor ring after GUI button click * Changes size of fusion reactor ring after GUI button click
* *
* @param sizeDelta int Size increment * @param sizeDelta {@code int} Size increment
*/ */
public void changeSize(int sizeDelta) { public void changeSize(int sizeDelta) {
int newSize = size + sizeDelta; int newSize = size + sizeDelta;
@ -125,13 +126,13 @@ public class FusionControlComputerBlockEntity extends GenericMachineBlockEntity
} }
/** /**
* Checks that ItemStack could be inserted into slot provided, including check * Checks that {@link ItemStack} could be inserted into slot provided, including check
* for existing item in slot and maximum stack size * for existing item in slot and maximum stack size
* *
* @param stack ItemStack ItemStack to insert * @param stack {@link ItemStack} Stack to insert
* @param slot int Slot ID to check * @param slot {@code int} Slot ID to check
* @param tags boolean Should we use tags * @param tags {@code boolean} Should we use tags
* @return boolean Returns true if ItemStack will fit into slot * @return {@code boolean} Returns true if ItemStack will fit into slot
*/ */
public boolean canFitStack(ItemStack stack, int slot, boolean tags) {// Checks to see if it can public boolean canFitStack(ItemStack stack, int slot, boolean tags) {// Checks to see if it can
// fit the stack // fit the stack
@ -165,18 +166,18 @@ public class FusionControlComputerBlockEntity extends GenericMachineBlockEntity
/** /**
* Validates if reactor has all inputs and can output result * Validates if reactor has all inputs and can output result
* *
* @param recipe FusionReactorRecipe Recipe to validate * @param recipe {@link FusionReactorRecipe} Recipe to validate
* @return Boolean True if we have all inputs and can fit output * @return {@code boolean} True if we have all inputs and can fit output
*/ */
private boolean validateRecipe(FusionReactorRecipe recipe) { private boolean validateRecipe(FusionReactorRecipe recipe) {
return hasAllInputs(recipe) && canFitStack(recipe.getOutputs().get(0), outputStackSlot, true); return hasAllInputs(recipe) && canFitStack(recipe.getOutputs().get(0), outputStackSlot, true);
} }
/** /**
* Check if BlockEntity has all necessary inputs for recipe provided * Check if {@link BlockEntity} has all necessary inputs for recipe provided
* *
* @param recipeType RebornRecipe Recipe to check inputs * @param recipeType {@link RebornRecipe} Recipe to check inputs
* @return Boolean True if reactor has all inputs for recipe * @return {@code boolean} True if reactor has all inputs for recipe
*/ */
private boolean hasAllInputs(RebornRecipe recipeType) { private boolean hasAllInputs(RebornRecipe recipeType) {
if (recipeType == null) { if (recipeType == null) {
@ -198,7 +199,7 @@ public class FusionControlComputerBlockEntity extends GenericMachineBlockEntity
/** /**
* Decrease stack size on the given slot according to recipe input * Decrease stack size on the given slot according to recipe input
* *
* @param slot int Slot number * @param slot {@code int} Slot number
*/ */
private void useInput(int slot) { private void useInput(int slot) {
if (currentRecipe == null) { if (currentRecipe == null) {
@ -259,7 +260,7 @@ public class FusionControlComputerBlockEntity extends GenericMachineBlockEntity
return; return;
} }
//Move this to here from the nbt read method, as it now requires the world as of 1.14 // Move this to here from the nbt read method, as it now requires the world as of 1.14
if (checkNBTRecipe) { if (checkNBTRecipe) {
checkNBTRecipe = false; checkNBTRecipe = false;
for (final RebornRecipe reactorRecipe : ModRecipes.FUSION_REACTOR.getRecipes(getWorld())) { for (final RebornRecipe reactorRecipe : ModRecipes.FUSION_REACTOR.getRecipes(getWorld())) {
@ -270,7 +271,7 @@ public class FusionControlComputerBlockEntity extends GenericMachineBlockEntity
} }
if (lastTick == world.getTime()) { if (lastTick == world.getTime()) {
//Prevent tick accelerators, blame obstinate for this. // Prevent tick accelerators, blame obstinate for this.
return; return;
} }
lastTick = world.getTime(); lastTick = world.getTime();
@ -308,7 +309,7 @@ public class FusionControlComputerBlockEntity extends GenericMachineBlockEntity
if (hasStartedCrafting && craftingTickTime < currentRecipe.getTime()) { if (hasStartedCrafting && craftingTickTime < currentRecipe.getTime()) {
// Power gen // Power gen
if (currentRecipe.getPower() > 0) { if (currentRecipe.getPower() > 0) {
// Waste power if it has no where to go // Waste power if it has nowhere to go
long power = (long) (Math.abs(currentRecipe.getPower()) * getPowerMultiplier()); long power = (long) (Math.abs(currentRecipe.getPower()) * getPowerMultiplier());
addEnergy(power); addEnergy(power);
powerChange = (power); powerChange = (power);
@ -380,7 +381,7 @@ public class FusionControlComputerBlockEntity extends GenericMachineBlockEntity
tagCompound.putInt("size", size); tagCompound.putInt("size", size);
} }
//MachineBaseBlockEntity // MachineBaseBlockEntity
@Override @Override
public double getPowerMultiplier() { public double getPowerMultiplier() {
double calc = (1F / 2F) * Math.pow(size - 5, 1.8); double calc = (1F / 2F) * Math.pow(size - 5, 1.8);

View file

@ -262,7 +262,7 @@ public class AutoCraftingTableBlockEntity extends PowerAcceptorBlockEntity
if (balanceSlot > craftCache.size()) { if (balanceSlot > craftCache.size()) {
balanceSlot = 0; balanceSlot = 0;
} }
//Find the best slot for each item in a recipe, and move it if needed // Find the best slot for each item in a recipe, and move it if needed
ItemStack sourceStack = inventory.getStack(balanceSlot); ItemStack sourceStack = inventory.getStack(balanceSlot);
if (sourceStack.isEmpty()) { if (sourceStack.isEmpty()) {
return Optional.empty(); return Optional.empty();

Some files were not shown because too many files have changed in this diff Show more