-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #2 Start the playback when the world loads
-The world will start playing the startup.tas file
- Loading branch information
1 parent
93cc55b
commit 3a196b0
Showing
6 changed files
with
72 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 0 additions & 60 deletions
60
src/main/java/de/scribble/lp/tasmod/custom/CustomEntityRenderer.java
This file was deleted.
Oops, something went wrong.
18 changes: 18 additions & 0 deletions
18
src/main/java/de/scribble/lp/tasmod/events/TASmodEvents.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package de.scribble.lp.tasmod.events; | ||
|
||
import de.scribble.lp.tasmod.CommonProxy; | ||
import de.scribble.lp.tasmod.playback.PlaybackPacket; | ||
import de.scribble.lp.tasmod.ticksync.TickSyncPackage; | ||
import de.scribble.lp.tasmod.ticksync.TickSyncServer; | ||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; | ||
import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent; | ||
|
||
public class TASmodEvents { | ||
@SubscribeEvent | ||
public void playerLogin(PlayerLoggedInEvent ev) { | ||
TickSyncServer.resetTickCounter(); | ||
CommonProxy.NETWORK.sendToAll(new TickSyncPackage(TickSyncServer.getServertickcounter(), true, TickSyncServer.isEnabled())); | ||
|
||
CommonProxy.NETWORK.sendToAll(new PlaybackPacket()); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/de/scribble/lp/tasmod/playback/PlaybackPacket.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package de.scribble.lp.tasmod.playback; | ||
|
||
import io.netty.buffer.ByteBuf; | ||
import net.minecraftforge.fml.common.network.simpleimpl.IMessage; | ||
|
||
public class PlaybackPacket implements IMessage{ | ||
String filename; | ||
|
||
public PlaybackPacket() { | ||
} | ||
public PlaybackPacket(String filename) { | ||
this.filename=filename; | ||
} | ||
@Override | ||
public void fromBytes(ByteBuf buf) { | ||
} | ||
|
||
@Override | ||
public void toBytes(ByteBuf buf) { | ||
|
||
} | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
src/main/java/de/scribble/lp/tasmod/playback/PlaybackPacketHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package de.scribble.lp.tasmod.playback; | ||
|
||
import java.io.File; | ||
|
||
import net.minecraft.client.Minecraft; | ||
import net.minecraftforge.fml.common.network.simpleimpl.IMessage; | ||
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; | ||
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; | ||
import net.minecraftforge.fml.relauncher.Side; | ||
|
||
public class PlaybackPacketHandler implements IMessageHandler<PlaybackPacket, IMessage>{ | ||
|
||
@Override | ||
public IMessage onMessage(PlaybackPacket message, MessageContext ctx) { | ||
if(ctx.side==Side.CLIENT) { | ||
File file = new File(Minecraft.getMinecraft().mcDataDir, "saves" + File.separator + | ||
"tasfiles" + File.separator + "startup.tas"); | ||
if(file.exists()) { | ||
InputPlayback.startPlayback(file, "startup"); | ||
} | ||
} | ||
return null; | ||
} | ||
|
||
} |