Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/1.20.x' into 1.20.x
Browse files Browse the repository at this point in the history
  • Loading branch information
XFactHD committed Dec 23, 2023
2 parents 75ec159 + 2b70b17 commit 65a467d
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
--- a/net/minecraft/client/gui/screens/packs/PackSelectionModel.java
+++ b/net/minecraft/client/gui/screens/packs/PackSelectionModel.java
@@ -31,7 +_,7 @@
@@ -31,9 +_,9 @@
this.onListChanged = p_99909_;
this.iconGetter = p_99910_;
this.repository = p_99911_;
- this.selected = Lists.newArrayList(p_99911_.getSelectedPacks());
+ this.selected = Lists.newArrayList(p_99911_.getSelectedPacks().stream().filter(p -> !p.isHidden()).toList());
Collections.reverse(this.selected);
this.unselected = Lists.newArrayList(p_99911_.getAvailablePacks());
- this.unselected = Lists.newArrayList(p_99911_.getAvailablePacks());
+ this.unselected = Lists.newArrayList(p_99911_.getAvailablePacks().stream().filter(p -> !p.isHidden()).toList());
this.unselected.removeAll(this.selected);
this.output = p_99912_;
}
@@ -59,7 +_,7 @@
this.repository.reload();
this.selected.retainAll(this.repository.getAvailablePacks());
this.unselected.clear();
- this.unselected.addAll(this.repository.getAvailablePacks());
+ this.unselected.addAll(this.repository.getAvailablePacks().stream().filter(p -> !p.isHidden()).toList());
this.unselected.removeAll(this.selected);
}

4 changes: 2 additions & 2 deletions patches/net/minecraft/core/MappedRegistry.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,12 @@
+
+ @Override
+ public int getId(ResourceLocation name) {
+ return toId.getOrDefault(get(name), -1);
+ return getId(get(name));
+ }
+
+ @Override
+ public int getId(ResourceKey<T> key) {
+ return toId.getOrDefault(get(key), -1);
+ return getId(get(key));
+ }
+
+ @Override
Expand Down
2 changes: 1 addition & 1 deletion patches/net/minecraft/world/level/block/Block.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
+ return true;
+
+ if (net.neoforged.neoforge.common.PlantType.DESERT.equals(type)) {
+ return state.is(BlockTags.SAND) || this == Blocks.TERRACOTTA || this instanceof GlazedTerracottaBlock;
+ return state.is(BlockTags.SAND) || state.is(BlockTags.TERRACOTTA);
+ } else if (net.neoforged.neoforge.common.PlantType.NETHER.equals(type)) {
+ return this == Blocks.SOUL_SAND;
+ } else if (net.neoforged.neoforge.common.PlantType.CROP.equals(type)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,20 +92,20 @@ default <C extends RegistryCallback<T>> void addCallback(Class<C> type, C callba
ResourceKey<T> resolve(ResourceKey<T> key);

/**
* Gets the integer id linked to the given key.
* Gets the integer id linked to the given key. If the key is not present in the registry, the default entry's
* integer id is returned if the registry is defaulted or {@code -1} if the registry is not defaulted
*
* @param key the resource key to lookup
* @return the integer id linked to the given key,
* or {@code -1} if the key is not present in this registry
* @return the integer id linked to the given key
*/
int getId(ResourceKey<T> key);

/**
* Gets the integer id linked to the given name.
* Gets the integer id linked to the given name. If the name is not present in the registry, the default entry's
* integer id is returned if the registry is defaulted or {@code -1} if the registry is not defaulted
*
* @param name the resource name to lookup
* @return the integer id linked to the given name,
* or {@code -1} if the name is not present in this registry
* @return the integer id linked to the given name
*/
int getId(ResourceLocation name);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import java.util.Optional;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.gametest.framework.GameTest;
import net.minecraft.network.protocol.game.ClientboundSoundPacket;
import net.minecraft.resources.ResourceLocation;
Expand All @@ -17,6 +18,8 @@
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.GameType;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelReader;
Expand All @@ -32,6 +35,7 @@
import net.neoforged.testframework.annotation.ForEachTest;
import net.neoforged.testframework.annotation.TestHolder;
import net.neoforged.testframework.gametest.EmptyTemplate;
import net.neoforged.testframework.gametest.ExtendedGameTestHelper;
import net.neoforged.testframework.registration.RegistrationHelper;
import org.jetbrains.annotations.Nullable;

Expand Down Expand Up @@ -96,4 +100,30 @@ public Optional<Vec3> getRespawnPosition(BlockState state, EntityType<?> type, L
1, 3, 2))
.thenSucceed());
}

@GameTest
@EmptyTemplate(floor = true)
@TestHolder(description = {
"Dead bushes should be placeable on regular terracotta (colored or not), but not on glazed terracotta",
"(neoforged/NeoForge#306)"
})
static void deadBushTerracottaTest(final ExtendedGameTestHelper helper) {
final BlockPos farmlandBlock = new BlockPos(1, 1, 1);
helper.startSequence(() -> helper.makeTickingMockServerPlayerInCorner(GameType.SURVIVAL))
.thenExecute(() -> helper.setBlock(farmlandBlock, Blocks.TERRACOTTA))
.thenExecute(player -> helper.useBlock(farmlandBlock, player, new ItemStack(Items.DEAD_BUSH), Direction.UP))
.thenExecute(() -> helper.assertBlockPresent(Blocks.DEAD_BUSH, farmlandBlock.above()))

.thenExecute(() -> helper.setBlock(farmlandBlock.above(), Blocks.AIR))
.thenExecute(() -> helper.setBlock(farmlandBlock, Blocks.WHITE_TERRACOTTA))
.thenExecute(player -> helper.useBlock(farmlandBlock, player, new ItemStack(Items.DEAD_BUSH), Direction.UP))
.thenExecute(() -> helper.assertBlockPresent(Blocks.DEAD_BUSH, farmlandBlock.above()))

.thenExecute(() -> helper.setBlock(farmlandBlock.above(), Blocks.AIR))
.thenExecute(() -> helper.setBlock(farmlandBlock, Blocks.WHITE_GLAZED_TERRACOTTA))
.thenExecute(player -> helper.useBlock(farmlandBlock, player, new ItemStack(Items.DEAD_BUSH), Direction.UP))
.thenExecute(() -> helper.assertBlockNotPresent(Blocks.DEAD_BUSH, farmlandBlock.above()))

.thenSucceed();
}
}

0 comments on commit 65a467d

Please sign in to comment.