Added spotless back and reformatted
This commit is contained in:
+4
-3
@@ -20,7 +20,7 @@ plugins {
|
||||
id 'java'
|
||||
id 'fabric-loom'
|
||||
id 'maven-publish'
|
||||
id "com.matthewprenger.cursegradle" version "1.4.0"
|
||||
id "com.diffplug.gradle.spotless" version "4.3.0"
|
||||
id "org.sonarqube" version "2.8"
|
||||
id "jacoco"
|
||||
}
|
||||
@@ -60,8 +60,7 @@ group = artifact_group
|
||||
archivesBaseName = artifact_basename
|
||||
|
||||
sourceSets {
|
||||
api {
|
||||
}
|
||||
api
|
||||
main {
|
||||
compileClasspath += sourceSets.api.output
|
||||
runtimeClasspath += sourceSets.api.output
|
||||
@@ -94,6 +93,8 @@ configurations {
|
||||
unportedCompile.extendsFrom(compileClasspath)
|
||||
}
|
||||
|
||||
apply from: 'gradle/scripts/spotless.gradle'
|
||||
|
||||
minecraft {
|
||||
accessWidener "src/main/resources/appliedenergistics2.accesswidener"
|
||||
}
|
||||
|
||||
@@ -45,23 +45,25 @@ public interface ICellModelRegistry {
|
||||
* the game. See
|
||||
* {@see net.minecraftforge.client.model.ModelLoader#addSpecialModel}.
|
||||
*
|
||||
* This method only maps an {@link Item} to a {@link Identifier} which can
|
||||
* be looked up from the {@link net.minecraft.client.render.model.BakedModelManager}. No validation about missing models
|
||||
* will be done.
|
||||
* This method only maps an {@link Item} to a {@link Identifier} which can be
|
||||
* looked up from the
|
||||
* {@link net.minecraft.client.render.model.BakedModelManager}. No validation
|
||||
* about missing models will be done.
|
||||
*
|
||||
* Will throw an exception in case a model is already registered for an item.
|
||||
*
|
||||
* For examples look at our cell part models within the drive model directory.
|
||||
*
|
||||
* @param item The cell item
|
||||
* @param model The {@link net.minecraft.util.Identifier} representing the model.
|
||||
* @param model The {@link net.minecraft.util.Identifier} representing the
|
||||
* model.
|
||||
* @return
|
||||
*/
|
||||
void registerModel(@Nonnull Item item, @Nonnull Identifier model);
|
||||
|
||||
/**
|
||||
* The {@link Identifier} of the model used to render the given storage
|
||||
* cell {@link Item} when inserted into a drive or similar.
|
||||
* The {@link Identifier} of the model used to render the given storage cell
|
||||
* {@link Item} when inserted into a drive or similar.
|
||||
*
|
||||
* @param item
|
||||
* @return null, if no model is registered.
|
||||
|
||||
@@ -75,7 +75,6 @@ public enum SecurityPermissions {
|
||||
return this.translationKey + ".tip";
|
||||
}
|
||||
|
||||
|
||||
public Text tooltipText() {
|
||||
return new TranslatableText(getTranslatedTip());
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ public interface ICraftingHelper {
|
||||
* equivalent items to craft this recipe.
|
||||
*/
|
||||
ItemStack encodeCraftingPattern(@Nullable ItemStack stack, CraftingRecipe recipe, ItemStack[] in, ItemStack out,
|
||||
boolean allowSubstitutes);
|
||||
boolean allowSubstitutes);
|
||||
|
||||
/**
|
||||
* Same as {@link #decodePattern(ItemStack, World, boolean)} with no auto
|
||||
|
||||
@@ -29,8 +29,8 @@ import java.util.Set;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemConvertible;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.features.AEFeature;
|
||||
|
||||
|
||||
@@ -23,10 +23,11 @@
|
||||
|
||||
package appeng.api.events;
|
||||
|
||||
import appeng.api.features.ILocatable;
|
||||
import net.fabricmc.fabric.api.event.Event;
|
||||
import net.fabricmc.fabric.api.event.EventFactory;
|
||||
|
||||
import appeng.api.features.ILocatable;
|
||||
|
||||
/**
|
||||
* Input Event:
|
||||
* <p>
|
||||
@@ -34,11 +35,12 @@ import net.fabricmc.fabric.api.event.EventFactory;
|
||||
*/
|
||||
public interface LocatableEventAnnounce {
|
||||
|
||||
Event<LocatableEventAnnounce> EVENT = EventFactory.createArrayBacked(LocatableEventAnnounce.class, listeners -> (ILocatable target, LocatableEvent change) -> {
|
||||
for (LocatableEventAnnounce listener : listeners) {
|
||||
listener.onLocatableAnnounce(target, change);
|
||||
}
|
||||
});
|
||||
Event<LocatableEventAnnounce> EVENT = EventFactory.createArrayBacked(LocatableEventAnnounce.class,
|
||||
listeners -> (ILocatable target, LocatableEvent change) -> {
|
||||
for (LocatableEventAnnounce listener : listeners) {
|
||||
listener.onLocatableAnnounce(target, change);
|
||||
}
|
||||
});
|
||||
|
||||
void onLocatableAnnounce(final ILocatable target, final LocatableEvent change);
|
||||
|
||||
|
||||
@@ -26,9 +26,10 @@ package appeng.api.features;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import alexiil.mc.lib.attributes.Attribute;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import alexiil.mc.lib.attributes.Attribute;
|
||||
|
||||
import appeng.api.config.TunnelType;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
package appeng.api.parts;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.fabricmc.fabric.api.renderer.v1.render.RenderContext;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.render.model.BakedModel;
|
||||
@@ -12,33 +18,32 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.BlockRenderView;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Supplier;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
|
||||
/**
|
||||
* This interface can be implemented by baked models returned by {@link IPart#getStaticModels()} to indicate that
|
||||
* they would like to use the model data returned by {@link IPart#getModelData()}.
|
||||
* This interface can be implemented by baked models returned by
|
||||
* {@link IPart#getStaticModels()} to indicate that they would like to use the
|
||||
* model data returned by {@link IPart#getModelData()}.
|
||||
*/
|
||||
public interface IDynamicPartBakedModel extends BakedModel {
|
||||
|
||||
/**
|
||||
* See {@link net.fabricmc.fabric.api.renderer.v1.model.FabricBakedModel#emitBlockQuads(BlockRenderView, BlockState, BlockPos, Supplier, RenderContext)}
|
||||
* See
|
||||
* {@link net.fabricmc.fabric.api.renderer.v1.model.FabricBakedModel#emitBlockQuads(BlockRenderView, BlockState, BlockPos, Supplier, RenderContext)}
|
||||
* for context.
|
||||
* <p>
|
||||
* The given <code>context</code> will already have been transformed so that the model renders from the
|
||||
* rotated location the part is attached to.
|
||||
* The given <code>context</code> will already have been transformed so that the
|
||||
* model renders from the rotated location the part is attached to.
|
||||
*
|
||||
* @param partSide The side of the cable bus that the part is attached to.
|
||||
* @param partSide The side of the cable bus that the part is attached to.
|
||||
* @param modelData The model data returned by {@link IPart#getModelData()}
|
||||
*/
|
||||
void emitQuads(BlockRenderView blockView, BlockState state, BlockPos pos, Supplier<Random> randomSupplier, RenderContext context,
|
||||
Direction partSide, @Nullable Object modelData);
|
||||
void emitQuads(BlockRenderView blockView, BlockState state, BlockPos pos, Supplier<Random> randomSupplier,
|
||||
RenderContext context, Direction partSide, @Nullable Object modelData);
|
||||
|
||||
/**
|
||||
* Unless you use your dynamic model for other purposes, this method will not be called.
|
||||
* Unless you use your dynamic model for other purposes, this method will not be
|
||||
* called.
|
||||
*/
|
||||
@Override
|
||||
default List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction face, Random random) {
|
||||
|
||||
@@ -23,11 +23,13 @@
|
||||
|
||||
package appeng.api.parts;
|
||||
|
||||
import alexiil.mc.lib.attributes.AttributeList;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
@@ -46,11 +48,12 @@ import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import alexiil.mc.lib.attributes.AttributeList;
|
||||
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
|
||||
public interface IPart extends ICustomCableConnection {
|
||||
|
||||
@@ -343,14 +346,14 @@ public interface IPart extends ICustomCableConnection {
|
||||
*
|
||||
* @see alexiil.mc.lib.attributes.AttributeProvider
|
||||
*/
|
||||
default void addAllAttributes(AttributeList<?> to) {}
|
||||
|
||||
default void addAllAttributes(AttributeList<?> to) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Additional rendering data to be passed to the models for rendering this part.
|
||||
*
|
||||
* @return The rendering data to pass to the model. Only useful if custom models are
|
||||
* used. Can be null to not pass anything.
|
||||
* @return The rendering data to pass to the model. Only useful if custom models
|
||||
* are used. Can be null to not pass anything.
|
||||
*/
|
||||
@Nullable
|
||||
default Object getModelData() {
|
||||
|
||||
@@ -26,9 +26,9 @@ package appeng.api.parts;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IPartHelper {
|
||||
|
||||
@@ -25,16 +25,16 @@ package appeng.api.parts;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
/**
|
||||
* Implemented on AE's TileEntity.
|
||||
@@ -115,8 +115,8 @@ public interface IPartHost extends ICustomCableConnection {
|
||||
DimensionalCoord getLocation();
|
||||
|
||||
/**
|
||||
* @return the block entity for the host, this can either be an FMP tile, or a AE
|
||||
* tile
|
||||
* @return the block entity for the host, this can either be an FMP tile, or a
|
||||
* AE tile
|
||||
*/
|
||||
BlockEntity getTile();
|
||||
|
||||
|
||||
@@ -31,8 +31,8 @@ import javax.annotation.Nonnull;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
/**
|
||||
* A container to store a collection of {@link Identifier} as models for a
|
||||
* part as well as other properties.
|
||||
* A container to store a collection of {@link Identifier} as models for a part
|
||||
* as well as other properties.
|
||||
*/
|
||||
public interface IPartModel {
|
||||
|
||||
|
||||
@@ -22,12 +22,12 @@ import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.registry.RegistryKey;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
|
||||
public interface ISpatialDimension {
|
||||
ServerWorld getWorld(RegistryKey<World> cellDim);
|
||||
|
||||
@@ -115,11 +115,11 @@ public interface IStorageHelper {
|
||||
/**
|
||||
* Inserts items into a {@link IMEInventory} respecting power requirements.
|
||||
*
|
||||
* @param energy Energy source.
|
||||
* @param inv Inventory to insert into.
|
||||
* @param input Items to insert.
|
||||
* @param src Action source.
|
||||
* @param mode Simulate or modulate
|
||||
* @param energy Energy source.
|
||||
* @param inv Inventory to insert into.
|
||||
* @param input Items to insert.
|
||||
* @param src Action source.
|
||||
* @param mode Simulate or modulate
|
||||
* @return items not inserted or {@code null} if everything was inserted.
|
||||
*/
|
||||
<T extends IAEStack<T>> T poweredInsert(final IEnergySource energy, final IMEInventory<T> inv, final T input,
|
||||
|
||||
@@ -23,9 +23,10 @@
|
||||
|
||||
package appeng.api.storage.cells;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
|
||||
@@ -23,9 +23,10 @@
|
||||
|
||||
package appeng.api.storage.cells;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
|
||||
import appeng.api.config.FuzzyMode;
|
||||
|
||||
public interface ICellWorkbenchItem {
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
package appeng.data;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Collections;
|
||||
|
||||
import net.fabricmc.loader.api.entrypoint.PreLaunchEntrypoint;
|
||||
import net.minecraft.Bootstrap;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.CreativeTab;
|
||||
import appeng.data.providers.loot.BlockDropProvider;
|
||||
import appeng.data.providers.recipes.SlabStairRecipes;
|
||||
import appeng.data.providers.tags.ConventionTagProvider;
|
||||
import net.fabricmc.loader.api.entrypoint.PreLaunchEntrypoint;
|
||||
import net.minecraft.Bootstrap;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Collections;
|
||||
|
||||
public class Entrypoint implements PreLaunchEntrypoint {
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import java.util.function.Function;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import appeng.data.providers.IAE2DataProvider;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
@@ -26,11 +25,12 @@ import net.minecraft.loot.entry.LeafEntry;
|
||||
import net.minecraft.loot.function.ApplyBonusLootFunction;
|
||||
import net.minecraft.loot.function.SetCountLootFunction;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.registry.RegistryKey;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
import appeng.data.providers.IAE2DataProvider;
|
||||
|
||||
public class BlockDropProvider extends BlockLootTableGenerator implements IAE2DataProvider {
|
||||
|
||||
private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();
|
||||
@@ -40,17 +40,15 @@ public class BlockDropProvider extends BlockLootTableGenerator implements IAE2Da
|
||||
private Map<Block, Function<Block, LootTable.Builder>> overrides = ImmutableMap.<Block, Function<Block, LootTable.Builder>>builder()
|
||||
.put(BLOCKS.matrixFrame().block(), $ -> LootTable.builder())
|
||||
.put(BLOCKS.quartzOre().block(),
|
||||
b -> dropsWithSilkTouch(BLOCKS.quartzOre().block(),
|
||||
applyExplosionDecay(BLOCKS.quartzOre().block(),
|
||||
ItemEntry.builder(MATERIALS.certusQuartzCrystal().item())
|
||||
.apply(SetCountLootFunction.builder(UniformLootTableRange.between(1.0F, 2.0F)))
|
||||
.apply(ApplyBonusLootFunction.uniformBonusCount(Enchantments.FORTUNE)))))
|
||||
.put(BLOCKS.quartzOreCharged().block(),
|
||||
b -> dropsWithSilkTouch(BLOCKS.quartzOreCharged().block(),
|
||||
applyExplosionDecay(BLOCKS.quartzOreCharged().block(),
|
||||
ItemEntry.builder(MATERIALS.certusQuartzCrystalCharged().item())
|
||||
.apply(SetCountLootFunction.builder(UniformLootTableRange.between(1.0F, 2.0F)))
|
||||
.apply(ApplyBonusLootFunction.uniformBonusCount(Enchantments.FORTUNE)))))
|
||||
b -> dropsWithSilkTouch(BLOCKS.quartzOre().block(), applyExplosionDecay(BLOCKS.quartzOre().block(),
|
||||
ItemEntry.builder(MATERIALS.certusQuartzCrystal().item())
|
||||
.apply(SetCountLootFunction.builder(UniformLootTableRange.between(1.0F, 2.0F)))
|
||||
.apply(ApplyBonusLootFunction.uniformBonusCount(Enchantments.FORTUNE)))))
|
||||
.put(BLOCKS.quartzOreCharged().block(), b -> dropsWithSilkTouch(BLOCKS.quartzOreCharged().block(),
|
||||
applyExplosionDecay(BLOCKS.quartzOreCharged().block(),
|
||||
ItemEntry.builder(MATERIALS.certusQuartzCrystalCharged().item())
|
||||
.apply(SetCountLootFunction.builder(UniformLootTableRange.between(1.0F, 2.0F)))
|
||||
.apply(ApplyBonusLootFunction.uniformBonusCount(Enchantments.FORTUNE)))))
|
||||
.build();
|
||||
|
||||
public BlockDropProvider(Path outputFolder) {
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
package appeng.data.providers.recipes;
|
||||
|
||||
import appeng.api.definitions.IBlockDefinition;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.data.providers.IAE2DataProvider;
|
||||
import static net.minecraft.data.server.RecipesProvider.conditionsFromItem;
|
||||
import static net.minecraft.data.server.RecipesProvider.saveRecipe;
|
||||
import static net.minecraft.data.server.RecipesProvider.saveRecipeAdvancement;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.data.DataCache;
|
||||
import net.minecraft.data.server.recipe.RecipeJsonProvider;
|
||||
@@ -12,23 +17,20 @@ import net.minecraft.data.server.recipe.SingleItemRecipeJsonFactory;
|
||||
import net.minecraft.recipe.Ingredient;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import static net.minecraft.data.server.RecipesProvider.conditionsFromItem;
|
||||
import static net.minecraft.data.server.RecipesProvider.saveRecipe;
|
||||
import static net.minecraft.data.server.RecipesProvider.saveRecipeAdvancement;
|
||||
import appeng.api.definitions.IBlockDefinition;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.data.providers.IAE2DataProvider;
|
||||
|
||||
public class SlabStairRecipes implements IAE2DataProvider {
|
||||
|
||||
IBlockDefinition[][] blocks = {{BLOCKS.skyStoneBlock(), BLOCKS.skyStoneSlab(), BLOCKS.skyStoneStairs()},
|
||||
{BLOCKS.smoothSkyStoneBlock(), BLOCKS.smoothSkyStoneSlab(), BLOCKS.smoothSkyStoneStairs()},
|
||||
{BLOCKS.skyStoneBrick(), BLOCKS.skyStoneBrickSlab(), BLOCKS.skyStoneBrickStairs()},
|
||||
{BLOCKS.skyStoneSmallBrick(), BLOCKS.skyStoneSmallBrickSlab(), BLOCKS.skyStoneSmallBrickStairs()},
|
||||
{BLOCKS.fluixBlock(), BLOCKS.fluixSlab(), BLOCKS.fluixStairs()},
|
||||
{BLOCKS.quartzBlock(), BLOCKS.quartzSlab(), BLOCKS.quartzStairs()},
|
||||
{BLOCKS.chiseledQuartzBlock(), BLOCKS.chiseledQuartzSlab(), BLOCKS.chiseledQuartzStairs()},
|
||||
{BLOCKS.quartzPillar(), BLOCKS.quartzPillarSlab(), BLOCKS.quartzPillarStairs()},};
|
||||
IBlockDefinition[][] blocks = { { BLOCKS.skyStoneBlock(), BLOCKS.skyStoneSlab(), BLOCKS.skyStoneStairs() },
|
||||
{ BLOCKS.smoothSkyStoneBlock(), BLOCKS.smoothSkyStoneSlab(), BLOCKS.smoothSkyStoneStairs() },
|
||||
{ BLOCKS.skyStoneBrick(), BLOCKS.skyStoneBrickSlab(), BLOCKS.skyStoneBrickStairs() },
|
||||
{ BLOCKS.skyStoneSmallBrick(), BLOCKS.skyStoneSmallBrickSlab(), BLOCKS.skyStoneSmallBrickStairs() },
|
||||
{ BLOCKS.fluixBlock(), BLOCKS.fluixSlab(), BLOCKS.fluixStairs() },
|
||||
{ BLOCKS.quartzBlock(), BLOCKS.quartzSlab(), BLOCKS.quartzStairs() },
|
||||
{ BLOCKS.chiseledQuartzBlock(), BLOCKS.chiseledQuartzSlab(), BLOCKS.chiseledQuartzStairs() },
|
||||
{ BLOCKS.quartzPillar(), BLOCKS.quartzPillarSlab(), BLOCKS.quartzPillarStairs() }, };
|
||||
|
||||
private final Path outputPath;
|
||||
|
||||
@@ -77,10 +79,14 @@ public class SlabStairRecipes implements IAE2DataProvider {
|
||||
}
|
||||
|
||||
private void provideRecipe(RecipeJsonProvider recipeJsonProvider) {
|
||||
saveRecipe(cache, recipeJsonProvider.toJson(), outputPath.resolve("data/" + recipeJsonProvider.getRecipeId().getNamespace() + "/recipes/" + recipeJsonProvider.getRecipeId().getPath() + ".json"));
|
||||
saveRecipe(cache, recipeJsonProvider.toJson(),
|
||||
outputPath.resolve("data/" + recipeJsonProvider.getRecipeId().getNamespace() + "/recipes/"
|
||||
+ recipeJsonProvider.getRecipeId().getPath() + ".json"));
|
||||
JsonObject jsonObject = recipeJsonProvider.toAdvancementJson();
|
||||
if (jsonObject != null) {
|
||||
saveRecipeAdvancement(cache, jsonObject, outputPath.resolve("data/" + recipeJsonProvider.getRecipeId().getNamespace() + "/advancements/" + recipeJsonProvider.getAdvancementId().getPath() + ".json"));
|
||||
saveRecipeAdvancement(cache, jsonObject,
|
||||
outputPath.resolve("data/" + recipeJsonProvider.getRecipeId().getNamespace() + "/advancements/"
|
||||
+ recipeJsonProvider.getAdvancementId().getPath() + ".json"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package appeng.data.providers.tags;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.Items;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.Items;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
|
||||
public class ConventionTagProvider extends TagProvider {
|
||||
|
||||
public ConventionTagProvider(Path outputPath) {
|
||||
@@ -47,61 +48,24 @@ public class ConventionTagProvider extends TagProvider {
|
||||
addItemTag("wheat_crops", Items.WHEAT);
|
||||
addItemTag("redstone_dusts", Items.REDSTONE);
|
||||
addItemTag("ender_pearls", Items.ENDER_PEARL);
|
||||
addItemTag("terracotta_blocks", Items.TERRACOTTA,
|
||||
Items.WHITE_TERRACOTTA,
|
||||
Items.ORANGE_TERRACOTTA,
|
||||
Items.MAGENTA_TERRACOTTA,
|
||||
Items.LIGHT_BLUE_TERRACOTTA,
|
||||
Items.YELLOW_TERRACOTTA,
|
||||
Items.LIME_TERRACOTTA,
|
||||
Items.PINK_TERRACOTTA,
|
||||
Items.GRAY_TERRACOTTA,
|
||||
Items.LIGHT_GRAY_TERRACOTTA,
|
||||
Items.CYAN_TERRACOTTA,
|
||||
Items.PURPLE_TERRACOTTA,
|
||||
Items.BLUE_TERRACOTTA,
|
||||
Items.BROWN_TERRACOTTA,
|
||||
Items.GREEN_TERRACOTTA,
|
||||
Items.RED_TERRACOTTA,
|
||||
Items.BLACK_TERRACOTTA
|
||||
);
|
||||
addItemTag("glass_blocks", Items.GLASS,
|
||||
Items.WHITE_STAINED_GLASS,
|
||||
Items.ORANGE_STAINED_GLASS,
|
||||
Items.MAGENTA_STAINED_GLASS,
|
||||
Items.LIGHT_BLUE_STAINED_GLASS,
|
||||
Items.YELLOW_STAINED_GLASS,
|
||||
Items.LIME_STAINED_GLASS,
|
||||
Items.PINK_STAINED_GLASS,
|
||||
Items.GRAY_STAINED_GLASS,
|
||||
Items.LIGHT_GRAY_STAINED_GLASS,
|
||||
Items.CYAN_STAINED_GLASS,
|
||||
Items.PURPLE_STAINED_GLASS,
|
||||
Items.BLUE_STAINED_GLASS,
|
||||
Items.BROWN_STAINED_GLASS,
|
||||
Items.GREEN_STAINED_GLASS,
|
||||
Items.RED_STAINED_GLASS,
|
||||
Items.BLACK_STAINED_GLASS
|
||||
);
|
||||
addItemTag("terracotta_blocks", Items.TERRACOTTA, Items.WHITE_TERRACOTTA, Items.ORANGE_TERRACOTTA,
|
||||
Items.MAGENTA_TERRACOTTA, Items.LIGHT_BLUE_TERRACOTTA, Items.YELLOW_TERRACOTTA, Items.LIME_TERRACOTTA,
|
||||
Items.PINK_TERRACOTTA, Items.GRAY_TERRACOTTA, Items.LIGHT_GRAY_TERRACOTTA, Items.CYAN_TERRACOTTA,
|
||||
Items.PURPLE_TERRACOTTA, Items.BLUE_TERRACOTTA, Items.BROWN_TERRACOTTA, Items.GREEN_TERRACOTTA,
|
||||
Items.RED_TERRACOTTA, Items.BLACK_TERRACOTTA);
|
||||
addItemTag("glass_blocks", Items.GLASS, Items.WHITE_STAINED_GLASS, Items.ORANGE_STAINED_GLASS,
|
||||
Items.MAGENTA_STAINED_GLASS, Items.LIGHT_BLUE_STAINED_GLASS, Items.YELLOW_STAINED_GLASS,
|
||||
Items.LIME_STAINED_GLASS, Items.PINK_STAINED_GLASS, Items.GRAY_STAINED_GLASS,
|
||||
Items.LIGHT_GRAY_STAINED_GLASS, Items.CYAN_STAINED_GLASS, Items.PURPLE_STAINED_GLASS,
|
||||
Items.BLUE_STAINED_GLASS, Items.BROWN_STAINED_GLASS, Items.GREEN_STAINED_GLASS, Items.RED_STAINED_GLASS,
|
||||
Items.BLACK_STAINED_GLASS);
|
||||
|
||||
addBlockTag("glass_blocks", Blocks.GLASS,
|
||||
Blocks.WHITE_STAINED_GLASS,
|
||||
Blocks.ORANGE_STAINED_GLASS,
|
||||
Blocks.MAGENTA_STAINED_GLASS,
|
||||
Blocks.LIGHT_BLUE_STAINED_GLASS,
|
||||
Blocks.YELLOW_STAINED_GLASS,
|
||||
Blocks.LIME_STAINED_GLASS,
|
||||
Blocks.PINK_STAINED_GLASS,
|
||||
Blocks.GRAY_STAINED_GLASS,
|
||||
Blocks.LIGHT_GRAY_STAINED_GLASS,
|
||||
Blocks.CYAN_STAINED_GLASS,
|
||||
Blocks.PURPLE_STAINED_GLASS,
|
||||
Blocks.BLUE_STAINED_GLASS,
|
||||
Blocks.BROWN_STAINED_GLASS,
|
||||
Blocks.GREEN_STAINED_GLASS,
|
||||
Blocks.RED_STAINED_GLASS,
|
||||
Blocks.BLACK_STAINED_GLASS
|
||||
);
|
||||
addBlockTag("glass_blocks", Blocks.GLASS, Blocks.WHITE_STAINED_GLASS, Blocks.ORANGE_STAINED_GLASS,
|
||||
Blocks.MAGENTA_STAINED_GLASS, Blocks.LIGHT_BLUE_STAINED_GLASS, Blocks.YELLOW_STAINED_GLASS,
|
||||
Blocks.LIME_STAINED_GLASS, Blocks.PINK_STAINED_GLASS, Blocks.GRAY_STAINED_GLASS,
|
||||
Blocks.LIGHT_GRAY_STAINED_GLASS, Blocks.CYAN_STAINED_GLASS, Blocks.PURPLE_STAINED_GLASS,
|
||||
Blocks.BLUE_STAINED_GLASS, Blocks.BROWN_STAINED_GLASS, Blocks.GREEN_STAINED_GLASS,
|
||||
Blocks.RED_STAINED_GLASS, Blocks.BLACK_STAINED_GLASS);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
package appeng.data.providers.tags;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
import appeng.data.providers.IAE2DataProvider;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.data.DataCache;
|
||||
import net.minecraft.data.DataProvider;
|
||||
@@ -13,11 +18,8 @@ import net.minecraft.item.ItemConvertible;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.data.providers.IAE2DataProvider;
|
||||
|
||||
public abstract class TagProvider implements IAE2DataProvider {
|
||||
|
||||
@@ -47,23 +49,19 @@ public abstract class TagProvider implements IAE2DataProvider {
|
||||
protected abstract void generate() throws IOException;
|
||||
|
||||
protected void addItemTag(String name, ItemConvertible... items) throws IOException {
|
||||
List<String> itemIds = Arrays.stream(items)
|
||||
.map(ItemConvertible::asItem)
|
||||
.map(Registry.ITEM::getId)
|
||||
.map(Identifier::toString)
|
||||
.collect(Collectors.toList());
|
||||
List<String> itemIds = Arrays.stream(items).map(ItemConvertible::asItem).map(Registry.ITEM::getId)
|
||||
.map(Identifier::toString).collect(Collectors.toList());
|
||||
writeTagFile(CONVENTION_NAMESPACE, TYPE_ITEMS, name, itemIds);
|
||||
}
|
||||
|
||||
protected void addBlockTag(String name, Block... blocks) throws IOException {
|
||||
List<String> itemIds = Arrays.stream(blocks)
|
||||
.map(Registry.BLOCK::getId)
|
||||
.map(Identifier::toString)
|
||||
List<String> itemIds = Arrays.stream(blocks).map(Registry.BLOCK::getId).map(Identifier::toString)
|
||||
.collect(Collectors.toList());
|
||||
writeTagFile(CONVENTION_NAMESPACE, TYPE_BLOCKS, name, itemIds);
|
||||
}
|
||||
|
||||
protected void writeTagFile(String namespace, String tagType, String tagName, List<String> entries) throws IOException {
|
||||
protected void writeTagFile(String namespace, String tagType, String tagName, List<String> entries)
|
||||
throws IOException {
|
||||
JsonObject rootObj = new JsonObject();
|
||||
JsonArray valuesArr = new JsonArray();
|
||||
for (String entry : entries) {
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
"version": "1.0.0",
|
||||
"name": "Applied Energistics 2 Datagen",
|
||||
"description": "",
|
||||
"authors": [
|
||||
"TeamAppliedEnergistics"
|
||||
],
|
||||
"authors": ["TeamAppliedEnergistics"],
|
||||
"contact": {
|
||||
"homepage": "https://ae-mod.info/",
|
||||
"sources": "https://github.com/AppliedEnergistics/Applied-Energistics-2/"
|
||||
@@ -17,9 +15,7 @@
|
||||
|
||||
"environment": "*",
|
||||
"entrypoints": {
|
||||
"preLaunch": [
|
||||
"appeng.data.Entrypoint"
|
||||
]
|
||||
"preLaunch": ["appeng.data.Entrypoint"]
|
||||
},
|
||||
"depends": {
|
||||
"fabricloader": ">=0.7.1",
|
||||
|
||||
@@ -18,17 +18,19 @@
|
||||
|
||||
package appeng.attributes;
|
||||
|
||||
import alexiil.mc.lib.attributes.Attribute;
|
||||
import alexiil.mc.lib.attributes.Attributes;
|
||||
import alexiil.mc.lib.attributes.SearchOptions;
|
||||
import appeng.api.storage.IStorageMonitorableAccessor;
|
||||
import appeng.parts.AEBasePart;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import alexiil.mc.lib.attributes.Attribute;
|
||||
import alexiil.mc.lib.attributes.Attributes;
|
||||
import alexiil.mc.lib.attributes.SearchOptions;
|
||||
|
||||
import appeng.api.storage.IStorageMonitorableAccessor;
|
||||
import appeng.parts.AEBasePart;
|
||||
|
||||
/**
|
||||
* Utility class that holds various attributes, both by AE2 and other Mods.
|
||||
*/
|
||||
@@ -37,8 +39,8 @@ public final class MEAttributes {
|
||||
private MEAttributes() {
|
||||
}
|
||||
|
||||
public static Attribute<IStorageMonitorableAccessor> STORAGE_MONITORABLE_ACCESSOR
|
||||
= Attributes.createDefaulted(IStorageMonitorableAccessor.class, new NullMENetworkAccessor());
|
||||
public static Attribute<IStorageMonitorableAccessor> STORAGE_MONITORABLE_ACCESSOR = Attributes
|
||||
.createDefaulted(IStorageMonitorableAccessor.class, new NullMENetworkAccessor());
|
||||
|
||||
public static <T> T getFirstAttributeOnSide(Attribute<T> attribute, BlockEntity be, Direction side) {
|
||||
World world = be.getWorld();
|
||||
@@ -49,7 +51,8 @@ public final class MEAttributes {
|
||||
return attribute.getFirstOrNull(world, be.getPos().offset(side), SearchOptions.inDirection(side.getOpposite()));
|
||||
}
|
||||
|
||||
// Convenience function to get an attribute of the block that is in front of a part
|
||||
// Convenience function to get an attribute of the block that is in front of a
|
||||
// part
|
||||
public static <T> T getAttributeInFrontOfPart(Attribute<T> attribute, AEBasePart part) {
|
||||
BlockEntity self = part.getHost().getTile();
|
||||
Direction direction = part.getSide().getFacing();
|
||||
|
||||
@@ -21,24 +21,24 @@ package appeng.block;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.block.MaterialColor;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.WorldAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
|
||||
import net.minecraft.world.WorldAccess;
|
||||
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
@@ -68,8 +68,7 @@ public abstract class AEBaseBlock extends Block {
|
||||
public static FabricBlockSettings defaultProps(Material material, MaterialColor color) {
|
||||
return FabricBlockSettings.of(material, color)
|
||||
// These values previousls were encoded in AEBaseBlock
|
||||
.strength(2.2f, 11.f)
|
||||
.breakByTool(FabricToolTags.PICKAXES, 0)
|
||||
.strength(2.2f, 11.f).breakByTool(FabricToolTags.PICKAXES, 0)
|
||||
.sounds(getDefaultSoundByMaterial(material));
|
||||
}
|
||||
|
||||
|
||||
@@ -20,24 +20,24 @@ package appeng.block;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import appeng.block.networking.WirelessBlock;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.item.TooltipContext;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.ItemPlacementContext;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.world.World;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
import appeng.block.misc.LightDetectorBlock;
|
||||
import appeng.block.misc.SkyCompassBlock;
|
||||
import appeng.block.networking.WirelessBlock;
|
||||
import appeng.me.helpers.IGridProxyable;
|
||||
import appeng.tile.AEBaseBlockEntity;
|
||||
|
||||
|
||||
@@ -18,14 +18,9 @@
|
||||
|
||||
package appeng.block;
|
||||
|
||||
import appeng.core.Api;
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.PowerUnits;
|
||||
import appeng.api.definitions.IBlockDefinition;
|
||||
import appeng.api.implementations.items.IAEItemPowerStorage;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.localization.GuiText;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.List;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.client.model.FabricModelPredicateProviderRegistry;
|
||||
@@ -38,24 +33,27 @@ import net.minecraft.text.TranslatableText;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.List;
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.PowerUnits;
|
||||
import appeng.api.definitions.IBlockDefinition;
|
||||
import appeng.api.implementations.items.IAEItemPowerStorage;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.localization.GuiText;
|
||||
|
||||
public class AEBaseBlockItemChargeable extends AEBaseBlockItem implements IAEItemPowerStorage {
|
||||
|
||||
public AEBaseBlockItemChargeable(Block id, Settings props) {
|
||||
super(id, props);
|
||||
|
||||
FabricModelPredicateProviderRegistry.register(
|
||||
this,
|
||||
new Identifier(AppEng.MOD_ID, "fill_level"),
|
||||
FabricModelPredicateProviderRegistry.register(this, new Identifier(AppEng.MOD_ID, "fill_level"),
|
||||
(is, world, entity) -> {
|
||||
double curPower = getAECurrentPower(is);
|
||||
double maxPower = getAEMaxPower(is);
|
||||
|
||||
return (int) Math.round(100 * curPower / maxPower);
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -73,8 +71,7 @@ public class AEBaseBlockItemChargeable extends AEBaseBlockItem implements IAEIte
|
||||
|
||||
final double percent = internalCurrentPower / internalMaxPower;
|
||||
|
||||
lines.add(GuiText.StoredEnergy.text()
|
||||
.copy()
|
||||
lines.add(GuiText.StoredEnergy.text().copy()
|
||||
.append(':' + MessageFormat.format(" {0,number,#} ", internalCurrentPower))
|
||||
.append(new TranslatableText(PowerUnits.AE.unlocalizedName))
|
||||
.append(" - " + MessageFormat.format("{0,number,#.##%}", percent)));
|
||||
|
||||
@@ -25,11 +25,6 @@ import java.util.function.Supplier;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import alexiil.mc.lib.attributes.AttributeList;
|
||||
import alexiil.mc.lib.attributes.AttributeProvider;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
import appeng.block.networking.CableBusBlock;
|
||||
import appeng.tile.networking.CableBusBlockEntity;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerChunkEvents;
|
||||
@@ -39,28 +34,35 @@ import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import alexiil.mc.lib.attributes.AttributeList;
|
||||
import alexiil.mc.lib.attributes.AttributeProvider;
|
||||
import alexiil.mc.lib.attributes.item.FixedItemInv;
|
||||
|
||||
import appeng.api.implementations.items.IMemoryCard;
|
||||
import appeng.api.implementations.items.MemoryCardMessages;
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.tile.AEBaseInvBlockEntity;
|
||||
import appeng.block.networking.CableBusBlock;
|
||||
import appeng.tile.AEBaseBlockEntity;
|
||||
import appeng.tile.AEBaseInvBlockEntity;
|
||||
import appeng.tile.networking.CableBusBlockEntity;
|
||||
import appeng.tile.storage.SkyChestBlockEntity;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.SettingsFrom;
|
||||
|
||||
public abstract class AEBaseTileBlock<T extends AEBaseBlockEntity> extends AEBaseBlock implements BlockEntityProvider, AttributeProvider {
|
||||
public abstract class AEBaseTileBlock<T extends AEBaseBlockEntity> extends AEBaseBlock
|
||||
implements BlockEntityProvider, AttributeProvider {
|
||||
|
||||
@Nonnull
|
||||
private Class<T> blockEntityClass;
|
||||
@@ -141,22 +143,21 @@ public abstract class AEBaseTileBlock<T extends AEBaseBlockEntity> extends AEBas
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate redstone output level.
|
||||
* 0 if completely empty, 1 if _any_ item is present, up to 15 if all slots are full.
|
||||
* Calculate redstone output level. 0 if completely empty, 1 if _any_ item is
|
||||
* present, up to 15 if all slots are full.
|
||||
*/
|
||||
private int getRedstoneFromFixedItemInv(FixedItemInv inv) {
|
||||
boolean foundAnything = false; // ANY slots non-empty?
|
||||
float fillRatio = 0;
|
||||
|
||||
for (int i = 0; i < inv.getSlotCount(); ++i)
|
||||
{
|
||||
for (int i = 0; i < inv.getSlotCount(); ++i) {
|
||||
ItemStack stack = inv.getInvStack(i);
|
||||
if (stack.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int slotMaxCount = inv.getMaxAmount(i, stack);
|
||||
fillRatio += stack.getCount() / (float)Math.min(slotMaxCount, stack.getMaxCount());
|
||||
fillRatio += stack.getCount() / (float) Math.min(slotMaxCount, stack.getMaxCount());
|
||||
foundAnything = true;
|
||||
}
|
||||
|
||||
@@ -192,8 +193,8 @@ public abstract class AEBaseTileBlock<T extends AEBaseBlockEntity> extends AEBas
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player,
|
||||
Hand hand, BlockHitResult hit) {
|
||||
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand,
|
||||
BlockHitResult hit) {
|
||||
ItemStack heldItem;
|
||||
if (player != null && !player.getStackInHand(hand).isEmpty()) {
|
||||
heldItem = player.getStackInHand(hand);
|
||||
@@ -271,7 +272,7 @@ public abstract class AEBaseTileBlock<T extends AEBaseBlockEntity> extends AEBas
|
||||
}
|
||||
|
||||
public ActionResult onActivated(final World w, final BlockPos pos, final PlayerEntity player, final Hand hand,
|
||||
final @Nullable ItemStack heldItem, final BlockHitResult hit) {
|
||||
final @Nullable ItemStack heldItem, final BlockHitResult hit) {
|
||||
return ActionResult.PASS;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,11 +18,6 @@
|
||||
|
||||
package appeng.block.crafting;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.container.ContainerLocator;
|
||||
import appeng.container.ContainerOpener;
|
||||
import appeng.container.implementations.CraftingCPUContainer;
|
||||
import appeng.tile.crafting.CraftingBlockEntity;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
@@ -34,6 +29,12 @@ import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.container.ContainerLocator;
|
||||
import appeng.container.ContainerOpener;
|
||||
import appeng.container.implementations.CraftingCPUContainer;
|
||||
import appeng.tile.crafting.CraftingBlockEntity;
|
||||
|
||||
public abstract class AbstractCraftingUnitBlock<T extends CraftingBlockEntity> extends AEBaseTileBlock<T> {
|
||||
public static final BooleanProperty FORMED = BooleanProperty.of("formed");
|
||||
public static final BooleanProperty POWERED = BooleanProperty.of("powered");
|
||||
@@ -77,8 +78,7 @@ public abstract class AbstractCraftingUnitBlock<T extends CraftingBlockEntity> e
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult onUse(BlockState state, World w, BlockPos pos, PlayerEntity p, Hand hand,
|
||||
BlockHitResult hit) {
|
||||
public ActionResult onUse(BlockState state, World w, BlockPos pos, PlayerEntity p, Hand hand, BlockHitResult hit) {
|
||||
final CraftingBlockEntity tg = this.getBlockEntity(w, pos);
|
||||
|
||||
if (tg != null && !p.isInSneakingPose() && tg.isFormed() && tg.isActive()) {
|
||||
|
||||
@@ -21,8 +21,8 @@ package appeng.block.crafting;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.state.property.BooleanProperty;
|
||||
import net.minecraft.state.StateManager;
|
||||
import net.minecraft.state.property.BooleanProperty;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
@@ -56,8 +56,7 @@ public class MolecularAssemblerBlock extends AEBaseTileBlock<MolecularAssemblerB
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult onUse(BlockState state, World w, BlockPos pos, PlayerEntity p, Hand hand,
|
||||
BlockHitResult hit) {
|
||||
public ActionResult onUse(BlockState state, World w, BlockPos pos, PlayerEntity p, Hand hand, BlockHitResult hit) {
|
||||
final MolecularAssemblerBlockEntity tg = this.getBlockEntity(w, pos);
|
||||
if (tg != null && !p.isInSneakingPose()) {
|
||||
if (!tg.isClient()) {
|
||||
|
||||
@@ -20,33 +20,33 @@ package appeng.block.grindstone;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import appeng.util.FakePlayer;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockRenderType;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.Box;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Box;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
import net.minecraft.util.shape.VoxelShapes;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldAccess;
|
||||
import net.minecraft.world.WorldView;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.implementations.tiles.ICrankable;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.stats.AeStats;
|
||||
import appeng.tile.AEBaseBlockEntity;
|
||||
import appeng.tile.grindstone.CrankBlockEntity;
|
||||
import appeng.util.FakePlayer;
|
||||
|
||||
public class CrankBlock extends AEBaseTileBlock<CrankBlockEntity> {
|
||||
|
||||
@@ -79,8 +79,8 @@ public class CrankBlock extends AEBaseTileBlock<CrankBlockEntity> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlaced(final World world, final BlockPos pos, final BlockState state,
|
||||
final LivingEntity placer, final ItemStack stack) {
|
||||
public void onPlaced(final World world, final BlockPos pos, final BlockState state, final LivingEntity placer,
|
||||
final ItemStack stack) {
|
||||
final AEBaseBlockEntity tile = this.getBlockEntity(world, pos);
|
||||
if (tile != null) {
|
||||
final Direction mnt = this.findCrankable(world, pos);
|
||||
@@ -95,7 +95,8 @@ public class CrankBlock extends AEBaseTileBlock<CrankBlockEntity> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValidOrientation(final WorldAccess w, final BlockPos pos, final Direction forward, final Direction up) {
|
||||
public boolean isValidOrientation(final WorldAccess w, final BlockPos pos, final Direction forward,
|
||||
final Direction up) {
|
||||
final BlockEntity te = w.getBlockEntity(pos);
|
||||
return !(te instanceof CrankBlockEntity) || this.isCrankable(w, pos, up.getOpposite());
|
||||
}
|
||||
@@ -155,8 +156,8 @@ public class CrankBlock extends AEBaseTileBlock<CrankBlockEntity> {
|
||||
final double xOff = -0.15 * up.getOffsetX();
|
||||
final double yOff = -0.15 * up.getOffsetY();
|
||||
final double zOff = -0.15 * up.getOffsetZ();
|
||||
return VoxelShapes.cuboid(
|
||||
new Box(xOff + 0.15, yOff + 0.15, zOff + 0.15, xOff + 0.85, yOff + 0.85, zOff + 0.85));
|
||||
return VoxelShapes
|
||||
.cuboid(new Box(xOff + 0.15, yOff + 0.15, zOff + 0.15, xOff + 0.85, yOff + 0.85, zOff + 0.85));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@ package appeng.block.grindstone;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
|
||||
@@ -25,8 +25,8 @@ import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
|
||||
@@ -23,28 +23,28 @@ import java.util.function.Function;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.render.model.json.Transformation;
|
||||
import net.minecraft.client.util.math.AffineTransformation;
|
||||
import net.minecraft.util.math.Box;
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.util.math.Vector3f;
|
||||
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
|
||||
import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher;
|
||||
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
|
||||
import net.minecraft.client.render.model.json.Transformation;
|
||||
import net.minecraft.client.util.math.AffineTransformation;
|
||||
import net.minecraft.client.util.math.Vector3f;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Box;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
import net.minecraft.util.shape.VoxelShapes;
|
||||
import net.minecraft.world.BlockView;
|
||||
@@ -110,8 +110,9 @@ public class ChargerBlock extends AEBaseTileBlock<ChargerBlockEntity> {
|
||||
|
||||
for (int bolts = 0; bolts < 3; bolts++) {
|
||||
if (AppEng.instance().shouldAddParticles(r)) {
|
||||
MinecraftClient.getInstance().particleManager.addParticle(ParticleTypes.LIGHTNING, xOff + 0.5 + pos.getX(),
|
||||
yOff + 0.5 + pos.getY(), zOff + 0.5 + pos.getZ(), 0.0, 0.0, 0.0);
|
||||
MinecraftClient.getInstance().particleManager.addParticle(ParticleTypes.LIGHTNING,
|
||||
xOff + 0.5 + pos.getX(), yOff + 0.5 + pos.getY(), zOff + 0.5 + pos.getZ(), 0.0, 0.0,
|
||||
0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -171,8 +172,7 @@ public class ChargerBlock extends AEBaseTileBlock<ChargerBlockEntity> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getCollisionShape(BlockState state, BlockView worldIn, BlockPos pos,
|
||||
ShapeContext context) {
|
||||
public VoxelShape getCollisionShape(BlockState state, BlockView worldIn, BlockPos pos, ShapeContext context) {
|
||||
return VoxelShapes.cuboid(new Box(0.0, 0.0, 0.0, 1.0, 1.0, 1.0));
|
||||
}
|
||||
|
||||
@@ -183,7 +183,8 @@ public class ChargerBlock extends AEBaseTileBlock<ChargerBlockEntity> {
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
private static Pair<ItemStack, Transformation> getRenderedItem(ChargerBlockEntity tile) {
|
||||
Transformation transform = new Transformation(new Vector3f(), new Vector3f(0.5f, 0.375f, 0.5f), new Vector3f(1f, 1f, 1f));
|
||||
Transformation transform = new Transformation(new Vector3f(), new Vector3f(0.5f, 0.375f, 0.5f),
|
||||
new Vector3f(1f, 1f, 1f));
|
||||
return new ImmutablePair<>(tile.getInternalInventory().getInvStack(0), transform);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,13 +25,13 @@ import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.state.property.BooleanProperty;
|
||||
import net.minecraft.state.StateManager;
|
||||
import net.minecraft.state.property.BooleanProperty;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.util.IOrientable;
|
||||
|
||||
@@ -19,18 +19,18 @@
|
||||
package appeng.block.misc;
|
||||
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.state.property.BooleanProperty;
|
||||
import net.minecraft.state.StateManager;
|
||||
import net.minecraft.state.property.BooleanProperty;
|
||||
import net.minecraft.state.property.Properties;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Box;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
import net.minecraft.util.shape.VoxelShapes;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldAccess;
|
||||
import net.minecraft.world.WorldView;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
@@ -56,7 +56,8 @@ public class LightDetectorBlock extends AEBaseTileBlock<LightDetectorBlockEntity
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWeakRedstonePower(final BlockState state, final BlockView w, final BlockPos pos, final Direction side) {
|
||||
public int getWeakRedstonePower(final BlockState state, final BlockView w, final BlockPos pos,
|
||||
final Direction side) {
|
||||
if (w instanceof World && this.getBlockEntity(w, pos).isReady()) {
|
||||
// FIXME: This is ... uhm... fishy
|
||||
return ((World) w).getLightLevel(pos) - 6;
|
||||
@@ -70,7 +71,8 @@ public class LightDetectorBlock extends AEBaseTileBlock<LightDetectorBlockEntity
|
||||
return true;
|
||||
}
|
||||
|
||||
public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState newState, WorldAccess world, BlockPos pos, BlockPos posFrom) {
|
||||
public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState newState,
|
||||
WorldAccess world, BlockPos pos, BlockPos posFrom) {
|
||||
final Direction up = this.getOrientable(world, pos).getUp();
|
||||
if (!this.canPlaceAt(world, pos, up.getOpposite())) {
|
||||
// FIXME: Double check that this actually updates neighbors
|
||||
@@ -86,7 +88,8 @@ public class LightDetectorBlock extends AEBaseTileBlock<LightDetectorBlockEntity
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValidOrientation(final WorldAccess w, final BlockPos pos, final Direction forward, final Direction up) {
|
||||
public boolean isValidOrientation(final WorldAccess w, final BlockPos pos, final Direction forward,
|
||||
final Direction up) {
|
||||
return this.canPlaceAt(w, pos, up.getOpposite());
|
||||
}
|
||||
|
||||
@@ -106,13 +109,11 @@ public class LightDetectorBlock extends AEBaseTileBlock<LightDetectorBlockEntity
|
||||
final double xOff = -0.3 * up.getOffsetX();
|
||||
final double yOff = -0.3 * up.getOffsetY();
|
||||
final double zOff = -0.3 * up.getOffsetZ();
|
||||
return VoxelShapes
|
||||
.cuboid(new Box(xOff + 0.3, yOff + 0.3, zOff + 0.3, xOff + 0.7, yOff + 0.7, zOff + 0.7));
|
||||
return VoxelShapes.cuboid(new Box(xOff + 0.3, yOff + 0.3, zOff + 0.3, xOff + 0.7, yOff + 0.7, zOff + 0.7));
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getCollisionShape(BlockState state, BlockView worldIn, BlockPos pos,
|
||||
ShapeContext context) {
|
||||
public VoxelShape getCollisionShape(BlockState state, BlockView worldIn, BlockPos pos, ShapeContext context) {
|
||||
return VoxelShapes.empty();
|
||||
}
|
||||
|
||||
|
||||
@@ -24,28 +24,28 @@ import java.util.Random;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.item.ItemPlacementContext;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.state.StateManager;
|
||||
import net.minecraft.state.property.BooleanProperty;
|
||||
import net.minecraft.state.property.DirectionProperty;
|
||||
import net.minecraft.state.StateManager;
|
||||
import net.minecraft.state.property.Properties;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Box;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
import net.minecraft.util.shape.VoxelShapes;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldAccess;
|
||||
import net.minecraft.world.WorldView;
|
||||
import net.minecraft.world.World;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
@@ -80,8 +80,7 @@ public class QuartzFixtureBlock extends AEBaseBlock implements IOrientableBlock
|
||||
public static final BooleanProperty ODD = BooleanProperty.of("odd");
|
||||
|
||||
public QuartzFixtureBlock() {
|
||||
super(defaultProps(Material.SUPPORTED).noCollision().strength(0).lightLevel(14)
|
||||
.sounds(BlockSoundGroup.GLASS));
|
||||
super(defaultProps(Material.SUPPORTED).noCollision().strength(0).lightLevel(14).sounds(BlockSoundGroup.GLASS));
|
||||
|
||||
this.setDefaultState(getDefaultState().with(FACING, Direction.UP).with(ODD, false));
|
||||
}
|
||||
@@ -117,8 +116,8 @@ public class QuartzFixtureBlock extends AEBaseBlock implements IOrientableBlock
|
||||
// Break the fixture if the block it is attached to is changed so that it could
|
||||
// no longer be placed
|
||||
@Override
|
||||
public BlockState getStateForNeighborUpdate(BlockState state, Direction facing, BlockState facingState, WorldAccess worldIn,
|
||||
BlockPos pos, BlockPos facingPos) {
|
||||
public BlockState getStateForNeighborUpdate(BlockState state, Direction facing, BlockState facingState,
|
||||
WorldAccess worldIn, BlockPos pos, BlockPos facingPos) {
|
||||
Direction fixtureFacing = state.get(FACING);
|
||||
if (facing.getOpposite() == fixtureFacing && !canPlaceAt(worldIn, pos, facing)) {
|
||||
return Blocks.AIR.getDefaultState();
|
||||
@@ -127,7 +126,8 @@ public class QuartzFixtureBlock extends AEBaseBlock implements IOrientableBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValidOrientation(final WorldAccess w, final BlockPos pos, final Direction forward, final Direction up) {
|
||||
public boolean isValidOrientation(final WorldAccess w, final BlockPos pos, final Direction forward,
|
||||
final Direction up) {
|
||||
// FIXME: I think this entire method -> not required, but not sure... are quartz
|
||||
// fixtures rotateable???
|
||||
return this.canPlaceAt(w, pos, up.getOpposite());
|
||||
|
||||
@@ -21,17 +21,17 @@ package appeng.block.misc;
|
||||
import java.util.Random;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.state.property.BooleanProperty;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import net.minecraft.state.StateManager;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.state.property.BooleanProperty;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.World;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
@@ -52,7 +52,8 @@ public class QuartzGrowthAcceleratorBlock extends AEBaseTileBlock<QuartzGrowthAc
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockState updateBlockStateFromTileEntity(BlockState currentState, QuartzGrowthAcceleratorBlockEntity te) {
|
||||
protected BlockState updateBlockStateFromTileEntity(BlockState currentState,
|
||||
QuartzGrowthAcceleratorBlockEntity te) {
|
||||
return currentState.with(POWERED, te.isPowered());
|
||||
}
|
||||
|
||||
@@ -134,7 +135,8 @@ public class QuartzGrowthAcceleratorBlock extends AEBaseTileBlock<QuartzGrowthAc
|
||||
ry += dz * forward.getOffsetY();
|
||||
rz += dz * forward.getOffsetZ();
|
||||
|
||||
MinecraftClient.getInstance().particleManager.addParticle(ParticleTypes.LIGHTNING, rx, ry, rz, 0.0D, 0.0D, 0.0D);
|
||||
MinecraftClient.getInstance().particleManager.addParticle(ParticleTypes.LIGHTNING, rx, ry, rz, 0.0D, 0.0D,
|
||||
0.0D);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,12 +25,12 @@ import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.state.property.BooleanProperty;
|
||||
import net.minecraft.state.StateManager;
|
||||
import net.minecraft.state.property.BooleanProperty;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
package appeng.block.misc;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.bootstrap.BlockRenderingCustomizer;
|
||||
|
||||
@@ -21,16 +21,16 @@ package appeng.block.misc;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockRenderType;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Box;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Box;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
import net.minecraft.util.shape.VoxelShapes;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldAccess;
|
||||
import net.minecraft.world.WorldView;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.tile.misc.SkyCompassBlockEntity;
|
||||
@@ -42,7 +42,8 @@ public class SkyCompassBlock extends AEBaseTileBlock<SkyCompassBlockEntity> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValidOrientation(final WorldAccess w, final BlockPos pos, final Direction forward, final Direction up) {
|
||||
public boolean isValidOrientation(final WorldAccess w, final BlockPos pos, final Direction forward,
|
||||
final Direction up) {
|
||||
final SkyCompassBlockEntity sc = this.getBlockEntity(w, pos);
|
||||
if (sc != null) {
|
||||
return false;
|
||||
@@ -145,8 +146,7 @@ public class SkyCompassBlock extends AEBaseTileBlock<SkyCompassBlockEntity> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getCollisionShape(BlockState state, BlockView worldIn, BlockPos pos,
|
||||
ShapeContext context) {
|
||||
public VoxelShape getCollisionShape(BlockState state, BlockView worldIn, BlockPos pos, ShapeContext context) {
|
||||
return VoxelShapes.empty();
|
||||
}
|
||||
|
||||
|
||||
@@ -20,33 +20,32 @@ package appeng.block.misc;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.projectile.PersistentProjectileEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.sound.SoundCategory;
|
||||
import net.minecraft.sound.SoundEvents;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.sound.SoundCategory;
|
||||
import net.minecraft.util.math.Box;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Box;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
import net.minecraft.util.shape.VoxelShapes;
|
||||
import net.minecraft.world.explosion.Explosion;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.explosion.Explosion;
|
||||
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.entity.TinyTNTPrimedEntity;
|
||||
|
||||
public class TinyTNTBlock extends AEBaseBlock {
|
||||
|
||||
private static final VoxelShape SHAPE = VoxelShapes
|
||||
.cuboid(new Box(0.25f, 0.0f, 0.25f, 0.75f, 0.5f, 0.75f));
|
||||
private static final VoxelShape SHAPE = VoxelShapes.cuboid(new Box(0.25f, 0.0f, 0.25f, 0.75f, 0.5f, 0.75f));
|
||||
|
||||
public TinyTNTBlock(Settings props) {
|
||||
super(props);
|
||||
@@ -80,16 +79,17 @@ public class TinyTNTBlock extends AEBaseBlock {
|
||||
|
||||
public void startFuse(final World w, final BlockPos pos, final LivingEntity igniter) {
|
||||
if (!w.isClient) {
|
||||
final TinyTNTPrimedEntity primedTinyTNTEntity = new TinyTNTPrimedEntity(w, pos.getX() + 0.5F,
|
||||
pos.getY(), pos.getZ() + 0.5F, igniter);
|
||||
final TinyTNTPrimedEntity primedTinyTNTEntity = new TinyTNTPrimedEntity(w, pos.getX() + 0.5F, pos.getY(),
|
||||
pos.getZ() + 0.5F, igniter);
|
||||
w.spawnEntity(primedTinyTNTEntity);
|
||||
w.playSound(null, primedTinyTNTEntity.getX(), primedTinyTNTEntity.getY(),
|
||||
primedTinyTNTEntity.getZ(), SoundEvents.ENTITY_TNT_PRIMED, SoundCategory.BLOCKS, 1, 1);
|
||||
w.playSound(null, primedTinyTNTEntity.getX(), primedTinyTNTEntity.getY(), primedTinyTNTEntity.getZ(),
|
||||
SoundEvents.ENTITY_TNT_PRIMED, SoundCategory.BLOCKS, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void neighborUpdate(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean notify) {
|
||||
public void neighborUpdate(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos,
|
||||
boolean notify) {
|
||||
if (world.isReceivingRedstonePower(pos)) {
|
||||
this.startFuse(world, pos, null);
|
||||
world.removeBlock(pos, false);
|
||||
|
||||
@@ -28,13 +28,13 @@ import net.minecraft.block.Material;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.particle.ParticleTypes;
|
||||
import net.minecraft.state.property.BooleanProperty;
|
||||
import net.minecraft.state.StateManager;
|
||||
import net.minecraft.state.property.BooleanProperty;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
|
||||
@@ -18,25 +18,11 @@
|
||||
|
||||
package appeng.block.networking;
|
||||
|
||||
import appeng.api.parts.IFacadeContainer;
|
||||
import appeng.api.parts.IFacadePart;
|
||||
import appeng.api.parts.PartItemStack;
|
||||
import appeng.api.parts.SelectedPart;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.client.render.cablebus.CableBusBakedModel;
|
||||
import appeng.client.render.cablebus.CableBusBreakingParticle;
|
||||
import appeng.client.render.cablebus.CableBusRenderState;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.ClickPacket;
|
||||
import appeng.helpers.AEMaterials;
|
||||
import appeng.integration.abstraction.IAEFacade;
|
||||
import appeng.parts.ICableBusContainer;
|
||||
import appeng.parts.NullCableBusContainer;
|
||||
import appeng.tile.networking.CableBusBlockEntity;
|
||||
import appeng.util.Platform;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.fabric.api.event.client.player.ClientPickBlockGatherCallback;
|
||||
@@ -70,19 +56,32 @@ import net.minecraft.util.shape.VoxelShapes;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import appeng.api.parts.IFacadeContainer;
|
||||
import appeng.api.parts.IFacadePart;
|
||||
import appeng.api.parts.PartItemStack;
|
||||
import appeng.api.parts.SelectedPart;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.client.render.cablebus.CableBusBakedModel;
|
||||
import appeng.client.render.cablebus.CableBusBreakingParticle;
|
||||
import appeng.client.render.cablebus.CableBusRenderState;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.ClickPacket;
|
||||
import appeng.helpers.AEMaterials;
|
||||
import appeng.integration.abstraction.IAEFacade;
|
||||
import appeng.parts.ICableBusContainer;
|
||||
import appeng.parts.NullCableBusContainer;
|
||||
import appeng.tile.networking.CableBusBlockEntity;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class CableBusBlock extends AEBaseTileBlock<CableBusBlockEntity> implements IAEFacade {
|
||||
|
||||
private static final ICableBusContainer NULL_CABLE_BUS = new NullCableBusContainer();
|
||||
|
||||
public CableBusBlock() {
|
||||
super(defaultProps(AEMaterials.GLASS)
|
||||
.nonOpaque()
|
||||
.dropsNothing()
|
||||
.dynamicBounds());
|
||||
super(defaultProps(AEMaterials.GLASS).nonOpaque().dropsNothing().dynamicBounds());
|
||||
}
|
||||
|
||||
static {
|
||||
@@ -92,8 +91,7 @@ public class CableBusBlock extends AEBaseTileBlock<CableBusBlockEntity> implemen
|
||||
BlockState blockState = player.world.getBlockState(((BlockHitResult) result).getBlockPos());
|
||||
if (blockState.getBlock() instanceof CableBusBlock) {
|
||||
CableBusBlock cableBus = (CableBusBlock) blockState.getBlock();
|
||||
return cableBus.getPickBlock(blockState,
|
||||
result, player.world, blockResult.getBlockPos(), player);
|
||||
return cableBus.getPickBlock(blockState, result, player.world, blockResult.getBlockPos(), player);
|
||||
}
|
||||
}
|
||||
return ItemStack.EMPTY;
|
||||
@@ -112,7 +110,8 @@ public class CableBusBlock extends AEBaseTileBlock<CableBusBlockEntity> implemen
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWeakRedstonePower(final BlockState state, final BlockView w, final BlockPos pos, final Direction side) {
|
||||
public int getWeakRedstonePower(final BlockState state, final BlockView w, final BlockPos pos,
|
||||
final Direction side) {
|
||||
return this.cb(w, pos).isProvidingWeakPower(side.getOpposite()); // TODO:
|
||||
// IS
|
||||
// OPPOSITE!?
|
||||
@@ -144,21 +143,18 @@ public class CableBusBlock extends AEBaseTileBlock<CableBusBlockEntity> implemen
|
||||
// FIXME FABRIC return this.cb(world, pos).getLightValue();
|
||||
// FIXME FABRIC }
|
||||
|
||||
|
||||
// FIXME: Must hook isClimbing ourselves
|
||||
// FIXME FABRIC @Override
|
||||
// FIXME FABRIC public boolean isLadder(BlockState state, WorldView world, BlockPos pos, LivingEntity entity) {
|
||||
// FIXME FABRIC return this.cb(world, pos).isLadder(entity);
|
||||
// FIXME FABRIC }
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canReplace(BlockState state, ItemPlacementContext context) {
|
||||
// FIXME: Potentially check the fluid one too
|
||||
return super.canReplace(state, context) && this.cb(context.getWorld(), context.getBlockPos()).isEmpty();
|
||||
}
|
||||
|
||||
|
||||
// FIXME FABRIC Hook does not exist
|
||||
// FIXME FABRIC @Override
|
||||
// FIXME FABRIC public boolean removedByPlayer(BlockState state, World world, BlockPos pos, PlayerEntity player,
|
||||
@@ -185,7 +181,7 @@ public class CableBusBlock extends AEBaseTileBlock<CableBusBlockEntity> implemen
|
||||
// FIXME FABRIC }
|
||||
|
||||
public ItemStack getPickBlock(BlockState state, HitResult target, BlockView world, BlockPos pos,
|
||||
PlayerEntity player) {
|
||||
PlayerEntity player) {
|
||||
final Vec3d v3 = target.getPos().subtract(pos.getX(), pos.getY(), pos.getZ());
|
||||
final SelectedPart sp = this.cb(world, pos).selectPart(v3);
|
||||
|
||||
@@ -198,11 +194,11 @@ public class CableBusBlock extends AEBaseTileBlock<CableBusBlockEntity> implemen
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
|
||||
// FIXME FABRIC MIXIN net.minecraft.client.particle.ParticleManager.addBlockBreakingParticles
|
||||
// FIXME FABRIC MIXIN
|
||||
// net.minecraft.client.particle.ParticleManager.addBlockBreakingParticles
|
||||
@Environment(EnvType.CLIENT)
|
||||
public boolean addHitEffects(final BlockState state, final World world, final HitResult target,
|
||||
final ParticleManager effectRenderer) {
|
||||
final ParticleManager effectRenderer) {
|
||||
|
||||
// Half the particle rate. Since we're spawning concentrated on a specific spot,
|
||||
// our particle effect otherwise looks too strong
|
||||
@@ -218,8 +214,7 @@ public class CableBusBlock extends AEBaseTileBlock<CableBusBlockEntity> implemen
|
||||
ICableBusContainer cb = this.cb(world, blockPos);
|
||||
|
||||
// Our built-in model has the actual baked sprites we need
|
||||
BakedModel model = MinecraftClient.getInstance().getBlockRenderManager()
|
||||
.getModel(this.getDefaultState());
|
||||
BakedModel model = MinecraftClient.getInstance().getBlockRenderManager().getModel(this.getDefaultState());
|
||||
|
||||
// We cannot add the effect if we don't have the model
|
||||
if (!(model instanceof CableBusBakedModel)) {
|
||||
@@ -238,21 +233,20 @@ public class CableBusBlock extends AEBaseTileBlock<CableBusBlockEntity> implemen
|
||||
double z = target.getPos().z;
|
||||
// FIXME: Check how this looks, probably like shit, maybe provide parts the
|
||||
// ability to supply particle textures???
|
||||
effectRenderer
|
||||
.addParticle(new CableBusBreakingParticle((ClientWorld) world, x, y, z, texture).scale(0.8F));
|
||||
effectRenderer.addParticle(new CableBusBreakingParticle((ClientWorld) world, x, y, z, texture).scale(0.8F));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// FIXME FABRIC: Mixin to net.minecraft.client.particle.ParticleManager.addBlockBreakParticles
|
||||
// FIXME FABRIC: Mixin to
|
||||
// net.minecraft.client.particle.ParticleManager.addBlockBreakParticles
|
||||
@Environment(EnvType.CLIENT)
|
||||
public boolean addDestroyEffects(BlockState state, World world, BlockPos pos, ParticleManager effectRenderer) {
|
||||
ICableBusContainer cb = this.cb(world, pos);
|
||||
|
||||
// Our built-in model has the actual baked sprites we need
|
||||
BakedModel model = MinecraftClient.getInstance().getBlockRenderManager()
|
||||
.getModel(this.getDefaultState());
|
||||
BakedModel model = MinecraftClient.getInstance().getBlockRenderManager().getModel(this.getDefaultState());
|
||||
|
||||
// We cannot add the effect if we dont have the model
|
||||
if (!(model instanceof CableBusBakedModel)) {
|
||||
@@ -280,8 +274,8 @@ public class CableBusBlock extends AEBaseTileBlock<CableBusBlockEntity> implemen
|
||||
|
||||
// FIXME: Check how this looks, probably like shit, maybe provide parts the
|
||||
// ability to supply particle textures???
|
||||
Particle effect = new CableBusBreakingParticle((ClientWorld) world, x, y, z, x - pos.getX() - 0.5D,
|
||||
y - pos.getY() - 0.5D, z - pos.getZ() - 0.5D, texture);
|
||||
Particle effect = new CableBusBreakingParticle((ClientWorld) world, x, y, z,
|
||||
x - pos.getX() - 0.5D, y - pos.getY() - 0.5D, z - pos.getZ() - 0.5D, texture);
|
||||
effectRenderer.addParticle(effect);
|
||||
}
|
||||
}
|
||||
@@ -293,7 +287,7 @@ public class CableBusBlock extends AEBaseTileBlock<CableBusBlockEntity> implemen
|
||||
|
||||
@Override
|
||||
public void neighborUpdate(BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos,
|
||||
boolean isMoving) {
|
||||
boolean isMoving) {
|
||||
if (Platform.isServer()) {
|
||||
this.cb(world, pos).onneighborUpdate(world, pos, fromPos);
|
||||
}
|
||||
@@ -334,7 +328,7 @@ public class CableBusBlock extends AEBaseTileBlock<CableBusBlockEntity> implemen
|
||||
|
||||
if (this.cb(worldIn, pos).clicked(player, Hand.MAIN_HAND, hitVec)) {
|
||||
NetworkHandler.instance().sendToServer(new ClickPacket(pos, brtr.getSide(), (float) hitVec.x,
|
||||
(float) hitVec.y, (float) hitVec.z, Hand.MAIN_HAND, true));
|
||||
(float) hitVec.y, (float) hitVec.z, Hand.MAIN_HAND, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -347,15 +341,15 @@ public class CableBusBlock extends AEBaseTileBlock<CableBusBlockEntity> implemen
|
||||
|
||||
@Override
|
||||
public ActionResult onActivated(final World w, final BlockPos pos, final PlayerEntity player, final Hand hand,
|
||||
final @Nullable ItemStack heldItem, final BlockHitResult hit) {
|
||||
final @Nullable ItemStack heldItem, final BlockHitResult hit) {
|
||||
// Transform from world into block space
|
||||
Vec3d hitVec = hit.getPos();
|
||||
Vec3d hitInBlock = new Vec3d(hitVec.x - pos.getX(), hitVec.y - pos.getY(), hitVec.z - pos.getZ());
|
||||
return this.cb(w, pos).activate(player, hand, hitInBlock) ? ActionResult.SUCCESS : ActionResult.PASS;
|
||||
}
|
||||
|
||||
public boolean recolorBlock(final BlockView world, final BlockPos pos, final Direction side,
|
||||
final DyeColor color, final PlayerEntity who) {
|
||||
public boolean recolorBlock(final BlockView world, final BlockPos pos, final Direction side, final DyeColor color,
|
||||
final PlayerEntity who) {
|
||||
try {
|
||||
return this.cb(world, pos).recolourBlock(side, AEColor.values()[color.ordinal()], who);
|
||||
} catch (final Throwable ignored) {
|
||||
@@ -399,7 +393,8 @@ public class CableBusBlock extends AEBaseTileBlock<CableBusBlockEntity> implemen
|
||||
return VoxelShapes.empty();
|
||||
} else {
|
||||
Entity entity = null;
|
||||
// FIXME FABRIC: even EntityShapeContext doesn't give us the actual entity we're colliding with :|
|
||||
// FIXME FABRIC: even EntityShapeContext doesn't give us the actual entity we're
|
||||
// colliding with :|
|
||||
return te.getCableBus().getCollisionShape(entity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,13 +20,13 @@ package appeng.block.networking;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.client.color.block.BlockColorProvider;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.BlockRenderView;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.parts.CableBusContainer;
|
||||
|
||||
@@ -20,11 +20,11 @@ package appeng.block.networking;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
|
||||
import appeng.bootstrap.BlockRenderingCustomizer;
|
||||
import appeng.bootstrap.IBlockRendering;
|
||||
import appeng.bootstrap.IItemRendering;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
|
||||
/**
|
||||
* Customizes the rendering behavior for cable busses, which are the biggest
|
||||
@@ -35,7 +35,8 @@ public class CableBusRendering extends BlockRenderingCustomizer {
|
||||
@Override
|
||||
@Environment(EnvType.CLIENT)
|
||||
public void customize(IBlockRendering rendering, IItemRendering itemRendering) {
|
||||
// FIXME This is straight up impossible in Vanilla, and questionable if it's actually needed.
|
||||
// FIXME This is straight up impossible in Vanilla, and questionable if it's
|
||||
// actually needed.
|
||||
// FIXME rendering.renderType(rt -> true);
|
||||
rendering.renderType(RenderLayer.getCutout());
|
||||
|
||||
|
||||
@@ -18,19 +18,19 @@
|
||||
|
||||
package appeng.block.networking;
|
||||
|
||||
import appeng.tile.networking.ControllerBlockEntity;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.state.property.EnumProperty;
|
||||
import net.minecraft.state.StateManager;
|
||||
import net.minecraft.state.property.EnumProperty;
|
||||
import net.minecraft.util.StringIdentifiable;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.WorldAccess;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldAccess;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.tile.networking.ControllerBlockEntity;
|
||||
|
||||
public class ControllerBlock extends AEBaseTileBlock<ControllerBlockEntity> {
|
||||
|
||||
@@ -86,8 +86,8 @@ public class ControllerBlock extends AEBaseTileBlock<ControllerBlockEntity> {
|
||||
* texture feel for the controller based on how it is placed.
|
||||
*/
|
||||
@Override
|
||||
public BlockState getStateForNeighborUpdate(BlockState state, Direction facing, BlockState facingState, WorldAccess world,
|
||||
BlockPos pos, BlockPos facingPos) {
|
||||
public BlockState getStateForNeighborUpdate(BlockState state, Direction facing, BlockState facingState,
|
||||
WorldAccess world, BlockPos pos, BlockPos facingPos) {
|
||||
|
||||
// FIXME: this might work, or might _NOT_ work, but needs to be investigated
|
||||
|
||||
|
||||
@@ -20,17 +20,17 @@ package appeng.block.networking;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.state.property.EnumProperty;
|
||||
import net.minecraft.state.StateManager;
|
||||
import net.minecraft.state.property.EnumProperty;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.StringIdentifiable;
|
||||
import net.minecraft.util.math.Box;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.util.math.Box;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
import net.minecraft.util.shape.VoxelShapes;
|
||||
import net.minecraft.world.BlockView;
|
||||
@@ -83,7 +83,7 @@ public class WirelessBlock extends AEBaseTileBlock<WirelessBlockEntity> {
|
||||
|
||||
@Override
|
||||
public ActionResult onUse(BlockState state, World w, BlockPos pos, PlayerEntity player, Hand hand,
|
||||
BlockHitResult hit) {
|
||||
BlockHitResult hit) {
|
||||
final WirelessBlockEntity tg = this.getBlockEntity(w, pos);
|
||||
|
||||
if (tg != null && !player.isInSneakingPose()) {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
|
||||
package appeng.block.networking;
|
||||
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.bootstrap.BlockRenderingCustomizer;
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
|
||||
package appeng.block.paint;
|
||||
|
||||
import appeng.client.render.cablebus.CubeBuilder;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.helpers.Splotch;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import net.fabricmc.fabric.api.renderer.v1.model.FabricBakedModel;
|
||||
import net.fabricmc.fabric.api.renderer.v1.render.RenderContext;
|
||||
import net.fabricmc.fabric.api.rendering.data.v1.RenderAttachedBlockView;
|
||||
@@ -22,12 +28,9 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.BlockRenderView;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
import appeng.client.render.cablebus.CubeBuilder;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.helpers.Splotch;
|
||||
|
||||
/**
|
||||
* Renders paint blocks, which render multiple "splotches" that have been
|
||||
@@ -56,7 +59,8 @@ class PaintSplotchesBakedModel implements BakedModel, FabricBakedModel {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void emitBlockQuads(BlockRenderView blockView, BlockState state, BlockPos pos, Supplier<Random> randomSupplier, RenderContext context) {
|
||||
public void emitBlockQuads(BlockRenderView blockView, BlockState state, BlockPos pos,
|
||||
Supplier<Random> randomSupplier, RenderContext context) {
|
||||
|
||||
Object renderAttachment = ((RenderAttachedBlockView) blockView).getBlockEntityRenderAttachment(pos);
|
||||
if (!(renderAttachment instanceof PaintSplotches)) {
|
||||
|
||||
@@ -18,23 +18,23 @@
|
||||
|
||||
package appeng.block.paint;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.block.MaterialColor;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.item.ItemPlacementContext;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemPlacementContext;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.collection.DefaultedList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
import net.minecraft.util.shape.VoxelShapes;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.tile.misc.PaintSplotchesBlockEntity;
|
||||
|
||||
@@ -1,7 +1,15 @@
|
||||
|
||||
package appeng.block.paint;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
|
||||
import net.minecraft.client.render.model.BakedModel;
|
||||
import net.minecraft.client.render.model.ModelBakeSettings;
|
||||
import net.minecraft.client.render.model.ModelLoader;
|
||||
@@ -10,22 +18,18 @@ import net.minecraft.client.texture.Sprite;
|
||||
import net.minecraft.client.util.SpriteIdentifier;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class PaintSplotchesModel implements UnbakedModel {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BakedModel bake(ModelLoader loader, Function<SpriteIdentifier, Sprite> textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) {
|
||||
public BakedModel bake(ModelLoader loader, Function<SpriteIdentifier, Sprite> textureGetter,
|
||||
ModelBakeSettings rotationContainer, Identifier modelId) {
|
||||
return new PaintSplotchesBakedModel(textureGetter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<SpriteIdentifier> getTextureDependencies(Function<Identifier, UnbakedModel> unbakedModelGetter, Set<Pair<String, String>> unresolvedTextureReferences) {
|
||||
public Collection<SpriteIdentifier> getTextureDependencies(Function<Identifier, UnbakedModel> unbakedModelGetter,
|
||||
Set<Pair<String, String>> unresolvedTextureReferences) {
|
||||
return PaintSplotchesBakedModel.getRequiredTextures();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
|
||||
package appeng.block.paint;
|
||||
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
|
||||
import appeng.bootstrap.BlockRenderingCustomizer;
|
||||
import appeng.bootstrap.IBlockRendering;
|
||||
|
||||
@@ -1,10 +1,17 @@
|
||||
|
||||
package appeng.block.qnb;
|
||||
|
||||
import appeng.client.render.cablebus.CubeBuilder;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.AppEng;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import net.fabricmc.fabric.api.renderer.v1.mesh.QuadEmitter;
|
||||
import net.fabricmc.fabric.api.renderer.v1.model.FabricBakedModel;
|
||||
import net.fabricmc.fabric.api.renderer.v1.render.RenderContext;
|
||||
@@ -24,13 +31,9 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.BlockRenderView;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
import appeng.client.render.cablebus.CubeBuilder;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.AppEng;
|
||||
|
||||
class QnbFormedBakedModel implements BakedModel, FabricBakedModel {
|
||||
|
||||
@@ -40,12 +43,12 @@ class QnbFormedBakedModel implements BakedModel, FabricBakedModel {
|
||||
new Identifier(AppEng.MOD_ID, "block/quantum_ring"));
|
||||
private static final SpriteIdentifier TEXTURE_RING_LIGHT = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEX,
|
||||
new Identifier(AppEng.MOD_ID, "block/quantum_ring_light"));
|
||||
private static final SpriteIdentifier TEXTURE_RING_LIGHT_CORNER = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEX,
|
||||
new Identifier(AppEng.MOD_ID, "block/quantum_ring_light_corner"));
|
||||
private static final SpriteIdentifier TEXTURE_RING_LIGHT_CORNER = new SpriteIdentifier(
|
||||
SpriteAtlasTexture.BLOCK_ATLAS_TEX, new Identifier(AppEng.MOD_ID, "block/quantum_ring_light_corner"));
|
||||
private static final SpriteIdentifier TEXTURE_CABLE_GLASS = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEX,
|
||||
new Identifier(AppEng.MOD_ID, "part/cable/glass/transparent"));
|
||||
private static final SpriteIdentifier TEXTURE_COVERED_CABLE = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEX,
|
||||
new Identifier(AppEng.MOD_ID, "part/cable/covered/transparent"));
|
||||
private static final SpriteIdentifier TEXTURE_COVERED_CABLE = new SpriteIdentifier(
|
||||
SpriteAtlasTexture.BLOCK_ATLAS_TEX, new Identifier(AppEng.MOD_ID, "part/cable/covered/transparent"));
|
||||
|
||||
private static final float DEFAULT_RENDER_MIN = 2.0f;
|
||||
private static final float DEFAULT_RENDER_MAX = 14.0f;
|
||||
@@ -89,7 +92,8 @@ class QnbFormedBakedModel implements BakedModel, FabricBakedModel {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void emitBlockQuads(BlockRenderView blockView, BlockState state, BlockPos pos, Supplier<Random> randomSupplier, RenderContext context) {
|
||||
public void emitBlockQuads(BlockRenderView blockView, BlockState state, BlockPos pos,
|
||||
Supplier<Random> randomSupplier, RenderContext context) {
|
||||
QnbFormedState formedState = getState(blockView, pos);
|
||||
|
||||
if (formedState == null) {
|
||||
@@ -185,7 +189,7 @@ class QnbFormedBakedModel implements BakedModel, FabricBakedModel {
|
||||
}
|
||||
|
||||
private void renderCableAt(CubeBuilder builder, float thickness, Sprite texture, float pull,
|
||||
Set<Direction> connections) {
|
||||
Set<Direction> connections) {
|
||||
builder.setTexture(texture);
|
||||
|
||||
if (connections.contains(Direction.WEST)) {
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
|
||||
package appeng.block.qnb;
|
||||
|
||||
import appeng.client.render.BasicUnbakedModel;
|
||||
import appeng.core.AppEng;
|
||||
import java.util.Collection;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import net.minecraft.client.render.model.BakedModel;
|
||||
import net.minecraft.client.render.model.ModelBakeSettings;
|
||||
import net.minecraft.client.render.model.ModelLoader;
|
||||
@@ -11,10 +16,8 @@ import net.minecraft.client.texture.Sprite;
|
||||
import net.minecraft.client.util.SpriteIdentifier;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
import appeng.client.render.BasicUnbakedModel;
|
||||
import appeng.core.AppEng;
|
||||
|
||||
public class QnbFormedModel implements BasicUnbakedModel {
|
||||
|
||||
@@ -22,7 +25,8 @@ public class QnbFormedModel implements BasicUnbakedModel {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BakedModel bake(ModelLoader loader, Function<SpriteIdentifier, Sprite> textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) {
|
||||
public BakedModel bake(ModelLoader loader, Function<SpriteIdentifier, Sprite> textureGetter,
|
||||
ModelBakeSettings rotationContainer, Identifier modelId) {
|
||||
BakedModel ringModel = loader.bake(MODEL_RING, rotationContainer);
|
||||
return new QnbFormedBakedModel(ringModel, textureGetter);
|
||||
}
|
||||
|
||||
@@ -20,11 +20,11 @@ package appeng.block.qnb;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.state.property.BooleanProperty;
|
||||
import net.minecraft.state.StateManager;
|
||||
import net.minecraft.util.math.Box;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.state.StateManager;
|
||||
import net.minecraft.state.property.BooleanProperty;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Box;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
import net.minecraft.util.shape.VoxelShapes;
|
||||
import net.minecraft.world.BlockView;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
|
||||
package appeng.block.qnb;
|
||||
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
|
||||
import appeng.bootstrap.BlockRenderingCustomizer;
|
||||
import appeng.bootstrap.IBlockRendering;
|
||||
|
||||
@@ -23,14 +23,14 @@ import java.util.Random;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.Box;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Box;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
import net.minecraft.util.shape.VoxelShapes;
|
||||
import net.minecraft.world.BlockView;
|
||||
@@ -51,8 +51,8 @@ public class QuantumLinkChamberBlock extends QuantumBaseBlock {
|
||||
|
||||
static {
|
||||
final double onePixel = 2.0 / 16.0;
|
||||
SHAPE = VoxelShapes.cuboid(
|
||||
new Box(onePixel, onePixel, onePixel, 1.0 - onePixel, 1.0 - onePixel, 1.0 - onePixel));
|
||||
SHAPE = VoxelShapes
|
||||
.cuboid(new Box(onePixel, onePixel, onePixel, 1.0 - onePixel, 1.0 - onePixel, 1.0 - onePixel));
|
||||
}
|
||||
|
||||
public QuantumLinkChamberBlock() {
|
||||
@@ -65,8 +65,8 @@ public class QuantumLinkChamberBlock extends QuantumBaseBlock {
|
||||
if (bridge != null) {
|
||||
if (bridge.hasQES()) {
|
||||
if (AppEng.instance().shouldAddParticles(rand)) {
|
||||
AppEng.instance().spawnEffect(EffectType.Energy, w, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5,
|
||||
null);
|
||||
AppEng.instance().spawnEffect(EffectType.Energy, w, pos.getX() + 0.5, pos.getY() + 0.5,
|
||||
pos.getZ() + 0.5, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,9 +20,9 @@ package appeng.block.qnb;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.util.math.Box;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Box;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
import net.minecraft.util.shape.VoxelShapes;
|
||||
import net.minecraft.world.BlockView;
|
||||
@@ -51,7 +51,7 @@ public class QuantumRingBlock extends QuantumBaseBlock {
|
||||
}
|
||||
|
||||
private static VoxelShape createShape(double onePixel) {
|
||||
return VoxelShapes.cuboid(
|
||||
new Box(onePixel, onePixel, onePixel, 1.0 - onePixel, 1.0 - onePixel, 1.0 - onePixel));
|
||||
return VoxelShapes
|
||||
.cuboid(new Box(onePixel, onePixel, onePixel, 1.0 - onePixel, 1.0 - onePixel, 1.0 - onePixel));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
package appeng.block.spatial;
|
||||
|
||||
import appeng.block.AEBaseBlock;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.piston.PistonBehavior;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
@@ -32,13 +31,16 @@ import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldView;
|
||||
import net.minecraft.world.explosion.Explosion;
|
||||
|
||||
import appeng.block.AEBaseBlock;
|
||||
|
||||
/**
|
||||
* This block is used to fill empty space in spatial dimensions and delinates
|
||||
* the border of a spatial dimensions's usable space.
|
||||
*/
|
||||
public class MatrixFrameBlock extends AEBaseBlock {
|
||||
|
||||
private static final Material MATERIAL = new Material(MaterialColor.CLEAR, false, true, true, false, false, false, PistonBehavior.PUSH_ONLY);
|
||||
private static final Material MATERIAL = new Material(MaterialColor.CLEAR, false, true, true, false, false, false,
|
||||
PistonBehavior.PUSH_ONLY);
|
||||
|
||||
public MatrixFrameBlock() {
|
||||
super(Settings.of(MATERIAL).strength(-1.0F, 6000000.0F).nonOpaque().dropsNothing());
|
||||
@@ -55,8 +57,7 @@ public class MatrixFrameBlock extends AEBaseBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getCollisionShape(BlockState state, BlockView worldIn, BlockPos pos,
|
||||
ShapeContext context) {
|
||||
public VoxelShape getCollisionShape(BlockState state, BlockView worldIn, BlockPos pos, ShapeContext context) {
|
||||
return VoxelShapes.fullCube();
|
||||
}
|
||||
|
||||
|
||||
@@ -27,8 +27,8 @@ import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
|
||||
@@ -20,24 +20,24 @@ package appeng.block.storage;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import appeng.container.ContainerLocator;
|
||||
import appeng.container.ContainerOpener;
|
||||
import appeng.container.implementations.ChestContainer;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.state.property.BooleanProperty;
|
||||
import net.minecraft.state.StateManager;
|
||||
import net.minecraft.state.property.BooleanProperty;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.container.ContainerLocator;
|
||||
import appeng.container.ContainerOpener;
|
||||
import appeng.container.implementations.ChestContainer;
|
||||
import appeng.core.localization.PlayerMessages;
|
||||
import appeng.tile.storage.ChestBlockEntity;
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@ import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
|
||||
@@ -20,26 +20,26 @@ package appeng.block.storage;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import appeng.container.ContainerLocator;
|
||||
import appeng.container.ContainerOpener;
|
||||
import appeng.container.implementations.SkyChestContainer;
|
||||
import net.minecraft.block.BlockRenderType;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Box;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
import net.minecraft.util.shape.VoxelShapes;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.container.ContainerLocator;
|
||||
import appeng.container.ContainerOpener;
|
||||
import appeng.container.implementations.SkyChestContainer;
|
||||
import appeng.tile.storage.SkyChestBlockEntity;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
@@ -18,6 +18,24 @@
|
||||
|
||||
package appeng.bootstrap;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
import appeng.api.definitions.IBlockDefinition;
|
||||
import appeng.api.features.AEFeature;
|
||||
import appeng.block.AEBaseBlock;
|
||||
@@ -29,22 +47,6 @@ import appeng.core.CreativeTab;
|
||||
import appeng.core.features.BlockDefinition;
|
||||
import appeng.core.features.TileDefinition;
|
||||
import appeng.util.Platform;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
class BlockDefinitionBuilder implements IBlockBuilder {
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ public class BlockEntityBuilder<T extends AEBaseBlockEntity> {
|
||||
private final EnumSet<AEFeature> features = EnumSet.noneOf(AEFeature.class);
|
||||
|
||||
public BlockEntityBuilder(FeatureFactory factory, String id, Class<T> tileClass,
|
||||
Function<BlockEntityType<T>, T> supplier) {
|
||||
Function<BlockEntityType<T>, T> supplier) {
|
||||
this.factory = factory;
|
||||
this.id = AppEng.makeId(id);
|
||||
this.tileClass = tileClass;
|
||||
|
||||
@@ -20,7 +20,6 @@ package appeng.bootstrap;
|
||||
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
import appeng.client.render.model.AutoRotatingBakedModel;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.ColorProviderRegistry;
|
||||
@@ -33,6 +32,7 @@ import net.minecraft.util.Identifier;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.bootstrap.components.BlockColorComponent;
|
||||
import appeng.bootstrap.components.RenderTypeComponent;
|
||||
import appeng.client.render.model.AutoRotatingBakedModel;
|
||||
|
||||
class BlockRendering implements IBlockRendering {
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package appeng.bootstrap;
|
||||
|
||||
import appeng.api.features.AEFeature;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.entity.FabricEntityTypeBuilder;
|
||||
import net.fabricmc.fabric.impl.object.builder.FabricEntityType;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -8,9 +11,7 @@ import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.SpawnGroup;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.function.Consumer;
|
||||
import appeng.api.features.AEFeature;
|
||||
|
||||
/**
|
||||
* Helper to register a custom Entity with Minecraft.
|
||||
|
||||
@@ -29,16 +29,16 @@ import java.util.function.BiFunction;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.client.render.model.BakedModel;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.SpawnGroup;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.SpawnGroup;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.fabricmc.api.EnvType;
|
||||
|
||||
import appeng.api.features.AEFeature;
|
||||
import appeng.bootstrap.components.ModelOverrideComponent;
|
||||
@@ -86,7 +86,7 @@ public class FeatureFactory {
|
||||
}
|
||||
|
||||
public <T extends AEBaseBlockEntity> BlockEntityBuilder<T> tileEntity(String id, Class<T> teClass,
|
||||
Function<BlockEntityType<T>, T> factory) {
|
||||
Function<BlockEntityType<T>, T> factory) {
|
||||
return new BlockEntityBuilder<>(this, id, teClass, factory).features(this.defaultFeatures);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
|
||||
package appeng.bootstrap;
|
||||
|
||||
import net.minecraft.client.color.item.ItemColorProvider;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.color.item.ItemColorProvider;
|
||||
|
||||
/**
|
||||
* Allows the rendering of an item to be customized.
|
||||
|
||||
@@ -26,12 +26,14 @@ import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.block.DispenserBlock;
|
||||
import net.minecraft.block.dispenser.DispenserBehavior;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
import appeng.api.features.AEFeature;
|
||||
import appeng.bootstrap.components.IInitComponent;
|
||||
@@ -39,8 +41,6 @@ import appeng.core.AppEng;
|
||||
import appeng.core.CreativeTab;
|
||||
import appeng.core.features.ItemDefinition;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
class ItemDefinitionBuilder implements IItemBuilder {
|
||||
|
||||
|
||||
@@ -18,10 +18,10 @@
|
||||
|
||||
package appeng.bootstrap;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.color.item.ItemColorProvider;
|
||||
import net.minecraft.item.Item;
|
||||
import net.fabricmc.api.EnvType;
|
||||
|
||||
import appeng.bootstrap.components.ItemColorComponent;
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
|
||||
package appeng.bootstrap;
|
||||
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
/**
|
||||
* A callback that allows the rendering of a item to be customized. Sadly this
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package appeng.bootstrap;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import net.fabricmc.fabric.api.event.Event;
|
||||
import net.fabricmc.fabric.api.event.EventFactory;
|
||||
import net.minecraft.client.render.model.BakedModel;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@FunctionalInterface
|
||||
public interface ModelsReloadCallback {
|
||||
|
||||
|
||||
@@ -20,10 +20,10 @@ package appeng.bootstrap;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
|
||||
import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher;
|
||||
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
|
||||
|
||||
import appeng.tile.AEBaseBlockEntity;
|
||||
|
||||
|
||||
@@ -21,15 +21,15 @@ package appeng.bootstrap;
|
||||
import appeng.tile.AEBaseBlockEntity;
|
||||
|
||||
/**
|
||||
* A callback that allows the rendering of a block entity to be customized. Sadly
|
||||
* this class is required and no lambdas can be used due to them not being able
|
||||
* to be annotated with @OnlyIn(CLIENT).
|
||||
* A callback that allows the rendering of a block entity to be customized.
|
||||
* Sadly this class is required and no lambdas can be used due to them not being
|
||||
* able to be annotated with @OnlyIn(CLIENT).
|
||||
*/
|
||||
public interface TileEntityRenderingCustomizer<T extends AEBaseBlockEntity> {
|
||||
|
||||
/**
|
||||
* Declared as a default method because we will carve out the implementations that
|
||||
* override this method on the Server side.
|
||||
* Declared as a default method because we will carve out the implementations
|
||||
* that override this method on the Server side.
|
||||
*/
|
||||
default void customize(TileEntityRendering<T> rendering) {
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package appeng.bootstrap.components;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.client.render.model.BakedModel;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import appeng.bootstrap.IBootstrapComponent;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface IModelBakeComponent extends IBootstrapComponent {
|
||||
|
||||
void onModelsReloaded(Map<Identifier, BakedModel> loadedModels);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package appeng.bootstrap.components;
|
||||
|
||||
|
||||
import appeng.bootstrap.IBootstrapComponent;
|
||||
|
||||
@FunctionalInterface
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package appeng.bootstrap.components;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
|
||||
@@ -1,5 +1,38 @@
|
||||
package appeng.client;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
|
||||
import net.fabricmc.fabric.api.client.model.ModelLoadingRegistry;
|
||||
import net.fabricmc.fabric.api.client.particle.v1.ParticleFactoryRegistry;
|
||||
import net.fabricmc.fabric.api.client.rendereregistry.v1.EntityRendererRegistry;
|
||||
import net.fabricmc.fabric.api.client.screenhandler.v1.ScreenRegistry;
|
||||
import net.fabricmc.fabric.api.event.client.ClientSpriteRegistryCallback;
|
||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.options.KeyBinding;
|
||||
import net.minecraft.client.render.entity.ItemEntityRenderer;
|
||||
import net.minecraft.client.render.model.BakedModel;
|
||||
import net.minecraft.client.render.model.UnbakedModel;
|
||||
import net.minecraft.client.util.SpriteIdentifier;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.integrated.IntegratedServer;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.hit.HitResult;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.parts.CableRenderMode;
|
||||
import appeng.block.crafting.AbstractCraftingUnitBlock;
|
||||
import appeng.block.paint.PaintSplotchesModel;
|
||||
@@ -124,37 +157,6 @@ import appeng.hooks.ClientTickHandler;
|
||||
import appeng.parts.automation.PlaneModel;
|
||||
import appeng.tile.crafting.MolecularAssemblerRenderer;
|
||||
import appeng.util.Platform;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
|
||||
import net.fabricmc.fabric.api.client.model.ModelLoadingRegistry;
|
||||
import net.fabricmc.fabric.api.client.particle.v1.ParticleFactoryRegistry;
|
||||
import net.fabricmc.fabric.api.client.rendereregistry.v1.EntityRendererRegistry;
|
||||
import net.fabricmc.fabric.api.client.screenhandler.v1.ScreenRegistry;
|
||||
import net.fabricmc.fabric.api.event.client.ClientSpriteRegistryCallback;
|
||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.options.KeyBinding;
|
||||
import net.minecraft.client.render.entity.ItemEntityRenderer;
|
||||
import net.minecraft.client.render.model.BakedModel;
|
||||
import net.minecraft.client.render.model.UnbakedModel;
|
||||
import net.minecraft.client.util.SpriteIdentifier;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.integrated.IntegratedServer;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.hit.HitResult;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Collection;
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public final class AppEngClient extends AppEngBase {
|
||||
@@ -182,8 +184,7 @@ public final class AppEngClient extends AppEngBase {
|
||||
|
||||
ModelsReloadCallback.EVENT.register(this::onModelsReloaded);
|
||||
|
||||
callDeferredBootstrapComponents(IClientSetupComponent.class,
|
||||
IClientSetupComponent::setup);
|
||||
callDeferredBootstrapComponents(IClientSetupComponent.class, IClientSetupComponent::setup);
|
||||
registerModelProviders();
|
||||
registerParticleRenderers();
|
||||
registerEntityRenderers();
|
||||
@@ -191,7 +192,8 @@ public final class AppEngClient extends AppEngBase {
|
||||
registerTextures();
|
||||
registerScreens();
|
||||
|
||||
// On the client, we'll register for server startup/shutdown to properly setup WorldData
|
||||
// On the client, we'll register for server startup/shutdown to properly setup
|
||||
// WorldData
|
||||
// each time the integrated server starts&stops
|
||||
ServerLifecycleEvents.SERVER_STARTED.register(WorldData::onServerStarting);
|
||||
ServerLifecycleEvents.SERVER_STOPPING.register(server -> WorldData.instance().onServerStopping());
|
||||
@@ -265,8 +267,7 @@ public final class AppEngClient extends AppEngBase {
|
||||
|
||||
final int range = 16 * 16;
|
||||
|
||||
client.worldRenderer.scheduleBlockRenders(x - range, y - range, z - range, x + range, y + range,
|
||||
z + range);
|
||||
client.worldRenderer.scheduleBlockRenders(x - range, y - range, z - range, x + range, y + range, z + range);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -295,7 +296,8 @@ public final class AppEngClient extends AppEngBase {
|
||||
|
||||
registry.register(TinyTNTPrimedEntity.TYPE, (dispatcher, context) -> new TinyTNTPrimedRenderer(dispatcher));
|
||||
|
||||
EntityRendererRegistry.Factory itemEntityFactory = (dispatcher, context) -> new ItemEntityRenderer(dispatcher, context.getItemRenderer());
|
||||
EntityRendererRegistry.Factory itemEntityFactory = (dispatcher, context) -> new ItemEntityRenderer(dispatcher,
|
||||
context.getItemRenderer());
|
||||
registry.register(SingularityEntity.TYPE, itemEntityFactory);
|
||||
registry.register(GrowingCrystalEntity.TYPE, itemEntityFactory);
|
||||
registry.register(ChargedQuartzEntity.TYPE, itemEntityFactory);
|
||||
@@ -316,10 +318,7 @@ public final class AppEngClient extends AppEngBase {
|
||||
}
|
||||
|
||||
public void registerTextures() {
|
||||
Stream<Collection<SpriteIdentifier>> sprites = Stream.of(
|
||||
SkyChestTESR.SPRITES,
|
||||
InscriberTESR.SPRITES
|
||||
);
|
||||
Stream<Collection<SpriteIdentifier>> sprites = Stream.of(SkyChestTESR.SPRITES, InscriberTESR.SPRITES);
|
||||
|
||||
// Group every needed sprite by atlas, since every atlas has their own event
|
||||
Map<Identifier, List<SpriteIdentifier>> groupedByAtlas = sprites.flatMap(Collection::stream)
|
||||
@@ -327,12 +326,11 @@ public final class AppEngClient extends AppEngBase {
|
||||
|
||||
// Register to the stitch event for each atlas
|
||||
for (Map.Entry<Identifier, List<SpriteIdentifier>> entry : groupedByAtlas.entrySet()) {
|
||||
ClientSpriteRegistryCallback.event(entry.getKey())
|
||||
.register((spriteAtlasTexture, registry) -> {
|
||||
for (SpriteIdentifier spriteIdentifier : entry.getValue()) {
|
||||
registry.register(spriteIdentifier.getTextureId());
|
||||
}
|
||||
});
|
||||
ClientSpriteRegistryCallback.event(entry.getKey()).register((spriteAtlasTexture, registry) -> {
|
||||
for (SpriteIdentifier spriteIdentifier : entry.getValue()) {
|
||||
registry.register(spriteIdentifier.getTextureId());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -344,27 +342,30 @@ public final class AppEngClient extends AppEngBase {
|
||||
ModelLoadingRegistry.INSTANCE.registerVariantProvider((resourceManager) -> {
|
||||
return (modelIdentifier, modelProviderContext) -> {
|
||||
if (MolecularAssemblerRenderer.LIGHTS_MODEL.equals(modelIdentifier)) {
|
||||
return modelProviderContext.loadModel(new Identifier(modelIdentifier.getNamespace(), modelIdentifier.getPath()));
|
||||
return modelProviderContext
|
||||
.loadModel(new Identifier(modelIdentifier.getNamespace(), modelIdentifier.getPath()));
|
||||
}
|
||||
return null;
|
||||
};
|
||||
});
|
||||
|
||||
ModelLoadingRegistry.INSTANCE.registerResourceProvider(rm -> new CableBusModelLoader((PartModels) Api.INSTANCE.registries().partModels()));
|
||||
ModelLoadingRegistry.INSTANCE.registerResourceProvider(
|
||||
rm -> new CableBusModelLoader((PartModels) Api.INSTANCE.registries().partModels()));
|
||||
|
||||
addBuiltInModel("block/quartz_glass", GlassModel::new);
|
||||
addBuiltInModel("block/sky_compass", SkyCompassModel::new);
|
||||
addBuiltInModel("item/sky_compass", SkyCompassModel::new);
|
||||
addBuiltInModel("block/quartz_glass", GlassModel::new);
|
||||
addBuiltInModel("block/sky_compass", SkyCompassModel::new);
|
||||
addBuiltInModel("item/sky_compass", SkyCompassModel::new);
|
||||
// FIXME FABRIC addBuiltInModel("item/dummy_fluid_item", DummyFluidItemModel::new);
|
||||
addBuiltInModel("item/memory_card", MemoryCardModel::new);
|
||||
addBuiltInModel("item/biometric_card", BiometricCardModel::new);
|
||||
addBuiltInModel("block/drive", DriveModel::new);
|
||||
addBuiltInModel("color_applicator", ColorApplicatorModel::new); // FIXME need to wire this up (this might just not be needed)
|
||||
addBuiltInModel("block/spatial_pylon", SpatialPylonModel::new);
|
||||
addBuiltInModel("block/paint", PaintSplotchesModel::new);
|
||||
addBuiltInModel("block/qnb/qnb_formed", QnbFormedModel::new);
|
||||
addBuiltInModel("part/p2p/p2p_tunnel_frequency", P2PTunnelFrequencyModel::new);
|
||||
addBuiltInModel("item/facade", FacadeItemModel::new);
|
||||
addBuiltInModel("item/memory_card", MemoryCardModel::new);
|
||||
addBuiltInModel("item/biometric_card", BiometricCardModel::new);
|
||||
addBuiltInModel("block/drive", DriveModel::new);
|
||||
addBuiltInModel("color_applicator", ColorApplicatorModel::new); // FIXME need to wire this up (this might just
|
||||
// not be needed)
|
||||
addBuiltInModel("block/spatial_pylon", SpatialPylonModel::new);
|
||||
addBuiltInModel("block/paint", PaintSplotchesModel::new);
|
||||
addBuiltInModel("block/qnb/qnb_formed", QnbFormedModel::new);
|
||||
addBuiltInModel("part/p2p/p2p_tunnel_frequency", P2PTunnelFrequencyModel::new);
|
||||
addBuiltInModel("item/facade", FacadeItemModel::new);
|
||||
|
||||
addPlaneModel("part/annihilation_plane", "part/annihilation_plane");
|
||||
addPlaneModel("part/annihilation_plane_on", "part/annihilation_plane_on");
|
||||
@@ -377,13 +378,20 @@ public final class AppEngClient extends AppEngBase {
|
||||
addPlaneModel("part/formation_plane", "part/formation_plane");
|
||||
addPlaneModel("part/formation_plane_on", "part/formation_plane_on");
|
||||
|
||||
addBuiltInModel("block/crafting/1k_storage_formed", () -> new CraftingCubeModel(AbstractCraftingUnitBlock.CraftingUnitType.STORAGE_1K));
|
||||
addBuiltInModel("block/crafting/4k_storage_formed", () -> new CraftingCubeModel(AbstractCraftingUnitBlock.CraftingUnitType.STORAGE_4K));
|
||||
addBuiltInModel("block/crafting/16k_storage_formed", () -> new CraftingCubeModel(AbstractCraftingUnitBlock.CraftingUnitType.STORAGE_16K));
|
||||
addBuiltInModel("block/crafting/64k_storage_formed", () -> new CraftingCubeModel(AbstractCraftingUnitBlock.CraftingUnitType.STORAGE_64K));
|
||||
addBuiltInModel("block/crafting/accelerator_formed", () -> new CraftingCubeModel(AbstractCraftingUnitBlock.CraftingUnitType.ACCELERATOR));
|
||||
addBuiltInModel("block/crafting/monitor_formed", () -> new CraftingCubeModel(AbstractCraftingUnitBlock.CraftingUnitType.MONITOR));
|
||||
addBuiltInModel("block/crafting/unit_formed", () -> new CraftingCubeModel(AbstractCraftingUnitBlock.CraftingUnitType.UNIT));
|
||||
addBuiltInModel("block/crafting/1k_storage_formed",
|
||||
() -> new CraftingCubeModel(AbstractCraftingUnitBlock.CraftingUnitType.STORAGE_1K));
|
||||
addBuiltInModel("block/crafting/4k_storage_formed",
|
||||
() -> new CraftingCubeModel(AbstractCraftingUnitBlock.CraftingUnitType.STORAGE_4K));
|
||||
addBuiltInModel("block/crafting/16k_storage_formed",
|
||||
() -> new CraftingCubeModel(AbstractCraftingUnitBlock.CraftingUnitType.STORAGE_16K));
|
||||
addBuiltInModel("block/crafting/64k_storage_formed",
|
||||
() -> new CraftingCubeModel(AbstractCraftingUnitBlock.CraftingUnitType.STORAGE_64K));
|
||||
addBuiltInModel("block/crafting/accelerator_formed",
|
||||
() -> new CraftingCubeModel(AbstractCraftingUnitBlock.CraftingUnitType.ACCELERATOR));
|
||||
addBuiltInModel("block/crafting/monitor_formed",
|
||||
() -> new CraftingCubeModel(AbstractCraftingUnitBlock.CraftingUnitType.MONITOR));
|
||||
addBuiltInModel("block/crafting/unit_formed",
|
||||
() -> new CraftingCubeModel(AbstractCraftingUnitBlock.CraftingUnitType.UNIT));
|
||||
// FIXME FABRIC ModelLoaderRegistry.registerLoader(new Identifier(AppEng.MOD_ID, "uvlightmap"), UVLModelLoader.INSTANCE);
|
||||
}
|
||||
|
||||
@@ -395,9 +403,8 @@ public final class AppEngClient extends AppEngBase {
|
||||
}
|
||||
|
||||
private static <T extends UnbakedModel> void addBuiltInModel(String id, Supplier<T> modelFactory) {
|
||||
ModelLoadingRegistry.INSTANCE.registerResourceProvider(
|
||||
resourceManager -> new SimpleModelLoader<>(AppEng.makeId(id), modelFactory)
|
||||
);
|
||||
ModelLoadingRegistry.INSTANCE
|
||||
.registerResourceProvider(resourceManager -> new SimpleModelLoader<>(AppEng.makeId(id), modelFactory));
|
||||
}
|
||||
|
||||
private void registerScreens() {
|
||||
@@ -406,43 +413,43 @@ public final class AppEngClient extends AppEngBase {
|
||||
ScreenRegistry.register(SkyChestContainer.TYPE, SkyChestScreen::new);
|
||||
ScreenRegistry.register(ChestContainer.TYPE, ChestScreen::new);
|
||||
ScreenRegistry.register(WirelessContainer.TYPE, WirelessScreen::new);
|
||||
ScreenRegistry.<MEMonitorableContainer, MEMonitorableScreen<MEMonitorableContainer>>register(
|
||||
MEMonitorableContainer.TYPE, MEMonitorableScreen::new);
|
||||
ScreenRegistry.register(MEPortableCellContainer.TYPE, MEPortableCellScreen::new);
|
||||
ScreenRegistry.register(WirelessTermContainer.TYPE, WirelessTermScreen::new);
|
||||
ScreenRegistry.register(NetworkStatusContainer.TYPE, NetworkStatusScreen::new);
|
||||
ScreenRegistry.<CraftingCPUContainer, CraftingCPUScreen<CraftingCPUContainer>>register(
|
||||
CraftingCPUContainer.TYPE, CraftingCPUScreen::new);
|
||||
ScreenRegistry.register(NetworkToolContainer.TYPE, NetworkToolScreen::new);
|
||||
ScreenRegistry.register(QuartzKnifeContainer.TYPE, QuartzKnifeScreen::new);
|
||||
ScreenRegistry.register(DriveContainer.TYPE, DriveScreen::new);
|
||||
ScreenRegistry.register(VibrationChamberContainer.TYPE, VibrationChamberScreen::new);
|
||||
ScreenRegistry.register(CondenserContainer.TYPE, CondenserScreen::new);
|
||||
ScreenRegistry.register(InterfaceContainer.TYPE, InterfaceScreen::new);
|
||||
ScreenRegistry.register(FluidInterfaceContainer.TYPE, FluidInterfaceScreen::new);
|
||||
ScreenRegistry.<UpgradeableContainer, UpgradeableScreen<UpgradeableContainer>>register(
|
||||
UpgradeableContainer.TYPE, UpgradeableScreen::new);
|
||||
ScreenRegistry.register(FluidIOContainer.TYPE, FluidIOScreen::new);
|
||||
ScreenRegistry.register(IOPortContainer.TYPE, IOPortScreen::new);
|
||||
ScreenRegistry.register(StorageBusContainer.TYPE, StorageBusScreen::new);
|
||||
ScreenRegistry.register(FluidStorageBusContainer.TYPE, FluidStorageBusScreen::new);
|
||||
ScreenRegistry.register(FormationPlaneContainer.TYPE, FormationPlaneScreen::new);
|
||||
ScreenRegistry.register(FluidFormationPlaneContainer.TYPE, FluidFormationPlaneScreen::new);
|
||||
ScreenRegistry.register(PriorityContainer.TYPE, PriorityScreen::new);
|
||||
ScreenRegistry.register(SecurityStationContainer.TYPE, SecurityStationScreen::new);
|
||||
ScreenRegistry.register(CraftingTermContainer.TYPE, CraftingTermScreen::new);
|
||||
ScreenRegistry.register(PatternTermContainer.TYPE, PatternTermScreen::new);
|
||||
ScreenRegistry.register(FluidTerminalContainer.TYPE, FluidTerminalScreen::new);
|
||||
ScreenRegistry.register(LevelEmitterContainer.TYPE, LevelEmitterScreen::new);
|
||||
ScreenRegistry.register(FluidLevelEmitterContainer.TYPE, FluidLevelEmitterScreen::new);
|
||||
ScreenRegistry.register(SpatialIOPortContainer.TYPE, SpatialIOPortScreen::new);
|
||||
ScreenRegistry.register(InscriberContainer.TYPE, InscriberScreen::new);
|
||||
ScreenRegistry.register(CellWorkbenchContainer.TYPE, CellWorkbenchScreen::new);
|
||||
ScreenRegistry.register(MolecularAssemblerContainer.TYPE, MolecularAssemblerScreen::new);
|
||||
ScreenRegistry.register(CraftAmountContainer.TYPE, CraftAmountScreen::new);
|
||||
ScreenRegistry.register(CraftConfirmContainer.TYPE, CraftConfirmScreen::new);
|
||||
ScreenRegistry.register(InterfaceTerminalContainer.TYPE, InterfaceTerminalScreen::new);
|
||||
ScreenRegistry.register(CraftingStatusContainer.TYPE, CraftingStatusScreen::new);
|
||||
ScreenRegistry.<MEMonitorableContainer, MEMonitorableScreen<MEMonitorableContainer>>register(
|
||||
MEMonitorableContainer.TYPE, MEMonitorableScreen::new);
|
||||
ScreenRegistry.register(MEPortableCellContainer.TYPE, MEPortableCellScreen::new);
|
||||
ScreenRegistry.register(WirelessTermContainer.TYPE, WirelessTermScreen::new);
|
||||
ScreenRegistry.register(NetworkStatusContainer.TYPE, NetworkStatusScreen::new);
|
||||
ScreenRegistry.<CraftingCPUContainer, CraftingCPUScreen<CraftingCPUContainer>>register(
|
||||
CraftingCPUContainer.TYPE, CraftingCPUScreen::new);
|
||||
ScreenRegistry.register(NetworkToolContainer.TYPE, NetworkToolScreen::new);
|
||||
ScreenRegistry.register(QuartzKnifeContainer.TYPE, QuartzKnifeScreen::new);
|
||||
ScreenRegistry.register(DriveContainer.TYPE, DriveScreen::new);
|
||||
ScreenRegistry.register(VibrationChamberContainer.TYPE, VibrationChamberScreen::new);
|
||||
ScreenRegistry.register(CondenserContainer.TYPE, CondenserScreen::new);
|
||||
ScreenRegistry.register(InterfaceContainer.TYPE, InterfaceScreen::new);
|
||||
ScreenRegistry.register(FluidInterfaceContainer.TYPE, FluidInterfaceScreen::new);
|
||||
ScreenRegistry.<UpgradeableContainer, UpgradeableScreen<UpgradeableContainer>>register(
|
||||
UpgradeableContainer.TYPE, UpgradeableScreen::new);
|
||||
ScreenRegistry.register(FluidIOContainer.TYPE, FluidIOScreen::new);
|
||||
ScreenRegistry.register(IOPortContainer.TYPE, IOPortScreen::new);
|
||||
ScreenRegistry.register(StorageBusContainer.TYPE, StorageBusScreen::new);
|
||||
ScreenRegistry.register(FluidStorageBusContainer.TYPE, FluidStorageBusScreen::new);
|
||||
ScreenRegistry.register(FormationPlaneContainer.TYPE, FormationPlaneScreen::new);
|
||||
ScreenRegistry.register(FluidFormationPlaneContainer.TYPE, FluidFormationPlaneScreen::new);
|
||||
ScreenRegistry.register(PriorityContainer.TYPE, PriorityScreen::new);
|
||||
ScreenRegistry.register(SecurityStationContainer.TYPE, SecurityStationScreen::new);
|
||||
ScreenRegistry.register(CraftingTermContainer.TYPE, CraftingTermScreen::new);
|
||||
ScreenRegistry.register(PatternTermContainer.TYPE, PatternTermScreen::new);
|
||||
ScreenRegistry.register(FluidTerminalContainer.TYPE, FluidTerminalScreen::new);
|
||||
ScreenRegistry.register(LevelEmitterContainer.TYPE, LevelEmitterScreen::new);
|
||||
ScreenRegistry.register(FluidLevelEmitterContainer.TYPE, FluidLevelEmitterScreen::new);
|
||||
ScreenRegistry.register(SpatialIOPortContainer.TYPE, SpatialIOPortScreen::new);
|
||||
ScreenRegistry.register(InscriberContainer.TYPE, InscriberScreen::new);
|
||||
ScreenRegistry.register(CellWorkbenchContainer.TYPE, CellWorkbenchScreen::new);
|
||||
ScreenRegistry.register(MolecularAssemblerContainer.TYPE, MolecularAssemblerScreen::new);
|
||||
ScreenRegistry.register(CraftAmountContainer.TYPE, CraftAmountScreen::new);
|
||||
ScreenRegistry.register(CraftConfirmContainer.TYPE, CraftConfirmScreen::new);
|
||||
ScreenRegistry.register(InterfaceTerminalContainer.TYPE, InterfaceTerminalScreen::new);
|
||||
ScreenRegistry.register(CraftingStatusContainer.TYPE, CraftingStatusScreen::new);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@ import java.util.Locale;
|
||||
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.screen.slot.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.screen.slot.Slot;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
|
||||
@@ -61,8 +61,7 @@ public abstract class AEBaseMEScreen<T extends AEBaseContainer> extends AEBaseSc
|
||||
if (myStack.getStackSize() > bigNumber || (myStack.getStackSize() > 1 && stack.isDamaged())) {
|
||||
final String formattedAmount = NumberFormat.getNumberInstance(Locale.US)
|
||||
.format(myStack.getStackSize());
|
||||
currentToolTip.add(ButtonToolTips.ItemsStored.text(formattedAmount)
|
||||
.formatted(Formatting.GRAY));
|
||||
currentToolTip.add(ButtonToolTips.ItemsStored.text(formattedAmount).formatted(Formatting.GRAY));
|
||||
}
|
||||
|
||||
if (myStack.getCountRequestable() > 0) {
|
||||
|
||||
@@ -18,9 +18,47 @@
|
||||
|
||||
package appeng.client.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.base.Stopwatch;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.Element;
|
||||
import net.minecraft.client.gui.screen.ingame.HandledScreen;
|
||||
import net.minecraft.client.gui.widget.AbstractButtonWidget;
|
||||
import net.minecraft.client.network.ClientPlayerEntity;
|
||||
import net.minecraft.client.render.BufferBuilder;
|
||||
import net.minecraft.client.render.Tessellator;
|
||||
import net.minecraft.client.render.VertexFormats;
|
||||
import net.minecraft.client.util.InputUtil;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.screen.ScreenHandler;
|
||||
import net.minecraft.screen.slot.Slot;
|
||||
import net.minecraft.screen.slot.SlotActionType;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.Style;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import alexiil.mc.lib.attributes.fluid.render.FluidRenderFace;
|
||||
import alexiil.mc.lib.attributes.fluid.render.FluidVolumeRenderer;
|
||||
import alexiil.mc.lib.attributes.fluid.volume.FluidVolume;
|
||||
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.client.gui.widgets.CustomSlotWidget;
|
||||
@@ -52,40 +90,6 @@ import appeng.fluids.client.render.FluidStackSizeRenderer;
|
||||
import appeng.fluids.container.slots.IMEFluidSlot;
|
||||
import appeng.helpers.InventoryAction;
|
||||
import appeng.mixins.SlotMixin;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.base.Stopwatch;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.Element;
|
||||
import net.minecraft.client.gui.screen.ingame.HandledScreen;
|
||||
import net.minecraft.client.gui.widget.AbstractButtonWidget;
|
||||
import net.minecraft.client.network.ClientPlayerEntity;
|
||||
import net.minecraft.client.render.BufferBuilder;
|
||||
import net.minecraft.client.render.Tessellator;
|
||||
import net.minecraft.client.render.VertexFormats;
|
||||
import net.minecraft.client.util.InputUtil;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.screen.ScreenHandler;
|
||||
import net.minecraft.screen.slot.Slot;
|
||||
import net.minecraft.screen.slot.SlotActionType;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.Style;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
import net.minecraft.util.Identifier;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public abstract class AEBaseScreen<T extends AEBaseContainer> extends HandledScreen<T> {
|
||||
|
||||
@@ -161,7 +165,8 @@ public abstract class AEBaseScreen<T extends AEBaseContainer> extends HandledScr
|
||||
}
|
||||
}
|
||||
|
||||
protected void drawGuiSlot(MatrixStack matrices, CustomSlotWidget slot, int mouseX, int mouseY, float partialTicks) {
|
||||
protected void drawGuiSlot(MatrixStack matrices, CustomSlotWidget slot, int mouseX, int mouseY,
|
||||
float partialTicks) {
|
||||
if (slot.isSlotEnabled()) {
|
||||
final int left = slot.xPos();
|
||||
final int top = slot.yPos();
|
||||
@@ -252,13 +257,13 @@ public abstract class AEBaseScreen<T extends AEBaseContainer> extends HandledScr
|
||||
if (optionalSlot.isRenderDisabled()) {
|
||||
final AppEngSlot aeSlot = (AppEngSlot) slot;
|
||||
if (aeSlot.isSlotEnabled()) {
|
||||
drawTexture(matrices, ox + aeSlot.x - 1, oy + aeSlot.y - 1,
|
||||
optionalSlot.getSourceX() - 1, optionalSlot.getSourceY() - 1, 18, 18);
|
||||
drawTexture(matrices, ox + aeSlot.x - 1, oy + aeSlot.y - 1, optionalSlot.getSourceX() - 1,
|
||||
optionalSlot.getSourceY() - 1, 18, 18);
|
||||
} else {
|
||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 0.4F);
|
||||
RenderSystem.enableBlend();
|
||||
drawTexture(matrices, ox + aeSlot.x - 1, oy + aeSlot.y - 1,
|
||||
optionalSlot.getSourceX() - 1, optionalSlot.getSourceY() - 1, 18, 18);
|
||||
drawTexture(matrices, ox + aeSlot.x - 1, oy + aeSlot.y - 1, optionalSlot.getSourceX() - 1,
|
||||
optionalSlot.getSourceY() - 1, 18, 18);
|
||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
@@ -314,8 +319,8 @@ public abstract class AEBaseScreen<T extends AEBaseContainer> extends HandledScr
|
||||
if (this.drag_click.size() > 1) {
|
||||
for (final Slot dr : this.drag_click) {
|
||||
final InventoryActionPacket p = new InventoryActionPacket(
|
||||
mouseButton == 0 ? InventoryAction.PICKUP_OR_SET_DOWN : InventoryAction.PLACE_SINGLE,
|
||||
dr.id, 0);
|
||||
mouseButton == 0 ? InventoryAction.PICKUP_OR_SET_DOWN : InventoryAction.PLACE_SINGLE, dr.id,
|
||||
0);
|
||||
NetworkHandler.instance().sendToServer(p);
|
||||
}
|
||||
}
|
||||
@@ -329,7 +334,7 @@ public abstract class AEBaseScreen<T extends AEBaseContainer> extends HandledScr
|
||||
// TODO 1.9.4 aftermath - Whole SlotActionType thing, to be checked.
|
||||
@Override
|
||||
protected void onMouseClick(final Slot slot, final int slotIdx, final int mouseButton,
|
||||
final SlotActionType clickType) {
|
||||
final SlotActionType clickType) {
|
||||
final PlayerEntity player = getPlayer();
|
||||
|
||||
if (slot instanceof FakeSlot) {
|
||||
@@ -534,10 +539,8 @@ public abstract class AEBaseScreen<T extends AEBaseContainer> extends HandledScr
|
||||
return true;
|
||||
} else {
|
||||
for (final Slot s : slots) {
|
||||
if (getSlotIndex(s) == j
|
||||
&& s.inventory == this.handler.getPlayerInv()) {
|
||||
NetworkHandler.instance()
|
||||
.sendToServer(new SwapSlotsPacket(s.id, theSlot.id));
|
||||
if (getSlotIndex(s) == j && s.inventory == this.handler.getPlayerInv()) {
|
||||
NetworkHandler.instance().sendToServer(new SwapSlotsPacket(s.id, theSlot.id));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -566,7 +569,8 @@ public abstract class AEBaseScreen<T extends AEBaseContainer> extends HandledScr
|
||||
return null;
|
||||
}
|
||||
|
||||
public abstract void drawBG(MatrixStack matrices, int offsetX, int offsetY, int mouseX, int mouseY, float partialTicks);
|
||||
public abstract void drawBG(MatrixStack matrices, int offsetX, int offsetY, int mouseX, int mouseY,
|
||||
float partialTicks);
|
||||
|
||||
@Override
|
||||
public boolean mouseScrolled(double x, double y, double wheelDelta) {
|
||||
@@ -702,21 +706,16 @@ public abstract class AEBaseScreen<T extends AEBaseContainer> extends HandledScr
|
||||
final float par6 = 16;
|
||||
vb.vertex(par1 + 0, par2 + par6, getZOffset())
|
||||
.color(1.0f, 1.0f, 1.0f, aes.getOpacityOfIcon())
|
||||
.texture((par3 + 0) * f, (par4 + par6) * f1)
|
||||
.next();
|
||||
.texture((par3 + 0) * f, (par4 + par6) * f1).next();
|
||||
final float par5 = 16;
|
||||
vb.vertex(par1 + par5, par2 + par6, getZOffset())
|
||||
.color(1.0f, 1.0f, 1.0f, aes.getOpacityOfIcon())
|
||||
.texture((par3 + par5) * f, (par4 + par6) * f1)
|
||||
.next();
|
||||
.texture((par3 + par5) * f, (par4 + par6) * f1).next();
|
||||
vb.vertex(par1 + par5, par2 + 0, getZOffset())
|
||||
.color(1.0f, 1.0f, 1.0f, aes.getOpacityOfIcon())
|
||||
.texture((par3 + par5) * f, (par4 + 0) * f1)
|
||||
.next();
|
||||
vb.vertex(par1 + 0, par2 + 0, getZOffset())
|
||||
.color(1.0f, 1.0f, 1.0f, aes.getOpacityOfIcon())
|
||||
.texture((par3 + 0) * f, (par4 + 0) * f1)
|
||||
.next();
|
||||
.texture((par3 + par5) * f, (par4 + 0) * f1).next();
|
||||
vb.vertex(par1 + 0, par2 + 0, getZOffset()).color(1.0f, 1.0f, 1.0f, aes.getOpacityOfIcon())
|
||||
.texture((par3 + 0) * f, (par4 + 0) * f1).next();
|
||||
tessellator.draw();
|
||||
|
||||
} catch (final Exception err) {
|
||||
@@ -728,9 +727,8 @@ public abstract class AEBaseScreen<T extends AEBaseContainer> extends HandledScr
|
||||
if (!is.isEmpty() && s instanceof AppEngSlot) {
|
||||
AppEngSlot aeSlot = (AppEngSlot) s;
|
||||
if (aeSlot.getIsValid() == CalculatedValidity.NotAvailable) {
|
||||
boolean isValid = s.canInsert(is) || s instanceof OutputSlot
|
||||
|| s instanceof AppEngCraftingSlot || s instanceof DisabledSlot
|
||||
|| s instanceof InaccessibleSlot || s instanceof FakeSlot
|
||||
boolean isValid = s.canInsert(is) || s instanceof OutputSlot || s instanceof AppEngCraftingSlot
|
||||
|| s instanceof DisabledSlot || s instanceof InaccessibleSlot || s instanceof FakeSlot
|
||||
|| s instanceof RestrictedInputSlot || s instanceof SlotDisconnected;
|
||||
if (isValid && s instanceof RestrictedInputSlot) {
|
||||
try {
|
||||
|
||||
@@ -4,15 +4,17 @@ package appeng.client.gui;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import appeng.client.me.SlotME;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.screen.slot.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.screen.slot.Slot;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import appeng.client.me.SlotME;
|
||||
|
||||
/**
|
||||
* A proxy for a slot that will always return an itemstack with size 1, if there
|
||||
* is an item in the slot. Used to prevent the default item count from
|
||||
|
||||
@@ -5,8 +5,9 @@ import java.util.function.Consumer;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.render.item.ItemRenderer;
|
||||
import net.minecraft.screen.ScreenHandlerType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.screen.ScreenHandlerType;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
import appeng.api.definitions.IDefinitions;
|
||||
import appeng.api.definitions.IParts;
|
||||
@@ -26,7 +27,6 @@ import appeng.parts.reporting.CraftingTerminalPart;
|
||||
import appeng.parts.reporting.PatternTerminalPart;
|
||||
import appeng.parts.reporting.TerminalPart;
|
||||
import appeng.tile.storage.ChestBlockEntity;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
/**
|
||||
* Utility class for sub-screens of other containers that allow returning to the
|
||||
@@ -99,8 +99,8 @@ final class AESubScreen {
|
||||
label = previousContainerIcon.getName();
|
||||
}
|
||||
ItemRenderer itemRenderer = gui.getClient().getItemRenderer();
|
||||
TabButton button = new TabButton(gui.getX() + x, gui.getY() + y, previousContainerIcon, label,
|
||||
itemRenderer, btn -> goBack());
|
||||
TabButton button = new TabButton(gui.getX() + x, gui.getY() + y, previousContainerIcon, label, itemRenderer,
|
||||
btn -> goBack());
|
||||
buttonAdder.accept(button);
|
||||
return button;
|
||||
}
|
||||
|
||||
@@ -43,35 +43,33 @@ public class CellWorkbenchScreen extends UpgradeableScreen<CellWorkbenchContaine
|
||||
|
||||
private ToggleButton copyMode;
|
||||
|
||||
public CellWorkbenchScreen(CellWorkbenchContainer container, PlayerInventory playerInventory,
|
||||
Text title) {
|
||||
public CellWorkbenchScreen(CellWorkbenchContainer container, PlayerInventory playerInventory, Text title) {
|
||||
super(container, playerInventory, title);
|
||||
this.backgroundHeight = 251;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addButtons() {
|
||||
this.fuzzyMode = this.addButton(new SettingToggleButton<>(this.x - 18, this.y + 68,
|
||||
Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL, this::toggleFuzzyMode));
|
||||
this.addButton(
|
||||
new ActionButton(this.x - 18, this.y + 28, ActionItems.WRENCH, act1 -> action("Partition")));
|
||||
this.fuzzyMode = this.addButton(new SettingToggleButton<>(this.x - 18, this.y + 68, Settings.FUZZY_MODE,
|
||||
FuzzyMode.IGNORE_ALL, this::toggleFuzzyMode));
|
||||
this.addButton(new ActionButton(this.x - 18, this.y + 28, ActionItems.WRENCH, act1 -> action("Partition")));
|
||||
this.addButton(new ActionButton(this.x - 18, this.y + 8, ActionItems.CLOSE, act -> action("Clear")));
|
||||
this.copyMode = this.addButton(new ToggleButton(this.x - 18, this.y + 48, 11 * 16 + 5, 12 * 16 + 5,
|
||||
GuiText.CopyMode.text(), GuiText.CopyModeDesc.text(), act -> action("CopyMode")));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
|
||||
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY,
|
||||
float partialTicks) {
|
||||
this.handleButtonVisibility();
|
||||
|
||||
this.bindTexture(this.getBackground());
|
||||
drawTexture(matrices, offsetX, offsetY, 0, 0, 211 - 34, this.backgroundHeight);
|
||||
if (this.drawUpgrades()) {
|
||||
if (this.handler.availableUpgrades() <= 8) {
|
||||
drawTexture(matrices, offsetX + 177, offsetY, 177, 0, 35,
|
||||
7 + this.handler.availableUpgrades() * 18);
|
||||
drawTexture(matrices, offsetX + 177, offsetY + (7 + (this.handler.availableUpgrades()) * 18),
|
||||
177, 151, 35, 7);
|
||||
drawTexture(matrices, offsetX + 177, offsetY, 177, 0, 35, 7 + this.handler.availableUpgrades() * 18);
|
||||
drawTexture(matrices, offsetX + 177, offsetY + (7 + (this.handler.availableUpgrades()) * 18), 177, 151,
|
||||
35, 7);
|
||||
} else if (this.handler.availableUpgrades() <= 16) {
|
||||
drawTexture(matrices, offsetX + 177, offsetY, 177, 0, 35, 7 + 8 * 18);
|
||||
drawTexture(matrices, offsetX + 177, offsetY + (7 + (8) * 18), 177, 151, 35, 7);
|
||||
@@ -81,8 +79,7 @@ public class CellWorkbenchScreen extends UpgradeableScreen<CellWorkbenchContaine
|
||||
if (dx == 8) {
|
||||
drawTexture(matrices, offsetX + 177 + 27, offsetY + (7 + (dx) * 18), 186, 151, 35 - 8, 7);
|
||||
} else {
|
||||
drawTexture(matrices, offsetX + 177 + 27 + 4, offsetY + (7 + (dx) * 18), 186 + 4, 151,
|
||||
35 - 8, 7);
|
||||
drawTexture(matrices, offsetX + 177 + 27 + 4, offsetY + (7 + (dx) * 18), 186 + 4, 151, 35 - 8, 7);
|
||||
}
|
||||
} else {
|
||||
drawTexture(matrices, offsetX + 177, offsetY, 177, 0, 35, 7 + 8 * 18);
|
||||
@@ -94,11 +91,10 @@ public class CellWorkbenchScreen extends UpgradeableScreen<CellWorkbenchContaine
|
||||
final int dx = this.handler.availableUpgrades() - 16;
|
||||
drawTexture(matrices, offsetX + 177 + 27 + 18, offsetY, 186, 0, 35 - 8, 7 + dx * 18);
|
||||
if (dx == 8) {
|
||||
drawTexture(matrices, offsetX + 177 + 27 + 18, offsetY + (7 + (dx) * 18), 186, 151, 35 - 8,
|
||||
7);
|
||||
drawTexture(matrices, offsetX + 177 + 27 + 18, offsetY + (7 + (dx) * 18), 186, 151, 35 - 8, 7);
|
||||
} else {
|
||||
drawTexture(matrices, offsetX + 177 + 27 + 18 + 4, offsetY + (7 + (dx) * 18), 186 + 4, 151,
|
||||
35 - 8, 7);
|
||||
drawTexture(matrices, offsetX + 177 + 27 + 18 + 4, offsetY + (7 + (dx) * 18), 186 + 4, 151, 35 - 8,
|
||||
7);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
|
||||
import appeng.client.gui.AEBaseScreen;
|
||||
import appeng.client.gui.widgets.TabButton;
|
||||
import appeng.container.implementations.ChestContainer;
|
||||
@@ -42,8 +41,8 @@ public class ChestScreen extends AEBaseScreen<ChestContainer> {
|
||||
public void init() {
|
||||
super.init();
|
||||
|
||||
this.addButton(new TabButton(this.x + 154, this.y, 2 + 4 * 16, GuiText.Priority.text(),
|
||||
this.itemRenderer, btn -> openPriority()));
|
||||
this.addButton(new TabButton(this.x + 154, this.y, 2 + 4 * 16, GuiText.Priority.text(), this.itemRenderer,
|
||||
btn -> openPriority()));
|
||||
}
|
||||
|
||||
private void openPriority() {
|
||||
@@ -57,7 +56,8 @@ public class ChestScreen extends AEBaseScreen<ChestContainer> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
|
||||
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY,
|
||||
float partialTicks) {
|
||||
this.bindTexture("guis/chest.png");
|
||||
drawTexture(matrices, offsetX, offsetY, 0, 0, this.backgroundWidth, this.backgroundHeight);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
|
||||
import appeng.api.config.CondenserOutput;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.client.gui.AEBaseScreen;
|
||||
@@ -49,8 +48,8 @@ public class CondenserScreen extends AEBaseScreen<CondenserContainer> {
|
||||
this.mode = new ServerSettingToggleButton<>(128 + this.x, 52 + this.y, Settings.CONDENSER_OUTPUT,
|
||||
this.handler.getOutput());
|
||||
|
||||
this.addButton(new ProgressBar(this.handler, "guis/condenser.png", 120 + this.x, 25 + this.y, 178,
|
||||
25, 6, 18, Direction.VERTICAL, GuiText.StoredEnergy.text()));
|
||||
this.addButton(new ProgressBar(this.handler, "guis/condenser.png", 120 + this.x, 25 + this.y, 178, 25, 6, 18,
|
||||
Direction.VERTICAL, GuiText.StoredEnergy.text()));
|
||||
this.addButton(this.mode);
|
||||
}
|
||||
|
||||
@@ -64,7 +63,8 @@ public class CondenserScreen extends AEBaseScreen<CondenserContainer> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
|
||||
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY,
|
||||
float partialTicks) {
|
||||
this.bindTexture("guis/condenser.png");
|
||||
|
||||
drawTexture(matrices, offsetX, offsetY, 0, 0, this.backgroundWidth, this.backgroundHeight);
|
||||
|
||||
@@ -23,7 +23,6 @@ import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
|
||||
import appeng.client.gui.AEBaseScreen;
|
||||
import appeng.client.gui.NumberEntryType;
|
||||
import appeng.container.implementations.CraftAmountContainer;
|
||||
@@ -54,8 +53,8 @@ public class CraftAmountScreen extends AEBaseScreen<CraftAmountContainer> {
|
||||
this.amountToCraft.setMinValue(1);
|
||||
this.amountToCraft.addButtons(children::add, this::addButton);
|
||||
|
||||
this.next = this.addButton(
|
||||
new ButtonWidget(this.x + 128, this.y + 51, 38, 20, GuiText.Next.text(), this::confirm));
|
||||
this.next = this
|
||||
.addButton(new ButtonWidget(this.x + 128, this.y + 51, 38, 20, GuiText.Next.text(), this::confirm));
|
||||
|
||||
subGui.addBackButton(this::addButton, 154, 0);
|
||||
}
|
||||
@@ -71,7 +70,8 @@ public class CraftAmountScreen extends AEBaseScreen<CraftAmountContainer> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
|
||||
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY,
|
||||
float partialTicks) {
|
||||
this.next.setMessage(hasShiftDown() ? GuiText.Start.text() : GuiText.Next.text());
|
||||
|
||||
this.bindTexture("guis/craft_amt.png");
|
||||
|
||||
@@ -33,7 +33,6 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
@@ -171,8 +170,8 @@ public class CraftConfirmScreen extends AEBaseScreen<CraftConfirmContainer> {
|
||||
dsp = GuiText.Simulation.text();
|
||||
} else {
|
||||
dsp = this.handler.getCpuAvailableBytes() > 0
|
||||
? (GuiText.Bytes.withSuffix(": " + this.handler.getCpuAvailableBytes() + " : ").append(
|
||||
GuiText.CoProcessors.text()).append(": " + this.handler.getCpuCoProcessors()))
|
||||
? (GuiText.Bytes.withSuffix(": " + this.handler.getCpuAvailableBytes() + " : ")
|
||||
.append(GuiText.CoProcessors.text()).append(": " + this.handler.getCpuCoProcessors()))
|
||||
: GuiText.Bytes.withSuffix(": N/A : ").append(GuiText.CoProcessors.text()).append(": N/A");
|
||||
}
|
||||
|
||||
@@ -326,7 +325,8 @@ public class CraftConfirmScreen extends AEBaseScreen<CraftConfirmContainer> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
|
||||
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY,
|
||||
float partialTicks) {
|
||||
this.setScrollBar();
|
||||
this.bindTexture("guis/craftingreport.png");
|
||||
drawTexture(matrices, offsetX, offsetY, 0, 0, this.backgroundWidth, this.backgroundHeight);
|
||||
|
||||
@@ -26,15 +26,14 @@ import java.util.concurrent.TimeUnit;
|
||||
import com.google.common.base.Joiner;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import org.apache.commons.lang3.time.DurationFormatUtils;
|
||||
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
|
||||
import appeng.api.config.SortDir;
|
||||
import appeng.api.config.SortOrder;
|
||||
import appeng.api.config.ViewItems;
|
||||
@@ -307,7 +306,8 @@ public class CraftingCPUScreen<T extends CraftingCPUContainer> extends AEBaseScr
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
|
||||
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY,
|
||||
float partialTicks) {
|
||||
this.bindTexture("guis/craftingcpu.png");
|
||||
drawTexture(matrices, offsetX, offsetY, 0, 0, this.backgroundWidth, this.backgroundHeight);
|
||||
}
|
||||
|
||||
@@ -34,8 +34,7 @@ public class CraftingStatusScreen extends CraftingCPUScreen<CraftingStatusContai
|
||||
|
||||
private ButtonWidget selectCPU;
|
||||
|
||||
public CraftingStatusScreen(CraftingStatusContainer container, PlayerInventory playerInventory,
|
||||
Text title) {
|
||||
public CraftingStatusScreen(CraftingStatusContainer container, PlayerInventory playerInventory, Text title) {
|
||||
super(container, playerInventory, title);
|
||||
this.subGui = new AESubScreen(this, container.getTarget());
|
||||
}
|
||||
|
||||
@@ -64,8 +64,8 @@ public class CraftingTermScreen extends MEMonitorableScreen<CraftingTermContaine
|
||||
@Override
|
||||
public void drawFG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
super.drawFG(matrices, offsetX, offsetY, mouseX, mouseY);
|
||||
this.textRenderer.draw(matrices, GuiText.CraftingTerminal.text(), 8, this.backgroundHeight - 96 + 1 - this.getReservedSpace(),
|
||||
4210752);
|
||||
this.textRenderer.draw(matrices, GuiText.CraftingTerminal.text(), 8,
|
||||
this.backgroundHeight - 96 + 1 - this.getReservedSpace(), 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -22,7 +22,6 @@ import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
|
||||
import appeng.client.gui.AEBaseScreen;
|
||||
import appeng.client.gui.widgets.TabButton;
|
||||
import appeng.container.implementations.DriveContainer;
|
||||
@@ -42,8 +41,8 @@ public class DriveScreen extends AEBaseScreen<DriveContainer> {
|
||||
public void init() {
|
||||
super.init();
|
||||
|
||||
this.addButton(new TabButton(this.x + 154, this.y, 2 + 4 * 16, GuiText.Priority.text(),
|
||||
this.itemRenderer, btn -> openPriorityGui()));
|
||||
this.addButton(new TabButton(this.x + 154, this.y, 2 + 4 * 16, GuiText.Priority.text(), this.itemRenderer,
|
||||
btn -> openPriorityGui()));
|
||||
}
|
||||
|
||||
private void openPriorityGui() {
|
||||
@@ -57,7 +56,8 @@ public class DriveScreen extends AEBaseScreen<DriveContainer> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
|
||||
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY,
|
||||
float partialTicks) {
|
||||
this.bindTexture("guis/drive.png");
|
||||
drawTexture(matrices, offsetX, offsetY, 0, 0, this.backgroundWidth, this.backgroundHeight);
|
||||
}
|
||||
|
||||
@@ -38,21 +38,19 @@ public class FormationPlaneScreen extends UpgradeableScreen<FormationPlaneContai
|
||||
|
||||
private SettingToggleButton<YesNo> placeMode;
|
||||
|
||||
public FormationPlaneScreen(FormationPlaneContainer container, PlayerInventory playerInventory,
|
||||
Text title) {
|
||||
public FormationPlaneScreen(FormationPlaneContainer container, PlayerInventory playerInventory, Text title) {
|
||||
super(container, playerInventory, title);
|
||||
this.backgroundHeight = 251;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addButtons() {
|
||||
this.placeMode = new ServerSettingToggleButton<>(this.x - 18, this.y + 28, Settings.PLACE_BLOCK,
|
||||
YesNo.YES);
|
||||
this.placeMode = new ServerSettingToggleButton<>(this.x - 18, this.y + 28, Settings.PLACE_BLOCK, YesNo.YES);
|
||||
this.fuzzyMode = new ServerSettingToggleButton<>(this.x - 18, this.y + 48, Settings.FUZZY_MODE,
|
||||
FuzzyMode.IGNORE_ALL);
|
||||
|
||||
this.addButton(new TabButton(this.x + 154, this.y, 2 + 4 * 16, GuiText.Priority.text(),
|
||||
this.itemRenderer, btn -> openPriorityGui()));
|
||||
this.addButton(new TabButton(this.x + 154, this.y, 2 + 4 * 16, GuiText.Priority.text(), this.itemRenderer,
|
||||
btn -> openPriorityGui()));
|
||||
|
||||
this.addButton(this.placeMode);
|
||||
this.addButton(this.fuzzyMode);
|
||||
|
||||
@@ -22,7 +22,6 @@ import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
|
||||
import appeng.client.gui.AEBaseScreen;
|
||||
import appeng.container.implementations.GrinderContainer;
|
||||
import appeng.core.localization.GuiText;
|
||||
@@ -41,7 +40,8 @@ public class GrinderScreen extends AEBaseScreen<GrinderContainer> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
|
||||
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY,
|
||||
float partialTicks) {
|
||||
this.bindTexture("guis/grinder.png");
|
||||
drawTexture(matrices, offsetX, offsetY, 0, 0, this.backgroundWidth, this.backgroundHeight);
|
||||
}
|
||||
|
||||
@@ -47,13 +47,13 @@ public class IOPortScreen extends UpgradeableScreen<IOPortContainer> {
|
||||
protected void addButtons() {
|
||||
this.fullMode = new ServerSettingToggleButton<>(this.x - 18, this.y + 8, Settings.FULLNESS_MODE,
|
||||
FullnessMode.EMPTY);
|
||||
this.operationMode = new ServerSettingToggleButton<>(this.x + 80, this.y + 17,
|
||||
Settings.OPERATION_MODE, OperationMode.EMPTY);
|
||||
this.operationMode = new ServerSettingToggleButton<>(this.x + 80, this.y + 17, Settings.OPERATION_MODE,
|
||||
OperationMode.EMPTY);
|
||||
|
||||
this.addButton(this.operationMode);
|
||||
this.addButton(this.fullMode);
|
||||
this.redstoneMode = new ServerSettingToggleButton<>(this.x - 18, this.y + 28,
|
||||
Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE);
|
||||
this.redstoneMode = new ServerSettingToggleButton<>(this.x - 18, this.y + 28, Settings.REDSTONE_CONTROLLED,
|
||||
RedstoneMode.IGNORE);
|
||||
addButton(this.redstoneMode);
|
||||
}
|
||||
|
||||
@@ -76,7 +76,8 @@ public class IOPortScreen extends UpgradeableScreen<IOPortContainer> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
|
||||
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY,
|
||||
float partialTicks) {
|
||||
super.drawBG(matrices, offsetX, offsetY, mouseX, mouseY, partialTicks);
|
||||
|
||||
final IDefinitions definitions = Api.instance().definitions();
|
||||
|
||||
@@ -23,7 +23,6 @@ import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
|
||||
import appeng.client.gui.AEBaseScreen;
|
||||
import appeng.client.gui.widgets.ProgressBar;
|
||||
import appeng.client.gui.widgets.ProgressBar.Direction;
|
||||
@@ -54,14 +53,16 @@ public class InscriberScreen extends AEBaseScreen<InscriberContainer> {
|
||||
|
||||
@Override
|
||||
public void drawFG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
this.pb.setFullMsg(new LiteralText(this.handler.getCurrentProgress() * 100 / this.handler.getMaxProgress() + "%"));
|
||||
this.pb.setFullMsg(
|
||||
new LiteralText(this.handler.getCurrentProgress() * 100 / this.handler.getMaxProgress() + "%"));
|
||||
|
||||
this.textRenderer.draw(matrices, this.getGuiDisplayName(GuiText.Inscriber.text()), 8, 6, 4210752);
|
||||
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
|
||||
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY,
|
||||
float partialTicks) {
|
||||
this.bindTexture("guis/inscriber.png");
|
||||
this.pb.x = 135 + this.x;
|
||||
this.pb.y = 39 + this.y;
|
||||
@@ -69,11 +70,11 @@ public class InscriberScreen extends AEBaseScreen<InscriberContainer> {
|
||||
drawTexture(matrices, offsetX, offsetY, 0, 0, 211 - 34, this.backgroundHeight);
|
||||
|
||||
if (this.drawUpgrades()) {
|
||||
drawTexture(matrices, offsetX + 177, offsetY, 177, 0, 35,
|
||||
14 + this.handler.availableUpgrades() * 18);
|
||||
drawTexture(matrices, offsetX + 177, offsetY, 177, 0, 35, 14 + this.handler.availableUpgrades() * 18);
|
||||
}
|
||||
if (this.hasToolbox()) {
|
||||
drawTexture(matrices, offsetX + 178, offsetY + this.backgroundHeight - 90, 178, this.backgroundHeight - 90, 68, 68);
|
||||
drawTexture(matrices, offsetX + 178, offsetY + this.backgroundHeight - 90, 178, this.backgroundHeight - 90,
|
||||
68, 68);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,15 +47,14 @@ public class InterfaceScreen extends UpgradeableScreen<InterfaceContainer> {
|
||||
|
||||
@Override
|
||||
protected void addButtons() {
|
||||
this.addButton(new TabButton(this.x + 154, this.y, 2 + 4 * 16, GuiText.Priority.text(),
|
||||
this.itemRenderer, btn -> openPriorityGui()));
|
||||
this.addButton(new TabButton(this.x + 154, this.y, 2 + 4 * 16, GuiText.Priority.text(), this.itemRenderer,
|
||||
btn -> openPriorityGui()));
|
||||
|
||||
this.blockMode = new ServerSettingToggleButton<>(this.x - 18, this.y + 8, Settings.BLOCK, YesNo.NO);
|
||||
this.addButton(this.blockMode);
|
||||
|
||||
this.interfaceMode = new ToggleButton(this.x - 18, this.y + 26, 84, 85,
|
||||
GuiText.InterfaceTerminal.text(), GuiText.InterfaceTerminalHint.text(),
|
||||
btn -> selectNextInterfaceMode());
|
||||
this.interfaceMode = new ToggleButton(this.x - 18, this.y + 26, 84, 85, GuiText.InterfaceTerminal.text(),
|
||||
GuiText.InterfaceTerminalHint.text(), btn -> selectNextInterfaceMode());
|
||||
this.addButton(this.interfaceMode);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,20 +27,20 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import alexiil.mc.lib.attributes.Simulation;
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import net.minecraft.client.util.InputUtil;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
import net.minecraft.client.util.InputUtil;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
import alexiil.mc.lib.attributes.Simulation;
|
||||
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.client.ActionKey;
|
||||
@@ -69,8 +69,7 @@ public class InterfaceTerminalScreen extends AEBaseScreen<InterfaceTerminalConta
|
||||
private boolean refreshList = false;
|
||||
private AETextField searchField;
|
||||
|
||||
public InterfaceTerminalScreen(InterfaceTerminalContainer container, PlayerInventory playerInventory,
|
||||
Text title) {
|
||||
public InterfaceTerminalScreen(InterfaceTerminalContainer container, PlayerInventory playerInventory, Text title) {
|
||||
super(container, playerInventory, title);
|
||||
final Scrollbar scrollbar = new Scrollbar();
|
||||
this.setScrollBar(scrollbar);
|
||||
@@ -142,7 +141,8 @@ public class InterfaceTerminalScreen extends AEBaseScreen<InterfaceTerminalConta
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
|
||||
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY,
|
||||
float partialTicks) {
|
||||
this.bindTexture("guis/interfaceterminal.png");
|
||||
drawTexture(matrices, offsetX, offsetY, 0, 0, this.backgroundWidth, this.backgroundHeight);
|
||||
|
||||
@@ -223,7 +223,8 @@ public class InterfaceTerminalScreen extends AEBaseScreen<InterfaceTerminalConta
|
||||
for (int x = 0; x < current.getInventory().getSlotCount(); x++) {
|
||||
final String which = Integer.toString(x);
|
||||
if (invData.contains(which)) {
|
||||
current.getInventory().setInvStack(x, ItemStack.fromTag(invData.getCompound(which)), Simulation.ACTION);
|
||||
current.getInventory().setInvStack(x, ItemStack.fromTag(invData.getCompound(which)),
|
||||
Simulation.ACTION);
|
||||
}
|
||||
}
|
||||
} catch (final NumberFormatException ignored) {
|
||||
|
||||
@@ -68,12 +68,12 @@ public class LevelEmitterScreen extends UpgradeableScreen<LevelEmitterContainer>
|
||||
protected void addButtons() {
|
||||
this.levelMode = new ServerSettingToggleButton<>(this.x - 18, this.y + 8, Settings.LEVEL_TYPE,
|
||||
LevelType.ITEM_LEVEL);
|
||||
this.redstoneMode = new ServerSettingToggleButton<>(this.x - 18, this.y + 28,
|
||||
Settings.REDSTONE_EMITTER, RedstoneMode.LOW_SIGNAL);
|
||||
this.redstoneMode = new ServerSettingToggleButton<>(this.x - 18, this.y + 28, Settings.REDSTONE_EMITTER,
|
||||
RedstoneMode.LOW_SIGNAL);
|
||||
this.fuzzyMode = new ServerSettingToggleButton<>(this.x - 18, this.y + 48, Settings.FUZZY_MODE,
|
||||
FuzzyMode.IGNORE_ALL);
|
||||
this.craftingMode = new ServerSettingToggleButton<>(this.x - 18, this.y + 48,
|
||||
Settings.CRAFT_VIA_REDSTONE, YesNo.NO);
|
||||
this.craftingMode = new ServerSettingToggleButton<>(this.x - 18, this.y + 48, Settings.CRAFT_VIA_REDSTONE,
|
||||
YesNo.NO);
|
||||
this.addButton(this.levelMode);
|
||||
this.addButton(this.redstoneMode);
|
||||
this.addButton(this.craftingMode);
|
||||
@@ -100,14 +100,16 @@ public class LevelEmitterScreen extends UpgradeableScreen<LevelEmitterContainer>
|
||||
|
||||
if (notCraftingMode) {
|
||||
if (currentLevelMode == LevelType.ENERGY_LEVEL) {
|
||||
this.textRenderer.draw(matrices, PowerUnits.AE.textComponent().getString(), 110, 44, COLOR_DARK_GRAY);
|
||||
this.textRenderer.draw(matrices, PowerUnits.AE.textComponent().getString(), 110, 44,
|
||||
COLOR_DARK_GRAY);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
|
||||
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY,
|
||||
float partialTicks) {
|
||||
super.drawBG(matrices, offsetX, offsetY, mouseX, mouseY, partialTicks);
|
||||
this.level.render(matrices, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
|
||||
@@ -20,13 +20,12 @@ package appeng.client.gui.implementations;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import appeng.mixins.SlotMixin;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.screen.slot.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.screen.slot.Slot;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
import appeng.api.config.SearchBoxMode;
|
||||
@@ -63,6 +62,7 @@ import appeng.core.sync.packets.ConfigValuePacket;
|
||||
import appeng.core.sync.packets.SwitchGuisPacket;
|
||||
import appeng.helpers.WirelessTerminalGuiObject;
|
||||
import appeng.integration.abstraction.ReiFacade;
|
||||
import appeng.mixins.SlotMixin;
|
||||
import appeng.parts.reporting.AbstractTerminalPart;
|
||||
import appeng.tile.misc.SecurityStationBlockEntity;
|
||||
import appeng.util.IConfigManagerHost;
|
||||
@@ -205,13 +205,13 @@ public class MEMonitorableScreen<T extends MEMonitorableContainer> extends AEBas
|
||||
}
|
||||
|
||||
if (this.viewCell || this instanceof WirelessTermScreen) {
|
||||
this.viewModeToggle = this.addButton(new SettingToggleButton<>(this.x - 18, offset,
|
||||
Settings.VIEW_MODE, getSortDisplay(), this::toggleServerSetting));
|
||||
this.viewModeToggle = this.addButton(new SettingToggleButton<>(this.x - 18, offset, Settings.VIEW_MODE,
|
||||
getSortDisplay(), this::toggleServerSetting));
|
||||
offset += 20;
|
||||
}
|
||||
|
||||
this.addButton(this.sortDirToggle = new SettingToggleButton<>(this.x - 18, offset,
|
||||
Settings.SORT_DIRECTION, getSortDir(), this::toggleServerSetting));
|
||||
this.addButton(this.sortDirToggle = new SettingToggleButton<>(this.x - 18, offset, Settings.SORT_DIRECTION,
|
||||
getSortDir(), this::toggleServerSetting));
|
||||
offset += 20;
|
||||
|
||||
SearchBoxMode searchMode = AEConfig.instance().getTerminalSearchMode();
|
||||
@@ -225,8 +225,7 @@ public class MEMonitorableScreen<T extends MEMonitorableContainer> extends AEBas
|
||||
this::toggleTerminalStyle));
|
||||
}
|
||||
|
||||
this.searchField = new AETextField(this.textRenderer, this.x + Math.max(80, this.offsetX), this.y + 4, 90,
|
||||
12);
|
||||
this.searchField = new AETextField(this.textRenderer, this.x + Math.max(80, this.offsetX), this.y + 4, 90, 12);
|
||||
this.searchField.setHasBorder(false);
|
||||
this.searchField.setMaxLength(25);
|
||||
this.searchField.setEditableColor(0xFFFFFF);
|
||||
@@ -319,7 +318,8 @@ public class MEMonitorableScreen<T extends MEMonitorableContainer> extends AEBas
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
|
||||
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY,
|
||||
float partialTicks) {
|
||||
|
||||
this.bindTexture(this.getBackground());
|
||||
final int x_width = 197;
|
||||
@@ -333,8 +333,8 @@ public class MEMonitorableScreen<T extends MEMonitorableContainer> extends AEBas
|
||||
drawTexture(matrices, offsetX, offsetY + 18 + x * 18, 0, 18, x_width, 18);
|
||||
}
|
||||
|
||||
drawTexture(matrices, offsetX, offsetY + 16 + this.rows * 18 + this.lowerTextureOffset, 0, 106 - 18 - 18, x_width,
|
||||
99 + this.reservedSpace - this.lowerTextureOffset);
|
||||
drawTexture(matrices, offsetX, offsetY + 16 + this.rows * 18 + this.lowerTextureOffset, 0, 106 - 18 - 18,
|
||||
x_width, 99 + this.reservedSpace - this.lowerTextureOffset);
|
||||
|
||||
if (this.viewCell) {
|
||||
boolean update = false;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user