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
1 change: 1 addition & 0 deletions REPAIRED.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,4 @@ Unticked checkboxes indicate the issue is fixed in dev but not released yet.
- [x] [Fix a dupe when breaking a Postbox while its menu is open](https://github.com/Creators-of-Create/Create/pull/9802) (Thanks, techno-sam!)
- [x] [Fix a dupe with the Schematicannon ignoring BlockEntity item requirements](https://github.com/Creators-of-Create/Create/issues/9511) (Thanks, IThundxr!)
- [x] [Fix a dupe with the Deployer](https://github.com/Creators-of-Create/Create/commit/dd133f667969870dd6e9b96395097ac93cd91ced) (Thanks, IThundxr!)
- [ ] [Fix a dupe when making a contraption with attached blocks to attached blocks](https://github.com/Creators-of-Create/Create/pull/9399) (Thanks, Allmoz!)
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package ch.voidlee.repair.mixin.bug_fixes.dupes;

import com.simibubi.create.content.contraptions.Contraption;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import java.util.*;

// https://github.com/Creators-of-Create/Create/pull/9399
@Mixin(Contraption.class)
public abstract class ContraptionMixin {
@Shadow(remap = false)
protected Map<BlockPos, StructureBlockInfo> blocks;

@Inject(method = "<init>()V", at = @At("TAIL"), remap = false)
private void create_repair$blocksStoredInLinkedHashMap(CallbackInfo ci) {
this.blocks = new LinkedHashMap<>(this.blocks);
}

@Inject(method = "removeBlocksFromWorld", at = @At("HEAD"), remap = false)
private void create_repair$iterateBlocksInReverse(Level world, BlockPos offset, CallbackInfo ci) {
List<Map.Entry<BlockPos, StructureBlockInfo>> entries = new ArrayList<>(this.blocks.entrySet());
Collections.reverse(entries);
this.blocks.clear();
entries.forEach(e -> this.blocks.put(e.getKey(), e.getValue()));
}
}
1 change: 1 addition & 0 deletions src/main/resources/mixins.create_repair.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"bug_fixes.clearable.StockTickerBlockEntityMixin",
"bug_fixes.clearable.ThresholdSwitchBlockEntityMixin",
"bug_fixes.clearable.TrackObserverBlockEntityMixin",
"bug_fixes.dupes.ContraptionMixin",
"bug_fixes.dupes.DeployerNotifyUpdateMixin",
"bug_fixes.dupes.PostboxBlockEntityMixin",
"bug_fixes.dupes.SchematicPrinterMixin",
Expand Down