mirror of
				https://github.com/SquidDev-CC/CC-Tweaked
				synced 2025-11-04 07:32:59 +00:00 
			
		
		
		
	Compare commits
	
		
			16 Commits
		
	
	
		
			v1.16.5-1.
			...
			v1.16.5-1.
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					bcc7dd6991 | ||
| 
						 | 
					bd36185662 | ||
| 
						 | 
					045c4fc88c | ||
| 
						 | 
					e0fcc425c6 | ||
| 
						 | 
					e01895d719 | ||
| 
						 | 
					87b38f4249 | ||
| 
						 | 
					60d1d1bb18 | ||
| 
						 | 
					cdf8b77ffd | ||
| 
						 | 
					e2ce52fe81 | ||
| 
						 | 
					9cf70b10ef | ||
| 
						 | 
					9ac8f3aeea | ||
| 
						 | 
					e191b08eb5 | ||
| 
						 | 
					a1221b99e1 | ||
| 
						 | 
					85bced6b1d | ||
| 
						 | 
					fc4569e0cc | ||
| 
						 | 
					e7f08313d9 | 
@@ -19,8 +19,8 @@ numerical value depending on which button on your mouse was last pressed when th
 | 
			
		||||
    <!-- Our markdown parser doesn't work on tables!? Guess I'll have to roll my own soonish :/. -->
 | 
			
		||||
    <tr><th>Button code</th><th>Mouse button</th></tr>
 | 
			
		||||
    <tr><td align="right">1</td><td>Left button</td></tr>
 | 
			
		||||
    <tr><td align="right">2</td><td>Middle button</td></tr>
 | 
			
		||||
    <tr><td align="right">3</td><td>Right button</td></tr>
 | 
			
		||||
    <tr><td align="right">2</td><td>Right button</td></tr>
 | 
			
		||||
    <tr><td align="right">3</td><td>Middle button</td></tr>
 | 
			
		||||
</table>
 | 
			
		||||
 | 
			
		||||
## Example
 | 
			
		||||
 
 | 
			
		||||
@@ -18,7 +18,7 @@ representable value.
 | 
			
		||||
 | 
			
		||||
This representation of sound - a long, uniformally sampled list of amplitudes is referred to as [Pulse-code
 | 
			
		||||
Modulation][PCM] (PCM). PCM can be thought of as the "standard" audio format, as it's incredibly easy to work with. For
 | 
			
		||||
instance, to mix two pieces of audio together, you can just samples from the two tracks together and take the average.
 | 
			
		||||
instance, to mix two pieces of audio together, you can just add samples from the two tracks together and take the average.
 | 
			
		||||
 | 
			
		||||
CC: Tweaked's speakers also work with PCM audio. It plays back 48,000 samples a second, where each sample is an integer
 | 
			
		||||
between -128 and 127. This is more commonly referred to as 48kHz and an 8-bit resolution.
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
# Mod properties
 | 
			
		||||
mod_version=1.100.1
 | 
			
		||||
mod_version=1.100.3
 | 
			
		||||
 | 
			
		||||
# Minecraft properties (update mods.toml when changing)
 | 
			
		||||
mc_version=1.16.5
 | 
			
		||||
 
 | 
			
		||||
@@ -118,7 +118,7 @@ public final class ComputerCraftAPI
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * rers a peripheral provider to convert blocks into {@link IPeripheral} implementations.
 | 
			
		||||
     * Registers a peripheral provider to convert blocks into {@link IPeripheral} implementations.
 | 
			
		||||
     *
 | 
			
		||||
     * @param provider The peripheral provider to register.
 | 
			
		||||
     * @see IPeripheral
 | 
			
		||||
 
 | 
			
		||||
@@ -10,7 +10,6 @@ import dan200.computercraft.client.gui.*;
 | 
			
		||||
import dan200.computercraft.client.render.TileEntityMonitorRenderer;
 | 
			
		||||
import dan200.computercraft.client.render.TileEntityTurtleRenderer;
 | 
			
		||||
import dan200.computercraft.client.render.TurtleModelLoader;
 | 
			
		||||
