mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-08-28 16:22:18 +00:00
Update to 1.18.2
This commit is contained in:
parent
be842f2a33
commit
846273077b
@ -2,12 +2,12 @@
|
||||
org.gradle.jvmargs=-Xmx3G
|
||||
|
||||
# Mod properties
|
||||
mod_version=1.100.1
|
||||
mod_version=1.100.2
|
||||
|
||||
# Minecraft properties
|
||||
mc_version=1.18.1
|
||||
fabric_api_version=0.44.0+1.18
|
||||
fabric_loader_version=0.12.12
|
||||
mc_version=1.18.2
|
||||
fabric_api_version=0.47.8+1.18.2
|
||||
fabric_loader_version=0.13.3
|
||||
|
||||
cloth_api_version=2.0.54
|
||||
cloth_config_version=6.0.42
|
||||
|
@ -22,7 +22,6 @@ import dan200.computercraft.core.apis.ApiFactories;
|
||||
import dan200.computercraft.core.asm.GenericMethod;
|
||||
import dan200.computercraft.core.filesystem.FileMount;
|
||||
import dan200.computercraft.core.filesystem.ResourceMount;
|
||||
import dan200.computercraft.fabric.mixin.MinecraftServerAccess;
|
||||
import dan200.computercraft.shared.*;
|
||||
import dan200.computercraft.shared.peripheral.modem.wired.TileCable;
|
||||
import dan200.computercraft.shared.peripheral.modem.wired.TileWiredModemFull;
|
||||
@ -34,7 +33,7 @@ import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.packs.resources.ReloadableResourceManager;
|
||||
import net.minecraft.server.packs.resources.ResourceManager;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
@ -57,7 +56,7 @@ public final class ComputerCraftAPIImpl implements IComputerCraftAPI
|
||||
|
||||
public static InputStream getResourceFile( String domain, String subPath )
|
||||
{
|
||||
ReloadableResourceManager manager = (ReloadableResourceManager) ((MinecraftServerAccess) GameInstanceUtils.getServer()).callGetResourceManager();
|
||||
ResourceManager manager = GameInstanceUtils.getServer().getResourceManager();
|
||||
try
|
||||
{
|
||||
return manager.getResource( new ResourceLocation( domain, subPath ) ).getInputStream();
|
||||
@ -100,7 +99,7 @@ public final class ComputerCraftAPIImpl implements IComputerCraftAPI
|
||||
@Override
|
||||
public IMount createResourceMount( @Nonnull String domain, @Nonnull String subPath )
|
||||
{
|
||||
ReloadableResourceManager manager = (ReloadableResourceManager) ((MinecraftServerAccess) GameInstanceUtils.getServer()).callGetResourceManager();
|
||||
ResourceManager manager = GameInstanceUtils.getServer().getResourceManager();
|
||||
ResourceMount mount = ResourceMount.get( domain, subPath, manager );
|
||||
return mount.exists( "" ) ? mount : null;
|
||||
}
|
||||
|
@ -6,9 +6,9 @@
|
||||
package dan200.computercraft.api;
|
||||
|
||||
import dan200.computercraft.ComputerCraft;
|
||||
import net.fabricmc.fabric.api.tag.TagFactory;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.Tag;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
|
||||
@ -19,47 +19,47 @@ public class ComputerCraftTags
|
||||
{
|
||||
public static class Items
|
||||
{
|
||||
public static final Tag.Named<Item> COMPUTER = make( "computer" );
|
||||
public static final Tag.Named<Item> TURTLE = make( "turtle" );
|
||||
public static final Tag.Named<Item> WIRED_MODEM = make( "wired_modem" );
|
||||
public static final Tag.Named<Item> MONITOR = make( "monitor" );
|
||||
public static final TagKey<Item> COMPUTER = make( "computer" );
|
||||
public static final TagKey<Item> TURTLE = make( "turtle" );
|
||||
public static final TagKey<Item> WIRED_MODEM = make( "wired_modem" );
|
||||
public static final TagKey<Item> MONITOR = make( "monitor" );
|
||||
|
||||
private static Tag.Named<Item> make( String name )
|
||||
private static TagKey<Item> make( String name )
|
||||
{
|
||||
return TagFactory.ITEM.create( new ResourceLocation( ComputerCraft.MOD_ID, name ) );
|
||||
return TagKey.create( Registry.ITEM_REGISTRY, new ResourceLocation( ComputerCraft.MOD_ID, name ) );
|
||||
}
|
||||
}
|
||||
|
||||
public static class Blocks
|
||||
{
|
||||
public static final Tag.Named<Block> COMPUTER = make( "computer" );
|
||||
public static final Tag.Named<Block> TURTLE = make( "turtle" );
|
||||
public static final Tag.Named<Block> WIRED_MODEM = make( "wired_modem" );
|
||||
public static final Tag.Named<Block> MONITOR = make( "monitor" );
|
||||
public static final TagKey<Block> COMPUTER = make( "computer" );
|
||||
public static final TagKey<Block> TURTLE = make( "turtle" );
|
||||
public static final TagKey<Block> WIRED_MODEM = make( "wired_modem" );
|
||||
public static final TagKey<Block> MONITOR = make( "monitor" );
|
||||
|
||||
/**
|
||||
* Blocks which can be broken by any turtle tool.
|
||||
*/
|
||||
public static final Tag.Named<Block> TURTLE_ALWAYS_BREAKABLE = make( "turtle_always_breakable" );
|
||||
public static final TagKey<Block> TURTLE_ALWAYS_BREAKABLE = make( "turtle_always_breakable" );
|
||||
|
||||
/**
|
||||
* Blocks which can be broken by the default shovel tool.
|
||||
*/
|
||||
public static final Tag.Named<Block> TURTLE_SHOVEL_BREAKABLE = make( "turtle_shovel_harvestable" );
|
||||
public static final TagKey<Block> TURTLE_SHOVEL_BREAKABLE = make( "turtle_shovel_harvestable" );
|
||||
|
||||
/**
|
||||
* Blocks which can be broken with the default sword tool.
|
||||
*/
|
||||
public static final Tag.Named<Block> TURTLE_SWORD_BREAKABLE = make( "turtle_sword_harvestable" );
|
||||
public static final TagKey<Block> TURTLE_SWORD_BREAKABLE = make( "turtle_sword_harvestable" );
|
||||
|
||||
/**
|
||||
* Blocks which can be broken with the default hoe tool.
|
||||
*/
|
||||
public static final Tag.Named<Block> TURTLE_HOE_BREAKABLE = make( "turtle_hoe_harvestable" );
|
||||
public static final TagKey<Block> TURTLE_HOE_BREAKABLE = make( "turtle_hoe_harvestable" );
|
||||
|
||||
private static Tag.Named<Block> make( String name )
|
||||
private static TagKey<Block> make( String name )
|
||||
{
|
||||
return TagFactory.BLOCK.create( new ResourceLocation( ComputerCraft.MOD_ID, name ) );
|
||||
return TagKey.create( Registry.BLOCK_REGISTRY, new ResourceLocation( ComputerCraft.MOD_ID, name ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,18 +0,0 @@
|
||||
/*
|
||||
* This file is part of ComputerCraft - http://www.computercraft.info
|
||||
* Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission.
|
||||
* Send enquiries to dratcliffe@gmail.com
|
||||
*/
|
||||
package dan200.computercraft.fabric.mixin;
|
||||
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.packs.resources.ResourceManager;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||
|
||||
@Mixin( MinecraftServer.class )
|
||||
public interface MinecraftServerAccess
|
||||
{
|
||||
@Invoker
|
||||
ResourceManager callGetResourceManager();
|
||||
}
|
@ -68,6 +68,7 @@ import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.world.level.material.MaterialColor;
|
||||
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
@ -157,7 +158,7 @@ public final class Registry
|
||||
|
||||
private static BlockBehaviour.Properties modemProperties()
|
||||
{
|
||||
return FabricBlockSettings.copyOf( Blocks.STONE ).breakByHand( true ).strength( 1.5f );
|
||||
return BlockBehaviour.Properties.of( Material.STONE, MaterialColor.STONE ).strength( 1.5f );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ public final class CommandUtils
|
||||
}
|
||||
else
|
||||
{
|
||||
return ((SharedSuggestionProvider) source).customSuggestion( (CommandContext<SharedSuggestionProvider>) context, builder );
|
||||
return ((SharedSuggestionProvider) source).customSuggestion( context );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,8 +7,6 @@ package dan200.computercraft.shared.peripheral.generic.data;
|
||||
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.enchantment.Enchantment;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
@ -18,6 +16,7 @@ import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public final class DataHelpers
|
||||
{
|
||||
@ -35,14 +34,14 @@ public final class DataHelpers
|
||||
@Nonnull
|
||||
static Map<String, Boolean> getTags( @Nonnull Block block )
|
||||
{
|
||||
Collection<ResourceLocation> tags = BlockTags.getAllTags().getMatchingTags( block );
|
||||
Collection<ResourceLocation> tags = block.builtInRegistryHolder().tags().map( tag -> tag.location() ).collect( Collectors.toList() );
|
||||
return getTags( tags );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
static Map<String, Boolean> getTags( @Nonnull Item item )
|
||||
{
|
||||
Collection<ResourceLocation> tags = ItemTags.getAllTags().getMatchingTags( item );
|
||||
Collection<ResourceLocation> tags = item.builtInRegistryHolder().tags().map( tag -> tag.location() ).collect( Collectors.toList() );
|
||||
return getTags( tags );
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.Tag;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
@ -62,9 +62,9 @@ public class TurtleTool extends AbstractTurtleUpgrade
|
||||
final ItemStack item;
|
||||
final float damageMulitiplier;
|
||||
@Nullable
|
||||
final Tag<Block> breakable;
|
||||
final TagKey<Block> breakable;
|
||||
|
||||
public TurtleTool( ResourceLocation id, Item item, float damageMulitiplier, @Nullable Tag<Block> breakable )
|
||||
public TurtleTool( ResourceLocation id, Item item, float damageMulitiplier, @Nullable TagKey<Block> breakable )
|
||||
{
|
||||
super( id, TurtleUpgradeType.TOOL, new ItemStack( item ) );
|
||||
this.item = new ItemStack( item );
|
||||
@ -122,7 +122,7 @@ public class TurtleTool extends AbstractTurtleUpgrade
|
||||
return UNBREAKABLE;
|
||||
}
|
||||
|
||||
return breakable == null || breakable.contains( state.getBlock() ) || isTriviallyBreakable( world, pos, state )
|
||||
return breakable == null || state.is( breakable ) || isTriviallyBreakable( world, pos, state )
|
||||
? TurtleCommandResult.success() : INEFFECTIVE;
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,10 @@
|
||||
{
|
||||
"required": true,
|
||||
"package": "dan200.computercraft.fabric.mixin",
|
||||
"compatibilityLevel": "JAVA_16",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [
|
||||
"ConnectionAccess",
|
||||
"LevelResourceAccess",
|
||||
"MinecraftServerAccess",
|
||||
|
||||
"MixinBlock",
|
||||
"MixinChunkMap",
|
||||
"MixinEntity",
|
||||
@ -18,7 +16,6 @@
|
||||
"client": [
|
||||
"ChatComponentAccess",
|
||||
"ItemInHandRendererAccess",
|
||||
|
||||
"MixinGameRenderer",
|
||||
"MixinItemFrameRenderer",
|
||||
"MixinItemInHandRenderer",
|
||||
|
@ -20,7 +20,7 @@
|
||||
"Toad-Dev"
|
||||
],
|
||||
"depends": {
|
||||
"minecraft": "1.18.x",
|
||||
"minecraft": ">=1.18.2-rc.1 <1.19",
|
||||
"fabricloader": ">=0.12.9",
|
||||
"fabric": "*"
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user