mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-28 07:56:09 +00:00
Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
21cea32be7 | ||
|
|
0ae4d4bd2d | ||
|
|
c0a68ee410 | ||
|
|
c7c478684d | ||
|
|
f3ffd2ab38 | ||
|
|
2892e0df64 | ||
|
|
a5e0584206 | ||
|
|
b80ce8c9a3 | ||
|
|
cb87007dfd | ||
|
|
8318b6a614 |
No files matched your search
+6
-6
@@ -1,23 +1,23 @@
|
|||||||
// Add your dependencies here
|
// Add your dependencies here
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("com.github.GTNewHorizons:CodeChickenCore:1.4.12:dev")
|
implementation("com.github.GTNewHorizons:CodeChickenCore:1.5.2:dev")
|
||||||
implementation("com.github.GTNewHorizons:NotEnoughItems:2.8.84-GTNH:dev")
|
implementation("com.github.GTNewHorizons:NotEnoughItems:2.9.18-GTNH:dev")
|
||||||
implementation("com.github.GTNewHorizons:ForgeMultipart:1.7.3:dev")
|
implementation("com.github.GTNewHorizons:ForgeMultipart:2.0.1:dev")
|
||||||
|
|
||||||
compileOnly("org.projectlombok:lombok:1.18.24")
|
compileOnly("org.projectlombok:lombok:1.18.24")
|
||||||
annotationProcessor("org.projectlombok:lombok:1.18.24")
|
annotationProcessor("org.projectlombok:lombok:1.18.24")
|
||||||
|
|
||||||
devOnlyNonPublishable("com.github.GTNewHorizons:waila:1.19.22:dev") {
|
devOnlyNonPublishable("com.github.GTNewHorizons:waila:1.20.3:dev") {
|
||||||
transitive = false
|
transitive = false
|
||||||
}
|
}
|
||||||
devOnlyNonPublishable("com.github.GTNewHorizons:WailaHarvestability:1.3.4-GTNH:dev")
|
devOnlyNonPublishable("com.github.GTNewHorizons:WailaHarvestability:1.4.0-GTNH:dev")
|
||||||
|
|
||||||
compileOnly("curse.maven:ee3-65509:2305023") { // https://www.curseforge.com/minecraft/mc-mods/ee3/files/2305023
|
compileOnly("curse.maven:ee3-65509:2305023") { // https://www.curseforge.com/minecraft/mc-mods/ee3/files/2305023
|
||||||
transitive = false
|
transitive = false
|
||||||
}
|
}
|
||||||
|
|
||||||
compileOnly("com.github.GTNewHorizons:Angelica:2.1.15:api") {
|
compileOnly("com.github.GTNewHorizons:Angelica:2.2.47:api") {
|
||||||
transitive = false
|
transitive = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -186,6 +186,11 @@ modrinthRelations =
|
|||||||
# Leave this empty if you don't want to publish on CurseForge.
|
# Leave this empty if you don't want to publish on CurseForge.
|
||||||
curseForgeProjectId =
|
curseForgeProjectId =
|
||||||
|
|
||||||
|
# Comma-separated supported CurseForge environments: client, server (case-insensitive).
|
||||||
|
# Use client or server for mods that only support one environment. Defaults to client,server.
|
||||||
|
# These tags describe where the mod can run, not whether installation is required on both sides.
|
||||||
|
curseForgeEnvironments = client,server
|
||||||
|
|
||||||
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
|
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
|
||||||
# Syntax: type1:name1;type2:name2;...
|
# Syntax: type1:name1;type2:name2;...
|
||||||
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
|
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
#This file is generated by updateDaemonJvm
|
#This file is generated by updateDaemonJvm
|
||||||
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1630f7ebef05444cb27a2709ea0249b3/redirect
|
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/f8ac1fda746e772cf5b0f48554982722/redirect
|
||||||
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/cd495626d2ee49a75447e3fdc6afb287/redirect
|
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/b4d79acf73eaf165b8c6bc8fba023764/redirect
|
||||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1630f7ebef05444cb27a2709ea0249b3/redirect
|
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/f8ac1fda746e772cf5b0f48554982722/redirect
|
||||||
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/cd495626d2ee49a75447e3fdc6afb287/redirect
|
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/b4d79acf73eaf165b8c6bc8fba023764/redirect
|
||||||
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/d4fd992c9557644e637ebe98263e0ae7/redirect
|
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/54e1f31b8c26d88fb972744b5f1ba132/redirect
|
||||||
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/faa12903720d410b387cc69ccafb1a74/redirect
|
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/7c3593fb729bc79a24557ddfe52a53a6/redirect
|
||||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1630f7ebef05444cb27a2709ea0249b3/redirect
|
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/f8ac1fda746e772cf5b0f48554982722/redirect
|
||||||
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/cd495626d2ee49a75447e3fdc6afb287/redirect
|
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/b4d79acf73eaf165b8c6bc8fba023764/redirect
|
||||||
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/a4c09dd2e2d7079373d30e524bbc2829/redirect
|
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/a7c7be8a3ec5d8e677e7250d9c1ce3ed/redirect
|
||||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/8e1d9ee5d0f13e442218f6884a306da1/redirect
|
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/832ed89f4b59e936e5cbc9a5b76b3411/redirect
|
||||||
toolchainVersion=25
|
toolchainVersion=25
|
||||||
Vendored
BIN
Binary file not shown.
+3
-1
@@ -1,7 +1,9 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.1-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
|
retries=0
|
||||||
|
retryBackOffMs=500
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
#
|
#
|
||||||
# Gradle start up script for POSIX generated by Gradle.
|
# gradlew start up script for POSIX generated by Gradle.
|
||||||
#
|
#
|
||||||
# Important for running:
|
# Important for running:
|
||||||
#
|
#
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
# bash, then to run this script, type that shell name before the whole
|
# bash, then to run this script, type that shell name before the whole
|
||||||
# command line, like:
|
# command line, like:
|
||||||
#
|
#
|
||||||
# ksh Gradle
|
# ksh gradlew
|
||||||
#
|
#
|
||||||
# Busybox and similar reduced shells will NOT work, because this script
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
# requires all of these POSIX shell features:
|
# requires all of these POSIX shell features:
|
||||||
@@ -57,7 +57,7 @@
|
|||||||
# Darwin, MinGW, and NonStop.
|
# Darwin, MinGW, and NonStop.
|
||||||
#
|
#
|
||||||
# (3) This script is generated from the Groovy template
|
# (3) This script is generated from the Groovy template
|
||||||
# https://github.com/gradle/gradle/blob/b631911858264c0b6e4d6603d677ff5218766cee/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
# within the Gradle project.
|
# within the Gradle project.
|
||||||
#
|
#
|
||||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
|||||||
Vendored
+12
-23
@@ -19,12 +19,12 @@
|
|||||||
@if "%DEBUG%"=="" @echo off
|
@if "%DEBUG%"=="" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@rem
|
@rem
|
||||||
@rem Gradle startup script for Windows
|
@rem gradlew startup script for Windows
|
||||||
@rem
|
@rem
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
|
|
||||||
@rem Set local scope for the variables with windows NT shell
|
@rem Set local scope for the variables, and ensure extensions are enabled
|
||||||
if "%OS%"=="Windows_NT" setlocal
|
setlocal EnableExtensions
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
set DIRNAME=%~dp0
|
||||||
if "%DIRNAME%"=="" set DIRNAME=.
|
if "%DIRNAME%"=="" set DIRNAME=.
|
||||||
@@ -51,7 +51,7 @@ echo. 1>&2
|
|||||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
echo location of your Java installation. 1>&2
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
"%COMSPEC%" /c exit 1
|
||||||
|
|
||||||
:findJavaFromJavaHome
|
:findJavaFromJavaHome
|
||||||
set JAVA_HOME=%JAVA_HOME:"=%
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
@@ -65,29 +65,18 @@ echo. 1>&2
|
|||||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
echo location of your Java installation. 1>&2
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
"%COMSPEC%" /c exit 1
|
||||||
|
|
||||||
:execute
|
:execute
|
||||||
@rem Setup the command line
|
@rem Setup the command line
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@rem Execute Gradle
|
@rem Execute gradlew
|
||||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
@rem endlocal doesn't take effect until after the line is parsed and variables are expanded
|
||||||
|
@rem which allows us to clear the local environment before executing the java command
|
||||||
|
endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel
|
||||||
|
|
||||||
:end
|
:exitWithErrorLevel
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts
|
||||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
"%COMSPEC%" /c exit %ERRORLEVEL%
|
||||||
|
|
||||||
:fail
|
|
||||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
|
||||||
rem the _cmd.exe /c_ return code!
|
|
||||||
set EXIT_CODE=%ERRORLEVEL%
|
|
||||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
|
||||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
|
||||||
exit /b %EXIT_CODE%
|
|
||||||
|
|
||||||
:mainEnd
|
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
|
||||||
|
|
||||||
:omega
|
|
||||||
+1
-1
@@ -17,7 +17,7 @@ pluginManagement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.24'
|
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.34'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -4,8 +4,12 @@ import java.util.Collections;
|
|||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
@@ -69,6 +73,65 @@ public class CarvingUtils {
|
|||||||
return new SimpleCarvingGroup(name);
|
return new SimpleCarvingGroup(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attempts to chisel the {@link ItemStack} from {@code input} into the {@code target} {@link ItemStack}.
|
||||||
|
* If it can be chiseled, the input's stack size and NBT data will be copied over
|
||||||
|
* to the newly created {@link ItemStack}.
|
||||||
|
*
|
||||||
|
* @param input The original {@link ItemStack} to be chiseled. Can't be {@code null}.
|
||||||
|
* @param target The desired {@link ItemStack} chiseling target. Stack size and NBT data are ignored.
|
||||||
|
* Can't be {@code null}.
|
||||||
|
*
|
||||||
|
* @return A copy of the {@code target} {@link ItemStack} with the input's stack count and NBT data,
|
||||||
|
* if this is a valid chiseling operation. Will return {@code null} if it's not possible to chisel
|
||||||
|
* {@code input} into {@code target}.
|
||||||
|
*/
|
||||||
|
public static @Nullable ItemStack tryChiselingInto(@Nonnull ItemStack input, @Nonnull ItemStack target) {
|
||||||
|
ICarvingRegistry registry = getChiselRegistry();
|
||||||
|
if (registry == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ItemStack> chiselGroup = registry.getItemsForChiseling(input);
|
||||||
|
if (chiselGroup != null) {
|
||||||
|
for (ItemStack variation : chiselGroup) {
|
||||||
|
if (target.getItemDamage() == variation.getItemDamage() && target.getItem() == variation.getItem()) {
|
||||||
|
return applyInputToChiselTarget(input, variation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an {@link ItemStack} copy of {@code target} with the stack size and NBT data from {@code input}.
|
||||||
|
* Used as a step in a chisel craft. This method does not validate whether the chisel craft from
|
||||||
|
* {@code input} to {@code target} does actually exist.
|
||||||
|
* <p>
|
||||||
|
* In general, you should prefer using the method {@link tryChiselingInto}, as it safeguards against
|
||||||
|
* invalid chisel operations. This method is kept as an option in situations where the craft has already been
|
||||||
|
* confirmed as valid, and we can skip the expensive operation of creating a list of chisel
|
||||||
|
* variants to simply validate it again.
|
||||||
|
*
|
||||||
|
* @param input The {@link ItemStack} provider for the stack size and NBT data. Can't be {@code null}.
|
||||||
|
* @param target The {@link ItemStack} template that serves as the base for the result. Can't be {@code null}.
|
||||||
|
*/
|
||||||
|
public static @Nonnull ItemStack applyInputToChiselTarget(@Nonnull ItemStack input, @Nonnull ItemStack target) {
|
||||||
|
ItemStack result = new ItemStack(target.getItem(), input.stackSize, target.getItemDamage());
|
||||||
|
|
||||||
|
// Copy NBT from input to target to both avoid dupes and prevent loss of stored information
|
||||||
|
// (such as when chiseling drawers with items inside)
|
||||||
|
NBTTagCompound inputNBT = input.getTagCompound();
|
||||||
|
if (inputNBT != null) {
|
||||||
|
inputNBT = (NBTTagCompound) inputNBT.copy();
|
||||||
|
}
|
||||||
|
|
||||||
|
result.setTagCompound(inputNBT);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
public static class SimpleCarvingVariation implements ICarvingVariation {
|
public static class SimpleCarvingVariation implements ICarvingVariation {
|
||||||
|
|
||||||
private int order;
|
private int order;
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ import team.chisel.world.GeneratorChisel;
|
|||||||
name = Chisel.MOD_NAME,
|
name = Chisel.MOD_NAME,
|
||||||
version = Chisel.VERSION,
|
version = Chisel.VERSION,
|
||||||
guiFactory = "team.chisel.client.gui.GuiFactory",
|
guiFactory = "team.chisel.client.gui.GuiFactory",
|
||||||
dependencies = "after:EE3;after:ForgeMultipart;after:Thaumcraft;after:appliedenergistics2;after:Railcraft;after:AWWayofTime;after:TwilightForest;after:BiomesOPlenty")
|
dependencies = "after:EE3;after:ForgeMultipart@[2.0.0,);after:Thaumcraft;after:appliedenergistics2;after:Railcraft;after:AWWayofTime;after:TwilightForest;after:BiomesOPlenty")
|
||||||
public class Chisel {
|
public class Chisel {
|
||||||
|
|
||||||
public static final String MOD_ID = "chisel";
|
public static final String MOD_ID = "chisel";
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import net.minecraft.util.EnumChatFormatting;
|
|||||||
import net.minecraft.util.StatCollector;
|
import net.minecraft.util.StatCollector;
|
||||||
|
|
||||||
import com.cricketcraft.chisel.api.IChiselItem;
|
import com.cricketcraft.chisel.api.IChiselItem;
|
||||||
|
import com.cricketcraft.chisel.api.carving.CarvingUtils;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
@@ -81,6 +82,11 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory
|
|||||||
|
|
||||||
private ItemStack lastBase;
|
private ItemStack lastBase;
|
||||||
|
|
||||||
|
// Crafting caches to avoid creating a new ItemStack result each tick
|
||||||
|
private ItemStack baseCache = null;
|
||||||
|
private ItemStack targetCache = null;
|
||||||
|
private ItemStack resultCache;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canUpdate() {
|
public boolean canUpdate() {
|
||||||
return true;
|
return true;
|
||||||
@@ -126,69 +132,91 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
|
// Client-side visuals
|
||||||
ItemStack base = inventory[BASE], target = getTarget(), output = inventory[OUTPUT];
|
if (worldObj.isRemote) {
|
||||||
|
|
||||||
if (!worldObj.isRemote && hasChisel() && base != null && target != null) {
|
|
||||||
if (canBeMadeFrom(base, target)) {
|
|
||||||
if (progress >= (hasUpgrade(Upgrade.SPEED) ? FAST_SPEED : SLOW_SPEED)) {
|
|
||||||
|
|
||||||
// reset progress
|
|
||||||
progress = 0;
|
|
||||||
|
|
||||||
// the max possible for this craft
|
|
||||||
int canBeMade = target.getMaxStackSize();
|
|
||||||
|
|
||||||
// if there are items in the output, they count towards the max we can make
|
|
||||||
if (output != null) {
|
|
||||||
canBeMade -= output.stackSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
// can't make more than we have
|
|
||||||
canBeMade = Math.min(base.stackSize, canBeMade);
|
|
||||||
|
|
||||||
// if we can't make any, forget it
|
|
||||||
if (canBeMade <= 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// result will always be a copy of the target
|
|
||||||
ItemStack chiseled = target.copy();
|
|
||||||
|
|
||||||
// if we have the stack upgrade, boost the stack size to the max possible, otherwise just one
|
|
||||||
chiseled.stackSize = hasUpgrade(Upgrade.STACK) ? canBeMade : 1;
|
|
||||||
|
|
||||||
if (canChisel(chiseled)) {
|
|
||||||
// if our output is empty, just use the current result
|
|
||||||
if (output == null) {
|
|
||||||
setInventorySlotContents(OUTPUT, chiseled);
|
|
||||||
} else {
|
|
||||||
// otherwise just add our result to the existing stack
|
|
||||||
inventory[OUTPUT].stackSize += chiseled.stackSize;
|
|
||||||
slotChanged(OUTPUT);
|
|
||||||
}
|
|
||||||
|
|
||||||
chiselItem(chiseled.stackSize, target);
|
|
||||||
|
|
||||||
// remove what we made from the stack
|
|
||||||
base.stackSize -= chiseled.stackSize;
|
|
||||||
if (base.stackSize <= 0) {
|
|
||||||
setInventorySlotContents(BASE, null); // clear out 0 size itemstacks
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (worldObj.getTotalWorldTime() % 10 == 0) {
|
|
||||||
progress++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (worldObj.isRemote) {
|
|
||||||
if (chiseling) {
|
if (chiseling) {
|
||||||
chiselRot += rotAmnt;
|
chiselRot += rotAmnt;
|
||||||
if (chiselRot >= maxRot) {
|
if (chiselRot >= maxRot) {
|
||||||
|
// Play Chisel SFX
|
||||||
chiselItem(0, getTarget());
|
chiselItem(0, getTarget());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
chiselRot = Math.max(chiselRot - rotAmnt, 0);
|
chiselRot = Math.max(chiselRot - rotAmnt, 0);
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Server-side crafting
|
||||||
|
ItemStack base = inventory[BASE];
|
||||||
|
ItemStack target = getTarget();
|
||||||
|
if (base == null || target == null || !hasChisel()) {
|
||||||
|
baseCache = targetCache = resultCache = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Something has changed about the recipe, regenerate caches
|
||||||
|
if (resultCache == null || baseCache != base || targetCache != target) {
|
||||||
|
// Unfiltered chisel result. Actual crafting might fail or be of a lower stack size than this.
|
||||||
|
resultCache = CarvingUtils.tryChiselingInto(base, target);
|
||||||
|
if (resultCache == null) {
|
||||||
|
// Not a valid chisel recipe
|
||||||
|
baseCache = targetCache = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
baseCache = base;
|
||||||
|
targetCache = target;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (progress < (hasUpgrade(Upgrade.SPEED) ? FAST_SPEED : SLOW_SPEED)) {
|
||||||
|
if (worldObj.getTotalWorldTime() % 10 == 0) {
|
||||||
|
progress++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update progress and return
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Crafting finished
|
||||||
|
progress = 0;
|
||||||
|
|
||||||
|
// Use the template's stack size as the max possible for this craft
|
||||||
|
int canBeMade = target.getMaxStackSize();
|
||||||
|
|
||||||
|
// If there are items in the output, they count towards the max we can make
|
||||||
|
ItemStack output = inventory[OUTPUT];
|
||||||
|
if (output != null) {
|
||||||
|
canBeMade -= output.stackSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Can't make more than we have
|
||||||
|
canBeMade = Math.min(base.stackSize, canBeMade);
|
||||||
|
|
||||||
|
// If we can't make any, forget it
|
||||||
|
if (canBeMade <= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we have the stack upgrade, boost the stack size to the max possible, otherwise just one
|
||||||
|
resultCache.stackSize = hasUpgrade(Upgrade.STACK) ? canBeMade : 1;
|
||||||
|
|
||||||
|
if (canChisel(resultCache)) {
|
||||||
|
// Use (and possibly break) the chisel
|
||||||
|
chiselItem(resultCache.stackSize, target);
|
||||||
|
|
||||||
|
// Remove what we made from the input stack and add it to the output stack
|
||||||
|
base.stackSize -= resultCache.stackSize;
|
||||||
|
if (base.stackSize <= 0) {
|
||||||
|
setInventorySlotContents(BASE, null);
|
||||||
|
baseCache = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (output == null) {
|
||||||
|
setInventorySlotContents(OUTPUT, resultCache.copy());
|
||||||
|
} else {
|
||||||
|
inventory[OUTPUT].stackSize += resultCache.stackSize;
|
||||||
|
slotChanged(OUTPUT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,17 +230,6 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// lets make sure the user isn't trying to make something from a block that doesn't have this as a valid target
|
|
||||||
private boolean canBeMadeFrom(ItemStack from, ItemStack to) {
|
|
||||||
List<ItemStack> results = Carving.chisel.getItemsForChiseling(from);
|
|
||||||
for (ItemStack s : results) {
|
|
||||||
if (s.getItem() == to.getItem() && s.getItemDamage() == to.getItemDamage()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean canChisel(ItemStack toMerge) {
|
private boolean canChisel(ItemStack toMerge) {
|
||||||
// if the output slot is empty we can merge without checking
|
// if the output slot is empty we can merge without checking
|
||||||
if (inventory[OUTPUT] == null) {
|
if (inventory[OUTPUT] == null) {
|
||||||
|
|||||||
@@ -1,25 +1,27 @@
|
|||||||
package team.chisel.compat.fmp;
|
package team.chisel.compat.fmp;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
|
import codechicken.lib.data.MCDataInput;
|
||||||
import codechicken.lib.vec.BlockCoord;
|
import codechicken.lib.vec.BlockCoord;
|
||||||
import codechicken.microblock.MicroMaterialRegistry;
|
import codechicken.microblock.MicroMaterialRegistry;
|
||||||
import codechicken.multipart.MultiPartRegistry;
|
import codechicken.multipart.MultiPartRegistry;
|
||||||
import codechicken.multipart.MultiPartRegistry.IPartConverter;
|
import codechicken.multipart.MultiPartRegistry.IPartConverter;
|
||||||
import codechicken.multipart.MultiPartRegistry.IPartFactory;
|
import codechicken.multipart.MultiPartRegistry.IPartFactory2;
|
||||||
import codechicken.multipart.TMultiPart;
|
import codechicken.multipart.TMultiPart;
|
||||||
import team.chisel.client.render.FullBrightMicroMaterial;
|
import team.chisel.client.render.FullBrightMicroMaterial;
|
||||||
import team.chisel.init.ChiselBlocks;
|
import team.chisel.init.ChiselBlocks;
|
||||||
|
|
||||||
public class FMPCompat implements IPartFactory, IPartConverter {
|
public class FMPCompat implements IPartFactory2, IPartConverter {
|
||||||
|
|
||||||
public void init() {
|
public void init() {
|
||||||
MultiPartRegistry.registerConverter(this);
|
MultiPartRegistry.registerConverter(this);
|
||||||
MultiPartRegistry.registerParts(this, new String[] { "chisel_torch" });
|
MultiPartRegistry.registerPartFactory(this, "chisel_torch");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -39,7 +41,21 @@ public class FMPCompat implements IPartFactory, IPartConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TMultiPart createPart(String type, boolean client) {
|
public TMultiPart createPart(String type, NBTTagCompound nbt) {
|
||||||
|
return newPart(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TMultiPart createPart(String type, MCDataInput packet) {
|
||||||
|
return newPart(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TMultiPart createPartForClientPreview(String type, NBTTagCompound nbt) {
|
||||||
|
return newPart(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static TMultiPart newPart(String type) {
|
||||||
if (type.equals("chisel_torch")) {
|
if (type.equals("chisel_torch")) {
|
||||||
return new PartChiselTorch();
|
return new PartChiselTorch();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.StatCollector;
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
@@ -76,7 +77,7 @@ public class RecipeHandlerChisel extends TemplateRecipeHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getRecipeName() {
|
public String getRecipeName() {
|
||||||
return "Chisel";
|
return StatCollector.translateToLocal("chisel.nei.title");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -146,7 +146,16 @@ public class InventoryChiselSelection implements IInventory {
|
|||||||
list.get(activeVariations + currentScroll)
|
list.get(activeVariations + currentScroll)
|
||||||
.getItem()))
|
.getItem()))
|
||||||
!= null) {
|
!= null) {
|
||||||
inventory[activeVariations] = list.get(activeVariations + currentScroll);
|
ItemStack variationTemplate = list.get(activeVariations + currentScroll);
|
||||||
|
|
||||||
|
// Preserve the original's NBT tags
|
||||||
|
if (chiseledItem.hasTagCompound()) {
|
||||||
|
variationTemplate = variationTemplate.copy();
|
||||||
|
// We can defer the deep copy the NBT object until the player actually chisels the item
|
||||||
|
variationTemplate.setTagCompound(chiseledItem.getTagCompound());
|
||||||
|
}
|
||||||
|
|
||||||
|
inventory[activeVariations] = variationTemplate;
|
||||||
activeVariations++;
|
activeVariations++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.inventory.Slot;
|
import net.minecraft.inventory.Slot;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
|
|
||||||
import com.cricketcraft.chisel.api.IChiselItem;
|
import com.cricketcraft.chisel.api.IChiselItem;
|
||||||
@@ -40,30 +41,32 @@ public class SlotChiselSelection extends Slot {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPickupFromSlot(EntityPlayer player, ItemStack itemstack) {
|
public void onPickupFromSlot(EntityPlayer player, ItemStack itemstack) {
|
||||||
|
ItemStack chiselInput = selInventory.inventory[InventoryChiselSelection.normalSlots];
|
||||||
ItemStack heldStack = player.inventory.getItemStack();
|
ItemStack heldStack = player.inventory.getItemStack();
|
||||||
ItemStack crafted = selInventory.inventory[InventoryChiselSelection.normalSlots];
|
|
||||||
|
|
||||||
|
// Was chiseled by clicking 1-9 or Q, chisel only one item from the stack
|
||||||
if (heldStack == null) {
|
if (heldStack == null) {
|
||||||
selInventory.decrStackSize(InventoryChiselSelection.normalSlots, 1);
|
selInventory.decrStackSize(InventoryChiselSelection.normalSlots, 1);
|
||||||
} else {
|
if (selInventory.inventory[InventoryChiselSelection.normalSlots] != null) {
|
||||||
putStack(itemstack.copy());
|
NBTTagCompound stackNBT = itemstack.getTagCompound();
|
||||||
|
if (stackNBT != null) {
|
||||||
|
// Deep copy the resulting stack's NBT to prevent it from sharing
|
||||||
|
// the same NBT object reference with the unchiseled ItemStack
|
||||||
|
itemstack.setTagCompound((NBTTagCompound) stackNBT.copy());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
player.inventory.setItemStack(null);
|
// Was clicked normally (or shift-clicked), chisel the entire stack
|
||||||
|
else {
|
||||||
if (selInventory.inventory[InventoryChiselSelection.normalSlots] == null) return;
|
heldStack.stackSize = chiselInput.stackSize;
|
||||||
|
|
||||||
player.inventory.setItemStack(
|
|
||||||
new ItemStack(
|
|
||||||
itemstack.getItem(),
|
|
||||||
selInventory.inventory[InventoryChiselSelection.normalSlots].stackSize,
|
|
||||||
itemstack.getItemDamage()));
|
|
||||||
selInventory.setInventorySlotContents(InventoryChiselSelection.normalSlots, null);
|
selInventory.setInventorySlotContents(InventoryChiselSelection.normalSlots, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
selInventory.updateItems();
|
selInventory.updateItems();
|
||||||
|
|
||||||
if (((IChiselItem) container.chisel.getItem())
|
if (((IChiselItem) container.chisel.getItem())
|
||||||
.onChisel(player.worldObj, container.chisel, General.getVariation(crafted))) {
|
.onChisel(player.worldObj, container.chisel, General.getVariation(chiselInput))) {
|
||||||
container.chisel.damageItem(1, player);
|
container.chisel.damageItem(1, player);
|
||||||
if (container.chisel.stackSize <= 0) {
|
if (container.chisel.stackSize <= 0) {
|
||||||
player.setCurrentItemOrArmor(0, null);
|
player.setCurrentItemOrArmor(0, null);
|
||||||
@@ -71,7 +74,7 @@ public class SlotChiselSelection extends Slot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (player.worldObj.isRemote) {
|
if (player.worldObj.isRemote) {
|
||||||
String sound = Carving.chisel.getVariationSound(crafted.getItem(), crafted.getItemDamage());
|
String sound = Carving.chisel.getVariationSound(chiselInput.getItem(), chiselInput.getItemDamage());
|
||||||
GeneralClient.playChiselSound(
|
GeneralClient.playChiselSound(
|
||||||
player.worldObj,
|
player.worldObj,
|
||||||
MathHelper.floor_double(player.posX),
|
MathHelper.floor_double(player.posX),
|
||||||
@@ -79,7 +82,7 @@ public class SlotChiselSelection extends Slot {
|
|||||||
MathHelper.floor_double(player.posZ),
|
MathHelper.floor_double(player.posZ),
|
||||||
sound);
|
sound);
|
||||||
} else {
|
} else {
|
||||||
container.playerInventory.player.addStat(Statistics.blocksChiseled, crafted.stackSize);
|
container.playerInventory.player.addStat(Statistics.blocksChiseled, itemstack.stackSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -148,6 +148,9 @@ autochisel.slot.stack.tooltip=Stack Upgrade Slot
|
|||||||
autochisel.slot.reversion.tooltip=Reversion Upgrade Slot
|
autochisel.slot.reversion.tooltip=Reversion Upgrade Slot
|
||||||
chisel.autochisel.upgrade.disabled=Upgrades Disabled
|
chisel.autochisel.upgrade.disabled=Upgrades Disabled
|
||||||
|
|
||||||
|
#NEI
|
||||||
|
chisel.nei.title=Chisel
|
||||||
|
|
||||||
#Beacon
|
#Beacon
|
||||||
tile.chisel.beacon.name=Beacon
|
tile.chisel.beacon.name=Beacon
|
||||||
tile.beacon.black.desc=Black Beamed Beacon
|
tile.beacon.black.desc=Black Beamed Beacon
|
||||||
|
|||||||
Reference in new issue
Block a user