Skip to content

Commit

Permalink
V 1.4.2 - BETA
Browse files Browse the repository at this point in the history
Removed Creative Inventory fix as it was breaking more things than it was fixing
  • Loading branch information
mattymatty97 committed Nov 9, 2021
1 parent 00c4d17 commit aaa1246
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 50 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,4 @@ run/

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar
/output/
47 changes: 46 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
id 'maven-publish'
}

version = project.mod_version
version = project.mod_version + project.mod_suffix
group = project.maven_group

repositories {
Expand Down Expand Up @@ -92,3 +92,48 @@ publishing {
// retrieving dependencies.
}
}

def buildnumber = 1

tasks.register("updateBuildNumber") {
doLast {
Properties props = new Properties()

File propsFile = new File('build.properties')

props.load(propsFile.newDataInputStream())

String prevVersion = (props.getProperty('mod_version'))

if (prevVersion.equals(project.mod_version)) {

buildnumber = (((props.getProperty('mod_buildnumber')) as Integer) + 1)

}

props.setProperty('mod_buildnumber', buildnumber.toString())
props.setProperty('mod_version', project.mod_version.toString())

props.store(propsFile.newWriter(), null)

props.load(propsFile.newDataInputStream())

}
outputs.upToDateWhen { false }
}

tasks.register("FinalizeBuild", Copy){
from "$buildDir/libs"
into "output/libs"
include "${project.archives_base_name}-${project.version}.jar"
rename { String filename ->
return "${project.archives_base_name}-${project.version} build ${buildnumber}.jar"
}
doLast {
mkdir "output/libs"
}
}

tasks.build.finalizedBy updateBuildNumber
tasks.updateBuildNumber.shouldRunAfter build
tasks.updateBuildNumber.finalizedBy FinalizeBuild
3 changes: 3 additions & 0 deletions build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#Tue Nov 09 14:01:36 CET 2021
mod_version=1.4.1
mod_buildnumber=17
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ yarn_mappings=1.17.1+build.63
loader_version=0.12.4
carpet_core_version=1.4.52+v211104
# Mod Properties
mod_version=1.4.1-BETA
mod_version=1.4.2
mod_suffix=-BETA
maven_group=carpet-shadow-item
archives_base_name=carpet-shadow
# Dependencies
Expand Down

This file was deleted.

14 changes: 5 additions & 9 deletions src/main/java/com/carpet_shadow/mixins/fragility/SlotMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,19 @@
@Mixin(Slot.class)
public abstract class SlotMixin {

@Shadow public abstract ItemStack getStack();

@Shadow public abstract ItemStack takeStack(int amount);

@Shadow public abstract void setStack(ItemStack stack);

@Redirect(method = "tryTakeStackRange", at=@At(value = "INVOKE",target = "Lnet/minecraft/screen/slot/Slot;takeStack(I)Lnet/minecraft/item/ItemStack;"))
public ItemStack fixFragility_tryTakeStackRange(Slot instance, int amount){
if(CarpetShadowSettings.shadowItemFragilityFixes && ((ShadowItem)(Object)this.getStack()).getShadowId()!=null &&
amount == this.getStack().getCount()){
ItemStack ret = this.getStack();
if(CarpetShadowSettings.shadowItemFragilityFixes && ((ShadowItem)(Object)instance.getStack()).getShadowId()!=null &&
amount == instance.getStack().getCount()){
ItemStack ret = instance.getStack();
ItemStack res = ret.copy();
res.setCount(0);
this.setStack(res);
instance.setStack(res);
return ret;
}
return takeStack(amount);
return instance.takeStack(amount);
}

@Inject(method = "insertStack(Lnet/minecraft/item/ItemStack;I)Lnet/minecraft/item/ItemStack;",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.carpet_shadow.mixins.general;
package com.carpet_shadow.mixins.tooltip;

import com.carpet_shadow.CarpetShadow;
import com.carpet_shadow.CarpetShadowSettings;
Expand All @@ -19,12 +19,6 @@ public abstract class InventoryS2CPacketMixin {
@Redirect(method = "<init>(IILnet/minecraft/util/collection/DefaultedList;Lnet/minecraft/item/ItemStack;)V",
at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;copy()Lnet/minecraft/item/ItemStack;"))
public ItemStack copy_redirect(ItemStack instance){
if(CarpetShadowSettings.shadowItemFragilityFixes && ((ShadowItem)(Object)instance).getShadowId()!=null){
Reference<ItemStack> reference = CarpetShadow.shadowMap.get(((ShadowItem)(Object)instance).getShadowId());
if (reference!=null && !reference.refersTo(null)) {
return reference.get();
}
}
if(CarpetShadowSettings.shadowItemTooltip){
return ShadowItem.copy_redirect(instance);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.carpet_shadow.mixins.general;
package com.carpet_shadow.mixins.tooltip;

import com.carpet_shadow.CarpetShadowSettings;
import com.carpet_shadow.interfaces.ShadowItem;
Expand All @@ -12,7 +12,7 @@
public abstract class ScreenHandlerSlotUpdateS2CPacketMixin {
@Redirect(method ="<init>(IIILnet/minecraft/item/ItemStack;)V", at=@At(value = "INVOKE",target = "Lnet/minecraft/item/ItemStack;copy()Lnet/minecraft/item/ItemStack;"))
public ItemStack copy_redirect(ItemStack instance){
if(CarpetShadowSettings.shadowItemTooltip || CarpetShadowSettings.shadowItemFragilityFixes){
if(CarpetShadowSettings.shadowItemTooltip ){
return ShadowItem.copy_redirect(instance);
}
return instance.copy();
Expand Down
5 changes: 2 additions & 3 deletions src/main/resources/carpet-shadow.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"package": "com.carpet_shadow.mixins",
"compatibilityLevel": "JAVA_16",
"mixins": [
"fragility.CreativeInventoryActionC2SPacketMixin",
"fragility.DropperBlockMixin",
"fragility.HopperBlockEntityMixin",
"fragility.ItemEntityMixin",
Expand All @@ -14,11 +13,11 @@
"general.ItemStackMixin",
"general.ScreenHandlerMixin",
"persistence.ItemStackMixin",
"general.InventoryS2CPacketMixin",
"tooltip.InventoryS2CPacketMixin",
"tooltip.ItemStackMixin",
"tooltip.PacketByteBufMixin",
"tooltip.ScreenHandlerMixin",
"general.ScreenHandlerSlotUpdateS2CPacketMixin"
"tooltip.ScreenHandlerSlotUpdateS2CPacketMixin"
],
"client": [
],
Expand Down

0 comments on commit aaa1246

Please sign in to comment.