Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ plugins {
id "com.jfrog.bintray" version "1.7.3"
}

group 'com.vcsajen'
version '1.0.0'
group = "${project.group}.${project.name}"
version = "[v${project.modVersion}]-[MC${project.minecraftVersion}]-[F${project.forgeBuild}]-[S${project.spongeAPIVersion.split("-")[0]}]"


apply plugin: 'java'

Expand All @@ -22,6 +23,7 @@ repositories {

def bintrayVersion = getVersion()+(System.getenv('TRAVIS') ? "."+System.getenv('TRAVIS_BUILD_NUMBER') : ".0")
def bintrayProjName = rootProject.name

setVersion(getVersion()+(System.getenv('TRAVIS') ? "."+System.getenv('TRAVIS_BUILD_NUMBER') : ".0")+(System.getenv('TRAVIS_TAG') ? "" : (System.getenv('TRAVIS') ? "-"+System.getenv('TRAVIS_COMMIT').take(7) : "")+"-SNAPSHOT"))

static def getSecret(String secretname){
Expand All @@ -32,9 +34,11 @@ static def getSecret(String secretname){
return props[secretname]
}

ext.spongeApiVersion = "${project.spongeAPIVersion}"

dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
shadow 'org.spongepowered:spongeapi:7.0.0-SNAPSHOT'
shadow "org.spongepowered:spongeapi:$spongeApiVersion"

compile 'com.flowpowered:flow-nbt:1.0.0'
compile group: 'com.mortennobel', name: 'java-image-scaling', version: '0.8.6'
Expand All @@ -58,7 +62,7 @@ bintray {
publish = true
userOrg = user
licenses = ['MIT']
vcsUrl = 'https://github.com/VcSaJen/YourCustomPaintings.git'
vcsUrl = 'https://github.com/SparkVGX/YourCustomPaintings.git'
version {
name = bintrayVersion.toString()
desc = bintrayProjName.toString() + bintrayVersion.toString()
Expand Down
13 changes: 13 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name=yourcustompaintings
group=com.vcsajen
author=vcsajen
url=https://github.com/SparkVGX/YourCustomPaintings
modVersion=1.1
minecraftVersion=1.12.2
forgeBuild=2555
spongeAPIVersion=7.0.0-SNAPSHOT
spongeForgeVersion=1.12.2-2555-7.0.0-BETA-2799
forgeGradleVersion=2.2-SNAPSHOT
forgeVersion=1.12.2-14.23.1.2555
mcpVersion=snapshot_20171228
org.gradle.jvmargs=-Xmx3G
17 changes: 3 additions & 14 deletions src/main/java/com/vcsajen/yourcustompaintings/PaintingPlacer.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@
import com.flowpowered.math.vector.Vector3i;
import com.google.common.collect.Lists;
import com.vcsajen.yourcustompaintings.database.PaintingRecord;
import com.vcsajen.yourcustompaintings.exceptions.MissingRequiredItemException;
import com.vcsajen.yourcustompaintings.util.BestFitRect;
import org.spongepowered.api.block.BlockTypes;
import org.spongepowered.api.data.DataQuery;
import org.spongepowered.api.data.DataView;
import org.spongepowered.api.data.key.Keys;
import org.spongepowered.api.data.property.AbstractProperty;
import org.spongepowered.api.data.property.BooleanProperty;
import org.spongepowered.api.data.property.block.PassableProperty;
import org.spongepowered.api.data.type.HandTypes;
Expand All @@ -25,14 +23,9 @@
import org.spongepowered.api.entity.living.player.gamemode.GameModes;
import org.spongepowered.api.event.Listener;
import org.spongepowered.api.event.block.InteractBlockEvent;
import org.spongepowered.api.event.cause.Cause;
import org.spongepowered.api.event.cause.entity.spawn.EntitySpawnCause;
import org.spongepowered.api.event.cause.entity.spawn.SpawnCause;
import org.spongepowered.api.event.cause.entity.spawn.SpawnTypes;
import org.spongepowered.api.event.filter.cause.Root;
import org.spongepowered.api.item.ItemTypes;
import org.spongepowered.api.item.inventory.Inventory;
import org.spongepowered.api.item.inventory.InventoryArchetype;
import org.spongepowered.api.item.inventory.ItemStack;
import org.spongepowered.api.text.Text;
import org.spongepowered.api.text.format.TextColors;
Expand All @@ -44,8 +37,6 @@
import org.spongepowered.api.world.World;

import javax.annotation.Nullable;
import java.awt.*;
import java.text.ParseException;
import java.util.List;
import java.util.UUID;
import java.util.regex.Matcher;
Expand All @@ -71,7 +62,8 @@ public static ItemStack getPaintingMapItem(int id) {

public ItemStack getPlacerItem(PaintingRecord paintingRecord)
{
ItemStack itemStack = ItemStack.builder()

return ItemStack.builder()
.itemType(ItemTypes.STICK)
.quantity(1)
.keyValue(Keys.DISPLAY_NAME, Text.of(TextStyles.RESET, itemName))
Expand All @@ -81,8 +73,6 @@ public ItemStack getPlacerItem(PaintingRecord paintingRecord)
Text.of("#"+paintingRecord.getStartMapId()+" "+paintingRecord.getMapsX()+"x"+paintingRecord.getMapsY())
))
.build();

return itemStack;
}

private Pattern pname = Pattern.compile("^\"(.+)\"$");
Expand Down Expand Up @@ -174,8 +164,7 @@ private boolean placePaintingIfPossible(PaintingRecord paintingRecord, Location<
((ItemFrame)itemFrame).setLocation(new Location<>(world, placePlace));
itemFrame.tryOffer(Keys.REPRESENTED_ITEM, getPaintingMapItem(paintingRecord.getStartMapId()+j*pw+i).createSnapshot());
itemFrame.tryOffer(Keys.DIRECTION, dir);
SpawnCause spawnCause = EntitySpawnCause.builder().entity(itemFrame).type(SpawnTypes.PLUGIN).build();
world.spawnEntity(itemFrame, Cause.source(spawnCause).build());
world.spawnEntity(itemFrame);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,12 @@
* Main plugin class
* Created by VcSaJen on 26.07.2017 17:21.
*/
@Plugin(id = "yourcustompaintings", name = "YourCustomPaintings", description = "Upload your own custom paintings to minecraft server!")
@Plugin(
id = "yourcustompaintings",
name = "YourCustomPaintings",
description = "Upload your own custom paintings to minecraft server!",
version = "1.1"
Copy link
Copy Markdown
Owner

@VcSaJen VcSaJen May 3, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not accept pull requests at this point of time, sorry.
P.S. Version is auto-generated with SpongeGradle. This line is unnecessary. Check mcmod.info inside JAR file that was generated after "assembly" gradle task.

)
public class YourCustomPaintings {
@Inject
private Logger logger;
Expand Down Expand Up @@ -777,7 +782,6 @@ private void runUploadPaintingTask(@Nonnull UploadPaintingParams params) {

ImageIO.write(mapImgOut, "png", dbgDir.resolve("scaled_mapcolor_tile_"+l+"_"+k+"_img.png").toFile());
}
//Генерируем сами файлы карт
Path fileName = dataFolder.resolve("map_tmp_"+tmpId+"_"+(k+l*params.getMapsX())+".dat");
myPlugin.getAsset("map_N.dat").orElseThrow(() -> new IOException("Asset map_N.dat not found"))
.copyToFile(fileName);
Expand Down