Skip to content

Commit 981ee14

Browse files
committed
Merge remote-tracking branch 'refs/remotes/forge/mc1.20.1/dev' into mc1.20.1/fabric/dev
# Conflicts: # .github/workflows/build.yml # build.gradle # gradle.properties # src/main/java/com/simibubi/create/Create.java # src/main/java/com/simibubi/create/compat/Mods.java # src/main/java/com/simibubi/create/content/equipment/tool/CardboardSwordItem.java # src/main/java/com/simibubi/create/content/logistics/factoryBoard/FactoryPanelBehaviour.java # src/main/java/com/simibubi/create/content/logistics/packager/PackagerBlock.java # src/main/java/com/simibubi/create/content/logistics/redstoneRequester/RedstoneRequesterMenu.java # src/main/java/com/simibubi/create/foundation/mixin/client/HeavyBootsOnPlayerMixin.java # src/main/java/com/simibubi/create/infrastructure/debugInfo/DebugInformation.java # src/main/resources/META-INF/mods.toml
2 parents 2f707ab + cda89da commit 981ee14

21 files changed

+249
-72
lines changed

changelog.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
------------------------------------------------------
2+
Create 6.0.1
3+
------------------------------------------------------
4+
5+
#### Bug Fixes
6+
7+
- Fixed Shopping lists not updating when adding purchases (1.21) #7449 #7393
8+
- Fixed Frogport ponder scene not animating correctly (1.21)
9+
- Fixed broken address filter in second stock ticker ponder scene (1.21)
10+
- Added a tooltip for the stock keeper address input
11+
- Fixed crash when re-packaging a duplicated package fragment #7456
12+
- Fixed crash when ctrl-click copying a gauge #7431
13+
- Safety check for unexpected string modifications in address edit boxes #7409
14+
- Fixed crash with fluid propagator
15+
- Fixed a crash when using factory gauges
16+
- Fixed debug info command not translating the graphics mode text
17+
- Fixed cardboard sword not being able to damage arthropod mobs other than the spider
18+
- Fixed a crash that occurred when placing a stock link on a re-packager
19+
- Fixed an issue where wearing diving boots and sprinting would force you into the swim position and then out of it
20+
right away
21+
- Fixed item group attribute filters crashing
22+
- Fixed mixin conflict with immersive portals
23+
- Fixed processing output not supporting itemstack components
24+
125
------------------------------------------------------
226
Create 6.0.0
327
------------------------------------------------------

gradle/property_loader.gradle

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
This module can inject build properties from a JSON file. Each property in the
3+
JSON file will be mapped to a build property using the key of that property.
4+
Property keys ending with _comment will be skipped.
5+
6+
If a secretFile property exists and points to a valid JSON file that file will
7+
be automatically loaded. You can manually load a file using the loadProperties
8+
method.
9+
*/
10+
import groovy.json.JsonSlurper
11+
12+
// Auto detects a secret file and injects it.
13+
if (project.rootProject.hasProperty("secretFile")) {
14+
project.logger.lifecycle("Automatically loading properties from the secretFile")
15+
final def secretsFile = project.rootProject.file(project.rootProject.getProperty("secretFile"))
16+
17+
if (secretsFile.exists() && secretsFile.name.endsWith(".json")) {
18+
loadProperties(secretsFile)
19+
}
20+
}
21+
22+
// Loads properties using a specified json file.
23+
def loadProperties(propertyFile) {
24+
if (propertyFile.exists()) {
25+
propertyFile.withReader {
26+
Map propMap = new JsonSlurper().parse it
27+
28+
for (entry in propMap) {
29+
30+
// Filter entries that use _comment in the key.
31+
if (!entry.key.endsWith("_comment")) {
32+
33+
project.ext.set(entry.key, entry.value)
34+
}
35+
}
36+
37+
project.logger.lifecycle("Successfully loaded " + propMap.size() + " properties")
38+
propMap.clear()
39+
}
40+
} else {
41+
project.logger.warn("The property file " + propertyFile.getName() + " could not be loaded. It does not exist.")
42+
}
43+
}
44+
45+
// Allows other scripts to use these methods.
46+
ext {
47+
loadProperties = this.&loadProperties
48+
}

src/main/java/com/simibubi/create/Create.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import java.util.Random;
44

5+
import com.simibubi.create.compat.inventorySorter.InventorySorterCompat;
6+
57
import org.slf4j.Logger;
68

79
import com.google.gson.Gson;