import dan200.computercraft.client.render.TurtlePlayerRenderer;
 | 
			
		||||
import dan200.computercraft.shared.Registry;
 | 
			
		||||
import dan200.computercraft.shared.common.IColouredItem;
 | 
			
		||||
import dan200.computercraft.shared.computer.inventory.ContainerComputerBase;
 | 
			
		||||
@@ -33,7 +32,6 @@ import net.minecraftforge.client.event.ModelRegistryEvent;
 | 
			
		||||
import net.minecraftforge.client.model.ModelLoader;
 | 
			
		||||
import net.minecraftforge.client.model.ModelLoaderRegistry;
 | 
			
		||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
 | 
			
		||||
import net.minecraftforge.fml.client.registry.RenderingRegistry;
 | 
			
		||||
import net.minecraftforge.fml.common.Mod;
 | 
			
		||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
 | 
			
		||||
 | 
			
		||||
@@ -140,8 +138,6 @@ public final class ClientRegistry
 | 
			
		||||
        net.minecraftforge.fml.client.registry.ClientRegistry.bindTileEntityRenderer( Registry.ModTiles.TURTLE_NORMAL.get(), TileEntityTurtleRenderer::new );
 | 
			
		||||
        net.minecraftforge.fml.client.registry.ClientRegistry.bindTileEntityRenderer( Registry.ModTiles.TURTLE_ADVANCED.get(), TileEntityTurtleRenderer::new );
 | 
			
		||||
 | 
			
		||||
        RenderingRegistry.registerEntityRenderingHandler( Registry.ModEntities.TURTLE_PLAYER.get(), TurtlePlayerRenderer::new );
 | 
			
		||||
 | 
			
		||||
        registerItemProperty( "state",
 | 
			
		||||
            ( stack, world, player ) -> ItemPocketComputer.getState( stack ).ordinal(),
 | 
			
		||||
            Registry.ModItems.POCKET_COMPUTER_NORMAL, Registry.ModItems.POCKET_COMPUTER_ADVANCED
 | 
			
		||||
 
 | 
			
		||||
@@ -16,6 +16,7 @@ import dan200.computercraft.shared.computer.core.IComputer;
 | 
			
		||||
import dan200.computercraft.shared.computer.core.IContainerComputer;
 | 
			
		||||
import dan200.computercraft.shared.computer.core.ServerComputer;
 | 
			
		||||
import dan200.computercraft.shared.peripheral.modem.wireless.WirelessNetwork;
 | 
			
		||||
import net.minecraft.entity.EntityType;
 | 
			
		||||
import net.minecraft.inventory.container.Container;
 | 
			
		||||
import net.minecraft.loot.ConstantRange;
 | 
			
		||||
import net.minecraft.loot.LootPool;
 | 
			
		||||
@@ -24,10 +25,7 @@ import net.minecraft.loot.TableLootEntry;
 | 
			
		||||
import net.minecraft.server.MinecraftServer;
 | 
			
		||||
import net.minecraft.server.dedicated.DedicatedServer;
 | 
			
		||||
import net.minecraft.util.ResourceLocation;
 | 
			
		||||
import net.minecraftforge.event.AddReloadListenerEvent;
 | 
			
		||||
import net.minecraftforge.event.LootTableLoadEvent;
 | 
			
		||||
import net.minecraftforge.event.RegisterCommandsEvent;
 | 
			
		||||
import net.minecraftforge.event.TickEvent;
 | 
			
		||||
import net.minecraftforge.event.*;
 | 
			
		||||
import net.minecraftforge.event.entity.player.PlayerContainerEvent;
 | 
			
		||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
 | 
			
		||||
import net.minecraftforge.fml.common.Mod;
 | 
			
		||||
@@ -146,4 +144,14 @@ public final class CommonHooks
 | 
			
		||||
    {
 | 
			
		||||
        event.addListener( ResourceMount.RELOAD_LISTENER );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @SubscribeEvent
 | 
			
		||||
    public static void onMissingEntityMappingsEvent( RegistryEvent.MissingMappings<EntityType<?>> event )
 | 
			
		||||
    {
 | 
			
		||||
        ResourceLocation id = new ResourceLocation( ComputerCraft.MOD_ID, "turtle_player" );
 | 
			
		||||
        for( RegistryEvent.MissingMappings.Mapping<EntityType<?>> mapping : event.getMappings( ComputerCraft.MOD_ID ) )
 | 
			
		||||
        {
 | 
			
		||||
            if( mapping.key.equals( id ) ) mapping.ignore();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -60,7 +60,6 @@ import dan200.computercraft.shared.pocket.peripherals.PocketSpeaker;
 | 
			
		||||
import dan200.computercraft.shared.pocket.recipes.PocketComputerUpgradeRecipe;
 | 
			
		||||
import dan200.computercraft.shared.turtle.blocks.BlockTurtle;
 | 
			
		||||
import dan200.computercraft.shared.turtle.blocks.TileTurtle;
 | 
			
		||||
import dan200.computercraft.shared.turtle.core.TurtlePlayer;
 | 
			
		||||
import dan200.computercraft.shared.turtle.inventory.ContainerTurtle;
 | 
			
		||||
import dan200.computercraft.shared.turtle.items.ItemTurtle;
 | 
			
		||||
import dan200.computercraft.shared.turtle.recipes.TurtleRecipe;
 | 
			
		||||
@@ -70,8 +69,6 @@ import dan200.computercraft.shared.util.*;
 | 
			
		||||
import net.minecraft.block.AbstractBlock;
 | 
			
		||||
import net.minecraft.block.Block;
 | 
			
		||||
import net.minecraft.block.material.Material;
 | 
			
		||||
import net.minecraft.entity.EntityClassification;
 | 
			
		||||
import net.minecraft.entity.EntityType;
 | 
			
		||||
import net.minecraft.inventory.container.ContainerType;
 | 
			
		||||
import net.minecraft.item.*;
 | 
			
		||||
import net.minecraft.item.crafting.IRecipeSerializer;
 | 
			
		||||
@@ -296,18 +293,6 @@ public final class Registry
 | 
			
		||||
        ComputerCraftAPI.registerPocketUpgrade( ComputerCraft.PocketUpgrades.speaker = new PocketSpeaker() );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static class ModEntities
 | 
			
		||||
    {
 | 
			
		||||
        static final DeferredRegister<EntityType<?>> ENTITIES = DeferredRegister.create( ForgeRegistries.ENTITIES, ComputerCraft.MOD_ID );
 | 
			
		||||
 | 
			
		||||
        public static final RegistryObject<EntityType<TurtlePlayer>> TURTLE_PLAYER = ENTITIES.register( "turtle_player", () ->
 | 
			
		||||
            EntityType.Builder.<TurtlePlayer>createNothing( EntityClassification.MISC )
 | 
			
		||||
                .noSave()
 | 
			
		||||
                .noSummon()
 | 
			
		||||
                .sized( 0, 0 )
 | 
			
		||||
                .build( ComputerCraft.MOD_ID + ":turtle_player" ) );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static class ModContainers
 | 
			
		||||
    {
 | 
			
		||||
        static final DeferredRegister<ContainerType<?>> CONTAINERS = DeferredRegister.create( ForgeRegistries.CONTAINERS, ComputerCraft.MOD_ID );
 | 
			
		||||
@@ -418,7 +403,6 @@ public final class Registry
 | 
			
		||||
        ModBlocks.BLOCKS.register( bus );
 | 
			
		||||
        ModTiles.TILES.register( bus );
 | 
			
		||||
        ModItems.ITEMS.register( bus );
 | 
			
		||||
        ModEntities.ENTITIES.register( bus );
 | 
			
		||||
        ModContainers.CONTAINERS.register( bus );
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -160,6 +160,7 @@ public class UploadFileMessage extends ComputerServerMessage
 | 
			
		||||
                contents.position( currentOffset ).limit( currentOffset + canWrite );
 | 
			
		||||
                slices.add( new FileSlice( fileId, currentOffset, contents.slice() ) );
 | 
			
		||||
                currentOffset += canWrite;
 | 
			
		||||
                remaining -= canWrite;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            contents.position( 0 ).limit( capacity );
 | 
			
		||||
 
 | 
			
		||||
@@ -59,7 +59,7 @@ public enum CableModemVariant implements IStringSerializable
 | 
			
		||||
    @Nonnull
 | 
			
		||||
    public static CableModemVariant from( Direction facing, boolean modem, boolean peripheral )
 | 
			
		||||
    {
 | 
			
		||||
        int state = (modem ? 2 : 0) + (peripheral ? 1 : 0);
 | 
			
		||||
        int state = (modem ? 1 : 0) + (peripheral ? 2 : 0);
 | 
			
		||||
        return facing == null ? None : VALUES[1 + 6 * state + facing.get3DDataValue()];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -8,14 +8,11 @@ package dan200.computercraft.shared.turtle.core;
 | 
			
		||||
import com.mojang.authlib.GameProfile;
 | 
			
		||||
import dan200.computercraft.ComputerCraft;
 | 
			
		||||
import dan200.computercraft.api.turtle.ITurtleAccess;
 | 
			
		||||
import dan200.computercraft.shared.Registry;
 | 
			
		||||
import dan200.computercraft.shared.util.DirectionUtil;
 | 
			
		||||
import dan200.computercraft.shared.util.FakeNetHandler;
 | 
			
		||||
import dan200.computercraft.shared.util.InventoryUtil;
 | 
			
		||||
import dan200.computercraft.shared.util.WorldUtil;
 | 
			
		||||
import net.minecraft.entity.Entity;
 | 
			
		||||
import net.minecraft.entity.EntitySize;
 | 
			
		||||
import net.minecraft.entity.EntityType;
 | 
			
		||||
import net.minecraft.entity.Pose;
 | 
			
		||||
import net.minecraft.entity.passive.horse.AbstractHorseEntity;
 | 
			
		||||
import net.minecraft.entity.player.ServerPlayerEntity;
 | 
			
		||||
@@ -54,7 +51,6 @@ public final class TurtlePlayer extends FakePlayer
 | 
			
		||||
        GameProfile profile = turtle.getOwningPlayer();
 | 
			
		||||
 | 
			
		||||
        TurtlePlayer player = new TurtlePlayer( world, getProfile( profile ) );
 | 
			
		||||
        player.connection = new FakeNetHandler( player );
 | 
			
		||||
        player.setState( turtle );
 | 
			
		||||
 | 
			
		||||
        if( profile != null && profile.getId() != null )
 | 
			
		||||
@@ -203,13 +199,6 @@ public final class TurtlePlayer extends FakePlayer
 | 
			
		||||
        inventory.setChanged();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Nonnull
 | 
			
		||||
    @Override
 | 
			
		||||
    public EntityType<?> getType()
 | 
			
		||||
    {
 | 
			
		||||
        return Registry.ModEntities.TURTLE_PLAYER.get();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public Vector3d position()
 | 
			
		||||
    {
 | 
			
		||||
 
 | 
			
		||||
@@ -172,7 +172,6 @@ public class TurtleTool extends AbstractTurtleUpgrade
 | 
			
		||||
            {
 | 
			
		||||
                float damage = (float) turtlePlayer.getAttributeValue( Attributes.ATTACK_DAMAGE );
 | 
			
		||||
                damage *= getDamageMultiplier();
 | 
			
		||||
                ComputerCraft.log.info( "Dealing {} damage", damage );
 | 
			
		||||
                if( damage > 0.0f )
 | 
			
		||||
                {
 | 
			
		||||
                    DamageSource source = DamageSource.playerAttack( turtlePlayer );
 | 
			
		||||
 
 | 
			
		||||
@@ -1,348 +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.shared.util;
 | 
			
		||||
 | 
			
		||||
import io.netty.channel.ChannelHandlerContext;
 | 
			
		||||
import io.netty.util.concurrent.Future;
 | 
			
		||||
import io.netty.util.concurrent.GenericFutureListener;
 | 
			
		||||
import net.minecraft.network.*;
 | 
			
		||||
import net.minecraft.network.play.ServerPlayNetHandler;
 | 
			
		||||
import net.minecraft.network.play.client.*;
 | 
			
		||||
import net.minecraft.util.text.ITextComponent;
 | 
			
		||||
import net.minecraftforge.common.util.FakePlayer;
 | 
			
		||||
 | 
			
		||||
import javax.annotation.Nonnull;
 | 
			
		||||
import javax.annotation.Nullable;
 | 
			
		||||
 | 
			
		||||
public class FakeNetHandler extends ServerPlayNetHandler
 | 
			
		||||
{
 | 
			
		||||
    public FakeNetHandler( @Nonnull FakePlayer player )
 | 
			
		||||
    {
 | 
			
		||||
        super( player.getLevel().getServer(), new FakeNetworkManager(), player );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void tick()
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void disconnect( @Nonnull ITextComponent reason )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void onDisconnect( @Nonnull ITextComponent reason )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void send( @Nonnull IPacket<?> packet )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void send( @Nonnull IPacket<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> whenSent )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void handlePlayerInput( @Nonnull CInputPacket packet )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void handleMoveVehicle( @Nonnull CMoveVehiclePacket packet )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void handleAcceptTeleportPacket( @Nonnull CConfirmTeleportPacket packet )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void handleSeenAdvancements( @Nonnull CSeenAdvancementsPacket packet )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void handleCustomCommandSuggestions( @Nonnull CTabCompletePacket packet )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void handleSetCommandBlock( @Nonnull CUpdateCommandBlockPacket packet )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void handleSetCommandMinecart( @Nonnull CUpdateMinecartCommandBlockPacket packet )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void handlePickItem( @Nonnull CPickItemPacket packet )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void handleRenameItem( @Nonnull CRenameItemPacket packet )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void handleSetBeaconPacket( @Nonnull CUpdateBeaconPacket packet )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void handleSetStructureBlock( @Nonnull CUpdateStructureBlockPacket packet )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void handleSetJigsawBlock( @Nonnull CUpdateJigsawBlockPacket packet )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void handleSelectTrade( @Nonnull CSelectTradePacket packet )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void handleEditBook( @Nonnull CEditBookPacket packet )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void handleEntityTagQuery( @Nonnull CQueryEntityNBTPacket packet )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void handleBlockEntityTagQuery( @Nonnull CQueryTileEntityNBTPacket packet )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void handleMovePlayer( @Nonnull CPlayerPacket packet )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void handlePlayerAction( @Nonnull CPlayerDiggingPacket packet )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void handleUseItemOn( @Nonnull CPlayerTryUseItemOnBlockPacket packet )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void handleUseItem( @Nonnull CPlayerTryUseItemPacket packet )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void handleTeleportToEntityPacket( @Nonnull CSpectatePacket packet )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void handleResourcePackResponse( @Nonnull CResourcePackStatusPacket packet )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void handlePaddleBoat( @Nonnull CSteerBoatPacket packet )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void handleSetCarriedItem( @Nonnull CHeldItemChangePacket packet )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void handleChat( @Nonnull CChatMessagePacket packet )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void handleAnimate( @Nonnull CAnimateHandPacket packet )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void handlePlayerCommand( @Nonnull CEntityActionPacket packet )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void handleInteract( @Nonnull CUseEntityPacket packet )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void handleClientCommand( @Nonnull CClientStatusPacket packet )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void handleContainerClose( @Nonnull CCloseWindowPacket packet )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void handleContainerClick( @Nonnull CClickWindowPacket packet )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void handlePlaceRecipe( @Nonnull CPlaceRecipePacket packet )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void handleContainerButtonClick( @Nonnull CEnchantItemPacket packet )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void handleSetCreativeModeSlot( @Nonnull CCreativeInventoryActionPacket packet )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void handleContainerAck( @Nonnull CConfirmTransactionPacket packet )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void handleSignUpdate( @Nonnull CUpdateSignPacket packet )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void handleKeepAlive( @Nonnull CKeepAlivePacket packet )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void handlePlayerAbilities( @Nonnull CPlayerAbilitiesPacket packet )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void handleClientInformation( @Nonnull CClientSettingsPacket packet )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void handleCustomPayload( @Nonnull CCustomPayloadPacket packet )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void handleChangeDifficulty( @Nonnull CSetDifficultyPacket packet )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void handleLockDifficulty( @Nonnull CLockDifficultyPacket packet )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static class FakeNetworkManager extends NetworkManager
 | 
			
		||||
    {
 | 
			
		||||
        private INetHandler handler;
 | 
			
		||||
        private ITextComponent closeReason;
 | 
			
		||||
 | 
			
		||||
        FakeNetworkManager()
 | 
			
		||||
        {
 | 
			
		||||
            super( PacketDirection.CLIENTBOUND );
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        @Override
 | 
			
		||||
        public void channelActive( @Nonnull ChannelHandlerContext context )
 | 
			
		||||
        {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        @Override
 | 
			
		||||
        public void setProtocol( @Nonnull ProtocolType state )
 | 
			
		||||
        {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        @Override
 | 
			
		||||
        public void channelInactive( @Nonnull ChannelHandlerContext context )
 | 
			
		||||
        {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        @Override
 | 
			
		||||
        public void exceptionCaught( @Nonnull ChannelHandlerContext context, @Nonnull Throwable err )
 | 
			
		||||
        {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        @Override
 | 
			
		||||
        protected void channelRead0( @Nonnull ChannelHandlerContext context, @Nonnull IPacket<?> packet )
 | 
			
		||||
        {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        @Override
 | 
			
		||||
        public void setListener( @Nonnull INetHandler handler )
 | 
			
		||||
        {
 | 
			
		||||
            this.handler = handler;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        @Override
 | 
			
		||||
        public void send( @Nonnull IPacket<?> packet )
 | 
			
		||||
        {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        @Override
 | 
			
		||||
        public void send( @Nonnull IPacket<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> whenSent )
 | 
			
		||||
        {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        @Override
 | 
			
		||||
        public void tick()
 | 
			
		||||
        {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        @Override
 | 
			
		||||
        public void disconnect( @Nonnull ITextComponent message )
 | 
			
		||||
        {
 | 
			
		||||
            closeReason = message;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        @Nonnull
 | 
			
		||||
        @Override
 | 
			
		||||
        public INetHandler getPacketListener()
 | 
			
		||||
        {
 | 
			
		||||
            return handler;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        @Nullable
 | 
			
		||||
        @Override
 | 
			
		||||
        public ITextComponent getDisconnectedReason()
 | 
			
		||||
        {
 | 
			
		||||
            return closeReason;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        @Override
 | 
			
		||||
        public void setReadOnly()
 | 
			
		||||
        {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        @Override
 | 
			
		||||
        public void setupCompression( int threshold )
 | 
			
		||||
        {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -45,21 +45,17 @@ public final class IDAssigner
 | 
			
		||||
        return ServerLifecycleHooks.getCurrentServer().getWorldPath( FOLDER ).toFile();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static MinecraftServer getCachedServer()
 | 
			
		||||
    private static boolean hasServerChanged()
 | 
			
		||||
    {
 | 
			
		||||
        if( server == null ) return null;
 | 
			
		||||
        if( server == null ) return true;
 | 
			
		||||
 | 
			
		||||
        MinecraftServer currentServer = server.get();
 | 
			
		||||
        if( currentServer == null ) return null;
 | 
			
		||||
 | 
			
		||||
        if( currentServer != ServerLifecycleHooks.getCurrentServer() ) return null;
 | 
			
		||||
        return currentServer;
 | 
			
		||||
        return currentServer == null || currentServer != ServerLifecycleHooks.getCurrentServer();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static synchronized int getNextId( String kind )
 | 
			
		||||
    {
 | 
			
		||||
        MinecraftServer currentServer = getCachedServer();
 | 
			
		||||
        if( currentServer == null )
 | 
			
		||||
        if( hasServerChanged() )
 | 
			
		||||
        {
 | 
			
		||||
            // The server has changed, refetch our ID map
 | 
			
		||||
            server = new WeakReference<>( ServerLifecycleHooks.getCurrentServer() );
 | 
			
		||||
@@ -68,23 +64,22 @@ public final class IDAssigner
 | 
			
		||||
            dir.mkdirs();
 | 
			
		||||
 | 
			
		||||
            // Load our ID file from disk
 | 
			
		||||
            Map<String, Integer> newIds = null;
 | 
			
		||||
            idFile = new File( dir, "ids.json" ).toPath();
 | 
			
		||||
            if( Files.isRegularFile( idFile ) )
 | 
			
		||||
            {
 | 
			
		||||
                try( Reader reader = Files.newBufferedReader( idFile, StandardCharsets.UTF_8 ) )
 | 
			
		||||
                {
 | 
			
		||||
                    ids = GSON.fromJson( reader, ID_TOKEN );
 | 
			
		||||
                    newIds = GSON.fromJson( reader, ID_TOKEN );
 | 
			
		||||
                }
 | 
			
		||||
                catch( Exception e )
 | 
			
		||||
                {
 | 
			
		||||
                    ComputerCraft.log.error( "Cannot load id file '" + idFile + "'", e );
 | 
			
		||||
                    ids = new HashMap<>();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                ids = new HashMap<>();
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if( newIds == null ) newIds = new HashMap<>();
 | 
			
		||||
            ids = newIds;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        Integer existing = ids.get( kind );
 | 
			
		||||
 
 | 
			
		||||
@@ -5,10 +5,10 @@
 | 
			
		||||
 */
 | 
			
		||||
package dan200.computercraft.shared.util;
 | 
			
		||||
 | 
			
		||||
import com.google.common.io.BaseEncoding;
 | 
			
		||||
import dan200.computercraft.ComputerCraft;
 | 
			
		||||
import net.minecraft.nbt.*;
 | 
			
		||||
import net.minecraftforge.common.util.Constants;
 | 
			
		||||
import org.apache.commons.codec.binary.Hex;
 | 
			
		||||
 | 
			
		||||
import javax.annotation.Nonnull;
 | 
			
		||||
import javax.annotation.Nullable;
 | 
			
		||||
@@ -25,6 +25,8 @@ import static net.minecraftforge.common.util.Constants.NBT.*;
 | 
			
		||||
 | 
			
		||||
public final class NBTUtil
 | 
			
		||||
{
 | 
			
		||||
    private static final BaseEncoding ENCODING = BaseEncoding.base16().lowerCase();
 | 
			
		||||
 | 
			
		||||
    private NBTUtil() {}
 | 
			
		||||
 | 
			
		||||
    private static INBT toNBTTag( Object object )
 | 
			
		||||
@@ -181,7 +183,7 @@ public final class NBTUtil
 | 
			
		||||
            DataOutput output = new DataOutputStream( new DigestOutputStream( digest ) );
 | 
			
		||||
            CompressedStreamTools.write( tag, output );
 | 
			
		||||
            byte[] hash = digest.digest();
 | 
			
		||||
            return new String( Hex.encodeHex( hash ) );
 | 
			
		||||
            return ENCODING.encode( hash );
 | 
			
		||||
        }
 | 
			
		||||
        catch( NoSuchAlgorithmException | IOException e )
 | 
			
		||||
        {
 | 
			
		||||
 
 | 
			
		||||
@@ -39,5 +39,25 @@
 | 
			
		||||
    "chat.computercraft.wired_modem.peripheral_disconnected": "Perifer enhed \"%s\" koblet fra netværk",
 | 
			
		||||
    "gui.computercraft.tooltip.copy": "Kopier til udklipsholder",
 | 
			
		||||
    "gui.computercraft.tooltip.computer_id": "Computer-ID: %s",
 | 
			
		||||
    "gui.computercraft.tooltip.disk_id": "Disk-ID: %s"
 | 
			
		||||
    "gui.computercraft.tooltip.disk_id": "Disk-ID: %s",
 | 
			
		||||
    "gui.computercraft.tooltip.turn_on": "Tænd denne computer",
 | 
			
		||||
    "gui.computercraft.tooltip.turn_off": "Sluk denne computer",
 | 
			
		||||
    "gui.computercraft.tooltip.terminate.key": "Hold Ctrl+T nede",
 | 
			
		||||
    "gui.computercraft.tooltip.turn_off.key": "Hold Ctrl+S nede",
 | 
			
		||||
    "gui.computercraft.tooltip.terminate": "Stop den igangværende kode",
 | 
			
		||||
    "gui.computercraft.tooltip.turn_on.key": "Hold Ctrl+R nede",
 | 
			
		||||
    "gui.computercraft.upload.overwrite_button": "Overskriv",
 | 
			
		||||
    "gui.computercraft.upload.overwrite.detail": "Følgende filer vil blive overskrevet ved upload. Fortsæt?%s",
 | 
			
		||||
    "gui.computercraft.upload.success": "Upload Lykkedes",
 | 
			
		||||
    "gui.computercraft.upload.overwrite": "Filer ville blive overskrevet",
 | 
			
		||||
    "gui.computercraft.upload.failed.out_of_space": "Ikke nok plads på computeren til disse filer.",
 | 
			
		||||
    "gui.computercraft.upload.failed.computer_off": "Du skal tænde computeren, før du kan uploade filer.",
 | 
			
		||||
    "gui.computercraft.upload.failed.too_much": "Dine filer er for store til at blive uploadet.",
 | 
			
		||||
    "gui.computercraft.upload.failed.overwrite_dir": "Kan ikke uploade %s, da der allerede er en mappe med det samme navn.",
 | 
			
		||||
    "gui.computercraft.upload.success.msg": "%d filer uploadet.",
 | 
			
		||||
    "gui.computercraft.upload.failed": "Upload Fejlede",
 | 
			
		||||
    "gui.computercraft.upload.failed.name_too_long": "Filnavne er for lange til at blive uploadet.",
 | 
			
		||||
    "gui.computercraft.upload.failed.too_many_files": "Kan ikke uploade så mange filer.",
 | 
			
		||||
    "gui.computercraft.pocket_computer_overlay": "Lommecomputer åben. Tryk ESC for at lukke.",
 | 
			
		||||
    "itemGroup.computercraft": "ComputerCraft"
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
{
 | 
			
		||||
    "parent": "minecraft:recipes/root",
 | 
			
		||||
    "rewards": {
 | 
			
		||||
        "recipes": [ "computercraft:normal_turtle_normal" ]
 | 
			
		||||
        "recipes": [ "computercraft:turtle_normal" ]
 | 
			
		||||
    },
 | 
			
		||||
    "criteria": {
 | 
			
		||||
        "has_normal": {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,17 @@
 | 
			
		||||
# New features in CC: Tweaked 1.100.3
 | 
			
		||||
 | 
			
		||||
Several bug fixes:
 | 
			
		||||
* Fix client disconnect when uploading large files.
 | 
			
		||||
* Correctly handling empty computer ID file.
 | 
			
		||||
* Fix the normal turtle recipe not being unlocked.
 | 
			
		||||
* Remove turtle fake EntityType.
 | 
			
		||||
 | 
			
		||||
# New features in CC: Tweaked 1.100.2
 | 
			
		||||
 | 
			
		||||
Several bug fixes:
 | 
			
		||||
* Fix wired modems swapping the modem/peripheral block state.
 | 
			
		||||
* Remove debugging logging line from `turtle.attack`.
 | 
			
		||||
 | 
			
		||||
# New features in CC: Tweaked 1.100.1
 | 
			
		||||
 | 
			
		||||
Several bug fixes:
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,9 @@
 | 
			
		||||
New features in CC: Tweaked 1.100.1
 | 
			
		||||
New features in CC: Tweaked 1.100.3
 | 
			
		||||
 | 
			
		||||
Several bug fixes:
 | 
			
		||||
* Fix `peripheral.hasType` not working with wired modems (Toad-Dev).
 | 
			
		||||
* Fix crashes when noisy pocket computer are shutdown.
 | 
			
		||||
* Fix client disconnect when uploading large files.
 | 
			
		||||
* Correctly handling empty computer ID file.
 | 
			
		||||
* Fix the normal turtle recipe not being unlocked.
 | 
			
		||||
* Remove turtle fake EntityType.
 | 
			
		||||
 | 
			
		||||
Type "help changelog" to see the full version history.
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user