mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-01-15 03:35:42 +00:00
Merge branch 'mc-1.16.x' into mc-1.17.x
This commit is contained in:
commit
4a4e8bb4b6
@ -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 :/. -->
|
<!-- 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><th>Button code</th><th>Mouse button</th></tr>
|
||||||
<tr><td align="right">1</td><td>Left button</td></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">2</td><td>Right button</td></tr>
|
||||||
<tr><td align="right">3</td><td>Right button</td></tr>
|
<tr><td align="right">3</td><td>Middle button</td></tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
org.gradle.jvmargs=-Xmx3G
|
org.gradle.jvmargs=-Xmx3G
|
||||||
|
|
||||||
# Mod properties
|
# Mod properties
|
||||||
mod_version=1.100.2
|
mod_version=1.100.3
|
||||||
|
|
||||||
# Minecraft properties (update mods.toml when changing)
|
# Minecraft properties (update mods.toml when changing)
|
||||||
mc_version=1.17.1
|
mc_version=1.17.1
|
||||||
|
@ -10,7 +10,6 @@ import dan200.computercraft.client.gui.*;
|
|||||||
import dan200.computercraft.client.render.TileEntityMonitorRenderer;
|
import dan200.computercraft.client.render.TileEntityMonitorRenderer;
|
||||||
import dan200.computercraft.client.render.TileEntityTurtleRenderer;
|
import dan200.computercraft.client.render.TileEntityTurtleRenderer;
|
||||||
import dan200.computercraft.client.render.TurtleModelLoader;
|
import dan200.computercraft.client.render.TurtleModelLoader;
|
||||||
import dan200.computercraft.client.render.TurtlePlayerRenderer;
|
|
||||||
import dan200.computercraft.shared.Registry;
|
import dan200.computercraft.shared.Registry;
|
||||||
import dan200.computercraft.shared.common.IColouredItem;
|
import dan200.computercraft.shared.common.IColouredItem;
|
||||||
import dan200.computercraft.shared.computer.inventory.ContainerComputerBase;
|
import dan200.computercraft.shared.computer.inventory.ContainerComputerBase;
|
||||||
@ -30,7 +29,6 @@ import net.minecraft.resources.ResourceLocation;
|
|||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.client.event.ColorHandlerEvent;
|
import net.minecraftforge.client.event.ColorHandlerEvent;
|
||||||
import net.minecraftforge.client.event.EntityRenderersEvent;
|
|
||||||
import net.minecraftforge.client.event.ModelRegistryEvent;
|
import net.minecraftforge.client.event.ModelRegistryEvent;
|
||||||
import net.minecraftforge.client.model.ModelLoader;
|
import net.minecraftforge.client.model.ModelLoader;
|
||||||
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
||||||
@ -122,12 +120,6 @@ public final class ClientRegistry
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public static void registerEntityRenderers( EntityRenderersEvent.RegisterRenderers event )
|
|
||||||
{
|
|
||||||
event.registerEntityRenderer( Registry.ModEntities.TURTLE_PLAYER.get(), TurtlePlayerRenderer::new );
|
|
||||||
}
|
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void setupClient( FMLClientSetupEvent event )
|
public static void setupClient( FMLClientSetupEvent event )
|
||||||
{
|
{
|
||||||
|
@ -21,6 +21,7 @@ import dan200.computercraft.shared.peripheral.modem.wireless.WirelessNetwork;
|
|||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.server.dedicated.DedicatedServer;
|
import net.minecraft.server.dedicated.DedicatedServer;
|
||||||
|
import net.minecraft.world.entity.EntityType;
|
||||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
import net.minecraft.world.inventory.AbstractContainerMenu;
|
||||||
import net.minecraft.world.level.storage.loot.BuiltInLootTables;
|
import net.minecraft.world.level.storage.loot.BuiltInLootTables;
|
||||||
import net.minecraft.world.level.storage.loot.LootPool;
|
import net.minecraft.world.level.storage.loot.LootPool;
|
||||||
@ -161,4 +162,14 @@ public final class CommonHooks
|
|||||||
NetworkHandler.sendToPlayer( event.getPlayer(), packet );
|
NetworkHandler.sendToPlayer( event.getPlayer(), packet );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@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();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,6 @@ import dan200.computercraft.shared.pocket.peripherals.PocketSpeaker;
|
|||||||
import dan200.computercraft.shared.pocket.recipes.PocketComputerUpgradeRecipe;
|
import dan200.computercraft.shared.pocket.recipes.PocketComputerUpgradeRecipe;
|
||||||
import dan200.computercraft.shared.turtle.blocks.BlockTurtle;
|
import dan200.computercraft.shared.turtle.blocks.BlockTurtle;
|
||||||
import dan200.computercraft.shared.turtle.blocks.TileTurtle;
|
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.inventory.ContainerTurtle;
|
||||||
import dan200.computercraft.shared.turtle.items.ItemTurtle;
|
import dan200.computercraft.shared.turtle.items.ItemTurtle;
|
||||||
import dan200.computercraft.shared.turtle.recipes.TurtleRecipe;
|
import dan200.computercraft.shared.turtle.recipes.TurtleRecipe;
|
||||||
@ -73,8 +72,6 @@ import dan200.computercraft.shared.util.ImpostorRecipe;
|
|||||||
import dan200.computercraft.shared.util.ImpostorShapelessRecipe;
|
import dan200.computercraft.shared.util.ImpostorShapelessRecipe;
|
||||||
import net.minecraft.core.cauldron.CauldronInteraction;
|
import net.minecraft.core.cauldron.CauldronInteraction;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.entity.EntityType;
|
|
||||||
import net.minecraft.world.entity.MobCategory;
|
|
||||||
import net.minecraft.world.inventory.MenuType;
|
import net.minecraft.world.inventory.MenuType;
|
||||||
import net.minecraft.world.item.BlockItem;
|
import net.minecraft.world.item.BlockItem;
|
||||||
import net.minecraft.world.item.CreativeModeTab;
|
import net.minecraft.world.item.CreativeModeTab;
|
||||||
@ -285,18 +282,6 @@ public final class Registry
|
|||||||
SERIALISERS.register( "wireless_modem_advanced", () -> PocketUpgradeSerialiser.simpleWithCustomItem( ( id, item ) -> new PocketModem( id, item, true ) ) );
|
SERIALISERS.register( "wireless_modem_advanced", () -> PocketUpgradeSerialiser.simpleWithCustomItem( ( id, item ) -> new PocketModem( id, item, true ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
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( MobCategory.MISC )
|
|
||||||
.noSave()
|
|
||||||
.noSummon()
|
|
||||||
.sized( 0, 0 )
|
|
||||||
.build( ComputerCraft.MOD_ID + ":turtle_player" ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class ModContainers
|
public static class ModContainers
|
||||||
{
|
{
|
||||||
static final DeferredRegister<MenuType<?>> CONTAINERS = DeferredRegister.create( ForgeRegistries.CONTAINERS, ComputerCraft.MOD_ID );
|
static final DeferredRegister<MenuType<?>> CONTAINERS = DeferredRegister.create( ForgeRegistries.CONTAINERS, ComputerCraft.MOD_ID );
|
||||||
@ -425,7 +410,6 @@ public final class Registry
|
|||||||
ModItems.ITEMS.register( bus );
|
ModItems.ITEMS.register( bus );
|
||||||
ModTurtleSerialisers.SERIALISERS.register( bus );
|
ModTurtleSerialisers.SERIALISERS.register( bus );
|
||||||
ModPocketUpgradeSerialisers.SERIALISERS.register( bus );
|
ModPocketUpgradeSerialisers.SERIALISERS.register( bus );
|
||||||
ModEntities.ENTITIES.register( bus );
|
|
||||||
ModContainers.CONTAINERS.register( bus );
|
ModContainers.CONTAINERS.register( bus );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,6 +160,7 @@ public class UploadFileMessage extends ComputerServerMessage
|
|||||||
contents.position( currentOffset ).limit( currentOffset + canWrite );
|
contents.position( currentOffset ).limit( currentOffset + canWrite );
|
||||||
slices.add( new FileSlice( fileId, currentOffset, contents.slice() ) );
|
slices.add( new FileSlice( fileId, currentOffset, contents.slice() ) );
|
||||||
currentOffset += canWrite;
|
currentOffset += canWrite;
|
||||||
|
remaining -= canWrite;
|
||||||
}
|
}
|
||||||
|
|
||||||
contents.position( 0 ).limit( capacity );
|
contents.position( 0 ).limit( capacity );
|
||||||
|
@ -8,7 +8,6 @@ package dan200.computercraft.shared.turtle.core;
|
|||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import dan200.computercraft.ComputerCraft;
|
import dan200.computercraft.ComputerCraft;
|
||||||
import dan200.computercraft.api.turtle.ITurtleAccess;
|
import dan200.computercraft.api.turtle.ITurtleAccess;
|
||||||
import dan200.computercraft.shared.Registry;
|
|
||||||
import dan200.computercraft.shared.util.DirectionUtil;
|
import dan200.computercraft.shared.util.DirectionUtil;
|
||||||
import dan200.computercraft.shared.util.InventoryUtil;
|
import dan200.computercraft.shared.util.InventoryUtil;
|
||||||
import dan200.computercraft.shared.util.WorldUtil;
|
import dan200.computercraft.shared.util.WorldUtil;
|
||||||
@ -22,7 +21,6 @@ import net.minecraft.world.MenuProvider;
|
|||||||
import net.minecraft.world.effect.MobEffectInstance;
|
import net.minecraft.world.effect.MobEffectInstance;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.EntityDimensions;
|
import net.minecraft.world.entity.EntityDimensions;
|
||||||
import net.minecraft.world.entity.EntityType;
|
|
||||||
import net.minecraft.world.entity.Pose;
|
import net.minecraft.world.entity.Pose;
|
||||||
import net.minecraft.world.entity.animal.horse.AbstractHorse;
|
import net.minecraft.world.entity.animal.horse.AbstractHorse;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
@ -197,13 +195,6 @@ public final class TurtlePlayer extends FakePlayer
|
|||||||
getInventory().setChanged();
|
getInventory().setChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
|
||||||
@Override
|
|
||||||
public EntityType<?> getType()
|
|
||||||
{
|
|
||||||
return Registry.ModEntities.TURTLE_PLAYER.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec3 position()
|
public Vec3 position()
|
||||||
{
|
{
|
||||||
|
@ -45,21 +45,17 @@ public final class IDAssigner
|
|||||||
return ServerLifecycleHooks.getCurrentServer().getWorldPath( FOLDER ).toFile();
|
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();
|
MinecraftServer currentServer = server.get();
|
||||||
if( currentServer == null ) return null;
|
return currentServer == null || currentServer != ServerLifecycleHooks.getCurrentServer();
|
||||||
|
|
||||||
if( currentServer != ServerLifecycleHooks.getCurrentServer() ) return null;
|
|
||||||
return currentServer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static synchronized int getNextId( String kind )
|
public static synchronized int getNextId( String kind )
|
||||||
{
|
{
|
||||||
MinecraftServer currentServer = getCachedServer();
|
if( hasServerChanged() )
|
||||||
if( currentServer == null )
|
|
||||||
{
|
{
|
||||||
// The server has changed, refetch our ID map
|
// The server has changed, refetch our ID map
|
||||||
server = new WeakReference<>( ServerLifecycleHooks.getCurrentServer() );
|
server = new WeakReference<>( ServerLifecycleHooks.getCurrentServer() );
|
||||||
@ -68,23 +64,22 @@ public final class IDAssigner
|
|||||||
dir.mkdirs();
|
dir.mkdirs();
|
||||||
|
|
||||||
// Load our ID file from disk
|
// Load our ID file from disk
|
||||||
|
Map<String, Integer> newIds = null;
|
||||||
idFile = new File( dir, "ids.json" ).toPath();
|
idFile = new File( dir, "ids.json" ).toPath();
|
||||||
if( Files.isRegularFile( idFile ) )
|
if( Files.isRegularFile( idFile ) )
|
||||||
{
|
{
|
||||||
try( Reader reader = Files.newBufferedReader( idFile, StandardCharsets.UTF_8 ) )
|
try( Reader reader = Files.newBufferedReader( idFile, StandardCharsets.UTF_8 ) )
|
||||||
{
|
{
|
||||||
ids = GSON.fromJson( reader, ID_TOKEN );
|
newIds = GSON.fromJson( reader, ID_TOKEN );
|
||||||
}
|
}
|
||||||
catch( Exception e )
|
catch( Exception e )
|
||||||
{
|
{
|
||||||
ComputerCraft.log.error( "Cannot load id file '" + idFile + "'", e );
|
ComputerCraft.log.error( "Cannot load id file '" + idFile + "'", e );
|
||||||
ids = new HashMap<>();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
if( newIds == null ) newIds = new HashMap<>();
|
||||||
ids = new HashMap<>();
|
ids = newIds;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Integer existing = ids.get( kind );
|
Integer existing = ids.get( kind );
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"parent": "minecraft:recipes/root",
|
"parent": "minecraft:recipes/root",
|
||||||
"rewards": {
|
"rewards": {
|
||||||
"recipes": [ "computercraft:normal_turtle_normal" ]
|
"recipes": [ "computercraft:turtle_normal" ]
|
||||||
},
|
},
|
||||||
"criteria": {
|
"criteria": {
|
||||||
"has_normal": {
|
"has_normal": {
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
# 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
|
# New features in CC: Tweaked 1.100.2
|
||||||
|
|
||||||
Several bug fixes:
|
Several bug fixes:
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
New features in CC: Tweaked 1.100.2
|
New features in CC: Tweaked 1.100.3
|
||||||
|
|
||||||
Several bug fixes:
|
Several bug fixes:
|
||||||
* Fix wired modems swapping the modem/peripheral block state.
|
* Fix client disconnect when uploading large files.
|
||||||
* Remove debugging logging line from `turtle.attack`.
|
* 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.
|
Type "help changelog" to see the full version history.
|
||||||
|
Loading…
Reference in New Issue
Block a user