Merge branch 'mc1.16/dev' into mc1.16/chromatic-projector

This commit is contained in:
JozsefA 2021-04-09 16:43:21 -07:00
commit 62eb16241b
9 changed files with 12 additions and 183 deletions

View file

@ -37,10 +37,8 @@ minecraft {
runs {
client {
workingDirectory project.file('run')
// property 'mixin.env.disableRefMap', 'true'
arg '-mixin.config=create.mixins.json'
//jvmArgs '-XX:+UnlockCommercialFeatures'
jvmArgs '-Dmixin.env.disableRefMap=true'
//jvmArgs '-XX:+UnlockCommercialFeatures' // uncomment for profiling
property 'forge.logging.console.level', 'info'
property 'fml.earlyprogresswindow', 'false'
mods {
@ -52,7 +50,6 @@ minecraft {
server {
workingDirectory project.file('run/server')
// property 'mixin.env.disableRefMap', 'true'
arg '-mixin.config=create.mixins.json'
property 'forge.logging.console.level', 'info'
mods {
@ -110,10 +107,6 @@ repositories {
maven {
url = "https://www.cursemaven.com"
}
flatDir {
dirs 'deps'
}
}
configurations {
@ -122,7 +115,7 @@ configurations {
dependencies {
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
def registrate = "com.tterrag.registrate:Registrate:MC1.16.2-${registrate_version}"
implementation fg.deobf(registrate)
shade registrate
@ -140,9 +133,6 @@ dependencies {
// runtimeOnly fg.deobf("slimeknights.mantle:Mantle:1.16.3-1.6.40")
// runtimeOnly fg.deobf("slimeknights.tconstruct:TConstruct:1.16.3-3.0.1.24")
compileOnly fg.deobf("local:starlight-1.0.0-RC1")
//runtimeOnly fg.deobf("local:starlight-1.0.0-RC1")
annotationProcessor 'org.spongepowered:mixin:0.8:processor'
}
@ -207,7 +197,7 @@ String getChangelogText() {
//new File("changelog.html").write getChangelogText()
tasks.curseforge.enabled = !dev && project.hasProperty('simi_curseforge_key')
curseforge {
if (project.hasProperty('simi_curseforge_key')) {
apiKey = project.simi_curseforge_key
@ -231,4 +221,4 @@ apply plugin: 'org.spongepowered.mixin'
mixin {
add sourceSets.main, "create.refmap.json"
}
}

Binary file not shown.

View file

@ -16,7 +16,6 @@ import com.simibubi.create.foundation.render.backend.instancing.IInstanceRendere
import com.simibubi.create.foundation.render.backend.light.GridAlignedBB;
import com.simibubi.create.foundation.utility.AnimationTickHolder;
import com.simibubi.create.foundation.utility.worldWrappers.PlacementSimulationWorld;
import com.simibubi.create.foundation.utility.worldWrappers.PlacementSimulationWorldStarlight;
import net.minecraft.block.BlockRenderType;
import net.minecraft.block.BlockState;
@ -40,7 +39,6 @@ import net.minecraft.world.gen.feature.template.Template;
import net.minecraft.world.lighting.WorldLightManager;
import net.minecraftforge.client.ForgeHooksClient;
import net.minecraftforge.client.model.data.EmptyModelData;
import net.minecraftforge.fml.ModList;
public class RenderedContraption {
private final HashMap<RenderType, ContraptionModel> renderLayers = new HashMap<>();
@ -172,14 +170,6 @@ public class RenderedContraption {
}
private static PlacementSimulationWorld setupRenderWorld(World world, Contraption c) {
if (ModList.get().isLoaded("starlight")) {
return PlacementSimulationWorldStarlight.setupRenderWorldStarlight(world, c);
} else {
return setupRenderWorldVanilla(world, c);
}
}
private static PlacementSimulationWorld setupRenderWorldVanilla(World world, Contraption c) {
PlacementSimulationWorld renderWorld = new PlacementSimulationWorld(world);
renderWorld.setTileEntities(c.presentTileEntities.values());

View file

@ -12,7 +12,6 @@ import java.util.stream.Stream;
import com.simibubi.create.Create;
import com.simibubi.create.foundation.utility.worldWrappers.WrappedChunkProvider;
import com.simibubi.create.foundation.utility.worldWrappers.WrappedWorld;
import com.simibubi.create.foundation.utility.worldWrappers.chunk.WrappedChunk;
import net.minecraft.block.AbstractFurnaceBlock;
import net.minecraft.block.Block;
@ -54,7 +53,7 @@ public class SchematicWorld extends WrappedWorld implements IServerWorld {
}
public SchematicWorld(BlockPos anchor, World original) {
super(original, new WrappedChunkProvider(WrappedChunk::new));
super(original, new WrappedChunkProvider());
this.blocks = new HashMap<>();
this.tileEntities = new HashMap<>();
this.bounds = new MutableBoundingBox();
@ -110,7 +109,7 @@ public class SchematicWorld extends WrappedWorld implements IServerWorld {
}
return null;
}
protected void onTEadded(TileEntity tileEntity, BlockPos pos) {
tileEntity.setLocation(this, pos);
}

View file

@ -6,7 +6,6 @@ import java.util.HashSet;
import java.util.function.Predicate;
import com.simibubi.create.foundation.render.backend.instancing.IFlywheelWorld;
import com.simibubi.create.foundation.utility.worldWrappers.chunk.WrappedChunk;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
@ -26,7 +25,7 @@ public class PlacementSimulationWorld extends WrappedWorld implements IFlywheelW
private final BlockPos.Mutable scratch = new BlockPos.Mutable();
public PlacementSimulationWorld(World wrapped) {
this(wrapped, new WrappedChunkProvider(WrappedChunk::new));
this(wrapped, new WrappedChunkProvider());
}
public PlacementSimulationWorld(World wrapped, WrappedChunkProvider chunkProvider) {

View file

@ -1,60 +0,0 @@
package com.simibubi.create.foundation.utility.worldWrappers;
import com.simibubi.create.content.contraptions.components.structureMovement.Contraption;
import com.simibubi.create.foundation.utility.worldWrappers.chunk.WrappedChunkStarlight;
import ca.spottedleaf.starlight.common.light.VariableBlockLightHandler;
import ca.spottedleaf.starlight.common.light.VariableBlockLightHandlerImpl;
import ca.spottedleaf.starlight.common.world.ExtendedWorld;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.IChunk;
import net.minecraft.world.gen.feature.template.Template;
import net.minecraft.world.lighting.WorldLightManager;
public class PlacementSimulationWorldStarlight extends PlacementSimulationWorld implements ExtendedWorld {
VariableBlockLightHandler variableBlockLightHandler = new VariableBlockLightHandlerImpl();
public PlacementSimulationWorldStarlight(World wrapped) {
super(wrapped, new WrappedChunkProvider(WrappedChunkStarlight::new));
}
@Override
public Chunk getChunkAtImmediately(int i, int i1) {
return null;
}
@Override
public IChunk getAnyChunkImmediately(int i, int i1) {
return null;
}
@Override
public VariableBlockLightHandler getCustomLightHandler() {
return variableBlockLightHandler;
}
@Override
public void setCustomLightHandler(VariableBlockLightHandler variableBlockLightHandler) {
this.variableBlockLightHandler = variableBlockLightHandler;
}
public static PlacementSimulationWorld setupRenderWorldStarlight(World world, Contraption c) {
PlacementSimulationWorld renderWorld = new PlacementSimulationWorldStarlight(world);
renderWorld.setTileEntities(c.presentTileEntities.values());
for (Template.BlockInfo info : c.getBlocks()
.values())
renderWorld.setBlockState(info.pos, info.state);
WorldLightManager lighter = renderWorld.lighter;
renderWorld.chunkProvider.getLightSources().forEach((pos) -> lighter.func_215573_a(pos, renderWorld.getLightValue(pos)));
lighter.tick(Integer.MAX_VALUE, true, false);
return renderWorld;
}
}

View file

@ -21,12 +21,6 @@ public class WrappedChunkProvider extends AbstractChunkProvider {
public HashMap<Long, WrappedChunk> chunks;
protected final ChunkFactory chunkFactory;
public WrappedChunkProvider(ChunkFactory chunkFactory) {
this.chunkFactory = chunkFactory;
}
public WrappedChunkProvider setWorld(PlacementSimulationWorld world) {
this.world = world;
this.chunks = new HashMap<>();
@ -64,8 +58,7 @@ public class WrappedChunkProvider extends AbstractChunkProvider {
if (chunks == null)
return null;
return chunks.computeIfAbsent(pos, $ -> chunkFactory.create(world, x, z));
return chunks.computeIfAbsent(pos, $ -> new WrappedChunk(world, x, z));
}
@Override
@ -77,8 +70,4 @@ public class WrappedChunkProvider extends AbstractChunkProvider {
public WorldLightManager getLightManager() {
return world.getLightingProvider();
}
public interface ChunkFactory {
WrappedChunk create(PlacementSimulationWorld world, int x, int z);
}
}

View file

@ -219,7 +219,7 @@ public class WrappedChunk implements IChunk {
@Override
public void addStructureReference(Structure<?> arg0, long arg1) {
}
@Override
@ -239,17 +239,17 @@ public class WrappedChunk implements IChunk {
@Override
public void setStructureReferences(Map<Structure<?>, LongSet> arg0) {
}
@Override
public void setStructureStart(Structure<?> arg0, StructureStart<?> arg1) {
}
@Override
public void setStructureStarts(Map<Structure<?>, StructureStart<?>> p_201612_1_) {
}
@Override
@ -257,5 +257,4 @@ public class WrappedChunk implements IChunk {
return null;
}
}

View file

@ -1,77 +0,0 @@
package com.simibubi.create.foundation.utility.worldWrappers.chunk;
import com.simibubi.create.foundation.utility.worldWrappers.PlacementSimulationWorld;
import ca.spottedleaf.starlight.common.chunk.ExtendedChunk;
import ca.spottedleaf.starlight.common.light.SWMRNibbleArray;
import ca.spottedleaf.starlight.common.light.StarLightEngine;
import net.minecraft.world.chunk.ChunkSection;
import net.minecraft.world.chunk.IChunk;
public class WrappedChunkStarlight extends WrappedChunk implements ExtendedChunk {
private SWMRNibbleArray[] blockNibbles;
private SWMRNibbleArray[] skyNibbles;
private boolean[] skyEmptinessMap;
private boolean[] blockEmptinessMap;
public WrappedChunkStarlight(PlacementSimulationWorld world, int x, int z) {
super(world, x, z);
this.blockNibbles = StarLightEngine.getFilledEmptyLight(world);
this.skyNibbles = StarLightEngine.getFilledEmptyLight(world);
this.skyEmptinessMap = getEmptySectionsForChunk(this);
this.blockEmptinessMap = getEmptySectionsForChunk(this);
}
@Override
public SWMRNibbleArray[] getBlockNibbles() {
return blockNibbles;
}
@Override
public void setBlockNibbles(SWMRNibbleArray[] swmrNibbleArrays) {
this.blockNibbles = swmrNibbleArrays;
}
@Override
public SWMRNibbleArray[] getSkyNibbles() {
return skyNibbles;
}
@Override
public void setSkyNibbles(SWMRNibbleArray[] swmrNibbleArrays) {
this.skyNibbles = swmrNibbleArrays;
}
@Override
public boolean[] getSkyEmptinessMap() {
return skyEmptinessMap;
}
@Override
public void setSkyEmptinessMap(boolean[] booleans) {
this.skyEmptinessMap = booleans;
}
@Override
public boolean[] getBlockEmptinessMap() {
return blockEmptinessMap;
}
@Override
public void setBlockEmptinessMap(boolean[] booleans) {
this.blockEmptinessMap = booleans;
}
public static boolean[] getEmptySectionsForChunk(IChunk chunk) {
ChunkSection[] sections = chunk.getSections();
boolean[] ret = new boolean[sections.length];
for (int i = 0; i < sections.length; ++i) {
ret[i] = sections[i] == null || sections[i].isEmpty();
}
return ret;
}
}