src/main/java/com/simibubi/create/compat/Mods.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public enum Mods {
3535
FTBCHUNKS,
3636
JOURNEYMAP,
3737
FTBLIBRARY,
38+
INVENTORYSORTER,
3839

3940
// fabric mods
4041
SANDWICHABLE,
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package com.simibubi.create.compat.inventorySorter;
2+
3+
import com.simibubi.create.compat.Mods;
4+
5+
import com.simibubi.create.content.logistics.redstoneRequester.RedstoneRequesterMenu.SorterProofSlot;
6+
7+
import net.minecraftforge.eventbus.api.IEventBus;
8+
import net.minecraftforge.fml.InterModComms;
9+
import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent;
10+
11+
/**
12+
* Compatibility with cpw's InventorySorter.
13+
* We need to stop it from interfering with scrolling in the Redstone Requester's screen.
14+
*/
15+
public class InventorySorterCompat {
16+
public static final String SLOT_BLACKLIST = "slotblacklist";
17+
18+
public static void init(IEventBus bus) {
19+
bus.addListener(InventorySorterCompat::sendImc);
20+
}
21+
22+
private static void sendImc(InterModEnqueueEvent event) {
23+
InterModComms.sendTo(Mods.INVENTORYSORTER.id(), SLOT_BLACKLIST, SorterProofSlot.class::getName);
24+
}
25+
}

src/main/java/com/simibubi/create/content/contraptions/render/ContraptionVisual.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
import com.simibubi.create.foundation.utility.worldWrappers.WrappedBlockAndTintGetter;
1515
import com.simibubi.create.foundation.virtualWorld.VirtualRenderWorld;
1616

17+
import net.minecraftforge.client.model.data.ModelData;
18+
1719
import dev.engine_room.flywheel.api.material.CardinalLightingMode;
1820
import dev.engine_room.flywheel.api.model.Model;
1921
import dev.engine_room.flywheel.api.task.Plan;
@@ -132,7 +134,7 @@ private void setupActors(float partialTick, Contraption contraption) {
132134
}
133135

134136
@SuppressWarnings("unchecked")
135-
protected <T extends BlockEntity> void setupVisualizer(T be, float partialTicks) {
137+
protected <T extends BlockEntity> void setupVisualizer(T be, float partialTicks) {
136138
BlockEntityVisualizer<? super T> visualizer = (BlockEntityVisualizer<? super T>) VisualizerRegistry.getVisualizer(be.getType());
137139
if (visualizer == null) {
138140
return;
@@ -182,17 +184,17 @@ private void setupActor(MutablePair<StructureTemplate.StructureBlockInfo, Moveme
182184
@Override
183185
public Plan<TickableVisual.Context> planTick() {
184186
return NestedPlan.of(
185-
ForEachPlan.of(() -> actors, ActorVisual::tick),
186-
tickableVisuals
187+
ForEachPlan.of(() -> actors, ActorVisual::tick),
188+
tickableVisuals
187189
);
188190
}
189191

190192
@Override
191193
public Plan<DynamicVisual.Context> planFrame() {
192194
return NestedPlan.of(
193-
RunnablePlan.of(this::beginFrame),
194-
ForEachPlan.of(() -> actors, ActorVisual::beginFrame),
195-
dynamicVisuals
195+
RunnablePlan.of(this::beginFrame),
196+
ForEachPlan.of(() -> actors, ActorVisual::beginFrame),
197+
dynamicVisuals
196198
);
197199
}
198200

@@ -201,7 +203,7 @@ protected void beginFrame(DynamicVisual.Context context) {
201203
setEmbeddingMatrices(partialTick);
202204

203205
if (hasMovedSections()) {
204-
sectionCollector.sections(collectLightSections());
206+
sectionCollector.sections(collectLightSections());
205207
}
206208

207209
if (hasMovedBlocks()) {
@@ -282,13 +284,13 @@ protected boolean hasMovedBlocks() {
282284
int maxY = maxLight(boundingBox.maxY);
283285
int maxZ = maxLight(boundingBox.maxZ);
284286

285-
return minBlock != BlockPos.asLong(minX, minY, minZ) || maxBlock != BlockPos.asLong(maxX, maxY, maxZ);
287+
return minBlock != BlockPos.asLong(minX, minY, minZ) || maxBlock != BlockPos.asLong(maxX, maxY, maxZ);
286288
}
287289

288290
protected boolean hasMovedSections() {
289291
var boundingBox = entity.getBoundingBox();
290292

291-
var minSectionX = minLightSection(boundingBox.minX);
293+
var minSectionX = minLightSection(boundingBox.minX);
292294
var minSectionY = minLightSection(boundingBox.minY);
293295
var minSectionZ = minLightSection(boundingBox.minZ);
294296
int maxSectionX = maxLightSection(boundingBox.maxX);

src/main/java/com/simibubi/create/content/equipment/tool/CardboardSwordItem.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@
1717
import net.minecraft.world.entity.Entity;
1818
import net.minecraft.world.entity.LivingEntity;
1919
import net.minecraft.world.entity.MobCategory;
20+
import net.minecraft.world.entity.MobType;
2021
import net.minecraft.world.entity.ai.attributes.Attributes;
21-
import net.minecraft.world.entity.monster.Spider;
2222
import net.minecraft.world.entity.player.Player;
2323
import net.minecraft.world.item.ItemStack;
2424
import net.minecraft.world.item.ItemStack.TooltipPart;
2525
import net.minecraft.world.item.SwordItem;
26+
import net.minecraft.world.item.crafting.RecipeType;
2627
import net.minecraft.world.item.enchantment.Enchantment;
2728
import net.minecraft.world.item.enchantment.EnchantmentHelper;
2829
import net.minecraft.world.item.enchantment.Enchantments;
@@ -67,7 +68,7 @@ public static void cardboardSwordsCannotHurtYou(LivingAttackEvent event) {
6768
Entity attacker = event.getSource()
6869
.getEntity();
6970
LivingEntity target = event.getEntity();
70-
if (target == null || target instanceof Spider)
71+
if (target == null || target.getMobType() == MobType.ARTHROPOD)
7172
return;
7273
if (!(attacker instanceof LivingEntity livingAttacker
7374
&& AllItems.CARDBOARD_SWORD.isIn(livingAttacker.getItemInHand(InteractionHand.MAIN_HAND))))

src/main/java/com/simibubi/create/content/logistics/factoryBoard/FactoryPanelBehaviour.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@
4747
import com.simibubi.create.foundation.blockEntity.behaviour.filtering.FilteringBehaviour;
4848
import com.simibubi.create.foundation.utility.CreateLang;
4949

50+
import net.minecraftforge.api.distmarker.Dist;
51+
import net.minecraftforge.api.distmarker.OnlyIn;
52+
import net.minecraftforge.fml.DistExecutor;
53+
import net.minecraftforge.network.NetworkHooks;
54+
5055
import net.createmod.catnip.animation.LerpedFloat;
5156
import net.createmod.catnip.animation.LerpedFloat.Chaser;
5257
import net.createmod.catnip.gui.ScreenOpener;
@@ -731,13 +736,16 @@ public int getPromised() {
731736
}
732737

733738
RequestPromiseQueue promises = Create.LOGISTICS.getQueuedPromises(network);
739+
if (promises == null)
740+
return 0;
741+
734742
if (forceClearPromises) {
735743
promises.forceClear(item);
736744
resetTimerSlightly();
737745
}
738746
forceClearPromises = false;
739747

740-
return promises == null ? 0 : promises.getTotalPromisedAndRemoveExpired(item, getPromiseExpiryTimeInTicks());
748+
return promises.getTotalPromisedAndRemoveExpired(item, getPromiseExpiryTimeInTicks());
741749
}
742750

743751
public void resetTimer() {

src/main/java/com/simibubi/create/content/logistics/factoryBoard/FactoryPanelBlock.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,16 +124,16 @@ public BlockState getStateForPlacement(BlockPlaceContext pContext) {
124124
if (blockState.is(this) && location != null && fpbe != null) {
125125
if (!level.isClientSide()) {
126126
PanelSlot targetedSlot = getTargetedSlot(pos, blockState, location);
127-
UUID networkFromStack = LogisticallyLinkedBlockItem.networkFromStack(pContext.getItemInHand());
127+
ItemStack panelItem = FactoryPanelBlockItem.fixCtrlCopiedStack(pContext.getItemInHand());
128+
UUID networkFromStack = LogisticallyLinkedBlockItem.networkFromStack(panelItem);
128129
Player pPlayer = pContext.getPlayer();
129130

130131
if (fpbe.addPanel(targetedSlot, networkFromStack) && pPlayer != null) {
131132
pPlayer.displayClientMessage(CreateLang.translateDirect("logistically_linked.connected"), true);
132133

133134
if (!pPlayer.isCreative()) {
134-
ItemStack item = pContext.getItemInHand();
135-
item.shrink(1);
136-
if (item.isEmpty())
135+
panelItem.shrink(1);
136+
if (panelItem.isEmpty())
137137
pPlayer.setItemInHand(pContext.getHand(), ItemStack.EMPTY);
138138
}
139139
}
@@ -215,7 +215,7 @@ public InteractionResult use(BlockState pState, Level pLevel, BlockPos pPos, Pla
215215

216216
PanelSlot newSlot = getTargetedSlot(pPos, pState, location);
217217
withBlockEntityDo(pLevel, pPos, fpbe -> {
218-
if (!fpbe.addPanel(newSlot, LogisticallyLinkedBlockItem.networkFromStack(item)))
218+
if (!fpbe.addPanel(newSlot, LogisticallyLinkedBlockItem.networkFromStack(FactoryPanelBlockItem.fixCtrlCopiedStack(item))))
219219
return;
220220
pPlayer.displayClientMessage(CreateLang.translateDirect("logistically_linked.connected"), true);
221221
pLevel.playSound(null, pPos, soundType.getPlaceSound(), SoundSource.BLOCKS);

src/main/java/com/simibubi/create/content/logistics/factoryBoard/FactoryPanelBlockEntity.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ public boolean addPanel(PanelSlot slot, UUID frequency) {
133133
FactoryPanelBehaviour behaviour = panels.get(slot);
134134
if (behaviour != null && !behaviour.isActive()) {
135135
behaviour.enable();
136-
behaviour.setNetwork(frequency);
136+
if (frequency != null)
137+
behaviour.setNetwork(frequency);
137138
redraw = true;
138139
lastShape = null;
139140

src/main/java/com/simibubi/create/content/logistics/factoryBoard/FactoryPanelBlockItem.java

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
package com.simibubi.create.content.logistics.factoryBoard;
22

3+
import java.util.UUID;
4+
35
import com.simibubi.create.AllSoundEvents;
6+
import com.simibubi.create.content.logistics.factoryBoard.FactoryPanelBlock.PanelSlot;
47
import com.simibubi.create.content.logistics.packagerLink.LogisticallyLinkedBlockItem;
58
import com.simibubi.create.foundation.utility.CreateLang;
69

10+
import net.minecraft.core.BlockPos;
11+
import net.minecraft.nbt.CompoundTag;
712
import net.minecraft.world.InteractionResult;
13+
import net.minecraft.world.entity.player.Player;
814
import net.minecraft.world.item.ItemStack;
915
import net.minecraft.world.item.context.BlockPlaceContext;
16+
import net.minecraft.world.level.Level;
1017
import net.minecraft.world.level.block.Block;
18+
import net.minecraft.world.level.block.state.BlockState;
1119

1220
public class FactoryPanelBlockItem extends LogisticallyLinkedBlockItem {
1321

@@ -29,5 +37,31 @@ public InteractionResult place(BlockPlaceContext pContext) {
2937

3038
return super.place(pContext);
3139
}
40+
41+
@Override
42+
protected boolean updateCustomBlockEntityTag(BlockPos pos, Level level, Player player, ItemStack stack,
43+
BlockState state) {
44+
return super.updateCustomBlockEntityTag(pos, level, player, fixCtrlCopiedStack(stack), state);
45+
}
46+
47+
public static ItemStack fixCtrlCopiedStack(ItemStack stack) {
48+
// Salvage frequency data from one of the panel slots
49+
if (isTuned(stack) && networkFromStack(stack) == null) {
50+
CompoundTag bet = stack.getTagElement(BLOCK_ENTITY_TAG);
51+
UUID frequency = UUID.randomUUID();
52+
53+
for (PanelSlot slot : PanelSlot.values()) {
54+
CompoundTag panelTag = bet.getCompound(CreateLang.asId(slot.name()));
55+
if (panelTag.hasUUID("Freq"))
56+
frequency = panelTag.getUUID("Freq");
57+
}
58+
59+
bet = new CompoundTag();
60+
bet.putUUID("Freq", frequency);
61+
stack.getTag().put(BLOCK_ENTITY_TAG, bet);
62+
}
63+
64+
return stack;
65+
}
3266

3367
}

src/main/java/com/simibubi/create/content/logistics/packager/PackageDefragmenter.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ public List<ItemStack> repack(int orderId) {
114114

115115
ItemStack output = ItemHandlerHelper.copyStackWithSize(entry.stack, removedAmount);
116116
targetAmount -= removedAmount;
117-
targetedEntry.count = targetAmount;
117+
if (targetedEntry != null)
118+
targetedEntry.count = targetAmount;
118119
entry.count -= removedAmount;
119120
outputSlots.add(output);
120121
}

0 commit comments

Comments
 (0)