Port more stuff
This commit is contained in:
@@ -69,6 +69,12 @@ sourceSets {
|
||||
srcDir 'src/generated/resources'
|
||||
}
|
||||
}
|
||||
datagen {
|
||||
compileClasspath += sourceSets.api.output
|
||||
runtimeClasspath += sourceSets.api.output
|
||||
compileClasspath += sourceSets.main.output
|
||||
runtimeClasspath += sourceSets.main.output
|
||||
}
|
||||
unported {
|
||||
compileClasspath += sourceSets.api.output
|
||||
runtimeClasspath += sourceSets.api.output
|
||||
@@ -84,6 +90,7 @@ sourceSets {
|
||||
|
||||
configurations {
|
||||
apiCompile.extendsFrom(compileClasspath)
|
||||
datagenCompile.extendsFrom(compileClasspath)
|
||||
unportedCompile.extendsFrom(compileClasspath)
|
||||
}
|
||||
|
||||
@@ -169,4 +176,16 @@ publishing {
|
||||
url = "https://maven.pkg.github.com/AppliedEnergistics/Applied-Energistics-2"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
import net.fabricmc.loom.task.RunClientTask;
|
||||
|
||||
task generateData(type: RunClientTask, dependsOn: downloadAssets, group: "ae2") {
|
||||
classpath sourceSets.datagen.runtimeClasspath
|
||||
doFirst {
|
||||
sourceSets.datagen.runtimeClasspath.each { println it }
|
||||
sourceSets.main.runtimeClasspath.each { println it }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package appeng.data;
|
||||
|
||||
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 {
|
||||
|
||||
public static void dump() throws Exception {
|
||||
Path output = Paths.get("../src/generated/resources");
|
||||
|
||||
DataGenerator generator = new DataGenerator(output, Collections.emptyList());
|
||||
generator.install(new BlockDropProvider(output));
|
||||
generator.install(new SlabStairRecipes(output));
|
||||
generator.install(new ConventionTagProvider(output));
|
||||
generator.run();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPreLaunch() {
|
||||
Bootstrap.initialize();
|
||||
AEConfig.load(new File("config"));
|
||||
CreativeTab.init(); // Vanilla data gens use item tab associations
|
||||
Api.INSTANCE = new Api();
|
||||
|
||||
try {
|
||||
dump();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.exit(-1);
|
||||
}
|
||||
System.exit(0);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package appeng.forge.data.providers;
|
||||
package appeng.data.providers;
|
||||
|
||||
import net.minecraft.data.DataProvider;
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package appeng.forge.data.providers.loot;
|
||||
package appeng.data.providers.loot;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
@@ -7,6 +7,7 @@ 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;
|
||||
@@ -27,7 +28,6 @@ import net.minecraft.loot.function.SetCountLootFunction;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
import appeng.forge.data.providers.IAE2DataProvider;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.registry.RegistryKey;
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
package appeng.forge.data.providers.recipes;
|
||||
package appeng.data.providers.recipes;
|
||||
|
||||
import appeng.api.definitions.IBlockDefinition;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.forge.data.providers.IAE2DataProvider;
|
||||
import appeng.data.providers.IAE2DataProvider;
|
||||
import com.google.gson.JsonObject;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.data.DataCache;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package appeng.forge.data.providers.tags;
|
||||
package appeng.data.providers.tags;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
import net.minecraft.block.Blocks;
|
||||
+2
-3
@@ -1,7 +1,7 @@
|
||||
package appeng.forge.data.providers.tags;
|
||||
package appeng.data.providers.tags;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
import appeng.forge.data.providers.IAE2DataProvider;
|
||||
import appeng.data.providers.IAE2DataProvider;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonArray;
|
||||
@@ -10,7 +10,6 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.data.DataCache;
|
||||
import net.minecraft.data.DataProvider;
|
||||
import net.minecraft.item.ItemConvertible;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"id": "appliedenergistics2datagen",
|
||||
"version": "1.0.0",
|
||||
"name": "Applied Energistics 2 Datagen",
|
||||
"description": "",
|
||||
"authors": [
|
||||
"TeamAppliedEnergistics"
|
||||
],
|
||||
"contact": {
|
||||
"homepage": "https://ae-mod.info/",
|
||||
"sources": "https://github.com/AppliedEnergistics/Applied-Energistics-2/"
|
||||
},
|
||||
|
||||
"license": "LGPL",
|
||||
"icon": "assets/appliedenergistics2/icon.png",
|
||||
|
||||
"environment": "*",
|
||||
"entrypoints": {
|
||||
"preLaunch": [
|
||||
"appeng.data.Entrypoint"
|
||||
]
|
||||
},
|
||||
"depends": {
|
||||
"fabricloader": ">=0.7.1",
|
||||
"fabric": "*",
|
||||
"minecraft": "1.16.x"
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2018, AlgorithmX2, All rights reserved.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -18,70 +18,61 @@
|
||||
|
||||
package appeng.client.render;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import net.fabricmc.fabric.api.renderer.v1.model.FabricBakedModel;
|
||||
import appeng.client.render.cablebus.FacadeBuilder;
|
||||
import appeng.items.parts.FacadeItem;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import net.fabricmc.fabric.api.renderer.v1.mesh.Mesh;
|
||||
import net.fabricmc.fabric.api.renderer.v1.model.ForwardingBakedModel;
|
||||
import net.fabricmc.fabric.api.renderer.v1.render.RenderContext;
|
||||
import net.minecraft.client.render.model.BakedModel;
|
||||
import net.minecraft.client.render.model.BakedQuad;
|
||||
import net.minecraft.client.render.model.json.ModelOverrideList;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
||||
|
||||
import appeng.client.render.cablebus.FacadeBuilder;
|
||||
import java.util.Objects;
|
||||
import java.util.Random;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* This model used the provided FacadeBuilder to "slice" the item quads for the
|
||||
* facade provided.
|
||||
*
|
||||
* @author covers1624
|
||||
* This baked model class is used as a dispatcher to redirect the renderer to
|
||||
* the *real* model that should be used based on the item stack. A custom Item
|
||||
* Override List is used to accomplish this.
|
||||
*/
|
||||
public class FacadeBakedItemModel extends ForwardingBakedModel implements FabricBakedModel {
|
||||
|
||||
private final ItemStack textureStack;
|
||||
public class FacadeBakedItemModel extends ForwardingBakedModel {
|
||||
private final FacadeBuilder facadeBuilder;
|
||||
private List<BakedQuad> quads = null;
|
||||
private final Int2ObjectMap<Mesh> cache = new Int2ObjectArrayMap<>();
|
||||
|
||||
protected FacadeBakedItemModel(BakedModel base, ItemStack textureStack, FacadeBuilder facadeBuilder) {
|
||||
this.wrapped = base;
|
||||
this.textureStack = textureStack;
|
||||
public FacadeBakedItemModel(BakedModel baseModel, FacadeBuilder facadeBuilder) {
|
||||
this.wrapped = baseModel;
|
||||
this.facadeBuilder = facadeBuilder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVanillaAdapter() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void emitItemQuads(ItemStack stack, Supplier<Random> randomSupplier, RenderContext context) {
|
||||
if (!(stack.getItem() instanceof FacadeItem)) {
|
||||
return;
|
||||
}
|
||||
|
||||
super.emitItemQuads(stack, randomSupplier, context);
|
||||
|
||||
if (quads == null) {
|
||||
quads = new ArrayList<>();
|
||||
quads.addAll(this.facadeBuilder.buildFacadeItemQuads(this.textureStack, Direction.NORTH));
|
||||
quads = Collections.unmodifiableList(quads);
|
||||
FacadeItem itemFacade = (FacadeItem) stack.getItem();
|
||||
ItemStack textureItem = itemFacade.getTextureItem(stack);
|
||||
|
||||
int itemId = Item.getRawId(textureItem.getItem());
|
||||
int hash = Objects.hash(itemId, textureItem.getTag());
|
||||
Mesh mesh = this.cache.get(hash);
|
||||
if (mesh == null) {
|
||||
mesh = this.facadeBuilder.buildFacadeItemQuads(textureItem, Direction.NORTH);
|
||||
this.cache.put(hash, mesh);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasDepth() {
|
||||
return false;
|
||||
}
|
||||
context.meshConsumer().accept(mesh);
|
||||
|
||||
@Override
|
||||
public boolean isSideLit() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBuiltin() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelOverrideList getOverrides() {
|
||||
return ModelOverrideList.EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render;
|
||||
|
||||
import appeng.client.render.cablebus.FacadeBuilder;
|
||||
import appeng.items.parts.FacadeItem;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import net.fabricmc.fabric.api.renderer.v1.model.ForwardingBakedModel;
|
||||
import net.fabricmc.fabric.api.renderer.v1.render.RenderContext;
|
||||
import net.minecraft.client.render.model.BakedModel;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Random;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* This baked model class is used as a dispatcher to redirect the renderer to
|
||||
* the *real* model that should be used based on the item stack. A custom Item
|
||||
* Override List is used to accomplish this.
|
||||
*/
|
||||
public class FacadeDispatcherBakedModel extends ForwardingBakedModel {
|
||||
private final FacadeBuilder facadeBuilder;
|
||||
private final Int2ObjectMap<FacadeBakedItemModel> cache = new Int2ObjectArrayMap<>();
|
||||
|
||||
public FacadeDispatcherBakedModel(BakedModel baseModel, FacadeBuilder facadeBuilder) {
|
||||
this.wrapped = baseModel;
|
||||
this.facadeBuilder = facadeBuilder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVanillaAdapter() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void emitItemQuads(ItemStack stack, Supplier<Random> randomSupplier, RenderContext context) {
|
||||
if (!(stack.getItem() instanceof FacadeItem)) {
|
||||
return;
|
||||
}
|
||||
|
||||
FacadeItem itemFacade = (FacadeItem) stack.getItem();
|
||||
|
||||
ItemStack textureItem = itemFacade.getTextureItem(stack);
|
||||
|
||||
int itemId = Item.getRawId(textureItem.getItem());
|
||||
int hash = Objects.hash(itemId, textureItem.getTag());
|
||||
FacadeBakedItemModel model = FacadeDispatcherBakedModel.this.cache.get(hash);
|
||||
if (model == null) {
|
||||
model = new FacadeBakedItemModel(FacadeDispatcherBakedModel.this.wrapped, textureItem,
|
||||
FacadeDispatcherBakedModel.this.facadeBuilder);
|
||||
FacadeDispatcherBakedModel.this.cache.put(hash, model);
|
||||
}
|
||||
|
||||
context.fallbackConsumer().accept(model);
|
||||
}
|
||||
}
|
||||
@@ -47,7 +47,7 @@ public class FacadeItemModel implements BasicUnbakedModel {
|
||||
BakedModel bakedBaseModel = loader.bake(MODEL_BASE, rotationContainer);
|
||||
FacadeBuilder facadeBuilder = new FacadeBuilder(loader);
|
||||
|
||||
return new FacadeDispatcherBakedModel(bakedBaseModel, facadeBuilder);
|
||||
return new FacadeBakedItemModel(bakedBaseModel, facadeBuilder);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,6 +20,7 @@ package appeng.client.render.cablebus;
|
||||
|
||||
import appeng.api.util.AEAxisAlignedBB;
|
||||
import appeng.core.Api;
|
||||
import appeng.mixins.MinecraftClientAccessor;
|
||||
import appeng.parts.misc.CableAnchorPart;
|
||||
import appeng.thirdparty.codechicken.lib.model.pipeline.transformers.QuadClamper;
|
||||
import appeng.thirdparty.codechicken.lib.model.pipeline.transformers.QuadCornerKicker;
|
||||
@@ -33,10 +34,10 @@ import net.fabricmc.fabric.api.renderer.v1.mesh.MeshBuilder;
|
||||
import net.fabricmc.fabric.api.renderer.v1.mesh.QuadEmitter;
|
||||
import net.fabricmc.fabric.api.renderer.v1.model.ModelHelper;
|
||||
import net.fabricmc.fabric.api.renderer.v1.render.RenderContext;
|
||||
import net.fabricmc.fabric.impl.client.indigo.renderer.mesh.MutableQuadViewImpl;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.color.block.BlockColors;
|
||||
import net.minecraft.client.color.item.ItemColors;
|
||||
import net.minecraft.client.render.block.BlockRenderManager;
|
||||
import net.minecraft.client.render.model.BakedModel;
|
||||
import net.minecraft.client.render.model.BakedQuad;
|
||||
@@ -138,26 +139,9 @@ public class FacadeBuilder {
|
||||
return stems;
|
||||
}
|
||||
|
||||
// private final ThreadLocal<BakedPipeline> pipelines = ThreadLocal.withInitial(() -> BakedPipeline.builder()
|
||||
// // Clamper is responsible for clamping the vertex to the bounds specified.
|
||||
// .addElement("clamper", QuadClamper.FACTORY)
|
||||
// // Strips faces if they match a mask.
|
||||
// .addElement("face_stripper", QuadFaceStripper.FACTORY)
|
||||
// // Kicks the edge inner corners in, solves Z fighting
|
||||
// .addElement("corner_kicker", QuadCornerKicker.FACTORY)
|
||||
// // Re-Interpolates the UV's for the quad.
|
||||
// .addElement("interp", QuadReInterpolator.FACTORY)
|
||||
// // Tints the quad if we need it to. Disabled by default.
|
||||
// .addElement("tinter", QuadTinter.FACTORY, false)
|
||||
// // Overrides the quad's alpha if we are forcing transparent facades.
|
||||
// .addElement("transparent", QuadAlphaOverride.FACTORY, false, e -> e.setAlphaOverride(0x4C / 255F)).build()//
|
||||
// );
|
||||
|
||||
public Mesh getFacadeMesh(CableBusRenderState renderState,
|
||||
Supplier<Random> rand,
|
||||
Function<Identifier, BakedModel> modelLookup) {
|
||||
//FIXME BakedPipeline pipeline = this.pipelines.get();
|
||||
//FIXME Quad collectorQuad = this.collectors.get();
|
||||
boolean transparent = Api.instance().partHelper().getCableRenderMode().transparentFacades;
|
||||
Map<Direction, FacadeRenderState> facadeStates = renderState.getFacades();
|
||||
List<Box> partBoxes = renderState.getBoundingBoxes();
|
||||
@@ -225,7 +209,7 @@ public class FacadeBuilder {
|
||||
tmpBB.maxX -= offset;
|
||||
break;
|
||||
default:
|
||||
throw new RuntimeException("Switch falloff. " + String.valueOf(face));
|
||||
throw new RuntimeException("Switch falloff. " + face);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -299,10 +283,10 @@ public class FacadeBuilder {
|
||||
|
||||
interpolator.transform(emitter);
|
||||
|
||||
// Tints the quad if we need it to. Disabled by default.
|
||||
if (quadTinter != null) {
|
||||
quadTinter.transform(emitter);
|
||||
}
|
||||
// Tints the quad if we need it to. Disabled by default.
|
||||
if (quadTinter != null) {
|
||||
quadTinter.transform(emitter);
|
||||
}
|
||||
|
||||
// // Overrides the quad's alpha if we are forcing transparent facades.
|
||||
// .addElement("transparent", QuadAlphaOverride.FACTORY, false, e -> e.setAlphaOverride(0x4C / 255F)).build()//
|
||||
@@ -311,34 +295,6 @@ public class FacadeBuilder {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME FABRIC List<BakedQuad> modelQuads = new ArrayList<>();
|
||||
// FIXME FABRIC modelQuads.addAll(gatherQuads(model, blockState, rand));
|
||||
|
||||
// FIXME FABRIC // No quads.. Cool, next!
|
||||
// FIXME FABRIC if (modelQuads.isEmpty()) {
|
||||
// FIXME FABRIC continue;
|
||||
// FIXME FABRIC }
|
||||
// FIXME FABRIC
|
||||
// FIXME FABRIC // Grab out pipeline elements.
|
||||
// FIXME FABRIC QuadClamper clamper = pipeline.getElement("clamper", QuadClamper.class);
|
||||
// FIXME FABRIC QuadFaceStripper edgeStripper = pipeline.getElement("face_stripper", QuadFaceStripper.class);
|
||||
// FIXME FABRIC QuadTinter tinter = pipeline.getElement("tinter", QuadTinter.class);
|
||||
// FIXME FABRIC QuadCornerKicker kicker = pipeline.getElement("corner_kicker", QuadCornerKicker.class);
|
||||
// FIXME FABRIC
|
||||
// FIXME FABRIC // Set global element states.
|
||||
// FIXME FABRIC
|
||||
// FIXME FABRIC // Setup the kicker.
|
||||
// FIXME FABRIC kicker.setSide(sideIndex);
|
||||
// FIXME FABRIC kicker.setFacadeMask(facadeMask);
|
||||
// FIXME FABRIC kicker.setBox(fullBounds);
|
||||
// FIXME FABRIC kicker.setThickness(thinFacades ? THIN_THICKNESS : THICK_THICKNESS);
|
||||
// FIXME FABRIC
|
||||
// FIXME FABRIC for (BakedQuad quad : modelQuads) {
|
||||
// FIXME FABRIC // lookup the format in CachedFormat.
|
||||
// FIXME FABRIC CachedFormat format = CachedFormat.lookup(VertexFormats.POSITION_COLOR_TEXTURE_LIGHT_NORMAL);
|
||||
|
||||
// FIXME FABRIC }
|
||||
}
|
||||
|
||||
return meshBuilder.build();
|
||||
@@ -350,12 +306,14 @@ public class FacadeBuilder {
|
||||
*
|
||||
* @return The model.
|
||||
*/
|
||||
public List<BakedQuad> buildFacadeItemQuads(ItemStack textureItem, Direction side) {
|
||||
List<BakedQuad> facadeQuads = new ArrayList<>();
|
||||
public Mesh buildFacadeItemQuads(ItemStack textureItem, Direction side) {
|
||||
|
||||
MeshBuilder meshBuilder = renderer.meshBuilder();
|
||||
QuadEmitter emitter = meshBuilder.getEmitter();
|
||||
|
||||
BakedModel model = MinecraftClient.getInstance().getItemRenderer().getHeldItemModel(textureItem, null,
|
||||
null);
|
||||
List<BakedQuad> modelQuads = gatherQuads(model, null, new Random());
|
||||
List<BakedQuad> modelQuads = model.getQuads(null, null, new Random());
|
||||
|
||||
//FIXME BakedPipeline pipeline = this.pipelines.get();
|
||||
//FIXME Quad collectorQuad = this.collectors.get();
|
||||
@@ -364,7 +322,45 @@ public class FacadeBuilder {
|
||||
// FIXME QuadClamper clamper = pipeline.getElement("clamper", QuadClamper.class);
|
||||
// FIXME QuadTinter tinter = pipeline.getElement("tinter", QuadTinter.class);
|
||||
|
||||
QuadReInterpolator interpolator = new QuadReInterpolator();
|
||||
|
||||
ItemColors itemColors = ((MinecraftClientAccessor) MinecraftClient.getInstance()).getItemColors();
|
||||
QuadClamper clamper = new QuadClamper(THICK_FACADE_BOXES[side.ordinal()]);
|
||||
|
||||
for (int cullFaceIdx = 0; cullFaceIdx <= ModelHelper.NULL_FACE_ID; cullFaceIdx++) {
|
||||
Direction cullFace = ModelHelper.faceFromIndex(cullFaceIdx);
|
||||
List<BakedQuad> quads = model.getQuads(null, cullFace, new Random());
|
||||
|
||||
for (BakedQuad quad : quads) {
|
||||
QuadTinter quadTinter = null;
|
||||
|
||||
// Prebake the color tint into the quad
|
||||
if (quad.getColorIndex() != -1) {
|
||||
quadTinter = new QuadTinter(itemColors.getColorMultiplier(textureItem, quad.getColorIndex()));
|
||||
}
|
||||
|
||||
emitter.fromVanilla(quad.getVertexData(), 0, false);
|
||||
emitter.cullFace(cullFace);
|
||||
emitter.nominalFace(quad.getFace());
|
||||
interpolator.setInputQuad(emitter);
|
||||
|
||||
if (!clamper.transform(emitter)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
interpolator.transform(emitter);
|
||||
|
||||
// Tints the quad if we need it to. Disabled by default.
|
||||
if (quadTinter != null) {
|
||||
quadTinter.transform(emitter);
|
||||
}
|
||||
|
||||
emitter.emit();
|
||||
}
|
||||
}
|
||||
|
||||
for (BakedQuad quad : modelQuads) {
|
||||
|
||||
// Lookup the CachedFormat for this quads format.
|
||||
// FIXME CachedFormat format = CachedFormat.lookup(VertexFormats.POSITION_COLOR_TEXTURE_LIGHT_NORMAL);
|
||||
// Reset the pipeline.
|
||||
@@ -390,17 +386,7 @@ public class FacadeBuilder {
|
||||
// FIXME facadeQuads.add(collectorQuad.bake());
|
||||
// FIXME }
|
||||
}
|
||||
return facadeQuads;
|
||||
}
|
||||
|
||||
// Helper to gather all quads from a model into a list.
|
||||
private static List<BakedQuad> gatherQuads(BakedModel model, BlockState state, Random rand) {
|
||||
List<BakedQuad> modelQuads = new ArrayList<>();
|
||||
for (Direction face : Direction.values()) {
|
||||
modelQuads.addAll(model.getQuads(state, face, rand));
|
||||
}
|
||||
modelQuads.addAll(model.getQuads(state, null, rand));
|
||||
return modelQuads;
|
||||
return meshBuilder.build();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -72,7 +72,7 @@ public final class AEConfig {
|
||||
// Config instance
|
||||
private static AEConfig instance;
|
||||
|
||||
static void load(File configFolder) {
|
||||
public static void load(File configFolder) {
|
||||
if (instance != null) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
@@ -73,7 +73,6 @@ import appeng.fluids.container.FluidLevelEmitterContainer;
|
||||
import appeng.fluids.container.FluidStorageBusContainer;
|
||||
import appeng.fluids.container.FluidTerminalContainer;
|
||||
import appeng.fluids.registries.BasicFluidCellGuiHandler;
|
||||
import appeng.forge.data.AE2DataGenerators;
|
||||
import appeng.hooks.RegisterDimensionTypeCallback;
|
||||
import appeng.hooks.ToolItemHook;
|
||||
import appeng.items.parts.FacadeItem;
|
||||
@@ -168,7 +167,7 @@ public abstract class AppEngBase implements AppEng {
|
||||
AEConfig.load(FabricLoader.getInstance().getConfigDirectory());
|
||||
|
||||
CreativeTab.init();
|
||||
// FIXME FABRIC new FacadeItemGroup(); // This call has a side-effect (adding it to the creative screen)
|
||||
FacadeCreativeTab.init() ;// This call has a side-effect (adding it to the creative screen)
|
||||
|
||||
AeStats.register();
|
||||
advancementTriggers = new AdvancementTriggers(CriteriaRegisterMixin::callRegister);
|
||||
@@ -188,11 +187,6 @@ public abstract class AppEngBase implements AppEng {
|
||||
|
||||
setupInternalRegistries();
|
||||
|
||||
if (System.getProperty("appeng2.generatedataendexit", "false").equals("true")) {
|
||||
AE2DataGenerators.dump();
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void setupInternalRegistries() {
|
||||
@@ -643,11 +637,11 @@ public abstract class AppEngBase implements AppEng {
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
256,
|
||||
BlockTags.INFINIBURN_OVERWORLD.getId(),
|
||||
0.5f
|
||||
1.0f
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
+26
-31
@@ -18,53 +18,48 @@
|
||||
|
||||
package appeng.core;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import appeng.items.parts.FacadeItem;
|
||||
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.collection.DefaultedList;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
import appeng.items.parts.FacadeItem;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public final class FacadeItemGroup extends ItemGroup {
|
||||
public final class FacadeCreativeTab {
|
||||
|
||||
private final FacadeItem itemFacade;
|
||||
private static List<ItemStack> subTypes = null;
|
||||
|
||||
private List<ItemStack> subTypes = null;
|
||||
|
||||
public FacadeItemGroup() {
|
||||
super("appliedenergistics2.facades");
|
||||
|
||||
itemFacade = (FacadeItem) Api.INSTANCE.definitions().items().facade().item();
|
||||
public static void init() {
|
||||
FabricItemGroupBuilder.create(AppEng.makeId("facades"))
|
||||
.icon(() -> {
|
||||
calculateSubTypes();
|
||||
if (subTypes.isEmpty()) {
|
||||
return new ItemStack(Items.CAKE);
|
||||
}
|
||||
return subTypes.get(0);
|
||||
})
|
||||
.appendItems(FacadeCreativeTab::fill)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack createIcon() {
|
||||
this.calculateSubTypes();
|
||||
if (this.subTypes.isEmpty()) {
|
||||
return new ItemStack(Items.CAKE);
|
||||
}
|
||||
return this.subTypes.get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fill(DefaultedList<ItemStack> items) {
|
||||
this.calculateSubTypes();
|
||||
private static void fill(List<ItemStack> items) {
|
||||
calculateSubTypes();
|
||||
items.addAll(subTypes);
|
||||
}
|
||||
|
||||
private void calculateSubTypes() {
|
||||
if (this.subTypes != null) {
|
||||
private static void calculateSubTypes() {
|
||||
if (subTypes != null) {
|
||||
return;
|
||||
}
|
||||
this.subTypes = new ArrayList<>(1000);
|
||||
subTypes = new ArrayList<>(1000);
|
||||
|
||||
for (final Block b : ForgeRegistries.BLOCKS) {
|
||||
FacadeItem itemFacade = (FacadeItem) Api.INSTANCE.definitions().items().facade().item();
|
||||
for (final Block b : Registry.BLOCK) {
|
||||
try {
|
||||
final Item item = Item.fromBlock(b);
|
||||
if (item == Items.AIR) {
|
||||
@@ -78,7 +73,7 @@ public final class FacadeItemGroup extends ItemGroup {
|
||||
for (final ItemStack l : tmpList) {
|
||||
final ItemStack facade = itemFacade.createFacadeForItem(l, false);
|
||||
if (!facade.isEmpty()) {
|
||||
this.subTypes.add(facade);
|
||||
subTypes.add(facade);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package appeng.forge.data;
|
||||
|
||||
import appeng.forge.data.providers.loot.BlockDropProvider;
|
||||
import appeng.forge.data.providers.recipes.SlabStairRecipes;
|
||||
import appeng.forge.data.providers.tags.ConventionTagProvider;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Collections;
|
||||
|
||||
public class AE2DataGenerators {
|
||||
|
||||
public static void dump() {
|
||||
Path output = Paths.get("../src/generated/resources");
|
||||
|
||||
DataGenerator generator = new DataGenerator(output, Collections.emptyList());
|
||||
generator.install(new BlockDropProvider(output));
|
||||
generator.install(new SlabStairRecipes(output));
|
||||
generator.install(new ConventionTagProvider(output));
|
||||
try {
|
||||
generator.run();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package appeng.mixins;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.color.item.ItemColors;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
@Mixin(MinecraftClient.class)
|
||||
public interface MinecraftClientAccessor {
|
||||
|
||||
@Accessor
|
||||
ItemColors getItemColors();
|
||||
|
||||
}
|
||||
@@ -51,8 +51,8 @@ public final class SpatialDimensionManager implements ISpatialDimension {
|
||||
public static final SkyProperties STORAGE_SKY = new SkyProperties(
|
||||
Float.NaN /* disables clouds */,
|
||||
false,
|
||||
SkyProperties.SkyType.NORMAL /* we use a custom render mixin */,
|
||||
false,
|
||||
SkyProperties.SkyType.NONE /* we use a custom render mixin */,
|
||||
true,
|
||||
false
|
||||
) {
|
||||
@Override
|
||||
|
||||
@@ -21,7 +21,8 @@
|
||||
"RenderEncodedPatternMixin",
|
||||
"ItemRendererAccessor",
|
||||
"SkyRenderMixin",
|
||||
"SkyPropertiesMixin"
|
||||
"SkyPropertiesMixin",
|
||||
"MinecraftClientAccessor"
|
||||
],
|
||||
"server": [],
|
||||
"injectors": {
|
||||
|
||||
@@ -1,127 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.spatial;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.minecraftforge.client.IRenderHandler;
|
||||
|
||||
import appeng.client.render.SpatialSkyRender;
|
||||
|
||||
public class StorageCellDimension extends Dimension {
|
||||
|
||||
public StorageCellDimension(World world, DimensionType dimensionType) {
|
||||
// FIXME: check light value
|
||||
super(world, dimensionType, 1.0f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChunkGenerator createChunkGenerator() {
|
||||
return new StorageChunkGenerator(this.world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float calculateCelestialAngle(final long par1, final float par3) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSurfaceWorld() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Environment(EnvType.CLIENT)
|
||||
public float[] calcSunriseSunsetColors(final float celestialAngle, final float partialTicks) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3d getFogColor(final float par1, final float par2) {
|
||||
return new Vec3d(0.07, 0.07, 0.07);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRespawnHere() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Environment(EnvType.CLIENT)
|
||||
public boolean isSkyColored() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesXZShowFog(final int par1, final int par2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRenderHandler getSkyRenderer() {
|
||||
return SpatialSkyRender.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDaytime() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockPos getSpawnCoordinate() {
|
||||
return REGION_CENTER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHighHumidity(final BlockPos pos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDoLightning(final Chunk chunk) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDoRainSnowIce(Chunk chunk) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BlockPos findSpawn(ChunkPos chunkPosIn, boolean checkValid) {
|
||||
return getSpawnCoordinate();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BlockPos findSpawn(int posX, int posZ, boolean checkValid) {
|
||||
return getSpawnCoordinate();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.spatial;
|
||||
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
import net.minecraftforge.common.ModDimension;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
|
||||
public class StorageCellModDimension extends ModDimension {
|
||||
|
||||
public static final StorageCellModDimension INSTANCE = new StorageCellModDimension();
|
||||
|
||||
static {
|
||||
INSTANCE.setRegistryName(AppEng.MOD_ID, "storage_cell");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiFunction<World, DimensionType, ? extends Dimension> getFactory() {
|
||||
return StorageCellDimension::new;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user