Compare commits

...

3 Commits

Author SHA1 Message Date
yueh 92fb39d53a Added curseforge task 2020-07-07 10:21:58 +02:00
Sebastian Hartte eb0e4289b3 Unify the client/server-side shared itemstack registry to avoid over-dependence on the current thread
when this class is used. Otherwise if a thread is not correctly detected to be part of the server or client
thread groups, a shared item stack from the wrong domain is returned.
2020-07-05 12:23:16 +02:00
Sebastian Hartte ebbb5b1059 Removed unused storage dimension cap. 2020-07-05 12:22:06 +02:00
7 changed files with 63 additions and 87 deletions
+18 -3
View File
@@ -2,7 +2,7 @@ name: 'Release'
on:
release:
types: [created]
types: [published]
jobs:
build:
@@ -36,13 +36,28 @@ jobs:
run: ./gradlew runData --no-daemon
- name: Validate assets
run: test -d ./src/generated
- name: Build, sign, and publish with Gradle
- name: Build with Gradle
env:
KEY_STORE_PASS: ${{ secrets.KEY_STORE_PASS }}
KEY_STORE_ALIAS: ${{ secrets.KEY_STORE_ALIAS }}
KEY_STORE_KEY_PASS: ${{ secrets.KEY_STORE_KEY_PASS }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew build publish --no-daemon
run: ./gradlew build --no-daemon
- name: Upload to curseforge
env:
KEY_STORE_PASS: ${{ secrets.KEY_STORE_PASS }}
KEY_STORE_ALIAS: ${{ secrets.KEY_STORE_ALIAS }}
KEY_STORE_KEY_PASS: ${{ secrets.KEY_STORE_KEY_PASS }}
CHANGELOG: ${{ github.event.release.body }}
CURSEFORGE: ${{ secrets.CURSEFORGE }}
run: ./gradlew curseforge --no-daemon
- name: Publish to github packages
env:
KEY_STORE_PASS: ${{ secrets.KEY_STORE_PASS }}
KEY_STORE_ALIAS: ${{ secrets.KEY_STORE_ALIAS }}
KEY_STORE_KEY_PASS: ${{ secrets.KEY_STORE_KEY_PASS }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew publish --no-daemon
- name: Prepare artifact metadata
id: prepare_artifact_metadata
run: |
+2
View File
@@ -30,6 +30,7 @@ buildscript {
plugins {
id "maven-publish"
id "com.diffplug.gradle.spotless" version "4.3.0"
id "com.matthewprenger.cursegradle" version "1.4.0"
id "org.sonarqube" version "2.8"
id "jacoco"
}
@@ -165,6 +166,7 @@ task signJar(type: net.minecraftforge.gradle.common.task.SignJar, dependsOn: 're
}
apply from: 'gradle/scripts/artifacts.gradle'
apply from: 'gradle/scripts/curseforge.gradle'
publishing {
publications {
+1
View File
@@ -26,6 +26,7 @@ ctm_version=MC1.15.2-1.1.0.9
#########################################################
website_version=1.15.2
curse_versions=1.15.2
curseforge_project=223794
#########################################################
# Gradle #
+39
View File
@@ -0,0 +1,39 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2020, TeamAppliedEnergistics, 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
*g 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>.
*/
def isAlpha = project.version.contains("alpha")
def isBeta = project.version.contains("beta")
def cfReleaseType = "release"
if (isAlpha) {
cfReleaseType = "alpha"
} else if (isBeta) {
cfReleaseType = "beta"
}
if (System.getenv("CURSEFORGE")) {
curseforge {
apiKey = System.getenv("CURSEFORGE")
project {
id = project.curseforge_project
changelogType = "markdown"
changelog = System.getenv("CHANGELOG") ?: "Please visit our [releases](https://github.com/AppliedEnergistics/Applied-Energistics-2/releases) for a changelog"
releaseType = cfReleaseType
}
}
}
@@ -25,7 +25,6 @@ import net.minecraftforge.common.capabilities.CapabilityInject;
import net.minecraftforge.common.capabilities.CapabilityManager;
import net.minecraftforge.energy.IEnergyStorage;
import appeng.api.storage.ISpatialDimension;
import appeng.api.storage.IStorageMonitorableAccessor;
/**
@@ -38,8 +37,6 @@ public final class Capabilities {
public static Capability<IStorageMonitorableAccessor> STORAGE_MONITORABLE_ACCESSOR;
public static Capability<ISpatialDimension> SPATIAL_DIMENSION;
public static Capability<IEnergyStorage> FORGE_ENERGY;
/**
@@ -48,7 +45,6 @@ public final class Capabilities {
public static void register() {
CapabilityManager.INSTANCE.register(IStorageMonitorableAccessor.class, createNullStorage(),
NullMENetworkAccessor::new);
CapabilityManager.INSTANCE.register(ISpatialDimension.class, createNullStorage(), NullSpatialDimension::new);
}
@CapabilityInject(IStorageMonitorableAccessor.class)
@@ -56,11 +52,6 @@ public final class Capabilities {
STORAGE_MONITORABLE_ACCESSOR = cap;
}
@CapabilityInject(ISpatialDimension.class)
private static void capISpatialDimensionRegistered(Capability<ISpatialDimension> cap) {
SPATIAL_DIMENSION = cap;
}
@CapabilityInject(IEnergyStorage.class)
private static void capIEnergyStorageRegistered(Capability<IEnergyStorage> cap) {
FORGE_ENERGY = cap;
@@ -1,63 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2017, 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.capabilities;
import java.util.List;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.dimension.DimensionType;
import net.minecraft.world.server.ServerWorld;
import appeng.api.storage.ISpatialDimension;
class NullSpatialDimension implements ISpatialDimension {
@Override
public DimensionType createNewCellDimension(BlockPos size) {
return null;
}
@Override
public void deleteCellDimension(DimensionType cellStorageId) {
}
@Override
public BlockPos getCellDimensionOrigin(DimensionType cellStorageId) {
return null;
}
@Override
public BlockPos getCellDimensionSize(DimensionType cellDim) {
return BlockPos.ZERO;
}
@Override
public void addCellDimensionTooltip(DimensionType cellDim, List<ITextComponent> tooltip) {
}
@Override
public ServerWorld getWorld(DimensionType cellStorageId) {
return null;
}
@Override
public boolean isCellDimension(DimensionType cellDimID) {
return false;
}
}
@@ -33,20 +33,11 @@ import net.minecraft.item.ItemStack;
import appeng.util.Platform;
public final class AEItemStackRegistry {
private static final WeakHashMap<AESharedItemStack, WeakReference<AESharedItemStack>> SERVER_REGISTRY = new WeakHashMap<>();
private static final WeakHashMap<AESharedItemStack, WeakReference<AESharedItemStack>> CLIENT_REGISTRY = new WeakHashMap<>();
private static final WeakHashMap<AESharedItemStack, WeakReference<AESharedItemStack>> REGISTRY = new WeakHashMap<>();
private AEItemStackRegistry() {
}
private static WeakHashMap<AESharedItemStack, WeakReference<AESharedItemStack>> registry() {
if (Platform.isClient()) {
return CLIENT_REGISTRY;
} else {
return SERVER_REGISTRY;
}
}
static synchronized AESharedItemStack getRegisteredStack(final @Nonnull ItemStack itemStack) {
if (itemStack.isEmpty()) {
throw new IllegalArgumentException("stack cannot be empty");
@@ -56,7 +47,7 @@ public final class AEItemStackRegistry {
itemStack.setCount(1);
AESharedItemStack search = new AESharedItemStack(itemStack);
WeakReference<AESharedItemStack> weak = registry().get(search);
WeakReference<AESharedItemStack> weak = REGISTRY.get(search);
AESharedItemStack ret = null;
if (weak != null) {
@@ -65,7 +56,7 @@ public final class AEItemStackRegistry {
if (ret == null) {
ret = new AESharedItemStack(itemStack.copy());
registry().put(ret, new WeakReference<>(ret));
REGISTRY.put(ret, new WeakReference<>(ret));
}
itemStack.setCount(oldStackSize);