use maven-publish plugin

This commit is contained in:
dags- 2020-02-26 14:20:32 +00:00
parent 8b58e0fac7
commit 179965fc9c
10 changed files with 227 additions and 269 deletions

@ -1 +1 @@
Subproject commit a53367b857a43107877096869c40d53fa16fd216 Subproject commit 8ec2190c3b28a0299e4e6610bdccfbe10cd10266

View File

@ -9,7 +9,7 @@ repositories {
} }
dependencies { dependencies {
implementation "com.terraforged:TerraForgedAPI:0.0.1-mc1.15.2:deobf@jar" implementation "com.terraforged:TerraForgedAPI:0.0.1-mc1.15.2"
} }
``` ```

View File

@ -10,10 +10,10 @@ buildscript {
} }
apply plugin: "net.minecraftforge.gradle" apply plugin: "net.minecraftforge.gradle"
apply plugin: "maven-publish"
apply plugin: "eclipse" apply plugin: "eclipse"
apply plugin: "maven"
version = "${version}-mc${mc_version}" version = "${mc_version}-${version}"
archivesBaseName = "TerraForgedAPI" archivesBaseName = "TerraForgedAPI"
repositories { repositories {
@ -32,28 +32,29 @@ minecraft {
mappings channel: mcp_channel, version: mcp_version mappings channel: mcp_channel, version: mcp_version
} }
task deobfApiJar(type: Jar, dependsOn: classes) { jar {
classifier = "deobf"
duplicatesStrategy = "EXCLUDE"
from("$buildDir/classes/java/main") from("$buildDir/classes/java/main")
from(project(":Noise2D").buildDir.getPath() + "/classes/java/main") from(project(":Noise2D").buildDir.getPath() + "/classes/java/main")
from(project(":FeatureManager").buildDir.getPath() + "/classes/java/main") from(project(":FeatureManager").buildDir.getPath() + "/classes/java/main")
from(project(":TerraForgedCore").buildDir.getPath() + "/classes/java/main") from(project(":TerraForgedCore").buildDir.getPath() + "/classes/java/main")
} }
jar { publishing {
dependsOn(deobfApiJar) publications {
mavenJava(MavenPublication) {
artifact jar
}
} }
artifacts{ if (System.getenv("MAVEN_USER") != null && System.getenv("MAVEN_PASS") != null) {
archives deobfApiJar
}
uploadArchives {
repositories { repositories {
mavenDeployer { maven {
repository(url: "https://io.terraforged.com/repository/maven/") { credentials {
authentication(userName: System.getenv("MAVEN_USER"), password: System.getenv("MAVEN_PASS")) username System.getenv("MAVEN_USER")
password System.getenv("MAVEN_PASS")
}
name = "nexus"
url = "https://io.terraforged.com/repository/maven/"
} }
} }
} }

View File

@ -1,35 +0,0 @@
/*
*
* MIT License
*
* Copyright (c) 2020 TerraForged
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.terraforged.api.chunk;
import net.minecraft.block.BlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.chunk.IChunk;
public interface ChunkAccess extends IChunk {
BlockState getState(BlockPos pos);
}

View File

@ -41,7 +41,6 @@ import net.minecraft.util.math.RayTraceContext;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.palette.UpgradeData; import net.minecraft.util.palette.UpgradeData;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.ITickList; import net.minecraft.world.ITickList;
import net.minecraft.world.IWorld; import net.minecraft.world.IWorld;
import net.minecraft.world.biome.BiomeContainer; import net.minecraft.world.biome.BiomeContainer;
@ -57,296 +56,273 @@ import java.util.BitSet;
import java.util.Collection; import java.util.Collection;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.stream.Stream; import java.util.stream.Stream;
public class ChunkDelegate implements ChunkAccess { public interface ChunkDelegate extends IChunk {
private final IChunk chunk; IChunk getDelegate();
public ChunkDelegate(IChunk chunk) { @Override
this.chunk = chunk; @Nullable
} default BlockState setBlockState(BlockPos pos, BlockState state, boolean isMoving) {
return getDelegate().setBlockState(pos, state, isMoving);
public IChunk getChunk() {
return chunk;
} }
@Override @Override
public BlockState getState(BlockPos pos) { default void addTileEntity(BlockPos pos, TileEntity tileEntityIn) {
return chunk.getBlockState(pos); getDelegate().addTileEntity(pos, tileEntityIn);
}
@Override
default void addEntity(Entity entityIn) {
getDelegate().addEntity(entityIn);
} }
@Override @Override
@Nullable @Nullable
public BlockState setBlockState(BlockPos pos, BlockState state, boolean isMoving) { default ChunkSection getLastExtendedBlockStorage() {
return chunk.setBlockState(pos, state, isMoving); return getDelegate().getLastExtendedBlockStorage();
} }
@Override @Override
public void addTileEntity(BlockPos pos, TileEntity tileEntityIn) { default int getTopFilledSegment() {
chunk.addTileEntity(pos, tileEntityIn); return getDelegate().getTopFilledSegment();
} }
@Override @Override
public void addEntity(Entity entityIn) { default Set<BlockPos> getTileEntitiesPos() {
chunk.addEntity(entityIn); return getDelegate().getTileEntitiesPos();
}
@Override
default ChunkSection[] getSections() {
return getDelegate().getSections();
}
@Override
default Collection<Map.Entry<Heightmap.Type, Heightmap>> getHeightmaps() {
return getDelegate().getHeightmaps();
}
@Override
default void setHeightmap(Heightmap.Type type, long[] data) {
getDelegate().setHeightmap(type, data);
}
@Override
default Heightmap getHeightmap(Heightmap.Type type) {
return getDelegate().getHeightmap(type);
}
@Override
default int getTopBlockY(Heightmap.Type heightmapType, int x, int z) {
return getDelegate().getTopBlockY(heightmapType, x, z);
}
@Override
default ChunkPos getPos() {
return getDelegate().getPos();
}
@Override
default void setLastSaveTime(long saveTime) {
getDelegate().setLastSaveTime(saveTime);
}
@Override
default Map<String, StructureStart> getStructureStarts() {
return getDelegate().getStructureStarts();
}
@Override
default void setStructureStarts(Map<String, StructureStart> structureStartsIn) {
getDelegate().setStructureStarts(structureStartsIn);
}
@Override
default boolean isEmptyBetween(int startY, int endY) {
return getDelegate().isEmptyBetween(startY, endY);
} }
@Override @Override
@Nullable @Nullable
public ChunkSection getLastExtendedBlockStorage() { default BiomeContainer getBiomes() {
return chunk.getLastExtendedBlockStorage(); return getDelegate().getBiomes();
} }
@Override @Override
public int getTopFilledSegment() { default void setModified(boolean modified) {
return chunk.getTopFilledSegment(); getDelegate().setModified(modified);
} }
@Override @Override
public Set<BlockPos> getTileEntitiesPos() { default boolean isModified() {
return chunk.getTileEntitiesPos(); return getDelegate().isModified();
} }
@Override @Override
public ChunkSection[] getSections() { default ChunkStatus getStatus() {
return chunk.getSections(); return getDelegate().getStatus();
} }
@Override @Override
public Collection<Map.Entry<Heightmap.Type, Heightmap>> getHeightmaps() { default void removeTileEntity(BlockPos pos) {
return chunk.getHeightmaps(); getDelegate().removeTileEntity(pos);
} }
@Override @Override
public void setHeightmap(Heightmap.Type type, long[] data) { default void markBlockForPostprocessing(BlockPos pos) {
chunk.setHeightmap(type, data); getDelegate().markBlockForPostprocessing(pos);
} }
@Override @Override
public Heightmap getHeightmap(Heightmap.Type type) { default ShortList[] getPackedPositions() {
return chunk.getHeightmap(type); return getDelegate().getPackedPositions();
} }
@Override @Override
public int getTopBlockY(Heightmap.Type heightmapType, int x, int z) { default void func_201636_b(short packedPosition, int index) {
return chunk.getTopBlockY(heightmapType, x, z); getDelegate().func_201636_b(packedPosition, index);
} }
@Override @Override
public ChunkPos getPos() { default void addTileEntity(CompoundNBT nbt) {
return chunk.getPos(); getDelegate().addTileEntity(nbt);
}
@Override
public void setLastSaveTime(long saveTime) {
chunk.setLastSaveTime(saveTime);
}
@Override
public Map<String, StructureStart> getStructureStarts() {
return chunk.getStructureStarts();
}
@Override
public void setStructureStarts(Map<String, StructureStart> structureStartsIn) {
chunk.setStructureStarts(structureStartsIn);
}
@Override
public boolean isEmptyBetween(int startY, int endY) {
return chunk.isEmptyBetween(startY, endY);
} }
@Override @Override
@Nullable @Nullable
public BiomeContainer getBiomes() { default CompoundNBT getDeferredTileEntity(BlockPos pos) {
return chunk.getBiomes(); return getDelegate().getDeferredTileEntity(pos);
}
@Override
public void setModified(boolean modified) {
chunk.setModified(modified);
}
@Override
public boolean isModified() {
return chunk.isModified();
}
@Override
public ChunkStatus getStatus() {
return chunk.getStatus();
}
@Override
public void removeTileEntity(BlockPos pos) {
chunk.removeTileEntity(pos);
}
@Override
public void markBlockForPostprocessing(BlockPos pos) {
chunk.markBlockForPostprocessing(pos);
}
@Override
public ShortList[] getPackedPositions() {
return chunk.getPackedPositions();
}
@Override
public void func_201636_b(short packedPosition, int index) {
chunk.func_201636_b(packedPosition, index);
}
@Override
public void addTileEntity(CompoundNBT nbt) {
chunk.addTileEntity(nbt);
} }
@Override @Override
@Nullable @Nullable
public CompoundNBT getDeferredTileEntity(BlockPos pos) { default CompoundNBT getTileEntityNBT(BlockPos pos) {
return chunk.getDeferredTileEntity(pos); return getDelegate().getTileEntityNBT(pos);
}
@Override
default Stream<BlockPos> getLightSources() {
return getDelegate().getLightSources();
}
@Override
default ITickList<Block> getBlocksToBeTicked() {
return getDelegate().getBlocksToBeTicked();
}
@Override
default ITickList<Fluid> getFluidsToBeTicked() {
return getDelegate().getFluidsToBeTicked();
}
@Override
default BitSet getCarvingMask(GenerationStage.Carving type) {
return getDelegate().getCarvingMask(type);
}
@Override
default UpgradeData getUpgradeData() {
return getDelegate().getUpgradeData();
}
@Override
default void setInhabitedTime(long newInhabitedTime) {
getDelegate().setInhabitedTime(newInhabitedTime);
}
@Override
default long getInhabitedTime() {
return getDelegate().getInhabitedTime();
}
@Override
default boolean hasLight() {
return getDelegate().hasLight();
}
@Override
default void setLight(boolean p_217305_1_) {
getDelegate().setLight(p_217305_1_);
} }
@Override @Override
@Nullable @Nullable
public CompoundNBT getTileEntityNBT(BlockPos pos) { default IWorld getWorldForge() {
return chunk.getTileEntityNBT(pos); return getDelegate().getWorldForge();
}
@Override
public Stream<BlockPos> getLightSources() {
return chunk.getLightSources();
}
@Override
public ITickList<Block> getBlocksToBeTicked() {
return chunk.getBlocksToBeTicked();
}
@Override
public ITickList<Fluid> getFluidsToBeTicked() {
return chunk.getFluidsToBeTicked();
}
@Override
public BitSet getCarvingMask(GenerationStage.Carving type) {
return chunk.getCarvingMask(type);
}
@Override
public UpgradeData getUpgradeData() {
return chunk.getUpgradeData();
}
@Override
public void setInhabitedTime(long newInhabitedTime) {
chunk.setInhabitedTime(newInhabitedTime);
}
@Override
public long getInhabitedTime() {
return chunk.getInhabitedTime();
}
public static ShortList getList(ShortList[] p_217308_0_, int p_217308_1_) {
return IChunk.getList(p_217308_0_, p_217308_1_);
}
@Override
public boolean hasLight() {
return chunk.hasLight();
}
@Override
public void setLight(boolean p_217305_1_) {
chunk.setLight(p_217305_1_);
} }
@Override @Override
@Nullable @Nullable
public IWorld getWorldForge() { default TileEntity getTileEntity(BlockPos pos) {
return chunk.getWorldForge(); return getDelegate().getTileEntity(pos);
}
@Override
default BlockState getBlockState(BlockPos pos) {
return getDelegate().getBlockState(pos);
}
@Override
default IFluidState getFluidState(BlockPos pos) {
return getDelegate().getFluidState(pos);
}
@Override
default int getLightValue(BlockPos pos) {
return getDelegate().getLightValue(pos);
}
@Override
default int getMaxLightLevel() {
return getDelegate().getMaxLightLevel();
}
@Override
default int getHeight() {
return getDelegate().getHeight();
}
@Override
default BlockRayTraceResult rayTraceBlocks(RayTraceContext context) {
return getDelegate().rayTraceBlocks(context);
} }
@Override @Override
@Nullable @Nullable
public TileEntity getTileEntity(BlockPos pos) { default BlockRayTraceResult rayTraceBlocks(Vec3d p_217296_1_, Vec3d p_217296_2_, BlockPos p_217296_3_, VoxelShape p_217296_4_, BlockState p_217296_5_) {
return chunk.getTileEntity(pos); return getDelegate().rayTraceBlocks(p_217296_1_, p_217296_2_, p_217296_3_, p_217296_4_, p_217296_5_);
}
@Override
public BlockState getBlockState(BlockPos pos) {
return chunk.getBlockState(pos);
}
@Override
public IFluidState getFluidState(BlockPos pos) {
return chunk.getFluidState(pos);
}
@Override
public int getLightValue(BlockPos pos) {
return chunk.getLightValue(pos);
}
@Override
public int getMaxLightLevel() {
return chunk.getMaxLightLevel();
}
@Override
public int getHeight() {
return chunk.getHeight();
}
@Override
public BlockRayTraceResult rayTraceBlocks(RayTraceContext context) {
return chunk.rayTraceBlocks(context);
} }
@Override @Override
@Nullable @Nullable
public BlockRayTraceResult rayTraceBlocks(Vec3d p_217296_1_, Vec3d p_217296_2_, BlockPos p_217296_3_, VoxelShape p_217296_4_, BlockState p_217296_5_) { default StructureStart getStructureStart(String stucture) {
return chunk.rayTraceBlocks(p_217296_1_, p_217296_2_, p_217296_3_, p_217296_4_, p_217296_5_); return getDelegate().getStructureStart(stucture);
}
public static <T> T func_217300_a(RayTraceContext p_217300_0_, BiFunction<RayTraceContext, BlockPos, T> p_217300_1_, Function<RayTraceContext, T> p_217300_2_) {
return IBlockReader.func_217300_a(p_217300_0_, p_217300_1_, p_217300_2_);
} }
@Override @Override
@Nullable default void putStructureStart(String structureIn, StructureStart structureStartIn) {
public StructureStart getStructureStart(String stucture) { getDelegate().putStructureStart(structureIn, structureStartIn);
return chunk.getStructureStart(stucture);
} }
@Override @Override
public void putStructureStart(String structureIn, StructureStart structureStartIn) { default LongSet getStructureReferences(String structureIn) {
chunk.putStructureStart(structureIn, structureStartIn); return getDelegate().getStructureReferences(structureIn);
} }
@Override @Override
public LongSet getStructureReferences(String structureIn) { default void addStructureReference(String strucutre, long reference) {
return chunk.getStructureReferences(structureIn); getDelegate().addStructureReference(strucutre, reference);
} }
@Override @Override
public void addStructureReference(String strucutre, long reference) { default Map<String, LongSet> getStructureReferences() {
chunk.addStructureReference(strucutre, reference); return getDelegate().getStructureReferences();
} }
@Override @Override
public Map<String, LongSet> getStructureReferences() { default void setStructureReferences(Map<String, LongSet> p_201606_1_) {
return chunk.getStructureReferences(); getDelegate().setStructureReferences(p_201606_1_);
}
@Override
public void setStructureReferences(Map<String, LongSet> p_201606_1_) {
chunk.setStructureReferences(p_201606_1_);
} }
} }

View File

@ -25,7 +25,7 @@
package com.terraforged.api.chunk.column; package com.terraforged.api.chunk.column;
import com.terraforged.api.chunk.ChunkSurfaceBuffer; import com.terraforged.api.chunk.surface.ChunkSurfaceBuffer;
import me.dags.noise.Source; import me.dags.noise.Source;
import me.dags.noise.source.FastSource; import me.dags.noise.source.FastSource;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
@ -41,7 +41,7 @@ public interface ColumnDecorator {
void decorate(IChunk chunk, ProcessorContext context, int x, int y, int z); void decorate(IChunk chunk, ProcessorContext context, int x, int y, int z);
default void decorate(ChunkSurfaceBuffer buffer, ProcessorContext context, int x, int y, int z) { default void decorate(ChunkSurfaceBuffer buffer, ProcessorContext context, int x, int y, int z) {
decorate(buffer.getChunk(), context, x, y, z); decorate(buffer.getDelegate(), context, x, y, z);
} }
default void fillDown(IChunk chunk, int x, int z, int from, int to, BlockState state) { default void fillDown(IChunk chunk, int x, int z, int from, int to, BlockState state) {

View File

@ -23,21 +23,28 @@
* SOFTWARE. * SOFTWARE.
*/ */
package com.terraforged.api.chunk; package com.terraforged.api.chunk.surface;
import com.terraforged.api.chunk.ChunkDelegate;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.chunk.IChunk; import net.minecraft.world.chunk.IChunk;
import javax.annotation.Nullable; import javax.annotation.Nullable;
public class ChunkSurfaceBuffer extends ChunkDelegate { public class ChunkSurfaceBuffer implements ChunkDelegate {
private int surfaceTop; private int surfaceTop;
private int surfaceBottom; private int surfaceBottom;
private final IChunk delegate;
public ChunkSurfaceBuffer(IChunk chunk) { public ChunkSurfaceBuffer(IChunk chunk) {
super(chunk); this.delegate = chunk;
}
@Override
public IChunk getDelegate() {
return delegate;
} }
@Nullable @Nullable
@ -49,7 +56,7 @@ public class ChunkSurfaceBuffer extends ChunkDelegate {
if (pos.getY() < surfaceBottom) { if (pos.getY() < surfaceBottom) {
surfaceBottom = pos.getY(); surfaceBottom = pos.getY();
} }
return super.setBlockState(pos, state, isMoving); return getDelegate().setBlockState(pos, state, isMoving);
} }
public int getSurfaceTop() { public int getSurfaceTop() {

View File

@ -32,6 +32,7 @@ import com.terraforged.core.world.heightmap.RegionConfig;
import com.terraforged.core.world.terrain.LandForms; import com.terraforged.core.world.terrain.LandForms;
import com.terraforged.core.world.terrain.Terrain; import com.terraforged.core.world.terrain.Terrain;
import com.terraforged.core.world.terrain.TerrainPopulator; import com.terraforged.core.world.terrain.TerrainPopulator;
import com.terraforged.core.world.terrain.Terrains;
import com.terraforged.core.world.terrain.VolcanoPopulator; import com.terraforged.core.world.terrain.VolcanoPopulator;
import me.dags.noise.Module; import me.dags.noise.Module;
import me.dags.noise.Source; import me.dags.noise.Source;
@ -77,6 +78,11 @@ public class StandardTerrainProvider implements TerrainProvider {
registerUnMixable(context.terrain.mountains, landForms.mountains3(context.seed)); registerUnMixable(context.terrain.mountains, landForms.mountains3(context.seed));
} }
@Override
public Terrains getTerrain() {
return context.terrain;
}
@Override @Override
public void registerMixable(TerrainPopulator populator) { public void registerMixable(TerrainPopulator populator) {
populators.putIfAbsent(populator.getType(), populator); populators.putIfAbsent(populator.getType(), populator);

View File

@ -29,6 +29,7 @@ import com.terraforged.core.cell.Populator;
import com.terraforged.core.world.terrain.LandForms; import com.terraforged.core.world.terrain.LandForms;
import com.terraforged.core.world.terrain.Terrain; import com.terraforged.core.world.terrain.Terrain;
import com.terraforged.core.world.terrain.TerrainPopulator; import com.terraforged.core.world.terrain.TerrainPopulator;
import com.terraforged.core.world.terrain.Terrains;
import me.dags.noise.Module; import me.dags.noise.Module;
import java.util.List; import java.util.List;
@ -38,6 +39,8 @@ import java.util.List;
*/ */
public interface TerrainProvider { public interface TerrainProvider {
Terrains getTerrain();
LandForms getLandforms(); LandForms getLandforms();
/** /**

@ -1 +1 @@
Subproject commit 2e18fe66d631773288b1e27db0246514ce74d681 Subproject commit f7e27c70a2a2b30225a85137688d2014f9ad1b6f