Skip to content

Commit

Permalink
update to 24w33a
Browse files Browse the repository at this point in the history
  • Loading branch information
gnembon committed Aug 18, 2024
1 parent 9940feb commit d11586f
Show file tree
Hide file tree
Showing 58 changed files with 375 additions and 871 deletions.
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check https://fabricmc.net/develop/
minecraft_version=1.21.1
minecraft_version=24w33a
loader_version=0.15.11
jsr305_version=3.0.2
fabric_version=0.99.2+1.21
fabric_version=0.102.0+1.21

# Mod Properties
mod_version = 1.4.147
Expand All @@ -17,7 +17,7 @@ org.gradle.jvmargs=-Xmx1G
# The Curseforge versions "names" or ids for the main branch (comma separated: 1.16.4,1.16.5)
# This is needed because CF uses too vague names for prereleases and release candidates
# Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN]
release-curse-versions = Minecraft 1.21.1:1.21.1
release-curse-versions = Minecraft 1.21.2:1.21.2-Snapshot
# Whether or not to build another branch on release
release-extra-branch = false
# The name of the second branch to release
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/carpet/commands/PerimeterInfoCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import net.minecraft.core.registries.Registries;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntitySpawnReason;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.Mob;

Expand Down Expand Up @@ -54,7 +55,7 @@ private static int perimeterDiagnose(CommandSourceStack source, BlockPos pos, St
if (mobId != null)
{
nbttagcompound.putString("id", mobId);
Entity baseEntity = EntityType.loadEntityRecursive(nbttagcompound, source.getLevel(), (entity_1x) -> {
Entity baseEntity = EntityType.loadEntityRecursive(nbttagcompound, source.getLevel(), EntitySpawnReason.COMMAND, (entity_1x) -> {
entity_1x.moveTo(new BlockPos(pos.getX(), source.getLevel().getMinBuildHeight()-10, pos.getZ()), entity_1x.getYRot(), entity_1x. getXRot());
return !source.getLevel().addWithUUID(entity_1x) ? null : entity_1x;
});
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package carpet.fakes;

import net.minecraft.core.BlockPos;
import net.minecraft.world.level.Level;


public interface DefaultRedstoneWireEvaluatorInferface
{
int calculateTargetStrengthCM(final Level level, final BlockPos pos);
}
2 changes: 1 addition & 1 deletion src/main/java/carpet/fakes/IngredientInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ public interface IngredientInterface
* Gets all the stacks of the ingredients for a given item recipe. Also used for {@link carpet.helpers.HopperCounter#guessColor}
* to guess the colour of an item to display it prettily
*/
List<Collection<ItemStack>> getRecipeStacks();
//List<Collection<ItemStack>> getRecipeStacks();
}
2 changes: 1 addition & 1 deletion src/main/java/carpet/helpers/BlockRotator.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ else if (block == Blocks.HOPPER)
}
}
// Send block update to the block that just have been rotated.
world.neighborChanged(blockpos, block, source.pos());
world.neighborChanged(blockpos, block, null);

return stack;
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/carpet/helpers/EntityPlayerActionPack.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import net.minecraft.commands.arguments.EntityAnchorArgument;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.network.protocol.game.ClientboundSetCarriedItemPacket;
import net.minecraft.network.protocol.game.ClientboundSetHeldSlotPacket;
import net.minecraft.network.protocol.game.ServerboundPlayerActionPacket;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
Expand Down Expand Up @@ -282,7 +282,7 @@ public void drop(int selectedSlot, boolean dropAll)
public void setSlot(int slot)
{
player.getInventory().selected = slot-1;
player.connection.send(new ClientboundSetCarriedItemPacket(slot-1));
player.connection.send(new ClientboundSetHeldSlotPacket(slot-1));
}

public enum ActionType
Expand Down Expand Up @@ -317,9 +317,9 @@ boolean execute(ServerPlayer player, Action action)
if (pos.getY() < player.level().getMaxBuildHeight() - (side == Direction.UP ? 1 : 0) && world.mayInteract(player, pos))
{
InteractionResult result = player.gameMode.useItemOn(player, world, player.getItemInHand(hand), hand, blockHit);
if (result.consumesAction())
if (result instanceof InteractionResult.Success success)
{
if (result.shouldSwing()) player.swing(hand);
if (success.swingSource() == InteractionResult.SwingSource.SERVER) player.swing(hand);
ap.itemUseCooldown = 3;
return true;
}
Expand Down
18 changes: 7 additions & 11 deletions src/main/java/carpet/helpers/HopperCounter.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package carpet.helpers;

import carpet.CarpetServer;
import carpet.fakes.IngredientInterface;
import carpet.fakes.RecipeManagerInterface;
import carpet.utils.Messenger;
import it.unimi.dsi.fastutil.objects.Object2LongLinkedOpenHashMap;
Expand All @@ -22,7 +21,7 @@
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.item.crafting.PlacementInfo;
import net.minecraft.world.item.crafting.Recipe;
import net.minecraft.world.item.crafting.RecipeType;
import net.minecraft.world.level.block.AbstractBannerBlock;
Expand All @@ -32,12 +31,12 @@
import net.minecraft.world.level.material.MapColor;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.EnumMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;

import static java.util.Map.entry;
Expand Down Expand Up @@ -376,16 +375,13 @@ public static TextColor guessColor(Item item, RegistryAccess registryAccess)
{
for (Recipe<?> r: ((RecipeManagerInterface) CarpetServer.minecraft_server.getRecipeManager()).getAllMatching(type, id, registryAccess))
{
for (Ingredient ingredient: r.getIngredients())
for (Optional<PlacementInfo.SlotInfo> ingredient: r.placementInfo().slotInfo())
{
for (Collection<ItemStack> stacks : ((IngredientInterface) (Object) ingredient).getRecipeStacks())
for(ItemStack stack : ingredient.get().possibleItems())
{
for (ItemStack iStak : stacks)
{
TextColor cand = fromItem(iStak.getItem(), registryAccess);
if (cand != null)
return cand;
}
TextColor cand = fromItem(stack.getItem(), registryAccess);
if (cand != null)
return cand;
}
}
}
Expand Down
Loading

0 comments on commit d11586f

Please sign in to comment.