Merge branch '1.18' into 1.18-Ayutac-datagen-6
This commit is contained in:
commit
19f657a0d6
241 changed files with 2043 additions and 942 deletions
|
@ -3,6 +3,7 @@ root = true
|
|||
[*]
|
||||
charset = utf-8
|
||||
tab_width = 4
|
||||
indent_size = 4
|
||||
|
||||
[*.java]
|
||||
indent_style = tab
|
||||
|
|
6
.github/CONTRIBUTING.md
vendored
6
.github/CONTRIBUTING.md
vendored
|
@ -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.
|
||||
|
||||
* The code compiles )).
|
||||
* The code compiles.
|
||||
* The code has been developer-tested.
|
||||
* The code includes javadoc where appropriate.
|
||||
* 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?
|
||||
* Was performance considered?
|
||||
* Corner cases well documented or any workarounds for a known limitation of the MC, Fabric, RC, etc used.
|
||||
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ To report an issue or make a suggestion, please head up to the `Issues` tab up a
|
|||
|
||||
# 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
|
||||
|
||||
|
|
|
@ -25,11 +25,12 @@
|
|||
package io.github.cottonmc.libcd.api;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.recipe.Recipe;
|
||||
|
||||
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.
|
||||
*/
|
||||
public interface CustomOutputRecipe {
|
||||
|
|
|
@ -33,8 +33,8 @@ import net.fabricmc.fabric.api.event.world.WorldTickCallback;
|
|||
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidStorage;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.util.Identifier;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import reborncore.api.ToolManager;
|
||||
import reborncore.api.blockentity.UnloadHandler;
|
||||
import reborncore.common.RebornCoreCommands;
|
||||
|
@ -77,7 +77,7 @@ public class RebornCore implements ModInitializer {
|
|||
public void onInitialize() {
|
||||
new Configuration(RebornCoreConfig.class, MOD_ID);
|
||||
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("forestry:wrench"), false));
|
||||
|
|
|
@ -44,11 +44,11 @@ public class RebornRegistry {
|
|||
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 builder Item.Settings Settings builder for BlockItem
|
||||
* @param name Identifier Registry name for block and item
|
||||
* @param block {@link Block} Block to register
|
||||
* @param builder {@link Item.Settings} Settings builder for {@link BlockItem}
|
||||
* @param name {@link Identifier} Registry name for block and item
|
||||
*/
|
||||
public static void registerBlock(Block block, Item.Settings builder, Identifier name) {
|
||||
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
|
||||
*
|
||||
* @param block Block Block to register
|
||||
* @param itemGroup Item.Settings Settings builder for BlockItem
|
||||
* @param block {@link Block} Block to register
|
||||
* @param itemGroup {@link Item.Settings} Settings builder for {@link BlockItem}
|
||||
*/
|
||||
public static void registerBlock(Block block, Item.Settings itemGroup) {
|
||||
Validate.isTrue(objIdentMap.containsKey(block));
|
||||
|
@ -80,9 +80,11 @@ public class RebornRegistry {
|
|||
}
|
||||
|
||||
/**
|
||||
* Register only Block, without BlockItem in vanilla registries
|
||||
* Block should have registered identifier in RebornRegistry via {@link #registerIdent registerIdent} method
|
||||
* @param block Block Block to register
|
||||
* Register only {@link Block}, without {@link BlockItem} in vanilla registries
|
||||
* Block should have registered identifier in {@link RebornRegistry} via
|
||||
* {@link #registerIdent registerIdent} method
|
||||
*
|
||||
* @param block {@link Block} Block to register
|
||||
*/
|
||||
public static void registerBlockNoItem(Block 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 name Identifier Registry name for item
|
||||
* @param item {@link Item} Item to register
|
||||
* @param name {@link Identifier} Registry name for item
|
||||
*/
|
||||
public static void registerItem(Item item, Identifier name) {
|
||||
Registry.register(Registry.ITEM, name, item);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register Item in vanilla registries
|
||||
* Item should have registered identifier in RebornRegistry via {@link #registerIdent registerIdent} method
|
||||
* <p>Register {@link Item} in vanilla registries</p>
|
||||
* <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){
|
||||
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 identifier Identifier Registry name for object
|
||||
* @param object {@link Object}, {@link Item}, {@link Block} or whatever to be put into map
|
||||
* @param identifier {@link Identifier} Registry name for object
|
||||
*/
|
||||
public static void registerIdent(Object object, Identifier identifier){
|
||||
objIdentMap.put(object, identifier);
|
||||
|
|
|
@ -36,15 +36,16 @@ import net.minecraft.world.World;
|
|||
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 pos the pos of the block
|
||||
* @param world the world of the block
|
||||
* @param player the player that actived the block
|
||||
* @param side the side that the player actived
|
||||
* @param damage if the tool should be damged, 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.
|
||||
* @param stack {@link ItemStack} The held itemstack
|
||||
* @param pos {@link BlockPos} The pos of the block
|
||||
* @param world {@link World} The world of the block
|
||||
* @param player {@link PlayerEntity} The player that activated the block
|
||||
* @param side {@link Direction} The side that the player activated
|
||||
* @param damage {@code boolean} If the tool should be damaged, or power taken
|
||||
* @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);
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ public interface IUpgradeable {
|
|||
return true;
|
||||
}
|
||||
|
||||
Inventory getUpgradeInvetory();
|
||||
Inventory getUpgradeInventory();
|
||||
|
||||
int getUpgradeSlotCount();
|
||||
|
||||
|
|
|
@ -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.
|
||||
* Event is called after damage is being reduced by armor already and before damage reduction from enchants.
|
||||
* <p>Apply armor to amount of damage inflicted.</p>
|
||||
* Decreases it in most cases unless armor should increase damage inflicted.
|
||||
*
|
||||
* @param player PlayerEntity Player being damaged
|
||||
* @param source DamageSource Type of damage
|
||||
* @param amount float Current amount of damage
|
||||
* @return float Amount of damage after reduction
|
||||
* <p>Event is called after damage is being reduced by armor already and before damage reduction from enchants.</p>
|
||||
*
|
||||
* @param player {@link PlayerEntity} Player being damaged
|
||||
* @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);
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ public abstract class InventoryBase implements Inventory {
|
|||
|
||||
@Override
|
||||
public void markDirty() {
|
||||
//Stuff happens in the super methods
|
||||
// Stuff happens in the super methods
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -50,7 +50,7 @@ public class ClientChunkManager {
|
|||
|
||||
public static void toggleLoadedChunks(BlockPos chunkLoader) {
|
||||
if (loadedChunks.size() == 0) {
|
||||
NetworkManager.sendToServer(ServerBoundPackets.requestChunkloaderChunks(chunkLoader));
|
||||
NetworkManager.sendToServer(ServerBoundPackets.requestChunkLoaderChunks(chunkLoader));
|
||||
} else {
|
||||
loadedChunks.clear();
|
||||
}
|
||||
|
|
|
@ -44,7 +44,8 @@ import java.nio.file.Files;
|
|||
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
|
||||
*/
|
||||
public class ItemStackRenderer implements HudRenderCallback {
|
||||
|
|
|
@ -40,151 +40,151 @@ import java.util.Arrays;
|
|||
import java.util.Collections;
|
||||
|
||||
public class ModelSantaHat extends EntityModel<AbstractClientPlayerEntity> {
|
||||
private final ModelPart hatband1;
|
||||
private final ModelPart hatband2;
|
||||
private final ModelPart hatband3;
|
||||
private final ModelPart hatband4;
|
||||
private final ModelPart hatbase1;
|
||||
private final ModelPart hatband5;
|
||||
private final ModelPart hatband6;
|
||||
private final ModelPart hatbase2;
|
||||
private final ModelPart hatextension1;
|
||||
private final ModelPart hatextension2;
|
||||
private final ModelPart hatextension3;
|
||||
private final ModelPart hatextension4;
|
||||
private final ModelPart hatball1;
|
||||
private final ModelPart hatball2;
|
||||
private final ModelPart hatball3;
|
||||
private final ModelPart hatball4;
|
||||
private final ModelPart hatball5;
|
||||
private final ModelPart hatball6;
|
||||
private final ModelPart hatBand1;
|
||||
private final ModelPart hatBand2;
|
||||
private final ModelPart hatBand3;
|
||||
private final ModelPart hatBand4;
|
||||
private final ModelPart hatBase1;
|
||||
private final ModelPart hatBand5;
|
||||
private final ModelPart hatBand6;
|
||||
private final ModelPart hatBase2;
|
||||
private final ModelPart hatExtension1;
|
||||
private final ModelPart hatExtension2;
|
||||
private final ModelPart hatExtension3;
|
||||
private final ModelPart hatExtension4;
|
||||
private final ModelPart hatBall1;
|
||||
private final ModelPart hatBall2;
|
||||
private final ModelPart hatBall3;
|
||||
private final ModelPart hatBall4;
|
||||
private final ModelPart hatBall5;
|
||||
private final ModelPart hatBall6;
|
||||
|
||||
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)
|
||||
};
|
||||
hatband1 = new ModelPart(Arrays.asList(hatband1Cuboids), Collections.emptyMap());
|
||||
hatband1.setPivot(0F, 0F, 0F);
|
||||
setRotation(hatband1, 0F, 0F, 0F);
|
||||
hatBand1 = new ModelPart(Arrays.asList(hatBand1Cuboids), Collections.emptyMap());
|
||||
hatBand1.setPivot(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)
|
||||
};
|
||||
hatband2 = new ModelPart(Arrays.asList(hatband2Cuboids), Collections.emptyMap());
|
||||
hatband2.setPivot(0F, 0F, 0F);
|
||||
setRotation(hatband2, 0F, 0F, 0F);
|
||||
hatBand2 = new ModelPart(Arrays.asList(hatBand2Cuboids), Collections.emptyMap());
|
||||
hatBand2.setPivot(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)
|
||||
};
|
||||
hatband3 = new ModelPart(Arrays.asList(hatband3Cuboids), Collections.emptyMap());
|
||||
hatband3.setPivot(0F, 0F, 0F);
|
||||
setRotation(hatband3, 0F, 0F, 0F);
|
||||
hatBand3 = new ModelPart(Arrays.asList(hatBand3Cuboids), Collections.emptyMap());
|
||||
hatBand3.setPivot(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)
|
||||
};
|
||||
hatband4 = new ModelPart(Arrays.asList(hatband4Cuboids), Collections.emptyMap());
|
||||
hatband4.setPivot(0F, 0F, 0F);
|
||||
setRotation(hatband4, 0F, 0F, 0F);
|
||||
hatBand4 = new ModelPart(Arrays.asList(hatBand4Cuboids), Collections.emptyMap());
|
||||
hatBand4.setPivot(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)
|
||||
};
|
||||
hatbase1 = new ModelPart(Arrays.asList(hatbase1Cuboids), Collections.emptyMap());
|
||||
hatbase1.setPivot(0F, 0F, 0F);
|
||||
setRotation(hatbase1, 0F, 0F, 0F);
|
||||
hatBase1 = new ModelPart(Arrays.asList(hatBase1Cuboids), Collections.emptyMap());
|
||||
hatBase1.setPivot(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)
|
||||
};
|
||||
hatband5 = new ModelPart(Arrays.asList(hatband5Cuboids), Collections.emptyMap());
|
||||
hatband5.setPivot(0F, 0F, 0F);
|
||||
setRotation(hatband5, 0F, 0F, 0F);
|
||||
hatBand5 = new ModelPart(Arrays.asList(hatBand5Cuboids), Collections.emptyMap());
|
||||
hatBand5.setPivot(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)
|
||||
};
|
||||
hatband6 = new ModelPart(Arrays.asList(hatband6Cuboids), Collections.emptyMap());
|
||||
hatband6.setPivot(0F, 0F, 4F);
|
||||
setRotation(hatband6, 0F, 0F, 0F);
|
||||
hatBand6 = new ModelPart(Arrays.asList(hatBand6Cuboids), Collections.emptyMap());
|
||||
hatBand6.setPivot(0F, 0F, 4F);
|
||||
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)
|
||||
};
|
||||
hatbase2 = new ModelPart(Arrays.asList(hatbase2Cuboids), Collections.emptyMap());
|
||||
hatbase2.setPivot(0F, 0F, 0F);
|
||||
setRotation(hatbase2, 0F, 0.1115358F, 0F);
|
||||
hatBase2 = new ModelPart(Arrays.asList(hatBase2Cuboids), Collections.emptyMap());
|
||||
hatBase2.setPivot(0F, 0F, 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)
|
||||
};
|
||||
hatextension1 = new ModelPart(Arrays.asList(hatextension1Cuboids), Collections.emptyMap());
|
||||
hatextension1.setPivot(0F, 0F, 0F);
|
||||
setRotation(hatextension1, 0F, -0.0371786F, 0.0743572F);
|
||||
hatExtension1 = new ModelPart(Arrays.asList(hatExtension1Cuboids), Collections.emptyMap());
|
||||
hatExtension1.setPivot(0F, 0F, 0F);
|
||||
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)
|
||||
};
|
||||
hatextension2 = new ModelPart(Arrays.asList(hatextension2Cuboids), Collections.emptyMap());
|
||||
hatextension2.setPivot(0F, 0F, 0F);
|
||||
setRotation(hatextension2, 0F, 0.0743572F, 0.0743572F);
|
||||
hatExtension2 = new ModelPart(Arrays.asList(hatExtension2Cuboids), Collections.emptyMap());
|
||||
hatExtension2.setPivot(0F, 0F, 0F);
|
||||
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)
|
||||
};
|
||||
hatextension3 = new ModelPart(Arrays.asList(hatextension3Cuboids), Collections.emptyMap());
|
||||
hatextension3.setPivot(0F, 0F, 0F);
|
||||
setRotation(hatextension3, 0F, 0F, 0.2230717F);
|
||||
hatExtension3 = new ModelPart(Arrays.asList(hatExtension3Cuboids), Collections.emptyMap());
|
||||
hatExtension3.setPivot(0F, 0F, 0F);
|
||||
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)
|
||||
};
|
||||
hatextension4 = new ModelPart(Arrays.asList(hatextension4Cuboids), Collections.emptyMap());
|
||||
hatextension4.setPivot(0F, 0F, 0F);
|
||||
setRotation(hatextension4, 0F, 0F, 1.264073F);
|
||||
hatExtension4 = new ModelPart(Arrays.asList(hatExtension4Cuboids), Collections.emptyMap());
|
||||
hatExtension4.setPivot(0F, 0F, 0F);
|
||||
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)
|
||||
};
|
||||
hatball1 = new ModelPart(Arrays.asList(hatball1Cuboids), Collections.emptyMap());
|
||||
hatball1.setPivot(0F, 0F, 0F);
|
||||
setRotation(hatball1, 0F, 0F, 0F);
|
||||
hatBall1 = new ModelPart(Arrays.asList(hatBall1Cuboids), Collections.emptyMap());
|
||||
hatBall1.setPivot(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)
|
||||
};
|
||||
hatball2 = new ModelPart(Arrays.asList(hatball2Cuboids), Collections.emptyMap());
|
||||
hatball2.setPivot(0F, 0F, 0F);
|
||||
setRotation(hatball2, 0F, 0F, 0F);
|
||||
hatBall2 = new ModelPart(Arrays.asList(hatBall2Cuboids), Collections.emptyMap());
|
||||
hatBall2.setPivot(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)
|
||||
};
|
||||
hatball3 = new ModelPart(Arrays.asList(hatball3Cuboids), Collections.emptyMap());
|
||||
hatball3.setPivot(0F, 0F, 0F);
|
||||
setRotation(hatball3, 0F, 0F, 0F);
|
||||
hatBall3 = new ModelPart(Arrays.asList(hatBall3Cuboids), Collections.emptyMap());
|
||||
hatBall3.setPivot(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)
|
||||
};
|
||||
hatball4 = new ModelPart(Arrays.asList(hatball4Cuboids), Collections.emptyMap());
|
||||
hatball4.setPivot(0F, 0F, 0F);
|
||||
setRotation(hatball4, 0F, 0F, 0F);
|
||||
hatBall4 = new ModelPart(Arrays.asList(hatBall4Cuboids), Collections.emptyMap());
|
||||
hatBall4.setPivot(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)
|
||||
};
|
||||
hatball5 = new ModelPart(Arrays.asList(hatball5Cuboids), Collections.emptyMap());
|
||||
hatball5.setPivot(0F, 0F, 0F);
|
||||
setRotation(hatball5, 0F, 0F, 0F);
|
||||
hatBall5 = new ModelPart(Arrays.asList(hatBall5Cuboids), Collections.emptyMap());
|
||||
hatBall5.setPivot(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)
|
||||
};
|
||||
hatball6 = new ModelPart(Arrays.asList(hatball6Cuboids), Collections.emptyMap());
|
||||
hatball6.setPivot(0F, 0F, 0F);
|
||||
setRotation(hatball6, 0F, 0F, 0F);
|
||||
hatBall6 = new ModelPart(Arrays.asList(hatBall6Cuboids), Collections.emptyMap());
|
||||
hatBall6.setPivot(0F, 0F, 0F);
|
||||
setRotation(hatBall6, 0F, 0F, 0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -194,24 +194,24 @@ public class ModelSantaHat extends EntityModel<AbstractClientPlayerEntity> {
|
|||
|
||||
@Override
|
||||
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);
|
||||
hatband2.render(matrixStack, vertexConsumer, light, overlay);
|
||||
hatband3.render(matrixStack, vertexConsumer, light, overlay);
|
||||
hatband4.render(matrixStack, vertexConsumer, light, overlay);
|
||||
hatbase1.render(matrixStack, vertexConsumer, light, overlay);
|
||||
hatband5.render(matrixStack, vertexConsumer, light, overlay);
|
||||
hatband6.render(matrixStack, vertexConsumer, light, overlay);
|
||||
hatbase2.render(matrixStack, vertexConsumer, light, overlay);
|
||||
hatextension1.render(matrixStack, vertexConsumer, light, overlay);
|
||||
hatextension2.render(matrixStack, vertexConsumer, light, overlay);
|
||||
hatextension3.render(matrixStack, vertexConsumer, light, overlay);
|
||||
hatextension4.render(matrixStack, vertexConsumer, light, overlay);
|
||||
hatball1.render(matrixStack, vertexConsumer, light, overlay);
|
||||
hatball2.render(matrixStack, vertexConsumer, light, overlay);
|
||||
hatball3.render(matrixStack, vertexConsumer, light, overlay);
|
||||
hatball4.render(matrixStack, vertexConsumer, light, overlay);
|
||||
hatball5.render(matrixStack, vertexConsumer, light, overlay);
|
||||
hatball6.render(matrixStack, vertexConsumer, light, overlay);
|
||||
hatBand1.render(matrixStack, vertexConsumer, light, overlay);
|
||||
hatBand2.render(matrixStack, vertexConsumer, light, overlay);
|
||||
hatBand3.render(matrixStack, vertexConsumer, light, overlay);
|
||||
hatBand4.render(matrixStack, vertexConsumer, light, overlay);
|
||||
hatBase1.render(matrixStack, vertexConsumer, light, overlay);
|
||||
hatBand5.render(matrixStack, vertexConsumer, light, overlay);
|
||||
hatBand6.render(matrixStack, vertexConsumer, light, overlay);
|
||||
hatBase2.render(matrixStack, vertexConsumer, light, overlay);
|
||||
hatExtension1.render(matrixStack, vertexConsumer, light, overlay);
|
||||
hatExtension2.render(matrixStack, vertexConsumer, light, overlay);
|
||||
hatExtension3.render(matrixStack, vertexConsumer, light, overlay);
|
||||
hatExtension4.render(matrixStack, vertexConsumer, light, overlay);
|
||||
hatBall1.render(matrixStack, vertexConsumer, light, overlay);
|
||||
hatBall2.render(matrixStack, vertexConsumer, light, overlay);
|
||||
hatBall3.render(matrixStack, vertexConsumer, light, overlay);
|
||||
hatBall4.render(matrixStack, vertexConsumer, light, overlay);
|
||||
hatBall5.render(matrixStack, vertexConsumer, light, overlay);
|
||||
hatBall6.render(matrixStack, vertexConsumer, light, overlay);
|
||||
}
|
||||
|
||||
private void setRotation(ModelPart model, float x, float y, float z) {
|
||||
|
|
|
@ -37,10 +37,10 @@ import reborncore.common.util.Color;
|
|||
public class GuiButtonCustomTexture extends ButtonWidget {
|
||||
public int textureU;
|
||||
public int textureV;
|
||||
public String texturename;
|
||||
public String textureName;
|
||||
public String linkedPage;
|
||||
public Text name;
|
||||
public String imageprefix = "techreborn:textures/manual/elements/";
|
||||
public String imagePrefix = "techreborn:textures/manual/elements/";
|
||||
public int buttonHeight;
|
||||
public int buttonWidth;
|
||||
public int buttonU;
|
||||
|
@ -49,11 +49,11 @@ public class GuiButtonCustomTexture extends ButtonWidget {
|
|||
public int textureW;
|
||||
|
||||
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);
|
||||
this.textureU = u;
|
||||
this.textureV = v;
|
||||
this.texturename = texturename;
|
||||
this.textureName = textureName;
|
||||
this.name = name;
|
||||
this.linkedPage = linkedPage;
|
||||
this.buttonHeight = height;
|
||||
|
@ -87,7 +87,7 @@ public class GuiButtonCustomTexture extends ButtonWidget {
|
|||
}
|
||||
|
||||
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.blendFunc(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA);
|
||||
|
|
|
@ -389,13 +389,13 @@ public class GuiBase<T extends ScreenHandler> extends HandledScreen<T> {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param rectX int Top left corner of region
|
||||
* @param rectY int Top left corner of region
|
||||
* @param rectWidth int Width of region
|
||||
* @param rectHeight int Height of region
|
||||
* @param pointX int Mouse pointer
|
||||
* @param pointY int Mouse pointer
|
||||
* @return boolean Returns true if mouse pointer is in region specified
|
||||
* @param rectX {@code int} Top left corner of region
|
||||
* @param rectY {@code int} Top left corner of region
|
||||
* @param rectWidth {@code int} Width of region
|
||||
* @param rectHeight {@code int} Height of region
|
||||
* @param pointX {@code int} Mouse pointer
|
||||
* @param pointY {@code int} Mouse pointer
|
||||
* @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) {
|
||||
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() {
|
||||
// Just to stop complains from IDEA
|
||||
// Just to stop complaints from IDEA
|
||||
if (client == null) {
|
||||
throw new NullPointerException("Minecraft client is null.");
|
||||
}
|
||||
|
@ -454,7 +454,7 @@ public class GuiBase<T extends ScreenHandler> extends HandledScreen<T> {
|
|||
|
||||
@Override
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ public class SlotConfigGui {
|
|||
}
|
||||
String json = machine.getSlotConfiguration().toJson(machine.getClass().getCanonicalName());
|
||||
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() {
|
||||
|
|
|
@ -55,7 +55,7 @@ public class FluidConfigPopupElement extends ElementBase {
|
|||
public boolean filter = false;
|
||||
|
||||
ConfigFluidElement fluidElement;
|
||||
double lastMousex, lastMousey;
|
||||
double lastMouseX, lastMouseY;
|
||||
|
||||
public FluidConfigPopupElement(int x, int y, ConfigFluidElement fluidElement) {
|
||||
super(x, y, Sprite.SLOT_CONFIG_POPUP);
|
||||
|
@ -93,24 +93,24 @@ public class FluidConfigPopupElement extends ElementBase {
|
|||
@Override
|
||||
public boolean onRelease(MachineBaseBlockEntity provider, GuiBase<?> gui, double mouseX, double mouseY) {
|
||||
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)) {
|
||||
cyleConfig(MachineFacing.FRONT.getFacing(provider), gui);
|
||||
cycleConfig(MachineFacing.FRONT.getFacing(provider), 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)) {
|
||||
cyleConfig(MachineFacing.LEFT.getFacing(provider), gui);
|
||||
cycleConfig(MachineFacing.LEFT.getFacing(provider), 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)) {
|
||||
cyleConfig(MachineFacing.BACK.getFacing(provider), gui);
|
||||
cycleConfig(MachineFacing.BACK.getFacing(provider), gui);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
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.ExtractConfig fluidIO = config.getIoConfig().getNext();
|
||||
|
@ -137,8 +137,8 @@ public class FluidConfigPopupElement extends ElementBase {
|
|||
|
||||
@Override
|
||||
public boolean onHover(MachineBaseBlockEntity provider, GuiBase<?> gui, double mouseX, double mouseY) {
|
||||
lastMousex = mouseX;
|
||||
lastMousey = mouseY;
|
||||
lastMouseX = mouseX;
|
||||
lastMouseY = mouseY;
|
||||
return super.onHover(provider, gui, mouseX, mouseY);
|
||||
}
|
||||
|
||||
|
@ -148,7 +148,7 @@ public class FluidConfigPopupElement extends ElementBase {
|
|||
int sy = iny + getY() + gui.getGuiTop();
|
||||
FluidConfiguration fluidConfiguration = machineBase.fluidConfiguration;
|
||||
if (fluidConfiguration == null) {
|
||||
RebornCore.LOGGER.debug("Humm, this isnt suppoed to happen");
|
||||
RebornCore.LOGGER.debug("Hmm, this isn't supposed to happen");
|
||||
return;
|
||||
}
|
||||
FluidConfiguration.FluidConfig fluidConfig = fluidConfiguration.getSideDetail(side);
|
||||
|
@ -197,4 +197,4 @@ public class FluidConfigPopupElement extends ElementBase {
|
|||
matrixStack.pop();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -97,27 +97,27 @@ public class SlotConfigPopupElement extends ElementBase {
|
|||
@Override
|
||||
public boolean onRelease(MachineBaseBlockEntity provider, GuiBase<?> gui, double mouseX, double mouseY) {
|
||||
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)) {
|
||||
cyleSlotConfig(MachineFacing.FRONT.getFacing(provider), gui);
|
||||
cycleSlotConfig(MachineFacing.FRONT.getFacing(provider), 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)) {
|
||||
cyleSlotConfig(MachineFacing.LEFT.getFacing(provider), gui);
|
||||
cycleSlotConfig(MachineFacing.LEFT.getFacing(provider), 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)) {
|
||||
cyleSlotConfig(MachineFacing.BACK.getFacing(provider), gui);
|
||||
cycleSlotConfig(MachineFacing.BACK.getFacing(provider), gui);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
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);
|
||||
|
||||
//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();
|
||||
if (!allowInput && nextConfig == SlotConfiguration.ExtractConfig.INPUT) {
|
||||
nextConfig = SlotConfiguration.ExtractConfig.OUTPUT;
|
||||
|
@ -154,7 +154,7 @@ public class SlotConfigPopupElement extends ElementBase {
|
|||
int sy = iny + getY() + gui.getGuiTop();
|
||||
SlotConfiguration.SlotConfigHolder slotConfigHolder = machineBase.getSlotConfiguration().getSlotDetails(slotID);
|
||||
if (slotConfigHolder == null) {
|
||||
RebornCore.LOGGER.debug("Humm, this isnt suppoed to happen");
|
||||
RebornCore.LOGGER.debug("Hmm, this isn't supposed to happen");
|
||||
return;
|
||||
}
|
||||
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) {
|
||||
drawState(gui, world, model, actualState, pos, dispatcher, x, y, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ public class GuiHiddenButton extends ButtonWidget {
|
|||
@Override
|
||||
public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
|
||||
if (this.visible) {
|
||||
TextRenderer fontrenderer = MinecraftClient.getInstance().textRenderer;
|
||||
TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
|
||||
RenderSystem.setShaderTexture(0, WIDGETS_TEXTURE);
|
||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.hovered = mouseX >= this.x && mouseY >= this.y
|
||||
|
@ -63,7 +63,7 @@ public class GuiHiddenButton extends ButtonWidget {
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -136,10 +136,10 @@ public class GuiBuilder {
|
|||
/**
|
||||
* Draws button with JEI icon in the given coords.
|
||||
*
|
||||
* @param gui GuiBase GUI to draw on
|
||||
* @param x int Top left corner where to place button
|
||||
* @param y int Top left corner where to place button
|
||||
* @param layer Layer Layer to draw on
|
||||
* @param gui {@link GuiBase} The GUI to draw on
|
||||
* @param x {@code int} Top left corner where to place button
|
||||
* @param y {@code int} Top left corner where to place button
|
||||
* @param layer {@link GuiBase.Layer} The layer to draw on
|
||||
*/
|
||||
public void drawJEIButton(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, GuiBase.Layer layer) {
|
||||
if (gui.hideGuiElements()) return;
|
||||
|
@ -156,13 +156,13 @@ public class GuiBuilder {
|
|||
/**
|
||||
* Draws lock button in either locked or unlocked state
|
||||
*
|
||||
* @param gui GuiBase GUI to draw on
|
||||
* @param x int Top left corner where to place button
|
||||
* @param y int Top left corner where to place button
|
||||
* @param mouseX int Mouse cursor position to check for tooltip
|
||||
* @param mouseY int Mouse cursor position to check for tooltip
|
||||
* @param layer Layer Layer to draw on
|
||||
* @param locked boolean Set to true if it is in locked state
|
||||
* @param gui {@link GuiBase} The GUI to draw on
|
||||
* @param x {@code int} Top left corner where to place button
|
||||
* @param y {@code int} Top left corner where to place button
|
||||
* @param mouseX {@code int} Mouse cursor position to check for tooltip
|
||||
* @param mouseY {@code int} Mouse cursor position to check for tooltip
|
||||
* @param layer {@link GuiBase.Layer} The layer to draw on
|
||||
* @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) {
|
||||
if (gui.hideGuiElements()) return;
|
||||
|
@ -188,12 +188,12 @@ public class GuiBuilder {
|
|||
/**
|
||||
* Draws hologram toggle button
|
||||
*
|
||||
* @param gui GuiBase GUI to draw on
|
||||
* @param x int Top left corner where to place button
|
||||
* @param y int Top left corner where to place button
|
||||
* @param mouseX int Mouse cursor position to check for tooltip
|
||||
* @param mouseY int Mouse cursor position to check for tooltip
|
||||
* @param layer Layer Layer to draw on
|
||||
* @param gui {@link GuiBase} The GUI to draw on
|
||||
* @param x {@code int} Top left corner where to place button
|
||||
* @param y {@code int} Top left corner where to place button
|
||||
* @param mouseX {@code int} Mouse cursor position to check for tooltip
|
||||
* @param mouseY {@code int} Mouse cursor position to check for tooltip
|
||||
* @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) {
|
||||
if (gui.isTabOpen()) return;
|
||||
|
@ -223,12 +223,12 @@ public class GuiBuilder {
|
|||
/**
|
||||
* Draws big horizontal bar for heat value
|
||||
*
|
||||
* @param gui GuiBase GUI to draw on
|
||||
* @param x int Top left corner where to place bar
|
||||
* @param y int Top left corner where to place bar
|
||||
* @param value int Current heat value
|
||||
* @param max int Maximum heat value
|
||||
* @param layer Layer Layer to draw on
|
||||
* @param gui {@link GuiBase} The GUI to draw on
|
||||
* @param x {@code int} Top left corner where to place bar
|
||||
* @param y {@code int} Top left corner where to place bar
|
||||
* @param value {@code int} Current heat value
|
||||
* @param max {@code int} Maximum heat value
|
||||
* @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) {
|
||||
if (gui.hideGuiElements()) return;
|
||||
|
@ -255,17 +255,17 @@ public class GuiBuilder {
|
|||
/**
|
||||
* Draws big horizontal blue bar
|
||||
*
|
||||
* @param gui GuiBase GUI to draw on
|
||||
* @param x int Top left corner where to place bar
|
||||
* @param y int Top left corner where to place bar
|
||||
* @param value int Current value
|
||||
* @param max int Maximum value
|
||||
* @param mouseX int Mouse cursor position to check for tooltip
|
||||
* @param mouseY int Mouse cursor position to check for tooltip
|
||||
* @param suffix 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 format String Formatted value to put on the bar
|
||||
* @param layer Layer Layer to draw on
|
||||
* @param gui {@link GuiBase} The GUI to draw on
|
||||
* @param x {@code int} Top left corner where to place bar
|
||||
* @param y {@code int} Top left corner where to place bar
|
||||
* @param value {@code int} Current value
|
||||
* @param max {@code int} Maximum value
|
||||
* @param mouseX {@code int} Mouse cursor position to check for tooltip
|
||||
* @param mouseY {@code int} Mouse cursor position to check for tooltip
|
||||
* @param suffix {@link String} String to put on the bar and tooltip after percentage value
|
||||
* @param line2 {@link String} String to put into tooltip as a second line
|
||||
* @param format {@link String} Formatted value to put on the bar
|
||||
* @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) {
|
||||
if (gui.hideGuiElements()) return;
|
||||
|
@ -343,8 +343,8 @@ public class GuiBuilder {
|
|||
/**
|
||||
* Shades GUI and draw gray bar on top of GUI
|
||||
*
|
||||
* @param gui GuiBase GUI to draw on
|
||||
* @param layer Layer Layer to draw on
|
||||
* @param gui {@link GuiBase} The GUI to draw on
|
||||
* @param layer {@link GuiBase.Layer} The layer to draw on
|
||||
*/
|
||||
public void drawMultiblockMissingBar(MatrixStack matrixStack, GuiBase<?> gui, GuiBase.Layer layer) {
|
||||
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
|
||||
* level.
|
||||
*
|
||||
* @param gui GuiBase GUI to draw on
|
||||
* @param x int Top left corner where to place slots
|
||||
* @param y int Top left corner where to place slots
|
||||
* @param gui {@link GuiBase} The GUI to draw on
|
||||
* @param x {@code 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) {
|
||||
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.
|
||||
*
|
||||
* @param gui GuiBase GUI to draw on
|
||||
* @param x int Top left corner where to place tab
|
||||
* @param y int Top left corner where to place tab
|
||||
* @param stack ItemStack Item to show as tab icon
|
||||
* @param gui {@link GuiBase} The GUI to draw on
|
||||
* @param x {@code int} Top left corner where to place tab
|
||||
* @param y {@code int} Top left corner where to place tab
|
||||
* @param stack {@link ItemStack} Item to show as tab icon
|
||||
*/
|
||||
public void drawSlotTab(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, ItemStack stack) {
|
||||
RenderSystem.setShaderTexture(0, resourceLocation);
|
||||
|
@ -396,11 +396,11 @@ public class GuiBuilder {
|
|||
/**
|
||||
* Draws Slot Configuration tips instead of player inventory
|
||||
*
|
||||
* @param gui GuiBase GUI to draw on
|
||||
* @param x int Top left corner where to place tips list
|
||||
* @param y int Top left corner where to place tips list
|
||||
* @param mouseX int Mouse cursor position
|
||||
* @param mouseY int Mouse cursor position
|
||||
* @param gui {@link GuiBase} The GUI to draw on
|
||||
* @param x {@code int} Top left corner where to place tips list
|
||||
* @param y {@code int} Top left corner where to place tips list
|
||||
* @param mouseX {@code 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) {
|
||||
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
|
||||
*
|
||||
* @param gui GuiBase GUI to draw on
|
||||
* @param x int Top left corner where to place energy output
|
||||
* @param y int Top left corner where to place energy output
|
||||
* @param maxOutput int Energy output value
|
||||
* @param layer Layer Layer to draw on
|
||||
* @param gui {@link GuiBase} The GUI to draw on
|
||||
* @param x {@code int} Top left corner where to place energy output
|
||||
* @param y {@code int} Top left corner where to place energy output
|
||||
* @param maxOutput {@code int} Energy output value
|
||||
* @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) {
|
||||
if (gui.hideGuiElements()) return;
|
||||
|
@ -498,15 +499,15 @@ public class GuiBuilder {
|
|||
/**
|
||||
* Draws progress arrow in direction specified.
|
||||
*
|
||||
* @param gui GuiBase GUI to draw on
|
||||
* @param progress int Current progress
|
||||
* @param maxProgress int Maximum progress
|
||||
* @param x int Top left corner where to place progress arrow
|
||||
* @param y int Top left corner where to place progress arrow
|
||||
* @param mouseX int Mouse cursor position to check for tooltip
|
||||
* @param mouseY int Mouse cursor position to check for tooltip
|
||||
* @param direction ProgressDirection Direction of progress arrow
|
||||
* @param layer Layer Layer to draw on
|
||||
* @param gui {@link GuiBase} The GUI to draw on
|
||||
* @param progress {@code int} Current progress
|
||||
* @param maxProgress {@code int} Maximum progress
|
||||
* @param x {@code int} Top left corner where to place progress arrow
|
||||
* @param y {@code int} Top left corner where to place progress arrow
|
||||
* @param mouseX {@code int} Mouse cursor position to check for tooltip
|
||||
* @param mouseY {@code int} Mouse cursor position to check for tooltip
|
||||
* @param direction {@link ProgressDirection} Direction of the progress arrow
|
||||
* @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) {
|
||||
if (gui.hideGuiElements()) return;
|
||||
|
@ -560,15 +561,15 @@ public class GuiBuilder {
|
|||
/**
|
||||
* Draws multi-energy bar
|
||||
*
|
||||
* @param gui GuiBase GUI to draw on
|
||||
* @param x int Top left corner where to place energy bar
|
||||
* @param y int Top left corner where to place energy bar
|
||||
* @param energyStored int Current amount of energy
|
||||
* @param maxEnergyStored int Maximum amount of energy
|
||||
* @param mouseX int Mouse cursor position to check for tooltip
|
||||
* @param mouseY int Mouse cursor position to check for tooltip
|
||||
* @param buttonID int Button ID used to switch energy systems
|
||||
* @param layer Layer Layer to draw on
|
||||
* @param gui {@link GuiBase} The GUI to draw on
|
||||
* @param x {@code int} Top left corner where to place energy bar
|
||||
* @param y {@code int} Top left corner where to place energy bar
|
||||
* @param energyStored {@code int} Current amount of energy
|
||||
* @param maxEnergyStored {@code int} Maximum amount of energy
|
||||
* @param mouseX {@code int} Mouse cursor position to check for tooltip
|
||||
* @param mouseY {@code int} Mouse cursor position to check for tooltip
|
||||
* @param buttonID {@code int} Button ID used to switch energy systems
|
||||
* @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,
|
||||
int mouseY, int buttonID, GuiBase.Layer layer) {
|
||||
|
@ -641,15 +642,15 @@ public class GuiBuilder {
|
|||
/**
|
||||
* Draws tank and fluid inside it
|
||||
*
|
||||
* @param gui GuiBase GUI to draw on
|
||||
* @param x int Top left corner of tank
|
||||
* @param y int Top left corner of tank
|
||||
* @param mouseX int Mouse cursor position to check for tooltip
|
||||
* @param mouseY int Mouse cursor position to check for tooltip
|
||||
* @param fluid FluidStack Fluid to draw in tank
|
||||
* @param maxCapacity int Maximum tank capacity
|
||||
* @param isTankEmpty boolean True if tank is empty
|
||||
* @param layer Layer Layer to draw on
|
||||
* @param gui {@link GuiBase} The GUI to draw on
|
||||
* @param x {@code int} Top left corner of tank
|
||||
* @param y {@code int} Top left corner of tank
|
||||
* @param mouseX {@code int} Mouse cursor position to check for tooltip
|
||||
* @param mouseY {@code int} Mouse cursor position to check for tooltip
|
||||
* @param fluid {@link FluidInstance} to draw in tank
|
||||
* @param maxCapacity {@code int} Maximum tank capacity
|
||||
* @param isTankEmpty {@code boolean} True if tank is empty
|
||||
* @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) {
|
||||
if (gui.hideGuiElements()) return;
|
||||
|
@ -704,13 +705,13 @@ public class GuiBuilder {
|
|||
/**
|
||||
* Draws fluid in tank
|
||||
*
|
||||
* @param gui GuiBase GUI to draw on
|
||||
* @param fluid FluidStack Fluid to draw
|
||||
* @param x int Top left corner of fluid
|
||||
* @param y int Top left corner of fluid
|
||||
* @param width int Width of fluid to draw
|
||||
* @param height int Height of fluid to draw
|
||||
* @param maxCapacity int Maximum capacity of tank
|
||||
* @param gui {@link GuiBase} The GUI to draw on
|
||||
* @param fluid {@link FluidInstance} Fluid to draw
|
||||
* @param x {@code int} Top left corner of fluid
|
||||
* @param y {@code int} Top left corner of fluid
|
||||
* @param width {@code int} Width of fluid to draw
|
||||
* @param height {@code int} Height of fluid to draw
|
||||
* @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) {
|
||||
if (fluid.getFluid() == Fluids.EMPTY) {
|
||||
|
@ -746,14 +747,14 @@ public class GuiBuilder {
|
|||
/**
|
||||
* Draws burning progress, similar to vanilla furnace
|
||||
*
|
||||
* @param gui GuiBase GUI to draw on
|
||||
* @param progress int Current progress
|
||||
* @param maxProgress int Maximum progress
|
||||
* @param x int Top left corner where to place burn bar
|
||||
* @param y int Top left corner where to place burn bar
|
||||
* @param mouseX int Mouse cursor position to check for tooltip
|
||||
* @param mouseY int Mouse cursor position to check for tooltip
|
||||
* @param layer Layer Layer to draw on
|
||||
* @param gui {@link GuiBase} The GUI to draw on
|
||||
* @param progress {@code int} Current progress
|
||||
* @param maxProgress {@code int} Maximum progress
|
||||
* @param x {@code int} Top left corner where to place burn bar
|
||||
* @param y {@code int} Top left corner where to place burn bar
|
||||
* @param mouseX {@code int} Mouse cursor position to check for tooltip
|
||||
* @param mouseY {@code int} Mouse cursor position to check for tooltip
|
||||
* @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) {
|
||||
if (gui.hideGuiElements()) return;
|
||||
|
@ -785,10 +786,10 @@ public class GuiBuilder {
|
|||
/**
|
||||
* Draws bar containing output slots
|
||||
*
|
||||
* @param gui GuiBase GUI to draw on
|
||||
* @param x int Top left corner where to place slots bar
|
||||
* @param y int Top left corner where to place slots bar
|
||||
* @param count int Number of output slots
|
||||
* @param gui {@link GuiBase} The GUI to draw on
|
||||
* @param x {@code int} Top left corner where to place slots bar
|
||||
* @param y {@code int} Top left corner where to place slots bar
|
||||
* @param count {@code int} Number of output slots
|
||||
*/
|
||||
public void drawOutputSlotBar(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, int count) {
|
||||
RenderSystem.setShaderTexture(0, resourceLocation);
|
||||
|
|
|
@ -31,14 +31,14 @@ public class SlotFake extends BaseSlot {
|
|||
|
||||
public boolean mCanInsertItem;
|
||||
public boolean mCanStackItem;
|
||||
public int mMaxStacksize = 127;
|
||||
public int mMaxStackSize = 127;
|
||||
|
||||
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);
|
||||
this.mCanInsertItem = aCanInsertItem;
|
||||
this.mCanStackItem = aCanStackItem;
|
||||
this.mMaxStacksize = aMaxStacksize;
|
||||
this.mMaxStackSize = aMaxStackSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -48,7 +48,7 @@ public class SlotFake extends BaseSlot {
|
|||
|
||||
@Override
|
||||
public int getMaxItemCount() {
|
||||
return this.mMaxStacksize;
|
||||
return this.mMaxStackSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -22,9 +22,9 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
/*
|
||||
* 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
|
||||
* <p>
|
||||
* Botania is Open Source and distributed under the
|
||||
|
|
|
@ -130,17 +130,18 @@ public class BlockEntityScreenHandlerBuilder {
|
|||
private BlockEntityScreenHandlerBuilder upgradeSlots(IUpgradeable upgradeable) {
|
||||
if (upgradeable.canBeUpgraded()) {
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param supplier The supplier it can supply a variable holding in an Object it
|
||||
* will be synced with a custom packet
|
||||
* @param setter The setter to call when the variable has been updated.
|
||||
* @return ContainerTileInventoryBuilder Inventory which will do the sync
|
||||
* @param <T> The type of the block entity
|
||||
* @param supplier {@link Supplier<T>} The supplier it can supply a variable holding in an Object.
|
||||
* it will be synced with a custom packet
|
||||
* @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) {
|
||||
this.parent.objectValues.add(Pair.of(supplier, setter));
|
||||
|
|
|
@ -37,8 +37,8 @@ import net.minecraft.screen.slot.Slot;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import org.apache.commons.lang3.Range;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import reborncore.common.blockentity.MachineBaseBlockEntity;
|
||||
import reborncore.common.network.ClientBoundPackets;
|
||||
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>> 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 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) {
|
||||
shiftItemStack(stackToShift, start, end);
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ public final class PlayerScreenHandlerBuilder {
|
|||
this.parent.addPlayerInventoryRange(this.main);
|
||||
}
|
||||
if (this.armor != null) {
|
||||
this.parent.addBlockEnityInventoryRange(this.armor);
|
||||
this.parent.addBlockEntityInventoryRange(this.armor);
|
||||
}
|
||||
|
||||
return this.parent;
|
||||
|
@ -139,4 +139,4 @@ public final class PlayerScreenHandlerBuilder {
|
|||
return this.parent;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ public class ScreenHandlerBuilder {
|
|||
this.playerInventoryRanges.add(range);
|
||||
}
|
||||
|
||||
void addBlockEnityInventoryRange(final Range<Integer> range) {
|
||||
void addBlockEntityInventoryRange(final Range<Integer> range) {
|
||||
this.blockEntityInventoryRanges.add(range);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ import net.minecraft.inventory.Inventory;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import reborncore.client.gui.slots.BaseSlot;
|
||||
|
||||
import java.util.function.BiPredicate;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class FilteredSlot extends BaseSlot {
|
||||
|
|
|
@ -35,12 +35,12 @@ import org.jetbrains.annotations.Nullable;
|
|||
public class SpriteSlot extends FilteredSlot {
|
||||
|
||||
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);
|
||||
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) {
|
||||
|
@ -49,7 +49,7 @@ public class SpriteSlot extends FilteredSlot {
|
|||
|
||||
@Override
|
||||
public int getMaxItemCount() {
|
||||
return this.stacksize;
|
||||
return this.stackSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -89,7 +89,7 @@ public class FluidConfiguration implements NBTSerializable {
|
|||
if (autoInput() && fluidConfig.getIoConfig().isInsert()) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -187,16 +187,16 @@ public class FluidConfiguration implements NBTSerializable {
|
|||
OUTPUT(true, false),
|
||||
ALL(true, true);
|
||||
|
||||
boolean extact;
|
||||
boolean extract;
|
||||
boolean insert;
|
||||
|
||||
ExtractConfig(boolean extact, boolean insert) {
|
||||
this.extact = extact;
|
||||
ExtractConfig(boolean extract, boolean insert) {
|
||||
this.extract = extract;
|
||||
this.insert = insert;
|
||||
}
|
||||
|
||||
public boolean isExtact() {
|
||||
return extact;
|
||||
public boolean isExtract() {
|
||||
return extract;
|
||||
}
|
||||
|
||||
public boolean isInsert() {
|
||||
|
@ -204,7 +204,7 @@ public class FluidConfiguration implements NBTSerializable {
|
|||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return extact || insert;
|
||||
return extract || insert;
|
||||
}
|
||||
|
||||
public FluidConfiguration.ExtractConfig getNext() {
|
||||
|
|
|
@ -75,19 +75,31 @@ public class MachineBaseBlockEntity extends BlockEntity implements BlockEntityTi
|
|||
|
||||
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/>
|
||||
* 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;
|
||||
/**
|
||||
* This is used to change the power of the crafting operation.
|
||||
* <p>
|
||||
* This is used to change the power of the crafting operation.
|
||||
* <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;
|
||||
|
||||
|
@ -139,10 +151,10 @@ public class MachineBaseBlockEntity extends BlockEntity implements BlockEntityTi
|
|||
|
||||
@Override
|
||||
public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) {
|
||||
if (ticktime == 0) {
|
||||
if (tickTime == 0) {
|
||||
onLoad();
|
||||
}
|
||||
ticktime++;
|
||||
tickTime++;
|
||||
@Nullable
|
||||
RecipeCrafter crafter = null;
|
||||
if (getOptionalCrafter().isPresent()) {
|
||||
|
@ -151,7 +163,7 @@ public class MachineBaseBlockEntity extends BlockEntity implements BlockEntityTi
|
|||
if (canBeUpgraded()) {
|
||||
resetUpgrades();
|
||||
for (int i = 0; i < getUpgradeSlotCount(); i++) {
|
||||
ItemStack stack = getUpgradeInvetory().getStack(i);
|
||||
ItemStack stack = getUpgradeInventory().getStack(i);
|
||||
if (!stack.isEmpty() && stack.getItem() instanceof IUpgrade) {
|
||||
((IUpgrade) stack.getItem()).process(this, this, stack);
|
||||
}
|
||||
|
@ -173,8 +185,8 @@ public class MachineBaseBlockEntity extends BlockEntity implements BlockEntityTi
|
|||
}
|
||||
|
||||
public void resetUpgrades() {
|
||||
resetPowerMulti();
|
||||
resetSpeedMulti();
|
||||
resetPowerMultiplier();
|
||||
resetSpeedMultiplier();
|
||||
}
|
||||
|
||||
protected void afterUpgradesApplication() {
|
||||
|
@ -289,10 +301,10 @@ public class MachineBaseBlockEntity extends BlockEntity implements BlockEntityTi
|
|||
}
|
||||
return true;
|
||||
}
|
||||
//Inventory end
|
||||
// Inventory end
|
||||
|
||||
@Override
|
||||
public Inventory getUpgradeInvetory() {
|
||||
public Inventory getUpgradeInventory() {
|
||||
return upgradeInventory;
|
||||
}
|
||||
|
||||
|
@ -306,7 +318,7 @@ public class MachineBaseBlockEntity extends BlockEntity implements BlockEntityTi
|
|||
}
|
||||
|
||||
@Override
|
||||
public void resetSpeedMulti() {
|
||||
public void resetSpeedMultiplier() {
|
||||
speedMultiplier = 0;
|
||||
}
|
||||
|
||||
|
@ -316,12 +328,12 @@ public class MachineBaseBlockEntity extends BlockEntity implements BlockEntityTi
|
|||
}
|
||||
|
||||
@Override
|
||||
public void addPowerMulti(double amount) {
|
||||
public void addPowerMultiplier(double amount) {
|
||||
powerMultiplier = powerMultiplier * (1f + amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetPowerMulti() {
|
||||
public void resetPowerMultiplier() {
|
||||
powerMultiplier = 1;
|
||||
}
|
||||
|
||||
|
@ -336,7 +348,7 @@ public class MachineBaseBlockEntity extends BlockEntity implements BlockEntityTi
|
|||
}
|
||||
|
||||
@Override
|
||||
public void addSpeedMulti(double amount) {
|
||||
public void addSpeedMultiplier(double amount) {
|
||||
if (speedMultiplier + amount <= 0.99) {
|
||||
speedMultiplier += amount;
|
||||
} else {
|
||||
|
@ -357,12 +369,12 @@ public class MachineBaseBlockEntity extends BlockEntity implements BlockEntityTi
|
|||
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() {
|
||||
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() {
|
||||
return FluidValue.BUCKET_QUARTER;
|
||||
}
|
||||
|
@ -459,7 +471,7 @@ public class MachineBaseBlockEntity extends BlockEntity implements BlockEntityTi
|
|||
@Override
|
||||
public int[] getAvailableSlots(Direction side) {
|
||||
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()
|
||||
.filter(Objects::nonNull)
|
||||
|
@ -491,7 +503,7 @@ public class MachineBaseBlockEntity extends BlockEntity implements BlockEntityTi
|
|||
}
|
||||
SlotConfiguration.SlotConfigHolder slotConfigHolder = slotConfiguration.getSlotDetails(index);
|
||||
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){
|
||||
|
|
|
@ -50,36 +50,36 @@ import java.util.function.BiPredicate;
|
|||
/**
|
||||
* Writes a multiblock for either verification or hologram rendering
|
||||
*
|
||||
* @author ramidzkh
|
||||
* @see MultiblockVerifier
|
||||
* @see HologramRenderer
|
||||
* @author ramidzkh
|
||||
*/
|
||||
public interface MultiblockWriter {
|
||||
|
||||
/**
|
||||
* Adds a block to the multiblock
|
||||
*
|
||||
* @param x X
|
||||
* @param y Y
|
||||
* @param z Z
|
||||
* @param predicate Predicate of the position
|
||||
* @param state The state for the hologram
|
||||
* @return This. Useful for chaining
|
||||
* @param x {@code int} X
|
||||
* @param y {@code int} Y
|
||||
* @param z {@code int} Z
|
||||
* @param predicate {@link BiPredicate} Predicate of the position
|
||||
* @param state {@link BlockState} The state for the hologram
|
||||
* @return {@link MultiblockWriter} This. Useful for chaining
|
||||
*/
|
||||
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)
|
||||
*
|
||||
* @param ax X of the first point
|
||||
* @param ay Y of the first point
|
||||
* @param az Z of the first point
|
||||
* @param bx X of the second point
|
||||
* @param by X of the second point
|
||||
* @param bz Z of the second point
|
||||
* @param predicate Predicate of the position
|
||||
* @param state The state for the hologram
|
||||
* @return This. Useful for chaining
|
||||
* @param ax {@code int} X of the first point
|
||||
* @param ay {@code int} Y of the first point
|
||||
* @param az {@code int} Z of the first point
|
||||
* @param bx {@code int} X of the second point
|
||||
* @param by {@code int} X of the second point
|
||||
* @param bz {@code int} Z of the second point
|
||||
* @param predicate {@link BiPredicate} Predicate of the position
|
||||
* @param state {@link BlockState} The state for the hologram
|
||||
* @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) {
|
||||
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
|
||||
* <code>state</code>. The inside of the ring uses <code>holePredicate</code> and <code>holeHologramState</code>
|
||||
*
|
||||
* @param through The axis to go through
|
||||
* @param pX Size on the X axis
|
||||
* @param pY Size on the Y axis
|
||||
* @param pZ Size on the Z axis
|
||||
* @param predicate Predicate for the ring
|
||||
* @param state The ring state for the hologram
|
||||
* @param holePredicate Predicate for the hole
|
||||
* @param holeHologramState The hole state for the hologram
|
||||
* @return This. Useful for chaining
|
||||
* @param through {@link Direction.Axis} The axis to go through
|
||||
* @param pX {@code int} Size on the X axis
|
||||
* @param pY {@code int} Size on the Y axis
|
||||
* @param pZ {@code int} Size on the Z axis
|
||||
* @param predicate {@link BiPredicate} Predicate for the ring
|
||||
* @param state {@link BlockState} The state for the hologram
|
||||
* @param holePredicate {@link BiPredicate} Predicate for the hole
|
||||
* @param holeHologramState {@link BlockState} The hole state for the hologram
|
||||
* @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) {
|
||||
if (holePredicate == null) {
|
||||
|
|
|
@ -47,7 +47,7 @@ import java.util.stream.Collectors;
|
|||
|
||||
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 fluidStack = new ItemStack(Items.BUCKET);
|
||||
|
||||
|
@ -168,7 +168,7 @@ public class RedstoneConfiguration implements NBTSerializable, Syncable {
|
|||
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()) {
|
||||
if (!stateMap.containsKey(element)) {
|
||||
stateMap.put(element, State.IGNORED);
|
||||
|
@ -185,7 +185,7 @@ public class RedstoneConfiguration implements NBTSerializable, Syncable {
|
|||
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 {
|
||||
private final String name;
|
||||
private final BooleanFunction<MachineBaseBlockEntity> isApplicable;
|
||||
|
|
|
@ -67,7 +67,7 @@ public class SlotConfiguration implements NBTSerializable {
|
|||
SlotConfigHolder holder = getSlotDetails(i);
|
||||
if (holder == null) {
|
||||
RebornCore.LOGGER.debug("Fixed slot " + i + " in " + machineBase);
|
||||
//humm somthing has gone wrong
|
||||
// hmm, something has gone wrong
|
||||
updateSlotDetails(new SlotConfigHolder(i));
|
||||
}
|
||||
}
|
||||
|
@ -88,8 +88,8 @@ public class SlotConfiguration implements NBTSerializable {
|
|||
/**
|
||||
* Replaces or adds a slot detail for the slot id
|
||||
*
|
||||
* @param slotConfigHolder
|
||||
* @return SlotConfigHolder
|
||||
* @param slotConfigHolder {@link SlotConfigHolder}
|
||||
* @return {@link SlotConfigHolder} Updated SlotConfigHolder
|
||||
*/
|
||||
public SlotConfigHolder updateSlotDetails(SlotConfigHolder slotConfigHolder) {
|
||||
SlotConfigHolder lookup = getSlotDetails(slotConfigHolder.slotID);
|
||||
|
@ -209,7 +209,7 @@ public class SlotConfiguration implements NBTSerializable {
|
|||
this.output = output;
|
||||
}
|
||||
|
||||
public void setfilter(boolean filter) {
|
||||
public void setFilter(boolean filter) {
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
|
@ -236,7 +236,7 @@ public class SlotConfiguration implements NBTSerializable {
|
|||
});
|
||||
input = nbt.getBoolean("input");
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
@ -367,16 +367,16 @@ public class SlotConfiguration implements NBTSerializable {
|
|||
INPUT(false, true),
|
||||
OUTPUT(true, false);
|
||||
|
||||
boolean extact;
|
||||
boolean extract;
|
||||
boolean insert;
|
||||
|
||||
ExtractConfig(boolean extact, boolean insert) {
|
||||
this.extact = extact;
|
||||
ExtractConfig(boolean extract, boolean insert) {
|
||||
this.extract = extract;
|
||||
this.insert = insert;
|
||||
}
|
||||
|
||||
public boolean isExtact() {
|
||||
return extact;
|
||||
public boolean isExtract() {
|
||||
return extract;
|
||||
}
|
||||
|
||||
public boolean isInsert() {
|
||||
|
@ -404,7 +404,7 @@ public class SlotConfiguration implements NBTSerializable {
|
|||
try {
|
||||
compound = StringNbtReader.parse(json);
|
||||
} 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)) {
|
||||
throw new UnsupportedOperationException("Machine config is not for this machine.");
|
||||
|
@ -412,7 +412,7 @@ public class SlotConfiguration implements NBTSerializable {
|
|||
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) {
|
||||
if(itemStackIn.isEmpty()){
|
||||
return false;
|
||||
|
@ -430,11 +430,11 @@ public class SlotConfiguration implements NBTSerializable {
|
|||
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) {
|
||||
SlotConfiguration.SlotConfigHolder slotConfigHolder = blockEntity.getSlotConfiguration().getSlotDetails(index);
|
||||
SlotConfiguration.SlotConfig slotConfig = slotConfigHolder.getSideDetail(direction);
|
||||
if (slotConfig.getSlotIO().getIoConfig().isExtact()) {
|
||||
if (slotConfig.getSlotIO().getIoConfig().isExtract()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -83,7 +83,7 @@ public abstract class BlockMachineBase extends BaseBlockEntityProvider implement
|
|||
this.setDefaultState(
|
||||
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) {
|
||||
|
@ -180,7 +180,7 @@ public abstract class BlockMachineBase extends BaseBlockEntityProvider implement
|
|||
ItemStack stack = playerIn.getStackInHand(hand);
|
||||
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) {
|
||||
return ActionResult.PASS;
|
||||
}
|
||||
|
@ -200,7 +200,7 @@ public abstract class BlockMachineBase extends BaseBlockEntityProvider implement
|
|||
} else if (stack.getItem() instanceof IUpgrade && blockEntity instanceof IUpgradeable upgradeableEntity) {
|
||||
if (upgradeableEntity.canBeUpgraded()) {
|
||||
int inserted = (int) insertItemStacked(
|
||||
InventoryStorage.of(upgradeableEntity.getUpgradeInvetory(), null),
|
||||
InventoryStorage.of(upgradeableEntity.getUpgradeInventory(), null),
|
||||
ItemVariant.of(stack),
|
||||
stack.getCount()
|
||||
);
|
||||
|
|
|
@ -36,7 +36,7 @@ import java.util.List;
|
|||
|
||||
public class BlockWrenchEventHandler {
|
||||
|
||||
public static List<Block> wrenableBlocks = new ArrayList<>();
|
||||
public static List<Block> wrenchableBlocks = new ArrayList<>();
|
||||
|
||||
|
||||
public static void setup() {
|
||||
|
@ -47,7 +47,7 @@ public class BlockWrenchEventHandler {
|
|||
}
|
||||
if (ToolManager.INSTANCE.canHandleTool(playerEntity.getStackInHand(Hand.MAIN_HAND))) {
|
||||
BlockState state = world.getBlockState(blockHitResult.getBlockPos());
|
||||
if (wrenableBlocks.contains(state.getBlock())) {
|
||||
if (wrenchableBlocks.contains(state.getBlock())) {
|
||||
Block block = state.getBlock();
|
||||
block.onUse(state, world, blockHitResult.getBlockPos(), playerEntity, hand, blockHitResult);
|
||||
return ActionResult.SUCCESS;
|
||||
|
@ -57,5 +57,4 @@ public class BlockWrenchEventHandler {
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ import reborncore.common.network.NetworkManager;
|
|||
import java.util.*;
|
||||
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 static Codec<List<LoadedChunk>> CODEC = Codec.list(LoadedChunk.CODEC);
|
||||
|
@ -103,10 +103,10 @@ public class ChunkLoaderManager extends PersistentState {
|
|||
.findFirst();
|
||||
}
|
||||
|
||||
public List<LoadedChunk> getLoadedChunks(World world, BlockPos chunkloader){
|
||||
public List<LoadedChunk> getLoadedChunks(World world, BlockPos chunkLoader){
|
||||
return loadedChunks.stream()
|
||||
.filter(loadedChunk -> loadedChunk.getWorld().equals(getWorldName(world)))
|
||||
.filter(loadedChunk -> loadedChunk.getChunkLoader().equals(chunkloader))
|
||||
.filter(loadedChunk -> loadedChunk.getChunkLoader().equals(chunkLoader))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
|
|
@ -36,28 +36,29 @@ public @interface Config {
|
|||
/**
|
||||
* This the category of the config
|
||||
*
|
||||
* @return
|
||||
* @return {@link String}
|
||||
*/
|
||||
String category() default "config";
|
||||
|
||||
/**
|
||||
* This is the key for the config, the default is the field name.
|
||||
*
|
||||
* @return
|
||||
* @return {@link String}
|
||||
*/
|
||||
String key() default "";
|
||||
|
||||
/**
|
||||
* 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 "";
|
||||
|
||||
/**
|
||||
* 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";
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ public class Configuration {
|
|||
readFromJson(configs);
|
||||
}
|
||||
|
||||
//Save the configs
|
||||
// Save the configs
|
||||
for (Map.Entry<String, JsonObject> entry : toJson().entrySet()) {
|
||||
final File configFile = new File(configDir, entry.getKey() + ".json");
|
||||
final String jsonStr = GSON.toJson(entry.getValue());
|
||||
|
@ -123,7 +123,7 @@ public class Configuration {
|
|||
|
||||
String key = annotation.key().isEmpty() ? field.getName() : annotation.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();
|
||||
|
@ -155,7 +155,7 @@ public class Configuration {
|
|||
final JsonObject config = configs.get(annotation.config());
|
||||
|
||||
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());
|
||||
|
|
|
@ -81,7 +81,9 @@ public class RebornRecipe implements Recipe<Inventory>, CustomOutputRecipe {
|
|||
return type;
|
||||
}
|
||||
|
||||
// use the RebornIngredient version to ensure stack sizes are checked
|
||||
/**
|
||||
* use the {@link RebornIngredient} version to ensure stack sizes are checked
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public DefaultedList<Ingredient> getIngredients() {
|
||||
|
@ -105,8 +107,8 @@ public class RebornRecipe implements Recipe<Inventory>, CustomOutputRecipe {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param blockEntity the blockEntity that is doing the crafting
|
||||
* @return if true the recipe will craft, if false it will not
|
||||
* @param blockEntity {@link BlockEntity} The blockEntity that is doing the crafting
|
||||
* @return {@code boolean} If true, the recipe will craft, if false it will not
|
||||
*/
|
||||
public boolean canCraft(BlockEntity blockEntity) {
|
||||
if (blockEntity instanceof IRecipeCrafterProvider) {
|
||||
|
@ -116,14 +118,14 @@ public class RebornRecipe implements Recipe<Inventory>, CustomOutputRecipe {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param blockEntity the blockEntity that is doing the crafting
|
||||
* @return return true if fluid was taken and should craft
|
||||
* @param blockEntity {@link BlockEntity} The blockEntity that is doing the crafting
|
||||
* @return {@code boolean} Returns true if fluid was taken and should craft
|
||||
*/
|
||||
public boolean onCraft(BlockEntity blockEntity) {
|
||||
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
|
||||
@Override
|
||||
|
@ -143,7 +145,10 @@ public class RebornRecipe implements Recipe<Inventory>, CustomOutputRecipe {
|
|||
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
|
||||
@Override
|
||||
public ItemStack getOutput() {
|
||||
|
@ -158,7 +163,7 @@ public class RebornRecipe implements Recipe<Inventory>, CustomOutputRecipe {
|
|||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
//Done to try and stop the table from loading it
|
||||
// Done to try and stop the table from loading it
|
||||
@Override
|
||||
public boolean isIgnoredInRecipeBook() {
|
||||
return true;
|
||||
|
|
|
@ -107,8 +107,8 @@ public class StackIngredient extends RebornIngredient {
|
|||
return false;
|
||||
}
|
||||
|
||||
//Bit of a meme here, as DataFixer likes to use the most basic primative 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.
|
||||
// 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 it's using types that match our input.
|
||||
|
||||
NbtCompound compoundTag = itemStack.getNbt();
|
||||
JsonElement jsonElement = Dynamic.convert(NbtOps.INSTANCE, JsonOps.INSTANCE, compoundTag);
|
||||
|
|
|
@ -114,7 +114,7 @@ public class TagIngredient extends RebornIngredient {
|
|||
}
|
||||
|
||||
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.addProperty("tag_server_sync", true);
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ public class RecipeSerdeException extends RuntimeException {
|
|||
|
||||
public RecipeSerdeException(Identifier identifier, Throwable 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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@ public final class FluidValue {
|
|||
return fromRaw(droplets);
|
||||
}
|
||||
} else if (jsonElement.isJsonPrimitive() && jsonElement.getAsJsonPrimitive().isNumber()) {
|
||||
//TODO add a warning here
|
||||
// TODO add a warning here
|
||||
return fromMillibuckets(jsonElement.getAsJsonPrimitive().getAsInt());
|
||||
}
|
||||
throw new JsonSyntaxException("Could not parse fluid value");
|
||||
|
|
|
@ -56,7 +56,8 @@ public class RebornFluidRenderManager implements ClientSpriteRegistryCallback, S
|
|||
}
|
||||
|
||||
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<>(() -> {
|
||||
FluidSettings fluidSettings = fluid.getFluidSettings();
|
||||
return new Sprite[]{RenderUtil.getSprite(fluidSettings.getStillTexture()), RenderUtil.getSprite(fluidSettings.getFlowingTexture())};
|
||||
|
@ -81,7 +82,7 @@ public class RebornFluidRenderManager implements ClientSpriteRegistryCallback, S
|
|||
|
||||
@Override
|
||||
public void reload(ResourceManager manager) {
|
||||
//Reset the cached fluid sprites
|
||||
// Reset the cached fluid sprites
|
||||
spriteMap.forEach((key, value) -> value.reset());
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@ import net.minecraft.util.registry.Registry;
|
|||
/**
|
||||
* @author drcrazy
|
||||
*/
|
||||
|
||||
public class ModSounds {
|
||||
|
||||
public static SoundEvent BLOCK_DISMANTLE;
|
||||
|
|
|
@ -24,18 +24,22 @@
|
|||
|
||||
package reborncore.common.misc;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tag.Tag;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* @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> {
|
||||
|
||||
/**
|
||||
* Returns the common tag of this object.
|
||||
*
|
||||
* @return the common tag of this object
|
||||
*/
|
||||
Tag.Identified<T> asTag();
|
||||
|
|
|
@ -34,11 +34,11 @@ import java.util.Set;
|
|||
|
||||
/**
|
||||
* 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,
|
||||
* you should derive from MultiblockBlockEntityBase, which does all the hard work
|
||||
* class as we need the basic functionality of a {@link BlockEntity} as well. Preferably,
|
||||
* you should derive from {@link MultiblockBlockEntityBase}, which does all the hard work
|
||||
* for you.
|
||||
* <p>
|
||||
* {@link MultiblockBlockEntityBase}
|
||||
*
|
||||
* <p>{@link MultiblockBlockEntityBase}</p>
|
||||
*/
|
||||
public abstract class IMultiblockPart extends BlockEntity {
|
||||
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.
|
||||
*/
|
||||
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();
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @return A BlockPos with its x,y,z members set to the location of this
|
||||
* blockEntity entity in the world.
|
||||
* @return A {@link BlockPos} with its x,y,z members set to the location of this
|
||||
* {@link BlockEntity} entity in the world.
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* @param newController The new multiblock controller to which this blockEntity entity is
|
||||
* attached.
|
||||
* @param newController {@link MultiblockControllerBase} The new multiblock controller to which this
|
||||
* {@link BlockEntity} entity is attached.
|
||||
*/
|
||||
public abstract void onAttached(MultiblockControllerBase newController);
|
||||
|
||||
/**
|
||||
* Called after this block has been detached from a multiblock controller.
|
||||
*
|
||||
* @param multiblockController The multiblock controller that no longer controls this blockEntity
|
||||
* entity.
|
||||
* @param multiblockController {@link MultiblockControllerBase} The multiblock controller that no longer
|
||||
* controls this blockEntity entity.
|
||||
*/
|
||||
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
|
||||
* afterwards.
|
||||
*
|
||||
* @param oldController The controller which is orphaning this block.
|
||||
* @param oldControllerSize The number of connected blocks in the controller prior to
|
||||
* shedding orphans.
|
||||
* @param newControllerSize The number of connected blocks in the controller after
|
||||
* shedding orphans.
|
||||
* @param oldController {@link MultiblockControllerBase} The controller which is orphaning this block.
|
||||
* @param oldControllerSize {@code int} The number of connected blocks in the controller prior to
|
||||
* shedding orphans.
|
||||
* @param newControllerSize {@code int} The number of connected blocks in the controller after
|
||||
* shedding orphans.
|
||||
* @see #onDetached(MultiblockControllerBase)
|
||||
*/
|
||||
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!
|
||||
*
|
||||
* @return A new Multiblock Controller, derived from
|
||||
* MultiblockControllerBase.
|
||||
* {@link MultiblockControllerBase}.
|
||||
*/
|
||||
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
|
||||
* 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.
|
||||
*/
|
||||
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
|
||||
* avoid triggering lots of recalculation logic.
|
||||
*
|
||||
* @param newController The new controller into which this blockEntity entity is being
|
||||
* merged.
|
||||
* @param newController {@link MultiblockControllerBase} The new controller into which this
|
||||
* {@link BlockEntity} entity is being merged.
|
||||
*/
|
||||
public abstract void onAssimilated(MultiblockControllerBase newController);
|
||||
|
||||
|
@ -146,7 +146,7 @@ public abstract class IMultiblockPart extends BlockEntity {
|
|||
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.
|
||||
*/
|
||||
public abstract boolean isVisited();
|
||||
|
@ -166,22 +166,22 @@ public abstract class IMultiblockPart extends BlockEntity {
|
|||
/**
|
||||
* Is this block the designated save/load & network delegate?
|
||||
*
|
||||
* @return Boolean
|
||||
* @return {@code boolean}
|
||||
*/
|
||||
public abstract boolean isMultiblockSaveDelegate();
|
||||
|
||||
/**
|
||||
* Returns an array containing references to neighboring IMultiblockPart
|
||||
* blockEntity entities. Primarily a utility method. Only works after blockentity
|
||||
* Returns an array containing references to neighboring {@link IMultiblockPart}
|
||||
* {@link BlockEntity} entities. Primarily a utility method. Only works after {@link BlockEntity}
|
||||
* construction, so it cannot be used in
|
||||
* MultiblockControllerBase::attachBlock.
|
||||
* {@link MultiblockControllerBase#attachBlock}.
|
||||
* <p>
|
||||
* 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
|
||||
* client, because ChunkProviderClient is stupid.
|
||||
* </p>
|
||||
*
|
||||
* @return An array of references to neighboring IMultiblockPart blockEntity
|
||||
* entities.
|
||||
* @return An array of references to neighboring {@link IMultiblockPart} {@link BlockEntity} entities.
|
||||
*/
|
||||
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
|
||||
* 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);
|
||||
|
||||
|
@ -221,12 +222,12 @@ public abstract class IMultiblockPart extends BlockEntity {
|
|||
/**
|
||||
* 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
|
||||
* 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.
|
||||
*
|
||||
* @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
|
||||
* this list. Return null if there are no compatible controllers
|
||||
* this list. Return {@code null} if there are no compatible controllers
|
||||
* nearby.
|
||||
*/
|
||||
public abstract Set<MultiblockControllerBase> attachToNeighbors();
|
||||
|
@ -238,12 +239,12 @@ public abstract class IMultiblockPart extends BlockEntity {
|
|||
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();
|
||||
|
||||
/**
|
||||
* @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.
|
||||
*/
|
||||
public abstract NbtCompound getMultiblockSaveData();
|
||||
|
|
|
@ -41,7 +41,7 @@ import java.util.List;
|
|||
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
|
||||
* 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
|
||||
// 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.
|
||||
if (data.contains("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
|
||||
* been ticked, as the chunk in which this blockEntity entity is contained is
|
||||
* Called from Minecraft's {@link BlockEntity} entity loop, after all {@link BlockEntity} entities have
|
||||
* been ticked, as the chunk in which this {@link BlockEntity} entity is contained is
|
||||
* unloading.
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
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>
|
||||
* 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
|
||||
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
|
||||
* 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
|
||||
* description data.
|
||||
* @param packetData {@link NbtCompound} An NBT compound tag into which
|
||||
* you should write your custom description data.
|
||||
*/
|
||||
protected void encodeDescriptionPacket(NbtCompound packetData) {
|
||||
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
|
||||
* packet. Encoded in encodeDescriptionPacket.
|
||||
* Override this to easily read in data from a {@link BlockEntity}'s description
|
||||
* 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) {
|
||||
if (packetData.contains("multiblockData")) {
|
||||
|
@ -334,7 +339,7 @@ public abstract class MultiblockBlockEntityBase extends IMultiblockPart implemen
|
|||
getWorld().markDirty(getPos());
|
||||
}
|
||||
|
||||
// // Helper functions for notifying neighboring blocks
|
||||
// /// Helper functions for notifying neighboring blocks
|
||||
protected void notifyNeighborsOfBlockChange() {
|
||||
world.updateNeighborsAlways(getPos(), getCachedState().getBlock());
|
||||
}
|
||||
|
@ -344,9 +349,10 @@ public abstract class MultiblockBlockEntityBase extends IMultiblockPart implemen
|
|||
}
|
||||
|
||||
// /// 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) {
|
||||
if (this.controller != null) {
|
||||
|
|
|
@ -41,8 +41,9 @@ import java.util.Set;
|
|||
* Conceptually, they are meta-TileEntities. They govern the logic for an
|
||||
* associated group of TileEntities.
|
||||
* <p>
|
||||
* Subordinate TileEntities implement the IMultiblockPart class and, generally,
|
||||
* should not have an update() loop.
|
||||
* Subordinate TileEntities implement the {@link IMultiblockPart} class and, generally,
|
||||
* should not have an update() loop.
|
||||
* </p>
|
||||
*/
|
||||
public abstract class MultiblockControllerBase {
|
||||
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
|
||||
* this call completes.
|
||||
*
|
||||
* @param part Attached part
|
||||
* @param data The NBT tag containing this controller's data.
|
||||
* @param part {@link IMultiblockPart} Attached part
|
||||
* @param data {@link NbtCompound} The NBT tag containing this controller's data.
|
||||
*/
|
||||
public abstract void onAttachedPartWithMultiblockData(IMultiblockPart part, NbtCompound data);
|
||||
|
||||
/**
|
||||
* Check if a block is being tracked by this machine.
|
||||
*
|
||||
* @param blockCoord Coordinate to check.
|
||||
* @return True if the blockEntity entity at blockCoord is being tracked by this
|
||||
* @param blockCoord {@link BlockPos} Coordinate to check.
|
||||
* @return {@code boolean} True if the blockEntity entity at blockCoord is being tracked by this
|
||||
* machine, false otherwise.
|
||||
*/
|
||||
public boolean hasBlock(BlockPos blockCoord) {
|
||||
|
@ -143,7 +144,7 @@ public abstract class MultiblockControllerBase {
|
|||
/**
|
||||
* 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) {
|
||||
//IMultiblockPart candidate;
|
||||
|
@ -218,7 +219,7 @@ public abstract class MultiblockControllerBase {
|
|||
* Called when a new part is added to the machine. Good time to register
|
||||
* things into lists.
|
||||
*
|
||||
* @param newPart The part being added.
|
||||
* @param newPart {@link IMultiblockPart} The part being added.
|
||||
*/
|
||||
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
|
||||
* lists.
|
||||
*
|
||||
* @param oldPart The part being removed.
|
||||
* @param oldPart {@link IMultiblockPart} The part being removed.
|
||||
*/
|
||||
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)
|
||||
* 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) {
|
||||
// Strip out this part
|
||||
|
@ -276,11 +277,11 @@ public abstract class MultiblockControllerBase {
|
|||
|
||||
/**
|
||||
* 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 chunkUnloading Is this entity detaching due to the chunk unloading? If true,
|
||||
* the multiblock will be paused instead of broken.
|
||||
* @param part {@link IMultiblockPart} The part to detach from this machine.
|
||||
* @param chunkUnloading {@code boolean} Is this entity detaching due to the chunk unloading? If true,
|
||||
* the multiblock will be paused instead of broken.
|
||||
*/
|
||||
public void detachBlock(IMultiblockPart part, boolean chunkUnloading) {
|
||||
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
|
||||
* 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.
|
||||
*/
|
||||
protected abstract int getMinimumNumberOfBlocksForAssembledMachine();
|
||||
|
@ -326,7 +327,7 @@ public abstract class MultiblockControllerBase {
|
|||
* (DIMENSION_UNBOUNDED) to disable dimension checking in X. (This is not
|
||||
* 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();
|
||||
|
||||
|
@ -335,7 +336,7 @@ public abstract class MultiblockControllerBase {
|
|||
* (DIMENSION_UNBOUNDED) to disable dimension checking in X. (This is not
|
||||
* 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();
|
||||
|
||||
|
@ -344,7 +345,7 @@ public abstract class MultiblockControllerBase {
|
|||
* (DIMENSION_UNBOUNDED) to disable dimension checking in X. (This is not
|
||||
* 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();
|
||||
|
||||
|
@ -352,7 +353,7 @@ public abstract class MultiblockControllerBase {
|
|||
* Returns the minimum X dimension size of the machine. Must be at least 1,
|
||||
* 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() {
|
||||
return 1;
|
||||
|
@ -362,7 +363,7 @@ public abstract class MultiblockControllerBase {
|
|||
* Returns the minimum Y dimension size of the machine. Must be at least 1,
|
||||
* 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() {
|
||||
return 1;
|
||||
|
@ -372,15 +373,15 @@ public abstract class MultiblockControllerBase {
|
|||
* Returns the minimum Z dimension size of the machine. Must be at least 1,
|
||||
* 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() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return An exception representing the last error encountered when trying
|
||||
* to assemble this multiblock, or null if there is no error.
|
||||
* @return {@link MultiblockValidationException} An exception representing the last error encountered when trying
|
||||
* to assemble this multiblock, or {@code null} if there is no error.
|
||||
*/
|
||||
public MultiblockValidationException getLastValidationException() {
|
||||
return lastValidationException;
|
||||
|
@ -389,6 +390,8 @@ public abstract class MultiblockControllerBase {
|
|||
/**
|
||||
* Checks if a machine is whole. If not, throws an exception with the reason
|
||||
* why.
|
||||
*
|
||||
* @throws MultiblockValidationException if the machine is not whole.
|
||||
*/
|
||||
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
|
||||
* now is, assemble the machine. If the machine was whole, but no longer is,
|
||||
* disassemble the machine.
|
||||
*
|
||||
*/
|
||||
public void checkIfMachineIsWhole() {
|
||||
AssemblyState oldState = this.assemblyState;
|
||||
|
@ -422,8 +424,10 @@ public abstract class MultiblockControllerBase {
|
|||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @param oldState {@link AssemblyState} The previous state of the machine.
|
||||
*/
|
||||
private void assembleMachine(AssemblyState oldState) {
|
||||
for (IMultiblockPart part : connectedParts) {
|
||||
|
@ -441,7 +445,7 @@ public abstract class MultiblockControllerBase {
|
|||
/**
|
||||
* 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
|
||||
* being removed. Calls onMachineBroken on all attached parts.
|
||||
* being removed. Calls {@link IMultiblockPart#onMachineBroken} on all attached parts.
|
||||
*/
|
||||
private void disassembleMachine() {
|
||||
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.
|
||||
*
|
||||
* @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) {
|
||||
BlockPos otherReferenceCoord = other.getReferenceCoord();
|
||||
|
@ -467,7 +473,7 @@ public abstract class MultiblockControllerBase {
|
|||
|
||||
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);
|
||||
|
||||
for (IMultiblockPart acquiredPart : partsToAcquire) {
|
||||
|
@ -489,7 +495,7 @@ public abstract class MultiblockControllerBase {
|
|||
* Called when this machine is consumed by another controller. Essentially,
|
||||
* 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) {
|
||||
if (referenceCoord == null) { return; }
|
||||
|
@ -509,7 +515,7 @@ public abstract class MultiblockControllerBase {
|
|||
* Callback. Called after this controller assimilates all the blocks from
|
||||
* 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);
|
||||
|
||||
|
@ -518,7 +524,7 @@ public abstract class MultiblockControllerBase {
|
|||
* controller. All blocks have been stripped out of this object and handed
|
||||
* 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);
|
||||
|
||||
|
@ -553,7 +559,7 @@ public abstract class MultiblockControllerBase {
|
|||
|
||||
for (int x = minChunkX; x <= maxChunkX; x++) {
|
||||
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.
|
||||
WorldChunk chunkToSave = this.worldObj.getChunk(x, z);
|
||||
chunkToSave.needsSaving();
|
||||
|
@ -565,12 +571,12 @@ public abstract class MultiblockControllerBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* The server-side update loop! Use this similarly to a BlockEntity's update
|
||||
* loop. You do not need to call your superclass' update() if you're
|
||||
* directly derived from MultiblockControllerBase. This is a callback. Note
|
||||
* The server-side update loop! Use this similarly to a {@link BlockEntity}'s update
|
||||
* loop. You do not need to call your superclass' {@code update()} if you're
|
||||
* directly derived from {@link MultiblockControllerBase}. This is a callback. Note
|
||||
* 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.
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* @param world World object for the world in which this controller is
|
||||
* located.
|
||||
* @param x X coordinate of the block being tested
|
||||
* @param y Y coordinate of the block being tested
|
||||
* @param z Z coordinate of the block being tested
|
||||
* @param world {@link World} The object for the world in which this controller is
|
||||
* located.
|
||||
* @param x {@code int} X coordinate of the block being tested
|
||||
* @param y {@code int} Y 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
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* @param world World object for the world in which this controller is
|
||||
* located.
|
||||
* @param x X coordinate of the block being tested
|
||||
* @param y Y coordinate of the block being tested
|
||||
* @param z Z coordinate of the block being tested
|
||||
* @param world {@link World} The object for the world in which this controller is
|
||||
* located.
|
||||
* @param x {@code int} X coordinate of the block being tested
|
||||
* @param y {@code int} Y 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
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* @param world World object for the world in which this controller is
|
||||
* located.
|
||||
* @param x X coordinate of the block being tested
|
||||
* @param y Y coordinate of the block being tested
|
||||
* @param z Z coordinate of the block being tested
|
||||
* @param world {@link World} The object for the world in which this controller is
|
||||
* located.
|
||||
* @param x {@code int} X coordinate of the block being tested
|
||||
* @param y {@code int} Y 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
|
||||
* face
|
||||
* face
|
||||
*/
|
||||
protected void isBlockGoodForBottom(World world, int x, int y, int z) throws 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
|
||||
* located.
|
||||
* @param x X coordinate of the block being tested
|
||||
* @param y Y coordinate of the block being tested
|
||||
* @param z Z coordinate of the block being tested
|
||||
* @param world {@link World} The object for the world in which this controller is
|
||||
* located.
|
||||
* @param x {@code int} X coordinate of the block being tested
|
||||
* @param y {@code int} Y 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
|
||||
* faces
|
||||
* faces
|
||||
*/
|
||||
protected void isBlockGoodForSides(World world, int x, int y, int z) throws 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.
|
||||
*
|
||||
* @param world World object for the world in which this controller is
|
||||
* located.
|
||||
* @param x X coordinate of the block being tested
|
||||
* @param y Y coordinate of the block being tested
|
||||
* @param z Z coordinate of the block being tested
|
||||
* @param world {@link World} The object for the world in which this controller is
|
||||
* located.
|
||||
* @param x {@code int} X coordinate of the block being tested
|
||||
* @param y {@code int} Y 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
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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() {
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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
|
||||
*
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* Called when the save delegate's blockEntity entity receiving a description
|
||||
* Called when the save delegate's {@link BlockEntity} entity receiving a description
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* @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() {
|
||||
return connectedParts.isEmpty();
|
||||
|
@ -767,9 +773,12 @@ public abstract class MultiblockControllerBase {
|
|||
* become the new multiblock master when the two multiblocks are adjacent.
|
||||
* Assumes both multiblocks are the same type.
|
||||
*
|
||||
* @param otherController The other multiblock controller.
|
||||
* @return True if this multiblock should consume the other, false
|
||||
* @param otherController {@link MultiblockControllerBase} The other multiblock controller.
|
||||
* @return {@code boolean} True if this multiblock should consume the other, false
|
||||
* 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) {
|
||||
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.
|
||||
*/
|
||||
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
|
||||
* physically connected to the reference coordinate.
|
||||
*
|
||||
* @return Set with removed parts
|
||||
* @return {@link Set} Set with removed {@link IMultiblockPart}s.
|
||||
*/
|
||||
public Set<IMultiblockPart> checkForDisconnections() {
|
||||
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.
|
||||
*
|
||||
* @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() {
|
||||
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.
|
||||
*/
|
||||
public boolean isAssembled() {
|
||||
|
@ -1035,12 +1044,12 @@ public abstract class MultiblockControllerBase {
|
|||
/**
|
||||
* Marks the reference coord dirty & updateable.
|
||||
* <p>
|
||||
* 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
|
||||
* 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.
|
||||
* <p>
|
||||
* On the client, this will mark the block for a rendering update.
|
||||
* 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
|
||||
* 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.
|
||||
* </p>
|
||||
* <p>On the client, this will mark the block for a rendering update.</p>
|
||||
*/
|
||||
protected void markReferenceCoordForUpdate() {
|
||||
BlockPos rc = getReferenceCoord();
|
||||
|
@ -1053,11 +1062,11 @@ public abstract class MultiblockControllerBase {
|
|||
/**
|
||||
* Marks the reference coord dirty.
|
||||
* <p>
|
||||
* 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
|
||||
* does NOT mark it dirty for a description-packet update.
|
||||
* <p>
|
||||
* On the client, does nothing.
|
||||
* 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
|
||||
* does NOT mark it dirty for a description-packet update.
|
||||
* </p>
|
||||
* <p>On the client, does nothing.</p>
|
||||
*
|
||||
* @see MultiblockControllerBase#markReferenceCoordForUpdate()
|
||||
*/
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
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
|
||||
* asynchronously in environments like MCPC+, so we cannot behavior any blocks
|
||||
* that are in chunks which are still loading.
|
||||
|
|
|
@ -44,7 +44,7 @@ public class MultiblockRegistry {
|
|||
/**
|
||||
* 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) {
|
||||
if (registries.containsKey(world)) {
|
||||
|
@ -57,8 +57,8 @@ public class MultiblockRegistry {
|
|||
/**
|
||||
* Called when the world has finished loading a chunk.
|
||||
*
|
||||
* @param world The world which has finished loading a chunk
|
||||
* @param chunk Loaded chunk
|
||||
* @param world {@link World} The world which has finished loading a chunk
|
||||
* @param chunk {@link Chunk} Loaded chunk
|
||||
*/
|
||||
public static void onChunkLoaded(World world, Chunk chunk) {
|
||||
if (registries.containsKey(world)) {
|
||||
|
@ -70,8 +70,8 @@ public class MultiblockRegistry {
|
|||
* Register a new part in the system. The part has been created either
|
||||
* through user action or via a chunk loading.
|
||||
*
|
||||
* @param world The world into which this part is loading.
|
||||
* @param part The part being loaded.
|
||||
* @param world {@link World} The world into which this part is loading.
|
||||
* @param part {@link IMultiblockPart} The part being loaded.
|
||||
*/
|
||||
public static void onPartAdded(World world, IMultiblockPart part) {
|
||||
MultiblockWorldRegistry registry = getOrCreateRegistry(world);
|
||||
|
@ -81,8 +81,8 @@ public class MultiblockRegistry {
|
|||
/**
|
||||
* Call to remove a part from world lists.
|
||||
*
|
||||
* @param world The world from which a multiblock part is being removed.
|
||||
* @param part The part being removed.
|
||||
* @param world {@link World} The world from which a multiblock part is being removed.
|
||||
* @param part {@link IMultiblockPart} The part being removed.
|
||||
*/
|
||||
public static void onPartRemovedFromWorld(World world, IMultiblockPart part) {
|
||||
if (registries.containsKey(world)) {
|
||||
|
@ -95,7 +95,7 @@ public class MultiblockRegistry {
|
|||
* Called whenever a world is unloaded. Unload the relevant registry, if we
|
||||
* have one.
|
||||
*
|
||||
* @param world The world being unloaded.
|
||||
* @param world {@link World} The world being unloaded.
|
||||
*/
|
||||
public static void onWorldUnloaded(World 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
|
||||
* added or removed this tick.
|
||||
*
|
||||
* @param world The world containing the multiblock
|
||||
* @param controller The dirty controller
|
||||
* @param world {@link World} The world containing the multiblock
|
||||
* @param controller {@link MultiblockControllerBase} The dirty controller
|
||||
*/
|
||||
public static void addDirtyController(World world, MultiblockControllerBase controller) {
|
||||
if (registries.containsKey(world)) {
|
||||
registries.get(world).addDirtyController(controller);
|
||||
} 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
|
||||
* it has no connected parts. It will be removed after the next world tick.
|
||||
*
|
||||
* @param world The world formerly containing the multiblock
|
||||
* @param controller The dead controller
|
||||
* @param world {@link World} The world formerly containing the multiblock
|
||||
* @param controller {@link MultiblockControllerBase} The dead controller
|
||||
*/
|
||||
public static void addDeadController(World world, MultiblockControllerBase controller) {
|
||||
if (registries.containsKey(world)) {
|
||||
|
@ -137,9 +137,9 @@ public class MultiblockRegistry {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param world The world whose controllers you wish to retrieve.
|
||||
* @return An unmodifiable set of controllers active in the given world, or
|
||||
* null if there are none.
|
||||
* @param world {@link World} The world whose controllers you wish to retrieve.
|
||||
* @return {@link Set} An unmodifiable set of {@link MultiblockControllerBase}
|
||||
* controllers active in the given world, or null if there are none.
|
||||
*/
|
||||
public static Set<MultiblockControllerBase> getControllersFromWorld(World world) {
|
||||
if (registries.containsKey(world)) {
|
||||
|
|
|
@ -311,7 +311,7 @@ public class MultiblockWorldRegistry {
|
|||
* during the next tick. If the chunk is not loaded, it will be added to a
|
||||
* 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) {
|
||||
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,
|
||||
* 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) {
|
||||
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
|
||||
* be added to machines after the next world tick.
|
||||
* be added to the machines after the next world tick.
|
||||
*
|
||||
* @param chunk Chunk that was
|
||||
* loaded
|
||||
* @param chunk {@link Chunk} Chunk that was loaded
|
||||
*/
|
||||
public void onChunkLoaded(Chunk chunk) {
|
||||
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
|
||||
* 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) {
|
||||
this.deadControllers.add(deadController);
|
||||
|
@ -429,7 +428,7 @@ public class MultiblockWorldRegistry {
|
|||
* changed, and it must be re-checked for assembly and, possibly, for
|
||||
* orphans.
|
||||
*
|
||||
* @param dirtyController The dirty controller.
|
||||
* @param dirtyController {@link MultiblockControllerBase} The dirty controller.
|
||||
*/
|
||||
public void addDirtyController(MultiblockControllerBase 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
|
||||
* iterate over all controllers in a world!
|
||||
*
|
||||
* @return An (unmodifiable) set of controllers which are active in this
|
||||
* world.
|
||||
* @return {@link Set} An (unmodifiable) set of {@link MultiblockControllerBase}
|
||||
* controllers which are active in this world.
|
||||
*/
|
||||
public Set<MultiblockControllerBase> getControllers() {
|
||||
return Collections.unmodifiableSet(controllers);
|
||||
|
|
|
@ -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 isGoodForSides() throws MultiblockValidationException;
|
||||
|
|
|
@ -37,8 +37,8 @@ public abstract class RectangularMultiblockControllerBase extends MultiblockCont
|
|||
}
|
||||
|
||||
/**
|
||||
* @return True if the machine is "whole" and should be assembled. False
|
||||
* otherwise.
|
||||
* @throws MultiblockValidationException If the machine is not "whole" and
|
||||
* should not be assembled.
|
||||
*/
|
||||
@Override
|
||||
protected void isMachineWhole() throws MultiblockValidationException {
|
||||
|
|
|
@ -52,7 +52,7 @@ public class ExtendedPacketBuffer extends PacketByteBuf {
|
|||
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) {
|
||||
DataResult<NbtElement> dataResult = codec.encodeStart(NbtOps.INSTANCE, object);
|
||||
if (dataResult.error().isPresent()) {
|
||||
|
|
|
@ -54,7 +54,8 @@ public class ServerBoundPackets {
|
|||
IdentifiedPacket packetFluidConfigSync = ClientBoundPackets.createPacketFluidConfigSync(pos, legacyMachineBase.fluidConfiguration);
|
||||
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();
|
||||
BlockState blockState = world.getBlockState(legacyMachineBase.getPos());
|
||||
world.updateNeighborsAlways(legacyMachineBase.getPos(), blockState.getBlock());
|
||||
|
@ -89,7 +90,7 @@ public class ServerBoundPackets {
|
|||
config.setInput(input);
|
||||
config.setOutput(output);
|
||||
|
||||
//Syncs back to the client
|
||||
// Syncs back to the client
|
||||
IdentifiedPacket packetFluidConfigSync = ClientBoundPackets.createPacketFluidConfigSync(pos, legacyMachineBase.fluidConfiguration);
|
||||
NetworkManager.sendToTracking(packetFluidConfigSync, legacyMachineBase);
|
||||
});
|
||||
|
@ -112,7 +113,7 @@ public class ServerBoundPackets {
|
|||
|
||||
holder.setInput(input);
|
||||
holder.setOutput(output);
|
||||
holder.setfilter(filter);
|
||||
holder.setFilter(filter);
|
||||
|
||||
//Syncs back to the client
|
||||
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 -> {
|
||||
packetBuffer.writeBlockPos(pos);
|
||||
});
|
||||
|
|
|
@ -26,13 +26,10 @@ package reborncore.common.powerSystem;
|
|||
|
||||
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.ItemVariant;
|
||||
import net.fabricmc.fabric.api.transfer.v1.storage.base.SingleSlotStorage;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.inventory.Inventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
|
@ -43,6 +40,7 @@ import net.minecraft.util.math.MathHelper;
|
|||
import net.minecraft.world.World;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import reborncore.api.IListInfoProvider;
|
||||
import reborncore.client.screen.builder.BlockEntityScreenHandlerBuilder;
|
||||
import reborncore.common.blockentity.MachineBaseBlockEntity;
|
||||
import reborncore.common.blockentity.RedstoneConfiguration;
|
||||
import reborncore.common.util.StringUtils;
|
||||
|
@ -77,7 +75,7 @@ public abstract class PowerAcceptorBlockEntity extends MachineBaseBlockEntity im
|
|||
public int extraTier;
|
||||
public long powerChange;
|
||||
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) {
|
||||
super(type, pos, state);
|
||||
|
@ -99,7 +97,7 @@ public abstract class PowerAcceptorBlockEntity extends MachineBaseBlockEntity im
|
|||
/**
|
||||
* 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() {
|
||||
return getMaxStoredPower() - getStored();
|
||||
|
@ -108,7 +106,7 @@ public abstract class PowerAcceptorBlockEntity extends MachineBaseBlockEntity im
|
|||
/**
|
||||
* Adds energy to block entity
|
||||
*
|
||||
* @param amount double Amount to add
|
||||
* @param amount {@code long} Amount to add
|
||||
*/
|
||||
public void addEnergy(long amount){
|
||||
setStored(getEnergy() + amount);
|
||||
|
@ -127,7 +125,7 @@ public abstract class PowerAcceptorBlockEntity extends MachineBaseBlockEntity im
|
|||
/**
|
||||
* 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){
|
||||
if (getEnergy() > amount) {
|
||||
|
@ -140,7 +138,7 @@ public abstract class PowerAcceptorBlockEntity extends MachineBaseBlockEntity im
|
|||
/**
|
||||
* 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) {
|
||||
if (world == null) {
|
||||
|
@ -170,7 +168,7 @@ public abstract class PowerAcceptorBlockEntity extends MachineBaseBlockEntity im
|
|||
/**
|
||||
* 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) {
|
||||
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
|
||||
* {@code ceil(blockEntity.getStored() * 15.0 / storage.getMaxPower())}.
|
||||
* <pre>
|
||||
* ceil(blockEntity.getStored() * 15.0 / storage.getMaxPower())
|
||||
* </pre>
|
||||
*
|
||||
* @param blockEntity the powered BE
|
||||
* @return the calculated comparator output or 0 if {@code blockEntity} is not a {@code PowerAcceptorBlockEntity}
|
||||
* @param blockEntity {@link BlockEntity} the powered BE
|
||||
* @return {@code int} the calculated comparator output or 0 if {@link BlockEntity}
|
||||
* is not a {@link PowerAcceptorBlockEntity}
|
||||
*/
|
||||
public static int calculateComparatorOutputFromEnergy(@Nullable BlockEntity blockEntity) {
|
||||
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
|
||||
*
|
||||
* @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() {
|
||||
return true;
|
||||
|
@ -222,8 +223,8 @@ public abstract class PowerAcceptorBlockEntity extends MachineBaseBlockEntity im
|
|||
/**
|
||||
* Check if block entity can accept energy from a particular side
|
||||
*
|
||||
* @param side EnergySide Machine side
|
||||
* @return boolean Returns true if machine can accept energy from side provided
|
||||
* @param side {@link Direction} Machine side
|
||||
* @return {@code boolean} Returns true if machine can accept energy from side provided
|
||||
*/
|
||||
protected boolean canAcceptEnergy(@Nullable Direction side){
|
||||
return true;
|
||||
|
@ -232,62 +233,68 @@ public abstract class PowerAcceptorBlockEntity extends MachineBaseBlockEntity im
|
|||
/**
|
||||
* Check if block entity can provide energy via a particular side
|
||||
*
|
||||
* @param side EnergySide Machine side
|
||||
* @return boolean Returns true if machine can provide energy via particular side
|
||||
* @param side {@link Direction} Machine side
|
||||
* @return {@code boolean} Returns true if machine can provide energy via particular side
|
||||
*/
|
||||
protected boolean canProvideEnergy(@Nullable Direction side){
|
||||
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(){
|
||||
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) {
|
||||
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() {
|
||||
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) {
|
||||
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() {
|
||||
return getStored();
|
||||
return getStored();
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper method used to sync energy values with client via BlockEntityScreenHandlerBuilder
|
||||
* @param energy double Energy stored in block entity
|
||||
* Wrapper method used to sync energy values with client via
|
||||
* {@link BlockEntityScreenHandlerBuilder}
|
||||
*
|
||||
* @param energy {@code long} Energy stored in block entity
|
||||
*/
|
||||
public void setEnergy(long 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
|
||||
*
|
||||
* @return double Size of internal Energy buffer
|
||||
* @return {@code long} Size of internal Energy buffer
|
||||
*/
|
||||
public abstract long getBaseMaxPower();
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
|
@ -346,7 +353,7 @@ public abstract class PowerAcceptorBlockEntity extends MachineBaseBlockEntity im
|
|||
super.readNbt(tag);
|
||||
NbtCompound data = tag.getCompound("PowerAcceptor");
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,13 +5,16 @@ import net.minecraft.entity.player.PlayerEntity;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Hand;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import team.reborn.energy.api.EnergyStorage;
|
||||
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>
|
||||
* <li>A tooltip will be added for the item, indicating the stored power, the max power and the extraction rates.</li>
|
||||
* <li>Any RcEnergyItem input in a crafting recipe input will automatically give its energy to the output if the output implements RcEnergyItem.</li>
|
||||
* <li>A tooltip will be added for the item, indicating the stored power,
|
||||
* 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>
|
||||
* TODO: consider moving this functionality to the energy API?
|
||||
*/
|
||||
|
@ -19,7 +22,7 @@ public interface RcEnergyItem extends SimpleBatteryItem, FabricItem {
|
|||
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();
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ import net.minecraft.block.entity.BlockEntity;
|
|||
/**
|
||||
* Created by Mark on 01/07/2017.
|
||||
*/
|
||||
public interface ICrafterSoundHanlder {
|
||||
public interface ICrafterSoundHandler {
|
||||
|
||||
void playSound(boolean firstRun, BlockEntity blockEntity);
|
||||
|
|
@ -25,22 +25,22 @@
|
|||
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 {
|
||||
|
||||
void resetSpeedMulti();
|
||||
void resetSpeedMultiplier();
|
||||
|
||||
double getSpeedMultiplier();
|
||||
|
||||
void addPowerMulti(double amount);
|
||||
void addPowerMultiplier(double amount);
|
||||
|
||||
void resetPowerMulti();
|
||||
void resetPowerMultiplier();
|
||||
|
||||
double getPowerMultiplier();
|
||||
|
||||
long getEuPerTick(long baseEu);
|
||||
|
||||
void addSpeedMulti(double amount);
|
||||
void addSpeedMultiplier(double amount);
|
||||
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ public class RecipeCrafter implements IUpgradeHandler {
|
|||
int ticksSinceLastChange;
|
||||
|
||||
@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,
|
||||
|
@ -172,7 +172,7 @@ public class RecipeCrafter implements IUpgradeHandler {
|
|||
currentRecipe = null;
|
||||
currentTickTime = 0;
|
||||
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) {
|
||||
setIsActive();
|
||||
}
|
||||
|
@ -181,8 +181,8 @@ public class RecipeCrafter implements IUpgradeHandler {
|
|||
long useRequirement = getEuPerTick(currentRecipe.getPower());
|
||||
if (energy.tryUseExact(useRequirement)) {
|
||||
currentTickTime++;
|
||||
if ((currentTickTime == 1 || currentTickTime % 20 == 0) && soundHanlder != null) {
|
||||
soundHanlder.playSound(false, blockEntity);
|
||||
if ((currentTickTime == 1 || currentTickTime % 20 == 0) && soundHandler != null) {
|
||||
soundHandler.playSound(false, blockEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -196,11 +196,11 @@ public class RecipeCrafter implements IUpgradeHandler {
|
|||
public void updateCurrentRecipe() {
|
||||
currentTickTime = 0;
|
||||
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 (!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;
|
||||
for (int i = 0; i < recipe.getOutputs().size(); i++) {
|
||||
if (!canFitOutput(recipe.getOutputs().get(i), outputSlots[i])) {
|
||||
|
@ -246,7 +246,7 @@ public class RecipeCrafter implements IUpgradeHandler {
|
|||
return;
|
||||
}
|
||||
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))) {
|
||||
inventory.shrinkSlot(inputSlot, ingredient.getCount());
|
||||
break;
|
||||
|
@ -354,8 +354,8 @@ public class RecipeCrafter implements IUpgradeHandler {
|
|||
return inventory.hasChanged();
|
||||
}
|
||||
|
||||
public void setInvDirty(boolean isDiry) {
|
||||
inventory.setHashChanged(isDiry);
|
||||
public void setInvDirty(boolean isDirty) {
|
||||
inventory.setHashChanged(isDirty);
|
||||
}
|
||||
|
||||
public boolean isStackValidInput(ItemStack stack) {
|
||||
|
@ -363,7 +363,8 @@ public class RecipeCrafter implements IUpgradeHandler {
|
|||
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();
|
||||
largeStack.setCount(largeStack.getMaxCount());
|
||||
for (RebornRecipe recipe : recipeType.getRecipes(blockEntity.getWorld())) {
|
||||
|
@ -377,8 +378,8 @@ public class RecipeCrafter implements IUpgradeHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void resetSpeedMulti() {
|
||||
parentUpgradeHandler.ifPresent(IUpgradeHandler::resetSpeedMulti);
|
||||
public void resetSpeedMultiplier() {
|
||||
parentUpgradeHandler.ifPresent(IUpgradeHandler::resetSpeedMultiplier);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -387,13 +388,13 @@ public class RecipeCrafter implements IUpgradeHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void addPowerMulti(double amount) {
|
||||
parentUpgradeHandler.ifPresent(iUpgradeHandler -> iUpgradeHandler.addPowerMulti(amount));
|
||||
public void addPowerMultiplier(double amount) {
|
||||
parentUpgradeHandler.ifPresent(iUpgradeHandler -> iUpgradeHandler.addPowerMultiplier(amount));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetPowerMulti() {
|
||||
parentUpgradeHandler.ifPresent(IUpgradeHandler::resetPowerMulti);
|
||||
public void resetPowerMultiplier() {
|
||||
parentUpgradeHandler.ifPresent(IUpgradeHandler::resetPowerMultiplier);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -408,7 +409,7 @@ public class RecipeCrafter implements IUpgradeHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void addSpeedMulti(double amount) {
|
||||
parentUpgradeHandler.ifPresent(iUpgradeHandler -> iUpgradeHandler.addSpeedMulti(amount));
|
||||
public void addSpeedMultiplier(double amount) {
|
||||
parentUpgradeHandler.ifPresent(iUpgradeHandler -> iUpgradeHandler.addSpeedMultiplier(amount));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public class CalenderUtils {
|
|||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
|
||||
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 (day >= 24 && day <= 26) {
|
||||
christmas = true;
|
||||
|
|
|
@ -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
|
||||
* idea from ExtraUtilities, who stole it from vanilla.
|
||||
* <p>
|
||||
* Original class link:
|
||||
* https://github.com/SleepyTrousers/EnderCore/blob/master/src/main/java/com/enderio/core/common/util/ChatUtil.java
|
||||
* Original class link:
|
||||
* https://github.com/SleepyTrousers/EnderCore/blob/master/src/main/java/com/enderio/core/common/util/ChatUtil.java
|
||||
* </p>
|
||||
*/
|
||||
|
||||
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) {
|
||||
if (FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT) {
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
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 final static Color WHITE = new Color(255, 255, 255);
|
||||
|
|
|
@ -35,7 +35,11 @@ import java.util.function.Function;
|
|||
import java.util.function.Supplier;
|
||||
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>> {
|
||||
|
||||
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() {
|
||||
return CH_ID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,12 @@ public class FluidTextHelper {
|
|||
|
||||
/**
|
||||
* 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) {
|
||||
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
|
||||
* in
|
||||
*
|
||||
* <pre>
|
||||
* 2 ¹⁄₈₁
|
||||
* 2 ¹⁄₈₁
|
||||
* </pre>
|
||||
*
|
||||
* .
|
||||
*/
|
||||
public static String getUnicodeMillibuckets(long droplets, boolean simplify) {
|
||||
String result = "" + droplets / 81;
|
||||
|
|
|
@ -50,7 +50,7 @@ public class InventoryItem extends InventoryBase {
|
|||
this.stack = stack;
|
||||
}
|
||||
|
||||
public static InventoryItem getItemInvetory(ItemStack stack, int size) {
|
||||
public static InventoryItem getItemInventory(ItemStack stack, int size) {
|
||||
return new InventoryItem(stack, size);
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ public class ItemHandlerUtils {
|
|||
dropItemHandler(world, pos, inventory);
|
||||
}
|
||||
if (blockEntity instanceof IUpgradeable) {
|
||||
dropItemHandler(world, pos, ((IUpgradeable) blockEntity).getUpgradeInvetory());
|
||||
dropItemHandler(world, pos, ((IUpgradeable) blockEntity).getUpgradeInventory());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,15 +31,15 @@ import net.minecraft.nbt.NbtList;
|
|||
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) {
|
||||
return stack.hasNbt();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to initialize an NBT Tag Compound in an ItemStack, this will not do
|
||||
* anything if the stack already has a tag compound
|
||||
* Tries to initialize an {@link NbtCompound} in an {@link ItemStack}, this will not do
|
||||
* anything if the stack already has an {@link NbtCompound}
|
||||
**/
|
||||
public static void initNBT(ItemStack 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
|
||||
**/
|
||||
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
|
||||
**/
|
||||
public static NbtCompound getNBT(ItemStack stack) {
|
||||
|
@ -113,53 +113,53 @@ public class ItemNBTHelper {
|
|||
// GETTERS
|
||||
// ///////////////////////////////////////////////////////////////////
|
||||
|
||||
public static boolean verifyExistance(ItemStack stack, String tag) {
|
||||
public static boolean verifyExistence(ItemStack stack, String tag) {
|
||||
return !stack.isEmpty() && getNBT(stack).contains(tag);
|
||||
}
|
||||
|
||||
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) {
|
||||
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) {
|
||||
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) {
|
||||
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) {
|
||||
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) {
|
||||
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) {
|
||||
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.
|
||||
**/
|
||||
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();
|
||||
}
|
||||
|
||||
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) {
|
||||
return verifyExistance(stack, tag) ? getNBT(stack).getList(tag, objtype)
|
||||
public static NbtList getList(ItemStack stack, String tag, int objType, boolean nullifyOnFail) {
|
||||
return verifyExistence(stack, tag) ? getNBT(stack).getList(tag, objType)
|
||||
: nullifyOnFail ? null : new NbtList();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -147,8 +147,8 @@ public class ItemUtils {
|
|||
/**
|
||||
* Checks if powered item is active
|
||||
*
|
||||
* @param stack ItemStack ItemStack to check
|
||||
* @return True if powered item is active
|
||||
* @param stack {@link ItemStack} Stack to check
|
||||
* @return {@code boolean} True if powered item is active
|
||||
*/
|
||||
public static boolean isActive(ItemStack stack) {
|
||||
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
|
||||
*
|
||||
* @param stack ItemStack ItemStack to check
|
||||
* @param cost int Cost of operation performed by tool
|
||||
* @param isClient boolean Client side
|
||||
* @param messageId int MessageID for sending no spam message
|
||||
* @param stack {@link ItemStack} Stack to check
|
||||
* @param cost {@link int} Cost of operation performed by tool
|
||||
* @param isClient {@link boolean} Client side
|
||||
* @param messageId {@link int} MessageID for sending no spam message
|
||||
*/
|
||||
public static void checkActive(ItemStack stack, int cost, boolean isClient, int messageId) {
|
||||
if (!ItemUtils.isActive(stack)) {
|
||||
|
@ -185,10 +185,10 @@ public class ItemUtils {
|
|||
/**
|
||||
* Switch active\inactive state for powered item
|
||||
*
|
||||
* @param stack ItemStack ItemStack to work on
|
||||
* @param cost int Cost of operation performed by tool
|
||||
* @param isClient boolean Are we on client side
|
||||
* @param messageId MessageID for sending no spam message
|
||||
* @param stack {@link ItemStack} Stack to switch state
|
||||
* @param cost {@code int} Cost of operation performed by tool
|
||||
* @param isClient {@code boolean} Are we on client side
|
||||
* @param messageId {@code int} MessageID for sending no spam message
|
||||
*/
|
||||
public static void switchActive(ItemStack stack, int cost, boolean isClient, int messageId) {
|
||||
ItemUtils.checkActive(stack, cost, isClient, messageId);
|
||||
|
@ -225,8 +225,8 @@ public class ItemUtils {
|
|||
/**
|
||||
* Adds active\inactive state to powered item tooltip
|
||||
*
|
||||
* @param stack ItemStack ItemStack to check
|
||||
* @param tooltip List Tooltip strings
|
||||
* @param stack {@link ItemStack} Stack to check
|
||||
* @param tooltip {@link List} List of {@link Text} tooltip strings
|
||||
*/
|
||||
public static void buildActiveTooltip(ItemStack stack, List<Text> tooltip) {
|
||||
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 itemStack ItemStack Powered item
|
||||
* @param maxOutput int Maximum output rate of powered item
|
||||
* @param player {@link PlayerEntity} Player having powered item
|
||||
* @param itemStack {@link ItemStack} Powered item
|
||||
* @param maxOutput {@code int} Maximum output rate of powered item
|
||||
*/
|
||||
public static void distributePowerToInventory(PlayerEntity player, ItemStack itemStack, long maxOutput) {
|
||||
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) {
|
||||
// Locate the current stack in the player inventory.
|
||||
PlayerInventoryStorage playerInv = PlayerInventoryStorage.of(player);
|
||||
|
|
|
@ -43,7 +43,7 @@ public enum MachineFacing {
|
|||
return machineBase.getFacing().getOpposite();
|
||||
}
|
||||
if (this == RIGHT) {
|
||||
//North -> West
|
||||
// North -> West
|
||||
int i = machineBase.getFacing().getOpposite().getHorizontal() + 1;
|
||||
if (i > 3) {
|
||||
i = 0;
|
||||
|
@ -54,7 +54,7 @@ public enum MachineFacing {
|
|||
return Direction.fromHorizontal(i);
|
||||
}
|
||||
if (this == LEFT) {
|
||||
//North -> East
|
||||
// North -> East
|
||||
int i = machineBase.getFacing().getOpposite().getHorizontal() - 1;
|
||||
if (i > 3) {
|
||||
i = 0;
|
||||
|
|
|
@ -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) {
|
||||
super(size);
|
||||
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.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) {
|
||||
this(size, invName, invStackLimit, blockEntity, (slotID, stack, facing, direction, be) -> {
|
||||
if (facing == null) {
|
||||
|
@ -99,8 +99,8 @@ public class RebornInventory<T extends MachineBaseBlockEntity> extends Inventory
|
|||
}
|
||||
|
||||
public void read(NbtCompound data, String tag) {
|
||||
NbtCompound nbttaglist = data.getCompound(tag);
|
||||
deserializeNBT(nbttaglist);
|
||||
NbtCompound nbtTagList = data.getCompound(tag);
|
||||
deserializeNBT(nbtTagList);
|
||||
hasChanged = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -54,8 +54,8 @@ public class StringUtils {
|
|||
/**
|
||||
* Returns red-yellow-green text formatting depending on percentage
|
||||
*
|
||||
* @param percentage int percentage amount
|
||||
* @return TextFormatting Red or Yellow or Green
|
||||
* @param percentage {@code int} percentage amount
|
||||
* @return {@link Formatting} Red or Yellow or Green
|
||||
*/
|
||||
public static Formatting getPercentageColour(int percentage) {
|
||||
if (percentage <= 10) {
|
||||
|
|
|
@ -107,7 +107,7 @@ public class Tank extends SnapshotParticipant<FluidInstance> implements Syncable
|
|||
|
||||
public final Tank read(NbtCompound nbt) {
|
||||
if (nbt.contains(name)) {
|
||||
// allow to read empty tanks
|
||||
// allow reading empty tanks
|
||||
setFluid(Fluids.EMPTY);
|
||||
|
||||
NbtCompound tankData = nbt.getCompound(name);
|
||||
|
|
|
@ -38,13 +38,13 @@ public class Torus {
|
|||
private static final ExecutorService GEN_EXECUTOR = Executors.newSingleThreadExecutor();
|
||||
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<>();
|
||||
for (int x = -radius; x < radius; x++) {
|
||||
for (int y = -radius; y < radius; y++) {
|
||||
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)) {
|
||||
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) {
|
||||
if (torusSizeCache != null) {
|
||||
//Lets not do this again
|
||||
// Let's not do this again
|
||||
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;
|
||||
|
||||
torusSizeCache = new Int2IntOpenHashMap(sizeToCompute);
|
||||
|
@ -83,6 +83,10 @@ public class Torus {
|
|||
GEN_EXECUTOR.shutdown();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link Int2IntMap}
|
||||
* @throws RuntimeException If failed to initialize the map
|
||||
*/
|
||||
public static Int2IntMap getTorusSizeCache() {
|
||||
if (!GEN_EXECUTOR.isShutdown()) {
|
||||
try {
|
||||
|
|
|
@ -35,10 +35,10 @@ import java.nio.file.Paths;
|
|||
import java.util.*;
|
||||
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 {
|
||||
|
||||
//Scanner used for manual matching
|
||||
// Scanner used for manual matching
|
||||
private static final Scanner SCANNER = new Scanner(System.in);
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
|
@ -68,7 +68,7 @@ public class TranslationTools {
|
|||
key = keyMap.get(key);
|
||||
}
|
||||
if (!newLang.containsKey(key)) {
|
||||
//Lost key, no point copying them over
|
||||
// Lost key, no point copying them over
|
||||
continue;
|
||||
}
|
||||
output.put(key, value);
|
||||
|
|
|
@ -49,9 +49,9 @@ public class WorldUtils {
|
|||
/**
|
||||
* Checks if chunk is loaded using proper chunk manager
|
||||
*
|
||||
* @param world World object
|
||||
* @param pos BlockPos X and Z coordinates to check
|
||||
* @return boolean True if chunk is loaded
|
||||
* @param world {@link World} World object
|
||||
* @param pos {@link BlockPos} X and Z coordinates to check
|
||||
* @return {@code boolean} True if chunk is loaded
|
||||
*/
|
||||
public static boolean isChunkLoaded(World world, BlockPos pos){
|
||||
return world.getChunkManager().isChunkLoaded(ChunkSectionPos.getSectionCoord(pos.getX()), ChunkSectionPos.getSectionCoord(pos.getZ()));
|
||||
|
|
|
@ -34,7 +34,7 @@ import net.minecraft.util.registry.Registry;
|
|||
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
//Based from ee3's code
|
||||
// Based from ee3's code
|
||||
public class ItemStackSerializer implements JsonSerializer<ItemStack>, JsonDeserializer<ItemStack> {
|
||||
|
||||
private static final String NAME = "name";
|
||||
|
|
|
@ -42,7 +42,7 @@ public class SerializationUtil {
|
|||
.registerTypeAdapter(ItemStack.class, new ItemStackSerializer())
|
||||
.create();
|
||||
|
||||
//Same as above, just without pretty printing
|
||||
// Same as above, just without pretty printing
|
||||
public static final Gson GSON_FLAT = new GsonBuilder()
|
||||
.enableComplexMapKeySerialization()
|
||||
.registerTypeAdapter(ItemStack.class, new ItemStackSerializer())
|
||||
|
|
|
@ -25,9 +25,9 @@
|
|||
"reborncore.common.mixins.json"
|
||||
],
|
||||
"depends": {
|
||||
"fabricloader": ">=0.12.0",
|
||||
"fabricloader": ">=0.12.12",
|
||||
"fabric": ">=0.40.0",
|
||||
"team_reborn_energy": ">=2.0.0-beta1",
|
||||
"team_reborn_energy": ">=2.2.0",
|
||||
"fabric-biome-api-v1": ">=3.0.0"
|
||||
},
|
||||
"authors": [
|
||||
|
|
18
build.gradle
18
build.gradle
|
@ -137,6 +137,20 @@ allprojects {
|
|||
}
|
||||
}
|
||||
|
||||
processResources {
|
||||
doLast {
|
||||
// Depend on the reborn core version it was built against
|
||||
fileTree(dir: outputs.files.asPath, include: "fabric.mod.json").each {
|
||||
def jsonSlurper = new JsonSlurper()
|
||||
def modJson = jsonSlurper.parseText(it.text)
|
||||
|
||||
modJson.depends.reborncore = "~${project.version}"
|
||||
|
||||
it.text = JsonOutput.toJson(modJson)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
loom {
|
||||
accessWidenerPath = file("src/main/resources/techreborn.accesswidener")
|
||||
}
|
||||
|
@ -237,7 +251,7 @@ loom {
|
|||
test.dependsOn runGametest
|
||||
|
||||
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')
|
||||
}
|
||||
|
||||
|
@ -386,4 +400,4 @@ task checkVersion {
|
|||
|
||||
github.mustRunAfter checkVersion
|
||||
publish.mustRunAfter checkVersion
|
||||
project.tasks.curseforge.mustRunAfter checkVersion
|
||||
project.tasks.curseforge.mustRunAfter checkVersion
|
||||
|
|
|
@ -2,17 +2,17 @@
|
|||
org.gradle.jvmargs=-Xmx2G
|
||||
|
||||
# Mod properties
|
||||
mod_version=5.1.0-beta.7
|
||||
mod_version=5.1.0-beta.9
|
||||
|
||||
# Fabric Properties
|
||||
# check these on https://modmuss50.me/fabric.html
|
||||
minecraft_version=1.18.1
|
||||
yarn_version=1.18.1+build.18
|
||||
loader_version=0.12.12
|
||||
fapi_version=0.46.1+1.18
|
||||
fapi_version=0.46.4+1.18
|
||||
|
||||
# Dependencies
|
||||
energy_version=2.1.0
|
||||
energy_version=2.2.0
|
||||
rei_version=7.1.361
|
||||
trinkets_version=3.0.2
|
||||
autoswitch_version=-SNAPSHOT
|
||||
|
|
|
@ -153,7 +153,7 @@ class MachineRecipeJsonFactory<R extends RebornRecipe> {
|
|||
|
||||
protected void validate() {
|
||||
if (ingredients.isEmpty()) {
|
||||
throw new IllegalStateException("recipe has no ingrendients")
|
||||
throw new IllegalStateException("recipe has no ingredients")
|
||||
}
|
||||
|
||||
if (outputs.isEmpty()) {
|
||||
|
|
|
@ -81,7 +81,7 @@ public class TechReborn implements ModInitializer {
|
|||
|
||||
if (TechRebornConfig.machineSoundVolume > 0) {
|
||||
if (TechRebornConfig.machineSoundVolume > 1) TechRebornConfig.machineSoundVolume = 1F;
|
||||
RecipeCrafter.soundHanlder = new ModSounds.SoundHandler();
|
||||
RecipeCrafter.soundHandler = new ModSounds.SoundHandler();
|
||||
}
|
||||
ModLoot.init();
|
||||
WorldGenerator.initWorldGen();
|
||||
|
|
|
@ -47,7 +47,7 @@ public interface CableElectrocutionEvent {
|
|||
/**
|
||||
* 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);
|
||||
}
|
||||
|
|
|
@ -33,22 +33,24 @@ import java.util.Optional;
|
|||
public class GeneratorRecipeHelper {
|
||||
|
||||
/**
|
||||
* This 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
|
||||
* FluidGeneratorRecipe.
|
||||
* This {@link EnumMap} store all the energy recipes for the fluid generators. Each
|
||||
* value of the {@link EFluidGenerator} enum is linked to an object holding a set of
|
||||
* {@link FluidGeneratorRecipe}.
|
||||
*/
|
||||
public static EnumMap<EFluidGenerator, FluidGeneratorRecipeList> fluidRecipes = new EnumMap<>(
|
||||
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
|
||||
* allowed to be consumed.
|
||||
* @param fluidType
|
||||
* @param energyPerMb Represent the energy / MILLI_BUCKET the fluid will produce.
|
||||
* Some generators use this value to alter their fluid decay
|
||||
* speed to match their maximum energy output.
|
||||
* @param generatorType {@link EFluidGenerator} A value of the {@link EFluidGenerator} type in
|
||||
* which the fluid is allowed to be consumed.
|
||||
* @param fluidType {@link Fluid} The fluid type that will be registered.
|
||||
* @param energyPerMb {@code int} Represent the energy / MILLI_BUCKET the fluid will produce.
|
||||
* <p>
|
||||
* 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) {
|
||||
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
|
||||
* allowed to be consumed.
|
||||
* @return An object holding a set of availables recipes for this type of
|
||||
* FluidGenerator.
|
||||
* @param generatorType {@link EFluidGenerator} A value of the {@link EFluidGenerator} type in
|
||||
* which the fluid is allowed to be consumed.
|
||||
* @return {@link FluidGeneratorRecipeList} An object holding a set of available recipes
|
||||
* for this type of {@link EFluidGenerator}.
|
||||
*/
|
||||
public static FluidGeneratorRecipeList getFluidRecipesForGenerator(EFluidGenerator generatorType) {
|
||||
return fluidRecipes.get(generatorType);
|
||||
|
@ -68,8 +70,9 @@ public class GeneratorRecipeHelper {
|
|||
/**
|
||||
* Removes recipe
|
||||
*
|
||||
* @param generatorType A value of the EFluidGenerator type for which we should remove recipe
|
||||
* @param fluidType Fluid to remove from generator recipes
|
||||
* @param generatorType {@link EFluidGenerator} A value of the {@link EFluidGenerator} type for
|
||||
* which we should remove recipe
|
||||
* @param fluidType {@link Fluid} Fluid to remove from generator recipes
|
||||
*/
|
||||
public static void removeFluidRecipe(EFluidGenerator generatorType, Fluid fluidType) {
|
||||
FluidGeneratorRecipeList recipeList = getFluidRecipesForGenerator(generatorType);
|
||||
|
|
|
@ -38,10 +38,10 @@ import java.util.List;
|
|||
public class ScrapboxRecipeCrafter extends RecipeCrafter {
|
||||
|
||||
/**
|
||||
* @param parent Tile having this crafter
|
||||
* @param inventory Inventory from parent blockEntity
|
||||
* @param inputSlots Slot IDs for input
|
||||
* @param outputSlots Slot IDs for output
|
||||
* @param parent {@link BlockEntity} Tile having this crafter
|
||||
* @param inventory {@link RebornInventory} Inventory from parent blockEntity
|
||||
* @param inputSlots {@code int[]} Slot IDs for input
|
||||
* @param outputSlots {@code int[]} Slot IDs for output
|
||||
*/
|
||||
public ScrapboxRecipeCrafter(BlockEntity parent, RebornInventory<?> inventory, int[] inputSlots, int[] outputSlots) {
|
||||
super(ModRecipes.SCRAPBOX, parent, 1, 1, inventory, inputSlots, outputSlots);
|
||||
|
|
|
@ -89,8 +89,9 @@ public class CableBlockEntity extends BlockEntity
|
|||
* This prevents double transfer rates, and back and forth between two cables.
|
||||
*/
|
||||
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;
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ import net.minecraft.util.math.Direction;
|
|||
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 {
|
||||
final CableBlockEntity sourceCable;
|
||||
|
|
|
@ -86,7 +86,8 @@ public class DataDrivenBEProvider extends BlockEntityType<DataDrivenBEProvider.D
|
|||
this.energy = JsonHelper.getInt(jsonObject, "energy");
|
||||
this.maxInput = JsonHelper.getInt(jsonObject, "maxInput");
|
||||
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
|
||||
|
|
|
@ -55,7 +55,7 @@ public record DataDrivenSlot(int id, int x, int y, @NotNull SlotType type) {
|
|||
|
||||
@Environment(EnvType.CLIENT)
|
||||
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) {
|
||||
guiBase.drawOutputSlot(matrixStack, x(), y(), layer);
|
||||
} else {
|
||||
|
|
|
@ -30,7 +30,7 @@ import java.util.Arrays;
|
|||
import java.util.function.BiConsumer;
|
||||
|
||||
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) -> {
|
||||
builder.slot(slot.id(), slot.x(), slot.y());
|
||||
}),
|
||||
|
|
|
@ -37,6 +37,7 @@ import reborncore.api.IToolDrop;
|
|||
import reborncore.api.blockentity.InventoryProvider;
|
||||
import reborncore.common.blockentity.MachineBaseBlockEntity;
|
||||
import reborncore.common.blocks.BlockMachineBase;
|
||||
import reborncore.common.fluid.FluidUtils;
|
||||
import reborncore.common.fluid.FluidValue;
|
||||
import reborncore.common.powerSystem.PowerAcceptorBlockEntity;
|
||||
import reborncore.common.util.RebornInventory;
|
||||
|
@ -45,7 +46,6 @@ import techreborn.api.generator.EFluidGenerator;
|
|||
import techreborn.api.generator.FluidGeneratorRecipe;
|
||||
import techreborn.api.generator.FluidGeneratorRecipeList;
|
||||
import techreborn.api.generator.GeneratorRecipeHelper;
|
||||
import reborncore.common.fluid.FluidUtils;
|
||||
|
||||
public abstract class BaseFluidGeneratorBlockEntity extends PowerAcceptorBlockEntity implements IToolDrop, InventoryProvider {
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I
|
|||
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
|
||||
// a smooth transition to night production as sun rises/sets
|
||||
float multiplier;
|
||||
|
|
|
@ -63,7 +63,7 @@ public class SolidFuelGeneratorBlockEntity extends PowerAcceptorBlockEntity impl
|
|||
ItemStack burnItem;
|
||||
|
||||
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) {
|
||||
|
|
|
@ -46,7 +46,7 @@ import techreborn.init.TRContent;
|
|||
*/
|
||||
public class WaterMillBlockEntity extends PowerAcceptorBlockEntity implements IToolDrop {
|
||||
|
||||
int waterblocks = 0;
|
||||
int waterBlocks = 0;
|
||||
|
||||
public WaterMillBlockEntity(BlockPos pos, BlockState state) {
|
||||
super(TRBlockEntities.WATER_MILL, pos, state);
|
||||
|
@ -62,8 +62,8 @@ public class WaterMillBlockEntity extends PowerAcceptorBlockEntity implements IT
|
|||
if (world.getTime() % 20 == 0) {
|
||||
checkForWater();
|
||||
}
|
||||
if (waterblocks > 0) {
|
||||
addEnergyProbabilistic(waterblocks * TechRebornConfig.waterMillEnergyMultiplier);
|
||||
if (waterBlocks > 0) {
|
||||
addEnergyProbabilistic(waterBlocks * TechRebornConfig.waterMillEnergyMultiplier);
|
||||
world.setBlockState(pos, world.getBlockState(pos).with(BlockMachineBase.ACTIVE, true));
|
||||
} else {
|
||||
world.setBlockState(pos, world.getBlockState(pos).with(BlockMachineBase.ACTIVE, false));
|
||||
|
@ -71,10 +71,10 @@ public class WaterMillBlockEntity extends PowerAcceptorBlockEntity implements IT
|
|||
}
|
||||
|
||||
public void checkForWater() {
|
||||
waterblocks = 0;
|
||||
waterBlocks = 0;
|
||||
for (Direction facing : Direction.values()) {
|
||||
if (facing.getAxis().isHorizontal() && world.getBlockState(pos.offset(facing)).getBlock() == Blocks.WATER) {
|
||||
waterblocks++;
|
||||
waterBlocks++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ public class LampBlockEntity extends PowerAcceptorBlockEntity implements IToolDr
|
|||
return 32;
|
||||
}
|
||||
|
||||
//MachineBaseBlockEntity
|
||||
// MachineBaseBlockEntity
|
||||
@Override
|
||||
public Direction getFacing(){
|
||||
if (world == null){
|
||||
|
|
|
@ -26,6 +26,7 @@ package techreborn.blockentity.machine;
|
|||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -57,11 +58,11 @@ public abstract class GenericMachineBlockEntity extends PowerAcceptorBlockEntity
|
|||
public RecipeCrafter crafter;
|
||||
|
||||
/**
|
||||
* @param name String Name for a blockEntity. Do we need it at all?
|
||||
* @param maxInput int Maximum energy input, value in EU
|
||||
* @param maxEnergy int Maximum energy buffer, value in EU
|
||||
* @param toolDrop Block Block to drop with wrench
|
||||
* @param energySlot int Energy slot to use to charge machine from battery
|
||||
* @param name {@link String} Name for a {@link BlockEntity}. Do we need it at all?
|
||||
* @param maxInput {@code int} Maximum energy input, value in EU
|
||||
* @param maxEnergy {@code int} Maximum energy buffer, value in EU
|
||||
* @param toolDrop {@link Block} Block to drop with wrench
|
||||
* @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) {
|
||||
super(blockEntityType, pos, state);
|
||||
|
@ -76,8 +77,8 @@ public abstract class GenericMachineBlockEntity extends PowerAcceptorBlockEntity
|
|||
/**
|
||||
* Returns progress scaled to input value
|
||||
*
|
||||
* @param scale int Maximum value for progress
|
||||
* @return int Scale of progress
|
||||
* @param scale {@code int} Maximum value for progress
|
||||
* @return {@code int} Scale of progress
|
||||
*/
|
||||
public int getProgressScaled(int scale) {
|
||||
if (crafter != null && crafter.currentTickTime != 0 && crafter.currentNeededTicks != 0) {
|
||||
|
|
|
@ -75,8 +75,8 @@ public abstract class AbstractIronMachineBlockEntity extends MachineBaseBlockEnt
|
|||
* Returns the number of ticks that the supplied fuel item will keep the
|
||||
* furnace burning, or 0 if the item isn't fuel
|
||||
*
|
||||
* @param stack Itemstack of fuel
|
||||
* @return Integer Number of ticks
|
||||
* @param stack {@link ItemStack} stack of fuel
|
||||
* @return {@code int} Number of ticks
|
||||
*/
|
||||
private int getItemBurnTime(ItemStack stack) {
|
||||
if (stack.isEmpty()) {
|
||||
|
@ -88,8 +88,8 @@ public abstract class AbstractIronMachineBlockEntity extends MachineBaseBlockEnt
|
|||
/**
|
||||
* Returns remaining fraction of fuel burn time
|
||||
*
|
||||
* @param scale Scale to use for burn time
|
||||
* @return int scaled remaining fuel burn time
|
||||
* @param scale {@code int} Scale to use for burn time
|
||||
* @return {@code int} scaled remaining fuel burn time
|
||||
*/
|
||||
public int getBurnTimeRemainingScaled(int scale) {
|
||||
if (totalBurnTime == 0) {
|
||||
|
@ -102,8 +102,8 @@ public abstract class AbstractIronMachineBlockEntity extends MachineBaseBlockEnt
|
|||
/**
|
||||
* Returns crafting progress
|
||||
*
|
||||
* @param scale Scale to use for crafting progress
|
||||
* @return int Scaled crafting progress
|
||||
* @param scale {@code int} Scale to use for crafting progress
|
||||
* @return {@code int} Scaled crafting progress
|
||||
*/
|
||||
public int getProgressScaled(int scale) {
|
||||
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
|
||||
*
|
||||
* @return Boolean True if machine is burning
|
||||
* @return {@code boolean} True if machine is burning
|
||||
*/
|
||||
public boolean isBurning() {
|
||||
return burnTime > 0;
|
||||
|
@ -233,4 +233,4 @@ public abstract class AbstractIronMachineBlockEntity extends MachineBaseBlockEnt
|
|||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,8 +57,8 @@ public class IronAlloyFurnaceBlockEntity extends AbstractIronMachineBlockEntity
|
|||
}
|
||||
for (RebornIngredient ingredient : recipeType.getRebornIngredients()) {
|
||||
boolean hasItem = false;
|
||||
for (int inputslot = 0; inputslot < 2; inputslot++) {
|
||||
if (ingredient.test(inventory.getStack(inputslot))) {
|
||||
for (int inputSlot = 0; inputSlot < 2; inputSlot++) {
|
||||
if (ingredient.test(inventory.getStack(inputSlot))) {
|
||||
hasItem = true;
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue